KiCad PCB EDA Suite
pcb_control.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-2016 CERN
5 * Copyright (C) 2021 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, 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_CONTROL_H
28#define PCB_CONTROL_H
29
30#include <io_mgr.h>
31#include <memory>
32#include <tools/pcb_tool_base.h>
33#include <status_popup.h>
34
35namespace KIGFX {
36 class ORIGIN_VIEWITEM;
37}
38
39class PCB_BASE_FRAME;
40class BOARD_ITEM;
41
47{
48public:
51
53 void Reset( RESET_REASON aReason ) override;
54
55 int AddLibrary( const TOOL_EVENT& aEvent );
56 int Print( const TOOL_EVENT& aEvent );
57 int Quit( const TOOL_EVENT& aEvent );
58
59 // Display modes
60 int ToggleRatsnest( const TOOL_EVENT& aEvent );
61 int ZoneDisplayMode( const TOOL_EVENT& aEvent );
62 int TrackDisplayMode( const TOOL_EVENT& aEvent );
63 int ViaDisplayMode( const TOOL_EVENT& aEvent );
64
65 // Update the view with the new high-contrast mode from the display settings
66 int HighContrastMode( const TOOL_EVENT& aEvent );
67
68 // Rotate through the available high-contrast, net color and ratsnest color modes
69 int HighContrastModeCycle( const TOOL_EVENT& aEvent );
70 int NetColorModeCycle( const TOOL_EVENT& aEvent );
71 int RatsnestModeCycle( const TOOL_EVENT& aEvent );
72
73 // Layer control
74 int LayerSwitch( const TOOL_EVENT& aEvent );
75 int LayerNext( const TOOL_EVENT& aEvent );
76 int LayerPrev( const TOOL_EVENT& aEvent );
77 int LayerToggle( const TOOL_EVENT& aEvent );
78 int LayerAlphaInc( const TOOL_EVENT& aEvent );
79 int LayerAlphaDec( const TOOL_EVENT& aEvent );
80
81 // Grid control
82 int GridSetOrigin( const TOOL_EVENT& aEvent );
83 int GridResetOrigin( const TOOL_EVENT& aEvent );
84
85 // Low-level access (below undo) to setting the grid origin
86 static void DoSetGridOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
87 EDA_ITEM* originViewItem, const VECTOR2D& aPoint );
88
89 int Undo( const TOOL_EVENT& aEvent );
90 int Redo( const TOOL_EVENT& aEvent );
91
92 // Miscellaneous
93 int DeleteItemCursor( const TOOL_EVENT& aEvent );
94 int Paste( const TOOL_EVENT& aEvent );
95 int AppendBoardFromFile( const TOOL_EVENT& aEvent );
96 int AppendBoard( PLUGIN& pi, wxString& fileName );
97 int UpdateMessagePanel( const TOOL_EVENT& aEvent );
98
99 int FlipPcbView( const TOOL_EVENT& aEvent );
100
101private:
103 void setTransitions() override;
104
110 void unfilledZoneCheck();
111
123 int placeBoardItems( std::vector<BOARD_ITEM*>& aItems, bool aIsNew, bool aAnchorAtOrigin,
124 bool aReannotateDuplicates );
125
126 int placeBoardItems( BOARD* aBoard, bool aAnchorAtOrigin, bool aReannotateDuplicates );
127
130
132 std::unique_ptr<KIGFX::ORIGIN_VIEWITEM> m_gridOrigin;
133
135
136 std::unique_ptr<STATUS_TEXT_POPUP> m_statusPopup;
137};
138
139#endif
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:53
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:240
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:69
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
Handle actions that are shared between different frames in PcbNew.
Definition: pcb_control.h:47
int AppendBoard(PLUGIN &pi, wxString &fileName)
void setTransitions() override
< Sets up handlers for various events.
int AppendBoardFromFile(const TOOL_EVENT &aEvent)
int AddLibrary(const TOOL_EVENT &aEvent)
int placeBoardItems(std::vector< BOARD_ITEM * > &aItems, bool aIsNew, bool aAnchorAtOrigin, bool aReannotateDuplicates)
Add and select or just select for move/place command a list of board items.
int NetColorModeCycle(const TOOL_EVENT &aEvent)
int RatsnestModeCycle(const TOOL_EVENT &aEvent)
int TrackDisplayMode(const TOOL_EVENT &aEvent)
int Redo(const TOOL_EVENT &aEvent)
int UpdateMessagePanel(const TOOL_EVENT &aEvent)
int LayerAlphaDec(const TOOL_EVENT &aEvent)
int LayerNext(const TOOL_EVENT &aEvent)
std::unique_ptr< STATUS_TEXT_POPUP > m_statusPopup
Definition: pcb_control.h:136
int ToggleRatsnest(const TOOL_EVENT &aEvent)
int LayerAlphaInc(const TOOL_EVENT &aEvent)
int HighContrastModeCycle(const TOOL_EVENT &aEvent)
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
Definition: pcb_control.h:132
int Quit(const TOOL_EVENT &aEvent)
int HighContrastMode(const TOOL_EVENT &aEvent)
int Undo(const TOOL_EVENT &aEvent)
int ViaDisplayMode(const TOOL_EVENT &aEvent)
PCB_BASE_FRAME * m_frame
Grid origin marker.
Definition: pcb_control.h:129
int GridSetOrigin(const TOOL_EVENT &aEvent)
static void DoSetGridOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, EDA_ITEM *originViewItem, const VECTOR2D &aPoint)
int FlipPcbView(const TOOL_EVENT &aEvent)
int LayerToggle(const TOOL_EVENT &aEvent)
void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
Definition: pcb_control.cpp:86
int DeleteItemCursor(const TOOL_EVENT &aEvent)
int Print(const TOOL_EVENT &aEvent)
int ZoneDisplayMode(const TOOL_EVENT &aEvent)
int GridResetOrigin(const TOOL_EVENT &aEvent)
BOARD_ITEM * m_pickerItem
Definition: pcb_control.h:134
int LayerPrev(const TOOL_EVENT &aEvent)
int Paste(const TOOL_EVENT &aEvent)
void unfilledZoneCheck()
We have bug reports indicating that some new users confuse zone filling/unfilling with the display mo...
int LayerSwitch(const TOOL_EVENT &aEvent)
A base class that BOARD loading and saving plugins should derive from.
Definition: io_mgr.h:270
RESET_REASON
Determine the reason of reset for a tool.
Definition: tool_base.h:78
Generic, UI-independent tool event.
Definition: tool_event.h:155
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:243