summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llpaneltopinfobar.cpp35
-rw-r--r--indra/newview/llpaneltopinfobar.h5
-rw-r--r--indra/newview/llviewercontrol.cpp12
-rw-r--r--indra/newview/llviewermenu.cpp25
-rw-r--r--indra/newview/llviewermenu.h1
-rw-r--r--indra/newview/skins/default/xui/en/menu_topinfobar.xml51
6 files changed, 126 insertions, 3 deletions
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"));
diff --git a/indra/newview/llpaneltopinfobar.h b/indra/newview/llpaneltopinfobar.h
index 4a85bbcd76..e417a06a64 100644
--- a/indra/newview/llpaneltopinfobar.h
+++ b/indra/newview/llpaneltopinfobar.h
@@ -95,6 +95,11 @@ private:
void onAgentParcelChange();
/**
+ * Called when context menu item is clicked.
+ */
+ void onContextMenuItemClicked(const LLSD::String& userdata);
+
+ /**
* Called when user checks/unchecks Show Coordinates menu item.
*/
void onNavBarShowParcelPropertiesCtrlChanged();
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index f4b4954cbd..f2c9fbf78d 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -462,7 +462,11 @@ bool toggle_agent_pause(const LLSD& newvalue)
bool toggle_show_navigation_panel(const LLSD& newvalue)
{
- LLNavigationBar::getInstance()->showNavigationPanel(newvalue.asBoolean());
+ bool value = newvalue.asBoolean();
+
+ LLNavigationBar::getInstance()->showNavigationPanel(value);
+ gSavedSettings.setBOOL("ShowMiniLocationPanel", !value);
+
return true;
}
@@ -474,7 +478,11 @@ bool toggle_show_favorites_panel(const LLSD& newvalue)
bool toggle_show_mini_location_panel(const LLSD& newvalue)
{
- LLPanelTopInfoBar::getInstance()->setVisible(newvalue.asBoolean());
+ bool value = newvalue.asBoolean();
+
+ LLPanelTopInfoBar::getInstance()->setVisible(value);
+ gSavedSettings.setBOOL("ShowNavbarNavigationPanel", !value);
+
return true;
}
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 36650af6cb..635cc361f3 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -7693,6 +7693,31 @@ void show_navbar_context_menu(LLView* ctrl, S32 x, S32 y)
LLMenuGL::showPopup(ctrl, show_navbar_context_menu, x, y);
}
+void show_topinfobar_context_menu(LLView* ctrl, S32 x, S32 y)
+{
+ static LLMenuGL* show_topbarinfo_context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_topinfobar.xml",
+ gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+
+ LLMenuItemGL* landmark_item = show_topbarinfo_context_menu->getChild<LLMenuItemGL>("Landmark");
+ if (!LLLandmarkActions::landmarkAlreadyExists())
+ {
+ landmark_item->setLabel(LLTrans::getString("AddLandmarkNavBarMenu"));
+ }
+ else
+ {
+ landmark_item->setLabel(LLTrans::getString("EditLandmarkNavBarMenu"));
+ }
+
+ if(gMenuHolder->hasVisibleMenu())
+ {
+ gMenuHolder->hideMenus();
+ }
+
+ show_topbarinfo_context_menu->buildDrawLabels();
+ show_topbarinfo_context_menu->updateParent(LLMenuGL::sMenuContainer);
+ LLMenuGL::showPopup(ctrl, show_topbarinfo_context_menu, x, y);
+}
+
void initialize_edit_menu()
{
view_listener_t::addMenu(new LLEditUndo(), "Edit.Undo");
diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h
index ad88fcea9a..e0497139a5 100644
--- a/indra/newview/llviewermenu.h
+++ b/indra/newview/llviewermenu.h
@@ -53,6 +53,7 @@ void toggle_debug_menus(void*);
void show_context_menu( S32 x, S32 y, MASK mask );
void show_build_mode_context_menu(S32 x, S32 y, MASK mask);
void show_navbar_context_menu(LLView* ctrl, S32 x, S32 y);
+void show_topinfobar_context_menu(LLView* ctrl, S32 x, S32 y);
BOOL enable_save_into_inventory(void*);
void handle_reset_view();
void handle_cut(void*);
diff --git a/indra/newview/skins/default/xui/en/menu_topinfobar.xml b/indra/newview/skins/default/xui/en/menu_topinfobar.xml
new file mode 100644
index 0000000000..cbe249ed4d
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/menu_topinfobar.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<menu
+ height="201"
+ layout="topleft"
+ left="100"
+ mouse_opaque="false"
+ name="menu_topinfobar"
+ top="624"
+ visible="false"
+ width="128">
+ <menu_item_check
+ label="Show Coordinates"
+ name="Show Coordinates">
+ <on_click
+ function="ToggleControl"
+ parameter="NavBarShowCoordinates" />
+ <on_check
+ function="CheckControl"
+ parameter="NavBarShowCoordinates" />
+ </menu_item_check>
+ <menu_item_check
+ label="Show Parcel Properties"
+ name="Show Parcel Properties">
+ <on_click
+ function="ToggleControl"
+ parameter="NavBarShowParcelProperties" />
+ <on_check
+ function="CheckControl"
+ parameter="NavBarShowParcelProperties" />
+ </menu_item_check>
+ <menu_item_separator
+ name="Separator" />
+ <!-- Label of 'Landmark' item is changing in runtime,
+ see AddLandmarkNavBarMenu/EditLandmarkNavBarMenu in strings.xml -->
+ <menu_item_call
+ label="Landmark"
+ name="Landmark">
+ <on_click
+ function="TopInfoBar.Action"
+ parameter="landmark" />
+ </menu_item_call>
+ <menu_item_separator
+ name="Separator" />
+ <menu_item_call
+ label="Copy"
+ name="Copy">
+ <on_click
+ function="TopInfoBar.Action"
+ parameter="copy" />
+ </menu_item_call>
+</menu>