From 36e986629afb57cb362d947e3032655c4df2943c Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 6 Oct 2019 12:59:18 +0200 Subject: [PATCH] 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 --- bitmaps_png/cpp_16/pinshape_clock_fall.cpp | 22 ++- .../sources/pinshape_clock_active_low.svg | 27 ++- bitmaps_png/sources/pinshape_clock_fall.svg | 41 ++++- bitmaps_png/sources/pinshape_clock_invert.svg | 27 ++- eeschema/lib_pin.cpp | 27 +-- eeschema/sch_painter.cpp | 174 +++++++++++------- 6 files changed, 199 insertions(+), 119 deletions(-) diff --git a/bitmaps_png/cpp_16/pinshape_clock_fall.cpp b/bitmaps_png/cpp_16/pinshape_clock_fall.cpp index b7b1e338af..f089321a06 100644 --- a/bitmaps_png/cpp_16/pinshape_clock_fall.cpp +++ b/bitmaps_png/cpp_16/pinshape_clock_fall.cpp @@ -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" }}; diff --git a/bitmaps_png/sources/pinshape_clock_active_low.svg b/bitmaps_png/sources/pinshape_clock_active_low.svg index 8c91813999..f03f65438b 100644 --- a/bitmaps_png/sources/pinshape_clock_active_low.svg +++ b/bitmaps_png/sources/pinshape_clock_active_low.svg @@ -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"> @@ -21,8 +21,23 @@ image/svg+xml - + + + + + + + + + + inkscape:version="0.92.0 r15299" + sodipodi:docname="pinshape_clock_active_low.svg"> @@ -21,8 +21,23 @@ image/svg+xml - + + + + + + + + + + + inkscape:version="0.92.0 r15299" + sodipodi:docname="pinshape_clock_invert.svg"> @@ -22,7 +22,22 @@ + + + + + + + + )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 ); diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index 9648a73643..cd6e7d81ab 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -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,76 +681,10 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer ) const int diam = radius*2; const int clock_size = InternalPinDecoSize( *aPin ); - if( shape == 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 ; - - triLine( p0 + VECTOR2D( dir.y, -dir.x) * clock_size, - pc, - p0 + VECTOR2D( -dir.y, dir.x) * clock_size ); - - m_gal->DrawLine( pos, pc ); - } - else + if( aPin->GetType() == PIN_NC ) // Draw a N.C. symbol { m_gal->DrawLine( p0, pos ); - } - 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 ) ); - } - } - - if( shape == PINSHAPE_INPUT_LOW ) - { - 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 ); - } - } - - if( shape == PINSHAPE_OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */ - { - 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 ); - } - - 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 ); - } - - 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 , @@ -756,6 +692,108 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer ) 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 ); + 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->DrawCircle( p0 + dir * radius, radius ); + m_gal->DrawLine( p0 + dir * ( diam ), pos ); + break; + + 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(!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 ); + } + + 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 ); + + 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->HasFlag( IS_DANGLING ) && ( aPin->IsVisible() || aPin->IsPowerConnection() ) ) drawPinDanglingSymbol( pos, drawingShadows );