diff options
-rw-r--r-- | indra/newview/llchiclet.cpp | 57 | ||||
-rw-r--r-- | indra/newview/llchiclet.h | 5 | ||||
-rw-r--r-- | indra/newview/llmoveview.cpp | 2 |
3 files changed, 52 insertions, 12 deletions
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index bb09f34362..957d272f40 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -68,7 +68,8 @@ static const LLRect CHICLET_RECT(0, 25, 25, 0); static const LLRect CHICLET_ICON_RECT(0, 22, 22, 0); static const LLRect VOICE_INDICATOR_RECT(50, 25, 70, 0); static const LLRect COUNTER_RECT(25, 25, 50, 0); -static const S32 OVERLAY_ICON_SHIFT = 2; // used for shifting of an overlay icon for new massages in a chiclet +static const S32 OVERLAY_ICON_SHIFT = 2; // used for shifting of an overlay icon for new massages in a chiclet +static const S32 SCROLL_BUTTON_PAD = 5; // static const S32 LLChicletPanel::s_scroll_ratio = 10; @@ -1311,7 +1312,6 @@ bool LLChicletPanel::addChiclet(LLChiclet* chiclet, S32 index) chiclet->setChicletSizeChangedCallback(boost::bind(&LLChicletPanel::onChicletSizeChanged, this, _1, index)); arrange(); - showScrollButtonsIfNeeded(); return true; } @@ -1322,8 +1322,6 @@ bool LLChicletPanel::addChiclet(LLChiclet* chiclet, S32 index) void LLChicletPanel::onChicletSizeChanged(LLChiclet* ctrl, const LLSD& param) { arrange(); - trimChiclets(); - showScrollButtonsIfNeeded(); } void LLChicletPanel::onChicletClick(LLUICtrl*ctrl,const LLSD¶m) @@ -1340,8 +1338,6 @@ void LLChicletPanel::removeChiclet(chiclet_list_t::iterator it) mChicletList.erase(it); arrange(); - trimChiclets(); - showScrollButtonsIfNeeded(); } void LLChicletPanel::removeChiclet(S32 index) @@ -1434,8 +1430,6 @@ void LLChicletPanel::reshape(S32 width, S32 height, BOOL called_from_parent ) { LLPanel::reshape(width,height,called_from_parent); - static const S32 SCROLL_BUTTON_PAD = 5; - //Needed once- to avoid error at first call of reshape() before postBuild() if(!mLeftScrollButton||!mRightScrollButton) return; @@ -1446,9 +1440,21 @@ void LLChicletPanel::reshape(S32 width, S32 height, BOOL called_from_parent ) scroll_button_rect = mRightScrollButton->getRect(); mRightScrollButton->setRect(LLRect(width - scroll_button_rect.getWidth(),scroll_button_rect.mTop, width, scroll_button_rect.mBottom)); - mScrollArea->setRect(LLRect(scroll_button_rect.getWidth() + SCROLL_BUTTON_PAD, - height, width - scroll_button_rect.getWidth() - SCROLL_BUTTON_PAD, 0)); + + + bool need_show_scroll = needShowScroll(); + if(need_show_scroll) + { + mScrollArea->setRect(LLRect(scroll_button_rect.getWidth() + SCROLL_BUTTON_PAD, + height, width - scroll_button_rect.getWidth() - SCROLL_BUTTON_PAD, 0)); + } + else + { + mScrollArea->setRect(LLRect(0,height, width, 0)); + } + mShowControls = width >= mMinWidth; + mScrollArea->setVisible(mShowControls); trimChiclets(); @@ -1461,8 +1467,8 @@ void LLChicletPanel::arrange() if(mChicletList.empty()) return; + //initial arrange of chicklets positions S32 chiclet_left = getChiclet(0)->getRect().mLeft; - S32 size = getChicletCount(); for( int n = 0; n < size; ++n) { @@ -1476,6 +1482,24 @@ void LLChicletPanel::arrange() chiclet_left += chiclet_width + getChicletPadding(); } + + //reset size and pos on mScrollArea + LLRect rect = getRect(); + LLRect scroll_button_rect = mLeftScrollButton->getRect(); + + bool need_show_scroll = needShowScroll(); + if(need_show_scroll) + { + mScrollArea->setRect(LLRect(scroll_button_rect.getWidth() + SCROLL_BUTTON_PAD, + rect.getHeight(), rect.getWidth() - scroll_button_rect.getWidth() - SCROLL_BUTTON_PAD, 0)); + } + else + { + mScrollArea->setRect(LLRect(0,rect.getHeight(), rect.getWidth(), 0)); + } + + trimChiclets(); + showScrollButtonsIfNeeded(); } void LLChicletPanel::trimChiclets() @@ -1493,6 +1517,17 @@ void LLChicletPanel::trimChiclets() } } +bool LLChicletPanel::needShowScroll() +{ + if(mChicletList.empty()) + return false; + + S32 chicklet_width = (*mChicletList.rbegin())->getRect().mRight - (*mChicletList.begin())->getRect().mLeft; + + return chicklet_width>getRect().getWidth(); +} + + void LLChicletPanel::showScrollButtonsIfNeeded() { bool can_scroll_left = canScrollLeft(); diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index 259476c2ad..2ab6abfb5b 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -1050,6 +1050,11 @@ protected: bool canScrollRight(); /** + * Returns true if we need to show scroll buttons + */ + bool needShowScroll(); + + /** * Returns true if chiclets can be scrolled left. */ bool canScrollLeft(); diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp index 22201aecb2..818e7e0db1 100644 --- a/indra/newview/llmoveview.cpp +++ b/indra/newview/llmoveview.cpp @@ -571,7 +571,7 @@ BOOL LLPanelStandStopFlying::postBuild() mStandButton->setVisible(FALSE); mStopFlyingButton = getChild<LLButton>("stop_fly_btn"); - mStopFlyingButton->setCommitCallback(boost::bind(&LLFloaterMove::setFlyingMode, FALSE)); + //mStopFlyingButton->setCommitCallback(boost::bind(&LLFloaterMove::setFlyingMode, FALSE)); mStopFlyingButton->setCommitCallback(boost::bind(&LLPanelStandStopFlying::onStopFlyingButtonClick, this)); mStopFlyingButton->setVisible(FALSE); |