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:
48  ~PCBNEW_CONTROL();
49 
51  void Reset( RESET_REASON aReason ) override;
52 
53  // Display modes
54  int ZoneDisplayMode( const TOOL_EVENT& aEvent );
55  int TrackDisplayMode( const TOOL_EVENT& aEvent );
56  int PadDisplayMode( const TOOL_EVENT& aEvent );
57  int ViaDisplayMode( const TOOL_EVENT& aEvent );
58  int GraphicDisplayMode( const TOOL_EVENT& aEvent );
59  int ModuleEdgeOutlines( const TOOL_EVENT& aEvent );
60  int ModuleTextOutlines( const TOOL_EVENT& aEvent );
61  int HighContrastMode( const TOOL_EVENT& aEvent );
62  int HighContrastInc( const TOOL_EVENT& aEvent );
63  int HighContrastDec( const TOOL_EVENT& aEvent );
64 
65  // Layer control
66  int LayerSwitch( const TOOL_EVENT& aEvent );
67  int LayerNext( const TOOL_EVENT& aEvent );
68  int LayerPrev( const TOOL_EVENT& aEvent );
69  int LayerToggle( const TOOL_EVENT& aEvent );
70  int LayerAlphaInc( const TOOL_EVENT& aEvent );
71  int LayerAlphaDec( 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  // UI-level access (including undo) to setting the grid origin
80  static bool SetGridOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
81  BOARD_ITEM* originViewItem, const VECTOR2D& aPoint );
82 
83  // Low-level access (below undo) to setting the grid origin
84  static bool DoSetGridOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
85  BOARD_ITEM* originViewItem, const VECTOR2D& aPoint );
86 
87  // Miscellaneous
88  int ResetCoords( const TOOL_EVENT& aEvent );
89  int SwitchCursor( const TOOL_EVENT& aEvent );
90  int SwitchUnits( const TOOL_EVENT& aEvent );
91  int DeleteItemCursor( const TOOL_EVENT& aEvent );
92  int PasteItemsFromClipboard( const TOOL_EVENT& aEvent );
93  int AppendBoardFromFile( const TOOL_EVENT& aEvent );
94  int AppendBoard( PLUGIN& pi, wxString& fileName );
95  int ShowHelp( const TOOL_EVENT& aEvent );
96  int ToBeDone( const TOOL_EVENT& aEvent );
97 
99  void setTransitions() override;
100 
101 private:
102  int placeBoardItems( BOARD* aBoard );
103 
109  int placeBoardItems( std::vector<BOARD_ITEM*>& aItems, bool aIsNew );
110 
113 
115  std::unique_ptr<KIGFX::ORIGIN_VIEWITEM> m_gridOrigin;
116 
118  void updateGrid();
119 };
120 
121 #endif
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...
Class PCBNEW_CONTROL.
PCB_BASE_FRAME * m_frame
Pointer to the currently used edit frame.
Class TOOL_EVENT.
Definition: tool_event.h:168
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_gridOrigin
Grid origin marker.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
Class PLUGIN is a base class that BOARD loading and saving plugins should derive from.
Definition: io_mgr.h:266
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:80
Class VIEW.
Definition: view.h:61
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...