KiCad PCB EDA Suite
TOOL_EVENT Class Reference

Class TOOL_EVENT. More...

#include <tool_event.h>

Public Member Functions

const std::string Format () const
 Function Format() Returns 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=NULL)
 
 TOOL_EVENT (TOOL_EVENT_CATEGORY aCategory, TOOL_ACTIONS aAction, int aExtraParam, TOOL_ACTION_SCOPE aScope=AS_GLOBAL, void *aParameter=NULL)
 
 TOOL_EVENT (TOOL_EVENT_CATEGORY aCategory, TOOL_ACTIONS aAction, const std::string &aExtraParam, TOOL_ACTION_SCOPE aScope=AS_GLOBAL, void *aParameter=NULL)
 
TOOL_EVENT_CATEGORY Category () const
 

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

More...
 
TOOL_ACTIONS Action () const
 

Returns more specific information about the type of an event.

More...
 
const VECTOR2DDelta () const
 

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

More...
 
const VECTOR2DPosition () const
 

Returns mouse cursor position in world coordinates.

More...
 
const VECTOR2DDragOrigin () const
 

Returns the point where dragging has started.

More...
 
int Buttons () const
 

Returns information about mouse buttons state.

More...
 
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 IsCancel () const
 
bool IsActivate () const
 
bool IsUndoRedo () const
 
int Modifier (int aMask=MD_MODIFIER_MASK) const
 

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

More...
 
int KeyCode () const
 
bool IsKeyPressed () const
 
bool Matches (const TOOL_EVENT &aEvent) const
 Function Matches() Tests whether two events match in terms of category & action or command. More...
 
bool IsAction (const TOOL_ACTION *aAction) const
 Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_ACTION. More...
 
template<typename T >
Parameter () const
 Function Parameter() Returns a non-standard parameter assigned to the event. More...
 
template<typename T >
void SetParameter (T aParam)
 Function SetParameter() Sets a non-standard parameter assigned to the event. More...
 
boost::optional< int > GetCommandId () const
 
boost::optional< std::string > GetCommandStr () const
 
void SetMousePosition (const VECTOR2D &aP)
 

Private Member Functions

void setMouseDragOrigin (const VECTOR2D &aP)
 
void setMouseDelta (const VECTOR2D &aP)
 
void setMouseButtons (int aButtons)
 
void setModifiers (int aMods)
 

Private Attributes

TOOL_EVENT_CATEGORY m_category
 
TOOL_ACTIONS m_actions
 
TOOL_ACTION_SCOPE m_scope
 
VECTOR2D m_mouseDelta
 

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

More...
 
VECTOR2D m_mousePos
 

Current mouse cursor position

More...
 
VECTOR2D m_mouseDragOrigin
 

Point where dragging has started

More...
 
int m_mouseButtons
 

State of mouse buttons

More...
 
int m_keyCode
 

Stores code of pressed/released key

More...
 
int m_modifiers
 

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

More...
 
void * m_param
 

Generic parameter used for passing non-standard data.

More...
 
boost::optional< int > m_commandId
 
boost::optional< std::string > m_commandStr
 

Friends

class TOOL_DISPATCHER
 

Detailed Description

Class TOOL_EVENT.

Generic, UI-independent tool event.

Definition at line 162 of file tool_event.h.

Constructor & Destructor Documentation

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

Definition at line 173 of file tool_event.h.

174  :
175  m_category( aCategory ),
176  m_actions( aAction ),
177  m_scope( aScope ),
178  m_mouseButtons( 0 ),
179  m_keyCode( 0 ),
180  m_modifiers( 0 ),
181  m_param( aParameter ) {}
int m_modifiers
State of key modifierts (Ctrl/Alt/etc.)
Definition: tool_event.h:451
TOOL_ACTIONS m_actions
Definition: tool_event.h:431
int m_mouseButtons
State of mouse buttons
Definition: tool_event.h:445
int m_keyCode
Stores code of pressed/released key
Definition: tool_event.h:448
TOOL_ACTION_SCOPE m_scope
Definition: tool_event.h:432
void * m_param
Generic parameter used for passing non-standard data.
Definition: tool_event.h:454
TOOL_EVENT_CATEGORY m_category
Definition: tool_event.h:430
TOOL_EVENT::TOOL_EVENT ( TOOL_EVENT_CATEGORY  aCategory,
TOOL_ACTIONS  aAction,
int  aExtraParam,
TOOL_ACTION_SCOPE  aScope = AS_GLOBAL,
void *  aParameter = NULL 
)
inline

Definition at line 183 of file tool_event.h.

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

184  :
185  m_category( aCategory ),
186  m_actions( aAction ),
187  m_scope( aScope ),
188  m_mouseButtons( 0 ),
189  m_keyCode( 0 ),
190  m_modifiers( 0 ),
191  m_param( aParameter )
192  {
193  if( aCategory == TC_MOUSE )
194  {
195  setMouseButtons( aExtraParam & BUT_BUTTON_MASK );
196  }
197  else if( aCategory == TC_KEYBOARD )
198  {
199  m_keyCode = aExtraParam & ~MD_MODIFIER_MASK; // Filter out modifiers
200  }
201  else if( aCategory == TC_COMMAND )
202  {
203  m_commandId = aExtraParam;
204  }
205 
206  if( aCategory & ( TC_MOUSE | TC_KEYBOARD ) )
207  {
208  m_modifiers = aExtraParam & MD_MODIFIER_MASK;
209  }
210  }
void setMouseButtons(int aButtons)
Definition: tool_event.h:418
int m_modifiers
State of key modifierts (Ctrl/Alt/etc.)
Definition: tool_event.h:451
TOOL_ACTIONS m_actions
Definition: tool_event.h:431
int m_mouseButtons
State of mouse buttons
Definition: tool_event.h:445
int m_keyCode
Stores code of pressed/released key
Definition: tool_event.h:448
boost::optional< int > m_commandId
Definition: tool_event.h:456
TOOL_ACTION_SCOPE m_scope
Definition: tool_event.h:432
void * m_param
Generic parameter used for passing non-standard data.
Definition: tool_event.h:454
TOOL_EVENT_CATEGORY m_category
Definition: tool_event.h:430
TOOL_EVENT::TOOL_EVENT ( TOOL_EVENT_CATEGORY  aCategory,
TOOL_ACTIONS  aAction,
const std::string &  aExtraParam,
TOOL_ACTION_SCOPE  aScope = AS_GLOBAL,
void *  aParameter = NULL 
)
inline

Definition at line 212 of file tool_event.h.

References m_commandStr, TC_COMMAND, and TC_MESSAGE.

214  :
215  m_category( aCategory ),
216  m_actions( aAction ),
217  m_scope( aScope ),
218  m_mouseButtons( 0 ),
219  m_keyCode( 0 ),
220  m_modifiers( 0 ),
221  m_param( aParameter )
222  {
223  if( aCategory == TC_COMMAND || aCategory == TC_MESSAGE )
224  m_commandStr = aExtraParam;
225  }
int m_modifiers
State of key modifierts (Ctrl/Alt/etc.)
Definition: tool_event.h:451
TOOL_ACTIONS m_actions
Definition: tool_event.h:431
int m_mouseButtons
State of mouse buttons
Definition: tool_event.h:445
int m_keyCode
Stores code of pressed/released key
Definition: tool_event.h:448
TOOL_ACTION_SCOPE m_scope
Definition: tool_event.h:432
boost::optional< std::string > m_commandStr
Definition: tool_event.h:457
void * m_param
Generic parameter used for passing non-standard data.
Definition: tool_event.h:454
TOOL_EVENT_CATEGORY m_category
Definition: tool_event.h:430

Member Function Documentation

TOOL_ACTIONS TOOL_EVENT::Action ( ) const
inline

Returns more specific information about the type of an event.

Definition at line 234 of file tool_event.h.

References m_actions.

Referenced by TOOL_MANAGER::dispatchStandardEvents().

235  {
236  return m_actions;
237  }
TOOL_ACTIONS m_actions
Definition: tool_event.h:431
int TOOL_EVENT::Buttons ( ) const
inline

Returns information about mouse buttons state.

Definition at line 262 of file tool_event.h.

References m_category, m_mouseButtons, and TC_MOUSE.

263  {
264  assert( m_category == TC_MOUSE ); // this should be used only with mouse events
265  return m_mouseButtons;
266  }
int m_mouseButtons
State of mouse buttons
Definition: tool_event.h:445
TOOL_EVENT_CATEGORY m_category
Definition: tool_event.h:430
TOOL_EVENT_CATEGORY TOOL_EVENT::Category ( ) const
inline

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

Definition at line 228 of file tool_event.h.

References m_category.

Referenced by TOOL_MANAGER::dispatchInternal().

229  {
230  return m_category;
231  }
TOOL_EVENT_CATEGORY m_category
Definition: tool_event.h:430
const VECTOR2D& TOOL_EVENT::Delta ( ) const
inline

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

Definition at line 241 of file tool_event.h.

References m_category, m_mouseDelta, and TC_MOUSE.

242  {
243  assert( m_category == TC_MOUSE ); // this should be used only with mouse events
244  return m_mouseDelta;
245  }
VECTOR2D m_mouseDelta
Difference between mouse cursor position and the point where dragging event has started ...
Definition: tool_event.h:436
TOOL_EVENT_CATEGORY m_category
Definition: tool_event.h:430
const VECTOR2D& TOOL_EVENT::DragOrigin ( ) const
inline

Returns the point where dragging has started.

Definition at line 255 of file tool_event.h.

References m_category, m_mouseDragOrigin, and TC_MOUSE.

Referenced by POINT_EDITOR::updateEditedPoint().

256  {
257  assert( m_category == TC_MOUSE ); // this should be used only with mouse events
258  return m_mouseDragOrigin;
259  }
VECTOR2D m_mouseDragOrigin
Point where dragging has started
Definition: tool_event.h:442
TOOL_EVENT_CATEGORY m_category
Definition: tool_event.h:430
const std::string TOOL_EVENT::Format ( ) const

Function Format() Returns information about event in form of a human-readable string.

Returns
Event information.

Definition at line 60 of file tool_event.cpp.

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_CONTEXT_MENU_CHOICE, TA_CONTEXT_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.

