summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelteleporthistory.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2009-10-19 02:17:01 +0000
committerSteven Bennetts <steve@lindenlab.com>2009-10-19 02:17:01 +0000
commitea1bfae838c59e24ec1a962f7d015d609b63d083 (patch)
tree4fb1bc94522313df13a6d329cd8fef29d099a46d /indra/newview/llpanelteleporthistory.cpp
parent8103710c054ec6ea4a46f9732e569e543691184b (diff)
Merging revisions 2070-2084 of https://svn.aws.productengine.com/secondlife/pe/stable-2 into P:\svn\viewer-2.0.0, respecting ancestry
* Bugs: EXT-792 EXT-1519 EXT-1514 EXT-1245 EXT-1600 EXT-1535 EXT-1174 EXT-1241 * Dev: EXT-1271 EXT-1601 EXT-1154
Diffstat (limited to 'indra/newview/llpanelteleporthistory.cpp')
-rw-r--r--indra/newview/llpanelteleporthistory.cpp38
1 files changed, 26 insertions, 12 deletions
diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp
index 96efb885dd..207ed723b2 100644
--- a/indra/newview/llpanelteleporthistory.cpp
+++ b/indra/newview/llpanelteleporthistory.cpp
@@ -221,7 +221,8 @@ LLTeleportHistoryPanel::LLTeleportHistoryPanel()
mTeleportHistory(NULL),
mHistoryAccordion(NULL),
mAccordionTabMenu(NULL),
- mLastSelectedScrollList(NULL)
+ mLastSelectedFlatlList(NULL),
+ mLastSelectedItemIndex(-1)
{
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_teleport_history.xml");
}
@@ -236,7 +237,7 @@ BOOL LLTeleportHistoryPanel::postBuild()
mTeleportHistory = LLTeleportHistoryStorage::getInstance();
if (mTeleportHistory)
{
- mTeleportHistory->setHistoryChangedCallback(boost::bind(&LLTeleportHistoryPanel::showTeleportHistory, this));
+ mTeleportHistory->setHistoryChangedCallback(boost::bind(&LLTeleportHistoryPanel::onTeleportHistoryChange, this));
}
mHistoryAccordion = getChild<LLAccordionCtrl>("history_accordion");
@@ -308,10 +309,10 @@ void LLTeleportHistoryPanel::onSearchEdit(const std::string& string)
// virtual
void LLTeleportHistoryPanel::onShowOnMap()
{
- if (!mLastSelectedScrollList)
+ if (!mLastSelectedFlatlList)
return;
- LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedScrollList->getSelectedItem());
+ LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
if(!itemp)
return;
@@ -328,10 +329,10 @@ void LLTeleportHistoryPanel::onShowOnMap()
// virtual
void LLTeleportHistoryPanel::onTeleport()
{
- if (!mLastSelectedScrollList)
+ if (!mLastSelectedFlatlList)
return;
- LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedScrollList->getSelectedItem());
+ LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
if(!itemp)
return;
@@ -369,14 +370,14 @@ void LLTeleportHistoryPanel::updateVerbs()
if (!isTabVisible())
return;
- if (!mLastSelectedScrollList)
+ if (!mLastSelectedFlatlList)
{
mTeleportBtn->setEnabled(false);
mShowOnMapBtn->setEnabled(false);
return;
}
- LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedScrollList->getSelectedItem());
+ LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
mTeleportBtn->setEnabled(NULL != itemp && itemp->getIndex() < (S32)mTeleportHistory->getItems().size() - 1);
mShowOnMapBtn->setEnabled(NULL != itemp);
@@ -480,8 +481,14 @@ void LLTeleportHistoryPanel::refresh()
}
if (curr_flat_view)
- curr_flat_view->addItem(new LLTeleportHistoryFlatItem(mCurrentItem, &mContextMenu, items[mCurrentItem].mTitle));
+ {
+ LLTeleportHistoryFlatItem* item = new LLTeleportHistoryFlatItem(mCurrentItem, &mContextMenu, items[mCurrentItem].mTitle);
+ curr_flat_view->addItem(item);
+ if (mLastSelectedItemIndex == mCurrentItem)
+ curr_flat_view->selectItem(item, true);
+ }
+
mCurrentItem--;
if (++added_items >= ADD_LIMIT)
@@ -496,6 +503,12 @@ void LLTeleportHistoryPanel::refresh()
mDirty = false;
}
+void LLTeleportHistoryPanel::onTeleportHistoryChange()
+{
+ mLastSelectedItemIndex = -1;
+ showTeleportHistory();
+}
+
void LLTeleportHistoryPanel::showTeleportHistory()
{
mDirty = true;
@@ -516,7 +529,10 @@ void LLTeleportHistoryPanel::showTeleportHistory()
void LLTeleportHistoryPanel::handleItemSelect(LLFlatListView* selected)
{
- mLastSelectedScrollList = selected;
+ mLastSelectedFlatlList = selected;
+ LLTeleportHistoryFlatItem* item = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
+ if (item)
+ mLastSelectedItemIndex = item->getIndex();
S32 tabs_cnt = mItemContainers.size();
@@ -633,8 +649,6 @@ bool LLTeleportHistoryPanel::onClearTeleportHistoryDialog(const LLSD& notificati
LLTeleportHistoryStorage *th = LLTeleportHistoryStorage::getInstance();
th->purgeItems();
th->save();
-
- showTeleportHistory();
}
return false;