- Timestamp:
- Mar 20, 2009, 12:35:30 AM (17 years ago)
- Location:
- trunk/dll
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/collect.c
r1402 r1409 1417 1417 1418 1418 RestorePresParams(hwnd, PCSZ_COLLECTOR); 1419 LoadDetailsSwitches(PCSZ_COLLECTOR, &dcd->ds );1419 LoadDetailsSwitches(PCSZ_COLLECTOR, &dcd->ds, FALSE); 1420 1420 1421 1421 dcd->amextracted = FALSE; // Say not busy -
trunk/dll/comp.c
r1402 r1409 65 65 08 Mar 09 GKY Removed variable aurguments from docopyf and unlinkf (not used) 66 66 08 Mar 09 GKY Additional strings move to PCSZs in init.c & String Table 67 15 Mar 09 GKY Use WriteDetailsSwitchs to save detail switch changes to the ini file. 67 68 68 69 ***********************************************************************/ … … 2343 2344 cmp->dcd.mask.attrFile = (FILE_DIRECTORY | FILE_ARCHIVED | 2344 2345 FILE_READONLY | FILE_SYSTEM | FILE_HIDDEN); 2345 LoadDetailsSwitches( "DirCmp", &cmp->dcd.ds);2346 LoadDetailsSwitches(PCSZ_DIRCMP, &cmp->dcd.ds, FALSE); 2346 2347 cmp->dcd.ds.detailslongname = FALSE; 2347 2348 cmp->dcd.ds.detailsicon = FALSE; // TRUE; … … 2984 2985 AdjustDetailsSwitches(hwndLeft, 2985 2986 (HWND)0, SHORT1FROMMP(mp1), 2986 cmp->leftdir, "DirCmp", &cmp->dcd.ds, TRUE);2987 cmp->leftdir, PCSZ_DIRCMP, &cmp->dcd.ds, TRUE); 2987 2988 tempsubj = cmp->dcd.ds.detailssubject; 2988 2989 cmp->dcd = dcd1; … … 2990 2991 AdjustDetailsSwitches(hwndRight, 2991 2992 cmp->dcd.hwndLastMenu, SHORT1FROMMP(mp1), 2992 cmp->rightdir, "DirCmp", &cmp->dcd.ds, TRUE); 2993 cmp->dcd.ds.detailssubject = tempsubj; 2993 cmp->rightdir, PCSZ_DIRCMP, &cmp->dcd.ds, TRUE); 2994 cmp->dcd.ds.detailssubject = tempsubj; 2995 WriteDetailsSwitches(PCSZ_DIRCMP, &cmp->dcd.ds, TRUE); 2994 2996 } 2995 2997 break; -
trunk/dll/flesh.c
r1400 r1409 270 270 BOOL Stubby(HWND hwndCnr, PCNRITEM pciParent) 271 271 { 272 /* 272 /** 273 273 * this code is full of workarounds for screwed up LANs. 274 274 * let's hope all the current LAN programmers fall into -
trunk/dll/init.c
r1403 r1409 235 235 PCSZ PCSZ_COLLECTOR = "Collector"; 236 236 PCSZ PCSZ_DIRCNR = "DirCnr"; 237 PCSZ PCSZ_DIRCMP = "DirCmp"; 237 238 PCSZ PCSZ_DIRSIZES = "DirSizes"; 238 239 PCSZ PCSZ_TOOLBAR = "ToolBar"; … … 1520 1521 PrfQueryProfileData(fmprof, FM3Str, "TrashCan", &fTrashCan, &size); 1521 1522 1522 LoadDetailsSwitches(PCSZ_DIRCNR, &dsDirCnrDefault );1523 LoadDetailsSwitches(PCSZ_DIRCNR, &dsDirCnrDefault, FALSE); 1523 1524 1524 1525 /* load pointers and icons we use */ -
trunk/dll/init.h
r1402 r1409 50 50 extern PCSZ PCSZ_COLLECTOR; 51 51 extern PCSZ PCSZ_DIRCNR; 52 extern PCSZ PCSZ_DIRCMP; 52 53 extern PCSZ PCSZ_DIRSIZES; 53 54 extern PCSZ PCSZ_TOOLBAR; -
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) -
trunk/dll/misc.c
r1402 r1409 1318 1318 } 1319 1319 1320 VOID LoadDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS *pds) 1320 /** 1321 * Loads all the detail switches from the ini file 1322 * state if TRUE skips global only settings 1323 * keyroot shouldn't pass trailing dot 1324 */ 1325 VOID LoadDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS *pds, BOOL state) 1321 1326 { 1322 1327 ULONG size; … … 1374 1379 size = sizeof(BOOL); 1375 1380 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailslatime, &size); 1376 strcpy(eos, "SubjectInLeftPane"); 1377 pds->fSubjectInLeftPane = dsDirCnrDefault.fSubjectInLeftPane; 1378 size = sizeof(BOOL); 1379 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->fSubjectInLeftPane, &size); 1380 strcpy(eos, "SubjectLengthMax"); 1381 pds->fSubjectLengthMax = dsDirCnrDefault.fSubjectLengthMax; 1382 size = sizeof(BOOL); 1383 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->fSubjectLengthMax, &size); 1384 if (pds->fSubjectLengthMax) 1385 pds->SubjectDisplayWidth = 0; 1386 else { 1387 strcpy(eos, "SubjectDisplayWidth"); 1388 pds->SubjectDisplayWidth = dsDirCnrDefault.SubjectDisplayWidth; 1389 size = sizeof(ULONG); 1390 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->SubjectDisplayWidth, &size); 1391 if (pds->SubjectDisplayWidth < 50) 1381 if (!state) { 1382 strcpy(eos, "SubjectInLeftPane"); 1383 pds->fSubjectInLeftPane = dsDirCnrDefault.fSubjectInLeftPane; 1384 size = sizeof(BOOL); 1385 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->fSubjectInLeftPane, &size); 1386 strcpy(eos, "SubjectLengthMax"); 1387 pds->fSubjectLengthMax = dsDirCnrDefault.fSubjectLengthMax; 1388 size = sizeof(BOOL); 1389 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->fSubjectLengthMax, &size); 1390 if (pds->fSubjectLengthMax) 1392 1391 pds->SubjectDisplayWidth = 0; 1393 else if (pds->SubjectDisplayWidth > 1000) 1394 pds->SubjectDisplayWidth = 1000; 1395 } 1396 } 1397 1398 VOID WriteDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS *pds) 1392 else { 1393 strcpy(eos, "SubjectDisplayWidth"); 1394 pds->SubjectDisplayWidth = dsDirCnrDefault.SubjectDisplayWidth; 1395 size = sizeof(ULONG); 1396 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->SubjectDisplayWidth, &size); 1397 if (pds->SubjectDisplayWidth < 50) 1398 pds->SubjectDisplayWidth = 0; 1399 else if (pds->SubjectDisplayWidth > 1000) 1400 pds->SubjectDisplayWidth = 1000; 1401 } 1402 } 1403 } 1404 1405 /** 1406 * Writes all the detail switches to the ini file 1407 * state if TRUE skips global only settings 1408 * keyroot shouldn't pass trailing dot 1409 */ 1410 VOID WriteDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS *pds, BOOL state) 1399 1411 { 1400 1412 CHAR s[CCHMAXPATH], *eos = s; … … 1404 1416 eos = &s[strlen(s)]; 1405 1417 strcpy(eos, "DetailsLongname"); 1406 PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailslongname : NULL, 1407 pds ? sizeof(BOOL) : 0); 1418 PrfWriteProfileData(fmprof, appname, s, &pds->detailslongname, sizeof(BOOL)); 1408 1419 strcpy(eos, "DetailsSubject"); 1409 PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailssubject : NULL, 1410 pds ? sizeof(BOOL) : 0); 1420 PrfWriteProfileData(fmprof, appname, s, &pds->detailssubject, sizeof(BOOL)); 1411 1421 strcpy(eos, "DetailsEA"); 1412 PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailsea : NULL, 1413 pds ? sizeof(BOOL) : 0); 1422 PrfWriteProfileData(fmprof, appname, s, &pds->detailsea, sizeof(BOOL)); 1414 1423 strcpy(eos, "DetailsSize"); 1415 PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailssize : NULL, 1416 pds ? sizeof(BOOL) : 0); 1424 PrfWriteProfileData(fmprof, appname, s, &pds->detailssize, sizeof(BOOL)); 1417 1425 strcpy(eos, "DetailsIcon"); 1418 PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailsicon : NULL, 1419 pds ? sizeof(BOOL) : 0); 1426 PrfWriteProfileData(fmprof, appname, s, &pds->detailsicon, sizeof(BOOL)); 1420 1427 strcpy(eos, "DetailsAttr"); 1421 PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailsattr : NULL, 1422 pds ? sizeof(BOOL) : 0); 1428 PrfWriteProfileData(fmprof, appname, s, &pds->detailsattr, sizeof(BOOL)); 1423 1429 strcpy(eos, "DetailsCRDate"); 1424 PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailscrdate : NULL, 1425 pds ? sizeof(BOOL) : 0); 1430 PrfWriteProfileData(fmprof, appname, s, &pds->detailscrdate, sizeof(BOOL)); 1426 1431 strcpy(eos, "DetailsCRTime"); 1427 PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailscrtime : NULL, 1428 pds ? sizeof(BOOL) : 0); 1432 PrfWriteProfileData(fmprof, appname, s, &pds->detailscrtime, sizeof(BOOL)); 1429 1433 strcpy(eos, "DetailsLWDate"); 1430 PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailslwdate : NULL, 1431 pds ? sizeof(BOOL) : 0); 1434 PrfWriteProfileData(fmprof, appname, s, &pds->detailslwdate, sizeof(BOOL)); 1432 1435 strcpy(eos, "DetailsLWTime"); 1433 PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailslwtime : NULL, 1434 pds ? sizeof(BOOL) : 0); 1436 PrfWriteProfileData(fmprof, appname, s, &pds->detailslwtime, sizeof(BOOL)); 1435 1437 strcpy(eos, "DetailsLADate"); 1436 PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailsladate : NULL, 1437 pds ? sizeof(BOOL) : 0); 1438 PrfWriteProfileData(fmprof, appname, s, &pds->detailsladate, sizeof(BOOL)); 1438 1439 strcpy(eos, "DetailsLATime"); 1439 PrfWriteProfileData(fmprof, appname, s, pds ? &pds->detailslatime : NULL, 1440 pds ? sizeof(BOOL) : 0); 1440 PrfWriteProfileData(fmprof, appname, s, &pds->detailslatime, sizeof(BOOL)); 1441 if (!state) { 1442 strcpy(eos, "SubjectInLeftPane"); 1443 PrfWriteProfileData(fmprof, appname, s, &pds->fSubjectInLeftPane, sizeof(BOOL)); 1444 strcpy(eos, "SubjectLengthMax"); 1445 PrfWriteProfileData(fmprof, appname, s, &pds->fSubjectLengthMax, sizeof(BOOL)); 1446 strcpy(eos, "SubjectDisplayWidth"); 1447 PrfWriteProfileData(fmprof, appname, s, &pds->SubjectDisplayWidth, sizeof(ULONG)); 1448 } 1449 } 1450 1451 /** 1452 * Removes the ini entries when a state is deleted 1453 * statename should be NULL for the shutdown state 1454 * (avoids removing global state settings like toolbar) 1455 * keyroot shouldn't pass the trailing dot 1456 */ 1457 VOID RemoveCnrSwitches(PCSZ keyroot, PCSZ statename) 1458 { 1459 CHAR s[CCHMAXPATH], *eos = s; 1460 1461 strcpy(s, keyroot); 1462 strcat(s, "."); 1463 eos = &s[strlen(s)]; 1464 DeletePresParams(s); 1465 strcpy(eos, "DetailsLongname"); 1466 PrfWriteProfileData(fmprof, appname, s, NULL, 0); 1467 strcpy(eos, "DetailsSubject"); 1468 PrfWriteProfileData(fmprof, appname, s, NULL, 0); 1469 strcpy(eos, "DetailsEA"); 1470 PrfWriteProfileData(fmprof, appname, s, NULL, 0); 1471 strcpy(eos, "DetailsSize"); 1472 PrfWriteProfileData(fmprof, appname, s, NULL, 0); 1473 strcpy(eos, "DetailsIcon"); 1474 PrfWriteProfileData(fmprof, appname, s, NULL, 0); 1475 strcpy(eos, "DetailsAttr"); 1476 PrfWriteProfileData(fmprof, appname, s, NULL, 0); 1477 strcpy(eos, "DetailsCRDate"); 1478 PrfWriteProfileData(fmprof, appname, s, NULL, 0); 1479 strcpy(eos, "DetailsCRTime"); 1480 PrfWriteProfileData(fmprof, appname, s, NULL, 0); 1481 strcpy(eos, "DetailsLWDate"); 1482 PrfWriteProfileData(fmprof, appname, s, NULL, 0); 1483 strcpy(eos, "DetailsLWTime"); 1484 PrfWriteProfileData(fmprof, appname, s, NULL, 0); 1485 strcpy(eos, "DetailsLADate"); 1486 PrfWriteProfileData(fmprof, appname, s, NULL, 0); 1487 strcpy(eos, "DetailsLATime"); 1488 PrfWriteProfileData(fmprof, appname, s, NULL, 0); 1441 1489 strcpy(eos, "SubjectInLeftPane"); 1442 PrfWriteProfileData(fmprof, appname, s, pds ? &pds->fSubjectInLeftPane : NULL, 1443 pds ? sizeof(BOOL) : 0); 1490 PrfWriteProfileData(fmprof, appname, s, NULL, 0); 1444 1491 strcpy(eos, "SubjectLengthMax"); 1445 PrfWriteProfileData(fmprof, appname, s, pds ? &pds->fSubjectLengthMax : NULL, 1446 pds ? sizeof(BOOL) : 0); 1492 PrfWriteProfileData(fmprof, appname, s, NULL, 0); 1447 1493 strcpy(eos, "SubjectDisplayWidth"); 1448 PrfWriteProfileData(fmprof, appname, s, pds ? &pds->SubjectDisplayWidth : NULL, 1449 pds ? sizeof(ULONG) : 0); 1450 } 1451 1494 PrfWriteProfileData(fmprof, appname, s, NULL, 0); 1495 strcpy(eos, "Pos");; 1496 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 1497 strcpy(eos, "Sort"); 1498 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 1499 strcpy(eos, "Filter"); 1500 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 1501 strcpy(eos, "View"); 1502 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 1503 strcpy(eos, "Dir"); 1504 PrfWriteProfileString(fmprof, FM3Str, s, NULL); 1505 if (statename && strstr(s, ".0.")) { 1506 strcpy(s, statename); 1507 strcat(s, "."); 1508 eos = &s[strlen(s)]; 1509 strcpy(eos, "LastTreePos"); 1510 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 1511 strcpy(eos, "MySizeLastTime"); 1512 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 1513 strcpy(eos, "Toolbar"); 1514 PrfWriteProfileString(fmprof, FM3Str, s, NULL); 1515 strcpy(eos, "TargetDir"); 1516 PrfWriteProfileString(fmprof, FM3Str, s, NULL); 1517 } 1518 1519 } 1452 1520 1453 1521 HWND FindDirCnr(HWND hwndParent) -
trunk/dll/misc.h
r1400 r1409 52 52 VOID HeapThread(VOID * dummy); 53 53 BOOL IsFm2Window(HWND hwnd, BOOL chkTid); 54 VOID LoadDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS *pds); 55 VOID WriteDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS *pds); 54 VOID LoadDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS *pds, BOOL state); 55 VOID WriteDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS *pds, BOOL state); 56 VOID RemoveCnrSwitches(PCSZ keyroot, PCSZ statename); 56 57 VOID LoadLibPath(PSZ str, LONG len); 57 58 VOID OpenEdit(HWND hwnd); -
trunk/dll/notebook.c
r1402 r1409 2367 2367 dsDirCnrDefault.SubjectDisplayWidth = 0; 2368 2368 } 2369 WriteDetailsSwitches(PCSZ_DIRCNR, &dsDirCnrDefault );2369 WriteDetailsSwitches(PCSZ_DIRCNR, &dsDirCnrDefault, FALSE); 2370 2370 break; 2371 2371 } … … 2601 2601 2602 2602 memset(&ds, 0, sizeof(ds)); 2603 LoadDetailsSwitches(PCSZ_COLLECTOR, &ds );2603 LoadDetailsSwitches(PCSZ_COLLECTOR, &ds, FALSE); 2604 2604 WinCheckButton(hwnd, CFG5_SHOWLNAMES, ds.detailslongname); 2605 2605 WinCheckButton(hwnd, CFG5_SHOWSUBJECT, ds.detailssubject); … … 2721 2721 ds.SubjectDisplayWidth = 0; 2722 2722 } 2723 WriteDetailsSwitches(PCSZ_COLLECTOR, &ds );2723 WriteDetailsSwitches(PCSZ_COLLECTOR, &ds, FALSE); 2724 2724 } 2725 2725 break; … … 3527 3527 } 3528 3528 // Save new details settings and refresh windows 3529 WriteDetailsSwitches(PCSZ_DIRCNR, &dsDirCnrDefault );3529 WriteDetailsSwitches(PCSZ_DIRCNR, &dsDirCnrDefault, FALSE); 3530 3530 if (hwndMain) { 3531 3531 // Save state and restore to refresh windows with new settings -
trunk/dll/presparm.c
r1402 r1409 14 14 10 Dec 07 GKY Updated CopyPresParams to copy all parameter types 15 15 08 Mar 09 GKY Additional strings move to PCSZs in init.c 16 19 Mar 09 GKY Moved DeletePresParams from mainwnd.c 16 17 17 18 ***********************************************************************/ … … 523 524 } 524 525 526 VOID DeletePresParams(PCSZ Keyroot) 527 { 528 PSZ apszPPNames[] = 529 { 530 "Backgroundcolor", 531 "Foregroundcolor", 532 "Hilitebackgroundcolor", 533 "Hiliteforegroundcolor", 534 "Bordercolor", 535 "Fontnamesize" 536 }; 537 538 ULONG ulSize, ulArraySize = sizeof(apszPPNames) / sizeof(PSZ), x; 539 CHAR pchKeyroot[CCHMAXPATH]; 540 CHAR *eos; 541 542 strcpy(pchKeyroot, Keyroot); 543 eos = pchKeyroot + strlen(pchKeyroot); 544 545 for (x = 0; x < ulArraySize; x++) { 546 strcpy(eos, apszPPNames[x]); 547 if (PrfQueryProfileSize(fmprof, appname, pchKeyroot, &ulSize) && ulSize) { 548 PrfWriteProfileData(fmprof, appname, pchKeyroot, NULL, ulSize); 549 } 550 } 551 } 552 525 553 #pragma alloc_text(PRESPARAM,CopyPresParams,SetPresParams) 526 554 #pragma alloc_text(PRESPARAM,PresParamChanged,RestorePresParams,SavePresParams) -
trunk/dll/presparm.h
r1400 r1409 11 11 Change log 12 12 08 Mar 09 GKY Additional strings move to PCSZs in init.c (Delcare changes to PCSZ) 13 19 Mar 09 GKY Moved DeletePresParams from mainwnd.c 13 14 14 15 ***********************************************************************/ … … 21 22 VOID RestorePresParams(HWND hwnd, PCSZ keyroot); 22 23 VOID SavePresParams(HWND hwnd, PCSZ keyroot); 24 VOID DeletePresParams(PCSZ Keyroot); 23 25 #ifdef INCL_GPI 24 26 VOID SetPresParams(HWND hwnd, RGB2 * back, RGB2 * fore, RGB2 * border, 25 27 PCSZ font); 26 28 #endif 27 29
Note:
See TracChangeset
for help on using the changeset viewer.