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 (C) 2020-2023 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{
35 PL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<PL_EDITOR_SETTINGS>( "pl_editor" );
37
38 int width = 0;
39 int height = 0;
40 int minwidth = width;
41
42 m_themes->Clear();
43
44 for( COLOR_SETTINGS* settings : Pgm().GetSettingsManager().GetColorSettingsList() )
45 {
46 int pos = m_themes->Append( settings->GetName(), static_cast<void*>( settings ) );
47
48 if( settings == current )
49 m_themes->SetSelection( pos );
50
51 m_themes->GetTextExtent( settings->GetName(), &width, &height );
52 minwidth = std::max( minwidth, width );
53 }
54
55 m_themes->SetMinSize( wxSize( minwidth + 50, -1 ) );
56
57 Fit();
58
59 return true;
60}
61
62
64{
65 int sel = m_themes->GetSelection();
66
67 if( sel >= 0 )
68 {
70 PL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<PL_EDITOR_SETTINGS>( "pl_editor" );
71 COLOR_SETTINGS* colors = static_cast<COLOR_SETTINGS*>( m_themes->GetClientData( sel ) );
72
73 cfg->m_ColorTheme = colors->GetFilename();
74 }
75
76 return true;
77}
78
79
81{
82 m_themes->SetStringSelection( _( "KiCad Default" ) );
83}
84
85
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:197
Color settings are a bit different than most of the settings objects in that there can be more than o...
Class PANEL_PL_EDITOR_COLOR_SETTINGS_BASE.
void ResetPanel() override
Reset the contents of this panel.
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:142
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
T * GetAppSettings(const wxString &aFilename)
Returns a handle to the a given settings by type If the settings have already been loaded,...
#define _(s)
SETTINGS_MANAGER * GetSettingsManager()
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1060
see class PGM_BASE