KiCad PCB EDA Suite
COMMON_TOOLS Class Reference

Handles action that are shared between different applications. More...

#include <common_tools.h>

Inheritance diagram for COMMON_TOOLS:
TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN , MODEL_RELOAD , GAL_SWITCH , REDRAW }
 Determine the reason of reset for a tool. More...
 

Public Member Functions

 COMMON_TOOLS ()
 
 ~COMMON_TOOLS () override
 
void Reset (RESET_REASON aReason) override
 Bring the tool to a known, initial state. More...
 
int SelectionTool (const TOOL_EVENT &aEvent)
 
int ZoomRedraw (const TOOL_EVENT &aEvent)
 
int ZoomInOut (const TOOL_EVENT &aEvent)
 
int ZoomInOutCenter (const TOOL_EVENT &aEvent)
 
int ZoomCenter (const TOOL_EVENT &aEvent)
 
int ZoomFitScreen (const TOOL_EVENT &aEvent)
 
int ZoomFitObjects (const TOOL_EVENT &aEvent)
 
int ZoomPreset (const TOOL_EVENT &aEvent)
 
int CenterContents (const TOOL_EVENT &aEvent)
 
int PanControl (const TOOL_EVENT &aEvent)
 
int CursorControl (const TOOL_EVENT &aEvent)
 
int ToggleCursor (const TOOL_EVENT &aEvent)
 
int ToggleCursorStyle (const TOOL_EVENT &aEvent)
 
int ToggleBoundingBoxes (const TOOL_EVENT &aEvent)
 
int SwitchUnits (const TOOL_EVENT &aEvent)
 
int ToggleUnits (const TOOL_EVENT &aEvent)
 
int TogglePolarCoords (const TOOL_EVENT &aEvent)
 
int ResetLocalCoords (const TOOL_EVENT &aEvent)
 
void SetLastUnits (EDA_UNITS aUnit)
 
EDA_UNITS GetLastMetricUnits ()
 
EDA_UNITS GetLastImperialUnits ()
 
int GridNext (const TOOL_EVENT &aEvent)
 
int GridPrev (const TOOL_EVENT &aEvent)
 
int GridPreset (const TOOL_EVENT &aEvent)
 
int GridFast1 (const TOOL_EVENT &aEvent)
 
int GridFast2 (const TOOL_EVENT &aEvent)
 
int ToggleGrid (const TOOL_EVENT &aEvent)
 
int GridProperties (const TOOL_EVENT &aEvent)
 
int GridPreset (int idx)
 
int OnGridChanged ()
 
void Activate ()
 Run the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Assign a context menu and tells when it should be activated. More...
 
void RunMainStack (std::function< void()> aFunc)
 Call a function using the main stack. More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Define which state (aStateFunc) to go when a certain event arrives (aConditions). More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Suspend execution of the tool until an event specified in aEventList arrives. More...
 
virtual bool Init ()
 Init() is called once upon a registration of the tool. More...
 
TOOL_TYPE GetType () const
 Return the type of the tool. More...
 
TOOL_ID GetId () const
 Return the unique identifier of the tool. More...
 
const std::string & GetName () const
 Return the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Return the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Protected Member Functions

void attachManager (TOOL_MANAGER *aManager)
 Set the TOOL_MANAGER the tool will belong to. More...
 
KIGFX::VIEWgetView () const
 Returns the instance of #VIEW object used in the application. More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Return the instance of VIEW_CONTROLS object used in the application. More...
 
template<typename T >
T * getEditFrame () const
 Return the application window object, casted to requested user type. More...
 
template<typename T >
T * getModel () const
 Return the model object if it matches the requested type. More...
 

Protected Attributes

TOOL_MENU m_menu
 The functions below are not yet implemented - their interface may change. More...
 
TOOL_TYPE m_type
 Unique identifier for the tool, assigned by a TOOL_MANAGER instance. More...
 
TOOL_ID m_toolId
 Name of the tool. More...
 
std::string m_toolName
 
TOOL_MANAGERm_toolMgr
 

Private Types

enum  ZOOM_FIT_TYPE_T { ZOOM_FIT_ALL , ZOOM_FIT_OBJECTS }
 The set of "Zoom to Fit" types that can be performed. More...
 

Private Member Functions

void setTransitions () override
 Pointer to the currently used edit frame. More...
 
int doZoomInOut (bool aDirection, bool aCenterOnCursor)
 Note: idx == 0 is Auto; idx == 1 is first entry in zoomList. More...
 
int doZoomToPreset (int idx, bool aCenterOnCursor)
 
int doZoomFit (ZOOM_FIT_TYPE_T aFitType)
 
void resetTransitions ()
 Clear the current transition map and restores the default one created by setTransitions(). More...
 
void goInternal (TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)
 
EDA_ITEMgetModelInt () const
 
TOOLS_HOLDERgetToolHolderInt () const
 

Private Attributes

EDA_DRAW_FRAMEm_frame
 
std::vector< VECTOR2Im_grids
 Grids from #APP_SETTINGS converted to internal units and with the user grid appended. More...
 
EDA_UNITS m_imperialUnit
 
EDA_UNITS m_metricUnit
 

Detailed Description

Handles action that are shared between different applications.

Definition at line 37 of file common_tools.h.

Member Enumeration Documentation

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determine the reason of reset for a tool.

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

REDRAW 

Full drawing refresh.

Definition at line 77 of file tool_base.h.

78 {
79 RUN,
82 REDRAW
83 };
@ REDRAW
Full drawing refresh.
Definition: tool_base.h:82
@ MODEL_RELOAD
Model changes (required full reload)
Definition: tool_base.h:80
@ GAL_SWITCH
Rendering engine changes.
Definition: tool_base.h:81
@ RUN
Tool is invoked after being inactive.
Definition: tool_base.h:79

◆ ZOOM_FIT_TYPE_T

The set of "Zoom to Fit" types that can be performed.

Enumerator
ZOOM_FIT_ALL 

Zoom to fall all items in view INCLUDING page and border.

ZOOM_FIT_OBJECTS 

Zoom to fit all items in view EXCLUDING page and border.

Definition at line 94 of file common_tools.h.

95 {
98 };
@ ZOOM_FIT_ALL
Zoom to fall all items in view INCLUDING page and border.
Definition: common_tools.h:96
@ ZOOM_FIT_OBJECTS
Zoom to fit all items in view EXCLUDING page and border.
Definition: common_tools.h:97

Constructor & Destructor Documentation

◆ COMMON_TOOLS()

COMMON_TOOLS::COMMON_TOOLS ( )

Definition at line 45 of file common_tools.cpp.

45 :
46 TOOL_INTERACTIVE( "common.Control" ),
47 m_frame( nullptr ),
50{
51}
EDA_UNITS m_metricUnit
Definition: common_tools.h:118
EDA_UNITS m_imperialUnit
Definition: common_tools.h:117
EDA_DRAW_FRAME * m_frame
Definition: common_tools.h:104
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Create a tool with given id & name.

References INCHES, and MILLIMETRES.

◆ ~COMMON_TOOLS()

COMMON_TOOLS::~COMMON_TOOLS ( )
inlineoverride

Definition at line 42 of file common_tools.h.

42{ }

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Run the tool.

After activation, the tool starts receiving events until it is finished.

Definition at line 51 of file tool_interactive.cpp.

52{
54}
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:210
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.

References TOOL_MANAGER::InvokeTool(), TOOL_BASE::m_toolId, and TOOL_BASE::m_toolMgr.

