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 
64 
65  // TODO(JE) Look at optimizing this out
69  void UpdateColors();
70 
72  virtual void SetHighContrastLayer( int aLayer ) override
73  {
74  SetHighContrastLayer( static_cast< PCB_LAYER_ID >( aLayer ) );
75  }
76 
78  void SetHighContrastLayer( PCB_LAYER_ID aLayer );
79 
81  virtual void SetTopLayer( int aLayer ) override
82  {
83  SetTopLayer( static_cast< PCB_LAYER_ID >( aLayer ) );
84  }
85 
87  void SetTopLayer( PCB_LAYER_ID aLayer );
88 
94  void SyncLayersVisibility( const BOARD* aBoard );
95 
97  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
98 
100  void OnShow() override;
101 
102  bool SwitchBackend( GAL_TYPE aGalType ) override;
103 
105  void RedrawRatsnest();
106 
108  BOX2I GetDefaultViewBBox() const override;
109 
110  virtual KIGFX::PCB_VIEW* GetView() const override;
111 
112 protected:
113 
115  void setDefaultLayerOrder();
116 
118  void setDefaultLayerDeps();
119 
121  std::unique_ptr<KIGFX::WS_PROXY_VIEW_ITEM> m_worksheet;
122 
124  std::unique_ptr<KIGFX::RATSNEST_VIEWITEM> m_ratsnest;
125 };
126 
127 #endif /* PCB_DRAW_PANEL_GAL_H_ */
void setDefaultLayerDeps()
Sets rendering targets & dependencies for layers.
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:175
void setDefaultLayerOrder()
Reassigns layer order to the initial settings.
The base class for create windows for drawing purpose.
void RedrawRatsnest()
Forces refresh of the ratsnest visual representation
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
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.
KIGFX::WS_PROXY_VIEW_ITEM * GetWorksheet() const
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:180
The common library.
virtual void SetTopLayer(int aLayer) override