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, see <https://www.gnu.org/licenses/>.
18*/
19
20#include <pgm_base.h>
25
26
31
32
34{
36
37 if( cfg && cfg->m_UseEeschemaColorSettings )
38 m_eeschemaRB->SetValue( true );
39 else
40 m_themeRB->SetValue( true );
41
43
44 int width = 0;
45 int height = 0;
46 int minwidth = width;
47
48 m_themes->Clear();
49
50 for( COLOR_SETTINGS* settings : Pgm().GetSettingsManager().GetColorSettingsList() )
51 {
52 int pos = m_themes->Append( settings->GetName(), static_cast<void*>( settings ) );
53
54 if( settings == current )
55 m_themes->SetSelection( pos );
56
57 m_themes->GetTextExtent( settings->GetName(), &width, &height );
58 minwidth = std::max( minwidth, width );
59 }
60
61 m_themes->SetMinSize( wxSize( minwidth + 50, -1 ) );
62
63 Fit();
64
65 return true;
66}
67
68
70{
72 {
73 cfg->m_UseEeschemaColorSettings = m_eeschemaRB->GetValue();
74
75 if( !cfg->m_UseEeschemaColorSettings )
76 {
77 int sel = m_themes->GetSelection();
78 COLOR_SETTINGS* colors = static_cast<COLOR_SETTINGS*>( m_themes->GetClientData( sel ) );
79
80 cfg->m_ColorTheme = colors->GetFilename();
81 }
82 }
83
84 return true;
85}
86
87
88void PANEL_SYM_COLOR_SETTINGS::OnThemeChanged( wxCommandEvent& event )
89{
90 m_themeRB->SetValue( true );
91}
wxString m_ColorTheme
Active color theme name.
Color settings are a bit different than most of the settings objects in that there can be more than o...
wxString GetFilename() const
PANEL_SYM_COLOR_SETTINGS_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)
void OnThemeChanged(wxCommandEvent &event) override
PANEL_SYM_COLOR_SETTINGS(wxWindow *aWindow)
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
#define DEFAULT_THEME
COLOR_SETTINGS * GetColorSettings(const wxString &aName)
T * GetAppSettings(const char *aFilename)