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  * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * @author Maciej Suminski <maciej.suminski@cern.ch>
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, you may find one here:
21  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22  * or you may search the http://www.gnu.org website for the version 2 license,
23  * or you may write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  */
26 
27 #ifndef PCB_DRAW_PANEL_GAL_H_
28 #define PCB_DRAW_PANEL_GAL_H_
29 
30 #include <class_draw_panel_gal.h>
32 #include <pcb_view.h>
33 
34 class DS_PROXY_VIEW_ITEM;
35 class RATSNEST_VIEW_ITEM;
36 
38 {
39 public:
40  PCB_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId, const wxPoint& aPosition,
41  const wxSize& aSize, KIGFX::GAL_DISPLAY_OPTIONS& aOptions,
42  GAL_TYPE aGalType = GAL_TYPE_OPENGL );
43 
44  virtual ~PCB_DRAW_PANEL_GAL();
45 
51  void DisplayBoard( BOARD* aBoard );
52 
59  void SetDrawingSheet( DS_PROXY_VIEW_ITEM* aDrawingSheet );
60 
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_DRAW_FRAME* aFrame, 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:
112  void setDefaultLayerOrder();
113 
115  void setDefaultLayerDeps();
116 
118  std::unique_ptr<DS_PROXY_VIEW_ITEM> m_drawingSheet;
119 
121  std::unique_ptr<RATSNEST_VIEW_ITEM> m_ratsnest;
122 };
123 
124 #endif /* PCB_DRAW_PANEL_GAL_H_ */
void setDefaultLayerDeps()
Currently used drawing-sheet.
void setDefaultLayerOrder()
< Reassign layer order to the initial settings.
The base class for create windows for drawing purpose.
void RedrawRatsnest()
Return the bounding box of the view that should be used if model is not valid.
DS_PROXY_VIEW_ITEM * GetDrawingSheet() const
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Called when the window is shown for the first time.
std::unique_ptr< DS_PROXY_VIEW_ITEM > m_drawingSheet
Ratsnest view item.
PCB_LAYER_ID
A quick note on layer IDs:
void DisplayBoard(BOARD *aBoard)
Add all items from the current board to the VIEW, so they can be displayed by GAL.
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)
Update "visibility" property of each layer of a given BOARD.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
BOX2I GetDefaultViewBBox() const override
Return the bounding box of the view that should be used if model is not valid.
void UpdateColors()
Update the color settings in the painter and GAL.
virtual void SetHighContrastLayer(int aLayer) override
SetHighContrastLayer(), with some extra smarts for PCB.
bool SwitchBackend(GAL_TYPE aGalType) override
Force refresh of the ratsnest visual representation.
Board layer functions and definitions.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
virtual void SetTopLayer(int aLayer) override
SetTopLayer(), with some extra smarts for PCB.
void OnShow() override
Called when the window is shown for the first time.
std::unique_ptr< RATSNEST_VIEW_ITEM > m_ratsnest
void SetDrawingSheet(DS_PROXY_VIEW_ITEM *aDrawingSheet)
Sets (or updates) drawing-sheet used by the draw panel.