A Fast Bresenham Type Algorithm For Drawing Ellipses by John Kennedy
[xy_vsfilter.git] / src / apps / mplayerc / PPageAccelTbl.cpp
blobcb3600e4ce64b8a14d1d5069e18769ad40e5c9f2
1 /*
2 * Copyright (C) 2003-2006 Gabest
3 * http://www.gabest.org
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GNU Make; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
22 // PPageAccelTbl.cpp : implementation file
25 #include "stdafx.h"
26 #include "mplayerc.h"
27 #include "PPageAccelTbl.h"
29 // CPPageAccelTbl dialog
31 IMPLEMENT_DYNAMIC(CPPageAccelTbl, CPPageBase)
32 CPPageAccelTbl::CPPageAccelTbl()
33 : CPPageBase(CPPageAccelTbl::IDD, CPPageAccelTbl::IDD)
34 , m_list(0)
35 , m_counter(0)
36 , m_fWinLirc(FALSE)
37 , m_WinLircLink(_T("http://winlirc.sourceforge.net/"))
38 , m_fUIce(FALSE)
39 , m_UIceLink(_T("http://www.mediatexx.com/"))
43 CPPageAccelTbl::~CPPageAccelTbl()
47 BOOL CPPageAccelTbl::PreTranslateMessage(MSG* pMsg)
49 if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN
50 && (pMsg->hwnd == m_WinLircEdit.m_hWnd || pMsg->hwnd == m_UIceEdit.m_hWnd))
52 OnApply();
53 return TRUE;
56 return __super::PreTranslateMessage(pMsg);
60 void CPPageAccelTbl::SetupList()
62 for(int row = 0; row < m_list.GetItemCount(); row++)
64 wmcmd& wc = m_wmcmds.GetAt((POSITION)m_list.GetItemData(row));
66 CString mod = MakeAccelModLabel(wc.fVirt);
67 m_list.SetItemText(row, COL_MOD, mod);
69 CString key = MakeAccelVkeyLabel(wc.key, wc.fVirt&FVIRTKEY);
70 m_list.SetItemText(row, COL_KEY, key);
72 CString type = (wc.fVirt&FVIRTKEY)?_T("VIRTKEY"):_T("ASCII");
73 m_list.SetItemText(row, COL_TYPE, type);
75 CString id;
76 id.Format(_T("%d"), wc.cmd);
77 m_list.SetItemText(row, COL_ID, id);
79 m_list.SetItemText(row, COL_MOUSE, MakeMouseButtonLabel(wc.mouse));
81 m_list.SetItemText(row, COL_APPCMD, MakeAppCommandLabel(wc.appcmd));
83 m_list.SetItemText(row, COL_RMCMD, CString(wc.rmcmd));
85 CString repcnt;
86 repcnt.Format(_T("%d"), wc.rmrepcnt);
87 m_list.SetItemText(row, COL_RMREPCNT, repcnt);
91 CString CPPageAccelTbl::MakeAccelModLabel(BYTE fVirt)
93 CString str;
94 if(fVirt&FCONTROL) {if(!str.IsEmpty()) str += _T(" + "); str += _T("Ctrl");}
95 if(fVirt&FALT) {if(!str.IsEmpty()) str += _T(" + "); str += _T("Alt");}
96 if(fVirt&FSHIFT) {if(!str.IsEmpty()) str += _T(" + "); str += _T("Shift");}
97 if(str.IsEmpty()) str = _T("None");
98 return(str);
101 CString CPPageAccelTbl::MakeAccelVkeyLabel(WORD key, bool fVirtKey)
103 CString str;
105 if(fVirtKey)
106 switch(key)
108 case VK_LBUTTON: str = _T("VK_LBUTTON"); break;
109 case VK_RBUTTON: str = _T("VK_RBUTTON"); break;
110 case VK_CANCEL: str = _T("VK_CANCEL"); break;
111 case VK_MBUTTON: str = _T("VK_MBUTTON"); break;
112 case VK_XBUTTON1: str = _T("VK_XBUTTON1"); break;
113 case VK_XBUTTON2: str = _T("VK_XBUTTON2"); break;
114 case VK_BACK: str = _T("VK_BACK"); break;
115 case VK_TAB: str = _T("VK_TAB"); break;
116 case VK_CLEAR: str = _T("VK_CLEAR"); break;
117 case VK_RETURN: str = _T("VK_RETURN"); break;
118 case VK_SHIFT: str = _T("VK_SHIFT"); break;
119 case VK_CONTROL: str = _T("VK_CONTROL"); break;
120 case VK_MENU: str = _T("VK_MENU"); break;
121 case VK_PAUSE: str = _T("VK_PAUSE"); break;
122 case VK_CAPITAL: str = _T("VK_CAPITAL"); break;
123 // case VK_KANA: str = _T("VK_KANA"); break;
124 // case VK_HANGEUL: str = _T("VK_HANGEUL"); break;
125 case VK_HANGUL: str = _T("VK_HANGUL"); break;
126 case VK_JUNJA: str = _T("VK_JUNJA"); break;
127 case VK_FINAL: str = _T("VK_FINAL"); break;
128 // case VK_HANJA: str = _T("VK_HANJA"); break;
129 case VK_KANJI: str = _T("VK_KANJI"); break;
130 case VK_ESCAPE: str = _T("VK_ESCAPE"); break;
131 case VK_CONVERT: str = _T("VK_CONVERT"); break;
132 case VK_NONCONVERT: str = _T("VK_NONCONVERT"); break;
133 case VK_ACCEPT: str = _T("VK_ACCEPT"); break;
134 case VK_MODECHANGE: str = _T("VK_MODECHANGE"); break;
135 case VK_SPACE: str = _T("VK_SPACE"); break;
136 case VK_PRIOR: str = _T("VK_PRIOR"); break;
137 case VK_NEXT: str = _T("VK_NEXT"); break;
138 case VK_END: str = _T("VK_END"); break;
139 case VK_HOME: str = _T("VK_HOME"); break;
140 case VK_LEFT: str = _T("VK_LEFT"); break;
141 case VK_UP: str = _T("VK_UP"); break;
142 case VK_RIGHT: str = _T("VK_RIGHT"); break;
143 case VK_DOWN: str = _T("VK_DOWN"); break;
144 case VK_SELECT: str = _T("VK_SELECT"); break;
145 case VK_PRINT: str = _T("VK_PRINT"); break;
146 case VK_EXECUTE: str = _T("VK_EXECUTE"); break;
147 case VK_SNAPSHOT: str = _T("VK_SNAPSHOT"); break;
148 case VK_INSERT: str = _T("VK_INSERT"); break;
149 case VK_DELETE: str = _T("VK_DELETE"); break;
150 case VK_HELP: str = _T("VK_HELP"); break;
151 case VK_LWIN: str = _T("VK_LWIN"); break;
152 case VK_RWIN: str = _T("VK_RWIN"); break;
153 case VK_APPS: str = _T("VK_APPS"); break;
154 case VK_SLEEP: str = _T("VK_SLEEP"); break;
155 case VK_NUMPAD0: str = _T("VK_NUMPAD0"); break;
156 case VK_NUMPAD1: str = _T("VK_NUMPAD1"); break;
157 case VK_NUMPAD2: str = _T("VK_NUMPAD2"); break;
158 case VK_NUMPAD3: str = _T("VK_NUMPAD3"); break;
159 case VK_NUMPAD4: str = _T("VK_NUMPAD4"); break;
160 case VK_NUMPAD5: str = _T("VK_NUMPAD5"); break;
161 case VK_NUMPAD6: str = _T("VK_NUMPAD6"); break;
162 case VK_NUMPAD7: str = _T("VK_NUMPAD7"); break;
163 case VK_NUMPAD8: str = _T("VK_NUMPAD8"); break;
164 case VK_NUMPAD9: str = _T("VK_NUMPAD9"); break;
165 case VK_MULTIPLY: str = _T("VK_MULTIPLY"); break;
166 case VK_ADD: str = _T("VK_ADD"); break;
167 case VK_SEPARATOR: str = _T("VK_SEPARATOR"); break;
168 case VK_SUBTRACT: str = _T("VK_SUBTRACT"); break;
169 case VK_DECIMAL: str = _T("VK_DECIMAL"); break;
170 case VK_DIVIDE: str = _T("VK_DIVIDE"); break;
171 case VK_F1: str = _T("VK_F1"); break;
172 case VK_F2: str = _T("VK_F2"); break;
173 case VK_F3: str = _T("VK_F3"); break;
174 case VK_F4: str = _T("VK_F4"); break;
175 case VK_F5: str = _T("VK_F5"); break;
176 case VK_F6: str = _T("VK_F6"); break;
177 case VK_F7: str = _T("VK_F7"); break;
178 case VK_F8: str = _T("VK_F8"); break;
179 case VK_F9: str = _T("VK_F9"); break;
180 case VK_F10: str = _T("VK_F10"); break;
181 case VK_F11: str = _T("VK_F11"); break;
182 case VK_F12: str = _T("VK_F12"); break;
183 case VK_F13: str = _T("VK_F13"); break;
184 case VK_F14: str = _T("VK_F14"); break;
185 case VK_F15: str = _T("VK_F15"); break;
186 case VK_F16: str = _T("VK_F16"); break;
187 case VK_F17: str = _T("VK_F17"); break;
188 case VK_F18: str = _T("VK_F18"); break;
189 case VK_F19: str = _T("VK_F19"); break;
190 case VK_F20: str = _T("VK_F20"); break;
191 case VK_F21: str = _T("VK_F21"); break;
192 case VK_F22: str = _T("VK_F22"); break;
193 case VK_F23: str = _T("VK_F23"); break;
194 case VK_F24: str = _T("VK_F24"); break;
195 case VK_NUMLOCK: str = _T("VK_NUMLOCK"); break;
196 case VK_SCROLL: str = _T("VK_SCROLL"); break;
197 // case VK_OEM_NEC_EQUAL: str = _T("VK_OEM_NEC_EQUAL"); break;
198 case VK_OEM_FJ_JISHO: str = _T("VK_OEM_FJ_JISHO"); break;
199 case VK_OEM_FJ_MASSHOU: str = _T("VK_OEM_FJ_MASSHOU"); break;
200 case VK_OEM_FJ_TOUROKU: str = _T("VK_OEM_FJ_TOUROKU"); break;
201 case VK_OEM_FJ_LOYA: str = _T("VK_OEM_FJ_LOYA"); break;
202 case VK_OEM_FJ_ROYA: str = _T("VK_OEM_FJ_ROYA"); break;
203 case VK_LSHIFT: str = _T("VK_LSHIFT"); break;
204 case VK_RSHIFT: str = _T("VK_RSHIFT"); break;
205 case VK_LCONTROL: str = _T("VK_LCONTROL"); break;
206 case VK_RCONTROL: str = _T("VK_RCONTROL"); break;
207 case VK_LMENU: str = _T("VK_LMENU"); break;
208 case VK_RMENU: str = _T("VK_RMENU"); break;
209 case VK_BROWSER_BACK: str = _T("VK_BROWSER_BACK"); break;
210 case VK_BROWSER_FORWARD: str = _T("VK_BROWSER_FORWARD"); break;
211 case VK_BROWSER_REFRESH: str = _T("VK_BROWSER_REFRESH"); break;
212 case VK_BROWSER_STOP: str = _T("VK_BROWSER_STOP"); break;
213 case VK_BROWSER_SEARCH: str = _T("VK_BROWSER_SEARCH"); break;
214 case VK_BROWSER_FAVORITES: str = _T("VK_BROWSER_FAVORITES"); break;
215 case VK_BROWSER_HOME: str = _T("VK_BROWSER_HOME"); break;
216 case VK_VOLUME_MUTE: str = _T("VK_VOLUME_MUTE"); break;
217 case VK_VOLUME_DOWN: str = _T("VK_VOLUME_DOWN"); break;
218 case VK_VOLUME_UP: str = _T("VK_VOLUME_UP"); break;
219 case VK_MEDIA_NEXT_TRACK: str = _T("VK_MEDIA_NEXT_TRACK"); break;
220 case VK_MEDIA_PREV_TRACK: str = _T("VK_MEDIA_PREV_TRACK"); break;
221 case VK_MEDIA_STOP: str = _T("VK_MEDIA_STOP"); break;
222 case VK_MEDIA_PLAY_PAUSE: str = _T("VK_MEDIA_PLAY_PAUSE"); break;
223 case VK_LAUNCH_MAIL: str = _T("VK_LAUNCH_MAIL"); break;
224 case VK_LAUNCH_MEDIA_SELECT: str = _T("VK_LAUNCH_MEDIA_SELECT"); break;
225 case VK_LAUNCH_APP1: str = _T("VK_LAUNCH_APP1"); break;
226 case VK_LAUNCH_APP2: str = _T("VK_LAUNCH_APP2"); break;
227 case VK_OEM_1: str = _T("VK_OEM_1"); break;
228 case VK_OEM_PLUS: str = _T("VK_OEM_PLUS"); break;
229 case VK_OEM_COMMA: str = _T("VK_OEM_COMMA"); break;
230 case VK_OEM_MINUS: str = _T("VK_OEM_MINUS"); break;
231 case VK_OEM_PERIOD: str = _T("VK_OEM_PERIOD"); break;
232 case VK_OEM_2: str = _T("VK_OEM_2"); break;
233 case VK_OEM_3: str = _T("VK_OEM_3"); break;
234 case VK_OEM_4: str = _T("VK_OEM_4"); break;
235 case VK_OEM_5: str = _T("VK_OEM_5"); break;
236 case VK_OEM_6: str = _T("VK_OEM_6"); break;
237 case VK_OEM_7: str = _T("VK_OEM_7"); break;
238 case VK_OEM_8: str = _T("VK_OEM_8"); break;
239 case VK_OEM_AX: str = _T("VK_OEM_AX"); break;
240 case VK_OEM_102: str = _T("VK_OEM_102"); break;
241 case VK_ICO_HELP: str = _T("VK_ICO_HELP"); break;
242 case VK_ICO_00: str = _T("VK_ICO_00"); break;
243 case VK_PROCESSKEY: str = _T("VK_PROCESSKEY"); break;
244 case VK_ICO_CLEAR: str = _T("VK_ICO_CLEAR"); break;
245 case VK_PACKET: str = _T("VK_PACKET"); break;
246 case VK_OEM_RESET: str = _T("VK_OEM_RESET"); break;
247 case VK_OEM_JUMP: str = _T("VK_OEM_JUMP"); break;
248 case VK_OEM_PA1: str = _T("VK_OEM_PA1"); break;
249 case VK_OEM_PA2: str = _T("VK_OEM_PA2"); break;
250 case VK_OEM_PA3: str = _T("VK_OEM_PA3"); break;
251 case VK_OEM_WSCTRL: str = _T("VK_OEM_WSCTRL"); break;
252 case VK_OEM_CUSEL: str = _T("VK_OEM_CUSEL"); break;
253 case VK_OEM_ATTN: str = _T("VK_OEM_ATTN"); break;
254 case VK_OEM_FINISH: str = _T("VK_OEM_FINISH"); break;
255 case VK_OEM_COPY: str = _T("VK_OEM_COPY"); break;
256 case VK_OEM_AUTO: str = _T("VK_OEM_AUTO"); break;
257 case VK_OEM_ENLW: str = _T("VK_OEM_ENLW"); break;
258 case VK_OEM_BACKTAB: str = _T("VK_OEM_BACKTAB"); break;
259 case VK_ATTN: str = _T("VK_ATTN"); break;
260 case VK_CRSEL: str = _T("VK_CRSEL"); break;
261 case VK_EXSEL: str = _T("VK_EXSEL"); break;
262 case VK_EREOF: str = _T("VK_EREOF"); break;
263 case VK_PLAY: str = _T("VK_PLAY"); break;
264 case VK_ZOOM: str = _T("VK_ZOOM"); break;
265 case VK_NONAME: str = _T("VK_NONAME"); break;
266 case VK_PA1: str = _T("VK_PA1"); break;
267 case VK_OEM_CLEAR: str = _T("VK_OEM_CLEAR"); break;
268 default:
269 if('0' <= key && key <= '9' || 'A' <= key && key <= 'Z')
270 str.Format(_T("%c"), (TCHAR)key);
271 break;
274 if(str.IsEmpty() || !fVirtKey)
276 str.Format(_T("%c, 0x%02x"), (TCHAR)key, key);
277 return(str);
280 return(str);
283 CString CPPageAccelTbl::MakeAccelShortcutLabel(UINT id)
285 CList<wmcmd>& wmcmds = AfxGetAppSettings().wmcmds;
286 POSITION pos = wmcmds.GetHeadPosition();
287 while(pos)
289 ACCEL& a = wmcmds.GetNext(pos);
290 if(a.cmd == id)
291 return(MakeAccelShortcutLabel(a));
294 return(_T(""));
297 CString CPPageAccelTbl::MakeAccelShortcutLabel(ACCEL& a)
299 CString str;
301 if(a.fVirt&1)
302 switch(a.key)
304 case VK_LBUTTON: str = _T("LBtn"); break;
305 case VK_RBUTTON: str = _T("RBtn"); break;
306 case VK_CANCEL: str = _T("Cancel"); break;
307 case VK_MBUTTON: str = _T("MBtn"); break;
308 case VK_XBUTTON1: str = _T("X1Btn"); break;
309 case VK_XBUTTON2: str = _T("X2Btn"); break;
310 case VK_BACK: str = _T("Back"); break;
311 case VK_TAB: str = _T("Tab"); break;
312 case VK_CLEAR: str = _T("Clear"); break;
313 case VK_RETURN: str = _T("Return"); break;
314 case VK_SHIFT: str = _T("Shift"); break;
315 case VK_CONTROL: str = _T("Ctrl"); break;
316 case VK_MENU: str = _T("Alt"); break;
317 case VK_PAUSE: str = _T("Pause"); break;
318 case VK_CAPITAL: str = _T("Capital"); break;
319 // case VK_KANA: str = _T("Kana"); break;
320 // case VK_HANGEUL: str = _T("Hangeul"); break;
321 case VK_HANGUL: str = _T("Hangul"); break;
322 case VK_JUNJA: str = _T("Junja"); break;
323 case VK_FINAL: str = _T("Final"); break;
324 // case VK_HANJA: str = _T("Hanja"); break;
325 case VK_KANJI: str = _T("Kanji"); break;
326 case VK_ESCAPE: str = _T("Escape"); break;
327 case VK_CONVERT: str = _T("Convert"); break;
328 case VK_NONCONVERT: str = _T("Non Convert"); break;
329 case VK_ACCEPT: str = _T("Accept"); break;
330 case VK_MODECHANGE: str = _T("Mode Change"); break;
331 case VK_SPACE: str = _T("Space"); break;
332 case VK_PRIOR: str = _T("PgUp"); break;
333 case VK_NEXT: str = _T("PgDn"); break;
334 case VK_END: str = _T("End"); break;
335 case VK_HOME: str = _T("Home"); break;
336 case VK_LEFT: str = _T("Left"); break;
337 case VK_UP: str = _T("Up"); break;
338 case VK_RIGHT: str = _T("Right"); break;
339 case VK_DOWN: str = _T("Down"); break;
340 case VK_SELECT: str = _T("Select"); break;
341 case VK_PRINT: str = _T("Print"); break;
342 case VK_EXECUTE: str = _T("Execute"); break;
343 case VK_SNAPSHOT: str = _T("Snapshot"); break;
344 case VK_INSERT: str = _T("Insert"); break;
345 case VK_DELETE: str = _T("Delete"); break;
346 case VK_HELP: str = _T("Help"); break;
347 case VK_LWIN: str = _T("LWin"); break;
348 case VK_RWIN: str = _T("RWin"); break;
349 case VK_APPS: str = _T("Apps"); break;
350 case VK_SLEEP: str = _T("Sleep"); break;
351 case VK_NUMPAD0: str = _T("Numpad 0"); break;
352 case VK_NUMPAD1: str = _T("Numpad 1"); break;
353 case VK_NUMPAD2: str = _T("Numpad 2"); break;
354 case VK_NUMPAD3: str = _T("Numpad 3"); break;
355 case VK_NUMPAD4: str = _T("Numpad 4"); break;
356 case VK_NUMPAD5: str = _T("Numpad 5"); break;
357 case VK_NUMPAD6: str = _T("Numpad 6"); break;
358 case VK_NUMPAD7: str = _T("Numpad 7"); break;
359 case VK_NUMPAD8: str = _T("Numpad 8"); break;
360 case VK_NUMPAD9: str = _T("Numpad 9"); break;
361 case VK_MULTIPLY: str = _T("Multiply"); break;
362 case VK_ADD: str = _T("Add"); break;
363 case VK_SEPARATOR: str = _T("Separator"); break;
364 case VK_SUBTRACT: str = _T("Subtract"); break;
365 case VK_DECIMAL: str = _T("Decimal"); break;
366 case VK_DIVIDE: str = _T("Divide"); break;
367 case VK_F1: str = _T("F1"); break;
368 case VK_F2: str = _T("F2"); break;
369 case VK_F3: str = _T("F3"); break;
370 case VK_F4: str = _T("F4"); break;
371 case VK_F5: str = _T("F5"); break;
372 case VK_F6: str = _T("F6"); break;
373 case VK_F7: str = _T("F7"); break;
374 case VK_F8: str = _T("F8"); break;
375 case VK_F9: str = _T("F9"); break;
376 case VK_F10: str = _T("F10"); break;
377 case VK_F11: str = _T("F11"); break;
378 case VK_F12: str = _T("F12"); break;
379 case VK_F13: str = _T("F13"); break;
380 case VK_F14: str = _T("F14"); break;
381 case VK_F15: str = _T("F15"); break;
382 case VK_F16: str = _T("F16"); break;
383 case VK_F17: str = _T("F17"); break;
384 case VK_F18: str = _T("F18"); break;
385 case VK_F19: str = _T("F19"); break;
386 case VK_F20: str = _T("F20"); break;
387 case VK_F21: str = _T("F21"); break;
388 case VK_F22: str = _T("F22"); break;
389 case VK_F23: str = _T("F23"); break;
390 case VK_F24: str = _T("F24"); break;
391 case VK_NUMLOCK: str = _T("Numlock"); break;
392 case VK_SCROLL: str = _T("Scroll"); break;
393 // case VK_OEM_NEC_EQUAL: str = _T("OEM NEC Equal"); break;
394 case VK_OEM_FJ_JISHO: str = _T("OEM FJ Jisho"); break;
395 case VK_OEM_FJ_MASSHOU: str = _T("OEM FJ Msshou"); break;
396 case VK_OEM_FJ_TOUROKU: str = _T("OEM FJ Touroku"); break;
397 case VK_OEM_FJ_LOYA: str = _T("OEM FJ Loya"); break;
398 case VK_OEM_FJ_ROYA: str = _T("OEM FJ Roya"); break;
399 case VK_LSHIFT: str = _T("LShift"); break;
400 case VK_RSHIFT: str = _T("RShift"); break;
401 case VK_LCONTROL: str = _T("LCtrl"); break;
402 case VK_RCONTROL: str = _T("RCtrl"); break;
403 case VK_LMENU: str = _T("LAlt"); break;
404 case VK_RMENU: str = _T("RAlt"); break;
405 case VK_BROWSER_BACK: str = _T("Browser Back"); break;
406 case VK_BROWSER_FORWARD: str = _T("Browser Forward"); break;
407 case VK_BROWSER_REFRESH: str = _T("Browser Refresh"); break;
408 case VK_BROWSER_STOP: str = _T("Browser Stop"); break;
409 case VK_BROWSER_SEARCH: str = _T("Browser Search"); break;
410 case VK_BROWSER_FAVORITES: str = _T("Browser Favorites"); break;
411 case VK_BROWSER_HOME: str = _T("Browser Home"); break;
412 case VK_VOLUME_MUTE: str = _T("Volume Mute"); break;
413 case VK_VOLUME_DOWN: str = _T("Volume Down"); break;
414 case VK_VOLUME_UP: str = _T("Volume Up"); break;
415 case VK_MEDIA_NEXT_TRACK: str = _T("Media Next Track"); break;
416 case VK_MEDIA_PREV_TRACK: str = _T("Media Prev Track"); break;
417 case VK_MEDIA_STOP: str = _T("Media Stop"); break;
418 case VK_MEDIA_PLAY_PAUSE: str = _T("Media Play/Pause"); break;
419 case VK_LAUNCH_MAIL: str = _T("Launch Mail"); break;
420 case VK_LAUNCH_MEDIA_SELECT: str = _T("Launch Media Select"); break;
421 case VK_LAUNCH_APP1: str = _T("Launch App1"); break;
422 case VK_LAUNCH_APP2: str = _T("Launch App2"); break;
423 case VK_OEM_1: str = _T("OEM 1"); break;
424 case VK_OEM_PLUS: str = _T("Plus"); break;
425 case VK_OEM_COMMA: str = _T("Comma"); break;
426 case VK_OEM_MINUS: str = _T("Minus"); break;
427 case VK_OEM_PERIOD: str = _T("Period"); break;
428 case VK_OEM_2: str = _T("OEM 2"); break;
429 case VK_OEM_3: str = _T("OEM 3"); break;
430 case VK_OEM_4: str = _T("OEM 4"); break;
431 case VK_OEM_5: str = _T("OEM 5"); break;
432 case VK_OEM_6: str = _T("OEM 6"); break;
433 case VK_OEM_7: str = _T("OEM 7"); break;
434 case VK_OEM_8: str = _T("OEM 8"); break;
435 case VK_OEM_AX: str = _T("OEM AX"); break;
436 case VK_OEM_102: str = _T("OEM 102"); break;
437 case VK_ICO_HELP: str = _T("ICO Help"); break;
438 case VK_ICO_00: str = _T("ICO 00"); break;
439 case VK_PROCESSKEY: str = _T("Process Key"); break;
440 case VK_ICO_CLEAR: str = _T("ICO Clear"); break;
441 case VK_PACKET: str = _T("Packet"); break;
442 case VK_OEM_RESET: str = _T("OEM Reset"); break;
443 case VK_OEM_JUMP: str = _T("OEM Jump"); break;
444 case VK_OEM_PA1: str = _T("OEM PA1"); break;
445 case VK_OEM_PA2: str = _T("OEM PA2"); break;
446 case VK_OEM_PA3: str = _T("OEM PA3"); break;
447 case VK_OEM_WSCTRL: str = _T("OEM WSCtrl"); break;
448 case VK_OEM_CUSEL: str = _T("OEM CUSEL"); break;
449 case VK_OEM_ATTN: str = _T("OEM ATTN"); break;
450 case VK_OEM_FINISH: str = _T("OEM Finish"); break;
451 case VK_OEM_COPY: str = _T("OEM Copy"); break;
452 case VK_OEM_AUTO: str = _T("OEM Auto"); break;
453 case VK_OEM_ENLW: str = _T("OEM ENLW"); break;
454 case VK_OEM_BACKTAB: str = _T("OEM Backtab"); break;
455 case VK_ATTN: str = _T("ATTN"); break;
456 case VK_CRSEL: str = _T("CRSEL"); break;
457 case VK_EXSEL: str = _T("EXSEL"); break;
458 case VK_EREOF: str = _T("EREOF"); break;
459 case VK_PLAY: str = _T("Play"); break;
460 case VK_ZOOM: str = _T("Zoom"); break;
461 case VK_NONAME: str = _T("Noname"); break;
462 case VK_PA1: str = _T("PA1"); break;
463 case VK_OEM_CLEAR: str = _T("OEM Clear"); break;
464 default:
465 if('0' <= a.key && a.key <= '9' || 'A' <= a.key && a.key <= 'Z')
466 str.Format(_T("%c"), (TCHAR)a.key);
467 break;
470 if(str.IsEmpty() || !(a.fVirt&1))
471 str.Format(_T("%c"), (TCHAR)a.key);
473 if(a.fVirt&(FCONTROL|FALT|FSHIFT))
474 str = MakeAccelModLabel(a.fVirt) + _T(" + ") + str;
476 str.Replace(_T(" + "), _T("+"));
478 return(str);
481 CString CPPageAccelTbl::MakeMouseButtonLabel(UINT mouse)
483 CString ret;
484 switch(mouse)
486 case wmcmd::NONE: default: ret = _T("None"); break;
487 case wmcmd::LDOWN: ret = _T("Left Down"); break;
488 case wmcmd::LUP: ret = _T("Left Up"); break;
489 case wmcmd::LDBLCLK: ret = _T("Left DblClk"); break;
490 case wmcmd::MDOWN: ret = _T("Middle Down"); break;
491 case wmcmd::MUP: ret = _T("Middle Up"); break;
492 case wmcmd::MDBLCLK: ret = _T("Middle DblClk"); break;
493 case wmcmd::RDOWN: ret = _T("Right Down"); break;
494 case wmcmd::RUP: ret = _T("Right Up"); break;
495 case wmcmd::RDBLCLK: ret = _T("Right DblClk"); break;
496 case wmcmd::X1DOWN: ret = _T("X1 Down"); break;
497 case wmcmd::X1UP: ret = _T("X1 Up"); break;
498 case wmcmd::X1DBLCLK: ret = _T("X1 DblClk"); break;
499 case wmcmd::X2DOWN: ret = _T("X2 Down"); break;
500 case wmcmd::X2UP: ret = _T("X2 Up"); break;
501 case wmcmd::X2DBLCLK: ret = _T("X2 DblClk"); break;
502 case wmcmd::WUP: ret = _T("Wheel Up"); break;
503 case wmcmd::WDOWN: ret = _T("Wheel Down"); break;
505 return ret;
508 CString CPPageAccelTbl::MakeAppCommandLabel(UINT id)
510 CString str;
512 ASSERT(id <= APPCOMMAND_LAST);
514 switch(id)
516 default: str = _T(""); break;
517 case APPCOMMAND_BROWSER_BACKWARD: str = _T("BROWSER_BACKWARD"); break;
518 case APPCOMMAND_BROWSER_FORWARD: str = _T("BROWSER_FORWARD"); break;
519 case APPCOMMAND_BROWSER_REFRESH: str = _T("BROWSER_REFRESH"); break;
520 case APPCOMMAND_BROWSER_STOP: str = _T("BROWSER_STOP"); break;
521 case APPCOMMAND_BROWSER_SEARCH: str = _T("BROWSER_SEARCH"); break;
522 case APPCOMMAND_BROWSER_FAVORITES: str = _T("BROWSER_FAVORITES"); break;
523 case APPCOMMAND_BROWSER_HOME: str = _T("BROWSER_HOME"); break;
524 case APPCOMMAND_VOLUME_MUTE: str = _T("VOLUME_MUTE"); break;
525 case APPCOMMAND_VOLUME_DOWN: str = _T("VOLUME_DOWN"); break;
526 case APPCOMMAND_VOLUME_UP: str = _T("VOLUME_UP"); break;
527 case APPCOMMAND_MEDIA_NEXTTRACK: str = _T("MEDIA_NEXTTRACK"); break;
528 case APPCOMMAND_MEDIA_PREVIOUSTRACK: str = _T("MEDIA_PREVIOUSTRACK"); break;
529 case APPCOMMAND_MEDIA_STOP: str = _T("MEDIA_STOP"); break;
530 case APPCOMMAND_MEDIA_PLAY_PAUSE: str = _T("MEDIA_PLAY_PAUSE"); break;
531 case APPCOMMAND_LAUNCH_MAIL: str = _T("LAUNCH_MAIL"); break;
532 case APPCOMMAND_LAUNCH_MEDIA_SELECT: str = _T("LAUNCH_MEDIA_SELECT"); break;
533 case APPCOMMAND_LAUNCH_APP1: str = _T("LAUNCH_APP1"); break;
534 case APPCOMMAND_LAUNCH_APP2: str = _T("LAUNCH_APP2"); break;
535 case APPCOMMAND_BASS_DOWN: str = _T("BASS_DOWN"); break;
536 case APPCOMMAND_BASS_BOOST: str = _T("BASS_BOOST"); break;
537 case APPCOMMAND_BASS_UP: str = _T("BASS_UP"); break;
538 case APPCOMMAND_TREBLE_DOWN: str = _T("TREBLE_DOWN"); break;
539 case APPCOMMAND_TREBLE_UP: str = _T("TREBLE_UP"); break;
540 case APPCOMMAND_MICROPHONE_VOLUME_MUTE: str = _T("MICROPHONE_VOLUME_MUTE"); break;
541 case APPCOMMAND_MICROPHONE_VOLUME_DOWN: str = _T("MICROPHONE_VOLUME_DOWN"); break;
542 case APPCOMMAND_MICROPHONE_VOLUME_UP: str = _T("MICROPHONE_VOLUME_UP"); break;
543 case APPCOMMAND_HELP: str = _T("HELP"); break;
544 case APPCOMMAND_FIND: str = _T("FIND"); break;
545 case APPCOMMAND_NEW: str = _T("NEW"); break;
546 case APPCOMMAND_OPEN: str = _T("OPEN"); break;
547 case APPCOMMAND_CLOSE: str = _T("CLOSE"); break;
548 case APPCOMMAND_SAVE: str = _T("SAVE"); break;
549 case APPCOMMAND_PRINT: str = _T("PRINT"); break;
550 case APPCOMMAND_UNDO: str = _T("UNDO"); break;
551 case APPCOMMAND_REDO: str = _T("REDO"); break;
552 case APPCOMMAND_COPY: str = _T("COPY"); break;
553 case APPCOMMAND_CUT: str = _T("CUT"); break;
554 case APPCOMMAND_PASTE: str = _T("PASTE"); break;
555 case APPCOMMAND_REPLY_TO_MAIL: str = _T("REPLY_TO_MAIL"); break;
556 case APPCOMMAND_FORWARD_MAIL: str = _T("FORWARD_MAIL"); break;
557 case APPCOMMAND_SEND_MAIL: str = _T("SEND_MAIL"); break;
558 case APPCOMMAND_SPELL_CHECK: str = _T("SPELL_CHECK"); break;
559 case APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE: str = _T("DICTATE_OR_COMMAND_CONTROL_TOGGLE"); break;
560 case APPCOMMAND_MIC_ON_OFF_TOGGLE: str = _T("MIC_ON_OFF_TOGGLE"); break;
561 case APPCOMMAND_CORRECTION_LIST: str = _T("CORRECTION_LIST"); break;
562 case APPCOMMAND_MEDIA_PLAY: str = _T("MEDIA_PLAY"); break;
563 case APPCOMMAND_MEDIA_PAUSE: str = _T("MEDIA_PAUSE"); break;
564 case APPCOMMAND_MEDIA_RECORD: str = _T("MEDIA_RECORD"); break;
565 case APPCOMMAND_MEDIA_FAST_FORWARD: str = _T("MEDIA_FAST_FORWARD"); break;
566 case APPCOMMAND_MEDIA_REWIND: str = _T("MEDIA_REWIND"); break;
567 case APPCOMMAND_MEDIA_CHANNEL_UP: str = _T("MEDIA_CHANNEL_UP"); break;
568 case APPCOMMAND_MEDIA_CHANNEL_DOWN: str = _T("MEDIA_CHANNEL_DOWN"); break;
571 return str;
573 void CPPageAccelTbl::DoDataExchange(CDataExchange* pDX)
575 __super::DoDataExchange(pDX);
576 DDX_Text(pDX, IDC_EDIT1, m_WinLircAddr);
577 DDX_Control(pDX, IDC_EDIT1, m_WinLircEdit);
578 DDX_Control(pDX, IDC_STATICLINK, m_WinLircLink);
579 DDX_Check(pDX, IDC_CHECK1, m_fWinLirc);
580 DDX_Text(pDX, IDC_EDIT2, m_UIceAddr);
581 DDX_Control(pDX, IDC_EDIT2, m_UIceEdit);
582 DDX_Control(pDX, IDC_STATICLINK2, m_UIceLink);
583 DDX_Check(pDX, IDC_CHECK9, m_fUIce);
586 BEGIN_MESSAGE_MAP(CPPageAccelTbl, CPPageBase)
587 ON_NOTIFY(LVN_BEGINLABELEDIT, IDC_LIST1, OnBeginlabeleditList)
588 ON_NOTIFY(LVN_DOLABELEDIT, IDC_LIST1, OnDolabeleditList)
589 ON_NOTIFY(LVN_ENDLABELEDIT, IDC_LIST1, OnEndlabeleditList)
590 ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
591 ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2)
592 ON_WM_TIMER()
593 ON_WM_CTLCOLOR()
594 END_MESSAGE_MAP()
596 // CPPageAccelTbl message handlers
598 BOOL CPPageAccelTbl::OnInitDialog()
600 __super::OnInitDialog();
602 AppSettings& s = AfxGetAppSettings();
604 m_wmcmds.RemoveAll();
605 m_wmcmds.AddTail(&s.wmcmds);
606 m_fWinLirc = s.fWinLirc;
607 m_WinLircAddr = s.WinLircAddr;
608 m_fUIce = s.fUIce;
609 m_UIceAddr = s.UIceAddr;
611 UpdateData(FALSE);
613 CRect r;
614 GetDlgItem(IDC_PLACEHOLDER)->GetWindowRect(r);
615 ScreenToClient(r);
617 m_list.CreateEx(
618 WS_EX_CLIENTEDGE,
619 WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_TABSTOP|LVS_REPORT|LVS_AUTOARRANGE|LVS_SHOWSELALWAYS,
620 r, this, IDC_LIST1);
622 m_list.SetExtendedStyle(m_list.GetExtendedStyle()|LVS_EX_FULLROWSELECT|LVS_EX_DOUBLEBUFFER);
624 for(int i = 0, j = m_list.GetHeaderCtrl()->GetItemCount(); i < j; i++) m_list.DeleteColumn(0);
625 m_list.InsertColumn(COL_CMD, _T("Command"), LVCFMT_LEFT, 80);
626 m_list.InsertColumn(COL_MOD, _T("Modifier"), LVCFMT_LEFT, 40);
627 m_list.InsertColumn(COL_KEY, _T("Key"), LVCFMT_LEFT, 40);
628 m_list.InsertColumn(COL_TYPE, _T("Type"), LVCFMT_LEFT, 40);
629 m_list.InsertColumn(COL_ID, _T("ID"), LVCFMT_LEFT, 40);
630 m_list.InsertColumn(COL_MOUSE, _T("Mouse"), LVCFMT_LEFT, 80);
631 m_list.InsertColumn(COL_APPCMD, _T("App Command"), LVCFMT_LEFT, 120);
632 m_list.InsertColumn(COL_RMCMD, _T("RemoteCmd"), LVCFMT_LEFT, 80);
633 m_list.InsertColumn(COL_RMREPCNT, _T("RepCnt"), LVCFMT_CENTER, 60);
635 POSITION pos = m_wmcmds.GetHeadPosition();
636 for(int i = 0; pos; i++)
638 int row = m_list.InsertItem(m_list.GetItemCount(), m_wmcmds.GetAt(pos).name, COL_CMD);
639 m_list.SetItemData(row, (DWORD_PTR)pos);
640 m_wmcmds.GetNext(pos);
643 SetupList();
645 m_list.SetColumnWidth(COL_CMD, LVSCW_AUTOSIZE);
646 m_list.SetColumnWidth(COL_MOD, LVSCW_AUTOSIZE);
647 m_list.SetColumnWidth(COL_KEY, LVSCW_AUTOSIZE);
648 m_list.SetColumnWidth(COL_TYPE, LVSCW_AUTOSIZE);
649 m_list.SetColumnWidth(COL_ID, LVSCW_AUTOSIZE_USEHEADER);
651 return TRUE; // return TRUE unless you set the focus to a control
652 // EXCEPTION: OCX Property Pages should return FALSE
655 BOOL CPPageAccelTbl::OnApply()
657 UpdateData();
659 AppSettings& s = AfxGetAppSettings();
661 s.wmcmds.RemoveAll();
662 s.wmcmds.AddTail(&m_wmcmds);
664 CAtlArray<ACCEL> pAccel;
665 pAccel.SetCount(m_wmcmds.GetCount());
666 POSITION pos = m_wmcmds.GetHeadPosition();
667 for(int i = 0; pos; i++) pAccel[i] = m_wmcmds.GetNext(pos);
668 if(s.hAccel) DestroyAcceleratorTable(s.hAccel);
669 s.hAccel = CreateAcceleratorTable(pAccel.GetData(), pAccel.GetCount());
671 GetParentFrame()->m_hAccelTable = s.hAccel;
673 s.fWinLirc = !!m_fWinLirc;
674 s.WinLircAddr = m_WinLircAddr;
675 if(s.fWinLirc) s.WinLircClient.Connect(m_WinLircAddr);
676 s.fUIce = !!m_fUIce;
677 s.UIceAddr = m_UIceAddr;
678 if(s.fUIce) s.UIceClient.Connect(m_UIceAddr);
680 return __super::OnApply();
683 void CPPageAccelTbl::OnBnClickedButton1()
685 m_list.SetFocus();
687 for(int i = 0, j = m_list.GetItemCount(); i < j; i++)
689 m_list.SetItemState(i, LVIS_SELECTED, LVIS_SELECTED);
693 void CPPageAccelTbl::OnBnClickedButton2()
695 m_list.SetFocus();
697 POSITION pos = m_list.GetFirstSelectedItemPosition();
698 if(!pos) return;
700 AppSettings& s = AfxGetAppSettings();
702 while(pos)
704 wmcmd& wc = m_wmcmds.GetAt((POSITION)m_list.GetItemData(m_list.GetNextSelectedItem(pos)));
705 wc.Restore();
708 SetupList();
710 SetModified();
713 void CPPageAccelTbl::OnBeginlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
715 LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
716 LV_ITEM* pItem = &pDispInfo->item;
718 *pResult = FALSE;
720 if(pItem->iItem < 0)
721 return;
723 if(pItem->iSubItem == COL_MOD || pItem->iSubItem == COL_KEY || pItem->iSubItem == COL_TYPE
724 || pItem->iSubItem == COL_MOUSE || pItem->iSubItem == COL_APPCMD
725 || pItem->iSubItem == COL_RMCMD || pItem->iSubItem == COL_RMREPCNT)
727 *pResult = TRUE;
731 static BYTE s_mods[] = {0,FALT,FCONTROL,FSHIFT,FCONTROL|FALT,FCONTROL|FSHIFT,FALT|FSHIFT,FCONTROL|FALT|FSHIFT};
733 void CPPageAccelTbl::OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
735 LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
736 LV_ITEM* pItem = &pDispInfo->item;
738 *pResult = FALSE;
740 if(pItem->iItem < 0)
741 return;
743 wmcmd& wc = m_wmcmds.GetAt((POSITION)m_list.GetItemData(pItem->iItem));
744 ACCEL& a = wc;
746 CAtlList<CString> sl;
747 int nSel = -1;
749 if(pItem->iSubItem == COL_MOD)
751 for(int i = 0; i < countof(s_mods); i++)
753 sl.AddTail(MakeAccelModLabel(s_mods[i]));
754 if((a.fVirt&~3) == s_mods[i]) nSel = i;
757 m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
759 *pResult = TRUE;
761 else if(pItem->iSubItem == COL_KEY)
763 for(int i = 0; i < 256; i++)
765 sl.AddTail(MakeAccelVkeyLabel(i, a.fVirt&FVIRTKEY));
766 if(a.key == i) nSel = i;
769 m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
771 *pResult = TRUE;
773 else if(pItem->iSubItem == COL_TYPE)
775 sl.AddTail(_T("VIRTKEY"));
776 sl.AddTail(_T("ASCII"));
778 nSel = !(a.fVirt&FVIRTKEY);
780 m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
782 *pResult = TRUE;
784 else if(pItem->iSubItem == COL_MOUSE)
786 for(UINT i = 0; i < wmcmd::LAST; i++)
788 sl.AddTail(MakeMouseButtonLabel(i));
789 if(wc.mouse == i) nSel = i;
792 m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
794 *pResult = TRUE;
796 else if(pItem->iSubItem == COL_APPCMD)
798 for(int i = 0; i <= APPCOMMAND_LAST; i++)
800 sl.AddTail(MakeAppCommandLabel(i));
801 if(wc.appcmd == i) nSel = i;
804 m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
806 *pResult = TRUE;
808 else if(pItem->iSubItem == COL_RMCMD)
810 m_list.ShowInPlaceEdit(pItem->iItem, pItem->iSubItem);
812 *pResult = TRUE;
814 else if(pItem->iSubItem == COL_RMREPCNT)
816 m_list.ShowInPlaceEdit(pItem->iItem, pItem->iSubItem);
818 *pResult = TRUE;
822 void CPPageAccelTbl::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
824 LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
825 LV_ITEM* pItem = &pDispInfo->item;
827 *pResult = FALSE;
829 if(!m_list.m_fInPlaceDirty)
830 return;
832 if(pItem->iItem < 0)
833 return;
835 wmcmd& wc = m_wmcmds.GetAt((POSITION)m_list.GetItemData(pItem->iItem));
837 if(pItem->iSubItem == COL_MOD)
839 if(pItem->lParam >= 0 && pItem->lParam < countof(s_mods))
841 wc.fVirt = (wc.fVirt&3) | (s_mods[pItem->lParam]&~3);
842 m_list.SetItemText(pItem->iItem, COL_MOD, pItem->pszText);
843 *pResult = TRUE;
846 else if(pItem->iSubItem == COL_KEY)
848 int i = pItem->lParam;
849 if(i >= 0 && i < 256)
851 wc.key = (WORD)i;
852 m_list.SetItemText(pItem->iItem, COL_KEY, pItem->pszText);
853 *pResult = TRUE;
856 else if(pItem->iSubItem == COL_TYPE)
858 int i = pItem->lParam;
859 if(i >= 0 && i < 2)
861 wc.fVirt = (wc.fVirt&~FVIRTKEY) | (i == 0 ? FVIRTKEY : 0);
862 m_list.SetItemText(pItem->iItem, COL_KEY, MakeAccelVkeyLabel(wc.key, wc.fVirt&FVIRTKEY));
863 m_list.SetItemText(pItem->iItem, COL_TYPE, (wc.fVirt&FVIRTKEY)?_T("VIRTKEY"):_T("ASCII"));
864 *pResult = TRUE;
867 else if(pItem->iSubItem == COL_APPCMD)
869 int i = pItem->lParam;
870 if(i >= 0 && i <= APPCOMMAND_LAST)
872 wc.appcmd = (WORD)i;
873 m_list.SetItemText(pItem->iItem, COL_APPCMD, pItem->pszText);
874 *pResult = TRUE;
877 else if(pItem->iSubItem == COL_MOUSE)
879 wc.mouse = pItem->lParam;
880 m_list.SetItemText(pItem->iItem, COL_MOUSE, pItem->pszText);
882 else if(pItem->iSubItem == COL_RMCMD)
884 wc.rmcmd = CStringA(CString(pItem->pszText)).Trim();
885 wc.rmcmd.Replace(' ', '_');
886 m_list.SetItemText(pItem->iItem, pItem->iSubItem, CString(wc.rmcmd));
887 *pResult = TRUE;
889 else if(pItem->iSubItem == COL_RMREPCNT)
891 CString str = CString(pItem->pszText).Trim();
892 wc.rmrepcnt = _tcstol(str, NULL, 10);
893 str.Format(_T("%d"), wc.rmrepcnt);
894 m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
895 *pResult = TRUE;
898 if(*pResult)
899 SetModified();
903 void CPPageAccelTbl::OnTimer(UINT nIDEvent)
905 UpdateData();
907 if(m_fWinLirc)
909 CString addr;
910 m_WinLircEdit.GetWindowText(addr);
911 AfxGetAppSettings().WinLircClient.Connect(addr);
914 m_WinLircEdit.Invalidate();
916 if(m_fUIce)
918 CString addr;
919 m_UIceEdit.GetWindowText(addr);
920 AfxGetAppSettings().UIceClient.Connect(addr);
923 m_UIceEdit.Invalidate();
925 m_counter++;
927 __super::OnTimer(nIDEvent);
930 HBRUSH CPPageAccelTbl::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
932 HBRUSH hbr = __super::OnCtlColor(pDC, pWnd, nCtlColor);
934 int status = -1;
936 if(*pWnd == m_WinLircEdit)
937 status = AfxGetAppSettings().WinLircClient.GetStatus();
938 else if(*pWnd == m_UIceEdit)
939 status = AfxGetAppSettings().UIceClient.GetStatus();
941 if(status == 0 || status == 2 && (m_counter&1))
942 pDC->SetTextColor(0x0000ff);
943 else if(status == 1)
944 pDC->SetTextColor(0x008000);
946 return hbr;
949 BOOL CPPageAccelTbl::OnSetActive()
951 SetTimer(1, 1000, NULL);
953 return CPPageBase::OnSetActive();
956 BOOL CPPageAccelTbl::OnKillActive()
958 KillTimer(1);
960 return CPPageBase::OnKillActive();