diff --git a/indra/llui/lfidbearer.cpp b/indra/llui/lfidbearer.cpp index 51d2a8768..8af0b133a 100644 --- a/indra/llui/lfidbearer.cpp +++ b/indra/llui/lfidbearer.cpp @@ -26,12 +26,13 @@ const std::array LFIDBearer::sMenuStrings { "menu_avs_list.xml" // 0 , "menu_groups_list.xml" // 1 -, "menu_objects_list.xml" // 2 // Singu TODO +, "menu_objects_list.xml" // 2 }; std::array LFIDBearer::sMenus {}; const LFIDBearer* LFIDBearer::sActive = nullptr; LFIDBearer::Type LFIDBearer::sActiveType = LFIDBearer::AVATAR; +uuid_vec_t LFIDBearer::sActiveIDs {}; void LFIDBearer::buildMenus() { diff --git a/indra/llui/lfidbearer.h b/indra/llui/lfidbearer.h index 0f8a8b5bd..a54b06619 100644 --- a/indra/llui/lfidbearer.h +++ b/indra/llui/lfidbearer.h @@ -40,19 +40,19 @@ struct LFIDBearer virtual ~LFIDBearer() { if (sActive == this) sActive = nullptr; } virtual LLUUID getStringUUIDSelectedItem() const = 0; virtual uuid_vec_t getSelectedIDs() const { return { getStringUUIDSelectedItem() }; } - virtual S32 getNumSelected() const { return getStringUUIDSelectedItem().notNull(); } virtual Type getSelectedType() const { return AVATAR; } 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 const LLUUID& getActiveSelectedID() { return sActiveIDs.empty() ? LLUUID::null : sActiveIDs[0]; } + static const uuid_vec_t& getActiveSelectedIDs() { return sActiveIDs; } + static size_t getActiveNumSelected() { return sActiveIDs.size(); } static const Type& getActiveType() { return sActiveType; } void setActive() const { sActive = this; sActiveType = getSelectedType(); + sActiveIDs = getSelectedIDs(); //sActiveIDs or even some kinda hybrid map, if Type is MULTIPLE fill the vals? and remove a buncha virtual functions? } @@ -68,4 +68,5 @@ protected: private: static const LFIDBearer* sActive; static Type sActiveType; + static uuid_vec_t sActiveIDs; }; diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index aa9ec150a..c1dcf8eed 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -202,7 +202,7 @@ public: virtual S32 getFirstSelectedIndex() const; std::vector getAllSelected() const; uuid_vec_t getSelectedIDs() const override final; //Helper. Much like getAllSelected, but just provides a LLUUID vec - S32 getNumSelected() const override final; + S32 getNumSelected() const; LLScrollListItem* getLastSelectedItem() const { return mLastSelected; } // iterate over all items diff --git a/indra/newview/llnameui.h b/indra/newview/llnameui.h index e71994877..1e8da160b 100644 --- a/indra/newview/llnameui.h +++ b/indra/newview/llnameui.h @@ -47,7 +47,6 @@ struct LLNameUI : public LFIDBearer } LLUUID getStringUUIDSelectedItem() const override final { return mNameID; } - S32 getNumSelected() const override final { return 1; } Type getSelectedType() const override final { return mType; } void setType(const Type& type); diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h index 75200dfb9..67eb3d4be 100644 --- a/indra/newview/llnetmap.h +++ b/indra/newview/llnetmap.h @@ -70,7 +70,6 @@ public: LLUUID getStringUUIDSelectedItem() const override final { return mClosestAgentAtLastRightClick; } uuid_vec_t getSelectedIDs() const override final { return mClosestAgentsAtLastClick; } - S32 getNumSelected() const override final { return mClosestAgentsAtLastClick.size(); } // [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) void refreshParcelOverlay() { mUpdateParcelImage = true; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 6fe00b513..676ecc26b 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -9100,7 +9100,7 @@ class ListEnableAnySelected : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - gMenuHolder->findControl(userdata["control"].asString())->setValue(LFIDBearer::getActiveNumSelected()); + gMenuHolder->findControl(userdata["control"].asString())->setValue(LFIDBearer::getActiveNumSelected() != 0); return true; } }; @@ -9414,7 +9414,7 @@ class ListTeleportTo : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - const auto&& id = LFIDBearer::getActiveSelectedID(); + const auto& id = LFIDBearer::getActiveSelectedID(); gAgent.teleportViaLocation(LFIDBearer::getActiveType() == LFIDBearer::OBJECT ? gObjectList.findObject(id)->getPositionGlobal() : get_av_pos(id)); return true; } @@ -9452,7 +9452,7 @@ class ListIsNearby : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - const auto&& id = LFIDBearer::getActiveSelectedID(); + const auto& id = LFIDBearer::getActiveSelectedID(); gMenuHolder->findControl(userdata["control"].asString())->setValue(LFIDBearer::getActiveType() == LFIDBearer::OBJECT ? !!gObjectList.findObject(id) : is_nearby(id)); return true; }