KiCad PCB EDA Suite
|
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_ID > | ID_LIST |
Public Member Functions | |
TOOL_MANAGER () | |
~TOOL_MANAGER () | |
void | RegisterTool (TOOL_BASE *aTool) |
Add a tool to the manager set and sets it up. More... | |
bool | InvokeTool (TOOL_ID aToolId) |
Call a tool by sending a tool activation event to tool of given ID. More... | |
bool | InvokeTool (const std::string &aToolName) |
Call a tool by sending a tool activation event to tool of given name. More... | |
void | ShutdownAllTools () |
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with a null event. More... | |
void | ShutdownTool (TOOL_BASE *aTool) |
Shutdown the specified tool by waking it up with a null event to terminate the processing loop. More... | |
void | ShutdownTool (TOOL_ID aToolId) |
Shutdown the specified tool by waking it up with a null event to terminate the processing loop. More... | |
void | ShutdownTool (const std::string &aToolName) |
Shutdown the specified tool by waking it up with a null event to terminate the processing loop. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
void | PostAction (const TOOL_ACTION &aAction) |
void | CancelTool () |
Send a cancel event to the tool currently at the top of the tool stack. More... | |
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. More... | |
int | GetHotKey (const TOOL_ACTION &aAction) const |
ACTION_MANAGER * | GetActionManager () const |
TOOL_BASE * | FindTool (int aId) const |
Search for a tool with given ID. More... | |
TOOL_BASE * | FindTool (const std::string &aName) const |
Search for a tool with given name. More... | |
template<typename T > | |
T * | GetTool () |
std::vector< TOOL_BASE * > | Tools () |
void | DeactivateTool () |
Deactivate the currently active tool. More... | |
bool | IsToolActive (TOOL_ID aId) const |
Return true if a tool with given id is active (executing) More... | |
void | ResetTools (TOOL_BASE::RESET_REASON aReason) |
Reset all tools (i.e. More... | |
void | InitTools () |
Initializes all registered tools. More... | |
bool | ProcessEvent (const TOOL_EVENT &aEvent) |
Propagate an event to tools that requested events of matching type(s). More... | |
void | PostEvent (const TOOL_EVENT &aEvent) |
Put an event to the event queue to be processed at the end of event processing cycle. More... | |
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). More... | |
KIGFX::VIEW * | GetView () const |
KIGFX::VIEW_CONTROLS * | GetViewControls () const |
VECTOR2D | GetMousePosition () const |
VECTOR2D | GetCursorPosition () const |
EDA_ITEM * | GetModel () const |
APP_SETTINGS_BASE * | GetSettings () const |
TOOLS_HOLDER * | GetToolHolder () const |
int | GetCurrentToolId () const |
Return id of the tool that is on the top of the active tools stack (was invoked the most recently). More... | |
TOOL_BASE * | GetCurrentTool () const |
Return the tool that is on the top of the active tools stack (was invoked the most recently). More... | |
TOOL_STATE * | GetCurrentToolState () const |
Return the #TOOL_STATE object representing the state of the active tool. More... | |
int | GetPriority (int aToolId) const |
Return priority of a given tool. More... | |
void | ScheduleNextState (TOOL_BASE *aTool, TOOL_STATE_FUNC &aHandler, const TOOL_EVENT_LIST &aConditions) |
Define a state transition. More... | |
void | ClearTransitions (TOOL_BASE *aTool) |
Clear the state transition map for a tool. More... | |
void | RunMainStack (TOOL_BASE *aTool, std::function< void()> aFunc) |
void | UpdateUI (const TOOL_EVENT &aEvent) |
Update the status bar and synchronizes toolbars. More... | |
TOOL_EVENT * | ScheduleWait (TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions) |
Pause execution of a given tool until one or more events matching aConditions arrives. More... | |
void | ScheduleContextMenu (TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger) |
Set behavior of the tool's context popup menu. More... | |
bool | SaveClipboard (const std::string &aTextUTF8) |
Store information to the system clipboard. More... | |
std::string | GetClipboardUTF8 () const |
Return the information currently stored in the system clipboard. More... | |
const KIGFX::VC_SETTINGS & | GetCurrentToolVC () const |
Return the view controls settings for the current tool or the general settings if there is no active tool. More... | |
bool | IsContextMenuActive () const |
True while processing a context menu. More... | |
void | VetoContextMenuMouseWarp () |
Disable mouse warping after the current context menu is closed. More... | |
void | DispatchContextMenu (const TOOL_EVENT &aEvent) |
Handle context menu related events. More... | |
bool | DispatchHotKey (const TOOL_EVENT &aEvent) |
Handle specific events, that are intended for TOOL_MANAGER rather than tools. More... | |
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. More... | |
Private Types | |
typedef std::pair< TOOL_EVENT_LIST, TOOL_STATE_FUNC > | TRANSITION |
Private Member Functions | |
bool | doRunAction (const TOOL_ACTION &aAction, bool aNow, const std::any &aParam, COMMIT *aCommit) |
Helper function to actually run an action. More... | |
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. More... | |
bool | dispatchActivation (const TOOL_EVENT &aEvent) |
Check if it is a valid activation event and invokes a proper tool. More... | |
bool | invokeTool (TOOL_BASE *aTool) |
Invoke a tool by sending a proper event (in contrary to runTool, which makes the tool run for real). More... | |
bool | runTool (TOOL_BASE *aTool) |
Make a tool active, so it can receive events and react to them. More... | |
ID_LIST::iterator | finishTool (TOOL_STATE *aState) |
Deactivate a tool and does the necessary clean up. More... | |
bool | isRegistered (TOOL_BASE *aTool) const |
Return information about a tool registration status. More... | |
bool | isActive (TOOL_BASE *aTool) const |
Return information about a tool activation status. More... | |
void | saveViewControls (TOOL_STATE *aState) |
Save the #VIEW_CONTROLS settings to the tool state object. More... | |
void | applyViewControls (const TOOL_STATE *aState) |
Apply #VIEW_CONTROLS settings stored in a #TOOL_STATE object. More... | |
bool | processEvent (const TOOL_EVENT &aEvent) |
Main function for event processing. More... | |
void | setActiveState (TOOL_STATE *aState) |
Save the previous active state and sets a new one. More... | |
Private Attributes | |
std::vector< TOOL_BASE * > | m_toolOrder |
Index of registered tools current states, associated by tools' objects. More... | |
TOOL_STATE_MAP | m_toolState |
Index of the registered tools current states, associated by tools' names. More... | |
NAME_STATE_MAP | m_toolNameIndex |
Index of the registered tools current states, associated by tools' ID numbers. More... | |
ID_STATE_MAP | m_toolIdIndex |
Index of the registered tools to easily lookup by their type. More... | |
std::map< const char *, TOOL_BASE * > | m_toolTypes |
Stack of the active tools. More... | |
ID_LIST | m_activeTools |
Instance of ACTION_MANAGER that handles TOOL_ACTIONs. More... | |
ACTION_MANAGER * | m_actionMgr |
Original cursor position, if overridden by the context menu handler. More... | |
std::map< TOOL_ID, std::optional< VECTOR2D > > | m_cursorSettings |
EDA_ITEM * | m_model |
KIGFX::VIEW * | m_view |
KIGFX::VIEW_CONTROLS * | m_viewControls |
TOOLS_HOLDER * | m_frame |
APP_SETTINGS_BASE * | m_settings |
Queue that stores events to be processed at the end of the event processing cycle. More... | |
std::list< TOOL_EVENT > | m_eventQueue |
Right click context menu position. More... | |
VECTOR2D | m_menuCursor |
bool | m_warpMouseAfterContextMenu |
Flag indicating whether a context menu is currently displayed. More... | |
bool | m_menuActive |
Tool currently displaying a popup menu. It is negative when there is no menu displayed. More... | |
TOOL_ID | m_menuOwner |
Pointer to the state object corresponding to the currently executed tool. More... | |
TOOL_STATE * | m_activeState |
True if the tool manager is shutting down (don't process additional events) More... | |
bool | m_shuttingDown |
Master controller class:
Definition at line 56 of file tool_manager.h.
typedef std::list<TOOL_ID> TOOL_MANAGER::ID_LIST |
Definition at line 70 of file tool_manager.h.
typedef std::map<TOOL_ID, TOOL_STATE*> TOOL_MANAGER::ID_STATE_MAP |
Definition at line 69 of file tool_manager.h.
typedef std::map<std::string, TOOL_STATE*> TOOL_MANAGER::NAME_STATE_MAP |
Definition at line 68 of file tool_manager.h.
typedef std::map<TOOL_BASE*, TOOL_STATE*> TOOL_MANAGER::TOOL_STATE_MAP |
Definition at line 67 of file tool_manager.h.
|
private |
Definition at line 541 of file tool_manager.h.
TOOL_MANAGER::TOOL_MANAGER | ( | ) |
Definition at line 208 of file tool_manager.cpp.
References m_actionMgr.
TOOL_MANAGER::~TOOL_MANAGER | ( | ) |
Definition at line 224 of file tool_manager.cpp.
References m_actionMgr, and m_toolState.
|
private |
Apply #VIEW_CONTROLS settings stored in a #TOOL_STATE object.
Definition at line 1170 of file tool_manager.cpp.
References KIGFX::VIEW_CONTROLS::ApplySettings(), m_viewControls, and TOOL_MANAGER::TOOL_STATE::vcSettings.
Referenced by setActiveState().
void TOOL_MANAGER::CancelTool | ( | ) |
Send a cancel event to the tool currently at the top of the tool stack.
Definition at line 385 of file tool_manager.cpp.
References processEvent(), TA_CANCEL_TOOL, and TC_COMMAND.
Referenced by ACTION_TOOLBAR::onToolEvent().
void TOOL_MANAGER::ClearTransitions | ( | TOOL_BASE * | aTool | ) |
Clear the state transition map for a tool.
aTool | is the tool that should have the transition map cleared. |
Definition at line 682 of file tool_manager.cpp.
References m_toolState.
Referenced by TOOL_INTERACTIVE::resetTransitions().
void TOOL_MANAGER::DeactivateTool | ( | ) |
Deactivate the currently active tool.
Definition at line 599 of file tool_manager.cpp.
References processEvent(), TA_CANCEL_TOOL, and TC_COMMAND.
Referenced by GERBVIEW_FRAME::doCloseWindow(), SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape(), SCH_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DIALOG_UPDATE_PCB::PerformUpdate(), ResetTools(), and FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME().
|
private |
Check if it is a valid activation event and invokes a proper tool.
aEvent | is an event to be tested. |
Definition at line 863 of file tool_manager.cpp.
References TOOL_EVENT::Format(), TOOL_EVENT::getCommandStr(), TOOL_EVENT::IsActivate(), kicadTraceToolStack, m_toolNameIndex, and runTool().
Referenced by processEvent().
void TOOL_MANAGER::DispatchContextMenu | ( | const TOOL_EVENT & | aEvent | ) |
Handle context menu related events.
Definition at line 886 of file tool_manager.cpp.
References BUT_RIGHT, ACTION_MENU::Clone(), CMENU_BUTTON, CMENU_NOW, CMENU_OFF, TOOL_MANAGER::TOOL_STATE::cofunc, TOOL_MANAGER::TOOL_STATE::contextMenu, TOOL_MANAGER::TOOL_STATE::contextMenuTrigger, dispatchInternal(), KIGFX::VIEW_CONTROLS::ForceCursorPosition(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOL_EVENT::IsClick(), m_activeTools, m_cursorSettings, KIGFX::VC_SETTINGS::m_forceCursorPosition, KIGFX::VC_SETTINGS::m_forcedPosition, m_frame, m_menuActive, m_menuCursor, m_menuOwner, m_toolIdIndex, m_viewControls, m_warpMouseAfterContextMenu, TOOL_MANAGER::TOOL_STATE::pendingWait, TOOL_EVENT::SetHasPosition(), TOOL_EVENT::SetParameter(), TA_ANY, TA_CHOICE_MENU_CHOICE, TA_CHOICE_MENU_CLOSED, TC_ANY, TC_COMMAND, TOOL_MANAGER::TOOL_STATE::vcSettings, and TOOL_MANAGER::TOOL_STATE::waitEvents.
Referenced by processEvent().
bool TOOL_MANAGER::DispatchHotKey | ( | const TOOL_EVENT & | aEvent | ) |
Handle specific events, that are intended for TOOL_MANAGER rather than tools.
aEvent | is the event to be processed. |
Definition at line 854 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().
|
private |
Pass an event at first to the active tools, then to all others.
Definition at line 721 of file tool_manager.cpp.
References COROUTINE< ReturnType, ArgType >::Call(), TOOL_EVENT::Category(), TOOL_EVENT_LIST::clear(), TOOL_MANAGER::TOOL_STATE::cofunc, finishTool(), TOOL_EVENT::FirstResponder(), TOOL_EVENT::Format(), TOOL_BASE::GetName(), TOOL_MANAGER::TOOL_STATE::idle, TOOL_MANAGER::TOOL_STATE::initialEvent, TOOL_EVENT::IsChoiceMenu(), kicadTraceToolStack, m_activeTools, m_menuOwner, m_toolIdIndex, m_toolState, TOOL_EVENT_LIST::Matches(), TOOL_EVENT::PassEvent(), TOOL_MANAGER::TOOL_STATE::pendingWait, TOOL_MANAGER::TOOL_STATE::Push(), COROUTINE< ReturnType, ArgType >::Resume(), COROUTINE< ReturnType, ArgType >::Running(), setActiveState(), TOOL_EVENT::SetFirstResponder(), TC_MESSAGE, TOOL_MANAGER::TOOL_STATE::theTool, TOOL_MANAGER::TOOL_STATE::transitions, TOOL_MANAGER::TOOL_STATE::vcSettings, TOOL_MANAGER::TOOL_STATE::waitEvents, and TOOL_MANAGER::TOOL_STATE::wakeupEvent.
Referenced by DispatchContextMenu(), and processEvent().
|
private |
Definition at line 289 of file tool_manager.cpp.
References doRunAction(), ACTION_MANAGER::FindAction(), and m_actionMgr.
|
private |
Helper function to actually run an action.
Definition at line 324 of file tool_manager.cpp.
References GetCursorPosition(), m_activeState, m_shuttingDown, TOOL_ACTION::MakeEvent(), PostEvent(), processEvent(), setActiveState(), STS_CANCELLED, STS_FINISHED, STS_RUNNING, TC_COMMAND, and UpdateUI().
Referenced by doRunAction(), PostAction(), RunAction(), and RunSynchronousAction().
TOOL_BASE * TOOL_MANAGER::FindTool | ( | const std::string & | aName | ) | const |
Search for a tool with given name.
aName | is the name of the requested tool. |
Definition at line 588 of file tool_manager.cpp.
References m_toolNameIndex.
TOOL_BASE * TOOL_MANAGER::FindTool | ( | int | aId | ) | const |
Search for a tool with given ID.
aId | is the ID number of the requested tool. |
Definition at line 577 of file tool_manager.cpp.
References m_toolIdIndex.
Referenced by GetCurrentTool(), InvokeTool(), ACTION_MANAGER::RunHotKey(), and ShutdownTool().
|
private |
Deactivate a tool and does the necessary clean up.
aState | is the state variable of the tool to be stopped. |
Definition at line 982 of file tool_manager.cpp.
References TOOL_BASE::GetId(), TOOL_BASE::GetType(), TOOL_MANAGER::TOOL_STATE::idle, INTERACTIVE, m_activeState, m_activeTools, TOOL_MANAGER::TOOL_STATE::Pop(), setActiveState(), and TOOL_MANAGER::TOOL_STATE::theTool.
Referenced by dispatchInternal(), and ShutdownTool().
|
inline |
Definition at line 289 of file tool_manager.h.
References m_actionMgr.
Referenced by TOOLS_HOLDER::CommonSettingsChanged(), ACTION_TOOLBAR::doSelectAction(), ACTION_MENU::OnMenuEvent(), TOOLS_HOLDER::PopTool(), TOOLS_HOLDER::PushTool(), NL_3D_VIEWER_PLUGIN_IMPL::SetActiveCommand(), NL_SCHEMATIC_PLUGIN_IMPL::SetActiveCommand(), NL_PCBNEW_PLUGIN_IMPL::SetActiveCommand(), EDA_3D_VIEWER_FRAME::setupUIConditions(), CVPCB_MAINFRAME::setupUIConditions(), DISPLAY_FOOTPRINTS_FRAME::setupUIConditions(), SCH_EDIT_FRAME::setupUIConditions(), SIMULATOR_FRAME::setupUIConditions(), SYMBOL_EDIT_FRAME::setupUIConditions(), SYMBOL_VIEWER_FRAME::setupUIConditions(), GERBVIEW_FRAME::setupUIConditions(), KICAD_MANAGER_FRAME::setupUIConditions(), PL_EDITOR_FRAME::setupUIConditions(), FOOTPRINT_EDIT_FRAME::setupUIConditions(), FOOTPRINT_VIEWER_FRAME::setupUIConditions(), PCB_EDIT_FRAME::setupUIConditions(), and TOOLS_HOLDER::ShowChangedLanguage().
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.
Definition at line 1065 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().
|
inline |
Return the tool that is on the top of the active tools stack (was invoked the most recently).
Definition at line 408 of file tool_manager.h.
References FindTool(), and GetCurrentToolId().
Referenced by PCB_GRID_HELPER::queryVisible().
|
inline |
Return id of the tool that is on the top of the active tools stack (was invoked the most recently).
Definition at line 397 of file tool_manager.h.
References m_activeTools.
Referenced by GetCurrentTool(), and GetCurrentToolState().
|
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 417 of file tool_manager.h.
References GetCurrentToolId(), and m_toolIdIndex.
Referenced by GetCurrentToolVC(), invokeTool(), and ProcessEvent().
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 1091 of file tool_manager.cpp.
References GetCurrentToolState(), KIGFX::VIEW_CONTROLS::GetSettings(), and m_viewControls.
Referenced by COMMON_TOOLS::ResetLocalCoords().
VECTOR2D TOOL_MANAGER::GetCursorPosition | ( | ) | const |
Definition at line 315 of file tool_manager.cpp.
References KIGFX::VIEW_CONTROLS::GetCursorPosition(), KIPLATFORM::UI::GetMousePosition(), m_viewControls, and ToVECTOR2D().
Referenced by doRunAction(), and invokeTool().
int TOOL_MANAGER::GetHotKey | ( | const TOOL_ACTION & | aAction | ) | const |
Definition at line 424 of file tool_manager.cpp.
References ACTION_MANAGER::GetHotKey(), and m_actionMgr.
Referenced by ACTION_MENU::updateHotKeys().
|
inline |
Definition at line 535 of file tool_manager.h.
References m_menuCursor.
Referenced by ROUTER_TOOL::InlineBreakTrack().
|
inline |
Definition at line 385 of file tool_manager.h.
References m_model.
Referenced by BOARD_INSPECTION_TOOL::ClearHighlight(), BOARD_COMMIT::dirtyIntersectingZones(), DIALOG_POSITION_RELATIVE::getAnchorPos(), BOARD_COMMIT::GetBoard(), TOOL_BASE::getModelInt(), BOARD_INSPECTION_TOOL::highlightNet(), BOARD_COMMIT::Push(), BOARD_COMMIT::Revert(), and GROUP_CONTEXT_MENU::update().
VECTOR2D TOOL_MANAGER::GetMousePosition | ( | ) | const |
Definition at line 306 of file tool_manager.cpp.
References KIPLATFORM::UI::GetMousePosition(), KIGFX::VIEW_CONTROLS::GetMousePosition(), m_viewControls, and ToVECTOR2D().
Referenced by PCB_TUNING_PATTERN::GetPreviewItems(), EE_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), and ACTION_MENU::OnMenuEvent().
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).
aToolId | is the id of queried tool. |
Definition at line 657 of file tool_manager.cpp.
References m_activeTools.
Referenced by ACTION_MANAGER::RunHotKey().
|
inline |
Definition at line 387 of file tool_manager.h.
References m_settings.
Referenced by EDA_DRAW_FRAME::DisplayGridMsg(), PNS_KICAD_IFACE::DisplayItem(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EE_GRID_HELPER::GetGridSize(), PCB_GRID_HELPER::GetGridSize(), PNS_KICAD_IFACE::GetUnits(), COMMON_TOOLS::GridFastCycle(), SCH_EDITOR_CONTROL::GridFeedback(), COMMON_TOOLS::GridNext(), COMMON_TOOLS::GridPreset(), COMMON_TOOLS::GridPrev(), COMMON_TOOLS::OnGridChanged(), COMMON_TOOLS::Reset(), COMMON_TOOLS::ToggleCursor(), and COMMON_TOOLS::ToggleCursorStyle().
|
inline |
Definition at line 311 of file tool_manager.h.
References m_toolTypes, and name.
Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), EDA_BASE_FRAME::AddStandardHelpMenu(), EDA_DRAW_FRAME::AddStandardSubMenus(), SCH_PROPERTIES_PANEL::AfterCommit(), PCB_PROPERTIES_PANEL::AfterCommit(), SCH_MOVE_TOOL::AlignElements(), SCH_EDIT_FRAME::AnnotateSymbols(), SCH_EDITOR_CONTROL::AssignNetclass(), BOARD_EDITOR_CONTROL::AssignNetclass(), EE_SELECTION_TOOL::autostartEvent(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), PCB_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(), EDIT_TOOL::Drag(), DRAWING_TOOL::DrawVia(), BOARD_EDITOR_CONTROL::DrillOrigin(), 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(), EDA_DRAW_FRAME::GetUnitPair(), PCB_CONTROL::GridPlaceOrigin(), GROUP_TOOL::Group(), 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_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(), 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(), 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_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(), 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(), PCB_EDIT_FRAME::saveProjectSettings(), 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(), SCH_EDITOR_CONTROL::SimProbe(), SCH_EDITOR_CONTROL::SimTune(), EDA_DRAW_FRAME::ToggleUserUnits(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow(), DIALOG_LIB_TEXT_PROPERTIES::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().
|
inline |
Definition at line 389 of file tool_manager.h.
References m_frame.
Referenced by TOOL_DISPATCHER::DispatchWxEvent(), ACTION_TOOLBAR::doSelectAction(), VIA_SIZE_MENU::eventHandler(), DIALOG_POSITION_RELATIVE::getAnchorPos(), TOOL_BASE::getToolHolderInt(), highlightNet(), EDA_3D_CONTROLLER::Main(), SCH_COMMIT::makeImage(), ACTION_TOOLBAR::onPaletteEvent(), ACTION_TOOLBAR::onToolEvent(), SCH_COMMIT::parentObject(), ACTION_TOOLBAR::popupPalette(), processEvent(), BOARD_COMMIT::Push(), SCH_COMMIT::pushLibEdit(), SCH_COMMIT::pushSchEdit(), EDA_3D_CONTROLLER::Reset(), SCH_COMMIT::Revert(), SCH_COMMIT::revertLibEdit(), ACTION_MANAGER::RunHotKey(), SCH_COMMIT::SCH_COMMIT(), NL_3D_VIEWER_PLUGIN_IMPL::SetActiveCommand(), NL_SCHEMATIC_PLUGIN_IMPL::SetActiveCommand(), NL_PCBNEW_PLUGIN_IMPL::SetActiveCommand(), ACTION_MANAGER::SetConditions(), EDA_3D_CONTROLLER::SetMaterial(), EDA_3D_CONTROLLER::ToggleLayersManager(), EDA_3D_CONTROLLER::ToggleVisibility(), VIA_SIZE_MENU::update(), ACTION_MANAGER::UpdateHotKeys(), and UpdateUI().
|
inline |
Definition at line 378 of file tool_manager.h.
References m_view.
Referenced by EE_GRID_HELPER::BestDragOrigin(), PCB_GRID_HELPER::BestDragOrigin(), PCB_GRID_HELPER::BestSnapAnchor(), EE_GRID_HELPER::BestSnapAnchor(), GRID_HELPER::canUseGrid(), BOARD_INSPECTION_TOOL::ClearHighlight(), PCB_GRID_HELPER::computeAnchors(), BOARD_INSPECTION_TOOL::doHideRatsnestNet(), EDIT_TOOL::doMoveSelection(), EE_GRID_HELPER::EE_GRID_HELPER(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), EE_GRID_HELPER::GetGrid(), GRID_HELPER::GetGridSize(), EE_GRID_HELPER::GetGridSize(), PCB_GRID_HELPER::GetGridSize(), GRID_HELPER::GetOrigin(), TOOL_DISPATCHER::getView(), TOOL_BASE::getView(), GRID_HELPER::GetVisibleGrid(), BOARD_INSPECTION_TOOL::HighlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), ROUTER_TOOL::Init(), DRAWING_TOOL::Init(), PCB_SELECTION_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PCB_GRID_HELPER::PCB_GRID_HELPER(), BOARD_COMMIT::Push(), SCH_COMMIT::pushLibEdit(), SCH_COMMIT::pushSchEdit(), EE_GRID_HELPER::queryVisible(), PCB_GRID_HELPER::queryVisible(), SCH_COMMIT::Revert(), BOARD_COMMIT::Revert(), GRID_HELPER::SetAuxAxes(), SCH_MOVE_TOOL::trimDanglingLines(), PNS::TOOL_BASE::updateEndItem(), PNS::TOOL_BASE::updateStartItem(), EE_GRID_HELPER::~EE_GRID_HELPER(), and PCB_GRID_HELPER::~PCB_GRID_HELPER().
|
inline |
Definition at line 380 of file tool_manager.h.
References m_viewControls.
Referenced by ZONE_CREATE_HELPER::createNewZone(), TOOL_DISPATCHER::DispatchWxEvent(), and TOOL_BASE::getViewControls().
void TOOL_MANAGER::InitTools | ( | ) |
Initializes all registered tools.
If a tool fails during the initialization, it is deactivated and becomes unavailable for further use. Initialization should be done only once.
Definition at line 624 of file tool_manager.cpp.
References TOOL_BASE::GetId(), TOOL_BASE::GetName(), TOOL_BASE::Init(), kicadTraceToolStack, m_actionMgr, m_toolIdIndex, m_toolNameIndex, m_toolOrder, m_toolState, m_toolTypes, ResetTools(), TOOL_BASE::RUN, setActiveState(), and ACTION_MANAGER::UpdateHotKeys().
Referenced by PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL(), CVPCB_MAINFRAME::setupTools(), SCH_EDIT_FRAME::setupTools(), SIMULATOR_FRAME::setupTools(), SYMBOL_EDIT_FRAME::setupTools(), SYMBOL_VIEWER_FRAME::setupTools(), GERBVIEW_FRAME::setupTools(), KICAD_MANAGER_FRAME::setupTools(), PL_EDITOR_FRAME::setupTools(), FOOTPRINT_EDIT_FRAME::setupTools(), and PCB_EDIT_FRAME::setupTools().
bool TOOL_MANAGER::InvokeTool | ( | const std::string & | aToolName | ) |
Call a tool by sending a tool activation event to tool of given name.
aToolName | is the name of the requested tool. |
Definition at line 275 of file tool_manager.cpp.
References FindTool(), TOOL_BASE::GetType(), INTERACTIVE, invokeTool(), and kicadTraceToolStack.
|
private |
Invoke a tool by sending a proper event (in contrary to runTool, which makes the tool run for real).
aTool | is the tool to be invoked. |
Definition at line 430 of file tool_manager.cpp.
References GetCurrentToolState(), GetCursorPosition(), TOOL_BASE::GetName(), processEvent(), setActiveState(), TOOL_EVENT::SetMousePosition(), TA_ACTIVATE, and TC_COMMAND.
Referenced by InvokeTool().
bool TOOL_MANAGER::InvokeTool | ( | TOOL_ID | aToolId | ) |
Call a tool by sending a tool activation event to tool of given ID.
aToolId | is the ID number of the requested tool. |
Definition at line 261 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(), SYMBOL_EDIT_FRAME::setupTools(), SYMBOL_VIEWER_FRAME::setupTools(), GERBVIEW_FRAME::setupTools(), PL_EDITOR_FRAME::setupTools(), FOOTPRINT_EDIT_FRAME::setupTools(), and PCB_EDIT_FRAME::setupTools().
|
private |
Return information about a tool activation status.
aTool | is the tool to be checked. |
Definition at line 1120 of file tool_manager.cpp.
References alg::contains(), TOOL_BASE::GetId(), isRegistered(), and m_activeTools.
Referenced by runTool(), and ShutdownTool().
|
inline |
True while processing a context menu.
Definition at line 506 of file tool_manager.h.
References m_menuActive.
Referenced by DIALOG_SHIM::DIALOG_SHIM(), and ROUTER_TOOL::InlineBreakTrack().
|
inlineprivate |
Return information about a tool registration status.
aTool | is the tool to be checked. |
Definition at line 596 of file tool_manager.h.
References m_toolState.
Referenced by isActive(), and runTool().
bool TOOL_MANAGER::IsToolActive | ( | TOOL_ID | aId | ) | const |
Return true if a tool with given id is active (executing)
Definition at line 1235 of file tool_manager.cpp.
References m_toolIdIndex.
Referenced by TOOL_BASE::IsToolActive().
|
static |
Generates a unique ID from for a tool with given name.
Definition at line 1100 of file tool_manager.cpp.
|
inline |
Definition at line 238 of file tool_manager.h.
References doRunAction().
|
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.
aActionName | is the name of action to be invoked. |
aParam | is an optional parameter that might be used by the invoked action. Its meaning depends on the action. |
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_EDITOR_CONTROL::ChangeLineMode(), SCH_EDIT_TOOL::ConvertDeMorgan(), 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(), EDIT_TOOL::Flip(), GERBVIEW_FRAME::GERBVIEW_FRAME(), EDIT_TOOL::GetAndPlace(), SCH_EDIT_TOOL::InteractiveDelete(), SYMBOL_EDITOR_EDIT_TOOL::InteractiveDelete(), PL_EDIT_TOOL::InteractiveDelete(), 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(), PCB_TUNING_PATTERN::ShowPropertiesDialog(), SCH_EDITOR_CONTROL::SimProbe(), SCH_EDITOR_CONTROL::SimTune(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDIT_TOOL::Swap(), SIMULATOR_CONTROL::Tune(), and SCH_DRAWING_TOOLS::TwoClickPlace().
|
inline |
Definition at line 265 of file tool_manager.h.
References doRunAction().
|
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.
aAction | is the action to be invoked. |
aParam | is 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().
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.
aEvent | is the event to be put into the queue. |
Definition at line 413 of file tool_manager.cpp.
References TOOL_EVENT::IsSimulator(), and m_eventQueue.
Referenced by SCH_MOVE_TOOL::AlignElements(), SYMBOL_EDITOR_MOVE_TOOL::AlignElements(), EDIT_TOOL::doMoveSelection(), SYMBOL_EDITOR_MOVE_TOOL::doMoveSelection(), SCH_MOVE_TOOL::doMoveSelection(), doRunAction(), 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().
void TOOL_MANAGER::PrimeTool | ( | const VECTOR2D & | aPosition | ) |
"Prime" a tool by sending a cursor left-click event with the mouse position set to the passed in position.
aPosition | is the mouse position to use in the event Return the hot key associated with a given action or 0 if there is none. |
aAction | is the queried action. |
Definition at line 393 of file tool_manager.cpp.
References BUT_LEFT, PostEvent(), TOOL_EVENT::SetMousePosition(), TA_PRIME, and TC_MOUSE.
Referenced by SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), SCH_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), DRAWING_TOOL::InteractivePlaceWithPreview(), ROUTER_TOOL::MainLoop(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), DRAWING_TOOL::PlaceReferenceImage(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace().
bool TOOL_MANAGER::ProcessEvent | ( | const TOOL_EVENT & | aEvent | ) |
Propagate an event to tools that requested events of matching type(s).
aEvent | is the event to be processed. |
Definition at line 1008 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(), 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(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), EDIT_TOOL::Mirror(), 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::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(), PL_SELECTION_TOOL::SelectPoint(), PCB_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::selectPoint(), PCB_SELECTION_TOOL::selectSameSheet(), PCB_SELECTION_TOOL::selectSheetContents(), 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().
|
private |
Main function for event processing.
Definition at line 1176 of file tool_manager.cpp.
References dispatchActivation(), DispatchContextMenu(), DispatchHotKey(), dispatchInternal(), TOOL_EVENT::ForceImmediate(), TOOL_EVENT::Format(), TOOL_EVENT::getCommandStr(), GetToolHolder(), kicadTraceToolStack, m_eventQueue, processEvent(), and TOOL_EVENT::SetHasPosition().
Referenced by CancelTool(), DeactivateTool(), doRunAction(), invokeTool(), ProcessEvent(), and processEvent().
void TOOL_MANAGER::RegisterTool | ( | TOOL_BASE * | aTool | ) |
Add a tool to the manager set and sets it up.
Called once for each tool during application initialization.
aTool | tool to be added. Ownership is transferred. |
Definition at line 239 of file tool_manager.cpp.
References TOOL_BASE::attachManager(), TOOL_BASE::GetId(), TOOL_BASE::GetName(), m_toolIdIndex, m_toolNameIndex, m_toolOrder, m_toolState, m_toolTypes, and TOOL_MANAGER::TOOL_STATE::theTool.
Referenced by BOOST_FIXTURE_TEST_CASE(), KI_TEST::FillZones(), PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL(), CVPCB_MAINFRAME::setupTools(), SCH_EDIT_FRAME::setupTools(), SIMULATOR_FRAME::setupTools(), SYMBOL_EDIT_FRAME::setupTools(), SYMBOL_VIEWER_FRAME::setupTools(), GERBVIEW_FRAME::setupTools(), KICAD_MANAGER_FRAME::setupTools(), PL_EDITOR_FRAME::setupTools(), FOOTPRINT_EDIT_FRAME::setupTools(), and PCB_EDIT_FRAME::setupTools().
void TOOL_MANAGER::ResetTools | ( | TOOL_BASE::RESET_REASON | aReason | ) |
Reset all tools (i.e.
calls their Reset() method).
Definition at line 607 of file tool_manager.cpp.
References DeactivateTool(), TOOL_BASE::GetType(), INTERACTIVE, m_toolState, TOOL_BASE::REDRAW, TOOL_BASE::Reset(), and setActiveState().
Referenced by GERBVIEW_FRAME::ActivateGalCanvas(), PCB_BASE_FRAME::ActivateGalCanvas(), GERBVIEW_FRAME::Clear_DrawLayers(), FOOTPRINT_EDIT_FRAME::Clear_Pcb(), PCB_EDIT_FRAME::Clear_Pcb(), SCH_EDIT_FRAME::DisplayCurrentSheet(), KIGFX::SCH_VIEW::DisplaySheet(), GERBVIEW_FRAME::Erase_Current_DrawLayer(), COMMON_TOOLS::GridOrigin(), InitTools(), SYMBOL_EDIT_FRAME::KiwayMailIn(), SYMBOL_EDIT_FRAME::LoadOneLibrarySymbolAux(), SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic(), SYMBOL_EDITOR_CONTROL::OnDeMorgan(), PCB_BASE_FRAME::OnFpChangeDebounceTimer(), SYMBOL_EDIT_FRAME::OnSelectUnit(), PCB_EDIT_FRAME::RebuildAndRefresh(), SYMBOL_EDIT_FRAME::RebuildView(), FOOTPRINT_WIZARD_FRAME::RegenerateFootprint(), SCH_COMMIT::revertLibEdit(), PCB_BASE_EDIT_FRAME::SetBoard(), SYMBOL_EDIT_FRAME::SetCurSymbol(), SCH_EDIT_FRAME::SetScreen(), SYMBOL_EDIT_FRAME::SetScreen(), PCB_EDIT_FRAME::ShowBoardSetupDialog(), EDA_BASE_FRAME::ShowPreferences(), SCH_BASE_FRAME::SyncView(), DISPLAY_FOOTPRINTS_FRAME::updateView(), FOOTPRINT_EDIT_FRAME::UpdateView(), FOOTPRINT_VIEWER_FRAME::updateView(), and FOOTPRINT_WIZARD_FRAME::updateView().
|
inline |
Definition at line 153 of file tool_manager.h.
References doRunAction().
|
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.
aActionName | is the name of action to be invoked. |
aParam | is an optional parameter that might be used by the invoked action. Its meaning depends on the action. |
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_NAVIGATE_TOOL::changeSheet(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), GERBVIEW_CONTROL::ClearAllLayers(), PCB_SELECTION_TOOL::ClearSelection(), ZONE_CREATE_HELPER::commitZone(), EDA_DRAW_FRAME::CommonSettingsChanged(), SCH_EDIT_TOOL::ConvertDeMorgan(), SCH_EDIT_FRAME::ConvertPart(), 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_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_LINE_WIRE_BUS_TOOL::DrawSegments(), SCH_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), 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_NAVIGATE_TOOL::Forward(), GERBVIEW_FRAME::GERBVIEW_FRAME(), EDIT_TOOL::GetAndPlace(), DRAWING_TOOL::getSourceZoneForAction(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), PCB_SELECTION_TOOL::grabUnconnected(), COMMON_TOOLS::GridOrigin(), PCB_CONTROL::GridPlaceOrigin(), BOARD_INSPECTION_TOOL::HighlightItem(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PL_EDIT_TOOL::ImportDrawingSheetContent(), SCH_EDIT_FRAME::importFile(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), SCH_EDIT_FRAME::initScreenZoom(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), 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_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::OnERCItemSelected(), SCH_EDIT_FRAME::OnFindDialogClose(), 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(), 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(), SCH_DRAWING_TOOLS::SchImportGraphics(), 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(), SYMBOL_EDITOR_DRAWING_TOOLS::SymbolImportGraphics(), 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(), PCB_PROPERTIES_PANEL::valueChanged(), 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().
|
inline |
Definition at line 208 of file tool_manager.h.
References doRunAction().
|
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.
aAction | is the action to be invoked. |
aParam | is an optional parameter that might be used by the invoked action. Its meaning depends on the action. |
Definition at line 173 of file tool_manager.h.
References doRunAction().
void TOOL_MANAGER::RunMainStack | ( | TOOL_BASE * | aTool, |
std::function< void()> | aFunc | ||
) |
Definition at line 688 of file tool_manager.cpp.
References TOOL_MANAGER::TOOL_STATE::cofunc, m_toolState, COROUTINE< ReturnType, ArgType >::RunMainStack(), and setActiveState().
Referenced by TOOL_INTERACTIVE::RunMainStack().
|
inline |
Definition at line 200 of file tool_manager.h.
References doRunAction().
|
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.
aAction | is the action to be invoked. |
aCommit | is the commit object the tool handling the action should add the new edits to |
Definition at line 192 of file tool_manager.h.
References doRunAction().
Referenced by 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().
|
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.
aTool | is the tool to be run. |
Definition at line 445 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().
bool TOOL_MANAGER::SaveClipboard | ( | const std::string & | aTextUTF8 | ) |
Store information to the system clipboard.
aText | is the information to be stored, expected UTF8 encoding. The text will be stored as Unicode string (not stored as UTF8 string). |
Definition at line 1045 of file tool_manager.cpp.
Referenced by SYMBOL_EDITOR_EDIT_TOOL::Copy(), PL_EDIT_TOOL::Copy(), and SCH_EDITOR_CONTROL::doCopy().
|
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 1130 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().
void TOOL_MANAGER::ScheduleContextMenu | ( | TOOL_BASE * | aTool, |
ACTION_MENU * | aMenu, | ||
CONTEXT_MENU_TRIGGER | aTrigger | ||
) |
Set behavior of the tool's context popup menu.
aTool | is the parent tool. |
aMenu | is the menu structure, defined by the tool. |
aTrigger | determines 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 1035 of file tool_manager.cpp.
References TOOL_MANAGER::TOOL_STATE::contextMenu, TOOL_MANAGER::TOOL_STATE::contextMenuTrigger, and m_toolState.
Referenced by TOOL_INTERACTIVE::SetContextMenu().
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 673 of file tool_manager.cpp.
References m_toolState, and TOOL_MANAGER::TOOL_STATE::transitions.
Referenced by TOOL_INTERACTIVE::goInternal().
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 697 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().
|
private |
Save the previous active state and sets a new one.
aState | is 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 1223 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().
void TOOL_MANAGER::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).
These are made available to the tool. Called by the parent frame when it is set up.
Definition at line 1108 of file tool_manager.cpp.
References m_frame, m_model, m_settings, m_view, and m_viewControls.
Referenced by GERBVIEW_FRAME::ActivateGalCanvas(), PCB_BASE_FRAME::ActivateGalCanvas(), BITMAP2CMP_FRAME::BITMAP2CMP_FRAME(), BOOST_FIXTURE_TEST_CASE(), DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME(), EVT_GRID_CMD_CELL_CHANGED(), EVT_TOOL_RANGE(), KI_TEST::FillZones(), PCBNEW_JOBS_HANDLER::JobExportDrc(), PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL(), PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME(), PCB_BASE_EDIT_FRAME::SetBoard(), CVPCB_MAINFRAME::setupTools(), SCH_EDIT_FRAME::setupTools(), SIMULATOR_FRAME::setupTools(), SYMBOL_EDIT_FRAME::setupTools(), SYMBOL_VIEWER_FRAME::setupTools(), GERBVIEW_FRAME::setupTools(), KICAD_MANAGER_FRAME::setupTools(), PL_EDITOR_FRAME::setupTools(), FOOTPRINT_EDIT_FRAME::setupTools(), and PCB_EDIT_FRAME::setupTools().
void TOOL_MANAGER::ShutdownAllTools | ( | ) |
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with a null event.
Definition at line 490 of file tool_manager.cpp.
References m_activeTools, m_shuttingDown, m_toolIdIndex, and ShutdownTool().
Referenced by SCH_EDIT_FRAME::doCloseWindow(), CVPCB_MAINFRAME::~CVPCB_MAINFRAME(), DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME(), FOOTPRINT_EDIT_FRAME::~FOOTPRINT_EDIT_FRAME(), FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME(), GERBVIEW_FRAME::~GERBVIEW_FRAME(), KICAD_MANAGER_FRAME::~KICAD_MANAGER_FRAME(), PCB_EDIT_FRAME::~PCB_EDIT_FRAME(), PL_EDITOR_FRAME::~PL_EDITOR_FRAME(), SYMBOL_DIFF_FRAME::~SYMBOL_DIFF_FRAME(), SYMBOL_EDIT_FRAME::~SYMBOL_EDIT_FRAME(), and SYMBOL_VIEWER_FRAME::~SYMBOL_VIEWER_FRAME().
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.
aToolName | is name of the tool to shutdown |
Definition at line 527 of file tool_manager.cpp.
References FindTool(), TOOL_BASE::GetType(), INTERACTIVE, kicadTraceToolStack, and ShutdownTool().
void TOOL_MANAGER::ShutdownTool | ( | TOOL_BASE * | aTool | ) |
Shutdown the specified tool by waking it up with a null event to terminate the processing loop.
aTool | is the tool to shutdown |
Definition at line 539 of file tool_manager.cpp.
References TOOL_EVENT_LIST::clear(), TOOL_MANAGER::TOOL_STATE::cofunc, finishTool(), TOOL_BASE::GetId(), TOOL_BASE::GetName(), isActive(), kicadTraceToolStack, m_activeTools, m_toolIdIndex, TOOL_MANAGER::TOOL_STATE::pendingWait, COROUTINE< ReturnType, ArgType >::Resume(), setActiveState(), TOOL_MANAGER::TOOL_STATE::shutdown, TOOL_MANAGER::TOOL_STATE::theTool, and TOOL_MANAGER::TOOL_STATE::waitEvents.
Referenced by ShutdownAllTools(), and ShutdownTool().
void TOOL_MANAGER::ShutdownTool | ( | TOOL_ID | aToolId | ) |
Shutdown the specified tool by waking it up with a null event to terminate the processing loop.
aToolId | is the ID of the tool to shutdown |
Definition at line 515 of file tool_manager.cpp.
References FindTool(), TOOL_BASE::GetType(), INTERACTIVE, kicadTraceToolStack, and ShutdownTool().
|
inline |
Definition at line 324 of file tool_manager.h.
References m_toolOrder.
Referenced by FOOTPRINT_EDIT_FRAME::setupTools(), and PCB_EDIT_FRAME::setupTools().
void TOOL_MANAGER::UpdateUI | ( | const TOOL_EVENT & | aEvent | ) |
Update the status bar and synchronizes toolbars.
Definition at line 1245 of file tool_manager.cpp.
References GetToolHolder(), and EDA_BASE_FRAME::UpdateStatusBar().
Referenced by doRunAction(), and ProcessEvent().
|
inline |
Disable mouse warping after the current context menu is closed.
This must be called before invoking each context menu. It's a good idea to call this from non-modal dialogs (e.g. DRC window).
Definition at line 517 of file tool_manager.h.
References m_warpMouseAfterContextMenu.
Referenced by DIALOG_SHIM::DIALOG_SHIM(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape(), SCH_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), DRAWING_TOOL::PlaceReferenceImage(), SCH_DRAWING_TOOLS::PlaceSymbol(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace().
|
private |
Original cursor position, if overridden by the context menu handler.
Definition at line 655 of file tool_manager.h.
Referenced by DispatchHotKey(), doRunAction(), GetActionManager(), GetHotKey(), InitTools(), TOOL_MANAGER(), and ~TOOL_MANAGER().
|
private |
True if the tool manager is shutting down (don't process additional events)
Definition at line 681 of file tool_manager.h.
Referenced by doRunAction(), finishTool(), and setActiveState().
|
private |
Instance of ACTION_MANAGER that handles TOOL_ACTIONs.
Definition at line 652 of file tool_manager.h.
Referenced by DispatchContextMenu(), dispatchInternal(), finishTool(), GetCurrentToolId(), GetPriority(), isActive(), runTool(), ShutdownAllTools(), and ShutdownTool().
Definition at line 658 of file tool_manager.h.
Referenced by DispatchContextMenu(), and saveViewControls().
|
private |
Right click context menu position.
Definition at line 667 of file tool_manager.h.
Referenced by PostEvent(), and processEvent().
|
private |
Definition at line 663 of file tool_manager.h.
Referenced by DispatchContextMenu(), GetToolHolder(), and SetEnvironment().
|
private |
Tool currently displaying a popup menu. It is negative when there is no menu displayed.
Definition at line 675 of file tool_manager.h.
Referenced by DispatchContextMenu(), IsContextMenuActive(), and saveViewControls().
|
private |
Definition at line 670 of file tool_manager.h.
Referenced by DispatchContextMenu(), GetMenuCursorPos(), and saveViewControls().
|
private |
Pointer to the state object corresponding to the currently executed tool.
Definition at line 678 of file tool_manager.h.
Referenced by DispatchContextMenu(), and dispatchInternal().
|
private |
Definition at line 660 of file tool_manager.h.
Referenced by GetModel(), and SetEnvironment().
|
private |
Queue that stores events to be processed at the end of the event processing cycle.
Definition at line 664 of file tool_manager.h.
Referenced by GetSettings(), and SetEnvironment().
|
private |
Definition at line 684 of file tool_manager.h.
Referenced by doRunAction(), ProcessEvent(), and ShutdownAllTools().
|
private |
Index of the registered tools to easily lookup by their type.
Definition at line 646 of file tool_manager.h.
Referenced by DispatchContextMenu(), dispatchInternal(), FindTool(), GetCurrentToolState(), InitTools(), IsToolActive(), RegisterTool(), runTool(), ShutdownAllTools(), and ShutdownTool().
|
private |
Index of the registered tools current states, associated by tools' ID numbers.
Definition at line 643 of file tool_manager.h.
Referenced by dispatchActivation(), FindTool(), InitTools(), and RegisterTool().
|
private |
Index of registered tools current states, associated by tools' objects.
Definition at line 637 of file tool_manager.h.
Referenced by InitTools(), RegisterTool(), and Tools().
|
private |
Index of the registered tools current states, associated by tools' names.
Definition at line 640 of file tool_manager.h.
Referenced by ClearTransitions(), dispatchInternal(), InitTools(), isRegistered(), RegisterTool(), ResetTools(), RunMainStack(), ScheduleContextMenu(), ScheduleNextState(), ScheduleWait(), and ~TOOL_MANAGER().
|
private |
Stack of the active tools.
Definition at line 649 of file tool_manager.h.
Referenced by GetTool(), InitTools(), and RegisterTool().
|
private |
Definition at line 661 of file tool_manager.h.
Referenced by GetView(), ProcessEvent(), and SetEnvironment().
|
private |
Definition at line 662 of file tool_manager.h.
Referenced by applyViewControls(), DispatchContextMenu(), GetCurrentToolVC(), GetCursorPosition(), GetMousePosition(), GetViewControls(), saveViewControls(), setActiveState(), and SetEnvironment().
|
private |
Flag indicating whether a context menu is currently displayed.
Definition at line 672 of file tool_manager.h.
Referenced by DispatchContextMenu(), and VetoContextMenuMouseWarp().