- Timestamp:
 - Jul 18, 2008, 8:11:54 PM (17 years ago)
 - Location:
 - trunk/dll
 - Files:
 - 
      
- 2 added
 - 17 edited
 
- 
          
  arccnrs.c (modified) (28 diffs)
 - 
          
  collect.c (modified) (31 diffs)
 - 
          
  dircnrs.c (modified) (20 diffs)
 - 
          
  filldir.c (modified) (3 diffs)
 - 
          
  fortify.c (modified) (10 diffs)
 - 
          
  fortify.h (modified) (5 diffs)
 - 
          
  init.c (modified) (7 diffs)
 - 
          
  killproc.c (modified) (7 diffs)
 - 
          
  mainwnd.c (modified) (191 diffs)
 - 
          
  makelist.c (modified) (4 diffs)
 - 
          
  makelist.h (modified) (2 diffs)
 - 
          
  misc.c (modified) (8 diffs)
 - 
          
  misc.h (added)
 - 
          
  objwin.c (modified) (2 diffs)
 - 
          
  treecnr.c (modified) (23 diffs)
 - 
          
  ufortify.h (modified) (2 diffs)
 - 
          
  walkem.c (modified) (11 diffs)
 - 
          
  walkem.h (added)
 - 
          
  worker.c (modified) (10 diffs)
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
      
trunk/dll/arccnrs.c
r1076 r1077 339 339 if (pai->pszFileName && pai->pszFileName != NullStr) { 340 340 psz = pai->pszFileName; 341 pai->pszFileName = NULL; 341 pai->pszFileName = NULL; // 08 Jul 08 SHL was NulStr 342 342 free(psz); 343 343 } … … 1230 1230 1231 1231 switch (msg) { 1232 case WM_CREATE: 1233 DbgMsg(pszSrcFile, __LINE__, "WM_CREATE mp1 %p mp2 %p", mp1, mp2); // 18 Jul 08 SHL fixme 1234 break; 1235 1232 1236 case DM_PRINTOBJECT: 1233 1237 case DM_DISCARDOBJECT: … … 1347 1351 1348 1352 case UM_SETUP: 1353 # ifdef FORTIFY 1354 Fortify_EnterScope(); 1355 # endif 1349 1356 dcd = WinQueryWindowPtr(hwnd, QWL_USER); 1350 1357 if (!dcd) { … … 1353 1360 } 1354 1361 else { 1362 # ifdef FORTIFY 1363 Fortify_ChangeOwner(dcd); 1364 # endif 1355 1365 /* set unique id */ 1356 1366 WinSetWindowUShort(hwnd, QWS_ID, ARCOBJ_FRAME + (ARC_FRAME - dcd->id)); … … 1500 1510 1501 1511 if (li && li->list && li->list[0]) { 1502 printf("%x/r", li->type); fflush(stdout);1512 printf("%x/r", li->type); fflush(stdout); 1503 1513 switch (li->type) { 1504 1514 case IDM_ARCHIVE: … … 1565 1575 case IDM_DELETE: 1566 1576 { 1567 CHAR *endofit;1568 PSZ pszCmdLine;1577 CHAR *endofit; 1578 PSZ pszCmdLine; 1569 1579 INT z; 1570 1580 CHECKLIST ck; … … 1592 1602 li->list = ck.list; 1593 1603 if (!li->list || !li->list[0]) 1594 break;1595 pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);1596 if (!pszCmdLine)1597 break;1604 break; 1605 pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 1606 if (!pszCmdLine) 1607 break; 1598 1608 strcpy(pszCmdLine, li->type == IDM_DELETE ? 1599 1609 dcd->info->delete : … … 1613 1623 (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED), 1614 1624 hwnd, pszSrcFile, __LINE__, NullStr, NULL, "%s", pszCmdLine); 1615 *endofit = 0;1616 free(pszCmdLine);1625 *endofit = 0; 1626 free(pszCmdLine); 1617 1627 } while (li->list[x]); 1618 1628 PostMsg(dcd->hwndCnr, UM_RESCAN, MPFROMSHORT(1), MPVOID); … … 1639 1649 case IDM_OPENSETTINGS: 1640 1650 { 1641 CHAR *endofit, *ptr;1642 PSZ pszCmdLine;1651 CHAR *endofit, *ptr; 1652 PSZ pszCmdLine; 1643 1653 INT z; 1644 1654 if ((li->type == IDM_EXTRACT && !li->info->extract) || … … 1699 1709 } 1700 1710 if (!li->list || !li->list[0]) 1701 break;1702 pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);1703 if (!pszCmdLine)1704 break;1711 break; 1712 pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 1713 if (!pszCmdLine) 1714 break; 1705 1715 strcpy(pszCmdLine, 1706 1716 (li->type == IDM_EXTRACT || … … 1739 1749 (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED) | 1740 1750 WAIT, hwnd, pszSrcFile, __LINE__, 1741 li->targetpath, NULL, "%s", pszCmdLine);1751 li->targetpath, NULL, "%s", pszCmdLine); 1742 1752 *endofit = 0; 1743 1753 } while (li->list[x]); … … 1757 1767 p = xmalloc(strlen(temp) + strlen(li->targetpath) + 2, 1758 1768 pszSrcFile, __LINE__); 1759 if (p) {1760 BldFullPathName(p, li->targetpath, temp);1769 if (p) { 1770 BldFullPathName(p, li->targetpath, temp); 1761 1771 /*strcpy(p, li->targetpath); 1762 1772 if (p[strlen(p) - 1] != '\\') … … 1827 1837 } 1828 1838 } 1829 }1839 } 1830 1840 BldFullPathName(pszCmdLine, li->targetpath, li->list[x]); 1831 1841 temp = li->list[x]; 1832 li->list[x] = xstrdup(pszCmdLine, pszSrcFile, __LINE__);1842 li->list[x] = xstrdup(pszCmdLine, pszSrcFile, __LINE__); 1833 1843 if (!li->list[x]) 1834 1844 li->list[x] = temp; 1835 1845 else 1836 1846 xfree(temp, pszSrcFile, __LINE__); 1837 }1838 free(pszCmdLine);1847 } 1848 free(pszCmdLine); 1839 1849 if (li->type == IDM_VIEW || li->type == IDM_EDIT) { 1840 1850 … … 1856 1866 if (li->type == IDM_MCIPLAY) { 1857 1867 1858 FILE *fp;1859 CHAR szTempFile[CCHMAXPATH];1860 1861 BldFullPathName(szTempFile, pTmpDir, "$FM2PLAY.$$$");1868 FILE *fp; 1869 CHAR szTempFile[CCHMAXPATH]; 1870 1871 BldFullPathName(szTempFile, pTmpDir, "$FM2PLAY.$$$"); 1862 1872 fp = xfopen(szTempFile, "w", pszSrcFile, __LINE__); 1863 1873 if (fp) { … … 1866 1876 fprintf(fp, "%s\n", li->list[x]); 1867 1877 fprintf(fp, ";end\n"); 1868 fclose(fp);1869 strrev(szTempFile);1870 strcat(szTempFile, "@/");1871 strrev(szTempFile);1878 fclose(fp); 1879 strrev(szTempFile); 1880 strcat(szTempFile, "@/"); 1881 strrev(szTempFile); 1872 1882 RunFM2Util("FM2PLAY.EXE", szTempFile); 1873 1883 } … … 1913 1923 li->type == IDM_OPENSETTINGS) { 1914 1924 WORKER *wk; 1915 # ifdef FORTIFY1916 Fortify_EnterScope();1917 # endif1925 # ifdef FORTIFY 1926 Fortify_EnterScope(); 1927 # endif 1918 1928 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__); 1919 1929 if (!wk) 1920 FreeListInfo(li);1930 FreeListInfo(li); 1921 1931 else { 1922 wk->size = sizeof(WORKER); 1923 wk->hwndCnr = dcd->hwndCnr; 1924 wk->hwndParent = dcd->hwndParent; 1925 wk->hwndFrame = dcd->hwndFrame; 1926 wk->hwndClient = dcd->hwndClient; 1927 wk->li = li; 1928 strcpy(wk->directory, dcd->directory); 1929 if (_beginthread(Action, NULL, 122880, (PVOID) wk) == -1) { 1930 Runtime_Error(pszSrcFile, __LINE__, 1931 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 1932 free(wk); 1933 FreeListInfo((LISTINFO *) mp1); 1934 # ifdef FORTIFY 1935 Fortify_LeaveScope(); 1936 # endif 1937 } 1938 } 1939 1932 wk->size = sizeof(WORKER); 1933 wk->hwndCnr = dcd->hwndCnr; 1934 wk->hwndParent = dcd->hwndParent; 1935 wk->hwndFrame = dcd->hwndFrame; 1936 wk->hwndClient = dcd->hwndClient; 1937 wk->li = li; 1938 strcpy(wk->directory, dcd->directory); 1939 if (_beginthread(Action, NULL, 122880, (PVOID) wk) == -1) { 1940 Runtime_Error(pszSrcFile, __LINE__, 1941 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 1942 free(wk); 1943 FreeListInfo((LISTINFO *) mp1); 1944 } 1945 } 1946 # ifdef FORTIFY 1947 Fortify_LeaveScope(); 1948 # endif 1940 1949 } 1941 1950 else { … … 1954 1963 else 1955 1964 viewtype = 0; 1965 # ifdef FORTIFY 1966 Fortify_EnterScope(); 1967 # endif 1956 1968 temp = xstrdup(li->list[x], pszSrcFile, __LINE__); 1957 1969 if (temp) { … … 1964 1976 free(temp); 1965 1977 } 1978 # ifdef FORTIFY 1979 DosSleep(1); // Allow MassAction to take ownership 1980 Fortify_LeaveScope(); 1981 # endif 1966 1982 } 1967 1983 } … … 2020 2036 if (li->type != IDM_OPENDEFAULT && li->type != IDM_OPENSETTINGS) 2021 2037 { 2022 FreeListInfo(li);2038 FreeListInfo(li); 2023 2039 } 2024 2040 } … … 2045 2061 free(dcd); 2046 2062 # ifdef FORTIFY 2047 //Fortify_LeaveScope();2048 # endif2063 Fortify_LeaveScope(); 2064 # endif 2049 2065 WinSetWindowPtr(dcd->hwndCnr, QWL_USER, NULL); 2050 2066 } … … 2592 2608 2593 2609 if ((INT)mp1 == 5 || (INT)mp1 == 13 || (INT)mp1 == 21) 2594 hwnd = StartViewer(HWND_DESKTOP, (INT)mp1,2595 (CHAR *)mp2, dcd->hwndFrame);2610 hwnd = StartViewer(HWND_DESKTOP, (INT)mp1, 2611 (CHAR *)mp2, dcd->hwndFrame); 2596 2612 else 2597 hwnd = StartMLEEditor(dcd->hwndParent,2598 (INT)mp1, (CHAR *)mp2, dcd->hwndFrame);2613 hwnd = StartMLEEditor(dcd->hwndParent, 2614 (INT)mp1, (CHAR *)mp2, dcd->hwndFrame); 2599 2615 free((CHAR *)mp2); 2600 2616 return MRFROMLONG(hwnd); … … 2953 2969 { 2954 2970 LISTINFO *li; 2955 # ifdef FORTIFY2956 Fortify_EnterScope();2957 # endif2971 # ifdef FORTIFY 2972 Fortify_EnterScope(); 2973 # endif 2958 2974 li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__); 2959 2975 if (li) { … … 3015 3031 case IDM_VIRUSSCAN: 3016 3032 case IDM_OPENDEFAULT: 3017 case IDM_OPENSETTINGS:3018 case IDM_MCIPLAY:3033 case IDM_OPENSETTINGS: 3034 case IDM_MCIPLAY: 3019 3035 strcpy(li->targetpath, dcd->workdir); 3020 3036 break; … … 3031 3047 UnHilite(hwnd, TRUE, &dcd->lastselection, 0); 3032 3048 } 3033 else {3049 else { 3034 3050 free(li); 3035 # ifdef FORTIFY 3036 Fortify_LeaveScope(); 3037 # endif3038 } 3039 } 3051 } 3052 } 3053 # ifdef FORTIFY 3054 Fortify_LeaveScope(); 3055 # endif 3040 3056 } 3041 3057 break; … … 3509 3525 # ifdef FORTIFY 3510 3526 Fortify_EnterScope(); 3511 # endif3527 # endif 3512 3528 dcd = xmallocz(sizeof(DIRCNRDATA), pszSrcFile, __LINE__); 3513 3529 if (!dcd) { … … 3519 3535 dcd->id = id; 3520 3536 dcd->type = ARC_FRAME; 3521 if (!pTmpDir) {3522 save_dir2(dcd->workdir);3523 if (dcd->workdir[strlen(dcd->workdir) - 1] != '\\')3524 strcat(dcd->workdir, "\\");3525 sprintf(dcd->workdir + strlen(dcd->workdir), "%s.%03x",3526 ArcTempRoot, (clock() & 4095));3527 }3528 else3529 sprintf(dcd->workdir, "%s.%03x",3530 ArcTempRoot, (clock() & 4095));3537 if (!pTmpDir) { 3538 save_dir2(dcd->workdir); 3539 if (dcd->workdir[strlen(dcd->workdir) - 1] != '\\') 3540 strcat(dcd->workdir, "\\"); 3541 sprintf(dcd->workdir + strlen(dcd->workdir), "%s.%03x", 3542 ArcTempRoot, (clock() & 4095)); 3543 } 3544 else 3545 sprintf(dcd->workdir, "%s.%03x", 3546 ArcTempRoot, (clock() & 4095)); 3531 3547 strcpy(dcd->arcname, fullname); 3532 3548 if (*extractpath) { … … 3598 3614 IDS_WINCREATEWINDOW); 3599 3615 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID); 3600 free(dcd); 3601 # ifdef FORTIFY 3602 Fortify_LeaveScope(); 3603 # endif 3616 free(dcd); 3604 3617 hwndFrame = (HWND) 0; 3605 3618 } … … 3692 3705 } 3693 3706 } 3707 # ifdef FORTIFY 3708 Fortify_LeaveScope(); 3709 # endif 3694 3710 } 3695 3711 }  - 
      
trunk/dll/collect.c
r1065 r1077 50 50 06 Jul 08 GKY Update delete/undelete to include move to and open XWP trashcan 51 51 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating 52 all the details view settings (both the global variables and those in the53 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.52 all the details view settings (both the global variables and those in the 53 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS. 54 54 55 55 ***********************************************************************/ … … 78 78 #include "tmrsvcs.h" // ITIMER_DESC 79 79 #include "notebook.h" // CfgDlgProc 80 #include "command.h" // RunCommand80 #include "command.h" // RunCommand 81 81 #include "fm3dll.h" 82 82 … … 466 466 switch (msg) { 467 467 case WM_CREATE: 468 // 18 Jul 08 SHL fixme to doc why messsage gets lost 469 DbgMsg(pszSrcFile, __LINE__, "WM_CREATE mp1 %p mp2 %p", mp1, mp2); // 18 Jul 08 SHL fixme 468 470 break; 469 471 … … 505 507 506 508 case UM_SETUP: 509 # ifdef FORTIFY 510 Fortify_EnterScope(); 511 # endif 507 512 dcd = WinQueryWindowPtr(hwnd, QWL_USER); 508 513 if (dcd) { 514 # ifdef FORTIFY 515 Fortify_ChangeOwner(dcd); 516 # endif 509 517 /* set unique id */ 510 518 WinSetWindowUShort(hwnd, … … 601 609 nm = 1; 602 610 hdir = HDIR_CREATE; 603 DosError(FERR_DISABLEHARDERR);604 if (FindCnrRecord(dcd->hwndCnr,611 DosError(FERR_DISABLEHARDERR); 612 if (FindCnrRecord(dcd->hwndCnr, 605 613 li->list[x], 606 614 NULL, 607 615 FALSE, 608 616 FALSE, 609 TRUE)) {610 pci = UpdateCnrRecord(dcd->hwndCnr, li->list[x], FALSE, dcd);611 if (Filter((PMINIRECORDCORE) pci, (PVOID) & dcd->mask)) {612 pci->rc.flRecordAttr &= ~CRA_FILTERED;613 WinSendMsg(dcd->hwndCnr, CM_INVALIDATERECORD, MPVOID,614 MPFROM2SHORT(0, CMA_REPOSITION | CMA_ERASE));615 }616 pci = (PCNRITEM) pci->rc.preccNextRecord;617 TRUE)) { 618 pci = UpdateCnrRecord(dcd->hwndCnr, li->list[x], FALSE, dcd); 619 if (Filter((PMINIRECORDCORE) pci, (PVOID) & dcd->mask)) { 620 pci->rc.flRecordAttr &= ~CRA_FILTERED; 621 WinSendMsg(dcd->hwndCnr, CM_INVALIDATERECORD, MPVOID, 622 MPFROM2SHORT(0, CMA_REPOSITION | CMA_ERASE)); 623 } 624 pci = (PCNRITEM) pci->rc.preccNextRecord; 617 625 if (pciP) 618 626 pciP->rc.preccNextRecord = (PMINIRECORDCORE) pci; 619 627 else 620 pciFirst = pci;621 }628 pciFirst = pci; 629 } 622 630 else if (*li->list[x] && 623 631 !DosQueryPathInfo(li->list[x], FIL_QUERYFULLNAME, … … 631 639 &fb4, sizeof(fb4), &nm, FIL_QUERYEASIZEL)) { 632 640 DosFindClose(hdir); 633 priority_normal();634 *fb4.achName = 0;635 ullTotalBytes = FillInRecordFromFFB(dcd->hwndCnr,636 pci,641 priority_normal(); 642 *fb4.achName = 0; 643 ullTotalBytes = FillInRecordFromFFB(dcd->hwndCnr, 644 pci, 637 645 fullname, &fb4, FALSE, dcd); 638 dcd->ullTotalBytes += ullTotalBytes;639 pciP = pci;640 pci = (PCNRITEM) pci->rc.preccNextRecord;646 dcd->ullTotalBytes += ullTotalBytes; 647 pciP = pci; 648 pci = (PCNRITEM) pci->rc.preccNextRecord; 641 649 } 642 650 else { … … 647 655 pciP->rc.preccNextRecord = (PMINIRECORDCORE) pci; 648 656 else 649 pciFirst = pci;650 if (pciT)651 FreeCnrItemData(pciT); // FreeCnrItem(hwnd, pciT);657 pciFirst = pci; 658 if (pciT) 659 FreeCnrItemData(pciT); // FreeCnrItem(hwnd, pciT); 652 660 ulMaxFiles--; // Remember gone 653 661 } … … 680 688 case UM_COLLECTFROMFILE: 681 689 dcd = WinQueryWindowPtr(hwnd, QWL_USER); 690 # ifdef FORTIFY 691 Fortify_EnterScope(); 692 # endif 693 682 694 if (dcd && mp1) { 683 695 FILESTATUS4L fs4; … … 690 702 size_t c; 691 703 704 # ifdef FORTIFY 705 Fortify_ChangeOwner(mp1); 706 # endif 707 692 708 fp = _fsopen((CHAR *)mp1, "r", SH_DENYNO); 693 709 if (fp) { … … 722 738 } 723 739 /* fullname now contains name of file to collect */ 724 DosError(FERR_DISABLEHARDERR);725 if (FindCnrRecord(dcd->hwndCnr,740 DosError(FERR_DISABLEHARDERR); 741 if (FindCnrRecord(dcd->hwndCnr, 726 742 fullname, 727 743 NULL, 728 744 FALSE, 729 745 FALSE, 730 TRUE)) {731 pci = UpdateCnrRecord(dcd->hwndCnr, fullname, FALSE, dcd);732 if (Filter((PMINIRECORDCORE) pci, (PVOID) & dcd->mask)) {733 pci->rc.flRecordAttr &= ~CRA_FILTERED;734 WinSendMsg(dcd->hwndCnr, CM_INVALIDATERECORD, MPVOID,735 MPFROM2SHORT(0, CMA_REPOSITION | CMA_ERASE));736 }737 /*pci = (PCNRITEM) pci->rc.preccNextRecord;746 TRUE)) { 747 pci = UpdateCnrRecord(dcd->hwndCnr, fullname, FALSE, dcd); 748 if (Filter((PMINIRECORDCORE) pci, (PVOID) & dcd->mask)) { 749 pci->rc.flRecordAttr &= ~CRA_FILTERED; 750 WinSendMsg(dcd->hwndCnr, CM_INVALIDATERECORD, MPVOID, 751 MPFROM2SHORT(0, CMA_REPOSITION | CMA_ERASE)); 752 } 753 /*pci = (PCNRITEM) pci->rc.preccNextRecord; 738 754 if (pciP) 739 755 pciP->rc.preccNextRecord = (PMINIRECORDCORE) pci; 740 756 else 741 pciFirst = pci;*/742 }757 pciFirst = pci;*/ 758 } 743 759 else if (IsFullName(fullname) && 744 760 !IsRoot(fullname) && … … 746 762 FIL_QUERYEASIZEL, 747 763 &fs4, 748 sizeof(fs4))) {764 sizeof(fs4))) { 749 765 /* collect it */ 750 766 pci = WinSendMsg(dcd->hwndCnr, … … 791 807 # ifdef FORTIFY 792 808 Fortify_LeaveScope(); 793 # endif809 # endif 794 810 return 0; 795 811 … … 890 906 891 907 case UM_MASSACTION: 908 # ifdef FORTIFY 909 Fortify_EnterScope(); 910 # endif 892 911 if (mp1) { 912 # ifdef FORTIFY 913 Fortify_ChangeOwner(mp1); 914 # endif 893 915 dcd = WinQueryWindowPtr(hwnd, QWL_USER); 894 916 if (dcd) { 895 917 WORKER *wk; 896 # ifdef FORTIFY897 Fortify_EnterScope();898 # endif899 918 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__); 900 919 if (!wk) … … 911 930 Runtime_Error(pszSrcFile, __LINE__, 912 931 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 913 free(wk);932 free(wk); 914 933 FreeListInfo((LISTINFO *) mp1); 915 # ifdef FORTIFY 916 Fortify_LeaveScope(); 917 # endif 918 } 919 } 920 } 921 } 934 } 935 } 936 } 937 } 938 # ifdef FORTIFY 939 DosSleep(1); // Let receiver take ownership 940 Fortify_LeaveScope(); 941 # endif 922 942 return 0; 923 943 924 944 case UM_ACTION: 945 # ifdef FORTIFY 946 Fortify_EnterScope(); 947 # endif 925 948 if (mp1) { 949 # ifdef FORTIFY 950 Fortify_ChangeOwner(mp1); 951 # endif 926 952 dcd = WinQueryWindowPtr(hwnd, QWL_USER); 927 953 if (dcd) { 928 954 WORKER *wk; 929 # ifdef FORTIFY930 Fortify_EnterScope();931 # endif932 955 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__); 933 956 if (!wk) … … 944 967 Runtime_Error(pszSrcFile, __LINE__, 945 968 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 946 free(wk);969 free(wk); 947 970 FreeListInfo((LISTINFO *) mp1); 948 # ifdef FORTIFY 949 Fortify_LeaveScope(); 950 # endif 951 } 952 } 953 } 954 } 971 } 972 } 973 } 974 } 975 # ifdef FORTIFY 976 DosSleep(1); // Let receiver take ownership 977 Fortify_LeaveScope(); 978 # endif 955 979 return 0; 956 980 … … 975 999 # ifdef FORTIFY 976 1000 Fortify_LeaveScope(); 977 # endif1001 # endif 978 1002 WinSetWindowPtr(dcd->hwndCnr, QWL_USER, NULL); 979 1003 } … … 1470 1494 case UM_COLLECTFROMFILE: 1471 1495 if (mp1) { 1472 if (!dcd) { 1473 free(mp1);1474 # ifdef FORTIFY 1475 Fortify_LeaveScope(); 1476 # endif 1496 # ifdef FORTIFY 1497 Fortify_EnterScope(); 1498 Fortify_ChangeOwner(mp1); 1499 # endif 1500 if (!dcd) 1477 1501 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 1478 }1479 1502 else { 1480 1503 if (!PostMsg(dcd->hwndObject, UM_COLLECTFROMFILE, mp1, mp2)) { 1481 1504 Runtime_Error(pszSrcFile, __LINE__, "PostMsg"); 1482 free(mp1); 1483 # ifdef FORTIFY 1484 Fortify_LeaveScope(); 1485 # endif 1486 } 1487 } 1505 } 1506 } 1507 free(mp1); 1508 # ifdef FORTIFY 1509 DosSleep(1); // Let receiver take ownership 1510 Fortify_LeaveScope(); 1511 # endif 1488 1512 } 1489 1513 return 0; … … 1606 1630 } 1607 1631 if (insert_filename(hwnd, filename, FALSE, FALSE)) { 1632 # ifdef FORTIFY 1633 Fortify_EnterScope(); 1634 # endif 1608 1635 p = xstrdup(filename, pszSrcFile, __LINE__); 1609 1636 if (p) { 1610 1637 if (!PostMsg(hwnd, UM_COLLECTFROMFILE, MPFROMP(p), MPVOID)) 1611 free(p); 1612 # ifdef FORTIFY 1613 Fortify_LeaveScope(); 1614 # endif 1615 } 1638 free(p); 1639 } 1640 # ifdef FORTIFY 1641 DosSleep(1); // Let receiver take ownership 1642 Fortify_LeaveScope(); 1643 # endif 1616 1644 } 1617 1645 } … … 1727 1755 { 1728 1756 LISTINFO *li; 1729 # ifdef FORTIFY1730 Fortify_EnterScope();1731 # endif1757 # ifdef FORTIFY 1758 Fortify_EnterScope(); 1759 # endif 1732 1760 li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__); 1733 1761 if (li) { … … 1741 1769 } 1742 1770 } 1771 # ifdef FORTIFY 1772 DosSleep(1); // Let receiver take ownership 1773 Fortify_LeaveScope(); 1774 # endif 1743 1775 } 1744 1776 break; … … 1778 1810 if (mp2) { 1779 1811 LISTINFO *li; 1780 # ifdef FORTIFY1781 Fortify_EnterScope();1782 # endif1812 # ifdef FORTIFY 1813 Fortify_EnterScope(); 1814 # endif 1783 1815 li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__); 1784 1816 if (li) { … … 1794 1826 else 1795 1827 FreeList(mp2); 1828 # ifdef FORTIFY 1829 DosSleep(1); // Let receiver take ownership 1830 Fortify_LeaveScope(); 1831 # endif 1796 1832 } 1797 1833 break; 1798 1834 1799 1835 case IDM_UNDELETE: 1800 {1836 { 1801 1837 PCNRITEM pci; 1802 CHAR path[CCHMAXPATH];1803 HOBJECT hObject;1804 HWND hwndDesktop;1805 1806 hObject = WinQueryObject("<XWP_TRASHCAN>");1807 if (hObject != NULLHANDLE && fTrashCan) {1808 hwndDesktop = WinQueryDesktopWindow((HAB) 0, NULLHANDLE);1838 CHAR path[CCHMAXPATH]; 1839 HOBJECT hObject; 1840 HWND hwndDesktop; 1841 1842 hObject = WinQueryObject("<XWP_TRASHCAN>"); 1843 if (hObject != NULLHANDLE && fTrashCan) { 1844 hwndDesktop = WinQueryDesktopWindow((HAB) 0, NULLHANDLE); 1809 1845 WinSetFocus(HWND_DESKTOP, hwndDesktop); 1810 WinOpenObject(hObject, 0, TRUE);1811 }1812 else {1813 pci = (PCNRITEM) CurrentRecord(hwnd);1814 if (pci && (INT) pci != -1) {1815 strcpy(path, pci->pszFileName);1816 MakeValidDir(path);1817 WinDlgBox(HWND_DESKTOP, hwnd, UndeleteDlgProc, FM3ModHandle,1818 UNDEL_FRAME, MPFROMP(path));1819 }1846 WinOpenObject(hObject, 0, TRUE); 1847 } 1848 else { 1849 pci = (PCNRITEM) CurrentRecord(hwnd); 1850 if (pci && (INT) pci != -1) { 1851 strcpy(path, pci->pszFileName); 1852 MakeValidDir(path); 1853 WinDlgBox(HWND_DESKTOP, hwnd, UndeleteDlgProc, FM3ModHandle, 1854 UNDEL_FRAME, MPFROMP(path)); 1855 } 1820 1856 } 1821 1857 } … … 1891 1927 DIR_FILTER), &dcd->mask, FALSE); 1892 1928 } 1893 break;1929 break; 1894 1930 1895 1931 case IDM_UNHIDEALL: 1896 WinSendMsg(hwnd, CM_FILTER, MPFROMP(Filter), MPFROMP(&dcd->mask));1897 break;1932 WinSendMsg(hwnd, CM_FILTER, MPFROMP(Filter), MPFROMP(&dcd->mask)); 1933 break; 1898 1934 1899 1935 case IDM_HIDEALL: … … 2092 2128 LISTINFO *li; 2093 2129 ULONG action = UM_ACTION; 2094 # ifdef FORTIFY2095 Fortify_EnterScope();2096 # endif2130 # ifdef FORTIFY 2131 Fortify_EnterScope(); 2132 # endif 2097 2133 li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__); 2098 2134 if (li) { … … 2137 2173 UnHilite(hwnd, TRUE, &dcd->lastselection, dcd->ulItemsToUnHilite); 2138 2174 } 2139 else2140 free(li);2141 # ifdef FORTIFY 2142 Fortify_LeaveScope(); 2143 # endif 2144 } 2175 else 2176 free(li); 2177 } 2178 # ifdef FORTIFY 2179 Fortify_LeaveScope(); 2180 # endif 2145 2181 } 2146 2182 break; … … 2700 2736 2701 2737 if ((INT)mp1 == 5 || (INT)mp1 == 13 || (INT)mp1 == 21) 2702 hwnd = StartViewer(HWND_DESKTOP, (INT)mp1,2703 (CHAR *)mp2, dcd->hwndFrame);2738 hwnd = StartViewer(HWND_DESKTOP, (INT)mp1, 2739 (CHAR *)mp2, dcd->hwndFrame); 2704 2740 else 2705 hwnd = StartMLEEditor(dcd->hwndParent,2706 (INT)mp1, (CHAR *)mp2, dcd->hwndFrame);2741 hwnd = StartMLEEditor(dcd->hwndParent, 2742 (INT)mp1, (CHAR *)mp2, dcd->hwndFrame); 2707 2743 free((CHAR *)mp2); 2708 2744 return MRFROMLONG(hwnd); … … 2764 2800 { 2765 2801 PFNWP oldMenuProc = WinQueryWindowPtr(hwnd, QWL_USER); 2766 static short sLastMenuitem;2802 static short sLastMenuitem; 2767 2803 2768 2804 switch (msg) { … … 2791 2827 MOUSEMSG(&msg)->y < rectl.yTop) 2792 2828 break; 2793 } // for2829 } // for 2794 2830 2795 2831 … … 2859 2895 # ifdef FORTIFY 2860 2896 Fortify_EnterScope(); 2861 # endif2897 # endif 2862 2898 dcd = xmallocz(sizeof(DIRCNRDATA), pszSrcFile, __LINE__); 2863 2899 if (!dcd) { … … 2898 2934 IDS_WINCREATEWINDOW); 2899 2935 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID); 2900 free(dcd); 2901 # ifdef FORTIFY 2902 Fortify_LeaveScope(); 2903 # endif 2936 free(dcd); 2904 2937 hwndFrame = (HWND) 0; 2905 2938 } … … 2952 2985 } 2953 2986 } 2987 # ifdef FORTIFY 2988 DosSleep(1); // Let receiver take ownership 2989 Fortify_LeaveScope(); 2990 # endif 2954 2991 } 2955 2992 return hwndFrame;  - 
      
trunk/dll/dircnrs.c
r1065 r1077 42 42 06 Jul 08 GKY Update delete/undelete to include move to and open XWP trashcan 43 43 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating 44 all the details view settings (both the global variables and those in the45 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.44 all the details view settings (both the global variables and those in the 45 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS. 46 46 47 47 ***********************************************************************/ … … 70 70 #include "command.h" // RunCommand 71 71 #include "fm3dll.h" 72 #include "avl.h" // free_archivers72 #include "avl.h" // free_archivers 73 73 #include "fortify.h" 74 74 … … 598 598 switch (msg) { 599 599 case WM_CREATE: 600 DbgMsg(pszSrcFile, __LINE__, "WM_CREATE mp1 %p mp2 %p", mp1, mp2); // 18 Jul 08 SHL fixme 600 601 break; 601 602 … … 606 607 dcd = INSTDATA(hwnd); 607 608 if (fFM2Deletes && dcd) { 608 609 609 LISTINFO *li; 610 610 CNRDRAGINFO cni; 611 612 611 cni.pRecord = NULL; 613 612 cni.pDragInfo = (PDRAGINFO) mp1; … … 641 640 642 641 case UM_SETUP: 642 # ifdef FORTIFY 643 Fortify_EnterScope(); 644 # endif 643 645 dcd = WinQueryWindowPtr(hwnd, QWL_USER); 644 646 if (dcd) { 647 # ifdef FORTIFY 648 Fortify_ChangeOwner(dcd); 649 # endif 645 650 /* set unique id */ 646 651 WinSetWindowUShort(hwnd, QWS_ID, DIROBJ_FRAME + (DIR_FRAME - dcd->id)); … … 988 993 case UM_MASSACTION: 989 994 if (mp1) { 990 991 995 dcd = WinQueryWindowPtr(hwnd, QWL_USER); 992 996 if (dcd) { 993 994 997 WORKER *wk; 995 # ifdef FORTIFY996 Fortify_EnterScope();997 # endif998 # ifdef FORTIFY 999 Fortify_EnterScope(); 1000 # endif 998 1001 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__); 999 1002 if (!wk) … … 1010 1013 Runtime_Error(pszSrcFile, __LINE__, 1011 1014 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 1012 free(wk);1015 free(wk); 1013 1016 FreeListInfo((LISTINFO *) mp1); 1014 # ifdef FORTIFY 1015 Fortify_LeaveScope(); 1016 # endif 1017 } 1018 } 1017 } 1018 } 1019 # ifdef FORTIFY 1020 DosSleep(1); // Allow MassAction to take ownership 1021 Fortify_LeaveScope(); 1022 # endif 1019 1023 } 1020 1024 } … … 1028 1032 1029 1033 WORKER *wk; 1030 # ifdef FORTIFY1031 Fortify_EnterScope();1032 # endif1034 # ifdef FORTIFY 1035 Fortify_EnterScope(); 1036 # endif 1033 1037 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__); 1034 1038 if (!wk) … … 1045 1049 Runtime_Error(pszSrcFile, __LINE__, 1046 1050 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 1047 free(wk);1051 free(wk); 1048 1052 FreeListInfo((LISTINFO *) mp1); 1049 # ifdef FORTIFY 1050 Fortify_LeaveScope(); 1051 # endif1052 }1053 } 1053 } 1054 } 1055 # ifdef FORTIFY 1056 Fortify_LeaveScope(); 1057 # endif 1054 1058 } 1055 1059 } … … 1091 1095 1092 1096 switch (msg) { 1097 case WM_CREATE: 1098 # ifdef FORTIFY 1099 Fortify_EnterScope(); 1100 # endif 1101 break; 1102 1093 1103 case DM_PRINTOBJECT: 1094 1104 return MRFROMLONG(DRR_TARGET); … … 1242 1252 1243 1253 if (!IsFile(leftdir) && !IsFile(rightdir)) { 1254 # ifdef FORTIFY 1255 Fortify_EnterScope(); 1256 # endif 1244 1257 cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__); 1245 1258 if (cmp) { … … 1253 1266 CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp)); 1254 1267 } 1268 # ifdef FORTIFY 1269 Fortify_LeaveScope(); 1270 # endif 1255 1271 } 1256 1272 } … … 2040 2056 { 2041 2057 PCNRITEM pci; 2042 CHAR path[CCHMAXPATH];2043 HOBJECT hObject;2044 HWND hwndDesktop;2045 2046 hObject = WinQueryObject("<XWP_TRASHCAN>");2047 if (hObject != NULLHANDLE && fTrashCan) {2048 hwndDesktop = WinQueryDesktopWindow((HAB) 0, NULLHANDLE);2058 CHAR path[CCHMAXPATH]; 2059 HOBJECT hObject; 2060 HWND hwndDesktop; 2061 2062 hObject = WinQueryObject("<XWP_TRASHCAN>"); 2063 if (hObject != NULLHANDLE && fTrashCan) { 2064 hwndDesktop = WinQueryDesktopWindow((HAB) 0, NULLHANDLE); 2049 2065 WinSetFocus(HWND_DESKTOP, hwndDesktop); 2050 WinOpenObject(hObject, 0, TRUE);2051 }2052 else {2053 pci = (PCNRITEM) CurrentRecord(hwnd);2054 if (pci && (INT) pci != -1) {2055 strcpy(path, pci->pszFileName);2056 MakeValidDir(path);2057 WinDlgBox(HWND_DESKTOP, hwnd, UndeleteDlgProc, FM3ModHandle,2058 UNDEL_FRAME, MPFROMP(path));2059 }2066 WinOpenObject(hObject, 0, TRUE); 2067 } 2068 else { 2069 pci = (PCNRITEM) CurrentRecord(hwnd); 2070 if (pci && (INT) pci != -1) { 2071 strcpy(path, pci->pszFileName); 2072 MakeValidDir(path); 2073 WinDlgBox(HWND_DESKTOP, hwnd, UndeleteDlgProc, FM3ModHandle, 2074 UNDEL_FRAME, MPFROMP(path)); 2075 } 2060 2076 } 2061 2077 } … … 2063 2079 2064 2080 case IDM_UNDELETESPEC: 2065 {2066 HOBJECT hObject;2067 HWND hwndDesktop;2068 2069 hObject = WinQueryObject("<XWP_TRASHCAN>");2070 if (hObject != NULLHANDLE && fTrashCan) {2071 hwndDesktop = WinQueryDesktopWindow((HAB) 0, NULLHANDLE);2081 { 2082 HOBJECT hObject; 2083 HWND hwndDesktop; 2084 2085 hObject = WinQueryObject("<XWP_TRASHCAN>"); 2086 if (hObject != NULLHANDLE && fTrashCan) { 2087 hwndDesktop = WinQueryDesktopWindow((HAB) 0, NULLHANDLE); 2072 2088 WinSetFocus(HWND_DESKTOP, hwndDesktop); 2073 WinOpenObject(hObject, 0, TRUE);2074 }2075 else2089 WinOpenObject(hObject, 0, TRUE); 2090 } 2091 else 2076 2092 WinDlgBox(HWND_DESKTOP, 2077 2093 hwnd, 2078 2094 UndeleteDlgProc, 2079 FM3ModHandle, UNDEL_FRAME, MPFROMP(dcd->directory));2080 }2081 break;2095 FM3ModHandle, UNDEL_FRAME, MPFROMP(dcd->directory)); 2096 } 2097 break; 2082 2098 2083 2099 case IDM_RESORT: … … 3338 3354 3339 3355 if ((INT)mp1 == 5 || (INT)mp1 == 13 || (INT)mp1 == 21) 3340 hwnd = StartViewer(HWND_DESKTOP, (INT)mp1,3341 (CHAR *)mp2, dcd->hwndFrame);3356 hwnd = StartViewer(HWND_DESKTOP, (INT)mp1, 3357 (CHAR *)mp2, dcd->hwndFrame); 3342 3358 else 3343 hwnd = StartMLEEditor(dcd->hwndParent,3344 (INT)mp1, (CHAR *)mp2, dcd->hwndFrame);3359 hwnd = StartMLEEditor(dcd->hwndParent, 3360 (INT)mp1, (CHAR *)mp2, dcd->hwndFrame); 3345 3361 xfree((CHAR *)mp2, pszSrcFile, __LINE__); 3346 3362 return MRFROMLONG(hwnd); … … 3400 3416 DirMenu = DirCnrMenu = FileMenu = (HWND) 0; 3401 3417 EmptyCnr(hwnd); 3418 # ifdef FORTIFY 3419 Fortify_LeaveScope(); 3420 # endif 3402 3421 break; 3403 3422 } // switch … … 3440 3459 if (!hwndMain && !first) { 3441 3460 if (DirCnrMenu) { 3442 3443 3461 MENUITEM mi; 3444 3445 3462 memset(&mi, 0, sizeof(mi)); 3446 3463 WinSendMsg(DirCnrMenu, … … 3470 3487 # ifdef FORTIFY 3471 3488 Fortify_EnterScope(); 3472 # endif3489 # endif 3473 3490 dcd = xmallocz(sizeof(DIRCNRDATA), pszSrcFile, __LINE__); 3474 3491 if (!dcd) { … … 3521 3538 IDS_WINCREATEWINDOW); 3522 3539 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID); 3523 free(dcd); 3524 # ifdef FORTIFY 3525 Fortify_LeaveScope(); 3526 # endif 3540 free(dcd); 3527 3541 hwndFrame = (HWND) 0; 3528 3542 } … … 3573 3587 } 3574 3588 } 3589 # ifdef FORTIFY 3590 Fortify_LeaveScope(); 3591 # endif 3575 3592 } 3576 3593 }  - 
      
trunk/dll/filldir.c
r1076 r1077 1595 1595 pci->pszLongName != pci->pszDisplayName + 1) { 1596 1596 psz = pci->pszLongName; 1597 // pci->pszLongName = NullStr;1598 pci->pszLongName = NULL; 1597 // pci->pszLongName = NullStr; 1598 pci->pszLongName = NULL; // for debug 1599 1599 free(psz); 1600 1600 } … … 1602 1602 if (pci->pszFileName && pci->pszFileName != NullStr) { 1603 1603 psz = pci->pszFileName; 1604 // pci->pszFileName = NullStr;1605 pci->pszFileName = NULL; 1604 // pci->pszFileName = NullStr; 1605 pci->pszFileName = NULL; // for debug 1606 1606 free(psz); 1607 1607 } … … 1609 1609 if (pci->pszFmtFileSize && pci->pszFmtFileSize != NullStr) { 1610 1610 psz = pci->pszFmtFileSize; 1611 // pci->pszFmtFileSize = NullStr;1612 pci->pszFmtFileSize = NULL; 1611 // pci->pszFmtFileSize = NullStr; 1612 pci->pszFmtFileSize = NULL; // for debug 1613 1613 free(psz); 1614 1614 }  - 
      
trunk/dll/fortify.c
r1072 r1077 43 43 /* 06 May 08 SHL Rework scope logic to be MT capable 44 44 26 May 08 SHL Show TID for leaking scope 45 17 Jul 08 SHL Add Fortify_SetOwner Fortify_ChangeOwner 45 17 Jul 08 SHL Add Fortify_SetOwner Fortify_ChangeOwner Fortify_ChangeScope 46 18 Jul 08 SHL Add FORTIFY_VERBOSE_SCOPE_ENTER_EXIT 46 47 */ 47 48 … … 177 178 #ifdef MT_SCOPES 178 179 static unsigned volatile st_cOrdinals; // Number of known threads 179 static unsigned volatilechar* st_pScopes; // Scope level of blocks allocated by thread180 static unsigned volatilelong* st_pOwners; // Owner of blocks allocated by thread180 static volatile unsigned char* st_pScopes; // Scope level of blocks allocated by thread 181 static volatile unsigned long* st_pOwners; // Owner of blocks allocated by thread 181 182 #else 182 183 static unsigned char st_Scope = 0; … … 997 998 FORTIFY_UNLOCK(); 998 999 } 999 return(++st_pScopes[ordinal]); 1000 i = ++st_pScopes[ordinal]; 1001 # ifdef FORTIFY_VERBOSE_SCOPE_ENTER_EXIT 1002 sprintf(st_Buffer, 1003 "Fortify: Entering scope %u in TID %u at %s.%lu\n", 1004 i, ordinal, 1005 file, line); // 26 May 08 SHL 1006 st_Output(st_Buffer); 1007 # endif 1008 return(i); 1000 1009 #else 1001 1010 return(++st_Scope); … … 1025 1034 // Complain on leave without enter 06 May 08 SHL 1026 1035 ordinal = Get_TID_Ordinal(); 1027 if (ordinal < st_cOrdinals && st_pScopes[ordinal] > 0) 1036 if (ordinal < st_cOrdinals && st_pScopes[ordinal] > 0) { 1028 1037 st_pScopes[ordinal]--; 1038 } 1029 1039 else { 1030 1040 sprintf(st_Buffer, 1031 "\nFortify: attempting to leave scope before enter at %s.%lu in TID %u\n",1032 file, line, ordinal); // 26 May 08 SHL1041 "\nFortify: Attempting to leave scope before enter in TID %u at %s.%lu\n", 1042 ordinal, file, line); // 26 May 08 SHL 1033 1043 st_Output(st_Buffer); 1034 1044 } … … 1037 1047 st_Scope--; 1038 1048 else { 1039 sprintf(st_Buffer, "\nFortify: attempting to leave scope before enter at %s.%lu\n", file, line);1049 sprintf(st_Buffer, "\nFortify: Attempting to leave scope before enter at %s.%lu\n", file, line); 1040 1050 st_Output(st_Buffer); 1041 1051 } … … 1054 1064 #ifdef MT_SCOPES 1055 1065 sprintf(st_Buffer, 1056 "\nFortify: Memory leak detected leaving scope at %s.%lu in TID %u\n", 1057 file, line, ordinal); 1066 "\nFortify: Memory leak detected leaving scope %d in TID %u at %s.%lu\n", 1067 ordinal < st_cOrdinals ? st_pScopes[ordinal] + 1 : 0, 1068 ordinal, 1069 file, line); 1058 1070 #else 1059 1071 sprintf(st_Buffer, "\nFortify: Memory leak detected leaving scope at %s.%lu\n", file, line); … … 1078 1090 st_Output(st_Buffer); 1079 1091 } 1092 # ifdef FORTIFY_VERBOSE_SCOPE_ENTER_EXIT 1093 else { 1094 sprintf(st_Buffer, 1095 "Fortify: Leaving scope %u in TID %u at %s.%lu\n", 1096 ordinal < st_cOrdinals ? st_pScopes[ordinal] + 1 : 0, 1097 ordinal, 1098 file, line); // 26 May 08 SHL 1099 st_Output(st_Buffer); 1100 } 1101 # endif 1080 1102 1081 1103 #ifdef FORTIFY_TRACK_DEALLOCATED_MEMORY … … 2430 2452 if (ordinal >= st_cOrdinals) { 2431 2453 // Expand arrays 2432 unsigned i;2433 unsigned c;2454 unsigned i; 2455 unsigned c; 2434 2456 FORTIFY_LOCK(); 2435 2457 i = st_cOrdinals; … … 2450 2472 /** 2451 2473 * Take ownership of block allocated by some other thread 2452 * Allows scope enter/exit logic to correctly report leaks in 2474 * Allows scope enter/exit logic to correctly report leaks in 2453 2475 * cross thread allocations 2454 * @param p Void is pointto block allocated by Fortify2476 * @param pBlock points to block allocated by Fortify 2455 2477 */ 2456 2478 … … 2466 2488 h->Scope = ordinal < st_cOrdinals ? st_pScopes[ordinal] : 0; 2467 2489 h->Owner = ordinal; // Take ownership 2490 st_MakeHeaderValid(h); 2491 } 2492 2493 /** 2494 * Adjust scope level of allocated block 2495 * Allows scope enter/exit logic to correctly report leaks in 2496 * window procedure related allocations 2497 * @param pBlock points to block allocated by Fortify 2498 */ 2499 2500 void Fortify_ChangeScope(void *pBlock, int delta) 2501 { 2502 unsigned char *ptr = (unsigned char *)pBlock - 2503 FORTIFY_HEADER_SIZE - 2504 FORTIFY_ALIGNED_BEFORE_SIZE; 2505 struct Header *h = (struct Header *)ptr; 2506 h->Scope += delta; 2507 st_MakeHeaderValid(h); 2468 2508 } 2469 2509  - 
      
trunk/dll/fortify.h
r1072 r1077 42 42 43 43 /* 06 May 08 SHL Rework scope logic to be MT capable 44 17 Jul 08 SHL Add Fortify_SetOwner Fortify_ChangeOwner 44 17 Jul 08 SHL Add Fortify_SetOwner Fortify_ChangeOwner Fortify_ChangeScope 45 45 */ 46 46 … … 190 190 191 191 #ifdef MT_SCOPES 192 void Fortify_SetOwner(long lOwnerTID); 193 void Fortify_ChangeOwner(void *pBlock); 192 void Fortify_SetOwner(long lOwnerTID); 193 void Fortify_ChangeOwner(void *pBlock); 194 void Fortify_ChangeScope(void *pBlock, int delta); 194 195 #endif 195 196 … … 228 229 */ 229 230 #ifdef FORTIFY_PROVIDE_ARRAY_NEW 230 void *operator new[](size_t size);231 void *operator new[](size_t size, const char *file, unsigned long line); // 16 Jan 08 SHL231 void *operator new[](size_t size); 232 void *operator new[](size_t size, const char *file, unsigned long line); // 16 Jan 08 SHL 232 233 #endif 233 234 … … 236 237 */ 237 238 #ifdef FORTIFY_PROVIDE_ARRAY_DELETE 238 void operator delete[](void *pointer);239 void operator delete[](void *pointer); 239 240 #endif 240 241 … … 266 267 /* Fortify versions of some non-ANSI C memory allocation functions */ 267 268 #ifdef FORTIFY_STRDUP 268 #define strdup(ptr) Fortify_strdup(ptr, __FILE__, __LINE__)269 #define strdup(ptr) Fortify_strdup(ptr, __FILE__, __LINE__) 269 270 #endif 270 271 271 272 /* Fortify versions of new and delete */ 272 273 #ifdef __cplusplus 273 #define Fortify_New new(__FILE__, __LINE__)274 #define Fortify_Delete for(gbl_FortifyMagic = 1, \275 Fortify_PreDelete(__FILE__, __LINE__); \276 gbl_FortifyMagic; Fortify_PostDelete()) \277 gbl_FortifyMagic = 0, delete278 #define new Fortify_New279 #define delete Fortify_Delete274 #define Fortify_New new(__FILE__, __LINE__) 275 #define Fortify_Delete for(gbl_FortifyMagic = 1, \ 276 Fortify_PreDelete(__FILE__, __LINE__); \ 277 gbl_FortifyMagic; Fortify_PostDelete()) \ 278 gbl_FortifyMagic = 0, delete 279 #define new Fortify_New 280 #define delete Fortify_Delete 280 281 #endif /* __cplusplus */ 281 282  - 
      
trunk/dll/init.c
r1076 r1077 44 44 29 Feb 08 GKY Refactor global command line variables to notebook.h 45 45 08 Mar 08 JBS Ticket 230: Replace prefixless INI keys for default directory containers with 46 keys using a "DirCnr." prefix46 keys using a "DirCnr." prefix 47 47 20 Apr 08 GKY Change default cmd line length to 1024 Ask once if user wants to reset it. 48 48 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating 49 all the details view settings (both the global variables and those in the50 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.49 all the details view settings (both the global variables and those in the 50 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS. 51 51 16 JUL 08 GKY Use TMP directory for temp files 52 52 17 Jul 08 SHL Reduce code bulk in fUseTmp setup … … 81 81 #include "strutil.h" // GetPString 82 82 #include "fm3dll.h" 83 #include "notebook.h" // command line variables (editor etc)83 #include "notebook.h" // command line variables (editor etc) 84 84 #include "fortify.h" 85 85 … … 660 660 if (fs3.attrFile & FILE_DIRECTORY) { 661 661 // 17 Jul 08 SHL fixme to check writable someday 662 pTmpDir = xstrdup(env, pszSrcFile, __LINE__);662 pTmpDir = xstrdup(env, pszSrcFile, __LINE__); 663 663 } 664 664 } 665 665 } 666 BldFullPathName(ArcTempRoot, env, fAmAV2 ? "$AV$ARC$" : "$FM$ARC$");666 BldFullPathName(ArcTempRoot, pTmpDir, fAmAV2 ? "$AV$ARC$" : "$FM$ARC$"); 667 667 668 668 /* initialize random number generator */ … … 731 731 else { 732 732 if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) { 733 saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,734 "Check INI header failed will attempt to replace with backup \\735 if backup fails or not found will open with new ini");736 DosCopy("FM3.INI", "FM3INI.BAD", DCPY_EXISTING);737 DosCopy("FM3INI.BAK", "FM3.INI", DCPY_EXISTING);738 if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) {739 DosCopy("FM3.INI", "FM3INI2.BAD", DCPY_EXISTING);740 fWantFirstTimeInit = TRUE;741 }733 saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING, 734 "Check INI header failed will attempt to replace with backup \\ 735 if backup fails or not found will open with new ini"); 736 DosCopy("FM3.INI", "FM3INI.BAD", DCPY_EXISTING); 737 DosCopy("FM3INI.BAK", "FM3.INI", DCPY_EXISTING); 738 if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) { 739 DosCopy("FM3.INI", "FM3INI2.BAD", DCPY_EXISTING); 740 fWantFirstTimeInit = TRUE; 741 } 742 742 } 743 743 if (!fWantFirstTimeInit) { 744 fIniExisted = TRUE;745 if (fs3.attrFile & (FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM)) {746 fs3.attrFile &= ~(FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM);747 rc = xDosSetPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3), 0);748 if (rc) {749 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,750 GetPString(IDS_INIREADONLYTEXT), inipath);751 }752 }744 fIniExisted = TRUE; 745 if (fs3.attrFile & (FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM)) { 746 fs3.attrFile &= ~(FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM); 747 rc = xDosSetPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3), 0); 748 if (rc) { 749 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 750 GetPString(IDS_INIREADONLYTEXT), inipath); 751 } 752 } 753 753 } 754 754 } … … 763 763 if (!fmprof) { 764 764 Win_Error(NULLHANDLE, NULLHANDLE, pszSrcFile, __LINE__, 765 "PrfOpenProfile");765 "PrfOpenProfile"); 766 766 return FALSE; 767 767 } … … 1019 1019 if (!MaxComLineChecked) { 1020 1020 ret = saymsg(MB_YESNO, 1021 HWND_DESKTOP,1022 NullStr,1023 GetPString(IDS_CHANGECMDLINELENGTHDEFAULT));1021 HWND_DESKTOP, 1022 NullStr, 1023 GetPString(IDS_CHANGECMDLINELENGTHDEFAULT)); 1024 1024 if (ret == MBID_YES) 1025 MaxComLineStrg = 1024;1025 MaxComLineStrg = 1024; 1026 1026 MaxComLineChecked = TRUE; 1027 1027 PrfWriteProfileData(fmprof, appname, "MaxComLineChecked", &MaxComLineChecked, sizeof(BOOL)); … … 1525 1525 if (!DosRead(handle, buffer, l, &len) && len == l) { 1526 1526 if (!memcmp(signature, buffer, l)) 1527 ret = TRUE; // Matched1527 ret = TRUE; // Matched 1528 1528 } 1529 1529 }  - 
      
trunk/dll/killproc.c
r1075 r1077 38 38 #include "errutil.h" // Dos_Error... 39 39 #include "strutil.h" // GetPString 40 #include "pathutil.h" // BldFullPathName40 #include "pathutil.h" // BldFullPathName 41 41 #include "fm3dll.h" 42 42 #include "fortify.h" … … 113 113 if (!stricmp(pmi->szModName, "SYSINIT")) 114 114 GetDosPgmName(ppi->pid, s + strlen(s)); 115 else {115 else { 116 116 if (*pmi->szModName) 117 strcat(s, pmi->szModName);117 strcat(s, pmi->szModName); 118 118 else 119 119 strcat(s, GetPString(IDS_UNKNOWNPROCTEXT)); … … 182 182 if (!stricmp((CHAR *) pmi->pName, "SYSINIT")) 183 183 GetDosPgmName(ppi->pid, s + strlen(s)); 184 else {184 else { 185 185 if (*pmi->pName) 186 strcat(s, (CHAR *) pmi->pName);186 strcat(s, (CHAR *) pmi->pName); 187 187 else 188 188 strcat(s, GetPString(IDS_UNKNOWNPROCTEXT)); … … 197 197 } 198 198 } 199 ppi = (QSPREC *) (ppi->pThrdRec + ppi->cTCB); 199 ppi = (QSPREC *) (ppi->pThrdRec + ppi->cTCB); // 22 Jun 08 SHL fixme to know why this looks odd 200 200 } // while 201 201 } … … 254 254 DosDupHandle(fileno(fp), &oldstdout); 255 255 rc = runemf2(SEPARATE | INVISIBLE | FULLSCREEN | BACKGROUND | WAIT, 256 hwnd, pszSrcFile, __LINE__, NULL, NULL,257 "%s", "PSTAT.EXE /C");256 hwnd, pszSrcFile, __LINE__, NULL, NULL, 257 "%s", "PSTAT.EXE /C"); 258 258 oldstdout = fileno(stdout); 259 259 DosDupHandle(newstdout, &oldstdout); … … 363 363 PrfWriteProfileData(fmprof, 364 364 FM3Str, 365 "UseQProcStat", &fUseQProcStat, sizeof(BOOL));365 "UseQProcStat", &fUseQProcStat, sizeof(BOOL)); 366 366 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(KILL_RESCAN, 0), MPVOID); 367 367 if (WinQueryButtonCheckstate(hwnd, KILL_CHECKBOX)) { … … 437 437 DosSleep(100); // 05 Aug 07 GKY 250 438 438 else 439 WinDismissDlg(hwnd, 0);439 WinDismissDlg(hwnd, 0); 440 440 } 441 441 else if (fUseQSysState) 442 if (_beginthread(FillKillListThread3,442 if (_beginthread(FillKillListThread3, 443 443 NULL, 65536, (PVOID) & hwnd) != -1) 444 444 DosSleep(100);//05 Aug 07 GKY 250 445 445 else 446 WinDismissDlg(hwnd, 0);446 WinDismissDlg(hwnd, 0); 447 447 else { 448 448 if (_beginthread(FillKillListThread, 449 449 NULL, 65536, (PVOID) & hwnd) != -1) 450 DosSleep(100); // 05 Aug 07 GKY 250450 DosSleep(100); // 05 Aug 07 GKY 250 451 451 else 452 452 WinDismissDlg(hwnd, 0);  - 
      
trunk/dll/mainwnd.c
r1066 r1077 60 60 07 Jul 08 JBS Ticket 242: Delete obsolete INI keys when re-saving a state 61 61 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating 62 all the details view settings (both the global variables and those in the63 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.62 all the details view settings (both the global variables and those in the 63 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS. 64 64 12 Jul 08 JBS Ticket 246: Allow saved directory container states to have no directory containers 65 (i.e. just a directory tree container). 65 (i.e. just a directory tree container). 66 18 Jul 08 SHL Use new Fortify feature to avoid spurious reports 66 67 67 68 ***********************************************************************/ … … 70 71 #include <string.h> 71 72 #include <ctype.h> 72 #include <process.h> // _beginthread73 #include <process.h> // _beginthread 73 74 74 75 #define INCL_DOS 75 76 #define INCL_WIN 76 #define INCL_SHLERRORS // PMERR_NOT_IN_IDX77 #define INCL_SHLERRORS // PMERR_NOT_IN_IDX 77 78 #define INCL_WINHELP 78 79 #define INCL_GPI … … 84 85 #include "comp.h" 85 86 #include "datamin.h" 86 #include "pathutil.h" // BldQuotedFileName 87 #include "errutil.h" // Dos_Error... 88 #include "strutil.h" // GetPString 89 #include "notebook.h" // CfgDlgProc CfgMenuInit 90 #include "command.h" // LINKCMDS 87 #include "pathutil.h" // BldQuotedFileName 88 #include "errutil.h" // Dos_Error... 89 #include "strutil.h" // GetPString 90 #include "notebook.h" // CfgDlgProc CfgMenuInit 91 #include "command.h" // LINKCMDS 92 #include "avl.h" // free_archivers 93 #include "walkem.h" // free_setups... 91 94 #include "fm3dll.h" 92 #include "avl.h" // free_archivers93 95 94 96 #include "fortify.h" … … 105 107 106 108 static MRESULT EXPENTRY MainObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1, 107 MPARAM mp2)109 MPARAM mp2) 108 110 { 109 111 switch (msg) { 112 case WM_CREATE: 113 break; 114 110 115 case UM_SETUP: 111 116 case UM_SETUP2: … … 131 136 *dv = 0; 132 137 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwndB, QW_PARENT), 133 id + 50), sizeof(dv), dv);138 id + 50), sizeof(dv), dv); 134 139 d = toupper(*dv); 135 140 if (isalpha(d) && d > 'B' && 136 !(driveflags[d - 'A'] & (DRIVE_CDROM | DRIVE_INVALID |137 DRIVE_SLOW)) &&138 (!hwndBubble ||139 WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) &&140 !WinQueryCapture(HWND_DESKTOP)) {141 142 FSALLOCATE fsa;143 CHAR s[90], szQty[38];144 ULONG ulPctFree;145 ULONGLONG ullFreeQty;146 147 if (!DosQueryFSInfo((d - 'A') + 1,148 FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) {149 ullFreeQty = (ULONGLONG) fsa.cUnitAvail *150 (fsa.cSectorUnit * fsa.cbSector);151 ulPctFree = (fsa.cUnit && fsa.cUnitAvail) ?152 (fsa.cUnitAvail * 100) / fsa.cUnit : 0;153 CommaFmtULL(szQty, sizeof(szQty), ullFreeQty, ' ');154 sprintf(s, "%s (%lu%%) free", szQty, ulPctFree);155 }156 if ((!hwndBubble ||157 WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) &&158 !WinQueryCapture(HWND_DESKTOP))159 WinSendMsg(hwndB, UM_SETUP6, MPFROMP(s), MPVOID);141 !(driveflags[d - 'A'] & (DRIVE_CDROM | DRIVE_INVALID | 142 DRIVE_SLOW)) && 143 (!hwndBubble || 144 WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) && 145 !WinQueryCapture(HWND_DESKTOP)) { 146 147 FSALLOCATE fsa; 148 CHAR s[90], szQty[38]; 149 ULONG ulPctFree; 150 ULONGLONG ullFreeQty; 151 152 if (!DosQueryFSInfo((d - 'A') + 1, 153 FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) { 154 ullFreeQty = (ULONGLONG) fsa.cUnitAvail * 155 (fsa.cSectorUnit * fsa.cbSector); 156 ulPctFree = (fsa.cUnit && fsa.cUnitAvail) ? 157 (fsa.cUnitAvail * 100) / fsa.cUnit : 0; 158 CommaFmtULL(szQty, sizeof(szQty), ullFreeQty, ' '); 159 sprintf(s, "%s (%lu%%) free", szQty, ulPctFree); 160 } 161 if ((!hwndBubble || 162 WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) && 163 !WinQueryCapture(HWND_DESKTOP)) 164 WinSendMsg(hwndB, UM_SETUP6, MPFROMP(s), MPVOID); 160 165 } 161 166 } … … 168 173 169 174 if (DosQuerySysInfo(QSV_BOOT_DRIVE, 170 QSV_BOOT_DRIVE,171 (PVOID) & bd, (ULONG) sizeof(ULONG)))172 bd = 3L;175 QSV_BOOT_DRIVE, 176 (PVOID) & bd, (ULONG) sizeof(ULONG))) 177 bd = 3L; 173 178 *s = (CHAR) bd + '@'; 174 179 WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPFROMLONG(1)); 175 180 if (!mp1) { 176 s[3] = 0;177 WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPVOID);181 s[3] = 0; 182 WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPVOID); 178 183 } 179 184 PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMLONG(1), MPFROMLONG(1)); … … 215 220 if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID)) 216 221 WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID); 217 # ifdef FORTIFY218 Fortify_LeaveScope();219 # endif220 222 break; 221 223 } … … 236 238 DosError(FERR_DISABLEHARDERR); 237 239 WinRegisterClass(hab2, 238 (PSZ) WC_OBJECTWINDOW,239 MainObjectWndProc, 0, sizeof(PVOID));240 (PSZ) WC_OBJECTWINDOW, 241 MainObjectWndProc, 0, sizeof(PVOID)); 240 242 MainObjectHwnd = WinCreateWindow(HWND_OBJECT, 241 WC_OBJECTWINDOW,242 (PSZ) NULL,243 0,244 0L,245 0L,246 0L,247 0L,248 0L, HWND_TOP, OBJ_FRAME, NULL, NULL);243 WC_OBJECTWINDOW, 244 (PSZ) NULL, 245 0, 246 0L, 247 0L, 248 0L, 249 0L, 250 0L, HWND_TOP, OBJ_FRAME, NULL, NULL); 249 251 if (!MainObjectHwnd) 250 Win_Error2(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__,251 IDS_WINCREATEWINDOW);252 Win_Error2(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__, 253 IDS_WINCREATEWINDOW); 252 254 else { 253 WinSetWindowPtr(MainObjectHwnd, QWL_USER, args); 254 while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0)) 255 WinDispatchMsg(hab2, &qmsg2); 256 WinDestroyWindow(MainObjectHwnd); 255 WinSetWindowPtr(MainObjectHwnd, QWL_USER, args); 256 # ifdef FORTIFY 257 Fortify_EnterScope(); 258 # endif 259 while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0)) 260 WinDispatchMsg(hab2, &qmsg2); 261 WinDestroyWindow(MainObjectHwnd); 262 # ifdef FORTIFY 263 Fortify_LeaveScope(); 264 # endif 257 265 } 258 266 WinDestroyMsgQueue(hmq2); … … 263 271 264 272 static MRESULT EXPENTRY IdealButtonProc(HWND hwnd, ULONG msg, MPARAM mp1, 265 MPARAM mp2)273 MPARAM mp2) 266 274 { 267 275 switch (msg) { … … 283 291 while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) { 284 292 if (hwndC != exclude) { 285 id = WinQueryWindowUShort(hwndC, QWS_ID);286 if (id)287 break;293 id = WinQueryWindowUShort(hwndC, QWS_ID); 294 if (id) 295 break; 288 296 } 289 297 } … … 305 313 henum = WinBeginEnumWindows(hwndMain); 306 314 while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) { 307 // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu",hwndTree,exclude,hwndC);308 if (hwndC != exclude && hwndC != hwndTree) {309 id = WinQueryWindowUShort(hwndC, QWS_ID);310 if (id) {311 hwndClient = WinWindowFromID(hwndC, FID_CLIENT);312 if (hwndClient) {313 hwndDir = WinWindowFromID(hwndClient, DIR_CNR);314 if (hwndDir) {315 if (fLookInDir) {316 pci = (PCNRITEM) WinSendMsg(hwndDir,317 CM_QUERYRECORDEMPHASIS,318 MPFROMLONG(CMA_FIRST),319 MPFROMSHORT(CRA_CURSORED));320 if (pci && (INT) pci != -1)321 break;322 }323 if (WinSendMsg(hwndClient,324 UM_CONTAINERDIR, MPFROMP(ret), MPVOID)) {325 MakeValidDir(ret);326 // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu\r\"%s\"",hwndTree,exclude,hwndC,ret);327 WinEndEnumWindows(henum);328 return hwndC;329 }330 }331 }332 }333 }315 // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu",hwndTree,exclude,hwndC); 316 if (hwndC != exclude && hwndC != hwndTree) { 317 id = WinQueryWindowUShort(hwndC, QWS_ID); 318 if (id) { 319 hwndClient = WinWindowFromID(hwndC, FID_CLIENT); 320 if (hwndClient) { 321 hwndDir = WinWindowFromID(hwndClient, DIR_CNR); 322 if (hwndDir) { 323 if (fLookInDir) { 324 pci = (PCNRITEM) WinSendMsg(hwndDir, 325 CM_QUERYRECORDEMPHASIS, 326 MPFROMLONG(CMA_FIRST), 327 MPFROMSHORT(CRA_CURSORED)); 328 if (pci && (INT) pci != -1) 329 break; 330 } 331 if (WinSendMsg(hwndClient, 332 UM_CONTAINERDIR, MPFROMP(ret), MPVOID)) { 333 MakeValidDir(ret); 334 // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu\r\"%s\"",hwndTree,exclude,hwndC,ret); 335 WinEndEnumWindows(henum); 336 return hwndC; 337 } 338 } 339 } 340 } 341 } 334 342 } 335 343 WinEndEnumWindows(henum); 336 344 if (!pci || (INT) pci == -1) { 337 hwndC = hwndTree;338 pci = (PCNRITEM) WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree,339 FID_CLIENT),340 TREE_CNR),341 CM_QUERYRECORDEMPHASIS,342 MPFROMLONG(CMA_FIRST),343 MPFROMSHORT(CRA_CURSORED));345 hwndC = hwndTree; 346 pci = (PCNRITEM) WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree, 347 FID_CLIENT), 348 TREE_CNR), 349 CM_QUERYRECORDEMPHASIS, 350 MPFROMLONG(CMA_FIRST), 351 MPFROMSHORT(CRA_CURSORED)); 344 352 } 345 353 if (pci && (INT) pci != -1) { 346 strcpy(ret, pci->pszFileName);347 MakeValidDir(ret);354 strcpy(ret, pci->pszFileName); 355 MakeValidDir(ret); 348 356 } 349 357 else 350 save_dir2(ret);358 save_dir2(ret); 351 359 } 352 360 } … … 366 374 hwndDir = WinWindowFromID(hwndC, DIR_CNR); 367 375 if (hwndDir) 368 ret++;376 ret++; 369 377 } 370 378 } … … 384 392 hwndC = WinWindowFromID(hwndF, FID_CLIENT); 385 393 if (hwndC) { 386 hwndDir = WinWindowFromID(hwndC, DIR_CNR);387 if (hwndDir) {388 *retstr = 0;389 WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(retstr), MPVOID);390 if (*retstr && !stricmp(retstr, directory)) {391 if (restore)392 WinSetWindowPos(hwndF,393 HWND_TOP,394 0,395 0,396 0,397 0,398 SWP_RESTORE | SWP_SHOW |399 SWP_ACTIVATE | SWP_ZORDER);400 break;401 }402 }394 hwndDir = WinWindowFromID(hwndC, DIR_CNR); 395 if (hwndDir) { 396 *retstr = 0; 397 WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(retstr), MPVOID); 398 if (*retstr && !stricmp(retstr, directory)) { 399 if (restore) 400 WinSetWindowPos(hwndF, 401 HWND_TOP, 402 0, 403 0, 404 0, 405 0, 406 SWP_RESTORE | SWP_SHOW | 407 SWP_ACTIVATE | SWP_ZORDER); 408 break; 409 } 410 } 403 411 } 404 412 } … … 467 475 while (tool) { 468 476 if (!(tool->flags & T_INVISIBLE)) { 469 swp[x].x = butx;470 if (fTextTools || (tool->flags & T_TEXT)) {471 butx += 55L;472 swp[x].cx = 54L;473 swp[x].cy = 24L;474 swp[x].y = 3L;475 }476 else477 butx += 33L;478 if (tool->flags & T_SEPARATOR)479 butx += 12;477 swp[x].x = butx; 478 if (fTextTools || (tool->flags & T_TEXT)) { 479 butx += 55L; 480 swp[x].cx = 54L; 481 swp[x].cy = 24L; 482 swp[x].y = 3L; 483 } 484 else 485 butx += 33L; 486 if (tool->flags & T_SEPARATOR) 487 butx += 12; 480 488 } 481 489 else 482 swp[x].fl = noattrib;490 swp[x].fl = noattrib; 483 491 swp[x].hwnd = WinWindowFromID(hwnd, tool->id); 484 492 x++; … … 489 497 swp[x].x = butx; 490 498 if (!(tool->flags & T_INVISIBLE)) { 491 if (fTextTools || (tool->flags & T_TEXT)) {492 butx += 55L;493 swp[x].cx = 54L;494 swp[x].cy = 24L;495 swp[x].y = 3L;496 }497 else498 butx += 33L;499 if (tool->flags & T_SEPARATOR)500 butx += 12;499 if (fTextTools || (tool->flags & T_TEXT)) { 500 butx += 55L; 501 swp[x].cx = 54L; 502 swp[x].cy = 24L; 503 swp[x].y = 3L; 504 } 505 else 506 butx += 33L; 507 if (tool->flags & T_SEPARATOR) 508 butx += 12; 501 509 } 502 510 else 503 swp[x].fl = noattrib;511 swp[x].fl = noattrib; 504 512 swp[x].hwnd = WinWindowFromID(hwnd, tool->id); 505 513 x++; … … 509 517 if (!fTextTools && fToolTitles) { 510 518 for (x = 2L; x < numtools + 2L; x++) { 511 if (fTextTools || !fToolTitles)512 swp[x].fl = noattrib;513 else {514 tool = find_tool(WinQueryWindowUShort(swp[x].hwnd, QWS_ID));515 if (tool && (tool->flags & T_TEXT))516 swp[x].fl = noattrib;517 else {518 swp[x].hwndInsertBehind = HWND_TOP;519 swp[x].y = 1L;520 swp[x].cy = 10L;521 }522 }523 swp[x].hwnd = WinWindowFromID(hwnd,524 WinQueryWindowUShort(swp[x].hwnd,525 QWS_ID) + 25000);519 if (fTextTools || !fToolTitles) 520 swp[x].fl = noattrib; 521 else { 522 tool = find_tool(WinQueryWindowUShort(swp[x].hwnd, QWS_ID)); 523 if (tool && (tool->flags & T_TEXT)) 524 swp[x].fl = noattrib; 525 else { 526 swp[x].hwndInsertBehind = HWND_TOP; 527 swp[x].y = 1L; 528 swp[x].cy = 10L; 529 } 530 } 531 swp[x].hwnd = WinWindowFromID(hwnd, 532 WinQueryWindowUShort(swp[x].hwnd, 533 QWS_ID) + 25000); 526 534 } 527 535 WinSetMultWindowPos(WinQueryAnchorBlock(hwnd), &swp[2], numtools); … … 533 541 534 542 static MRESULT EXPENTRY DropDownListProc(HWND hwnd, ULONG msg, MPARAM mp1, 535 MPARAM mp2)543 MPARAM mp2) 536 544 { 537 545 PFNWP oldproc = (PFNWP) INSTDATA(hwnd); … … 571 579 id = WinQueryWindowUShort(hwndParent, QWS_ID); 572 580 if (SHORT1FROMMP(mp2)) { 573 // If getting focus 1st time - save original accelerator574 if (haccelSaved == NULLHANDLE) {575 haccelSaved = WinQueryAccelTable(hab, hwndFrame);576 if (haccelSaved == NULLHANDLE)577 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryAccelTable");578 // else579 // DbgMsg(pszSrcFile, __LINE__, "WinQueryAccelTable SAVED %x", haccelSaved);580 }581 if (haccelSaved != NULLHANDLE) {582 switch (id) {583 case MAIN_DRIVELIST:584 if (haccelDriveList == NULLHANDLE) {585 haccelDriveList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_DRIVELIST);586 if (haccelDriveList == NULLHANDLE)587 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");588 }589 if (haccelDriveList != NULLHANDLE) {590 if (!WinSetAccelTable(hab, haccelDriveList, hwndFrame))591 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");592 // else593 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_DRIVELIST %x %x", hwndFrame, haccelDriveList);594 }595 break;596 case MAIN_SETUPLIST:597 if (haccelSetupList == NULLHANDLE) {598 haccelSetupList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_SETUPLIST);599 if (haccelSetupList == NULLHANDLE)600 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");601 }602 if (haccelSetupList != NULLHANDLE) {603 if (!WinSetAccelTable(hab, haccelSetupList, hwndFrame))604 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");605 // else606 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_SETUPLIST %x %x", hwndFrame, haccelSetupList);607 }608 break;609 case MAIN_CMDLIST:610 if (haccelCmdList == NULLHANDLE) {611 haccelCmdList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_CMDLIST);612 if (haccelCmdList == NULLHANDLE)613 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");614 }615 if (haccelCmdList != NULLHANDLE) {616 if (!WinSetAccelTable(hab, haccelCmdList, hwndFrame))617 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");618 // else619 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_CMDLIST %x %x", hwndFrame, haccelCmdList);620 }621 break;622 case MAIN_USERLIST:623 if (haccelUserList == NULLHANDLE) {624 haccelUserList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_USERLIST);625 if (haccelUserList == NULLHANDLE)626 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");627 }628 if (haccelUserList != NULLHANDLE) {629 if (!WinSetAccelTable(hab, haccelUserList, hwndFrame))630 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");631 // else632 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_USERLIST %x %x", hwndFrame, haccelUserList);633 }634 break;635 case MAIN_BUTTONLIST:636 if (haccelButtonList == NULLHANDLE) {637 haccelButtonList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_BUTTONLIST);638 if (haccelButtonList == NULLHANDLE)639 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");640 }641 if (haccelButtonList != NULLHANDLE) {642 if (!WinSetAccelTable(hab, haccelButtonList, hwndFrame))643 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");644 // else645 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_BUTTONLIST %x %x", hwndFrame, haccelButtonList);646 }647 break;648 } // switch649 }581 // If getting focus 1st time - save original accelerator 582 if (haccelSaved == NULLHANDLE) { 583 haccelSaved = WinQueryAccelTable(hab, hwndFrame); 584 if (haccelSaved == NULLHANDLE) 585 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryAccelTable"); 586 // else 587 // DbgMsg(pszSrcFile, __LINE__, "WinQueryAccelTable SAVED %x", haccelSaved); 588 } 589 if (haccelSaved != NULLHANDLE) { 590 switch (id) { 591 case MAIN_DRIVELIST: 592 if (haccelDriveList == NULLHANDLE) { 593 haccelDriveList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_DRIVELIST); 594 if (haccelDriveList == NULLHANDLE) 595 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 596 } 597 if (haccelDriveList != NULLHANDLE) { 598 if (!WinSetAccelTable(hab, haccelDriveList, hwndFrame)) 599 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 600 // else 601 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_DRIVELIST %x %x", hwndFrame, haccelDriveList); 602 } 603 break; 604 case MAIN_SETUPLIST: 605 if (haccelSetupList == NULLHANDLE) { 606 haccelSetupList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_SETUPLIST); 607 if (haccelSetupList == NULLHANDLE) 608 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 609 } 610 if (haccelSetupList != NULLHANDLE) { 611 if (!WinSetAccelTable(hab, haccelSetupList, hwndFrame)) 612 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 613 // else 614 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_SETUPLIST %x %x", hwndFrame, haccelSetupList); 615 } 616 break; 617 case MAIN_CMDLIST: 618 if (haccelCmdList == NULLHANDLE) { 619 haccelCmdList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_CMDLIST); 620 if (haccelCmdList == NULLHANDLE) 621 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 622 } 623 if (haccelCmdList != NULLHANDLE) { 624 if (!WinSetAccelTable(hab, haccelCmdList, hwndFrame)) 625 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 626 // else 627 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_CMDLIST %x %x", hwndFrame, haccelCmdList); 628 } 629 break; 630 case MAIN_USERLIST: 631 if (haccelUserList == NULLHANDLE) { 632 haccelUserList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_USERLIST); 633 if (haccelUserList == NULLHANDLE) 634 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 635 } 636 if (haccelUserList != NULLHANDLE) { 637 if (!WinSetAccelTable(hab, haccelUserList, hwndFrame)) 638 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 639 // else 640 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_USERLIST %x %x", hwndFrame, haccelUserList); 641 } 642 break; 643 case MAIN_BUTTONLIST: 644 if (haccelButtonList == NULLHANDLE) { 645 haccelButtonList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_BUTTONLIST); 646 if (haccelButtonList == NULLHANDLE) 647 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 648 } 649 if (haccelButtonList != NULLHANDLE) { 650 if (!WinSetAccelTable(hab, haccelButtonList, hwndFrame)) 651 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 652 // else 653 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_BUTTONLIST %x %x", hwndFrame, haccelButtonList); 654 } 655 break; 656 } // switch 657 } 650 658 } 651 659 else { 652 // Losing focus653 switch (id) {654 case MAIN_DRIVELIST:655 case MAIN_SETUPLIST:656 case MAIN_CMDLIST:657 case MAIN_USERLIST:658 case MAIN_BUTTONLIST:659 if (haccelSaved != NULLHANDLE) {660 if (!WinSetAccelTable(hab, haccelSaved, hwndFrame))661 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");662 // else663 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable SAVED %x %x", hwndFrame, haccelSaved);664 }665 break;666 } // switch660 // Losing focus 661 switch (id) { 662 case MAIN_DRIVELIST: 663 case MAIN_SETUPLIST: 664 case MAIN_CMDLIST: 665 case MAIN_USERLIST: 666 case MAIN_BUTTONLIST: 667 if (haccelSaved != NULLHANDLE) { 668 if (!WinSetAccelTable(hab, haccelSaved, hwndFrame)) 669 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 670 // else 671 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable SAVED %x %x", hwndFrame, haccelSaved); 672 } 673 break; 674 } // switch 667 675 } 668 676 } … … 674 682 675 683 if (hwndMenu) 676 WinDestroyWindow(hwndMenu);684 WinDestroyWindow(hwndMenu); 677 685 hwndMenu = (HWND) 0; 678 686 id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID); 679 687 switch (id) { 680 688 case MAIN_CMDLIST: 681 WinPostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,682 QW_PARENT),683 QW_PARENT),684 FID_CLIENT),685 WM_COMMAND, MPFROM2SHORT(IDM_EDITCOMMANDS, 0), MPVOID);686 break;689 WinPostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 690 QW_PARENT), 691 QW_PARENT), 692 FID_CLIENT), 693 WM_COMMAND, MPFROM2SHORT(IDM_EDITCOMMANDS, 0), MPVOID); 694 break; 687 695 case MAIN_USERLIST: 688 696 case MAIN_SETUPLIST: 689 hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);690 if (hwndMenu)691 PopupMenu(hwnd,692 WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,693 QW_PARENT),694 QW_PARENT),695 FID_CLIENT), hwndMenu);696 break;697 hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id); 698 if (hwndMenu) 699 PopupMenu(hwnd, 700 WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 701 QW_PARENT), 702 QW_PARENT), 703 FID_CLIENT), hwndMenu); 704 break; 697 705 default: 698 ret = FALSE;699 break;706 ret = FALSE; 707 break; 700 708 } // switch 701 709 return ret; … … 706 714 switch (SHORT1FROMMP(mp1)) { 707 715 case CBID_EDIT: 708 id = WinQueryWindowUShort(hwnd, QWS_ID);709 switch (SHORT2FROMMP(mp1)) {710 case EN_SETFOCUS:711 switch (id) {712 case MAIN_CMDLIST:713 WinSetWindowText(hwndStatus2, GetPString(IDS_CMDLISTHELP));714 break;715 case MAIN_SETUPLIST:716 WinSetWindowText(hwndStatus2, GetPString(IDS_SETUPLISTHELP));717 break;718 case MAIN_USERLIST:719 WinSetWindowText(hwndStatus2, GetPString(IDS_USERLISTHELP));720 break;721 case MAIN_DRIVELIST:722 WinSetWindowText(hwndStatus2, GetPString(IDS_DRIVELISTHELP));723 break;724 case MAIN_BUTTONLIST:725 WinSetWindowText(hwndStatus2, GetPString(IDS_BUTTONLISTHELP));726 break;727 default:728 break;729 }730 break;731 732 default:733 break;734 }716 id = WinQueryWindowUShort(hwnd, QWS_ID); 717 switch (SHORT2FROMMP(mp1)) { 718 case EN_SETFOCUS: 719 switch (id) { 720 case MAIN_CMDLIST: 721 WinSetWindowText(hwndStatus2, GetPString(IDS_CMDLISTHELP)); 722 break; 723 case MAIN_SETUPLIST: 724 WinSetWindowText(hwndStatus2, GetPString(IDS_SETUPLISTHELP)); 725 break; 726 case MAIN_USERLIST: 727 WinSetWindowText(hwndStatus2, GetPString(IDS_USERLISTHELP)); 728 break; 729 case MAIN_DRIVELIST: 730 WinSetWindowText(hwndStatus2, GetPString(IDS_DRIVELISTHELP)); 731 break; 732 case MAIN_BUTTONLIST: 733 WinSetWindowText(hwndStatus2, GetPString(IDS_BUTTONLISTHELP)); 734 break; 735 default: 736 break; 737 } 738 break; 739 740 default: 741 break; 742 } 735 743 } 736 744 break; … … 745 753 // 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); 746 754 if (id == CBID_EDIT && 747 WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID) ==748 MAIN_USERLIST) {755 WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID) == 756 MAIN_USERLIST) { 749 757 750 758 CHAR path[CCHMAXPATH]; … … 755 763 // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Dragging: %s",path); 756 764 if (*path && !IsRoot(path)) 757 DragOne(hwnd, (HWND) 0, path, FALSE);765 DragOne(hwnd, (HWND) 0, path, FALSE); 758 766 return 0; 759 767 } … … 764 772 if (id == MAIN_USERLIST) { 765 773 if (!emphasized) { 766 emphasized = TRUE;767 DrawTargetEmphasis(hwnd, emphasized);774 emphasized = TRUE; 775 DrawTargetEmphasis(hwnd, emphasized); 768 776 } 769 777 if (AcceptOneDrop(hwnd, mp1, mp2)) 770 return MRFROM2SHORT(DOR_DROP, DO_MOVE);778 return MRFROM2SHORT(DOR_DROP, DO_MOVE); 771 779 return MRFROM2SHORT(DOR_NEVERDROP, 0); 772 780 } … … 777 785 if (id == MAIN_USERLIST) { 778 786 if (emphasized) { 779 emphasized = FALSE;780 DrawTargetEmphasis(hwnd, emphasized);787 emphasized = FALSE; 788 DrawTargetEmphasis(hwnd, emphasized); 781 789 } 782 790 } … … 798 806 799 807 if (emphasized) { 800 emphasized = FALSE;801 DrawTargetEmphasis(hwnd, emphasized);808 emphasized = FALSE; 809 DrawTargetEmphasis(hwnd, emphasized); 802 810 } 803 811 if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) { 804 MakeValidDir(szFrom);805 WinSetWindowText(hwnd, szFrom);806 PostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,807 QW_PARENT),808 QW_PARENT),809 FID_CLIENT),810 UM_COMMAND, MPFROM2SHORT(IDM_ADDTOUSERLIST, 0), MPVOID);811 return 0;812 MakeValidDir(szFrom); 813 WinSetWindowText(hwnd, szFrom); 814 PostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 815 QW_PARENT), 816 QW_PARENT), 817 FID_CLIENT), 818 UM_COMMAND, MPFROM2SHORT(IDM_ADDTOUSERLIST, 0), MPVOID); 819 return 0; 812 820 } 813 821 } … … 830 838 (other && fOtherHelp) || (!other && !drive && fToolbarHelp))) { 831 839 if ((!hwndBubble || 832 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&833 !WinQueryCapture(HWND_DESKTOP))840 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) && 841 !WinQueryCapture(HWND_DESKTOP)) 834 842 MakeBubble(hwnd, above, help); 835 843 } … … 852 860 /* don't bring up help if window isn't active */ 853 861 if (!WinIsChild(hwnd, hwndActive)) 854 return;862 return; 855 863 } 856 864 hwndActive = WinQueryFocus(HWND_DESKTOP); … … 858 866 /* don't bring up help if a menu is active */ 859 867 if (!strcmp(ucClassname, "#4")) 860 return;868 return; 861 869 } 862 870 } 863 871 864 872 hwndBubble = WinCreateWindow(HWND_DESKTOP, 865 WC_BUBBLE,866 help,867 WS_CLIPSIBLINGS | SS_TEXT |868 DT_CENTER | DT_VCENTER,869 0,870 0,871 0,872 0,873 HWND_DESKTOP, HWND_TOP, MAIN_HELP, NULL, NULL);873 WC_BUBBLE, 874 help, 875 WS_CLIPSIBLINGS | SS_TEXT | 876 DT_CENTER | DT_VCENTER, 877 0, 878 0, 879 0, 880 0, 881 HWND_DESKTOP, HWND_TOP, MAIN_HELP, NULL, NULL); 874 882 if (!hwndBubble) 875 883 Win_Error2(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, 876 IDS_WINCREATEWINDOW);884 IDS_WINCREATEWINDOW); 877 885 else { 878 886 HPS hps; … … 894 902 pp = strchr(p, '\r'); 895 903 if (pp) { 896 wp = pp;897 *pp = 0;898 pp++;904 wp = pp; 905 *pp = 0; 906 pp++; 899 907 } 900 908 GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl); 901 909 tptl.x = max(aptl[TXTBOX_TOPRIGHT].x, tptl.x); 902 910 if (tptl.y) 903 tptl.y += extra;911 tptl.y += extra; 904 912 else 905 extra = aptl[TXTBOX_TOPLEFT].y / 4;913 extra = aptl[TXTBOX_TOPLEFT].y / 4; 906 914 tptl.y += aptl[TXTBOX_TOPLEFT].y; 907 915 if (wp) 908 *wp = '\r';916 *wp = '\r'; 909 917 p = pp; 910 918 } … … 916 924 sy = ptl.y + swp.cy + 4; 917 925 if (sy + tptl.y + 12 > lyScreen) { 918 above = FALSE;919 sy = ptl.y - (tptl.y + 14);926 above = FALSE; 927 sy = ptl.y - (tptl.y + 14); 920 928 } 921 929 } … … 933 941 sy = ptl.y + swp.cy + 4; 934 942 if (sy + tptl.y + 12 > lyScreen) 935 sy = 0;943 sy = 0; 936 944 } 937 945 WinSetWindowPos(hwndBubble, HWND_TOP, sx, sy, 938 tptl.x + 14,939 tptl.y + 12,940 SWP_DEACTIVATE | SWP_SHOW | SWP_ZORDER |941 SWP_MOVE | SWP_SIZE);946 tptl.x + 14, 947 tptl.y + 12, 948 SWP_DEACTIVATE | SWP_SHOW | SWP_ZORDER | 949 SWP_MOVE | SWP_SIZE); 942 950 } 943 951 } … … 965 973 WinQueryPointerPos(HWND_DESKTOP, &ptl); 966 974 if (WinWindowFromPoint(HWND_DESKTOP, &ptl, TRUE) != 967 WinQueryWindowULong(hwnd, QWL_USER) || !WinIsWindowVisible(hwnd))968 WinDestroyWindow(hwnd);975 WinQueryWindowULong(hwnd, QWL_USER) || !WinIsWindowVisible(hwnd)) 976 WinDestroyWindow(hwnd); 969 977 } 970 978 return 0; … … 980 988 hps = WinBeginPaint(hwnd, (HPS) 0, NULL); 981 989 if (hps) { 982 WinQueryWindowPos(hwnd, &swp);983 GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, 0);984 GpiSetColor(hps, ((255 << 16) | (255 << 8) | 198));985 GpiSetBackMix(hps, BM_LEAVEALONE);986 GpiSetMix(hps, FM_OVERPAINT);987 ptl.x = ptl.y = 0;988 GpiMove(hps, &ptl);989 ptl.x = swp.cx - 1;990 ptl.y = swp.cy - 1;991 GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0);992 tlen = WinQueryWindowTextLength(hwnd);993 if (tlen) {994 s = xmalloc(tlen + 2, pszSrcFile, __LINE__);995 if (s) {996 WinQueryWindowText(hwnd, tlen + 1, s);997 if (*s) {998 p = s;999 y = swp.cy - 3;1000 extra = WinQueryWindowULong(hwnd, QWL_USER + 4);1001 GpiSetColor(hps, 0);1002 GpiSetMix(hps, FM_OVERPAINT);1003 while (p && *p) {1004 wp = NULL;1005 pp = strchr(p, '\r');1006 if (pp) {1007 wp = pp;1008 *pp = 0;1009 pp++;1010 }1011 GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);1012 ptl.x = 7;1013 y -= aptl[TXTBOX_TOPLEFT].y;1014 if (p != s)1015 y -= extra;1016 ptl.y = y;1017 GpiCharStringAt(hps, &ptl, strlen(p), p);1018 if (wp)1019 *wp = '\r';1020 p = pp;1021 }1022 }1023 free(s);1024 }1025 }1026 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)) && swp.cx > 6 && swp.cy > 6) {1027 GpiSetColor(hps, CLR_WHITE);1028 ptl.x = 1;1029 ptl.y = 1;1030 GpiMove(hps, &ptl);1031 ptl.y = swp.cy - 2;1032 GpiLine(hps, &ptl);1033 ptl.x = swp.cx - 2;1034 GpiLine(hps, &ptl);1035 ptl.x = 2;1036 ptl.y = 2;1037 GpiMove(hps, &ptl);1038 ptl.y = swp.cy - 3;1039 GpiLine(hps, &ptl);1040 ptl.x = swp.cx - 3;1041 GpiLine(hps, &ptl);1042 GpiSetColor(hps, CLR_BROWN);1043 ptl.x = 1;1044 ptl.y = 1;1045 GpiMove(hps, &ptl);1046 ptl.x = swp.cx - 2;1047 GpiLine(hps, &ptl);1048 ptl.y = swp.cy - 2;1049 GpiLine(hps, &ptl);1050 ptl.x = 2;1051 ptl.y = 2;1052 GpiMove(hps, &ptl);1053 ptl.x = swp.cx - 3;1054 GpiLine(hps, &ptl);1055 ptl.y = swp.cy - 3;1056 GpiLine(hps, &ptl);1057 }1058 WinEndPaint(hps);990 WinQueryWindowPos(hwnd, &swp); 991 GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, 0); 992 GpiSetColor(hps, ((255 << 16) | (255 << 8) | 198)); 993 GpiSetBackMix(hps, BM_LEAVEALONE); 994 GpiSetMix(hps, FM_OVERPAINT); 995 ptl.x = ptl.y = 0; 996 GpiMove(hps, &ptl); 997 ptl.x = swp.cx - 1; 998 ptl.y = swp.cy - 1; 999 GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0); 1000 tlen = WinQueryWindowTextLength(hwnd); 1001 if (tlen) { 1002 s = xmalloc(tlen + 2, pszSrcFile, __LINE__); 1003 if (s) { 1004 WinQueryWindowText(hwnd, tlen + 1, s); 1005 if (*s) { 1006 p = s; 1007 y = swp.cy - 3; 1008 extra = WinQueryWindowULong(hwnd, QWL_USER + 4); 1009 GpiSetColor(hps, 0); 1010 GpiSetMix(hps, FM_OVERPAINT); 1011 while (p && *p) { 1012 wp = NULL; 1013 pp = strchr(p, '\r'); 1014 if (pp) { 1015 wp = pp; 1016 *pp = 0; 1017 pp++; 1018 } 1019 GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl); 1020 ptl.x = 7; 1021 y -= aptl[TXTBOX_TOPLEFT].y; 1022 if (p != s) 1023 y -= extra; 1024 ptl.y = y; 1025 GpiCharStringAt(hps, &ptl, strlen(p), p); 1026 if (wp) 1027 *wp = '\r'; 1028 p = pp; 1029 } 1030 } 1031 free(s); 1032 } 1033 } 1034 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)) && swp.cx > 6 && swp.cy > 6) { 1035 GpiSetColor(hps, CLR_WHITE); 1036 ptl.x = 1; 1037 ptl.y = 1; 1038 GpiMove(hps, &ptl); 1039 ptl.y = swp.cy - 2; 1040 GpiLine(hps, &ptl); 1041 ptl.x = swp.cx - 2; 1042 GpiLine(hps, &ptl); 1043 ptl.x = 2; 1044 ptl.y = 2; 1045 GpiMove(hps, &ptl); 1046 ptl.y = swp.cy - 3; 1047 GpiLine(hps, &ptl); 1048 ptl.x = swp.cx - 3; 1049 GpiLine(hps, &ptl); 1050 GpiSetColor(hps, CLR_BROWN); 1051 ptl.x = 1; 1052 ptl.y = 1; 1053 GpiMove(hps, &ptl); 1054 ptl.x = swp.cx - 2; 1055 GpiLine(hps, &ptl); 1056 ptl.y = swp.cy - 2; 1057 GpiLine(hps, &ptl); 1058 ptl.x = 2; 1059 ptl.y = 2; 1060 GpiMove(hps, &ptl); 1061 ptl.x = swp.cx - 3; 1062 GpiLine(hps, &ptl); 1063 ptl.y = swp.cy - 3; 1064 GpiLine(hps, &ptl); 1065 } 1066 WinEndPaint(hps); 1059 1067 } 1060 1068 } … … 1083 1091 switch (WinQueryWindowUShort(hwnd, QWS_ID)) { 1084 1092 case MAIN_LED: 1085 hps = WinGetPS(hwnd);1086 hbmold = (HBITMAP) WinSendMsg(hwnd, SM_QUERYHANDLE, MPVOID, MPVOID);1087 if (!fBlueLED) {1088 hbmLEDon = GpiLoadBitmap(hps, 0, LEDON_BMP, 12, 12);1089 hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF_BMP, 12, 12);1090 }1091 else {1092 hbmLEDon = GpiLoadBitmap(hps, 0, LEDON2_BMP, 12, 12);1093 hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF2_BMP, 12, 12);1094 }1095 if (hbmLEDoff && hbmLEDon)1096 WinSendMsg(hwnd, SM_SETHANDLE, MPFROMLONG(hbmLEDoff), MPVOID);1097 else {1098 if (hbmLEDoff)1099 GpiDeleteBitmap(hbmLEDoff);1100 if (hbmLEDon)1101 GpiDeleteBitmap(hbmLEDon);1102 }1103 if (hbmold &&1104 hbmLEDon &&1105 hbmLEDoff && hbmold != hbmLEDon && hbmold != hbmLEDoff)1106 GpiDeleteBitmap(hbmold);1107 if (hps)1108 WinReleasePS(hps);1109 break;1093 hps = WinGetPS(hwnd); 1094 hbmold = (HBITMAP) WinSendMsg(hwnd, SM_QUERYHANDLE, MPVOID, MPVOID); 1095 if (!fBlueLED) { 1096 hbmLEDon = GpiLoadBitmap(hps, 0, LEDON_BMP, 12, 12); 1097 hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF_BMP, 12, 12); 1098 } 1099 else { 1100 hbmLEDon = GpiLoadBitmap(hps, 0, LEDON2_BMP, 12, 12); 1101 hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF2_BMP, 12, 12); 1102 } 1103 if (hbmLEDoff && hbmLEDon) 1104 WinSendMsg(hwnd, SM_SETHANDLE, MPFROMLONG(hbmLEDoff), MPVOID); 1105 else { 1106 if (hbmLEDoff) 1107 GpiDeleteBitmap(hbmLEDoff); 1108 if (hbmLEDon) 1109 GpiDeleteBitmap(hbmLEDon); 1110 } 1111 if (hbmold && 1112 hbmLEDon && 1113 hbmLEDoff && hbmold != hbmLEDon && hbmold != hbmLEDoff) 1114 GpiDeleteBitmap(hbmold); 1115 if (hps) 1116 WinReleasePS(hps); 1117 break; 1110 1118 default: 1111 SetPresParams(hwnd,1112 &RGBGREY,1113 &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT));1114 break;1119 SetPresParams(hwnd, 1120 &RGBGREY, 1121 &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT)); 1122 break; 1115 1123 } 1116 1124 return mr; … … 1136 1144 case WM_BUTTON1CLICK: 1137 1145 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 1138 WM_COMMAND, MPFROM2SHORT(IDM_SHOWNOTEWND, 0), MPVOID);1146 WM_COMMAND, MPFROM2SHORT(IDM_SHOWNOTEWND, 0), MPVOID); 1139 1147 break; 1140 1148 1141 1149 case WM_BUTTON2CLICK: 1142 1150 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 1143 WM_COMMAND, MPFROM2SHORT(IDM_HIDENOTEWND, 0), MPVOID);1151 WM_COMMAND, MPFROM2SHORT(IDM_HIDENOTEWND, 0), MPVOID); 1144 1152 break; 1145 1153 … … 1147 1155 case WM_BUTTON3CLICK: 1148 1156 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 1149 WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);1157 WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID); 1150 1158 break; 1151 1159 } … … 1170 1178 if (fToolbarHelp) { 1171 1179 if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) 1172 && !WinQueryCapture(HWND_DESKTOP)) {1173 id = WinQueryWindowUShort(hwnd, QWS_ID);1174 tool = find_tool(id);1175 if (tool && tool->help && *tool->help) {1176 1177 char s[128];1178 1179 strcpy(s, tool->help);1180 if (tool->flags & T_DROPABLE)1181 strcat(s, GetPString(IDS_DROPONMETEXT));1182 MakeBubble(hwnd, FALSE, s);1183 }1180 && !WinQueryCapture(HWND_DESKTOP)) { 1181 id = WinQueryWindowUShort(hwnd, QWS_ID); 1182 tool = find_tool(id); 1183 if (tool && tool->help && *tool->help) { 1184 1185 char s[128]; 1186 1187 strcpy(s, tool->help); 1188 if (tool->flags & T_DROPABLE) 1189 strcat(s, GetPString(IDS_DROPONMETEXT)); 1190 MakeBubble(hwnd, FALSE, s); 1191 } 1184 1192 } 1185 1193 } … … 1190 1198 case IDM_HELP: 1191 1199 if (hwndHelp) 1192 WinSendMsg(hwndHelp,1193 HM_DISPLAY_HELP,1194 MPFROM2SHORT(HELP_TOOLBAR, 0), MPFROMSHORT(HM_RESOURCEID));1200 WinSendMsg(hwndHelp, 1201 HM_DISPLAY_HELP, 1202 MPFROM2SHORT(HELP_TOOLBAR, 0), MPFROMSHORT(HM_RESOURCEID)); 1195 1203 break; 1196 1204 … … 1198 1206 case IDM_HIDETOOL: /* hide tool */ 1199 1207 if (SHORT1FROMMP(mp1) == IDM_HIDETOOL) 1200 id = WinQueryWindowUShort(hwnd, QWS_ID);1208 id = WinQueryWindowUShort(hwnd, QWS_ID); 1201 1209 else 1202 id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd,1203 PickToolProc, FM3ModHandle,1204 PICKBTN_FRAME, GetPString(IDS_HIDETEXT));1210 id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, 1211 PickToolProc, FM3ModHandle, 1212 PICKBTN_FRAME, GetPString(IDS_HIDETEXT)); 1205 1213 if (id) { 1206 tool = find_tool(id);1207 if (tool) {1208 tool->flags |= T_INVISIBLE;1209 fToolsChanged = TRUE;1210 }1214 tool = find_tool(id); 1215 if (tool) { 1216 tool->flags |= T_INVISIBLE; 1217 fToolsChanged = TRUE; 1218 } 1211 1219 } 1212 1220 break; … … 1215 1223 tool = toolhead; 1216 1224 while (tool) { 1217 tool->flags &= (~T_INVISIBLE);1218 tool = tool->next;1219 fToolsChanged = TRUE;1225 tool->flags &= (~T_INVISIBLE); 1226 tool = tool->next; 1227 fToolsChanged = TRUE; 1220 1228 } 1221 1229 break; … … 1224 1232 case IDM_DELETETOOL: /* delete button */ 1225 1233 if (SHORT1FROMMP(mp1) == IDM_DELETETOOL) 1226 id = WinQueryWindowUShort(hwnd, QWS_ID);1234 id = WinQueryWindowUShort(hwnd, QWS_ID); 1227 1235 else 1228 id =1229 (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle,1230 PICKBTN_FRAME, GetPString(IDS_DELETETEXT));1236 id = 1237 (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle, 1238 PICKBTN_FRAME, GetPString(IDS_DELETETEXT)); 1231 1239 if (id) 1232 PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_SETUP,1233 MPFROM2SHORT(id, 0), MPVOID);1240 PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_SETUP, 1241 MPFROM2SHORT(id, 0), MPVOID); 1234 1242 return 0; 1235 1243 … … 1237 1245 case IDM_EDITTOOL: /* edit button */ 1238 1246 if (SHORT1FROMMP(mp1) == IDM_EDITTOOL) 1239 id = WinQueryWindowUShort(hwnd, QWS_ID);1247 id = WinQueryWindowUShort(hwnd, QWS_ID); 1240 1248 else 1241 id =1242 (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle,1243 PICKBTN_FRAME, GetPString(IDS_EDITTEXT));1249 id = 1250 (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle, 1251 PICKBTN_FRAME, GetPString(IDS_EDITTEXT)); 1244 1252 if (id) { 1245 tool = find_tool(id);1246 if (tool) {1247 if (WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle,1248 ADDBTN_FRAME, (PVOID) tool))1249 WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,1250 QW_PARENT),1251 QW_PARENT), FID_CLIENT),1252 WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0),1253 MPFROM2SHORT(id, 0));1254 }1253 tool = find_tool(id); 1254 if (tool) { 1255 if (WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle, 1256 ADDBTN_FRAME, (PVOID) tool)) 1257 WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 1258 QW_PARENT), 1259 QW_PARENT), FID_CLIENT), 1260 WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0), 1261 MPFROM2SHORT(id, 0)); 1262 } 1255 1263 } 1256 1264 break; … … 1258 1266 case IDM_ADDTOOL: /* add tool */ 1259 1267 id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle, 1260 ADDBTN_FRAME, MPVOID);1268 ADDBTN_FRAME, MPVOID); 1261 1269 if (id && id != (USHORT) - 1) 1262 WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,1263 QW_PARENT),1264 QW_PARENT), FID_CLIENT),1265 WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0),1266 MPFROM2SHORT(id, 0));1270 WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 1271 QW_PARENT), 1272 QW_PARENT), FID_CLIENT), 1273 WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0), 1274 MPFROM2SHORT(id, 0)); 1267 1275 break; 1268 1276 1269 1277 case IDM_REORDERTOOLS: /* reorder tools */ 1270 1278 WinDlgBox(HWND_DESKTOP, 1271 hwnd, ReOrderToolsProc, FM3ModHandle, RE_FRAME, MPVOID);1279 hwnd, ReOrderToolsProc, FM3ModHandle, RE_FRAME, MPVOID); 1272 1280 break; 1273 1281 … … 1275 1283 case IDM_LOADTOOLS: 1276 1284 if (WinDlgBox(HWND_DESKTOP, 1277 hwnd,1278 ToolIODlgProc,1279 FM3ModHandle,1280 SVBTN_FRAME,1281 (PVOID) (SHORT1FROMMP(mp1) == IDM_SAVETOOLS) ?1282 "TRUE" : NULL))1283 BuildTools(hwndToolback, TRUE);1285 hwnd, 1286 ToolIODlgProc, 1287 FM3ModHandle, 1288 SVBTN_FRAME, 1289 (PVOID) (SHORT1FROMMP(mp1) == IDM_SAVETOOLS) ? 1290 "TRUE" : NULL)) 1291 BuildTools(hwndToolback, TRUE); 1284 1292 break; 1285 1293 } … … 1313 1321 tool = find_tool(id); 1314 1322 if (!tool) { 1315 DrgFreeDraginfo(pDInfo);1316 return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */1323 DrgFreeDraginfo(pDInfo); 1324 return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */ 1317 1325 } 1318 1326 if (!(tool->flags & T_DROPABLE)) { 1319 DrgFreeDraginfo(pDInfo);1320 return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */1327 DrgFreeDraginfo(pDInfo); 1328 return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */ 1321 1329 } 1322 1330 { 1323 PDRAGITEM pDItem; /* Pointer to DRAGITEM */1324 1325 pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */1326 0); /* Index to DRAGITEM */1327 if (DrgVerifyRMF(pDItem, /* Check valid rendering */1328 DRM_OS2FILE, /* mechanisms and data */1329 NULL)) { /* formats */1330 if (!(tool->flags & T_EMPHASIZED)) {1331 tool->flags |= T_EMPHASIZED;1332 DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));1333 DrgFreeDraginfo(pDInfo);1334 }1335 return (MRFROM2SHORT(DOR_DROP, /* Return okay to drop */1336 DO_MOVE)); /* Move operation valid */1337 }1338 DrgFreeDraginfo(pDInfo);1331 PDRAGITEM pDItem; /* Pointer to DRAGITEM */ 1332 1333 pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */ 1334 0); /* Index to DRAGITEM */ 1335 if (DrgVerifyRMF(pDItem, /* Check valid rendering */ 1336 DRM_OS2FILE, /* mechanisms and data */ 1337 NULL)) { /* formats */ 1338 if (!(tool->flags & T_EMPHASIZED)) { 1339 tool->flags |= T_EMPHASIZED; 1340 DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0)); 1341 DrgFreeDraginfo(pDInfo); 1342 } 1343 return (MRFROM2SHORT(DOR_DROP, /* Return okay to drop */ 1344 DO_MOVE)); /* Move operation valid */ 1345 } 1346 DrgFreeDraginfo(pDInfo); 1339 1347 } 1340 1348 } … … 1353 1361 if (tool && (tool->flags & T_DROPABLE)) { 1354 1362 if (tool->flags & T_EMPHASIZED) { 1355 tool->flags &= (~T_EMPHASIZED);1356 DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));1363 tool->flags &= (~T_EMPHASIZED); 1364 DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0)); 1357 1365 } 1358 1366 } … … 1367 1375 1368 1376 if (tool->flags & T_EMPHASIZED) { 1369 DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));1370 tool->flags &= (~T_EMPHASIZED);1377 DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0)); 1378 tool->flags &= (~T_EMPHASIZED); 1371 1379 } 1372 1380 memset(&cdi, 0, sizeof(cdi)); … … 1375 1383 CheckPmDrgLimit(cdi.pDragInfo); 1376 1384 if (li) { 1377 li->type = id;1378 if (!li->list || !li->list[0])1379 FreeListInfo(li);1380 else {1381 HWND hwndActive;1382 1383 hwndActive = TopWindow(hwndMain, (HWND) 0);1384 if (hwndActive) {1385 if (!WinSendMsg(hwndActive, UM_COMMAND, MPFROMP(li), MPVOID))1386 FreeListInfo(li);1387 }1388 else1389 FreeListInfo(li);1390 }1385 li->type = id; 1386 if (!li->list || !li->list[0]) 1387 FreeListInfo(li); 1388 else { 1389 HWND hwndActive; 1390 1391 hwndActive = TopWindow(hwndMain, (HWND) 0); 1392 if (hwndActive) { 1393 if (!WinSendMsg(hwndActive, UM_COMMAND, MPFROMP(li), MPVOID)) 1394 FreeListInfo(li); 1395 } 1396 else 1397 FreeListInfo(li); 1398 } 1391 1399 } 1392 1400 } … … 1425 1433 if (!fTextTools) { 1426 1434 if (!(tool->flags & T_MYICON)) { 1427 hwndTool = WinCreateWindow(hwndT,1428 WC_TOOLBUTTONS,1429 s,1430 BS_NOPOINTERFOCUS |1431 BS_BITMAP | BS_PUSHBUTTON,1432 ctrlxpos,1433 14,1434 32,1435 32, hwndT, HWND_TOP, tool->id, NULL, NULL);1435 hwndTool = WinCreateWindow(hwndT, 1436 WC_TOOLBUTTONS, 1437 s, 1438 BS_NOPOINTERFOCUS | 1439 BS_BITMAP | BS_PUSHBUTTON, 1440 ctrlxpos, 1441 14, 1442 32, 1443 32, hwndT, HWND_TOP, tool->id, NULL, NULL); 1436 1444 } 1437 1445 if (!hwndTool) { 1438 HBITMAP hbm = LoadBitmapFromFileNum(tool->id);1439 1440 if (hbm) {1441 BTNCDATA btc;1442 1443 memset(&btc, 0, sizeof(btc));1444 btc.cb = sizeof(btc);1445 btc.hImage = hbm;1446 hwndTool = WinCreateWindow(hwndT,1447 WC_TOOLBUTTONS,1448 NullStr,1449 BS_NOPOINTERFOCUS |1450 BS_BITMAP | BS_PUSHBUTTON,1451 ctrlxpos,1452 14,1453 32,1454 32,1455 hwndT, HWND_TOP, tool->id, &btc, NULL);1456 if (!hwndTool)1457 GpiDeleteBitmap(hbm);1458 }1446 HBITMAP hbm = LoadBitmapFromFileNum(tool->id); 1447 1448 if (hbm) { 1449 BTNCDATA btc; 1450 1451 memset(&btc, 0, sizeof(btc)); 1452 btc.cb = sizeof(btc); 1453 btc.hImage = hbm; 1454 hwndTool = WinCreateWindow(hwndT, 1455 WC_TOOLBUTTONS, 1456 NullStr, 1457 BS_NOPOINTERFOCUS | 1458 BS_BITMAP | BS_PUSHBUTTON, 1459 ctrlxpos, 1460 14, 1461 32, 1462 32, 1463 hwndT, HWND_TOP, tool->id, &btc, NULL); 1464 if (!hwndTool) 1465 GpiDeleteBitmap(hbm); 1466 } 1459 1467 } 1460 1468 if (hwndTool) 1461 tool->flags &= (~T_TEXT);1469 tool->flags &= (~T_TEXT); 1462 1470 } 1463 1471 if (!hwndTool) { 1464 1472 hwndTool = WinCreateWindow(hwndT, 1465 WC_TOOLBUTTONS,1466 (!tool->text && tool->id >= IDM_COMMANDSTART1467 && tool->id <1468 IDM_QUICKTOOLSTART) ? command_title(tool->1469 id -1470 IDM_COMMANDSTART)1471 : tool->text,1472 BS_NOPOINTERFOCUS | BS_PUSHBUTTON, ctrlxpos,1473 2, 54, 24, hwndT, HWND_TOP, tool->id, NULL,1474 NULL);1473 WC_TOOLBUTTONS, 1474 (!tool->text && tool->id >= IDM_COMMANDSTART 1475 && tool->id < 1476 IDM_QUICKTOOLSTART) ? command_title(tool-> 1477 id - 1478 IDM_COMMANDSTART) 1479 : tool->text, 1480 BS_NOPOINTERFOCUS | BS_PUSHBUTTON, ctrlxpos, 1481 2, 54, 24, hwndT, HWND_TOP, tool->id, NULL, 1482 NULL); 1475 1483 if (!hwndTool) 1476 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,1477 IDS_WINCREATEWINDOW);1484 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 1485 IDS_WINCREATEWINDOW); 1478 1486 tool->flags |= T_TEXT; 1479 1487 } 1480 1488 if (fToolTitles && !fTextTools) { 1481 1489 hwndTool = WinCreateWindow(hwndT, 1482 WC_STATIC,1483 tool->text,1484 SS_TEXT | DT_LEFT | DT_VCENTER,1485 ctrlxpos,1486 1,1487 32,1488 10,1489 hwndT,1490 HWND_TOP, tool->id + 25000, NULL, NULL);1490 WC_STATIC, 1491 tool->text, 1492 SS_TEXT | DT_LEFT | DT_VCENTER, 1493 ctrlxpos, 1494 1, 1495 32, 1496 10, 1497 hwndT, 1498 HWND_TOP, tool->id + 25000, NULL, NULL); 1491 1499 if (!hwndTool) 1492 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,1493 IDS_WINCREATEWINDOW);1500 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 1501 IDS_WINCREATEWINDOW); 1494 1502 else { 1495 SetPresParams(hwndTool,1496 &RGBGREY,1497 &RGBBLACK, &RGBGREY, GetPString(IDS_2SYSTEMVIOTEXT));1503 SetPresParams(hwndTool, 1504 &RGBGREY, 1505 &RGBBLACK, &RGBGREY, GetPString(IDS_2SYSTEMVIOTEXT)); 1498 1506 } 1499 1507 } 1500 1508 ctrlxpos += ((tool->flags & T_TEXT) ? 55L : 33L); 1501 1509 SetPresParams(WinWindowFromID(hwndT, tool->id), 1502 NULL, NULL, NULL, GetPString(IDS_8HELVTEXT));1510 NULL, NULL, NULL, GetPString(IDS_8HELVTEXT)); 1503 1511 tool = tool->next; 1504 1512 } // while tool 1505 1513 1506 1514 hwndTool = WinCreateWindow(hwndT, 1507 WC_BUTTON,1508 "#6010",1509 BS_NOPOINTERFOCUS |1510 BS_BITMAP | BS_PUSHBUTTON,1511 1,1512 19,1513 14,1514 13, hwndT, HWND_TOP, IDM_TOOLLEFT, NULL, NULL);1515 WC_BUTTON, 1516 "#6010", 1517 BS_NOPOINTERFOCUS | 1518 BS_BITMAP | BS_PUSHBUTTON, 1519 1, 1520 19, 1521 14, 1522 13, hwndT, HWND_TOP, IDM_TOOLLEFT, NULL, NULL); 1515 1523 if (!hwndTool) 1516 1524 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 1517 IDS_WINCREATEWINDOW);1525 IDS_WINCREATEWINDOW); 1518 1526 hwndTool = 1519 1527 WinCreateWindow(hwndT, WC_BUTTON, "#6011", 1520 BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON, 1, 4, 14,1521 13, hwndT, HWND_TOP, IDM_TOOLRIGHT, NULL, NULL);1528 BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON, 1, 4, 14, 1529 13, hwndT, HWND_TOP, IDM_TOOLRIGHT, NULL, NULL); 1522 1530 if (!hwndTool) 1523 1531 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 1524 IDS_WINCREATEWINDOW);1532 IDS_WINCREATEWINDOW); 1525 1533 if (resize) 1526 1534 ResizeTools(hwndT); … … 1528 1536 1529 1537 static MRESULT EXPENTRY CommandLineProc(HWND hwnd, ULONG msg, MPARAM mp1, 1530 MPARAM mp2)1538 MPARAM mp2) 1531 1539 { 1532 1540 PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER); … … 1545 1553 1546 1554 if (WinQueryWindowUShort((HWND) mp1, QWS_ID) == COMMAND_BUTTON) 1547 break;1555 break; 1548 1556 if (!WinQueryWindowProcess((HWND) mp1, &pid, &tid) || pid == mypid) 1549 WinDestroyWindow(hwnd);1557 WinDestroyWindow(hwnd); 1550 1558 } 1551 1559 break; … … 1557 1565 pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 1558 1566 if (pszCmdLine) { 1559 lbup = TRUE;1560 if (WinDlgBox(HWND_DESKTOP,1561 hwnd,1562 CmdLine2DlgProc,1563 FM3ModHandle, EXEC2_FRAME, MPFROMP(pszCmdLine))) {1564 lstrip(pszCmdLine);1565 WinSetWindowText(hwnd, pszCmdLine);1566 }1567 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);1568 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);1569 free(pszCmdLine);1567 lbup = TRUE; 1568 if (WinDlgBox(HWND_DESKTOP, 1569 hwnd, 1570 CmdLine2DlgProc, 1571 FM3ModHandle, EXEC2_FRAME, MPFROMP(pszCmdLine))) { 1572 lstrip(pszCmdLine); 1573 WinSetWindowText(hwnd, pszCmdLine); 1574 } 1575 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID); 1576 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID); 1577 free(pszCmdLine); 1570 1578 } 1571 1579 } … … 1584 1592 case COMMAND_BUTTON: 1585 1593 if (!lbup) 1586 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);1594 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 1587 1595 break; 1588 1596 } … … 1603 1611 bstrip(cl + len); 1604 1612 if (strlen(cl) > len) { 1605 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),1606 UM_SETUP, MPFROMP(cl + len), MPVOID);1607 WinQueryWindowText(hwndStatus, CCHMAXPATH, directory);1608 bstrip(directory);1609 if (*directory && (IsRoot(directory) || !IsFile(directory))) {1610 if (!FM2Command(directory, cl + len)) {1611 hwndCnr = TopWindow(hwndMain, (HWND) 0);1612 if (hwndCnr) {1613 hwndCnr = WinWindowFromID(hwndCnr, FID_CLIENT);1614 if (hwndCnr) {1615 hwndCnr = WinWindowFromID(hwndCnr, DIR_CNR);1616 if (hwndCnr)1617 list = BuildList(hwndCnr);1618 }1619 }1620 WinSetActiveWindow(HWND_DESKTOP, hwndCnr);1621 if (add_cmdline(cl + len, FALSE) && fSaveMiniCmds)1622 save_cmdlines(FALSE);1623 ExecOnList(hwndCnr,1624 cl,1625 WINDOWED | ((fKeepCmdLine) ?1626 SEPARATEKEEP : SEPARATE),1627 directory, list, NULL, pszSrcFile, __LINE__);1628 xfree(list, pszSrcFile, __LINE__);1629 WinDestroyWindow(hwnd);1630 break;1631 }1632 }1613 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), 1614 UM_SETUP, MPFROMP(cl + len), MPVOID); 1615 WinQueryWindowText(hwndStatus, CCHMAXPATH, directory); 1616 bstrip(directory); 1617 if (*directory && (IsRoot(directory) || !IsFile(directory))) { 1618 if (!FM2Command(directory, cl + len)) { 1619 hwndCnr = TopWindow(hwndMain, (HWND) 0); 1620 if (hwndCnr) { 1621 hwndCnr = WinWindowFromID(hwndCnr, FID_CLIENT); 1622 if (hwndCnr) { 1623 hwndCnr = WinWindowFromID(hwndCnr, DIR_CNR); 1624 if (hwndCnr) 1625 list = BuildList(hwndCnr); 1626 } 1627 } 1628 WinSetActiveWindow(HWND_DESKTOP, hwndCnr); 1629 if (add_cmdline(cl + len, FALSE) && fSaveMiniCmds) 1630 save_cmdlines(FALSE); 1631 ExecOnList(hwndCnr, 1632 cl, 1633 WINDOWED | ((fKeepCmdLine) ? 1634 SEPARATEKEEP : SEPARATE), 1635 directory, list, NULL, pszSrcFile, __LINE__); 1636 xfree(list, pszSrcFile, __LINE__); 1637 WinDestroyWindow(hwnd); 1638 break; 1639 } 1640 } 1633 1641 } 1634 1642 WinSendMsg(hwnd, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID); … … 1639 1647 if (!lbup && !(SHORT1FROMMP(mp1) & KC_KEYUP)) { 1640 1648 if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) { 1641 if ((SHORT1FROMMP(mp2) & 255) == '\r')1642 PostMsg(hwnd, UM_OPENWINDOWFORME, MPVOID, MPVOID);1643 else if ((SHORT1FROMMP(mp2) & 0xff) == 0x1b)1644 WinDestroyWindow(hwnd);1645 else if (SHORT2FROMMP(mp2) == VK_UP || SHORT2FROMMP(mp2) == VK_DOWN)1646 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);1649 if ((SHORT1FROMMP(mp2) & 255) == '\r') 1650 PostMsg(hwnd, UM_OPENWINDOWFORME, MPVOID, MPVOID); 1651 else if ((SHORT1FROMMP(mp2) & 0xff) == 0x1b) 1652 WinDestroyWindow(hwnd); 1653 else if (SHORT2FROMMP(mp2) == VK_UP || SHORT2FROMMP(mp2) == VK_DOWN) 1654 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 1647 1655 } 1648 1656 } 1649 1657 else if ((SHORT1FROMMP(mp1) & KC_VIRTUALKEY) && 1650 ((SHORT2FROMMP(mp2) == VK_UP ||1651 SHORT2FROMMP(mp2) == VK_DOWN) ||1652 (SHORT1FROMMP(mp2) == '\x1b') || (SHORT1FROMMP(mp2) == '\r')))1658 ((SHORT2FROMMP(mp2) == VK_UP || 1659 SHORT2FROMMP(mp2) == VK_DOWN) || 1660 (SHORT1FROMMP(mp2) == '\x1b') || (SHORT1FROMMP(mp2) == '\r'))) 1653 1661 return 0; 1654 1662 break; … … 1676 1684 rgb.bRed = (BYTE)128; 1677 1685 SetPresParams(hwnd, 1678 &RGBGREY, &rgb, &RGBGREY, GetPString(IDS_8HELVTEXT));1686 &RGBGREY, &rgb, &RGBGREY, GetPString(IDS_8HELVTEXT)); 1679 1687 SetTargetDir(hwnd, TRUE); 1680 1688 } … … 1706 1714 case WM_CONTROLPOINTER: 1707 1715 if (!fNoFinger && 1708 (SHORT1FROMMP(mp1) >= IDM_DRIVEA &&1709 SHORT1FROMMP(mp1) < IDM_DRIVEA + 26))1716 (SHORT1FROMMP(mp1) >= IDM_DRIVEA && 1717 SHORT1FROMMP(mp1) < IDM_DRIVEA + 26)) 1710 1718 return MRFROMLONG(hptrFinger); 1711 1719 break; … … 1717 1725 *dv = 0; 1718 1726 WinQueryWindowText(WinWindowFromID(hwnd, SHORT1FROMMP(mp1) + 50), 1719 2, dv);1727 2, dv); 1720 1728 if (isalpha(*dv)) { 1721 1729 1722 HWND hwndActive;1723 1724 dv[1] = ':';1725 dv[2] = '\\';1726 dv[3] = 0;1727 hwndActive = TopWindow(hwnd, (HWND) 0);1728 if (hwndActive)1729 WinSendMsg(WinWindowFromID(hwndActive, FID_CLIENT),1730 UM_DRIVECMD, MPFROMP(dv), MPVOID);1730 HWND hwndActive; 1731 1732 dv[1] = ':'; 1733 dv[2] = '\\'; 1734 dv[3] = 0; 1735 hwndActive = TopWindow(hwnd, (HWND) 0); 1736 if (hwndActive) 1737 WinSendMsg(WinWindowFromID(hwndActive, FID_CLIENT), 1738 UM_DRIVECMD, MPFROMP(dv), MPVOID); 1731 1739 } 1732 1740 } … … 1756 1764 case WM_MOUSEMOVE: 1757 1765 if (fDrivebarHelp && 1758 (!hwndBubble ||1759 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&1760 !WinQueryCapture(HWND_DESKTOP)) {1766 (!hwndBubble || 1767 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) && 1768 !WinQueryCapture(HWND_DESKTOP)) { 1761 1769 id = WinQueryWindowUShort(hwnd, QWS_ID); 1762 1770 if (helpid != id) { 1763 helpid = id;1764 PostMsg(MainObjectHwnd, UM_SETUP6, MPFROMLONG((ULONG) hwnd), MPVOID);1771 helpid = id; 1772 PostMsg(MainObjectHwnd, UM_SETUP6, MPFROMLONG((ULONG) hwnd), MPVOID); 1765 1773 } 1766 1774 else 1767 helpid = 0;1775 helpid = 0; 1768 1776 } 1769 1777 break; … … 1772 1780 if (helpid == WinQueryWindowUShort(hwnd, QWS_ID)) { 1773 1781 if ((char *)mp1 && 1774 (!hwndBubble ||1775 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&1776 !WinQueryCapture(HWND_DESKTOP)) {1777 1778 RECTL rcl;1779 POINTL ptl;1780 1781 WinQueryPointerPos(HWND_DESKTOP, &ptl);1782 WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1);1783 WinQueryWindowRect(hwnd, &rcl);1784 if (WinPtInRect(WinQueryAnchorBlock(hwnd), &rcl, &ptl))1785 BubbleHelp(hwnd, FALSE, TRUE, FALSE, (char *)mp1);1782 (!hwndBubble || 1783 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) && 1784 !WinQueryCapture(HWND_DESKTOP)) { 1785 1786 RECTL rcl; 1787 POINTL ptl; 1788 1789 WinQueryPointerPos(HWND_DESKTOP, &ptl); 1790 WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1); 1791 WinQueryWindowRect(hwnd, &rcl); 1792 if (WinPtInRect(WinQueryAnchorBlock(hwnd), &rcl, &ptl)) 1793 BubbleHelp(hwnd, FALSE, TRUE, FALSE, (char *)mp1); 1786 1794 } 1787 1795 } … … 1802 1810 *szDrv = 0; 1803 1811 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1804 id + 50), sizeof(szDrv), szDrv);1812 id + 50), sizeof(szDrv), szDrv); 1805 1813 if (isalpha(*szDrv)) { 1806 1814 hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, MAIN_DRIVES); 1807 1815 if (hwndMenu) { 1808 BOOL rdy;1809 CHAR chDrv = *szDrv;1810 UINT iDrv;1811 1812 strcpy(szDrv + 2, "\\");1813 MakeValidDir(szDrv);1814 // Disable menus if MakeValidDir changes drive letter fixme this section doesn't do anything see treecnt.c1815 rdy = toupper(*szDrv) == toupper(chDrv);1816 iDrv = toupper(*szDrv) - 'A';1817 if (!rdy || ~driveflags[iDrv] & DRIVE_REMOTE)1818 WinEnableMenuItem(hwndMenu, IDM_DETACH, FALSE);1819 1820 if (!rdy || driveflags[iDrv] & DRIVE_NOTWRITEABLE) {1821 WinEnableMenuItem(hwndMenu, IDM_MKDIR, FALSE);1822 WinEnableMenuItem(hwndMenu, IDM_FORMAT, FALSE);1823 WinEnableMenuItem(hwndMenu, IDM_OPTIMIZE, FALSE);1824 WinEnableMenuItem(hwndMenu, IDM_UNDELETE, FALSE);1825 }1826 if (!rdy || ~driveflags[iDrv] & DRIVE_REMOVABLE) {1827 WinEnableMenuItem(hwndMenu, IDM_EJECT, FALSE);1828 WinEnableMenuItem(hwndMenu, IDM_LOCK, FALSE);1829 WinEnableMenuItem(hwndMenu, IDM_UNLOCK, FALSE);1830 }1831 if (!rdy) {1832 WinEnableMenuItem(hwndMenu, IDM_INFO, FALSE);1833 WinEnableMenuItem(hwndMenu, IDM_ARCHIVE, FALSE);1834 WinEnableMenuItem(hwndMenu, IDM_SIZES, FALSE);1835 WinEnableMenuItem(hwndMenu, IDM_SHOWALLFILES, FALSE);1836 WinEnableMenuItem(hwndMenu, IDM_CHKDSK, FALSE);1837 }1838 /* fixme to be gone?1839 if (!rdy || ~driveflags[iDrv] & DRIVE_CDROM) {1840 WinEnableMenuItem(hwndMenu, IDM_CLOSETRAY, FALSE);1841 }1842 */1843 PopupMenu(hwnd, hwnd, hwndMenu);1816 BOOL rdy; 1817 CHAR chDrv = *szDrv; 1818 UINT iDrv; 1819 1820 strcpy(szDrv + 2, "\\"); 1821 MakeValidDir(szDrv); 1822 // Disable menus if MakeValidDir changes drive letter fixme this section doesn't do anything see treecnt.c 1823 rdy = toupper(*szDrv) == toupper(chDrv); 1824 iDrv = toupper(*szDrv) - 'A'; 1825 if (!rdy || ~driveflags[iDrv] & DRIVE_REMOTE) 1826 WinEnableMenuItem(hwndMenu, IDM_DETACH, FALSE); 1827 1828 if (!rdy || driveflags[iDrv] & DRIVE_NOTWRITEABLE) { 1829 WinEnableMenuItem(hwndMenu, IDM_MKDIR, FALSE); 1830 WinEnableMenuItem(hwndMenu, IDM_FORMAT, FALSE); 1831 WinEnableMenuItem(hwndMenu, IDM_OPTIMIZE, FALSE); 1832 WinEnableMenuItem(hwndMenu, IDM_UNDELETE, FALSE); 1833 } 1834 if (!rdy || ~driveflags[iDrv] & DRIVE_REMOVABLE) { 1835 WinEnableMenuItem(hwndMenu, IDM_EJECT, FALSE); 1836 WinEnableMenuItem(hwndMenu, IDM_LOCK, FALSE); 1837 WinEnableMenuItem(hwndMenu, IDM_UNLOCK, FALSE); 1838 } 1839 if (!rdy) { 1840 WinEnableMenuItem(hwndMenu, IDM_INFO, FALSE); 1841 WinEnableMenuItem(hwndMenu, IDM_ARCHIVE, FALSE); 1842 WinEnableMenuItem(hwndMenu, IDM_SIZES, FALSE); 1843 WinEnableMenuItem(hwndMenu, IDM_SHOWALLFILES, FALSE); 1844 WinEnableMenuItem(hwndMenu, IDM_CHKDSK, FALSE); 1845 } 1846 /* fixme to be gone? 1847 if (!rdy || ~driveflags[iDrv] & DRIVE_CDROM) { 1848 WinEnableMenuItem(hwndMenu, IDM_CLOSETRAY, FALSE); 1849 } 1850 */ 1851 PopupMenu(hwnd, hwnd, hwndMenu); 1844 1852 } 1845 1853 } … … 1856 1864 *szDrv = 0; 1857 1865 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1858 id + 50), sizeof(szDrv), szDrv);1866 id + 50), sizeof(szDrv), szDrv); 1859 1867 if (isalpha(*szDrv)) { 1860 1868 strcat(szDrv, "\\"); 1861 1869 if (!FindDirCnrByName(szDrv, TRUE)) 1862 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szDrv);1870 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szDrv); 1863 1871 } 1864 1872 break; … … 1872 1880 *szDrv = 0; 1873 1881 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1874 id + 50), sizeof(szDrv), szDrv);1882 id + 50), sizeof(szDrv), szDrv); 1875 1883 if (isalpha(*szDrv)) { 1876 1884 strcat(szDrv, "\\"); … … 1883 1891 *szDrv = 0; 1884 1892 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1885 id + 50), sizeof(szDrv), szDrv);1893 id + 50), sizeof(szDrv), szDrv); 1886 1894 if (isalpha(*szDrv) && 1887 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {1895 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) { 1888 1896 if (!emphasized) { 1889 emphasized = TRUE;1890 DrawTargetEmphasis(hwnd, emphasized);1897 emphasized = TRUE; 1898 DrawTargetEmphasis(hwnd, emphasized); 1891 1899 } 1892 1900 if (AcceptOneDrop(hwnd, mp1, mp2)) 1893 return MRFROM2SHORT(DOR_DROP, DO_MOVE);1901 return MRFROM2SHORT(DOR_DROP, DO_MOVE); 1894 1902 return MRFROM2SHORT(DOR_NEVERDROP, 0); 1895 1903 } … … 1900 1908 *szDrv = 0; 1901 1909 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1902 id + 50), sizeof(szDrv), szDrv);1910 id + 50), sizeof(szDrv), szDrv); 1903 1911 if (isalpha(*szDrv) && 1904 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {1912 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) { 1905 1913 if (emphasized) { 1906 emphasized = FALSE;1907 DrawTargetEmphasis(hwnd, emphasized);1914 emphasized = FALSE; 1915 DrawTargetEmphasis(hwnd, emphasized); 1908 1916 } 1909 1917 } … … 1914 1922 *szDrv = 0; 1915 1923 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1916 id + 50), sizeof(szDrv), szDrv);1924 id + 50), sizeof(szDrv), szDrv); 1917 1925 if (isalpha(*szDrv) && 1918 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {1926 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) { 1919 1927 DropHelp(mp1, mp2, hwnd, GetPString(IDS_DRIVEDROPHELP)); 1920 1928 return 0; … … 1926 1934 *szDrv = 0; 1927 1935 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1928 id + 50), sizeof(szDrv), szDrv);1936 id + 50), sizeof(szDrv), szDrv); 1929 1937 if (isalpha(*szDrv) && 1930 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {1938 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) { 1931 1939 1932 1940 CNRDRAGINFO cnd; … … 1935 1943 1936 1944 if (emphasized) { 1937 emphasized = FALSE;1938 DrawTargetEmphasis(hwnd, emphasized);1945 emphasized = FALSE; 1946 DrawTargetEmphasis(hwnd, emphasized); 1939 1947 } 1940 1948 memset(&cnd, 0, sizeof(cnd)); … … 1942 1950 cnd.pRecord = NULL; 1943 1951 li = DoFileDrop(hwnd, 1944 NULL,1945 TRUE, MPFROM2SHORT(TREE_CNR, CN_DROP), MPFROMP(&cnd));1952 NULL, 1953 TRUE, MPFROM2SHORT(TREE_CNR, CN_DROP), MPFROMP(&cnd)); 1946 1954 CheckPmDrgLimit(cnd.pDragInfo); 1947 1955 if (li) { 1948 strcpy(li->targetpath, szDrv);1949 strcat(li->targetpath, "\\");1950 if (li->list && li->list[0] && IsRoot(li->list[0]))1951 li->type = DO_LINK;1952 else if (fDragndropDlg && (!*li->arcname || !li->info)) {1953 1954 CHECKLIST cl;1955 1956 memset(&cl, 0, sizeof(cl));1957 cl.size = sizeof(cl);1958 cl.flags = li->type;1959 cl.list = li->list;1960 cl.cmd = li->type;1961 cl.prompt = li->targetpath;1962 li->type = WinDlgBox(HWND_DESKTOP,1963 hwndMain,1964 DropListProc,1965 FM3ModHandle, DND_FRAME, MPFROMP(&cl));1966 if (li->type == DID_ERROR)1967 Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__,1968 "Drag & Drop Dialog");1969 if (!li->type) {1970 FreeListInfo(li);1971 return 0;1972 }1973 li->list = cl.list;1974 if (!li->list || !li->list[0]) {1975 FreeListInfo(li);1976 return 0;1977 }1978 }1979 else {1980 if (!WinDlgBox(HWND_DESKTOP,1981 hwndMain,1982 WalkDlgProc,1983 FM3ModHandle,1984 WALK_FRAME,1985 MPFROMP(li->targetpath)) || !*li->targetpath) {1986 FreeListInfo(li);1987 return 0;1988 }1989 }1990 switch (li->type) {1991 case DND_LAUNCH:1992 strcat(li->targetpath, " %a");1993 ExecOnList(hwndMain,1994 li->targetpath, PROMPT | WINDOWED, NULL, li->list, NULL,1995 pszSrcFile, __LINE__);1996 FreeList(li->list);1997 li->list = NULL;1998 break;1999 case DO_LINK:2000 if (fLinkSetsIcon) {2001 li->type = IDM_SETICON;2002 action = UM_MASSACTION;2003 }2004 else2005 li->type = IDM_COMPARE;2006 break;2007 case DND_EXTRACT:2008 if (*li->targetpath && !IsFile(li->targetpath))2009 li->type = IDM_EXTRACT;2010 break;2011 case DND_MOVE:2012 li->type = IDM_MOVE;2013 if (*li->targetpath && IsFile(li->targetpath) == 1) {2014 action = UM_MASSACTION;2015 li->type = IDM_ARCHIVEM;2016 }2017 break;2018 case DND_WILDMOVE:2019 li->type = IDM_WILDMOVE;2020 if (*li->targetpath && IsFile(li->targetpath) == 1) {2021 action = UM_MASSACTION;2022 li->type = IDM_ARCHIVEM;2023 }2024 break;2025 case DND_OBJECT:2026 li->type = IDM_OBJECT;2027 action = UM_MASSACTION;2028 break;2029 case DND_SHADOW:2030 li->type = IDM_SHADOW;2031 action = UM_MASSACTION;2032 break;2033 case DND_COMPARE:2034 li->type = IDM_COMPARE;2035 break;2036 case DND_SETICON:2037 action = UM_MASSACTION;2038 li->type = IDM_SETICON;2039 break;2040 case DND_COPY:2041 li->type = IDM_COPY;2042 if (*li->targetpath && IsFile(li->targetpath) == 1) {2043 action = UM_MASSACTION;2044 li->type = IDM_ARCHIVE;2045 }2046 break;2047 case DND_WILDCOPY:2048 li->type = IDM_WILDCOPY;2049 if (*li->targetpath && IsFile(li->targetpath) == 1) {2050 action = UM_MASSACTION;2051 li->type = IDM_ARCHIVE;2052 }2053 break;2054 default:2055 if (*li->arcname && li->info) {2056 action = UM_MASSACTION;2057 li->type = (li->type == DO_MOVE) ? IDM_FAKEEXTRACTM :2058 IDM_FAKEEXTRACT;2059 }2060 else if (*li->targetpath && IsFile(li->targetpath) == 1) {2061 action = UM_MASSACTION;2062 li->type = (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE;2063 }2064 else2065 li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY;2066 break;2067 }2068 if (!li->list || !li->list[0])2069 FreeListInfo(li);2070 else2071 WinSendMsg(hwndTree, UM_ACTION, MPFROMP(li), MPFROMLONG(action));1956 strcpy(li->targetpath, szDrv); 1957 strcat(li->targetpath, "\\"); 1958 if (li->list && li->list[0] && IsRoot(li->list[0])) 1959 li->type = DO_LINK; 1960 else if (fDragndropDlg && (!*li->arcname || !li->info)) { 1961 1962 CHECKLIST cl; 1963 1964 memset(&cl, 0, sizeof(cl)); 1965 cl.size = sizeof(cl); 1966 cl.flags = li->type; 1967 cl.list = li->list; 1968 cl.cmd = li->type; 1969 cl.prompt = li->targetpath; 1970 li->type = WinDlgBox(HWND_DESKTOP, 1971 hwndMain, 1972 DropListProc, 1973 FM3ModHandle, DND_FRAME, MPFROMP(&cl)); 1974 if (li->type == DID_ERROR) 1975 Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__, 1976 "Drag & Drop Dialog"); 1977 if (!li->type) { 1978 FreeListInfo(li); 1979 return 0; 1980 } 1981 li->list = cl.list; 1982 if (!li->list || !li->list[0]) { 1983 FreeListInfo(li); 1984 return 0; 1985 } 1986 } 1987 else { 1988 if (!WinDlgBox(HWND_DESKTOP, 1989 hwndMain, 1990 WalkDlgProc, 1991 FM3ModHandle, 1992 WALK_FRAME, 1993 MPFROMP(li->targetpath)) || !*li->targetpath) { 1994 FreeListInfo(li); 1995 return 0; 1996 } 1997 } 1998 switch (li->type) { 1999 case DND_LAUNCH: 2000 strcat(li->targetpath, " %a"); 2001 ExecOnList(hwndMain, 2002 li->targetpath, PROMPT | WINDOWED, NULL, li->list, NULL, 2003 pszSrcFile, __LINE__); 2004 FreeList(li->list); 2005 li->list = NULL; 2006 break; 2007 case DO_LINK: 2008 if (fLinkSetsIcon) { 2009 li->type = IDM_SETICON; 2010 action = UM_MASSACTION; 2011 } 2012 else 2013 li->type = IDM_COMPARE; 2014 break; 2015 case DND_EXTRACT: 2016 if (*li->targetpath && !IsFile(li->targetpath)) 2017 li->type = IDM_EXTRACT; 2018 break; 2019 case DND_MOVE: 2020 li->type = IDM_MOVE; 2021 if (*li->targetpath && IsFile(li->targetpath) == 1) { 2022 action = UM_MASSACTION; 2023 li->type = IDM_ARCHIVEM; 2024 } 2025 break; 2026 case DND_WILDMOVE: 2027 li->type = IDM_WILDMOVE; 2028 if (*li->targetpath && IsFile(li->targetpath) == 1) { 2029 action = UM_MASSACTION; 2030 li->type = IDM_ARCHIVEM; 2031 } 2032 break; 2033 case DND_OBJECT: 2034 li->type = IDM_OBJECT; 2035 action = UM_MASSACTION; 2036 break; 2037 case DND_SHADOW: 2038 li->type = IDM_SHADOW; 2039 action = UM_MASSACTION; 2040 break; 2041 case DND_COMPARE: 2042 li->type = IDM_COMPARE; 2043 break; 2044 case DND_SETICON: 2045 action = UM_MASSACTION; 2046 li->type = IDM_SETICON; 2047 break; 2048 case DND_COPY: 2049 li->type = IDM_COPY; 2050 if (*li->targetpath && IsFile(li->targetpath) == 1) { 2051 action = UM_MASSACTION; 2052 li->type = IDM_ARCHIVE; 2053 } 2054 break; 2055 case DND_WILDCOPY: 2056 li->type = IDM_WILDCOPY; 2057 if (*li->targetpath && IsFile(li->targetpath) == 1) { 2058 action = UM_MASSACTION; 2059 li->type = IDM_ARCHIVE; 2060 } 2061 break; 2062 default: 2063 if (*li->arcname && li->info) { 2064 action = UM_MASSACTION; 2065 li->type = (li->type == DO_MOVE) ? IDM_FAKEEXTRACTM : 2066 IDM_FAKEEXTRACT; 2067 } 2068 else if (*li->targetpath && IsFile(li->targetpath) == 1) { 2069 action = UM_MASSACTION; 2070 li->type = (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE; 2071 } 2072 else 2073 li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY; 2074 break; 2075 } 2076 if (!li->list || !li->list[0]) 2077 FreeListInfo(li); 2078 else 2079 WinSendMsg(hwndTree, UM_ACTION, MPFROMP(li), MPFROMLONG(action)); 2072 2080 } 2073 2081 return 0; … … 2103 2111 for (x = 0; x < 26; x++) { 2104 2112 if ((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE)) { 2105 if (x > 1) {2106 if (driveflags[x] & DRIVE_CDROM)2107 iconid = CDROM_ICON;2108 else2109 iconid = (driveflags[x] & DRIVE_REMOVABLE) ?2110 REMOVABLE_ICON :2111 (driveflags[x] & DRIVE_VIRTUAL) ?2112 VIRTUAL_ICON :2113 (driveflags[x] & DRIVE_REMOTE) ?2114 REMOTE_ICON :2115 (driveflags[x] & DRIVE_RAMDISK) ?2116 RAMDISK_ICON :2117 (driveflags[x] & DRIVE_ZIPSTREAM) ?2118 ZIPSTREAM_ICON :DRIVE_ICON;2119 }2120 else2121 iconid = FLOPPY_ICON;2122 sprintf(s, "#%lu", iconid);2123 hwndB = WinCreateWindow(hwndT,2124 WC_DRIVEBUTTONS,2125 s,2126 BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON,2127 0,2128 0,2129 28,2130 18,2131 hwndT, HWND_TOP, y + IDM_DRIVEA, NULL, NULL);2132 if (!hwndB)2133 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,2134 IDS_WINCREATEWINDOW);2135 else {2136 WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);2137 sprintf(s, "%c:", (CHAR) x + 'A');2138 hwndB = WinCreateWindow(hwndT,2139 WC_STATIC,2140 s,2141 SS_TEXT | DT_LEFT | DT_VCENTER,2142 0,2143 0,2144 10,2145 18,2146 hwndT,2147 HWND_TOP, y + IDM_DRIVEATEXT, NULL, NULL);2148 if (!hwndB)2149 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,2150 IDS_WINCREATEWINDOW);2151 else {2152 SetPresParams(hwndB,2153 &RGBGREY,2154 &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT));2155 WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);2156 }2157 y++;2158 }2113 if (x > 1) { 2114 if (driveflags[x] & DRIVE_CDROM) 2115 iconid = CDROM_ICON; 2116 else 2117 iconid = (driveflags[x] & DRIVE_REMOVABLE) ? 2118 REMOVABLE_ICON : 2119 (driveflags[x] & DRIVE_VIRTUAL) ? 2120 VIRTUAL_ICON : 2121 (driveflags[x] & DRIVE_REMOTE) ? 2122 REMOTE_ICON : 2123 (driveflags[x] & DRIVE_RAMDISK) ? 2124 RAMDISK_ICON : 2125 (driveflags[x] & DRIVE_ZIPSTREAM) ? 2126 ZIPSTREAM_ICON :DRIVE_ICON; 2127 } 2128 else 2129 iconid = FLOPPY_ICON; 2130 sprintf(s, "#%lu", iconid); 2131 hwndB = WinCreateWindow(hwndT, 2132 WC_DRIVEBUTTONS, 2133 s, 2134 BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON, 2135 0, 2136 0, 2137 28, 2138 18, 2139 hwndT, HWND_TOP, y + IDM_DRIVEA, NULL, NULL); 2140 if (!hwndB) 2141 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 2142 IDS_WINCREATEWINDOW); 2143 else { 2144 WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER); 2145 sprintf(s, "%c:", (CHAR) x + 'A'); 2146 hwndB = WinCreateWindow(hwndT, 2147 WC_STATIC, 2148 s, 2149 SS_TEXT | DT_LEFT | DT_VCENTER, 2150 0, 2151 0, 2152 10, 2153 18, 2154 hwndT, 2155 HWND_TOP, y + IDM_DRIVEATEXT, NULL, NULL); 2156 if (!hwndB) 2157 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 2158 IDS_WINCREATEWINDOW); 2159 else { 2160 SetPresParams(hwndB, 2161 &RGBGREY, 2162 &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT)); 2163 WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER); 2164 } 2165 y++; 2166 } 2159 2167 } 2160 2168 } // for 2161 2169 } // if drivebar 2162 2170 PostMsg(WinQueryWindow(hwndT, QW_PARENT), 2163 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);2171 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 2164 2172 } 2165 2173 … … 2177 2185 WinQueryWindowRect(hwndT, &rcl); 2178 2186 xwidth = rcl.xRight - ((WinQuerySysValue(HWND_DESKTOP, 2179 SV_CYSIZEBORDER) * 2) + 2);2187 SV_CYSIZEBORDER) * 2) + 2); 2180 2188 } 2181 2189 henum = WinBeginEnumWindows(hwndT); … … 2186 2194 ctrlxsize = 28; 2187 2195 WinSetWindowPos(hwndB, 2188 HWND_TOP,2189 ctrlxpos, ctrlypos, ctrlxsize, 18, SWP_MOVE | SWP_SHOW);2196 HWND_TOP, 2197 ctrlxpos, ctrlypos, ctrlxsize, 18, SWP_MOVE | SWP_SHOW); 2190 2198 ctrlxpos += (ctrlxsize + 2); 2191 2199 if (ctrlxsize == 10) { 2192 2200 if (ctrlxpos + (42 + ((fShowTarget && DriveLines == 0) ? 2193 256 : 0)) > xwidth) {2194 ctrlxpos = 2;2195 ctrlypos += 18;2196 DriveLines++;2201 256 : 0)) > xwidth) { 2202 ctrlxpos = 2; 2203 ctrlypos += 18; 2204 DriveLines++; 2197 2205 } 2198 2206 } … … 2213 2221 2214 2222 SetPresParams(hwnd, 2215 &RGBGREY,2216 &RGBBLACK, &RGBGREY, GetPString(IDS_8HELVBOLDTEXT));2223 &RGBGREY, 2224 &RGBBLACK, &RGBGREY, GetPString(IDS_8HELVBOLDTEXT)); 2217 2225 return mr; 2218 2226 } … … 2224 2232 2225 2233 cbRetLen = WinQueryPresParam(hwnd, 2226 (ULONG) mp1,2227 0,2228 &AttrFound,2229 (ULONG) sizeof(AttrValue), &AttrValue, 0);2234 (ULONG) mp1, 2235 0, 2236 &AttrFound, 2237 (ULONG) sizeof(AttrValue), &AttrValue, 0); 2230 2238 if (cbRetLen) { 2231 PostMsg(WinQueryWindow(hwnd, QW_PARENT),2232 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);2239 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 2240 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 2233 2241 } 2234 2242 } … … 2247 2255 WinQueryWindowPos(hwndTree, &swp); 2248 2256 if (!(swp.fl & SWP_MAXIMIZE)) 2249 fl |= SWP_RESTORE;2257 fl |= SWP_RESTORE; 2250 2258 WinSetWindowPos(hwndTree, HWND_TOP, 0, 0, 0, 0, fl); 2251 2259 } … … 2280 2288 2281 2289 if (fOtherHelp) { 2282 if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd)2283 && !WinQueryCapture(HWND_DESKTOP)) {2284 switch (id) {2285 case IDM_ATTRS:2286 if (WinQueryWindowTextLength(hwnd))2287 s = GetPString(IDS_ATTRSBUTTONHELP);2288 break;2289 case IDM_INFO:2290 if (WinQueryWindowTextLength(hwnd))2291 s = GetPString(IDS_INFOBUTTONHELP);2292 break;2293 case IDM_RENAME:2294 if (WinQueryWindowTextLength(hwnd))2295 s = GetPString(IDS_NAMEBUTTONHELP);2296 break;2297 case MAIN_STATUS2:2298 if (!hwndE)2299 s = GetPString(IDS_STATUS2HELP);2300 break;2301 default:2302 break;2303 }2304 if (s)2305 MakeBubble(hwnd, FALSE, s);2306 else if (hwndBubble)2307 WinDestroyWindow(hwndBubble);2308 }2290 if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) 2291 && !WinQueryCapture(HWND_DESKTOP)) { 2292 switch (id) { 2293 case IDM_ATTRS: 2294 if (WinQueryWindowTextLength(hwnd)) 2295 s = GetPString(IDS_ATTRSBUTTONHELP); 2296 break; 2297 case IDM_INFO: 2298 if (WinQueryWindowTextLength(hwnd)) 2299 s = GetPString(IDS_INFOBUTTONHELP); 2300 break; 2301 case IDM_RENAME: 2302 if (WinQueryWindowTextLength(hwnd)) 2303 s = GetPString(IDS_NAMEBUTTONHELP); 2304 break; 2305 case MAIN_STATUS2: 2306 if (!hwndE) 2307 s = GetPString(IDS_STATUS2HELP); 2308 break; 2309 default: 2310 break; 2311 } 2312 if (s) 2313 MakeBubble(hwnd, FALSE, s); 2314 else if (hwndBubble) 2315 WinDestroyWindow(hwndBubble); 2316 } 2309 2317 } 2310 2318 switch (id) { … … 2313 2321 case IDM_RENAME: 2314 2322 case MAIN_STATUS2: 2315 return CommonTextProc(hwnd, msg, mp1, mp2);2323 return CommonTextProc(hwnd, msg, mp1, mp2); 2316 2324 default: 2317 break;2325 break; 2318 2326 } 2319 2327 } … … 2338 2346 case IDM_RENAME: 2339 2347 case MAIN_STATUS2: 2340 return CommonTextButton(hwnd, msg, mp1, mp2);2348 return CommonTextButton(hwnd, msg, mp1, mp2); 2341 2349 default: 2342 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);2343 break;2350 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID); 2351 break; 2344 2352 } 2345 2353 } … … 2353 2361 id = WinQueryWindowUShort(hwnd, QWS_ID); 2354 2362 if (id == MAIN_STATUS2 && hwndE) 2355 WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);2363 WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 2356 2364 else 2357 return CommonTextButton(hwnd, msg, mp1, mp2);2365 return CommonTextButton(hwnd, msg, mp1, mp2); 2358 2366 } 2359 2367 break; … … 2365 2373 id = WinQueryWindowUShort(hwnd, QWS_ID); 2366 2374 if (id == MAIN_STATUS) { 2367 if (SHORT2FROMMP(mp2) & KC_CTRL)2368 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),2369 FID_CLIENT),2370 WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);2371 else if (hwndTree)2372 PostMsg(hwndTree, UM_TIMER, MPVOID, MPVOID);2375 if (SHORT2FROMMP(mp2) & KC_CTRL) 2376 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2377 FID_CLIENT), 2378 WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID); 2379 else if (hwndTree) 2380 PostMsg(hwndTree, UM_TIMER, MPVOID, MPVOID); 2373 2381 } 2374 2382 } … … 2383 2391 if (id == MAIN_STATUS2 && !hwndE) { 2384 2392 2385 SWP swp;2386 CHAR directory[CCHMAXPATH];2387 PFNWP oldproce;2388 2389 *directory = 0;2390 TopWindowName(hwndMain, (HWND) 0, directory);2391 WinQueryWindowPos(hwnd, &swp);2392 hwndB = WinCreateWindow(hwnd,2393 WC_BUTTON,2394 "+",2395 WS_VISIBLE | BS_PUSHBUTTON |2396 BS_NOPOINTERFOCUS,2397 swp.cx - swp.cy,2398 0,2399 swp.cy,2400 swp.cy,2401 hwnd, HWND_TOP, COMMAND_BUTTON, NULL, NULL);2402 if (!hwndB)2403 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);2404 hwndE = WinCreateWindow(hwnd,2405 WC_ENTRYFIELD,2406 NULL,2407 WS_VISIBLE | ES_AUTOSCROLL,2408 0,2409 0,2410 swp.cx - swp.cy,2411 swp.cy,2412 hwnd, HWND_TOP, COMMAND_LINE, NULL, NULL);2413 if (!hwndE)2414 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);2415 if (!hwndE || !hwndB) {2416 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);2417 return 0;2418 }2419 WinSendMsg(hwndE, EM_SETTEXTLIMIT, MPFROM2SHORT(1024, 0), MPVOID);2420 WinSetWindowText(hwndStatus, directory);2421 if (*lastcmd)2422 WinSetWindowText(hwndE, lastcmd);2423 else2424 WinSetWindowText(hwndE, GetPString(IDS_HELPCMDTEXT));2425 oldproce = WinSubclassWindow(hwndE, (PFNWP) CommandLineProc);2426 if (oldproce)2427 WinSetWindowPtr(hwndE, QWL_USER, (PVOID) oldproce);2428 PostMsg(hwndE, UM_FOCUSME, MPVOID, MPVOID);2429 PostMsg(hwndE, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID);2430 return 0;2393 SWP swp; 2394 CHAR directory[CCHMAXPATH]; 2395 PFNWP oldproce; 2396 2397 *directory = 0; 2398 TopWindowName(hwndMain, (HWND) 0, directory); 2399 WinQueryWindowPos(hwnd, &swp); 2400 hwndB = WinCreateWindow(hwnd, 2401 WC_BUTTON, 2402 "+", 2403 WS_VISIBLE | BS_PUSHBUTTON | 2404 BS_NOPOINTERFOCUS, 2405 swp.cx - swp.cy, 2406 0, 2407 swp.cy, 2408 swp.cy, 2409 hwnd, HWND_TOP, COMMAND_BUTTON, NULL, NULL); 2410 if (!hwndB) 2411 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 2412 hwndE = WinCreateWindow(hwnd, 2413 WC_ENTRYFIELD, 2414 NULL, 2415 WS_VISIBLE | ES_AUTOSCROLL, 2416 0, 2417 0, 2418 swp.cx - swp.cy, 2419 swp.cy, 2420 hwnd, HWND_TOP, COMMAND_LINE, NULL, NULL); 2421 if (!hwndE) 2422 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 2423 if (!hwndE || !hwndB) { 2424 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 2425 return 0; 2426 } 2427 WinSendMsg(hwndE, EM_SETTEXTLIMIT, MPFROM2SHORT(1024, 0), MPVOID); 2428 WinSetWindowText(hwndStatus, directory); 2429 if (*lastcmd) 2430 WinSetWindowText(hwndE, lastcmd); 2431 else 2432 WinSetWindowText(hwndE, GetPString(IDS_HELPCMDTEXT)); 2433 oldproce = WinSubclassWindow(hwndE, (PFNWP) CommandLineProc); 2434 if (oldproce) 2435 WinSetWindowPtr(hwndE, QWL_USER, (PVOID) oldproce); 2436 PostMsg(hwndE, UM_FOCUSME, MPVOID, MPVOID); 2437 PostMsg(hwndE, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID); 2438 return 0; 2431 2439 } 2432 2440 if (msg == UM_CLICKED3 || (SHORT2FROMMP(mp2) & KC_CTRL)) { 2433 switch (id) {2434 case IDM_ATTRS:2435 id = IDM_SORTSIZE;2436 break;2437 case IDM_INFO:2438 id = IDM_SORTLWDATE;2439 break;2440 case IDM_RENAME:2441 id = IDM_SORTFILENAME;2442 break;2443 }2441 switch (id) { 2442 case IDM_ATTRS: 2443 id = IDM_SORTSIZE; 2444 break; 2445 case IDM_INFO: 2446 id = IDM_SORTLWDATE; 2447 break; 2448 case IDM_RENAME: 2449 id = IDM_SORTFILENAME; 2450 break; 2451 } 2444 2452 } 2445 2453 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 2446 WM_COMMAND, MPFROM2SHORT(id, 0), MPVOID);2454 WM_COMMAND, MPFROM2SHORT(id, 0), MPVOID); 2447 2455 } 2448 2456 return 0; … … 2458 2466 case IDM_RENAME: 2459 2467 case MAIN_STATUS2: 2460 PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE);2461 break;2468 PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE); 2469 break; 2462 2470 default: 2463 PaintRecessedWindow(hwnd, (HPS) 0, FALSE, TRUE);2464 break;2471 PaintRecessedWindow(hwnd, (HPS) 0, FALSE, TRUE); 2472 break; 2465 2473 } 2466 2474 if (id == IDM_RENAME) { 2467 2475 2468 HPS hps;2469 2470 hps = WinBeginPaint(hwnd, (HPS) 0, NULL);2471 if (hps) {2472 PaintSTextWindow(hwnd, hps);2473 WinEndPaint(hps);2474 }2475 return 0;2476 HPS hps; 2477 2478 hps = WinBeginPaint(hwnd, (HPS) 0, NULL); 2479 if (hps) { 2480 PaintSTextWindow(hwnd, hps); 2481 WinEndPaint(hps); 2482 } 2483 return 0; 2476 2484 } 2477 2485 } … … 2506 2514 case UM_COMMAND: 2507 2515 return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2508 FID_CLIENT), msg, mp1, mp2);2516 FID_CLIENT), msg, mp1, mp2); 2509 2517 2510 2518 case WM_PAINT: … … 2519 2527 hps = WinBeginPaint(hwnd, (HPS)0, NULL); 2520 2528 if (hps) { 2521 GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL);2522 WinQueryPresParam(hwnd, PP_BACKGROUNDCOLOR, 0, NULL,2523 sizeof(lColor), &lColor, 0);2524 WinQueryWindowRect(hwnd, &rcl);2525 WinFillRect(hps, &rcl, lColor);2526 WinEndPaint(hps);2529 GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL); 2530 WinQueryPresParam(hwnd, PP_BACKGROUNDCOLOR, 0, NULL, 2531 sizeof(lColor), &lColor, 0); 2532 WinQueryWindowRect(hwnd, &rcl); 2533 WinFillRect(hps, &rcl, lColor); 2534 WinEndPaint(hps); 2527 2535 } 2528 2536 … … 2543 2551 tool = find_tool(id); 2544 2552 if (tool) { 2545 del_tool(tool);2546 WinShowWindow(WinWindowFromID(hwnd, id), FALSE);2547 if (fToolTitles)2548 WinShowWindow(WinWindowFromID(hwnd, id + 25000), FALSE);2549 ResizeTools(hwnd);2553 del_tool(tool); 2554 WinShowWindow(WinWindowFromID(hwnd, id), FALSE); 2555 if (fToolTitles) 2556 WinShowWindow(WinWindowFromID(hwnd, id + 25000), FALSE); 2557 ResizeTools(hwnd); 2550 2558 } 2551 2559 } … … 2557 2565 2558 2566 id = (USHORT) WinDlgBox(HWND_DESKTOP, 2559 hwnd,2560 AddToolProc,2561 FM3ModHandle, ADDBTN_FRAME, MPVOID);2567 hwnd, 2568 AddToolProc, 2569 FM3ModHandle, ADDBTN_FRAME, MPVOID); 2562 2570 if (id && id != (USHORT) - 1) 2563 WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),2564 FID_CLIENT),2565 WM_COMMAND,2566 MPFROM2SHORT(IDM_CREATETOOL, 0), MPFROM2SHORT(id, 0));2571 WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2572 FID_CLIENT), 2573 WM_COMMAND, 2574 MPFROM2SHORT(IDM_CREATETOOL, 0), MPFROM2SHORT(id, 0)); 2567 2575 } 2568 2576 break; … … 2570 2578 case WM_CONTEXTMENU: 2571 2579 if (WinDlgBox(HWND_DESKTOP, 2572 hwnd, ToolIODlgProc, FM3ModHandle, SVBTN_FRAME, MPVOID))2580 hwnd, ToolIODlgProc, FM3ModHandle, SVBTN_FRAME, MPVOID)) 2573 2581 BuildTools(hwnd, TRUE); 2574 2582 return MRFROMSHORT(TRUE); … … 2593 2601 if (pswp) { 2594 2602 if (WinQueryWindowPos(hwndTree, &swp) && 2595 !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE))) {2603 !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE))) { 2596 2604 pswp->x = swp.cx; 2597 2605 pswp->cx -= swp.cx; … … 2600 2608 if (prectl) { 2601 2609 if (WinQueryWindowPos(hwndTree, &swp) && 2602 !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)) &&2603 WinQueryWindowRect(hwndTree, &rectl)) {2610 !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)) && 2611 WinQueryWindowRect(hwndTree, &rectl)) { 2604 2612 prectl->xLeft = rectl.xRight; 2605 2613 prectl->xRight -= rectl.xRight; … … 2653 2661 if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) { 2654 2662 if (swp.x < swpT.cx) { 2655 swp.x = swpT.cx;2656 if (swp.x + swp.cx > swpC.cx)2657 swp.cx = swpC.cx - swp.x;2658 if (swp.cx > 24)2659 WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,2660 SWP_SIZE | SWP_MOVE | SWP_SHOW);2663 swp.x = swpT.cx; 2664 if (swp.x + swp.cx > swpC.cx) 2665 swp.cx = swpC.cx - swp.x; 2666 if (swp.cx > 24) 2667 WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 2668 SWP_SIZE | SWP_MOVE | SWP_SHOW); 2661 2669 } 2662 2670 } … … 2678 2686 WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1); 2679 2687 WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0, 2680 SWP_MOVE | SWP_SHOW | SWP_FOCUSDEACTIVATE);2688 SWP_MOVE | SWP_SHOW | SWP_FOCUSDEACTIVATE); 2681 2689 } 2682 2690 } … … 2700 2708 if (hwndNext) { 2701 2709 if (!WinQueryWindowUShort(hwndNext, QWS_ID)) 2702 continue;2710 continue; 2703 2711 if (next) 2704 break;2712 break; 2705 2713 if (hwndNext == hwndActive) { 2706 if (!previous && hwndPrev) {2707 hwndNext = hwndPrev;2708 break;2709 }2710 else if (previous)2711 next = TRUE;2714 if (!previous && hwndPrev) { 2715 hwndNext = hwndPrev; 2716 break; 2717 } 2718 else if (previous) 2719 next = TRUE; 2712 2720 } 2713 2721 hwndPrev = hwndNext; … … 2715 2723 else { 2716 2724 if ((!next && previous) || once) 2717 break;2725 break; 2718 2726 else if (!previous) { 2719 hwndNext = hwndPrev;2720 break;2727 hwndNext = hwndPrev; 2728 break; 2721 2729 } 2722 2730 else 2723 once = next = TRUE;2731 once = next = TRUE; 2724 2732 } 2725 2733 } … … 2728 2736 if (hwndNext && hwndNext != hwndActive) { 2729 2737 WinSetWindowPos(hwndNext, HWND_TOP, 0, 0, 0, 0, 2730 SWP_ZORDER | SWP_ACTIVATE);2738 SWP_ZORDER | SWP_ACTIVATE); 2731 2739 WinSetWindowPos(hwndActive, ((previous) ? HWND_BOTTOM : hwndNext), 0, 0, 2732 0, 0, SWP_ZORDER);2740 0, 0, SWP_ZORDER); 2733 2741 } 2734 2742 } … … 2745 2753 if (hwndChild != hwndTree) { 2746 2754 WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT), 2747 WM_SAVEAPPLICATION, MPVOID, MPVOID);2755 WM_SAVEAPPLICATION, MPVOID, MPVOID); 2748 2756 if (WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT), 2749 WM_CLOSE, MPVOID, MPVOID)) {2750 ret = TRUE;2751 break;2757 WM_CLOSE, MPVOID, MPVOID)) { 2758 ret = TRUE; 2759 break; 2752 2760 } 2753 2761 } … … 2772 2780 hwndTemp = WinWindowFromID(hwndChild, FID_CLIENT); 2773 2781 if (hwndTemp) { 2774 hwndDir = WinWindowFromID(hwndTemp, DIR_CNR);2775 if (hwndDir) {2776 WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT),2777 WM_CLOSE, MPVOID, MPVOID);2778 ret = TRUE;2779 }2782 hwndDir = WinWindowFromID(hwndTemp, DIR_CNR); 2783 if (hwndDir) { 2784 WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT), 2785 WM_CLOSE, MPVOID, MPVOID); 2786 ret = TRUE; 2787 } 2780 2788 } 2781 2789 } … … 2825 2833 hwndC = WinWindowFromID(hwndChild, FID_CLIENT); 2826 2834 if (hwndC) { 2827 hwndDir = WinWindowFromID(hwndC, DIR_CNR);2828 if (hwndDir) {2829 WinQueryWindowPos(hwndChild, &swp);2830 *szDir = 0;2831 WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(szDir), MPVOID);2832 if (*szDir) {2833 // If saving shutdown state skip no prescan drives2834 if (fIsShutDownState &&2835 driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) {2836 continue;2837 }2838 sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, numsaves);2839 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp,2840 sizeof(SWP));2841 dcd =2842 WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);2843 if (dcd) {2844 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, numsaves);2845 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->sortFlags,2846 sizeof(INT));2847 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, numsaves);2848 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->mask,2849 sizeof(MASK));2850 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, numsaves);2851 flWindowAttr = dcd->flWindowAttr;2852 if (!fLeaveTree && (flWindowAttr & CV_TREE)) {2853 flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));2854 if (dcd->lastattr) {2855 if (dcd->lastattr & CV_TEXT)2856 flWindowAttr |= CV_TEXT;2857 else if (dcd->lastattr & CV_DETAIL)2858 flWindowAttr |= CV_DETAIL;2859 else if (dcd->lastattr & CV_ICON)2860 flWindowAttr |= CV_ICON;2861 else2862 flWindowAttr |= CV_NAME;2863 }2864 else2865 flWindowAttr |= CV_NAME;2866 }2867 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & flWindowAttr,2868 sizeof(ULONG));2869 sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, numsaves);2870 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslongname,2871 sizeof(BOOL));2872 sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, numsaves);2873 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailssubject,2874 sizeof(BOOL));2875 sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, numsaves);2876 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailssize,2877 sizeof(BOOL));2878 sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, numsaves);2879 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsea,2880 sizeof(BOOL));2881 sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, numsaves);2882 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsattr,2883 sizeof(BOOL));2884 sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, numsaves);2885 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsicon,2886 sizeof(BOOL));2887 sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, numsaves);2888 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslwdate,2889 sizeof(BOOL));2890 sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, numsaves);2891 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslwtime,2892 sizeof(BOOL));2893 sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, numsaves);2894 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsladate,2895 sizeof(BOOL));2896 sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, numsaves);2897 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslatime,2898 sizeof(BOOL));2899 sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, numsaves);2900 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailscrdate,2901 sizeof(BOOL));2902 sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, numsaves);2903 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailscrtime,2904 sizeof(BOOL));2905 sprintf(szKey, "%sDirCnr.%lu", szPrefix, numsaves);2906 SavePresParams(hwndDir, szKey);2907 }2908 sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, numsaves++);2909 PrfWriteProfileString(fmprof, FM3Str, szKey, szDir);2910 }2911 }2835 hwndDir = WinWindowFromID(hwndC, DIR_CNR); 2836 if (hwndDir) { 2837 WinQueryWindowPos(hwndChild, &swp); 2838 *szDir = 0; 2839 WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(szDir), MPVOID); 2840 if (*szDir) { 2841 // If saving shutdown state skip no prescan drives 2842 if (fIsShutDownState && 2843 driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) { 2844 continue; 2845 } 2846 sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, numsaves); 2847 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, 2848 sizeof(SWP)); 2849 dcd = 2850 WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER); 2851 if (dcd) { 2852 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, numsaves); 2853 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->sortFlags, 2854 sizeof(INT)); 2855 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, numsaves); 2856 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->mask, 2857 sizeof(MASK)); 2858 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, numsaves); 2859 flWindowAttr = dcd->flWindowAttr; 2860 if (!fLeaveTree && (flWindowAttr & CV_TREE)) { 2861 flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT)); 2862 if (dcd->lastattr) { 2863 if (dcd->lastattr & CV_TEXT) 2864 flWindowAttr |= CV_TEXT; 2865 else if (dcd->lastattr & CV_DETAIL) 2866 flWindowAttr |= CV_DETAIL; 2867 else if (dcd->lastattr & CV_ICON) 2868 flWindowAttr |= CV_ICON; 2869 else 2870 flWindowAttr |= CV_NAME; 2871 } 2872 else 2873 flWindowAttr |= CV_NAME; 2874 } 2875 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & flWindowAttr, 2876 sizeof(ULONG)); 2877 sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, numsaves); 2878 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslongname, 2879 sizeof(BOOL)); 2880 sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, numsaves); 2881 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailssubject, 2882 sizeof(BOOL)); 2883 sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, numsaves); 2884 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailssize, 2885 sizeof(BOOL)); 2886 sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, numsaves); 2887 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsea, 2888 sizeof(BOOL)); 2889 sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, numsaves); 2890 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsattr, 2891 sizeof(BOOL)); 2892 sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, numsaves); 2893 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsicon, 2894 sizeof(BOOL)); 2895 sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, numsaves); 2896 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslwdate, 2897 sizeof(BOOL)); 2898 sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, numsaves); 2899 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslwtime, 2900 sizeof(BOOL)); 2901 sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, numsaves); 2902 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsladate, 2903 sizeof(BOOL)); 2904 sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, numsaves); 2905 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslatime, 2906 sizeof(BOOL)); 2907 sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, numsaves); 2908 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailscrdate, 2909 sizeof(BOOL)); 2910 sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, numsaves); 2911 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailscrtime, 2912 sizeof(BOOL)); 2913 sprintf(szKey, "%sDirCnr.%lu", szPrefix, numsaves); 2914 SavePresParams(hwndDir, szKey); 2915 } 2916 sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, numsaves++); 2917 PrfWriteProfileString(fmprof, FM3Str, szKey, szDir); 2918 } 2919 } 2912 2920 } 2913 2921 } … … 2994 3002 if (hwnd) { 2995 3003 if (WinQueryWindowPos(hwnd, &swp)) { 2996 if (pswp->x > swp.cx)2997 pswp->x = (swp.cx > 24) ? swp.cx - 24 : swp.cx;2998 if (pswp->y > swp.cy)2999 pswp->y = (swp.cy > 24) ? swp.cy - 24 : swp.cy;3000 if (pswp->x + pswp->cx > swp.cx)3001 pswp->cx = swp.cx - pswp->x;3002 if (pswp->y + pswp->cy > swp.cy)3003 pswp->cy = swp.cy - pswp->y;3004 if (pswp->x > swp.cx) 3005 pswp->x = (swp.cx > 24) ? swp.cx - 24 : swp.cx; 3006 if (pswp->y > swp.cy) 3007 pswp->y = (swp.cy > 24) ? swp.cy - 24 : swp.cy; 3008 if (pswp->x + pswp->cx > swp.cx) 3009 pswp->cx = swp.cx - pswp->x; 3010 if (pswp->y + pswp->cy > swp.cy) 3011 pswp->cy = swp.cy - pswp->y; 3004 3012 } 3005 3013 } … … 3049 3057 sprintf(szKey, "%sMySizeLastTime", szPrefix); 3050 3058 if (!PrfQueryProfileData(fmprof, 3051 FM3Str,3052 szKey,3053 (PVOID) & swpO,3054 &size) ||3059 FM3Str, 3060 szKey, 3061 (PVOID) & swpO, 3062 &size) || 3055 3063 size != sizeof(SWP) || !swp.cx || !swp.cy) 3056 3064 { … … 3080 3088 swp.fl &= (~SWP_ACTIVATE); 3081 3089 WinSetWindowPos(hwndTree, 3082 HWND_TOP,3083 swp.x,3084 swp.y,3085 swp.cx,3086 swp.cy,3087 swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);3090 HWND_TOP, 3091 swp.x, 3092 swp.y, 3093 swp.cx, 3094 swp.cy, 3095 swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER); 3088 3096 } 3089 3097 else { 3090 3098 WinSetWindowPos(hwndTree, 3091 HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW);3099 HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW); 3092 3100 WinSetWindowUShort(hwndTree, QWS_XRESTORE, (USHORT) swp.x); 3093 3101 WinSetWindowUShort(hwndTree, QWS_CXRESTORE, (USHORT) swp.cx); … … 3099 3107 sprintf(szKey, "%sNumDirsLastTime", szPrefix); 3100 3108 if (PrfQueryProfileData(fmprof, 3101 FM3Str, szKey, (PVOID) & numsaves, &size)) {3109 FM3Str, szKey, (PVOID) & numsaves, &size)) { 3102 3110 if (fDeleteState) 3103 3111 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); … … 3106 3114 size = sizeof(SWP); 3107 3115 if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &swp, &size)) { 3108 if (fDeleteState)3109 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);3110 sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, x);3111 size = sizeof(szDir);3112 if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) {3113 // If restoring shutdown state and drive marked no prescan3114 // bypass window restore3115 if (fIsShutDownState &&3116 driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) {3117 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);3118 continue;3119 }3120 if (fDeleteState)3121 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);3122 localdcd.ds.detailslongname = dsDirCnrDefault.detailslongname; // Set default3123 size = sizeof(BOOL);3124 sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, x);3125 if (PrfQueryProfileData(fmprof,3126 FM3Str,3127 szKey,3128 (PVOID)&localdcd.ds.detailslongname,3129 &size) &&3130 size == sizeof(BOOL))3131 {3132 if (fDeleteState)3133 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);3134 }3135 localdcd.ds.detailssubject = dsDirCnrDefault.detailssubject; // Set default3136 size = sizeof(BOOL);3137 sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, x);3138 if (PrfQueryProfileData(fmprof,3139 FM3Str,3140 szKey,3141 (PVOID)&localdcd.ds.detailssubject,3142 &size) &&3143 size == sizeof(BOOL))3144 {3145 if (fDeleteState)3146 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);3147 }3148 localdcd.ds.detailsea = dsDirCnrDefault.detailsea; // Set default3149 size = sizeof(BOOL);3150 sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, x);3151 if (PrfQueryProfileData(fmprof,3152 FM3Str,3153 szKey,3154 (PVOID) & localdcd.ds.detailsea,3155 &size) &&3156 size == sizeof(BOOL))3157 {3158 if (fDeleteState)3159 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);3160 }3161 localdcd.ds.detailssize = dsDirCnrDefault.detailssize; // Set default3162 size = sizeof(BOOL);3163 sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, x);3164 if (PrfQueryProfileData(fmprof,3165 FM3Str,3166 szKey,3167 (PVOID) & localdcd.ds.detailssize,3168 &size) &&3169 size == sizeof(BOOL))3170 {3171 if (fDeleteState)3172 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);3173 }3174 localdcd.ds.detailsicon = dsDirCnrDefault.detailsicon; // Set default3175 size = sizeof(BOOL);3176 sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, x);3177 if (PrfQueryProfileData(fmprof,3178 FM3Str,3179 szKey,3180 (PVOID) & localdcd.ds.detailsicon,3181 &size) &&3182 size == sizeof(BOOL))3183 {3184 if (fDeleteState)3185 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);3186 }3187 localdcd.ds.detailsattr = dsDirCnrDefault.detailsattr; // Set default3188 size = sizeof(BOOL);3189 sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, x);3190 if (PrfQueryProfileData(fmprof,3191 FM3Str,3192 szKey,3193 (PVOID)&localdcd.ds.detailsattr,3194 &size) &&3195 size == sizeof(BOOL))3196 {3197 if (fDeleteState)3198 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);3199 }3200 localdcd.ds.detailscrdate = dsDirCnrDefault.detailscrdate; // Set default3201 size = sizeof(BOOL);3202 sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, x);3203 if (PrfQueryProfileData(fmprof,3204 FM3Str,3205 szKey,3206 (PVOID) & localdcd.ds.detailscrdate,3207 &size) && size == sizeof(BOOL))3208 {3209 if (fDeleteState)3210 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);3211 }3212 localdcd.ds.detailscrtime = dsDirCnrDefault.detailscrtime; // Set default3213 size = sizeof(BOOL);3214 sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, x);3215 if (PrfQueryProfileData(fmprof,3216 FM3Str,3217 szKey,3218 (PVOID)&localdcd.ds.detailscrtime,3219 &size) &&3220 size == sizeof(BOOL))3221 {3222 if (fDeleteState)3223 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);3224 }3225 localdcd.ds.detailslwdate = dsDirCnrDefault.detailslwdate; // Set default3226 size = sizeof(BOOL);3227 sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, x);3228 if (PrfQueryProfileData(fmprof,3229 FM3Str,3230 szKey,3231 (PVOID) & localdcd.ds.detailslwdate,3232 &size) &&3233 size == sizeof(BOOL))3234 {3235 if (fDeleteState)3236 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);3237 }3238 localdcd.ds.detailslwtime = dsDirCnrDefault.detailslwtime; // Set default3239 size = sizeof(BOOL);3240 sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, x);3241 if (PrfQueryProfileData(fmprof,3242 FM3Str,3243 szKey,3244 (PVOID) & localdcd.ds.detailslwtime,3245 &size) &&3246 size == sizeof(BOOL))3247 {3248 if (fDeleteState)3249 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);3250 }3251 localdcd.ds.detailsladate = dsDirCnrDefault.detailsladate; // Set default3252 size = sizeof(BOOL);3253 sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, x);3254 if (PrfQueryProfileData(fmprof,3255 FM3Str,3256 szKey,3257 (PVOID) & localdcd.ds.detailsladate,3258 &size) &&3259 size == sizeof(BOOL))3260 {3261 if (fDeleteState)3262 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);3263 }3264 localdcd.ds.detailslatime = dsDirCnrDefault.detailslatime; // Set default3265 size = sizeof(BOOL);3266 sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, x);3267 if (PrfQueryProfileData(fmprof,3268 FM3Str,3269 szKey,3270 (PVOID) & localdcd.ds.detailslatime,3271 &size) &&3272 size == sizeof(BOOL))3273 {3274 if (fDeleteState)3275 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);3276 }3277 hwndDir = (HWND) WinSendMsg(hwndClient,3278 UM_SETDIR,3279 MPFROMP(szDir), MPFROMLONG(1));3280 if (hwndDir) {3281 hwndC = WinWindowFromID(hwndDir, FID_CLIENT);3282 if (hwndC) {3283 HWND hwndCnr = WinWindowFromID(hwndC, DIR_CNR);3284 if (!hwndPPSave) {3285 hwndPPSave = WinCreateWindow(hwndCnr, // Create a window (used to save default presparams)3286 WC_CONTAINER,3287 NULL,3288 CCS_AUTOPOSITION | CCS_MINIICONS |3289 CCS_MINIRECORDCORE | ulCnrType |3290 WS_VISIBLE,3291 0,3292 0,3293 0,3294 0,3295 hwndCnr,3296 HWND_TOP, (ULONG) -1, NULL, NULL);3297 CopyPresParams(hwndPPSave, hwndC);3298 RestorePresParams(hwndPPSave, "DirCnr");3299 }3300 sprintf(szKey, "%sDirCnr.%lu", szPrefix, x);3301 RestorePresParams(hwndCnr, szKey);3302 dcd = WinQueryWindowPtr(hwndCnr, QWL_USER);3303 if (dcd) {3304 dcd->ds.detailslongname = localdcd.ds.detailslongname;3305 dcd->ds.detailssubject = localdcd.ds.detailssubject ;3306 dcd->ds.detailsattr = localdcd.ds.detailsattr ;3307 dcd->ds.detailsea = localdcd.ds.detailsea ;3308 dcd->ds.detailssize = localdcd.ds.detailssize ;3309 dcd->ds.detailsicon = localdcd.ds.detailsicon ;3310 dcd->ds.detailscrdate = localdcd.ds.detailscrdate ;3311 dcd->ds.detailscrtime = localdcd.ds.detailscrtime ;3312 dcd->ds.detailsladate = localdcd.ds.detailsladate ;3313 dcd->ds.detailslatime = localdcd.ds.detailslatime ;3314 dcd->ds.detailslwdate = localdcd.ds.detailslwdate ;3315 dcd->ds.detailslwtime = localdcd.ds.detailslwtime ;3316 size = sizeof(INT);3317 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, x);3318 if (PrfQueryProfileData(fmprof,3319 FM3Str,3320 szKey,3321 (PVOID) & dcd->sortFlags,3322 &size) && size == sizeof(INT)) {3323 if (!dcd->sortFlags)3324 dcd->sortFlags = SORT_PATHNAME;3325 }3326 if (fDeleteState)3327 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);3328 size = sizeof(MASK);3329 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, x);3330 if (PrfQueryProfileData(fmprof,3331 FM3Str,3332 szKey,3333 (PVOID) & dcd->mask, &size) && size) {3334 if (*dcd->mask.szMask)3335 WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),3336 UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID);3337 }3338 *(dcd->mask.prompt) = 0;3339 if (fDeleteState)3340 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);3341 size = sizeof(ULONG);3342 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, x);3343 if (!noview) {3344 if (PrfQueryProfileData(fmprof,3345 FM3Str,3346 szKey,3347 (PVOID) & dcd->flWindowAttr,3348 &size) && size == sizeof(ULONG)) {3349 3350 CNRINFO cnri;3351 3352 memset(&cnri, 0, sizeof(CNRINFO));3353 cnri.cb = sizeof(CNRINFO);3354 if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),3355 CM_QUERYCNRINFO,3356 MPFROMP(&cnri),3357 MPFROMLONG(sizeof(CNRINFO)))) {3358 cnri.flWindowAttr = dcd->flWindowAttr;3359 WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),3360 CM_SETCNRINFO,3361 MPFROMP(&cnri),3362 MPFROMLONG(CMA_FLWINDOWATTR));3363 }3364 }3365 }3366 if (fDeleteState)3367 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);3368 if (!PostMsg(hwndCnr, UM_SETUP2, NULL, NULL))3369 WinSendMsg(hwndCnr, UM_SETUP2, NULL, NULL);3370 }3371 }3372 fRestored = TRUE;3373 swp.hwnd = hwndDir;3374 TransformSwp(&swp, xtrans, ytrans);3375 if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) {3376 WinSetWindowPos(hwndDir,3377 HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW);3378 WinSetWindowUShort(hwndDir, QWS_XRESTORE, (USHORT) swp.x);3379 WinSetWindowUShort(hwndDir, QWS_CXRESTORE, (USHORT) swp.cx);3380 WinSetWindowUShort(hwndDir, QWS_YRESTORE, (USHORT) swp.y);3381 WinSetWindowUShort(hwndDir, QWS_CYRESTORE, (USHORT) swp.cy);3382 } else3383 WinSetWindowPos(hwndDir,3384 HWND_TOP,3385 swp.x,3386 swp.y,3387 swp.cx,3388 swp.cy,3389 swp.fl | SWP_MOVE |3390 SWP_SIZE | SWP_SHOW | SWP_ZORDER |3391 SWP_ACTIVATE);3392 }3393 }3116 if (fDeleteState) 3117 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3118 sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, x); 3119 size = sizeof(szDir); 3120 if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) { 3121 // If restoring shutdown state and drive marked no prescan 3122 // bypass window restore 3123 if (fIsShutDownState && 3124 driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) { 3125 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3126 continue; 3127 } 3128 if (fDeleteState) 3129 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3130 localdcd.ds.detailslongname = dsDirCnrDefault.detailslongname; // Set default 3131 size = sizeof(BOOL); 3132 sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, x); 3133 if (PrfQueryProfileData(fmprof, 3134 FM3Str, 3135 szKey, 3136 (PVOID)&localdcd.ds.detailslongname, 3137 &size) && 3138 size == sizeof(BOOL)) 3139 { 3140 if (fDeleteState) 3141 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3142 } 3143 localdcd.ds.detailssubject = dsDirCnrDefault.detailssubject; // Set default 3144 size = sizeof(BOOL); 3145 sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, x); 3146 if (PrfQueryProfileData(fmprof, 3147 FM3Str, 3148 szKey, 3149 (PVOID)&localdcd.ds.detailssubject, 3150 &size) && 3151 size == sizeof(BOOL)) 3152 { 3153 if (fDeleteState) 3154 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3155 } 3156 localdcd.ds.detailsea = dsDirCnrDefault.detailsea; // Set default 3157 size = sizeof(BOOL); 3158 sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, x); 3159 if (PrfQueryProfileData(fmprof, 3160 FM3Str, 3161 szKey, 3162 (PVOID) & localdcd.ds.detailsea, 3163 &size) && 3164 size == sizeof(BOOL)) 3165 { 3166 if (fDeleteState) 3167 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3168 } 3169 localdcd.ds.detailssize = dsDirCnrDefault.detailssize; // Set default 3170 size = sizeof(BOOL); 3171 sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, x); 3172 if (PrfQueryProfileData(fmprof, 3173 FM3Str, 3174 szKey, 3175 (PVOID) & localdcd.ds.detailssize, 3176 &size) && 3177 size == sizeof(BOOL)) 3178 { 3179 if (fDeleteState) 3180 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3181 } 3182 localdcd.ds.detailsicon = dsDirCnrDefault.detailsicon; // Set default 3183 size = sizeof(BOOL); 3184 sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, x); 3185 if (PrfQueryProfileData(fmprof, 3186 FM3Str, 3187 szKey, 3188 (PVOID) & localdcd.ds.detailsicon, 3189 &size) && 3190 size == sizeof(BOOL)) 3191 { 3192 if (fDeleteState) 3193 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3194 } 3195 localdcd.ds.detailsattr = dsDirCnrDefault.detailsattr; // Set default 3196 size = sizeof(BOOL); 3197 sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, x); 3198 if (PrfQueryProfileData(fmprof, 3199 FM3Str, 3200 szKey, 3201 (PVOID)&localdcd.ds.detailsattr, 3202 &size) && 3203 size == sizeof(BOOL)) 3204 { 3205 if (fDeleteState) 3206 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3207 } 3208 localdcd.ds.detailscrdate = dsDirCnrDefault.detailscrdate; // Set default 3209 size = sizeof(BOOL); 3210 sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, x); 3211 if (PrfQueryProfileData(fmprof, 3212 FM3Str, 3213 szKey, 3214 (PVOID) & localdcd.ds.detailscrdate, 3215 &size) && size == sizeof(BOOL)) 3216 { 3217 if (fDeleteState) 3218 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3219 } 3220 localdcd.ds.detailscrtime = dsDirCnrDefault.detailscrtime; // Set default 3221 size = sizeof(BOOL); 3222 sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, x); 3223 if (PrfQueryProfileData(fmprof, 3224 FM3Str, 3225 szKey, 3226 (PVOID)&localdcd.ds.detailscrtime, 3227 &size) && 3228 size == sizeof(BOOL)) 3229 { 3230 if (fDeleteState) 3231 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3232 } 3233 localdcd.ds.detailslwdate = dsDirCnrDefault.detailslwdate; // Set default 3234 size = sizeof(BOOL); 3235 sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, x); 3236 if (PrfQueryProfileData(fmprof, 3237 FM3Str, 3238 szKey, 3239 (PVOID) & localdcd.ds.detailslwdate, 3240 &size) && 3241 size == sizeof(BOOL)) 3242 { 3243 if (fDeleteState) 3244 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3245 } 3246 localdcd.ds.detailslwtime = dsDirCnrDefault.detailslwtime; // Set default 3247 size = sizeof(BOOL); 3248 sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, x); 3249 if (PrfQueryProfileData(fmprof, 3250 FM3Str, 3251 szKey, 3252 (PVOID) & localdcd.ds.detailslwtime, 3253 &size) && 3254 size == sizeof(BOOL)) 3255 { 3256 if (fDeleteState) 3257 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3258 } 3259 localdcd.ds.detailsladate = dsDirCnrDefault.detailsladate; // Set default 3260 size = sizeof(BOOL); 3261 sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, x); 3262 if (PrfQueryProfileData(fmprof, 3263 FM3Str, 3264 szKey, 3265 (PVOID) & localdcd.ds.detailsladate, 3266 &size) && 3267 size == sizeof(BOOL)) 3268 { 3269 if (fDeleteState) 3270 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3271 } 3272 localdcd.ds.detailslatime = dsDirCnrDefault.detailslatime; // Set default 3273 size = sizeof(BOOL); 3274 sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, x); 3275 if (PrfQueryProfileData(fmprof, 3276 FM3Str, 3277 szKey, 3278 (PVOID) & localdcd.ds.detailslatime, 3279 &size) && 3280 size == sizeof(BOOL)) 3281 { 3282 if (fDeleteState) 3283 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3284 } 3285 hwndDir = (HWND) WinSendMsg(hwndClient, 3286 UM_SETDIR, 3287 MPFROMP(szDir), MPFROMLONG(1)); 3288 if (hwndDir) { 3289 hwndC = WinWindowFromID(hwndDir, FID_CLIENT); 3290 if (hwndC) { 3291 HWND hwndCnr = WinWindowFromID(hwndC, DIR_CNR); 3292 if (!hwndPPSave) { 3293 hwndPPSave = WinCreateWindow(hwndCnr, // Create a window (used to save default presparams) 3294 WC_CONTAINER, 3295 NULL, 3296 CCS_AUTOPOSITION | CCS_MINIICONS | 3297 CCS_MINIRECORDCORE | ulCnrType | 3298 WS_VISIBLE, 3299 0, 3300 0, 3301 0, 3302 0, 3303 hwndCnr, 3304 HWND_TOP, (ULONG) -1, NULL, NULL); 3305 CopyPresParams(hwndPPSave, hwndC); 3306 RestorePresParams(hwndPPSave, "DirCnr"); 3307 } 3308 sprintf(szKey, "%sDirCnr.%lu", szPrefix, x); 3309 RestorePresParams(hwndCnr, szKey); 3310 dcd = WinQueryWindowPtr(hwndCnr, QWL_USER); 3311 if (dcd) { 3312 dcd->ds.detailslongname = localdcd.ds.detailslongname; 3313 dcd->ds.detailssubject = localdcd.ds.detailssubject ; 3314 dcd->ds.detailsattr = localdcd.ds.detailsattr ; 3315 dcd->ds.detailsea = localdcd.ds.detailsea ; 3316 dcd->ds.detailssize = localdcd.ds.detailssize ; 3317 dcd->ds.detailsicon = localdcd.ds.detailsicon ; 3318 dcd->ds.detailscrdate = localdcd.ds.detailscrdate ; 3319 dcd->ds.detailscrtime = localdcd.ds.detailscrtime ; 3320 dcd->ds.detailsladate = localdcd.ds.detailsladate ; 3321 dcd->ds.detailslatime = localdcd.ds.detailslatime ; 3322 dcd->ds.detailslwdate = localdcd.ds.detailslwdate ; 3323 dcd->ds.detailslwtime = localdcd.ds.detailslwtime ; 3324 size = sizeof(INT); 3325 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, x); 3326 if (PrfQueryProfileData(fmprof, 3327 FM3Str, 3328 szKey, 3329 (PVOID) & dcd->sortFlags, 3330 &size) && size == sizeof(INT)) { 3331 if (!dcd->sortFlags) 3332 dcd->sortFlags = SORT_PATHNAME; 3333 } 3334 if (fDeleteState) 3335 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3336 size = sizeof(MASK); 3337 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, x); 3338 if (PrfQueryProfileData(fmprof, 3339 FM3Str, 3340 szKey, 3341 (PVOID) & dcd->mask, &size) && size) { 3342 if (*dcd->mask.szMask) 3343 WinSendMsg(WinWindowFromID(hwndC, DIR_CNR), 3344 UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID); 3345 } 3346 *(dcd->mask.prompt) = 0; 3347 if (fDeleteState) 3348 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3349 size = sizeof(ULONG); 3350 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, x); 3351 if (!noview) { 3352 if (PrfQueryProfileData(fmprof, 3353 FM3Str, 3354 szKey, 3355 (PVOID) & dcd->flWindowAttr, 3356 &size) && size == sizeof(ULONG)) { 3357 3358 CNRINFO cnri; 3359 3360 memset(&cnri, 0, sizeof(CNRINFO)); 3361 cnri.cb = sizeof(CNRINFO); 3362 if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR), 3363 CM_QUERYCNRINFO, 3364 MPFROMP(&cnri), 3365 MPFROMLONG(sizeof(CNRINFO)))) { 3366 cnri.flWindowAttr = dcd->flWindowAttr; 3367 WinSendMsg(WinWindowFromID(hwndC, DIR_CNR), 3368 CM_SETCNRINFO, 3369 MPFROMP(&cnri), 3370 MPFROMLONG(CMA_FLWINDOWATTR)); 3371 } 3372 } 3373 } 3374 if (fDeleteState) 3375 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3376 if (!PostMsg(hwndCnr, UM_SETUP2, NULL, NULL)) 3377 WinSendMsg(hwndCnr, UM_SETUP2, NULL, NULL); 3378 } 3379 } 3380 fRestored = TRUE; 3381 swp.hwnd = hwndDir; 3382 TransformSwp(&swp, xtrans, ytrans); 3383 if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) { 3384 WinSetWindowPos(hwndDir, 3385 HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW); 3386 WinSetWindowUShort(hwndDir, QWS_XRESTORE, (USHORT) swp.x); 3387 WinSetWindowUShort(hwndDir, QWS_CXRESTORE, (USHORT) swp.cx); 3388 WinSetWindowUShort(hwndDir, QWS_YRESTORE, (USHORT) swp.y); 3389 WinSetWindowUShort(hwndDir, QWS_CYRESTORE, (USHORT) swp.cy); 3390 } else 3391 WinSetWindowPos(hwndDir, 3392 HWND_TOP, 3393 swp.x, 3394 swp.y, 3395 swp.cx, 3396 swp.cy, 3397 swp.fl | SWP_MOVE | 3398 SWP_SIZE | SWP_SHOW | SWP_ZORDER | 3399 SWP_ACTIVATE); 3400 } 3401 } 3394 3402 } 3395 3403 } // for … … 3420 3428 if (ulNumMinChildren) { 3421 3429 if (WinQueryWindowPos(hwndChild, &swp) && (swp.fl & SWP_MINIMIZE)) 3422 (*ulNumMinChildren)++;3430 (*ulNumMinChildren)++; 3423 3431 } 3424 3432 } … … 3428 3436 3429 3437 VOID GetNextWindowPos(HWND hwndClient, PSWP pswp, ULONG * ulCntR, 3430 ULONG * ulNumMinChildrenR)3438 ULONG * ulNumMinChildrenR) 3431 3439 { 3432 3440 register ULONG ulCnt; … … 3492 3500 if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) { 3493 3501 if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom) 3494 swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;3502 swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y; 3495 3503 if (swp.x != 0) 3496 swp.x = 0;3504 swp.x = 0; 3497 3505 if (swp.y < 0) 3498 swp.y = 0;3506 swp.y = 0; 3499 3507 if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft) 3500 swp.cx = Rectl.xRight - Rectl.xLeft;3508 swp.cx = Rectl.xRight - Rectl.xLeft; 3501 3509 WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 3502 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);3510 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE); 3503 3511 } 3504 3512 } … … 3512 3520 GetNextWindowPos(hwndClient, &swp, &ulCnt, &ulNumMinChildren); 3513 3521 WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 3514 SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_RESTORE |3515 SWP_ZORDER | SWP_ACTIVATE);3522 SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_RESTORE | 3523 SWP_ZORDER | SWP_ACTIVATE); 3516 3524 ulCnt++; 3517 3525 } … … 3566 3574 if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) { 3567 3575 if (swp.y < 0) 3568 swp.y = 0;3576 swp.y = 0; 3569 3577 if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom) 3570 swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;3578 swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y; 3571 3579 if (swp.x != 0) 3572 swp.x = 0;3580 swp.x = 0; 3573 3581 if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft) 3574 swp.cx = Rectl.xRight - Rectl.xLeft;3582 swp.cx = Rectl.xRight - Rectl.xLeft; 3575 3583 WinSetWindowPos(hwndTree, 3576 HWND_TOP,3577 swp.x,3578 swp.y,3579 swp.cx,3580 swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);3584 HWND_TOP, 3585 swp.x, 3586 swp.y, 3587 swp.cx, 3588 swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE); 3581 3589 WinQueryWindowPos(hwndTree, &swp); 3582 3590 } … … 3603 3611 3604 3612 for (ulCurRow = 0; ulCurRow < ulNumRows; ulCurRow++) { 3605 if ((ulNumRows - ulCurRow) <= ulExtraCols)3606 ulNumCols++;3607 for (ulCurCol = 0; ulCurCol < ulNumCols; ulCurCol++) {3608 ulWidth = Rectl.xRight / ulNumCols;3609 3610 while (hwndChild) {3611 id = WinQueryWindowUShort(hwndChild, QWS_ID);3612 if (id && (id != TREE_FRAME || fFreeTree)) {3613 WinQueryWindowPos(hwndChild, &swp);3614 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)))3615 break;3616 }3617 hwndChild = WinGetNextWindow(henum);3618 }3619 3620 if (hwndChild) {3621 if (!absolute && (swp.fl & SWP_MAXIMIZE)) {3622 WinGetMaxPosition(hwndChild, &swp);3623 WinSetWindowPos(hwndChild,3624 HWND_TOP,3625 swp.x,3626 swp.y,3627 swp.cx, swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW);3628 WinSetWindowUShort(hwndChild,3629 QWS_XRESTORE,3630 (USHORT) (ulWidth * ulCurCol) + Rectl.xLeft);3631 WinSetWindowUShort(hwndChild,3632 QWS_YRESTORE,3633 (USHORT) (Rectl.yTop -3634 (ulHeight * (ulCurRow + 1))));3635 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, (USHORT) ulWidth);3636 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, (USHORT) ulHeight);3637 }3638 else3639 WinSetWindowPos(hwndChild,3640 HWND_TOP,3641 (ulWidth * ulCurCol) + Rectl.xLeft,3642 Rectl.yTop - (ulHeight * (ulCurRow + 1)),3643 ulWidth,3644 ulHeight,3645 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);3646 hwndChild = WinGetNextWindow(henum);3647 }3648 }3649 if ((ulNumRows - ulCurRow) <= ulExtraCols) {3650 ulNumCols--;3651 ulExtraCols--;3652 }3613 if ((ulNumRows - ulCurRow) <= ulExtraCols) 3614 ulNumCols++; 3615 for (ulCurCol = 0; ulCurCol < ulNumCols; ulCurCol++) { 3616 ulWidth = Rectl.xRight / ulNumCols; 3617 3618 while (hwndChild) { 3619 id = WinQueryWindowUShort(hwndChild, QWS_ID); 3620 if (id && (id != TREE_FRAME || fFreeTree)) { 3621 WinQueryWindowPos(hwndChild, &swp); 3622 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) 3623 break; 3624 } 3625 hwndChild = WinGetNextWindow(henum); 3626 } 3627 3628 if (hwndChild) { 3629 if (!absolute && (swp.fl & SWP_MAXIMIZE)) { 3630 WinGetMaxPosition(hwndChild, &swp); 3631 WinSetWindowPos(hwndChild, 3632 HWND_TOP, 3633 swp.x, 3634 swp.y, 3635 swp.cx, swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW); 3636 WinSetWindowUShort(hwndChild, 3637 QWS_XRESTORE, 3638 (USHORT) (ulWidth * ulCurCol) + Rectl.xLeft); 3639 WinSetWindowUShort(hwndChild, 3640 QWS_YRESTORE, 3641 (USHORT) (Rectl.yTop - 3642 (ulHeight * (ulCurRow + 1)))); 3643 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, (USHORT) ulWidth); 3644 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, (USHORT) ulHeight); 3645 } 3646 else 3647 WinSetWindowPos(hwndChild, 3648 HWND_TOP, 3649 (ulWidth * ulCurCol) + Rectl.xLeft, 3650 Rectl.yTop - (ulHeight * (ulCurRow + 1)), 3651 ulWidth, 3652 ulHeight, 3653 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE); 3654 hwndChild = WinGetNextWindow(henum); 3655 } 3656 } 3657 if ((ulNumRows - ulCurRow) <= ulExtraCols) { 3658 ulNumCols--; 3659 ulExtraCols--; 3660 } 3653 3661 } 3654 3662 } … … 3660 3668 3661 3669 static VOID ResizeChildren(HWND hwndClient, SHORT oldcx, SHORT oldcy, 3662 SHORT newcx, SHORT newcy)3670 SHORT newcx, SHORT newcy) 3663 3671 { 3664 3672 /* … … 3678 3686 while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) { 3679 3687 if (!WinQueryWindowUShort(hwndChild, QWS_ID)) 3680 continue;3688 continue; 3681 3689 if (WinQueryWindowPos(hwndChild, &swp)) { 3682 if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) {3683 swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE);3684 swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE);3685 swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE);3686 swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE);3687 }3688 else if (swp.fl & SWP_MAXIMIZE) {3689 swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE);3690 swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE);3691 swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE);3692 swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE);3693 }3694 cx = (swp.cx) ? (LONG) (((double)oldcx * 100.0) / (double)swp.cx) : 0;3695 cy = (swp.cy) ? (LONG) (((double)oldcy * 100.0) / (double)swp.cy) : 0;3696 x = (swp.x) ? (LONG) (((double)oldcx * 100.0) / (double)swp.x) : 0;3697 y = (swp.y) ? (LONG) (((double)oldcy * 100.0) / (double)swp.y) : 0;3698 if (x < 0)3699 x = 0;3700 if (y < 0)3701 y = 0;3702 ux = (x) ? (LONG) (((double)newcx * 100.0) / (double)x) : 0;3703 uy = (y) ? (LONG) (((double)newcy * 100.0) / (double)y) : 0;3704 ucx = (cx) ? (LONG) (((double)newcx * 100.0) / (double)cx) : 0;3705 ucy = (cy) ? (LONG) (((double)newcy * 100.0) / (double)cy) : 0;3706 if (ux + ucx > newcx)3707 ucx = newcx - ux;3708 if (uy + ucy > newcy)3709 ucy = newcy - uy;3710 3711 if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)))3712 WinSetWindowPos(hwndChild, HWND_TOP, ux, uy, ucx, ucy,3713 SWP_MOVE | SWP_SIZE | SWP_SHOW);3714 else if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) {3715 WinSetWindowUShort(hwndChild, QWS_XMINIMIZE, (USHORT) - 1);3716 WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1);3717 WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0,3718 SWP_SIZE | SWP_MOVE | SWP_FOCUSDEACTIVATE);3719 WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux);3720 WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy);3721 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx);3722 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy);3723 }3724 else {3725 WinGetMaxPosition(hwndChild, &swp);3726 WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,3727 SWP_MOVE | SWP_SIZE | SWP_SHOW);3728 WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux);3729 WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy);3730 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx);3731 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy);3732 }3690 if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) { 3691 swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE); 3692 swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE); 3693 swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE); 3694 swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE); 3695 } 3696 else if (swp.fl & SWP_MAXIMIZE) { 3697 swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE); 3698 swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE); 3699 swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE); 3700 swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE); 3701 } 3702 cx = (swp.cx) ? (LONG) (((double)oldcx * 100.0) / (double)swp.cx) : 0; 3703 cy = (swp.cy) ? (LONG) (((double)oldcy * 100.0) / (double)swp.cy) : 0; 3704 x = (swp.x) ? (LONG) (((double)oldcx * 100.0) / (double)swp.x) : 0; 3705 y = (swp.y) ? (LONG) (((double)oldcy * 100.0) / (double)swp.y) : 0; 3706 if (x < 0) 3707 x = 0; 3708 if (y < 0) 3709 y = 0; 3710 ux = (x) ? (LONG) (((double)newcx * 100.0) / (double)x) : 0; 3711 uy = (y) ? (LONG) (((double)newcy * 100.0) / (double)y) : 0; 3712 ucx = (cx) ? (LONG) (((double)newcx * 100.0) / (double)cx) : 0; 3713 ucy = (cy) ? (LONG) (((double)newcy * 100.0) / (double)cy) : 0; 3714 if (ux + ucx > newcx) 3715 ucx = newcx - ux; 3716 if (uy + ucy > newcy) 3717 ucy = newcy - uy; 3718 3719 if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE))) 3720 WinSetWindowPos(hwndChild, HWND_TOP, ux, uy, ucx, ucy, 3721 SWP_MOVE | SWP_SIZE | SWP_SHOW); 3722 else if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) { 3723 WinSetWindowUShort(hwndChild, QWS_XMINIMIZE, (USHORT) - 1); 3724 WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1); 3725 WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0, 3726 SWP_SIZE | SWP_MOVE | SWP_FOCUSDEACTIVATE); 3727 WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux); 3728 WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy); 3729 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx); 3730 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy); 3731 } 3732 else { 3733 WinGetMaxPosition(hwndChild, &swp); 3734 WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 3735 SWP_MOVE | SWP_SIZE | SWP_SHOW); 3736 WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux); 3737 WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy); 3738 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx); 3739 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy); 3740 } 3733 3741 } 3734 3742 } … … 3746 3754 3747 3755 if (!fNoTreeGap) { 3748 INT height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;3749 if (swp.y < height)3750 swp.y = height; // Force bottom to position3756 INT height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2; 3757 if (swp.y < height) 3758 swp.y = height; // Force bottom to position 3751 3759 } 3752 3760 else 3753 swp.y = 0; // Force bottom to position3761 swp.y = 0; // Force bottom to position 3754 3762 3755 3763 swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y; 3756 3764 if (swp.cy < 0) 3757 swp.cy = 0;3765 swp.cy = 0; 3758 3766 3759 3767 if (swp.x != 0) 3760 swp.x = 0; // Left align3768 swp.x = 0; // Left align 3761 3769 3762 3770 // AdjustSizeOfClient can return bogus xRight values - fixme someday 3763 3771 if (Rectl.xRight >= Rectl.xLeft) { 3764 if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)3765 swp.cx = Rectl.xRight - Rectl.xLeft;3772 if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft) 3773 swp.cx = Rectl.xRight - Rectl.xLeft; 3766 3774 } 3767 3775 WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 3768 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);3776 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE); 3769 3777 } 3770 3778 } … … 3794 3802 3795 3803 static MRESULT EXPENTRY ChildFrameButtonProc(HWND hwnd, 3796 ULONG msg,3797 MPARAM mp1, MPARAM mp2)3804 ULONG msg, 3805 MPARAM mp1, MPARAM mp2) 3798 3806 { 3799 3807 USHORT id; … … 3809 3817 if (fOtherHelp) { 3810 3818 if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) 3811 && !WinQueryCapture(HWND_DESKTOP)) {3812 id = WinQueryWindowUShort(hwnd, QWS_ID);3813 switch (id) {3814 case IDM_OPENWALK:3815 MakeBubble(hwnd, FALSE, GetPString(IDS_WALKBUTTONHELP));3816 break;3817 case IDM_USERLIST:3818 MakeBubble(hwnd, FALSE, GetPString(IDS_QUICKBUTTONHELP));3819 break;3820 }3819 && !WinQueryCapture(HWND_DESKTOP)) { 3820 id = WinQueryWindowUShort(hwnd, QWS_ID); 3821 switch (id) { 3822 case IDM_OPENWALK: 3823 MakeBubble(hwnd, FALSE, GetPString(IDS_WALKBUTTONHELP)); 3824 break; 3825 case IDM_USERLIST: 3826 MakeBubble(hwnd, FALSE, GetPString(IDS_QUICKBUTTONHELP)); 3827 break; 3828 } 3821 3829 } 3822 3830 } … … 3832 3840 switch (id) { 3833 3841 case IDM_OPENWALK: 3834 switch (msg) {3835 case WM_BUTTON2CLICK:3836 if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) ==3837 (KC_ALT | KC_SHIFT | KC_CTRL))3838 cmd = IDM_GREP;3839 else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL))3840 CascadeChildren(hwndMain);3842 switch (msg) { 3843 case WM_BUTTON2CLICK: 3844 if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) == 3845 (KC_ALT | KC_SHIFT | KC_CTRL)) 3846 cmd = IDM_GREP; 3847 else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL)) 3848 CascadeChildren(hwndMain); 3841 3849 3842 3850 #ifdef NEVER 3843 else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT))3844 cmd = IDM_SYSINFO;3851 else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT)) 3852 cmd = IDM_SYSINFO; 3845 3853 #endif 3846 3854 3847 else if (shiftstate & KC_SHIFT)3848 cmd = IDM_WINDOWDLG;3849 else if (shiftstate & KC_CTRL)3850 cmd = IDM_SEEALL;3851 else if (shiftstate & KC_ALT)3852 TileChildren(hwndMain, TRUE);3853 else3854 cmd = IDM_WALKDIR;3855 break;3856 case WM_BUTTON3CLICK:3857 TileChildren(hwndMain, TRUE);3858 break;3859 }3860 break;3855 else if (shiftstate & KC_SHIFT) 3856 cmd = IDM_WINDOWDLG; 3857 else if (shiftstate & KC_CTRL) 3858 cmd = IDM_SEEALL; 3859 else if (shiftstate & KC_ALT) 3860 TileChildren(hwndMain, TRUE); 3861 else 3862 cmd = IDM_WALKDIR; 3863 break; 3864 case WM_BUTTON3CLICK: 3865 TileChildren(hwndMain, TRUE); 3866 break; 3867 } 3868 break; 3861 3869 case IDM_USERLIST: 3862 switch (msg) {3863 case WM_BUTTON2CLICK:3864 if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) ==3865 (KC_ALT | KC_SHIFT | KC_CTRL))3866 cmd = IDM_COLORPALETTE;3867 else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL))3868 cmd = IDM_HIDEMENU;3869 else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT))3870 cmd = IDM_NOTEBOOK;3871 else if (shiftstate & KC_SHIFT)3872 cmd = IDM_TOOLTITLES;3873 else if (shiftstate & KC_CTRL)3874 cmd = IDM_TEXTTOOLS;3875 else if (shiftstate & KC_ALT)3876 cmd = IDM_FONTPALETTE;3877 else3878 cmd = IDM_TOOLBAR;3879 break;3880 case WM_BUTTON3CLICK:3881 cmd = IDM_DRIVEBAR;3882 break;3883 }3884 break;3870 switch (msg) { 3871 case WM_BUTTON2CLICK: 3872 if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) == 3873 (KC_ALT | KC_SHIFT | KC_CTRL)) 3874 cmd = IDM_COLORPALETTE; 3875 else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL)) 3876 cmd = IDM_HIDEMENU; 3877 else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT)) 3878 cmd = IDM_NOTEBOOK; 3879 else if (shiftstate & KC_SHIFT) 3880 cmd = IDM_TOOLTITLES; 3881 else if (shiftstate & KC_CTRL) 3882 cmd = IDM_TEXTTOOLS; 3883 else if (shiftstate & KC_ALT) 3884 cmd = IDM_FONTPALETTE; 3885 else 3886 cmd = IDM_TOOLBAR; 3887 break; 3888 case WM_BUTTON3CLICK: 3889 cmd = IDM_DRIVEBAR; 3890 break; 3891 } 3892 break; 3885 3893 } // switch id 3886 3894 3887 3895 if (cmd) { 3888 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_CLIENT),3889 WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);3896 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_CLIENT), 3897 WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID); 3890 3898 } 3891 3899 } … … 3896 3904 if (id == IDM_OPENWALK) { 3897 3905 if (!emphasized) { 3898 emphasized = TRUE;3899 DrawTargetEmphasis(hwnd, emphasized);3906 emphasized = TRUE; 3907 DrawTargetEmphasis(hwnd, emphasized); 3900 3908 } 3901 3909 if (AcceptOneDrop(hwnd, mp1, mp2)) 3902 return MRFROM2SHORT(DOR_DROP, DO_MOVE);3910 return MRFROM2SHORT(DOR_DROP, DO_MOVE); 3903 3911 } 3904 3912 return MRFROM2SHORT(DOR_NEVERDROP, 0); … … 3920 3928 3921 3929 if (emphasized) { 3922 emphasized = FALSE;3923 DrawTargetEmphasis(hwnd, emphasized);3930 emphasized = FALSE; 3931 DrawTargetEmphasis(hwnd, emphasized); 3924 3932 } 3925 3933 if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) { 3926 if (MakeValidDir(szFrom) && !FindDirCnrByName(szFrom, TRUE)) {3927 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szFrom);3928 }3934 if (MakeValidDir(szFrom) && !FindDirCnrByName(szFrom, TRUE)) { 3935 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szFrom); 3936 } 3929 3937 } 3930 3938 } … … 3939 3947 3940 3948 static MRESULT EXPENTRY MainFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1, 3941 MPARAM mp2)3949 MPARAM mp2) 3942 3950 { 3943 3951 PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER); … … 3951 3959 pswp = (SWP *) mp1; 3952 3960 if (fDataMin && !fAmClosing) { 3953 if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) {3954 3955 SWP swp;3956 3957 WinQueryWindowPos(hwnd, &swp);3958 PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(swp.fl), MPVOID);3959 HideNote();3960 }3961 else if (pswp->fl & (SWP_SHOW | SWP_RESTORE)) {3962 if (DataHwnd)3963 PostMsg(DataHwnd, WM_CLOSE, MPVOID, MPVOID);3964 }3961 if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) { 3962 3963 SWP swp; 3964 3965 WinQueryWindowPos(hwnd, &swp); 3966 PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(swp.fl), MPVOID); 3967 HideNote(); 3968 } 3969 else if (pswp->fl & (SWP_SHOW | SWP_RESTORE)) { 3970 if (DataHwnd) 3971 PostMsg(DataHwnd, WM_CLOSE, MPVOID, MPVOID); 3972 } 3965 3973 } 3966 3974 if (!fAmClosing) { 3967 if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE))3968 HideNote();3975 if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) 3976 HideNote(); 3969 3977 } 3970 3978 } … … 3989 3997 case WM_CONTROL: 3990 3998 return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), UM_CONTROL, mp1, 3991 mp2);3999 mp2); 3992 4000 3993 4001 case WM_COMMAND: … … 4009 4017 4010 4018 if (mr && mp2) { 4011 prectl = (PRECTL) mp1;4012 if (prectl->yBottom != prectl->yTop) {4013 {4014 HPS hps;4015 POINTL aptl[TXTBOX_COUNT];4016 4017 hps = WinGetPS(hwndStatus);4018 if (hps) {4019 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);4020 bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;4021 WinReleasePS(hps);4022 }4023 }4024 prectl->yBottom += (sheight + 4);4025 prectl->yTop -= (sheight + 4);4026 if (fMoreButtons) {4027 4028 HPS hps;4029 POINTL aptl[TXTBOX_COUNT];4030 4031 hps = WinGetPS(hwndName);4032 if (hps) {4033 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);4034 bheight = aptl[TXTBOX_TOPLEFT].y + 6;4035 WinReleasePS(hps);4036 }4037 prectl->yBottom += (bheight + 4);4038 prectl->yTop -= (bheight + 4);4039 }4040 if (fToolbar) {4041 if (!fTextTools)4042 prectl->yTop -= ((fToolTitles) ? 50 : 40);4043 else4044 prectl->yTop -= 32;4045 }4046 if (fDrivebar) {4047 ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES),4048 ((prectl->xRight -4049 (WinQuerySysValue(HWND_DESKTOP,4050 SV_CYSIZEBORDER) * 2)) - 4));4051 prectl->yTop -= (16 * (DriveLines * 18));4052 }4053 if (fUserComboBox) {4054 if (!aheight) {4055 4056 SWP swpTemp;4057 4058 WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT),4059 &swpTemp);4060 aheight = swpTemp.cy;4061 }4062 prectl->yTop -= (aheight + 6L);4063 }4064 if (fAutoView) {4065 AutoviewHeight = min(AutoviewHeight,4066 (prectl->yTop - prectl->yBottom) - 116);4067 AutoviewHeight = max(AutoviewHeight, 36);4068 prectl->yBottom += (AutoviewHeight + 6);4069 }4070 }4019 prectl = (PRECTL) mp1; 4020 if (prectl->yBottom != prectl->yTop) { 4021 { 4022 HPS hps; 4023 POINTL aptl[TXTBOX_COUNT]; 4024 4025 hps = WinGetPS(hwndStatus); 4026 if (hps) { 4027 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl); 4028 bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6; 4029 WinReleasePS(hps); 4030 } 4031 } 4032 prectl->yBottom += (sheight + 4); 4033 prectl->yTop -= (sheight + 4); 4034 if (fMoreButtons) { 4035 4036 HPS hps; 4037 POINTL aptl[TXTBOX_COUNT]; 4038 4039 hps = WinGetPS(hwndName); 4040 if (hps) { 4041 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl); 4042 bheight = aptl[TXTBOX_TOPLEFT].y + 6; 4043 WinReleasePS(hps); 4044 } 4045 prectl->yBottom += (bheight + 4); 4046 prectl->yTop -= (bheight + 4); 4047 } 4048 if (fToolbar) { 4049 if (!fTextTools) 4050 prectl->yTop -= ((fToolTitles) ? 50 : 40); 4051 else 4052 prectl->yTop -= 32; 4053 } 4054 if (fDrivebar) { 4055 ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), 4056 ((prectl->xRight - 4057 (WinQuerySysValue(HWND_DESKTOP, 4058 SV_CYSIZEBORDER) * 2)) - 4)); 4059 prectl->yTop -= (16 * (DriveLines * 18)); 4060 } 4061 if (fUserComboBox) { 4062 if (!aheight) { 4063 4064 SWP swpTemp; 4065 4066 WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT), 4067 &swpTemp); 4068 aheight = swpTemp.cy; 4069 } 4070 prectl->yTop -= (aheight + 6L); 4071 } 4072 if (fAutoView) { 4073 AutoviewHeight = min(AutoviewHeight, 4074 (prectl->yTop - prectl->yBottom) - 116); 4075 AutoviewHeight = max(AutoviewHeight, 36); 4076 prectl->yBottom += (AutoviewHeight + 6); 4077 } 4078 } 4071 4079 } 4072 4080 return mr; … … 4092 4100 pswp = (PSWP) mp1; 4093 4101 { 4094 SHORT x;4095 4096 for (x = 0; x < soldCount; x++) {4097 if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) {4098 pswpClient = pswp;4099 break;4100 }4101 pswp++;4102 }4102 SHORT x; 4103 4104 for (x = 0; x < soldCount; x++) { 4105 if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) { 4106 pswpClient = pswp; 4107 break; 4108 } 4109 pswp++; 4110 } 4103 4111 } 4104 4112 4105 4113 { 4106 HPS hps;4107 POINTL aptl[TXTBOX_COUNT];4108 4109 hps = WinGetPS(hwndStatus);4110 if (hps) {4111 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);4112 bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;4113 WinReleasePS(hps);4114 }4115 if (fMoreButtons) {4116 hps = WinGetPS(hwndName);4117 if (hps) {4118 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);4119 bheight = aptl[TXTBOX_TOPLEFT].y + 6;4120 WinReleasePS(hps);4121 }4122 }4114 HPS hps; 4115 POINTL aptl[TXTBOX_COUNT]; 4116 4117 hps = WinGetPS(hwndStatus); 4118 if (hps) { 4119 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl); 4120 bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6; 4121 WinReleasePS(hps); 4122 } 4123 if (fMoreButtons) { 4124 hps = WinGetPS(hwndName); 4125 if (hps) { 4126 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl); 4127 bheight = aptl[TXTBOX_TOPLEFT].y + 6; 4128 WinReleasePS(hps); 4129 } 4130 } 4123 4131 } 4124 4132 pswpNew = (PSWP) mp1 + soldCount; … … 4130 4138 pswpNew->y = swpClient.y + 2; 4131 4139 if (!fSplitStatus) 4132 width = swpClient.cx - (16 + (sheight * 2) + 4);4140 width = swpClient.cx - (16 + (sheight * 2) + 4); 4133 4141 else 4134 width = (swpClient.cx - (16 + (sheight * 2) + 4)) / 2;4142 width = (swpClient.cx - (16 + (sheight * 2) + 4)) / 2; 4135 4143 width = max(width, 10); 4136 4144 if (fSplitStatus) 4137 pswpNew->cx = width - 6;4145 pswpNew->cx = width - 6; 4138 4146 else 4139 pswpNew->cx = width - 8;4147 pswpNew->cx = width - 8; 4140 4148 pswpNew->cy = sheight; 4141 4149 pswpClient->y = pswpNew->y + pswpNew->cy + 3; … … 4144 4152 4145 4153 if (fSplitStatus) { 4146 pswpNew = (PSWP) mp1 + (soldCount + 1);4147 *pswpNew = *pswpClient;4148 pswpNew->hwnd = hwndStatus2;4149 pswpNew->hwndInsertBehind = HWND_BOTTOM;4150 pswpNew->x = width + 8;4151 pswpNew->y = swpClient.y + 2;4152 pswpNew->cx = width - 6;4153 pswpNew->cy = sheight;4154 sCount++;4154 pswpNew = (PSWP) mp1 + (soldCount + 1); 4155 *pswpNew = *pswpClient; 4156 pswpNew->hwnd = hwndStatus2; 4157 pswpNew->hwndInsertBehind = HWND_BOTTOM; 4158 pswpNew->x = width + 8; 4159 pswpNew->y = swpClient.y + 2; 4160 pswpNew->cx = width - 6; 4161 pswpNew->cy = sheight; 4162 sCount++; 4155 4163 } 4156 4164 else { 4157 WinShowWindow(hwndStatus2, FALSE);4158 WinSetWindowText(hwndStatus2, NullStr);4165 WinShowWindow(hwndStatus2, FALSE); 4166 WinSetWindowText(hwndStatus2, NullStr); 4159 4167 } 4160 4168 4161 4169 if (fToolbar) { 4162 if (fTextTools)4163 theight = 32L;4164 else if (!fToolTitles)4165 theight = 40L;4166 pswpNew = (PSWP) mp1 + (soldCount + 1 + (fSplitStatus != FALSE));4167 *pswpNew = *pswpClient;4168 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_TOOLS);4169 pswpNew->hwndInsertBehind = HWND_BOTTOM;4170 pswpNew->x = swpClient.x + 2;4171 pswpNew->y = (swpClient.y + swpClient.cy) - (theight - 2);4172 pswpNew->cx = swpClient.cx - 4;4173 pswpNew->cy = theight - 4;4174 pswpClient->cy -= theight;4175 sCount++;4170 if (fTextTools) 4171 theight = 32L; 4172 else if (!fToolTitles) 4173 theight = 40L; 4174 pswpNew = (PSWP) mp1 + (soldCount + 1 + (fSplitStatus != FALSE)); 4175 *pswpNew = *pswpClient; 4176 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_TOOLS); 4177 pswpNew->hwndInsertBehind = HWND_BOTTOM; 4178 pswpNew->x = swpClient.x + 2; 4179 pswpNew->y = (swpClient.y + swpClient.cy) - (theight - 2); 4180 pswpNew->cx = swpClient.cx - 4; 4181 pswpNew->cy = theight - 4; 4182 pswpClient->cy -= theight; 4183 sCount++; 4176 4184 } 4177 4185 else 4178 WinShowWindow(WinWindowFromID(hwnd, MAIN_TOOLS), FALSE);4186 WinShowWindow(WinWindowFromID(hwnd, MAIN_TOOLS), FALSE); 4179 4187 4180 4188 if (fDrivebar) { 4181 ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), pswpClient->cx - 4);4182 pswpNew = (PSWP) mp1 + (soldCount + 1 +4183 (fSplitStatus != FALSE) +4184 (fToolbar != FALSE));4185 *pswpNew = *pswpClient;4186 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_DRIVES);4187 pswpNew->hwndInsertBehind = HWND_BOTTOM;4188 pswpNew->x = swpClient.x + 2;4189 dheight += ((dheight - 2) * DriveLines);4190 pswpNew->y = (swpClient.y + swpClient.cy) - (dheight - 2);4191 if (fToolbar)4192 pswpNew->y -= theight;4193 pswpNew->cx = swpClient.cx - 4;4194 pswpNew->cy = dheight - 4;4195 pswpClient->cy -= dheight;4196 sCount++;4189 ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), pswpClient->cx - 4); 4190 pswpNew = (PSWP) mp1 + (soldCount + 1 + 4191 (fSplitStatus != FALSE) + 4192 (fToolbar != FALSE)); 4193 *pswpNew = *pswpClient; 4194 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_DRIVES); 4195 pswpNew->hwndInsertBehind = HWND_BOTTOM; 4196 pswpNew->x = swpClient.x + 2; 4197 dheight += ((dheight - 2) * DriveLines); 4198 pswpNew->y = (swpClient.y + swpClient.cy) - (dheight - 2); 4199 if (fToolbar) 4200 pswpNew->y -= theight; 4201 pswpNew->cx = swpClient.cx - 4; 4202 pswpNew->cy = dheight - 4; 4203 pswpClient->cy -= dheight; 4204 sCount++; 4197 4205 } 4198 4206 else 4199 WinShowWindow(WinWindowFromID(hwnd, MAIN_DRIVES), FALSE);4207 WinShowWindow(WinWindowFromID(hwnd, MAIN_DRIVES), FALSE); 4200 4208 4201 4209 if (fAutoView) { 4202 pswpNew = (PSWP) mp1 + (soldCount + 1 +4203 (fToolbar != FALSE) +4204 (fDrivebar != FALSE) +4205 (fSplitStatus != FALSE));4206 *pswpNew = *pswpClient;4207 pswpNew->hwnd = (fComments) ? hwndAutoMLE : hwndAutoview;4208 pswpNew->x = pswpClient->x + 3;4209 pswpNew->y = pswpClient->y + 3;4210 if (fMoreButtons)4211 pswpNew->y += (bheight + 4);4212 pswpNew->cx = pswpClient->cx - 6;4213 AutoviewHeight = min(AutoviewHeight, pswpClient->cy - 116);4214 AutoviewHeight = max(AutoviewHeight, 36);4215 pswpNew->cy = AutoviewHeight;4216 pswpClient->y += (AutoviewHeight + 6);4217 pswpClient->cy -= (AutoviewHeight + 6);4218 sCount++;4219 WinShowWindow((fComments) ? hwndAutoview : hwndAutoMLE, FALSE);4210 pswpNew = (PSWP) mp1 + (soldCount + 1 + 4211 (fToolbar != FALSE) + 4212 (fDrivebar != FALSE) + 4213 (fSplitStatus != FALSE)); 4214 *pswpNew = *pswpClient; 4215 pswpNew->hwnd = (fComments) ? hwndAutoMLE : hwndAutoview; 4216 pswpNew->x = pswpClient->x + 3; 4217 pswpNew->y = pswpClient->y + 3; 4218 if (fMoreButtons) 4219 pswpNew->y += (bheight + 4); 4220 pswpNew->cx = pswpClient->cx - 6; 4221 AutoviewHeight = min(AutoviewHeight, pswpClient->cy - 116); 4222 AutoviewHeight = max(AutoviewHeight, 36); 4223 pswpNew->cy = AutoviewHeight; 4224 pswpClient->y += (AutoviewHeight + 6); 4225 pswpClient->cy -= (AutoviewHeight + 6); 4226 sCount++; 4227 WinShowWindow((fComments) ? hwndAutoview : hwndAutoMLE, FALSE); 4220 4228 } 4221 4229 else { 4222 WinShowWindow(hwndAutoview, FALSE);4223 WinShowWindow(hwndAutoMLE, FALSE);4230 WinShowWindow(hwndAutoview, FALSE); 4231 WinShowWindow(hwndAutoMLE, FALSE); 4224 4232 } 4225 4233 4226 4234 pswpNew = (PSWP) mp1 + (soldCount + 1 + 4227 (fToolbar != FALSE) +4228 (fDrivebar != FALSE) +4229 (fSplitStatus != FALSE) + (fAutoView != FALSE));4235 (fToolbar != FALSE) + 4236 (fDrivebar != FALSE) + 4237 (fSplitStatus != FALSE) + (fAutoView != FALSE)); 4230 4238 *pswpNew = *pswpClient; 4231 4239 pswpNew->hwnd = WinWindowFromID(hwnd, IDM_OPENWALK); … … 4236 4244 sCount++; 4237 4245 pswpNew = (PSWP) mp1 + (soldCount + 2 + 4238 (fToolbar != FALSE) +4239 (fDrivebar != FALSE) +4240 (fSplitStatus != FALSE) + (fAutoView != FALSE));4246 (fToolbar != FALSE) + 4247 (fDrivebar != FALSE) + 4248 (fSplitStatus != FALSE) + (fAutoView != FALSE)); 4241 4249 *pswpNew = *pswpClient; 4242 4250 pswpNew->hwnd = WinWindowFromID(hwnd, IDM_USERLIST); … … 4247 4255 sCount++; 4248 4256 pswpNew = (PSWP) mp1 + (soldCount + 3 + 4249 (fToolbar != FALSE) +4250 (fDrivebar != FALSE) +4251 (fSplitStatus != FALSE) + (fAutoView != FALSE));4257 (fToolbar != FALSE) + 4258 (fDrivebar != FALSE) + 4259 (fSplitStatus != FALSE) + (fAutoView != FALSE)); 4252 4260 *pswpNew = *pswpClient; 4253 4261 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LED); … … 4258 4266 sCount++; 4259 4267 pswpNew = (PSWP) mp1 + (soldCount + 4 + 4260 (fToolbar != FALSE) +4261 (fDrivebar != FALSE) +4262 (fSplitStatus != FALSE) + (fAutoView != FALSE));4268 (fToolbar != FALSE) + 4269 (fDrivebar != FALSE) + 4270 (fSplitStatus != FALSE) + (fAutoView != FALSE)); 4263 4271 *pswpNew = *pswpClient; 4264 4272 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LEDHDR); … … 4269 4277 sCount++; 4270 4278 if (fUserComboBox) { 4271 if (!aheight) {4272 4273 SWP swpTemp;4274 4275 WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT),4276 &swpTemp);4277 aheight = swpTemp.cy;4278 }4279 pswpNew = (PSWP) mp1 + (soldCount + 5 +4280 (fToolbar != FALSE) +4281 (fSplitStatus != FALSE) +4282 (fDrivebar != FALSE) + (fAutoView != FALSE));4283 *pswpNew = *pswpClient;4284 pswpNew->hwnd = hwndDrivelist;4285 pswpNew->x = swpClient.x;4286 pswpNew->cx = 48;4287 pswpClient->cy -= (aheight + 6L);4288 pswpNew->y = pswpClient->y;4289 pswpNew->cy = pswpClient->cy + (aheight + 5L);4290 sCount++;4291 pswpNew = (PSWP) mp1 + (soldCount + 6 +4292 (fToolbar != FALSE) +4293 (fDrivebar != FALSE) +4294 (fSplitStatus != FALSE) +4295 (fAutoView != FALSE));4296 *pswpNew = *pswpClient;4297 pswpNew->hwnd = hwndStatelist;4298 pswpNew->x = swpClient.x + 48;4299 pswpNew->cx = (swpClient.cx - 48) / 7;4300 pswpNew->y = pswpClient->y;4301 pswpNew->cy = pswpClient->cy + (aheight + 5L);4302 sCount++;4303 pswpNew = (PSWP) mp1 + (soldCount + 7 +4304 (fToolbar != FALSE) +4305 (fDrivebar != FALSE) +4306 (fSplitStatus != FALSE) +4307 (fAutoView != FALSE));4308 *pswpNew = *pswpClient;4309 pswpNew->hwnd = hwndCmdlist;4310 pswpNew->x = swpClient.x + 48 + ((swpClient.cx - 48) / 7);4311 pswpNew->cx = (swpClient.cx - 48) / 5 +4312 ((swpClient.cx - 48) / 5) - ((swpClient.cx - 48) / 7);4313 pswpNew->y = pswpClient->y;4314 pswpNew->cy = pswpClient->cy + (aheight + 5L);4315 sCount++;4316 pswpNew = (PSWP) mp1 + (soldCount + 8 +4317 (fToolbar != FALSE) +4318 (fDrivebar != FALSE) +4319 (fSplitStatus != FALSE) +4320 (fAutoView != FALSE));4321 *pswpNew = *pswpClient;4322 pswpNew->hwnd = hwndUserlist;4323 pswpNew->x = swpClient.x + 48 + (((swpClient.cx - 48) / 5) * 2);4324 pswpNew->cx = ((swpClient.x + swpClient.cx) - pswpNew->x) -4325 ((fToolbar) ? ((swpClient.cx - 48) / 7) : 0);4326 pswpNew->y = pswpClient->y;4327 pswpNew->cy = pswpClient->cy + (aheight + 5L);4328 sCount++;4329 if (fToolbar) {4330 pswpNew = (PSWP) mp1 + (soldCount + 9 +4331 (fToolbar != FALSE) +4332 (fDrivebar != FALSE) +4333 (fSplitStatus != FALSE) +4334 (fAutoView != FALSE));4335 *pswpNew = *pswpClient;4336 pswpNew->hwnd = hwndButtonlist;4337 pswpNew->x = swpClient.cx - ((swpClient.cx - 48) / 7) + 4;4338 pswpNew->cx = (swpClient.x + swpClient.cx) - pswpNew->x;4339 pswpNew->y = pswpClient->y;4340 pswpNew->cy = pswpClient->cy + (aheight + 5L);4341 sCount++;4342 }4343 else4344 WinShowWindow(hwndButtonlist, FALSE);4279 if (!aheight) { 4280 4281 SWP swpTemp; 4282 4283 WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT), 4284 &swpTemp); 4285 aheight = swpTemp.cy; 4286 } 4287 pswpNew = (PSWP) mp1 + (soldCount + 5 + 4288 (fToolbar != FALSE) + 4289 (fSplitStatus != FALSE) + 4290 (fDrivebar != FALSE) + (fAutoView != FALSE)); 4291 *pswpNew = *pswpClient; 4292 pswpNew->hwnd = hwndDrivelist; 4293 pswpNew->x = swpClient.x; 4294 pswpNew->cx = 48; 4295 pswpClient->cy -= (aheight + 6L); 4296 pswpNew->y = pswpClient->y; 4297 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4298 sCount++; 4299 pswpNew = (PSWP) mp1 + (soldCount + 6 + 4300 (fToolbar != FALSE) + 4301 (fDrivebar != FALSE) + 4302 (fSplitStatus != FALSE) + 4303 (fAutoView != FALSE)); 4304 *pswpNew = *pswpClient; 4305 pswpNew->hwnd = hwndStatelist; 4306 pswpNew->x = swpClient.x + 48; 4307 pswpNew->cx = (swpClient.cx - 48) / 7; 4308 pswpNew->y = pswpClient->y; 4309 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4310 sCount++; 4311 pswpNew = (PSWP) mp1 + (soldCount + 7 + 4312 (fToolbar != FALSE) + 4313 (fDrivebar != FALSE) + 4314 (fSplitStatus != FALSE) + 4315 (fAutoView != FALSE)); 4316 *pswpNew = *pswpClient; 4317 pswpNew->hwnd = hwndCmdlist; 4318 pswpNew->x = swpClient.x + 48 + ((swpClient.cx - 48) / 7); 4319 pswpNew->cx = (swpClient.cx - 48) / 5 + 4320 ((swpClient.cx - 48) / 5) - ((swpClient.cx - 48) / 7); 4321 pswpNew->y = pswpClient->y; 4322 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4323 sCount++; 4324 pswpNew = (PSWP) mp1 + (soldCount + 8 + 4325 (fToolbar != FALSE) + 4326 (fDrivebar != FALSE) + 4327 (fSplitStatus != FALSE) + 4328 (fAutoView != FALSE)); 4329 *pswpNew = *pswpClient; 4330 pswpNew->hwnd = hwndUserlist; 4331 pswpNew->x = swpClient.x + 48 + (((swpClient.cx - 48) / 5) * 2); 4332 pswpNew->cx = ((swpClient.x + swpClient.cx) - pswpNew->x) - 4333 ((fToolbar) ? ((swpClient.cx - 48) / 7) : 0); 4334 pswpNew->y = pswpClient->y; 4335 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4336 sCount++; 4337 if (fToolbar) { 4338 pswpNew = (PSWP) mp1 + (soldCount + 9 + 4339 (fToolbar != FALSE) + 4340 (fDrivebar != FALSE) + 4341 (fSplitStatus != FALSE) + 4342 (fAutoView != FALSE)); 4343 *pswpNew = *pswpClient; 4344 pswpNew->hwnd = hwndButtonlist; 4345 pswpNew->x = swpClient.cx - ((swpClient.cx - 48) / 7) + 4; 4346 pswpNew->cx = (swpClient.x + swpClient.cx) - pswpNew->x; 4347 pswpNew->y = pswpClient->y; 4348 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4349 sCount++; 4350 } 4351 else 4352 WinShowWindow(hwndButtonlist, FALSE); 4345 4353 } 4346 4354 else { 4347 WinShowWindow(hwndUserlist, FALSE);4348 WinShowWindow(hwndDrivelist, FALSE);4349 WinShowWindow(hwndStatelist, FALSE);4350 WinShowWindow(hwndButtonlist, FALSE);4351 WinShowWindow(hwndCmdlist, FALSE);4355 WinShowWindow(hwndUserlist, FALSE); 4356 WinShowWindow(hwndDrivelist, FALSE); 4357 WinShowWindow(hwndStatelist, FALSE); 4358 WinShowWindow(hwndButtonlist, FALSE); 4359 WinShowWindow(hwndCmdlist, FALSE); 4352 4360 } 4353 4361 { 4354 PSWP pswpTitlebar = (PSWP) 0, pswpMinbutton = (PSWP) 0;4355 SHORT x;4356 4357 pswpNew = (PSWP) mp1 + (soldCount + 5 +4358 (fToolbar != FALSE) +4359 (fDrivebar != FALSE) +4360 (fSplitStatus != FALSE) +4361 (fAutoView != FALSE) +4362 ((fUserComboBox != FALSE) * 4) +4363 (fUserComboBox != FALSE &&4364 fToolbar != FALSE));4365 pswp = (PSWP) mp1;4366 for (x = 0; x < soldCount; x++) {4367 if (!pswpTitlebar &&4368 WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_TITLEBAR)4369 pswpTitlebar = pswp;4370 else if (!pswpMinbutton &&4371 WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_MINMAX)4372 pswpMinbutton = pswp;4373 if (pswpTitlebar && pswpMinbutton)4374 break;4375 pswp++;4376 }4377 if (pswpMinbutton && pswpTitlebar) {4378 *pswpNew = *pswpMinbutton;4379 pswpNew->hwnd = WinWindowFromID(hwnd, IDM_IDEALSIZE);4380 pswpNew->cy = pswpMinbutton->cy + 3;4381 pswpNew->cx = min(pswpNew->cy, (pswpMinbutton->cx / 2) + 3);4382 pswpTitlebar->cx -= (pswpNew->cx - 1);4383 pswpNew->x = pswpTitlebar->x + (pswpTitlebar->cx);4384 pswpNew->y = pswpMinbutton->y - 1;4385 sCount++;4386 }4387 else4388 WinShowWindow(WinWindowFromID(hwnd, IDM_IDEALSIZE), FALSE);4362 PSWP pswpTitlebar = (PSWP) 0, pswpMinbutton = (PSWP) 0; 4363 SHORT x; 4364 4365 pswpNew = (PSWP) mp1 + (soldCount + 5 + 4366 (fToolbar != FALSE) + 4367 (fDrivebar != FALSE) + 4368 (fSplitStatus != FALSE) + 4369 (fAutoView != FALSE) + 4370 ((fUserComboBox != FALSE) * 4) + 4371 (fUserComboBox != FALSE && 4372 fToolbar != FALSE)); 4373 pswp = (PSWP) mp1; 4374 for (x = 0; x < soldCount; x++) { 4375 if (!pswpTitlebar && 4376 WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_TITLEBAR) 4377 pswpTitlebar = pswp; 4378 else if (!pswpMinbutton && 4379 WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_MINMAX) 4380 pswpMinbutton = pswp; 4381 if (pswpTitlebar && pswpMinbutton) 4382 break; 4383 pswp++; 4384 } 4385 if (pswpMinbutton && pswpTitlebar) { 4386 *pswpNew = *pswpMinbutton; 4387 pswpNew->hwnd = WinWindowFromID(hwnd, IDM_IDEALSIZE); 4388 pswpNew->cy = pswpMinbutton->cy + 3; 4389 pswpNew->cx = min(pswpNew->cy, (pswpMinbutton->cx / 2) + 3); 4390 pswpTitlebar->cx -= (pswpNew->cx - 1); 4391 pswpNew->x = pswpTitlebar->x + (pswpTitlebar->cx); 4392 pswpNew->y = pswpMinbutton->y - 1; 4393 sCount++; 4394 } 4395 else 4396 WinShowWindow(WinWindowFromID(hwnd, IDM_IDEALSIZE), FALSE); 4389 4397 } 4390 4398 4391 4399 if (fMoreButtons) { 4392 4400 4393 LONG lastx;4394 4395 pswpNew = (PSWP) mp1 + (soldCount + 6 +4396 (fToolbar != FALSE) +4397 (fDrivebar != FALSE) +4398 (fSplitStatus != FALSE) +4399 (fAutoView != FALSE) +4400 ((fUserComboBox != FALSE) * 4) +4401 (fUserComboBox != FALSE &&4402 fToolbar != FALSE));4403 *pswpNew = *pswpClient;4404 pswpNew->hwnd = hwndName;4405 pswpNew->x = swpClient.x + 3;4406 pswpNew->y = swpClient.y + (sheight + 6);4407 pswpNew->cx = ((swpClient.cx / 2) + (swpClient.cx / 5)) - 3;4408 lastx = pswpNew->x + pswpNew->cx;4409 pswpNew->cy = bheight;4410 pswpClient->y += (bheight + 4);4411 pswpClient->cy -= (bheight + 4);4412 sCount++;4413 pswpNew = (PSWP) mp1 + (soldCount + 7 +4414 (fToolbar != FALSE) +4415 (fDrivebar != FALSE) +4416 (fSplitStatus != FALSE) +4417 (fAutoView != FALSE) +4418 ((fUserComboBox != FALSE) * 4) +4419 (fUserComboBox != FALSE &&4420 fToolbar != FALSE));4421 *pswpNew = *pswpClient;4422 pswpNew->hwnd = hwndDate;4423 pswpNew->x = lastx + 3;4424 pswpNew->y = swpClient.y + (sheight + 6);4425 pswpNew->cx = (swpClient.cx / 6) + (swpClient.cx / 16) - 3;4426 lastx = pswpNew->x + pswpNew->cx;4427 pswpNew->cy = bheight;4428 sCount++;4429 pswpNew = (PSWP) mp1 + (soldCount + 8 +4430 (fToolbar != FALSE) +4431 (fDrivebar != FALSE) +4432 (fSplitStatus != FALSE) +4433 (fAutoView != FALSE) +4434 ((fUserComboBox != FALSE) * 4) +4435 (fUserComboBox != FALSE &&4436 fToolbar != FALSE));4437 *pswpNew = *pswpClient;4438 pswpNew->hwnd = hwndAttr;4439 pswpNew->x = lastx + 3;4440 pswpNew->y = swpClient.y + (sheight + 6);4441 pswpNew->cx = (swpClient.cx - pswpNew->x) - 1;4442 pswpNew->cy = bheight;4443 sCount++;4401 LONG lastx; 4402 4403 pswpNew = (PSWP) mp1 + (soldCount + 6 + 4404 (fToolbar != FALSE) + 4405 (fDrivebar != FALSE) + 4406 (fSplitStatus != FALSE) + 4407 (fAutoView != FALSE) + 4408 ((fUserComboBox != FALSE) * 4) + 4409 (fUserComboBox != FALSE && 4410 fToolbar != FALSE)); 4411 *pswpNew = *pswpClient; 4412 pswpNew->hwnd = hwndName; 4413 pswpNew->x = swpClient.x + 3; 4414 pswpNew->y = swpClient.y + (sheight + 6); 4415 pswpNew->cx = ((swpClient.cx / 2) + (swpClient.cx / 5)) - 3; 4416 lastx = pswpNew->x + pswpNew->cx; 4417 pswpNew->cy = bheight; 4418 pswpClient->y += (bheight + 4); 4419 pswpClient->cy -= (bheight + 4); 4420 sCount++; 4421 pswpNew = (PSWP) mp1 + (soldCount + 7 + 4422 (fToolbar != FALSE) + 4423 (fDrivebar != FALSE) + 4424 (fSplitStatus != FALSE) + 4425 (fAutoView != FALSE) + 4426 ((fUserComboBox != FALSE) * 4) + 4427 (fUserComboBox != FALSE && 4428 fToolbar != FALSE)); 4429 *pswpNew = *pswpClient; 4430 pswpNew->hwnd = hwndDate; 4431 pswpNew->x = lastx + 3; 4432 pswpNew->y = swpClient.y + (sheight + 6); 4433 pswpNew->cx = (swpClient.cx / 6) + (swpClient.cx / 16) - 3; 4434 lastx = pswpNew->x + pswpNew->cx; 4435 pswpNew->cy = bheight; 4436 sCount++; 4437 pswpNew = (PSWP) mp1 + (soldCount + 8 + 4438 (fToolbar != FALSE) + 4439 (fDrivebar != FALSE) + 4440 (fSplitStatus != FALSE) + 4441 (fAutoView != FALSE) + 4442 ((fUserComboBox != FALSE) * 4) + 4443 (fUserComboBox != FALSE && 4444 fToolbar != FALSE)); 4445 *pswpNew = *pswpClient; 4446 pswpNew->hwnd = hwndAttr; 4447 pswpNew->x = lastx + 3; 4448 pswpNew->y = swpClient.y + (sheight + 6); 4449 pswpNew->cx = (swpClient.cx - pswpNew->x) - 1; 4450 pswpNew->cy = bheight; 4451 sCount++; 4444 4452 } 4445 4453 else { 4446 WinShowWindow(hwndAttr, FALSE);4447 WinShowWindow(hwndName, FALSE);4448 WinShowWindow(hwndDate, FALSE);4454 WinShowWindow(hwndAttr, FALSE); 4455 WinShowWindow(hwndName, FALSE); 4456 WinShowWindow(hwndDate, FALSE); 4449 4457 } 4450 4458 return MRFROMSHORT(sCount); … … 4459 4467 sCount += 6; 4460 4468 if (fSplitStatus) 4461 sCount++;4469 sCount++; 4462 4470 if (fToolbar) 4463 sCount++;4471 sCount++; 4464 4472 if (fUserComboBox) { 4465 sCount += 4;4466 if (fToolbar)4467 sCount++;4473 sCount += 4; 4474 if (fToolbar) 4475 sCount++; 4468 4476 } 4469 4477 if (fDrivebar) 4470 sCount++;4478 sCount++; 4471 4479 if (fAutoView) 4472 sCount++;4480 sCount++; 4473 4481 if (fMoreButtons) 4474 sCount += 3;4482 sCount += 3; 4475 4483 return MRFROMSHORT(sCount); 4476 4484 } … … 4493 4501 // DbgMsg(pszSrcFile, __LINE__, "IDM_CONTEXTMENU %x", hwnd); 4494 4502 if (hwnd != NULLHANDLE) { 4495 HWND hwndParent = WinQueryWindow(hwnd, QW_PARENT);4496 USHORT id = WinQueryWindowUShort(hwndParent, QWS_ID);4497 switch (id) {4498 case MAIN_SETUPLIST:4499 case MAIN_USERLIST:4500 case MAIN_CMDLIST:4501 // DbgMsg(pszSrcFile, __LINE__, "WM_CONTEXTMENU");4502 WinPostMsg(hwnd, WM_CONTEXTMENU, 0, 0);4503 }4503 HWND hwndParent = WinQueryWindow(hwnd, QW_PARENT); 4504 USHORT id = WinQueryWindowUShort(hwndParent, QWS_ID); 4505 switch (id) { 4506 case MAIN_SETUPLIST: 4507 case MAIN_USERLIST: 4508 case MAIN_CMDLIST: 4509 // DbgMsg(pszSrcFile, __LINE__, "WM_CONTEXTMENU"); 4510 WinPostMsg(hwnd, WM_CONTEXTMENU, 0, 0); 4511 } 4504 4512 } 4505 4513 } … … 4530 4538 wa.size = sizeof(wa); 4531 4539 pci = 4532 (PCNRITEM)4533 WinSendMsg(WinWindowFromID4534 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),4535 CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST),4536 MPFROMSHORT(CRA_CURSORED));4540 (PCNRITEM) 4541 WinSendMsg(WinWindowFromID 4542 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), 4543 CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST), 4544 MPFROMSHORT(CRA_CURSORED)); 4537 4545 if (pci && (INT) pci != -1) { 4538 strcpy(wa.szCurrentPath1, pci->pszFileName);4539 MakeValidDir(wa.szCurrentPath1);4546 strcpy(wa.szCurrentPath1, pci->pszFileName); 4547 MakeValidDir(wa.szCurrentPath1); 4540 4548 } 4541 4549 else 4542 save_dir2(wa.szCurrentPath1);4550 save_dir2(wa.szCurrentPath1); 4543 4551 TopWindowName(hwndMain, (HWND) 0, wa.szCurrentPath2); 4544 4552 if (!*wa.szCurrentPath2) 4545 strcpy(wa.szCurrentPath2, wa.szCurrentPath1);4553 strcpy(wa.szCurrentPath2, wa.szCurrentPath1); 4546 4554 MakeValidDir(wa.szCurrentPath2); 4547 4555 if (WinDlgBox(HWND_DESKTOP, 4548 hwnd,4549 WalkTwoCmpDlgProc,4550 FM3ModHandle,4551 WALK2_FRAME,4552 MPFROMP(&wa)) &&4553 !IsFile(wa.szCurrentPath1) && !IsFile(wa.szCurrentPath2)) {4554 if (!*dircompare) {4555 4556 COMPARE *cmp;4557 4558 cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);4559 if (cmp) {4560 cmp->size = sizeof(COMPARE);4561 strcpy(cmp->leftdir, wa.szCurrentPath1);4562 strcpy(cmp->rightdir, wa.szCurrentPath2);4563 cmp->hwndParent = hwnd;4564 cmp->dcd.hwndParent = hwnd;4565 WinDlgBox(HWND_DESKTOP,4566 HWND_DESKTOP,4567 CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp));4568 }4569 }4570 else {4571 4572 CHAR szPath1[CCHMAXPATH];4573 CHAR szPath2[CCHMAXPATH];4574 runemf2(SEPARATE,4575 HWND_DESKTOP, pszSrcFile, __LINE__,4576 NULL, NULL,4577 "%s %s %s",4578 dircompare,4579 BldQuotedFileName(szPath1, wa.szCurrentPath1),4580 BldQuotedFileName(szPath2, wa.szCurrentPath2));4581 }4556 hwnd, 4557 WalkTwoCmpDlgProc, 4558 FM3ModHandle, 4559 WALK2_FRAME, 4560 MPFROMP(&wa)) && 4561 !IsFile(wa.szCurrentPath1) && !IsFile(wa.szCurrentPath2)) { 4562 if (!*dircompare) { 4563 4564 COMPARE *cmp; 4565 4566 cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__); 4567 if (cmp) { 4568 cmp->size = sizeof(COMPARE); 4569 strcpy(cmp->leftdir, wa.szCurrentPath1); 4570 strcpy(cmp->rightdir, wa.szCurrentPath2); 4571 cmp->hwndParent = hwnd; 4572 cmp->dcd.hwndParent = hwnd; 4573 WinDlgBox(HWND_DESKTOP, 4574 HWND_DESKTOP, 4575 CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp)); 4576 } 4577 } 4578 else { 4579 4580 CHAR szPath1[CCHMAXPATH]; 4581 CHAR szPath2[CCHMAXPATH]; 4582 runemf2(SEPARATE, 4583 HWND_DESKTOP, pszSrcFile, __LINE__, 4584 NULL, NULL, 4585 "%s %s %s", 4586 dircompare, 4587 BldQuotedFileName(szPath1, wa.szCurrentPath1), 4588 BldQuotedFileName(szPath2, wa.szCurrentPath2)); 4589 } 4582 4590 } 4583 4591 } … … 4591 4599 case IDM_CLI: 4592 4600 if (fSplitStatus && 4593 hwndStatus2 &&4594 !WinIsWindow(WinQueryAnchorBlock(hwnd),4595 WinWindowFromID(hwndStatus2, COMMAND_LINE)))4601 hwndStatus2 && 4602 !WinIsWindow(WinQueryAnchorBlock(hwnd), 4603 WinWindowFromID(hwndStatus2, COMMAND_LINE))) 4596 4604 PostMsg(hwndStatus2, UM_CLICKED, MPVOID, MPVOID); 4597 4605 break; … … 4606 4614 bstrip(temp); 4607 4615 if (*temp && 4608 !DosQueryPathInfo(temp, FIL_QUERYFULLNAME, path, sizeof(path))) {4609 if (SHORT1FROMMP(mp1) == IDM_ADDTOUSERLIST) {4610 add_udir(TRUE, path);4611 if (fUdirsChanged)4612 save_udirs();4613 WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);4614 }4615 else {4616 if (!remove_udir(path))4617 Runtime_Error(pszSrcFile, __LINE__, "remove_udir");4618 else {4619 if (fUdirsChanged)4620 save_udirs();4621 WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);4622 }4623 }4616 !DosQueryPathInfo(temp, FIL_QUERYFULLNAME, path, sizeof(path))) { 4617 if (SHORT1FROMMP(mp1) == IDM_ADDTOUSERLIST) { 4618 add_udir(TRUE, path); 4619 if (fUdirsChanged) 4620 save_udirs(); 4621 WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID); 4622 } 4623 else { 4624 if (!remove_udir(path)) 4625 Runtime_Error(pszSrcFile, __LINE__, "remove_udir"); 4626 else { 4627 if (fUdirsChanged) 4628 save_udirs(); 4629 WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID); 4630 } 4631 } 4624 4632 } 4625 4633 } … … 4636 4644 // Complain if attempting to use reserved name 4637 4645 if (stricmp(szStateName, GetPString(IDS_STATETEXT)) == 0 || 4638 stricmp(szStateName, GetPString(IDS_FM2TEMPTEXT)) == 0)4646 stricmp(szStateName, GetPString(IDS_FM2TEMPTEXT)) == 0) 4639 4647 { 4640 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,4641 GetPString(IDS_WARNINGTEXT),4642 "\"%s\" is a reserved state name", szStateName);4648 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, 4649 GetPString(IDS_WARNINGTEXT), 4650 "\"%s\" is a reserved state name", szStateName); 4643 4651 } 4644 4652 // Ignore request if blank 4645 4653 else if (*szStateName) { 4646 BOOL fAbortOperation = FALSE;4647 if (!fNoSaveState && fSaveState && stricmp(szStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0)4648 {4649 if (saymsg(MB_YESNO | MB_DEFBUTTON2 | MB_ICONASTERISK, hwnd,4650 GetPString(IDS_WARNINGTEXT),4651 GetPString(IDS_SHUTDOWNSTATE_WARNING), szStateName) == MBID_NO)4652 fAbortOperation = TRUE;4653 }4654 if (!fAbortOperation) {4655 if (SHORT1FROMMP(mp1) == IDM_SAVEDIRCNRSTATE) {4656 // Save4657 INT nSaved = SaveDirCnrState(hwnd, szStateName);4658 if (nSaved >= 0) {4659 INT ret = add_setup(szStateName);4660 if (ret == 0) {4661 WinSendMsg(hwndStatelist, LM_INSERTITEM,4662 MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(szStateName));4663 save_setups();4664 }4665 else if (ret != 1) {4666 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,4667 GetPString(IDS_WARNINGTEXT),4668 "\"%s\" state name add failed", szStateName); // 15 Apr 07 SHL failed4669 WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));4670 }4671 }4672 else {4673 saymsg(MB_ENTER | MB_ICONASTERISK,4674 hwnd,4675 GetPString(IDS_WARNINGTEXT),4676 "State data save failed");4677 WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));4678 }4679 }4680 else {4681 // Delete4682 ULONG numsaves = 0, size, x;4683 CHAR s[STATE_NAME_MAX_BYTES + 80];4684 4685 INT ret = remove_setup(szStateName);4686 if (ret == 1)4687 save_setups();4688 sprintf(s, "%s.NumDirsLastTime", szStateName);4689 size = sizeof(ULONG);4690 if (!PrfQueryProfileData(fmprof,4691 FM3Str,4692 s,4693 (PVOID)&numsaves,4694 &size)) {4695 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,4696 GetPString(IDS_WARNINGTEXT),4697 GetPString(IDS_DOESNTEXISTTEXT), szStateName);4698 }4699 else if (!size)4700 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);4701 else {4702 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0L);4703 for (x = 0; x < numsaves; x++) {4704 sprintf(s, "%s.DirCnrPos.%lu", szStateName, x);4705 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4706 sprintf(s, "%s.DirCnrDir.%lu", szStateName, x);4707 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4708 sprintf(s, "%s.DirCnrSort.%lu", szStateName, x);4709 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4710 sprintf(s, "%s.DirCnrFilter.%lu", szStateName, x);4711 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4712 sprintf(s, "%s.DirCnrView.%lu", szStateName, x);4713 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4714 sprintf(s, "%s.DirCnr.%lu.DetailsLongname", szStateName, x);4715 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4716 sprintf(s, "%s.DirCnr.%lu.DetailsSubject", szStateName, x);4717 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4718 sprintf(s, "%s.DirCnr.%lu.DetailsSize", szStateName, x);4719 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4720 sprintf(s, "%s.DirCnr.%lu.DetailsEA", szStateName, x);4721 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4722 sprintf(s, "%s.DirCnr.%lu.DetailsAttr", szStateName, x);4723 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4724 sprintf(s, "%s.DirCnr.%lu.DetailsIcon", szStateName, x);4725 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4726 sprintf(s, "%s.DirCnr.%lu.DetailsLWDate", szStateName, x);4727 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4728 sprintf(s, "%s.DirCnr.%lu.DetailsLWTime", szStateName, x);4729 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4730 sprintf(s, "%s.DirCnr.%lu.DetailsLADate", szStateName, x);4731 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4732 sprintf(s, "%s.DirCnr.%lu.DetailsLATime", szStateName, x);4733 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4734 sprintf(s, "%s.DirCnr.%lu.DetailsCRDate", szStateName, x);4735 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4736 sprintf(s, "%s.DirCnr.%lu.DetailsCRTime", szStateName, x);4737 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4738 sprintf(s, "%s.DirCnr.%lu.Backgroundcolor", szStateName, x);4739 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4740 sprintf(s, "%s.DirCnr.%lu.Fontnamesize", szStateName, x);4741 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4742 }4743 sprintf(s, "%s.LastTreePos", szStateName);4744 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4745 sprintf(s, "%s.MySizeLastTime", szStateName);4746 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4747 }4748 PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);4749 }4750 }4654 BOOL fAbortOperation = FALSE; 4655 if (!fNoSaveState && fSaveState && stricmp(szStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0) 4656 { 4657 if (saymsg(MB_YESNO | MB_DEFBUTTON2 | MB_ICONASTERISK, hwnd, 4658 GetPString(IDS_WARNINGTEXT), 4659 GetPString(IDS_SHUTDOWNSTATE_WARNING), szStateName) == MBID_NO) 4660 fAbortOperation = TRUE; 4661 } 4662 if (!fAbortOperation) { 4663 if (SHORT1FROMMP(mp1) == IDM_SAVEDIRCNRSTATE) { 4664 // Save 4665 INT nSaved = SaveDirCnrState(hwnd, szStateName); 4666 if (nSaved >= 0) { 4667 INT ret = add_setup(szStateName); 4668 if (ret == 0) { 4669 WinSendMsg(hwndStatelist, LM_INSERTITEM, 4670 MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(szStateName)); 4671 save_setups(); 4672 } 4673 else if (ret != 1) { 4674 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, 4675 GetPString(IDS_WARNINGTEXT), 4676 "\"%s\" state name add failed", szStateName); // 15 Apr 07 SHL failed 4677 WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT)); 4678 } 4679 } 4680 else { 4681 saymsg(MB_ENTER | MB_ICONASTERISK, 4682 hwnd, 4683 GetPString(IDS_WARNINGTEXT), 4684 "State data save failed"); 4685 WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT)); 4686 } 4687 } 4688 else { 4689 // Delete 4690 ULONG numsaves = 0, size, x; 4691 CHAR s[STATE_NAME_MAX_BYTES + 80]; 4692 4693 INT ret = remove_setup(szStateName); 4694 if (ret == 1) 4695 save_setups(); 4696 sprintf(s, "%s.NumDirsLastTime", szStateName); 4697 size = sizeof(ULONG); 4698 if (!PrfQueryProfileData(fmprof, 4699 FM3Str, 4700 s, 4701 (PVOID)&numsaves, 4702 &size)) { 4703 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, 4704 GetPString(IDS_WARNINGTEXT), 4705 GetPString(IDS_DOESNTEXISTTEXT), szStateName); 4706 } 4707 else if (!size) 4708 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 4709 else { 4710 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0L); 4711 for (x = 0; x < numsaves; x++) { 4712 sprintf(s, "%s.DirCnrPos.%lu", szStateName, x); 4713 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4714 sprintf(s, "%s.DirCnrDir.%lu", szStateName, x); 4715 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4716 sprintf(s, "%s.DirCnrSort.%lu", szStateName, x); 4717 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4718 sprintf(s, "%s.DirCnrFilter.%lu", szStateName, x); 4719 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4720 sprintf(s, "%s.DirCnrView.%lu", szStateName, x); 4721 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4722 sprintf(s, "%s.DirCnr.%lu.DetailsLongname", szStateName, x); 4723 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4724 sprintf(s, "%s.DirCnr.%lu.DetailsSubject", szStateName, x); 4725 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4726 sprintf(s, "%s.DirCnr.%lu.DetailsSize", szStateName, x); 4727 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4728 sprintf(s, "%s.DirCnr.%lu.DetailsEA", szStateName, x); 4729 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4730 sprintf(s, "%s.DirCnr.%lu.DetailsAttr", szStateName, x); 4731 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4732 sprintf(s, "%s.DirCnr.%lu.DetailsIcon", szStateName, x); 4733 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4734 sprintf(s, "%s.DirCnr.%lu.DetailsLWDate", szStateName, x); 4735 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4736 sprintf(s, "%s.DirCnr.%lu.DetailsLWTime", szStateName, x); 4737 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4738 sprintf(s, "%s.DirCnr.%lu.DetailsLADate", szStateName, x); 4739 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4740 sprintf(s, "%s.DirCnr.%lu.DetailsLATime", szStateName, x); 4741 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4742 sprintf(s, "%s.DirCnr.%lu.DetailsCRDate", szStateName, x); 4743 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4744 sprintf(s, "%s.DirCnr.%lu.DetailsCRTime", szStateName, x); 4745 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4746 sprintf(s, "%s.DirCnr.%lu.Backgroundcolor", szStateName, x); 4747 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4748 sprintf(s, "%s.DirCnr.%lu.Fontnamesize", szStateName, x); 4749 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4750 } 4751 sprintf(s, "%s.LastTreePos", szStateName); 4752 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4753 sprintf(s, "%s.MySizeLastTime", szStateName); 4754 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4755 } 4756 PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID); 4757 } 4758 } 4751 4759 } 4752 4760 } … … 4761 4769 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp); 4762 4770 if (swp.fl & SWP_MAXIMIZE) { 4763 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_SYSCOMMAND,4764 MPFROM2SHORT(SC_RESTORE, 0), MPVOID);4765 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);4771 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_SYSCOMMAND, 4772 MPFROM2SHORT(SC_RESTORE, 0), MPVOID); 4773 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp); 4766 4774 } 4767 4775 WinGetMaxPosition(WinQueryWindow(hwnd, QW_PARENT), &swpD); … … 4771 4779 swpD.cy -= (icz + bsz); 4772 4780 if (swp.x == swpD.x && swp.y == swpD.y && 4773 swp.cx == swpD.cx && swp.cy == swpD.cy &&4774 // fixme to be #defined someday4775 WinQueryWindowUShort(hwnd, QWL_USER + 10) &&4776 WinQueryWindowUShort(hwnd, QWL_USER + 14)) {4777 swpD.x = WinQueryWindowUShort(hwnd, QWL_USER + 8);4778 swpD.cx = WinQueryWindowUShort(hwnd, QWL_USER + 10);4779 swpD.y = WinQueryWindowUShort(hwnd, QWL_USER + 12);4780 swpD.cy = WinQueryWindowUShort(hwnd, QWL_USER + 14);4781 swp.cx == swpD.cx && swp.cy == swpD.cy && 4782 // fixme to be #defined someday 4783 WinQueryWindowUShort(hwnd, QWL_USER + 10) && 4784 WinQueryWindowUShort(hwnd, QWL_USER + 14)) { 4785 swpD.x = WinQueryWindowUShort(hwnd, QWL_USER + 8); 4786 swpD.cx = WinQueryWindowUShort(hwnd, QWL_USER + 10); 4787 swpD.y = WinQueryWindowUShort(hwnd, QWL_USER + 12); 4788 swpD.cy = WinQueryWindowUShort(hwnd, QWL_USER + 14); 4781 4789 } 4782 4790 else { 4783 WinSetWindowUShort(hwnd, QWL_USER + 8, (USHORT) swp.x);4784 WinSetWindowUShort(hwnd, QWL_USER + 10, (USHORT) swp.cx);4785 WinSetWindowUShort(hwnd, QWL_USER + 12, (USHORT) swp.y);4786 WinSetWindowUShort(hwnd, QWL_USER + 14, (USHORT) swp.cy);4791 WinSetWindowUShort(hwnd, QWL_USER + 8, (USHORT) swp.x); 4792 WinSetWindowUShort(hwnd, QWL_USER + 10, (USHORT) swp.cx); 4793 WinSetWindowUShort(hwnd, QWL_USER + 12, (USHORT) swp.y); 4794 WinSetWindowUShort(hwnd, QWL_USER + 14, (USHORT) swp.cy); 4787 4795 } 4788 4796 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 4789 swpD.x, swpD.y, swpD.cx, swpD.cy, SWP_MOVE | SWP_SIZE);4797 swpD.x, swpD.y, swpD.cx, swpD.cy, SWP_MOVE | SWP_SIZE); 4790 4798 } 4791 4799 break; … … 4793 4801 case IDM_BLINK: 4794 4802 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0, 4795 SWP_MINIMIZE);4803 SWP_MINIMIZE); 4796 4804 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0, 4797 SWP_RESTORE | SWP_ZORDER);4805 SWP_RESTORE | SWP_ZORDER); 4798 4806 break; 4799 4807 … … 4803 4811 4804 4812 if (hwndTop) 4805 WinSetFocus(HWND_DESKTOP, hwndTop);4813 WinSetFocus(HWND_DESKTOP, hwndTop); 4806 4814 } 4807 4815 break; … … 4825 4833 case IDM_QUICKSETTINGS: 4826 4834 WinDlgBox(HWND_DESKTOP, 4827 hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMLONG(mp1));4835 hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMLONG(mp1)); 4828 4836 break; 4829 4837 … … 4831 4839 case IDM_VIEWINFS: 4832 4840 WinDlgBox(HWND_DESKTOP, 4833 HWND_DESKTOP,4834 ViewInfProc,4835 FM3ModHandle,4836 VINF_FRAME,4837 ((SHORT1FROMMP(mp1) == IDM_VIEWHELPS) ?4838 MPFROMP(NullStr) : MPVOID));4841 HWND_DESKTOP, 4842 ViewInfProc, 4843 FM3ModHandle, 4844 VINF_FRAME, 4845 ((SHORT1FROMMP(mp1) == IDM_VIEWHELPS) ? 4846 MPFROMP(NullStr) : MPVOID)); 4839 4847 break; 4840 4848 … … 4846 4854 TopWindowName(hwnd, (HWND) 0, newpath); 4847 4855 if (WinDlgBox(HWND_DESKTOP, 4848 hwnd,4849 WalkAllDlgProc,4850 FM3ModHandle, WALK_FRAME, MPFROMP(newpath)) && *newpath)4851 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, newpath);4856 hwnd, 4857 WalkAllDlgProc, 4858 FM3ModHandle, WALK_FRAME, MPFROMP(newpath)) && *newpath) 4859 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, newpath); 4852 4860 } 4853 4861 break; … … 4870 4878 if (SHORT1FROMMP(mp2) == CMDSRC_MENU) { 4871 4879 4872 RECTL rcl;4873 ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2L;4874 4875 WinQueryWindowRect(HWND_DESKTOP, &rcl);4876 rcl.yBottom += icz;4877 rcl.yTop -= icz;4878 rcl.xLeft += icz;4879 rcl.xRight -= icz;4880 WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID);4880 RECTL rcl; 4881 ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2L; 4882 4883 WinQueryWindowRect(HWND_DESKTOP, &rcl); 4884 rcl.yBottom += icz; 4885 rcl.yTop -= icz; 4886 rcl.xLeft += icz; 4887 rcl.xRight -= icz; 4888 WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID); 4881 4889 } 4882 4890 else { 4883 4891 4884 RECTL rcl;4885 4886 WinQueryWindowRect(HWND_DESKTOP, &rcl);4887 rcl.yBottom += 8;4888 rcl.yTop = (rcl.yTop / 2) + (rcl.yTop / 7);4889 rcl.xLeft = (rcl.xRight / 2) - (rcl.xRight / 7);4890 rcl.xRight -= 8;4891 WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID);4892 RECTL rcl; 4893 4894 WinQueryWindowRect(HWND_DESKTOP, &rcl); 4895 rcl.yBottom += 8; 4896 rcl.yTop = (rcl.yTop / 2) + (rcl.yTop / 7); 4897 rcl.xLeft = (rcl.xRight / 2) - (rcl.xRight / 7); 4898 rcl.xRight -= 8; 4899 WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID); 4892 4900 } 4893 4901 switch (SHORT1FROMMP(mp1)) { 4894 4902 case IDM_HELPCONTEXT: 4895 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,4896 MPFROM2SHORT(HELP_CONTEXT, 0), MPFROMSHORT(HM_RESOURCEID));4897 break;4903 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4904 MPFROM2SHORT(HELP_CONTEXT, 0), MPFROMSHORT(HM_RESOURCEID)); 4905 break; 4898 4906 4899 4907 case IDM_HELPMOUSE: 4900 if (hwndHelp)4901 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,4902 MPFROM2SHORT(HELP_MOUSE, 0), MPFROMSHORT(HM_RESOURCEID));4903 break;4908 if (hwndHelp) 4909 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4910 MPFROM2SHORT(HELP_MOUSE, 0), MPFROMSHORT(HM_RESOURCEID)); 4911 break; 4904 4912 4905 4913 case IDM_HELPPIX: 4906 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,4907 MPFROM2SHORT(HELP_BITMAP1, 0), MPFROMSHORT(HM_RESOURCEID));4908 break;4914 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4915 MPFROM2SHORT(HELP_BITMAP1, 0), MPFROMSHORT(HM_RESOURCEID)); 4916 break; 4909 4917 4910 4918 case IDM_HELPTUTOR: 4911 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,4912 MPFROM2SHORT(HELP_TUTORIAL, 0),4913 MPFROMSHORT(HM_RESOURCEID));4914 break;4919 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4920 MPFROM2SHORT(HELP_TUTORIAL, 0), 4921 MPFROMSHORT(HM_RESOURCEID)); 4922 break; 4915 4923 4916 4924 case IDM_HELPHINTS: 4917 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,4918 MPFROM2SHORT(HELP_HINTS, 0), MPFROMSHORT(HM_RESOURCEID));4919 break;4925 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4926 MPFROM2SHORT(HELP_HINTS, 0), MPFROMSHORT(HM_RESOURCEID)); 4927 break; 4920 4928 4921 4929 case IDM_HELPGENERAL: 4922 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,4923 MPFROM2SHORT(HELP_MAIN, 0), MPFROMSHORT(HM_RESOURCEID));4924 break;4930 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4931 MPFROM2SHORT(HELP_MAIN, 0), MPFROMSHORT(HM_RESOURCEID)); 4932 break; 4925 4933 case IDM_HELPKEYS: 4926 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,4927 MPFROM2SHORT(HELP_KEYS, 0), MPFROMSHORT(HM_RESOURCEID));4928 break;4934 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4935 MPFROM2SHORT(HELP_KEYS, 0), MPFROMSHORT(HM_RESOURCEID)); 4936 break; 4929 4937 4930 4938 case IDM_HELP: 4931 4939 case IDM_HELPCONTENTS: 4932 WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID);4933 break;4940 WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID); 4941 break; 4934 4942 4935 4943 case IDM_HELPUSERLIST: 4936 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,4937 MPFROM2SHORT(HELP_USERLISTS, 0),4938 MPFROMSHORT(HM_RESOURCEID));4939 break;4944 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4945 MPFROM2SHORT(HELP_USERLISTS, 0), 4946 MPFROMSHORT(HM_RESOURCEID)); 4947 break; 4940 4948 } 4941 4949 } … … 4948 4956 case IDM_ABOUT: 4949 4957 WinDlgBox(HWND_DESKTOP, hwnd, AboutDlgProc, FM3ModHandle, 4950 ABT_FRAME, MPVOID);4958 ABT_FRAME, MPVOID); 4951 4959 break; 4952 4960 … … 4962 4970 4963 4971 if (!DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_MINOR, 4964 (PVOID) & version, (ULONG) sizeof(version))) {4965 if (version[0] > 20L || (version[0] == 20L && version[1] > 29L)) {4966 if (SHORT1FROMMP(mp1) == IDM_HICOLORPALETTE)4967 palette = "<WP_HIRESCLRPAL>";4968 else4969 palette = "<WP_LORESCLRPAL>";4970 }4972 (PVOID) & version, (ULONG) sizeof(version))) { 4973 if (version[0] > 20L || (version[0] == 20L && version[1] > 29L)) { 4974 if (SHORT1FROMMP(mp1) == IDM_HICOLORPALETTE) 4975 palette = "<WP_HIRESCLRPAL>"; 4976 else 4977 palette = "<WP_LORESCLRPAL>"; 4978 } 4971 4979 } 4972 4980 OpenObject(palette, Default, hwnd); … … 4984 4992 hWPSObject = WinQueryObject("<WP_SCHPAL>"); 4985 4993 if (hWPSObject != NULLHANDLE) 4986 WinSetObjectData(hWPSObject, "SCHEMES=Winter:PM_Winter,"4987 "Spring:PM_Spring,Summer:PM_Summer,"4988 "System:PM_System,Windows:PM_Windows;"4989 "OPEN=DEFAULT");4994 WinSetObjectData(hWPSObject, "SCHEMES=Winter:PM_Winter," 4995 "Spring:PM_Spring,Summer:PM_Summer," 4996 "System:PM_System,Windows:PM_Windows;" 4997 "OPEN=DEFAULT"); 4990 4998 } 4991 4999 break; … … 4998 5006 case IDM_SYSINFO: 4999 5007 WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, SysInfoDlgProc, FM3ModHandle, 5000 SYS_FRAME, NULL);5008 SYS_FRAME, NULL); 5001 5009 break; 5002 5010 #endif … … 5008 5016 5009 5017 if (hwndTree) 5010 pci = (PCNRITEM) WinSendMsg(hwndTree, CM_QUERYRECORDEMPHASIS,5011 MPFROMLONG(CMA_FIRST),5012 MPFROMSHORT(CRA_CURSORED));5018 pci = (PCNRITEM) WinSendMsg(hwndTree, CM_QUERYRECORDEMPHASIS, 5019 MPFROMLONG(CMA_FIRST), 5020 MPFROMSHORT(CRA_CURSORED)); 5013 5021 if (pci && (INT) pci != -1) { 5014 strcpy(path, pci->pszFileName);5015 MakeValidDir(path);5022 strcpy(path, pci->pszFileName); 5023 MakeValidDir(path); 5016 5024 } 5017 5025 else 5018 save_dir2(path);5026 save_dir2(path); 5019 5027 WinDlgBox(HWND_DESKTOP, hwnd, InstantDlgProc, FM3ModHandle, 5020 BAT_FRAME, MPFROMP(path));5028 BAT_FRAME, MPFROMP(path)); 5021 5029 } 5022 5030 break; … … 5032 5040 TopWindowName(hwnd, (HWND) 0, path); 5033 5041 if (SHORT1FROMMP(mp1) == IDM_DOSCOMMANDLINE) 5034 env = GetCmdSpec(TRUE);5042 env = GetCmdSpec(TRUE); 5035 5043 else if (SHORT1FROMMP(mp1) != IDM_COMMANDLINE) { 5036 env = "WINOS2.COM";5037 type = SEPARATE | FULLSCREEN;5044 env = "WINOS2.COM"; 5045 type = SEPARATE | FULLSCREEN; 5038 5046 } 5039 5047 runemf2(type, hwnd, pszSrcFile, __LINE__, 5040 path, NULL, "%s", env);5048 path, NULL, "%s", env); 5041 5049 } 5042 5050 break; … … 5044 5052 case IDM_KILLPROC: 5045 5053 WinDlgBox(HWND_DESKTOP, hwnd, KillDlgProc, FM3ModHandle, 5046 KILL_FRAME, NULL);5054 KILL_FRAME, NULL); 5047 5055 break; 5048 5056 … … 5059 5067 case IDM_AUTOVIEW: 5060 5068 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 5061 &fAutoView, TRUE, "AutoView");5069 &fAutoView, TRUE, "AutoView"); 5062 5070 AutoChange: 5063 5071 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 5064 MPFROMLONG(FCF_SIZEBORDER), MPVOID);5072 MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5065 5073 if (fAutoView) { 5066 5074 … … 5071 5079 hwndDir = TopWindowName(hwnd, (HWND) 0, s); 5072 5080 if (hwndDir) { 5073 hwndDir = WinWindowFromID(hwndDir, FID_CLIENT);5074 if (hwndDir) {5075 hwndDir = WinWindowFromID(hwndDir, DIR_CNR);5076 if (hwndDir) {5077 pci = (PCNRITEM) WinSendMsg(hwndDir, CM_QUERYRECORDEMPHASIS,5078 MPFROMLONG(CMA_FIRST),5079 MPFROMSHORT(CRA_CURSORED));5080 if (pci && (INT) pci != -1 &&5081 (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)))5082 WinSendMsg(hwnd,5083 UM_LOADFILE,5084 MPFROMP(pci->pszFileName),5085 (SHORT1FROMMP(mp1) == IDM_AUTOVIEW) ?5086 MPVOID : MPFROMLONG(1));5087 }5088 }5081 hwndDir = WinWindowFromID(hwndDir, FID_CLIENT); 5082 if (hwndDir) { 5083 hwndDir = WinWindowFromID(hwndDir, DIR_CNR); 5084 if (hwndDir) { 5085 pci = (PCNRITEM) WinSendMsg(hwndDir, CM_QUERYRECORDEMPHASIS, 5086 MPFROMLONG(CMA_FIRST), 5087 MPFROMSHORT(CRA_CURSORED)); 5088 if (pci && (INT) pci != -1 && 5089 (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW))) 5090 WinSendMsg(hwnd, 5091 UM_LOADFILE, 5092 MPFROMP(pci->pszFileName), 5093 (SHORT1FROMMP(mp1) == IDM_AUTOVIEW) ? 5094 MPVOID : MPFROMLONG(1)); 5095 } 5096 } 5089 5097 } 5090 5098 } … … 5093 5101 case IDM_TEXTTOOLS: 5094 5102 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 5095 &fTextTools, TRUE, "TextTools");5103 &fTextTools, TRUE, "TextTools"); 5096 5104 BuildTools(hwndToolback, TRUE); 5097 5105 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 5098 MPFROMLONG(FCF_SIZEBORDER), MPVOID);5106 MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5099 5107 break; 5100 5108 5101 5109 case IDM_TOOLTITLES: 5102 5110 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 5103 &fToolTitles, TRUE, "ToolTitles");5111 &fToolTitles, TRUE, "ToolTitles"); 5104 5112 BuildTools(hwndToolback, TRUE); 5105 5113 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 5106 MPFROMLONG(FCF_SIZEBORDER), MPVOID);5114 MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5107 5115 break; 5108 5116 … … 5112 5120 MenuInvisible = MenuInvisible ? FALSE : TRUE; 5113 5121 if (MenuInvisible) { 5114 WinSetParent(hwndMenu, HWND_OBJECT, FALSE);5115 WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),5116 FID_SYSMENU), IDM_HIDEMENU,5117 GetPString(IDS_UNHIDEMENUTEXT));5122 WinSetParent(hwndMenu, HWND_OBJECT, FALSE); 5123 WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5124 FID_SYSMENU), IDM_HIDEMENU, 5125 GetPString(IDS_UNHIDEMENUTEXT)); 5118 5126 } 5119 5127 else { 5120 WinSetParent(hwndMenu, WinQueryWindow(hwnd, QW_PARENT), FALSE);5121 WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),5122 FID_SYSMENU), IDM_HIDEMENU,5123 GetPString(IDS_HIDEMENUTEXT));5128 WinSetParent(hwndMenu, WinQueryWindow(hwnd, QW_PARENT), FALSE); 5129 WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5130 FID_SYSMENU), IDM_HIDEMENU, 5131 GetPString(IDS_HIDEMENUTEXT)); 5124 5132 } 5125 5133 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 5126 MPFROMLONG(FCF_MENU), MPVOID);5134 MPFROMLONG(FCF_MENU), MPVOID); 5127 5135 PrfWriteProfileData(fmprof, FM3Str, "MenuInvisible", 5128 &MenuInvisible, sizeof(BOOL));5136 &MenuInvisible, sizeof(BOOL)); 5129 5137 } 5130 5138 break; … … 5139 5147 5140 5148 if (Collector) 5141 already = TRUE;5149 already = TRUE; 5142 5150 if (!already && !fAutoTile && !fExternalCollector) 5143 GetNextWindowPos(hwnd, &swp, NULL, NULL);5151 GetNextWindowPos(hwnd, &swp, NULL, NULL); 5144 5152 hwndC = StartCollector(fExternalCollector ? HWND_DESKTOP : hwnd, 4); 5145 5153 if (hwndC) { 5146 if (!already && !fAutoTile && !fExternalCollector)5147 WinSetWindowPos(hwndC, HWND_TOP,5148 swp.x, swp.y, swp.cx, swp.cy,5149 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);5150 else if (fAutoTile && !already)5151 TileChildren(hwnd, TRUE);5152 WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE |5153 SWP_ACTIVATE);5154 if (SHORT1FROMMP(mp1) == IDM_GREP)5155 PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND,5156 MPFROM2SHORT(IDM_GREP, 0), MPVOID);5157 if (SHORT1FROMMP(mp1) == IDM_SEEALL)5158 PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND,5159 MPFROM2SHORT(IDM_SEEALL, 0), MPVOID);5154 if (!already && !fAutoTile && !fExternalCollector) 5155 WinSetWindowPos(hwndC, HWND_TOP, 5156 swp.x, swp.y, swp.cx, swp.cy, 5157 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER); 5158 else if (fAutoTile && !already) 5159 TileChildren(hwnd, TRUE); 5160 WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE | 5161 SWP_ACTIVATE); 5162 if (SHORT1FROMMP(mp1) == IDM_GREP) 5163 PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND, 5164 MPFROM2SHORT(IDM_GREP, 0), MPVOID); 5165 if (SHORT1FROMMP(mp1) == IDM_SEEALL) 5166 PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND, 5167 MPFROM2SHORT(IDM_SEEALL, 0), MPVOID); 5160 5168 } 5161 5169 } … … 5168 5176 5169 5177 if (!toolhead || !toolhead->next) { 5170 firsttool = (toolhead) ? toolhead->id : 0;5171 break;5178 firsttool = (toolhead) ? toolhead->id : 0; 5179 break; 5172 5180 } 5173 5181 tool = find_tool(firsttool); 5174 5182 if (!tool) 5175 tool = toolhead;5183 tool = toolhead; 5176 5184 if (SHORT1FROMMP(mp1) == IDM_TOOLRIGHT) { 5177 tool = prev_tool(tool, TRUE);5178 firsttool = tool->id;5185 tool = prev_tool(tool, TRUE); 5186 firsttool = tool->id; 5179 5187 } 5180 5188 else { 5181 tool = next_tool(tool, TRUE);5182 firsttool = tool->id;5189 tool = next_tool(tool, TRUE); 5190 firsttool = tool->id; 5183 5191 } 5184 5192 ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5185 MAIN_TOOLS));5193 MAIN_TOOLS)); 5186 5194 } 5187 5195 break; … … 5193 5201 case IDM_TOOLBAR: 5194 5202 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5195 IDM_TOOLSUBMENU, &fToolbar, TRUE, "Toolbar");5203 IDM_TOOLSUBMENU, &fToolbar, TRUE, "Toolbar"); 5196 5204 BuildTools(hwndToolback, TRUE); 5197 5205 WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5198 MAIN_TOOLS), fToolbar);5206 MAIN_TOOLS), fToolbar); 5199 5207 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), 5200 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);5208 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5201 5209 if (fDrivebar) 5202 5210 WinInvalidateRect(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5203 MAIN_DRIVES), NULL, TRUE);5211 MAIN_DRIVES), NULL, TRUE); 5204 5212 break; 5205 5213 5206 5214 case IDM_DRIVEBAR: 5207 5215 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5208 IDM_DRIVEBAR, &fDrivebar, TRUE, "Drivebar");5216 IDM_DRIVEBAR, &fDrivebar, TRUE, "Drivebar"); 5209 5217 WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5210 MAIN_DRIVES), fDrivebar);5218 MAIN_DRIVES), fDrivebar); 5211 5219 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 5212 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);5220 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5213 5221 PostMsg(hwnd, UM_BUILDDRIVEBAR, MPVOID, MPVOID); 5214 5222 break; … … 5216 5224 case IDM_USERLIST: 5217 5225 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5218 SHORT1FROMMP(mp1), &fUserComboBox, TRUE, "UserComboBox");5226 SHORT1FROMMP(mp1), &fUserComboBox, TRUE, "UserComboBox"); 5219 5227 WinShowWindow(hwndUserlist, fUserComboBox); 5220 5228 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 5221 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);5229 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5222 5230 PostMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID); 5223 5231 PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID); … … 5231 5239 WinSetWindowText(hwndAttr, NullStr); 5232 5240 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5233 SHORT1FROMMP(mp1), &fMoreButtons, TRUE, "MoreButtons");5241 SHORT1FROMMP(mp1), &fMoreButtons, TRUE, "MoreButtons"); 5234 5242 if (fMoreButtons) { 5235 5243 … … 5239 5247 5240 5248 if (hwndTemp) { 5241 WinSetFocus(HWND_DESKTOP, hwnd);5242 WinSetFocus(HWND_DESKTOP, hwndTemp);5249 WinSetFocus(HWND_DESKTOP, hwnd); 5250 WinSetFocus(HWND_DESKTOP, hwndTemp); 5243 5251 } 5244 5252 } 5245 5253 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 5246 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);5254 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5247 5255 break; 5248 5256 5249 5257 case IDM_TOGGLEDRAGDIALOG: 5250 5258 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5251 IDM_TOGGLEDRAGDIALOG,5252 &fDragndropDlg,5253 TRUE,5254 "Drag&DropDlg");5259 IDM_TOGGLEDRAGDIALOG, 5260 &fDragndropDlg, 5261 TRUE, 5262 "Drag&DropDlg"); 5255 5263 break; 5256 5264 5257 5265 case IDM_SYNCUPDATES: 5258 5266 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5259 IDM_SYNCUPDATES,5260 &fSyncUpdates,5261 TRUE,5262 "SyncUpdates");5267 IDM_SYNCUPDATES, 5268 &fSyncUpdates, 5269 TRUE, 5270 "SyncUpdates"); 5263 5271 break; 5264 5272 … … 5270 5278 WinQueryWindowPos(hwnd, &swp); 5271 5279 WinSetWindowPos(hwndTree, HWND_TOP, 0, swp.cy - swpT.cy, 0, 0, 5272 SWP_MOVE);5280 SWP_MOVE); 5273 5281 } 5274 5282 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 5275 &fFreeTree, TRUE, "FreeTree");5283 &fFreeTree, TRUE, "FreeTree"); 5276 5284 if (fAutoTile) 5277 5285 TileChildren(hwnd, TRUE); … … 5280 5288 case IDM_AUTOTILE: 5281 5289 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5282 SHORT1FROMMP(mp1), &fAutoTile, TRUE, "AutoTile");5290 SHORT1FROMMP(mp1), &fAutoTile, TRUE, "AutoTile"); 5283 5291 if (fAutoTile) 5284 5292 TileChildren(hwnd, TRUE); … … 5287 5295 case IDM_TILEBACKWARDS: 5288 5296 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5289 SHORT1FROMMP(mp1), &fTileBackwards, TRUE, "TileBackwards");5297 SHORT1FROMMP(mp1), &fTileBackwards, TRUE, "TileBackwards"); 5290 5298 if (fAutoTile) 5291 5299 TileChildren(hwnd, TRUE); … … 5332 5340 default: 5333 5341 if (!SwitchCommand((HWND) WinQueryWindowULong(hwnd, QWL_USER), 5334 SHORT1FROMMP(mp1))) {5342 SHORT1FROMMP(mp1))) { 5335 5343 if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART && 5336 SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {5337 5338 INT x;5339 HWND hwndCnr;5340 5341 if (!cmdloaded)5342 load_commands();5343 hwndCnr = TopWindow(hwnd, (HWND) 0);5344 hwndCnr = (HWND) WinSendMsg(WinWindowFromID(hwndCnr, FID_CLIENT),5345 UM_CONTAINERHWND, MPVOID, MPVOID);5346 if (!hwndCnr) {5347 Runtime_Error2(pszSrcFile, __LINE__, IDS_NOWINDOWTEXT);5348 break;5349 }5350 x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;5351 if (x >= 0) {5352 x++;5353 RunCommand(hwndCnr, x);5354 if (fUnHilite) {5355 5356 PCNRITEM pci;5357 DIRCNRDATA *dcd = NULL;5358 5359 // 12 May 07 SHL fixme to understand? backwards maybe? looking for DIR_CNR?5360 if (WinQueryWindowUShort(hwndCnr, QWS_ID) != TREE_CNR)5361 dcd = INSTDATA(hwndCnr);5362 pci = (PCNRITEM) WinSendMsg(hwndCnr,5363 CM_QUERYRECORDEMPHASIS,5364 MPFROMLONG(CMA_FIRST),5365 MPFROMSHORT(CRA_CURSORED));5366 if (pci && (INT) pci != -1 &&5367 (pci->rc.flRecordAttr & CRA_SELECTED))5368 {5369 UnHilite(hwnd,5370 TRUE,5371 dcd ? &dcd->lastselection : NULL,5372 dcd ? dcd ->ulItemsToUnHilite : 0);5373 }5374 }5375 }5344 SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) { 5345 5346 INT x; 5347 HWND hwndCnr; 5348 5349 if (!cmdloaded) 5350 load_commands(); 5351 hwndCnr = TopWindow(hwnd, (HWND) 0); 5352 hwndCnr = (HWND) WinSendMsg(WinWindowFromID(hwndCnr, FID_CLIENT), 5353 UM_CONTAINERHWND, MPVOID, MPVOID); 5354 if (!hwndCnr) { 5355 Runtime_Error2(pszSrcFile, __LINE__, IDS_NOWINDOWTEXT); 5356 break; 5357 } 5358 x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART; 5359 if (x >= 0) { 5360 x++; 5361 RunCommand(hwndCnr, x); 5362 if (fUnHilite) { 5363 5364 PCNRITEM pci; 5365 DIRCNRDATA *dcd = NULL; 5366 5367 // 12 May 07 SHL fixme to understand? backwards maybe? looking for DIR_CNR? 5368 if (WinQueryWindowUShort(hwndCnr, QWS_ID) != TREE_CNR) 5369 dcd = INSTDATA(hwndCnr); 5370 pci = (PCNRITEM) WinSendMsg(hwndCnr, 5371 CM_QUERYRECORDEMPHASIS, 5372 MPFROMLONG(CMA_FIRST), 5373 MPFROMSHORT(CRA_CURSORED)); 5374 if (pci && (INT) pci != -1 && 5375 (pci->rc.flRecordAttr & CRA_SELECTED)) 5376 { 5377 UnHilite(hwnd, 5378 TRUE, 5379 dcd ? &dcd->lastselection : NULL, 5380 dcd ? dcd ->ulItemsToUnHilite : 0); 5381 } 5382 } 5383 } 5376 5384 } 5377 5385 else if (SHORT1FROMMP(mp1) >= IDM_QUICKTOOLSTART && 5378 SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART + 50) {5379 if (!qtloaded)5380 load_quicktools();5381 if (quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]) {5382 if (fToolsChanged)5383 save_tools(NULL);5384 if (!load_tools(quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]))5385 load_tools(NULL);5386 else {5387 strcpy(lasttoolbox,5388 quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]);5389 PrfWriteProfileString(fmprof, FM3Str, "LastToolBox", lasttoolbox);5390 }5391 BuildTools(hwndToolback, TRUE);5392 }5386 SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART + 50) { 5387 if (!qtloaded) 5388 load_quicktools(); 5389 if (quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]) { 5390 if (fToolsChanged) 5391 save_tools(NULL); 5392 if (!load_tools(quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART])) 5393 load_tools(NULL); 5394 else { 5395 strcpy(lasttoolbox, 5396 quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]); 5397 PrfWriteProfileString(fmprof, FM3Str, "LastToolBox", lasttoolbox); 5398 } 5399 BuildTools(hwndToolback, TRUE); 5400 } 5393 5401 } 5394 5402 else { 5395 5403 5396 HWND hwndActive;5397 5398 hwndActive = TopWindow(hwnd, (HWND) 0);5399 if (hwndActive)5400 PostMsg(WinWindowFromID(hwndActive, FID_CLIENT),5401 WM_COMMAND, mp1, mp2);5404 HWND hwndActive; 5405 5406 hwndActive = TopWindow(hwnd, (HWND) 0); 5407 if (hwndActive) 5408 PostMsg(WinWindowFromID(hwndActive, FID_CLIENT), 5409 WM_COMMAND, mp1, mp2); 5402 5410 } 5403 5411 } … … 5408 5416 5409 5417 static MRESULT EXPENTRY MainWMOnce(HWND hwnd, ULONG msg, MPARAM mp1, 5410 MPARAM mp2)5418 MPARAM mp2) 5411 5419 { 5412 5420 TID tid; … … 5431 5439 if (_beginthread(MakeMainObjWin, NULL, 245760, MPVOID) == -1) { 5432 5440 Runtime_Error(pszSrcFile, __LINE__, 5433 GetPString(IDS_COULDNTSTARTTHREADTEXT));5441 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 5434 5442 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID); 5435 5443 return 0; … … 5450 5458 5451 5459 if (!WinCreateWindow(hwndFrame, 5452 WC_BUTTON,5453 "I",5454 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS,5455 ((swp.cx -5456 WinQuerySysValue(HWND_DESKTOP,5457 SV_CXMINMAXBUTTON)) -5458 WinQuerySysValue(HWND_DESKTOP,5459 SV_CXMINMAXBUTTON) / 2) -5460 WinQuerySysValue(HWND_DESKTOP,5461 SV_CXSIZEBORDER),5462 (swp.cy - WinQuerySysValue(HWND_DESKTOP,5463 SV_CYMINMAXBUTTON)) -5464 WinQuerySysValue(HWND_DESKTOP,5465 SV_CYSIZEBORDER),5466 WinQuerySysValue(HWND_DESKTOP,5467 SV_CXMINMAXBUTTON) / 2,5468 WinQuerySysValue(HWND_DESKTOP,5469 SV_CYMINMAXBUTTON),5470 hwnd, HWND_TOP, IDM_IDEALSIZE, NULL, NULL)) {5460 WC_BUTTON, 5461 "I", 5462 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, 5463 ((swp.cx - 5464 WinQuerySysValue(HWND_DESKTOP, 5465 SV_CXMINMAXBUTTON)) - 5466 WinQuerySysValue(HWND_DESKTOP, 5467 SV_CXMINMAXBUTTON) / 2) - 5468 WinQuerySysValue(HWND_DESKTOP, 5469 SV_CXSIZEBORDER), 5470 (swp.cy - WinQuerySysValue(HWND_DESKTOP, 5471 SV_CYMINMAXBUTTON)) - 5472 WinQuerySysValue(HWND_DESKTOP, 5473 SV_CYSIZEBORDER), 5474 WinQuerySysValue(HWND_DESKTOP, 5475 SV_CXMINMAXBUTTON) / 2, 5476 WinQuerySysValue(HWND_DESKTOP, 5477 SV_CYMINMAXBUTTON), 5478 hwnd, HWND_TOP, IDM_IDEALSIZE, NULL, NULL)) { 5471 5479 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5472 5480 } 5473 5481 else { 5474 5482 WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_IDEALSIZE), 5475 IdealButtonProc);5483 IdealButtonProc); 5476 5484 SetPresParams(WinWindowFromID(hwndFrame, 5477 IDM_IDEALSIZE),5478 NULL, NULL, NULL, GetPString(IDS_10SYSTEMVIOTEXT));5485 IDM_IDEALSIZE), 5486 NULL, NULL, NULL, GetPString(IDS_10SYSTEMVIOTEXT)); 5479 5487 } 5480 5488 5481 5489 hwndTmp = WinCreateWindow(hwndFrame, 5482 WC_BUTTON,5483 "#1019",5484 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS |5485 BS_BITMAP,5486 swp.cx - 46,5487 swp.y + 2,5488 24,5489 22, hwnd, HWND_TOP, IDM_OPENWALK, NULL, NULL);5490 WC_BUTTON, 5491 "#1019", 5492 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS | 5493 BS_BITMAP, 5494 swp.cx - 46, 5495 swp.y + 2, 5496 24, 5497 22, hwnd, HWND_TOP, IDM_OPENWALK, NULL, NULL); 5490 5498 if (!hwndTmp) 5491 5499 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5492 5500 5493 5501 hwndTmp = WinCreateWindow(hwndFrame, 5494 WC_BUTTON,5495 "#3062",5496 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS |5497 BS_BITMAP,5498 swp.cx - 22,5499 swp.y + 2,5500 24,5501 22, hwnd, HWND_TOP, IDM_USERLIST, NULL, NULL);5502 WC_BUTTON, 5503 "#3062", 5504 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS | 5505 BS_BITMAP, 5506 swp.cx - 22, 5507 swp.y + 2, 5508 24, 5509 22, hwnd, HWND_TOP, IDM_USERLIST, NULL, NULL); 5502 5510 if (!hwndTmp) 5503 5511 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5504 5512 5505 5513 hwndUserlist = WinCreateWindow(hwndFrame, 5506 WC_COMBOBOX,5507 (PSZ) NULL,5508 WS_VISIBLE | CBS_DROPDOWN |5509 LS_HORZSCROLL,5510 (swp.x +5511 WinQuerySysValue(HWND_DESKTOP,5512 SV_CXSIZEBORDER) + 48L),5513 (swp.cy -5514 WinQuerySysValue(HWND_DESKTOP,5515 SV_CYSIZEBORDER)) - 60,5516 ((swp.cx -5517 (WinQuerySysValue(HWND_DESKTOP,5518 SV_CXSIZEBORDER) *5519 2)) - 64L), 60L, hwndFrame, HWND_TOP,5520 MAIN_USERLIST, NULL, NULL);5514 WC_COMBOBOX, 5515 (PSZ) NULL, 5516 WS_VISIBLE | CBS_DROPDOWN | 5517 LS_HORZSCROLL, 5518 (swp.x + 5519 WinQuerySysValue(HWND_DESKTOP, 5520 SV_CXSIZEBORDER) + 48L), 5521 (swp.cy - 5522 WinQuerySysValue(HWND_DESKTOP, 5523 SV_CYSIZEBORDER)) - 60, 5524 ((swp.cx - 5525 (WinQuerySysValue(HWND_DESKTOP, 5526 SV_CXSIZEBORDER) * 5527 2)) - 64L), 60L, hwndFrame, HWND_TOP, 5528 MAIN_USERLIST, NULL, NULL); 5521 5529 if (!hwndUserlist) 5522 5530 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5523 5531 hwndCmdlist = WinCreateWindow(hwndFrame, 5524 WC_COMBOBOX,5525 (PSZ) NULL,5526 WS_VISIBLE | CBS_DROPDOWN |5527 LS_HORZSCROLL,5528 (swp.x +5529 WinQuerySysValue(HWND_DESKTOP,5530 SV_CXSIZEBORDER) + 48L),5531 (swp.cy -5532 WinQuerySysValue(HWND_DESKTOP,5533 SV_CYSIZEBORDER)) - 60,5534 ((swp.cx -5535 (WinQuerySysValue(HWND_DESKTOP,5536 SV_CXSIZEBORDER) * 2)) -5537 64L), 60L, hwndFrame, HWND_TOP,5538 MAIN_CMDLIST, NULL, NULL);5532 WC_COMBOBOX, 5533 (PSZ) NULL, 5534 WS_VISIBLE | CBS_DROPDOWN | 5535 LS_HORZSCROLL, 5536 (swp.x + 5537 WinQuerySysValue(HWND_DESKTOP, 5538 SV_CXSIZEBORDER) + 48L), 5539 (swp.cy - 5540 WinQuerySysValue(HWND_DESKTOP, 5541 SV_CYSIZEBORDER)) - 60, 5542 ((swp.cx - 5543 (WinQuerySysValue(HWND_DESKTOP, 5544 SV_CXSIZEBORDER) * 2)) - 5545 64L), 60L, hwndFrame, HWND_TOP, 5546 MAIN_CMDLIST, NULL, NULL); 5539 5547 if (!hwndCmdlist) 5540 5548 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5541 5549 WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT)); 5542 5550 hwndStatelist = WinCreateWindow(hwndFrame, 5543 WC_COMBOBOX,5544 (PSZ) NULL,5545 WS_VISIBLE | CBS_DROPDOWN |5546 LS_HORZSCROLL,5547 (swp.x +5548 WinQuerySysValue(HWND_DESKTOP,5549 SV_CXSIZEBORDER) + 48L),5550 (swp.cy -5551 WinQuerySysValue(HWND_DESKTOP,5552 SV_CYSIZEBORDER)) - 60,5553 ((swp.cx -5554 (WinQuerySysValue(HWND_DESKTOP,5555 SV_CXSIZEBORDER) *5556 2)) - 64L), 60L, hwndFrame, HWND_TOP,5557 MAIN_SETUPLIST, NULL, NULL);5551 WC_COMBOBOX, 5552 (PSZ) NULL, 5553 WS_VISIBLE | CBS_DROPDOWN | 5554 LS_HORZSCROLL, 5555 (swp.x + 5556 WinQuerySysValue(HWND_DESKTOP, 5557 SV_CXSIZEBORDER) + 48L), 5558 (swp.cy - 5559 WinQuerySysValue(HWND_DESKTOP, 5560 SV_CYSIZEBORDER)) - 60, 5561 ((swp.cx - 5562 (WinQuerySysValue(HWND_DESKTOP, 5563 SV_CXSIZEBORDER) * 5564 2)) - 64L), 60L, hwndFrame, HWND_TOP, 5565 MAIN_SETUPLIST, NULL, NULL); 5558 5566 if (!hwndStatelist) 5559 5567 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5560 5568 5561 5569 hwndDrivelist = WinCreateWindow(hwndFrame, 5562 WC_COMBOBOX,5563 (PSZ) NULL,5564 WS_VISIBLE | CBS_DROPDOWN,5565 (swp.x +5566 WinQuerySysValue(HWND_DESKTOP,5567 SV_CXSIZEBORDER)),5568 (swp.cy -5569 WinQuerySysValue(HWND_DESKTOP,5570 SV_CYSIZEBORDER)) - 60,5571 48L,5572 60L,5573 hwndFrame,5574 HWND_TOP, MAIN_DRIVELIST, NULL, NULL);5570 WC_COMBOBOX, 5571 (PSZ) NULL, 5572 WS_VISIBLE | CBS_DROPDOWN, 5573 (swp.x + 5574 WinQuerySysValue(HWND_DESKTOP, 5575 SV_CXSIZEBORDER)), 5576 (swp.cy - 5577 WinQuerySysValue(HWND_DESKTOP, 5578 SV_CYSIZEBORDER)) - 60, 5579 48L, 5580 60L, 5581 hwndFrame, 5582 HWND_TOP, MAIN_DRIVELIST, NULL, NULL); 5575 5583 if (!hwndDrivelist) 5576 5584 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5577 5585 SetPresParams(hwndDrivelist, 5578 NULL, NULL, NULL, GetPString(IDS_10SYSTEMMONOTEXT));5586 NULL, NULL, NULL, GetPString(IDS_10SYSTEMMONOTEXT)); 5579 5587 hwndButtonlist = WinCreateWindow(hwndFrame, 5580 WC_COMBOBOX,5581 (PSZ) NULL,5582 WS_VISIBLE | CBS_DROPDOWN |5583 LS_HORZSCROLL,5584 (swp.cx -5585 WinQuerySysValue(HWND_DESKTOP,5586 SV_CXSIZEBORDER)) -5587 164L,5588 (swp.cy -5589 WinQuerySysValue(HWND_DESKTOP,5590 SV_CYSIZEBORDER)) - 60,5591 164L, 60L, hwndFrame, HWND_TOP,5592 MAIN_BUTTONLIST, NULL, NULL);5588 WC_COMBOBOX, 5589 (PSZ) NULL, 5590 WS_VISIBLE | CBS_DROPDOWN | 5591 LS_HORZSCROLL, 5592 (swp.cx - 5593 WinQuerySysValue(HWND_DESKTOP, 5594 SV_CXSIZEBORDER)) - 5595 164L, 5596 (swp.cy - 5597 WinQuerySysValue(HWND_DESKTOP, 5598 SV_CYSIZEBORDER)) - 60, 5599 164L, 60L, hwndFrame, HWND_TOP, 5600 MAIN_BUTTONLIST, NULL, NULL); 5593 5601 if (!hwndButtonlist) 5594 5602 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5595 5603 WinSendMsg(WinWindowFromID(hwndUserlist, CBID_EDIT), 5596 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);5604 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 5597 5605 WinSendMsg(WinWindowFromID(hwndStatelist, CBID_EDIT), 5598 EM_SETTEXTLIMIT, MPFROM2SHORT(STATE_NAME_MAX_BYTES, 0), MPVOID);5606 EM_SETTEXTLIMIT, MPFROM2SHORT(STATE_NAME_MAX_BYTES, 0), MPVOID); 5599 5607 WinSendMsg(WinWindowFromID(hwndDrivelist, CBID_EDIT), 5600 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);5608 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID); 5601 5609 WinSendMsg(WinWindowFromID(hwndButtonlist, CBID_EDIT), 5602 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);5610 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID); 5603 5611 WinSendMsg(WinWindowFromID(hwndCmdlist, CBID_EDIT), 5604 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);5612 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID); 5605 5613 5606 5614 oldproc = WinSubclassWindow(WinWindowFromID(hwndUserlist, CBID_EDIT), 5607 DropDownListProc);5615 DropDownListProc); 5608 5616 WinSetWindowPtr(WinWindowFromID(hwndUserlist, CBID_EDIT), 5609 QWL_USER, (PVOID) oldproc);5617 QWL_USER, (PVOID) oldproc); 5610 5618 oldproc = WinSubclassWindow(WinWindowFromID(hwndCmdlist, CBID_EDIT), 5611 DropDownListProc);5619 DropDownListProc); 5612 5620 WinSetWindowPtr(WinWindowFromID(hwndCmdlist, CBID_EDIT), 5613 QWL_USER, (PVOID) oldproc);5621 QWL_USER, (PVOID) oldproc); 5614 5622 oldproc = WinSubclassWindow(WinWindowFromID(hwndButtonlist, CBID_EDIT), 5615 DropDownListProc);5623 DropDownListProc); 5616 5624 WinSetWindowPtr(WinWindowFromID(hwndButtonlist, CBID_EDIT), 5617 QWL_USER, (PVOID) oldproc);5625 QWL_USER, (PVOID) oldproc); 5618 5626 oldproc = WinSubclassWindow(WinWindowFromID(hwndStatelist, CBID_EDIT), 5619 DropDownListProc);5627 DropDownListProc); 5620 5628 WinSetWindowPtr(WinWindowFromID(hwndStatelist, CBID_EDIT), 5621 QWL_USER, (PVOID) oldproc);5629 QWL_USER, (PVOID) oldproc); 5622 5630 oldproc = WinSubclassWindow(WinWindowFromID(hwndDrivelist, CBID_EDIT), 5623 DropDownListProc);5631 DropDownListProc); 5624 5632 WinSetWindowPtr(WinWindowFromID(hwndDrivelist, CBID_EDIT), 5625 QWL_USER, (PVOID) oldproc);5633 QWL_USER, (PVOID) oldproc); 5626 5634 oldproc = WinSubclassWindow(hwndUserlist, DropDownListProc); 5627 5635 WinSetWindowPtr(hwndUserlist, QWL_USER, (PVOID) oldproc); … … 5635 5643 WinSetWindowPtr(hwndButtonlist, QWL_USER, (PVOID) oldproc); 5636 5644 oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_USERLIST), 5637 ChildFrameButtonProc);5645 ChildFrameButtonProc); 5638 5646 WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_USERLIST), 5639 QWL_USER, (PVOID) oldproc);5647 QWL_USER, (PVOID) oldproc); 5640 5648 oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_OPENWALK), 5641 ChildFrameButtonProc);5649 ChildFrameButtonProc); 5642 5650 WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_OPENWALK), 5643 QWL_USER, (PVOID) oldproc);5651 QWL_USER, (PVOID) oldproc); 5644 5652 hwndMenu = WinWindowFromID(hwndFrame, FID_MENU); 5645 5653 WinSendMsg(hwnd, UM_ADDTOMENU, MPVOID, MPVOID); … … 5655 5663 hwndSysMenu = WinWindowFromID(hwndFrame, FID_SYSMENU); 5656 5664 idSysMenu = SHORT1FROMMR(WinSendMsg(hwndSysMenu, 5657 MM_ITEMIDFROMPOSITION,5658 MPVOID, MPVOID));5665 MM_ITEMIDFROMPOSITION, 5666 MPVOID, MPVOID)); 5659 5667 WinSendMsg(hwndSysMenu, 5660 MM_QUERYITEM, MPFROM2SHORT(idSysMenu, 0), MPFROMP(&mit));5668 MM_QUERYITEM, MPFROM2SHORT(idSysMenu, 0), MPFROMP(&mit)); 5661 5669 hwndSysSubMenu = mit.hwndSubMenu; 5662 5670 mi.iPosition = MIT_END; … … 5667 5675 mi.id = IDM_IDEALSIZE; 5668 5676 WinSendMsg(hwndSysSubMenu, 5669 MM_INSERTITEM,5670 MPFROMP(&mi), MPFROMP(GetPString(IDS_IDEALMENUTEXT)));5677 MM_INSERTITEM, 5678 MPFROMP(&mi), MPFROMP(GetPString(IDS_IDEALMENUTEXT))); 5671 5679 mi.afStyle = MIS_TEXT; 5672 5680 mi.id = IDM_HIDEMENU; 5673 5681 WinSendMsg(hwndSysSubMenu, 5674 MM_INSERTITEM,5675 MPFROMP(&mi), MPFROMP(GetPString(IDS_HIDEMENUTEXT)));5682 MM_INSERTITEM, 5683 MPFROMP(&mi), MPFROMP(GetPString(IDS_HIDEMENUTEXT))); 5676 5684 SetSysMenu(hwndSysMenu); 5677 5685 5678 5686 size = sizeof(BOOL); 5679 5687 if (PrfQueryProfileData(fmprof, 5680 FM3Str,5681 "MenuInvisible", &temp, &size) && size && temp)5688 FM3Str, 5689 "MenuInvisible", &temp, &size) && size && temp) 5682 5690 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID); 5683 5691 size = sizeof(BOOL); 5684 5692 if (PrfQueryProfileData(fmprof, 5685 FM3Str, "FreeTree", &temp, &size) && size && temp)5693 FM3Str, "FreeTree", &temp, &size) && size && temp) 5686 5694 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_FREETREE, 0), MPVOID); 5687 5695 size = sizeof(BOOL); 5688 5696 if (PrfQueryProfileData(fmprof, 5689 FM3Str,5690 "AutoTile", &temp, &size) && size && !temp)5697 FM3Str, 5698 "AutoTile", &temp, &size) && size && !temp) 5691 5699 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_AUTOTILE, 0), MPVOID); 5692 5700 size = sizeof(BOOL); 5693 5701 if (PrfQueryProfileData(fmprof, 5694 FM3Str, "Toolbar", &temp, &size) && size && !temp)5702 FM3Str, "Toolbar", &temp, &size) && size && !temp) 5695 5703 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID); 5696 5704 … … 5717 5725 hwndTree = StartTreeCnr(hwnd, 4); 5718 5726 if (!hwndTree) 5719 WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));5727 WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT)); 5720 5728 else { 5721 if (!fSaveState ||5722 !PrfQueryProfileData(fmprof,5723 FM3Str,5724 "LastTreePos",5725 &swp, &size) || size != sizeof(SWP)) {5726 5727 INT ratio, height = 0;5728 5729 if (!fNoTreeGap)5730 height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;5731 size = sizeof(ratio);5732 if (!PrfQueryProfileData(fmprof,5733 FM3Str,5734 "TreeWindowRatio",5735 (PVOID) & ratio,5736 &size) || size < sizeof(ratio))5737 ratio = 400;5738 WinSetWindowPos(hwndTree,5739 HWND_TOP,5740 0,5741 height,5742 (swp.cx * 100) / ratio,5743 swp.cy - height,5744 SWP_SHOW | SWP_SIZE | SWP_MOVE |5745 SWP_ACTIVATE | SWP_ZORDER);5746 }5747 else5748 WinSetWindowPos(hwndTree,5749 HWND_TOP,5750 swp.x,5751 swp.y,5752 swp.cx,5753 swp.cy,5754 swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW |5755 SWP_ZORDER | SWP_ACTIVATE);5729 if (!fSaveState || 5730 !PrfQueryProfileData(fmprof, 5731 FM3Str, 5732 "LastTreePos", 5733 &swp, &size) || size != sizeof(SWP)) { 5734 5735 INT ratio, height = 0; 5736 5737 if (!fNoTreeGap) 5738 height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2; 5739 size = sizeof(ratio); 5740 if (!PrfQueryProfileData(fmprof, 5741 FM3Str, 5742 "TreeWindowRatio", 5743 (PVOID) & ratio, 5744 &size) || size < sizeof(ratio)) 5745 ratio = 400; 5746 WinSetWindowPos(hwndTree, 5747 HWND_TOP, 5748 0, 5749 height, 5750 (swp.cx * 100) / ratio, 5751 swp.cy - height, 5752 SWP_SHOW | SWP_SIZE | SWP_MOVE | 5753 SWP_ACTIVATE | SWP_ZORDER); 5754 } 5755 else 5756 WinSetWindowPos(hwndTree, 5757 HWND_TOP, 5758 swp.x, 5759 swp.y, 5760 swp.cx, 5761 swp.cy, 5762 swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW | 5763 SWP_ZORDER | SWP_ACTIVATE); 5756 5764 } 5757 5765 ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5758 MAIN_TOOLS));5766 MAIN_TOOLS)); 5759 5767 } 5760 5768 PostMsg(MainObjectHwnd, UM_SETUP3, mp1, mp2); … … 5767 5775 PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszStatename), MPVOID); 5768 5776 if (!add_setup(pszStatename)) 5769 save_setups();5777 save_setups(); 5770 5778 } 5771 5779 PostMsg(MainObjectHwnd, UM_SETUP4, mp1, mp2); … … 5778 5786 5779 5787 for (x = 1; x < argc; x++) { 5780 if (*argv[x] == '/' || *argv[x] == ';')5781 continue;5782 if (!IsFile(argv[x]) && !FindDirCnrByName(argv[x], FALSE))5783 OpenDirCnr((HWND) 0, hwndMain, hwndTree, TRUE, argv[x]);5788 if (*argv[x] == '/' || *argv[x] == ';') 5789 continue; 5790 if (!IsFile(argv[x]) && !FindDirCnrByName(argv[x], FALSE)) 5791 OpenDirCnr((HWND) 0, hwndMain, hwndTree, TRUE, argv[x]); 5784 5792 } 5785 5793 } … … 5799 5807 hwndActive = TopWindow(hwnd, hwndTree); 5800 5808 if (hwndActive) 5801 WinSetWindowPos(hwndActive, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE);5809 WinSetWindowPos(hwndActive, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE); 5802 5810 } 5803 5811 if (fStartMinimized || fReminimize) … … 5810 5818 PostMsg(hwnd, WM_COMMAND, MPFROMLONG(IDM_QUICKSETTINGS), MPVOID); 5811 5819 } 5812 # ifdef FORTIFY5813 Fortify_EnterScope();5814 # endif5815 5820 return 0; 5816 5821 } … … 5823 5828 switch (msg) { 5824 5829 case WM_CREATE: 5830 # ifdef FORTIFY 5831 Fortify_EnterScope(); 5832 # endif 5825 5833 case UM_SETUP: 5826 5834 case UM_SETUP2: … … 5832 5840 case WM_CONTROLPOINTER: 5833 5841 if (!fNoFinger && 5834 (SHORT1FROMMP(mp1) == IDM_OPENWALK ||5835 SHORT1FROMMP(mp1) == IDM_USERLIST))5842 (SHORT1FROMMP(mp1) == IDM_OPENWALK || 5843 SHORT1FROMMP(mp1) == IDM_USERLIST)) 5836 5844 return MRFROMLONG(hptrFinger); 5837 5845 break; … … 5873 5881 if (mp1) { 5874 5882 if (fUserComboBox) 5875 WinSetWindowText(WinWindowFromID(hwndUserlist, CBID_EDIT),5876 (CHAR *)mp1);5883 WinSetWindowText(WinWindowFromID(hwndUserlist, CBID_EDIT), 5884 (CHAR *)mp1); 5877 5885 if (add_udir(FALSE, (CHAR *)mp1)) { 5878 if (fUserComboBox && fAutoAddDirs) {5879 WinSendMsg(hwndUserlist, LM_INSERTITEM,5880 MPFROM2SHORT(LIT_SORTASCENDING, 0),5881 MPFROMP((CHAR *)mp1));5882 }5886 if (fUserComboBox && fAutoAddDirs) { 5887 WinSendMsg(hwndUserlist, LM_INSERTITEM, 5888 MPFROM2SHORT(LIT_SORTASCENDING, 0), 5889 MPFROMP((CHAR *)mp1)); 5890 } 5883 5891 } 5884 5892 } … … 5912 5920 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp); 5913 5921 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) { 5914 WinStoreWindowPos(FM2Str,5915 "MainWindowPos", WinQueryWindow(hwnd, QW_PARENT));5916 if (!fNoSaveState && fSaveState)5917 SaveDirCnrState(hwnd, GetPString(IDS_SHUTDOWNSTATE));5922 WinStoreWindowPos(FM2Str, 5923 "MainWindowPos", WinQueryWindow(hwnd, QW_PARENT)); 5924 if (!fNoSaveState && fSaveState) 5925 SaveDirCnrState(hwnd, GetPString(IDS_SHUTDOWNSTATE)); 5918 5926 } 5919 5927 } … … 5925 5933 case 1: 5926 5934 { 5927 HWND hwndCurrent;5928 ULONG wmsg;5929 5930 wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU;5931 hwndCurrent = TopWindow(hwnd, (HWND) 0);5932 PortholeInit((HWND) WinSendMsg(WinWindowFromID(hwndCurrent,5933 FID_CLIENT), wmsg,5934 MPVOID, MPVOID), mp1, mp2);5935 HWND hwndCurrent; 5936 ULONG wmsg; 5937 5938 wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU; 5939 hwndCurrent = TopWindow(hwnd, (HWND) 0); 5940 PortholeInit((HWND) WinSendMsg(WinWindowFromID(hwndCurrent, 5941 FID_CLIENT), wmsg, 5942 MPVOID, MPVOID), mp1, mp2); 5935 5943 } 5936 5944 break; … … 5950 5958 */ 5951 5959 { 5952 HWND hwndMenu, hwndSubMenu;5953 MENUITEM mi;5954 5955 hwndMenu = WinQueryWindowULong(hwnd, QWL_USER);5956 memset(&mi, 0, sizeof(mi));5957 mi.iPosition = MIT_END;5958 mi.afStyle = MIS_TEXT;5959 if (!WinSendMsg(hwndMenu, MM_QUERYITEM,5960 MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi)))5961 break;5962 hwndSubMenu = mi.hwndSubMenu;5963 SetupWinList(hwndSubMenu, hwnd, WinQueryWindow(hwnd, QW_PARENT));5960 HWND hwndMenu, hwndSubMenu; 5961 MENUITEM mi; 5962 5963 hwndMenu = WinQueryWindowULong(hwnd, QWL_USER); 5964 memset(&mi, 0, sizeof(mi)); 5965 mi.iPosition = MIT_END; 5966 mi.afStyle = MIS_TEXT; 5967 if (!WinSendMsg(hwndMenu, MM_QUERYITEM, 5968 MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi))) 5969 break; 5970 hwndSubMenu = mi.hwndSubMenu; 5971 SetupWinList(hwndSubMenu, hwnd, WinQueryWindow(hwnd, QW_PARENT)); 5964 5972 } 5965 5973 break; … … 5967 5975 default: 5968 5976 { 5969 HWND hwndCurrent;5970 5971 hwndCurrent = TopWindow(hwnd, (HWND) 0);5972 if (hwndCurrent)5973 WinSendMsg(hwndCurrent, UM_INITMENU, mp1, mp2);5977 HWND hwndCurrent; 5978 5979 hwndCurrent = TopWindow(hwnd, (HWND) 0); 5980 if (hwndCurrent) 5981 WinSendMsg(hwndCurrent, UM_INITMENU, mp1, mp2); 5974 5982 } 5975 5983 break; … … 5979 5987 case UM_ADDTOMENU: 5980 5988 AddToMenu((CHAR *)mp1, WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5981 FID_MENU));5989 FID_MENU)); 5982 5990 return 0; 5983 5991 … … 5992 6000 info = cmdhead; 5993 6001 while (info) { 5994 WinSendMsg(hwndCmdlist, LM_INSERTITEM,5995 MPFROM2SHORT(LIT_END, 0), MPFROMP(info->title));5996 info = info->next;6002 WinSendMsg(hwndCmdlist, LM_INSERTITEM, 6003 MPFROM2SHORT(LIT_END, 0), MPFROMP(info->title)); 6004 info = info->next; 5997 6005 } 5998 6006 } … … 6018 6026 ulSearchCount = 1; 6019 6027 if (!DosFindFirst("*.TLS", &hDir, FILE_READONLY | FILE_ARCHIVED, 6020 &findbuf, sizeof(FILEFINDBUF3),6021 &ulSearchCount, FIL_STANDARD)) {6022 do {6023 priority_bumped();6024 if (!foundit) {6025 thisone = FALSE;6026 p = strrchr(lasttoolbox, '\\');6027 if (!p)6028 p = lasttoolbox;6029 else6030 p++;6031 if (!stricmp(findbuf.achName, p))6032 thisone = TRUE;6033 }6034 p = strrchr(findbuf.achName, '.');6035 if (p)6036 *p = 0;6037 sSelect = (SHORT) WinSendMsg(hwndButtonlist, LM_INSERTITEM,6038 MPFROM2SHORT(LIT_SORTASCENDING, 0),6039 MPFROMP(findbuf.achName));6040 if (!foundit && thisone && sSelect >= 0) {6041 WinSendMsg(hwndButtonlist, LM_SELECTITEM,6042 MPFROM2SHORT(sSelect, 0), MPFROMLONG(TRUE));6043 foundit = TRUE;6044 }6045 }6046 while (!DosFindNext(hDir, &findbuf, sizeof(FILEFINDBUF3),6047 &ulSearchCount));6048 DosFindClose(hDir);6049 priority_bumped();6028 &findbuf, sizeof(FILEFINDBUF3), 6029 &ulSearchCount, FIL_STANDARD)) { 6030 do { 6031 priority_bumped(); 6032 if (!foundit) { 6033 thisone = FALSE; 6034 p = strrchr(lasttoolbox, '\\'); 6035 if (!p) 6036 p = lasttoolbox; 6037 else 6038 p++; 6039 if (!stricmp(findbuf.achName, p)) 6040 thisone = TRUE; 6041 } 6042 p = strrchr(findbuf.achName, '.'); 6043 if (p) 6044 *p = 0; 6045 sSelect = (SHORT) WinSendMsg(hwndButtonlist, LM_INSERTITEM, 6046 MPFROM2SHORT(LIT_SORTASCENDING, 0), 6047 MPFROMP(findbuf.achName)); 6048 if (!foundit && thisone && sSelect >= 0) { 6049 WinSendMsg(hwndButtonlist, LM_SELECTITEM, 6050 MPFROM2SHORT(sSelect, 0), MPFROMLONG(TRUE)); 6051 foundit = TRUE; 6052 } 6053 } 6054 while (!DosFindNext(hDir, &findbuf, sizeof(FILEFINDBUF3), 6055 &ulSearchCount)); 6056 DosFindClose(hDir); 6057 priority_bumped(); 6050 6058 } 6051 6059 WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBOXTEXT)); … … 6066 6074 6067 6075 if (!loadedudirs) 6068 load_udirs();6076 load_udirs(); 6069 6077 DosError(FERR_DISABLEHARDERR); 6070 6078 DosQCurDisk(&ulDriveNum, &ulDriveMap); 6071 6079 info = udirhead; 6072 6080 while (info) { 6073 if (IsFullName(info->path) &&6074 !(driveflags[toupper(*info->path) - 'A'] &6075 (DRIVE_IGNORE | DRIVE_INVALID))) {6076 DosError(FERR_DISABLEHARDERR);6077 hDir = HDIR_CREATE;6078 ulSearchCount = 1;6079 if (!IsRoot(info->path))6080 rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |6081 MUST_HAVE_DIRECTORY | FILE_READONLY |6082 FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,6083 &findbuf, sizeof(FILEFINDBUF3),6084 &ulSearchCount, FIL_STANDARD);6085 else {6086 rc = 0;6087 findbuf.attrFile = FILE_DIRECTORY;6088 }6089 priority_bumped();6090 if (!rc) {6091 if (!IsRoot(info->path))6092 DosFindClose(hDir);6093 if (findbuf.attrFile & FILE_DIRECTORY)6094 WinSendMsg(hwndUserlist, LM_INSERTITEM,6095 MPFROM2SHORT(LIT_SORTASCENDING, 0),6096 MPFROMP(info->path));6097 else {6098 temp = info->next;6099 remove_udir(info->path);6100 info = temp;6101 continue;6102 }6103 }6104 else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) {6105 temp = info->next;6106 remove_udir(info->path);6107 info = temp;6108 continue;6109 }6110 }6111 info = info->next;6081 if (IsFullName(info->path) && 6082 !(driveflags[toupper(*info->path) - 'A'] & 6083 (DRIVE_IGNORE | DRIVE_INVALID))) { 6084 DosError(FERR_DISABLEHARDERR); 6085 hDir = HDIR_CREATE; 6086 ulSearchCount = 1; 6087 if (!IsRoot(info->path)) 6088 rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY | 6089 MUST_HAVE_DIRECTORY | FILE_READONLY | 6090 FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN, 6091 &findbuf, sizeof(FILEFINDBUF3), 6092 &ulSearchCount, FIL_STANDARD); 6093 else { 6094 rc = 0; 6095 findbuf.attrFile = FILE_DIRECTORY; 6096 } 6097 priority_bumped(); 6098 if (!rc) { 6099 if (!IsRoot(info->path)) 6100 DosFindClose(hDir); 6101 if (findbuf.attrFile & FILE_DIRECTORY) 6102 WinSendMsg(hwndUserlist, LM_INSERTITEM, 6103 MPFROM2SHORT(LIT_SORTASCENDING, 0), 6104 MPFROMP(info->path)); 6105 else { 6106 temp = info->next; 6107 remove_udir(info->path); 6108 info = temp; 6109 continue; 6110 } 6111 } 6112 else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) { 6113 temp = info->next; 6114 remove_udir(info->path); 6115 info = temp; 6116 continue; 6117 } 6118 } 6119 info = info->next; 6112 6120 } 6113 6121 info = ldirhead; 6114 6122 while (info) { 6115 if (IsFullName(info->path) &&6116 !(driveflags[toupper(*info->path) - 'A'] &6117 (DRIVE_IGNORE | DRIVE_INVALID))) {6118 DosError(FERR_DISABLEHARDERR);6119 hDir = HDIR_CREATE;6120 ulSearchCount = 1;6121 if (!IsRoot(info->path))6122 rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |6123 MUST_HAVE_DIRECTORY | FILE_READONLY |6124 FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,6125 &findbuf, sizeof(FILEFINDBUF3),6126 &ulSearchCount, FIL_STANDARD);6127 else {6128 rc = 0;6129 findbuf.attrFile = FILE_DIRECTORY;6130 }6131 priority_bumped();6132 if (!rc) {6133 if (!IsRoot(info->path))6134 DosFindClose(hDir);6135 if (findbuf.attrFile & FILE_DIRECTORY)6136 WinSendMsg(hwndUserlist, LM_INSERTITEM,6137 MPFROM2SHORT(LIT_SORTASCENDING, 0),6138 MPFROMP(info->path));6139 else {6140 temp = info->next;6141 remove_udir(info->path);6142 info = temp;6143 continue;6144 }6145 }6146 else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) {6147 temp = info->next;6148 remove_udir(info->path);6149 info = temp;6150 continue;6151 }6152 }6153 info = info->next;6123 if (IsFullName(info->path) && 6124 !(driveflags[toupper(*info->path) - 'A'] & 6125 (DRIVE_IGNORE | DRIVE_INVALID))) { 6126 DosError(FERR_DISABLEHARDERR); 6127 hDir = HDIR_CREATE; 6128 ulSearchCount = 1; 6129 if (!IsRoot(info->path)) 6130 rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY | 6131 MUST_HAVE_DIRECTORY | FILE_READONLY | 6132 FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN, 6133 &findbuf, sizeof(FILEFINDBUF3), 6134 &ulSearchCount, FIL_STANDARD); 6135 else { 6136 rc = 0; 6137 findbuf.attrFile = FILE_DIRECTORY; 6138 } 6139 priority_bumped(); 6140 if (!rc) { 6141 if (!IsRoot(info->path)) 6142 DosFindClose(hDir); 6143 if (findbuf.attrFile & FILE_DIRECTORY) 6144 WinSendMsg(hwndUserlist, LM_INSERTITEM, 6145 MPFROM2SHORT(LIT_SORTASCENDING, 0), 6146 MPFROMP(info->path)); 6147 else { 6148 temp = info->next; 6149 remove_udir(info->path); 6150 info = temp; 6151 continue; 6152 } 6153 } 6154 else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) { 6155 temp = info->next; 6156 remove_udir(info->path); 6157 info = temp; 6158 continue; 6159 } 6160 } 6161 info = info->next; 6154 6162 } 6155 6163 WinSendMsg(hwndUserlist, LM_INSERTITEM, 6156 MPFROM2SHORT(0, 0),6157 MPFROMP(GetPString(IDS_NEWDIRECTORYTEXT)));6164 MPFROM2SHORT(0, 0), 6165 MPFROMP(GetPString(IDS_NEWDIRECTORYTEXT))); 6158 6166 WinSetWindowText(hwndUserlist, GetPString(IDS_COMMONDIRTEXT)); 6159 6167 } … … 6169 6177 case WM_SIZE: 6170 6178 ResizeChildren(hwnd, SHORT1FROMMP(mp1), SHORT2FROMMP(mp1), 6171 SHORT1FROMMP(mp2), SHORT2FROMMP(mp2));6179 SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)); 6172 6180 break; 6173 6181 … … 6183 6191 hps = WinBeginPaint(hwnd, (HPS) 0, NULL); 6184 6192 if (hps) { 6185 WinQueryWindowRect(hwnd, &rcl);6186 WinFillRect(hps, &rcl, CLR_PALEGRAY);6187 WinEndPaint(hps);6193 WinQueryWindowRect(hwnd, &rcl); 6194 WinFillRect(hps, &rcl, CLR_PALEGRAY); 6195 WinEndPaint(hps); 6188 6196 } 6189 6197 } … … 6199 6207 switch (SHORT2FROMMP(mp1)) { 6200 6208 case CBN_ENTER: 6201 {6202 HWND hwndUL = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),6203 SHORT1FROMMP(mp1));6204 CHAR path[CCHMAXPATH];6205 ULONG ul;6206 6207 switch (SHORT1FROMMP(mp1)) {6208 case MAIN_USERLIST:6209 ul = CCHMAXPATH;6210 break;6211 case MAIN_SETUPLIST:6212 ul = STATE_NAME_MAX_BYTES;6213 break;6214 default:6215 ul = 13; // fixme to not be hardcoded6216 }6217 6218 SetShiftState();6219 WinQueryWindowText(WinWindowFromID(hwndUL, CBID_EDIT), ul, path);6220 bstrip(path);6221 if (*path) {6222 if (SHORT1FROMMP(mp1) == MAIN_USERLIST) {6223 if (!strcmp(path, GetPString(IDS_NEWDIRECTORYTEXT))) {6224 if (!LastDir ||6225 !WinSendMsg(WinQueryWindow(LastDir, QW_PARENT),6226 UM_CONTAINERDIR, MPFROMP(path), MPVOID))6227 save_dir2(path);6228 if (!PMMkDir(hwnd, path, TRUE)) {6229 WinSetWindowText(hwndUL, GetPString(IDS_COMMONDIRTEXT));6230 break;6231 }6232 }6233 if (!IsFile(path) && !FindDirCnrByName(path, TRUE)) {6234 6235 HWND hwndDir;6236 6237 if ((fUserListSwitches &&6238 !(shiftstate & KC_SHIFT)) ||6239 (!fUserListSwitches && (shiftstate & KC_SHIFT))) {6240 hwndDir = FindDirCnr(hwnd);6241 if (hwndDir) {6242 WinSendMsg(LastDir, UM_SETDIR, MPFROMP(path), MPVOID);6243 break;6244 }6245 }6246 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, path);6247 }6248 }6249 else if (SHORT1FROMMP(mp1) == MAIN_DRIVELIST) {6250 ShowTreeRec(WinWindowFromID(WinWindowFromID(hwndTree,6251 FID_CLIENT),6252 TREE_CNR), path, FALSE, TRUE);6253 WinSetFocus(HWND_DESKTOP, hwndTree);6254 }6255 else if (SHORT1FROMMP(mp1) == MAIN_BUTTONLIST) {6256 strcat(path, ".TLS");6257 load_tools(path);6258 PrfWriteProfileString(fmprof,6259 FM3Str, "LastToolBox", lasttoolbox);6260 BuildTools(hwndToolback, TRUE);6261 WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBOXTEXT));6262 }6263 else if (SHORT1FROMMP(mp1) == MAIN_SETUPLIST) {6264 CHAR szKey[80];6265 ULONG size, numsaves = 0;6266 6267 SetShiftState();6268 size = sizeof(ULONG);6269 sprintf(szKey, "%s.NumDirsLastTime", path); // path is state name6270 if (!PrfQueryProfileData(fmprof,6271 FM3Str,6272 szKey,6273 (PVOID)&numsaves,6274 &size))6275 {6276 if ((WinGetLastError(WinQueryAnchorBlock(hwnd)) & 0xffff) == PMERR_NOT_IN_IDX) {6277 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,6278 GetPString(IDS_WARNINGTEXT),6279 GetPString(IDS_DOESNTEXISTTEXT), path);6280 }6281 else {6282 Win_Error2(hwnd, hwnd, __FILE__, __LINE__,6283 IDS_PRFQUERYPROFILEDATA);6284 }6285 }6286 else {6287 char *pszStateName;6288 if ((shiftstate & KC_SHIFT) == 0)6289 PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2));6290 pszStateName = xstrdup(path, pszSrcFile, __LINE__);6291 if (!pszStateName) {6292 // Fall back if out of memory - already complained6293 if ((shiftstate & KC_SHIFT) != 0 || fAutoTile) {6294 // Autotile requested or forced6295 PostMsg(MainObjectHwnd,6296 UM_RESTORE,6297 MPVOID,6298 MPFROMLONG(1)); // Autotile6299 }6300 }6301 else if (!PostMsg(MainObjectHwnd,6302 UM_RESTORE,6303 MPFROMP(pszStateName),6304 MPVOID)) {6305 free(pszStateName);6306 }6307 }6308 }6309 else if (SHORT1FROMMP(mp1) == MAIN_CMDLIST) {6310 6311 SHORT sSelect;6312 6313 sSelect = (SHORT) WinSendMsg(hwndCmdlist,6314 LM_QUERYSELECTION,6315 MPFROMSHORT(LIT_FIRST), MPVOID);6316 if (sSelect >= 0)6317 WinPostMsg(hwnd,6318 WM_COMMAND,6319 MPFROM2SHORT(IDM_COMMANDSTART + sSelect, 0),6320 MPVOID);6321 WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT));6322 }6323 }6324 }6325 break;6209 { 6210 HWND hwndUL = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 6211 SHORT1FROMMP(mp1)); 6212 CHAR path[CCHMAXPATH]; 6213 ULONG ul; 6214 6215 switch (SHORT1FROMMP(mp1)) { 6216 case MAIN_USERLIST: 6217 ul = CCHMAXPATH; 6218 break; 6219 case MAIN_SETUPLIST: 6220 ul = STATE_NAME_MAX_BYTES; 6221 break; 6222 default: 6223 ul = 13; // fixme to not be hardcoded 6224 } 6225 6226 SetShiftState(); 6227 WinQueryWindowText(WinWindowFromID(hwndUL, CBID_EDIT), ul, path); 6228 bstrip(path); 6229 if (*path) { 6230 if (SHORT1FROMMP(mp1) == MAIN_USERLIST) { 6231 if (!strcmp(path, GetPString(IDS_NEWDIRECTORYTEXT))) { 6232 if (!LastDir || 6233 !WinSendMsg(WinQueryWindow(LastDir, QW_PARENT), 6234 UM_CONTAINERDIR, MPFROMP(path), MPVOID)) 6235 save_dir2(path); 6236 if (!PMMkDir(hwnd, path, TRUE)) { 6237 WinSetWindowText(hwndUL, GetPString(IDS_COMMONDIRTEXT)); 6238 break; 6239 } 6240 } 6241 if (!IsFile(path) && !FindDirCnrByName(path, TRUE)) { 6242 6243 HWND hwndDir; 6244 6245 if ((fUserListSwitches && 6246 !(shiftstate & KC_SHIFT)) || 6247 (!fUserListSwitches && (shiftstate & KC_SHIFT))) { 6248 hwndDir = FindDirCnr(hwnd); 6249 if (hwndDir) { 6250 WinSendMsg(LastDir, UM_SETDIR, MPFROMP(path), MPVOID); 6251 break; 6252 } 6253 } 6254 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, path); 6255 } 6256 } 6257 else if (SHORT1FROMMP(mp1) == MAIN_DRIVELIST) { 6258 ShowTreeRec(WinWindowFromID(WinWindowFromID(hwndTree, 6259 FID_CLIENT), 6260 TREE_CNR), path, FALSE, TRUE); 6261 WinSetFocus(HWND_DESKTOP, hwndTree); 6262 } 6263 else if (SHORT1FROMMP(mp1) == MAIN_BUTTONLIST) { 6264 strcat(path, ".TLS"); 6265 load_tools(path); 6266 PrfWriteProfileString(fmprof, 6267 FM3Str, "LastToolBox", lasttoolbox); 6268 BuildTools(hwndToolback, TRUE); 6269 WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBOXTEXT)); 6270 } 6271 else if (SHORT1FROMMP(mp1) == MAIN_SETUPLIST) { 6272 CHAR szKey[80]; 6273 ULONG size, numsaves = 0; 6274 6275 SetShiftState(); 6276 size = sizeof(ULONG); 6277 sprintf(szKey, "%s.NumDirsLastTime", path); // path is state name 6278 if (!PrfQueryProfileData(fmprof, 6279 FM3Str, 6280 szKey, 6281 (PVOID)&numsaves, 6282 &size)) 6283 { 6284 if ((WinGetLastError(WinQueryAnchorBlock(hwnd)) & 0xffff) == PMERR_NOT_IN_IDX) { 6285 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, 6286 GetPString(IDS_WARNINGTEXT), 6287 GetPString(IDS_DOESNTEXISTTEXT), path); 6288 } 6289 else { 6290 Win_Error2(hwnd, hwnd, __FILE__, __LINE__, 6291 IDS_PRFQUERYPROFILEDATA); 6292 } 6293 } 6294 else { 6295 char *pszStateName; 6296 if ((shiftstate & KC_SHIFT) == 0) 6297 PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2)); 6298 pszStateName = xstrdup(path, pszSrcFile, __LINE__); 6299 if (!pszStateName) { 6300 // Fall back if out of memory - already complained 6301 if ((shiftstate & KC_SHIFT) != 0 || fAutoTile) { 6302 // Autotile requested or forced 6303 PostMsg(MainObjectHwnd, 6304 UM_RESTORE, 6305 MPVOID, 6306 MPFROMLONG(1)); // Autotile 6307 } 6308 } 6309 else if (!PostMsg(MainObjectHwnd, 6310 UM_RESTORE, 6311 MPFROMP(pszStateName), 6312 MPVOID)) { 6313 free(pszStateName); 6314 } 6315 } 6316 } 6317 else if (SHORT1FROMMP(mp1) == MAIN_CMDLIST) { 6318 6319 SHORT sSelect; 6320 6321 sSelect = (SHORT) WinSendMsg(hwndCmdlist, 6322 LM_QUERYSELECTION, 6323 MPFROMSHORT(LIT_FIRST), MPVOID); 6324 if (sSelect >= 0) 6325 WinPostMsg(hwnd, 6326 WM_COMMAND, 6327 MPFROM2SHORT(IDM_COMMANDSTART + sSelect, 0), 6328 MPVOID); 6329 WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT)); 6330 } 6331 } 6332 } 6333 break; 6326 6334 6327 6335 default: 6328 break;6336 break; 6329 6337 } 6330 6338 break; … … 6346 6354 case WM_CLOSE: 6347 6355 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), 6348 WM_SYSCOMMAND, MPFROM2SHORT(SC_RESTORE, 0), MPVOID);6356 WM_SYSCOMMAND, MPFROM2SHORT(SC_RESTORE, 0), MPVOID); 6349 6357 WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID); 6350 6358 fAmClosing = TRUE; 6351 6359 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), 6352 WM_SYSCOMMAND, MPFROM2SHORT(SC_MINIMIZE, 0), MPVOID);6360 WM_SYSCOMMAND, MPFROM2SHORT(SC_MINIMIZE, 0), MPVOID); 6353 6361 if (CloseChildren(hwnd)) { 6354 6362 fAmClosing = FALSE; 6355 6363 if (fAutoTile) 6356 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TILE, 0), MPVOID);6364 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TILE, 0), MPVOID); 6357 6365 return 0; 6358 6366 } 6359 6367 if (hwndTree) { 6360 6368 if (!PostMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID)) 6361 WinSendMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID);6369 WinSendMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID); 6362 6370 } 6363 6371 DosSleep(1); … … 6373 6381 // Try to restore saved shutdown state 6374 6382 char *pszDefaultStateName = xstrdup(GetPString(IDS_SHUTDOWNSTATE), 6375 pszSrcFile, __LINE__);6383 pszSrcFile, __LINE__); 6376 6384 if (pszDefaultStateName) { 6377 if (!PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszDefaultStateName), MPVOID))6378 // 05 Feb 08 SHL fixme to complain?6379 free(pszDefaultStateName);6385 if (!PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszDefaultStateName), MPVOID)) 6386 // 05 Feb 08 SHL fixme to complain? 6387 free(pszDefaultStateName); 6380 6388 } 6381 6389 } … … 6386 6394 if (mp1) 6387 6395 return MRFROMLONG(OpenDirCnr((HWND) 0, 6388 hwndMain,6389 hwndTree, (BOOL) mp2, (char *)mp1));6396 hwndMain, 6397 hwndTree, (BOOL) mp2, (char *)mp1)); 6390 6398 return 0; 6391 6399 … … 6394 6402 if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID)) 6395 6403 WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID); 6396 # ifdef FORTIFY 6397 free_commands(); 6398 free_associations(); 6399 free_udirs(); 6400 free_ldir(); 6401 free_archivers(); 6402 free_tools(); 6403 Fortify_LeaveScope(); 6404 # endif 6404 # ifdef FORTIFY 6405 free_commands(); 6406 free_associations(); 6407 free_udirs(); 6408 free_ldir(); 6409 free_archivers(); 6410 free_tools(); 6411 free_setups(); 6412 Fortify_LeaveScope(); 6413 # endif 6405 6414 break; 6406 6415 }  - 
      
trunk/dll/makelist.c
r1063 r1077 15 15 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 16 16 29 Feb 08 GKY Use xfree where appropriate 17 17 Jul 08 SHL Add SetListOwner for Fortify support 17 18 18 19 ***********************************************************************/ … … 260 261 for (x = 0; list[x]; x++) { 261 262 if (item == list[x]) { 262 free(list[x]);263 free(list[x]); 263 264 list[x] = NULL; 264 265 for (y = x;; y++) { … … 272 273 } 273 274 # ifdef FORTIFY 274 Fortify_LeaveScope();275 Fortify_LeaveScope(); 275 276 # endif 276 277 break; … … 301 302 } 302 303 304 #ifdef FORTIFY 305 306 VOID SetListOwner(LISTINFO *li) 307 { 308 if (li) { 309 CHAR **list = li->list; 310 if (list) { 311 UINT x; 312 for (x = 0; list[x]; x++) 313 Fortify_ChangeOwner(list[x]); 314 } 315 Fortify_ChangeOwner(li); 316 } 317 } 318 319 #endif // FORTIFY 320 303 321 #pragma alloc_text(MAKELIST,AddToList,AddToFileList,BuildList,FreeListInfo,FreeList) 304 322 #pragma alloc_text(MAKELIST,SortList,BuildArcList,RemoveFromList,CombineLists) 323 #ifdef FORTIFY 324 #pragma alloc_text(MAKELIST,SetListOwner) 325 #endif // FORTIFY  - 
      
trunk/dll/makelist.h
r1029 r1077 11 11 05 Jan 08 SHL Move makelist.c definitions here 12 12 22 Jun 08 GKY Change variable type to fix compiler warning 13 17 Jul 08 SHL Add SetListOwner for Fortify support 13 14 14 15 ***********************************************************************/ … … 84 85 CHAR **CombineLists(CHAR **prime, CHAR **add); 85 86 87 #ifdef FORTIFY 88 VOID SetListOwner(LISTINFO *li); 89 #endif // FORTIFY 90 86 91 #endif // MAKELIST_H  - 
      
trunk/dll/misc.c
r1065 r1077 42 42 29 Feb 08 GKY Use xfree where appropriate 43 43 08 Mar 08 JBS Ticket 230: Replace prefixless INI keys for default directory containers with 44 keys using a "DirCnr." prefix44 keys using a "DirCnr." prefix 45 45 19 Jun 08 JBS Ticket 239: Fix LoadDetailsSwitches so INI file is read correctly and details 46 switches are set correctly.46 switches are set correctly. 47 47 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating 48 all the details view settings (both the global variables and those in the 49 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS. 48 all the details view settings (both the global variables and those in the 49 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS. 50 17 Jul 08 SHL Add GetTidForWindow for Fortify support 50 51 51 52 ***********************************************************************/ … … 55 56 #include <ctype.h> 56 57 #include <share.h> 57 #include <malloc.h> // _heapmin58 #include <malloc.h> // _heapmin 58 59 59 60 #define INCL_DOS … … 64 65 #include "fm3dlg.h" 65 66 #include "fm3str.h" 66 #include "pathutil.h" // BldQuotedFileName67 #include "errutil.h" // Dos_Error...68 #include "strutil.h" // GetPString69 #include "command.h" // LINKCMDS67 #include "pathutil.h" // BldQuotedFileName 68 #include "errutil.h" // Dos_Error... 69 #include "strutil.h" // GetPString 70 #include "command.h" // LINKCMDS 70 71 #include "fm3dll.h" 72 #include "misc.h" 71 73 #include "fortify.h" 72 74 … … 112 114 return yes; 113 115 } 116 117 #ifdef FORTIFY 118 119 /** 120 * Return tid for fm/2 window 121 * window must exist and must be created by fm/2 122 * @param hwnd is window handle 123 * @returns tid or -1 if error 124 */ 125 126 INT GetTidForWindow(HWND hwnd) 127 { 128 PIB *ppib; 129 TIB *ptib; 130 LONG tid = -1; 131 APIRET rc = DosGetInfoBlocks(&ptib, &ppib); 132 133 if (rc) { 134 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 135 "DosGetInfoBlocks"); 136 } 137 else { 138 PID pid; 139 TID tid; 140 if (!WinQueryWindowProcess(hwnd, &pid, &tid)) 141 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryWindowProcess failed for %X", hwnd); 142 else if (pid != ppib->pib_ulpid) 143 Runtime_Error(pszSrcFile, __LINE__, "hwnd %X not created by fm/2", hwnd); 144 else 145 tid = ptib->tib_ptib2->tib2_ultid; 146 } 147 return tid; 148 } 149 150 #endif // FORTIFY 114 151 115 152 VOID SetShiftState(VOID) … … 710 747 USHORT len; 711 748 CHAR *eaval; 712 LONG retlen;713 PSZ psz;749 LONG retlen; 750 PSZ psz; 714 751 715 752 retlen = WinQueryWindowText(hwndMLE, sizeof(szSubject), szSubject); 716 753 szSubject[retlen + 1] = 0; 717 bstrip(szSubject);718 if (pci->pszSubject != NullStr) {719 if (retlen == 0) {720 psz = pci->pszSubject;721 pci->pszSubject = NullStr;722 xfree(psz, pszSrcFile, __LINE__);723 }724 else725 pci->pszSubject = xrealloc(pci->pszSubject, retlen + 1, pszSrcFile, __LINE__);726 }727 else {728 pci->pszSubject = xmalloc(retlen + 1, pszSrcFile, __LINE__);729 if (!pci->pszSubject)730 return FALSE;731 }754 bstrip(szSubject); 755 if (pci->pszSubject != NullStr) { 756 if (retlen == 0) { 757 psz = pci->pszSubject; 758 pci->pszSubject = NullStr; 759 xfree(psz, pszSrcFile, __LINE__); 760 } 761 else 762 pci->pszSubject = xrealloc(pci->pszSubject, retlen + 1, pszSrcFile, __LINE__); 763 } 764 else { 765 pci->pszSubject = xmalloc(retlen + 1, pszSrcFile, __LINE__); 766 if (!pci->pszSubject) 767 return FALSE; 768 } 732 769 len = strlen(szSubject); 733 770 if (len) … … 772 809 773 810 CHAR longname[CCHMAXPATHCOMP]; 774 LONG retlen;775 PSZ psz;811 LONG retlen; 812 PSZ psz; 776 813 777 814 *longname = 0; 778 815 retlen = WinQueryWindowText(hwndMLE, sizeof(longname), longname); 779 816 longname[retlen + 1] = 0; 780 chop_at_crnl(longname);781 bstrip(longname);782 WinSetWindowText(hwndMLE, longname);783 if (pci->pszLongName != NullStr) {784 if (retlen == 0) {785 psz = pci->pszLongName;786 pci->pszLongName = NullStr;787 xfree(psz, pszSrcFile, __LINE__);788 }789 else790 pci->pszLongName = xrealloc(pci->pszLongName, retlen + 1, pszSrcFile, __LINE__);791 }792 else {793 pci->pszLongName = xmalloc(retlen + 1, pszSrcFile, __LINE__);794 if (!pci->pszLongName)795 return FALSE;796 }817 chop_at_crnl(longname); 818 bstrip(longname); 819 WinSetWindowText(hwndMLE, longname); 820 if (pci->pszLongName != NullStr) { 821 if (retlen == 0) { 822 psz = pci->pszLongName; 823 pci->pszLongName = NullStr; 824 xfree(psz, pszSrcFile, __LINE__); 825 } 826 else 827 pci->pszLongName = xrealloc(pci->pszLongName, retlen + 1, pszSrcFile, __LINE__); 828 } 829 else { 830 pci->pszLongName = xmalloc(retlen + 1, pszSrcFile, __LINE__); 831 if (!pci->pszLongName) 832 return FALSE; 833 } 797 834 return (MRESULT) WriteLongName(pci->pszFileName, longname); 798 835 } … … 980 1017 *ex.environment = 0; 981 1018 ret = WinDlgBox(HWND_DESKTOP, hwnd, CmdLineDlgProc, FM3ModHandle, 982 EXEC_FRAME, &ex);1019 EXEC_FRAME, &ex); 983 1020 if (ret == 1) { 984 1021 lastflags = ex.flags; 985 1022 return runemf2(ex.flags, hwnd, pszSrcFile, __LINE__, path, 986 *ex.environment ? ex.environment : NULL,987 "%s", pszCmdLine) != -1;1023 *ex.environment ? ex.environment : NULL, 1024 "%s", pszCmdLine) != -1; 988 1025 } 989 1026 else if (ret != 0) … … 2157 2194 #pragma alloc_text(MISC1,BoxWindow,PaintRecessedWindow,PostMsg,PaintSTextWindow,IsFm2Window) 2158 2195 #pragma alloc_text(MISC1,FixSwitchList,FindDirCnr,CurrentRecord,SetShiftState,AddToListboxBottom) 2196 2197 #ifdef FORTIFY 2198 #pragma alloc_text(MISC1,GetTidForWindow) 2199 #endif // FORTIFY 2200 2159 2201 #pragma alloc_text(CNR_MISC1,AdjustCnrColVis,AdjustCnrColsForFSType) 2160 2202 #pragma alloc_text(CNR_MISC1,AdjustCnrColsForPref,SetCnrCols)  - 
      
trunk/dll/objwin.c
r1063 r1077 77 77 IDS_WINCREATEWINDOW); 78 78 else { 79 # ifdef FORTIFY80 Fortify_EnterScope();81 # endif79 # ifdef FORTIFY 80 Fortify_EnterScope(); 81 # endif 82 82 WinSetWindowPtr(ObjectHwnd, QWL_USER, args); 83 83 /* initially populate container */ 84 // 18 Jul 08 SHL fixme to know if this really kills WM_CREATE 84 85 WinSendMsg(ObjectHwnd, UM_SETUP, MPVOID, MPVOID); 85 86 PostMsg(ObjectHwnd, UM_RESCAN, MPVOID, MPVOID); … … 88 89 WinDispatchMsg(hab2, &qmsg2); 89 90 WinDestroyWindow(ObjectHwnd); 90 # ifdef FORTIFY91 # ifdef FORTIFY 91 92 { 93 // Allow container to close and free data 92 94 HWND hwndCnr = ((DIRCNRDATA *)args)->hwndCnr; 93 95 USHORT i; 94 // Allow container to close and free data 95 for (i = 0; WinIsWindow(hab2, hwndCnr) && i < 10; i++) { 96 DosSleep(50); 97 } 96 for (i = 0; WinIsWindow(hab2, hwndCnr) && i < 10; i++) 97 DosSleep(50); 98 98 Fortify_LeaveScope(); 99 99 } 100 # endif100 # endif 101 101 } 102 102 WinDestroyMsgQueue(hmq2);  - 
      
trunk/dll/treecnr.c
r1063 r1077 66 66 #include "strutil.h" // GetPString 67 67 #include "notebook.h" // CfgDlgProc 68 #include "command.h" // RunCommand68 #include "command.h" // RunCommand 69 69 #include "fm3dll.h" 70 70 … … 544 544 switch (msg) { 545 545 case WM_CREATE: 546 DbgMsg(pszSrcFile, __LINE__, "WM_CREATE mp1 %p mp2 %p", mp1, mp2); // 18 Jul 08 SHL fixme 546 547 break; 547 548 … … 628 629 629 630 case UM_SETUP: 631 # ifdef FORTIFY 632 Fortify_EnterScope(); 633 # endif 630 634 dcd = WinQueryWindowPtr(hwnd, QWL_USER); 631 635 if (!dcd) 632 636 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 633 637 else { 638 # ifdef FORTIFY 639 Fortify_ChangeOwner(dcd); 640 # endif 634 641 dcd->hwndObject = hwnd; 635 642 if (ParentIsDesktop(hwnd, dcd->hwndParent)) … … 785 792 else { 786 793 WORKER *wk; 787 # ifdef FORTIFY788 Fortify_EnterScope();789 # endif794 # ifdef FORTIFY 795 Fortify_EnterScope(); 796 # endif 790 797 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__); 791 798 if (!wk) … … 802 809 Runtime_Error(pszSrcFile, __LINE__, 803 810 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 804 free(wk);811 free(wk); 805 812 FreeListInfo((LISTINFO *) mp1); 806 813 } 807 814 } 808 # ifdef FORTIFY809 Fortify_LeaveScope();810 # endif815 # ifdef FORTIFY 816 Fortify_LeaveScope(); 817 # endif 811 818 } 812 819 } … … 814 821 815 822 case UM_ACTION: 823 # ifdef FORTIFY 824 Fortify_EnterScope(); 825 # endif 816 826 if (mp1) { 817 827 # ifdef FORTIFY 828 Fortify_ChangeOwner(mp1); 829 # endif 818 830 dcd = WinQueryWindowPtr(hwnd, QWL_USER); 819 831 if (!dcd) … … 821 833 else { 822 834 WORKER *wk; 823 # ifdef FORTIFY824 Fortify_EnterScope();825 # endif826 835 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__); 827 836 if (!wk) … … 838 847 Runtime_Error(pszSrcFile, __LINE__, 839 848 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 840 free(wk);849 free(wk); 841 850 FreeListInfo((LISTINFO *) mp1); 842 851 } 843 852 } 844 # ifdef FORTIFY 845 Fortify_LeaveScope();846 # endif847 }848 } 853 } 854 } 855 # ifdef FORTIFY 856 Fortify_LeaveScope(); 857 # endif 849 858 return 0; 850 859 … … 862 871 # ifdef FORTIFY 863 872 Fortify_LeaveScope(); 864 # endif873 # endif 865 874 WinSetWindowPtr(dcd->hwndCnr, QWL_USER, NULL); 866 875 } … … 879 888 880 889 switch (msg) { 890 case WM_CREATE: 891 DbgMsg(pszSrcFile, __LINE__, "WM_CREATE mp1 %p mp2 %p", mp1, mp2); // 18 Jul 08 SHL fixme 892 break; 893 881 894 case DM_PRINTOBJECT: 882 895 return MRFROMLONG(DRR_TARGET); … … 1172 1185 * first time through -- set things up 1173 1186 */ 1174 1175 1187 CNRINFO cnri; 1188 1189 # ifdef FORTIFY 1190 Fortify_EnterScope(); 1191 # endif 1176 1192 1177 1193 RestorePresParams(hwnd, "TreeCnr"); … … 2173 2189 2174 2190 if ((INT)mp1 == 5 || (INT)mp1 == 13 || (INT)mp1 == 21) 2175 hwnd = StartViewer(HWND_DESKTOP, (INT)mp1,2176 (CHAR *)mp2, dcd->hwndFrame);2191 hwnd = StartViewer(HWND_DESKTOP, (INT)mp1, 2192 (CHAR *)mp2, dcd->hwndFrame); 2177 2193 else 2178 hwnd = StartMLEEditor(dcd->hwndParent,2179 (INT)mp1, (CHAR *)mp2, dcd->hwndFrame);2194 hwnd = StartMLEEditor(dcd->hwndParent, 2195 (INT)mp1, (CHAR *)mp2, dcd->hwndFrame); 2180 2196 free((CHAR *)mp2); 2181 2197 return MRFROMLONG(hwnd); … … 2761 2777 LISTINFO *li; 2762 2778 ULONG action = UM_ACTION; 2763 # ifdef FORTIFY2764 Fortify_EnterScope();2765 # endif2779 # ifdef FORTIFY 2780 Fortify_EnterScope(); 2781 # endif 2766 2782 li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__); 2767 2783 if (li) { … … 2771 2787 if (!li->list || !li->list[0]) { 2772 2788 free(li); 2773 # ifdef FORTIFY2774 Fortify_LeaveScope();2775 # endif2776 2789 break; 2777 2790 } … … 2789 2802 mp1 = MPFROM2SHORT(IDM_INFO, SHORT2FROMMP(mp1)); 2790 2803 li->type = IDM_INFO; 2791 break;2792 2804 } 2793 2805 } … … 2811 2823 case IDM_MCIPLAY: 2812 2824 action = UM_MASSACTION; 2813 break;2814 2825 } 2815 2826 if (SHORT1FROMMP(mp1) == IDM_SHADOW || … … 2821 2832 } 2822 2833 } 2834 # ifdef FORTIFY 2835 Fortify_LeaveScope(); 2836 # endif 2823 2837 } 2824 2838 break; … … 2935 2949 EmptyCnr(hwnd); 2936 2950 if (apphead) { 2937 2938 2951 APPNOTIFY *info, *next; 2939 2940 2952 info = apphead; 2941 2953 while (info) { … … 2946 2958 apphead = apptail = NULL; 2947 2959 } 2948 break; 2949 } 2960 # ifdef FORTIFY 2961 // if (dcd) 2962 // Fortify_ChangeScope(dcd, -1); 2963 Fortify_LeaveScope(); 2964 // if (dcd) 2965 // Fortify_ChangeScope(dcd, -1); 2966 # endif 2967 break; // WM_DESTROY 2968 } // switch 2950 2969 if (dcd && dcd->oldproc){ 2951 2970 return dcd->oldproc(hwnd, msg, mp1, mp2); … … 2998 3017 # ifdef FORTIFY 2999 3018 Fortify_EnterScope(); 3000 # endif3019 # endif 3001 3020 dcd = xmallocz(sizeof(DIRCNRDATA), pszSrcFile, __LINE__); 3002 3021 if (!dcd) { … … 3007 3026 else { 3008 3027 SWP swp; 3009 3010 3028 WinQueryWindowPos(hwndFrame, &swp); 3011 3029 if (*(ULONG *) realappname == FM3UL) { … … 3082 3100 IDS_WINCREATEWINDOW); 3083 3101 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID); 3084 free(dcd); 3085 # ifdef FORTIFY 3086 Fortify_LeaveScope(); 3087 # endif 3102 free(dcd); 3103 dcd = 0; 3088 3104 hwndFrame = (HWND) 0; 3089 3105 } … … 3109 3125 } 3110 3126 } 3127 # ifdef FORTIFY 3128 if (dcd) 3129 Fortify_ChangeScope(dcd, -1); 3130 Fortify_LeaveScope(); 3131 if (dcd) 3132 Fortify_ChangeScope(dcd, +1); 3133 # endif 3111 3134 } 3112 3135 return hwndFrame;  - 
      
trunk/dll/ufortify.h
r1015 r1077 8 8 * User options for fortify. Changes to this file require fortify.c to be 9 9 * recompiled, but nothing else. 10 */ 11 12 /* 18 Jul 08 SHL Add FORTIFY_VERBOSE_SCOPE_ENTER_EXIT 10 13 */ 11 14 … … 45 48 /* #define FORTIFY_WARN_WHEN_DISCARDING_DEALLOCATED_MEMORY */ 46 49 /* #define FORTIFY_VERBOSE_WARN_WHEN_DISCARDING_DEALLOCATED_MEMORY */ 50 #define FORTIFY_VERBOSE_SCOPE_ENTER_EXIT /* Log all scope entry and exit */ 47 51 48 52 /* #define FORTIFY_NO_PERCENT_P */ /* sprintf() doesn't support %p */  - 
      
trunk/dll/walkem.c
r1039 r1077 3 3 4 4 $Id$ 5 6 Misc persistent lists support 5 7 6 8 Copyright (c) 1993-98 M. Kimes … … 47 49 #include "errutil.h" // Dos_Error... 48 50 #include "strutil.h" // GetPString 49 #include "notebook.h" // targetdirectory51 #include "notebook.h" // targetdirectory 50 52 #include "fm3dll.h" 51 53 #include "fortify.h" 54 #include "walkem.h" 52 55 53 56 #pragma data_seg(DATA1) … … 309 312 return lookup_setup(name, LS_DELETE); 310 313 } 314 315 #ifdef FORTIFY 316 317 VOID free_setups(VOID) 318 { 319 LINKDIRS *pld = pFirstSetup; 320 while (pld) { 321 LINKDIRS *next = pld->next; 322 free(pld->path); 323 free(pld); 324 pld = next; 325 } 326 pFirstSetup = NULL; 327 } 328 329 #endif // FORTIFY 311 330 312 331 VOID load_udirs(VOID) … … 460 479 else 461 480 last->next = info; 462 }481 } 463 482 return TRUE; 464 483 } … … 707 726 PrfQueryProfileData(fmprof, FM3Str, "WalkDir.Position", (PVOID) &swp, &size); 708 727 WinSetWindowPos(hwnd, 709 HWND_TOP,710 swp.x,711 swp.y,712 swp.cx,713 swp.cy,714 swp.fl);728 HWND_TOP, 729 swp.x, 730 swp.y, 731 swp.cx, 732 swp.cy, 733 swp.fl); 715 734 } 716 735 PosOverOkay(hwnd); … … 1195 1214 } 1196 1215 { 1197 SWP swp;1198 ULONG size = sizeof(SWP);1199 1200 WinQueryWindowPos(hwnd, &swp);1201 PrfWriteProfileData(fmprof, FM3Str, "WalkDir.Position", (PVOID) &swp,1202 size);1216 SWP swp; 1217 ULONG size = sizeof(SWP); 1218 1219 WinQueryWindowPos(hwnd, &swp); 1220 PrfWriteProfileData(fmprof, FM3Str, "WalkDir.Position", (PVOID) &swp, 1221 size); 1203 1222 } 1204 1223 if (wa->changed) … … 1216 1235 case DID_CANCEL: 1217 1236 { 1218 SWP swp;1219 ULONG size = sizeof(SWP);1220 1221 WinQueryWindowPos(hwnd, &swp);1222 PrfWriteProfileData(fmprof, FM3Str, "WalkDir.Position", (PVOID) &swp,1223 size);1237 SWP swp; 1238 ULONG size = sizeof(SWP); 1239 1240 WinQueryWindowPos(hwnd, &swp); 1241 PrfWriteProfileData(fmprof, FM3Str, "WalkDir.Position", (PVOID) &swp, 1242 size); 1224 1243 } 1225 1244 if (wa->changed) 1226 WinSendMsg(hwnd, UM_SETUP3, MPVOID, MPVOID);1245 WinSendMsg(hwnd, UM_SETUP3, MPVOID, MPVOID); 1227 1246 free(wa); 1228 1247 WinDismissDlg(hwnd, 0); … … 1232 1251 1233 1252 case WM_CLOSE: 1234 break;1253 break; 1235 1254 } 1236 1255 return WinDefDlgProc(hwnd, msg, mp1, mp2); … … 1336 1355 PrfQueryProfileData(fmprof, FM3Str, "WalkDir2.Position", (PVOID) &swp, &size); 1337 1356 WinSetWindowPos(hwnd, 1338 HWND_TOP,1339 swp.x,1340 swp.y,1341 swp.cx,1342 swp.cy,1343 swp.fl);1357 HWND_TOP, 1358 swp.x, 1359 swp.y, 1360 swp.cx, 1361 swp.cy, 1362 swp.fl); 1344 1363 } 1345 1364 if (!*wa->szCurrentPath1) … … 1614 1633 WinQueryWindowPos(hwnd, &swp); 1615 1634 PrfWriteProfileData(fmprof, FM3Str, "WalkDir2.Position", (PVOID) &swp, 1616 size);1635 size); 1617 1636 } 1618 1637 WinDismissDlg(hwnd, 1); … … 1633 1652 WinQueryWindowPos(hwnd, &swp); 1634 1653 PrfWriteProfileData(fmprof, FM3Str, "WalkDir2.Position", (PVOID) &swp, 1635 size);1654 size); 1636 1655 } 1637 1656 WinDismissDlg(hwnd, 0);  - 
      
trunk/dll/worker.c
r1075 r1077 25 25 26 Aug 07 SHL Revert to DosSleep(0) 26 26 29 Feb 08 GKY Refactor global command line variables to notebook.h 27 22 Jun 08 GKY Made Felete move to xworkplace trash can on systems that have it27 22 Jun 08 GKY Made Felete move to xworkplace trash can on systems that have it 28 28 16 JUL 08 GKY Use TMP directory for temp files 29 29 … … 51 51 #include "errutil.h" // Dos_Error... 52 52 #include "strutil.h" // GetPString 53 #include "notebook.h" // External viewers53 #include "notebook.h" // External viewers 54 54 #include "fm3dll.h" 55 55 … … 85 85 # endif 86 86 li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__); 87 if (li) {87 if (li) { 88 88 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__); 89 89 if (wk) { … … 105 105 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 106 106 FreeListInfo(wk->li); 107 free(wk);108 # ifdef FORTIFY109 Fortify_LeaveScope();110 # endif107 free(wk); 108 # ifdef FORTIFY 109 Fortify_LeaveScope(); 110 # endif 111 111 } 112 112 } … … 1001 1001 if (wk) { 1002 1002 # ifdef FORTIFY 1003 // Fortify_ChangeOwner(wk); 1003 1004 Fortify_EnterScope(); 1004 # endif1005 # endif 1005 1006 if (wk->li && wk->li->list && wk->li->list[0]) { 1006 1007 hab2 = WinInitialize(0); … … 1068 1069 if (total > 1000) { 1069 1070 1070 FILE *fp;1071 CHAR szTempFile[CCHMAXPATH];1072 1073 BldFullPathName(szTempFile, pTmpDir, "$FM2PLAY.$$$");1071 FILE *fp; 1072 CHAR szTempFile[CCHMAXPATH]; 1073 1074 BldFullPathName(szTempFile, pTmpDir, "$FM2PLAY.$$$"); 1074 1075 fp = xfopen(szTempFile, "w", pszSrcFile, __LINE__); 1075 1076 if (fp) { … … 1078 1079 fprintf(fp, "%s\n", wk->li->list[x]); 1079 1080 fprintf(fp, ";end\n"); 1080 fclose(fp);1081 strrev(szTempFile);1082 strcat(szTempFile, "@/");1083 strrev(szTempFile);1081 fclose(fp); 1082 strrev(szTempFile); 1083 strcat(szTempFile, "@/"); 1084 strrev(szTempFile); 1084 1085 RunFM2Util("FM2PLAY.EXE", szTempFile); 1085 1086 } … … 1450 1451 CHAR prompt[CCHMAXPATH * 3]; 1451 1452 APIRET error; 1452 HOBJECT hObjectdest, hObjectofObject;1453 HOBJECT hObjectdest, hObjectofObject; 1453 1454 1454 1455 for (x = 0; wk->li->list[x]; x++) { … … 1574 1575 AddNote(prompt); 1575 1576 DosError(FERR_DISABLEHARDERR); 1576 if (wk->li->type == IDM_DELETE){1577 hObjectdest = WinQueryObject("<XWP_TRASHCAN>");1578 if (hObjectdest != NULLHANDLE){1579 hObjectofObject = WinQueryObject(wk->li->list[x]);1580 error = WinMoveObject(hObjectofObject, hObjectdest, 0);1581 }1582 else1583 error = DosDelete(wk->li->list[x]);1584 }1577 if (wk->li->type == IDM_DELETE){ 1578 hObjectdest = WinQueryObject("<XWP_TRASHCAN>"); 1579 if (hObjectdest != NULLHANDLE){ 1580 hObjectofObject = WinQueryObject(wk->li->list[x]); 1581 error = WinMoveObject(hObjectofObject, hObjectdest, 0); 1582 } 1583 else 1584 error = DosDelete(wk->li->list[x]); 1585 } 1585 1586 else 1586 1587 error = DosForceDelete(wk->li->list[x]); … … 1589 1590 make_deleteable(wk->li->list[x]); 1590 1591 if (wk->li->type == IDM_DELETE){ 1591 hObjectdest = WinQueryObject("<XWP_TRASHCAN>");1592 if (hObjectdest != NULLHANDLE){1593 hObjectofObject = WinQueryObject(wk->li->list[x]);1594 error = WinMoveObject(hObjectofObject, hObjectdest, 0);1595 }1596 else1597 error = DosDelete(wk->li->list[x]);1598 }1592 hObjectdest = WinQueryObject("<XWP_TRASHCAN>"); 1593 if (hObjectdest != NULLHANDLE){ 1594 hObjectofObject = WinQueryObject(wk->li->list[x]); 1595 error = WinMoveObject(hObjectofObject, hObjectdest, 0); 1596 } 1597 else 1598 error = DosDelete(wk->li->list[x]); 1599 } 1599 1600 else 1600 1601 error = DosForceDelete(wk->li->list[x]);  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  