61 {
62  std::string ev;
63 
64  const FlagString categories[] =
65  {
66  { TC_MOUSE, "mouse" },
67  { TC_KEYBOARD, "keyboard" },
68  { TC_COMMAND, "command" },
69  { TC_MESSAGE, "message" },
70  { TC_VIEW, "view" },
71  { 0, "" }
72  };
73 
74  const FlagString actions[] =
75  {
76  { TA_MOUSE_CLICK, "click" },
77  { TA_MOUSE_DBLCLICK, "double click" },
78  { TA_MOUSE_UP, "button-up" },
79  { TA_MOUSE_DOWN, "button-down" },
80  { TA_MOUSE_DRAG, "drag" },
81  { TA_MOUSE_MOTION, "motion" },
82  { TA_MOUSE_WHEEL, "wheel" },
83  { TA_KEY_PRESSED, "key-pressed" },
84  { TA_VIEW_REFRESH, "view-refresh" },
85  { TA_VIEW_ZOOM, "view-zoom" },
86  { TA_VIEW_PAN, "view-pan" },
87  { TA_VIEW_DIRTY, "view-dirty" },
88  { TA_CHANGE_LAYER, "change-layer" },
89  { TA_CANCEL_TOOL, "cancel-tool" },
90  { TA_CONTEXT_MENU_UPDATE, "context-menu-update" },
91  { TA_CONTEXT_MENU_CHOICE, "context-menu-choice" },
92  { TA_UNDO_REDO_PRE, "undo-redo-pre" },
93  { TA_UNDO_REDO_POST, "undo-redo-post" },
94  { TA_ACTION, "action" },
95  { TA_ACTIVATE, "activate" },
96  { 0, "" }
97  };
98 
99  const FlagString buttons[] =
100  {
101  { BUT_NONE, "none" },
102  { BUT_LEFT, "left" },
103  { BUT_RIGHT, "right" },
104  { BUT_MIDDLE, "middle" },
105  { 0, "" }
106  };
107 
108  const FlagString modifiers[] =
109  {
110  { MD_SHIFT, "shift" },
111  { MD_CTRL, "ctrl" },
112  { MD_ALT, "alt" },
113  { 0, "" }
114  };
115 
116  ev = "category: ";
117  ev += flag2string( m_category, categories );
118  ev += " action: ";
119  ev += flag2string( m_actions, actions );
120 
121  if( m_actions & TA_MOUSE )
122  {
123  ev += " btns: ";
124  ev += flag2string( m_mouseButtons, buttons );
125  }
126 
127  if( m_actions & TA_KEYBOARD )
128  {
129  char tmp[128];
130  sprintf( tmp, "key: %d", m_keyCode );
131  ev += tmp;
132  }
133 
134  if( m_actions & ( TA_MOUSE | TA_KEYBOARD ) )
135  {
136  ev += " mods: ";
137  ev += flag2string( m_modifiers, modifiers );
138  }
139 
140  if( m_commandId )
141  {
142  char tmp[128];
143  sprintf( tmp, "cmd-id: %d", *m_commandId );
144  ev += tmp;
145  }
146 
147  if( m_commandStr )
148  ev += "cmd-str: " + ( *m_commandStr );
149 
150  return ev;
151 }
int m_modifiers
State of key modifierts (Ctrl/Alt/etc.)
Definition: tool_event.h:451
TOOL_ACTIONS m_actions
Definition: tool_event.h:431
int m_mouseButtons
State of mouse buttons
Definition: tool_event.h:445
int m_keyCode
Stores code of pressed/released key
Definition: tool_event.h:448
boost::optional< int > m_commandId
Definition: tool_event.h:456
boost::optional< std::string > m_commandStr
Definition: tool_event.h:457
static const std::string flag2string(int aFlag, const FlagString *aExps)
Definition: tool_event.cpp:40
TOOL_EVENT_CATEGORY m_category
Definition: tool_event.h:430
boost::optional<int> TOOL_EVENT::GetCommandId ( ) const
inline

Definition at line 390 of file tool_event.h.

References m_commandId.

391  {
392  return m_commandId;
393  }
boost::optional< int > m_commandId
Definition: tool_event.h:456
boost::optional<std::string> TOOL_EVENT::GetCommandStr ( ) const
inline

Definition at line 395 of file tool_event.h.

References m_commandStr.

Referenced by TOOL_MANAGER::dispatchActivation().

396  {
397  return m_commandStr;
398  }
boost::optional< std::string > m_commandStr
Definition: tool_event.h:457
bool TOOL_EVENT::IsAction ( const TOOL_ACTION aAction) const

Function IsAction() Tests 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 54 of file tool_event.cpp.

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

Referenced by EDIT_TOOL::Duplicate(), TOOL_EVT_UTILS::IsCancelInteractive(), TOOL_EVT_UTILS::IsRotateToolEvt(), ROUTER_TOOL::onViaCommand(), PCBNEW_CONTROL::ZoneDisplayMode(), COMMON_TOOLS::ZoomInOut(), and COMMON_TOOLS::ZoomInOutCenter().

55 {
56  return Matches( aAction->MakeEvent() );
57 }
bool Matches(const TOOL_EVENT &aEvent) const
Function Matches() Tests whether two events match in terms of category & action or command...
Definition: tool_event.h:333
TOOL_EVENT MakeEvent() const
Function HasHotKey() Checks if the action has a hot key assigned.
Definition: tool_action.h:104
bool TOOL_EVENT::IsActivate ( ) const
inline

Definition at line 300 of file tool_event.h.

References m_actions, and TA_ACTIVATE.

Referenced by TOOL_MANAGER::dispatchActivation(), and TOOL_EVT_UTILS::IsCancelInteractive().

301  {
302  return m_actions == TA_ACTIVATE;
303  }
TOOL_ACTIONS m_actions
Definition: tool_event.h:431
bool TOOL_EVENT::IsCancel ( ) const
inline

Definition at line 295 of file tool_event.h.

References m_actions, and TA_CANCEL_TOOL.

Referenced by TOOL_EVT_UTILS::IsCancelInteractive().

