Reconcile "apply defaults to new footprints" with DRC lib checks.

Moves apply defaults settings to Board Setup (where they were
duplicated anyway due to an earlier botched merge).

Modifies the apply-to-graphics algorithm to skip copper shapes.

Modifies DRC library check to skip STROKE_PARAMS for non-copper
shapes.
This commit is contained in:
Jeff Young 2023-10-02 22:10:13 +01:00
parent 2d3a8ee4c9
commit 8760bd8c80
19 changed files with 83 additions and 259 deletions

View File

@ -712,6 +712,10 @@ public:
int m_DimensionArrowLength;
int m_DimensionExtensionOffset;
bool m_StyleFPFields;
bool m_StyleFPText;
bool m_StyleFPShapes;
// Miscellaneous
std::unique_ptr<PAD> m_Pad_Master; // A dummy pad to store all default parameters
// when importing values or creating a new pad

View File

@ -723,6 +723,13 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
&m_DimensionExtensionOffset,
pcbIUScale.mmToIU( DEFAULT_DIMENSION_EXTENSION_OFFSET ) ) );
m_params.emplace_back( new PARAM<bool>( "defaults.apply_defaults_to_fp_fields",
&m_StyleFPFields, false ) );
m_params.emplace_back( new PARAM<bool>( "defaults.apply_defaults_to_fp_text",
&m_StyleFPText, false ) );
m_params.emplace_back( new PARAM<bool>( "defaults.apply_defaults_to_fp_shapes",
&m_StyleFPShapes, false ) );
m_params.emplace_back( new PARAM_SCALED<int>( "defaults.zones.min_clearance",
&m_defaultZoneSettings.m_ZoneClearance, pcbIUScale.mmToIU( ZONE_CLEARANCE_MM ),
pcbIUScale.mmToIU( 0.0 ), pcbIUScale.mmToIU( 25.0 ), pcbIUScale.MM_PER_IU ) );

View File

@ -87,9 +87,6 @@ void PANEL_EDIT_OPTIONS::loadPCBSettings( PCBNEW_SETTINGS* aCfg )
m_escClearsNetHighlight->SetValue( aCfg->m_ESCClearsNetHighlight );
m_showPageLimits->SetValue( aCfg->m_ShowPageLimits );
m_cbCourtyardCollisions->SetValue( aCfg->m_ShowCourtyardCollisions );
m_styleFields->SetValue( aCfg->m_StyleFootprintFields );
m_styleTextAndGraphics->SetValue( aCfg->m_StyleFootprintTextAndGraphics );
}
@ -166,9 +163,6 @@ bool PANEL_EDIT_OPTIONS::TransferDataFromWindow()
cfg->m_ShowPageLimits = m_showPageLimits->GetValue();
cfg->m_ShowCourtyardCollisions = m_cbCourtyardCollisions->GetValue();
cfg->m_StyleFootprintFields = m_styleFields->GetValue();
cfg->m_StyleFootprintTextAndGraphics = m_styleTextAndGraphics->GetValue();
#ifdef __WXOSX_MAC__
cfg->m_CtrlClickHighlight = m_rbCtrlClickActionMac->GetSelection();

View File

