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 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
|
|
|
@ -148,8 +148,8 @@ bool DIALOG_LIB_EDIT_PIN::TransferDataFromWindow()
|
|||
*/
|
||||
void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event )
|
||||
{
|
||||
wxPaintDC dc( m_panelShowPin );
|
||||
wxSize dc_size = dc.GetSize();
|
||||
wxPaintDC dc( m_panelShowPin );
|
||||
wxSize dc_size = dc.GetSize();
|
||||
dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
|
||||
|
||||
// Give a parent to m_dummyPin only from draw purpose.
|
||||
|
@ -160,16 +160,19 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event )
|
|||
|
||||
// Calculate a suitable scale to fit the available draw area
|
||||
EDA_RECT bBox = m_dummyPin->GetBoundingBox( true );
|
||||
double xscale = (double) dc_size.x / bBox.GetWidth();
|
||||
double yscale = (double) dc_size.y / bBox.GetHeight();
|
||||
double scale = std::min( xscale, yscale );
|
||||
double xscale = (double) dc_size.x / bBox.GetWidth();
|
||||
double yscale = (double) dc_size.y / bBox.GetHeight();
|
||||
double scale = std::min( xscale, yscale );
|
||||
|
||||
// Give a 10% margin
|
||||
scale *= 0.9;
|
||||
// Give a 10% margin and limit to no more than 100% zoom
|
||||
scale = std::min( scale * 0.9, 1.0 );
|
||||
dc.SetUserScale( scale, scale );
|
||||
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 );
|
||||
|
||||
|
|
|
@ -560,10 +560,8 @@ int LIB_PIN::GetPenSize() const
|
|||
|
||||
void LIB_PIN::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRANSFORM& aTransform )
|
||||
{
|
||||
// aData is used here as a boolean.
|
||||
bool drawElectricalTypeName = (bool) aData;
|
||||
|
||||
LIB_PART* Entry = GetParent();
|
||||
PART_DRAW_OPTIONS* opts = (PART_DRAW_OPTIONS*) aData;
|
||||
LIB_PART* part = GetParent();
|
||||
|
||||
/* Calculate pin orient taking in account the component orientation. */
|
||||
int orient = PinDrawOrient( aTransform );
|
||||
|
@ -571,16 +569,16 @@ void LIB_PIN::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRANS
|
|||
/* Calculate the pin position */
|
||||
wxPoint pos1 = aTransform.TransformCoordinate( m_position ) + aOffset;
|
||||
|
||||
if( !IsVisible() )
|
||||
return;
|
||||
if( IsVisible() || ( opts && opts->draw_hidden_fields ) )
|
||||
{
|
||||
PrintPinSymbol( aDC, pos1, orient );
|
||||
|
||||
PrintPinSymbol( aDC, pos1, orient );
|
||||
PrintPinTexts( aDC, pos1, orient, part->GetPinNameOffset(), part->ShowPinNumbers(),
|
||||
part->ShowPinNames() );
|
||||
|
||||
PrintPinTexts( aDC, pos1, orient, Entry->GetPinNameOffset(), Entry->ShowPinNumbers(),
|
||||
Entry->ShowPinNames() );
|
||||
|
||||
if( drawElectricalTypeName )
|
||||
PrintPinElectricalTypeName( aDC, pos1, orient );
|
||||
if( opts && opts->show_elec_type )
|
||||
PrintPinElectricalTypeName( aDC, pos1, orient );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue