KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_sym_color_settings.cpp
Go to the documentation of this file.
1/*
2* This program source code file is part of KiCad, a free EDA CAD application.
3*
4* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5*
6* This program is free software; you can redistribute it and/or
7* modify it under the terms of the GNU General Public License
8* as published by the Free Software Foundation; either version 2
9* of the License, or (at your option) any later version.
10*
11* This program is distributed in the hope that it will be useful,
12* but WITHOUT ANY WARRANTY; without even the implied warranty of
13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14* GNU General Public License for more details.
15*
16* You should have received a copy of the GNU General Public License
17* along with this program; if not, you may find one here:
18* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19* or you may search the http://www.gnu.org website for the version 2 license,
20* or you may write to the Free Software Foundation, Inc.,
21* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22*/
23
24#include <pgm_base.h>
28
29
32{
33}
34
35
37{
38 SYMBOL_EDITOR_SETTINGS* cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
39
40 if( cfg && cfg->m_UseEeschemaColorSettings )
41 m_eeschemaRB->SetValue( true );
42 else
43 m_themeRB->SetValue( true );
44
46
47 int width = 0;
48 int height = 0;
49 int minwidth = width;
50
51 m_themes->Clear();
52
53 for( COLOR_SETTINGS* settings : Pgm().GetSettingsManager().GetColorSettingsList() )
54 {
55 int pos = m_themes->Append( settings->GetName(), static_cast<void*>( settings ) );
56
57 if( settings == current )
58 m_themes->SetSelection( pos );
59
60 m_themes->GetTextExtent( settings->GetName(), &width, &height );
61 minwidth = std::max( minwidth, width );
62 }
63
64 m_themes->SetMinSize( wxSize( minwidth + 50, -1 ) );
65
66 Fit();
67
68 return true;
69}
70
71
73{
74 if( SYMBOL_EDITOR_SETTINGS* cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" ) )
75 {
76 cfg->m_UseEeschemaColorSettings = m_eeschemaRB->GetValue();
77
78 if( !cfg->m_UseEeschemaColorSettings )
79 {
80 int sel = m_themes->GetSelection();
81 COLOR_SETTINGS* colors = static_cast<COLOR_SETTINGS*>( m_themes->GetClientData( sel ) );
82
83 cfg->m_ColorTheme = colors->GetFilename();
84 }
85 }
86
87 return true;
88}
89
90
91void PANEL_SYM_COLOR_SETTINGS::OnThemeChanged( wxCommandEvent& event )
92{
93 m_themeRB->SetValue( true );
94}
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:237
Color settings are a bit different than most of the settings objects in that there can be more than o...
wxString GetFilename() const
Definition: json_settings.h:81
Class PANEL_SYM_COLOR_SETTINGS_BASE.
void OnThemeChanged(wxCommandEvent &event) override
PANEL_SYM_COLOR_SETTINGS(wxWindow *aWindow)
SETTINGS_MANAGER * GetSettingsManager()
PGM_BASE & Pgm()
The global program "get" accessor.
Definition: pgm_base.cpp:893
see class PGM_BASE
#define DEFAULT_THEME
COLOR_SETTINGS * GetColorSettings(const wxString &aName)