KiCad PCB EDA Suite
Loading...
Searching...
No Matches
TOOL_MANAGER Class Reference

Master controller class: More...

#include <tool_manager.h>

Classes

struct  TOOL_STATE
 Struct describing the current execution state of a TOOL. More...
 

Public Types

typedef std::map< TOOL_BASE *, TOOL_STATE * > TOOL_STATE_MAP
 
typedef std::map< std::string, TOOL_STATE * > NAME_STATE_MAP
 
typedef std::map< TOOL_ID, TOOL_STATE * > ID_STATE_MAP
 
typedef std::list< TOOL_IDID_LIST
 

Public Member Functions

 TOOL_MANAGER ()
 
 ~TOOL_MANAGER ()
 
void RegisterTool (TOOL_BASE *aTool)
 Add a tool to the manager set and sets it up.
 
bool InvokeTool (TOOL_ID aToolId)
 Call a tool by sending a tool activation event to tool of given ID.
 
bool InvokeTool (const std::string &aToolName)
 Call a tool by sending a tool activation event to tool of given name.
 
void ShutdownAllTools ()
 Shutdown all tools with a currently registered event loop in this tool manager by waking them up with a null event.
 
void ShutdownTool (TOOL_BASE *aTool)
 Shutdown the specified tool by waking it up with a null event to terminate the processing loop.
 
void ShutdownTool (TOOL_ID aToolId)
 Shutdown the specified tool by waking it up with a null event to terminate the processing loop.
 
void ShutdownTool (const std::string &aToolName)
 Shutdown the specified tool by waking it up with a null event to terminate the processing loop.
 
template<typename T , std::enable_if_t<!std::is_convertible_v< T *, COMMIT * > > * = nullptr>
bool RunAction (const std::string &aActionName, T aParam)
 Run the specified action immediately, pausing the current action to run the new one.
 
bool RunAction (const std::string &aActionName)
 
template<typename T , std::enable_if_t<!std::is_convertible_v< T, COMMIT * > > * = nullptr>
bool RunAction (const TOOL_ACTION &aAction, T aParam)
 Run the specified action immediately, pausing the current action to run the new one.
 
template<typename T >
bool RunSynchronousAction (const TOOL_ACTION &aAction, COMMIT *aCommit, T aParam)
 Run the specified action immediately, pausing the current action to run the new one.
 
bool RunSynchronousAction (const TOOL_ACTION &aAction, COMMIT *aCommit)
 
bool RunAction (const TOOL_ACTION &aAction)
 
template<typename T >
bool PostAction (const std::string &aActionName, T aParam)
 Run the specified action after the current action (coroutine) ends.
 
bool PostAction (const std::string &aActionName)
 
template<typename T >
bool PostAction (const TOOL_ACTION &aAction, T aParam)
 Run the specified action after the current action (coroutine) ends.
 
void PostAction (const TOOL_ACTION &aAction)
 
bool PostAction (const TOOL_ACTION &aAction, COMMIT *aCommit)
 
void CancelTool ()
 Send a cancel event to the tool currently at the top of the tool stack.
 
void PrimeTool (const VECTOR2D &aPosition)
 "Prime" a tool by sending a cursor left-click event with the mouse position set to the passed in position.
 
int GetHotKey (const TOOL_ACTION &aAction) const
 
ACTION_MANAGERGetActionManager () const
 
TOOL_BASEFindTool (int aId) const
 Search for a tool with given ID.
 
TOOL_BASEFindTool (const std::string &aName) const
 Search for a tool with given name.
 
template<typename T >
T * GetTool ()
 
std::vector< TOOL_BASE * > Tools ()
 
void DeactivateTool ()
 Deactivate the currently active tool.
 
bool IsToolActive (TOOL_ID aId) const
 Return true if a tool with given id is active (executing)
 
void ResetTools (TOOL_BASE::RESET_REASON aReason)
 Reset all tools (i.e.
 
void InitTools ()
 Initializes all registered tools.
 
bool ProcessEvent (const TOOL_EVENT &aEvent)
 Propagate an event to tools that requested events of matching type(s).
 
void PostEvent (const TOOL_EVENT &aEvent)
 Put an event to the event queue to be processed at the end of event processing cycle.
 
void SetEnvironment (EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
 Set the work environment (model, view, view controls and the parent window).
 
KIGFX::VIEWGetView () const
 
KIGFX::VIEW_CONTROLSGetViewControls () const
 
VECTOR2D GetMousePosition () const
 
VECTOR2D GetCursorPosition () const
 
EDA_ITEMGetModel () const
 
APP_SETTINGS_BASEGetSettings () const
 
TOOLS_HOLDERGetToolHolder () const
 
int GetCurrentToolId () const
 Return id of the tool that is on the top of the active tools stack (was invoked the most recently).
 
TOOL_BASEGetCurrentTool () const
 Return the tool that is on the top of the active tools stack (was invoked the most recently).
 
TOOL_STATEGetCurrentToolState () const
 Return the #TOOL_STATE object representing the state of the active tool.
 
int GetPriority (int aToolId) const
 Return priority of a given tool.
 
void ScheduleNextState (TOOL_BASE *aTool, TOOL_STATE_FUNC &aHandler, const TOOL_EVENT_LIST &aConditions)
 Define a state transition.
 
void ClearTransitions (TOOL_BASE *aTool)
 Clear the state transition map for a tool.
 
void RunMainStack (TOOL_BASE *aTool, std::function< void()> aFunc)
 
void UpdateUI (const TOOL_EVENT &aEvent)
 Update the status bar and synchronizes toolbars.
 
TOOL_EVENTScheduleWait (TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
 Pause execution of a given tool until one or more events matching aConditions arrives.
 
void ScheduleContextMenu (TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
 Set behavior of the tool's context popup menu.
 
bool SaveClipboard (const std::string &aTextUTF8)
 Store information to the system clipboard.
 
std::string GetClipboardUTF8 () const
 Return the information currently stored in the system clipboard.
 
const KIGFX::VC_SETTINGSGetCurrentToolVC () const
 Return the view controls settings for the current tool or the general settings if there is no active tool.
 
bool IsContextMenuActive () const
 True while processing a context menu.
 
void VetoContextMenuMouseWarp ()
 Disable mouse warping after the current context menu is closed.
 
void DispatchContextMenu (const TOOL_EVENT &aEvent)
 Handle context menu related events.
 
bool DispatchHotKey (const TOOL_EVENT &aEvent)
 Handle specific events, that are intended for TOOL_MANAGER rather than tools.
 
VECTOR2D GetMenuCursorPos () const
 

Static Public Member Functions

static TOOL_ID MakeToolId (const std::string &aToolName)
 Generates a unique ID from for a tool with given name.
 

Private Types

typedef std::pair< TOOL_EVENT_LIST, TOOL_STATE_FUNCTRANSITION
 

Private Member Functions

bool doRunAction (const TOOL_ACTION &aAction, bool aNow, const std::any &aParam, COMMIT *aCommit)
 Helper function to actually run an action.
 
bool doRunAction (const std::string &aActionName, bool aNow, const std::any &aParam, COMMIT *aCommit)
 
bool dispatchInternal (TOOL_EVENT &aEvent)
 Pass an event at first to the active tools, then to all others.
 
bool dispatchActivation (const TOOL_EVENT &aEvent)
 Check if it is a valid activation event and invokes a proper tool.
 
bool invokeTool (TOOL_BASE *aTool)
 Invoke a tool by sending a proper event (in contrary to runTool, which makes the tool run for real).
 
bool runTool (TOOL_BASE *aTool)
 Make a tool active, so it can receive events and react to them.
 
ID_LIST::iterator finishTool (TOOL_STATE *aState)
 Deactivate a tool and does the necessary clean up.
 
bool isRegistered (TOOL_BASE *aTool) const
 Return information about a tool registration status.
 
bool isActive (TOOL_BASE *aTool) const
 Return information about a tool activation status.
 
void saveViewControls (TOOL_STATE *aState)
 Save the #VIEW_CONTROLS settings to the tool state object.
 
void applyViewControls (const TOOL_STATE *aState)
 Apply #VIEW_CONTROLS settings stored in a #TOOL_STATE object.
 
bool processEvent (const TOOL_EVENT &aEvent)
 Main function for event processing.
 
void setActiveState (TOOL_STATE *aState)
 Save the previous active state and sets a new one.
 

Private Attributes

std::vector< TOOL_BASE * > m_toolOrder
 Index of registered tools current states, associated by tools' objects.
 
TOOL_STATE_MAP m_toolState
 Index of the registered tools current states, associated by tools' names.
 
NAME_STATE_MAP m_toolNameIndex
 Index of the registered tools current states, associated by tools' ID numbers.
 
ID_STATE_MAP m_toolIdIndex
 Index of the registered tools to easily lookup by their type.
 
std::map< const char *, TOOL_BASE * > m_toolTypes
 Stack of the active tools.
 
ID_LIST m_activeTools
 Instance of ACTION_MANAGER that handles TOOL_ACTIONs.
 
ACTION_MANAGERm_actionMgr
 Original cursor position, if overridden by the context menu handler.
 
std::map< TOOL_ID, std::optional< VECTOR2D > > m_cursorSettings
 
EDA_ITEMm_model
 
KIGFX::VIEWm_view
 
KIGFX::VIEW_CONTROLSm_viewControls
 
TOOLS_HOLDERm_frame
 
APP_SETTINGS_BASEm_settings
 Queue that stores events to be processed at the end of the event processing cycle.
 
std::list< TOOL_EVENTm_eventQueue
 Right click context menu position.
 
VECTOR2D m_menuCursor
 
bool m_warpMouseAfterContextMenu
 Flag indicating whether a context menu is currently displayed.
 
bool m_menuActive
 Tool currently displaying a popup menu. It is negative when there is no menu displayed.
 
TOOL_ID m_menuOwner
 Pointer to the state object corresponding to the currently executed tool.
 
TOOL_STATEm_activeState
 True if the tool manager is shutting down (don't process additional events)
 
bool m_shuttingDown
 

Detailed Description

Master controller class:

  • registers editing tools
  • pumps UI events to tools requesting them
  • manages tool state machines (transitions and wait requests)

Definition at line 56 of file tool_manager.h.

Member Typedef Documentation

◆ ID_LIST

typedef std::list<TOOL_ID> TOOL_MANAGER::ID_LIST

Definition at line 70 of file tool_manager.h.

◆ ID_STATE_MAP

Definition at line 69 of file tool_manager.h.

◆ NAME_STATE_MAP

typedef std::map<std::string, TOOL_STATE*> TOOL_MANAGER::NAME_STATE_MAP

Definition at line 68 of file tool_manager.h.

◆ TOOL_STATE_MAP

Definition at line 67 of file tool_manager.h.

◆ TRANSITION

Definition at line 549 of file tool_manager.h.

Constructor & Destructor Documentation

◆ TOOL_MANAGER()

TOOL_MANAGER::TOOL_MANAGER ( )

Definition at line 208 of file tool_manager.cpp.

References m_actionMgr.

◆ ~TOOL_MANAGER()

TOOL_MANAGER::~TOOL_MANAGER ( )

Definition at line 224 of file tool_manager.cpp.

References m_actionMgr, and m_toolState.

Member Function Documentation

◆ applyViewControls()

void TOOL_MANAGER::applyViewControls ( const TOOL_STATE aState)
private

Apply #VIEW_CONTROLS settings stored in a #TOOL_STATE object.

Definition at line 1173 of file tool_manager.cpp.

References KIGFX::VIEW_CONTROLS::ApplySettings(), m_viewControls, and TOOL_MANAGER::TOOL_STATE::vcSettings.

Referenced by setActiveState().

◆ CancelTool()

void TOOL_MANAGER::CancelTool ( )

Send a cancel event to the tool currently at the top of the tool stack.

Definition at line 387 of file tool_manager.cpp.

References processEvent(), TA_CANCEL_TOOL, and TC_COMMAND.

Referenced by ACTION_TOOLBAR::onToolEvent().

◆ ClearTransitions()

void TOOL_MANAGER::ClearTransitions ( TOOL_BASE aTool)

Clear the state transition map for a tool.

Parameters
aToolis the tool that should have the transition map cleared.

Definition at line 688 of file tool_manager.cpp.

References m_toolState.

Referenced by TOOL_INTERACTIVE::resetTransitions().

◆ DeactivateTool()

◆ dispatchActivation()

bool TOOL_MANAGER::dispatchActivation ( const TOOL_EVENT aEvent)
private

Check if it is a valid activation event and invokes a proper tool.

Parameters
aEventis an event to be tested.
Returns
True if a tool was invoked, false otherwise.

Definition at line 866 of file tool_manager.cpp.

References TOOL_EVENT::Format(), TOOL_EVENT::getCommandStr(), TOOL_EVENT::IsActivate(), kicadTraceToolStack, m_toolNameIndex, and runTool().

Referenced by processEvent().

◆ DispatchContextMenu()

◆ DispatchHotKey()

bool TOOL_MANAGER::DispatchHotKey ( const TOOL_EVENT aEvent)

Handle specific events, that are intended for TOOL_MANAGER rather than tools.

Parameters
aEventis the event to be processed.
Returns
true if the event was processed and should not go any further.

Definition at line 857 of file tool_manager.cpp.

References TOOL_EVENT::Action(), TOOL_EVENT::KeyCode(), m_actionMgr, TOOL_EVENT::Modifier(), ACTION_MANAGER::RunHotKey(), and TA_KEY_PRESSED.

Referenced by processEvent().

◆ dispatchInternal()

◆ doRunAction() [1/2]

bool TOOL_MANAGER::doRunAction ( const std::string &  aActionName,
bool  aNow,
const std::any &  aParam,
COMMIT aCommit 
)
private

Definition at line 292 of file tool_manager.cpp.

References doRunAction(), ACTION_MANAGER::FindAction(), and m_actionMgr.

◆ doRunAction() [2/2]

bool TOOL_MANAGER::doRunAction ( const TOOL_ACTION aAction,
bool  aNow,
const std::any &  aParam,
COMMIT aCommit 
)
private

◆ FindTool() [1/2]

TOOL_BASE * TOOL_MANAGER::FindTool ( const std::string &  aName) const

Search for a tool with given name.

Parameters
aNameis the name of the requested tool.
Returns
Pointer to the requested tool or NULL in case of failure.

Definition at line 590 of file tool_manager.cpp.

References m_toolNameIndex.

◆ FindTool() [2/2]

TOOL_BASE * TOOL_MANAGER::FindTool ( int  aId) const

Search for a tool with given ID.

Parameters
aIdis the ID number of the requested tool.
Returns
Pointer to the requested tool or NULL in case of failure.

Definition at line 579 of file tool_manager.cpp.

References m_toolIdIndex.

Referenced by GetCurrentTool(), InvokeTool(), ACTION_MANAGER::RunHotKey(), PCB_TEST_FRAME_BASE::SetSelectionHook(), and ShutdownTool().

◆ finishTool()

TOOL_MANAGER::ID_LIST::iterator TOOL_MANAGER::finishTool ( TOOL_STATE aState)
private

Deactivate a tool and does the necessary clean up.

Parameters
aStateis the state variable of the tool to be stopped.
Returns
m_activeTools iterator. If the tool has been completely deactivated, it points to the next active tool on the list. Otherwise it is an iterator pointing to aState.

Definition at line 991 of file tool_manager.cpp.

References TOOL_BASE::GetId(), TOOL_MANAGER::TOOL_STATE::idle, m_activeState, m_activeTools, TOOL_MANAGER::TOOL_STATE::Pop(), setActiveState(), and TOOL_MANAGER::TOOL_STATE::theTool.

Referenced by dispatchInternal(), and ShutdownTool().

◆ GetActionManager()

◆ GetClipboardUTF8()

std::string TOOL_MANAGER::GetClipboardUTF8 ( ) const

Return the information currently stored in the system clipboard.

If data stored in the clipboard is in non-text format, empty string is returned.

Note
The clipboard is expected containing Unicode chars, not only ASCII7 chars. The returned string is UTF8 encoded

Definition at line 1068 of file tool_manager.cpp.

Referenced by SYMBOL_EDIT_FRAME::DuplicateSymbol(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), and PL_EDIT_TOOL::Paste().

◆ GetCurrentTool()

TOOL_BASE * TOOL_MANAGER::GetCurrentTool ( ) const
inline

Return the tool that is on the top of the active tools stack (was invoked the most recently).

Returns
Pointer to the currently used tool.

Definition at line 416 of file tool_manager.h.

References FindTool(), and GetCurrentToolId().

Referenced by PCB_GRID_HELPER::queryVisible().

◆ GetCurrentToolId()

int TOOL_MANAGER::GetCurrentToolId ( ) const
inline

Return id of the tool that is on the top of the active tools stack (was invoked the most recently).

Returns
Id of the currently used tool.

Definition at line 405 of file tool_manager.h.

References m_activeTools.

Referenced by GetCurrentTool(), and GetCurrentToolState().

◆ GetCurrentToolState()

TOOL_STATE * TOOL_MANAGER::GetCurrentToolState ( ) const
inline

Return the #TOOL_STATE object representing the state of the active tool.

If there are no tools active, it returns nullptr.

Definition at line 425 of file tool_manager.h.

References GetCurrentToolId(), and m_toolIdIndex.

Referenced by GetCurrentToolVC(), invokeTool(), and ProcessEvent().

◆ GetCurrentToolVC()

const KIGFX::VC_SETTINGS & TOOL_MANAGER::GetCurrentToolVC ( ) const

Return the view controls settings for the current tool or the general settings if there is no active tool.

Definition at line 1094 of file tool_manager.cpp.

References GetCurrentToolState(), KIGFX::VIEW_CONTROLS::GetSettings(), and m_viewControls.

Referenced by COMMON_TOOLS::ResetLocalCoords().

◆ GetCursorPosition()

VECTOR2D TOOL_MANAGER::GetCursorPosition ( ) const

◆ GetHotKey()

int TOOL_MANAGER::GetHotKey ( const TOOL_ACTION aAction) const

Definition at line 426 of file tool_manager.cpp.

References ACTION_MANAGER::GetHotKey(), and m_actionMgr.

Referenced by ACTION_MENU::updateHotKeys().

◆ GetMenuCursorPos()

VECTOR2D TOOL_MANAGER::GetMenuCursorPos ( ) const
inline

Definition at line 543 of file tool_manager.h.

References m_menuCursor.

Referenced by ROUTER_TOOL::InlineBreakTrack().

◆ GetModel()

◆ GetMousePosition()

◆ GetPriority()

int TOOL_MANAGER::GetPriority ( int  aToolId) const

Return priority of a given tool.

Higher number means that the tool is closer to the beginning of the active tools queue (i.e. receives events earlier, tools with lower priority receive events later).

Parameters
aToolIdis the id of queried tool.
Returns
The priority of a given tool. If returned number is negative, then it means that the tool id is invalid or the tool is not active.

Definition at line 663 of file tool_manager.cpp.

References m_activeTools.

Referenced by ACTION_MANAGER::RunHotKey().

◆ GetSettings()

◆ GetTool()

template<typename T >
T * TOOL_MANAGER::GetTool ( )
inline

Definition at line 319 of file tool_manager.h.

References m_toolTypes, and name.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), SCH_EDIT_FRAME::AddSheetAndUpdateDisplay(), EDA_BASE_FRAME::AddStandardHelpMenu(), EDA_DRAW_FRAME::AddStandardSubMenus(), SCH_PROPERTIES_PANEL::AfterCommit(), PCB_PROPERTIES_PANEL::AfterCommit(), SCH_MOVE_TOOL::AlignToGrid(), SCH_EDIT_FRAME::AnnotateSymbols(), SCH_EDITOR_CONTROL::AssignNetclass(), BOARD_EDITOR_CONTROL::AssignNetclass(), EE_SELECTION_TOOL::autostartEvent(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), PCB_EDIT_FRAME::CanAcceptApiCommands(), PCB_EDIT_FRAME::canCloseWindow(), FOOTPRINT_EDIT_FRAME::canCloseWindow(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_FRAME::CheckAnnotate(), PCB_EDIT_FRAME::CommonSettingsChanged(), PAD_TOOL::copyPadSettings(), ZONE_CREATE_HELPER::createNewZone(), EE_INSPECTION_TOOL::CrossProbe(), DRC_TOOL::CrossProbe(), SCH_EDIT_FRAME::DeleteAnnotation(), SCH_EDIT_FRAME::DeleteJunction(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), BOARD_INSPECTION_TOOL::DiffFootprint(), BOARD_COMMIT::dirtyIntersectingZones(), SCH_EDIT_FRAME::DisplayCurrentSheet(), PL_DRAW_PANEL_GAL::DisplayDrawingSheet(), DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup(), SCH_EDITOR_CONTROL::doCopy(), BOARD_EDITOR_CONTROL::doCrossProbePcbToSch(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), BOARD_INSPECTION_TOOL::doHideRatsnestNet(), SCH_FIELD::DoHypertextAction(), SCH_TEXT::DoHypertextAction(), SCH_TEXTBOX::DoHypertextAction(), EDIT_TOOL::doMoveSelection(), SYMBOL_EDITOR_MOVE_TOOL::doMoveSelection(), SCH_MOVE_TOOL::doMoveSelection(), EDA_3D_VIEWER_FRAME::doReCreateMenuBar(), BITMAP2CMP_FRAME::doReCreateMenuBar(), CVPCB_MAINFRAME::doReCreateMenuBar(), SCH_EDIT_FRAME::doReCreateMenuBar(), SIMULATOR_FRAME::doReCreateMenuBar(), SYMBOL_EDIT_FRAME::doReCreateMenuBar(), SYMBOL_VIEWER_FRAME::doReCreateMenuBar(), GERBVIEW_FRAME::doReCreateMenuBar(), KICAD_MANAGER_FRAME::doReCreateMenuBar(), PL_EDITOR_FRAME::doReCreateMenuBar(), PCB_CALCULATOR_FRAME::doReCreateMenuBar(), FOOTPRINT_EDIT_FRAME::doReCreateMenuBar(), FOOTPRINT_VIEWER_FRAME::doReCreateMenuBar(), PCB_EDIT_FRAME::doReCreateMenuBar(), SCH_DRAWING_TOOLS::doSyncSheetsPins(), EDIT_TOOL::Drag(), DRAWING_TOOL::DrawVia(), BOARD_EDITOR_CONTROL::DrillOrigin(), EDIT_TOOL::Duplicate(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editShapeProperties(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), EE_INSPECTION_TOOL::ExcludeMarker(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), EDIT_TOOL::GetAndPlace(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetContextMenuTool(), FP_TREE_SYNCHRONIZING_ADAPTER::GetContextMenuTool(), DISPLAY_FOOTPRINTS_FRAME::GetCurrentSelection(), SCH_EDIT_FRAME::GetCurrentSelection(), SYMBOL_EDIT_FRAME::GetCurrentSelection(), SYMBOL_VIEWER_FRAME::GetCurrentSelection(), GERBVIEW_FRAME::GetCurrentSelection(), PL_EDITOR_FRAME::GetCurrentSelection(), FOOTPRINT_EDIT_FRAME::GetCurrentSelection(), FOOTPRINT_VIEWER_FRAME::GetCurrentSelection(), PCB_EDIT_FRAME::GetCurrentSelection(), PL_EDITOR_FRAME::GetLayoutFromRedoList(), PL_EDITOR_FRAME::GetLayoutFromUndoList(), SCH_PROPERTIES_PANEL::getPropertyFromEvent(), PCB_PROPERTIES_PANEL::getPropertyFromEvent(), DRAWING_TOOL::getSourceZoneForAction(), PCB_EDIT_TABLE_TOOL::getTableCellSelection(), EDA_DRAW_FRAME::GetUnitPair(), PCB_CONTROL::GridPlaceOrigin(), GROUP_TOOL::Group(), API_HANDLER_PCB::handleInteractiveMoveItems(), SCH_EDIT_FRAME::HardRedraw(), SYMBOL_EDIT_FRAME::HardRedraw(), PL_EDITOR_FRAME::HardRedraw(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::highlightNet(), highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), EE_TOOL_BASE< T >::Init(), SCH_EDIT_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), SYMBOL_EDITOR_EDIT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), PL_EDIT_TOOL::Init(), PL_POINT_EDITOR::Init(), BOARD_EDITOR_CONTROL::Init(), BOARD_INSPECTION_TOOL::Init(), BOARD_REANNOTATE_TOOL::Init(), CONVERT_TOOL::Init(), EDIT_TOOL::Init(), GENERATOR_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), GROUP_TOOL::Init(), PAD_TOOL::Init(), PCB_EDIT_TABLE_TOOL::Init(), PCB_POINT_EDITOR::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), POSITION_RELATIVE_TOOL::Init(), DIALOG_PAD_PROPERTIES::initValues(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), SCH_EDIT_TOOL::InteractiveDelete(), SYMBOL_EDITOR_EDIT_TOOL::InteractiveDelete(), PL_EDIT_TOOL::InteractiveDelete(), PCB_CONTROL::InteractiveDelete(), ARRAY_CREATOR::Invoke(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isRouterActive(), SCH_EDIT_FRAME::KiwayMailIn(), GROUP_TOOL::LeaveGroup(), SCH_EDIT_FRAME::LoadProjectSettings(), PCB_EDIT_FRAME::LoadProjectSettings(), FOOTPRINT_EDIT_FRAME::LoadSettings(), SYMBOL_EDIT_FRAME::LoadSymbol(), SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), EE_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), makeShapeModificationMenu(), GRAPHICS_CLEANER::mergePads(), SCH_EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), PROPERTIES_FRAME::OnAcceptPrms(), DIALOG_DRC::OnActivateDlg(), PCB_EDIT_FRAME::onBoardLoaded(), DIALOG_DRC::OnCancelClick(), DIALOG_FOOTPRINT_CHECKER::OnCancelClick(), DIALOG_GENERATORS::OnCancelClick(), DIALOG_INSPECTOR::onCellClicked(), DIALOG_POSITION_RELATIVE::OnClear(), DIALOG_DRC::OnDRCItemRClick(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), DIALOG_ERC::OnERCItemRClick(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_POSITION_RELATIVE::OnOkClick(), DIALOG_PLOT::onRunDRC(), DIALOG_DRC::OnRunDRCClick(), DIALOG_POSITION_RELATIVE::OnSelectItemClick(), DIALOG_SYMBOL_FIELDS_TABLE::OnTableRangeSelected(), SCH_EDIT_FRAME::OpenProjectFiles(), PANEL_SCH_SELECTION_FILTER::PANEL_SCH_SELECTION_FILTER(), PANEL_SELECTION_FILTER::PANEL_SELECTION_FILTER(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), PCB_CONTROL::placeBoardItems(), DRAWING_TOOL::PlaceReferenceImage(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceTuningPattern(), DIALOG_PLOT::Plot(), SCH_PRINTOUT::PrintPage(), SCH_EDIT_TOOL::Properties(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), BOARD_COMMIT::Push(), PAD_TOOL::pushPadSettings(), SCH_COMMIT::pushSchEdit(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), PCB_EDIT_FRAME::RebuildAndRefresh(), SCH_EDIT_FRAME::ReCreateOptToolbar(), SYMBOL_EDIT_FRAME::ReCreateOptToolbar(), PL_EDITOR_FRAME::ReCreateOptToolbar(), FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar(), PCB_EDIT_FRAME::ReCreateOptToolbar(), FOOTPRINT_EDIT_FRAME::ReCreateVToolbar(), PCB_EDIT_FRAME::ReCreateVToolbar(), SCH_EDITOR_CONTROL::Redo(), SYMBOL_EDITOR_EDIT_TOOL::Redo(), SCH_BASE_FRAME::RefreshZoomDependentItems(), GENERATOR_TOOL::RegenerateSelected(), GROUP_TOOL::RemoveFromGroup(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem(), SCH_COMMIT::Revert(), BOARD_COMMIT::Revert(), SCH_COMMIT::revertLibEdit(), PL_EDITOR_FRAME::RollbackFromUndo(), SCH_EDIT_FRAME::RollbackSchematicFromUndo(), SCH_EDIT_TOOL::Rotate(), ROUTER_TOOL::RouteSelected(), DRC_TOOL::RunTests(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_EDIT_FRAME::SaveProjectLocalSettings(), PCB_EDIT_FRAME::saveProjectSettings(), SYMBOL_EDIT_FRAME::SaveSettings(), EDA_DRAW_FRAME::SaveSettings(), FOOTPRINT_EDIT_FRAME::SaveSettings(), SCH_BASE_FRAME::SCH_BASE_FRAME(), SCH_EDIT_FRAME::SchematicCleanUp(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), PCB_TOOL_BASE::selection(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), CVPCB_MAINFRAME::setupTools(), FOOTPRINT_EDIT_FRAME::setupTools(), SCH_EDIT_FRAME::setupUIConditions(), PCB_EDIT_FRAME::setupUIConditions(), EDA_DRAW_FRAME::setupUnits(), PCB_EDIT_FRAME::ShowFindDialog(), SCH_EDIT_FRAME::ShowFindReplaceDialog(), BOARD_INSPECTION_TOOL::ShowFootprintLinks(), PCB_BASE_EDIT_FRAME::ShowGraphicItemPropertiesDialog(), PCB_TUNING_PATTERN::ShowPropertiesDialog(), SCH_EDITOR_CONTROL::SimProbe(), SCH_EDITOR_CONTROL::SimTune(), EDA_DRAW_FRAME::ToggleUserUnits(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow(), DIALOG_SYMBOL_FIELDS_TABLE::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TEARDROPS::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_EDITOR_CONTROL::Undo(), SYMBOL_EDITOR_EDIT_TOOL::Undo(), GROUP_TOOL::Ungroup(), SYMBOL_UNIT_MENU::update(), ALT_PIN_FUNCTION_MENU::update(), PIN_TRICKS_MENU::update(), BUS_UNFOLD_MENU::update(), HIGHLIGHT_MENU::update(), GROUP_CONTEXT_MENU::update(), SCH_PROPERTIES_PANEL::UpdateData(), PCB_PROPERTIES_PANEL::UpdateData(), DIALOG_DRC::updateDisplayedCounts(), SCH_EDIT_FRAME::UpdateHierarchyNavigator(), PCB_POINT_EDITOR::updateItem(), BOARD_INSPECTION_TOOL::UpdateLocalRatsnest(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCB_CONTROL::UpdateMessagePanel(), PCB_EDIT_FRAME::UpdateViaSizeSelectBox(), SCH_PROPERTIES_PANEL::valueChanged(), PCB_PROPERTIES_PANEL::valueChanged(), SCH_PROPERTIES_PANEL::valueChanging(), PCB_PROPERTIES_PANEL::valueChanging(), BOARD_EDITOR_CONTROL::ViaSizeDec(), BOARD_EDITOR_CONTROL::ViaSizeInc(), BOARD_EDITOR_CONTROL::ZoneDuplicate(), ZONE_FILLER_TOOL::ZoneFill(), BOARD_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfill().

◆ GetToolHolder()

◆ GetView()

KIGFX::VIEW * TOOL_MANAGER::GetView ( ) const
inline

◆ GetViewControls()

KIGFX::VIEW_CONTROLS * TOOL_MANAGER::GetViewControls ( ) const
inline

◆ InitTools()

◆ InvokeTool() [1/2]

bool TOOL_MANAGER::InvokeTool ( const std::string &  aToolName)

Call a tool by sending a tool activation event to tool of given name.

Parameters
aToolNameis the name of the requested tool.
Returns
True if the requested tool was invoked successfully.

Definition at line 278 of file tool_manager.cpp.

References FindTool(), TOOL_BASE::GetType(), INTERACTIVE, invokeTool(), and kicadTraceToolStack.

◆ invokeTool()

bool TOOL_MANAGER::invokeTool ( TOOL_BASE aTool)
private

Invoke a tool by sending a proper event (in contrary to runTool, which makes the tool run for real).

Parameters
aToolis the tool to be invoked.

Definition at line 432 of file tool_manager.cpp.

References GetCurrentToolState(), GetCursorPosition(), TOOL_BASE::GetName(), processEvent(), setActiveState(), TOOL_EVENT::SetMousePosition(), TA_ACTIVATE, and TC_COMMAND.

Referenced by InvokeTool().

◆ InvokeTool() [2/2]

bool TOOL_MANAGER::InvokeTool ( TOOL_ID  aToolId)

Call a tool by sending a tool activation event to tool of given ID.

Parameters
aToolIdis the ID number of the requested tool.
Returns
True if the requested tool was invoked successfully.

Definition at line 264 of file tool_manager.cpp.

References FindTool(), TOOL_BASE::GetType(), INTERACTIVE, invokeTool(), and kicadTraceToolStack.

Referenced by TOOL_INTERACTIVE::Activate(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL(), PCB_TEST_FRAME_BASE::SetBoard(), SYMBOL_EDIT_FRAME::setupTools(), SYMBOL_VIEWER_FRAME::setupTools(), GERBVIEW_FRAME::setupTools(), PL_EDITOR_FRAME::setupTools(), FOOTPRINT_EDIT_FRAME::setupTools(), and PCB_EDIT_FRAME::setupTools().

◆ isActive()

bool TOOL_MANAGER::isActive ( TOOL_BASE aTool) const
private

Return information about a tool activation status.

Parameters
aToolis the tool to be checked.
Returns
True if the tool is on the active tools stack, false otherwise.

Definition at line 1123 of file tool_manager.cpp.

References alg::contains(), TOOL_BASE::GetId(), isRegistered(), and m_activeTools.

Referenced by runTool(), and ShutdownTool().

◆ IsContextMenuActive()

bool TOOL_MANAGER::IsContextMenuActive ( ) const
inline

True while processing a context menu.

Definition at line 514 of file tool_manager.h.

References m_menuActive.

Referenced by DIALOG_SHIM::DIALOG_SHIM(), and ROUTER_TOOL::InlineBreakTrack().

◆ isRegistered()

bool TOOL_MANAGER::isRegistered ( TOOL_BASE aTool) const
inlineprivate

Return information about a tool registration status.

Parameters
aToolis the tool to be checked.
Returns
true if the tool is in the registered tools list, false otherwise.

Definition at line 604 of file tool_manager.h.

References m_toolState.

Referenced by isActive(), and runTool().

◆ IsToolActive()

bool TOOL_MANAGER::IsToolActive ( TOOL_ID  aId) const

Return true if a tool with given id is active (executing)

Definition at line 1238 of file tool_manager.cpp.

References m_toolIdIndex.

Referenced by TOOL_BASE::IsToolActive().

◆ MakeToolId()

TOOL_ID TOOL_MANAGER::MakeToolId ( const std::string &  aToolName)
static

Generates a unique ID from for a tool with given name.

Definition at line 1103 of file tool_manager.cpp.

◆ PostAction() [1/5]

bool TOOL_MANAGER::PostAction ( const std::string &  aActionName)
inline

Definition at line 238 of file tool_manager.h.

References doRunAction().

◆ PostAction() [2/5]

template<typename T >
bool TOOL_MANAGER::PostAction ( const std::string &  aActionName,
aParam 
)
inline

Run the specified action after the current action (coroutine) ends.

The common format for action names is "application.ToolName.Action".

Note: The type of the optional parameter must match exactly with the type the consuming action is expecting, otherwise an assert will occur when reading the paramter.

Parameters
aActionNameis the name of action to be invoked.
aParamis an optional parameter that might be used by the invoked action. Its meaning depends on the action.
Returns
False if the action was not found.

Definition at line 230 of file tool_manager.h.

References doRunAction().

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic(), CVPCB_ASSOCIATION_TOOL::Associate(), SCH_EDIT_TOOL::AutoplaceFields(), SCH_EDIT_TOOL::ChangeBodyStyle(), SCH_EDITOR_CONTROL::ChangeLineMode(), COMMON_TOOLS::CursorControl(), SIMULATOR_FRAME::doCloseWindow(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SCH_MOVE_TOOL::doMoveSelection(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), SCH_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_DRAWING_TOOLS::DrawTable(), DRAWING_TOOL::DrawTable(), SIMULATOR_CONTROL::ExportPlotToSchematic(), EDIT_TOOL::Flip(), GERBVIEW_FRAME::GERBVIEW_FRAME(), EDIT_TOOL::GetAndPlace(), API_HANDLER_PCB::handleInteractiveMoveItems(), SCH_EDIT_TOOL::InteractiveDelete(), SYMBOL_EDITOR_EDIT_TOOL::InteractiveDelete(), PL_EDIT_TOOL::InteractiveDelete(), EDIT_TOOL::JustifyText(), CVPCB_CONTROL::Main(), EE_SELECTION_TOOL::Main(), EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_EDITOR_CONTROL::NextLineMode(), PCB_POINT_EDITOR::OnSelectionChange(), PL_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceReferenceImage(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), SIMULATOR_CONTROL::Probe(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), BOARD_COMMIT::Push(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), ROUTER_TOOL::RouteSelected(), GERBVIEW_FRAME::SetActiveLayer(), FOOTPRINT_EDIT_FRAME::SetActiveLayer(), PCB_EDIT_FRAME::SetActiveLayer(), SCH_EDIT_FRAME::setupTools(), SCH_EDITOR_CONTROL::SimProbe(), SCH_EDITOR_CONTROL::SimTune(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDIT_TOOL::Swap(), SIMULATOR_CONTROL::Tune(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ PostAction() [3/5]

void TOOL_MANAGER::PostAction ( const TOOL_ACTION aAction)
inline

Definition at line 265 of file tool_manager.h.

References doRunAction().

◆ PostAction() [4/5]

bool TOOL_MANAGER::PostAction ( const TOOL_ACTION aAction,
COMMIT aCommit 
)
inline

Definition at line 273 of file tool_manager.h.

References doRunAction().

◆ PostAction() [5/5]

template<typename T >
bool TOOL_MANAGER::PostAction ( const TOOL_ACTION aAction,
aParam 
)
inline

Run the specified action after the current action (coroutine) ends.

Note: The type of the optional parameter must match exactly with the type the consuming action is expecting, otherwise an assert will occur when reading the paramter.

Parameters
aActionis the action to be invoked.
aParamis an optional parameter that might be used by the invoked action. Its meaning depends on the action.

Definition at line 257 of file tool_manager.h.

References doRunAction().

◆ PostEvent()

void TOOL_MANAGER::PostEvent ( const TOOL_EVENT aEvent)

Put an event to the event queue to be processed at the end of event processing cycle.

Parameters
aEventis the event to be put into the queue.

Definition at line 415 of file tool_manager.cpp.

References TOOL_EVENT::IsSimulator(), and m_eventQueue.

Referenced by SYMBOL_EDITOR_MOVE_TOOL::AlignElements(), SCH_MOVE_TOOL::AlignToGrid(), EDIT_TABLE_TOOL_BASE< T_TABLE, T_TABLECELL, T_COMMIT >::doAddColumnAfter(), EDIT_TABLE_TOOL_BASE< T_TABLE, T_TABLECELL, T_COMMIT >::doAddColumnBefore(), EDIT_TABLE_TOOL_BASE< T_TABLE, T_TABLECELL, T_COMMIT >::doAddRowAbove(), EDIT_TABLE_TOOL_BASE< T_TABLE, T_TABLECELL, T_COMMIT >::doAddRowBelow(), EDIT_TABLE_TOOL_BASE< T_TABLE, T_TABLECELL, T_COMMIT >::doDeleteColumns(), EDIT_TABLE_TOOL_BASE< T_TABLE, T_TABLECELL, T_COMMIT >::doDeleteRows(), EDIT_TABLE_TOOL_BASE< T_TABLE, T_TABLECELL, T_COMMIT >::doMergeCells(), EDIT_TOOL::doMoveSelection(), SYMBOL_EDITOR_MOVE_TOOL::doMoveSelection(), SCH_MOVE_TOOL::doMoveSelection(), doRunAction(), EDIT_TABLE_TOOL_BASE< T_TABLE, T_TABLECELL, T_COMMIT >::doUnmergeCells(), PCB_TUNING_PATTERN::EditStart(), GROUP_TOOL::Group(), PCB_CONTROL::HighContrastModeCycle(), PL_EDIT_TOOL::Main(), BOARD_EDITOR_CONTROL::modifyLockSelected(), COMMON_TOOLS::OnGridChanged(), TOOLS_HOLDER::PopTool(), PrimeTool(), BOARD_COMMIT::Push(), SCH_COMMIT::pushLibEdit(), SCH_COMMIT::pushSchEdit(), PCB_BASE_FRAME::rebuildConnectivity(), EDIT_TOOL::rebuildConnectivity(), ZONE_FILLER_TOOL::rebuildConnectivity(), GROUP_TOOL::RemoveFromGroup(), PCB_BASE_EDIT_FRAME::RestoreCopyFromRedoList(), PCB_BASE_EDIT_FRAME::RestoreCopyFromUndoList(), BOARD_COMMIT::Revert(), PCB_BASE_EDIT_FRAME::ShowReferenceImagePropertiesDialog(), PCB_CONTROL::SnapMode(), GROUP_TOOL::Ungroup(), and PCB_BASE_EDIT_FRAME::unitsChangeRefresh().

◆ PrimeTool()

◆ ProcessEvent()

bool TOOL_MANAGER::ProcessEvent ( const TOOL_EVENT aEvent)

Propagate an event to tools that requested events of matching type(s).

Parameters
aEventis the event to be processed.
Returns
true if the event is a managed hotkey

Definition at line 1011 of file tool_manager.cpp.

References GetCurrentToolState(), KIGFX::VIEW::IsDirty(), m_shuttingDown, m_view, processEvent(), setActiveState(), and UpdateUI().

Referenced by SELECTION_TOOL::AddItemsToSel(), SELECTION_TOOL::AddItemToSel(), BOARD_EDITOR_CONTROL::AssignNetclass(), EDIT_TOOL::ChangeTrackWidth(), GERBVIEW_SELECTION_TOOL::clearSelection(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), PANEL_KICAD_LAUNCHER::CreateLaunchers(), COMMON_TOOLS::CursorControl(), TOOL_DISPATCHER::DispatchWxEvent(), PCB_TOOL_BASE::doInteractiveItemPlacement(), PCB_SELECTION_TOOL::doSyncSelection(), SCH_EDIT_FRAME::EditSheetProperties(), PCB_SELECTION_TOOL::EnterGroup(), PCB_SELECTION_TOOL::ExitGroup(), PCB_SELECTION_TOOL::expandConnection(), PCB_SELECTION_TOOL::filterSelection(), PCB_SELECTION_TOOL::FindItem(), EDIT_TOOL::Flip(), TOOL_DISPATCHER::handleMouseButton(), EDIT_TOOL::JustifyText(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), EDIT_TOOL::Mirror(), EDIT_TOOL::Move(), EDIT_TOOL::MoveExact(), SELECTION_TOOL::onDisambiguationExpire(), ACTION_MENU::OnMenuEvent(), ACTION_TOOLBAR::onPaletteEvent(), ACTION_TOOLBAR::onToolEvent(), PAD_TOOL::pastePadProperties(), PCB_CONTROL::placeBoardItems(), EDIT_TOOL::Properties(), BOARD_COMMIT::Push(), SCH_COMMIT::pushLibEdit(), PAD_TOOL::pushPadSettings(), SCH_COMMIT::pushSchEdit(), EE_SELECTION_TOOL::RebuildSelection(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemsFromSel(), EE_SELECTION_TOOL::RequestSelection(), PCB_BASE_EDIT_FRAME::RestoreCopyFromRedoList(), PCB_BASE_EDIT_FRAME::RestoreCopyFromUndoList(), EDIT_TOOL::Rotate(), EE_SELECTION_TOOL::SelectAll(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::SelectColumns(), PCB_SELECTION_TOOL::SelectColumns(), EE_SELECTION_TOOL::SelectConnection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectNet(), GERBVIEW_SELECTION_TOOL::selectPoint(), PCB_TEST_SELECTION_TOOL::selectPoint(), PL_SELECTION_TOOL::SelectPoint(), PCB_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::SelectRows(), PCB_SELECTION_TOOL::SelectRows(), PCB_SELECTION_TOOL::selectSameSheet(), PCB_SELECTION_TOOL::selectSheetContents(), EE_SELECTION_TOOL::SelectTable(), PCB_SELECTION_TOOL::SelectTable(), PCB_SELECTION_TOOL::selectTableCells(), EE_SELECTION_TOOL::selectTableCells(), PCB_EDIT_FRAME::ShowBoardSetupDialog(), EDIT_TOOL::Swap(), EE_SELECTION_TOOL::SyncSelection(), SCH_EDITOR_CONTROL::Undo(), EE_SELECTION_TOOL::UnselectAll(), PCB_SELECTION_TOOL::UnselectAll(), GERBVIEW_SELECTION_TOOL::UnselectItem(), and GERBVIEW_SELECTION_TOOL::UnselectItems().

◆ processEvent()

bool TOOL_MANAGER::processEvent ( const TOOL_EVENT aEvent)
private

◆ RegisterTool()

◆ ResetTools()

void TOOL_MANAGER::ResetTools ( TOOL_BASE::RESET_REASON  aReason)

◆ RunAction() [1/4]

bool TOOL_MANAGER::RunAction ( const std::string &  aActionName)
inline

Definition at line 153 of file tool_manager.h.

References doRunAction().

◆ RunAction() [2/4]

template<typename T , std::enable_if_t<!std::is_convertible_v< T *, COMMIT * > > * = nullptr>
bool TOOL_MANAGER::RunAction ( const std::string &  aActionName,
aParam 
)
inline

Run the specified action immediately, pausing the current action to run the new one.

The common format for action names is "application.ToolName.Action".

Note: The type of the optional parameter must match exactly with the type the consuming action is expecting, otherwise an assert will occur when reading the paramter.

Parameters
aActionNameis the name of action to be invoked.
aParamis an optional parameter that might be used by the invoked action. Its meaning depends on the action.
Returns
False if the action was not found.

Definition at line 145 of file tool_manager.h.

References doRunAction().

Referenced by PROJECT_TREE_ITEM::Activate(), SCH_SEARCH_HANDLER::ActivateItem(), PCB_SEARCH_HANDLER::ActivateItem(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), APPEARANCE_CONTROLS::APPEARANCE_CONTROLS(), BOARD_EDITOR_CONTROL::AssignNetclass(), SCH_EDIT_TOOL::AutoplaceFields(), SCH_NAVIGATE_TOOL::Back(), SCH_EDIT_FRAME::canCloseWindow(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeBodyStyle(), SCH_NAVIGATE_TOOL::changeSheet(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), GERBVIEW_CONTROL::ClearAllLayers(), SCH_EDIT_TABLE_TOOL::clearSelection(), PCB_EDIT_TABLE_TOOL::clearSelection(), PCB_SELECTION_TOOL::ClearSelection(), RULE_AREA_CREATE_HELPER::commitRuleArea(), ZONE_CREATE_HELPER::commitZone(), EDA_DRAW_FRAME::CommonSettingsChanged(), MICROWAVE_TOOL::createInductorBetween(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), SCH_EDITOR_CONTROL::Cut(), SYMBOL_VIEWER_FRAME::DClickOnSymbolList(), DIALOG_FOOTPRINT_CHECKER::deleteAllMarkers(), DIALOG_ERC::deleteAllMarkers(), DIALOG_DRC::deleteAllMarkers(), EDIT_TOOL::DeleteItems(), DIALOG_MIGRATE_BUSES::DIALOG_MIGRATE_BUSES(), SCH_EDIT_FRAME::DisplayCurrentSheet(), DIALOG_CLEANUP_GRAPHICS::doCleanup(), DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDIT_TOOL::DoDelete(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape(), DIALOG_GLOBAL_DELETION::DoGlobalDeletions(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SYMBOL_EDITOR_MOVE_TOOL::doMoveSelection(), SCH_MOVE_TOOL::doMoveSelection(), SCH_DRAWING_TOOLS::doSyncSheetsPins(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), EDA_BASE_FRAME::DoWithAcceptedFiles(), GERBVIEW_FRAME::DoWithAcceptedFiles(), KICAD_MANAGER_FRAME::DoWithAcceptedFiles(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), SCH_DRAWING_TOOLS::DrawRuleArea(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), SCH_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_DRAWING_TOOLS::DrawTable(), DRAWING_TOOL::DrawTable(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), SCH_EDIT_TABLE_TOOL::EditTable(), PCB_EDIT_TABLE_TOOL::EditTable(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SYMBOL_EDIT_FRAME::emptyScreen(), PAD_TOOL::EnumeratePads(), TRACK_WIDTH_MENU::eventHandler(), DIFF_PAIR_MENU::eventHandler(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), SCH_EDIT_FRAME::FlipBodyStyle(), SCH_NAVIGATE_TOOL::Forward(), GERBVIEW_FRAME::GERBVIEW_FRAME(), EDIT_TOOL::GetAndPlace(), DRAWING_TOOL::getSourceZoneForAction(), PCB_SELECTION_TOOL::grabUnconnected(), COMMON_TOOLS::GridOrigin(), PCB_CONTROL::GridPlaceOrigin(), API_HANDLER_PCB::handleInteractiveMoveItems(), API_HANDLER_PCB::handleRefillZones(), BOARD_INSPECTION_TOOL::HighlightItem(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PL_EDIT_TOOL::ImportDrawingSheetContent(), SCH_EDIT_FRAME::importFile(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), SCH_DRAWING_TOOLS::ImportGraphics(), SYMBOL_EDITOR_DRAWING_TOOLS::ImportGraphics(), SCH_EDIT_FRAME::initScreenZoom(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectDRCError(), EE_INSPECTION_TOOL::InspectERCError(), SCH_EDIT_TOOL::InteractiveDelete(), SYMBOL_EDITOR_EDIT_TOOL::InteractiveDelete(), PL_EDIT_TOOL::InteractiveDelete(), PCB_CONTROL::InteractiveDelete(), DRAWING_TOOL::InteractivePlaceWithPreview(), ARRAY_CREATOR::Invoke(), EDIT_TOOL::invokeInlineRouter(), SCH_EDIT_TOOL::JustifyText(), EDIT_TOOL::JustifyText(), SCH_EDIT_FRAME::KiwayMailIn(), PCB_EDIT_FRAME::KiwayMailIn(), SYMBOL_EDIT_FRAME::LoadOneLibrarySymbolAux(), SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), SCH_EDIT_TOOL::Mirror(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), DIALOG_GROUP_PROPERTIES::OnAddMember(), DIALOG_DRC::OnDeleteOneClick(), DIALOG_ERC::OnDeleteOneClick(), DIALOG_FOOTPRINT_CHECKER::OnDeleteOneClick(), SYMBOL_EDITOR_CONTROL::OnDeMorgan(), DIALOG_DRC::OnDRCItemSelected(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), DIALOG_ERC::OnERCItemRClick(), DIALOG_ERC::OnERCItemSelected(), SCH_EDIT_FRAME::OnFindDialogClose(), RULE_AREA_CREATE_HELPER::OnFirstPoint(), ZONE_CREATE_HELPER::OnFirstPoint(), PCB_BASE_FRAME::OnFpChangeDebounceTimer(), KICAD_MANAGER_FRAME::OnIdle(), DIALOG_GENERATORS::OnItemSelected(), FOOTPRINTS_LISTBOX::OnLeftDClick(), ACTION_MENU::OnMenuEvent(), APPEARANCE_CONTROLS::onNetclassContextMenu(), APPEARANCE_CONTROLS::onNetContextMenu(), PCB_EDIT_FRAME::OnNetlistChanged(), PL_EDITOR_FRAME::OnNewDrawingSheet(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), GERBER_LAYER_WIDGET::onPopupSelection(), DIALOG_GENERATORS::OnRebuildAllClick(), DIALOG_GENERATORS::OnRebuildTypeClick(), EDA_DRAW_FRAME::OnSelectGrid(), DIALOG_POSITION_RELATIVE::OnSelectItemClick(), HIERARCHY_PANE::onSelectSheetPath(), SYMBOL_EDIT_FRAME::OnSelectUnit(), EDA_DRAW_FRAME::OnSelectZoom(), SCH_EDIT_FRAME::onSize(), PCB_EDIT_FRAME::onSize(), SYMBOL_TREE_PANE::onSymbolSelected(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDITOR_CONTROL::Paste(), ROUTER_TOOL::performRouting(), DIALOG_UPDATE_PCB::PerformUpdate(), ZONE_CREATE_HELPER::performZoneCutout(), 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(), DRAWING_TOOL::PlaceReferenceImage(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::PlaceTuningPattern(), GERBVIEW_CONTROL::Print(), PCB_CONTROL::Print(), SCH_EDIT_TOOL::Properties(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), FOOTPRINT_WIZARD_FRAME::PythonPluginsReload(), SCH_EDIT_FRAME::RecalculateConnections(), PAD_TOOL::RecombinePad(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), PCB_POINT_EDITOR::removeCorner(), GROUP_TOOL::RemoveFromGroup(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem(), PCB_SELECTION_TOOL::RequestSelection(), SCH_EDITOR_CONTROL::Revert(), PL_EDITOR_FRAME::RollbackFromUndo(), SCH_EDIT_TOOL::Rotate(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), ROUTER_TOOL::RouteSelected(), ACTION_MANAGER::RunHotKey(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SYMBOL_EDIT_FRAME::saveLibrary(), DIALOG_FIND::search(), SCH_SEARCH_HANDLER::SelectItems(), PCB_SEARCH_HANDLER::SelectItems(), EE_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), NL_3D_VIEWER_PLUGIN_IMPL::SetActiveCommand(), NL_SCHEMATIC_PLUGIN_IMPL::SetActiveCommand(), NL_PCBNEW_PLUGIN_IMPL::SetActiveCommand(), DRAWING_TOOL::SetAnchor(), SYMBOL_EDIT_FRAME::SetCurSymbol(), SCH_EDIT_FRAME::SetScreen(), CVPCB_MAINFRAME::setupEventHandlers(), FOOTPRINT_EDIT_FRAME::setupTools(), EDA_DRAW_FRAME::setupUnits(), DRC_TOOL::ShowDRCDialog(), APPEARANCE_CONTROLS::showNetclass(), SCH_EDITOR_CONTROL::SimProbe(), SCH_EDITOR_CONTROL::SimTune(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDIT_TOOL::Swap(), SYMBOL_DIFF_FRAME::SYMBOL_DIFF_FRAME(), PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), DIALOG_GROUP_PROPERTIES::TransferDataFromWindow(), PANEL_SETUP_LAYERS::TransferDataFromWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), GROUP_TOOL::Ungroup(), EDA_DRAW_FRAME::unitsChangeRefresh(), PCB_SELECTION_TOOL::unrouteSelected(), CVPCB_MAINFRAME::updateFootprintViewerOnIdle(), NET_GRID_TABLE::updateNetVisibility(), SYMBOL_VIEWER_FRAME::updatePreviewSymbol(), DISPLAY_FOOTPRINTS_FRAME::updateView(), FOOTPRINT_VIEWER_FRAME::updateView(), FOOTPRINT_WIZARD_FRAME::updateView(), BOARD_EDITOR_CONTROL::ViaSizeDec(), BOARD_EDITOR_CONTROL::ViaSizeInc(), BOARD_EDITOR_CONTROL::ZoneMerge(), EDA_DRAW_FRAME::Zoom_Automatique(), DIALOG_IMPORT_NETLIST::~DIALOG_IMPORT_NETLIST(), and DIALOG_UPDATE_PCB::~DIALOG_UPDATE_PCB().

◆ RunAction() [3/4]

bool TOOL_MANAGER::RunAction ( const TOOL_ACTION aAction)
inline

Definition at line 208 of file tool_manager.h.

References doRunAction().

◆ RunAction() [4/4]

template<typename T , std::enable_if_t<!std::is_convertible_v< T, COMMIT * > > * = nullptr>
bool TOOL_MANAGER::RunAction ( const TOOL_ACTION aAction,
aParam 
)
inline

Run the specified action immediately, pausing the current action to run the new one.

Note: The type of the optional parameter must match exactly with the type the consuming action is expecting, otherwise an assert will occur when reading the paramter.

Parameters
aActionis the action to be invoked.
aParamis an optional parameter that might be used by the invoked action. Its meaning depends on the action.
Returns
True if the action was handled immediately

Definition at line 173 of file tool_manager.h.

References doRunAction().

◆ RunMainStack()

void TOOL_MANAGER::RunMainStack ( TOOL_BASE aTool,
std::function< void()>  aFunc 
)

◆ RunSynchronousAction() [1/2]

bool TOOL_MANAGER::RunSynchronousAction ( const TOOL_ACTION aAction,
COMMIT aCommit 
)
inline

Definition at line 200 of file tool_manager.h.

References doRunAction().

◆ RunSynchronousAction() [2/2]

template<typename T >
bool TOOL_MANAGER::RunSynchronousAction ( const TOOL_ACTION aAction,
COMMIT aCommit,
aParam 
)
inline

Run the specified action immediately, pausing the current action to run the new one.

Note: The type of the optional parameter must match exactly with the type the consuming action is expecting, otherwise an assert will occur when reading the paramter.

Parameters
aActionis the action to be invoked.
aCommitis the commit object the tool handling the action should add the new edits to
Returns
True if the action was handled immediately

Definition at line 192 of file tool_manager.h.

References doRunAction().

Referenced by SCH_EDIT_FRAME::AddSheetAndUpdateDisplay(), SCH_EDIT_TOOL::BreakWire(), EDIT_TOOL::DeleteItems(), EDIT_TOOL::doMoveSelection(), SCH_MOVE_TOOL::doMoveSelection(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), EE_SELECTION_TOOL::Main(), PCB_POINT_EDITOR::OnSelectionChange(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PCB_CONTROL::placeBoardItems(), SCH_EDIT_TOOL::RepeatDrawItem(), and PCB_POINT_EDITOR::updateItem().

◆ runTool()

bool TOOL_MANAGER::runTool ( TOOL_BASE aTool)
private

Make a tool active, so it can receive events and react to them.

The activated tool is pushed on the active tools stack, so the last activated tool receives events first.

Parameters
aToolis the tool to be run.

Definition at line 447 of file tool_manager.cpp.

References TOOL_BASE::GetId(), TOOL_BASE::GetName(), TOOL_BASE::GetType(), INTERACTIVE, isActive(), isRegistered(), kicadTraceToolStack, m_activeTools, m_toolIdIndex, TOOL_BASE::Reset(), TOOL_BASE::RUN, and setActiveState().

Referenced by dispatchActivation().

◆ SaveClipboard()

bool TOOL_MANAGER::SaveClipboard ( const std::string &  aTextUTF8)

Store information to the system clipboard.

Parameters
aTextis the information to be stored, expected UTF8 encoding. The text will be stored as Unicode string (not stored as UTF8 string).
Returns
False if error occurred.

Definition at line 1048 of file tool_manager.cpp.

Referenced by SYMBOL_EDITOR_EDIT_TOOL::Copy(), PL_EDIT_TOOL::Copy(), and SCH_EDITOR_CONTROL::doCopy().

◆ saveViewControls()

void TOOL_MANAGER::saveViewControls ( TOOL_STATE aState)
private

Save the #VIEW_CONTROLS settings to the tool state object.

If #VIEW_CONTROLS settings are affected by TOOL_MANAGER, the original settings are saved.

Definition at line 1133 of file tool_manager.cpp.

References cursor, TOOL_BASE::GetId(), KIGFX::VIEW_CONTROLS::GetSettings(), m_cursorSettings, KIGFX::VC_SETTINGS::m_forceCursorPosition, KIGFX::VC_SETTINGS::m_forcedPosition, m_menuActive, m_menuCursor, m_viewControls, TOOL_MANAGER::TOOL_STATE::theTool, and TOOL_MANAGER::TOOL_STATE::vcSettings.

Referenced by setActiveState().

◆ ScheduleContextMenu()

void TOOL_MANAGER::ScheduleContextMenu ( TOOL_BASE aTool,
ACTION_MENU aMenu,
CONTEXT_MENU_TRIGGER  aTrigger 
)

Set behavior of the tool's context popup menu.

Parameters
aToolis the parent tool.
aMenuis the menu structure, defined by the tool.
aTriggerdetermines when the menu is activated: CMENU_NOW: opens the menu right now CMENU_BUTTON: opens the menu when RMB is pressed CMENU_OFF: menu is disabled. May be called from a coroutine context.

Definition at line 1038 of file tool_manager.cpp.

References TOOL_MANAGER::TOOL_STATE::contextMenu, TOOL_MANAGER::TOOL_STATE::contextMenuTrigger, and m_toolState.

Referenced by TOOL_INTERACTIVE::SetContextMenu().

◆ ScheduleNextState()

void TOOL_MANAGER::ScheduleNextState ( TOOL_BASE aTool,
TOOL_STATE_FUNC aHandler,
const TOOL_EVENT_LIST aConditions 
)

Define a state transition.

The events that cause a given handler method in the tool to be called. Called by TOOL_INTERACTIVE::Go(). May be called from a coroutine context.

Definition at line 679 of file tool_manager.cpp.

References m_toolState, and TOOL_MANAGER::TOOL_STATE::transitions.

Referenced by TOOL_INTERACTIVE::goInternal().

◆ ScheduleWait()

TOOL_EVENT * TOOL_MANAGER::ScheduleWait ( TOOL_BASE aTool,
const TOOL_EVENT_LIST aConditions 
)

Pause execution of a given tool until one or more events matching aConditions arrives.

The pause/resume operation is done through COROUTINE object. Called only from coroutines.

Definition at line 703 of file tool_manager.cpp.

References TOOL_MANAGER::TOOL_STATE::cofunc, COROUTINE< ReturnType, ArgType >::KiYield(), m_toolState, TOOL_MANAGER::TOOL_STATE::pendingWait, TOOL_MANAGER::TOOL_STATE::shutdown, TOOL_MANAGER::TOOL_STATE::waitEvents, and TOOL_MANAGER::TOOL_STATE::wakeupEvent.

Referenced by TOOL_INTERACTIVE::Wait().

◆ setActiveState()

void TOOL_MANAGER::setActiveState ( TOOL_STATE aState)
private

Save the previous active state and sets a new one.

Parameters
aStateis the new active state. Might be null to indicate there is no new active state. List of tools in the order they were registered

Definition at line 1226 of file tool_manager.cpp.

References applyViewControls(), m_activeState, m_viewControls, and saveViewControls().

Referenced by dispatchInternal(), doRunAction(), finishTool(), InitTools(), invokeTool(), ProcessEvent(), ResetTools(), RunMainStack(), runTool(), and ShutdownTool().

◆ SetEnvironment()

◆ ShutdownAllTools()

◆ ShutdownTool() [1/3]

void TOOL_MANAGER::ShutdownTool ( const std::string &  aToolName)

Shutdown the specified tool by waking it up with a null event to terminate the processing loop.

Parameters
aToolNameis name of the tool to shutdown

Definition at line 529 of file tool_manager.cpp.

References FindTool(), TOOL_BASE::GetType(), INTERACTIVE, kicadTraceToolStack, and ShutdownTool().

◆ ShutdownTool() [2/3]

void TOOL_MANAGER::ShutdownTool ( TOOL_BASE aTool)

◆ ShutdownTool() [3/3]

void TOOL_MANAGER::ShutdownTool ( TOOL_ID  aToolId)

Shutdown the specified tool by waking it up with a null event to terminate the processing loop.

Parameters
aToolIdis the ID of the tool to shutdown

Definition at line 517 of file tool_manager.cpp.

References FindTool(), TOOL_BASE::GetType(), INTERACTIVE, kicadTraceToolStack, and ShutdownTool().

◆ Tools()

std::vector< TOOL_BASE * > TOOL_MANAGER::Tools ( )
inline

◆ UpdateUI()

void TOOL_MANAGER::UpdateUI ( const TOOL_EVENT aEvent)

Update the status bar and synchronizes toolbars.

Definition at line 1248 of file tool_manager.cpp.

References GetToolHolder(), and EDA_BASE_FRAME::UpdateStatusBar().

Referenced by doRunAction(), and ProcessEvent().

◆ VetoContextMenuMouseWarp()

Member Data Documentation

◆ m_actionMgr

ACTION_MANAGER* TOOL_MANAGER::m_actionMgr
private

Original cursor position, if overridden by the context menu handler.

Definition at line 663 of file tool_manager.h.

Referenced by DispatchHotKey(), doRunAction(), GetActionManager(), GetHotKey(), InitTools(), TOOL_MANAGER(), and ~TOOL_MANAGER().

◆ m_activeState

TOOL_STATE* TOOL_MANAGER::m_activeState
private

True if the tool manager is shutting down (don't process additional events)

Definition at line 689 of file tool_manager.h.

Referenced by doRunAction(), finishTool(), and setActiveState().

◆ m_activeTools

ID_LIST TOOL_MANAGER::m_activeTools
private

◆ m_cursorSettings

std::map<TOOL_ID, std::optional<VECTOR2D> > TOOL_MANAGER::m_cursorSettings
private

Definition at line 666 of file tool_manager.h.

Referenced by DispatchContextMenu(), and saveViewControls().

◆ m_eventQueue

std::list<TOOL_EVENT> TOOL_MANAGER::m_eventQueue
private

Right click context menu position.

Definition at line 675 of file tool_manager.h.

Referenced by PostEvent(), and processEvent().

◆ m_frame

TOOLS_HOLDER* TOOL_MANAGER::m_frame
private

Definition at line 671 of file tool_manager.h.

Referenced by DispatchContextMenu(), GetToolHolder(), and SetEnvironment().

◆ m_menuActive

bool TOOL_MANAGER::m_menuActive
private

Tool currently displaying a popup menu. It is negative when there is no menu displayed.

Definition at line 683 of file tool_manager.h.

Referenced by DispatchContextMenu(), IsContextMenuActive(), and saveViewControls().

◆ m_menuCursor

VECTOR2D TOOL_MANAGER::m_menuCursor
private

Definition at line 678 of file tool_manager.h.

Referenced by DispatchContextMenu(), GetMenuCursorPos(), and saveViewControls().

◆ m_menuOwner

TOOL_ID TOOL_MANAGER::m_menuOwner
private

Pointer to the state object corresponding to the currently executed tool.

Definition at line 686 of file tool_manager.h.

Referenced by DispatchContextMenu(), and dispatchInternal().

◆ m_model

EDA_ITEM* TOOL_MANAGER::m_model
private

Definition at line 668 of file tool_manager.h.

Referenced by GetModel(), and SetEnvironment().

◆ m_settings

APP_SETTINGS_BASE* TOOL_MANAGER::m_settings
private

Queue that stores events to be processed at the end of the event processing cycle.

Definition at line 672 of file tool_manager.h.

Referenced by GetSettings(), and SetEnvironment().

◆ m_shuttingDown

bool TOOL_MANAGER::m_shuttingDown
private

Definition at line 692 of file tool_manager.h.

Referenced by doRunAction(), ProcessEvent(), and ShutdownAllTools().

◆ m_toolIdIndex

ID_STATE_MAP TOOL_MANAGER::m_toolIdIndex
private

Index of the registered tools to easily lookup by their type.

Definition at line 654 of file tool_manager.h.

Referenced by DispatchContextMenu(), dispatchInternal(), FindTool(), GetCurrentToolState(), InitTools(), IsToolActive(), RegisterTool(), runTool(), ShutdownAllTools(), and ShutdownTool().

◆ m_toolNameIndex

NAME_STATE_MAP TOOL_MANAGER::m_toolNameIndex
private

Index of the registered tools current states, associated by tools' ID numbers.

Definition at line 651 of file tool_manager.h.

Referenced by dispatchActivation(), FindTool(), InitTools(), and RegisterTool().

◆ m_toolOrder

std::vector<TOOL_BASE*> TOOL_MANAGER::m_toolOrder
private

Index of registered tools current states, associated by tools' objects.

Definition at line 645 of file tool_manager.h.

Referenced by InitTools(), RegisterTool(), and Tools().

◆ m_toolState

TOOL_STATE_MAP TOOL_MANAGER::m_toolState
private

Index of the registered tools current states, associated by tools' names.

Definition at line 648 of file tool_manager.h.

Referenced by ClearTransitions(), dispatchInternal(), InitTools(), isRegistered(), RegisterTool(), ResetTools(), RunMainStack(), ScheduleContextMenu(), ScheduleNextState(), ScheduleWait(), and ~TOOL_MANAGER().

◆ m_toolTypes

std::map<const char*, TOOL_BASE*> TOOL_MANAGER::m_toolTypes
private

Stack of the active tools.

Definition at line 657 of file tool_manager.h.

Referenced by GetTool(), InitTools(), and RegisterTool().

◆ m_view

KIGFX::VIEW* TOOL_MANAGER::m_view
private

Definition at line 669 of file tool_manager.h.

Referenced by GetView(), ProcessEvent(), and SetEnvironment().

◆ m_viewControls

◆ m_warpMouseAfterContextMenu

bool TOOL_MANAGER::m_warpMouseAfterContextMenu
private

Flag indicating whether a context menu is currently displayed.

Definition at line 680 of file tool_manager.h.

Referenced by DispatchContextMenu(), and VetoContextMenuMouseWarp().


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