Uniformly save WX_GRID shown columns.

Also retires some other settings that are now handled
by DIALOG_SHIM's state saving architecture.
This commit is contained in:
Jeff Young
2025-11-13 14:41:17 +00:00
parent 4e5665108c
commit bb5a326aa6
23 changed files with 62 additions and 402 deletions
+10 -1
View File
@@ -300,7 +300,7 @@ int DIALOG_SHIM::vertPixelsFromDU( int y ) const
// our hashtable is an implementation secret, don't need or want it in a header file
#include <hashtables.h>
#include <typeinfo>
#include <grid_tricks.h>
void DIALOG_SHIM::SetPosition( const wxPoint& aNewPosition )
@@ -559,6 +559,10 @@ void DIALOG_SHIM::SaveControlState()
if( index >= 0 && index < (int) notebook->GetPageCount() )
dlgMap[ key ] = notebook->GetPageText( notebook->GetSelection() );
}
else if( WX_GRID* grid = dynamic_cast<WX_GRID*>( win ) )
{
dlgMap[ key ] = grid->GetShownColumnsAsString();
}
}
for( wxWindow* child : win->GetChildren() )
@@ -699,6 +703,11 @@ void DIALOG_SHIM::LoadControlState()
}
}
}
else if( WX_GRID* grid = dynamic_cast<WX_GRID*>( win ) )
{
if( j.is_string() )
grid->ShowHideColumns( wxString::FromUTF8( j.get<std::string>().c_str() ) );
}
}
}
+2 -14
View File
@@ -150,12 +150,10 @@ PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( wxWindow* aParentWindow, EDA_DRA
m_netclassGrid->SetUnitsProvider( m_pcbUnitsProvider.get(), i );
}
COMMON_SETTINGS* cfg = Pgm().GetCommonSettings();
if( m_isEEschema )
m_netclassGrid->ShowHideColumns( cfg->m_NetclassPanel.eeschema_visible_columns );
m_netclassGrid->ShowHideColumns( "0 11 12 13 14" );
else
m_netclassGrid->ShowHideColumns( cfg->m_NetclassPanel.pcbnew_visible_columns );
m_netclassGrid->ShowHideColumns( "0 1 2 3 4 5 6 7 8 9 10" );
m_shownColumns = m_netclassGrid->GetShownColumns();
@@ -206,8 +204,6 @@ PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( wxWindow* aParentWindow, EDA_DRA
m_netclassGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
m_assignmentGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
m_splitter->SetSashPosition( cfg->m_NetclassPanel.sash_pos );
m_addButton->SetBitmap( KiBitmapBundle( BITMAPS::small_plus ) );
m_removeButton->SetBitmap( KiBitmapBundle( BITMAPS::small_trash ) );
@@ -257,14 +253,6 @@ PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( wxWindow* aParentWindow, EDA_DRA
PANEL_SETUP_NETCLASSES::~PANEL_SETUP_NETCLASSES()
{
COMMON_SETTINGS* cfg = Pgm().GetCommonSettings();
cfg->m_NetclassPanel.sash_pos = m_splitter->GetSashPosition();
if( m_isEEschema )
cfg->m_NetclassPanel.eeschema_visible_columns = m_netclassGrid->GetShownColumnsAsString();
else
cfg->m_NetclassPanel.pcbnew_visible_columns = m_netclassGrid->GetShownColumnsAsString();
// Delete the GRID_TRICKS.
m_netclassGrid->PopEventHandler( true );
m_assignmentGrid->PopEventHandler( true );
-10
View File
@@ -55,7 +55,6 @@ COMMON_SETTINGS::COMMON_SETTINGS() :
m_Session(),
m_System(),
m_DoNotShowAgain(),
m_NetclassPanel(),
m_PackageManager(),
m_Api()
{
@@ -376,15 +375,6 @@ COMMON_SETTINGS::COMMON_SETTINGS() :
m_params.emplace_back( new PARAM_LIST<wxString>( "session.pinned_design_block_libs",
&m_Session.pinned_design_block_libs, {} ) );
m_params.emplace_back( new PARAM<int>( "netclass_panel.sash_pos",
&m_NetclassPanel.sash_pos, 160 ) );
m_params.emplace_back( new PARAM<wxString>( "netclass_panel.eeschema_shown_columns",
&m_NetclassPanel.eeschema_visible_columns, "0 11 12 13 14" ) );
m_params.emplace_back( new PARAM<wxString>( "netclass_panel.pcbnew_shown_columns",
&m_NetclassPanel.pcbnew_visible_columns, "0 1 2 3 4 5 6 7 8 9 10" ) );
m_params.emplace_back( new PARAM<int>( "package_manager.sash_pos",
&m_PackageManager.sash_pos, 380 ) );
+6 -55
View File
@@ -55,12 +55,6 @@ DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_L
{
COLOR_SETTINGS* colorSettings = m_Parent->GetColorSettings();
COLOR4D schematicBackground = colorSettings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
bool multiLine = false;
if( EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ) )
multiLine = cfg->m_Appearance.edit_label_multiple;
m_cbMultiLine->SetValue( multiLine );
m_fields = new FIELDS_GRID_TABLE( this, aParent, m_grid, m_currentLabel );
m_delayedFocusRow = -1;
@@ -73,20 +67,6 @@ DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_L
m_labelSingleLine->Show( false );
m_valueSingleLine->Show( false );
if( multiLine && aNew )
{
m_activeTextEntry = m_valueMultiLine;
SetInitialFocus( m_valueMultiLine );
m_labelCombo->Show( false );
m_valueCombo->Show( false );
}
else
{
m_labelMultiLine->Show( false );
m_valueMultiLine->Show( false );
m_valueCombo->SetValidator( m_netNameValidator );
}
}
else if( m_currentLabel->Type() == SCH_HIER_LABEL_T )
{
@@ -95,20 +75,6 @@ DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_L
m_labelCombo->Show( false );
m_valueCombo->Show( false );
if( multiLine && aNew )
{
m_activeTextEntry = m_valueMultiLine;
SetInitialFocus( m_valueMultiLine );
m_labelSingleLine->Show( false );
m_valueSingleLine->Show( false );
}
else
{
m_labelMultiLine->Show( false );
m_valueMultiLine->Show( false );
m_valueSingleLine->SetValidator( m_netNameValidator );
}
}
else if( m_currentLabel->Type() == SCH_DIRECTIVE_LABEL_T )
{
@@ -148,13 +114,8 @@ DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_L
OnAddField( aEvent );
} ) );
m_grid->SetSelectionMode( wxGrid::wxGridSelectRows );
// Show/hide columns according to user's preference
if( EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ) )
{
m_grid->ShowHideColumns( cfg->m_Appearance.edit_label_visible_columns );
m_shownColumns = m_grid->GetShownColumns();
}
m_grid->ShowHideColumns( "0 1 2 3 4 5 6 7" );
m_shownColumns = m_grid->GetShownColumns();
// Configure button logos
m_bpAdd->SetBitmap( KiBitmapBundle( BITMAPS::small_plus ) );
@@ -249,25 +210,11 @@ DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_L
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
if( EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ) )
{
if( cfg->m_Appearance.edit_label_width > 0 && cfg->m_Appearance.edit_label_height > 0 )
SetSize( cfg->m_Appearance.edit_label_width, cfg->m_Appearance.edit_label_height );
}
}
DIALOG_LABEL_PROPERTIES::~DIALOG_LABEL_PROPERTIES()
{
if( EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ) )
{
cfg->m_Appearance.edit_label_visible_columns = m_grid->GetShownColumnsAsString();
cfg->m_Appearance.edit_label_width = GetSize().x;
cfg->m_Appearance.edit_label_height = GetSize().y;
cfg->m_Appearance.edit_label_multiple = m_cbMultiLine->IsChecked();
}
// Prevents crash bug in wxGrid's d'tor
m_grid->DestroyTable( m_fields );
@@ -284,6 +231,10 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataToWindow()
if( !wxDialog::TransferDataToWindow() )
return false;
// Respond to previously-saved state of multilable checkbox
wxCommandEvent dummy;
onMultiLabelCheck( dummy );
wxString text;
if( m_activeTextEntry )
+2 -10
View File
@@ -1068,13 +1068,8 @@ DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE( SYMBOL_EDIT_FRAME* parent,
OnAddRow( aEvent );
} ) );
m_grid->SetSelectionMode( wxGrid::wxGridSelectRows );
// Show/hide columns according to the user's preference
if( SYMBOL_EDITOR_SETTINGS* cfg = parent->GetSettings() )
{
m_grid->ShowHideColumns( cfg->m_PinTableVisibleColumns );
m_columnsShown = m_grid->GetShownColumns();
}
m_grid->ShowHideColumns( "0 1 2 3 4 5 9 10" );
m_columnsShown = m_grid->GetShownColumns();
// Set special attributes
wxGridCellAttr* attr;
@@ -1210,9 +1205,6 @@ DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE( SYMBOL_EDIT_FRAME* parent,
DIALOG_LIB_EDIT_PIN_TABLE::~DIALOG_LIB_EDIT_PIN_TABLE()
{
if( SYMBOL_EDITOR_SETTINGS* cfg = m_editFrame->GetSettings() )
cfg->m_PinTableVisibleColumns = m_grid->GetShownColumnsAsString();
// Disconnect Events
m_grid->Disconnect( wxEVT_GRID_COL_SORT, wxGridEventHandler( DIALOG_LIB_EDIT_PIN_TABLE::OnColSort ), nullptr,
this );
+1 -12
View File
@@ -320,16 +320,7 @@ DIALOG_LIB_FIELDS_TABLE::DIALOG_LIB_FIELDS_TABLE( SYMBOL_EDIT_FRAME* parent, DIA
SYMBOL_EDITOR_SETTINGS::PANEL_LIB_FIELDS_TABLE& cfg = m_parent->libeditconfig()->m_LibFieldEditor;
m_viewControlsGrid->ShowHideColumns( cfg.view_controls_visible_columns );
// Ensure at least one column is visible otherwise we cannot add columns
// because there is no area to right click to get the menu managing the show/hide columns
wxString visible_column = m_viewControlsGrid->GetShownColumnsAsString();;
if( visible_column.IsEmpty() )
{
visible_column = wxT( "0" );
m_viewControlsGrid->ShowHideColumns( visible_column );
}
m_viewControlsGrid->ShowHideColumns( "0 2 3" );
CallAfter( [this, cfg]()
{
@@ -355,8 +346,6 @@ DIALOG_LIB_FIELDS_TABLE::~DIALOG_LIB_FIELDS_TABLE()
{
SYMBOL_EDITOR_SETTINGS::PANEL_LIB_FIELDS_TABLE& cfg = m_parent->libeditconfig()->m_LibFieldEditor;
cfg.view_controls_visible_columns = m_viewControlsGrid->GetShownColumnsAsString();
if( !cfg.sidebar_collapsed )
cfg.sash_pos = m_splitterMainWindow->GetSashPosition();
@@ -92,9 +92,7 @@ DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* a
if( std::shared_ptr<LIB_SYMBOL> parent = m_libEntry->GetParent().lock() )
addInheritedFields( parent );
// Show/hide columns according to the user's preference
SYMBOL_EDITOR_SETTINGS* cfg = m_Parent->GetSettings();
m_grid->ShowHideColumns( cfg->m_EditSymbolVisibleColumns );
m_grid->ShowHideColumns( "0 1 2 3 4 5 6 7" );
m_SymbolNameCtrl->SetValidator( FIELD_VALIDATOR( FIELD_T::VALUE ) );
@@ -189,9 +187,6 @@ DIALOG_LIB_SYMBOL_PROPERTIES::~DIALOG_LIB_SYMBOL_PROPERTIES()
{
m_lastOpenedPage = m_NoteBook->GetSelection( );
if( SYMBOL_EDITOR_SETTINGS* cfg = m_Parent->GetSettings() )
cfg->m_EditSymbolVisibleColumns = m_grid->GetShownColumnsAsString();
// Prevents crash bug in wxGrid's d'tor
m_grid->DestroyTable( m_fields );
+2 -10
View File
@@ -75,13 +75,8 @@ DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_S
OnAddField( aEvent );
} ) );
m_grid->SetSelectionMode( wxGrid::wxGridSelectRows );
// Show/hide columns according to user's preference
if( EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ) )
{
m_grid->ShowHideColumns( cfg->m_Appearance.edit_sheet_visible_columns );
m_shownColumns = m_grid->GetShownColumns();
}
m_grid->ShowHideColumns( "0 1 2 3 4 5 6 7" );
m_shownColumns = m_grid->GetShownColumns();
if( m_frame->GetColorSettings()->GetOverrideSchItemColors() )
m_infoBar->ShowMessage( _( "Note: individual item colors overridden in Preferences." ) );
@@ -114,9 +109,6 @@ DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_S
DIALOG_SHEET_PROPERTIES::~DIALOG_SHEET_PROPERTIES()
{
if( EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ) )
cfg->m_Appearance.edit_sheet_visible_columns = m_grid->GetShownColumnsAsString();
// Prevents crash bug in wxGrid's d'tor
m_grid->DestroyTable( m_fields );
@@ -341,16 +341,7 @@ DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent,
EESCHEMA_SETTINGS::PANEL_SYMBOL_FIELDS_TABLE& cfg = m_parent->eeconfig()->m_FieldEditorPanel;
m_viewControlsGrid->ShowHideColumns( cfg.view_controls_visible_columns );
// Ensure at least one column is visible otherwise we cannot add columns
// because there is no area to right click to get the menu managing the show/hide columns
wxString visible_column = m_viewControlsGrid->GetShownColumnsAsString();;
if( visible_column.IsEmpty() )
{
visible_column = wxT( "0" );
m_viewControlsGrid->ShowHideColumns( visible_column );
}
m_viewControlsGrid->ShowHideColumns( "0 1 2 3" );
CallAfter( [this, cfg]()
{
@@ -398,8 +389,6 @@ DIALOG_SYMBOL_FIELDS_TABLE::~DIALOG_SYMBOL_FIELDS_TABLE()
EESCHEMA_SETTINGS::PANEL_SYMBOL_FIELDS_TABLE& cfg = m_parent->eeconfig()->m_FieldEditorPanel;
cfg.view_controls_visible_columns = m_viewControlsGrid->GetShownColumnsAsString();
if( !cfg.sidebar_collapsed )
cfg.sash_pos = m_splitterMainWindow->GetSashPosition();
+2 -19
View File
@@ -333,13 +333,8 @@ DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH
OnAddField( aEvent );
} ) );
m_fieldsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
// Show/hide columns according to user's preference
if( EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ) )
{
m_fieldsGrid->ShowHideColumns( cfg->m_Appearance.edit_symbol_visible_columns );
m_shownColumns = m_fieldsGrid->GetShownColumns();
}
m_fieldsGrid->ShowHideColumns( "0 1 2 3 4 5 6 7" );
m_shownColumns = m_fieldsGrid->GetShownColumns();
if( m_part && m_part->IsMultiBodyStyle() )
{
@@ -403,13 +398,6 @@ DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH
DIALOG_SYMBOL_PROPERTIES::~DIALOG_SYMBOL_PROPERTIES()
{
if( EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ) )
{
cfg->m_Appearance.edit_symbol_visible_columns = m_fieldsGrid->GetShownColumnsAsString();
cfg->m_Appearance.edit_symbol_width = GetSize().x;
cfg->m_Appearance.edit_symbol_height = GetSize().y;
}
// Prevents crash bug in wxGrid's d'tor
m_fieldsGrid->DestroyTable( m_fields );
@@ -1106,11 +1094,6 @@ void DIALOG_SYMBOL_PROPERTIES::OnInitDlg( wxInitDialogEvent& event )
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
if( cfg && cfg->m_Appearance.edit_symbol_width > 0 && cfg->m_Appearance.edit_symbol_height > 0 )
SetSize( cfg->m_Appearance.edit_symbol_width, cfg->m_Appearance.edit_symbol_height );
}
+27 -80
View File
@@ -165,31 +165,9 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
m_SymChooserPanel(),
m_FindReplaceExtra(),
m_ERCDialog(),
m_ImportGraphics(),
m_Simulator(),
m_RescueNeverShow( false )
{
m_params.emplace_back( new PARAM<wxString>( "appearance.edit_symbol_visible_columns",
&m_Appearance.edit_symbol_visible_columns, "0 1 2 3 4 5 6 7" ) );
m_params.emplace_back( new PARAM<int>( "appearance.edit_symbol_width",
&m_Appearance.edit_symbol_width, -1 ) );
m_params.emplace_back( new PARAM<int>( "appearance.edit_symbol_height",
&m_Appearance.edit_symbol_height, -1 ) );
m_params.emplace_back( new PARAM<wxString>( "appearance.edit_sheet_visible_columns",
&m_Appearance.edit_sheet_visible_columns, "0 1 2 3 4 5 6 7" ) );
m_params.emplace_back( new PARAM<wxString>( "appearance.edit_label_visible_columns",
&m_Appearance.edit_label_visible_columns, "0 1 2 3 4 5 6 7" ) );
m_params.emplace_back( new PARAM<int>( "appearance.edit_label_width",
&m_Appearance.edit_label_width, -1 ) );
m_params.emplace_back( new PARAM<int>( "appearance.edit_label_height",
&m_Appearance.edit_label_height, -1 ) );
m_params.emplace_back( new PARAM<bool>( "appearance.footprint_preview",
&m_Appearance.footprint_preview, true ) );
@@ -524,9 +502,6 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
m_params.emplace_back( new PARAM<int>( "field_editor.selection_mode",
&m_FieldEditorPanel.selection_mode, 0 ) );
m_params.emplace_back( new PARAM<wxString>( "field_editor.view_controls_visible_columns",
&m_FieldEditorPanel.view_controls_visible_columns, "0 1 2 3" ) );
m_params.emplace_back( new PARAM<int>( "field_editor.sash_pos",
&m_FieldEditorPanel.sash_pos, 400 ) );
@@ -598,27 +573,6 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
m_params.emplace_back( new PARAM<bool>( "ERC.scroll_on_crossprobe",
&m_ERCDialog.scroll_on_crossprobe, true ) );
m_params.emplace_back( new PARAM<bool>( "import_graphics.interactive_placement",
&m_ImportGraphics.interactive_placement, true ) );
m_params.emplace_back( new PARAM<int>( "import_graphics.line_width_units",
&m_ImportGraphics.dxf_line_width_units, 0 ) );
m_params.emplace_back( new PARAM<double>( "import_graphics.line_width",
&m_ImportGraphics.dxf_line_width, 0.2 ) );
m_params.emplace_back( new PARAM<int>( "import_graphics.origin_units",
&m_ImportGraphics.origin_units, 0 ) );
m_params.emplace_back( new PARAM<double>( "import_graphics.origin_x",
&m_ImportGraphics.origin_x, 0 ) );
m_params.emplace_back( new PARAM<double>( "import_graphics.origin_y",
&m_ImportGraphics.origin_y, 0 ) );
m_params.emplace_back( new PARAM<int>( "import_graphics.dxf_units",
&m_ImportGraphics.dxf_units, 0 ) );
m_params.emplace_back( new PARAM<bool>( "change_symbols.update_references",
&m_ChangeSymbols.updateReferences, false ) );
@@ -693,49 +647,42 @@ bool EESCHEMA_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
Set( gridSizePtr, 1 );
}
ret &= fromLegacy<bool>( aCfg, "FootprintPreview", "appearance.footprint_preview" );
ret &= fromLegacy<bool>( aCfg, "NavigatorStaysOpen", "appearance.navigator_stays_open" );
ret &= fromLegacy<bool>( aCfg, "PrintSheetReferenceAndTitleBlock",
"appearance.print_sheet_reference" );
ret &= fromLegacy<bool>( aCfg, "ShowHiddenPins", "appearance.show_hidden_pins" );
ret &= fromLegacy<bool>( aCfg, "ShowIllegalSymbolLibDialog",
"appearance.show_illegal_symbol_lib_dialog" );
ret &= fromLegacy<bool>( aCfg, "ShowPageLimits", "appearance.show_page_limits" );
ret &= fromLegacy<bool>( aCfg, "ShowSheetFileNameCaseSensitivityDlg",
"appearance.show_sheet_filename_case_sensitivity_dialog" );
ret &= fromLegacy<bool>( aCfg, "FootprintPreview", "appearance.footprint_preview" );
ret &= fromLegacy<bool>( aCfg, "NavigatorStaysOpen", "appearance.navigator_stays_open" );
ret &= fromLegacy<bool>( aCfg, "PrintSheetReferenceAndTitleBlock", "appearance.print_sheet_reference" );
ret &= fromLegacy<bool>( aCfg, "ShowHiddenPins", "appearance.show_hidden_pins" );
ret &= fromLegacy<bool>( aCfg, "ShowIllegalSymbolLibDialog", "appearance.show_illegal_symbol_lib_dialog" );
ret &= fromLegacy<bool>( aCfg, "ShowPageLimits", "appearance.show_page_limits" );
ret &= fromLegacy<bool>( aCfg, "ShowSheetFileNameCaseSensitivityDlg", "appearance.show_sheet_filename_case_sensitivity_dialog" );
ret &= fromLegacy<bool>( aCfg, "AutoplaceFields", "autoplace_fields.enable" );
ret &= fromLegacy<bool>( aCfg, "AutoplaceJustify", "autoplace_fields.allow_rejustify" );
ret &= fromLegacy<bool>( aCfg, "AutoplaceAlign", "autoplace_fields.align_to_grid" );
ret &= fromLegacy<bool>( aCfg, "AutoplaceFields", "autoplace_fields.enable" );
ret &= fromLegacy<bool>( aCfg, "AutoplaceJustify", "autoplace_fields.allow_rejustify" );
ret &= fromLegacy<bool>( aCfg, "AutoplaceAlign", "autoplace_fields.align_to_grid" );
ret &= fromLegacy<int>( aCfg, "DefaultBusWidth", "drawing.default_bus_thickness" );
ret &= fromLegacy<int>( aCfg, "DefaultJunctionSize", "drawing.default_junction_size" );
ret &= fromLegacy<int>( aCfg, "DefaultDrawLineWidth", "drawing.default_line_thickness" );
ret &= fromLegacy<int>( aCfg, "RepeatStepX", "drawing.default_repeat_offset_x" );
ret &= fromLegacy<int>( aCfg, "RepeatStepY", "drawing.default_repeat_offset_y" );
ret &= fromLegacy<int>( aCfg, "DefaultWireWidth", "drawing.default_wire_thickness" );
ret &= fromLegacyString( aCfg, "FieldNames", "drawing.field_names" );
ret &= fromLegacy<bool>( aCfg, "HorizVertLinesOnly", "drawing.line_mode" );
ret &= fromLegacy<int>( aCfg, "RepeatLabelIncrement", "drawing.repeat_label_increment" );
ret &= fromLegacy<int>( aCfg, "DefaultBusWidth", "drawing.default_bus_thickness" );
ret &= fromLegacy<int>( aCfg, "DefaultJunctionSize", "drawing.default_junction_size" );
ret &= fromLegacy<int>( aCfg, "DefaultDrawLineWidth", "drawing.default_line_thickness" );
ret &= fromLegacy<int>( aCfg, "RepeatStepX", "drawing.default_repeat_offset_x" );
ret &= fromLegacy<int>( aCfg, "RepeatStepY", "drawing.default_repeat_offset_y" );
ret &= fromLegacy<int>( aCfg, "DefaultWireWidth", "drawing.default_wire_thickness" );
ret &= fromLegacyString( aCfg, "FieldNames", "drawing.field_names" );
ret &= fromLegacy<bool>( aCfg, "HorizVertLinesOnly", "drawing.line_mode" );
ret &= fromLegacy<int>( aCfg, "RepeatLabelIncrement", "drawing.repeat_label_increment" );
ret &= fromLegacy<bool>( aCfg, "DragActionIsMove", "input.drag_is_move" );
ret &= fromLegacy<bool>( aCfg, "DragActionIsMove", "input.drag_is_move" );
ret &= fromLegacy<int>( aCfg, "SelectionThickness", "selection.thickness" );
ret &= fromLegacy<bool>( aCfg, "SelectionDrawChildItems", "selection.draw_selected_children" );
ret &= fromLegacy<bool>( aCfg, "SelectionFillShapes", "selection.fill_shapes" );
ret &= fromLegacy<bool>( aCfg, "SelectPinSelectSymbolOpt",
"selection.select_pin_selects_symbol" );
ret &= fromLegacy<int>( aCfg, "SelectionThickness", "selection.thickness" );
ret &= fromLegacy<bool>( aCfg, "SelectionDrawChildItems", "selection.draw_selected_children" );
ret &= fromLegacy<bool>( aCfg, "SelectionFillShapes", "selection.fill_shapes" );
ret &= fromLegacy<bool>( aCfg, "SelectPinSelectSymbolOpt", "selection.select_pin_selects_symbol" );
ret &= fromLegacy<int>( aCfg, "AnnotateFilterMsg", "annotation.messages_filter" );
ret &= fromLegacy<int>( aCfg, "AnnotateFilterMsg", "annotation.messages_filter" );
ret &= fromLegacyString( aCfg, "bom_plugin_selected", "bom.selected_plugin" );
ret &= fromLegacyString( aCfg, "bom_plugins", "bom.plugins" );
ret &= fromLegacyString( aCfg, "bom_plugin_selected", "bom.selected_plugin" );
ret &= fromLegacyString( aCfg, "bom_plugins", "bom.plugins" );
migrateBomSettings();
ret &= fromLegacyString( aCfg, "SymbolFieldsShownColumns",
"edit_sch_component.visible_columns" );
ret &= fromLegacy<bool>( aCfg, "PageSettingsExportRevision", "page_settings.export_revision" );
ret &= fromLegacy<bool>( aCfg, "PageSettingsExportDate", "page_settings.export_date" );
ret &= fromLegacy<bool>( aCfg, "PageSettingsExportTitle", "page_settings.export_title" );
-22
View File
@@ -60,14 +60,6 @@ class EESCHEMA_SETTINGS : public APP_SETTINGS_BASE
public:
struct APPEARANCE
{
wxString edit_symbol_visible_columns;
int edit_symbol_width;
int edit_symbol_height;
wxString edit_sheet_visible_columns;
wxString edit_label_visible_columns;
int edit_label_width;
int edit_label_height;
bool edit_label_multiple;
bool footprint_preview;
bool print_sheet_reference;
wxString default_font;
@@ -237,7 +229,6 @@ public:
std::map<std::string, int> field_widths;
wxString export_filename;
int selection_mode;
wxString view_controls_visible_columns;
int sash_pos;
bool sidebar_collapsed;
};
@@ -277,18 +268,6 @@ public:
bool updateValues;
};
struct DIALOG_IMPORT_GRAPHICS
{
bool interactive_placement;
wxString last_file;
double dxf_line_width;
int dxf_line_width_units;
int origin_units;
double origin_x;
double origin_y;
int dxf_units;
};
struct SIMULATOR
{
struct VIEW
@@ -359,7 +338,6 @@ public:
FIND_REPLACE_EXTRA m_FindReplaceExtra;
DIALOG_ERC m_ERCDialog;
DIALOG_IMPORT_GRAPHICS m_ImportGraphics;
DIALOG_CHANGE_SYMBOLS m_ChangeSymbols;
SIMULATOR m_Simulator;
+3 -59
View File
@@ -72,42 +72,11 @@ DIALOG_IMPORT_GFX_SCH::DIALOG_IMPORT_GFX_SCH( SCH_BASE_FRAME* aParent ) :
{
m_browseButton->SetBitmap( KiBitmapBundle( BITMAPS::small_folder ) );
auto initWidgetsFromSettings = [&]( const auto& aCfg )
{
m_placementInteractive = aCfg->m_ImportGraphics.interactive_placement;
m_xOrigin.SetValue( aCfg->m_ImportGraphics.origin_x * schIUScale.IU_PER_MM );
m_yOrigin.SetValue( aCfg->m_ImportGraphics.origin_y * schIUScale.IU_PER_MM );
m_defaultLineWidth.SetValue( aCfg->m_ImportGraphics.dxf_line_width * schIUScale.IU_PER_MM );
m_textCtrlFileName->SetValue( aCfg->m_ImportGraphics.last_file );
m_rbInteractivePlacement->SetValue( m_placementInteractive );
m_rbAbsolutePlacement->SetValue( !m_placementInteractive );
m_importScaleCtrl->SetValue( wxString::Format( wxT( "%f" ), m_importScale ) );
for( const std::pair<const DXF_IMPORT_UNITS, wxString>& unitEntry : dxfUnitsMap )
m_choiceDxfUnits->Append( unitEntry.second );
m_choiceDxfUnits->SetSelection( aCfg->m_ImportGraphics.dxf_units );
};
if( SYMBOL_EDIT_FRAME* symFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( aParent ) )
{
m_importer = std::make_unique<GRAPHICS_IMPORTER_LIB_SYMBOL>( symFrame->GetCurSymbol(),
symFrame->GetUnit() );
SYMBOL_EDITOR_SETTINGS* cfg = aParent->libeditconfig();
initWidgetsFromSettings( cfg );
}
m_importer = std::make_unique<GRAPHICS_IMPORTER_LIB_SYMBOL>( symFrame->GetCurSymbol(), symFrame->GetUnit() );
else if( dynamic_cast<SCH_EDIT_FRAME*>( aParent ) )
{
m_importer = std::make_unique<GRAPHICS_IMPORTER_SCH>();
EESCHEMA_SETTINGS* cfg = aParent->eeconfig();
initWidgetsFromSettings( cfg );
}
m_gfxImportMgr = std::make_unique<GRAPHICS_IMPORT_MGR>();
wxCommandEvent dummy;
@@ -121,39 +90,14 @@ DIALOG_IMPORT_GFX_SCH::DIALOG_IMPORT_GFX_SCH( SCH_BASE_FRAME* aParent ) :
Centre();
m_textCtrlFileName->Connect( wxEVT_COMMAND_TEXT_UPDATED,
wxCommandEventHandler( DIALOG_IMPORT_GFX_SCH::onFilename ),
nullptr, this );
wxCommandEventHandler( DIALOG_IMPORT_GFX_SCH::onFilename ), nullptr, this );
}
DIALOG_IMPORT_GFX_SCH::~DIALOG_IMPORT_GFX_SCH()
{
auto saveToSettings = [&]( const auto& aCfg )
{
aCfg->m_ImportGraphics.interactive_placement = m_placementInteractive;
aCfg->m_ImportGraphics.last_file = m_textCtrlFileName->GetValue();
aCfg->m_ImportGraphics.dxf_line_width = schIUScale.IUTomm( m_defaultLineWidth.GetValue() );
aCfg->m_ImportGraphics.origin_x = schIUScale.IUTomm( m_xOrigin.GetValue() );
aCfg->m_ImportGraphics.origin_y = schIUScale.IUTomm( m_yOrigin.GetValue() );
aCfg->m_ImportGraphics.dxf_units = m_choiceDxfUnits->GetSelection();
m_importScale = EDA_UNIT_UTILS::UI::DoubleValueFromString( m_importScaleCtrl->GetValue() );
};
if( SYMBOL_EDIT_FRAME* symFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_parent ) )
{
SYMBOL_EDITOR_SETTINGS* cfg = symFrame->libeditconfig();
saveToSettings( cfg );
}
else if( SCH_EDIT_FRAME* schFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_parent ) )
{
EESCHEMA_SETTINGS* cfg = schFrame->eeconfig();
saveToSettings( cfg );
}
m_textCtrlFileName->Disconnect( wxEVT_COMMAND_TEXT_UPDATED,
wxCommandEventHandler( DIALOG_IMPORT_GFX_SCH::onFilename ),
nullptr, this );
wxCommandEventHandler( DIALOG_IMPORT_GFX_SCH::onFilename ), nullptr, this );
}
@@ -38,10 +38,8 @@ SYMBOL_EDITOR_SETTINGS::SYMBOL_EDITOR_SETTINGS() :
APP_SETTINGS_BASE( "symbol_editor", libeditSchemaVersion ),
m_Defaults(),
m_Repeat(),
m_ImportGraphics(),
m_ShowPinElectricalType( true ),
m_LibWidth(),
m_EditSymbolVisibleColumns()
m_LibWidth()
{
// Make Coverity happy
m_UseEeschemaColorSettings = true;;
@@ -79,27 +77,6 @@ SYMBOL_EDITOR_SETTINGS::SYMBOL_EDITOR_SETTINGS() :
m_params.emplace_back( new PARAM<int>( "repeat.pin_step",
&m_Repeat.pin_step, 100 ) );
m_params.emplace_back( new PARAM<bool>( "import_graphics.interactive_placement",
&m_ImportGraphics.interactive_placement, true ) );
m_params.emplace_back( new PARAM<int>( "import_graphics.line_width_units",
&m_ImportGraphics.dxf_line_width_units, 0 ) );
m_params.emplace_back( new PARAM<double>( "import_graphics.line_width",
&m_ImportGraphics.dxf_line_width, 0.2 ) );
m_params.emplace_back( new PARAM<int>( "import_graphics.origin_units",
&m_ImportGraphics.origin_units, 0 ) );
m_params.emplace_back( new PARAM<double>( "import_graphics.origin_x",
&m_ImportGraphics.origin_x, 0 ) );
m_params.emplace_back( new PARAM<double>( "import_graphics.origin_y",
&m_ImportGraphics.origin_y, 0 ) );
m_params.emplace_back( new PARAM<int>( "import_graphics.dxf_units",
&m_ImportGraphics.dxf_units, 0 ) );
m_params.emplace_back( new PARAM<bool>( "show_pin_electrical_type",
&m_ShowPinElectricalType, true ) );
@@ -121,21 +98,12 @@ SYMBOL_EDITOR_SETTINGS::SYMBOL_EDITOR_SETTINGS() :
m_params.emplace_back( new PARAM<int>( "library.sort_mode",
&m_LibrarySortMode, 0 ) );
m_params.emplace_back( new PARAM<wxString>( "edit_symbol_visible_columns",
&m_EditSymbolVisibleColumns, "0 1 2 3 4 5 6 7" ) );
m_params.emplace_back( new PARAM<wxString>( "pin_table_visible_columns",
&m_PinTableVisibleColumns, "0 1 2 3 4 5 9 10" ) );
m_params.emplace_back( new PARAM<bool>( "use_eeschema_color_settings",
&m_UseEeschemaColorSettings, true ) );
m_params.emplace_back( new PARAM_MAP<int>( "lib_field_editor.field_widths",
&m_LibFieldEditor.field_widths, {} ) );
m_params.emplace_back( new PARAM<wxString>( "lib_field_editor.view_controls_visible_columns",
&m_LibFieldEditor.view_controls_visible_columns, "0 2 3" ) );
m_params.emplace_back( new PARAM<int>( "lib_field_editor.sash_pos",
&m_LibFieldEditor.sash_pos, 400 ) );
@@ -227,9 +195,5 @@ bool SYMBOL_EDITOR_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
ret &= fromLegacy<int>( aCfg, "LibeditLibWidth", "lib_table_width" );
ret &= fromLegacy<bool>( aCfg, "LibeditShowPinElectricalType", "show_pin_electrical_type" );
ret &= fromLegacyString( aCfg, "LibEditFieldsShownColumns", "edit_symbol_visible_columns" );
ret &= fromLegacyString( aCfg, "PinTableShownColumns", "pin_table_visible_columns" );
return ret;
}
@@ -53,22 +53,9 @@ public:
int pin_step;
};
struct DIALOG_IMPORT_GRAPHICS
{
bool interactive_placement;
wxString last_file;
double dxf_line_width;
int dxf_line_width_units;
int origin_units;
double origin_x;
double origin_y;
int dxf_units;
};
struct PANEL_LIB_FIELDS_TABLE
{
std::map<std::string, int> field_widths;
wxString view_controls_visible_columns;
int sash_pos;
bool sidebar_collapsed;
};
@@ -85,8 +72,6 @@ public:
REPEAT m_Repeat;
DIALOG_IMPORT_GRAPHICS m_ImportGraphics;
bool m_ShowPinElectricalType;
bool m_ShowHiddenPins;
bool m_ShowHiddenFields;
@@ -99,10 +84,6 @@ public:
int m_LibrarySortMode;
wxString m_EditSymbolVisibleColumns;
wxString m_PinTableVisibleColumns;
bool m_UseEeschemaColorSettings;
SCH_SELECTION_FILTER_OPTIONS m_SelectionFilter;
-2
View File
@@ -82,8 +82,6 @@ public:
wxString m_LastExportPath;
wxString m_FootprintTextShownColumns;
PCB_SELECTION_FILTER_OPTIONS m_SelectionFilter;
std::vector<LAYER_PRESET> m_LayerPresets;
-8
View File
@@ -154,13 +154,6 @@ public:
bool update_check_prompt;
};
struct NETCLASS_PANEL
{
int sash_pos;
wxString eeschema_visible_columns;
wxString pcbnew_visible_columns;
};
struct PACKAGE_MANAGER
{
int sash_pos;
@@ -233,7 +226,6 @@ public:
SESSION m_Session;
SYSTEM m_System;
DO_NOT_SHOW_AGAIN m_DoNotShowAgain;
NETCLASS_PANEL m_NetclassPanel;
PACKAGE_MANAGER m_PackageManager;
GIT m_Git;
API m_Api;
+1 -2
View File
@@ -105,8 +105,7 @@ PANEL_PACKAGES_VIEW::PANEL_PACKAGES_VIEW( wxWindow*
PANEL_PACKAGES_VIEW::~PANEL_PACKAGES_VIEW()
{
m_splitter1->Disconnect( wxEVT_IDLE, wxIdleEventHandler( PANEL_PACKAGES_VIEW::SetSashOnIdle ),
NULL, this );
m_splitter1->Disconnect( wxEVT_IDLE, wxIdleEventHandler( PANEL_PACKAGES_VIEW::SetSashOnIdle ), nullptr, this );
COMMON_SETTINGS* cfg = Pgm().GetCommonSettings();
cfg->m_PackageManager.sash_pos = m_splitter1->GetSashPosition();
@@ -98,10 +98,7 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen
m_itemsGrid->SetTable( m_fields );
m_itemsGrid->PushEventHandler( new GRID_TRICKS( m_itemsGrid ) );
m_itemsGrid->SetupColumnAutosizer( PFC_VALUE );
// Show/hide text item columns according to the user's preference
if( PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings() )
m_itemsGrid->ShowHideColumns( cfg->m_FootprintTextShownColumns );
m_itemsGrid->ShowHideColumns( "0 1 2 3 4 5 7" );
m_orientation.SetUnits( EDA_UNITS::DEGREES );
m_orientation.SetPrecision( 3 );
@@ -182,9 +179,6 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen
DIALOG_FOOTPRINT_PROPERTIES::~DIALOG_FOOTPRINT_PROPERTIES()
{
if( PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings() )
cfg->m_FootprintTextShownColumns = m_itemsGrid->GetShownColumnsAsString();
// Prevents crash bug in wxGrid's d'tor
m_itemsGrid->DestroyTable( m_fields );
@@ -237,8 +237,7 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR( FO
m_jumperGroupsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
m_customUserLayersGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
// Show/hide columns according to the user's preference
m_itemsGrid->ShowHideColumns( m_frame->GetSettings()->m_FootprintTextShownColumns );
m_itemsGrid->ShowHideColumns( "0 1 2 3 4 5 7" );
m_FootprintNameCtrl->SetValidator( FOOTPRINT_NAME_VALIDATOR() );
@@ -288,8 +287,6 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR( FO
DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::~DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR()
{
m_frame->GetSettings()->m_FootprintTextShownColumns = m_itemsGrid->GetShownColumnsAsString();
// Prevents crash bug in wxGrid's d'tor
m_itemsGrid->DestroyTable( m_fields );
m_privateLayersGrid->DestroyTable( m_privateLayers );
+1 -6
View File
@@ -53,8 +53,7 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
m_AngleSnapMode( LEADER_MODE::DEG45 ),
m_ArcEditMode( ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS ),
m_LibWidth( 250 ),
m_LastExportPath(),
m_FootprintTextShownColumns()
m_LastExportPath()
{
m_MagneticItems.pads = MAGNETIC_OPTIONS::CAPTURE_ALWAYS;
m_MagneticItems.tracks = MAGNETIC_OPTIONS::NO_EFFECT;
@@ -104,9 +103,6 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
m_params.emplace_back( new PARAM<bool>( "pcb_display.pad_numbers",
&m_ViewersDisplay.m_DisplayPadNumbers, true ) );
m_params.emplace_back( new PARAM<wxString>( "window.footprint_text_shown_columns",
&m_FootprintTextShownColumns, "0 1 2 3 4 5 7" ) );
m_params.emplace_back( new PARAM<int>( "editing.magnetic_pads",
reinterpret_cast<int*>( &m_MagneticItems.pads ),
static_cast<int>( MAGNETIC_OPTIONS::CAPTURE_ALWAYS ) ) );
@@ -398,7 +394,6 @@ bool FOOTPRINT_EDITOR_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
//
ret &= fromLegacy<int>( aCfg, "ModeditLibWidth", "window.lib_width" );
ret &= fromLegacyString( aCfg, "import_last_path", "system.last_import_export_path" );
ret &= fromLegacyString( aCfg, "LibFootprintTextShownColumns", "window.footprint_text_shown_columns" );
ret &= fromLegacy<int>( aCfg, "FpEditorMagneticPads", "editing.magnetic_pads" );
ret &= fromLegacy<bool>( aCfg, "FpEditorDisplayPolarCoords", "editing.polar_coords" );
-5
View File
@@ -287,9 +287,6 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
m_params.emplace_back( new PARAM<bool>( "export_d356.doNotExportUnconnectedPads",
&m_ExportD356.doNotExportUnconnectedPads, false ) );
m_params.emplace_back( new PARAM<wxString>( "window.footprint_text_shown_columns",
&m_FootprintTextShownColumns, "0 1 2 3 4 5 7" ) );
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "action_plugins",
[&]() -> nlohmann::json
{
@@ -524,8 +521,6 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
ret &= fromLegacy<double>( aCfg, "PSPlotFineWidthAdj", "plot.ps_fine_width_adjust" );
ret &= fromLegacy<bool>( aCfg, "CheckZonesBeforePlotting", "plot.check_zones_before_plotting" );
ret &= fromLegacyString( aCfg, "FootprintTextShownColumns", "window.footprint_text_shown_columns" );
ret &= fromLegacy<int>( aCfg, "FpWizardListWidth", "footprint_wizard_list.width" );
ret &= fromLegacy<int>( aCfg, "FpWizardListHeight", "footprint_wizard_list.height" );
-2
View File
@@ -262,8 +262,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.
wxString m_FootprintTextShownColumns;
std::unique_ptr<PNS::ROUTING_SETTINGS> m_PnsSettings;
int m_FootprintViewerLibListWidth;