Eeschema: fix issues with pin shapes related to clock input pin shapes.

* Fix not drawn shapes for clock low, inverted clock and broken shape for falling edge clock
* Especially, shape for falling edge clock was a not existing shape, therefore useless.
* now falling edge clock and clock low shape are similar.

Fixes: lp:1846901
https://bugs.launchpad.net/kicad/+bug/1846901
This commit is contained in:
jean-pierre charras 2019-10-06 12:59:18 +02:00
parent 8c2ee6c025
commit 36e986629a
6 changed files with 199 additions and 119 deletions

View File

@ -8,14 +8,20 @@
static const unsigned char png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff,
0x61, 0x00, 0x00, 0x00, 0x60, 0x49, 0x44, 0x41, 0x54, 0x38, 0xcb, 0x63, 0x90, 0x92, 0x92, 0xfa,
0x0f, 0xc2, 0x0c, 0xe4, 0x02, 0xaa, 0x19, 0x20, 0x2e, 0x2e, 0x2e, 0x46, 0x91, 0x01, 0xd2, 0xd2,
0xd2, 0x97, 0xc9, 0x32, 0x04, 0x66, 0x00, 0x14, 0x5f, 0x97, 0x97, 0x97, 0x97, 0x24, 0xd7, 0x80,
0x4b, 0x64, 0x19, 0x02, 0x33, 0x40, 0x42, 0x42, 0x42, 0x94, 0x2c, 0x43, 0x90, 0x63, 0x01, 0x14,
0x06, 0xa0, 0xb0, 0x40, 0xf3, 0x16, 0x5e, 0x4c, 0x3d, 0x03, 0xd0, 0xbd, 0x20, 0x2a, 0x2a, 0x2a,
0x41, 0x76, 0x20, 0x12, 0xad, 0x19, 0x5b, 0x34, 0x92, 0xa4, 0x99, 0xaa, 0x09, 0x89, 0xe2, 0xa4,
0x3c, 0x60, 0xb9, 0x11, 0x00, 0xd8, 0xbd, 0x63, 0x3e, 0x86, 0xe5, 0x97, 0x0f, 0x00, 0x00, 0x00,
0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
0x61, 0x00, 0x00, 0x00, 0xb9, 0x49, 0x44, 0x41, 0x54, 0x38, 0xcb, 0x63, 0x60, 0x40, 0x03, 0x52,
0x52, 0x52, 0xff, 0x41, 0x98, 0x01, 0x0b, 0x10, 0x11, 0x11, 0xe1, 0x95, 0x94, 0x94, 0xdc, 0xca,
0x80, 0x0f, 0xe0, 0x32, 0x40, 0x5a, 0x5a, 0x5a, 0x06, 0x28, 0x7e, 0x1e, 0x97, 0xe1, 0x70, 0x1b,
0xb0, 0x19, 0x20, 0x23, 0x23, 0x63, 0x06, 0x14, 0x7b, 0x81, 0xcf, 0x75, 0x20, 0xc0, 0x08, 0xb4,
0x65, 0x2d, 0xba, 0x22, 0xa0, 0x93, 0x83, 0x80, 0xfc, 0xaf, 0x30, 0x71, 0x9c, 0x06, 0x00, 0x35,
0xd7, 0xa0, 0x2b, 0x02, 0xd2, 0x65, 0x40, 0xfc, 0x17, 0x2a, 0x36, 0x0b, 0xa7, 0x01, 0x40, 0x41,
0x37, 0x20, 0xfe, 0x83, 0xa4, 0x18, 0x84, 0xa7, 0x42, 0xe9, 0x7f, 0x40, 0xdc, 0x80, 0x33, 0x7c,
0x80, 0xfe, 0x53, 0x05, 0x0a, 0xbe, 0x07, 0x49, 0x00, 0x9d, 0x5b, 0x85, 0xec, 0x0a, 0x20, 0xfe,
0x0e, 0xc4, 0x11, 0x78, 0x03, 0x18, 0x28, 0x70, 0x05, 0x24, 0x08, 0xf2, 0x3f, 0x28, 0x1c, 0xd0,
0x0c, 0x20, 0x88, 0x29, 0x37, 0x40, 0x5c, 0x5c, 0x5c, 0x11, 0xc8, 0x78, 0x03, 0x35, 0xa4, 0x9a,
0x50, 0x54, 0xe1, 0x4a, 0x3c, 0xae, 0xe8, 0x81, 0xc8, 0x40, 0x2a, 0x40, 0xb6, 0x9d, 0x2c, 0x03,
0x70, 0x25, 0x24, 0x92, 0x00, 0xae, 0xa4, 0x4c, 0x6a, 0x78, 0xd0, 0xd7, 0x00, 0x00, 0xe0, 0x1c,
0x80, 0xeb, 0x37, 0x41, 0x6c, 0xd9, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42,
0x60, 0x82,
};
const BITMAP_OPAQUE pinshape_clock_fall_xpm[1] = {{ png, sizeof( png ), "pinshape_clock_fall_xpm" }};

