KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_pl_editor_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 modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <pgm_base.h>
22#include <pl_editor_settings.h>
24
25
28{
29}
30
31
33{
34 PL_EDITOR_SETTINGS* cfg = GetAppSettings<PL_EDITOR_SETTINGS>( "pl_editor" );
36
37 int width = 0;
38 int height = 0;
39 int minwidth = width;
40
41 m_themes->Clear();
42
43 for( COLOR_SETTINGS* settings : Pgm().GetSettingsManager().GetColorSettingsList() )
44 {
45 int pos = m_themes->Append( settings->GetName(), static_cast<void*>( settings ) );
46
47 if( settings == current )
48 m_themes->SetSelection( pos );
49
50 m_themes->GetTextExtent( settings->GetName(), &width, &height );
51 minwidth = std::max( minwidth, width );
52 }
53
54 m_themes->SetMinSize( wxSize( minwidth + 50, -1 ) );
55
56 Fit();
57
58 return true;
59}
60
61
63{
64 int sel = m_themes->GetSelection();
65
66 if( sel >= 0 )
67 {
68 if( PL_EDITOR_SETTINGS* cfg = GetAppSettings<PL_EDITOR_SETTINGS>( "pl_editor" ) )
69 {
70 COLOR_SETTINGS* colors = static_cast<COLOR_SETTINGS*>( m_themes->GetClientData( sel ) );
71 cfg->m_ColorTheme = colors->GetFilename();
72 }
73 }
74
75 return true;
76}
77
78
80{
81 m_themes->SetStringSelection( _( "KiCad Default" ) );
82}
83
84
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:236
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:86
Class PANEL_PL_EDITOR_COLOR_SETTINGS_BASE.
void ResetPanel() override
Reset the contents of this panel.
#define _(s)
SETTINGS_MANAGER * GetSettingsManager()
PGM_BASE & Pgm()
The global program "get" accessor.
Definition: pgm_base.cpp:902
see class PGM_BASE
#define DEFAULT_THEME
COLOR_SETTINGS * GetColorSettings(const wxString &aName)