From e182b4ddd2e0313ac14e4dd0b4da88cd7e9e8333 Mon Sep 17 00:00:00 2001 From: JoshuaJB Date: Wed, 19 Feb 2014 21:59:07 +0000 Subject: [PATCH] Fix a valgrind warning about uninitilized variables in the scrollbar code and some comment/style fixes. This was SVN commit r14764. --- source/gui/CGUI.cpp | 14 ++++++++++---- source/gui/CTooltip.cpp | 2 +- source/gui/IGUIObject.cpp | 4 +++- source/gui/IGUIScrollBar.cpp | 4 +--- source/gui/IGUIScrollBar.h | 4 ++-- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/source/gui/CGUI.cpp b/source/gui/CGUI.cpp index 0bfadad872..7631e569cd 100644 --- a/source/gui/CGUI.cpp +++ b/source/gui/CGUI.cpp @@ -1631,7 +1631,7 @@ void CGUI::Xeromyces_ReadStyle(XMBElement Element, CXeromyces* pFile) CStr name; // - // Read Attributes + // Read Attributes // // Now we can iterate all attributes and store @@ -1650,7 +1650,7 @@ void CGUI::Xeromyces_ReadStyle(XMBElement Element, CXeromyces* pFile) } // - // Add to CGUI + // Add to CGUI // m_Styles[name] = style; @@ -1661,9 +1661,15 @@ void CGUI::Xeromyces_ReadScrollBarStyle(XMBElement Element, CXeromyces* pFile) // style object we're adding SGUIScrollBarStyle scrollbar; CStr name; - + + // Setup some defaults. + scrollbar.m_MinimumBarSize = 0.f; + // Using 1.0e100 as a substitute for infinity + scrollbar.m_MaximumBarSize = 1.0e100; + scrollbar.m_UseEdgeButtons = false; + // - // Read Attributes + // Read Attributes // // Now we can iterate all attributes and store diff --git a/source/gui/CTooltip.cpp b/source/gui/CTooltip.cpp index 75ed0e6b05..d10673c2b8 100644 --- a/source/gui/CTooltip.cpp +++ b/source/gui/CTooltip.cpp @@ -140,7 +140,7 @@ void CTooltip::SetupText() size.pixel.right -= size.pixel.left, size.pixel.left = 0.f; else if (size.pixel.right > screenw) size.pixel.left -= (size.pixel.right-screenw), size.pixel.right = screenw; - + GUI::SetSetting(this, "size", size); } diff --git a/source/gui/IGUIObject.cpp b/source/gui/IGUIObject.cpp index fa684d8028..9c359301ee 100644 --- a/source/gui/IGUIObject.cpp +++ b/source/gui/IGUIObject.cpp @@ -49,11 +49,13 @@ IGUIObject::IGUIObject() : AddSetting(GUIST_bool, "hidden"); AddSetting(GUIST_CClientArea, "size"); AddSetting(GUIST_CStr, "style"); - AddSetting(GUIST_CStr, "hotkey" ); + AddSetting(GUIST_CStr, "hotkey"); AddSetting(GUIST_float, "z"); AddSetting(GUIST_bool, "absolute"); AddSetting(GUIST_bool, "ghost"); AddSetting(GUIST_float, "aspectratio"); + AddSetting(GUIST_CStrW, "tooltip"); + AddSetting(GUIST_CStr, "tooltip_style"); // Setup important defaults GUI::SetSetting(this, "hidden", false); diff --git a/source/gui/IGUIScrollBar.cpp b/source/gui/IGUIScrollBar.cpp index 6edde8c725..b92b2097de 100644 --- a/source/gui/IGUIScrollBar.cpp +++ b/source/gui/IGUIScrollBar.cpp @@ -47,9 +47,7 @@ IGUIScrollBar::~IGUIScrollBar() void IGUIScrollBar::SetupBarSize() { if (!GetStyle()) - { return; - } float min = GetStyle()->m_MinimumBarSize; float max = GetStyle()->m_MaximumBarSize; float length = m_Length; @@ -73,7 +71,7 @@ const SGUIScrollBarStyle *IGUIScrollBar::GetStyle() const if (!m_pHostObject) return NULL; - return m_pHostObject->GetScrollBarStyle(m_ScrollBarStyle); + return m_pHostObject->GetScrollBarStyle(m_ScrollBarStyle); } CGUI *IGUIScrollBar::GetGUI() const diff --git a/source/gui/IGUIScrollBar.h b/source/gui/IGUIScrollBar.h index 6c1aab7a3a..46eb47178e 100644 --- a/source/gui/IGUIScrollBar.h +++ b/source/gui/IGUIScrollBar.h @@ -105,7 +105,7 @@ struct SGUIScrollBarStyle //@} //-------------------------------------------------------- - /** @name Horizontal Sprites */ + /** @name Vertical Sprites */ //-------------------------------------------------------- //@{ @@ -127,7 +127,7 @@ struct SGUIScrollBarStyle //@} //-------------------------------------------------------- - /** @name Vertical Sprites */ + /** @name Horizontal Sprites */ //-------------------------------------------------------- //@{