diff options
author | Merov Linden <merov@lindenlab.com> | 2013-02-21 19:15:48 -0800 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2013-02-21 19:15:48 -0800 |
commit | 86150b4019d1a84b4af73f0ea18c47baff955562 (patch) | |
tree | e5414250c8b0c4f18e3a128d09b9da1494dadd75 | |
parent | f79f9f111b0db67cacfe9bbe453737f3979b3ba9 (diff) |
CHUI-568 : WIP : Introduced Ctrl-T and Ctrl-H for conversations and nearby chat
-rw-r--r-- | indra/llui/llfloater.cpp | 33 | ||||
-rw-r--r-- | indra/llui/llfloater.h | 3 | ||||
-rw-r--r-- | indra/llui/llfloaterreg.cpp | 30 | ||||
-rw-r--r-- | indra/newview/llfloaterimnearbychat.cpp | 21 | ||||
-rw-r--r-- | indra/newview/llfloaterimnearbychat.h | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 8 |
6 files changed, 79 insertions, 18 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 734e2cfda7..bf424883b3 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -813,6 +813,22 @@ void LLFloater::closeFloater(bool app_quitting) } /*virtual*/ +void LLFloater::closeHostedFloater() +{ + // When toggling *visibility*, close the host instead of the floater when hosted + if (getHost()) + { + llinfos << "Merov debug : closeHostedFloater : host " << llendl; + getHost()->closeFloater(); + } + else + { + llinfos << "Merov debug : closeHostedFloater : floater " << llendl; + closeFloater(); + } +} + +/*virtual*/ void LLFloater::reshape(S32 width, S32 height, BOOL called_from_parent) { LLPanel::reshape(width, height, called_from_parent); @@ -1609,8 +1625,19 @@ void LLFloater::bringToFront( S32 x, S32 y ) // virtual void LLFloater::setVisibleAndFrontmost(BOOL take_focus) { - setVisible(TRUE); - setFrontmost(take_focus); + LLMultiFloater* hostp = getHost(); + if (hostp) + { + llinfos << "Merov debug : setVisibleAndFrontmost : hostp->setFrontmost " << llendl; + hostp->setVisible(TRUE); + hostp->setFrontmost(take_focus); + } + else + { + llinfos << "Merov debug : setVisibleAndFrontmost : setFrontmost " << llendl; + setVisible(TRUE); + setFrontmost(take_focus); + } } void LLFloater::setFrontmost(BOOL take_focus) @@ -1618,12 +1645,14 @@ void LLFloater::setFrontmost(BOOL take_focus) LLMultiFloater* hostp = getHost(); if (hostp) { + llinfos << "Merov debug : setFrontmost : hostp->showFloater " << llendl; // this will bring the host floater to the front and select // the appropriate panel hostp->showFloater(this); } else { + llinfos << "Merov debug : setFrontmost : bringToFront " << llendl; // there are more than one floater view // so we need to query our parent directly ((LLFloaterView*)getParent())->bringToFront(this, take_focus); diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 157b9b0113..cb5bf28db3 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -226,6 +226,9 @@ public: // If allowed, close the floater cleanly, releasing focus. virtual void closeFloater(bool app_quitting = false); + // Close the floater or its host. Use when hidding or toggling a floater instance. + virtual void closeHostedFloater(); + /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); // Release keyboard and mouse focus diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index 306caf2b91..c0be086671 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -264,11 +264,7 @@ 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(); + instance->closeHostedFloater(); return true; } else @@ -281,18 +277,17 @@ bool LLFloaterReg::hideInstance(const std::string& name, const LLSD& key) // returns true if the instance is visible when completed bool LLFloaterReg::toggleInstance(const std::string& name, const LLSD& key) { + llinfos << "Merov debug : toggleInstance, name = " << name << ", key = " << key.asString() << llendl; 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(); + llinfos << "Merov debug : call closeHostedFloater " << llendl; + instance->closeHostedFloater(); return false; } else { + llinfos << "Merov debug : call show instance " << llendl; return showInstance(name, key, TRUE) ? true : false; } } @@ -481,31 +476,42 @@ 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. // + llinfos << "Merov debug : toggleInstanceOrBringToFront, name = " << sdname.asString() << ", key = " << key.asString() << llendl; 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 (instance->isMinimized()) { + llinfos << "Merov debug : unminimize, make visible and set to front " << llendl; instance->setMinimized(FALSE); instance->setVisibleAndFrontmost(); } else if (!instance->isShown()) { + llinfos << "Merov debug : open, make visible and set to front " << llendl; instance->openFloater(key); instance->setVisibleAndFrontmost(); } else if (!instance->isFrontmost()) { + llinfos << "Merov debug : make visible and set to front " << llendl; instance->setVisibleAndFrontmost(); } else { - instance->closeFloater(); + llinfos << "Merov debug : closeHostedFloater " << llendl; + instance->closeHostedFloater(); } } diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp index 430326203f..80051eb7f1 100644 --- a/indra/newview/llfloaterimnearbychat.cpp +++ b/indra/newview/llfloaterimnearbychat.cpp @@ -136,6 +136,27 @@ BOOL LLFloaterIMNearbyChat::postBuild() } // virtual +void LLFloaterIMNearbyChat::closeFloater(bool app_quitting) +{ + llinfos << "Merov debug : LLFloaterIMNearbyChat::closeFloater! " << llendl; + LLFloater::closeFloater(app_quitting); +} + +// virtual +void LLFloaterIMNearbyChat::closeHostedFloater() +{ + if (getHost()) + { + llinfos << "Merov debug : LLFloaterIMNearbyChat::closeHostedFloater : hosted -> do nothing" << llendl; + } + else + { + llinfos << "Merov debug : LLFloaterIMNearbyChat::closeHostedFloater : close floater " << llendl; + LLFloater::closeFloater(); + } +} + +// virtual void LLFloaterIMNearbyChat::refresh() { displaySpeakingIndicator(); diff --git a/indra/newview/llfloaterimnearbychat.h b/indra/newview/llfloaterimnearbychat.h index 14c7d01ecd..2d32bb3fc9 100644 --- a/indra/newview/llfloaterimnearbychat.h +++ b/indra/newview/llfloaterimnearbychat.h @@ -54,6 +54,8 @@ public: /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onClose(bool app_quitting); /*virtual*/ void setVisible(BOOL visible); + /*virtual*/ void closeFloater(bool app_quitting = false); + /*virtual*/ void closeHostedFloater(); void loadHistory(); void reloadMessages(bool clean_messages = false); diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index b50deb7d7a..544f06ac0c 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -183,8 +183,7 @@ </menu_item_call> <menu_item_call label="Toolbar buttons..." - name="Toolbars" - shortcut="control|T"> + name="Toolbars"> <menu_item_call.on_click function="Floater.Toggle" parameter="toybox" /> @@ -223,7 +222,8 @@ tear_off="true"> <menu_item_check label="Conversations..." - name="Conversations"> + name="Conversations" + shortcut="control|T"> <menu_item_check.on_check function="Floater.IsOpen" parameter="im_container" /> @@ -240,7 +240,7 @@ function="Floater.Visible" parameter="nearby_chat" /> <menu_item_check.on_click - function="Floater.Toggle" + function="Floater.ToggleOrBringToFront" parameter="nearby_chat" /> </menu_item_check> <menu_item_check |