diff options
Diffstat (limited to 'indra/newview/llscrollingpanelparam.cpp')
-rw-r--r-- | indra/newview/llscrollingpanelparam.cpp | 83 |
1 files changed, 39 insertions, 44 deletions
diff --git a/indra/newview/llscrollingpanelparam.cpp b/indra/newview/llscrollingpanelparam.cpp index 4c8666bdde..8dfe21e4cb 100644 --- a/indra/newview/llscrollingpanelparam.cpp +++ b/indra/newview/llscrollingpanelparam.cpp @@ -50,56 +50,51 @@ const S32 LLScrollingPanelParam::PARAM_HINT_HEIGHT = 128; S32 LLScrollingPanelParam::sUpdateDelayFrames = 0; LLScrollingPanelParam::LLScrollingPanelParam( const LLPanel::Params& panel_params, - LLViewerJointMesh* mesh, LLViewerVisualParam* param, BOOL allow_modify, LLWearable* wearable, LLJoint* jointp, BOOL use_hints ) + 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 ); + 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 ); + setVisible(false); + setBorderVisible( false ); } LLScrollingPanelParam::~LLScrollingPanelParam() { } -void LLScrollingPanelParam::updatePanel(BOOL allow_modify) +void LLScrollingPanelParam::updatePanel(bool allow_modify) { if (!mWearable) { @@ -110,11 +105,11 @@ 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 ) +void LLScrollingPanelParam::setVisible( bool visible ) { if( getVisible() != 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 |