mirror of
https://github.com/Open-Shell/Open-Shell-Menu.git
synced 2026-06-14 03:16:38 +10:00
Auto-detect when setting is back to default value
Intercepts *most* instances of FLAG_DEFAULT getting set, including when XML files are loaded and when Open-Shell starts, adding if-statements to those spots to check if a new value is actually different from the setting's default value. Ensures more consistency behind the scenes and gets rid of inaccurate bold highlights.
This commit is contained in:
committed by
Ibuprophen
parent
0cb43dd17c
commit
998d83c15c
+16
-4
@@ -793,7 +793,10 @@ CString CSettingsManager::LoadSettingsXml( const wchar_t *fname )
|
||||
}
|
||||
string.push_back(0);
|
||||
pSetting->value=CComVariant(&string[0]);
|
||||
pSetting->flags&=~CSetting::FLAG_DEFAULT;
|
||||
if (pSetting->value==pSetting->defValue)
|
||||
pSetting->flags|=CSetting::FLAG_DEFAULT;
|
||||
else
|
||||
pSetting->flags&=~CSetting::FLAG_DEFAULT;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -806,7 +809,10 @@ CString CSettingsManager::LoadSettingsXml( const wchar_t *fname )
|
||||
if (pSetting->type>=CSetting::TYPE_STRING)
|
||||
{
|
||||
pSetting->value=value;
|
||||
pSetting->flags&=~CSetting::FLAG_DEFAULT;
|
||||
if (pSetting->value==pSetting->defValue)
|
||||
pSetting->flags|=CSetting::FLAG_DEFAULT;
|
||||
else
|
||||
pSetting->flags&=~CSetting::FLAG_DEFAULT;
|
||||
}
|
||||
else if (pSetting->type==CSetting::TYPE_BOOL || (pSetting->type==CSetting::TYPE_INT && pSetting[1].type!=CSetting::TYPE_RADIO) || pSetting->type==CSetting::TYPE_HOTKEY || pSetting->type==CSetting::TYPE_HOTKEY_ANY || pSetting->type==CSetting::TYPE_COLOR)
|
||||
{
|
||||
@@ -815,7 +821,10 @@ CString CSettingsManager::LoadSettingsXml( const wchar_t *fname )
|
||||
pSetting->value=CComVariant(val?1:0);
|
||||
else
|
||||
pSetting->value=CComVariant(val);
|
||||
pSetting->flags&=~CSetting::FLAG_DEFAULT;
|
||||
if (pSetting->value==pSetting->defValue)
|
||||
pSetting->flags|=CSetting::FLAG_DEFAULT;
|
||||
else
|
||||
pSetting->flags&=~CSetting::FLAG_DEFAULT;
|
||||
}
|
||||
else if (pSetting->type==CSetting::TYPE_INT && pSetting[1].type==CSetting::TYPE_RADIO)
|
||||
{
|
||||
@@ -825,7 +834,10 @@ CString CSettingsManager::LoadSettingsXml( const wchar_t *fname )
|
||||
if (_wcsicmp(pRadio->name,value.bstrVal)==0)
|
||||
{
|
||||
pSetting->value=CComVariant(val);
|
||||
pSetting->flags&=~CSetting::FLAG_DEFAULT;
|
||||
if (pSetting->value==pSetting->defValue)
|
||||
pSetting->flags|=CSetting::FLAG_DEFAULT;
|
||||
else
|
||||
pSetting->flags&=~CSetting::FLAG_DEFAULT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user