summaryrefslogtreecommitdiff
path: root/indra/newview/llchiclet.cpp
diff options
context:
space:
mode:
authorYuri Chebotarev <ychebotarev@productengine.com>2009-12-21 12:11:26 +0200
committerYuri Chebotarev <ychebotarev@productengine.com>2009-12-21 12:11:26 +0200
commit2fd6bb4b59ac5f016de91f2dfddcebd71883f0d0 (patch)
tree961530257befc8ff433b026b947f8b03e4382719 /indra/newview/llchiclet.cpp
parentd1a857de1f0bb3e7f38ffae6cd4901e188c37ba3 (diff)
fix for low Task EXT-2881 Enough space to place 5 chiclets without arrows in bottom bar when voice indicator isn't shown
change whole chicklet arranging. --HG-- branch : product-engine
Diffstat (limited to 'indra/newview/llchiclet.cpp')
-rw-r--r--indra/newview/llchiclet.cpp57
1 files changed, 46 insertions, 11 deletions
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp
index 5695f7cac1..b77c9b3348 100644
--- a/indra/newview/llchiclet.cpp
+++ b/indra/newview/llchiclet.cpp
@@ -67,7 +67,8 @@ static LLDefaultChildRegistry::Register<LLInvOfferChiclet> t7("chiclet_offer");
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(25, 25, 45, 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;
@@ -1230,7 +1231,6 @@ bool LLChicletPanel::addChiclet(LLChiclet* chiclet, S32 index)
chiclet->setChicletSizeChangedCallback(boost::bind(&LLChicletPanel::onChicletSizeChanged, this, _1, index));
arrange();
- showScrollButtonsIfNeeded();
return true;
}
@@ -1241,8 +1241,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&param)
@@ -1259,8 +1257,6 @@ void LLChicletPanel::removeChiclet(chiclet_list_t::iterator it)
mChicletList.erase(it);
arrange();
- trimChiclets();
- showScrollButtonsIfNeeded();
}
void LLChicletPanel::removeChiclet(S32 index)
@@ -1353,8 +1349,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;
@@ -1365,9 +1359,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();
@@ -1380,8 +1386,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)
{
@@ -1395,6 +1401,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()
@@ -1412,6 +1436,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();