@ -388,18 +388,6 @@ PANEL_EDIT_OPTIONS_BASE::PANEL_EDIT_OPTIONS_BASE( wxWindow* parent, wxWindowID i
pcbOptionsSizer->Add( sbSizerMisc, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
wxStaticBoxSizer* sbSizer2;
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( pcbPage, wxID_ANY, _("When Adding Footprints to PCB") ), wxVERTICAL );
m_styleFields = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Apply board defaults to footprint fields"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer2->Add( m_styleFields, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_styleTextAndGraphics = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Apply board defaults to footprint text && graphics"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer2->Add( m_styleTextAndGraphics, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
pcbOptionsSizer->Add( sbSizer2, 1, wxEXPAND|wxTOP, 5 );
pcbPage->SetSizer( pcbOptionsSizer );
pcbPage->Layout();

View File

@ -3699,148 +3699,6 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">When Adding Footprints to PCB</property>
<property name="minimum_size"></property>
<property name="name">sbSizer2</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Apply board defaults to footprint fields</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_styleFields</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Apply board defaults to footprint text &amp;&amp; graphics</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_styleTextAndGraphics</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>
</object>
</object>
</object>
</object>

View File

@ -72,8 +72,6 @@ class PANEL_EDIT_OPTIONS_BASE : public RESETTABLE_PANEL
wxCheckBox* m_showPageLimits;
wxCheckBox* m_cbCourtyardCollisions;
wxCheckBox* m_autoRefillZones;
wxCheckBox* m_styleFields;
wxCheckBox* m_styleTextAndGraphics;
public:

View File

@ -52,6 +52,12 @@ bool PANEL_SETUP_FORMATTING::TransferDataToWindow()
m_gapLengthCtrl->SetValue( EDA_UNIT_UTILS::UI::StringFromValue( unityScale, EDA_UNITS::UNSCALED,
settings.GetDashedLineGapRatio() ) );
BOARD_DESIGN_SETTINGS& bds = m_frame->GetBoard()->GetDesignSettings();
m_styleFields->SetValue( bds.m_StyleFPFields );
m_styleText->SetValue( bds.m_StyleFPText );
m_styleShapes->SetValue( bds.m_StyleFPShapes );
return true;
}
@ -65,6 +71,12 @@ bool PANEL_SETUP_FORMATTING::TransferDataFromWindow()
m_frame->GetBoard()->SetPlotOptions( settings );
BOARD_DESIGN_SETTINGS& bds = m_frame->GetBoard()->GetDesignSettings();
bds.m_StyleFPFields = m_styleFields->GetValue();
bds.m_StyleFPText = m_styleText->GetValue();
bds.m_StyleFPShapes = m_styleShapes->GetValue();
KIGFX::PCB_VIEW* view = m_frame->GetCanvas()->GetView();
view->GetPainter()->GetSettings()->SetDashLengthRatio( settings.GetDashedLineDashRatio() );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -53,16 +53,16 @@ PANEL_SETUP_FORMATTING_BASE::PANEL_SETUP_FORMATTING_BASE( wxWindow* parent, wxWi
bMargins->Add( 0, 10, 0, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer2;
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Format Footprints when Added to Board") ), wxVERTICAL );
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("When Adding Footprints to Board") ), wxVERTICAL );
m_styleFields = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Apply board defaults to footprint fields"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer2->Add( m_styleFields, 0, wxALL, 5 );
sbSizer2->Add( m_styleFields, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_styleText = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Apply board defaults to footprint text"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer2->Add( m_styleText, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_styleGrahics = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Apply board defaults to footprint graphics"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer2->Add( m_styleGrahics, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_styleShapes = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Apply board defaults to non-copper footprint shapes"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer2->Add( m_styleShapes, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bMargins->Add( sbSizer2, 0, wxEXPAND|wxALL, 5 );

View File

@ -35,7 +35,6 @@
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="fg"></property>
@ -120,7 +119,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -182,7 +180,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -247,7 +244,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -309,7 +305,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -376,7 +371,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -431,7 +425,7 @@
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Format Footprints when Added to Board</property>
<property name="label">When Adding Footprints to Board</property>
<property name="minimum_size"></property>
<property name="name">sbSizer2</property>
<property name="orient">wxVERTICAL</property>
@ -439,7 +433,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@ -463,7 +457,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -528,7 +521,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -593,7 +585,6 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -601,7 +592,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Apply board defaults to footprint graphics</property>
<property name="label">Apply board defaults to non-copper footprint shapes</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -609,7 +600,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_styleGrahics</property>
<property name="name">m_styleShapes</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -40,7 +40,7 @@ class PANEL_SETUP_FORMATTING_BASE : public wxPanel
wxStaticText* m_dashedLineHelp;
wxCheckBox* m_styleFields;
wxCheckBox* m_styleText;
wxCheckBox* m_styleGrahics;
wxCheckBox* m_styleShapes;
public:

View File

@ -404,7 +404,9 @@ bool shapeNeedsUpdate( const PCB_SHAPE* a, const PCB_SHAPE* b )
UNIMPLEMENTED_FOR( a->SHAPE_T_asString() );
}
TEST( a->GetStroke(), b->GetStroke(), "" );
if( a->IsOnCopperLayer() )
TEST( a->GetStroke(), b->GetStroke(), "" );
TEST( a->IsFilled(), b->IsFilled(), "" );
TEST( a->GetLayer(), b->GetLayer(), "" );
@ -413,33 +415,6 @@ bool shapeNeedsUpdate( const PCB_SHAPE* a, const PCB_SHAPE* b )
}
bool textNeedsUpdate( const PCB_TEXT* a, const PCB_TEXT* b )
{
REPORTER* aReporter = nullptr;
bool diff = false;
TEST( a->GetLayer(), b->GetLayer(), "" );
TEST( a->IsKeepUpright(), b->IsKeepUpright(), "" );
TEST( a->GetText(), b->GetText(), "" );
TEST( a->GetTextThickness(), b->GetTextThickness(), "" );
TEST( a->GetTextAngle(), b->GetTextAngle(), "" );
TEST( a->IsItalic(), b->IsItalic(), "" );
TEST( a->IsBold(), b->IsBold(), "" );
TEST( a->IsVisible(), b->IsVisible(), "" );
TEST( a->IsMirrored(), b->IsMirrored(), "" );
TEST( a->GetHorizJustify(), b->GetHorizJustify(), "" );
TEST( a->GetVertJustify(), b->GetVertJustify(), "" );
TEST( a->GetTextSize(), b->GetTextSize(), "" );
TEST( a->GetFPRelativePosition(), b->GetFPRelativePosition(), "" );
return diff;
}
bool zoneNeedsUpdate( const ZONE* a, const ZONE* b, REPORTER* aReporter )
{
bool diff = false;
@ -526,21 +501,6 @@ bool zoneNeedsUpdate( const ZONE* a, const ZONE* b, REPORTER* aReporter )
}
bool modelNeedsUpdate( const FP_3DMODEL& a, const FP_3DMODEL& b, REPORTER* aReporter )
{
bool diff = false;
TEST_V3D( a.m_Scale, b.m_Scale, _( "3D model scale doesn't match: " ) + a.m_Filename );
TEST_V3D( a.m_Rotation, b.m_Rotation, _( "3D model rotation doesn't match: " ) + a.m_Filename );
TEST_V3D( a.m_Offset, b.m_Offset, _( "3D model offset doesn't match: " ) + a.m_Filename );
TEST( a.m_Opacity, b.m_Opacity, _( "3D model opacity doesn't match: " ) + a.m_Filename );
TEST( a.m_Filename, b.m_Filename, _( "3D model doesn't match: " ) + a.m_Filename );
TEST( a.m_Show, b.m_Show, _( "3D model visibility doesn't match: " ) + a.m_Filename );
return diff;
}
bool FOOTPRINT::FootprintNeedsUpdate( const FOOTPRINT* aLibFP, REPORTER* aReporter )
{
UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::MILLIMETRES );
@ -698,19 +658,6 @@ bool FOOTPRINT::FootprintNeedsUpdate( const FOOTPRINT* aLibFP, REPORTER* aReport
CHECKPOINT;
if( Models().size() != aLibFP->Models().size() )
{
diff = true;
REPORT( _( "3D model count differs." ) );
}
else
{
for( size_t ii = 0; ii < Models().size(); ++ii )
diff |= modelNeedsUpdate( Models()[ii], aLibFP->Models()[ii], aReporter );
}
CHECKPOINT;
// Rotate/position a copy of libFootprint so that zones sort the same
std::unique_ptr<FOOTPRINT> libCopy( static_cast<FOOTPRINT*>( aLibFP->Clone() ) );

View File

@ -352,8 +352,8 @@ void FOOTPRINT::RemoveField( const wxString& aFieldName )
}
void FOOTPRINT::ApplyDefaultSettings( const BOARD& board, bool aStyleFields,
bool aStyleTextAndGraphics )
void FOOTPRINT::ApplyDefaultSettings( const BOARD& board, bool aStyleFields, bool aStyleText,
bool aStyleShapes )
{
if( aStyleFields )
{
@ -361,10 +361,26 @@ void FOOTPRINT::ApplyDefaultSettings( const BOARD& board, bool aStyleFields,
field->StyleFromSettings( board.GetDesignSettings() );
}
if( aStyleTextAndGraphics )
for( BOARD_ITEM* item : m_drawings )
{
for( BOARD_ITEM* item : m_drawings )
item->StyleFromSettings( board.GetDesignSettings() );
switch( item->Type() )
{
case PCB_TEXT_T:
case PCB_TEXTBOX_T:
if( aStyleText )
item->StyleFromSettings( board.GetDesignSettings() );
break;
case PCB_SHAPE_T:
if( aStyleShapes && !item->IsOnCopperLayer() )
item->StyleFromSettings( board.GetDesignSettings() );
break;
default:
break;
}
}
}

View File

@ -680,7 +680,8 @@ public:
* being created in the footprint library cache, and we want these fields to have
* the correct default text properties.
*/
void ApplyDefaultSettings( const BOARD& board, bool aStyleFields, bool aStyleTextAndGraphics );
void ApplyDefaultSettings( const BOARD& board, bool aStyleFields, bool aStyleText,
bool aStyleShapes );
bool IsBoardOnly() const { return m_attributes & FP_BOARD_ONLY; }
void SetBoardOnly( bool aIsBoardOnly = true )
@ -864,7 +865,7 @@ public:
/**
* Return true if a board footprint differs from the library version.
*/
bool FootprintNeedsUpdate( const FOOTPRINT* aLibFootprint, REPORTER* aReporter = nullptr );
bool FootprintNeedsUpdate( const FOOTPRINT* aLibFP, REPORTER* aReporter = nullptr );
/**
* Take ownership of caller's heap allocated aInitialComments block.

View File

@ -898,8 +898,10 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
fixUuid( const_cast<KIID&>( aChild->m_Uuid ) );
} );
newFootprint->ApplyDefaultSettings( *m_pcb, GetPcbNewSettings()->m_StyleFootprintFields,
GetPcbNewSettings()->m_StyleFootprintTextAndGraphics );
BOARD_DESIGN_SETTINGS& bds = m_pcb->GetDesignSettings();
newFootprint->ApplyDefaultSettings( *m_pcb, bds.m_StyleFPFields, bds.m_StyleFPText,
bds.m_StyleFPShapes );
if( sourceFootprint ) // this is an update command
{

View File

@ -260,8 +260,10 @@ FOOTPRINT* PCB_BASE_FRAME::loadFootprint( const LIB_ID& aFootprintId )
if( m_pcb && !m_pcb->IsFootprintHolder() )
{
footprint->ApplyDefaultSettings( *m_pcb, GetPcbNewSettings()->m_StyleFootprintFields,
GetPcbNewSettings()->m_StyleFootprintTextAndGraphics );
BOARD_DESIGN_SETTINGS& bds = m_pcb->GetDesignSettings();
footprint->ApplyDefaultSettings( *m_pcb, bds.m_StyleFPFields, bds.m_StyleFPText,
bds.m_StyleFPShapes );
}
}

View File

@ -54,6 +54,18 @@ PCB_TEXTBOX::~PCB_TEXTBOX()
}
void PCB_TEXTBOX::StyleFromSettings( const BOARD_DESIGN_SETTINGS& settings )
{
PCB_SHAPE::StyleFromSettings( settings );
SetTextSize( settings.GetTextSize( GetLayer() ) );
SetTextThickness( settings.GetTextThickness( GetLayer() ) );
SetItalic( settings.GetTextItalic( GetLayer() ) );
SetKeepUpright( settings.GetTextUpright( GetLayer() ) );
SetMirrored( IsBackLayer( GetLayer() ) );
}
int PCB_TEXTBOX::GetTextMargin() const
{
return KiROUND( GetStroke().GetWidth() / 2.0 ) + KiROUND( GetTextSize().y * 0.75 );

View File

@ -72,6 +72,8 @@ public:
void SetRight( int aVal ) override;
void SetBottom( int aVal ) override;
void StyleFromSettings( const BOARD_DESIGN_SETTINGS& settings ) override;
int GetTextMargin() const;
VECTOR2I GetDrawPos() const override;

View File

@ -78,8 +78,6 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
m_ShowCourtyardCollisions( true ),
m_AutoRefillZones( false ),
m_AllowFreePads( false ),
m_StyleFootprintFields( false ),
m_StyleFootprintTextAndGraphics( false ),
m_PnsSettings( nullptr ),
m_FootprintViewerZoom( 1.0 ),
m_FootprintViewerAutoZoomOnSelect( true ),
@ -194,11 +192,6 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
m_params.emplace_back( new PARAM<bool>( "editing.allow_free_pads",
&m_AllowFreePads, false ) );
m_params.emplace_back( new PARAM<bool>( "editing.style_footprint_fields",
&m_StyleFootprintFields, false ) );
m_params.emplace_back( new PARAM<bool>( "editing.style_footprint_text_and_graphics",
&m_StyleFootprintTextAndGraphics, false ) );
m_params.emplace_back( new PARAM_LAMBDA<int>( "editing.rotation_angle",
[this] () -> int
{

View File

@ -414,9 +414,6 @@ public:
// False (default): all pads are treated as locked for the purposes of
// movement and any attempt to move them will move the footprint instead.
bool m_StyleFootprintFields;
bool m_StyleFootprintTextAndGraphics;
wxString m_FootprintTextShownColumns;
std::unique_ptr<PNS::ROUTING_SETTINGS> m_PnsSettings;