- Added #CURRENTFILE# variable

- Changes to log strings
This commit is contained in:
Birunthan Mohanathas 2011-09-09 16:31:55 +00:00
parent 3518dbf07e
commit f14d751604
17 changed files with 136 additions and 159 deletions

View File

@ -104,6 +104,7 @@ void CConfigParser::SetBuiltInVariables(CRainmeter* pRainmeter, CMeterWindow* me
}
if (meterWindow)
{
SetBuiltInVariable(L"CURRENTFILE", meterWindow->GetSkinIniFile());
SetBuiltInVariable(L"CURRENTCONFIG", meterWindow->GetSkinName());
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?
{
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;
}
// Verify whether the file exists
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;
}

View File

@ -708,7 +708,7 @@ void LogWithArgs(int nLevel, const WCHAR* format, ... )
if (errno != 0)
{
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);

View File

@ -182,7 +182,7 @@ void CMeasure::ReadConfig(CConfigParser& parser, const WCHAR* section)
}
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"");
@ -851,5 +851,5 @@ CMeasure* CMeasure::Create(const WCHAR* measure, CMeterWindow* meterWindow, cons
*/
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());
}

View File

@ -102,7 +102,7 @@ void CMeasureCPU::ReadConfig(CConfigParser& parser, const WCHAR* section)
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;
}

View File

@ -150,7 +150,7 @@ void CMeasureDiskSpace::ReadConfig(CConfigParser& parser, const WCHAR* section)
m_Drive = parser.ReadString(section, L"Drive", L"C:\\");
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_MaxValue = 0.0;
m_OldTotalBytes = 0;

View File

@ -123,7 +123,7 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section)
{
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
@ -140,7 +140,7 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section)
{
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)
{
std::wstring error = L"Plugin: \"" + m_PluginName;
error += L"\" not found!";
error += L"\" not found";
throw CError(error, __LINE__, __FILE__);
}
}
@ -228,6 +228,6 @@ void CMeasurePlugin::ExecuteBang(const WCHAR* args)
}
else
{
LogWithArgs(LOG_WARNING, L"[%s] doesn't support bangs.", m_Name.c_str());
CMeasure::ExecuteBang(args);
}
}

View File

@ -160,10 +160,7 @@ void CMeasureScript::ReadConfig(CConfigParser& parser, const WCHAR* section)
if (m_HasGetStringFunction)
{
std::wstring error = L"Script: GetStringValue() used in measure [";
error += m_Name;
error += L"] has been deprecated. Check manual to ensure future compatibility.";
Log(LOG_WARNING, error.c_str());
LogWithArgs(LOG_WARNING, L"Script: Using deprecated GetStringValue() in [%s]", m_Name.c_str());
}
m_LuaScript->PushTable();
@ -215,11 +212,7 @@ void CMeasureScript::ReadConfig(CConfigParser& parser, const WCHAR* section)
}
else
{
std::wstring error = L"Script: ScriptFile= is not valid in measure [";
error += m_Name;
error += L"].";
Log(LOG_WARNING, error.c_str());
LogWithArgs(LOG_ERROR, L"Script: File not valid in [%s]", m_Name.c_str());
DeleteLuaScript();
}
}
@ -236,30 +229,30 @@ void CMeasureScript::ExecuteBang(const WCHAR* args)
m_LuaScript->RunString(str.c_str());
}
static void stackDump(lua_State *L)
{
LuaManager::LuaLog(LOG_DEBUG, " ---------------- Stack Dump ----------------" );
for (int i = lua_gettop(L); i > 0; --i)
{
int t = lua_type(L, i);
switch (t)
{
case LUA_TSTRING:
LuaManager::LuaLog(LOG_DEBUG, "%d:'%s'", i, lua_tostring(L, i));
break;
case LUA_TBOOLEAN:
LuaManager::LuaLog(LOG_DEBUG, "%d: %s", i, lua_toboolean(L, i) ? "true" : "false");
break;
case LUA_TNUMBER:
LuaManager::LuaLog(LOG_DEBUG, "%d: %g", i, lua_tonumber(L, i));
break;
default:
LuaManager::LuaLog(LOG_DEBUG, "%d: %s", i, lua_typename(L, t));
break;
}
}
LuaManager::LuaLog(LOG_DEBUG, "--------------- Stack Dump Finished ---------------" );
}
//static void stackDump(lua_State *L)
//{
// LuaManager::LuaLog(LOG_DEBUG, " ---------------- Stack Dump ----------------" );
// for (int i = lua_gettop(L); i > 0; --i)
// {
// int t = lua_type(L, i);
// switch (t)
// {
// case LUA_TSTRING:
// LuaManager::LuaLog(LOG_DEBUG, "%d:'%s'", i, lua_tostring(L, i));
// break;
//
// case LUA_TBOOLEAN:
// LuaManager::LuaLog(LOG_DEBUG, "%d: %s", i, lua_toboolean(L, i) ? "true" : "false");
// break;
//
// case LUA_TNUMBER:
// LuaManager::LuaLog(LOG_DEBUG, "%d: %g", i, lua_tonumber(L, i));
// break;
//
// default:
// LuaManager::LuaLog(LOG_DEBUG, "%d: %s", i, lua_typename(L, t));
// break;
// }
// }
// LuaManager::LuaLog(LOG_DEBUG, "--------------- Stack Dump Finished ---------------" );
//}

