From 03b836d94f0f09936af887302db7e19f45881f01 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Wed, 19 Oct 2011 17:25:18 -0700 Subject: EXP-1424 FIX Floaters open on top of one another in default position with no offset EXP-1412 FIX Additional Inventory windows are opened directly on top of each after opening additional inventory windows and closing the first time also made sidepanel floaters reuse the existing instances, saving state --- indra/llui/llfloater.cpp | 23 ++++++++++++++++++---- indra/llui/llfloater.h | 2 ++ indra/llui/llfloaterreg.cpp | 1 + .../skins/default/xui/en/floater_my_appearance.xml | 1 + .../skins/default/xui/en/floater_my_inventory.xml | 1 + .../skins/default/xui/en/floater_people.xml | 1 + .../newview/skins/default/xui/en/floater_picks.xml | 1 + .../skins/default/xui/en/floater_places.xml | 1 + 8 files changed, 27 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 3085921e04..29d05b8002 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -165,6 +165,7 @@ LLFloater::Params::Params() : title("title"), short_title("short_title"), single_instance("single_instance", false), + reuse_instance("reuse_instance", false), can_resize("can_resize", false), can_minimize("can_minimize", true), can_close("can_close", true), @@ -239,6 +240,7 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p) mTitle(p.title), mShortTitle(p.short_title), mSingleInstance(p.single_instance), + mReuseInstance(p.reuse_instance.isProvided() ? p.reuse_instance : p.single_instance), // reuse single-instance floaters by default mKey(key), mCanTearOff(p.can_tear_off), mCanMinimize(p.can_minimize), @@ -776,12 +778,19 @@ void LLFloater::closeFloater(bool app_quitting) else { setVisible(FALSE); + if (!mReuseInstance) + { + destroy(); + } } } else { setVisible(FALSE); // hide before destroying (so handleVisibilityChange() gets called) - destroy(); + if (!mReuseInstance) + { + destroy(); + } } } } @@ -861,9 +870,15 @@ bool LLFloater::applyRectControl() { bool saved_rect = false; - // If we have a saved rect, use it - if (mRectControl.size() > 1) + if (LLFloaterReg::getLastFloaterInGroup(mInstanceName)) + { + // other floaters in our group, position ourselves relative to them and don't save the rect + mRectControl.clear(); + mOpenPositioning = LLFloaterEnums::OPEN_POSITIONING_CASCADING; + } + else if (mRectControl.size() > 1) { + // If we have a saved rect, use it const LLRect& rect = getControlGroup()->getRect(mRectControl); saved_rect = rect.notEmpty(); if (saved_rect) @@ -2949,6 +2964,7 @@ void LLFloater::initFromParams(const LLFloater::Params& p) mHeaderHeight = p.header_height; mLegacyHeaderHeight = p.legacy_header_height; mSingleInstance = p.single_instance; + mReuseInstance = p.reuse_instance.isProvided() ? p.reuse_instance : p.single_instance; mOpenPositioning = p.open_positioning; mSpecifiedLeft = p.specified_left; @@ -3230,7 +3246,6 @@ void LLFloater::stackWith(LLFloater& other) next_rect.setLeftTopAndSize(next_rect.mLeft, next_rect.mTop, getRect().getWidth(), getRect().getHeight()); - mRectControl.clear(); // don't save rect of stacked floaters setShape(next_rect); } diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index f610b04e35..f384e64e53 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -120,6 +120,7 @@ public: short_title; Optional single_instance, + reuse_instance, can_resize, can_minimize, can_close, @@ -409,6 +410,7 @@ private: LLUIString mShortTitle; BOOL mSingleInstance; // TRUE if there is only ever one instance of the floater + bool mReuseInstance; // true if we want to hide the floater when we close it instead of destroying it std::string mInstanceName; // Store the instance name so we can remove ourselves from the list BOOL mCanTearOff; diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index df3cff9968..e144b68f5e 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -167,6 +167,7 @@ LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key) res->setInstanceName(name); LLFloater *last_floater = (list.empty() ? NULL : list.back()); + res->applyControlsAndPosition(last_floater); gFloaterView->adjustToFitScreen(res, false); diff --git a/indra/newview/skins/default/xui/en/floater_my_appearance.xml b/indra/newview/skins/default/xui/en/floater_my_appearance.xml index d9f3f1e13f..a40393aed8 100644 --- a/indra/newview/skins/default/xui/en/floater_my_appearance.xml +++ b/indra/newview/skins/default/xui/en/floater_my_appearance.xml @@ -10,6 +10,7 @@ help_topic="appearance" save_rect="true" single_instance="true" + reuse_instance="true" title="APPEARANCE" min_height="260" min_width="333" diff --git a/indra/newview/skins/default/xui/en/floater_my_inventory.xml b/indra/newview/skins/default/xui/en/floater_my_inventory.xml index 44491c671f..80718584e3 100644 --- a/indra/newview/skins/default/xui/en/floater_my_inventory.xml +++ b/indra/newview/skins/default/xui/en/floater_my_inventory.xml @@ -10,6 +10,7 @@ name="floater_my_inventory" save_rect="true" save_visibility="true" + reuse_instance="false" title="INVENTORY" width="333" >