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.h>
29 
30 namespace KIGFX {
31  class ORIGIN_VIEWITEM;
32 }
33 
34 class PCB_EDIT_FRAME;
35 
42 {
43 public:
46 
48  void Reset( RESET_REASON aReason ) override;
49 
51  bool Init() override;
52 
53  // Track & via size control
54  int TrackWidthInc( const TOOL_EVENT& aEvent );
55  int TrackWidthDec( const TOOL_EVENT& aEvent );
56  int ViaSizeInc( const TOOL_EVENT& aEvent );
57  int ViaSizeDec( const TOOL_EVENT& aEvent );
58 
59  // Zone actions
60  int ZoneFill( const TOOL_EVENT& aEvent );
61  int ZoneFillAll( const TOOL_EVENT& aEvent );
62  int ZoneUnfill( const TOOL_EVENT& aEvent );
63  int ZoneUnfillAll( const TOOL_EVENT& aEvent );
64  int ZoneMerge( const TOOL_EVENT& aEvent );
65 
67  int ZoneDuplicate( const TOOL_EVENT& aEvent );
68 
73  int PlaceTarget( const TOOL_EVENT& aEvent );
74 
79  int PlaceModule( const TOOL_EVENT& aEvent );
80 
82  int ToggleLockSelected( const TOOL_EVENT& aEvent );
83 
85  int LockSelected( const TOOL_EVENT& aEvent );
86 
88  int UnlockSelected( const TOOL_EVENT& aEvent );
89 
91  int CrossProbePcbToSch( const TOOL_EVENT& aEvent );
92 
94  int CrossProbeSchToPcb( const TOOL_EVENT& aEvent );
95 
97  int DrillOrigin( const TOOL_EVENT& aEvent );
98 
100  int HighlightNet( const TOOL_EVENT& aEvent );
101 
103  int HighlightNetCursor( const TOOL_EVENT& aEvent );
104 
106  int UpdateSelectionRatsnest( const TOOL_EVENT& aEvent );
107 
109  int ShowLocalRatsnest( const TOOL_EVENT& aEvent );
110 
112  void SetTransitions() override;
113 
114 private:
117 
119  std::unique_ptr<KIGFX::ORIGIN_VIEWITEM> m_placeOrigin;
120 
123 
125  enum MODIFY_MODE { ON, OFF, TOGGLE };
126 
127  int modifyLockSelected( MODIFY_MODE aMode );
128 
129  // How does line width change after one -/+ key press.
130  static const int WIDTH_STEP;
131 };
132 
133 #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
Place & drill origin marker.
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:58
int TrackWidthDec(const TOOL_EVENT &aEvent)
void SetTransitions() override
Sets up handlers for various events.
int ZoneDuplicate(const TOOL_EVENT &aEvent)
Duplicates a zone onto a layer (prompts for new layer)
MODIFY_MODE
How to modify a property for selected items.
int HighlightNet(const TOOL_EVENT &aEvent)
Highlights net belonging to the item under the cursor.
int ShowLocalRatsnest(const TOOL_EVENT &aEvent)
Shows local ratsnest of a component
int ViaSizeDec(const TOOL_EVENT &aEvent)
int TrackWidthInc(const TOOL_EVENT &aEvent)
Class TOOL_EVENT.
Definition: tool_event.h:162
int DrillOrigin(const TOOL_EVENT &aEvent)
Places the origin point for drill and pick-and-place files.
int ZoneUnfill(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.
int HighlightNetCursor(const TOOL_EVENT &aEvent)
Launches a tool to pick the item whose net is going to be highlighted.
int ZoneFill(const TOOL_EVENT &aEvent)
int UpdateSelectionRatsnest(const TOOL_EVENT &aEvent)
Updates ratsnest for selected items.
Class PCB_EDITOR_CONTROL.
PCB_EDIT_FRAME * m_frame
Pointer to the currently used edit frame.
int PlaceTarget(const TOOL_EVENT &aEvent)
Function PlaceTarget() Allows user to place a layer alignment target.
static const int WIDTH_STEP
int modifyLockSelected(MODIFY_MODE aMode)
bool m_probingSchToPcb
Flag to ignore a single crossprobe message from eeschema.
int ZoneFillAll(const TOOL_EVENT &aEvent)
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:80
int ZoneUnfillAll(const TOOL_EVENT &aEvent)
int CrossProbePcbToSch(const TOOL_EVENT &aEvent)
Notifies eeschema about the selected item.
int CrossProbeSchToPcb(const TOOL_EVENT &aEvent)
Reacts to selection change in eeschema.
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 Reset(RESET_REASON aReason) override
Function Reset() Brings the tool to a known, initial state.