Eeschema: fix connection indicators for power symbol targets.

This commit is contained in:
Chris Pavlina 2015-07-21 10:07:52 -04:00 committed by Wayne Stambaugh
parent ca0849b968
commit 3921f78ac2
4 changed files with 51 additions and 28 deletions

View File

@ -384,6 +384,8 @@ void LIB_PART::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOffset,
if( drawItem.Type() == LIB_PIN_T ) if( drawItem.Type() == LIB_PIN_T )
{ {
LIB_PIN& pin = dynamic_cast<LIB_PIN&>( drawItem );
uintptr_t flags = 0; uintptr_t flags = 0;
if( aShowPinText ) if( aShowPinText )
flags |= PIN_DRAW_TEXTS; flags |= PIN_DRAW_TEXTS;
@ -391,6 +393,9 @@ void LIB_PART::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOffset,
if( !aPinsDangling || (aPinsDangling->size() > pin_index && (*aPinsDangling)[pin_index] ) ) if( !aPinsDangling || (aPinsDangling->size() > pin_index && (*aPinsDangling)[pin_index] ) )
flags |= PIN_DRAW_DANGLING; flags |= PIN_DRAW_DANGLING;
if( pin.IsPowerConnection() && IsPower() )
flags |= PIN_DANGLING_HIDDEN;
drawItem.Draw( aPanel, aDc, aOffset, aColor, aDrawMode, (void*) flags, aTransform ); drawItem.Draw( aPanel, aDc, aOffset, aColor, aDrawMode, (void*) flags, aTransform );
++pin_index; ++pin_index;

View File

@ -857,6 +857,20 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel,
void* aData, void* aData,
const TRANSFORM& aTransform ) const TRANSFORM& aTransform )
{ {
// aData is used here as a bitfield of flags.
uintptr_t flags = (uintptr_t) aData;
bool drawPinText = flags & PIN_DRAW_TEXTS;
bool drawPinDangling = flags & PIN_DRAW_DANGLING;
bool drawDanglingHidden = flags & PIN_DANGLING_HIDDEN;
LIB_PART* Entry = GetParent();
/* Calculate pin orient taking in account the component orientation. */
int orient = PinDrawOrient( aTransform );
/* Calculate the pin position */
wxPoint pos1 = aTransform.TransformCoordinate( m_position ) + aOffset;
// Invisible pins are only drawn on request. // Invisible pins are only drawn on request.
// They are drawn in GetInvisibleItemColor(). // They are drawn in GetInvisibleItemColor().
// in schematic, they are drawn only if m_showAllPins is true. // in schematic, they are drawn only if m_showAllPins is true.
@ -870,24 +884,19 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel,
if( frame && frame->IsType( FRAME_SCH ) && if( frame && frame->IsType( FRAME_SCH ) &&
! ((SCH_EDIT_FRAME*)frame)->GetShowAllPins() ) ! ((SCH_EDIT_FRAME*)frame)->GetShowAllPins() )
{
if( drawPinDangling && drawDanglingHidden )
{
// Draw the target
DrawPinSymbol( aPanel, aDC, pos1, orient, aDrawMode, aColor, drawPinDangling,
/* aOnlyTarget */ true );
}
return; return;
}
aColor = GetInvisibleItemColor(); aColor = GetInvisibleItemColor();
} }
LIB_PART* Entry = GetParent();
// aData is used here as a bitfield of flags.
uintptr_t flags = (uintptr_t) aData;
bool drawPinText = flags & PIN_DRAW_TEXTS;
bool drawPinDangling = flags & PIN_DRAW_DANGLING;
/* Calculate pin orient taking in account the component orientation. */
int orient = PinDrawOrient( aTransform );
/* Calculate the pin position */
wxPoint pos1 = aTransform.TransformCoordinate( m_position ) + aOffset;
/* Drawing from the pin and the special symbol combination */ /* Drawing from the pin and the special symbol combination */
DrawPinSymbol( aPanel, aDC, pos1, orient, aDrawMode, aColor, drawPinDangling ); DrawPinSymbol( aPanel, aDC, pos1, orient, aDrawMode, aColor, drawPinDangling );
@ -916,7 +925,8 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
int aOrient, int aOrient,
GR_DRAWMODE aDrawMode, GR_DRAWMODE aDrawMode,
EDA_COLOR_T aColor, EDA_COLOR_T aColor,
bool aDrawDangling ) bool aDrawDangling,
bool aOnlyTarget )
{ {
int MapX1, MapY1, x1, y1; int MapX1, MapY1, x1, y1;
int width = GetPenSize(); int width = GetPenSize();
@ -962,6 +972,21 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
break; break;
} }
// Draw the pin end target (active end of the pin)
BASE_SCREEN* screen = aPanel ? aPanel->GetScreen() : NULL;
#define NCSYMB_PIN_DIM TARGET_PIN_RADIUS
// Draw but do not print the pin end target 1 pixel width
if( m_type != PIN_NC && ( screen == NULL || !screen->m_IsPrinting ) )
{
if( aDrawDangling )
GRCircle( clipbox, aDC, posX, posY, TARGET_PIN_RADIUS, 0, color );
}
if( aOnlyTarget )
return;
if( m_shape & INVERT ) if( m_shape & INVERT )
{ {
const int radius = ExternalPinDecoSize( *this ); const int radius = ExternalPinDecoSize( *this );
@ -1079,10 +1104,6 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
width, color ); 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
if( m_type == PIN_NC ) // Draw a N.C. symbol if( m_type == PIN_NC ) // Draw a N.C. symbol
{ {
GRLine( clipbox, aDC, GRLine( clipbox, aDC,
@ -1094,12 +1115,6 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
posX - NCSYMB_PIN_DIM, posY + NCSYMB_PIN_DIM, posX - NCSYMB_PIN_DIM, posY + NCSYMB_PIN_DIM,
width, color ); width, color );
} }
// Draw but do not print the pin end target 1 pixel width
else if( screen == NULL || !screen->m_IsPrinting )
{
if( aDrawDangling )
GRCircle( clipbox, aDC, posX, posY, TARGET_PIN_RADIUS, 0, color );
}
} }

