KiCad PCB EDA Suite
TOOL_DISPATCHER Class Reference

Class TOOL_DISPATCHER. More...

#include <tool_dispatcher.h>

Inheritance diagram for TOOL_DISPATCHER:

Classes

struct  BUTTON_STATE
 

Stores information about a mouse button state

More...
 

Public Member Functions

 TOOL_DISPATCHER (TOOL_MANAGER *aToolMgr, ACTIONS *aActions)
 Constructor. More...
 
virtual ~TOOL_DISPATCHER ()
 
virtual void ResetState ()
 Function ResetState() Brings the dispatcher to its initial state. More...
 
virtual void DispatchWxEvent (wxEvent &aEvent)
 Function DispatchWxEvent() Processes wxEvents (mostly UI events), translates them to TOOL_EVENTs, and makes tools handle those. More...
 
virtual void DispatchWxCommand (wxCommandEvent &aEvent)
 Function DispatchWxCommand() Processes wxCommands (mostly menu related events) and runs appropriate actions (eg. More...
 

Private Member Functions

bool handleMouseButton (wxEvent &aEvent, int aIndex, bool aMotion)
 

Handles mouse related events (click, motion, dragging).

More...
 
KIGFX::VIEWgetView ()
 

Returns the instance of VIEW, used by the application.

More...
 

Static Private Member Functions

static int decodeModifiers (const wxKeyboardState *aState)
 

Saves the state of key modifiers (Alt, Ctrl and so on).

More...
 

Private Attributes

VECTOR2D m_lastMousePos
 

The last mouse cursor position (in world coordinates).

More...
 
std::vector< BUTTON_STATE * > m_buttons
 

State of mouse buttons.

More...
 
TOOL_MANAGERm_toolMgr
 

Instance of tool manager that cooperates with the dispatcher.

More...
 
ACTIONSm_actions
 

Instance of an actions list that handles legacy action translation

More...
 

Static Private Attributes

static const int MouseButtonCount = 3
 

Number of mouse buttons that is handled in events.

More...
 
static const int DragTimeThreshold = 300
 

The time threshold for a mouse button press that distinguishes between a single mouse click and a beginning of drag event (expressed in milliseconds).

More...
 
static const int DragDistanceThreshold = 8
 

The distance threshold for mouse cursor that disinguishes between a single mouse click and a beginning of drag event (expressed in screen pixels).

More...
 

Detailed Description

Class TOOL_DISPATCHER.

  • takes wx events,
  • fixes all wx quirks (mouse warping, panning, ordering problems, etc)
  • translates coordinates to world space
  • low-level input conditioning (drag/click threshold), updating mouse position during view auto-scroll/pan.
  • issues TOOL_EVENTS to the tool manager

Definition at line 51 of file tool_dispatcher.h.

Constructor & Destructor Documentation

◆ TOOL_DISPATCHER()

TOOL_DISPATCHER::TOOL_DISPATCHER ( TOOL_MANAGER aToolMgr,
ACTIONS aActions 
)

Constructor.

Parameters
aToolMgrtool manager instance the events will be sent to
aActionsACTIONS subclass instance for ACTIONS::TranslateLegacyId()

Definition at line 119 of file tool_dispatcher.cpp.

119  :
120  m_toolMgr( aToolMgr ),
121  m_actions( aActions )
122 {
123  m_buttons.push_back( new BUTTON_STATE( BUT_LEFT, wxEVT_LEFT_DOWN,
124  wxEVT_LEFT_UP, wxEVT_LEFT_DCLICK ) );
125  m_buttons.push_back( new BUTTON_STATE( BUT_RIGHT, wxEVT_RIGHT_DOWN,
126  wxEVT_RIGHT_UP, wxEVT_RIGHT_DCLICK ) );
127  m_buttons.push_back( new BUTTON_STATE( BUT_MIDDLE, wxEVT_MIDDLE_DOWN,
128  wxEVT_MIDDLE_UP, wxEVT_MIDDLE_DCLICK ) );
129 
130  ResetState();
131 }
ACTIONS * m_actions
Instance of an actions list that handles legacy action translation
virtual void ResetState()
Function ResetState() Brings the dispatcher to its initial state.
std::vector< BUTTON_STATE * > m_buttons
State of mouse buttons.
TOOL_MANAGER * m_toolMgr
Instance of tool manager that cooperates with the dispatcher.

References BUT_LEFT, BUT_MIDDLE, BUT_RIGHT, m_buttons, and ResetState().

◆ ~TOOL_DISPATCHER()

TOOL_DISPATCHER::~TOOL_DISPATCHER ( )
virtual

Definition at line 134 of file tool_dispatcher.cpp.

135 {
136  for( BUTTON_STATE* st : m_buttons )
137  delete st;
138 }
std::vector< BUTTON_STATE * > m_buttons
State of mouse buttons.

References m_buttons.

Member Function Documentation

◆ decodeModifiers()

static int TOOL_DISPATCHER::decodeModifiers ( const wxKeyboardState *  aState)
inlinestaticprivate

Saves the state of key modifiers (Alt, Ctrl and so on).

Definition at line 102 of file tool_dispatcher.h.

103  {
104  int mods = 0;
105 
106  if( aState->ControlDown() )
107  mods |= MD_CTRL;
108 
109  if( aState->AltDown() )
110  mods |= MD_ALT;
111 
112  if( aState->ShiftDown() )
113  mods |= MD_SHIFT;
114 
115  return mods;
116  }

References MD_ALT, MD_CTRL, and MD_SHIFT.

Referenced by DispatchWxEvent(), and handleMouseButton().

◆ DispatchWxCommand()

void TOOL_DISPATCHER::DispatchWxCommand ( wxCommandEvent &  aEvent)
virtual

Function DispatchWxCommand() Processes wxCommands (mostly menu related events) and runs appropriate actions (eg.

run the specified tool).

Parameters
aEventis the wxCommandEvent to be processed.

Definition at line 475 of file tool_dispatcher.cpp.

476 {
477  OPT<TOOL_EVENT> evt = m_actions->TranslateLegacyId( aEvent.GetId() );
478 
479  if( evt )
480  m_toolMgr->ProcessEvent( *evt );
481  else
482  aEvent.Skip();
483 }
ACTIONS * m_actions
Instance of an actions list that handles legacy action translation
virtual OPT< TOOL_EVENT > TranslateLegacyId(int aId)=0
Function TranslateLegacyId() Translates legacy tool ids to the corresponding TOOL_ACTION name.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
boost::optional< T > OPT
Definition: optional.h:7
TOOL_MANAGER * m_toolMgr
Instance of tool manager that cooperates with the dispatcher.

References m_actions, m_toolMgr, TOOL_MANAGER::ProcessEvent(), and ACTIONS::TranslateLegacyId().

Referenced by EDA_DRAW_PANEL_GAL::SetEventDispatcher().

◆ DispatchWxEvent()

void TOOL_DISPATCHER::DispatchWxEvent ( wxEvent &  aEvent)
virtual

Function DispatchWxEvent() Processes wxEvents (mostly UI events), translates them to TOOL_EVENTs, and makes tools handle those.

Parameters
aEventis the wxWidgets event to be processed.

Definition at line 310 of file tool_dispatcher.cpp.

311 {
312  bool motion = false, buttonEvents = false;
313  OPT<TOOL_EVENT> evt;
314  int key = 0; // key = 0 if the event is not a key event
315  int unicode = 0;
316  bool keyIsSpecial = false; // True if the key is a special key code
317 
318  int type = aEvent.GetEventType();
319 
320  // Sometimes there is no window that has the focus (it happens when another PCB_BASE_FRAME
321  // is opened and is iconized on Windows).
322  // In this case, gives the focus to the parent PCB_BASE_FRAME (for an obscure reason,
323  // when happens, the GAL canvas itself does not accept the focus)
324  if( wxWindow::FindFocus() == nullptr )
325  static_cast<PCB_BASE_FRAME*>( m_toolMgr->GetEditFrame() )->SetFocus();
326 
327  // Mouse handling
328  // Note: wxEVT_LEFT_DOWN event must always be skipped.
329  if( type == wxEVT_MOTION || type == wxEVT_MOUSEWHEEL ||
330 #if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
331  type == wxEVT_MAGNIFY ||
332 #endif
333  type == wxEVT_LEFT_DOWN || type == wxEVT_LEFT_UP ||
334  type == wxEVT_MIDDLE_DOWN || type == wxEVT_MIDDLE_UP ||
335  type == wxEVT_RIGHT_DOWN || type == wxEVT_RIGHT_UP ||
336  type == wxEVT_LEFT_DCLICK || type == wxEVT_MIDDLE_DCLICK || type == wxEVT_RIGHT_DCLICK ||
337  // Event issued when mouse retains position in screen coordinates,
338  // but changes in world coordinates (e.g. autopanning)
340  {
341  wxMouseEvent* me = static_cast<wxMouseEvent*>( &aEvent );
342  int mods = decodeModifiers( me );
343 
345 
346  if( pos != m_lastMousePos )
347  {
348  motion = true;
349  m_lastMousePos = pos;
350  }
351 
352  for( unsigned int i = 0; i < m_buttons.size(); i++ )
353  buttonEvents |= handleMouseButton( aEvent, i, motion );
354 
355  if( !buttonEvents && motion )
356  {
357  evt = TOOL_EVENT( TC_MOUSE, TA_MOUSE_MOTION, mods );
358  evt->SetMousePosition( pos );
359  }
360 
361 #ifdef __APPLE__
362  // TODO That's a big ugly workaround, somehow DRAWPANEL_GAL loses focus
363  // after second LMB click and currently I have no means to do better debugging
364  if( type == wxEVT_LEFT_UP )
365  static_cast<PCB_BASE_FRAME*>( m_toolMgr->GetEditFrame() )->GetGalCanvas()->SetFocus();
366 #endif /* __APPLE__ */
367  }
368  else if( type == wxEVT_CHAR_HOOK || type == wxEVT_CHAR )
369  {
370  wxKeyEvent* ke = static_cast<wxKeyEvent*>( &aEvent );
371  key = ke->GetKeyCode();
372  keyIsSpecial = isKeySpecialCode( key );
373  unicode = ke->GetUnicodeKey();
374 
375  wxLogTrace( kicadTraceKeyEvent, "TOOL_DISPATCHER::DispatchWxEvent %s", dump( *ke ) );
376 
377  // if the key event must be skipped, skip it here if the event is a wxEVT_CHAR_HOOK
378  // and do nothing.
379  // a wxEVT_CHAR will be fired by wxWidgets later for this key.
380  if( type == wxEVT_CHAR_HOOK )
381  {
382  if( !keyIsSpecial )
383  {
384  aEvent.Skip();
385  return;
386  }
387  else
388  key = translateSpecialCode( key );
389  }
390 
391  int mods = decodeModifiers( ke );
392 
393  if( mods & MD_CTRL )
394  {
395  // wxWidgets maps key codes related to Ctrl+letter handled by CHAR_EVT
396  // (http://docs.wxwidgets.org/trunk/classwx_key_event.html):
397  // char events for ASCII letters in this case carry codes corresponding to the ASCII
398  // value of Ctrl-Latter, i.e. 1 for Ctrl-A, 2 for Ctrl-B and so on until 26 for Ctrl-Z.
399  // They are remapped here to be more easy to handle in code
400  // Note also on OSX wxWidgets has a differnt behavior and the mapping is made
401  // only for ctrl+'A' to ctlr+'Z' (unicode code return 'A' to 'Z').
402  // Others OS return WXK_CONTROL_A to WXK_CONTROL_Z, and Ctrl+'M' returns the same code as
403  // the return key, so the remapping does not use the unicode key value.
404 #ifdef __APPLE__
405  if( unicode >= 'A' && unicode <= 'Z' && key >= WXK_CONTROL_A && key <= WXK_CONTROL_Z )
406 #else
407  (void) unicode; //not used: avoid compil warning
408  if( key >= WXK_CONTROL_A && key <= WXK_CONTROL_Z )
409 #endif
410  key += 'A' - 1;
411  }
412 
413 #ifdef __APPLE__
414  if( mods & MD_ALT )
415  {
416  // OSX maps a bunch of commonly used extended-ASCII characters onto the keyboard
417  // using the ALT key. Since we use ALT for some of our hotkeys, we need to map back
418  // to the underlying keys. The kVK_ANSI_* values come from Apple and are said to be
419  // hardware independant.
420  switch( ke->GetRawKeyCode() )
421  {
422  case /* kVK_ANSI_1 */ 0x12: key = '1'; break;
423  case /* kVK_ANSI_2 */ 0x13: key = '2'; break;
424  case /* kVK_ANSI_3 */ 0x14: key = '3'; break;
425  case /* kVK_ANSI_4 */ 0x15: key = '4'; break;
426  case /* kVK_ANSI_6 */ 0x16: key = '6'; break;
427  case /* kVK_ANSI_5 */ 0x17: key = '5'; break;
428  case /* kVK_ANSI_Equal */ 0x18: key = '='; break;
429  case /* kVK_ANSI_9 */ 0x19: key = '9'; break;
430  case /* kVK_ANSI_7 */ 0x1A: key = '7'; break;
431  case /* kVK_ANSI_Minus */ 0x1B: key = '-'; break;
432  case /* kVK_ANSI_8 */ 0x1C: key = '8'; break;
433  case /* kVK_ANSI_0 */ 0x1D: key = '0'; break;
434  default: ;
435  }
436  }
437 #endif
438 
439  if( key == WXK_ESCAPE ) // ESC is the special key for canceling tools
441  else
442  evt = TOOL_EVENT( TC_KEYBOARD, TA_KEY_PRESSED, key | mods );
443  }
444 
445  if( evt )
446  m_toolMgr->ProcessEvent( *evt );
447 
448  // pass the event to the GUI, it might still be interested in it
449  // Note wxEVT_CHAR_HOOK event is already skipped for special keys not used by KiCad
450  // and wxEVT_LEFT_DOWN must be always Skipped.
451  //
452  // On OS X, key events are always meant to be caught. An uncaught key event is assumed
453  // to be a user input error by OS X (as they are pressing keys in a context where nothing
454  // is there to catch the event). This annoyingly makes OS X beep and/or flash the screen
455  // in Pcbnew and the footprint editor any time a hotkey is used. The correct procedure is
456  // to NOT pass wxEVT_CHAR events to the GUI under OS X.
457  //
458  // On Windows, avoid to call wxEvent::Skip for special keys because some keys (ARROWS,
459  // PAGE_UP, PAGE_DOWN have predefined actions (like move thumbtrack cursor), and we do
460  // not want these actions executed (most are handled by KiCad)
461 
462  if( !evt || type == wxEVT_LEFT_DOWN )
463  aEvent.Skip();
464 
465  // The suitable Skip is already called, but the wxEVT_CHAR
466  // must be Skipped (sent to GUI).
467  // Otherwise accelerators and shortcuts in main menu or toolbars are not seen.
468 #ifndef __APPLE__
469  if( type == wxEVT_CHAR && !keyIsSpecial )
470  aEvent.Skip();
471 #endif
472 }
static int decodeModifiers(const wxKeyboardState *aState)
Saves the state of key modifiers (Alt, Ctrl and so on).
virtual VECTOR2D GetMousePosition(bool aWorldCoordinates=true) const =0
Function GetMousePosition() Returns the current mouse pointer position.
static const wxEventType EVT_REFRESH_MOUSE
Event that forces mouse move event in the dispatcher (eg.
int translateSpecialCode(int aKeyCode)
EDA_DRAW_FRAME * GetEditFrame() const
Definition: tool_manager.h:267
wxString dump(const wxArrayString &aArray)
Debug helper for printing wxArrayString contents.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
bool isKeySpecialCode(int aKeyCode)
Class TOOL_EVENT.
Definition: tool_event.h:167
VECTOR2D m_lastMousePos
The last mouse cursor position (in world coordinates).
std::vector< BUTTON_STATE * > m_buttons
State of mouse buttons.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:257
size_t i
Definition: json11.cpp:597
const wxChar *const kicadTraceKeyEvent
Flag to enable wxKeyEvent debug tracing.
boost::optional< T > OPT
Definition: optional.h:7
bool handleMouseButton(wxEvent &aEvent, int aIndex, bool aMotion)
Handles mouse related events (click, motion, dragging).
TOOL_MANAGER * m_toolMgr
Instance of tool manager that cooperates with the dispatcher.

References decodeModifiers(), dump(), KIGFX::WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE, TOOL_MANAGER::GetEditFrame(), KIGFX::VIEW_CONTROLS::GetMousePosition(), TOOL_MANAGER::GetViewControls(), handleMouseButton(), i, isKeySpecialCode(), kicadTraceKeyEvent, m_buttons, m_lastMousePos, m_toolMgr, MD_ALT, MD_CTRL, TOOL_MANAGER::ProcessEvent(), TA_CANCEL_TOOL, TA_KEY_PRESSED, TA_MOUSE_MOTION, TC_COMMAND, TC_KEYBOARD, TC_MOUSE, and translateSpecialCode().

Referenced by EDA_DRAW_PANEL_GAL::OnEvent().

◆ getView()

KIGFX::VIEW * TOOL_DISPATCHER::getView ( )
private

Returns the instance of VIEW, used by the application.

Definition at line 148 of file tool_dispatcher.cpp.

149 {
150  return m_toolMgr->GetView();
151 }
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:252
TOOL_MANAGER * m_toolMgr
Instance of tool manager that cooperates with the dispatcher.

References TOOL_MANAGER::GetView(), and m_toolMgr.

Referenced by handleMouseButton().

◆ handleMouseButton()

bool TOOL_DISPATCHER::handleMouseButton ( wxEvent &  aEvent,
int  aIndex,
bool  aMotion 
)
private

Handles mouse related events (click, motion, dragging).

Definition at line 154 of file tool_dispatcher.cpp.

155 {
156  BUTTON_STATE* st = m_buttons[aIndex];
157  wxEventType type = aEvent.GetEventType();
158  OPT<TOOL_EVENT> evt;
159  bool isClick = false;
160 
161 // bool up = type == st->upEvent;
162 // bool down = type == st->downEvent;
163  bool up = false, down = false;
164  bool dblClick = type == st->dblClickEvent;
165  bool state = st->GetState();
166 
167  if( !dblClick )
168  {
169  // Sometimes the dispatcher does not receive mouse button up event, so it stays
170  // in the dragging mode even if the mouse button is not held anymore
171  if( st->pressed && !state )
172  up = true;
173  // Don't apply same logic to down events as it kills touchpad tapping
174  else if( !st->pressed && type == st->downEvent )
175  down = true;
176  }
177 
178  int mods = decodeModifiers( static_cast<wxMouseEvent*>( &aEvent ) );
179  int args = st->button | mods;
180 
181  if( down ) // Handle mouse button press
182  {
183  st->downTimestamp = wxGetLocalTimeMillis();
184 
185  if( !st->pressed ) // save the drag origin on the first click only
186  st->dragOrigin = m_lastMousePos;
187 
188  st->downPosition = m_lastMousePos;
189  st->dragMaxDelta = 0;
190  st->pressed = true;
191  evt = TOOL_EVENT( TC_MOUSE, TA_MOUSE_DOWN, args );
192  }
193  else if( up ) // Handle mouse button release
194  {
195  st->pressed = false;
196 
197  if( st->dragging )
198  {
199  wxLongLong t = wxGetLocalTimeMillis();
200 
201  // Determine if it was just a single click or beginning of dragging
202  if( t - st->downTimestamp < DragTimeThreshold &&
203  st->dragMaxDelta < DragDistanceThreshold )
204  isClick = true;
205  else
206  evt = TOOL_EVENT( TC_MOUSE, TA_MOUSE_UP, args );
207  }
208  else
209  isClick = true;
210 
211  if( isClick )
212  evt = TOOL_EVENT( TC_MOUSE, TA_MOUSE_CLICK, args );
213 
214  st->dragging = false;
215  }
216  else if( dblClick )
217  {
218  evt = TOOL_EVENT( TC_MOUSE, TA_MOUSE_DBLCLICK, args );
219  }
220 
221  if( st->pressed && aMotion )
222  {
223  st->dragging = true;
224  double dragPixelDistance =
225  getView()->ToScreen( m_lastMousePos - st->dragOrigin, false ).EuclideanNorm();
226  st->dragMaxDelta = std::max( st->dragMaxDelta, dragPixelDistance );
227 
228  wxLongLong t = wxGetLocalTimeMillis();
229 
230  if( t - st->downTimestamp > DragTimeThreshold || st->dragMaxDelta > DragDistanceThreshold )
231  {
232  evt = TOOL_EVENT( TC_MOUSE, TA_MOUSE_DRAG, args );
233  evt->setMouseDragOrigin( st->dragOrigin );
234  evt->setMouseDelta( m_lastMousePos - st->dragOrigin );
235  }
236  }
237 
238  if( evt )
239  {
240  evt->SetMousePosition( isClick ? st->downPosition : m_lastMousePos );
241  m_toolMgr->ProcessEvent( *evt );
242 
243  return true;
244  }
245 
246  return false;
247 }
static int decodeModifiers(const wxKeyboardState *aState)
Saves the state of key modifiers (Alt, Ctrl and so on).
static const int DragDistanceThreshold
The distance threshold for mouse cursor that disinguishes between a single mouse click and a beginnin...
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
Class TOOL_EVENT.
Definition: tool_event.h:167
VECTOR2D m_lastMousePos
The last mouse cursor position (in world coordinates).
VECTOR2D ToScreen(const VECTOR2D &aCoord, bool aAbsolute=true) const
Function ToScreen() Converts a world space point/vector to a point/vector in screen space coordinates...
Definition: view.cpp:494
std::vector< BUTTON_STATE * > m_buttons
State of mouse buttons.
#define max(a, b)
Definition: auxiliary.h:86
boost::optional< T > OPT
Definition: optional.h:7
T EuclideanNorm() const
Destructor.
Definition: vector2d.h:292
static const int DragTimeThreshold
The time threshold for a mouse button press that distinguishes between a single mouse click and a beg...
KIGFX::VIEW * getView()
Returns the instance of VIEW, used by the application.
TOOL_MANAGER * m_toolMgr
Instance of tool manager that cooperates with the dispatcher.

References TOOL_DISPATCHER::BUTTON_STATE::button, TOOL_DISPATCHER::BUTTON_STATE::dblClickEvent, decodeModifiers(), TOOL_DISPATCHER::BUTTON_STATE::downEvent, TOOL_DISPATCHER::BUTTON_STATE::downPosition, TOOL_DISPATCHER::BUTTON_STATE::downTimestamp, DragDistanceThreshold, TOOL_DISPATCHER::BUTTON_STATE::dragging, TOOL_DISPATCHER::BUTTON_STATE::dragMaxDelta, TOOL_DISPATCHER::BUTTON_STATE::dragOrigin, DragTimeThreshold, VECTOR2< T >::EuclideanNorm(), TOOL_DISPATCHER::BUTTON_STATE::GetState(), getView(), m_buttons, m_lastMousePos, m_toolMgr, max, TOOL_DISPATCHER::BUTTON_STATE::pressed, TOOL_MANAGER::ProcessEvent(), TA_MOUSE_CLICK, TA_MOUSE_DBLCLICK, TA_MOUSE_DOWN, TA_MOUSE_DRAG, TA_MOUSE_UP, TC_MOUSE, and KIGFX::VIEW::ToScreen().

Referenced by DispatchWxEvent().

◆ ResetState()

void TOOL_DISPATCHER::ResetState ( )
virtual

Function ResetState() Brings the dispatcher to its initial state.

Definition at line 141 of file tool_dispatcher.cpp.

142 {
143  for( BUTTON_STATE* st : m_buttons )
144  st->Reset();
145 }
std::vector< BUTTON_STATE * > m_buttons
State of mouse buttons.

References m_buttons.

Referenced by TOOL_DISPATCHER().

Member Data Documentation

◆ DragDistanceThreshold

const int TOOL_DISPATCHER::DragDistanceThreshold = 8
staticprivate

The distance threshold for mouse cursor that disinguishes between a single mouse click and a beginning of drag event (expressed in screen pixels).

Definition at line 96 of file tool_dispatcher.h.

Referenced by handleMouseButton().

◆ DragTimeThreshold

const int TOOL_DISPATCHER::DragTimeThreshold = 300
staticprivate

The time threshold for a mouse button press that distinguishes between a single mouse click and a beginning of drag event (expressed in milliseconds).

Definition at line 92 of file tool_dispatcher.h.

Referenced by handleMouseButton().

◆ m_actions

ACTIONS* TOOL_DISPATCHER::m_actions
private

Instance of an actions list that handles legacy action translation

Definition at line 134 of file tool_dispatcher.h.

Referenced by DispatchWxCommand().

◆ m_buttons

std::vector<BUTTON_STATE*> TOOL_DISPATCHER::m_buttons
private

State of mouse buttons.

Definition at line 125 of file tool_dispatcher.h.

Referenced by DispatchWxEvent(), handleMouseButton(), ResetState(), TOOL_DISPATCHER(), and ~TOOL_DISPATCHER().

◆ m_lastMousePos

VECTOR2D TOOL_DISPATCHER::m_lastMousePos
private

The last mouse cursor position (in world coordinates).

Definition at line 119 of file tool_dispatcher.h.

Referenced by DispatchWxEvent(), and handleMouseButton().

◆ m_toolMgr

TOOL_MANAGER* TOOL_DISPATCHER::m_toolMgr
private

Instance of tool manager that cooperates with the dispatcher.

Definition at line 131 of file tool_dispatcher.h.

Referenced by DispatchWxCommand(), DispatchWxEvent(), getView(), and handleMouseButton().

◆ MouseButtonCount

const int TOOL_DISPATCHER::MouseButtonCount = 3
staticprivate

Number of mouse buttons that is handled in events.

Definition at line 88 of file tool_dispatcher.h.


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