Code cleanup & cosmetics.

This commit is contained in:
spx 2010-10-31 20:13:32 +00:00
parent b490555842
commit 1668de5a3b
11 changed files with 61 additions and 61 deletions

View File

@ -719,7 +719,7 @@ 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)
{
DebugLog(ConvertToWide(errMsg).c_str());
LSLog(LOG_DEBUG, APPNAME, ConvertToWide(errMsg).c_str());
}
return resultValue;
@ -739,7 +739,7 @@ int CConfigParser::ReadFormula(const std::wstring& result, double* resultValue)
if (errMsg != NULL)
{
DebugLog(ConvertToWide(errMsg).c_str());
LSLog(LOG_DEBUG, APPNAME, ConvertToWide(errMsg).c_str());
return -1;
}

View File

@ -84,7 +84,7 @@ bool CMeasureCalc::Update()
char* errMsg = MathParser_Parse(m_Parser, ConvertToAscii(m_Formula.c_str()).c_str(), &m_Value);
if (errMsg != NULL)
{
DebugLog(ConvertToWide(errMsg).c_str());
LSLog(LOG_DEBUG, APPNAME, ConvertToWide(errMsg).c_str());
}
return PostUpdate();

View File

@ -173,7 +173,7 @@ void CMeasureDiskSpace::ReadConfig(CConfigParser& parser, const WCHAR* section)
m_Drive = parser.ReadString(section, L"Drive", L"C:\\");
if (m_Drive.empty())
{
DebugLog(L"Drive path is not given.");
LSLog(LOG_DEBUG, APPNAME, L"Drive path is not given.");
m_Value = 0;
m_LabelName = L"";
}

View File

@ -114,7 +114,7 @@ void CMeasureNet::UpdateIFTable()
if (CRainmeter::GetDebug() && logging)
{
DebugLog(L"------------------------------");
LSLog(LOG_DEBUG, APPNAME, L"------------------------------");
DebugLog(L"* NETWORK-INTERFACE: Count=%i", c_NumOfTables);
for (size_t i = 0; i < c_NumOfTables; ++i)
@ -151,7 +151,7 @@ void CMeasureNet::UpdateIFTable()
(ifTable->Table[i].InterfaceAndOperStatusFlags.HardwareInterface == 1) ? L"Yes" : L"No",
(ifTable->Table[i].InterfaceAndOperStatusFlags.FilterInterface == 1) ? L"Yes" : L"No");
}
DebugLog(L"------------------------------");
LSLog(LOG_DEBUG, APPNAME, L"------------------------------");
}
}
else
@ -209,7 +209,7 @@ void CMeasureNet::UpdateIFTable()
if (CRainmeter::GetDebug() && logging)
{
DebugLog(L"------------------------------");
LSLog(LOG_DEBUG, APPNAME, L"------------------------------");
DebugLog(L"* NETWORK-INTERFACE: Count=%i", c_NumOfTables);
for (size_t i = 0; i < c_NumOfTables; ++i)
@ -246,7 +246,7 @@ void CMeasureNet::UpdateIFTable()
DebugLog(L" Type=%s(%i)",
type.c_str(), ifTable->table[i].dwType);
}
DebugLog(L"------------------------------");
LSLog(LOG_DEBUG, APPNAME, L"------------------------------");
}
}
else

View File

@ -421,7 +421,7 @@ void CMeter::ReadConfig(const WCHAR* section)
}
else if (!matrix.empty())
{
DebugLog(L"The transformation matrix has incorrect number of values:", parser.ReadString(section, L"TransformationMatrix", L"").c_str());
DebugLog(L"The transformation matrix has incorrect number of values: %s", parser.ReadString(section, L"TransformationMatrix", L"").c_str());
}
std::wstring group = parser.ReadString(section, L"Group", L"");

View File

