KiCad PCB EDA Suite
pcb_editor_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 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 PCB_EDITOR_CONTROL_H
26 #define PCB_EDITOR_CONTROL_H
27 
28 #include <tools/pcb_tool_base.h>
29 #include <tool/tool_menu.h>
30 
31 namespace KIGFX {
32  class ORIGIN_VIEWITEM;
33 }
34 
35 class PCB_EDIT_FRAME;
36 
43 {
44 public:
47 
49  void Reset( RESET_REASON aReason ) override;
50 
52  bool Init() override;
53 
54  int New( const TOOL_EVENT& aEvent );
55  int Open( const TOOL_EVENT& aEvent );
56  int Save( const TOOL_EVENT& aEvent );
57  int SaveAs( const TOOL_EVENT& aEvent );
58  int SaveCopyAs( const TOOL_EVENT& aEvent );
59  int PageSettings( const TOOL_EVENT& aEvent );
60  int Plot( const TOOL_EVENT& aEvent );
61 
62  int BoardSetup( const TOOL_EVENT& aEvent );
63  int ImportNetlist( const TOOL_EVENT& aEvent );
64  int ImportSpecctraSession( const TOOL_EVENT& aEvent );
65  int ExportSpecctraDSN( const TOOL_EVENT& aEvent );
66  int GenerateDrillFiles( const TOOL_EVENT& aEvent );
67  int GeneratePosFile( const TOOL_EVENT& aEvent );
68  int GenerateFabFiles( const TOOL_EVENT& aEvent );
69 
70  int UpdatePCBFromSchematic( const TOOL_EVENT& aEvent );
71  int ShowEeschema( const TOOL_EVENT& aEvent );
72  int ToggleLayersManager( const TOOL_EVENT& aEvent );
73  int ToggleMicrowaveToolbar( const TOOL_EVENT& aEvent );
74  int TogglePythonConsole( const TOOL_EVENT& aEvent );
75 
76  // Track & via size control
77  int TrackWidthInc( const TOOL_EVENT& aEvent );
78  int TrackWidthDec( const TOOL_EVENT& aEvent );
79  int ViaSizeInc( const TOOL_EVENT& aEvent );
80  int ViaSizeDec( const TOOL_EVENT& aEvent );
81 
82  // Zone actions
83  int ZoneMerge( const TOOL_EVENT& aEvent );
84 
86  int ZoneDuplicate( const TOOL_EVENT& aEvent );
87 
92  int PlaceTarget( const TOOL_EVENT& aEvent );
93 
98  int PlaceModule( const TOOL_EVENT& aEvent );
99 
101  int ToggleLockSelected( const TOOL_EVENT& aEvent );
102 
104  int LockSelected( const TOOL_EVENT& aEvent );
105 
107  int UnlockSelected( const TOOL_EVENT& aEvent );
108 
110  int DrillOrigin( const TOOL_EVENT& aEvent );
111 
113  static void DoSetDrillOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
114  BOARD_ITEM* aItem, const VECTOR2D& aPoint );
115 
116  int FlipPcbView( const TOOL_EVENT& aEvent );
117 
118 private:
120  enum MODIFY_MODE { ON, OFF, TOGGLE };
121 
122  int modifyLockSelected( MODIFY_MODE aMode );
123 
125  void setTransitions() override;
126 
127 private:
129 
130  std::unique_ptr<KIGFX::ORIGIN_VIEWITEM> m_placeOrigin;
131 
132  static const int WIDTH_STEP;
133 };
134 
135 #endif
int ZoneMerge(const TOOL_EVENT &aEvent)
int PlaceModule(const TOOL_EVENT &aEvent)
Function PlaceModule() Displays a dialog to select a module to be added and allows the user to set it...
std::unique_ptr< KIGFX::ORIGIN_VIEWITEM > m_placeOrigin
Pointer to the currently used edit frame.
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:58
int Open(const TOOL_EVENT &aEvent)
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
int TrackWidthDec(const TOOL_EVENT &aEvent)
int GenerateDrillFiles(const TOOL_EVENT &aEvent)
int ShowEeschema(const TOOL_EVENT &aEvent)
int BoardSetup(const TOOL_EVENT &aEvent)
int ImportSpecctraSession(const TOOL_EVENT &aEvent)
int ToggleMicrowaveToolbar(const TOOL_EVENT &aEvent)
int ZoneDuplicate(const TOOL_EVENT &aEvent)
Duplicates a zone onto a layer (prompts for new layer)
int Save(const TOOL_EVENT &aEvent)
MODIFY_MODE
How to modify a property for selected items.
int ViaSizeDec(const TOOL_EVENT &aEvent)
int TrackWidthInc(const TOOL_EVENT &aEvent)
int Plot(const TOOL_EVENT &aEvent)
int ExportSpecctraDSN(const TOOL_EVENT &aEvent)
Class TOOL_EVENT.
Definition: tool_event.h:171
int SaveAs(const TOOL_EVENT &aEvent)
int DrillOrigin(const TOOL_EVENT &aEvent)
Runs the drill origin tool for setting the origin for drill and pick-and-place files.
int GeneratePosFile(const TOOL_EVENT &aEvent)
int ViaSizeInc(const TOOL_EVENT &aEvent)
int LockSelected(const TOOL_EVENT &aEvent)
Locks selected items.
int UnlockSelected(const TOOL_EVENT &aEvent)
Unlocks selected items.
static void DoSetDrillOrigin(KIGFX::VIEW *aView, PCB_BASE_FRAME *aFrame, BOARD_ITEM *aItem, const VECTOR2D &aPoint)
Low-level access (below undo) to setting the drill origin
int New(const TOOL_EVENT &aEvent)
int SaveCopyAs(const TOOL_EVENT &aEvent)
int TogglePythonConsole(const TOOL_EVENT &aEvent)
int GenerateFabFiles(const TOOL_EVENT &aEvent)
Class PCB_EDITOR_CONTROL.
int FlipPcbView(const TOOL_EVENT &aEvent)
PCB_EDIT_FRAME * m_frame
int PlaceTarget(const TOOL_EVENT &aEvent)
Function PlaceTarget() Allows user to place a layer alignment target.
static const int WIDTH_STEP
Place & drill origin marker
int modifyLockSelected(MODIFY_MODE aMode)
int ImportNetlist(const TOOL_EVENT &aEvent)
int ToggleLayersManager(const TOOL_EVENT &aEvent)
int UpdatePCBFromSchematic(const TOOL_EVENT &aEvent)
Class PCB_EDIT_FRAME is the main frame for Pcbnew.
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:79
Class VIEW.
Definition: view.h:61
int PageSettings(const TOOL_EVENT &aEvent)
int ToggleLockSelected(const TOOL_EVENT &aEvent)
Toggles 'lock' property for selected items.
bool Init() override
Function Init() Init() is called once upon a registration of the tool.
void setTransitions() override
Sets up handlers for various events.
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void Reset(RESET_REASON aReason) override
Function Reset() Brings the tool to a known, initial state.