Changeset 1065 for trunk/dll/mainwnd.c


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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);
Note: See TracChangeset for help on using the changeset viewer.