KiCad PCB EDA Suite
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 <jon@craftyjon.com>
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 
28 class COLOR_SETTINGS;
29 class COLOR_SWATCH;
30 
31 
33 {
34 public:
35  PANEL_COLOR_SETTINGS( wxWindow* aParent );
36 
37  ~PANEL_COLOR_SETTINGS() = default;
38 
40  {
41  ID_COPY = wxID_HIGHEST + 1,
44  };
45 
46 protected:
47  void OnBtnOpenThemeFolderClicked( wxCommandEvent& event ) override;
48 
49  void OnBtnResetClicked( wxCommandEvent& aEvent ) override;
50 
51  void OnLeftDownTheme( wxMouseEvent& event ) override;
52  void OnThemeChanged( wxCommandEvent& aEvent ) override;
53 
54  void ShowColorContextMenu( wxMouseEvent& aEvent, int aLayer );
55 
56  void OnColorChanged( wxCommandEvent& aEvent );
57 
58  void createThemeList( const wxString& aCurrent );
59 
60  void createSwatch( int aLayer, const wxString& aName );
61 
62  void updateColor( int aLayer, const KIGFX::COLOR4D& aColor );
63 
64  virtual bool saveCurrentTheme( bool aValidate );
65 
71  virtual bool validateSave( bool aQuiet = false )
72  {
73  return true;
74  }
75 
79  virtual void onNewThemeSelected() {}
80 
84  virtual void onColorChanged() {}
85 
87 
88  std::map<int, wxStaticText*> m_labels;
89  std::map<int, COLOR_SWATCH*> m_swatches;
90 
92 
101  std::vector<int> m_validLayers;
103 
109  std::string m_colorNamespace;
110 };
111 
112 
113 #endif
virtual bool saveCurrentTheme(bool aValidate)
std::map< int, wxStaticText * > m_labels
virtual void onNewThemeSelected()
Event fired when a new theme is selected that can be overridden in children.
std::map< int, COLOR_SWATCH * > m_swatches
void updateColor(int aLayer, const KIGFX::COLOR4D &aColor)
void ShowColorContextMenu(wxMouseEvent &aEvent, int aLayer)
std::string m_colorNamespace
A namespace that will be passed to SETTINGS_MANAGER::SaveColorSettings.
Class PANEL_COLOR_SETTINGS_BASE.
void createThemeList(const wxString &aCurrent)
COLOR_SETTINGS * m_currentSettings
virtual void onColorChanged()
Event fired when the user changes any color.
PANEL_COLOR_SETTINGS(wxWindow *aParent)
std::vector< int > m_validLayers
A list of layer IDs that are valid for the current color settings dialog.
void OnBtnOpenThemeFolderClicked(wxCommandEvent &event) override
~PANEL_COLOR_SETTINGS()=default
void OnBtnResetClicked(wxCommandEvent &aEvent) override
void OnLeftDownTheme(wxMouseEvent &event) override
Class representing a simple color swatch, of the kind used to set layer colors.
Definition: color_swatch.h:38
Color settings are a bit different than most of the settings objects in that there can be more than o...
void createSwatch(int aLayer, const wxString &aName)
void OnThemeChanged(wxCommandEvent &aEvent) override
virtual bool validateSave(bool aQuiet=false)
Performs a pre-save validation of the current color theme.
void OnColorChanged(wxCommandEvent &aEvent)
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:99