Changeset 1065


Ignore:
Timestamp:
Jul 11, 2008, 6:50:19 PM (17 years ago)
Author:
John Small
Message:

Ticket 230: Simplified code and eliminated some local variables by incorporating
all the details view settings (both the global variables and those in the
DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.

Location:
trunk/dll
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/dll/collect.c

    r1063 r1065  
    4949  29 Feb 08 GKY Use xfree where appropriate
    5050  06 Jul 08 GKY Update delete/undelete to include move to and open XWP trashcan
     51  11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
     52                all the details view settings (both the global variables and those in the
     53                DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
    5154
    5255***********************************************************************/
     
    139142              if (dcd) {
    140143                SetViewMenu(hwndButtonPopup, dcd->flWindowAttr);
    141                 SetDetailsSwitches(hwndButtonPopup, dcd);
     144                SetDetailsSwitches(hwndButtonPopup, &dcd->ds);
    142145                CopyPresParams(hwndButtonPopup, hwnd);
    143146              }
     
    223226                                                COLLECTOR_CNR), QWL_USER);
    224227        if (dcd)
    225           SetDetailsSwitches(hwndButtonPopup, dcd);
     228          SetDetailsSwitches(hwndButtonPopup, &dcd->ds);
    226229      }
    227230      return mr;
     
    13171320
    13181321        RestorePresParams(hwnd, "Collector");
    1319         LoadDetailsSwitches("Collector", dcd);
     1322        LoadDetailsSwitches("Collector", &dcd->ds);
    13201323
    13211324        dcd->amextracted = FALSE;       // Say not busy
     
    13591362                              CMA_CXTREEINDENT | CMA_PSORTRECORD));
    13601363        SetCnrCols(hwnd, FALSE);
    1361         AdjustCnrColsForPref(hwnd, NULL, dcd, FALSE);
     1364        AdjustCnrColsForPref(hwnd, NULL, &dcd->ds, FALSE);
    13621365
    13631366        /* fix splitbar for collector container */
     
    14481451
    14491452      case IDM_DETAILSSETUP:
    1450         SetDetailsSwitches((HWND) mp2, dcd);
     1453        SetDetailsSwitches((HWND) mp2, &dcd->ds);
    14511454        break;
    14521455
     
    19521955        AdjustDetailsSwitches(hwnd, dcd->hwndLastMenu,
    19531956                              SHORT1FROMMP(mp1), NULL,
    1954                               "Collector", dcd, FALSE);
     1957                              "Collector", &dcd->ds, FALSE);
    19551958        break;
    19561959
     
    22132216            if (dcd->hwndLastMenu == CollectorCnrMenu) {
    22142217              SetViewMenu(dcd->hwndLastMenu, dcd->flWindowAttr);
    2215               SetDetailsSwitches(dcd->hwndLastMenu, dcd);
     2218              SetDetailsSwitches(dcd->hwndLastMenu, &dcd->ds);
    22162219              CopyPresParams(dcd->hwndLastMenu, hwnd);
    22172220              if (dcd->flWindowAttr & CV_MINI)
  • TabularUnified trunk/dll/comp.c

    r1063 r1065  
    5454  29 Feb 08 GKY Refactor global command line variables to notebook.h
    5555  16 Mar 08 GKY Prevent trap caused by files that exceed maxpath length
     56  11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
     57                all the details view settings (both the global variables and those in the
     58                DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
    5659
    5760***********************************************************************/
     
    22632266        cmp->dcd.mask.attrFile = (FILE_DIRECTORY | FILE_ARCHIVED |
    22642267                                  FILE_READONLY | FILE_SYSTEM | FILE_HIDDEN);
    2265         LoadDetailsSwitches("DirCmp", &cmp->dcd);
    2266         cmp->dcd.detailslongname = FALSE;
    2267         cmp->dcd.detailsicon = FALSE;   // TRUE;
     2268        LoadDetailsSwitches("DirCmp", &cmp->dcd.ds);
     2269        cmp->dcd.ds.detailslongname = FALSE;
     2270        cmp->dcd.ds.detailsicon = FALSE;        // TRUE;
    22682271      }
    22692272      memset(&cnri, 0, sizeof(CNRINFO));
     
    22872290      AdjustCnrColRO(hwndRight, GetPString(IDS_FILENAMECOLTEXT), TRUE, FALSE);
    22882291      AdjustCnrColRO(hwndRight, GetPString(IDS_LONGNAMECOLTEXT), TRUE, FALSE);
    2289       AdjustCnrColsForPref(hwndLeft, cmp->leftdir, &cmp->dcd, TRUE);
    2290       tempsubj = cmp->dcd.detailssubject;
    2291       cmp->dcd.detailssubject = FALSE;
    2292       AdjustCnrColsForPref(hwndRight, cmp->rightdir, &cmp->dcd, TRUE);
     2292      AdjustCnrColsForPref(hwndLeft, cmp->leftdir, &cmp->dcd.ds, TRUE);
     2293      tempsubj = cmp->dcd.ds.detailssubject;
     2294      cmp->dcd.ds.detailssubject = FALSE;
     2295      AdjustCnrColsForPref(hwndRight, cmp->rightdir, &cmp->dcd.ds, TRUE);
    22932296      if (*cmp->rightlist) {
    22942297        AdjustCnrColVis(hwndRight, GetPString(IDS_LADATECOLTEXT), FALSE,
     
    23012304                        FALSE);
    23022305      }
    2303       cmp->dcd.detailssubject = tempsubj;
     2306      cmp->dcd.ds.detailssubject = tempsubj;
    23042307    }
    23052308    return 0;
     
    25302533                WinSendMsg(cmp->dcd.hwndLastMenu, MM_DELETEITEM,
    25312534                           MPFROM2SHORT(IDM_SHOWSUBJECT, FALSE), MPVOID);
    2532               SetDetailsSwitches(cmp->dcd.hwndLastMenu, &cmp->dcd);
     2535              SetDetailsSwitches(cmp->dcd.hwndLastMenu, &cmp->dcd.ds);
    25332536              if (SHORT1FROMMP(mp1) == COMP_LEFTDIR)
    25342537                WinSendMsg(cmp->dcd.hwndLastMenu, MM_DELETEITEM,
     
    29022905        AdjustDetailsSwitches(hwndLeft,
    29032906                              (HWND)0, SHORT1FROMMP(mp1),
    2904                               cmp->leftdir, "DirCmp", &cmp->dcd, TRUE);
    2905         tempsubj = cmp->dcd.detailssubject;
     2907                              cmp->leftdir, "DirCmp", &cmp->dcd.ds, TRUE);
     2908        tempsubj = cmp->dcd.ds.detailssubject;
    29062909        cmp->dcd = dcd1;
    2907         cmp->dcd.detailssubject = FALSE;
     2910        cmp->dcd.ds.detailssubject = FALSE;
    29082911        AdjustDetailsSwitches(hwndRight,
    29092912                              cmp->dcd.hwndLastMenu, SHORT1FROMMP(mp1),
    2910                               cmp->rightdir, "DirCmp", &cmp->dcd, TRUE);
    2911         cmp->dcd.detailssubject = tempsubj;
     2913                              cmp->rightdir, "DirCmp", &cmp->dcd.ds, TRUE);
     2914        cmp->dcd.ds.detailssubject = tempsubj;
    29122915      }
    29132916      break;
  • TabularUnified trunk/dll/dircnrs.c

    r1063 r1065  
    4141  22 Jun 08 GKY Included free_... functions for fortify checking
    4242  06 Jul 08 GKY Update delete/undelete to include move to and open XWP trashcan
     43  11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
     44                all the details view settings (both the global variables and those in the
     45                DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
    4346
    4447***********************************************************************/
     
    105108                                                DIR_CNR), QWL_USER);
    106109        if (dcd)
    107           SetDetailsSwitches(hwndButtonPopup, dcd);
     110          SetDetailsSwitches(hwndButtonPopup, &dcd->ds);
    108111      }
    109112      return mr;
     
    168171              if (dcd) {
    169172                SetViewMenu(hwndButtonPopup, dcd->flWindowAttr);
    170                 SetDetailsSwitches(hwndButtonPopup, dcd);
     173                SetDetailsSwitches(hwndButtonPopup, &dcd->ds);
    171174              }
    172175            }
     
    755758      }
    756759      RemoveCnrItems(dcd->hwndCnr, NULL, 0, CMA_FREE | CMA_INVALIDATE | CMA_ERASE);
    757       AdjustCnrColsForFSType(dcd->hwndCnr, dcd->directory, dcd);
     760      AdjustCnrColsForFSType(dcd->hwndCnr, dcd->directory, &dcd->ds);
    758761      dcd->ullTotalBytes = dcd->totalfiles =
    759762        dcd->selectedfiles = dcd->selectedbytes = 0;
     
    15261529  case UM_SETUP2:
    15271530    if (dcd) {
    1528       AdjustCnrColsForPref(hwnd, NULL, dcd, FALSE);
     1531      AdjustCnrColsForPref(hwnd, NULL, &dcd->ds, FALSE);
    15291532      SayFilter(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    15301533                DIR_FILTER), &dcd->mask, FALSE);
     
    16351638
    16361639      case IDM_DETAILSSETUP:
    1637         SetDetailsSwitches((HWND) mp2, dcd);
     1640        SetDetailsSwitches((HWND) mp2, &dcd->ds);
    16381641        break;
    16391642
     
    22052208                              dcd->hwndLastMenu,
    22062209                              SHORT1FROMMP(mp1),
    2207                               dcd->directory, NULL, dcd, FALSE);
     2210                              dcd->directory, NULL, &dcd->ds, FALSE);
    22082211        break;
    22092212
     
    34823485        dcd->hwndRestore = hwndRestore;
    34833486        dcd->dontclose = ((flags & 1) != 0);
    3484         dcd->detailslongname = detailslongname;
    3485         dcd->detailssubject = detailssubject;
    3486         dcd->detailsea = detailsea;
    3487         dcd->detailssize = detailssize;
    3488         dcd->detailsicon = detailsicon;
    3489         dcd->detailsattr = detailsattr;
    3490         dcd->detailscrdate = detailscrdate;
    3491         dcd->detailscrtime = detailscrtime;
    3492         dcd->detailslwdate = detailslwdate;
    3493         dcd->detailslwtime = detailslwtime;
    3494         dcd->detailsladate = detailsladate;
    3495         dcd->detailslatime = detailslatime;
     3487        dcd->ds.detailslongname = dsDirCnrDefault.detailslongname;
     3488        dcd->ds.detailssubject = dsDirCnrDefault.detailssubject;
     3489        dcd->ds.detailsea = dsDirCnrDefault.detailsea;
     3490        dcd->ds.detailssize = dsDirCnrDefault.detailssize;
     3491        dcd->ds.detailsicon = dsDirCnrDefault.detailsicon;
     3492        dcd->ds.detailsattr = dsDirCnrDefault.detailsattr;
     3493        dcd->ds.detailscrdate = dsDirCnrDefault.detailscrdate;
     3494        dcd->ds.detailscrtime = dsDirCnrDefault.detailscrtime;
     3495        dcd->ds.detailslwdate = dsDirCnrDefault.detailslwdate;
     3496        dcd->ds.detailslwtime = dsDirCnrDefault.detailslwtime;
     3497        dcd->ds.detailsladate = dsDirCnrDefault.detailsladate;
     3498        dcd->ds.detailslatime = dsDirCnrDefault.detailslatime;
    34963499        strcpy(dcd->directory, directory);
    34973500        add_udir(FALSE, directory);
  • TabularUnified trunk/dll/dircnrs.h

    r940 r1065  
    1111  05 Jan 08 SHL Move dircnrs.c definitions here
    1212  13 Jan 08 GKY Add variables to DIRCNRDATA struct for Subjectwidth/Subjectleft.
     13  11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
     14                all the details view settings (both the global variables and those in the
     15                DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
    1316
    1417***********************************************************************/
     
    8689MASK;
    8790
     91typedef struct DETAILS_SETTINGS
     92{
     93  BOOL detailsladate, detailslatime, detailscrdate, detailscrtime,
     94    detailslongname, detailsea, detailssize, detailssubject,
     95    detailslwdate, detailslwtime, detailsattr, detailsicon,
     96    fSubjectInLeftPane, fSubjectLengthMax;
     97  ULONG SubjectDisplayWidth;
     98}
     99DETAILS_SETTINGS;
     100
    88101typedef struct DIRCNRDATA
    89102{
     
    124137  INT lasthelp;
    125138  INT sortFlags;
    126   BOOL detailsladate, detailslatime, detailscrdate, detailscrtime,
    127     detailslongname, detailsea, detailssize, detailssubject,
    128     detailslwdate, detailslwtime, detailsattr, detailsicon,
    129     fSubjectInLeftPane, fSubjectLengthMax, SubjectDisplayWidth;
     139  DETAILS_SETTINGS ds;
    130140  CHAR **lastselection;
    131141  USHORT shiftstate;
  • TabularUnified trunk/dll/fm3dll.h

    r1043 r1065  
    8080  29 Feb 08 GKY Refactor global command line variables to notebook.h
    8181  22 Jun 08 GKY Changed some variable types to fix compiler warnings
     82  11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
     83                all the details view settings (both the global variables and those in the
     84                DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
    8285
    8386***********************************************************************/
     
    501504BOOL AdjustCnrColVis(HWND hwndCnr, CHAR * title, BOOL visible, BOOL toggle);
    502505BOOL AdjustCnrColRO(HWND hwndCnr, CHAR * title, BOOL readonly, BOOL toggle);
    503 VOID AdjustCnrColsForFSType(HWND hwndCnr, CHAR * directory, DIRCNRDATA * dcd);
    504 VOID AdjustCnrColsForPref(HWND hwndCnr, CHAR * directory, DIRCNRDATA * dcd,
     506VOID AdjustCnrColsForFSType(HWND hwndCnr, CHAR * directory, DETAILS_SETTINGS * pds);
     507VOID AdjustCnrColsForPref(HWND hwndCnr, CHAR * directory, DETAILS_SETTINGS * pds,
    505508                          BOOL compare);
    506509BOOL SetCnrCols(HWND hwndCnr, BOOL compare);
     
    512515VOID CloseHelp(VOID);
    513516INT ExecFile(HWND hwnd, CHAR * filename);
    514 VOID SetDetailsSwitches(HWND hwnd, DIRCNRDATA * dcd);
     517VOID SetDetailsSwitches(HWND hwnd, DETAILS_SETTINGS * pds);
    515518VOID AdjustDetailsSwitches(HWND hwnd, HWND hwndMenu, USHORT cmd,
    516                            CHAR * directory, CHAR * keyroot, DIRCNRDATA * dcd,
     519                           CHAR * directory, CHAR * keyroot, DETAILS_SETTINGS * pds,
    517520                           BOOL compare);
    518521VOID SetConditionalCascade(HWND hwndMenu, USHORT id, USHORT def);
    519522VOID SetSortChecks(HWND hwndMenu, INT sortflags);
    520523VOID SetupCommandMenu(HWND hwndMenu, HWND hwndCnr);
    521 VOID LoadDetailsSwitches(CHAR * keyroot, DIRCNRDATA * dcd);
     524VOID LoadDetailsSwitches(CHAR * keyroot, DETAILS_SETTINGS * pds);
    522525HWND FindDirCnr(HWND hwndParent);
    523526VOID HeapThread(VOID * dummy);
     
    11361139  fSwitchTreeExpand, fCollapseFirst, fFilesInTree, fNoDead,
    11371140  fThreadNotes, fOkayMinimize, fRunning, fDullMin, fBlueLED,
    1138   fViewChild, fShowEnv, fLeaveTree, fNoFoldMenu, fSubjectInLeftPane,
     1141  fViewChild, fShowEnv, fLeaveTree, fNoFoldMenu,
    11391142  fCustomFileDlg, fSaveMiniCmds, fSaveBigCmds, fNoTileUpdate,
    11401143  fFM2Deletes, fAutoAddAllDirs, fConfirmTarget, fChangeTarget,
    11411144  fFirstTime, fShowTarget, fNoFinger, fDrivebarHelp, fCheckMM,
    1142   fSubjectLengthMax, fNoLargeFileSupport, fNoMailtoMailRun,
     1145  fNoLargeFileSupport, fNoMailtoMailRun,
    11431146  fHttpRunWPSDefault, fFtpRunWPSDefault, fLibPathStrictMailRun,
    11441147  fLibPathStrictHttpRun, fLibPathStrictFtpRun, fCancelAction, fTrashCan;
    1145 DATADEF BOOL detailsladate, detailslatime, detailscrdate, detailscrtime,
    1146   detailslongname, detailsea, detailssize, detailssubject,
    1147   detailslwdate, detailslwtime, detailsattr, detailsicon;
     1148DATADEF DETAILS_SETTINGS dsDirCnrDefault;
    11481149DATADEF PID mypid;
    11491150DATADEF INT driveflags[26], driveserial[26];
     
    11831184#define FILESTOGET_MAX  4096
    11841185
    1185 DATADEF ULONG ulCnrType, FilesToGet, AutoviewHeight, TreeWidth, FM3UL, SubjectDisplayWidth;
     1186DATADEF ULONG ulCnrType, FilesToGet, AutoviewHeight, TreeWidth, FM3UL;
    11861187DATADEF long prnwidth, prnlength, prntmargin, prnbmargin, prnlmargin,
    11871188  prnrmargin, prnspacing, prntabspaces;
  • TabularUnified trunk/dll/init.c

    r1063 r1065  
    4646                keys using a "DirCnr." prefix
    4747  20 Apr 08 GKY Change default cmd line length to 1024 Ask once if user wants to reset it.
     48  11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
     49                all the details view settings (both the global variables and those in the
     50                DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
    4851
    4952***********************************************************************/
     
    958961   * to 0)
    959962   */
    960   detailssize = detailsea = detailslwdate = detailslwtime = detailsattr =
    961     detailsicon = fAutoTile = fConfirmDelete = fLoadSubject = fUnHilite =
     963  dsDirCnrDefault.detailssize = dsDirCnrDefault.detailsea = dsDirCnrDefault.detailslwdate =
     964    dsDirCnrDefault.detailslwtime = dsDirCnrDefault.detailsattr = dsDirCnrDefault.detailsicon =
     965    fAutoTile = fConfirmDelete = fLoadSubject = fUnHilite =
    962966    fLoadLongnames = fToolbar = fSaveState = fGuessType = fToolbarHelp =
    963967    fAutoAddDirs = fUseNewViewer = fDataToFore = fDataShowDrives =
     
    13651369  PrfQueryProfileData(fmprof, FM3Str, "TrashCan", &fTrashCan, &size);
    13661370
    1367   LoadDetailsSwitches("DirCnr", NULL);
     1371  LoadDetailsSwitches("DirCnr", &dsDirCnrDefault);
    13681372
    13691373  /* load pointers and icons we use */
  • TabularUnified trunk/dll/mainwnd.c

    r1063 r1065  
    5959  30 Jun 08 JBS Ticket 103: Fix restore of previous shutdown state when opening FM/2
    6060  07 Jul 08 JBS Ticket 242: Delete obsolete INI keys when re-saving a state
     61  11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
     62                all the details view settings (both the global variables and those in the
     63                DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
    6164
    6265***********************************************************************/
     
    28632866                                  sizeof(ULONG));
    28642867              sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, numsaves);
    2865               PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslongname,
     2868              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslongname,
    28662869                                  sizeof(BOOL));
    28672870              sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, numsaves);
    2868               PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailssubject,
     2871              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailssubject,
    28692872                                  sizeof(BOOL));
    28702873              sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, numsaves);
    2871               PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailssize,
     2874              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailssize,
    28722875                                  sizeof(BOOL));
    28732876              sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, numsaves);
    2874               PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsea,
     2877              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsea,
    28752878                                  sizeof(BOOL));
    28762879              sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, numsaves);
    2877               PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsattr,
     2880              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsattr,
    28782881                                  sizeof(BOOL));
    28792882              sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, numsaves);
    2880               PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsicon,
     2883              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsicon,
    28812884                                  sizeof(BOOL));
    28822885              sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, numsaves);
    2883               PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslwdate,
     2886              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslwdate,
    28842887                                  sizeof(BOOL));
    28852888              sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, numsaves);
    2886               PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslwtime,
     2889              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslwtime,
    28872890                                  sizeof(BOOL));
    28882891              sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, numsaves);
    2889               PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsladate,
     2892              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailsladate,
    28902893                                  sizeof(BOOL));
    28912894              sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, numsaves);
    2892               PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslatime,
     2895              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailslatime,
    28932896                                  sizeof(BOOL));
    28942897              sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, numsaves);
    2895               PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailscrdate,
     2898              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailscrdate,
    28962899                                  sizeof(BOOL));
    28972900              sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, numsaves);
    2898               PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailscrtime,
     2901              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->ds.detailscrtime,
    28992902                                  sizeof(BOOL));
    29002903              sprintf(szKey, "%sDirCnr.%lu", szPrefix, numsaves);
     
    31153118          if (fDeleteState)
    31163119            PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    3117           localdcd.detailslongname = detailslongname;  // Set default
     3120          localdcd.ds.detailslongname = dsDirCnrDefault.detailslongname;  // Set default
    31183121          size = sizeof(BOOL);
    31193122          sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, x);
     
    31213124                                  FM3Str,
    31223125                                  szKey,
    3123                                   (PVOID)&localdcd.detailslongname,
     3126                                  (PVOID)&localdcd.ds.detailslongname,
    31243127                                  &size) &&
    31253128              size == sizeof(BOOL))
     
    31283131              PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    31293132          }
    3130           localdcd.detailssubject = detailssubject;  // Set default
     3133          localdcd.ds.detailssubject = dsDirCnrDefault.detailssubject;  // Set default
    31313134          size = sizeof(BOOL);
    31323135          sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, x);
     
    31343137                                  FM3Str,
    31353138                                  szKey,
    3136                                   (PVOID)&localdcd.detailssubject,
     3139                                  (PVOID)&localdcd.ds.detailssubject,
    31373140                                  &size) &&
    31383141              size == sizeof(BOOL))
     
    31413144              PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    31423145          }
    3143           localdcd.detailsea = detailsea;  // Set default
     3146          localdcd.ds.detailsea = dsDirCnrDefault.detailsea;  // Set default
    31443147          size = sizeof(BOOL);
    31453148          sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, x);
     
    31473150                                  FM3Str,
    31483151                                  szKey,
    3149                                   (PVOID) & localdcd.detailsea,
     3152                                  (PVOID) & localdcd.ds.detailsea,
    31503153                                  &size) &&
    31513154              size == sizeof(BOOL))
     
    31543157              PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    31553158          }
    3156           localdcd.detailssize = detailssize;  // Set default
     3159          localdcd.ds.detailssize = dsDirCnrDefault.detailssize;  // Set default
    31573160          size = sizeof(BOOL);
    31583161          sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, x);
     
    31603163                                  FM3Str,
    31613164                                  szKey,
    3162                                   (PVOID) & localdcd.detailssize,
     3165                                  (PVOID) & localdcd.ds.detailssize,
    31633166                                  &size) &&
    31643167              size == sizeof(BOOL))
     
    31673170              PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    31683171          }
    3169           localdcd.detailsicon = detailsicon;  // Set default
     3172          localdcd.ds.detailsicon = dsDirCnrDefault.detailsicon;  // Set default
    31703173          size = sizeof(BOOL);
    31713174          sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, x);
     
    31733176                                  FM3Str,
    31743177                                  szKey,
    3175                                   (PVOID) & localdcd.detailsicon,
     3178                                  (PVOID) & localdcd.ds.detailsicon,
    31763179                                  &size) &&
    31773180              size == sizeof(BOOL))
     
    31803183              PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    31813184          }
    3182           localdcd.detailsattr = detailsattr;  // Set default
     3185          localdcd.ds.detailsattr = dsDirCnrDefault.detailsattr;  // Set default
    31833186          size = sizeof(BOOL);
    31843187          sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, x);
     
    31863189                                  FM3Str,
    31873190                                  szKey,
    3188                                   (PVOID)&localdcd.detailsattr,
     3191                                  (PVOID)&localdcd.ds.detailsattr,
    31893192                                  &size) &&
    31903193              size == sizeof(BOOL))
     
    31933196              PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    31943197          }
    3195           localdcd.detailscrdate = detailscrdate;  // Set default
     3198          localdcd.ds.detailscrdate = dsDirCnrDefault.detailscrdate;  // Set default
    31963199          size = sizeof(BOOL);
    31973200          sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, x);
     
    31993202                                  FM3Str,
    32003203                                  szKey,
    3201                                   (PVOID) & localdcd.detailscrdate,
     3204                                  (PVOID) & localdcd.ds.detailscrdate,
    32023205              &size) && size == sizeof(BOOL))
    32033206          {
     
    32053208              PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    32063209          }
    3207           localdcd.detailscrtime = detailscrtime;  // Set default
     3210          localdcd.ds.detailscrtime = dsDirCnrDefault.detailscrtime;  // Set default
    32083211          size = sizeof(BOOL);
    32093212          sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, x);
     
    32113214                                  FM3Str,
    32123215                                  szKey,
    3213                                   (PVOID)&localdcd.detailscrtime,
     3216                                  (PVOID)&localdcd.ds.detailscrtime,
    32143217                                  &size) &&
    32153218              size == sizeof(BOOL))
     
    32183221              PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    32193222          }
    3220           localdcd.detailslwdate = detailslwdate;  // Set default
     3223          localdcd.ds.detailslwdate = dsDirCnrDefault.detailslwdate;  // Set default
    32213224          size = sizeof(BOOL);
    32223225          sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, x);
     
    32243227                                  FM3Str,
    32253228                                  szKey,
    3226                                   (PVOID) & localdcd.detailslwdate,
     3229                                  (PVOID) & localdcd.ds.detailslwdate,
    32273230                                  &size) &&
    32283231              size == sizeof(BOOL))
     
    32313234              PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    32323235          }
    3233           localdcd.detailslwtime = detailslwtime;  // Set default
     3236          localdcd.ds.detailslwtime = dsDirCnrDefault.detailslwtime;  // Set default
    32343237          size = sizeof(BOOL);
    32353238          sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, x);
     
    32373240                                  FM3Str,
    32383241                                  szKey,
    3239                                   (PVOID) & localdcd.detailslwtime,
     3242                                  (PVOID) & localdcd.ds.detailslwtime,
    32403243                                  &size) &&
    32413244              size == sizeof(BOOL))
     
    32443247              PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    32453248          }
    3246           localdcd.detailsladate = detailsladate;  // Set default
     3249          localdcd.ds.detailsladate = dsDirCnrDefault.detailsladate;  // Set default
    32473250          size = sizeof(BOOL);
    32483251          sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, x);
     
    32503253                                  FM3Str,
    32513254                                  szKey,
    3252                                   (PVOID) & localdcd.detailsladate,
     3255                                  (PVOID) & localdcd.ds.detailsladate,
    32533256                                  &size) &&
    32543257              size == sizeof(BOOL))
     
    32573260              PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    32583261          }
    3259           localdcd.detailslatime = detailslatime;  // Set default
     3262          localdcd.ds.detailslatime = dsDirCnrDefault.detailslatime;  // Set default
    32603263          size = sizeof(BOOL);
    32613264          sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, x);
     
    32633266                                  FM3Str,
    32643267                                  szKey,
    3265                                   (PVOID) & localdcd.detailslatime,
     3268                                  (PVOID) & localdcd.ds.detailslatime,
    32663269                                  &size) &&
    32673270              size == sizeof(BOOL))
     
    32973300              dcd = WinQueryWindowPtr(hwndCnr, QWL_USER);
    32983301              if (dcd) {
    3299                 dcd->detailslongname = localdcd.detailslongname;
    3300                 dcd->detailssubject  = localdcd.detailssubject ;
    3301                 dcd->detailsattr     = localdcd.detailsattr    ;
    3302                 dcd->detailsea       = localdcd.detailsea      ;
    3303                 dcd->detailssize     = localdcd.detailssize    ;
    3304                 dcd->detailsicon     = localdcd.detailsicon    ;
    3305                 dcd->detailscrdate   = localdcd.detailscrdate  ;
    3306                 dcd->detailscrtime   = localdcd.detailscrtime  ;
    3307                 dcd->detailsladate   = localdcd.detailsladate  ;
    3308                 dcd->detailslatime   = localdcd.detailslatime  ;
    3309                 dcd->detailslwdate   = localdcd.detailslwdate  ;
    3310                 dcd->detailslwtime   = localdcd.detailslwtime  ;
     3302                dcd->ds.detailslongname = localdcd.ds.detailslongname;
     3303                dcd->ds.detailssubject  = localdcd.ds.detailssubject ;
     3304                dcd->ds.detailsattr     = localdcd.ds.detailsattr    ;
     3305                dcd->ds.detailsea       = localdcd.ds.detailsea      ;
     3306                dcd->ds.detailssize     = localdcd.ds.detailssize    ;
     3307                dcd->ds.detailsicon     = localdcd.ds.detailsicon    ;
     3308                dcd->ds.detailscrdate   = localdcd.ds.detailscrdate  ;
     3309                dcd->ds.detailscrtime   = localdcd.ds.detailscrtime  ;
     3310                dcd->ds.detailsladate   = localdcd.ds.detailsladate  ;
     3311                dcd->ds.detailslatime   = localdcd.ds.detailslatime  ;
     3312                dcd->ds.detailslwdate   = localdcd.ds.detailslwdate  ;
     3313                dcd->ds.detailslwtime   = localdcd.ds.detailslwtime  ;
    33113314                size = sizeof(INT);
    33123315                sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, x);
  • TabularUnified trunk/dll/misc.c

    r1039 r1065  
    4545  19 Jun 08 JBS Ticket 239: Fix LoadDetailsSwitches so INI file is read correctly and details
    4646                switches are set correctly.
    47   21 Jun 08 GKY Fix LoadDetailsSwitches to actually use the keyroot value passed (change strcpy to strcat)
     47  11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
     48                all the details view settings (both the global variables and those in the
     49                DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
    4850
    4951***********************************************************************/
     
    368370}
    369371
    370 VOID AdjustCnrColsForFSType(HWND hwndCnr, CHAR * directory, DIRCNRDATA * dcd)
     372VOID AdjustCnrColsForFSType(HWND hwndCnr, CHAR * directory, DETAILS_SETTINGS * pds)
    371373{
    372374  CHAR FileSystem[CCHMAXPATH];
     
    375377  BOOL hasAccessDT;
    376378  BOOL hasLongNames;
    377   BOOL *pBool;
    378379
    379380  if (!directory || !*directory)
     
    410411    hasLongNames = FALSE;
    411412  }
    412   pBool = dcd ? &dcd->detailsladate : &detailsladate;
    413413  AdjustCnrColVis(hwndCnr,
    414414                  GetPString(IDS_LADATE),
    415                   *pBool ? hasAccessDT : FALSE,
     415                  pds->detailsladate ? hasAccessDT : FALSE,
    416416                  FALSE);
    417   pBool = dcd ? &dcd->detailslatime : &detailslatime;
    418417  AdjustCnrColVis(hwndCnr,
    419418                  GetPString(IDS_LATIME),
    420                   *pBool ? hasAccessDT : FALSE,
     419                  pds->detailslatime ? hasAccessDT : FALSE,
    421420                  FALSE);
    422   pBool = dcd ? &dcd->detailscrdate : &detailscrdate;
    423421  AdjustCnrColVis(hwndCnr,
    424422                  GetPString(IDS_CRDATE),
    425                   *pBool ? hasCreateDT : FALSE,
     423                  pds->detailscrdate ? hasCreateDT : FALSE,
    426424                  FALSE);
    427   pBool = dcd ? &dcd->detailscrtime : &detailscrtime;
    428425  AdjustCnrColVis(hwndCnr,
    429426                  GetPString(IDS_CRTIME),
    430                   *pBool ? hasCreateDT : FALSE,
     427                  pds->detailscrtime ? hasCreateDT : FALSE,
    431428                  FALSE);
    432   pBool = dcd ? &dcd->detailslongname : &detailslongname;
    433429  AdjustCnrColVis(hwndCnr,
    434430                  GetPString(IDS_LNAME),
    435                   *pBool ? hasLongNames : FALSE,
     431                  pds->detailslongname ? hasLongNames : FALSE,
    436432                  FALSE);
    437433  WinSendMsg(hwndCnr, CM_INVALIDATEDETAILFIELDINFO, MPVOID, MPVOID);
    438434}
    439435
    440 VOID AdjustCnrColsForPref(HWND hwndCnr, CHAR * directory, DIRCNRDATA * dcd,
     436VOID AdjustCnrColsForPref(HWND hwndCnr, CHAR * directory, DETAILS_SETTINGS * pds,
    441437                          BOOL compare)
    442438{
    443   BOOL *bool;
    444 
    445   bool = dcd ? &dcd->detailssubject : &detailssubject;
     439
    446440  AdjustCnrColVis(hwndCnr,
    447441                  compare ? GetPString(IDS_STATUS) : GetPString(IDS_SUBJ),
    448                   *bool,
     442                  pds->detailssubject,
    449443                  FALSE);
    450444
    451   bool = dcd ? &dcd->detailsattr : &detailsattr;
    452   AdjustCnrColVis(hwndCnr, GetPString(IDS_ATTR), *bool, FALSE);
    453   bool = dcd ? &dcd->detailsicon : &detailsicon;
    454   AdjustCnrColVis(hwndCnr, GetPString(IDS_ICON), *bool, FALSE);
    455   bool = dcd ? &dcd->detailslwdate : &detailslwdate;
    456   AdjustCnrColVis(hwndCnr, GetPString(IDS_LWDATE), *bool, FALSE);
    457   bool = dcd ? &dcd->detailslwtime : &detailslwtime;
    458   AdjustCnrColVis(hwndCnr, GetPString(IDS_LWTIME), *bool, FALSE);
    459   bool = dcd ? &dcd->detailsea : &detailsea;
    460   AdjustCnrColVis(hwndCnr, GetPString(IDS_EA), *bool, FALSE);
    461   bool = dcd ? &dcd->detailssize : &detailssize;
    462   AdjustCnrColVis(hwndCnr, GetPString(IDS_SIZE), *bool, FALSE);
     445  AdjustCnrColVis(hwndCnr, GetPString(IDS_ATTR), pds->detailsattr, FALSE);
     446  AdjustCnrColVis(hwndCnr, GetPString(IDS_ICON), pds->detailsicon, FALSE);
     447  AdjustCnrColVis(hwndCnr, GetPString(IDS_LWDATE), pds->detailslwdate, FALSE);
     448  AdjustCnrColVis(hwndCnr, GetPString(IDS_LWTIME), pds->detailslwtime, FALSE);
     449  AdjustCnrColVis(hwndCnr, GetPString(IDS_EA), pds->detailsea, FALSE);
     450  AdjustCnrColVis(hwndCnr, GetPString(IDS_SIZE), pds->detailssize, FALSE);
    463451
    464452  if (!directory) {
    465     bool = dcd ? &dcd->detailsladate : &detailsladate;
    466     AdjustCnrColVis(hwndCnr, GetPString(IDS_LADATE), *bool, FALSE);
    467     bool = dcd ? &dcd->detailslatime : &detailslatime;
    468     AdjustCnrColVis(hwndCnr, GetPString(IDS_LATIME), *bool, FALSE);
    469     bool = dcd ? &dcd->detailscrdate : &detailscrdate;
    470     AdjustCnrColVis(hwndCnr, GetPString(IDS_CRDATE), *bool, FALSE);
    471     bool = dcd ? &dcd->detailscrtime : &detailscrtime;
    472     AdjustCnrColVis(hwndCnr, GetPString(IDS_CRTIME), *bool, FALSE);
    473     bool = dcd ? &dcd->detailslongname : &detailslongname;
    474     AdjustCnrColVis(hwndCnr, GetPString(IDS_LNAME), *bool, FALSE);
     453    AdjustCnrColVis(hwndCnr, GetPString(IDS_LADATE), pds->detailsladate, FALSE);
     454    AdjustCnrColVis(hwndCnr, GetPString(IDS_LATIME), pds->detailslatime, FALSE);
     455    AdjustCnrColVis(hwndCnr, GetPString(IDS_CRDATE), pds->detailscrdate, FALSE);
     456    AdjustCnrColVis(hwndCnr, GetPString(IDS_CRTIME), pds->detailscrtime, FALSE);
     457    AdjustCnrColVis(hwndCnr, GetPString(IDS_LNAME), pds->detailslongname, FALSE);
    475458    WinSendMsg(hwndCnr, CM_INVALIDATEDETAILFIELDINFO, MPVOID, MPVOID);
    476459  }
    477460  else
    478     AdjustCnrColsForFSType(hwndCnr, directory, dcd);
     461    AdjustCnrColsForFSType(hwndCnr, directory, pds);
    479462}
    480463
     
    533516    // Fill in column info for subjects
    534517
    535     if (fSubjectInLeftPane) {
     518    if (dsDirCnrDefault.fSubjectInLeftPane) {
    536519      pfi = pfi->pNextFieldInfo;
    537520      pfi->flData = CFA_STRING | CFA_LEFT | CFA_SEPARATOR;
     
    542525                                  GetPString(IDS_SUBJ);
    543526      pfi->offStruct = FIELDOFFSET(CNRITEM, pszSubject);
    544       pfi->cxWidth = SubjectDisplayWidth;
     527      pfi->cxWidth = dsDirCnrDefault.SubjectDisplayWidth;
    545528
    546529      // Store the current pfi value as that will be used to indicate the
     
    562545                                  GetPString(IDS_SUBJ);
    563546      pfi->offStruct = FIELDOFFSET(CNRITEM, pszSubject);
    564       pfi->cxWidth = SubjectDisplayWidth;
     547      pfi->cxWidth = dsDirCnrDefault.SubjectDisplayWidth;
    565548    }
    566549
     
    1011994}
    1012995
    1013 VOID SetDetailsSwitches(HWND hwnd, DIRCNRDATA * dcd)
    1014 {
    1015   WinCheckMenuItem(hwnd, IDM_SHOWLNAMES,
    1016                    dcd ? dcd->detailslongname : detailslongname);
    1017   WinCheckMenuItem(hwnd, IDM_SHOWSUBJECT,
    1018                    dcd ? dcd->detailssubject : detailssubject);
    1019   WinCheckMenuItem(hwnd, IDM_SHOWEAS, dcd ? dcd->detailsea : detailsea);
    1020   WinCheckMenuItem(hwnd, IDM_SHOWSIZE,
    1021                    dcd ? dcd->detailssize : detailssize);
    1022   WinCheckMenuItem(hwnd, IDM_SHOWICON,
    1023                    dcd ? dcd->detailsicon : detailsicon);
    1024   WinCheckMenuItem(hwnd, IDM_SHOWLWDATE,
    1025                    dcd ? dcd->detailslwdate : detailslwdate);
    1026   WinCheckMenuItem(hwnd, IDM_SHOWLWTIME,
    1027                    dcd ? dcd->detailslwtime : detailslwtime);
    1028   WinCheckMenuItem(hwnd, IDM_SHOWLADATE,
    1029                    dcd ? dcd->detailsladate : detailsladate);
    1030   WinCheckMenuItem(hwnd, IDM_SHOWLATIME,
    1031                    dcd ? dcd->detailslatime : detailslatime);
    1032   WinCheckMenuItem(hwnd, IDM_SHOWCRDATE,
    1033                    dcd ? dcd->detailscrdate : detailscrdate);
    1034   WinCheckMenuItem(hwnd, IDM_SHOWCRTIME,
    1035                    dcd ? dcd->detailscrtime : detailscrtime);
    1036   WinCheckMenuItem(hwnd, IDM_SHOWATTR,
    1037                    dcd ? dcd->detailsattr : detailsattr);
     996VOID SetDetailsSwitches(HWND hwnd, DETAILS_SETTINGS * pds)
     997{
     998  WinCheckMenuItem(hwnd, IDM_SHOWLNAMES, pds->detailslongname);
     999  WinCheckMenuItem(hwnd, IDM_SHOWSUBJECT, pds->detailssubject);
     1000  WinCheckMenuItem(hwnd, IDM_SHOWEAS, pds->detailsea);
     1001  WinCheckMenuItem(hwnd, IDM_SHOWSIZE, pds->detailssize);
     1002  WinCheckMenuItem(hwnd, IDM_SHOWICON, pds->detailsicon);
     1003  WinCheckMenuItem(hwnd, IDM_SHOWLWDATE, pds->detailslwdate);
     1004  WinCheckMenuItem(hwnd, IDM_SHOWLWTIME, pds->detailslwtime);
     1005  WinCheckMenuItem(hwnd, IDM_SHOWLADATE, pds->detailsladate);
     1006  WinCheckMenuItem(hwnd, IDM_SHOWLATIME, pds->detailslatime);
     1007  WinCheckMenuItem(hwnd, IDM_SHOWCRDATE, pds->detailscrdate);
     1008  WinCheckMenuItem(hwnd, IDM_SHOWCRTIME, pds->detailscrtime);
     1009  WinCheckMenuItem(hwnd, IDM_SHOWATTR, pds->detailsattr);
    10381010}
    10391011
    10401012VOID AdjustDetailsSwitches(HWND hwnd, HWND hwndMenu, USHORT cmd,
    10411013                           CHAR * directory, CHAR * keyroot,
    1042                            DIRCNRDATA * dcd, BOOL compare)
     1014                           DETAILS_SETTINGS * pds, BOOL compare)
    10431015{
    10441016  BOOL *bool = NULL;
     
    10461018  switch (cmd) {
    10471019  case IDM_SHOWLNAMES:
    1048     bool = dcd ? &dcd->detailslongname : &detailslongname;
     1020    bool = &pds->detailslongname;
    10491021    break;
    10501022  case IDM_SHOWSUBJECT:
    1051     bool = dcd ? &dcd->detailssubject : &detailssubject;
     1023    bool = &pds->detailssubject;
    10521024    break;
    10531025  case IDM_SHOWEAS:
    1054     bool = dcd ? &dcd->detailsea : &detailsea;
     1026    bool = &pds->detailsea;
    10551027    break;
    10561028  case IDM_SHOWSIZE:
    1057     bool = dcd ? &dcd->detailssize : &detailssize;
     1029    bool = &pds->detailssize;
    10581030    break;
    10591031  case IDM_SHOWICON:
    1060     bool = dcd ? &dcd->detailsicon : &detailsicon;
     1032    bool = &pds->detailsicon;
    10611033    break;
    10621034  case IDM_SHOWLWDATE:
    1063     bool = dcd ? &dcd->detailslwdate : &detailslwdate;
     1035    bool = &pds->detailslwdate;
    10641036    break;
    10651037  case IDM_SHOWLWTIME:
    1066     bool = dcd ? &dcd->detailslwtime : &detailslwtime;
     1038    bool = &pds->detailslwtime;
    10671039    break;
    10681040  case IDM_SHOWLADATE:
    1069     bool = dcd ? &dcd->detailsladate : &detailsladate;
     1041    bool = &pds->detailsladate;
    10701042    break;
    10711043  case IDM_SHOWLATIME:
    1072     bool = dcd ? &dcd->detailslatime : &detailslatime;
     1044    bool = &pds->detailslatime;
    10731045    break;
    10741046  case IDM_SHOWCRDATE:
    1075     bool = dcd ? &dcd->detailscrdate : &detailscrdate;
     1047    bool = &pds->detailscrdate;
    10761048    break;
    10771049  case IDM_SHOWCRTIME:
    1078     bool = dcd ? &dcd->detailscrtime : &detailscrtime;
     1050    bool = &pds->detailscrtime;
    10791051    break;
    10801052  case IDM_SHOWATTR:
    1081     bool = dcd ? &dcd->detailsattr : &detailsattr;
     1053    bool = &pds->detailsattr;
    10821054    break;
    10831055  default:
    10841056    if (hwndMenu)
    1085       SetDetailsSwitches(hwndMenu, dcd);
     1057      SetDetailsSwitches(hwndMenu, pds);
    10861058    return;
    10871059  }
     
    10891061    *bool = *bool ? FALSE : TRUE;
    10901062  if (hwnd)
    1091     AdjustCnrColsForPref(hwnd, directory, dcd, compare);
     1063    AdjustCnrColsForPref(hwnd, directory, pds, compare);
    10921064  if (hwndMenu)
    1093     SetDetailsSwitches(hwndMenu, dcd);
     1065    SetDetailsSwitches(hwndMenu, pds);
    10941066}
    10951067
     
    12281200}
    12291201
    1230 VOID LoadDetailsSwitches(CHAR * keyroot, DIRCNRDATA * dcd)
     1202VOID LoadDetailsSwitches(CHAR * keyroot, DETAILS_SETTINGS * pds)
    12311203{
    12321204  ULONG size;
    12331205  CHAR s[CCHMAXPATH], *eos = s;
    1234   BOOL *bool;
    12351206
    12361207  strcpy(s, keyroot);
    12371208  strcat(s, ".");
    12381209  eos = &s[strlen(s)];
    1239   strcat(s, "DetailsLongname");
    1240   if (dcd)
    1241     bool = &dcd->detailslongname;
    1242   else
    1243     bool = &detailslongname;
    1244   *bool = detailslongname;
     1210  strcpy(eos, "DetailsLongname");
     1211  pds->detailslongname = dsDirCnrDefault.detailslongname;
    12451212  size = sizeof(BOOL);
    1246   PrfQueryProfileData(fmprof, appname, s, (PVOID) bool, &size);
     1213  PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailslongname, &size);
    12471214  strcpy(eos, "DetailsSubject");
    1248   if (dcd)
    1249     bool = &dcd->detailssubject;
    1250   else
    1251     bool = &detailssubject;
    1252   *bool = detailssubject;
     1215  pds->detailssubject = dsDirCnrDefault.detailssubject;
    12531216  size = sizeof(BOOL);
    1254   PrfQueryProfileData(fmprof, appname, s, (PVOID) bool, &size);
     1217  PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailssubject, &size);
    12551218  strcpy(eos, "DetailsEA");
    1256   if (dcd)
    1257     bool = &dcd->detailsea;
    1258   else
    1259     bool = &detailsea;
    1260   *bool = detailsea;
     1219  pds->detailsea = dsDirCnrDefault.detailsea;
    12611220  size = sizeof(BOOL);
    1262   PrfQueryProfileData(fmprof, appname, s, (PVOID) bool, &size);
     1221  PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailsea, &size);
    12631222  strcpy(eos, "DetailsSize");
    1264   if (dcd)
    1265     bool = &dcd->detailssize;
    1266   else
    1267     bool = &detailssize;
    1268   *bool = detailssize;
     1223  pds->detailssize = dsDirCnrDefault.detailssize;
    12691224  size = sizeof(BOOL);
    1270   PrfQueryProfileData(fmprof, appname, s, (PVOID) bool, &size);
     1225  PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailssize, &size);
    12711226  strcpy(eos, "DetailsIcon");
    1272   if (dcd)
    1273     bool = &dcd->detailsicon;
    1274   else
    1275     bool = &detailsicon;
    1276   *bool = detailsicon;
     1227  pds->detailsicon = dsDirCnrDefault.detailsicon;
    12771228  size = sizeof(BOOL);
    1278   PrfQueryProfileData(fmprof, appname, s, (PVOID) bool, &size);
     1229  PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailsicon, &size);
    12791230  strcpy(eos, "DetailsAttr");
    1280   if (dcd)
    1281     bool = &dcd->detailsattr;
    1282   else
    1283     bool = &detailsattr;
    1284   *bool = detailsattr;
     1231  pds->detailsattr = dsDirCnrDefault.detailsattr;
    12851232  size = sizeof(BOOL);
    1286   PrfQueryProfileData(fmprof, appname, s, (PVOID) bool, &size);
     1233  PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailsattr, &size);
    12871234  strcpy(eos, "DetailsCRDate");
    1288   if (dcd)
    1289     bool = &dcd->detailscrdate;
    1290   else
    1291     bool = &detailscrdate;
    1292   *bool = detailscrdate;
     1235  pds->detailscrdate = dsDirCnrDefault.detailscrdate;
    12931236  size = sizeof(BOOL);
    1294   PrfQueryProfileData(fmprof, appname, s, (PVOID) bool, &size);
     1237  PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailscrdate, &size);
    12951238  strcpy(eos, "DetailsCRTime");
    1296   if (dcd)
    1297     bool = &dcd->detailscrtime;
    1298   else
    1299     bool = &detailscrtime;
    1300   *bool = detailscrtime;
     1239  pds->detailscrtime = dsDirCnrDefault.detailscrtime;
    13011240  size = sizeof(BOOL);
    1302   PrfQueryProfileData(fmprof, appname, s, (PVOID) bool, &size);
     1241  PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailscrtime, &size);
    13031242  strcpy(eos, "DetailsLWDate");
    1304   if (dcd)
    1305     bool = &dcd->detailslwdate;
    1306   else
    1307     bool = &detailslwdate;
    1308   *bool = detailslwdate;
     1243  pds->detailslwdate = dsDirCnrDefault.detailslwdate;
    13091244  size = sizeof(BOOL);
    1310   PrfQueryProfileData(fmprof, appname, s, (PVOID) bool, &size);
     1245  PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailslwdate, &size);
    13111246  strcpy(eos, "DetailsLWTime");
    1312   if (dcd)
    1313     bool = &dcd->detailslwtime;
    1314   else
    1315     bool = &detailslwtime;
    1316   *bool = detailslwtime;
     1247  pds->detailslwtime = dsDirCnrDefault.detailslwtime;
    13171248  size = sizeof(BOOL);
    1318   PrfQueryProfileData(fmprof, appname, s, (PVOID) bool, &size);
     1249  PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailslwtime, &size);
    13191250  strcpy(eos, "DetailsLADate");
    1320   if (dcd)
    1321     bool = &dcd->detailsladate;
    1322   else
    1323     bool = &detailsladate;
    1324   *bool = detailsladate;
     1251  pds->detailsladate = dsDirCnrDefault.detailsladate;
    13251252  size = sizeof(BOOL);
    1326   PrfQueryProfileData(fmprof, appname, s, (PVOID) bool, &size);
     1253  PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailsladate, &size);
    13271254  strcpy(eos, "DetailsLATime");
    1328   if (dcd)
    1329     bool = &dcd->detailslatime;
    1330   else
    1331     bool = &detailslatime;
    1332   *bool = detailslatime;
     1255  pds->detailslatime = dsDirCnrDefault.detailslatime;
    13331256  size = sizeof(BOOL);
    1334   PrfQueryProfileData(fmprof, appname, s, (PVOID) bool, &size);
     1257  PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailslatime, &size);
    13351258  strcpy(eos, "SubjectInLeftPane");
    1336   if (dcd)
    1337     bool = &dcd->fSubjectInLeftPane;
    1338   else
    1339     bool = &fSubjectInLeftPane;
    1340   *bool = fSubjectInLeftPane;
     1259  pds->fSubjectInLeftPane = dsDirCnrDefault.fSubjectInLeftPane;
    13411260  size = sizeof(BOOL);
    1342   PrfQueryProfileData(fmprof, appname, s, (PVOID) bool, &size);
     1261  PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->fSubjectInLeftPane, &size);
    13431262  strcpy(eos, "SubjectLengthMax");
    1344   if (dcd)
    1345     bool = &dcd->fSubjectLengthMax;
    1346   else
    1347     bool = &fSubjectLengthMax;
    1348   *bool = fSubjectLengthMax;
     1263  pds->fSubjectLengthMax = dsDirCnrDefault.fSubjectLengthMax;
    13491264  size = sizeof(BOOL);
    1350   PrfQueryProfileData(fmprof, appname, s, (PVOID) bool, &size);
    1351   if (dcd) {
    1352     if (dcd->fSubjectLengthMax)
    1353       dcd->SubjectDisplayWidth = 0;
    1354     else {
    1355       strcpy(eos, "SubjectDisplayWidth");
    1356       bool = &dcd->SubjectDisplayWidth;
    1357       *bool = SubjectDisplayWidth;
    1358       size = sizeof(ULONG);
    1359       PrfQueryProfileData(fmprof, appname, s, (PVOID) bool, &size);
    1360       if (dcd->SubjectDisplayWidth < 50)
    1361         dcd->SubjectDisplayWidth = 0;
    1362       else if (dcd->SubjectDisplayWidth > 1000)
    1363         dcd->SubjectDisplayWidth = 1000;
    1364     }
    1365   }
     1265  PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->fSubjectLengthMax, &size);
     1266  if (pds->fSubjectLengthMax)
     1267    pds->SubjectDisplayWidth = 0;
    13661268  else {
    1367     if (fSubjectLengthMax)
    1368       SubjectDisplayWidth = 0;
    1369     else {
    1370       strcpy(eos, "SubjectDisplayWidth");
    1371       bool = &SubjectDisplayWidth;
    1372       *bool = SubjectDisplayWidth;
    1373       size = sizeof(ULONG);
    1374       PrfQueryProfileData(fmprof, appname, s, (PVOID) bool, &size);
    1375       if (SubjectDisplayWidth < 50)
    1376         SubjectDisplayWidth = 0;
    1377       else if (SubjectDisplayWidth > 1000)
    1378         SubjectDisplayWidth = 1000;
    1379     }
     1269    strcpy(eos, "SubjectDisplayWidth");
     1270    pds->SubjectDisplayWidth = dsDirCnrDefault.SubjectDisplayWidth;
     1271    size = sizeof(ULONG);
     1272    PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->SubjectDisplayWidth, &size);
     1273    if (pds->SubjectDisplayWidth < 50)
     1274      pds->SubjectDisplayWidth = 0;
     1275    else if (pds->SubjectDisplayWidth > 1000)
     1276      pds->SubjectDisplayWidth = 1000;
    13801277  }
    13811278}
  • TabularUnified trunk/dll/notebook.c

    r1049 r1065  
    3131  29 Feb 08 GKY Changes to enable user settable command line length
    3232  08 Mar 08 JBS Ticket 230: Replace prefixless INI keys for default directory containers with
    33   keys using a "DirCnr." prefix
     33                keys using a "DirCnr." prefix
    3434  06 Jul 08 GKY Update delete/undelete to include move to and open XWP trashcan
     35  11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
     36                all the details view settings (both the global variables and those in the
     37                DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
    3538
    3639***********************************************************************/
     
    17251728      if (flWindowAttr & CA_DETAILSVIEWTITLES)
    17261729        WinCheckButton(hwnd, CFG5_SHOWTITLES, TRUE);
    1727       WinCheckButton(hwnd, CFG5_SHOWLNAMES, detailslongname);
    1728       WinCheckButton(hwnd, CFG5_SHOWSUBJECT, detailssubject);
    1729       WinCheckButton(hwnd, CFG5_SHOWEAS, detailsea);
    1730       WinCheckButton(hwnd, CFG5_SHOWSIZE, detailssize);
    1731       WinCheckButton(hwnd, CFG5_SHOWICON, detailsicon);
    1732       WinCheckButton(hwnd, CFG5_SHOWLWDATE, detailslwdate);
    1733       WinCheckButton(hwnd, CFG5_SHOWLWTIME, detailslwtime);
    1734       WinCheckButton(hwnd, CFG5_SHOWLADATE, detailsladate);
    1735       WinCheckButton(hwnd, CFG5_SHOWLATIME, detailslatime);
    1736       WinCheckButton(hwnd, CFG5_SHOWCRDATE, detailscrdate);
    1737       WinCheckButton(hwnd, CFG5_SHOWCRTIME, detailscrtime);
    1738       WinCheckButton(hwnd, CFG5_SHOWATTR, detailsattr);
     1730      WinCheckButton(hwnd, CFG5_SHOWLNAMES, dsDirCnrDefault.detailslongname);
     1731      WinCheckButton(hwnd, CFG5_SHOWSUBJECT, dsDirCnrDefault.detailssubject);
     1732      WinCheckButton(hwnd, CFG5_SHOWEAS, dsDirCnrDefault.detailsea);
     1733      WinCheckButton(hwnd, CFG5_SHOWSIZE, dsDirCnrDefault.detailssize);
     1734      WinCheckButton(hwnd, CFG5_SHOWICON, dsDirCnrDefault.detailsicon);
     1735      WinCheckButton(hwnd, CFG5_SHOWLWDATE, dsDirCnrDefault.detailslwdate);
     1736      WinCheckButton(hwnd, CFG5_SHOWLWTIME, dsDirCnrDefault.detailslwtime);
     1737      WinCheckButton(hwnd, CFG5_SHOWLADATE, dsDirCnrDefault.detailsladate);
     1738      WinCheckButton(hwnd, CFG5_SHOWLATIME, dsDirCnrDefault.detailslatime);
     1739      WinCheckButton(hwnd, CFG5_SHOWCRDATE, dsDirCnrDefault.detailscrdate);
     1740      WinCheckButton(hwnd, CFG5_SHOWCRTIME, dsDirCnrDefault.detailscrtime);
     1741      WinCheckButton(hwnd, CFG5_SHOWATTR, dsDirCnrDefault.detailsattr);
    17391742      memset(&mask, 0, sizeof(mask));
    17401743      mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN |
     
    17481751      strcpy(mask.prompt, GetPString(IDS_DEFDIRFILTERTITLETEXT));
    17491752      WinSetDlgItemText(hwnd, CFG5_FILTER, mask.szMask);
    1750       WinCheckButton(hwnd, CFG5_SUBJECTINLEFTPANE, fSubjectInLeftPane);
    1751       WinCheckButton(hwnd, CFG5_SUBJECTLENGTHMAX, fSubjectLengthMax);
     1753      WinCheckButton(hwnd, CFG5_SUBJECTINLEFTPANE, dsDirCnrDefault.fSubjectInLeftPane);
     1754      WinCheckButton(hwnd, CFG5_SUBJECTLENGTHMAX, dsDirCnrDefault.fSubjectLengthMax);
    17521755      WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_SETCURRENTVALUE,
    1753                         MPFROMLONG(SubjectDisplayWidth), MPVOID);
     1756                        MPFROMLONG(dsDirCnrDefault.SubjectDisplayWidth), MPVOID);
    17541757    }
    17551758    return 0;
     
    18181821                          "DirflWindowAttr", &flWindowAttr, sizeof(ULONG));
    18191822    }
    1820     detailslongname = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLNAMES);
     1823    dsDirCnrDefault.detailslongname = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLNAMES);
    18211824    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLongname",
    1822                         &detailslongname, sizeof(BOOL));
    1823     detailssubject = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSUBJECT);
     1825                        &dsDirCnrDefault.detailslongname, sizeof(BOOL));
     1826    dsDirCnrDefault.detailssubject = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSUBJECT);
    18241827    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsSubject",
    1825                         &detailssubject, sizeof(BOOL));
     1828                        &dsDirCnrDefault.detailssubject, sizeof(BOOL));
     1829    dsDirCnrDefault.detailsea = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSUBJECT);
    18261830    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsEA",
    1827                         &detailsea, sizeof(BOOL));
    1828     detailssize = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSIZE);
     1831                        &dsDirCnrDefault.detailsea, sizeof(BOOL));
     1832    dsDirCnrDefault.detailssize = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSIZE);
    18291833    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsSize",
    1830                         &detailssize, sizeof(BOOL));
    1831     detailsicon = WinQueryButtonCheckstate(hwnd, CFG5_SHOWICON);
     1834                        &dsDirCnrDefault.detailssize, sizeof(BOOL));
     1835    dsDirCnrDefault.detailsicon = WinQueryButtonCheckstate(hwnd, CFG5_SHOWICON);
    18321836    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsIcon",
    1833                         &detailsicon, sizeof(BOOL));
    1834     detailslwdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWDATE);
     1837                        &dsDirCnrDefault.detailsicon, sizeof(BOOL));
     1838    dsDirCnrDefault.detailslwdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWDATE);
    18351839    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLWDate",
    1836                         &detailslwdate, sizeof(BOOL));
    1837     detailslwtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWTIME);
     1840                        &dsDirCnrDefault.detailslwdate, sizeof(BOOL));
     1841    dsDirCnrDefault.detailslwtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWTIME);
    18381842    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLWTime",
    1839                         &detailslwtime, sizeof(BOOL));
    1840     detailsladate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLADATE);
     1843                        &dsDirCnrDefault.detailslwtime, sizeof(BOOL));
     1844    dsDirCnrDefault.detailsladate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLADATE);
    18411845    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLADate",
    1842                         &detailsladate, sizeof(BOOL));
    1843     detailslatime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLATIME);
     1846                        &dsDirCnrDefault.detailsladate, sizeof(BOOL));
     1847    dsDirCnrDefault.detailslatime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLATIME);
    18441848    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLATime",
    1845                         &detailslatime, sizeof(BOOL));
    1846     detailscrdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRDATE);
     1849                        &dsDirCnrDefault.detailslatime, sizeof(BOOL));
     1850    dsDirCnrDefault.detailscrdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRDATE);
    18471851    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsCRDate",
    1848                         &detailscrdate, sizeof(BOOL));
    1849     detailscrtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRTIME);
     1852                        &dsDirCnrDefault.detailscrdate, sizeof(BOOL));
     1853    dsDirCnrDefault.detailscrtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRTIME);
    18501854    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsCRTime",
    1851                         &detailscrtime, sizeof(BOOL));
    1852     detailsattr = WinQueryButtonCheckstate(hwnd, CFG5_SHOWATTR);
     1855                        &dsDirCnrDefault.detailscrtime, sizeof(BOOL));
     1856    dsDirCnrDefault.detailsattr = WinQueryButtonCheckstate(hwnd, CFG5_SHOWATTR);
    18531857    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsAttr",
    1854                         &detailsattr, sizeof(BOOL));
    1855     fSubjectInLeftPane = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTINLEFTPANE);
     1858                        &dsDirCnrDefault.detailsattr, sizeof(BOOL));
     1859    dsDirCnrDefault.fSubjectInLeftPane = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTINLEFTPANE);
    18561860    PrfWriteProfileData(fmprof, appname, "DirCnr.SubjectInLeftPane",
    1857                         &fSubjectInLeftPane, sizeof(BOOL));
    1858     fSubjectLengthMax = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX);
     1861                        &dsDirCnrDefault.fSubjectInLeftPane, sizeof(BOOL));
     1862    dsDirCnrDefault.fSubjectLengthMax = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX);
    18591863    PrfWriteProfileData(fmprof, appname, "DirCnr.SubjectLengthMax",
    1860                         &fSubjectLengthMax, sizeof(BOOL));
     1864                        &dsDirCnrDefault.fSubjectLengthMax, sizeof(BOOL));
    18611865    *mask.prompt = 0;
    18621866    PrfWriteProfileData(fmprof, appname, "DirFilter", &mask, sizeof(MASK));
     
    18641868        if (!WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX)) {
    18651869          WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_QUERYVALUE,
    1866                             MPFROMP(&SubjectDisplayWidth), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
    1867           if (SubjectDisplayWidth < 50)
    1868             SubjectDisplayWidth = 0;
    1869           else if (SubjectDisplayWidth > 1000)
    1870             SubjectDisplayWidth = 1000;
     1870                            MPFROMP(&dsDirCnrDefault.SubjectDisplayWidth), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
     1871          if (dsDirCnrDefault.SubjectDisplayWidth < 50)
     1872            dsDirCnrDefault.SubjectDisplayWidth = 0;
     1873          else if (dsDirCnrDefault.SubjectDisplayWidth > 1000)
     1874            dsDirCnrDefault.SubjectDisplayWidth = 1000;
    18711875        }
    18721876        else
    1873           SubjectDisplayWidth = 0;
     1877          dsDirCnrDefault.SubjectDisplayWidth = 0;
    18741878        PrfWriteProfileData(fmprof,
    18751879                            appname, "DirCnr.SubjectDisplayWidth",
    1876                             &SubjectDisplayWidth, sizeof(ULONG));
     1880                            &dsDirCnrDefault.SubjectDisplayWidth, sizeof(ULONG));
    18771881    }
    18781882    break;
     
    20562060    }
    20572061    {
    2058       DIRCNRDATA dcd;
    2059 
    2060       memset(&dcd, 0, sizeof(dcd));
    2061       LoadDetailsSwitches("Collector", &dcd);
    2062       WinCheckButton(hwnd, CFG5_SHOWLNAMES, dcd.detailslongname);
    2063       WinCheckButton(hwnd, CFG5_SHOWSUBJECT, dcd.detailssubject);
    2064       WinCheckButton(hwnd, CFG5_SHOWEAS, dcd.detailsea);
    2065       WinCheckButton(hwnd, CFG5_SHOWSIZE, dcd.detailssize);
    2066       WinCheckButton(hwnd, CFG5_SHOWICON, dcd.detailsicon);
    2067       WinCheckButton(hwnd, CFG5_SHOWLWDATE, dcd.detailslwdate);
    2068       WinCheckButton(hwnd, CFG5_SHOWLWTIME, dcd.detailslwtime);
    2069       WinCheckButton(hwnd, CFG5_SHOWLADATE, dcd.detailsladate);
    2070       WinCheckButton(hwnd, CFG5_SHOWLATIME, dcd.detailslatime);
    2071       WinCheckButton(hwnd, CFG5_SHOWCRDATE, dcd.detailscrdate);
    2072       WinCheckButton(hwnd, CFG5_SHOWCRTIME, dcd.detailscrtime);
    2073       WinCheckButton(hwnd, CFG5_SHOWATTR, dcd.detailsattr);
    2074       WinCheckButton(hwnd, CFG5_SUBJECTINLEFTPANE, dcd.fSubjectInLeftPane);
    2075       WinCheckButton(hwnd, CFG5_SUBJECTLENGTHMAX, dcd.fSubjectLengthMax);
     2062      DETAILS_SETTINGS ds;
     2063
     2064      memset(&ds, 0, sizeof(ds));
     2065      LoadDetailsSwitches("Collector", &ds);
     2066      WinCheckButton(hwnd, CFG5_SHOWLNAMES, ds.detailslongname);
     2067      WinCheckButton(hwnd, CFG5_SHOWSUBJECT, ds.detailssubject);
     2068      WinCheckButton(hwnd, CFG5_SHOWEAS, ds.detailsea);
     2069      WinCheckButton(hwnd, CFG5_SHOWSIZE, ds.detailssize);
     2070      WinCheckButton(hwnd, CFG5_SHOWICON, ds.detailsicon);
     2071      WinCheckButton(hwnd, CFG5_SHOWLWDATE, ds.detailslwdate);
     2072      WinCheckButton(hwnd, CFG5_SHOWLWTIME, ds.detailslwtime);
     2073      WinCheckButton(hwnd, CFG5_SHOWLADATE, ds.detailsladate);
     2074      WinCheckButton(hwnd, CFG5_SHOWLATIME, ds.detailslatime);
     2075      WinCheckButton(hwnd, CFG5_SHOWCRDATE, ds.detailscrdate);
     2076      WinCheckButton(hwnd, CFG5_SHOWCRTIME, ds.detailscrtime);
     2077      WinCheckButton(hwnd, CFG5_SHOWATTR, ds.detailsattr);
     2078      WinCheckButton(hwnd, CFG5_SUBJECTINLEFTPANE, ds.fSubjectInLeftPane);
     2079      WinCheckButton(hwnd, CFG5_SUBJECTLENGTHMAX, ds.fSubjectLengthMax);
    20762080      WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_SETCURRENTVALUE,
    2077                         MPFROMLONG(dcd.SubjectDisplayWidth), MPVOID);
     2081                        MPFROMLONG(ds.SubjectDisplayWidth), MPVOID);
    20782082
    20792083    }
     
    21472151    }
    21482152    {
    2149       DIRCNRDATA dcd;
    2150 
    2151       memset(&dcd, 0, sizeof(dcd));
    2152       dcd.detailslongname = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLNAMES);
     2153      DETAILS_SETTINGS ds;
     2154
     2155      memset(&ds, 0, sizeof(ds));
     2156      ds.detailslongname = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLNAMES);
    21532157      PrfWriteProfileData(fmprof, appname, "Collector.DetailsLongname",
    2154                           &dcd.detailslongname, sizeof(BOOL));
    2155       dcd.detailssubject = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSUBJECT);
     2158                          &ds.detailslongname, sizeof(BOOL));
     2159      ds.detailssubject = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSUBJECT);
    21562160      PrfWriteProfileData(fmprof, appname, "Collector.DetailsSubject",
    2157                           &dcd.detailssubject, sizeof(BOOL));
    2158       dcd.detailsea = WinQueryButtonCheckstate(hwnd, CFG5_SHOWEAS);
     2161                          &ds.detailssubject, sizeof(BOOL));
     2162      ds.detailsea = WinQueryButtonCheckstate(hwnd, CFG5_SHOWEAS);
    21592163      PrfWriteProfileData(fmprof, appname, "Collector.DetailsEA",
    2160                           &dcd.detailsea, sizeof(BOOL));
    2161       dcd.detailssize = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSIZE);
     2164                          &ds.detailsea, sizeof(BOOL));
     2165      ds.detailssize = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSIZE);
    21622166      PrfWriteProfileData(fmprof, appname, "Collector.DetailsSize",
    2163                           &dcd.detailssize, sizeof(BOOL));
    2164       dcd.detailsicon = WinQueryButtonCheckstate(hwnd, CFG5_SHOWICON);
     2167                          &ds.detailssize, sizeof(BOOL));
     2168      ds.detailsicon = WinQueryButtonCheckstate(hwnd, CFG5_SHOWICON);
    21652169      PrfWriteProfileData(fmprof, appname, "Collector.DetailsIcon",
    2166                           &dcd.detailsicon, sizeof(BOOL));
    2167       dcd.detailslwdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWDATE);
     2170                          &ds.detailsicon, sizeof(BOOL));
     2171      ds.detailslwdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWDATE);
    21682172      PrfWriteProfileData(fmprof, appname, "Collector.DetailsLWDate",
    2169                           &dcd.detailslwdate, sizeof(BOOL));
    2170       dcd.detailslwtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWTIME);
     2173                          &ds.detailslwdate, sizeof(BOOL));
     2174      ds.detailslwtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWTIME);
    21712175      PrfWriteProfileData(fmprof, appname, "Collector.DetailsLWTime",
    2172                           &dcd.detailslwtime, sizeof(BOOL));
    2173       dcd.detailsladate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLADATE);
     2176                          &ds.detailslwtime, sizeof(BOOL));
     2177      ds.detailsladate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLADATE);
    21742178      PrfWriteProfileData(fmprof, appname, "Collector.DetailsLADate",
    2175                           &dcd.detailsladate, sizeof(BOOL));
    2176       dcd.detailslatime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLATIME);
     2179                          &ds.detailsladate, sizeof(BOOL));
     2180      ds.detailslatime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLATIME);
    21772181      PrfWriteProfileData(fmprof, appname, "Collector.DetailsLATime",
    2178                           &dcd.detailslatime, sizeof(BOOL));
    2179       dcd.detailscrdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRDATE);
     2182                          &ds.detailslatime, sizeof(BOOL));
     2183      ds.detailscrdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRDATE);
    21802184      PrfWriteProfileData(fmprof, appname, "Collector.DetailsCRDate",
    2181                           &dcd.detailscrdate, sizeof(BOOL));
    2182       dcd.detailscrtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRTIME);
     2185                          &ds.detailscrdate, sizeof(BOOL));
     2186      ds.detailscrtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRTIME);
    21832187      PrfWriteProfileData(fmprof, appname, "Collector.DetailsCRTime",
    2184                           &dcd.detailscrtime, sizeof(BOOL));
    2185       dcd.detailsattr = WinQueryButtonCheckstate(hwnd, CFG5_SHOWATTR);
     2188                          &ds.detailscrtime, sizeof(BOOL));
     2189      ds.detailsattr = WinQueryButtonCheckstate(hwnd, CFG5_SHOWATTR);
    21862190      PrfWriteProfileData(fmprof, appname, "Collector.DetailsAttr",
    2187                           &dcd.detailsattr, sizeof(BOOL));
    2188       dcd.fSubjectInLeftPane = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTINLEFTPANE);
     2191                          &ds.detailsattr, sizeof(BOOL));
     2192      ds.fSubjectInLeftPane = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTINLEFTPANE);
    21892193      PrfWriteProfileData(fmprof, appname, "Collector.SubjectInLeftPane",
    2190                           &dcd.fSubjectInLeftPane, sizeof(BOOL));
    2191       dcd.fSubjectLengthMax = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX);
     2194                          &ds.fSubjectInLeftPane, sizeof(BOOL));
     2195      ds.fSubjectLengthMax = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX);
    21922196      PrfWriteProfileData(fmprof, appname, "Collector.SubjectLengthMax",
    2193                           &dcd.fSubjectLengthMax, sizeof(BOOL));
     2197                          &ds.fSubjectLengthMax, sizeof(BOOL));
    21942198      *mask.prompt = 0;
    21952199      PrfWriteProfileData(fmprof,
     
    21982202        if (!WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX)) {
    21992203          WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_QUERYVALUE,
    2200                             MPFROMP(&dcd.SubjectDisplayWidth), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
    2201           if (dcd.SubjectDisplayWidth < 50)
    2202             dcd.SubjectDisplayWidth = 0;
    2203           else if (dcd.SubjectDisplayWidth > 1000)
    2204             dcd.SubjectDisplayWidth = 1000;
     2204                            MPFROMP(&ds.SubjectDisplayWidth), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
     2205          if (ds.SubjectDisplayWidth < 50)
     2206            ds.SubjectDisplayWidth = 0;
     2207          else if (ds.SubjectDisplayWidth > 1000)
     2208            ds.SubjectDisplayWidth = 1000;
    22052209        }
    22062210        else
    2207           dcd.SubjectDisplayWidth = 0;
     2211          ds.SubjectDisplayWidth = 0;
    22082212        PrfWriteProfileData(fmprof,
    22092213                            appname, "Collector.SubjectDisplayWidth",
    2210                             &dcd.SubjectDisplayWidth, sizeof(ULONG));
     2214                            &ds.SubjectDisplayWidth, sizeof(ULONG));
    22112215      }
    22122216    }
     
    24192423                            appname, "Collector.Fontnamesize", NULL, 0);
    24202424      }
    2421       detailslongname = TRUE;
    2422       detailssubject = TRUE;
    2423       detailsea = TRUE;
    2424       detailssize = TRUE;
    2425       detailsicon = TRUE;
    2426       detailslwdate = TRUE;
    2427       detailslwtime = TRUE;
    2428       detailsladate = TRUE;
    2429       detailslatime = TRUE;
    2430       detailscrdate = TRUE;
    2431       detailscrtime = TRUE;
    2432       detailsattr = TRUE;
     2425      dsDirCnrDefault.detailslongname = TRUE;
     2426      dsDirCnrDefault.detailssubject = TRUE;
     2427      dsDirCnrDefault.detailsea = TRUE;
     2428      dsDirCnrDefault.detailssize = TRUE;
     2429      dsDirCnrDefault.detailsicon = TRUE;
     2430      dsDirCnrDefault.detailslwdate = TRUE;
     2431      dsDirCnrDefault.detailslwtime = TRUE;
     2432      dsDirCnrDefault.detailsladate = TRUE;
     2433      dsDirCnrDefault.detailslatime = TRUE;
     2434      dsDirCnrDefault.detailscrdate = TRUE;
     2435      dsDirCnrDefault.detailscrtime = TRUE;
     2436      dsDirCnrDefault.detailsattr = TRUE;
    24332437      if (hwndTree) {
    24342438
     
    24762480                            strlen(GetPString(IDS_8HELVTEXT)) + 1);
    24772481      }
    2478       detailslongname = TRUE;
    2479       detailssubject = TRUE;
    2480       detailsea = TRUE;
    2481       detailssize = TRUE;
    2482       detailsicon = TRUE;
    2483       detailslwdate = TRUE;
    2484       detailslwtime = TRUE;
    2485       detailsladate = TRUE;
    2486       detailslatime = TRUE;
    2487       detailscrdate = TRUE;
    2488       detailscrtime = TRUE;
    2489       detailsattr = TRUE;
     2482      dsDirCnrDefault.detailslongname = TRUE;
     2483      dsDirCnrDefault.detailssubject = TRUE;
     2484      dsDirCnrDefault.detailsea = TRUE;
     2485      dsDirCnrDefault.detailssize = TRUE;
     2486      dsDirCnrDefault.detailsicon = TRUE;
     2487      dsDirCnrDefault.detailslwdate = TRUE;
     2488      dsDirCnrDefault.detailslwtime = TRUE;
     2489      dsDirCnrDefault.detailsladate = TRUE;
     2490      dsDirCnrDefault.detailslatime = TRUE;
     2491      dsDirCnrDefault.detailscrdate = TRUE;
     2492      dsDirCnrDefault.detailscrtime = TRUE;
     2493      dsDirCnrDefault.detailsattr = TRUE;
    24902494      if (hwndTree) {
    24912495
     
    25642568      fForceUpper = FALSE;
    25652569      fForceLower = FALSE;
    2566       detailslongname = FALSE;
    2567       detailssubject = FALSE;
     2570      dsDirCnrDefault.detailslongname = FALSE;
     2571      dsDirCnrDefault.detailssubject = FALSE;
    25682572      break;
    25692573
     
    26242628                            &flWindowAttr, sizeof(ULONG));
    26252629      }
    2626       detailslongname = FALSE;
    2627       detailssubject = FALSE;
    2628       detailsea = TRUE;
    2629       detailssize = TRUE;
    2630       detailsicon = TRUE;
    2631       detailslwdate = TRUE;
    2632       detailslwtime = TRUE;
    2633       detailsladate = FALSE;
    2634       detailslatime = FALSE;
    2635       detailscrdate = FALSE;
    2636       detailscrtime = FALSE;
    2637       detailsattr = TRUE;
     2630      dsDirCnrDefault.detailslongname = FALSE;
     2631      dsDirCnrDefault.detailssubject = FALSE;
     2632      dsDirCnrDefault.detailsea = TRUE;
     2633      dsDirCnrDefault.detailssize = TRUE;
     2634      dsDirCnrDefault.detailsicon = TRUE;
     2635      dsDirCnrDefault.detailslwdate = TRUE;
     2636      dsDirCnrDefault.detailslwtime = TRUE;
     2637      dsDirCnrDefault.detailsladate = FALSE;
     2638      dsDirCnrDefault.detailslatime = FALSE;
     2639      dsDirCnrDefault.detailscrdate = FALSE;
     2640      dsDirCnrDefault.detailscrtime = FALSE;
     2641      dsDirCnrDefault.detailsattr = TRUE;
    26382642      sortFlags = SORT_FILENAME | SORT_DIRSFIRST;
    26392643      CollectorsortFlags = SORT_FILENAME | SORT_DIRSFIRST;
     
    27412745                            &flWindowAttr, sizeof(ULONG));
    27422746      }
    2743       detailslongname = FALSE;
    2744       detailssubject = FALSE;
    2745       detailsea = TRUE;
    2746       detailssize = TRUE;
    2747       detailsicon = TRUE;
    2748       detailslwdate = TRUE;
    2749       detailslwtime = TRUE;
    2750       detailsladate = FALSE;
    2751       detailslatime = FALSE;
    2752       detailscrdate = FALSE;
    2753       detailscrtime = FALSE;
    2754       detailsattr = TRUE;
     2747      dsDirCnrDefault.detailslongname = FALSE;
     2748      dsDirCnrDefault.detailssubject = FALSE;
     2749      dsDirCnrDefault.detailsea = TRUE;
     2750      dsDirCnrDefault.detailssize = TRUE;
     2751      dsDirCnrDefault.detailsicon = TRUE;
     2752      dsDirCnrDefault.detailslwdate = TRUE;
     2753      dsDirCnrDefault.detailslwtime = TRUE;
     2754      dsDirCnrDefault.detailsladate = FALSE;
     2755      dsDirCnrDefault.detailslatime = FALSE;
     2756      dsDirCnrDefault.detailscrdate = FALSE;
     2757      dsDirCnrDefault.detailscrtime = FALSE;
     2758      dsDirCnrDefault.detailsattr = TRUE;
    27552759      sortFlags = SORT_FILENAME | SORT_DIRSFIRST;
    27562760      CollectorsortFlags = SORT_FILENAME | SORT_DIRSFIRST;
     
    29642968    // Save new details settings and refresh windows
    29652969    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLongname",
    2966                         &detailslongname, sizeof(BOOL));
     2970                        &dsDirCnrDefault.detailslongname, sizeof(BOOL));
    29672971    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsSubject",
    2968                         &detailssubject, sizeof(BOOL));
     2972                        &dsDirCnrDefault.detailssubject, sizeof(BOOL));
    29692973    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsEA",
    2970                         &detailsea, sizeof(BOOL));
     2974                        &dsDirCnrDefault.detailsea, sizeof(BOOL));
    29712975    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsSize",
    2972                         &detailssize, sizeof(BOOL));
     2976                        &dsDirCnrDefault.detailssize, sizeof(BOOL));
    29732977    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsIcon",
    2974                         &detailsicon, sizeof(BOOL));
     2978                        &dsDirCnrDefault.detailsicon, sizeof(BOOL));
    29752979    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLWDate",
    2976                         &detailslwdate, sizeof(BOOL));
     2980                        &dsDirCnrDefault.detailslwdate, sizeof(BOOL));
    29772981    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLWTime",
    2978                         &detailslwtime, sizeof(BOOL));
     2982                        &dsDirCnrDefault.detailslwtime, sizeof(BOOL));
    29792983    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLADate",
    2980                         &detailsladate, sizeof(BOOL));
     2984                        &dsDirCnrDefault.detailsladate, sizeof(BOOL));
    29812985    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLATime",
    2982                         &detailslatime, sizeof(BOOL));
     2986                        &dsDirCnrDefault.detailslatime, sizeof(BOOL));
    29832987    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsCRDate",
    2984                         &detailscrdate, sizeof(BOOL));
     2988                        &dsDirCnrDefault.detailscrdate, sizeof(BOOL));
    29852989    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsCRTime",
    2986                         &detailscrtime, sizeof(BOOL));
     2990                        &dsDirCnrDefault.detailscrtime, sizeof(BOOL));
    29872991    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsAttr",
    2988                         &detailsattr, sizeof(BOOL));
     2992                        &dsDirCnrDefault.detailsattr, sizeof(BOOL));
    29892993    if (hwndMain) {
    29902994      // Save state and restore to refresh windows with new settings
Note: See TracChangeset for help on using the changeset viewer.