Fixed resizing of certain meters with !SetOption

This commit is contained in:
Brian Ferguson 2012-08-03 17:18:12 -06:00
parent 9f44e5cfae
commit 78542ec2be
8 changed files with 17 additions and 5 deletions

View File

@ -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;

View File

@ -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);

View File

@ -37,6 +37,8 @@ public:
protected:
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
virtual bool IsFixedSize() { return m_ImageName.empty(); }
private:
enum ORIENTATION
{

View File

@ -46,6 +46,8 @@ 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);

View File

@ -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();

View File

@ -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();

View File

@ -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_ImageName.empty(); }
private:
void LoadImage(const std::wstring& imageName, bool bLoadAlways);

View File

@ -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
{