KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Maciej Suminski <[email protected]>
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, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef PCB_DRAW_PANEL_GAL_H_
24#define PCB_DRAW_PANEL_GAL_H_
25
27#include <layer_ids.h>
28#include <pcb_view.h>
29
34
38
42
44{
45public:
46 PCB_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId, const wxPoint& aPosition,
47 const wxSize& aSize, KIGFX::GAL_DISPLAY_OPTIONS& aOptions,
48 GAL_TYPE aGalType = GAL_TYPE_MODERN );
49
50 virtual ~PCB_DRAW_PANEL_GAL();
51
58 void DisplayBoard( BOARD* aBoard, PROGRESS_REPORTER* aReporter = nullptr );
59
66 void SetDrawingSheet( DS_PROXY_VIEW_ITEM* aDrawingSheet );
67
69
70 // TODO(JE) Look at optimizing this out
74 void UpdateColors();
75
79 void prepareGridSources() override;
80
82 virtual void SetHighContrastLayer( int aLayer ) override
83 {
84 SetHighContrastLayer( static_cast< PCB_LAYER_ID >( aLayer ) );
85 }
86
89
95
97 virtual void SetTopLayer( int aLayer ) override
98 {
99 SetTopLayer( static_cast< PCB_LAYER_ID >( aLayer ) );
100 }
101
103 void SetTopLayer( PCB_LAYER_ID aLayer );
104
110 void SyncLayersVisibility( const BOARD* aBoard );
111
120 static void SyncLayersVisibility( KIGFX::VIEW& aView, const BOARD* aBoard, PCB_LAYER_ID aActiveLayer );
121
123 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
124
126 void OnShow() override;
127
128 bool SwitchBackend( GAL_TYPE aGalType ) override;
129
131 void RedrawRatsnest();
132
134 BOX2I GetDefaultViewBBox() const override;
135
136 virtual KIGFX::PCB_VIEW* GetView() const override;
137
138protected:
141
143 void setDefaultLayerDeps();
144
150
154 void applyHighContrastLayer( PCB_LAYER_ID aLayer, bool aOnlyLayerChanged );
155
159 void addRatsnest( std::shared_ptr<CONNECTIVITY_DATA> aConnectivity );
160
161 void beforeRedraw() override;
162
163protected:
164 std::unique_ptr<DS_PROXY_VIEW_ITEM> m_drawingSheet;
165
168
171 std::unique_ptr<RATSNEST_VIEW_ITEM> m_ratsnest;
172 std::unique_ptr<RATSNEST_VIEW_ITEM> m_localRatsnest;
173};
174
175#endif /* PCB_DRAW_PANEL_GAL_H_ */
BOX2< VECTOR2I > BOX2I
Definition box2.h:917
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:411
The base class for create windows for drawing purpose.
EDA_DRAW_PANEL_GAL(wxWindow *aParentWindow, wxWindowID aWindowId, const wxPoint &aPosition, const wxSize &aSize, KIGFX::GAL_DISPLAY_OPTIONS &aOptions, GAL_TYPE aGalType=GAL_TYPE_OPENGL)
Create a drawing panel that is contained inside aParentWindow.
@ GAL_TYPE_MODERN
RHI implementation, Vulkan or Metal on macOS.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:68
void ChangeHighContrastLayer(PCB_LAYER_ID aLayer)
Follow an active layer change when nothing else that colours items has changed.
void UpdateColors()
Update the color settings in the painter and GAL.
void updateCanvasFadedLayers()
Let a retained scene apply the high contrast dim of cached layers whose dim does not depend on the it...
std::unique_ptr< RATSNEST_VIEW_ITEM > m_localRatsnest
Moving items' part, when split off.
BOX2I GetDefaultViewBBox() const override
Return the bounding box of the view that should be used if model is not valid.
virtual void SetTopLayer(int aLayer) override
Move the selected layer to the top, so it is displayed above all others.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
std::unique_ptr< RATSNEST_VIEW_ITEM > m_ratsnest
Ratsnest view item.
DS_PROXY_VIEW_ITEM * GetDrawingSheet() const
void applyHighContrastLayer(PCB_LAYER_ID aLayer, bool aOnlyLayerChanged)
Make aLayer the high contrast layer.
void SetDrawingSheet(DS_PROXY_VIEW_ITEM *aDrawingSheet)
Set or update drawing-sheet used by the draw panel.
void setDefaultLayerDeps()
Set rendering targets & dependencies for layers.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the KIGFX::VIEW instance used in the panel.
void beforeRedraw() override
Hook for subclasses to update view items whose inputs nothing else tracks.
void OnShow() override
Called when the window is shown for the first time.
void DisplayBoard(BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr)
Add all items from the current board to the VIEW, so they can be displayed by GAL.
void SyncLayersVisibility(const BOARD *aBoard)
Update "visibility" property of each layer of a given BOARD.
bool m_highContrastShown
High contrast was on at the last recolour, so the next one may bring items back.
void setDefaultLayerOrder()
Reassign layer order to the initial settings.
PCB_DRAW_PANEL_GAL(wxWindow *aParentWindow, wxWindowID aWindowId, const wxPoint &aPosition, const wxSize &aSize, KIGFX::GAL_DISPLAY_OPTIONS &aOptions, GAL_TYPE aGalType=GAL_TYPE_MODERN)
bool m_highContrastHidden
High contrast hid inactive layers at the last recolour, which the canvas cannot fade away.
virtual void SetHighContrastLayer(int aLayer) override
Take care of display settings for the given layer to be displayed in high contrast mode.
void addRatsnest(std::shared_ptr< CONNECTIVITY_DATA > aConnectivity)
Add the ratsnest items the current canvas needs.
std::unique_ptr< DS_PROXY_VIEW_ITEM > m_drawingSheet
Currently used drawing-sheet.
bool SwitchBackend(GAL_TYPE aGalType) override
Switch method of rendering graphics.
void RedrawRatsnest()
Force refresh of the ratsnest visual representation.
void prepareGridSources() override
Push a GRID_SOURCE for every PCB_GRIDITEM on the board to the GAL.
A progress reporter interface for use in multi-threaded environments.
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
void ApplyPcbGalLayerDeps(KIGFX::VIEW *aView)
Make pcbnew's derived layers (pad copper, zones, holes, netnames) follow their board layer's visibili...
void ApplyPcbGalLayerOrder(KIGFX::VIEW *aView)
Apply pcbnew's canonical GAL layer order (copper and zones below silk, fab and courtyard) to any view...