Referenced by AUTOPLACE_TOOL::autoplace(), EDIT_TOOL::copyToClipboard(), SCH_EDIT_TOOL::DeleteItemCursor(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCB_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), EE_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), GROUP_TOOL::PickNewMember(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), ROUTER_TOOL::RouteSelected(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Set the TOOL_MANAGER the tool will belong to.

Called by TOOL_MANAGER::RegisterTool()

Definition at line 60 of file tool_base.cpp.

61{
62 m_toolMgr = aManager;
63}

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ CenterContents()

int COMMON_TOOLS::CenterContents ( const TOOL_EVENT aEvent)

Definition at line 364 of file common_tools.cpp.

365{
367 BOX2I bBox = getModel<EDA_ITEM>()->ViewBBox();
368
369 if( bBox.GetWidth() == 0 || bBox.GetHeight() == 0 )
370 bBox = canvas->GetDefaultViewBBox();
371
372 getView()->SetCenter( bBox.Centre() );
373
374 // Take scrollbars into account
375 VECTOR2D scrollbarSize = VECTOR2D( ToVECTOR2D( canvas->GetSize() - canvas->GetClientSize() ) );
376 VECTOR2D worldScrollbarSize = getView()->ToWorld( scrollbarSize, false );
377 getView()->SetCenter( getView()->GetCenter() + worldScrollbarSize / 2.0 );
378
379 return 0;
380}
coord_type GetHeight() const
Definition: box2.h:188
coord_type GetWidth() const
Definition: box2.h:187
Vec Centre() const
Definition: box2.h:70
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual BOX2I GetDefaultViewBBox() const
Return the bounding box of the view that should be used if model is not valid.
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:448
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition: view.cpp:577
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
VECTOR2< double > VECTOR2D
Definition: vector2d.h:589
VECTOR2D ToVECTOR2D(const wxPoint &aPoint)
Definition: vector2wx.h:40

References BOX2< Vec >::Centre(), EDA_DRAW_FRAME::GetCanvas(), EDA_DRAW_PANEL_GAL::GetDefaultViewBBox(), BOX2< Vec >::GetHeight(), TOOL_BASE::getView(), BOX2< Vec >::GetWidth(), m_frame, KIGFX::VIEW::SetCenter(), ToVECTOR2D(), and KIGFX::VIEW::ToWorld().

Referenced by setTransitions().

◆ CursorControl()

int COMMON_TOOLS::CursorControl ( const TOOL_EVENT aEvent)

Definition at line 103 of file common_tools.cpp.

104{
105 long type = aEvent.Parameter<intptr_t>();
106 bool fastMove = type & ACTIONS::CURSOR_FAST_MOVE;
107 type &= ~ACTIONS::CURSOR_FAST_MOVE;
108 bool mirroredX = getView()->IsMirroredX();
109
111 VECTOR2D gridSize = getView()->GetGAL()->GetGridSize();
112
113 if( fastMove )
114 gridSize = gridSize * 10;
115
116 switch( type )
117 {
119 cursor -= VECTOR2D( 0, gridSize.y );
120 break;
121
123 cursor += VECTOR2D( 0, gridSize.y );
124 break;
125
127 cursor -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
128 break;
129
131 cursor += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
132 break;
133
134 case ACTIONS::CURSOR_CLICK: // fall through
137 {
140 int modifiers = 0;
141
142 modifiers |= wxGetKeyState( WXK_SHIFT ) ? MD_SHIFT : 0;
143 modifiers |= wxGetKeyState( WXK_CONTROL ) ? MD_CTRL : 0;
144 modifiers |= wxGetKeyState( WXK_ALT ) ? MD_ALT : 0;
145
146 if( type == ACTIONS::CURSOR_DBL_CLICK )
147 action = TA_MOUSE_DBLCLICK;
148
149 if( type == ACTIONS::CURSOR_RIGHT_CLICK )
150 button = BUT_RIGHT;
151
152 TOOL_EVENT evt( TC_MOUSE, action, button | modifiers );
153 evt.SetParameter( static_cast<intptr_t>( type ) );
154 evt.SetMousePosition( getViewControls()->GetCursorPosition() );
155 m_toolMgr->ProcessEvent( evt );
156
157 return 0;
158 }
159 default:
160 wxFAIL_MSG( wxS( "CursorControl(): unexpected request" ) );
161 }
162
163 getViewControls()->SetCursorPosition( cursor, true, true, type );
165
166 return 0;
167}
Gather all the actions that are shared by tools.
Definition: actions.h:41
@ CURSOR_DBL_CLICK
Definition: actions.h:192
@ CURSOR_RIGHT
Definition: actions.h:191
@ CURSOR_FAST_MOVE
Definition: actions.h:193
@ CURSOR_LEFT
Definition: actions.h:191
@ CURSOR_CLICK
Definition: actions.h:192
@ CURSOR_UP
Definition: actions.h:191
@ CURSOR_DOWN
Definition: actions.h:191
@ CURSOR_RIGHT_CLICK
Definition: actions.h:192
static TOOL_ACTION refreshPreview
Definition: actions.h:110
const VECTOR2D & GetGridSize() const
Return the grid size.
virtual VECTOR2D GetRawCursorPosition(bool aSnappingEnabled=true) const =0
Return the current cursor position in world coordinates ignoring the cursorUp position force mode.
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Move cursor to the requested position expressed in world coordinates.
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:195
bool IsMirroredX() const
Return true if view is flipped across the X axis.
Definition: view.h:243
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
Generic, UI-independent tool event.
Definition: tool_event.h:156
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:442
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142
TOOL_ACTIONS
Definition: tool_event.h:59
@ TA_MOUSE_CLICK
Definition: tool_event.h:62
@ TA_MOUSE_DBLCLICK
Definition: tool_event.h:63
@ TC_MOUSE
Definition: tool_event.h:50
@ MD_ALT
Definition: tool_event.h:140
@ MD_CTRL
Definition: tool_event.h:139
@ MD_SHIFT
Definition: tool_event.h:138
TOOL_MOUSE_BUTTONS
Definition: tool_event.h:125
@ BUT_LEFT
Definition: tool_event.h:127
@ BUT_RIGHT
Definition: tool_event.h:128

References BUT_LEFT, BUT_RIGHT, cursor, ACTIONS::CURSOR_CLICK, ACTIONS::CURSOR_DBL_CLICK, ACTIONS::CURSOR_DOWN, ACTIONS::CURSOR_FAST_MOVE, ACTIONS::CURSOR_LEFT, ACTIONS::CURSOR_RIGHT, ACTIONS::CURSOR_RIGHT_CLICK, ACTIONS::CURSOR_UP, KIGFX::VIEW::GetGAL(), KIGFX::GAL::GetGridSize(), KIGFX::VIEW_CONTROLS::GetRawCursorPosition(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), KIGFX::VIEW::IsMirroredX(), TOOL_BASE::m_toolMgr, MD_ALT, MD_CTRL, MD_SHIFT, TOOL_EVENT::Parameter(), TOOL_MANAGER::ProcessEvent(), ACTIONS::refreshPreview, TOOL_MANAGER::RunAction(), KIGFX::VIEW_CONTROLS::SetCursorPosition(), TOOL_EVENT::SetMousePosition(), TOOL_EVENT::SetParameter(), TA_MOUSE_CLICK, TA_MOUSE_DBLCLICK, TC_MOUSE, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

◆ doZoomFit()

int COMMON_TOOLS::doZoomFit ( ZOOM_FIT_TYPE_T  aFitType)
private

Definition at line 292 of file common_tools.cpp.

293{
294 KIGFX::VIEW* view = getView();
296 EDA_DRAW_FRAME* frame = getEditFrame<EDA_DRAW_FRAME>();
297
298 BOX2I bBox = frame->GetDocumentExtents();
299 BOX2I defaultBox = canvas->GetDefaultViewBBox();
300
301 view->SetScale( 1.0 ); // The best scale will be determined later, but this initial
302 // value ensures all view parameters are up to date (especially
303 // at init time)
304 VECTOR2D screenSize = view->ToWorld( ToVECTOR2I( canvas->GetClientSize() ), false );
305
306 // Currently "Zoom to Objects" is only supported in Eeschema & Pcbnew. Support for other
307 // programs in the suite can be added as needed.
308
309 if( aFitType == ZOOM_FIT_OBJECTS )
310 {
311 if( frame->IsType( FRAME_SCH ) || frame->IsType( FRAME_PCB_EDITOR ) )
312 bBox = m_frame->GetDocumentExtents( false );
313 else
314 aFitType = ZOOM_FIT_ALL; // Just do a "Zoom to Fit" for unsupported editors
315 }
316
317 // If the screen is empty then use the default view bbox
318
319 if( bBox.GetWidth() == 0 || bBox.GetHeight() == 0 )
320 bBox = defaultBox;
321
322 VECTOR2D vsize = bBox.GetSize();
323 double scale = view->GetScale() / std::max( fabs( vsize.x / screenSize.x ),
324 fabs( vsize.y / screenSize.y ) );
325
326 // if the scale isn't finite (most likely due to an empty canvas)
327 // simply just make sure we are centered and quit out of trying to zoom to fit
328 if( !std::isfinite( scale ) )
329 {
330 view->SetCenter( VECTOR2D( 0, 0 ) );
331 return 0;
332 }
333
334 // Reserve enough margin to limit the amount of the view that might be obscured behind the
335 // infobar.
336 double margin_scale_factor = 1.04;
337
338 if( canvas->GetClientSize().y < 768 )
339 margin_scale_factor = 1.10;
340
341 if( aFitType == ZOOM_FIT_ALL )
342 {
343 // Leave a bigger margin for library editors & viewers
344
346 || frame->IsType( FRAME_SCH_VIEWER ) || frame->IsType( FRAME_SCH_VIEWER_MODAL ) )
347 {
348 margin_scale_factor = 1.30;
349 }
350 else if( frame->IsType( FRAME_SCH_SYMBOL_EDITOR )
351 || frame->IsType( FRAME_FOOTPRINT_EDITOR ) )
352 {
353 margin_scale_factor = 1.48;
354 }
355 }
356
357 view->SetScale( scale / margin_scale_factor );
358 view->SetCenter( bBox.Centre() );
359
360 return 0;
361}
const Vec & GetSize() const
Definition: box2.h:179
bool IsType(FRAME_T aType) const
The base class for create windows for drawing purpose.
virtual const BOX2I GetDocumentExtents(bool aIncludeAllVisible=true) const
Returns bbox of document with option to not include some items.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:69
double GetScale() const
Definition: view.h:269
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Set the scaling factor, zooming around a given anchor point.
Definition: view.cpp:551
@ FRAME_PCB_EDITOR
Definition: frame_type.h:40
@ FRAME_FOOTPRINT_VIEWER_MODAL
Definition: frame_type.h:43
@ FRAME_SCH_SYMBOL_EDITOR
Definition: frame_type.h:35
@ FRAME_FOOTPRINT_VIEWER
Definition: frame_type.h:42
@ FRAME_SCH_VIEWER
Definition: frame_type.h:36
@ FRAME_SCH
Definition: frame_type.h:34
@ FRAME_SCH_VIEWER_MODAL
Definition: frame_type.h:37
@ FRAME_FOOTPRINT_EDITOR
Definition: frame_type.h:41
const int scale
VECTOR2I ToVECTOR2I(const wxSize &aSize)
Definition: vector2wx.h:30

