Board Settings: control styling of footprint fields
Can use library values or board default settings. Defaults to board default settings. Fixes: https://gitlab.com/kicad/code/kicad/-/issues/8161
This commit is contained in:
parent
1d0a5ca34b
commit
cc7798745e
|
@ -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;
|
||||
|
|
|
@ -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<bool>( "defaults.other_text_upright",
|
||||
&m_TextUpright[LAYER_CLASS_OTHERS], true ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "defaults.style_footprint_fields",
|
||||
&m_StyleFootprintFields, true ) );
|
||||
|
||||
m_params.emplace_back( new PARAM_ENUM<DIM_UNITS_MODE>( "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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -127,6 +127,64 @@
|
|||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND | wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticLine" 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="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="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_staticline11</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">wxLI_HORIZONTAL</property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></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">wxEXPAND</property>
|
||||
|
@ -225,6 +283,70 @@
|
|||
<property name="window_style">wxTAB_TRAVERSAL</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</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">1</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">Style 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_styleFootprintFields</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">When checked, the default text style of footprint fields will be overridden by the board settings</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">wxEXPAND|wxTOP</property>
|
||||
|
|
|
@ -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 <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/grid.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/grid.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/gbsizer.h>
|
||||
#include <wx/sizer.h>
|
||||
|
@ -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;
|
||||
|
|
|
@ -46,6 +46,7 @@ using namespace std::placeholders;
|
|||
#include <macros.h>
|
||||
#include <pcb_edit_frame.h>
|
||||
#include <pcbnew_settings.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <view/view_controls.h>
|
||||
#include <widgets/lib_tree.h>
|
||||
#include <widgets/wx_progress_reporters.h>
|
||||
|
@ -355,9 +356,12 @@ 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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue