Code cleanup.

This commit is contained in:
spx 2011-11-03 00:13:42 +00:00
parent 8339d22a0f
commit 22c36f8b49
4 changed files with 15 additions and 19 deletions

View File

@ -53,10 +53,10 @@ CMeter::CMeter(CMeterWindow* meterWindow, const WCHAR* name) : m_MeterWindow(met
m_ToolTipWidth(), m_ToolTipWidth(),
m_ToolTipDelay(), m_ToolTipDelay(),
m_ToolTipType(false), m_ToolTipType(false),
m_ToolTipHidden(false), m_ToolTipHidden(meterWindow ? meterWindow->GetMeterToolTipHidden() : false),
m_ToolTipHandle(), m_ToolTipHandle(),
m_HasMouseAction(false), m_HasMouseAction(false),
m_MouseActionCursor(true), m_MouseActionCursor(meterWindow ? meterWindow->GetMeterMouseActionCursor() : true),
m_MouseOver(false), m_MouseOver(false),
m_RelativeX(POSITION_ABSOLUTE), m_RelativeX(POSITION_ABSOLUTE),
m_RelativeY(POSITION_ABSOLUTE), m_RelativeY(POSITION_ABSOLUTE),
@ -360,14 +360,17 @@ void CMeter::ReadConfig(CConfigParser& parser, const WCHAR* section)
} }
m_W = (int)parser.ReadFormula(section, L"W", 1.0); m_W = (int)parser.ReadFormula(section, L"W", 1.0);
m_W = max(m_W, 0);
m_WDefined = parser.GetLastValueDefined(); m_WDefined = parser.GetLastValueDefined();
if (m_W < 0) m_W = 0;
m_H = (int)parser.ReadFormula(section, L"H", 1.0); m_H = (int)parser.ReadFormula(section, L"H", 1.0);
m_H = max(m_H, 0);
m_HDefined = parser.GetLastValueDefined(); m_HDefined = parser.GetLastValueDefined();
if (m_H < 0) m_H = 0;
if (!m_Initialized) if (!m_Initialized)
{ {
m_MeasureName = parser.ReadString(section, L"MeasureName", L"");
m_Hidden = 0!=parser.ReadInt(section, L"Hidden", 0); m_Hidden = 0!=parser.ReadInt(section, L"Hidden", 0);
} }
else else
@ -380,11 +383,6 @@ void CMeter::ReadConfig(CConfigParser& parser, const WCHAR* section)
} }
} }
if (!m_Initialized)
{
m_MeasureName = parser.ReadString(section, L"MeasureName", L"");
}
m_SolidBevel = (BEVELTYPE)parser.ReadInt(section, L"BevelType", BEVELTYPE_NONE); m_SolidBevel = (BEVELTYPE)parser.ReadInt(section, L"BevelType", BEVELTYPE_NONE);
m_SolidColor = parser.ReadColor(section, L"SolidColor", Color(0, 0, 0, 0)); m_SolidColor = parser.ReadColor(section, L"SolidColor", Color(0, 0, 0, 0));
@ -403,19 +401,19 @@ void CMeter::ReadConfig(CConfigParser& parser, const WCHAR* section)
m_MouseOverAction = parser.ReadString(section, L"MouseOverAction", L"", false); m_MouseOverAction = parser.ReadString(section, L"MouseOverAction", L"", false);
m_MouseLeaveAction = parser.ReadString(section, L"MouseLeaveAction", L"", false); m_MouseLeaveAction = parser.ReadString(section, L"MouseLeaveAction", L"", false);
m_MouseActionCursor = 0!=parser.ReadInt(section, L"MouseActionCursor", m_MouseActionCursor); m_MouseActionCursor = 0!=parser.ReadInt(section, L"MouseActionCursor", m_MeterWindow ? m_MeterWindow->GetMeterMouseActionCursor() : true);
m_HasMouseAction = m_HasMouseAction =
( !m_LeftMouseUpAction.empty() || !m_LeftMouseDownAction.empty() || !m_LeftMouseDoubleClickAction.empty() ( !m_LeftMouseUpAction.empty() || !m_LeftMouseDownAction.empty() || !m_LeftMouseDoubleClickAction.empty()
|| !m_MiddleMouseUpAction.empty() || !m_MiddleMouseDownAction.empty() || !m_MiddleMouseDoubleClickAction.empty() || !m_MiddleMouseUpAction.empty() || !m_MiddleMouseDownAction.empty() || !m_MiddleMouseDoubleClickAction.empty()
|| !m_RightMouseUpAction.empty() || !m_RightMouseDownAction.empty() || !m_RightMouseDoubleClickAction.empty() ); || !m_RightMouseUpAction.empty() || !m_RightMouseDownAction.empty() || !m_RightMouseDoubleClickAction.empty() );
m_ToolTipText = parser.ReadString(section, L"ToolTipText", L"", true); m_ToolTipText = parser.ReadString(section, L"ToolTipText", L"");
m_ToolTipTitle = parser.ReadString(section, L"ToolTipTitle", L"", true); m_ToolTipTitle = parser.ReadString(section, L"ToolTipTitle", L"");
m_ToolTipIcon = parser.ReadString(section, L"ToolTipIcon", L"", true); m_ToolTipIcon = parser.ReadString(section, L"ToolTipIcon", L"");
m_ToolTipWidth = (int)parser.ReadFormula(section, L"ToolTipWidth", 1000); m_ToolTipWidth = (int)parser.ReadFormula(section, L"ToolTipWidth", 1000);
m_ToolTipType = 0!=parser.ReadInt(section, L"ToolTipType", 0); m_ToolTipType = 0!=parser.ReadInt(section, L"ToolTipType", 0);
m_ToolTipHidden = 0!=parser.ReadInt(section, L"ToolTipHidden", m_ToolTipHidden); m_ToolTipHidden = 0!=parser.ReadInt(section, L"ToolTipHidden", m_MeterWindow ? m_MeterWindow->GetMeterToolTipHidden() : false);
int updateDivider = parser.ReadInt(section, L"UpdateDivider", 1); int updateDivider = parser.ReadInt(section, L"UpdateDivider", 1);
if (updateDivider != m_UpdateDivider) if (updateDivider != m_UpdateDivider)

View File

@ -73,14 +73,12 @@ public:
const std::wstring& GetToolTipText() { return m_ToolTipText; } const std::wstring& GetToolTipText() { return m_ToolTipText; }
bool HasToolTip() { return m_ToolTipHandle != NULL; } bool HasToolTip() { return m_ToolTipHandle != NULL; }
void SetToolTipHidden(bool b) { m_ToolTipHidden = b; }
void CreateToolTip(CMeterWindow* meterWindow); void CreateToolTip(CMeterWindow* meterWindow);
void UpdateToolTip(); void UpdateToolTip();
bool HasMouseAction() { return m_HasMouseAction; } bool HasMouseAction() { return m_HasMouseAction; }
bool HasMouseActionCursor() { return m_MouseActionCursor; } bool HasMouseActionCursor() { return m_MouseActionCursor; }
void SetMouseActionCursor(bool b) { m_MouseActionCursor = b; }
virtual void Hide(); virtual void Hide();
virtual void Show(); virtual void Show();

View File

@ -2260,9 +2260,6 @@ bool CMeterWindow::ReadSkin()
meter = CMeter::Create(meterName.c_str(), this, section); meter = CMeter::Create(meterName.c_str(), this, section);
if (meter) if (meter)
{ {
meter->SetMouseActionCursor(m_MouseActionCursor);
meter->SetToolTipHidden(m_ToolTipHidden);
meter->ReadConfig(m_Parser); meter->ReadConfig(m_Parser);
m_Meters.push_back(meter); m_Meters.push_back(meter);

View File

@ -235,6 +235,9 @@ public:
int GetUpdateCounter() { return m_UpdateCounter; } int GetUpdateCounter() { return m_UpdateCounter; }
int GetTransitionUpdate() { return m_TransitionUpdate; } int GetTransitionUpdate() { return m_TransitionUpdate; }
bool GetMeterToolTipHidden() { return m_ToolTipHidden; }
bool GetMeterMouseActionCursor() { return m_MouseActionCursor; }
void AddMeasureBang(const WCHAR* bang, int index, CMeasure* measure); void AddMeasureBang(const WCHAR* bang, int index, CMeasure* measure);
LRESULT OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam); LRESULT OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam);