From 35d0eeea1147868d01c0538a781b19f772583549 Mon Sep 17 00:00:00 2001 From: spx Date: Sat, 13 Nov 2010 19:45:50 +0000 Subject: [PATCH] Fixed an issue that UpdateDivider is ignored if DynamicVariables=1 is set. --- Library/Meter.cpp | 9 ++++++++- Library/MeterWindow.cpp | 8 ++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Library/Meter.cpp b/Library/Meter.cpp index 0ad9f241..f68b6e5a 100644 --- a/Library/Meter.cpp +++ b/Library/Meter.cpp @@ -276,6 +276,8 @@ void CMeter::ReadConfig(const WCHAR* section) parser.SetStyleTemplate(style); } + UINT oldUpdateDivider = m_UpdateDivider; + std::wstring oldStyleX = m_StyleX; std::wstring oldStyleY = m_StyleY; std::wstring oldStyleHidden = m_StyleHidden; @@ -410,7 +412,6 @@ void CMeter::ReadConfig(const WCHAR* section) m_MeasureName = parser.ReadString(section, L"MeasureName", L""); m_UpdateDivider = parser.ReadInt(section, L"UpdateDivider", 1); - m_UpdateCounter = m_UpdateDivider; m_AntiAlias = 0!=parser.ReadInt(section, L"AntiAlias", 0); m_DynamicVariables = 0!=parser.ReadInt(section, L"DynamicVariables", 0); @@ -427,6 +428,12 @@ void CMeter::ReadConfig(const WCHAR* section) std::wstring group = parser.ReadString(section, L"Group", L""); InitializeGroup(group); + if (!m_Initialized || + oldUpdateDivider != m_UpdateDivider) + { + m_UpdateCounter = m_UpdateDivider; + } + /* Are these necessary? if (m_W == 0 || m_H == 0) { diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index 14fb3bce..b8596155 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -2443,6 +2443,7 @@ void CMeterWindow::Update(bool nodraw) // Update the meters bool bActiveTransition = false; + bool bUpdate = false; std::list::const_iterator j = m_Meters.begin(); for( ; j != m_Meters.end(); ++j) { @@ -2453,7 +2454,10 @@ void CMeterWindow::Update(bool nodraw) (*j)->ReadConfig((*j)->GetName()); m_Parser.ClearStyleTemplate(); } - (*j)->Update(); + if ((*j)->Update()) + { + bUpdate = true; + } } catch (CError& error) { @@ -2480,7 +2484,7 @@ void CMeterWindow::Update(bool nodraw) } } - if (!nodraw) + if (!nodraw && (m_Refreshing || bUpdate)) { if (m_DynamicWindowSize) {