KiCad PCB EDA Suite
pcbnew_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  * @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 PCBNEW_CONTROL_H
26 #define PCBNEW_CONTROL_H
27 
28 #include <io_mgr.h>
29 #include <memory>
30 #include <tools/pcb_tool_base.h>
31 
32 namespace KIGFX {
33  class ORIGIN_VIEWITEM;
34 }
35 
36 class PCB_BASE_FRAME;
37 class BOARD_ITEM;
45 {
46 public:
49 
51  void Reset( RESET_REASON aReason ) override;
52 
53  int AddLibrary( const TOOL_EVENT& aEvent );
54  int Print( const TOOL_EVENT& aEvent );
55  int Quit( const TOOL_EVENT& aEvent );
56 
57  // Display modes
58  int ToggleRatsnest( const TOOL_EVENT& aEvent );
59  int ZoneDisplayMode( const TOOL_EVENT& aEvent );
60  int TrackDisplayMode( const TOOL_EVENT& aEvent );
61  int PadDisplayMode( const TOOL_EVENT& aEvent );
62  int ViaDisplayMode( const TOOL_EVENT& aEvent );
63  int GraphicDisplayMode( const TOOL_EVENT& aEvent );
64  int ModuleEdgeOutlines( const TOOL_EVENT& aEvent );
65  int HighContrastMode( const TOOL_EVENT& aEvent );
66 
67  // Layer control
68  int LayerSwitch( const TOOL_EVENT& aEvent );
69  int LayerNext( const TOOL_EVENT& aEvent );
70  int LayerPrev( const TOOL_EVENT& aEvent );
71  int LayerToggle( const TOOL_EVENT& aEvent );
72  int LayerAlphaInc( const TOOL_EVENT& aEvent );
73  int LayerAlphaDec( const TOOL_EVENT& aEvent );
74 
75  // Grid control
76  int GridFast1( const TOOL_EVENT& aEvent );
77  int GridFast2( const TOOL_EVENT& aEvent );
78  int GridSetOrigin( const TOOL_EVENT& aEvent );
79  int GridResetOrigin( const TOOL_EVENT& aEvent );
80 
81  // Low-level access (below undo) to setting the grid origin
82  static void DoSetGridOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
83  BOARD_ITEM* originViewItem, const VECTOR2D& aPoint );
84 
85  int Undo( const TOOL_EVENT& aEvent );
86  int Redo( const TOOL_EVENT& aEvent );
87 
88  // Miscellaneous
89  int DeleteItemCursor( const TOOL_EVENT& aEvent );
90  int Paste( const TOOL_EVENT& aEvent );
91  int AppendBoardFromFile( const TOOL_EVENT& aEvent );
92  int AppendBoard( PLUGIN& pi, wxString& fileName );
93  int Show3DViewer( const TOOL_EVENT& aEvent );
94  int UpdateMessagePanel( const TOOL_EVENT& aEvent );
95 
97  void setTransitions() override;
98 
99 private:
100  int placeBoardItems( BOARD* aBoard );
101 
107  int placeBoardItems( std::vector<BOARD_ITEM*>& aItems, bool aIsNew );
108 
111 
113  std::unique_ptr<KIGFX::ORIGIN_VIEWITEM> m_gridOrigin;
114 
116 
118  void updateGrid();
119 };
120 
121 #endif
static void DoSetGridOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, BOARD_ITEM *originViewItem, const VECTOR2D &aPoint)
int PadDisplayMode(const TOOL_EVENT &aEvent)
int ToggleRatsnest(const TOOL_EVENT &aEvent)
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:57
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
int AddLibrary(const TOOL_EVENT &aEvent)
int LayerAlphaInc(const TOOL_EVENT &aEvent)
int Quit(const TOOL_EVENT &aEvent)
int HighContrastMode(const TOOL_EVENT &aEvent)
int ModuleEdgeOutlines(const TOOL_EVENT &aEvent)
int LayerPrev(const TOOL_EVENT &aEvent)
int Paste(const TOOL_EVENT &aEvent)
int GridSetOrigin(const TOOL_EVENT &aEvent)
void setTransitions() override
Sets up handlers for various events.
int LayerNext(const TOOL_EVENT &aEvent)
Class PCBNEW_CONTROL.
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
int GridResetOrigin(const TOOL_EVENT &aEvent)
int GraphicDisplayMode(const TOOL_EVENT &aEvent)
Class TOOL_EVENT.
Definition: tool_event.h:168
int Show3DViewer(const TOOL_EVENT &aEvent)
int LayerToggle(const TOOL_EVENT &aEvent)
BOARD_ITEM * m_pickerItem
int ZoneDisplayMode(const TOOL_EVENT &aEvent)
int GridFast1(const TOOL_EVENT &aEvent)
int placeBoardItems(BOARD *aBoard)
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
Grid origin marker.
int AppendBoardFromFile(const TOOL_EVENT &aEvent)
int Redo(const TOOL_EVENT &aEvent)
void Reset(RESET_REASON aReason) override
Function Reset() Brings the tool to a known, initial state.
int LayerAlphaDec(const TOOL_EVENT &aEvent)
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:161
int ViaDisplayMode(const TOOL_EVENT &aEvent)
Class PLUGIN is a base class that BOARD loading and saving plugins should derive from.
Definition: io_mgr.h:271
int TrackDisplayMode(const TOOL_EVENT &aEvent)
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:79
int DeleteItemCursor(const TOOL_EVENT &aEvent)
int Undo(const TOOL_EVENT &aEvent)
int GridFast2(const TOOL_EVENT &aEvent)
Class VIEW.
Definition: view.h:61
int LayerSwitch(const TOOL_EVENT &aEvent)
int UpdateMessagePanel(const TOOL_EVENT &aEvent)
void updateGrid()
Applies the legacy canvas grid settings for GAL.
int AppendBoard(PLUGIN &pi, wxString &fileName)
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
int Print(const TOOL_EVENT &aEvent)