7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 14:01:44 +00:00

Put preferences panes for toolbars, but hide behind an advanced config

There is still more work to do to make this feature actually
user-friendly and make it so people can't break their UI config too
easily.
This commit is contained in:
Ian McInerney 2025-02-26 19:25:57 +00:00
parent e53c155b8c
commit ab114c4159
5 changed files with 62 additions and 5 deletions

View File

@ -128,6 +128,7 @@ static const wxChar NetInspectorBulkUpdateOptimisationThreshold[] =
static const wxChar ExcludeFromSimulationLineWidth[] = wxT( "ExcludeFromSimulationLineWidth" );
static const wxChar GitIconRefreshInterval[] = wxT( "GitIconRefreshInterval" );
static const wxChar GitProjectStatusRefreshInterval[] = wxT( "GitProjectStatusRefreshInterval" );
static const wxChar ConfigurableToolbars[] = wxT( "ConfigurableToolbars" );
} // namespace KEYS
@ -310,6 +311,8 @@ ADVANCED_CFG::ADVANCED_CFG()
m_GitIconRefreshInterval = 10000;
m_GitProjectStatusRefreshInterval = 60000;
m_ConfigurableToolbars = false;
loadFromConfigFile();
}
@ -599,6 +602,10 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
&m_GitProjectStatusRefreshInterval,
m_GitProjectStatusRefreshInterval, 0, 100000 ) );
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ConfigurableToolbars,
&m_ConfigurableToolbars,
m_ConfigurableToolbars ) );
// Special case for trace mask setting...we just grab them and set them immediately
// Because we even use wxLogTrace inside of advanced config
wxString traceMasks;

View File

@ -1309,7 +1309,10 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_ANNO_OPTIONS ), _( "Annotation Options" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_COLORS ), _( "Colors" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_TOOLBARS ), _( "Toolbars" ) );
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" ) );
@ -1349,7 +1352,10 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
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_TOOLBARS ), _( "Toolbars" ) );
if( ADVANCED_CFG::GetCfg().m_ConfigurableToolbars )
book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_TOOLBARS ), _( "Toolbars" ) );
book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_ACTION_PLUGINS ), _( "Plugins" ) );
if( GetFrameType() == FRAME_PCB_DISPLAY3D )

View File

@ -67,6 +67,10 @@
#include <panel_sym_display_options.h>
#include <sim/simulator_frame.h>
#include <dialogs/panel_toolbar_customization.h>
#include <toolbars_sch_editor.h>
#include <toolbars_symbol_editor.h>
#include <wx/crt.h>
// The main sheet of the project
@ -306,15 +310,25 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
return new PANEL_EESCHEMA_ANNOTATION_OPTIONS( aParent, schSettingsProvider );
}
/*
case PANEL_SCH_TOOLBARS:
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
TOOLBAR_SETTINGS* tb = new SCH_EDIT_TOOLBAR_SETTINGS();
return new PANEL_TOOLBAR_CUSTOMIZATION( aParent, cfg );
std::vector<TOOL_ACTION*> actions;
std::vector<ACTION_TOOLBAR_CONTROL*> controls;
for( TOOL_ACTION* action : ACTION_MANAGER::GetActionList() )
actions.push_back( action );
for( ACTION_TOOLBAR_CONTROL* control : ACTION_TOOLBAR::GetCustomControlList() )
controls.push_back( control );
return new PANEL_TOOLBAR_CUSTOMIZATION( aParent, cfg, tb, actions, controls );
}
*/
case PANEL_SCH_COLORS:
return new PANEL_EESCHEMA_COLOR_SETTINGS( aParent );

View File

@ -757,6 +757,14 @@ public:
*/
int m_GitProjectStatusRefreshInterval;
/**
* Enable the UI to configure toolbars.
*
* Setting name: "ConfigurableToolbars"
* Default value: false
*/
bool m_ConfigurableToolbars;
///@}
private:

View File

@ -66,6 +66,10 @@
#include <wildcards_and_files_ext.h>
#include "pcbnew_jobs_handler.h"
#include <dialogs/panel_toolbar_customization.h>
#include <toolbars_pcb_editor.h>
#include <toolbars_footprint_editor.h>
#include <wx/crt.h>
/* init functions defined by swig */
@ -293,6 +297,24 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
return new PANEL_PCBNEW_COLOR_SETTINGS( aParent, board );
}
case PANEL_PCB_TOOLBARS:
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
PCBNEW_SETTINGS* cfg = mgr.GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" );
TOOLBAR_SETTINGS* tb = new PCB_EDIT_TOOLBAR_SETTINGS();
std::vector<TOOL_ACTION*> actions;
std::vector<ACTION_TOOLBAR_CONTROL*> controls;
for( TOOL_ACTION* action : ACTION_MANAGER::GetActionList() )
actions.push_back( action );
for( ACTION_TOOLBAR_CONTROL* control : ACTION_TOOLBAR::GetCustomControlList() )
controls.push_back( control );
return new PANEL_TOOLBAR_CUSTOMIZATION( aParent, cfg, tb, actions, controls );
}
case PANEL_PCB_ACTION_PLUGINS:
return new PANEL_PCBNEW_ACTION_PLUGINS( aParent );