KiCad PCB EDA Suite
Loading...
Searching...
No Matches
tool_dispatcher.cpp File Reference
#include "tool/tool_dispatcher.h"
#include <bit>
#include <optional>
#include <wx/log.h>
#include <wx/stc/stc.h>
#include <wx/settings.h>
#include <core/ignore.h>
#include <macros.h>
#include <trace_helpers.h>
#include <tool/tool_manager.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 <kiplatform/app.h>
#include <kiplatform/ui.h>

Go to the source code of this file.

Classes

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

Functions

bool isKeySpecialCode (int aKeyCode)
 Helper to know if a special key ( see key list ) should be captured.
 
static bool isKeyModifierOnly (int aKeyCode)
 Helper to know if a key should be managed by DispatchWxEvent() or if the event can be ignored and skipped because the key is only a modifier that is not used alone in KiCad.
 
static bool isMouseClick (wxEventType type)
 
int translateSpecialCode (int aKeyCode)
 Convert some special key codes to an equivalent.
 

Function Documentation

◆ isKeyModifierOnly()

static bool isKeyModifierOnly ( int  aKeyCode)
static

Helper to know if a key should be managed by DispatchWxEvent() or if the event can be ignored and skipped because the key is only a modifier that is not used alone in KiCad.

Definition at line 296 of file tool_dispatcher.cpp.

References alg::contains().

Referenced by TOOL_DISPATCHER::GetToolEvent().

◆ isKeySpecialCode()

bool isKeySpecialCode ( int  aKeyCode)

Helper to know if a special key ( see key list ) should be captured.

If the event can be skipped on Linux, the event must be passed to the GUI if they are not used by KiCad, especially the wxEVENT_CHAR_HOOK, if it is not handled. Some keys have a predefined action in wxWidgets so, even if not used, the even will be not skipped the unused keys listed in isKeySpecialCode() will be not skipped.

Definition at line 278 of file tool_dispatcher.cpp.

References alg::contains().

Referenced by TOOL_DISPATCHER::GetToolEvent().

◆ isMouseClick()

static bool isMouseClick ( wxEventType  type)
static

Definition at line 307 of file tool_dispatcher.cpp.

Referenced by TOOL_DISPATCHER::DispatchWxEvent().

◆ translateSpecialCode()

int translateSpecialCode ( int  aKeyCode)

Convert some special key codes to an equivalent.

  • WXK_NUMPAD_UP to WXK_UP
  • WXK_NUMPAD_DOWN to WXK_DOWN
  • WXK_NUMPAD_LEFT to WXK_LEFT
  • WXK_NUMPAD_RIGHT to WXK_RIGHT
  • WXK_NUMPAD_PAGEUP to WXK_PAGEUP
  • WXK_NUMPAD_PAGEDOWN to WXK_PAGEDOWN
Note
wxEVT_CHAR_HOOK does this conversion when it is skipped by firing a wxEVT_CHAR with this converted code, but we do not skip these key events because they also have default action (scroll the panel).

Definition at line 331 of file tool_dispatcher.cpp.

Referenced by TOOL_DISPATCHER::GetToolEvent().