KiCad PCB EDA Suite
tool_dispatcher.cpp File Reference
#include <pcb_edit_frame.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 <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)
 
int translateSpecialCode (int aKeyCode)
 

Function Documentation

bool isKeySpecialCode ( int  aKeyCode)

Definition at line 259 of file tool_dispatcher.cpp.

References DIM.

Referenced by TOOL_DISPATCHER::DispatchWxEvent().

260 {
261  const enum wxKeyCode special_keys[] =
262  {
263  WXK_UP, WXK_DOWN, WXK_LEFT, WXK_RIGHT,
264  WXK_PAGEUP, WXK_PAGEDOWN,
265  WXK_NUMPAD_UP, WXK_NUMPAD_DOWN, WXK_NUMPAD_LEFT, WXK_NUMPAD_RIGHT,
266  WXK_NUMPAD_PAGEUP, WXK_NUMPAD_PAGEDOWN
267  };
268 
269  bool isInList = false;
270 
271  for( unsigned ii = 0; ii < DIM( special_keys ) && !isInList; ii++ )
272  {
273  if( special_keys[ii] == aKeyCode )
274  isInList = true;
275  }
276 
277  return isInList;
278 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
int translateSpecialCode ( int  aKeyCode)

Definition at line 293 of file tool_dispatcher.cpp.

Referenced by TOOL_DISPATCHER::DispatchWxEvent().

294 {
295  switch( aKeyCode )
296  {
297  case WXK_NUMPAD_UP: return WXK_UP;
298  case WXK_NUMPAD_DOWN: return WXK_DOWN;
299  case WXK_NUMPAD_LEFT: return WXK_LEFT;
300  case WXK_NUMPAD_RIGHT: return WXK_RIGHT;
301  case WXK_NUMPAD_PAGEUP: return WXK_PAGEUP;
302  case WXK_NUMPAD_PAGEDOWN: return WXK_PAGEDOWN;
303  default: break;
304  };
305 
306  return aKeyCode;
307 }