From 71c1d052a79ba66423f135f3e108f942be18f278 Mon Sep 17 00:00:00 2001 From: Kimmo Pekkola Date: Sat, 19 Sep 2009 07:15:28 +0000 Subject: [PATCH] The relative coordinates got broken by the previous changes. They should be fixed now. Changed the meter bangs to case insensitive. --- Library/ConfigParser.cpp | 14 ++++---------- Library/ConfigParser.h | 3 ++- Library/MeterWindow.cpp | 19 +++++++++---------- Plugins/PluginAdvancedCPU/AdvancedCPU.cpp | 2 +- 4 files changed, 16 insertions(+), 22 deletions(-) diff --git a/Library/ConfigParser.cpp b/Library/ConfigParser.cpp index 5c3e2bc1..d1f68704 100644 --- a/Library/ConfigParser.cpp +++ b/Library/ConfigParser.cpp @@ -63,6 +63,7 @@ void CConfigParser::Initialize(LPCTSTR filename, CRainmeter* pRainmeter) m_Measures.clear(); m_Keys.clear(); m_Values.clear(); + m_Sections.clear(); // Set the default variables. Do this before the ini file is read so that the paths can be used with @include if (pRainmeter) @@ -506,6 +507,7 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, int depth) if (m_Keys.find(strTmp) == m_Keys.end()) { m_Keys[strTmp] = std::vector(); + m_Sections.push_back(pos); } pos = pos + wcslen(pos) + 1; } @@ -622,17 +624,9 @@ const std::wstring& CConfigParser::GetValue(const std::wstring& strSection, cons ** ** \return A list of sections in the ini file. */ -std::vector CConfigParser::GetSections() +const std::vector& CConfigParser::GetSections() { - std::vector listSections; - - stdext::hash_map >::iterator iter = m_Keys.begin(); - for ( ; iter != m_Keys.end(); iter++) - { - listSections.push_back((*iter).first); - } - - return listSections; + return m_Sections; } //============================================================================== diff --git a/Library/ConfigParser.h b/Library/ConfigParser.h index 5a22d39c..75b550d5 100644 --- a/Library/ConfigParser.h +++ b/Library/ConfigParser.h @@ -49,7 +49,7 @@ public: std::vector ReadFloats(LPCTSTR section, LPCTSTR key); std::wstring& GetFilename() { return m_Filename; } - std::vector GetSections(); + const std::vector& GetSections(); static std::vector Tokenize(const std::wstring& str, const std::wstring delimiters); @@ -71,6 +71,7 @@ private: std::wstring m_StyleTemplate; + std::vector m_Sections; // The sections must be an ordered array stdext::hash_map > m_Keys; stdext::hash_map m_Values; }; diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index ebd753bc..77742d2d 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -715,7 +715,7 @@ void CMeterWindow::ShowMeter(const WCHAR* name) std::list::iterator j = m_Meters.begin(); for( ; j != m_Meters.end(); j++) { - if (wcscmp((*j)->GetName(), name) == 0) + if (wcsicmp((*j)->GetName(), name) == 0) { (*j)->Show(); m_ResetRegion = true; // Need to recalculate the window region @@ -739,7 +739,7 @@ void CMeterWindow::HideMeter(const WCHAR* name) std::list::iterator j = m_Meters.begin(); for( ; j != m_Meters.end(); j++) { - if (wcscmp((*j)->GetName(), name) == 0) + if (wcsicmp((*j)->GetName(), name) == 0) { (*j)->Hide(); m_ResetRegion = true; // Need to recalculate the windowregion @@ -763,7 +763,7 @@ void CMeterWindow::ToggleMeter(const WCHAR* name) std::list::iterator j = m_Meters.begin(); for( ; j != m_Meters.end(); j++) { - if (wcscmp((*j)->GetName(), name) == 0) + if (wcsicmp((*j)->GetName(), name) == 0) { if ((*j)->IsHidden()) { @@ -794,7 +794,7 @@ void CMeterWindow::MoveMeter(int x, int y, const WCHAR* name) std::list::iterator j = m_Meters.begin(); for( ; j != m_Meters.end(); j++) { - if (wcscmp((*j)->GetName(), name) == 0) + if (wcsicmp((*j)->GetName(), name) == 0) { (*j)->SetX(x); (*j)->SetY(y); @@ -818,7 +818,7 @@ void CMeterWindow::EnableMeasure(const WCHAR* name) std::list::iterator i = m_Measures.begin(); for( ; i != m_Measures.end(); i++) { - if (wcscmp((*i)->GetName(), name) == 0) + if (wcsicmp((*i)->GetName(), name) == 0) { (*i)->Enable(); return; @@ -842,7 +842,7 @@ void CMeterWindow::DisableMeasure(const WCHAR* name) std::list::iterator i = m_Measures.begin(); for( ; i != m_Measures.end(); i++) { - if (wcscmp((*i)->GetName(), name) == 0) + if (wcsicmp((*i)->GetName(), name) == 0) { (*i)->Disable(); return; @@ -866,7 +866,7 @@ void CMeterWindow::ToggleMeasure(const WCHAR* name) std::list::iterator i = m_Measures.begin(); for( ; i != m_Measures.end(); i++) { - if (wcscmp((*i)->GetName(), name) == 0) + if (wcsicmp((*i)->GetName(), name) == 0) { if ((*i)->IsDisabled()) { @@ -2650,7 +2650,7 @@ LRESULT CMeterWindow::OnNcHitTest(WPARAM wParam, LPARAM lParam) */ LRESULT CMeterWindow::OnDisplayChange(WPARAM wParam, LPARAM lParam) { - return OnSettingChange(wParam, lParam); + return OnSettingChange(0, 0); } /* @@ -2680,8 +2680,7 @@ LRESULT CMeterWindow::OnSettingChange(WPARAM wParam, LPARAM lParam) PostMessage(m_Window, WM_DELAYED_REFRESH, (WPARAM)NULL, (LPARAM)NULL); } - // Commented: Calling DefWindowProc seems to cause crash sometimes - return 0; // DefWindowProc(m_Window, m_Message, wParam, lParam); + return 0; } /* diff --git a/Plugins/PluginAdvancedCPU/AdvancedCPU.cpp b/Plugins/PluginAdvancedCPU/AdvancedCPU.cpp index 9166e5b7..27e3bfab 100644 --- a/Plugins/PluginAdvancedCPU/AdvancedCPU.cpp +++ b/Plugins/PluginAdvancedCPU/AdvancedCPU.cpp @@ -303,7 +303,7 @@ void UpdateProcesses() { if(pObjInst->GetObjectInstanceName(name, 256)) { - if (wcscmp(name, L"_Total") == 0) + if (wcsicmp(name, L"_Total") == 0) { continue; }