View File

@ -85,7 +85,7 @@ void CMeasureTime::TimeToString(WCHAR* buf, size_t bufLen, const WCHAR* format,
wcsftime(buf, bufLen, m_Format.c_str(), time);
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;
}

View File

@ -109,7 +109,7 @@ const WCHAR* CMeasureUptime::GetStringValue(AUTOSCALE autoScale, double scale, i
}
__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;
}

View File

@ -427,7 +427,7 @@ void CMeter::ReadConfig(CConfigParser& parser, const WCHAR* section)
}
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"");

View File

@ -109,7 +109,7 @@ void CMeterHistogram::Initialize()
// A sanity check
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_SecondaryImage.DisposeImage();

View File

@ -203,7 +203,7 @@ void CMeterString::Initialize()
// It couldn't find the font family: Log it.
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());
delete m_FontFamily;
@ -279,7 +279,7 @@ void CMeterString::Initialize()
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__);
}
}
@ -836,18 +836,18 @@ void CMeterString::EnumerateInstalledFontFamilies()
}
else
{
Log(LOG_ERROR, L"Font family enumeration: GetFamilies() failed.");
Log(LOG_ERROR, L"Font enumeration: GetFamilies failed");
}
delete [] fontFamilies;
}
else
{
Log(LOG_WARNING, L"There are no installed font families!");
Log(LOG_WARNING, L"No installed fonts");
}
}
else
{
Log(LOG_ERROR, L"Font family enumeration: InstalledFontCollection() failed.");
Log(LOG_ERROR, L"Font enumeration: InstalledFontCollection failed");
}
}

View File

@ -294,7 +294,7 @@ int CMeterWindow::Initialize(CRainmeter& Rainmeter)
}
}
Log(LOG_NOTICE, L"Initialization successful.");
Log(LOG_NOTICE, L"Initialization successful");
return 0;
}
@ -833,7 +833,7 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
}
else
{
Log(LOG_ERROR, L"Unable to parse parameters for !Move");
Log(LOG_ERROR, L"!Move: Invalid parameters");
}
break;
@ -901,7 +901,7 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
}
else
{
LogWithArgs(LOG_WARNING, L"Unable to parse parameters for !LsBoxHook (%s)", arg);
LogWithArgs(LOG_ERROR, L"!LsBoxHook: Invalid parameters (%s)", arg);
}
}
break;
@ -914,16 +914,10 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
if (pos2 != NULL)
{
MoveMeter(_wtoi(arg), _wtoi(pos), pos2 + 1);
}
else
{
Log(LOG_ERROR, L"Unable to parse coordinates for !MoveMeter");
break;
}
}
else
{
Log(LOG_ERROR, L"Unable to parse parameters for !MoveMeter");
}
Log(LOG_ERROR, L"!MoveMeter: Invalid parameters");
break;
case BANG_COMMANDMEASURE:
@ -945,11 +939,11 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
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
{
Log(LOG_ERROR, L"Unable to parse parameters for !CommandMeasure");
Log(LOG_ERROR, L"!CommandMeasure: Invalid parameters");
}
}
break;
@ -990,11 +984,11 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
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
{
Log(LOG_ERROR, L"Unable to parse parameters for !PluginBang");
Log(LOG_ERROR, L"!PluginBang: Invalid parameters");
}
}
break;
@ -1025,7 +1019,7 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
}
else
{
Log(LOG_ERROR, L"Unable to parse parameters for !SetVariable");
Log(LOG_ERROR, L"!SetVariable: Invalid parameters");
}
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
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
{
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)
{
Log(LOG_ERROR, L"There are no monitors. WindowToScreen function fails.");
Log(LOG_ERROR, L"No monitors (WindowToScreen)");
return;
}
@ -1768,7 +1762,7 @@ void CMeterWindow::ScreenToWindow()
if (monitors.empty())
{
Log(LOG_ERROR, L"There are no monitors. ScreenToWindow function fails.");
Log(LOG_ERROR, L"No monitors (ScreenToWindow)");
return;
}
@ -2099,7 +2093,7 @@ bool CMeterWindow::ReadSkin()
std::wstring message = L"Unable to refresh skin \"" + m_SkinName;
message += L"\\";
message += m_SkinIniFile;
message += L"\": Ini-file not found.";
message += L"\": File not found.";
Log(LOG_WARNING, message.c_str());
MessageBox(m_Window, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
return false;
@ -2281,23 +2275,22 @@ bool CMeterWindow::ReadSkin()
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 &&
_wcsicmp(L"Variables", strSection.c_str()) != 0 &&
_wcsicmp(L"Metadata", strSection.c_str()) != 0)
if (_wcsicmp(L"Rainmeter", section) != 0 &&
_wcsicmp(L"Variables", section) != 0 &&
_wcsicmp(L"Metadata", section) != 0)
{
// 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"");
std::wstring meterName = m_Parser.ReadString(strSection.c_str(), L"Meter", L"");
if (measureName.length() > 0)
const std::wstring& measureName = m_Parser.ReadString(section, L"Measure", L"");
if (!measureName.empty())
{
// It's a measure
CMeasure* measure = NULL;
try
{
measure = CMeasure::Create(measureName.c_str(), this, strSection.c_str());
measure = CMeasure::Create(measureName.c_str(), this, section);
if (measure)
{
measure->ReadConfig(m_Parser);
@ -2317,15 +2310,19 @@ bool CMeterWindow::ReadSkin()
measure = NULL;
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
CMeter* meter = NULL;
try
{
meter = CMeter::Create(meterName.c_str(), this, strSection.c_str());
meter = CMeter::Create(meterName.c_str(), this, section);
if (meter)
{
meter->SetMouseActionCursor(m_MouseActionCursor);
@ -2347,7 +2344,10 @@ bool CMeterWindow::ReadSkin()
meter = NULL;
LogError(error);
}
continue;
}
// If it's not a meter or measure it will be ignored
}
}
@ -2359,7 +2359,7 @@ bool CMeterWindow::ReadSkin()
text += m_SkinIniFile;
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);
return false;
}
@ -5087,7 +5087,7 @@ LRESULT CMeterWindow::OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam)
}
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
}

