KiCad PCB EDA Suite
tool_dispatcher.cpp File Reference
#include <ignore.h>
#include <macros.h>
#include <trace_helpers.h>
#include <tool/tool_manager.h>
#include <tool/tools_holder.h>
#include <tool/tool_dispatcher.h>
#include <tool/actions.h>
#include <tool/action_manager.h>
#include <tool/action_menu.h>
#include <view/view.h>
#include <view/wx_view_controls.h>
#include <class_draw_panel_gal.h>
#include <eda_draw_frame.h>
#include <core/arraydim.h>
#include <core/optional.h>
#include <wx/log.h>
#include <wx/stc/stc.h>
#include <wx/settings.h>
#include <kiplatform/app.h>
#include <kiplatform/ui.h>

Go to the source code of this file.

Classes

struct  TOOL_DISPATCHER::BUTTON_STATE
 < Stores information about a mouse button state More...
 

Functions

bool isKeySpecialCode (int aKeyCode)
 
static bool isKeyModifierOnly (int aKeyCode)
 
static bool isMouseClick (wxEventType type)
 
int translateSpecialCode (int aKeyCode)
 

Function Documentation

◆ isKeyModifierOnly()

static bool isKeyModifierOnly ( int  aKeyCode)
static

Definition at line 293 of file tool_dispatcher.cpp.

294 {
295  const enum wxKeyCode special_keys[] =
296  {
297  WXK_CONTROL, WXK_RAW_CONTROL, WXK_SHIFT,WXK_ALT
298  };
299 
300  bool isInList = false;
301 
302  for( unsigned ii = 0; ii < arrayDim( special_keys ) && !isInList; ii++ )
303  {
304  if( special_keys[ii] == aKeyCode )
305  isInList = true;
306  }
307 
308  return isInList;
309 }
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31

References arrayDim().

Referenced by TOOL_DISPATCHER::GetToolEvent().

◆ isKeySpecialCode()

bool isKeySpecialCode ( int  aKeyCode)

Definition at line 268 of file tool_dispatcher.cpp.

269 {
270  // These keys have predefined actions (like move thumbtrack cursor),
271  // and we do not want these actions executed
272  const enum wxKeyCode special_keys[] =
273  {
274  WXK_PAGEUP, WXK_PAGEDOWN,
275  WXK_NUMPAD_PAGEUP, WXK_NUMPAD_PAGEDOWN
276  };
277 
278  bool isInList = false;
279 
280  for( unsigned ii = 0; ii < arrayDim( special_keys ) && !isInList; ii++ )
281  {
282  if( special_keys[ii] == aKeyCode )
283  isInList = true;
284  }
285 
286  return isInList;
287 }
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31

References arrayDim().

Referenced by TOOL_DISPATCHER::GetToolEvent().

◆ isMouseClick()

static bool isMouseClick ( wxEventType  type)
static

Definition at line 312 of file tool_dispatcher.cpp.

313 {
314  return type == wxEVT_LEFT_DOWN || type == wxEVT_LEFT_UP || type == wxEVT_MIDDLE_DOWN
315  || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_DOWN || type == wxEVT_RIGHT_UP
316  || type == wxEVT_LEFT_DCLICK || type == wxEVT_MIDDLE_DCLICK
317  || type == wxEVT_RIGHT_DCLICK;
318 }

Referenced by TOOL_DISPATCHER::DispatchWxEvent().

◆ translateSpecialCode()

int translateSpecialCode ( int  aKeyCode)

Definition at line 333 of file tool_dispatcher.cpp.

334 {
335  switch( aKeyCode )
336  {
337  case WXK_NUMPAD_UP: return WXK_UP;
338  case WXK_NUMPAD_DOWN: return WXK_DOWN;
339  case WXK_NUMPAD_LEFT: return WXK_LEFT;
340  case WXK_NUMPAD_RIGHT: return WXK_RIGHT;
341  case WXK_NUMPAD_PAGEUP: return WXK_PAGEUP;
342  case WXK_NUMPAD_PAGEDOWN: return WXK_PAGEDOWN;
343  default: break;
344  };
345 
346  return aKeyCode;
347 }

Referenced by TOOL_DISPATCHER::GetToolEvent().