Changeset 1027
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/mainwnd.c
r1025 r1027 55 55 22 Feb 08 JBS Ticket 230: Fix/improve various code related to state or presparam values in the INI file. 56 56 29 Feb 08 GKY Use xfree where appropriate 57 19 Jun 08 JBS Ticket 227: Allow temporary saving/deleting of the shutdown state of directory containers 57 58 58 59 ***********************************************************************/ … … 78 79 #include "errutil.h" // Dos_Error... 79 80 #include "strutil.h" // GetPString 80 #include "notebook.h" 81 #include "notebook.h" // CfgDlgProc CfgMenuInit 81 82 #include "command.h" // LINKCMDS 82 83 #include "fm3dll.h" … … 94 95 95 96 static MRESULT EXPENTRY MainObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1, 96 97 MPARAM mp2) 97 98 { 98 99 switch (msg) { … … 120 121 *dv = 0; 121 122 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwndB, QW_PARENT), 122 123 id + 50), sizeof(dv), dv); 123 124 d = toupper(*dv); 124 125 if (isalpha(d) && d > 'B' && 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 126 !(driveflags[d - 'A'] & (DRIVE_CDROM | DRIVE_INVALID | 127 DRIVE_SLOW)) && 128 (!hwndBubble || 129 WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) && 130 !WinQueryCapture(HWND_DESKTOP)) { 131 132 FSALLOCATE fsa; 133 CHAR s[90], szQty[38]; 134 ULONG ulPctFree; 135 ULONGLONG ullFreeQty; 136 137 if (!DosQueryFSInfo((d - 'A') + 1, 138 FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) { 139 ullFreeQty = (ULONGLONG) fsa.cUnitAvail * 140 (fsa.cSectorUnit * fsa.cbSector); 141 ulPctFree = (fsa.cUnit && fsa.cUnitAvail) ? 142 (fsa.cUnitAvail * 100) / fsa.cUnit : 0; 143 CommaFmtULL(szQty, sizeof(szQty), ullFreeQty, ' '); 144 sprintf(s, "%s (%lu%%) free", szQty, ulPctFree); 145 } 146 if ((!hwndBubble || 147 WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) && 148 !WinQueryCapture(HWND_DESKTOP)) 149 WinSendMsg(hwndB, UM_SETUP6, MPFROMP(s), MPVOID); 149 150 } 150 151 } … … 157 158 158 159 if (DosQuerySysInfo(QSV_BOOT_DRIVE, 159 160 161 160 QSV_BOOT_DRIVE, 161 (PVOID) & bd, (ULONG) sizeof(ULONG))) 162 bd = 3L; 162 163 *s = (CHAR) bd + '@'; 163 164 WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPFROMLONG(1)); 164 165 if (!mp1) { 165 166 166 s[3] = 0; 167 WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPVOID); 167 168 } 168 169 PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMLONG(1), MPFROMLONG(1)); … … 186 187 //xfree((char *)mp1, pszSrcFile, __LINE__); 187 188 if (fAutoTile) 188 189 TileChildren(hwndMain, TRUE); 189 190 break; 190 191 default: … … 225 226 DosError(FERR_DISABLEHARDERR); 226 227 WinRegisterClass(hab2, 227 228 228 (PSZ) WC_OBJECTWINDOW, 229 MainObjectWndProc, 0, sizeof(PVOID)); 229 230 MainObjectHwnd = WinCreateWindow(HWND_OBJECT, 230 231 232 233 234 235 236 237 231 WC_OBJECTWINDOW, 232 (PSZ) NULL, 233 0, 234 0L, 235 0L, 236 0L, 237 0L, 238 0L, HWND_TOP, OBJ_FRAME, NULL, NULL); 238 239 if (!MainObjectHwnd) 239 240 240 Win_Error2(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__, 241 IDS_WINCREATEWINDOW); 241 242 else { 242 243 244 245 243 WinSetWindowPtr(MainObjectHwnd, QWL_USER, args); 244 while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0)) 245 WinDispatchMsg(hab2, &qmsg2); 246 WinDestroyWindow(MainObjectHwnd); 246 247 } 247 248 WinDestroyMsgQueue(hmq2); … … 252 253 253 254 static MRESULT EXPENTRY IdealButtonProc(HWND hwnd, ULONG msg, MPARAM mp1, 254 255 MPARAM mp2) 255 256 { 256 257 switch (msg) { … … 272 273 while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) { 273 274 if (hwndC != exclude) { 274 275 276 275 id = WinQueryWindowUShort(hwndC, QWS_ID); 276 if (id) 277 break; 277 278 } 278 279 } … … 294 295 henum = WinBeginEnumWindows(hwndMain); 295 296 while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) { 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 297 // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu",hwndTree,exclude,hwndC); 298 if (hwndC != exclude && hwndC != hwndTree) { 299 id = WinQueryWindowUShort(hwndC, QWS_ID); 300 if (id) { 301 hwndClient = WinWindowFromID(hwndC, FID_CLIENT); 302 if (hwndClient) { 303 hwndDir = WinWindowFromID(hwndClient, DIR_CNR); 304 if (hwndDir) { 305 if (fLookInDir) { 306 pci = (PCNRITEM) WinSendMsg(hwndDir, 307 CM_QUERYRECORDEMPHASIS, 308 MPFROMLONG(CMA_FIRST), 309 MPFROMSHORT(CRA_CURSORED)); 310 if (pci && (INT) pci != -1) 311 break; 312 } 313 if (WinSendMsg(hwndClient, 314 UM_CONTAINERDIR, MPFROMP(ret), MPVOID)) { 315 MakeValidDir(ret); 316 // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu\r\"%s\"",hwndTree,exclude,hwndC,ret); 317 WinEndEnumWindows(henum); 318 return hwndC; 319 } 320 } 321 } 322 } 323 } 323 324 } 324 325 WinEndEnumWindows(henum); 325 326 if (!pci || (INT) pci == -1) { 326 327 328 329 330 331 332 327 hwndC = hwndTree; 328 pci = (PCNRITEM) WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree, 329 FID_CLIENT), 330 TREE_CNR), 331 CM_QUERYRECORDEMPHASIS, 332 MPFROMLONG(CMA_FIRST), 333 MPFROMSHORT(CRA_CURSORED)); 333 334 } 334 335 if (pci && (INT) pci != -1) { 335 336 336 strcpy(ret, pci->pszFileName); 337 MakeValidDir(ret); 337 338 } 338 339 else 339 340 save_dir2(ret); 340 341 } 341 342 } … … 355 356 hwndDir = WinWindowFromID(hwndC, DIR_CNR); 356 357 if (hwndDir) 357 358 ret++; 358 359 } 359 360 } … … 373 374 hwndC = WinWindowFromID(hwndF, FID_CLIENT); 374 375 if (hwndC) { 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 376 hwndDir = WinWindowFromID(hwndC, DIR_CNR); 377 if (hwndDir) { 378 *retstr = 0; 379 WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(retstr), MPVOID); 380 if (*retstr && !stricmp(retstr, directory)) { 381 if (restore) 382 WinSetWindowPos(hwndF, 383 HWND_TOP, 384 0, 385 0, 386 0, 387 0, 388 SWP_RESTORE | SWP_SHOW | 389 SWP_ACTIVATE | SWP_ZORDER); 390 break; 391 } 392 } 392 393 } 393 394 } … … 456 457 while (tool) { 457 458 if (!(tool->flags & T_INVISIBLE)) { 458 459 460 461 462 463 464 465 466 467 468 459 swp[x].x = butx; 460 if (fTextTools || (tool->flags & T_TEXT)) { 461 butx += 55L; 462 swp[x].cx = 54L; 463 swp[x].cy = 24L; 464 swp[x].y = 3L; 465 } 466 else 467 butx += 33L; 468 if (tool->flags & T_SEPARATOR) 469 butx += 12; 469 470 } 470 471 else 471 472 swp[x].fl = noattrib; 472 473 swp[x].hwnd = WinWindowFromID(hwnd, tool->id); 473 474 x++; … … 478 479 swp[x].x = butx; 479 480 if (!(tool->flags & T_INVISIBLE)) { 480 481 482 483 484 485 486 487 488 489 481 if (fTextTools || (tool->flags & T_TEXT)) { 482 butx += 55L; 483 swp[x].cx = 54L; 484 swp[x].cy = 24L; 485 swp[x].y = 3L; 486 } 487 else 488 butx += 33L; 489 if (tool->flags & T_SEPARATOR) 490 butx += 12; 490 491 } 491 492 else 492 493 swp[x].fl = noattrib; 493 494 swp[x].hwnd = WinWindowFromID(hwnd, tool->id); 494 495 x++; … … 498 499 if (!fTextTools && fToolTitles) { 499 500 for (x = 2L; x < numtools + 2L; x++) { 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 501 if (fTextTools || !fToolTitles) 502 swp[x].fl = noattrib; 503 else { 504 tool = find_tool(WinQueryWindowUShort(swp[x].hwnd, QWS_ID)); 505 if (tool && (tool->flags & T_TEXT)) 506 swp[x].fl = noattrib; 507 else { 508 swp[x].hwndInsertBehind = HWND_TOP; 509 swp[x].y = 1L; 510 swp[x].cy = 10L; 511 } 512 } 513 swp[x].hwnd = WinWindowFromID(hwnd, 514 WinQueryWindowUShort(swp[x].hwnd, 515 QWS_ID) + 25000); 515 516 } 516 517 WinSetMultWindowPos(WinQueryAnchorBlock(hwnd), &swp[2], numtools); … … 522 523 523 524 static MRESULT EXPENTRY DropDownListProc(HWND hwnd, ULONG msg, MPARAM mp1, 524 525 MPARAM mp2) 525 526 { 526 527 PFNWP oldproc = (PFNWP) INSTDATA(hwnd); … … 560 561 id = WinQueryWindowUShort(hwndParent, QWS_ID); 561 562 if (SHORT1FROMMP(mp2)) { 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 563 // If getting focus 1st time - save original accelerator 564 if (haccelSaved == NULLHANDLE) { 565 haccelSaved = WinQueryAccelTable(hab, hwndFrame); 566 if (haccelSaved == NULLHANDLE) 567 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryAccelTable"); 568 // else 569 // DbgMsg(pszSrcFile, __LINE__, "WinQueryAccelTable SAVED %x", haccelSaved); 570 } 571 if (haccelSaved != NULLHANDLE) { 572 switch (id) { 573 case MAIN_DRIVELIST: 574 if (haccelDriveList == NULLHANDLE) { 575 haccelDriveList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_DRIVELIST); 576 if (haccelDriveList == NULLHANDLE) 577 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 578 } 579 if (haccelDriveList != NULLHANDLE) { 580 if (!WinSetAccelTable(hab, haccelDriveList, hwndFrame)) 581 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 582 // else 583 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_DRIVELIST %x %x", hwndFrame, haccelDriveList); 584 } 585 break; 586 case MAIN_SETUPLIST: 587 if (haccelSetupList == NULLHANDLE) { 588 haccelSetupList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_SETUPLIST); 589 if (haccelSetupList == NULLHANDLE) 590 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 591 } 592 if (haccelSetupList != NULLHANDLE) { 593 if (!WinSetAccelTable(hab, haccelSetupList, hwndFrame)) 594 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 595 // else 596 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_SETUPLIST %x %x", hwndFrame, haccelSetupList); 597 } 598 break; 599 case MAIN_CMDLIST: 600 if (haccelCmdList == NULLHANDLE) { 601 haccelCmdList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_CMDLIST); 602 if (haccelCmdList == NULLHANDLE) 603 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 604 } 605 if (haccelCmdList != NULLHANDLE) { 606 if (!WinSetAccelTable(hab, haccelCmdList, hwndFrame)) 607 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 608 // else 609 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_CMDLIST %x %x", hwndFrame, haccelCmdList); 610 } 611 break; 612 case MAIN_USERLIST: 613 if (haccelUserList == NULLHANDLE) { 614 haccelUserList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_USERLIST); 615 if (haccelUserList == NULLHANDLE) 616 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 617 } 618 if (haccelUserList != NULLHANDLE) { 619 if (!WinSetAccelTable(hab, haccelUserList, hwndFrame)) 620 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 621 // else 622 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_USERLIST %x %x", hwndFrame, haccelUserList); 623 } 624 break; 625 case MAIN_BUTTONLIST: 626 if (haccelButtonList == NULLHANDLE) { 627 haccelButtonList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_BUTTONLIST); 628 if (haccelButtonList == NULLHANDLE) 629 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 630 } 631 if (haccelButtonList != NULLHANDLE) { 632 if (!WinSetAccelTable(hab, haccelButtonList, hwndFrame)) 633 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 634 // else 635 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_BUTTONLIST %x %x", hwndFrame, haccelButtonList); 636 } 637 break; 638 } // switch 639 } 639 640 } 640 641 else { 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 642 // Losing focus 643 switch (id) { 644 case MAIN_DRIVELIST: 645 case MAIN_SETUPLIST: 646 case MAIN_CMDLIST: 647 case MAIN_USERLIST: 648 case MAIN_BUTTONLIST: 649 if (haccelSaved != NULLHANDLE) { 650 if (!WinSetAccelTable(hab, haccelSaved, hwndFrame)) 651 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 652 // else 653 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable SAVED %x %x", hwndFrame, haccelSaved); 654 } 655 break; 656 } // switch 656 657 } 657 658 } … … 663 664 664 665 if (hwndMenu) 665 666 WinDestroyWindow(hwndMenu); 666 667 hwndMenu = (HWND) 0; 667 668 id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID); 668 669 switch (id) { 669 670 case MAIN_CMDLIST: 670 671 672 673 674 675 671 WinPostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 672 QW_PARENT), 673 QW_PARENT), 674 FID_CLIENT), 675 WM_COMMAND, MPFROM2SHORT(IDM_EDITCOMMANDS, 0), MPVOID); 676 break; 676 677 case MAIN_USERLIST: 677 678 case MAIN_SETUPLIST: 678 679 680 681 682 683 684 685 679 hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id); 680 if (hwndMenu) 681 PopupMenu(hwnd, 682 WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 683 QW_PARENT), 684 QW_PARENT), 685 FID_CLIENT), hwndMenu); 686 break; 686 687 default: 687 688 688 ret = FALSE; 689 break; 689 690 } // switch 690 691 return ret; … … 695 696 switch (SHORT1FROMMP(mp1)) { 696 697 case CBID_EDIT: 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 698 id = WinQueryWindowUShort(hwnd, QWS_ID); 699 switch (SHORT2FROMMP(mp1)) { 700 case EN_SETFOCUS: 701 switch (id) { 702 case MAIN_CMDLIST: 703 WinSetWindowText(hwndStatus2, GetPString(IDS_CMDLISTHELP)); 704 break; 705 case MAIN_SETUPLIST: 706 WinSetWindowText(hwndStatus2, GetPString(IDS_SETUPLISTHELP)); 707 break; 708 case MAIN_USERLIST: 709 WinSetWindowText(hwndStatus2, GetPString(IDS_USERLISTHELP)); 710 break; 711 case MAIN_DRIVELIST: 712 WinSetWindowText(hwndStatus2, GetPString(IDS_DRIVELISTHELP)); 713 break; 714 case MAIN_BUTTONLIST: 715 WinSetWindowText(hwndStatus2, GetPString(IDS_BUTTONLISTHELP)); 716 break; 717 default: 718 break; 719 } 720 break; 721 722 default: 723 break; 724 } 724 725 } 725 726 break; … … 734 735 // 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); 735 736 if (id == CBID_EDIT && 736 737 737 WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID) == 738 MAIN_USERLIST) { 738 739 739 740 CHAR path[CCHMAXPATH]; … … 744 745 // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Dragging: %s",path); 745 746 if (*path && !IsRoot(path)) 746 747 DragOne(hwnd, (HWND) 0, path, FALSE); 747 748 return 0; 748 749 } … … 753 754 if (id == MAIN_USERLIST) { 754 755 if (!emphasized) { 755 756 756 emphasized = TRUE; 757 DrawTargetEmphasis(hwnd, emphasized); 757 758 } 758 759 if (AcceptOneDrop(hwnd, mp1, mp2)) 759 760 return MRFROM2SHORT(DOR_DROP, DO_MOVE); 760 761 return MRFROM2SHORT(DOR_NEVERDROP, 0); 761 762 } … … 766 767 if (id == MAIN_USERLIST) { 767 768 if (emphasized) { 768 769 769 emphasized = FALSE; 770 DrawTargetEmphasis(hwnd, emphasized); 770 771 } 771 772 } … … 787 788 788 789 if (emphasized) { 789 790 790 emphasized = FALSE; 791 DrawTargetEmphasis(hwnd, emphasized); 791 792 } 792 793 if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) { 793 794 795 796 797 798 799 800 794 MakeValidDir(szFrom); 795 WinSetWindowText(hwnd, szFrom); 796 PostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 797 QW_PARENT), 798 QW_PARENT), 799 FID_CLIENT), 800 UM_COMMAND, MPFROM2SHORT(IDM_ADDTOUSERLIST, 0), MPVOID); 801 return 0; 801 802 } 802 803 } … … 819 820 (other && fOtherHelp) || (!other && !drive && fToolbarHelp))) { 820 821 if ((!hwndBubble || 821 822 822 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) && 823 !WinQueryCapture(HWND_DESKTOP)) 823 824 MakeBubble(hwnd, above, help); 824 825 } … … 841 842 /* don't bring up help if window isn't active */ 842 843 if (!WinIsChild(hwnd, hwndActive)) 843 844 return; 844 845 } 845 846 hwndActive = WinQueryFocus(HWND_DESKTOP); … … 847 848 /* don't bring up help if a menu is active */ 848 849 if (!strcmp(ucClassname, "#4")) 849 850 return; 850 851 } 851 852 } 852 853 853 854 hwndBubble = WinCreateWindow(HWND_DESKTOP, 854 855 856 857 858 859 860 861 862 855 WC_BUBBLE, 856 help, 857 WS_CLIPSIBLINGS | SS_TEXT | 858 DT_CENTER | DT_VCENTER, 859 0, 860 0, 861 0, 862 0, 863 HWND_DESKTOP, HWND_TOP, MAIN_HELP, NULL, NULL); 863 864 if (!hwndBubble) 864 865 Win_Error2(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, 865 866 IDS_WINCREATEWINDOW); 866 867 else { 867 868 HPS hps; … … 883 884 pp = strchr(p, '\r'); 884 885 if (pp) { 885 886 887 886 wp = pp; 887 *pp = 0; 888 pp++; 888 889 } 889 890 GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl); 890 891 tptl.x = max(aptl[TXTBOX_TOPRIGHT].x, tptl.x); 891 892 if (tptl.y) 892 893 tptl.y += extra; 893 894 else 894 895 extra = aptl[TXTBOX_TOPLEFT].y / 4; 895 896 tptl.y += aptl[TXTBOX_TOPLEFT].y; 896 897 if (wp) 897 898 *wp = '\r'; 898 899 p = pp; 899 900 } … … 905 906 sy = ptl.y + swp.cy + 4; 906 907 if (sy + tptl.y + 12 > lyScreen) { 907 908 908 above = FALSE; 909 sy = ptl.y - (tptl.y + 14); 909 910 } 910 911 } … … 922 923 sy = ptl.y + swp.cy + 4; 923 924 if (sy + tptl.y + 12 > lyScreen) 924 925 sy = 0; 925 926 } 926 927 WinSetWindowPos(hwndBubble, HWND_TOP, sx, sy, 927 928 929 930 928 tptl.x + 14, 929 tptl.y + 12, 930 SWP_DEACTIVATE | SWP_SHOW | SWP_ZORDER | 931 SWP_MOVE | SWP_SIZE); 931 932 } 932 933 } … … 954 955 WinQueryPointerPos(HWND_DESKTOP, &ptl); 955 956 if (WinWindowFromPoint(HWND_DESKTOP, &ptl, TRUE) != 956 957 957 WinQueryWindowULong(hwnd, QWL_USER) || !WinIsWindowVisible(hwnd)) 958 WinDestroyWindow(hwnd); 958 959 } 959 960 return 0; … … 969 970 hps = WinBeginPaint(hwnd, (HPS) 0, NULL); 970 971 if (hps) { 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 972 WinQueryWindowPos(hwnd, &swp); 973 GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, 0); 974 GpiSetColor(hps, ((255 << 16) | (255 << 8) | 198)); 975 GpiSetBackMix(hps, BM_LEAVEALONE); 976 GpiSetMix(hps, FM_OVERPAINT); 977 ptl.x = ptl.y = 0; 978 GpiMove(hps, &ptl); 979 ptl.x = swp.cx - 1; 980 ptl.y = swp.cy - 1; 981 GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0); 982 tlen = WinQueryWindowTextLength(hwnd); 983 if (tlen) { 984 s = xmalloc(tlen + 2, pszSrcFile, __LINE__); 985 if (s) { 986 WinQueryWindowText(hwnd, tlen + 1, s); 987 if (*s) { 988 p = s; 989 y = swp.cy - 3; 990 extra = WinQueryWindowULong(hwnd, QWL_USER + 4); 991 GpiSetColor(hps, 0); 992 GpiSetMix(hps, FM_OVERPAINT); 993 while (p && *p) { 994 wp = NULL; 995 pp = strchr(p, '\r'); 996 if (pp) { 997 wp = pp; 998 *pp = 0; 999 pp++; 1000 } 1001 GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl); 1002 ptl.x = 7; 1003 y -= aptl[TXTBOX_TOPLEFT].y; 1004 if (p != s) 1005 y -= extra; 1006 ptl.y = y; 1007 GpiCharStringAt(hps, &ptl, strlen(p), p); 1008 if (wp) 1009 *wp = '\r'; 1010 p = pp; 1011 } 1012 } 1013 xfree(s, pszSrcFile, __LINE__); 1014 } 1015 } 1016 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)) && swp.cx > 6 && swp.cy > 6) { 1017 GpiSetColor(hps, CLR_WHITE); 1018 ptl.x = 1; 1019 ptl.y = 1; 1020 GpiMove(hps, &ptl); 1021 ptl.y = swp.cy - 2; 1022 GpiLine(hps, &ptl); 1023 ptl.x = swp.cx - 2; 1024 GpiLine(hps, &ptl); 1025 ptl.x = 2; 1026 ptl.y = 2; 1027 GpiMove(hps, &ptl); 1028 ptl.y = swp.cy - 3; 1029 GpiLine(hps, &ptl); 1030 ptl.x = swp.cx - 3; 1031 GpiLine(hps, &ptl); 1032 GpiSetColor(hps, CLR_BROWN); 1033 ptl.x = 1; 1034 ptl.y = 1; 1035 GpiMove(hps, &ptl); 1036 ptl.x = swp.cx - 2; 1037 GpiLine(hps, &ptl); 1038 ptl.y = swp.cy - 2; 1039 GpiLine(hps, &ptl); 1040 ptl.x = 2; 1041 ptl.y = 2; 1042 GpiMove(hps, &ptl); 1043 ptl.x = swp.cx - 3; 1044 GpiLine(hps, &ptl); 1045 ptl.y = swp.cy - 3; 1046 GpiLine(hps, &ptl); 1047 } 1048 WinEndPaint(hps); 1048 1049 } 1049 1050 } … … 1072 1073 switch (WinQueryWindowUShort(hwnd, QWS_ID)) { 1073 1074 case MAIN_LED: 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1075 hps = WinGetPS(hwnd); 1076 hbmold = (HBITMAP) WinSendMsg(hwnd, SM_QUERYHANDLE, MPVOID, MPVOID); 1077 if (!fBlueLED) { 1078 hbmLEDon = GpiLoadBitmap(hps, 0, LEDON_BMP, 12, 12); 1079 hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF_BMP, 12, 12); 1080 } 1081 else { 1082 hbmLEDon = GpiLoadBitmap(hps, 0, LEDON2_BMP, 12, 12); 1083 hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF2_BMP, 12, 12); 1084 } 1085 if (hbmLEDoff && hbmLEDon) 1086 WinSendMsg(hwnd, SM_SETHANDLE, MPFROMLONG(hbmLEDoff), MPVOID); 1087 else { 1088 if (hbmLEDoff) 1089 GpiDeleteBitmap(hbmLEDoff); 1090 if (hbmLEDon) 1091 GpiDeleteBitmap(hbmLEDon); 1092 } 1093 if (hbmold && 1094 hbmLEDon && 1095 hbmLEDoff && hbmold != hbmLEDon && hbmold != hbmLEDoff) 1096 GpiDeleteBitmap(hbmold); 1097 if (hps) 1098 WinReleasePS(hps); 1099 break; 1099 1100 default: 1100 1101 1102 1103 1101 SetPresParams(hwnd, 1102 &RGBGREY, 1103 &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT)); 1104 break; 1104 1105 } 1105 1106 return mr; … … 1125 1126 case WM_BUTTON1CLICK: 1126 1127 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 1127 1128 WM_COMMAND, MPFROM2SHORT(IDM_SHOWNOTEWND, 0), MPVOID); 1128 1129 break; 1129 1130 1130 1131 case WM_BUTTON2CLICK: 1131 1132 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 1132 1133 WM_COMMAND, MPFROM2SHORT(IDM_HIDENOTEWND, 0), MPVOID); 1133 1134 break; 1134 1135 … … 1136 1137 case WM_BUTTON3CLICK: 1137 1138 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 1138 1139 WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID); 1139 1140 break; 1140 1141 } … … 1159 1160 if (fToolbarHelp) { 1160 1161 if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1162 && !WinQueryCapture(HWND_DESKTOP)) { 1163 id = WinQueryWindowUShort(hwnd, QWS_ID); 1164 tool = find_tool(id); 1165 if (tool && tool->help && *tool->help) { 1166 1167 char s[128]; 1168 1169 strcpy(s, tool->help); 1170 if (tool->flags & T_DROPABLE) 1171 strcat(s, GetPString(IDS_DROPONMETEXT)); 1172 MakeBubble(hwnd, FALSE, s); 1173 } 1173 1174 } 1174 1175 } … … 1179 1180 case IDM_HELP: 1180 1181 if (hwndHelp) 1181 1182 1183 1182 WinSendMsg(hwndHelp, 1183 HM_DISPLAY_HELP, 1184 MPFROM2SHORT(HELP_TOOLBAR, 0), MPFROMSHORT(HM_RESOURCEID)); 1184 1185 break; 1185 1186 … … 1187 1188 case IDM_HIDETOOL: /* hide tool */ 1188 1189 if (SHORT1FROMMP(mp1) == IDM_HIDETOOL) 1189 1190 id = WinQueryWindowUShort(hwnd, QWS_ID); 1190 1191 else 1191 1192 1193 1192 id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, 1193 PickToolProc, FM3ModHandle, 1194 PICKBTN_FRAME, GetPString(IDS_HIDETEXT)); 1194 1195 if (id) { 1195 1196 1197 1198 1199 1196 tool = find_tool(id); 1197 if (tool) { 1198 tool->flags |= T_INVISIBLE; 1199 fToolsChanged = TRUE; 1200 } 1200 1201 } 1201 1202 break; … … 1204 1205 tool = toolhead; 1205 1206 while (tool) { 1206 1207 1208 1207 tool->flags &= (~T_INVISIBLE); 1208 tool = tool->next; 1209 fToolsChanged = TRUE; 1209 1210 } 1210 1211 break; … … 1213 1214 case IDM_DELETETOOL: /* delete button */ 1214 1215 if (SHORT1FROMMP(mp1) == IDM_DELETETOOL) 1215 1216 id = WinQueryWindowUShort(hwnd, QWS_ID); 1216 1217 else 1217 1218 1219 1218 id = 1219 (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle, 1220 PICKBTN_FRAME, GetPString(IDS_DELETETEXT)); 1220 1221 if (id) 1221 1222 1222 PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_SETUP, 1223 MPFROM2SHORT(id, 0), MPVOID); 1223 1224 return 0; 1224 1225 … … 1226 1227 case IDM_EDITTOOL: /* edit button */ 1227 1228 if (SHORT1FROMMP(mp1) == IDM_EDITTOOL) 1228 1229 id = WinQueryWindowUShort(hwnd, QWS_ID); 1229 1230 else 1230 1231 1232 1231 id = 1232 (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle, 1233 PICKBTN_FRAME, GetPString(IDS_EDITTEXT)); 1233 1234 if (id) { 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1235 tool = find_tool(id); 1236 if (tool) { 1237 if (WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle, 1238 ADDBTN_FRAME, (PVOID) tool)) 1239 WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 1240 QW_PARENT), 1241 QW_PARENT), FID_CLIENT), 1242 WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0), 1243 MPFROM2SHORT(id, 0)); 1244 } 1244 1245 } 1245 1246 break; … … 1247 1248 case IDM_ADDTOOL: /* add tool */ 1248 1249 id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle, 1249 1250 ADDBTN_FRAME, MPVOID); 1250 1251 if (id && id != (USHORT) - 1) 1251 1252 1253 1254 1255 1252 WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 1253 QW_PARENT), 1254 QW_PARENT), FID_CLIENT), 1255 WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0), 1256 MPFROM2SHORT(id, 0)); 1256 1257 break; 1257 1258 1258 1259 case IDM_REORDERTOOLS: /* reorder tools */ 1259 1260 WinDlgBox(HWND_DESKTOP, 1260 1261 hwnd, ReOrderToolsProc, FM3ModHandle, RE_FRAME, MPVOID); 1261 1262 break; 1262 1263 … … 1264 1265 case IDM_LOADTOOLS: 1265 1266 if (WinDlgBox(HWND_DESKTOP, 1266 1267 1268 1269 1270 1271 1272 1267 hwnd, 1268 ToolIODlgProc, 1269 FM3ModHandle, 1270 SVBTN_FRAME, 1271 (PVOID) (SHORT1FROMMP(mp1) == IDM_SAVETOOLS) ? 1272 "TRUE" : NULL)) 1273 BuildTools(hwndToolback, TRUE); 1273 1274 break; 1274 1275 } … … 1302 1303 tool = find_tool(id); 1303 1304 if (!tool) { 1304 1305 1305 DrgFreeDraginfo(pDInfo); 1306 return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */ 1306 1307 } 1307 1308 if (!(tool->flags & T_DROPABLE)) { 1308 1309 1309 DrgFreeDraginfo(pDInfo); 1310 return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */ 1310 1311 } 1311 1312 { 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1313 PDRAGITEM pDItem; /* Pointer to DRAGITEM */ 1314 1315 pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */ 1316 0); /* Index to DRAGITEM */ 1317 if (DrgVerifyRMF(pDItem, /* Check valid rendering */ 1318 DRM_OS2FILE, /* mechanisms and data */ 1319 NULL)) { /* formats */ 1320 if (!(tool->flags & T_EMPHASIZED)) { 1321 tool->flags |= T_EMPHASIZED; 1322 DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0)); 1323 DrgFreeDraginfo(pDInfo); 1324 } 1325 return (MRFROM2SHORT(DOR_DROP, /* Return okay to drop */ 1326 DO_MOVE)); /* Move operation valid */ 1327 } 1328 DrgFreeDraginfo(pDInfo); 1328 1329 } 1329 1330 } … … 1342 1343 if (tool && (tool->flags & T_DROPABLE)) { 1343 1344 if (tool->flags & T_EMPHASIZED) { 1344 1345 1345 tool->flags &= (~T_EMPHASIZED); 1346 DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0)); 1346 1347 } 1347 1348 } … … 1356 1357 1357 1358 if (tool->flags & T_EMPHASIZED) { 1358 1359 1359 DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0)); 1360 tool->flags &= (~T_EMPHASIZED); 1360 1361 } 1361 1362 memset(&cdi, 0, sizeof(cdi)); … … 1364 1365 CheckPmDrgLimit(cdi.pDragInfo); 1365 1366 if (li) { 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1367 li->type = id; 1368 if (!li->list || !li->list[0]) 1369 FreeListInfo(li); 1370 else { 1371 HWND hwndActive; 1372 1373 hwndActive = TopWindow(hwndMain, (HWND) 0); 1374 if (hwndActive) { 1375 if (!WinSendMsg(hwndActive, UM_COMMAND, MPFROMP(li), MPVOID)) 1376 FreeListInfo(li); 1377 } 1378 else 1379 FreeListInfo(li); 1380 } 1380 1381 } 1381 1382 } … … 1414 1415 if (!fTextTools) { 1415 1416 if (!(tool->flags & T_MYICON)) { 1416 1417 1418 1419 1420 1421 1422 1423 1424 1417 hwndTool = WinCreateWindow(hwndT, 1418 WC_TOOLBUTTONS, 1419 s, 1420 BS_NOPOINTERFOCUS | 1421 BS_BITMAP | BS_PUSHBUTTON, 1422 ctrlxpos, 1423 14, 1424 32, 1425 32, hwndT, HWND_TOP, tool->id, NULL, NULL); 1425 1426 } 1426 1427 if (!hwndTool) { 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1428 HBITMAP hbm = LoadBitmapFromFileNum(tool->id); 1429 1430 if (hbm) { 1431 BTNCDATA btc; 1432 1433 memset(&btc, 0, sizeof(btc)); 1434 btc.cb = sizeof(btc); 1435 btc.hImage = hbm; 1436 hwndTool = WinCreateWindow(hwndT, 1437 WC_TOOLBUTTONS, 1438 NullStr, 1439 BS_NOPOINTERFOCUS | 1440 BS_BITMAP | BS_PUSHBUTTON, 1441 ctrlxpos, 1442 14, 1443 32, 1444 32, 1445 hwndT, HWND_TOP, tool->id, &btc, NULL); 1446 if (!hwndTool) 1447 GpiDeleteBitmap(hbm); 1448 } 1448 1449 } 1449 1450 if (hwndTool) 1450 1451 tool->flags &= (~T_TEXT); 1451 1452 } 1452 1453 if (!hwndTool) { 1453 1454 hwndTool = WinCreateWindow(hwndT, 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1455 WC_TOOLBUTTONS, 1456 (!tool->text && tool->id >= IDM_COMMANDSTART 1457 && tool->id < 1458 IDM_QUICKTOOLSTART) ? command_title(tool-> 1459 id - 1460 IDM_COMMANDSTART) 1461 : tool->text, 1462 BS_NOPOINTERFOCUS | BS_PUSHBUTTON, ctrlxpos, 1463 2, 54, 24, hwndT, HWND_TOP, tool->id, NULL, 1464 NULL); 1464 1465 if (!hwndTool) 1465 1466 1466 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 1467 IDS_WINCREATEWINDOW); 1467 1468 tool->flags |= T_TEXT; 1468 1469 } 1469 1470 if (fToolTitles && !fTextTools) { 1470 1471 hwndTool = WinCreateWindow(hwndT, 1471 1472 1473 1474 1475 1476 1477 1478 1479 1472 WC_STATIC, 1473 tool->text, 1474 SS_TEXT | DT_LEFT | DT_VCENTER, 1475 ctrlxpos, 1476 1, 1477 32, 1478 10, 1479 hwndT, 1480 HWND_TOP, tool->id + 25000, NULL, NULL); 1480 1481 if (!hwndTool) 1481 1482 1482 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 1483 IDS_WINCREATEWINDOW); 1483 1484 else { 1484 1485 1486 1485 SetPresParams(hwndTool, 1486 &RGBGREY, 1487 &RGBBLACK, &RGBGREY, GetPString(IDS_2SYSTEMVIOTEXT)); 1487 1488 } 1488 1489 } 1489 1490 ctrlxpos += ((tool->flags & T_TEXT) ? 55L : 33L); 1490 1491 SetPresParams(WinWindowFromID(hwndT, tool->id), 1491 1492 NULL, NULL, NULL, GetPString(IDS_8HELVTEXT)); 1492 1493 tool = tool->next; 1493 1494 } // while tool 1494 1495 1495 1496 hwndTool = WinCreateWindow(hwndT, 1496 1497 1498 1499 1500 1501 1502 1503 1497 WC_BUTTON, 1498 "#6010", 1499 BS_NOPOINTERFOCUS | 1500 BS_BITMAP | BS_PUSHBUTTON, 1501 1, 1502 19, 1503 14, 1504 13, hwndT, HWND_TOP, IDM_TOOLLEFT, NULL, NULL); 1504 1505 if (!hwndTool) 1505 1506 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 1506 1507 IDS_WINCREATEWINDOW); 1507 1508 hwndTool = 1508 1509 WinCreateWindow(hwndT, WC_BUTTON, "#6011", 1509 1510 1510 BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON, 1, 4, 14, 1511 13, hwndT, HWND_TOP, IDM_TOOLRIGHT, NULL, NULL); 1511 1512 if (!hwndTool) 1512 1513 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 1513 1514 IDS_WINCREATEWINDOW); 1514 1515 if (resize) 1515 1516 ResizeTools(hwndT); … … 1517 1518 1518 1519 static MRESULT EXPENTRY CommandLineProc(HWND hwnd, ULONG msg, MPARAM mp1, 1519 1520 MPARAM mp2) 1520 1521 { 1521 1522 PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER); … … 1534 1535 1535 1536 if (WinQueryWindowUShort((HWND) mp1, QWS_ID) == COMMAND_BUTTON) 1536 1537 break; 1537 1538 if (!WinQueryWindowProcess((HWND) mp1, &pid, &tid) || pid == mypid) 1538 1539 WinDestroyWindow(hwnd); 1539 1540 } 1540 1541 break; … … 1548 1549 lbup = TRUE; 1549 1550 if (WinDlgBox(HWND_DESKTOP, 1550 1551 1552 1553 1554 1551 hwnd, 1552 CmdLine2DlgProc, 1553 FM3ModHandle, EXEC2_FRAME, MPFROMP(pszCmdLine))) { 1554 lstrip(pszCmdLine); 1555 WinSetWindowText(hwnd, pszCmdLine); 1555 1556 } 1556 1557 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID); … … 1573 1574 case COMMAND_BUTTON: 1574 1575 if (!lbup) 1575 1576 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 1576 1577 break; 1577 1578 } … … 1592 1593 bstrip(cl + len); 1593 1594 if (strlen(cl) > len) { 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1595 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), 1596 UM_SETUP, MPFROMP(cl + len), MPVOID); 1597 WinQueryWindowText(hwndStatus, CCHMAXPATH, directory); 1598 bstrip(directory); 1599 if (*directory && (IsRoot(directory) || !IsFile(directory))) { 1600 if (!FM2Command(directory, cl + len)) { 1601 hwndCnr = TopWindow(hwndMain, (HWND) 0); 1602 if (hwndCnr) { 1603 hwndCnr = WinWindowFromID(hwndCnr, FID_CLIENT); 1604 if (hwndCnr) { 1605 hwndCnr = WinWindowFromID(hwndCnr, DIR_CNR); 1606 if (hwndCnr) 1607 list = BuildList(hwndCnr); 1608 } 1609 } 1610 WinSetActiveWindow(HWND_DESKTOP, hwndCnr); 1611 if (add_cmdline(cl + len, FALSE) && fSaveMiniCmds) 1612 save_cmdlines(FALSE); 1613 ExecOnList(hwndCnr, 1614 cl, 1615 WINDOWED | ((fKeepCmdLine) ? 1616 SEPARATEKEEP : SEPARATE), 1617 directory, list, NULL, pszSrcFile, __LINE__); 1618 xfree(list, pszSrcFile, __LINE__); 1619 WinDestroyWindow(hwnd); 1620 break; 1621 } 1622 } 1622 1623 } 1623 1624 WinSendMsg(hwnd, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID); … … 1628 1629 if (!lbup && !(SHORT1FROMMP(mp1) & KC_KEYUP)) { 1629 1630 if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) { 1630 1631 1632 1633 1634 1635 1631 if ((SHORT1FROMMP(mp2) & 255) == '\r') 1632 PostMsg(hwnd, UM_OPENWINDOWFORME, MPVOID, MPVOID); 1633 else if ((SHORT1FROMMP(mp2) & 0xff) == 0x1b) 1634 WinDestroyWindow(hwnd); 1635 else if (SHORT2FROMMP(mp2) == VK_UP || SHORT2FROMMP(mp2) == VK_DOWN) 1636 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 1636 1637 } 1637 1638 } 1638 1639 else if ((SHORT1FROMMP(mp1) & KC_VIRTUALKEY) && 1639 1640 1641 1640 ((SHORT2FROMMP(mp2) == VK_UP || 1641 SHORT2FROMMP(mp2) == VK_DOWN) || 1642 (SHORT1FROMMP(mp2) == '\x1b') || (SHORT1FROMMP(mp2) == '\r'))) 1642 1643 return 0; 1643 1644 break; … … 1665 1666 rgb.bRed = (BYTE)128; 1666 1667 SetPresParams(hwnd, 1667 1668 &RGBGREY, &rgb, &RGBGREY, GetPString(IDS_8HELVTEXT)); 1668 1669 SetTargetDir(hwnd, TRUE); 1669 1670 } … … 1695 1696 case WM_CONTROLPOINTER: 1696 1697 if (!fNoFinger && 1697 1698 1698 (SHORT1FROMMP(mp1) >= IDM_DRIVEA && 1699 SHORT1FROMMP(mp1) < IDM_DRIVEA + 26)) 1699 1700 return MRFROMLONG(hptrFinger); 1700 1701 break; … … 1706 1707 *dv = 0; 1707 1708 WinQueryWindowText(WinWindowFromID(hwnd, SHORT1FROMMP(mp1) + 50), 1708 1709 2, dv); 1709 1710 if (isalpha(*dv)) { 1710 1711 1711 1712 1713 1714 1715 1716 1717 1718 1719 1712 HWND hwndActive; 1713 1714 dv[1] = ':'; 1715 dv[2] = '\\'; 1716 dv[3] = 0; 1717 hwndActive = TopWindow(hwnd, (HWND) 0); 1718 if (hwndActive) 1719 WinSendMsg(WinWindowFromID(hwndActive, FID_CLIENT), 1720 UM_DRIVECMD, MPFROMP(dv), MPVOID); 1720 1721 } 1721 1722 } … … 1745 1746 case WM_MOUSEMOVE: 1746 1747 if (fDrivebarHelp && 1747 1748 1749 1748 (!hwndBubble || 1749 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) && 1750 !WinQueryCapture(HWND_DESKTOP)) { 1750 1751 id = WinQueryWindowUShort(hwnd, QWS_ID); 1751 1752 if (helpid != id) { 1752 1753 1753 helpid = id; 1754 PostMsg(MainObjectHwnd, UM_SETUP6, MPFROMLONG((ULONG) hwnd), MPVOID); 1754 1755 } 1755 1756 else 1756 1757 helpid = 0; 1757 1758 } 1758 1759 break; … … 1761 1762 if (helpid == WinQueryWindowUShort(hwnd, QWS_ID)) { 1762 1763 if ((char *)mp1 && 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1764 (!hwndBubble || 1765 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) && 1766 !WinQueryCapture(HWND_DESKTOP)) { 1767 1768 RECTL rcl; 1769 POINTL ptl; 1770 1771 WinQueryPointerPos(HWND_DESKTOP, &ptl); 1772 WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1); 1773 WinQueryWindowRect(hwnd, &rcl); 1774 if (WinPtInRect(WinQueryAnchorBlock(hwnd), &rcl, &ptl)) 1775 BubbleHelp(hwnd, FALSE, TRUE, FALSE, (char *)mp1); 1775 1776 } 1776 1777 } … … 1791 1792 *szDrv = 0; 1792 1793 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1793 1794 id + 50), sizeof(szDrv), szDrv); 1794 1795 if (isalpha(*szDrv)) { 1795 1796 hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, MAIN_DRIVES); 1796 1797 if (hwndMenu) { 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1798 BOOL rdy; 1799 CHAR chDrv = *szDrv; 1800 UINT iDrv; 1801 1802 strcpy(szDrv + 2, "\\"); 1803 MakeValidDir(szDrv); 1804 // Disable menus if MakeValidDir changes drive letter fixme this section doesn't do anything see treecnt.c 1805 rdy = toupper(*szDrv) == toupper(chDrv); 1806 iDrv = toupper(*szDrv) - 'A'; 1807 if (!rdy || ~driveflags[iDrv] & DRIVE_REMOTE) 1808 WinEnableMenuItem(hwndMenu, IDM_DETACH, FALSE); 1809 1810 if (!rdy || driveflags[iDrv] & DRIVE_NOTWRITEABLE) { 1811 WinEnableMenuItem(hwndMenu, IDM_MKDIR, FALSE); 1812 WinEnableMenuItem(hwndMenu, IDM_FORMAT, FALSE); 1813 WinEnableMenuItem(hwndMenu, IDM_OPTIMIZE, FALSE); 1814 WinEnableMenuItem(hwndMenu, IDM_UNDELETE, FALSE); 1815 } 1816 if (!rdy || ~driveflags[iDrv] & DRIVE_REMOVABLE) { 1817 WinEnableMenuItem(hwndMenu, IDM_EJECT, FALSE); 1818 WinEnableMenuItem(hwndMenu, IDM_LOCK, FALSE); 1819 WinEnableMenuItem(hwndMenu, IDM_UNLOCK, FALSE); 1820 } 1821 if (!rdy) { 1822 WinEnableMenuItem(hwndMenu, IDM_INFO, FALSE); 1823 WinEnableMenuItem(hwndMenu, IDM_ARCHIVE, FALSE); 1824 WinEnableMenuItem(hwndMenu, IDM_SIZES, FALSE); 1825 WinEnableMenuItem(hwndMenu, IDM_SHOWALLFILES, FALSE); 1826 WinEnableMenuItem(hwndMenu, IDM_CHKDSK, FALSE); 1827 } 1828 /* fixme to be gone? 1829 if (!rdy || ~driveflags[iDrv] & DRIVE_CDROM) { 1830 WinEnableMenuItem(hwndMenu, IDM_CLOSETRAY, FALSE); 1831 } 1832 */ 1833 PopupMenu(hwnd, hwnd, hwndMenu); 1833 1834 } 1834 1835 } … … 1845 1846 *szDrv = 0; 1846 1847 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1847 1848 id + 50), sizeof(szDrv), szDrv); 1848 1849 if (isalpha(*szDrv)) { 1849 1850 strcat(szDrv, "\\"); 1850 1851 if (!FindDirCnrByName(szDrv, TRUE)) 1851 1852 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szDrv); 1852 1853 } 1853 1854 break; … … 1861 1862 *szDrv = 0; 1862 1863 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1863 1864 id + 50), sizeof(szDrv), szDrv); 1864 1865 if (isalpha(*szDrv)) { 1865 1866 strcat(szDrv, "\\"); … … 1872 1873 *szDrv = 0; 1873 1874 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1874 1875 id + 50), sizeof(szDrv), szDrv); 1875 1876 if (isalpha(*szDrv) && 1876 1877 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) { 1877 1878 if (!emphasized) { 1878 1879 1879 emphasized = TRUE; 1880 DrawTargetEmphasis(hwnd, emphasized); 1880 1881 } 1881 1882 if (AcceptOneDrop(hwnd, mp1, mp2)) 1882 1883 return MRFROM2SHORT(DOR_DROP, DO_MOVE); 1883 1884 return MRFROM2SHORT(DOR_NEVERDROP, 0); 1884 1885 } … … 1889 1890 *szDrv = 0; 1890 1891 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1891 1892 id + 50), sizeof(szDrv), szDrv); 1892 1893 if (isalpha(*szDrv) && 1893 1894 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) { 1894 1895 if (emphasized) { 1895 1896 1896 emphasized = FALSE; 1897 DrawTargetEmphasis(hwnd, emphasized); 1897 1898 } 1898 1899 } … … 1903 1904 *szDrv = 0; 1904 1905 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1905 1906 id + 50), sizeof(szDrv), szDrv); 1906 1907 if (isalpha(*szDrv) && 1907 1908 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) { 1908 1909 DropHelp(mp1, mp2, hwnd, GetPString(IDS_DRIVEDROPHELP)); 1909 1910 return 0; … … 1915 1916 *szDrv = 0; 1916 1917 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1917 1918 id + 50), sizeof(szDrv), szDrv); 1918 1919 if (isalpha(*szDrv) && 1919 1920 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) { 1920 1921 1921 1922 CNRDRAGINFO cnd; … … 1924 1925 1925 1926 if (emphasized) { 1926 1927 1927 emphasized = FALSE; 1928 DrawTargetEmphasis(hwnd, emphasized); 1928 1929 } 1929 1930 memset(&cnd, 0, sizeof(cnd)); … … 1931 1932 cnd.pRecord = NULL; 1932 1933 li = DoFileDrop(hwnd, 1933 1934 1934 NULL, 1935 TRUE, MPFROM2SHORT(TREE_CNR, CN_DROP), MPFROMP(&cnd)); 1935 1936 CheckPmDrgLimit(cnd.pDragInfo); 1936 1937 if (li) { 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 1938 strcpy(li->targetpath, szDrv); 1939 strcat(li->targetpath, "\\"); 1940 if (li->list && li->list[0] && IsRoot(li->list[0])) 1941 li->type = DO_LINK; 1942 else if (fDragndropDlg && (!*li->arcname || !li->info)) { 1943 1944 CHECKLIST cl; 1945 1946 memset(&cl, 0, sizeof(cl)); 1947 cl.size = sizeof(cl); 1948 cl.flags = li->type; 1949 cl.list = li->list; 1950 cl.cmd = li->type; 1951 cl.prompt = li->targetpath; 1952 li->type = WinDlgBox(HWND_DESKTOP, 1953 hwndMain, 1954 DropListProc, 1955 FM3ModHandle, DND_FRAME, MPFROMP(&cl)); 1956 if (li->type == DID_ERROR) 1957 Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__, 1958 "Drag & Drop Dialog"); 1959 if (!li->type) { 1960 FreeListInfo(li); 1961 return 0; 1962 } 1963 li->list = cl.list; 1964 if (!li->list || !li->list[0]) { 1965 FreeListInfo(li); 1966 return 0; 1967 } 1968 } 1969 else { 1970 if (!WinDlgBox(HWND_DESKTOP, 1971 hwndMain, 1972 WalkDlgProc, 1973 FM3ModHandle, 1974 WALK_FRAME, 1975 MPFROMP(li->targetpath)) || !*li->targetpath) { 1976 FreeListInfo(li); 1977 return 0; 1978 } 1979 } 1980 switch (li->type) { 1981 case DND_LAUNCH: 1982 strcat(li->targetpath, " %a"); 1983 ExecOnList(hwndMain, 1984 li->targetpath, PROMPT | WINDOWED, NULL, li->list, NULL, 1985 pszSrcFile, __LINE__); 1986 FreeList(li->list); 1987 li->list = NULL; 1988 break; 1989 case DO_LINK: 1990 if (fLinkSetsIcon) { 1991 li->type = IDM_SETICON; 1992 action = UM_MASSACTION; 1993 } 1994 else 1995 li->type = IDM_COMPARE; 1996 break; 1997 case DND_EXTRACT: 1998 if (*li->targetpath && !IsFile(li->targetpath)) 1999 li->type = IDM_EXTRACT; 2000 break; 2001 case DND_MOVE: 2002 li->type = IDM_MOVE; 2003 if (*li->targetpath && IsFile(li->targetpath) == 1) { 2004 action = UM_MASSACTION; 2005 li->type = IDM_ARCHIVEM; 2006 } 2007 break; 2008 case DND_WILDMOVE: 2009 li->type = IDM_WILDMOVE; 2010 if (*li->targetpath && IsFile(li->targetpath) == 1) { 2011 action = UM_MASSACTION; 2012 li->type = IDM_ARCHIVEM; 2013 } 2014 break; 2015 case DND_OBJECT: 2016 li->type = IDM_OBJECT; 2017 action = UM_MASSACTION; 2018 break; 2019 case DND_SHADOW: 2020 li->type = IDM_SHADOW; 2021 action = UM_MASSACTION; 2022 break; 2023 case DND_COMPARE: 2024 li->type = IDM_COMPARE; 2025 break; 2026 case DND_SETICON: 2027 action = UM_MASSACTION; 2028 li->type = IDM_SETICON; 2029 break; 2030 case DND_COPY: 2031 li->type = IDM_COPY; 2032 if (*li->targetpath && IsFile(li->targetpath) == 1) { 2033 action = UM_MASSACTION; 2034 li->type = IDM_ARCHIVE; 2035 } 2036 break; 2037 case DND_WILDCOPY: 2038 li->type = IDM_WILDCOPY; 2039 if (*li->targetpath && IsFile(li->targetpath) == 1) { 2040 action = UM_MASSACTION; 2041 li->type = IDM_ARCHIVE; 2042 } 2043 break; 2044 default: 2045 if (*li->arcname && li->info) { 2046 action = UM_MASSACTION; 2047 li->type = (li->type == DO_MOVE) ? IDM_FAKEEXTRACTM : 2048 IDM_FAKEEXTRACT; 2049 } 2050 else if (*li->targetpath && IsFile(li->targetpath) == 1) { 2051 action = UM_MASSACTION; 2052 li->type = (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE; 2053 } 2054 else 2055 li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY; 2056 break; 2057 } 2058 if (!li->list || !li->list[0]) 2059 FreeListInfo(li); 2060 else 2061 WinSendMsg(hwndTree, UM_ACTION, MPFROMP(li), MPFROMLONG(action)); 2061 2062 } 2062 2063 return 0; … … 2092 2093 for (x = 0; x < 26; x++) { 2093 2094 if ((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE)) { 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 2095 if (x > 1) { 2096 if (driveflags[x] & DRIVE_CDROM) 2097 iconid = CDROM_ICON; 2098 else 2099 iconid = (driveflags[x] & DRIVE_REMOVABLE) ? 2100 REMOVABLE_ICON : 2101 (driveflags[x] & DRIVE_VIRTUAL) ? 2102 VIRTUAL_ICON : 2103 (driveflags[x] & DRIVE_REMOTE) ? 2104 REMOTE_ICON : 2105 (driveflags[x] & DRIVE_RAMDISK) ? 2106 RAMDISK_ICON : 2107 (driveflags[x] & DRIVE_ZIPSTREAM) ? 2108 ZIPSTREAM_ICON :DRIVE_ICON; 2109 } 2110 else 2111 iconid = FLOPPY_ICON; 2112 sprintf(s, "#%lu", iconid); 2113 hwndB = WinCreateWindow(hwndT, 2114 WC_DRIVEBUTTONS, 2115 s, 2116 BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON, 2117 0, 2118 0, 2119 28, 2120 18, 2121 hwndT, HWND_TOP, y + IDM_DRIVEA, NULL, NULL); 2122 if (!hwndB) 2123 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 2124 IDS_WINCREATEWINDOW); 2125 else { 2126 WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER); 2127 sprintf(s, "%c:", (CHAR) x + 'A'); 2128 hwndB = WinCreateWindow(hwndT, 2129 WC_STATIC, 2130 s, 2131 SS_TEXT | DT_LEFT | DT_VCENTER, 2132 0, 2133 0, 2134 10, 2135 18, 2136 hwndT, 2137 HWND_TOP, y + IDM_DRIVEATEXT, NULL, NULL); 2138 if (!hwndB) 2139 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 2140 IDS_WINCREATEWINDOW); 2141 else { 2142 SetPresParams(hwndB, 2143 &RGBGREY, 2144 &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT)); 2145 WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER); 2146 } 2147 y++; 2148 } 2148 2149 } 2149 2150 } // for 2150 2151 } // if drivebar 2151 2152 PostMsg(WinQueryWindow(hwndT, QW_PARENT), 2152 2153 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 2153 2154 } 2154 2155 … … 2166 2167 WinQueryWindowRect(hwndT, &rcl); 2167 2168 xwidth = rcl.xRight - ((WinQuerySysValue(HWND_DESKTOP, 2168 2169 SV_CYSIZEBORDER) * 2) + 2); 2169 2170 } 2170 2171 henum = WinBeginEnumWindows(hwndT); … … 2175 2176 ctrlxsize = 28; 2176 2177 WinSetWindowPos(hwndB, 2177 2178 2178 HWND_TOP, 2179 ctrlxpos, ctrlypos, ctrlxsize, 18, SWP_MOVE | SWP_SHOW); 2179 2180 ctrlxpos += (ctrlxsize + 2); 2180 2181 if (ctrlxsize == 10) { 2181 2182 if (ctrlxpos + (42 + ((fShowTarget && DriveLines == 0) ? 2182 2183 2184 2185 2183 256 : 0)) > xwidth) { 2184 ctrlxpos = 2; 2185 ctrlypos += 18; 2186 DriveLines++; 2186 2187 } 2187 2188 } … … 2202 2203 2203 2204 SetPresParams(hwnd, 2204 2205 2205 &RGBGREY, 2206 &RGBBLACK, &RGBGREY, GetPString(IDS_8HELVBOLDTEXT)); 2206 2207 return mr; 2207 2208 } … … 2213 2214 2214 2215 cbRetLen = WinQueryPresParam(hwnd, 2215 2216 2217 2218 2216 (ULONG) mp1, 2217 0, 2218 &AttrFound, 2219 (ULONG) sizeof(AttrValue), &AttrValue, 0); 2219 2220 if (cbRetLen) { 2220 2221 2221 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 2222 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 2222 2223 } 2223 2224 } … … 2236 2237 WinQueryWindowPos(hwndTree, &swp); 2237 2238 if (!(swp.fl & SWP_MAXIMIZE)) 2238 2239 fl |= SWP_RESTORE; 2239 2240 WinSetWindowPos(hwndTree, HWND_TOP, 0, 0, 0, 0, fl); 2240 2241 } … … 2269 2270 2270 2271 if (fOtherHelp) { 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2272 if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) 2273 && !WinQueryCapture(HWND_DESKTOP)) { 2274 switch (id) { 2275 case IDM_ATTRS: 2276 if (WinQueryWindowTextLength(hwnd)) 2277 s = GetPString(IDS_ATTRSBUTTONHELP); 2278 break; 2279 case IDM_INFO: 2280 if (WinQueryWindowTextLength(hwnd)) 2281 s = GetPString(IDS_INFOBUTTONHELP); 2282 break; 2283 case IDM_RENAME: 2284 if (WinQueryWindowTextLength(hwnd)) 2285 s = GetPString(IDS_NAMEBUTTONHELP); 2286 break; 2287 case MAIN_STATUS2: 2288 if (!hwndE) 2289 s = GetPString(IDS_STATUS2HELP); 2290 break; 2291 default: 2292 break; 2293 } 2294 if (s) 2295 MakeBubble(hwnd, FALSE, s); 2296 else if (hwndBubble) 2297 WinDestroyWindow(hwndBubble); 2298 } 2298 2299 } 2299 2300 switch (id) { … … 2302 2303 case IDM_RENAME: 2303 2304 case MAIN_STATUS2: 2304 2305 return CommonTextProc(hwnd, msg, mp1, mp2); 2305 2306 default: 2306 2307 break; 2307 2308 } 2308 2309 } … … 2327 2328 case IDM_RENAME: 2328 2329 case MAIN_STATUS2: 2329 2330 return CommonTextButton(hwnd, msg, mp1, mp2); 2330 2331 default: 2331 2332 2332 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID); 2333 break; 2333 2334 } 2334 2335 } … … 2342 2343 id = WinQueryWindowUShort(hwnd, QWS_ID); 2343 2344 if (id == MAIN_STATUS2 && hwndE) 2344 2345 WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 2345 2346 else 2346 2347 return CommonTextButton(hwnd, msg, mp1, mp2); 2347 2348 } 2348 2349 break; … … 2354 2355 id = WinQueryWindowUShort(hwnd, QWS_ID); 2355 2356 if (id == MAIN_STATUS) { 2356 2357 2358 2359 2360 2361 2357 if (SHORT2FROMMP(mp2) & KC_CTRL) 2358 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2359 FID_CLIENT), 2360 WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID); 2361 else if (hwndTree) 2362 PostMsg(hwndTree, UM_TIMER, MPVOID, MPVOID); 2362 2363 } 2363 2364 } … … 2372 2373 if (id == MAIN_STATUS2 && !hwndE) { 2373 2374 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 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 2375 SWP swp; 2376 CHAR directory[CCHMAXPATH]; 2377 PFNWP oldproce; 2378 2379 *directory = 0; 2380 TopWindowName(hwndMain, (HWND) 0, directory); 2381 WinQueryWindowPos(hwnd, &swp); 2382 hwndB = WinCreateWindow(hwnd, 2383 WC_BUTTON, 2384 "+", 2385 WS_VISIBLE | BS_PUSHBUTTON | 2386 BS_NOPOINTERFOCUS, 2387 swp.cx - swp.cy, 2388 0, 2389 swp.cy, 2390 swp.cy, 2391 hwnd, HWND_TOP, COMMAND_BUTTON, NULL, NULL); 2392 if (!hwndB) 2393 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 2394 hwndE = WinCreateWindow(hwnd, 2395 WC_ENTRYFIELD, 2396 NULL, 2397 WS_VISIBLE | ES_AUTOSCROLL, 2398 0, 2399 0, 2400 swp.cx - swp.cy, 2401 swp.cy, 2402 hwnd, HWND_TOP, COMMAND_LINE, NULL, NULL); 2403 if (!hwndE) 2404 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 2405 if (!hwndE || !hwndB) { 2406 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 2407 return 0; 2408 } 2409 WinSendMsg(hwndE, EM_SETTEXTLIMIT, MPFROM2SHORT(1024, 0), MPVOID); 2410 WinSetWindowText(hwndStatus, directory); 2411 if (*lastcmd) 2412 WinSetWindowText(hwndE, lastcmd); 2413 else 2414 WinSetWindowText(hwndE, GetPString(IDS_HELPCMDTEXT)); 2415 oldproce = WinSubclassWindow(hwndE, (PFNWP) CommandLineProc); 2416 if (oldproce) 2417 WinSetWindowPtr(hwndE, QWL_USER, (PVOID) oldproce); 2418 PostMsg(hwndE, UM_FOCUSME, MPVOID, MPVOID); 2419 PostMsg(hwndE, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID); 2420 return 0; 2420 2421 } 2421 2422 if (msg == UM_CLICKED3 || (SHORT2FROMMP(mp2) & KC_CTRL)) { 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2423 switch (id) { 2424 case IDM_ATTRS: 2425 id = IDM_SORTSIZE; 2426 break; 2427 case IDM_INFO: 2428 id = IDM_SORTLWDATE; 2429 break; 2430 case IDM_RENAME: 2431 id = IDM_SORTFILENAME; 2432 break; 2433 } 2433 2434 } 2434 2435 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 2435 2436 WM_COMMAND, MPFROM2SHORT(id, 0), MPVOID); 2436 2437 } 2437 2438 return 0; … … 2447 2448 case IDM_RENAME: 2448 2449 case MAIN_STATUS2: 2449 2450 2450 PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE); 2451 break; 2451 2452 default: 2452 2453 2453 PaintRecessedWindow(hwnd, (HPS) 0, FALSE, TRUE); 2454 break; 2454 2455 } 2455 2456 if (id == IDM_RENAME) { 2456 2457 2457 2458 2459 2460 2461 2462 2463 2464 2458 HPS hps; 2459 2460 hps = WinBeginPaint(hwnd, (HPS) 0, NULL); 2461 if (hps) { 2462 PaintSTextWindow(hwnd, hps); 2463 WinEndPaint(hps); 2464 } 2465 return 0; 2465 2466 } 2466 2467 } … … 2495 2496 case UM_COMMAND: 2496 2497 return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2497 2498 FID_CLIENT), msg, mp1, mp2); 2498 2499 2499 2500 case WM_PAINT: … … 2508 2509 hps = WinBeginPaint(hwnd, (HPS)0, NULL); 2509 2510 if (hps) { 2510 2511 2512 2513 2514 2515 2511 GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL); 2512 WinQueryPresParam(hwnd, PP_BACKGROUNDCOLOR, 0, NULL, 2513 sizeof(lColor), &lColor, 0); 2514 WinQueryWindowRect(hwnd, &rcl); 2515 WinFillRect(hps, &rcl, lColor); 2516 WinEndPaint(hps); 2516 2517 } 2517 2518 … … 2532 2533 tool = find_tool(id); 2533 2534 if (tool) { 2534 2535 2536 2537 2538 2535 del_tool(tool); 2536 WinShowWindow(WinWindowFromID(hwnd, id), FALSE); 2537 if (fToolTitles) 2538 WinShowWindow(WinWindowFromID(hwnd, id + 25000), FALSE); 2539 ResizeTools(hwnd); 2539 2540 } 2540 2541 } … … 2546 2547 2547 2548 id = (USHORT) WinDlgBox(HWND_DESKTOP, 2548 2549 2550 2549 hwnd, 2550 AddToolProc, 2551 FM3ModHandle, ADDBTN_FRAME, MPVOID); 2551 2552 if (id && id != (USHORT) - 1) 2552 2553 2554 2555 2553 WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2554 FID_CLIENT), 2555 WM_COMMAND, 2556 MPFROM2SHORT(IDM_CREATETOOL, 0), MPFROM2SHORT(id, 0)); 2556 2557 } 2557 2558 break; … … 2559 2560 case WM_CONTEXTMENU: 2560 2561 if (WinDlgBox(HWND_DESKTOP, 2561 2562 hwnd, ToolIODlgProc, FM3ModHandle, SVBTN_FRAME, MPVOID)) 2562 2563 BuildTools(hwnd, TRUE); 2563 2564 return MRFROMSHORT(TRUE); … … 2582 2583 if (pswp) { 2583 2584 if (WinQueryWindowPos(hwndTree, &swp) && 2584 2585 !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE))) { 2585 2586 pswp->x = swp.cx; 2586 2587 pswp->cx -= swp.cx; … … 2589 2590 if (prectl) { 2590 2591 if (WinQueryWindowPos(hwndTree, &swp) && 2591 2592 2592 !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)) && 2593 WinQueryWindowRect(hwndTree, &rectl)) { 2593 2594 prectl->xLeft = rectl.xRight; 2594 2595 prectl->xRight -= rectl.xRight; … … 2642 2643 if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) { 2643 2644 if (swp.x < swpT.cx) { 2644 2645 2646 2647 2648 2649 2645 swp.x = swpT.cx; 2646 if (swp.x + swp.cx > swpC.cx) 2647 swp.cx = swpC.cx - swp.x; 2648 if (swp.cx > 24) 2649 WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 2650 SWP_SIZE | SWP_MOVE | SWP_SHOW); 2650 2651 } 2651 2652 } … … 2667 2668 WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1); 2668 2669 WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0, 2669 2670 SWP_MOVE | SWP_SHOW | SWP_FOCUSDEACTIVATE); 2670 2671 } 2671 2672 } … … 2689 2690 if (hwndNext) { 2690 2691 if (!WinQueryWindowUShort(hwndNext, QWS_ID)) 2691 2692 continue; 2692 2693 if (next) 2693 2694 break; 2694 2695 if (hwndNext == hwndActive) { 2695 2696 2697 2698 2699 2700 2696 if (!previous && hwndPrev) { 2697 hwndNext = hwndPrev; 2698 break; 2699 } 2700 else if (previous) 2701 next = TRUE; 2701 2702 } 2702 2703 hwndPrev = hwndNext; … … 2704 2705 else { 2705 2706 if ((!next && previous) || once) 2706 2707 break; 2707 2708 else if (!previous) { 2708 2709 2709 hwndNext = hwndPrev; 2710 break; 2710 2711 } 2711 2712 else 2712 2713 once = next = TRUE; 2713 2714 } 2714 2715 } … … 2717 2718 if (hwndNext && hwndNext != hwndActive) { 2718 2719 WinSetWindowPos(hwndNext, HWND_TOP, 0, 0, 0, 0, 2719 2720 SWP_ZORDER | SWP_ACTIVATE); 2720 2721 WinSetWindowPos(hwndActive, ((previous) ? HWND_BOTTOM : hwndNext), 0, 0, 2721 2722 0, 0, SWP_ZORDER); 2722 2723 } 2723 2724 } … … 2734 2735 if (hwndChild != hwndTree) { 2735 2736 WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT), 2736 2737 WM_SAVEAPPLICATION, MPVOID, MPVOID); 2737 2738 if (WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT), 2738 2739 2740 2739 WM_CLOSE, MPVOID, MPVOID)) { 2740 ret = TRUE; 2741 break; 2741 2742 } 2742 2743 } … … 2761 2762 hwndTemp = WinWindowFromID(hwndChild, FID_CLIENT); 2762 2763 if (hwndTemp) { 2763 2764 2765 2766 2767 2768 2764 hwndDir = WinWindowFromID(hwndTemp, DIR_CNR); 2765 if (hwndDir) { 2766 WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT), 2767 WM_CLOSE, MPVOID, MPVOID); 2768 ret = TRUE; 2769 } 2769 2770 } 2770 2771 } … … 2814 2815 hwndC = WinWindowFromID(hwndChild, FID_CLIENT); 2815 2816 if (hwndC) { 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2817 hwndDir = WinWindowFromID(hwndC, DIR_CNR); 2818 if (hwndDir) { 2819 WinQueryWindowPos(hwndChild, &swp); 2820 *szDir = 0; 2821 WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(szDir), MPVOID); 2822 if (*szDir) { 2823 // If saving shutdown state skip no prescan drives 2824 if (fIsShutDownState && 2825 driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) { 2826 continue; 2827 } 2828 sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, numsaves); 2829 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, 2830 sizeof(SWP)); 2831 dcd = 2832 WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER); 2833 if (dcd) { 2834 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, numsaves); 2835 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->sortFlags, 2836 sizeof(INT)); 2837 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, numsaves); 2838 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->mask, 2839 sizeof(MASK)); 2840 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, numsaves); 2841 flWindowAttr = dcd->flWindowAttr; 2842 if (!fLeaveTree && (flWindowAttr & CV_TREE)) { 2843 flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT)); 2844 if (dcd->lastattr) { 2845 if (dcd->lastattr & CV_TEXT) 2846 flWindowAttr |= CV_TEXT; 2847 else if (dcd->lastattr & CV_DETAIL) 2848 flWindowAttr |= CV_DETAIL; 2849 else if (dcd->lastattr & CV_ICON) 2850 flWindowAttr |= CV_ICON; 2851 else 2852 flWindowAttr |= CV_NAME; 2853 } 2854 else 2855 flWindowAttr |= CV_NAME; 2856 } 2857 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & flWindowAttr, 2858 sizeof(ULONG)); 2859 sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, numsaves); 2860 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslongname, 2861 sizeof(BOOL)); 2862 sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, numsaves); 2863 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailssubject, 2864 sizeof(BOOL)); 2865 sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, numsaves); 2866 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailssize, 2867 sizeof(BOOL)); 2868 sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, numsaves); 2869 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsea, 2870 sizeof(BOOL)); 2871 sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, numsaves); 2872 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsattr, 2873 sizeof(BOOL)); 2874 sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, numsaves); 2875 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsicon, 2876 sizeof(BOOL)); 2877 sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, numsaves); 2878 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslwdate, 2879 sizeof(BOOL)); 2880 sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, numsaves); 2881 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslwtime, 2882 sizeof(BOOL)); 2883 sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, numsaves); 2884 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsladate, 2885 sizeof(BOOL)); 2886 sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, numsaves); 2887 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslatime, 2888 sizeof(BOOL)); 2889 sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, numsaves); 2890 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailscrdate, 2891 sizeof(BOOL)); 2892 sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, numsaves); 2893 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailscrtime, 2894 sizeof(BOOL)); 2895 sprintf(szKey, "%sDirCnr.%lu", szPrefix, numsaves); 2896 SavePresParams(hwndDir, szKey); 2897 } 2898 sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, numsaves++); 2899 PrfWriteProfileString(fmprof, FM3Str, szKey, szDir); 2900 nSaved++; 2901 } 2902 } 2902 2903 } 2903 2904 } … … 2945 2946 if (hwnd) { 2946 2947 if (WinQueryWindowPos(hwnd, &swp)) { 2947 2948 2949 2950 2951 2952 2953 2954 2948 if (pswp->x > swp.cx) 2949 pswp->x = (swp.cx > 24) ? swp.cx - 24 : swp.cx; 2950 if (pswp->y > swp.cy) 2951 pswp->y = (swp.cy > 24) ? swp.cy - 24 : swp.cy; 2952 if (pswp->x + pswp->cx > swp.cx) 2953 pswp->cx = swp.cx - pswp->x; 2954 if (pswp->y + pswp->cy > swp.cy) 2955 pswp->cy = swp.cy - pswp->y; 2955 2956 } 2956 2957 } … … 2999 3000 sprintf(szKey, "%sMySizeLastTime", szPrefix); 3000 3001 if (!PrfQueryProfileData(fmprof, 3001 3002 3003 3004 3002 FM3Str, 3003 szKey, 3004 (PVOID) & swpO, 3005 &size) || 3005 3006 size != sizeof(SWP) || !swp.cx || !swp.cy) 3006 3007 { … … 3030 3031 swp.fl &= (~SWP_ACTIVATE); 3031 3032 WinSetWindowPos(hwndTree, 3032 3033 3034 3035 3036 3037 3033 HWND_TOP, 3034 swp.x, 3035 swp.y, 3036 swp.cx, 3037 swp.cy, 3038 swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER); 3038 3039 } 3039 3040 else { 3040 3041 WinSetWindowPos(hwndTree, 3041 3042 HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW); 3042 3043 WinSetWindowUShort(hwndTree, QWS_XRESTORE, (USHORT) swp.x); 3043 3044 WinSetWindowUShort(hwndTree, QWS_CXRESTORE, (USHORT) swp.cx); … … 3049 3050 sprintf(szKey, "%sNumDirsLastTime", szPrefix); 3050 3051 if (PrfQueryProfileData(fmprof, 3051 3052 FM3Str, szKey, (PVOID) & numsaves, &size) && numsaves) { 3052 3053 if (fDeleteState) 3053 3054 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); … … 3056 3057 size = sizeof(SWP); 3057 3058 if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &swp, &size)) { 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3059 if (fDeleteState) 3060 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3061 sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, x); 3062 size = sizeof(szDir); 3063 if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) { 3064 // If restoring shutdown state and drive marked no prescan 3065 // bypass window restore 3066 if (fIsShutDownState && 3067 driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) { 3068 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3069 continue; 3070 } 3071 if (fDeleteState) 3072 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3073 localdcd.detailslongname = detailslongname; // Set default 3074 size = sizeof(BOOL); 3075 sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, x); 3076 if (PrfQueryProfileData(fmprof, 3077 FM3Str, 3078 szKey, 3079 (PVOID)&localdcd.detailslongname, 3080 &size) && 3081 size == sizeof(BOOL)) 3082 { 3083 if (fDeleteState) 3084 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3085 } 3086 localdcd.detailssubject = detailssubject; // Set default 3087 size = sizeof(BOOL); 3088 sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, x); 3089 if (PrfQueryProfileData(fmprof, 3090 FM3Str, 3091 szKey, 3092 (PVOID)&localdcd.detailssubject, 3093 &size) && 3094 size == sizeof(BOOL)) 3095 { 3096 if (fDeleteState) 3097 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3098 } 3099 localdcd.detailsea = detailsea; // Set default 3100 size = sizeof(BOOL); 3101 sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, x); 3102 if (PrfQueryProfileData(fmprof, 3103 FM3Str, 3104 szKey, 3105 (PVOID) & localdcd.detailsea, 3106 &size) && 3107 size == sizeof(BOOL)) 3108 { 3109 if (fDeleteState) 3110 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3111 } 3112 localdcd.detailssize = detailssize; // Set default 3113 size = sizeof(BOOL); 3114 sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, x); 3115 if (PrfQueryProfileData(fmprof, 3116 FM3Str, 3117 szKey, 3118 (PVOID) & localdcd.detailssize, 3119 &size) && 3120 size == sizeof(BOOL)) 3121 { 3122 if (fDeleteState) 3123 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3124 } 3125 localdcd.detailsicon = detailsicon; // Set default 3126 size = sizeof(BOOL); 3127 sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, x); 3128 if (PrfQueryProfileData(fmprof, 3129 FM3Str, 3130 szKey, 3131 (PVOID) & localdcd.detailsicon, 3132 &size) && 3133 size == sizeof(BOOL)) 3134 { 3135 if (fDeleteState) 3136 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3137 } 3138 localdcd.detailsattr = detailsattr; // Set default 3139 size = sizeof(BOOL); 3140 sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, x); 3141 if (PrfQueryProfileData(fmprof, 3142 FM3Str, 3143 szKey, 3144 (PVOID)&localdcd.detailsattr, 3145 &size) && 3146 size == sizeof(BOOL)) 3147 { 3148 if (fDeleteState) 3149 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3150 } 3151 localdcd.detailscrdate = detailscrdate; // Set default 3152 size = sizeof(BOOL); 3153 sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, x); 3154 if (PrfQueryProfileData(fmprof, 3155 FM3Str, 3156 szKey, 3157 (PVOID) & localdcd.detailscrdate, 3158 &size) && size == sizeof(BOOL)) 3159 { 3160 if (fDeleteState) 3161 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3162 } 3163 localdcd.detailscrtime = detailscrtime; // Set default 3164 size = sizeof(BOOL); 3165 sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, x); 3166 if (PrfQueryProfileData(fmprof, 3167 FM3Str, 3168 szKey, 3169 (PVOID)&localdcd.detailscrtime, 3170 &size) && 3171 size == sizeof(BOOL)) 3172 { 3173 if (fDeleteState) 3174 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3175 } 3176 localdcd.detailslwdate = detailslwdate; // Set default 3177 size = sizeof(BOOL); 3178 sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, x); 3179 if (PrfQueryProfileData(fmprof, 3180 FM3Str, 3181 szKey, 3182 (PVOID) & localdcd.detailslwdate, 3183 &size) && 3184 size == sizeof(BOOL)) 3185 { 3186 if (fDeleteState) 3187 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3188 } 3189 localdcd.detailslwtime = detailslwtime; // Set default 3190 size = sizeof(BOOL); 3191 sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, x); 3192 if (PrfQueryProfileData(fmprof, 3193 FM3Str, 3194 szKey, 3195 (PVOID) & localdcd.detailslwtime, 3196 &size) && 3197 size == sizeof(BOOL)) 3198 { 3199 if (fDeleteState) 3200 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3201 } 3202 localdcd.detailsladate = detailsladate; // Set default 3203 size = sizeof(BOOL); 3204 sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, x); 3205 if (PrfQueryProfileData(fmprof, 3206 FM3Str, 3207 szKey, 3208 (PVOID) & localdcd.detailsladate, 3209 &size) && 3210 size == sizeof(BOOL)) 3211 { 3212 if (fDeleteState) 3213 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3214 } 3215 localdcd.detailslatime = detailslatime; // Set default 3216 size = sizeof(BOOL); 3217 sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, x); 3218 if (PrfQueryProfileData(fmprof, 3219 FM3Str, 3220 szKey, 3221 (PVOID) & localdcd.detailslatime, 3222 &size) && 3223 size == sizeof(BOOL)) 3224 { 3225 if (fDeleteState) 3226 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3227 } 3228 hwndDir = (HWND) WinSendMsg(hwndClient, 3229 UM_SETDIR, 3230 MPFROMP(szDir), MPFROMLONG(1)); 3231 if (hwndDir) { 3232 hwndC = WinWindowFromID(hwndDir, FID_CLIENT); 3233 if (hwndC) { 3234 HWND hwndCnr = WinWindowFromID(hwndC, DIR_CNR); 3235 if (!hwndPPSave) { 3235 3236 hwndPPSave = WinCreateWindow(hwndCnr, // Create a window (used to save default presparams) 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 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 3237 WC_CONTAINER, 3238 NULL, 3239 CCS_AUTOPOSITION | CCS_MINIICONS | 3240 CCS_MINIRECORDCORE | ulCnrType | 3241 WS_VISIBLE, 3242 0, 3243 0, 3244 0, 3245 0, 3246 hwndCnr, 3247 HWND_TOP, (ULONG) -1, NULL, NULL); 3248 CopyPresParams(hwndPPSave, hwndC); 3249 RestorePresParams(hwndPPSave, "DirCnr"); 3250 } 3251 sprintf(szKey, "%sDirCnr.%lu", szPrefix, x); 3252 RestorePresParams(hwndCnr, szKey); 3253 dcd = WinQueryWindowPtr(hwndCnr, QWL_USER); 3254 if (dcd) { 3255 dcd->detailslongname = localdcd.detailslongname; 3256 dcd->detailssubject = localdcd.detailssubject ; 3257 dcd->detailsattr = localdcd.detailsattr ; 3258 dcd->detailsea = localdcd.detailsea ; 3259 dcd->detailssize = localdcd.detailssize ; 3260 dcd->detailsicon = localdcd.detailsicon ; 3261 dcd->detailscrdate = localdcd.detailscrdate ; 3262 dcd->detailscrtime = localdcd.detailscrtime ; 3263 dcd->detailsladate = localdcd.detailsladate ; 3264 dcd->detailslatime = localdcd.detailslatime ; 3265 dcd->detailslwdate = localdcd.detailslwdate ; 3266 dcd->detailslwtime = localdcd.detailslwtime ; 3267 size = sizeof(INT); 3268 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, x); 3269 if (PrfQueryProfileData(fmprof, 3270 FM3Str, 3271 szKey, 3272 (PVOID) & dcd->sortFlags, 3273 &size) && size == sizeof(INT)) { 3274 if (!dcd->sortFlags) 3275 dcd->sortFlags = SORT_PATHNAME; 3276 } 3277 if (fDeleteState) 3278 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3279 size = sizeof(MASK); 3280 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, x); 3281 if (PrfQueryProfileData(fmprof, 3282 FM3Str, 3283 szKey, 3284 (PVOID) & dcd->mask, &size) && size) { 3285 if (*dcd->mask.szMask) 3286 WinSendMsg(WinWindowFromID(hwndC, DIR_CNR), 3287 UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID); 3288 } 3289 *(dcd->mask.prompt) = 0; 3290 if (fDeleteState) 3291 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3292 size = sizeof(ULONG); 3293 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, x); 3294 if (!noview) { 3295 if (PrfQueryProfileData(fmprof, 3296 FM3Str, 3297 szKey, 3298 (PVOID) & dcd->flWindowAttr, 3299 &size) && size == sizeof(ULONG)) { 3300 3301 CNRINFO cnri; 3302 3303 memset(&cnri, 0, sizeof(CNRINFO)); 3304 cnri.cb = sizeof(CNRINFO); 3305 if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR), 3306 CM_QUERYCNRINFO, 3307 MPFROMP(&cnri), 3308 MPFROMLONG(sizeof(CNRINFO)))) { 3309 cnri.flWindowAttr = dcd->flWindowAttr; 3310 WinSendMsg(WinWindowFromID(hwndC, DIR_CNR), 3311 CM_SETCNRINFO, 3312 MPFROMP(&cnri), 3313 MPFROMLONG(CMA_FLWINDOWATTR)); 3314 } 3315 } 3316 } 3317 if (fDeleteState) 3318 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3319 if (!PostMsg(hwndCnr, UM_SETUP2, NULL, NULL)) 3320 WinSendMsg(hwndCnr, UM_SETUP2, NULL, NULL); 3321 } 3322 } 3323 fRestored = TRUE; 3324 swp.hwnd = hwndDir; 3325 TransformSwp(&swp, xtrans, ytrans); 3326 if (!fAutoTile && !(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) 3327 WinSetWindowPos(hwndDir, 3328 HWND_TOP, 3329 swp.x, 3330 swp.y, 3331 swp.cx, 3332 swp.cy, 3333 swp.fl | SWP_MOVE | 3334 SWP_SIZE | SWP_SHOW | SWP_ZORDER | 3335 SWP_ACTIVATE); 3336 else if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) { 3337 WinSetWindowPos(hwndDir, 3338 HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW); 3339 WinSetWindowUShort(hwndDir, QWS_XRESTORE, (USHORT) swp.x); 3340 WinSetWindowUShort(hwndDir, QWS_CXRESTORE, (USHORT) swp.cx); 3341 WinSetWindowUShort(hwndDir, QWS_YRESTORE, (USHORT) swp.y); 3342 WinSetWindowUShort(hwndDir, QWS_CYRESTORE, (USHORT) swp.cy); 3343 } 3344 else 3345 WinSetWindowPos(hwndDir, 3346 HWND_BOTTOM, 3347 0, 0, 0, 0, SWP_ZORDER | SWP_ACTIVATE); 3348 } 3349 } 3349 3350 } 3350 3351 } // for … … 3375 3376 if (ulNumMinChildren) { 3376 3377 if (WinQueryWindowPos(hwndChild, &swp) && (swp.fl & SWP_MINIMIZE)) 3377 3378 (*ulNumMinChildren)++; 3378 3379 } 3379 3380 } … … 3383 3384 3384 3385 VOID GetNextWindowPos(HWND hwndClient, PSWP pswp, ULONG * ulCntR, 3385 3386 ULONG * ulNumMinChildrenR) 3386 3387 { 3387 3388 register ULONG ulCnt; … … 3447 3448 if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) { 3448 3449 if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom) 3449 3450 swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y; 3450 3451 if (swp.x != 0) 3451 3452 swp.x = 0; 3452 3453 if (swp.y < 0) 3453 3454 swp.y = 0; 3454 3455 if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft) 3455 3456 swp.cx = Rectl.xRight - Rectl.xLeft; 3456 3457 WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 3457 3458 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE); 3458 3459 } 3459 3460 } … … 3467 3468 GetNextWindowPos(hwndClient, &swp, &ulCnt, &ulNumMinChildren); 3468 3469 WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 3469 3470 3470 SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_RESTORE | 3471 SWP_ZORDER | SWP_ACTIVATE); 3471 3472 ulCnt++; 3472 3473 } … … 3521 3522 if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) { 3522 3523 if (swp.y < 0) 3523 3524 swp.y = 0; 3524 3525 if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom) 3525 3526 swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y; 3526 3527 if (swp.x != 0) 3527 3528 swp.x = 0; 3528 3529 if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft) 3529 3530 swp.cx = Rectl.xRight - Rectl.xLeft; 3530 3531 WinSetWindowPos(hwndTree, 3531 3532 3533 3534 3535 3532 HWND_TOP, 3533 swp.x, 3534 swp.y, 3535 swp.cx, 3536 swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE); 3536 3537 WinQueryWindowPos(hwndTree, &swp); 3537 3538 } … … 3558 3559 3559 3560 for (ulCurRow = 0; ulCurRow < ulNumRows; ulCurRow++) { 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3561 if ((ulNumRows - ulCurRow) <= ulExtraCols) 3562 ulNumCols++; 3563 for (ulCurCol = 0; ulCurCol < ulNumCols; ulCurCol++) { 3564 ulWidth = Rectl.xRight / ulNumCols; 3565 3566 while (hwndChild) { 3567 id = WinQueryWindowUShort(hwndChild, QWS_ID); 3568 if (id && (id != TREE_FRAME || fFreeTree)) { 3569 WinQueryWindowPos(hwndChild, &swp); 3570 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) 3571 break; 3572 } 3573 hwndChild = WinGetNextWindow(henum); 3574 } 3575 3576 if (hwndChild) { 3577 if (!absolute && (swp.fl & SWP_MAXIMIZE)) { 3578 WinGetMaxPosition(hwndChild, &swp); 3579 WinSetWindowPos(hwndChild, 3580 HWND_TOP, 3581 swp.x, 3582 swp.y, 3583 swp.cx, swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW); 3584 WinSetWindowUShort(hwndChild, 3585 QWS_XRESTORE, 3586 (USHORT) (ulWidth * ulCurCol) + Rectl.xLeft); 3587 WinSetWindowUShort(hwndChild, 3588 QWS_YRESTORE, 3589 (USHORT) (Rectl.yTop - 3590 (ulHeight * (ulCurRow + 1)))); 3591 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, (USHORT) ulWidth); 3592 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, (USHORT) ulHeight); 3593 } 3594 else 3595 WinSetWindowPos(hwndChild, 3596 HWND_TOP, 3597 (ulWidth * ulCurCol) + Rectl.xLeft, 3598 Rectl.yTop - (ulHeight * (ulCurRow + 1)), 3599 ulWidth, 3600 ulHeight, 3601 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE); 3602 hwndChild = WinGetNextWindow(henum); 3603 } 3604 } 3605 if ((ulNumRows - ulCurRow) <= ulExtraCols) { 3606 ulNumCols--; 3607 ulExtraCols--; 3608 } 3608 3609 } 3609 3610 } … … 3615 3616 3616 3617 static VOID ResizeChildren(HWND hwndClient, SHORT oldcx, SHORT oldcy, 3617 3618 SHORT newcx, SHORT newcy) 3618 3619 { 3619 3620 /* … … 3633 3634 while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) { 3634 3635 if (!WinQueryWindowUShort(hwndChild, QWS_ID)) 3635 3636 continue; 3636 3637 if (WinQueryWindowPos(hwndChild, &swp)) { 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3638 if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) { 3639 swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE); 3640 swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE); 3641 swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE); 3642 swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE); 3643 } 3644 else if (swp.fl & SWP_MAXIMIZE) { 3645 swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE); 3646 swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE); 3647 swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE); 3648 swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE); 3649 } 3650 cx = (swp.cx) ? (LONG) (((double)oldcx * 100.0) / (double)swp.cx) : 0; 3651 cy = (swp.cy) ? (LONG) (((double)oldcy * 100.0) / (double)swp.cy) : 0; 3652 x = (swp.x) ? (LONG) (((double)oldcx * 100.0) / (double)swp.x) : 0; 3653 y = (swp.y) ? (LONG) (((double)oldcy * 100.0) / (double)swp.y) : 0; 3654 if (x < 0) 3655 x = 0; 3656 if (y < 0) 3657 y = 0; 3658 ux = (x) ? (LONG) (((double)newcx * 100.0) / (double)x) : 0; 3659 uy = (y) ? (LONG) (((double)newcy * 100.0) / (double)y) : 0; 3660 ucx = (cx) ? (LONG) (((double)newcx * 100.0) / (double)cx) : 0; 3661 ucy = (cy) ? (LONG) (((double)newcy * 100.0) / (double)cy) : 0; 3662 if (ux + ucx > newcx) 3663 ucx = newcx - ux; 3664 if (uy + ucy > newcy) 3665 ucy = newcy - uy; 3666 3667 if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE))) 3668 WinSetWindowPos(hwndChild, HWND_TOP, ux, uy, ucx, ucy, 3669 SWP_MOVE | SWP_SIZE | SWP_SHOW); 3670 else if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) { 3671 WinSetWindowUShort(hwndChild, QWS_XMINIMIZE, (USHORT) - 1); 3672 WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1); 3673 WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0, 3674 SWP_SIZE | SWP_MOVE | SWP_FOCUSDEACTIVATE); 3675 WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux); 3676 WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy); 3677 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx); 3678 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy); 3679 } 3680 else { 3681 WinGetMaxPosition(hwndChild, &swp); 3682 WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 3683 SWP_MOVE | SWP_SIZE | SWP_SHOW); 3684 WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux); 3685 WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy); 3686 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx); 3687 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy); 3688 } 3688 3689 } 3689 3690 } … … 3701 3702 3702 3703 if (!fNoTreeGap) { 3703 3704 3705 swp.y = height;// Force bottom to position3704 INT height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2; 3705 if (swp.y < height) 3706 swp.y = height; // Force bottom to position 3706 3707 } 3707 3708 else 3708 swp.y = 0;// Force bottom to position3709 swp.y = 0; // Force bottom to position 3709 3710 3710 3711 swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y; 3711 3712 if (swp.cy < 0) 3712 3713 swp.cy = 0; 3713 3714 3714 3715 if (swp.x != 0) 3715 swp.x = 0;// Left align3716 swp.x = 0; // Left align 3716 3717 3717 3718 // AdjustSizeOfClient can return bogus xRight values - fixme someday 3718 3719 if (Rectl.xRight >= Rectl.xLeft) { 3719 3720 3720 if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft) 3721 swp.cx = Rectl.xRight - Rectl.xLeft; 3721 3722 } 3722 3723 WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 3723 3724 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE); 3724 3725 } 3725 3726 } … … 3749 3750 3750 3751 static MRESULT EXPENTRY ChildFrameButtonProc(HWND hwnd, 3751 3752 3752 ULONG msg, 3753 MPARAM mp1, MPARAM mp2) 3753 3754 { 3754 3755 USHORT id; … … 3764 3765 if (fOtherHelp) { 3765 3766 if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3767 && !WinQueryCapture(HWND_DESKTOP)) { 3768 id = WinQueryWindowUShort(hwnd, QWS_ID); 3769 switch (id) { 3770 case IDM_OPENWALK: 3771 MakeBubble(hwnd, FALSE, GetPString(IDS_WALKBUTTONHELP)); 3772 break; 3773 case IDM_USERLIST: 3774 MakeBubble(hwnd, FALSE, GetPString(IDS_QUICKBUTTONHELP)); 3775 break; 3776 } 3776 3777 } 3777 3778 } … … 3787 3788 switch (id) { 3788 3789 case IDM_OPENWALK: 3789 3790 3791 3792 3793 3794 3795 3790 switch (msg) { 3791 case WM_BUTTON2CLICK: 3792 if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) == 3793 (KC_ALT | KC_SHIFT | KC_CTRL)) 3794 cmd = IDM_GREP; 3795 else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL)) 3796 CascadeChildren(hwndMain); 3796 3797 3797 3798 #ifdef NEVER 3798 3799 3799 else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT)) 3800 cmd = IDM_SYSINFO; 3800 3801 #endif 3801 3802 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3803 else if (shiftstate & KC_SHIFT) 3804 cmd = IDM_WINDOWDLG; 3805 else if (shiftstate & KC_CTRL) 3806 cmd = IDM_SEEALL; 3807 else if (shiftstate & KC_ALT) 3808 TileChildren(hwndMain, TRUE); 3809 else 3810 cmd = IDM_WALKDIR; 3811 break; 3812 case WM_BUTTON3CLICK: 3813 TileChildren(hwndMain, TRUE); 3814 break; 3815 } 3816 break; 3816 3817 case IDM_USERLIST: 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3818 switch (msg) { 3819 case WM_BUTTON2CLICK: 3820 if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) == 3821 (KC_ALT | KC_SHIFT | KC_CTRL)) 3822 cmd = IDM_COLORPALETTE; 3823 else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL)) 3824 cmd = IDM_HIDEMENU; 3825 else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT)) 3826 cmd = IDM_NOTEBOOK; 3827 else if (shiftstate & KC_SHIFT) 3828 cmd = IDM_TOOLTITLES; 3829 else if (shiftstate & KC_CTRL) 3830 cmd = IDM_TEXTTOOLS; 3831 else if (shiftstate & KC_ALT) 3832 cmd = IDM_FONTPALETTE; 3833 else 3834 cmd = IDM_TOOLBAR; 3835 break; 3836 case WM_BUTTON3CLICK: 3837 cmd = IDM_DRIVEBAR; 3838 break; 3839 } 3840 break; 3840 3841 } // switch id 3841 3842 3842 3843 if (cmd) { 3843 3844 3844 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_CLIENT), 3845 WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID); 3845 3846 } 3846 3847 } … … 3851 3852 if (id == IDM_OPENWALK) { 3852 3853 if (!emphasized) { 3853 3854 3854 emphasized = TRUE; 3855 DrawTargetEmphasis(hwnd, emphasized); 3855 3856 } 3856 3857 if (AcceptOneDrop(hwnd, mp1, mp2)) 3857 3858 return MRFROM2SHORT(DOR_DROP, DO_MOVE); 3858 3859 } 3859 3860 return MRFROM2SHORT(DOR_NEVERDROP, 0); … … 3875 3876 3876 3877 if (emphasized) { 3877 3878 3878 emphasized = FALSE; 3879 DrawTargetEmphasis(hwnd, emphasized); 3879 3880 } 3880 3881 if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) { 3881 3882 3883 3882 if (MakeValidDir(szFrom) && !FindDirCnrByName(szFrom, TRUE)) { 3883 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szFrom); 3884 } 3884 3885 } 3885 3886 } … … 3894 3895 3895 3896 static MRESULT EXPENTRY MainFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1, 3896 3897 MPARAM mp2) 3897 3898 { 3898 3899 PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER); … … 3906 3907 pswp = (SWP *) mp1; 3907 3908 if (fDataMin && !fAmClosing) { 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3909 if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) { 3910 3911 SWP swp; 3912 3913 WinQueryWindowPos(hwnd, &swp); 3914 PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(swp.fl), MPVOID); 3915 HideNote(); 3916 } 3917 else if (pswp->fl & (SWP_SHOW | SWP_RESTORE)) { 3918 if (DataHwnd) 3919 PostMsg(DataHwnd, WM_CLOSE, MPVOID, MPVOID); 3920 } 3920 3921 } 3921 3922 if (!fAmClosing) { 3922 3923 3923 if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) 3924 HideNote(); 3924 3925 } 3925 3926 } … … 3944 3945 case WM_CONTROL: 3945 3946 return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), UM_CONTROL, mp1, 3946 3947 mp2); 3947 3948 3948 3949 case WM_COMMAND: … … 3964 3965 3965 3966 if (mr && mp2) { 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 3967 prectl = (PRECTL) mp1; 3968 if (prectl->yBottom != prectl->yTop) { 3969 { 3970 HPS hps; 3971 POINTL aptl[TXTBOX_COUNT]; 3972 3973 hps = WinGetPS(hwndStatus); 3974 if (hps) { 3975 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl); 3976 bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6; 3977 WinReleasePS(hps); 3978 } 3979 } 3980 prectl->yBottom += (sheight + 4); 3981 prectl->yTop -= (sheight + 4); 3982 if (fMoreButtons) { 3983 3984 HPS hps; 3985 POINTL aptl[TXTBOX_COUNT]; 3986 3987 hps = WinGetPS(hwndName); 3988 if (hps) { 3989 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl); 3990 bheight = aptl[TXTBOX_TOPLEFT].y + 6; 3991 WinReleasePS(hps); 3992 } 3993 prectl->yBottom += (bheight + 4); 3994 prectl->yTop -= (bheight + 4); 3995 } 3996 if (fToolbar) { 3997 if (!fTextTools) 3998 prectl->yTop -= ((fToolTitles) ? 50 : 40); 3999 else 4000 prectl->yTop -= 32; 4001 } 4002 if (fDrivebar) { 4003 ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), 4004 ((prectl->xRight - 4005 (WinQuerySysValue(HWND_DESKTOP, 4006 SV_CYSIZEBORDER) * 2)) - 4)); 4007 prectl->yTop -= (16 * (DriveLines * 18)); 4008 } 4009 if (fUserComboBox) { 4010 if (!aheight) { 4011 4012 SWP swpTemp; 4013 4014 WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT), 4015 &swpTemp); 4016 aheight = swpTemp.cy; 4017 } 4018 prectl->yTop -= (aheight + 6L); 4019 } 4020 if (fAutoView) { 4021 AutoviewHeight = min(AutoviewHeight, 4022 (prectl->yTop - prectl->yBottom) - 116); 4023 AutoviewHeight = max(AutoviewHeight, 36); 4024 prectl->yBottom += (AutoviewHeight + 6); 4025 } 4026 } 4026 4027 } 4027 4028 return mr; … … 4047 4048 pswp = (PSWP) mp1; 4048 4049 { 4049 4050 4051 4052 4053 4054 4055 4056 4057 4050 SHORT x; 4051 4052 for (x = 0; x < soldCount; x++) { 4053 if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) { 4054 pswpClient = pswp; 4055 break; 4056 } 4057 pswp++; 4058 } 4058 4059 } 4059 4060 4060 4061 { 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4062 HPS hps; 4063 POINTL aptl[TXTBOX_COUNT]; 4064 4065 hps = WinGetPS(hwndStatus); 4066 if (hps) { 4067 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl); 4068 bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6; 4069 WinReleasePS(hps); 4070 } 4071 if (fMoreButtons) { 4072 hps = WinGetPS(hwndName); 4073 if (hps) { 4074 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl); 4075 bheight = aptl[TXTBOX_TOPLEFT].y + 6; 4076 WinReleasePS(hps); 4077 } 4078 } 4078 4079 } 4079 4080 pswpNew = (PSWP) mp1 + soldCount; … … 4085 4086 pswpNew->y = swpClient.y + 2; 4086 4087 if (!fSplitStatus) 4087 4088 width = swpClient.cx - (16 + (sheight * 2) + 4); 4088 4089 else 4089 4090 width = (swpClient.cx - (16 + (sheight * 2) + 4)) / 2; 4090 4091 width = max(width, 10); 4091 4092 if (fSplitStatus) 4092 4093 pswpNew->cx = width - 6; 4093 4094 else 4094 4095 pswpNew->cx = width - 8; 4095 4096 pswpNew->cy = sheight; 4096 4097 pswpClient->y = pswpNew->y + pswpNew->cy + 3; … … 4099 4100 4100 4101 if (fSplitStatus) { 4101 4102 4103 4104 4105 4106 4107 4108 4109 4102 pswpNew = (PSWP) mp1 + (soldCount + 1); 4103 *pswpNew = *pswpClient; 4104 pswpNew->hwnd = hwndStatus2; 4105 pswpNew->hwndInsertBehind = HWND_BOTTOM; 4106 pswpNew->x = width + 8; 4107 pswpNew->y = swpClient.y + 2; 4108 pswpNew->cx = width - 6; 4109 pswpNew->cy = sheight; 4110 sCount++; 4110 4111 } 4111 4112 else { 4112 4113 4113 WinShowWindow(hwndStatus2, FALSE); 4114 WinSetWindowText(hwndStatus2, NullStr); 4114 4115 } 4115 4116 4116 4117 if (fToolbar) { 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4118 if (fTextTools) 4119 theight = 32L; 4120 else if (!fToolTitles) 4121 theight = 40L; 4122 pswpNew = (PSWP) mp1 + (soldCount + 1 + (fSplitStatus != FALSE)); 4123 *pswpNew = *pswpClient; 4124 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_TOOLS); 4125 pswpNew->hwndInsertBehind = HWND_BOTTOM; 4126 pswpNew->x = swpClient.x + 2; 4127 pswpNew->y = (swpClient.y + swpClient.cy) - (theight - 2); 4128 pswpNew->cx = swpClient.cx - 4; 4129 pswpNew->cy = theight - 4; 4130 pswpClient->cy -= theight; 4131 sCount++; 4131 4132 } 4132 4133 else 4133 4134 WinShowWindow(WinWindowFromID(hwnd, MAIN_TOOLS), FALSE); 4134 4135 4135 4136 if (fDrivebar) { 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4137 ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), pswpClient->cx - 4); 4138 pswpNew = (PSWP) mp1 + (soldCount + 1 + 4139 (fSplitStatus != FALSE) + 4140 (fToolbar != FALSE)); 4141 *pswpNew = *pswpClient; 4142 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_DRIVES); 4143 pswpNew->hwndInsertBehind = HWND_BOTTOM; 4144 pswpNew->x = swpClient.x + 2; 4145 dheight += ((dheight - 2) * DriveLines); 4146 pswpNew->y = (swpClient.y + swpClient.cy) - (dheight - 2); 4147 if (fToolbar) 4148 pswpNew->y -= theight; 4149 pswpNew->cx = swpClient.cx - 4; 4150 pswpNew->cy = dheight - 4; 4151 pswpClient->cy -= dheight; 4152 sCount++; 4152 4153 } 4153 4154 else 4154 4155 WinShowWindow(WinWindowFromID(hwnd, MAIN_DRIVES), FALSE); 4155 4156 4156 4157 if (fAutoView) { 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4158 pswpNew = (PSWP) mp1 + (soldCount + 1 + 4159 (fToolbar != FALSE) + 4160 (fDrivebar != FALSE) + 4161 (fSplitStatus != FALSE)); 4162 *pswpNew = *pswpClient; 4163 pswpNew->hwnd = (fComments) ? hwndAutoMLE : hwndAutoview; 4164 pswpNew->x = pswpClient->x + 3; 4165 pswpNew->y = pswpClient->y + 3; 4166 if (fMoreButtons) 4167 pswpNew->y += (bheight + 4); 4168 pswpNew->cx = pswpClient->cx - 6; 4169 AutoviewHeight = min(AutoviewHeight, pswpClient->cy - 116); 4170 AutoviewHeight = max(AutoviewHeight, 36); 4171 pswpNew->cy = AutoviewHeight; 4172 pswpClient->y += (AutoviewHeight + 6); 4173 pswpClient->cy -= (AutoviewHeight + 6); 4174 sCount++; 4175 WinShowWindow((fComments) ? hwndAutoview : hwndAutoMLE, FALSE); 4175 4176 } 4176 4177 else { 4177 4178 4178 WinShowWindow(hwndAutoview, FALSE); 4179 WinShowWindow(hwndAutoMLE, FALSE); 4179 4180 } 4180 4181 4181 4182 pswpNew = (PSWP) mp1 + (soldCount + 1 + 4182 4183 4184 4183 (fToolbar != FALSE) + 4184 (fDrivebar != FALSE) + 4185 (fSplitStatus != FALSE) + (fAutoView != FALSE)); 4185 4186 *pswpNew = *pswpClient; 4186 4187 pswpNew->hwnd = WinWindowFromID(hwnd, IDM_OPENWALK); … … 4191 4192 sCount++; 4192 4193 pswpNew = (PSWP) mp1 + (soldCount + 2 + 4193 4194 4195 4194 (fToolbar != FALSE) + 4195 (fDrivebar != FALSE) + 4196 (fSplitStatus != FALSE) + (fAutoView != FALSE)); 4196 4197 *pswpNew = *pswpClient; 4197 4198 pswpNew->hwnd = WinWindowFromID(hwnd, IDM_USERLIST); … … 4202 4203 sCount++; 4203 4204 pswpNew = (PSWP) mp1 + (soldCount + 3 + 4204 4205 4206 4205 (fToolbar != FALSE) + 4206 (fDrivebar != FALSE) + 4207 (fSplitStatus != FALSE) + (fAutoView != FALSE)); 4207 4208 *pswpNew = *pswpClient; 4208 4209 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LED); … … 4213 4214 sCount++; 4214 4215 pswpNew = (PSWP) mp1 + (soldCount + 4 + 4215 4216 4217 4216 (fToolbar != FALSE) + 4217 (fDrivebar != FALSE) + 4218 (fSplitStatus != FALSE) + (fAutoView != FALSE)); 4218 4219 *pswpNew = *pswpClient; 4219 4220 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LEDHDR); … … 4224 4225 sCount++; 4225 4226 if (fUserComboBox) { 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4227 if (!aheight) { 4228 4229 SWP swpTemp; 4230 4231 WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT), 4232 &swpTemp); 4233 aheight = swpTemp.cy; 4234 } 4235 pswpNew = (PSWP) mp1 + (soldCount + 5 + 4236 (fToolbar != FALSE) + 4237 (fSplitStatus != FALSE) + 4238 (fDrivebar != FALSE) + (fAutoView != FALSE)); 4239 *pswpNew = *pswpClient; 4240 pswpNew->hwnd = hwndDrivelist; 4241 pswpNew->x = swpClient.x; 4242 pswpNew->cx = 48; 4243 pswpClient->cy -= (aheight + 6L); 4244 pswpNew->y = pswpClient->y; 4245 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4246 sCount++; 4247 pswpNew = (PSWP) mp1 + (soldCount + 6 + 4248 (fToolbar != FALSE) + 4249 (fDrivebar != FALSE) + 4250 (fSplitStatus != FALSE) + 4251 (fAutoView != FALSE)); 4252 *pswpNew = *pswpClient; 4253 pswpNew->hwnd = hwndStatelist; 4254 pswpNew->x = swpClient.x + 48; 4255 pswpNew->cx = (swpClient.cx - 48) / 7; 4256 pswpNew->y = pswpClient->y; 4257 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4258 sCount++; 4259 pswpNew = (PSWP) mp1 + (soldCount + 7 + 4260 (fToolbar != FALSE) + 4261 (fDrivebar != FALSE) + 4262 (fSplitStatus != FALSE) + 4263 (fAutoView != FALSE)); 4264 *pswpNew = *pswpClient; 4265 pswpNew->hwnd = hwndCmdlist; 4266 pswpNew->x = swpClient.x + 48 + ((swpClient.cx - 48) / 7); 4267 pswpNew->cx = (swpClient.cx - 48) / 5 + 4268 ((swpClient.cx - 48) / 5) - ((swpClient.cx - 48) / 7); 4269 pswpNew->y = pswpClient->y; 4270 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4271 sCount++; 4272 pswpNew = (PSWP) mp1 + (soldCount + 8 + 4273 (fToolbar != FALSE) + 4274 (fDrivebar != FALSE) + 4275 (fSplitStatus != FALSE) + 4276 (fAutoView != FALSE)); 4277 *pswpNew = *pswpClient; 4278 pswpNew->hwnd = hwndUserlist; 4279 pswpNew->x = swpClient.x + 48 + (((swpClient.cx - 48) / 5) * 2); 4280 pswpNew->cx = ((swpClient.x + swpClient.cx) - pswpNew->x) - 4281 ((fToolbar) ? ((swpClient.cx - 48) / 7) : 0); 4282 pswpNew->y = pswpClient->y; 4283 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4284 sCount++; 4285 if (fToolbar) { 4286 pswpNew = (PSWP) mp1 + (soldCount + 9 + 4287 (fToolbar != FALSE) + 4288 (fDrivebar != FALSE) + 4289 (fSplitStatus != FALSE) + 4290 (fAutoView != FALSE)); 4291 *pswpNew = *pswpClient; 4292 pswpNew->hwnd = hwndButtonlist; 4293 pswpNew->x = swpClient.cx - ((swpClient.cx - 48) / 7) + 4; 4294 pswpNew->cx = (swpClient.x + swpClient.cx) - pswpNew->x; 4295 pswpNew->y = pswpClient->y; 4296 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4297 sCount++; 4298 } 4299 else 4300 WinShowWindow(hwndButtonlist, FALSE); 4300 4301 } 4301 4302 else { 4302 4303 4304 4305 4306 4303 WinShowWindow(hwndUserlist, FALSE); 4304 WinShowWindow(hwndDrivelist, FALSE); 4305 WinShowWindow(hwndStatelist, FALSE); 4306 WinShowWindow(hwndButtonlist, FALSE); 4307 WinShowWindow(hwndCmdlist, FALSE); 4307 4308 } 4308 4309 { 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4310 PSWP pswpTitlebar = (PSWP) 0, pswpMinbutton = (PSWP) 0; 4311 SHORT x; 4312 4313 pswpNew = (PSWP) mp1 + (soldCount + 5 + 4314 (fToolbar != FALSE) + 4315 (fDrivebar != FALSE) + 4316 (fSplitStatus != FALSE) + 4317 (fAutoView != FALSE) + 4318 ((fUserComboBox != FALSE) * 4) + 4319 (fUserComboBox != FALSE && 4320 fToolbar != FALSE)); 4321 pswp = (PSWP) mp1; 4322 for (x = 0; x < soldCount; x++) { 4323 if (!pswpTitlebar && 4324 WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_TITLEBAR) 4325 pswpTitlebar = pswp; 4326 else if (!pswpMinbutton && 4327 WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_MINMAX) 4328 pswpMinbutton = pswp; 4329 if (pswpTitlebar && pswpMinbutton) 4330 break; 4331 pswp++; 4332 } 4333 if (pswpMinbutton && pswpTitlebar) { 4334 *pswpNew = *pswpMinbutton; 4335 pswpNew->hwnd = WinWindowFromID(hwnd, IDM_IDEALSIZE); 4336 pswpNew->cy = pswpMinbutton->cy + 3; 4337 pswpNew->cx = min(pswpNew->cy, (pswpMinbutton->cx / 2) + 3); 4338 pswpTitlebar->cx -= (pswpNew->cx - 1); 4339 pswpNew->x = pswpTitlebar->x + (pswpTitlebar->cx); 4340 pswpNew->y = pswpMinbutton->y - 1; 4341 sCount++; 4342 } 4343 else 4344 WinShowWindow(WinWindowFromID(hwnd, IDM_IDEALSIZE), FALSE); 4344 4345 } 4345 4346 4346 4347 if (fMoreButtons) { 4347 4348 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4349 LONG lastx; 4350 4351 pswpNew = (PSWP) mp1 + (soldCount + 6 + 4352 (fToolbar != FALSE) + 4353 (fDrivebar != FALSE) + 4354 (fSplitStatus != FALSE) + 4355 (fAutoView != FALSE) + 4356 ((fUserComboBox != FALSE) * 4) + 4357 (fUserComboBox != FALSE && 4358 fToolbar != FALSE)); 4359 *pswpNew = *pswpClient; 4360 pswpNew->hwnd = hwndName; 4361 pswpNew->x = swpClient.x + 3; 4362 pswpNew->y = swpClient.y + (sheight + 6); 4363 pswpNew->cx = ((swpClient.cx / 2) + (swpClient.cx / 5)) - 3; 4364 lastx = pswpNew->x + pswpNew->cx; 4365 pswpNew->cy = bheight; 4366 pswpClient->y += (bheight + 4); 4367 pswpClient->cy -= (bheight + 4); 4368 sCount++; 4369 pswpNew = (PSWP) mp1 + (soldCount + 7 + 4370 (fToolbar != FALSE) + 4371 (fDrivebar != FALSE) + 4372 (fSplitStatus != FALSE) + 4373 (fAutoView != FALSE) + 4374 ((fUserComboBox != FALSE) * 4) + 4375 (fUserComboBox != FALSE && 4376 fToolbar != FALSE)); 4377 *pswpNew = *pswpClient; 4378 pswpNew->hwnd = hwndDate; 4379 pswpNew->x = lastx + 3; 4380 pswpNew->y = swpClient.y + (sheight + 6); 4381 pswpNew->cx = (swpClient.cx / 6) + (swpClient.cx / 16) - 3; 4382 lastx = pswpNew->x + pswpNew->cx; 4383 pswpNew->cy = bheight; 4384 sCount++; 4385 pswpNew = (PSWP) mp1 + (soldCount + 8 + 4386 (fToolbar != FALSE) + 4387 (fDrivebar != FALSE) + 4388 (fSplitStatus != FALSE) + 4389 (fAutoView != FALSE) + 4390 ((fUserComboBox != FALSE) * 4) + 4391 (fUserComboBox != FALSE && 4392 fToolbar != FALSE)); 4393 *pswpNew = *pswpClient; 4394 pswpNew->hwnd = hwndAttr; 4395 pswpNew->x = lastx + 3; 4396 pswpNew->y = swpClient.y + (sheight + 6); 4397 pswpNew->cx = (swpClient.cx - pswpNew->x) - 1; 4398 pswpNew->cy = bheight; 4399 sCount++; 4399 4400 } 4400 4401 else { 4401 4402 4403 4402 WinShowWindow(hwndAttr, FALSE); 4403 WinShowWindow(hwndName, FALSE); 4404 WinShowWindow(hwndDate, FALSE); 4404 4405 } 4405 4406 return MRFROMSHORT(sCount); … … 4414 4415 sCount += 6; 4415 4416 if (fSplitStatus) 4416 4417 sCount++; 4417 4418 if (fToolbar) 4418 4419 sCount++; 4419 4420 if (fUserComboBox) { 4420 4421 4422 4421 sCount += 4; 4422 if (fToolbar) 4423 sCount++; 4423 4424 } 4424 4425 if (fDrivebar) 4425 4426 sCount++; 4426 4427 if (fAutoView) 4427 4428 sCount++; 4428 4429 if (fMoreButtons) 4429 4430 sCount += 3; 4430 4431 return MRFROMSHORT(sCount); 4431 4432 } … … 4448 4449 // DbgMsg(pszSrcFile, __LINE__, "IDM_CONTEXTMENU %x", hwnd); 4449 4450 if (hwnd != NULLHANDLE) { 4450 4451 4452 4453 4454 4455 4456 4457 4458 4451 HWND hwndParent = WinQueryWindow(hwnd, QW_PARENT); 4452 USHORT id = WinQueryWindowUShort(hwndParent, QWS_ID); 4453 switch (id) { 4454 case MAIN_SETUPLIST: 4455 case MAIN_USERLIST: 4456 case MAIN_CMDLIST: 4457 // DbgMsg(pszSrcFile, __LINE__, "WM_CONTEXTMENU"); 4458 WinPostMsg(hwnd, WM_CONTEXTMENU, 0, 0); 4459 } 4459 4460 } 4460 4461 } … … 4485 4486 wa.size = sizeof(wa); 4486 4487 pci = 4487 4488 4489 4490 4491 4488 (PCNRITEM) 4489 WinSendMsg(WinWindowFromID 4490 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), 4491 CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST), 4492 MPFROMSHORT(CRA_CURSORED)); 4492 4493 if (pci && (INT) pci != -1) { 4493 4494 4494 strcpy(wa.szCurrentPath1, pci->pszFileName); 4495 MakeValidDir(wa.szCurrentPath1); 4495 4496 } 4496 4497 else 4497 4498 save_dir2(wa.szCurrentPath1); 4498 4499 TopWindowName(hwndMain, (HWND) 0, wa.szCurrentPath2); 4499 4500 if (!*wa.szCurrentPath2) 4500 4501 strcpy(wa.szCurrentPath2, wa.szCurrentPath1); 4501 4502 MakeValidDir(wa.szCurrentPath2); 4502 4503 if (WinDlgBox(HWND_DESKTOP, 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4504 hwnd, 4505 WalkTwoCmpDlgProc, 4506 FM3ModHandle, 4507 WALK2_FRAME, 4508 MPFROMP(&wa)) && 4509 !IsFile(wa.szCurrentPath1) && !IsFile(wa.szCurrentPath2)) { 4510 if (!*dircompare) { 4511 4512 COMPARE *cmp; 4513 4514 cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__); 4515 if (cmp) { 4516 cmp->size = sizeof(COMPARE); 4517 strcpy(cmp->leftdir, wa.szCurrentPath1); 4518 strcpy(cmp->rightdir, wa.szCurrentPath2); 4519 cmp->hwndParent = hwnd; 4520 cmp->dcd.hwndParent = hwnd; 4521 WinDlgBox(HWND_DESKTOP, 4522 HWND_DESKTOP, 4523 CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp)); 4524 } 4525 } 4526 else { 4527 4528 CHAR szPath1[CCHMAXPATH]; 4529 CHAR szPath2[CCHMAXPATH]; 4530 runemf2(SEPARATE, 4531 HWND_DESKTOP, pszSrcFile, __LINE__, 4532 NULL, NULL, 4533 "%s %s %s", 4534 dircompare, 4535 BldQuotedFileName(szPath1, wa.szCurrentPath1), 4536 BldQuotedFileName(szPath2, wa.szCurrentPath2)); 4537 } 4537 4538 } 4538 4539 } … … 4546 4547 case IDM_CLI: 4547 4548 if (fSplitStatus && 4548 4549 4550 4549 hwndStatus2 && 4550 !WinIsWindow(WinQueryAnchorBlock(hwnd), 4551 WinWindowFromID(hwndStatus2, COMMAND_LINE))) 4551 4552 PostMsg(hwndStatus2, UM_CLICKED, MPVOID, MPVOID); 4552 4553 break; … … 4561 4562 bstrip(temp); 4562 4563 if (*temp && 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4564 !DosQueryPathInfo(temp, FIL_QUERYFULLNAME, path, sizeof(path))) { 4565 if (SHORT1FROMMP(mp1) == IDM_ADDTOUSERLIST) { 4566 add_udir(TRUE, path); 4567 if (fUdirsChanged) 4568 save_udirs(); 4569 WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID); 4570 } 4571 else { 4572 if (!remove_udir(path)) 4573 Runtime_Error(pszSrcFile, __LINE__, "remove_udir"); 4574 else { 4575 if (fUdirsChanged) 4576 save_udirs(); 4577 WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID); 4578 } 4579 } 4579 4580 } 4580 4581 } … … 4591 4592 // Complain if attempting to use reserved name 4592 4593 if (stricmp(szStateName, GetPString(IDS_STATETEXT)) == 0 || 4593 // stricmp(szStateName, GetPString(IDS_FM2TEMPTEXT)) == 0 || 4594 // stricmp(szStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0) 4595 stricmp(szStateName, GetPString(IDS_FM2TEMPTEXT)) == 0) 4594 stricmp(szStateName, GetPString(IDS_FM2TEMPTEXT)) == 0) 4596 4595 { 4597 4598 4599 4596 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, 4597 GetPString(IDS_WARNINGTEXT), 4598 "\"%s\" is a reserved state name", szStateName); 4600 4599 } 4601 4600 // Ignore request if blank 4602 else if (*szStateName) 4603 { 4604 BOOL fAbortOperation = FALSE; 4605 if (!fNoSaveState && fSaveState && stricmp(szStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0) 4606 { 4607 if (saymsg(MB_YESNO | MB_DEFBUTTON2 | MB_ICONASTERISK, hwnd, 4608 GetPString(IDS_WARNINGTEXT), 4609 "\"%s\" is the state name used by 'Save directory container state'. Any changes to this state will last only until FM/2 closes or this setting is disabled. Proceed with this change?", szStateName) == MBID_NO) 4610 fAbortOperation = TRUE; 4611 } 4612 if (!fAbortOperation) { 4601 else if (*szStateName) { 4602 BOOL fAbortOperation = FALSE; 4603 if (!fNoSaveState && fSaveState && stricmp(szStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0) 4604 { 4605 if (saymsg(MB_YESNO | MB_DEFBUTTON2 | MB_ICONASTERISK, hwnd, 4606 GetPString(IDS_WARNINGTEXT), 4607 "\"%s\" is the state name used by \"Save directory container state\". Any changes to this state will last only until FM/2 closes or this setting is disabled. Proceed with this change?", szStateName) == MBID_NO) 4608 fAbortOperation = TRUE; 4609 } 4610 if (!fAbortOperation) { 4613 4611 if (SHORT1FROMMP(mp1) == IDM_SAVEDIRCNRSTATE) { 4614 4612 // Save … … 4617 4615 INT ret = add_setup(szStateName); 4618 4616 if (ret == 0) { 4619 4620 4621 4617 WinSendMsg(hwndStatelist, LM_INSERTITEM, 4618 MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(szStateName)); 4619 save_setups(); 4622 4620 } 4623 4621 else if (ret != 1) { 4624 4625 4626 4627 4622 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, 4623 GetPString(IDS_WARNINGTEXT), 4624 "\"%s\" state name add failed", szStateName); // 15 Apr 07 SHL failed 4625 WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT)); 4628 4626 } 4629 4627 } 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 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 4628 else { 4629 saymsg(MB_ENTER | MB_ICONASTERISK, 4630 hwnd, 4631 GetPString(IDS_WARNINGTEXT), 4632 nSaved == 0 ? 4633 "Nothing to save" : 4634 "State data save failed"); 4635 WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT)); 4636 } 4637 } 4638 else { 4639 // Delete 4640 ULONG numsaves = 0, size, x; 4641 CHAR s[STATE_NAME_MAX_BYTES + 80]; 4642 4643 INT ret = remove_setup(szStateName); 4644 if (ret == 1) 4645 save_setups(); 4646 sprintf(s, "%s.NumDirsLastTime", szStateName); 4647 size = sizeof(ULONG); 4648 if (!PrfQueryProfileData(fmprof, 4649 FM3Str, 4650 s, 4651 (PVOID)&numsaves, 4652 &size)) { 4653 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, 4654 GetPString(IDS_WARNINGTEXT), 4655 GetPString(IDS_DOESNTEXISTTEXT), szStateName); 4656 } 4657 else if (!size) 4658 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 4659 else { 4660 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0L); 4661 for (x = 0; x < numsaves; x++) { 4662 sprintf(s, "%s.DirCnrPos.%lu", szStateName, x); 4663 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4664 sprintf(s, "%s.DirCnrDir.%lu", szStateName, x); 4665 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4666 sprintf(s, "%s.DirCnrSort.%lu", szStateName, x); 4667 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4668 sprintf(s, "%s.DirCnrFilter.%lu", szStateName, x); 4669 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4670 sprintf(s, "%s.DirCnrView.%lu", szStateName, x); 4671 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4672 sprintf(s, "%s.DirCnr.%lu.DetailsLongname", szStateName, x); 4673 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4674 sprintf(s, "%s.DirCnr.%lu.DetailsSubject", szStateName, x); 4675 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4676 sprintf(s, "%s.DirCnr.%lu.DetailsSize", szStateName, x); 4677 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4678 sprintf(s, "%s.DirCnr.%lu.DetailsEA", szStateName, x); 4679 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4680 sprintf(s, "%s.DirCnr.%lu.DetailsAttr", szStateName, x); 4681 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4682 sprintf(s, "%s.DirCnr.%lu.DetailsIcon", szStateName, x); 4683 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4684 sprintf(s, "%s.DirCnr.%lu.DetailsLWDate", szStateName, x); 4685 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4686 sprintf(s, "%s.DirCnr.%lu.DetailsLWTime", szStateName, x); 4687 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4688 sprintf(s, "%s.DirCnr.%lu.DetailsLADate", szStateName, x); 4689 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4690 sprintf(s, "%s.DirCnr.%lu.DetailsLATime", szStateName, x); 4691 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4692 sprintf(s, "%s.DirCnr.%lu.DetailsCRDate", szStateName, x); 4693 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4694 sprintf(s, "%s.DirCnr.%lu.DetailsCRTime", szStateName, x); 4695 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4696 sprintf(s, "%s.DirCnr.%lu.Backgroundcolor", szStateName, x); 4697 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4698 sprintf(s, "%s.DirCnr.%lu.Fontnamesize", szStateName, x); 4699 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4700 } 4701 sprintf(s, "%s.LastTreePos", szStateName); 4702 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4703 sprintf(s, "%s.MySizeLastTime", szStateName); 4704 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4705 } 4706 PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID); 4707 } 4708 } 4711 4709 } 4712 4710 } … … 4721 4719 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp); 4722 4720 if (swp.fl & SWP_MAXIMIZE) { 4723 4724 4725 4721 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_SYSCOMMAND, 4722 MPFROM2SHORT(SC_RESTORE, 0), MPVOID); 4723 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp); 4726 4724 } 4727 4725 WinGetMaxPosition(WinQueryWindow(hwnd, QW_PARENT), &swpD); … … 4731 4729 swpD.cy -= (icz + bsz); 4732 4730 if (swp.x == swpD.x && swp.y == swpD.y && 4733 4734 4735 4736 4737 4738 4739 4740 4731 swp.cx == swpD.cx && swp.cy == swpD.cy && 4732 // fixme to be #defined someday 4733 WinQueryWindowUShort(hwnd, QWL_USER + 10) && 4734 WinQueryWindowUShort(hwnd, QWL_USER + 14)) { 4735 swpD.x = WinQueryWindowUShort(hwnd, QWL_USER + 8); 4736 swpD.cx = WinQueryWindowUShort(hwnd, QWL_USER + 10); 4737 swpD.y = WinQueryWindowUShort(hwnd, QWL_USER + 12); 4738 swpD.cy = WinQueryWindowUShort(hwnd, QWL_USER + 14); 4741 4739 } 4742 4740 else { 4743 4744 4745 4746 4741 WinSetWindowUShort(hwnd, QWL_USER + 8, (USHORT) swp.x); 4742 WinSetWindowUShort(hwnd, QWL_USER + 10, (USHORT) swp.cx); 4743 WinSetWindowUShort(hwnd, QWL_USER + 12, (USHORT) swp.y); 4744 WinSetWindowUShort(hwnd, QWL_USER + 14, (USHORT) swp.cy); 4747 4745 } 4748 4746 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 4749 4747 swpD.x, swpD.y, swpD.cx, swpD.cy, SWP_MOVE | SWP_SIZE); 4750 4748 } 4751 4749 break; … … 4753 4751 case IDM_BLINK: 4754 4752 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0, 4755 4753 SWP_MINIMIZE); 4756 4754 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0, 4757 4755 SWP_RESTORE | SWP_ZORDER); 4758 4756 break; 4759 4757 … … 4763 4761 4764 4762 if (hwndTop) 4765 4763 WinSetFocus(HWND_DESKTOP, hwndTop); 4766 4764 } 4767 4765 break; … … 4785 4783 case IDM_QUICKSETTINGS: 4786 4784 WinDlgBox(HWND_DESKTOP, 4787 4785 hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMLONG(mp1)); 4788 4786 break; 4789 4787 … … 4791 4789 case IDM_VIEWINFS: 4792 4790 WinDlgBox(HWND_DESKTOP, 4793 4794 4795 4796 4797 4798 4791 HWND_DESKTOP, 4792 ViewInfProc, 4793 FM3ModHandle, 4794 VINF_FRAME, 4795 ((SHORT1FROMMP(mp1) == IDM_VIEWHELPS) ? 4796 MPFROMP(NullStr) : MPVOID)); 4799 4797 break; 4800 4798 … … 4806 4804 TopWindowName(hwnd, (HWND) 0, newpath); 4807 4805 if (WinDlgBox(HWND_DESKTOP, 4808 4809 4810 4811 4806 hwnd, 4807 WalkAllDlgProc, 4808 FM3ModHandle, WALK_FRAME, MPFROMP(newpath)) && *newpath) 4809 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, newpath); 4812 4810 } 4813 4811 break; … … 4830 4828 if (SHORT1FROMMP(mp2) == CMDSRC_MENU) { 4831 4829 4832 4833 4834 4835 4836 4837 4838 4839 4840 4830 RECTL rcl; 4831 ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2L; 4832 4833 WinQueryWindowRect(HWND_DESKTOP, &rcl); 4834 rcl.yBottom += icz; 4835 rcl.yTop -= icz; 4836 rcl.xLeft += icz; 4837 rcl.xRight -= icz; 4838 WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID); 4841 4839 } 4842 4840 else { 4843 4841 4844 4845 4846 4847 4848 4849 4850 4851 4842 RECTL rcl; 4843 4844 WinQueryWindowRect(HWND_DESKTOP, &rcl); 4845 rcl.yBottom += 8; 4846 rcl.yTop = (rcl.yTop / 2) + (rcl.yTop / 7); 4847 rcl.xLeft = (rcl.xRight / 2) - (rcl.xRight / 7); 4848 rcl.xRight -= 8; 4849 WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID); 4852 4850 } 4853 4851 switch (SHORT1FROMMP(mp1)) { 4854 4852 case IDM_HELPCONTEXT: 4855 4856 4857 4853 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4854 MPFROM2SHORT(HELP_CONTEXT, 0), MPFROMSHORT(HM_RESOURCEID)); 4855 break; 4858 4856 4859 4857 case IDM_HELPMOUSE: 4860 4861 4862 4863 4858 if (hwndHelp) 4859 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4860 MPFROM2SHORT(HELP_MOUSE, 0), MPFROMSHORT(HM_RESOURCEID)); 4861 break; 4864 4862 4865 4863 case IDM_HELPPIX: 4866 4867 4868 4864 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4865 MPFROM2SHORT(HELP_BITMAP1, 0), MPFROMSHORT(HM_RESOURCEID)); 4866 break; 4869 4867 4870 4868 case IDM_HELPTUTOR: 4871 4872 4873 4874 4869 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4870 MPFROM2SHORT(HELP_TUTORIAL, 0), 4871 MPFROMSHORT(HM_RESOURCEID)); 4872 break; 4875 4873 4876 4874 case IDM_HELPHINTS: 4877 4878 4879 4875 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4876 MPFROM2SHORT(HELP_HINTS, 0), MPFROMSHORT(HM_RESOURCEID)); 4877 break; 4880 4878 4881 4879 case IDM_HELPGENERAL: 4882 4883 4884 4880 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4881 MPFROM2SHORT(HELP_MAIN, 0), MPFROMSHORT(HM_RESOURCEID)); 4882 break; 4885 4883 case IDM_HELPKEYS: 4886 4887 4888 4884 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4885 MPFROM2SHORT(HELP_KEYS, 0), MPFROMSHORT(HM_RESOURCEID)); 4886 break; 4889 4887 4890 4888 case IDM_HELP: 4891 4889 case IDM_HELPCONTENTS: 4892 4893 4890 WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID); 4891 break; 4894 4892 4895 4893 case IDM_HELPUSERLIST: 4896 4897 4898 4899 4894 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4895 MPFROM2SHORT(HELP_USERLISTS, 0), 4896 MPFROMSHORT(HM_RESOURCEID)); 4897 break; 4900 4898 } 4901 4899 } … … 4908 4906 case IDM_ABOUT: 4909 4907 WinDlgBox(HWND_DESKTOP, hwnd, AboutDlgProc, FM3ModHandle, 4910 4908 ABT_FRAME, MPVOID); 4911 4909 break; 4912 4910 … … 4922 4920 4923 4921 if (!DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_MINOR, 4924 4925 4926 4927 4928 4929 4930 4922 (PVOID) & version, (ULONG) sizeof(version))) { 4923 if (version[0] > 20L || (version[0] == 20L && version[1] > 29L)) { 4924 if (SHORT1FROMMP(mp1) == IDM_HICOLORPALETTE) 4925 palette = "<WP_HIRESCLRPAL>"; 4926 else 4927 palette = "<WP_LORESCLRPAL>"; 4928 } 4931 4929 } 4932 4930 OpenObject(palette, Default, hwnd); … … 4944 4942 hWPSObject = WinQueryObject("<WP_SCHPAL>"); 4945 4943 if (hWPSObject != NULLHANDLE) 4946 4947 4948 4949 4944 WinSetObjectData(hWPSObject, "SCHEMES=Winter:PM_Winter," 4945 "Spring:PM_Spring,Summer:PM_Summer," 4946 "System:PM_System,Windows:PM_Windows;" 4947 "OPEN=DEFAULT"); 4950 4948 } 4951 4949 break; … … 4958 4956 case IDM_SYSINFO: 4959 4957 WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, SysInfoDlgProc, FM3ModHandle, 4960 4958 SYS_FRAME, NULL); 4961 4959 break; 4962 4960 #endif … … 4968 4966 4969 4967 if (hwndTree) 4970 4971 4972 4968 pci = (PCNRITEM) WinSendMsg(hwndTree, CM_QUERYRECORDEMPHASIS, 4969 MPFROMLONG(CMA_FIRST), 4970 MPFROMSHORT(CRA_CURSORED)); 4973 4971 if (pci && (INT) pci != -1) { 4974 4975 4972 strcpy(path, pci->pszFileName); 4973 MakeValidDir(path); 4976 4974 } 4977 4975 else 4978 4976 save_dir2(path); 4979 4977 WinDlgBox(HWND_DESKTOP, hwnd, InstantDlgProc, FM3ModHandle, 4980 4978 BAT_FRAME, MPFROMP(path)); 4981 4979 } 4982 4980 break; … … 4992 4990 TopWindowName(hwnd, (HWND) 0, path); 4993 4991 if (SHORT1FROMMP(mp1) == IDM_DOSCOMMANDLINE) 4994 4992 env = GetCmdSpec(TRUE); 4995 4993 else if (SHORT1FROMMP(mp1) != IDM_COMMANDLINE) { 4996 4997 4994 env = "WINOS2.COM"; 4995 type = SEPARATE | FULLSCREEN; 4998 4996 } 4999 4997 runemf2(type, hwnd, pszSrcFile, __LINE__, 5000 4998 path, NULL, "%s", env); 5001 4999 } 5002 5000 break; … … 5004 5002 case IDM_KILLPROC: 5005 5003 WinDlgBox(HWND_DESKTOP, hwnd, KillDlgProc, FM3ModHandle, 5006 5004 KILL_FRAME, NULL); 5007 5005 break; 5008 5006 … … 5019 5017 case IDM_AUTOVIEW: 5020 5018 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 5021 5019 &fAutoView, TRUE, "AutoView"); 5022 5020 AutoChange: 5023 5021 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 5024 5022 MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5025 5023 if (fAutoView) { 5026 5024 … … 5031 5029 hwndDir = TopWindowName(hwnd, (HWND) 0, s); 5032 5030 if (hwndDir) { 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5031 hwndDir = WinWindowFromID(hwndDir, FID_CLIENT); 5032 if (hwndDir) { 5033 hwndDir = WinWindowFromID(hwndDir, DIR_CNR); 5034 if (hwndDir) { 5035 pci = (PCNRITEM) WinSendMsg(hwndDir, CM_QUERYRECORDEMPHASIS, 5036 MPFROMLONG(CMA_FIRST), 5037 MPFROMSHORT(CRA_CURSORED)); 5038 if (pci && (INT) pci != -1 && 5039 (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW))) 5040 WinSendMsg(hwnd, 5041 UM_LOADFILE, 5042 MPFROMP(pci->pszFileName), 5043 (SHORT1FROMMP(mp1) == IDM_AUTOVIEW) ? 5044 MPVOID : MPFROMLONG(1)); 5045 } 5046 } 5049 5047 } 5050 5048 } … … 5053 5051 case IDM_TEXTTOOLS: 5054 5052 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 5055 5053 &fTextTools, TRUE, "TextTools"); 5056 5054 BuildTools(hwndToolback, TRUE); 5057 5055 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 5058 5056 MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5059 5057 break; 5060 5058 5061 5059 case IDM_TOOLTITLES: 5062 5060 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 5063 5061 &fToolTitles, TRUE, "ToolTitles"); 5064 5062 BuildTools(hwndToolback, TRUE); 5065 5063 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 5066 5064 MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5067 5065 break; 5068 5066 … … 5072 5070 MenuInvisible = MenuInvisible ? FALSE : TRUE; 5073 5071 if (MenuInvisible) { 5074 5075 5076 5077 5072 WinSetParent(hwndMenu, HWND_OBJECT, FALSE); 5073 WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5074 FID_SYSMENU), IDM_HIDEMENU, 5075 GetPString(IDS_UNHIDEMENUTEXT)); 5078 5076 } 5079 5077 else { 5080 5081 5082 5083 5078 WinSetParent(hwndMenu, WinQueryWindow(hwnd, QW_PARENT), FALSE); 5079 WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5080 FID_SYSMENU), IDM_HIDEMENU, 5081 GetPString(IDS_HIDEMENUTEXT)); 5084 5082 } 5085 5083 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 5086 5084 MPFROMLONG(FCF_MENU), MPVOID); 5087 5085 PrfWriteProfileData(fmprof, FM3Str, "MenuInvisible", 5088 5086 &MenuInvisible, sizeof(BOOL)); 5089 5087 } 5090 5088 break; … … 5099 5097 5100 5098 if (Collector) 5101 5099 already = TRUE; 5102 5100 if (!already && !fAutoTile && !fExternalCollector) 5103 5101 GetNextWindowPos(hwnd, &swp, NULL, NULL); 5104 5102 hwndC = StartCollector(fExternalCollector ? HWND_DESKTOP : hwnd, 4); 5105 5103 if (hwndC) { 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5104 if (!already && !fAutoTile && !fExternalCollector) 5105 WinSetWindowPos(hwndC, HWND_TOP, 5106 swp.x, swp.y, swp.cx, swp.cy, 5107 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER); 5108 else if (fAutoTile && !already) 5109 TileChildren(hwnd, TRUE); 5110 WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE | 5111 SWP_ACTIVATE); 5112 if (SHORT1FROMMP(mp1) == IDM_GREP) 5113 PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND, 5114 MPFROM2SHORT(IDM_GREP, 0), MPVOID); 5115 if (SHORT1FROMMP(mp1) == IDM_SEEALL) 5116 PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND, 5117 MPFROM2SHORT(IDM_SEEALL, 0), MPVOID); 5120 5118 } 5121 5119 } … … 5128 5126 5129 5127 if (!toolhead || !toolhead->next) { 5130 5131 5128 firsttool = (toolhead) ? toolhead->id : 0; 5129 break; 5132 5130 } 5133 5131 tool = find_tool(firsttool); 5134 5132 if (!tool) 5135 5133 tool = toolhead; 5136 5134 if (SHORT1FROMMP(mp1) == IDM_TOOLRIGHT) { 5137 5138 5135 tool = prev_tool(tool, TRUE); 5136 firsttool = tool->id; 5139 5137 } 5140 5138 else { 5141 5142 5139 tool = next_tool(tool, TRUE); 5140 firsttool = tool->id; 5143 5141 } 5144 5142 ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5145 5143 MAIN_TOOLS)); 5146 5144 } 5147 5145 break; … … 5153 5151 case IDM_TOOLBAR: 5154 5152 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5155 5153 IDM_TOOLSUBMENU, &fToolbar, TRUE, "Toolbar"); 5156 5154 BuildTools(hwndToolback, TRUE); 5157 5155 WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5158 5156 MAIN_TOOLS), fToolbar); 5159 5157 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), 5160 5158 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5161 5159 if (fDrivebar) 5162 5160 WinInvalidateRect(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5163 5161 MAIN_DRIVES), NULL, TRUE); 5164 5162 break; 5165 5163 5166 5164 case IDM_DRIVEBAR: 5167 5165 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5168 5166 IDM_DRIVEBAR, &fDrivebar, TRUE, "Drivebar"); 5169 5167 WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5170 5168 MAIN_DRIVES), fDrivebar); 5171 5169 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 5172 5170 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5173 5171 PostMsg(hwnd, UM_BUILDDRIVEBAR, MPVOID, MPVOID); 5174 5172 break; … … 5176 5174 case IDM_USERLIST: 5177 5175 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5178 5176 SHORT1FROMMP(mp1), &fUserComboBox, TRUE, "UserComboBox"); 5179 5177 WinShowWindow(hwndUserlist, fUserComboBox); 5180 5178 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 5181 5179 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5182 5180 PostMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID); 5183 5181 PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID); … … 5191 5189 WinSetWindowText(hwndAttr, NullStr); 5192 5190 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5193 5191 SHORT1FROMMP(mp1), &fMoreButtons, TRUE, "MoreButtons"); 5194 5192 if (fMoreButtons) { 5195 5193 … … 5199 5197 5200 5198 if (hwndTemp) { 5201 5202 5199 WinSetFocus(HWND_DESKTOP, hwnd); 5200 WinSetFocus(HWND_DESKTOP, hwndTemp); 5203 5201 } 5204 5202 } 5205 5203 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 5206 5204 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5207 5205 break; 5208 5206 5209 5207 case IDM_TOGGLEDRAGDIALOG: 5210 5208 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5211 5212 5213 5214 5209 IDM_TOGGLEDRAGDIALOG, 5210 &fDragndropDlg, 5211 TRUE, 5212 "Drag&DropDlg"); 5215 5213 break; 5216 5214 5217 5215 case IDM_SYNCUPDATES: 5218 5216 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5219 5220 5221 5222 5217 IDM_SYNCUPDATES, 5218 &fSyncUpdates, 5219 TRUE, 5220 "SyncUpdates"); 5223 5221 break; 5224 5222 … … 5230 5228 WinQueryWindowPos(hwnd, &swp); 5231 5229 WinSetWindowPos(hwndTree, HWND_TOP, 0, swp.cy - swpT.cy, 0, 0, 5232 5230 SWP_MOVE); 5233 5231 } 5234 5232 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 5235 5233 &fFreeTree, TRUE, "FreeTree"); 5236 5234 if (fAutoTile) 5237 5235 TileChildren(hwnd, TRUE); … … 5240 5238 case IDM_AUTOTILE: 5241 5239 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5242 5240 SHORT1FROMMP(mp1), &fAutoTile, TRUE, "AutoTile"); 5243 5241 if (fAutoTile) 5244 5242 TileChildren(hwnd, TRUE); … … 5247 5245 case IDM_TILEBACKWARDS: 5248 5246 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5249 5247 SHORT1FROMMP(mp1), &fTileBackwards, TRUE, "TileBackwards"); 5250 5248 if (fAutoTile) 5251 5249 TileChildren(hwnd, TRUE); … … 5292 5290 default: 5293 5291 if (!SwitchCommand((HWND) WinQueryWindowULong(hwnd, QWL_USER), 5294 5292 SHORT1FROMMP(mp1))) { 5295 5293 if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART && 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5294 SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) { 5295 5296 INT x; 5297 HWND hwndCnr; 5298 5299 if (!cmdloaded) 5300 load_commands(); 5301 hwndCnr = TopWindow(hwnd, (HWND) 0); 5302 hwndCnr = (HWND) WinSendMsg(WinWindowFromID(hwndCnr, FID_CLIENT), 5303 UM_CONTAINERHWND, MPVOID, MPVOID); 5304 if (!hwndCnr) { 5305 Runtime_Error2(pszSrcFile, __LINE__, IDS_NOWINDOWTEXT); 5306 break; 5307 } 5308 x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART; 5309 if (x >= 0) { 5310 x++; 5311 RunCommand(hwndCnr, x); 5312 if (fUnHilite) { 5313 5314 PCNRITEM pci; 5315 DIRCNRDATA *dcd = NULL; 5316 5317 // 12 May 07 SHL fixme to understand? backwards maybe? looking for DIR_CNR? 5318 if (WinQueryWindowUShort(hwndCnr, QWS_ID) != TREE_CNR) 5319 dcd = INSTDATA(hwndCnr); 5320 pci = (PCNRITEM) WinSendMsg(hwndCnr, 5321 CM_QUERYRECORDEMPHASIS, 5322 MPFROMLONG(CMA_FIRST), 5323 MPFROMSHORT(CRA_CURSORED)); 5324 if (pci && (INT) pci != -1 && 5325 (pci->rc.flRecordAttr & CRA_SELECTED)) 5326 { 5327 UnHilite(hwnd, 5328 TRUE, 5329 dcd ? &dcd->lastselection : NULL, 5330 dcd ? dcd ->ulItemsToUnHilite : 0); 5331 } 5332 } 5333 } 5336 5334 } 5337 5335 else if (SHORT1FROMMP(mp1) >= IDM_QUICKTOOLSTART && 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5336 SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART + 50) { 5337 if (!qtloaded) 5338 load_quicktools(); 5339 if (quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]) { 5340 if (fToolsChanged) 5341 save_tools(NULL); 5342 if (!load_tools(quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART])) 5343 load_tools(NULL); 5344 else { 5345 strcpy(lasttoolbox, 5346 quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]); 5347 PrfWriteProfileString(fmprof, FM3Str, "LastToolBox", lasttoolbox); 5348 } 5349 BuildTools(hwndToolback, TRUE); 5350 } 5353 5351 } 5354 5352 else { 5355 5353 5356 5357 5358 5359 5360 5361 5354 HWND hwndActive; 5355 5356 hwndActive = TopWindow(hwnd, (HWND) 0); 5357 if (hwndActive) 5358 PostMsg(WinWindowFromID(hwndActive, FID_CLIENT), 5359 WM_COMMAND, mp1, mp2); 5362 5360 } 5363 5361 } … … 5368 5366 5369 5367 static MRESULT EXPENTRY MainWMOnce(HWND hwnd, ULONG msg, MPARAM mp1, 5370 5368 MPARAM mp2) 5371 5369 { 5372 5370 TID tid; … … 5391 5389 if (_beginthread(MakeMainObjWin, NULL, 245760, MPVOID) == -1) { 5392 5390 Runtime_Error(pszSrcFile, __LINE__, 5393 5391 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 5394 5392 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID); 5395 5393 return 0; … … 5410 5408 5411 5409 if (!WinCreateWindow(hwndFrame, 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5410 WC_BUTTON, 5411 "I", 5412 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, 5413 ((swp.cx - 5414 WinQuerySysValue(HWND_DESKTOP, 5415 SV_CXMINMAXBUTTON)) - 5416 WinQuerySysValue(HWND_DESKTOP, 5417 SV_CXMINMAXBUTTON) / 2) - 5418 WinQuerySysValue(HWND_DESKTOP, 5419 SV_CXSIZEBORDER), 5420 (swp.cy - WinQuerySysValue(HWND_DESKTOP, 5421 SV_CYMINMAXBUTTON)) - 5422 WinQuerySysValue(HWND_DESKTOP, 5423 SV_CYSIZEBORDER), 5424 WinQuerySysValue(HWND_DESKTOP, 5425 SV_CXMINMAXBUTTON) / 2, 5426 WinQuerySysValue(HWND_DESKTOP, 5427 SV_CYMINMAXBUTTON), 5428 hwnd, HWND_TOP, IDM_IDEALSIZE, NULL, NULL)) { 5431 5429 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5432 5430 } 5433 5431 else { 5434 5432 WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_IDEALSIZE), 5435 5433 IdealButtonProc); 5436 5434 SetPresParams(WinWindowFromID(hwndFrame, 5437 5438 5435 IDM_IDEALSIZE), 5436 NULL, NULL, NULL, GetPString(IDS_10SYSTEMVIOTEXT)); 5439 5437 } 5440 5438 5441 5439 hwndTmp = WinCreateWindow(hwndFrame, 5442 5443 5444 5445 5446 5447 5448 5449 5440 WC_BUTTON, 5441 "#1019", 5442 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS | 5443 BS_BITMAP, 5444 swp.cx - 46, 5445 swp.y + 2, 5446 24, 5447 22, hwnd, HWND_TOP, IDM_OPENWALK, NULL, NULL); 5450 5448 if (!hwndTmp) 5451 5449 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5452 5450 5453 5451 hwndTmp = WinCreateWindow(hwndFrame, 5454 5455 5456 5457 5458 5459 5460 5461 5452 WC_BUTTON, 5453 "#3062", 5454 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS | 5455 BS_BITMAP, 5456 swp.cx - 22, 5457 swp.y + 2, 5458 24, 5459 22, hwnd, HWND_TOP, IDM_USERLIST, NULL, NULL); 5462 5460 if (!hwndTmp) 5463 5461 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5464 5462 5465 5463 hwndUserlist = WinCreateWindow(hwndFrame, 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5464 WC_COMBOBOX, 5465 (PSZ) NULL, 5466 WS_VISIBLE | CBS_DROPDOWN | 5467 LS_HORZSCROLL, 5468 (swp.x + 5469 WinQuerySysValue(HWND_DESKTOP, 5470 SV_CXSIZEBORDER) + 48L), 5471 (swp.cy - 5472 WinQuerySysValue(HWND_DESKTOP, 5473 SV_CYSIZEBORDER)) - 60, 5474 ((swp.cx - 5475 (WinQuerySysValue(HWND_DESKTOP, 5476 SV_CXSIZEBORDER) * 5477 2)) - 64L), 60L, hwndFrame, HWND_TOP, 5478 MAIN_USERLIST, NULL, NULL); 5481 5479 if (!hwndUserlist) 5482 5480 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5483 5481 hwndCmdlist = WinCreateWindow(hwndFrame, 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5482 WC_COMBOBOX, 5483 (PSZ) NULL, 5484 WS_VISIBLE | CBS_DROPDOWN | 5485 LS_HORZSCROLL, 5486 (swp.x + 5487 WinQuerySysValue(HWND_DESKTOP, 5488 SV_CXSIZEBORDER) + 48L), 5489 (swp.cy - 5490 WinQuerySysValue(HWND_DESKTOP, 5491 SV_CYSIZEBORDER)) - 60, 5492 ((swp.cx - 5493 (WinQuerySysValue(HWND_DESKTOP, 5494 SV_CXSIZEBORDER) * 2)) - 5495 64L), 60L, hwndFrame, HWND_TOP, 5496 MAIN_CMDLIST, NULL, NULL); 5499 5497 if (!hwndCmdlist) 5500 5498 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5501 5499 WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT)); 5502 5500 hwndStatelist = WinCreateWindow(hwndFrame, 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5501 WC_COMBOBOX, 5502 (PSZ) NULL, 5503 WS_VISIBLE | CBS_DROPDOWN | 5504 LS_HORZSCROLL, 5505 (swp.x + 5506 WinQuerySysValue(HWND_DESKTOP, 5507 SV_CXSIZEBORDER) + 48L), 5508 (swp.cy - 5509 WinQuerySysValue(HWND_DESKTOP, 5510 SV_CYSIZEBORDER)) - 60, 5511 ((swp.cx - 5512 (WinQuerySysValue(HWND_DESKTOP, 5513 SV_CXSIZEBORDER) * 5514 2)) - 64L), 60L, hwndFrame, HWND_TOP, 5515 MAIN_SETUPLIST, NULL, NULL); 5518 5516 if (!hwndStatelist) 5519 5517 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5520 5518 5521 5519 hwndDrivelist = WinCreateWindow(hwndFrame, 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5520 WC_COMBOBOX, 5521 (PSZ) NULL, 5522 WS_VISIBLE | CBS_DROPDOWN, 5523 (swp.x + 5524 WinQuerySysValue(HWND_DESKTOP, 5525 SV_CXSIZEBORDER)), 5526 (swp.cy - 5527 WinQuerySysValue(HWND_DESKTOP, 5528 SV_CYSIZEBORDER)) - 60, 5529 48L, 5530 60L, 5531 hwndFrame, 5532 HWND_TOP, MAIN_DRIVELIST, NULL, NULL); 5535 5533 if (!hwndDrivelist) 5536 5534 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5537 5535 SetPresParams(hwndDrivelist, 5538 5536 NULL, NULL, NULL, GetPString(IDS_10SYSTEMMONOTEXT)); 5539 5537 hwndButtonlist = WinCreateWindow(hwndFrame, 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5538 WC_COMBOBOX, 5539 (PSZ) NULL, 5540 WS_VISIBLE | CBS_DROPDOWN | 5541 LS_HORZSCROLL, 5542 (swp.cx - 5543 WinQuerySysValue(HWND_DESKTOP, 5544 SV_CXSIZEBORDER)) - 5545 164L, 5546 (swp.cy - 5547 WinQuerySysValue(HWND_DESKTOP, 5548 SV_CYSIZEBORDER)) - 60, 5549 164L, 60L, hwndFrame, HWND_TOP, 5550 MAIN_BUTTONLIST, NULL, NULL); 5553 5551 if (!hwndButtonlist) 5554 5552 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5555 5553 WinSendMsg(WinWindowFromID(hwndUserlist, CBID_EDIT), 5556 5554 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 5557 5555 WinSendMsg(WinWindowFromID(hwndStatelist, CBID_EDIT), 5558 5556 EM_SETTEXTLIMIT, MPFROM2SHORT(STATE_NAME_MAX_BYTES, 0), MPVOID); 5559 5557 WinSendMsg(WinWindowFromID(hwndDrivelist, CBID_EDIT), 5560 5558 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID); 5561 5559 WinSendMsg(WinWindowFromID(hwndButtonlist, CBID_EDIT), 5562 5560 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID); 5563 5561 WinSendMsg(WinWindowFromID(hwndCmdlist, CBID_EDIT), 5564 5562 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID); 5565 5563 5566 5564 oldproc = WinSubclassWindow(WinWindowFromID(hwndUserlist, CBID_EDIT), 5567 5565 DropDownListProc); 5568 5566 WinSetWindowPtr(WinWindowFromID(hwndUserlist, CBID_EDIT), 5569 5567 QWL_USER, (PVOID) oldproc); 5570 5568 oldproc = WinSubclassWindow(WinWindowFromID(hwndCmdlist, CBID_EDIT), 5571 5569 DropDownListProc); 5572 5570 WinSetWindowPtr(WinWindowFromID(hwndCmdlist, CBID_EDIT), 5573 5571 QWL_USER, (PVOID) oldproc); 5574 5572 oldproc = WinSubclassWindow(WinWindowFromID(hwndButtonlist, CBID_EDIT), 5575 5573 DropDownListProc); 5576 5574 WinSetWindowPtr(WinWindowFromID(hwndButtonlist, CBID_EDIT), 5577 5575 QWL_USER, (PVOID) oldproc); 5578 5576 oldproc = WinSubclassWindow(WinWindowFromID(hwndStatelist, CBID_EDIT), 5579 5577 DropDownListProc); 5580 5578 WinSetWindowPtr(WinWindowFromID(hwndStatelist, CBID_EDIT), 5581 5579 QWL_USER, (PVOID) oldproc); 5582 5580 oldproc = WinSubclassWindow(WinWindowFromID(hwndDrivelist, CBID_EDIT), 5583 5581 DropDownListProc); 5584 5582 WinSetWindowPtr(WinWindowFromID(hwndDrivelist, CBID_EDIT), 5585 5583 QWL_USER, (PVOID) oldproc); 5586 5584 oldproc = WinSubclassWindow(hwndUserlist, DropDownListProc); 5587 5585 WinSetWindowPtr(hwndUserlist, QWL_USER, (PVOID) oldproc); … … 5595 5593 WinSetWindowPtr(hwndButtonlist, QWL_USER, (PVOID) oldproc); 5596 5594 oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_USERLIST), 5597 5595 ChildFrameButtonProc); 5598 5596 WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_USERLIST), 5599 5597 QWL_USER, (PVOID) oldproc); 5600 5598 oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_OPENWALK), 5601 5599 ChildFrameButtonProc); 5602 5600 WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_OPENWALK), 5603 5601 QWL_USER, (PVOID) oldproc); 5604 5602 hwndMenu = WinWindowFromID(hwndFrame, FID_MENU); 5605 5603 WinSendMsg(hwnd, UM_ADDTOMENU, MPVOID, MPVOID); 5606 5604 SetToggleChecks(hwndMenu); 5607 CfgMenuInit(hwndMenu, FALSE); 5605 CfgMenuInit(hwndMenu, FALSE); // 14 Feb 08 SHL 5608 5606 SetConditionalCascade(hwndMenu, IDM_COMMANDLINESUBMENU, IDM_COMMANDLINE); 5609 5607 SetConditionalCascade(hwndMenu, IDM_TOOLSUBMENU, IDM_TOOLBAR); … … 5615 5613 hwndSysMenu = WinWindowFromID(hwndFrame, FID_SYSMENU); 5616 5614 idSysMenu = SHORT1FROMMR(WinSendMsg(hwndSysMenu, 5617 5618 5615 MM_ITEMIDFROMPOSITION, 5616 MPVOID, MPVOID)); 5619 5617 WinSendMsg(hwndSysMenu, 5620 5618 MM_QUERYITEM, MPFROM2SHORT(idSysMenu, 0), MPFROMP(&mit)); 5621 5619 hwndSysSubMenu = mit.hwndSubMenu; 5622 5620 mi.iPosition = MIT_END; … … 5627 5625 mi.id = IDM_IDEALSIZE; 5628 5626 WinSendMsg(hwndSysSubMenu, 5629 5630 5627 MM_INSERTITEM, 5628 MPFROMP(&mi), MPFROMP(GetPString(IDS_IDEALMENUTEXT))); 5631 5629 mi.afStyle = MIS_TEXT; 5632 5630 mi.id = IDM_HIDEMENU; 5633 5631 WinSendMsg(hwndSysSubMenu, 5634 5635 5632 MM_INSERTITEM, 5633 MPFROMP(&mi), MPFROMP(GetPString(IDS_HIDEMENUTEXT))); 5636 5634 SetSysMenu(hwndSysMenu); 5637 5635 5638 5636 size = sizeof(BOOL); 5639 5637 if (PrfQueryProfileData(fmprof, 5640 5641 5638 FM3Str, 5639 "MenuInvisible", &temp, &size) && size && temp) 5642 5640 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID); 5643 5641 size = sizeof(BOOL); 5644 5642 if (PrfQueryProfileData(fmprof, 5645 5643 FM3Str, "FreeTree", &temp, &size) && size && temp) 5646 5644 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_FREETREE, 0), MPVOID); 5647 5645 size = sizeof(BOOL); 5648 5646 if (PrfQueryProfileData(fmprof, 5649 5650 5647 FM3Str, 5648 "AutoTile", &temp, &size) && size && !temp) 5651 5649 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_AUTOTILE, 0), MPVOID); 5652 5650 size = sizeof(BOOL); 5653 5651 if (PrfQueryProfileData(fmprof, 5654 5652 FM3Str, "Toolbar", &temp, &size) && size && !temp) 5655 5653 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID); 5656 5654 … … 5677 5675 hwndTree = StartTreeCnr(hwnd, 4); 5678 5676 if (!hwndTree) 5679 5677 WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT)); 5680 5678 else { 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5679 if (!fSaveState || 5680 !PrfQueryProfileData(fmprof, 5681 FM3Str, 5682 "LastTreePos", 5683 &swp, &size) || size != sizeof(SWP)) { 5684 5685 INT ratio, height = 0; 5686 5687 if (!fNoTreeGap) 5688 height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2; 5689 size = sizeof(ratio); 5690 if (!PrfQueryProfileData(fmprof, 5691 FM3Str, 5692 "TreeWindowRatio", 5693 (PVOID) & ratio, 5694 &size) || size < sizeof(ratio)) 5695 ratio = 400; 5696 WinSetWindowPos(hwndTree, 5697 HWND_TOP, 5698 0, 5699 height, 5700 (swp.cx * 100) / ratio, 5701 swp.cy - height, 5702 SWP_SHOW | SWP_SIZE | SWP_MOVE | 5703 SWP_ACTIVATE | SWP_ZORDER); 5704 } 5705 else 5706 WinSetWindowPos(hwndTree, 5707 HWND_TOP, 5708 swp.x, 5709 swp.y, 5710 swp.cx, 5711 swp.cy, 5712 swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW | 5713 SWP_ZORDER | SWP_ACTIVATE); 5716 5714 } 5717 5715 ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5718 5716 MAIN_TOOLS)); 5719 5717 } 5720 5718 PostMsg(MainObjectHwnd, UM_SETUP3, mp1, mp2); … … 5727 5725 PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pStatename), MPVOID); 5728 5726 if (!add_setup(pStatename)) 5729 5727 save_setups(); 5730 5728 } 5731 5729 PostMsg(MainObjectHwnd, UM_SETUP4, mp1, mp2); … … 5738 5736 5739 5737 for (x = 1; x < argc; x++) { 5740 5741 5742 5743 5738 if (*argv[x] == '/' || *argv[x] == ';') 5739 continue; 5740 if (!IsFile(argv[x]) && !FindDirCnrByName(argv[x], FALSE)) 5741 OpenDirCnr((HWND) 0, hwndMain, hwndTree, TRUE, argv[x]); 5744 5742 } 5745 5743 } … … 5759 5757 hwndActive = TopWindow(hwnd, hwndTree); 5760 5758 if (hwndActive) 5761 5759 WinSetWindowPos(hwndActive, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE); 5762 5760 } 5763 5761 if (fStartMinimized || fReminimize) … … 5792 5790 case WM_CONTROLPOINTER: 5793 5791 if (!fNoFinger && 5794 5795 5792 (SHORT1FROMMP(mp1) == IDM_OPENWALK || 5793 SHORT1FROMMP(mp1) == IDM_USERLIST)) 5796 5794 return MRFROMLONG(hptrFinger); 5797 5795 break; … … 5833 5831 if (mp1) { 5834 5832 if (fUserComboBox) 5835 5836 5833 WinSetWindowText(WinWindowFromID(hwndUserlist, CBID_EDIT), 5834 (CHAR *)mp1); 5837 5835 if (add_udir(FALSE, (CHAR *)mp1)) { 5838 5839 5840 5841 5842 5836 if (fUserComboBox && fAutoAddDirs) { 5837 WinSendMsg(hwndUserlist, LM_INSERTITEM, 5838 MPFROM2SHORT(LIT_SORTASCENDING, 0), 5839 MPFROMP((CHAR *)mp1)); 5840 } 5843 5841 } 5844 5842 } … … 5872 5870 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp); 5873 5871 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) { 5874 5875 5876 5877 5872 WinStoreWindowPos(FM2Str, 5873 "MainWindowPos", WinQueryWindow(hwnd, QW_PARENT)); 5874 if (!fNoSaveState && fSaveState) 5875 SaveDirCnrState(hwnd, GetPString(IDS_SHUTDOWNSTATE)); 5878 5876 } 5879 5877 } … … 5885 5883 case 1: 5886 5884 { 5887 5888 5889 5890 5891 5892 5893 5894 5885 HWND hwndCurrent; 5886 ULONG wmsg; 5887 5888 wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU; 5889 hwndCurrent = TopWindow(hwnd, (HWND) 0); 5890 PortholeInit((HWND) WinSendMsg(WinWindowFromID(hwndCurrent, 5891 FID_CLIENT), wmsg, 5892 MPVOID, MPVOID), mp1, mp2); 5895 5893 } 5896 5894 break; … … 5910 5908 */ 5911 5909 { 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5910 HWND hwndMenu, hwndSubMenu; 5911 MENUITEM mi; 5912 5913 hwndMenu = WinQueryWindowULong(hwnd, QWL_USER); 5914 memset(&mi, 0, sizeof(mi)); 5915 mi.iPosition = MIT_END; 5916 mi.afStyle = MIS_TEXT; 5917 if (!WinSendMsg(hwndMenu, MM_QUERYITEM, 5918 MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi))) 5919 break; 5920 hwndSubMenu = mi.hwndSubMenu; 5921 SetupWinList(hwndSubMenu, hwnd, WinQueryWindow(hwnd, QW_PARENT)); 5924 5922 } 5925 5923 break; … … 5927 5925 default: 5928 5926 { 5929 5930 5931 5932 5933 5927 HWND hwndCurrent; 5928 5929 hwndCurrent = TopWindow(hwnd, (HWND) 0); 5930 if (hwndCurrent) 5931 WinSendMsg(hwndCurrent, UM_INITMENU, mp1, mp2); 5934 5932 } 5935 5933 break; … … 5939 5937 case UM_ADDTOMENU: 5940 5938 AddToMenu((CHAR *)mp1, WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5941 5939 FID_MENU)); 5942 5940 return 0; 5943 5941 … … 5952 5950 info = cmdhead; 5953 5951 while (info) { 5954 5955 5956 5952 WinSendMsg(hwndCmdlist, LM_INSERTITEM, 5953 MPFROM2SHORT(LIT_END, 0), MPFROMP(info->title)); 5954 info = info->next; 5957 5955 } 5958 5956 } … … 5978 5976 ulSearchCount = 1; 5979 5977 if (!DosFindFirst("*.TLS", &hDir, FILE_READONLY | FILE_ARCHIVED, 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 5978 &findbuf, sizeof(FILEFINDBUF3), 5979 &ulSearchCount, FIL_STANDARD)) { 5980 do { 5981 priority_bumped(); 5982 if (!foundit) { 5983 thisone = FALSE; 5984 p = strrchr(lasttoolbox, '\\'); 5985 if (!p) 5986 p = lasttoolbox; 5987 else 5988 p++; 5989 if (!stricmp(findbuf.achName, p)) 5990 thisone = TRUE; 5991 } 5992 p = strrchr(findbuf.achName, '.'); 5993 if (p) 5994 *p = 0; 5995 sSelect = (SHORT) WinSendMsg(hwndButtonlist, LM_INSERTITEM, 5996 MPFROM2SHORT(LIT_SORTASCENDING, 0), 5997 MPFROMP(findbuf.achName)); 5998 if (!foundit && thisone && sSelect >= 0) { 5999 WinSendMsg(hwndButtonlist, LM_SELECTITEM, 6000 MPFROM2SHORT(sSelect, 0), MPFROMLONG(TRUE)); 6001 foundit = TRUE; 6002 } 6003 } 6004 while (!DosFindNext(hDir, &findbuf, sizeof(FILEFINDBUF3), 6005 &ulSearchCount)); 6006 DosFindClose(hDir); 6007 priority_bumped(); 6010 6008 } 6011 6009 WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBOXTEXT)); … … 6026 6024 6027 6025 if (!loadedudirs) 6028 6026 load_udirs(); 6029 6027 DosError(FERR_DISABLEHARDERR); 6030 6028 DosQCurDisk(&ulDriveNum, &ulDriveMap); 6031 6029 info = udirhead; 6032 6030 while (info) { 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6031 if (IsFullName(info->path) && 6032 !(driveflags[toupper(*info->path) - 'A'] & 6033 (DRIVE_IGNORE | DRIVE_INVALID))) { 6034 DosError(FERR_DISABLEHARDERR); 6035 hDir = HDIR_CREATE; 6036 ulSearchCount = 1; 6037 if (!IsRoot(info->path)) 6038 rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY | 6039 MUST_HAVE_DIRECTORY | FILE_READONLY | 6040 FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN, 6041 &findbuf, sizeof(FILEFINDBUF3), 6042 &ulSearchCount, FIL_STANDARD); 6043 else { 6044 rc = 0; 6045 findbuf.attrFile = FILE_DIRECTORY; 6046 } 6047 priority_bumped(); 6048 if (!rc) { 6049 if (!IsRoot(info->path)) 6050 DosFindClose(hDir); 6051 if (findbuf.attrFile & FILE_DIRECTORY) 6052 WinSendMsg(hwndUserlist, LM_INSERTITEM, 6053 MPFROM2SHORT(LIT_SORTASCENDING, 0), 6054 MPFROMP(info->path)); 6055 else { 6056 temp = info->next; 6057 remove_udir(info->path); 6058 info = temp; 6059 continue; 6060 } 6061 } 6062 else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) { 6063 temp = info->next; 6064 remove_udir(info->path); 6065 info = temp; 6066 continue; 6067 } 6068 } 6069 info = info->next; 6072 6070 } 6073 6071 info = ldirhead; 6074 6072 while (info) { 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6073 if (IsFullName(info->path) && 6074 !(driveflags[toupper(*info->path) - 'A'] & 6075 (DRIVE_IGNORE | DRIVE_INVALID))) { 6076 DosError(FERR_DISABLEHARDERR); 6077 hDir = HDIR_CREATE; 6078 ulSearchCount = 1; 6079 if (!IsRoot(info->path)) 6080 rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY | 6081 MUST_HAVE_DIRECTORY | FILE_READONLY | 6082 FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN, 6083 &findbuf, sizeof(FILEFINDBUF3), 6084 &ulSearchCount, FIL_STANDARD); 6085 else { 6086 rc = 0; 6087 findbuf.attrFile = FILE_DIRECTORY; 6088 } 6089 priority_bumped(); 6090 if (!rc) { 6091 if (!IsRoot(info->path)) 6092 DosFindClose(hDir); 6093 if (findbuf.attrFile & FILE_DIRECTORY) 6094 WinSendMsg(hwndUserlist, LM_INSERTITEM, 6095 MPFROM2SHORT(LIT_SORTASCENDING, 0), 6096 MPFROMP(info->path)); 6097 else { 6098 temp = info->next; 6099 remove_udir(info->path); 6100 info = temp; 6101 continue; 6102 } 6103 } 6104 else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) { 6105 temp = info->next; 6106 remove_udir(info->path); 6107 info = temp; 6108 continue; 6109 } 6110 } 6111 info = info->next; 6114 6112 } 6115 6113 WinSendMsg(hwndUserlist, LM_INSERTITEM, 6116 6117 6114 MPFROM2SHORT(0, 0), 6115 MPFROMP(GetPString(IDS_NEWDIRECTORYTEXT))); 6118 6116 WinSetWindowText(hwndUserlist, GetPString(IDS_COMMONDIRTEXT)); 6119 6117 } … … 6129 6127 case WM_SIZE: 6130 6128 ResizeChildren(hwnd, SHORT1FROMMP(mp1), SHORT2FROMMP(mp1), 6131 6129 SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)); 6132 6130 break; 6133 6131 … … 6143 6141 hps = WinBeginPaint(hwnd, (HPS) 0, NULL); 6144 6142 if (hps) { 6145 6146 6147 6143 WinQueryWindowRect(hwnd, &rcl); 6144 WinFillRect(hps, &rcl, CLR_PALEGRAY); 6145 WinEndPaint(hps); 6148 6146 } 6149 6147 } … … 6159 6157 switch (SHORT2FROMMP(mp1)) { 6160 6158 case CBN_ENTER: 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 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 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 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 MPFROMLONG(1));// Autotile6261 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 6159 { 6160 HWND hwndUL = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 6161 SHORT1FROMMP(mp1)); 6162 CHAR path[CCHMAXPATH]; 6163 ULONG ul; 6164 6165 switch (SHORT1FROMMP(mp1)) { 6166 case MAIN_USERLIST: 6167 ul = CCHMAXPATH; 6168 break; 6169 case MAIN_SETUPLIST: 6170 ul = STATE_NAME_MAX_BYTES; 6171 break; 6172 default: 6173 ul = 13; // fixme to not be hardcoded 6174 } 6175 6176 SetShiftState(); 6177 WinQueryWindowText(WinWindowFromID(hwndUL, CBID_EDIT), ul, path); 6178 bstrip(path); 6179 if (*path) { 6180 if (SHORT1FROMMP(mp1) == MAIN_USERLIST) { 6181 if (!strcmp(path, GetPString(IDS_NEWDIRECTORYTEXT))) { 6182 if (!LastDir || 6183 !WinSendMsg(WinQueryWindow(LastDir, QW_PARENT), 6184 UM_CONTAINERDIR, MPFROMP(path), MPVOID)) 6185 save_dir2(path); 6186 if (!PMMkDir(hwnd, path, TRUE)) { 6187 WinSetWindowText(hwndUL, GetPString(IDS_COMMONDIRTEXT)); 6188 break; 6189 } 6190 } 6191 if (!IsFile(path) && !FindDirCnrByName(path, TRUE)) { 6192 6193 HWND hwndDir; 6194 6195 if ((fUserListSwitches && 6196 !(shiftstate & KC_SHIFT)) || 6197 (!fUserListSwitches && (shiftstate & KC_SHIFT))) { 6198 hwndDir = FindDirCnr(hwnd); 6199 if (hwndDir) { 6200 WinSendMsg(LastDir, UM_SETDIR, MPFROMP(path), MPVOID); 6201 break; 6202 } 6203 } 6204 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, path); 6205 } 6206 } 6207 else if (SHORT1FROMMP(mp1) == MAIN_DRIVELIST) { 6208 ShowTreeRec(WinWindowFromID(WinWindowFromID(hwndTree, 6209 FID_CLIENT), 6210 TREE_CNR), path, FALSE, TRUE); 6211 WinSetFocus(HWND_DESKTOP, hwndTree); 6212 } 6213 else if (SHORT1FROMMP(mp1) == MAIN_BUTTONLIST) { 6214 strcat(path, ".TLS"); 6215 load_tools(path); 6216 PrfWriteProfileString(fmprof, 6217 FM3Str, "LastToolBox", lasttoolbox); 6218 BuildTools(hwndToolback, TRUE); 6219 WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBOXTEXT)); 6220 } 6221 else if (SHORT1FROMMP(mp1) == MAIN_SETUPLIST) { 6222 CHAR szKey[80]; 6223 ULONG size, numsaves = 0; 6224 6225 SetShiftState(); 6226 size = sizeof(ULONG); 6227 sprintf(szKey, "%s.NumDirsLastTime", path); // path is state name 6228 if (!PrfQueryProfileData(fmprof, 6229 FM3Str, 6230 szKey, 6231 (PVOID)&numsaves, 6232 &size)) 6233 { 6234 if ((WinGetLastError(WinQueryAnchorBlock(hwnd)) & 0xffff) == PMERR_NOT_IN_IDX) { 6235 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, 6236 GetPString(IDS_WARNINGTEXT), 6237 GetPString(IDS_DOESNTEXISTTEXT), path); 6238 } 6239 else { 6240 Win_Error2(hwnd, hwnd, __FILE__, __LINE__, 6241 IDS_PRFQUERYPROFILEDATA); 6242 } 6243 } 6244 else if (!numsaves) 6245 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 6246 else { 6247 char *pszStateName; 6248 if ((shiftstate & KC_SHIFT) == 0) 6249 PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2)); 6250 pszStateName = xstrdup(path, pszSrcFile, __LINE__); 6251 if (!pszStateName) { 6252 // Fall back if out of memory - already complained 6253 if ((shiftstate & KC_SHIFT) != 0 || fAutoTile) { 6254 // Autotile requested or forced 6255 PostMsg(MainObjectHwnd, 6256 UM_RESTORE, 6257 MPVOID, 6258 MPFROMLONG(1)); // Autotile 6259 } 6260 } 6261 else if (!PostMsg(MainObjectHwnd, 6262 UM_RESTORE, 6263 MPFROMP(pszStateName), 6264 MPVOID)) { 6265 xfree(pszStateName, pszSrcFile, __LINE__); 6266 } 6267 } 6268 } 6269 else if (SHORT1FROMMP(mp1) == MAIN_CMDLIST) { 6270 6271 SHORT sSelect; 6272 6273 sSelect = (SHORT) WinSendMsg(hwndCmdlist, 6274 LM_QUERYSELECTION, 6275 MPFROMSHORT(LIT_FIRST), MPVOID); 6276 if (sSelect >= 0) 6277 WinPostMsg(hwnd, 6278 WM_COMMAND, 6279 MPFROM2SHORT(IDM_COMMANDSTART + sSelect, 0), 6280 MPVOID); 6281 WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT)); 6282 } 6283 } 6284 } 6285 break; 6288 6286 6289 6287 default: 6290 6288 break; 6291 6289 } 6292 6290 break; … … 6308 6306 case WM_CLOSE: 6309 6307 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), 6310 6308 WM_SYSCOMMAND, MPFROM2SHORT(SC_RESTORE, 0), MPVOID); 6311 6309 WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID); 6312 6310 fAmClosing = TRUE; 6313 6311 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), 6314 6312 WM_SYSCOMMAND, MPFROM2SHORT(SC_MINIMIZE, 0), MPVOID); 6315 6313 if (CloseChildren(hwnd)) { 6316 6314 fAmClosing = FALSE; 6317 6315 if (fAutoTile) 6318 6316 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TILE, 0), MPVOID); 6319 6317 return 0; 6320 6318 } 6321 6319 if (hwndTree) { 6322 6320 if (!PostMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID)) 6323 6321 WinSendMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID); 6324 6322 } 6325 6323 DosSleep(1); … … 6335 6333 // Try to restore saved shutdown state 6336 6334 char *pszDefaultStateName = xstrdup(GetPString(IDS_SHUTDOWNSTATE), 6337 6335 pszSrcFile, __LINE__); 6338 6336 if (pszDefaultStateName) { 6339 6340 6341 6337 if (!PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszDefaultStateName), MPVOID)) 6338 // 05 Feb 08 SHL fixme to complain? 6339 xfree(pszDefaultStateName, pszSrcFile, __LINE__); 6342 6340 } 6343 6341 } … … 6348 6346 if (mp1) 6349 6347 return MRFROMLONG(OpenDirCnr((HWND) 0, 6350 6351 6348 hwndMain, 6349 hwndTree, (BOOL) mp2, (char *)mp1)); 6352 6350 return 0; 6353 6351 -
trunk/dll/walkem.c
r1025 r1027 27 27 29 Feb 08 GKY Use xfree where appropriate 28 28 29 Feb 08 GKY Refactor global command line variables to notebook.h 29 19 Jun 08 JBS Ticket 227: Allow temporary saving/deleting of the shutdown state of directory containers 29 30 30 31 ***********************************************************************/ … … 93 94 MPFROMP(pld->path)); 94 95 } 95 // if (fSaveState) {96 // WinSendMsg(hwndStatelist,97 // LM_INSERTITEM,98 // MPFROM2SHORT(LIT_SORTASCENDING, 0),99 // MPFROMP(GetPString(IDS_SHUTDOWNSTATE)));100 // }101 96 WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT)); 102 97 }
Note:
See TracChangeset
for help on using the changeset viewer.