@ -161,7 +161,7 @@ void CMeterHistogram::Initialize()
// A sanity check
if (m_SecondaryMeasure && !m_PrimaryImageName.empty() && (m_BothImageName.empty() || m_SecondaryImageName.empty()))
{
LSLog(LOG_DEBUG, L"Rainmeter", L"You need to define SecondaryImage and BothImage also!");
LSLog(LOG_DEBUG, APPNAME, L"You need to define SecondaryImage and BothImage also!");
if (m_PrimaryBitmap)
{

View File

@ -134,7 +134,7 @@ void CMeterString::Initialize()
{
std::wstring error = L"Error: Couldn't load font family: ";
error += m_FontFace;
DebugLog(error.c_str());
LSLog(LOG_DEBUG, APPNAME, error.c_str());
delete m_FontFamily;
m_FontFamily = NULL;
@ -755,23 +755,23 @@ void CMeterString::EnumerateInstalledFontFamilies()
}
fonts += L", ";
}
LSLog(LOG_DEBUG, L"Rainmeter", fonts.c_str());
LSLog(LOG_DEBUG, APPNAME, fonts.c_str());
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Failed to enumerate installed font families: GetFamilies() failed.");
LSLog(LOG_DEBUG, APPNAME, L"Failed to enumerate installed font families: GetFamilies() failed.");
}
delete [] fontFamilies;
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"There are no installed font families!");
LSLog(LOG_DEBUG, APPNAME, L"There are no installed font families!");
}
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"Failed to enumerate installed font families: InstalledFontCollection() failed.");
LSLog(LOG_DEBUG, APPNAME, L"Failed to enumerate installed font families: InstalledFontCollection() failed.");
}
}

View File

@ -258,7 +258,7 @@ int CMeterWindow::Initialize(CRainmeter& Rainmeter)
}
}
LSLog(LOG_DEBUG, L"Rainmeter", L"Initialization successful.");
LSLog(LOG_DEBUG, APPNAME, L"Initialization successful.");
return 0;
}
@ -305,7 +305,7 @@ void CMeterWindow::Refresh(bool init, bool all)
std::wstring dbg = L"Refreshing skin \"" + m_SkinName;
dbg += L"\\" + m_SkinIniFile;
dbg += L"\"";
LSLog(LOG_DEBUG, L"Rainmeter", dbg.c_str());
LSLog(LOG_DEBUG, APPNAME, dbg.c_str());
m_Refreshing = true;
@ -754,7 +754,7 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
}
else
{
DebugLog(L"Unable to parse parameters for !RainmeterMove");
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse parameters for !RainmeterMove");
}
break;
@ -866,12 +866,12 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
}
else
{
DebugLog(L"Unable to parse coordinates for !RainmeterMoveMeter");
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse coordinates for !RainmeterMoveMeter");
}
}
else
{
DebugLog(L"Unable to parse parameters for !RainmeterMoveMeter");
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse parameters for !RainmeterMoveMeter");
}
break;
@ -913,7 +913,7 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
}
else
{
DebugLog(L"Unable to parse parameters for !RainmeterPluginBang");
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse parameters for !RainmeterPluginBang");
}
}
break;
@ -944,7 +944,7 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
}
else
{
DebugLog(L"Unable to parse parameters for !RainmeterSetVariable");
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse parameters for !RainmeterSetVariable");
}
break;
}
@ -1177,7 +1177,7 @@ void CMeterWindow::WindowToScreen()
{
if (CSystem::GetMonitorCount() == 0)
{
DebugLog(L"There are no monitors. WindowToScreen function fails.");
LSLog(LOG_DEBUG, APPNAME, L"There are no monitors. WindowToScreen function fails.");
return;
}
@ -1403,7 +1403,7 @@ void CMeterWindow::ScreenToWindow()
if (monitors.empty())
{
DebugLog(L"There are no monitors. ScreenToWindow function fails.");
LSLog(LOG_DEBUG, APPNAME, L"There are no monitors. ScreenToWindow function fails.");
return;
}
@ -1836,7 +1836,7 @@ bool CMeterWindow::ReadSkin()
{
std::wstring error = L"Error: Couldn't load font file: ";
error += localFont;
DebugLog(error.c_str());
LSLog(LOG_DEBUG, APPNAME, error.c_str());
}
}
@ -1880,7 +1880,7 @@ bool CMeterWindow::ReadSkin()
{
std::wstring error = L"Error: Couldn't load font file: ";
error += localFont;
DebugLog(error.c_str());
LSLog(LOG_DEBUG, APPNAME, error.c_str());
}
}
}
@ -2007,14 +2007,14 @@ bool CMeterWindow::ReadSkin()
{
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.";
MessageBox(m_Window, text.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
m_Rainmeter->DeactivateConfig(this, -1);
return false;
}
else
{
text += L"\" does not contain any meters.\nDo you want to deactivate this skin?";
if (IDYES == MessageBox(m_Window, text.c_str(), APPNAME, MB_YESNO | MB_TOPMOST | MB_ICONEXCLAMATION))
{
m_Rainmeter->DeactivateConfig(this, -1);
return false;
}
}
}
@ -4508,7 +4508,7 @@ LRESULT CMeterWindow::OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam)
}
if (!found)
{
DebugLog(L"Unable to send the !bang to a deactivated config.");
LSLog(LOG_DEBUG, APPNAME, L"Unable to send the !bang to a deactivated config.");
return 0; // This meterwindow has been deactivated
}

