diff options
-rw-r--r-- | indra/newview/CMakeLists.txt | 6 | ||||
-rw-r--r-- | indra/newview/llfloatercamera.cpp | 10 | ||||
-rw-r--r-- | indra/newview/lllocationhistory.cpp | 59 | ||||
-rw-r--r-- | indra/newview/lllocationhistory.h | 13 | ||||
-rw-r--r-- | indra/newview/lllocationinputctrl.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llmoveview.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llnavigationbar.cpp | 93 | ||||
-rw-r--r-- | indra/newview/llnavigationbar.h | 22 | ||||
-rw-r--r-- | indra/newview/llpanelplaceinfo.cpp | 36 | ||||
-rw-r--r-- | indra/newview/llpanelplaces.cpp | 45 | ||||
-rw-r--r-- | indra/newview/llpanelplaces.h | 1 | ||||
-rw-r--r-- | indra/newview/llscreenchannel.h | 72 | ||||
-rw-r--r-- | indra/newview/llviewerfloaterreg.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 4 |
14 files changed, 260 insertions, 115 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 0be84e2ab9..4286b91654 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -135,7 +135,6 @@ set(viewer_SOURCE_FILES llflexibleobject.cpp llfloaterabout.cpp llfloateractivespeakers.cpp - llfloateraddlandmark.cpp llfloateranimpreview.cpp llfloaterauction.cpp llfloateravatarpicker.cpp @@ -283,7 +282,6 @@ set(viewer_SOURCE_FILES llpanelavatarrow.cpp llpanelavatartag.cpp llpanelclassified.cpp - llsidetraypanelcontainer.cpp llpanelcontents.cpp llpaneldirbrowser.cpp llpaneldirclassified.cpp @@ -344,6 +342,7 @@ set(viewer_SOURCE_FILES llscreenchannel.cpp llselectmgr.cpp llsidetray.cpp + llsidetraypanelcontainer.cpp llsky.cpp llslurl.cpp llspatialpartition.cpp @@ -577,7 +576,6 @@ set(viewer_HEADER_FILES llflexibleobject.h llfloaterabout.h llfloateractivespeakers.h - llfloateraddlandmark.h llfloateranimpreview.h llfloaterauction.h llfloateravatarpicker.h @@ -724,7 +722,6 @@ set(viewer_HEADER_FILES llpanelavatarrow.h llpanelavatartag.h llpanelclassified.h - llsidetraypanelcontainer.h llpanelcontents.h llpaneldirbrowser.h llpaneldirclassified.h @@ -787,6 +784,7 @@ set(viewer_HEADER_FILES llsavedsettingsglue.h llselectmgr.h llsidetray.h + llsidetraypanelcontainer.h llsky.h llslurl.h llspatialpartition.h diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index 81f1beb40d..8cba42dea5 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -53,6 +53,11 @@ const F32 CAMERA_BUTTON_DELAY = 0.0f; #define PAN "cam_track_stick" #define CONTROLS "controls" + +void show_tip(LLFirstTimeTipsManager::EFirstTimeTipType tipType, LLView* anchorView) +{ + LLFirstTimeTipsManager::showTipsFor(tipType, anchorView, LLFirstTimeTipsManager::TPA_POS_RIGHT_ALIGN_TOP); +} // // Member functions // @@ -93,7 +98,8 @@ void LLFloaterCamera::update() { ECameraControlMode mode = determineMode(); if (mode != mCurrMode) setMode(mode); - LLFirstTimeTipsManager::showTipsFor(mMode2TipType[mode], this); + updatePosition(); + show_tip(mMode2TipType[mode], this); } @@ -270,7 +276,7 @@ void LLFloaterCamera::onClickBtn(ECameraControlMode mode) switchMode(mode); - LLFirstTimeTipsManager::showTipsFor(mMode2TipType[mode], mMode2Button[mode]); + show_tip(mMode2TipType[mode], this); } void LLFloaterCamera::assignButton2Mode(ECameraControlMode mode, const std::string& button_name) diff --git a/indra/newview/lllocationhistory.cpp b/indra/newview/lllocationhistory.cpp index 68143fd1e3..03d6953521 100644 --- a/indra/newview/lllocationhistory.cpp +++ b/indra/newview/lllocationhistory.cpp @@ -38,33 +38,58 @@ #include "llui.h" +const char LLLocationHistory::delimiter = '\t'; + LLLocationHistory::LLLocationHistory() : mFilename("typed_locations.txt") { } -void LLLocationHistory::addItem(std::string item) -{ +void LLLocationHistory::addItem(const std::string & item, const std::string & tooltip) { static LLUICachedControl<S32> max_items("LocationHistoryMaxSize", 100); - - std::vector<std::string>::iterator item_iter = std::find(mItems.begin(), mItems.end(), item); - if (item_iter != mItems.end()) { - mItems.erase(item_iter); + // check if this item doesn't duplicate any existing one + if (touchItem(item)) { + return; } mItems.push_back(item); + mToolTips[item] = tooltip; // If the vector size exceeds the maximum, purge the oldest items. - if ((S32)mItems.size() > max_items) - mItems.erase(mItems.begin(), mItems.end()-max_items); + if ((S32)mItems.size() > max_items) { + for(std::vector<std::string>::iterator i = mItems.begin(); i != mItems.end()-max_items; ++i) { + mToolTips.erase(*i); + mItems.erase(i); + } + } +} + +bool LLLocationHistory::touchItem(const std::string & item) { + bool result = false; + std::vector<std::string>::iterator item_iter = std::find(mItems.begin(), mItems.end(), item); + + // the last used item should be the first in the history + if (item_iter != mItems.end()) { + mItems.erase(item_iter); + mItems.push_back(item); + result = true; + } + + return result; } void LLLocationHistory::removeItems() { mItems.clear(); + mToolTips.clear(); } +std::string LLLocationHistory::getToolTip(const std::string & item) const { + std::map<std::string, std::string>::const_iterator i = mToolTips.find(item); + + return i != mToolTips.end() ? i->second : ""; +} bool LLLocationHistory::getMatchingItems(std::string substring, location_list_t& result) const { @@ -110,7 +135,7 @@ void LLLocationHistory::save() const } for (location_list_t::const_iterator it = mItems.begin(); it != mItems.end(); ++it) - file << (*it) << std::endl; + file << (*it) << delimiter << mToolTips.find(*it)->second << std::endl; file.close(); } @@ -129,13 +154,21 @@ void LLLocationHistory::load() return; } - // remove current entries before we load over them - mItems.clear(); + removeItems(); // add each line in the file to the list std::string line; - while (std::getline(file, line)) - addItem(line); + + while (std::getline(file, line)) { + size_t dp = line.find(delimiter); + + if (dp != std::string::npos) { + const std::string reg_name = line.substr(0, dp); + const std::string tooltip = line.substr(dp + 1, std::string::npos); + + addItem(reg_name, tooltip); + } + } file.close(); diff --git a/indra/newview/lllocationhistory.h b/indra/newview/lllocationhistory.h index 19032686c1..67eabcdaca 100644 --- a/indra/newview/lllocationhistory.h +++ b/indra/newview/lllocationhistory.h @@ -37,6 +37,7 @@ #include <vector> #include <string> +#include <map> #include <boost/function.hpp> class LLLocationHistory: public LLSingleton<LLLocationHistory> @@ -50,8 +51,10 @@ public: LLLocationHistory(); - void addItem(std::string item); + void addItem(const std::string & item, const std::string & tooltip); + bool touchItem(const std::string & item); void removeItems(); + std::string getToolTip(const std::string & item) const; size_t getItemCount() const { return mItems.size(); } const location_list_t& getItems() const { return mItems; } bool getMatchingItems(std::string substring, location_list_t& result) const; @@ -62,9 +65,11 @@ public: void dump() const; private: - std::vector<std::string> mItems; - std::string mFilename; /// File to store the history to. - loaded_signal_t mLoadedSignal; + const static char delimiter; + std::vector<std::string> mItems; + std::map<std::string, std::string> mToolTips; + std::string mFilename; /// File to store the history to. + loaded_signal_t mLoadedSignal; }; #endif diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index 3880ea91eb..a20296a122 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -234,6 +234,13 @@ BOOL LLLocationInputCtrl::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* // Let the buttons show their tooltips. if (LLUICtrl::handleToolTip(x, y, msg, sticky_rect_screen) && !msg.empty()) { + LLLocationHistory* lh = LLLocationHistory::getInstance(); + const std::string tooltip = lh->getToolTip(msg); + + if (!tooltip.empty()) { + msg = tooltip; + } + return TRUE; } @@ -347,9 +354,6 @@ void LLLocationInputCtrl::onInfoButtonClicked() void LLLocationInputCtrl::onAddLandmarkButtonClicked() { LLSideTray::getInstance()->showPanel("panel_places", LLSD().insert("type", "create_landmark")); - - // Floater "Add Landmark" functionality moved to Side Tray - //LLFloaterReg::showInstance("add_landmark"); } void LLLocationInputCtrl::onAgentParcelChange() diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp index 124a2def7f..96c8f3e2e9 100644 --- a/indra/newview/llmoveview.cpp +++ b/indra/newview/llmoveview.cpp @@ -435,7 +435,7 @@ void LLFloaterMove::showQuickTips(const EMovementMode mode) default: llwarns << "Quick Tip type was not detected, FTT_MOVE_WALK will be used" << llendl; } - LLFirstTimeTipsManager::showTipsFor(tipType, this); + LLFirstTimeTipsManager::showTipsFor(tipType, this, LLFirstTimeTipsManager::TPA_POS_LEFT_ALIGN_TOP); } void LLFloaterMove::setModeButtonToggleState(const EMovementMode mode) diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp index 06cab9afb0..b980490434 100644 --- a/indra/newview/llnavigationbar.cpp +++ b/indra/newview/llnavigationbar.cpp @@ -181,10 +181,14 @@ LLNavigationBar::LLNavigationBar() mBtnHome(NULL), mCmbLocation(NULL), mLeSearch(NULL), - mPurgeTPHistoryItems(false) + mPurgeTPHistoryItems(false), + mUpdateTypedLocationHistory(false) { setIsChrome(TRUE); + mParcelMgrConnection = LLViewerParcelMgr::getInstance()->setAgentParcelChangedCallback( + boost::bind(&LLNavigationBar::onTeleportFinished, this)); + // Register callbacks and load the location field context menu (NB: the order matters). mCommitCallbackRegistrar.add("Navbar.Action", boost::bind(&LLNavigationBar::onLocationContextMenuItemClicked, this, _2)); mEnableCallbackRegistrar.add("Navbar.EnableMenuItem", boost::bind(&LLNavigationBar::onLocationContextMenuItemEnabled, this, _2)); @@ -200,6 +204,7 @@ LLNavigationBar::LLNavigationBar() LLNavigationBar::~LLNavigationBar() { + mParcelMgrConnection.disconnect(); sInstance = 0; } @@ -324,12 +329,12 @@ void LLNavigationBar::onLocationSelection() std::string region_name; LLVector3 local_coords(128, 128, 0); + S32 x = 0, y = 0, z = 0; // Is the typed location a SLURL? if (LLSLURL::isSLURL(typed_location)) { // Yes. Extract region name and local coordinates from it. - S32 x = 0, y = 0, z = 0; if (LLURLSimString::parse(LLSLURL::stripProtocol(typed_location), ®ion_name, &x, &y, &z)) local_coords.set(x, y, z); else @@ -337,8 +342,13 @@ void LLNavigationBar::onLocationSelection() } else { + region_name = extractLocalCoordsFromRegName(typed_location, &x, &y, &z); + + if (region_name != typed_location) { + local_coords.set(x, y, z); + } // Treat it as region name. - region_name = typed_location; + // region_name = typed_location; } // Resolve the region name to its global coordinates. @@ -349,6 +359,32 @@ void LLNavigationBar::onLocationSelection() LLWorldMap::getInstance()->sendNamedRegionRequest(region_name, cb, std::string("unused"), false); } +void LLNavigationBar::onTeleportFinished() { + + if (mUpdateTypedLocationHistory) { + LLLocationHistory* lh = LLLocationHistory::getInstance(); + + // Location is valid. Add it to the typed locations history. + // If user has typed text this variable will contain -1. + if (mCmbLocation->getCurrentIndex() != -1) { + lh->touchItem(mCmbLocation->getSelectedItemLabel()); + } else { + std::string region_name; + std::string url = gAgent.getSLURL(); + S32 x = 0, y = 0, z = 0; + + if (LLSLURL::isSLURL(url)) { + LLURLSimString::parse(LLSLURL::stripProtocol(url), ®ion_name, &x, &y, &z); + appendLocalCoordsToRegName(®ion_name, x, y, z); + lh->addItem(region_name, url); + } + } + + lh->save(); + mUpdateTypedLocationHistory = false; + } +} + void LLNavigationBar::onTeleportHistoryChanged() { // Update navigation controls. @@ -415,27 +451,13 @@ void LLNavigationBar::onRegionNameResponse( return; } - // Location is valid. Add it to the typed locations history. - // If user has typed text this variable will contain -1. - S32 selected_item = mCmbLocation->getCurrentIndex(); - - /* - LLLocationHistory* lh = LLLocationHistory::getInstance(); - lh->addItem(selected_item == -1 ? typed_location : mCmbLocation->getSelectedItemLabel()); - lh->save(); - */ - // Teleport to the location. LLVector3d region_pos = from_region_handle(region_handle); LLVector3d global_pos = region_pos + (LLVector3d) local_coords; - + mUpdateTypedLocationHistory = true; llinfos << "Teleporting to: " << global_pos << llendl; gAgent.teleportViaLocation(global_pos); - - LLLocationHistory* lh = LLLocationHistory::getInstance(); - lh->addItem(selected_item == -1 ? typed_location : mCmbLocation->getSelectedItemLabel()); - lh->save(); } void LLNavigationBar::showTeleportHistoryMenu() @@ -474,9 +496,6 @@ void LLNavigationBar::onLocationContextMenuItemClicked(const LLSD& userdata) else if (item == std::string("landmark")) { LLSideTray::getInstance()->showPanel("panel_places", LLSD().insert("type", "create_landmark")); - - // Floater "Add Landmark" functionality moved to Side Tray - //LLFloaterReg::showInstance("add_landmark"); } else if (item == std::string("cut")) { @@ -546,6 +565,38 @@ void LLNavigationBar::invokeSearch(std::string search_text) LLFloaterReg::showInstance("search", LLSD().insert("panel", "all").insert("id", LLSD(search_text))); } +void LLNavigationBar::appendLocalCoordsToRegName(std::string* reg_name, S32 x, S32 y, S32 z) { + std::string fmt = *reg_name + " (%d, %d, %d)"; + *reg_name = llformat(fmt.c_str(), x, y, z); +} + +std::string LLNavigationBar::extractLocalCoordsFromRegName(const std::string & reg_name, S32* x, S32* y, S32* z) { + /* + * This regular expression extracts numbers from the following string + * construct: "(num1, num2, num3)", where num1, num2 and num3 are decimal + * numbers. Leading and trailing spaces are also caught by the expression. + */ + const boost::regex re("\\s*\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)\\s*"); + + boost::smatch m; + if (boost::regex_search(reg_name, m, re)) { + // string representations of parsed by regex++ numbers + std::string xstr(m[1].first, m[1].second); + std::string ystr(m[2].first, m[2].second); + std::string zstr(m[3].first, m[3].second); + + *x = atoi(xstr.c_str()); + *y = atoi(ystr.c_str()); + *z = atoi(zstr.c_str()); + + return boost::regex_replace(reg_name, re, ""); + } + + *x = *y = *z = 0; + + return reg_name; +} + void LLNavigationBar::clearHistoryCache() { mCmbLocation->removeall(); diff --git a/indra/newview/llnavigationbar.h b/indra/newview/llnavigationbar.h index 17a1438912..1c93a05348 100644 --- a/indra/newview/llnavigationbar.h +++ b/indra/newview/llnavigationbar.h @@ -68,6 +68,9 @@ private: void showTeleportHistoryMenu(); void invokeSearch(std::string search_text); + static void appendLocalCoordsToRegName(std::string* reg_name, S32 x, S32 y, S32 z); + static std::string extractLocalCoordsFromRegName(const std::string & reg_name, S32* x, S32* y, S32* z); + // callbacks bool onLocationContextMenuItemEnabled(const LLSD& userdata); void onLocationContextMenuItemClicked(const LLSD& userdata); @@ -81,6 +84,7 @@ private: void onLocationSelection(); void onLocationPrearrange(const LLSD& data); void onSearchCommit(); + void onTeleportFinished(); void onRegionNameResponse( std::string typed_location, std::string region_name, @@ -90,14 +94,16 @@ private: static LLNavigationBar *sInstance; - LLMenuGL* mLocationContextMenu; - LLMenuGL* mTeleportHistoryMenu; - LLButton* mBtnBack; - LLButton* mBtnForward; - LLButton* mBtnHome; - LLSearchEditor* mLeSearch; - LLLocationInputCtrl* mCmbLocation; - bool mPurgeTPHistoryItems; + LLMenuGL* mLocationContextMenu; + LLMenuGL* mTeleportHistoryMenu; + LLButton* mBtnBack; + LLButton* mBtnForward; + LLButton* mBtnHome; + LLSearchEditor* mLeSearch; + LLLocationInputCtrl* mCmbLocation; + boost::signals2::connection mParcelMgrConnection; + bool mPurgeTPHistoryItems; + bool mUpdateTypedLocationHistory; }; #endif diff --git a/indra/newview/llpanelplaceinfo.cpp b/indra/newview/llpanelplaceinfo.cpp index 40275be82f..a2d491c2cf 100644 --- a/indra/newview/llpanelplaceinfo.cpp +++ b/indra/newview/llpanelplaceinfo.cpp @@ -67,7 +67,10 @@ LLPanelPlaceInfo::LLPanelPlaceInfo() mRequestedID(), mPosRegion(), mLandmarkID(), - mMinHeight(0) + mMinHeight(0), + mScrollingPanel(NULL), + mInfoPanel(NULL), + mMediaPanel(NULL) {} LLPanelPlaceInfo::~LLPanelPlaceInfo() @@ -110,9 +113,10 @@ BOOL LLPanelPlaceInfo::postBuild() mMinHeight = scroll_container->getScrolledViewRect().getHeight(); mScrollingPanel = getChild<LLPanel>("scrolling_panel"); - - mInfoPanel = getChild<LLPanel>("info_panel", TRUE, FALSE); - mMediaPanel = getChild<LLMediaPanel>("media_panel", TRUE, FALSE); + mInfoPanel = getChild<LLPanel>("info_panel"); + mMediaPanel = getChild<LLMediaPanel>("media_panel"); + if (!(mMediaPanel && mInfoPanel && mScrollingPanel)) + return FALSE; return TRUE; } @@ -240,12 +244,20 @@ void LLPanelPlaceInfo::setInfoType(INFO_TYPE type) if (!mInfoPanel) return; + if (type != PLACE) + toggleMediaPanel(FALSE); + + bool is_landmark_info_type = type == LANDMARK; + LLPanel* landmark_info_panel = getChild<LLPanel>("landmark_info_panel"); + if (landmark_info_panel) + { + landmark_info_panel->setVisible(is_landmark_info_type); + } + switch(type) { case CREATE_LANDMARK: mCurrentTitle = getString("title_create_landmark"); - - toggleMediaPanel(FALSE); break; case PLACE: @@ -261,14 +273,10 @@ void LLPanelPlaceInfo::setInfoType(INFO_TYPE type) // a landmark or a teleport history item case LANDMARK: mCurrentTitle = getString("title_landmark"); - - toggleMediaPanel(FALSE); break; - + case TELEPORT_HISTORY: mCurrentTitle = getString("title_place"); - - toggleMediaPanel(FALSE); break; } } @@ -383,7 +391,7 @@ void LLPanelPlaceInfo::processParcelInfo(const LLParcelData& parcel_data) if (mCurrentTitle != getString("title_landmark")) { - mTitleEditor->setText(parcel_data.name + "; " + name); + mTitleEditor->setText(parcel_data.name); mNotesEditor->setText(LLStringUtil::null); } } @@ -499,7 +507,7 @@ void LLPanelPlaceInfo::createLandmark(const LLUUID& folder_id) // If typed name is empty use the parcel name instead. if (name.empty()) { - name = mParcelName->getText() + "; " + mRegionName->getText(); + name = mParcelName->getText(); } LLStringUtil::replaceChar(desc, '\n', ' '); @@ -510,7 +518,7 @@ void LLPanelPlaceInfo::createLandmark(const LLUUID& folder_id) void LLPanelPlaceInfo::reshape(S32 width, S32 height, BOOL called_from_parent) { - if (mMinHeight > 0) + if (mMinHeight > 0 && mScrollingPanel != NULL) { mScrollingPanel->reshape(mScrollingPanel->getRect().getWidth(), mMinHeight); } diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index 31b2d01dcf..5976897970 100644 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -106,6 +106,9 @@ BOOL LLPanelPlaces::postBuild() mOverflowBtn = getChild<LLButton>("overflow_btn"); + // *TODO: Assign the action to an appropriate event. + mOverflowBtn->setClickedCallback(boost::bind(&LLPanelPlaces::toggleMediaPanel, this)); + mTabContainer = getChild<LLTabContainer>("Places Tabs"); if (mTabContainer) { @@ -118,17 +121,14 @@ BOOL LLPanelPlaces::postBuild() mFilterEditor->setCommitCallback(boost::bind(&LLPanelPlaces::onFilterEdit, this, _2)); } - mPlaceInfo = getChild<LLPanelPlaceInfo>("panel_place_info", TRUE, FALSE); - if (mPlaceInfo) + mPlaceInfo = getChild<LLPanelPlaceInfo>("panel_place_info"); + if (!mPlaceInfo) + return FALSE; + + LLButton* back_btn = mPlaceInfo->getChild<LLButton>("back_btn"); + if (back_btn) { - LLButton* back_btn = mPlaceInfo->getChild<LLButton>("back_btn"); - if (back_btn) - { - back_btn->setClickedCallback(boost::bind(&LLPanelPlaces::onBackButtonClicked, this)); - } - - // *TODO: Assign the action to an appropriate event. - mOverflowBtn->setClickedCallback(boost::bind(&LLPanelPlaces::toggleMediaPanel, this)); + back_btn->setClickedCallback(boost::bind(&LLPanelPlaces::onBackButtonClicked, this)); } return TRUE; @@ -136,7 +136,7 @@ BOOL LLPanelPlaces::postBuild() void LLPanelPlaces::onOpen(const LLSD& key) { - if(key.size() == 0) + if(mPlaceInfo == NULL || key.size() == 0) return; mPlaceInfoType = key["type"].asString(); @@ -201,6 +201,9 @@ void LLPanelPlaces::onOpen(const LLSD& key) void LLPanelPlaces::setItem(LLInventoryItem* item) { + if (!mPlaceInfo) + return; + mItem = item; // If the item is a link get a linked item @@ -224,6 +227,9 @@ void LLPanelPlaces::setItem(LLInventoryItem* item) void LLPanelPlaces::onLandmarkLoaded(LLLandmark* landmark) { + if (!mPlaceInfo) + return; + LLUUID region_id; landmark->getRegionID(region_id); LLVector3d pos_global; @@ -263,11 +269,6 @@ void LLPanelPlaces::onShareButtonClicked() // TODO: Launch the "Things" Share wizard } -void LLPanelPlaces::onAddLandmarkButtonClicked() -{ - LLFloaterReg::showInstance("add_landmark"); -} - void LLPanelPlaces::onCopySLURLButtonClicked() { mActivePanel->onCopySLURL(); @@ -276,6 +277,9 @@ void LLPanelPlaces::onCopySLURLButtonClicked() void LLPanelPlaces::onTeleportButtonClicked() { + if (!mPlaceInfo) + return; + if (mPlaceInfo->getVisible()) { if (mPlaceInfoType == "landmark") @@ -302,6 +306,9 @@ void LLPanelPlaces::onTeleportButtonClicked() void LLPanelPlaces::onShowOnMapButtonClicked() { + if (!mPlaceInfo) + return; + if (mPlaceInfo->getVisible()) { LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance(); @@ -430,6 +437,9 @@ void LLPanelPlaces::changed(U32 mask) void LLPanelPlaces::onAgentParcelChange() { + if (!mPlaceInfo) + return; + if (mPlaceInfo->getVisible() && (mPlaceInfoType == "agent" || mPlaceInfoType == "create_landmark")) { onOpen(LLSD().insert("type", mPlaceInfoType)); @@ -442,6 +452,9 @@ void LLPanelPlaces::onAgentParcelChange() void LLPanelPlaces::updateVerbs() { + if (!mPlaceInfo) + return; + bool is_place_info_visible = mPlaceInfo->getVisible(); bool is_agent_place_info_visible = mPlaceInfoType == "agent"; bool is_create_landmark_visible = mPlaceInfoType == "create_landmark"; diff --git a/indra/newview/llpanelplaces.h b/indra/newview/llpanelplaces.h index 695c78cfba..431c8168d9 100644 --- a/indra/newview/llpanelplaces.h +++ b/indra/newview/llpanelplaces.h @@ -66,7 +66,6 @@ private: void onFilterEdit(const std::string& search_string); void onTabSelected(); - //void onAddLandmarkButtonClicked(); //void onCopySLURLButtonClicked(); //void onShareButtonClicked(); void onTeleportButtonClicked(); diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h index a205b913ab..579f41eac8 100644 --- a/indra/newview/llscreenchannel.h +++ b/indra/newview/llscreenchannel.h @@ -59,36 +59,55 @@ public: LLScreenChannel(); virtual ~LLScreenChannel(); + // Channel's outfit-functions + // classic reshape void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - - LLToast* addToast(LLUUID id, LLPanel* panel, bool is_not_tip = true); + // initialization of channel's shape and position void init(S32 channel_left, S32 channel_right); + // set allignment of toasts inside a channel + void setToastAlignment(e_notification_toast_alignment align) {mToastAlignment = align;} + // set a template for a string in the OverflowToast + void setOverflowFormatString ( std::string str) { mOverflowFormatString = str; } + // Operating with toasts + // add a toast to a channel + LLToast* addToast(LLUUID id, LLPanel* panel, bool is_not_tip = true); + // kill or modify a toast by its ID void killToastByNotificationID(LLUUID id); void modifyToastByNotificationID(LLUUID id, LLPanel* panel); - - void setToastAlignment(e_notification_toast_alignment align) {mToastAlignment = align;} - - void setControlHovering(bool control) { mControlHovering = control; } - void setHovering(bool hovering) { mIsHovering = hovering; } - + // hide all toasts from screen, but not remove them from a channel + void hideToastsFromScreen(); + // removes all toasts from a channel void removeToastsFromChannel(); + // show all toasts in a channel + void showToasts(); + // + void loadStoredToastsToChannel(); + // void closeUnreadToastsPanel(); - void hideToastsFromScreen(); + // Channel's behavior-functions + // set whether a channel will control hovering inside itself or not + void setControlHovering(bool control) { mControlHovering = control; } + // set Hovering flag for a channel + void setHovering(bool hovering) { mIsHovering = hovering; } + // set whether a channel will store faded toasts or not void setStoreToasts(bool store) { mStoreToasts = store; } - void loadStoredToastsToChannel(); - - void showToasts(); + // tell all channels that the StartUp toast was shown and allow them showing of toasts + static void setStartUpToastShown() { mWasStartUpToastShown = true; } + // Channel's other interface functions functions S32 getNumberOfHiddenToasts() { return mHiddenToastsNum;} + // TODO: split StartUp and Overflow toasts void setNumberOfHiddenToasts(S32 num) { mHiddenToastsNum = num;} - - static void setStartUpToastShown() { mWasStartUpToastShown = true; } - e_notification_toast_alignment getToastAlignment() {return mToastAlignment;} - void setOverflowFormatString ( std::string str) { mOverflowFormatString = str; } + // Channel's callbacks + // callback for storing of faded toasts + typedef boost::function<void (LLPanel* info_panel, const LLUUID id)> store_tost_callback_t; + typedef boost::signals2::signal<void (LLPanel* info_panel, const LLUUID id)> store_tost_signal_t; + store_tost_signal_t mOnStoreToast; + boost::signals2::connection setOnStoreToastCallback(store_tost_callback_t cb) { return mOnStoreToast.connect(cb); } private: struct ToastElem @@ -117,31 +136,38 @@ private: } }; + // Channel's handlers void onToastHover(LLToast* toast, bool mouse_enter); - void onToastFade(LLToast* toast); + void onOverflowToastHide(); + + // void storeToast(ToastElem& toast_elem); + // show-functions depending on allignment of toasts void showToastsBottom(); void showToastsCentre(); void showToastsTop(); + // create the OverflowToast void createOverflowToast(S32 bottom, F32 timer); - void onOverflowToastHide(); + // Channel's flags static bool mWasStartUpToastShown; bool mControlHovering; bool mIsHovering; bool mStoreToasts; bool mOverflowToastHidden; - S32 mHiddenToastsNum; - LLToast* mUnreadToastsPanel; - std::vector<ToastElem> mToastList; - std::vector<ToastElem> mStoredToastList; + // e_notification_toast_alignment mToastAlignment; - std::map<LLToast*, bool> mToastEventStack; + S32 mHiddenToastsNum; + LLToast* mUnreadToastsPanel; std::string mOverflowFormatString; + + std::vector<ToastElem> mToastList; + std::vector<ToastElem> mStoredToastList; + std::map<LLToast*, bool> mToastEventStack; }; } diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 9c29131def..f573a0858b 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -40,7 +40,6 @@ #include "llcompilequeue.h" #include "llfloaterabout.h" #include "llfloateractivespeakers.h" -#include "llfloateraddlandmark.h" #include "llfloateranimpreview.h" #include "llfloaterauction.h" #include "llfloateravatarpicker.h" @@ -129,7 +128,6 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("about_land", "floater_about_land.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLand>); LLFloaterReg::add("active_speakers", "floater_active_speakers.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterActiveSpeakers>); - LLFloaterReg::add("add_landmark", "floater_add_landmark.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAddLandmark>); LLFloaterReg::add("auction", "floater_auction.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAuction>); LLFloaterReg::add("avatar_picker", "floater_avatar_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAvatarPicker>); LLFloaterReg::add("avatar_textures", "floater_avatar_textures.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAvatarTextures>); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index cbaee2ac70..3af85a82c9 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -5280,9 +5280,7 @@ class LLWorldCreateLandmark : public view_listener_t bool handleEvent(const LLSD& userdata) { LLSideTray::getInstance()->showPanel("panel_places", LLSD().insert("type", "create_landmark")); - - // Floater "Add Landmark" functionality moved to Side Tray - //LLFloaterReg::showInstance("add_landmark"); + return true; } }; |