Changeset 1209 for trunk/dll/mainwnd.c
- Timestamp:
- Sep 13, 2008, 8:51:06 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/mainwnd.c
r1181 r1209 59 59 07 Jul 08 JBS Ticket 242: Delete obsolete INI keys when re-saving a state 60 60 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating 61 62 61 all the details view settings (both the global variables and those in the 62 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS. 63 63 12 Jul 08 JBS Ticket 246: Allow saved directory container states to have no directory containers 64 64 (i.e. just a directory tree container). 65 65 18 Jul 08 SHL Use new Fortify feature to avoid spurious reports 66 66 19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory … … 75 75 #include <string.h> 76 76 #include <ctype.h> 77 #include <process.h> 77 #include <process.h> // _beginthread 78 78 79 79 #define INCL_DOS 80 80 #define INCL_WIN 81 #define INCL_SHLERRORS 81 #define INCL_SHLERRORS // PMERR_NOT_IN_IDX 82 82 #define INCL_WINHELP 83 83 #define INCL_GPI … … 85 85 86 86 #include "fm3dll.h" 87 #include "grep.h" // Data declaration(s) 88 #include "autoview.h" // Data declaration(s) 89 #include "dircnrs.h" // Data declaration(s) 90 #include "info.h" // Data declaration(s) 91 #include "defview.h" // Data declaration(s) 92 #include "init.h" // Data declaration(s) 87 93 #include "fm3dlg.h" 88 94 #include "fm3str.h" … … 90 96 #include "comp.h" 91 97 #include "datamin.h" 92 #include "pathutil.h" 93 #include "errutil.h" 94 #include "strutil.h" 95 #include "notebook.h" 96 #include "command.h" 97 #include "avl.h" 98 #include "walkem.h" 99 #include "key.h" 100 #include "menu.h" 98 #include "pathutil.h" // BldQuotedFileName 99 #include "errutil.h" // Dos_Error... 100 #include "strutil.h" // GetPString 101 #include "notebook.h" // CfgDlgProc CfgMenuInit 102 #include "command.h" // LINKCMDS 103 #include "avl.h" // free_archivers 104 #include "walkem.h" // free_setups... 105 #include "key.h" // AboutDlgProc 106 #include "menu.h" // AddToMenu 101 107 #include "mainwnd.h" 102 #include "cmdline.h" 103 #include "common.h" 104 105 #include "notify.h" 106 #include "draglist.h" 107 #include "chklist.h" 108 #include "avv.h" 109 #include "assoc.h" 110 #include "fm2cmd.h" 111 #include "misc.h" 112 113 114 115 #include "instant.h" 116 #include "killproc.h" 117 #include "loadbmp.h" 118 #include "presparm.h" 119 #include "treecnr.h" 120 #include "inis.h" 121 #include "sysinfo.h" 122 #include "viewinf.h" 123 #include "walkem.h" 124 125 126 #include "winlist.h" 127 #include "cmdline.h" 128 #include "assoc.h" 129 #include "droplist.h" 130 #include "common.h" 131 #include "presparm.h" 132 #include "systemf.h" 133 #include "shadow.h" 134 #include "mkdir.h" 135 #include "collect.h" 136 #include "select.h" 137 #include "strips.h" 138 #include "commafmt.h" 139 #include "valid.h" 140 #include "dirs.h" 141 #include "wrappers.h" 108 #include "cmdline.h" // CmdLine2DlgProc, save_cmdlines 109 #include "common.h" // CommonCreateMainChildren, CommonDriveCmd, CommonMainWndProc 110 // CommonTextButton 111 #include "notify.h" // DoNotify, HideNote, ShowNote 112 #include "draglist.h" // DragOne 113 #include "chklist.h" // DropListProc 114 #include "avv.h" // EditArchiverDefinition 115 #include "assoc.h" // EditAssociations 116 #include "fm2cmd.h" // FM2Command 117 #include "misc.h" // FindDirCnr, FixSwitchList, PaintSTextWindow, 118 // SetConditionalCascade, SetMenuCheck, SetSysMenu 119 // SwitchCommand, CheckMenu, DrawTargetEmphasis 120 // IsFm2Window 121 #include "instant.h" // InstantDlgProc 122 #include "killproc.h" // KillDlgProc 123 #include "loadbmp.h" // LoadBitmapFromFileNum 124 #include "presparm.h" // SavePresParams 125 #include "treecnr.h" // ShowTreeRec, StartTreeCnr 126 #include "inis.h" // StartIniEditor 127 #include "sysinfo.h" // SysInfoDlgProc 128 #include "viewinf.h" // ViewInfProc 129 #include "walkem.h" // WalkDlgProc, WalkTwoCmpDlgProc, add_setup, add_udir 130 // fill_setups_list, free_ldir, free_udirs, load_udirs 131 // remove_setup, remove_udir, save_setups, save_udirs 132 #include "winlist.h" // WindowList 133 #include "cmdline.h" // add_cmdline 134 #include "assoc.h" // free_associations 135 #include "droplist.h" // AcceptOneDrop, CheckPmDrgLimit, DropHelp, GetOneDrop 136 #include "common.h" // CommonTextProc 137 #include "presparm.h" // CopyPresParams 138 #include "systemf.h" // ExecOnList 139 #include "shadow.h" // OpenObject 140 #include "mkdir.h" // PMMkDir 141 #include "collect.h" // StartCollector 142 #include "select.h" // UnHilite 143 #include "strips.h" // bstrip 144 #include "commafmt.h" // CommaFmtULL 145 #include "valid.h" // IsFullName 146 #include "dirs.h" // save_dir2 147 #include "wrappers.h" // xfree 142 148 #include "fortify.h" 143 144 #pragma data_seg(DATA1)145 146 static PSZ pszSrcFile = __FILE__;147 148 static USHORT firsttool = 0;149 149 150 150 static BOOL CloseDirCnrChildren(HWND hwndClient); … … 153 153 static VOID BuildTools(HWND hwndT, BOOL resize); 154 154 155 // Data definitions 156 #pragma data_seg(GLOBAL1) 157 ULONG DriveLines; 158 HWND MainObjectHwnd; 159 HWND MainPopupMenu; 160 BOOL MenuInvisible; 161 PFNWP PFNWPButton; 162 PFNWP PFNWPStatic; 163 BOOL fAmClosing; 164 BOOL fAutoTile; 165 BOOL fAutoView; 166 BOOL fComments; 167 BOOL fDrivebar; 168 BOOL fFreeTree; 169 BOOL fMoreButtons; 170 BOOL fNoFinger; 171 BOOL fNoSaveState; 172 BOOL fNoTileUpdate; 173 BOOL fRunning; 174 BOOL fSplitStatus; 175 BOOL fTextTools; 176 BOOL fToolTitles; 177 BOOL fToolbar; 178 BOOL fUserComboBox; 179 HBITMAP hbmLEDoff; 180 HBITMAP hbmLEDon; 181 HPOINTER hptrFinger; 182 HWND hwndAutoview; 183 HWND hwndBubble; 184 HWND hwndName; 185 HWND hwndStatelist; 186 HWND hwndToolback; 187 HWND hwndTree; 188 USHORT shiftstate; 189 190 #pragma data_seg(GLOBAL2) 191 HMODULE FM3ModHandle; 192 CHAR *FM3Str; 193 RGB2 RGBGREY; 194 195 #pragma data_seg(DATA1) 196 197 static PSZ pszSrcFile = __FILE__; 198 static USHORT firsttool = 0; 199 static HWND hwndButtonlist; 200 static HWND hwndCmdlist; 201 static HWND hwndDrivelist; 202 static HWND hwndUserlist; 203 204 155 205 static MRESULT EXPENTRY MainObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1, 156 206 MPARAM mp2) 157 207 { 158 208 switch (msg) { … … 183 233 *dv = 0; 184 234 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwndB, QW_PARENT), 185 235 id + 50), sizeof(dv), dv); 186 236 d = toupper(*dv); 187 237 if (isalpha(d) && d > 'B' && 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 238 !(driveflags[d - 'A'] & (DRIVE_CDROM | DRIVE_INVALID | 239 DRIVE_SLOW)) && 240 (!hwndBubble || 241 WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) && 242 !WinQueryCapture(HWND_DESKTOP)) { 243 244 FSALLOCATE fsa; 245 CHAR s[90], szQty[38]; 246 ULONG ulPctFree; 247 ULONGLONG ullFreeQty; 248 249 if (!DosQueryFSInfo((d - 'A') + 1, 250 FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) { 251 ullFreeQty = (ULONGLONG) fsa.cUnitAvail * 252 (fsa.cSectorUnit * fsa.cbSector); 253 ulPctFree = (fsa.cUnit && fsa.cUnitAvail) ? 254 (fsa.cUnitAvail * 100) / fsa.cUnit : 0; 255 CommaFmtULL(szQty, sizeof(szQty), ullFreeQty, ' '); 256 sprintf(s, "%s (%lu%%) free", szQty, ulPctFree); 257 } 258 if ((!hwndBubble || 259 WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) && 260 !WinQueryCapture(HWND_DESKTOP)) 261 WinSendMsg(hwndB, UM_SETUP6, MPFROMP(s), MPVOID); 212 262 } 213 263 } … … 220 270 221 271 if (DosQuerySysInfo(QSV_BOOT_DRIVE, 222 223 224 272 QSV_BOOT_DRIVE, 273 (PVOID) & bd, (ULONG) sizeof(ULONG))) 274 bd = 3L; 225 275 *s = (CHAR) bd + '@'; 226 276 WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPFROMLONG(1)); 227 277 if (!mp1) { 228 229 278 s[3] = 0; 279 WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPVOID); 230 280 } 231 281 PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMLONG(1), MPFROMLONG(1)); … … 285 335 DosError(FERR_DISABLEHARDERR); 286 336 WinRegisterClass(hab2, 287 288 337 (PSZ) WC_OBJECTWINDOW, 338 MainObjectWndProc, 0, sizeof(PVOID)); 289 339 MainObjectHwnd = WinCreateWindow(HWND_OBJECT, 290 291 292 293 294 295 296 297 340 WC_OBJECTWINDOW, 341 (PSZ) NULL, 342 0, 343 0L, 344 0L, 345 0L, 346 0L, 347 0L, HWND_TOP, OBJ_FRAME, NULL, NULL); 298 348 if (!MainObjectHwnd) 299 300 349 Win_Error2(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__, 350 IDS_WINCREATEWINDOW); 301 351 else { 302 303 # 304 305 # 306 307 308 309 # 310 311 # 352 WinSetWindowPtr(MainObjectHwnd, QWL_USER, args); 353 # ifdef FORTIFY 354 Fortify_EnterScope(); 355 # endif 356 while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0)) 357 WinDispatchMsg(hab2, &qmsg2); 358 WinDestroyWindow(MainObjectHwnd); 359 # ifdef FORTIFY 360 Fortify_LeaveScope(); 361 # endif 312 362 } 313 363 WinDestroyMsgQueue(hmq2); … … 318 368 319 369 static MRESULT EXPENTRY IdealButtonProc(HWND hwnd, ULONG msg, MPARAM mp1, 320 370 MPARAM mp2) 321 371 { 322 372 switch (msg) { … … 338 388 while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) { 339 389 if (hwndC != exclude) { 340 341 342 390 id = WinQueryWindowUShort(hwndC, QWS_ID); 391 if (id) 392 break; 343 393 } 344 394 } … … 360 410 henum = WinBeginEnumWindows(hwndMain); 361 411 while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) { 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 412 // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu",hwndTree,exclude,hwndC); 413 if (hwndC != exclude && hwndC != hwndTree) { 414 id = WinQueryWindowUShort(hwndC, QWS_ID); 415 if (id) { 416 hwndClient = WinWindowFromID(hwndC, FID_CLIENT); 417 if (hwndClient) { 418 hwndDir = WinWindowFromID(hwndClient, DIR_CNR); 419 if (hwndDir) { 420 if (fLookInDir) { 421 pci = (PCNRITEM) WinSendMsg(hwndDir, 422 CM_QUERYRECORDEMPHASIS, 423 MPFROMLONG(CMA_FIRST), 424 MPFROMSHORT(CRA_CURSORED)); 425 if (pci && (INT) pci != -1) 426 break; 427 } 428 if (WinSendMsg(hwndClient, 429 UM_CONTAINERDIR, MPFROMP(ret), MPVOID)) { 430 MakeValidDir(ret); 431 // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu\r\"%s\"",hwndTree,exclude,hwndC,ret); 432 WinEndEnumWindows(henum); 433 return hwndC; 434 } 435 } 436 } 437 } 438 } 389 439 } 390 440 WinEndEnumWindows(henum); 391 441 if (!pci || (INT) pci == -1) { 392 393 394 395 396 397 398 442 hwndC = hwndTree; 443 pci = (PCNRITEM) WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree, 444 FID_CLIENT), 445 TREE_CNR), 446 CM_QUERYRECORDEMPHASIS, 447 MPFROMLONG(CMA_FIRST), 448 MPFROMSHORT(CRA_CURSORED)); 399 449 } 400 450 if (pci && (INT) pci != -1) { 401 402 451 strcpy(ret, pci->pszFileName); 452 MakeValidDir(ret); 403 453 } 404 454 else 405 455 strcpy(ret, pFM2SaveDirectory); 406 456 } 407 457 } … … 421 471 hwndDir = WinWindowFromID(hwndC, DIR_CNR); 422 472 if (hwndDir) 423 473 ret++; 424 474 } 425 475 } … … 439 489 hwndC = WinWindowFromID(hwndF, FID_CLIENT); 440 490 if (hwndC) { 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 491 hwndDir = WinWindowFromID(hwndC, DIR_CNR); 492 if (hwndDir) { 493 *retstr = 0; 494 WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(retstr), MPVOID); 495 if (*retstr && !stricmp(retstr, directory)) { 496 if (restore) 497 WinSetWindowPos(hwndF, 498 HWND_TOP, 499 0, 500 0, 501 0, 502 0, 503 SWP_RESTORE | SWP_SHOW | 504 SWP_ACTIVATE | SWP_ZORDER); 505 break; 506 } 507 } 458 508 } 459 509 } … … 522 572 while (tool) { 523 573 if (!(tool->flags & T_INVISIBLE)) { 524 525 526 527 528 529 530 531 532 533 534 574 swp[x].x = butx; 575 if (fTextTools || (tool->flags & T_TEXT)) { 576 butx += 55L; 577 swp[x].cx = 54L; 578 swp[x].cy = 24L; 579 swp[x].y = 3L; 580 } 581 else 582 butx += 33L; 583 if (tool->flags & T_SEPARATOR) 584 butx += 12; 535 585 } 536 586 else 537 587 swp[x].fl = noattrib; 538 588 swp[x].hwnd = WinWindowFromID(hwnd, tool->id); 539 589 x++; … … 544 594 swp[x].x = butx; 545 595 if (!(tool->flags & T_INVISIBLE)) { 546 547 548 549 550 551 552 553 554 555 596 if (fTextTools || (tool->flags & T_TEXT)) { 597 butx += 55L; 598 swp[x].cx = 54L; 599 swp[x].cy = 24L; 600 swp[x].y = 3L; 601 } 602 else 603 butx += 33L; 604 if (tool->flags & T_SEPARATOR) 605 butx += 12; 556 606 } 557 607 else 558 608 swp[x].fl = noattrib; 559 609 swp[x].hwnd = WinWindowFromID(hwnd, tool->id); 560 610 x++; … … 564 614 if (!fTextTools && fToolTitles) { 565 615 for (x = 2L; x < numtools + 2L; x++) { 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 616 if (fTextTools || !fToolTitles) 617 swp[x].fl = noattrib; 618 else { 619 tool = find_tool(WinQueryWindowUShort(swp[x].hwnd, QWS_ID)); 620 if (tool && (tool->flags & T_TEXT)) 621 swp[x].fl = noattrib; 622 else { 623 swp[x].hwndInsertBehind = HWND_TOP; 624 swp[x].y = 1L; 625 swp[x].cy = 10L; 626 } 627 } 628 swp[x].hwnd = WinWindowFromID(hwnd, 629 WinQueryWindowUShort(swp[x].hwnd, 630 QWS_ID) + 25000); 581 631 } 582 632 WinSetMultWindowPos(WinQueryAnchorBlock(hwnd), &swp[2], numtools); … … 588 638 589 639 static MRESULT EXPENTRY DropDownListProc(HWND hwnd, ULONG msg, MPARAM mp1, 590 640 MPARAM mp2) 591 641 { 592 642 PFNWP oldproc = (PFNWP) INSTDATA(hwnd); … … 626 676 id = WinQueryWindowUShort(hwndParent, QWS_ID); 627 677 if (SHORT1FROMMP(mp2)) { 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 678 // If getting focus 1st time - save original accelerator 679 if (haccelSaved == NULLHANDLE) { 680 haccelSaved = WinQueryAccelTable(hab, hwndFrame); 681 if (haccelSaved == NULLHANDLE) 682 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryAccelTable"); 683 // else 684 // DbgMsg(pszSrcFile, __LINE__, "WinQueryAccelTable SAVED %x", haccelSaved); 685 } 686 if (haccelSaved != NULLHANDLE) { 687 switch (id) { 688 case MAIN_DRIVELIST: 689 if (haccelDriveList == NULLHANDLE) { 690 haccelDriveList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_DRIVELIST); 691 if (haccelDriveList == NULLHANDLE) 692 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 693 } 694 if (haccelDriveList != NULLHANDLE) { 695 if (!WinSetAccelTable(hab, haccelDriveList, hwndFrame)) 696 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 697 // else 698 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_DRIVELIST %x %x", hwndFrame, haccelDriveList); 699 } 700 break; 701 case MAIN_SETUPLIST: 702 if (haccelSetupList == NULLHANDLE) { 703 haccelSetupList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_SETUPLIST); 704 if (haccelSetupList == NULLHANDLE) 705 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 706 } 707 if (haccelSetupList != NULLHANDLE) { 708 if (!WinSetAccelTable(hab, haccelSetupList, hwndFrame)) 709 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 710 // else 711 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_SETUPLIST %x %x", hwndFrame, haccelSetupList); 712 } 713 break; 714 case MAIN_CMDLIST: 715 if (haccelCmdList == NULLHANDLE) { 716 haccelCmdList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_CMDLIST); 717 if (haccelCmdList == NULLHANDLE) 718 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 719 } 720 if (haccelCmdList != NULLHANDLE) { 721 if (!WinSetAccelTable(hab, haccelCmdList, hwndFrame)) 722 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 723 // else 724 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_CMDLIST %x %x", hwndFrame, haccelCmdList); 725 } 726 break; 727 case MAIN_USERLIST: 728 if (haccelUserList == NULLHANDLE) { 729 haccelUserList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_USERLIST); 730 if (haccelUserList == NULLHANDLE) 731 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 732 } 733 if (haccelUserList != NULLHANDLE) { 734 if (!WinSetAccelTable(hab, haccelUserList, hwndFrame)) 735 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 736 // else 737 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_USERLIST %x %x", hwndFrame, haccelUserList); 738 } 739 break; 740 case MAIN_BUTTONLIST: 741 if (haccelButtonList == NULLHANDLE) { 742 haccelButtonList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_BUTTONLIST); 743 if (haccelButtonList == NULLHANDLE) 744 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 745 } 746 if (haccelButtonList != NULLHANDLE) { 747 if (!WinSetAccelTable(hab, haccelButtonList, hwndFrame)) 748 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 749 // else 750 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_BUTTONLIST %x %x", hwndFrame, haccelButtonList); 751 } 752 break; 753 } // switch 754 } 705 755 } 706 756 else { 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 757 // Losing focus 758 switch (id) { 759 case MAIN_DRIVELIST: 760 case MAIN_SETUPLIST: 761 case MAIN_CMDLIST: 762 case MAIN_USERLIST: 763 case MAIN_BUTTONLIST: 764 if (haccelSaved != NULLHANDLE) { 765 if (!WinSetAccelTable(hab, haccelSaved, hwndFrame)) 766 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 767 // else 768 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable SAVED %x %x", hwndFrame, haccelSaved); 769 } 770 break; 771 } // switch 722 772 } 723 773 } … … 729 779 730 780 if (hwndMenu) 731 781 WinDestroyWindow(hwndMenu); 732 782 hwndMenu = (HWND) 0; 733 783 id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID); 734 784 switch (id) { 735 785 case MAIN_CMDLIST: 736 737 738 739 740 741 786 WinPostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 787 QW_PARENT), 788 QW_PARENT), 789 FID_CLIENT), 790 WM_COMMAND, MPFROM2SHORT(IDM_EDITCOMMANDS, 0), MPVOID); 791 break; 742 792 case MAIN_USERLIST: 743 793 case MAIN_SETUPLIST: 744 745 746 747 748 749 750 751 794 hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id); 795 if (hwndMenu) 796 PopupMenu(hwnd, 797 WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 798 QW_PARENT), 799 QW_PARENT), 800 FID_CLIENT), hwndMenu); 801 break; 752 802 default: 753 754 803 ret = FALSE; 804 break; 755 805 } // switch 756 806 return ret; … … 761 811 switch (SHORT1FROMMP(mp1)) { 762 812 case CBID_EDIT: 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 813 id = WinQueryWindowUShort(hwnd, QWS_ID); 814 switch (SHORT2FROMMP(mp1)) { 815 case EN_SETFOCUS: 816 switch (id) { 817 case MAIN_CMDLIST: 818 WinSetWindowText(hwndStatus2, GetPString(IDS_CMDLISTHELP)); 819 break; 820 case MAIN_SETUPLIST: 821 WinSetWindowText(hwndStatus2, GetPString(IDS_SETUPLISTHELP)); 822 break; 823 case MAIN_USERLIST: 824 WinSetWindowText(hwndStatus2, GetPString(IDS_USERLISTHELP)); 825 break; 826 case MAIN_DRIVELIST: 827 WinSetWindowText(hwndStatus2, GetPString(IDS_DRIVELISTHELP)); 828 break; 829 case MAIN_BUTTONLIST: 830 WinSetWindowText(hwndStatus2, GetPString(IDS_BUTTONLISTHELP)); 831 break; 832 default: 833 break; 834 } 835 break; 836 837 default: 838 break; 839 } 790 840 } 791 841 break; … … 800 850 // 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); 801 851 if (id == CBID_EDIT && 802 803 852 WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID) == 853 MAIN_USERLIST) { 804 854 805 855 CHAR path[CCHMAXPATH]; … … 810 860 // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Dragging: %s",path); 811 861 if (*path && !IsRoot(path)) 812 862 DragOne(hwnd, (HWND) 0, path, FALSE); 813 863 return 0; 814 864 } … … 819 869 if (id == MAIN_USERLIST) { 820 870 if (!emphasized) { 821 822 871 emphasized = TRUE; 872 DrawTargetEmphasis(hwnd, emphasized); 823 873 } 824 874 if (AcceptOneDrop(hwnd, mp1, mp2)) 825 875 return MRFROM2SHORT(DOR_DROP, DO_MOVE); 826 876 return MRFROM2SHORT(DOR_NEVERDROP, 0); 827 877 } … … 832 882 if (id == MAIN_USERLIST) { 833 883 if (emphasized) { 834 835 884 emphasized = FALSE; 885 DrawTargetEmphasis(hwnd, emphasized); 836 886 } 837 887 } … … 853 903 854 904 if (emphasized) { 855 856 905 emphasized = FALSE; 906 DrawTargetEmphasis(hwnd, emphasized); 857 907 } 858 908 if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) { 859 860 861 862 863 864 865 866 909 MakeValidDir(szFrom); 910 WinSetWindowText(hwnd, szFrom); 911 PostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 912 QW_PARENT), 913 QW_PARENT), 914 FID_CLIENT), 915 UM_COMMAND, MPFROM2SHORT(IDM_ADDTOUSERLIST, 0), MPVOID); 916 return 0; 867 917 } 868 918 } … … 885 935 (other && fOtherHelp) || (!other && !drive && fToolbarHelp))) { 886 936 if ((!hwndBubble || 887 888 937 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) && 938 !WinQueryCapture(HWND_DESKTOP)) 889 939 MakeBubble(hwnd, above, help); 890 940 } … … 907 957 /* don't bring up help if window isn't active */ 908 958 if (!WinIsChild(hwnd, hwndActive)) 909 959 return; 910 960 } 911 961 hwndActive = WinQueryFocus(HWND_DESKTOP); … … 913 963 /* don't bring up help if a menu is active */ 914 964 if (!strcmp(ucClassname, "#4")) 915 965 return; 916 966 } 917 967 } 918 968 919 969 hwndBubble = WinCreateWindow(HWND_DESKTOP, 920 921 922 923 924 925 926 927 928 970 WC_BUBBLE, 971 help, 972 WS_CLIPSIBLINGS | SS_TEXT | 973 DT_CENTER | DT_VCENTER, 974 0, 975 0, 976 0, 977 0, 978 HWND_DESKTOP, HWND_TOP, MAIN_HELP, NULL, NULL); 929 979 if (!hwndBubble) 930 980 Win_Error2(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, 931 981 IDS_WINCREATEWINDOW); 932 982 else { 933 983 HPS hps; … … 949 999 pp = strchr(p, '\r'); 950 1000 if (pp) { 951 952 953 1001 wp = pp; 1002 *pp = 0; 1003 pp++; 954 1004 } 955 1005 GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl); 956 1006 tptl.x = max(aptl[TXTBOX_TOPRIGHT].x, tptl.x); 957 1007 if (tptl.y) 958 1008 tptl.y += extra; 959 1009 else 960 1010 extra = aptl[TXTBOX_TOPLEFT].y / 4; 961 1011 tptl.y += aptl[TXTBOX_TOPLEFT].y; 962 1012 if (wp) 963 1013 *wp = '\r'; 964 1014 p = pp; 965 1015 } … … 971 1021 sy = ptl.y + swp.cy + 4; 972 1022 if (sy + tptl.y + 12 > lyScreen) { 973 974 1023 above = FALSE; 1024 sy = ptl.y - (tptl.y + 14); 975 1025 } 976 1026 } … … 988 1038 sy = ptl.y + swp.cy + 4; 989 1039 if (sy + tptl.y + 12 > lyScreen) 990 1040 sy = 0; 991 1041 } 992 1042 WinSetWindowPos(hwndBubble, HWND_TOP, sx, sy, 993 994 995 996 1043 tptl.x + 14, 1044 tptl.y + 12, 1045 SWP_DEACTIVATE | SWP_SHOW | SWP_ZORDER | 1046 SWP_MOVE | SWP_SIZE); 997 1047 } 998 1048 } … … 1020 1070 WinQueryPointerPos(HWND_DESKTOP, &ptl); 1021 1071 if (WinWindowFromPoint(HWND_DESKTOP, &ptl, TRUE) != 1022 1023 1072 WinQueryWindowULong(hwnd, QWL_USER) || !WinIsWindowVisible(hwnd)) 1073 WinDestroyWindow(hwnd); 1024 1074 } 1025 1075 return 0; … … 1035 1085 hps = WinBeginPaint(hwnd, (HPS) 0, NULL); 1036 1086 if (hps) { 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 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 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1087 WinQueryWindowPos(hwnd, &swp); 1088 GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, 0); 1089 GpiSetColor(hps, ((255 << 16) | (255 << 8) | 198)); 1090 GpiSetBackMix(hps, BM_LEAVEALONE); 1091 GpiSetMix(hps, FM_OVERPAINT); 1092 ptl.x = ptl.y = 0; 1093 GpiMove(hps, &ptl); 1094 ptl.x = swp.cx - 1; 1095 ptl.y = swp.cy - 1; 1096 GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0); 1097 tlen = WinQueryWindowTextLength(hwnd); 1098 if (tlen) { 1099 s = xmalloc(tlen + 2, pszSrcFile, __LINE__); 1100 if (s) { 1101 WinQueryWindowText(hwnd, tlen + 1, s); 1102 if (*s) { 1103 p = s; 1104 y = swp.cy - 3; 1105 extra = WinQueryWindowULong(hwnd, QWL_USER + 4); 1106 GpiSetColor(hps, 0); 1107 GpiSetMix(hps, FM_OVERPAINT); 1108 while (p && *p) { 1109 wp = NULL; 1110 pp = strchr(p, '\r'); 1111 if (pp) { 1112 wp = pp; 1113 *pp = 0; 1114 pp++; 1115 } 1116 GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl); 1117 ptl.x = 7; 1118 y -= aptl[TXTBOX_TOPLEFT].y; 1119 if (p != s) 1120 y -= extra; 1121 ptl.y = y; 1122 GpiCharStringAt(hps, &ptl, strlen(p), p); 1123 if (wp) 1124 *wp = '\r'; 1125 p = pp; 1126 } 1127 } 1128 free(s); 1129 } 1130 } 1131 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)) && swp.cx > 6 && swp.cy > 6) { 1132 GpiSetColor(hps, CLR_WHITE); 1133 ptl.x = 1; 1134 ptl.y = 1; 1135 GpiMove(hps, &ptl); 1136 ptl.y = swp.cy - 2; 1137 GpiLine(hps, &ptl); 1138 ptl.x = swp.cx - 2; 1139 GpiLine(hps, &ptl); 1140 ptl.x = 2; 1141 ptl.y = 2; 1142 GpiMove(hps, &ptl); 1143 ptl.y = swp.cy - 3; 1144 GpiLine(hps, &ptl); 1145 ptl.x = swp.cx - 3; 1146 GpiLine(hps, &ptl); 1147 GpiSetColor(hps, CLR_BROWN); 1148 ptl.x = 1; 1149 ptl.y = 1; 1150 GpiMove(hps, &ptl); 1151 ptl.x = swp.cx - 2; 1152 GpiLine(hps, &ptl); 1153 ptl.y = swp.cy - 2; 1154 GpiLine(hps, &ptl); 1155 ptl.x = 2; 1156 ptl.y = 2; 1157 GpiMove(hps, &ptl); 1158 ptl.x = swp.cx - 3; 1159 GpiLine(hps, &ptl); 1160 ptl.y = swp.cy - 3; 1161 GpiLine(hps, &ptl); 1162 } 1163 WinEndPaint(hps); 1114 1164 } 1115 1165 } … … 1138 1188 switch (WinQueryWindowUShort(hwnd, QWS_ID)) { 1139 1189 case MAIN_LED: 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1190 hps = WinGetPS(hwnd); 1191 hbmold = (HBITMAP) WinSendMsg(hwnd, SM_QUERYHANDLE, MPVOID, MPVOID); 1192 if (!fBlueLED) { 1193 hbmLEDon = GpiLoadBitmap(hps, 0, LEDON_BMP, 12, 12); 1194 hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF_BMP, 12, 12); 1195 } 1196 else { 1197 hbmLEDon = GpiLoadBitmap(hps, 0, LEDON2_BMP, 12, 12); 1198 hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF2_BMP, 12, 12); 1199 } 1200 if (hbmLEDoff && hbmLEDon) 1201 WinSendMsg(hwnd, SM_SETHANDLE, MPFROMLONG(hbmLEDoff), MPVOID); 1202 else { 1203 if (hbmLEDoff) 1204 GpiDeleteBitmap(hbmLEDoff); 1205 if (hbmLEDon) 1206 GpiDeleteBitmap(hbmLEDon); 1207 } 1208 if (hbmold && 1209 hbmLEDon && 1210 hbmLEDoff && hbmold != hbmLEDon && hbmold != hbmLEDoff) 1211 GpiDeleteBitmap(hbmold); 1212 if (hps) 1213 WinReleasePS(hps); 1214 break; 1165 1215 default: 1166 1167 1168 1169 1216 SetPresParams(hwnd, 1217 &RGBGREY, 1218 &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT)); 1219 break; 1170 1220 } 1171 1221 return mr; … … 1191 1241 case WM_BUTTON1CLICK: 1192 1242 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 1193 1243 WM_COMMAND, MPFROM2SHORT(IDM_SHOWNOTEWND, 0), MPVOID); 1194 1244 break; 1195 1245 1196 1246 case WM_BUTTON2CLICK: 1197 1247 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 1198 1248 WM_COMMAND, MPFROM2SHORT(IDM_HIDENOTEWND, 0), MPVOID); 1199 1249 break; 1200 1250 … … 1202 1252 case WM_BUTTON3CLICK: 1203 1253 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 1204 1254 WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID); 1205 1255 break; 1206 1256 } … … 1225 1275 if (fToolbarHelp) { 1226 1276 if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1277 && !WinQueryCapture(HWND_DESKTOP)) { 1278 id = WinQueryWindowUShort(hwnd, QWS_ID); 1279 tool = find_tool(id); 1280 if (tool && tool->help && *tool->help) { 1281 1282 char s[128]; 1283 1284 strcpy(s, tool->help); 1285 if (tool->flags & T_DROPABLE) 1286 strcat(s, GetPString(IDS_DROPONMETEXT)); 1287 MakeBubble(hwnd, FALSE, s); 1288 } 1239 1289 } 1240 1290 } … … 1245 1295 case IDM_HELP: 1246 1296 if (hwndHelp) 1247 1248 1249 1297 WinSendMsg(hwndHelp, 1298 HM_DISPLAY_HELP, 1299 MPFROM2SHORT(HELP_TOOLBAR, 0), MPFROMSHORT(HM_RESOURCEID)); 1250 1300 break; 1251 1301 … … 1253 1303 case IDM_HIDETOOL: /* hide tool */ 1254 1304 if (SHORT1FROMMP(mp1) == IDM_HIDETOOL) 1255 1305 id = WinQueryWindowUShort(hwnd, QWS_ID); 1256 1306 else 1257 1258 1259 1307 id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, 1308 PickToolProc, FM3ModHandle, 1309 PICKBTN_FRAME, GetPString(IDS_HIDETEXT)); 1260 1310 if (id) { 1261 1262 1263 1311 tool = find_tool(id); 1312 if (tool) { 1313 tool->flags |= T_INVISIBLE; 1264 1314 save_tools(NULL); 1265 1315 } 1266 1316 } 1267 1317 break; … … 1270 1320 tool = toolhead; 1271 1321 while (tool) { 1272 1273 1322 tool->flags &= (~T_INVISIBLE); 1323 tool = tool->next; 1274 1324 } 1275 1325 save_tools(NULL); … … 1279 1329 case IDM_DELETETOOL: /* delete button */ 1280 1330 if (SHORT1FROMMP(mp1) == IDM_DELETETOOL) 1281 1331 id = WinQueryWindowUShort(hwnd, QWS_ID); 1282 1332 else 1283 1284 1285 1333 id = 1334 (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle, 1335 PICKBTN_FRAME, GetPString(IDS_DELETETEXT)); 1286 1336 if (id) 1287 1337 PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_SETUP, 1288 1338 MPFROM2SHORT(id, 0), MPVOID); 1289 1339 return 0; … … 1292 1342 case IDM_EDITTOOL: /* edit button */ 1293 1343 if (SHORT1FROMMP(mp1) == IDM_EDITTOOL) 1294 1344 id = WinQueryWindowUShort(hwnd, QWS_ID); 1295 1345 else 1296 1297 1298 1346 id = 1347 (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle, 1348 PICKBTN_FRAME, GetPString(IDS_EDITTEXT)); 1299 1349 if (id) { 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1350 tool = find_tool(id); 1351 if (tool) { 1352 if (WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle, 1353 ADDBTN_FRAME, (PVOID) tool)) 1354 WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 1355 QW_PARENT), 1356 QW_PARENT), FID_CLIENT), 1357 WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0), 1358 MPFROM2SHORT(id, 0)); 1359 } 1310 1360 } 1311 1361 break; … … 1313 1363 case IDM_ADDTOOL: /* add tool */ 1314 1364 id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle, 1315 1365 ADDBTN_FRAME, MPVOID); 1316 1366 if (id && id != (USHORT) - 1) 1317 1318 1319 1320 1321 1367 WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 1368 QW_PARENT), 1369 QW_PARENT), FID_CLIENT), 1370 WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0), 1371 MPFROM2SHORT(id, 0)); 1322 1372 break; 1323 1373 1324 1374 case IDM_REORDERTOOLS: /* reorder tools */ 1325 1375 WinDlgBox(HWND_DESKTOP, 1326 1376 hwnd, ReOrderToolsProc, FM3ModHandle, RE_FRAME, MPVOID); 1327 1377 break; 1328 1378 … … 1330 1380 case IDM_LOADTOOLS: 1331 1381 if (WinDlgBox(HWND_DESKTOP, 1332 1333 1334 1335 1336 1337 1382 hwnd, 1383 ToolIODlgProc, 1384 FM3ModHandle, 1385 SVBTN_FRAME, 1386 (PVOID) (SHORT1FROMMP(mp1) == IDM_SAVETOOLS) ? 1387 "TRUE" : NULL)) 1338 1388 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 1339 1389 break; … … 1368 1418 tool = find_tool(id); 1369 1419 if (!tool) { 1370 1371 1420 DrgFreeDraginfo(pDInfo); 1421 return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */ 1372 1422 } 1373 1423 if (!(tool->flags & T_DROPABLE)) { 1374 1375 1424 DrgFreeDraginfo(pDInfo); 1425 return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */ 1376 1426 } 1377 1427 { 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1428 PDRAGITEM pDItem; /* Pointer to DRAGITEM */ 1429 1430 pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */ 1431 0); /* Index to DRAGITEM */ 1432 if (DrgVerifyRMF(pDItem, /* Check valid rendering */ 1433 DRM_OS2FILE, /* mechanisms and data */ 1434 NULL)) { /* formats */ 1435 if (!(tool->flags & T_EMPHASIZED)) { 1436 tool->flags |= T_EMPHASIZED; 1437 DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0)); 1438 DrgFreeDraginfo(pDInfo); 1439 } 1440 return (MRFROM2SHORT(DOR_DROP, /* Return okay to drop */ 1441 DO_MOVE)); /* Move operation valid */ 1442 } 1443 DrgFreeDraginfo(pDInfo); 1394 1444 } 1395 1445 } … … 1408 1458 if (tool && (tool->flags & T_DROPABLE)) { 1409 1459 if (tool->flags & T_EMPHASIZED) { 1410 1411 1460 tool->flags &= (~T_EMPHASIZED); 1461 DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0)); 1412 1462 } 1413 1463 } … … 1422 1472 1423 1473 if (tool->flags & T_EMPHASIZED) { 1424 1425 1474 DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0)); 1475 tool->flags &= (~T_EMPHASIZED); 1426 1476 } 1427 1477 memset(&cdi, 0, sizeof(cdi)); … … 1430 1480 CheckPmDrgLimit(cdi.pDragInfo); 1431 1481 if (li) { 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1482 li->type = id; 1483 if (!li->list || !li->list[0]) 1484 FreeListInfo(li); 1485 else { 1486 HWND hwndActive; 1487 1488 hwndActive = TopWindow(hwndMain, (HWND) 0); 1489 if (hwndActive) { 1490 if (!WinSendMsg(hwndActive, UM_COMMAND, MPFROMP(li), MPVOID)) 1491 FreeListInfo(li); 1492 } 1493 else 1494 FreeListInfo(li); 1495 } 1446 1496 } 1447 1497 } … … 1481 1531 if (!fTextTools) { 1482 1532 if (!(tool->flags & T_MYICON)) { 1483 1484 1485 1486 1487 1488 1489 1490 1491 1533 hwndTool = WinCreateWindow(hwndT, 1534 WC_TOOLBUTTONS, 1535 s, 1536 BS_NOPOINTERFOCUS | 1537 BS_BITMAP | BS_PUSHBUTTON, 1538 ctrlxpos, 1539 14, 1540 32, 1541 32, hwndT, HWND_TOP, tool->id, NULL, NULL); 1492 1542 } 1493 1543 if (!hwndTool) { 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1544 HBITMAP hbm = LoadBitmapFromFileNum(tool->id); 1545 1546 if (hbm) { 1547 BTNCDATA btc; 1548 1549 memset(&btc, 0, sizeof(btc)); 1550 btc.cb = sizeof(btc); 1551 btc.hImage = hbm; 1552 hwndTool = WinCreateWindow(hwndT, 1553 WC_TOOLBUTTONS, 1554 NullStr, 1555 BS_NOPOINTERFOCUS | 1556 BS_BITMAP | BS_PUSHBUTTON, 1557 ctrlxpos, 1558 14, 1559 32, 1560 32, 1561 hwndT, HWND_TOP, tool->id, &btc, NULL); 1562 if (!hwndTool) 1563 GpiDeleteBitmap(hbm); 1564 } 1515 1565 } 1516 1566 if (hwndTool) 1517 1567 tool->flags &= (~T_TEXT); 1518 1568 } 1519 1569 if (!hwndTool) { 1520 1570 hwndTool = WinCreateWindow(hwndT, 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1571 WC_TOOLBUTTONS, 1572 (!tool->text && tool->id >= IDM_COMMANDSTART 1573 && tool->id < 1574 IDM_QUICKTOOLSTART) ? command_title(tool-> 1575 id - 1576 IDM_COMMANDSTART) 1577 : tool->text, 1578 BS_NOPOINTERFOCUS | BS_PUSHBUTTON, ctrlxpos, 1579 2, 54, 24, hwndT, HWND_TOP, tool->id, NULL, 1580 NULL); 1531 1581 if (!hwndTool) 1532 1533 1582 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 1583 IDS_WINCREATEWINDOW); 1534 1584 tool->flags |= T_TEXT; 1535 1585 } 1536 1586 if (fToolTitles && !fTextTools) { 1537 1587 hwndTool = WinCreateWindow(hwndT, 1538 1539 1540 1541 1542 1543 1544 1545 1546 1588 WC_STATIC, 1589 tool->text, 1590 SS_TEXT | DT_LEFT | DT_VCENTER, 1591 ctrlxpos, 1592 1, 1593 32, 1594 10, 1595 hwndT, 1596 HWND_TOP, tool->id + 25000, NULL, NULL); 1547 1597 if (!hwndTool) 1548 1549 1598 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 1599 IDS_WINCREATEWINDOW); 1550 1600 else { 1551 1552 1553 1601 SetPresParams(hwndTool, 1602 &RGBGREY, 1603 &RGBBLACK, &RGBGREY, GetPString(IDS_2SYSTEMVIOTEXT)); 1554 1604 } 1555 1605 } 1556 1606 ctrlxpos += ((tool->flags & T_TEXT) ? 55L : 33L); 1557 1607 SetPresParams(WinWindowFromID(hwndT, tool->id), 1558 1608 NULL, NULL, NULL, GetPString(IDS_8HELVTEXT)); 1559 1609 tool = tool->next; 1560 1610 } // while tool 1561 1611 1562 1612 hwndTool = WinCreateWindow(hwndT, 1563 1564 1565 1566 1567 1568 1569 1570 1613 WC_BUTTON, 1614 "#6010", 1615 BS_NOPOINTERFOCUS | 1616 BS_BITMAP | BS_PUSHBUTTON, 1617 1, 1618 19, 1619 14, 1620 13, hwndT, HWND_TOP, IDM_TOOLLEFT, NULL, NULL); 1571 1621 if (!hwndTool) 1572 1622 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 1573 1623 IDS_WINCREATEWINDOW); 1574 1624 hwndTool = 1575 1625 WinCreateWindow(hwndT, WC_BUTTON, "#6011", 1576 1577 1626 BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON, 1, 4, 14, 1627 13, hwndT, HWND_TOP, IDM_TOOLRIGHT, NULL, NULL); 1578 1628 if (!hwndTool) 1579 1629 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 1580 1630 IDS_WINCREATEWINDOW); 1581 1631 if (resize) 1582 1632 ResizeTools(hwndT); … … 1584 1634 1585 1635 static MRESULT EXPENTRY CommandLineProc(HWND hwnd, ULONG msg, MPARAM mp1, 1586 1636 MPARAM mp2) 1587 1637 { 1588 1638 PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER); … … 1601 1651 1602 1652 if (WinQueryWindowUShort((HWND) mp1, QWS_ID) == COMMAND_BUTTON) 1603 1653 break; 1604 1654 if (!WinQueryWindowProcess((HWND) mp1, &pid, &tid) || pid == mypid) 1605 1655 WinDestroyWindow(hwnd); 1606 1656 } 1607 1657 break; … … 1613 1663 pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 1614 1664 if (pszCmdLine) { 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1665 lbup = TRUE; 1666 if (WinDlgBox(HWND_DESKTOP, 1667 hwnd, 1668 CmdLine2DlgProc, 1669 FM3ModHandle, EXEC2_FRAME, MPFROMP(pszCmdLine))) { 1670 lstrip(pszCmdLine); 1671 WinSetWindowText(hwnd, pszCmdLine); 1672 } 1673 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID); 1674 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID); 1675 free(pszCmdLine); 1626 1676 } 1627 1677 } … … 1640 1690 case COMMAND_BUTTON: 1641 1691 if (!lbup) 1642 1692 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 1643 1693 break; 1644 1694 } … … 1659 1709 bstrip(cl + len); 1660 1710 if (strlen(cl) > len) { 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1711 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), 1712 UM_SETUP, MPFROMP(cl + len), MPVOID); 1713 WinQueryWindowText(hwndStatus, CCHMAXPATH, directory); 1714 bstrip(directory); 1715 if (*directory && (IsRoot(directory) || !IsFile(directory))) { 1716 if (!FM2Command(directory, cl + len)) { 1717 hwndCnr = TopWindow(hwndMain, (HWND) 0); 1718 if (hwndCnr) { 1719 hwndCnr = WinWindowFromID(hwndCnr, FID_CLIENT); 1720 if (hwndCnr) { 1721 hwndCnr = WinWindowFromID(hwndCnr, DIR_CNR); 1722 if (hwndCnr) 1723 list = BuildList(hwndCnr); 1724 } 1725 } 1726 WinSetActiveWindow(HWND_DESKTOP, hwndCnr); 1727 if (add_cmdline(cl + len, FALSE) && fSaveMiniCmds) 1728 save_cmdlines(FALSE); 1729 ExecOnList(hwndCnr, 1730 cl, 1731 WINDOWED | ((fKeepCmdLine) ? 1732 SEPARATEKEEP : SEPARATE), 1733 directory, list, NULL, pszSrcFile, __LINE__); 1734 xfree(list, pszSrcFile, __LINE__); 1735 WinDestroyWindow(hwnd); 1736 break; 1737 } 1738 } 1689 1739 } 1690 1740 WinSendMsg(hwnd, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID); … … 1695 1745 if (!lbup && !(SHORT1FROMMP(mp1) & KC_KEYUP)) { 1696 1746 if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) { 1697 1698 1699 1700 1701 1702 1747 if ((SHORT1FROMMP(mp2) & 255) == '\r') 1748 PostMsg(hwnd, UM_OPENWINDOWFORME, MPVOID, MPVOID); 1749 else if ((SHORT1FROMMP(mp2) & 0xff) == 0x1b) 1750 WinDestroyWindow(hwnd); 1751 else if (SHORT2FROMMP(mp2) == VK_UP || SHORT2FROMMP(mp2) == VK_DOWN) 1752 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 1703 1753 } 1704 1754 } 1705 1755 else if ((SHORT1FROMMP(mp1) & KC_VIRTUALKEY) && 1706 1707 1708 1756 ((SHORT2FROMMP(mp2) == VK_UP || 1757 SHORT2FROMMP(mp2) == VK_DOWN) || 1758 (SHORT1FROMMP(mp2) == '\x1b') || (SHORT1FROMMP(mp2) == '\r'))) 1709 1759 return 0; 1710 1760 break; … … 1732 1782 rgb.bRed = (BYTE)128; 1733 1783 SetPresParams(hwnd, 1734 1784 &RGBGREY, &rgb, &RGBGREY, GetPString(IDS_8HELVTEXT)); 1735 1785 SetTargetDir(hwnd, TRUE); 1736 1786 } … … 1762 1812 case WM_CONTROLPOINTER: 1763 1813 if (!fNoFinger && 1764 1765 1814 (SHORT1FROMMP(mp1) >= IDM_DRIVEA && 1815 SHORT1FROMMP(mp1) < IDM_DRIVEA + 26)) 1766 1816 return MRFROMLONG(hptrFinger); 1767 1817 break; … … 1773 1823 *dv = 0; 1774 1824 WinQueryWindowText(WinWindowFromID(hwnd, SHORT1FROMMP(mp1) + 50), 1775 1825 2, dv); 1776 1826 if (isalpha(*dv)) { 1777 1827 1778 1779 1780 1781 1782 1783 1784 1785 1786 1828 HWND hwndActive; 1829 1830 dv[1] = ':'; 1831 dv[2] = '\\'; 1832 dv[3] = 0; 1833 hwndActive = TopWindow(hwnd, (HWND) 0); 1834 if (hwndActive) 1835 WinSendMsg(WinWindowFromID(hwndActive, FID_CLIENT), 1836 UM_DRIVECMD, MPFROMP(dv), MPVOID); 1787 1837 } 1788 1838 } … … 1812 1862 case WM_MOUSEMOVE: 1813 1863 if (fDrivebarHelp && 1814 1815 1816 1864 (!hwndBubble || 1865 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) && 1866 !WinQueryCapture(HWND_DESKTOP)) { 1817 1867 id = WinQueryWindowUShort(hwnd, QWS_ID); 1818 1868 if (helpid != id) { 1819 1820 1869 helpid = id; 1870 PostMsg(MainObjectHwnd, UM_SETUP6, MPFROMLONG((ULONG) hwnd), MPVOID); 1821 1871 } 1822 1872 else 1823 1873 helpid = 0; 1824 1874 } 1825 1875 break; … … 1828 1878 if (helpid == WinQueryWindowUShort(hwnd, QWS_ID)) { 1829 1879 if ((char *)mp1 && 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1880 (!hwndBubble || 1881 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) && 1882 !WinQueryCapture(HWND_DESKTOP)) { 1883 1884 RECTL rcl; 1885 POINTL ptl; 1886 1887 WinQueryPointerPos(HWND_DESKTOP, &ptl); 1888 WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1); 1889 WinQueryWindowRect(hwnd, &rcl); 1890 if (WinPtInRect(WinQueryAnchorBlock(hwnd), &rcl, &ptl)) 1891 BubbleHelp(hwnd, FALSE, TRUE, FALSE, (char *)mp1); 1842 1892 } 1843 1893 } … … 1858 1908 *szDrv = 0; 1859 1909 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1860 1910 id + 50), sizeof(szDrv), szDrv); 1861 1911 if (isalpha(*szDrv)) { 1862 1912 hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, MAIN_DRIVES); 1863 1913 if (hwndMenu) { 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1914 BOOL rdy; 1915 CHAR chDrv = *szDrv; 1916 UINT iDrv; 1917 1918 strcpy(szDrv + 2, "\\"); 1919 MakeValidDir(szDrv); 1920 // Disable menus if MakeValidDir changes drive letter fixme this section doesn't do anything see treecnt.c 1921 rdy = toupper(*szDrv) == toupper(chDrv); 1922 iDrv = toupper(*szDrv) - 'A'; 1923 if (!rdy || ~driveflags[iDrv] & DRIVE_REMOTE) 1924 WinEnableMenuItem(hwndMenu, IDM_DETACH, FALSE); 1925 1926 if (!rdy || driveflags[iDrv] & DRIVE_NOTWRITEABLE) { 1927 WinEnableMenuItem(hwndMenu, IDM_MKDIR, FALSE); 1928 WinEnableMenuItem(hwndMenu, IDM_FORMAT, FALSE); 1929 WinEnableMenuItem(hwndMenu, IDM_OPTIMIZE, FALSE); 1930 WinEnableMenuItem(hwndMenu, IDM_UNDELETE, FALSE); 1931 } 1932 if (!rdy || ~driveflags[iDrv] & DRIVE_REMOVABLE) { 1933 WinEnableMenuItem(hwndMenu, IDM_EJECT, FALSE); 1934 WinEnableMenuItem(hwndMenu, IDM_LOCK, FALSE); 1935 WinEnableMenuItem(hwndMenu, IDM_UNLOCK, FALSE); 1936 } 1937 if (!rdy) { 1938 WinEnableMenuItem(hwndMenu, IDM_INFO, FALSE); 1939 WinEnableMenuItem(hwndMenu, IDM_ARCHIVE, FALSE); 1940 WinEnableMenuItem(hwndMenu, IDM_SIZES, FALSE); 1941 WinEnableMenuItem(hwndMenu, IDM_SHOWALLFILES, FALSE); 1942 WinEnableMenuItem(hwndMenu, IDM_CHKDSK, FALSE); 1943 } 1944 /* fixme to be gone? 1945 if (!rdy || ~driveflags[iDrv] & DRIVE_CDROM) { 1946 WinEnableMenuItem(hwndMenu, IDM_CLOSETRAY, FALSE); 1947 } 1948 */ 1949 PopupMenu(hwnd, hwnd, hwndMenu); 1900 1950 } 1901 1951 } … … 1912 1962 *szDrv = 0; 1913 1963 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1914 1964 id + 50), sizeof(szDrv), szDrv); 1915 1965 if (isalpha(*szDrv)) { 1916 1966 strcat(szDrv, "\\"); 1917 1967 if (!FindDirCnrByName(szDrv, TRUE)) 1918 1968 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szDrv); 1919 1969 } 1920 1970 break; … … 1928 1978 *szDrv = 0; 1929 1979 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1930 1980 id + 50), sizeof(szDrv), szDrv); 1931 1981 if (isalpha(*szDrv)) { 1932 1982 strcat(szDrv, "\\"); … … 1939 1989 *szDrv = 0; 1940 1990 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1941 1991 id + 50), sizeof(szDrv), szDrv); 1942 1992 if (isalpha(*szDrv) && 1943 1993 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) { 1944 1994 if (!emphasized) { 1945 1946 1995 emphasized = TRUE; 1996 DrawTargetEmphasis(hwnd, emphasized); 1947 1997 } 1948 1998 if (AcceptOneDrop(hwnd, mp1, mp2)) 1949 1999 return MRFROM2SHORT(DOR_DROP, DO_MOVE); 1950 2000 return MRFROM2SHORT(DOR_NEVERDROP, 0); 1951 2001 } … … 1956 2006 *szDrv = 0; 1957 2007 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1958 2008 id + 50), sizeof(szDrv), szDrv); 1959 2009 if (isalpha(*szDrv) && 1960 2010 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) { 1961 2011 if (emphasized) { 1962 1963 2012 emphasized = FALSE; 2013 DrawTargetEmphasis(hwnd, emphasized); 1964 2014 } 1965 2015 } … … 1970 2020 *szDrv = 0; 1971 2021 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1972 2022 id + 50), sizeof(szDrv), szDrv); 1973 2023 if (isalpha(*szDrv) && 1974 2024 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) { 1975 2025 DropHelp(mp1, mp2, hwnd, GetPString(IDS_DRIVEDROPHELP)); 1976 2026 return 0; … … 1982 2032 *szDrv = 0; 1983 2033 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1984 2034 id + 50), sizeof(szDrv), szDrv); 1985 2035 if (isalpha(*szDrv) && 1986 2036 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) { 1987 2037 1988 2038 CNRDRAGINFO cnd; … … 1991 2041 1992 2042 if (emphasized) { 1993 1994 2043 emphasized = FALSE; 2044 DrawTargetEmphasis(hwnd, emphasized); 1995 2045 } 1996 2046 memset(&cnd, 0, sizeof(cnd)); … … 1998 2048 cnd.pRecord = NULL; 1999 2049 li = DoFileDrop(hwnd, 2000 2001 2050 NULL, 2051 TRUE, MPFROM2SHORT(TREE_CNR, CN_DROP), MPFROMP(&cnd)); 2002 2052 CheckPmDrgLimit(cnd.pDragInfo); 2003 2053 if (li) { 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 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2054 strcpy(li->targetpath, szDrv); 2055 strcat(li->targetpath, "\\"); 2056 if (li->list && li->list[0] && IsRoot(li->list[0])) 2057 li->type = DO_LINK; 2058 else if (fDragndropDlg && (!*li->arcname || !li->info)) { 2059 2060 CHECKLIST cl; 2061 2062 memset(&cl, 0, sizeof(cl)); 2063 cl.size = sizeof(cl); 2064 cl.flags = li->type; 2065 cl.list = li->list; 2066 cl.cmd = li->type; 2067 cl.prompt = li->targetpath; 2068 li->type = WinDlgBox(HWND_DESKTOP, 2069 hwndMain, 2070 DropListProc, 2071 FM3ModHandle, DND_FRAME, MPFROMP(&cl)); 2072 if (li->type == DID_ERROR) 2073 Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__, 2074 "Drag & Drop Dialog"); 2075 if (!li->type) { 2076 FreeListInfo(li); 2077 return 0; 2078 } 2079 li->list = cl.list; 2080 if (!li->list || !li->list[0]) { 2081 FreeListInfo(li); 2082 return 0; 2083 } 2084 } 2085 else { 2086 if (!WinDlgBox(HWND_DESKTOP, 2087 hwndMain, 2088 WalkDlgProc, 2089 FM3ModHandle, 2090 WALK_FRAME, 2091 MPFROMP(li->targetpath)) || !*li->targetpath) { 2092 FreeListInfo(li); 2093 return 0; 2094 } 2095 } 2096 switch (li->type) { 2097 case DND_LAUNCH: 2098 strcat(li->targetpath, " %a"); 2099 ExecOnList(hwndMain, 2100 li->targetpath, PROMPT | WINDOWED, NULL, li->list, NULL, 2101 pszSrcFile, __LINE__); 2102 FreeList(li->list); 2103 li->list = NULL; 2104 break; 2105 case DO_LINK: 2106 if (fLinkSetsIcon) { 2107 li->type = IDM_SETICON; 2108 action = UM_MASSACTION; 2109 } 2110 else 2111 li->type = IDM_COMPARE; 2112 break; 2113 case DND_EXTRACT: 2114 if (*li->targetpath && !IsFile(li->targetpath)) 2115 li->type = IDM_EXTRACT; 2116 break; 2117 case DND_MOVE: 2118 li->type = IDM_MOVE; 2119 if (*li->targetpath && IsFile(li->targetpath) == 1) { 2120 action = UM_MASSACTION; 2121 li->type = IDM_ARCHIVEM; 2122 } 2123 break; 2124 case DND_WILDMOVE: 2125 li->type = IDM_WILDMOVE; 2126 if (*li->targetpath && IsFile(li->targetpath) == 1) { 2127 action = UM_MASSACTION; 2128 li->type = IDM_ARCHIVEM; 2129 } 2130 break; 2131 case DND_OBJECT: 2132 li->type = IDM_OBJECT; 2133 action = UM_MASSACTION; 2134 break; 2135 case DND_SHADOW: 2136 li->type = IDM_SHADOW; 2137 action = UM_MASSACTION; 2138 break; 2139 case DND_COMPARE: 2140 li->type = IDM_COMPARE; 2141 break; 2142 case DND_SETICON: 2143 action = UM_MASSACTION; 2144 li->type = IDM_SETICON; 2145 break; 2146 case DND_COPY: 2147 li->type = IDM_COPY; 2148 if (*li->targetpath && IsFile(li->targetpath) == 1) { 2149 action = UM_MASSACTION; 2150 li->type = IDM_ARCHIVE; 2151 } 2152 break; 2153 case DND_WILDCOPY: 2154 li->type = IDM_WILDCOPY; 2155 if (*li->targetpath && IsFile(li->targetpath) == 1) { 2156 action = UM_MASSACTION; 2157 li->type = IDM_ARCHIVE; 2158 } 2159 break; 2160 default: 2161 if (*li->arcname && li->info) { 2162 action = UM_MASSACTION; 2163 li->type = (li->type == DO_MOVE) ? IDM_FAKEEXTRACTM : 2164 IDM_FAKEEXTRACT; 2165 } 2166 else if (*li->targetpath && IsFile(li->targetpath) == 1) { 2167 action = UM_MASSACTION; 2168 li->type = (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE; 2169 } 2170 else 2171 li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY; 2172 break; 2173 } 2174 if (!li->list || !li->list[0]) 2175 FreeListInfo(li); 2176 else 2177 WinSendMsg(hwndTree, UM_ACTION, MPFROMP(li), MPFROMLONG(action)); 2128 2178 } 2129 2179 return 0; … … 2159 2209 for (x = 0; x < 26; x++) { 2160 2210 if ((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE)) { 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2211 if (x > 1) { 2212 if (driveflags[x] & DRIVE_CDROM) 2213 iconid = CDROM_ICON; 2214 else 2215 iconid = (driveflags[x] & DRIVE_REMOVABLE) ? 2216 REMOVABLE_ICON : 2217 (driveflags[x] & DRIVE_VIRTUAL) ? 2218 VIRTUAL_ICON : 2219 (driveflags[x] & DRIVE_REMOTE) ? 2220 REMOTE_ICON : 2221 (driveflags[x] & DRIVE_RAMDISK) ? 2222 RAMDISK_ICON : 2223 (driveflags[x] & DRIVE_ZIPSTREAM) ? 2224 ZIPSTREAM_ICON :DRIVE_ICON; 2225 } 2226 else 2227 iconid = FLOPPY_ICON; 2228 sprintf(s, "#%lu", iconid); 2229 hwndB = WinCreateWindow(hwndT, 2230 WC_DRIVEBUTTONS, 2231 s, 2232 BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON, 2233 0, 2234 0, 2235 28, 2236 18, 2237 hwndT, HWND_TOP, y + IDM_DRIVEA, NULL, NULL); 2238 if (!hwndB) 2239 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 2240 IDS_WINCREATEWINDOW); 2241 else { 2242 WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER); 2243 sprintf(s, "%c:", (CHAR) x + 'A'); 2244 hwndB = WinCreateWindow(hwndT, 2245 WC_STATIC, 2246 s, 2247 SS_TEXT | DT_LEFT | DT_VCENTER, 2248 0, 2249 0, 2250 10, 2251 18, 2252 hwndT, 2253 HWND_TOP, y + IDM_DRIVEATEXT, NULL, NULL); 2254 if (!hwndB) 2255 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 2256 IDS_WINCREATEWINDOW); 2257 else { 2258 SetPresParams(hwndB, 2259 &RGBGREY, 2260 &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT)); 2261 WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER); 2262 } 2263 y++; 2264 } 2215 2265 } 2216 2266 } // for 2217 2267 } // if drivebar 2218 2268 PostMsg(WinQueryWindow(hwndT, QW_PARENT), 2219 2269 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 2220 2270 } 2221 2271 … … 2233 2283 WinQueryWindowRect(hwndT, &rcl); 2234 2284 xwidth = rcl.xRight - ((WinQuerySysValue(HWND_DESKTOP, 2235 2285 SV_CYSIZEBORDER) * 2) + 2); 2236 2286 } 2237 2287 henum = WinBeginEnumWindows(hwndT); … … 2242 2292 ctrlxsize = 28; 2243 2293 WinSetWindowPos(hwndB, 2244 2245 2294 HWND_TOP, 2295 ctrlxpos, ctrlypos, ctrlxsize, 18, SWP_MOVE | SWP_SHOW); 2246 2296 ctrlxpos += (ctrlxsize + 2); 2247 2297 if (ctrlxsize == 10) { 2248 2298 if (ctrlxpos + (42 + ((fShowTarget && DriveLines == 0) ? 2249 2250 2251 2252 2299 256 : 0)) > xwidth) { 2300 ctrlxpos = 2; 2301 ctrlypos += 18; 2302 DriveLines++; 2253 2303 } 2254 2304 } … … 2269 2319 2270 2320 SetPresParams(hwnd, 2271 2272 2321 &RGBGREY, 2322 &RGBBLACK, &RGBGREY, GetPString(IDS_8HELVBOLDTEXT)); 2273 2323 return mr; 2274 2324 } … … 2280 2330 2281 2331 cbRetLen = WinQueryPresParam(hwnd, 2282 2283 2284 2285 2332 (ULONG) mp1, 2333 0, 2334 &AttrFound, 2335 (ULONG) sizeof(AttrValue), &AttrValue, 0); 2286 2336 if (cbRetLen) { 2287 2288 2337 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 2338 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 2289 2339 } 2290 2340 } … … 2303 2353 WinQueryWindowPos(hwndTree, &swp); 2304 2354 if (!(swp.fl & SWP_MAXIMIZE)) 2305 2355 fl |= SWP_RESTORE; 2306 2356 WinSetWindowPos(hwndTree, HWND_TOP, 0, 0, 0, 0, fl); 2307 2357 } … … 2336 2386 2337 2387 if (fOtherHelp) { 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2388 if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) 2389 && !WinQueryCapture(HWND_DESKTOP)) { 2390 switch (id) { 2391 case IDM_ATTRS: 2392 if (WinQueryWindowTextLength(hwnd)) 2393 s = GetPString(IDS_ATTRSBUTTONHELP); 2394 break; 2395 case IDM_INFO: 2396 if (WinQueryWindowTextLength(hwnd)) 2397 s = GetPString(IDS_INFOBUTTONHELP); 2398 break; 2399 case IDM_RENAME: 2400 if (WinQueryWindowTextLength(hwnd)) 2401 s = GetPString(IDS_NAMEBUTTONHELP); 2402 break; 2403 case MAIN_STATUS2: 2404 if (!hwndE) 2405 s = GetPString(IDS_STATUS2HELP); 2406 break; 2407 default: 2408 break; 2409 } 2410 if (s) 2411 MakeBubble(hwnd, FALSE, s); 2412 else if (hwndBubble) 2413 WinDestroyWindow(hwndBubble); 2414 } 2365 2415 } 2366 2416 switch (id) { … … 2369 2419 case IDM_RENAME: 2370 2420 case MAIN_STATUS2: 2371 2421 return CommonTextProc(hwnd, msg, mp1, mp2); 2372 2422 default: 2373 2423 break; 2374 2424 } 2375 2425 } … … 2394 2444 case IDM_RENAME: 2395 2445 case MAIN_STATUS2: 2396 2446 return CommonTextButton(hwnd, msg, mp1, mp2); 2397 2447 default: 2398 2399 2448 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID); 2449 break; 2400 2450 } 2401 2451 } … … 2409 2459 id = WinQueryWindowUShort(hwnd, QWS_ID); 2410 2460 if (id == MAIN_STATUS2 && hwndE) 2411 2461 WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 2412 2462 else 2413 2463 return CommonTextButton(hwnd, msg, mp1, mp2); 2414 2464 } 2415 2465 break; … … 2421 2471 id = WinQueryWindowUShort(hwnd, QWS_ID); 2422 2472 if (id == MAIN_STATUS) { 2423 2424 2425 2426 2427 2428 2473 if (SHORT2FROMMP(mp2) & KC_CTRL) 2474 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2475 FID_CLIENT), 2476 WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID); 2477 else if (hwndTree) 2478 PostMsg(hwndTree, UM_TIMER, MPVOID, MPVOID); 2429 2479 } 2430 2480 } … … 2439 2489 if (id == MAIN_STATUS2 && !hwndE) { 2440 2490 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2491 SWP swp; 2492 CHAR directory[CCHMAXPATH]; 2493 PFNWP oldproce; 2494 2495 *directory = 0; 2496 TopWindowName(hwndMain, (HWND) 0, directory); 2497 WinQueryWindowPos(hwnd, &swp); 2498 hwndB = WinCreateWindow(hwnd, 2499 WC_BUTTON, 2500 "+", 2501 WS_VISIBLE | BS_PUSHBUTTON | 2502 BS_NOPOINTERFOCUS, 2503 swp.cx - swp.cy, 2504 0, 2505 swp.cy, 2506 swp.cy, 2507 hwnd, HWND_TOP, COMMAND_BUTTON, NULL, NULL); 2508 if (!hwndB) 2509 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 2510 hwndE = WinCreateWindow(hwnd, 2511 WC_ENTRYFIELD, 2512 NULL, 2513 WS_VISIBLE | ES_AUTOSCROLL, 2514 0, 2515 0, 2516 swp.cx - swp.cy, 2517 swp.cy, 2518 hwnd, HWND_TOP, COMMAND_LINE, NULL, NULL); 2519 if (!hwndE) 2520 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 2521 if (!hwndE || !hwndB) { 2522 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 2523 return 0; 2524 } 2525 WinSendMsg(hwndE, EM_SETTEXTLIMIT, MPFROM2SHORT(1024, 0), MPVOID); 2526 WinSetWindowText(hwndStatus, directory); 2527 if (*lastcmd) 2528 WinSetWindowText(hwndE, lastcmd); 2529 else 2530 WinSetWindowText(hwndE, GetPString(IDS_HELPCMDTEXT)); 2531 oldproce = WinSubclassWindow(hwndE, (PFNWP) CommandLineProc); 2532 if (oldproce) 2533 WinSetWindowPtr(hwndE, QWL_USER, (PVOID) oldproce); 2534 PostMsg(hwndE, UM_FOCUSME, MPVOID, MPVOID); 2535 PostMsg(hwndE, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID); 2536 return 0; 2487 2537 } 2488 2538 if (msg == UM_CLICKED3 || (SHORT2FROMMP(mp2) & KC_CTRL)) { 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2539 switch (id) { 2540 case IDM_ATTRS: 2541 id = IDM_SORTSIZE; 2542 break; 2543 case IDM_INFO: 2544 id = IDM_SORTLWDATE; 2545 break; 2546 case IDM_RENAME: 2547 id = IDM_SORTFILENAME; 2548 break; 2549 } 2500 2550 } 2501 2551 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 2502 2552 WM_COMMAND, MPFROM2SHORT(id, 0), MPVOID); 2503 2553 } 2504 2554 return 0; … … 2514 2564 case IDM_RENAME: 2515 2565 case MAIN_STATUS2: 2516 2517 2566 PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE); 2567 break; 2518 2568 default: 2519 2520 2569 PaintRecessedWindow(hwnd, (HPS) 0, FALSE, TRUE); 2570 break; 2521 2571 } 2522 2572 if (id == IDM_RENAME) { 2523 2573 2524 2525 2526 2527 2528 2529 2530 2531 2574 HPS hps; 2575 2576 hps = WinBeginPaint(hwnd, (HPS) 0, NULL); 2577 if (hps) { 2578 PaintSTextWindow(hwnd, hps); 2579 WinEndPaint(hps); 2580 } 2581 return 0; 2532 2582 } 2533 2583 } … … 2562 2612 case UM_COMMAND: 2563 2613 return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2564 2614 FID_CLIENT), msg, mp1, mp2); 2565 2615 2566 2616 case WM_PAINT: … … 2575 2625 hps = WinBeginPaint(hwnd, (HPS)0, NULL); 2576 2626 if (hps) { 2577 2578 2627 GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL); 2628 WinQueryPresParam(hwnd, PP_BACKGROUNDCOLOR, 0, NULL, 2579 2629 sizeof(lColor), &lColor, 0); 2580 2630 if (!lColor) 2581 2631 lColor = CLR_PALEGRAY; 2582 2583 2584 2632 WinQueryWindowRect(hwnd, &rcl); 2633 WinFillRect(hps, &rcl, lColor); 2634 WinEndPaint(hps); 2585 2635 } 2586 2636 … … 2601 2651 tool = find_tool(id); 2602 2652 if (tool) { 2603 2604 2605 2606 2653 del_tool(tool); 2654 WinShowWindow(WinWindowFromID(hwnd, id), FALSE); 2655 if (fToolTitles) 2656 WinShowWindow(WinWindowFromID(hwnd, id + 25000), FALSE); 2607 2657 ResizeTools(hwnd); 2608 2658 save_tools(NULL); … … 2620 2670 2621 2671 id = (USHORT) WinDlgBox(HWND_DESKTOP, 2622 2623 2624 2672 hwnd, 2673 AddToolProc, 2674 FM3ModHandle, ADDBTN_FRAME, MPVOID); 2625 2675 if (id && id != (USHORT) - 1) 2626 2627 2628 2629 2676 WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2677 FID_CLIENT), 2678 WM_COMMAND, 2679 MPFROM2SHORT(IDM_CREATETOOL, 0), MPFROM2SHORT(id, 0)); 2630 2680 } 2631 2681 break; … … 2633 2683 case WM_CONTEXTMENU: 2634 2684 if (WinDlgBox(HWND_DESKTOP, 2635 2685 hwnd, ToolIODlgProc, FM3ModHandle, SVBTN_FRAME, MPVOID)) 2636 2686 PostMsg(hwnd, UM_SETUP2, MPVOID, MPVOID); 2637 2687 return MRFROMSHORT(TRUE); … … 2656 2706 if (pswp) { 2657 2707 if (WinQueryWindowPos(hwndTree, &swp) && 2658 2708 !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE))) { 2659 2709 pswp->x = swp.cx; 2660 2710 pswp->cx -= swp.cx; … … 2663 2713 if (prectl) { 2664 2714 if (WinQueryWindowPos(hwndTree, &swp) && 2665 2666 2715 !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)) && 2716 WinQueryWindowRect(hwndTree, &rectl)) { 2667 2717 prectl->xLeft = rectl.xRight; 2668 2718 prectl->xRight -= rectl.xRight; … … 2716 2766 if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) { 2717 2767 if (swp.x < swpT.cx) { 2718 2719 2720 2721 2722 2723 2768 swp.x = swpT.cx; 2769 if (swp.x + swp.cx > swpC.cx) 2770 swp.cx = swpC.cx - swp.x; 2771 if (swp.cx > 24) 2772 WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 2773 SWP_SIZE | SWP_MOVE | SWP_SHOW); 2724 2774 } 2725 2775 } … … 2741 2791 WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1); 2742 2792 WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0, 2743 2793 SWP_MOVE | SWP_SHOW | SWP_FOCUSDEACTIVATE); 2744 2794 } 2745 2795 } … … 2763 2813 if (hwndNext) { 2764 2814 if (!WinQueryWindowUShort(hwndNext, QWS_ID)) 2765 2815 continue; 2766 2816 if (next) 2767 2817 break; 2768 2818 if (hwndNext == hwndActive) { 2769 2770 2771 2772 2773 2774 2819 if (!previous && hwndPrev) { 2820 hwndNext = hwndPrev; 2821 break; 2822 } 2823 else if (previous) 2824 next = TRUE; 2775 2825 } 2776 2826 hwndPrev = hwndNext; … … 2778 2828 else { 2779 2829 if ((!next && previous) || once) 2780 2830 break; 2781 2831 else if (!previous) { 2782 2783 2832 hwndNext = hwndPrev; 2833 break; 2784 2834 } 2785 2835 else 2786 2836 once = next = TRUE; 2787 2837 } 2788 2838 } … … 2791 2841 if (hwndNext && hwndNext != hwndActive) { 2792 2842 WinSetWindowPos(hwndNext, HWND_TOP, 0, 0, 0, 0, 2793 2843 SWP_ZORDER | SWP_ACTIVATE); 2794 2844 WinSetWindowPos(hwndActive, ((previous) ? HWND_BOTTOM : hwndNext), 0, 0, 2795 2845 0, 0, SWP_ZORDER); 2796 2846 } 2797 2847 } … … 2808 2858 if (hwndChild != hwndTree) { 2809 2859 WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT), 2810 2860 WM_SAVEAPPLICATION, MPVOID, MPVOID); 2811 2861 if (WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT), 2812 2813 2814 2862 WM_CLOSE, MPVOID, MPVOID)) { 2863 ret = TRUE; 2864 break; 2815 2865 } 2816 2866 } … … 2835 2885 hwndTemp = WinWindowFromID(hwndChild, FID_CLIENT); 2836 2886 if (hwndTemp) { 2837 2838 2839 2840 2841 2842 2887 hwndDir = WinWindowFromID(hwndTemp, DIR_CNR); 2888 if (hwndDir) { 2889 WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT), 2890 WM_CLOSE, MPVOID, MPVOID); 2891 ret = TRUE; 2892 } 2843 2893 } 2844 2894 } … … 2898 2948 hwndC = WinWindowFromID(hwndChild, FID_CLIENT); 2899 2949 if (hwndC) { 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2950 hwndDir = WinWindowFromID(hwndC, DIR_CNR); 2951 if (hwndDir) { 2952 WinQueryWindowPos(hwndChild, &swp); 2953 *szDir = 0; 2954 WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(szDir), MPVOID); 2955 if (*szDir) { 2956 // If saving shutdown state skip no prescan drives 2957 if (fIsShutDownState && 2958 driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) { 2959 continue; 2960 } 2961 sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, numsaves); 2962 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, 2963 sizeof(SWP)); 2964 dcd = 2965 WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER); 2966 if (dcd) { 2967 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, numsaves); 2968 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->sortFlags, 2969 sizeof(INT)); 2970 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, numsaves); 2971 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->mask, 2972 sizeof(MASK)); 2973 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, numsaves); 2974 flWindowAttr = dcd->flWindowAttr; 2975 if (!fLeaveTree && (flWindowAttr & CV_TREE)) { 2976 flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT)); 2977 if (dcd->lastattr) { 2978 if (dcd->lastattr & CV_TEXT) 2979 flWindowAttr |= CV_TEXT; 2980 else if (dcd->lastattr & CV_DETAIL) 2981 flWindowAttr |= CV_DETAIL; 2982 else if (dcd->lastattr & CV_ICON) 2983 flWindowAttr |= CV_ICON; 2984 else 2985 flWindowAttr |= CV_NAME; 2986 } 2987 else 2988 flWindowAttr |= CV_NAME; 2989 } 2990 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & flWindowAttr, 2991 sizeof(ULONG)); 2992 sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, numsaves); 2993 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslongname, 2994 sizeof(BOOL)); 2995 sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, numsaves); 2996 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailssubject, 2997 sizeof(BOOL)); 2998 sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, numsaves); 2999 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailssize, 3000 sizeof(BOOL)); 3001 sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, numsaves); 3002 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsea, 3003 sizeof(BOOL)); 3004 sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, numsaves); 3005 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsattr, 3006 sizeof(BOOL)); 3007 sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, numsaves); 3008 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsicon, 3009 sizeof(BOOL)); 3010 sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, numsaves); 3011 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslwdate, 3012 sizeof(BOOL)); 3013 sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, numsaves); 3014 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslwtime, 3015 sizeof(BOOL)); 3016 sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, numsaves); 3017 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsladate, 3018 sizeof(BOOL)); 3019 sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, numsaves); 3020 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslatime, 3021 sizeof(BOOL)); 3022 sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, numsaves); 3023 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailscrdate, 3024 sizeof(BOOL)); 3025 sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, numsaves); 3026 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailscrtime, 3027 sizeof(BOOL)); 3028 sprintf(szKey, "%sDirCnr.%lu", szPrefix, numsaves); 3029 SavePresParams(hwndDir, szKey); 3030 } 3031 sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, numsaves++); 3032 PrfWriteProfileString(fmprof, FM3Str, szKey, szDir); 3033 } 3034 } 2985 3035 } 2986 3036 } … … 3067 3117 if (hwnd) { 3068 3118 if (WinQueryWindowPos(hwnd, &swp)) { 3069 3070 3071 3072 3073 3074 3075 3076 3119 if (pswp->x > swp.cx) 3120 pswp->x = (swp.cx > 24) ? swp.cx - 24 : swp.cx; 3121 if (pswp->y > swp.cy) 3122 pswp->y = (swp.cy > 24) ? swp.cy - 24 : swp.cy; 3123 if (pswp->x + pswp->cx > swp.cx) 3124 pswp->cx = swp.cx - pswp->x; 3125 if (pswp->y + pswp->cy > swp.cy) 3126 pswp->cy = swp.cy - pswp->y; 3077 3127 } 3078 3128 } … … 3141 3191 sprintf(szKey, "%sMySizeLastTime", szPrefix); 3142 3192 if (!PrfQueryProfileData(fmprof, 3143 3144 3145 3146 3193 FM3Str, 3194 szKey, 3195 (PVOID) & swpO, 3196 &size) || 3147 3197 size != sizeof(SWP) || !swp.cx || !swp.cy) 3148 3198 { … … 3172 3222 swp.fl &= (~SWP_ACTIVATE); 3173 3223 WinSetWindowPos(hwndTree, 3174 3175 3176 3177 3178 3179 3224 HWND_TOP, 3225 swp.x, 3226 swp.y, 3227 swp.cx, 3228 swp.cy, 3229 swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER); 3180 3230 } 3181 3231 else { 3182 3232 WinSetWindowPos(hwndTree, 3183 3233 HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW); 3184 3234 WinSetWindowUShort(hwndTree, QWS_XRESTORE, (USHORT) swp.x); 3185 3235 WinSetWindowUShort(hwndTree, QWS_CXRESTORE, (USHORT) swp.cx); … … 3191 3241 sprintf(szKey, "%sNumDirsLastTime", szPrefix); 3192 3242 if (PrfQueryProfileData(fmprof, 3193 3243 FM3Str, szKey, (PVOID) & numsaves, &size)) { 3194 3244 if (fDeleteState) 3195 3245 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); … … 3198 3248 size = sizeof(SWP); 3199 3249 if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &swp, &size)) { 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 3235 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 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3250 if (fDeleteState) 3251 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3252 sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, x); 3253 size = sizeof(szDir); 3254 if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) { 3255 // If restoring shutdown state and drive marked no prescan 3256 // bypass window restore 3257 if (fIsShutDownState && 3258 driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) { 3259 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3260 continue; 3261 } 3262 if (fDeleteState) 3263 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3264 localdcd.ds.detailslongname = dsDirCnrDefault.detailslongname; // Set default 3265 size = sizeof(BOOL); 3266 sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, x); 3267 if (PrfQueryProfileData(fmprof, 3268 FM3Str, 3269 szKey, 3270 (PVOID)&localdcd.ds.detailslongname, 3271 &size) && 3272 size == sizeof(BOOL)) 3273 { 3274 if (fDeleteState) 3275 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3276 } 3277 localdcd.ds.detailssubject = dsDirCnrDefault.detailssubject; // Set default 3278 size = sizeof(BOOL); 3279 sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, x); 3280 if (PrfQueryProfileData(fmprof, 3281 FM3Str, 3282 szKey, 3283 (PVOID)&localdcd.ds.detailssubject, 3284 &size) && 3285 size == sizeof(BOOL)) 3286 { 3287 if (fDeleteState) 3288 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3289 } 3290 localdcd.ds.detailsea = dsDirCnrDefault.detailsea; // Set default 3291 size = sizeof(BOOL); 3292 sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, x); 3293 if (PrfQueryProfileData(fmprof, 3294 FM3Str, 3295 szKey, 3296 (PVOID) & localdcd.ds.detailsea, 3297 &size) && 3298 size == sizeof(BOOL)) 3299 { 3300 if (fDeleteState) 3301 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3302 } 3303 localdcd.ds.detailssize = dsDirCnrDefault.detailssize; // Set default 3304 size = sizeof(BOOL); 3305 sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, x); 3306 if (PrfQueryProfileData(fmprof, 3307 FM3Str, 3308 szKey, 3309 (PVOID) & localdcd.ds.detailssize, 3310 &size) && 3311 size == sizeof(BOOL)) 3312 { 3313 if (fDeleteState) 3314 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3315 } 3316 localdcd.ds.detailsicon = dsDirCnrDefault.detailsicon; // Set default 3317 size = sizeof(BOOL); 3318 sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, x); 3319 if (PrfQueryProfileData(fmprof, 3320 FM3Str, 3321 szKey, 3322 (PVOID) & localdcd.ds.detailsicon, 3323 &size) && 3324 size == sizeof(BOOL)) 3325 { 3326 if (fDeleteState) 3327 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3328 } 3329 localdcd.ds.detailsattr = dsDirCnrDefault.detailsattr; // Set default 3330 size = sizeof(BOOL); 3331 sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, x); 3332 if (PrfQueryProfileData(fmprof, 3333 FM3Str, 3334 szKey, 3335 (PVOID)&localdcd.ds.detailsattr, 3336 &size) && 3337 size == sizeof(BOOL)) 3338 { 3339 if (fDeleteState) 3340 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3341 } 3342 localdcd.ds.detailscrdate = dsDirCnrDefault.detailscrdate; // Set default 3343 size = sizeof(BOOL); 3344 sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, x); 3345 if (PrfQueryProfileData(fmprof, 3346 FM3Str, 3347 szKey, 3348 (PVOID) & localdcd.ds.detailscrdate, 3349 &size) && size == sizeof(BOOL)) 3350 { 3351 if (fDeleteState) 3352 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3353 } 3354 localdcd.ds.detailscrtime = dsDirCnrDefault.detailscrtime; // Set default 3355 size = sizeof(BOOL); 3356 sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, x); 3357 if (PrfQueryProfileData(fmprof, 3358 FM3Str, 3359 szKey, 3360 (PVOID)&localdcd.ds.detailscrtime, 3361 &size) && 3362 size == sizeof(BOOL)) 3363 { 3364 if (fDeleteState) 3365 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3366 } 3367 localdcd.ds.detailslwdate = dsDirCnrDefault.detailslwdate; // Set default 3368 size = sizeof(BOOL); 3369 sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, x); 3370 if (PrfQueryProfileData(fmprof, 3371 FM3Str, 3372 szKey, 3373 (PVOID) & localdcd.ds.detailslwdate, 3374 &size) && 3375 size == sizeof(BOOL)) 3376 { 3377 if (fDeleteState) 3378 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3379 } 3380 localdcd.ds.detailslwtime = dsDirCnrDefault.detailslwtime; // Set default 3381 size = sizeof(BOOL); 3382 sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, x); 3383 if (PrfQueryProfileData(fmprof, 3384 FM3Str, 3385 szKey, 3386 (PVOID) & localdcd.ds.detailslwtime, 3387 &size) && 3388 size == sizeof(BOOL)) 3389 { 3390 if (fDeleteState) 3391 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3392 } 3393 localdcd.ds.detailsladate = dsDirCnrDefault.detailsladate; // Set default 3394 size = sizeof(BOOL); 3395 sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, x); 3396 if (PrfQueryProfileData(fmprof, 3397 FM3Str, 3398 szKey, 3399 (PVOID) & localdcd.ds.detailsladate, 3400 &size) && 3401 size == sizeof(BOOL)) 3402 { 3403 if (fDeleteState) 3404 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3405 } 3406 localdcd.ds.detailslatime = dsDirCnrDefault.detailslatime; // Set default 3407 size = sizeof(BOOL); 3408 sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, x); 3409 if (PrfQueryProfileData(fmprof, 3410 FM3Str, 3411 szKey, 3412 (PVOID) & localdcd.ds.detailslatime, 3413 &size) && 3414 size == sizeof(BOOL)) 3415 { 3416 if (fDeleteState) 3417 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3418 } 3419 hwndDir = (HWND) WinSendMsg(hwndClient, 3420 UM_SETDIR, 3421 MPFROMP(szDir), MPFROMLONG(1)); 3422 if (hwndDir) { 3423 hwndC = WinWindowFromID(hwndDir, FID_CLIENT); 3424 if (hwndC) { 3425 HWND hwndCnr = WinWindowFromID(hwndC, DIR_CNR); 3426 if (!hwndPPSave) { 3427 hwndPPSave = WinCreateWindow(hwndCnr, // Create a window (used to save default presparams) 3428 WC_CONTAINER, 3429 NULL, 3430 CCS_AUTOPOSITION | CCS_MINIICONS | 3431 CCS_MINIRECORDCORE | ulCnrType | 3432 WS_VISIBLE, 3433 0, 3434 0, 3435 0, 3436 0, 3437 hwndCnr, 3438 HWND_TOP, (ULONG) -1, NULL, NULL); 3439 CopyPresParams(hwndPPSave, hwndC); 3440 RestorePresParams(hwndPPSave, "DirCnr"); 3441 } 3442 sprintf(szKey, "%sDirCnr.%lu", szPrefix, x); 3443 RestorePresParams(hwndCnr, szKey); 3444 dcd = WinQueryWindowPtr(hwndCnr, QWL_USER); 3445 if (dcd) { 3446 dcd->ds.detailslongname = localdcd.ds.detailslongname; 3447 dcd->ds.detailssubject = localdcd.ds.detailssubject ; 3448 dcd->ds.detailsattr = localdcd.ds.detailsattr ; 3449 dcd->ds.detailsea = localdcd.ds.detailsea ; 3450 dcd->ds.detailssize = localdcd.ds.detailssize ; 3451 dcd->ds.detailsicon = localdcd.ds.detailsicon ; 3452 dcd->ds.detailscrdate = localdcd.ds.detailscrdate ; 3453 dcd->ds.detailscrtime = localdcd.ds.detailscrtime ; 3454 dcd->ds.detailsladate = localdcd.ds.detailsladate ; 3455 dcd->ds.detailslatime = localdcd.ds.detailslatime ; 3456 dcd->ds.detailslwdate = localdcd.ds.detailslwdate ; 3457 dcd->ds.detailslwtime = localdcd.ds.detailslwtime ; 3458 size = sizeof(INT); 3459 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, x); 3460 if (PrfQueryProfileData(fmprof, 3461 FM3Str, 3462 szKey, 3463 (PVOID) & dcd->sortFlags, 3464 &size) && size == sizeof(INT)) { 3465 if (!dcd->sortFlags) 3466 dcd->sortFlags = SORT_PATHNAME; 3467 } 3468 if (fDeleteState) 3469 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3470 size = sizeof(MASK); 3471 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, x); 3472 if (PrfQueryProfileData(fmprof, 3473 FM3Str, 3474 szKey, 3475 (PVOID) & dcd->mask, &size) && size) { 3476 if (*dcd->mask.szMask) 3477 WinSendMsg(WinWindowFromID(hwndC, DIR_CNR), 3478 UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID); 3479 } 3480 *(dcd->mask.prompt) = 0; 3481 if (fDeleteState) 3482 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3483 size = sizeof(ULONG); 3484 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, x); 3485 if (!noview) { 3486 if (PrfQueryProfileData(fmprof, 3487 FM3Str, 3488 szKey, 3489 (PVOID) & dcd->flWindowAttr, 3490 &size) && size == sizeof(ULONG)) { 3491 3492 CNRINFO cnri; 3493 3494 memset(&cnri, 0, sizeof(CNRINFO)); 3495 cnri.cb = sizeof(CNRINFO); 3496 if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR), 3497 CM_QUERYCNRINFO, 3498 MPFROMP(&cnri), 3499 MPFROMLONG(sizeof(CNRINFO)))) { 3500 cnri.flWindowAttr = dcd->flWindowAttr; 3501 WinSendMsg(WinWindowFromID(hwndC, DIR_CNR), 3502 CM_SETCNRINFO, 3503 MPFROMP(&cnri), 3504 MPFROMLONG(CMA_FLWINDOWATTR)); 3505 } 3506 } 3507 } 3508 if (fDeleteState) 3509 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3510 if (!PostMsg(hwndCnr, UM_SETUP2, NULL, NULL)) 3511 WinSendMsg(hwndCnr, UM_SETUP2, NULL, NULL); 3512 } 3513 } 3514 fRestored = TRUE; 3515 swp.hwnd = hwndDir; 3516 TransformSwp(&swp, xtrans, ytrans); 3517 if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) { 3518 WinSetWindowPos(hwndDir, 3519 HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW); 3520 WinSetWindowUShort(hwndDir, QWS_XRESTORE, (USHORT) swp.x); 3521 WinSetWindowUShort(hwndDir, QWS_CXRESTORE, (USHORT) swp.cx); 3522 WinSetWindowUShort(hwndDir, QWS_YRESTORE, (USHORT) swp.y); 3523 WinSetWindowUShort(hwndDir, QWS_CYRESTORE, (USHORT) swp.cy); 3524 } else 3525 WinSetWindowPos(hwndDir, 3526 HWND_TOP, 3527 swp.x, 3528 swp.y, 3529 swp.cx, 3530 swp.cy, 3531 swp.fl | SWP_MOVE | 3532 SWP_SIZE | SWP_SHOW | SWP_ZORDER | 3533 SWP_ACTIVATE); 3534 } 3535 } 3486 3536 } 3487 3537 } // for … … 3512 3562 if (ulNumMinChildren) { 3513 3563 if (WinQueryWindowPos(hwndChild, &swp) && (swp.fl & SWP_MINIMIZE)) 3514 3564 (*ulNumMinChildren)++; 3515 3565 } 3516 3566 } … … 3520 3570 3521 3571 VOID GetNextWindowPos(HWND hwndClient, PSWP pswp, ULONG * ulCntR, 3522 3572 ULONG * ulNumMinChildrenR) 3523 3573 { 3524 3574 register ULONG ulCnt; … … 3584 3634 if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) { 3585 3635 if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom) 3586 3636 swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y; 3587 3637 if (swp.x != 0) 3588 3638 swp.x = 0; 3589 3639 if (swp.y < 0) 3590 3640 swp.y = 0; 3591 3641 if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft) 3592 3642 swp.cx = Rectl.xRight - Rectl.xLeft; 3593 3643 WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 3594 3644 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE); 3595 3645 } 3596 3646 } … … 3604 3654 GetNextWindowPos(hwndClient, &swp, &ulCnt, &ulNumMinChildren); 3605 3655 WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 3606 3607 3656 SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_RESTORE | 3657 SWP_ZORDER | SWP_ACTIVATE); 3608 3658 ulCnt++; 3609 3659 } … … 3658 3708 if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) { 3659 3709 if (swp.y < 0) 3660 3710 swp.y = 0; 3661 3711 if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom) 3662 3712 swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y; 3663 3713 if (swp.x != 0) 3664 3714 swp.x = 0; 3665 3715 if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft) 3666 3716 swp.cx = Rectl.xRight - Rectl.xLeft; 3667 3717 WinSetWindowPos(hwndTree, 3668 3669 3670 3671 3672 3718 HWND_TOP, 3719 swp.x, 3720 swp.y, 3721 swp.cx, 3722 swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE); 3673 3723 WinQueryWindowPos(hwndTree, &swp); 3674 3724 } … … 3695 3745 3696 3746 for (ulCurRow = 0; ulCurRow < ulNumRows; ulCurRow++) { 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3747 if ((ulNumRows - ulCurRow) <= ulExtraCols) 3748 ulNumCols++; 3749 for (ulCurCol = 0; ulCurCol < ulNumCols; ulCurCol++) { 3750 ulWidth = Rectl.xRight / ulNumCols; 3751 3752 while (hwndChild) { 3753 id = WinQueryWindowUShort(hwndChild, QWS_ID); 3754 if (id && (id != TREE_FRAME || fFreeTree)) { 3755 WinQueryWindowPos(hwndChild, &swp); 3756 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) 3757 break; 3758 } 3759 hwndChild = WinGetNextWindow(henum); 3760 } 3761 3762 if (hwndChild) { 3763 if (!absolute && (swp.fl & SWP_MAXIMIZE)) { 3764 WinGetMaxPosition(hwndChild, &swp); 3765 WinSetWindowPos(hwndChild, 3766 HWND_TOP, 3767 swp.x, 3768 swp.y, 3769 swp.cx, swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW); 3770 WinSetWindowUShort(hwndChild, 3771 QWS_XRESTORE, 3772 (USHORT) (ulWidth * ulCurCol) + Rectl.xLeft); 3773 WinSetWindowUShort(hwndChild, 3774 QWS_YRESTORE, 3775 (USHORT) (Rectl.yTop - 3776 (ulHeight * (ulCurRow + 1)))); 3777 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, (USHORT) ulWidth); 3778 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, (USHORT) ulHeight); 3779 } 3780 else 3781 WinSetWindowPos(hwndChild, 3782 HWND_TOP, 3783 (ulWidth * ulCurCol) + Rectl.xLeft, 3784 Rectl.yTop - (ulHeight * (ulCurRow + 1)), 3785 ulWidth, 3786 ulHeight, 3787 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE); 3788 hwndChild = WinGetNextWindow(henum); 3789 } 3790 } 3791 if ((ulNumRows - ulCurRow) <= ulExtraCols) { 3792 ulNumCols--; 3793 ulExtraCols--; 3794 } 3745 3795 } 3746 3796 } … … 3752 3802 3753 3803 static VOID ResizeChildren(HWND hwndClient, SHORT oldcx, SHORT oldcy, 3754 3804 SHORT newcx, SHORT newcy) 3755 3805 { 3756 3806 /* … … 3770 3820 while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) { 3771 3821 if (!WinQueryWindowUShort(hwndChild, QWS_ID)) 3772 3822 continue; 3773 3823 if (WinQueryWindowPos(hwndChild, &swp)) { 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3824 if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) { 3825 swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE); 3826 swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE); 3827 swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE); 3828 swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE); 3829 } 3830 else if (swp.fl & SWP_MAXIMIZE) { 3831 swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE); 3832 swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE); 3833 swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE); 3834 swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE); 3835 } 3836 cx = (swp.cx) ? (LONG) (((double)oldcx * 100.0) / (double)swp.cx) : 0; 3837 cy = (swp.cy) ? (LONG) (((double)oldcy * 100.0) / (double)swp.cy) : 0; 3838 x = (swp.x) ? (LONG) (((double)oldcx * 100.0) / (double)swp.x) : 0; 3839 y = (swp.y) ? (LONG) (((double)oldcy * 100.0) / (double)swp.y) : 0; 3840 if (x < 0) 3841 x = 0; 3842 if (y < 0) 3843 y = 0; 3844 ux = (x) ? (LONG) (((double)newcx * 100.0) / (double)x) : 0; 3845 uy = (y) ? (LONG) (((double)newcy * 100.0) / (double)y) : 0; 3846 ucx = (cx) ? (LONG) (((double)newcx * 100.0) / (double)cx) : 0; 3847 ucy = (cy) ? (LONG) (((double)newcy * 100.0) / (double)cy) : 0; 3848 if (ux + ucx > newcx) 3849 ucx = newcx - ux; 3850 if (uy + ucy > newcy) 3851 ucy = newcy - uy; 3852 3853 if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE))) 3854 WinSetWindowPos(hwndChild, HWND_TOP, ux, uy, ucx, ucy, 3855 SWP_MOVE | SWP_SIZE | SWP_SHOW); 3856 else if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) { 3857 WinSetWindowUShort(hwndChild, QWS_XMINIMIZE, (USHORT) - 1); 3858 WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1); 3859 WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0, 3860 SWP_SIZE | SWP_MOVE | SWP_FOCUSDEACTIVATE); 3861 WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux); 3862 WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy); 3863 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx); 3864 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy); 3865 } 3866 else { 3867 WinGetMaxPosition(hwndChild, &swp); 3868 WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 3869 SWP_MOVE | SWP_SIZE | SWP_SHOW); 3870 WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux); 3871 WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy); 3872 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx); 3873 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy); 3874 } 3825 3875 } 3826 3876 } … … 3838 3888 3839 3889 if (!fNoTreeGap) { 3840 3841 3842 3890 INT height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2; 3891 if (swp.y < height) 3892 swp.y = height; // Force bottom to position 3843 3893 } 3844 3894 else 3845 3895 swp.y = 0; // Force bottom to position 3846 3896 3847 3897 swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y; 3848 3898 if (swp.cy < 0) 3849 3899 swp.cy = 0; 3850 3900 3851 3901 if (swp.x != 0) 3852 3902 swp.x = 0; // Left align 3853 3903 3854 3904 // AdjustSizeOfClient can return bogus xRight values - fixme someday 3855 3905 if (Rectl.xRight >= Rectl.xLeft) { 3856 3857 3906 if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft) 3907 swp.cx = Rectl.xRight - Rectl.xLeft; 3858 3908 } 3859 3909 WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 3860 3910 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE); 3861 3911 } 3862 3912 } … … 3886 3936 3887 3937 static MRESULT EXPENTRY ChildFrameButtonProc(HWND hwnd, 3888 3889 3938 ULONG msg, 3939 MPARAM mp1, MPARAM mp2) 3890 3940 { 3891 3941 USHORT id; … … 3901 3951 if (fOtherHelp) { 3902 3952 if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3953 && !WinQueryCapture(HWND_DESKTOP)) { 3954 id = WinQueryWindowUShort(hwnd, QWS_ID); 3955 switch (id) { 3956 case IDM_OPENWALK: 3957 MakeBubble(hwnd, FALSE, GetPString(IDS_WALKBUTTONHELP)); 3958 break; 3959 case IDM_USERLIST: 3960 MakeBubble(hwnd, FALSE, GetPString(IDS_QUICKBUTTONHELP)); 3961 break; 3962 } 3913 3963 } 3914 3964 } … … 3924 3974 switch (id) { 3925 3975 case IDM_OPENWALK: 3926 3927 3928 3929 3930 3931 3932 3976 switch (msg) { 3977 case WM_BUTTON2CLICK: 3978 if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) == 3979 (KC_ALT | KC_SHIFT | KC_CTRL)) 3980 cmd = IDM_GREP; 3981 else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL)) 3982 CascadeChildren(hwndMain); 3933 3983 3934 3984 #ifdef NEVER 3935 3936 3985 else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT)) 3986 cmd = IDM_SYSINFO; 3937 3987 #endif 3938 3988 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3989 else if (shiftstate & KC_SHIFT) 3990 cmd = IDM_WINDOWDLG; 3991 else if (shiftstate & KC_CTRL) 3992 cmd = IDM_SEEALL; 3993 else if (shiftstate & KC_ALT) 3994 TileChildren(hwndMain, TRUE); 3995 else 3996 cmd = IDM_WALKDIR; 3997 break; 3998 case WM_BUTTON3CLICK: 3999 TileChildren(hwndMain, TRUE); 4000 break; 4001 } 4002 break; 3953 4003 case IDM_USERLIST: 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 4004 switch (msg) { 4005 case WM_BUTTON2CLICK: 4006 if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) == 4007 (KC_ALT | KC_SHIFT | KC_CTRL)) 4008 cmd = IDM_COLORPALETTE; 4009 else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL)) 4010 cmd = IDM_HIDEMENU; 4011 else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT)) 4012 cmd = IDM_NOTEBOOK; 4013 else if (shiftstate & KC_SHIFT) 4014 cmd = IDM_TOOLTITLES; 4015 else if (shiftstate & KC_CTRL) 4016 cmd = IDM_TEXTTOOLS; 4017 else if (shiftstate & KC_ALT) 4018 cmd = IDM_FONTPALETTE; 4019 else 4020 cmd = IDM_TOOLBAR; 4021 break; 4022 case WM_BUTTON3CLICK: 4023 cmd = IDM_DRIVEBAR; 4024 break; 4025 } 4026 break; 3977 4027 } // switch id 3978 4028 3979 4029 if (cmd) { 3980 3981 4030 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_CLIENT), 4031 WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID); 3982 4032 } 3983 4033 } … … 3988 4038 if (id == IDM_OPENWALK) { 3989 4039 if (!emphasized) { 3990 3991 4040 emphasized = TRUE; 4041 DrawTargetEmphasis(hwnd, emphasized); 3992 4042 } 3993 4043 if (AcceptOneDrop(hwnd, mp1, mp2)) 3994 4044 return MRFROM2SHORT(DOR_DROP, DO_MOVE); 3995 4045 } 3996 4046 return MRFROM2SHORT(DOR_NEVERDROP, 0); … … 4012 4062 4013 4063 if (emphasized) { 4014 4015 4064 emphasized = FALSE; 4065 DrawTargetEmphasis(hwnd, emphasized); 4016 4066 } 4017 4067 if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) { 4018 4019 4020 4068 if (MakeValidDir(szFrom) && !FindDirCnrByName(szFrom, TRUE)) { 4069 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szFrom); 4070 } 4021 4071 } 4022 4072 } … … 4031 4081 4032 4082 static MRESULT EXPENTRY MainFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1, 4033 4083 MPARAM mp2) 4034 4084 { 4035 4085 PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER); … … 4043 4093 pswp = (SWP *) mp1; 4044 4094 if (fDataMin && !fAmClosing) { 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4095 if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) { 4096 4097 SWP swp; 4098 4099 WinQueryWindowPos(hwnd, &swp); 4100 PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(swp.fl), MPVOID); 4101 HideNote(); 4102 } 4103 else if (pswp->fl & (SWP_SHOW | SWP_RESTORE)) { 4104 if (DataHwnd) 4105 PostMsg(DataHwnd, WM_CLOSE, MPVOID, MPVOID); 4106 } 4057 4107 } 4058 4108 if (!fAmClosing) { 4059 4060 4109 if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) 4110 HideNote(); 4061 4111 } 4062 4112 } … … 4081 4131 case WM_CONTROL: 4082 4132 return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), UM_CONTROL, mp1, 4083 4133 mp2); 4084 4134 4085 4135 case WM_COMMAND: … … 4101 4151 4102 4152 if (mr && mp2) { 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4153 prectl = (PRECTL) mp1; 4154 if (prectl->yBottom != prectl->yTop) { 4155 { 4156 HPS hps; 4157 POINTL aptl[TXTBOX_COUNT]; 4158 4159 hps = WinGetPS(hwndStatus); 4160 if (hps) { 4161 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl); 4162 bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6; 4163 WinReleasePS(hps); 4164 } 4165 } 4166 prectl->yBottom += (sheight + 4); 4167 prectl->yTop -= (sheight + 4); 4168 if (fMoreButtons) { 4169 4170 HPS hps; 4171 POINTL aptl[TXTBOX_COUNT]; 4172 4173 hps = WinGetPS(hwndName); 4174 if (hps) { 4175 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl); 4176 bheight = aptl[TXTBOX_TOPLEFT].y + 6; 4177 WinReleasePS(hps); 4178 } 4179 prectl->yBottom += (bheight + 4); 4180 prectl->yTop -= (bheight + 4); 4181 } 4182 if (fToolbar) { 4183 if (!fTextTools) 4184 prectl->yTop -= ((fToolTitles) ? 50 : 40); 4185 else 4186 prectl->yTop -= 32; 4187 } 4188 if (fDrivebar) { 4189 ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), 4190 ((prectl->xRight - 4191 (WinQuerySysValue(HWND_DESKTOP, 4192 SV_CYSIZEBORDER) * 2)) - 4)); 4193 prectl->yTop -= (16 * (DriveLines * 18)); 4194 } 4195 if (fUserComboBox) { 4196 if (!aheight) { 4197 4198 SWP swpTemp; 4199 4200 WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT), 4201 &swpTemp); 4202 aheight = swpTemp.cy; 4203 } 4204 prectl->yTop -= (aheight + 6L); 4205 } 4206 if (fAutoView) { 4207 AutoviewHeight = min(AutoviewHeight, 4208 (prectl->yTop - prectl->yBottom) - 116); 4209 AutoviewHeight = max(AutoviewHeight, 36); 4210 prectl->yBottom += (AutoviewHeight + 6); 4211 } 4212 } 4163 4213 } 4164 4214 return mr; … … 4184 4234 pswp = (PSWP) mp1; 4185 4235 { 4186 4187 4188 4189 4190 4191 4192 4193 4194 4236 SHORT x; 4237 4238 for (x = 0; x < soldCount; x++) { 4239 if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) { 4240 pswpClient = pswp; 4241 break; 4242 } 4243 pswp++; 4244 } 4195 4245 } 4196 4246 4197 4247 { 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4248 HPS hps; 4249 POINTL aptl[TXTBOX_COUNT]; 4250 4251 hps = WinGetPS(hwndStatus); 4252 if (hps) { 4253 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl); 4254 bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6; 4255 WinReleasePS(hps); 4256 } 4257 if (fMoreButtons) { 4258 hps = WinGetPS(hwndName); 4259 if (hps) { 4260 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl); 4261 bheight = aptl[TXTBOX_TOPLEFT].y + 6; 4262 WinReleasePS(hps); 4263 } 4264 } 4215 4265 } 4216 4266 pswpNew = (PSWP) mp1 + soldCount; … … 4222 4272 pswpNew->y = swpClient.y + 2; 4223 4273 if (!fSplitStatus) 4224 4274 width = swpClient.cx - (16 + (sheight * 2) + 4); 4225 4275 else 4226 4276 width = (swpClient.cx - (16 + (sheight * 2) + 4)) / 2; 4227 4277 width = max(width, 10); 4228 4278 if (fSplitStatus) 4229 4279 pswpNew->cx = width - 6; 4230 4280 else 4231 4281 pswpNew->cx = width - 8; 4232 4282 pswpNew->cy = sheight; 4233 4283 pswpClient->y = pswpNew->y + pswpNew->cy + 3; … … 4236 4286 4237 4287 if (fSplitStatus) { 4238 4239 4240 4241 4242 4243 4244 4245 4246 4288 pswpNew = (PSWP) mp1 + (soldCount + 1); 4289 *pswpNew = *pswpClient; 4290 pswpNew->hwnd = hwndStatus2; 4291 pswpNew->hwndInsertBehind = HWND_BOTTOM; 4292 pswpNew->x = width + 8; 4293 pswpNew->y = swpClient.y + 2; 4294 pswpNew->cx = width - 6; 4295 pswpNew->cy = sheight; 4296 sCount++; 4247 4297 } 4248 4298 else { 4249 4250 4299 WinShowWindow(hwndStatus2, FALSE); 4300 WinSetWindowText(hwndStatus2, NullStr); 4251 4301 } 4252 4302 4253 4303 if (fToolbar) { 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4304 if (fTextTools) 4305 theight = 32L; 4306 else if (!fToolTitles) 4307 theight = 40L; 4308 pswpNew = (PSWP) mp1 + (soldCount + 1 + (fSplitStatus != FALSE)); 4309 *pswpNew = *pswpClient; 4310 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_TOOLS); 4311 pswpNew->hwndInsertBehind = HWND_BOTTOM; 4312 pswpNew->x = swpClient.x + 2; 4313 pswpNew->y = (swpClient.y + swpClient.cy) - (theight - 2); 4314 pswpNew->cx = swpClient.cx - 4; 4315 pswpNew->cy = theight - 4; 4316 pswpClient->cy -= theight; 4317 sCount++; 4268 4318 } 4269 4319 else 4270 4320 WinShowWindow(WinWindowFromID(hwnd, MAIN_TOOLS), FALSE); 4271 4321 4272 4322 if (fDrivebar) { 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4323 ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), pswpClient->cx - 4); 4324 pswpNew = (PSWP) mp1 + (soldCount + 1 + 4325 (fSplitStatus != FALSE) + 4326 (fToolbar != FALSE)); 4327 *pswpNew = *pswpClient; 4328 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_DRIVES); 4329 pswpNew->hwndInsertBehind = HWND_BOTTOM; 4330 pswpNew->x = swpClient.x + 2; 4331 dheight += ((dheight - 2) * DriveLines); 4332 pswpNew->y = (swpClient.y + swpClient.cy) - (dheight - 2); 4333 if (fToolbar) 4334 pswpNew->y -= theight; 4335 pswpNew->cx = swpClient.cx - 4; 4336 pswpNew->cy = dheight - 4; 4337 pswpClient->cy -= dheight; 4338 sCount++; 4289 4339 } 4290 4340 else 4291 4341 WinShowWindow(WinWindowFromID(hwnd, MAIN_DRIVES), FALSE); 4292 4342 4293 4343 if (fAutoView) { 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4344 pswpNew = (PSWP) mp1 + (soldCount + 1 + 4345 (fToolbar != FALSE) + 4346 (fDrivebar != FALSE) + 4347 (fSplitStatus != FALSE)); 4348 *pswpNew = *pswpClient; 4349 pswpNew->hwnd = (fComments) ? hwndAutoMLE : hwndAutoview; 4350 pswpNew->x = pswpClient->x + 3; 4351 pswpNew->y = pswpClient->y + 3; 4352 if (fMoreButtons) 4353 pswpNew->y += (bheight + 4); 4354 pswpNew->cx = pswpClient->cx - 6; 4355 AutoviewHeight = min(AutoviewHeight, pswpClient->cy - 116); 4356 AutoviewHeight = max(AutoviewHeight, 36); 4357 pswpNew->cy = AutoviewHeight; 4358 pswpClient->y += (AutoviewHeight + 6); 4359 pswpClient->cy -= (AutoviewHeight + 6); 4360 sCount++; 4361 WinShowWindow((fComments) ? hwndAutoview : hwndAutoMLE, FALSE); 4312 4362 } 4313 4363 else { 4314 4315 4364 WinShowWindow(hwndAutoview, FALSE); 4365 WinShowWindow(hwndAutoMLE, FALSE); 4316 4366 } 4317 4367 4318 4368 pswpNew = (PSWP) mp1 + (soldCount + 1 + 4319 4320 4321 4369 (fToolbar != FALSE) + 4370 (fDrivebar != FALSE) + 4371 (fSplitStatus != FALSE) + (fAutoView != FALSE)); 4322 4372 *pswpNew = *pswpClient; 4323 4373 pswpNew->hwnd = WinWindowFromID(hwnd, IDM_OPENWALK); … … 4328 4378 sCount++; 4329 4379 pswpNew = (PSWP) mp1 + (soldCount + 2 + 4330 4331 4332 4380 (fToolbar != FALSE) + 4381 (fDrivebar != FALSE) + 4382 (fSplitStatus != FALSE) + (fAutoView != FALSE)); 4333 4383 *pswpNew = *pswpClient; 4334 4384 pswpNew->hwnd = WinWindowFromID(hwnd, IDM_USERLIST); … … 4339 4389 sCount++; 4340 4390 pswpNew = (PSWP) mp1 + (soldCount + 3 + 4341 4342 4343 4391 (fToolbar != FALSE) + 4392 (fDrivebar != FALSE) + 4393 (fSplitStatus != FALSE) + (fAutoView != FALSE)); 4344 4394 *pswpNew = *pswpClient; 4345 4395 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LED); … … 4350 4400 sCount++; 4351 4401 pswpNew = (PSWP) mp1 + (soldCount + 4 + 4352 4353 4354 4402 (fToolbar != FALSE) + 4403 (fDrivebar != FALSE) + 4404 (fSplitStatus != FALSE) + (fAutoView != FALSE)); 4355 4405 *pswpNew = *pswpClient; 4356 4406 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LEDHDR); … … 4361 4411 sCount++; 4362 4412 if (fUserComboBox) { 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 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4413 if (!aheight) { 4414 4415 SWP swpTemp; 4416 4417 WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT), 4418 &swpTemp); 4419 aheight = swpTemp.cy; 4420 } 4421 pswpNew = (PSWP) mp1 + (soldCount + 5 + 4422 (fToolbar != FALSE) + 4423 (fSplitStatus != FALSE) + 4424 (fDrivebar != FALSE) + (fAutoView != FALSE)); 4425 *pswpNew = *pswpClient; 4426 pswpNew->hwnd = hwndDrivelist; 4427 pswpNew->x = swpClient.x; 4428 pswpNew->cx = 48; 4429 pswpClient->cy -= (aheight + 6L); 4430 pswpNew->y = pswpClient->y; 4431 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4432 sCount++; 4433 pswpNew = (PSWP) mp1 + (soldCount + 6 + 4434 (fToolbar != FALSE) + 4435 (fDrivebar != FALSE) + 4436 (fSplitStatus != FALSE) + 4437 (fAutoView != FALSE)); 4438 *pswpNew = *pswpClient; 4439 pswpNew->hwnd = hwndStatelist; 4440 pswpNew->x = swpClient.x + 48; 4441 pswpNew->cx = (swpClient.cx - 48) / 7; 4442 pswpNew->y = pswpClient->y; 4443 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4444 sCount++; 4445 pswpNew = (PSWP) mp1 + (soldCount + 7 + 4446 (fToolbar != FALSE) + 4447 (fDrivebar != FALSE) + 4448 (fSplitStatus != FALSE) + 4449 (fAutoView != FALSE)); 4450 *pswpNew = *pswpClient; 4451 pswpNew->hwnd = hwndCmdlist; 4452 pswpNew->x = swpClient.x + 48 + ((swpClient.cx - 48) / 7); 4453 pswpNew->cx = (swpClient.cx - 48) / 5 + 4454 ((swpClient.cx - 48) / 5) - ((swpClient.cx - 48) / 7); 4455 pswpNew->y = pswpClient->y; 4456 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4457 sCount++; 4458 pswpNew = (PSWP) mp1 + (soldCount + 8 + 4459 (fToolbar != FALSE) + 4460 (fDrivebar != FALSE) + 4461 (fSplitStatus != FALSE) + 4462 (fAutoView != FALSE)); 4463 *pswpNew = *pswpClient; 4464 pswpNew->hwnd = hwndUserlist; 4465 pswpNew->x = swpClient.x + 48 + (((swpClient.cx - 48) / 5) * 2); 4466 pswpNew->cx = ((swpClient.x + swpClient.cx) - pswpNew->x) - 4467 ((fToolbar) ? ((swpClient.cx - 48) / 7) : 0); 4468 pswpNew->y = pswpClient->y; 4469 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4470 sCount++; 4471 if (fToolbar) { 4472 pswpNew = (PSWP) mp1 + (soldCount + 9 + 4473 (fToolbar != FALSE) + 4474 (fDrivebar != FALSE) + 4475 (fSplitStatus != FALSE) + 4476 (fAutoView != FALSE)); 4477 *pswpNew = *pswpClient; 4478 pswpNew->hwnd = hwndButtonlist; 4479 pswpNew->x = swpClient.cx - ((swpClient.cx - 48) / 7) + 4; 4480 pswpNew->cx = (swpClient.x + swpClient.cx) - pswpNew->x; 4481 pswpNew->y = pswpClient->y; 4482 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4483 sCount++; 4484 } 4485 else 4486 WinShowWindow(hwndButtonlist, FALSE); 4437 4487 } 4438 4488 else { 4439 4440 4441 4442 4443 4489 WinShowWindow(hwndUserlist, FALSE); 4490 WinShowWindow(hwndDrivelist, FALSE); 4491 WinShowWindow(hwndStatelist, FALSE); 4492 WinShowWindow(hwndButtonlist, FALSE); 4493 WinShowWindow(hwndCmdlist, FALSE); 4444 4494 } 4445 4495 { 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4496 PSWP pswpTitlebar = (PSWP) 0, pswpMinbutton = (PSWP) 0; 4497 SHORT x; 4498 4499 pswpNew = (PSWP) mp1 + (soldCount + 5 + 4500 (fToolbar != FALSE) + 4501 (fDrivebar != FALSE) + 4502 (fSplitStatus != FALSE) + 4503 (fAutoView != FALSE) + 4504 ((fUserComboBox != FALSE) * 4) + 4505 (fUserComboBox != FALSE && 4506 fToolbar != FALSE)); 4507 pswp = (PSWP) mp1; 4508 for (x = 0; x < soldCount; x++) { 4509 if (!pswpTitlebar && 4510 WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_TITLEBAR) 4511 pswpTitlebar = pswp; 4512 else if (!pswpMinbutton && 4513 WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_MINMAX) 4514 pswpMinbutton = pswp; 4515 if (pswpTitlebar && pswpMinbutton) 4516 break; 4517 pswp++; 4518 } 4519 if (pswpMinbutton && pswpTitlebar) { 4520 *pswpNew = *pswpMinbutton; 4521 pswpNew->hwnd = WinWindowFromID(hwnd, IDM_IDEALSIZE); 4522 pswpNew->cy = pswpMinbutton->cy + 3; 4523 pswpNew->cx = min(pswpNew->cy, (pswpMinbutton->cx / 2) + 3); 4524 pswpTitlebar->cx -= (pswpNew->cx - 1); 4525 pswpNew->x = pswpTitlebar->x + (pswpTitlebar->cx); 4526 pswpNew->y = pswpMinbutton->y - 1; 4527 sCount++; 4528 } 4529 else 4530 WinShowWindow(WinWindowFromID(hwnd, IDM_IDEALSIZE), FALSE); 4481 4531 } 4482 4532 4483 4533 if (fMoreButtons) { 4484 4534 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4535 LONG lastx; 4536 4537 pswpNew = (PSWP) mp1 + (soldCount + 6 + 4538 (fToolbar != FALSE) + 4539 (fDrivebar != FALSE) + 4540 (fSplitStatus != FALSE) + 4541 (fAutoView != FALSE) + 4542 ((fUserComboBox != FALSE) * 4) + 4543 (fUserComboBox != FALSE && 4544 fToolbar != FALSE)); 4545 *pswpNew = *pswpClient; 4546 pswpNew->hwnd = hwndName; 4547 pswpNew->x = swpClient.x + 3; 4548 pswpNew->y = swpClient.y + (sheight + 6); 4549 pswpNew->cx = ((swpClient.cx / 2) + (swpClient.cx / 5)) - 3; 4550 lastx = pswpNew->x + pswpNew->cx; 4551 pswpNew->cy = bheight; 4552 pswpClient->y += (bheight + 4); 4553 pswpClient->cy -= (bheight + 4); 4554 sCount++; 4555 pswpNew = (PSWP) mp1 + (soldCount + 7 + 4556 (fToolbar != FALSE) + 4557 (fDrivebar != FALSE) + 4558 (fSplitStatus != FALSE) + 4559 (fAutoView != FALSE) + 4560 ((fUserComboBox != FALSE) * 4) + 4561 (fUserComboBox != FALSE && 4562 fToolbar != FALSE)); 4563 *pswpNew = *pswpClient; 4564 pswpNew->hwnd = hwndDate; 4565 pswpNew->x = lastx + 3; 4566 pswpNew->y = swpClient.y + (sheight + 6); 4567 pswpNew->cx = (swpClient.cx / 6) + (swpClient.cx / 16) - 3; 4568 lastx = pswpNew->x + pswpNew->cx; 4569 pswpNew->cy = bheight; 4570 sCount++; 4571 pswpNew = (PSWP) mp1 + (soldCount + 8 + 4572 (fToolbar != FALSE) + 4573 (fDrivebar != FALSE) + 4574 (fSplitStatus != FALSE) + 4575 (fAutoView != FALSE) + 4576 ((fUserComboBox != FALSE) * 4) + 4577 (fUserComboBox != FALSE && 4578 fToolbar != FALSE)); 4579 *pswpNew = *pswpClient; 4580 pswpNew->hwnd = hwndAttr; 4581 pswpNew->x = lastx + 3; 4582 pswpNew->y = swpClient.y + (sheight + 6); 4583 pswpNew->cx = (swpClient.cx - pswpNew->x) - 1; 4584 pswpNew->cy = bheight; 4585 sCount++; 4536 4586 } 4537 4587 else { 4538 4539 4540 4588 WinShowWindow(hwndAttr, FALSE); 4589 WinShowWindow(hwndName, FALSE); 4590 WinShowWindow(hwndDate, FALSE); 4541 4591 } 4542 4592 return MRFROMSHORT(sCount); … … 4551 4601 sCount += 6; 4552 4602 if (fSplitStatus) 4553 4603 sCount++; 4554 4604 if (fToolbar) 4555 4605 sCount++; 4556 4606 if (fUserComboBox) { 4557 4558 4559 4607 sCount += 4; 4608 if (fToolbar) 4609 sCount++; 4560 4610 } 4561 4611 if (fDrivebar) 4562 4612 sCount++; 4563 4613 if (fAutoView) 4564 4614 sCount++; 4565 4615 if (fMoreButtons) 4566 4616 sCount += 3; 4567 4617 return MRFROMSHORT(sCount); 4568 4618 } … … 4585 4635 // DbgMsg(pszSrcFile, __LINE__, "IDM_CONTEXTMENU %x", hwnd); 4586 4636 if (hwnd != NULLHANDLE) { 4587 4588 4589 4590 4591 4592 4593 4594 4595 4637 HWND hwndParent = WinQueryWindow(hwnd, QW_PARENT); 4638 USHORT id = WinQueryWindowUShort(hwndParent, QWS_ID); 4639 switch (id) { 4640 case MAIN_SETUPLIST: 4641 case MAIN_USERLIST: 4642 case MAIN_CMDLIST: 4643 // DbgMsg(pszSrcFile, __LINE__, "WM_CONTEXTMENU"); 4644 WinPostMsg(hwnd, WM_CONTEXTMENU, 0, 0); 4645 } 4596 4646 } 4597 4647 } … … 4622 4672 wa.size = sizeof(wa); 4623 4673 pci = 4624 4625 4626 4627 4628 4674 (PCNRITEM) 4675 WinSendMsg(WinWindowFromID 4676 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), 4677 CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST), 4678 MPFROMSHORT(CRA_CURSORED)); 4629 4679 if (pci && (INT) pci != -1) { 4630 4631 4680 strcpy(wa.szCurrentPath1, pci->pszFileName); 4681 MakeValidDir(wa.szCurrentPath1); 4632 4682 } 4633 4683 else 4634 4684 strcpy(wa.szCurrentPath1, pFM2SaveDirectory); 4635 4685 TopWindowName(hwndMain, (HWND) 0, wa.szCurrentPath2); 4636 4686 if (!*wa.szCurrentPath2) 4637 4687 strcpy(wa.szCurrentPath2, wa.szCurrentPath1); 4638 4688 MakeValidDir(wa.szCurrentPath2); 4639 4689 if (WinDlgBox(HWND_DESKTOP, 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 4690 hwnd, 4691 WalkTwoCmpDlgProc, 4692 FM3ModHandle, 4693 WALK2_FRAME, 4694 MPFROMP(&wa)) && 4695 !IsFile(wa.szCurrentPath1) && !IsFile(wa.szCurrentPath2)) { 4696 if (!*dircompare) { 4697 4698 COMPARE *cmp; 4699 4700 cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__); 4701 if (cmp) { 4702 cmp->size = sizeof(COMPARE); 4703 strcpy(cmp->leftdir, wa.szCurrentPath1); 4704 strcpy(cmp->rightdir, wa.szCurrentPath2); 4705 cmp->hwndParent = hwnd; 4706 cmp->dcd.hwndParent = hwnd; 4707 WinDlgBox(HWND_DESKTOP, 4708 HWND_DESKTOP, 4709 CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp)); 4710 } 4711 } 4712 else { 4713 4714 CHAR szPath1[CCHMAXPATH]; 4715 CHAR szPath2[CCHMAXPATH]; 4716 runemf2(SEPARATE, 4717 HWND_DESKTOP, pszSrcFile, __LINE__, 4718 NULL, NULL, 4719 "%s %s %s", 4720 dircompare, 4721 BldQuotedFileName(szPath1, wa.szCurrentPath1), 4722 BldQuotedFileName(szPath2, wa.szCurrentPath2)); 4723 } 4674 4724 } 4675 4725 } … … 4683 4733 case IDM_CLI: 4684 4734 if (fSplitStatus && 4685 4686 4687 4735 hwndStatus2 && 4736 !WinIsWindow(WinQueryAnchorBlock(hwnd), 4737 WinWindowFromID(hwndStatus2, COMMAND_LINE))) 4688 4738 PostMsg(hwndStatus2, UM_CLICKED, MPVOID, MPVOID); 4689 4739 break; … … 4698 4748 bstrip(temp); 4699 4749 if (*temp && 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4750 !DosQueryPathInfo(temp, FIL_QUERYFULLNAME, path, sizeof(path))) { 4751 if (SHORT1FROMMP(mp1) == IDM_ADDTOUSERLIST) { 4752 add_udir(TRUE, path); 4753 if (fUdirsChanged) 4754 save_udirs(); 4755 WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID); 4756 } 4757 else { 4758 if (!remove_udir(path)) 4759 Runtime_Error(pszSrcFile, __LINE__, "remove_udir"); 4760 else { 4761 if (fUdirsChanged) 4762 save_udirs(); 4763 WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID); 4764 } 4765 } 4716 4766 } 4717 4767 } … … 4728 4778 // Complain if attempting to use reserved name 4729 4779 if (stricmp(szStateName, GetPString(IDS_STATETEXT)) == 0 || 4730 4780 stricmp(szStateName, GetPString(IDS_FM2TEMPTEXT)) == 0) 4731 4781 { 4732 4733 4734 4782 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, 4783 GetPString(IDS_WARNINGTEXT), 4784 "\"%s\" is a reserved state name", szStateName); 4735 4785 } 4736 4786 // Ignore request if blank 4737 4787 else if (*szStateName) { 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4788 BOOL fAbortOperation = FALSE; 4789 if (!fNoSaveState && fSaveState && stricmp(szStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0) 4790 { 4791 if (saymsg(MB_YESNO | MB_DEFBUTTON2 | MB_ICONASTERISK, hwnd, 4792 GetPString(IDS_WARNINGTEXT), 4793 GetPString(IDS_SHUTDOWNSTATE_WARNING), szStateName) == MBID_NO) 4794 fAbortOperation = TRUE; 4795 } 4796 if (!fAbortOperation) { 4797 if (SHORT1FROMMP(mp1) == IDM_SAVEDIRCNRSTATE) { 4798 // Save 4799 INT nSaved = SaveDirCnrState(hwnd, szStateName); 4800 if (nSaved >= 0) { 4801 INT ret = add_setup(szStateName); 4802 if (ret == 0) { 4803 WinSendMsg(hwndStatelist, LM_INSERTITEM, 4804 MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(szStateName)); 4805 save_setups(); 4806 } 4807 else if (ret != 1) { 4808 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, 4809 GetPString(IDS_WARNINGTEXT), 4810 "\"%s\" state name add failed", szStateName); // 15 Apr 07 SHL failed 4811 WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT)); 4812 } 4813 } 4814 else { 4815 saymsg(MB_ENTER | MB_ICONASTERISK, 4816 hwnd, 4817 GetPString(IDS_WARNINGTEXT), 4818 "State data save failed"); 4819 WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT)); 4820 } 4821 } 4822 else { 4823 // Delete 4824 ULONG numsaves = 0, size, x; 4825 CHAR s[STATE_NAME_MAX_BYTES + 80]; 4826 4827 INT ret = remove_setup(szStateName); 4828 if (ret == 1) 4829 save_setups(); 4830 sprintf(s, "%s.NumDirsLastTime", szStateName); 4831 size = sizeof(ULONG); 4832 if (!PrfQueryProfileData(fmprof, 4833 FM3Str, 4834 s, 4835 (PVOID)&numsaves, 4836 &size)) { 4837 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, 4838 GetPString(IDS_WARNINGTEXT), 4839 GetPString(IDS_DOESNTEXISTTEXT), szStateName); 4840 } 4841 else if (!size) 4842 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 4843 else { 4844 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0L); 4845 for (x = 0; x < numsaves; x++) { 4846 sprintf(s, "%s.DirCnrPos.%lu", szStateName, x); 4847 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4848 sprintf(s, "%s.DirCnrDir.%lu", szStateName, x); 4849 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4850 sprintf(s, "%s.DirCnrSort.%lu", szStateName, x); 4851 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4852 sprintf(s, "%s.DirCnrFilter.%lu", szStateName, x); 4853 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4854 sprintf(s, "%s.DirCnrView.%lu", szStateName, x); 4855 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4856 sprintf(s, "%s.DirCnr.%lu.DetailsLongname", szStateName, x); 4857 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4858 sprintf(s, "%s.DirCnr.%lu.DetailsSubject", szStateName, x); 4859 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4860 sprintf(s, "%s.DirCnr.%lu.DetailsSize", szStateName, x); 4861 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4862 sprintf(s, "%s.DirCnr.%lu.DetailsEA", szStateName, x); 4863 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4864 sprintf(s, "%s.DirCnr.%lu.DetailsAttr", szStateName, x); 4865 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4866 sprintf(s, "%s.DirCnr.%lu.DetailsIcon", szStateName, x); 4867 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4868 sprintf(s, "%s.DirCnr.%lu.DetailsLWDate", szStateName, x); 4869 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4870 sprintf(s, "%s.DirCnr.%lu.DetailsLWTime", szStateName, x); 4871 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4872 sprintf(s, "%s.DirCnr.%lu.DetailsLADate", szStateName, x); 4873 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4874 sprintf(s, "%s.DirCnr.%lu.DetailsLATime", szStateName, x); 4875 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4876 sprintf(s, "%s.DirCnr.%lu.DetailsCRDate", szStateName, x); 4877 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4878 sprintf(s, "%s.DirCnr.%lu.DetailsCRTime", szStateName, x); 4879 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4880 sprintf(s, "%s.DirCnr.%lu.Backgroundcolor", szStateName, x); 4881 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4882 sprintf(s, "%s.DirCnr.%lu.Fontnamesize", szStateName, x); 4883 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4884 } 4885 sprintf(s, "%s.LastTreePos", szStateName); 4886 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4887 sprintf(s, "%s.MySizeLastTime", szStateName); 4888 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4889 } 4890 PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID); 4891 } 4892 } 4843 4893 } 4844 4894 } … … 4853 4903 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp); 4854 4904 if (swp.fl & SWP_MAXIMIZE) { 4855 4856 4857 4905 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_SYSCOMMAND, 4906 MPFROM2SHORT(SC_RESTORE, 0), MPVOID); 4907 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp); 4858 4908 } 4859 4909 WinGetMaxPosition(WinQueryWindow(hwnd, QW_PARENT), &swpD); … … 4863 4913 swpD.cy -= (icz + bsz); 4864 4914 if (swp.x == swpD.x && swp.y == swpD.y && 4865 4866 4867 4868 4869 4870 4871 4872 4915 swp.cx == swpD.cx && swp.cy == swpD.cy && 4916 // fixme to be #defined someday 4917 WinQueryWindowUShort(hwnd, QWL_USER + 10) && 4918 WinQueryWindowUShort(hwnd, QWL_USER + 14)) { 4919 swpD.x = WinQueryWindowUShort(hwnd, QWL_USER + 8); 4920 swpD.cx = WinQueryWindowUShort(hwnd, QWL_USER + 10); 4921 swpD.y = WinQueryWindowUShort(hwnd, QWL_USER + 12); 4922 swpD.cy = WinQueryWindowUShort(hwnd, QWL_USER + 14); 4873 4923 } 4874 4924 else { 4875 4876 4877 4878 4925 WinSetWindowUShort(hwnd, QWL_USER + 8, (USHORT) swp.x); 4926 WinSetWindowUShort(hwnd, QWL_USER + 10, (USHORT) swp.cx); 4927 WinSetWindowUShort(hwnd, QWL_USER + 12, (USHORT) swp.y); 4928 WinSetWindowUShort(hwnd, QWL_USER + 14, (USHORT) swp.cy); 4879 4929 } 4880 4930 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 4881 4931 swpD.x, swpD.y, swpD.cx, swpD.cy, SWP_MOVE | SWP_SIZE); 4882 4932 } 4883 4933 break; … … 4885 4935 case IDM_BLINK: 4886 4936 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0, 4887 4937 SWP_MINIMIZE); 4888 4938 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0, 4889 4939 SWP_RESTORE | SWP_ZORDER); 4890 4940 break; 4891 4941 … … 4895 4945 4896 4946 if (hwndTop) 4897 4947 WinSetFocus(HWND_DESKTOP, hwndTop); 4898 4948 } 4899 4949 break; … … 4917 4967 case IDM_QUICKSETTINGS: 4918 4968 WinDlgBox(HWND_DESKTOP, 4919 4969 hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMLONG(mp1)); 4920 4970 break; 4921 4971 … … 4923 4973 case IDM_VIEWINFS: 4924 4974 WinDlgBox(HWND_DESKTOP, 4925 4926 4927 4928 4929 4930 4975 HWND_DESKTOP, 4976 ViewInfProc, 4977 FM3ModHandle, 4978 VINF_FRAME, 4979 ((SHORT1FROMMP(mp1) == IDM_VIEWHELPS) ? 4980 MPFROMP(NullStr) : MPVOID)); 4931 4981 break; 4932 4982 … … 4938 4988 TopWindowName(hwnd, (HWND) 0, newpath); 4939 4989 if (WinDlgBox(HWND_DESKTOP, 4940 4941 4942 4943 4990 hwnd, 4991 WalkAllDlgProc, 4992 FM3ModHandle, WALK_FRAME, MPFROMP(newpath)) && *newpath) 4993 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, newpath); 4944 4994 } 4945 4995 break; … … 4962 5012 if (SHORT1FROMMP(mp2) == CMDSRC_MENU) { 4963 5013 4964 4965 4966 4967 4968 4969 4970 4971 4972 5014 RECTL rcl; 5015 ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2L; 5016 5017 WinQueryWindowRect(HWND_DESKTOP, &rcl); 5018 rcl.yBottom += icz; 5019 rcl.yTop -= icz; 5020 rcl.xLeft += icz; 5021 rcl.xRight -= icz; 5022 WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID); 4973 5023 } 4974 5024 else { 4975 5025 4976 4977 4978 4979 4980 4981 4982 4983 5026 RECTL rcl; 5027 5028 WinQueryWindowRect(HWND_DESKTOP, &rcl); 5029 rcl.yBottom += 8; 5030 rcl.yTop = (rcl.yTop / 2) + (rcl.yTop / 7); 5031 rcl.xLeft = (rcl.xRight / 2) - (rcl.xRight / 7); 5032 rcl.xRight -= 8; 5033 WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID); 4984 5034 } 4985 5035 switch (SHORT1FROMMP(mp1)) { 4986 5036 case IDM_HELPCONTEXT: 4987 4988 4989 5037 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 5038 MPFROM2SHORT(HELP_CONTEXT, 0), MPFROMSHORT(HM_RESOURCEID)); 5039 break; 4990 5040 4991 5041 case IDM_HELPMOUSE: 4992 4993 4994 4995 5042 if (hwndHelp) 5043 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 5044 MPFROM2SHORT(HELP_MOUSE, 0), MPFROMSHORT(HM_RESOURCEID)); 5045 break; 4996 5046 4997 5047 case IDM_HELPPIX: 4998 4999 5000 5048 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 5049 MPFROM2SHORT(HELP_BITMAP1, 0), MPFROMSHORT(HM_RESOURCEID)); 5050 break; 5001 5051 5002 5052 case IDM_HELPTUTOR: 5003 5004 5005 5006 5053 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 5054 MPFROM2SHORT(HELP_TUTORIAL, 0), 5055 MPFROMSHORT(HM_RESOURCEID)); 5056 break; 5007 5057 5008 5058 case IDM_HELPHINTS: 5009 5010 5011 5059 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 5060 MPFROM2SHORT(HELP_HINTS, 0), MPFROMSHORT(HM_RESOURCEID)); 5061 break; 5012 5062 5013 5063 case IDM_HELPGENERAL: 5014 5015 5016 5064 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 5065 MPFROM2SHORT(HELP_MAIN, 0), MPFROMSHORT(HM_RESOURCEID)); 5066 break; 5017 5067 case IDM_HELPKEYS: 5018 5019 5020 5068 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 5069 MPFROM2SHORT(HELP_KEYS, 0), MPFROMSHORT(HM_RESOURCEID)); 5070 break; 5021 5071 5022 5072 case IDM_HELP: 5023 5073 case IDM_HELPCONTENTS: 5024 5025 5074 WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID); 5075 break; 5026 5076 5027 5077 case IDM_HELPUSERLIST: 5028 5029 5030 5031 5078 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 5079 MPFROM2SHORT(HELP_USERLISTS, 0), 5080 MPFROMSHORT(HM_RESOURCEID)); 5081 break; 5032 5082 } 5033 5083 } … … 5040 5090 case IDM_ABOUT: 5041 5091 WinDlgBox(HWND_DESKTOP, hwnd, AboutDlgProc, FM3ModHandle, 5042 5092 ABT_FRAME, MPVOID); 5043 5093 break; 5044 5094 … … 5054 5104 5055 5105 if (!DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_MINOR, 5056 5057 5058 5059 5060 5061 5062 5106 (PVOID) & version, (ULONG) sizeof(version))) { 5107 if (version[0] > 20L || (version[0] == 20L && version[1] > 29L)) { 5108 if (SHORT1FROMMP(mp1) == IDM_HICOLORPALETTE) 5109 palette = "<WP_HIRESCLRPAL>"; 5110 else 5111 palette = "<WP_LORESCLRPAL>"; 5112 } 5063 5113 } 5064 5114 OpenObject(palette, Default, hwnd); … … 5076 5126 hWPSObject = WinQueryObject("<WP_SCHPAL>"); 5077 5127 if (hWPSObject != NULLHANDLE) 5078 5079 5080 5081 5128 WinSetObjectData(hWPSObject, "SCHEMES=Winter:PM_Winter," 5129 "Spring:PM_Spring,Summer:PM_Summer," 5130 "System:PM_System,Windows:PM_Windows;" 5131 "OPEN=DEFAULT"); 5082 5132 } 5083 5133 break; … … 5090 5140 case IDM_SYSINFO: 5091 5141 WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, SysInfoDlgProc, FM3ModHandle, 5092 5142 SYS_FRAME, NULL); 5093 5143 break; 5094 5144 #endif … … 5100 5150 5101 5151 if (hwndTree) 5102 5103 5104 5152 pci = (PCNRITEM) WinSendMsg(hwndTree, CM_QUERYRECORDEMPHASIS, 5153 MPFROMLONG(CMA_FIRST), 5154 MPFROMSHORT(CRA_CURSORED)); 5105 5155 if (pci && (INT) pci != -1) { 5106 5107 5156 strcpy(path, pci->pszFileName); 5157 MakeValidDir(path); 5108 5158 } 5109 5159 else 5110 5160 strcpy(path, pFM2SaveDirectory); 5111 5161 WinDlgBox(HWND_DESKTOP, hwnd, InstantDlgProc, FM3ModHandle, 5112 5162 BAT_FRAME, MPFROMP(path)); 5113 5163 } 5114 5164 break; … … 5124 5174 TopWindowName(hwnd, (HWND) 0, path); 5125 5175 if (SHORT1FROMMP(mp1) == IDM_DOSCOMMANDLINE) 5126 5176 env = GetCmdSpec(TRUE); 5127 5177 else if (SHORT1FROMMP(mp1) != IDM_COMMANDLINE) { 5128 5129 5178 env = "WINOS2.COM"; 5179 type = SEPARATE | FULLSCREEN; 5130 5180 } 5131 5181 runemf2(type, hwnd, pszSrcFile, __LINE__, 5132 5182 path, NULL, "%s", env); 5133 5183 } 5134 5184 break; … … 5136 5186 case IDM_KILLPROC: 5137 5187 WinDlgBox(HWND_DESKTOP, hwnd, KillDlgProc, FM3ModHandle, 5138 5188 KILL_FRAME, NULL); 5139 5189 break; 5140 5190 … … 5151 5201 case IDM_AUTOVIEW: 5152 5202 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 5153 5203 &fAutoView, TRUE, "AutoView"); 5154 5204 AutoChange: 5155 5205 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 5156 5206 MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5157 5207 if (fAutoView) { 5158 5208 … … 5163 5213 hwndDir = TopWindowName(hwnd, (HWND) 0, s); 5164 5214 if (hwndDir) { 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5215 hwndDir = WinWindowFromID(hwndDir, FID_CLIENT); 5216 if (hwndDir) { 5217 hwndDir = WinWindowFromID(hwndDir, DIR_CNR); 5218 if (hwndDir) { 5219 pci = (PCNRITEM) WinSendMsg(hwndDir, CM_QUERYRECORDEMPHASIS, 5220 MPFROMLONG(CMA_FIRST), 5221 MPFROMSHORT(CRA_CURSORED)); 5222 if (pci && (INT) pci != -1 && 5223 (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW))) 5224 WinSendMsg(hwnd, 5225 UM_LOADFILE, 5226 MPFROMP(pci->pszFileName), 5227 (SHORT1FROMMP(mp1) == IDM_AUTOVIEW) ? 5228 MPVOID : MPFROMLONG(1)); 5229 } 5230 } 5181 5231 } 5182 5232 } … … 5185 5235 case IDM_TEXTTOOLS: 5186 5236 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 5187 5237 &fTextTools, TRUE, "TextTools"); 5188 5238 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 5189 5239 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 5190 5240 MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5191 5241 break; 5192 5242 5193 5243 case IDM_TOOLTITLES: 5194 5244 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 5195 5245 &fToolTitles, TRUE, "ToolTitles"); 5196 5246 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 5197 5247 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 5198 5248 MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5199 5249 break; 5200 5250 … … 5204 5254 MenuInvisible = MenuInvisible ? FALSE : TRUE; 5205 5255 if (MenuInvisible) { 5206 5207 5208 5209 5256 WinSetParent(hwndMenu, HWND_OBJECT, FALSE); 5257 WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5258 FID_SYSMENU), IDM_HIDEMENU, 5259 GetPString(IDS_UNHIDEMENUTEXT)); 5210 5260 } 5211 5261 else { 5212 5213 5214 5215 5262 WinSetParent(hwndMenu, WinQueryWindow(hwnd, QW_PARENT), FALSE); 5263 WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5264 FID_SYSMENU), IDM_HIDEMENU, 5265 GetPString(IDS_HIDEMENUTEXT)); 5216 5266 } 5217 5267 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 5218 5268 MPFROMLONG(FCF_MENU), MPVOID); 5219 5269 PrfWriteProfileData(fmprof, FM3Str, "MenuInvisible", 5220 5270 &MenuInvisible, sizeof(BOOL)); 5221 5271 } 5222 5272 break; … … 5231 5281 5232 5282 if (Collector) 5233 5283 already = TRUE; 5234 5284 if (!already && !fAutoTile && !fExternalCollector) 5235 5285 GetNextWindowPos(hwnd, &swp, NULL, NULL); 5236 5286 hwndC = StartCollector(fExternalCollector ? HWND_DESKTOP : hwnd, 4); 5237 5287 if (hwndC) { 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5288 if (!already && !fAutoTile && !fExternalCollector) 5289 WinSetWindowPos(hwndC, HWND_TOP, 5290 swp.x, swp.y, swp.cx, swp.cy, 5291 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER); 5292 else if (fAutoTile && !already) 5293 TileChildren(hwnd, TRUE); 5294 WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE | 5295 SWP_ACTIVATE); 5296 if (SHORT1FROMMP(mp1) == IDM_GREP) 5297 PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND, 5298 MPFROM2SHORT(IDM_GREP, 0), MPVOID); 5299 if (SHORT1FROMMP(mp1) == IDM_SEEALL) 5300 PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND, 5301 MPFROM2SHORT(IDM_SEEALL, 0), MPVOID); 5252 5302 } 5253 5303 } … … 5260 5310 5261 5311 if (!toolhead || !toolhead->next) { 5262 5263 5312 firsttool = (toolhead) ? toolhead->id : 0; 5313 break; 5264 5314 } 5265 5315 tool = find_tool(firsttool); 5266 5316 if (!tool) 5267 5317 tool = toolhead; 5268 5318 if (SHORT1FROMMP(mp1) == IDM_TOOLRIGHT) { 5269 5270 5319 tool = prev_tool(tool, TRUE); 5320 firsttool = tool->id; 5271 5321 } 5272 5322 else { 5273 5274 5323 tool = next_tool(tool, TRUE); 5324 firsttool = tool->id; 5275 5325 } 5276 5326 ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5277 5327 MAIN_TOOLS)); 5278 5328 } 5279 5329 break; … … 5285 5335 case IDM_TOOLBAR: 5286 5336 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5287 5337 IDM_TOOLSUBMENU, &fToolbar, TRUE, "Toolbar"); 5288 5338 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 5289 5339 WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5290 5340 MAIN_TOOLS), fToolbar); 5291 5341 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), 5292 5342 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5293 5343 if (fDrivebar) 5294 5344 WinInvalidateRect(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5295 5345 MAIN_DRIVES), NULL, TRUE); 5296 5346 break; 5297 5347 5298 5348 case IDM_DRIVEBAR: 5299 5349 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5300 5350 IDM_DRIVEBAR, &fDrivebar, TRUE, "Drivebar"); 5301 5351 WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5302 5352 MAIN_DRIVES), fDrivebar); 5303 5353 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 5304 5354 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5305 5355 PostMsg(hwnd, UM_BUILDDRIVEBAR, MPVOID, MPVOID); 5306 5356 break; … … 5308 5358 case IDM_USERLIST: 5309 5359 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5310 5360 SHORT1FROMMP(mp1), &fUserComboBox, TRUE, "UserComboBox"); 5311 5361 WinShowWindow(hwndUserlist, fUserComboBox); 5312 5362 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 5313 5363 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5314 5364 PostMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID); 5315 5365 PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID); … … 5323 5373 WinSetWindowText(hwndAttr, NullStr); 5324 5374 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5325 5375 SHORT1FROMMP(mp1), &fMoreButtons, TRUE, "MoreButtons"); 5326 5376 if (fMoreButtons) { 5327 5377 … … 5331 5381 5332 5382 if (hwndTemp) { 5333 5334 5383 WinSetFocus(HWND_DESKTOP, hwnd); 5384 WinSetFocus(HWND_DESKTOP, hwndTemp); 5335 5385 } 5336 5386 } 5337 5387 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 5338 5388 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5339 5389 break; 5340 5390 5341 5391 case IDM_TOGGLEDRAGDIALOG: 5342 5392 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5343 5344 5345 5346 5393 IDM_TOGGLEDRAGDIALOG, 5394 &fDragndropDlg, 5395 TRUE, 5396 "Drag&DropDlg"); 5347 5397 break; 5348 5398 5349 5399 case IDM_SYNCUPDATES: 5350 5400 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5351 5352 5353 5354 5401 IDM_SYNCUPDATES, 5402 &fSyncUpdates, 5403 TRUE, 5404 "SyncUpdates"); 5355 5405 break; 5356 5406 … … 5362 5412 WinQueryWindowPos(hwnd, &swp); 5363 5413 WinSetWindowPos(hwndTree, HWND_TOP, 0, swp.cy - swpT.cy, 0, 0, 5364 5414 SWP_MOVE); 5365 5415 } 5366 5416 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 5367 5417 &fFreeTree, TRUE, "FreeTree"); 5368 5418 if (fAutoTile) 5369 5419 TileChildren(hwnd, TRUE); … … 5372 5422 case IDM_AUTOTILE: 5373 5423 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5374 5424 SHORT1FROMMP(mp1), &fAutoTile, TRUE, "AutoTile"); 5375 5425 if (fAutoTile) 5376 5426 TileChildren(hwnd, TRUE); … … 5379 5429 case IDM_TILEBACKWARDS: 5380 5430 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5381 5431 SHORT1FROMMP(mp1), &fTileBackwards, TRUE, "TileBackwards"); 5382 5432 if (fAutoTile) 5383 5433 TileChildren(hwnd, TRUE); … … 5424 5474 default: 5425 5475 if (!SwitchCommand((HWND) WinQueryWindowULong(hwnd, QWL_USER), 5426 5476 SHORT1FROMMP(mp1))) { 5427 5477 if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART && 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5478 SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) { 5479 5480 INT x; 5481 HWND hwndCnr; 5482 5483 if (!cmdloaded) 5484 load_commands(); 5485 hwndCnr = TopWindow(hwnd, (HWND) 0); 5486 hwndCnr = (HWND) WinSendMsg(WinWindowFromID(hwndCnr, FID_CLIENT), 5487 UM_CONTAINERHWND, MPVOID, MPVOID); 5488 if (!hwndCnr) { 5489 Runtime_Error2(pszSrcFile, __LINE__, IDS_NOWINDOWTEXT); 5490 break; 5491 } 5492 x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART; 5493 if (x >= 0) { 5494 x++; 5495 RunCommand(hwndCnr, x); 5496 if (fUnHilite) { 5497 5498 PCNRITEM pci; 5499 DIRCNRDATA *dcd = NULL; 5500 5501 // 12 May 07 SHL fixme to understand? backwards maybe? looking for DIR_CNR? 5502 if (WinQueryWindowUShort(hwndCnr, QWS_ID) != TREE_CNR) 5503 dcd = INSTDATA(hwndCnr); 5504 pci = (PCNRITEM) WinSendMsg(hwndCnr, 5505 CM_QUERYRECORDEMPHASIS, 5506 MPFROMLONG(CMA_FIRST), 5507 MPFROMSHORT(CRA_CURSORED)); 5508 if (pci && (INT) pci != -1 && 5509 (pci->rc.flRecordAttr & CRA_SELECTED)) 5510 { 5511 UnHilite(hwnd, 5512 TRUE, 5513 dcd ? &dcd->lastselection : NULL, 5514 dcd ? dcd ->ulItemsToUnHilite : 0); 5515 } 5516 } 5517 } 5468 5518 } 5469 5519 else if (SHORT1FROMMP(mp1) >= IDM_QUICKTOOLSTART && 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5520 SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART + 51) { 5521 if (!qtloaded) 5522 load_quicktools(); 5523 if (quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]) { 5524 if (fToolsChanged) 5525 save_tools(NULL); 5526 if (!load_tools(quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1])) 5527 load_tools(NULL); 5528 else { 5529 strcpy(lasttoolbar, 5530 quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]); 5531 PrfWriteProfileString(fmprof, FM3Str, "LastToolbar", lasttoolbar); 5532 } 5533 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 5534 } 5485 5535 } 5486 5536 else { 5487 5537 5488 5489 5490 5491 5492 5493 5538 HWND hwndActive; 5539 5540 hwndActive = TopWindow(hwnd, (HWND) 0); 5541 if (hwndActive) 5542 PostMsg(WinWindowFromID(hwndActive, FID_CLIENT), 5543 WM_COMMAND, mp1, mp2); 5494 5544 } 5495 5545 } … … 5500 5550 5501 5551 static MRESULT EXPENTRY MainWMOnce(HWND hwnd, ULONG msg, MPARAM mp1, 5502 5552 MPARAM mp2) 5503 5553 { 5504 5554 TID tid; … … 5523 5573 if (_beginthread(MakeMainObjWin, NULL, 245760, MPVOID) == -1) { 5524 5574 Runtime_Error(pszSrcFile, __LINE__, 5525 5575 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 5526 5576 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID); 5527 5577 return 0; … … 5542 5592 5543 5593 if (!WinCreateWindow(hwndFrame, 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5594 WC_BUTTON, 5595 "I", 5596 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, 5597 ((swp.cx - 5598 WinQuerySysValue(HWND_DESKTOP, 5599 SV_CXMINMAXBUTTON)) - 5600 WinQuerySysValue(HWND_DESKTOP, 5601 SV_CXMINMAXBUTTON) / 2) - 5602 WinQuerySysValue(HWND_DESKTOP, 5603 SV_CXSIZEBORDER), 5604 (swp.cy - WinQuerySysValue(HWND_DESKTOP, 5605 SV_CYMINMAXBUTTON)) - 5606 WinQuerySysValue(HWND_DESKTOP, 5607 SV_CYSIZEBORDER), 5608 WinQuerySysValue(HWND_DESKTOP, 5609 SV_CXMINMAXBUTTON) / 2, 5610 WinQuerySysValue(HWND_DESKTOP, 5611 SV_CYMINMAXBUTTON), 5612 hwnd, HWND_TOP, IDM_IDEALSIZE, NULL, NULL)) { 5563 5613 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5564 5614 } 5565 5615 else { 5566 5616 WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_IDEALSIZE), 5567 5617 IdealButtonProc); 5568 5618 SetPresParams(WinWindowFromID(hwndFrame, 5569 5570 5619 IDM_IDEALSIZE), 5620 NULL, NULL, NULL, GetPString(IDS_10SYSTEMVIOTEXT)); 5571 5621 } 5572 5622 5573 5623 hwndTmp = WinCreateWindow(hwndFrame, 5574 5575 5576 5577 5578 5579 5580 5581 5624 WC_BUTTON, 5625 "#1019", 5626 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS | 5627 BS_BITMAP, 5628 swp.cx - 46, 5629 swp.y + 2, 5630 24, 5631 22, hwnd, HWND_TOP, IDM_OPENWALK, NULL, NULL); 5582 5632 if (!hwndTmp) 5583 5633 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5584 5634 5585 5635 hwndTmp = WinCreateWindow(hwndFrame, 5586 5587 5588 5589 5590 5591 5592 5593 5636 WC_BUTTON, 5637 "#3062", 5638 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS | 5639 BS_BITMAP, 5640 swp.cx - 22, 5641 swp.y + 2, 5642 24, 5643 22, hwnd, HWND_TOP, IDM_USERLIST, NULL, NULL); 5594 5644 if (!hwndTmp) 5595 5645 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5596 5646 5597 5647 hwndUserlist = WinCreateWindow(hwndFrame, 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5648 WC_COMBOBOX, 5649 (PSZ) NULL, 5650 WS_VISIBLE | CBS_DROPDOWN | 5651 LS_HORZSCROLL, 5652 (swp.x + 5653 WinQuerySysValue(HWND_DESKTOP, 5654 SV_CXSIZEBORDER) + 48L), 5655 (swp.cy - 5656 WinQuerySysValue(HWND_DESKTOP, 5657 SV_CYSIZEBORDER)) - 60, 5658 ((swp.cx - 5659 (WinQuerySysValue(HWND_DESKTOP, 5660 SV_CXSIZEBORDER) * 5661 2)) - 64L), 60L, hwndFrame, HWND_TOP, 5662 MAIN_USERLIST, NULL, NULL); 5613 5663 if (!hwndUserlist) 5614 5664 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5615 5665 hwndCmdlist = WinCreateWindow(hwndFrame, 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5666 WC_COMBOBOX, 5667 (PSZ) NULL, 5668 WS_VISIBLE | CBS_DROPDOWN | 5669 LS_HORZSCROLL, 5670 (swp.x + 5671 WinQuerySysValue(HWND_DESKTOP, 5672 SV_CXSIZEBORDER) + 48L), 5673 (swp.cy - 5674 WinQuerySysValue(HWND_DESKTOP, 5675 SV_CYSIZEBORDER)) - 60, 5676 ((swp.cx - 5677 (WinQuerySysValue(HWND_DESKTOP, 5678 SV_CXSIZEBORDER) * 2)) - 5679 64L), 60L, hwndFrame, HWND_TOP, 5680 MAIN_CMDLIST, NULL, NULL); 5631 5681 if (!hwndCmdlist) 5632 5682 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5633 5683 WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT)); 5634 5684 hwndStatelist = WinCreateWindow(hwndFrame, 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5685 WC_COMBOBOX, 5686 (PSZ) NULL, 5687 WS_VISIBLE | CBS_DROPDOWN | 5688 LS_HORZSCROLL, 5689 (swp.x + 5690 WinQuerySysValue(HWND_DESKTOP, 5691 SV_CXSIZEBORDER) + 48L), 5692 (swp.cy - 5693 WinQuerySysValue(HWND_DESKTOP, 5694 SV_CYSIZEBORDER)) - 60, 5695 ((swp.cx - 5696 (WinQuerySysValue(HWND_DESKTOP, 5697 SV_CXSIZEBORDER) * 5698 2)) - 64L), 60L, hwndFrame, HWND_TOP, 5699 MAIN_SETUPLIST, NULL, NULL); 5650 5700 if (!hwndStatelist) 5651 5701 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5652 5702 5653 5703 hwndDrivelist = WinCreateWindow(hwndFrame, 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5704 WC_COMBOBOX, 5705 (PSZ) NULL, 5706 WS_VISIBLE | CBS_DROPDOWN, 5707 (swp.x + 5708 WinQuerySysValue(HWND_DESKTOP, 5709 SV_CXSIZEBORDER)), 5710 (swp.cy - 5711 WinQuerySysValue(HWND_DESKTOP, 5712 SV_CYSIZEBORDER)) - 60, 5713 48L, 5714 60L, 5715 hwndFrame, 5716 HWND_TOP, MAIN_DRIVELIST, NULL, NULL); 5667 5717 if (!hwndDrivelist) 5668 5718 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5669 5719 SetPresParams(hwndDrivelist, 5670 5720 NULL, NULL, NULL, GetPString(IDS_10SYSTEMMONOTEXT)); 5671 5721 hwndButtonlist = WinCreateWindow(hwndFrame, 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5722 WC_COMBOBOX, 5723 (PSZ) NULL, 5724 WS_VISIBLE | CBS_DROPDOWN | 5725 LS_HORZSCROLL, 5726 (swp.cx - 5727 WinQuerySysValue(HWND_DESKTOP, 5728 SV_CXSIZEBORDER)) - 5729 164L, 5730 (swp.cy - 5731 WinQuerySysValue(HWND_DESKTOP, 5732 SV_CYSIZEBORDER)) - 60, 5733 164L, 60L, hwndFrame, HWND_TOP, 5734 MAIN_BUTTONLIST, NULL, NULL); 5685 5735 if (!hwndButtonlist) 5686 5736 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5687 5737 WinSendMsg(WinWindowFromID(hwndUserlist, CBID_EDIT), 5688 5738 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 5689 5739 WinSendMsg(WinWindowFromID(hwndStatelist, CBID_EDIT), 5690 5740 EM_SETTEXTLIMIT, MPFROM2SHORT(STATE_NAME_MAX_BYTES, 0), MPVOID); 5691 5741 WinSendMsg(WinWindowFromID(hwndDrivelist, CBID_EDIT), 5692 5742 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID); 5693 5743 WinSendMsg(WinWindowFromID(hwndButtonlist, CBID_EDIT), 5694 5744 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID); 5695 5745 WinSendMsg(WinWindowFromID(hwndCmdlist, CBID_EDIT), 5696 5746 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID); 5697 5747 5698 5748 oldproc = WinSubclassWindow(WinWindowFromID(hwndUserlist, CBID_EDIT), 5699 5749 DropDownListProc); 5700 5750 WinSetWindowPtr(WinWindowFromID(hwndUserlist, CBID_EDIT), 5701 5751 QWL_USER, (PVOID) oldproc); 5702 5752 oldproc = WinSubclassWindow(WinWindowFromID(hwndCmdlist, CBID_EDIT), 5703 5753 DropDownListProc); 5704 5754 WinSetWindowPtr(WinWindowFromID(hwndCmdlist, CBID_EDIT), 5705 5755 QWL_USER, (PVOID) oldproc); 5706 5756 oldproc = WinSubclassWindow(WinWindowFromID(hwndButtonlist, CBID_EDIT), 5707 5757 DropDownListProc); 5708 5758 WinSetWindowPtr(WinWindowFromID(hwndButtonlist, CBID_EDIT), 5709 5759 QWL_USER, (PVOID) oldproc); 5710 5760 oldproc = WinSubclassWindow(WinWindowFromID(hwndStatelist, CBID_EDIT), 5711 5761 DropDownListProc); 5712 5762 WinSetWindowPtr(WinWindowFromID(hwndStatelist, CBID_EDIT), 5713 5763 QWL_USER, (PVOID) oldproc); 5714 5764 oldproc = WinSubclassWindow(WinWindowFromID(hwndDrivelist, CBID_EDIT), 5715 5765 DropDownListProc); 5716 5766 WinSetWindowPtr(WinWindowFromID(hwndDrivelist, CBID_EDIT), 5717 5767 QWL_USER, (PVOID) oldproc); 5718 5768 oldproc = WinSubclassWindow(hwndUserlist, DropDownListProc); 5719 5769 WinSetWindowPtr(hwndUserlist, QWL_USER, (PVOID) oldproc); … … 5727 5777 WinSetWindowPtr(hwndButtonlist, QWL_USER, (PVOID) oldproc); 5728 5778 oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_USERLIST), 5729 5779 ChildFrameButtonProc); 5730 5780 WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_USERLIST), 5731 5781 QWL_USER, (PVOID) oldproc); 5732 5782 oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_OPENWALK), 5733 5783 ChildFrameButtonProc); 5734 5784 WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_OPENWALK), 5735 5785 QWL_USER, (PVOID) oldproc); 5736 5786 hwndMenu = WinWindowFromID(hwndFrame, FID_MENU); 5737 5787 WinSendMsg(hwnd, UM_ADDTOMENU, MPVOID, MPVOID); … … 5747 5797 hwndSysMenu = WinWindowFromID(hwndFrame, FID_SYSMENU); 5748 5798 idSysMenu = SHORT1FROMMR(WinSendMsg(hwndSysMenu, 5749 5750 5799 MM_ITEMIDFROMPOSITION, 5800 MPVOID, MPVOID)); 5751 5801 WinSendMsg(hwndSysMenu, 5752 5802 MM_QUERYITEM, MPFROM2SHORT(idSysMenu, 0), MPFROMP(&mit)); 5753 5803 hwndSysSubMenu = mit.hwndSubMenu; 5754 5804 mi.iPosition = MIT_END; … … 5759 5809 mi.id = IDM_IDEALSIZE; 5760 5810 WinSendMsg(hwndSysSubMenu, 5761 5762 5811 MM_INSERTITEM, 5812 MPFROMP(&mi), MPFROMP(GetPString(IDS_IDEALMENUTEXT))); 5763 5813 mi.afStyle = MIS_TEXT; 5764 5814 mi.id = IDM_HIDEMENU; 5765 5815 WinSendMsg(hwndSysSubMenu, 5766 5767 5816 MM_INSERTITEM, 5817 MPFROMP(&mi), MPFROMP(GetPString(IDS_HIDEMENUTEXT))); 5768 5818 SetSysMenu(hwndSysMenu); 5769 5819 5770 5820 size = sizeof(BOOL); 5771 5821 if (PrfQueryProfileData(fmprof, 5772 5773 5822 FM3Str, 5823 "MenuInvisible", &temp, &size) && size && temp) 5774 5824 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID); 5775 5825 size = sizeof(BOOL); 5776 5826 if (PrfQueryProfileData(fmprof, 5777 5827 FM3Str, "FreeTree", &temp, &size) && size && temp) 5778 5828 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_FREETREE, 0), MPVOID); 5779 5829 size = sizeof(BOOL); 5780 5830 if (PrfQueryProfileData(fmprof, 5781 5782 5831 FM3Str, 5832 "AutoTile", &temp, &size) && size && !temp) 5783 5833 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_AUTOTILE, 0), MPVOID); 5784 5834 size = sizeof(BOOL); 5785 5835 if (PrfQueryProfileData(fmprof, 5786 5836 FM3Str, "Toolbar", &temp, &size) && size && !temp) 5787 5837 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID); 5788 5838 … … 5807 5857 hwndTree = StartTreeCnr(hwnd, 4); 5808 5858 if (!hwndTree) 5809 5859 WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT)); 5810 5860 else { 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5861 if (!fSaveState || 5862 !PrfQueryProfileData(fmprof, 5863 FM3Str, 5864 "LastTreePos", 5865 &swp, &size) || size != sizeof(SWP)) { 5866 5867 INT ratio, height = 0; 5868 5869 if (!fNoTreeGap) 5870 height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2; 5871 size = sizeof(ratio); 5872 if (!PrfQueryProfileData(fmprof, 5873 FM3Str, 5874 "TreeWindowRatio", 5875 (PVOID) & ratio, 5876 &size) || size < sizeof(ratio)) 5877 ratio = 400; 5878 WinSetWindowPos(hwndTree, 5879 HWND_TOP, 5880 0, 5881 height, 5882 (swp.cx * 100) / ratio, 5883 swp.cy - height, 5884 SWP_SHOW | SWP_SIZE | SWP_MOVE | 5885 SWP_ACTIVATE | SWP_ZORDER); 5886 } 5887 else 5888 WinSetWindowPos(hwndTree, 5889 HWND_TOP, 5890 swp.x, 5891 swp.y, 5892 swp.cx, 5893 swp.cy, 5894 swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW | 5895 SWP_ZORDER | SWP_ACTIVATE); 5846 5896 } 5847 5897 // ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5848 // 5898 // MAIN_TOOLS)); 5849 5899 } 5850 5900 PostMsg(MainObjectHwnd, UM_SETUP3, mp1, mp2); … … 5871 5921 5872 5922 for (x = 1; x < argc; x++) { 5873 5874 5875 5876 5923 if (*argv[x] == '/' || *argv[x] == ';') 5924 continue; 5925 if (!IsFile(argv[x]) && !FindDirCnrByName(argv[x], FALSE)) 5926 OpenDirCnr((HWND) 0, hwndMain, hwndTree, TRUE, argv[x]); 5877 5927 } 5878 5928 } … … 5892 5942 hwndActive = TopWindow(hwnd, hwndTree); 5893 5943 if (hwndActive) 5894 5944 WinSetWindowPos(hwndActive, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE); 5895 5945 } 5896 5946 if (fStartMinimized || fReminimize) … … 5925 5975 case WM_CONTROLPOINTER: 5926 5976 if (!fNoFinger && 5927 5928 5977 (SHORT1FROMMP(mp1) == IDM_OPENWALK || 5978 SHORT1FROMMP(mp1) == IDM_USERLIST)) 5929 5979 return MRFROMLONG(hptrFinger); 5930 5980 break; … … 5966 6016 if (mp1) { 5967 6017 if (fUserComboBox) 5968 5969 6018 WinSetWindowText(WinWindowFromID(hwndUserlist, CBID_EDIT), 6019 (CHAR *)mp1); 5970 6020 if (add_udir(FALSE, (CHAR *)mp1)) { 5971 5972 5973 5974 5975 6021 if (fUserComboBox && fAutoAddDirs) { 6022 WinSendMsg(hwndUserlist, LM_INSERTITEM, 6023 MPFROM2SHORT(LIT_SORTASCENDING, 0), 6024 MPFROMP((CHAR *)mp1)); 6025 } 5976 6026 } 5977 6027 } … … 6005 6055 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp); 6006 6056 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) { 6007 6008 6009 6010 6057 WinStoreWindowPos(FM2Str, 6058 "MainWindowPos", WinQueryWindow(hwnd, QW_PARENT)); 6059 if (!fNoSaveState && fSaveState) 6060 SaveDirCnrState(hwnd, GetPString(IDS_SHUTDOWNSTATE)); 6011 6061 } 6012 6062 } … … 6018 6068 case 1: 6019 6069 { 6020 6021 6022 6023 6024 6025 6026 6027 6070 HWND hwndCurrent; 6071 ULONG wmsg; 6072 6073 wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU; 6074 hwndCurrent = TopWindow(hwnd, (HWND) 0); 6075 PortholeInit((HWND) WinSendMsg(WinWindowFromID(hwndCurrent, 6076 FID_CLIENT), wmsg, 6077 MPVOID, MPVOID), mp1, mp2); 6028 6078 } 6029 6079 break; … … 6043 6093 */ 6044 6094 { 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6095 HWND hwndMenu, hwndSubMenu; 6096 MENUITEM mi; 6097 6098 hwndMenu = WinQueryWindowULong(hwnd, QWL_USER); 6099 memset(&mi, 0, sizeof(mi)); 6100 mi.iPosition = MIT_END; 6101 mi.afStyle = MIS_TEXT; 6102 if (!WinSendMsg(hwndMenu, MM_QUERYITEM, 6103 MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi))) 6104 break; 6105 hwndSubMenu = mi.hwndSubMenu; 6106 SetupWinList(hwndSubMenu, hwnd, WinQueryWindow(hwnd, QW_PARENT)); 6057 6107 } 6058 6108 break; … … 6060 6110 default: 6061 6111 { 6062 6063 6064 6065 6066 6112 HWND hwndCurrent; 6113 6114 hwndCurrent = TopWindow(hwnd, (HWND) 0); 6115 if (hwndCurrent) 6116 WinSendMsg(hwndCurrent, UM_INITMENU, mp1, mp2); 6067 6117 } 6068 6118 break; … … 6072 6122 case UM_ADDTOMENU: 6073 6123 AddToMenu((CHAR *)mp1, WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 6074 6124 FID_MENU)); 6075 6125 return 0; 6076 6126 … … 6085 6135 info = cmdhead; 6086 6136 while (info) { 6087 6088 6089 6137 WinSendMsg(hwndCmdlist, LM_INSERTITEM, 6138 MPFROM2SHORT(LIT_END, 0), MPFROMP(info->title)); 6139 info = info->next; 6090 6140 } 6091 6141 } … … 6111 6161 ulSearchCount = 1; 6112 6162 if (!DosFindFirst("*.TLS", &hDir, FILE_READONLY | FILE_ARCHIVED, 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6163 &findbuf, sizeof(FILEFINDBUF3), 6164 &ulSearchCount, FIL_STANDARD)) { 6165 do { 6166 priority_bumped(); 6167 if (!foundit) { 6168 thisone = FALSE; 6169 p = strrchr(lasttoolbar, '\\'); 6170 if (!p) 6171 p = lasttoolbar; 6172 else 6173 p++; 6174 if (!stricmp(findbuf.achName, p)) 6175 thisone = TRUE; 6176 } 6177 p = strrchr(findbuf.achName, '.'); 6178 if (p) 6179 *p = 0; 6180 sSelect = (SHORT) WinSendMsg(hwndButtonlist, LM_INSERTITEM, 6181 MPFROM2SHORT(LIT_SORTASCENDING, 0), 6182 MPFROMP(findbuf.achName)); 6183 if (!foundit && thisone && sSelect >= 0) { 6184 WinSendMsg(hwndButtonlist, LM_SELECTITEM, 6185 MPFROM2SHORT(sSelect, 0), MPFROMLONG(TRUE)); 6186 foundit = TRUE; 6187 } 6188 } 6189 while (!DosFindNext(hDir, &findbuf, sizeof(FILEFINDBUF3), 6190 &ulSearchCount)); 6191 DosFindClose(hDir); 6192 priority_bumped(); 6143 6193 } 6144 6194 WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBARTEXT)); … … 6159 6209 6160 6210 if (!loadedudirs) 6161 6211 load_udirs(); 6162 6212 DosError(FERR_DISABLEHARDERR); 6163 6213 DosQCurDisk(&ulDriveNum, &ulDriveMap); 6164 6214 info = udirhead; 6165 6215 while (info) { 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 6216 if (IsFullName(info->path) && 6217 !(driveflags[toupper(*info->path) - 'A'] & 6218 (DRIVE_IGNORE | DRIVE_INVALID))) { 6219 DosError(FERR_DISABLEHARDERR); 6220 hDir = HDIR_CREATE; 6221 ulSearchCount = 1; 6222 if (!IsRoot(info->path)) 6223 rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY | 6224 MUST_HAVE_DIRECTORY | FILE_READONLY | 6225 FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN, 6226 &findbuf, sizeof(FILEFINDBUF3), 6227 &ulSearchCount, FIL_STANDARD); 6228 else { 6229 rc = 0; 6230 findbuf.attrFile = FILE_DIRECTORY; 6231 } 6232 priority_bumped(); 6233 if (!rc) { 6234 if (!IsRoot(info->path)) 6235 DosFindClose(hDir); 6236 if (findbuf.attrFile & FILE_DIRECTORY) 6237 WinSendMsg(hwndUserlist, LM_INSERTITEM, 6238 MPFROM2SHORT(LIT_SORTASCENDING, 0), 6239 MPFROMP(info->path)); 6240 else { 6241 temp = info->next; 6242 remove_udir(info->path); 6243 info = temp; 6244 continue; 6245 } 6246 } 6247 else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) { 6248 temp = info->next; 6249 remove_udir(info->path); 6250 info = temp; 6251 continue; 6252 } 6253 } 6254 info = info->next; 6205 6255 } 6206 6256 info = ldirhead; 6207 6257 while (info) { 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 6258 if (IsFullName(info->path) && 6259 !(driveflags[toupper(*info->path) - 'A'] & 6260 (DRIVE_IGNORE | DRIVE_INVALID))) { 6261 DosError(FERR_DISABLEHARDERR); 6262 hDir = HDIR_CREATE; 6263 ulSearchCount = 1; 6264 if (!IsRoot(info->path)) 6265 rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY | 6266 MUST_HAVE_DIRECTORY | FILE_READONLY | 6267 FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN, 6268 &findbuf, sizeof(FILEFINDBUF3), 6269 &ulSearchCount, FIL_STANDARD); 6270 else { 6271 rc = 0; 6272 findbuf.attrFile = FILE_DIRECTORY; 6273 } 6274 priority_bumped(); 6275 if (!rc) { 6276 if (!IsRoot(info->path)) 6277 DosFindClose(hDir); 6278 if (findbuf.attrFile & FILE_DIRECTORY) 6279 WinSendMsg(hwndUserlist, LM_INSERTITEM, 6280 MPFROM2SHORT(LIT_SORTASCENDING, 0), 6281 MPFROMP(info->path)); 6282 else { 6283 temp = info->next; 6284 remove_udir(info->path); 6285 info = temp; 6286 continue; 6287 } 6288 } 6289 else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) { 6290 temp = info->next; 6291 remove_udir(info->path); 6292 info = temp; 6293 continue; 6294 } 6295 } 6296 info = info->next; 6247 6297 } 6248 6298 WinSendMsg(hwndUserlist, LM_INSERTITEM, 6249 6250 6299 MPFROM2SHORT(0, 0), 6300 MPFROMP(GetPString(IDS_NEWDIRECTORYTEXT))); 6251 6301 WinSetWindowText(hwndUserlist, GetPString(IDS_COMMONDIRTEXT)); 6252 6302 } … … 6262 6312 case WM_SIZE: 6263 6313 ResizeChildren(hwnd, SHORT1FROMMP(mp1), SHORT2FROMMP(mp1), 6264 6314 SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)); 6265 6315 break; 6266 6316 … … 6276 6326 hps = WinBeginPaint(hwnd, (HPS) 0, NULL); 6277 6327 if (hps) { 6278 6279 6280 6328 WinQueryWindowRect(hwnd, &rcl); 6329 WinFillRect(hps, &rcl, CLR_PALEGRAY); 6330 WinEndPaint(hps); 6281 6331 } 6282 6332 } … … 6292 6342 switch (SHORT2FROMMP(mp1)) { 6293 6343 case CBN_ENTER: 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6344 { 6345 HWND hwndUL = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 6346 SHORT1FROMMP(mp1)); 6347 CHAR path[CCHMAXPATH]; 6348 ULONG ul; 6349 6350 switch (SHORT1FROMMP(mp1)) { 6351 case MAIN_USERLIST: 6352 ul = CCHMAXPATH; 6353 break; 6354 case MAIN_SETUPLIST: 6355 ul = STATE_NAME_MAX_BYTES; 6356 break; 6357 default: 6358 ul = 13; // fixme to not be hardcoded 6359 } 6360 6361 SetShiftState(); 6362 WinQueryWindowText(WinWindowFromID(hwndUL, CBID_EDIT), ul, path); 6363 bstrip(path); 6364 if (*path) { 6365 if (SHORT1FROMMP(mp1) == MAIN_USERLIST) { 6366 if (!strcmp(path, GetPString(IDS_NEWDIRECTORYTEXT))) { 6367 if (!LastDir || 6368 !WinSendMsg(WinQueryWindow(LastDir, QW_PARENT), 6369 UM_CONTAINERDIR, MPFROMP(path), MPVOID)) 6370 strcpy(path, pFM2SaveDirectory); 6371 if (!PMMkDir(hwnd, path, TRUE)) { 6372 WinSetWindowText(hwndUL, GetPString(IDS_COMMONDIRTEXT)); 6373 break; 6374 } 6375 } 6376 if (!IsFile(path) && !FindDirCnrByName(path, TRUE)) { 6377 6378 HWND hwndDir; 6379 6380 if ((fUserListSwitches && 6381 !(shiftstate & KC_SHIFT)) || 6382 (!fUserListSwitches && (shiftstate & KC_SHIFT))) { 6383 hwndDir = FindDirCnr(hwnd); 6384 if (hwndDir) { 6385 WinSendMsg(LastDir, UM_SETDIR, MPFROMP(path), MPVOID); 6386 break; 6387 } 6388 } 6389 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, path); 6390 } 6391 } 6392 else if (SHORT1FROMMP(mp1) == MAIN_DRIVELIST) { 6393 ShowTreeRec(WinWindowFromID(WinWindowFromID(hwndTree, 6394 FID_CLIENT), 6395 TREE_CNR), path, FALSE, TRUE); 6396 WinSetFocus(HWND_DESKTOP, hwndTree); 6397 } 6398 else if (SHORT1FROMMP(mp1) == MAIN_BUTTONLIST) { 6399 strcat(path, ".TLS"); 6400 load_tools(path); 6401 PrfWriteProfileString(fmprof, 6402 FM3Str, "LastToolbar", lasttoolbar); 6403 PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID); 6404 WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBARTEXT)); 6405 } 6406 else if (SHORT1FROMMP(mp1) == MAIN_SETUPLIST) { 6407 CHAR szKey[80]; 6408 ULONG size, numsaves = 0; 6409 6410 SetShiftState(); 6411 size = sizeof(ULONG); 6412 sprintf(szKey, "%s.NumDirsLastTime", path); // path is state name 6413 if (!PrfQueryProfileData(fmprof, 6414 FM3Str, 6415 szKey, 6416 (PVOID)&numsaves, 6417 &size)) 6418 { 6419 if ((WinGetLastError(WinQueryAnchorBlock(hwnd)) & 0xffff) == PMERR_NOT_IN_IDX) { 6420 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, 6421 GetPString(IDS_WARNINGTEXT), 6422 GetPString(IDS_DOESNTEXISTTEXT), path); 6423 } 6424 else { 6425 Win_Error2(hwnd, hwnd, __FILE__, __LINE__, 6426 IDS_PRFQUERYPROFILEDATA); 6427 } 6428 } 6429 else { 6430 char *pszStateName; 6431 if ((shiftstate & KC_SHIFT) == 0) 6432 PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2)); 6433 pszStateName = xstrdup(path, pszSrcFile, __LINE__); 6434 if (!pszStateName) { 6435 // Fall back if out of memory - already complained 6436 if ((shiftstate & KC_SHIFT) != 0 || fAutoTile) { 6437 // Autotile requested or forced 6438 PostMsg(MainObjectHwnd, 6439 UM_RESTORE, 6440 MPVOID, 6441 MPFROMLONG(1)); // Autotile 6442 } 6443 } 6444 else if (!PostMsg(MainObjectHwnd, 6445 UM_RESTORE, 6446 MPFROMP(pszStateName), 6447 MPVOID)) { 6448 free(pszStateName); 6449 } 6450 } 6451 } 6452 else if (SHORT1FROMMP(mp1) == MAIN_CMDLIST) { 6453 6454 SHORT sSelect; 6455 6456 sSelect = (SHORT) WinSendMsg(hwndCmdlist, 6457 LM_QUERYSELECTION, 6458 MPFROMSHORT(LIT_FIRST), MPVOID); 6459 if (sSelect >= 0) 6460 WinPostMsg(hwnd, 6461 WM_COMMAND, 6462 MPFROM2SHORT(IDM_COMMANDSTART + sSelect, 0), 6463 MPVOID); 6464 WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT)); 6465 } 6466 } 6467 } 6468 break; 6419 6469 6420 6470 default: 6421 6471 break; 6422 6472 } 6423 6473 break; … … 6439 6489 case WM_CLOSE: 6440 6490 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), 6441 6491 WM_SYSCOMMAND, MPFROM2SHORT(SC_RESTORE, 0), MPVOID); 6442 6492 WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID); 6443 6493 fAmClosing = TRUE; 6444 6494 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), 6445 6495 WM_SYSCOMMAND, MPFROM2SHORT(SC_MINIMIZE, 0), MPVOID); 6446 6496 if (CloseChildren(hwnd)) { 6447 6497 fAmClosing = FALSE; 6448 6498 if (fAutoTile) 6449 6499 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TILE, 0), MPVOID); 6450 6500 return 0; 6451 6501 } 6452 6502 if (hwndTree) { 6453 6503 if (!PostMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID)) 6454 6504 WinSendMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID); 6455 6505 } 6456 6506 DosSleep(1); … … 6466 6516 // Try to restore saved shutdown state 6467 6517 char *pszDefaultStateName = xstrdup(GetPString(IDS_SHUTDOWNSTATE), 6468 6518 pszSrcFile, __LINE__); 6469 6519 if (pszDefaultStateName) { 6470 6471 6472 6520 if (!PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszDefaultStateName), MPVOID)) 6521 // 05 Feb 08 SHL fixme to complain? 6522 free(pszDefaultStateName); 6473 6523 } 6474 6524 } … … 6479 6529 if (mp1) 6480 6530 return MRFROMLONG(OpenDirCnr((HWND) 0, 6481 6482 6531 hwndMain, 6532 hwndTree, (BOOL) mp2, (char *)mp1)); 6483 6533 return 0; 6484 6534
Note:
See TracChangeset
for help on using the changeset viewer.