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 }
 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 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)
 

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.

Definition at line 77 of file tool_base.h.

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

◆ 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 92 of file common_tools.h.

93  {
94  ZOOM_FIT_ALL,
96  };
Zoom to fall all items in view INCLUDING page and border.
Definition: common_tools.h:94
Zoom to fit all items in view EXCLUDING page and border.
Definition: common_tools.h:95

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_DRAW_FRAME * m_frame
Definition: common_tools.h:102
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Create a tool with given id & name.
EDA_UNITS m_imperialUnit
Definition: common_tools.h:115
EDA_UNITS m_metricUnit
Definition: common_tools.h:116

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:214
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209
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(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_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(), 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(), PCB_PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), LIB_TREE::onContextMenu(), PCB_POINT_EDITOR::OnSelectionChange(), GROUP_TOOL::PickNewMember(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_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 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ CenterContents()

int COMMON_TOOLS::CenterContents ( const TOOL_EVENT aEvent)

Definition at line 357 of file common_tools.cpp.

358 {
359  EDA_DRAW_PANEL_GAL* canvas = m_frame->GetCanvas();
360  BOX2I bBox = getModel<EDA_ITEM>()->ViewBBox();
361 
362  if( bBox.GetWidth() == 0 || bBox.GetHeight() == 0 )
363  bBox = canvas->GetDefaultViewBBox();
364 
365  getView()->SetCenter( bBox.Centre() );
366 
367  // Take scrollbars into account
368  VECTOR2D scrollbarSize = VECTOR2D( canvas->GetSize() - canvas->GetClientSize() );
369  VECTOR2D worldScrollbarSize = getView()->ToWorld( scrollbarSize, false );
370  getView()->SetCenter( getView()->GetCenter() + worldScrollbarSize / 2.0 );
371 
372  return 0;
373 }
EDA_DRAW_FRAME * m_frame
Definition: common_tools.h:102
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:452
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition: view.cpp:581
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
coord_type GetWidth() const
Definition: box2.h:180
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
Vec Centre() const
Definition: box2.h:63
coord_type GetHeight() const
Definition: box2.h:181
virtual BOX2I GetDefaultViewBBox() const
Return the bounding box of the view that should be used if model is not valid.

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(), and KIGFX::VIEW::ToWorld().

Referenced by setTransitions().

◆ CursorControl()

int COMMON_TOOLS::CursorControl ( const TOOL_EVENT aEvent)

Definition at line 96 of file common_tools.cpp.

97 {
98  long type = aEvent.Parameter<intptr_t>();
99  bool fastMove = type & ACTIONS::CURSOR_FAST_MOVE;
100  type &= ~ACTIONS::CURSOR_FAST_MOVE;
101  bool mirroredX = getView()->IsMirroredX();
102 
104  VECTOR2D gridSize = getView()->GetGAL()->GetGridSize();
105 
106  if( fastMove )
107  gridSize = gridSize * 10;
108 
109  switch( type )
110  {
111  case ACTIONS::CURSOR_UP:
112  cursor -= VECTOR2D( 0, gridSize.y );
113  break;
114 
116  cursor += VECTOR2D( 0, gridSize.y );
117  break;
118 
120  cursor -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
121  break;
122 
124  cursor += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
125  break;
126 
127  case ACTIONS::CURSOR_CLICK: // fall through
130  {
131  TOOL_ACTIONS action = TA_MOUSE_CLICK;
132  TOOL_MOUSE_BUTTONS button = BUT_LEFT;
133  int modifiers = 0;
134 
135  modifiers |= wxGetKeyState( WXK_SHIFT ) ? MD_SHIFT : 0;
136  modifiers |= wxGetKeyState( WXK_CONTROL ) ? MD_CTRL : 0;
137  modifiers |= wxGetKeyState( WXK_ALT ) ? MD_ALT : 0;
138 
139  if( type == ACTIONS::CURSOR_DBL_CLICK )
140  action = TA_MOUSE_DBLCLICK;
141 
142  if( type == ACTIONS::CURSOR_RIGHT_CLICK )
143  button = BUT_RIGHT;
144 
145  TOOL_EVENT evt( TC_MOUSE, action, button | modifiers );
146  evt.SetParameter( type );
147  evt.SetMousePosition( getViewControls()->GetCursorPosition() );
148  m_toolMgr->ProcessEvent( evt );
149 
150  return 0;
151  }
152  default:
153  wxFAIL_MSG( "CursorControl(): unexpected request" );
154  }
155 
156  getViewControls()->SetCursorPosition( cursor, true, true, type );
158 
159  return 0;
160 }
TOOL_ACTIONS
Definition: tool_event.h:57
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:190
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.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
Generic, UI-independent tool event.
Definition: tool_event.h:152
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
bool IsMirroredX() const
Return true if view is flipped across the X axis.
Definition: view.h:238
TOOL_MOUSE_BUTTONS
Definition: tool_event.h:123
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.
Gather all the actions that are shared by tools.
Definition: actions.h:40
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
static TOOL_ACTION refreshPreview
Definition: actions.h:106

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 285 of file common_tools.cpp.

286 {
287  KIGFX::VIEW* view = getView();
288  EDA_DRAW_PANEL_GAL* canvas = m_frame->GetCanvas();
289  EDA_DRAW_FRAME* frame = getEditFrame<EDA_DRAW_FRAME>();
290 
291  BOX2I bBox = frame->GetDocumentExtents();
292  BOX2I defaultBox = canvas->GetDefaultViewBBox();
293 
294  view->SetScale( 1.0 ); // The best scale will be determined later, but this initial
295  // value ensures all view parameters are up to date (especially
296  // at init time)
297  VECTOR2D screenSize = view->ToWorld( canvas->GetClientSize(), false );
298 
299  // Currently "Zoom to Objects" is only supported in Eeschema & Pcbnew. Support for other
300  // programs in the suite can be added as needed.
301 
302  if( aFitType == ZOOM_FIT_OBJECTS )
303  {
304  if( frame->IsType( FRAME_SCH ) || frame->IsType( FRAME_PCB_EDITOR ) )
305  bBox = m_frame->GetDocumentExtents( false );
306  else
307  aFitType = ZOOM_FIT_ALL; // Just do a "Zoom to Fit" for unsupported editors
308  }
309 
310  // If the screen is empty then use the default view bbox
311 
312  if( bBox.GetWidth() == 0 || bBox.GetHeight() == 0 )
313  bBox = defaultBox;
314 
315  VECTOR2D vsize = bBox.GetSize();
316  double scale = view->GetScale() / std::max( fabs( vsize.x / screenSize.x ),
317  fabs( vsize.y / screenSize.y ) );
318 
319  // if the scale isn't finite (most likely due to an empty canvas)
320  // simply just make sure we are centered and quit out of trying to zoom to fit
321  if( !std::isfinite( scale ) )
322  {
323  view->SetCenter( VECTOR2D( 0, 0 ) );
324  return 0;
325  }
326 
327  // Reserve enough margin to limit the amount of the view that might be obscured behind the
328  // infobar.
329  double margin_scale_factor = 1.04;
330 
331  if( canvas->GetClientSize().y < 768 )
332  margin_scale_factor = 1.10;
333 
334  if( aFitType == ZOOM_FIT_ALL )
335  {
336  // Leave a bigger margin for library editors & viewers
337 
339  || frame->IsType( FRAME_SCH_VIEWER ) || frame->IsType( FRAME_SCH_VIEWER_MODAL ) )
340  {
341  margin_scale_factor = 1.30;
342  }
343  else if( frame->IsType( FRAME_SCH_SYMBOL_EDITOR )
344  || frame->IsType( FRAME_FOOTPRINT_EDITOR ) )
345  {
346  margin_scale_factor = 1.48;
347  }
348  }
349 
350  view->SetScale( scale / margin_scale_factor );
351  view->SetCenter( bBox.Centre() );
352 
353  return 0;
354 }
EDA_DRAW_FRAME * m_frame
Definition: common_tools.h:102
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:452
Zoom to fall all items in view INCLUDING page and border.
Definition: common_tools.h:94
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
The base class for create windows for drawing purpose.
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition: view.cpp:581
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
coord_type GetWidth() const
Definition: box2.h:180
Zoom to fit all items in view EXCLUDING page and border.
Definition: common_tools.h:95
virtual const BOX2I GetDocumentExtents(bool aIncludeAllVisible=true) const
Returns bbox of document with option to not include some items.
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Set the scaling factor, zooming around a given anchor point.
Definition: view.cpp:555
const int scale
bool IsType(FRAME_T aType) const
Vec Centre() const
Definition: box2.h:63
coord_type GetHeight() const
Definition: box2.h:181
const Vec & GetSize() const
Definition: box2.h:172
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
double GetScale() const
Definition: view.h:264
virtual BOX2I GetDefaultViewBBox() const
Return the bounding box of the view that should be used if model is not valid.

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(), 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 221 of file common_tools.cpp.

