KiCad PCB EDA Suite
COMMON_TOOLS Class Reference

COMMON_TOOLS. More...

#include <common_tools.h>

Inheritance diagram for COMMON_TOOLS:
TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 

Determines the reason of reset for a tool

More...
 

Public Member Functions

 COMMON_TOOLS ()
 
 ~COMMON_TOOLS () override
 
void Reset (RESET_REASON aReason) override
 Function Reset() Brings 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 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 ImperialUnits (const TOOL_EVENT &aEvent)
 
int MetricUnits (const TOOL_EVENT &aEvent)
 
int ToggleUnits (const TOOL_EVENT &aEvent)
 
int TogglePolarCoords (const TOOL_EVENT &aEvent)
 
int ResetLocalCoords (const TOOL_EVENT &aEvent)
 
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 ()
 
int SwitchCanvas (const TOOL_EVENT &aEvent)
 
void Activate ()
 Function Activate() Runs the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Function SetContextMenu() More...
 
void RunMainStack (std::function< void()> aFunc)
 Function RunMainStack() More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Go() More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Wait() More...
 
virtual bool Init ()
 Function Init() Init() is called once upon a registration of the tool. More...
 
TOOL_TYPE GetType () const
 Function GetType() Returns the type of the tool. More...
 
TOOL_ID GetId () const
 Function GetId() Returns the unique identifier of the tool. More...
 
const std::string & GetName () const
 Function GetName() Returns the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Protected Member Functions

void attachManager (TOOL_MANAGER *aManager)
 Function attachManager() More...
 
KIGFX::VIEWgetView () const
 Function getView() More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Function getViewControls() More...
 
template<typename T >
T * getEditFrame () const
 Function getEditFrame() More...
 
template<typename T >
T * getModel () const
 Function getModel() More...
 

Protected Attributes

TOOL_MENU m_menu
 functions below are not yet implemented - their interface may change More...
 
TOOL_TYPE m_type
 

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

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

More...
 
std::string m_toolName
 

Name of the tool.

More...
 
TOOL_MANAGERm_toolMgr
 

Private Member Functions

void setTransitions () override
 

Sets up handlers for various events.

More...
 
int doZoomInOut (bool aDirection, bool aCenterOnCursor)
 
int doZoomToPreset (int idx, bool aCenterOnCursor)
 

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

More...
 

Private Attributes

EDA_DRAW_FRAMEm_frame
 

Pointer to the currently used edit frame.

More...
 
std::vector< VECTOR2Im_grids
 

Detailed Description

COMMON_TOOLS.

Handles actions that are shared between different applications

Definition at line 38 of file common_tools.h.

Member Enumeration Documentation

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

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

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

Constructor & Destructor Documentation

◆ COMMON_TOOLS()

COMMON_TOOLS::COMMON_TOOLS ( )
inline

Definition at line 41 of file common_tools.h.

41  :
42  TOOL_INTERACTIVE( "common.Control" ),
43  m_frame( nullptr )
44  { }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:95
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Constructor.

◆ ~COMMON_TOOLS()

COMMON_TOOLS::~COMMON_TOOLS ( )
inlineoverride

Definition at line 46 of file common_tools.h.

