• R/O
  • HTTP
  • SSH
  • HTTPS

xkeymacs: Commit


Commit MetaInfo

Revision48deba580a62aa2e5ad345804b3a8ce3dba5946e (tree)
Time2011-11-02 20:31:05
AuthorKazuhiro Fujieda <fujieda@user...>
CommiterKazuhiro Fujieda

Log Message

Add KeyString class for conversion from a modifier and a key code to
a string and the opposite. Modify related code.

Change Summary

Incremental Difference

--- /dev/null
+++ b/xkeymacs/KeyString.cpp
@@ -0,0 +1,308 @@
1+#include "KeyString.h"
2+#include "../xkeymacsdll/defs.h"
3+
4+static const struct {
5+ UINT Type;
6+ LPCTSTR Name;
7+} Types[] = {
8+ {CONTROLX, _T("Ctrl+X ")},
9+ {CONTROL, _T("Ctrl+")},
10+ {META, _T("Meta+")},
11+ {SHIFT, _T("Shift+")},
12+};
13+
14+static LPCSTR Keys[] = {
15+ _T(""), // 0
16+ _T("Left mouse button"), // VK_LBUTTON
17+ _T("Right mouse button"), // VK_RBUTTON
18+ _T("Break"), // VK_CANCEL
19+ _T("Middle mouse button"), // VK_MBUTTON
20+ _T("X1 mouse button"), // VK_XBUTTON1
21+ _T("X2 mouse button"), // VK_XBUTTON2
22+ _T("Undefined"), // 0x07
23+ _T("Backspace"), // VK_BACK
24+ _T("Tab"), // VK_TAB
25+ _T("Reserved"), // 0x0a
26+ _T("Reserved"), // 0x0b
27+ _T("Clear"), // VK_CLEAR
28+ _T("Enter"), // VK_RETURN
29+ _T("Undefined"), // 0x0e
30+ _T("Undefined"), // 0x0f
31+ _T("Shift"), // VK_SHIFT
32+ _T("Ctrl"), // VK_CONTROL
33+ _T("Alt"), // VK_MENU
34+ _T("Pause"), // VK_PAUSE
35+ _T("Caps Lock"), // VK_CAPITAL
36+ _T("Kana"), // VK_KANA {VK_HANGUEL, "Hanguel"}, {VK_HANGUL, "Hangul"}
37+ _T("Undefined"), // 0x16
38+ _T("Junja"), // VK_JUNJA
39+ _T("Final"), // VK_FINAL
40+ _T("Kanji"), //VK_KANJI {VK_HANJA, "Hanja"}
41+ _T("Undefined"), // 0x1a
42+ _T("Esc"), // VK_ESCAPE
43+ _T("Convert"), // VK_CONVERT 変換
44+ _T("Nonconvert"), // VK_NONCONVERT 無変換
45+ _T("Accept"), // VK_ACCEPT
46+ _T("Mode change"), // VK_MODECHANGE
47+ _T("Space"), // VK_SPACE
48+ _T("Page Up"), // VK_PRIOR
49+ _T("Page Down"), // VK_NEXT
50+ _T("End"), // VK_END
51+ _T("Home"), // VK_HOME
52+ _T("Left"), // VK_LEFT
53+ _T("Up"), // VK_UP
54+ _T("Right"), // VK_RIGHT
55+ _T("Down"), // VK_DOWN
56+ _T("Select"), // VK_SELECT
57+ _T("Print"), // VK_PRINT
58+ _T("Execute"), // VK_EXECUTE
59+ _T("Print Screen"), // VK_SNAPSHOT
60+ _T("Ins"), // VK_INSERT
61+ _T("Del"), // VK_DELETE
62+ _T("Help"), // VK_HELP
63+ _T("0"), // '0'
64+ _T("1"), // '1'
65+ _T("2"), // '2'
66+ _T("3"), // '3'
67+ _T("4"), // '4'
68+ _T("5"), // '5'
69+ _T("6"), // '6'
70+ _T("7"), // '7'
71+ _T("8"), // '8'
72+ _T("9"), // '9'
73+ _T("Undefined"), // 0x3a
74+ _T("Undefined"), // 0x3b
75+ _T("Undefined"), // 0x3c
76+ _T("Undefined"), // 0x3d
77+ _T("Undefined"), // 0x3e
78+ _T("Undefined"), // 0x3f
79+ _T("Undefined"), // 0x40
80+ _T("A"), // 'A'
81+ _T("B"), // 'B'
82+ _T("C"), // 'C'
83+ _T("D"), // 'D'
84+ _T("E"), // 'E'
85+ _T("F"), // 'F'
86+ _T("G"), // 'G'
87+ _T("H"), // 'H'
88+ _T("I"), // 'I'
89+ _T("J"), // 'J'
90+ _T("K"), // 'K'
91+ _T("L"), // 'L'
92+ _T("M"), // 'M'
93+ _T("N"), // 'N'
94+ _T("O"), // 'O'
95+ _T("P"), // 'P'
96+ _T("Q"), // 'Q'
97+ _T("R"), // 'R'
98+ _T("S"), // 'S'
99+ _T("T"), // 'T'
100+ _T("U"), // 'U'
101+ _T("V"), // 'V'
102+ _T("W"), // 'W'
103+ _T("X"), // 'X'
104+ _T("Y"), // 'Y'
105+ _T("Z"), // 'Z'
106+ _T("Left Windows"), // VK_LWIN
107+ _T("Right Windows"), // VK_RWIN
108+ _T("Application"), // VK_APPS
109+ _T("Reserved"), // 0x5e
110+ _T("Sleep"), // VK_SLEEP
111+ _T("Num 0"), // VK_NUMPAD0
112+ _T("Num 1"), // VK_NUMPAD1
113+ _T("Num 2"), // VK_NUMPAD2
114+ _T("Num 3"), // VK_NUMPAD3
115+ _T("Num 4"), // VK_NUMPAD4
116+ _T("Num 5"), // VK_NUMPAD5
117+ _T("Num 6"), // VK_NUMPAD6
118+ _T("Num 7"), // VK_NUMPAD7
119+ _T("Num 8"), // VK_NUMPAD8
120+ _T("Num 9"), // VK_NUMPAD9
121+ _T("Num *"), // VK_MULTIPLY
122+ _T("Num +"), // VK_ADD
123+ _T("Separator"), // VK_SEPARATOR
124+ _T("Num -"), // VK_SUBTRACT
125+ _T("Num ."), // VK_DECIMAL
126+ _T("Num /"), // VK_DIVIDE
127+ _T("F1"), // VK_F1
128+ _T("F2"), // VK_F2
129+ _T("F3"), // VK_F3
130+ _T("F4"), // VK_F4
131+ _T("F5"), // VK_F5
132+ _T("F6"), // VK_F6
133+ _T("F7"), // VK_F7
134+ _T("F8"), // VK_F8
135+ _T("F9"), // VK_F9
136+ _T("F10"), // VK_F10
137+ _T("F11"), // VK_F11
138+ _T("F12"), // VK_F12
139+ _T("F13"), // VK_F13
140+ _T("F14"), // VK_F14
141+ _T("F15"), // VK_F15
142+ _T("F16"), // VK_F16
143+ _T("F17"), // VK_F17
144+ _T("F18"), // VK_F18
145+ _T("F19"), // VK_F19
146+ _T("F20"), // VK_F20
147+ _T("F21"), // VK_F21
148+ _T("F22"), // VK_F22
149+ _T("F23"), // VK_F23
150+ _T("F24"), // VK_F24
151+ _T("Unassigned"), // 0x88
152+ _T("Unassigned"), // 0x89
153+ _T("Unassigned"), // 0x8a
154+ _T("Unassigned"), // 0x8b
155+ _T("Unassigned"), // 0x8c
156+ _T("Unassigned"), // 0x8d
157+ _T("Unassigned"), // 0x8e
158+ _T("Unassigned"), // 0x8f
159+ _T("Num Lock"), // VK_NUMLOCK
160+ _T("Scroll Lock"), // VK_SCROLL
161+ _T("OEM specific"), // 0x92
162+ _T("OEM specific"), // 0x93
163+ _T("OEM specific"), // 0x94
164+ _T("OEM specific"), // 0x95
165+ _T("OEM specific"), // 0x96
166+ _T("Unassigned"), // 0x97
167+ _T("Unassigned"), // 0x98
168+ _T("Unassigned"), // 0x99
169+ _T("Unassigned"), // 0x9a
170+ _T("Unassigned"), // 0x9b
171+ _T("Unassigned"), // 0x9c
172+ _T("Unassigned"), // 0x9d
173+ _T("Unassigned"), // 0x9e
174+ _T("Unassigned"), // 0x9f
175+ _T("Left Shift"), // VK_LSHIFT
176+ _T("Right Shift"), // VK_RSHIFT
177+ _T("Left Ctrl"), // VK_LCONTROL
178+ _T("Right Ctrl"), // VK_RCONTROL
179+ _T("Left Alt"), // VK_LMENU
180+ _T("Right Alt"), // VK_RMENU
181+ _T("Browser Back"), // VK_BROWSER_BACK
182+ _T("Browser Forward"), // VK_BROWSER_FORWARD
183+ _T("Browser Refresh"), // VK_BROWSER_REFRESH
184+ _T("Browser Stop"), // VK_BROWSER_STOP
185+ _T("Browser Search"), // VK_BROWSER_SEARCH
186+ _T("Browser Favorites"), // VK_BROWSER_FAVORITES
187+ _T("Browser Start"), // VK_BROWSER_HOME
188+ _T("Volume Mute"), // VK_VOLUME_MUTE
189+ _T("Volume Down"), // VK_VOLUME_DOWN
190+ _T("Volume Up"), // VK_VOLUME_UP
191+ _T("Next Track"), // VK_MEDIA_NEXT_TRACK
192+ _T("Previous Track"), // VK_MEDIA_PREV_TRACK
193+ _T("Stop Media"), // VK_MEDIA_STOP
194+ _T("Play/Pause Media"), // VK_MEDIA_PLAY_PAUSE
195+ _T("Start Mail"), // VK_LAUNCH_MAIL
196+ _T("Select Media"), // VK_LAUNCH_MEDIA_SELECT
197+ _T("Start Application 1"), // VK_LAUNCH_APP1
198+ _T("Start Application 2"), // VK_LAUNCH_APP2
199+ _T("Reserved"), // 0xb8
200+ _T("Reserved"), // 0xb9
201+ _T(";"), // VK_OEM_1 _T(":") for Japanese keyboard
202+ _T("+"), // VK_OEM_PLUS _T(";") for Japanese keyboard
203+ _T(","), // VK_OEM_COMMA
204+ _T("-"), // VK_OEM_MINUS
205+ _T("."), // VK_OEM_PERIOD
206+ _T("/"), // VK_OEM_2
207+ _T("`"), // VK_OEM_3 _T("@") for Japanese keyboard
208+ _T("Reserved"), // 0xc1
209+ _T("Reserved"), // 0xc2
210+ _T("Reserved"), // 0xc3
211+ _T("Reserved"), // 0xc4
212+ _T("Reserved"), // 0xc5
213+ _T("Reserved"), // 0xc6
214+ _T("Reserved"), // 0xc7
215+ _T("Reserved"), // 0xc8
216+ _T("Reserved"), // 0xc9
217+ _T("Reserved"), // 0xca
218+ _T("Reserved"), // 0xcb
219+ _T("Reserved"), // 0xcc
220+ _T("Reserved"), // 0xcd
221+ _T("Reserved"), // 0xce
222+ _T("Reserved"), // 0xcf
223+ _T("Reserved"), // 0xd0
224+ _T("Reserved"), // 0xd1
225+ _T("Reserved"), // 0xd2
226+ _T("Reserved"), // 0xd3
227+ _T("Reserved"), // 0xd4
228+ _T("Reserved"), // 0xd5
229+ _T("Reserved"), // 0xd6
230+ _T("Reserved"), // 0xd7
231+ _T("Unassigned"), // 0xd8
232+ _T("Unassigned"), // 0xd9
233+ _T("Unassigned"), // 0xda
234+ _T("["), // VK_OEM_4
235+ _T("Backslash"), // VK_OEM_5
236+ _T("]"), // VK_OEM_6
237+ _T("'"), // VK_OEM_7
238+ _T("OEM specific"), // VK_OEM_8
239+ _T("Reserved"), // 0xe0
240+ _T("OEM specific"), // 0xe1
241+ _T("Backslash for 106 keyboard"), // VK_OEM_102
242+ _T("OEM specific"), // 0xe3
243+ _T("OEM specific"), // 0xe4
244+ _T("Process"), // VK_PROCESSKEY
245+ _T("OEM specific"), // 0xe6
246+ _T("Packet"), // VK_PACKET
247+ _T("Unassigned"), // 0xe8
248+ _T("OEM specific"), // 0xe9
249+ _T("OEM specific"), // 0xea
250+ _T("OEM specific"), // 0xeb
251+ _T("OEM specific"), // 0xec
252+ _T("OEM specific"), // 0xed
253+ _T("OEM specific"), // 0xee
254+ _T("OEM specific"), // 0xef
255+ _T("Eisu"), // 0xf0 // 英数
256+ _T("OEM specific"), // 0xf1
257+ _T("Hiragana"), // 0xf2 ひらがな
258+ _T("Hankaku/Zenkaku 0xf3"), // 0xf3 "半角/全角"
259+ _T("Hankaku/Zenkaku 0xf4"), // 0xf4 "半角/全角"
260+ _T("OEM specific"), // 0xf5
261+ _T("Attn"), // VK_ATTN
262+ _T("CrSel"), // VK_CRSEL
263+ _T("ExSel"), // VK_EXSEL
264+ _T("Erace EOF"), // VK_EREOF
265+ _T("Play"), // VK_PLAY
266+ _T("Zoom"), // VK_ZOOM
267+ _T("Noname"), // VK_NONAME
268+ _T("PA1"), // VK_PA1
269+ _T("OEM Clear"), // VK_OEM_CLEAR
270+ _T("Fn"), // 0xff
271+};
272+
273+KeyString::KeyString(bool is106Keyboard)
274+{
275+ if (!is106Keyboard)
276+ return;
277+ Keys[0xba] = _T(":");
278+ Keys[0xbb] = _T(";");
279+ Keys[0xc0] = _T("@");
280+ Keys[0xde] = _T("^");
281+}
282+
283+CString KeyString::ToString(int type, int key)
284+{
285+ CString str;
286+ for (int i = 0; i < _countof(Types); ++i)
287+ if ((type & Types[i].Type) != 0)
288+ str += Types[i].Name;
289+ str += Keys[key];
290+ return str;
291+}
292+
293+void KeyString::ToKey(LPCTSTR str, int& type, int& key)
294+{
295+ CString s(str);
296+ type = NONE;
297+ for (int i = 0; i < _countof(Types); ++i)
298+ if (s.Find(Types[i].Name) == 0) {
299+ type |= Types[i].Type;
300+ s.Delete(0, static_cast<int>(_tcslen(Types[i].Name)));
301+ }
302+ key = 0;
303+ for (int i = 1; i < 256; ++i)
304+ if (s == Keys[i]) {
305+ key = i;
306+ break;
307+ }
308+}
--- /dev/null
+++ b/xkeymacs/KeyString.h
@@ -0,0 +1,11 @@
1+#pragma once
2+#include "stdafx.h"
3+
4+class KeyString
5+{
6+public:
7+ KeyString(bool is106Keyboard);
8+ CString ToString(int type, int key);
9+ void ToKey(LPCTSTR str, int& type, int& key);
10+};
11+
--- a/xkeymacs/profile.cpp
+++ b/xkeymacs/profile.cpp
@@ -17,297 +17,11 @@ static char THIS_FILE[]=__FILE__;
1717 #define new DEBUG_NEW
1818 #endif
1919
20-struct CommandTypeName
21-{
22- int nType;
23- LPCTSTR szName;
24-};
25-
26-static const CommandTypeName CommandTypes[] = {
27- {NONE, _T("")},
28- {SHIFT, _T("Shift+")},
29- {CONTROL, _T("Ctrl+")},
30- {CONTROL+SHIFT, _T("Ctrl+Shift+")},
31- {META, _T("Meta+")},
32- {META+SHIFT, _T("Meta+Shift+")},
33- {CONTROL+META, _T("Ctrl+Meta+")},
34- {CONTROL+META+SHIFT, _T("Ctrl+Meta+Shift+")},
35- {CONTROLX+NONE, _T("Ctrl+X ")},
36- {CONTROLX+SHIFT, _T("Ctrl+X Shift+")},
37- {CONTROLX+CONTROL, _T("Ctrl+X Ctrl+")},
38- {CONTROLX+CONTROL+SHIFT, _T("Ctrl+X Ctrl+Shift+")},
39- {CONTROLX+META, _T("Ctrl+X Meta+")},
40- {CONTROLX+META+SHIFT, _T("Ctrl+X Meta+Shift+")},
41- {CONTROLX+CONTROL+META, _T("Ctrl+X Ctrl+Meta+")},
42- {CONTROLX+CONTROL+META+SHIFT, _T("Ctrl+X Ctrl+Meta+Shift+")},
43-};
44-
45-static const KeyName KeyNames[] = {
46- {0, _T("")},
47- {VK_LBUTTON, _T("Left mouse button")},
48- {VK_RBUTTON, _T("Right mouse button")},
49- {VK_CANCEL, _T("Break")},
50- {VK_MBUTTON, _T("Middle mouse button")},
51- {0x05, _T("X1 mouse button")}, // VK_XBUTTON1
52- {0x06, _T("X2 mouse button")}, // VK_XBUTTON2
53- {0x07, _T("Undefined")},
54- {VK_BACK, _T("Backspace")},
55- {VK_TAB, _T("Tab")},
56- {0x0a, _T("Reserved")},
57- {0x0b, _T("Reserved")},
58- {VK_CLEAR, _T("Clear")},
59- {VK_RETURN, _T("Enter")},
60- {0x0e, _T("Undefined")},
61- {0x0f, _T("Undefined")},
62- {VK_SHIFT, _T("Shift")},
63- {VK_CONTROL, _T("Ctrl")},
64- {VK_MENU, _T("Alt")},
65- {VK_PAUSE, _T("Pause")},
66- {VK_CAPITAL, _T("Caps Lock")},
67- {VK_KANA, _T("Kana")}, // {VK_HANGUEL, "Hanguel"}, {VK_HANGUL, "Hangul"},
68- {0x16, _T("Undefined")},
69- {VK_JUNJA, _T("Junja")},
70- {VK_FINAL, _T("Final")},
71- {VK_KANJI, _T("Kanji")}, // {VK_HANJA, "Hanja"},
72- {0x1a, _T("Undefined")},
73- {VK_ESCAPE, _T("Esc")},
74- {VK_CONVERT, _T("Convert")}, // 変換
75- {VK_NONCONVERT, _T("Nonconvert")}, // 無変換
76- {VK_ACCEPT, _T("Accept")},
77- {VK_MODECHANGE, _T("Mode change")},
78- {VK_SPACE, _T("Space")},
79- {VK_PRIOR, _T("Page Up")},
80- {VK_NEXT, _T("Page Down")},
81- {VK_END, _T("End")},
82- {VK_HOME, _T("Home")},
83- {VK_LEFT, _T("Left")},
84- {VK_UP, _T("Up")},
85- {VK_RIGHT, _T("Right")},
86- {VK_DOWN, _T("Down")},
87- {VK_SELECT, _T("Select")},
88- {VK_PRINT, _T("Print")},
89- {VK_EXECUTE, _T("Execute")},
90- {VK_SNAPSHOT, _T("Print Screen")},
91- {VK_INSERT, _T("Ins")},
92- {VK_DELETE, _T("Del")},
93- {VK_HELP, _T("Help")},
94- {'0', _T("0")},
95- {'1', _T("1")},
96- {'2', _T("2")},
97- {'3', _T("3")},
98- {'4', _T("4")},
99- {'5', _T("5")},
100- {'6', _T("6")},
101- {'7', _T("7")},
102- {'8', _T("8")},
103- {'9', _T("9")},
104- {0x3a, _T("Undefined")},
105- {0x3b, _T("Undefined")},
106- {0x3c, _T("Undefined")},
107- {0x3d, _T("Undefined")},
108- {0x3e, _T("Undefined")},
109- {0x3f, _T("Undefined")},
110- {0x40, _T("Undefined")},
111- {'A', _T("A")},
112- {'B', _T("B")},
113- {'C', _T("C")},
114- {'D', _T("D")},
115- {'E', _T("E")},
116- {'F', _T("F")},
117- {'G', _T("G")},
118- {'H', _T("H")},
119- {'I', _T("I")},
120- {'J', _T("J")},
121- {'K', _T("K")},
122- {'L', _T("L")},
123- {'M', _T("M")},
124- {'N', _T("N")},
125- {'O', _T("O")},
126- {'P', _T("P")},
127- {'Q', _T("Q")},
128- {'R', _T("R")},
129- {'S', _T("S")},
130- {'T', _T("T")},
131- {'U', _T("U")},
132- {'V', _T("V")},
133- {'W', _T("W")},
134- {'X', _T("X")},
135- {'Y', _T("Y")},
136- {'Z', _T("Z")},
137- {VK_LWIN, _T("Left Windows")},
138- {VK_RWIN, _T("Right Windows")},
139- {VK_APPS, _T("Application")},
140- {0x5e, _T("Reserved")},
141- {0x5f, _T("Sleep")}, // VK_SLEEP
142- {VK_NUMPAD0, _T("Num 0")},
143- {VK_NUMPAD1, _T("Num 1")},
144- {VK_NUMPAD2, _T("Num 2")},
145- {VK_NUMPAD3, _T("Num 3")},
146- {VK_NUMPAD4, _T("Num 4")},
147- {VK_NUMPAD5, _T("Num 5")},
148- {VK_NUMPAD6, _T("Num 6")},
149- {VK_NUMPAD7, _T("Num 7")},
150- {VK_NUMPAD8, _T("Num 8")},
151- {VK_NUMPAD9, _T("Num 9")},
152- {VK_MULTIPLY, _T("Num *")},
153- {VK_ADD, _T("Num +")},
154- {VK_SEPARATOR, _T("Separator")},
155- {VK_SUBTRACT, _T("Num -")},
156- {VK_DECIMAL, _T("Num .")},
157- {VK_DIVIDE, _T("Num /")},
158- {VK_F1, _T("F1")},
159- {VK_F2, _T("F2")},
160- {VK_F3, _T("F3")},
161- {VK_F4, _T("F4")},
162- {VK_F5, _T("F5")},
163- {VK_F6, _T("F6")},
164- {VK_F7, _T("F7")},
165- {VK_F8, _T("F8")},
166- {VK_F9, _T("F9")},
167- {VK_F10, _T("F10")},
168- {VK_F11, _T("F11")},
169- {VK_F12, _T("F12")},
170- {VK_F13, _T("F13")},
171- {VK_F14, _T("F14")},
172- {VK_F15, _T("F15")},
173- {VK_F16, _T("F16")},
174- {VK_F17, _T("F17")},
175- {VK_F18, _T("F18")},
176- {VK_F19, _T("F19")},
177- {VK_F20, _T("F20")},
178- {VK_F21, _T("F21")},
179- {VK_F22, _T("F22")},
180- {VK_F23, _T("F23")},
181- {VK_F24, _T("F24")},
182- {0x88, _T("Unassigned")},
183- {0x89, _T("Unassigned")},
184- {0x8a, _T("Unassigned")},
185- {0x8b, _T("Unassigned")},
186- {0x8c, _T("Unassigned")},
187- {0x8d, _T("Unassigned")},
188- {0x8e, _T("Unassigned")},
189- {0x8f, _T("Unassigned")},
190- {VK_NUMLOCK, _T("Num Lock")},
191- {VK_SCROLL, _T("Scroll Lock")},
192- {0x92, _T("OEM specific")},
193- {0x93, _T("OEM specific")},
194- {0x94, _T("OEM specific")},
195- {0x95, _T("OEM specific")},
196- {0x96, _T("OEM specific")},
197- {0x97, _T("Unassigned")},
198- {0x98, _T("Unassigned")},
199- {0x99, _T("Unassigned")},
200- {0x9a, _T("Unassigned")},
201- {0x9b, _T("Unassigned")},
202- {0x9c, _T("Unassigned")},
203- {0x9d, _T("Unassigned")},
204- {0x9e, _T("Unassigned")},
205- {0x9f, _T("Unassigned")},
206- {VK_LSHIFT, _T("Left Shift")},
207- {VK_RSHIFT, _T("Right Shift")},
208- {VK_LCONTROL, _T("Left Ctrl")},
209- {VK_RCONTROL, _T("Right Ctrl")},
210- {VK_LMENU, _T("Left Alt")},
211- {VK_RMENU, _T("Right Alt")},
212- {0xa6, _T("Browser Back")}, // VK_BROWSER_BACK
213- {0xa7, _T("Browser Forward")}, // VK_BROWSER_FORWARD
214- {0xa8, _T("Browser Refresh")}, // VK_BROWSER_REFRESH
215- {0xa9, _T("Browser Stop")}, // VK_BROWSER_STOP
216- {0xaa, _T("Browser Search")}, // VK_BROWSER_SEARCH
217- {0xab, _T("Browser Favorites")}, // VK_BROWSER_FAVORITES
218- {0xac, _T("Browser Start")}, // VK_BROWSER_HOME
219- {0xad, _T("Volume Mute")}, // VK_VOLUME_MUTE
220- {0xae, _T("Volume Down")}, // VK_VOLUME_DOWN
221- {0xaf, _T("Volume Up")}, // VK_VOLUME_UP
222- {0xb0, _T("Next Track")}, // VK_MEDIA_NEXT_TRACK
223- {0xb1, _T("Previous Track")}, // VK_MEDIA_PREV_TRACK
224- {0xb2, _T("Stop Media")}, // VK_MEDIA_STOP
225- {0xb3, _T("Play/Pause Media")}, // VK_MEDIA_PLAY_PAUSE
226- {0xb4, _T("Start Mail")}, // VK_LAUNCH_MAIL
227- {0xb5, _T("Select Media")}, // VK_LAUNCH_MEDIA_SELECT
228- {0xb6, _T("Start Application 1")}, // VK_LAUNCH_APP1
229- {0xb7, _T("Start Application 2")}, // VK_LAUNCH_APP2
230- {0xb8, _T("Reserved")},
231- {0xb9, _T("Reserved")},
232- {0xba, _T(";")}, // VK_OEM_1
233-// {0xba, _T(":")}, // VK_OEM_1 // for Japanese keyboard
234- {0xbb, _T("+")}, // VK_OEM_PLUS
235-// {0xbb, _T(";")}, // VK_OEM_PLUS // for Japanese keyboard
236- {0xbc, _T(",")}, // VK_OEM_COMMA
237- {0xbd, _T("-")}, // VK_OEM_MINUS
238- {0xbe, _T(".")}, // VK_OEM_PERIOD
239- {0xbf, _T("/")}, // VK_OEM_2
240- {0xc0, _T("`")}, // VK_OEM_3
241-// {0xc0, _T("@")}, // VK_OEM_3 // for Japanese keyboard
242- {0xc1, _T("Reserved")},
243- {0xc2, _T("Reserved")},
244- {0xc3, _T("Reserved")},
245- {0xc4, _T("Reserved")},
246- {0xc5, _T("Reserved")},
247- {0xc6, _T("Reserved")},
248- {0xc7, _T("Reserved")},
249- {0xc8, _T("Reserved")},
250- {0xc9, _T("Reserved")},
251- {0xca, _T("Reserved")},
252- {0xcb, _T("Reserved")},
253- {0xcc, _T("Reserved")},
254- {0xcd, _T("Reserved")},
255- {0xce, _T("Reserved")},
256- {0xcf, _T("Reserved")},
257- {0xd0, _T("Reserved")},
258- {0xd1, _T("Reserved")},
259- {0xd2, _T("Reserved")},
260- {0xd3, _T("Reserved")},
261- {0xd4, _T("Reserved")},
262- {0xd5, _T("Reserved")},
263- {0xd6, _T("Reserved")},
264- {0xd7, _T("Reserved")},
265- {0xd8, _T("Unassigned")},
266- {0xd9, _T("Unassigned")},
267- {0xda, _T("Unassigned")},
268- {0xdb, _T("[")}, // VK_OEM_4
269- {0xdc, _T("Backslash")}, // VK_OEM_5
270- {0xdd, _T("]")}, // VK_OEM_6
271- {0xde, _T("'")}, // VK_OEM_7
272- {0xdf, _T("OEM specific")}, // VK_OEM_8
273- {0xe0, _T("Reserved")},
274- {0xe1, _T("OEM specific")},
275- {0xe2, _T("Backslash for 106 keyboard")}, // VK_OEM_102
276- {0xe3, _T("OEM specific")},
277- {0xe4, _T("OEM specific")},
278- {0xe5, _T("Process")}, // VK_PROCESSKEY
279- {0xe6, _T("OEM specific")},
280- {0xe7, _T("Packet")}, // VK_PACKET
281- {0xe8, _T("Unassigned")},
282- {0xe9, _T("OEM specific")},
283- {0xea, _T("OEM specific")},
284- {0xeb, _T("OEM specific")},
285- {0xec, _T("OEM specific")},
286- {0xed, _T("OEM specific")},
287- {0xee, _T("OEM specific")},
288- {0xef, _T("OEM specific")},
289- {0xf0, _T("Eisu")}, // 英数
290- {0xf1, _T("OEM specific")},
291- {0xf2, _T("Hiragana")}, // ひらがな
292- {0xf3, _T("Hankaku/Zenkaku 0xf3")}, // "半角/全角"
293- {0xf4, _T("Hankaku/Zenkaku 0xf4")}, // "半角/全角"
294- {0xf5, _T("OEM specific")},
295- {VK_ATTN, _T("Attn")},
296- {VK_CRSEL, _T("CrSel")},
297- {VK_EXSEL, _T("ExSel")},
298- {VK_EREOF, _T("Erace EOF")},
299- {VK_PLAY, _T("Play")},
300- {VK_ZOOM, _T("Zoom")},
301- {VK_NONAME, _T("Noname")},
302- {VK_PA1, _T("PA1")},
303- {VK_OEM_CLEAR, _T("OEM Clear")},
304- {0xff, _T("Fn")},
305-};
306-
30720 Config CProfile::m_Config;
30821 TCHAR CProfile::m_szAppTitle[MAX_APP][WINDOW_TEXT_LENGTH];
30922 TASK_LIST CProfile::m_TaskList[MAX_TASKS];
31023 DWORD CProfile::m_dwTasks;
24+KeyString CProfile::m_KeyString(CProfile::Is106Keyboard() != FALSE);
31125
31226 // This function returns the nth string in a window name separated by " - ".
31327 // If there aren't a sufficient number of strings, it returns the last string
@@ -428,7 +142,7 @@ void CProfile::LoadRegistry()
428142 DWORD dwKeyBind = _countof(szKeyBind);
429143 for (DWORD dwIndex = 0; RegEnumKeyEx(hKey, dwIndex, szKeyBind, &dwKeyBind, NULL, NULL, NULL, NULL) == ERROR_SUCCESS; ++dwIndex) {
430144 int nType, nKey;
431- ReadKeyBind(nType, nKey, szKeyBind);
145+ StringToKey(szKeyBind, nType, nKey);
432146 m_Config.nCommandID[nAppID][nType][nKey] = nComID;
433147 dwKeyBind = _countof(szKeyBind);
434148 }
@@ -452,7 +166,7 @@ void CProfile::LoadRegistry()
452166 DWORD dwKeyBind = _countof(szKeyBind);
453167 for (DWORD dwIndex = 0; RegEnumKeyEx(hKey, dwIndex, szKeyBind, &dwKeyBind, NULL, NULL, NULL, NULL) == ERROR_SUCCESS; ++dwIndex) {
454168 int nType, nKey;
455- ReadKeyBind(nType, nKey, szKeyBind);
169+ StringToKey(szKeyBind, nType, nKey);
456170 CDotXkeymacs::SetKey(nFuncID, nAppID, nType, nKey);
457171 dwKeyBind = _countof(szKeyBind);
458172 }
@@ -499,10 +213,9 @@ void CProfile::SaveRegistry()
499213 entry.LoadString(IDS_REG_ENTRY_WINDOW_TEXT);
500214 AfxGetApp()->WriteProfileString(szAppName, entry, m_Config.szWindowText[nAppID]);
501215
502- const CString regApp = CString(MAKEINTRESOURCE(IDS_REGSUBKEY_DATA)) + _T("\\") + szAppName;
503216 // Create all commands
504217 for (int nComID = 1; nComID < MAX_COMMAND; ++nComID)
505- SaveCommand(szAppName, nComID);
218+ SaveKeyBind(szAppName, nComID, 0, 0);
506219 for (int nType = 0; nType < MAX_COMMAND_TYPE; ++nType)
507220 for (int nKey = 0; nKey < MAX_KEY; ++nKey)
508221 SaveKeyBind(szAppName, m_Config.nCommandID[nAppID][nType][nKey], nType, nKey);
@@ -575,107 +288,35 @@ void CProfile::SetDllData()
575288 pApp->SendIPCMessage(XKEYMACS_RELOAD);
576289 }
577290
578-void CProfile::ReadKeyBind(int& nCommandType, int& nKey, const LPCTSTR szKeyBind)
579-{
580- nCommandType = KeyBind2CommandType(szKeyBind);
581- nKey = KeyBind2Key(szKeyBind + _tcslen(CommandType2String(nCommandType)));
582-}
583-
584-CString CProfile::WriteKeyBind(const int nType, const int nKey)
291+void CProfile::SaveKeyBind(const LPCTSTR appName, int comID, int type, int key)
585292 {
586- CString szKeyBind;
587- szKeyBind.Format(_T("%s%s"), CommandType2String(nType), Key2String(nKey));
588- return szKeyBind;
589-}
590-
591-int CProfile::KeyBind2CommandType(LPCTSTR szKeyBind)
592-{
593- for (int nType = MAX_COMMAND_TYPE - 1; nType; --nType) {
594- if (IsCommandType(nType, szKeyBind)) {
595- return nType;
596- }
597- }
598- return NONE;
599-}
600-
601-int CProfile::KeyBind2Key(LPCTSTR szKey)
602-{
603- for (int nKey = 1; nKey <= 0xff; ++nKey) {
604- if (!_tcscmp(szKey, Key2String(nKey))) {
605- return nKey;
606- }
607- }
608- return 0;
609-}
610-
611-LPCTSTR CProfile::CommandType2String(int nType)
612-{
613- if (nType < 0 || sizeof(CommandTypes) / sizeof(CommandTypes[0]) <= nType) {
614- ASSERT(0);
615- nType = NONE;
616- }
617- return CommandTypes[nType].szName;
618-}
619-
620-LPCTSTR CProfile::Key2String(int nKey)
621-{
622- if (CProfile::Is106Keyboard()) {
623- switch (nKey) {
624- case 0xBA:
625- return _T(":");
626- case 0xBB:
627- return _T(";");
628- case 0xC0:
629- return _T("@");
630- case 0xDE:
631- return _T("^");
632- default:
633- break;
634- }
635- }
636-
637- if (nKey < 0 || sizeof(KeyNames) / sizeof(KeyNames[0]) <= nKey) {
638- ASSERT(0);
639- nKey = 0;
640- }
641- return KeyNames[nKey].name;
642-}
643-
644-BOOL CProfile::IsCommandType(const int nType, LPCTSTR szKeyBind)
645-{
646- LPCTSTR szCommandType = CommandType2String(nType);
647-
648- if (!_tcsnicmp(szKeyBind, szCommandType, _tcslen(szCommandType))) {
649- return TRUE;
650- }
651-
652- return FALSE;
653-}
654-
655-void CProfile::SaveKeyBind(const LPCSTR szAppName, const int nComID, const int nType, const int nKey)
656-{
657- if (!nComID)
293+ if (!comID)
658294 return;
659- const LPCSTR szComName = CCommands::GetCommandName(nComID);
660- if (!szComName[0])
295+ LPCTSTR comName = CCommands::GetCommandName(comID);
296+ if (!comName[0])
661297 return;
662- SaveKeyBind(szAppName, szComName, nType, nKey);
298+ SaveKeyBind(appName, comName, type, key);
663299 }
664300
665-void CProfile::SaveKeyBind(const LPCSTR szAppName, const LPCSTR szComName, const int nType, const int nKey)
301+void CProfile::SaveKeyBind(const LPCTSTR appName, const LPCTSTR comName, int type, int key)
666302 {
667- const CString szKeyBind = WriteKeyBind(nType, nKey);
668- CString szSubKey = CString(MAKEINTRESOURCE(IDS_REGSUBKEY_DATA)) + _T("\\") + szAppName + _T("\\") + szComName;
669- if (!szKeyBind.IsEmpty())
670- szSubKey += _T("\\") + szKeyBind;
303+ CString subKey = CString(MAKEINTRESOURCE(IDS_REGSUBKEY_DATA)) + _T("\\") + appName + _T("\\") + comName;
304+ CString s = KeyToString(type, key);
305+ if (s.IsEmpty())
306+ subKey = subKey + _T("\\") + s;
671307 HKEY hKey = NULL;
672- if (RegCreateKeyEx(HKEY_CURRENT_USER, szSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL) == ERROR_SUCCESS)
308+ if (RegCreateKeyEx(HKEY_CURRENT_USER, subKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL) == ERROR_SUCCESS)
673309 RegCloseKey(hKey);
674310 }
675311
676-void CProfile::SaveCommand(const LPCSTR szAppName, const int nComID)
312+void CProfile::StringToKey(const LPCTSTR str, int& type, int& key)
313+{
314+ m_KeyString.ToKey(str, type, key);
315+}
316+
317+CString CProfile::KeyToString(int type, int key)
677318 {
678- SaveKeyBind(szAppName, nComID, 0, 0);
319+ return m_KeyString.ToString(type, key);
679320 }
680321
681322 void CProfile::AddKeyBind2C_(const LPCSTR szAppName, const BYTE bVk)
@@ -731,7 +372,7 @@ void CProfile::LevelUp()
731372 DWORD dwKeyBind = sizeof(szKeyBind);
732373 for (DWORD dwIndex = 0; RegEnumKeyEx(hKey, dwIndex, szKeyBind, &dwKeyBind, NULL, NULL, NULL, NULL) == ERROR_SUCCESS; ++dwIndex) {
733374 int nType, nKey;
734- ReadKeyBind(nType, nKey, szKeyBind);
375+ StringToKey(szKeyBind, nType, nKey);
735376 SaveKeyBind(appName, CDotXkeymacs::GetFunctionSymbol(nFuncID), nType, nKey);
736377 dwKeyBind = sizeof(szKeyBind);
737378 }
--- a/xkeymacs/profile.h
+++ b/xkeymacs/profile.h
@@ -11,6 +11,7 @@
1111
1212 #include "resource.h"
1313 #include "properties.h"
14+#include "KeyString.h"
1415 #include "../xkeymacsdll/ipc.h"
1516
1617 struct TASK_LIST {
@@ -44,9 +45,8 @@ public:
4445 static void SetUseDialogSetting(int nAppID, BOOL bUseDialogSetting);
4546 static int GetAppID(const LPCSTR szAppName);
4647 static void CopyData(CString szDestinationApplication, CString szSourceApplication);
47- static void ReadKeyBind(int& pnCommandType, int& pnKey, LPCTSTR szKeyBind);
48- static LPCTSTR Key2String(int nKey);
49- static LPCTSTR CommandType2String(int nType);
48+ static void StringToKey(LPCTSTR str, int& type, int& key);
49+ static CString KeyToString(int type, int key);
5050 static int GetKillRingMax(int nAppID);
5151 static void SetKillRingMax(int nAppID, int nKillRingMax);
5252 static int GetCommandID(int nAppID, int nType, int nKey);
@@ -64,12 +64,12 @@ public:
6464 static void SaveData();
6565
6666 private:
67- static void SaveKeyBind(const LPCSTR szAppName, const LPCSTR szComName, int nType, int nKey);
67+ static KeyString m_KeyString;
6868 static BOOL DiableTokenPrivileges();
6969 static BOOL AdjustTokenPrivileges(LPCTSTR lpName);
70- static void SaveCommand(const LPCSTR szAppName, int nComID);
71- static void SaveKeyBind(const LPCSTR szAppName, int nComID, int nType, int nKey);
72- static void AddKeyBind2C_(const LPCSTR szApplicationName, BYTE bVk);
70+ static void SaveKeyBind(const LPCTSTR appName, int comID, int type, int key);
71+ static void SaveKeyBind(const LPCTSTR appName, const LPCTSTR comName, int type, int key);
72+ static void AddKeyBind2C_(const LPCTSTR szApplicationName, BYTE bVk);
7373 static void LevelUp();
7474 static bool GetAppTitle(CString& appTitle, const CString& windowName, int nth = 1000);
7575 static BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam);
@@ -80,10 +80,6 @@ private:
8080 static TASK_LIST m_TaskList[MAX_TASKS];
8181 static DWORD m_dwTasks;
8282 static void GetTaskList();
83- static BOOL IsCommandType(int nType, LPCTSTR szKeyBind);
84- static int KeyBind2Key(const LPCTSTR szKey);
85- static int KeyBind2CommandType(const LPCTSTR szKeyBind);
86- static CString WriteKeyBind(int nType, int nKey);
8783 static void LoadRegistry();
8884 static void SaveRegistry();
8985 static void AddIMEInfo(CProperties& cProperties);
--- a/xkeymacs/propertiesadvanced.cpp
+++ b/xkeymacs/propertiesadvanced.cpp
@@ -258,9 +258,7 @@ void CPropertiesAdvanced::SetCurrentKeys()
258258 for (int nType = 0; nType < MAX_COMMAND_TYPE; ++nType) {
259259 for (int nKey = 0; nKey < MAX_KEY; ++nKey) {
260260 if (CCommands::GetCommandName(CProfile::GetCommandID(m_nAppID, nType, nKey)) == szCurrentCommandName) {
261- CString sz;
262- sz.Format(_T("%s%s"), CProfile::CommandType2String(nType), CProfile::Key2String(nKey));
263- m_cCurrentKeys.AddString(sz);
261+ m_cCurrentKeys.AddString(CProfile::KeyToString(nType, nKey));
264262 }
265263 }
266264 }
@@ -292,10 +290,7 @@ void CPropertiesAdvanced::SetCurrentKeys()
292290 int nType = 0;
293291 int nKey = 0;
294292 CDotXkeymacs::GetKey(nIndex, m_nAppID, nKeyID, &nType, &nKey);
295-
296- CString sz;
297- sz.Format(_T("%s%s"), CProfile::CommandType2String(nType), CProfile::Key2String(nKey));
298- m_cCurrentKeys.AddString(sz);
293+ m_cCurrentKeys.AddString(CProfile::KeyToString(nType, nKey));
299294 }
300295
301296 m_cDescription.SetWindowText(CDotXkeymacs::GetFunctionDefinition(szCurrentCommandName));
@@ -331,7 +326,7 @@ void CPropertiesAdvanced::OnSelchangeCurrentKeys()
331326 {
332327 TCHAR szKeyBind[128] = {'\0'};
333328 m_cCurrentKeys.GetText(m_cCurrentKeys.GetCurSel(), szKeyBind);
334- CProfile::ReadKeyBind(m_nRemoveCommandType, m_nRemoveKey, szKeyBind);
329+ CProfile::StringToKey(szKeyBind, m_nRemoveCommandType, m_nRemoveKey);
335330 m_cRemove.EnableWindow();
336331 }
337332
@@ -354,9 +349,8 @@ void CPropertiesAdvanced::OnAssign()
354349 CDotXkeymacs::RemoveKey(m_nAppID, m_nAssignCommandType, m_nAssignKey);
355350
356351 // Assign New Setting
357- CString szItem;
358- szItem.Format(_T("%s%s"), CProfile::CommandType2String(m_nAssignCommandType), CProfile::Key2String(m_nAssignKey));
359- if (m_cCurrentKeys.FindString(-1, szItem) == LB_ERR) { // This key bind has not assignd to the same command yet.
352+ CString item = CProfile::KeyToString(m_nAssignCommandType, m_nAssignKey);
353+ if (m_cCurrentKeys.FindString(-1, item) == LB_ERR) { // This key bind has not assignd to the same command yet.
360354 CString szCategory;
361355 m_cCategory.GetLBText(m_cCategory.GetCurSel(), szCategory);
362356
@@ -368,7 +362,7 @@ void CPropertiesAdvanced::OnAssign()
368362 m_cCommands.GetText(m_cCommands.GetCurSel(), szCurrentCommandName);
369363 CDotXkeymacs::SetKey(CDotXkeymacs::GetIndex(szCurrentCommandName), m_nAppID, m_nAssignCommandType, m_nAssignKey);
370364 }
371- m_cCurrentKeys.AddString(szItem);
365+ m_cCurrentKeys.AddString(item);
372366 }
373367
374368 ClearNewKey();
@@ -435,37 +429,25 @@ LRESULT CALLBACK CPropertiesAdvanced::KeyboardProc(int code, WPARAM wParam, LPAR
435429
436430 void CPropertiesAdvanced::SetNewKey()
437431 {
438- CString szNewKey;
439- int nType = NONE;
440-
441- if (m_bC_x) {
442- szNewKey += _T("Ctrl+X ");
443- nType += CONTROLX;
444- }
445- if (IsCtrlDown()) {
446- szNewKey += _T("Ctrl+");
447- nType += CONTROL;
448- }
449- if (IsMetaDown()) {
450- szNewKey += _T("Meta+");
451- nType += META;
452- }
453- if (IsShiftDown()) {
454- szNewKey += _T("Shift+");
455- nType += SHIFT;
456- }
457-
432+ UINT nType = NONE;
433+ if (m_bC_x)
434+ nType |= CONTROLX;
435+ if (IsCtrlDown())
436+ nType |= CONTROL;
437+ if (IsMetaDown())
438+ nType |= META;
439+ if (IsShiftDown())
440+ nType |= SHIFT;
458441 m_nAssignCommandType = nType;
459442
460- szNewKey += CProfile::Key2String(m_nAssignKey);
461- if (m_pNewKey) {
462- m_pNewKey->SetWindowText(szNewKey);
463- }
443+ CString newKey = CProfile::KeyToString(nType, m_nAssignKey);
444+ if (m_pNewKey)
445+ m_pNewKey->SetWindowText(newKey);
464446
465447 if (m_pAssign) {
466448 BOOL bEnable = TRUE;
467449 if (m_pCurrentKeys
468- && m_pCurrentKeys->FindString(-1, szNewKey) != LB_ERR) { // This key bind is already assigned.
450+ && m_pCurrentKeys->FindString(-1, newKey) != LB_ERR) { // This key bind is already assigned.
469451 bEnable = FALSE;
470452 }
471453 m_pAssign->EnableWindow(bEnable);
--- a/xkeymacs/propertieslist.cpp
+++ b/xkeymacs/propertieslist.cpp
@@ -75,8 +75,7 @@ void CPropertiesList::SetDialogData()
7575 for (int nType = 0; nType < MAX_COMMAND_TYPE; ++nType) {
7676 for (int nKey = 0; nKey < MAX_KEY; ++nKey)
7777 if (nComID == CProfile::GetCommandID(nAppID, nType, nKey)) {
78- CString key;
79- key.Format(_T("%s%s"), CProfile::CommandType2String(nType), CProfile::Key2String(nKey));
78+ CString key = CProfile::KeyToString(nType, nKey);
8079 InsertItem(category, szComName, key);
8180 bInserted = true;
8281 }
--- a/xkeymacs/xkeymacs-vc10.vcxproj
+++ b/xkeymacs/xkeymacs-vc10.vcxproj
@@ -211,6 +211,7 @@
211211 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
212212 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
213213 </ClCompile>
214+ <ClCompile Include="KeyString.cpp" />
214215 <ClCompile Include="mainfrm.cpp">
215216 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
216217 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -264,6 +265,7 @@
264265 <ClInclude Include="imelist.h" />
265266 <ClInclude Include="key.h" />
266267 <ClInclude Include="keyboardlayout.h" />
268+ <ClInclude Include="KeyString.h" />
267269 <ClInclude Include="mainfrm.h" />
268270 <ClInclude Include="mainfrm64.h" />
269271 <ClInclude Include="optionsdlg.h" />
--- a/xkeymacs/xkeymacs-vc10.vcxproj.filters
+++ b/xkeymacs/xkeymacs-vc10.vcxproj.filters
@@ -69,6 +69,9 @@
6969 <ClCompile Include="imelist.cpp">
7070 <Filter>Source Files</Filter>
7171 </ClCompile>
72+ <ClCompile Include="KeyString.cpp">
73+ <Filter>Source Files</Filter>
74+ </ClCompile>
7275 </ItemGroup>
7376 <ItemGroup>
7477 <ClInclude Include="104keyboard.h">
@@ -131,6 +134,9 @@
131134 <ClInclude Include="resource1.h">
132135 <Filter>Header Files</Filter>
133136 </ClInclude>
137+ <ClInclude Include="KeyString.h">
138+ <Filter>Header Files</Filter>
139+ </ClInclude>
134140 </ItemGroup>
135141 <ItemGroup>
136142 <ResourceCompile Include="xkeymacs.rc">
--- a/xkeymacsdll/defs.h
+++ b/xkeymacsdll/defs.h
@@ -20,12 +20,6 @@ enum { OFF_ICON, ON_ICON };
2020 enum SETTING_STYLE { SETTING_DEFAULT, SETTING_SPECIFIC, SETTING_DISABLE, SETTING_UNDEFINED };
2121 enum GOTO { GOTO_DO_NOTHING, GOTO_HOOK, GOTO_RECURSIVE, GOTO_HOOKX, GOTO_HOOK0_9, CONTINUE };
2222
23-struct KeyName
24-{
25- BYTE bVk;
26- LPCTSTR name;
27-};
28-
2923 struct KeyBind
3024 {
3125 int nType;
--- a/xkeymacsdll/xkeymacsdll.cpp
+++ b/xkeymacsdll/xkeymacsdll.cpp
@@ -33,7 +33,10 @@ static const Modifier Modifiers[] = {
3333 };
3434 static const int MAX_MODIFIER = _countof(Modifiers);
3535
36-static const KeyName KeyNames[] = {
36+static const struct {
37+ BYTE bVk;
38+ LPCTSTR name;
39+} KeyNames[] = {
3740 // { VK_LBUTTON, _T("mouse-1") }, // does not work well
3841 // { VK_RBUTTON, _T("mouse-3") }, // does not work well
3942 { VK_CANCEL, _T("break") },
Show on old repository browser