Changeset 1394 for trunk/dll/comp.c


Ignore:
Timestamp:
Feb 5, 2009, 5:17:25 AM (17 years ago)
Author:
Steven Levine
Message:

Ticket 340: Convert GetPString to use STRINGTABLE.

Drop fm3dll.str and mkstr.exe from makefiles and wpi builders

Convert many functions to expect PCSZ arguments.
Correct walk, compare and dirsizes dialog setups to ignore saved dialog size
Drop copyright.c logic from makefile

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/comp.c

    r1391 r1394  
    77
    88  Copyright (c) 1993-02 M. Kimes
    9   Copyright (c) 2003, 2008 Steven H. Levine
     9  Copyright (c) 2003, 2009 Steven H. Levine
    1010
    1111  16 Oct 02 MK Baseline
     
    553553            break;
    554554
    555           case IDM_MOVE:
    556             {
    557               BOOL fResetVerify = FALSE;
    558 
    559               if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR))
    560                 BldFullPathName(szNewName, cmp->leftdir, pciS->pszDisplayName);
    561               else
    562                 BldFullPathName(szNewName, cmp->rightdir, pciS->pszDisplayName);
    563               // Make directory if required
    564               strcpy(szDirName, szNewName);
    565               p = strrchr(szDirName, '\\');
    566               if (fVerify && (driveflags[toupper(*szNewName) - 'A'] & DRIVE_WRITEVERIFYOFF ||
    567                               driveflags[toupper(*pciS->pszFileName) - 'A'] & DRIVE_WRITEVERIFYOFF)) {
    568                 DosSetVerify(FALSE);
    569                 fResetVerify = TRUE;
    570               }
    571               if (p) {
    572                 if (p > szDirName + 2)
    573                   p++;
    574                 *p = 0;
    575                 if (IsFile(szDirName) == -1)
    576                   MassMkdir(hwndMain, szDirName);
    577               }
    578               rc = docopyf(MOVE, pciS->pszFileName, "%s", szNewName);
    579               if (fResetVerify) {
    580                 DosSetVerify(fVerify);
    581                 fResetVerify = FALSE;
    582               }
    583               if (!rc && stricmp(pciS->pszFileName, szNewName)) {
    584                 WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciS),
    585                            MPFROM2SHORT(FALSE, CRA_SELECTED));
    586                 if (pciD->rc.flRecordAttr & CRA_SELECTED)
    587                   WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciD),
    588                              MPFROM2SHORT(FALSE, CRA_SELECTED));
    589                 FreeCnrItemData(pciD);
    590                 pciD->pszFileName = xstrdup(szNewName, pszSrcFile, __LINE__);
    591                 if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) {
    592                   pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->leftdir);
    593                   if (cmp->leftdir[strlen(cmp->leftdir) - 1] != '\\')
    594                     pciD->pszDisplayName++;
    595                 }
    596                 else {
    597                   pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->rightdir);
    598                   if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\')
    599                     pciD->pszDisplayName++;
    600                 }
    601                 pciD->pszLongName = pciS->pszLongName;
    602                 pciS->pszLongName = NullStr;    // 07 Sep 08 SHL avoid aliased pointer
    603                 if (pciD->pszSubject != NullStr) {
    604                   xfree(pciD->pszSubject, pszSrcFile, __LINE__);
    605                   pciD->pszSubject = NullStr;
    606                 }
    607                 pciD->attrFile = pciS->attrFile;
    608                 pciD->pszDispAttr = pciS->pszDispAttr;
    609                 pciD->flags = 0;                // Just on one side
    610                 pciD->date = pciS->date;
    611                 pciD->time = pciS->time;
    612                 pciD->ladate = pciS->ladate;
    613                 pciD->latime = pciS->latime;
    614                 pciD->crdate = pciS->crdate;
    615                 pciD->crtime = pciS->crtime;
    616                 pciD->cbFile = pciS->cbFile;
    617                 pciD->easize = pciS->easize;
    618 
    619                 if (pciS->pszFileName != NullStr) {
    620                   xfree(pciS->pszFileName, pszSrcFile, __LINE__);
    621                   pciS->pszFileName = NullStr;
    622                   pciS->pszDisplayName = pciS->pszFileName;
    623                   pciS->rc.pszIcon = pciS->pszFileName;
    624                 }
    625                 if (pciS->pszSubject != NullStr) {
    626                   xfree(pciS->pszSubject, pszSrcFile, __LINE__);
    627                   pciS->pszSubject = NullStr;
    628                 }
    629                 pciS->flags = 0;                // Just on one side
    630 
    631                 WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pciS),
    632                            MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
    633 
    634                 WinSendMsg(hwndCnrD, CM_INVALIDATERECORD, MPFROMP(&pciD),
    635                            MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
    636 
    637                 if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_LEFTDIR))
    638                   cmp->cmp->totalleft--;
    639                 else
    640                   cmp->cmp->totalright--;
    641               }
    642               else if (rc) {
    643                 rc = Dos_Error(MB_ENTERCANCEL,
    644                                rc,
    645                                HWND_DESKTOP,
    646                                pszSrcFile,
    647                                __LINE__,
    648                                GetPString(IDS_COMPMOVEFAILEDTEXT),
    649                                pciS->pszFileName, szNewName);
    650                 if (rc == MBID_CANCEL)  // Cause loop to break
    651                   pciNextS = NULL;
    652               }
    653               break;
    654             }
    655 
    656           case IDM_COPY:
    657             {
    658               BOOL fResetVerify = FALSE;
    659 
    660               if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR))
    661                 BldFullPathName(szNewName, cmp->leftdir, pciS->pszDisplayName);
    662               else
    663                 BldFullPathName(szNewName, cmp->rightdir, pciS->pszDisplayName);
    664               // Make directory if required
    665               strcpy(szDirName, szNewName);
    666               p = strrchr(szDirName, '\\');
    667               if (fVerify && (driveflags[toupper(*szNewName) - 'A'] & DRIVE_WRITEVERIFYOFF ||
    668                                 driveflags[toupper(*pciS->pszFileName) - 'A'] & DRIVE_WRITEVERIFYOFF)) {
    669                 DosSetVerify(FALSE);
    670                 fResetVerify = TRUE;
    671               }
    672               if (p) {
    673                 if (p > szDirName + 2)
    674                   p++;
    675                 *p = 0;
    676                 if (IsFile(szDirName) == -1)
    677                   MassMkdir(hwndMain, szDirName);
    678               }
    679               rc = docopyf(COPY, pciS->pszFileName, "%s", szNewName);
    680               if (fResetVerify) {
    681                 DosSetVerify(fVerify);
    682                 fResetVerify = FALSE;
    683               }
    684               if (rc) {
    685                 rc = Dos_Error(MB_ENTERCANCEL,
    686                                rc,
    687                                HWND_DESKTOP,
    688                                pszSrcFile,
    689                                __LINE__,
    690                                GetPString(IDS_COMPCOPYFAILEDTEXT),
    691                                pciS->pszFileName, szNewName);
    692                 if (rc == MBID_CANCEL)
    693                   pciNextS = NULL;      // Cause loop to break
    694               }
    695               else {
    696                 WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciS),
    697                            MPFROM2SHORT(FALSE, CRA_SELECTED));
    698                 if (pciD->rc.flRecordAttr & CRA_SELECTED)
    699                   WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciD),
    700                              MPFROM2SHORT(FALSE, CRA_SELECTED));
    701                 // 12 Jan 08 SHL
    702                 if (pciD->pszFileName == NullStr) {
    703                   if (hwndCnrD == WinWindowFromID(cmp->hwnd, COMP_LEFTDIR))
    704                     cmp->totalleft++;
    705                   else
    706                     cmp->totalright++;
    707                 }
    708                 FreeCnrItemData(pciD);
    709                 pciD->pszFileName = xstrdup(szNewName, pszSrcFile, __LINE__);
    710                 if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) {
    711                   pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->leftdir);
    712                   if (cmp->leftdir[strlen(cmp->leftdir) - 1] != '\\')
    713                     pciD->pszDisplayName++;
    714                 }
    715                 else {
    716                   pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->rightdir);
    717                   if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\')
    718                     pciD->pszDisplayName++;
    719                 }
    720                 pciD->attrFile = pciS->attrFile;
    721                 pciD->pszDispAttr = pciS->pszDispAttr;
    722                 pciD->flags = CNRITEM_EXISTS;   // Now on both sides
    723                 pciD->date = pciS->date;
    724                 pciD->time = pciS->time;
    725                 pciD->ladate = pciS->ladate;
    726                 pciD->latime = pciS->latime;
    727                 pciD->crdate = pciS->crdate;
    728                 pciD->crtime = pciS->crtime;
    729                 pciD->cbFile = pciS->cbFile;
    730                 pciD->easize = pciS->easize;
    731 
    732                 // Forget status until we regenerate it
    733                 if (pciS->pszSubject != NullStr) {
    734                   xfree(pciS->pszSubject, pszSrcFile, __LINE__);
    735                   pciS->pszSubject = NullStr;
    736                 }
    737                 pciS->flags = CNRITEM_EXISTS;   // Now on both sides
    738 
    739                 WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pciS),
    740                            MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
    741                 WinSendMsg(hwndCnrD, CM_INVALIDATERECORD, MPFROMP(&pciD),
    742                            MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
    743               }
    744               break;
    745             }
     555          case IDM_MOVE:
     556            {
     557              BOOL fResetVerify = FALSE;
     558
     559              if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR))
     560                BldFullPathName(szNewName, cmp->leftdir, pciS->pszDisplayName);
     561              else
     562                BldFullPathName(szNewName, cmp->rightdir, pciS->pszDisplayName);
     563              // Make directory if required
     564              strcpy(szDirName, szNewName);
     565              p = strrchr(szDirName, '\\');
     566              if (fVerify && (driveflags[toupper(*szNewName) - 'A'] & DRIVE_WRITEVERIFYOFF ||
     567                              driveflags[toupper(*pciS->pszFileName) - 'A'] & DRIVE_WRITEVERIFYOFF)) {
     568                DosSetVerify(FALSE);
     569                fResetVerify = TRUE;
     570              }
     571              if (p) {
     572                if (p > szDirName + 2)
     573                  p++;
     574                *p = 0;
     575                if (IsFile(szDirName) == -1)
     576                  MassMkdir(hwndMain, szDirName);
     577              }
     578              rc = docopyf(MOVE, pciS->pszFileName, "%s", szNewName);
     579              if (fResetVerify) {
     580                DosSetVerify(fVerify);
     581                fResetVerify = FALSE;
     582              }
     583              if (!rc && stricmp(pciS->pszFileName, szNewName)) {
     584                WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciS),
     585                           MPFROM2SHORT(FALSE, CRA_SELECTED));
     586                if (pciD->rc.flRecordAttr & CRA_SELECTED)
     587                  WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciD),
     588                             MPFROM2SHORT(FALSE, CRA_SELECTED));
     589                FreeCnrItemData(pciD);
     590                pciD->pszFileName = xstrdup(szNewName, pszSrcFile, __LINE__);
     591                if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) {
     592                  pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->leftdir);
     593                  if (cmp->leftdir[strlen(cmp->leftdir) - 1] != '\\')
     594                    pciD->pszDisplayName++;
     595                }
     596                else {
     597                  pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->rightdir);
     598                  if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\')
     599                    pciD->pszDisplayName++;
     600                }
     601                pciD->pszLongName = pciS->pszLongName;
     602                pciS->pszLongName = NullStr;    // 07 Sep 08 SHL avoid aliased pointer
     603                if (pciD->pszSubject != NullStr) {
     604                  xfree(pciD->pszSubject, pszSrcFile, __LINE__);
     605                  pciD->pszSubject = NullStr;
     606                }
     607                pciD->attrFile = pciS->attrFile;
     608                pciD->pszDispAttr = pciS->pszDispAttr;
     609                pciD->flags = 0;                // Just on one side
     610                pciD->date = pciS->date;
     611                pciD->time = pciS->time;
     612                pciD->ladate = pciS->ladate;
     613                pciD->latime = pciS->latime;
     614                pciD->crdate = pciS->crdate;
     615                pciD->crtime = pciS->crtime;
     616                pciD->cbFile = pciS->cbFile;
     617                pciD->easize = pciS->easize;
     618
     619                if (pciS->pszFileName != NullStr) {
     620                  xfree(pciS->pszFileName, pszSrcFile, __LINE__);
     621                  pciS->pszFileName = NullStr;
     622                  pciS->pszDisplayName = pciS->pszFileName;
     623                  pciS->rc.pszIcon = pciS->pszFileName;
     624                }
     625                if (pciS->pszSubject != NullStr) {
     626                  xfree(pciS->pszSubject, pszSrcFile, __LINE__);
     627                  pciS->pszSubject = NullStr;
     628                }
     629                pciS->flags = 0;                // Just on one side
     630
     631                WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pciS),
     632                           MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
     633
     634                WinSendMsg(hwndCnrD, CM_INVALIDATERECORD, MPFROMP(&pciD),
     635                           MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
     636
     637                if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_LEFTDIR))
     638                  cmp->cmp->totalleft--;
     639                else
     640                  cmp->cmp->totalright--;
     641              }
     642              else if (rc) {
     643                rc = Dos_Error(MB_ENTERCANCEL,
     644                               rc,
     645                               HWND_DESKTOP,
     646                               pszSrcFile,
     647                               __LINE__,
     648                               GetPString(IDS_COMPMOVEFAILEDTEXT),
     649                               pciS->pszFileName, szNewName);
     650                if (rc == MBID_CANCEL)  // Cause loop to break
     651                  pciNextS = NULL;
     652              }
     653              break;
     654            }
     655
     656          case IDM_COPY:
     657            {
     658              BOOL fResetVerify = FALSE;
     659
     660              if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR))
     661                BldFullPathName(szNewName, cmp->leftdir, pciS->pszDisplayName);
     662              else
     663                BldFullPathName(szNewName, cmp->rightdir, pciS->pszDisplayName);
     664              // Make directory if required
     665              strcpy(szDirName, szNewName);
     666              p = strrchr(szDirName, '\\');
     667              if (fVerify && (driveflags[toupper(*szNewName) - 'A'] & DRIVE_WRITEVERIFYOFF ||
     668                                driveflags[toupper(*pciS->pszFileName) - 'A'] & DRIVE_WRITEVERIFYOFF)) {
     669                DosSetVerify(FALSE);
     670                fResetVerify = TRUE;
     671              }
     672              if (p) {
     673                if (p > szDirName + 2)
     674                  p++;
     675                *p = 0;
     676                if (IsFile(szDirName) == -1)
     677                  MassMkdir(hwndMain, szDirName);
     678              }
     679              rc = docopyf(COPY, pciS->pszFileName, "%s", szNewName);
     680              if (fResetVerify) {
     681                DosSetVerify(fVerify);
     682                fResetVerify = FALSE;
     683              }
     684              if (rc) {
     685                rc = Dos_Error(MB_ENTERCANCEL,
     686                               rc,
     687                               HWND_DESKTOP,
     688                               pszSrcFile,
     689                               __LINE__,
     690                               GetPString(IDS_COMPCOPYFAILEDTEXT),
     691                               pciS->pszFileName, szNewName);
     692                if (rc == MBID_CANCEL)
     693                  pciNextS = NULL;      // Cause loop to break
     694              }
     695              else {
     696                WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciS),
     697                           MPFROM2SHORT(FALSE, CRA_SELECTED));
     698                if (pciD->rc.flRecordAttr & CRA_SELECTED)
     699                  WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciD),
     700                             MPFROM2SHORT(FALSE, CRA_SELECTED));
     701                // 12 Jan 08 SHL
     702                if (pciD->pszFileName == NullStr) {
     703                  if (hwndCnrD == WinWindowFromID(cmp->hwnd, COMP_LEFTDIR))
     704                    cmp->totalleft++;
     705                  else
     706                    cmp->totalright++;
     707                }
     708                FreeCnrItemData(pciD);
     709                pciD->pszFileName = xstrdup(szNewName, pszSrcFile, __LINE__);
     710                if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) {
     711                  pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->leftdir);
     712                  if (cmp->leftdir[strlen(cmp->leftdir) - 1] != '\\')
     713                    pciD->pszDisplayName++;
     714                }
     715                else {
     716                  pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->rightdir);
     717                  if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\')
     718                    pciD->pszDisplayName++;
     719                }
     720                pciD->attrFile = pciS->attrFile;
     721                pciD->pszDispAttr = pciS->pszDispAttr;
     722                pciD->flags = CNRITEM_EXISTS;   // Now on both sides
     723                pciD->date = pciS->date;
     724                pciD->time = pciS->time;
     725                pciD->ladate = pciS->ladate;
     726                pciD->latime = pciS->latime;
     727                pciD->crdate = pciS->crdate;
     728                pciD->crtime = pciS->crtime;
     729                pciD->cbFile = pciS->cbFile;
     730                pciD->easize = pciS->easize;
     731
     732                // Forget status until we regenerate it
     733                if (pciS->pszSubject != NullStr) {
     734                  xfree(pciS->pszSubject, pszSrcFile, __LINE__);
     735                  pciS->pszSubject = NullStr;
     736                }
     737                pciS->flags = CNRITEM_EXISTS;   // Now on both sides
     738
     739                WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pciS),
     740                           MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
     741                WinSendMsg(hwndCnrD, CM_INVALIDATERECORD, MPFROMP(&pciD),
     742                           MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
     743              }
     744              break;
     745            }
    746746
    747747          default:
     
    22112211
    22122212        PrfQueryProfileData(fmprof, FM3Str, "CompDir.Position", (PVOID) &swp, &size);
     2213        swp.fl &= ~SWP_SIZE;            // 04 Feb 09 SHL ignore saved size
    22132214        WinSetWindowPos(hwnd,
    22142215                        HWND_TOP,
     
    22302231                       };
    22312232        UINT x;
    2232         for (x = 0; ids[x]; x++) {
    2233           //fixme to allow user to change presparams 1-10-09 GKY
     2233        for (x = 0; ids[x]; x++) {
     2234          //fixme to allow user to change presparams 1-10-09 GKY
    22342235          SetPresParams(WinWindowFromID(hwnd, ids[x]),
    22352236                        &RGBGREY,
Note: See TracChangeset for help on using the changeset viewer.