Changeset 1394 for trunk/dll/misc.c
- Timestamp:
- Feb 5, 2009, 5:17:25 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/misc.c
r1360 r1394 6 6 7 7 Copyright (c) 1993-98 M. Kimes 8 Copyright (c) 2003, 200 8Steven H. Levine8 Copyright (c) 2003, 2009 Steven H. Levine 9 9 10 10 11 Jun 03 SHL Add JFS and FAT32 support … … 41 41 29 Feb 08 GKY Use xfree where appropriate 42 42 08 Mar 08 JBS Ticket 230: Replace prefixless INI keys for default directory containers with 43 43 keys using a "DirCnr." prefix 44 44 19 Jun 08 JBS Ticket 239: Fix LoadDetailsSwitches so INI file is read correctly and details 45 45 switches are set correctly. 46 46 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating 47 48 47 all the details view settings (both the global variables and those in the 48 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS. 49 49 17 Jul 08 SHL Add GetTidForWindow for Fortify support 50 50 20 Jul 08 GKY Add save/append filename to clipboard. 51 51 Change menu wording to make these easier to find 52 52 23 Aug 08 GKY Add CheckDriveSpaceAvail To pre check drive space to prevent failures 53 53 25 Dec 08 GKY Add code to allow write verify to be turned off on a per drive basis … … 141 141 if (rc) { 142 142 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 143 143 "DosGetInfoBlocks"); 144 144 yes = FALSE; 145 145 } … … 152 152 // OK for window to be dead - just return FALSE 153 153 yes = WinQueryWindowProcess(hwnd, &pid, &tid) && 154 155 154 pid == ppib->pib_ulpid && 155 (!chkTid || tid == ptib->tib_ptib2->tib2_ultid); 156 156 } 157 157 return yes; … … 176 176 if (rc) { 177 177 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 178 178 "DosGetInfoBlocks"); 179 179 } 180 180 else { … … 182 182 TID tid; 183 183 if (!WinQueryWindowProcess(hwnd, &pid, &tid)) 184 184 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryWindowProcess failed for %X", hwnd); 185 185 else if (pid != ppib->pib_ulpid) 186 186 Runtime_Error(pszSrcFile, __LINE__, "hwnd %X not created by fm/2", hwnd); 187 187 else 188 188 ordinal = ptib->tib_ptib2->tib2_ultid; 189 189 } 190 190 return ordinal; … … 205 205 if (rc) { 206 206 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 207 207 "DosGetInfoBlocks"); 208 208 } 209 209 else … … 312 312 WinQueryWindowText(hwnd, CCHMAXPATH, s); 313 313 if (*s) { 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 314 rcl.xRight -= 3; 315 p = s; 316 GpiQueryTextBox(hps, 3, "...", TXTBOX_COUNT, aptl); 317 len = aptl[TXTBOX_TOPRIGHT].x; 318 do { 319 GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl); 320 if (aptl[TXTBOX_TOPRIGHT].x > (rcl.xRight - (p != s ? len : 0))) 321 p++; 322 else 323 break; 324 } 325 while (*p); 326 if (*p) { 327 GpiSetMix(hps, FM_OVERPAINT); 328 GpiSetColor(hps, CLR_BLACK); 329 ptl.x = 3; 330 ptl.y = ((rcl.yTop / 2) - 331 ((aptl[TXTBOX_TOPRIGHT].y + 332 aptl[TXTBOX_BOTTOMLEFT].y) / 2)); 333 GpiMove(hps, &ptl); 334 if (p != s) 335 GpiCharString(hps, 3, "..."); 336 GpiCharString(hps, strlen(p), p); 337 } 338 338 } 339 339 free(s); … … 416 416 } 417 417 418 BOOL AdjustCnrColVis(HWND hwndCnr, CHAR *title, BOOL visible, BOOL toggle)418 BOOL AdjustCnrColVis(HWND hwndCnr, PCSZ title, BOOL visible, BOOL toggle) 419 419 { 420 420 PFIELDINFO pfi = (PFIELDINFO) WinSendMsg(hwndCnr, 421 422 421 CM_QUERYDETAILFIELDINFO, 422 MPVOID, MPFROMSHORT(CMA_FIRST)); 423 423 424 424 while (pfi) { 425 425 if (!strcmp(pfi->pTitleData, title)) { 426 426 if (toggle) { 427 428 429 430 431 427 if (pfi->flData & CFA_INVISIBLE) 428 pfi->flData &= (~CFA_INVISIBLE); 429 else 430 pfi->flData |= CFA_INVISIBLE; 431 return !(pfi->flData & CFA_INVISIBLE); 432 432 } 433 433 else { 434 435 436 437 434 if (visible) 435 pfi->flData &= (~CFA_INVISIBLE); 436 else 437 pfi->flData |= CFA_INVISIBLE; 438 438 } 439 439 return TRUE; … … 444 444 } 445 445 446 BOOL AdjustCnrColRO(HWND hwndCnr, CHAR *title, BOOL readonly, BOOL toggle)446 BOOL AdjustCnrColRO(HWND hwndCnr, PCSZ title, BOOL readonly, BOOL toggle) 447 447 { 448 448 PFIELDINFO pfi = (PFIELDINFO) WinSendMsg(hwndCnr, 449 450 449 CM_QUERYDETAILFIELDINFO, 450 MPVOID, MPFROMSHORT(CMA_FIRST)); 451 451 452 452 while (pfi) { 453 453 if (!strcmp(pfi->pTitleData, title)) { 454 454 if (toggle) { 455 456 457 458 459 455 if (pfi->flData & CFA_FIREADONLY) 456 pfi->flData &= (~CFA_FIREADONLY); 457 else 458 pfi->flData |= CFA_FIREADONLY; 459 return (pfi->flData & CFA_FIREADONLY); 460 460 } 461 461 else { 462 463 464 465 462 if (!readonly) 463 pfi->flData &= (~CFA_FIREADONLY); 464 else 465 pfi->flData |= CFA_FIREADONLY; 466 466 } 467 467 return TRUE; … … 472 472 } 473 473 474 VOID AdjustCnrColsForFSType(HWND hwndCnr, CHAR *directory, DETAILS_SETTINGS * pds)474 VOID AdjustCnrColsForFSType(HWND hwndCnr, PCSZ directory, DETAILS_SETTINGS * pds) 475 475 { 476 476 CHAR FileSystem[CCHMAXPATH]; … … 485 485 if (x != -1) { 486 486 if (!stricmp(FileSystem, HPFS) || 487 488 489 490 491 492 487 !stricmp(FileSystem, JFS) || 488 !stricmp(FileSystem, FAT32) || 489 !stricmp(FileSystem, RAMFS) || 490 !stricmp(FileSystem, NDFS32) || 491 !stricmp(FileSystem, NTFS) || 492 !stricmp(FileSystem, HPFS386)) { 493 493 hasCreateDT = TRUE; 494 494 hasAccessDT = TRUE; … … 514 514 } 515 515 AdjustCnrColVis(hwndCnr, 516 517 518 516 GetPString(IDS_LADATE), 517 pds->detailsladate ? hasAccessDT : FALSE, 518 FALSE); 519 519 AdjustCnrColVis(hwndCnr, 520 521 522 520 GetPString(IDS_LATIME), 521 pds->detailslatime ? hasAccessDT : FALSE, 522 FALSE); 523 523 AdjustCnrColVis(hwndCnr, 524 525 526 524 GetPString(IDS_CRDATE), 525 pds->detailscrdate ? hasCreateDT : FALSE, 526 FALSE); 527 527 AdjustCnrColVis(hwndCnr, 528 529 530 528 GetPString(IDS_CRTIME), 529 pds->detailscrtime ? hasCreateDT : FALSE, 530 FALSE); 531 531 AdjustCnrColVis(hwndCnr, 532 533 534 532 GetPString(IDS_LNAME), 533 pds->detailslongname ? hasLongNames : FALSE, 534 FALSE); 535 535 WinSendMsg(hwndCnr, CM_INVALIDATEDETAILFIELDINFO, MPVOID, MPVOID); 536 536 } 537 537 538 VOID AdjustCnrColsForPref(HWND hwndCnr, CHAR *directory, DETAILS_SETTINGS * pds,539 538 VOID AdjustCnrColsForPref(HWND hwndCnr, PCSZ directory, DETAILS_SETTINGS * pds, 539 BOOL compare) 540 540 { 541 541 542 542 AdjustCnrColVis(hwndCnr, 543 544 545 543 compare ? GetPString(IDS_STATUS) : GetPString(IDS_SUBJ), 544 pds->detailssubject, 545 FALSE); 546 546 547 547 AdjustCnrColVis(hwndCnr, GetPString(IDS_ATTR), pds->detailsattr, FALSE); … … 572 572 573 573 pfi = WinSendMsg(hwndCnr, CM_ALLOCDETAILFIELDINFO, 574 574 MPFROMLONG(CONTAINER_COLUMNS), NULL); 575 575 576 576 if (!pfi) { … … 592 592 pfi->flData = CFA_BITMAPORICON | CFA_CENTER | CFA_FIREADONLY; 593 593 pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY; 594 pfi->pTitleData = GetPString(IDS_ICON);594 pfi->pTitleData = (PSZ)GetPString(IDS_ICON); 595 595 pfi->offStruct = FIELDOFFSET(MINIRECORDCORE, hptrIcon); 596 596 … … 605 605 pfi->flData = CFA_STRING | CFA_LEFT | CFA_SEPARATOR; 606 606 pfi->flTitle = CFA_LEFT; 607 pfi->pTitleData = GetPString(IDS_FILENAME);607 pfi->pTitleData = (PSZ)GetPString(IDS_FILENAME); 608 608 pfi->offStruct = FIELDOFFSET(CNRITEM, pszDisplayName); 609 609 … … 613 613 pfi->flData = CFA_STRING | CFA_LEFT; 614 614 pfi->flTitle = CFA_LEFT | CFA_FITITLEREADONLY; 615 pfi->pTitleData = GetPString(IDS_LNAME);615 pfi->pTitleData = (PSZ)GetPString(IDS_LNAME); 616 616 pfi->offStruct = FIELDOFFSET(CNRITEM, pszLongName); 617 617 … … 622 622 pfi->flData = CFA_STRING | CFA_LEFT | CFA_SEPARATOR; 623 623 if (isCompCnr) 624 624 pfi->flData |= CFA_FIREADONLY; 625 625 pfi->flTitle = CFA_LEFT | CFA_FITITLEREADONLY; 626 pfi->pTitleData = isCompCnr ? GetPString(IDS_STATUS) :627 626 pfi->pTitleData = isCompCnr ? (PSZ)GetPString(IDS_STATUS) : 627 (PSZ)GetPString(IDS_SUBJ); 628 628 pfi->offStruct = FIELDOFFSET(CNRITEM, pszSubject); 629 629 pfi->cxWidth = dsDirCnrDefault.SubjectDisplayWidth; … … 642 642 pfi->flData = CFA_STRING | CFA_LEFT | CFA_SEPARATOR; 643 643 if (isCompCnr) 644 644 pfi->flData |= CFA_FIREADONLY; 645 645 pfi->flTitle = CFA_LEFT | CFA_FITITLEREADONLY; 646 pfi->pTitleData = isCompCnr ? GetPString(IDS_STATUS) :647 646 pfi->pTitleData = isCompCnr ? (PSZ)GetPString(IDS_STATUS) : 647 (PSZ)GetPString(IDS_SUBJ); 648 648 pfi->offStruct = FIELDOFFSET(CNRITEM, pszSubject); 649 649 pfi->cxWidth = dsDirCnrDefault.SubjectDisplayWidth; … … 656 656 pfi->flData = CFA_STRING | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY; 657 657 pfi->flTitle = CFA_CENTER; 658 pfi->pTitleData = GetPString(IDS_SIZE);658 pfi->pTitleData = (PSZ)GetPString(IDS_SIZE); 659 659 pfi->offStruct = FIELDOFFSET(CNRITEM, pszFmtFileSize); 660 660 … … 665 665 pfi->flData = CFA_ULONG | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY; 666 666 pfi->flTitle = CFA_CENTER; 667 pfi->pTitleData = GetPString(IDS_EA);667 pfi->pTitleData = (PSZ)GetPString(IDS_EA); 668 668 pfi->offStruct = FIELDOFFSET(CNRITEM, easize); 669 669 … … 673 673 pfi->flData = CFA_STRING | CFA_CENTER | CFA_SEPARATOR | CFA_FIREADONLY; 674 674 pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY; 675 pfi->pTitleData = GetPString(IDS_ATTR);675 pfi->pTitleData = (PSZ)GetPString(IDS_ATTR); 676 676 pfi->offStruct = FIELDOFFSET(CNRITEM, pszDispAttr); 677 677 … … 681 681 pfi->flData = CFA_DATE | CFA_RIGHT | CFA_FIREADONLY; 682 682 pfi->flTitle = CFA_CENTER; 683 pfi->pTitleData = GetPString(IDS_LWDATE);683 pfi->pTitleData = (PSZ)GetPString(IDS_LWDATE); 684 684 pfi->offStruct = FIELDOFFSET(CNRITEM, date); 685 685 … … 689 689 pfi->flData = CFA_TIME | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY; 690 690 pfi->flTitle = CFA_CENTER; 691 pfi->pTitleData = GetPString(IDS_LWTIME);691 pfi->pTitleData = (PSZ)GetPString(IDS_LWTIME); 692 692 pfi->offStruct = FIELDOFFSET(CNRITEM, time); 693 693 … … 697 697 pfi->flData = CFA_DATE | CFA_RIGHT | CFA_FIREADONLY; 698 698 pfi->flTitle = CFA_CENTER; 699 pfi->pTitleData = GetPString(IDS_LADATE);699 pfi->pTitleData = (PSZ)GetPString(IDS_LADATE); 700 700 pfi->offStruct = FIELDOFFSET(CNRITEM, ladate); 701 701 … … 705 705 pfi->flData = CFA_TIME | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY; 706 706 pfi->flTitle = CFA_CENTER; 707 pfi->pTitleData = GetPString(IDS_LATIME);707 pfi->pTitleData = (PSZ)GetPString(IDS_LATIME); 708 708 pfi->offStruct = FIELDOFFSET(CNRITEM, latime); 709 709 … … 713 713 pfi->flData = CFA_DATE | CFA_RIGHT | CFA_FIREADONLY; 714 714 pfi->flTitle = CFA_CENTER; 715 pfi->pTitleData = GetPString(IDS_CRDATE);715 pfi->pTitleData = (PSZ)GetPString(IDS_CRDATE); 716 716 pfi->offStruct = FIELDOFFSET(CNRITEM, crdate); 717 717 … … 721 721 pfi->flData = CFA_TIME | CFA_RIGHT | CFA_FIREADONLY; 722 722 pfi->flTitle = CFA_CENTER; 723 pfi->pTitleData = GetPString(IDS_CRTIME);723 pfi->pTitleData = (PSZ)GetPString(IDS_CRTIME); 724 724 pfi->offStruct = FIELDOFFSET(CNRITEM, crtime); 725 725 … … 737 737 738 738 if (!WinSendMsg(hwndCnr, CM_INSERTDETAILFIELDINFO, MPFROMP(pfiFirst), 739 739 MPFROMP(&fii))) { 740 740 Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_INSERTDETAILFIELDINFO"); 741 741 fSuccess = FALSE; … … 756 756 size = sizeof(LONG); 757 757 PrfQueryProfileData(fmprof, 758 758 appname, "CnrSplitBar", &cnri.xVertSplitbar, &size); 759 759 if (cnri.xVertSplitbar <= 0) 760 760 cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32; 761 761 if (!WinSendMsg(hwndCnr, CM_SETCNRINFO, MPFROMP(&cnri), 762 763 762 MPFROMLONG(CMA_PFIELDINFOLAST | CMA_PFIELDINFOOBJECT | 763 CMA_XVERTSPLITBAR))) { 764 764 Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_SETCNRINFO"); 765 765 fSuccess = FALSE; … … 779 779 780 780 if (pci && 781 782 783 784 785 786 787 788 789 790 781 (INT) pci != -1 && 782 !IsRoot(pci->pszFileName) && 783 !(pci->flags & RECFLAGS_ENV) && !(pci->flags & RECFLAGS_UNDERENV)) { 784 if (!pfi || pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName)) { 785 PostMsg(hwnd, UM_FIXEDITNAME, MPFROMP(pci->pszFileName), MPVOID); 786 } 787 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, pszSubject)) 788 PostMsg(hwnd, UM_FIXCNRMLE, MPFROMLONG(1048), MPVOID); 789 else 790 PostMsg(hwnd, UM_FIXCNRMLE, MPFROMLONG(CCHMAXPATH), MPVOID); 791 791 } 792 792 else 793 793 PostMsg(hwnd, CM_CLOSEEDIT, MPVOID, MPVOID); 794 794 } 795 795 break; … … 804 804 805 805 if (pci && (INT) pci != -1 && !IsRoot(pci->pszFileName)) { 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 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 806 if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszSubject)) { 807 808 APIRET rc; 809 EAOP2 eaop; 810 PFEA2LIST pfealist = NULL; 811 CHAR szSubject[1048]; 812 ULONG ealen; 813 USHORT len; 814 CHAR *eaval; 815 LONG retlen; 816 PSZ psz; 817 818 retlen = WinQueryWindowText(hwndMLE, sizeof(szSubject), szSubject); 819 szSubject[retlen + 1] = 0; 820 bstrip(szSubject); 821 if (pci->pszSubject != NullStr) { 822 if (retlen == 0) { 823 psz = pci->pszSubject; 824 pci->pszSubject = NullStr; 825 xfree(psz, pszSrcFile, __LINE__); 826 } 827 else 828 pci->pszSubject = xrealloc(pci->pszSubject, retlen + 1, pszSrcFile, __LINE__); 829 } 830 else { 831 pci->pszSubject = xmalloc(retlen + 1, pszSrcFile, __LINE__); 832 if (!pci->pszSubject) 833 return FALSE; 834 } 835 len = strlen(szSubject); 836 if (len) 837 ealen = sizeof(FEA2LIST) + 9 + len + 4; 838 else 839 ealen = sizeof(FEALIST) + 9; 840 rc = DosAllocMem((PPVOID) & pfealist, ealen + 64, 841 OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE); 842 if (rc) 843 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, 844 __LINE__, GetPString(IDS_OUTOFMEMORY)); 845 else { 846 memset(pfealist, 0, ealen + 1); 847 pfealist->cbList = ealen; 848 pfealist->list[0].oNextEntryOffset = 0; 849 pfealist->list[0].fEA = 0; 850 pfealist->list[0].cbName = 8; 851 strcpy(pfealist->list[0].szName, SUBJECT); 852 if (len) { 853 eaval = pfealist->list[0].szName + 9; 854 *(USHORT *) eaval = (USHORT) EAT_ASCII; 855 eaval += sizeof(USHORT); 856 *(USHORT *) eaval = (USHORT) len; 857 eaval += sizeof(USHORT); 858 memcpy(eaval, szSubject, len); 859 pfealist->list[0].cbValue = len + (sizeof(USHORT) * 2); 860 } 861 else 862 pfealist->list[0].cbValue = 0; 863 eaop.fpGEA2List = (PGEA2LIST) 0; 864 eaop.fpFEA2List = pfealist; 865 eaop.oError = 0; 866 rc = xDosSetPathInfo(pci->pszFileName, FIL_QUERYEASIZE, 867 &eaop, sizeof(eaop), DSPI_WRTTHRU); 868 DosFreeMem(pfealist); 869 if (rc) 870 return FALSE; 871 } 872 return (MRESULT) TRUE; 873 } 874 else if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszLongName)) { 875 876 CHAR longname[CCHMAXPATHCOMP]; 877 LONG retlen; 878 PSZ psz; 879 880 *longname = 0; 881 retlen = WinQueryWindowText(hwndMLE, sizeof(longname), longname); 882 longname[retlen + 1] = 0; 883 chop_at_crnl(longname); 884 bstrip(longname); 885 WinSetWindowText(hwndMLE, longname); 886 if (pci->pszLongName != NullStr) { 887 if (retlen == 0) { 888 psz = pci->pszLongName; 889 pci->pszLongName = NullStr; 890 xfree(psz, pszSrcFile, __LINE__); 891 } 892 else 893 pci->pszLongName = xrealloc(pci->pszLongName, retlen + 1, pszSrcFile, __LINE__); 894 } 895 else { 896 pci->pszLongName = xmalloc(retlen + 1, pszSrcFile, __LINE__); 897 if (!pci->pszLongName) 898 return FALSE; 899 } 900 return (MRESULT) WriteLongName(pci->pszFileName, longname); 901 } 902 else { 903 WinQueryWindowText(hwndMLE, sizeof(szData), szData); 904 if (strchr(szData, '?') || 905 strchr(szData, '*') || IsRoot(pci->pszFileName)) 906 return (MRESULT) FALSE; 907 /* If the text changed, rename the file system object. */ 908 chop_at_crnl(szData); 909 bstrip(szData); 910 if (!IsFullName(szData)) 911 Runtime_Error(pszSrcFile, __LINE__, "bad name"); 912 else { 913 if (DosQueryPathInfo(szData, 914 FIL_QUERYFULLNAME, 915 testname, sizeof(testname))) 916 return FALSE; 917 if (DosQueryPathInfo(pci->pszFileName, 918 FIL_QUERYFULLNAME, 919 szData, 920 sizeof(szData))) 921 { 922 pci->pszFileName = xrealloc(pci->pszFileName, sizeof(szData), pszSrcFile, __LINE__); 923 strcpy(szData, pci->pszFileName); 924 } 925 WinSetWindowText(hwndMLE, szData); 926 if (strcmp(szData, testname)) { 927 if (stricmp(szData, testname) && IsFile(testname) != -1) { 928 DosBeep(50, 100); /* exists; disallow */ 929 return (MRESULT) FALSE; 930 } 931 if (fVerify && (driveflags[toupper(*szData) - 'A'] & DRIVE_WRITEVERIFYOFF || 932 driveflags[toupper(*testname) - 'A'] & DRIVE_WRITEVERIFYOFF)) { 933 DosSetVerify(FALSE); 934 fResetVerify = TRUE; 935 } 936 if (docopyf(MOVE, szData, "%s", testname)) 937 Runtime_Error(pszSrcFile, __LINE__, "docopyf"); 938 else { 939 CHAR *filename; 940 941 filename = xstrdup(testname, pszSrcFile, __LINE__); 942 if (filename) { 943 if (!PostMsg(hwnd, 944 UM_FIXEDITNAME, MPVOID, MPFROMP(filename))) 945 free(filename); 946 } 947 if (stricmp(testname, pci->pszFileName)) { 948 PostMsg(hwnd, UM_FIXEDITNAME, MPFROMLONG(-1), MPFROMP(pci)); 949 filename = xstrdup(pci->pszFileName, pszSrcFile, __LINE__); 950 if (filename) { 951 if (!PostMsg(hwnd, 952 UM_FIXEDITNAME, MPVOID, MPFROMP(filename))) 953 free(filename); 954 } 955 } 956 } 957 if (fResetVerify) { 958 DosSetVerify(fVerify); 959 fResetVerify = FALSE; 960 } 961 } 962 } 963 } 964 964 } 965 965 } … … 972 972 973 973 if (pci && (INT) pci != -1 && !IsRoot(pci->pszFileName)) { 974 975 976 977 978 979 974 WinSendMsg(hwnd, 975 CM_INVALIDATERECORD, 976 MPFROMP(&pci), 977 MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED)); 978 if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName)) 979 PostMsg(hwnd, UM_SORTRECORD, MPVOID, MPVOID); 980 980 } 981 981 else { 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 982 USHORT cmd = 0; 983 984 if (!pfi || pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName)) 985 cmd = IDM_SORTSMARTNAME; 986 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, cbFile)) 987 cmd = IDM_SORTSIZE; 988 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, easize)) 989 cmd = IDM_SORTEASIZE; 990 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, date)) 991 cmd = IDM_SORTLWDATE; 992 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, time)) 993 cmd = IDM_SORTLWDATE; 994 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, ladate)) 995 cmd = IDM_SORTLADATE; 996 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, latime)) 997 cmd = IDM_SORTLADATE; 998 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, crdate)) 999 cmd = IDM_SORTCRDATE; 1000 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, crtime)) 1001 cmd = IDM_SORTCRDATE; 1002 if (cmd) 1003 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID); 1004 1004 } 1005 1005 } … … 1010 1010 1011 1011 BOOL SetMenuCheck(HWND hwndMenu, USHORT id, BOOL * bool, BOOL toggle, 1012 CHAR *savename)1012 PCSZ savename) 1013 1013 { 1014 1014 if (toggle) { … … 1018 1018 } 1019 1019 WinSendMsg(hwndMenu, MM_SETITEMATTR, 1020 1021 1020 MPFROM2SHORT(id, 1), 1021 MPFROM2SHORT(MIA_CHECKED, (*bool ? MIA_CHECKED : 0))); 1022 1022 return *bool; 1023 1023 } … … 1028 1028 { 1029 1029 WinSendMsg(hwndMenu, MM_SETITEMATTR, 1030 1031 1030 MPFROM2SHORT(id, TRUE), 1031 MPFROM2SHORT(MIA_DISABLED, (disable ? MIA_DISABLED : 0))); 1032 1032 } 1033 1033 1034 1034 //== ViewHelp() invoke view.exe, return TRUE if OK == 1035 1035 1036 BOOL ViewHelp( CHAR *filename)1036 BOOL ViewHelp(PCSZ filename) 1037 1037 { 1038 1038 CHAR s[CCHMAXPATH + 81]; … … 1051 1051 fclose(fp); 1052 1052 ret = runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, pszSrcFile, __LINE__, 1053 1054 1055 1053 NULL, NULL, 1054 "VIEW.EXE \"%s\"", 1055 BldQuotedFileName(szQuotedFileName, filename)); 1056 1056 } 1057 1057 … … 1061 1061 //== ExecFile() run file, return 1 if OK 0 if skipped -1 if can't run == 1062 1062 1063 INT ExecFile(HWND hwnd, CHAR *filename)1063 INT ExecFile(HWND hwnd, PCSZ filename) 1064 1064 { 1065 1065 EXECARGS ex; … … 1092 1092 *ex.environment = 0; 1093 1093 ret = WinDlgBox(HWND_DESKTOP, hwnd, CmdLineDlgProc, FM3ModHandle, 1094 1094 EXEC_FRAME, &ex); 1095 1095 if (ret == 1) { 1096 1096 lastflags = ex.flags; 1097 1097 return runemf2(ex.flags, hwnd, pszSrcFile, __LINE__, path, 1098 1099 1098 *ex.environment ? ex.environment : NULL, 1099 "%s", pszCmdLine) != -1; 1100 1100 } 1101 1101 else if (ret != 0) … … 1123 1123 1124 1124 VOID AdjustDetailsSwitches(HWND hwnd, HWND hwndMenu, USHORT cmd, 1125 CHAR * directory, CHAR *keyroot,1126 1125 PCSZ directory, PCSZ keyroot, 1126 DETAILS_SETTINGS * pds, BOOL compare) 1127 1127 { 1128 1128 BOOL *bool = NULL; … … 1193 1193 mi.afStyle = MIS_TEXT; 1194 1194 if (WinSendMsg(hwndMenu, 1195 1196 1197 1195 MM_QUERYITEM, 1196 MPFROM2SHORT(id, TRUE), 1197 MPFROMP(&mi))) 1198 1198 { 1199 1199 WinSetWindowBits(mi.hwndSubMenu, QWL_STYLE, MS_CONDITIONALCASCADE, 1200 1200 MS_CONDITIONALCASCADE); 1201 1201 WinSendMsg(mi.hwndSubMenu, MM_SETDEFAULTITEMID, MPFROMSHORT(def), MPVOID); 1202 1202 WinCheckMenuItem(mi.hwndSubMenu, def, TRUE); … … 1275 1275 else 1276 1276 WinSendMsg(hwndMenu, MM_QUERYITEM, 1277 1277 MPFROM2SHORT(IDM_COMMANDSMENU, TRUE), MPFROMP(&mit)); 1278 1278 if (mit.hwndSubMenu) { 1279 1279 numitems = (SHORT) WinSendMsg(mit.hwndSubMenu, MM_QUERYITEMCOUNT, 1280 1280 MPVOID, MPVOID); 1281 1281 WinSendMsg(mit.hwndSubMenu, MM_DELETEITEM, MPFROMSHORT(-1), MPVOID); 1282 1282 for (x = 0; x < numitems; x++) 1283 1283 WinSendMsg(mit.hwndSubMenu, MM_DELETEITEM, 1284 1284 MPFROMSHORT((SHORT) (x + IDM_COMMANDSTART)), MPVOID); 1285 1285 if (hwndCnr && cmdhead) { 1286 1286 x = 0; … … 1288 1288 while (info) { 1289 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1290 CHAR s[CCHMAXPATH + 24]; 1291 1292 sprintf(s, 1293 "%s%s%s", 1294 info->title, 1295 x < 20 ? "\tCtrl + " : NullStr, 1296 x < 20 && x > 9 ? "Shift + " : NullStr); 1297 if (x < 20) 1298 sprintf(&s[strlen(s)], "%d", 1299 ((x % 10) + 1) == 10 ? 0 : (x % 10) + 1); 1300 mi.id = IDM_COMMANDSTART + x; 1301 mi.afAttribute = (info->flags & ONCE ? MIA_CHECKED : 0) | 1302 (info->flags & PROMPT ? MIA_FRAMED : 0); 1303 mi.afStyle = MIS_TEXT; 1304 if (!(x % 24) && x && info->next) 1305 mi.afStyle |= MIS_BREAK; 1306 WinSendMsg(mit.hwndSubMenu, MM_INSERTITEM, MPFROMP(&mi), MPFROMP(s)); 1307 x++; 1308 info = info->next; 1309 1309 } 1310 1310 } … … 1312 1312 } 1313 1313 1314 VOID LoadDetailsSwitches( CHAR *keyroot, DETAILS_SETTINGS * pds)1314 VOID LoadDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS * pds) 1315 1315 { 1316 1316 ULONG size; … … 1401 1401 hwndDir = WinWindowFromID(hwndDir, DIR_CNR); 1402 1402 if (hwndDir) 1403 1403 break; 1404 1404 hwndDir = (HWND) 0; 1405 1405 } … … 1418 1418 if (rc) 1419 1419 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 1420 1420 "DosCreateEventSem"); 1421 1421 else { 1422 1422 priority_normal(); 1423 1423 for (;;) { 1424 1424 if (DosWaitEventSem(CompactSem, SEM_INDEFINITE_WAIT)) 1425 1425 break; 1426 1426 _heapmin(); 1427 1427 DosResetEventSem(CompactSem, &postcount); … … 1430 1430 } 1431 1431 1432 VOID FixSwitchList(HWND hwnd, CHAR *text)1432 VOID FixSwitchList(HWND hwnd, PCSZ text) 1433 1433 { 1434 1434 HSWITCH hswitch; … … 1449 1449 if (dcd->hwndLastMenu && !dcd->cnremphasized) { 1450 1450 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID, 1451 1451 MPFROM2SHORT(TRUE, CRA_SOURCE)); 1452 1452 dcd->cnremphasized = TRUE; 1453 1453 } … … 1455 1455 WinCheckMenuItem(dcd->hwndLastMenu, IDM_MINIICONS, TRUE); 1456 1456 if (!WinPopupMenu(hwnd, hwnd, dcd->hwndLastMenu, 1457 1458 1459 1457 8, 8, 0, 1458 PU_HCONSTRAIN | PU_VCONSTRAIN | 1459 PU_KEYBOARD | PU_MOUSEBUTTON1)) { 1460 1460 if (dcd->cnremphasized) { 1461 1461 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID, 1462 1462 MPFROM2SHORT(FALSE, CRA_SOURCE)); 1463 1463 dcd->cnremphasized = FALSE; 1464 1464 } … … 1466 1466 else 1467 1467 WinSendMsg(dcd->hwndLastMenu, MM_SELECTITEM, 1468 1468 MPFROM2SHORT(id, TRUE), MPFROM2SHORT(0, FALSE)); 1469 1469 } 1470 1470 … … 1476 1476 for (;;) { 1477 1477 pmi = (PMINIRECORDCORE) WinSendMsg(hwndCnr, CM_QUERYRECORDEMPHASIS, 1478 1479 1478 MPFROMLONG(CMA_FIRST), 1479 MPFROMSHORT(attrib)); 1480 1480 if ((!pmi || (INT) pmi == -1) && attrib == CRA_SELECTED) /* punt */ 1481 1481 attrib = CRA_CURSORED; … … 1496 1496 QMSG qmsg; 1497 1497 for (;;) { 1498 1499 1500 1501 1502 1503 1504 1505 1498 DosSleep(1); 1499 rc = WinPostMsg(h, msg, mp1, mp2); 1500 if (rc) 1501 break; // OK 1502 if (!WinIsWindow((HAB) 0, h)) 1503 break; // Window gone 1504 if (WinPeekMsg((HAB) 0, &qmsg, (HWND) 0, 0, 0, PM_NOREMOVE)) 1505 break; // Queue has message(s) 1506 1506 } // for 1507 1507 } … … 1517 1517 1518 1518 pci = (PCNRITEM) WinSendMsg(hwnd, 1519 1520 1521 1519 CM_QUERYRECORDEMPHASIS, 1520 MPFROMLONG(CMA_FIRST), 1521 MPFROMSHORT(CRA_CURSORED)); 1522 1522 if (pci && (INT) pci != -1) { 1523 1523 memset(&ced, 0, sizeof(ced)); … … 1527 1527 ced.pRecord = (PRECORDCORE) pci; 1528 1528 pfi = (PFIELDINFO) WinSendMsg(hwnd, 1529 1530 1529 CM_QUERYDETAILFIELDINFO, 1530 MPVOID, MPFROMSHORT(CMA_FIRST)); 1531 1531 if (!pfi) 1532 1532 WinSendMsg(hwnd, CM_OPENEDIT, MPFROMP(&ced), MPVOID); 1533 1533 else { 1534 1534 while (pfi && (INT) pfi != -1 && 1535 1536 1537 1538 1535 pfi->offStruct != FIELDOFFSET(CNRITEM, pszFileName)) 1536 pfi = (PFIELDINFO) WinSendMsg(hwnd, 1537 CM_QUERYDETAILFIELDINFO, 1538 MPFROMP(pfi), MPFROMSHORT(CMA_NEXT)); 1539 1539 if (pfi && (INT) pfi != -1) { 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1540 ced.pFieldInfo = pfi; 1541 { 1542 CNRINFO cnri; 1543 1544 memset(&cnri, 0, sizeof(CNRINFO)); 1545 cnri.cb = sizeof(CNRINFO); 1546 WinSendMsg(hwnd, 1547 CM_QUERYCNRINFO, 1548 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO))); 1549 if (cnri.flWindowAttr & CV_DETAIL) 1550 ced.id = CID_LEFTDVWND; 1551 } 1552 WinSendMsg(hwnd, CM_OPENEDIT, MPFROMP(&ced), MPVOID); 1553 1553 } 1554 1554 } … … 1557 1557 1558 1558 #ifdef NEVER 1559 VOID QuickView(HWND hwnd, CHAR *filename)1559 VOID QuickView(HWND hwnd, PCSZ filename) 1560 1560 { 1561 1561 if (filename && IsFile(filename) == 1) { … … 1567 1567 list[1] = NULL; 1568 1568 ExecOnList(hwnd, binview, WINDOWED | SEPARATE, NULL, list, NULL, 1569 1569 pszSrcFile, __LINE__); 1570 1570 return; 1571 1571 } … … 1577 1577 list[1] = NULL; 1578 1578 ExecOnList(hwnd, viewer, 1579 1580 1579 WINDOWED | SEPARATE | (fViewChild ? CHILD : 0), 1580 NULL, list, NULL, pszSrcFile, __LINE__); 1581 1581 return; 1582 1582 } … … 1595 1595 list[1] = NULL; 1596 1596 ExecOnList(hwnd, bined, WINDOWED | SEPARATE, NULL, list, NULL, 1597 1597 pszSrcFile, __LINE__); 1598 1598 return; 1599 1599 } … … 1605 1605 list[1] = NULL; 1606 1606 ExecOnList(hwnd, editor, WINDOWED | SEPARATE, NULL, list, NULL, 1607 1607 pszSrcFile, __LINE__); 1608 1608 return; 1609 1609 } … … 1637 1637 mi.afStyle = MIS_TEXT; 1638 1638 WinSendMsg(hwndMenu, MM_QUERYITEM, 1639 1639 MPFROM2SHORT(IDM_FILESMENU, TRUE), MPFROMP(&mi)); 1640 1640 if (!DefMenu) 1641 1641 DefMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, DEFMENU); 1642 1642 hwndNow = mi.hwndSubMenu; 1643 1643 mi.hwndSubMenu = hwndNew; 1644 1644 if (!mi.hwndSubMenu) 1645 1645 mi.hwndSubMenu = DefMenu; 1646 1646 WinSetParent(hwndNow, WinQueryObjectWindow(HWND_DESKTOP), FALSE); 1647 1647 WinSetOwner(hwndNow, WinQueryObjectWindow(HWND_DESKTOP)); … … 1668 1668 mi.afStyle = MIS_TEXT; 1669 1669 WinSendMsg(hwndMenu, MM_QUERYITEM, 1670 1670 MPFROM2SHORT(IDM_VIEWSMENU, TRUE), MPFROMP(&mi)); 1671 1671 if (!DefMenu) 1672 1672 DefMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, DEFMENU); 1673 1673 hwndNow = mi.hwndSubMenu; 1674 1674 mi.hwndSubMenu = hwndNew; 1675 1675 if (!mi.hwndSubMenu) 1676 1676 mi.hwndSubMenu = DefMenu; 1677 1677 WinSetParent(hwndNow, WinQueryObjectWindow(HWND_DESKTOP), FALSE); 1678 1678 WinSetOwner(hwndNow, WinQueryObjectWindow(HWND_DESKTOP)); … … 1706 1706 SetConditionalCascade(DirMenu, IDM_EDITSUBMENU, IDM_ATTRS); 1707 1707 SetConditionalCascade(DirMenu, IDM_DELETESUBMENU, 1708 1708 fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE); 1709 1709 SetConditionalCascade(DirMenu, IDM_MISCSUBMENU, IDM_SIZES); 1710 1710 SetConditionalCascade(DirMenu, IDM_OPENSUBMENU, IDM_OPENWINDOW); 1711 1711 if (fWorkPlace) { 1712 1713 1714 1715 1712 WinSendMsg(DirMenu, MM_DELETEITEM, 1713 MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID); 1714 WinSendMsg(DirMenu, MM_DELETEITEM, 1715 MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID); 1716 1716 } 1717 1717 } … … 1725 1725 SetConditionalCascade(TreeMenu, IDM_OPENSUBMENU, IDM_OPENWINDOW); 1726 1726 if (fWorkPlace) { 1727 1728 1729 1730 1727 WinSendMsg(TreeMenu, MM_DELETEITEM, 1728 MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID); 1729 WinSendMsg(TreeMenu, MM_DELETEITEM, 1730 MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID); 1731 1731 } 1732 1732 if (!fLVM) 1733 1734 1733 WinSendMsg(TreeMenu, MM_DELETEITEM, 1734 MPFROM2SHORT(IDM_REFRESHREMOVABLES, TRUE), MPVOID); 1735 1735 } 1736 1736 else if (hwndMenu == &ArcMenu) { … … 1740 1740 SetConditionalCascade(ArcMenu, IDM_VIEWSUBMENU, IDM_VIEW); 1741 1741 if (fWorkPlace) 1742 1743 1742 WinSendMsg(ArcMenu, MM_DELETEITEM, 1743 MPFROM2SHORT(IDM_FOLDERAFTEREXTRACT, TRUE), MPVOID); 1744 1744 } 1745 1745 else if (hwndMenu == &FileMenu) { … … 1753 1753 SetConditionalCascade(FileMenu, IDM_COLLECTMENU, IDM_COLLECT); 1754 1754 SetConditionalCascade(FileMenu, IDM_DELETESUBMENU, 1755 1755 fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE); 1756 1756 SetConditionalCascade(FileMenu, IDM_OPENSUBMENU, IDM_OPENDEFAULT); 1757 1757 SetConditionalCascade(FileMenu, IDM_OBJECTSUBMENU, IDM_SHADOW); 1758 1758 if (fWorkPlace) { 1759 1760 1761 1762 1759 WinSendMsg(FileMenu, MM_DELETEITEM, 1760 MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID); 1761 WinSendMsg(FileMenu, MM_DELETEITEM, 1762 MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID); 1763 1763 } 1764 1764 if (!fLVM) 1765 1766 1765 WinSendMsg(FileMenu, MM_DELETEITEM, 1766 MPFROM2SHORT(IDM_REFRESHREMOVABLES, TRUE), MPVOID); 1767 1767 } 1768 1768 else if (hwndMenu == &DirCnrMenu) { … … 1771 1771 SetConditionalCascade(DirCnrMenu, IDM_OPENSUBMENU, IDM_OPENSETTINGSME); 1772 1772 if (fWorkPlace) 1773 1774 1773 WinSendMsg(DirCnrMenu, MM_DELETEITEM, 1774 MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID); 1775 1775 } 1776 1776 else if (hwndMenu == &TreeCnrMenu) { 1777 1777 WinSetWindowUShort(TreeCnrMenu, QWS_ID, IDM_VIEWSMENU); 1778 1778 if (!fLVM) 1779 1780 1779 WinSendMsg(TreeCnrMenu, MM_DELETEITEM, 1780 MPFROM2SHORT(IDM_REFRESHREMOVABLES, TRUE), MPVOID); 1781 1781 } 1782 1782 else if (hwndMenu == &ArcCnrMenu) { … … 1784 1784 SetConditionalCascade(ArcCnrMenu, IDM_EXTRACTSUBMENU, IDM_ARCEXTRACT); 1785 1785 if (fWorkPlace) 1786 1787 1786 WinSendMsg(ArcCnrMenu, MM_DELETEITEM, 1787 MPFROM2SHORT(IDM_FOLDERAFTEREXTRACT, TRUE), MPVOID); 1788 1788 } 1789 1789 else if (hwndMenu == &CollectorCnrMenu) { 1790 1790 WinSetWindowUShort(CollectorCnrMenu, QWS_ID, IDM_VIEWSMENU); 1791 1791 SetConditionalCascade(CollectorCnrMenu, IDM_COLLECTMENU, 1792 1792 IDM_COLLECTFROMCLIP); 1793 1793 } 1794 1794 else if (hwndMenu == &CollectorFileMenu) { 1795 1795 WinSetWindowUShort(CollectorFileMenu, QWS_ID, IDM_FILESMENU); 1796 1796 SetConditionalCascade(CollectorFileMenu, IDM_COMMANDSMENU, 1797 1797 IDM_DOITYOURSELF); 1798 1798 SetConditionalCascade(CollectorFileMenu, IDM_COPYMENU, IDM_COPY); 1799 1799 SetConditionalCascade(CollectorFileMenu, IDM_MOVEMENU, IDM_MOVE); 1800 1800 SetConditionalCascade(CollectorFileMenu, IDM_SAVESUBMENU, 1801 1801 IDM_SAVETOCLIP); 1802 1802 SetConditionalCascade(CollectorFileMenu, IDM_VIEWSUBMENU, IDM_VIEW); 1803 1803 SetConditionalCascade(CollectorFileMenu, IDM_EDITSUBMENU, IDM_EDIT); 1804 1804 SetConditionalCascade(CollectorFileMenu, IDM_DELETESUBMENU, 1805 1805 fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE); 1806 1806 SetConditionalCascade(CollectorFileMenu, IDM_OPENSUBMENU, 1807 1807 IDM_OPENDEFAULT); 1808 1808 SetConditionalCascade(CollectorFileMenu, IDM_OBJECTSUBMENU, IDM_SHADOW); 1809 1809 if (fWorkPlace) { 1810 1811 1812 1813 1810 WinSendMsg(CollectorFileMenu, MM_DELETEITEM, 1811 MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID); 1812 WinSendMsg(CollectorFileMenu, MM_DELETEITEM, 1813 MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID); 1814 1814 } 1815 1815 } … … 1817 1817 WinSetWindowUShort(CollectorDirMenu, QWS_ID, IDM_FILESMENU); 1818 1818 SetConditionalCascade(CollectorDirMenu, IDM_COMMANDSMENU, 1819 1819 IDM_DOITYOURSELF); 1820 1820 SetConditionalCascade(CollectorDirMenu, IDM_COPYMENU, IDM_COPY); 1821 1821 SetConditionalCascade(CollectorDirMenu, IDM_MOVEMENU, IDM_MOVE); 1822 1822 SetConditionalCascade(CollectorDirMenu, IDM_SAVESUBMENU, 1823 1823 IDM_SAVETOCLIP); 1824 1824 SetConditionalCascade(CollectorDirMenu, IDM_VIEWSUBMENU, IDM_INFO); 1825 1825 SetConditionalCascade(CollectorDirMenu, IDM_EDITSUBMENU, IDM_ATTRS); 1826 1826 SetConditionalCascade(CollectorDirMenu, IDM_DELETESUBMENU, 1827 1827 fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE); 1828 1828 SetConditionalCascade(CollectorDirMenu, IDM_MISCSUBMENU, IDM_SIZES); 1829 1829 SetConditionalCascade(CollectorDirMenu, IDM_OPENSUBMENU, 1830 1830 IDM_OPENWINDOW); 1831 1831 if (fWorkPlace) { 1832 1833 1834 1835 1832 WinSendMsg(CollectorDirMenu, MM_DELETEITEM, 1833 MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID); 1834 WinSendMsg(CollectorDirMenu, MM_DELETEITEM, 1835 MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID); 1836 1836 } 1837 1837 } … … 1846 1846 } 1847 1847 1848 SHORT AddToListboxBottom(HWND hwnd, CHAR *str)1848 SHORT AddToListboxBottom(HWND hwnd, PCSZ str) 1849 1849 { 1850 1850 SHORT ln; 1851 1851 1852 1852 ln = (SHORT) WinSendMsg(hwnd, LM_INSERTITEM, MPFROM2SHORT(LIT_END, 0), 1853 1853 MPFROMP(str)); 1854 1854 if (ln) 1855 1855 WinSendMsg(hwnd, LM_SELECTITEM, MPFROM2SHORT(ln, 0), MPVOID); … … 1862 1862 1863 1863 if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT, 1864 1864 MPFROM2SHORT(SC_RESTORE, 128), MPFROMP(s))) { 1865 1865 p = strchr(s, '\t'); 1866 1866 if (p) { … … 1871 1871 } 1872 1872 if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT, 1873 1873 MPFROM2SHORT(SC_CLOSE, 128), MPFROMP(s))) { 1874 1874 p = strchr(s, '\t'); 1875 1875 if (p) { … … 1880 1880 } 1881 1881 if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT, 1882 1882 MPFROM2SHORT(SC_MOVE, 128), MPFROMP(s))) { 1883 1883 p = strchr(s, '\t'); 1884 1884 if (p) { … … 1889 1889 } 1890 1890 if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT, 1891 1891 MPFROM2SHORT(SC_SIZE, 128), MPFROMP(s))) { 1892 1892 p = strchr(s, '\t'); 1893 1893 if (p) { … … 1898 1898 } 1899 1899 if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT, 1900 1900 MPFROM2SHORT(SC_MINIMIZE, 128), MPFROMP(s))) { 1901 1901 p = strchr(s, '\t'); 1902 1902 if (p) { … … 1907 1907 } 1908 1908 if (WinSendMsg(hwndSysMenu, 1909 1910 1909 MM_QUERYITEMTEXT, 1910 MPFROM2SHORT(SC_MAXIMIZE, 128), MPFROMP(s))) { 1911 1911 p = strchr(s, '\t'); 1912 1912 if (p) { … … 1917 1917 } 1918 1918 if (WinSendMsg(hwndSysMenu, 1919 1919 MM_QUERYITEMTEXT, MPFROM2SHORT(SC_HIDE, 128), MPFROMP(s))) { 1920 1920 p = strchr(s, '\t'); 1921 1921 if (p) { … … 1927 1927 } 1928 1928 1929 VOID LoadLibPath( CHAR *str, LONG len)1929 VOID LoadLibPath(PSZ str, LONG len) 1930 1930 { 1931 1931 ULONG ver[2]; … … 1940 1940 *str = 0; 1941 1941 if (DosQuerySysInfo(QSV_BOOT_DRIVE, 1942 1942 QSV_BOOT_DRIVE, (PVOID) ver, (ULONG) sizeof(ULONG))) 1943 1943 ver[0] = 3L; 1944 1944 *configsys = (CHAR) ver[0] + '@'; 1945 1945 if (!DosQuerySysInfo(QSV_VERSION_MAJOR, 1946 1947 1946 QSV_VERSION_MINOR, 1947 (PVOID) ver, (ULONG) sizeof(ver)) && ver[1] >= 30) 1948 1948 warp = TRUE; 1949 1949 *var = *beg = *end = 0; 1950 1950 if (warp) { 1951 1951 if (!DosLoadModule(var, sizeof(var), "DOSCALL1.DLL", &hmod)) { 1952 1953 1954 1955 1956 1957 1958 1952 if (!DosQueryProcAddr(hmod, 1953 ORD_DOS32QUERYEXTLIBPATH, 1954 NULL, (PFN *) & DQELIBPATH)) { 1955 DQELIBPATH(beg, BEGIN_LIBPATH); 1956 DQELIBPATH(end, END_LIBPATH); 1957 } 1958 DosFreeModule(hmod); 1959 1959 } 1960 1960 *var = 0; … … 1963 1963 if (fp) { 1964 1964 while (!feof(fp)) { 1965 1966 1967 1968 1969 1970 1971 1965 if (!xfgets_bstripcr(var, sizeof(var), fp, pszSrcFile, __LINE__)) 1966 break; 1967 if (!strnicmp(var, "LIBPATH=", 8)) { 1968 memmove(var, var + 8, strlen(var + 8) + 1); 1969 lstrip(var); 1970 break; 1971 } 1972 1972 } 1973 1973 fclose(fp); … … 1985 1985 WinCheckMenuItem(hwndMenu, IDM_TEXT, ((flWindowAttr & CV_TEXT))); 1986 1986 WinCheckMenuItem(hwndMenu, IDM_ICON, ((flWindowAttr & CV_ICON) && 1987 1987 !(flWindowAttr & CV_TREE))); 1988 1988 WinCheckMenuItem(hwndMenu, IDM_TREEVIEW, ((flWindowAttr & CV_TREE))); 1989 1989 WinCheckMenuItem(hwndMenu, IDM_DETAILS, ((flWindowAttr & CV_DETAIL))); … … 1998 1998 if (s) { 1999 1999 sprintf(s, "S:%s%s", 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2000 sortflags & SORT_REVERSE ? "^" : NullStr, 2001 (sortflags & SORT_FIRSTEXTENSION) ? 2002 GetPString(IDS_FIRSTX) : (sortflags & SORT_LASTEXTENSION) ? 2003 GetPString(IDS_LASTX) : (sortflags & SORT_SIZE) ? 2004 "Size" : (sortflags & SORT_EASIZE) ? 2005 (archive == 0) ? 2006 GetPString(IDS_EASIZE) : GetPString(IDS_CSIZE) : 2007 (sortflags & SORT_LWDATE) ? 2008 (archive == 0) ? 2009 GetPString(IDS_LWDATE) : GetPString(IDS_DATE) : 2010 (sortflags & SORT_LADATE) ? 2011 GetPString(IDS_LADATE) : (sortflags & SORT_CRDATE) ? 2012 GetPString(IDS_CRDATE) : 2013 (sortflags & SORT_PATHNAME) ? 2014 GetPString(IDS_PATH) : (sortflags & SORT_NOSORT) ? 2015 GetPString(IDS_NONE) : (sortflags & SORT_SUBJECT) ? 2016 GetPString(IDS_SUBJ) : GetPString(IDS_NAME)); 2017 2017 WinSetWindowText(hwnd, s); 2018 2018 free(s); … … 2027 2027 if (s) { 2028 2028 sprintf(s, "V:%s%s", 2029 2030 2031 2032 2033 2034 2035 2029 (flWindowAttr & CV_TREE) ? GetPString(IDS_TREE) : 2030 (flWindowAttr & CV_NAME) ? GetPString(IDS_NAME) : 2031 (flWindowAttr & CV_DETAIL) ? GetPString(IDS_DETAIL) : 2032 (flWindowAttr & CV_TEXT) ? GetPString(IDS_TEXT) : 2033 GetPString(IDS_ICON), 2034 ((flWindowAttr & CV_MINI) && 2035 !(flWindowAttr & CV_TEXT)) ? GetPString(IDS_MINI) : NullStr); 2036 2036 WinSetWindowText(hwnd, s); 2037 2037 free(s); … … 2046 2046 if (s) { 2047 2047 sprintf(s, "F:%s%s", 2048 2049 2050 2051 2052 2053 2048 mask->szMask, 2049 (!archive && (mask->attrFile != ALLATTRS || 2050 mask->antiattr != 0)) ? " " : NullStr, 2051 (!archive && (mask->attrFile != ALLATTRS || 2052 mask->antiattr != 2053 0)) ? GetPString(IDS_ATTRTEXT) : NullStr); 2054 2054 if (!s[2]) 2055 2055 sprintf(s, "F:%s", GetPString(IDS_ALLTEXT)); … … 2100 2100 2101 2101 sItemCount = (SHORT) WinSendMsg(hwndMenu, 2102 2102 MM_QUERYITEMCOUNT, MPVOID, MPVOID); 2103 2103 2104 2104 /* clean out old additions */ 2105 2105 while ((SHORT) WinSendMsg(hwndMenu, 2106 2107 2108 2106 MM_DELETEITEM, 2107 MPFROM2SHORT(IDM_SWITCHSTART + x++, 2108 TRUE), MPVOID) < sItemCount) 2109 2109 sItemCount--; 2110 2110 x = 0; 2111 2111 while ((SHORT) WinSendMsg(hwndMenu, 2112 2113 2114 2112 MM_DELETEITEM, 2113 MPFROM2SHORT(IDM_WINDOWSTART + x++, 2114 TRUE), MPVOID) < sItemCount) 2115 2115 sItemCount--; 2116 2116 … … 2127 2127 while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) { 2128 2128 if (WinQueryWindowUShort(hwndChild, QWS_ID) && hwndChild != hwndFrame) { 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2129 *wtext = 0; 2130 WinQueryWindowText(hwndChild, CCHMAXPATH + 8, wtext); 2131 if (*wtext) { 2132 wtext[CCHMAXPATH + 7] = 0; 2133 mi.afStyle = MIS_TEXT; 2134 if (!((x + sItemCount) % 28)) 2135 mi.afStyle |= MIS_BREAK; 2136 mi.id = IDM_WINDOWSTART + x; 2137 mi.iPosition = MIT_END; 2138 if ((SHORT) WinSendMsg(hwndMenu, 2139 MM_INSERTITEM, 2140 MPFROMP(&mi), MPFROMP(wtext)) >= 0) 2141 x++; 2142 } 2143 2143 } 2144 2144 } … … 2167 2167 memset(&mi, 0, sizeof(mi)); 2168 2168 for (i = 0; i < pswb->cswentry; i++) { 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2169 if (pswb->aswentry[i].swctl.uchVisibility == SWL_VISIBLE && 2170 pswb->aswentry[i].swctl.fbJump == SWL_JUMPABLE && 2171 (pswb->aswentry[i].swctl.idProcess != mypid || 2172 !hwndFrame || 2173 pswb->aswentry[i].swctl.hwnd != hwndFrame) && 2174 (pswb->aswentry[i].swctl.idProcess != mypid || 2175 !hwndTopFrame || 2176 pswb->aswentry[i].swctl.hwnd != hwndTopFrame || 2177 !WinIsChild(hwndFrame, hwndTop))) { 2178 if (!strnicmp(pswb->aswentry[i].swctl.szSwtitle, "AV/2", 4) 2179 || !stricmp(pswb->aswentry[i].swctl.szSwtitle, "File Manager/2") 2180 || !stricmp(pswb->aswentry[i].swctl.szSwtitle, "Collector") 2181 || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "VTree", 5) 2182 || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "VDir", 4) 2183 || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, FM2Str, 4)) { 2184 mi.afStyle = MIS_TEXT; 2185 if (x && !(x % 28)) 2186 mi.afStyle |= MIS_BREAK; 2187 mi.id = IDM_SWITCHSTART + y; 2188 mi.iPosition = MIT_END; 2189 switches[y] = pswb->aswentry[i].hswitch; 2190 if ((SHORT) WinSendMsg(hwndMenu, 2191 MM_INSERTITEM, 2192 MPFROMP(&mi), 2193 MPFROMP(pswb->aswentry[i]. 2194 swctl.szSwtitle)) >= 0) { 2195 y++; 2196 x++; 2197 } 2198 } 2199 } 2200 2200 } 2201 2201 numswitches = y; … … 2224 2224 mi.afStyle = MIS_TEXT; 2225 2225 if (WinSendMsg(hwndMenu, 2226 2227 2228 2226 MM_QUERYITEM, 2227 MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi))) 2228 hwndSubMenu = mi.hwndSubMenu; 2229 2229 } 2230 2230 else … … 2233 2233 *s = 0; 2234 2234 if (WinSendMsg(hwndSubMenu, 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2235 MM_QUERYITEMTEXT, 2236 MPFROM2SHORT(cmd, CCHMAXPATH + 8), MPFROMP(s)) && *s) { 2237 2238 HENUM henum; 2239 CHAR checkText[CCHMAXPATH + 8]; 2240 SWP swp; 2241 2242 s[CCHMAXPATH + 7] = 0; 2243 henum = WinBeginEnumWindows(hwndMain); 2244 while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) { 2245 if (WinQueryWindowUShort(hwndChild, QWS_ID)) { 2246 *checkText = 0; 2247 WinQueryWindowText(hwndChild, CCHMAXPATH + 8, checkText); 2248 checkText[CCHMAXPATH + 7] = 0; 2249 if (!stricmp(checkText, s)) { 2250 if (WinQueryWindowPos(hwndChild, &swp)) { 2251 if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) 2252 WinSetWindowPos(hwndChild, 2253 HWND_TOP, 2254 0, 0, 0, 0, SWP_RESTORE | SWP_ZORDER); 2255 } 2256 WinSetActiveWindow(HWND_DESKTOP, hwndChild); 2257 ret = TRUE; 2258 break; 2259 } 2260 } 2261 } 2262 WinEndEnumWindows(henum); 2263 2263 } 2264 2264 } … … 2280 2280 */ 2281 2281 2282 INT CheckDriveSpaceAvail( CHAR *pTargetPath, ULONGLONG ullSpaceNeeded,2283 2282 INT CheckDriveSpaceAvail(PCSZ pTargetPath, ULONGLONG ullSpaceNeeded, 2283 ULONGLONG ullFreeSpaceWhenComplete) 2284 2284 { 2285 2285 FSALLOCATE fsa; … … 2295 2295 2296 2296 CommaFmtULL(szKB, sizeof(szKB), 2297 2297 ullFreeQty - ullSpaceNeeded, ' '); 2298 2298 if (ullFreeSpaceWhenComplete == 0) { 2299 2299 saymsg(MB_OK, 2300 2301 2302 2303 2300 HWND_DESKTOP, 2301 NullStr, 2302 GetPString(IDS_DRIVESPACELIMITEDTMPSAVE), 2303 pTargetPath); 2304 2304 return 0; 2305 2305 } 2306 2306 else { 2307 2307 if (ullFreeQty > ullSpaceNeeded) { 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2308 ret = saymsg(MB_YESNO, 2309 HWND_DESKTOP, 2310 NullStr, 2311 GetPString(IDS_DRIVESPACELIMITED), 2312 pTargetPath, 2313 szKB); 2314 if (ret == MBID_YES) 2315 return 0; 2316 else 2317 return 2; 2318 2318 } 2319 2319 else { 2320 2321 2322 2323 2324 2325 2320 saymsg(MB_OK, 2321 HWND_DESKTOP, 2322 NullStr, 2323 GetPString(IDS_DRIVESPACEEXCEEDED), 2324 pTargetPath); 2325 return 2; 2326 2326 } 2327 2327 }
Note:
See TracChangeset
for help on using the changeset viewer.