References BOX2< Vec >::Centre(), FRAME_FOOTPRINT_EDITOR, FRAME_FOOTPRINT_VIEWER, FRAME_FOOTPRINT_VIEWER_MODAL, FRAME_PCB_EDITOR, FRAME_SCH, FRAME_SCH_SYMBOL_EDITOR, FRAME_SCH_VIEWER, FRAME_SCH_VIEWER_MODAL, EDA_DRAW_FRAME::GetCanvas(), EDA_DRAW_PANEL_GAL::GetDefaultViewBBox(), EDA_DRAW_FRAME::GetDocumentExtents(), BOX2< Vec >::GetHeight(), KIGFX::VIEW::GetScale(), BOX2< Vec >::GetSize(), TOOL_BASE::getView(), BOX2< Vec >::GetWidth(), EDA_BASE_FRAME::IsType(), m_frame, scale, KIGFX::VIEW::SetCenter(), KIGFX::VIEW::SetScale(), ToVECTOR2I(), KIGFX::VIEW::ToWorld(), VECTOR2< T >::x, VECTOR2< T >::y, ZOOM_FIT_ALL, and ZOOM_FIT_OBJECTS.

Referenced by ZoomFitObjects(), and ZoomFitScreen().

◆ doZoomInOut()

int COMMON_TOOLS::doZoomInOut ( bool  aDirection,
bool  aCenterOnCursor 
)
private

Note: idx == 0 is Auto; idx == 1 is first entry in zoomList.

Definition at line 228 of file common_tools.cpp.

229{
230 double zoom = getView()->GetGAL()->GetZoomFactor();
231
232 // Step must be AT LEAST 1.3
233 if( aDirection )
234 zoom *= 1.3;
235 else
236 zoom /= 1.3;
237
238 // Now look for the next closest menu step
239 std::vector<double>& zoomList = m_toolMgr->GetSettings()->m_Window.zoom_factors;
240 int idx;
241
242 if( aDirection )
243 {
244 for( idx = 0; idx < int( zoomList.size() ); ++idx )
245 {
246 if( zoomList[idx] >= zoom )
247 break;
248 }
249
250 if( idx >= int( zoomList.size() ) )
251 idx = (int) zoomList.size() - 1; // if we ran off the end then peg to the end
252 }
253 else
254 {
255 for( idx = int( zoomList.size() ) - 1; idx >= 0; --idx )
256 {
257 if( zoomList[idx] <= zoom )
258 break;
259 }
260
261 if( idx < 0 )
262 idx = 0; // if we ran off the end then peg to the end
263 }
264
265 // Note: idx == 0 is Auto; idx == 1 is first entry in zoomList
266 return doZoomToPreset( idx + 1, aCenterOnCursor );
267}
WINDOW_SETTINGS m_Window
Definition: app_settings.h:187
int doZoomToPreset(int idx, bool aCenterOnCursor)
double GetZoomFactor() const
APP_SETTINGS_BASE * GetSettings() const
Definition: tool_manager.h:294
std::vector< double > zoom_factors
Definition: app_settings.h:96

References doZoomToPreset(), KIGFX::VIEW::GetGAL(), TOOL_MANAGER::GetSettings(), TOOL_BASE::getView(), KIGFX::GAL::GetZoomFactor(), TOOL_BASE::m_toolMgr, APP_SETTINGS_BASE::m_Window, zoom, and WINDOW_SETTINGS::zoom_factors.

Referenced by ZoomInOut(), and ZoomInOutCenter().

◆ doZoomToPreset()

int COMMON_TOOLS::doZoomToPreset ( int  idx,
bool  aCenterOnCursor 
)
private

Definition at line 391 of file common_tools.cpp.

392{
393 std::vector<double>& zoomList = m_toolMgr->GetSettings()->m_Window.zoom_factors;
394
395 if( idx == 0 ) // Zoom Auto
396 {
398 return ZoomFitScreen( dummy );
399 }
400 else
401 {
402 idx--;
403 }
404
405 double scale = zoomList[idx];
406
407 if( aCenterOnCursor )
408 {
409 getView()->SetScale( scale, getViewControls()->GetCursorPosition() );
410
411 if( getViewControls()->IsCursorWarpingEnabled() )
413 }
414 else
415 {
416 getView()->SetScale( scale );
417 }
418
419 return 0;
420}
int ZoomFitScreen(const TOOL_EVENT &aEvent)
virtual void CenterOnCursor()=0
Set the viewport center to the current cursor position and warps the cursor to the screen center.
std::vector< FAB_LAYER_COLOR > dummy

