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

Generic, UI-independent tool event. More...

#include <tool_event.h>

Public Member Functions

const std::string Format () const
 Return information about event in form of a human-readable string.
 
 TOOL_EVENT (TOOL_EVENT_CATEGORY aCategory=TC_NONE, TOOL_ACTIONS aAction=TA_NONE, TOOL_ACTION_SCOPE aScope=AS_GLOBAL)
 
 TOOL_EVENT (TOOL_EVENT_CATEGORY aCategory, TOOL_ACTIONS aAction, int aExtraParam, TOOL_ACTION_SCOPE aScope=AS_GLOBAL)
 
 TOOL_EVENT (TOOL_EVENT_CATEGORY aCategory, TOOL_ACTIONS aAction, const std::string &aExtraParam, TOOL_ACTION_SCOPE aScope=AS_GLOBAL)
 
TOOL_EVENT_CATEGORY Category () const
 Return the category (eg. mouse/keyboard/action) of an event.
 
TOOL_ACTIONS Action () const
 Returns more specific information about the type of an event.
 
bool PassEvent () const
 These give a tool a method of informing the TOOL_MANAGER that a particular event should be passed on to subsequent tools on the stack.
 
void SetPassEvent (bool aPass=true)
 
bool HasPosition () const
 Returns if it this event has a valid position (true for mouse events and context-menu or hotkey-based command events).
 
void SetHasPosition (bool aHasPosition)
 
bool ForceImmediate () const
 Returns if the action associated with this event should be treated as immediate regardless of the current immediate action settings.
 
void SetForceImmediate (bool aForceImmediate=true)
 
TOOL_BASEFirstResponder () const
 
void SetFirstResponder (TOOL_BASE *aTool)
 
bool IsReactivate () const
 Control whether the tool is first being pushed to the stack or being reactivated after a pause.
 
void SetReactivate (bool aReactivate=true)
 
void SetSynchronous (std::atomic< SYNCRONOUS_TOOL_STATE > *aState)
 
std::atomic< SYNCRONOUS_TOOL_STATE > * SynchronousState () const
 
void SetCommit (COMMIT *aCommit)
 
COMMITCommit () const
 
const VECTOR2D Delta () const
 Return information about difference between current mouse cursor position and the place where dragging has started.
 
const VECTOR2D Position () const
 Return mouse cursor position in world coordinates.
 
const VECTOR2D DragOrigin () const
 Return the point where dragging has started.
 
int Buttons () const
 Return information about mouse buttons state.
 
bool IsClick (int aButtonMask=BUT_ANY) const
 
bool IsDblClick (int aButtonMask=BUT_ANY) const
 
bool IsDrag (int aButtonMask=BUT_ANY) const
 
bool IsMouseDown (int aButtonMask=BUT_ANY) const
 
bool IsMouseUp (int aButtonMask=BUT_ANY) const
 
bool IsMotion () const
 
bool IsMouseAction () const
 
bool IsCancel () const
 
bool IsActivate () const
 
bool IsUndoRedo () const
 
bool IsChoiceMenu () const
 
bool IsPrime () const
 
int Modifier (int aMask=MD_MODIFIER_MASK) const
 Return information about key modifiers state (Ctrl, Alt, etc.).
 
bool DisableGridSnapping () const
 
int KeyCode () const
 
bool IsKeyPressed () const
 
bool Matches (const TOOL_EVENT &aEvent) const
 Test whether two events match in terms of category & action or command.
 
bool IsAction (const TOOL_ACTION *aAction) const
 Test if the event contains an action issued upon activation of the given TOOL_ACTION.
 
bool IsCancelInteractive () const
 Indicate the event should restart/end an ongoing interactive tool's event loop (eg esc key, click cancel, start different tool).
 
bool IsSelectionEvent () const
 Indicate an selection-changed notification event.
 
bool IsPointEditor () const
 Indicate if the event is from one of the point editors.
 
bool IsMoveTool () const
 Indicate if the event is from one of the move tools.
 
bool IsEditorTool () const
 Indicate if the event is asking for an editor tool.
 
bool IsSimulator () const
 Indicate if the event is from the simulator.
 
bool HasParameter () const
 
template<typename T, std::enable_if_t<!std::is_pointer< T >::value > * = nullptr>
T Parameter () const
 Return a parameter assigned to the event.
 
