Changeset 1409 for trunk/dll


Ignore:
Timestamp:
Mar 20, 2009, 12:35:30 AM (17 years ago)
Author:
Gregg Young
Message:

Rename some container ini keys consolidate inline code in WriteDetailsSwitches, LoadDetailsSwitches and RemoveCnrSwitches (Ticket 343, 345, 347) Save changes to detail switches for compare directories (Ticket 346). Move additional messages to PCSZs (Ticket 6). Comments and minor code clean up.

Location:
trunk/dll
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/collect.c

    r1402 r1409  
    14171417
    14181418        RestorePresParams(hwnd, PCSZ_COLLECTOR);
    1419         LoadDetailsSwitches(PCSZ_COLLECTOR, &dcd->ds);
     1419        LoadDetailsSwitches(PCSZ_COLLECTOR, &dcd->ds, FALSE);
    14201420
    14211421        dcd->amextracted = FALSE;       // Say not busy
  • trunk/dll/comp.c

    r1402 r1409  
    6565  08 Mar 09 GKY Removed variable aurguments from docopyf and unlinkf (not used)
    6666  08 Mar 09 GKY Additional strings move to PCSZs in init.c & String Table
     67  15 Mar 09 GKY Use WriteDetailsSwitchs to save detail switch changes to the ini file.
    6768
    6869***********************************************************************/
     
    23432344        cmp->dcd.mask.attrFile = (FILE_DIRECTORY | FILE_ARCHIVED |
    23442345                                  FILE_READONLY | FILE_SYSTEM | FILE_HIDDEN);
    2345         LoadDetailsSwitches("DirCmp", &cmp->dcd.ds);
     2346        LoadDetailsSwitches(PCSZ_DIRCMP, &cmp->dcd.ds, FALSE);
    23462347        cmp->dcd.ds.detailslongname = FALSE;
    23472348        cmp->dcd.ds.detailsicon = FALSE;        // TRUE;
     
    29842985        AdjustDetailsSwitches(hwndLeft,
    29852986                              (HWND)0, SHORT1FROMMP(mp1),
    2986                               cmp->leftdir, "DirCmp", &cmp->dcd.ds, TRUE);
     2987                              cmp->leftdir, PCSZ_DIRCMP, &cmp->dcd.ds, TRUE);
    29872988        tempsubj = cmp->dcd.ds.detailssubject;
    29882989        cmp->dcd = dcd1;
     
    29902991        AdjustDetailsSwitches(hwndRight,
    29912992                              cmp->dcd.hwndLastMenu, SHORT1FROMMP(mp1),
    2992                               cmp->rightdir, "DirCmp", &cmp->dcd.ds, TRUE);
    2993         cmp->dcd.ds.detailssubject = tempsubj;
     2993                              cmp->rightdir, PCSZ_DIRCMP, &cmp->dcd.ds, TRUE);
     2994        cmp->dcd.ds.detailssubject = tempsubj;
     2995        WriteDetailsSwitches(PCSZ_DIRCMP, &cmp->dcd.ds, TRUE);
    29942996      }
    29952997      break;
  • trunk/dll/flesh.c

    r1400 r1409  
    270270BOOL Stubby(HWND hwndCnr, PCNRITEM pciParent)
    271271{
    272   /*
     272  /**
    273273   * this code is full of workarounds for screwed up LANs.
    274274   * let's hope all the current LAN programmers fall into
  • trunk/dll/init.c

    r1403 r1409  
    235235PCSZ PCSZ_COLLECTOR   = "Collector";
    236236PCSZ PCSZ_DIRCNR      = "DirCnr";
     237PCSZ PCSZ_DIRCMP      = "DirCmp";
    237238PCSZ PCSZ_DIRSIZES    = "DirSizes";
    238239PCSZ PCSZ_TOOLBAR     = "ToolBar";
     
    15201521  PrfQueryProfileData(fmprof, FM3Str, "TrashCan", &fTrashCan, &size);
    15211522
    1522   LoadDetailsSwitches(PCSZ_DIRCNR, &dsDirCnrDefault);
     1523  LoadDetailsSwitches(PCSZ_DIRCNR, &dsDirCnrDefault, FALSE);
    15231524
    15241525  /* load pointers and icons we use */
  • trunk/dll/init.h

    r1402 r1409  
    5050extern PCSZ PCSZ_COLLECTOR;
    5151extern PCSZ PCSZ_DIRCNR;
     52extern PCSZ PCSZ_DIRCMP;
    5253extern PCSZ PCSZ_DIRSIZES;
    5354extern PCSZ PCSZ_TOOLBAR;
  • trunk/dll/mainwnd.c

    r1402 r1409  
    8383  08 Mar 09 GKY Additional strings move to PCSZs & String Table
    8484  08 Mar 09 GKY Add WriteDetailsSwitches and use LoadDetailsSwitches to replace in line code
     85  19 Mar 09 GKY Moved DeletePresParams to presparam.c
    8586
    8687***********************************************************************/
     
    167168static BOOL CloseDirCnrChildren(HWND hwndClient);
    168169static BOOL RestoreDirCnrState(HWND hwndClient, PSZ pszStateName, BOOL noview);
    169 static VOID DeletePresParams(PSZ pszKeyroot);
    170170static VOID BuildTools(HWND hwndT, BOOL resize);
    171171
     
    29192919  ULONG previous_numsaves, ulTemp = sizeof(ULONG);
    29202920  CHAR szPrefix[STATE_NAME_MAX_BYTES + 1];
    2921   CHAR szKey[STATE_NAME_MAX_BYTES + 80];
     2921  CHAR szKey[STATE_NAME_MAX_BYTES + 80], szKeyBase[STATE_NAME_MAX_BYTES + 80], *eos;
    29222922  CHAR szDir[CCHMAXPATH];
    29232923  SWP swp;
     
    29632963              continue;
    29642964            }
    2965             sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, numsaves);
     2965            sprintf(szKeyBase, "%sDirCnr.%lu", szPrefix, numsaves);
     2966            strcpy(szKey, szKeyBase);
     2967            strcat(szKey, ".");
     2968            eos = &szKey[strlen(szKey)];
     2969            strcpy(eos, "Pos");
    29662970            PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp,
    29672971                                sizeof(SWP));
    29682972            dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
    2969             if (dcd) {
    2970               sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, numsaves);
     2973            if (dcd) {
     2974              strcpy(eos, "Sort");
    29712975              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->sortFlags,
    2972                                   sizeof(INT));
    2973               sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, numsaves);
     2976                                  sizeof(INT));
     2977              strcpy(eos, "Filter");
    29742978              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->mask,
    2975                                   sizeof(MASK));
    2976               sprintf(szKey, "%sDirCnrView.%lu", szPrefix, numsaves);
     2979                                  sizeof(MASK));
     2980              strcpy(eos, "View");
    29772981              flWindowAttr = dcd->flWindowAttr;
    29782982              if (!fLeaveTree && (flWindowAttr & CV_TREE)) {
     
    29912995                  flWindowAttr |= CV_NAME;
    29922996              }
    2993               PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & flWindowAttr,
     2997              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) &flWindowAttr,
    29942998                                  sizeof(ULONG));
    2995               sprintf(szKey, "%sDirCnr.%lu", szPrefix, numsaves);
    2996               WriteDetailsSwitches(szKey, &dcd->ds);
    2997               sprintf(szKey, "%sDirCnr.%lu", szPrefix, numsaves);
    2998               SavePresParams(hwndDir, szKey);
    2999             }
    3000             sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, numsaves++);
     2999              WriteDetailsSwitches(szKeyBase, &dcd->ds, TRUE);
     3000              SavePresParams(hwndDir, szKeyBase);
     3001            }
     3002            strcpy(eos, "Dir");
    30013003            PrfWriteProfileString(fmprof, FM3Str, szKey, szDir);
     3004            numsaves++;
    30023005          }
    30033006        }
     
    30103013  if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &previous_numsaves, &ulTemp))
    30113014    for (ulTemp = numsaves; ulTemp < previous_numsaves; ulTemp++) {
    3012       sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, ulTemp);
    3013       PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(SWP));
    3014       sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, ulTemp);
    3015       PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(INT));
    3016       sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, ulTemp);
    3017       PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(MASK));
    3018       sprintf(szKey, "%sDirCnrView.%lu", szPrefix, ulTemp);
    3019       PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(ULONG));
    3020 
    3021       sprintf(szKey, "%sDirCnr.%lu", szPrefix, ulTemp);
    3022       WriteDetailsSwitches(szKey, NULL);
    3023       sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, ulTemp);
    3024       PrfWriteProfileString(fmprof, FM3Str, szKey, NULL);
    3025       sprintf(szKey, "%sDirCnr.%lu.", szPrefix, ulTemp);
    3026       DeletePresParams(szKey);
     3015      sprintf(szKeyBase, "%sDirCnr.%lu", szPrefix, ulTemp);
     3016      RemoveCnrSwitches(szKeyBase, NULL);
    30273017    }
    30283018  sprintf(szKey, "%sNumDirsLastTime", szPrefix);
    30293019  if (numsaves) {
    3030     PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & numsaves, sizeof(ULONG));
     3020    PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) &numsaves, sizeof(ULONG));
    30313021    WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swp);
    30323022    sprintf(szKey, "%sMySizeLastTime", szPrefix);
    3033     PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, sizeof(SWP));
     3023    PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) &swp, sizeof(SWP));
    30343024    if (WinQueryWindowPos(hwndTree, &swp)) {
    30353025      sprintf(szKey, "%sLastTreePos", szPrefix);
    3036       PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, sizeof(SWP));
     3026      PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) &swp, sizeof(SWP));
    30373027    }
    30383028  }
    30393029  else if (fIsShutDownState) {
    3040     PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & numsaves, sizeof(ULONG));
    3041   }
    3042 
     3030    PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) &numsaves, sizeof(ULONG));
     3031  }
    30433032  return numsaves;
    30443033}
     
    30883077static BOOL RestoreDirCnrState(HWND hwndClient, PSZ pszStateName, BOOL noview)
    30893078{
    3090   CHAR szKey[STATE_NAME_MAX_BYTES + 80];
     3079  CHAR szKey[STATE_NAME_MAX_BYTES + 80], szKeyBase[STATE_NAME_MAX_BYTES + 80];
    30913080  CHAR szDir[CCHMAXPATH];
    30923081  CHAR szPrefix[STATE_NAME_MAX_BYTES + 2];
     
    31933182      PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    31943183    for (x = numsaves - 1; x >= 0; x--) {
    3195       sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, x);
     3184      CHAR *eos = szKey;
     3185
     3186      sprintf(szKeyBase, "%sDirCnr.%lu", szPrefix, x);
     3187      strcpy(szKey, szKeyBase);
     3188      strcat(szKey, ".");
     3189      eos = &szKey[strlen(szKey)];
     3190      strcpy(eos, "Pos");
    31963191      size = sizeof(SWP);
    31973192      if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &swp, &size)) {
    3198         if (fDeleteState)
    3199           PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    3200         sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, x);
     3193        strcpy(eos, "Dir"); ;
    32013194        size = sizeof(szDir);
    32023195        if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) {
     
    32053198          if (fIsShutDownState &&
    32063199              driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) {
    3207             PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    3208             sprintf(szKey, "%sDirCnr.%lu", szPrefix, x);
    3209             WriteDetailsSwitches(szKey, NULL);
     3200            RemoveCnrSwitches(szKeyBase, NULL);
    32103201            continue;
    32113202          }
    3212           if (fDeleteState)
    3213             PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    3214           sprintf(szKey, "%sDirCnr.%lu", szPrefix, x);
    3215           LoadDetailsSwitches(szKey, &localdcd.ds);
    3216           if (fDeleteState)
    3217             WriteDetailsSwitches(szKey, NULL);
     3203          LoadDetailsSwitches(szKeyBase, &localdcd.ds, TRUE);
    32183204          hwndDir = (HWND) WinSendMsg(hwndClient,
    32193205                                      UM_SETDIR,
     
    32383224                RestorePresParams(hwndPPSave, PCSZ_DIRCNR);
    32393225              }
    3240               //sprintf(szKey, "%sDirCnr.%lu", szPrefix, x);
    3241               RestorePresParams(hwndCnr, szKey);
     3226              RestorePresParams(hwndCnr, szKeyBase);
    32423227              dcd = WinQueryWindowPtr(hwndCnr, QWL_USER);
    32433228              if (dcd) {
     
    32533238                dcd->ds.detailslatime   = localdcd.ds.detailslatime  ;
    32543239                dcd->ds.detailslwdate   = localdcd.ds.detailslwdate  ;
    3255                 dcd->ds.detailslwtime   = localdcd.ds.detailslwtime  ;
    3256                 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, x);
     3240                dcd->ds.detailslwtime   = localdcd.ds.detailslwtime  ;
     3241                strcpy(eos, "Sort");
    32573242                size = sizeof(INT);
    32583243                if (PrfQueryProfileData(fmprof,
     
    32643249                    dcd->sortFlags = SORT_PATHNAME;
    32653250                }
    3266                 if (fDeleteState)
    3267                   PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    3268                 size = sizeof(MASK);
    3269                 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, x);
     3251                size = sizeof(MASK);
     3252                strcpy(eos, "Filter");
    32703253                if (PrfQueryProfileData(fmprof,
    32713254                                        FM3Str,
     
    32773260                }
    32783261                *(dcd->mask.prompt) = 0;
    3279                 if (fDeleteState)
    3280                   PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    3281                 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, x);
     3262                strcpy(eos, "View");
    32823263                if (!noview) {
    32833264                  size = sizeof(ULONG);
     
    33043285                  }
    33053286                }
    3306                 if (fDeleteState)
    3307                   PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    33083287                if (!PostMsg(hwndCnr, UM_SETUP2, NULL, NULL))
    33093288                  WinSendMsg(hwndCnr, UM_SETUP2, NULL, NULL);
     
    33303309                              SWP_SIZE | SWP_SHOW |  SWP_ZORDER |
    33313310                              SWP_ACTIVATE);
    3332           }
     3311          }
     3312          if (fDeleteState)
     3313            RemoveCnrSwitches(szKeyBase, pszStateName);
    33333314        }
    33343315      }
     
    45694550  case IDM_DELETEDIRCNRSTATE:
    45704551    {
    4571       CHAR szStateName[STATE_NAME_MAX_BYTES + 1];
     4552      CHAR szStateName[STATE_NAME_MAX_BYTES + 1], szKeyBase[STATE_NAME_MAX_BYTES + 1];
    45724553
    45734554      *szStateName = 0;
     
    46214602            // Delete
    46224603            ULONG numsaves = 0, size, x;
    4623             CHAR s[STATE_NAME_MAX_BYTES + 80];
     4604            CHAR szKey[STATE_NAME_MAX_BYTES + 80];
    46244605
    46254606            INT ret = remove_setup(szStateName);
    46264607            if (ret == 1)
    46274608              save_setups();
    4628             sprintf(s, "%s.NumDirsLastTime", szStateName);
     4609            sprintf(szKey, "%s.NumDirsLastTime", szStateName);
    46294610            size = sizeof(ULONG);
    46304611            if (!PrfQueryProfileData(fmprof,
    46314612                                     FM3Str,
    4632                                      s,
     4613                                     szKey,
    46334614                                     (PVOID)&numsaves,
    46344615                                     &size)) {
     
    46404621              Runtime_Error(pszSrcFile, __LINE__, NULL);
    46414622            else {
    4642               PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0L);
    4643               for (x = 0; x < numsaves; x++) {
    4644                 sprintf(s, "%s.DirCnrPos.%lu", szStateName, x);
    4645                 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
    4646                 sprintf(s, "%s.DirCnrDir.%lu", szStateName, x);
    4647                 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
    4648                 sprintf(s, "%s.DirCnrSort.%lu", szStateName, x);
    4649                 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
    4650                 sprintf(s, "%s.DirCnrFilter.%lu", szStateName, x);
    4651                 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
    4652                 sprintf(s, "%s.DirCnrView.%lu", szStateName, x);
    4653                 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
    4654 
    4655                 sprintf(s, "%s.DirCnr.%lu", szStateName, x);
    4656                 WriteDetailsSwitches(s, NULL);
    4657                 sprintf(s, "%s.DirCnr.%lu.Backgroundcolor", szStateName, x);
    4658                 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
    4659                 sprintf(s, "%s.DirCnr.%lu.Fontnamesize", szStateName, x);
    4660                 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     4623              PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     4624              for (x = 0; x < numsaves; x++) {
     4625                sprintf(szKeyBase, "%s.DirCnr.%lu", szStateName, x);
     4626                RemoveCnrSwitches(szKeyBase, szStateName);
    46614627              }
    4662               sprintf(s, "%s.LastTreePos", szStateName);
    4663               PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
    4664               sprintf(s, "%s.MySizeLastTime", szStateName);
    4665               PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
    46664628            }
    46674629            PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);
     
    63546316}
    63556317
    6356 VOID DeletePresParams(CHAR * pchKeyroot)
    6357 // This code assumes that pchKeyroot points to a buffer large enough to
    6358 // hold the full INI key: The state name.dircnr-number.PPName. The
    6359 // PPNames are listed below.
    6360 {
    6361   PSZ apszPPNames[] =
    6362   {
    6363     "Backgroundcolor",
    6364     "Foregroundcolor",
    6365     "Hilitebackgroundcolor",
    6366     "Hiliteforegroundcolor",
    6367     "Bordercolor",
    6368     "Fontnamesize"
    6369   };
    6370 
    6371   ULONG ulSize, ulArraySize = sizeof(apszPPNames) / sizeof(PSZ), x;
    6372   CHAR * eos = pchKeyroot + strlen(pchKeyroot);
    6373 
    6374   for (x = 0; x < ulArraySize; x++)
    6375   {
    6376     strcpy(eos, apszPPNames[x]);
    6377     if (PrfQueryProfileSize(fmprof, appname, pchKeyroot, &ulSize) && ulSize)
    6378     {
    6379       PrfWriteProfileData(fmprof, appname, pchKeyroot, NULL, ulSize);
    6380     }
    6381   }
    6382 }
    6383 
    63846318#pragma alloc_text(MISC8,SetToggleChecks,FindDirCnrByName,TopWindow)
    63856319#pragma alloc_text(MISC8,TopWindowName,CountDirCnrs)
  • trunk/dll/misc.c

    r1402 r1409  
    13181318}
    13191319
    1320 VOID LoadDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS *pds)
     1320/**
     1321 * Loads all the detail switches from the ini file
     1322 * state if TRUE skips global only settings
     1323 * keyroot shouldn't pass trailing dot
     1324 */
     1325VOID LoadDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS *pds, BOOL state)
    13211326{
    13221327  ULONG size;
     
    13741379  size = sizeof(BOOL);
    13751380  PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailslatime, &size);
    1376   strcpy(eos, "SubjectInLeftPane");
    1377   pds->fSubjectInLeftPane = dsDirCnrDefault.fSubjectInLeftPane;
    1378   size = sizeof(BOOL);
    1379   PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->fSubjectInLeftPane, &size);
    1380   strcpy(eos, "SubjectLengthMax");
    1381   pds->fSubjectLengthMax = dsDirCnrDefault.fSubjectLengthMax;
    1382   size = sizeof(BOOL);
    1383   PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->fSubjectLengthMax, &size);
    1384   if (pds->fSubjectLengthMax)
    1385     pds->SubjectDisplayWidth = 0;
    1386   else {
    1387     strcpy(eos, "SubjectDisplayWidth");
    1388     pds->SubjectDisplayWidth = dsDirCnrDefault.SubjectDisplayWidth;
    1389     size = sizeof(ULONG);
    1390     PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->SubjectDisplayWidth, &size);
    1391     if (pds->SubjectDisplayWidth < 50)
     1381  if (!state) {
     1382    strcpy(eos, "SubjectInLeftPane");
     1383    pds->fSubjectInLeftPane = dsDirCnrDefault.fSubjectInLeftPane;
     1384    size = sizeof(BOOL);
     1385    PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->fSubjectInLeftPane, &size);
     1386    strcpy(eos, "SubjectLengthMax");
     1387    pds->fSubjectLengthMax = dsDirCnrDefault.fSubjectLengthMax;
     1388    size = sizeof(BOOL);
     1389    PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->fSubjectLengthMax, &size);
     1390    if (pds->fSubjectLengthMax)
    13921391      pds->SubjectDisplayWidth = 0;
    1393     else if (pds->SubjectDisplayWidth > 1000)
    1394       pds->SubjectDisplayWidth = 1000;
    1395   }
    1396 }
    1397 
    1398 VOID WriteDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS *pds)
     1392    else {
     1393      strcpy(eos, "SubjectDisplayWidth");
     1394      pds->SubjectDisplayWidth = dsDirCnrDefault.SubjectDisplayWidth;
     1395      size = sizeof(ULONG);
     1396      PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->SubjectDisplayWidth, &size);
     1397      if (pds->SubjectDisplayWidth < 50)
     1398        pds->SubjectDisplayWidth = 0;
     1399      else if (pds->SubjectDisplayWidth > 1000)
     1400        pds->SubjectDisplayWidth = 1000;
     1401    }
     1402  }
     1403}
     1404
     1405/**
     1406 * Writes all the detail switches to the ini file
     1407 * state if TRUE skips global only settings
     1408 * keyroot shouldn't pass trailing dot
     1409 */
     1410VOID WriteDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS *pds, BOOL state)
    13991411{
    14001412  CHAR s[CCHMAXPATH], *eos = s;
     
    14041416  eos = &s[strlen(s)];
    14051417  strcpy(eos, "DetailsLongname");
    1406   PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailslongname : NULL,
    1407                       pds ? sizeof(BOOL) : 0);
     1418  PrfWriteProfileData(fmprof, appname, s, &pds->detailslongname, sizeof(BOOL));
    14081419  strcpy(eos, "DetailsSubject");
    1409   PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailssubject : NULL,
    1410                       pds ? sizeof(BOOL) : 0);
     1420  PrfWriteProfileData(fmprof, appname, s, &pds->detailssubject, sizeof(BOOL));
    14111421  strcpy(eos, "DetailsEA");
    1412   PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailsea : NULL,
    1413                       pds ? sizeof(BOOL) : 0);
     1422  PrfWriteProfileData(fmprof, appname, s, &pds->detailsea, sizeof(BOOL));
    14141423  strcpy(eos, "DetailsSize");
    1415   PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailssize : NULL,
    1416                       pds ? sizeof(BOOL) : 0);
     1424  PrfWriteProfileData(fmprof, appname, s, &pds->detailssize, sizeof(BOOL));
    14171425  strcpy(eos, "DetailsIcon");
    1418   PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailsicon : NULL,
    1419                       pds ? sizeof(BOOL) : 0);
     1426  PrfWriteProfileData(fmprof, appname, s, &pds->detailsicon, sizeof(BOOL));
    14201427  strcpy(eos, "DetailsAttr");
    1421   PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailsattr : NULL,
    1422                       pds ? sizeof(BOOL) : 0);
     1428  PrfWriteProfileData(fmprof, appname, s, &pds->detailsattr, sizeof(BOOL));
    14231429  strcpy(eos, "DetailsCRDate");
    1424   PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailscrdate : NULL,
    1425                       pds ? sizeof(BOOL) : 0);
     1430  PrfWriteProfileData(fmprof, appname, s, &pds->detailscrdate, sizeof(BOOL));
    14261431  strcpy(eos, "DetailsCRTime");
    1427   PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailscrtime : NULL,
    1428                       pds ? sizeof(BOOL) : 0);
     1432  PrfWriteProfileData(fmprof, appname, s, &pds->detailscrtime, sizeof(BOOL));
    14291433  strcpy(eos, "DetailsLWDate");
    1430   PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailslwdate : NULL,
    1431                       pds ? sizeof(BOOL) : 0);
     1434  PrfWriteProfileData(fmprof, appname, s, &pds->detailslwdate, sizeof(BOOL));
    14321435  strcpy(eos, "DetailsLWTime");
    1433   PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailslwtime : NULL,
    1434                       pds ? sizeof(BOOL) : 0);
     1436  PrfWriteProfileData(fmprof, appname, s, &pds->detailslwtime, sizeof(BOOL));
    14351437  strcpy(eos, "DetailsLADate");
    1436   PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailsladate : NULL,
    1437                       pds ? sizeof(BOOL) : 0);
     1438  PrfWriteProfileData(fmprof, appname, s, &pds->detailsladate, sizeof(BOOL));
    14381439  strcpy(eos, "DetailsLATime");
    1439   PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailslatime : NULL,
    1440                       pds ? sizeof(BOOL) : 0);
     1440  PrfWriteProfileData(fmprof, appname, s, &pds->detailslatime, sizeof(BOOL));
     1441  if (!state) {
     1442    strcpy(eos, "SubjectInLeftPane");
     1443    PrfWriteProfileData(fmprof, appname, s, &pds->fSubjectInLeftPane, sizeof(BOOL));
     1444    strcpy(eos, "SubjectLengthMax");
     1445    PrfWriteProfileData(fmprof, appname, s, &pds->fSubjectLengthMax, sizeof(BOOL));
     1446    strcpy(eos, "SubjectDisplayWidth");
     1447    PrfWriteProfileData(fmprof, appname, s, &pds->SubjectDisplayWidth, sizeof(ULONG));
     1448  }
     1449}
     1450
     1451/**
     1452 * Removes the ini entries when a state is deleted
     1453 * statename should be NULL for the shutdown state
     1454 * (avoids removing global state settings like toolbar)
     1455 * keyroot shouldn't pass the trailing dot
     1456 */
     1457VOID RemoveCnrSwitches(PCSZ keyroot, PCSZ statename)
     1458{
     1459  CHAR s[CCHMAXPATH], *eos = s;
     1460
     1461  strcpy(s, keyroot);
     1462  strcat(s, ".");
     1463  eos = &s[strlen(s)];
     1464  DeletePresParams(s);
     1465  strcpy(eos, "DetailsLongname");
     1466  PrfWriteProfileData(fmprof, appname, s, NULL, 0);
     1467  strcpy(eos, "DetailsSubject");
     1468  PrfWriteProfileData(fmprof, appname, s, NULL, 0);
     1469  strcpy(eos, "DetailsEA");
     1470  PrfWriteProfileData(fmprof, appname, s, NULL, 0);
     1471  strcpy(eos, "DetailsSize");
     1472  PrfWriteProfileData(fmprof, appname, s, NULL, 0);
     1473  strcpy(eos, "DetailsIcon");
     1474  PrfWriteProfileData(fmprof, appname, s, NULL, 0);
     1475  strcpy(eos, "DetailsAttr");
     1476  PrfWriteProfileData(fmprof, appname, s, NULL, 0);
     1477  strcpy(eos, "DetailsCRDate");
     1478  PrfWriteProfileData(fmprof, appname, s, NULL, 0);
     1479  strcpy(eos, "DetailsCRTime");
     1480  PrfWriteProfileData(fmprof, appname, s, NULL, 0);
     1481  strcpy(eos, "DetailsLWDate");
     1482  PrfWriteProfileData(fmprof, appname, s, NULL, 0);
     1483  strcpy(eos, "DetailsLWTime");
     1484  PrfWriteProfileData(fmprof, appname, s, NULL, 0);
     1485  strcpy(eos, "DetailsLADate");
     1486  PrfWriteProfileData(fmprof, appname, s, NULL, 0);
     1487  strcpy(eos, "DetailsLATime");
     1488  PrfWriteProfileData(fmprof, appname, s, NULL, 0);
    14411489  strcpy(eos, "SubjectInLeftPane");
    1442   PrfWriteProfileData(fmprof, appname, s, pds ? &pds->fSubjectInLeftPane : NULL,
    1443                       pds ? sizeof(BOOL) : 0);
     1490  PrfWriteProfileData(fmprof, appname, s, NULL, 0);
    14441491  strcpy(eos, "SubjectLengthMax");
    1445   PrfWriteProfileData(fmprof, appname, s, pds ? &pds->fSubjectLengthMax : NULL,
    1446                       pds ? sizeof(BOOL) : 0);
     1492  PrfWriteProfileData(fmprof, appname, s, NULL, 0);
    14471493  strcpy(eos, "SubjectDisplayWidth");
    1448   PrfWriteProfileData(fmprof, appname, s, pds ? &pds->SubjectDisplayWidth : NULL,
    1449                       pds ? sizeof(ULONG) : 0);
    1450 }
    1451 
     1494  PrfWriteProfileData(fmprof, appname, s, NULL, 0);
     1495  strcpy(eos, "Pos");;
     1496  PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     1497  strcpy(eos, "Sort");
     1498  PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     1499  strcpy(eos, "Filter");
     1500  PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     1501  strcpy(eos, "View");
     1502  PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     1503  strcpy(eos, "Dir");
     1504  PrfWriteProfileString(fmprof, FM3Str, s, NULL);
     1505  if (statename && strstr(s, ".0.")) {
     1506    strcpy(s, statename);
     1507    strcat(s, ".");
     1508    eos = &s[strlen(s)];
     1509    strcpy(eos, "LastTreePos");
     1510    PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     1511    strcpy(eos, "MySizeLastTime");
     1512    PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     1513    strcpy(eos, "Toolbar");
     1514    PrfWriteProfileString(fmprof, FM3Str, s, NULL);
     1515    strcpy(eos, "TargetDir");
     1516    PrfWriteProfileString(fmprof, FM3Str, s, NULL);
     1517  }
     1518
     1519}
    14521520
    14531521HWND FindDirCnr(HWND hwndParent)
  • trunk/dll/misc.h

    r1400 r1409  
    5252VOID HeapThread(VOID * dummy);
    5353BOOL IsFm2Window(HWND hwnd, BOOL chkTid);
    54 VOID LoadDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS *pds);
    55 VOID WriteDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS *pds);
     54VOID LoadDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS *pds, BOOL state);
     55VOID WriteDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS *pds, BOOL state);
     56VOID RemoveCnrSwitches(PCSZ keyroot, PCSZ statename);
    5657VOID LoadLibPath(PSZ str, LONG len);
    5758VOID OpenEdit(HWND hwnd);
  • trunk/dll/notebook.c

    r1402 r1409  
    23672367          dsDirCnrDefault.SubjectDisplayWidth = 0;
    23682368    }
    2369     WriteDetailsSwitches(PCSZ_DIRCNR, &dsDirCnrDefault);
     2369    WriteDetailsSwitches(PCSZ_DIRCNR, &dsDirCnrDefault, FALSE);
    23702370    break;
    23712371  }
     
    26012601
    26022602      memset(&ds, 0, sizeof(ds));
    2603       LoadDetailsSwitches(PCSZ_COLLECTOR, &ds);
     2603      LoadDetailsSwitches(PCSZ_COLLECTOR, &ds, FALSE);
    26042604      WinCheckButton(hwnd, CFG5_SHOWLNAMES, ds.detailslongname);
    26052605      WinCheckButton(hwnd, CFG5_SHOWSUBJECT, ds.detailssubject);
     
    27212721          ds.SubjectDisplayWidth = 0;
    27222722      }
    2723     WriteDetailsSwitches(PCSZ_COLLECTOR, &ds);
     2723    WriteDetailsSwitches(PCSZ_COLLECTOR, &ds, FALSE);
    27242724    }
    27252725    break;
     
    35273527    }
    35283528    // Save new details settings and refresh windows
    3529     WriteDetailsSwitches(PCSZ_DIRCNR, &dsDirCnrDefault);
     3529    WriteDetailsSwitches(PCSZ_DIRCNR, &dsDirCnrDefault, FALSE);
    35303530    if (hwndMain) {
    35313531      // Save state and restore to refresh windows with new settings
  • trunk/dll/presparm.c

    r1402 r1409  
    1414  10 Dec 07 GKY Updated CopyPresParams to copy all parameter types
    1515  08 Mar 09 GKY Additional strings move to PCSZs in init.c
     16  19 Mar 09 GKY Moved DeletePresParams from mainwnd.c
    1617
    1718***********************************************************************/
     
    523524}
    524525
     526VOID DeletePresParams(PCSZ Keyroot)
     527{
     528  PSZ apszPPNames[] =
     529  {
     530    "Backgroundcolor",
     531    "Foregroundcolor",
     532    "Hilitebackgroundcolor",
     533    "Hiliteforegroundcolor",
     534    "Bordercolor",
     535    "Fontnamesize"
     536  };
     537
     538  ULONG ulSize, ulArraySize = sizeof(apszPPNames) / sizeof(PSZ), x;
     539  CHAR  pchKeyroot[CCHMAXPATH];
     540  CHAR  *eos;
     541
     542  strcpy(pchKeyroot, Keyroot);
     543  eos = pchKeyroot + strlen(pchKeyroot);
     544
     545  for (x = 0; x < ulArraySize; x++) {
     546    strcpy(eos, apszPPNames[x]);
     547    if (PrfQueryProfileSize(fmprof, appname, pchKeyroot, &ulSize) && ulSize) {
     548      PrfWriteProfileData(fmprof, appname, pchKeyroot, NULL, ulSize);
     549    }
     550  }
     551}
     552
    525553#pragma alloc_text(PRESPARAM,CopyPresParams,SetPresParams)
    526554#pragma alloc_text(PRESPARAM,PresParamChanged,RestorePresParams,SavePresParams)
  • trunk/dll/presparm.h

    r1400 r1409  
    1111  Change log
    1212  08 Mar 09 GKY Additional strings move to PCSZs in init.c (Delcare changes to PCSZ)
     13  19 Mar 09 GKY Moved DeletePresParams from mainwnd.c
    1314
    1415***********************************************************************/
     
    2122VOID RestorePresParams(HWND hwnd, PCSZ keyroot);
    2223VOID SavePresParams(HWND hwnd, PCSZ keyroot);
     24VOID DeletePresParams(PCSZ Keyroot);
    2325#ifdef INCL_GPI
    2426VOID SetPresParams(HWND hwnd, RGB2 * back, RGB2 * fore, RGB2 * border,
    25                    PCSZ font);
     27                   PCSZ font);
    2628#endif
    2729
Note: See TracChangeset for help on using the changeset viewer.