mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Code cleanup
This commit is contained in:
parent
fa591bdf60
commit
2f2f5e6efa
@ -1727,7 +1727,7 @@ void CMeterWindow::ScreenToWindow()
|
||||
screenx = monitors[m_WindowXScreen-1].screen.left;
|
||||
screenw = monitors[m_WindowXScreen-1].screen.right - monitors[m_WindowXScreen-1].screen.left;
|
||||
}
|
||||
if (m_WindowXFromRight == true)
|
||||
if (m_WindowXFromRight)
|
||||
{
|
||||
pixel = (screenx + screenw) - m_ScreenX;
|
||||
pixel -= m_AnchorScreenX;
|
||||
@ -1737,7 +1737,7 @@ void CMeterWindow::ScreenToWindow()
|
||||
pixel = m_ScreenX - screenx;
|
||||
pixel += m_AnchorScreenX;
|
||||
}
|
||||
if (m_WindowXPercentage == true)
|
||||
if (m_WindowXPercentage)
|
||||
{
|
||||
num = 100.0f * (float)pixel / (float)screenw;
|
||||
_snwprintf_s(buffer, _TRUNCATE, L"%.5f%%", num);
|
||||
@ -1746,11 +1746,11 @@ void CMeterWindow::ScreenToWindow()
|
||||
{
|
||||
_itow_s(pixel, buffer, 10);
|
||||
}
|
||||
if (m_WindowXFromRight == true)
|
||||
if (m_WindowXFromRight)
|
||||
{
|
||||
_snwprintf_s(buffer, _TRUNCATE, L"%sR", buffer);
|
||||
}
|
||||
if (m_WindowXScreenDefined == true)
|
||||
if (m_WindowXScreenDefined)
|
||||
{
|
||||
_snwprintf_s(buffer, _TRUNCATE, L"%s@%i", buffer, m_WindowXScreen);
|
||||
}
|
||||
@ -1768,7 +1768,7 @@ void CMeterWindow::ScreenToWindow()
|
||||
screeny = monitors[m_WindowYScreen-1].screen.top;
|
||||
screenh = monitors[m_WindowYScreen-1].screen.bottom - monitors[m_WindowYScreen-1].screen.top;
|
||||
}
|
||||
if (m_WindowYFromBottom == true)
|
||||
if (m_WindowYFromBottom)
|
||||
{
|
||||
pixel = (screeny + screenh) - m_ScreenY;
|
||||
pixel -= m_AnchorScreenY;
|
||||
@ -1778,7 +1778,7 @@ void CMeterWindow::ScreenToWindow()
|
||||
pixel = m_ScreenY - screeny;
|
||||
pixel += m_AnchorScreenY;
|
||||
}
|
||||
if (m_WindowYPercentage == true)
|
||||
if (m_WindowYPercentage)
|
||||
{
|
||||
num = 100.0f * (float)pixel / (float)screenh;
|
||||
_snwprintf_s(buffer, _TRUNCATE, L"%.5f%%", num);
|
||||
@ -1787,11 +1787,11 @@ void CMeterWindow::ScreenToWindow()
|
||||
{
|
||||
_itow_s(pixel, buffer, 10);
|
||||
}
|
||||
if (m_WindowYFromBottom == true)
|
||||
if (m_WindowYFromBottom)
|
||||
{
|
||||
_snwprintf_s(buffer, _TRUNCATE, L"%sB", buffer);
|
||||
}
|
||||
if (m_WindowYScreenDefined == true)
|
||||
if (m_WindowYScreenDefined)
|
||||
{
|
||||
_snwprintf_s(buffer, _TRUNCATE, L"%s@%i", buffer, m_WindowYScreen);
|
||||
}
|
||||
|
@ -108,9 +108,9 @@ void CSystem::Initialize(HINSTANCE instance)
|
||||
c_Monitors.monitors.reserve(4);
|
||||
SetMultiMonitorInfo();
|
||||
|
||||
WCHAR directory[MAX_PATH] = {0};
|
||||
GetCurrentDirectory(MAX_PATH, directory);
|
||||
c_WorkingDirectory = directory;
|
||||
WCHAR directory[MAX_PATH];
|
||||
DWORD len = GetCurrentDirectory(MAX_PATH, directory);
|
||||
c_WorkingDirectory.assign(directory, len <= MAX_PATH ? len : 0);
|
||||
|
||||
c_WinEventHook = SetWinEventHook(
|
||||
EVENT_SYSTEM_FOREGROUND,
|
||||
@ -1113,9 +1113,10 @@ void CSystem::ResetWorkingDirectory()
|
||||
WCHAR directory[MAX_PATH] = {0};
|
||||
GetCurrentDirectory(MAX_PATH, directory);
|
||||
|
||||
if (_wcsicmp(directory, c_WorkingDirectory.c_str()) != 0)
|
||||
const WCHAR* workDir = c_WorkingDirectory.c_str();
|
||||
if (_wcsicmp(directory, workDir) != 0)
|
||||
{
|
||||
SetCurrentDirectory(c_WorkingDirectory.c_str());
|
||||
SetCurrentDirectory(workDir);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user