From 64a44d6c1bb8f4a0671501341d2b450ec6814bbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Liru=20F=C3=A6rs?= Date: Tue, 11 Feb 2020 18:31:47 -0500 Subject: [PATCH] Fix size and position of folder floaters not being restored from setting --- indra/newview/lffloaterinvpanel.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/indra/newview/lffloaterinvpanel.cpp b/indra/newview/lffloaterinvpanel.cpp index d729054e3..5cba1ae93 100644 --- a/indra/newview/lffloaterinvpanel.cpp +++ b/indra/newview/lffloaterinvpanel.cpp @@ -33,33 +33,27 @@ LFFloaterInvPanel::LFFloaterInvPanel(const LLSD& cat, const std::string& name, L { // Setup the floater first mPanel = new LLInventoryPanel("inv_panel", LLInventoryPanel::DEFAULT_SORT_ORDER, cat, LLRect(), model ? model : &gInventory, true); - const auto& title = name.empty() ? gInventory.getCategory(mPanel->getRootFolderID())->getName() : name; - - // Figure out a unique name for our rect control - const auto rect_control = llformat("FloaterInv%sRect", boost::algorithm::erase_all_copy(title, " ").data()); - - bool existed = gSavedSettings.controlExists(rect_control); - if (existed) // Set our initial rect to the stored control - setRectControl(rect_control); // Load from XUI mCommitCallbackRegistrar.add("InvPanel.Search", boost::bind(&LLInventoryPanel::setFilterSubString, boost::ref(mPanel), _2)); LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inv_panel.xml"); // Now set the title + const auto& title = name.empty() ? gInventory.getCategory(mPanel->getRootFolderID())->getName() : name; setTitle(title); - // If we haven't existed before, create and set our rect control now - if (!existed) + // Figure out a unique name for our rect control + const auto rect_control = llformat("FloaterInv%sRect", boost::algorithm::erase_all_copy(title, " ").data()); + if (!gSavedSettings.controlExists(rect_control)) // If we haven't existed before, create it { S32 left, top; gFloaterView->getNewFloaterPosition(&left, &top); LLRect rect = getRect(); rect.translate(left - rect.mLeft, top - rect.mTop); - setRect(rect); gSavedSettings.declareRect(rect_control, rect, "Rectangle for " + title + " window"); - setRectControl(rect_control); } + setRectControl(rect_control); + applyRectControl(); // Set our initial rect to the stored (or just created) control // Now take care of the children LLPanel* panel = getChild("placeholder_panel");