KiCad PCB EDA Suite
tool_dispatcher.cpp File Reference
#include <macros.h>
#include <trace_helpers.h>
#include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h>
#include <tool/actions.h>
#include <view/view.h>
#include <view/wx_view_controls.h>
#include <class_draw_panel_gal.h>
#include <eda_draw_frame.h>
#include <pcbnew_id.h>
#include <core/optional.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)
 
int translateSpecialCode (int aKeyCode)
 

Function Documentation

◆ isKeyModifierOnly()

static bool isKeyModifierOnly ( int  aKeyCode)
static

Definition at line 281 of file tool_dispatcher.cpp.

282 {
283  const enum wxKeyCode special_keys[] =
284  {
285  WXK_CONTROL, WXK_RAW_CONTROL, WXK_SHIFT,WXK_ALT
286  };
287 
288  bool isInList = false;
289 
290  for( unsigned ii = 0; ii < arrayDim( special_keys ) && !isInList; ii++ )
291  {
292  if( special_keys[ii] == aKeyCode )
293  isInList = true;
294  }
295 
296  return isInList;
297 }
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108

References arrayDim().

Referenced by TOOL_DISPATCHER::DispatchWxEvent().

◆ isKeySpecialCode()

bool isKeySpecialCode ( int  aKeyCode)

Definition at line 257 of file tool_dispatcher.cpp.

258 {
259  // These keys have predefined actions (like move thumbtrack cursor),
260  // and we do not want these actions executed
261  const enum wxKeyCode special_keys[] =
262  {
263  WXK_PAGEUP, WXK_PAGEDOWN,
264  WXK_NUMPAD_PAGEUP, WXK_NUMPAD_PAGEDOWN
265  };
266 
267  bool isInList = false;
268 
269  for( unsigned ii = 0; ii < arrayDim( special_keys ) && !isInList; ii++ )
270  {
271  if( special_keys[ii] == aKeyCode )
272  isInList = true;
273  }
274 
275  return isInList;
276 }
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108

References arrayDim().

Referenced by TOOL_DISPATCHER::DispatchWxEvent().

◆ translateSpecialCode()

int translateSpecialCode ( int  aKeyCode)

Definition at line 311 of file tool_dispatcher.cpp.

312 {
313  switch( aKeyCode )
314  {
315  case WXK_NUMPAD_UP: return WXK_UP;
316  case WXK_NUMPAD_DOWN: return WXK_DOWN;
317  case WXK_NUMPAD_LEFT: return WXK_LEFT;
318  case WXK_NUMPAD_RIGHT: return WXK_RIGHT;
319  case WXK_NUMPAD_PAGEUP: return WXK_PAGEUP;
320  case WXK_NUMPAD_PAGEDOWN: return WXK_PAGEDOWN;
321  default: break;
322  };
323 
324  return aKeyCode;
325 }

Referenced by TOOL_DISPATCHER::DispatchWxEvent().