← Back to team overview

kicad-lib-committers team mailing list archive

Re: New "Library Convention" and his influences with current EEschema code

 

On Fri, May 09, 2014 at 07:37:38PM +0200, Lorenzo Marcantonio wrote:
> On Fri, May 09, 2014 at 06:29:14PM +0200, Kerusey Karyu wrote:
> > Some pin graphics must be reviewed/recoded to keep 0.100" or 0.150" pin
> > length for black-boxed symbols (That's why I don't use these graphics
> > options).

Here you go, patched the code for right shape and size (it uses the
number size). Of course if you use one of the 'outer' decorations you'll
need to make the pin longer.

If nobody has something to say on that I'll commit it in about a week.

-- 
Lorenzo Marcantonio
Logos Srl
=== modified file 'eeschema/lib_pin.cpp'
--- eeschema/lib_pin.cpp	2014-05-04 17:08:36 +0000
+++ eeschema/lib_pin.cpp	2014-05-11 07:58:33 +0000
@@ -907,32 +907,32 @@
 
     if( m_shape & INVERT )
     {
-        GRCircle( clipbox, aDC, MapX1 * INVERT_PIN_RADIUS + x1,
-                  MapY1 * INVERT_PIN_RADIUS + y1,
-                  INVERT_PIN_RADIUS, width, color );
+        GRCircle( clipbox, aDC, MapX1 * m_numTextSize/2 + x1,
+                  MapY1 * m_numTextSize/2 + y1,
+                  m_numTextSize/2, width, color );
 
-        GRMoveTo( MapX1 * INVERT_PIN_RADIUS * 2 + x1,
-                  MapY1 * INVERT_PIN_RADIUS * 2 + y1 );
+        GRMoveTo( MapX1 * m_numTextSize/2 * 2 + x1,
+                  MapY1 * m_numTextSize/2 * 2 + y1 );
         GRLineTo( clipbox, aDC, posX, posY, width, color );
     }
     else if( m_shape & CLOCK_FALL ) /* an alternative for Inverted Clock */
     {
-        GRMoveTo( x1 + MapY1 * CLOCK_PIN_DIM,
-                  y1 - MapX1 * CLOCK_PIN_DIM );
-        GRLineTo( clipbox,
-                  aDC,
-                  x1 + MapX1 * CLOCK_PIN_DIM,
-                  y1 + MapY1 * CLOCK_PIN_DIM,
-                  width,
-                  color );
-        GRLineTo( clipbox,
-                  aDC,
-                  x1 - MapY1 * CLOCK_PIN_DIM,
-                  y1 + MapX1 * CLOCK_PIN_DIM,
-                  width,
-                  color );
-        GRMoveTo( MapX1 * CLOCK_PIN_DIM + x1,
-                  MapY1 * CLOCK_PIN_DIM + y1 );
+        GRMoveTo( x1 + MapY1 * m_numTextSize/2,
+                  y1 - MapX1 * m_numTextSize/2 );
+        GRLineTo( clipbox,
+                  aDC,
+                  x1 + MapX1 * m_numTextSize/2,
+                  y1 + MapY1 * m_numTextSize/2,
+                  width,
+                  color );
+        GRLineTo( clipbox,
+                  aDC,
+                  x1 - MapY1 * m_numTextSize/2,
+                  y1 + MapX1 * m_numTextSize/2,
+                  width,
+                  color );
+        GRMoveTo( MapX1 * m_numTextSize/2 + x1,
+                  MapY1 * m_numTextSize/2 + y1 );
         GRLineTo( clipbox, aDC, posX, posY, width, color );
     }
     else
