From b98d0461d1e4e845154afa243ece1f5e64b18c04 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Fri, 8 Mar 2019 18:11:17 -0500 Subject: [PATCH] [VMM] Make sort menu somewhat work --- .../newview/llfloatermarketplacelistings.cpp | 12 ++-------- indra/newview/llfloatermarketplacelistings.h | 2 ++ indra/newview/llviewermenu.cpp | 23 +++++++++++++++++++ 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 0fccbc196..720eef585 100644 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -64,23 +64,15 @@ void showMenu(LLView* button, LLMenuGL* menu) menu->buildDrawLabels(); menu->updateParent(LLMenuGL::sMenuContainer); const auto& rect = button->getRect(); - LLMenuGL::showPopup(button, menu, rect.mLeft, rect.mBottom); + LLMenuGL::showPopup(button->getParent(), menu, rect.mLeft, rect.mBottom); } BOOL LLPanelMarketplaceListings::postBuild() { childSetAction("add_btn", boost::bind(&LLPanelMarketplaceListings::onAddButtonClicked, this)); childSetAction("audit_btn", boost::bind(&LLPanelMarketplaceListings::onAuditButtonClicked, this)); - mMenu = LLUICtrlFactory::instance().buildMenu("menu_marketplace_view.xml", this); + mMenu = LLUICtrlFactory::instance().buildMenu("menu_marketplace_view.xml", LLMenuGL::sMenuContainer); auto sort = getChild("sort_btn"); - new LLBindMemberListener(this, "Marketplace.ViewSort.Action", [this](LLPointer event, const LLSD& userdata) - { - LLMenuGL::sMenuContainer->findControl(userdata["control"].asString())->setValue(onViewSortMenuItemCheck(userdata["data"])); - }); - new LLBindMemberListener(this, "Marketplace.ViewSort.CheckItem", [this](LLPointer event, const LLSD& userdata) - { - onViewSortMenuItemClicked(userdata["data"]); - }); sort->setCommitCallback(boost::bind(showMenu, _1, mMenu)); mFilterEditor = getChild("filter_editor"); diff --git a/indra/newview/llfloatermarketplacelistings.h b/indra/newview/llfloatermarketplacelistings.h index a44d2f060..775e897b6 100644 --- a/indra/newview/llfloatermarketplacelistings.h +++ b/indra/newview/llfloatermarketplacelistings.h @@ -132,6 +132,8 @@ protected: void updateView(); private: + friend MarketplaceViewSortAction; + friend MarketplaceViewSortCheckItem; S32 getFolderCount(); LLInventoryCategoriesObserver * mCategoriesObserver; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index da6bed3d1..7f0e106d4 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -75,6 +75,7 @@ #include "llfloatergodtools.h" #include "llfloaterhtmlcurrency.h" #include "llfloaterland.h" +#include "llfloatermarketplacelistings.h" #include "llfloatermute.h" #include "llfloateropenobject.h" #include "llfloaterpathfindingcharacters.h" @@ -9318,6 +9319,25 @@ class ListToggleMute : public view_listener_t } }; +struct MarketplaceViewSortAction : view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + LLFloaterMarketplaceListings::findInstance()->mPanelListings->onViewSortMenuItemClicked(userdata); + return true; + } +}; + +struct MarketplaceViewSortCheckItem : view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + LLMenuGL::sMenuContainer->findControl(userdata["control"].asString()) + ->setValue(LLFloaterMarketplaceListings::findInstance()->mPanelListings->onViewSortMenuItemCheck(userdata["data"])); + return true; + } +}; + void addMenu(view_listener_t *menu, const std::string& name) { sMenus.push_back(menu); @@ -9649,6 +9669,9 @@ void initialize_menus() LLTextEditor::setIsFriendCallback(LLAvatarActions::isFriend); LLTextEditor::addMenuListeners(); + addMenu(new MarketplaceViewSortAction, "Marketplace.ViewSort.Action"); + addMenu(new MarketplaceViewSortCheckItem, "Marketplace.ViewSort.CheckItem"); + class LLViewBuildMode : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata)