Minor code tweaks.

This commit is contained in:
spx 2012-02-07 08:32:37 +00:00
parent b5530163a2
commit 1e88fe1db3
3 changed files with 10 additions and 22 deletions

View File

@ -3978,9 +3978,8 @@ LRESULT CMeterWindow::OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lPara
} }
// Snap to other windows // Snap to other windows
const std::map<std::wstring, CMeterWindow*>& windows = m_Rainmeter->GetAllMeterWindows(); std::map<std::wstring, CMeterWindow*>::const_iterator iter = m_Rainmeter->GetAllMeterWindows().begin();
std::map<std::wstring, CMeterWindow*>::const_iterator iter = windows.begin(); for ( ; iter != m_Rainmeter->GetAllMeterWindows().end(); ++iter)
for ( ; iter != windows.end(); ++iter)
{ {
if ((*iter).second != this) if ((*iter).second != this)
{ {
@ -4908,10 +4907,8 @@ LRESULT CMeterWindow::OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
// Check that we're still alive // Check that we're still alive
bool found = false; bool found = false;
const std::map<std::wstring, CMeterWindow*>& meters = m_Rainmeter->GetAllMeterWindows(); std::map<std::wstring, CMeterWindow*>::const_iterator iter = m_Rainmeter->GetAllMeterWindows().begin();
std::map<std::wstring, CMeterWindow*>::const_iterator iter = meters.begin(); for ( ; iter != m_Rainmeter->GetAllMeterWindows().end(); ++iter)
for ( ; iter != meters.end(); ++iter)
{ {
if ((*iter).second == this) if ((*iter).second == this)
{ {

View File

@ -795,8 +795,8 @@ void CSystem::ChangeZPosInOrder()
auto resetZPos = [&](ZPOSITION zpos) auto resetZPos = [&](ZPOSITION zpos)
{ {
// Reset ZPos in Z-order (Bottom) // Reset ZPos in Z-order (Bottom)
std::vector<CMeterWindow*>::const_iterator iter = windowsInZOrder.begin(), iterEnd = windowsInZOrder.end(); std::vector<CMeterWindow*>::const_iterator iter = windowsInZOrder.begin();
for ( ; iter != iterEnd; ++iter) for ( ; iter != windowsInZOrder.end(); ++iter)
{ {
if ((*iter)->GetWindowZPosition() == zpos) if ((*iter)->GetWindowZPosition() == zpos)
{ {
@ -1036,9 +1036,8 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
} }
// Deliver WM_DISPLAYCHANGE / WM_SETTINGCHANGE message to all meter windows // Deliver WM_DISPLAYCHANGE / WM_SETTINGCHANGE message to all meter windows
const std::map<std::wstring, CMeterWindow*>& windows = Rainmeter->GetAllMeterWindows(); std::map<std::wstring, CMeterWindow*>::const_iterator iter = Rainmeter->GetAllMeterWindows().begin();
std::map<std::wstring, CMeterWindow*>::const_iterator iter = windows.begin(); for ( ; iter != Rainmeter->GetAllMeterWindows().end(); ++iter)
for ( ; iter != windows.end(); ++iter)
{ {
PostMessage((*iter).second->GetWindow(), WM_DELAYED_MOVE, (WPARAM)uMsg, (LPARAM)0); PostMessage((*iter).second->GetWindow(), WM_DELAYED_MOVE, (WPARAM)uMsg, (LPARAM)0);
} }

View File

@ -679,16 +679,8 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
if (cds->dwData == RAINMETER_QUERY_ID_SKIN_WINDOWHANDLE) if (cds->dwData == RAINMETER_QUERY_ID_SKIN_WINDOWHANDLE)
{ {
LPCWSTR configName = (LPCWSTR)cds->lpData; LPCWSTR configName = (LPCWSTR)cds->lpData;
const std::map<std::wstring, CMeterWindow*>& windows = Rainmeter->GetAllMeterWindows(); CMeterWindow* mw = Rainmeter->GetMeterWindow(configName);
std::map<std::wstring, CMeterWindow*>::const_iterator iter = windows.begin(); return (mw) ? (LRESULT)mw->GetWindow() : NULL;
for ( ; iter != windows.end(); ++iter)
{
if (wcscmp((*iter).first.c_str(), configName) == 0)
{
return (LRESULT)(*iter).second->GetWindow();
}
}
return NULL;
} }
} }
return 1; return 1;