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 (C) 2020-2021 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{
40
42 m_eeschemaRB->SetValue( true );
43 else
44 m_themeRB->SetValue( true );
45
46 COLOR_SETTINGS* current = mgr.GetColorSettings( cfg->m_ColorTheme );
47
48 int width = 0;
49 int height = 0;
50 int minwidth = width;
51
52 m_themes->Clear();
53
54 for( COLOR_SETTINGS* settings : mgr.GetColorSettingsList() )
55 {
56 int pos = m_themes->Append( settings->GetName(), static_cast<void*>( settings ) );
57
58 if( settings == current )
59 m_themes->SetSelection( pos );
60
61 m_themes->GetTextExtent( settings->GetName(), &width, &height );
62 minwidth = std::max( minwidth, width );
63 }
64
65 m_themes->SetMinSize( wxSize( minwidth + 50, -1 ) );
66
67 Fit();
68
69 return true;
70}
71
72
74{
77
79
81 {
82 int sel = m_themes->GetSelection();
83 COLOR_SETTINGS* colors = static_cast<COLOR_SETTINGS*>( m_themes->GetClientData( sel ) );
84
85 cfg->m_ColorTheme = colors->GetFilename();
86 }
87
88 return true;
89}
90
91
92void PANEL_SYM_COLOR_SETTINGS::OnThemeChanged( wxCommandEvent& event )
93{
94 m_themeRB->SetValue( true );
95}
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:173
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:80
Class PANEL_SYM_COLOR_SETTINGS_BASE.
void OnThemeChanged(wxCommandEvent &event) override
PANEL_SYM_COLOR_SETTINGS(wxWindow *aWindow)
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:142
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
std::vector< COLOR_SETTINGS * > GetColorSettingsList()
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1059
see class PGM_BASE