mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
- Added #CURRENTFILE# variable
- Changes to log strings
This commit is contained in:
parent
3518dbf07e
commit
f14d751604
@ -104,6 +104,7 @@ void CConfigParser::SetBuiltInVariables(CRainmeter* pRainmeter, CMeterWindow* me
|
|||||||
}
|
}
|
||||||
if (meterWindow)
|
if (meterWindow)
|
||||||
{
|
{
|
||||||
|
SetBuiltInVariable(L"CURRENTFILE", meterWindow->GetSkinIniFile());
|
||||||
SetBuiltInVariable(L"CURRENTCONFIG", meterWindow->GetSkinName());
|
SetBuiltInVariable(L"CURRENTCONFIG", meterWindow->GetSkinName());
|
||||||
SetBuiltInVariable(L"ROOTCONFIGPATH", meterWindow->GetSkinRootPath());
|
SetBuiltInVariable(L"ROOTCONFIGPATH", meterWindow->GetSkinRootPath());
|
||||||
}
|
}
|
||||||
@ -1032,14 +1033,14 @@ void CConfigParser::ReadIniFile(const std::vector<std::wstring>& iniFileMappings
|
|||||||
{
|
{
|
||||||
if (depth > 100) // Is 100 enough to assume the include loop never ends?
|
if (depth > 100) // Is 100 enough to assume the include loop never ends?
|
||||||
{
|
{
|
||||||
MessageBox(NULL, L"It looks like you've made an infinite\nloop with the @include statements.\nPlease check your skin.", L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONERROR);
|
MessageBox(NULL, L"It seems that you have created an infinite loop with @include.\nPlease check your skin.", APPNAME, MB_OK | MB_TOPMOST | MB_ICONERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify whether the file exists
|
// Verify whether the file exists
|
||||||
if (_waccess(iniFile.c_str(), 0) == -1)
|
if (_waccess(iniFile.c_str(), 0) == -1)
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_WARNING, L"Unable to read file: %s", iniFile.c_str());
|
LogWithArgs(LOG_ERROR, L"Unable to read file: %s", iniFile.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -708,7 +708,7 @@ void LogWithArgs(int nLevel, const WCHAR* format, ... )
|
|||||||
if (errno != 0)
|
if (errno != 0)
|
||||||
{
|
{
|
||||||
nLevel = LOG_ERROR;
|
nLevel = LOG_ERROR;
|
||||||
_snwprintf_s(buffer, 4096, _TRUNCATE, L"LogWithArgs() internal error: %s", format);
|
_snwprintf_s(buffer, 4096, _TRUNCATE, L"LogWithArgs internal error: %s", format);
|
||||||
}
|
}
|
||||||
|
|
||||||
_set_invalid_parameter_handler(oldHandler);
|
_set_invalid_parameter_handler(oldHandler);
|
||||||
|
@ -182,7 +182,7 @@ void CMeasure::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
}
|
}
|
||||||
if (!ParseSubstitute(subs))
|
if (!ParseSubstitute(subs))
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_WARNING, L"Incorrect substitute string: %s", subs.c_str());
|
LogWithArgs(LOG_ERROR, L"Measure: Invalid Substitute=%s", subs.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::wstring& group = parser.ReadString(section, L"Group", L"");
|
const std::wstring& group = parser.ReadString(section, L"Group", L"");
|
||||||
@ -851,5 +851,5 @@ CMeasure* CMeasure::Create(const WCHAR* measure, CMeterWindow* meterWindow, cons
|
|||||||
*/
|
*/
|
||||||
void CMeasure::ExecuteBang(const WCHAR* args)
|
void CMeasure::ExecuteBang(const WCHAR* args)
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_WARNING, L"[%s] doesn't support this bang: %s", m_Name.c_str(), args);
|
LogWithArgs(LOG_WARNING, L"!CommandMeasure: Not suppoted by [%s]", m_Name.c_str());
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ void CMeasureCPU::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
|
|
||||||
if (processor < 0 || processor > c_NumOfProcessors)
|
if (processor < 0 || processor > c_NumOfProcessors)
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_WARNING, L"[%s] Invalid Processor: %i", section, processor);
|
LogWithArgs(LOG_WARNING, L"CPU: Processor=%i invalid in [%s]", processor, section);
|
||||||
|
|
||||||
processor = 0;
|
processor = 0;
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ void CMeasureDiskSpace::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
m_Drive = parser.ReadString(section, L"Drive", L"C:\\");
|
m_Drive = parser.ReadString(section, L"Drive", L"C:\\");
|
||||||
if (m_Drive.empty())
|
if (m_Drive.empty())
|
||||||
{
|
{
|
||||||
Log(LOG_WARNING, L"Drive path is not given.");
|
Log(LOG_WARNING, L"FreeDiskSpace: Drive= empty");
|
||||||
m_Value = 0.0;
|
m_Value = 0.0;
|
||||||
m_MaxValue = 0.0;
|
m_MaxValue = 0.0;
|
||||||
m_OldTotalBytes = 0;
|
m_OldTotalBytes = 0;
|
||||||
|
@ -123,7 +123,7 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
{
|
{
|
||||||
if (CRainmeter::GetDebug())
|
if (CRainmeter::GetDebug())
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_ERROR, L"Plugin: Unable to load plugin: \"%s\", ErrorCode=%u", m_PluginName.c_str(), err);
|
LogWithArgs(LOG_ERROR, L"Plugin: Unable to load \"%s\" (%u)", m_PluginName.c_str(), err);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to load from Rainmeter's folder
|
// Try to load from Rainmeter's folder
|
||||||
@ -140,7 +140,7 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
{
|
{
|
||||||
if (CRainmeter::GetDebug())
|
if (CRainmeter::GetDebug())
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_ERROR, L"Plugin: Unable to load plugin: \"%s\", ErrorCode=%u", pluginName.c_str(), err);
|
LogWithArgs(LOG_ERROR, L"Plugin: Unable to load \"%s\" (%u)", pluginName.c_str(), err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
if (m_Plugin == NULL)
|
if (m_Plugin == NULL)
|
||||||
{
|
{
|
||||||
std::wstring error = L"Plugin: \"" + m_PluginName;
|
std::wstring error = L"Plugin: \"" + m_PluginName;
|
||||||
error += L"\" not found!";
|
error += L"\" not found";
|
||||||
throw CError(error, __LINE__, __FILE__);
|
throw CError(error, __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -228,6 +228,6 @@ void CMeasurePlugin::ExecuteBang(const WCHAR* args)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_WARNING, L"[%s] doesn't support bangs.", m_Name.c_str());
|
CMeasure::ExecuteBang(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -160,10 +160,7 @@ void CMeasureScript::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
|
|
||||||
if (m_HasGetStringFunction)
|
if (m_HasGetStringFunction)
|
||||||
{
|
{
|
||||||
std::wstring error = L"Script: GetStringValue() used in measure [";
|
LogWithArgs(LOG_WARNING, L"Script: Using deprecated GetStringValue() in [%s]", m_Name.c_str());
|
||||||
error += m_Name;
|
|
||||||
error += L"] has been deprecated. Check manual to ensure future compatibility.";
|
|
||||||
Log(LOG_WARNING, error.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_LuaScript->PushTable();
|
m_LuaScript->PushTable();
|
||||||
@ -215,11 +212,7 @@ void CMeasureScript::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring error = L"Script: ScriptFile= is not valid in measure [";
|
LogWithArgs(LOG_ERROR, L"Script: File not valid in [%s]", m_Name.c_str());
|
||||||
error += m_Name;
|
|
||||||
error += L"].";
|
|
||||||
Log(LOG_WARNING, error.c_str());
|
|
||||||
|
|
||||||
DeleteLuaScript();
|
DeleteLuaScript();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -236,30 +229,30 @@ void CMeasureScript::ExecuteBang(const WCHAR* args)
|
|||||||
m_LuaScript->RunString(str.c_str());
|
m_LuaScript->RunString(str.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stackDump(lua_State *L)
|
//static void stackDump(lua_State *L)
|
||||||
{
|
//{
|
||||||
LuaManager::LuaLog(LOG_DEBUG, " ---------------- Stack Dump ----------------" );
|
// LuaManager::LuaLog(LOG_DEBUG, " ---------------- Stack Dump ----------------" );
|
||||||
for (int i = lua_gettop(L); i > 0; --i)
|
// for (int i = lua_gettop(L); i > 0; --i)
|
||||||
{
|
// {
|
||||||
int t = lua_type(L, i);
|
// int t = lua_type(L, i);
|
||||||
switch (t)
|
// switch (t)
|
||||||
{
|
// {
|
||||||
case LUA_TSTRING:
|
// case LUA_TSTRING:
|
||||||
LuaManager::LuaLog(LOG_DEBUG, "%d:'%s'", i, lua_tostring(L, i));
|
// LuaManager::LuaLog(LOG_DEBUG, "%d:'%s'", i, lua_tostring(L, i));
|
||||||
break;
|
// break;
|
||||||
|
//
|
||||||
case LUA_TBOOLEAN:
|
// case LUA_TBOOLEAN:
|
||||||
LuaManager::LuaLog(LOG_DEBUG, "%d: %s", i, lua_toboolean(L, i) ? "true" : "false");
|
// LuaManager::LuaLog(LOG_DEBUG, "%d: %s", i, lua_toboolean(L, i) ? "true" : "false");
|
||||||
break;
|
// break;
|
||||||
|
//
|
||||||
case LUA_TNUMBER:
|
// case LUA_TNUMBER:
|
||||||
LuaManager::LuaLog(LOG_DEBUG, "%d: %g", i, lua_tonumber(L, i));
|
// LuaManager::LuaLog(LOG_DEBUG, "%d: %g", i, lua_tonumber(L, i));
|
||||||
break;
|
// break;
|
||||||
|
//
|
||||||
default:
|
// default:
|
||||||
LuaManager::LuaLog(LOG_DEBUG, "%d: %s", i, lua_typename(L, t));
|
// LuaManager::LuaLog(LOG_DEBUG, "%d: %s", i, lua_typename(L, t));
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
LuaManager::LuaLog(LOG_DEBUG, "--------------- Stack Dump Finished ---------------" );
|
// LuaManager::LuaLog(LOG_DEBUG, "--------------- Stack Dump Finished ---------------" );
|
||||||
}
|
//}
|
||||||
|
@ -85,7 +85,7 @@ void CMeasureTime::TimeToString(WCHAR* buf, size_t bufLen, const WCHAR* format,
|
|||||||
wcsftime(buf, bufLen, m_Format.c_str(), time);
|
wcsftime(buf, bufLen, m_Format.c_str(), time);
|
||||||
if (errno == EINVAL)
|
if (errno == EINVAL)
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_WARNING, L"Time: Invalid Format: Measure=[%s], Format=\"%s\"", m_Name.c_str(), format);
|
LogWithArgs(LOG_ERROR, L"Time: \"Format=%s\" invalid in [%s]", format, m_Name.c_str());
|
||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ const WCHAR* CMeasureUptime::GetStringValue(AUTOSCALE autoScale, double scale, i
|
|||||||
}
|
}
|
||||||
__except (EXCEPTION_EXECUTE_HANDLER)
|
__except (EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_WARNING, L"Uptime: Invalid Format: Measure=[%s], Format=\"%s\"", m_Name.c_str(), m_Format.c_str());
|
LogWithArgs(LOG_ERROR, L"Uptime: \"Format=%s\" invalid in [%s]", m_Format.c_str(), m_Name.c_str());
|
||||||
buffer[0] = 0;
|
buffer[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ void CMeter::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
}
|
}
|
||||||
else if (!matrix.empty())
|
else if (!matrix.empty())
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_WARNING, L"The transformation matrix has incorrect number of values: %s", parser.ReadString(section, L"TransformationMatrix", L"").c_str());
|
LogWithArgs(LOG_ERROR, L"Meter: Incorrect number of values in TransformationMatrix=%s", parser.ReadString(section, L"TransformationMatrix", L"").c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::wstring& group = parser.ReadString(section, L"Group", L"");
|
const std::wstring& group = parser.ReadString(section, L"Group", L"");
|
||||||
|
@ -109,7 +109,7 @@ void CMeterHistogram::Initialize()
|
|||||||
// A sanity check
|
// A sanity check
|
||||||
if (m_SecondaryMeasure && !m_PrimaryImageName.empty() && (m_BothImageName.empty() || m_SecondaryImageName.empty()))
|
if (m_SecondaryMeasure && !m_PrimaryImageName.empty() && (m_BothImageName.empty() || m_SecondaryImageName.empty()))
|
||||||
{
|
{
|
||||||
Log(LOG_WARNING, L"You need to define SecondaryImage and BothImage also!");
|
Log(LOG_WARNING, L"Histogram: SecondaryImage and BothImage not defined");
|
||||||
|
|
||||||
m_PrimaryImage.DisposeImage();
|
m_PrimaryImage.DisposeImage();
|
||||||
m_SecondaryImage.DisposeImage();
|
m_SecondaryImage.DisposeImage();
|
||||||
|
@ -203,7 +203,7 @@ void CMeterString::Initialize()
|
|||||||
// It couldn't find the font family: Log it.
|
// It couldn't find the font family: Log it.
|
||||||
if (Ok != status)
|
if (Ok != status)
|
||||||
{
|
{
|
||||||
std::wstring error = L"Unable to load font family: " + m_FontFace;
|
std::wstring error = L"String: Unable to load font: " + m_FontFace;
|
||||||
Log(LOG_ERROR, error.c_str());
|
Log(LOG_ERROR, error.c_str());
|
||||||
|
|
||||||
delete m_FontFamily;
|
delete m_FontFamily;
|
||||||
@ -279,7 +279,7 @@ void CMeterString::Initialize()
|
|||||||
|
|
||||||
if (m_FontSize != 0)
|
if (m_FontSize != 0)
|
||||||
{
|
{
|
||||||
std::wstring error = L"Unable to create font: " + m_FontFace;
|
std::wstring error = L"String: Unable to create font: " + m_FontFace;
|
||||||
throw CError(error, __LINE__, __FILE__);
|
throw CError(error, __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -836,18 +836,18 @@ void CMeterString::EnumerateInstalledFontFamilies()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log(LOG_ERROR, L"Font family enumeration: GetFamilies() failed.");
|
Log(LOG_ERROR, L"Font enumeration: GetFamilies failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] fontFamilies;
|
delete [] fontFamilies;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log(LOG_WARNING, L"There are no installed font families!");
|
Log(LOG_WARNING, L"No installed fonts");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log(LOG_ERROR, L"Font family enumeration: InstalledFontCollection() failed.");
|
Log(LOG_ERROR, L"Font enumeration: InstalledFontCollection failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -294,7 +294,7 @@ int CMeterWindow::Initialize(CRainmeter& Rainmeter)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log(LOG_NOTICE, L"Initialization successful.");
|
Log(LOG_NOTICE, L"Initialization successful");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -833,7 +833,7 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log(LOG_ERROR, L"Unable to parse parameters for !Move");
|
Log(LOG_ERROR, L"!Move: Invalid parameters");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -901,7 +901,7 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_WARNING, L"Unable to parse parameters for !LsBoxHook (%s)", arg);
|
LogWithArgs(LOG_ERROR, L"!LsBoxHook: Invalid parameters (%s)", arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -914,16 +914,10 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
|
|||||||
if (pos2 != NULL)
|
if (pos2 != NULL)
|
||||||
{
|
{
|
||||||
MoveMeter(_wtoi(arg), _wtoi(pos), pos2 + 1);
|
MoveMeter(_wtoi(arg), _wtoi(pos), pos2 + 1);
|
||||||
}
|
break;
|
||||||
else
|
|
||||||
{
|
|
||||||
Log(LOG_ERROR, L"Unable to parse coordinates for !MoveMeter");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
Log(LOG_ERROR, L"!MoveMeter: Invalid parameters");
|
||||||
{
|
|
||||||
Log(LOG_ERROR, L"Unable to parse parameters for !MoveMeter");
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BANG_COMMANDMEASURE:
|
case BANG_COMMANDMEASURE:
|
||||||
@ -945,11 +939,11 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogWithArgs(LOG_WARNING, L"Unable to find [%s] for !CommandMeasure", measure.c_str());
|
LogWithArgs(LOG_WARNING, L"!CommandMeasure: [%s] not found", measure.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log(LOG_ERROR, L"Unable to parse parameters for !CommandMeasure");
|
Log(LOG_ERROR, L"!CommandMeasure: Invalid parameters");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -990,11 +984,11 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogWithArgs(LOG_WARNING, L"Unable to find [%s] for !PluginBang", measure.c_str());
|
LogWithArgs(LOG_WARNING, L"!PluginBang: [%s] not found", measure.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log(LOG_ERROR, L"Unable to parse parameters for !PluginBang");
|
Log(LOG_ERROR, L"!PluginBang: Invalid parameters");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1025,7 +1019,7 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log(LOG_ERROR, L"Unable to parse parameters for !SetVariable");
|
Log(LOG_ERROR, L"!SetVariable: Invalid parameters");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1208,7 +1202,7 @@ void CMeterWindow::ShowMeter(const WCHAR* name, bool group)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to show the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
if (!group) LogWithArgs(LOG_NOTICE, L"!ShowMeter: [%s] not found in \"%s\"", name, m_SkinName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1232,7 +1226,7 @@ void CMeterWindow::HideMeter(const WCHAR* name, bool group)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to hide the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
if (!group) LogWithArgs(LOG_ERROR, L"!HideMeter: [%s] not found in \"%s\"", name, m_SkinName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1263,7 +1257,7 @@ void CMeterWindow::ToggleMeter(const WCHAR* name, bool group)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to toggle the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
if (!group) LogWithArgs(LOG_ERROR, L"!ToggleMeter: [%s] not found in \"%s\"", name, m_SkinName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1288,7 +1282,7 @@ void CMeterWindow::MoveMeter(int x, int y, const WCHAR* name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LogWithArgs(LOG_NOTICE, L"Unable to move the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
LogWithArgs(LOG_ERROR, L"!MoveMeter: [%s] not found in \"%s\"", name, m_SkinName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1330,7 +1324,7 @@ void CMeterWindow::UpdateMeter(const WCHAR* name, bool group)
|
|||||||
// Post-updates
|
// Post-updates
|
||||||
PostUpdate(bActiveTransition);
|
PostUpdate(bActiveTransition);
|
||||||
|
|
||||||
if (!group && bContinue) LogWithArgs(LOG_NOTICE, L"Unable to update the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
if (!group && bContinue) LogWithArgs(LOG_ERROR, L"!UpdateMeter: [%s] not found in \"%s\"", name, m_SkinName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1353,7 +1347,7 @@ void CMeterWindow::EnableMeasure(const WCHAR* name, bool group)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to enable the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
if (!group) LogWithArgs(LOG_ERROR, L"!EnableMeasure: [%s] not found in \"%s\"", name, m_SkinName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1376,7 +1370,7 @@ void CMeterWindow::DisableMeasure(const WCHAR* name, bool group)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to disable the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
if (!group) LogWithArgs(LOG_ERROR, L"!DisableMeasure: [%s] not found in \"%s\"", name, m_SkinName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1406,7 +1400,7 @@ void CMeterWindow::ToggleMeasure(const WCHAR* name, bool group)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to toggle the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
if (!group) LogWithArgs(LOG_ERROR, L"!ToggleMeasure: [%s] not found in \"%s\"", name, m_SkinName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1443,7 +1437,7 @@ void CMeterWindow::UpdateMeasure(const WCHAR* name, bool group)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to update the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
if (!group) LogWithArgs(LOG_ERROR, L"!UpdateMeasure: [%s] not found in \"%s\"", name, m_SkinName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1543,7 +1537,7 @@ void CMeterWindow::SetOption(const WCHAR* arg, bool group)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log(LOG_ERROR, L"Unable to parse parameters for !SetOption");
|
Log(LOG_ERROR, L"!SetOption: Invalid parameters");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1556,7 +1550,7 @@ void CMeterWindow::WindowToScreen()
|
|||||||
{
|
{
|
||||||
if (CSystem::GetMonitorCount() == 0)
|
if (CSystem::GetMonitorCount() == 0)
|
||||||
{
|
{
|
||||||
Log(LOG_ERROR, L"There are no monitors. WindowToScreen function fails.");
|
Log(LOG_ERROR, L"No monitors (WindowToScreen)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1768,7 +1762,7 @@ void CMeterWindow::ScreenToWindow()
|
|||||||
|
|
||||||
if (monitors.empty())
|
if (monitors.empty())
|
||||||
{
|
{
|
||||||
Log(LOG_ERROR, L"There are no monitors. ScreenToWindow function fails.");
|
Log(LOG_ERROR, L"No monitors (ScreenToWindow)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2099,7 +2093,7 @@ bool CMeterWindow::ReadSkin()
|
|||||||
std::wstring message = L"Unable to refresh skin \"" + m_SkinName;
|
std::wstring message = L"Unable to refresh skin \"" + m_SkinName;
|
||||||
message += L"\\";
|
message += L"\\";
|
||||||
message += m_SkinIniFile;
|
message += m_SkinIniFile;
|
||||||
message += L"\": Ini-file not found.";
|
message += L"\": File not found.";
|
||||||
Log(LOG_WARNING, message.c_str());
|
Log(LOG_WARNING, message.c_str());
|
||||||
MessageBox(m_Window, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
MessageBox(m_Window, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||||
return false;
|
return false;
|
||||||
@ -2281,23 +2275,22 @@ bool CMeterWindow::ReadSkin()
|
|||||||
|
|
||||||
for (size_t i = 0, isize = arraySections.size(); i < isize; ++i)
|
for (size_t i = 0, isize = arraySections.size(); i < isize; ++i)
|
||||||
{
|
{
|
||||||
const std::wstring& strSection = arraySections[i];
|
const WCHAR* section = arraySections[i].c_str();
|
||||||
|
|
||||||
if (_wcsicmp(L"Rainmeter", strSection.c_str()) != 0 &&
|
if (_wcsicmp(L"Rainmeter", section) != 0 &&
|
||||||
_wcsicmp(L"Variables", strSection.c_str()) != 0 &&
|
_wcsicmp(L"Variables", section) != 0 &&
|
||||||
_wcsicmp(L"Metadata", strSection.c_str()) != 0)
|
_wcsicmp(L"Metadata", section) != 0)
|
||||||
{
|
{
|
||||||
// Check if the item is a meter or a measure (or perhaps something else)
|
// Check if the item is a meter or a measure (or perhaps something else)
|
||||||
std::wstring measureName = m_Parser.ReadString(strSection.c_str(), L"Measure", L"");
|
const std::wstring& measureName = m_Parser.ReadString(section, L"Measure", L"");
|
||||||
std::wstring meterName = m_Parser.ReadString(strSection.c_str(), L"Meter", L"");
|
if (!measureName.empty())
|
||||||
if (measureName.length() > 0)
|
|
||||||
{
|
{
|
||||||
// It's a measure
|
// It's a measure
|
||||||
CMeasure* measure = NULL;
|
CMeasure* measure = NULL;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
measure = CMeasure::Create(measureName.c_str(), this, strSection.c_str());
|
measure = CMeasure::Create(measureName.c_str(), this, section);
|
||||||
if (measure)
|
if (measure)
|
||||||
{
|
{
|
||||||
measure->ReadConfig(m_Parser);
|
measure->ReadConfig(m_Parser);
|
||||||
@ -2317,15 +2310,19 @@ bool CMeterWindow::ReadSkin()
|
|||||||
measure = NULL;
|
measure = NULL;
|
||||||
LogError(error);
|
LogError(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
else if (meterName.length() > 0)
|
|
||||||
|
const std::wstring& meterName = m_Parser.ReadString(section, L"Meter", L"");
|
||||||
|
if (!meterName.empty())
|
||||||
{
|
{
|
||||||
// It's a meter
|
// It's a meter
|
||||||
CMeter* meter = NULL;
|
CMeter* meter = NULL;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
meter = CMeter::Create(meterName.c_str(), this, strSection.c_str());
|
meter = CMeter::Create(meterName.c_str(), this, section);
|
||||||
if (meter)
|
if (meter)
|
||||||
{
|
{
|
||||||
meter->SetMouseActionCursor(m_MouseActionCursor);
|
meter->SetMouseActionCursor(m_MouseActionCursor);
|
||||||
@ -2347,7 +2344,10 @@ bool CMeterWindow::ReadSkin()
|
|||||||
meter = NULL;
|
meter = NULL;
|
||||||
LogError(error);
|
LogError(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it's not a meter or measure it will be ignored
|
// If it's not a meter or measure it will be ignored
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2359,7 +2359,7 @@ bool CMeterWindow::ReadSkin()
|
|||||||
text += m_SkinIniFile;
|
text += m_SkinIniFile;
|
||||||
if (m_Measures.empty())
|
if (m_Measures.empty())
|
||||||
{
|
{
|
||||||
text += L"\" does not contain\nany valid meters or measures and will be deactivated.\n\nThe file may be damaged or not a Rainmeter skin file.";
|
text += L"\" does not contain\nany meters or measures and will be deactivated.\n\nThe file may be damaged or may not be a Rainmeter skin.";
|
||||||
MessageBox(m_Window, text.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
MessageBox(m_Window, text.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -5087,7 +5087,7 @@ LRESULT CMeterWindow::OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
Log(LOG_WARNING, L"Unable to send the !bang to a deactivated config.");
|
Log(LOG_WARNING, L"Unable to bang a deactivated config");
|
||||||
return TRUE; // This meterwindow has been deactivated
|
return TRUE; // This meterwindow has been deactivated
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,8 +421,7 @@ void BangWithArgs(BANGCOMMAND bang, const WCHAR* arg, size_t numOfArgs)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring dbg = L"Unknown config name: " + config;
|
LogWithArgs(LOG_ERROR, L"Bang: Config \"%s\" not found", config.c_str());
|
||||||
Log(LOG_NOTICE, dbg.c_str());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -439,7 +438,7 @@ void BangWithArgs(BANGCOMMAND bang, const WCHAR* arg, size_t numOfArgs)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log(LOG_WARNING, L"Incorrect number of arguments for the bang!");
|
Log(LOG_ERROR, L"Bang: Incorrect number of arugments");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -477,7 +476,7 @@ void BangGroupWithArgs(BANGCOMMAND bang, const WCHAR* arg, size_t numOfArgs)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log(LOG_WARNING, L"Incorrect number of arguments for the group bang!");
|
Log(LOG_ERROR, L"BangGroup: Incorrect number of arguments");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1302,28 +1301,18 @@ void RainmeterActivateConfigWide(const WCHAR* arg)
|
|||||||
|
|
||||||
if (subStrings.size() > 1)
|
if (subStrings.size() > 1)
|
||||||
{
|
{
|
||||||
const std::vector<CRainmeter::CONFIG>& configs = Rainmeter->GetAllConfigs();
|
std::pair<int, int> indexes = Rainmeter->GetMeterWindowIndex(subStrings[0], subStrings[1]);
|
||||||
|
if (indexes.first != -1 && indexes.second != -1)
|
||||||
for (int i = 0, isize = (int)configs.size(); i < isize; ++i)
|
|
||||||
{
|
{
|
||||||
if (_wcsicmp(configs[i].config.c_str(), subStrings[0].c_str()) == 0)
|
Rainmeter->ActivateConfig(indexes.first, indexes.second);
|
||||||
{
|
return;
|
||||||
for (int j = 0, jsize = (int)configs[i].iniFiles.size(); j < jsize; ++j)
|
|
||||||
{
|
|
||||||
if (_wcsicmp(configs[i].iniFiles[j].c_str(), subStrings[1].c_str()) == 0)
|
|
||||||
{
|
|
||||||
Rainmeter->ActivateConfig(i, j);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
LogWithArgs(LOG_NOTICE, L"No such config: \"%s\" \"%s\"", subStrings[0].c_str(), subStrings[1].c_str());
|
LogWithArgs(LOG_ERROR, L"!ActivateConfig: \"%s\\%s\" not found", subStrings[0].c_str(), subStrings[1].c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If we got this far, something went wrong
|
// If we got this far, something went wrong
|
||||||
Log(LOG_WARNING, L"Unable to parse the arguments for !ActivateConfig");
|
Log(LOG_ERROR, L"!ActivateConfig: Invalid parameters");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1348,11 +1337,11 @@ void RainmeterDeactivateConfigWide(const WCHAR* arg)
|
|||||||
Rainmeter->DeactivateConfig(mw, -1);
|
Rainmeter->DeactivateConfig(mw, -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LogWithArgs(LOG_NOTICE, L"The config is not active: \"%s\"", subStrings[0].c_str());
|
LogWithArgs(LOG_WARNING, L"!DeactivateConfig: \"%s\" not active", subStrings[0].c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log(LOG_WARNING, L"Unable to parse the arguments for !DeactivateConfig");
|
Log(LOG_ERROR, L"!DeactivateConfig: Invalid parameters");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1383,7 +1372,7 @@ void RainmeterToggleConfigWide(const WCHAR* arg)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log(LOG_WARNING, L"Unable to parse the arguments for !ToggleConfig");
|
Log(LOG_ERROR, L"!ToggleConfig: Invalid parameters");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1413,7 +1402,7 @@ void RainmeterDeactivateConfigGroupWide(const WCHAR* arg)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log(LOG_WARNING, L"Unable to parse the arguments for !DeactivateConfigGroup");
|
Log(LOG_ERROR, L"!DeactivateConfigGroup: Invalid parameters");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1513,11 +1502,11 @@ void RainmeterSkinMenuWide(const WCHAR* arg)
|
|||||||
Rainmeter->ShowContextMenu(pos, mw);
|
Rainmeter->ShowContextMenu(pos, mw);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LogWithArgs(LOG_NOTICE, L"The config is not active: \"%s\"", subStrings[0].c_str());
|
LogWithArgs(LOG_WARNING, L"!SkinMenu: \"%s\" not active", subStrings[0].c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log(LOG_WARNING, L"Unable to parse the arguments for !SkinMenu");
|
Log(LOG_ERROR, L"!SkinMenu: Invalid parameter");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1568,9 +1557,9 @@ void RainmeterWriteKeyValueWide(const WCHAR* arg)
|
|||||||
{
|
{
|
||||||
const std::wstring& iniFile = subStrings[3];
|
const std::wstring& iniFile = subStrings[3];
|
||||||
|
|
||||||
if (iniFile.find(L"..\\") != std::string::npos || iniFile.find(L"../") != std::string::npos)
|
if (iniFile.find(L"..") != std::string::npos)
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_ERROR, L"!WriteKeyValue: Illegal characters in path - \"..\\\": %s", iniFile.c_str());
|
LogWithArgs(LOG_ERROR, L"!WriteKeyValue: Illegal path: %s", iniFile.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1580,14 +1569,14 @@ void RainmeterWriteKeyValueWide(const WCHAR* arg)
|
|||||||
if (_wcsnicmp(iniFile.c_str(), skinPath.c_str(), skinPath.size()) != 0 &&
|
if (_wcsnicmp(iniFile.c_str(), skinPath.c_str(), skinPath.size()) != 0 &&
|
||||||
_wcsnicmp(iniFile.c_str(), settingsPath.c_str(), settingsPath.size()) != 0)
|
_wcsnicmp(iniFile.c_str(), settingsPath.c_str(), settingsPath.size()) != 0)
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_ERROR, L"!WriteKeyValue: Illegal path outside of Rainmeter directories: %s", iniFile.c_str());
|
LogWithArgs(LOG_ERROR, L"!WriteKeyValue: Illegal path: %s", iniFile.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify whether the file exists
|
// Verify whether the file exists
|
||||||
if (_waccess(iniFile.c_str(), 0) == -1)
|
if (_waccess(iniFile.c_str(), 0) == -1)
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_WARNING, L"!WriteKeyValue: File not found: %s", iniFile.c_str());
|
LogWithArgs(LOG_ERROR, L"!WriteKeyValue: File not found: %s", iniFile.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1605,7 +1594,6 @@ void RainmeterWriteKeyValueWide(const WCHAR* arg)
|
|||||||
std::wstring iniWrite = CSystem::GetTemporaryFile(iniFileMappings, iniFile);
|
std::wstring iniWrite = CSystem::GetTemporaryFile(iniFileMappings, iniFile);
|
||||||
if (iniWrite == L"<>") // error occurred
|
if (iniWrite == L"<>") // error occurred
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_ERROR, L"!WriteKeyValue: Failed to create a temporary file: %s", iniFile.c_str());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1613,11 +1601,11 @@ void RainmeterWriteKeyValueWide(const WCHAR* arg)
|
|||||||
|
|
||||||
if (temporary)
|
if (temporary)
|
||||||
{
|
{
|
||||||
if (CRainmeter::GetDebug()) LogWithArgs(LOG_DEBUG, L"!WriteKeyValue: Writing file: %s (Temp: %s)", iniFile.c_str(), iniWrite.c_str());
|
if (CRainmeter::GetDebug()) LogWithArgs(LOG_DEBUG, L"!WriteKeyValue: Writing to: %s (Temp: %s)", iniFile.c_str(), iniWrite.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (CRainmeter::GetDebug()) LogWithArgs(LOG_DEBUG, L"!WriteKeyValue: Writing file: %s", iniFile.c_str());
|
if (CRainmeter::GetDebug()) LogWithArgs(LOG_DEBUG, L"!WriteKeyValue: Writing to: %s", iniFile.c_str());
|
||||||
iniWrite = iniFile;
|
iniWrite = iniFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1664,12 +1652,12 @@ void RainmeterWriteKeyValueWide(const WCHAR* arg)
|
|||||||
// Copy the file back
|
// Copy the file back
|
||||||
if (!CSystem::CopyFiles(iniWrite, iniFile))
|
if (!CSystem::CopyFiles(iniWrite, iniFile))
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_ERROR, L"!WriteKeyValue: Failed to copy a temporary file to the original filepath: %s (Temp: %s)", iniFile.c_str(), iniWrite.c_str());
|
LogWithArgs(LOG_ERROR, L"!WriteKeyValue: Failed to copy temporary file to original filepath: %s (Temp: %s)", iniFile.c_str(), iniWrite.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // failed
|
else // failed
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_ERROR, L"!WriteKeyValue: Failed to write a value to the file: %s (Temp: %s)", iniFile.c_str(), iniWrite.c_str());
|
LogWithArgs(LOG_ERROR, L"!WriteKeyValue: Failed to write to: %s (Temp: %s)", iniFile.c_str(), iniWrite.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove a temporary file
|
// Remove a temporary file
|
||||||
@ -1679,13 +1667,13 @@ void RainmeterWriteKeyValueWide(const WCHAR* arg)
|
|||||||
{
|
{
|
||||||
if (write == 0) // failed
|
if (write == 0) // failed
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_ERROR, L"!WriteKeyValue: Failed to write a value to the file: %s", iniFile.c_str());
|
LogWithArgs(LOG_ERROR, L"!WriteKeyValue: Failed to write to: %s", iniFile.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log(LOG_WARNING, L"Unable to parse the arguments for !WriteKeyValue");
|
Log(LOG_ERROR, L"!WriteKeyValue: Invalid parameters");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1957,7 +1945,7 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log(LOG_WARNING, L"Unable to get the My Documents location.");
|
Log(LOG_WARNING, L"Documents folder not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
WritePrivateProfileString(L"Rainmeter", L"SkinPath", m_SkinPath.c_str(), m_IniFile.c_str());
|
WritePrivateProfileString(L"Rainmeter", L"SkinPath", m_SkinPath.c_str(), m_IniFile.c_str());
|
||||||
@ -2213,7 +2201,7 @@ void CRainmeter::ActivateConfig(int configIndex, int iniIndex)
|
|||||||
{
|
{
|
||||||
if (((*iter).second)->GetSkinIniFile() == skinIniFile)
|
if (((*iter).second)->GetSkinIniFile() == skinIniFile)
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_WARNING, L"MeterWindow \"%s\" is already active.", skinConfig.c_str());
|
LogWithArgs(LOG_WARNING, L"!ActivateConfig: \"%s\" already active", skinConfig.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2233,8 +2221,7 @@ void CRainmeter::ActivateConfig(int configIndex, int iniIndex)
|
|||||||
std::wstring message = L"Unable to activate skin \"" + skinConfig;
|
std::wstring message = L"Unable to activate skin \"" + skinConfig;
|
||||||
message += L"\\";
|
message += L"\\";
|
||||||
message += skinIniFile;
|
message += skinIniFile;
|
||||||
message += L"\": Ini-file not found.";
|
message += L"\": File not found";
|
||||||
Log(LOG_WARNING, message.c_str());
|
|
||||||
MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3536,8 +3523,7 @@ void CRainmeter::RefreshAll()
|
|||||||
std::wstring message = L"Unable to refresh skin \"" + skinConfig;
|
std::wstring message = L"Unable to refresh skin \"" + skinConfig;
|
||||||
message += L"\\";
|
message += L"\\";
|
||||||
message += skinIniFile;
|
message += skinIniFile;
|
||||||
message += L"\": Ini-file not found.";
|
message += L"\": File not found.";
|
||||||
Log(LOG_WARNING, message.c_str());
|
|
||||||
MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3552,7 +3538,6 @@ void CRainmeter::RefreshAll()
|
|||||||
|
|
||||||
std::wstring message = L"Unable to refresh config \"" + skinConfig;
|
std::wstring message = L"Unable to refresh config \"" + skinConfig;
|
||||||
message += L"\": Config not found.";
|
message += L"\": Config not found.";
|
||||||
Log(LOG_WARNING, message.c_str());
|
|
||||||
MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -3654,7 +3639,7 @@ void CRainmeter::UpdateDesktopWorkArea(bool reset)
|
|||||||
{
|
{
|
||||||
format += L" => FAIL";
|
format += L" => FAIL";
|
||||||
}
|
}
|
||||||
LogWithArgs(LOG_NOTICE, format.c_str(), (int)i + 1, r.left, r.top, r.right, r.bottom, r.right - r.left, r.bottom - r.top);
|
LogWithArgs(LOG_DEBUG, format.c_str(), (int)i + 1, r.left, r.top, r.right, r.bottom, r.right - r.left, r.bottom - r.top);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
changed = true;
|
changed = true;
|
||||||
@ -3676,7 +3661,7 @@ void CRainmeter::UpdateDesktopWorkArea(bool reset)
|
|||||||
|
|
||||||
if (c_Debug)
|
if (c_Debug)
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_NOTICE, L"DesktopWorkAreaType: %s", m_DesktopWorkAreaType ? L"Margin" : L"Default");
|
LogWithArgs(LOG_DEBUG, L"DesktopWorkAreaType: %s", m_DesktopWorkAreaType ? L"Margin" : L"Default");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (UINT i = 0; i <= CSystem::GetMonitorCount(); ++i)
|
for (UINT i = 0; i <= CSystem::GetMonitorCount(); ++i)
|
||||||
@ -3728,7 +3713,7 @@ void CRainmeter::UpdateDesktopWorkArea(bool reset)
|
|||||||
{
|
{
|
||||||
format += L" => FAIL";
|
format += L" => FAIL";
|
||||||
}
|
}
|
||||||
LogWithArgs(LOG_NOTICE, format.c_str(), r.left, r.top, r.right, r.bottom, r.right - r.left, r.bottom - r.top);
|
LogWithArgs(LOG_DEBUG, format.c_str(), r.left, r.top, r.right, r.bottom, r.right - r.left, r.bottom - r.top);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4401,8 +4386,6 @@ void CRainmeter::TestSettingsFile(bool bDefaultIniLocation)
|
|||||||
}
|
}
|
||||||
if (!bSuccess)
|
if (!bSuccess)
|
||||||
{
|
{
|
||||||
Log(LOG_WARNING, L"Rainmeter.ini is NOT writable.");
|
|
||||||
|
|
||||||
std::wstring error = L"Rainmeter.ini is not writable. Rainmeter will not\n"
|
std::wstring error = L"Rainmeter.ini is not writable. Rainmeter will not\n"
|
||||||
L"be able to save any settings permanently.\n\n";
|
L"be able to save any settings permanently.\n\n";
|
||||||
|
|
||||||
@ -4473,7 +4456,7 @@ void CRainmeter::ExpandEnvironmentVariables(std::wstring& strPath)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_WARNING, L"Unable to expand the environment strings for string: %s", strPath.c_str());
|
LogWithArgs(LOG_WARNING, L"Unable to expand environment strings in: %s", strPath.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,7 +441,7 @@ void CSystem::SetMultiMonitorInfo()
|
|||||||
|
|
||||||
if (monitors.empty()) // Failed to enumerate the monitors
|
if (monitors.empty()) // Failed to enumerate the monitors
|
||||||
{
|
{
|
||||||
Log(LOG_WARNING, L"Failed to enumerate the monitors. Prepares the dummy monitor information.");
|
Log(LOG_WARNING, L"Failed to enumerate monitors. Using dummy monitor info.");
|
||||||
c_Monitors.useEnumDisplayMonitors = false;
|
c_Monitors.useEnumDisplayMonitors = false;
|
||||||
|
|
||||||
MONITOR_INFO monitor = {0};
|
MONITOR_INFO monitor = {0};
|
||||||
@ -839,8 +839,8 @@ bool CSystem::CheckDesktopState(HWND WorkerW)
|
|||||||
|
|
||||||
if (CRainmeter::GetDebug())
|
if (CRainmeter::GetDebug())
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_DEBUG, L"System: \"%s\" has been detected.",
|
LogWithArgs(LOG_DEBUG, L"System: \"Show %s\" has been detected.",
|
||||||
c_ShowDesktop ? L"Show the desktop" : L"Show open windows");
|
c_ShowDesktop ? L"desktop" : L"open windows");
|
||||||
}
|
}
|
||||||
|
|
||||||
PrepareHelperWindow(WorkerW);
|
PrepareHelperWindow(WorkerW);
|
||||||
@ -935,7 +935,7 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_DISPLAYCHANGE:
|
case WM_DISPLAYCHANGE:
|
||||||
Log(LOG_NOTICE, L"System: Display setting has been changed.");
|
Log(LOG_NOTICE, L"System: Display settings changed");
|
||||||
ClearMultiMonitorInfo();
|
ClearMultiMonitorInfo();
|
||||||
CConfigParser::ClearMultiMonitorVariables();
|
CConfigParser::ClearMultiMonitorVariables();
|
||||||
case WM_SETTINGCHANGE:
|
case WM_SETTINGCHANGE:
|
||||||
@ -943,7 +943,7 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||||||
{
|
{
|
||||||
if (uMsg == WM_SETTINGCHANGE) // SPI_SETWORKAREA
|
if (uMsg == WM_SETTINGCHANGE) // SPI_SETWORKAREA
|
||||||
{
|
{
|
||||||
Log(LOG_NOTICE, L"System: Work area has been changed.");
|
Log(LOG_NOTICE, L"System: Work area changed");
|
||||||
UpdateWorkareaInfo();
|
UpdateWorkareaInfo();
|
||||||
CConfigParser::UpdateWorkareaVariables();
|
CConfigParser::UpdateWorkareaVariables();
|
||||||
}
|
}
|
||||||
@ -1292,7 +1292,7 @@ std::wstring CSystem::GetTemporaryFile(const std::vector<std::wstring>& iniFileM
|
|||||||
}
|
}
|
||||||
else // failed
|
else // failed
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_ERROR, L"Unable to create a temporary file to: %s", temporary.c_str());
|
LogWithArgs(LOG_ERROR, L"Unable to create temporary file to: %s", temporary.c_str());
|
||||||
return L"<>";
|
return L"<>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -332,7 +332,7 @@ void CTintedImage::LoadImage(const std::wstring& imageName, bool bLoadAlways)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_ERROR, L"Unable to load %s: %s", m_ConfigName.c_str(), filename.c_str());
|
LogWithArgs(LOG_ERROR, L"%s: Unable to load: %s", m_ConfigName.c_str(), filename.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CloseHandle(fileHandle);
|
CloseHandle(fileHandle);
|
||||||
@ -364,7 +364,7 @@ void CTintedImage::LoadImage(const std::wstring& imageName, bool bLoadAlways)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_ERROR, L"Unable to open %s: %s", m_ConfigName.c_str(), filename.c_str());
|
LogWithArgs(LOG_ERROR, L"%s: Unable to open: %s", m_ConfigName.c_str(), filename.c_str());
|
||||||
DisposeImage();
|
DisposeImage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ void CheckVersion(void* dummy)
|
|||||||
0);
|
0);
|
||||||
if (hRootHandle == NULL)
|
if (hRootHandle == NULL)
|
||||||
{
|
{
|
||||||
Log(LOG_ERROR, L"CheckUpdate: InternetOpen failed.");
|
Log(LOG_ERROR, L"CheckUpdate: InternetOpen failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ void CheckVersion(void* dummy)
|
|||||||
if (version > RAINMETER_VERSION)
|
if (version > RAINMETER_VERSION)
|
||||||
{
|
{
|
||||||
Rainmeter->SetNewVersion(true);
|
Rainmeter->SetNewVersion(true);
|
||||||
Log(LOG_NOTICE, L"CheckUpdate: New version available.");
|
Log(LOG_NOTICE, L"CheckUpdate: Update available");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -81,13 +81,13 @@ void CheckVersion(void* dummy)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log(LOG_ERROR, L"CheckUpdate: InternetReadFile failed.");
|
Log(LOG_ERROR, L"CheckUpdate: InternetReadFile failed");
|
||||||
}
|
}
|
||||||
InternetCloseHandle(hUrlDump);
|
InternetCloseHandle(hUrlDump);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log(LOG_ERROR, L"CheckUpdate: InternetOpenUrl failed.");
|
Log(LOG_ERROR, L"CheckUpdate: InternetOpenUrl failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
InternetCloseHandle(hRootHandle);
|
InternetCloseHandle(hRootHandle);
|
||||||
|
Loading…
Reference in New Issue
Block a user