void LLTeleportHistoryPanel::handleItemSelect(LLFlatListView* selected) { mLastSelectedFlatlList = selected; LLTeleportHistoryFlatItem* item = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem()); if (item) mLastSelectedItemIndex = item->getIndex(); S32 tabs_cnt = mItemContainers.size(); for (S32 n = 0; n < tabs_cnt; n++) { LLAccordionCtrlTab* tab = mItemContainers.get(n); if (!tab->getVisible()) continue; LLFlatListView *flv = getFlatListViewFromTab(tab); if (!flv) continue; if (flv == selected) continue; flv->resetSelection(true); } updateVerbs(); }
// virtual void LLTeleportHistoryPanel::onTeleport() { if (!mLastSelectedFlatlList) return; LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem()); if(!itemp) return; // teleport to existing item in history, so we don't add it again confirmTeleport(itemp->getIndex()); }
//virtual void LLTeleportHistoryPanel::onShowProfile() { if (!mLastSelectedFlatlList) return; LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem()); if(!itemp) return; LLTeleportHistoryFlatItem::showPlaceInfoPanel(itemp->getIndex()); }
// virtual void LLTeleportHistoryPanel::onShowOnMap() { if (!mLastSelectedFlatlList) return; LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem()); if(!itemp) return; LLVector3d global_pos = mTeleportHistory->getItems()[itemp->getIndex()].mGlobalPos; if (!global_pos.isExactlyZero()) { LLFloaterWorldMap::getInstance()->trackLocation(global_pos); LLFloaterReg::showInstance("world_map", "center"); } }
LLTeleportHistoryFlatItem* LLTeleportHistoryFlatItemStorage::getFlatItemForPersistentItem ( LLTeleportHistoryPanel::ContextMenu *context_menu, const LLTeleportHistoryPersistentItem& persistent_item, const S32 cur_item_index, const std::string &hl) { LLTeleportHistoryFlatItem* item = NULL; if ( cur_item_index < (S32) mItems.size() ) { item = mItems[cur_item_index].get(); if (item->getParent() == NULL) { item->setIndex(cur_item_index); item->setRegionName(persistent_item.mTitle); item->setHighlightedText(hl); item->setVisible(TRUE); item->updateTitle(); } else { // Item already added to parent item = NULL; } } if ( !item ) { item = new LLTeleportHistoryFlatItem(cur_item_index, context_menu, persistent_item.mTitle, hl); mItems.push_back(item->getItemHandle()); } return item; }
void LLTeleportHistoryPanel::replaceItem(S32 removed_index) { // Flat list for 'Today' (mItemContainers keeps accordion tabs in reverse order) LLFlatListView* fv = NULL; if (mItemContainers.size() > 0) { fv = getFlatListViewFromTab(mItemContainers[mItemContainers.size() - 1]); } // Empty flat list for 'Today' means that other flat lists are empty as well, // so all items from teleport history should be added. if (!fv || fv->size() == 0) { showTeleportHistory(); return; } const LLTeleportHistoryStorage::slurl_list_t& history_items = mTeleportHistory->getItems(); LLTeleportHistoryFlatItem* item = LLTeleportHistoryFlatItemStorage::instance() .getFlatItemForPersistentItem(&mContextMenu, history_items[history_items.size() - 1], // Most recent item, it was added instead of removed history_items.size(), // index will be decremented inside loop below sFilterSubString); fv->addItem(item, LLUUID::null, ADD_TOP); // Index of each item, from last to removed item should be decremented // to point to the right item in LLTeleportHistoryStorage for (S32 tab_idx = mItemContainers.size() - 1; tab_idx >= 0; --tab_idx) { LLAccordionCtrlTab* tab = mItemContainers.get(tab_idx); if (!tab->getVisible()) continue; fv = getFlatListViewFromTab(tab); if (!fv) { showTeleportHistory(); return; } std::vector<LLPanel*> items; fv->getItems(items); S32 items_cnt = items.size(); for (S32 n = 0; n < items_cnt; ++n) { LLTeleportHistoryFlatItem *item = (LLTeleportHistoryFlatItem*) items[n]; if (item->getIndex() == removed_index) { LLTeleportHistoryFlatItemStorage::instance().removeItem(item); fv->removeItem(item); // If flat list becames empty, then accordion tab should be hidden if (fv->size() == 0) tab->setVisible(false); mHistoryAccordion->arrange(); return; // No need to decrement idexes for the rest of items } item->setIndex(item->getIndex() - 1); } } }
LLTeleportHistoryFlatItem* LLTeleportHistoryFlatItemStorage::getFlatItemForPersistentItem ( LLTeleportHistoryPanel::ContextMenu *context_menu, const LLTeleportHistoryPersistentItem& persistent_item, const S32 cur_item_index, const std::string &hl) { // <FS:Ansariel> Extended TP history LLVector3 local_pos((F32)fmod(persistent_item.mGlobalPos.mdV[VX], (F64)REGION_WIDTH_METERS), (F32)fmod(persistent_item.mGlobalPos.mdV[VY], (F64)REGION_WIDTH_METERS), (F32)persistent_item.mGlobalPos.mdV[VZ]); // </FS:Ansariel> LLTeleportHistoryFlatItem* item = NULL; if ( cur_item_index < (S32) mItems.size() ) { item = mItems[cur_item_index].get(); if (item->getParent() == NULL) { item->setIndex(cur_item_index); item->setRegionName(persistent_item.mTitle); item->setDate(persistent_item.mDate); // <FS:Ansariel> Extended TP history item->setLocalPos(local_pos); // </FS:Ansariel> item->setHighlightedText(hl); item->setVisible(TRUE); item->updateTitle(); item->updateTimestamp(); } else { // Item already added to parent item = NULL; } } if ( !item ) { item = new LLTeleportHistoryFlatItem(cur_item_index, context_menu, persistent_item.mTitle, persistent_item.mDate, // <FS:Ansariel> Extended TP history local_pos, // </FS:Ansariel> hl); mItems.push_back(item->getItemHandle()); } return item; }