Ignore:
Timestamp:
Nov 13, 2007, 12:25:28 AM (18 years ago)
Author:
John Small
Message:

A "first draft" of code to address ticket 150.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ticket_150/dll/mainwnd.c

    r847 r869  
    4444
    4545***********************************************************************/
     46
     47// #define FM2_STATE_AT_CLOSE GetPString(IDS_FM2TEMPTEXT)
     48#define FM2_STATE_AT_CLOSE "StateAtFM2Close"
     49//#define JBSDBG size = 1; //
     50#define JBSDBG
    4651
    4752#define INCL_DOS
     
    28202825              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & flWindowAttr,
    28212826                                  sizeof(ULONG));
     2827              sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, numsaves);
     2828              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslongname,
     2829                                  sizeof(BOOL));
     2830              sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, numsaves);
     2831              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailssubject,
     2832                                  sizeof(BOOL));
     2833              sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, numsaves);
     2834              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailssize,
     2835                                  sizeof(BOOL));
     2836              sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, numsaves);
     2837              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsea,
     2838                                  sizeof(BOOL));
     2839              sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, numsaves);
     2840              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsattr,
     2841                                  sizeof(BOOL));
     2842              sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, numsaves);
     2843              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsicon,
     2844                                  sizeof(BOOL));
     2845              sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, numsaves);
     2846              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslwdate,
     2847                                  sizeof(BOOL));
     2848              sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, numsaves);
     2849              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslwtime,
     2850                                  sizeof(BOOL));
     2851              sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, numsaves);
     2852              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsladate,
     2853                                  sizeof(BOOL));
     2854              sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, numsaves);
     2855              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslatime,
     2856                                  sizeof(BOOL));
     2857              sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, numsaves);
     2858              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailscrdate,
     2859                                  sizeof(BOOL));
     2860              sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, numsaves);
     2861              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailscrtime,
     2862                                  sizeof(BOOL));
    28222863            }
    28232864            sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, numsaves++);
     
    28982939  BOOL fRestored = FALSE;
    28992940  DIRCNRDATA *dcd;
     2941  DIRCNRDATA localdcd;
    29002942
    29012943  if (!pszStateName)
     
    29793021            continue;
    29803022          }
     3023// test code
     3024
     3025                localdcd.detailslongname = detailslongname;  // Set default
     3026                size = sizeof(BOOL);
     3027                sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, x);
     3028                if (PrfQueryProfileData(fmprof,
     3029                                        FM3Str,
     3030                                        szKey,
     3031                                        (PVOID) & localdcd.detailslongname,
     3032                                        &size) && size == sizeof(BOOL))
     3033                                        {
     3034                                          if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
     3035                                            JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3036                                        }
     3037                localdcd.detailssubject = detailssubject;  // Set default
     3038                size = sizeof(BOOL);
     3039                sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, x);
     3040                if (PrfQueryProfileData(fmprof,
     3041                                        FM3Str,
     3042                                        szKey,
     3043                                        (PVOID) & localdcd.detailssubject,
     3044                                        &size) && size == sizeof(BOOL))
     3045                                        {
     3046                                          if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
     3047                                            JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3048                                        }
     3049                localdcd.detailsea = detailsea;  // Set default
     3050                size = sizeof(BOOL);
     3051                sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, x);
     3052                if (PrfQueryProfileData(fmprof,
     3053                                        FM3Str,
     3054                                        szKey,
     3055                                        (PVOID) & localdcd.detailsea,
     3056                                        &size) && size == sizeof(BOOL))
     3057                                        {
     3058                                          if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
     3059                                            JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3060                                        }
     3061                localdcd.detailssize = detailssize;  // Set default
     3062                size = sizeof(BOOL);
     3063                sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, x);
     3064                if (PrfQueryProfileData(fmprof,
     3065                                        FM3Str,
     3066                                        szKey,
     3067                                        (PVOID) & localdcd.detailssize,
     3068                                        &size) && size == sizeof(BOOL))
     3069                                        {
     3070                                          if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
     3071                                            JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3072                                        }
     3073                localdcd.detailsicon = detailsicon;  // Set default
     3074                size = sizeof(BOOL);
     3075                sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, x);
     3076                if (PrfQueryProfileData(fmprof,
     3077                                        FM3Str,
     3078                                        szKey,
     3079                                        (PVOID) & localdcd.detailsicon,
     3080                                        &size) && size == sizeof(BOOL))
     3081                                        {
     3082                                          if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
     3083                                            JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3084                                        }
     3085                localdcd.detailsattr = detailsattr;  // Set default
     3086                size = sizeof(BOOL);
     3087                sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, x);
     3088                if (PrfQueryProfileData(fmprof,
     3089                                        FM3Str,
     3090                                        szKey,
     3091                                        (PVOID) & localdcd.detailsattr,
     3092                                        &size) && size == sizeof(BOOL))
     3093                                        {
     3094                                          if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
     3095                                            JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3096                                        }
     3097                localdcd.detailscrdate = detailscrdate;  // Set default
     3098                size = sizeof(BOOL);
     3099                sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, x);
     3100                if (PrfQueryProfileData(fmprof,
     3101                                        FM3Str,
     3102                                        szKey,
     3103                                        (PVOID) & localdcd.detailscrdate,
     3104                                        &size) && size == sizeof(BOOL))
     3105                                        {
     3106                                          if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
     3107                                            JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3108                                        }
     3109                localdcd.detailscrtime = detailscrtime;  // Set default
     3110                size = sizeof(BOOL);
     3111                sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, x);
     3112                if (PrfQueryProfileData(fmprof,
     3113                                        FM3Str,
     3114                                        szKey,
     3115                                        (PVOID) & localdcd.detailscrtime,
     3116                                        &size) && size == sizeof(BOOL))
     3117                                        {
     3118                                          if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
     3119                                            JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3120                                        }
     3121                localdcd.detailslwdate = detailslwdate;  // Set default
     3122                size = sizeof(BOOL);
     3123                sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, x);
     3124                if (PrfQueryProfileData(fmprof,
     3125                                        FM3Str,
     3126                                        szKey,
     3127                                        (PVOID) & localdcd.detailslwdate,
     3128                                        &size) && size == sizeof(BOOL))
     3129                                        {
     3130                                          if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
     3131                                            JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3132                                        }
     3133                localdcd.detailslwtime = detailslwtime;  // Set default
     3134                size = sizeof(BOOL);
     3135                sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, x);
     3136                if (PrfQueryProfileData(fmprof,
     3137                                        FM3Str,
     3138                                        szKey,
     3139                                        (PVOID) & localdcd.detailslwtime,
     3140                                        &size) && size == sizeof(BOOL))
     3141                                        {
     3142                                          if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
     3143                                            JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3144                                        }
     3145                localdcd.detailsladate = detailsladate;  // Set default
     3146                size = sizeof(BOOL);
     3147                sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, x);
     3148                if (PrfQueryProfileData(fmprof,
     3149                                        FM3Str,
     3150                                        szKey,
     3151                                        (PVOID) & localdcd.detailsladate,
     3152                                        &size) && size == sizeof(BOOL))
     3153                                        {
     3154                                          if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
     3155                                            JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3156                                        }
     3157                localdcd.detailslatime = detailslatime;  // Set default
     3158                size = sizeof(BOOL);
     3159                sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, x);
     3160                if (PrfQueryProfileData(fmprof,
     3161                                        FM3Str,
     3162                                        szKey,
     3163                                        (PVOID) & localdcd.detailslatime,
     3164                                        &size) && size == sizeof(BOOL))
     3165                                        {
     3166                                          if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
     3167                                            JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3168                                        }
     3169
    29813170          hwndDir = (HWND) WinSendMsg(hwndClient,
    29823171                                      UM_SETDIR,
     
    29853174            hwndC = WinWindowFromID(hwndDir, FID_CLIENT);
    29863175            if (hwndC) {
    2987               dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR),
    2988                                       QWL_USER);
     3176              HWND hwndCnr = WinWindowFromID(hwndC, DIR_CNR);
     3177              dcd = WinQueryWindowPtr(hwndCnr, QWL_USER);
    29893178              if (dcd) {
     3179                dcd->detailslongname = localdcd.detailslongname;
     3180                dcd->detailssubject  = localdcd.detailssubject ;
     3181                dcd->detailsattr     = localdcd.detailsattr    ;
     3182                dcd->detailsea       = localdcd.detailsea      ;
     3183                dcd->detailssize     = localdcd.detailssize    ;
     3184                dcd->detailsicon     = localdcd.detailsicon    ;
     3185                dcd->detailscrdate   = localdcd.detailscrdate  ;
     3186                dcd->detailscrtime   = localdcd.detailscrtime  ;
     3187                dcd->detailsladate   = localdcd.detailsladate  ;
     3188                dcd->detailslatime   = localdcd.detailslatime  ;
     3189                dcd->detailslwdate   = localdcd.detailslwdate  ;
     3190                dcd->detailslwtime   = localdcd.detailslwtime  ;
    29903191                size = sizeof(INT);
    29913192                sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, x);
     
    30403241                if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)))
    30413242                  PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3243                if (!PostMsg(hwndCnr, UM_SETUP2, NULL, NULL))
     3244                  WinSendMsg(hwndCnr, UM_SETUP2, NULL, NULL);
    30423245              }
    30433246            }
     
    43674570              sprintf(s, "%s.DirCnrView.%lu", szStateName, x);
    43684571              PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     4572              sprintf(s, "%s.DirCnr.%lu.DetailsLongname", szStateName, x);
     4573              PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     4574              sprintf(s, "%s.DirCnr.%lu.DetailsSubject", szStateName, x);
     4575              PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     4576              sprintf(s, "%s.DirCnr.%lu.DetailsSize", szStateName, x);
     4577              PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     4578              sprintf(s, "%s.DirCnr.%lu.DetailsEA", szStateName, x);
     4579              PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     4580              sprintf(s, "%s.DirCnr.%lu.DetailsAttr", szStateName, x);
     4581              PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     4582              sprintf(s, "%s.DirCnr.%lu.DetailsLWDate", szStateName, x);
     4583              PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     4584              sprintf(s, "%s.DirCnr.%lu.DetailsLWTime", szStateName, x);
     4585              PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     4586              sprintf(s, "%s.DirCnr.%lu.DetailsLADate", szStateName, x);
     4587              PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     4588              sprintf(s, "%s.DirCnr.%lu.DetailsLATime", szStateName, x);
     4589              PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     4590              sprintf(s, "%s.DirCnr.%lu.DetailsCRDate", szStateName, x);
     4591              PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     4592              sprintf(s, "%s.DirCnr.%lu.DetailsCRTime", szStateName, x);
     4593              PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
    43694594            }
    43704595            sprintf(s, "%s.LastTreePos", szStateName);
     
    53585583    /* start remaining child windows */
    53595584    if (!fNoSaveState && fSaveState)
    5360       PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPVOID);
     5585//    PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPVOID);
     5586      PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(FM2_STATE_AT_CLOSE), MPVOID);
    53615587    PostMsg(MainObjectHwnd, UM_SETUP4, mp1, mp2);
    53625588    return 0;
     
    54985724                          "MainWindowPos", WinQueryWindow(hwnd, QW_PARENT));
    54995725        if (!fNoSaveState && fSaveState)
    5500           SaveDirCnrState(hwnd, NULL);
    5501       }
     5726//        SaveDirCnrState(hwnd, NULL);
     5727          SaveDirCnrState(hwnd, FM2_STATE_AT_CLOSE);
     5728}
    55025729    }
    55035730    break;
Note: See TracChangeset for help on using the changeset viewer.