Changeset 1159 for trunk/dll/misc.c
- Timestamp:
- Sep 5, 2008, 11:41:13 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/misc.c
r1120 r1159 1 2 1 /*********************************************************************** 3 2 … … 42 41 29 Feb 08 GKY Use xfree where appropriate 43 42 08 Mar 08 JBS Ticket 230: Replace prefixless INI keys for default directory containers with 44 43 keys using a "DirCnr." prefix 45 44 19 Jun 08 JBS Ticket 239: Fix LoadDetailsSwitches so INI file is read correctly and details 46 45 switches are set correctly. 47 46 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating 48 49 47 all the details view settings (both the global variables and those in the 48 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS. 50 49 17 Jul 08 SHL Add GetTidForWindow for Fortify support 51 50 20 Jul 08 GKY Add save/append filename to clipboard. … … 59 58 #include <ctype.h> 60 59 #include <share.h> 61 #include <malloc.h> 60 #include <malloc.h> // _heapmin 62 61 63 62 #define INCL_DOS … … 68 67 #include "fm3dlg.h" 69 68 #include "fm3str.h" 70 #include "pathutil.h" // BldQuotedFileName 71 #include "errutil.h" // Dos_Error... 72 #include "strutil.h" // GetPString 73 #include "command.h" // LINKCMDS 69 #include "pathutil.h" // BldQuotedFileName 70 #include "errutil.h" // Dos_Error... 71 #include "strutil.h" // GetPString 72 #include "command.h" // LINKCMDS 73 #include "cmdline.h" // CmdLineDlgProc 74 #include "defview.h" // QuickView 75 #include "copyf.h" // WriteLongName 76 #include "strips.h" // chop_at_crnl 74 77 #include "fm3dll.h" 78 #include "fortify.h" 75 79 #include "misc.h" 76 #include "fortify.h"77 80 78 81 #pragma data_seg(DATA1) … … 81 84 82 85 #ifndef BEGIN_LIBPATH 83 #define BEGIN_LIBPATH 86 #define BEGIN_LIBPATH 1 84 87 #endif 85 88 86 89 #ifndef END_LIBPATH 87 #define END_LIBPATH 90 #define END_LIBPATH 2 88 91 #endif 89 92 … … 101 104 if (rc) { 102 105 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 103 106 "DosGetInfoBlocks"); 104 107 yes = FALSE; 105 108 } … … 112 115 // OK for window to be dead - just return FALSE 113 116 yes = WinQueryWindowProcess(hwnd, &pid, &tid) && 114 115 117 pid == ppib->pib_ulpid && 118 (!chkTid || tid == ptib->tib_ptib2->tib2_ultid); 116 119 } 117 120 return yes; … … 136 139 if (rc) { 137 140 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 138 141 "DosGetInfoBlocks"); 139 142 } 140 143 else { … … 142 145 TID tid; 143 146 if (!WinQueryWindowProcess(hwnd, &pid, &tid)) 144 147 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryWindowProcess failed for %X", hwnd); 145 148 else if (pid != ppib->pib_ulpid) 146 149 Runtime_Error(pszSrcFile, __LINE__, "hwnd %X not created by fm/2", hwnd); 147 150 else 148 151 ordinal = ptib->tib_ptib2->tib2_ultid; 149 152 } 150 153 return ordinal; … … 165 168 if (rc) { 166 169 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 167 170 "DosGetInfoBlocks"); 168 171 } 169 172 else … … 272 275 WinQueryWindowText(hwnd, CCHMAXPATH, s); 273 276 if (*s) { 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 277 rcl.xRight -= 3; 278 p = s; 279 GpiQueryTextBox(hps, 3, "...", TXTBOX_COUNT, aptl); 280 len = aptl[TXTBOX_TOPRIGHT].x; 281 do { 282 GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl); 283 if (aptl[TXTBOX_TOPRIGHT].x > (rcl.xRight - (p != s ? len : 0))) 284 p++; 285 else 286 break; 287 } 288 while (*p); 289 if (*p) { 290 GpiSetMix(hps, FM_OVERPAINT); 291 GpiSetColor(hps, CLR_BLACK); 292 ptl.x = 3; 293 ptl.y = ((rcl.yTop / 2) - 294 ((aptl[TXTBOX_TOPRIGHT].y + 295 aptl[TXTBOX_BOTTOMLEFT].y) / 2)); 296 GpiMove(hps, &ptl); 297 if (p != s) 298 GpiCharString(hps, 3, "..."); 299 GpiCharString(hps, strlen(p), p); 300 } 298 301 } 299 302 free(s); … … 379 382 { 380 383 PFIELDINFO pfi = (PFIELDINFO) WinSendMsg(hwndCnr, 381 382 384 CM_QUERYDETAILFIELDINFO, 385 MPVOID, MPFROMSHORT(CMA_FIRST)); 383 386 384 387 while (pfi) { 385 388 if (!strcmp(pfi->pTitleData, title)) { 386 389 if (toggle) { 387 388 389 390 391 390 if (pfi->flData & CFA_INVISIBLE) 391 pfi->flData &= (~CFA_INVISIBLE); 392 else 393 pfi->flData |= CFA_INVISIBLE; 394 return !(pfi->flData & CFA_INVISIBLE); 392 395 } 393 396 else { 394 395 396 397 397 if (visible) 398 pfi->flData &= (~CFA_INVISIBLE); 399 else 400 pfi->flData |= CFA_INVISIBLE; 398 401 } 399 402 return TRUE; … … 407 410 { 408 411 PFIELDINFO pfi = (PFIELDINFO) WinSendMsg(hwndCnr, 409 410 412 CM_QUERYDETAILFIELDINFO, 413 MPVOID, MPFROMSHORT(CMA_FIRST)); 411 414 412 415 while (pfi) { 413 416 if (!strcmp(pfi->pTitleData, title)) { 414 417 if (toggle) { 415 416 417 418 419 418 if (pfi->flData & CFA_FIREADONLY) 419 pfi->flData &= (~CFA_FIREADONLY); 420 else 421 pfi->flData |= CFA_FIREADONLY; 422 return (pfi->flData & CFA_FIREADONLY); 420 423 } 421 424 else { 422 423 424 425 425 if (!readonly) 426 pfi->flData &= (~CFA_FIREADONLY); 427 else 428 pfi->flData |= CFA_FIREADONLY; 426 429 } 427 430 return TRUE; … … 445 448 if (x != -1) { 446 449 if (!stricmp(FileSystem, HPFS) || 447 448 449 450 451 452 450 !stricmp(FileSystem, JFS) || 451 !stricmp(FileSystem, FAT32) || 452 !stricmp(FileSystem, RAMFS) || 453 !stricmp(FileSystem, NDFS32) || 454 !stricmp(FileSystem, NTFS) || 455 !stricmp(FileSystem, HPFS386)) { 453 456 hasCreateDT = TRUE; 454 457 hasAccessDT = TRUE; … … 474 477 } 475 478 AdjustCnrColVis(hwndCnr, 476 477 478 479 GetPString(IDS_LADATE), 480 pds->detailsladate ? hasAccessDT : FALSE, 481 FALSE); 479 482 AdjustCnrColVis(hwndCnr, 480 481 482 483 GetPString(IDS_LATIME), 484 pds->detailslatime ? hasAccessDT : FALSE, 485 FALSE); 483 486 AdjustCnrColVis(hwndCnr, 484 485 486 487 GetPString(IDS_CRDATE), 488 pds->detailscrdate ? hasCreateDT : FALSE, 489 FALSE); 487 490 AdjustCnrColVis(hwndCnr, 488 489 490 491 GetPString(IDS_CRTIME), 492 pds->detailscrtime ? hasCreateDT : FALSE, 493 FALSE); 491 494 AdjustCnrColVis(hwndCnr, 492 493 494 495 GetPString(IDS_LNAME), 496 pds->detailslongname ? hasLongNames : FALSE, 497 FALSE); 495 498 WinSendMsg(hwndCnr, CM_INVALIDATEDETAILFIELDINFO, MPVOID, MPVOID); 496 499 } 497 500 498 501 VOID AdjustCnrColsForPref(HWND hwndCnr, CHAR * directory, DETAILS_SETTINGS * pds, 499 502 BOOL compare) 500 503 { 501 504 502 505 AdjustCnrColVis(hwndCnr, 503 504 505 506 compare ? GetPString(IDS_STATUS) : GetPString(IDS_SUBJ), 507 pds->detailssubject, 508 FALSE); 506 509 507 510 AdjustCnrColVis(hwndCnr, GetPString(IDS_ATTR), pds->detailsattr, FALSE); … … 532 535 533 536 pfi = WinSendMsg(hwndCnr, CM_ALLOCDETAILFIELDINFO, 534 537 MPFROMLONG(CONTAINER_COLUMNS), NULL); 535 538 536 539 if (!pfi) { … … 582 585 pfi->flData = CFA_STRING | CFA_LEFT | CFA_SEPARATOR; 583 586 if (isCompCnr) 584 587 pfi->flData |= CFA_FIREADONLY; 585 588 pfi->flTitle = CFA_LEFT | CFA_FITITLEREADONLY; 586 589 pfi->pTitleData = isCompCnr ? GetPString(IDS_STATUS) : 587 590 GetPString(IDS_SUBJ); 588 591 pfi->offStruct = FIELDOFFSET(CNRITEM, pszSubject); 589 592 pfi->cxWidth = dsDirCnrDefault.SubjectDisplayWidth; … … 602 605 pfi->flData = CFA_STRING | CFA_LEFT | CFA_SEPARATOR; 603 606 if (isCompCnr) 604 607 pfi->flData |= CFA_FIREADONLY; 605 608 pfi->flTitle = CFA_LEFT | CFA_FITITLEREADONLY; 606 609 pfi->pTitleData = isCompCnr ? GetPString(IDS_STATUS) : 607 610 GetPString(IDS_SUBJ); 608 611 pfi->offStruct = FIELDOFFSET(CNRITEM, pszSubject); 609 612 pfi->cxWidth = dsDirCnrDefault.SubjectDisplayWidth; … … 697 700 698 701 if (!WinSendMsg(hwndCnr, CM_INSERTDETAILFIELDINFO, MPFROMP(pfiFirst), 699 702 MPFROMP(&fii))) { 700 703 Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_INSERTDETAILFIELDINFO"); 701 704 fSuccess = FALSE; … … 716 719 size = sizeof(LONG); 717 720 PrfQueryProfileData(fmprof, 718 721 appname, "CnrSplitBar", &cnri.xVertSplitbar, &size); 719 722 if (cnri.xVertSplitbar <= 0) 720 723 cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32; 721 724 if (!WinSendMsg(hwndCnr, CM_SETCNRINFO, MPFROMP(&cnri), 722 723 725 MPFROMLONG(CMA_PFIELDINFOLAST | CMA_PFIELDINFOOBJECT | 726 CMA_XVERTSPLITBAR))) { 724 727 Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_SETCNRINFO"); 725 728 fSuccess = FALSE; … … 739 742 740 743 if (pci && 741 742 743 744 745 746 747 748 749 750 744 (INT) pci != -1 && 745 !IsRoot(pci->pszFileName) && 746 !(pci->flags & RECFLAGS_ENV) && !(pci->flags & RECFLAGS_UNDERENV)) { 747 if (!pfi || pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName)) { 748 PostMsg(hwnd, UM_FIXEDITNAME, MPFROMP(pci->pszFileName), MPVOID); 749 } 750 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, pszSubject)) 751 PostMsg(hwnd, UM_FIXCNRMLE, MPFROMLONG(1048), MPVOID); 752 else 753 PostMsg(hwnd, UM_FIXCNRMLE, MPFROMLONG(CCHMAXPATH), MPVOID); 751 754 } 752 755 else 753 756 PostMsg(hwnd, CM_CLOSEEDIT, MPVOID, MPVOID); 754 757 } 755 758 break; … … 763 766 764 767 if (pci && (INT) pci != -1 && !IsRoot(pci->pszFileName)) { 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 768 if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszSubject)) { 769 770 APIRET rc; 771 EAOP2 eaop; 772 PFEA2LIST pfealist = NULL; 773 CHAR szSubject[1048]; 774 ULONG ealen; 775 USHORT len; 776 CHAR *eaval; 777 LONG retlen; 778 PSZ psz; 779 780 retlen = WinQueryWindowText(hwndMLE, sizeof(szSubject), szSubject); 781 szSubject[retlen + 1] = 0; 782 bstrip(szSubject); 783 if (pci->pszSubject != NullStr) { 784 if (retlen == 0) { 785 psz = pci->pszSubject; 786 pci->pszSubject = NullStr; 787 xfree(psz, pszSrcFile, __LINE__); 788 } 789 else 790 pci->pszSubject = xrealloc(pci->pszSubject, retlen + 1, pszSrcFile, __LINE__); 791 } 792 else { 793 pci->pszSubject = xmalloc(retlen + 1, pszSrcFile, __LINE__); 794 if (!pci->pszSubject) 795 return FALSE; 796 } 797 len = strlen(szSubject); 798 if (len) 799 ealen = sizeof(FEA2LIST) + 9 + len + 4; 800 else 801 ealen = sizeof(FEALIST) + 9; 802 rc = DosAllocMem((PPVOID) & pfealist, ealen + 64, 803 OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE); 804 if (rc) 805 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, 806 __LINE__, GetPString(IDS_OUTOFMEMORY)); 807 else { 808 memset(pfealist, 0, ealen + 1); 809 pfealist->cbList = ealen; 810 pfealist->list[0].oNextEntryOffset = 0; 811 pfealist->list[0].fEA = 0; 812 pfealist->list[0].cbName = 8; 813 strcpy(pfealist->list[0].szName, SUBJECT); 814 if (len) { 815 eaval = pfealist->list[0].szName + 9; 816 *(USHORT *) eaval = (USHORT) EAT_ASCII; 817 eaval += sizeof(USHORT); 818 *(USHORT *) eaval = (USHORT) len; 819 eaval += sizeof(USHORT); 820 memcpy(eaval, szSubject, len); 821 pfealist->list[0].cbValue = len + (sizeof(USHORT) * 2); 822 } 823 else 824 pfealist->list[0].cbValue = 0; 825 eaop.fpGEA2List = (PGEA2LIST) 0; 826 eaop.fpFEA2List = pfealist; 827 eaop.oError = 0; 828 rc = xDosSetPathInfo(pci->pszFileName, FIL_QUERYEASIZE, 829 &eaop, sizeof(eaop), DSPI_WRTTHRU); 830 DosFreeMem(pfealist); 831 if (rc) 832 return FALSE; 833 } 834 return (MRESULT) TRUE; 835 } 836 else if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszLongName)) { 837 838 CHAR longname[CCHMAXPATHCOMP]; 839 LONG retlen; 840 PSZ psz; 841 842 *longname = 0; 843 retlen = WinQueryWindowText(hwndMLE, sizeof(longname), longname); 844 longname[retlen + 1] = 0; 845 chop_at_crnl(longname); 846 bstrip(longname); 847 WinSetWindowText(hwndMLE, longname); 848 if (pci->pszLongName != NullStr) { 849 if (retlen == 0) { 850 psz = pci->pszLongName; 851 pci->pszLongName = NullStr; 852 xfree(psz, pszSrcFile, __LINE__); 853 } 854 else 855 pci->pszLongName = xrealloc(pci->pszLongName, retlen + 1, pszSrcFile, __LINE__); 856 } 857 else { 858 pci->pszLongName = xmalloc(retlen + 1, pszSrcFile, __LINE__); 859 if (!pci->pszLongName) 860 return FALSE; 861 } 862 return (MRESULT) WriteLongName(pci->pszFileName, longname); 863 } 864 else { 865 WinQueryWindowText(hwndMLE, sizeof(szData), szData); 866 if (strchr(szData, '?') || 867 strchr(szData, '*') || IsRoot(pci->pszFileName)) 868 return (MRESULT) FALSE; 869 /* If the text changed, rename the file system object. */ 870 chop_at_crnl(szData); 871 bstrip(szData); 872 if (!IsFullName(szData)) 873 Runtime_Error(pszSrcFile, __LINE__, "bad name"); 874 else { 875 if (DosQueryPathInfo(szData, 876 FIL_QUERYFULLNAME, 877 testname, sizeof(testname))) 878 return FALSE; 879 if (DosQueryPathInfo(pci->pszFileName, 880 FIL_QUERYFULLNAME, 881 szData, 882 sizeof(szData))) 883 { 884 pci->pszFileName = xrealloc(pci->pszFileName, sizeof(szData), pszSrcFile, __LINE__); 885 strcpy(szData, pci->pszFileName); 886 } 887 WinSetWindowText(hwndMLE, szData); 888 if (strcmp(szData, testname)) { 889 if (stricmp(szData, testname) && IsFile(testname) != -1) { 890 DosBeep(50, 100); /* exists; disallow */ 891 return (MRESULT) FALSE; 892 } 893 if (docopyf(MOVE, szData, "%s", testname)) 894 Runtime_Error(pszSrcFile, __LINE__, "docopyf"); 895 else { 896 CHAR *filename; 897 898 filename = xstrdup(testname, pszSrcFile, __LINE__); 899 if (filename) { 900 if (!PostMsg(hwnd, 901 UM_FIXEDITNAME, MPVOID, MPFROMP(filename))) 902 free(filename); 903 } 904 if (stricmp(testname, pci->pszFileName)) { 905 PostMsg(hwnd, UM_FIXEDITNAME, MPFROMLONG(-1), MPFROMP(pci)); 906 filename = xstrdup(pci->pszFileName, pszSrcFile, __LINE__); 907 if (filename) { 908 if (!PostMsg(hwnd, 909 UM_FIXEDITNAME, MPVOID, MPFROMP(filename))) 910 free(filename); 911 } 912 } 913 } 914 } 915 } 916 } 914 917 } 915 918 } … … 922 925 923 926 if (pci && (INT) pci != -1 && !IsRoot(pci->pszFileName)) { 924 925 926 927 928 929 927 WinSendMsg(hwnd, 928 CM_INVALIDATERECORD, 929 MPFROMP(&pci), 930 MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED)); 931 if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName)) 932 PostMsg(hwnd, UM_SORTRECORD, MPVOID, MPVOID); 930 933 } 931 934 else { 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 935 USHORT cmd = 0; 936 937 if (!pfi || pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName)) 938 cmd = IDM_SORTSMARTNAME; 939 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, cbFile)) 940 cmd = IDM_SORTSIZE; 941 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, easize)) 942 cmd = IDM_SORTEASIZE; 943 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, date)) 944 cmd = IDM_SORTLWDATE; 945 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, time)) 946 cmd = IDM_SORTLWDATE; 947 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, ladate)) 948 cmd = IDM_SORTLADATE; 949 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, latime)) 950 cmd = IDM_SORTLADATE; 951 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, crdate)) 952 cmd = IDM_SORTCRDATE; 953 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, crtime)) 954 cmd = IDM_SORTCRDATE; 955 if (cmd) 956 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID); 954 957 } 955 958 } … … 960 963 961 964 BOOL SetMenuCheck(HWND hwndMenu, USHORT id, BOOL * bool, BOOL toggle, 962 965 CHAR * savename) 963 966 { 964 967 if (toggle) { … … 968 971 } 969 972 WinSendMsg(hwndMenu, MM_SETITEMATTR, 970 971 973 MPFROM2SHORT(id, 1), 974 MPFROM2SHORT(MIA_CHECKED, (*bool ? MIA_CHECKED : 0))); 972 975 return *bool; 973 976 } … … 978 981 { 979 982 WinSendMsg(hwndMenu, MM_SETITEMATTR, 980 981 983 MPFROM2SHORT(id, TRUE), 984 MPFROM2SHORT(MIA_DISABLED, (disable ? MIA_DISABLED : 0))); 982 985 } 983 986 … … 1001 1004 fclose(fp); 1002 1005 ret = runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, pszSrcFile, __LINE__, 1003 1004 1005 1006 NULL, NULL, 1007 "VIEW.EXE \"%s\"", 1008 BldQuotedFileName(szQuotedFileName, filename)); 1006 1009 } 1007 1010 … … 1042 1045 *ex.environment = 0; 1043 1046 ret = WinDlgBox(HWND_DESKTOP, hwnd, CmdLineDlgProc, FM3ModHandle, 1044 1047 EXEC_FRAME, &ex); 1045 1048 if (ret == 1) { 1046 1049 lastflags = ex.flags; 1047 1050 return runemf2(ex.flags, hwnd, pszSrcFile, __LINE__, path, 1048 1049 1051 *ex.environment ? ex.environment : NULL, 1052 "%s", pszCmdLine) != -1; 1050 1053 } 1051 1054 else if (ret != 0) … … 1073 1076 1074 1077 VOID AdjustDetailsSwitches(HWND hwnd, HWND hwndMenu, USHORT cmd, 1075 1076 1078 CHAR * directory, CHAR * keyroot, 1079 DETAILS_SETTINGS * pds, BOOL compare) 1077 1080 { 1078 1081 BOOL *bool = NULL; … … 1143 1146 mi.afStyle = MIS_TEXT; 1144 1147 if (WinSendMsg(hwndMenu, 1145 1146 1147 1148 MM_QUERYITEM, 1149 MPFROM2SHORT(id, TRUE), 1150 MPFROMP(&mi))) 1148 1151 { 1149 1152 WinSetWindowBits(mi.hwndSubMenu, QWL_STYLE, MS_CONDITIONALCASCADE, 1150 1153 MS_CONDITIONALCASCADE); 1151 1154 WinSendMsg(mi.hwndSubMenu, MM_SETDEFAULTITEMID, MPFROMSHORT(def), MPVOID); 1152 1155 WinCheckMenuItem(mi.hwndSubMenu, def, TRUE); … … 1225 1228 else 1226 1229 WinSendMsg(hwndMenu, MM_QUERYITEM, 1227 1230 MPFROM2SHORT(IDM_COMMANDSMENU, TRUE), MPFROMP(&mit)); 1228 1231 if (mit.hwndSubMenu) { 1229 1232 numitems = (SHORT) WinSendMsg(mit.hwndSubMenu, MM_QUERYITEMCOUNT, 1230 1233 MPVOID, MPVOID); 1231 1234 WinSendMsg(mit.hwndSubMenu, MM_DELETEITEM, MPFROMSHORT(-1), MPVOID); 1232 1235 for (x = 0; x < numitems; x++) 1233 1236 WinSendMsg(mit.hwndSubMenu, MM_DELETEITEM, 1234 1237 MPFROMSHORT((SHORT) (x + IDM_COMMANDSTART)), MPVOID); 1235 1238 if (hwndCnr && cmdhead) { 1236 1239 x = 0; … … 1238 1241 while (info) { 1239 1242 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1243 CHAR s[CCHMAXPATH + 24]; 1244 1245 sprintf(s, 1246 "%s%s%s", 1247 info->title, 1248 x < 20 ? "\tCtrl + " : NullStr, 1249 x < 20 && x > 9 ? "Shift + " : NullStr); 1250 if (x < 20) 1251 sprintf(&s[strlen(s)], "%d", 1252 ((x % 10) + 1) == 10 ? 0 : (x % 10) + 1); 1253 mi.id = IDM_COMMANDSTART + x; 1254 mi.afAttribute = (info->flags & ONCE ? MIA_CHECKED : 0) | 1255 (info->flags & PROMPT ? MIA_FRAMED : 0); 1256 mi.afStyle = MIS_TEXT; 1257 if (!(x % 24) && x && info->next) 1258 mi.afStyle |= MIS_BREAK; 1259 WinSendMsg(mit.hwndSubMenu, MM_INSERTITEM, MPFROMP(&mi), MPFROMP(s)); 1260 x++; 1261 info = info->next; 1259 1262 } 1260 1263 } … … 1351 1354 hwndDir = WinWindowFromID(hwndDir, DIR_CNR); 1352 1355 if (hwndDir) 1353 1356 break; 1354 1357 hwndDir = (HWND) 0; 1355 1358 } … … 1368 1371 if (rc) 1369 1372 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 1370 1373 "DosCreateEventSem"); 1371 1374 else { 1372 1375 priority_normal(); 1373 1376 for (;;) { 1374 1377 if (DosWaitEventSem(CompactSem, SEM_INDEFINITE_WAIT)) 1375 1378 break; 1376 1379 _heapmin(); 1377 1380 DosResetEventSem(CompactSem, &postcount); … … 1399 1402 if (dcd->hwndLastMenu && !dcd->cnremphasized) { 1400 1403 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID, 1401 1404 MPFROM2SHORT(TRUE, CRA_SOURCE)); 1402 1405 dcd->cnremphasized = TRUE; 1403 1406 } … … 1405 1408 WinCheckMenuItem(dcd->hwndLastMenu, IDM_MINIICONS, TRUE); 1406 1409 if (!WinPopupMenu(hwnd, hwnd, dcd->hwndLastMenu, 1407 1408 1409 1410 8, 8, 0, 1411 PU_HCONSTRAIN | PU_VCONSTRAIN | 1412 PU_KEYBOARD | PU_MOUSEBUTTON1)) { 1410 1413 if (dcd->cnremphasized) { 1411 1414 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID, 1412 1415 MPFROM2SHORT(FALSE, CRA_SOURCE)); 1413 1416 dcd->cnremphasized = FALSE; 1414 1417 } … … 1416 1419 else 1417 1420 WinSendMsg(dcd->hwndLastMenu, MM_SELECTITEM, 1418 1421 MPFROM2SHORT(id, TRUE), MPFROM2SHORT(0, FALSE)); 1419 1422 } 1420 1423 … … 1426 1429 for (;;) { 1427 1430 pmi = (PMINIRECORDCORE) WinSendMsg(hwndCnr, CM_QUERYRECORDEMPHASIS, 1428 1429 1431 MPFROMLONG(CMA_FIRST), 1432 MPFROMSHORT(attrib)); 1430 1433 if ((!pmi || (INT) pmi == -1) && attrib == CRA_SELECTED) /* punt */ 1431 1434 attrib = CRA_CURSORED; … … 1446 1449 QMSG qmsg; 1447 1450 for (;;) { 1448 1449 1450 1451 break;// OK1452 1453 break;// Window gone1454 1455 break;// Queue has message(s)1456 } 1451 DosSleep(1); 1452 rc = WinPostMsg(h, msg, mp1, mp2); 1453 if (rc) 1454 break; // OK 1455 if (!WinIsWindow((HAB) 0, h)) 1456 break; // Window gone 1457 if (WinPeekMsg((HAB) 0, &qmsg, (HWND) 0, 0, 0, PM_NOREMOVE)) 1458 break; // Queue has message(s) 1459 } // for 1457 1460 } 1458 1461 } … … 1467 1470 1468 1471 pci = (PCNRITEM) WinSendMsg(hwnd, 1469 1470 1471 1472 CM_QUERYRECORDEMPHASIS, 1473 MPFROMLONG(CMA_FIRST), 1474 MPFROMSHORT(CRA_CURSORED)); 1472 1475 if (pci && (INT) pci != -1) { 1473 1476 memset(&ced, 0, sizeof(ced)); … … 1477 1480 ced.pRecord = (PRECORDCORE) pci; 1478 1481 pfi = (PFIELDINFO) WinSendMsg(hwnd, 1479 1480 1482 CM_QUERYDETAILFIELDINFO, 1483 MPVOID, MPFROMSHORT(CMA_FIRST)); 1481 1484 if (!pfi) 1482 1485 WinSendMsg(hwnd, CM_OPENEDIT, MPFROMP(&ced), MPVOID); 1483 1486 else { 1484 1487 while (pfi && (INT) pfi != -1 && 1485 1486 1487 1488 1488 pfi->offStruct != FIELDOFFSET(CNRITEM, pszFileName)) 1489 pfi = (PFIELDINFO) WinSendMsg(hwnd, 1490 CM_QUERYDETAILFIELDINFO, 1491 MPFROMP(pfi), MPFROMSHORT(CMA_NEXT)); 1489 1492 if (pfi && (INT) pfi != -1) { 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1493 ced.pFieldInfo = pfi; 1494 { 1495 CNRINFO cnri; 1496 1497 memset(&cnri, 0, sizeof(CNRINFO)); 1498 cnri.cb = sizeof(CNRINFO); 1499 WinSendMsg(hwnd, 1500 CM_QUERYCNRINFO, 1501 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO))); 1502 if (cnri.flWindowAttr & CV_DETAIL) 1503 ced.id = CID_LEFTDVWND; 1504 } 1505 WinSendMsg(hwnd, CM_OPENEDIT, MPFROMP(&ced), MPVOID); 1503 1506 } 1504 1507 } … … 1517 1520 list[1] = NULL; 1518 1521 ExecOnList(hwnd, binview, WINDOWED | SEPARATE, NULL, list, NULL, 1519 1522 pszSrcFile, __LINE__); 1520 1523 return; 1521 1524 } … … 1527 1530 list[1] = NULL; 1528 1531 ExecOnList(hwnd, viewer, 1529 1530 1532 WINDOWED | SEPARATE | (fViewChild ? CHILD : 0), 1533 NULL, list, NULL, pszSrcFile, __LINE__); 1531 1534 return; 1532 1535 } … … 1545 1548 list[1] = NULL; 1546 1549 ExecOnList(hwnd, bined, WINDOWED | SEPARATE, NULL, list, NULL, 1547 1550 pszSrcFile, __LINE__); 1548 1551 return; 1549 1552 } … … 1555 1558 list[1] = NULL; 1556 1559 ExecOnList(hwnd, editor, WINDOWED | SEPARATE, NULL, list, NULL, 1557 1560 pszSrcFile, __LINE__); 1558 1561 return; 1559 1562 } … … 1587 1590 mi.afStyle = MIS_TEXT; 1588 1591 WinSendMsg(hwndMenu, MM_QUERYITEM, 1589 1592 MPFROM2SHORT(IDM_FILESMENU, TRUE), MPFROMP(&mi)); 1590 1593 if (!DefMenu) 1591 1594 DefMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, DEFMENU); 1592 1595 hwndNow = mi.hwndSubMenu; 1593 1596 mi.hwndSubMenu = hwndNew; 1594 1597 if (!mi.hwndSubMenu) 1595 1598 mi.hwndSubMenu = DefMenu; 1596 1599 WinSetParent(hwndNow, WinQueryObjectWindow(HWND_DESKTOP), FALSE); 1597 1600 WinSetOwner(hwndNow, WinQueryObjectWindow(HWND_DESKTOP)); … … 1618 1621 mi.afStyle = MIS_TEXT; 1619 1622 WinSendMsg(hwndMenu, MM_QUERYITEM, 1620 1623 MPFROM2SHORT(IDM_VIEWSMENU, TRUE), MPFROMP(&mi)); 1621 1624 if (!DefMenu) 1622 1625 DefMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, DEFMENU); 1623 1626 hwndNow = mi.hwndSubMenu; 1624 1627 mi.hwndSubMenu = hwndNew; 1625 1628 if (!mi.hwndSubMenu) 1626 1629 mi.hwndSubMenu = DefMenu; 1627 1630 WinSetParent(hwndNow, WinQueryObjectWindow(HWND_DESKTOP), FALSE); 1628 1631 WinSetOwner(hwndNow, WinQueryObjectWindow(HWND_DESKTOP)); … … 1657 1660 SetConditionalCascade(DirMenu, IDM_EDITSUBMENU, IDM_ATTRS); 1658 1661 SetConditionalCascade(DirMenu, IDM_DELETESUBMENU, 1659 1662 fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE); 1660 1663 SetConditionalCascade(DirMenu, IDM_MISCSUBMENU, IDM_SIZES); 1661 1664 SetConditionalCascade(DirMenu, IDM_OPENSUBMENU, IDM_OPENWINDOW); 1662 1665 if (fWorkPlace) { 1663 1664 1665 1666 1666 WinSendMsg(DirMenu, MM_DELETEITEM, 1667 MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID); 1668 WinSendMsg(DirMenu, MM_DELETEITEM, 1669 MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID); 1667 1670 } 1668 1671 } … … 1676 1679 SetConditionalCascade(TreeMenu, IDM_OPENSUBMENU, IDM_OPENWINDOW); 1677 1680 if (fWorkPlace) { 1678 1679 1680 1681 1681 WinSendMsg(TreeMenu, MM_DELETEITEM, 1682 MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID); 1683 WinSendMsg(TreeMenu, MM_DELETEITEM, 1684 MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID); 1682 1685 } 1683 1686 } … … 1688 1691 SetConditionalCascade(ArcMenu, IDM_VIEWSUBMENU, IDM_VIEW); 1689 1692 if (fWorkPlace) 1690 1691 1693 WinSendMsg(ArcMenu, MM_DELETEITEM, 1694 MPFROM2SHORT(IDM_FOLDERAFTEREXTRACT, TRUE), MPVOID); 1692 1695 } 1693 1696 else if (hwndMenu == &FileMenu) { … … 1701 1704 SetConditionalCascade(FileMenu, IDM_COLLECTMENU, IDM_COLLECT); 1702 1705 SetConditionalCascade(FileMenu, IDM_DELETESUBMENU, 1703 1706 fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE); 1704 1707 SetConditionalCascade(FileMenu, IDM_OPENSUBMENU, IDM_OPENDEFAULT); 1705 1708 SetConditionalCascade(FileMenu, IDM_OBJECTSUBMENU, IDM_SHADOW); 1706 1709 if (fWorkPlace) { 1707 1708 1709 1710 1710 WinSendMsg(FileMenu, MM_DELETEITEM, 1711 MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID); 1712 WinSendMsg(FileMenu, MM_DELETEITEM, 1713 MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID); 1711 1714 } 1712 1715 } … … 1716 1719 SetConditionalCascade(DirCnrMenu, IDM_OPENSUBMENU, IDM_OPENSETTINGSME); 1717 1720 if (fWorkPlace) 1718 1719 1721 WinSendMsg(DirCnrMenu, MM_DELETEITEM, 1722 MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID); 1720 1723 } 1721 1724 else if (hwndMenu == &TreeCnrMenu) { … … 1727 1730 SetConditionalCascade(ArcCnrMenu, IDM_EXTRACTSUBMENU, IDM_ARCEXTRACT); 1728 1731 if (fWorkPlace) 1729 1730 1732 WinSendMsg(ArcCnrMenu, MM_DELETEITEM, 1733 MPFROM2SHORT(IDM_FOLDERAFTEREXTRACT, TRUE), MPVOID); 1731 1734 } 1732 1735 else if (hwndMenu == &CollectorCnrMenu) { 1733 1736 WinSetWindowUShort(CollectorCnrMenu, QWS_ID, IDM_VIEWSMENU); 1734 1737 SetConditionalCascade(CollectorCnrMenu, IDM_COLLECTMENU, 1735 1738 IDM_COLLECTFROMCLIP); 1736 1739 } 1737 1740 else if (hwndMenu == &CollectorFileMenu) { 1738 1741 WinSetWindowUShort(CollectorFileMenu, QWS_ID, IDM_FILESMENU); 1739 1742 SetConditionalCascade(CollectorFileMenu, IDM_COMMANDSMENU, 1740 1743 IDM_DOITYOURSELF); 1741 1744 SetConditionalCascade(CollectorFileMenu, IDM_COPYMENU, IDM_COPY); 1742 1745 SetConditionalCascade(CollectorFileMenu, IDM_MOVEMENU, IDM_MOVE); … … 1746 1749 SetConditionalCascade(CollectorFileMenu, IDM_EDITSUBMENU, IDM_EDIT); 1747 1750 SetConditionalCascade(CollectorFileMenu, IDM_DELETESUBMENU, 1748 1751 fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE); 1749 1752 SetConditionalCascade(CollectorFileMenu, IDM_OPENSUBMENU, 1750 1753 IDM_OPENDEFAULT); 1751 1754 SetConditionalCascade(CollectorFileMenu, IDM_OBJECTSUBMENU, IDM_SHADOW); 1752 1755 if (fWorkPlace) { 1753 1754 1755 1756 1756 WinSendMsg(CollectorFileMenu, MM_DELETEITEM, 1757 MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID); 1758 WinSendMsg(CollectorFileMenu, MM_DELETEITEM, 1759 MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID); 1757 1760 } 1758 1761 } … … 1760 1763 WinSetWindowUShort(CollectorDirMenu, QWS_ID, IDM_FILESMENU); 1761 1764 SetConditionalCascade(CollectorDirMenu, IDM_COMMANDSMENU, 1762 1765 IDM_DOITYOURSELF); 1763 1766 SetConditionalCascade(CollectorDirMenu, IDM_COPYMENU, IDM_COPY); 1764 1767 SetConditionalCascade(CollectorDirMenu, IDM_MOVEMENU, IDM_MOVE); … … 1768 1771 SetConditionalCascade(CollectorDirMenu, IDM_EDITSUBMENU, IDM_ATTRS); 1769 1772 SetConditionalCascade(CollectorDirMenu, IDM_DELETESUBMENU, 1770 1773 fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE); 1771 1774 SetConditionalCascade(CollectorDirMenu, IDM_MISCSUBMENU, IDM_SIZES); 1772 1775 SetConditionalCascade(CollectorDirMenu, IDM_OPENSUBMENU, 1773 1776 IDM_OPENWINDOW); 1774 1777 if (fWorkPlace) { 1775 1776 1777 1778 1778 WinSendMsg(CollectorDirMenu, MM_DELETEITEM, 1779 MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID); 1780 WinSendMsg(CollectorDirMenu, MM_DELETEITEM, 1781 MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID); 1779 1782 } 1780 1783 } … … 1794 1797 1795 1798 ln = (SHORT) WinSendMsg(hwnd, LM_INSERTITEM, MPFROM2SHORT(LIT_END, 0), 1796 1799 MPFROMP(str)); 1797 1800 if (ln) 1798 1801 WinSendMsg(hwnd, LM_SELECTITEM, MPFROM2SHORT(ln, 0), MPVOID); … … 1805 1808 1806 1809 if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT, 1807 1810 MPFROM2SHORT(SC_RESTORE, 128), MPFROMP(s))) { 1808 1811 p = strchr(s, '\t'); 1809 1812 if (p) { … … 1814 1817 } 1815 1818 if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT, 1816 1819 MPFROM2SHORT(SC_CLOSE, 128), MPFROMP(s))) { 1817 1820 p = strchr(s, '\t'); 1818 1821 if (p) { … … 1823 1826 } 1824 1827 if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT, 1825 1828 MPFROM2SHORT(SC_MOVE, 128), MPFROMP(s))) { 1826 1829 p = strchr(s, '\t'); 1827 1830 if (p) { … … 1832 1835 } 1833 1836 if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT, 1834 1837 MPFROM2SHORT(SC_SIZE, 128), MPFROMP(s))) { 1835 1838 p = strchr(s, '\t'); 1836 1839 if (p) { … … 1841 1844 } 1842 1845 if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT, 1843 1846 MPFROM2SHORT(SC_MINIMIZE, 128), MPFROMP(s))) { 1844 1847 p = strchr(s, '\t'); 1845 1848 if (p) { … … 1850 1853 } 1851 1854 if (WinSendMsg(hwndSysMenu, 1852 1853 1855 MM_QUERYITEMTEXT, 1856 MPFROM2SHORT(SC_MAXIMIZE, 128), MPFROMP(s))) { 1854 1857 p = strchr(s, '\t'); 1855 1858 if (p) { … … 1860 1863 } 1861 1864 if (WinSendMsg(hwndSysMenu, 1862 1865 MM_QUERYITEMTEXT, MPFROM2SHORT(SC_HIDE, 128), MPFROMP(s))) { 1863 1866 p = strchr(s, '\t'); 1864 1867 if (p) { … … 1883 1886 *str = 0; 1884 1887 if (DosQuerySysInfo(QSV_BOOT_DRIVE, 1885 1888 QSV_BOOT_DRIVE, (PVOID) ver, (ULONG) sizeof(ULONG))) 1886 1889 ver[0] = 3L; 1887 1890 *configsys = (CHAR) ver[0] + '@'; 1888 1891 if (!DosQuerySysInfo(QSV_VERSION_MAJOR, 1889 1890 1892 QSV_VERSION_MINOR, 1893 (PVOID) ver, (ULONG) sizeof(ver)) && ver[1] >= 30) 1891 1894 warp = TRUE; 1892 1895 *var = *beg = *end = 0; 1893 1896 if (warp) { 1894 1897 if (!DosLoadModule(var, sizeof(var), "DOSCALL1.DLL", &hmod)) { 1895 1896 1897 1898 1899 1900 1901 1898 if (!DosQueryProcAddr(hmod, 1899 ORD_DOS32QUERYEXTLIBPATH, 1900 NULL, (PFN *) & DQELIBPATH)) { 1901 DQELIBPATH(beg, BEGIN_LIBPATH); 1902 DQELIBPATH(end, END_LIBPATH); 1903 } 1904 DosFreeModule(hmod); 1902 1905 } 1903 1906 *var = 0; … … 1906 1909 if (fp) { 1907 1910 while (!feof(fp)) { 1908 1909 1910 1911 1912 1913 1914 1911 if (!xfgets_bstripcr(var, sizeof(var), fp, pszSrcFile, __LINE__)) 1912 break; 1913 if (!strnicmp(var, "LIBPATH=", 8)) { 1914 memmove(var, var + 8, strlen(var + 8) + 1); 1915 lstrip(var); 1916 break; 1917 } 1915 1918 } 1916 1919 fclose(fp); … … 1928 1931 WinCheckMenuItem(hwndMenu, IDM_TEXT, ((flWindowAttr & CV_TEXT))); 1929 1932 WinCheckMenuItem(hwndMenu, IDM_ICON, ((flWindowAttr & CV_ICON) && 1930 1933 !(flWindowAttr & CV_TREE))); 1931 1934 WinCheckMenuItem(hwndMenu, IDM_TREEVIEW, ((flWindowAttr & CV_TREE))); 1932 1935 WinCheckMenuItem(hwndMenu, IDM_DETAILS, ((flWindowAttr & CV_DETAIL))); … … 1941 1944 if (s) { 1942 1945 sprintf(s, "S:%s%s", 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1946 sortflags & SORT_REVERSE ? "^" : NullStr, 1947 (sortflags & SORT_FIRSTEXTENSION) ? 1948 GetPString(IDS_FIRSTX) : (sortflags & SORT_LASTEXTENSION) ? 1949 GetPString(IDS_LASTX) : (sortflags & SORT_SIZE) ? 1950 "Size" : (sortflags & SORT_EASIZE) ? 1951 (archive == 0) ? 1952 GetPString(IDS_EASIZE) : GetPString(IDS_CSIZE) : 1953 (sortflags & SORT_LWDATE) ? 1954 (archive == 0) ? 1955 GetPString(IDS_LWDATE) : GetPString(IDS_DATE) : 1956 (sortflags & SORT_LADATE) ? 1957 GetPString(IDS_LADATE) : (sortflags & SORT_CRDATE) ? 1958 GetPString(IDS_CRDATE) : 1959 (sortflags & SORT_PATHNAME) ? 1960 GetPString(IDS_PATH) : (sortflags & SORT_NOSORT) ? 1961 GetPString(IDS_NONE) : (sortflags & SORT_SUBJECT) ? 1962 GetPString(IDS_SUBJ) : GetPString(IDS_NAME)); 1960 1963 WinSetWindowText(hwnd, s); 1961 1964 free(s); … … 1970 1973 if (s) { 1971 1974 sprintf(s, "V:%s%s", 1972 1973 1974 1975 1976 1977 1978 1975 (flWindowAttr & CV_TREE) ? GetPString(IDS_TREE) : 1976 (flWindowAttr & CV_NAME) ? GetPString(IDS_NAME) : 1977 (flWindowAttr & CV_DETAIL) ? GetPString(IDS_DETAIL) : 1978 (flWindowAttr & CV_TEXT) ? GetPString(IDS_TEXT) : 1979 GetPString(IDS_ICON), 1980 ((flWindowAttr & CV_MINI) && 1981 !(flWindowAttr & CV_TEXT)) ? GetPString(IDS_MINI) : NullStr); 1979 1982 WinSetWindowText(hwnd, s); 1980 1983 free(s); … … 1989 1992 if (s) { 1990 1993 sprintf(s, "F:%s%s", 1991 1992 1993 1994 1995 1996 1994 mask->szMask, 1995 (!archive && (mask->attrFile != ALLATTRS || 1996 mask->antiattr != 0)) ? " " : NullStr, 1997 (!archive && (mask->attrFile != ALLATTRS || 1998 mask->antiattr != 1999 0)) ? GetPString(IDS_ATTRTEXT) : NullStr); 1997 2000 if (!s[2]) 1998 2001 sprintf(s, "F:%s", GetPString(IDS_ALLTEXT)); … … 2043 2046 2044 2047 sItemCount = (SHORT) WinSendMsg(hwndMenu, 2045 2048 MM_QUERYITEMCOUNT, MPVOID, MPVOID); 2046 2049 2047 2050 /* clean out old additions */ 2048 2051 while ((SHORT) WinSendMsg(hwndMenu, 2049 2050 2051 2052 MM_DELETEITEM, 2053 MPFROM2SHORT(IDM_SWITCHSTART + x++, 2054 TRUE), MPVOID) < sItemCount) 2052 2055 sItemCount--; 2053 2056 x = 0; 2054 2057 while ((SHORT) WinSendMsg(hwndMenu, 2055 2056 2057 2058 MM_DELETEITEM, 2059 MPFROM2SHORT(IDM_WINDOWSTART + x++, 2060 TRUE), MPVOID) < sItemCount) 2058 2061 sItemCount--; 2059 2062 … … 2070 2073 while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) { 2071 2074 if (WinQueryWindowUShort(hwndChild, QWS_ID) && hwndChild != hwndFrame) { 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2075 *wtext = 0; 2076 WinQueryWindowText(hwndChild, CCHMAXPATH + 8, wtext); 2077 if (*wtext) { 2078 wtext[CCHMAXPATH + 7] = 0; 2079 mi.afStyle = MIS_TEXT; 2080 if (!((x + sItemCount) % 28)) 2081 mi.afStyle |= MIS_BREAK; 2082 mi.id = IDM_WINDOWSTART + x; 2083 mi.iPosition = MIT_END; 2084 if ((SHORT) WinSendMsg(hwndMenu, 2085 MM_INSERTITEM, 2086 MPFROMP(&mi), MPFROMP(wtext)) >= 0) 2087 x++; 2088 } 2086 2089 } 2087 2090 } … … 2110 2113 memset(&mi, 0, sizeof(mi)); 2111 2114 for (i = 0; i < pswb->cswentry; i++) { 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2115 if (pswb->aswentry[i].swctl.uchVisibility == SWL_VISIBLE && 2116 pswb->aswentry[i].swctl.fbJump == SWL_JUMPABLE && 2117 (pswb->aswentry[i].swctl.idProcess != mypid || 2118 !hwndFrame || 2119 pswb->aswentry[i].swctl.hwnd != hwndFrame) && 2120 (pswb->aswentry[i].swctl.idProcess != mypid || 2121 !hwndTopFrame || 2122 pswb->aswentry[i].swctl.hwnd != hwndTopFrame || 2123 !WinIsChild(hwndFrame, hwndTop))) { 2124 if (!strnicmp(pswb->aswentry[i].swctl.szSwtitle, "AV/2", 4) 2125 || !stricmp(pswb->aswentry[i].swctl.szSwtitle, "File Manager/2") 2126 || !stricmp(pswb->aswentry[i].swctl.szSwtitle, "Collector") 2127 || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "VTree", 5) 2128 || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "VDir", 4) 2129 || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, FM2Str, 4)) { 2130 mi.afStyle = MIS_TEXT; 2131 if (x && !(x % 28)) 2132 mi.afStyle |= MIS_BREAK; 2133 mi.id = IDM_SWITCHSTART + y; 2134 mi.iPosition = MIT_END; 2135 switches[y] = pswb->aswentry[i].hswitch; 2136 if ((SHORT) WinSendMsg(hwndMenu, 2137 MM_INSERTITEM, 2138 MPFROMP(&mi), 2139 MPFROMP(pswb->aswentry[i]. 2140 swctl.szSwtitle)) >= 0) { 2141 y++; 2142 x++; 2143 } 2144 } 2145 } 2143 2146 } 2144 2147 numswitches = y; … … 2167 2170 mi.afStyle = MIS_TEXT; 2168 2171 if (WinSendMsg(hwndMenu, 2169 2170 2171 2172 MM_QUERYITEM, 2173 MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi))) 2174 hwndSubMenu = mi.hwndSubMenu; 2172 2175 } 2173 2176 else … … 2176 2179 *s = 0; 2177 2180 if (WinSendMsg(hwndSubMenu, 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2181 MM_QUERYITEMTEXT, 2182 MPFROM2SHORT(cmd, CCHMAXPATH + 8), MPFROMP(s)) && *s) { 2183 2184 HENUM henum; 2185 CHAR checkText[CCHMAXPATH + 8]; 2186 SWP swp; 2187 2188 s[CCHMAXPATH + 7] = 0; 2189 henum = WinBeginEnumWindows(hwndMain); 2190 while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) { 2191 if (WinQueryWindowUShort(hwndChild, QWS_ID)) { 2192 *checkText = 0; 2193 WinQueryWindowText(hwndChild, CCHMAXPATH + 8, checkText); 2194 checkText[CCHMAXPATH + 7] = 0; 2195 if (!stricmp(checkText, s)) { 2196 if (WinQueryWindowPos(hwndChild, &swp)) { 2197 if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) 2198 WinSetWindowPos(hwndChild, 2199 HWND_TOP, 2200 0, 0, 0, 0, SWP_RESTORE | SWP_ZORDER); 2201 } 2202 WinSetActiveWindow(HWND_DESKTOP, hwndChild); 2203 ret = TRUE; 2204 break; 2205 } 2206 } 2207 } 2208 WinEndEnumWindows(henum); 2206 2209 } 2207 2210 } … … 2241 2244 if (ullFreeSpaceWhenComplete == 0) { 2242 2245 saymsg(MB_OK, 2243 2244 2246 HWND_DESKTOP, 2247 NullStr, 2245 2248 GetPString(IDS_DRIVESPACELIMITEDTMPSAVE), 2246 2249 pTargetPath);
Note:
See TracChangeset
for help on using the changeset viewer.