View File

@ -11,7 +11,7 @@
width="16"
version="1.1"
id="svg2"
inkscape:version="0.48.4 r9939"
inkscape:version="0.92.0 r15299"
sodipodi:docname="pinshape_clock_active_low.svg">
<metadata
id="metadata22">
@ -21,8 +21,23 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
<dc:title></dc:title>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by/4.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by/4.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
</cc:License>
</rdf:RDF>
</metadata>
<defs
@ -36,15 +51,15 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="744"
inkscape:window-width="1920"
inkscape:window-height="1033"
id="namedview18"
showgrid="true"
inkscape:zoom="24.969708"
inkscape:cx="4.4578733"
inkscape:cy="9.2981956"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-x="-4"
inkscape:window-y="-4"
inkscape:window-maximized="1"
inkscape:current-layer="svg2">
<inkscape:grid

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -11,8 +11,8 @@
width="16"
version="1.1"
id="svg2"
inkscape:version="0.48.4 r9939"
sodipodi:docname="pinshape_clock_fall.svg">
inkscape:version="0.92.0 r15299"
sodipodi:docname="pinshape_clock_active_low.svg">
<metadata
id="metadata22">
<rdf:RDF>
@ -21,8 +21,23 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
<dc:title></dc:title>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by/4.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by/4.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
</cc:License>
</rdf:RDF>
</metadata>
<defs
@ -36,15 +51,15 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="744"
inkscape:window-width="1920"
inkscape:window-height="1033"
id="namedview18"
showgrid="true"
inkscape:zoom="24.969708"
inkscape:cx="4.4578733"
inkscape:cy="9.2981956"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-x="-4"
inkscape:window-y="-4"
inkscape:window-maximized="1"
inkscape:current-layer="svg2">
<inkscape:grid
@ -56,19 +71,25 @@
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<path
d="M 1,0 1,16"
d="M 5,0 5,16"
id="path12"
inkscape:connector-curvature="0"
style="fill:none;stroke:#1a1a1a;stroke-width:2;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none"
sodipodi:nodetypes="cc" />
<path
d="M 6,8 16,8"
d="M 5,8 16,8"
id="path14"
inkscape:connector-curvature="0"
style="fill:none;stroke:#1a1a1a;stroke-width:2;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none"
sodipodi:nodetypes="cc" />
<path
d="M 1,13 6,8 1,3"
sodipodi:nodetypes="ccc"
style="fill:none;stroke:#1a1a1a;stroke-width:2;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none"
inkscape:connector-curvature="0"
id="path4010"
d="m 5,8 7,-6 0,6" />
<path
d="M 5,13 1,8 5,3"
id="path4094"
inkscape:connector-curvature="0"
style="fill:none;stroke:#1a1a1a;stroke-width:2;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none"

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -11,8 +11,8 @@
width="16"
version="1.1"
id="svg2"
inkscape:version="0.48.4 r9939"
sodipodi:docname="pinshape_clock_normal.svg">
inkscape:version="0.92.0 r15299"
sodipodi:docname="pinshape_clock_invert.svg">
<metadata
id="metadata22">
<rdf:RDF>
@ -22,7 +22,22 @@
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by/4.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by/4.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
</cc:License>
</rdf:RDF>
</metadata>
<defs
@ -36,15 +51,15 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="744"
inkscape:window-width="1920"
inkscape:window-height="1033"
id="namedview18"
showgrid="true"
inkscape:zoom="24.969708"
inkscape:cx="18.434809"
inkscape:cy="9.4183412"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-x="-4"
inkscape:window-y="-4"
inkscape:window-maximized="1"
inkscape:current-layer="svg2">
<inkscape:grid

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -609,31 +609,15 @@ void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
GRMoveTo( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 );
GRLineTo( nullptr, aDC, posX, posY, width, color );
}
else if( m_shape == PINSHAPE_FALLING_EDGE_CLOCK ) /* an alternative for Inverted Clock */
{
const int deco_size = InternalPinDecoSize( *this );
if( MapY1 == 0 ) /* MapX1 = +- 1 */
{
GRMoveTo( x1, y1 + deco_size );
GRLineTo( nullptr, aDC, x1 + MapX1 * deco_size * 2, y1, width, color );
GRLineTo( nullptr, aDC, x1, y1 - deco_size, width, color );
}
else /* MapX1 = 0 */
{
GRMoveTo( x1 + deco_size, y1 );
GRLineTo( nullptr, aDC, x1, y1 + MapY1 * deco_size * 2, width, color );
GRLineTo( nullptr, aDC, x1 - deco_size, y1, width, color );
}
GRMoveTo( MapX1 * deco_size * 2 + x1, MapY1 * deco_size * 2 + y1 );
GRLineTo( nullptr, aDC, posX, posY, width, color );
}
else
{
GRMoveTo( x1, y1 );
GRLineTo( nullptr, aDC, posX, posY, width, color );
}
if( m_shape == PINSHAPE_CLOCK || m_shape == PINSHAPE_INVERTED_CLOCK || m_shape == PINSHAPE_CLOCK_LOW )
// Draw the clock shape (>)inside the symbol
if( m_shape == PINSHAPE_CLOCK || m_shape == PINSHAPE_INVERTED_CLOCK ||
m_shape == PINSHAPE_FALLING_EDGE_CLOCK || m_shape == PINSHAPE_CLOCK_LOW )
{
const int clock_size = InternalPinDecoSize( *this );
if( MapY1 == 0 ) /* MapX1 = +- 1 */
@ -650,7 +634,9 @@ void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
}
}
if( m_shape == PINSHAPE_INPUT_LOW || m_shape == PINSHAPE_CLOCK_LOW )
// Draw the active low (or H to L active transition)
if( m_shape == PINSHAPE_INPUT_LOW ||
m_shape == PINSHAPE_FALLING_EDGE_CLOCK || m_shape == PINSHAPE_CLOCK_LOW )
{
const int deco_size = ExternalPinDecoSize( *this );
if( MapY1 == 0 ) /* MapX1 = +- 1 */
@ -667,7 +653,6 @@ void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
}
}
if( m_shape == PINSHAPE_OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
{
const int deco_size = ExternalPinDecoSize( *this );

View File

@ -642,7 +642,6 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
VECTOR2I p0;
VECTOR2I dir;
int len = aPin->GetLength();
int shape = aPin->GetShape();
int orient = aPin->GetOrientation();
switch( orient )
@ -651,14 +650,17 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
p0 = VECTOR2I( pos.x, pos.y - len );
dir = VECTOR2I(0, 1);
break;
case PIN_DOWN:
p0 = VECTOR2I( pos.x, pos.y + len );
dir = VECTOR2I(0, -1);
break;
case PIN_LEFT:
p0 = VECTOR2I( pos.x - len, pos.y );
dir = VECTOR2I(1, 0);
break;
default:
case PIN_RIGHT:
p0 = VECTOR2I( pos.x + len, pos.y );
@ -679,44 +681,49 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
const int diam = radius*2;
const int clock_size = InternalPinDecoSize( *aPin );
if( shape == PINSHAPE_INVERTED )
if( aPin->GetType() == PIN_NC ) // Draw a N.C. symbol
{
m_gal->DrawLine( p0, pos );
m_gal->DrawLine( pos + VECTOR2D( -1, -1 ) * TARGET_PIN_RADIUS,
pos + VECTOR2D( 1, 1 ) * TARGET_PIN_RADIUS );
m_gal->DrawLine( pos + VECTOR2D( 1, -1 ) * TARGET_PIN_RADIUS ,
pos + VECTOR2D( -1, 1 ) * TARGET_PIN_RADIUS );
aPin->ClearFlags( IS_DANGLING ); // PIN_NC pin type is always not connected and dangling.
}
else
{
switch( aPin->GetShape() )
{
case PINSHAPE_LINE:
m_gal->DrawLine( p0, pos );
break;
case PINSHAPE_INVERTED:
m_gal->DrawCircle( p0 + dir * radius, radius );
m_gal->DrawLine( p0 + dir * ( diam ), pos );
}
else if( shape == PINSHAPE_FALLING_EDGE_CLOCK )
{
pc = p0 + dir * clock_size ;
break;
case PINSHAPE_INVERTED_CLOCK:
pc = p0 - dir * clock_size ;
triLine( p0 + VECTOR2D( dir.y, -dir.x) * clock_size,
pc,
p0 + VECTOR2D( -dir.y, dir.x) * clock_size );
m_gal->DrawLine( pos, pc );
}
else
{
m_gal->DrawLine( p0, pos );
}
m_gal->DrawCircle( p0 + dir * radius, radius );
m_gal->DrawLine( p0 + dir * ( diam ), pos );
break;
if( shape == PINSHAPE_CLOCK )
{
if (!dir.y)
{
triLine( p0 + VECTOR2D( 0, clock_size ),
p0 + VECTOR2D( -dir.x * clock_size, 0 ),
p0 + VECTOR2D( 0, -clock_size ) );
}
else
{
triLine( p0 + VECTOR2D( clock_size, 0 ),
p0 + VECTOR2D( 0, -dir.y * clock_size ),
p0 + VECTOR2D( -clock_size, 0 ) );
}
}
case PINSHAPE_CLOCK_LOW:
case PINSHAPE_FALLING_EDGE_CLOCK:
pc = p0 - dir * clock_size ;
triLine( p0 + VECTOR2D( dir.y, -dir.x) * clock_size,
pc,
p0 + VECTOR2D( -dir.y, dir.x) * clock_size );
if( shape == PINSHAPE_INPUT_LOW )
{
if(!dir.y)
{
triLine( p0 + VECTOR2D(dir.x, 0) * diam,
@ -729,33 +736,64 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
p0 + VECTOR2D(-1, dir.y) * diam,
p0 );
}
}
if( shape == PINSHAPE_OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
m_gal->DrawLine( p0, pos );
break;
case PINSHAPE_CLOCK:
m_gal->DrawLine( p0, pos );
if (!dir.y)
{
triLine( p0 + VECTOR2D( 0, clock_size ),
p0 + VECTOR2D( -dir.x * clock_size, 0 ),
p0 + VECTOR2D( 0, -clock_size ) );
}
else
{
triLine( p0 + VECTOR2D( clock_size, 0 ),
p0 + VECTOR2D( 0, -dir.y * clock_size ),
p0 + VECTOR2D( -clock_size, 0 ) );
}
break;
case PINSHAPE_INPUT_LOW:
m_gal->DrawLine( p0, pos );
if(!dir.y)
{
triLine( p0 + VECTOR2D(dir.x, 0) * diam,
p0 + VECTOR2D(dir.x, -1) * diam,
p0 );
}
else /* MapX1 = 0 */
{
triLine( p0 + VECTOR2D( 0, dir.y) * diam,
p0 + VECTOR2D(-1, dir.y) * diam,
p0 );
}
break;
case PINSHAPE_OUTPUT_LOW: // IEEE symbol "Active Low Output"
m_gal->DrawLine( p0, pos );
if( !dir.y ) // Horizontal pin
m_gal->DrawLine( p0 - VECTOR2D( 0, diam ), p0 + VECTOR2D( dir.x, 0 ) * diam );
else // Vertical pin
m_gal->DrawLine( p0 - VECTOR2D( diam, 0 ), p0 + VECTOR2D( 0, dir.y ) * diam );
}
break;
case PINSHAPE_NONLOGIC: // NonLogic pin symbol
m_gal->DrawLine( p0, pos );
if( shape == PINSHAPE_NONLOGIC ) /* NonLogic pin symbol */
{
m_gal->DrawLine( p0 - VECTOR2D( dir.x + dir.y, dir.y - dir.x ) * radius,
p0 + VECTOR2D( dir.x + dir.y, dir.y - dir.x ) * radius );
m_gal->DrawLine( p0 - VECTOR2D( dir.x - dir.y, dir.x + dir.y ) * radius,
p0 + VECTOR2D( dir.x - dir.y, dir.x + dir.y ) * radius );
break;
}
}
if( aPin->GetType() == PIN_NC ) // Draw a N.C. symbol
{
m_gal->DrawLine( pos + VECTOR2D( -1, -1 ) * TARGET_PIN_RADIUS,
pos + VECTOR2D( 1, 1 ) * TARGET_PIN_RADIUS );
m_gal->DrawLine( pos + VECTOR2D( 1, -1 ) * TARGET_PIN_RADIUS ,
pos + VECTOR2D( -1, 1 ) * TARGET_PIN_RADIUS );
aPin->ClearFlags( IS_DANGLING ); // PIN_NC pin type is always not connected and dangling.
}
if( aPin->HasFlag( IS_DANGLING ) && ( aPin->IsVisible() || aPin->IsPowerConnection() ) )
drawPinDanglingSymbol( pos, drawingShadows );