Improve ease-of-use of color preferences.
This commit is contained in:
parent
ac933d4e83
commit
48e0f68c7e
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-2021 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
|
||||
|
@ -26,8 +26,6 @@
|
|||
#include <symbol_editor_settings.h>
|
||||
#include <sch_painter.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <view/view.h>
|
||||
|
||||
#include "panel_sym_color_settings.h"
|
||||
|
||||
|
||||
|
@ -42,7 +40,10 @@ bool PANEL_SYM_COLOR_SETTINGS::TransferDataToWindow()
|
|||
{
|
||||
SYMBOL_EDITOR_SETTINGS* cfg = m_frame->GetSettings();
|
||||
|
||||
m_useEeschemaTheme->SetValue( cfg->m_UseEeschemaColorSettings );
|
||||
if( cfg->m_UseEeschemaColorSettings )
|
||||
m_eeschemaRB->SetValue( true );
|
||||
else
|
||||
m_themeRB->SetValue( true );
|
||||
|
||||
COLOR_SETTINGS* current = m_frame->GetSettingsManager()->GetColorSettings( cfg->m_ColorTheme );
|
||||
|
||||
|
@ -50,23 +51,20 @@ bool PANEL_SYM_COLOR_SETTINGS::TransferDataToWindow()
|
|||
int height = 0;
|
||||
int minwidth = width;
|
||||
|
||||
m_themeSelection->Clear();
|
||||
m_themes->Clear();
|
||||
|
||||
for( COLOR_SETTINGS* settings : m_frame->GetSettingsManager()->GetColorSettingsList() )
|
||||
{
|
||||
int pos = m_themeSelection->Append( settings->GetName(), static_cast<void*>( settings ) );
|
||||
int pos = m_themes->Append( settings->GetName(), static_cast<void*>( settings ) );
|
||||
|
||||
if( settings == current )
|
||||
m_themeSelection->SetSelection( pos );
|
||||
m_themes->SetSelection( pos );
|
||||
|
||||
m_themeSelection->GetTextExtent( settings->GetName(), &width, &height );
|
||||
m_themes->GetTextExtent( settings->GetName(), &width, &height );
|
||||
minwidth = std::max( minwidth, width );
|
||||
}
|
||||
|
||||
m_themeSelection->SetMinSize( wxSize( minwidth + 50, -1 ) );
|
||||
|
||||
m_txtTheme->Enable( !m_useEeschemaTheme->GetValue() );
|
||||
m_themeSelection->Enable( !m_useEeschemaTheme->GetValue() );
|
||||
m_themes->SetMinSize( wxSize( minwidth + 50, -1 ) );
|
||||
|
||||
Fit();
|
||||
|
||||
|
@ -77,34 +75,30 @@ bool PANEL_SYM_COLOR_SETTINGS::TransferDataToWindow()
|
|||
bool PANEL_SYM_COLOR_SETTINGS::TransferDataFromWindow()
|
||||
{
|
||||
SETTINGS_MANAGER* mgr = m_frame->GetSettingsManager();
|
||||
|
||||
auto selected = static_cast<COLOR_SETTINGS*>(
|
||||
m_themeSelection->GetClientData( m_themeSelection->GetSelection() ) );
|
||||
int sel = m_themes->GetSelection();
|
||||
COLOR_SETTINGS* colors = static_cast<COLOR_SETTINGS*>( m_themes->GetClientData( sel ) );
|
||||
|
||||
SYMBOL_EDITOR_SETTINGS* cfg = mgr->GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
|
||||
|
||||
cfg->m_UseEeschemaColorSettings = m_useEeschemaTheme->GetValue();
|
||||
|
||||
if( !cfg->m_UseEeschemaColorSettings )
|
||||
cfg->m_ColorTheme = selected->GetFilename();
|
||||
cfg->m_UseEeschemaColorSettings = m_eeschemaRB->GetValue();
|
||||
|
||||
if( cfg->m_UseEeschemaColorSettings )
|
||||
{
|
||||
EESCHEMA_SETTINGS* eecfg = mgr->GetAppSettings<EESCHEMA_SETTINGS>();
|
||||
selected = mgr->GetColorSettings( eecfg->m_ColorTheme );
|
||||
colors = mgr->GetColorSettings( eecfg->m_ColorTheme );
|
||||
}
|
||||
else
|
||||
{
|
||||
cfg->m_ColorTheme = colors->GetFilename();
|
||||
}
|
||||
|
||||
auto settings = m_frame->GetCanvas()->GetView()->GetPainter()->GetSettings();
|
||||
settings->LoadColors( selected );
|
||||
RENDER_SETTINGS* settings = m_frame->GetCanvas()->GetView()->GetPainter()->GetSettings();
|
||||
settings->LoadColors( colors );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void PANEL_SYM_COLOR_SETTINGS::OnUseEeschemaThemeChanged( wxCommandEvent& event )
|
||||
void PANEL_SYM_COLOR_SETTINGS::OnThemeChanged( wxCommandEvent& event )
|
||||
{
|
||||
bool useEeschema = m_useEeschemaTheme->GetValue();
|
||||
|
||||
m_txtTheme->Enable( !useEeschema );
|
||||
m_themeSelection->Enable( !useEeschema );
|
||||
m_themeRB->SetValue( true );
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
PANEL_SYM_COLOR_SETTINGS( SYMBOL_EDIT_FRAME* aFrame, wxWindow* aWindow );
|
||||
|
||||
protected:
|
||||
void OnUseEeschemaThemeChanged( wxCommandEvent& event ) override;
|
||||
void OnThemeChanged( wxCommandEvent& event ) override;
|
||||
|
||||
private:
|
||||
bool TransferDataToWindow() override;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
BEGIN_EVENT_TABLE( PANEL_SYM_COLOR_SETTINGS_BASE, wxPanel )
|
||||
EVT_CHECKBOX( wxID_ANY, PANEL_SYM_COLOR_SETTINGS_BASE::_wxFB_OnUseEeschemaThemeChanged )
|
||||
EVT_CHOICE( wxID_ANY, PANEL_SYM_COLOR_SETTINGS_BASE::_wxFB_OnThemeChanged )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
PANEL_SYM_COLOR_SETTINGS_BASE::PANEL_SYM_COLOR_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
|
||||
|
@ -19,25 +19,25 @@ PANEL_SYM_COLOR_SETTINGS_BASE::PANEL_SYM_COLOR_SETTINGS_BASE( wxWindow* parent,
|
|||
p1mainSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxStaticBoxSizer* sbSizer1;
|
||||
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Color Theme") ), wxHORIZONTAL );
|
||||
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Color Theme") ), wxVERTICAL );
|
||||
|
||||
sbSizer1->SetMinSize( wxSize( 250,-1 ) );
|
||||
m_useEeschemaTheme = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Use Eeschema color theme"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_useEeschemaTheme->SetValue(true);
|
||||
sbSizer1->Add( m_useEeschemaTheme, 0, wxALL|wxEXPAND, 10 );
|
||||
m_eeschemaRB = new wxRadioButton( sbSizer1->GetStaticBox(), wxID_ANY, _("Use schematic editor color theme"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
|
||||
sbSizer1->Add( m_eeschemaRB, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_txtTheme = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("Theme:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_txtTheme->Wrap( -1 );
|
||||
m_txtTheme->Enable( false );
|
||||
wxBoxSizer* bSizer2;
|
||||
bSizer2 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
sbSizer1->Add( m_txtTheme, 0, wxALIGN_CENTER_VERTICAL|wxALL, 10 );
|
||||
m_themeRB = new wxRadioButton( sbSizer1->GetStaticBox(), wxID_ANY, _("Use theme:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer2->Add( m_themeRB, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxArrayString m_themeSelectionChoices;
|
||||
m_themeSelection = new wxChoice( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_themeSelectionChoices, 0 );
|
||||
m_themeSelection->SetSelection( 0 );
|
||||
m_themeSelection->Enable( false );
|
||||
wxArrayString m_themesChoices;
|
||||
m_themes = new wxChoice( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_themesChoices, 0 );
|
||||
m_themes->SetSelection( 0 );
|
||||
bSizer2->Add( m_themes, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
sbSizer1->Add( m_themeSelection, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxTOP, 10 );
|
||||
|
||||
sbSizer1->Add( bSizer2, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
p1mainSizer->Add( sbSizer1, 0, wxALL, 5 );
|
||||
|
|
|
@ -63,14 +63,14 @@
|
|||
<property name="label">Color Theme</property>
|
||||
<property name="minimum_size">250,-1</property>
|
||||
<property name="name">sbSizer1</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="parent">1</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">10</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<object class="wxRadioButton" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -84,7 +84,6 @@
|
|||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">1</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
|
@ -99,7 +98,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Use Eeschema color theme</property>
|
||||
<property name="label">Use schematic editor color theme</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
|
@ -107,7 +106,7 @@
|
|||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_useEeschemaTheme</property>
|
||||
<property name="name">m_eeschemaRB</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
|
@ -117,7 +116,7 @@
|
|||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="style">wxRB_GROUP</property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
|
@ -125,135 +124,150 @@
|
|||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value">0</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnCheckBox">OnUseEeschemaThemeChanged</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">10</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">0</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Theme:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_txtTheme</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">10</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxTOP</property>
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxChoice" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices"></property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">0</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_themeSelection</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">0</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="name">bSizer2</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxRadioButton" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Use theme:</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_themeRB</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value">0</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxChoice" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices"></property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_themes</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">0</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChoice">OnThemeChanged</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
|
|
@ -11,12 +11,11 @@
|
|||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/radiobut.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
|
@ -34,16 +33,16 @@ class PANEL_SYM_COLOR_SETTINGS_BASE : public wxPanel
|
|||
private:
|
||||
|
||||
// Private event handlers
|
||||
void _wxFB_OnUseEeschemaThemeChanged( wxCommandEvent& event ){ OnUseEeschemaThemeChanged( event ); }
|
||||
void _wxFB_OnThemeChanged( wxCommandEvent& event ){ OnThemeChanged( event ); }
|
||||
|
||||
|
||||
protected:
|
||||
wxCheckBox* m_useEeschemaTheme;
|
||||
wxStaticText* m_txtTheme;
|
||||
wxChoice* m_themeSelection;
|
||||
wxRadioButton* m_eeschemaRB;
|
||||
wxRadioButton* m_themeRB;
|
||||
wxChoice* m_themes;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnUseEeschemaThemeChanged( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnThemeChanged( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
|
|
@ -45,20 +45,20 @@ bool PANEL_PL_EDITOR_COLOR_SETTINGS::TransferDataToWindow()
|
|||
int height = 0;
|
||||
int minwidth = width;
|
||||
|
||||
m_themeSelection->Clear();
|
||||
m_themes->Clear();
|
||||
|
||||
for( COLOR_SETTINGS* settings : Pgm().GetSettingsManager().GetColorSettingsList() )
|
||||
{
|
||||
int pos = m_themeSelection->Append( settings->GetName(), static_cast<void*>( settings ) );
|
||||
int pos = m_themes->Append( settings->GetName(), static_cast<void*>( settings ) );
|
||||
|
||||
if( settings == current )
|
||||
m_themeSelection->SetSelection( pos );
|
||||
m_themes->SetSelection( pos );
|
||||
|
||||
m_themeSelection->GetTextExtent( settings->GetName(), &width, &height );
|
||||
m_themes->GetTextExtent( settings->GetName(), &width, &height );
|
||||
minwidth = std::max( minwidth, width );
|
||||
}
|
||||
|
||||
m_themeSelection->SetMinSize( wxSize( minwidth + 50, -1 ) );
|
||||
m_themes->SetMinSize( wxSize( minwidth + 50, -1 ) );
|
||||
|
||||
Fit();
|
||||
|
||||
|
@ -69,16 +69,14 @@ bool PANEL_PL_EDITOR_COLOR_SETTINGS::TransferDataToWindow()
|
|||
bool PANEL_PL_EDITOR_COLOR_SETTINGS::TransferDataFromWindow()
|
||||
{
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
|
||||
auto selected = static_cast<COLOR_SETTINGS*>(
|
||||
m_themeSelection->GetClientData( m_themeSelection->GetSelection() ) );
|
||||
int sel = m_themes->GetSelection();
|
||||
COLOR_SETTINGS* colors = static_cast<COLOR_SETTINGS*>( m_themes->GetClientData( sel ) );
|
||||
|
||||
PL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<PL_EDITOR_SETTINGS>();
|
||||
cfg->m_ColorTheme = colors->GetFilename();
|
||||
|
||||
cfg->m_ColorTheme = selected->GetFilename();
|
||||
|
||||
auto settings = m_frame->GetCanvas()->GetView()->GetPainter()->GetSettings();
|
||||
settings->LoadColors( selected );
|
||||
RENDER_SETTINGS* settings = m_frame->GetCanvas()->GetView()->GetPainter()->GetSettings();
|
||||
settings->LoadColors( colors );
|
||||
|
||||
return true;
|
||||
}
|
|
@ -20,12 +20,12 @@ PANEL_PL_EDITOR_COLOR_SETTINGS_BASE::PANEL_PL_EDITOR_COLOR_SETTINGS_BASE( wxWind
|
|||
sbSizer1->SetMinSize( wxSize( 250,-1 ) );
|
||||
m_txtTheme = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("Theme:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_txtTheme->Wrap( -1 );
|
||||
sbSizer1->Add( m_txtTheme, 0, wxALIGN_CENTER_VERTICAL|wxALL, 10 );
|
||||
sbSizer1->Add( m_txtTheme, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxArrayString m_themeSelectionChoices;
|
||||
m_themeSelection = new wxChoice( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_themeSelectionChoices, 0 );
|
||||
m_themeSelection->SetSelection( 0 );
|
||||
sbSizer1->Add( m_themeSelection, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxTOP, 10 );
|
||||
wxArrayString m_themesChoices;
|
||||
m_themes = new wxChoice( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_themesChoices, 0 );
|
||||
m_themes->SetSelection( 0 );
|
||||
sbSizer1->Add( m_themes, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
|
||||
p1mainSizer->Add( sbSizer1, 0, wxALL, 10 );
|
||||
|
|
|
@ -67,8 +67,8 @@
|
|||
<property name="parent">1</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">10</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -128,8 +128,8 @@
|
|||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">10</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxTOP</property>
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxChoice" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -167,7 +167,7 @@
|
|||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_themeSelection</property>
|
||||
<property name="name">m_themes</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
|
|
|
@ -33,7 +33,7 @@ class PANEL_PL_EDITOR_COLOR_SETTINGS_BASE : public wxPanel
|
|||
|
||||
protected:
|
||||
wxStaticText* m_txtTheme;
|
||||
wxChoice* m_themeSelection;
|
||||
wxChoice* m_themes;
|
||||
|
||||
public:
|
||||
|
||||
|
|
Loading…
Reference in New Issue