mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 10:13:19 +02:00
Add setting for custom toolbar and read custom toolbar config
This commit is contained in:
parent
7e2a81da15
commit
caa03ab59e
@ -57,6 +57,7 @@
|
|||||||
#include <tool/common_control.h>
|
#include <tool/common_control.h>
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
#include <tool/tool_dispatcher.h>
|
#include <tool/tool_dispatcher.h>
|
||||||
|
#include <tool/ui/toolbar_configuration.h>
|
||||||
#include <trace_helpers.h>
|
#include <trace_helpers.h>
|
||||||
#include <widgets/paged_dialog.h>
|
#include <widgets/paged_dialog.h>
|
||||||
#include <widgets/wx_busy_indicator.h>
|
#include <widgets/wx_busy_indicator.h>
|
||||||
@ -516,6 +517,31 @@ ACTION_TOOLBAR_CONTROL_FACTORY* EDA_BASE_FRAME::GetCustomToolbarControlFactory(
|
|||||||
|
|
||||||
|
|
||||||
void EDA_BASE_FRAME::configureToolbars()
|
void EDA_BASE_FRAME::configureToolbars()
|
||||||
|
{
|
||||||
|
APP_SETTINGS_BASE* cfg = config();
|
||||||
|
|
||||||
|
if( cfg && cfg->m_CustomToolbars )
|
||||||
|
{
|
||||||
|
// Get the custom toolbar config
|
||||||
|
TOOLBAR_SETTINGS tb( cfg->GetFilename() + "-toolbars" );
|
||||||
|
|
||||||
|
tb.LoadFromFile( SETTINGS_MANAGER::GetToolbarSettingsPath() );
|
||||||
|
|
||||||
|
for( auto t : tb.m_Toolbars )
|
||||||
|
{
|
||||||
|
if( t.first == "left" )
|
||||||
|
m_tbConfigLeft = t.second;
|
||||||
|
else if( t.first == "right" )
|
||||||
|
m_tbConfigRight = t.second;
|
||||||
|
else if( t.first == "top_aux" )
|
||||||
|
m_tbConfigTopAux = t.second;
|
||||||
|
else if( t.first == "top_main" )
|
||||||
|
m_tbConfigTopMain = t.second;
|
||||||
|
else
|
||||||
|
wxASSERT_MSG( false, wxString::Format( "Unknown toolbar: '%s'", t.first ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// Get the default toolbar config for the frame
|
// Get the default toolbar config for the frame
|
||||||
m_tbConfigLeft = DefaultLeftToolbarConfig();
|
m_tbConfigLeft = DefaultLeftToolbarConfig();
|
||||||
@ -523,6 +549,7 @@ void EDA_BASE_FRAME::configureToolbars()
|
|||||||
m_tbConfigTopAux = DefaultTopAuxToolbarConfig();
|
m_tbConfigTopAux = DefaultTopAuxToolbarConfig();
|
||||||
m_tbConfigTopMain = DefaultTopMainToolbarConfig();
|
m_tbConfigTopMain = DefaultTopMainToolbarConfig();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_BASE_FRAME::RecreateToolbars()
|
void EDA_BASE_FRAME::RecreateToolbars()
|
||||||
|
@ -43,6 +43,7 @@ APP_SETTINGS_BASE::APP_SETTINGS_BASE( const std::string& aFilename, int aSchemaV
|
|||||||
m_System(),
|
m_System(),
|
||||||
m_Plugins(),
|
m_Plugins(),
|
||||||
m_Window(),
|
m_Window(),
|
||||||
|
m_CustomToolbars( false ),
|
||||||
m_appSettingsSchemaVersion( aSchemaVersion )
|
m_appSettingsSchemaVersion( aSchemaVersion )
|
||||||
{
|
{
|
||||||
// Make Coverity happy:
|
// Make Coverity happy:
|
||||||
@ -205,6 +206,9 @@ APP_SETTINGS_BASE::APP_SETTINGS_BASE( const std::string& aFilename, int aSchemaV
|
|||||||
m_params.emplace_back( new PARAM<wxString>( "appearance.color_theme",
|
m_params.emplace_back( new PARAM<wxString>( "appearance.color_theme",
|
||||||
&m_ColorTheme, COLOR_SETTINGS::COLOR_BUILTIN_DEFAULT ) );
|
&m_ColorTheme, COLOR_SETTINGS::COLOR_BUILTIN_DEFAULT ) );
|
||||||
|
|
||||||
|
m_params.emplace_back( new PARAM<bool>( "appearance.custom_toolbars",
|
||||||
|
&m_CustomToolbars, false ) );
|
||||||
|
|
||||||
addParamsForWindow( &m_Window, "window" );
|
addParamsForWindow( &m_Window, "window" );
|
||||||
|
|
||||||
m_params.emplace_back( new PARAM<bool>( "cross_probing.on_selection",
|
m_params.emplace_back( new PARAM<bool>( "cross_probing.on_selection",
|
||||||
|
@ -198,6 +198,9 @@ public:
|
|||||||
/// Active color theme name.
|
/// Active color theme name.
|
||||||
wxString m_ColorTheme;
|
wxString m_ColorTheme;
|
||||||
|
|
||||||
|
/// Use custom toolbars
|
||||||
|
bool m_CustomToolbars;
|
||||||
|
|
||||||
|
|
||||||
///! Local schema version for common app settings.
|
///! Local schema version for common app settings.
|
||||||
int m_appSettingsSchemaVersion;
|
int m_appSettingsSchemaVersion;
|
||||||
|
@ -454,6 +454,7 @@ void PCB_EDIT_FRAME::configureToolbars()
|
|||||||
_( "Region to hold the IPC/Scripting action buttons" ),
|
_( "Region to hold the IPC/Scripting action buttons" ),
|
||||||
pluginControlFactory );
|
pluginControlFactory );
|
||||||
|
|
||||||
|
/*
|
||||||
TOOLBAR_SETTINGS tb( "pcbnew-toolbars" );
|
TOOLBAR_SETTINGS tb( "pcbnew-toolbars" );
|
||||||
|
|
||||||
if( m_tbConfigLeft.has_value() )
|
if( m_tbConfigLeft.has_value() )
|
||||||
@ -469,6 +470,7 @@ void PCB_EDIT_FRAME::configureToolbars()
|
|||||||
tb.m_Toolbars.emplace( "top_main", m_tbConfigTopMain.value() );
|
tb.m_Toolbars.emplace( "top_main", m_tbConfigTopMain.value() );
|
||||||
|
|
||||||
tb.SaveToFile( SETTINGS_MANAGER::GetToolbarSettingsPath(), true );
|
tb.SaveToFile( SETTINGS_MANAGER::GetToolbarSettingsPath(), true );
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user