- Added some info to error message from MathParser.

- Cosmetic changes.
This commit is contained in:
spx 2011-08-29 21:57:36 +00:00
parent a1f0c4fd19
commit 614eef6c3b
3 changed files with 23 additions and 10 deletions

View File

@ -759,7 +759,14 @@ double CConfigParser::ReadFormula(LPCTSTR section, LPCTSTR key, double defValue)
char* errMsg = MathParser_Parse(m_Parser, ConvertToAscii(result.substr(1, result.size() - 2).c_str()).c_str(), &resultValue);
if (errMsg != NULL)
{
Log(LOG_ERROR, ConvertToWide(errMsg).c_str());
std::wstring error = L"ReadFormula: ";
error += ConvertToWide(errMsg);
error += L" in key \"";
error += key ? key : L"";
error += L"\" in section [";
error += section ? section : L"";
error += L"].";
Log(LOG_ERROR, error.c_str());
}
return resultValue;
@ -778,7 +785,11 @@ bool CConfigParser::ReadFormula(const std::wstring& result, double* resultValue)
char* errMsg = MathParser_Parse(m_Parser, ConvertToAscii(result.substr(1, result.size() - 2).c_str()).c_str(), resultValue);
if (errMsg != NULL)
{
Log(LOG_ERROR, ConvertToWide(errMsg).c_str());
std::wstring error = L"ReadFormula: ";
error += ConvertToWide(errMsg);
error += L": ";
error += result;
Log(LOG_ERROR, error.c_str());
return false;
}

View File

@ -82,7 +82,12 @@ bool CMeasureCalc::Update()
char* errMsg = MathParser_Parse(m_Parser, ConvertToAscii(m_Formula.c_str()).c_str(), &m_Value);
if (errMsg != NULL)
{
Log(LOG_ERROR, ConvertToWide(errMsg).c_str());
std::wstring error = L"Calc: ";
error += ConvertToWide(errMsg);
error += L" in measure [";
error += m_Name;
error += L"].";
Log(LOG_ERROR, error.c_str());
}
return PostUpdate();

View File

@ -3781,7 +3781,7 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow)
{
if (!m_ConfigMenu.empty())
{
DeleteMenu(configMenu, 0, MF_BYPOSITION);
DeleteMenu(configMenu, 0, MF_BYPOSITION); // "No skins available" menuitem
CreateConfigMenu(configMenu, m_ConfigMenu);
}
@ -3796,7 +3796,7 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow)
{
if (!m_Themes.empty())
{
DeleteMenu(themeMenu, 0, MF_BYPOSITION);
DeleteMenu(themeMenu, 0, MF_BYPOSITION); // "No themes available" menuitem
CreateThemeMenu(themeMenu);
}
}
@ -3925,15 +3925,12 @@ HMENU CRainmeter::CreateConfigMenu(HMENU configMenu, std::vector<CONFIGMENU>& co
}
void CRainmeter::CreateThemeMenu(HMENU themeMenu)
{
if (!m_Themes.empty())
{
for (size_t i = 0, isize = m_Themes.size(); i < isize; ++i)
{
InsertMenu(themeMenu, i, MF_BYPOSITION, ID_THEME_FIRST + i, m_Themes[i].c_str());
}
}
}
HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU configMenu)
{