46 { }

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Function Activate() Runs 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:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls 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(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::Move(), LIB_TREE::onContextMenu(), POINT_EDITOR::OnSelectionChange(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Function attachManager()

Sets 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:219

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ CenterContents()

int COMMON_TOOLS::CenterContents ( const TOOL_EVENT aEvent)

Definition at line 298 of file common_tools.cpp.

299 {
300  EDA_DRAW_PANEL_GAL* canvas = m_frame->GetCanvas();
301  BOX2I bBox = getModel<EDA_ITEM>()->ViewBBox();
302 
303  if( bBox.GetWidth() == 0 || bBox.GetHeight() == 0 )
304  bBox = canvas->GetDefaultViewBBox();
305 
306  getView()->SetCenter( bBox.Centre() );
307 
308  // Take scrollbars into account
309  VECTOR2D scrollbarSize = VECTOR2D( canvas->GetSize() - canvas->GetClientSize() );
310  VECTOR2D worldScrollbarSize = getView()->ToWorld( scrollbarSize, false );
311  getView()->SetCenter( getView()->GetCenter() + worldScrollbarSize / 2.0 );
312 
313  return 0;
314 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:95
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Function ToWorld() Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:475
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:604
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593
coord_type GetWidth() const
Definition: box2.h:196
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
Vec Centre() const
Definition: box2.h:78
coord_type GetHeight() const
Definition: box2.h:197
virtual BOX2I GetDefaultViewBBox() const
Returns the bounding box of the view that should be used if model is not valid For example,...

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

77 {
78  long type = aEvent.Parameter<intptr_t>();
79  bool fastMove = type & ACTIONS::CURSOR_FAST_MOVE;
80  type &= ~ACTIONS::CURSOR_FAST_MOVE;
81  bool mirroredX = getView()->IsMirroredX();
82 
83  VECTOR2D cursor = getViewControls()->GetRawCursorPosition( false );
84  VECTOR2D gridSize = getView()->GetGAL()->GetGridSize();
85 
86  if( fastMove )
87  gridSize = gridSize * 10;
88 
89  switch( type )
90  {
91  case ACTIONS::CURSOR_UP:
92  cursor -= VECTOR2D( 0, gridSize.y );
93  break;
94 
96  cursor += VECTOR2D( 0, gridSize.y );
97  break;
98 
100  cursor -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
101  break;
102 
104  cursor += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
105  break;
106 
107  case ACTIONS::CURSOR_CLICK: // fall through
110  {
111  TOOL_ACTIONS action = TA_MOUSE_CLICK;
112  TOOL_MOUSE_BUTTONS button = BUT_LEFT;
113  int modifiers = 0;
114 
115  modifiers |= wxGetKeyState( WXK_SHIFT ) ? MD_SHIFT : 0;
116  modifiers |= wxGetKeyState( WXK_CONTROL ) ? MD_CTRL : 0;
117  modifiers |= wxGetKeyState( WXK_ALT ) ? MD_ALT : 0;
118 
119  if( type == ACTIONS::CURSOR_DBL_CLICK )
120  action = TA_MOUSE_DBLCLICK;
121 
122  if( type == ACTIONS::CURSOR_RIGHT_CLICK )
123  button = BUT_RIGHT;
124 
125  TOOL_EVENT evt( TC_MOUSE, action, button | modifiers );
126  evt.SetMousePosition( getViewControls()->GetCursorPosition() );
127  m_toolMgr->ProcessEvent( evt );
128 
129  return 0;
130  }
131  default:
132  wxFAIL_MSG( "CursorControl(): unexpected request" );
133  }
134 
135  getViewControls()->SetCursorPosition( cursor, true, true, type );
137 
138  return 0;
139 }
TOOL_ACTIONS
Definition: tool_event.h:61
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
GAL * GetGAL() const
Function GetGAL() Returns the GAL this view is using to draw graphical primitives.
Definition: view.h:180
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Moves cursor to the requested position expressed in world coordinates.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
TOOL_EVENT.
Definition: tool_event.h:171
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
bool IsMirroredX() const
Function IsMirroredX() Returns true if view is flipped across the X axis.
Definition: view.h:230
TOOL_MOUSE_BUTTONS
Definition: tool_event.h:124
const VECTOR2D & GetGridSize() const
Returns the grid size.
virtual VECTOR2D GetRawCursorPosition(bool aSnappingEnabled=true) const =0
Returns the current cursor position in world coordinates - ingoring the cursorUp position force mode.
ACTIONS.
Definition: actions.h:43
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
static TOOL_ACTION refreshPreview
Definition: actions.h:101

References BUT_LEFT, BUT_RIGHT, 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(), TA_MOUSE_CLICK, TA_MOUSE_DBLCLICK, TC_MOUSE, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

◆ doZoomInOut()

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

Definition at line 200 of file common_tools.cpp.

201 {
202  double zoom = getView()->GetGAL()->GetZoomFactor() / ZOOM_COEFF;
203 
204  // Step must be AT LEAST 1.3
205  if( aDirection )
206  zoom *= 1.3;
207  else
208  zoom /= 1.3;
209 
210  // Now look for the next closest menu step
211  std::vector<double>& zoomList = m_toolMgr->GetSettings()->m_Window.zoom_factors;
212  int idx;
213 
214  if( aDirection )
215  {
216  for( idx = 0; idx < int( zoomList.size() ); ++idx )
217  {
218  if( zoomList[idx] >= zoom )
219  break;
220  }
221 
222  if( idx >= int( zoomList.size() ) )
223  idx = (int) zoomList.size() - 1; // if we ran off the end then peg to the end
224  }
225  else
226  {
227  for( idx = int( zoomList.size() ) - 1; idx >= 0; --idx )
228  {
229  if( zoomList[idx] <= zoom )
230  break;
231  }
232 
233  if( idx < 0 )
234  idx = 0; // if we ran off the end then peg to the end
235  }
236 
237  return doZoomToPreset( idx + 1, aCenterOnCursor );
238 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
GAL * GetGAL() const
Function GetGAL() Returns the GAL this view is using to draw graphical primitives.
Definition: view.h:180
#define ZOOM_COEFF
int doZoomToPreset(int idx, bool aCenterOnCursor)
Note: idx == 0 is Auto; idx == 1 is first entry in zoomList
std::vector< double > zoom_factors
Definition: app_settings.h:78
double GetZoomFactor() const
Get the zoom factor.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
WINDOW_SETTINGS m_Window
Definition: app_settings.h:153
APP_SETTINGS_BASE * GetSettings() const
Definition: tool_manager.h:293

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

Referenced by ZoomInOut(), and ZoomInOutCenter().

◆ doZoomToPreset()

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

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

Definition at line 325 of file common_tools.cpp.

326 {
327  std::vector<double>& zoomList = m_toolMgr->GetSettings()->m_Window.zoom_factors;
328 
329  if( idx == 0 ) // Zoom Auto
330  {
332  return ZoomFitScreen( dummy );
333  }
334  else
335  {
336  idx--;
337  }
338 
339  double scale = zoomList[idx] * ZOOM_COEFF;
340 
341  if( aCenterOnCursor )
342  {
343  getView()->SetScale( scale, getViewControls()->GetCursorPosition() );
344 
345  if( getViewControls()->IsCursorWarpingEnabled() )
347  }
348  else
349  {
350  getView()->SetScale( scale );
351  }
352 
353  return 0;
354 }
int ZoomFitScreen(const TOOL_EVENT &aEvent)
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
#define ZOOM_COEFF
std::vector< double > zoom_factors
Definition: app_settings.h:78
virtual void CenterOnCursor() const =0
Function CenterOnCursor() Sets the viewport center to the current cursor position and warps the curso...
TOOL_EVENT.
Definition: tool_event.h:171
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Function SetScale() Sets the scaling factor, zooming around a given anchor point.
Definition: view.cpp:578
WINDOW_SETTINGS m_Window
Definition: app_settings.h:153
const int scale
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
APP_SETTINGS_BASE * GetSettings() const
Definition: tool_manager.h:293

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(), ZOOM_COEFF, WINDOW_SETTINGS::zoom_factors, and ZoomFitScreen().

Referenced by doZoomInOut(), and ZoomPreset().

◆ getEditFrame()

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

Function getEditFrame()

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

Definition at line 187 of file tool_base.h.

188  {
189 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
190  wxASSERT( dynamic_cast<T*>( getToolHolderInt() ) );
191 #endif
192  return static_cast<T*>( getToolHolderInt() );
193  }
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

Function GetId() Returns 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  }
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214

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

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool.

Returns
Instance of the TOOL_MANAGER. If there is no TOOL_MANAGER associated, it returns NULL.

Definition at line 143 of file tool_base.h.

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

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

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 201 of file tool_base.h.

202  {
203  EDA_ITEM* m = getModelInt();
204 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
205  wxASSERT( dynamic_cast<T*>( m ) );
206 #endif
207  return static_cast<T*>( m );
208  }
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:54
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159

References TOOL_BASE::getModelInt().

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

◆ GetName()

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

Function GetName() Returns 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 132 of file tool_base.h.

133  {
134  return m_toolName;
135  }
std::string m_toolName
Name of the tool.
Definition: tool_base.h:218

References TOOL_BASE::m_toolName.

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

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 110 of file tool_base.h.

111  {
112  return m_type;
113  }
TOOL_TYPE m_type
Stores the type of the tool.
Definition: tool_base.h:211

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

Function getView()

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

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::checkPart(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), CursorControl(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_EDIT_TOOL::DoDelete(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), doZoomInOut(), doZoomToPreset(), MICROWAVE_TOOL::drawMicrowaveInductor(), PL_DRAWING_TOOLS::DrawShape(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_EDITOR_CONTROL::FindComponentAndItem(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), PCBNEW_CONTROL::GridResetOrigin(), PCBNEW_CONTROL::GridSetOrigin(), SELECTION_TOOL::GuessSelectionCandidates(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCB_INSPECTION_TOOL::highlightNet(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), PL_EDIT_TOOL::moveItem(), OnGridChanged(), POINT_EDITOR::OnSelectionChange(), PanControl(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PNS::TOOL_BASE::pickSingleItem(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), PCB_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SELECTION_TOOL::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), SELECTION_TOOL::Selectable(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), EE_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), PL_EDITOR_CONTROL::ToggleBackgroundColor(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), EE_POINT_EDITOR::updateItem(), PL_POINT_EDITOR::updateItem(), POINT_EDITOR::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateView(), PCB_VIEWER_TOOLS::view(), PCB_TOOL_BASE::view(), ZoomFitScreen(), SELECTION_TOOL::zoomFitSelection(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and SELECTION_TOOL::~SELECTION_TOOL().

◆ getViewControls()

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

Function getViewControls()

Returns 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:219
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:286

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

Referenced by EE_POINT_EDITOR::addCorner(), POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), doZoomToPreset(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::Move(), OnGridChanged(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LIB_DRAWING_TOOLS::PlaceAnchor(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_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(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PICKER_TOOL::setControls(), PCBNEW_PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), LIB_MOVE_TOOL::updateModificationPoint(), PL_EDIT_TOOL::updateModificationPoint(), 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

Function Go()

Defines which state (aStateFunc) to go when a certain event arrives (aConditions). No conditions means any event.

Definition at line 129 of file tool_interactive.h.

131 {
132  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
133 
134  goInternal( sptr, aConditions );
135 }
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 LENGTH_TUNER_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), AUTOPLACE_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), LIB_PIN_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), PL_POINT_EDITOR::setTransitions(), COMMON_CONTROL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), LIB_MOVE_TOOL::setTransitions(), LIB_DRAWING_TOOLS::setTransitions(), SCH_MOVE_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), POINT_EDITOR::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GERBVIEW_CONTROL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), LIB_EDIT_TOOL::setTransitions(), LIB_CONTROL::setTransitions(), PAD_TOOL::setTransitions(), PL_EDIT_TOOL::setTransitions(), FOOTPRINT_EDITOR_TOOLS::setTransitions(), SCH_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), PCBNEW_CONTROL::setTransitions(), setTransitions(), PCB_INSPECTION_TOOL::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), PCBNEW_PICKER_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), PCB_EDITOR_CONTROL::setTransitions(), DRC::setTransitions(), EDIT_TOOL::setTransitions(), DRAWING_TOOL::setTransitions(), SELECTION_TOOL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ GridFast1()

