summaryrefslogtreecommitdiff
path: root/indra/llui/llfloaterreg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llfloaterreg.cpp')
-rw-r--r--indra/llui/llfloaterreg.cpp73
1 files changed, 44 insertions, 29 deletions
diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp
index 306caf2b91..1cdddf0d5b 100644
--- a/indra/llui/llfloaterreg.cpp
+++ b/indra/llui/llfloaterreg.cpp
@@ -264,17 +264,9 @@ bool LLFloaterReg::hideInstance(const std::string& name, const LLSD& key)
LLFloater* instance = findInstance(name, key);
if (instance)
{
- // When toggling *visibility*, close the host instead of the floater when hosted
- if (instance->getHost())
- instance->getHost()->closeFloater();
- else
- instance->closeFloater();
- return true;
- }
- else
- {
- return false;
+ instance->closeHostedFloater();
}
+ return (instance != NULL);
}
//static
@@ -284,11 +276,7 @@ bool LLFloaterReg::toggleInstance(const std::string& name, const LLSD& key)
LLFloater* instance = findInstance(name, key);
if (LLFloater::isShown(instance))
{
- // When toggling *visibility*, close the host instead of the floater when hosted
- if (instance->getHost())
- instance->getHost()->closeFloater();
- else
- instance->closeFloater();
+ instance->closeHostedFloater();
return false;
}
else
@@ -481,31 +469,58 @@ void LLFloaterReg::toggleInstanceOrBringToFront(const LLSD& sdname, const LLSD&
// * Also, if it is not on top, bring it forward when focus is given.
// * Else the target floater is open, close it.
//
-
std::string name = sdname.asString();
LLFloater* instance = getInstance(name, key);
+
if (!instance)
{
lldebugs << "Unable to get instance of floater '" << name << "'" << llendl;
+ return;
}
- else if (instance->isMinimized())
+
+ // If hosted, we need to take that into account
+ LLFloater* host = instance->getHost();
+
+ if (host)
{
- instance->setMinimized(FALSE);
- instance->setVisibleAndFrontmost();
- }
- else if (!instance->isShown())
- {
- instance->openFloater(key);
- instance->setVisibleAndFrontmost();
- }
- else if (!instance->isFrontmost())
- {
- instance->setVisibleAndFrontmost();
+ if (host->isMinimized() || !host->isShown() || !host->isFrontmost())
+ {
+ host->setMinimized(FALSE);
+ instance->openFloater(key);
+ instance->setVisibleAndFrontmost(true, key);
+ }
+ else if (!instance->getVisible())
+ {
+ instance->openFloater(key);
+ instance->setVisibleAndFrontmost(true, key);
+ instance->setFocus(TRUE);
+ }
+ else
+ {
+ instance->closeHostedFloater();
+ }
}
else
{
- instance->closeFloater();
+ if (instance->isMinimized())
+ {
+ instance->setMinimized(FALSE);
+ instance->setVisibleAndFrontmost(true, key);
+ }
+ else if (!instance->isShown())
+ {
+ instance->openFloater(key);
+ instance->setVisibleAndFrontmost(true, key);
+ }
+ else if (!instance->isFrontmost())
+ {
+ instance->setVisibleAndFrontmost(true, key);
+ }
+ else
+ {
+ instance->closeHostedFloater();
+ }
}
}