KiCad PCB EDA Suite
class_pcb_layer_widget.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) 2004-2015 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr
5  * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 2010-2015 KiCad Developers, see change_log.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 
27 /************************************************************/
28 /* class_pcb_layer_widget.h : header for the layers manager */
29 /************************************************************/
30 
31 #ifndef CLASS_PCB_LAYER_WIDGET_H_
32 #define CLASS_PCB_LAYER_WIDGET_H_
33 
34 #include <layer_widget.h>
35 
43 {
44 public:
45 
57  PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner,
58  int aPointSize = 10, bool aFpEditorMode = false );
59 
60  void ReFill();
61 
66  void ReFillRender();
67 
73  void SyncRenderStates();
74 
81  void SyncLayerVisibilities();
82 
89 
90  //-----<implement LAYER_WIDGET abstract callback functions>-----------
91  void OnLayerColorChange( int aLayer, COLOR4D aColor ) override;
92  bool OnLayerSelect( int aLayer ) override;
93  void OnLayerVisible( int aLayer, bool isVisible, bool isFinal ) override;
94  void OnRenderColorChange( int aId, COLOR4D aColor ) override;
95  void OnRenderEnable( int aId, bool isEnabled ) override;
96  //-----</implement LAYER_WIDGET abstract callback functions>----------
97 
106  bool OnLayerSelected(); // postprocess after an active layer selection
107  // ensure active layer visible if
108  // m_alwaysShowActiveCopperLayer is true;
109 
110 
111 protected:
112 
114  bool m_alwaysShowActiveCopperLayer; // If true: Only shows the current active layer
115  // even if it is changed
117 
119 
120  // popup menu ids.
121 #define ID_SHOW_ALL_COPPER_LAYERS wxID_HIGHEST
122 #define ID_SHOW_NO_COPPER_LAYERS (wxID_HIGHEST+1)
123 #define ID_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE (wxID_HIGHEST+2)
124 #define ID_ALWAYS_SHOW_NO_COPPER_LAYERS_BUT_ACTIVE (wxID_HIGHEST+3)
125 #define ID_SHOW_NO_LAYERS (wxID_HIGHEST+4)
126 #define ID_SHOW_ALL_LAYERS (wxID_HIGHEST+5)
127 
128  virtual bool AreArbitraryColorsAllowed() override;
129 
135  bool isAllowedInFpMode( int aId );
136 
147  bool isLayerAllowedInFpMode( LAYER_ID aLayer );
148 
153  void onRightDownLayers( wxMouseEvent& event );
154 
155  void onPopupSelection( wxCommandEvent& event );
156 
160 };
161 
162 #endif // CLASS_PCB_LAYER_WIDGET_H_
Struct ROW provides all the data needed to add a row to a LAYER_WIDGET.
Definition: layer_widget.h:84
bool OnLayerSelect(int aLayer) override
Function OnLayerSelect is called to notify client code whenever the user selects a different layer...
Class PCB_LAYER_WIDGET is here to implement the abstract functions of LAYER_WIDGET so they may be tie...
PCB_BASE_FRAME * myframe
bool OnLayerSelected()
Function OnLayerSelected ensure the active layer is visible, and other layers not visible when m_alwa...
void SetLayersManagerTabsText()
Function SetLayersManagerTabsText Update the layer manager tabs labels Useful when changing Language ...
bool isAllowedInFpMode(int aId)
Function isAllowedInFpMode.
bool isLayerAllowedInFpMode(LAYER_ID aLayer)
Function isLayerAllowedInFpMode.
void OnLayerColorChange(int aLayer, COLOR4D aColor) override
Function OnLayerColorChange is called to notify client code about a layer color change.
PCB_LAYER_WIDGET(PCB_BASE_FRAME *aParent, wxWindow *aFocusOwner, int aPointSize=10, bool aFpEditorMode=false)
Constructor.
void ReFillRender()
Function ReFillRender rebuilds Render for instance after the config is read.
void onRightDownLayers(wxMouseEvent &event)
Function OnRightDownLayers puts up a popup menu for the layer panel.
static const LAYER_WIDGET::ROW s_render_rows[]
This is a read only template that is copied and modified before adding to LAYER_WIDGET.
void OnRenderColorChange(int aId, COLOR4D aColor) override
Function OnRenderColorChange is called to notify client code whenever the user changes a rendering co...
void OnLayerVisible(int aLayer, bool isVisible, bool isFinal) override
Function OnLayerVisible is called to notify client code about a layer visibility change.
Class LAYER_WIDGET is abstract and is used to manage a list of layers, with the notion of a "current"...
Definition: layer_widget.h:76
void SyncLayerVisibilities()
Function SyncLayerVisibilities updates each "Layer" checkbox in this layer widget according to each l...
virtual bool AreArbitraryColorsAllowed() override
Subclasses can override this to provide logic for allowing arbitrary color selection via wxColourPick...
LAYER_ID
Enum LAYER_ID is the set of PCB layers.
void installRightLayerClickHandler()
this is for the popup menu, the right click handler has to be installed on every child control within...
void OnRenderEnable(int aId, bool isEnabled) override
Function OnRenderEnable is called to notify client code whenever the user changes an rendering enable...
void SyncRenderStates()
Function SyncRenderStates updates the checkboxes (checked or not) to be consistent with the current s...
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
void onPopupSelection(wxCommandEvent &event)
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39