diff --git a/indra/llui/lfidbearer.cpp b/indra/llui/lfidbearer.cpp index ce54ecbd5..51d2a8768 100644 --- a/indra/llui/lfidbearer.cpp +++ b/indra/llui/lfidbearer.cpp @@ -30,7 +30,8 @@ const std::array LFIDBearer::sMenuStrings }; std::array LFIDBearer::sMenus {}; -LFIDBearer* LFIDBearer::sActive = nullptr; +const LFIDBearer* LFIDBearer::sActive = nullptr; +LFIDBearer::Type LFIDBearer::sActiveType = LFIDBearer::AVATAR; void LFIDBearer::buildMenus() { @@ -49,7 +50,7 @@ LLMenuGL* LFIDBearer::showMenu(LLView* self, const std::string& menu_name, S32 x void LFIDBearer::showMenu(LLView* self, LLMenuGL* menu, S32 x, S32 y) { - sActive = this; // Menu listeners rely on this + setActive(); // Menu listeners rely on this menu->buildDrawLabels(); menu->updateParent(LLMenuGL::sMenuContainer); LLMenuGL::showPopup(self, menu, x, y); diff --git a/indra/llui/lfidbearer.h b/indra/llui/lfidbearer.h index 1cff25565..0f8a8b5bd 100644 --- a/indra/llui/lfidbearer.h +++ b/indra/llui/lfidbearer.h @@ -43,11 +43,18 @@ struct LFIDBearer virtual S32 getNumSelected() const { return getStringUUIDSelectedItem().notNull(); } virtual Type getSelectedType() const { return AVATAR; } - template static T* getActive() { return static_cast(sActive); } + template static const T* getActive() { return static_cast(sActive); } static LLUUID getActiveSelectedID() { return sActive->getStringUUIDSelectedItem(); } static uuid_vec_t getActiveSelectedIDs() { return sActive->getSelectedIDs(); } static S32 getActiveNumSelected() { return sActive->getNumSelected(); } - static Type getActiveType() { return sActive->getSelectedType(); } + static const Type& getActiveType() { return sActiveType; } + + void setActive() const + { + sActive = this; + sActiveType = getSelectedType(); + //sActiveIDs or even some kinda hybrid map, if Type is MULTIPLE fill the vals? and remove a buncha virtual functions? + } static void buildMenus(); LLMenuGL* showMenu(LLView* self, const std::string& menu_name, S32 x, S32 y, std::function on_menu_built = nullptr); @@ -57,5 +64,8 @@ protected: // Menus that recur, such as general avatars or groups menus static const std::array sMenuStrings; static std::array sMenus; - static LFIDBearer* sActive; + +private: + static const LFIDBearer* sActive; + static Type sActiveType; }; diff --git a/indra/newview/llfloatermap.h b/indra/newview/llfloatermap.h index 839cf2f33..5b3876382 100644 --- a/indra/newview/llfloatermap.h +++ b/indra/newview/llfloatermap.h @@ -58,6 +58,8 @@ public: // [/RLVa:KB] private: + friend class OverlayToggle; + friend class LLScaleMap; LLFloaterMap(const LLSD& key = LLSD()); LLNetMap* mPanelMap; }; diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index eff97ca85..0eecaff35 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -1340,18 +1340,15 @@ void LLFolderView::copy() const S32 count = mSelectedItems.size(); if(getVisible() && getEnabled() && (count > 0)) { - LLFolderViewEventListener* listener = NULL; - selected_items_t::iterator item_it; - for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) + for (auto item : mSelectedItems) { - listener = (*item_it)->getListener(); - if(listener) + if(auto listener = item->getListener()) { listener->copyToClipboard(); } } } - mSearchString.clear(); + //mSearchString.clear(); // Singu Note: There's no good reason to clear out the jumpto item search string now, it'll time out anyway, let's remain const } BOOL LLFolderView::canCut() const diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 16c605dfa..c6234d00e 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -1128,7 +1128,7 @@ void LLFloaterIMPanel::removeDynamicFocus() findChild("instant_message_flyout")->remove(getString("focus")); } -void copy_profile_uri(const LLUUID& id, LFIDBearer::Type type = LFIDBearer::AVATAR); +void copy_profile_uri(const LLUUID& id, const LFIDBearer::Type& type = LFIDBearer::AVATAR); void LLFloaterIMPanel::onFlyoutCommit(LLComboBox* flyout, const LLSD& value) { diff --git a/indra/newview/llnameeditor.cpp b/indra/newview/llnameeditor.cpp index 1d6aa59c2..9ad95f0dd 100644 --- a/indra/newview/llnameeditor.cpp +++ b/indra/newview/llnameeditor.cpp @@ -86,7 +86,7 @@ BOOL LLNameEditor::handleRightMouseDown(S32 x, S32 y, MASK mask) new_menu = mIsGroup ? "menu_nameeditor_group.xml" : "menu_nameeditor_avatar.xml"; } if (!new_menu.empty()) setContextMenu(LLUICtrlFactory::instance().buildMenu(new_menu, LLMenuGL::sMenuContainer)); - sActive = this; + setActive(); return LLLineEditor::handleRightMouseDown(x, y, mask); } diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index ec8c27760..49dcfb4bb 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -53,6 +53,7 @@ #include "llavatarnamecache.h" #include "llcallingcard.h" #include "llcolorscheme.h" +#include "llfloatermap.h" #include "llfloaterworldmap.h" #include "llframetimer.h" // [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) @@ -1360,7 +1361,7 @@ BOOL LLNetMap::handleMouseUp( S32 x, S32 y, MASK mask ) bool OverlayToggle::handleEvent(LLPointer event, const LLSD& sdParam) { // Force an overlay update - LFIDBearer::getActive()->mUpdateParcelImage = true; + LLFloaterMap::findInstance()->mPanelMap->mUpdateParcelImage = true; return true; } // [/SL:KB] @@ -1472,7 +1473,7 @@ BOOL LLNetMap::handleHover( S32 x, S32 y, MASK mask ) // static bool LLScaleMap::handleEvent(LLPointer event, const LLSD& userdata) { - LLNetMap *self = LFIDBearer::getActive(); + auto self = LLFloaterMap::findInstance()->mPanelMap; S32 level = userdata.asInteger(); diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index dfad5f071..5e65862cd 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -1399,7 +1399,7 @@ void LLPanelAvatar::onClickCopy(const LLSD& val) } else { - void copy_profile_uri(const LLUUID& id, LFIDBearer::Type type = LFIDBearer::AVATAR); + void copy_profile_uri(const LLUUID& id, const LFIDBearer::Type& type = LFIDBearer::AVATAR); copy_profile_uri(mAvatarID); } } diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index 55841cd17..46b3a3b24 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -130,7 +130,7 @@ void LLPanelGroupTab::handleClickHelp() } } -void copy_profile_uri(const LLUUID& id, LFIDBearer::Type type); +void copy_profile_uri(const LLUUID& id, const LFIDBearer::Type& type); LLPanelGroup::LLPanelGroup(const LLUUID& group_id) : LLPanel("PanelGroup", LLRect(), FALSE), diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index cf443a06d..bdda724e8 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -9034,17 +9034,17 @@ template T* get_focused() return t; } -const std::string get_slurl_for(const LLUUID& id, LFIDBearer::Type type) +const std::string get_slurl_for(const LLUUID& id, const LFIDBearer::Type& type) { return type == LFIDBearer::GROUP ? LLGroupActions::getSLURL(id) : LLAvatarActions::getSLURL(id); } -const LLWString get_wslurl_for(const LLUUID& id, LFIDBearer::Type type) +const LLWString get_wslurl_for(const LLUUID& id, const LFIDBearer::Type& type) { return utf8str_to_wstring(get_slurl_for(id, type)); } -void copy_profile_uri(const LLUUID& id, LFIDBearer::Type type) +void copy_profile_uri(const LLUUID& id, const LFIDBearer::Type& type) { gViewerWindow->getWindow()->copyTextToClipboard(get_wslurl_for(id, type)); }