296  {
297  return m_actions == TA_CANCEL_TOOL;
298  }
TOOL_ACTIONS m_actions
Definition: tool_event.h:431
bool TOOL_EVENT::IsClick ( int  aButtonMask = BUT_ANY) const
inline

Definition at line 268 of file tool_event.h.

References m_actions, m_mouseButtons, and TA_MOUSE_CLICK.

Referenced by TOOL_MANAGER::dispatchContextMenu(), and PNS::TOOL_BASE::updateStartItem().

269  {
270  return ( m_actions == TA_MOUSE_CLICK )
271  && ( ( m_mouseButtons & aButtonMask ) == aButtonMask );
272  }
TOOL_ACTIONS m_actions
Definition: tool_event.h:431
int m_mouseButtons
State of mouse buttons
Definition: tool_event.h:445
bool TOOL_EVENT::IsDblClick ( int  aButtonMask = BUT_ANY) const
inline

Definition at line 274 of file tool_event.h.

References m_actions, m_mouseButtons, and TA_MOUSE_DBLCLICK.

275  {
276  return ( m_actions == TA_MOUSE_DBLCLICK )
277  && ( ( m_mouseButtons & aButtonMask ) == aButtonMask );
278  }
TOOL_ACTIONS m_actions
Definition: tool_event.h:431
int m_mouseButtons
State of mouse buttons
Definition: tool_event.h:445
bool TOOL_EVENT::IsDrag ( int  aButtonMask = BUT_ANY) const
inline

Definition at line 280 of file tool_event.h.

References m_actions, m_mouseButtons, and TA_MOUSE_DRAG.

Referenced by POINT_EDITOR::updateEditedPoint().

281  {
282  return ( m_actions == TA_MOUSE_DRAG ) && ( ( m_mouseButtons & aButtonMask ) == aButtonMask );
283  }
TOOL_ACTIONS m_actions
Definition: tool_event.h:431
int m_mouseButtons
State of mouse buttons
Definition: tool_event.h:445
bool TOOL_EVENT::IsKeyPressed ( ) const
inline

Definition at line 321 of file tool_event.h.

References m_actions, and TA_KEY_PRESSED.

Referenced by ROUTER_TOOL::handleCommonEvents().

322  {
323  return m_actions == TA_KEY_PRESSED;
324  }
TOOL_ACTIONS m_actions
Definition: tool_event.h:431
bool TOOL_EVENT::IsMotion ( ) const
inline

Definition at line 290 of file tool_event.h.

References m_actions, and TA_MOUSE_MOTION.

Referenced by POINT_EDITOR::updateEditedPoint(), and PNS::TOOL_BASE::updateStartItem().

291  {
292  return m_actions == TA_MOUSE_MOTION;
293  }
TOOL_ACTIONS m_actions
Definition: tool_event.h:431
bool TOOL_EVENT::IsMouseUp ( int  aButtonMask = BUT_ANY) const
inline

Definition at line 285 of file tool_event.h.

References m_actions, m_mouseButtons, and TA_MOUSE_UP.

286  {
287  return ( m_actions == TA_MOUSE_UP ) && ( ( m_mouseButtons & aButtonMask ) == aButtonMask );
288  }
TOOL_ACTIONS m_actions
Definition: tool_event.h:431
int m_mouseButtons
State of mouse buttons
Definition: tool_event.h:445
bool TOOL_EVENT::IsUndoRedo ( ) const
inline

Definition at line 305 of file tool_event.h.

References m_actions, TA_UNDO_REDO_POST, and TA_UNDO_REDO_PRE.

306  {
308  }
TOOL_ACTIONS m_actions
Definition: tool_event.h:431
int TOOL_EVENT::KeyCode ( ) const
inline

Definition at line 316 of file tool_event.h.

References m_keyCode.

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

317  {
318  return m_keyCode;
319  }
int m_keyCode
Stores code of pressed/released key
Definition: tool_event.h:448
bool TOOL_EVENT::Matches ( const TOOL_EVENT aEvent) const
inline

Function Matches() Tests 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 333 of file tool_event.h.

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

Referenced by IsAction().