View File

@ -248,7 +248,7 @@ void BangWithArgs(BANGCOMMAND bang, const WCHAR* arg, size_t numOfArgs)
}
else
{
DebugLog(L"Incorrect number of arguments for the bang!");
LSLog(LOG_DEBUG, APPNAME, L"Incorrect number of arguments for the bang!");
}
}
}
@ -286,7 +286,7 @@ void BangGroupWithArgs(BANGCOMMAND bang, const WCHAR* arg, size_t numOfArgs)
}
else
{
DebugLog(L"Incorrect number of arguments for the group bang!");
LSLog(LOG_DEBUG, APPNAME, L"Incorrect number of arguments for the group bang!");
}
}
}
@ -496,7 +496,7 @@ void RainmeterActivateConfig(HWND, const char* arg)
else
{
// If we got this far, something went wrong
DebugLog(L"Unable to parse the arguments for !RainmeterActivateConfig");
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse the arguments for !RainmeterActivateConfig");
}
}
}
@ -525,7 +525,7 @@ void RainmeterDeactivateConfig(HWND, const char* arg)
}
else
{
DebugLog(L"Unable to parse the arguments for !RainmeterDeactivateConfig");
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse the arguments for !RainmeterDeactivateConfig");
}
}
}
@ -556,7 +556,7 @@ void RainmeterToggleConfig(HWND, const char* arg)
}
else
{
DebugLog(L"Unable to parse the arguments for !RainmeterToggleConfig");
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse the arguments for !RainmeterToggleConfig");
}
}
}
@ -828,7 +828,7 @@ void RainmeterDeactivateConfigGroup(HWND, const char* arg)
}
else
{
DebugLog(L"Unable to parse the arguments for !RainmeterDeactivateConfigGroup");
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse the arguments for !RainmeterDeactivateConfigGroup");
}
}
}
@ -961,7 +961,7 @@ void RainmeterSkinMenu(HWND, const char* arg)
}
else
{
DebugLog(L"Unable to parse the arguments for !RainmeterSkinMenu");
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse the arguments for !RainmeterSkinMenu");
}
}
}
@ -1136,7 +1136,7 @@ void RainmeterWriteKeyValue(HWND, const char* arg)
}
else
{
DebugLog(L"Unable to parse the arguments for !RainmeterWriteKeyValue");
LSLog(LOG_DEBUG, APPNAME, L"Unable to parse the arguments for !RainmeterWriteKeyValue");
}
}
}
@ -1431,7 +1431,7 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
}
else
{
DebugLog(L"Unable to get the My Documents location.");
LSLog(LOG_DEBUG, APPNAME, L"Unable to get the My Documents location.");
}
}
WritePrivateProfileString(L"Rainmeter", L"SkinPath", m_SkinPath.c_str(), m_IniFile.c_str());
@ -3767,7 +3767,7 @@ void CRainmeter::TestSettingsFile(bool bDefaultIniLocation)
}
if (!bSuccess)
{
DebugLog(L"The Rainmeter.ini file is NOT writable.");
LSLog(LOG_DEBUG, APPNAME, L"The Rainmeter.ini file is NOT writable.");
std::wstring error;
error += L"The Rainmeter.ini file is not writable. This means that the\n";
@ -3799,7 +3799,7 @@ void CRainmeter::TestSettingsFile(bool bDefaultIniLocation)
}
else
{
DebugLog(L"The Rainmeter.ini file is writable.");
LSLog(LOG_DEBUG, APPNAME, L"The Rainmeter.ini file is writable.");
}
}