222 {
223  double zoom = getView()->GetGAL()->GetZoomFactor();
224 
225  // Step must be AT LEAST 1.3
226  if( aDirection )
227  zoom *= 1.3;
228  else
229  zoom /= 1.3;
230 
231  // Now look for the next closest menu step
232  std::vector<double>& zoomList = m_toolMgr->GetSettings()->m_Window.zoom_factors;
233  int idx;
234 
235  if( aDirection )
236  {
237  for( idx = 0; idx < int( zoomList.size() ); ++idx )
238  {
239  if( zoomList[idx] >= zoom )
240  break;
241  }
242 
243  if( idx >= int( zoomList.size() ) )
244  idx = (int) zoomList.size() - 1; // if we ran off the end then peg to the end
245  }
246  else
247  {
248  for( idx = int( zoomList.size() ) - 1; idx >= 0; --idx )
249  {
250  if( zoomList[idx] <= zoom )
251  break;
252  }
253 
254  if( idx < 0 )
255  idx = 0; // if we ran off the end then peg to the end
256  }
257 
258  // Note: idx == 0 is Auto; idx == 1 is first entry in zoomList
259  return doZoomToPreset( idx + 1, aCenterOnCursor );
260 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:190
int doZoomToPreset(int idx, bool aCenterOnCursor)
std::vector< double > zoom_factors
Definition: app_settings.h:86
double GetZoomFactor() const
Get the zoom factor.
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
WINDOW_SETTINGS m_Window
Definition: app_settings.h:181
APP_SETTINGS_BASE * GetSettings() const
Definition: tool_manager.h:292

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 384 of file common_tools.cpp.

385 {
386  std::vector<double>& zoomList = m_toolMgr->GetSettings()->m_Window.zoom_factors;
387 
388  if( idx == 0 ) // Zoom Auto
389  {
391  return ZoomFitScreen( dummy );
392  }
393  else
394  {
395  idx--;
396  }
397 
398  double scale = zoomList[idx];
399 
400  if( aCenterOnCursor )
401  {
402  getView()->SetScale( scale, getViewControls()->GetCursorPosition() );
403 
404  if( getViewControls()->IsCursorWarpingEnabled() )
406  }
407  else
408  {
409  getView()->SetScale( scale );
410  }
411 
412  return 0;
413 }
int ZoomFitScreen(const TOOL_EVENT &aEvent)
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
std::vector< double > zoom_factors
Definition: app_settings.h:86
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:72
virtual void CenterOnCursor() const =0
Set the viewport center to the current cursor position and warps the cursor to the screen center.
Generic, UI-independent tool event.
Definition: tool_event.h:152
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Set the scaling factor, zooming around a given anchor point.
Definition: view.cpp:555
WINDOW_SETTINGS m_Window
Definition: app_settings.h:181
const int scale
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
APP_SETTINGS_BASE * GetSettings() const
Definition: tool_manager.h:292

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 184 of file tool_base.h.

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

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ 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 120 of file tool_base.h.

121  {
122  return m_toolId;
123  }
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209

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 75 of file common_tools.h.

75 { return m_imperialUnit; }
EDA_UNITS m_imperialUnit
Definition: common_tools.h:115

References m_imperialUnit.

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

◆ GetLastMetricUnits()

EDA_UNITS COMMON_TOOLS::GetLastMetricUnits ( )
inline

Definition at line 74 of file common_tools.h.

74 { return m_metricUnit; }
EDA_UNITS m_metricUnit
Definition: common_tools.h:116

References m_metricUnit.

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

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

Return the instance of TOOL_MANAGER that takes care of the tool.

Returns
Instance of the TOOL_MANAGER or NULL if there is no associated tool manager.

Definition at line 143 of file tool_base.h.

144  {
145  return m_toolMgr;
146  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214

References TOOL_BASE::m_toolMgr.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createNewZone(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ACTION_MENU::getToolManager(), LIB_TREE::onContextMenu(), ZONE_CREATE_HELPER::OnFirstPoint(), ACTION_MENU::OnMenuEvent(), and ZONE_CREATE_HELPER::performZoneCutout().

◆ 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 196 of file tool_base.h.

References TOOL_BASE::getModelInt().

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

◆ 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 133 of file tool_base.h.

134  {
135  return m_toolName;
136  }
std::string m_toolName
Definition: tool_base.h:213

References TOOL_BASE::m_toolName.

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

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 108 of file tool_base.h.

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

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:283
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214

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(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), doZoomFit(), doZoomInOut(), doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), PCB_CONTROL::GridResetOrigin(), PCB_CONTROL::GridSetOrigin(), ROUTER_TOOL::handleCommonEvents(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), PCB_SELECTION_TOOL::hitTestDistance(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineDrag(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), PL_EDIT_TOOL::moveItem(), OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), PanControl(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), ROUTER_TOOL::performRouting(), PNS::TOOL_BASE::pickSingleItem(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), ROUTER_TOOL::prepareInteractive(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), BOARD_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCB_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), PCB_SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), PCB_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::SelectAll(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), SCH_DRAWING_TOOLS::TwoClickPlace(), PL_SELECTION_TOOL::unhighlight(), EE_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_EDITOR_CONTROL::UpdateFind(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updateParentItem(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), PCB_SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), PCB_VIEWER_TOOLS::view(), PCB_TOOL_BASE::view(), 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 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:285

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

