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 OnLayerRightClick( wxMenu& aMenu ) override;
95  void OnRenderColorChange( int aId, COLOR4D aColor ) override;
96  void OnRenderEnable( int aId, bool isEnabled ) override;
97  //-----</implement LAYER_WIDGET abstract callback functions>----------
98 
107  bool OnLayerSelected(); // postprocess after an active layer selection
108  // ensure active layer visible if
109  // m_alwaysShowActiveCopperLayer is true;
110 
116  void AddRightClickMenuItems( wxMenu& menu );
117 
118 
119 protected:
120 
122  bool m_alwaysShowActiveCopperLayer; // If true: Only shows the current active layer
123  // even if it is changed
125 
127 
128  // popup menu ids.
129  enum POPUP_ID
130  {
142  };
143 
144  virtual bool AreArbitraryColorsAllowed() override;
145 
151  bool isAllowedInFpMode( int aId );
152 
163  bool isLayerAllowedInFpMode( PCB_LAYER_ID aLayer );
164 
169  void onRightDownLayers( wxMouseEvent& event );
170 
171  void onPopupSelection( wxCommandEvent& event );
172 
176 };
177 
178 #endif // CLASS_PCB_LAYER_WIDGET_H_
void AddRightClickMenuItems(wxMenu &menu)
Function addRightClickMenuItems add menu items to a menu that should be shown when right-clicking the...
Struct ROW provides all the data needed to add a row to a LAYER_WIDGET.
Definition: layer_widget.h:85
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...
bool isLayerAllowedInFpMode(PCB_LAYER_ID aLayer)
Function isLayerAllowedInFpMode.
PCB_BASE_FRAME * myframe
bool OnLayerSelected()
Function OnLayerSelected ensure the active layer is visible, and other layers not visible when m_alwa...
void OnLayerRightClick(wxMenu &aMenu) override
Function OnLayerRightClick is called to notify client code about a layer being right-clicked.
void SetLayersManagerTabsText()
Function SetLayersManagerTabsText Update the layer manager tabs labels Useful when changing Language ...
PCB_LAYER_ID
A quick note on layer IDs:
bool isAllowedInFpMode(int aId)
Function isAllowedInFpMode.
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:77
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...
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