References KIGFX::VIEW_CONTROLS::CenterOnCursor(), dummy, TOOL_MANAGER::GetSettings(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_BASE::m_toolMgr, APP_SETTINGS_BASE::m_Window, scale, KIGFX::VIEW::SetScale(), WINDOW_SETTINGS::zoom_factors, and ZoomFitScreen().

Referenced by doZoomInOut(), and ZoomPreset().

◆ getEditFrame()

template<typename T >
T * TOOL_BASE::getEditFrame ( ) const
inlineprotectedinherited

Return the application window object, casted to requested user type.

Definition at line 185 of file tool_base.h.

186 {
187#if !defined( QA_TEST ) // Dynamic casts give the linker a seizure in the test framework
188 wxASSERT( dynamic_cast<T*>( getToolHolderInt() ) );
189#endif
190 return static_cast<T*>( getToolHolderInt() );
191 }
TOOLS_HOLDER * getToolHolderInt() const
Definition: tool_base.cpp:48

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone(), and ZONE_CREATE_HELPER::setUniquePriority().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Return the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 121 of file tool_base.h.

122 {
123 return m_toolId;
124 }

References TOOL_BASE::m_toolId.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::isActive(), TOOL_MANAGER::RegisterTool(), ACTION_MANAGER::RunHotKey(), TOOL_MANAGER::runTool(), TOOL_MANAGER::saveViewControls(), and TOOL_MANAGER::ShutdownTool().

◆ GetLastImperialUnits()

EDA_UNITS COMMON_TOOLS::GetLastImperialUnits ( )
inline

Definition at line 77 of file common_tools.h.

77{ return m_imperialUnit; }

References m_imperialUnit.

Referenced by EDA_DRAW_FRAME::GetUnitPair(), and PCB_EDIT_FRAME::UpdateViaSizeSelectBox().

◆ GetLastMetricUnits()

EDA_UNITS COMMON_TOOLS::GetLastMetricUnits ( )
inline

Definition at line 76 of file common_tools.h.

76{ return m_metricUnit; }

References m_metricUnit.

Referenced by EDA_DRAW_FRAME::GetUnitPair(), and PCB_EDIT_FRAME::UpdateViaSizeSelectBox().

◆ GetManager()

TOOL_MANAGER * TOOL_BASE::GetManager ( ) const
inlineinherited

◆ getModel()

template<typename T >
T * TOOL_BASE::getModel ( ) const
inlineprotectedinherited

Return the model object if it matches the requested type.

Store the type of the tool.

Definition at line 197 of file tool_base.h.

References TOOL_BASE::getModelInt().

Referenced by ZONE_CREATE_HELPER::commitZone(), and ZONE_CREATE_HELPER::createZoneFromExisting().

◆ getModelInt()

EDA_ITEM * TOOL_BASE::getModelInt ( ) const
privateinherited

Definition at line 54 of file tool_base.cpp.

55{
56 return m_toolMgr->GetModel();
57}
EDA_ITEM * GetModel() const
Definition: tool_manager.h:292

References TOOL_MANAGER::GetModel(), and TOOL_BASE::m_toolMgr.

Referenced by TOOL_BASE::getModel().

◆ GetName()

const std::string & TOOL_BASE::GetName ( void  ) const
inlineinherited

Return the name of the tool.

Tool names are expected to obey the format: application.ToolName (eg. pcbnew.InteractiveSelection).

Returns
The name of the tool.

Definition at line 134 of file tool_base.h.

135 {
136 return m_toolName;
137 }
std::string m_toolName
Definition: tool_base.h:214

References TOOL_BASE::m_toolName.

Referenced by TOOL_MANAGER::dispatchInternal(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::invokeTool(), TOOL_MANAGER::RegisterTool(), TOOL_MANAGER::runTool(), and TOOL_MANAGER::ShutdownTool().

◆ getToolHolderInt()

TOOLS_HOLDER * TOOL_BASE::getToolHolderInt ( ) const
privateinherited

Definition at line 48 of file tool_base.cpp.

49{
50 return m_toolMgr->GetToolHolder();
51}
TOOLS_HOLDER * GetToolHolder() const
Definition: tool_manager.h:296

References TOOL_MANAGER::GetToolHolder(), and TOOL_BASE::m_toolMgr.

Referenced by TOOL_BASE::getEditFrame().

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 109 of file tool_base.h.

110 {
111 return m_type;
112 }
TOOL_TYPE m_type
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:207

References TOOL_BASE::m_type.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InvokeTool(), TOOL_MANAGER::ResetTools(), TOOL_MANAGER::runTool(), and TOOL_MANAGER::ShutdownTool().

◆ getView()

KIGFX::VIEW * TOOL_BASE::getView ( ) const
protectedinherited

Returns the instance of #VIEW object used in the application.

It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

37{
38 return m_toolMgr->GetView();
39}
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:285

References TOOL_MANAGER::GetView(), and TOOL_BASE::m_toolMgr.

Referenced by EE_POINT_EDITOR::addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), CenterContents(), SCH_EDIT_TOOL::ChangeTextType(), EE_INSPECTION_TOOL::CheckSymbol(), GERBVIEW_CONTROL::ClearAllLayers(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::CollectHits(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), CursorControl(), SCH_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), EDIT_TOOL::DeleteItems(), PL_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SELECTION_TOOL::doSelectionMenu(), doZoomFit(), doZoomInOut(), doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), PCB_CONTROL::GridResetOrigin(), PCB_CONTROL::GridSetOrigin(), EE_SELECTION_TOOL::GuessSelectionCandidates(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), ROUTER_TOOL::handleCommonEvents(), EE_SELECTION_TOOL::highlight(), PL_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::highlightNet(), PNS::TOOL_BASE::highlightNets(), PCB_SELECTION_TOOL::hitTestDistance(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineDrag(), EE_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_TOOL::Main(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), PL_EDIT_TOOL::moveItem(), OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), PanControl(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), ROUTER_TOOL::performRouting(), PNS::TOOL_BASE::pickSingleItem(), BOARD_EDITOR_CONTROL::PlaceFootprint(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EE_SELECTION_TOOL::Reset(), EE_TOOL_BASE< T >::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), PNS::TOOL_BASE::Reset(), BOARD_EDITOR_CONTROL::Reset(), DRAWING_TOOL::Reset(), PCB_CONTROL::Reset(), PCB_SELECTION_TOOL::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::SelectAll(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectionContains(), PCB_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), EE_SELECTION_TOOL::selectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDITOR_CONTROL::ToggleERCErrors(), SCH_EDITOR_CONTROL::ToggleERCExclusions(), SCH_EDITOR_CONTROL::ToggleERCWarnings(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), SCH_EDITOR_CONTROL::ToggleOPCurrents(), SCH_EDITOR_CONTROL::ToggleOPVoltages(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), EE_SELECTION_TOOL::unhighlight(), PL_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), SCH_FIND_REPLACE_TOOL::UpdateFind(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< T >::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), PCB_SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), PCB_SELECTION_TOOL::view(), PCB_TOOL_BASE::view(), PCB_VIEWER_TOOLS::view(), EE_SELECTION_TOOL::ZoomFitCrossProbeBBox(), PCB_SELECTION_TOOL::ZoomFitCrossProbeBBox(), PCB_SELECTION_TOOL::zoomFitSelection(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and PCB_SELECTION_TOOL::~PCB_SELECTION_TOOL().

◆ getViewControls()

KIGFX::VIEW_CONTROLS * TOOL_BASE::getViewControls ( ) const
protectedinherited

Return the instance of VIEW_CONTROLS object used in the application.

It allows tools to read & modify user input and its settings (eg. show cursor, enable snapping to grid, etc.).

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

43{
44 return m_toolMgr->GetViewControls();
45}
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:287

References TOOL_MANAGER::GetViewControls(), and TOOL_BASE::m_toolMgr.

Referenced by EE_POINT_EDITOR::addCorner(), PCB_POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), EE_SELECTION_TOOL::autostartEvent(), SCH_EDIT_TOOL::BreakWire(), PCB_SELECTION_TOOL::controls(), PCB_TOOL_BASE::controls(), EDIT_TOOL::copyToClipboard(), CursorControl(), EDIT_TOOL::DeleteItems(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::HighlightNet(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), EE_POINT_EDITOR::Main(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), DRAWING_TOOL::Reset(), PCB_POINT_EDITOR::Reset(), ResetLocalCoords(), ROUTER_TOOL::RouteSelected(), PCB_SELECTION_TOOL::selectCursor(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PICKER_TOOL::setControls(), PCB_PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), PCB_POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateItem(), PL_EDIT_TOOL::updateModificationPoint(), and ZoomCenter().

◆ Go()

template<class T >
void TOOL_INTERACTIVE::Go ( int(T::*)(const TOOL_EVENT &)  aStateFunc,
const TOOL_EVENT_LIST aConditions = TOOL_EVENTTC_ANYTA_ANY ) 
)
inherited

Define which state (aStateFunc) to go when a certain event arrives (aConditions).

No conditions means any event.

Definition at line 147 of file tool_interactive.h.

149{
150 TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
151
152 goInternal( sptr, aConditions );
153}
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:58

References TOOL_INTERACTIVE::goInternal().

Referenced by EDA_3D_CONTROLLER::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), EE_POINT_EDITOR::setTransitions(), EE_SELECTION_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), SCH_EDIT_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), SCH_FIND_REPLACE_TOOL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), SCH_NAVIGATE_TOOL::setTransitions(), SIMULATOR_CONTROL::setTransitions(), SYMBOL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions(), SYMBOL_EDITOR_EDIT_TOOL::setTransitions(), SYMBOL_EDITOR_MOVE_TOOL::setTransitions(), SYMBOL_EDITOR_PIN_TOOL::setTransitions(), GERBVIEW_CONTROL::setTransitions(), GERBVIEW_INSPECTION_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), COMMON_CONTROL::setTransitions(), setTransitions(), PICKER_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), PL_EDIT_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), PL_POINT_EDITOR::setTransitions(), PL_SELECTION_TOOL::setTransitions(), AUTOPLACE_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), SCRIPTING_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), BOARD_EDITOR_CONTROL::setTransitions(), BOARD_INSPECTION_TOOL::setTransitions(), BOARD_REANNOTATE_TOOL::setTransitions(), CONVERT_TOOL::setTransitions(), DRAWING_TOOL::setTransitions(), DRC_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), FOOTPRINT_EDITOR_CONTROL::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GROUP_TOOL::setTransitions(), PAD_TOOL::setTransitions(), PCB_CONTROL::setTransitions(), PCB_PICKER_TOOL::setTransitions(), PCB_POINT_EDITOR::setTransitions(), PCB_SELECTION_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), PROPERTIES_TOOL::setTransitions(), and ZONE_FILLER_TOOL::setTransitions().

◆ goInternal()

void TOOL_INTERACTIVE::goInternal ( TOOL_STATE_FUNC aState,
const TOOL_EVENT_LIST aConditions 
)
privateinherited

Definition at line 70 of file tool_interactive.cpp.

71{
72 m_toolMgr->ScheduleNextState( this, aState, aConditions );
73}
void ScheduleNextState(TOOL_BASE *aTool, TOOL_STATE_FUNC &aHandler, const TOOL_EVENT_LIST &aConditions)
Define a state transition.

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::ScheduleNextState().

Referenced by TOOL_INTERACTIVE::Go().

◆ GridFast1()

int COMMON_TOOLS::GridFast1 ( const TOOL_EVENT aEvent)

Definition at line 489 of file common_tools.cpp.

490{
492}
int GridPreset(const TOOL_EVENT &aEvent)
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
GRID_SETTINGS grid
Definition: app_settings.h:99

References EDA_BASE_FRAME::config(), GRID_SETTINGS::fast_grid_1, WINDOW_SETTINGS::grid, GridPreset(), m_frame, and APP_SETTINGS_BASE::m_Window.

Referenced by setTransitions().

◆ GridFast2()

int COMMON_TOOLS::GridFast2 ( const TOOL_EVENT aEvent)

◆ GridNext()

int COMMON_TOOLS::GridNext ( const TOOL_EVENT aEvent)

Definition at line 424 of file common_tools.cpp.