Referenced by EE_POINT_EDITOR::addCorner(), PCB_POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDITOR_CONTROL::AssignNetclass(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), EDIT_TOOL::copyToClipboard(), SCH_DRAWING_TOOLS::createSheetPin(), CursorControl(), 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(), 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_DRAWING_TOOLS::GetCanvasFreeAreaPixels(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), EE_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), 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(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), PCB_POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), PCB_SELECTION_TOOL::selectCursor(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PCB_PICKER_TOOL::setControls(), PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), PCB_POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_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 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:58
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)

References TOOL_INTERACTIVE::goInternal().

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

◆ GridFast1()

int COMMON_TOOLS::GridFast1 ( const TOOL_EVENT aEvent)

Definition at line 478 of file common_tools.cpp.

479 {
481 }
EDA_DRAW_FRAME * m_frame
Definition: common_tools.h:102
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
int GridPreset(const TOOL_EVENT &aEvent)
GRID_SETTINGS grid
Definition: app_settings.h:89
WINDOW_SETTINGS m_Window
Definition: app_settings.h:181

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)

Definition at line 484 of file common_tools.cpp.

485 {
487 }
EDA_DRAW_FRAME * m_frame
Definition: common_tools.h:102
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
int GridPreset(const TOOL_EVENT &aEvent)
GRID_SETTINGS grid
Definition: app_settings.h:89
WINDOW_SETTINGS m_Window
Definition: app_settings.h:181

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

Referenced by setTransitions().

◆ GridNext()

int COMMON_TOOLS::GridNext ( const TOOL_EVENT aEvent)

Definition at line 417 of file common_tools.cpp.

