KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_color_settings.h
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 Jon Evans <[email protected]>
5 * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef PANEL_COLOR_SETTINGS_H
22#define PANEL_COLOR_SETTINGS_H
23
24#include <gal/color4d.h>
26
27
28class COLOR_SETTINGS;
29class COLOR_SWATCH;
30
31
33{
34public:
35 PANEL_COLOR_SETTINGS( wxWindow* aParent );
36
38
40 {
41 ID_COPY = wxID_HIGHEST + 1,
44 };
45
46 virtual void ResetPanel() override;
47
48 virtual wxString GetResetTooltip() const override
49 {
50 return _( "Reset all colors in this theme to the KiCad defaults" );
51 }
52
53 bool Show( bool show ) override;
54
55protected:
56 void OnBtnOpenThemeFolderClicked( wxCommandEvent& event ) override;
57
58 void OnLeftDownTheme( wxMouseEvent& event ) override;
59 void OnThemeChanged( wxCommandEvent& aEvent ) override;
60
61 void ShowColorContextMenu( wxMouseEvent& aEvent, int aLayer );
62
63 void OnColorChanged( wxCommandEvent& aEvent );
64
65 virtual void createSwatches() = 0;
66 void updateSwatches();
67
72 void createThemeList( const wxString& aCurrent );
73
74 void createSwatch( int aLayer, const wxString& aName );
75
76 void updateColor( int aLayer, const KIGFX::COLOR4D& aColor );
77
78 virtual bool saveCurrentTheme( bool aValidate );
79
85 virtual bool validateSave( bool aQuiet = false )
86 {
87 return true;
88 }
89
93 virtual void onNewThemeSelected() {}
94
98 virtual void onColorChanged() {}
99
103 wxString GetSettingsDropdownName( COLOR_SETTINGS* aSettings );
104
106
107 std::map<int, wxStaticText*> m_labels;
108 std::map<int, COLOR_SWATCH*> m_swatches;
109
111
120 std::vector<int> m_validLayers;
122
128 std::string m_colorNamespace;
129};
130
131
132#endif
Color settings are a bit different than most of the settings objects in that there can be more than o...
A simple color swatch of the kind used to set layer colors.
Definition: color_swatch.h:57
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Class PANEL_COLOR_SETTINGS_BASE.
void createThemeList(const wxString &aCurrent)
Builds the theme listbox and sets the selection to the current theme.
void createSwatch(int aLayer, const wxString &aName)
std::vector< int > m_validLayers
A list of layer IDs that are valid for the current color settings dialog.
void OnThemeChanged(wxCommandEvent &aEvent) override
virtual bool saveCurrentTheme(bool aValidate)
std::string m_colorNamespace
A namespace that will be passed to SETTINGS_MANAGER::SaveColorSettings.
virtual void ResetPanel() override
Reset the contents of this panel.
void OnBtnOpenThemeFolderClicked(wxCommandEvent &event) override
void OnColorChanged(wxCommandEvent &aEvent)
std::map< int, wxStaticText * > m_labels
virtual void onNewThemeSelected()
Event fired when a new theme is selected that can be overridden in children.
wxString GetSettingsDropdownName(COLOR_SETTINGS *aSettings)
Retrieves the drop down name to be displayed for a color setting.
virtual wxString GetResetTooltip() const override
Get the tooltip the reset button should display when showing this panel.
void updateColor(int aLayer, const KIGFX::COLOR4D &aColor)
COLOR_SETTINGS * m_currentSettings
void ShowColorContextMenu(wxMouseEvent &aEvent, int aLayer)
void OnLeftDownTheme(wxMouseEvent &event) override
bool Show(bool show) override
virtual void createSwatches()=0
virtual void onColorChanged()
Event fired when the user changes any color.
~PANEL_COLOR_SETTINGS()=default
virtual bool validateSave(bool aQuiet=false)
Performs a pre-save validation of the current color theme.
std::map< int, COLOR_SWATCH * > m_swatches
#define _(s)