mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Error messages now display meter/measure in question.
This commit is contained in:
parent
77ac096f2c
commit
11588043de
@ -679,8 +679,8 @@ CMeasure* CMeasure::Create(const WCHAR* measure, CMeterWindow* meterWindow)
|
|||||||
return new CMeasureCalc(meterWindow);
|
return new CMeasureCalc(meterWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error
|
// Error
|
||||||
throw CError(std::wstring(L"No such measure: ") + measure, __LINE__, __FILE__);
|
throw CError(std::wstring(L"Measure=") + measure + L" is not valid.", __LINE__, __FILE__);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -53,58 +53,58 @@ CMeasureRegistry::~CMeasureRegistry()
|
|||||||
*/
|
*/
|
||||||
bool CMeasureRegistry::Update()
|
bool CMeasureRegistry::Update()
|
||||||
{
|
{
|
||||||
if (!CMeasure::PreUpdate()) return false;
|
if (!CMeasure::PreUpdate()) return false;
|
||||||
|
|
||||||
if(m_RegKey != NULL)
|
if(m_RegKey != NULL)
|
||||||
{
|
{
|
||||||
DWORD size = 4096;
|
DWORD size = 4096;
|
||||||
WCHAR data[4096];
|
WCHAR data[4096];
|
||||||
DWORD type = 0;
|
DWORD type = 0;
|
||||||
|
|
||||||
if(RegQueryValueEx(m_RegKey,
|
if(RegQueryValueEx(m_RegKey,
|
||||||
m_RegValueName.c_str(),
|
m_RegValueName.c_str(),
|
||||||
NULL,
|
NULL,
|
||||||
(LPDWORD)&type,
|
(LPDWORD)&type,
|
||||||
(LPBYTE)&data,
|
(LPBYTE)&data,
|
||||||
(LPDWORD)&size) == ERROR_SUCCESS)
|
(LPDWORD)&size) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
case REG_DWORD:
|
case REG_DWORD:
|
||||||
m_Value = *((LPDWORD)&data);
|
m_Value = *((LPDWORD)&data);
|
||||||
m_StringValue.erase();
|
m_StringValue.erase();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REG_SZ:
|
case REG_SZ:
|
||||||
case REG_EXPAND_SZ:
|
case REG_EXPAND_SZ:
|
||||||
case REG_MULTI_SZ:
|
case REG_MULTI_SZ:
|
||||||
m_Value = 0.0;
|
m_Value = 0.0;
|
||||||
m_StringValue = data;
|
m_StringValue = data;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REG_QWORD:
|
case REG_QWORD:
|
||||||
m_Value = (double)((LARGE_INTEGER*)&data)->QuadPart;
|
m_Value = (double)((LARGE_INTEGER*)&data)->QuadPart;
|
||||||
m_StringValue.erase();
|
m_StringValue.erase();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: // Other types are not supported
|
default: // Other types are not supported
|
||||||
m_Value = 0.0;
|
m_Value = 0.0;
|
||||||
m_StringValue.erase();
|
m_StringValue.erase();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Value = 0.0;
|
m_Value = 0.0;
|
||||||
m_StringValue.erase();
|
m_StringValue.erase();
|
||||||
RegOpenKeyEx(m_HKey, m_RegKeyName.c_str(), 0, KEY_READ, &m_RegKey);
|
RegOpenKeyEx(m_HKey, m_RegKeyName.c_str(), 0, KEY_READ, &m_RegKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RegOpenKeyEx(m_HKey, m_RegKeyName.c_str(), 0, KEY_READ, &m_RegKey);
|
RegOpenKeyEx(m_HKey, m_RegKeyName.c_str(), 0, KEY_READ, &m_RegKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
return PostUpdate();
|
return PostUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -150,7 +150,7 @@ void CMeasureRegistry::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw CError(std::wstring(L"No such HKEY: ") + keyname, __LINE__, __FILE__);
|
throw CError(std::wstring(L"HKEY=") + keyname + L" is not valid in measure [" + section + L"].", __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_RegKeyName = parser.ReadString(section, L"RegKey", L"");
|
m_RegKeyName = parser.ReadString(section, L"RegKey", L"");
|
||||||
@ -164,7 +164,7 @@ void CMeasureRegistry::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
|
|
||||||
// Try to open the key
|
// Try to open the key
|
||||||
if(m_RegKey) RegCloseKey(m_RegKey);
|
if(m_RegKey) RegCloseKey(m_RegKey);
|
||||||
RegOpenKeyEx(m_HKey, m_RegKeyName.c_str(), 0, KEY_READ, &m_RegKey);
|
RegOpenKeyEx(m_HKey, m_RegKeyName.c_str(), 0, KEY_READ, &m_RegKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -176,7 +176,7 @@ void CMeasureRegistry::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
*/
|
*/
|
||||||
const WCHAR* CMeasureRegistry::GetStringValue(bool autoScale, double scale, int decimals, bool percentual)
|
const WCHAR* CMeasureRegistry::GetStringValue(bool autoScale, double scale, int decimals, bool percentual)
|
||||||
{
|
{
|
||||||
if (m_StringValue.empty())
|
if (m_StringValue.empty())
|
||||||
{
|
{
|
||||||
return CMeasure::GetStringValue(autoScale, scale, decimals, percentual);
|
return CMeasure::GetStringValue(autoScale, scale, decimals, percentual);
|
||||||
}
|
}
|
||||||
|
@ -59,10 +59,10 @@ int GetYearDay(int year, int month, int day)
|
|||||||
CMeasureTime::CMeasureTime(CMeterWindow* meterWindow) : CMeasure(meterWindow)
|
CMeasureTime::CMeasureTime(CMeterWindow* meterWindow) : CMeasure(meterWindow)
|
||||||
{
|
{
|
||||||
/* Set time zone from TZ environment variable. If TZ is not set,
|
/* Set time zone from TZ environment variable. If TZ is not set,
|
||||||
* the operating system is queried to obtain the default value
|
* the operating system is queried to obtain the default value
|
||||||
* for the variable.
|
* for the variable.
|
||||||
*/
|
*/
|
||||||
_tzset();
|
tzset();
|
||||||
|
|
||||||
m_DeltaTime.QuadPart = 0;
|
m_DeltaTime.QuadPart = 0;
|
||||||
m_Time.QuadPart = 0;
|
m_Time.QuadPart = 0;
|
||||||
|
@ -406,7 +406,7 @@ void CMeter::BindMeasure(std::list<CMeasure*>& measures)
|
|||||||
// The meter is not bound to anything
|
// The meter is not bound to anything
|
||||||
if (m_MeasureName.empty())
|
if (m_MeasureName.empty())
|
||||||
{
|
{
|
||||||
throw CError(std::wstring(L"The meter [") + m_Name + L"] is not bound to anything!", __LINE__, __FILE__);
|
throw CError(std::wstring(L"The meter [") + m_Name + L"] is not bound to anything!", __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Go through the list and check it there is a measure for us
|
// Go through the list and check it there is a measure for us
|
||||||
@ -420,8 +420,8 @@ void CMeter::BindMeasure(std::list<CMeasure*>& measures)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error :)
|
// Error :)
|
||||||
throw CError(std::wstring(L"The meter [") + m_Name + L"] cannot be bound with [" + m_MeasureName + L"]!", __LINE__, __FILE__);
|
throw CError(std::wstring(L"The meter [") + m_Name + L"] cannot be bound with [" + m_MeasureName + L"]!", __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -470,8 +470,8 @@ CMeter* CMeter::Create(const WCHAR* meter, CMeterWindow* meterWindow)
|
|||||||
return new CMeterButton(meterWindow);
|
return new CMeterButton(meterWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error
|
// Error
|
||||||
throw CError(std::wstring(L"No such meter: ") + meter, __LINE__, __FILE__);
|
throw CError(std::wstring(L"Meter=") + meter + L" is not valid.", __LINE__, __FILE__);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ void CMeterBar::ReadConfig(const WCHAR* section)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw CError(std::wstring(L"No such BarOrientation: ") + orientation, __LINE__, __FILE__);
|
throw CError(std::wstring(L"BarOrientation=") + orientation + L" is not valid in meter [" + m_Name + L"].", __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Initialized)
|
if (m_Initialized)
|
||||||
|
@ -214,7 +214,7 @@ void CMeterBitmap::ReadConfig(const WCHAR* section)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw CError(std::wstring(L"No such BitmapAlign: ") + align, __LINE__, __FILE__);
|
throw CError(std::wstring(L"BitmapAlign=") + align + L" is not valid in meter [" + m_Name + L"].", __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Initialized)
|
if (m_Initialized)
|
||||||
|
@ -541,7 +541,7 @@ void CMeterImage::ReadConfig(const WCHAR* section)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw CError(std::wstring(L"No such ImageFlip: ") + flip, __LINE__, __FILE__);
|
throw CError(std::wstring(L"ImageFlip=") + flip + L" is not valid in meter [" + m_Name + L"].", __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Rotate = (REAL)parser.ReadFloat(section, L"ImageRotate", 0.0);
|
m_Rotate = (REAL)parser.ReadFloat(section, L"ImageRotate", 0.0);
|
||||||
|
@ -201,7 +201,7 @@ void CMeterString::Initialize()
|
|||||||
|
|
||||||
if (m_FontSize != 0)
|
if (m_FontSize != 0)
|
||||||
{
|
{
|
||||||
throw CError(std::wstring(L"Unable to create font: ") + m_FontFace, __LINE__, __FILE__);
|
throw CError(std::wstring(L"Unable to create font: ") + m_FontFace, __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -301,7 +301,7 @@ void CMeterString::ReadConfig(const WCHAR* section)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw CError(std::wstring(L"No such StringAlign: ") + align, __LINE__, __FILE__);
|
throw CError(std::wstring(L"StringAlign=") + align + L" is not valid in meter [" + m_Name + L"].", __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring stringCase;
|
std::wstring stringCase;
|
||||||
@ -323,8 +323,10 @@ void CMeterString::ReadConfig(const WCHAR* section)
|
|||||||
{
|
{
|
||||||
m_textCase = TEXTCASE_PROPER;
|
m_textCase = TEXTCASE_PROPER;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw CError(std::wstring(L"StringCase=") + stringCase + L" is not valid in meter [" + m_Name + L"].", __LINE__, __FILE__);
|
||||||
|
}
|
||||||
|
|
||||||
std::wstring style;
|
std::wstring style;
|
||||||
style = parser.ReadString(section, L"StringStyle", L"NORMAL");
|
style = parser.ReadString(section, L"StringStyle", L"NORMAL");
|
||||||
@ -347,7 +349,7 @@ void CMeterString::ReadConfig(const WCHAR* section)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw CError(std::wstring(L"No such StringStyle: ") + style, __LINE__, __FILE__);
|
throw CError(std::wstring(L"StringStyle=") + style + L" is not valid in meter [" + m_Name + L"].", __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring effect;
|
std::wstring effect;
|
||||||
@ -367,7 +369,7 @@ void CMeterString::ReadConfig(const WCHAR* section)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw CError(std::wstring(L"No such StringEffect: ") + effect, __LINE__, __FILE__);
|
throw CError(std::wstring(L"StringEffect=") + effect + L" is not valid in meter [" + m_Name + L"].", __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-1 != (int)parser.ReadFormula(section, L"W", -1) && -1 != (int)parser.ReadFormula(section, L"H", -1))
|
if (-1 != (int)parser.ReadFormula(section, L"W", -1) && -1 != (int)parser.ReadFormula(section, L"H", -1))
|
||||||
@ -613,7 +615,7 @@ void CMeterString::BindMeasure(std::list<CMeasure*>& measures)
|
|||||||
|
|
||||||
if (i == measures.end())
|
if (i == measures.end())
|
||||||
{
|
{
|
||||||
throw CError(std::wstring(L"The meter [") + m_Name + L"] cannot be bound with [" + (*j) + L"]!", __LINE__, __FILE__);
|
throw CError(std::wstring(L"The meter [") + m_Name + L"] cannot be bound with [" + (*j) + L"]!", __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CMeter::SetAllMeasures(m_Measures);
|
CMeter::SetAllMeasures(m_Measures);
|
||||||
|
@ -100,8 +100,9 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring error = L"No such RecycleType: ";
|
std::wstring error = L"RecycleType=";
|
||||||
error += type;
|
error += type;
|
||||||
|
error += L" is not valid in measure [" + section + L"].";
|
||||||
MessageBox(NULL, error.c_str(), L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
MessageBox(NULL, error.c_str(), L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,8 +113,9 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring error = L"No such GDICountType: ";
|
std::wstring error = L"GDICountType=";
|
||||||
error += type;
|
error += type;
|
||||||
|
error += L" is not valid in measure [" + section + L"].";
|
||||||
MessageBox(NULL, error.c_str(), L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
MessageBox(NULL, error.c_str(), L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,8 +111,9 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring error = L"No such SpeedFanScale: ";
|
std::wstring error = L"SpeedFanScale=";
|
||||||
error += scale;
|
error += scale;
|
||||||
|
error += L" is not valid in measure [" + section + L"]." ;
|
||||||
MessageBox(NULL, error.c_str(), L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
MessageBox(NULL, error.c_str(), L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,8 +128,9 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring error = L"No such SpeedFanType: ";
|
std::wstring error = L"SpeedFanType=";
|
||||||
error += type;
|
error += type;
|
||||||
|
error += L" is not valid in measure [" + section + L"]." ;
|
||||||
MessageBox(NULL, error.c_str(), L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
MessageBox(NULL, error.c_str(), L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,8 +207,9 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring error = L"No such SysInfoType: ";
|
std::wstring error = L"SysInfoType=";
|
||||||
error += type;
|
error += type;
|
||||||
|
error += L" is not valid in measure [" + section + L"]." ;
|
||||||
MessageBox(NULL, error.c_str(), L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
MessageBox(NULL, error.c_str(), L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user