Changeset 1159
- Timestamp:
- Sep 5, 2008, 11:41:13 PM (17 years ago)
- Location:
- trunk/dll
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/autoview.c
r1078 r1159 43 43 #include "errutil.h" // Dos_Error... 44 44 #include "strutil.h" // GetPString 45 #include "autoview.h" 46 #include "defview.h" // DefaultView 47 #include "valid.h" // IsBinary 45 48 #include "fm3dll.h" 46 49 … … 54 57 static CHAR stopflag; 55 58 static CHAR currfile[CCHMAXPATH]; 59 60 static BOOL PutComments(HWND hwnd, CHAR * filename, CHAR * comments); 61 static BOOL WriteEA(HWND hwnd, CHAR * filename, CHAR * eaname, USHORT type, 62 CHAR * data); 56 63 57 64 BOOL WriteEA(HWND hwnd, CHAR * filename, CHAR * eaname, USHORT type, -
trunk/dll/codepage.c
r907 r1159 25 25 #include "strutil.h" // GetPString 26 26 #include "errutil.h" // Runtime_Error 27 #include "codepage.h" 27 28 #include "fm3dll.h" 28 29 -
trunk/dll/collect.c
r1120 r1159 1 2 1 /*********************************************************************** 3 2 … … 83 82 #include "notebook.h" // CfgDlgProc 84 83 #include "command.h" // RunCommand 84 #include "worker.h" // Action, MassAction 85 #include "notify.h" // AddNote 86 #include "misc.h" // AdjustCnrColsForPref, AdjustDetailsSwitches, CnrDirectEdit, 87 // LoadDetailsSwitches, OpenEdit, QuickPopup, SayFilter 88 // SaySort, SayView, SetCnrCols, SetDetailsSwitches 89 // SetSortChecks, SetViewMenu, disable_menuitem 90 #include "chklist.h" // CenterOverWindow, DropListProc 91 #include "collect.h" 92 #include "common.h" // CommonCnrProc, CommonCreateTextChildren, CommonFrameWndProc 93 // CommonTextPaint 94 #include "select.h" // DeselectAll, HideAll, RemoveAll, SelectAll, SelectList 95 #include "dirsize.h" // DirSizeProc 96 #include "grep2.h" // GrepDlgProc 97 #include "mainwnd.h" // MakeBubble 98 #include "objwin.h" // MakeObjWin 99 #include "saveclip.h" // SaveListDlgProc 100 #include "findrec.h" // ShowCnrRecord 101 #include "sortcnr.h" // SortCollectorCnr 102 #include "seeall.h" // StartSeeAll 103 #include "update.h" // UpdateCnrList, UpdateCnrRecord 85 104 #include "fm3dll.h" 105 #include "select.h" // InvertAll 86 106 87 107 #include "fortify.h" -
trunk/dll/common.c
r1041 r1159 41 41 #include "errutil.h" // Dos_Error... 42 42 #include "strutil.h" // GetPString 43 #include "autoview.h" // AutoViewProc 44 #include "mainwnd.h" // BuildDriveBarButtons, TopWindow 45 #include "common.h" 46 #include "dirsize.h" // DirSizeProc 47 #include "info.h" // DrvInfoProc, SetDrvProc 48 #include "seeall.h" // StartSeeAll 43 49 #include "fm3dll.h" 44 50 #include "fortify.h" -
trunk/dll/dirs.c
r907 r1159 17 17 #include <ctype.h> 18 18 19 #define INCL_LONGLONG 19 #define INCL_LONGLONG // dircnrs.h 20 20 21 21 #include "fm3dll.h" 22 #include "dirs.h" 23 #include "valid.h" // IsValidDir 22 24 23 25 APIRET save_dir2(CHAR * curdir) … … 33 35 env = strrchr(curdir, '\\'); 34 36 if (env) { 35 36 37 37 *env = 0; 38 if (IsValidDir(curdir)) 39 return 0; 38 40 } 39 41 } … … 50 52 *curdir = 0; 51 53 ret = DosQCurDisk(&curdrive, &drivemap); 52 curdirlen = CCHMAXPATH - 4; 54 curdirlen = CCHMAXPATH - 4; /* NOTE!!!!!!!!! */ 53 55 ret += DosQCurDir(curdrive, &curdir[3], &curdirlen); 54 56 *curdir = (CHAR) ('@' + (INT) curdrive); … … 71 73 p = strrchr(path, '\\'); 72 74 if (p) 73 75 *p = 0; 74 76 else { 75 76 77 strcpy(path, s); 78 break; 77 79 } 78 80 } … … 86 88 if (!DosQCurDisk(&curdrive, &drivemap)) { 87 89 if ((CHAR) ((CHAR) curdrive + '@') != (CHAR) toupper(*HomePath) && 88 89 90 (CHAR) ((CHAR) curdrive + '@') != (CHAR) toupper(*path)) 91 DosChDir("\\"); 90 92 } 91 93 ret = DosSelectDisk(toupper(*path) - '@'); -
trunk/dll/droplist.c
r1063 r1159 33 33 #include "errutil.h" // Dos_Error... 34 34 #include "strutil.h" // GetPString 35 #include "droplist.h" 35 36 #include "fm3dll.h" 36 37 … … 40 41 41 42 static ULONG GetDropCount(HWND hwnd, MPARAM mp1); 43 static BOOL TwoDrgNames(PDRAGITEM pDItem, CHAR * buffer1, ULONG buflen1, 44 char *buffer2, ULONG buflen2); 42 45 43 46 BOOL CheckPmDrgLimit(PDRAGINFO pDInfo) -
trunk/dll/filldir.c
r1154 r1159 69 69 #include "fortify.h" // 06 May 08 SHL 70 70 #include "notebook.h" // INI file fields 71 #include "flesh.h" // FleshEnv, Stubby 72 #include "update.h" // SelectDriveIcon 71 73 #include "fm3dll.h" 72 74 -
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); -
trunk/dll/misc.h
r1078 r1159 25 25 #endif 26 26 27 SHORT AddToListboxBottom(HWND hwnd, CHAR * str); 28 BOOL AdjustCnrColRO(HWND hwndCnr, CHAR * title, BOOL readonly, BOOL toggle); 29 BOOL AdjustCnrColVis(HWND hwndCnr, CHAR * title, BOOL visible, BOOL toggle); 30 VOID AdjustCnrColsForFSType(HWND hwndCnr, CHAR * directory, DETAILS_SETTINGS * pds); 31 VOID AdjustCnrColsForPref(HWND hwndCnr, CHAR * directory, DETAILS_SETTINGS * pds, 32 BOOL compare); 33 VOID AdjustDetailsSwitches(HWND hwnd, HWND hwndMenu, USHORT cmd, 34 CHAR * directory, CHAR * keyroot, DETAILS_SETTINGS * pds, 35 BOOL compare); 36 void BoxWindow(HWND hwnd, HPS hps, LONG color); 37 MRESULT CnrDirectEdit(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 38 void EmphasizeButton(HWND hwnd, BOOL on); 39 INT ExecFile(HWND hwnd, CHAR * filename); 40 HWND FindDirCnr(HWND hwndParent); 41 VOID FixSwitchList(HWND hwnd, CHAR * text); 42 VOID HeapThread(VOID * dummy); 43 VOID LoadDetailsSwitches(CHAR * keyroot, DETAILS_SETTINGS * pds); 44 VOID LoadLibPath(CHAR * str, LONG len); 45 VOID OpenEdit(HWND hwnd); 46 void PaintSTextWindow(HWND hwnd, HPS hps); 47 VOID QuickPopup(HWND hwnd, DIRCNRDATA * dcd, HWND hwndMenu, USHORT id); 48 void SayFilter(HWND hwnd, MASK * mask, BOOL archive); 49 void SaySort(HWND hwnd, INT sortflags, BOOL archive); 50 void SayView(HWND hwnd, ULONG flWindowAttr); 51 BOOL SetCnrCols(HWND hwndCnr, BOOL compare); 52 VOID SetConditionalCascade(HWND hwndMenu, USHORT id, USHORT def); 53 VOID SetDetailsSwitches(HWND hwnd, DETAILS_SETTINGS * pds); 54 BOOL SetMenuCheck(HWND hwndMenu, USHORT id, BOOL * bool, BOOL toggle, 55 CHAR * savename); 56 VOID SetSortChecks(HWND hwndMenu, INT sortflags); 57 VOID SetSysMenu(HWND hwndSysMenu); 58 void SetViewMenu(HWND hwndMenu, ULONG flWindowAttr); 59 BOOL SwitchCommand(HWND hwndMenu, USHORT cmd); 60 BOOL ViewHelp(CHAR * filename); 61 VOID disable_menuitem(HWND hwndMenu, USHORT id, BOOL enable); 62 27 63 #endif // MISC_H -
trunk/dll/viewinf.c
r1104 r1159 23 23 #include <string.h> 24 24 #include <share.h> 25 #include <process.h> 25 #include <process.h> // _beginthread 26 26 27 27 #define INCL_DOS … … 31 31 #include "fm3dlg.h" 32 32 #include "fm3str.h" 33 #include "errutil.h" 34 #include "strutil.h" 33 #include "errutil.h" // Dos_Error... 34 #include "strutil.h" // GetPString 35 35 #include "pathutil.h" // BldFullPathName 36 36 #include "fm3dll.h" 37 #include "viewinf.h" 38 #include "misc.h" // ViewHelp 37 39 #include "fortify.h" 38 40 … … 74 76 priority_normal(); 75 77 if (!dummy->help) 76 78 env = getenv("BOOKSHELF"); 77 79 else 78 80 env = getenv("HELP"); 79 81 if (!env) { 80 81 82 83 84 85 86 82 saymsg(MB_CANCEL, 83 hwnd, 84 GetPString(IDS_SYSERRORTEXT), 85 GetPString(IDS_ENVPATHERRORTEXT), 86 (dummy->help) ? "HELP" : "BOOKSHELF", 87 (dummy->help) ? ".HLP" : ".INF"); 88 goto NoEnv; 87 89 } 88 90 else { 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 91 holdenv = xmalloc(strlen(env) + 2, pszSrcFile, __LINE__); 92 if (holdenv) { 93 strcpy(holdenv, env); 94 Repeat: 95 if (holdenv[strlen(holdenv) - 1] != ';') 96 strcat(holdenv, ";"); 97 p = strtok(holdenv, ";"); 98 while (p) { 99 bstrip(p); 100 if (*p) { 101 102 CHAR mask[CCHMAXPATH], *enddir, text[CCHMAXPATH * 2]; 103 FILEFINDBUF3 ffb; 104 HDIR hdir; 105 ULONG nm; 106 107 strcpy(mask, p); 108 if (mask[strlen(mask) - 1] != '\\') 109 strcat(mask, "\\"); 110 enddir = mask + strlen(mask); 111 if (dummy->help) 112 strcat(mask, "*.HLP"); 113 else 114 strcat(mask, "*.INF"); 115 hdir = HDIR_CREATE; 116 nm = 1; 117 DosError(FERR_DISABLEHARDERR); 118 if (!DosFindFirst(mask, &hdir, FILE_NORMAL | FILE_ARCHIVED, 119 &ffb, sizeof(ffb), &nm, FIL_STANDARD)) { 120 do { 121 priority_normal(); 122 strcpy(enddir, ffb.achName); 123 { 124 FILE *fp; 125 CHAR title[CCHMAXPATH]; 126 127 *title = 0; 128 fp = _fsopen(mask, "rb", SH_DENYNO); 129 if (fp) { 130 fread(title, 1, 3, fp); 131 if (*title != 'H' || title[1] != 'S' || title[2] != 'P') { 132 fclose(fp); 133 goto Continue; 134 } 135 *title = 0; 136 fseek(fp, 107, SEEK_SET); 137 fread(title, 1, CCHMAXPATH - 2, fp); 138 title[CCHMAXPATH - 3] = 0; 139 bstrip(title); 140 fclose(fp); 141 } 142 p = strchr(ffb.achName, '.'); 143 if (p) 144 *p = 0; 145 sprintf(text, 146 "%-10.10s %-42.42s > %s", 147 ffb.achName, title, mask); 148 } 149 if (!WinIsWindow(hab2, hwnd)) 150 break; 151 WinSendDlgItemMsg(hwnd, 152 VINF_LISTBOX, 153 LM_INSERTITEM, 154 MPFROM2SHORT(LIT_SORTASCENDING, 0), 155 MPFROMP(text)); 156 Continue: 157 nm = 1; 158 } while (!DosFindNext(hdir, &ffb, sizeof(ffb), &nm)); 159 DosFindClose(hdir); 160 priority_normal(); 161 } 162 } 163 if (!WinIsWindow(hab2, hwnd)) 164 break; 165 p = strtok(NULL, ";"); 166 } 167 free(holdenv); 168 NoEnv: 169 if (WinIsWindow(hab2, hwnd) && !repeating) { 170 171 ULONG size; 172 CHAR *key = "INFPaths"; 173 174 if (dummy->help) 175 key = "HLPPaths"; 176 repeating = TRUE; 177 if (PrfQueryProfileSize(fmprof, FM3Str, key, &size) && size) { 178 holdenv = xmalloc(size + 2, pszSrcFile, __LINE__); 179 if (holdenv) { 180 if (!PrfQueryProfileData(fmprof, FM3Str, key, holdenv, &size)) { 181 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__, 182 "PrfQueryProfileData"); 183 free(holdenv); 184 } 185 else 186 goto Repeat; 187 } 188 } 189 } 190 } 189 191 } 190 192 WinDestroyMsgQueue(hmq2); … … 211 213 case WM_INITDLG: 212 214 WinSendDlgItemMsg(hwnd, VINF_ENTRY, EM_SETTEXTLIMIT, 213 215 MPFROM2SHORT(1000, 0), MPVOID); 214 216 WinSendDlgItemMsg(hwnd, VINF_TOPIC, EM_SETTEXTLIMIT, 215 217 MPFROM2SHORT(CCHMAXPATH * 2, 0), MPVOID); 216 218 if (hwndMe) { 217 219 WinSetWindowPos(hwndMe, HWND_TOP, 0, 0, 0, 0, SWP_RESTORE | SWP_ZORDER | 218 220 SWP_ACTIVATE); 219 221 WinDismissDlg(hwnd, 0); 220 222 break; … … 228 230 WinDestroyWindow(WinWindowFromID(hwnd, VINF_LISTBOX)); 229 231 if (!WinCreateWindow(hwnd, 230 231 232 233 234 235 236 237 238 232 WC_LISTBOX, 233 (PSZ) NULL, 234 WS_VISIBLE | LS_HORZSCROLL, 235 swp.x, 236 swp.y, 237 swp.cx, 238 swp.cy, 239 hwnd, HWND_TOP, VINF_LISTBOX, NULL, NULL)) { 240 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 239 241 } 240 242 else { 241 242 243 244 243 WinSetPresParam(WinWindowFromID(hwnd, VINF_LISTBOX), 244 PP_FONTNAMESIZE, 245 strlen(GetPString(IDS_10SYSTEMMONOTEXT)) + 1, 246 (PVOID) GetPString(IDS_10SYSTEMMONOTEXT)); 245 247 } 246 248 WinSetWindowText(hwnd, GetPString(IDS_VIEWHELPFILESTEXT)); … … 264 266 d = xmallocz(sizeof(DUMMY), pszSrcFile, __LINE__); 265 267 if (!d) { 266 267 268 WinDismissDlg(hwnd, 0); 269 return 0; 268 270 } 269 271 else { 270 271 272 273 274 275 276 277 278 279 280 281 282 272 d->size = sizeof(DUMMY); 273 d->hwnd = hwnd; 274 if (help) 275 d->help = 1; 276 if (_beginthread(FillListboxThread, NULL, 65536, (PVOID) d) == -1) { 277 Runtime_Error(pszSrcFile, __LINE__, 278 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 279 free(d); 280 WinDismissDlg(hwnd, 0); 281 return 0; 282 } 283 WinEnableWindow(WinWindowFromID(hwnd, DID_CANCEL), FALSE); 284 threaddone = FALSE; 283 285 } 284 286 } … … 287 289 case UM_CONTAINER_FILLED: 288 290 if (!(SHORT) WinSendDlgItemMsg(hwnd, 289 290 291 VINF_LISTBOX, 292 LM_QUERYITEMCOUNT, MPVOID, MPVOID)) { 291 293 saymsg(MB_CANCEL, 292 293 294 hwnd, 295 GetPString(IDS_ERRORTEXT), GetPString(IDS_NOFILESFOUNDTEXT)); 294 296 hwndMe = (HWND) 0; 295 297 WinDismissDlg(hwnd, 0); … … 304 306 switch (SHORT2FROMMP(mp1)) { 305 307 case LN_ENTER: 306 307 308 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(DID_OK, 0), MPVOID); 309 break; 308 310 } 309 311 break; … … 311 313 switch (SHORT2FROMMP(mp1)) { 312 314 case EN_CHANGE: 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 315 { 316 SHORT sSelect; 317 CHAR szBuffer[CCHMAXPATH]; 318 319 WinQueryDlgItemText(hwnd, VINF_ENTRY, CCHMAXPATH, szBuffer); 320 bstrip(szBuffer); 321 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, 322 VINF_LISTBOX, 323 LM_SEARCHSTRING, 324 MPFROM2SHORT(LSS_SUBSTRING, 325 LIT_FIRST), 326 MPFROMP(szBuffer)); 327 if (sSelect >= 0) 328 WinSendDlgItemMsg(hwnd, 329 VINF_LISTBOX, 330 LM_SETTOPINDEX, 331 MPFROM2SHORT(sSelect, 0), MPVOID); 332 } 333 break; 332 334 } 333 335 break; … … 345 347 WinQueryWindowPos(hwnd, &swp); 346 348 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) { 347 348 349 350 351 352 353 354 355 356 349 WinQueryWindowPos(WinWindowFromID(hwnd, VINF_LISTBOX), &swpC); 350 if (!ypos) 351 ypos = swpC.y; 352 WinSetWindowPos(WinWindowFromID(hwnd, VINF_LISTBOX), HWND_TOP, 353 SysVal(SV_CXSIZEBORDER), 354 ypos, 355 swp.cx - (SysVal(SV_CXSIZEBORDER) * 2), 356 (swp.cy - ypos) - (SysVal(SV_CYTITLEBAR) + 357 SysVal(SV_CYSIZEBORDER)), 358 SWP_MOVE | SWP_SIZE); 357 359 } 358 360 } … … 367 369 case VINF_SRCH: 368 370 { 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 371 SHORT sSelect, sLast = LIT_FIRST; 372 CHAR szBuffer[CCHMAXPATH]; 373 374 *szBuffer = 0; 375 WinQueryDlgItemText(hwnd, VINF_ENTRY, CCHMAXPATH, szBuffer); 376 rstrip(szBuffer); 377 if (!*szBuffer) { 378 sLast = (SHORT) WinSendDlgItemMsg(hwnd, 379 VINF_LISTBOX, 380 LM_QUERYITEMCOUNT, 381 MPVOID, MPVOID); 382 for (sSelect = 0; sSelect < sLast; sSelect++) 383 WinSendDlgItemMsg(hwnd, 384 VINF_LISTBOX, 385 LM_SELECTITEM, 386 MPFROM2SHORT(sSelect, 0), 387 MPFROM2SHORT(FALSE, 0)); 388 break; 389 } 390 for (;;) { 391 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, VINF_LISTBOX, 392 LM_SEARCHSTRING, 393 MPFROM2SHORT(LSS_SUBSTRING, 394 sLast), 395 MPFROMP(szBuffer)); 396 if (sSelect <= sLast) 397 break; 398 if (sSelect >= 0) 399 WinSendDlgItemMsg(hwnd, 400 VINF_LISTBOX, 401 LM_SELECTITEM, 402 MPFROM2SHORT(sSelect, 0), 403 MPFROM2SHORT(TRUE, 0)); 404 else 405 break; 406 sLast = sSelect; 407 } 406 408 } 407 409 break; … … 409 411 case VINF_FILTER: 410 412 { 411 412 413 414 415 416 417 418 419 420 421 422 423 424 413 SHORT sSelect, sTotal; 414 415 sTotal = (SHORT) WinSendDlgItemMsg(hwnd, 416 VINF_LISTBOX, 417 LM_QUERYITEMCOUNT, MPVOID, MPVOID); 418 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, 419 VINF_LISTBOX, 420 LM_QUERYSELECTION, 421 MPFROM2SHORT(LIT_FIRST, 0), 422 MPVOID); 423 if (sSelect == LIT_NONE) { 424 DosBeep(50, 100); 425 break; 426 } 425 427 #ifdef BUGFIXED 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 428 sSelect = 0; 429 while (sSelect < sTotal) { 430 if (!WinSendDlgItemMsg(hwnd, 431 VINF_LISTBOX, 432 LM_SELECTITEM, 433 MPFROM2SHORT(sSelect, 0), 434 MPFROM2SHORT(FALSE, 0))) { 435 WinSendDlgItemMsg(hwnd, 436 VINF_LISTBOX, 437 LM_DELETEITEM, 438 MPFROM2SHORT(sSelect, 0), MPVOID); 439 sTotal--; 440 } 441 else 442 sSelect++; 443 } 442 444 #else // !BUGIFIXED 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 445 for (sSelect = 0; sSelect < sTotal; sSelect++) 446 WinSendDlgItemMsg(hwnd, 447 VINF_LISTBOX, 448 LM_SETITEMHANDLE, 449 MPFROM2SHORT(sSelect, 0), MPVOID); 450 sSelect = LIT_FIRST; 451 for (;;) { 452 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, 453 VINF_LISTBOX, 454 LM_QUERYSELECTION, 455 MPFROM2SHORT(sSelect, 0), 456 MPVOID); 457 if (sSelect >= 0) 458 WinSendDlgItemMsg(hwnd, 459 VINF_LISTBOX, 460 LM_SETITEMHANDLE, 461 MPFROM2SHORT(sSelect, 0), MPFROMLONG(1)); 462 else 463 break; 464 } 465 for (sSelect = 0; sSelect < sTotal; sSelect++) 466 WinSendDlgItemMsg(hwnd, 467 VINF_LISTBOX, 468 LM_SELECTITEM, 469 MPFROM2SHORT(sSelect, 0), MPFROM2SHORT(FALSE, 0)); 470 sSelect = 0; 471 while (sSelect < sTotal) { 472 if (!WinSendDlgItemMsg(hwnd, 473 VINF_LISTBOX, 474 LM_QUERYITEMHANDLE, 475 MPFROM2SHORT(sSelect, 0), MPVOID)) { 476 WinSendDlgItemMsg(hwnd, 477 VINF_LISTBOX, 478 LM_DELETEITEM, 479 MPFROM2SHORT(sSelect, 0), MPVOID); 480 sTotal--; 481 } 482 else 483 sSelect++; 484 } 483 485 #endif // BUGFIXED 484 486 } … … 487 489 case VINF_DIRS: 488 490 { 489 490 491 492 493 494 495 496 497 498 499 500 491 CHAR szBuffer[1001], *key = "INFPaths"; 492 493 if (help) 494 key = "HLPPaths"; 495 *szBuffer = 0; 496 WinQueryDlgItemText(hwnd, VINF_ENTRY, 1000, szBuffer); 497 bstrip(szBuffer); 498 PrfWriteProfileData(fmprof, 499 FM3Str, 500 key, 501 (*szBuffer) ? szBuffer : NULL, strlen(szBuffer)); 502 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 501 503 } 502 504 break; … … 509 511 case DID_OK: 510 512 { 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 513 SHORT sSelect; 514 CHAR text[CCHMAXPATH * 2], filename[CCHMAXPATH], *p; 515 FILE *fp; 516 BOOL notfirst = FALSE; 517 518 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, 519 VINF_LISTBOX, 520 LM_QUERYSELECTION, 521 MPFROM2SHORT(LIT_FIRST, 0), 522 MPVOID); 523 if (sSelect < 0) { 524 DosBeep(50, 100); 525 } 526 else { 527 if (help) { 528 *text = 0; 529 WinSendDlgItemMsg(hwnd, 530 VINF_LISTBOX, 531 LM_QUERYITEMTEXT, 532 MPFROM2SHORT(sSelect, CCHMAXPATH), 533 MPFROMP(text)); 534 p = strchr(text, '>'); 535 if (!p) { 536 DosBeep(50, 100); 537 break; 538 } 539 p++; 540 bstrip(p); 541 if (!*p) 542 DosBeep(50, 100); 543 else 544 ViewHelp(p); 545 break; 544 546 } 545 547 BldFullPathName(filename, pFM2SaveDirectory, "FM2VINF.CMD"); 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 }// while573 574 575 576 577 578 579 580 581 582 583 584 585 548 fp = xfopen(filename, "w", pszSrcFile, __LINE__); 549 if (fp) { 550 fprintf(fp, "@ECHO OFF\nSET FM2REF="); 551 while (sSelect >= 0) { 552 *text = 0; 553 WinSendDlgItemMsg(hwnd, 554 VINF_LISTBOX, 555 LM_QUERYITEMTEXT, 556 MPFROM2SHORT(sSelect, 557 CCHMAXPATH), MPFROMP(text)); 558 p = strchr(text, '>'); 559 if (p) { 560 p++; 561 bstrip(p); 562 if (*p) { 563 if (notfirst) 564 fprintf(fp, "+"); 565 notfirst = TRUE; 566 fprintf(fp, "%s", p); 567 } 568 } 569 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, 570 VINF_LISTBOX, 571 LM_QUERYSELECTION, 572 MPFROM2SHORT(sSelect, 0), 573 MPVOID); 574 } // while 575 *text = 0; 576 WinQueryDlgItemText(hwnd, VINF_TOPIC, CCHMAXPATH * 2, text); 577 bstrip(text); 578 fprintf(fp, 579 "\nVIEW FM2REF%s%s\nDEL %s\n", 580 (*text) ? " " : NullStr, text, filename); 581 fclose(fp); 582 runemf2(SEPARATE | WINDOWED | MINIMIZED | 583 BACKGROUND | INVISIBLE, 584 hwnd, pszSrcFile, __LINE__, 585 NULL, NULL, "%s /C %s", GetCmdSpec(FALSE), filename); 586 } 587 } 586 588 } 587 589 break; … … 589 591 case IDM_HELP: 590 592 if (hwndHelp) { 591 592 593 594 595 596 597 598 599 600 593 if (help) 594 WinSendMsg(hwndHelp, 595 HM_DISPLAY_HELP, 596 MPFROM2SHORT(HELP_VIEWHELPS, 0), 597 MPFROMSHORT(HM_RESOURCEID)); 598 else 599 WinSendMsg(hwndHelp, 600 HM_DISPLAY_HELP, 601 MPFROM2SHORT(HELP_VIEWINF, 0), 602 MPFROMSHORT(HM_RESOURCEID)); 601 603 } 602 604 break; … … 613 615 hwndMe = (HWND) 0; 614 616 if (hptrIcon) 615 617 WinDestroyPointer(hptrIcon); 616 618 hptrIcon = (HPOINTER) 0; 617 619 }
Note:
See TracChangeset
for help on using the changeset viewer.