diff options
author | Steven Bennetts <steve@lindenlab.com> | 2009-10-22 00:21:18 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2009-10-22 00:21:18 +0000 |
commit | 0041d485b1c5a1b18c9d5b2ae016f2c1e5ea6b8e (patch) | |
tree | e69610d38613885aa123c2744dd07db581a810d2 /indra/newview/llchiclet.cpp | |
parent | 67c4555a3793850ca8a8142b1e3e72c90d5001f4 (diff) |
Merging revisions 2129-2144 of https://svn.aws.productengine.com/secondlife/pe/stable-2 into P:\svn\viewer-2.0.0-3, respecting ancestry
* Bugs: EXT-1293 EXT-1611 EXT-1613 EXT-1176 EXT-1724 EXT-1186 EXT-1662 EXT-1760 EXT-1720
* Dev: EXT-1575 EXT-1770 EXT-1232 EXT-1234
Diffstat (limited to 'indra/newview/llchiclet.cpp')
-rw-r--r-- | indra/newview/llchiclet.cpp | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 43aca430a2..2ebbae33ad 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -868,19 +868,29 @@ BOOL LLChicletPanel::postBuild() return TRUE; } +S32 LLChicletPanel::calcChickletPanleWidth() +{ + S32 res = 0; + + for (chiclet_list_t::iterator it = mChicletList.begin(); it + != mChicletList.end(); it++) + { + res = (*it)->getRect().getWidth() + getChicletPadding(); + } + return res; +} + bool LLChicletPanel::addChiclet(LLChiclet* chiclet, S32 index) { if(mScrollArea->addChild(chiclet)) { + // chicklets should be aligned to right edge of scroll panel S32 offset = 0; - // if index == 0 and chickelt list isn't empty insert chiclet before first in the list - // without scrolling, so other visible chicklets aren't change screen position - if (0 == index && !mChicletList.empty()) + if (!canScrollLeft()) { - offset = getChiclet(0)->getRect().mLeft - - (chiclet->getRequiredRect().getWidth() - + getChicletPadding()); + offset = mScrollArea->getRect().getWidth() + - chiclet->getRect().getWidth() - calcChickletPanleWidth(); } mChicletList.insert(mChicletList.begin() + index, chiclet); @@ -1073,25 +1083,16 @@ void LLChicletPanel::arrange() void LLChicletPanel::trimChiclets() { // trim right - if(canScrollLeft() && !canScrollRight()) + if(!mChicletList.empty()) { S32 last_chiclet_right = (*mChicletList.rbegin())->getRect().mRight; + S32 first_chiclet_left = getChiclet(0)->getRect().mLeft; S32 scroll_width = mScrollArea->getRect().getWidth(); - if(last_chiclet_right < scroll_width) + if(last_chiclet_right < scroll_width || first_chiclet_left > 0) { shiftChiclets(scroll_width - last_chiclet_right); } } - - // trim left - if(!mChicletList.empty()) - { - LLRect first_chiclet_rect = getChiclet(0)->getRect(); - if(first_chiclet_rect.mLeft > 0) - { - shiftChiclets( - first_chiclet_rect.mLeft); - } - } } void LLChicletPanel::showScrollButtonsIfNeeded() |