Merge pull request #3541 from RaiKoHoff/Dev_DM_STD

Config version dependent "FileWatchingMode" settings value
This commit is contained in:
Pairi Daiza 2021-08-04 20:47:25 +02:00 committed by GitHub
commit 4ebc02e5a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 2 deletions

View File

@ -1554,9 +1554,16 @@ void LoadSettings()
Defaults.PrintMargin.bottom = _margin;
Settings.PrintMargin.bottom = clampi(IniSectionGetInt(IniSecSettings, L"PrintMarginBottom", Defaults.PrintMargin.bottom), 0, 40000);
if (Globals.iCfgVersionRead < CFG_VER_0005) {
int const fwm_mode = IniSectionGetInt(IniSecSettings, L"FileWatchingMode", -1);
if (fwm_mode > (int)FWM_DONT_CARE) {
IniSectionSetInt(IniSecSettings, L"FileWatchingMode", fwm_mode + 1);
}
}
GET_CAST_INT_VALUE_FROM_INISECTION(FILE_WATCHING_MODE, FileWatchingMode, FWM_MSGBOX, FWM_DONT_CARE, FWM_EXCLUSIVELOCK);
GET_BOOL_VALUE_FROM_INISECTION(SaveBeforeRunningTools, false);
GET_BOOL_VALUE_FROM_INISECTION(EvalTinyExprOnSelection, true);
GET_CAST_INT_VALUE_FROM_INISECTION(FILE_WATCHING_MODE, FileWatchingMode, FWM_MSGBOX, FWM_DONT_CARE, FWM_EXCLUSIVELOCK);
GET_BOOL_VALUE_FROM_INISECTION(ResetFileWatching, true);
GET_INT_VALUE_FROM_INISECTION(EscFunction, 0, 0, 2);
GET_BOOL_VALUE_FROM_INISECTION(AlwaysOnTop, false);

View File

@ -766,6 +766,19 @@ static void _DefaultsToTmpCache() {
StringCchCat(wchDefaultStyle, COUNTOF(wchDefaultStyle), wchColor);
}
TmpCacheSetString(Lexer_Section, pszDfltName, wchDefaultStyle);
// in case of "pStdDarkModeIniStyles" is incomplete (new Lexer, etc.)
unsigned i = 1;
while (g_pLexArray[iLexer]->Styles[i].iStyle != -1) {
LPCWSTR const pszKeyName = g_pLexArray[iLexer]->Styles[i].pszName;
LPCWSTR const pszDefault = g_pLexArray[iLexer]->Styles[i].pszDefault;
wchDefaultStyle[0] = L'\0'; // empty
TmpCacheGetString(Lexer_Section, pszKeyName, L"", wchDefaultStyle, COUNTOF(wchDefaultStyle));
if (StrIsEmpty(wchDefaultStyle) && StrIsNotEmpty(pszDefault)) {
TmpCacheSetString(Lexer_Section, pszKeyName, pszDefault);
}
++i;
}
}
} else {

View File

@ -124,8 +124,9 @@ typedef enum
CFG_VER_0002 = 2, /// LongLine Marker Off by default
CFG_VER_0003 = 3, /// SimpleIni UTF-8 BOM
CFG_VER_0004 = 4, /// Text Files lexer vs. Default Text => (2nd) Common Style
CFG_VER_0005 = 5, /// FileWatchingMode numbering changed
CFG_VER_CURRENT = CFG_VER_0004
CFG_VER_CURRENT = CFG_VER_0005
} CFG_VERSION;