KiCad PCB EDA Suite
pcb_draw_panel_gal.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) 2014 CERN
5  * @author Maciej Suminski <maciej.suminski@cern.ch>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #ifndef PCB_DRAW_PANEL_GAL_H_
26 #define PCB_DRAW_PANEL_GAL_H_
27 
28 #include <class_draw_panel_gal.h>
30 #include <pcb_view.h>
31 #include <common.h>
32 
33 namespace KIGFX
34 {
35  class WS_PROXY_VIEW_ITEM;
36  class RATSNEST_VIEWITEM;
37 }
38 
40 {
41 public:
42  PCB_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId, const wxPoint& aPosition,
43  const wxSize& aSize, KIGFX::GAL_DISPLAY_OPTIONS& aOptions,
44  GAL_TYPE aGalType = GAL_TYPE_OPENGL );
45 
46  virtual ~PCB_DRAW_PANEL_GAL();
47 
53  void DisplayBoard( BOARD* aBoard );
54 
61  void SetWorksheet( KIGFX::WS_PROXY_VIEW_ITEM* aWorksheet );
62 
63  // TODO(JE) Look at optimizing this out
67  void UpdateColors();
68 
70  virtual void SetHighContrastLayer( int aLayer ) override
71  {
72  SetHighContrastLayer( static_cast< PCB_LAYER_ID >( aLayer ) );
73  }
74 
76  void SetHighContrastLayer( PCB_LAYER_ID aLayer );
77 
79  virtual void SetTopLayer( int aLayer ) override
80  {
81  SetTopLayer( static_cast< PCB_LAYER_ID >( aLayer ) );
82  }
83 
85  void SetTopLayer( PCB_LAYER_ID aLayer );
86 
92  void SyncLayersVisibility( const BOARD* aBoard );
93 
95  void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
96 
98  void OnShow() override;
99 
100  bool SwitchBackend( GAL_TYPE aGalType ) override;
101 
103  void RedrawRatsnest();
104 
106  BOX2I GetDefaultViewBBox() const override;
107 
108  virtual KIGFX::PCB_VIEW* GetView() const override;
109 
110 protected:
111 
113  void setDefaultLayerOrder();
114 
116  void setDefaultLayerDeps();
117 
119  std::unique_ptr<KIGFX::WS_PROXY_VIEW_ITEM> m_worksheet;
120 
122  std::unique_ptr<KIGFX::RATSNEST_VIEWITEM> m_ratsnest;
123 };
124 
125 #endif /* PCB_DRAW_PANEL_GAL_H_ */
EDA_UNITS
Definition: common.h:184
void setDefaultLayerDeps()
Sets rendering targets & dependencies for layers.
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:131
void GetMsgPanelInfo(EDA_UNITS aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
void setDefaultLayerOrder()
Reassigns layer order to the initial settings.
void RedrawRatsnest()
Forces refresh of the ratsnest visual representation
std::unique_ptr< KIGFX::RATSNEST_VIEWITEM > m_ratsnest
Ratsnest view item
PCB_LAYER_ID
A quick note on layer IDs:
void DisplayBoard(BOARD *aBoard)
Function DisplayBoard adds all items from the current board to the VIEW, so they can be displayed by ...
std::unique_ptr< KIGFX::WS_PROXY_VIEW_ITEM > m_worksheet
Currently used worksheet
PCB_DRAW_PANEL_GAL(wxWindow *aParentWindow, wxWindowID aWindowId, const wxPoint &aPosition, const wxSize &aSize, KIGFX::GAL_DISPLAY_OPTIONS &aOptions, GAL_TYPE aGalType=GAL_TYPE_OPENGL)
void SyncLayersVisibility(const BOARD *aBoard)
Function SyncLayersVisibility Updates "visibility" property of each layer of a given BOARD.
virtual KIGFX::PCB_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
BOX2I GetDefaultViewBBox() const override
void UpdateColors()
Updates the color settings in the painter and GAL.
virtual void SetHighContrastLayer(int aLayer) override
bool SwitchBackend(GAL_TYPE aGalType) override
Function SwitchBackend Switches method of rendering graphics.
void SetWorksheet(KIGFX::WS_PROXY_VIEW_ITEM *aWorksheet)
Function SetWorksheet Sets (or updates) worksheet used by the draw panel.
Board layer functions and definitions.
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:163
The common library.
virtual void SetTopLayer(int aLayer) override