Draw invisible pins in grey in pin preview.
Also pins the zoom at 100% as we don't seem to be very good at calculating the bounding box for short pins. Fixes: lp:1836658 * https://bugs.launchpad.net/kicad/+bug/1836658
This commit is contained in:
parent
7d10b29592
commit
787b16db98
|
@ -419,7 +419,7 @@ void LIB_PART::Print( wxDC* aDc, const wxPoint& aOffset, int aMulti, int aConver
|
||||||
|
|
||||||
if( drawItem.Type() == LIB_PIN_T )
|
if( drawItem.Type() == LIB_PIN_T )
|
||||||
{
|
{
|
||||||
drawItem.Print( aDc, aOffset, (void*) aOpts.show_elec_type, aOpts.transform );
|
drawItem.Print( aDc, aOffset, (void*) &aOpts, aOpts.transform );
|
||||||
}
|
}
|
||||||
else if( drawItem.Type() == LIB_FIELD_T )
|
else if( drawItem.Type() == LIB_FIELD_T )
|
||||||
{
|
{
|
||||||
|
|
|
@ -164,12 +164,15 @@ void DIALOG_LIB_EDIT_PIN::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
|
// Give a 10% margin and limit to no more than 100% zoom
|
||||||
scale *= 0.9;
|
scale = std::min( scale * 0.9, 1.0 );
|
||||||
dc.SetUserScale( scale, scale );
|
dc.SetUserScale( scale, scale );
|
||||||
GRResetPenAndBrush( &dc );
|
GRResetPenAndBrush( &dc );
|
||||||
|
|
||||||
m_dummyPin->Print( &dc, -bBox.Centre(), (void*)0, DefaultTransform );
|
PART_DRAW_OPTIONS opts = PART_DRAW_OPTIONS::Default();
|
||||||
|
opts.draw_hidden_fields = true;
|
||||||
|
|
||||||
|
m_dummyPin->Print( &dc, -bBox.Centre(), (void*) &opts, DefaultTransform );
|
||||||
|
|
||||||
m_dummyPin->SetParent( nullptr );
|
m_dummyPin->SetParent( nullptr );
|
||||||
|
|
||||||
|
|
|
@ -560,10 +560,8 @@ int LIB_PIN::GetPenSize() const
|
||||||
|
|
||||||
void LIB_PIN::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRANSFORM& aTransform )
|
void LIB_PIN::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRANSFORM& aTransform )
|
||||||
{
|
{
|
||||||
// aData is used here as a boolean.
|
PART_DRAW_OPTIONS* opts = (PART_DRAW_OPTIONS*) aData;
|
||||||
bool drawElectricalTypeName = (bool) aData;
|
LIB_PART* part = GetParent();
|
||||||
|
|
||||||
LIB_PART* Entry = GetParent();
|
|
||||||
|
|
||||||
/* Calculate pin orient taking in account the component orientation. */
|
/* Calculate pin orient taking in account the component orientation. */
|
||||||
int orient = PinDrawOrient( aTransform );
|
int orient = PinDrawOrient( aTransform );
|
||||||
|
@ -571,17 +569,17 @@ void LIB_PIN::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRANS
|
||||||
/* Calculate the pin position */
|
/* Calculate the pin position */
|
||||||
wxPoint pos1 = aTransform.TransformCoordinate( m_position ) + aOffset;
|
wxPoint pos1 = aTransform.TransformCoordinate( m_position ) + aOffset;
|
||||||
|
|
||||||
if( !IsVisible() )
|
if( IsVisible() || ( opts && opts->draw_hidden_fields ) )
|
||||||
return;
|
{
|
||||||
|
|
||||||
PrintPinSymbol( aDC, pos1, orient );
|
PrintPinSymbol( aDC, pos1, orient );
|
||||||
|
|
||||||
PrintPinTexts( aDC, pos1, orient, Entry->GetPinNameOffset(), Entry->ShowPinNumbers(),
|
PrintPinTexts( aDC, pos1, orient, part->GetPinNameOffset(), part->ShowPinNumbers(),
|
||||||
Entry->ShowPinNames() );
|
part->ShowPinNames() );
|
||||||
|
|
||||||
if( drawElectricalTypeName )
|
if( opts && opts->show_elec_type )
|
||||||
PrintPinElectricalTypeName( aDC, pos1, orient );
|
PrintPinElectricalTypeName( aDC, pos1, orient );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
|
void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
|
||||||
|
|
Loading…
Reference in New Issue