From 2c5af9672c8b531762475c752dd1904a4024ff67 Mon Sep 17 00:00:00 2001 From: Andrew Polunin Date: Fri, 18 Jun 2010 15:58:00 +0300 Subject: EXT-5808 FIXED Added another context menu. Also Navigation Bar and Mini-Location bar are mutually exclusive now - Implemented context menu for Mini-Location bar (menu_topinfobar.xml) - Implemented function show_topinfobar_context_menu() (in llviewermenu.h) which displays context menu for Mini-Location bar. - Functions toggle_show_navigation_panel() and toggle_show_mini_location_panel() modified so that Navigation Bar and Mini-Location bar are mutually exclusive (when the former is visible the latter is hidden and vice versa). - Implemented method LLPanelTopInfoBar::onContextMenuItemClicked which handles \"landmark\" and \"copy\" Mini-Location bar context menu actions. Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/607/ --HG-- branch : product-engine --- indra/newview/llpaneltopinfobar.cpp | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpaneltopinfobar.cpp') diff --git a/indra/newview/llpaneltopinfobar.cpp b/indra/newview/llpaneltopinfobar.cpp index 7cf574b6e5..68dc1cdf71 100644 --- a/indra/newview/llpaneltopinfobar.cpp +++ b/indra/newview/llpaneltopinfobar.cpp @@ -36,12 +36,16 @@ #include "llagent.h" #include "llagentui.h" +#include "llclipboard.h" +#include "lllandmarkactions.h" #include "lllocationinputctrl.h" #include "llnotificationsutil.h" #include "llparcel.h" #include "llsidetray.h" +#include "llslurl.h" #include "llstatusbar.h" #include "llviewercontrol.h" +#include "llviewerinventory.h" #include "llviewermenu.h" #include "llviewerparcelmgr.h" #include "llviewerregion.h" @@ -65,6 +69,9 @@ private: LLPanelTopInfoBar::LLPanelTopInfoBar(): mParcelChangedObserver(0) { + LLUICtrl::CommitCallbackRegistry::currentRegistrar() + .add("TopInfoBar.Action", boost::bind(&LLPanelTopInfoBar::onContextMenuItemClicked, this, _2)); + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_topinfo_bar.xml"); } @@ -120,7 +127,7 @@ void LLPanelTopInfoBar::handleLoginComplete() BOOL LLPanelTopInfoBar::handleRightMouseDown(S32 x, S32 y, MASK mask) { - show_navbar_context_menu(this, x, y); + show_topinfobar_context_menu(this, x, y); return TRUE; } @@ -387,6 +394,32 @@ void LLPanelTopInfoBar::onAgentParcelChange() update(); } +void LLPanelTopInfoBar::onContextMenuItemClicked(const LLSD::String& item) +{ + if (item == "landmark") + { + LLViewerInventoryItem* landmark = LLLandmarkActions::findLandmarkForAgentPos(); + + if(landmark == NULL) + { + LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "create_landmark")); + } + else + { + LLSideTray::getInstance()->showPanel("panel_places", + LLSD().with("type", "landmark").with("id",landmark->getUUID())); + } + } + else if (item == "copy") + { + LLSLURL slurl; + LLAgentUI::buildSLURL(slurl, false); + LLUIString location_str(slurl.getSLURLString()); + + gClipboard.copyFromString(location_str); + } +} + void LLPanelTopInfoBar::onInfoButtonClicked() { LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "agent")); -- cgit v1.2.3