418 {
419  int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
420 
421  if( currentGrid + 1 < int( m_grids.size() ) )
422  currentGrid++;
423 
424  return OnGridChanged();
425 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
GRID_SETTINGS grid
Definition: app_settings.h:89
std::vector< VECTOR2I > m_grids
Grids from #APP_SETTINGS converted to internal units and with the user grid appended.
Definition: common_tools.h:111
WINDOW_SETTINGS m_Window
Definition: app_settings.h:181
APP_SETTINGS_BASE * GetSettings() const
Definition: tool_manager.h:292

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 439 of file common_tools.cpp.

440 {
441  return GridPreset( aEvent.Parameter<intptr_t>() );
442 }
int GridPreset(const TOOL_EVENT &aEvent)
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432

References TOOL_EVENT::Parameter().

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

◆ GridPreset() [2/2]

int COMMON_TOOLS::GridPreset ( int  idx)

Definition at line 445 of file common_tools.cpp.

446 {
447  int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
448 
449  currentGrid = std::max( 0, std::min( idx, (int) m_grids.size() - 1 ) );
450 
451  return OnGridChanged();
452 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
GRID_SETTINGS grid
Definition: app_settings.h:89
std::vector< VECTOR2I > m_grids
Grids from #APP_SETTINGS converted to internal units and with the user grid appended.
Definition: common_tools.h:111
WINDOW_SETTINGS m_Window
Definition: app_settings.h:181
APP_SETTINGS_BASE * GetSettings() const
Definition: tool_manager.h:292

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 428 of file common_tools.cpp.

429 {
430  int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
431 
432  if( currentGrid > 0 )
433  currentGrid--;
434 
435  return OnGridChanged();
436 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
GRID_SETTINGS grid
Definition: app_settings.h:89
WINDOW_SETTINGS m_Window
Definition: app_settings.h:181
APP_SETTINGS_BASE * GetSettings() const
Definition: tool_manager.h:292

References TOOL_MANAGER::GetSettings(), WINDOW_SETTINGS::grid, GRID_SETTINGS::last_size_idx, 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 498 of file common_tools.cpp.

499 {
500  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
501 
502  cmd.SetId( ID_GRID_SETTINGS );
503  m_frame->ProcessEvent( cmd );
504 
505  return 0;
506 }
EDA_DRAW_FRAME * m_frame
Definition: common_tools.h:102
bool ProcessEvent(wxEvent &aEvent) override
Override the default process event handler to implement the auto save feature.

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 {
33  return m_toolMgr->IsToolActive( m_toolId );
34 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209
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 ROUTER_TOOL::handleLayerSwitch(), EDIT_TOOL::isRouterActive(), PCB_SELECTION_TOOL::Main(), BOARD_EDITOR_CONTROL::TrackWidthDec(), and BOARD_EDITOR_CONTROL::TrackWidthInc().

◆ OnGridChanged()

int COMMON_TOOLS::OnGridChanged ( )

Definition at line 455 of file common_tools.cpp.

456 {
457  int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
458 
459  currentGrid = std::max( 0, std::min( currentGrid, static_cast<int>( m_grids.size() ) - 1 ) );
460 
461  // Update the combobox (if any)
462  wxUpdateUIEvent dummy;
464 
465  // Update GAL canvas from screen
466  getView()->GetGAL()->SetGridSize( m_grids[ currentGrid ] );
469 
470  // Put cursor on new grid
471  VECTOR2D gridCursor = getViewControls()->GetCursorPosition( true );
472  getViewControls()->SetCrossHairCursorPosition( gridCursor, false );
473 
474  return 0;
475 }
EDA_DRAW_FRAME * m_frame
Definition: common_tools.h:102
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:190
Auxiliary rendering target (noncached)
Definition: definitions.h:49
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:72
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:609
GRID_SETTINGS grid
Definition: app_settings.h:89
void OnUpdateSelectGrid(wxUpdateUIEvent &aEvent)
Update the checked item in the grid combobox.
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Move the graphic crosshair cursor to the requested position expressed in world coordinates.
void SetGridSize(const VECTOR2D &aGridSize)
Set the grid size.
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
std::vector< VECTOR2I > m_grids
Grids from #APP_SETTINGS converted to internal units and with the user grid appended.
Definition: common_tools.h:111
WINDOW_SETTINGS m_Window
Definition: app_settings.h:181
void SetGridVisibility(bool aVisibility)
Set the visibility setting of the grid.
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
APP_SETTINGS_BASE * GetSettings() const
Definition: tool_manager.h:292
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.

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 163 of file common_tools.cpp.

164 {
165  long type = aEvent.Parameter<intptr_t>();
166  KIGFX::VIEW* view = getView();
167  VECTOR2D center = view->GetCenter();
168  VECTOR2D gridSize = getView()->GetGAL()->GetGridSize() * 10;
169  bool mirroredX = view->IsMirroredX();
170 
171  switch( type )
172  {
173  case ACTIONS::CURSOR_UP:
174  center -= VECTOR2D( 0, gridSize.y );
175  break;
176 
178  center += VECTOR2D( 0, gridSize.y );
179  break;
180 
182  center -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
183  break;
184 
186  center += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
187  break;
188 
189  default:
190  wxFAIL;
191  break;
192  }
193 
194  view->SetCenter( center );
195 
196  return 0;
197 }
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:190
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
const VECTOR2D & GetGridSize() const
Return the grid size.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68

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 
58 
59  m_grids.clear();
60 
61  for( const wxString& gridDef : settings.sizes )
62  {
63  int gridSize = (int) ValueFromString( EDA_UNITS::MILLIMETRES, gridDef );
64  m_grids.emplace_back( gridSize, gridSize );
65  }
66 
67  m_grids.emplace_back( ValueFromString( EDA_UNITS::MILLIMETRES, settings.user_grid_x ),
69 
70  OnGridChanged();
71 }
EDA_DRAW_FRAME * m_frame
Definition: common_tools.h:102
wxString user_grid_y
Definition: app_settings.h:54
wxString user_grid_x
Definition: app_settings.h:53
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
std::vector< wxString > sizes
Definition: app_settings.h:52
long long int ValueFromString(EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application.
Definition: base_units.cpp:416
GRID_SETTINGS grid
Definition: app_settings.h:89
std::vector< VECTOR2I > m_grids
Grids from #APP_SETTINGS converted to internal units and with the user grid appended.
Definition: common_tools.h:111
WINDOW_SETTINGS m_Window
Definition: app_settings.h:181
APP_SETTINGS_BASE * GetSettings() const
Definition: tool_manager.h:292
Common grid settings, available to every frame.
Definition: app_settings.h:49

References TOOL_MANAGER::GetSettings(), WINDOW_SETTINGS::grid, m_frame, m_grids, TOOL_BASE::m_toolMgr, APP_SETTINGS_BASE::m_Window, MILLIMETRES, OnGridChanged(), GRID_SETTINGS::sizes, GRID_SETTINGS::user_grid_x, GRID_SETTINGS::user_grid_y, and ValueFromString().

◆ ResetLocalCoords()

int COMMON_TOOLS::ResetLocalCoords ( const TOOL_EVENT aEvent)

Definition at line 544 of file common_tools.cpp.

545 {
546  auto vcSettings = m_toolMgr->GetCurrentToolVC();
547 
548  // Use either the active tool forced cursor position or the general settings
549  if( vcSettings.m_forceCursorPosition )
550  m_frame->GetScreen()->m_LocalOrigin = vcSettings.m_forcedPosition;
551  else
553 
555 
556  return 0;
557 }
EDA_DRAW_FRAME * m_frame
Definition: common_tools.h:102
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
const KIGFX::VC_SETTINGS & GetCurrentToolVC() const
Return the view controls settings for the current tool or the general settings if there is no active ...
void UpdateStatusBar() override
Update the status bar information.
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
VECTOR2D m_LocalOrigin
Relative Screen cursor coordinate (on grid) in user units.
Definition: base_screen.h:90

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().

◆ 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 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
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 85 of file common_tools.cpp.

86 {
87  // Since selection tools are run permanently underneath the toolStack, this is really
88  // just a cancel of whatever other tools might be running.
89 
91  return 0;
92 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
Generic, UI-independent tool event.
Definition: tool_event.h:152

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 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
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.

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ SetLastUnits()

void COMMON_TOOLS::SetLastUnits ( EDA_UNITS  aUnit)

Definition at line 74 of file common_tools.cpp.

75 {
76  if( EDA_UNIT_UTILS::IsImperialUnit( aUnit ) )
77  m_imperialUnit = aUnit;
78  else if( EDA_UNIT_UTILS::IsMetricUnit( aUnit ) )
79  m_metricUnit = aUnit;
80  else
81  wxASSERT_MSG( false, "Invalid unit" );
82 }
bool IsImperialUnit(EDA_UNITS aUnit)
Definition: eda_units.cpp:26
bool IsMetricUnit(EDA_UNITS aUnit)
Definition: eda_units.cpp:42
EDA_UNITS m_imperialUnit
Definition: common_tools.h:115
EDA_UNITS m_metricUnit
Definition: common_tools.h:116

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 582 of file common_tools.cpp.

583 {
585 
586  // Cursor control
595 
599 
600  // Pan control
601  Go( &COMMON_TOOLS::PanControl, ACTIONS::panUp.MakeEvent() );
605 
606  // Zoom control
608  Go( &COMMON_TOOLS::ZoomInOut, ACTIONS::zoomIn.MakeEvent() );
617 
618  // Grid control
626 
627  // Units and coordinates
634 
635  // Misc
638 }
int ZoomFitScreen(const TOOL_EVENT &aEvent)
int GridFast1(const TOOL_EVENT &aEvent)
static TOOL_ACTION zoomPreset
Definition: actions.h:98
static TOOL_ACTION zoomInCenter
Definition: actions.h:93
int ToggleCursorStyle(const TOOL_EVENT &aEvent)
static TOOL_ACTION cursorRight
Definition: actions.h:116
static TOOL_ACTION zoomFitScreen
Definition: actions.h:96
static TOOL_ACTION millimetersUnits
Definition: actions.h:146
static TOOL_ACTION cursorRightFast
Definition: actions.h:121
static TOOL_ACTION gridFast1
Definition: actions.h:133
int GridPreset(const TOOL_EVENT &aEvent)
static TOOL_ACTION zoomFitObjects
Definition: actions.h:97
static TOOL_ACTION panLeft
Definition: actions.h:129
int ResetLocalCoords(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).
int SwitchUnits(const TOOL_EVENT &aEvent)
static TOOL_ACTION zoomOutCenter
Definition: actions.h:94
int GridNext(const TOOL_EVENT &aEvent)
int GridFast2(const TOOL_EVENT &aEvent)
int ToggleUnits(const TOOL_EVENT &aEvent)
int ZoomInOutCenter(const TOOL_EVENT &aEvent)
static TOOL_ACTION centerContents
Definition: actions.h:100
static TOOL_ACTION gridFast2
Definition: actions.h:134
static TOOL_ACTION toggleCursor
Definition: actions.h:101
static TOOL_ACTION gridPreset
Definition: actions.h:139
static TOOL_ACTION gridPrev
Definition: actions.h:136
static TOOL_ACTION panDown
Definition: actions.h:128
int GridPrev(const TOOL_EVENT &aEvent)
static TOOL_ACTION toggleGrid
Definition: actions.h:140
static TOOL_ACTION inchesUnits
Definition: actions.h:144
static TOOL_ACTION cursorUpFast
Definition: actions.h:118
static TOOL_ACTION cursorDownFast
Definition: actions.h:119
static TOOL_ACTION cursorLeft
Definition: actions.h:115
static TOOL_ACTION panRight
Definition: actions.h:130
int ZoomCenter(const TOOL_EVENT &aEvent)
static TOOL_ACTION togglePolarCoords
Definition: actions.h:149
int ToggleGrid(const TOOL_EVENT &aEvent)
int ZoomInOut(const TOOL_EVENT &aEvent)
static TOOL_ACTION cursorLeftFast
Definition: actions.h:120
int CursorControl(const TOOL_EVENT &aEvent)
int ToggleCursor(const TOOL_EVENT &aEvent)
static TOOL_ACTION milsUnits
Definition: actions.h:145
int CenterContents(const TOOL_EVENT &aEvent)
int SelectionTool(const TOOL_EVENT &aEvent)
static TOOL_ACTION zoomCenter
Definition: actions.h:95
static TOOL_ACTION cursorUp
Cursor control with keyboard.
Definition: actions.h:113
static TOOL_ACTION zoomRedraw
Definition: actions.h:90
static TOOL_ACTION cursorDblClick
Definition: actions.h:124
int ZoomPreset(const TOOL_EVENT &aEvent)
static TOOL_ACTION resetLocalCoords
Definition: actions.h:150
int ZoomFitObjects(const TOOL_EVENT &aEvent)
static TOOL_ACTION gridNext
Definition: actions.h:135
static TOOL_ACTION gridProperties
Definition: actions.h:141
static TOOL_ACTION panUp
Definition: actions.h:127
static TOOL_ACTION zoomIn
Definition: actions.h:91
static TOOL_ACTION zoomOut
Definition: actions.h:92
int TogglePolarCoords(const TOOL_EVENT &aEvent)
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:102
static TOOL_ACTION showContextMenu
Definition: actions.h:63
static TOOL_ACTION cursorDown
Definition: actions.h:114
int PanControl(const TOOL_EVENT &aEvent)
int ZoomRedraw(const TOOL_EVENT &aEvent)
static TOOL_ACTION toggleUnits
Definition: actions.h:148
int GridProperties(const TOOL_EVENT &aEvent)
static TOOL_ACTION selectionTool
Definition: actions.h:153
static TOOL_ACTION cursorClick
Definition: actions.h:123

References CenterContents(), ACTIONS::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(), GridFast1(), ACTIONS::gridFast1, GridFast2(), ACTIONS::gridFast2, GridNext(), ACTIONS::gridNext, GridPreset(), ACTIONS::gridPreset, GridPrev(), ACTIONS::gridPrev, GridProperties(), ACTIONS::gridProperties, ACTIONS::inchesUnits, ACTIONS::millimetersUnits, ACTIONS::milsUnits, PanControl(), ACTIONS::panDown, ACTIONS::panLeft, ACTIONS::panRight, ACTIONS::panUp, ResetLocalCoords(), ACTIONS::resetLocalCoords, SelectionTool(), ACTIONS::selectionTool, ACTIONS::showContextMenu, SwitchUnits(), ToggleCursor(), ACTIONS::toggleCursor, ToggleCursorStyle(), ACTIONS::toggleCursorStyle, ToggleGrid(), ACTIONS::toggleGrid, TogglePolarCoords(), ACTIONS::togglePolarCoords, ToggleUnits(), ACTIONS::toggleUnits, ZoomCenter(), ACTIONS::zoomCenter, ZoomFitObjects(), ACTIONS::zoomFitObjects, ZoomFitScreen(), ACTIONS::zoomFitScreen, ACTIONS::zoomIn, ACTIONS::zoomInCenter, ZoomInOut(), ZoomInOutCenter(), ACTIONS::zoomOut, ACTIONS::zoomOutCenter, ZoomPreset(), ACTIONS::zoomPreset, ZoomRedraw(), and ACTIONS::zoomRedraw.

◆ SwitchUnits()

int COMMON_TOOLS::SwitchUnits ( const TOOL_EVENT aEvent)

Definition at line 509 of file common_tools.cpp.

510 {
511  EDA_UNITS newUnit = aEvent.Parameter<EDA_UNITS>();
512 
513  if( EDA_UNIT_UTILS::IsMetricUnit( newUnit ) )
514  m_metricUnit = newUnit;
515  else if( EDA_UNIT_UTILS::IsImperialUnit( newUnit ) )
516  m_imperialUnit = newUnit;
517  else
518  wxASSERT_MSG( false, "Invalid unit for the frame" );
519 
520  m_frame->ChangeUserUnits( newUnit );
521  return 0;
522 }
EDA_DRAW_FRAME * m_frame
Definition: common_tools.h:102
void ChangeUserUnits(EDA_UNITS aUnits)
bool IsImperialUnit(EDA_UNITS aUnit)
Definition: eda_units.cpp:26
bool IsMetricUnit(EDA_UNITS aUnit)
Definition: eda_units.cpp:42
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
EDA_UNITS m_imperialUnit
Definition: common_tools.h:115
EDA_UNITS
Definition: eda_units.h:38
EDA_UNITS m_metricUnit
Definition: common_tools.h:116

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().

◆ ToggleCursor()

int COMMON_TOOLS::ToggleCursor ( const TOOL_EVENT aEvent)

Definition at line 560 of file common_tools.cpp.

561 {
562  auto& galOpts = m_frame->GetGalDisplayOptions();
563 
564  galOpts.m_forceDisplayCursor = !galOpts.m_forceDisplayCursor;
565  galOpts.NotifyChanged();
566 
567  return 0;
568 }
EDA_DRAW_FRAME * m_frame
Definition: common_tools.h:102
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(), KIGFX::GAL_DISPLAY_OPTIONS::m_forceDisplayCursor, and m_frame.

Referenced by setTransitions().

◆ ToggleCursorStyle()

int COMMON_TOOLS::ToggleCursorStyle ( const TOOL_EVENT aEvent)

Definition at line 571 of file common_tools.cpp.

572 {
574 
575  galOpts.m_fullscreenCursor = !galOpts.m_fullscreenCursor;
576  galOpts.NotifyChanged();
577 
578  return 0;
579 }
EDA_DRAW_FRAME * m_frame
Definition: common_tools.h:102
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
bool m_fullscreenCursor
Force cursor display.

References EDA_DRAW_FRAME::GetGalDisplayOptions(), m_frame, KIGFX::GAL_DISPLAY_OPTIONS::m_fullscreenCursor, and KIGFX::GAL_DISPLAY_OPTIONS::NotifyChanged().

Referenced by setTransitions().

◆ ToggleGrid()

int COMMON_TOOLS::ToggleGrid ( const TOOL_EVENT aEvent)

Definition at line 490 of file common_tools.cpp.

491 {
493 
494  return 0;
495 }
EDA_DRAW_FRAME * m_frame
Definition: common_tools.h:102
bool IsGridVisible() const
virtual void SetGridVisibility(bool aVisible)

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 534 of file common_tools.cpp.

535 {
536  m_frame->SetStatusText( wxEmptyString );
539 
540  return 0;
541 }
EDA_DRAW_FRAME * m_frame
Definition: common_tools.h:102
void SetShowPolarCoords(bool aShow)
bool GetShowPolarCoords() const
For those frames that support polar coordinates.
void UpdateStatusBar() override
Update the status bar information.

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)

Definition at line 525 of file common_tools.cpp.

526 {
528  m_metricUnit :
529  m_imperialUnit );
530  return 0;
531 }
EDA_DRAW_FRAME * m_frame
Definition: common_tools.h:102
void ChangeUserUnits(EDA_UNITS aUnits)
bool IsImperialUnit(EDA_UNITS aUnit)
Definition: eda_units.cpp:26
EDA_UNITS m_imperialUnit
Definition: common_tools.h:115
EDA_UNITS m_metricUnit
Definition: common_tools.h:116
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References EDA_BASE_FRAME::ChangeUserUnits(), EDA_BASE_FRAME::GetUserUnits(), EDA_UNIT_UTILS::IsImperialUnit(), m_frame, m_imperialUnit, and m_metricUnit.

Referenced by setTransitions().

◆ 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_MANAGER * m_toolMgr
Definition: tool_base.h:214
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 GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), ZOOM_TOOL::Main(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), CVPCB_CONTROL::Main(), PL_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ ZoomCenter()

int COMMON_TOOLS::ZoomCenter ( const TOOL_EVENT aEvent)

Definition at line 263 of file common_tools.cpp.

264 {
266 
267  ctls->CenterOnCursor();
268 
269  return 0;
270 }
virtual void CenterOnCursor() const =0
Set the viewport center to the current cursor position and warps the cursor to the screen center.
An interface for classes handling user events controlling the view behavior such as zooming,...
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42

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

Referenced by setTransitions().

◆ ZoomFitObjects()

int COMMON_TOOLS::ZoomFitObjects ( const TOOL_EVENT aEvent)

Definition at line 279 of file common_tools.cpp.

280 {
281  return doZoomFit( ZOOM_FIT_OBJECTS );
282 }
Zoom to fit all items in view EXCLUDING page and border.
Definition: common_tools.h:95
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 273 of file common_tools.cpp.

274 {
275  return doZoomFit( ZOOM_FIT_ALL );
276 }
Zoom to fall all items in view INCLUDING page and border.
Definition: common_tools.h:94
int doZoomFit(ZOOM_FIT_TYPE_T aFitType)

References doZoomFit(), and ZOOM_FIT_ALL.

Referenced by doZoomToPreset(), and setTransitions().

◆ ZoomInOut()

int COMMON_TOOLS::ZoomInOut ( const TOOL_EVENT aEvent)

Definition at line 207 of file common_tools.cpp.

208 {
209  bool direction = aEvent.IsAction( &ACTIONS::zoomIn );
210  return doZoomInOut( direction, true );
211 }
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:88
int doZoomInOut(bool aDirection, bool aCenterOnCursor)
Note: idx == 0 is Auto; idx == 1 is first entry in zoomList.
static TOOL_ACTION zoomIn
Definition: actions.h:91

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

Referenced by setTransitions().

◆ ZoomInOutCenter()

int COMMON_TOOLS::ZoomInOutCenter ( const TOOL_EVENT aEvent)

Definition at line 214 of file common_tools.cpp.

215 {
216  bool direction = aEvent.IsAction( &ACTIONS::zoomInCenter );
217  return doZoomInOut( direction, false );
218 }
static TOOL_ACTION zoomInCenter
Definition: actions.h:93
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:88
int doZoomInOut(bool aDirection, bool aCenterOnCursor)
Note: idx == 0 is Auto; idx == 1 is first entry in zoomList.

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

Referenced by setTransitions().

◆ ZoomPreset()

int COMMON_TOOLS::ZoomPreset ( const TOOL_EVENT aEvent)

Definition at line 376 of file common_tools.cpp.

377 {
378  unsigned int idx = aEvent.Parameter<intptr_t>();
379  return doZoomToPreset( (int) idx, false );
380 }
int doZoomToPreset(int idx, bool aCenterOnCursor)
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432

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

Referenced by setTransitions().

◆ ZoomRedraw()

int COMMON_TOOLS::ZoomRedraw ( const TOOL_EVENT aEvent)

Definition at line 200 of file common_tools.cpp.

201 {
202  m_frame->HardRedraw();
203  return 0;
204 }
EDA_DRAW_FRAME * m_frame
Definition: common_tools.h:102
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 111 of file common_tools.h.

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

◆ m_imperialUnit

EDA_UNITS COMMON_TOOLS::m_imperialUnit
private

Definition at line 115 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(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), ROUTER_TOOL::Init(), LENGTH_TUNER_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), PL_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_CONTROL::Init(), PCB_VIEWER_TOOLS::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), PL_SELECTION_TOOL::Init(), SCH_DRAWING_TOOLS::Init(), BOARD_EDITOR_CONTROL::Init(), GERBVIEW_SELECTION_TOOL::Init(), EDA_3D_CONTROLLER::Init(), DRAWING_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), PCB_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), PCB_TOOL_BASE::Init(), PICKER_TOOL::Init(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_PICKER_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PL_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_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::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_metricUnit

EDA_UNITS COMMON_TOOLS::m_metricUnit
private

Definition at line 116 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 209 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 214 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), PCB_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::AddItemToSel(), SCH_MOVE_TOOL::AlignElements(), SCH_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), SCH_EDIT_TOOL::BreakWire(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), GERBVIEW_CONTROL::ClearAllLayers(), BOARD_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), PL_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), PL_EDIT_TOOL::Copy(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), BOARD_INSPECTION_TOOL::CrossProbePcbToSch(), CursorControl(), SCH_EDITOR_CONTROL::Cut(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), PL_SELECTION_TOOL::disambiguateCursor(), EE_SELECTION_TOOL::disambiguateCursor(), PCB_SELECTION_TOOL::disambiguateCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), BOARD_INSPECTION_TOOL::doHideNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), doZoomInOut(), doZoomToPreset(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), DRAWING_TOOL::drawSegment(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::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(), SYMBOL_EDITOR_EDIT_TOOL::editGraphicProperties(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), EE_INSPECTION_TOOL::ExcludeMarker(), 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(), GridNext(), GridPreset(), GridPrev(), PCB_CONTROL::GridSetOrigin(), GROUP_TOOL::Group(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PL_EDIT_TOOL::ImportDrawingSheetContent(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), BOARD_REANNOTATE_TOOL::Init(), SYMBOL_EDITOR_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), GROUP_TOOL::Init(), PAD_TOOL::Init(), CONVERT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), GLOBAL_EDIT_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), PL_POINT_EDITOR::Init(), BOARD_INSPECTION_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PCB_POINT_EDITOR::Init(), BOARD_EDITOR_CONTROL::Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), GROUP_TOOL::LeaveGroup(), SCH_NAVIGATE_TOOL::LeaveSheet(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PCB_PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), CVPCB_CONTROL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), SYMBOL_EDITOR_CONTROL::OnDeMorgan(), PL_SELECTION_TOOL::onDisambiguationExpire(), EE_SELECTION_TOOL::onDisambiguationExpire(), PCB_SELECTION_TOOL::onDisambiguationExpire(), OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), PL_EDIT_TOOL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), 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::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_CONTROL::Print(), GERBVIEW_CONTROL::Print(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), SYMBOL_EDITOR_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), PCB_POINT_EDITOR::removeCorner(), GROUP_TOOL::RemoveFromGroup(), PL_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemFromSel(), PCB_SELECTION_TOOL::RemoveItemFromSel(), PL_SELECTION_TOOL::RemoveItemsFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), PCB_SELECTION_TOOL::RequestSelection(), Reset(), PNS::TOOL_BASE::Reset(), EDA_3D_CONTROLLER::Reset(), ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), DRC_TOOL::RunTests(), EE_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), PCB_SELECTION_TOOL::SelectItems(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectNet(), PL_SELECTION_TOOL::SelectPoint(), GERBVIEW_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::selectPoint(), PCB_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(), EDA_3D_CONTROLLER::ToggleVisibility(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_EDIT_TOOL::Undo(), SCH_EDITOR_CONTROL::Undo(), GROUP_TOOL::Ungroup(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), PCB_SELECTION_TOOL::UnselectItems(), PNS::TOOL_BASE::updateEndItem(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCB_CONTROL::UpdateMessagePanel(), EDIT_TOOL::updateModificationPoint(), BOARD_INSPECTION_TOOL::UpdateSelectionRatsnest(), 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 213 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 206 of file tool_base.h.

Referenced by TOOL_BASE::GetType(), and BOARD_COMMIT::Push().


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