Fixed an issue that ReadConfig() is called unnecessarily when DynamicVariables=1 and UpdateDivider=* are set.

This commit is contained in:
spx 2010-11-25 23:57:10 +00:00
parent 999ab0bd18
commit 2186b2eb2a
3 changed files with 18 additions and 10 deletions

View File

@ -37,13 +37,13 @@ public:
virtual const WCHAR* GetStats(); virtual const WCHAR* GetStats();
void SetName(const WCHAR* name) { m_Name = name; m_ANSIName = ConvertToAscii(name); }; void SetName(const WCHAR* name) { m_Name = name; m_ANSIName = ConvertToAscii(name); }
const WCHAR* GetName() { return m_Name.c_str(); }; const WCHAR* GetName() { return m_Name.c_str(); }
const char* GetANSIName() { return m_ANSIName.c_str(); }; const char* GetANSIName() { return m_ANSIName.c_str(); }
void Disable() { m_Disabled = true; }; void Disable() { m_Disabled = true; }
void Enable() { m_Disabled = false; }; void Enable() { m_Disabled = false; }
bool IsDisabled() { return m_Disabled; }; bool IsDisabled() { return m_Disabled; }
bool HasDynamicVariables() { return m_DynamicVariables; } bool HasDynamicVariables() { return m_DynamicVariables; }
@ -52,8 +52,11 @@ public:
double GetValue(); double GetValue();
double GetRelativeValue(); double GetRelativeValue();
double GetValueRange(); double GetValueRange();
double GetMinValue() { return m_MinValue; }; double GetMinValue() { return m_MinValue; }
double GetMaxValue() { return m_MaxValue; }; double GetMaxValue() { return m_MaxValue; }
UINT GetUpdateCounter() { return m_UpdateCounter; }
UINT GetUpdateDivider() { return m_UpdateDivider; }
virtual const WCHAR* GetStringValue(bool autoScale, double scale, int decimals, bool percentual); virtual const WCHAR* GetStringValue(bool autoScale, double scale, int decimals, bool percentual);
static void GetScaledValue(int decimals, double theValue, WCHAR* buffer); static void GetScaledValue(int decimals, double theValue, WCHAR* buffer);

View File

@ -89,6 +89,9 @@ public:
void SetName(const WCHAR* name) { m_Name = name; } void SetName(const WCHAR* name) { m_Name = name; }
const WCHAR* GetName() { return m_Name.c_str(); } const WCHAR* GetName() { return m_Name.c_str(); }
UINT GetUpdateCounter() { return m_UpdateCounter; }
UINT GetUpdateDivider() { return m_UpdateDivider; }
static CMeter* Create(const WCHAR* meter, CMeterWindow* meterWindow); static CMeter* Create(const WCHAR* meter, CMeterWindow* meterWindow);
static void DrawBevel(Gdiplus::Graphics& graphics, Gdiplus::Rect& rect, Gdiplus::Pen& light, Gdiplus::Pen& dark); static void DrawBevel(Gdiplus::Graphics& graphics, Gdiplus::Rect& rect, Gdiplus::Pen& light, Gdiplus::Pen& dark);

View File

@ -2409,7 +2409,8 @@ void CMeterWindow::Update(bool nodraw)
std::list<CMeasure*>::const_iterator i = m_Measures.begin(); std::list<CMeasure*>::const_iterator i = m_Measures.begin();
for( ; i != m_Measures.end(); ++i) for( ; i != m_Measures.end(); ++i)
{ {
if ((*i)->HasDynamicVariables()) if ((*i)->HasDynamicVariables() &&
((*i)->GetUpdateCounter() + 1) >= (*i)->GetUpdateDivider())
{ {
try try
{ {
@ -2429,7 +2430,8 @@ void CMeterWindow::Update(bool nodraw)
std::list<CMeter*>::const_iterator j = m_Meters.begin(); std::list<CMeter*>::const_iterator j = m_Meters.begin();
for( ; j != m_Meters.end(); ++j) for( ; j != m_Meters.end(); ++j)
{ {
if ((*j)->HasDynamicVariables()) if ((*j)->HasDynamicVariables() &&
((*j)->GetUpdateCounter() + 1) >= (*j)->GetUpdateDivider())
{ {
try try
{ {