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 scale = std::min( xscale, yscale );
// Give a 10% margin and limit to no more than 100% zoom
scale = std::min( scale * 0.9, 1.0 );
// Give a 7% margin (each side) and limit to no more than 100% zoom
scale = std::min( scale * 0.85, 1.0 );
dc.SetUserScale( scale, scale );
GRResetPenAndBrush( &dc );

View File

@ -217,7 +217,9 @@ void LIB_PIN::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, v
if( showPinType )
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();
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 );
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
{

View File

@ -88,7 +88,14 @@ public:
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; }
bool IsPointClickableAnchor( const wxPoint& aPos ) const override