KiCad PCB EDA Suite
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, jp.charras at wanadoo.fr
5  * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 2010-2018 KiCad Developers, see cAUTHORS.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 /* pcb_layer_widget.h : header for the layers manager */
29 /************************************************************/
30 
31 #ifndef PCB_LAYER_WIDGET_H
32 #define PCB_LAYER_WIDGET_H
33 
34 #include <layer_widget.h>
35 
43 {
44 public:
45 
54  PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner, bool aFpEditorMode = false );
55 
56  void ReFill();
57 
62  void ReFillRender();
63 
70  void SyncLayerVisibilities();
71 
78 
82  void SyncLayerColors();
83 
90 
91  //-----<implement LAYER_WIDGET abstract callback functions>-----------
92  void OnLayerColorChange( int aLayer, COLOR4D aColor ) override;
93  bool OnLayerSelect( int aLayer ) override;
94  void OnLayerVisible( int aLayer, bool isVisible, bool isFinal ) override;
95  void OnLayerRightClick( wxMenu& aMenu ) override;
96  void OnRenderColorChange( int aId, COLOR4D aColor ) override;
97  void OnRenderEnable( int aId, bool isEnabled ) override;
98  //-----</implement LAYER_WIDGET abstract callback functions>----------
99 
108  bool OnLayerSelected(); // postprocess after an active layer selection
109  // ensure active layer visible if
110  // m_alwaysShowActiveCopperLayer is true;
111 
117  void AddRightClickMenuItems( wxMenu& menu );
118 
119 
120 protected:
121 
123  bool m_alwaysShowActiveCopperLayer; // If true: Only shows the current active layer
124  // even if it is changed
126 
128 
129  // popup menu ids.
130  enum POPUP_ID
131  {
146  };
147 
148  virtual COLOR4D getBackgroundLayerColor() override;
149 
155  bool isAllowedInFpMode( int aId );
156 
167  bool isLayerAllowedInFpMode( PCB_LAYER_ID aLayer );
168 
173  void onRightDownLayers( wxMouseEvent& event );
174 
175  void onPopupSelection( wxCommandEvent& event );
176 
180 };
181 
182 #endif // 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:87
bool OnLayerSelect(int aLayer) override
Function OnLayerSelect is called to notify client code whenever the user selects a different layer.
PCB_LAYER_WIDGET is here to implement the abstract functions of LAYER_WIDGET so they may be tied into...
bool isLayerAllowedInFpMode(PCB_LAYER_ID aLayer)
Function isLayerAllowedInFpMode.
PCB_BASE_FRAME * myframe
virtual COLOR4D getBackgroundLayerColor() override
Subclasses can override this to provide accurate representation of transparent colour swatches.
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.
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.
void SyncLayerColors()
Updates the color for each layer and item from the active color theme.
void SyncLayerAlphaIndicators()
Function SyncLayerAlphaIndicators updates each "Layer"s alpha indicator to show if the board is curre...
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...
bool m_alwaysShowActiveCopperLayer
void OnLayerVisible(int aLayer, bool isVisible, bool isFinal) override
Function OnLayerVisible is called to notify client code about a layer visibility change.
LAYER_WIDGET is abstract and is used to manage a list of layers, with the notion of a "current" layer...
Definition: layer_widget.h:79
void SyncLayerVisibilities()
Function SyncLayerVisibilities updates each "Layer" checkbox in this layer widget according to each l...
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...
PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void onPopupSelection(wxCommandEvent &event)
PCB_LAYER_WIDGET(PCB_BASE_FRAME *aParent, wxWindow *aFocusOwner, bool aFpEditorMode=false)
Constructor.
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:99