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 #include <tool/tool_menu.h>
30 
31 namespace KIGFX {
32  class ORIGIN_VIEWITEM;
33 }
34 
35 class PCB_EDIT_FRAME;
36 
42 class PCB_EDITOR_CONTROL : public wxEvtHandler, public PCB_TOOL
43 {
44 public:
47 
49  void Reset( RESET_REASON aReason ) override;
50 
52  bool Init() override;
53 
54  // Track & via size control
55  int TrackWidthInc( const TOOL_EVENT& aEvent );
56  int TrackWidthDec( const TOOL_EVENT& aEvent );
57  int ViaSizeInc( const TOOL_EVENT& aEvent );
58  int ViaSizeDec( const TOOL_EVENT& aEvent );
59 
60  // Zone actions
61  int ZoneMerge( const TOOL_EVENT& aEvent );
62 
64  int ZoneDuplicate( const TOOL_EVENT& aEvent );
65 
70  int PlaceTarget( const TOOL_EVENT& aEvent );
71 
76  int PlaceModule( const TOOL_EVENT& aEvent );
77 
79  int ToggleLockSelected( const TOOL_EVENT& aEvent );
80 
82  int LockSelected( const TOOL_EVENT& aEvent );
83 
85  int UnlockSelected( const TOOL_EVENT& aEvent );
86 
88  int CrossProbePcbToSch( const TOOL_EVENT& aEvent );
89 
91  int CrossProbeSchToPcb( const TOOL_EVENT& aEvent );
92 
94  int DrillOrigin( const TOOL_EVENT& aEvent );
95 
97  static bool SetDrillOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
98  BOARD_ITEM* aItem, const VECTOR2D& aPoint );
99 
101  static bool DoSetDrillOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
102  BOARD_ITEM* aItem, const VECTOR2D& aPoint );
103 
105  int HighlightNet( const TOOL_EVENT& aEvent );
106 
108  int HighlightNetCursor( const TOOL_EVENT& aEvent );
109 
111  int UpdateSelectionRatsnest( const TOOL_EVENT& aEvent );
112 
114  int HideSelectionRatsnest( const TOOL_EVENT& aEvent );
115 
117  int ShowLocalRatsnest( const TOOL_EVENT& aEvent );
118 
119 private:
121  void ratsnestTimer( wxTimerEvent& aEvent );
122 
124  void calculateSelectionRatsnest();
125 
127  void setTransitions() override;
128 
131 
134 
136  std::unique_ptr<KIGFX::ORIGIN_VIEWITEM> m_placeOrigin;
137 
140 
143 
146 
148  enum MODIFY_MODE { ON, OFF, TOGGLE };
149 
150  int modifyLockSelected( MODIFY_MODE aMode );
151 
152  // How does line width change after one -/+ key press.
153  static const int WIDTH_STEP;
154 };
155 
156 #endif
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
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
Class TOOL_MENU.
Definition: tool_menu.h:47
#define OFF
wxTimer m_ratsnestTimer
Timer that start ratsnest calculation when it is slow to compute.
MODIFY_MODE
How to modify a property for selected items.
Class TOOL_EVENT.
Definition: tool_event.h:162
Class PCB_EDITOR_CONTROL.
PCB_EDIT_FRAME * m_frame
Pointer to the currently used edit frame.
static const int WIDTH_STEP
Class PCB_EDIT_FRAME is the main frame for Pcbnew.
bool m_probingSchToPcb
Flag to ignore a single crossprobe message from eeschema.
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:80
TOOL_MENU m_menu
Menu model displayed by the tool.
#define ON
Class VIEW.
Definition: view.h:58
bool m_slowRatsnest
Flag to indicate whether the current selection ratsnest is slow to calculate.
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...