(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
master
Dmitry Zaporozhan 2010-04-08 11:46:40 +03:00
parent 00462c2431
commit 5c1563e2cb
3 changed files with 41 additions and 45 deletions

View File

@ -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<LLViewBorder>("left_border");
static LLUICachedControl<S32> 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<LLViewBorder>("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<LLView>("min param text"), BTN_BORDER, BTN_BORDER);
drawChild(getChild<LLView>("min param text"));
childSetVisible( "max param text", TRUE );
drawChild(getChild<LLView>("max param text"), BTN_BORDER, BTN_BORDER);
drawChild(getChild<LLView>("max param text"));
}
// static

View File

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

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel
height="152"
height="157"
layout="topleft"
left="0"
name="LLScrollingPanelParam"
@ -10,25 +10,25 @@
follows="left|top"
height="16"
layout="topleft"
left="4"
left="12"
name="min param text"
top="116"
width="128" />
top="120"
width="120" />
<text
follows="left|top"
height="16"
layout="topleft"
left_pad="6"
left="155"
name="max param text"
top_delta="0"
width="128" />
width="120" />
<text
type="string"
length="1"
follows="left|top"
height="16"
layout="topleft"
left="8"
left="12"
name="Loading..."
top="11"
width="128">
@ -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 @@
<view_border
layout="topleft"
follows="left|top"
left="2"
top="0"
left="7"
top="5"
width="132"
height="132"
thickness="2"
shadow_light_color="LtGray_50"
highlight_light_color="LtGray_50"
highlight_dark_color="LtGray_50"
shadow_dark_color="LtGray_50"
shadow_light_color="0.3 0.3 0.3 1"
highlight_light_color="0.3 0.3 0.3 1"
highlight_dark_color="0.3 0.3 0.3 1"
shadow_dark_color="0.3 0.3 0.3 1"
bevel_style="in"
name="left_border"
/>
<view_border
layout="topleft"
follows="left|top"
left_pad="2"
left_pad="10"
top_delta="0"
width="132"
height="132"
thickness="2"
shadow_light_color="LtGray_50"
highlight_light_color="LtGray_50"
highlight_dark_color="LtGray_50"
shadow_dark_color="LtGray_50"
shadow_light_color="0.3 0.3 0.3 1"
highlight_light_color="0.3 0.3 0.3 1"
highlight_dark_color="0.3 0.3 0.3 1"
shadow_dark_color="0.3 0.3 0.3 1"
bevel_style="in"
name="right_border"
/>
@ -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" />
<button
enabled="false"
@ -97,7 +97,7 @@
image_selected="PushButton_Selected"
image_unselected="PushButton_Off"
layout="topleft"
left_pad="2"
left_pad="10"
name="more"
tab_stop="false"
top_delta="0"
@ -111,10 +111,11 @@
initial_value="0"
label="[DESC]"
label_width="100"
layout="topleft"
layout="bottom|left"
left="6"
max_val="100"
name="param slider"
top="134"
width="258" />
bottom="1"
width="274"
slider_label.font.style="BOLD" />
</panel>