Fix size and position of folder floaters not being restored from setting
This commit is contained in:
@@ -33,33 +33,27 @@ LFFloaterInvPanel::LFFloaterInvPanel(const LLSD& cat, const std::string& name, L
|
|||||||
{
|
{
|
||||||
// Setup the floater first
|
// Setup the floater first
|
||||||
mPanel = new LLInventoryPanel("inv_panel", LLInventoryPanel::DEFAULT_SORT_ORDER, cat, LLRect(), model ? model : &gInventory, true);
|
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
|
// Load from XUI
|
||||||
mCommitCallbackRegistrar.add("InvPanel.Search", boost::bind(&LLInventoryPanel::setFilterSubString, boost::ref(mPanel), _2));
|
mCommitCallbackRegistrar.add("InvPanel.Search", boost::bind(&LLInventoryPanel::setFilterSubString, boost::ref(mPanel), _2));
|
||||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inv_panel.xml");
|
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inv_panel.xml");
|
||||||
|
|
||||||
// Now set the title
|
// Now set the title
|
||||||
|
const auto& title = name.empty() ? gInventory.getCategory(mPanel->getRootFolderID())->getName() : name;
|
||||||
setTitle(title);
|
setTitle(title);
|
||||||
|
|
||||||
// If we haven't existed before, create and set our rect control now
|
// Figure out a unique name for our rect control
|
||||||
if (!existed)
|
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;
|
S32 left, top;
|
||||||
gFloaterView->getNewFloaterPosition(&left, &top);
|
gFloaterView->getNewFloaterPosition(&left, &top);
|
||||||
LLRect rect = getRect();
|
LLRect rect = getRect();
|
||||||
rect.translate(left - rect.mLeft, top - rect.mTop);
|
rect.translate(left - rect.mLeft, top - rect.mTop);
|
||||||
setRect(rect);
|
|
||||||
gSavedSettings.declareRect(rect_control, rect, "Rectangle for " + title + " window");
|
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
|
// Now take care of the children
|
||||||
LLPanel* panel = getChild<LLPanel>("placeholder_panel");
|
LLPanel* panel = getChild<LLPanel>("placeholder_panel");
|
||||||
|
|||||||
Reference in New Issue
Block a user