Changeset 1335 for trunk/dll/mainwnd.c
- Timestamp:
- Dec 13, 2008, 12:49:02 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/mainwnd.c
r1333 r1335 1 1 2 /*********************************************************************** 2 3 … … 59 60 07 Jul 08 JBS Ticket 242: Delete obsolete INI keys when re-saving a state 60 61 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating 61 62 62 all the details view settings (both the global variables and those in the 63 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS. 63 64 12 Jul 08 JBS Ticket 246: Allow saved directory container states to have no directory containers 64 65 65 (i.e. just a directory tree container). 66 18 Jul 08 SHL Use new Fortify feature to avoid spurious reports 66 67 19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory 67 68 26 Aug 08 GKY Require unique ID plus text and help strings for all tools save toolbar on button delete … … 71 72 29 Nov 08 GKY Remove or replace with a mutex semaphore DosEnterCriSec where appropriate. 72 73 04 Dec 08 GKY Use event semaphore to prevent scan of "last" directory container prior to 73 tree scan completion; prevents duplicate directory names in tree. 74 tree scan completion; prevents duplicate directory names in tree. 75 10 Dec 08 SHL Integrate exception handler support 74 76 75 77 ***********************************************************************/ … … 78 80 #include <string.h> 79 81 #include <ctype.h> 80 #include <process.h>// _beginthread82 // #include <process.h> // _beginthread 81 83 82 84 #define INCL_DOS … … 112 114 #include "cmdline.h" // CmdLine2DlgProc, save_cmdlines 113 115 #include "common.h" // CommonCreateMainChildren, CommonDriveCmd, CommonMainWndProc 114 116 // CommonTextButton 115 117 #include "notify.h" // DoNotify, HideNote, ShowNote 116 118 #include "draglist.h" // DragOne … … 120 122 #include "fm2cmd.h" // FM2Command 121 123 #include "misc.h" // FindDirCnr, FixSwitchList, PaintSTextWindow, 122 123 124 124 // SetConditionalCascade, SetMenuCheck, SetSysMenu 125 // SwitchCommand, CheckMenu, DrawTargetEmphasis 126 // IsFm2Window 125 127 #include "instant.h" // InstantDlgProc 126 128 #include "killproc.h" // KillDlgProc … … 132 134 #include "viewinf.h" // ViewInfProc 133 135 #include "walkem.h" // WalkDlgProc, WalkTwoCmpDlgProc, add_setup, add_udir 134 135 136 // fill_setups_list, free_ldir, free_udirs, load_udirs 137 // remove_setup, remove_udir, save_setups, save_udirs 136 138 #include "winlist.h" // WindowList 137 139 #include "cmdline.h" // add_cmdline … … 152 154 #include "fortify.h" 153 155 #include "filldir.h" // StubbyScanCount 156 #include "excputil.h" // xbeginthread 154 157 155 158 static BOOL CloseDirCnrChildren(HWND hwndClient); … … 209 212 210 213 static MRESULT EXPENTRY MainObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1, 211 214 MPARAM mp2) 212 215 { 213 216 switch (msg) { … … 238 241 *dv = 0; 239 242 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwndB, QW_PARENT), 240 243 id + 50), sizeof(dv), dv); 241 244 d = toupper(*dv); 242 245 if (isalpha(d) && d > 'B' && 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 246 !(driveflags[d - 'A'] & (DRIVE_CDROM | DRIVE_INVALID | 247 DRIVE_SLOW)) && 248 (!hwndBubble || 249 WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) && 250 !WinQueryCapture(HWND_DESKTOP)) { 251 252 FSALLOCATE fsa; 253 CHAR s[90], szQty[38]; 254 ULONG ulPctFree; 255 ULONGLONG ullFreeQty; 256 257 if (!DosQueryFSInfo((d - 'A') + 1, 258 FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) { 259 ullFreeQty = (ULONGLONG) fsa.cUnitAvail * 260 (fsa.cSectorUnit * fsa.cbSector); 261 ulPctFree = (fsa.cUnit && fsa.cUnitAvail) ? 262 (fsa.cUnitAvail * 100) / fsa.cUnit : 0; 263 CommaFmtULL(szQty, sizeof(szQty), ullFreeQty, ' '); 264 sprintf(s, "%s (%lu%%) free", szQty, ulPctFree); 265 } 266 if ((!hwndBubble || 267 WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) && 268 !WinQueryCapture(HWND_DESKTOP)) 269 WinSendMsg(hwndB, UM_SETUP6, MPFROMP(s), MPVOID); 267 270 } 268 271 } … … 275 278 276 279 if (DosQuerySysInfo(QSV_BOOT_DRIVE, 277 278 279 280 QSV_BOOT_DRIVE, 281 (PVOID) & bd, (ULONG) sizeof(ULONG))) 282 bd = 3L; 280 283 *s = (CHAR) bd + '@'; 281 284 WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPFROMLONG(1)); 282 285 if (!mp1) { 283 284 286 s[3] = 0; 287 WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPVOID); 285 288 } 286 289 PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMLONG(1), MPFROMLONG(1)); … … 340 343 DosError(FERR_DISABLEHARDERR); 341 344 WinRegisterClass(hab2, 342 343 345 (PSZ) WC_OBJECTWINDOW, 346 MainObjectWndProc, 0, sizeof(PVOID)); 344 347 MainObjectHwnd = WinCreateWindow(HWND_OBJECT, 345 346 347 348 349 350 351 352 348 WC_OBJECTWINDOW, 349 (PSZ) NULL, 350 0, 351 0L, 352 0L, 353 0L, 354 0L, 355 0L, HWND_TOP, OBJ_FRAME, NULL, NULL); 353 356 if (!MainObjectHwnd) 354 355 357 Win_Error2(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__, 358 IDS_WINCREATEWINDOW); 356 359 else { 357 360 WinSetWindowPtr(MainObjectHwnd, QWL_USER, args); 358 361 # ifdef FORTIFY 359 362 Fortify_EnterScope(); 360 363 # endif 361 362 363 364 while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0)) 365 WinDispatchMsg(hab2, &qmsg2); 366 WinDestroyWindow(MainObjectHwnd); 364 367 # ifdef FORTIFY 365 368 Fortify_LeaveScope(); 366 369 # endif 367 370 } … … 373 376 374 377 static MRESULT EXPENTRY IdealButtonProc(HWND hwnd, ULONG msg, MPARAM mp1, 375 378 MPARAM mp2) 376 379 { 377 380 switch (msg) { … … 393 396 while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) { 394 397 if (hwndC != exclude) { 395 396 397 398 id = WinQueryWindowUShort(hwndC, QWS_ID); 399 if (id) 400 break; 398 401 } 399 402 } … … 415 418 henum = WinBeginEnumWindows(hwndMain); 416 419 while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) { 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 420 //saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu",hwndTree,exclude,hwndC); 421 if (hwndC != exclude && hwndC != hwndTree) { 422 id = WinQueryWindowUShort(hwndC, QWS_ID); 423 if (id) { 424 hwndClient = WinWindowFromID(hwndC, FID_CLIENT); 425 if (hwndClient) { 426 hwndDir = WinWindowFromID(hwndClient, DIR_CNR); 427 if (hwndDir) { 428 if (fLookInDir) { 429 pci = (PCNRITEM) WinSendMsg(hwndDir, 430 CM_QUERYRECORDEMPHASIS, 431 MPFROMLONG(CMA_FIRST), 432 MPFROMSHORT(CRA_CURSORED)); 433 if (pci && (INT) pci != -1) 434 break; 435 } 436 if (WinSendMsg(hwndClient, 437 UM_CONTAINERDIR, MPFROMP(ret), MPVOID)) { 438 MakeValidDir(ret); 439 //saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu\r\"%s\"",hwndTree,exclude,hwndC,ret); 440 WinEndEnumWindows(henum); 441 return hwndC; 442 } 443 } 444 } 445 } 446 } 444 447 } 445 448 WinEndEnumWindows(henum); 446 449 if (!pci || (INT) pci == -1) { 447 448 449 450 451 452 453 450 hwndC = hwndTree; 451 pci = (PCNRITEM) WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree, 452 FID_CLIENT), 453 TREE_CNR), 454 CM_QUERYRECORDEMPHASIS, 455 MPFROMLONG(CMA_FIRST), 456 MPFROMSHORT(CRA_CURSORED)); 454 457 } 455 458 if (pci && (INT) pci != -1) { 456 457 459 strcpy(ret, pci->pszFileName); 460 MakeValidDir(ret); 458 461 } 459 462 else 460 463 strcpy(ret, pFM2SaveDirectory); 461 464 } 462 465 } … … 476 479 hwndDir = WinWindowFromID(hwndC, DIR_CNR); 477 480 if (hwndDir) 478 481 ret++; 479 482 } 480 483 } … … 494 497 hwndC = WinWindowFromID(hwndF, FID_CLIENT); 495 498 if (hwndC) { 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 499 hwndDir = WinWindowFromID(hwndC, DIR_CNR); 500 if (hwndDir) { 501 *retstr = 0; 502 WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(retstr), MPVOID); 503 if (*retstr && !stricmp(retstr, directory)) { 504 if (restore) 505 WinSetWindowPos(hwndF, 506 HWND_TOP, 507 0, 508 0, 509 0, 510 0, 511 SWP_RESTORE | SWP_SHOW | 512 SWP_ACTIVATE | SWP_ZORDER); 513 break; 514 } 515 } 513 516 } 514 517 } … … 577 580 while (tool) { 578 581 if (!(tool->flags & T_INVISIBLE)) { 579 580 581 582 583 584 585 586 587 588 589 582 swp[x].x = butx; 583 if (fTextTools || (tool->flags & T_TEXT)) { 584 butx += 55L; 585 swp[x].cx = 54L; 586 swp[x].cy = 24L; 587 swp[x].y = 3L; 588 } 589 else 590 butx += 33L; 591 if (tool->flags & T_SEPARATOR) 592 butx += 12; 590 593 } 591 594 else 592 595 swp[x].fl = noattrib; 593 596 swp[x].hwnd = WinWindowFromID(hwnd, tool->id); 594 597 x++; … … 599 602 swp[x].x = butx; 600 603 if (!(tool->flags & T_INVISIBLE)) { 601 602 603 604 605 606 607 608 609 610 604 if (fTextTools || (tool->flags & T_TEXT)) { 605 butx += 55L; 606 swp[x].cx = 54L; 607 swp[x].cy = 24L; 608 swp[x].y = 3L; 609 } 610 else 611 butx += 33L; 612 if (tool->flags & T_SEPARATOR) 613 butx += 12; 611 614 } 612 615 else 613 616 swp[x].fl = noattrib; 614 617 swp[x].hwnd = WinWindowFromID(hwnd, tool->id); 615 618 x++; … … 619 622 if (!fTextTools && fToolTitles) { 620 623 for (x = 2L; x < numtools + 2L; x++) { 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 624 if (fTextTools || !fToolTitles) 625 swp[x].fl = noattrib; 626 else { 627 tool = find_tool(WinQueryWindowUShort(swp[x].hwnd, QWS_ID)); 628 if (tool && (tool->flags & T_TEXT)) 629 swp[x].fl = noattrib; 630 else { 631 swp[x].hwndInsertBehind = HWND_TOP; 632 swp[x].y = 1L; 633 swp[x].cy = 10L; 634 } 635 } 636 swp[x].hwnd = WinWindowFromID(hwnd, 637 WinQueryWindowUShort(swp[x].hwnd, 638 QWS_ID) + 25000); 636 639 } 637 640 WinSetMultWindowPos(WinQueryAnchorBlock(hwnd), &swp[2], numtools); … … 643 646 644 647 static MRESULT EXPENTRY DropDownListProc(HWND hwnd, ULONG msg, MPARAM mp1, 645 648 MPARAM mp2) 646 649 { 647 650 PFNWP oldproc = (PFNWP) INSTDATA(hwnd); … … 681 684 id = WinQueryWindowUShort(hwndParent, QWS_ID); 682 685 if (SHORT1FROMMP(mp2)) { 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 686 // If getting focus 1st time - save original accelerator 687 if (haccelSaved == NULLHANDLE) { 688 haccelSaved = WinQueryAccelTable(hab, hwndFrame); 689 if (haccelSaved == NULLHANDLE) 690 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryAccelTable"); 691 // else 692 // DbgMsg(pszSrcFile, __LINE__, "WinQueryAccelTable SAVED %x", haccelSaved); 693 } 694 if (haccelSaved != NULLHANDLE) { 695 switch (id) { 696 case MAIN_DRIVELIST: 697 if (haccelDriveList == NULLHANDLE) { 698 haccelDriveList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_DRIVELIST); 699 if (haccelDriveList == NULLHANDLE) 700 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 701 } 702 if (haccelDriveList != NULLHANDLE) { 703 if (!WinSetAccelTable(hab, haccelDriveList, hwndFrame)) 704 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 705 // else 706 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_DRIVELIST %x %x", hwndFrame, haccelDriveList); 707 } 708 break; 709 case MAIN_SETUPLIST: 710 if (haccelSetupList == NULLHANDLE) { 711 haccelSetupList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_SETUPLIST); 712 if (haccelSetupList == NULLHANDLE) 713 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 714 } 715 if (haccelSetupList != NULLHANDLE) { 716 if (!WinSetAccelTable(hab, haccelSetupList, hwndFrame)) 717 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 718 // else 719 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_SETUPLIST %x %x", hwndFrame, haccelSetupList); 720 } 721 break; 722 case MAIN_CMDLIST: 723 if (haccelCmdList == NULLHANDLE) { 724 haccelCmdList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_CMDLIST); 725 if (haccelCmdList == NULLHANDLE) 726 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 727 } 728 if (haccelCmdList != NULLHANDLE) { 729 if (!WinSetAccelTable(hab, haccelCmdList, hwndFrame)) 730 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 731 // else 732 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_CMDLIST %x %x", hwndFrame, haccelCmdList); 733 } 734 break; 735 case MAIN_USERLIST: 736 if (haccelUserList == NULLHANDLE) { 737 haccelUserList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_USERLIST); 738 if (haccelUserList == NULLHANDLE) 739 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 740 } 741 if (haccelUserList != NULLHANDLE) { 742 if (!WinSetAccelTable(hab, haccelUserList, hwndFrame)) 743 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 744 // else 745 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_USERLIST %x %x", hwndFrame, haccelUserList); 746 } 747 break; 748 case MAIN_BUTTONLIST: 749 if (haccelButtonList == NULLHANDLE) { 750 haccelButtonList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_BUTTONLIST); 751 if (haccelButtonList == NULLHANDLE) 752 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 753 } 754 if (haccelButtonList != NULLHANDLE) { 755 if (!WinSetAccelTable(hab, haccelButtonList, hwndFrame)) 756 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 757 // else 758 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_BUTTONLIST %x %x", hwndFrame, haccelButtonList); 759 } 760 break; 761 } // switch 762 } 760 763 } 761 764 else { 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 765 // Losing focus 766 switch (id) { 767 case MAIN_DRIVELIST: 768 case MAIN_SETUPLIST: 769 case MAIN_CMDLIST: 770 case MAIN_USERLIST: 771 case MAIN_BUTTONLIST: 772 if (haccelSaved != NULLHANDLE) { 773 if (!WinSetAccelTable(hab, haccelSaved, hwndFrame)) 774 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 775 // else 776 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable SAVED %x %x", hwndFrame, haccelSaved); 777 } 778 break; 779 } // switch 777 780 } 778 781 } … … 784 787 785 788 if (hwndMenu) 786 789 WinDestroyWindow(hwndMenu); 787 790 hwndMenu = (HWND) 0; 788 791 id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID); 789 792 switch (id) { 790 793 case MAIN_CMDLIST: 791 792 793 794 795 796 794 WinPostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 795 QW_PARENT), 796 QW_PARENT), 797 FID_CLIENT), 798 WM_COMMAND, MPFROM2SHORT(IDM_EDITCOMMANDS, 0), MPVOID); 799 break; 797 800 case MAIN_USERLIST: 798 801 case MAIN_SETUPLIST: 799 800 801 802 803 804 805 806 802 hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id); 803 if (hwndMenu) 804 PopupMenu(hwnd, 805 WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 806 QW_PARENT), 807 QW_PARENT), 808 FID_CLIENT), hwndMenu); 809 break; 807 810 default: 808 809 811 ret = FALSE; 812 break; 810 813 } // switch 811 814 return ret; … … 816 819 switch (SHORT1FROMMP(mp1)) { 817 820 case CBID_EDIT: 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 821 id = WinQueryWindowUShort(hwnd, QWS_ID); 822 switch (SHORT2FROMMP(mp1)) { 823 case EN_SETFOCUS: 824 switch (id) { 825 case MAIN_CMDLIST: 826 WinSetWindowText(hwndStatus2, GetPString(IDS_CMDLISTHELP)); 827 break; 828 case MAIN_SETUPLIST: 829 WinSetWindowText(hwndStatus2, GetPString(IDS_SETUPLISTHELP)); 830 break; 831 case MAIN_USERLIST: 832 WinSetWindowText(hwndStatus2, GetPString(IDS_USERLISTHELP)); 833 break; 834 case MAIN_DRIVELIST: 835 WinSetWindowText(hwndStatus2, GetPString(IDS_DRIVELISTHELP)); 836 break; 837 case MAIN_BUTTONLIST: 838 WinSetWindowText(hwndStatus2, GetPString(IDS_BUTTONLISTHELP)); 839 break; 840 default: 841 break; 842 } 843 break; 844 845 default: 846 break; 847 } 845 848 } 846 849 break; … … 855 858 // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"%u %s %u",id,(id == CBID_EDIT) ? "TRUE" : "FALSE",WinQueryWindowUShort(WinQueryWindow(hwnd,QW_PARENT),QWS_ID) == MAIN_USERLIST); 856 859 if (id == CBID_EDIT && 857 858 860 WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID) == 861 MAIN_USERLIST) { 859 862 860 863 CHAR path[CCHMAXPATH]; … … 865 868 // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Dragging: %s",path); 866 869 if (*path && !IsRoot(path)) 867 870 DragOne(hwnd, (HWND) 0, path, FALSE); 868 871 return 0; 869 872 } … … 874 877 if (id == MAIN_USERLIST) { 875 878 if (!emphasized) { 876 877 879 emphasized = TRUE; 880 DrawTargetEmphasis(hwnd, emphasized); 878 881 } 879 882 if (AcceptOneDrop(hwnd, mp1, mp2)) 880 883 return MRFROM2SHORT(DOR_DROP, DO_MOVE); 881 884 return MRFROM2SHORT(DOR_NEVERDROP, 0); 882 885 } … … 887 890 if (id == MAIN_USERLIST) { 888 891 if (emphasized) { 889 890 892 emphasized = FALSE; 893 DrawTargetEmphasis(hwnd, emphasized); 891 894 } 892 895 } … … 908 911 909 912 if (emphasized) { 910 911 913 emphasized = FALSE; 914 DrawTargetEmphasis(hwnd, emphasized); 912 915 } 913 916 if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) { 914 915 916 917 918 919 920 921 917 MakeValidDir(szFrom); 918 WinSetWindowText(hwnd, szFrom); 919 PostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 920 QW_PARENT), 921 QW_PARENT), 922 FID_CLIENT), 923 UM_COMMAND, MPFROM2SHORT(IDM_ADDTOUSERLIST, 0), MPVOID); 924 return 0; 922 925 } 923 926 } … … 940 943 (other && fOtherHelp) || (!other && !drive && fToolbarHelp))) { 941 944 if ((!hwndBubble || 942 943 945 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) && 946 !WinQueryCapture(HWND_DESKTOP)) 944 947 MakeBubble(hwnd, above, help); 945 948 } … … 962 965 /* don't bring up help if window isn't active */ 963 966 if (!WinIsChild(hwnd, hwndActive)) 964 967 return; 965 968 } 966 969 hwndActive = WinQueryFocus(HWND_DESKTOP); … … 968 971 /* don't bring up help if a menu is active */ 969 972 if (!strcmp(ucClassname, "#4")) 970 973 return; 971 974 } 972 975 } 973 976 974 977 hwndBubble = WinCreateWindow(HWND_DESKTOP, 975 976 977 978 979 980 981 982 983 978 WC_BUBBLE, 979 help, 980 WS_CLIPSIBLINGS | SS_TEXT | 981 DT_CENTER | DT_VCENTER, 982 0, 983 0, 984 0, 985 0, 986 HWND_DESKTOP, HWND_TOP, MAIN_HELP, NULL, NULL); 984 987 if (!hwndBubble) 985 988 Win_Error2(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, 986 989 IDS_WINCREATEWINDOW); 987 990 else { 988 991 HPS hps; … … 1004 1007 pp = strchr(p, '\r'); 1005 1008 if (pp) { 1006 1007 1008 1009 wp = pp; 1010 *pp = 0; 1011 pp++; 1009 1012 } 1010 1013 GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl); 1011 1014 tptl.x = max(aptl[TXTBOX_TOPRIGHT].x, tptl.x); 1012 1015 if (tptl.y) 1013 1016 tptl.y += extra; 1014 1017 else 1015 1018 extra = aptl[TXTBOX_TOPLEFT].y / 4; 1016 1019 tptl.y += aptl[TXTBOX_TOPLEFT].y; 1017 1020 if (wp) 1018 1021 *wp = '\r'; 1019 1022 p = pp; 1020 1023 } … … 1026 1029 sy = ptl.y + swp.cy + 4; 1027 1030 if (sy + tptl.y + 12 > lyScreen) { 1028 1029 1031 above = FALSE; 1032 sy = ptl.y - (tptl.y + 14); 1030 1033 } 1031 1034 } … … 1043 1046 sy = ptl.y + swp.cy + 4; 1044 1047 if (sy + tptl.y + 12 > lyScreen) 1045 1048 sy = 0; 1046 1049 } 1047 1050 WinSetWindowPos(hwndBubble, HWND_TOP, sx, sy, 1048 1049 1050 1051 1051 tptl.x + 14, 1052 tptl.y + 12, 1053 SWP_DEACTIVATE | SWP_SHOW | SWP_ZORDER | 1054 SWP_MOVE | SWP_SIZE); 1052 1055 } 1053 1056 } … … 1075 1078 WinQueryPointerPos(HWND_DESKTOP, &ptl); 1076 1079 if (WinWindowFromPoint(HWND_DESKTOP, &ptl, TRUE) != 1077 1078 1080 WinQueryWindowULong(hwnd, QWL_USER) || !WinIsWindowVisible(hwnd)) 1081 WinDestroyWindow(hwnd); 1079 1082 } 1080 1083 return 0; … … 1090 1093 hps = WinBeginPaint(hwnd, (HPS) 0, NULL); 1091 1094 if (hps) { 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1095 WinQueryWindowPos(hwnd, &swp); 1096 GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, 0); 1097 GpiSetColor(hps, ((255 << 16) | (255 << 8) | 198)); 1098 GpiSetBackMix(hps, BM_LEAVEALONE); 1099 GpiSetMix(hps, FM_OVERPAINT); 1100 ptl.x = ptl.y = 0; 1101 GpiMove(hps, &ptl); 1102 ptl.x = swp.cx - 1; 1103 ptl.y = swp.cy - 1; 1104 GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0); 1105 tlen = WinQueryWindowTextLength(hwnd); 1106 if (tlen) { 1107 s = xmalloc(tlen + 2, pszSrcFile, __LINE__); 1108 if (s) { 1109 WinQueryWindowText(hwnd, tlen + 1, s); 1110 if (*s) { 1111 p = s; 1112 y = swp.cy - 3; 1113 extra = WinQueryWindowULong(hwnd, QWL_USER + 4); 1114 GpiSetColor(hps, 0); 1115 GpiSetMix(hps, FM_OVERPAINT); 1116 while (p && *p) { 1117 wp = NULL; 1118 pp = strchr(p, '\r'); 1119 if (pp) { 1120 wp = pp; 1121 *pp = 0; 1122 pp++; 1123 } 1124 GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl); 1125 ptl.x = 7; 1126 y -= aptl[TXTBOX_TOPLEFT].y; 1127 if (p != s) 1128 y -= extra; 1129 ptl.y = y; 1130 GpiCharStringAt(hps, &ptl, strlen(p), p); 1131 if (wp) 1132 *wp = '\r'; 1133 p = pp; 1134 } 1135 } 1136 free(s); 1137 } 1138 } 1139 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)) && swp.cx > 6 && swp.cy > 6) { 1140 GpiSetColor(hps, CLR_WHITE); 1141 ptl.x = 1; 1142 ptl.y = 1; 1143 GpiMove(hps, &ptl); 1144 ptl.y = swp.cy - 2; 1145 GpiLine(hps, &ptl); 1146 ptl.x = swp.cx - 2; 1147 GpiLine(hps, &ptl); 1148 ptl.x = 2; 1149 ptl.y = 2; 1150 GpiMove(hps, &ptl); 1151 ptl.y = swp.cy - 3; 1152 GpiLine(hps, &ptl); 1153 ptl.x = swp.cx - 3; 1154 GpiLine(hps, &ptl); 1155 GpiSetColor(hps, CLR_BROWN); 1156 ptl.x = 1; 1157 ptl.y = 1; 1158 GpiMove(hps, &ptl); 1159 ptl.x = swp.cx - 2; 1160 GpiLine(hps, &ptl); 1161 ptl.y = swp.cy - 2; 1162 GpiLine(hps, &ptl); 1163 ptl.x = 2; 1164 ptl.y = 2; 1165 GpiMove(hps, &ptl); 1166 ptl.x = swp.cx - 3; 1167 GpiLine(hps, &ptl); 1168 ptl.y = swp.cy - 3; 1169 GpiLine(hps, &ptl); 1170 } 1171 WinEndPaint(hps); 1169 1172 } 1170 1173 } … … 1193 1196 switch (WinQueryWindowUShort(hwnd, QWS_ID)) { 1194 1197 case MAIN_LED: 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1198 hps = WinGetPS(hwnd); 1199 hbmold = (HBITMAP) WinSendMsg(hwnd, SM_QUERYHANDLE, MPVOID, MPVOID); 1200 if (!fBlueLED) { 1201 hbmLEDon = GpiLoadBitmap(hps, 0, LEDON_BMP, 12, 12); 1202 hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF_BMP, 12, 12); 1203 } 1204 else { 1205 hbmLEDon = GpiLoadBitmap(hps, 0, LEDON2_BMP, 12, 12); 1206 hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF2_BMP, 12, 12); 1207 } 1208 if (hbmLEDoff && hbmLEDon) 1209 WinSendMsg(hwnd, SM_SETHANDLE, MPFROMLONG(hbmLEDoff), MPVOID); 1210 else { 1211 if (hbmLEDoff) 1212 GpiDeleteBitmap(hbmLEDoff); 1213 if (hbmLEDon) 1214 GpiDeleteBitmap(hbmLEDon); 1215 } 1216 if (hbmold && 1217 hbmLEDon && 1218 hbmLEDoff && hbmold != hbmLEDon && hbmold != hbmLEDoff) 1219 GpiDeleteBitmap(hbmold); 1220 if (hps) 1221 WinReleasePS(hps); 1222 break; 1220 1223 default: 1221 1222 1223 1224 1224 SetPresParams(hwnd, 1225 &RGBGREY, 1226 &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT)); 1227 break; 1225 1228 } 1226 1229 return mr; … … 1246 1249 case WM_BUTTON1CLICK: 1247 1250 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 1248 1251 WM_COMMAND, MPFROM2SHORT(IDM_SHOWNOTEWND, 0), MPVOID); 1249 1252 break; 1250 1253 1251 1254 case WM_BUTTON2CLICK: 1252 1255 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 1253 1256 WM_COMMAND, MPFROM2SHORT(IDM_HIDENOTEWND, 0), MPVOID); 1254 1257 break; 1255 1258 … … 1257 1260 case WM_BUTTON3CLICK: 1258 1261 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 1259 1262 WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID); 1260 1263 break; 1261 1264 } … … 1280 1283 if (fToolbarHelp) { 1281 1284 if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1285 && !WinQueryCapture(HWND_DESKTOP)) { 1286 id = WinQueryWindowUShort(hwnd, QWS_ID); 1287 tool = find_tool(id); 1288 if (tool && tool->help && *tool->help) { 1289 1290 char s[128]; 1291 1292 strcpy(s, tool->help); 1293 if (tool->flags & T_DROPABLE) 1294 strcat(s, GetPString(IDS_DROPONMETEXT)); 1295 MakeBubble(hwnd, FALSE, s); 1296 } 1294 1297 } 1295 1298 } … … 1300 1303 case IDM_HELP: 1301 1304 if (hwndHelp) 1302 1303 1304 1305 WinSendMsg(hwndHelp, 1306 HM_DISPLAY_HELP, 1307 MPFROM2SHORT(HELP_TOOLBAR, 0), MPFROMSHORT(HM_RESOURCEID)); 1305 1308 break; 1306 1309 … … 1308 1311 case IDM_HIDETOOL: /* hide tool */ 1309 1312 if (SHORT1FROMMP(mp1) == IDM_HIDETOOL) 1310 1313 id = WinQueryWindowUShort(hwnd, QWS_ID); 1311 1314 else 1312 1313 1314 1315 id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, 1316 PickToolProc, FM3ModHandle, 1317 PICKBTN_FRAME, GetPString(IDS_HIDETEXT)); 1315 1318 if (id) { 1316 1317 1318 1319 1320 1319 tool = find_tool(id); 1320 if (tool) { 1321 tool->flags |= T_INVISIBLE; 1322 save_tools(NULL); 1323 } 1321 1324 } 1322 1325 break; … … 1325 1328 tool = toolhead; 1326 1329 while (tool) { 1327 1328 1330 tool->flags &= (~T_INVISIBLE); 1331 tool = tool->next; 1329 1332 } 1330 1333 save_tools(NULL); … … 1334 1337 case IDM_DELETETOOL: /* delete button */ 1335 1338 if (SHORT1FROMMP(mp1) == IDM_DELETETOOL) 1336 1339 id = WinQueryWindowUShort(hwnd, QWS_ID); 1337 1340 else 1338 1339 1340 1341 id = 1342 (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle, 1343 PICKBTN_FRAME, GetPString(IDS_DELETETEXT)); 1341 1344 if (id) 1342 1343 1345 PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_SETUP, 1346 MPFROM2SHORT(id, 0), MPVOID); 1344 1347 return 0; 1345 1348 … … 1347 1350 case IDM_EDITTOOL: /* edit button */ 1348 1351 if (SHORT1FROMMP(mp1) == IDM_EDITTOOL) 1349 1352 id = WinQueryWindowUShort(hwnd, QWS_ID); 1350 1353 else 1351 1352 1353 1354 id = 1355 (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle, 1356 PICKBTN_FRAME, GetPString(IDS_EDITTEXT)); 1354 1357 if (id) { 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1358 tool = find_tool(id); 1359 if (tool) { 1360 if (WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle, 1361 ADDBTN_FRAME, (PVOID) tool)) 1362 WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 1363 QW_PARENT), 1364 QW_PARENT), FID_CLIENT), 1365 WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0), 1366 MPFROM2SHORT(id, 0)); 1367 } 1365 1368 } 1366 1369 break; … … 1368 1371 case IDM_ADDTOOL: /* add tool */ 1369 1372 id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle, 1370 1373 ADDBTN_FRAME, MPVOID); 1371 1374 if (id && id != (USHORT) - 1) 1372 1373 1374 1375 1376 1375 WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 1376 QW_PARENT), 1377 QW_PARENT), FID_CLIENT), 1378 WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0), 1379 MPFROM2SHORT(id, 0)); 1377 1380 break; 1378 1381 1379 1382 case IDM_REORDERTOOLS: /* reorder tools */ 1380 1383 WinDlgBox(HWND_DESKTOP, 1381 1384 hwnd, ReOrderToolsProc, FM3ModHandle, RE_FRAME, MPVOID); 1382 1385 break; 1383 1386 … … 1385 1388 case IDM_LOADTOOLS: 1386 1389 if (WinDlgBox(HWND_DESKTOP, 1387 1388 1389 1390 1391 1392 1393 1390 hwnd, 1391 ToolIODlgProc, 1392 FM3ModHandle, 1393 SVBTN_FRAME, 1394 (PVOID) (SHORT1FROMMP(mp1) == IDM_SAVETOOLS) ? 1395 "TRUE" : NULL)) 1396 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 1394 1397 break; 1395 1398 } … … 1425 1428 tool = find_tool(id); 1426 1429 if (!tool) { 1427 1428 1430 DrgFreeDraginfo(pDInfo); 1431 return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */ 1429 1432 } 1430 1433 if (!(tool->flags & T_DROPABLE)) { 1431 1432 1434 DrgFreeDraginfo(pDInfo); 1435 return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */ 1433 1436 } 1434 1437 { 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1438 PDRAGITEM pDItem; /* Pointer to DRAGITEM */ 1439 1440 pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */ 1441 0); /* Index to DRAGITEM */ 1442 if (DrgVerifyRMF(pDItem, /* Check valid rendering */ 1443 DRM_OS2FILE, /* mechanisms and data */ 1444 NULL)) { /* formats */ 1445 if (!(tool->flags & T_EMPHASIZED)) { 1446 tool->flags |= T_EMPHASIZED; 1447 DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0)); 1448 DrgFreeDraginfo(pDInfo); 1449 } 1450 return (MRFROM2SHORT(DOR_DROP, /* Return okay to drop */ 1451 DO_MOVE)); /* Move operation valid */ 1452 } 1453 DrgFreeDraginfo(pDInfo); 1451 1454 } 1452 1455 } … … 1465 1468 if (tool && (tool->flags & T_DROPABLE)) { 1466 1469 if (tool->flags & T_EMPHASIZED) { 1467 1468 1470 tool->flags &= (~T_EMPHASIZED); 1471 DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0)); 1469 1472 } 1470 1473 } … … 1479 1482 1480 1483 if (tool->flags & T_EMPHASIZED) { 1481 1482 1484 DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0)); 1485 tool->flags &= (~T_EMPHASIZED); 1483 1486 } 1484 1487 memset(&cdi, 0, sizeof(cdi)); … … 1487 1490 CheckPmDrgLimit(cdi.pDragInfo); 1488 1491 if (li) { 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1492 li->type = id; 1493 if (!li->list || !li->list[0]) 1494 FreeListInfo(li); 1495 else { 1496 HWND hwndActive; 1497 1498 hwndActive = TopWindow(hwndMain, (HWND) 0); 1499 if (hwndActive) { 1500 if (!WinSendMsg(hwndActive, UM_COMMAND, MPFROMP(li), MPVOID)) 1501 FreeListInfo(li); 1502 } 1503 else 1504 FreeListInfo(li); 1505 } 1503 1506 } 1504 1507 } … … 1538 1541 if (!fTextTools) { 1539 1542 if (!(tool->flags & T_MYICON)) { 1540 1541 1542 1543 1544 1545 1546 1547 1548 1543 hwndTool = WinCreateWindow(hwndT, 1544 WC_TOOLBUTTONS, 1545 s, 1546 BS_NOPOINTERFOCUS | 1547 BS_BITMAP | BS_PUSHBUTTON, 1548 ctrlxpos, 1549 14, 1550 32, 1551 32, hwndT, HWND_TOP, tool->id, NULL, NULL); 1549 1552 } 1550 1553 if (!hwndTool) { 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1554 HBITMAP hbm = LoadBitmapFromFileNum(tool->id); 1555 1556 if (hbm) { 1557 BTNCDATA btc; 1558 1559 memset(&btc, 0, sizeof(btc)); 1560 btc.cb = sizeof(btc); 1561 btc.hImage = hbm; 1562 hwndTool = WinCreateWindow(hwndT, 1563 WC_TOOLBUTTONS, 1564 NullStr, 1565 BS_NOPOINTERFOCUS | 1566 BS_BITMAP | BS_PUSHBUTTON, 1567 ctrlxpos, 1568 14, 1569 32, 1570 32, 1571 hwndT, HWND_TOP, tool->id, &btc, NULL); 1572 if (!hwndTool) 1573 GpiDeleteBitmap(hbm); 1574 } 1572 1575 } 1573 1576 if (hwndTool) 1574 1577 tool->flags &= (~T_TEXT); 1575 1578 } 1576 1579 if (!hwndTool) { 1577 1580 hwndTool = WinCreateWindow(hwndT, 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1581 WC_TOOLBUTTONS, 1582 (!tool->text && tool->id >= IDM_COMMANDSTART 1583 && tool->id < 1584 IDM_QUICKTOOLSTART) ? command_title(tool-> 1585 id - 1586 IDM_COMMANDSTART) 1587 : tool->text, 1588 BS_NOPOINTERFOCUS | BS_PUSHBUTTON, ctrlxpos, 1589 2, 54, 24, hwndT, HWND_TOP, tool->id, NULL, 1590 NULL); 1588 1591 if (!hwndTool) 1589 1590 1592 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 1593 IDS_WINCREATEWINDOW); 1591 1594 tool->flags |= T_TEXT; 1592 1595 } 1593 1596 if (fToolTitles && !fTextTools) { 1594 1597 hwndTool = WinCreateWindow(hwndT, 1595 1596 1597 1598 1599 1600 1601 1602 1603 1598 WC_STATIC, 1599 tool->text, 1600 SS_TEXT | DT_LEFT | DT_VCENTER, 1601 ctrlxpos, 1602 1, 1603 32, 1604 10, 1605 hwndT, 1606 HWND_TOP, tool->id + 25000, NULL, NULL); 1604 1607 if (!hwndTool) 1605 1606 1608 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 1609 IDS_WINCREATEWINDOW); 1607 1610 else { 1608 1609 1610 1611 SetPresParams(hwndTool, 1612 &RGBGREY, 1613 &RGBBLACK, &RGBGREY, GetPString(IDS_2SYSTEMVIOTEXT)); 1611 1614 } 1612 1615 } 1613 1616 ctrlxpos += ((tool->flags & T_TEXT) ? 55L : 33L); 1614 1617 SetPresParams(WinWindowFromID(hwndT, tool->id), 1615 1618 NULL, NULL, NULL, GetPString(IDS_8HELVTEXT)); 1616 1619 tool = tool->next; 1617 1620 } // while tool 1618 1621 1619 1622 hwndTool = WinCreateWindow(hwndT, 1620 1621 1622 1623 1624 1625 1626 1627 1623 WC_BUTTON, 1624 "#6010", 1625 BS_NOPOINTERFOCUS | 1626 BS_BITMAP | BS_PUSHBUTTON, 1627 1, 1628 19, 1629 14, 1630 13, hwndT, HWND_TOP, IDM_TOOLLEFT, NULL, NULL); 1628 1631 if (!hwndTool) 1629 1632 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 1630 1633 IDS_WINCREATEWINDOW); 1631 1634 hwndTool = 1632 1635 WinCreateWindow(hwndT, WC_BUTTON, "#6011", 1633 1634 1636 BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON, 1, 4, 14, 1637 13, hwndT, HWND_TOP, IDM_TOOLRIGHT, NULL, NULL); 1635 1638 if (!hwndTool) 1636 1639 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 1637 1640 IDS_WINCREATEWINDOW); 1638 1641 if (resize) 1639 1642 ResizeTools(hwndT); … … 1641 1644 1642 1645 static MRESULT EXPENTRY CommandLineProc(HWND hwnd, ULONG msg, MPARAM mp1, 1643 1646 MPARAM mp2) 1644 1647 { 1645 1648 PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER); … … 1658 1661 1659 1662 if (WinQueryWindowUShort((HWND) mp1, QWS_ID) == COMMAND_BUTTON) 1660 1663 break; 1661 1664 if (!WinQueryWindowProcess((HWND) mp1, &pid, &tid) || pid == mypid) 1662 1665 WinDestroyWindow(hwnd); 1663 1666 } 1664 1667 break; … … 1670 1673 pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 1671 1674 if (pszCmdLine) { 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1675 lbup = TRUE; 1676 if (WinDlgBox(HWND_DESKTOP, 1677 hwnd, 1678 CmdLine2DlgProc, 1679 FM3ModHandle, EXEC2_FRAME, MPFROMP(pszCmdLine))) { 1680 lstrip(pszCmdLine); 1681 WinSetWindowText(hwnd, pszCmdLine); 1682 } 1683 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID); 1684 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID); 1685 free(pszCmdLine); 1683 1686 } 1684 1687 } … … 1697 1700 case COMMAND_BUTTON: 1698 1701 if (!lbup) 1699 1702 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 1700 1703 break; 1701 1704 } … … 1716 1719 bstrip(cl + len); 1717 1720 if (strlen(cl) > len) { 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1721 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), 1722 UM_SETUP, MPFROMP(cl + len), MPVOID); 1723 WinQueryWindowText(hwndStatus, CCHMAXPATH, directory); 1724 bstrip(directory); 1725 if (*directory && (IsRoot(directory) || !IsFile(directory))) { 1726 if (!FM2Command(directory, cl + len)) { 1727 hwndCnr = TopWindow(hwndMain, (HWND) 0); 1728 if (hwndCnr) { 1729 hwndCnr = WinWindowFromID(hwndCnr, FID_CLIENT); 1730 if (hwndCnr) { 1731 hwndCnr = WinWindowFromID(hwndCnr, DIR_CNR); 1732 if (hwndCnr) 1733 list = BuildList(hwndCnr); 1734 } 1735 } 1736 WinSetActiveWindow(HWND_DESKTOP, hwndCnr); 1737 if (add_cmdline(cl + len, FALSE) && fSaveMiniCmds) 1738 save_cmdlines(FALSE); 1739 ExecOnList(hwndCnr, 1740 cl, 1741 WINDOWED | ((fKeepCmdLine) ? 1742 SEPARATEKEEP : SEPARATE), 1743 directory, list, NULL, pszSrcFile, __LINE__); 1744 xfree(list, pszSrcFile, __LINE__); 1745 WinDestroyWindow(hwnd); 1746 break; 1747 } 1748 } 1746 1749 } 1747 1750 WinSendMsg(hwnd, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID); … … 1752 1755 if (!lbup && !(SHORT1FROMMP(mp1) & KC_KEYUP)) { 1753 1756 if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) { 1754 1755 1756 1757 1758 1759 1757 if ((SHORT1FROMMP(mp2) & 255) == '\r') 1758 PostMsg(hwnd, UM_OPENWINDOWFORME, MPVOID, MPVOID); 1759 else if ((SHORT1FROMMP(mp2) & 0xff) == 0x1b) 1760 WinDestroyWindow(hwnd); 1761 else if (SHORT2FROMMP(mp2) == VK_UP || SHORT2FROMMP(mp2) == VK_DOWN) 1762 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 1760 1763 } 1761 1764 } 1762 1765 else if ((SHORT1FROMMP(mp1) & KC_VIRTUALKEY) && 1763 1764 1765 1766 ((SHORT2FROMMP(mp2) == VK_UP || 1767 SHORT2FROMMP(mp2) == VK_DOWN) || 1768 (SHORT1FROMMP(mp2) == '\x1b') || (SHORT1FROMMP(mp2) == '\r'))) 1766 1769 return 0; 1767 1770 break; … … 1789 1792 rgb.bRed = (BYTE)128; 1790 1793 SetPresParams(hwnd, 1791 1794 &RGBGREY, &rgb, &RGBGREY, GetPString(IDS_8HELVTEXT)); 1792 1795 SetTargetDir(hwnd, TRUE); 1793 1796 } … … 1819 1822 case WM_CONTROLPOINTER: 1820 1823 if (!fNoFinger && 1821 1822 1824 (SHORT1FROMMP(mp1) >= IDM_DRIVEA && 1825 SHORT1FROMMP(mp1) < IDM_DRIVEA + 26)) 1823 1826 return MRFROMLONG(hptrFinger); 1824 1827 break; … … 1830 1833 *dv = 0; 1831 1834 WinQueryWindowText(WinWindowFromID(hwnd, SHORT1FROMMP(mp1) + 50), 1832 1835 2, dv); 1833 1836 if (isalpha(*dv)) { 1834 1837 1835 1836 1837 1838 1839 1840 1841 1842 1843 1838 HWND hwndActive; 1839 1840 dv[1] = ':'; 1841 dv[2] = '\\'; 1842 dv[3] = 0; 1843 hwndActive = TopWindow(hwnd, (HWND) 0); 1844 if (hwndActive) 1845 WinSendMsg(WinWindowFromID(hwndActive, FID_CLIENT), 1846 UM_DRIVECMD, MPFROMP(dv), MPVOID); 1844 1847 } 1845 1848 } … … 1869 1872 case WM_MOUSEMOVE: 1870 1873 if (fDrivebarHelp && 1871 1872 1873 1874 (!hwndBubble || 1875 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) && 1876 !WinQueryCapture(HWND_DESKTOP)) { 1874 1877 id = WinQueryWindowUShort(hwnd, QWS_ID); 1875 1878 if (helpid != id) { 1876 1877 1879 helpid = id; 1880 PostMsg(MainObjectHwnd, UM_SETUP6, MPFROMLONG((ULONG) hwnd), MPVOID); 1878 1881 } 1879 1882 else 1880 1883 helpid = 0; 1881 1884 } 1882 1885 break; … … 1885 1888 if (helpid == WinQueryWindowUShort(hwnd, QWS_ID)) { 1886 1889 if ((char *)mp1 && 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1890 (!hwndBubble || 1891 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) && 1892 !WinQueryCapture(HWND_DESKTOP)) { 1893 1894 RECTL rcl; 1895 POINTL ptl; 1896 1897 WinQueryPointerPos(HWND_DESKTOP, &ptl); 1898 WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1); 1899 WinQueryWindowRect(hwnd, &rcl); 1900 if (WinPtInRect(WinQueryAnchorBlock(hwnd), &rcl, &ptl)) 1901 BubbleHelp(hwnd, FALSE, TRUE, FALSE, (char *)mp1); 1899 1902 } 1900 1903 } … … 1915 1918 *szDrv = 0; 1916 1919 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1917 1920 id + 50), sizeof(szDrv), szDrv); 1918 1921 if (isalpha(*szDrv)) { 1919 1922 hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, MAIN_DRIVES); 1920 1923 if (hwndMenu) { 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1924 BOOL rdy; 1925 CHAR chDrv = *szDrv; 1926 UINT iDrv; 1927 1928 strcpy(szDrv + 2, "\\"); 1929 MakeValidDir(szDrv); 1930 // Disable menus if MakeValidDir changes drive letter fixme this section doesn't do anything see treecnt.c 1931 rdy = toupper(*szDrv) == toupper(chDrv); 1932 iDrv = toupper(*szDrv) - 'A'; 1933 if (!rdy || ~driveflags[iDrv] & DRIVE_REMOTE) 1934 WinEnableMenuItem(hwndMenu, IDM_DETACH, FALSE); 1935 1936 if (!rdy || driveflags[iDrv] & DRIVE_NOTWRITEABLE) { 1937 WinEnableMenuItem(hwndMenu, IDM_MKDIR, FALSE); 1938 WinEnableMenuItem(hwndMenu, IDM_FORMAT, FALSE); 1939 WinEnableMenuItem(hwndMenu, IDM_OPTIMIZE, FALSE); 1940 WinEnableMenuItem(hwndMenu, IDM_UNDELETE, FALSE); 1941 } 1942 if (!rdy || ~driveflags[iDrv] & DRIVE_REMOVABLE) { 1943 WinEnableMenuItem(hwndMenu, IDM_EJECT, FALSE); 1944 WinEnableMenuItem(hwndMenu, IDM_LOCK, FALSE); 1945 WinEnableMenuItem(hwndMenu, IDM_UNLOCK, FALSE); 1946 } 1947 if (!rdy) { 1948 WinEnableMenuItem(hwndMenu, IDM_INFO, FALSE); 1949 WinEnableMenuItem(hwndMenu, IDM_ARCHIVE, FALSE); 1950 WinEnableMenuItem(hwndMenu, IDM_SIZES, FALSE); 1951 WinEnableMenuItem(hwndMenu, IDM_SHOWALLFILES, FALSE); 1952 WinEnableMenuItem(hwndMenu, IDM_CHKDSK, FALSE); 1953 } 1954 /* fixme to be gone? 1955 if (!rdy || ~driveflags[iDrv] & DRIVE_CDROM) { 1956 WinEnableMenuItem(hwndMenu, IDM_CLOSETRAY, FALSE); 1957 } 1958 */ 1959 PopupMenu(hwnd, hwnd, hwndMenu); 1957 1960 } 1958 1961 } … … 1969 1972 *szDrv = 0; 1970 1973 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1971 1974 id + 50), sizeof(szDrv), szDrv); 1972 1975 if (isalpha(*szDrv)) { 1973 1976 strcat(szDrv, "\\"); 1974 1977 if (!FindDirCnrByName(szDrv, TRUE)) 1975 1978 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szDrv); 1976 1979 } 1977 1980 break; … … 1985 1988 *szDrv = 0; 1986 1989 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1987 1990 id + 50), sizeof(szDrv), szDrv); 1988 1991 if (isalpha(*szDrv)) { 1989 1992 strcat(szDrv, "\\"); … … 1996 1999 *szDrv = 0; 1997 2000 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1998 2001 id + 50), sizeof(szDrv), szDrv); 1999 2002 if (isalpha(*szDrv) && 2000 2003 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) { 2001 2004 if (!emphasized) { 2002 2003 2005 emphasized = TRUE; 2006 DrawTargetEmphasis(hwnd, emphasized); 2004 2007 } 2005 2008 if (AcceptOneDrop(hwnd, mp1, mp2)) 2006 2009 return MRFROM2SHORT(DOR_DROP, DO_MOVE); 2007 2010 return MRFROM2SHORT(DOR_NEVERDROP, 0); 2008 2011 } … … 2013 2016 *szDrv = 0; 2014 2017 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2015 2018 id + 50), sizeof(szDrv), szDrv); 2016 2019 if (isalpha(*szDrv) && 2017 2020 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) { 2018 2021 if (emphasized) { 2019 2020 2022 emphasized = FALSE; 2023 DrawTargetEmphasis(hwnd, emphasized); 2021 2024 } 2022 2025 } … … 2027 2030 *szDrv = 0; 2028 2031 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2029 2032 id + 50), sizeof(szDrv), szDrv); 2030 2033 if (isalpha(*szDrv) && 2031 2034 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) { 2032 2035 DropHelp(mp1, mp2, hwnd, GetPString(IDS_DRIVEDROPHELP)); 2033 2036 return 0; … … 2039 2042 *szDrv = 0; 2040 2043 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2041 2044 id + 50), sizeof(szDrv), szDrv); 2042 2045 if (isalpha(*szDrv) && 2043 2046 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) { 2044 2047 2045 2048 CNRDRAGINFO cnd; … … 2048 2051 2049 2052 if (emphasized) { 2050 2051 2053 emphasized = FALSE; 2054 DrawTargetEmphasis(hwnd, emphasized); 2052 2055 } 2053 2056 memset(&cnd, 0, sizeof(cnd)); … … 2055 2058 cnd.pRecord = NULL; 2056 2059 li = DoFileDrop(hwnd, 2057 2058 2060 NULL, 2061 TRUE, MPFROM2SHORT(TREE_CNR, CN_DROP), MPFROMP(&cnd)); 2059 2062 CheckPmDrgLimit(cnd.pDragInfo); 2060 2063 if (li) { 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2064 strcpy(li->targetpath, szDrv); 2065 strcat(li->targetpath, "\\"); 2066 if (li->list && li->list[0] && IsRoot(li->list[0])) 2067 li->type = DO_LINK; 2068 else if (fDragndropDlg && (!*li->arcname || !li->info)) { 2069 2070 CHECKLIST cl; 2071 2072 memset(&cl, 0, sizeof(cl)); 2073 cl.size = sizeof(cl); 2074 cl.flags = li->type; 2075 cl.list = li->list; 2076 cl.cmd = li->type; 2077 cl.prompt = li->targetpath; 2078 li->type = WinDlgBox(HWND_DESKTOP, 2079 hwndMain, 2080 DropListProc, 2081 FM3ModHandle, DND_FRAME, MPFROMP(&cl)); 2082 if (li->type == DID_ERROR) 2083 Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__, 2084 "Drag & Drop Dialog"); 2085 if (!li->type) { 2086 FreeListInfo(li); 2087 return 0; 2088 } 2089 li->list = cl.list; 2090 if (!li->list || !li->list[0]) { 2091 FreeListInfo(li); 2092 return 0; 2093 } 2094 } 2095 else { 2096 if (!WinDlgBox(HWND_DESKTOP, 2097 hwndMain, 2098 WalkDlgProc, 2099 FM3ModHandle, 2100 WALK_FRAME, 2101 MPFROMP(li->targetpath)) || !*li->targetpath) { 2102 FreeListInfo(li); 2103 return 0; 2104 } 2105 } 2106 switch (li->type) { 2107 case DND_LAUNCH: 2108 strcat(li->targetpath, " %a"); 2109 ExecOnList(hwndMain, 2110 li->targetpath, PROMPT | WINDOWED, NULL, li->list, NULL, 2111 pszSrcFile, __LINE__); 2112 FreeList(li->list); 2113 li->list = NULL; 2114 break; 2115 case DO_LINK: 2116 if (fLinkSetsIcon) { 2117 li->type = IDM_SETICON; 2118 action = UM_MASSACTION; 2119 } 2120 else 2121 li->type = IDM_COMPARE; 2122 break; 2123 case DND_EXTRACT: 2124 if (*li->targetpath && !IsFile(li->targetpath)) 2125 li->type = IDM_EXTRACT; 2126 break; 2127 case DND_MOVE: 2128 li->type = IDM_MOVE; 2129 if (*li->targetpath && IsFile(li->targetpath) == 1) { 2130 action = UM_MASSACTION; 2131 li->type = IDM_ARCHIVEM; 2132 } 2133 break; 2134 case DND_WILDMOVE: 2135 li->type = IDM_WILDMOVE; 2136 if (*li->targetpath && IsFile(li->targetpath) == 1) { 2137 action = UM_MASSACTION; 2138 li->type = IDM_ARCHIVEM; 2139 } 2140 break; 2141 case DND_OBJECT: 2142 li->type = IDM_OBJECT; 2143 action = UM_MASSACTION; 2144 break; 2145 case DND_SHADOW: 2146 li->type = IDM_SHADOW; 2147 action = UM_MASSACTION; 2148 break; 2149 case DND_COMPARE: 2150 li->type = IDM_COMPARE; 2151 break; 2152 case DND_SETICON: 2153 action = UM_MASSACTION; 2154 li->type = IDM_SETICON; 2155 break; 2156 case DND_COPY: 2157 li->type = IDM_COPY; 2158 if (*li->targetpath && IsFile(li->targetpath) == 1) { 2159 action = UM_MASSACTION; 2160 li->type = IDM_ARCHIVE; 2161 } 2162 break; 2163 case DND_WILDCOPY: 2164 li->type = IDM_WILDCOPY; 2165 if (*li->targetpath && IsFile(li->targetpath) == 1) { 2166 action = UM_MASSACTION; 2167 li->type = IDM_ARCHIVE; 2168 } 2169 break; 2170 default: 2171 if (*li->arcname && li->info) { 2172 action = UM_MASSACTION; 2173 li->type = (li->type == DO_MOVE) ? IDM_FAKEEXTRACTM : 2174 IDM_FAKEEXTRACT; 2175 } 2176 else if (*li->targetpath && IsFile(li->targetpath) == 1) { 2177 action = UM_MASSACTION; 2178 li->type = (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE; 2179 } 2180 else 2181 li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY; 2182 break; 2183 } 2184 if (!li->list || !li->list[0]) 2185 FreeListInfo(li); 2186 else 2187 WinSendMsg(hwndTree, UM_ACTION, MPFROMP(li), MPFROMLONG(action)); 2185 2188 } 2186 2189 return 0; … … 2216 2219 for (x = 0; x < 26; x++) { 2217 2220 if ((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE)) { 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2221 if (x > 1) { 2222 if (driveflags[x] & DRIVE_CDROM) 2223 iconid = CDROM_ICON; 2224 else 2225 iconid = (driveflags[x] & DRIVE_REMOVABLE) ? 2226 REMOVABLE_ICON : 2227 (driveflags[x] & DRIVE_VIRTUAL) ? 2228 VIRTUAL_ICON : 2229 (driveflags[x] & DRIVE_REMOTE) ? 2230 REMOTE_ICON : 2231 (driveflags[x] & DRIVE_RAMDISK) ? 2232 RAMDISK_ICON : 2233 (driveflags[x] & DRIVE_ZIPSTREAM) ? 2234 ZIPSTREAM_ICON :DRIVE_ICON; 2235 } 2236 else 2237 iconid = FLOPPY_ICON; 2238 sprintf(s, "#%lu", iconid); 2239 hwndB = WinCreateWindow(hwndT, 2240 WC_DRIVEBUTTONS, 2241 s, 2242 BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON, 2243 0, 2244 0, 2245 28, 2246 18, 2247 hwndT, HWND_TOP, y + IDM_DRIVEA, NULL, NULL); 2248 if (!hwndB) 2249 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 2250 IDS_WINCREATEWINDOW); 2251 else { 2252 WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER); 2253 sprintf(s, "%c:", (CHAR) x + 'A'); 2254 hwndB = WinCreateWindow(hwndT, 2255 WC_STATIC, 2256 s, 2257 SS_TEXT | DT_LEFT | DT_VCENTER, 2258 0, 2259 0, 2260 10, 2261 18, 2262 hwndT, 2263 HWND_TOP, y + IDM_DRIVEATEXT, NULL, NULL); 2264 if (!hwndB) 2265 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 2266 IDS_WINCREATEWINDOW); 2267 else { 2268 SetPresParams(hwndB, 2269 &RGBGREY, 2270 &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT)); 2271 WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER); 2272 } 2273 y++; 2274 } 2272 2275 } 2273 2276 } // for 2274 2277 } // if drivebar 2275 2278 PostMsg(WinQueryWindow(hwndT, QW_PARENT), 2276 2279 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 2277 2280 } 2278 2281 … … 2290 2293 WinQueryWindowRect(hwndT, &rcl); 2291 2294 xwidth = rcl.xRight - ((WinQuerySysValue(HWND_DESKTOP, 2292 2295 SV_CYSIZEBORDER) * 2) + 2); 2293 2296 } 2294 2297 henum = WinBeginEnumWindows(hwndT); … … 2299 2302 ctrlxsize = 28; 2300 2303 WinSetWindowPos(hwndB, 2301 2302 2304 HWND_TOP, 2305 ctrlxpos, ctrlypos, ctrlxsize, 18, SWP_MOVE | SWP_SHOW); 2303 2306 ctrlxpos += (ctrlxsize + 2); 2304 2307 if (ctrlxsize == 10) { 2305 2308 if (ctrlxpos + (42 + ((fShowTarget && DriveLines == 0) ? 2306 2307 2308 2309 2309 256 : 0)) > xwidth) { 2310 ctrlxpos = 2; 2311 ctrlypos += 18; 2312 DriveLines++; 2310 2313 } 2311 2314 } … … 2326 2329 2327 2330 SetPresParams(hwnd, 2328 2329 2331 &RGBGREY, 2332 &RGBBLACK, &RGBGREY, GetPString(IDS_8HELVBOLDTEXT)); 2330 2333 return mr; 2331 2334 } … … 2337 2340 2338 2341 cbRetLen = WinQueryPresParam(hwnd, 2339 2340 2341 2342 2342 (ULONG) mp1, 2343 0, 2344 &AttrFound, 2345 (ULONG) sizeof(AttrValue), &AttrValue, 0); 2343 2346 if (cbRetLen) { 2344 2345 2347 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 2348 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 2346 2349 } 2347 2350 } … … 2360 2363 WinQueryWindowPos(hwndTree, &swp); 2361 2364 if (!(swp.fl & SWP_MAXIMIZE)) 2362 2365 fl |= SWP_RESTORE; 2363 2366 WinSetWindowPos(hwndTree, HWND_TOP, 0, 0, 0, 0, fl); 2364 2367 } … … 2393 2396 2394 2397 if (fOtherHelp) { 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2398 if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) 2399 && !WinQueryCapture(HWND_DESKTOP)) { 2400 switch (id) { 2401 case IDM_ATTRS: 2402 if (WinQueryWindowTextLength(hwnd)) 2403 s = GetPString(IDS_ATTRSBUTTONHELP); 2404 break; 2405 case IDM_INFO: 2406 if (WinQueryWindowTextLength(hwnd)) 2407 s = GetPString(IDS_INFOBUTTONHELP); 2408 break; 2409 case IDM_RENAME: 2410 if (WinQueryWindowTextLength(hwnd)) 2411 s = GetPString(IDS_NAMEBUTTONHELP); 2412 break; 2413 case MAIN_STATUS2: 2414 if (!hwndE) 2415 s = GetPString(IDS_STATUS2HELP); 2416 break; 2417 default: 2418 break; 2419 } 2420 if (s) 2421 MakeBubble(hwnd, FALSE, s); 2422 else if (hwndBubble) 2423 WinDestroyWindow(hwndBubble); 2424 } 2422 2425 } 2423 2426 switch (id) { … … 2426 2429 case IDM_RENAME: 2427 2430 case MAIN_STATUS2: 2428 2431 return CommonTextProc(hwnd, msg, mp1, mp2); 2429 2432 default: 2430 2433 break; 2431 2434 } 2432 2435 } … … 2451 2454 case IDM_RENAME: 2452 2455 case MAIN_STATUS2: 2453 2456 return CommonTextButton(hwnd, msg, mp1, mp2); 2454 2457 default: 2455 2456 2458 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID); 2459 break; 2457 2460 } 2458 2461 } … … 2466 2469 id = WinQueryWindowUShort(hwnd, QWS_ID); 2467 2470 if (id == MAIN_STATUS2 && hwndE) 2468 2471 WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 2469 2472 else 2470 2473 return CommonTextButton(hwnd, msg, mp1, mp2); 2471 2474 } 2472 2475 break; … … 2478 2481 id = WinQueryWindowUShort(hwnd, QWS_ID); 2479 2482 if (id == MAIN_STATUS) { 2480 2481 2482 2483 2484 2485 2483 if (SHORT2FROMMP(mp2) & KC_CTRL) 2484 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2485 FID_CLIENT), 2486 WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID); 2487 else if (hwndTree) 2488 PostMsg(hwndTree, UM_TIMER, MPVOID, MPVOID); 2486 2489 } 2487 2490 } … … 2496 2499 if (id == MAIN_STATUS2 && !hwndE) { 2497 2500 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2501 SWP swp; 2502 CHAR directory[CCHMAXPATH]; 2503 PFNWP oldproce; 2504 2505 *directory = 0; 2506 TopWindowName(hwndMain, (HWND) 0, directory); 2507 WinQueryWindowPos(hwnd, &swp); 2508 hwndB = WinCreateWindow(hwnd, 2509 WC_BUTTON, 2510 "+", 2511 WS_VISIBLE | BS_PUSHBUTTON | 2512 BS_NOPOINTERFOCUS, 2513 swp.cx - swp.cy, 2514 0, 2515 swp.cy, 2516 swp.cy, 2517 hwnd, HWND_TOP, COMMAND_BUTTON, NULL, NULL); 2518 if (!hwndB) 2519 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 2520 hwndE = WinCreateWindow(hwnd, 2521 WC_ENTRYFIELD, 2522 NULL, 2523 WS_VISIBLE | ES_AUTOSCROLL, 2524 0, 2525 0, 2526 swp.cx - swp.cy, 2527 swp.cy, 2528 hwnd, HWND_TOP, COMMAND_LINE, NULL, NULL); 2529 if (!hwndE) 2530 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 2531 if (!hwndE || !hwndB) { 2532 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 2533 return 0; 2534 } 2535 WinSendMsg(hwndE, EM_SETTEXTLIMIT, MPFROM2SHORT(1024, 0), MPVOID); 2536 WinSetWindowText(hwndStatus, directory); 2537 if (*lastcmd) 2538 WinSetWindowText(hwndE, lastcmd); 2539 else 2540 WinSetWindowText(hwndE, GetPString(IDS_HELPCMDTEXT)); 2541 oldproce = WinSubclassWindow(hwndE, (PFNWP) CommandLineProc); 2542 if (oldproce) 2543 WinSetWindowPtr(hwndE, QWL_USER, (PVOID) oldproce); 2544 PostMsg(hwndE, UM_FOCUSME, MPVOID, MPVOID); 2545 PostMsg(hwndE, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID); 2546 return 0; 2544 2547 } 2545 2548 if (msg == UM_CLICKED3 || (SHORT2FROMMP(mp2) & KC_CTRL)) { 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2549 switch (id) { 2550 case IDM_ATTRS: 2551 id = IDM_SORTSIZE; 2552 break; 2553 case IDM_INFO: 2554 id = IDM_SORTLWDATE; 2555 break; 2556 case IDM_RENAME: 2557 id = IDM_SORTFILENAME; 2558 break; 2559 } 2557 2560 } 2558 2561 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 2559 2562 WM_COMMAND, MPFROM2SHORT(id, 0), MPVOID); 2560 2563 } 2561 2564 return 0; … … 2571 2574 case IDM_RENAME: 2572 2575 case MAIN_STATUS2: 2573 2574 2576 PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE); 2577 break; 2575 2578 default: 2576 2577 2579 PaintRecessedWindow(hwnd, (HPS) 0, FALSE, TRUE); 2580 break; 2578 2581 } 2579 2582 if (id == IDM_RENAME) { 2580 2583 2581 2582 2583 2584 2585 2586 2587 2588 2584 HPS hps; 2585 2586 hps = WinBeginPaint(hwnd, (HPS) 0, NULL); 2587 if (hps) { 2588 PaintSTextWindow(hwnd, hps); 2589 WinEndPaint(hps); 2590 } 2591 return 0; 2589 2592 } 2590 2593 } … … 2619 2622 case UM_COMMAND: 2620 2623 return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2621 2624 FID_CLIENT), msg, mp1, mp2); 2622 2625 2623 2626 case WM_PAINT: … … 2632 2635 hps = WinBeginPaint(hwnd, (HPS)0, NULL); 2633 2636 if (hps) { 2634 2635 2636 2637 2638 2639 2640 2641 2637 GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL); 2638 WinQueryPresParam(hwnd, PP_BACKGROUNDCOLOR, 0, NULL, 2639 sizeof(lColor), &lColor, 0); 2640 if (!lColor) 2641 lColor = CLR_PALEGRAY; 2642 WinQueryWindowRect(hwnd, &rcl); 2643 WinFillRect(hps, &rcl, lColor); 2644 WinEndPaint(hps); 2642 2645 } 2643 2646 … … 2658 2661 tool = find_tool(id); 2659 2662 if (tool) { 2660 2661 2662 2663 2664 2665 2663 del_tool(tool); 2664 WinShowWindow(WinWindowFromID(hwnd, id), FALSE); 2665 if (fToolTitles) 2666 WinShowWindow(WinWindowFromID(hwnd, id + 25000), FALSE); 2667 ResizeTools(hwnd); 2668 save_tools(NULL); 2666 2669 } 2667 2670 } … … 2677 2680 2678 2681 id = (USHORT) WinDlgBox(HWND_DESKTOP, 2679 2680 2681 2682 hwnd, 2683 AddToolProc, 2684 FM3ModHandle, ADDBTN_FRAME, MPVOID); 2682 2685 if (id && id != (USHORT) - 1) 2683 2684 2685 2686 2686 WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2687 FID_CLIENT), 2688 WM_COMMAND, 2689 MPFROM2SHORT(IDM_CREATETOOL, 0), MPFROM2SHORT(id, 0)); 2687 2690 } 2688 2691 break; … … 2690 2693 case WM_CONTEXTMENU: 2691 2694 if (WinDlgBox(HWND_DESKTOP, 2692 2695 hwnd, ToolIODlgProc, FM3ModHandle, SVBTN_FRAME, MPVOID)) 2693 2696 PostMsg(hwnd, UM_SETUP2, MPVOID, MPVOID); 2694 2697 return MRFROMSHORT(TRUE); … … 2713 2716 if (pswp) { 2714 2717 if (WinQueryWindowPos(hwndTree, &swp) && 2715 2718 !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE))) { 2716 2719 pswp->x = swp.cx; 2717 2720 pswp->cx -= swp.cx; … … 2720 2723 if (prectl) { 2721 2724 if (WinQueryWindowPos(hwndTree, &swp) && 2722 2723 2725 !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)) && 2726 WinQueryWindowRect(hwndTree, &rectl)) { 2724 2727 prectl->xLeft = rectl.xRight; 2725 2728 prectl->xRight -= rectl.xRight; … … 2773 2776 if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) { 2774 2777 if (swp.x < swpT.cx) { 2775 2776 2777 2778 2779 2780 2778 swp.x = swpT.cx; 2779 if (swp.x + swp.cx > swpC.cx) 2780 swp.cx = swpC.cx - swp.x; 2781 if (swp.cx > 24) 2782 WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 2783 SWP_SIZE | SWP_MOVE | SWP_SHOW); 2781 2784 } 2782 2785 } … … 2798 2801 WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1); 2799 2802 WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0, 2800 2803 SWP_MOVE | SWP_SHOW | SWP_FOCUSDEACTIVATE); 2801 2804 } 2802 2805 } … … 2820 2823 if (hwndNext) { 2821 2824 if (!WinQueryWindowUShort(hwndNext, QWS_ID)) 2822 2825 continue; 2823 2826 if (next) 2824 2827 break; 2825 2828 if (hwndNext == hwndActive) { 2826 2827 2828 2829 2830 2831 2829 if (!previous && hwndPrev) { 2830 hwndNext = hwndPrev; 2831 break; 2832 } 2833 else if (previous) 2834 next = TRUE; 2832 2835 } 2833 2836 hwndPrev = hwndNext; … … 2835 2838 else { 2836 2839 if ((!next && previous) || once) 2837 2840 break; 2838 2841 else if (!previous) { 2839 2840 2842 hwndNext = hwndPrev; 2843 break; 2841 2844 } 2842 2845 else 2843 2846 once = next = TRUE; 2844 2847 } 2845 2848 } … … 2848 2851 if (hwndNext && hwndNext != hwndActive) { 2849 2852 WinSetWindowPos(hwndNext, HWND_TOP, 0, 0, 0, 0, 2850 2853 SWP_ZORDER | SWP_ACTIVATE); 2851 2854 WinSetWindowPos(hwndActive, ((previous) ? HWND_BOTTOM : hwndNext), 0, 0, 2852 2855 0, 0, SWP_ZORDER); 2853 2856 } 2854 2857 } … … 2865 2868 if (hwndChild != hwndTree) { 2866 2869 WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT), 2867 2870 WM_SAVEAPPLICATION, MPVOID, MPVOID); 2868 2871 if (WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT), 2869 2870 2871 2872 WM_CLOSE, MPVOID, MPVOID)) { 2873 ret = TRUE; 2874 break; 2872 2875 } 2873 2876 } … … 2892 2895 hwndTemp = WinWindowFromID(hwndChild, FID_CLIENT); 2893 2896 if (hwndTemp) { 2894 2895 2896 2897 2898 2899 2897 hwndDir = WinWindowFromID(hwndTemp, DIR_CNR); 2898 if (hwndDir) { 2899 WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT), 2900 WM_CLOSE, MPVOID, MPVOID); 2901 ret = TRUE; 2902 } 2900 2903 } 2901 2904 } … … 2953 2956 hwndC = WinWindowFromID(hwndChild, FID_CLIENT); 2954 2957 if (hwndC) { 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 2958 hwndDir = WinWindowFromID(hwndC, DIR_CNR); 2959 if (hwndDir) { 2960 WinQueryWindowPos(hwndChild, &swp); 2961 *szDir = 0; 2962 WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(szDir), MPVOID); 2963 if (*szDir) { 2964 // If saving shutdown state skip no prescan drives 2965 if (fIsShutDownState && 2966 driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) { 2967 continue; 2968 } 2969 sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, numsaves); 2970 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, 2971 sizeof(SWP)); 2972 dcd = 2973 WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER); 2974 if (dcd) { 2975 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, numsaves); 2976 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->sortFlags, 2977 sizeof(INT)); 2978 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, numsaves); 2979 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->mask, 2980 sizeof(MASK)); 2981 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, numsaves); 2982 flWindowAttr = dcd->flWindowAttr; 2983 if (!fLeaveTree && (flWindowAttr & CV_TREE)) { 2984 flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT)); 2985 if (dcd->lastattr) { 2986 if (dcd->lastattr & CV_TEXT) 2987 flWindowAttr |= CV_TEXT; 2988 else if (dcd->lastattr & CV_DETAIL) 2989 flWindowAttr |= CV_DETAIL; 2990 else if (dcd->lastattr & CV_ICON) 2991 flWindowAttr |= CV_ICON; 2992 else 2993 flWindowAttr |= CV_NAME; 2994 } 2995 else 2996 flWindowAttr |= CV_NAME; 2997 } 2998 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & flWindowAttr, 2999 sizeof(ULONG)); 3000 sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, numsaves); 3001 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslongname, 3002 sizeof(BOOL)); 3003 sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, numsaves); 3004 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailssubject, 3005 sizeof(BOOL)); 3006 sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, numsaves); 3007 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailssize, 3008 sizeof(BOOL)); 3009 sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, numsaves); 3010 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsea, 3011 sizeof(BOOL)); 3012 sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, numsaves); 3013 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsattr, 3014 sizeof(BOOL)); 3015 sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, numsaves); 3016 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsicon, 3017 sizeof(BOOL)); 3018 sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, numsaves); 3019 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslwdate, 3020 sizeof(BOOL)); 3021 sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, numsaves); 3022 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslwtime, 3023 sizeof(BOOL)); 3024 sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, numsaves); 3025 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsladate, 3026 sizeof(BOOL)); 3027 sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, numsaves); 3028 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslatime, 3029 sizeof(BOOL)); 3030 sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, numsaves); 3031 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailscrdate, 3032 sizeof(BOOL)); 3033 sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, numsaves); 3034 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailscrtime, 3035 sizeof(BOOL)); 3036 sprintf(szKey, "%sDirCnr.%lu", szPrefix, numsaves); 3037 SavePresParams(hwndDir, szKey); 3038 } 3039 sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, numsaves++); 3040 PrfWriteProfileString(fmprof, FM3Str, szKey, szDir); 3041 } 3042 } 3040 3043 } 3041 3044 } … … 3122 3125 if (hwnd) { 3123 3126 if (WinQueryWindowPos(hwnd, &swp)) { 3124 3125 3126 3127 3128 3129 3130 3131 3127 if (pswp->x > swp.cx) 3128 pswp->x = (swp.cx > 24) ? swp.cx - 24 : swp.cx; 3129 if (pswp->y > swp.cy) 3130 pswp->y = (swp.cy > 24) ? swp.cy - 24 : swp.cy; 3131 if (pswp->x + pswp->cx > swp.cx) 3132 pswp->cx = swp.cx - pswp->x; 3133 if (pswp->y + pswp->cy > swp.cy) 3134 pswp->cy = swp.cy - pswp->y; 3132 3135 } 3133 3136 } … … 3196 3199 sprintf(szKey, "%sMySizeLastTime", szPrefix); 3197 3200 if (!PrfQueryProfileData(fmprof, 3198 3199 3200 3201 3201 FM3Str, 3202 szKey, 3203 (PVOID) &swpO, 3204 &size) || 3202 3205 size != sizeof(SWP) || !swp.cx || !swp.cy) 3203 3206 { … … 3227 3230 swp.fl &= (~SWP_ACTIVATE); 3228 3231 WinSetWindowPos(hwndTree, 3229 3230 3231 3232 3233 3234 3232 HWND_TOP, 3233 swp.x, 3234 swp.y, 3235 swp.cx, 3236 swp.cy, 3237 swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER); 3235 3238 } 3236 3239 else { 3237 3240 WinSetWindowPos(hwndTree, 3238 3241 HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW); 3239 3242 WinSetWindowUShort(hwndTree, QWS_XRESTORE, (USHORT) swp.x); 3240 3243 WinSetWindowUShort(hwndTree, QWS_CXRESTORE, (USHORT) swp.cx); … … 3246 3249 size = sizeof(ULONG); 3247 3250 if (PrfQueryProfileData(fmprof, 3248 3251 FM3Str, szKey, (PVOID) &numsaves, &size)) { 3249 3252 if (fDeleteState) 3250 3253 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); … … 3253 3256 size = sizeof(SWP); 3254 3257 if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &swp, &size)) { 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3258 if (fDeleteState) 3259 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3260 sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, x); 3261 size = sizeof(szDir); 3262 if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) { 3263 // If restoring shutdown state and drive marked no prescan 3264 // bypass window restore 3265 if (fIsShutDownState && 3266 driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) { 3267 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3268 continue; 3269 } 3270 if (fDeleteState) 3271 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3272 localdcd.ds.detailslongname = dsDirCnrDefault.detailslongname; // Set default 3273 sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, x); 3274 size = sizeof(BOOL); 3275 if (PrfQueryProfileData(fmprof, 3276 FM3Str, 3277 szKey, 3278 (PVOID) &localdcd.ds.detailslongname, 3279 &size)) 3280 { 3281 if (fDeleteState) 3282 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3283 } 3284 localdcd.ds.detailssubject = dsDirCnrDefault.detailssubject; // Set default 3285 sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, x); 3286 size = sizeof(BOOL); 3287 if (PrfQueryProfileData(fmprof, 3288 FM3Str, 3289 szKey, 3290 (PVOID) &localdcd.ds.detailssubject, 3291 &size)) 3292 { 3293 if (fDeleteState) 3294 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3295 } 3296 localdcd.ds.detailsea = dsDirCnrDefault.detailsea; // Set default 3297 sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, x); 3298 size = sizeof(BOOL); 3299 if (PrfQueryProfileData(fmprof, 3300 FM3Str, 3301 szKey, 3302 (PVOID) &localdcd.ds.detailsea, 3303 &size)) 3304 { 3305 if (fDeleteState) 3306 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3307 } 3308 localdcd.ds.detailssize = dsDirCnrDefault.detailssize; // Set default 3309 sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, x); 3310 size = sizeof(BOOL); 3311 if (PrfQueryProfileData(fmprof, 3312 FM3Str, 3313 szKey, 3314 (PVOID) &localdcd.ds.detailssize, 3315 &size)) 3316 { 3317 if (fDeleteState) 3318 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3319 } 3320 localdcd.ds.detailsicon = dsDirCnrDefault.detailsicon; // Set default 3321 sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, x); 3322 size = sizeof(BOOL); 3323 if (PrfQueryProfileData(fmprof, 3324 FM3Str, 3325 szKey, 3326 (PVOID) &localdcd.ds.detailsicon, 3327 &size)) 3328 { 3329 if (fDeleteState) 3330 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3331 } 3332 localdcd.ds.detailsattr = dsDirCnrDefault.detailsattr; // Set default 3333 sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, x); 3334 size = sizeof(BOOL); 3335 if (PrfQueryProfileData(fmprof, 3336 FM3Str, 3337 szKey, 3338 (PVOID) &localdcd.ds.detailsattr, 3339 &size)) 3340 { 3341 if (fDeleteState) 3342 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3343 } 3344 localdcd.ds.detailscrdate = dsDirCnrDefault.detailscrdate; // Set default 3345 sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, x); 3346 size = sizeof(BOOL); 3347 if (PrfQueryProfileData(fmprof, 3348 FM3Str, 3349 szKey, 3350 (PVOID) &localdcd.ds.detailscrdate, 3351 &size)) 3352 { 3353 if (fDeleteState) 3354 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3355 } 3356 localdcd.ds.detailscrtime = dsDirCnrDefault.detailscrtime; // Set default 3357 sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, x); 3358 size = sizeof(BOOL); 3359 if (PrfQueryProfileData(fmprof, 3360 FM3Str, 3361 szKey, 3362 (PVOID) &localdcd.ds.detailscrtime, 3363 &size)) 3364 { 3365 if (fDeleteState) 3366 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3367 } 3368 localdcd.ds.detailslwdate = dsDirCnrDefault.detailslwdate; // Set default 3369 sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, x); 3370 size = sizeof(BOOL); 3371 if (PrfQueryProfileData(fmprof, 3372 FM3Str, 3373 szKey, 3374 (PVOID) &localdcd.ds.detailslwdate, 3375 &size)) 3376 { 3377 if (fDeleteState) 3378 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3379 } 3380 localdcd.ds.detailslwtime = dsDirCnrDefault.detailslwtime; // Set default 3381 sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, x); 3382 size = sizeof(BOOL); 3383 if (PrfQueryProfileData(fmprof, 3384 FM3Str, 3385 szKey, 3386 (PVOID) &localdcd.ds.detailslwtime, 3387 &size)) 3388 { 3389 if (fDeleteState) 3390 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3391 } 3392 localdcd.ds.detailsladate = dsDirCnrDefault.detailsladate; // Set default 3393 sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, x); 3394 size = sizeof(BOOL); 3395 if (PrfQueryProfileData(fmprof, 3396 FM3Str, 3397 szKey, 3398 (PVOID) &localdcd.ds.detailsladate, 3399 &size)) 3400 { 3401 if (fDeleteState) 3402 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3403 } 3404 localdcd.ds.detailslatime = dsDirCnrDefault.detailslatime; // Set default 3405 sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, x); 3406 size = sizeof(BOOL); 3407 if (PrfQueryProfileData(fmprof, 3408 FM3Str, 3409 szKey, 3410 (PVOID) &localdcd.ds.detailslatime, 3411 &size)) 3412 { 3413 if (fDeleteState) 3414 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3415 } 3416 hwndDir = (HWND) WinSendMsg(hwndClient, 3417 UM_SETDIR, 3418 MPFROMP(szDir), MPFROMLONG(1)); 3419 if (hwndDir) { 3420 hwndC = WinWindowFromID(hwndDir, FID_CLIENT); 3421 if (hwndC) { 3422 HWND hwndCnr = WinWindowFromID(hwndC, DIR_CNR); 3423 if (!hwndPPSave) { 3424 hwndPPSave = WinCreateWindow(hwndCnr, // Create a window (used to save default presparams) 3425 WC_CONTAINER, 3426 NULL, 3427 CCS_AUTOPOSITION | CCS_MINIICONS | 3428 CCS_MINIRECORDCORE | ulCnrType, 3429 0, 3430 0, 3431 0, 3432 0, 3433 hwndCnr, 3434 HWND_TOP, (ULONG) -1, NULL, NULL); 3435 CopyPresParams(hwndPPSave, hwndC); 3436 RestorePresParams(hwndPPSave, "DirCnr"); 3437 } 3438 sprintf(szKey, "%sDirCnr.%lu", szPrefix, x); 3439 RestorePresParams(hwndCnr, szKey); 3440 dcd = WinQueryWindowPtr(hwndCnr, QWL_USER); 3441 if (dcd) { 3442 dcd->ds.detailslongname = localdcd.ds.detailslongname; 3443 dcd->ds.detailssubject = localdcd.ds.detailssubject ; 3444 dcd->ds.detailsattr = localdcd.ds.detailsattr ; 3445 dcd->ds.detailsea = localdcd.ds.detailsea ; 3446 dcd->ds.detailssize = localdcd.ds.detailssize ; 3447 dcd->ds.detailsicon = localdcd.ds.detailsicon ; 3448 dcd->ds.detailscrdate = localdcd.ds.detailscrdate ; 3449 dcd->ds.detailscrtime = localdcd.ds.detailscrtime ; 3450 dcd->ds.detailsladate = localdcd.ds.detailsladate ; 3451 dcd->ds.detailslatime = localdcd.ds.detailslatime ; 3452 dcd->ds.detailslwdate = localdcd.ds.detailslwdate ; 3453 dcd->ds.detailslwtime = localdcd.ds.detailslwtime ; 3454 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, x); 3455 size = sizeof(INT); 3456 if (PrfQueryProfileData(fmprof, 3457 FM3Str, 3458 szKey, 3459 (PVOID) &dcd->sortFlags, 3460 &size)) { 3461 if (!dcd->sortFlags) 3462 dcd->sortFlags = SORT_PATHNAME; 3463 } 3464 if (fDeleteState) 3465 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3466 size = sizeof(MASK); 3467 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, x); 3468 if (PrfQueryProfileData(fmprof, 3469 FM3Str, 3470 szKey, 3471 (PVOID) &dcd->mask, &size)) { 3472 if (*dcd->mask.szMask) 3473 WinSendMsg(WinWindowFromID(hwndC, DIR_CNR), 3474 UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID); 3475 } 3476 *(dcd->mask.prompt) = 0; 3477 if (fDeleteState) 3478 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3479 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, x); 3480 if (!noview) { 3481 size = sizeof(ULONG); 3482 if (PrfQueryProfileData(fmprof, 3483 FM3Str, 3484 szKey, 3485 (PVOID) &dcd->flWindowAttr, 3486 &size)) { 3487 3488 CNRINFO cnri; 3489 3490 memset(&cnri, 0, sizeof(CNRINFO)); 3491 cnri.cb = sizeof(CNRINFO); 3492 if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR), 3493 CM_QUERYCNRINFO, 3494 MPFROMP(&cnri), 3495 MPFROMLONG(sizeof(CNRINFO)))) { 3496 cnri.flWindowAttr = dcd->flWindowAttr; 3497 WinSendMsg(WinWindowFromID(hwndC, DIR_CNR), 3498 CM_SETCNRINFO, 3499 MPFROMP(&cnri), 3500 MPFROMLONG(CMA_FLWINDOWATTR)); 3501 } 3502 } 3503 } 3504 if (fDeleteState) 3505 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3506 if (!PostMsg(hwndCnr, UM_SETUP2, NULL, NULL)) 3507 WinSendMsg(hwndCnr, UM_SETUP2, NULL, NULL); 3508 } 3509 } 3510 fRestored = TRUE; 3511 swp.hwnd = hwndDir; 3512 TransformSwp(&swp, xtrans, ytrans); 3513 if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) { 3514 WinSetWindowPos(hwndDir, 3515 HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW); 3516 WinSetWindowUShort(hwndDir, QWS_XRESTORE, (USHORT) swp.x); 3517 WinSetWindowUShort(hwndDir, QWS_CXRESTORE, (USHORT) swp.cx); 3518 WinSetWindowUShort(hwndDir, QWS_YRESTORE, (USHORT) swp.y); 3519 WinSetWindowUShort(hwndDir, QWS_CYRESTORE, (USHORT) swp.cy); 3520 } else 3521 WinSetWindowPos(hwndDir, 3522 HWND_TOP, 3523 swp.x, 3524 swp.y, 3525 swp.cx, 3526 swp.cy, 3527 swp.fl | SWP_MOVE | 3528 SWP_SIZE | SWP_SHOW | SWP_ZORDER | 3529 SWP_ACTIVATE); 3530 } 3531 } 3529 3532 } 3530 3533 } // for … … 3555 3558 if (ulNumMinChildren) { 3556 3559 if (WinQueryWindowPos(hwndChild, &swp) && (swp.fl & SWP_MINIMIZE)) 3557 3560 (*ulNumMinChildren)++; 3558 3561 } 3559 3562 } … … 3563 3566 3564 3567 VOID GetNextWindowPos(HWND hwndClient, PSWP pswp, ULONG * ulCntR, 3565 3568 ULONG * ulNumMinChildrenR) 3566 3569 { 3567 3570 register ULONG ulCnt; … … 3627 3630 if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) { 3628 3631 if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom) 3629 3632 swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y; 3630 3633 if (swp.x != 0) 3631 3634 swp.x = 0; 3632 3635 if (swp.y < 0) 3633 3636 swp.y = 0; 3634 3637 if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft) 3635 3638 swp.cx = Rectl.xRight - Rectl.xLeft; 3636 3639 WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 3637 3640 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE); 3638 3641 } 3639 3642 } … … 3647 3650 GetNextWindowPos(hwndClient, &swp, &ulCnt, &ulNumMinChildren); 3648 3651 WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 3649 3650 3652 SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_RESTORE | 3653 SWP_ZORDER | SWP_ACTIVATE); 3651 3654 ulCnt++; 3652 3655 } … … 3701 3704 if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) { 3702 3705 if (swp.y < 0) 3703 3706 swp.y = 0; 3704 3707 if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom) 3705 3708 swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y; 3706 3709 if (swp.x != 0) 3707 3710 swp.x = 0; 3708 3711 if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft) 3709 3712 swp.cx = Rectl.xRight - Rectl.xLeft; 3710 3713 WinSetWindowPos(hwndTree, 3711 3712 3713 3714 3715 3714 HWND_TOP, 3715 swp.x, 3716 swp.y, 3717 swp.cx, 3718 swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE); 3716 3719 WinQueryWindowPos(hwndTree, &swp); 3717 3720 } … … 3738 3741 3739 3742 for (ulCurRow = 0; ulCurRow < ulNumRows; ulCurRow++) { 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3743 if ((ulNumRows - ulCurRow) <= ulExtraCols) 3744 ulNumCols++; 3745 for (ulCurCol = 0; ulCurCol < ulNumCols; ulCurCol++) { 3746 ulWidth = Rectl.xRight / ulNumCols; 3747 3748 while (hwndChild) { 3749 id = WinQueryWindowUShort(hwndChild, QWS_ID); 3750 if (id && (id != TREE_FRAME || fFreeTree)) { 3751 WinQueryWindowPos(hwndChild, &swp); 3752 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) 3753 break; 3754 } 3755 hwndChild = WinGetNextWindow(henum); 3756 } 3757 3758 if (hwndChild) { 3759 if (!absolute && (swp.fl & SWP_MAXIMIZE)) { 3760 WinGetMaxPosition(hwndChild, &swp); 3761 WinSetWindowPos(hwndChild, 3762 HWND_TOP, 3763 swp.x, 3764 swp.y, 3765 swp.cx, swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW); 3766 WinSetWindowUShort(hwndChild, 3767 QWS_XRESTORE, 3768 (USHORT) (ulWidth * ulCurCol) + Rectl.xLeft); 3769 WinSetWindowUShort(hwndChild, 3770 QWS_YRESTORE, 3771 (USHORT) (Rectl.yTop - 3772 (ulHeight * (ulCurRow + 1)))); 3773 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, (USHORT) ulWidth); 3774 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, (USHORT) ulHeight); 3775 } 3776 else 3777 WinSetWindowPos(hwndChild, 3778 HWND_TOP, 3779 (ulWidth * ulCurCol) + Rectl.xLeft, 3780 Rectl.yTop - (ulHeight * (ulCurRow + 1)), 3781 ulWidth, 3782 ulHeight, 3783 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE); 3784 hwndChild = WinGetNextWindow(henum); 3785 } 3786 } 3787 if ((ulNumRows - ulCurRow) <= ulExtraCols) { 3788 ulNumCols--; 3789 ulExtraCols--; 3790 } 3788 3791 } 3789 3792 } … … 3795 3798 3796 3799 static VOID ResizeChildren(HWND hwndClient, SHORT oldcx, SHORT oldcy, 3797 3800 SHORT newcx, SHORT newcy) 3798 3801 { 3799 3802 /* … … 3813 3816 while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) { 3814 3817 if (!WinQueryWindowUShort(hwndChild, QWS_ID)) 3815 3818 continue; 3816 3819 if (WinQueryWindowPos(hwndChild, &swp)) { 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3820 if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) { 3821 swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE); 3822 swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE); 3823 swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE); 3824 swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE); 3825 } 3826 else if (swp.fl & SWP_MAXIMIZE) { 3827 swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE); 3828 swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE); 3829 swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE); 3830 swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE); 3831 } 3832 cx = (swp.cx) ? (LONG) (((double)oldcx * 100.0) / (double)swp.cx) : 0; 3833 cy = (swp.cy) ? (LONG) (((double)oldcy * 100.0) / (double)swp.cy) : 0; 3834 x = (swp.x) ? (LONG) (((double)oldcx * 100.0) / (double)swp.x) : 0; 3835 y = (swp.y) ? (LONG) (((double)oldcy * 100.0) / (double)swp.y) : 0; 3836 if (x < 0) 3837 x = 0; 3838 if (y < 0) 3839 y = 0; 3840 ux = (x) ? (LONG) (((double)newcx * 100.0) / (double)x) : 0; 3841 uy = (y) ? (LONG) (((double)newcy * 100.0) / (double)y) : 0; 3842 ucx = (cx) ? (LONG) (((double)newcx * 100.0) / (double)cx) : 0; 3843 ucy = (cy) ? (LONG) (((double)newcy * 100.0) / (double)cy) : 0; 3844 if (ux + ucx > newcx) 3845 ucx = newcx - ux; 3846 if (uy + ucy > newcy) 3847 ucy = newcy - uy; 3848 3849 if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE))) 3850 WinSetWindowPos(hwndChild, HWND_TOP, ux, uy, ucx, ucy, 3851 SWP_MOVE | SWP_SIZE | SWP_SHOW); 3852 else if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) { 3853 WinSetWindowUShort(hwndChild, QWS_XMINIMIZE, (USHORT) - 1); 3854 WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1); 3855 WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0, 3856 SWP_SIZE | SWP_MOVE | SWP_FOCUSDEACTIVATE); 3857 WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux); 3858 WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy); 3859 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx); 3860 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy); 3861 } 3862 else { 3863 WinGetMaxPosition(hwndChild, &swp); 3864 WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 3865 SWP_MOVE | SWP_SIZE | SWP_SHOW); 3866 WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux); 3867 WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy); 3868 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx); 3869 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy); 3870 } 3868 3871 } 3869 3872 } … … 3881 3884 3882 3885 if (!fNoTreeGap) { 3883 3884 3885 3886 INT height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2; 3887 if (swp.y < height) 3888 swp.y = height; // Force bottom to position 3886 3889 } 3887 3890 else 3888 3891 swp.y = 0; // Force bottom to position 3889 3892 3890 3893 swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y; 3891 3894 if (swp.cy < 0) 3892 3895 swp.cy = 0; 3893 3896 3894 3897 if (swp.x != 0) 3895 3898 swp.x = 0; // Left align 3896 3899 3897 3900 // AdjustSizeOfClient can return bogus xRight values - fixme someday 3898 3901 if (Rectl.xRight >= Rectl.xLeft) { 3899 3900 3902 if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft) 3903 swp.cx = Rectl.xRight - Rectl.xLeft; 3901 3904 } 3902 3905 WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 3903 3906 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE); 3904 3907 } 3905 3908 } … … 3929 3932 3930 3933 static MRESULT EXPENTRY ChildFrameButtonProc(HWND hwnd, 3931 3932 3934 ULONG msg, 3935 MPARAM mp1, MPARAM mp2) 3933 3936 { 3934 3937 USHORT id; … … 3944 3947 if (fOtherHelp) { 3945 3948 if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3949 && !WinQueryCapture(HWND_DESKTOP)) { 3950 id = WinQueryWindowUShort(hwnd, QWS_ID); 3951 switch (id) { 3952 case IDM_OPENWALK: 3953 MakeBubble(hwnd, FALSE, GetPString(IDS_WALKBUTTONHELP)); 3954 break; 3955 case IDM_USERLIST: 3956 MakeBubble(hwnd, FALSE, GetPString(IDS_QUICKBUTTONHELP)); 3957 break; 3958 } 3956 3959 } 3957 3960 } … … 3967 3970 switch (id) { 3968 3971 case IDM_OPENWALK: 3969 3970 3971 3972 3973 3974 3975 3972 switch (msg) { 3973 case WM_BUTTON2CLICK: 3974 if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) == 3975 (KC_ALT | KC_SHIFT | KC_CTRL)) 3976 cmd = IDM_GREP; 3977 else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL)) 3978 CascadeChildren(hwndMain); 3976 3979 3977 3980 #ifdef NEVER 3978 3979 3981 else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT)) 3982 cmd = IDM_SYSINFO; 3980 3983 #endif 3981 3984 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3985 else if (shiftstate & KC_SHIFT) 3986 cmd = IDM_WINDOWDLG; 3987 else if (shiftstate & KC_CTRL) 3988 cmd = IDM_SEEALL; 3989 else if (shiftstate & KC_ALT) 3990 TileChildren(hwndMain, TRUE); 3991 else 3992 cmd = IDM_WALKDIR; 3993 break; 3994 case WM_BUTTON3CLICK: 3995 TileChildren(hwndMain, TRUE); 3996 break; 3997 } 3998 break; 3996 3999 case IDM_USERLIST: 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4000 switch (msg) { 4001 case WM_BUTTON2CLICK: 4002 if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) == 4003 (KC_ALT | KC_SHIFT | KC_CTRL)) 4004 cmd = IDM_COLORPALETTE; 4005 else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL)) 4006 cmd = IDM_HIDEMENU; 4007 else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT)) 4008 cmd = IDM_NOTEBOOK; 4009 else if (shiftstate & KC_SHIFT) 4010 cmd = IDM_TOOLTITLES; 4011 else if (shiftstate & KC_CTRL) 4012 cmd = IDM_TEXTTOOLS; 4013 else if (shiftstate & KC_ALT) 4014 cmd = IDM_FONTPALETTE; 4015 else 4016 cmd = IDM_TOOLBAR; 4017 break; 4018 case WM_BUTTON3CLICK: 4019 cmd = IDM_DRIVEBAR; 4020 break; 4021 } 4022 break; 4020 4023 } // switch id 4021 4024 4022 4025 if (cmd) { 4023 4024 4026 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_CLIENT), 4027 WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID); 4025 4028 } 4026 4029 } … … 4031 4034 if (id == IDM_OPENWALK) { 4032 4035 if (!emphasized) { 4033 4034 4036 emphasized = TRUE; 4037 DrawTargetEmphasis(hwnd, emphasized); 4035 4038 } 4036 4039 if (AcceptOneDrop(hwnd, mp1, mp2)) 4037 4040 return MRFROM2SHORT(DOR_DROP, DO_MOVE); 4038 4041 } 4039 4042 return MRFROM2SHORT(DOR_NEVERDROP, 0); … … 4055 4058 4056 4059 if (emphasized) { 4057 4058 4060 emphasized = FALSE; 4061 DrawTargetEmphasis(hwnd, emphasized); 4059 4062 } 4060 4063 if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) { 4061 4062 4063 4064 if (MakeValidDir(szFrom) && !FindDirCnrByName(szFrom, TRUE)) { 4065 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szFrom); 4066 } 4064 4067 } 4065 4068 } … … 4074 4077 4075 4078 static MRESULT EXPENTRY MainFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1, 4076 4079 MPARAM mp2) 4077 4080 { 4078 4081 PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER); … … 4086 4089 pswp = (SWP *) mp1; 4087 4090 if (fDataMin && !fAmClosing) { 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4091 if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) { 4092 4093 SWP swp; 4094 4095 WinQueryWindowPos(hwnd, &swp); 4096 PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(swp.fl), MPVOID); 4097 HideNote(); 4098 } 4099 else if (pswp->fl & (SWP_SHOW | SWP_RESTORE)) { 4100 if (DataHwnd) 4101 PostMsg(DataHwnd, WM_CLOSE, MPVOID, MPVOID); 4102 } 4100 4103 } 4101 4104 if (!fAmClosing) { 4102 4103 4105 if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) 4106 HideNote(); 4104 4107 } 4105 4108 } … … 4124 4127 case WM_CONTROL: 4125 4128 return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), UM_CONTROL, mp1, 4126 4129 mp2); 4127 4130 4128 4131 case WM_COMMAND: … … 4144 4147 4145 4148 if (mr && mp2) { 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4149 prectl = (PRECTL) mp1; 4150 if (prectl->yBottom != prectl->yTop) { 4151 { 4152 HPS hps; 4153 POINTL aptl[TXTBOX_COUNT]; 4154 4155 hps = WinGetPS(hwndStatus); 4156 if (hps) { 4157 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl); 4158 bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6; 4159 WinReleasePS(hps); 4160 } 4161 } 4162 prectl->yBottom += (sheight + 4); 4163 prectl->yTop -= (sheight + 4); 4164 if (fMoreButtons) { 4165 4166 HPS hps; 4167 POINTL aptl[TXTBOX_COUNT]; 4168 4169 hps = WinGetPS(hwndName); 4170 if (hps) { 4171 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl); 4172 bheight = aptl[TXTBOX_TOPLEFT].y + 6; 4173 WinReleasePS(hps); 4174 } 4175 prectl->yBottom += (bheight + 4); 4176 prectl->yTop -= (bheight + 4); 4177 } 4178 if (fToolbar) { 4179 if (!fTextTools) 4180 prectl->yTop -= ((fToolTitles) ? 50 : 40); 4181 else 4182 prectl->yTop -= 32; 4183 } 4184 if (fDrivebar) { 4185 ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), 4186 ((prectl->xRight - 4187 (WinQuerySysValue(HWND_DESKTOP, 4188 SV_CYSIZEBORDER) * 2)) - 4)); 4189 prectl->yTop -= (16 * (DriveLines * 18)); 4190 } 4191 if (fUserComboBox) { 4192 if (!aheight) { 4193 4194 SWP swpTemp; 4195 4196 WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT), 4197 &swpTemp); 4198 aheight = swpTemp.cy; 4199 } 4200 prectl->yTop -= (aheight + 6L); 4201 } 4202 if (fAutoView) { 4203 AutoviewHeight = min(AutoviewHeight, 4204 (prectl->yTop - prectl->yBottom) - 116); 4205 AutoviewHeight = max(AutoviewHeight, 36); 4206 prectl->yBottom += (AutoviewHeight + 6); 4207 } 4208 } 4206 4209 } 4207 4210 return mr; … … 4227 4230 pswp = (PSWP) mp1; 4228 4231 { 4229 4230 4231 4232 4233 4234 4235 4236 4237 4232 SHORT x; 4233 4234 for (x = 0; x < soldCount; x++) { 4235 if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) { 4236 pswpClient = pswp; 4237 break; 4238 } 4239 pswp++; 4240 } 4238 4241 } 4239 4242 4240 4243 { 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4244 HPS hps; 4245 POINTL aptl[TXTBOX_COUNT]; 4246 4247 hps = WinGetPS(hwndStatus); 4248 if (hps) { 4249 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl); 4250 bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6; 4251 WinReleasePS(hps); 4252 } 4253 if (fMoreButtons) { 4254 hps = WinGetPS(hwndName); 4255 if (hps) { 4256 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl); 4257 bheight = aptl[TXTBOX_TOPLEFT].y + 6; 4258 WinReleasePS(hps); 4259 } 4260 } 4258 4261 } 4259 4262 pswpNew = (PSWP) mp1 + soldCount; … … 4265 4268 pswpNew->y = swpClient.y + 2; 4266 4269 if (!fSplitStatus) 4267 4270 width = swpClient.cx - (16 + (sheight * 2) + 4); 4268 4271 else 4269 4272 width = (swpClient.cx - (16 + (sheight * 2) + 4)) / 2; 4270 4273 width = max(width, 10); 4271 4274 if (fSplitStatus) 4272 4275 pswpNew->cx = width - 6; 4273 4276 else 4274 4277 pswpNew->cx = width - 8; 4275 4278 pswpNew->cy = sheight; 4276 4279 pswpClient->y = pswpNew->y + pswpNew->cy + 3; … … 4279 4282 4280 4283 if (fSplitStatus) { 4281 4282 4283 4284 4285 4286 4287 4288 4289 4284 pswpNew = (PSWP) mp1 + (soldCount + 1); 4285 *pswpNew = *pswpClient; 4286 pswpNew->hwnd = hwndStatus2; 4287 pswpNew->hwndInsertBehind = HWND_BOTTOM; 4288 pswpNew->x = width + 8; 4289 pswpNew->y = swpClient.y + 2; 4290 pswpNew->cx = width - 6; 4291 pswpNew->cy = sheight; 4292 sCount++; 4290 4293 } 4291 4294 else { 4292 4293 4295 WinShowWindow(hwndStatus2, FALSE); 4296 WinSetWindowText(hwndStatus2, NullStr); 4294 4297 } 4295 4298 4296 4299 if (fToolbar) { 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4300 if (fTextTools) 4301 theight = 32L; 4302 else if (!fToolTitles) 4303 theight = 40L; 4304 pswpNew = (PSWP) mp1 + (soldCount + 1 + (fSplitStatus != FALSE)); 4305 *pswpNew = *pswpClient; 4306 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_TOOLS); 4307 pswpNew->hwndInsertBehind = HWND_BOTTOM; 4308 pswpNew->x = swpClient.x + 2; 4309 pswpNew->y = (swpClient.y + swpClient.cy) - (theight - 2); 4310 pswpNew->cx = swpClient.cx - 4; 4311 pswpNew->cy = theight - 4; 4312 pswpClient->cy -= theight; 4313 sCount++; 4311 4314 } 4312 4315 else 4313 4316 WinShowWindow(WinWindowFromID(hwnd, MAIN_TOOLS), FALSE); 4314 4317 4315 4318 if (fDrivebar) { 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4319 ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), pswpClient->cx - 4); 4320 pswpNew = (PSWP) mp1 + (soldCount + 1 + 4321 (fSplitStatus != FALSE) + 4322 (fToolbar != FALSE)); 4323 *pswpNew = *pswpClient; 4324 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_DRIVES); 4325 pswpNew->hwndInsertBehind = HWND_BOTTOM; 4326 pswpNew->x = swpClient.x + 2; 4327 dheight += ((dheight - 2) * DriveLines); 4328 pswpNew->y = (swpClient.y + swpClient.cy) - (dheight - 2); 4329 if (fToolbar) 4330 pswpNew->y -= theight; 4331 pswpNew->cx = swpClient.cx - 4; 4332 pswpNew->cy = dheight - 4; 4333 pswpClient->cy -= dheight; 4334 sCount++; 4332 4335 } 4333 4336 else 4334 4337 WinShowWindow(WinWindowFromID(hwnd, MAIN_DRIVES), FALSE); 4335 4338 4336 4339 if (fAutoView) { 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4340 pswpNew = (PSWP) mp1 + (soldCount + 1 + 4341 (fToolbar != FALSE) + 4342 (fDrivebar != FALSE) + 4343 (fSplitStatus != FALSE)); 4344 *pswpNew = *pswpClient; 4345 pswpNew->hwnd = (fComments) ? hwndAutoMLE : hwndAutoview; 4346 pswpNew->x = pswpClient->x + 3; 4347 pswpNew->y = pswpClient->y + 3; 4348 if (fMoreButtons) 4349 pswpNew->y += (bheight + 4); 4350 pswpNew->cx = pswpClient->cx - 6; 4351 AutoviewHeight = min(AutoviewHeight, pswpClient->cy - 116); 4352 AutoviewHeight = max(AutoviewHeight, 36); 4353 pswpNew->cy = AutoviewHeight; 4354 pswpClient->y += (AutoviewHeight + 6); 4355 pswpClient->cy -= (AutoviewHeight + 6); 4356 sCount++; 4357 WinShowWindow((fComments) ? hwndAutoview : hwndAutoMLE, FALSE); 4355 4358 } 4356 4359 else { 4357 4358 4360 WinShowWindow(hwndAutoview, FALSE); 4361 WinShowWindow(hwndAutoMLE, FALSE); 4359 4362 } 4360 4363 4361 4364 pswpNew = (PSWP) mp1 + (soldCount + 1 + 4362 4363 4364 4365 (fToolbar != FALSE) + 4366 (fDrivebar != FALSE) + 4367 (fSplitStatus != FALSE) + (fAutoView != FALSE)); 4365 4368 *pswpNew = *pswpClient; 4366 4369 pswpNew->hwnd = WinWindowFromID(hwnd, IDM_OPENWALK); … … 4371 4374 sCount++; 4372 4375 pswpNew = (PSWP) mp1 + (soldCount + 2 + 4373 4374 4375 4376 (fToolbar != FALSE) + 4377 (fDrivebar != FALSE) + 4378 (fSplitStatus != FALSE) + (fAutoView != FALSE)); 4376 4379 *pswpNew = *pswpClient; 4377 4380 pswpNew->hwnd = WinWindowFromID(hwnd, IDM_USERLIST); … … 4382 4385 sCount++; 4383 4386 pswpNew = (PSWP) mp1 + (soldCount + 3 + 4384 4385 4386 4387 (fToolbar != FALSE) + 4388 (fDrivebar != FALSE) + 4389 (fSplitStatus != FALSE) + (fAutoView != FALSE)); 4387 4390 *pswpNew = *pswpClient; 4388 4391 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LED); … … 4393 4396 sCount++; 4394 4397 pswpNew = (PSWP) mp1 + (soldCount + 4 + 4395 4396 4397 4398 (fToolbar != FALSE) + 4399 (fDrivebar != FALSE) + 4400 (fSplitStatus != FALSE) + (fAutoView != FALSE)); 4398 4401 *pswpNew = *pswpClient; 4399 4402 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LEDHDR); … … 4404 4407 sCount++; 4405 4408 if (fUserComboBox) { 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4409 if (!aheight) { 4410 4411 SWP swpTemp; 4412 4413 WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT), 4414 &swpTemp); 4415 aheight = swpTemp.cy; 4416 } 4417 pswpNew = (PSWP) mp1 + (soldCount + 5 + 4418 (fToolbar != FALSE) + 4419 (fSplitStatus != FALSE) + 4420 (fDrivebar != FALSE) + (fAutoView != FALSE)); 4421 *pswpNew = *pswpClient; 4422 pswpNew->hwnd = hwndDrivelist; 4423 pswpNew->x = swpClient.x; 4424 pswpNew->cx = 48; 4425 pswpClient->cy -= (aheight + 6L); 4426 pswpNew->y = pswpClient->y; 4427 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4428 sCount++; 4429 pswpNew = (PSWP) mp1 + (soldCount + 6 + 4430 (fToolbar != FALSE) + 4431 (fDrivebar != FALSE) + 4432 (fSplitStatus != FALSE) + 4433 (fAutoView != FALSE)); 4434 *pswpNew = *pswpClient; 4435 pswpNew->hwnd = hwndStatelist; 4436 pswpNew->x = swpClient.x + 48; 4437 pswpNew->cx = (swpClient.cx - 48) / 7; 4438 pswpNew->y = pswpClient->y; 4439 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4440 sCount++; 4441 pswpNew = (PSWP) mp1 + (soldCount + 7 + 4442 (fToolbar != FALSE) + 4443 (fDrivebar != FALSE) + 4444 (fSplitStatus != FALSE) + 4445 (fAutoView != FALSE)); 4446 *pswpNew = *pswpClient; 4447 pswpNew->hwnd = hwndCmdlist; 4448 pswpNew->x = swpClient.x + 48 + ((swpClient.cx - 48) / 7); 4449 pswpNew->cx = (swpClient.cx - 48) / 5 + 4450 ((swpClient.cx - 48) / 5) - ((swpClient.cx - 48) / 7); 4451 pswpNew->y = pswpClient->y; 4452 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4453 sCount++; 4454 pswpNew = (PSWP) mp1 + (soldCount + 8 + 4455 (fToolbar != FALSE) + 4456 (fDrivebar != FALSE) + 4457 (fSplitStatus != FALSE) + 4458 (fAutoView != FALSE)); 4459 *pswpNew = *pswpClient; 4460 pswpNew->hwnd = hwndUserlist; 4461 pswpNew->x = swpClient.x + 48 + (((swpClient.cx - 48) / 5) * 2); 4462 pswpNew->cx = ((swpClient.x + swpClient.cx) - pswpNew->x) - 4463 ((fToolbar) ? ((swpClient.cx - 48) / 7) : 0); 4464 pswpNew->y = pswpClient->y; 4465 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4466 sCount++; 4467 if (fToolbar) { 4468 pswpNew = (PSWP) mp1 + (soldCount + 9 + 4469 (fToolbar != FALSE) + 4470 (fDrivebar != FALSE) + 4471 (fSplitStatus != FALSE) + 4472 (fAutoView != FALSE)); 4473 *pswpNew = *pswpClient; 4474 pswpNew->hwnd = hwndButtonlist; 4475 pswpNew->x = swpClient.cx - ((swpClient.cx - 48) / 7) + 4; 4476 pswpNew->cx = (swpClient.x + swpClient.cx) - pswpNew->x; 4477 pswpNew->y = pswpClient->y; 4478 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4479 sCount++; 4480 } 4481 else 4482 WinShowWindow(hwndButtonlist, FALSE); 4480 4483 } 4481 4484 else { 4482 4483 4484 4485 4486 4485 WinShowWindow(hwndUserlist, FALSE); 4486 WinShowWindow(hwndDrivelist, FALSE); 4487 WinShowWindow(hwndStatelist, FALSE); 4488 WinShowWindow(hwndButtonlist, FALSE); 4489 WinShowWindow(hwndCmdlist, FALSE); 4487 4490 } 4488 4491 { 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4492 PSWP pswpTitlebar = (PSWP) 0, pswpMinbutton = (PSWP) 0; 4493 SHORT x; 4494 4495 pswpNew = (PSWP) mp1 + (soldCount + 5 + 4496 (fToolbar != FALSE) + 4497 (fDrivebar != FALSE) + 4498 (fSplitStatus != FALSE) + 4499 (fAutoView != FALSE) + 4500 ((fUserComboBox != FALSE) * 4) + 4501 (fUserComboBox != FALSE && 4502 fToolbar != FALSE)); 4503 pswp = (PSWP) mp1; 4504 for (x = 0; x < soldCount; x++) { 4505 if (!pswpTitlebar && 4506 WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_TITLEBAR) 4507 pswpTitlebar = pswp; 4508 else if (!pswpMinbutton && 4509 WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_MINMAX) 4510 pswpMinbutton = pswp; 4511 if (pswpTitlebar && pswpMinbutton) 4512 break; 4513 pswp++; 4514 } 4515 if (pswpMinbutton && pswpTitlebar) { 4516 *pswpNew = *pswpMinbutton; 4517 pswpNew->hwnd = WinWindowFromID(hwnd, IDM_IDEALSIZE); 4518 pswpNew->cy = pswpMinbutton->cy + 3; 4519 pswpNew->cx = min(pswpNew->cy, (pswpMinbutton->cx / 2) + 3); 4520 pswpTitlebar->cx -= (pswpNew->cx - 1); 4521 pswpNew->x = pswpTitlebar->x + (pswpTitlebar->cx); 4522 pswpNew->y = pswpMinbutton->y - 1; 4523 sCount++; 4524 } 4525 else 4526 WinShowWindow(WinWindowFromID(hwnd, IDM_IDEALSIZE), FALSE); 4524 4527 } 4525 4528 4526 4529 if (fMoreButtons) { 4527 4530 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4531 LONG lastx; 4532 4533 pswpNew = (PSWP) mp1 + (soldCount + 6 + 4534 (fToolbar != FALSE) + 4535 (fDrivebar != FALSE) + 4536 (fSplitStatus != FALSE) + 4537 (fAutoView != FALSE) + 4538 ((fUserComboBox != FALSE) * 4) + 4539 (fUserComboBox != FALSE && 4540 fToolbar != FALSE)); 4541 *pswpNew = *pswpClient; 4542 pswpNew->hwnd = hwndName; 4543 pswpNew->x = swpClient.x + 3; 4544 pswpNew->y = swpClient.y + (sheight + 6); 4545 pswpNew->cx = ((swpClient.cx / 2) + (swpClient.cx / 5)) - 3; 4546 lastx = pswpNew->x + pswpNew->cx; 4547 pswpNew->cy = bheight; 4548 pswpClient->y += (bheight + 4); 4549 pswpClient->cy -= (bheight + 4); 4550 sCount++; 4551 pswpNew = (PSWP) mp1 + (soldCount + 7 + 4552 (fToolbar != FALSE) + 4553 (fDrivebar != FALSE) + 4554 (fSplitStatus != FALSE) + 4555 (fAutoView != FALSE) + 4556 ((fUserComboBox != FALSE) * 4) + 4557 (fUserComboBox != FALSE && 4558 fToolbar != FALSE)); 4559 *pswpNew = *pswpClient; 4560 pswpNew->hwnd = hwndDate; 4561 pswpNew->x = lastx + 3; 4562 pswpNew->y = swpClient.y + (sheight + 6); 4563 pswpNew->cx = (swpClient.cx / 6) + (swpClient.cx / 16) - 3; 4564 lastx = pswpNew->x + pswpNew->cx; 4565 pswpNew->cy = bheight; 4566 sCount++; 4567 pswpNew = (PSWP) mp1 + (soldCount + 8 + 4568 (fToolbar != FALSE) + 4569 (fDrivebar != FALSE) + 4570 (fSplitStatus != FALSE) + 4571 (fAutoView != FALSE) + 4572 ((fUserComboBox != FALSE) * 4) + 4573 (fUserComboBox != FALSE && 4574 fToolbar != FALSE)); 4575 *pswpNew = *pswpClient; 4576 pswpNew->hwnd = hwndAttr; 4577 pswpNew->x = lastx + 3; 4578 pswpNew->y = swpClient.y + (sheight + 6); 4579 pswpNew->cx = (swpClient.cx - pswpNew->x) - 1; 4580 pswpNew->cy = bheight; 4581 sCount++; 4579 4582 } 4580 4583 else { 4581 4582 4583 4584 WinShowWindow(hwndAttr, FALSE); 4585 WinShowWindow(hwndName, FALSE); 4586 WinShowWindow(hwndDate, FALSE); 4584 4587 } 4585 4588 return MRFROMSHORT(sCount); … … 4594 4597 sCount += 6; 4595 4598 if (fSplitStatus) 4596 4599 sCount++; 4597 4600 if (fToolbar) 4598 4601 sCount++; 4599 4602 if (fUserComboBox) { 4600 4601 4602 4603 sCount += 4; 4604 if (fToolbar) 4605 sCount++; 4603 4606 } 4604 4607 if (fDrivebar) 4605 4608 sCount++; 4606 4609 if (fAutoView) 4607 4610 sCount++; 4608 4611 if (fMoreButtons) 4609 4612 sCount += 3; 4610 4613 return MRFROMSHORT(sCount); 4611 4614 } … … 4628 4631 // DbgMsg(pszSrcFile, __LINE__, "IDM_CONTEXTMENU %x", hwnd); 4629 4632 if (hwnd != NULLHANDLE) { 4630 4631 4632 4633 4634 4635 4636 4637 4638 4633 HWND hwndParent = WinQueryWindow(hwnd, QW_PARENT); 4634 USHORT id = WinQueryWindowUShort(hwndParent, QWS_ID); 4635 switch (id) { 4636 case MAIN_SETUPLIST: 4637 case MAIN_USERLIST: 4638 case MAIN_CMDLIST: 4639 // DbgMsg(pszSrcFile, __LINE__, "WM_CONTEXTMENU"); 4640 WinPostMsg(hwnd, WM_CONTEXTMENU, 0, 0); 4641 } 4639 4642 } 4640 4643 } … … 4665 4668 wa.size = sizeof(wa); 4666 4669 pci = 4667 4668 4669 4670 4671 4670 (PCNRITEM) 4671 WinSendMsg(WinWindowFromID 4672 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), 4673 CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST), 4674 MPFROMSHORT(CRA_CURSORED)); 4672 4675 if (pci && (INT) pci != -1) { 4673 4674 4676 strcpy(wa.szCurrentPath1, pci->pszFileName); 4677 MakeValidDir(wa.szCurrentPath1); 4675 4678 } 4676 4679 else 4677 4680 strcpy(wa.szCurrentPath1, pFM2SaveDirectory); 4678 4681 TopWindowName(hwndMain, (HWND) 0, wa.szCurrentPath2); 4679 4682 if (!*wa.szCurrentPath2) 4680 4683 strcpy(wa.szCurrentPath2, wa.szCurrentPath1); 4681 4684 MakeValidDir(wa.szCurrentPath2); 4682 4685 if (WinDlgBox(HWND_DESKTOP, 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4686 hwnd, 4687 WalkTwoCmpDlgProc, 4688 FM3ModHandle, 4689 WALK2_FRAME, 4690 MPFROMP(&wa)) && 4691 !IsFile(wa.szCurrentPath1) && !IsFile(wa.szCurrentPath2)) { 4692 if (!*dircompare) { 4693 4694 COMPARE *cmp; 4695 4696 cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__); 4697 if (cmp) { 4698 cmp->size = sizeof(COMPARE); 4699 strcpy(cmp->leftdir, wa.szCurrentPath1); 4700 strcpy(cmp->rightdir, wa.szCurrentPath2); 4701 cmp->hwndParent = hwnd; 4702 cmp->dcd.hwndParent = hwnd; 4703 WinDlgBox(HWND_DESKTOP, 4704 HWND_DESKTOP, 4705 CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp)); 4706 } 4707 } 4708 else { 4709 4710 CHAR szPath1[CCHMAXPATH]; 4711 CHAR szPath2[CCHMAXPATH]; 4712 runemf2(SEPARATE, 4713 HWND_DESKTOP, pszSrcFile, __LINE__, 4714 NULL, NULL, 4715 "%s %s %s", 4716 dircompare, 4717 BldQuotedFileName(szPath1, wa.szCurrentPath1), 4718 BldQuotedFileName(szPath2, wa.szCurrentPath2)); 4719 } 4717 4720 } 4718 4721 } … … 4726 4729 case IDM_CLI: 4727 4730 if (fSplitStatus && 4728 4729 4730 4731 hwndStatus2 && 4732 !WinIsWindow(WinQueryAnchorBlock(hwnd), 4733 WinWindowFromID(hwndStatus2, COMMAND_LINE))) 4731 4734 PostMsg(hwndStatus2, UM_CLICKED, MPVOID, MPVOID); 4732 4735 break; … … 4741 4744 bstrip(temp); 4742 4745 if (*temp && 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4746 !DosQueryPathInfo(temp, FIL_QUERYFULLNAME, path, sizeof(path))) { 4747 if (SHORT1FROMMP(mp1) == IDM_ADDTOUSERLIST) { 4748 add_udir(TRUE, path); 4749 if (fUdirsChanged) 4750 save_udirs(); 4751 WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID); 4752 } 4753 else { 4754 if (!remove_udir(path)) 4755 Runtime_Error(pszSrcFile, __LINE__, "remove_udir"); 4756 else { 4757 if (fUdirsChanged) 4758 save_udirs(); 4759 WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID); 4760 } 4761 } 4759 4762 } 4760 4763 } … … 4771 4774 // Complain if attempting to use reserved name 4772 4775 if (stricmp(szStateName, GetPString(IDS_STATETEXT)) == 0 || 4773 4776 stricmp(szStateName, GetPString(IDS_FM2TEMPTEXT)) == 0) 4774 4777 { 4775 4776 4777 4778 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, 4779 GetPString(IDS_WARNINGTEXT), 4780 "\"%s\" is a reserved state name", szStateName); 4778 4781 } 4779 4782 // Ignore request if blank 4780 4783 else if (*szStateName) { 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4784 BOOL fAbortOperation = FALSE; 4785 if (!fNoSaveState && fSaveState && stricmp(szStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0) 4786 { 4787 if (saymsg(MB_YESNO | MB_DEFBUTTON2 | MB_ICONASTERISK, hwnd, 4788 GetPString(IDS_WARNINGTEXT), 4789 GetPString(IDS_SHUTDOWNSTATE_WARNING), szStateName) == MBID_NO) 4790 fAbortOperation = TRUE; 4791 } 4792 if (!fAbortOperation) { 4793 if (SHORT1FROMMP(mp1) == IDM_SAVEDIRCNRSTATE) { 4794 // Save 4795 INT nSaved = SaveDirCnrState(hwnd, szStateName); 4796 if (nSaved >= 0) { 4797 INT ret = add_setup(szStateName); 4798 if (ret == 0) { 4799 WinSendMsg(hwndStatelist, LM_INSERTITEM, 4800 MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(szStateName)); 4801 save_setups(); 4802 } 4803 else if (ret != 1) { 4804 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, 4805 GetPString(IDS_WARNINGTEXT), 4806 "\"%s\" state name add failed", szStateName); // 15 Apr 07 SHL failed 4807 WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT)); 4808 } 4809 } 4810 else { 4811 saymsg(MB_ENTER | MB_ICONASTERISK, 4812 hwnd, 4813 GetPString(IDS_WARNINGTEXT), 4814 "State data save failed"); 4815 WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT)); 4816 } 4817 } 4818 else { 4819 // Delete 4820 ULONG numsaves = 0, size, x; 4821 CHAR s[STATE_NAME_MAX_BYTES + 80]; 4822 4823 INT ret = remove_setup(szStateName); 4824 if (ret == 1) 4825 save_setups(); 4826 sprintf(s, "%s.NumDirsLastTime", szStateName); 4827 size = sizeof(ULONG); 4828 if (!PrfQueryProfileData(fmprof, 4829 FM3Str, 4830 s, 4831 (PVOID)&numsaves, 4832 &size)) { 4833 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, 4834 GetPString(IDS_WARNINGTEXT), 4835 GetPString(IDS_DOESNTEXISTTEXT), szStateName); 4836 } 4837 else if (!size) 4838 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 4839 else { 4840 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0L); 4841 for (x = 0; x < numsaves; x++) { 4842 sprintf(s, "%s.DirCnrPos.%lu", szStateName, x); 4843 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4844 sprintf(s, "%s.DirCnrDir.%lu", szStateName, x); 4845 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4846 sprintf(s, "%s.DirCnrSort.%lu", szStateName, x); 4847 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4848 sprintf(s, "%s.DirCnrFilter.%lu", szStateName, x); 4849 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4850 sprintf(s, "%s.DirCnrView.%lu", szStateName, x); 4851 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4852 sprintf(s, "%s.DirCnr.%lu.DetailsLongname", szStateName, x); 4853 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4854 sprintf(s, "%s.DirCnr.%lu.DetailsSubject", szStateName, x); 4855 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4856 sprintf(s, "%s.DirCnr.%lu.DetailsSize", szStateName, x); 4857 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4858 sprintf(s, "%s.DirCnr.%lu.DetailsEA", szStateName, x); 4859 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4860 sprintf(s, "%s.DirCnr.%lu.DetailsAttr", szStateName, x); 4861 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4862 sprintf(s, "%s.DirCnr.%lu.DetailsIcon", szStateName, x); 4863 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4864 sprintf(s, "%s.DirCnr.%lu.DetailsLWDate", szStateName, x); 4865 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4866 sprintf(s, "%s.DirCnr.%lu.DetailsLWTime", szStateName, x); 4867 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4868 sprintf(s, "%s.DirCnr.%lu.DetailsLADate", szStateName, x); 4869 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4870 sprintf(s, "%s.DirCnr.%lu.DetailsLATime", szStateName, x); 4871 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4872 sprintf(s, "%s.DirCnr.%lu.DetailsCRDate", szStateName, x); 4873 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4874 sprintf(s, "%s.DirCnr.%lu.DetailsCRTime", szStateName, x); 4875 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4876 sprintf(s, "%s.DirCnr.%lu.Backgroundcolor", szStateName, x); 4877 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4878 sprintf(s, "%s.DirCnr.%lu.Fontnamesize", szStateName, x); 4879 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4880 } 4881 sprintf(s, "%s.LastTreePos", szStateName); 4882 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4883 sprintf(s, "%s.MySizeLastTime", szStateName); 4884 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4885 } 4886 PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID); 4887 } 4888 } 4886 4889 } 4887 4890 } … … 4896 4899 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp); 4897 4900 if (swp.fl & SWP_MAXIMIZE) { 4898 4899 4900 4901 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_SYSCOMMAND, 4902 MPFROM2SHORT(SC_RESTORE, 0), MPVOID); 4903 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp); 4901 4904 } 4902 4905 WinGetMaxPosition(WinQueryWindow(hwnd, QW_PARENT), &swpD); … … 4906 4909 swpD.cy -= (icz + bsz); 4907 4910 if (swp.x == swpD.x && swp.y == swpD.y && 4908 4909 4910 4911 4912 4913 4914 4915 4911 swp.cx == swpD.cx && swp.cy == swpD.cy && 4912 // fixme to be #defined someday 4913 WinQueryWindowUShort(hwnd, QWL_USER + 10) && 4914 WinQueryWindowUShort(hwnd, QWL_USER + 14)) { 4915 swpD.x = WinQueryWindowUShort(hwnd, QWL_USER + 8); 4916 swpD.cx = WinQueryWindowUShort(hwnd, QWL_USER + 10); 4917 swpD.y = WinQueryWindowUShort(hwnd, QWL_USER + 12); 4918 swpD.cy = WinQueryWindowUShort(hwnd, QWL_USER + 14); 4916 4919 } 4917 4920 else { 4918 4919 4920 4921 4921 WinSetWindowUShort(hwnd, QWL_USER + 8, (USHORT) swp.x); 4922 WinSetWindowUShort(hwnd, QWL_USER + 10, (USHORT) swp.cx); 4923 WinSetWindowUShort(hwnd, QWL_USER + 12, (USHORT) swp.y); 4924 WinSetWindowUShort(hwnd, QWL_USER + 14, (USHORT) swp.cy); 4922 4925 } 4923 4926 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 4924 4927 swpD.x, swpD.y, swpD.cx, swpD.cy, SWP_MOVE | SWP_SIZE); 4925 4928 } 4926 4929 break; … … 4928 4931 case IDM_BLINK: 4929 4932 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0, 4930 4933 SWP_MINIMIZE); 4931 4934 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0, 4932 4935 SWP_RESTORE | SWP_ZORDER); 4933 4936 break; 4934 4937 … … 4938 4941 4939 4942 if (hwndTop) 4940 4943 WinSetFocus(HWND_DESKTOP, hwndTop); 4941 4944 } 4942 4945 break; … … 4960 4963 case IDM_QUICKSETTINGS: 4961 4964 WinDlgBox(HWND_DESKTOP, 4962 4965 hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMLONG(mp1)); 4963 4966 break; 4964 4967 … … 4966 4969 case IDM_VIEWINFS: 4967 4970 WinDlgBox(HWND_DESKTOP, 4968 4969 4970 4971 4972 4973 4971 HWND_DESKTOP, 4972 ViewInfProc, 4973 FM3ModHandle, 4974 VINF_FRAME, 4975 ((SHORT1FROMMP(mp1) == IDM_VIEWHELPS) ? 4976 MPFROMP(NullStr) : MPVOID)); 4974 4977 break; 4975 4978 … … 4981 4984 TopWindowName(hwnd, (HWND) 0, newpath); 4982 4985 if (WinDlgBox(HWND_DESKTOP, 4983 4984 4985 4986 4986 hwnd, 4987 WalkAllDlgProc, 4988 FM3ModHandle, WALK_FRAME, MPFROMP(newpath)) && *newpath) 4989 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, newpath); 4987 4990 } 4988 4991 break; … … 5005 5008 if (SHORT1FROMMP(mp2) == CMDSRC_MENU) { 5006 5009 5007 5008 5009 5010 5011 5012 5013 5014 5015 5010 RECTL rcl; 5011 ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2L; 5012 5013 WinQueryWindowRect(HWND_DESKTOP, &rcl); 5014 rcl.yBottom += icz; 5015 rcl.yTop -= icz; 5016 rcl.xLeft += icz; 5017 rcl.xRight -= icz; 5018 WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID); 5016 5019 } 5017 5020 else { 5018 5021 5019 5020 5021 5022 5023 5024 5025 5026 5022 RECTL rcl; 5023 5024 WinQueryWindowRect(HWND_DESKTOP, &rcl); 5025 rcl.yBottom += 8; 5026 rcl.yTop = (rcl.yTop / 2) + (rcl.yTop / 7); 5027 rcl.xLeft = (rcl.xRight / 2) - (rcl.xRight / 7); 5028 rcl.xRight -= 8; 5029 WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID); 5027 5030 } 5028 5031 switch (SHORT1FROMMP(mp1)) { 5029 5032 case IDM_HELPCONTEXT: 5030 5031 5032 5033 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 5034 MPFROM2SHORT(HELP_CONTEXT, 0), MPFROMSHORT(HM_RESOURCEID)); 5035 break; 5033 5036 5034 5037 case IDM_HELPMOUSE: 5035 5036 5037 5038 5038 if (hwndHelp) 5039 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 5040 MPFROM2SHORT(HELP_MOUSE, 0), MPFROMSHORT(HM_RESOURCEID)); 5041 break; 5039 5042 5040 5043 case IDM_HELPPIX: 5041 5042 5043 5044 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 5045 MPFROM2SHORT(HELP_BITMAP1, 0), MPFROMSHORT(HM_RESOURCEID)); 5046 break; 5044 5047 5045 5048 case IDM_HELPTUTOR: 5046 5047 5048 5049 5049 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 5050 MPFROM2SHORT(HELP_TUTORIAL, 0), 5051 MPFROMSHORT(HM_RESOURCEID)); 5052 break; 5050 5053 5051 5054 case IDM_HELPHINTS: 5052 5053 5054 5055 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 5056 MPFROM2SHORT(HELP_HINTS, 0), MPFROMSHORT(HM_RESOURCEID)); 5057 break; 5055 5058 5056 5059 case IDM_HELPGENERAL: 5057 5058 5059 5060 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 5061 MPFROM2SHORT(HELP_MAIN, 0), MPFROMSHORT(HM_RESOURCEID)); 5062 break; 5060 5063 case IDM_HELPKEYS: 5061 5062 5063 5064 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 5065 MPFROM2SHORT(HELP_KEYS, 0), MPFROMSHORT(HM_RESOURCEID)); 5066 break; 5064 5067 5065 5068 case IDM_HELP: 5066 5069 case IDM_HELPCONTENTS: 5067 5068 5070 WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID); 5071 break; 5069 5072 5070 5073 case IDM_HELPUSERLIST: 5071 5072 5073 5074 5074 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 5075 MPFROM2SHORT(HELP_USERLISTS, 0), 5076 MPFROMSHORT(HM_RESOURCEID)); 5077 break; 5075 5078 } 5076 5079 } … … 5083 5086 case IDM_ABOUT: 5084 5087 WinDlgBox(HWND_DESKTOP, hwnd, AboutDlgProc, FM3ModHandle, 5085 5088 ABT_FRAME, MPVOID); 5086 5089 break; 5087 5090 … … 5097 5100 5098 5101 if (!DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_MINOR, 5099 5100 5101 5102 5103 5104 5105 5102 (PVOID) & version, (ULONG) sizeof(version))) { 5103 if (version[0] > 20L || (version[0] == 20L && version[1] > 29L)) { 5104 if (SHORT1FROMMP(mp1) == IDM_HICOLORPALETTE) 5105 palette = "<WP_HIRESCLRPAL>"; 5106 else 5107 palette = "<WP_LORESCLRPAL>"; 5108 } 5106 5109 } 5107 5110 OpenObject(palette, Default, hwnd); … … 5119 5122 hWPSObject = WinQueryObject("<WP_SCHPAL>"); 5120 5123 if (hWPSObject != NULLHANDLE) 5121 5122 5123 5124 5124 WinSetObjectData(hWPSObject, "SCHEMES=Winter:PM_Winter," 5125 "Spring:PM_Spring,Summer:PM_Summer," 5126 "System:PM_System,Windows:PM_Windows;" 5127 "OPEN=DEFAULT"); 5125 5128 } 5126 5129 break; … … 5133 5136 case IDM_SYSINFO: 5134 5137 WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, SysInfoDlgProc, FM3ModHandle, 5135 5138 SYS_FRAME, NULL); 5136 5139 break; 5137 5140 #endif … … 5143 5146 5144 5147 if (hwndTree) 5145 5146 5147 5148 pci = (PCNRITEM) WinSendMsg(hwndTree, CM_QUERYRECORDEMPHASIS, 5149 MPFROMLONG(CMA_FIRST), 5150 MPFROMSHORT(CRA_CURSORED)); 5148 5151 if (pci && (INT) pci != -1) { 5149 5150 5152 strcpy(path, pci->pszFileName); 5153 MakeValidDir(path); 5151 5154 } 5152 5155 else 5153 5156 strcpy(path, pFM2SaveDirectory); 5154 5157 WinDlgBox(HWND_DESKTOP, hwnd, InstantDlgProc, FM3ModHandle, 5155 5158 BAT_FRAME, MPFROMP(path)); 5156 5159 } 5157 5160 break; … … 5167 5170 TopWindowName(hwnd, (HWND) 0, path); 5168 5171 if (SHORT1FROMMP(mp1) == IDM_DOSCOMMANDLINE) 5169 5172 env = GetCmdSpec(TRUE); 5170 5173 else if (SHORT1FROMMP(mp1) != IDM_COMMANDLINE) { 5171 5172 5174 env = "WINOS2.COM"; 5175 type = SEPARATE | FULLSCREEN; 5173 5176 } 5174 5177 runemf2(type, hwnd, pszSrcFile, __LINE__, 5175 5178 path, NULL, "%s", env); 5176 5179 } 5177 5180 break; … … 5179 5182 case IDM_KILLPROC: 5180 5183 WinDlgBox(HWND_DESKTOP, hwnd, KillDlgProc, FM3ModHandle, 5181 5184 KILL_FRAME, NULL); 5182 5185 break; 5183 5186 … … 5194 5197 case IDM_AUTOVIEW: 5195 5198 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 5196 5199 &fAutoView, TRUE, "AutoView"); 5197 5200 AutoChange: 5198 5201 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 5199 5202 MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5200 5203 if (fAutoView) { 5201 5204 … … 5206 5209 hwndDir = TopWindowName(hwnd, (HWND) 0, s); 5207 5210 if (hwndDir) { 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5211 hwndDir = WinWindowFromID(hwndDir, FID_CLIENT); 5212 if (hwndDir) { 5213 hwndDir = WinWindowFromID(hwndDir, DIR_CNR); 5214 if (hwndDir) { 5215 pci = (PCNRITEM) WinSendMsg(hwndDir, CM_QUERYRECORDEMPHASIS, 5216 MPFROMLONG(CMA_FIRST), 5217 MPFROMSHORT(CRA_CURSORED)); 5218 if (pci && (INT) pci != -1 && 5219 (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW))) 5220 WinSendMsg(hwnd, 5221 UM_LOADFILE, 5222 MPFROMP(pci->pszFileName), 5223 (SHORT1FROMMP(mp1) == IDM_AUTOVIEW) ? 5224 MPVOID : MPFROMLONG(1)); 5225 } 5226 } 5224 5227 } 5225 5228 } … … 5228 5231 case IDM_TEXTTOOLS: 5229 5232 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 5230 5233 &fTextTools, TRUE, "TextTools"); 5231 5234 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 5232 5235 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 5233 5236 MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5234 5237 break; 5235 5238 5236 5239 case IDM_TOOLTITLES: 5237 5240 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 5238 5241 &fToolTitles, TRUE, "ToolTitles"); 5239 5242 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 5240 5243 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 5241 5244 MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5242 5245 break; 5243 5246 … … 5247 5250 MenuInvisible = MenuInvisible ? FALSE : TRUE; 5248 5251 if (MenuInvisible) { 5249 5250 5251 5252 5252 WinSetParent(hwndMenu, HWND_OBJECT, FALSE); 5253 WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5254 FID_SYSMENU), IDM_HIDEMENU, 5255 GetPString(IDS_UNHIDEMENUTEXT)); 5253 5256 } 5254 5257 else { 5255 5256 5257 5258 5258 WinSetParent(hwndMenu, WinQueryWindow(hwnd, QW_PARENT), FALSE); 5259 WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5260 FID_SYSMENU), IDM_HIDEMENU, 5261 GetPString(IDS_HIDEMENUTEXT)); 5259 5262 } 5260 5263 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 5261 5264 MPFROMLONG(FCF_MENU), MPVOID); 5262 5265 PrfWriteProfileData(fmprof, FM3Str, "MenuInvisible", 5263 5266 &MenuInvisible, sizeof(BOOL)); 5264 5267 } 5265 5268 break; … … 5274 5277 5275 5278 if (Collector) 5276 5279 already = TRUE; 5277 5280 if (!already && !fAutoTile && !fExternalCollector) 5278 5281 GetNextWindowPos(hwnd, &swp, NULL, NULL); 5279 5282 hwndC = StartCollector(fExternalCollector ? HWND_DESKTOP : hwnd, 4); 5280 5283 if (hwndC) { 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5284 if (!already && !fAutoTile && !fExternalCollector) 5285 WinSetWindowPos(hwndC, HWND_TOP, 5286 swp.x, swp.y, swp.cx, swp.cy, 5287 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER); 5288 else if (fAutoTile && !already) 5289 TileChildren(hwnd, TRUE); 5290 WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE | 5291 SWP_ACTIVATE); 5292 if (SHORT1FROMMP(mp1) == IDM_GREP) 5293 PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND, 5294 MPFROM2SHORT(IDM_GREP, 0), MPVOID); 5295 if (SHORT1FROMMP(mp1) == IDM_SEEALL) 5296 PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND, 5297 MPFROM2SHORT(IDM_SEEALL, 0), MPVOID); 5295 5298 } 5296 5299 } … … 5303 5306 5304 5307 if (!toolhead || !toolhead->next) { 5305 5306 5308 firsttool = (toolhead) ? toolhead->id : 0; 5309 break; 5307 5310 } 5308 5311 tool = find_tool(firsttool); 5309 5312 if (!tool) 5310 5313 tool = toolhead; 5311 5314 if (SHORT1FROMMP(mp1) == IDM_TOOLRIGHT) { 5312 5313 5315 tool = prev_tool(tool, TRUE); 5316 firsttool = tool->id; 5314 5317 } 5315 5318 else { 5316 5317 5319 tool = next_tool(tool, TRUE); 5320 firsttool = tool->id; 5318 5321 } 5319 5322 ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5320 5323 MAIN_TOOLS)); 5321 5324 } 5322 5325 break; … … 5328 5331 case IDM_TOOLBAR: 5329 5332 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5330 5333 IDM_TOOLSUBMENU, &fToolbar, TRUE, "Toolbar"); 5331 5334 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 5332 5335 WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5333 5336 MAIN_TOOLS), fToolbar); 5334 5337 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), 5335 5338 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5336 5339 if (fDrivebar) 5337 5340 WinInvalidateRect(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5338 5341 MAIN_DRIVES), NULL, TRUE); 5339 5342 break; 5340 5343 5341 5344 case IDM_DRIVEBAR: 5342 5345 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5343 5346 IDM_DRIVEBAR, &fDrivebar, TRUE, "Drivebar"); 5344 5347 WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5345 5348 MAIN_DRIVES), fDrivebar); 5346 5349 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 5347 5350 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5348 5351 PostMsg(hwnd, UM_BUILDDRIVEBAR, MPVOID, MPVOID); 5349 5352 break; … … 5351 5354 case IDM_USERLIST: 5352 5355 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5353 5356 SHORT1FROMMP(mp1), &fUserComboBox, TRUE, "UserComboBox"); 5354 5357 WinShowWindow(hwndUserlist, fUserComboBox); 5355 5358 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 5356 5359 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5357 5360 PostMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID); 5358 5361 PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID); … … 5366 5369 WinSetWindowText(hwndAttr, NullStr); 5367 5370 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5368 5371 SHORT1FROMMP(mp1), &fMoreButtons, TRUE, "MoreButtons"); 5369 5372 if (fMoreButtons) { 5370 5373 … … 5374 5377 5375 5378 if (hwndTemp) { 5376 5377 5379 WinSetFocus(HWND_DESKTOP, hwnd); 5380 WinSetFocus(HWND_DESKTOP, hwndTemp); 5378 5381 } 5379 5382 } 5380 5383 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 5381 5384 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5382 5385 break; 5383 5386 5384 5387 case IDM_TOGGLEDRAGDIALOG: 5385 5388 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5386 5387 5388 5389 5389 IDM_TOGGLEDRAGDIALOG, 5390 &fDragndropDlg, 5391 TRUE, 5392 "Drag&DropDlg"); 5390 5393 break; 5391 5394 5392 5395 case IDM_SYNCUPDATES: 5393 5396 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5394 5395 5396 5397 5397 IDM_SYNCUPDATES, 5398 &fSyncUpdates, 5399 TRUE, 5400 "SyncUpdates"); 5398 5401 break; 5399 5402 … … 5405 5408 WinQueryWindowPos(hwnd, &swp); 5406 5409 WinSetWindowPos(hwndTree, HWND_TOP, 0, swp.cy - swpT.cy, 0, 0, 5407 5410 SWP_MOVE); 5408 5411 } 5409 5412 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 5410 5413 &fFreeTree, TRUE, "FreeTree"); 5411 5414 if (fAutoTile) 5412 5415 TileChildren(hwnd, TRUE); … … 5415 5418 case IDM_AUTOTILE: 5416 5419 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5417 5420 SHORT1FROMMP(mp1), &fAutoTile, TRUE, "AutoTile"); 5418 5421 if (fAutoTile) 5419 5422 TileChildren(hwnd, TRUE); … … 5422 5425 case IDM_TILEBACKWARDS: 5423 5426 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5424 5427 SHORT1FROMMP(mp1), &fTileBackwards, TRUE, "TileBackwards"); 5425 5428 if (fAutoTile) 5426 5429 TileChildren(hwnd, TRUE); … … 5467 5470 default: 5468 5471 if (!SwitchCommand((HWND) WinQueryWindowULong(hwnd, QWL_USER), 5469 5472 SHORT1FROMMP(mp1))) { 5470 5473 if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART && 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5474 SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) { 5475 5476 INT x; 5477 HWND hwndCnr; 5478 5479 if (!cmdloaded) 5480 load_commands(); 5481 hwndCnr = TopWindow(hwnd, (HWND) 0); 5482 hwndCnr = (HWND) WinSendMsg(WinWindowFromID(hwndCnr, FID_CLIENT), 5483 UM_CONTAINERHWND, MPVOID, MPVOID); 5484 if (!hwndCnr) { 5485 Runtime_Error2(pszSrcFile, __LINE__, IDS_NOWINDOWTEXT); 5486 break; 5487 } 5488 x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART; 5489 if (x >= 0) { 5490 x++; 5491 RunCommand(hwndCnr, x); 5492 if (fUnHilite) { 5493 5494 PCNRITEM pci; 5495 DIRCNRDATA *dcd = NULL; 5496 5497 // 12 May 07 SHL fixme to understand? backwards maybe? looking for DIR_CNR? 5498 if (WinQueryWindowUShort(hwndCnr, QWS_ID) != TREE_CNR) 5499 dcd = INSTDATA(hwndCnr); 5500 pci = (PCNRITEM) WinSendMsg(hwndCnr, 5501 CM_QUERYRECORDEMPHASIS, 5502 MPFROMLONG(CMA_FIRST), 5503 MPFROMSHORT(CRA_CURSORED)); 5504 if (pci && (INT) pci != -1 && 5505 (pci->rc.flRecordAttr & CRA_SELECTED)) 5506 { 5507 UnHilite(hwnd, 5508 TRUE, 5509 dcd ? &dcd->lastselection : NULL, 5510 dcd ? dcd ->ulItemsToUnHilite : 0); 5511 } 5512 } 5513 } 5511 5514 } 5512 5515 else if (SHORT1FROMMP(mp1) >= IDM_QUICKTOOLSTART && 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5516 SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART + 51) { 5517 if (!qtloaded) 5518 load_quicktools(); 5519 if (quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]) { 5520 if (fToolsChanged) 5521 save_tools(NULL); 5522 if (!load_tools(quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1])) 5523 load_tools(NULL); 5524 else { 5525 strcpy(lasttoolbar, 5526 quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]); 5527 PrfWriteProfileString(fmprof, FM3Str, "LastToolbar", lasttoolbar); 5528 } 5529 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 5530 } 5528 5531 } 5529 5532 else { 5530 5533 5531 5532 5533 5534 5535 5536 5534 HWND hwndActive; 5535 5536 hwndActive = TopWindow(hwnd, (HWND) 0); 5537 if (hwndActive) 5538 PostMsg(WinWindowFromID(hwndActive, FID_CLIENT), 5539 WM_COMMAND, mp1, mp2); 5537 5540 } 5538 5541 } … … 5543 5546 5544 5547 static MRESULT EXPENTRY MainWMOnce(HWND hwnd, ULONG msg, MPARAM mp1, 5545 5548 MPARAM mp2) 5546 5549 { 5547 5550 TID tid; … … 5564 5567 WinSetWindowUShort(hwnd, QWL_USER + 12, 0); 5565 5568 WinSetWindowUShort(hwnd, QWL_USER + 16, 0); 5566 if (_beginthread(MakeMainObjWin, NULL, 245760, MPVOID) == -1) { 5567 Runtime_Error(pszSrcFile, __LINE__, 5568 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 5569 if (xbeginthread(MakeMainObjWin, 5570 245760, 5571 MPVOID, 5572 pszSrcFile, 5573 __LINE__) == -1) 5574 { 5569 5575 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID); 5570 5576 return 0; … … 5585 5591 5586 5592 if (!WinCreateWindow(hwndFrame, 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5593 WC_BUTTON, 5594 "I", 5595 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, 5596 ((swp.cx - 5597 WinQuerySysValue(HWND_DESKTOP, 5598 SV_CXMINMAXBUTTON)) - 5599 WinQuerySysValue(HWND_DESKTOP, 5600 SV_CXMINMAXBUTTON) / 2) - 5601 WinQuerySysValue(HWND_DESKTOP, 5602 SV_CXSIZEBORDER), 5603 (swp.cy - WinQuerySysValue(HWND_DESKTOP, 5604 SV_CYMINMAXBUTTON)) - 5605 WinQuerySysValue(HWND_DESKTOP, 5606 SV_CYSIZEBORDER), 5607 WinQuerySysValue(HWND_DESKTOP, 5608 SV_CXMINMAXBUTTON) / 2, 5609 WinQuerySysValue(HWND_DESKTOP, 5610 SV_CYMINMAXBUTTON), 5611 hwnd, HWND_TOP, IDM_IDEALSIZE, NULL, NULL)) { 5606 5612 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5607 5613 } 5608 5614 else { 5609 5615 WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_IDEALSIZE), 5610 5616 IdealButtonProc); 5611 5617 SetPresParams(WinWindowFromID(hwndFrame, 5612 5613 5618 IDM_IDEALSIZE), 5619 NULL, NULL, NULL, GetPString(IDS_10SYSTEMVIOTEXT)); 5614 5620 } 5615 5621 5616 5622 hwndTmp = WinCreateWindow(hwndFrame, 5617 5618 5619 5620 5621 5622 5623 5624 5623 WC_BUTTON, 5624 "#1019", 5625 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS | 5626 BS_BITMAP, 5627 swp.cx - 46, 5628 swp.y + 2, 5629 24, 5630 22, hwnd, HWND_TOP, IDM_OPENWALK, NULL, NULL); 5625 5631 if (!hwndTmp) 5626 5632 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5627 5633 5628 5634 hwndTmp = WinCreateWindow(hwndFrame, 5629 5630 5631 5632 5633 5634 5635 5636 5635 WC_BUTTON, 5636 "#3062", 5637 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS | 5638 BS_BITMAP, 5639 swp.cx - 22, 5640 swp.y + 2, 5641 24, 5642 22, hwnd, HWND_TOP, IDM_USERLIST, NULL, NULL); 5637 5643 if (!hwndTmp) 5638 5644 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5639 5645 5640 5646 hwndUserlist = WinCreateWindow(hwndFrame, 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5647 WC_COMBOBOX, 5648 (PSZ) NULL, 5649 WS_VISIBLE | CBS_DROPDOWN | 5650 LS_HORZSCROLL, 5651 (swp.x + 5652 WinQuerySysValue(HWND_DESKTOP, 5653 SV_CXSIZEBORDER) + 48L), 5654 (swp.cy - 5655 WinQuerySysValue(HWND_DESKTOP, 5656 SV_CYSIZEBORDER)) - 60, 5657 ((swp.cx - 5658 (WinQuerySysValue(HWND_DESKTOP, 5659 SV_CXSIZEBORDER) * 5660 2)) - 64L), 60L, hwndFrame, HWND_TOP, 5661 MAIN_USERLIST, NULL, NULL); 5656 5662 if (!hwndUserlist) 5657 5663 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5658 5664 hwndCmdlist = WinCreateWindow(hwndFrame, 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5665 WC_COMBOBOX, 5666 (PSZ) NULL, 5667 WS_VISIBLE | CBS_DROPDOWN | 5668 LS_HORZSCROLL, 5669 (swp.x + 5670 WinQuerySysValue(HWND_DESKTOP, 5671 SV_CXSIZEBORDER) + 48L), 5672 (swp.cy - 5673 WinQuerySysValue(HWND_DESKTOP, 5674 SV_CYSIZEBORDER)) - 60, 5675 ((swp.cx - 5676 (WinQuerySysValue(HWND_DESKTOP, 5677 SV_CXSIZEBORDER) * 2)) - 5678 64L), 60L, hwndFrame, HWND_TOP, 5679 MAIN_CMDLIST, NULL, NULL); 5674 5680 if (!hwndCmdlist) 5675 5681 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5676 5682 WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT)); 5677 5683 hwndStatelist = WinCreateWindow(hwndFrame, 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5684 WC_COMBOBOX, 5685 (PSZ) NULL, 5686 WS_VISIBLE | CBS_DROPDOWN | 5687 LS_HORZSCROLL, 5688 (swp.x + 5689 WinQuerySysValue(HWND_DESKTOP, 5690 SV_CXSIZEBORDER) + 48L), 5691 (swp.cy - 5692 WinQuerySysValue(HWND_DESKTOP, 5693 SV_CYSIZEBORDER)) - 60, 5694 ((swp.cx - 5695 (WinQuerySysValue(HWND_DESKTOP, 5696 SV_CXSIZEBORDER) * 5697 2)) - 64L), 60L, hwndFrame, HWND_TOP, 5698 MAIN_SETUPLIST, NULL, NULL); 5693 5699 if (!hwndStatelist) 5694 5700 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5695 5701 5696 5702 hwndDrivelist = WinCreateWindow(hwndFrame, 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5703 WC_COMBOBOX, 5704 (PSZ) NULL, 5705 WS_VISIBLE | CBS_DROPDOWN, 5706 (swp.x + 5707 WinQuerySysValue(HWND_DESKTOP, 5708 SV_CXSIZEBORDER)), 5709 (swp.cy - 5710 WinQuerySysValue(HWND_DESKTOP, 5711 SV_CYSIZEBORDER)) - 60, 5712 48L, 5713 60L, 5714 hwndFrame, 5715 HWND_TOP, MAIN_DRIVELIST, NULL, NULL); 5710 5716 if (!hwndDrivelist) 5711 5717 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5712 5718 SetPresParams(hwndDrivelist, 5713 5719 NULL, NULL, NULL, GetPString(IDS_10SYSTEMMONOTEXT)); 5714 5720 hwndButtonlist = WinCreateWindow(hwndFrame, 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5721 WC_COMBOBOX, 5722 (PSZ) NULL, 5723 WS_VISIBLE | CBS_DROPDOWN | 5724 LS_HORZSCROLL, 5725 (swp.cx - 5726 WinQuerySysValue(HWND_DESKTOP, 5727 SV_CXSIZEBORDER)) - 5728 164L, 5729 (swp.cy - 5730 WinQuerySysValue(HWND_DESKTOP, 5731 SV_CYSIZEBORDER)) - 60, 5732 164L, 60L, hwndFrame, HWND_TOP, 5733 MAIN_BUTTONLIST, NULL, NULL); 5728 5734 if (!hwndButtonlist) 5729 5735 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5730 5736 WinSendMsg(WinWindowFromID(hwndUserlist, CBID_EDIT), 5731 5737 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 5732 5738 WinSendMsg(WinWindowFromID(hwndStatelist, CBID_EDIT), 5733 5739 EM_SETTEXTLIMIT, MPFROM2SHORT(STATE_NAME_MAX_BYTES, 0), MPVOID); 5734 5740 WinSendMsg(WinWindowFromID(hwndDrivelist, CBID_EDIT), 5735 5741 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID); 5736 5742 WinSendMsg(WinWindowFromID(hwndButtonlist, CBID_EDIT), 5737 5743 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID); 5738 5744 WinSendMsg(WinWindowFromID(hwndCmdlist, CBID_EDIT), 5739 5745 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID); 5740 5746 5741 5747 oldproc = WinSubclassWindow(WinWindowFromID(hwndUserlist, CBID_EDIT), 5742 5748 DropDownListProc); 5743 5749 WinSetWindowPtr(WinWindowFromID(hwndUserlist, CBID_EDIT), 5744 5750 QWL_USER, (PVOID) oldproc); 5745 5751 oldproc = WinSubclassWindow(WinWindowFromID(hwndCmdlist, CBID_EDIT), 5746 5752 DropDownListProc); 5747 5753 WinSetWindowPtr(WinWindowFromID(hwndCmdlist, CBID_EDIT), 5748 5754 QWL_USER, (PVOID) oldproc); 5749 5755 oldproc = WinSubclassWindow(WinWindowFromID(hwndButtonlist, CBID_EDIT), 5750 5756 DropDownListProc); 5751 5757 WinSetWindowPtr(WinWindowFromID(hwndButtonlist, CBID_EDIT), 5752 5758 QWL_USER, (PVOID) oldproc); 5753 5759 oldproc = WinSubclassWindow(WinWindowFromID(hwndStatelist, CBID_EDIT), 5754 5760 DropDownListProc); 5755 5761 WinSetWindowPtr(WinWindowFromID(hwndStatelist, CBID_EDIT), 5756 5762 QWL_USER, (PVOID) oldproc); 5757 5763 oldproc = WinSubclassWindow(WinWindowFromID(hwndDrivelist, CBID_EDIT), 5758 5764 DropDownListProc); 5759 5765 WinSetWindowPtr(WinWindowFromID(hwndDrivelist, CBID_EDIT), 5760 5766 QWL_USER, (PVOID) oldproc); 5761 5767 oldproc = WinSubclassWindow(hwndUserlist, DropDownListProc); 5762 5768 WinSetWindowPtr(hwndUserlist, QWL_USER, (PVOID) oldproc); … … 5770 5776 WinSetWindowPtr(hwndButtonlist, QWL_USER, (PVOID) oldproc); 5771 5777 oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_USERLIST), 5772 5778 ChildFrameButtonProc); 5773 5779 WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_USERLIST), 5774 5780 QWL_USER, (PVOID) oldproc); 5775 5781 oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_OPENWALK), 5776 5782 ChildFrameButtonProc); 5777 5783 WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_OPENWALK), 5778 5784 QWL_USER, (PVOID) oldproc); 5779 5785 hwndMenu = WinWindowFromID(hwndFrame, FID_MENU); 5780 5786 WinSendMsg(hwnd, UM_ADDTOMENU, MPVOID, MPVOID); … … 5790 5796 hwndSysMenu = WinWindowFromID(hwndFrame, FID_SYSMENU); 5791 5797 idSysMenu = SHORT1FROMMR(WinSendMsg(hwndSysMenu, 5792 5793 5798 MM_ITEMIDFROMPOSITION, 5799 MPVOID, MPVOID)); 5794 5800 WinSendMsg(hwndSysMenu, 5795 5801 MM_QUERYITEM, MPFROM2SHORT(idSysMenu, 0), MPFROMP(&mit)); 5796 5802 hwndSysSubMenu = mit.hwndSubMenu; 5797 5803 mi.iPosition = MIT_END; … … 5802 5808 mi.id = IDM_IDEALSIZE; 5803 5809 WinSendMsg(hwndSysSubMenu, 5804 5805 5810 MM_INSERTITEM, 5811 MPFROMP(&mi), MPFROMP(GetPString(IDS_IDEALMENUTEXT))); 5806 5812 mi.afStyle = MIS_TEXT; 5807 5813 mi.id = IDM_HIDEMENU; 5808 5814 WinSendMsg(hwndSysSubMenu, 5809 5810 5815 MM_INSERTITEM, 5816 MPFROMP(&mi), MPFROMP(GetPString(IDS_HIDEMENUTEXT))); 5811 5817 SetSysMenu(hwndSysMenu); 5812 5818 5813 5819 size = sizeof(BOOL); 5814 5820 if (PrfQueryProfileData(fmprof, 5815 5816 5821 FM3Str, 5822 "MenuInvisible", &temp, &size) && size && temp) 5817 5823 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID); 5818 5824 size = sizeof(BOOL); 5819 5825 if (PrfQueryProfileData(fmprof, 5820 5826 FM3Str, "FreeTree", &temp, &size) && size && temp) 5821 5827 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_FREETREE, 0), MPVOID); 5822 5828 size = sizeof(BOOL); 5823 5829 if (PrfQueryProfileData(fmprof, 5824 5825 5830 FM3Str, 5831 "AutoTile", &temp, &size) && size && !temp) 5826 5832 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_AUTOTILE, 0), MPVOID); 5827 5833 size = sizeof(BOOL); 5828 5834 if (PrfQueryProfileData(fmprof, 5829 5835 FM3Str, "Toolbar", &temp, &size) && size && !temp) 5830 5836 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID); 5831 5837 … … 5850 5856 hwndTree = StartTreeCnr(hwnd, 4); 5851 5857 if (!hwndTree) 5852 5858 WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT)); 5853 5859 else { 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5860 if (!fSaveState || 5861 !PrfQueryProfileData(fmprof, 5862 FM3Str, 5863 "LastTreePos", 5864 &swp, &size) || size != sizeof(SWP)) { 5865 5866 INT ratio, height = 0; 5867 5868 if (!fNoTreeGap) 5869 height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2; 5870 size = sizeof(ratio); 5871 if (!PrfQueryProfileData(fmprof, 5872 FM3Str, 5873 "TreeWindowRatio", 5874 (PVOID) & ratio, 5875 &size) || size < sizeof(ratio)) 5876 ratio = 400; 5877 WinSetWindowPos(hwndTree, 5878 HWND_TOP, 5879 0, 5880 height, 5881 (swp.cx * 100) / ratio, 5882 swp.cy - height, 5883 SWP_SHOW | SWP_SIZE | SWP_MOVE | 5884 SWP_ACTIVATE | SWP_ZORDER); 5885 } 5886 else 5887 WinSetWindowPos(hwndTree, 5888 HWND_TOP, 5889 swp.x, 5890 swp.y, 5891 swp.cx, 5892 swp.cy, 5893 swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW | 5894 SWP_ZORDER | SWP_ACTIVATE); 5889 5895 } 5890 5896 // ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), … … 5900 5906 PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszStatename), MPVOID); 5901 5907 if (!add_setup(pszStatename)) 5902 5908 save_setups(); 5903 5909 } else { 5904 5910 load_tools(NULL); … … 5914 5920 5915 5921 for (x = 1; x < argc; x++) { 5916 5917 5918 5919 5920 5922 if (*argv[x] == '/' || *argv[x] == ';') 5923 continue; 5924 if (!IsFile(argv[x]) && !FindDirCnrByName(argv[x], FALSE)) { 5925 OpenDirCnr((HWND) 0, hwndMain, hwndTree, TRUE, argv[x]); 5926 } 5921 5927 } 5922 5928 } … … 5936 5942 hwndActive = TopWindow(hwnd, hwndTree); 5937 5943 if (hwndActive) 5938 5944 WinSetWindowPos(hwndActive, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE); 5939 5945 } 5940 5946 if (fStartMinimized || fReminimize) … … 5969 5975 case WM_CONTROLPOINTER: 5970 5976 if (!fNoFinger && 5971 5972 5977 (SHORT1FROMMP(mp1) == IDM_OPENWALK || 5978 SHORT1FROMMP(mp1) == IDM_USERLIST)) 5973 5979 return MRFROMLONG(hptrFinger); 5974 5980 break; … … 6010 6016 if (mp1) { 6011 6017 if (fUserComboBox) 6012 6013 6018 WinSetWindowText(WinWindowFromID(hwndUserlist, CBID_EDIT), 6019 (CHAR *)mp1); 6014 6020 if (add_udir(FALSE, (CHAR *)mp1)) { 6015 6016 6017 6018 6019 6021 if (fUserComboBox && fAutoAddDirs) { 6022 WinSendMsg(hwndUserlist, LM_INSERTITEM, 6023 MPFROM2SHORT(LIT_SORTASCENDING, 0), 6024 MPFROMP((CHAR *)mp1)); 6025 } 6020 6026 } 6021 6027 } … … 6049 6055 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp); 6050 6056 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) { 6051 6052 6053 6054 6057 WinStoreWindowPos(FM2Str, 6058 "MainWindowPos", WinQueryWindow(hwnd, QW_PARENT)); 6059 if (!fNoSaveState && fSaveState) 6060 SaveDirCnrState(hwnd, GetPString(IDS_SHUTDOWNSTATE)); 6055 6061 } 6056 6062 } … … 6062 6068 case 1: 6063 6069 { 6064 6065 6066 6067 6068 6069 6070 6071 6070 HWND hwndCurrent; 6071 ULONG wmsg; 6072 6073 wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU; 6074 hwndCurrent = TopWindow(hwnd, (HWND) 0); 6075 PortholeInit((HWND) WinSendMsg(WinWindowFromID(hwndCurrent, 6076 FID_CLIENT), wmsg, 6077 MPVOID, MPVOID), mp1, mp2); 6072 6078 } 6073 6079 break; … … 6087 6093 */ 6088 6094 { 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6095 HWND hwndMenu, hwndSubMenu; 6096 MENUITEM mi; 6097 6098 hwndMenu = WinQueryWindowULong(hwnd, QWL_USER); 6099 memset(&mi, 0, sizeof(mi)); 6100 mi.iPosition = MIT_END; 6101 mi.afStyle = MIS_TEXT; 6102 if (!WinSendMsg(hwndMenu, MM_QUERYITEM, 6103 MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi))) 6104 break; 6105 hwndSubMenu = mi.hwndSubMenu; 6106 SetupWinList(hwndSubMenu, hwnd, WinQueryWindow(hwnd, QW_PARENT)); 6101 6107 } 6102 6108 break; … … 6104 6110 default: 6105 6111 { 6106 6107 6108 6109 6110 6112 HWND hwndCurrent; 6113 6114 hwndCurrent = TopWindow(hwnd, (HWND) 0); 6115 if (hwndCurrent) 6116 WinSendMsg(hwndCurrent, UM_INITMENU, mp1, mp2); 6111 6117 } 6112 6118 break; … … 6116 6122 case UM_ADDTOMENU: 6117 6123 AddToMenu((CHAR *)mp1, WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 6118 6124 FID_MENU)); 6119 6125 return 0; 6120 6126 … … 6129 6135 info = cmdhead; 6130 6136 while (info) { 6131 6132 6133 6137 WinSendMsg(hwndCmdlist, LM_INSERTITEM, 6138 MPFROM2SHORT(LIT_END, 0), MPFROMP(info->title)); 6139 info = info->next; 6134 6140 } 6135 6141 } … … 6155 6161 ulSearchCount = 1; 6156 6162 if (!DosFindFirst("*.TLS", &hDir, FILE_READONLY | FILE_ARCHIVED, 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6163 &findbuf, sizeof(FILEFINDBUF3), 6164 &ulSearchCount, FIL_STANDARD)) { 6165 do { 6166 priority_bumped(); 6167 if (!foundit) { 6168 thisone = FALSE; 6169 p = strrchr(lasttoolbar, '\\'); 6170 if (!p) 6171 p = lasttoolbar; 6172 else 6173 p++; 6174 if (!stricmp(findbuf.achName, p)) 6175 thisone = TRUE; 6176 } 6177 p = strrchr(findbuf.achName, '.'); 6178 if (p) 6179 *p = 0; 6180 sSelect = (SHORT) WinSendMsg(hwndButtonlist, LM_INSERTITEM, 6181 MPFROM2SHORT(LIT_SORTASCENDING, 0), 6182 MPFROMP(findbuf.achName)); 6183 if (!foundit && thisone && sSelect >= 0) { 6184 WinSendMsg(hwndButtonlist, LM_SELECTITEM, 6185 MPFROM2SHORT(sSelect, 0), MPFROMLONG(TRUE)); 6186 foundit = TRUE; 6187 } 6188 } 6189 while (!DosFindNext(hDir, &findbuf, sizeof(FILEFINDBUF3), 6190 &ulSearchCount)); 6191 DosFindClose(hDir); 6192 priority_bumped(); 6187 6193 } 6188 6194 WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBARTEXT)); … … 6203 6209 6204 6210 if (!loadedudirs) 6205 6211 load_udirs(); 6206 6212 DosError(FERR_DISABLEHARDERR); 6207 6213 DosQCurDisk(&ulDriveNum, &ulDriveMap); 6208 6214 info = udirhead; 6209 6215 while (info) { 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6216 if (IsFullName(info->path) && 6217 !(driveflags[toupper(*info->path) - 'A'] & 6218 (DRIVE_IGNORE | DRIVE_INVALID))) { 6219 DosError(FERR_DISABLEHARDERR); 6220 hDir = HDIR_CREATE; 6221 ulSearchCount = 1; 6222 if (!IsRoot(info->path)) 6223 rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY | 6224 MUST_HAVE_DIRECTORY | FILE_READONLY | 6225 FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN, 6226 &findbuf, sizeof(FILEFINDBUF3), 6227 &ulSearchCount, FIL_STANDARD); 6228 else { 6229 rc = 0; 6230 findbuf.attrFile = FILE_DIRECTORY; 6231 } 6232 priority_bumped(); 6233 if (!rc) { 6234 if (!IsRoot(info->path)) 6235 DosFindClose(hDir); 6236 if (findbuf.attrFile & FILE_DIRECTORY) 6237 WinSendMsg(hwndUserlist, LM_INSERTITEM, 6238 MPFROM2SHORT(LIT_SORTASCENDING, 0), 6239 MPFROMP(info->path)); 6240 else { 6241 temp = info->next; 6242 remove_udir(info->path); 6243 info = temp; 6244 continue; 6245 } 6246 } 6247 else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) { 6248 temp = info->next; 6249 remove_udir(info->path); 6250 info = temp; 6251 continue; 6252 } 6253 } 6254 info = info->next; 6249 6255 } 6250 6256 info = ldirhead; 6251 6257 while (info) { 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6258 if (IsFullName(info->path) && 6259 !(driveflags[toupper(*info->path) - 'A'] & 6260 (DRIVE_IGNORE | DRIVE_INVALID))) { 6261 DosError(FERR_DISABLEHARDERR); 6262 hDir = HDIR_CREATE; 6263 ulSearchCount = 1; 6264 if (!IsRoot(info->path)) 6265 rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY | 6266 MUST_HAVE_DIRECTORY | FILE_READONLY | 6267 FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN, 6268 &findbuf, sizeof(FILEFINDBUF3), 6269 &ulSearchCount, FIL_STANDARD); 6270 else { 6271 rc = 0; 6272 findbuf.attrFile = FILE_DIRECTORY; 6273 } 6274 priority_bumped(); 6275 if (!rc) { 6276 if (!IsRoot(info->path)) 6277 DosFindClose(hDir); 6278 if (findbuf.attrFile & FILE_DIRECTORY) 6279 WinSendMsg(hwndUserlist, LM_INSERTITEM, 6280 MPFROM2SHORT(LIT_SORTASCENDING, 0), 6281 MPFROMP(info->path)); 6282 else { 6283 temp = info->next; 6284 remove_udir(info->path); 6285 info = temp; 6286 continue; 6287 } 6288 } 6289 else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) { 6290 temp = info->next; 6291 remove_udir(info->path); 6292 info = temp; 6293 continue; 6294 } 6295 } 6296 info = info->next; 6291 6297 } 6292 6298 WinSendMsg(hwndUserlist, LM_INSERTITEM, 6293 6294 6299 MPFROM2SHORT(0, 0), 6300 MPFROMP(GetPString(IDS_NEWDIRECTORYTEXT))); 6295 6301 WinSetWindowText(hwndUserlist, GetPString(IDS_COMMONDIRTEXT)); 6296 6302 } … … 6306 6312 case WM_SIZE: 6307 6313 ResizeChildren(hwnd, SHORT1FROMMP(mp1), SHORT2FROMMP(mp1), 6308 6314 SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)); 6309 6315 break; 6310 6316 … … 6320 6326 hps = WinBeginPaint(hwnd, (HPS) 0, NULL); 6321 6327 if (hps) { 6322 6323 6324 6328 WinQueryWindowRect(hwnd, &rcl); 6329 WinFillRect(hps, &rcl, CLR_PALEGRAY); 6330 WinEndPaint(hps); 6325 6331 } 6326 6332 } … … 6336 6342 switch (SHORT2FROMMP(mp1)) { 6337 6343 case CBN_ENTER: 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6344 { 6345 HWND hwndUL = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 6346 SHORT1FROMMP(mp1)); 6347 CHAR path[CCHMAXPATH]; 6348 ULONG ul; 6349 6350 switch (SHORT1FROMMP(mp1)) { 6351 case MAIN_USERLIST: 6352 ul = CCHMAXPATH; 6353 break; 6354 case MAIN_SETUPLIST: 6355 ul = STATE_NAME_MAX_BYTES; 6356 break; 6357 default: 6358 ul = 13; // fixme to not be hardcoded 6359 } 6360 6361 SetShiftState(); 6362 WinQueryWindowText(WinWindowFromID(hwndUL, CBID_EDIT), ul, path); 6363 bstrip(path); 6364 if (*path) { 6365 if (SHORT1FROMMP(mp1) == MAIN_USERLIST) { 6366 if (!strcmp(path, GetPString(IDS_NEWDIRECTORYTEXT))) { 6367 if (!LastDir || 6368 !WinSendMsg(WinQueryWindow(LastDir, QW_PARENT), 6369 UM_CONTAINERDIR, MPFROMP(path), MPVOID)) 6370 strcpy(path, pFM2SaveDirectory); 6371 if (!PMMkDir(hwnd, path, TRUE)) { 6372 WinSetWindowText(hwndUL, GetPString(IDS_COMMONDIRTEXT)); 6373 break; 6374 } 6375 } 6376 if (!IsFile(path) && !FindDirCnrByName(path, TRUE)) { 6377 6378 HWND hwndDir; 6379 6380 if ((fUserListSwitches && 6381 !(shiftstate & KC_SHIFT)) || 6382 (!fUserListSwitches && (shiftstate & KC_SHIFT))) { 6383 hwndDir = FindDirCnr(hwnd); 6384 if (hwndDir) { 6385 WinSendMsg(LastDir, UM_SETDIR, MPFROMP(path), MPVOID); 6386 break; 6387 } 6388 } 6389 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, path); 6390 } 6391 } 6392 else if (SHORT1FROMMP(mp1) == MAIN_DRIVELIST) { 6393 ShowTreeRec(WinWindowFromID(WinWindowFromID(hwndTree, 6394 FID_CLIENT), 6395 TREE_CNR), path, FALSE, TRUE); 6396 WinSetFocus(HWND_DESKTOP, hwndTree); 6397 } 6398 else if (SHORT1FROMMP(mp1) == MAIN_BUTTONLIST) { 6399 strcat(path, ".TLS"); 6400 load_tools(path); 6401 PrfWriteProfileString(fmprof, 6402 FM3Str, "LastToolbar", lasttoolbar); 6403 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 6404 WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBARTEXT)); 6405 } 6406 else if (SHORT1FROMMP(mp1) == MAIN_SETUPLIST) { 6407 CHAR szKey[80]; 6408 ULONG size, numsaves = 0; 6409 6410 SetShiftState(); 6411 size = sizeof(ULONG); 6412 sprintf(szKey, "%s.NumDirsLastTime", path); // path is state name 6413 if (!PrfQueryProfileData(fmprof, 6414 FM3Str, 6415 szKey, 6416 (PVOID)&numsaves, 6417 &size)) 6418 { 6419 if ((WinGetLastError(WinQueryAnchorBlock(hwnd)) & 0xffff) == PMERR_NOT_IN_IDX) { 6420 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, 6421 GetPString(IDS_WARNINGTEXT), 6422 GetPString(IDS_DOESNTEXISTTEXT), path); 6423 } 6424 else { 6425 Win_Error2(hwnd, hwnd, __FILE__, __LINE__, 6426 IDS_PRFQUERYPROFILEDATA); 6427 } 6428 } 6429 else { 6430 char *pszStateName; 6431 if ((shiftstate & KC_SHIFT) == 0) 6432 PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2)); 6433 pszStateName = xstrdup(path, pszSrcFile, __LINE__); 6434 if (!pszStateName) { 6435 // Fall back if out of memory - already complained 6436 if ((shiftstate & KC_SHIFT) != 0 || fAutoTile) { 6437 // Autotile requested or forced 6438 PostMsg(MainObjectHwnd, 6439 UM_RESTORE, 6440 MPVOID, 6441 MPFROMLONG(1)); // Autotile 6442 } 6443 } 6444 else if (!PostMsg(MainObjectHwnd, 6445 UM_RESTORE, 6446 MPFROMP(pszStateName), 6447 MPVOID)) { 6448 free(pszStateName); 6449 } 6450 } 6451 } 6452 else if (SHORT1FROMMP(mp1) == MAIN_CMDLIST) { 6453 6454 SHORT sSelect; 6455 6456 sSelect = (SHORT) WinSendMsg(hwndCmdlist, 6457 LM_QUERYSELECTION, 6458 MPFROMSHORT(LIT_FIRST), MPVOID); 6459 if (sSelect >= 0) 6460 WinPostMsg(hwnd, 6461 WM_COMMAND, 6462 MPFROM2SHORT(IDM_COMMANDSTART + sSelect, 0), 6463 MPVOID); 6464 WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT)); 6465 } 6466 } 6467 } 6468 break; 6463 6469 6464 6470 default: 6465 6471 break; 6466 6472 } 6467 6473 break; … … 6483 6489 case WM_CLOSE: 6484 6490 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), 6485 6491 WM_SYSCOMMAND, MPFROM2SHORT(SC_RESTORE, 0), MPVOID); 6486 6492 WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID); 6487 6493 fAmClosing = TRUE; 6488 6494 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), 6489 6495 WM_SYSCOMMAND, MPFROM2SHORT(SC_MINIMIZE, 0), MPVOID); 6490 6496 if (CloseChildren(hwnd)) { 6491 6497 fAmClosing = FALSE; 6492 6498 if (fAutoTile) 6493 6499 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TILE, 0), MPVOID); 6494 6500 return 0; 6495 6501 } 6496 6502 if (hwndTree) { 6497 6503 if (!PostMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID)) 6498 6504 WinSendMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID); 6499 6505 } 6500 6506 DosSleep(1); … … 6510 6516 // Try to restore saved shutdown state 6511 6517 char *pszDefaultStateName = xstrdup(GetPString(IDS_SHUTDOWNSTATE), 6512 6518 pszSrcFile, __LINE__); 6513 6519 if (pszDefaultStateName) { 6514 6515 6516 6520 if (!PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszDefaultStateName), MPVOID)) 6521 // 05 Feb 08 SHL fixme to complain? 6522 free(pszDefaultStateName); 6517 6523 } 6518 6524 } … … 6523 6529 if (mp1) 6524 6530 return MRFROMLONG(OpenDirCnr((HWND) 0, 6525 6526 6531 hwndMain, 6532 hwndTree, (BOOL) mp2, (char *)mp1)); 6527 6533 return 0; 6528 6534
Note:
See TracChangeset
for help on using the changeset viewer.