View File

@ -84,7 +84,8 @@ enum DrawPinOrient {
enum LibPinDrawFlags { enum LibPinDrawFlags {
PIN_DRAW_TEXTS = 1, PIN_DRAW_TEXTS = 1,
PIN_DRAW_DANGLING = 2, PIN_DRAW_DANGLING = 2, // Draw this pin with a 'dangling' indicator
PIN_DANGLING_HIDDEN = 4, // Draw (only!) the dangling indicator if the pin is hidden
}; };
@ -114,7 +115,8 @@ class LIB_PIN : public LIB_ITEM
* @param aDrawMode GR_OR, GR_XOR, ... * @param aDrawMode GR_OR, GR_XOR, ...
* @param aData = used here as uintptr_t containing bitwise OR'd flags: * @param aData = used here as uintptr_t containing bitwise OR'd flags:
* PIN_DRAW_TEXTS, -- false to draw only pin shape, useful for fast mode * PIN_DRAW_TEXTS, -- false to draw only pin shape, useful for fast mode
* PIN_DRAW_DANGLING, * PIN_DRAW_DANGLING, -- true to draw the pin with its target
* PIN_DANGLING_HIDDEN -- draw the target even if the pin is hidden
* @param aTransform Transform Matrix (rotation, mirror ..) * @param aTransform Transform Matrix (rotation, mirror ..)
*/ */
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
@ -401,7 +403,8 @@ public:
void DrawPinSymbol( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, void DrawPinSymbol( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
int aOrientation, GR_DRAWMODE aDrawMode, int aOrientation, GR_DRAWMODE aDrawMode,
EDA_COLOR_T aColor = UNSPECIFIED_COLOR, EDA_COLOR_T aColor = UNSPECIFIED_COLOR,
bool aDrawDangling = true ); bool aDrawDangling = true,
bool aOnlyTarget = false );
/** /**
* Function DrawPinTexts * Function DrawPinTexts

View File

@ -1658,7 +1658,7 @@ bool SCH_COMPONENT::IsPinDanglingStateChanged( std::vector<DANGLING_END_ITEM> &a
const LIB_PIN* item_pin = dynamic_cast<const LIB_PIN*>( each_item.GetItem() ); const LIB_PIN* item_pin = dynamic_cast<const LIB_PIN*>( each_item.GetItem() );
if( item_pin if( item_pin
&& !item_pin->IsPowerConnection() && ( !item_pin->IsPowerConnection() || !IsInNetlist() )
&& std::find( aLibPins.begin(), aLibPins.end(), item_pin) != aLibPins.end() ) && std::find( aLibPins.begin(), aLibPins.end(), item_pin) != aLibPins.end() )
continue; continue;