334  {
335  if( !( m_category & aEvent.m_category ) )
336  return false;
337 
339  {
340  if( (bool) m_commandStr && (bool) aEvent.m_commandStr )
341  return *m_commandStr == *aEvent.m_commandStr;
342 
343  if( (bool) m_commandId && (bool) aEvent.m_commandId )
344  return *m_commandId == *aEvent.m_commandId;
345  }
346 
347  // BUGFIX: TA_ANY should match EVERYTHING, even TA_NONE (for TC_MESSAGE)
348  if( m_actions == TA_ANY && aEvent.m_actions == TA_NONE && aEvent.m_category == TC_MESSAGE )
349  return true;
350 
351  // BUGFIX: This check must happen after the TC_COMMAND check because otherwise events of
352  // the form { TC_COMMAND, TA_NONE } will be incorrectly skipped
353  if( !( m_actions & aEvent.m_actions ) )
354  return false;
355 
356  return true;
357  }
TOOL_ACTIONS m_actions
Definition: tool_event.h:431
boost::optional< int > m_commandId
Definition: tool_event.h:456
boost::optional< std::string > m_commandStr
Definition: tool_event.h:457
TOOL_EVENT_CATEGORY m_category
Definition: tool_event.h:430
int TOOL_EVENT::Modifier ( int  aMask = MD_MODIFIER_MASK) const
inline

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

Definition at line 311 of file tool_event.h.

References m_modifiers.

Referenced by TOOL_MANAGER::dispatchStandardEvents(), PNS::TOOL_BASE::updateEndItem(), and PNS::TOOL_BASE::updateStartItem().

312  {
313  return m_modifiers & aMask;
314  }
int m_modifiers
State of key modifierts (Ctrl/Alt/etc.)
Definition: tool_event.h:451
template<typename T >
T TOOL_EVENT::Parameter ( ) const
inline

Function Parameter() Returns a non-standard parameter assigned to the event.

Its meaning depends on the target tool.

Definition at line 373 of file tool_event.h.

References m_param.

Referenced by MICROWAVE_TOOL::addMicrowaveFootprint(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), PCBNEW_CONTROL::CursorControl(), SELECTION_TOOL::CursorSelection(), TOOL_EVT_UTILS::GetEventRotationAngle(), COMMON_TOOLS::GridPreset(), PCBNEW_CONTROL::GridSetOrigin(), PCB_EDITOR_CONTROL::HighlightNet(), PCBNEW_CONTROL::LayerSwitch(), PCBNEW_CONTROL::PanControl(), EDIT_TOOL::Remove(), SELECTION_TOOL::SelectItem(), SELECTION_TOOL::selectOnSheetFromEeschema(), SELECTION_TOOL::UnselectItem(), and COMMON_TOOLS::ZoomPreset().

374  {
375  return reinterpret_cast<T>( m_param );
376  }
T
enum T contains all this lexer's tokens.
void * m_param
Generic parameter used for passing non-standard data.
Definition: tool_event.h:454
const VECTOR2D& TOOL_EVENT::Position ( ) const
inline

Returns mouse cursor position in world coordinates.

Definition at line 248 of file tool_event.h.

References m_category, m_mousePos, and TC_MOUSE.

Referenced by POINT_EDITOR::updateEditedPoint(), and PNS::TOOL_BASE::updateStartItem().

249  {
250  assert( m_category == TC_MOUSE ); // this should be used only with mouse events
251  return m_mousePos;
252  }
VECTOR2D m_mousePos
Current mouse cursor position
Definition: tool_event.h:439
TOOL_EVENT_CATEGORY m_category
Definition: tool_event.h:430
void TOOL_EVENT::setModifiers ( int  aMods)
inlineprivate

Definition at line 424 of file tool_event.h.

References m_modifiers, and MD_MODIFIER_MASK.

425  {
426  assert( ( aMods & ~MD_MODIFIER_MASK ) == 0 );
427  m_modifiers = aMods;
428  }
int m_modifiers
State of key modifierts (Ctrl/Alt/etc.)
Definition: tool_event.h:451
void TOOL_EVENT::setMouseButtons ( int  aButtons)
inlineprivate