425{
426 int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
427
428 currentGrid++;
429
430 if( currentGrid >= int( m_grids.size() ) )
431 currentGrid = 0;
432
433 return OnGridChanged();
434}
std::vector< VECTOR2I > m_grids
Grids from #APP_SETTINGS converted to internal units and with the user grid appended.
Definition: common_tools.h:113

References TOOL_MANAGER::GetSettings(), WINDOW_SETTINGS::grid, GRID_SETTINGS::last_size_idx, m_grids, TOOL_BASE::m_toolMgr, APP_SETTINGS_BASE::m_Window, and OnGridChanged().

Referenced by setTransitions().

◆ GridPreset() [1/2]

int COMMON_TOOLS::GridPreset ( const TOOL_EVENT aEvent)

Definition at line 450 of file common_tools.cpp.

451{
452 return GridPreset( aEvent.Parameter<intptr_t>() );
453}

References GridPreset(), and TOOL_EVENT::Parameter().

Referenced by GridFast1(), GridFast2(), GridPreset(), and setTransitions().

◆ GridPreset() [2/2]

int COMMON_TOOLS::GridPreset ( int  idx)

Definition at line 456 of file common_tools.cpp.

457{
458 int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
459
460 currentGrid = std::max( 0, std::min( idx, (int) m_grids.size() - 1 ) );
461
462 return OnGridChanged();
463}

References TOOL_MANAGER::GetSettings(), WINDOW_SETTINGS::grid, GRID_SETTINGS::last_size_idx, m_grids, TOOL_BASE::m_toolMgr, APP_SETTINGS_BASE::m_Window, and OnGridChanged().

◆ GridPrev()

int COMMON_TOOLS::GridPrev ( const TOOL_EVENT aEvent)

Definition at line 437 of file common_tools.cpp.

438{
439 int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
440
441 currentGrid--;
442
443 if( currentGrid < 0 )
444 currentGrid = (int) m_grids.size() - 1;
445
446 return OnGridChanged();
447}

References TOOL_MANAGER::GetSettings(), WINDOW_SETTINGS::grid, GRID_SETTINGS::last_size_idx, m_grids, TOOL_BASE::m_toolMgr, APP_SETTINGS_BASE::m_Window, and OnGridChanged().

Referenced by setTransitions().

◆ GridProperties()

int COMMON_TOOLS::GridProperties ( const TOOL_EVENT aEvent)

Definition at line 509 of file common_tools.cpp.

510{
511 wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
512
513 cmd.SetId( ID_GRID_SETTINGS );
514 m_frame->ProcessEvent( cmd );
515
516 return 0;
517}
bool ProcessEvent(wxEvent &aEvent) override
Override the default process event handler to implement the auto save feature.
@ ID_GRID_SETTINGS
Definition: id.h:146

References ID_GRID_SETTINGS, m_frame, and EDA_BASE_FRAME::ProcessEvent().

Referenced by setTransitions().

◆ Init()

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

32{
34}
bool IsToolActive(TOOL_ID aId) const
Return true if a tool with given id is active (executing)

References TOOL_MANAGER::IsToolActive(), TOOL_BASE::m_toolId, and TOOL_BASE::m_toolMgr.

Referenced by EDIT_TOOL::Drag(), ROUTER_TOOL::handleLayerSwitch(), PCB_SELECTION_TOOL::Main(), BOARD_EDITOR_CONTROL::TrackWidthDec(), and BOARD_EDITOR_CONTROL::TrackWidthInc().

◆ OnGridChanged()

int COMMON_TOOLS::OnGridChanged ( )

Definition at line 466 of file common_tools.cpp.

467{
468 int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
469
470 currentGrid = std::max( 0, std::min( currentGrid, static_cast<int>( m_grids.size() ) - 1 ) );
471
472 // Update the combobox (if any)
473 wxUpdateUIEvent dummy;
475
476 // Update GAL canvas from screen
477 getView()->GetGAL()->SetGridSize( m_grids[ currentGrid ] );
480
481 // Put cursor on new grid
482 VECTOR2D gridCursor = getViewControls()->GetCursorPosition( true );
483 getViewControls()->SetCrossHairCursorPosition( gridCursor, false );
484
485 return 0;
486}
void OnUpdateSelectGrid(wxUpdateUIEvent &aEvent)
Update the checked item in the grid wxchoice.
void SetGridSize(const VECTOR2D &aGridSize)
Set the grid size.
void SetGridVisibility(bool aVisibility)
Set the visibility setting of the grid.
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Move the graphic crosshair cursor to the requested position expressed in world coordinates.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:617
@ TARGET_NONCACHED
Auxiliary rendering target (noncached)
Definition: definitions.h:49

References dummy, KIGFX::VIEW_CONTROLS::GetCursorPosition(), KIGFX::VIEW::GetGAL(), TOOL_MANAGER::GetSettings(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), WINDOW_SETTINGS::grid, GRID_SETTINGS::last_size_idx, m_frame, m_grids, TOOL_BASE::m_toolMgr, APP_SETTINGS_BASE::m_Window, KIGFX::VIEW::MarkTargetDirty(), EDA_DRAW_FRAME::OnUpdateSelectGrid(), KIGFX::VIEW_CONTROLS::SetCrossHairCursorPosition(), KIGFX::GAL::SetGridSize(), KIGFX::GAL::SetGridVisibility(), GRID_SETTINGS::show, and KIGFX::TARGET_NONCACHED.

Referenced by GridNext(), GridPreset(), GridPrev(), and Reset().

◆ PanControl()

int COMMON_TOOLS::PanControl ( const TOOL_EVENT aEvent)

Definition at line 170 of file common_tools.cpp.

171{
172 long type = aEvent.Parameter<intptr_t>();
173 KIGFX::VIEW* view = getView();
174 VECTOR2D center = view->GetCenter();
175 VECTOR2D gridSize = getView()->GetGAL()->GetGridSize() * 10;
176 bool mirroredX = view->IsMirroredX();
177
178 switch( type )
179 {
181 center -= VECTOR2D( 0, gridSize.y );
182 break;
183
185 center += VECTOR2D( 0, gridSize.y );
186 break;
187
189 center -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
190 break;
191
193 center += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
194 break;
195
196 default:
197 wxFAIL;
198 break;
199 }
200
201 view->SetCenter( center );
202
203 return 0;
204}

References ACTIONS::CURSOR_DOWN, ACTIONS::CURSOR_LEFT, ACTIONS::CURSOR_RIGHT, ACTIONS::CURSOR_UP, KIGFX::VIEW::GetGAL(), KIGFX::GAL::GetGridSize(), TOOL_BASE::getView(), TOOL_EVENT::Parameter(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

◆ Reset()

void COMMON_TOOLS::Reset ( RESET_REASON  aReason)
overridevirtual

Bring the tool to a known, initial state.

If the tool claimed anything from the model or the view, it must release it when its reset.

Parameters
aReasoncontains information about the reason of tool reset.

Implements TOOL_BASE.

Definition at line 53 of file common_tools.cpp.

54{
55 m_frame = getEditFrame<EDA_DRAW_FRAME>();
56
59
60 m_grids.clear();
61
62 for( const wxString& gridDef : settings.sizes )
63 {
65 gridDef );
66
67 m_grids.emplace_back( KiROUND<double, int>( gridSize ), KiROUND<double, int>( gridSize ) );
68 }
69
71 settings.user_grid_x );
73 settings.user_grid_y );
74
75 m_grids.emplace_back( KiROUND<double, int>( userGridX ), KiROUND<double, int>( userGridY ) );
76
78}
const EDA_IU_SCALE & GetIuScale() const
double DoubleValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Function DoubleValueFromString converts aTextValue to a double.
Definition: eda_units.cpp:445
Common grid settings, available to every frame.
Definition: app_settings.h:51
wxString user_grid_x
Definition: app_settings.h:54
wxString user_grid_y
Definition: app_settings.h:55
std::vector< wxString > sizes
Definition: app_settings.h:53

References EDA_UNIT_UTILS::UI::DoubleValueFromString(), UNITS_PROVIDER::GetIuScale(), TOOL_MANAGER::GetSettings(), WINDOW_SETTINGS::grid, m_frame, m_grids, TOOL_BASE::m_toolMgr, APP_SETTINGS_BASE::m_Window, MILLIMETRES, OnGridChanged(), scale, GRID_SETTINGS::sizes, GRID_SETTINGS::user_grid_x, and GRID_SETTINGS::user_grid_y.

◆ ResetLocalCoords()

int COMMON_TOOLS::ResetLocalCoords ( const TOOL_EVENT aEvent)

Definition at line 555 of file common_tools.cpp.

556{
557 auto vcSettings = m_toolMgr->GetCurrentToolVC();
558
559 // Use either the active tool forced cursor position or the general settings
560 if( vcSettings.m_forceCursorPosition )
561 m_frame->GetScreen()->m_LocalOrigin = vcSettings.m_forcedPosition;
562 else
564
566
567 return 0;
568}
VECTOR2D m_LocalOrigin
Relative Screen cursor coordinate (on grid) in user units.
Definition: base_screen.h:90
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
void UpdateStatusBar() override
Update the status bar information.
const KIGFX::VC_SETTINGS & GetCurrentToolVC() const
Return the view controls settings for the current tool or the general settings if there is no active ...