int COMMON_TOOLS::GridFast1 ( const TOOL_EVENT aEvent)

Definition at line 419 of file common_tools.cpp.

420 {
422 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:95
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:81
WINDOW_SETTINGS m_Window
Definition: app_settings.h:153

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

426 {
428 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:95
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:81
WINDOW_SETTINGS m_Window
Definition: app_settings.h:153

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

359 {
360  int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
361 
362  if( currentGrid + 1 < int( m_grids.size() ) )
363  currentGrid++;
364 
365  return OnGridChanged();
366 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
GRID_SETTINGS grid
Definition: app_settings.h:81
std::vector< VECTOR2I > m_grids
Definition: common_tools.h:102
WINDOW_SETTINGS m_Window
Definition: app_settings.h:153
APP_SETTINGS_BASE * GetSettings() const
Definition: tool_manager.h:293

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

381 {
382  return GridPreset( aEvent.Parameter<intptr_t>() );
383 }
int GridPreset(const TOOL_EVENT &aEvent)
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435

References TOOL_EVENT::Parameter().

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

◆ GridPreset() [2/2]

int COMMON_TOOLS::GridPreset ( int  idx)

Definition at line 386 of file common_tools.cpp.

387 {
388  int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
389 
390  currentGrid = std::max( 0, std::min( idx, (int) m_grids.size() - 1 ) );
391 
392  return OnGridChanged();
393 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
GRID_SETTINGS grid
Definition: app_settings.h:81
std::vector< VECTOR2I > m_grids
Definition: common_tools.h:102
WINDOW_SETTINGS m_Window
Definition: app_settings.h:153
APP_SETTINGS_BASE * GetSettings() const
Definition: tool_manager.h:293

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

370 {
371  int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
372 
373  if( currentGrid > 0 )
374  currentGrid--;
375 
376  return OnGridChanged();
377 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
GRID_SETTINGS grid
Definition: app_settings.h:81
WINDOW_SETTINGS m_Window
Definition: app_settings.h:153
APP_SETTINGS_BASE * GetSettings() const
Definition: tool_manager.h:293

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

440 {
441  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
442 
443  cmd.SetId( ID_GRID_SETTINGS );
444  m_frame->ProcessEvent( cmd );
445 
446  return 0;
447 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:95
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().

◆ ImperialUnits()

int COMMON_TOOLS::ImperialUnits ( const TOOL_EVENT aEvent)

Definition at line 457 of file common_tools.cpp.

458 {
460  return 0;
461 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:95
void ChangeUserUnits(EDA_UNITS aUnits)

References EDA_BASE_FRAME::ChangeUserUnits(), INCHES, and m_frame.

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:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool IsToolActive(TOOL_ID aId) const
Function IsToolActive() Returns true if a tool with given id is active (executing)

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

◆ MetricUnits()

int COMMON_TOOLS::MetricUnits ( const TOOL_EVENT aEvent)

Definition at line 450 of file common_tools.cpp.

451 {
453  return 0;
454 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:95
void ChangeUserUnits(EDA_UNITS aUnits)

References EDA_BASE_FRAME::ChangeUserUnits(), m_frame, and MILLIMETRES.

Referenced by setTransitions().

◆ OnGridChanged()

int COMMON_TOOLS::OnGridChanged ( )

Definition at line 396 of file common_tools.cpp.

397 {
398  int& currentGrid = m_toolMgr->GetSettings()->m_Window.grid.last_size_idx;
399 
400  currentGrid = std::max( 0, std::min( currentGrid, static_cast<int>( m_grids.size() ) - 1 ) );
401 
402  // Update the combobox (if any)
403  wxUpdateUIEvent dummy;
405 
406  // Update GAL canvas from screen
407  getView()->GetGAL()->SetGridSize( m_grids[ currentGrid ] );
410 
411  // Put cursor on new grid
412  VECTOR2D gridCursor = getViewControls()->GetCursorPosition( true );
413  getViewControls()->SetCrossHairCursorPosition( gridCursor, false );
414 
415  return 0;
416 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:95
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
GAL * GetGAL() const
Function GetGAL() Returns the GAL this view is using to draw graphical primitives.
Definition: view.h:180
Auxiliary rendering target (noncached)
Definition: definitions.h:49
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:585
GRID_SETTINGS grid
Definition: app_settings.h:81
void OnUpdateSelectGrid(wxUpdateUIEvent &aEvent)
Update the checked item in the grid combobox.
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves 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
Function getView()
Definition: tool_base.cpp:36
std::vector< VECTOR2I > m_grids
Definition: common_tools.h:102
WINDOW_SETTINGS m_Window
Definition: app_settings.h:153
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
void SetGridVisibility(bool aVisibility)
Sets the visibility setting of the grid.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
APP_SETTINGS_BASE * GetSettings() const
Definition: tool_manager.h:293
VECTOR2D GetCursorPosition() const
Returns 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 142 of file common_tools.cpp.

143 {
144  long type = aEvent.Parameter<intptr_t>();
145  KIGFX::VIEW* view = getView();
146  VECTOR2D center = view->GetCenter();
147  VECTOR2D gridSize = getView()->GetGAL()->GetGridSize() * 10;
148  bool mirroredX = view->IsMirroredX();
149 
150  switch( type )
151  {
152  case ACTIONS::CURSOR_UP:
153  center -= VECTOR2D( 0, gridSize.y );
154  break;
155 
157  center += VECTOR2D( 0, gridSize.y );
158  break;
159 
161  center -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
162  break;
163 
165  center += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
166  break;
167 
168  default:
169  wxFAIL;
170  break;
171  }
172 
173  view->SetCenter( center );
174 
175  return 0;
176 }
GAL * GetGAL() const
Function GetGAL() Returns the GAL this view is using to draw graphical primitives.
Definition: view.h:180
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
const VECTOR2D & GetGridSize() const
Returns the grid size.
VIEW.
Definition: view.h:61

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

Function Reset() Brings 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 44 of file common_tools.cpp.

45 {
46  m_frame = getEditFrame<EDA_DRAW_FRAME>();
47 
49 
50  m_grids.clear();
51 
52  for( const wxString& gridDef : settings.sizes )
53  {
54  int gridSize = (int) ValueFromString( EDA_UNITS::MILLIMETRES, gridDef, true );
55  m_grids.emplace_back( gridSize, gridSize );
56  }
57 
58  m_grids.emplace_back( ValueFromString( EDA_UNITS::MILLIMETRES, settings.user_grid_x, true ),
60 
61  OnGridChanged();
62 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:95
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:219
std::vector< wxString > sizes
Definition: app_settings.h:52
GRID_SETTINGS grid
Definition: app_settings.h:81
std::vector< VECTOR2I > m_grids
Definition: common_tools.h:102
WINDOW_SETTINGS m_Window
Definition: app_settings.h:153
long long int ValueFromString(EDA_UNITS aUnits, const wxString &aTextValue, bool aUseMils, EDA_DATA_TYPE aType)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application.
Definition: base_units.cpp:471
APP_SETTINGS_BASE * GetSettings() const
Definition: tool_manager.h:293
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 483 of file common_tools.cpp.

484 {
485  auto vcSettings = m_toolMgr->GetCurrentToolVC();
486 
487  // Use either the active tool forced cursor position or the general settings
488  if( vcSettings.m_forceCursorPosition )
489  m_frame->GetScreen()->m_LocalOrigin = vcSettings.m_forcedPosition;
490  else
492 
494 
495  return 0;
496 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:95
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
const KIGFX::VC_SETTINGS & GetCurrentToolVC() const
Returns 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
Function getViewControls()
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
Returns the current cursor position in world coordinates.
VECTOR2D m_LocalOrigin
Relative Screen cursor coordinate (on grid) in user units.
Definition: base_screen.h:64

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

Function RunMainStack()

Calls 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:219
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 65 of file common_tools.cpp.

66 {
67  // Since selection tools are run permanently underneath the toolStack, this is really
68  // just a cancel of whatever other tools might be running.
69 
71  return 0;
72 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
TOOL_EVENT.
Definition: tool_event.h:171

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

Function SetContextMenu()

Assigns 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:219
void SetTool(TOOL_INTERACTIVE *aTool)
Function SetTool() Sets a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Sets behaviour 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(), SELECTION_TOOL::doSelectionMenu(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ setTransitions()

void COMMON_TOOLS::setTransitions ( )
overrideprivatevirtual

Sets up handlers for various events.

Implements TOOL_INTERACTIVE.

Definition at line 534 of file common_tools.cpp.

535 {
537 
538  // Cursor control
547 
551 
552  // Pan control
553  Go( &COMMON_TOOLS::PanControl, ACTIONS::panUp.MakeEvent() );
557 
558  // Zoom control
560  Go( &COMMON_TOOLS::ZoomInOut, ACTIONS::zoomIn.MakeEvent() );
568 
569  // Grid control
577 
578  // Units and coordinates
584 
585  // Misc
590 }
int MetricUnits(const TOOL_EVENT &aEvent)
int ZoomFitScreen(const TOOL_EVENT &aEvent)
int GridFast1(const TOOL_EVENT &aEvent)
static TOOL_ACTION zoomPreset
Definition: actions.h:94
static TOOL_ACTION zoomInCenter
Definition: actions.h:90
int ToggleCursorStyle(const TOOL_EVENT &aEvent)
static TOOL_ACTION cursorRight
Definition: actions.h:111
static TOOL_ACTION zoomFitScreen
Definition: actions.h:93
static TOOL_ACTION standardGraphics
Definition: actions.h:159
static TOOL_ACTION cursorRightFast
Definition: actions.h:116
static TOOL_ACTION gridFast1
Definition: actions.h:128
int GridPreset(const TOOL_EVENT &aEvent)
static TOOL_ACTION panLeft
Definition: actions.h:124
int ResetLocalCoords(const TOOL_EVENT &aEvent)
static TOOL_ACTION imperialUnits
Definition: actions.h:139
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
int ImperialUnits(const TOOL_EVENT &aEvent)
static TOOL_ACTION zoomOutCenter
Definition: actions.h:91
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:96
static TOOL_ACTION gridFast2
Definition: actions.h:129
static TOOL_ACTION toggleCursor
Definition: actions.h:97
static TOOL_ACTION gridPreset
Definition: actions.h:134
static TOOL_ACTION gridPrev
Definition: actions.h:131
static TOOL_ACTION panDown
Definition: actions.h:123
int GridPrev(const TOOL_EVENT &aEvent)
static TOOL_ACTION toggleGrid
Definition: actions.h:135
static TOOL_ACTION cursorUpFast
Definition: actions.h:113
static TOOL_ACTION cursorDownFast
Definition: actions.h:114
static TOOL_ACTION cursorLeft
Definition: actions.h:110
static TOOL_ACTION panRight
Definition: actions.h:125
int ZoomCenter(const TOOL_EVENT &aEvent)
static TOOL_ACTION togglePolarCoords
Definition: actions.h:142
int ToggleGrid(const TOOL_EVENT &aEvent)
int ZoomInOut(const TOOL_EVENT &aEvent)
static TOOL_ACTION cursorLeftFast
Definition: actions.h:115
int CursorControl(const TOOL_EVENT &aEvent)
int ToggleCursor(const TOOL_EVENT &aEvent)
int SwitchCanvas(const TOOL_EVENT &aEvent)
int CenterContents(const TOOL_EVENT &aEvent)
static TOOL_ACTION metricUnits
Definition: actions.h:140
int SelectionTool(const TOOL_EVENT &aEvent)
static TOOL_ACTION zoomCenter
Definition: actions.h:92
static TOOL_ACTION cursorUp
Cursor control with keyboard.
Definition: actions.h:108
static TOOL_ACTION zoomRedraw
Definition: actions.h:87
static TOOL_ACTION cursorDblClick
Definition: actions.h:119
int ZoomPreset(const TOOL_EVENT &aEvent)
static TOOL_ACTION acceleratedGraphics
Definition: actions.h:158
static TOOL_ACTION resetLocalCoords
Definition: actions.h:143
static TOOL_ACTION gridNext
Definition: actions.h:130
static TOOL_ACTION gridProperties
Definition: actions.h:136
static TOOL_ACTION panUp
Definition: actions.h:122
static TOOL_ACTION zoomIn
Definition: actions.h:88
static TOOL_ACTION zoomOut
Definition: actions.h:89
int TogglePolarCoords(const TOOL_EVENT &aEvent)
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:98
static TOOL_ACTION showContextMenu
Definition: actions.h:66
static TOOL_ACTION cursorDown
Definition: actions.h:109
int PanControl(const TOOL_EVENT &aEvent)
int ZoomRedraw(const TOOL_EVENT &aEvent)
static TOOL_ACTION toggleUnits
Definition: actions.h:141
int GridProperties(const TOOL_EVENT &aEvent)
static TOOL_ACTION selectionTool
Definition: actions.h:146
static TOOL_ACTION cursorClick
Definition: actions.h:118

References ACTIONS::acceleratedGraphics, 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, ImperialUnits(), ACTIONS::imperialUnits, MetricUnits(), ACTIONS::metricUnits, PanControl(), ACTIONS::panDown, ACTIONS::panLeft, ACTIONS::panRight, ACTIONS::panUp, ResetLocalCoords(), ACTIONS::resetLocalCoords, SelectionTool(), ACTIONS::selectionTool, ACTIONS::showContextMenu, ACTIONS::standardGraphics, SwitchCanvas(), ToggleCursor(), ACTIONS::toggleCursor, ToggleCursorStyle(), ACTIONS::toggleCursorStyle, ToggleGrid(), ACTIONS::toggleGrid, TogglePolarCoords(), ACTIONS::togglePolarCoords, ToggleUnits(), ACTIONS::toggleUnits, ZoomCenter(), ACTIONS::zoomCenter, ZoomFitScreen(), ACTIONS::zoomFitScreen, ACTIONS::zoomIn, ACTIONS::zoomInCenter, ZoomInOut(), ZoomInOutCenter(), ACTIONS::zoomOut, ACTIONS::zoomOutCenter, ZoomPreset(), ACTIONS::zoomPreset, ZoomRedraw(), and ACTIONS::zoomRedraw.

◆ SwitchCanvas()

int COMMON_TOOLS::SwitchCanvas ( const TOOL_EVENT aEvent)

Definition at line 521 of file common_tools.cpp.

522 {
523  if( aEvent.IsAction( &ACTIONS::acceleratedGraphics ) )
525  else if( aEvent.IsAction( &ACTIONS::standardGraphics ) )
527  else
528  wxFAIL_MSG( "Unknown canvas type" );
529 
530  return 0;
531 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:95
static TOOL_ACTION standardGraphics
Definition: actions.h:159
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:67
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Changes the current rendering backend.
static TOOL_ACTION acceleratedGraphics
Definition: actions.h:158

References ACTIONS::acceleratedGraphics, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL, TOOL_EVENT::IsAction(), m_frame, ACTIONS::standardGraphics, and EDA_DRAW_FRAME::SwitchCanvas().

Referenced by setTransitions().

◆ ToggleCursor()

int COMMON_TOOLS::ToggleCursor ( const TOOL_EVENT aEvent)

Definition at line 499 of file common_tools.cpp.

500 {
501  auto& galOpts = m_frame->GetGalDisplayOptions();
502 
503  galOpts.m_forceDisplayCursor = !galOpts.m_forceDisplayCursor;
504  galOpts.NotifyChanged();
505 
506  return 0;
507 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:95
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
bool m_forceDisplayCursor
Force cursor display

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

511 {
513 
514  galOpts.m_fullscreenCursor = !galOpts.m_fullscreenCursor;
515  galOpts.NotifyChanged();
516 
517  return 0;
518 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:95
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
bool m_fullscreenCursor
Fullscreen crosshair or small cross

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

432 {
434 
435  return 0;
436 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:95
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 473 of file common_tools.cpp.

474 {
475  m_frame->SetStatusText( wxEmptyString );
478 
479  return 0;
480 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:95
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 464 of file common_tools.cpp.

465 {
469  return 0;
470 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:95
void ChangeUserUnits(EDA_UNITS aUnits)
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References EDA_BASE_FRAME::ChangeUserUnits(), EDA_BASE_FRAME::GetUserUnits(), INCHES, m_frame, and MILLIMETRES.

Referenced by setTransitions().

◆ Wait()

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

Function Wait()

Suspends 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:219
TOOL_EVENT * ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pauses 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(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::Move(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_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 241 of file common_tools.cpp.

242 {
244 
245  ctls->CenterOnCursor();
246 
247  return 0;
248 }
virtual void CenterOnCursor() const =0
Function CenterOnCursor() Sets the viewport center to the current cursor position and warps the curso...
VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (such a...
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42

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

Referenced by setTransitions().

◆ ZoomFitScreen()

int COMMON_TOOLS::ZoomFitScreen ( const TOOL_EVENT aEvent)

Definition at line 251 of file common_tools.cpp.

252 {
253  KIGFX::VIEW* view = getView();
254  EDA_DRAW_PANEL_GAL* canvas = m_frame->GetCanvas();
255  EDA_DRAW_FRAME* frame = getEditFrame<EDA_DRAW_FRAME>();
256 
257  BOX2I bBox = frame->GetDocumentExtents();
258  BOX2I defaultBox = canvas->GetDefaultViewBBox();
259  VECTOR2D scrollbarSize = VECTOR2D( canvas->GetSize() - canvas->GetClientSize() );
260 
261  view->SetScale( 1.0 ); // the best scale will be fixed later, from this initial value
262  // but this call ensure all view parameters are up to date
263  // especially at init time
264  VECTOR2D screenSize = view->ToWorld( canvas->GetClientSize(), false );
265 
266  if( bBox.GetWidth() == 0 || bBox.GetHeight() == 0 )
267  bBox = defaultBox;
268 
269  VECTOR2D vsize = bBox.GetSize();
270  double scale = view->GetScale() / std::max( fabs( vsize.x / screenSize.x ),
271  fabs( vsize.y / screenSize.y ) );
272 
273  // Reserve a 10% margin around component bounding box.
274  double margin_scale_factor = 1.1;
275 
276  // Leave a bigger margin for library editors & viewers
278  || frame->IsType( FRAME_SCH_VIEWER ) || frame->IsType( FRAME_SCH_VIEWER_MODAL ) )
279  {
280  margin_scale_factor = 1.4;
281  }
282  else if( frame->IsType( FRAME_SCH_LIB_EDITOR ) || frame->IsType( FRAME_FOOTPRINT_EDITOR ) )
283  {
284  margin_scale_factor = 2;
285  }
286 
287  view->SetScale( scale / margin_scale_factor );
288  view->SetCenter( bBox.Centre() );
289 
290  // Take scrollbars into account
291  VECTOR2D worldScrollbarSize = view->ToWorld( scrollbarSize, false );
292  view->SetCenter( view->GetCenter() + worldScrollbarSize / 2.0 );
293 
294  return 0;
295 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:95
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Function ToWorld() Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:475
const VECTOR2D & GetCenter() const
Function GetCenter() Returns the center point of this VIEW (in world space coordinates)
Definition: view.h:328
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)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:604
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593
coord_type GetWidth() const
Definition: box2.h:196
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Function SetScale() Sets the scaling factor, zooming around a given anchor point.
Definition: view.cpp:578
const int scale
bool IsType(FRAME_T aType) const
Vec Centre() const
Definition: box2.h:78
coord_type GetHeight() const
Definition: box2.h:197
const Vec & GetSize() const
Definition: box2.h:188
VIEW.
Definition: view.h:61
double GetScale() const
Function GetScale()
Definition: view.h:257
virtual BOX2I GetDefaultViewBBox() const
Returns the bounding box of the view that should be used if model is not valid For example,...
virtual const BOX2I GetDocumentExtents() const

References BOX2< Vec >::Centre(), FRAME_FOOTPRINT_EDITOR, FRAME_FOOTPRINT_VIEWER, FRAME_FOOTPRINT_VIEWER_MODAL, FRAME_SCH_LIB_EDITOR, FRAME_SCH_VIEWER, FRAME_SCH_VIEWER_MODAL, EDA_DRAW_FRAME::GetCanvas(), KIGFX::VIEW::GetCenter(), 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, and VECTOR2< T >::y.

Referenced by doZoomToPreset(), and setTransitions().

◆ ZoomInOut()

int COMMON_TOOLS::ZoomInOut ( const TOOL_EVENT aEvent)

Definition at line 186 of file common_tools.cpp.

187 {
188  bool direction = aEvent.IsAction( &ACTIONS::zoomIn );
189  return doZoomInOut( direction, true );
190 }
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:67
int doZoomInOut(bool aDirection, bool aCenterOnCursor)
static TOOL_ACTION zoomIn
Definition: actions.h:88

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

Referenced by setTransitions().

◆ ZoomInOutCenter()

int COMMON_TOOLS::ZoomInOutCenter ( const TOOL_EVENT aEvent)

Definition at line 193 of file common_tools.cpp.

194 {
195  bool direction = aEvent.IsAction( &ACTIONS::zoomInCenter );
196  return doZoomInOut( direction, false );
197 }
static TOOL_ACTION zoomInCenter
Definition: actions.h:90
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:67
int doZoomInOut(bool aDirection, bool aCenterOnCursor)

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

Referenced by setTransitions().

◆ ZoomPreset()

int COMMON_TOOLS::ZoomPreset ( const TOOL_EVENT aEvent)

Definition at line 317 of file common_tools.cpp.

318 {
319  unsigned int idx = aEvent.Parameter<intptr_t>();
320  return doZoomToPreset( (int) idx, false );
321 }
int doZoomToPreset(int idx, bool aCenterOnCursor)
Note: idx == 0 is Auto; idx == 1 is first entry in zoomList
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435

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

Referenced by setTransitions().

◆ ZoomRedraw()

int COMMON_TOOLS::ZoomRedraw ( const TOOL_EVENT aEvent)

Definition at line 179 of file common_tools.cpp.

180 {
181  m_frame->HardRedraw();
182  return 0;
183 }
EDA_DRAW_FRAME * m_frame
Pointer to the currently used edit frame.
Definition: common_tools.h:95
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

Definition at line 102 of file common_tools.h.

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

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

functions below are not yet implemented - their interface may change

Definition at line 108 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(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), PICKER_TOOL::Init(), PL_EDIT_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), SCH_EDIT_TOOL::Init(), LIB_DRAWING_TOOLS::Init(), FOOTPRINT_EDITOR_TOOLS::Init(), PCB_VIEWER_TOOLS::Init(), PL_DRAWING_TOOLS::Init(), LIB_CONTROL::Init(), PCB_EDITOR_CONTROL::Init(), SCH_DRAWING_TOOLS::Init(), EDA_3D_CONTROLLER::Init(), GERBVIEW_SELECTION_TOOL::Init(), PL_SELECTION_TOOL::Init(), DRAWING_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), EDIT_TOOL::Init(), SELECTION_TOOL::Init(), PCB_TOOL_BASE::Init(), PL_EDIT_TOOL::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

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

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

Referenced by TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::AddItemToSel(), SELECTION_TOOL::AddItemToSel(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), PCB_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), PL_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), LIB_EDIT_TOOL::Copy(), PL_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), MICROWAVE_TOOL::createInductorBetween(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), CursorControl(), ROUTER_TOOL::CustomTrackWidthDialog(), SCH_EDITOR_CONTROL::Cut(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), LIB_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), 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(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), PCB_EDITOR_CONTROL::EditFpInFpEditor(), LIB_EDIT_TOOL::editGraphicProperties(), PAD_TOOL::EditPad(), LIB_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), SELECTION_TOOL::filterSelection(), SELECTION_TOOL::findCallback(), SCH_EDITOR_CONTROL::FindComponentAndItem(), POINT_EDITOR::finishItem(), 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(), PCBNEW_CONTROL::GridSetOrigin(), GERBVIEW_CONTROL::HighlightControl(), PCB_INSPECTION_TOOL::HighlightItem(), PCB_INSPECTION_TOOL::HighlightNet(), PCB_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::ImportWorksheetContent(), LIB_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), PAD_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PL_DRAWING_TOOLS::Init(), LIB_CONTROL::Init(), PL_POINT_EDITOR::Init(), POINT_EDITOR::Init(), PCB_EDITOR_CONTROL::Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), TOOL_BASE::IsToolActive(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), LIB_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::Move(), EDIT_TOOL::MoveExact(), LIB_CONTROL::OnDeMorgan(), OnGridChanged(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), EDIT_TOOL::pickCopyReferencePoint(), LIB_EDIT_TOOL::PinTable(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCBNEW_CONTROL::Print(), GERBVIEW_CONTROL::Print(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), LIB_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), PL_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemFromSel(), PL_SELECTION_TOOL::RemoveItemsFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_DRAWING_TOOLS::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), Reset(), PNS::TOOL_BASE::Reset(), EDA_3D_CONTROLLER::Reset(), ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), LIB_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), DRC::RunTests(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), SELECTION_TOOL::SelectItems(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), PL_SELECTION_TOOL::SelectPoint(), GERBVIEW_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::SelectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), DRC::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), EDA_3D_CONTROLLER::ToggleVisibility(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), LIB_EDIT_TOOL::Undo(), SCH_EDITOR_CONTROL::Undo(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCBNEW_CONTROL::UpdateMessagePanel(), PCB_INSPECTION_TOOL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), PCB_EDITOR_CONTROL::ZoneDuplicate(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Name of the tool.

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

Definition at line 218 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 211 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: