KiCad PCB EDA Suite
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. More...
 
 TOOL_EVENT (TOOL_EVENT_CATEGORY aCategory=TC_NONE, TOOL_ACTIONS aAction=TA_NONE, TOOL_ACTION_SCOPE aScope=AS_GLOBAL, void *aParameter=nullptr)
 
 TOOL_EVENT (TOOL_EVENT_CATEGORY aCategory, TOOL_ACTIONS aAction, int aExtraParam, TOOL_ACTION_SCOPE aScope=AS_GLOBAL, void *aParameter=nullptr)
 
 TOOL_EVENT (TOOL_EVENT_CATEGORY aCategory, TOOL_ACTIONS aAction, const std::string &aExtraParam, TOOL_ACTION_SCOPE aScope=AS_GLOBAL, void *aParameter=nullptr)
 Returns the category (eg. mouse/keyboard/action) of an event.. More...
 
TOOL_EVENT_CATEGORY Category () const
 Returns more specific information about the type of an event. More...
 
TOOL_ACTIONS Action () 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. More...
 
bool PassEvent () const
 
void SetPassEvent (bool aPass=true)
 Returns if it this event has a valid position (true for mouse events and context-menu or hotkey-based command events) More...
 
bool HasPosition () const
 
void SetHasPosition (bool aHasPosition)
 Returns if the action associated with this event should be treated as immediate regardless of the current immediate action settings. More...
 
bool ForceImmediate () const
 
void SetForceImmediate (bool aForceImmediate=true)
 
TOOL_BASEFirstResponder () const
 
void SetFirstResponder (TOOL_BASE *aTool)
 Controls whether the tool is first being pushed to the stack or being reactivated after a pause. More...
 
bool IsReactivate () const
 
void SetReactivate (bool aReactivate=true)
 Returns information about difference between current mouse cursor position and the place where dragging has started. More...
 
const VECTOR2D Delta () const
 Returns mouse cursor position in world coordinates. More...
 
const VECTOR2D Position () const
 Returns the point where dragging has started. More...
 
const VECTOR2D DragOrigin () const
 Returns information about mouse buttons state. More...
 
int Buttons () const
 
bool IsClick (int aButtonMask=BUT_ANY) const
 
bool IsDblClick (int aButtonMask=BUT_ANY) const
 
bool IsDrag (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
 Returns information about key modifiers state (Ctrl, Alt, etc.) More...
 
int Modifier (int aMask=MD_MODIFIER_MASK) const
 
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. More...
 
bool IsAction (const TOOL_ACTION *aAction) const
 Test if the event contains an action issued upon activation of the given TOOL_ACTION. More...
 
bool IsCancelInteractive () const
 Indicate the event should restart/end an ongoing interactive tool's event loop (eg esc key, click cancel, start different tool). More...
 
bool IsSelectionEvent () const
 Indicate an selection-changed notification event. More...
 
bool IsPointEditor () const
 Indicate if the event is from one of the point editors. More...
 
bool IsMoveTool () const
 Indicate if the event is from one of the move tools. More...
 
bool IsSimulator () const
 Indicate if the event is from the simulator. More...
 
template<typename T >
Parameter () const
 Return a non-standard parameter assigned to the event. More...
 
template<typename T >
void SetParameter (T aParam)
 Set a non-standard parameter assigned to the event. More...
 
OPT< int > GetCommandId () const
 
OPT< std::string > GetCommandStr () const
 
void SetMousePosition (const VECTOR2D &aP)
 

Private Member Functions

void init ()
 
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. More...
 

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
 True when the tool is being re-activated from the stack. More...
 
bool m_reactivate
 Difference between mouse cursor position and the point where dragging event has started. More...
 
VECTOR2D m_mouseDelta
 Current mouse cursor position. More...
 
VECTOR2D m_mousePos
 Point where dragging has started. More...
 
VECTOR2D m_mouseDragOrigin
 State of mouse buttons. More...
 
int m_mouseButtons
 Stores code of pressed/released key. More...
 
int m_keyCode
 State of key modifiers (Ctrl/Alt/etc.) More...
 
int m_modifiers
 Generic parameter used for passing non-standard data. More...
 
void * m_param
 The first tool to receive the event. More...
 
TOOL_BASEm_firstResponder
 
OPT< int > m_commandId
 
OPT< std::string > m_commandStr
 

Friends

class TOOL_DISPATCHER
 

Detailed Description

Generic, UI-independent tool event.

Definition at line 152 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,
void *  aParameter = nullptr 
)
inline

Definition at line 162 of file tool_event.h.

163  :
164  m_category( aCategory ),
165  m_actions( aAction ),
166  m_scope( aScope ),
167  m_mouseButtons( 0 ),
168  m_keyCode( 0 ),
169  m_modifiers( 0 ),
170  m_param( aParameter ),
171  m_firstResponder( nullptr )
172  {
173  init();
174  }
void init()
Definition: tool_event.cpp:60
int m_modifiers
Generic parameter used for passing non-standard data.
Definition: tool_event.h:531
TOOL_ACTIONS m_actions
Definition: tool_event.h:505
int m_mouseButtons
Stores code of pressed/released key.
Definition: tool_event.h:525
int m_keyCode
State of key modifiers (Ctrl/Alt/etc.)
Definition: tool_event.h:528
TOOL_ACTION_SCOPE m_scope
Definition: tool_event.h:506
TOOL_BASE * m_firstResponder
Definition: tool_event.h:537
void * m_param
The first tool to receive the event.
Definition: tool_event.h:534
TOOL_EVENT_CATEGORY m_category
Definition: tool_event.h:504

References init().

◆ TOOL_EVENT() [2/3]

TOOL_EVENT::TOOL_EVENT ( TOOL_EVENT_CATEGORY  aCategory,
TOOL_ACTIONS  aAction,
int  aExtraParam,
TOOL_ACTION_SCOPE  aScope = AS_GLOBAL,
void *  aParameter = nullptr 
)
inline

Definition at line 176 of file tool_event.h.

177  :
178  m_category( aCategory ),
179  m_actions( aAction ),
180  m_scope( aScope ),
181  m_mouseButtons( 0 ),
182  m_keyCode( 0 ),
183  m_modifiers( 0 ),
184  m_param( aParameter ),
185  m_firstResponder( nullptr )
186  {
187  if( aCategory == TC_MOUSE )
188  {
189  setMouseButtons( aExtraParam & BUT_BUTTON_MASK );
190  }
191  else if( aCategory == TC_KEYBOARD )
192  {
193  m_keyCode = aExtraParam & ~MD_MODIFIER_MASK; // Filter out modifiers
194  }
195  else if( aCategory == TC_COMMAND )
196  {
197  m_commandId = aExtraParam;
198  }
199 
200  if( aCategory & ( TC_MOUSE | TC_KEYBOARD ) )
201  {
202  m_modifiers = aExtraParam & MD_MODIFIER_MASK;
203  }
204 
205  init();
206  }
void setMouseButtons(int aButtons)
Definition: tool_event.h:480
void init()
Definition: tool_event.cpp:60
int m_modifiers
Generic parameter used for passing non-standard data.
Definition: tool_event.h:531
TOOL_ACTIONS m_actions
Definition: tool_event.h:505
int m_mouseButtons
Stores code of pressed/released key.
Definition: tool_event.h:525
int m_keyCode
State of key modifiers (Ctrl/Alt/etc.)
Definition: tool_event.h:528
OPT< int > m_commandId
Definition: tool_event.h:539
TOOL_ACTION_SCOPE m_scope
Definition: tool_event.h:506
TOOL_BASE * m_firstResponder
Definition: tool_event.h:537
void * m_param
The first tool to receive the event.
Definition: tool_event.h:534
TOOL_EVENT_CATEGORY m_category
Definition: tool_event.h:504

References BUT_BUTTON_MASK, init(), m_commandId, m_keyCode, m_modifiers, MD_MODIFIER_MASK, setMouseButtons(), TC_COMMAND, TC_KEYBOARD, and TC_MOUSE.

◆ 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,
void *  aParameter = nullptr 
)
inline

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

Definition at line 208 of file tool_event.h.

References init(), m_commandStr, TC_COMMAND, and TC_MESSAGE.

Member Function Documentation

◆ Action()

TOOL_ACTIONS TOOL_EVENT::Action ( ) 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 230 of file tool_event.h.

References m_actions.

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

◆ Buttons()

int TOOL_EVENT::Buttons ( ) const
inline

Definition at line 275 of file tool_event.h.

276  {
277  assert( m_category == TC_MOUSE ); // this should be used only with mouse events
278  return m_mouseButtons;
279  }
int m_mouseButtons
Stores code of pressed/released key.
Definition: tool_event.h:525
TOOL_EVENT_CATEGORY m_category
Definition: tool_event.h:504

References m_category, m_mouseButtons, and TC_MOUSE.

◆ Category()

TOOL_EVENT_CATEGORY TOOL_EVENT::Category ( ) const
inline

Returns more specific information about the type of an event.

Definition at line 227 of file tool_event.h.

References m_category.

Referenced by EDIT_TOOL::cutToClipboard(), TOOL_MANAGER::dispatchInternal(), ROUTER_TOOL::handleCommonEvents(), PL_EDIT_TOOL::Main(), and SYMBOL_EDITOR_MOVE_TOOL::Main().

◆ Delta()

const VECTOR2D TOOL_EVENT::Delta ( ) const
inline

Returns mouse cursor position in world coordinates.

Definition at line 257 of file tool_event.h.

References m_mouseDelta, and returnCheckedPosition().

◆ DisableGridSnapping()

◆ DragOrigin()

const VECTOR2D TOOL_EVENT::DragOrigin ( ) const
inline

Returns information about mouse buttons state.

Definition at line 269 of file tool_event.h.

References m_mouseDragOrigin, and returnCheckedPosition().

Referenced by EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), and PCB_POINT_EDITOR::updateEditedPoint().

◆ FirstResponder()

TOOL_BASE* TOOL_EVENT::FirstResponder ( ) const
inline

Definition at line 248 of file tool_event.h.

248 { return m_firstResponder; }
TOOL_BASE * m_firstResponder
Definition: tool_event.h:537

References m_firstResponder.

Referenced by TOOL_MANAGER::dispatchInternal().

◆ ForceImmediate()

bool TOOL_EVENT::ForceImmediate ( ) const
inline

Definition at line 245 of file tool_event.h.

245 { return m_forceImmediate; }
bool m_forceImmediate
True when the tool is being re-activated from the stack.
Definition: tool_event.h:509

References m_forceImmediate.

Referenced by TOOL_MANAGER::processEvent().

◆ Format()

const std::string TOOL_EVENT::Format ( ) const

Return information about event in form of a human-readable string.

Returns
Event information.

Definition at line 94 of file tool_event.cpp.

95 {
96  std::string ev;
97 
98  const FlagString categories[] =
99  {
100  { TC_MOUSE, "mouse" },
101  { TC_KEYBOARD, "keyboard" },
102  { TC_COMMAND, "command" },
103  { TC_MESSAGE, "message" },
104  { TC_VIEW, "view" },
105  { 0, "" }
106  };
107 
108  const FlagString actions[] =
109  {
110  { TA_MOUSE_CLICK, "click" },
111  { TA_MOUSE_DBLCLICK, "double click" },
112  { TA_MOUSE_UP, "button-up" },
113  { TA_MOUSE_DOWN, "button-down" },
114  { TA_MOUSE_DRAG, "drag" },
115  { TA_MOUSE_MOTION, "motion" },
116  { TA_MOUSE_WHEEL, "wheel" },
117  { TA_KEY_PRESSED, "key-pressed" },
118  { TA_VIEW_REFRESH, "view-refresh" },
119  { TA_VIEW_ZOOM, "view-zoom" },
120  { TA_VIEW_PAN, "view-pan" },
121  { TA_VIEW_DIRTY, "view-dirty" },
122  { TA_CHANGE_LAYER, "change-layer" },
123  { TA_CANCEL_TOOL, "cancel-tool" },
124  { TA_CHOICE_MENU_UPDATE, "choice-menu-update" },
125  { TA_CHOICE_MENU_CHOICE, "choice-menu-choice" },
126  { TA_UNDO_REDO_PRE, "undo-redo-pre" },
127  { TA_UNDO_REDO_POST, "undo-redo-post" },
128  { TA_ACTION, "action" },
129  { TA_ACTIVATE, "activate" },
130  { 0, "" }
131  };
132 
133  const FlagString buttons[] =
134  {
135  { BUT_NONE, "none" },
136  { BUT_LEFT, "left" },
137  { BUT_RIGHT, "right" },
138  { BUT_MIDDLE, "middle" },
139  { 0, "" }
140  };
141 
142  const FlagString modifiers[] =
143  {
144  { MD_SHIFT, "shift" },
145  { MD_CTRL, "ctrl" },
146  { MD_ALT, "alt" },
147  { 0, "" }
148  };
149 
150  ev = "category: ";
151  ev += flag2string( m_category, categories );
152  ev += " action: ";
153  ev += flag2string( m_actions, actions );
154 
155  if( m_actions & TA_MOUSE )
156  {
157  ev += " btns: ";
158  ev += flag2string( m_mouseButtons, buttons );
159  }
160 
161  if( m_actions & TA_KEYBOARD )
162  {
163  char tmp[128];
164  sprintf( tmp, "key: %d", m_keyCode );
165  ev += tmp;
166  }
167 
168  if( m_actions & ( TA_MOUSE | TA_KEYBOARD ) )
169  {
170  ev += " mods: ";
171  ev += flag2string( m_modifiers, modifiers );
172  }
173 
174  if( m_commandId )
175  {
176  char tmp[128];
177  sprintf( tmp, "cmd-id: %d", *m_commandId );
178  ev += tmp;
179  }
180 
181  if( m_commandStr )
182  ev += "cmd-str: " + ( *m_commandStr );
183 
184  return ev;
185 }
int m_modifiers
Generic parameter used for passing non-standard data.
Definition: tool_event.h:531
TOOL_ACTIONS m_actions
Definition: tool_event.h:505
int m_mouseButtons
Stores code of pressed/released key.
Definition: tool_event.h:525
OPT< std::string > m_commandStr
Definition: tool_event.h:540
int m_keyCode
State of key modifiers (Ctrl/Alt/etc.)
Definition: tool_event.h:528
OPT< int > m_commandId
Definition: tool_event.h:539
static const std::string flag2string(int aFlag, const FlagString *aExps)
Definition: tool_event.cpp:46
TOOL_EVENT_CATEGORY m_category
Definition: tool_event.h:504

References BUT_LEFT, BUT_MIDDLE, BUT_NONE, BUT_RIGHT, flag2string(), m_actions, m_category, m_commandId, m_commandStr, m_keyCode, m_modifiers, m_mouseButtons, MD_ALT, MD_CTRL, MD_SHIFT, TA_ACTION, TA_ACTIVATE, TA_CANCEL_TOOL, TA_CHANGE_LAYER, TA_CHOICE_MENU_CHOICE, TA_CHOICE_MENU_UPDATE, TA_KEY_PRESSED, TA_KEYBOARD, TA_MOUSE, TA_MOUSE_CLICK, TA_MOUSE_DBLCLICK, TA_MOUSE_DOWN, TA_MOUSE_DRAG, TA_MOUSE_MOTION, TA_MOUSE_UP, TA_MOUSE_WHEEL, TA_UNDO_REDO_POST, TA_UNDO_REDO_PRE, TA_VIEW_DIRTY, TA_VIEW_PAN, TA_VIEW_REFRESH, TA_VIEW_ZOOM, TC_COMMAND, TC_KEYBOARD, TC_MESSAGE, TC_MOUSE, and TC_VIEW.

