SL-9626: When the panel loses visibility the picker is now automatically closed. Also picker checks handle to parent rather than pointer to parent.

master
Rider Linden 2018-09-11 17:10:32 -07:00
parent 3558377d54
commit 4fe44b9033
4 changed files with 20 additions and 10 deletions

View File

@ -147,6 +147,12 @@ void LLPanelEnvironmentInfo::onVisibilityChange(BOOL new_visibility)
gIdleCallbacks.addFunction(onIdlePlay, this);
else
{
LLFloaterSettingsPicker *picker = getSettingsPicker(false);
if (picker)
{
picker->closeFloater();
}
gIdleCallbacks.deleteFunction(onIdlePlay, this);
LLFloaterEditExtDayCycle *dayeditor = getEditFloater();
if (mCommitConnection.connected())
@ -252,12 +258,12 @@ std::string LLPanelEnvironmentInfo::getInventoryNameForAssetId(LLUUID asset_id)
return name;
}
LLFloaterSettingsPicker *LLPanelEnvironmentInfo::getSettingsPicker()
LLFloaterSettingsPicker * LLPanelEnvironmentInfo::getSettingsPicker(bool create)
{
LLFloaterSettingsPicker *picker = static_cast<LLFloaterSettingsPicker *>(mSettingsFloater.get());
// Show the dialog
if (!picker)
if (!picker && create)
{
picker = new LLFloaterSettingsPicker(this,
LLUUID::null, "SELECT SETTINGS");

View File

@ -125,7 +125,7 @@ protected:
std::string getInventoryNameForAssetId(LLUUID asset_id);
LLFloaterSettingsPicker * getSettingsPicker();
LLFloaterSettingsPicker * getSettingsPicker(bool create = true);
LLFloaterEditExtDayCycle * getEditFloater(bool create = true);
void updateEditFloater(const LLEnvironment::EnvironmentInfo::ptr_t &nextenv);

View File

@ -59,13 +59,15 @@ namespace
LLFloaterSettingsPicker::LLFloaterSettingsPicker(LLView * owner, LLUUID initial_asset_id, const std::string &label, const LLSD &params):
LLFloater(params),
mOwner(owner),
mOwnerHandle(),
mLabel(label),
mActive(true),
mContextConeOpacity(0.0f),
mSettingAssetID(initial_asset_id),
mImmediateFilterPermMask(PERM_NONE)
{
mOwnerHandle = owner->getHandle();
buildFromFile(FLOATER_DEFINITION_XML);
setCanMinimize(FALSE);
}
@ -136,9 +138,10 @@ void LLFloaterSettingsPicker::onClose(bool app_quitting)
return;
mCloseSignal();
if (mOwner)
LLView *owner = mOwnerHandle.get();
if (owner)
{
mOwner->setFocus(TRUE);
owner->setFocus(TRUE);
}
}
@ -165,13 +168,14 @@ void LLFloaterSettingsPicker::setSettingsFilter(LLSettingsType::type_e type)
void LLFloaterSettingsPicker::draw()
{
if (mOwner)
LLView *owner = mOwnerHandle.get();
if (owner)
{
// draw cone of context pointing back to texture swatch
LLRect owner_rect;
mOwner->localRectToOtherView(mOwner->getLocalRect(), &owner_rect, this);
owner->localRectToOtherView(owner->getLocalRect(), &owner_rect, this);
LLRect local_rect = getLocalRect();
if (gFocusMgr.childHasKeyboardFocus(this) && mOwner->isInVisibleChain() && mContextConeOpacity > 0.001f)
if (gFocusMgr.childHasKeyboardFocus(this) && owner->isInVisibleChain() && mContextConeOpacity > 0.001f)
{
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
LLGLEnable(GL_CULL_FACE);

View File

@ -98,7 +98,7 @@ private:
void onButtonSelect();
LLView* mOwner;
LLHandle<LLView> mOwnerHandle;
std::string mLabel;
LLUUID mSettingAssetID;
LLUUID mDefaultSettingsAssetID;