diff --git a/indra/newview/lffloaterinvpanel.cpp b/indra/newview/lffloaterinvpanel.cpp index 5cba1ae93..b687100a0 100644 --- a/indra/newview/lffloaterinvpanel.cpp +++ b/indra/newview/lffloaterinvpanel.cpp @@ -32,10 +32,10 @@ LFFloaterInvPanel::LFFloaterInvPanel(const LLSD& cat, const std::string& name, L : LLInstanceTracker(cat) { // Setup the floater first - mPanel = new LLInventoryPanel("inv_panel", LLInventoryPanel::DEFAULT_SORT_ORDER, cat, LLRect(), model ? model : &gInventory, true); + auto mPanel = new LLInventoryPanel("inv_panel", LLInventoryPanel::DEFAULT_SORT_ORDER, cat, LLRect(), model ? model : &gInventory, true); // Load from XUI - mCommitCallbackRegistrar.add("InvPanel.Search", boost::bind(&LLInventoryPanel::setFilterSubString, boost::ref(mPanel), _2)); + mCommitCallbackRegistrar.add("InvPanel.Search", boost::bind(&LLInventoryPanel::setFilterSubString, mPanel, _2)); LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inv_panel.xml"); // Now set the title @@ -58,18 +58,12 @@ LFFloaterInvPanel::LFFloaterInvPanel(const LLSD& cat, const std::string& name, L // Now take care of the children LLPanel* panel = getChild("placeholder_panel"); mPanel->setRect(panel->getRect()); + mPanel->setOrigin(0, 0); mPanel->postBuild(); mPanel->setFollows(FOLLOWS_ALL); mPanel->setEnabled(true); mPanel->removeBorder(); - addChild(mPanel); - sendChildToBack(mPanel); - removeChild(panel); -} - -LFFloaterInvPanel::~LFFloaterInvPanel() -{ - delete mPanel; + panel->addChild(mPanel); } // static @@ -96,15 +90,18 @@ void LFFloaterInvPanel::closeAll() } } -// virtual BOOL LFFloaterInvPanel::handleKeyHere(KEY key, MASK mask) { - if (!mPanel->hasFocus() && mask == MASK_NONE && (key == KEY_RETURN || key == KEY_DOWN)) + if (mask == MASK_NONE && (key == KEY_RETURN || key == KEY_DOWN)) { - mPanel->setFocus(true); - if (LLFolderView* root = mPanel->getRootFolder()) - root->scrollToShowSelection(); - return true; + auto& mPanel = *getChild("inv_panel"); + if (!mPanel.hasFocus()) + { + mPanel.setFocus(true); + if (LLFolderView* root = mPanel.getRootFolder()) + root->scrollToShowSelection(); + return true; + } } return LLFloater::handleKeyHere(key, mask); diff --git a/indra/newview/lffloaterinvpanel.h b/indra/newview/lffloaterinvpanel.h index 724fed98d..c65763cdd 100644 --- a/indra/newview/lffloaterinvpanel.h +++ b/indra/newview/lffloaterinvpanel.h @@ -18,18 +18,16 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ -#ifndef LFFLOATERINVPANEL_H -#define LFFLOATERINVPANEL_H +#pragma once #include "llfloater.h" #include "llinstancetracker.h" #include "llsdutil.h" -class LFFloaterInvPanel : public LLFloater, public LLInstanceTracker +class LFFloaterInvPanel final : public LLFloater, public LLInstanceTracker { LFFloaterInvPanel(const LLSD& cat, const std::string& name = LLStringUtil::null, class LLInventoryModel* model = nullptr); - ~LFFloaterInvPanel(); public: static void show(const LLSD& cat, const std::string& name = LLStringUtil::null, LLInventoryModel* model = nullptr); // Show the floater for cat (create with other params if necessary) @@ -42,10 +40,5 @@ public: } static void closeAll(); // Called when not allowed to have inventory open - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); - -private: - class LLInventoryPanel* mPanel; + BOOL handleKeyHere(KEY key, MASK mask) override; }; - -#endif //LFFLOATERINVPANEL_H