Referenced by TOOL_MANAGER::dispatchActivation(), TOOL_MANAGER::dispatchInternal(), and TOOL_MANAGER::processEvent().

◆ GetCommandId()

OPT<int> TOOL_EVENT::GetCommandId ( ) const
inline

Definition at line 450 of file tool_event.h.

451  {
452  return m_commandId;
453  }
OPT< int > m_commandId
Definition: tool_event.h:539

References m_commandId.

Referenced by SCH_MOVE_TOOL::Main().

◆ GetCommandStr()

OPT<std::string> TOOL_EVENT::GetCommandStr ( ) const
inline

Definition at line 455 of file tool_event.h.

456  {
457  return m_commandStr;
458  }
OPT< std::string > m_commandStr
Definition: tool_event.h:540

References m_commandStr.

Referenced by MICROWAVE_TOOL::addMicrowaveFootprint(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), TOOL_MANAGER::dispatchActivation(), EDIT_TOOL::doMoveSelection(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawVia(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCB_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), DRAWING_TOOL::InteractivePlaceWithPreview(), IsMoveTool(), IsPointEditor(), IsSimulator(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PAD_TOOL::PlacePad(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), TOOL_MANAGER::processEvent(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ HasPosition()

◆ init()

void TOOL_EVENT::init ( )
private

Definition at line 60 of file tool_event.cpp.

61 {
62  // By default only MESSAGEs and Cancels are passed to multiple recipients
64 
66 
67  // Cancel tool doesn't contain a position
68  if( IsCancel() )
69  m_hasPosition = false;
70 
71  m_forceImmediate = false;
72  m_reactivate = false;
73 }
bool IsCancel() const
Definition: tool_event.h:305
bool m_hasPosition
Definition: tool_event.h:508
bool m_forceImmediate
True when the tool is being re-activated from the stack.
Definition: tool_event.h:509
bool IsCancelInteractive() const
Indicate the event should restart/end an ongoing interactive tool's event loop (eg esc key,...
Definition: tool_event.cpp:211
bool m_passEvent
Definition: tool_event.h:507
bool m_reactivate
Difference between mouse cursor position and the point where dragging event has started.
Definition: tool_event.h:512
bool IsActivate() const
Definition: tool_event.h:310
TOOL_EVENT_CATEGORY m_category
Definition: tool_event.h:504

References IsActivate(), IsCancel(), IsCancelInteractive(), m_category, m_forceImmediate, m_hasPosition, m_passEvent, m_reactivate, TC_COMMAND, TC_MESSAGE, and TC_MOUSE.

Referenced by TOOL_EVENT().

◆ 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 88 of file tool_event.cpp.

89 {
90  return Matches( aAction->MakeEvent() );
91 }
bool Matches(const TOOL_EVENT &aEvent) const
Test whether two events match in terms of category & action or command.
Definition: tool_event.h:357
TOOL_EVENT MakeEvent() const
Return the event associated with the action (i.e.
Definition: tool_action.cpp:72

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

Referenced by SYMBOL_EDITOR_CONTROL::AddLibrary(), PCB_CONTROL::AddLibrary(), SYMBOL_EDITOR_CONTROL::AddSymbol(), SCH_EDIT_TOOL::ChangeSymbols(), SCH_EDIT_TOOL::ConvertDeMorgan(), EDIT_TOOL::copyToClipboard(), SYMBOL_EDITOR_CONTROL::CutCopyDelete(), FOOTPRINT_EDITOR_CONTROL::CutCopyFootprint(), GERBVIEW_CONTROL::DisplayControl(), EDIT_TOOL::Drag(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawZone(), EDIT_TOOL::Duplicate(), SYMBOL_EDITOR_CONTROL::DuplicateSymbol(), SCH_EDIT_TOOL::EditField(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), KICAD_MANAGER_CONTROL::Execute(), SCH_EDITOR_CONTROL::FindAndReplace(), SCH_EDITOR_CONTROL::FindNext(), BOARD_EDITOR_CONTROL::GenerateFabFiles(), getTargetLayerFromEvent(), ROUTER_TOOL::handleLayerSwitch(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightNet(), TOOL_EVT_UTILS::IsRotateToolEvt(), CONVERT_TOOL::LinesToPoly(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_CONTROL::OnDeMorgan(), PCB_CONTROL::Paste(), SCH_EDITOR_CONTROL::Paste(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), CONVERT_TOOL::PolyToLines(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SYMBOL_EDITOR_PIN_TOOL::PushPinProperties(), SYMBOL_EDITOR_CONTROL::Save(), PCB_SELECTION_TOOL::selectNet(), COMMON_CONTROL::ShowHelp(), COMMON_CONTROL::ShowLibraryTable(), PL_EDITOR_CONTROL::TitleBlockDisplayMode(), PCB_CONTROL::ToggleRatsnest(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SCH_EDITOR_CONTROL::UpdateFind(), PCB_CONTROL::ZoneDisplayMode(), COMMON_TOOLS::ZoomInOut(), EDA_3D_CONTROLLER::ZoomInOut(), COMMON_TOOLS::ZoomInOutCenter(), and EDA_3D_CONTROLLER::ZoomInOutCenter().

◆ IsActivate()

bool TOOL_EVENT::IsActivate ( ) const
inline

Definition at line 310 of file tool_event.h.

311  {
312  return m_actions == TA_ACTIVATE;
313  }
TOOL_ACTIONS m_actions
Definition: tool_event.h:505

References m_actions, and TA_ACTIVATE.

Referenced by TOOL_MANAGER::dispatchActivation(), init(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), and SCH_MOVE_TOOL::Main().

◆ IsCancel()

bool TOOL_EVENT::IsCancel ( ) const
inline

Definition at line 305 of file tool_event.h.

306  {
307  return m_actions == TA_CANCEL_TOOL;
308  }
TOOL_ACTIONS m_actions
Definition: tool_event.h:505

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 211 of file tool_event.cpp.

212 {
213  return( ( m_commandStr.is_initialized()
215  || ( m_commandId.is_initialized()
217  || ( m_actions == TA_CANCEL_TOOL ) );
218 }
TOOL_ACTIONS m_actions
Definition: tool_event.h:505
static TOOL_ACTION cancelInteractive
Definition: actions.h:62
OPT< std::string > m_commandStr
Definition: tool_event.h:540
OPT< int > m_commandId
Definition: tool_event.h:539
int GetId() const
Return the unique id of the TOOL_ACTION object.
Definition: tool_action.h:121
const std::string & GetName() const
Return name of the action.
Definition: tool_action.h:101

References ACTIONS::cancelInteractive, TOOL_ACTION::GetId(), TOOL_ACTION::GetName(), m_actions, m_commandId, m_commandStr, and TA_CANCEL_TOOL.

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

◆ IsChoiceMenu()

bool TOOL_EVENT::IsChoiceMenu ( ) const
inline

Definition at line 320 of file tool_event.h.

321  {
322  return m_actions & TA_CHOICE_MENU;
323  }
TOOL_ACTIONS m_actions
Definition: tool_event.h:505

References m_actions, and TA_CHOICE_MENU.

Referenced by TOOL_MANAGER::dispatchInternal().

◆ IsClick()

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

Definition at line 199 of file tool_event.cpp.

200 {
201  return ( m_actions & TA_MOUSE_CLICK ) && ( m_mouseButtons & aButtonMask ) == m_mouseButtons;
202 }
TOOL_ACTIONS m_actions
Definition: tool_event.h:505
int m_mouseButtons
Stores code of pressed/released key.
Definition: tool_event.h:525

References m_actions, m_mouseButtons, and TA_MOUSE_CLICK.

Referenced by TOOL_MANAGER::DispatchContextMenu(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), and PNS::TOOL_BASE::updateStartItem().

◆ IsDblClick()

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

Definition at line 205 of file tool_event.cpp.

206 {
207  return m_actions == TA_MOUSE_DBLCLICK && ( m_mouseButtons & aButtonMask ) == m_mouseButtons;
208 }
TOOL_ACTIONS m_actions
Definition: tool_event.h:505
int m_mouseButtons
Stores code of pressed/released key.
Definition: tool_event.h:525

References m_actions, m_mouseButtons, and TA_MOUSE_DBLCLICK.

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

◆ IsDrag()

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

◆ IsKeyPressed()

bool TOOL_EVENT::IsKeyPressed ( ) const
inline

Definition at line 346 of file tool_event.h.

347  {
348  return m_actions == TA_KEY_PRESSED;
349  }
TOOL_ACTIONS m_actions
Definition: tool_event.h:505

References m_actions, and TA_KEY_PRESSED.

Referenced by ROUTER_TOOL::handleCommonEvents().

◆ IsMotion()

◆ IsMouseAction()

bool TOOL_EVENT::IsMouseAction ( ) const
inline

Definition at line 300 of file tool_event.h.

301  {
302  return ( m_actions & TA_MOUSE );
303  }
TOOL_ACTIONS m_actions
Definition: tool_event.h:505

References m_actions, and TA_MOUSE.

◆ IsMouseUp()

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

Definition at line 290 of file tool_event.h.

291  {
292  return m_actions == TA_MOUSE_UP && ( m_mouseButtons & aButtonMask ) == m_mouseButtons;
293  }
TOOL_ACTIONS m_actions
Definition: tool_event.h:505
int m_mouseButtons
Stores code of pressed/released key.
Definition: tool_event.h:525

References m_actions, m_mouseButtons, and TA_MOUSE_UP.

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

◆ 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 238 of file tool_event.cpp.

239 {
240  return( m_commandStr.is_initialized()
241  && m_commandStr.get().find( "InteractiveMove" ) != GetCommandStr()->npos );
242 }
OPT< std::string > m_commandStr
Definition: tool_event.h:540
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:455

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 229 of file tool_event.cpp.

230 {
231  return( ( m_commandStr.is_initialized()
232  && m_commandStr.get().find( "PointEditor" ) != GetCommandStr()->npos )
233  || ( m_commandId.is_initialized()
235 }
static TOOL_ACTION activatePointEditor
Definition: actions.h:168
OPT< std::string > m_commandStr
Definition: tool_event.h:540
OPT< int > m_commandId
Definition: tool_event.h:539
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:455
int GetId() const
Return the unique id of the TOOL_ACTION object.
Definition: tool_action.h:121

References ACTIONS::activatePointEditor, GetCommandStr(), TOOL_ACTION::GetId(), m_commandId, and m_commandStr.

◆ IsPrime()

bool TOOL_EVENT::IsPrime ( ) const
inline

Returns information about key modifiers state (Ctrl, Alt, etc.)

Definition at line 325 of file tool_event.h.

References m_actions, and TA_PRIME.

◆ IsReactivate()

bool TOOL_EVENT::IsReactivate ( ) const
inline

Definition at line 252 of file tool_event.h.

252 { return m_reactivate; }
bool m_reactivate
Difference between mouse cursor position and the point where dragging event has started.
Definition: tool_event.h:512

References m_reactivate.

Referenced by BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ IsSelectionEvent()

bool TOOL_EVENT::IsSelectionEvent ( ) const

Indicate an selection-changed notification event.

Definition at line 221 of file tool_event.cpp.

222 {
223  return Matches( EVENTS::ClearedEvent )
226 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:199
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:200
static const TOOL_EVENT ClearedEvent
Selected item had a property changed (except movement)
Definition: actions.h:201
bool Matches(const TOOL_EVENT &aEvent) const
Test whether two events match in terms of category & action or command.
Definition: tool_event.h:357

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

◆ IsSimulator()

bool TOOL_EVENT::IsSimulator ( ) const

Indicate if the event is from the simulator.

Definition at line 245 of file tool_event.cpp.

246 {
247  return( m_commandStr.is_initialized()
248  && m_commandStr.get().find( "Simulation" ) != GetCommandStr()->npos );
249 }
OPT< std::string > m_commandStr
Definition: tool_event.h:540
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:455

References GetCommandStr(), and m_commandStr.

Referenced by TOOL_MANAGER::PostEvent().

◆ IsUndoRedo()

bool TOOL_EVENT::IsUndoRedo ( ) const
inline

Definition at line 315 of file tool_event.h.

316  {
318  }
TOOL_ACTIONS m_actions
Definition: tool_event.h:505

References m_actions, TA_UNDO_REDO_POST, and TA_UNDO_REDO_PRE.

◆ KeyCode()

int TOOL_EVENT::KeyCode ( ) const
inline

Definition at line 341 of file tool_event.h.

342  {
343  return m_keyCode;
344  }
int m_keyCode
State of key modifiers (Ctrl/Alt/etc.)
Definition: tool_event.h:528

References m_keyCode.

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

◆ Matches()

bool TOOL_EVENT::Matches ( const TOOL_EVENT aEvent) const
inline

Test whether two events match in terms of category & action or command.

Parameters
aEventis the event to test against.
Returns
True if two events match, false otherwise.

Definition at line 357 of file tool_event.h.

358  {
359  if( !( m_category & aEvent.m_category ) )
360  return false;
361 
363  {
364  if( (bool) m_commandStr && (bool) aEvent.m_commandStr )
365  return *m_commandStr == *aEvent.m_commandStr;
366 
367  if( (bool) m_commandId && (bool) aEvent.m_commandId )
368  return *m_commandId == *aEvent.m_commandId;
369  }
370 
371  // BUGFIX: TA_ANY should match EVERYTHING, even TA_NONE (for TC_MESSAGE)
372  if( m_actions == TA_ANY && aEvent.m_actions == TA_NONE && aEvent.m_category == TC_MESSAGE )
373  return true;
374 
375  // BUGFIX: This check must happen after the TC_COMMAND check because otherwise events of
376  // the form { TC_COMMAND, TA_NONE } will be incorrectly skipped
377  if( !( m_actions & aEvent.m_actions ) )
378  return false;
379 
380  return true;
381  }
TOOL_ACTIONS m_actions
Definition: tool_event.h:505
OPT< std::string > m_commandStr
Definition: tool_event.h:540
OPT< int > m_commandId
Definition: tool_event.h:539
TOOL_EVENT_CATEGORY m_category
Definition: tool_event.h:504

References m_actions, m_category, m_commandId, m_commandStr, TA_ANY, TA_NONE, TC_COMMAND, and TC_MESSAGE.

Referenced by IsAction(), IsSelectionEvent(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), and SCH_EDITOR_CONTROL::UpdateFind().

◆ Modifier()

int TOOL_EVENT::Modifier ( int  aMask = MD_MODIFIER_MASK) const
inline

◆ Parameter()

template<typename T >
T TOOL_EVENT::Parameter ( ) const
inline

Return a non-standard parameter assigned to the event.

Its meaning depends on the target tool.

Definition at line 427 of file tool_event.h.

428  {
429  // Exhibit #798 on why I love to hate C++
430  // - reinterpret_cast needs to be used for pointers
431  // - static_cast must be used for enums
432  // - templates can't usefully distinguish between pointer and non-pointer types
433  // Fortunately good old C's cast can be a reinterpret_cast or a static_cast, and
434  // C99 gave us intptr_t which is guaranteed to be round-trippable with a pointer.
435  return (T) reinterpret_cast<intptr_t>( m_param );
436  }
void * m_param
The first tool to receive the event.
Definition: tool_event.h:534

References m_param.

Referenced by PL_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::AddItemToSel(), SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded(), MICROWAVE_TOOL::addMicrowaveFootprint(), CVPCB_CONTROL::ChangeFocus(), ROUTER_TOOL::ChangeRouterMode(), SCH_EDIT_TOOL::ChangeTextType(), COMMON_TOOLS::CursorControl(), PCB_SELECTION_TOOL::CursorSelection(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::DrawZone(), KICAD_MANAGER_CONTROL::Execute(), TOOL_EVT_UTILS::GetEventRotationAngle(), COMMON_TOOLS::GridPreset(), PCB_CONTROL::GridSetOrigin(), GROUP_TOOL::GroupProperties(), ROUTER_TOOL::handleLayerSwitch(), BOARD_INSPECTION_TOOL::HideNet(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_NAVIGATE_TOOL::HypertextCommand(), ROUTER_TOOL::InlineDrag(), PCB_CONTROL::LayerSwitch(), PCB_PICKER_TOOL::Main(), EE_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), EDA_3D_CONTROLLER::On3DGridSelection(), COMMON_TOOLS::PanControl(), EDA_3D_CONTROLLER::PanControl(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), EDIT_TOOL::Remove(), PL_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemFromSel(), PL_SELECTION_TOOL::RemoveItemsFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), BOARD_EDITOR_CONTROL::RepairBoard(), EDA_3D_CONTROLLER::RotateView(), PL_SELECTION_TOOL::SelectionMenu(), PCB_SELECTION_TOOL::SelectionMenu(), EE_SELECTION_TOOL::SelectionMenu(), GERBVIEW_SELECTION_TOOL::SelectItem(), PCB_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), PCB_SELECTION_TOOL::SelectItems(), PCB_SELECTION_TOOL::selectNet(), PCB_SELECTION_TOOL::selectSheetContents(), EDA_3D_CONTROLLER::SetMaterial(), BOARD_INSPECTION_TOOL::ShowNet(), COMMON_CONTROL::ShowPlayer(), KICAD_MANAGER_CONTROL::ShowPlayer(), SCH_DRAWING_TOOLS::SingleClickPlace(), COMMON_TOOLS::SwitchUnits(), CVPCB_CONTROL::ToggleFootprintFilter(), EDA_3D_CONTROLLER::ToggleVisibility(), CVPCB_CONTROL::ToNA(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_LINE_WIRE_BUS_TOOL::UnfoldBus(), GERBVIEW_SELECTION_TOOL::UnselectItem(), PCB_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), PCB_SELECTION_TOOL::UnselectItems(), PL_SELECTION_TOOL::UpdateMenu(), KICAD_MANAGER_CONTROL::UpdateMenu(), EDA_3D_CONTROLLER::UpdateMenu(), GERBVIEW_SELECTION_TOOL::UpdateMenu(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::UpdateMenu(), EE_SELECTION_TOOL::UpdateMenu(), CVPCB_CONTROL::UpdateMenu(), PCB_SELECTION_TOOL::UpdateMenu(), BOARD_INSPECTION_TOOL::UpdateSelectionRatsnest(), EDA_3D_CONTROLLER::ViewControl(), ZONE_FILLER_TOOL::ZoneFill(), and COMMON_TOOLS::ZoomPreset().

◆ PassEvent()

bool TOOL_EVENT::PassEvent ( ) const
inline

Definition at line 235 of file tool_event.h.

235 { return m_passEvent; }
bool m_passEvent
Definition: tool_event.h:507

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

77 {
78 #ifdef WX_COMPATIBILITY
79  wxCHECK_MSG( HasPosition(), VECTOR2D(), "Attempted to get position from non-position event" );
80 #else
81  assert( HasPosition() );
82 #endif
83 
84  return aPos;
85 }
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
bool HasPosition() const
Definition: tool_event.h:240

References HasPosition().

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

◆ SetFirstResponder()

void TOOL_EVENT::SetFirstResponder ( TOOL_BASE aTool)
inline

Controls whether the tool is first being pushed to the stack or being reactivated after a pause.

Definition at line 249 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 246 of file tool_event.h.

246 { m_forceImmediate = aForceImmediate; }
bool m_forceImmediate
True when the tool is being re-activated from the stack.
Definition: tool_event.h:509

References m_forceImmediate.

◆ SetHasPosition()

void TOOL_EVENT::SetHasPosition ( bool  aHasPosition)
inline

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

Definition at line 241 of file tool_event.h.

References m_hasPosition.

Referenced by PANEL_KICAD_LAUNCHER::CreateLaunchers(), TOOL_MANAGER::DispatchContextMenu(), ACTION_TOOLBAR::onPaletteEvent(), TOOLS_HOLDER::PopTool(), TOOL_MANAGER::processEvent(), and PCB_EDIT_FRAME::ShowBoardSetupDialog().

◆ setModifiers()

void TOOL_EVENT::setModifiers ( int  aMods)
inlineprivate

Definition at line 486 of file tool_event.h.

487  {
488  assert( ( aMods & ~MD_MODIFIER_MASK ) == 0 );
489  m_modifiers = aMods;
490  }
int m_modifiers
Generic parameter used for passing non-standard data.
Definition: tool_event.h:531

References m_modifiers, and MD_MODIFIER_MASK.

◆ setMouseButtons()

void TOOL_EVENT::setMouseButtons ( int  aButtons)
inlineprivate

Definition at line 480 of file tool_event.h.

481  {
482  assert( ( aButtons & ~BUT_BUTTON_MASK ) == 0 );
483  m_mouseButtons = aButtons;
484  }
int m_mouseButtons
Stores code of pressed/released key.
Definition: tool_event.h:525

References BUT_BUTTON_MASK, and m_mouseButtons.

Referenced by TOOL_EVENT().

◆ setMouseDelta()

void TOOL_EVENT::setMouseDelta ( const VECTOR2D aP)
inlineprivate

Definition at line 475 of file tool_event.h.

476  {
477  m_mouseDelta = aP;
478  }
VECTOR2D m_mouseDelta
Current mouse cursor position.
Definition: tool_event.h:516

References m_mouseDelta.

◆ setMouseDragOrigin()

void TOOL_EVENT::setMouseDragOrigin ( const VECTOR2D aP)
inlineprivate

Definition at line 470 of file tool_event.h.

471  {
472  m_mouseDragOrigin = aP;
473  }
VECTOR2D m_mouseDragOrigin
State of mouse buttons.
Definition: tool_event.h:522

References m_mouseDragOrigin.

◆ SetMousePosition()

void TOOL_EVENT::SetMousePosition ( const VECTOR2D aP)
inline

Definition at line 460 of file tool_event.h.

461  {
462  m_mousePos = aP;
463  }
VECTOR2D m_mousePos
Point where dragging has started.
Definition: tool_event.h:519

References m_mousePos.

Referenced by COMMON_TOOLS::CursorControl(), TOOL_MANAGER::invokeTool(), TOOL_MANAGER::PrimeTool(), and TOOL_MANAGER::RunAction().

◆ SetParameter()

template<typename T >
void TOOL_EVENT::SetParameter ( 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 445 of file tool_event.h.

446  {
447  m_param = (void*) aParam;
448  }
void * m_param
The first tool to receive the event.
Definition: tool_event.h:534

References m_param.

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

◆ SetPassEvent()

void TOOL_EVENT::SetPassEvent ( bool  aPass = true)
inline

Returns if it this event has a valid position (true for mouse events and context-menu or hotkey-based command events)

Definition at line 236 of file tool_event.h.

References m_passEvent.

Referenced by ROUTER_TOOL::handleCommonEvents(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), and SCH_MOVE_TOOL::Main().

◆ SetReactivate()

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

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

Definition at line 253 of file tool_event.h.

References m_reactivate.

Referenced by TOOLS_HOLDER::PopTool().

Friends And Related Function Documentation

◆ TOOL_DISPATCHER

friend class TOOL_DISPATCHER
friend

Definition at line 466 of file tool_event.h.

Member Data Documentation

◆ m_actions

◆ m_category

TOOL_EVENT_CATEGORY TOOL_EVENT::m_category
private

Definition at line 504 of file tool_event.h.

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

◆ m_commandId

OPT<int> TOOL_EVENT::m_commandId
private

◆ m_commandStr

OPT<std::string> TOOL_EVENT::m_commandStr
private

◆ m_firstResponder

TOOL_BASE* TOOL_EVENT::m_firstResponder
private

Definition at line 537 of file tool_event.h.

Referenced by FirstResponder(), and SetFirstResponder().

◆ m_forceImmediate

bool TOOL_EVENT::m_forceImmediate
private

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

Definition at line 509 of file tool_event.h.

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

◆ m_hasPosition

bool TOOL_EVENT::m_hasPosition
private

Definition at line 508 of file tool_event.h.

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

◆ m_keyCode

int TOOL_EVENT::m_keyCode
private

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

Definition at line 528 of file tool_event.h.

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

◆ m_modifiers

int TOOL_EVENT::m_modifiers
private

Generic parameter used for passing non-standard data.

Definition at line 531 of file tool_event.h.

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

◆ m_mouseButtons

int TOOL_EVENT::m_mouseButtons
private

Stores code of pressed/released key.

Definition at line 525 of file tool_event.h.

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

◆ m_mouseDelta

VECTOR2D TOOL_EVENT::m_mouseDelta
private

Current mouse cursor position.

Definition at line 516 of file tool_event.h.

Referenced by Delta(), and setMouseDelta().

◆ m_mouseDragOrigin

VECTOR2D TOOL_EVENT::m_mouseDragOrigin
private

State of mouse buttons.

Definition at line 522 of file tool_event.h.

Referenced by DragOrigin(), and setMouseDragOrigin().

◆ m_mousePos

VECTOR2D TOOL_EVENT::m_mousePos
private

Point where dragging has started.

Definition at line 519 of file tool_event.h.

Referenced by Position(), and SetMousePosition().

◆ m_param

void* TOOL_EVENT::m_param
private

The first tool to receive the event.

Definition at line 534 of file tool_event.h.

Referenced by Parameter(), and SetParameter().

◆ m_passEvent

bool TOOL_EVENT::m_passEvent
private

Definition at line 507 of file tool_event.h.

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

◆ m_reactivate

bool TOOL_EVENT::m_reactivate
private

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

Definition at line 512 of file tool_event.h.

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

◆ m_scope

TOOL_ACTION_SCOPE TOOL_EVENT::m_scope
private

Definition at line 506 of file tool_event.h.


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