Move NC pin logic so we set it before we need it.

Also fixes drawing the dangling symbol in the Pin Properties dialog
and when printing.

Fixes https://gitlab.com/kicad/code/kicad/issues/9962
This commit is contained in:
Jeff Young 2021-12-12 21:37:06 +00:00
parent 067fa65756
commit 653c7b78d7
4 changed files with 16 additions and 9 deletions

View File

@ -377,8 +377,8 @@ void DIALOG_PIN_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
double yscale = (double) dc_size.y / bBox.GetHeight(); double yscale = (double) dc_size.y / bBox.GetHeight();
double scale = std::min( xscale, yscale ); double scale = std::min( xscale, yscale );
// Give a 10% margin and limit to no more than 100% zoom // Give a 7% margin (each side) and limit to no more than 100% zoom
scale = std::min( scale * 0.9, 1.0 ); scale = std::min( scale * 0.85, 1.0 );
dc.SetUserScale( scale, scale ); dc.SetUserScale( scale, scale );
GRResetPenAndBrush( &dc ); GRResetPenAndBrush( &dc );

View File

@ -195,9 +195,9 @@ void LIB_PIN::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, v
const TRANSFORM& aTransform ) const TRANSFORM& aTransform )
{ {
LIB_SYMBOL_OPTIONS* opts = (LIB_SYMBOL_OPTIONS*) aData; LIB_SYMBOL_OPTIONS* opts = (LIB_SYMBOL_OPTIONS*) aData;
bool drawHiddenFields = opts ? opts->draw_hidden_fields : false; bool drawHiddenFields = opts ? opts->draw_hidden_fields : false;
bool showPinType = opts ? opts->show_elec_type : false; bool showPinType = opts ? opts->show_elec_type : false;
bool show_connect_point = opts ? opts->show_connect_point : false; bool show_connect_point = opts ? opts->show_connect_point : false;
LIB_SYMBOL* part = GetParent(); LIB_SYMBOL* part = GetParent();
@ -217,7 +217,9 @@ void LIB_PIN::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, v
if( showPinType ) if( showPinType )
printPinElectricalTypeName( aSettings, pos1, orient ); printPinElectricalTypeName( aSettings, pos1, orient );
if( show_connect_point ) if( show_connect_point
&& m_type != ELECTRICAL_PINTYPE::PT_NC
&& m_type != ELECTRICAL_PINTYPE::PT_NIC )
{ {
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
COLOR4D color = aSettings->GetLayerColor( IsVisible() ? LAYER_PIN : LAYER_HIDDEN ); COLOR4D color = aSettings->GetLayerColor( IsVisible() ? LAYER_PIN : LAYER_HIDDEN );

View File

@ -842,8 +842,6 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
pos + VECTOR2D( 1, 1 ) * TARGET_PIN_RADIUS ); pos + VECTOR2D( 1, 1 ) * TARGET_PIN_RADIUS );
m_gal->DrawLine( pos + VECTOR2D( 1, -1 ) * TARGET_PIN_RADIUS , m_gal->DrawLine( pos + VECTOR2D( 1, -1 ) * TARGET_PIN_RADIUS ,
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 else
{ {

View File

@ -88,7 +88,14 @@ public:
bool IsConnectable() const override { return true; } bool IsConnectable() const override { return true; }
bool IsDangling() const override { return m_isDangling; } bool IsDangling() const override
{
if( GetType() == ELECTRICAL_PINTYPE::PT_NC || GetType() == ELECTRICAL_PINTYPE::PT_NIC )
return false;
return m_isDangling;
}
void SetIsDangling( bool isDangling ) { m_isDangling = isDangling; } void SetIsDangling( bool isDangling ) { m_isDangling = isDangling; }
bool IsPointClickableAnchor( const wxPoint& aPos ) const override bool IsPointClickableAnchor( const wxPoint& aPos ) const override