From 5c1563e2cbee162de52cee321edb8148016865ba Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Thu, 8 Apr 2010 11:46:40 +0300 Subject: (final part) EXT-6564(major) - Fix wearable editing panels Updated Parameter panel: - removed hard coded values - improved panel layout Reviewed by Mike Antipov, Neal Orman - https://codereview.productengine.com/secondlife/r/157/ --HG-- branch : product-engine --- indra/newview/llscrollingpanelparam.cpp | 30 ++++++------- indra/newview/llscrollingpanelparam.h | 5 --- .../skins/default/xui/en/panel_scrolling_param.xml | 51 +++++++++++----------- 3 files changed, 41 insertions(+), 45 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llscrollingpanelparam.cpp b/indra/newview/llscrollingpanelparam.cpp index 7980fe1945..a5518d87d4 100644 --- a/indra/newview/llscrollingpanelparam.cpp +++ b/indra/newview/llscrollingpanelparam.cpp @@ -42,17 +42,14 @@ #include "llbutton.h" #include "llsliderctrl.h" #include "llagent.h" +#include "llviewborder.h" #include "llvoavatarself.h" // Constants for LLPanelVisualParam const F32 LLScrollingPanelParam::PARAM_STEP_TIME_THRESHOLD = 0.25f; -const S32 LLScrollingPanelParam::BTN_BORDER = 2; const S32 LLScrollingPanelParam::PARAM_HINT_WIDTH = 128; const S32 LLScrollingPanelParam::PARAM_HINT_HEIGHT = 128; -const S32 LLScrollingPanelParam::PARAM_HINT_LABEL_HEIGHT = 16; -const S32 LLScrollingPanelParam::PARAM_PANEL_WIDTH = 2 * (3* BTN_BORDER + PARAM_HINT_WIDTH + LLPANEL_BORDER_WIDTH); -const S32 LLScrollingPanelParam::PARAM_PANEL_HEIGHT = 2 * BTN_BORDER + PARAM_HINT_HEIGHT + PARAM_HINT_LABEL_HEIGHT + 4 * LLPANEL_BORDER_WIDTH; // LLScrollingPanelParam //static @@ -67,14 +64,17 @@ LLScrollingPanelParam::LLScrollingPanelParam( const LLPanel::Params& panel_param { LLUICtrlFactory::getInstance()->buildPanel(this, "panel_scrolling_param.xml"); + // *HACK To avoid hard coding texture position, lets use border's position for texture. + LLViewBorder* left_border = getChild("left_border"); + static LLUICachedControl slider_ctrl_height ("UISliderctrlHeight", 0); - S32 pos_x = 2 * LLPANEL_BORDER_WIDTH; - S32 pos_y = 3 * LLPANEL_BORDER_WIDTH + slider_ctrl_height; + S32 pos_x = left_border->getRect().mLeft + left_border->getBorderWidth(); + S32 pos_y = left_border->getRect().mBottom + left_border->getBorderWidth(); F32 min_weight = param->getMinWeight(); F32 max_weight = param->getMaxWeight(); mHintMin = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, (LLViewerVisualParam*) wearable->getVisualParam(param->getID()), min_weight); - pos_x += PARAM_HINT_WIDTH + 3 * BTN_BORDER; + pos_x = getChild("right_border")->getRect().mLeft + left_border->getBorderWidth(); mHintMax = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, (LLViewerVisualParam*) wearable->getVisualParam(param->getID()), max_weight ); mHintMin->setAllowsUpdates( FALSE ); @@ -162,6 +162,10 @@ void LLScrollingPanelParam::draw() childSetVisible("less", mHintMin->getVisible()); childSetVisible("more", mHintMax->getVisible()); + // hide borders if texture has been loaded + childSetVisible("left_border", !mHintMin->getVisible()); + childSetVisible("right_border", !mHintMax->getVisible()); + // Draw all the children except for the labels childSetVisible( "min param text", FALSE ); childSetVisible( "max param text", FALSE ); @@ -171,9 +175,7 @@ void LLScrollingPanelParam::draw() gGL.pushUIMatrix(); { const LLRect& r = mHintMin->getRect(); - F32 left = (F32)(r.mLeft + BTN_BORDER); - F32 bot = (F32)(r.mBottom + BTN_BORDER); - gGL.translateUI(left, bot, 0.f); + gGL.translateUI((F32)r.mLeft, (F32)r.mBottom, 0.f); mHintMin->draw(); } gGL.popUIMatrix(); @@ -181,9 +183,7 @@ void LLScrollingPanelParam::draw() gGL.pushUIMatrix(); { const LLRect& r = mHintMax->getRect(); - F32 left = (F32)(r.mLeft + BTN_BORDER); - F32 bot = (F32)(r.mBottom + BTN_BORDER); - gGL.translateUI(left, bot, 0.f); + gGL.translateUI((F32)r.mLeft, (F32)r.mBottom, 0.f); mHintMax->draw(); } gGL.popUIMatrix(); @@ -191,10 +191,10 @@ void LLScrollingPanelParam::draw() // Draw labels on top of the buttons childSetVisible( "min param text", TRUE ); - drawChild(getChild("min param text"), BTN_BORDER, BTN_BORDER); + drawChild(getChild("min param text")); childSetVisible( "max param text", TRUE ); - drawChild(getChild("max param text"), BTN_BORDER, BTN_BORDER); + drawChild(getChild("max param text")); } // static diff --git a/indra/newview/llscrollingpanelparam.h b/indra/newview/llscrollingpanelparam.h index 8c5db64816..fe4ce07166 100644 --- a/indra/newview/llscrollingpanelparam.h +++ b/indra/newview/llscrollingpanelparam.h @@ -75,13 +75,8 @@ public: // Constants for LLPanelVisualParam const static F32 PARAM_STEP_TIME_THRESHOLD; - const static S32 BTN_BORDER; const static S32 PARAM_HINT_WIDTH; const static S32 PARAM_HINT_HEIGHT; - const static S32 PARAM_HINT_LABEL_HEIGHT; - const static S32 PARAM_PANEL_WIDTH; - const static S32 PARAM_PANEL_HEIGHT; - public: LLViewerVisualParam* mParam; diff --git a/indra/newview/skins/default/xui/en/panel_scrolling_param.xml b/indra/newview/skins/default/xui/en/panel_scrolling_param.xml index f9c86fc75b..8042563900 100644 --- a/indra/newview/skins/default/xui/en/panel_scrolling_param.xml +++ b/indra/newview/skins/default/xui/en/panel_scrolling_param.xml @@ -1,6 +1,6 @@ + top="120" + width="120" /> + width="120" /> @@ -40,7 +40,7 @@ follows="left|top" height="16" layout="topleft" - left_pad="6" + left="155" name="Loading...2" top_delta="0" width="128"> @@ -49,30 +49,30 @@ @@ -84,10 +84,10 @@ image_selected="PushButton_Selected" image_unselected="PushButton_Off" layout="topleft" - left="2" + left="7" name="less" tab_stop="false" - top="0" + top="5" width="132" />