Definition at line 418 of file tool_event.h.

References BUT_BUTTON_MASK, and m_mouseButtons.

Referenced by TOOL_EVENT().

419  {
420  assert( ( aButtons & ~BUT_BUTTON_MASK ) == 0 );
421  m_mouseButtons = aButtons;
422  }
int m_mouseButtons
State of mouse buttons
Definition: tool_event.h:445
void TOOL_EVENT::setMouseDelta ( const VECTOR2D aP)
inlineprivate

Definition at line 413 of file tool_event.h.

References m_mouseDelta.

414  {
415  m_mouseDelta = aP;
416  }
VECTOR2D m_mouseDelta
Difference between mouse cursor position and the point where dragging event has started ...
Definition: tool_event.h:436
void TOOL_EVENT::setMouseDragOrigin ( const VECTOR2D aP)
inlineprivate

Definition at line 408 of file tool_event.h.

References m_mouseDragOrigin.

409  {
410  m_mouseDragOrigin = aP;
411  }
VECTOR2D m_mouseDragOrigin
Point where dragging has started
Definition: tool_event.h:442
void TOOL_EVENT::SetMousePosition ( const VECTOR2D aP)
inline

Definition at line 400 of file tool_event.h.

References m_mousePos.

Referenced by PCBNEW_CONTROL::CursorControl().

401  {
402  m_mousePos = aP;
403  }
VECTOR2D m_mousePos
Current mouse cursor position
Definition: tool_event.h:439
template<typename T >
void TOOL_EVENT::SetParameter ( aParam)
inline

Function SetParameter() Sets a non-standard parameter assigned to the event.

Its meaning depends on the target tool.

Parameters
aParamis the new parameter.

Definition at line 385 of file tool_event.h.

References m_param.

Referenced by TOOL_MANAGER::dispatchContextMenu(), TOOL_MANAGER::RunAction(), and DIALOG_SET_GRID::TransferDataFromWindow().

386  {
387  m_param = (void*) aParam;
388  }
void * m_param
Generic parameter used for passing non-standard data.
Definition: tool_event.h:454

Friends And Related Function Documentation

friend class TOOL_DISPATCHER
friend

Definition at line 406 of file tool_event.h.

Member Data Documentation

TOOL_ACTIONS TOOL_EVENT::m_actions
private
TOOL_EVENT_CATEGORY TOOL_EVENT::m_category
private

Definition at line 430 of file tool_event.h.

Referenced by Buttons(), Category(), Delta(), DragOrigin(), Format(), Matches(), and Position().

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

Definition at line 456 of file tool_event.h.

Referenced by Format(), GetCommandId(), Matches(), and TOOL_EVENT().

boost::optional<std::string> TOOL_EVENT::m_commandStr
private

Definition at line 457 of file tool_event.h.

Referenced by Format(), GetCommandStr(), Matches(), and TOOL_EVENT().

int TOOL_EVENT::m_keyCode
private

Stores code of pressed/released key

Definition at line 448 of file tool_event.h.

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

int TOOL_EVENT::m_modifiers
private

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

Definition at line 451 of file tool_event.h.

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

int TOOL_EVENT::m_mouseButtons
private

State of mouse buttons

Definition at line 445 of file tool_event.h.

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

VECTOR2D TOOL_EVENT::m_mouseDelta
private

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

Definition at line 436 of file tool_event.h.

Referenced by Delta(), and setMouseDelta().

VECTOR2D TOOL_EVENT::m_mouseDragOrigin
private

Point where dragging has started

Definition at line 442 of file tool_event.h.

Referenced by DragOrigin(), and setMouseDragOrigin().

VECTOR2D TOOL_EVENT::m_mousePos
private

Current mouse cursor position

Definition at line 439 of file tool_event.h.

Referenced by Position(), and SetMousePosition().

void* TOOL_EVENT::m_param
private

Generic parameter used for passing non-standard data.

Definition at line 454 of file tool_event.h.

Referenced by Parameter(), and SetParameter().

TOOL_ACTION_SCOPE TOOL_EVENT::m_scope
private

Definition at line 432 of file tool_event.h.


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