From 4fe44b9033ee793134b7c080c71931c62c33ddf9 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 11 Sep 2018 17:10:32 -0700 Subject: SL-9626: When the panel loses visibility the picker is now automatically closed. Also picker checks handle to parent rather than pointer to parent. --- indra/newview/llpanelenvironment.cpp | 10 ++++++++-- indra/newview/llpanelenvironment.h | 2 +- indra/newview/llsettingspicker.cpp | 16 ++++++++++------ indra/newview/llsettingspicker.h | 2 +- 4 files changed, 20 insertions(+), 10 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 74cc7660f3..41d7d8b54f 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -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(mSettingsFloater.get()); // Show the dialog - if (!picker) + if (!picker && create) { picker = new LLFloaterSettingsPicker(this, LLUUID::null, "SELECT SETTINGS"); diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h index 7469da9c05..bd3db34332 100644 --- a/indra/newview/llpanelenvironment.h +++ b/indra/newview/llpanelenvironment.h @@ -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); diff --git a/indra/newview/llsettingspicker.cpp b/indra/newview/llsettingspicker.cpp index c882e7dbbb..06d54825e7 100644 --- a/indra/newview/llsettingspicker.cpp +++ b/indra/newview/llsettingspicker.cpp @@ -59,13 +59,15 @@ namespace LLFloaterSettingsPicker::LLFloaterSettingsPicker(LLView * owner, LLUUID initial_asset_id, const std::string &label, const LLSD ¶ms): 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); diff --git a/indra/newview/llsettingspicker.h b/indra/newview/llsettingspicker.h index b3637fd59a..a58fa38ed0 100644 --- a/indra/newview/llsettingspicker.h +++ b/indra/newview/llsettingspicker.h @@ -98,7 +98,7 @@ private: void onButtonSelect(); - LLView* mOwner; + LLHandle mOwnerHandle; std::string mLabel; LLUUID mSettingAssetID; LLUUID mDefaultSettingsAssetID; -- cgit v1.2.3