void LLTeleportHistoryStorage::onTeleportHistoryChange() { LLTeleportHistory *th = LLTeleportHistory::getInstance(); if (!th) return; // Hacky sanity check. (EXT-6798) if (th->getItems().size() == 0) { llassert(!"Inconsistent teleport history state"); return; } const LLTeleportHistoryItem &item = th->getItems()[th->getCurrentItemIndex()]; // [RLVa:KB] - Checked: 2010-09-03 (RLVa-1.2.1b) | Added: RLVa-1.2.1b // Make sure we don't attempt to save zero'ed out teleport history items if (item.mGlobalPos.isExactlyZero()) { return; } // [/RLVa:KB] addItem(item.mTitle, item.mGlobalPos); save(); }
void LLNavigationBar::onTeleportHistoryChanged() { // Update navigation controls. LLTeleportHistory* h = LLTeleportHistory::getInstance(); int cur_item = h->getCurrentItemIndex(); mBtnBack->setEnabled(cur_item > 0); mBtnForward->setEnabled(cur_item < ((int)h->getItems().size() - 1)); }
void LLNavigationBar::rebuildTeleportHistoryMenu() { // Has the pop-up menu been built? if (mTeleportHistoryMenu) { // Clear it. mTeleportHistoryMenu->empty(); } else { // Create it. LLMenuGL::Params menu_p; menu_p.name("popup"); menu_p.can_tear_off(false); menu_p.visible(false); menu_p.bg_visible(true); menu_p.scrollable(true); mTeleportHistoryMenu = LLUICtrlFactory::create<LLMenuGL>(menu_p); addChild(mTeleportHistoryMenu); } // Populate the menu with teleport history items. LLTeleportHistory* hist = LLTeleportHistory::getInstance(); const LLTeleportHistory::slurl_list_t& hist_items = hist->getItems(); int cur_item = hist->getCurrentItemIndex(); // Items will be shown in the reverse order, just like in Firefox. for (int i = (int)hist_items.size()-1; i >= 0; i--) { LLTeleportHistoryMenuItem::EType type; if (i < cur_item) type = LLTeleportHistoryMenuItem::TYPE_BACKWARD; else if (i > cur_item) type = LLTeleportHistoryMenuItem::TYPE_FORWARD; else type = LLTeleportHistoryMenuItem::TYPE_CURRENT; LLTeleportHistoryMenuItem::Params item_params; item_params.label = item_params.name = hist_items[i].mTitle; item_params.item_type = type; item_params.on_click.function(boost::bind(&LLNavigationBar::onTeleportHistoryMenuItemClicked, this, i)); LLTeleportHistoryMenuItem* new_itemp = LLUICtrlFactory::create<LLTeleportHistoryMenuItem>(item_params); //new_itemp->setFont() mTeleportHistoryMenu->addChild(new_itemp); } }
void LLTeleportHistoryStorage::onTeleportHistoryChange() { LLTeleportHistory *th = LLTeleportHistory::getInstance(); if (!th) return; // Hacky sanity check. (EXT-6798) if (th->getItems().size() == 0) { llassert(!"Inconsistent teleport history state"); return; } const LLTeleportHistoryItem &item = th->getItems()[th->getCurrentItemIndex()]; addItem(item.mTitle, item.mGlobalPos); save(); }
// Checked: 2010-04-22 (RLVa-1.2.0f) | Modified: RLVa-1.2.0f void RlvUIEnabler::onToggleShowLoc() { bool fEnable = !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC); if (LLNavigationBar::instanceExists()) LLNavigationBar::instance().refreshLocationCtrl(); if (LLPanelTopInfoBar::instanceExists()) LLPanelTopInfoBar::instance().update(); if (!fEnable) { // Hide the "About Land" floater if it's currently visible if (LLFloaterReg::instanceVisible("about_land")) LLFloaterReg::hideInstance("about_land"); // Hide the "Region / Estate" floater if it's currently visible if (LLFloaterReg::instanceVisible("region_info")) LLFloaterReg::hideInstance("region_info"); // Hide the "God Tools" floater if it's currently visible if (LLFloaterReg::instanceVisible("god_tools")) LLFloaterReg::hideInstance("god_tools"); // // Manipulate the teleport history // // If the last entry in the persistent teleport history matches the current teleport history entry then we should remove it LLTeleportHistory* pTpHistory = LLTeleportHistory::getInstance(); LLTeleportHistoryStorage* pTpHistoryStg = LLTeleportHistoryStorage::getInstance(); RLV_ASSERT( (pTpHistory) && (pTpHistoryStg) && (pTpHistory->getItems().size() > 0) && (pTpHistory->getCurrentItemIndex() >= 0) ); if ( (pTpHistory) && (pTpHistory->getItems().size() > 0) && (pTpHistory->getCurrentItemIndex() >= 0) && (pTpHistoryStg) && (pTpHistory->getItems().size() > 0) ) { const LLTeleportHistoryItem& tpItem = pTpHistory->getItems().back(); const LLTeleportHistoryPersistentItem& tpItemStg = pTpHistoryStg->getItems().back(); if (pTpHistoryStg->compareByTitleAndGlobalPos(tpItemStg, LLTeleportHistoryPersistentItem(tpItem.mTitle, tpItem.mGlobalPos))) { // TODO-RLVa: [RLVa-1.2.2] Is there a reason why LLTeleportHistoryStorage::removeItem() doesn't trigger history changed? pTpHistoryStg->removeItem(pTpHistoryStg->getItems().size() - 1); pTpHistoryStg->mHistoryChangedSignal(-1); } } // Clear the current location in the teleport history if (pTpHistory) pTpHistory->updateCurrentLocation(gAgent.getPositionGlobal()); } else { // Reset the current location in the teleport history (also takes care of adding it to the persistent teleport history) LLTeleportHistory* pTpHistory = LLTeleportHistory::getInstance(); if ( (pTpHistory) && (NULL != gAgent.getRegion()) ) pTpHistory->updateCurrentLocation(gAgent.getPositionGlobal()); } // Start or stop filtering the "About Land" and "Region / Estate" floaters if ( (!fEnable) && (!m_ConnFloaterShowLoc.connected()) ) { m_ConnFloaterShowLoc = LLFloaterReg::setValidateCallback(boost::bind(&RlvUIEnabler::filterFloaterShowLoc, this, _1, _2)); m_ConnPanelShowLoc = LLFloaterSidePanelContainer::setValidateCallback(boost::bind(&RlvUIEnabler::filterPanelShowLoc, this, _1, _2, _3)); } else if ( (fEnable) && (m_ConnFloaterShowLoc.connected()) ) { m_ConnFloaterShowLoc.disconnect(); m_ConnPanelShowLoc.disconnect(); } }