Pcbnew: Fix some draw issues in PCB_TEXT and PCB_TEXTBOX:
- fix incorrect ViewGetLayers() layer list. - fix incorrect color of graphic items (BOARD_CONNECTED_ITEM items) on copper layers - slightly modify how a PCB_TEXTBOX is drawn on LAYER_LOCKED_ITEM_SHADOW. Fixes #15458 https://gitlab.com/kicad/code/kicad/-/issues/15458
This commit is contained in:
parent
adb1ac8cb8
commit
4d1f9f6fb9
|
@ -192,6 +192,11 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons
|
||||||
int netCode = -1;
|
int netCode = -1;
|
||||||
int originalLayer = aLayer;
|
int originalLayer = aLayer;
|
||||||
|
|
||||||
|
// Some graphic objects are BOARD_CONNECTED_ITEM, but they are seen here as
|
||||||
|
// actually board connected objects only if on a copper layer
|
||||||
|
if( conItem && !conItem->IsOnCopperLayer() )
|
||||||
|
conItem = nullptr;
|
||||||
|
|
||||||
// Marker shadows
|
// Marker shadows
|
||||||
if( aLayer == LAYER_MARKER_SHADOWS )
|
if( aLayer == LAYER_MARKER_SHADOWS )
|
||||||
return m_backgroundColor.WithAlpha( 0.6 );
|
return m_backgroundColor.WithAlpha( 0.6 );
|
||||||
|
@ -2126,8 +2131,16 @@ void PCB_PAINTER::draw( const PCB_TEXTBOX* aTextBox, int aLayer )
|
||||||
std::vector<VECTOR2I> pts = aTextBox->GetCorners();
|
std::vector<VECTOR2I> pts = aTextBox->GetCorners();
|
||||||
int line_thickness = std::max( thickness*3, pcbIUScale.mmToIU( 0.2 ) );
|
int line_thickness = std::max( thickness*3, pcbIUScale.mmToIU( 0.2 ) );
|
||||||
|
|
||||||
|
std::deque<VECTOR2D> dpts;
|
||||||
|
|
||||||
for( size_t ii = 0; ii < pts.size(); ++ii )
|
for( size_t ii = 0; ii < pts.size(); ++ii )
|
||||||
m_gal->DrawSegment( pts[ ii ], pts[ (ii + 1) % pts.size() ], line_thickness );
|
dpts.push_back( VECTOR2D( pts[ii] ) );
|
||||||
|
|
||||||
|
dpts.push_back( VECTOR2D( pts[0] ) );
|
||||||
|
|
||||||
|
m_gal->SetIsStroke( true );
|
||||||
|
m_gal->SetLineWidth( line_thickness );
|
||||||
|
m_gal->DrawPolygon( dpts );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_gal->SetFillColor( color );
|
m_gal->SetFillColor( color );
|
||||||
|
@ -2176,10 +2189,18 @@ void PCB_PAINTER::draw( const PCB_TEXTBOX* aTextBox, int aLayer )
|
||||||
|
|
||||||
if( aLayer == LAYER_LOCKED_ITEM_SHADOW )
|
if( aLayer == LAYER_LOCKED_ITEM_SHADOW )
|
||||||
{
|
{
|
||||||
|
// For now, the textbox is a filled shape.
|
||||||
|
// so the text drawn on LAYER_LOCKED_ITEM_SHADOW with a thick width is disabled
|
||||||
|
// If enabled, the thick text position must be offsetted to be exactly on the
|
||||||
|
// initial text, which is not easy, depending on its rotation and justification.
|
||||||
|
#if 0
|
||||||
const COLOR4D sh_color = m_pcbSettings.GetColor( aTextBox, aLayer );
|
const COLOR4D sh_color = m_pcbSettings.GetColor( aTextBox, aLayer );
|
||||||
m_gal->SetFillColor( sh_color );
|
m_gal->SetFillColor( sh_color );
|
||||||
m_gal->SetStrokeColor( sh_color );
|
m_gal->SetStrokeColor( sh_color );
|
||||||
attrs.m_StrokeWidth += m_lockedShadowMargin;
|
attrs.m_StrokeWidth += m_lockedShadowMargin;
|
||||||
|
#else
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
|
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
|
||||||
|
|
|
@ -152,6 +152,9 @@ void PCB_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||||
aLayers[0] = LAYER_HIDDEN_TEXT;
|
aLayers[0] = LAYER_HIDDEN_TEXT;
|
||||||
|
|
||||||
aCount = 1;
|
aCount = 1;
|
||||||
|
|
||||||
|
if( IsLocked() )
|
||||||
|
aLayers[ aCount++ ] = LAYER_LOCKED_ITEM_SHADOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -383,7 +386,7 @@ wxString PCB_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
||||||
return wxString::Format( _( "Footprint Text '%s' of %s" ),
|
return wxString::Format( _( "Footprint Text '%s' of %s" ),
|
||||||
KIUI::EllipsizeMenuText( GetText() ), parentFP->GetReference() );
|
KIUI::EllipsizeMenuText( GetText() ), parentFP->GetReference() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return wxString::Format( _( "PCB Text '%s' on %s" ),
|
return wxString::Format( _( "PCB Text '%s' on %s" ),
|
||||||
KIUI::EllipsizeMenuText( GetText() ),
|
KIUI::EllipsizeMenuText( GetText() ),
|
||||||
GetLayerName() );
|
GetLayerName() );
|
||||||
|
|
|
@ -248,6 +248,16 @@ double PCB_TEXTBOX::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PCB_TEXTBOX::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||||
|
{
|
||||||
|
aLayers[0] = GetLayer();
|
||||||
|
aCount = 1;
|
||||||
|
|
||||||
|
if( IsLocked() )
|
||||||
|
aLayers[ aCount++ ] = LAYER_LOCKED_ITEM_SHADOW;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString PCB_TEXTBOX::GetShownText( bool aAllowExtraText, int aDepth ) const
|
wxString PCB_TEXTBOX::GetShownText( bool aAllowExtraText, int aDepth ) const
|
||||||
{
|
{
|
||||||
BOARD* board = dynamic_cast<BOARD*>( GetParent() );
|
BOARD* board = dynamic_cast<BOARD*>( GetParent() );
|
||||||
|
|
|
@ -132,6 +132,8 @@ public:
|
||||||
|
|
||||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||||
|
|
||||||
|
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||||
|
|
||||||
EDA_ITEM* Clone() const override;
|
EDA_ITEM* Clone() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in New Issue