diff --git a/include/board_design_settings.h b/include/board_design_settings.h index ab6a98c062..cd3e7b688b 100644 --- a/include/board_design_settings.h +++ b/include/board_design_settings.h @@ -621,6 +621,12 @@ public: bool GetTextItalic( PCB_LAYER_ID aLayer ) const; bool GetTextUpright( PCB_LAYER_ID aLayer ) const; + /** + * Return whether footprint field text styles library values are overridden + * with the board default settings for text/graphic items. + */ + bool GetStyleFootprintFields() const; + int GetLayerClass( PCB_LAYER_ID aLayer ) const; void SetAuxOrigin( const VECTOR2I& aOrigin ) { m_auxOrigin = aOrigin; } @@ -702,6 +708,7 @@ public: int m_TextThickness[ LAYER_CLASS_COUNT ]; bool m_TextItalic[ LAYER_CLASS_COUNT ]; bool m_TextUpright[ LAYER_CLASS_COUNT ]; + bool m_StyleFootprintFields; // Default values for dimension objects DIM_UNITS_MODE m_DimensionUnitsMode; diff --git a/pcbnew/board_design_settings.cpp b/pcbnew/board_design_settings.cpp index b4199421f8..b655dc40ab 100644 --- a/pcbnew/board_design_settings.cpp +++ b/pcbnew/board_design_settings.cpp @@ -116,6 +116,8 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std: m_TextItalic[ LAYER_CLASS_OTHERS ] = false; m_TextUpright[ LAYER_CLASS_OTHERS ] = false; + m_StyleFootprintFields = true; + m_DimensionPrecision = DIM_PRECISION::X_XXXX; m_DimensionUnitsMode = DIM_UNITS_MODE::AUTOMATIC; m_DimensionUnitsFormat = DIM_UNITS_FORMAT::BARE_SUFFIX; @@ -693,6 +695,9 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std: m_params.emplace_back( new PARAM( "defaults.other_text_upright", &m_TextUpright[LAYER_CLASS_OTHERS], true ) ); + m_params.emplace_back( new PARAM( "defaults.style_footprint_fields", + &m_StyleFootprintFields, true ) ); + m_params.emplace_back( new PARAM_ENUM( "defaults.dimension_units", &m_DimensionUnitsMode, DIM_UNITS_MODE::AUTOMATIC, DIM_UNITS_MODE::INCHES, DIM_UNITS_MODE::AUTOMATIC ) ); @@ -878,6 +883,8 @@ void BOARD_DESIGN_SETTINGS::initFromOther( const BOARD_DESIGN_SETTINGS& aOther ) std::copy( std::begin( aOther.m_TextUpright ), std::end( aOther.m_TextUpright ), std::begin( m_TextUpright ) ); + m_StyleFootprintFields = aOther.m_StyleFootprintFields; + m_DimensionUnitsMode = aOther.m_DimensionUnitsMode; m_DimensionPrecision = aOther.m_DimensionPrecision; m_DimensionUnitsFormat = aOther.m_DimensionUnitsFormat; @@ -1291,3 +1298,7 @@ bool BOARD_DESIGN_SETTINGS::GetTextUpright( PCB_LAYER_ID aLayer ) const } +bool BOARD_DESIGN_SETTINGS::GetStyleFootprintFields() const +{ + return m_StyleFootprintFields; +} diff --git a/pcbnew/dialogs/panel_setup_text_and_graphics.cpp b/pcbnew/dialogs/panel_setup_text_and_graphics.cpp index 8c708f19ab..f9fd323182 100644 --- a/pcbnew/dialogs/panel_setup_text_and_graphics.cpp +++ b/pcbnew/dialogs/panel_setup_text_and_graphics.cpp @@ -170,6 +170,8 @@ bool PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataToWindow() } } + m_styleFootprintFields->SetValue( m_BrdSettings->m_StyleFootprintFields ); + // Work around an issue where wxWidgets doesn't calculate the row width on its own for( int col = 0; col < m_grid->GetNumberCols(); col++ ) m_grid->SetColMinimalWidth( col, m_grid->GetVisibleWidth( col ) ); @@ -215,6 +217,8 @@ bool PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataFromWindow() wxGridCellBoolEditor::IsTrueValue( m_grid->GetCellValue( i, COL_TEXT_UPRIGHT ) ); } + m_BrdSettings->m_StyleFootprintFields = m_styleFootprintFields->GetValue(); + // These are all stored in project file, not board, so no need for OnModify() int mode = m_dimensionUnits->GetSelection(); diff --git a/pcbnew/dialogs/panel_setup_text_and_graphics_base.cpp b/pcbnew/dialogs/panel_setup_text_and_graphics_base.cpp index cab20ad334..15121283f4 100644 --- a/pcbnew/dialogs/panel_setup_text_and_graphics_base.cpp +++ b/pcbnew/dialogs/panel_setup_text_and_graphics_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) +// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -22,6 +22,9 @@ PANEL_SETUP_TEXT_AND_GRAPHICS_BASE::PANEL_SETUP_TEXT_AND_GRAPHICS_BASE( wxWindow m_staticTextDefProp->Wrap( -1 ); m_gridSizer->Add( m_staticTextDefProp, 0, wxTOP|wxRIGHT|wxLEFT, 8 ); + m_staticline11 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + m_gridSizer->Add( m_staticline11, 0, wxEXPAND | wxALL, 5 ); + m_gridSizer->Add( 0, 3, 0, wxEXPAND, 5 ); @@ -69,6 +72,12 @@ PANEL_SETUP_TEXT_AND_GRAPHICS_BASE::PANEL_SETUP_TEXT_AND_GRAPHICS_BASE( wxWindow m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); m_gridSizer->Add( m_grid, 0, wxBOTTOM, 15 ); + m_styleFootprintFields = new wxCheckBox( this, wxID_ANY, _("Style footprint fields"), wxDefaultPosition, wxDefaultSize, 0 ); + m_styleFootprintFields->SetValue(true); + m_styleFootprintFields->SetToolTip( _("When checked, the default text style of footprint fields will be overridden by the board settings") ); + + m_gridSizer->Add( m_styleFootprintFields, 0, wxALL, 5 ); + m_gridSizer->Add( 0, 0, 0, wxEXPAND|wxTOP, 5 ); diff --git a/pcbnew/dialogs/panel_setup_text_and_graphics_base.fbp b/pcbnew/dialogs/panel_setup_text_and_graphics_base.fbp index b3bcb2dadb..f6e6286ccf 100644 --- a/pcbnew/dialogs/panel_setup_text_and_graphics_base.fbp +++ b/pcbnew/dialogs/panel_setup_text_and_graphics_base.fbp @@ -127,6 +127,64 @@ -1 + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline11 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + + + 5 wxEXPAND @@ -225,6 +283,70 @@ wxTAB_TRAVERSAL + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Style footprint fields + + 0 + + + 0 + + 1 + m_styleFootprintFields + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + When checked, the default text style of footprint fields will be overridden by the board settings + + wxFILTER_NONE + wxDefaultValidator + + + + + + 5 wxEXPAND|wxTOP diff --git a/pcbnew/dialogs/panel_setup_text_and_graphics_base.h b/pcbnew/dialogs/panel_setup_text_and_graphics_base.h index 33ac2c4872..04d174b7a1 100644 --- a/pcbnew/dialogs/panel_setup_text_and_graphics_base.h +++ b/pcbnew/dialogs/panel_setup_text_and_graphics_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) +// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -18,10 +18,10 @@ class WX_GRID; #include #include #include -#include #include -#include +#include #include +#include #include #include #include @@ -39,7 +39,9 @@ class PANEL_SETUP_TEXT_AND_GRAPHICS_BASE : public wxPanel protected: wxBoxSizer* m_gridSizer; wxStaticText* m_staticTextDefProp; + wxStaticLine* m_staticline11; WX_GRID* m_grid; + wxCheckBox* m_styleFootprintFields; wxStaticText* m_staticTextDefPropDim; wxStaticLine* m_staticline1; wxStaticText* m_lblDimensionUnits; diff --git a/pcbnew/load_select_footprint.cpp b/pcbnew/load_select_footprint.cpp index be2fe5a76f..fd206b56aa 100644 --- a/pcbnew/load_select_footprint.cpp +++ b/pcbnew/load_select_footprint.cpp @@ -46,6 +46,7 @@ using namespace std::placeholders; #include #include #include +#include #include #include #include @@ -355,8 +356,11 @@ FOOTPRINT* PCB_BASE_FRAME::loadFootprint( const LIB_ID& aFootprintId ) // any netinfo list (should be not needed, but it can be edited from the footprint editor ) footprint->ClearAllNets(); - if( m_pcb && !IsType( FRAME_FOOTPRINT_EDITOR ) ) + if( m_pcb && !IsType( FRAME_FOOTPRINT_EDITOR ) + && m_pcb->GetDesignSettings().GetStyleFootprintFields() ) + { footprint->ApplyDefaultFieldSettings( *m_pcb ); + } } return footprint;