]>
git.saurik.com Git - wxWidgets.git/blob - contrib/src/stc/scintilla/src/KeyMap.cxx
9ab9694df15b9b99d9ec18a45d571c92950c925d
1 // Scintilla source code edit control
2 // KeyMap.cxx - defines a mapping between keystrokes and commands
3 // Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
4 // The License.txt file describes the conditions under which this software may be distributed.
12 KeyMap::KeyMap() : kmap(0), len(0), alloc(0) {
13 for (int i
= 0; MapDefault
[i
].key
; i
++) {
14 AssignCmdKey(MapDefault
[i
].key
,
15 MapDefault
[i
].modifiers
,
24 void KeyMap::Clear() {
31 void KeyMap::AssignCmdKey(int key
, int modifiers
, UINT msg
) {
32 if ((len
+1) >= alloc
) {
33 KeyToCommand
*ktcNew
= new KeyToCommand
[alloc
+ 5];
36 for (int k
=0;k
<len
;k
++)
42 for (int keyIndex
= 0; keyIndex
< len
; keyIndex
++) {
43 if ((key
== kmap
[keyIndex
].key
) && (modifiers
== kmap
[keyIndex
].modifiers
)) {
44 kmap
[keyIndex
].msg
= msg
;
49 kmap
[len
].modifiers
= modifiers
;
54 UINT
KeyMap::Find(int key
, int modifiers
) {
55 for (int i
=0; i
< len
; i
++) {
56 if ((key
== kmap
[i
].key
) && (modifiers
== kmap
[i
].modifiers
)) {
63 KeyToCommand
KeyMap::MapDefault
[] = {
64 VK_DOWN
, SCI_NORM
, SCI_LINEDOWN
,
65 VK_DOWN
, SCI_SHIFT
, SCI_LINEDOWNEXTEND
,
66 VK_UP
, SCI_NORM
, SCI_LINEUP
,
67 VK_UP
, SCI_SHIFT
, SCI_LINEUPEXTEND
,
68 VK_LEFT
, SCI_NORM
, SCI_CHARLEFT
,
69 VK_LEFT
, SCI_SHIFT
, SCI_CHARLEFTEXTEND
,
70 VK_LEFT
, SCI_CTRL
, SCI_WORDLEFT
,
71 VK_LEFT
, SCI_CSHIFT
, SCI_WORDLEFTEXTEND
,
72 VK_RIGHT
, SCI_NORM
, SCI_CHARRIGHT
,
73 VK_RIGHT
, SCI_SHIFT
, SCI_CHARRIGHTEXTEND
,
74 VK_RIGHT
, SCI_CTRL
, SCI_WORDRIGHT
,
75 VK_RIGHT
, SCI_CSHIFT
, SCI_WORDRIGHTEXTEND
,
76 VK_HOME
, SCI_NORM
, SCI_VCHOME
,
77 VK_HOME
, SCI_SHIFT
, SCI_VCHOMEEXTEND
,
78 VK_HOME
, SCI_CTRL
, SCI_DOCUMENTSTART
,
79 VK_HOME
, SCI_CSHIFT
, SCI_DOCUMENTSTARTEXTEND
,
80 VK_END
, SCI_NORM
, SCI_LINEEND
,
81 VK_END
, SCI_SHIFT
, SCI_LINEENDEXTEND
,
82 VK_END
, SCI_CTRL
, SCI_DOCUMENTEND
,
83 VK_END
, SCI_CSHIFT
, SCI_DOCUMENTENDEXTEND
,
84 VK_PRIOR
, SCI_NORM
, SCI_PAGEUP
,
85 VK_PRIOR
, SCI_SHIFT
, SCI_PAGEUPEXTEND
,
86 VK_NEXT
, SCI_NORM
, SCI_PAGEDOWN
,
87 VK_NEXT
, SCI_SHIFT
, SCI_PAGEDOWNEXTEND
,
88 VK_DELETE
, SCI_NORM
, WM_CLEAR
,
89 VK_DELETE
, SCI_SHIFT
, WM_CUT
,
90 VK_DELETE
, SCI_CTRL
, SCI_DELWORDRIGHT
,
91 VK_INSERT
, SCI_NORM
, SCI_EDITTOGGLEOVERTYPE
,
92 VK_INSERT
, SCI_SHIFT
, WM_PASTE
,
93 VK_INSERT
, SCI_CTRL
, WM_COPY
,
94 VK_ESCAPE
, SCI_NORM
, SCI_CANCEL
,
95 VK_BACK
, SCI_NORM
, SCI_DELETEBACK
,
96 VK_BACK
, SCI_CTRL
, SCI_DELWORDLEFT
,
97 'Z', SCI_CTRL
, WM_UNDO
,
98 'Y', SCI_CTRL
, SCI_REDO
,
99 'X', SCI_CTRL
, WM_CUT
,
100 'C', SCI_CTRL
, WM_COPY
,
101 'V', SCI_CTRL
, WM_PASTE
,
102 'A', SCI_CTRL
, SCI_SELECTALL
,
103 VK_TAB
, SCI_NORM
, SCI_TAB
,
104 VK_TAB
, SCI_SHIFT
, SCI_BACKTAB
,
105 VK_RETURN
, SCI_NORM
, SCI_NEWLINE
,
106 VK_ADD
, SCI_CTRL
, SCI_ZOOMIN
,
107 VK_SUBTRACT
, SCI_CTRL
, SCI_ZOOMOUT
,
108 //'L', SCI_CTRL, SCI_FORMFEED,
109 'L', SCI_CTRL
, SCI_LINECUT
,
110 'L', SCI_CSHIFT
, SCI_LINEDELETE
,
111 'T', SCI_CTRL
, SCI_LINETRANSPOSE
,
112 'U', SCI_CTRL
, SCI_LOWERCASE
,
113 'U', SCI_CSHIFT
, SCI_UPPERCASE
,