References TOOL_MANAGER::GetCurrentToolVC(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), EDA_DRAW_FRAME::GetScreen(), TOOL_BASE::getViewControls(), m_frame, BASE_SCREEN::m_LocalOrigin, TOOL_BASE::m_toolMgr, and EDA_DRAW_FRAME::UpdateStatusBar().

Referenced by setTransitions().

◆ resetTransitions()

void TOOL_INTERACTIVE::resetTransitions ( )
privateinherited

Clear the current transition map and restores the default one created by setTransitions().

Definition at line 63 of file tool_interactive.cpp.

64{
67}
virtual void setTransitions()=0
This method is meant to be overridden in order to specify handlers for events.
void ClearTransitions(TOOL_BASE *aTool)
Clear the state transition map for a tool.

References TOOL_MANAGER::ClearTransitions(), TOOL_BASE::m_toolMgr, and TOOL_INTERACTIVE::setTransitions().

◆ RunMainStack()

void TOOL_INTERACTIVE::RunMainStack ( std::function< void()>  aFunc)
inherited

Call a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

88{
89 m_toolMgr->RunMainStack( this, std::move( aFunc ) );
90}
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::RunMainStack().

Referenced by DRAWING_TOOL::PlaceText().

◆ SelectionTool()

int COMMON_TOOLS::SelectionTool ( const TOOL_EVENT aEvent)

Definition at line 92 of file common_tools.cpp.

93{
94 // Since selection tools are run permanently underneath the toolStack, this is really
95 // just a cancel of whatever other tools might be running.
96
98 return 0;
99}
@ TA_CANCEL_TOOL
Definition: tool_event.h:85
@ TC_COMMAND
Definition: tool_event.h:52

References TOOL_BASE::m_toolMgr, TOOL_MANAGER::ProcessEvent(), TA_CANCEL_TOOL, and TC_COMMAND.

Referenced by setTransitions().

◆ SetContextMenu()

void TOOL_INTERACTIVE::SetContextMenu ( ACTION_MENU aMenu,
CONTEXT_MENU_TRIGGER  aTrigger = CMENU_BUTTON 
)
inherited

Assign a context menu and tells when it should be activated.

Parameters
aMenuis the menu to be assigned.
aTriggerdetermines conditions upon which the context menu is activated.

Definition at line 76 of file tool_interactive.cpp.

77{
78 if( aMenu )
79 aMenu->SetTool( this );
80 else
81 aTrigger = CMENU_OFF;
82
83 m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
84}
void SetTool(TOOL_INTERACTIVE *aTool)
Set a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Set behavior of the tool's context popup menu.
@ CMENU_OFF
Definition: tool_event.h:149

References CMENU_OFF, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ScheduleContextMenu(), and ACTION_MENU::SetTool().

Referenced by SELECTION_TOOL::doSelectionMenu(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ SetLastUnits()

void COMMON_TOOLS::SetLastUnits ( EDA_UNITS  aUnit)

Definition at line 81 of file common_tools.cpp.

82{
84 m_imperialUnit = aUnit;
85 else if( EDA_UNIT_UTILS::IsMetricUnit( aUnit ) )
86 m_metricUnit = aUnit;
87 else
88 wxASSERT_MSG( false, wxS( "Invalid unit" ) );
89}
bool IsImperialUnit(EDA_UNITS aUnit)
Definition: eda_units.cpp:29
bool IsMetricUnit(EDA_UNITS aUnit)
Definition: eda_units.cpp:43

References EDA_UNIT_UTILS::IsImperialUnit(), EDA_UNIT_UTILS::IsMetricUnit(), m_imperialUnit, and m_metricUnit.

Referenced by EDA_DRAW_FRAME::setupUnits().

◆ setTransitions()

void COMMON_TOOLS::setTransitions ( )
overrideprivatevirtual

Pointer to the currently used edit frame.

Implements TOOL_INTERACTIVE.

Definition at line 613 of file common_tools.cpp.

614{
616
617 // Cursor control
626
630
631 // Pan control
636
637 // Zoom control
648
649 // Grid control
657
658 // Units and coordinates
665
666 // Misc
670}
static TOOL_ACTION gridProperties
Definition: actions.h:145
static TOOL_ACTION toggleGrid
Definition: actions.h:144
static TOOL_ACTION zoomRedraw
Definition: actions.h:93
static TOOL_ACTION millimetersUnits
Definition: actions.h:150
static TOOL_ACTION gridFast1
Definition: actions.h:137
static TOOL_ACTION gridPrev
Definition: actions.h:140
static TOOL_ACTION cursorLeft
Definition: actions.h:119
static TOOL_ACTION zoomOutCenter
Definition: actions.h:97
static TOOL_ACTION togglePolarCoords
Definition: actions.h:153
static TOOL_ACTION zoomIn
Definition: actions.h:94
static TOOL_ACTION cursorLeftFast
Definition: actions.h:124
static TOOL_ACTION gridPreset
Definition: actions.h:143
static TOOL_ACTION cursorDown
Definition: actions.h:118
static TOOL_ACTION zoomOut
Definition: actions.h:95
static TOOL_ACTION milsUnits
Definition: actions.h:149
static TOOL_ACTION cursorRightFast
Definition: actions.h:125
static TOOL_ACTION toggleBoundingBoxes
Definition: actions.h:108
static TOOL_ACTION showContextMenu
Definition: actions.h:64
static TOOL_ACTION toggleCursor
Definition: actions.h:104
static TOOL_ACTION centerContents
Definition: actions.h:103
static TOOL_ACTION zoomCenter
Definition: actions.h:98
static TOOL_ACTION panDown
Definition: actions.h:132
static TOOL_ACTION cursorDblClick
Definition: actions.h:128
static TOOL_ACTION cursorDownFast
Definition: actions.h:123
static TOOL_ACTION inchesUnits
Definition: actions.h:148
static TOOL_ACTION cursorUpFast
Definition: actions.h:122
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:105
static TOOL_ACTION panLeft
Definition: actions.h:133
static TOOL_ACTION selectionTool
Definition: actions.h:157
static TOOL_ACTION cursorClick
Definition: actions.h:127
static TOOL_ACTION zoomFitScreen
Definition: actions.h:99
static TOOL_ACTION zoomPreset
Definition: actions.h:101
static TOOL_ACTION panUp
Definition: actions.h:131
static TOOL_ACTION zoomFitObjects
Definition: actions.h:100
static TOOL_ACTION toggleUnits
Definition: actions.h:152
static TOOL_ACTION zoomInCenter
Definition: actions.h:96
static TOOL_ACTION panRight
Definition: actions.h:134
static TOOL_ACTION gridFast2
Definition: actions.h:138
static TOOL_ACTION cursorUp
Cursor control with keyboard.
Definition: actions.h:117
static TOOL_ACTION gridNext
Definition: actions.h:139
static TOOL_ACTION cursorRight
Definition: actions.h:120
static TOOL_ACTION resetLocalCoords
Definition: actions.h:154
int ZoomCenter(const TOOL_EVENT &aEvent)
int GridProperties(const TOOL_EVENT &aEvent)
int ToggleCursorStyle(const TOOL_EVENT &aEvent)
int PanControl(const TOOL_EVENT &aEvent)
int SwitchUnits(const TOOL_EVENT &aEvent)
int ToggleGrid(const TOOL_EVENT &aEvent)
int GridFast1(const TOOL_EVENT &aEvent)
int ToggleUnits(const TOOL_EVENT &aEvent)
int GridFast2(const TOOL_EVENT &aEvent)
int GridNext(const TOOL_EVENT &aEvent)
int ZoomPreset(const TOOL_EVENT &aEvent)
int ToggleBoundingBoxes(const TOOL_EVENT &aEvent)
int ToggleCursor(const TOOL_EVENT &aEvent)
int ZoomFitObjects(const TOOL_EVENT &aEvent)
int CenterContents(const TOOL_EVENT &aEvent)
int TogglePolarCoords(const TOOL_EVENT &aEvent)
int GridPrev(const TOOL_EVENT &aEvent)
int ZoomInOutCenter(const TOOL_EVENT &aEvent)
int ZoomRedraw(const TOOL_EVENT &aEvent)
int ResetLocalCoords(const TOOL_EVENT &aEvent)
int CursorControl(const TOOL_EVENT &aEvent)
int SelectionTool(const TOOL_EVENT &aEvent)
int ZoomInOut(const TOOL_EVENT &aEvent)
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).

