Fix accidental plotting of disabled textbox borders
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15252
This commit is contained in:
parent
d193334a10
commit
339684263c
|
@ -196,7 +196,7 @@ bool DIALOG_TEXTBOX_PROPERTIES::TransferDataToWindow()
|
|||
m_orientation.SetAngleValue( orientation.Normalize180() );
|
||||
|
||||
STROKE_PARAMS stroke = m_textBox->GetStroke();
|
||||
m_borderCheckbox->SetValue( stroke.GetWidth() >= 0 );
|
||||
m_borderCheckbox->SetValue( m_textBox->IsBorderEnabled() );
|
||||
|
||||
if( stroke.GetWidth() >= 0 )
|
||||
m_borderWidth.SetValue( stroke.GetWidth() );
|
||||
|
@ -357,28 +357,29 @@ bool DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow()
|
|||
|
||||
m_textBox->SetMirrored( m_mirrored->IsChecked() );
|
||||
|
||||
STROKE_PARAMS stroke = m_textBox->GetStroke();
|
||||
|
||||
if( m_borderCheckbox->GetValue() )
|
||||
{
|
||||
STROKE_PARAMS stroke = m_textBox->GetStroke();
|
||||
if( !m_borderWidth.IsIndeterminate() )
|
||||
stroke.SetWidth( m_borderWidth.GetValue() );
|
||||
|
||||
|
||||
auto it = lineTypeNames.begin();
|
||||
std::advance( it, m_borderStyleCombo->GetSelection() );
|
||||
|
||||
if( it == lineTypeNames.end() )
|
||||
stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
|
||||
else
|
||||
stroke.SetPlotStyle( it->first );
|
||||
|
||||
m_textBox->SetStroke( stroke );
|
||||
}
|
||||
else
|
||||
{
|
||||
stroke.SetWidth( -1 );
|
||||
m_textBox->DisableBorder();
|
||||
}
|
||||
|
||||
auto it = lineTypeNames.begin();
|
||||
std::advance( it, m_borderStyleCombo->GetSelection() );
|
||||
|
||||
if( it == lineTypeNames.end() )
|
||||
stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
|
||||
else
|
||||
stroke.SetPlotStyle( it->first );
|
||||
|
||||
m_textBox->SetStroke( stroke );
|
||||
|
||||
m_textBox->ClearBoundingBoxCache();
|
||||
m_textBox->ClearRenderCache();
|
||||
|
||||
|
|
|
@ -552,6 +552,18 @@ void PCB_TEXTBOX::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID
|
|||
}
|
||||
|
||||
|
||||
bool PCB_TEXTBOX::IsBorderEnabled() const
|
||||
{
|
||||
return m_stroke.GetWidth() != -1;
|
||||
}
|
||||
|
||||
|
||||
void PCB_TEXTBOX::DisableBorder()
|
||||
{
|
||||
m_stroke.SetWidth( -1 );
|
||||
}
|
||||
|
||||
|
||||
static struct PCB_TEXTBOX_DESC
|
||||
{
|
||||
PCB_TEXTBOX_DESC()
|
||||
|
|
|
@ -136,6 +136,12 @@ public:
|
|||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
///< Tests whether the border is disabled, as configured by the stroke
|
||||
bool IsBorderEnabled() const;
|
||||
|
||||
///< Disables the border, this is done by changing the stroke internally
|
||||
void DisableBorder();
|
||||
|
||||
protected:
|
||||
virtual void swapData( BOARD_ITEM* aImage ) override;
|
||||
|
||||
|
|
|
@ -359,7 +359,8 @@ void BRDITEMS_PLOTTER::PlotBoardGraphicItem( const BOARD_ITEM* item )
|
|||
{
|
||||
const PCB_TEXTBOX* textbox = static_cast<const PCB_TEXTBOX*>( item );
|
||||
PlotText( textbox, textbox->GetLayer(), textbox->IsKnockout(), textbox->GetFontMetrics() );
|
||||
PlotShape( textbox );
|
||||
if( textbox->IsBorderEnabled() )
|
||||
PlotShape( textbox );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -517,7 +518,8 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItems( const FOOTPRINT* aFootprint )
|
|||
{
|
||||
PlotText( textbox, textbox->GetLayer(), textbox->IsKnockout(),
|
||||
textbox->GetFontMetrics() );
|
||||
PlotShape( textbox );
|
||||
if( textbox->IsBorderEnabled() )
|
||||
PlotShape( textbox );
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue