diff options
author | Loren Shih <seraph@lindenlab.com> | 2011-03-16 14:54:56 -0400 |
---|---|---|
committer | Loren Shih <seraph@lindenlab.com> | 2011-03-16 14:54:56 -0400 |
commit | 037a83cd47e016f70092bccfdb2c13e759c6ff0a (patch) | |
tree | 2183c8ef1364d5f4e784cb91ea4d67b1861b2452 /indra/newview/llviewermenu.cpp | |
parent | 15b0509c01dbeec6854f4a0a5965e900eda06de1 (diff) | |
parent | 742dd75751f65224d80eb4f7d20daf5a21776c5f (diff) |
Automated merge up from viewer-development into mesh-development
Diffstat (limited to 'indra/newview/llviewermenu.cpp')
-rwxr-xr-x | indra/newview/llviewermenu.cpp | 92 |
1 files changed, 81 insertions, 11 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 89d533da28..26b6ffa19e 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -842,12 +842,14 @@ class LLAdvancedCheckFeature : public view_listener_t } }; -void LLDestinationAndAvatarShow(const LLSD& value) +void toggle_destination_and_avatar_picker(const LLSD& show) { - S32 panel_idx = value.isDefined() ? value.asInteger() : -1; + S32 panel_idx = show.isDefined() ? show.asInteger() : -1; LLView* container = gViewerWindow->getRootView()->getChildView("avatar_picker_and_destination_guide_container"); LLMediaCtrl* destinations = container->findChild<LLMediaCtrl>("destination_guide_contents"); LLMediaCtrl* avatar_picker = container->findChild<LLMediaCtrl>("avatar_picker_contents"); + LLButton* avatar_btn = gViewerWindow->getRootView()->getChildView("bottom_tray")->getChild<LLButton>("avatar_btn"); + LLButton* destination_btn = gViewerWindow->getRootView()->getChildView("bottom_tray")->getChild<LLButton>("destination_btn"); switch(panel_idx) { @@ -856,17 +858,22 @@ void LLDestinationAndAvatarShow(const LLSD& value) destinations->setVisible(true); avatar_picker->setVisible(false); LLFirstUse::notUsingDestinationGuide(false); + avatar_btn->setToggleState(false); + destination_btn->setToggleState(true); break; case 1: container->setVisible(true); destinations->setVisible(false); avatar_picker->setVisible(true); - LLFirstUse::notUsingAvatarPicker(false); + avatar_btn->setToggleState(true); + destination_btn->setToggleState(false); break; default: container->setVisible(false); destinations->setVisible(false); avatar_picker->setVisible(false); + avatar_btn->setToggleState(false); + destination_btn->setToggleState(false); break; } }; @@ -5559,20 +5566,42 @@ class LLShowHelp : public view_listener_t } }; -class LLShowSidetrayPanel : public view_listener_t +class LLToggleHelp : public view_listener_t { bool handleEvent(const LLSD& userdata) { - std::string panel_name = userdata.asString(); - // Toggle the panel - if (!LLSideTray::getInstance()->isPanelActive(panel_name)) + LLFloater* help_browser = (LLFloaterReg::findInstance("help_browser")); + if (help_browser && help_browser->isInVisibleChain()) { - // LLFloaterInventory::showAgentInventory(); - LLSideTray::getInstance()->showPanel(panel_name, LLSD()); + help_browser->closeFloater(); } else { - LLSideTray::getInstance()->collapseSideBar(); + std::string help_topic = userdata.asString(); + LLViewerHelp* vhelp = LLViewerHelp::getInstance(); + vhelp->showTopic(help_topic); + } + return true; + } +}; + +class LLShowSidetrayPanel : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + std::string panel_name = userdata.asString(); + + LLPanel* panel = LLSideTray::getInstance()->getPanel(panel_name); + if (panel) + { + if (panel->isInVisibleChain()) + { + LLSideTray::getInstance()->hidePanel(panel_name); + } + else + { + LLSideTray::getInstance()->showPanel(panel_name); + } } return true; } @@ -5701,6 +5730,44 @@ class LLShowAgentProfile : public view_listener_t } }; +class LLToggleAgentProfile : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLUUID agent_id; + if (userdata.asString() == "agent") + { + agent_id = gAgent.getID(); + } + else if (userdata.asString() == "hit object") + { + LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); + if (objectp) + { + agent_id = objectp->getID(); + } + } + else + { + agent_id = userdata.asUUID(); + } + + LLVOAvatar* avatar = find_avatar_from_object(agent_id); + if (avatar) + { + if (!LLAvatarActions::profileVisible(avatar->getID())) + { + LLAvatarActions::showProfile(avatar->getID()); + } + else + { + LLAvatarActions::hideProfile(avatar->getID()); + } + } + return true; + } +}; + class LLLandEdit : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -8095,8 +8162,10 @@ void initialize_menus() commit.add("ReportAbuse", boost::bind(&handle_report_abuse)); commit.add("BuyCurrency", boost::bind(&handle_buy_currency)); view_listener_t::addMenu(new LLShowHelp(), "ShowHelp"); + view_listener_t::addMenu(new LLToggleHelp(), "ToggleHelp"); view_listener_t::addMenu(new LLPromptShowURL(), "PromptShowURL"); view_listener_t::addMenu(new LLShowAgentProfile(), "ShowAgentProfile"); + view_listener_t::addMenu(new LLToggleAgentProfile(), "ToggleAgentProfile"); view_listener_t::addMenu(new LLToggleControl(), "ToggleControl"); view_listener_t::addMenu(new LLCheckControl(), "CheckControl"); view_listener_t::addMenu(new LLGoToObject(), "GoToObject"); @@ -8117,5 +8186,6 @@ void initialize_menus() view_listener_t::addMenu(new LLToggleUIHints(), "ToggleUIHints"); - commit.add("DestinationAndAvatar.show", boost::bind(&LLDestinationAndAvatarShow, _2)); + commit.add("Destination.show", boost::bind(&toggle_destination_and_avatar_picker, 0)); + commit.add("Avatar.show", boost::bind(&toggle_destination_and_avatar_picker, 1)); } |