mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Got rid of the "Not a meter or measure" error.
The handling of the MeterStyle is now done in the CConfigParser.
This commit is contained in:
parent
4274397806
commit
8eccc8ddec
@ -149,7 +149,15 @@ const std::wstring& CConfigParser::ReadString(LPCTSTR section, LPCTSTR key, LPCT
|
|||||||
defValue = L"";
|
defValue = L"";
|
||||||
}
|
}
|
||||||
|
|
||||||
result = GetValue(section, key, defValue);
|
std::wstring strDefault = defValue;
|
||||||
|
|
||||||
|
// If the template is defined read the value first from there.
|
||||||
|
if (!m_StyleTemplate.empty())
|
||||||
|
{
|
||||||
|
strDefault = GetValue(m_StyleTemplate, key, strDefault);
|
||||||
|
}
|
||||||
|
|
||||||
|
result = GetValue(section, key, strDefault);
|
||||||
if (result == defValue)
|
if (result == defValue)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
|
@ -39,6 +39,7 @@ public:
|
|||||||
void Initialize(LPCTSTR filename, CRainmeter* pRainmeter);
|
void Initialize(LPCTSTR filename, CRainmeter* pRainmeter);
|
||||||
void AddMeasure(CMeasure* pMeasure);
|
void AddMeasure(CMeasure* pMeasure);
|
||||||
void SetVariable(const std::wstring& strVariable, const std::wstring& strValue);
|
void SetVariable(const std::wstring& strVariable, const std::wstring& strValue);
|
||||||
|
void SetStyleTemplate(const std::wstring& strStyle) { m_StyleTemplate = strStyle; }
|
||||||
|
|
||||||
const std::wstring& ReadString(LPCTSTR section, LPCTSTR key, LPCTSTR defValue, bool bReplaceMeasures = true);
|
const std::wstring& ReadString(LPCTSTR section, LPCTSTR key, LPCTSTR defValue, bool bReplaceMeasures = true);
|
||||||
double ReadFloat(LPCTSTR section, LPCTSTR key, double defValue);
|
double ReadFloat(LPCTSTR section, LPCTSTR key, double defValue);
|
||||||
@ -66,6 +67,8 @@ private:
|
|||||||
hqMathParser* m_Parser;
|
hqMathParser* m_Parser;
|
||||||
std::map<std::wstring, CMeasure*> m_Measures;
|
std::map<std::wstring, CMeasure*> m_Measures;
|
||||||
|
|
||||||
|
std::wstring m_StyleTemplate;
|
||||||
|
|
||||||
stdext::hash_map<std::wstring, std::vector<std::wstring> > m_Keys;
|
stdext::hash_map<std::wstring, std::vector<std::wstring> > m_Keys;
|
||||||
stdext::hash_map<std::wstring, std::wstring> m_Values;
|
stdext::hash_map<std::wstring, std::wstring> m_Values;
|
||||||
};
|
};
|
||||||
|
@ -44,7 +44,6 @@ private:
|
|||||||
int m_UpdateRandom;
|
int m_UpdateRandom;
|
||||||
int m_LowBound;
|
int m_LowBound;
|
||||||
int m_HighBound;
|
int m_HighBound;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -212,6 +212,10 @@ void CMeter::ReadConfig(const WCHAR* section)
|
|||||||
{
|
{
|
||||||
CConfigParser& parser = m_MeterWindow->GetParser();
|
CConfigParser& parser = m_MeterWindow->GetParser();
|
||||||
|
|
||||||
|
// The MeterStyle defines a template where the values are read if the meter doesn't have it itself
|
||||||
|
const std::wstring& style = parser.ReadString(section, L"MeterStyle", L"");
|
||||||
|
parser.SetStyleTemplate(style);
|
||||||
|
|
||||||
const std::wstring& x = parser.ReadString(section, L"X", L"0");
|
const std::wstring& x = parser.ReadString(section, L"X", L"0");
|
||||||
if (x.size() > 0)
|
if (x.size() > 0)
|
||||||
{
|
{
|
||||||
|
@ -1564,11 +1564,7 @@ void CMeterWindow::ReadSkin()
|
|||||||
MessageBox(m_Window, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
MessageBox(m_Window, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
// If it's not a meter or measure it will be ignored
|
||||||
{
|
|
||||||
// It's something else
|
|
||||||
throw CError(std::wstring(L"Section [") + pos + L"] is not a meter or a measure!", __LINE__, __FILE__);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
pos = pos + wcslen(pos) + 1;
|
pos = pos + wcslen(pos) + 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user