View File

@ -421,8 +421,7 @@ void BangWithArgs(BANGCOMMAND bang, const WCHAR* arg, size_t numOfArgs)
}
else
{
std::wstring dbg = L"Unknown config name: " + config;
Log(LOG_NOTICE, dbg.c_str());
LogWithArgs(LOG_ERROR, L"Bang: Config \"%s\" not found", config.c_str());
}
}
else
@ -439,7 +438,7 @@ void BangWithArgs(BANGCOMMAND bang, const WCHAR* arg, size_t numOfArgs)
}
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
{
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)
{
const std::vector<CRainmeter::CONFIG>& configs = Rainmeter->GetAllConfigs();
for (int i = 0, isize = (int)configs.size(); i < isize; ++i)
std::pair<int, int> indexes = Rainmeter->GetMeterWindowIndex(subStrings[0], subStrings[1]);
if (indexes.first != -1 && indexes.second != -1)
{
if (_wcsicmp(configs[i].config.c_str(), subStrings[0].c_str()) == 0)
{
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);
Rainmeter->ActivateConfig(indexes.first, indexes.second);
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
{
// 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);
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
{
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
{
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
{
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);
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
{
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];
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;
}
@ -1580,14 +1569,14 @@ void RainmeterWriteKeyValueWide(const WCHAR* arg)
if (_wcsnicmp(iniFile.c_str(), skinPath.c_str(), skinPath.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;
}
// Verify whether the file exists
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;
}
@ -1605,7 +1594,6 @@ void RainmeterWriteKeyValueWide(const WCHAR* arg)
std::wstring iniWrite = CSystem::GetTemporaryFile(iniFileMappings, iniFile);
if (iniWrite == L"<>") // error occurred
{
LogWithArgs(LOG_ERROR, L"!WriteKeyValue: Failed to create a temporary file: %s", iniFile.c_str());
return;
}
@ -1613,11 +1601,11 @@ void RainmeterWriteKeyValueWide(const WCHAR* arg)
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
{
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;
}
@ -1664,12 +1652,12 @@ void RainmeterWriteKeyValueWide(const WCHAR* arg)
// Copy the file back
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
{
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
@ -1679,13 +1667,13 @@ void RainmeterWriteKeyValueWide(const WCHAR* arg)
{
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
{
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
{
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());
@ -2213,7 +2201,7 @@ void CRainmeter::ActivateConfig(int configIndex, int iniIndex)
{
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;
}
else
@ -2233,8 +2221,7 @@ void CRainmeter::ActivateConfig(int configIndex, int iniIndex)
std::wstring message = L"Unable to activate skin \"" + skinConfig;
message += L"\\";
message += skinIniFile;
message += L"\": Ini-file not found.";
Log(LOG_WARNING, message.c_str());
message += L"\": File not found";
MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
return;
}
@ -3536,8 +3523,7 @@ void CRainmeter::RefreshAll()
std::wstring message = L"Unable to refresh skin \"" + skinConfig;
message += L"\\";
message += skinIniFile;
message += L"\": Ini-file not found.";
Log(LOG_WARNING, message.c_str());
message += L"\": File not found.";
MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
}
break;
@ -3552,7 +3538,6 @@ void CRainmeter::RefreshAll()
std::wstring message = L"Unable to refresh config \"" + skinConfig;
message += L"\": Config not found.";
Log(LOG_WARNING, message.c_str());
MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
}
continue;
@ -3654,7 +3639,7 @@ void CRainmeter::UpdateDesktopWorkArea(bool reset)
{
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;
@ -3676,7 +3661,7 @@ void CRainmeter::UpdateDesktopWorkArea(bool reset)
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)
@ -3728,7 +3713,7 @@ void CRainmeter::UpdateDesktopWorkArea(bool reset)
{
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)
{
Log(LOG_WARNING, L"Rainmeter.ini is NOT writable.");
std::wstring error = L"Rainmeter.ini is not writable. Rainmeter will not\n"
L"be able to save any settings permanently.\n\n";
@ -4473,7 +4456,7 @@ void CRainmeter::ExpandEnvironmentVariables(std::wstring& strPath)
}
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());
}
}

View File

@ -441,7 +441,7 @@ void CSystem::SetMultiMonitorInfo()
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;
MONITOR_INFO monitor = {0};
@ -839,8 +839,8 @@ bool CSystem::CheckDesktopState(HWND WorkerW)
if (CRainmeter::GetDebug())
{
LogWithArgs(LOG_DEBUG, L"System: \"%s\" has been detected.",
c_ShowDesktop ? L"Show the desktop" : L"Show open windows");
LogWithArgs(LOG_DEBUG, L"System: \"Show %s\" has been detected.",
c_ShowDesktop ? L"desktop" : L"open windows");
}
PrepareHelperWindow(WorkerW);
@ -935,7 +935,7 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
break;
case WM_DISPLAYCHANGE:
Log(LOG_NOTICE, L"System: Display setting has been changed.");
Log(LOG_NOTICE, L"System: Display settings changed");
ClearMultiMonitorInfo();
CConfigParser::ClearMultiMonitorVariables();
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
{
Log(LOG_NOTICE, L"System: Work area has been changed.");
Log(LOG_NOTICE, L"System: Work area changed");
UpdateWorkareaInfo();
CConfigParser::UpdateWorkareaVariables();
}
@ -1292,7 +1292,7 @@ std::wstring CSystem::GetTemporaryFile(const std::vector<std::wstring>& iniFileM
}
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"<>";
}
}