@@ -945,32 +945,32 @@
     {
         if( MapY1 == 0 ) /* MapX1 = +- 1 */
         {
-            GRMoveTo( x1, y1 + CLOCK_PIN_DIM );
+            GRMoveTo( x1, y1 + m_numTextSize/2 );
             GRLineTo( clipbox,
                       aDC,
-                      x1 - MapX1 * CLOCK_PIN_DIM,
+                      x1 - MapX1 * m_numTextSize/2,
                       y1,
                       width,
                       color );
             GRLineTo( clipbox,
                       aDC,
                       x1,
-                      y1 - CLOCK_PIN_DIM,
+                      y1 - m_numTextSize/2,
                       width,
                       color );
         }
         else    /* MapX1 = 0 */
         {
-            GRMoveTo( x1 + CLOCK_PIN_DIM, y1 );
+            GRMoveTo( x1 + m_numTextSize/2, y1 );
             GRLineTo( clipbox,
                       aDC,
                       x1,
-                      y1 - MapY1 * CLOCK_PIN_DIM,
+                      y1 - MapY1 * m_numTextSize/2,
                       width,
                       color );
             GRLineTo( clipbox,
                       aDC,
-                      x1 - CLOCK_PIN_DIM,
+                      x1 - m_numTextSize/2,
                       y1,
                       width,
                       color );
@@ -981,20 +981,20 @@
     {
         if( MapY1 == 0 )            /* MapX1 = +- 1 */
         {
-            GRMoveTo( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 );
+            GRMoveTo( x1 + MapX1 * m_numTextSize, y1 );
             GRLineTo( clipbox,
                       aDC,
-                      x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
-                      y1 - IEEE_SYMBOL_PIN_DIM,
+                      x1 + MapX1 * m_numTextSize,
+                      y1 - m_numTextSize,
                       width,
                       color );
             GRLineTo( clipbox, aDC, x1, y1, width, color );
         }
         else    /* MapX1 = 0 */
         {
-            GRMoveTo( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 );
-            GRLineTo( clipbox, aDC, x1 - IEEE_SYMBOL_PIN_DIM,
-                      y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2, width, color );
+            GRMoveTo( x1, y1 + MapY1 * m_numTextSize );
+            GRLineTo( clipbox, aDC, x1 - m_numTextSize,
+                      y1 + MapY1 * m_numTextSize, width, color );
             GRLineTo( clipbox, aDC, x1, y1, width, color );
         }
     }
@@ -1004,48 +1004,50 @@
     {
         if( MapY1 == 0 )            /* MapX1 = +- 1 */
         {
-            GRMoveTo( x1, y1 - IEEE_SYMBOL_PIN_DIM );
+            GRMoveTo( x1, y1 - m_numTextSize );
             GRLineTo( clipbox,
                       aDC,
-                      x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
+                      x1 + MapX1 * m_numTextSize,
                       y1,
                       width,
                       color );
         }
         else    /* MapX1 = 0 */
         {
-            GRMoveTo( x1 - IEEE_SYMBOL_PIN_DIM, y1 );
+            GRMoveTo( x1 - m_numTextSize, y1 );
             GRLineTo( clipbox,
                       aDC,
                       x1,
-                      y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2,
+                      y1 + MapY1 * m_numTextSize,
                       width,
                       color );
         }
     }
     else if( m_shape & NONLOGIC ) /* NonLogic pin symbol */
     {
-        GRMoveTo( x1 - (MapX1 + MapY1) * NONLOGIC_PIN_DIM,
-                  y1 - (MapY1 - MapX1) * NONLOGIC_PIN_DIM );
+        GRMoveTo( x1 - (MapX1 + MapY1) * m_numTextSize/2,
+                  y1 - (MapY1 - MapX1) * m_numTextSize/2 );
         GRLineTo( clipbox,
                   aDC,
-                  x1 + (MapX1 + MapY1) * NONLOGIC_PIN_DIM,
-                  y1 + (MapY1 - MapX1) * NONLOGIC_PIN_DIM,
+                  x1 + (MapX1 + MapY1) * m_numTextSize/2,
+                  y1 + (MapY1 - MapX1) * m_numTextSize/2,
                   width,
                   color );
-        GRMoveTo( x1 - (MapX1 - MapY1) * NONLOGIC_PIN_DIM,
-                  y1 - (MapY1 + MapX1) * NONLOGIC_PIN_DIM );
+        GRMoveTo( x1 - (MapX1 - MapY1) * m_numTextSize/2,
+                  y1 - (MapY1 + MapX1) * m_numTextSize/2 );
         GRLineTo( clipbox,
                   aDC,
-                  x1 + (MapX1 - MapY1) * NONLOGIC_PIN_DIM,
-                  y1 + (MapY1 + MapX1) * NONLOGIC_PIN_DIM,
+                  x1 + (MapX1 - MapY1) * m_numTextSize/2,
+                  y1 + (MapY1 + MapX1) * m_numTextSize/2,
                   width,
                   color );
     }
 
     // Draw the pin end target (active end of the pin)
     BASE_SCREEN* screen = aPanel ? aPanel->GetScreen() : NULL;
-    #define NCSYMB_PIN_DIM TARGET_PIN_RADIUS
+
+    // Same as the noconnect symbol as manually placed
+#define NCSYMB_PIN_DIM 24
 
     if( m_type == PIN_NC )   // Draw a N.C. symbol
     {
@@ -1310,14 +1312,14 @@
 
     if( m_shape & INVERT )
     {
-        aPlotter->Circle( wxPoint( MapX1 * INVERT_PIN_RADIUS + x1,
-                                   MapY1 * INVERT_PIN_RADIUS + y1 ),
-                          INVERT_PIN_RADIUS * 2, // diameter
+        aPlotter->Circle( wxPoint( MapX1 * m_numTextSize/2 + x1,
+                                   MapY1 * m_numTextSize/2 + y1 ),
+                          m_numTextSize/2 * 2, // diameter
                           NO_FILL,               // fill option
                           GetPenSize() );       // width
 
-        aPlotter->MoveTo( wxPoint( MapX1 * INVERT_PIN_RADIUS * 2 + x1,
-                                    MapY1 * INVERT_PIN_RADIUS * 2 + y1 ) );
+        aPlotter->MoveTo( wxPoint( MapX1 * m_numTextSize/2 * 2 + x1,
+                                    MapY1 * m_numTextSize/2 * 2 + y1 ) );
         aPlotter->FinishTo( aPosition );
     }
     else
@@ -1330,15 +1332,15 @@
     {
         if( MapY1 == 0 ) /* MapX1 = +- 1 */
         {
-            aPlotter->MoveTo( wxPoint( x1, y1 + CLOCK_PIN_DIM ) );
-            aPlotter->LineTo( wxPoint( x1 - MapX1 * CLOCK_PIN_DIM, y1 ) );
-            aPlotter->FinishTo( wxPoint( x1, y1 - CLOCK_PIN_DIM ) );
+            aPlotter->MoveTo( wxPoint( x1, y1 + m_numTextSize/2 ) );
+            aPlotter->LineTo( wxPoint( x1 - MapX1 * m_numTextSize/2, y1 ) );
+            aPlotter->FinishTo( wxPoint( x1, y1 - m_numTextSize/2 ) );
         }
         else    /* MapX1 = 0 */
         {
-            aPlotter->MoveTo( wxPoint( x1 + CLOCK_PIN_DIM, y1 ) );
-            aPlotter->LineTo( wxPoint( x1, y1 - MapY1 * CLOCK_PIN_DIM ) );
-            aPlotter->FinishTo( wxPoint( x1 - CLOCK_PIN_DIM, y1 ) );
+            aPlotter->MoveTo( wxPoint( x1 + m_numTextSize/2, y1 ) );
+            aPlotter->LineTo( wxPoint( x1, y1 - MapY1 * m_numTextSize/2 ) );
+            aPlotter->FinishTo( wxPoint( x1 - m_numTextSize/2, y1 ) );
         }
     }
 
@@ -1346,16 +1348,16 @@
     {
         if( MapY1 == 0 )        /* MapX1 = +- 1 */
         {
-            aPlotter->MoveTo( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 ) );
-            aPlotter->LineTo( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
-                                        y1 - IEEE_SYMBOL_PIN_DIM ) );
+            aPlotter->MoveTo( wxPoint( x1 + MapX1 * m_numTextSize, y1 ) );
+            aPlotter->LineTo( wxPoint( x1 + MapX1 * m_numTextSize,
+                                        y1 - m_numTextSize ) );
             aPlotter->FinishTo( wxPoint( x1, y1 ) );
         }
         else    /* MapX1 = 0 */
         {
-            aPlotter->MoveTo( wxPoint( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
-            aPlotter->LineTo( wxPoint( x1 - IEEE_SYMBOL_PIN_DIM,
-                                        y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
+            aPlotter->MoveTo( wxPoint( x1, y1 + MapY1 * m_numTextSize ) );
+            aPlotter->LineTo( wxPoint( x1 - m_numTextSize,
+                                        y1 + MapY1 * m_numTextSize ) );
             aPlotter->FinishTo( wxPoint( x1, y1 ) );
         }
     }
@@ -1365,13 +1367,13 @@
     {
         if( MapY1 == 0 )        /* MapX1 = +- 1 */
         {
-            aPlotter->MoveTo( wxPoint( x1, y1 - IEEE_SYMBOL_PIN_DIM ) );
-            aPlotter->FinishTo( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 ) );
+            aPlotter->MoveTo( wxPoint( x1, y1 - m_numTextSize ) );
+            aPlotter->FinishTo( wxPoint( x1 + MapX1 * m_numTextSize, y1 ) );
         }
         else    /* MapX1 = 0 */
         {
-            aPlotter->MoveTo( wxPoint( x1 - IEEE_SYMBOL_PIN_DIM, y1 ) );
-            aPlotter->FinishTo( wxPoint( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
+            aPlotter->MoveTo( wxPoint( x1 - m_numTextSize, y1 ) );
+            aPlotter->FinishTo( wxPoint( x1, y1 + MapY1 * m_numTextSize ) );
         }
     }
 }
@@ -1897,7 +1899,7 @@
     int numberTextHeight  = showNum ? KiROUND( m_numTextSize * 1.1 ) : 0;
 
     if( m_shape & INVERT )
-        minsizeV = std::max( TARGET_PIN_RADIUS, INVERT_PIN_RADIUS );
+        minsizeV = std::max( TARGET_PIN_RADIUS, m_numTextSize/2 );
 
     // calculate top left corner position
     // for the default pin orientation (PIN_RIGHT)

=== modified file 'eeschema/lib_pin.h'
--- eeschema/lib_pin.h	2014-05-04 17:08:36 +0000
+++ eeschema/lib_pin.h	2014-05-11 07:59:00 +0000
@@ -33,13 +33,7 @@
 
 
 #define TARGET_PIN_RADIUS   12  // Circle diameter drawn at the active end of pins
-#define DEFAULT_PIN_LENGTH  300 // Default Length of a pin when it is created.
-
-// pins: special symbols sizes
-#define INVERT_PIN_RADIUS   30  // Radius of inverted pin circle.
-#define CLOCK_PIN_DIM       40  // Dim of clock pin symbol.
-#define IEEE_SYMBOL_PIN_DIM 40  // Dim of special pin symbol.
-#define NONLOGIC_PIN_DIM    30  // Dim of nonlogic pin symbol (X).
+#define DEFAULT_PIN_LENGTH  100 // Default Length of a pin when it is created.
 
 /**
  * The component library pin object electrical types used in ERC tests.


Follow ups

References