KiCad PCB EDA Suite
scintilla_tricks.cpp File Reference
#include <kicad_string.h>
#include <scintilla_tricks.h>
#include <wx/stc/stc.h>
#include <gal/color4d.h>
#include <dialog_shim.h>
#include <wx/clipbrd.h>
#include <wx/settings.h>
#include <confirm.h>

Go to the source code of this file.

Functions

bool isCtrlSlash (wxKeyEvent &aEvent)
 

Function Documentation

◆ isCtrlSlash()

bool isCtrlSlash ( wxKeyEvent &  aEvent)

Definition at line 72 of file scintilla_tricks.cpp.

73 {
74  if( !aEvent.ControlDown() || aEvent.MetaDown() )
75  return false;
76 
77  if( aEvent.GetUnicodeKey() == '/' )
78  return true;
79 
80  // OK, now the wxWidgets hacks start.
81  // (We should abandon these if https://trac.wxwidgets.org/ticket/18911 gets resolved.)
82 
83  // Many Latin America and European keyboars have have the / over the 7. We know that
84  // wxWidgets messes this up and returns Shift+7 through GetUnicodeKey(). However, other
85  // keyboards (such as France and Belgium) have 7 in the shifted position, so a Shift+7
86  // *could* be legitimate.
87 
88  // However, we *are* checking Ctrl, so to assume any Shift+7 is a Ctrl-/ really only
89  // disallows Ctrl+Shift+7 from doing something else, which is probably OK. (This routine
90  // is only used in the Scintilla editor, not in the rest of Kicad.)
91 
92  // The other main shifted loation of / is over : (France and Belgium), so we'll sacrifice
93  // Ctrl+Shift+: too.
94 
95  if( aEvent.ShiftDown() && ( aEvent.GetUnicodeKey() == '7' || aEvent.GetUnicodeKey() == ':' ) )
96  return true;
97 
98  // A few keyboards have / in an Alt position. Since we're expressly not checking Alt for
99  // up or down, those should work. However, if they don't, there's room below for yet
100  // another hack....
101 
102  return false;
103 }

Referenced by SCINTILLA_TRICKS::onCharHook().