References ACTIONS::centerContents, CenterContents(), ACTIONS::cursorClick, CursorControl(), ACTIONS::cursorDblClick, ACTIONS::cursorDown, ACTIONS::cursorDownFast, ACTIONS::cursorLeft, ACTIONS::cursorLeftFast, ACTIONS::cursorRight, ACTIONS::cursorRightFast, ACTIONS::cursorUp, ACTIONS::cursorUpFast, TOOL_INTERACTIVE::Go(), ACTIONS::gridFast1, GridFast1(), ACTIONS::gridFast2, GridFast2(), ACTIONS::gridNext, GridNext(), ACTIONS::gridPreset, GridPreset(), ACTIONS::gridPrev, GridPrev(), ACTIONS::gridProperties, GridProperties(), ACTIONS::inchesUnits, ACTIONS::millimetersUnits, ACTIONS::milsUnits, PanControl(), ACTIONS::panDown, ACTIONS::panLeft, ACTIONS::panRight, ACTIONS::panUp, ACTIONS::resetLocalCoords, ResetLocalCoords(), ACTIONS::selectionTool, SelectionTool(), ACTIONS::showContextMenu, SwitchUnits(), ACTIONS::toggleBoundingBoxes, ToggleBoundingBoxes(), ACTIONS::toggleCursor, ToggleCursor(), ACTIONS::toggleCursorStyle, ToggleCursorStyle(), ACTIONS::toggleGrid, ToggleGrid(), ACTIONS::togglePolarCoords, TogglePolarCoords(), ACTIONS::toggleUnits, ToggleUnits(), ACTIONS::zoomCenter, ZoomCenter(), ACTIONS::zoomFitObjects, ZoomFitObjects(), ACTIONS::zoomFitScreen, ZoomFitScreen(), ACTIONS::zoomIn, ACTIONS::zoomInCenter, ZoomInOut(), ZoomInOutCenter(), ACTIONS::zoomOut, ACTIONS::zoomOutCenter, ACTIONS::zoomPreset, ZoomPreset(), ACTIONS::zoomRedraw, and ZoomRedraw().

◆ SwitchUnits()

int COMMON_TOOLS::SwitchUnits ( const TOOL_EVENT aEvent)

Definition at line 520 of file common_tools.cpp.

521{
522 EDA_UNITS newUnit = aEvent.Parameter<EDA_UNITS>();
523
524 if( EDA_UNIT_UTILS::IsMetricUnit( newUnit ) )
525 m_metricUnit = newUnit;
526 else if( EDA_UNIT_UTILS::IsImperialUnit( newUnit ) )
527 m_imperialUnit = newUnit;
528 else
529 wxASSERT_MSG( false, wxS( "Invalid unit for the frame" ) );
530
531 m_frame->ChangeUserUnits( newUnit );
532 return 0;
533}
void ChangeUserUnits(EDA_UNITS aUnits)
EDA_UNITS
Definition: eda_units.h:43

References EDA_BASE_FRAME::ChangeUserUnits(), EDA_UNIT_UTILS::IsImperialUnit(), EDA_UNIT_UTILS::IsMetricUnit(), m_frame, m_imperialUnit, m_metricUnit, and TOOL_EVENT::Parameter().

Referenced by setTransitions().

◆ ToggleBoundingBoxes()

int COMMON_TOOLS::ToggleBoundingBoxes ( const TOOL_EVENT aEvent)

Definition at line 595 of file common_tools.cpp.

596{
598
599 if( canvas )
600 {
602
604
605 canvas->GetView()->UpdateAllItems( KIGFX::ALL );
606 canvas->ForceRefresh();
607 }
608
609 return 0;
610}
virtual KIGFX::VIEW * GetView() const
Return a pointer to the #VIEW instance used in the panel.
void ForceRefresh()
Force a redraw.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
void SetDrawBoundingBoxes(bool aEnabled)
bool GetDrawBoundingBoxes() const
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1484
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:213
@ ALL
All except INITIAL_ADD.
Definition: view_item.h:53

References KIGFX::ALL, EDA_DRAW_PANEL_GAL::ForceRefresh(), EDA_DRAW_FRAME::GetCanvas(), KIGFX::RENDER_SETTINGS::GetDrawBoundingBoxes(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), EDA_DRAW_PANEL_GAL::GetView(), m_frame, KIGFX::RENDER_SETTINGS::SetDrawBoundingBoxes(), and KIGFX::VIEW::UpdateAllItems().

Referenced by setTransitions().

◆ ToggleCursor()

int COMMON_TOOLS::ToggleCursor ( const TOOL_EVENT aEvent)

Definition at line 571 of file common_tools.cpp.

572{
573 auto& galOpts = m_frame->GetGalDisplayOptions();
574
575 galOpts.m_forceDisplayCursor = !galOpts.m_forceDisplayCursor;
576 galOpts.WriteConfig( m_toolMgr->GetSettings()->m_Window );
577 galOpts.NotifyChanged();
578
579 return 0;
580}
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
bool m_forceDisplayCursor
The pixel scale factor (>1 for hi-DPI scaled displays)

References EDA_DRAW_FRAME::GetGalDisplayOptions(), TOOL_MANAGER::GetSettings(), KIGFX::GAL_DISPLAY_OPTIONS::m_forceDisplayCursor, m_frame, TOOL_BASE::m_toolMgr, and APP_SETTINGS_BASE::m_Window.

Referenced by setTransitions().

◆ ToggleCursorStyle()

◆ ToggleGrid()

int COMMON_TOOLS::ToggleGrid ( const TOOL_EVENT aEvent)

Definition at line 501 of file common_tools.cpp.

502{
504
505 return 0;
506}
virtual void SetGridVisibility(bool aVisible)
bool IsGridVisible() const

References EDA_DRAW_FRAME::IsGridVisible(), m_frame, and EDA_DRAW_FRAME::SetGridVisibility().

Referenced by setTransitions().

◆ TogglePolarCoords()

int COMMON_TOOLS::TogglePolarCoords ( const TOOL_EVENT aEvent)

Definition at line 545 of file common_tools.cpp.

546{
547 m_frame->SetStatusText( wxEmptyString );
550
551 return 0;
552}
void SetShowPolarCoords(bool aShow)
bool GetShowPolarCoords() const
For those frames that support polar coordinates.

References EDA_DRAW_FRAME::GetShowPolarCoords(), m_frame, EDA_DRAW_FRAME::SetShowPolarCoords(), and EDA_DRAW_FRAME::UpdateStatusBar().

Referenced by setTransitions().

◆ ToggleUnits()

int COMMON_TOOLS::ToggleUnits ( const TOOL_EVENT aEvent)

◆ Wait()

TOOL_EVENT * TOOL_INTERACTIVE::Wait ( const TOOL_EVENT_LIST aEventList = TOOL_EVENTTC_ANYTA_ANY ))
inherited

Suspend execution of the tool until an event specified in aEventList arrives.

No parameters means waiting for any event.

Definition at line 57 of file tool_interactive.cpp.

