summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llscrollingpanelparam.cpp71
-rw-r--r--indra/newview/llscrollingpanelparam.h9
2 files changed, 42 insertions, 38 deletions
diff --git a/indra/newview/llscrollingpanelparam.cpp b/indra/newview/llscrollingpanelparam.cpp
index a77c387573..833eaaf8ca 100644
--- a/indra/newview/llscrollingpanelparam.cpp
+++ b/indra/newview/llscrollingpanelparam.cpp
@@ -53,44 +53,39 @@ LLScrollingPanelParam::LLScrollingPanelParam( const LLPanel::Params& panel_param
LLViewerJointMesh* mesh, LLViewerVisualParam* param, bool allow_modify, LLWearable* wearable, LLJoint* jointp, bool use_hints )
: LLScrollingPanelParamBase( panel_params, mesh, param, allow_modify, wearable, jointp, use_hints)
{
- // *HACK To avoid hard coding texture position, lets use border's position for texture.
- LLViewBorder* left_border = getChild<LLViewBorder>("left_border");
-
+ mLessBtn = getChild<LLButton>("less");
+ mMoreBtn = getChild<LLButton>("more");
+ mLeftBorder = getChild<LLViewBorder>("left_border");
+ mRightBorder = getChild<LLViewBorder>("right_border");
+ mMinParamText = getChild<LLUICtrl>("min param text");
+ mMaxParamText = getChild<LLUICtrl>("max param text");
+
+ // *HACK To avoid hard coding texture position, lets use border's position for texture.
static LLUICachedControl<S32> slider_ctrl_height ("UISliderctrlHeight", 0);
- S32 pos_x = left_border->getRect().mLeft + left_border->getBorderWidth();
- S32 pos_y = left_border->getRect().mBottom + left_border->getBorderWidth();
+ S32 pos_x = mLeftBorder->getRect().mLeft + mLeftBorder->getBorderWidth();
+ S32 pos_y = mLeftBorder->getRect().mBottom + mLeftBorder->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()), wearable, min_weight, jointp);
- pos_x = getChild<LLViewBorder>("right_border")->getRect().mLeft + left_border->getBorderWidth();
+ pos_x = mRightBorder->getRect().mLeft + mLeftBorder->getBorderWidth();
mHintMax = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, (LLViewerVisualParam*) wearable->getVisualParam(param->getID()), wearable, max_weight, jointp );
mHintMin->setAllowsUpdates( false );
mHintMax->setAllowsUpdates( false );
- std::string min_name = LLTrans::getString(param->getMinDisplayName());
- std::string max_name = LLTrans::getString(param->getMaxDisplayName());
- getChild<LLUICtrl>("min param text")->setValue(min_name);
- getChild<LLUICtrl>("max param text")->setValue(max_name);
+ mMinParamText->setValue(LLTrans::getString(param->getMinDisplayName()));
+ mMaxParamText->setValue(LLTrans::getString(param->getMaxDisplayName()));
- LLButton* less = getChild<LLButton>("less");
- if (less)
- {
- less->setMouseDownCallback( LLScrollingPanelParam::onHintMinMouseDown, this );
- less->setMouseUpCallback( LLScrollingPanelParam::onHintMinMouseUp, this );
- less->setHeldDownCallback( LLScrollingPanelParam::onHintMinHeldDown, this );
- less->setHeldDownDelay( PARAM_STEP_TIME_THRESHOLD );
- }
+ mLessBtn->setMouseDownCallback(LLScrollingPanelParam::onHintMinMouseDown, this);
+ mLessBtn->setMouseUpCallback(LLScrollingPanelParam::onHintMinMouseUp, this);
+ mLessBtn->setHeldDownCallback(LLScrollingPanelParam::onHintMinHeldDown, this);
+ mLessBtn->setHeldDownDelay(PARAM_STEP_TIME_THRESHOLD);
- LLButton* more = getChild<LLButton>("more");
- if (more)
- {
- more->setMouseDownCallback( LLScrollingPanelParam::onHintMaxMouseDown, this );
- more->setMouseUpCallback( LLScrollingPanelParam::onHintMaxMouseUp, this );
- more->setHeldDownCallback( LLScrollingPanelParam::onHintMaxHeldDown, this );
- more->setHeldDownDelay( PARAM_STEP_TIME_THRESHOLD );
- }
+ mMoreBtn->setMouseDownCallback(LLScrollingPanelParam::onHintMaxMouseDown, this);
+ mMoreBtn->setMouseUpCallback(LLScrollingPanelParam::onHintMaxMouseUp, this);
+ mMoreBtn->setHeldDownCallback(LLScrollingPanelParam::onHintMaxHeldDown, this);
+ mMoreBtn->setHeldDownDelay(PARAM_STEP_TIME_THRESHOLD);
setVisible(false);
setBorderVisible( false );
@@ -110,8 +105,8 @@ void LLScrollingPanelParam::updatePanel(bool allow_modify)
mHintMin->requestUpdate( sUpdateDelayFrames++ );
mHintMax->requestUpdate( sUpdateDelayFrames++ );
- getChildView("less")->setEnabled(mAllowModify);
- getChildView("more")->setEnabled(mAllowModify);
+ mLessBtn->setEnabled(mAllowModify);
+ mMoreBtn->setEnabled(mAllowModify);
}
void LLScrollingPanelParam::setVisible( bool visible )
@@ -141,16 +136,16 @@ void LLScrollingPanelParam::draw()
return;
}
- getChildView("less")->setVisible( mHintMin->getVisible());
- getChildView("more")->setVisible( mHintMax->getVisible());
+ mLessBtn->setVisible( mHintMin->getVisible());
+ mMoreBtn->setVisible( mHintMax->getVisible());
// hide borders if texture has been loaded
- getChildView("left_border")->setVisible( !mHintMin->getVisible());
- getChildView("right_border")->setVisible( !mHintMax->getVisible());
+ mLeftBorder->setVisible( !mHintMin->getVisible());
+ mRightBorder->setVisible( !mHintMax->getVisible());
// Draw all the children except for the labels
- getChildView("min param text")->setVisible( false );
- getChildView("max param text")->setVisible( false );
+ mMinParamText->setVisible( false );
+ mMaxParamText->setVisible( false );
LLPanel::draw();
// If we're in a focused floater, don't apply the floater's alpha to visual param hint,
@@ -176,11 +171,11 @@ void LLScrollingPanelParam::draw()
// Draw labels on top of the buttons
- getChildView("min param text")->setVisible( true );
- drawChild(getChild<LLView>("min param text"));
+ mMinParamText->setVisible( true );
+ drawChild(mMinParamText);
- getChildView("max param text")->setVisible( true );
- drawChild(getChild<LLView>("max param text"));
+ mMaxParamText->setVisible( true );
+ drawChild(mMaxParamText);
}
// static
diff --git a/indra/newview/llscrollingpanelparam.h b/indra/newview/llscrollingpanelparam.h
index 6a510026da..1ebf89f483 100644
--- a/indra/newview/llscrollingpanelparam.h
+++ b/indra/newview/llscrollingpanelparam.h
@@ -30,6 +30,8 @@
#include "llscrollingpanelparambase.h"
+class LLBorder;
+class LLButton;
class LLViewerJointMesh;
class LLViewerVisualParam;
class LLWearable;
@@ -80,6 +82,13 @@ protected:
LLTimer mMouseDownTimer; // timer for how long mouse has been held down on a hint.
F32 mLastHeldTime;
bool mAllowModify;
+
+ LLButton* mLessBtn;
+ LLButton* mMoreBtn;
+ LLViewBorder* mLeftBorder;
+ LLViewBorder* mRightBorder;
+ LLUICtrl* mMinParamText;
+ LLUICtrl* mMaxParamText;
};
#endif