Changeset 824 for trunk/dll/mainwnd.c
- Timestamp:
- Sep 1, 2007, 1:12:20 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/mainwnd.c
r789 r824 41 41 19 Aug 07 SHL Move #pragma alloc_text to end of file for OpenWatcom 42 42 19 Aug 07 SHL Rework SaveDirCnrState to return better error info 43 30 Aug 07 SHL Add accelerator support to quicklist windows 43 44 44 45 ***********************************************************************/ … … 504 505 { 505 506 PFNWP oldproc = (PFNWP) INSTDATA(hwnd); 506 static HWND hwndMenu = (HWND) 0;507 507 USHORT id; 508 509 static HWND hwndMenu = (HWND)0; 508 510 static BOOL emphasized = FALSE; 509 511 … … 523 525 } 524 526 break; 527 528 case WM_FOCUSCHANGE: 529 { 530 HAB hab = WinQueryAnchorBlock(hwnd); 531 HWND hwndParent = WinQueryWindow(hwnd, QW_PARENT); 532 HWND hwndFrame = WinQueryWindow(hwndParent, QW_PARENT); 533 static HACCEL haccelSaved = NULLHANDLE; 534 static HACCEL haccelDriveList = NULLHANDLE; 535 static HACCEL haccelSetupList = NULLHANDLE; 536 static HACCEL haccelUserList = NULLHANDLE; 537 static HACCEL haccelCmdList = NULLHANDLE; 538 static HACCEL haccelButtonList = NULLHANDLE; 539 // DbgMsg(pszSrcFile, __LINE__, "WM_FOCUSCHANGE %u", SHORT1FROMMP(mp2)); 540 id = WinQueryWindowUShort(hwndParent, QWS_ID); 541 if (SHORT1FROMMP(mp2)) { 542 // If getting focus 1st time - save original accelerator 543 if (haccelSaved == NULLHANDLE) { 544 haccelSaved = WinQueryAccelTable(hab, hwndFrame); 545 if (haccelSaved == NULLHANDLE) 546 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryAccelTable"); 547 // else 548 // DbgMsg(pszSrcFile, __LINE__, "WinQueryAccelTable SAVED %x", haccelSaved); 549 } 550 if (haccelSaved != NULLHANDLE) { 551 switch (id) { 552 case MAIN_DRIVELIST: 553 if (haccelDriveList == NULLHANDLE) { 554 haccelDriveList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_DRIVELIST); 555 if (haccelDriveList == NULLHANDLE) 556 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 557 } 558 if (haccelDriveList != NULLHANDLE) { 559 if (!WinSetAccelTable(hab, haccelDriveList, hwndFrame)) 560 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 561 // else 562 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_DRIVELIST %x %x", hwndFrame, haccelDriveList); 563 } 564 break; 565 case MAIN_SETUPLIST: 566 if (haccelSetupList == NULLHANDLE) { 567 haccelSetupList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_SETUPLIST); 568 if (haccelSetupList == NULLHANDLE) 569 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 570 } 571 if (haccelSetupList != NULLHANDLE) { 572 if (!WinSetAccelTable(hab, haccelSetupList, hwndFrame)) 573 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 574 // else 575 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_SETUPLIST %x %x", hwndFrame, haccelSetupList); 576 } 577 break; 578 case MAIN_CMDLIST: 579 if (haccelCmdList == NULLHANDLE) { 580 haccelCmdList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_CMDLIST); 581 if (haccelCmdList == NULLHANDLE) 582 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 583 } 584 if (haccelCmdList != NULLHANDLE) { 585 if (!WinSetAccelTable(hab, haccelCmdList, hwndFrame)) 586 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 587 // else 588 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_CMDLIST %x %x", hwndFrame, haccelCmdList); 589 } 590 break; 591 case MAIN_USERLIST: 592 if (haccelUserList == NULLHANDLE) { 593 haccelUserList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_USERLIST); 594 if (haccelUserList == NULLHANDLE) 595 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 596 } 597 if (haccelUserList != NULLHANDLE) { 598 if (!WinSetAccelTable(hab, haccelUserList, hwndFrame)) 599 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 600 // else 601 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_USERLIST %x %x", hwndFrame, haccelUserList); 602 } 603 break; 604 case MAIN_BUTTONLIST: 605 if (haccelButtonList == NULLHANDLE) { 606 haccelButtonList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_BUTTONLIST); 607 if (haccelButtonList == NULLHANDLE) 608 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 609 } 610 if (haccelButtonList != NULLHANDLE) { 611 if (!WinSetAccelTable(hab, haccelButtonList, hwndFrame)) 612 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 613 // else 614 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_BUTTONLIST %x %x", hwndFrame, haccelButtonList); 615 } 616 break; 617 } // switch 618 } 619 } 620 else { 621 // Losing focus 622 switch (id) { 623 case MAIN_DRIVELIST: 624 case MAIN_SETUPLIST: 625 case MAIN_CMDLIST: 626 case MAIN_USERLIST: 627 case MAIN_BUTTONLIST: 628 if (haccelSaved != NULLHANDLE) { 629 if (!WinSetAccelTable(hab, haccelSaved, hwndFrame)) 630 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 631 // else 632 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable SAVED %x %x", hwndFrame, haccelSaved); 633 } 634 break; 635 } // switch 636 } 637 } 638 break; // WM_FOCUSCHANGE 525 639 526 640 case WM_CONTEXTMENU: … … 553 667 ret = FALSE; 554 668 break; 555 } 669 } // switch 556 670 return ret; 557 671 } … … 4033 4147 SetShiftState(); 4034 4148 switch (SHORT1FROMMP(mp1)) { 4149 4150 case IDM_CONTEXTMENU: 4151 { 4152 HWND hwnd = WinQueryFocus(HWND_DESKTOP); 4153 // DbgMsg(pszSrcFile, __LINE__, "IDM_CONTEXTMENU %x", hwnd); 4154 if (hwnd != NULLHANDLE) { 4155 HWND hwndParent = WinQueryWindow(hwnd, QW_PARENT); 4156 USHORT id = WinQueryWindowUShort(hwndParent, QWS_ID); 4157 switch (id) { 4158 case MAIN_SETUPLIST: 4159 case MAIN_USERLIST: 4160 case MAIN_CMDLIST: 4161 // DbgMsg(pszSrcFile, __LINE__, "WM_CONTEXTMENU"); 4162 WinPostMsg(hwnd, WM_CONTEXTMENU, 0, 0); 4163 } 4164 } 4165 } 4166 break; 4167 4035 4168 case IDM_SETTARGET: 4036 4169 SetTargetDir(hwnd, FALSE); … … 4865 4998 } 4866 4999 } 4867 break; 4868 } 5000 break; // default 5001 } // switch mp1 4869 5002 return 0; 4870 5003 } … … 5021 5154 if (!hwndStatelist) 5022 5155 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5156 5023 5157 hwndDrivelist = WinCreateWindow(hwndFrame, 5024 5158 WC_COMBOBOX,
Note:
See TracChangeset
for help on using the changeset viewer.