View File

@ -171,7 +171,7 @@ BOOL CALLBACK MyInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonit
if (CRainmeter::GetDebug())
{
DebugLog(info.szDevice);
LSLog(LOG_DEBUG, APPNAME, info.szDevice);
DebugLog(L" Flags : %s(0x%08X)", (info.dwFlags & MONITORINFOF_PRIMARY) ? L"PRIMARY " : L"", info.dwFlags);
DebugLog(L" Handle : 0x%08X", hMonitor);
DebugLog(L" ScrArea : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)",
@ -270,8 +270,8 @@ void CSystem::SetMultiMonitorInfo()
if (logging)
{
DebugLog(L"------------------------------");
DebugLog(L"* EnumDisplayDevices / EnumDisplaySettings API");
LSLog(LOG_DEBUG, APPNAME, L"------------------------------");
LSLog(LOG_DEBUG, APPNAME, L"* EnumDisplayDevices / EnumDisplaySettings API");
}
DISPLAY_DEVICE dd = {0};
@ -287,7 +287,7 @@ void CSystem::SetMultiMonitorInfo()
if (logging)
{
DebugLog(dd.DeviceName);
LSLog(LOG_DEBUG, APPNAME, dd.DeviceName);
if (dd.StateFlags & DISPLAY_DEVICE_ACTIVE)
{
@ -427,15 +427,15 @@ void CSystem::SetMultiMonitorInfo()
if (monitors.empty()) // Failed to enumerate the non-mirroring monitors
{
DebugLog(L"Failed to enumerate the non-mirroring monitors. Only EnumDisplayMonitors is used instead.");
LSLog(LOG_DEBUG, APPNAME, L"Failed to enumerate the non-mirroring monitors. Only EnumDisplayMonitors is used instead.");
c_Monitors.useEnumDisplayDevices = false;
c_Monitors.useEnumDisplayMonitors = true;
}
if (logging)
{
DebugLog(L"------------------------------");
DebugLog(L"* EnumDisplayMonitors API");
LSLog(LOG_DEBUG, APPNAME, L"------------------------------");
LSLog(LOG_DEBUG, APPNAME, L"* EnumDisplayMonitors API");
}
if (c_Monitors.useEnumDisplayMonitors)
@ -444,7 +444,7 @@ void CSystem::SetMultiMonitorInfo()
if (monitors.empty()) // Failed to enumerate the monitors
{
DebugLog(L"Failed to enumerate the monitors. Prepares the dummy monitor information.");
LSLog(LOG_DEBUG, APPNAME, L"Failed to enumerate the monitors. Prepares the dummy monitor information.");
c_Monitors.useEnumDisplayMonitors = false;
MONITOR_INFO monitor = {0};
@ -473,7 +473,7 @@ void CSystem::SetMultiMonitorInfo()
if (logging)
{
DebugLog(L"------------------------------");
LSLog(LOG_DEBUG, APPNAME, L"------------------------------");
std::wstring method = L"* METHOD: ";
if (c_Monitors.useEnumDisplayDevices)
@ -485,10 +485,10 @@ void CSystem::SetMultiMonitorInfo()
{
method += c_Monitors.useEnumDisplayMonitors ? L"EnumDisplayMonitors Mode" : L"Dummy Mode";
}
DebugLog(method.c_str());
LSLog(LOG_DEBUG, APPNAME, method.c_str());
DebugLog(L"* MONITORS: Count=%i, Primary=@%i", monitors.size(), c_Monitors.primary);
DebugLog(L"@0: Virtual screen");
LSLog(LOG_DEBUG, APPNAME, L"@0: Virtual screen");
DebugLog(L" L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)",
c_Monitors.vsL, c_Monitors.vsT, c_Monitors.vsL + c_Monitors.vsW, c_Monitors.vsT + c_Monitors.vsH,
c_Monitors.vsW, c_Monitors.vsH);
@ -507,7 +507,7 @@ void CSystem::SetMultiMonitorInfo()
DebugLog(L"@%i: %s (inactive), MonitorName: %s", i + 1, monitors[i].deviceName, monitors[i].monitorName);
}
}
DebugLog(L"------------------------------");
LSLog(LOG_DEBUG, APPNAME, L"------------------------------");
}
}
@ -717,7 +717,7 @@ void CSystem::ChangeZPosInOrder()
bool logging = CRainmeter::GetDebug() && DEBUG_VERBOSE;
std::vector<CMeterWindow*> windowsInZOrder;
if (logging) LSLog(LOG_DEBUG, L"Rainmeter", L"1: ----- BEFORE -----");
if (logging) LSLog(LOG_DEBUG, APPNAME, L"1: ----- BEFORE -----");
// Retrieve the Rainmeter's meter windows in Z-order
EnumWindows(MyEnumWindowsProc, (LPARAM)(&windowsInZOrder));
@ -730,7 +730,7 @@ void CSystem::ChangeZPosInOrder()
if (logging)
{
LSLog(LOG_DEBUG, L"Rainmeter", L"2: ----- AFTER -----");
LSLog(LOG_DEBUG, APPNAME, L"2: ----- AFTER -----");
// Log all windows in Z-order
EnumWindows(MyEnumWindowsProc, (LPARAM)NULL);
@ -927,7 +927,7 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
break;
case WM_DWMCOMPOSITIONCHANGED:
DebugLog(L"System: DWM desktop composition has been changed.");
LSLog(LOG_DEBUG, APPNAME, L"System: DWM desktop composition has been changed.");
KillTimer(c_Window, TIMER_SHOWDESKTOP);
KillTimer(c_Window, TIMER_COMPOSITION);
@ -946,7 +946,7 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
return 0;
case WM_DISPLAYCHANGE:
DebugLog(L"System: Display setting has been changed.");
LSLog(LOG_DEBUG, APPNAME, L"System: Display setting has been changed.");
ClearMultiMonitorInfo();
CConfigParser::ClearMultiMonitorVariables();
case WM_SETTINGCHANGE:
@ -954,7 +954,7 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
{
if (uMsg == WM_SETTINGCHANGE) // SPI_SETWORKAREA
{
DebugLog(L"System: Work area has been changed.");
LSLog(LOG_DEBUG, APPNAME, L"System: Work area has been changed.");
UpdateWorkareaInfo();
CConfigParser::UpdateWorkareaVariables();
}

View File

@ -33,7 +33,7 @@ void CheckVersion(void* dummy)
0);
if (hRootHandle == NULL)
{
DebugLog(L"CheckUpdate: InternetOpen failed.");
LSLog(LOG_DEBUG, APPNAME, L"CheckUpdate: InternetOpen failed.");
return;
}
@ -75,18 +75,18 @@ void CheckVersion(void* dummy)
else
{
Rainmeter->SetNewVersion(FALSE);
DebugLog(L"CheckUpdate: No new version available.");
LSLog(LOG_DEBUG, APPNAME, L"CheckUpdate: No new version available.");
}
}
else
{
DebugLog(L"CheckUpdate: InternetReadFile failed.");
LSLog(LOG_DEBUG, APPNAME, L"CheckUpdate: InternetReadFile failed.");
}
InternetCloseHandle(hUrlDump);
}
else
{
DebugLog(L"CheckUpdate: InternetOpenUrl failed.");
LSLog(LOG_DEBUG, APPNAME, L"CheckUpdate: InternetOpenUrl failed.");
}
InternetCloseHandle(hRootHandle);