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/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 <eda_draw_frame.h>
#include <core/kicad_algo.h>
#include <optional>
#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 290 of file tool_dispatcher.cpp.

291{
292 static std::vector<enum wxKeyCode> special_keys =
293 {
294 WXK_CONTROL, WXK_RAW_CONTROL, WXK_SHIFT, WXK_ALT
295 };
296
297 return alg::contains( special_keys, aKeyCode );
298}
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:99

References alg::contains().

Referenced by TOOL_DISPATCHER::GetToolEvent().

◆ isKeySpecialCode()

bool isKeySpecialCode ( int  aKeyCode)

Definition at line 273 of file tool_dispatcher.cpp.

274{
275 // These keys have predefined actions (like move thumbtrack cursor),
276 // and we do not want these actions executed
277 const std::vector<enum wxKeyCode> special_keys =
278 {
279 WXK_PAGEUP, WXK_PAGEDOWN,
280 WXK_NUMPAD_PAGEUP, WXK_NUMPAD_PAGEDOWN
281 };
282
283 return alg::contains( special_keys, aKeyCode );
284}

References alg::contains().

Referenced by TOOL_DISPATCHER::GetToolEvent().

◆ isMouseClick()

static bool isMouseClick ( wxEventType  type)
static

Definition at line 301 of file tool_dispatcher.cpp.

302{
303 return type == wxEVT_LEFT_DOWN || type == wxEVT_LEFT_UP || type == wxEVT_LEFT_DCLICK
304 || type == wxEVT_MIDDLE_DOWN || type == wxEVT_MIDDLE_UP || type == wxEVT_MIDDLE_DCLICK
305 || type == wxEVT_RIGHT_DOWN || type == wxEVT_RIGHT_UP || type == wxEVT_RIGHT_DCLICK
306 || type == wxEVT_AUX1_DOWN || type == wxEVT_AUX1_UP || type == wxEVT_AUX1_DCLICK
307 || type == wxEVT_AUX2_DOWN || type == wxEVT_AUX2_UP || type == wxEVT_AUX2_DCLICK;
308}

Referenced by TOOL_DISPATCHER::DispatchWxEvent().

◆ translateSpecialCode()

int translateSpecialCode ( int  aKeyCode)

Definition at line 323 of file tool_dispatcher.cpp.

324{
325 switch( aKeyCode )
326 {
327 case WXK_NUMPAD_UP: return WXK_UP;
328 case WXK_NUMPAD_DOWN: return WXK_DOWN;
329 case WXK_NUMPAD_LEFT: return WXK_LEFT;
330 case WXK_NUMPAD_RIGHT: return WXK_RIGHT;
331 case WXK_NUMPAD_PAGEUP: return WXK_PAGEUP;
332 case WXK_NUMPAD_PAGEDOWN: return WXK_PAGEDOWN;
333 default: break;
334 };
335
336 return aKeyCode;
337}

Referenced by TOOL_DISPATCHER::GetToolEvent().