Changeset 1409 for trunk/dll/mainwnd.c
- Timestamp:
- Mar 20, 2009, 12:35:30 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/mainwnd.c
r1402 r1409 83 83 08 Mar 09 GKY Additional strings move to PCSZs & String Table 84 84 08 Mar 09 GKY Add WriteDetailsSwitches and use LoadDetailsSwitches to replace in line code 85 19 Mar 09 GKY Moved DeletePresParams to presparam.c 85 86 86 87 ***********************************************************************/ … … 167 168 static BOOL CloseDirCnrChildren(HWND hwndClient); 168 169 static BOOL RestoreDirCnrState(HWND hwndClient, PSZ pszStateName, BOOL noview); 169 static VOID DeletePresParams(PSZ pszKeyroot);170 170 static VOID BuildTools(HWND hwndT, BOOL resize); 171 171 … … 2919 2919 ULONG previous_numsaves, ulTemp = sizeof(ULONG); 2920 2920 CHAR szPrefix[STATE_NAME_MAX_BYTES + 1]; 2921 CHAR szKey[STATE_NAME_MAX_BYTES + 80] ;2921 CHAR szKey[STATE_NAME_MAX_BYTES + 80], szKeyBase[STATE_NAME_MAX_BYTES + 80], *eos; 2922 2922 CHAR szDir[CCHMAXPATH]; 2923 2923 SWP swp; … … 2963 2963 continue; 2964 2964 } 2965 sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, numsaves); 2965 sprintf(szKeyBase, "%sDirCnr.%lu", szPrefix, numsaves); 2966 strcpy(szKey, szKeyBase); 2967 strcat(szKey, "."); 2968 eos = &szKey[strlen(szKey)]; 2969 strcpy(eos, "Pos"); 2966 2970 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, 2967 2971 sizeof(SWP)); 2968 2972 dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER); 2969 2970 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, numsaves);2973 if (dcd) { 2974 strcpy(eos, "Sort"); 2971 2975 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->sortFlags, 2972 2973 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, numsaves);2976 sizeof(INT)); 2977 strcpy(eos, "Filter"); 2974 2978 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->mask, 2975 2976 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, numsaves);2979 sizeof(MASK)); 2980 strcpy(eos, "View"); 2977 2981 flWindowAttr = dcd->flWindowAttr; 2978 2982 if (!fLeaveTree && (flWindowAttr & CV_TREE)) { … … 2991 2995 flWindowAttr |= CV_NAME; 2992 2996 } 2993 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & 2997 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) &flWindowAttr, 2994 2998 sizeof(ULONG)); 2995 sprintf(szKey, "%sDirCnr.%lu", szPrefix, numsaves); 2996 WriteDetailsSwitches(szKey, &dcd->ds); 2997 sprintf(szKey, "%sDirCnr.%lu", szPrefix, numsaves); 2998 SavePresParams(hwndDir, szKey); 2999 } 3000 sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, numsaves++); 2999 WriteDetailsSwitches(szKeyBase, &dcd->ds, TRUE); 3000 SavePresParams(hwndDir, szKeyBase); 3001 } 3002 strcpy(eos, "Dir"); 3001 3003 PrfWriteProfileString(fmprof, FM3Str, szKey, szDir); 3004 numsaves++; 3002 3005 } 3003 3006 } … … 3010 3013 if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &previous_numsaves, &ulTemp)) 3011 3014 for (ulTemp = numsaves; ulTemp < previous_numsaves; ulTemp++) { 3012 sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, ulTemp); 3013 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(SWP)); 3014 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, ulTemp); 3015 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(INT)); 3016 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, ulTemp); 3017 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(MASK)); 3018 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, ulTemp); 3019 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, sizeof(ULONG)); 3020 3021 sprintf(szKey, "%sDirCnr.%lu", szPrefix, ulTemp); 3022 WriteDetailsSwitches(szKey, NULL); 3023 sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, ulTemp); 3024 PrfWriteProfileString(fmprof, FM3Str, szKey, NULL); 3025 sprintf(szKey, "%sDirCnr.%lu.", szPrefix, ulTemp); 3026 DeletePresParams(szKey); 3015 sprintf(szKeyBase, "%sDirCnr.%lu", szPrefix, ulTemp); 3016 RemoveCnrSwitches(szKeyBase, NULL); 3027 3017 } 3028 3018 sprintf(szKey, "%sNumDirsLastTime", szPrefix); 3029 3019 if (numsaves) { 3030 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & 3020 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) &numsaves, sizeof(ULONG)); 3031 3021 WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swp); 3032 3022 sprintf(szKey, "%sMySizeLastTime", szPrefix); 3033 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & 3023 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) &swp, sizeof(SWP)); 3034 3024 if (WinQueryWindowPos(hwndTree, &swp)) { 3035 3025 sprintf(szKey, "%sLastTreePos", szPrefix); 3036 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & 3026 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) &swp, sizeof(SWP)); 3037 3027 } 3038 3028 } 3039 3029 else if (fIsShutDownState) { 3040 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & numsaves, sizeof(ULONG)); 3041 } 3042 3030 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) &numsaves, sizeof(ULONG)); 3031 } 3043 3032 return numsaves; 3044 3033 } … … 3088 3077 static BOOL RestoreDirCnrState(HWND hwndClient, PSZ pszStateName, BOOL noview) 3089 3078 { 3090 CHAR szKey[STATE_NAME_MAX_BYTES + 80] ;3079 CHAR szKey[STATE_NAME_MAX_BYTES + 80], szKeyBase[STATE_NAME_MAX_BYTES + 80]; 3091 3080 CHAR szDir[CCHMAXPATH]; 3092 3081 CHAR szPrefix[STATE_NAME_MAX_BYTES + 2]; … … 3193 3182 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3194 3183 for (x = numsaves - 1; x >= 0; x--) { 3195 sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, x); 3184 CHAR *eos = szKey; 3185 3186 sprintf(szKeyBase, "%sDirCnr.%lu", szPrefix, x); 3187 strcpy(szKey, szKeyBase); 3188 strcat(szKey, "."); 3189 eos = &szKey[strlen(szKey)]; 3190 strcpy(eos, "Pos"); 3196 3191 size = sizeof(SWP); 3197 3192 if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &swp, &size)) { 3198 if (fDeleteState) 3199 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3200 sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, x); 3193 strcpy(eos, "Dir"); ; 3201 3194 size = sizeof(szDir); 3202 3195 if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) { … … 3205 3198 if (fIsShutDownState && 3206 3199 driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) { 3207 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3208 sprintf(szKey, "%sDirCnr.%lu", szPrefix, x); 3209 WriteDetailsSwitches(szKey, NULL); 3200 RemoveCnrSwitches(szKeyBase, NULL); 3210 3201 continue; 3211 3202 } 3212 if (fDeleteState) 3213 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3214 sprintf(szKey, "%sDirCnr.%lu", szPrefix, x); 3215 LoadDetailsSwitches(szKey, &localdcd.ds); 3216 if (fDeleteState) 3217 WriteDetailsSwitches(szKey, NULL); 3203 LoadDetailsSwitches(szKeyBase, &localdcd.ds, TRUE); 3218 3204 hwndDir = (HWND) WinSendMsg(hwndClient, 3219 3205 UM_SETDIR, … … 3238 3224 RestorePresParams(hwndPPSave, PCSZ_DIRCNR); 3239 3225 } 3240 //sprintf(szKey, "%sDirCnr.%lu", szPrefix, x); 3241 RestorePresParams(hwndCnr, szKey); 3226 RestorePresParams(hwndCnr, szKeyBase); 3242 3227 dcd = WinQueryWindowPtr(hwndCnr, QWL_USER); 3243 3228 if (dcd) { … … 3253 3238 dcd->ds.detailslatime = localdcd.ds.detailslatime ; 3254 3239 dcd->ds.detailslwdate = localdcd.ds.detailslwdate ; 3255 3256 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, x);3240 dcd->ds.detailslwtime = localdcd.ds.detailslwtime ; 3241 strcpy(eos, "Sort"); 3257 3242 size = sizeof(INT); 3258 3243 if (PrfQueryProfileData(fmprof, … … 3264 3249 dcd->sortFlags = SORT_PATHNAME; 3265 3250 } 3266 if (fDeleteState) 3267 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3268 size = sizeof(MASK); 3269 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, x); 3251 size = sizeof(MASK); 3252 strcpy(eos, "Filter"); 3270 3253 if (PrfQueryProfileData(fmprof, 3271 3254 FM3Str, … … 3277 3260 } 3278 3261 *(dcd->mask.prompt) = 0; 3279 if (fDeleteState) 3280 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3281 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, x); 3262 strcpy(eos, "View"); 3282 3263 if (!noview) { 3283 3264 size = sizeof(ULONG); … … 3304 3285 } 3305 3286 } 3306 if (fDeleteState)3307 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);3308 3287 if (!PostMsg(hwndCnr, UM_SETUP2, NULL, NULL)) 3309 3288 WinSendMsg(hwndCnr, UM_SETUP2, NULL, NULL); … … 3330 3309 SWP_SIZE | SWP_SHOW | SWP_ZORDER | 3331 3310 SWP_ACTIVATE); 3332 } 3311 } 3312 if (fDeleteState) 3313 RemoveCnrSwitches(szKeyBase, pszStateName); 3333 3314 } 3334 3315 } … … 4569 4550 case IDM_DELETEDIRCNRSTATE: 4570 4551 { 4571 CHAR szStateName[STATE_NAME_MAX_BYTES + 1] ;4552 CHAR szStateName[STATE_NAME_MAX_BYTES + 1], szKeyBase[STATE_NAME_MAX_BYTES + 1]; 4572 4553 4573 4554 *szStateName = 0; … … 4621 4602 // Delete 4622 4603 ULONG numsaves = 0, size, x; 4623 CHAR s [STATE_NAME_MAX_BYTES + 80];4604 CHAR szKey[STATE_NAME_MAX_BYTES + 80]; 4624 4605 4625 4606 INT ret = remove_setup(szStateName); 4626 4607 if (ret == 1) 4627 4608 save_setups(); 4628 sprintf(s , "%s.NumDirsLastTime", szStateName);4609 sprintf(szKey, "%s.NumDirsLastTime", szStateName); 4629 4610 size = sizeof(ULONG); 4630 4611 if (!PrfQueryProfileData(fmprof, 4631 4612 FM3Str, 4632 s ,4613 szKey, 4633 4614 (PVOID)&numsaves, 4634 4615 &size)) { … … 4640 4621 Runtime_Error(pszSrcFile, __LINE__, NULL); 4641 4622 else { 4642 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0L); 4643 for (x = 0; x < numsaves; x++) { 4644 sprintf(s, "%s.DirCnrPos.%lu", szStateName, x); 4645 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4646 sprintf(s, "%s.DirCnrDir.%lu", szStateName, x); 4647 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4648 sprintf(s, "%s.DirCnrSort.%lu", szStateName, x); 4649 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4650 sprintf(s, "%s.DirCnrFilter.%lu", szStateName, x); 4651 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4652 sprintf(s, "%s.DirCnrView.%lu", szStateName, x); 4653 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4654 4655 sprintf(s, "%s.DirCnr.%lu", szStateName, x); 4656 WriteDetailsSwitches(s, NULL); 4657 sprintf(s, "%s.DirCnr.%lu.Backgroundcolor", szStateName, x); 4658 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4659 sprintf(s, "%s.DirCnr.%lu.Fontnamesize", szStateName, x); 4660 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4623 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 4624 for (x = 0; x < numsaves; x++) { 4625 sprintf(szKeyBase, "%s.DirCnr.%lu", szStateName, x); 4626 RemoveCnrSwitches(szKeyBase, szStateName); 4661 4627 } 4662 sprintf(s, "%s.LastTreePos", szStateName);4663 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4664 sprintf(s, "%s.MySizeLastTime", szStateName);4665 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4666 4628 } 4667 4629 PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID); … … 6354 6316 } 6355 6317 6356 VOID DeletePresParams(CHAR * pchKeyroot)6357 // This code assumes that pchKeyroot points to a buffer large enough to6358 // hold the full INI key: The state name.dircnr-number.PPName. The6359 // PPNames are listed below.6360 {6361 PSZ apszPPNames[] =6362 {6363 "Backgroundcolor",6364 "Foregroundcolor",6365 "Hilitebackgroundcolor",6366 "Hiliteforegroundcolor",6367 "Bordercolor",6368 "Fontnamesize"6369 };6370 6371 ULONG ulSize, ulArraySize = sizeof(apszPPNames) / sizeof(PSZ), x;6372 CHAR * eos = pchKeyroot + strlen(pchKeyroot);6373 6374 for (x = 0; x < ulArraySize; x++)6375 {6376 strcpy(eos, apszPPNames[x]);6377 if (PrfQueryProfileSize(fmprof, appname, pchKeyroot, &ulSize) && ulSize)6378 {6379 PrfWriteProfileData(fmprof, appname, pchKeyroot, NULL, ulSize);6380 }6381 }6382 }6383 6384 6318 #pragma alloc_text(MISC8,SetToggleChecks,FindDirCnrByName,TopWindow) 6385 6319 #pragma alloc_text(MISC8,TopWindowName,CountDirCnrs)
Note:
See TracChangeset
for help on using the changeset viewer.