annotate src/win32/CmdAccelOb.cpp @ 2:3549bbe597ed

adding makefile.am
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:47 -0600
parents f9f4f1b99eed
children
rev   line source
rlm@1 1 ////////////////////////////////////////////////////////////////////////////////
rlm@1 2 // Copyright (C) 1998 by Thierry Maurel
rlm@1 3 // All rights reserved
rlm@1 4 //
rlm@1 5 // Distribute freely, except: don't remove my name from the source or
rlm@1 6 // documentation (don't take credit for my work), mark your changes (don't
rlm@1 7 // get me blamed for your possible bugs), don't alter or remove this
rlm@1 8 // notice.
rlm@1 9 // No warrantee of any kind, express or implied, is included with this
rlm@1 10 // software; use at your own risk, responsibility for damages (if any) to
rlm@1 11 // anyone resulting from the use of this software rests entirely with the
rlm@1 12 // user.
rlm@1 13 //
rlm@1 14 // Send bug reports, bug fixes, enhancements, requests, flames, etc., and
rlm@1 15 // I'll try to keep a version up to date. I can be reached as follows:
rlm@1 16 // tmaurel@caramail.com (or tmaurel@hol.fr)
rlm@1 17 //
rlm@1 18 ////////////////////////////////////////////////////////////////////////////////
rlm@1 19 // File : CmdAccelOb.cpp
rlm@1 20 // Project : AccelsEditor
rlm@1 21 ////////////////////////////////////////////////////////////////////////////////
rlm@1 22 // Version : 1.0 * Author : T.Maurel
rlm@1 23 // Date : 17.08.98
rlm@1 24 //
rlm@1 25 // Remarks :
rlm@1 26 //
rlm@1 27 ////////////////////////////////////////////////////////////////////////////////
rlm@1 28 // modified by the VBA-rr team
rlm@1 29
rlm@1 30 #include "stdafx.h"
rlm@1 31 #include "CmdAccelOb.h"
rlm@1 32
rlm@1 33 ////////////////////////////////////////////////////////////////////////
rlm@1 34 //
rlm@1 35 //
rlm@1 36 MAPVIRTKEYS mapVirtKeys[] = {
rlm@1 37 { VK_LBUTTON, "LBUTTON" },
rlm@1 38 { VK_RBUTTON, "RBUTTON" },
rlm@1 39 { VK_CANCEL, "Cancel" },
rlm@1 40 { VK_MBUTTON, "MBUTTON" },
rlm@1 41 { VK_BACK, "Backspace" },
rlm@1 42 { VK_TAB, "Tab" },
rlm@1 43 { VK_CLEAR, "Clear" },
rlm@1 44 { VK_RETURN, "Enter" },
rlm@1 45 { VK_SHIFT, "Shift" },
rlm@1 46 { VK_LSHIFT, "LShift" },
rlm@1 47 { VK_RSHIFT, "RShift" },
rlm@1 48 { VK_CONTROL, "Control" },
rlm@1 49 { VK_LCONTROL, "LControl" },
rlm@1 50 { VK_RCONTROL, "RControl" },
rlm@1 51 { VK_MENU, "Alt" },
rlm@1 52 { VK_LMENU, "LAlt" },
rlm@1 53 { VK_RMENU, "RAlt" },
rlm@1 54 { VK_PAUSE, "Pause" },
rlm@1 55 { VK_CAPITAL, "Caps Lock" },
rlm@1 56 { VK_ESCAPE, "Escape" },
rlm@1 57 { VK_SPACE, "Space" },
rlm@1 58 { VK_PRIOR, "Prior" },
rlm@1 59 { VK_NEXT, "Next" },
rlm@1 60 { VK_END, "End" },
rlm@1 61 { VK_HOME, "Home" },
rlm@1 62 { VK_LEFT, "Left" },
rlm@1 63 { VK_UP, "Up" },
rlm@1 64 { VK_RIGHT, "Right" },
rlm@1 65 { VK_DOWN, "Down" },
rlm@1 66 { VK_SELECT, "Select" },
rlm@1 67 { VK_PRINT, "Print" },
rlm@1 68 { VK_EXECUTE, "Execute" },
rlm@1 69 { VK_SNAPSHOT, "Snapshot" },
rlm@1 70 { VK_INSERT, "Insert" },
rlm@1 71 { VK_DELETE, "Delete" },
rlm@1 72 { VK_HELP, "Help" },
rlm@1 73 { WORD('0'), "0" },
rlm@1 74 { WORD('1'), "1" },
rlm@1 75 { WORD('2'), "2" },
rlm@1 76 { WORD('3'), "3" },
rlm@1 77 { WORD('4'), "4" },
rlm@1 78 { WORD('5'), "5" },
rlm@1 79 { WORD('6'), "6" },
rlm@1 80 { WORD('7'), "7" },
rlm@1 81 { WORD('8'), "8" },
rlm@1 82 { WORD('9'), "9" },
rlm@1 83 { WORD('A'), "A" },
rlm@1 84 { WORD('B'), "B" },
rlm@1 85 { WORD('C'), "C" },
rlm@1 86 { WORD('D'), "D" },
rlm@1 87 { WORD('E'), "E" },
rlm@1 88 { WORD('F'), "F" },
rlm@1 89 { WORD('G'), "G" },
rlm@1 90 { WORD('H'), "H" },
rlm@1 91 { WORD('I'), "I" },
rlm@1 92 { WORD('J'), "J" },
rlm@1 93 { WORD('K'), "K" },
rlm@1 94 { WORD('L'), "L" },
rlm@1 95 { WORD('M'), "M" },
rlm@1 96 { WORD('N'), "N" },
rlm@1 97 { WORD('O'), "O" },
rlm@1 98 { WORD('P'), "P" },
rlm@1 99 { WORD('Q'), "Q" },
rlm@1 100 { WORD('R'), "R" },
rlm@1 101 { WORD('S'), "S" },
rlm@1 102 { WORD('T'), "T" },
rlm@1 103 { WORD('U'), "U" },
rlm@1 104 { WORD('V'), "V" },
rlm@1 105 { WORD('W'), "W" },
rlm@1 106 { WORD('X'), "X" },
rlm@1 107 { WORD('Y'), "Y" },
rlm@1 108 { WORD('Z'), "Z" },
rlm@1 109 { VK_LWIN, "LWIN" },
rlm@1 110 { VK_RWIN, "RWIN" },
rlm@1 111 { VK_APPS, "APPS" },
rlm@1 112 { VK_NUMPAD0, "NumPad0" },
rlm@1 113 { VK_NUMPAD1, "NumPad1" },
rlm@1 114 { VK_NUMPAD2, "NumPad2" },
rlm@1 115 { VK_NUMPAD3, "NumPad3" },
rlm@1 116 { VK_NUMPAD4, "NumPad4" },
rlm@1 117 { VK_NUMPAD5, "NumPad5" },
rlm@1 118 { VK_NUMPAD6, "NumPad6" },
rlm@1 119 { VK_NUMPAD7, "NumPad7" },
rlm@1 120 { VK_NUMPAD8, "NumPad8" },
rlm@1 121 { VK_NUMPAD9, "NumPad9" },
rlm@1 122 { VK_MULTIPLY, "NumpadMultiply" },
rlm@1 123 { VK_ADD, "NumpadAdd" },
rlm@1 124 { VK_SEPARATOR, "Separator" },
rlm@1 125 { VK_SUBTRACT, "NumpadSubtract" },
rlm@1 126 { VK_DECIMAL, "NumpadDecimal" },
rlm@1 127 { VK_DIVIDE, "NumpadDivide" },
rlm@1 128 { VK_F1, "F1" },
rlm@1 129 { VK_F2, "F2" },
rlm@1 130 { VK_F3, "F3" },
rlm@1 131 { VK_F4, "F4" },
rlm@1 132 { VK_F5, "F5" },
rlm@1 133 { VK_F6, "F6" },
rlm@1 134 { VK_F7, "F7" },
rlm@1 135 { VK_F8, "F8" },
rlm@1 136 { VK_F9, "F9" },
rlm@1 137 { VK_F10, "F10" },
rlm@1 138 { VK_F11, "F11" },
rlm@1 139 { VK_F12, "F12" },
rlm@1 140 { VK_F13, "F13" },
rlm@1 141 { VK_F14, "F14" },
rlm@1 142 { VK_F15, "F15" },
rlm@1 143 { VK_F16, "F16" },
rlm@1 144 { VK_F17, "F17" },
rlm@1 145 { VK_F18, "F18" },
rlm@1 146 { VK_F19, "F19" },
rlm@1 147 { VK_F20, "F20" },
rlm@1 148 { VK_F21, "F21" },
rlm@1 149 { VK_F22, "F22" },
rlm@1 150 { VK_F23, "F23" },
rlm@1 151 { VK_F24, "F24" },
rlm@1 152 { VK_NUMLOCK, "Num Lock" },
rlm@1 153 { VK_SCROLL, "Scroll Lock" },
rlm@1 154 { VK_ATTN, "Attention" },
rlm@1 155 { VK_CRSEL, "CRSEL" },
rlm@1 156 { VK_EXSEL, "EXSEL" },
rlm@1 157 { VK_EREOF, "EREOF" },
rlm@1 158 { VK_PLAY, "Play" },
rlm@1 159 { VK_ZOOM, "Zoom" },
rlm@1 160 { VK_NONAME, "No Name" },
rlm@1 161 { VK_PA1, "PA1" },
rlm@1 162 { VK_OEM_CLEAR, "Clear2" },
rlm@1 163 { VK_OEM_1, "Semicolon;" },
rlm@1 164 { VK_OEM_2, "Slash/" },
rlm@1 165 { VK_OEM_3, "Tilde~" },
rlm@1 166 { VK_OEM_4, "LBracket[" },
rlm@1 167 { VK_OEM_5, "Backslash\\" },
rlm@1 168 { VK_OEM_6, "RBracket]" },
rlm@1 169 { VK_OEM_7, "Apostrophe'" },
rlm@1 170 { VK_OEM_8, "OEM8" },
rlm@1 171 { VK_OEM_PLUS, "Plus+" },
rlm@1 172 { VK_OEM_MINUS, "Minus-" },
rlm@1 173 { VK_OEM_COMMA, "Comma," },
rlm@1 174 { VK_OEM_PERIOD, "Period." },
rlm@1 175 { VK_OEM_AX, "Apostrophe`" },
rlm@1 176 { VK_OEM_102, "<> or \\|" },
rlm@1 177 { VK_ICO_HELP, "ICO Help" },
rlm@1 178 { VK_ICO_00, "ICO 00" },
rlm@1 179 { VK_OEM_FJ_JISHO, "JISHO" },
rlm@1 180 { VK_OEM_FJ_MASSHOU, "MASSHOU" },
rlm@1 181 { VK_OEM_FJ_TOUROKU, "TOUROKU" },
rlm@1 182 { VK_OEM_FJ_LOYA, "LOYA" },
rlm@1 183 { VK_OEM_FJ_ROYA, "ROYA" },
rlm@1 184 { VK_OEM_NEC_EQUAL, "Numpad Equals" },
rlm@1 185 };
rlm@1 186
rlm@1 187 ////////////////////////////////////////////////////////////////////////
rlm@1 188 //
rlm@1 189 //
rlm@1 190 MAPVIRTKEYS mapVirtSysKeys[] = {
rlm@1 191 { FCONTROL, "Ctrl" },
rlm@1 192 { FALT, "Alt" },
rlm@1 193 { FSHIFT, "Shift" },
rlm@1 194 };
rlm@1 195
rlm@1 196 ////////////////////////////////////////////////////////////////////////
rlm@1 197 // helper fct for external access
rlm@1 198 ////////////////////////////////////////////////////////////////////////
rlm@1 199 //
rlm@1 200 //
rlm@1 201 TCHAR *mapVirtKeysStringFromWORD(WORD wKey)
rlm@1 202 {
rlm@1 203 for (int index = 0; index < sizeof(mapVirtKeys) / sizeof(mapVirtKeys[0]); index++)
rlm@1 204 {
rlm@1 205 if (mapVirtKeys[index].wKey == wKey)
rlm@1 206 return mapVirtKeys[index].szKey;
rlm@1 207 }
rlm@1 208 return NULL;
rlm@1 209 }
rlm@1 210
rlm@1 211 ////////////////////////////////////////////////////////////////////////
rlm@1 212 //
rlm@1 213 #define DEFAULT_ACCEL 0x01
rlm@1 214 #define USER_ACCEL 0x02
rlm@1 215
rlm@1 216 ////////////////////////////////////////////////////////////////////////
rlm@1 217 //
rlm@1 218 ////////////////////////////////////////////////////////////////////////
rlm@1 219 //
rlm@1 220 //
rlm@1 221 CAccelsOb::CAccelsOb()
rlm@1 222 {
rlm@1 223 m_cVirt = 0;
rlm@1 224 m_wKey = 0;
rlm@1 225 m_bLocked = false;
rlm@1 226 }
rlm@1 227
rlm@1 228 ////////////////////////////////////////////////////////////////////////
rlm@1 229 //
rlm@1 230 //
rlm@1 231 CAccelsOb::CAccelsOb(CAccelsOb *pFrom)
rlm@1 232 {
rlm@1 233 ASSERT(pFrom != NULL);
rlm@1 234
rlm@1 235 m_cVirt = pFrom->m_cVirt;
rlm@1 236 m_wKey = pFrom->m_wKey;
rlm@1 237 m_bLocked = pFrom->m_bLocked;
rlm@1 238 }
rlm@1 239
rlm@1 240 ////////////////////////////////////////////////////////////////////////
rlm@1 241 //
rlm@1 242 //
rlm@1 243 CAccelsOb::CAccelsOb(BYTE cVirt, WORD wKey, bool bLocked)
rlm@1 244 {
rlm@1 245 m_cVirt = cVirt;
rlm@1 246 m_wKey = wKey;
rlm@1 247 m_bLocked = bLocked;
rlm@1 248 }
rlm@1 249
rlm@1 250 ////////////////////////////////////////////////////////////////////////
rlm@1 251 //
rlm@1 252 //
rlm@1 253 CAccelsOb::CAccelsOb(LPACCEL pACCEL)
rlm@1 254 {
rlm@1 255 ASSERT(pACCEL != NULL);
rlm@1 256
rlm@1 257 m_cVirt = pACCEL->fVirt;
rlm@1 258 m_wKey = pACCEL->key;
rlm@1 259 m_bLocked = false;
rlm@1 260 }
rlm@1 261
rlm@1 262 ////////////////////////////////////////////////////////////////////////
rlm@1 263 //
rlm@1 264 //
rlm@1 265 CAccelsOb & CAccelsOb::operator=(const CAccelsOb &from)
rlm@1 266 {
rlm@1 267 m_cVirt = from.m_cVirt;
rlm@1 268 m_wKey = from.m_wKey;
rlm@1 269 m_bLocked = from.m_bLocked;
rlm@1 270
rlm@1 271 return *this;
rlm@1 272 }
rlm@1 273
rlm@1 274 ////////////////////////////////////////////////////////////////////////
rlm@1 275 //
rlm@1 276 ////////////////////////////////////////////////////////////////////////
rlm@1 277 //
rlm@1 278 //
rlm@1 279 void CAccelsOb::GetString(CString &szBuffer)
rlm@1 280 {
rlm@1 281 szBuffer = "";
rlm@1 282
rlm@1 283 // modifiers part
rlm@1 284 for (int i = 0; i < sizetable(mapVirtSysKeys); i++)
rlm@1 285 {
rlm@1 286 if (m_cVirt & mapVirtSysKeys[i].wKey)
rlm@1 287 {
rlm@1 288 szBuffer += mapVirtSysKeys[i].szKey;
rlm@1 289 if (m_wKey)
rlm@1 290 szBuffer += "+";
rlm@1 291 }
rlm@1 292 }
rlm@1 293
rlm@1 294 // in case of the object is not assigned, we avoid error messages
rlm@1 295 if (m_wKey == 0)
rlm@1 296 return;
rlm@1 297
rlm@1 298 // and virtual key part
rlm@1 299 for (int i = 0; i < sizetable(mapVirtKeys); i++)
rlm@1 300 {
rlm@1 301 if (m_wKey == mapVirtKeys[i].wKey)
rlm@1 302 {
rlm@1 303 szBuffer += mapVirtKeys[i].szKey;
rlm@1 304 return;
rlm@1 305 }
rlm@1 306 }
rlm@1 307
rlm@1 308 AfxMessageBox("Internal error : (CAccelsOb::GetString) m_wKey invalid");
rlm@1 309 }
rlm@1 310
rlm@1 311 ////////////////////////////////////////////////////////////////////////
rlm@1 312 //
rlm@1 313 //
rlm@1 314 bool CAccelsOb::IsEqual(WORD wKey, bool bCtrl, bool bAlt, bool bShift)
rlm@1 315 {
rlm@1 316 bool m_bCtrl = (m_cVirt & FCONTROL) ? true : false;
rlm@1 317 bool m_bAlt = (m_cVirt & FALT) ? true : false;
rlm@1 318 bool m_bShift = (m_cVirt & FSHIFT) ? true : false;
rlm@1 319
rlm@1 320 bool bRet = (bCtrl == m_bCtrl) && (bAlt == m_bAlt) && (bShift == m_bShift) && (m_wKey == wKey);
rlm@1 321
rlm@1 322 return bRet;
rlm@1 323 }
rlm@1 324
rlm@1 325 ////////////////////////////////////////////////////////////////////////
rlm@1 326 //
rlm@1 327 //
rlm@1 328 DWORD CAccelsOb::GetData()
rlm@1 329 {
rlm@1 330 BYTE cLocalCodes = 0;
rlm@1 331 if (m_bLocked)
rlm@1 332 cLocalCodes = DEFAULT_ACCEL;
rlm@1 333 else
rlm@1 334 cLocalCodes = USER_ACCEL;
rlm@1 335
rlm@1 336 WORD bCodes = MAKEWORD(m_cVirt, cLocalCodes);
rlm@1 337 return MAKELONG(m_wKey, bCodes);
rlm@1 338 }
rlm@1 339
rlm@1 340 ////////////////////////////////////////////////////////////////////////
rlm@1 341 //
rlm@1 342 //
rlm@1 343 bool CAccelsOb::SetData(DWORD dwDatas)
rlm@1 344 {
rlm@1 345 m_wKey = LOWORD(dwDatas);
rlm@1 346
rlm@1 347 WORD bCodes = HIWORD(dwDatas);
rlm@1 348 m_cVirt = LOBYTE(bCodes);
rlm@1 349
rlm@1 350 BYTE cLocalCodes = HIBYTE(bCodes);
rlm@1 351 m_bLocked = (cLocalCodes == DEFAULT_ACCEL);
rlm@1 352
rlm@1 353 return true;
rlm@1 354 }
rlm@1 355
rlm@1 356 ////////////////////////////////////////////////////////////////////////
rlm@1 357 //
rlm@1 358 #ifdef _DEBUG
rlm@1 359 ////////////////////////////////////////////////////////////////////////
rlm@1 360 //
rlm@1 361 //
rlm@1 362 void CAccelsOb::AssertValid() const
rlm@1 363 {
rlm@1 364 CObject::AssertValid();
rlm@1 365 }
rlm@1 366
rlm@1 367 ////////////////////////////////////////////////////////////////////////
rlm@1 368 //
rlm@1 369 //
rlm@1 370 void CAccelsOb::Dump(CDumpContext &dc) const
rlm@1 371 {
rlm@1 372 dc << "\t\t";
rlm@1 373 CObject::Dump(dc);
rlm@1 374 dc << "\t\tlocked=" << m_bLocked << ", cVirt=" << m_cVirt << ", wKey=" << m_wKey << "\n\n";
rlm@1 375 }
rlm@1 376
rlm@1 377 #endif
rlm@1 378
rlm@1 379 ////////////////////////////////////////////////////////////////////////
rlm@1 380 //
rlm@1 381 ////////////////////////////////////////////////////////////////////////
rlm@1 382 //
rlm@1 383 //
rlm@1 384 CCmdAccelOb::CCmdAccelOb()
rlm@1 385 {}
rlm@1 386
rlm@1 387 ////////////////////////////////////////////////////////////////////////
rlm@1 388 //
rlm@1 389 //
rlm@1 390 CCmdAccelOb::CCmdAccelOb(WORD wIDCommand, LPCTSTR szCommand)
rlm@1 391 {
rlm@1 392 ASSERT(szCommand != NULL);
rlm@1 393
rlm@1 394 m_wIDCommand = wIDCommand;
rlm@1 395 m_szCommand = szCommand;
rlm@1 396 }
rlm@1 397
rlm@1 398 ////////////////////////////////////////////////////////////////////////
rlm@1 399 //
rlm@1 400 //
rlm@1 401 CCmdAccelOb::CCmdAccelOb(BYTE cVirt, WORD wIDCommand, WORD wKey, LPCTSTR szCommand, bool bLocked)
rlm@1 402 {
rlm@1 403 ASSERT(szCommand != NULL);
rlm@1 404
rlm@1 405 m_wIDCommand = wIDCommand;
rlm@1 406 m_szCommand = szCommand;
rlm@1 407
rlm@1 408 CAccelsOb *pAccel = new CAccelsOb(cVirt, wKey, bLocked);
rlm@1 409 ASSERT(pAccel != NULL);
rlm@1 410 m_Accels.AddTail(pAccel);
rlm@1 411 }
rlm@1 412
rlm@1 413 ////////////////////////////////////////////////////////////////////////
rlm@1 414 //
rlm@1 415 //
rlm@1 416 CCmdAccelOb::~CCmdAccelOb()
rlm@1 417 {
rlm@1 418 POSITION pos = m_Accels.GetHeadPosition();
rlm@1 419 while (pos != NULL)
rlm@1 420 delete m_Accels.GetNext(pos);
rlm@1 421 m_Accels.RemoveAll();
rlm@1 422 }
rlm@1 423
rlm@1 424 ////////////////////////////////////////////////////////////////////////
rlm@1 425 //
rlm@1 426 ////////////////////////////////////////////////////////////////////////
rlm@1 427 //
rlm@1 428 //
rlm@1 429 void CCmdAccelOb::Add(BYTE cVirt, WORD wKey, bool bLocked)
rlm@1 430 {
rlm@1 431 CAccelsOb *pAccel = new CAccelsOb(cVirt, wKey, bLocked);
rlm@1 432 ASSERT(pAccel != NULL);
rlm@1 433 m_Accels.AddTail(pAccel);
rlm@1 434 }
rlm@1 435
rlm@1 436 ////////////////////////////////////////////////////////////////////////
rlm@1 437 //
rlm@1 438 //
rlm@1 439 void CCmdAccelOb::Add(CAccelsOb *pAccel)
rlm@1 440 {
rlm@1 441 ASSERT(pAccel != NULL);
rlm@1 442 m_Accels.AddTail(pAccel);
rlm@1 443 }
rlm@1 444
rlm@1 445 ////////////////////////////////////////////////////////////////////////
rlm@1 446 //
rlm@1 447 //
rlm@1 448 CCmdAccelOb & CCmdAccelOb::operator=(const CCmdAccelOb &from)
rlm@1 449 {
rlm@1 450 Reset();
rlm@1 451
rlm@1 452 m_wIDCommand = from.m_wIDCommand;
rlm@1 453 m_szCommand = from.m_szCommand;
rlm@1 454
rlm@1 455 CAccelsOb *pAccel;
rlm@1 456 POSITION pos = from.m_Accels.GetHeadPosition();
rlm@1 457 while (pos != NULL)
rlm@1 458 {
rlm@1 459 pAccel = new CAccelsOb(from.m_Accels.GetNext(pos));
rlm@1 460 ASSERT(pAccel != NULL);
rlm@1 461 m_Accels.AddTail(pAccel);
rlm@1 462 }
rlm@1 463 return *this;
rlm@1 464 }
rlm@1 465
rlm@1 466 ////////////////////////////////////////////////////////////////////////
rlm@1 467 //
rlm@1 468 //
rlm@1 469 void CCmdAccelOb::DeleteUserAccels()
rlm@1 470 {
rlm@1 471 CAccelsOb *pAccel;
rlm@1 472 POSITION prevPos;
rlm@1 473 POSITION pos = m_Accels.GetHeadPosition();
rlm@1 474 while (pos != NULL)
rlm@1 475 {
rlm@1 476 prevPos = pos;
rlm@1 477 pAccel = m_Accels.GetNext(pos);
rlm@1 478 if (!pAccel->m_bLocked)
rlm@1 479 {
rlm@1 480 delete pAccel;
rlm@1 481 m_Accels.RemoveAt(prevPos);
rlm@1 482 }
rlm@1 483 }
rlm@1 484 }
rlm@1 485
rlm@1 486 ////////////////////////////////////////////////////////////////////////
rlm@1 487 //
rlm@1 488 //
rlm@1 489 void CCmdAccelOb::Reset()
rlm@1 490 {
rlm@1 491 m_wIDCommand = 0;
rlm@1 492 m_szCommand = "Empty command";
rlm@1 493
rlm@1 494 CAccelsOb *pAccel;
rlm@1 495 POSITION pos = m_Accels.GetHeadPosition();
rlm@1 496 while (pos != NULL)
rlm@1 497 {
rlm@1 498 pAccel = m_Accels.GetNext(pos);
rlm@1 499 delete pAccel;
rlm@1 500 }
rlm@1 501 }
rlm@1 502
rlm@1 503 ////////////////////////////////////////////////////////////////////////
rlm@1 504 //
rlm@1 505 #ifdef _DEBUG
rlm@1 506 ////////////////////////////////////////////////////////////////////////
rlm@1 507 //
rlm@1 508 //
rlm@1 509 void CCmdAccelOb::AssertValid() const
rlm@1 510 {
rlm@1 511 // call base class function first
rlm@1 512 CObject::AssertValid();
rlm@1 513 }
rlm@1 514
rlm@1 515 ////////////////////////////////////////////////////////////////////////
rlm@1 516 //
rlm@1 517 //
rlm@1 518 void CCmdAccelOb::Dump(CDumpContext &dc) const
rlm@1 519 {
rlm@1 520 // call base class function first
rlm@1 521 dc << "\t";
rlm@1 522 CObject::Dump(dc);
rlm@1 523
rlm@1 524 // now do the stuff for our specific class
rlm@1 525 dc << "\tIDCommand = " << m_wIDCommand;
rlm@1 526 dc << "\n\tszCommand = " << m_szCommand;
rlm@1 527 dc << "\n\tAccelerators = {\n";
rlm@1 528
rlm@1 529 CAccelsOb *pAccel;
rlm@1 530 POSITION pos = m_Accels.GetHeadPosition();
rlm@1 531 while (pos != NULL)
rlm@1 532 {
rlm@1 533 pAccel = m_Accels.GetNext(pos);
rlm@1 534 dc << pAccel;
rlm@1 535 }
rlm@1 536 dc << "\t}\n";
rlm@1 537 }
rlm@1 538
rlm@1 539 #endif