View File

@ -332,7 +332,7 @@ void CTintedImage::LoadImage(const std::wstring& imageName, bool bLoadAlways)
}
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);
@ -364,7 +364,7 @@ void CTintedImage::LoadImage(const std::wstring& imageName, bool bLoadAlways)
}
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();
}
}

View File

@ -34,7 +34,7 @@ void CheckVersion(void* dummy)
0);
if (hRootHandle == NULL)
{
Log(LOG_ERROR, L"CheckUpdate: InternetOpen failed.");
Log(LOG_ERROR, L"CheckUpdate: InternetOpen failed");
return;
}
@ -72,7 +72,7 @@ void CheckVersion(void* dummy)
if (version > RAINMETER_VERSION)
{
Rainmeter->SetNewVersion(true);
Log(LOG_NOTICE, L"CheckUpdate: New version available.");
Log(LOG_NOTICE, L"CheckUpdate: Update available");
}
else
{
@ -81,13 +81,13 @@ void CheckVersion(void* dummy)
}
else
{
Log(LOG_ERROR, L"CheckUpdate: InternetReadFile failed.");
Log(LOG_ERROR, L"CheckUpdate: InternetReadFile failed");
}
InternetCloseHandle(hUrlDump);
}
else
{
Log(LOG_ERROR, L"CheckUpdate: InternetOpenUrl failed.");
Log(LOG_ERROR, L"CheckUpdate: InternetOpenUrl failed");
}
InternetCloseHandle(hRootHandle);