The relative coordinates got broken by the previous changes. They should be fixed now.

Changed the meter bangs to case insensitive.
This commit is contained in:
Kimmo Pekkola 2009-09-19 07:15:28 +00:00
parent fa6d437a71
commit 71c1d052a7
4 changed files with 16 additions and 22 deletions

View File

@ -63,6 +63,7 @@ void CConfigParser::Initialize(LPCTSTR filename, CRainmeter* pRainmeter)
m_Measures.clear(); m_Measures.clear();
m_Keys.clear(); m_Keys.clear();
m_Values.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 // Set the default variables. Do this before the ini file is read so that the paths can be used with @include
if (pRainmeter) if (pRainmeter)
@ -506,6 +507,7 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, int depth)
if (m_Keys.find(strTmp) == m_Keys.end()) if (m_Keys.find(strTmp) == m_Keys.end())
{ {
m_Keys[strTmp] = std::vector<std::wstring>(); m_Keys[strTmp] = std::vector<std::wstring>();
m_Sections.push_back(pos);
} }
pos = pos + wcslen(pos) + 1; 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. ** \return A list of sections in the ini file.
*/ */
std::vector<std::wstring> CConfigParser::GetSections() const std::vector<std::wstring>& CConfigParser::GetSections()
{ {
std::vector<std::wstring> listSections; return m_Sections;
stdext::hash_map<std::wstring, std::vector<std::wstring> >::iterator iter = m_Keys.begin();
for ( ; iter != m_Keys.end(); iter++)
{
listSections.push_back((*iter).first);
}
return listSections;
} }
//============================================================================== //==============================================================================

View File

@ -49,7 +49,7 @@ public:
std::vector<Gdiplus::REAL> ReadFloats(LPCTSTR section, LPCTSTR key); std::vector<Gdiplus::REAL> ReadFloats(LPCTSTR section, LPCTSTR key);
std::wstring& GetFilename() { return m_Filename; } std::wstring& GetFilename() { return m_Filename; }
std::vector<std::wstring> GetSections(); const std::vector<std::wstring>& GetSections();
static std::vector<std::wstring> Tokenize(const std::wstring& str, const std::wstring delimiters); static std::vector<std::wstring> Tokenize(const std::wstring& str, const std::wstring delimiters);
@ -71,6 +71,7 @@ private:
std::wstring m_StyleTemplate; std::wstring m_StyleTemplate;
std::vector<std::wstring> m_Sections; // The sections must be an ordered array
stdext::hash_map<std::wstring, std::vector<std::wstring> > m_Keys; stdext::hash_map<std::wstring, std::vector<std::wstring> > m_Keys;
stdext::hash_map<std::wstring, std::wstring> m_Values; stdext::hash_map<std::wstring, std::wstring> m_Values;
}; };

View File

@ -715,7 +715,7 @@ void CMeterWindow::ShowMeter(const WCHAR* name)
std::list<CMeter*>::iterator j = m_Meters.begin(); std::list<CMeter*>::iterator j = m_Meters.begin();
for( ; j != m_Meters.end(); j++) for( ; j != m_Meters.end(); j++)
{ {
if (wcscmp((*j)->GetName(), name) == 0) if (wcsicmp((*j)->GetName(), name) == 0)
{ {
(*j)->Show(); (*j)->Show();
m_ResetRegion = true; // Need to recalculate the window region m_ResetRegion = true; // Need to recalculate the window region
@ -739,7 +739,7 @@ void CMeterWindow::HideMeter(const WCHAR* name)
std::list<CMeter*>::iterator j = m_Meters.begin(); std::list<CMeter*>::iterator j = m_Meters.begin();
for( ; j != m_Meters.end(); j++) for( ; j != m_Meters.end(); j++)
{ {
if (wcscmp((*j)->GetName(), name) == 0) if (wcsicmp((*j)->GetName(), name) == 0)
{ {
(*j)->Hide(); (*j)->Hide();
m_ResetRegion = true; // Need to recalculate the windowregion m_ResetRegion = true; // Need to recalculate the windowregion
@ -763,7 +763,7 @@ void CMeterWindow::ToggleMeter(const WCHAR* name)
std::list<CMeter*>::iterator j = m_Meters.begin(); std::list<CMeter*>::iterator j = m_Meters.begin();
for( ; j != m_Meters.end(); j++) for( ; j != m_Meters.end(); j++)
{ {
if (wcscmp((*j)->GetName(), name) == 0) if (wcsicmp((*j)->GetName(), name) == 0)
{ {
if ((*j)->IsHidden()) if ((*j)->IsHidden())
{ {
@ -794,7 +794,7 @@ void CMeterWindow::MoveMeter(int x, int y, const WCHAR* name)
std::list<CMeter*>::iterator j = m_Meters.begin(); std::list<CMeter*>::iterator j = m_Meters.begin();
for( ; j != m_Meters.end(); j++) for( ; j != m_Meters.end(); j++)
{ {
if (wcscmp((*j)->GetName(), name) == 0) if (wcsicmp((*j)->GetName(), name) == 0)
{ {
(*j)->SetX(x); (*j)->SetX(x);
(*j)->SetY(y); (*j)->SetY(y);
@ -818,7 +818,7 @@ void CMeterWindow::EnableMeasure(const WCHAR* name)
std::list<CMeasure*>::iterator i = m_Measures.begin(); std::list<CMeasure*>::iterator i = m_Measures.begin();
for( ; i != m_Measures.end(); i++) for( ; i != m_Measures.end(); i++)
{ {
if (wcscmp((*i)->GetName(), name) == 0) if (wcsicmp((*i)->GetName(), name) == 0)
{ {
(*i)->Enable(); (*i)->Enable();
return; return;
@ -842,7 +842,7 @@ void CMeterWindow::DisableMeasure(const WCHAR* name)
std::list<CMeasure*>::iterator i = m_Measures.begin(); std::list<CMeasure*>::iterator i = m_Measures.begin();
for( ; i != m_Measures.end(); i++) for( ; i != m_Measures.end(); i++)
{ {
if (wcscmp((*i)->GetName(), name) == 0) if (wcsicmp((*i)->GetName(), name) == 0)
{ {
(*i)->Disable(); (*i)->Disable();
return; return;
@ -866,7 +866,7 @@ void CMeterWindow::ToggleMeasure(const WCHAR* name)
std::list<CMeasure*>::iterator i = m_Measures.begin(); std::list<CMeasure*>::iterator i = m_Measures.begin();
for( ; i != m_Measures.end(); i++) for( ; i != m_Measures.end(); i++)
{ {
if (wcscmp((*i)->GetName(), name) == 0) if (wcsicmp((*i)->GetName(), name) == 0)
{ {
if ((*i)->IsDisabled()) if ((*i)->IsDisabled())
{ {
@ -2650,7 +2650,7 @@ LRESULT CMeterWindow::OnNcHitTest(WPARAM wParam, LPARAM lParam)
*/ */
LRESULT CMeterWindow::OnDisplayChange(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); PostMessage(m_Window, WM_DELAYED_REFRESH, (WPARAM)NULL, (LPARAM)NULL);
} }
// Commented: Calling DefWindowProc seems to cause crash sometimes return 0;
return 0; // DefWindowProc(m_Window, m_Message, wParam, lParam);
} }
/* /*

View File

@ -303,7 +303,7 @@ void UpdateProcesses()
{ {
if(pObjInst->GetObjectInstanceName(name, 256)) if(pObjInst->GetObjectInstanceName(name, 256))
{ {
if (wcscmp(name, L"_Total") == 0) if (wcsicmp(name, L"_Total") == 0)
{ {
continue; continue;
} }