58{
59 return m_toolMgr->ScheduleWait( this, aEventList );
60}
TOOL_EVENT * ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pause execution of a given tool until one or more events matching aConditions arrives.

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::ScheduleWait().

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SELECTION_TOOL::doSelectionMenu(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDA_3D_CONTROLLER::Main(), CVPCB_CONTROL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EE_POINT_EDITOR::Main(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), PL_SELECTION_TOOL::Main(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ ZoomCenter()

int COMMON_TOOLS::ZoomCenter ( const TOOL_EVENT aEvent)

Definition at line 270 of file common_tools.cpp.

271{
273
274 ctls->CenterOnCursor();
275
276 return 0;
277}
An interface for classes handling user events controlling the view behavior such as zooming,...

References KIGFX::VIEW_CONTROLS::CenterOnCursor(), and TOOL_BASE::getViewControls().

Referenced by setTransitions().

◆ ZoomFitObjects()

int COMMON_TOOLS::ZoomFitObjects ( const TOOL_EVENT aEvent)

Definition at line 286 of file common_tools.cpp.

287{
288 return doZoomFit( ZOOM_FIT_OBJECTS );
289}
int doZoomFit(ZOOM_FIT_TYPE_T aFitType)

References doZoomFit(), and ZOOM_FIT_OBJECTS.

Referenced by setTransitions().

◆ ZoomFitScreen()

int COMMON_TOOLS::ZoomFitScreen ( const TOOL_EVENT aEvent)

Definition at line 280 of file common_tools.cpp.

281{
282 return doZoomFit( ZOOM_FIT_ALL );
283}

References doZoomFit(), and ZOOM_FIT_ALL.

Referenced by doZoomToPreset(), and setTransitions().

◆ ZoomInOut()

int COMMON_TOOLS::ZoomInOut ( const TOOL_EVENT aEvent)

Definition at line 214 of file common_tools.cpp.

215{
216 bool direction = aEvent.IsAction( &ACTIONS::zoomIn );
217 return doZoomInOut( direction, true );
218}
int doZoomInOut(bool aDirection, bool aCenterOnCursor)
Note: idx == 0 is Auto; idx == 1 is first entry in zoomList.
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:81

References doZoomInOut(), TOOL_EVENT::IsAction(), and ACTIONS::zoomIn.

Referenced by setTransitions().

◆ ZoomInOutCenter()

int COMMON_TOOLS::ZoomInOutCenter ( const TOOL_EVENT aEvent)

Definition at line 221 of file common_tools.cpp.

222{
223 bool direction = aEvent.IsAction( &ACTIONS::zoomInCenter );
224 return doZoomInOut( direction, false );
225}

References doZoomInOut(), TOOL_EVENT::IsAction(), and ACTIONS::zoomInCenter.

Referenced by setTransitions().

◆ ZoomPreset()

int COMMON_TOOLS::ZoomPreset ( const TOOL_EVENT aEvent)

Definition at line 383 of file common_tools.cpp.

384{
385 unsigned int idx = aEvent.Parameter<intptr_t>();
386 return doZoomToPreset( (int) idx, false );
387}

References doZoomToPreset(), and TOOL_EVENT::Parameter().

Referenced by setTransitions().

◆ ZoomRedraw()

int COMMON_TOOLS::ZoomRedraw ( const TOOL_EVENT aEvent)

Definition at line 207 of file common_tools.cpp.

208{
210 return 0;
211}
virtual void HardRedraw()
Rebuild the GAL and redraws the screen.

References EDA_DRAW_FRAME::HardRedraw(), and m_frame.

Referenced by setTransitions().

Member Data Documentation

◆ m_frame

◆ m_grids

std::vector<VECTOR2I> COMMON_TOOLS::m_grids
private

Grids from #APP_SETTINGS converted to internal units and with the user grid appended.

Definition at line 113 of file common_tools.h.

Referenced by GridNext(), GridPreset(), GridPrev(), OnGridChanged(), and Reset().

◆ m_imperialUnit

EDA_UNITS COMMON_TOOLS::m_imperialUnit
private

Definition at line 117 of file common_tools.h.

Referenced by GetLastImperialUnits(), SetLastUnits(), SwitchUnits(), and ToggleUnits().

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

The functions below are not yet implemented - their interface may change.

Definition at line 125 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), EDA_3D_CONTROLLER::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< T >::Init(), SCH_DRAWING_TOOLS::Init(), SCH_EDIT_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), SYMBOL_EDITOR_DRAWING_TOOLS::Init(), GERBVIEW_SELECTION_TOOL::Init(), PICKER_TOOL::Init(), ZOOM_TOOL::Init(), PL_DRAWING_TOOLS::Init(), PL_EDIT_TOOL::Init(), PL_SELECTION_TOOL::Init(), LENGTH_TUNER_TOOL::Init(), ROUTER_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), DRAWING_TOOL::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), PAD_TOOL::Init(), PCB_SELECTION_TOOL::Init(), PCB_TOOL_BASE::Init(), PCB_VIEWER_TOOLS::Init(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDA_3D_CONTROLLER::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_SELECTION_TOOL::Main(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace().

◆ m_metricUnit

EDA_UNITS COMMON_TOOLS::m_metricUnit
private

Definition at line 118 of file common_tools.h.

Referenced by GetLastMetricUnits(), SetLastUnits(), SwitchUnits(), and ToggleUnits().

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Name of the tool.

Names are expected to obey the format application.ToolName (eg. pcbnew.InteractiveSelection).

Definition at line 210 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), TOOL_BASE::GetId(), and TOOL_BASE::IsToolActive().

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 215 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), SELECTION_TOOL::AddItemsToSel(), SELECTION_TOOL::AddItemToSel(), SCH_MOVE_TOOL::AlignElements(), SCH_EDITOR_CONTROL::AssignNetclass(), BOARD_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), EE_SELECTION_TOOL::autostartEvent(), SCH_EDIT_TOOL::BreakWire(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDITOR_CONTROL::ChangeLineMode(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), GERBVIEW_CONTROL::ClearAllLayers(), SCH_EDITOR_CONTROL::ClearHighlight(), BOARD_INSPECTION_TOOL::ClearHighlight(), GERBVIEW_SELECTION_TOOL::clearSelection(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), PL_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), MICROWAVE_TOOL::createInductorBetween(), EE_INSPECTION_TOOL::CrossProbe(), DRC_TOOL::CrossProbe(), CursorControl(), SCH_EDITOR_CONTROL::Cut(), SCH_EDIT_TOOL::DeleteItemCursor(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), EDIT_TOOL::DeleteItems(), SCH_EDITOR_CONTROL::doCopy(), BOARD_EDITOR_CONTROL::doCrossProbePcbToSch(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), SCH_EDIT_TOOL::DoDelete(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), BOARD_INSPECTION_TOOL::doHideRatsnestNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PCB_SELECTION_TOOL::doSyncSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), doZoomInOut(), doZoomToPreset(), EDIT_TOOL::Drag(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editShapeProperties(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), PCB_SELECTION_TOOL::EnterGroup(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), PAD_TOOL::EnumeratePads(), EE_INSPECTION_TOOL::ExcludeMarker(), PCB_SELECTION_TOOL::ExitGroup(), PCB_SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), PCB_SELECTION_TOOL::filterSelection(), PCB_SELECTION_TOOL::FindItem(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getToolHolderInt(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), PCB_SELECTION_TOOL::grabUnconnected(), GridNext(), GridPreset(), GridPrev(), PCB_CONTROL::GridSetOrigin(), GROUP_TOOL::Group(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightItem(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::HighlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PL_EDIT_TOOL::ImportDrawingSheetContent(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), EE_TOOL_BASE< T >::Init(), SCH_EDIT_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), SYMBOL_EDITOR_EDIT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), PL_EDIT_TOOL::Init(), PL_POINT_EDITOR::Init(), ROUTER_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), BOARD_INSPECTION_TOOL::Init(), BOARD_REANNOTATE_TOOL::Init(), CONVERT_TOOL::Init(), DRAWING_TOOL::Init(), EDIT_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), GROUP_TOOL::Init(), PAD_TOOL::Init(), PCB_POINT_EDITOR::Init(), PCB_SELECTION_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), POSITION_RELATIVE_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), GROUP_TOOL::LeaveGroup(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), EDA_3D_CONTROLLER::Main(), CVPCB_CONTROL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_SELECTION_TOOL::Main(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), SCH_EDITOR_CONTROL::NextLineMode(), SYMBOL_EDITOR_CONTROL::OnDeMorgan(), SELECTION_TOOL::onDisambiguationExpire(), OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_EDIT_TOOL::PinTable(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), GERBVIEW_CONTROL::Print(), PCB_CONTROL::Print(), SCH_EDIT_TOOL::Properties(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EDIT_TOOL::rebuildConnectivity(), ZONE_FILLER_TOOL::rebuildConnectivity(), EE_SELECTION_TOOL::RebuildSelection(), PAD_TOOL::RecombinePad(), SCH_EDITOR_CONTROL::Redo(), SYMBOL_EDITOR_EDIT_TOOL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), PCB_POINT_EDITOR::removeCorner(), GROUP_TOOL::RemoveFromGroup(), SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem(), PCB_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), EDA_3D_CONTROLLER::Reset(), Reset(), PNS::TOOL_BASE::Reset(), PAD_TOOL::Reset(), ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), SCH_EDITOR_CONTROL::Revert(), SCH_EDIT_TOOL::Rotate(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), ROUTER_TOOL::RouteSelected(), TOOL_INTERACTIVE::RunMainStack(), DRC_TOOL::RunTests(), EE_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::SelectAll(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectNet(), GERBVIEW_SELECTION_TOOL::selectPoint(), PL_SELECTION_TOOL::SelectPoint(), PCB_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), PCB_SELECTION_TOOL::selectSameSheet(), PCB_SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), EDA_3D_CONTROLLER::SetMaterial(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDIT_TOOL::Swap(), EE_SELECTION_TOOL::SyncSelection(), ToggleCursor(), ToggleCursorStyle(), EDA_3D_CONTROLLER::ToggleVisibility(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), SCH_MOVE_TOOL::trimDanglingLines(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_EDITOR_CONTROL::Undo(), SYMBOL_EDITOR_EDIT_TOOL::Undo(), GROUP_TOOL::Ungroup(), PCB_SELECTION_TOOL::unrouteSelected(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), PNS::TOOL_BASE::updateEndItem(), BOARD_INSPECTION_TOOL::UpdateLocalRatsnest(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCB_CONTROL::UpdateMessagePanel(), EDIT_TOOL::updateModificationPoint(), EE_POINT_EDITOR::updateParentItem(), PNS::TOOL_BASE::updateStartItem(), BOARD_EDITOR_CONTROL::ViaSizeDec(), BOARD_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), BOARD_EDITOR_CONTROL::ZoneDuplicate(), and BOARD_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Definition at line 214 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Unique identifier for the tool, assigned by a TOOL_MANAGER instance.

Definition at line 207 of file tool_base.h.

Referenced by TOOL_BASE::GetType().


The documentation for this class was generated from the following files: