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.h>
31 
32 namespace KIGFX {
33  class ORIGIN_VIEWITEM;
34 }
35 
36 class PCB_BASE_FRAME;
37 class BOARD_ITEM;
44 class PCBNEW_CONTROL : public PCB_TOOL
45 {
46 public:
49 
51  void Reset( RESET_REASON aReason ) override;
52 
53  // Display modes
54  int TrackDisplayMode( const TOOL_EVENT& aEvent );
55  int PadDisplayMode( const TOOL_EVENT& aEvent );
56  int ViaDisplayMode( const TOOL_EVENT& aEvent );
57  int ZoneDisplayMode( const TOOL_EVENT& aEvent );
58  int HighContrastMode( const TOOL_EVENT& aEvent );
59  int HighContrastInc( const TOOL_EVENT& aEvent );
60  int HighContrastDec( const TOOL_EVENT& aEvent );
61 
62  // Layer control
63  int LayerSwitch( const TOOL_EVENT& aEvent );
64  int LayerNext( const TOOL_EVENT& aEvent );
65  int LayerPrev( const TOOL_EVENT& aEvent );
66  int LayerToggle( const TOOL_EVENT& aEvent );
67  int LayerAlphaInc( const TOOL_EVENT& aEvent );
68  int LayerAlphaDec( const TOOL_EVENT& aEvent );
69 
70  int CursorControl( const TOOL_EVENT& aEvent );
71  int PanControl( const TOOL_EVENT& aEvent );
72 
73  // Grid control
74  int GridFast1( const TOOL_EVENT& aEvent );
75  int GridFast2( const TOOL_EVENT& aEvent );
76  int GridSetOrigin( const TOOL_EVENT& aEvent );
77  int GridResetOrigin( const TOOL_EVENT& aEvent );
78 
79  // Miscellaneous
80  int ResetCoords( const TOOL_EVENT& aEvent );
81  int SwitchCursor( const TOOL_EVENT& aEvent );
82  int SwitchUnits( const TOOL_EVENT& aEvent );
83  int DeleteItemCursor( const TOOL_EVENT& aEvent );
84  int PasteItemsFromClipboard( const TOOL_EVENT& aEvent );
85  int AppendBoardFromFile( const TOOL_EVENT& aEvent );
86  int AppendBoard( PLUGIN& pi, wxString& fileName );
87  int ShowHelp( const TOOL_EVENT& aEvent );
88  int ToBeDone( const TOOL_EVENT& aEvent );
89 
91  void setTransitions() override;
92 
93 private:
94  int placeBoardItems( BOARD* aBoard );
95  int placeBoardItems( std::vector<BOARD_ITEM*>& aItems );
96 
99 
101  std::unique_ptr<KIGFX::ORIGIN_VIEWITEM> m_gridOrigin;
102 
104  void updateGrid();
105 };
106 
107 #endif
int SwitchCursor(const TOOL_EVENT &aEvent)
int PanControl(const TOOL_EVENT &aEvent)
int PadDisplayMode(const TOOL_EVENT &aEvent)
int HighContrastInc(const TOOL_EVENT &aEvent)
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:58
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
int LayerAlphaInc(const TOOL_EVENT &aEvent)
int HighContrastMode(const TOOL_EVENT &aEvent)
int LayerPrev(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)
Class TOOL_EVENT.
Definition: tool_event.h:162
int LayerToggle(const TOOL_EVENT &aEvent)
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)
void Reset(RESET_REASON aReason) override
Function Reset() Brings the tool to a known, initial state.
int ResetCoords(const TOOL_EVENT &aEvent)
int ShowHelp(const TOOL_EVENT &aEvent)
int LayerAlphaDec(const TOOL_EVENT &aEvent)
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
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:193
int TrackDisplayMode(const TOOL_EVENT &aEvent)
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:80
int SwitchUnits(const TOOL_EVENT &aEvent)
int DeleteItemCursor(const TOOL_EVENT &aEvent)
int CursorControl(const TOOL_EVENT &aEvent)
int GridFast2(const TOOL_EVENT &aEvent)
int ToBeDone(const TOOL_EVENT &aEvent)
int LayerSwitch(const TOOL_EVENT &aEvent)
void updateGrid()
Applies the legacy canvas grid settings for GAL.
int AppendBoard(PLUGIN &pi, wxString &fileName)
int PasteItemsFromClipboard(const TOOL_EVENT &aEvent)
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
int HighContrastDec(const TOOL_EVENT &aEvent)