diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 81515b7277..e023bf766e 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -436,6 +436,8 @@ set( COMMON_DLG_SRCS dialogs/panel_image_editor_base.cpp dialogs/panel_grid_settings.cpp dialogs/panel_grid_settings_base.cpp + dialogs/panel_maintenance.cpp + dialogs/panel_maintenance_base.cpp dialogs/panel_mouse_settings.cpp dialogs/panel_mouse_settings_base.cpp dialogs/panel_spacemouse.cpp diff --git a/common/dialogs/panel_common_settings.cpp b/common/dialogs/panel_common_settings.cpp index 7b813a21e8..c563cf2363 100644 --- a/common/dialogs/panel_common_settings.cpp +++ b/common/dialogs/panel_common_settings.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -34,7 +33,6 @@ #include #include #include -#include #include #include @@ -165,7 +163,6 @@ bool PANEL_COMMON_SETTINGS::TransferDataFromWindow() commonSettings->m_System.autosave_interval = m_SaveTime->GetValue() * 60; commonSettings->m_System.file_history_size = m_fileHistorySize->GetValue(); - commonSettings->m_System.clear_3d_cache_interval = m_Clear3DCacheFilesOlder->GetValue(); commonSettings->m_Graphics.aa_mode = m_antialiasing->GetSelection(); @@ -265,8 +262,6 @@ void PANEL_COMMON_SETTINGS::applySettingsToPanel( COMMON_SETTINGS& aSettings ) else m_rbFallback->SetValue( true ); - m_Clear3DCacheFilesOlder->SetValue( aSettings.m_System.clear_3d_cache_interval ); - if( m_canvasScaleCtrl ) { const DPI_SCALING_COMMON dpi( &aSettings, this ); diff --git a/common/dialogs/panel_common_settings_base.cpp b/common/dialogs/panel_common_settings_base.cpp index 85a0cdac46..21aaa9db55 100644 --- a/common/dialogs/panel_common_settings_base.cpp +++ b/common/dialogs/panel_common_settings_base.cpp @@ -342,7 +342,7 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind bSessionSizer->Add( 0, 5, 0, 0, 5 ); wxGridBagSizer* gbSizer1; - gbSizer1 = new wxGridBagSizer( 4, 5 ); + gbSizer1 = new wxGridBagSizer( 5, 5 ); gbSizer1->SetFlexibleDirection( wxBOTH ); gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); gbSizer1->SetEmptyCellSize( wxSize( -1,2 ) ); @@ -368,19 +368,6 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind m_fileHistorySize = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 0 ); gbSizer1->Add( m_fileHistorySize, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - m_staticTextClear3DCache = new wxStaticText( this, wxID_ANY, _("3D cache file duration:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextClear3DCache->Wrap( -1 ); - gbSizer1->Add( m_staticTextClear3DCache, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); - - m_Clear3DCacheFilesOlder = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 120, 30 ); - m_Clear3DCacheFilesOlder->SetToolTip( _("3D cache files older than this are deleted.\nIf set to 0, cache clearing is disabled") ); - - gbSizer1->Add( m_Clear3DCacheFilesOlder, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - m_staticTextDays = new wxStaticText( this, wxID_ANY, _("days"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextDays->Wrap( -1 ); - gbSizer1->Add( m_staticTextDays, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); - gbSizer1->AddGrowableCol( 1 ); @@ -403,7 +390,7 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind bProjectBackupSizer = new wxBoxSizer( wxVERTICAL ); wxGridBagSizer* gbSizer3; - gbSizer3 = new wxGridBagSizer( 0, 0 ); + gbSizer3 = new wxGridBagSizer( 2, 0 ); gbSizer3->SetFlexibleDirection( wxBOTH ); gbSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); @@ -421,45 +408,45 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind m_staticText9->Wrap( -1 ); m_staticText9->SetToolTip( _("How many backup files total to keep (set to 0 for no limit)") ); - gbSizer3->Add( m_staticText9, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); + gbSizer3->Add( m_staticText9, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 3 ); m_backupLimitTotalFiles = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 1000, 0 ); - gbSizer3->Add( m_backupLimitTotalFiles, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + gbSizer3->Add( m_backupLimitTotalFiles, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 3 ); m_staticText10 = new wxStaticText( this, wxID_ANY, _("Maximum backups per day:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText10->Wrap( -1 ); m_staticText10->SetToolTip( _("How many backup files to keep each day (set to 0 for no limit)") ); - gbSizer3->Add( m_staticText10, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); + gbSizer3->Add( m_staticText10, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 3 ); m_backupLimitDailyFiles = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 1000, 0 ); - gbSizer3->Add( m_backupLimitDailyFiles, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + gbSizer3->Add( m_backupLimitDailyFiles, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 3 ); m_staticText11 = new wxStaticText( this, wxID_ANY, _("Minimum time between backups:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText11->Wrap( -1 ); m_staticText11->SetToolTip( _("Number of minutes since the last backup before another will be created the next time you save (set to 0 for no minimum)") ); - gbSizer3->Add( m_staticText11, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); + gbSizer3->Add( m_staticText11, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 3 ); m_backupMinInterval = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 3600, 0 ); - gbSizer3->Add( m_backupMinInterval, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + gbSizer3->Add( m_backupMinInterval, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxEXPAND, 3 ); m_staticText15 = new wxStaticText( this, wxID_ANY, _("minutes"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText15->Wrap( -1 ); - gbSizer3->Add( m_staticText15, wxGBPosition( 4, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); + gbSizer3->Add( m_staticText15, wxGBPosition( 4, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 3 ); m_staticText16 = new wxStaticText( this, wxID_ANY, _("Maximum total backup size:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText16->Wrap( -1 ); m_staticText16->SetToolTip( _("If the total size of backup files grows above this limit, old backups will be deleted (set to 0 for no limit)") ); - gbSizer3->Add( m_staticText16, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); + gbSizer3->Add( m_staticText16, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 3 ); m_backupLimitTotalSize = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 1000, 0 ); - gbSizer3->Add( m_backupLimitTotalSize, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + gbSizer3->Add( m_backupLimitTotalSize, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 3 ); m_staticText17 = new wxStaticText( this, wxID_ANY, _("MB"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText17->Wrap( -1 ); - gbSizer3->Add( m_staticText17, wxGBPosition( 5, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + gbSizer3->Add( m_staticText17, wxGBPosition( 5, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 ); gbSizer3->AddGrowableCol( 1 ); diff --git a/common/dialogs/panel_common_settings_base.fbp b/common/dialogs/panel_common_settings_base.fbp index dcf4cd27d7..6a0e2e8a47 100644 --- a/common/dialogs/panel_common_settings_base.fbp +++ b/common/dialogs/panel_common_settings_base.fbp @@ -3388,7 +3388,7 @@ gbSizer1 wxFLEX_GROWMODE_SPECIFIED none - 4 + 5 5 1 @@ -3716,202 +3716,6 @@ - - 5 - 1 - 0 - wxALIGN_CENTER_VERTICAL - 2 - 1 - - 1 - 1 - 1 - 1 - 0 - - 0 - 0 - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - 3D cache file duration: - 0 - - 0 - - - 0 - - 1 - m_staticTextClear3DCache - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - - - 5 - 1 - 1 - wxALIGN_CENTER_VERTICAL|wxEXPAND - 2 - 1 - - 1 - 1 - 1 - 1 - 0 - - 0 - 0 - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - 30 - 120 - - 0 - - 0 - - 0 - - 1 - m_Clear3DCacheFilesOlder - 1 - - - protected - 1 - - Resizable - 1 - - wxSP_ARROW_KEYS - ; ; forward_declare - 0 - 3D cache files older than this are deleted. If set to 0, cache clearing is disabled - - - - - - - - 5 - 1 - 2 - wxALIGN_CENTER_VERTICAL - 2 - 1 - - 1 - 1 - 1 - 1 - 0 - - 0 - 0 - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - days - 0 - - 0 - - - 0 - - 1 - m_staticTextDays - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - @@ -4070,7 +3874,7 @@ gbSizer3 wxFLEX_GROWMODE_SPECIFIED none - 0 + 2 5 3 @@ -4208,7 +4012,7 @@ - 5 + 3 1 0 wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT @@ -4273,7 +4077,7 @@ - 5 + 3 1 1 wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND @@ -4339,7 +4143,7 @@ - 5 + 3 1 0 wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT @@ -4404,7 +4208,7 @@ - 5 + 3 1 1 wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT @@ -4470,7 +4274,7 @@ - 5 + 3 1 0 wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT @@ -4535,7 +4339,7 @@ - 5 + 3 1 1 wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxEXPAND @@ -4601,7 +4405,7 @@ - 5 + 3 1 2 wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT @@ -4666,7 +4470,7 @@ - 5 + 3 1 0 wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT @@ -4731,7 +4535,7 @@ - 5 + 3 1 1 wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND @@ -4797,7 +4601,7 @@ - 5 + 3 1 2 wxALIGN_CENTER_VERTICAL|wxRIGHT diff --git a/common/dialogs/panel_common_settings_base.h b/common/dialogs/panel_common_settings_base.h index a9f2040db1..97084af00c 100644 --- a/common/dialogs/panel_common_settings_base.h +++ b/common/dialogs/panel_common_settings_base.h @@ -96,9 +96,6 @@ class PANEL_COMMON_SETTINGS_BASE : public RESETTABLE_PANEL wxSpinCtrl* m_SaveTime; wxStaticText* m_staticTextFileHistorySize; wxSpinCtrl* m_fileHistorySize; - wxStaticText* m_staticTextClear3DCache; - wxSpinCtrl* m_Clear3DCacheFilesOlder; - wxStaticText* m_staticTextDays; wxStaticText* m_staticText25; wxStaticLine* m_staticline4; wxCheckBox* m_cbBackupEnabled; diff --git a/common/dialogs/panel_data_collection_base.cpp b/common/dialogs/panel_data_collection_base.cpp index 3eb2da9ffa..958f858a1d 100644 --- a/common/dialogs/panel_data_collection_base.cpp +++ b/common/dialogs/panel_data_collection_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -30,13 +30,13 @@ PANEL_DATA_COLLECTION_BASE::PANEL_DATA_COLLECTION_BASE( wxWindow* parent, wxWind m_sentryUid = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); m_sentryUid->SetMinSize( wxSize( 340,-1 ) ); - bSizer3->Add( m_sentryUid, 0, wxALL, 5 ); + bSizer3->Add( m_sentryUid, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); m_buttonResetId = new wxButton( this, wxID_ANY, _("Reset Unique Id"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer3->Add( m_buttonResetId, 0, wxALL, 5 ); + bSizer3->Add( m_buttonResetId, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 10 ); - bSizer8->Add( bSizer3, 1, wxEXPAND, 5 ); + bSizer8->Add( bSizer3, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); bPanelSizer->Add( bSizer8, 1, wxEXPAND, 5 ); diff --git a/common/dialogs/panel_data_collection_base.fbp b/common/dialogs/panel_data_collection_base.fbp index 2609d41c3f..ed39b2a897 100644 --- a/common/dialogs/panel_data_collection_base.fbp +++ b/common/dialogs/panel_data_collection_base.fbp @@ -1,348 +1,355 @@ - + - - - - C++ - 1 - source_name - 0 - 0 - res - UTF-8 - connect - panel_data_collection_base - 1000 - none - - - 1 - PanelDataCollection - - . - - 1 - 1 - 1 - 1 - UI - 0 - 1 - 0 - - 0 - wxAUI_MGR_DEFAULT - - - 1 - 1 - impl_virtual - - - 0 - wxID_ANY - + + + C++ + + 1 + connect + none + + + 0 + 1 + res + UTF-8 + panel_data_collection_base + 1000 + 1 + 1 + UI + PanelDataCollection + . + 0 + source_name + 1 + 0 + source_name + + + 1 + 1 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + 1 + 0 + 1 + impl_virtual + + + 0 + wxID_ANY + + + PANEL_DATA_COLLECTION_BASE + + -1,-1 + RESETTABLE_PANEL; widgets/resettable_panel.h; Not forward_declare + + 0 + + + wxTAB_TRAVERSAL + + + bPanelSizer + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + - PANEL_DATA_COLLECTION_BASE - - -1,-1 - RESETTABLE_PANEL; widgets/resettable_panel.h; Not forward_declare - - 0 - - - wxTAB_TRAVERSAL - + bSizer8 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + KiCad can anonymously report crashes and special event data to developers in order to aid identifying critical bugs across the user base more effectively and help profile functionality to guide improvements. To link automatic reports from the same KiCad install, a unique identifier is generated that is completely random, and is only used for the purposes of crash reporting. No personally identifiable information (PII) including IP address is stored or connected to this identifier. You may reset this id at anytime with the button provided. If you choose to voluntarily participate, KiCad will automatically handle sending said reports when crashes or events occur. Your design files such as schematic or PCB are never shared in this process. + 0 + + 0 + + + 0 - bPanelSizer + 1 + m_stExplanation + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + 500 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + I agree to provide anonymous reports + + 0 + + + 0 + + 1 + m_cbOptIn + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxEXPAND|wxTOP|wxBOTTOM + 0 + + + bSizer3 wxHORIZONTAL none - - 5 - wxEXPAND - 1 - - - bSizer8 - wxVERTICAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - KiCad can anonymously report crashes and special event data to developers in order to aid identifying critical bugs across the user base more effectively and help profile functionality to guide improvements. To link automatic reports from the same KiCad install, a unique identifier is generated that is completely random, and is only used for the purposes of crash reporting. No personally identifiable information (PII) including IP address is stored or connected to this identifier. You may reset this id at anytime with the button provided. If you choose to voluntarily participate, KiCad will automatically handle sending said reports when crashes or events occur. Your design files such as schematic or PCB are never shared in this process. - 0 - - 0 - - - 0 - - 1 - m_stExplanation - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - 500 - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - I agree to provide anonymous reports - - 0 - - - 0 - - 1 - m_cbOptIn - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxEXPAND - 1 - - - bSizer3 - wxHORIZONTAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - 340,-1 - 1 - m_sentryUid - 1 - - - protected - 1 - - Resizable - 1 - - wxTE_READONLY - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - 0 - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Reset Unique Id - - 0 - - 0 - - - 0 - - 1 - m_buttonResetId - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnResetIdClick - - - - - + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + 340,-1 + 1 + m_sentryUid + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_READONLY + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 10 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Reset Unique Id + + 0 + + 0 + + + 0 + + 1 + m_buttonResetId + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnResetIdClick + + + + + + diff --git a/common/dialogs/panel_data_collection_base.h b/common/dialogs/panel_data_collection_base.h index 63d7d69b4d..a539ffc44f 100644 --- a/common/dialogs/panel_data_collection_base.h +++ b/common/dialogs/panel_data_collection_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! diff --git a/common/dialogs/panel_maintenance.cpp b/common/dialogs/panel_maintenance.cpp new file mode 100644 index 0000000000..a349a8d68c --- /dev/null +++ b/common/dialogs/panel_maintenance.cpp @@ -0,0 +1,146 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright The KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +#include +#include +#include +#include +#include +#include +#include + + +PANEL_MAINTENANCE::PANEL_MAINTENANCE( wxWindow* aParent, EDA_BASE_FRAME* aFrame ) : + PANEL_MAINTENANCE_BASE( aParent ), + m_frame( aFrame ) +{ +} + + +bool PANEL_MAINTENANCE::TransferDataToWindow() +{ + COMMON_SETTINGS* commonSettings = Pgm().GetCommonSettings(); + + applySettingsToPanel( *commonSettings ); + + return true; +} + + +bool PANEL_MAINTENANCE::TransferDataFromWindow() +{ + COMMON_SETTINGS* commonSettings = Pgm().GetCommonSettings(); + + commonSettings->m_System.clear_3d_cache_interval = m_Clear3DCacheFilesOlder->GetValue(); + + Pgm().GetSettingsManager().Save( commonSettings ); + + return true; +} + + +void PANEL_MAINTENANCE::ResetPanel() +{ + COMMON_SETTINGS defaultSettings; + + defaultSettings.ResetToDefaults(); + + applySettingsToPanel( defaultSettings ); +} + + +void PANEL_MAINTENANCE::applySettingsToPanel( COMMON_SETTINGS& aSettings ) +{ + m_Clear3DCacheFilesOlder->SetValue( aSettings.m_System.clear_3d_cache_interval ); +} + + +void PANEL_MAINTENANCE::onClearFileHistory( wxCommandEvent& event ) +{ + Pgm().GetSettingsManager().ClearFileHistory(); + + // We also need to clear the in-memory wxWidgets histories, update menu bars, etc. + m_frame->Kiway().ClearFileHistory(); + + if( PAGED_DIALOG* dlg = PAGED_DIALOG::GetDialog( this ) ) + dlg->GetInfoBar()->ShowMessageFor( _( "File history cleared." ), 6000, wxICON_INFORMATION ); +} + + +void PANEL_MAINTENANCE::doClearDontShowAgain() +{ + if( COMMON_SETTINGS* settings = Pgm().GetSettingsManager().GetCommonSettings() ) + { + // intra-session do-not-show-agains + settings->m_DoNotShowAgain = {}; + settings->SaveToFile( Pgm().GetSettingsManager().GetPathForSettingsFile( settings ) ); + } + + // Session do-not-show-agains + KIDIALOG::ClearDoNotShowAgainDialogs(); +} + + +void PANEL_MAINTENANCE::onClearDontShowAgain( wxCommandEvent& event ) +{ + doClearDontShowAgain(); + + if( PAGED_DIALOG* dlg = PAGED_DIALOG::GetDialog( this ) ) + dlg->GetInfoBar()->ShowMessageFor( _( "\"Don't show again\" dialogs reset." ), 6000, wxICON_INFORMATION ); +} + + +void PANEL_MAINTENANCE::doClearDialogState() +{ + doClearDontShowAgain(); + + if( COMMON_SETTINGS* settings = Pgm().GetSettingsManager().GetCommonSettings() ) + { + settings->m_dialogControlValues = {}; + settings->SaveToFile( Pgm().GetSettingsManager().GetPathForSettingsFile( settings ) ); + } +} + + +void PANEL_MAINTENANCE::onClearDialogState( wxCommandEvent& event ) +{ + doClearDialogState(); + + if( PAGED_DIALOG* dlg = PAGED_DIALOG::GetDialog( this ) ) + dlg->GetInfoBar()->ShowMessageFor( _( "All dialogs reset to defaults." ), 6000, wxICON_INFORMATION ); +} + + +void PANEL_MAINTENANCE::onResetAll( wxCommandEvent& event ) +{ + doClearDialogState(); + Pgm().GetSettingsManager().ResetToDefaults(); + + // Kill changes currently in dialog + wxQueueEvent( m_parent, new wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL ) ); + + // Reopen dialog + wxQueueEvent( m_frame, new wxCommandEvent( wxEVT_COMMAND_MENU_SELECTED, wxID_PREFERENCES ) ); +} diff --git a/common/dialogs/panel_maintenance_base.cpp b/common/dialogs/panel_maintenance_base.cpp new file mode 100644 index 0000000000..3f488076d0 --- /dev/null +++ b/common/dialogs/panel_maintenance_base.cpp @@ -0,0 +1,83 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "panel_maintenance_base.h" + +/////////////////////////////////////////////////////////////////////////// + +PANEL_MAINTENANCE_BASE::PANEL_MAINTENANCE_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : RESETTABLE_PANEL( parent, id, pos, size, style, name ) +{ + wxBoxSizer* bPanelSizer; + bPanelSizer = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* margins; + margins = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* b3DCacheSizer; + b3DCacheSizer = new wxBoxSizer( wxHORIZONTAL ); + + m_staticTextClear3DCache = new wxStaticText( this, wxID_ANY, _("3D cache file duration:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextClear3DCache->Wrap( -1 ); + b3DCacheSizer->Add( m_staticTextClear3DCache, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_Clear3DCacheFilesOlder = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 120, 30 ); + m_Clear3DCacheFilesOlder->SetToolTip( _("3D cache files older than this are deleted.\nIf set to 0, cache clearing is disabled") ); + + b3DCacheSizer->Add( m_Clear3DCacheFilesOlder, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5 ); + + m_staticTextDays = new wxStaticText( this, wxID_ANY, _("days"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextDays->Wrap( -1 ); + b3DCacheSizer->Add( m_staticTextDays, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + margins->Add( b3DCacheSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bResetStateSizer; + bResetStateSizer = new wxBoxSizer( wxVERTICAL ); + + m_clearFileHistory = new wxButton( this, wxID_ANY, _("Clear \"Open Recent\" History"), wxDefaultPosition, wxDefaultSize, 0 ); + bResetStateSizer->Add( m_clearFileHistory, 0, wxALL|wxEXPAND, 5 ); + + + bResetStateSizer->Add( 0, 10, 1, wxEXPAND, 5 ); + + m_clearDontShowAgain = new wxButton( this, wxID_ANY, _("Reset \"Don't Show Again\" Dialogs"), wxDefaultPosition, wxDefaultSize, 0 ); + bResetStateSizer->Add( m_clearDontShowAgain, 0, wxALL|wxEXPAND, 5 ); + + m_clearDialogState = new wxButton( this, wxID_ANY, _("Reset All Dialogs to Defaults"), wxDefaultPosition, wxDefaultSize, 0 ); + bResetStateSizer->Add( m_clearDialogState, 0, wxALL|wxEXPAND, 5 ); + + m_resetAll = new wxButton( this, wxID_ANY, _("Reset All Program Settings to Defaults"), wxDefaultPosition, wxDefaultSize, 0 ); + bResetStateSizer->Add( m_resetAll, 0, wxALL, 5 ); + + + margins->Add( bResetStateSizer, 1, wxEXPAND|wxTOP, 10 ); + + + bPanelSizer->Add( margins, 0, wxRIGHT|wxLEFT, 5 ); + + + this->SetSizer( bPanelSizer ); + this->Layout(); + bPanelSizer->Fit( this ); + + // Connect Events + m_clearFileHistory->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_MAINTENANCE_BASE::onClearFileHistory ), NULL, this ); + m_clearDontShowAgain->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_MAINTENANCE_BASE::onClearDontShowAgain ), NULL, this ); + m_clearDialogState->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_MAINTENANCE_BASE::onClearDialogState ), NULL, this ); + m_resetAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_MAINTENANCE_BASE::onResetAll ), NULL, this ); +} + +PANEL_MAINTENANCE_BASE::~PANEL_MAINTENANCE_BASE() +{ + // Disconnect Events + m_clearFileHistory->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_MAINTENANCE_BASE::onClearFileHistory ), NULL, this ); + m_clearDontShowAgain->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_MAINTENANCE_BASE::onClearDontShowAgain ), NULL, this ); + m_clearDialogState->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_MAINTENANCE_BASE::onClearDialogState ), NULL, this ); + m_resetAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_MAINTENANCE_BASE::onResetAll ), NULL, this ); + +} diff --git a/common/dialogs/panel_maintenance_base.fbp b/common/dialogs/panel_maintenance_base.fbp new file mode 100644 index 0000000000..16dd3f00fe --- /dev/null +++ b/common/dialogs/panel_maintenance_base.fbp @@ -0,0 +1,596 @@ + + + + + C++ + + 1 + connect + none + + + 0 + 1 + res + UTF-8 + panel_maintenance_base + 1000 + 1 + 1 + UI + PanelMaintenance + . + 0 + source_name + 1 + 0 + source_name + + + 1 + 1 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + 1 + 0 + 1 + impl_virtual + + + 0 + wxID_ANY + + + PANEL_MAINTENANCE_BASE + + -1,-1 + RESETTABLE_PANEL; widgets/resettable_panel.h; Not forward_declare + + 0 + + + wxTAB_TRAVERSAL + + + bPanelSizer + wxHORIZONTAL + none + + 5 + wxRIGHT|wxLEFT + 0 + + + margins + wxVERTICAL + none + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + + b3DCacheSizer + wxHORIZONTAL + none + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + 3D cache file duration: + 0 + + 0 + + + 0 + + 1 + m_staticTextClear3DCache + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + 30 + 120 + + 0 + + 0 + + 0 + + 1 + m_Clear3DCacheFilesOlder + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS + ; ; forward_declare + 0 + 3D cache files older than this are deleted. If set to 0, cache clearing is disabled + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + days + 0 + + 0 + + + 0 + + 1 + m_staticTextDays + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + 10 + wxEXPAND|wxTOP + 1 + + + bResetStateSizer + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Clear "Open Recent" History + + 0 + + 0 + + + 0 + + 1 + m_clearFileHistory + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + onClearFileHistory + + + + 5 + wxEXPAND + 1 + + 10 + protected + 0 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Reset "Don't Show Again" Dialogs + + 0 + + 0 + + + 0 + + 1 + m_clearDontShowAgain + 1 + + + private + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + onClearDontShowAgain + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Reset All Dialogs to Defaults + + 0 + + 0 + + + 0 + + 1 + m_clearDialogState + 1 + + + private + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + onClearDialogState + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Reset All Program Settings to Defaults + + 0 + + 0 + + + 0 + + 1 + m_resetAll + 1 + + + private + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + onResetAll + + + + + + + + + + diff --git a/common/dialogs/panel_maintenance_base.h b/common/dialogs/panel_maintenance_base.h new file mode 100644 index 0000000000..1fd0002ebb --- /dev/null +++ b/common/dialogs/panel_maintenance_base.h @@ -0,0 +1,60 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include +#include +#include "widgets/resettable_panel.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +/// Class PANEL_MAINTENANCE_BASE +/////////////////////////////////////////////////////////////////////////////// +class PANEL_MAINTENANCE_BASE : public RESETTABLE_PANEL +{ + private: + wxButton* m_clearDontShowAgain; + wxButton* m_clearDialogState; + wxButton* m_resetAll; + + protected: + wxStaticText* m_staticTextClear3DCache; + wxSpinCtrl* m_Clear3DCacheFilesOlder; + wxStaticText* m_staticTextDays; + wxButton* m_clearFileHistory; + + // Virtual event handlers, override them in your derived class + virtual void onClearFileHistory( wxCommandEvent& event ) { event.Skip(); } + virtual void onClearDontShowAgain( wxCommandEvent& event ) { event.Skip(); } + virtual void onClearDialogState( wxCommandEvent& event ) { event.Skip(); } + virtual void onResetAll( wxCommandEvent& event ) { event.Skip(); } + + + public: + + PANEL_MAINTENANCE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + + ~PANEL_MAINTENANCE_BASE(); + +}; + diff --git a/common/dialogs/panel_plugin_settings_base.cpp b/common/dialogs/panel_plugin_settings_base.cpp index e1991ca3ce..1b0950b2b7 100644 --- a/common/dialogs/panel_plugin_settings_base.cpp +++ b/common/dialogs/panel_plugin_settings_base.cpp @@ -12,17 +12,14 @@ PANEL_PLUGIN_SETTINGS_BASE::PANEL_PLUGIN_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : RESETTABLE_PANEL( parent, id, pos, size, style, name ) { wxBoxSizer* bPanelSizer; - bPanelSizer = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bSizer8; - bSizer8 = new wxBoxSizer( wxVERTICAL ); + bPanelSizer = new wxBoxSizer( wxVERTICAL ); apiLabel = new wxStaticText( this, wxID_ANY, _("KiCad API"), wxDefaultPosition, wxDefaultSize, 0 ); apiLabel->Wrap( -1 ); - bSizer8->Add( apiLabel, 0, wxTOP|wxRIGHT|wxLEFT, 13 ); + bPanelSizer->Add( apiLabel, 0, wxTOP|wxRIGHT|wxLEFT, 13 ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer8->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + bPanelSizer->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxBOTTOM, 2 ); wxBoxSizer* apiBox; apiBox = new wxBoxSizer( wxVERTICAL ); @@ -37,14 +34,17 @@ PANEL_PLUGIN_SETTINGS_BASE::PANEL_PLUGIN_SETTINGS_BASE( wxWindow* parent, wxWind apiBox->Add( m_cbEnableApi, 0, wxALL, 5 ); - bSizer8->Add( apiBox, 1, wxEXPAND|wxALL, 5 ); + bPanelSizer->Add( apiBox, 0, wxEXPAND|wxALL, 5 ); + + + bPanelSizer->Add( 0, 15, 0, wxEXPAND, 5 ); pythonLabel = new wxStaticText( this, wxID_ANY, _("Python Interpreter"), wxDefaultPosition, wxDefaultSize, 0 ); pythonLabel->Wrap( -1 ); - bSizer8->Add( pythonLabel, 0, wxTOP|wxRIGHT|wxLEFT, 13 ); + bPanelSizer->Add( pythonLabel, 0, wxTOP|wxRIGHT|wxLEFT, 13 ); m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer8->Add( m_staticline2, 0, wxEXPAND|wxTOP|wxBOTTOM, 2 ); + bPanelSizer->Add( m_staticline2, 0, wxEXPAND|wxTOP|wxBOTTOM, 2 ); wxBoxSizer* pythonBox; pythonBox = new wxBoxSizer( wxVERTICAL ); @@ -76,13 +76,7 @@ PANEL_PLUGIN_SETTINGS_BASE::PANEL_PLUGIN_SETTINGS_BASE( wxWindow* parent, wxWind pythonBox->Add( m_stApiStatus, 0, wxALL, 5 ); - bSizer8->Add( pythonBox, 1, wxEXPAND|wxALL, 5 ); - - - bSizer8->Add( 0, 0, 1, wxEXPAND, 5 ); - - - bPanelSizer->Add( bSizer8, 1, wxEXPAND, 5 ); + bPanelSizer->Add( pythonBox, 1, wxEXPAND|wxALL, 5 ); this->SetSizer( bPanelSizer ); diff --git a/common/dialogs/panel_plugin_settings_base.fbp b/common/dialogs/panel_plugin_settings_base.fbp index 1ad7066fd7..cbceed1fc1 100644 --- a/common/dialogs/panel_plugin_settings_base.fbp +++ b/common/dialogs/panel_plugin_settings_base.fbp @@ -58,20 +58,141 @@ bPanelSizer - wxHORIZONTAL + wxVERTICAL none + + 13 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + KiCad API + 0 + + 0 + + + 0 + + 1 + apiLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 2 + wxEXPAND|wxTOP|wxBOTTOM + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + + + 5 - wxEXPAND - 1 + wxEXPAND|wxALL + 0 - bSizer8 + apiBox wxVERTICAL none - 13 - wxTOP|wxRIGHT|wxLEFT + 5 + wxALL 0 1 @@ -102,7 +223,7 @@ 0 0 wxID_ANY - KiCad API + When the KiCad API is enabled, plugins and other software running on this computer can connect to KiCad. 0 0 @@ -111,7 +232,7 @@ 0 1 - apiLabel + m_staticText3 1 @@ -133,9 +254,9 @@ 5 - wxEXPAND | wxALL + wxALL 0 - + 1 1 1 @@ -149,6 +270,7 @@ 1 0 + 0 1 1 @@ -164,6 +286,7 @@ 0 0 wxID_ANY + Enable KiCad API 0 @@ -171,7 +294,7 @@ 0 1 - m_staticline1 + m_cbEnableApi 1 @@ -181,27 +304,174 @@ Resizable 1 - wxLI_HORIZONTAL + ; ; forward_declare 0 - + Enable the KiCad API. Doing so will allow third-party software running on your computer to access KiCad. + + wxFILTER_NONE + wxDefaultValidator + + OnEnableApiChecked + + + + 5 + wxEXPAND + 0 + + 15 + protected + 0 + + + + 13 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Python Interpreter + 0 + + 0 + + + 0 + + 1 + pythonLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 2 + wxEXPAND|wxTOP|wxBOTTOM + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline2 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + + + + + 5 + wxEXPAND|wxALL + 1 + + + pythonBox + wxVERTICAL + none 5 - wxEXPAND|wxALL - 1 + wxEXPAND + 0 - apiBox - wxVERTICAL + bSizer4 + wxHORIZONTAL none 5 - wxALL + wxALIGN_CENTER_VERTICAL|wxALL 0 1 @@ -232,7 +502,7 @@ 0 0 wxID_ANY - When the KiCad API is enabled, plugins and other software running on this computer can connect to KiCad. + Path to Python interpreter: 0 0 @@ -241,7 +511,7 @@ 0 1 - m_staticText3 + m_staticText2 1 @@ -263,9 +533,9 @@ 5 - wxALL - 0 - + wxALIGN_CENTER_VERTICAL|wxALL + 1 + 1 1 1 @@ -279,7 +549,6 @@ 1 0 - 0 1 1 @@ -295,15 +564,15 @@ 0 0 wxID_ANY - Enable KiCad API 0 + Select the path to a Python interpreter 0 1 - m_cbEnableApi + m_pickerPythonInterpreter 1 @@ -313,10 +582,87 @@ Resizable 1 + wxFLP_DEFAULT_STYLE|wxFLP_USE_TEXTCTRL + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + *.* + + + + OnPythonInterpreterChanged + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Detect Automatically + + 0 + + 0 + + + 0 + + 1 + m_btnDetectAutomatically + 1 + + + protected + 1 + + + + Resizable + 1 + ; ; forward_declare 0 - Enable the KiCad API. Doing so will allow third-party software running on your computer to access KiCad. + wxFILTER_NONE wxDefaultValidator @@ -324,14 +670,14 @@ - OnEnableApiChecked + OnBtnDetectAutomaticallyClicked - 13 - wxTOP|wxRIGHT|wxLEFT + 5 + wxALL 0 1 @@ -362,7 +708,7 @@ 0 0 wxID_ANY - Python Interpreter + No Python interpreter chosen; external Python plugins will not be available 0 0 @@ -371,11 +717,11 @@ 0 1 - pythonLabel + m_stPythonStatus 1 - protected + public 1 Resizable @@ -384,7 +730,7 @@ ; ; forward_declare 0 - + Python interpreter status @@ -392,10 +738,10 @@ - 2 - wxEXPAND|wxTOP|wxBOTTOM + 5 + wxALL 0 - + 1 1 1 @@ -424,6 +770,8 @@ 0 0 wxID_ANY + + 0 0 @@ -431,7 +779,7 @@ 0 1 - m_staticline2 + m_stApiStatus 1 @@ -441,373 +789,14 @@ Resizable 1 - wxLI_HORIZONTAL + ; ; forward_declare 0 - - - - 5 - wxEXPAND|wxALL - 1 - - - pythonBox - wxVERTICAL - none - - 5 - wxEXPAND - 0 - - - bSizer4 - wxHORIZONTAL - none - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - 0 - - 0 - 0 - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - Path to Python interpreter: - 0 - - 0 - - - 0 - - 1 - m_staticText2 - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 1 - - 1 - 1 - 1 - 1 - 0 - - 0 - 0 - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - Select the path to a Python interpreter - - 0 - - 1 - m_pickerPythonInterpreter - 1 - - - protected - 1 - - Resizable - 1 - - wxFLP_DEFAULT_STYLE|wxFLP_USE_TEXTCTRL - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - *.* - - - - OnPythonInterpreterChanged - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - 0 - - 0 - 0 - 0 - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 0 - 1 - - 1 - - - 0 - 0 - wxID_ANY - Detect Automatically - - 0 - - 0 - - - 0 - - 1 - m_btnDetectAutomatically - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnBtnDetectAutomaticallyClicked - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - 0 - - 0 - 0 - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - No Python interpreter chosen; external Python plugins will not be available - 0 - - 0 - - - 0 - - 1 - m_stPythonStatus - 1 - - - public - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - Python interpreter status - - - - -1 - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - 0 - - 0 - 0 - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - - 0 - - 1 - m_stApiStatus - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 + -1 diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp index 6c5672fa5a..1a4a2a2a0d 100644 --- a/common/eda_base_frame.cpp +++ b/common/eda_base_frame.cpp @@ -24,6 +24,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "dialogs/panel_maintenance.h" #include "kicad_manager_frame.h" #include @@ -1161,14 +1162,11 @@ wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type, } -void EDA_BASE_FRAME::ClearFileHistory( FILE_HISTORY* aFileHistory ) +void EDA_BASE_FRAME::ClearFileHistory() { - if( !aFileHistory ) - aFileHistory = m_fileHistory; + wxASSERT( m_fileHistory ); - wxASSERT( aFileHistory ); - - aFileHistory->ClearFileHistory(); + m_fileHistory->ClearFileHistory(); // Update the menubar to update the file history menu if( GetMenuBar() ) @@ -1195,7 +1193,7 @@ void EDA_BASE_FRAME::OnPreferences( wxCommandEvent& event ) void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParentPage ) { PAGED_DIALOG dlg( this, _( "Preferences" ), true, true, wxEmptyString, - wxWindow::FromDIP( wxSize( 980, 560 ), NULL ) ); + wxWindow::FromDIP( wxSize( 980, 560 ), nullptr ) ); dlg.SetEvtHandlerEnabled( false ); @@ -1204,7 +1202,6 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent WX_TREEBOOK* book = dlg.GetTreebook(); PANEL_HOTKEYS_EDITOR* hotkeysPanel = new PANEL_HOTKEYS_EDITOR( this, book, false ); - KIFACE* kiface = nullptr; std::vector expand; wxWindow* kicadMgr_window = wxWindow::FindWindowByName( KICAD_MANAGER_FRAME_NAME ); @@ -1262,40 +1259,37 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent try { - kiface = Kiway().KiFACE( KIWAY::FACE_SCH ); + if( KIFACE* kiface = Kiway().KiFACE( KIWAY::FACE_SCH ) ) + { + kiface->GetActions( hotkeysPanel->ActionsList() ); - if( !kiface ) - return; + if( GetFrameType() == FRAME_SCH_SYMBOL_EDITOR ) + expand.push_back( (int) book->GetPageCount() ); - kiface->GetActions( hotkeysPanel->ActionsList() ); + book->AddPage( new wxPanel( book ), _( "Symbol Editor" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_DISP_OPTIONS ), _( "Display Options" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_EDIT_GRIDS ), _( "Grids" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_EDIT_OPTIONS ), _( "Editing Options" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_COLORS ), _( "Colors" ) ); - if( GetFrameType() == FRAME_SCH_SYMBOL_EDITOR ) - expand.push_back( (int) book->GetPageCount() ); + if( ADVANCED_CFG::GetCfg().m_ConfigurableToolbars ) + book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_TOOLBARS ), _( "Toolbars" ) ); - book->AddPage( new wxPanel( book ), _( "Symbol Editor" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_DISP_OPTIONS ), _( "Display Options" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_EDIT_GRIDS ), _( "Grids" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_EDIT_OPTIONS ), _( "Editing Options" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_COLORS ), _( "Colors" ) ); + if( GetFrameType() == FRAME_SCH ) + expand.push_back( (int) book->GetPageCount() ); - if( ADVANCED_CFG::GetCfg().m_ConfigurableToolbars ) - book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_TOOLBARS ), _( "Toolbars" ) ); + book->AddPage( new wxPanel( book ), _( "Schematic Editor" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_DISP_OPTIONS ), _( "Display Options" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_GRIDS ), _( "Grids" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_EDIT_OPTIONS ), _( "Editing Options" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_COLORS ), _( "Colors" ) ); - if( GetFrameType() == FRAME_SCH ) - expand.push_back( (int) book->GetPageCount() ); + if( ADVANCED_CFG::GetCfg().m_ConfigurableToolbars ) + book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_TOOLBARS ), _( "Toolbars" ) ); - book->AddPage( new wxPanel( book ), _( "Schematic Editor" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_DISP_OPTIONS ), _( "Display Options" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_GRIDS ), _( "Grids" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_EDIT_OPTIONS ), _( "Editing Options" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_COLORS ), _( "Colors" ) ); - - if( ADVANCED_CFG::GetCfg().m_ConfigurableToolbars ) - book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_TOOLBARS ), _( "Toolbars" ) ); - - book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_FIELD_NAME_TEMPLATES ), - _( "Field Name Templates" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_SIMULATOR ), _( "Simulator" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_FIELD_NAME_TEMPLATES ), _( "Field Name Templates" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_SIMULATOR ), _( "Simulator" ) ); + } } catch( ... ) { @@ -1303,56 +1297,53 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent try { - kiface = Kiway().KiFACE( KIWAY::FACE_PCB ); + if( KIFACE* kiface = Kiway().KiFACE( KIWAY::FACE_PCB ) ) + { + kiface->GetActions( hotkeysPanel->ActionsList() ); - if( !kiface ) - return; + if( GetFrameType() == FRAME_FOOTPRINT_EDITOR ) + expand.push_back( (int) book->GetPageCount() ); - kiface->GetActions( hotkeysPanel->ActionsList() ); + book->AddPage( new wxPanel( book ), _( "Footprint Editor" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DISPLAY_OPTIONS ), _( "Display Options" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_FP_GRIDS ), _( "Grids" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_FP_ORIGINS_AXES ), _( "Origins & Axes" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_FP_EDIT_OPTIONS ), _( "Editing Options" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_FP_COLORS ), _( "Colors" ) ); - if( GetFrameType() == FRAME_FOOTPRINT_EDITOR ) - expand.push_back( (int) book->GetPageCount() ); + if( ADVANCED_CFG::GetCfg().m_ConfigurableToolbars ) + book->AddLazySubPage( LAZY_CTOR( PANEL_FP_TOOLBARS ), _( "Toolbars" ) ); - book->AddPage( new wxPanel( book ), _( "Footprint Editor" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DISPLAY_OPTIONS ), _( "Display Options" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_FP_GRIDS ), _( "Grids" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_FP_ORIGINS_AXES ), _( "Origins & Axes" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_FP_EDIT_OPTIONS ), _( "Editing Options" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_FP_COLORS ), _( "Colors" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DEFAULT_FIELDS ), _( "Footprint Defaults" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DEFAULT_GRAPHICS_VALUES ), _( "Graphics Defaults" ) ); - if( ADVANCED_CFG::GetCfg().m_ConfigurableToolbars ) - book->AddLazySubPage( LAZY_CTOR( PANEL_FP_TOOLBARS ), _( "Toolbars" ) ); + if( GetFrameType() == FRAME_PCB_EDITOR ) + expand.push_back( (int) book->GetPageCount() ); - book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DEFAULT_FIELDS ), _( "Footprint Defaults" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DEFAULT_GRAPHICS_VALUES ), - _( "Graphics Defaults" ) ); + book->AddPage( new wxPanel( book ), _( "PCB Editor" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_DISPLAY_OPTS ), _( "Display Options" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_GRIDS ), _( "Grids" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_ORIGINS_AXES ), _( "Origins & Axes" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_EDIT_OPTIONS ), _( "Editing Options" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_COLORS ), _( "Colors" ) ); - if( GetFrameType() == FRAME_PCB_EDITOR ) - expand.push_back( (int) book->GetPageCount() ); + if( ADVANCED_CFG::GetCfg().m_ConfigurableToolbars ) + book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_TOOLBARS ), _( "Toolbars" ) ); - book->AddPage( new wxPanel( book ), _( "PCB Editor" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_DISPLAY_OPTS ), _( "Display Options" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_GRIDS ), _( "Grids" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_ORIGINS_AXES ), _( "Origins & Axes" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_EDIT_OPTIONS ), _( "Editing Options" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_COLORS ), _( "Colors" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_ACTION_PLUGINS ), _( "Plugins" ) ); - if( ADVANCED_CFG::GetCfg().m_ConfigurableToolbars ) - book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_TOOLBARS ), _( "Toolbars" ) ); + if( GetFrameType() == FRAME_PCB_DISPLAY3D ) + expand.push_back( (int) book->GetPageCount() ); - book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_ACTION_PLUGINS ), _( "Plugins" ) ); + book->AddPage( new wxPanel( book ), _( "3D Viewer" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_DISPLAY_OPTIONS ), _( "General" ) ); - if( GetFrameType() == FRAME_PCB_DISPLAY3D ) - expand.push_back( (int) book->GetPageCount() ); + if( ADVANCED_CFG::GetCfg().m_ConfigurableToolbars ) + book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_TOOLBARS ), _( "Toolbars" ) ); - book->AddPage( new wxPanel( book ), _( "3D Viewer" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_DISPLAY_OPTIONS ), _( "General" ) ); - - if( ADVANCED_CFG::GetCfg().m_ConfigurableToolbars ) - book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_TOOLBARS ), _( "Toolbars" ) ); - - book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_OPENGL ), _( "Realtime Renderer" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_RAYTRACING ), _( "Raytracing Renderer" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_OPENGL ), _( "Realtime Renderer" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_RAYTRACING ), _( "Raytracing Renderer" ) ); + } } catch( ... ) { @@ -1360,26 +1351,23 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent try { - kiface = Kiway().KiFACE( KIWAY::FACE_GERBVIEW ); + if( KIFACE* kiface = Kiway().KiFACE( KIWAY::FACE_GERBVIEW ) ) + { + kiface->GetActions( hotkeysPanel->ActionsList() ); - if( !kiface ) - return; + if( GetFrameType() == FRAME_GERBER ) + expand.push_back( (int) book->GetPageCount() ); - kiface->GetActions( hotkeysPanel->ActionsList() ); + book->AddPage( new wxPanel( book ), _( "Gerber Viewer" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_DISPLAY_OPTIONS ), _( "Display Options" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_COLORS ), _( "Colors" ) ); - if( GetFrameType() == FRAME_GERBER ) - expand.push_back( (int) book->GetPageCount() ); + if( ADVANCED_CFG::GetCfg().m_ConfigurableToolbars ) + book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_TOOLBARS ), _( "Toolbars" ) ); - book->AddPage( new wxPanel( book ), _( "Gerber Viewer" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_DISPLAY_OPTIONS ), _( "Display Options" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_COLORS ), _( "Colors" ) ); - - if( ADVANCED_CFG::GetCfg().m_ConfigurableToolbars ) - book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_TOOLBARS ), _( "Toolbars" ) ); - - book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_GRIDS ), _( "Grids" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_EXCELLON_OPTIONS ), - _( "Excellon Options" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_GRIDS ), _( "Grids" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_EXCELLON_OPTIONS ), _( "Excellon Options" ) ); + } } catch( ... ) { @@ -1387,29 +1375,27 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent try { - kiface = Kiway().KiFACE( KIWAY::FACE_PL_EDITOR ); + if( KIFACE* kiface = Kiway().KiFACE( KIWAY::FACE_PL_EDITOR ) ) + { + kiface->GetActions( hotkeysPanel->ActionsList() ); - if( !kiface ) - return; + if( GetFrameType() == FRAME_PL_EDITOR ) + expand.push_back( (int) book->GetPageCount() ); - kiface->GetActions( hotkeysPanel->ActionsList() ); + book->AddPage( new wxPanel( book ), _( "Drawing Sheet Editor" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_DS_DISPLAY_OPTIONS ), _( "Display Options" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_DS_GRIDS ), _( "Grids" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_DS_COLORS ), _( "Colors" ) ); - if( GetFrameType() == FRAME_PL_EDITOR ) - expand.push_back( (int) book->GetPageCount() ); + if( ADVANCED_CFG::GetCfg().m_ConfigurableToolbars ) + book->AddLazySubPage( LAZY_CTOR( PANEL_DS_TOOLBARS ), _( "Toolbars" ) ); - book->AddPage( new wxPanel( book ), _( "Drawing Sheet Editor" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_DS_DISPLAY_OPTIONS ), _( "Display Options" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_DS_GRIDS ), _( "Grids" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_DS_COLORS ), _( "Colors" ) ); - - if( ADVANCED_CFG::GetCfg().m_ConfigurableToolbars ) - book->AddLazySubPage( LAZY_CTOR( PANEL_DS_TOOLBARS ), _( "Toolbars" ) ); - - book->AddLazyPage( - []( wxWindow* aParent ) -> wxWindow* - { - return new PANEL_PACKAGES_AND_UPDATES( aParent ); - }, _( "Packages and Updates" ) ); + book->AddLazyPage( + []( wxWindow* aParent ) -> wxWindow* + { + return new PANEL_PACKAGES_AND_UPDATES( aParent ); + }, _( "Packages and Updates" ) ); + } } catch( ... ) { @@ -1419,6 +1405,8 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent book->AddPage( new PANEL_PLUGIN_SETTINGS( book ), _( "Plugins" ) ); #endif + book->AddPage( new PANEL_MAINTENANCE( book, this ), _( "Maintenance" ) ); + // Update all of the action hotkeys. The process of loading the actions through // the KiFACE will only get us the default hotkeys ReadHotKeyConfigIntoActions( wxEmptyString, hotkeysPanel->ActionsList() ); diff --git a/common/kidialog.cpp b/common/kidialog.cpp index 29133b44c9..650a07c919 100644 --- a/common/kidialog.cpp +++ b/common/kidialog.cpp @@ -27,27 +27,31 @@ // Set of dialogs that have been chosen not to be shown again -static std::unordered_map doNotShowAgainDlgs; +static std::unordered_map g_doNotShowAgainDlgs; -KIDIALOG::KIDIALOG( wxWindow* aParent, const wxString& aMessage, const wxString& aCaption, - long aStyle ) - : KIDIALOG_BASE( aParent, aMessage, aCaption, aStyle | wxCENTRE | wxSTAY_ON_TOP ), - m_hash( 0 ), - m_cancelMeansCancel( true ) +KIDIALOG::KIDIALOG( wxWindow* aParent, const wxString& aMessage, const wxString& aCaption, long aStyle ) : + KIDIALOG_BASE( aParent, aMessage, aCaption, aStyle | wxCENTRE | wxSTAY_ON_TOP ), + m_hash( 0 ), + m_cancelMeansCancel( true ) { } -KIDIALOG::KIDIALOG( wxWindow* aParent, const wxString& aMessage, KD_TYPE aType, - const wxString& aCaption ) - : KIDIALOG_BASE( aParent, aMessage, getCaption( aType, aCaption ), getStyle( aType ) ), - m_hash( 0 ), - m_cancelMeansCancel( true ) +KIDIALOG::KIDIALOG( wxWindow* aParent, const wxString& aMessage, KD_TYPE aType, const wxString& aCaption ) : + KIDIALOG_BASE( aParent, aMessage, getCaption( aType, aCaption ), getStyle( aType ) ), + m_hash( 0 ), + m_cancelMeansCancel( true ) { } +void KIDIALOG::ClearDoNotShowAgainDialogs() +{ + g_doNotShowAgainDlgs = {}; +} + + void KIDIALOG::DoNotShowCheckbox( wxString aUniqueId, int line ) { ShowCheckBox( _( "Do not show again" ), false ); @@ -58,13 +62,7 @@ void KIDIALOG::DoNotShowCheckbox( wxString aUniqueId, int line ) bool KIDIALOG::DoNotShowAgain() const { - return doNotShowAgainDlgs.count( m_hash ) > 0; -} - - -void KIDIALOG::ForceShowAgain() -{ - doNotShowAgainDlgs.erase( m_hash ); + return g_doNotShowAgainDlgs.count( m_hash ) > 0; } @@ -74,9 +72,9 @@ bool KIDIALOG::Show( bool aShow ) if( aShow ) { // Check if this dialog should be shown to the user - auto it = doNotShowAgainDlgs.find( m_hash ); + auto it = g_doNotShowAgainDlgs.find( m_hash ); - if( it != doNotShowAgainDlgs.end() ) + if( it != g_doNotShowAgainDlgs.end() ) return it->second; } @@ -86,7 +84,7 @@ bool KIDIALOG::Show( bool aShow ) // Note that we don't save a Cancel value unless the Cancel button is being used for some // other function (which is actually more common than it being used for Cancel). if( IsCheckBoxChecked() && (!m_cancelMeansCancel || ret != wxID_CANCEL ) ) - doNotShowAgainDlgs[m_hash] = ret; + g_doNotShowAgainDlgs[m_hash] = ret; return ret; } @@ -95,9 +93,9 @@ bool KIDIALOG::Show( bool aShow ) int KIDIALOG::ShowModal() { // Check if this dialog should be shown to the user - auto it = doNotShowAgainDlgs.find( m_hash ); + auto it = g_doNotShowAgainDlgs.find( m_hash ); - if( it != doNotShowAgainDlgs.end() ) + if( it != g_doNotShowAgainDlgs.end() ) return it->second; int ret = KIDIALOG_BASE::ShowModal(); @@ -106,7 +104,7 @@ int KIDIALOG::ShowModal() // Note that we don't save a Cancel value unless the Cancel button is being used for some // other function (which is actually more common than it being used for Cancel). if( IsCheckBoxChecked() && (!m_cancelMeansCancel || ret != wxID_CANCEL ) ) - doNotShowAgainDlgs[m_hash] = ret; + g_doNotShowAgainDlgs[m_hash] = ret; return ret; } diff --git a/common/kiway.cpp b/common/kiway.cpp index 60384f0480..bb3aeca55b 100644 --- a/common/kiway.cpp +++ b/common/kiway.cpp @@ -609,6 +609,29 @@ void KIWAY::CommonSettingsChanged( int aFlags ) } +void KIWAY::ClearFileHistory() +{ + if( m_ctl & KFCTL_CPP_PROJECT_SUITE ) + { + // A dynamic_cast could be better, but creates link issues + // (some basic_frame functions not found) on some platforms, + // so a static_cast is used. + EDA_BASE_FRAME* top = static_cast( m_top ); + + if( top ) + top->ClearFileHistory(); + } + + for( unsigned i=0; i < KIWAY_PLAYER_COUNT; ++i ) + { + KIWAY_PLAYER* frame = GetPlayerFrame( ( FRAME_T )i ); + + if( frame ) + frame->ClearFileHistory(); + } +} + + void KIWAY::ProjectChanged() { APP_MONITOR::AddNavigationBreadcrumb( "Changing project", "kiway.projectchanged" ); diff --git a/common/settings/app_settings.cpp b/common/settings/app_settings.cpp index 21486c6810..ba4cd07718 100644 --- a/common/settings/app_settings.cpp +++ b/common/settings/app_settings.cpp @@ -199,6 +199,7 @@ APP_SETTINGS_BASE::APP_SETTINGS_BASE( const std::string& aFilename, int aSchemaV m_params.emplace_back( new PARAM( "system.max_undo_items", &m_System.max_undo_items, 0 ) ); + // WARNING: "system.file_history" is a "known" key (see JSON_SETTINGS::GetFileHistories()) m_params.emplace_back( new PARAM_LIST( "system.file_history", &m_System.file_history, {} ) ); diff --git a/common/settings/common_settings.cpp b/common/settings/common_settings.cpp index b8ca66d176..e9bafa9be0 100644 --- a/common/settings/common_settings.cpp +++ b/common/settings/common_settings.cpp @@ -383,10 +383,10 @@ COMMON_SETTINGS::COMMON_SETTINGS() : &m_NetclassPanel.sash_pos, 160 ) ); m_params.emplace_back( new PARAM( "netclass_panel.eeschema_shown_columns", - &m_NetclassPanel.eeschema_visible_columns, "0 11 12 13 14" ) ); + &m_NetclassPanel.eeschema_visible_columns, "0 11 12 13 14" ) ); m_params.emplace_back( new PARAM( "netclass_panel.pcbnew_shown_columns", - &m_NetclassPanel.pcbnew_visible_columns, "0 1 2 3 4 5 6 7 8 9 10" ) ); + &m_NetclassPanel.pcbnew_visible_columns, "0 1 2 3 4 5 6 7 8 9 10" ) ); m_params.emplace_back( new PARAM( "package_manager.sash_pos", &m_PackageManager.sash_pos, 380 ) ); @@ -519,21 +519,15 @@ bool COMMON_SETTINGS::migrateSchema0to1() if( mwp ) { ( *m_internals )[nlohmann::json::json_pointer( "/input/horizontal_pan" )] = true; - - ( *m_internals )[nlohmann::json::json_pointer( "/input/scroll_modifier_pan_h" )] = - WXK_SHIFT; + ( *m_internals )[nlohmann::json::json_pointer( "/input/scroll_modifier_pan_h" )] = WXK_SHIFT; ( *m_internals )[nlohmann::json::json_pointer( "/input/scroll_modifier_pan_v" )] = 0; - ( *m_internals )[nlohmann::json::json_pointer( "/input/scroll_modifier_zoom" )] = - WXK_CONTROL; + ( *m_internals )[nlohmann::json::json_pointer( "/input/scroll_modifier_zoom" )] = WXK_CONTROL; } else { ( *m_internals )[nlohmann::json::json_pointer( "/input/horizontal_pan" )] = false; - - ( *m_internals )[nlohmann::json::json_pointer( "/input/scroll_modifier_pan_h" )] = - WXK_CONTROL; - ( *m_internals )[nlohmann::json::json_pointer( "/input/scroll_modifier_pan_v" )] = - WXK_SHIFT; + ( *m_internals )[nlohmann::json::json_pointer( "/input/scroll_modifier_pan_h" )] = WXK_CONTROL; + ( *m_internals )[nlohmann::json::json_pointer( "/input/scroll_modifier_pan_v" )] = WXK_SHIFT; ( *m_internals )[nlohmann::json::json_pointer( "/input/scroll_modifier_zoom" )] = 0; } @@ -560,11 +554,9 @@ bool COMMON_SETTINGS::migrateSchema1to2() } if( prefer_selection ) - ( *m_internals )[nlohmann::json::json_pointer( "/input/mouse_left" )] = - MOUSE_DRAG_ACTION::SELECT; + ( *m_internals )[nlohmann::json::json_pointer( "/input/mouse_left" )] = MOUSE_DRAG_ACTION::SELECT; else - ( *m_internals )[nlohmann::json::json_pointer( "/input/mouse_left" )] = - MOUSE_DRAG_ACTION::DRAG_ANY; + ( *m_internals )[nlohmann::json::json_pointer( "/input/mouse_left" )] = MOUSE_DRAG_ACTION::DRAG_ANY; return true; } @@ -691,8 +683,7 @@ bool COMMON_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) { wxString key, value; long index = 0; - nlohmann::json::json_pointer ptr = - m_internals->PointerFromString( "environment.vars" ); + nlohmann::json::json_pointer ptr = m_internals->PointerFromString( "environment.vars" ); aCfg->SetPath( "EnvironmentVariables" ); ( *m_internals )[ptr] = nlohmann::json( {} ); diff --git a/common/settings/json_settings.cpp b/common/settings/json_settings.cpp index cd539430e5..17ab39d6d9 100644 --- a/common/settings/json_settings.cpp +++ b/common/settings/json_settings.cpp @@ -397,6 +397,20 @@ void JSON_SETTINGS::ResetToDefaults() } +std::map JSON_SETTINGS::GetFileHistories() +{ + std::map histories; + + for( const std::string& candidate : { "system.file_history" } ) + { + if( Contains( candidate ) ) + histories[candidate] = GetJson( candidate ).value(); + } + + return histories; +} + + bool JSON_SETTINGS::SaveToFile( const wxString& aDirectory, bool aForce ) { if( !m_writeFile ) @@ -480,8 +494,7 @@ bool JSON_SETTINGS::SaveToFile( const wxString& aDirectory, bool aForce ) { if( param->ClearUnknownKeys() ) { - nlohmann::json_pointer p - = JSON_SETTINGS_INTERNALS::PointerFromString( param->GetJsonPath() ); + nlohmann::json_pointer p = JSON_SETTINGS_INTERNALS::PointerFromString( param->GetJsonPath() ); toSave[p] = nlohmann::json( {} ); } diff --git a/common/settings/settings_manager.cpp b/common/settings/settings_manager.cpp index 12b2207736..9e67f50656 100644 --- a/common/settings/settings_manager.cpp +++ b/common/settings/settings_manager.cpp @@ -102,6 +102,41 @@ SETTINGS_MANAGER::~SETTINGS_MANAGER() } +void SETTINGS_MANAGER::ResetToDefaults() +{ + for( std::unique_ptr& settings : m_settings ) + { + if( settings->GetLocation() == SETTINGS_LOC::USER || settings->GetLocation() == SETTINGS_LOC::COLORS ) + { + std::map fileHistories = settings->GetFileHistories(); + + settings->Internals()->clear(); + settings->Load(); // load from nothing (ie: load defaults) + + for( const auto& [path, history] : fileHistories ) + settings->Set( path, history ); + + settings->SaveToFile( GetPathForSettingsFile( settings.get() ) ); + } + } +} + + +void SETTINGS_MANAGER::ClearFileHistory() +{ + for( std::unique_ptr& settings : m_settings ) + { + if( settings->GetLocation() == SETTINGS_LOC::USER ) + { + for( const auto& [path, history] : settings->GetFileHistories() ) + settings->Set( path, nlohmann::json::array() ); + + settings->SaveToFile( GetPathForSettingsFile( settings.get() ) ); + } + } +} + + JSON_SETTINGS* SETTINGS_MANAGER::registerSettings( JSON_SETTINGS* aSettings, bool aLoadNow ) { std::unique_ptr ptr( aSettings ); @@ -692,20 +727,21 @@ bool SETTINGS_MANAGER::GetPreviousVersionPaths( std::vector* aPaths ) wxString subdir; std::string mine = GetSettingsVersion(); - auto check_dir = [&] ( const wxString& aSubDir ) - { - // Only older versions are valid for migration - if( compareVersions( aSubDir.ToStdString(), mine ) <= 0 ) - { - wxString sub_path = dir.GetNameWithSep() + aSubDir; - - if( IsSettingsPathValid( sub_path ) ) + auto check_dir = + [&] ( const wxString& aSubDir ) { - aPaths->push_back( sub_path ); - wxLogTrace( traceSettings, wxT( "GetPreviousVersionName: %s is valid" ), sub_path ); - } - } - }; + // Only older versions are valid for migration + if( compareVersions( aSubDir.ToStdString(), mine ) <= 0 ) + { + wxString sub_path = dir.GetNameWithSep() + aSubDir; + + if( IsSettingsPathValid( sub_path ) ) + { + aPaths->push_back( sub_path ); + wxLogTrace( traceSettings, wxT( "GetPreviousVersionName: %s is valid" ), sub_path ); + } + } + }; std::set checkedPaths; @@ -747,21 +783,22 @@ bool SETTINGS_MANAGER::GetPreviousVersionPaths( std::vector* aPaths ) } } - std::erase_if( *aPaths, []( const wxString& aPath ) -> bool - { - wxFileName fulldir = wxFileName::DirName( aPath ); - const wxArrayString& dirs = fulldir.GetDirs(); + std::erase_if( *aPaths, + []( const wxString& aPath ) -> bool + { + wxFileName fulldir = wxFileName::DirName( aPath ); + const wxArrayString& dirs = fulldir.GetDirs(); - if( dirs.empty() || !fulldir.IsDirReadable() ) - return true; + if( dirs.empty() || !fulldir.IsDirReadable() ) + return true; - std::string ver = dirs.back().ToStdString(); + std::string ver = dirs.back().ToStdString(); - if( !extractVersion( ver ) ) - return true; + if( !extractVersion( ver ) ) + return true; - return false; - } ); + return false; + } ); std::sort( aPaths->begin(), aPaths->end(), [&]( const wxString& a, const wxString& b ) -> bool @@ -1074,7 +1111,7 @@ bool SETTINGS_MANAGER::IsProjectOpen() const bool SETTINGS_MANAGER::IsProjectOpenNotDummy() const { return m_projects.size() > 1 || ( m_projects.size() == 1 - && !m_projects.begin()->second->GetProjectFullName().IsEmpty() ); + && !m_projects.begin()->second->GetProjectFullName().IsEmpty() ); } diff --git a/gerbview/files.cpp b/gerbview/files.cpp index 704c6ad626..a3ed41b553 100644 --- a/gerbview/files.cpp +++ b/gerbview/files.cpp @@ -79,7 +79,13 @@ void GERBVIEW_FRAME::OnDrlFileHistory( wxCommandEvent& event ) void GERBVIEW_FRAME::OnClearDrlFileHistory( wxCommandEvent& aEvent ) { - ClearFileHistory( &m_drillFileHistory ); + m_drillFileHistory.ClearFileHistory(); + + if( GetMenuBar() ) + { + ReCreateMenuBar(); + GetMenuBar()->Refresh(); + } } @@ -97,7 +103,13 @@ void GERBVIEW_FRAME::OnZipFileHistory( wxCommandEvent& event ) void GERBVIEW_FRAME::OnClearZipFileHistory( wxCommandEvent& aEvent ) { - ClearFileHistory( &m_zipFileHistory ); + m_zipFileHistory.ClearFileHistory(); + + if( GetMenuBar() ) + { + ReCreateMenuBar(); + GetMenuBar()->Refresh(); + } } @@ -112,7 +124,13 @@ void GERBVIEW_FRAME::OnJobFileHistory( wxCommandEvent& event ) void GERBVIEW_FRAME::OnClearJobFileHistory( wxCommandEvent& aEvent ) { - ClearFileHistory( &m_jobFileHistory ); + m_jobFileHistory.ClearFileHistory(); + + if( GetMenuBar() ) + { + ReCreateMenuBar(); + GetMenuBar()->Refresh(); + } } @@ -690,6 +708,17 @@ bool GERBVIEW_FRAME::LoadZipArchiveFile( const wxString& aFullFileName ) return true; } + +void GERBVIEW_FRAME::ClearFileHistory() +{ + m_drillFileHistory.ClearFileHistory(); + m_zipFileHistory.ClearFileHistory(); + m_jobFileHistory.ClearFileHistory(); + + EDA_DRAW_FRAME::ClearFileHistory(); +} + + void GERBVIEW_FRAME::DoWithAcceptedFiles() { wxString gerbFn; // param to be sent with action event. diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index 71e052eb5a..1288662293 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -303,6 +303,10 @@ public: */ bool LoadZipArchiveFile( const wxString& aFileName ); + /** + * Remove all files from the file history. + */ + void ClearFileHistory() override; /** * Load a Gerber job file, and load gerber files found in job files. diff --git a/gerbview/gerbview_settings.cpp b/gerbview/gerbview_settings.cpp index e722cf6eb0..cd35a46e13 100644 --- a/gerbview/gerbview_settings.cpp +++ b/gerbview/gerbview_settings.cpp @@ -59,12 +59,15 @@ GERBVIEW_SETTINGS::GERBVIEW_SETTINGS() : m_params.emplace_back( new PARAM( "appearance.mode_opacity_value", &m_Display.m_OpacityModeAlphaValue, 0.6 ) ); + // WARNING: any change to this key MUST be reflected in GetFileHistories() m_params.emplace_back( new PARAM_LIST( "system.drill_file_history", &m_DrillFileHistory, {} ) ); + // WARNING: any change to this key MUST be reflected in GetFileHistories() m_params.emplace_back( new PARAM_LIST( "system.zip_file_history", &m_ZipFileHistory, {} ) ); + // WARNING: any change to this key MUST be reflected in GetFileHistories() m_params.emplace_back( new PARAM_LIST( "system.job_file_history", &m_JobFileHistory, {} ) ); @@ -176,3 +179,20 @@ bool GERBVIEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) return ret; } + + +std::map GERBVIEW_SETTINGS::GetFileHistories() +{ + std::map histories = JSON_SETTINGS::GetFileHistories(); + + for( const std::string& candidate : { "system.drill_file_history", + "system.zip_file_history", + "system.job_file_history" } ) + { + if( Contains( candidate ) ) + histories[candidate] = GetJson( candidate ).value(); + } + + return histories; +} + diff --git a/gerbview/gerbview_settings.h b/gerbview/gerbview_settings.h index e9ac3dffdf..4ed50fcefa 100644 --- a/gerbview/gerbview_settings.h +++ b/gerbview/gerbview_settings.h @@ -21,8 +21,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef _GERBVIEW_SETTINGS_H -#define _GERBVIEW_SETTINGS_H +#pragma once #include #include @@ -40,10 +39,11 @@ public: }; GERBVIEW_SETTINGS(); + virtual ~GERBVIEW_SETTINGS() = default; - virtual ~GERBVIEW_SETTINGS() {} + std::map GetFileHistories() override; - virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override; + bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override; /** * return the Excellon default values to read a drill file @@ -55,17 +55,12 @@ public: } public: - - APPEARANCE m_Appearance; - - GBR_DISPLAY_OPTIONS m_Display; - - int m_BoardLayersCount; + APPEARANCE m_Appearance; + GBR_DISPLAY_OPTIONS m_Display; + int m_BoardLayersCount; std::vector m_DrillFileHistory; - std::vector m_ZipFileHistory; - std::vector m_JobFileHistory; /** @@ -77,9 +72,6 @@ public: EXCELLON_DEFAULTS m_ExcellonDefaults; protected: - virtual std::string getLegacyFrameName() const override { return "GerberFrame"; } }; - -#endif diff --git a/include/dialogs/panel_common_settings.h b/include/dialogs/panel_common_settings.h index b789ca698b..eaa06db30c 100644 --- a/include/dialogs/panel_common_settings.h +++ b/include/dialogs/panel_common_settings.h @@ -21,15 +21,12 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef KICAD_DIALOG_SUITE_OPTIONS_H -#define KICAD_DIALOG_SUITE_OPTIONS_H +#pragma once #include class COMMON_SETTINGS; -class DIALOG_SHIM; -class STEPPED_SLIDER; class PANEL_COMMON_SETTINGS : public PANEL_COMMON_SETTINGS_BASE @@ -64,5 +61,3 @@ private: void ShowFileManagerWidgets( bool aBool ); void setPdfViewerPathState(); }; - -#endif //KICAD_DIALOG_SUITE_OPTIONS_H diff --git a/include/dialogs/panel_maintenance.h b/include/dialogs/panel_maintenance.h new file mode 100644 index 0000000000..742033831a --- /dev/null +++ b/include/dialogs/panel_maintenance.h @@ -0,0 +1,57 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright The KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#pragma once + +#include + + +class COMMON_SETTINGS; +class EDA_BASE_FRAME; + + +class PANEL_MAINTENANCE : public PANEL_MAINTENANCE_BASE +{ +public: + PANEL_MAINTENANCE( wxWindow* aParent, EDA_BASE_FRAME* aFrame ); + ~PANEL_MAINTENANCE() = default; + + void ResetPanel() override; + +protected: + bool TransferDataFromWindow() override; + bool TransferDataToWindow() override; + + void applySettingsToPanel( COMMON_SETTINGS& aSettings ); + + void doClearDontShowAgain(); + void doClearDialogState(); + + void onClearFileHistory( wxCommandEvent& event ) override; + void onClearDontShowAgain( wxCommandEvent& event ) override; + void onClearDialogState( wxCommandEvent& event ) override; + void onResetAll( wxCommandEvent& event ) override; + +protected: + EDA_BASE_FRAME* m_frame; +}; diff --git a/include/eda_base_frame.h b/include/eda_base_frame.h index 65feae5c82..d692da2521 100644 --- a/include/eda_base_frame.h +++ b/include/eda_base_frame.h @@ -396,11 +396,8 @@ public: /** * Remove all files from the file history. - * - * @param aFileHistory The FILE_HISTORY in use. If null, the main application file - * history is used */ - void ClearFileHistory( FILE_HISTORY* aFileHistory = nullptr ); + virtual void ClearFileHistory(); /** * Update the list of recently opened files. diff --git a/include/kidialog.h b/include/kidialog.h index e22a531fd4..8d08a2a3e8 100644 --- a/include/kidialog.h +++ b/include/kidialog.h @@ -22,15 +22,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/** - * This file is part of the common library. - * - * @file kidialog.h - * @see common.h - */ - -#ifndef KIDIALOG_H_ -#define KIDIALOG_H_ +#pragma once #include #include @@ -49,13 +41,13 @@ class KICOMMON_API KIDIALOG : public KIDIALOG_BASE { public: + static void ClearDoNotShowAgainDialogs(); + ///< Dialog type. Selects appropriate icon and default dialog title enum KD_TYPE { KD_NONE, KD_INFO, KD_QUESTION, KD_WARNING, KD_ERROR }; - KIDIALOG( wxWindow* aParent, const wxString& aMessage, const wxString& aCaption, - long aStyle = wxOK ); - KIDIALOG( wxWindow* aParent, const wxString& aMessage, KD_TYPE aType, - const wxString& aCaption = "" ); + KIDIALOG( wxWindow* aParent, const wxString& aMessage, const wxString& aCaption, long aStyle = wxOK ); + KIDIALOG( wxWindow* aParent, const wxString& aMessage, KD_TYPE aType, const wxString& aCaption = "" ); bool SetOKCancelLabels( const ButtonLabel& ok, const ButtonLabel& cancel ) override { @@ -68,7 +60,6 @@ public: /// Checks the 'do not show again' setting for the dialog. bool DoNotShowAgain() const; - void ForceShowAgain(); bool Show( bool aShow = true ) override; int ShowModal() override; @@ -80,10 +71,6 @@ protected: protected: unsigned long m_hash; // Unique id - bool m_cancelMeansCancel; // If the Cancel button is renamed then it should be - // saved by the DoNotShowAgain checkbox. If it's really - // a cancel then it should not. + bool m_cancelMeansCancel; // If the Cancel button is renamed then it should be saved by the + // DoNotShowAgain checkbox. If it's really a cancel then it should not. }; - - -#endif /* KIDIALOG_H_ */ diff --git a/include/kiway.h b/include/kiway.h index 5e556573bd..ee066674de 100644 --- a/include/kiway.h +++ b/include/kiway.h @@ -404,6 +404,12 @@ public: */ virtual void CommonSettingsChanged( int aFlags = 0 ); + /** + * Clear the wxWidgets file history on each open frame. Preference records are handled + * by SETTINGS_MANAGER (as not all frames might be open). + */ + void ClearFileHistory(); + /** * Calls ProjectChanged() on all KIWAY_PLAYERs. * Used after changing the project to ensure all players are updated correctly. diff --git a/include/settings/common_settings.h b/include/settings/common_settings.h index 03d0576bd7..b34588b506 100644 --- a/include/settings/common_settings.h +++ b/include/settings/common_settings.h @@ -18,8 +18,7 @@ * with this program. If not, see . */ -#ifndef _COMMON_SETTINGS_H -#define _COMMON_SETTINGS_H +#pragma once #include #include @@ -222,34 +221,20 @@ private: std::vector& aSearchPaths ); public: - APPEARANCE m_Appearance; - - AUTO_BACKUP m_Backup; - - ENVIRONMENT m_Env; - - INPUT m_Input; - - SPACEMOUSE m_SpaceMouse; - - GRAPHICS m_Graphics; - - SESSION m_Session; - - SYSTEM m_System; - + APPEARANCE m_Appearance; + AUTO_BACKUP m_Backup; + ENVIRONMENT m_Env; + INPUT m_Input; + SPACEMOUSE m_SpaceMouse; + GRAPHICS m_Graphics; + 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; + NETCLASS_PANEL m_NetclassPanel; + PACKAGE_MANAGER m_PackageManager; + GIT m_Git; + API m_Api; /// Persistent dialog control values std::map> m_dialogControlValues; }; - -#endif diff --git a/include/settings/json_settings.h b/include/settings/json_settings.h index 6daee03667..caa638ad11 100644 --- a/include/settings/json_settings.h +++ b/include/settings/json_settings.h @@ -166,6 +166,8 @@ public: template void Set( const std::string& aPath, ValueType aVal ); + virtual std::map GetFileHistories(); + /** * Migrates the schema of this settings from the version in the file to the latest version * diff --git a/include/settings/settings_manager.h b/include/settings/settings_manager.h index 506502efc2..f67995b6a0 100644 --- a/include/settings/settings_manager.h +++ b/include/settings/settings_manager.h @@ -91,6 +91,16 @@ public: */ void FlushAndRelease( JSON_SETTINGS* aSettings, bool aSave = true ); + /** + * Reset all program settings to defaults. + */ + void ResetToDefaults(); + + /** + * Clear saved file history from all settings files. + */ + void ClearFileHistory(); + /** * Return a handle to the a given settings by type. * diff --git a/include/widgets/paged_dialog.h b/include/widgets/paged_dialog.h index 4753310d15..38177689a4 100644 --- a/include/widgets/paged_dialog.h +++ b/include/widgets/paged_dialog.h @@ -50,6 +50,8 @@ public: void UpdateResetButton( int aPage ); + WX_INFOBAR* GetInfoBar() { return m_infoBar; } + static PAGED_DIALOG* GetDialog( wxWindow* aWindow ); protected: