summaryrefslogtreecommitdiffstats
path: root/gui/slidervalue.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--gui/slidervalue.cpp53
1 files changed, 12 insertions, 41 deletions
diff --git a/gui/slidervalue.cpp b/gui/slidervalue.cpp
index 5be58dcf3..3974c37d0 100644
--- a/gui/slidervalue.cpp
+++ b/gui/slidervalue.cpp
@@ -70,7 +70,7 @@ GUISliderValue::GUISliderValue(xml_node<>* node) : GUIObject(node)
mAction = new GUIAction(node);
- child = node->first_node("font");
+ child = FindNode(node, "font");
if (child)
{
mFont = LoadAttrFont(child, "resource");
@@ -78,21 +78,16 @@ GUISliderValue::GUISliderValue(xml_node<>* node) : GUIObject(node)
}
// Load the placement
- LoadPlacement(node->first_node("placement"), &mRenderX, &mRenderY, &mRenderW);
+ LoadPlacement(FindNode(node, "placement"), &mRenderX, &mRenderY, &mRenderW);
- child = node->first_node("colors");
+ child = FindNode(node, "colors");
if (child)
{
- attr = child->first_attribute("line");
- if (attr)
- ConvertStrToColor(attr->value(), &mLineColor);
-
- attr = child->first_attribute("slider");
- if (attr)
- ConvertStrToColor(attr->value(), &mSliderColor);
+ mLineColor = LoadAttrColor(child, "line");
+ mSliderColor = LoadAttrColor(child, "slider");
}
- child = node->first_node("resource");
+ child = FindNode(node, "resource");
if (child)
{
mBackgroundImage = LoadAttrImage(child, "background");
@@ -100,7 +95,7 @@ GUISliderValue::GUISliderValue(xml_node<>* node) : GUIObject(node)
mHandleHoverImage = LoadAttrImage(child, "handlehover");
}
- child = node->first_node("data");
+ child = FindNode(node, "data");
if (child)
{
attr = child->first_attribute("variable");
@@ -150,37 +145,13 @@ GUISliderValue::GUISliderValue(xml_node<>* node) : GUIObject(node)
mChangeOnDrag = atoi(attr->value());
}
- child = node->first_node("dimensions");
+ child = FindNode(node, "dimensions");
if (child)
{
- attr = child->first_attribute("lineh");
- if (attr)
- {
- string parsevalue = gui_parse_text(attr->value());
- mLineH = scale_theme_y(atoi(parsevalue.c_str()));
- }
-
- attr = child->first_attribute("linepadding");
- if (attr)
- {
- string parsevalue = gui_parse_text(attr->value());
- mPadding = scale_theme_x(atoi(parsevalue.c_str()));
- mLinePadding = mPadding;
- }
-
- attr = child->first_attribute("sliderw");
- if (attr)
- {
- string parsevalue = gui_parse_text(attr->value());
- mSliderW = scale_theme_x(atoi(parsevalue.c_str()));
- }
-
- attr = child->first_attribute("sliderh");
- if (attr)
- {
- string parsevalue = gui_parse_text(attr->value());
- mSliderH = scale_theme_y(atoi(parsevalue.c_str()));
- }
+ mLineH = LoadAttrIntScaleY(child, "lineh", mLineH);
+ mLinePadding = LoadAttrIntScaleX(child, "linepadding", mLinePadding);
+ mSliderW = LoadAttrIntScaleX(child, "sliderw", mSliderW);
+ mSliderH = LoadAttrIntScaleY(child, "sliderh", mSliderH);
}
mFontHeight = mFont->GetHeight();