diff --git a/Library/Meter.cpp b/Library/Meter.cpp index 0ae6721f..ce7aee92 100644 --- a/Library/Meter.cpp +++ b/Library/Meter.cpp @@ -294,19 +294,17 @@ void CMeter::ReadOptions(CConfigParser& parser, const WCHAR* section) bool oldWDefined = m_WDefined; m_W = parser.ReadInt(section, L"W", m_W); m_WDefined = parser.GetLastValueDefined(); - if (!m_WDefined && oldWDefined) + if (!m_WDefined && oldWDefined && IsFixedSize()) { m_W = 0; - parser.SetValue(section, L"W", L"0"); } bool oldHDefined = m_HDefined; m_H = parser.ReadInt(section, L"H", m_H); m_HDefined = parser.GetLastValueDefined(); - if (!m_HDefined && oldHDefined) + if (!m_HDefined && oldHDefined && IsFixedSize()) { m_H = 0; - parser.SetValue(section, L"H", L"0"); } bool oldHidden = m_Hidden; diff --git a/Library/Meter.h b/Library/Meter.h index 6ec7c76d..f97324ef 100644 --- a/Library/Meter.h +++ b/Library/Meter.h @@ -120,6 +120,8 @@ protected: virtual void ReadOptions(CConfigParser& parser, const WCHAR* section); virtual void BindMeasures(CConfigParser& parser, const WCHAR* section); + virtual bool IsFixedSize() { return true; } + bool BindPrimaryMeasure(CConfigParser& parser, const WCHAR* section, bool optional); void BindSecondaryMeasures(CConfigParser& parser, const WCHAR* section); diff --git a/Library/MeterBar.h b/Library/MeterBar.h index 1134940f..57cda520 100644 --- a/Library/MeterBar.h +++ b/Library/MeterBar.h @@ -37,6 +37,8 @@ public: protected: virtual void ReadOptions(CConfigParser& parser, const WCHAR* section); + virtual bool IsFixedSize() { return m_ImageName.empty(); } + private: enum ORIENTATION { diff --git a/Library/MeterButton.h b/Library/MeterButton.h index 280189df..c86d1f83 100644 --- a/Library/MeterButton.h +++ b/Library/MeterButton.h @@ -45,6 +45,8 @@ public: protected: virtual void ReadOptions(CConfigParser& parser, const WCHAR* section); virtual void BindMeasures(CConfigParser& parser, const WCHAR* section); + + virtual bool IsFixedSize() { return false; } private: bool HitTest2(int px, int py, bool checkAlpha); diff --git a/Library/MeterHistogram.cpp b/Library/MeterHistogram.cpp index 1ae0ff2e..a09eb33d 100644 --- a/Library/MeterHistogram.cpp +++ b/Library/MeterHistogram.cpp @@ -165,9 +165,10 @@ void CMeterHistogram::Initialize() DisposeBuffer(); // Create buffers for values - if (m_W > 0 || m_H > 0) + if (m_W >= 0 || m_H >= 0) { int maxSize = m_GraphHorizontalOrientation ? m_H : m_W; + maxSize = (maxSize == 0) ? 1 : maxSize; m_PrimaryValues = new double[maxSize](); if (secondaryMeasure) { @@ -360,6 +361,7 @@ bool CMeterHistogram::Update() ++m_MeterPos; int maxSize = m_GraphHorizontalOrientation ? m_H : m_W; + maxSize = (maxSize == 0) ? 1 : maxSize; m_MeterPos %= maxSize; m_MaxPrimaryValue = measure->GetMaxValue(); diff --git a/Library/MeterHistogram.h b/Library/MeterHistogram.h index 859beee5..b183272d 100644 --- a/Library/MeterHistogram.h +++ b/Library/MeterHistogram.h @@ -38,6 +38,8 @@ protected: virtual void ReadOptions(CConfigParser& parser, const WCHAR* section); virtual void BindMeasures(CConfigParser& parser, const WCHAR* section); + virtual bool IsFixedSize() { return m_PrimaryImageName.empty(); } + private: void DisposeBuffer(); diff --git a/Library/MeterImage.h b/Library/MeterImage.h index 72f0794b..5674114a 100644 --- a/Library/MeterImage.h +++ b/Library/MeterImage.h @@ -37,6 +37,8 @@ public: protected: virtual void ReadOptions(CConfigParser& parser, const WCHAR* section); virtual void BindMeasures(CConfigParser& parser, const WCHAR* section); + + virtual bool IsFixedSize() { return m_ImageName.empty(); } private: void LoadImage(const std::wstring& imageName, bool bLoadAlways); diff --git a/Library/MeterString.h b/Library/MeterString.h index 4e34eac9..c0d2a051 100644 --- a/Library/MeterString.h +++ b/Library/MeterString.h @@ -47,6 +47,8 @@ protected: virtual void ReadOptions(CConfigParser& parser, const WCHAR* section); virtual void BindMeasures(CConfigParser& parser, const WCHAR* section); + virtual bool IsFixedSize() { return false; } + private: enum TEXTSTYLE {