template<typename T, std::enable_if_t< std::is_pointer< T >::value > * = nullptr>
T Parameter () const
 Return pointer parameter assigned to the event.
 
template<typename T>
void SetParameter (T aParam)
 Set a non-standard parameter assigned to the event.
 
std::optional< int > GetCommandId () const
 
void SetMousePosition (const VECTOR2D &aP)
 
void SetActionGroup (const TOOL_ACTION_GROUP &aGroup)
 
bool IsActionInGroup (const TOOL_ACTION_GROUP &aGroup) const
 

Private Member Functions

void init ()
 
const std::string & getCommandStr () const
 
void setMouseDragOrigin (const VECTOR2D &aP)
 
void setMouseDelta (const VECTOR2D &aP)
 
void setMouseButtons (int aButtons)
 
void setModifiers (int aMods)
 
VECTOR2D returnCheckedPosition (const VECTOR2D &aPos) const
 Ensure that the event is a type that has a position before returning a position, otherwise return a null-constructed position.
 

Private Attributes

TOOL_EVENT_CATEGORY m_category
 
TOOL_ACTIONS m_actions
 
TOOL_ACTION_SCOPE m_scope
 
bool m_passEvent
 
bool m_hasPosition
 
bool m_forceImmediate
 
std::optional< TOOL_ACTION_GROUPm_actionGroup
 Optional group that the parent action for the event belongs to.
 
bool m_reactivate
 True when the tool is being re-activated from the stack.
 
VECTOR2D m_mouseDelta
 Difference between mouse cursor position and the point where dragging event has started.
 
VECTOR2D m_mousePos
 Current mouse cursor position.
 
VECTOR2D m_mouseDragOrigin
 Point where dragging has started.
 
int m_mouseButtons
 State of mouse buttons.
 
int m_keyCode
 Stores code of pressed/released key.
 
int m_modifiers
 State of key modifiers (Ctrl/Alt/etc.).
 
std::atomic< SYNCRONOUS_TOOL_STATE > * m_synchronousState
 
COMMITm_commit
 Commit the tool handling the event should add to.
 
ki::any m_param
 Generic parameter used for passing non-standard data.
 
TOOL_BASEm_firstResponder
 The first tool to receive the event.
 
std::optional< int > m_commandId
 
std::string m_commandStr
 

Friends

class TOOL_EVENT_LIST
 
class TOOL_DISPATCHER
 
class TOOL_MANAGER
 
class TOOLS_HOLDER
 

Detailed Description

Generic, UI-independent tool event.

Definition at line 170 of file tool_event.h.

Constructor & Destructor Documentation

◆ TOOL_EVENT() [1/3]

TOOL_EVENT::TOOL_EVENT ( TOOL_EVENT_CATEGORY aCategory = TC_NONE,
TOOL_ACTIONS aAction = TA_NONE,
TOOL_ACTION_SCOPE aScope = AS_GLOBAL )
inline

◆ TOOL_EVENT() [2/3]

◆ TOOL_EVENT() [3/3]

TOOL_EVENT::TOOL_EVENT ( TOOL_EVENT_CATEGORY aCategory,
TOOL_ACTIONS aAction,
const std::string & aExtraParam,
TOOL_ACTION_SCOPE aScope = AS_GLOBAL )
inline

Member Function Documentation

◆ Action()

TOOL_ACTIONS TOOL_EVENT::Action ( ) const
inline

Returns more specific information about the type of an event.

Definition at line 250 of file tool_event.h.

References m_actions.

Referenced by EDIT_TOOL::copyToClipboard(), TOOL_MANAGER::DispatchHotKey(), SCH_MOVE_TOOL::doMoveSelection(), SYMBOL_EDITOR_MOVE_TOOL::doMoveSelection(), and PL_EDIT_TOOL::Main().

◆ Buttons()

int TOOL_EVENT::Buttons ( ) const
inline

Return information about mouse buttons state.

Definition at line 305 of file tool_event.h.

References m_category, m_mouseButtons, and TC_MOUSE.

◆ Category()

TOOL_EVENT_CATEGORY TOOL_EVENT::Category ( ) const
inline

Return the category (eg. mouse/keyboard/action) of an event.

Definition at line 247 of file tool_event.h.

References m_category.

Referenced by EDIT_TOOL::copyToClipboard(), TOOL_MANAGER::dispatchInternal(), and ROUTER_TOOL::handleCommonEvents().

◆ Commit()

◆ Delta()

const VECTOR2D TOOL_EVENT::Delta ( ) const
inline

Return information about difference between current mouse cursor position and the place where dragging has started.

Definition at line 287 of file tool_event.h.

References m_mouseDelta, and returnCheckedPosition().

◆ DisableGridSnapping()

◆ DragOrigin()

const VECTOR2D TOOL_EVENT::DragOrigin ( ) const
inline

◆ FirstResponder()

TOOL_BASE * TOOL_EVENT::FirstResponder ( ) const
inline

Definition at line 268 of file tool_event.h.

References m_firstResponder.

Referenced by TOOL_MANAGER::dispatchInternal().

◆ ForceImmediate()

bool TOOL_EVENT::ForceImmediate ( ) const
inline

Returns if the action associated with this event should be treated as immediate regardless of the current immediate action settings.

Definition at line 265 of file tool_event.h.

References m_forceImmediate.

Referenced by TOOL_MANAGER::processEvent().

◆ Format()

◆ GetCommandId()

std::optional< int > TOOL_EVENT::GetCommandId ( ) const
inline

Definition at line 533 of file tool_event.h.

References m_commandId.

Referenced by SCH_MOVE_TOOL::doMoveSelection().

◆ getCommandStr()

const std::string & TOOL_EVENT::getCommandStr ( ) const
inlineprivate

◆ HasParameter()

◆ HasPosition()

◆ init()

void TOOL_EVENT::init ( )
private

◆ IsAction()

bool TOOL_EVENT::IsAction ( const TOOL_ACTION * aAction) const

Test if the event contains an action issued upon activation of the given TOOL_ACTION.

Parameters
aActionis the TOOL_ACTION to be checked against.
Returns
True if it matches the given TOOL_ACTION.

Definition at line 82 of file tool_event.cpp.

References TOOL_ACTION::MakeEvent(), and Matches().

Referenced by PCB_CONTROL::AddLibrary(), SYMBOL_EDITOR_CONTROL::AddLibrary(), SYMBOL_EDITOR_CONTROL::AddSymbol(), EDIT_TOOL::BooleanPolygons(), SCH_EDIT_TOOL::ChangeSymbols(), EDIT_TOOL::ChangeTrackLayer(), EDIT_TOOL::copyToClipboard(), CONVERT_TOOL::CreateLines(), CONVERT_TOOL::CreatePolys(), SYMBOL_EDITOR_CONTROL::CutCopyDelete(), FOOTPRINT_EDITOR_CONTROL::CutCopyFootprint(), GERBVIEW_CONTROL::DisplayControl(), EDIT_TOOL::doMoveSelection(), SCH_MOVE_TOOL::doMoveSelection(), SYMBOL_EDITOR_MOVE_TOOL::doMoveSelection(), EDIT_TOOL::Drag(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), SCH_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), EDIT_TOOL::Duplicate(), SYMBOL_EDITOR_CONTROL::DuplicateSymbol(), SCH_EDIT_TOOL::EditField(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), COMMON_CONTROL::Execute(), KICAD_MANAGER_CONTROL::Execute(), SCH_FIND_REPLACE_TOOL::FindAndReplace(), BOARD_EDITOR_CONTROL::FindNext(), SCH_FIND_REPLACE_TOOL::FindNext(), GENERATOR_TOOL::GenEditAction(), ROUTER_TOOL::handleLayerSwitch(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_DRAWING_TOOLS::ImportSheet(), TOOL_EVT_UTILS::IsRotateToolEvt(), ZONE_FILLER_TOOL::IsZoneFillAction(), PCB_PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), SCH_MOVE_TOOL::Main(), EDIT_TOOL::Mirror(), EDIT_TOOL::ModifyLines(), passEvent(), passEvent(), PCB_CONTROL::Paste(), SCH_EDITOR_CONTROL::Paste(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SYMBOL_EDITOR_PIN_TOOL::PushPinProperties(), SYMBOL_EDITOR_CONTROL::Save(), SIMULATOR_CONTROL::SaveWorkbook(), PCB_SELECTION_TOOL::selectNet(), SCH_EDIT_TOOL::SetAttribute(), COMMON_CONTROL::ShowHelp(), COMMON_CONTROL::ShowLibraryTable(), SYMBOL_EDITOR_CONTROL::ShowLibraryTable(), PCB_CONTROL::SnapMode(), PL_EDITOR_CONTROL::TitleBlockDisplayMode(), PCB_CONTROL::ToggleRatsnest(), EDA_3D_CONTROLLER::ToggleVisibility(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_FIND_REPLACE_TOOL::UpdateFind(), PCB_CONTROL::ZoneDisplayMode(), SIMULATOR_CONTROL::Zoom(), COMMON_TOOLS::ZoomInOut(), EDA_3D_CONTROLLER::ZoomInOut(), COMMON_TOOLS::ZoomInOutCenter(), and EDA_3D_CONTROLLER::ZoomInOutCenter().

◆ IsActionInGroup()

bool TOOL_EVENT::IsActionInGroup ( const TOOL_ACTION_GROUP & aGroup) const

Definition at line 88 of file tool_event.cpp.

References m_actionGroup.

Referenced by ROUTER_TOOL::handleLayerSwitch().

◆ IsActivate()

◆ IsCancel()

bool TOOL_EVENT::IsCancel ( ) const
inline

Definition at line 340 of file tool_event.h.

References m_actions, and TA_CANCEL_TOOL.

Referenced by init().

◆ IsCancelInteractive()

bool TOOL_EVENT::IsCancelInteractive ( ) const

Indicate the event should restart/end an ongoing interactive tool's event loop (eg esc key, click cancel, start different tool).

Definition at line 224 of file tool_event.cpp.

References ACTIONS::cancelInteractive, m_actions, m_commandId, m_commandStr, and TA_CANCEL_TOOL.

Referenced by EDIT_TOOL::doMoveSelection(), SCH_MOVE_TOOL::doMoveSelection(), SYMBOL_EDITOR_MOVE_TOOL::doMoveSelection(), init(), and PL_EDIT_TOOL::Main().

◆ IsChoiceMenu()

bool TOOL_EVENT::IsChoiceMenu ( ) const
inline

Definition at line 355 of file tool_event.h.

References m_actions, and TA_CHOICE_MENU.

Referenced by TOOL_MANAGER::dispatchInternal().

◆ IsClick()

◆ IsDblClick()

bool TOOL_EVENT::IsDblClick ( int aButtonMask = BUT_ANY) const

◆ IsDrag()

◆ IsEditorTool()

bool TOOL_EVENT::IsEditorTool ( ) const

Indicate if the event is asking for an editor tool.

Used to allow deleting an element without de-activating the current tool.

Definition at line 254 of file tool_event.cpp.

References getCommandStr(), and m_commandStr.

◆ IsKeyPressed()

bool TOOL_EVENT::IsKeyPressed ( ) const
inline

Definition at line 381 of file tool_event.h.

References m_actions, and TA_KEY_PRESSED.

Referenced by ROUTER_TOOL::handleCommonEvents().

◆ IsMotion()

◆ IsMouseAction()

bool TOOL_EVENT::IsMouseAction ( ) const
inline

Definition at line 335 of file tool_event.h.

References m_actions, and TA_MOUSE.

◆ IsMouseDown()

bool TOOL_EVENT::IsMouseDown ( int aButtonMask = BUT_ANY) const
inline

Definition at line 320 of file tool_event.h.

References BUT_ANY, m_actions, m_mouseButtons, and TA_MOUSE_DOWN.

◆ IsMouseUp()

bool TOOL_EVENT::IsMouseUp ( int aButtonMask = BUT_ANY) const
inline

◆ IsMoveTool()

bool TOOL_EVENT::IsMoveTool ( ) const

Indicate if the event is from one of the move tools.

Usually used to allow move to be done without de-activating the current drawing tool.

Definition at line 248 of file tool_event.cpp.

References getCommandStr(), and m_commandStr.

◆ IsPointEditor()

bool TOOL_EVENT::IsPointEditor ( ) const

Indicate if the event is from one of the point editors.

Usually used to allow the point editor to activate itself without de-activating the current drawing tool.

Definition at line 241 of file tool_event.cpp.

References ACTIONS::activatePointEditor, getCommandStr(), m_commandId, and m_commandStr.

◆ IsPrime()

bool TOOL_EVENT::IsPrime ( ) const
inline

Definition at line 360 of file tool_event.h.

References m_actions, and TA_PRIME.

◆ IsReactivate()

bool TOOL_EVENT::IsReactivate ( ) const
inline

◆ IsSelectionEvent()

bool TOOL_EVENT::IsSelectionEvent ( ) const

Indicate an selection-changed notification event.

Definition at line 232 of file tool_event.cpp.

References EVENTS::ClearedEvent, Matches(), EVENTS::PointSelectedEvent, EVENTS::SelectedEvent, and EVENTS::UnselectedEvent.

◆ IsSimulator()

bool TOOL_EVENT::IsSimulator ( ) const

Indicate if the event is from the simulator.

Definition at line 260 of file tool_event.cpp.

References getCommandStr(), and m_commandStr.

Referenced by TOOL_MANAGER::PostEvent().

◆ IsUndoRedo()

bool TOOL_EVENT::IsUndoRedo ( ) const
inline

Definition at line 350 of file tool_event.h.

References m_actions, TA_UNDO_REDO_POST, and TA_UNDO_REDO_PRE.

◆ KeyCode()

int TOOL_EVENT::KeyCode ( ) const
inline

Definition at line 376 of file tool_event.h.

References m_keyCode.

Referenced by TOOL_MANAGER::DispatchHotKey(), and ROUTER_TOOL::handleCommonEvents().

◆ Matches()

◆ Modifier()

◆ Parameter() [1/2]

template<typename T, std::enable_if_t<!std::is_pointer< T >::value > * = nullptr>
T TOOL_EVENT::Parameter ( ) const
inline

Return a parameter assigned to the event.

Its meaning depends on the target tool.

Definition at line 473 of file tool_event.h.

References ki::any_cast(), m_param, name, and T.

Referenced by EMBED_TOOL::AddFile(), SELECTION_TOOL::AddItemsToSel(), SELECTION_TOOL::AddItemToSel(), MICROWAVE_TOOL::addMicrowaveFootprint(), PCB_POINT_EDITOR::changeArcEditMode(), SCH_POINT_EDITOR::changeArcEditMode(), CVPCB_CONTROL::ChangeFocus(), SCH_EDITOR_CONTROL::ChangeLineMode(), ROUTER_TOOL::ChangeRouterMode(), SCH_NAVIGATE_TOOL::ChangeSheet(), SCH_EDIT_TOOL::ChangeTextType(), SYMBOL_EDITOR_CONTROL::ChangeUnit(), COMMON_TOOLS::CursorControl(), PCB_SELECTION_TOOL::CursorSelection(), SCH_EDIT_TOOL::DdAddImage(), PCB_CONTROL::DdAddLibrary(), SYMBOL_EDITOR_CONTROL::DdAddLibrary(), PCB_CONTROL::DdAppendBoard(), SCH_EDIT_TOOL::DdAppendFile(), PCB_CONTROL::DdImportFootprint(), EDIT_TOOL::doMoveSelection(), SCH_MOVE_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), COMMON_CONTROL::Execute(), KICAD_MANAGER_CONTROL::Execute(), EDA_3D_CONTROLLER::ExportImage(), GENERATOR_TOOL::GenEditAction(), TOOL_EVT_UTILS::GetEventRotationAngle(), PCB_CONTROL::GridPlaceOrigin(), COMMON_TOOLS::GridPreset(), GROUP_TOOL::GroupProperties(), ROUTER_TOOL::handleLayerSwitch(), BOARD_INSPECTION_TOOL::HideNetInRatsnest(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_DRAWING_TOOLS::ImportGraphics(), SCH_DRAWING_TOOLS::ImportSheet(), EDIT_TOOL::Increment(), SCH_TOOL_BASE< T >::Increment(), ROUTER_TOOL::InlineDrag(), PCB_CONTROL::IterateFootprint(), PCB_CONTROL::LayerSwitch(), GERBVIEW_CONTROL::LoadGerbFiles(), KICAD_MANAGER_CONTROL::LoadProject(), GERBVIEW_CONTROL::LoadZipfile(), PCB_PICKER_TOOL::Main(), PICKER_TOOL::Main(), SCH_MOVE_TOOL::Main(), ROUTER_TOOL::MainLoop(), EDA_3D_CONTROLLER::On3DGridSelection(), COMMON_TOOLS::PanControl(), EDA_3D_CONTROLLER::PanControl(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_CONTROL::PlaceLinkedDesignBlock(), SCH_DRAWING_TOOLS::PlaceNextSymbolUnit(), DRAWING_TOOL::PlaceReferenceImage(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceTuningPattern(), GENERATOR_TOOL::RegenerateAllOfType(), GENERATOR_TOOL::RegenerateItem(), EDIT_TOOL::Remove(), EMBED_TOOL::RemoveFile(), SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemsFromSel(), BOARD_EDITOR_CONTROL::RepairBoard(), SCH_EDITOR_CONTROL::RepairSchematic(), SELECTION_TOOL::ReselectItem(), EDA_3D_CONTROLLER::RotateView(), ROUTER_TOOL::RouteSelected(), SELECTION_TOOL::SelectionMenu(), GERBVIEW_SELECTION_TOOL::SelectItem(), PCB_PICKER_TOOL::SelectItemInteractively(), GERBVIEW_SELECTION_TOOL::SelectItems(), PCB_SELECTION_TOOL::selectNet(), PCB_PICKER_TOOL::SelectPointInteractively(), PCB_SELECTION_TOOL::selectSheetContents(), EDA_3D_CONTROLLER::SetMaterial(), BOARD_INSPECTION_TOOL::ShowNetInRatsnest(), COMMON_CONTROL::ShowPlayer(), KICAD_MANAGER_CONTROL::ShowPlayer(), SCH_DRAWING_TOOLS::SingleClickPlace(), COMMON_TOOLS::SwitchUnits(), PCB_SELECTION_TOOL::syncSelection(), PCB_SELECTION_TOOL::syncSelectionWithNets(), CVPCB_CONTROL::ToggleFootprintFilter(), CVPCB_CONTROL::ToNA(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_LINE_WIRE_BUS_TOOL::UnfoldBus(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), BOARD_INSPECTION_TOOL::UpdateLocalRatsnest(), CVPCB_CONTROL::UpdateMenu(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::UpdateMenu(), EDA_3D_CONTROLLER::UpdateMenu(), FOOTPRINT_CHOOSER_SELECTION_TOOL::UpdateMenu(), KICAD_MANAGER_CONTROL::UpdateMenu(), SELECTION_TOOL::UpdateMenu(), EDA_3D_CONTROLLER::ViewControl(), KICAD_MANAGER_CONTROL::ViewDroppedViewers(), ZONE_FILLER_TOOL::ZoneFill(), and COMMON_TOOLS::ZoomPreset().

◆ Parameter() [2/2]

template<typename T, std::enable_if_t< std::is_pointer< T >::value > * = nullptr>
T TOOL_EVENT::Parameter ( ) const
inline

Return pointer parameter assigned to the event.

Its meaning depends on the target tool.

Definition at line 499 of file tool_event.h.

References ki::any_cast(), m_param, name, and T.

◆ PassEvent()

bool TOOL_EVENT::PassEvent ( ) const
inline

These give a tool a method of informing the TOOL_MANAGER that a particular event should be passed on to subsequent tools on the stack.

Defaults to true for TC_MESSAGES; false for everything else.

Definition at line 255 of file tool_event.h.

References m_passEvent.

Referenced by TOOL_MANAGER::dispatchInternal().

◆ Position()

◆ returnCheckedPosition()

VECTOR2D TOOL_EVENT::returnCheckedPosition ( const VECTOR2D & aPos) const
private

Ensure that the event is a type that has a position before returning a position, otherwise return a null-constructed position.

Used to defend the position accessors from runtime access when the event does not have a valid position.

Parameters
aPosthe position to return if the event is valid
Returns
the checked position

Definition at line 74 of file tool_event.cpp.

References HasPosition().

Referenced by Delta(), DragOrigin(), and Position().

◆ SetActionGroup()

void TOOL_EVENT::SetActionGroup ( const TOOL_ACTION_GROUP & aGroup)
inline

Definition at line 543 of file tool_event.h.

References m_actionGroup.

Referenced by TOOL_ACTION::MakeEvent().

◆ SetCommit()

void TOOL_EVENT::SetCommit ( COMMIT * aCommit)
inline

Definition at line 282 of file tool_event.h.

References m_commit.

◆ SetFirstResponder()

void TOOL_EVENT::SetFirstResponder ( TOOL_BASE * aTool)
inline

Definition at line 269 of file tool_event.h.

References m_firstResponder.

Referenced by TOOL_MANAGER::dispatchInternal().

◆ SetForceImmediate()

void TOOL_EVENT::SetForceImmediate ( bool aForceImmediate = true)
inline

Definition at line 266 of file tool_event.h.

References m_forceImmediate.

◆ SetHasPosition()

◆ setModifiers()

void TOOL_EVENT::setModifiers ( int aMods)
inlineprivate

Definition at line 576 of file tool_event.h.

References m_modifiers, and MD_MODIFIER_MASK.

◆ setMouseButtons()

void TOOL_EVENT::setMouseButtons ( int aButtons)
inlineprivate

Definition at line 570 of file tool_event.h.

References BUT_BUTTON_MASK, and m_mouseButtons.

Referenced by TOOL_EVENT().

◆ setMouseDelta()

void TOOL_EVENT::setMouseDelta ( const VECTOR2D & aP)
inlineprivate

Definition at line 565 of file tool_event.h.

References m_mouseDelta.

◆ setMouseDragOrigin()

void TOOL_EVENT::setMouseDragOrigin ( const VECTOR2D & aP)
inlineprivate

Definition at line 560 of file tool_event.h.

References m_mouseDragOrigin.

◆ SetMousePosition()

void TOOL_EVENT::SetMousePosition ( const VECTOR2D & aP)
inline

◆ SetParameter()

template<typename T>
void TOOL_EVENT::SetParameter ( T aParam)
inline

Set a non-standard parameter assigned to the event.

Its meaning depends on the target tool.

Parameters
aParamis the new parameter.

Definition at line 528 of file tool_event.h.

References m_param, and T.

Referenced by COMMON_TOOLS::CursorControl(), EDIT_TOOL::cutToClipboard(), TOOL_MANAGER::DispatchContextMenu(), and TOOL_ACTION::MakeEvent().

◆ SetPassEvent()

◆ SetReactivate()

void TOOL_EVENT::SetReactivate ( bool aReactivate = true)
inline

Definition at line 274 of file tool_event.h.

References m_reactivate.

Referenced by TOOLS_HOLDER::PopTool().

◆ SetSynchronous()

void TOOL_EVENT::SetSynchronous ( std::atomic< SYNCRONOUS_TOOL_STATE > * aState)
inline

Definition at line 276 of file tool_event.h.

References m_synchronousState.

◆ SynchronousState()

std::atomic< SYNCRONOUS_TOOL_STATE > * TOOL_EVENT::SynchronousState ( ) const
inline

Definition at line 280 of file tool_event.h.

References m_synchronousState.

Referenced by SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), and EDIT_TOOL::Move().

Friends And Related Symbol Documentation

◆ TOOL_DISPATCHER

friend class TOOL_DISPATCHER
friend

Definition at line 552 of file tool_event.h.

References TOOL_DISPATCHER.

Referenced by TOOL_DISPATCHER.

◆ TOOL_EVENT_LIST

friend class TOOL_EVENT_LIST
friend

Definition at line 551 of file tool_event.h.

References TOOL_EVENT_LIST.

Referenced by TOOL_EVENT_LIST.

◆ TOOL_MANAGER

friend class TOOL_MANAGER
friend

Definition at line 553 of file tool_event.h.

References TOOL_MANAGER.

Referenced by TOOL_MANAGER.

◆ TOOLS_HOLDER

friend class TOOLS_HOLDER
friend

Definition at line 554 of file tool_event.h.

References TOOLS_HOLDER.

Referenced by TOOLS_HOLDER.

Member Data Documentation

◆ m_actionGroup

std::optional<TOOL_ACTION_GROUP> TOOL_EVENT::m_actionGroup
private

Optional group that the parent action for the event belongs to.

Definition at line 603 of file tool_event.h.

Referenced by Format(), IsActionInGroup(), and SetActionGroup().

◆ m_actions

◆ m_category

TOOL_EVENT_CATEGORY TOOL_EVENT::m_category
private

Definition at line 594 of file tool_event.h.

Referenced by Buttons(), Category(), Format(), init(), Matches(), TOOL_EVENT(), TOOL_EVENT(), and TOOL_EVENT().

◆ m_commandId

std::optional<int> TOOL_EVENT::m_commandId
private

◆ m_commandStr

std::string TOOL_EVENT::m_commandStr
private

◆ m_commit

COMMIT* TOOL_EVENT::m_commit
private

Commit the tool handling the event should add to.

Definition at line 629 of file tool_event.h.

Referenced by Commit(), SetCommit(), TOOL_EVENT(), TOOL_EVENT(), and TOOL_EVENT().

◆ m_firstResponder

TOOL_BASE* TOOL_EVENT::m_firstResponder
private

The first tool to receive the event.

Definition at line 635 of file tool_event.h.

Referenced by FirstResponder(), SetFirstResponder(), TOOL_EVENT(), TOOL_EVENT(), and TOOL_EVENT().

◆ m_forceImmediate

bool TOOL_EVENT::m_forceImmediate
private

Definition at line 599 of file tool_event.h.

Referenced by ForceImmediate(), init(), and SetForceImmediate().

◆ m_hasPosition

bool TOOL_EVENT::m_hasPosition
private

Definition at line 598 of file tool_event.h.

Referenced by HasPosition(), init(), and SetHasPosition().

◆ m_keyCode

int TOOL_EVENT::m_keyCode
private

Stores code of pressed/released key.

Definition at line 621 of file tool_event.h.

Referenced by Format(), KeyCode(), TOOL_EVENT(), TOOL_EVENT(), and TOOL_EVENT().

◆ m_modifiers

int TOOL_EVENT::m_modifiers
private

State of key modifiers (Ctrl/Alt/etc.).

Definition at line 624 of file tool_event.h.

Referenced by Format(), Modifier(), setModifiers(), TOOL_EVENT(), TOOL_EVENT(), and TOOL_EVENT().

◆ m_mouseButtons

int TOOL_EVENT::m_mouseButtons
private

State of mouse buttons.

Definition at line 618 of file tool_event.h.

Referenced by Buttons(), Format(), IsClick(), IsDblClick(), IsDrag(), IsMouseDown(), IsMouseUp(), setMouseButtons(), TOOL_EVENT(), TOOL_EVENT(), and TOOL_EVENT().

◆ m_mouseDelta

VECTOR2D TOOL_EVENT::m_mouseDelta
private

Difference between mouse cursor position and the point where dragging event has started.

Definition at line 609 of file tool_event.h.

Referenced by Delta(), and setMouseDelta().

◆ m_mouseDragOrigin

VECTOR2D TOOL_EVENT::m_mouseDragOrigin
private

Point where dragging has started.

Definition at line 615 of file tool_event.h.

Referenced by DragOrigin(), and setMouseDragOrigin().

◆ m_mousePos

VECTOR2D TOOL_EVENT::m_mousePos
private

Current mouse cursor position.

Definition at line 612 of file tool_event.h.

Referenced by Position(), and SetMousePosition().

◆ m_param

ki::any TOOL_EVENT::m_param
private

Generic parameter used for passing non-standard data.

Definition at line 632 of file tool_event.h.

Referenced by HasParameter(), Parameter(), and SetParameter().

◆ m_passEvent

bool TOOL_EVENT::m_passEvent
private

Definition at line 597 of file tool_event.h.

Referenced by init(), PassEvent(), and SetPassEvent().

◆ m_reactivate

bool TOOL_EVENT::m_reactivate
private

True when the tool is being re-activated from the stack.

Definition at line 606 of file tool_event.h.

Referenced by init(), IsReactivate(), and SetReactivate().

◆ m_scope

TOOL_ACTION_SCOPE TOOL_EVENT::m_scope
private

Definition at line 596 of file tool_event.h.

Referenced by TOOL_EVENT(), TOOL_EVENT(), and TOOL_EVENT().

◆ m_synchronousState

std::atomic<SYNCRONOUS_TOOL_STATE>* TOOL_EVENT::m_synchronousState
private

Definition at line 626 of file tool_event.h.

Referenced by SetSynchronous(), SynchronousState(), TOOL_EVENT(), TOOL_EVENT(), and TOOL_EVENT().


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