KiCad PCB EDA Suite
tool_dispatcher.cpp File Reference
#include <wxPcbStruct.h>
#include <wxBasePcbFrame.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 <boost/optional.hpp>

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 257 of file tool_dispatcher.cpp.

References DIM.

Referenced by TOOL_DISPATCHER::DispatchWxEvent().

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

Definition at line 290 of file tool_dispatcher.cpp.

Referenced by TOOL_DISPATCHER::DispatchWxEvent().

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