summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermenu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewermenu.cpp')
-rw-r--r--indra/newview/llviewermenu.cpp138
1 files changed, 79 insertions, 59 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 8c61ba7558..bc3b8ac9d6 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -44,6 +44,7 @@
#include "llagent.h"
#include "llagentwearables.h"
#include "llagentpilot.h"
+#include "llbottomtray.h"
#include "llcompilequeue.h"
#include "llconsole.h"
#include "lldebugview.h"
@@ -3554,9 +3555,15 @@ bool LLHaveCallingcard::operator()(LLInventoryCategory* cat,
BOOL is_agent_mappable(const LLUUID& agent_id)
{
- return (LLAvatarActions::isFriend(agent_id) &&
- LLAvatarTracker::instance().getBuddyInfo(agent_id)->isOnline() &&
- LLAvatarTracker::instance().getBuddyInfo(agent_id)->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION)
+ const LLRelationship* buddy_info = NULL;
+ bool is_friend = LLAvatarActions::isFriend(agent_id);
+
+ if (is_friend)
+ buddy_info = LLAvatarTracker::instance().getBuddyInfo(agent_id);
+
+ return (buddy_info &&
+ buddy_info->isOnline() &&
+ buddy_info->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION)
);
}
@@ -4415,35 +4422,22 @@ bool visible_take_object()
return !is_selection_buy_not_take() && enable_take();
}
+bool tools_visible_buy_object()
+{
+ return is_selection_buy_not_take();
+}
+
+bool tools_visible_take_object()
+{
+ return !is_selection_buy_not_take();
+}
+
class LLToolsEnableBuyOrTake : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
bool is_buy = is_selection_buy_not_take();
bool new_value = is_buy ? enable_buy_object() : enable_take();
-
- // Update label
- std::string label;
- std::string buy_text;
- std::string take_text;
- std::string param = userdata.asString();
- std::string::size_type offset = param.find(",");
- if (offset != param.npos)
- {
- buy_text = param.substr(0, offset);
- take_text = param.substr(offset+1);
- }
- if (is_buy)
- {
- label = buy_text;
- }
- else
- {
- label = take_text;
- }
- gMenuHolder->childSetText("Pie Object Take", label);
- gMenuHolder->childSetText("Menu Object Take", label);
-
return new_value;
}
};
@@ -5507,6 +5501,37 @@ bool enable_pay_object()
return false;
}
+bool visible_object_stand_up()
+{
+ // 'Object Stand Up' menu item is visible when agent is sitting on selection
+ return sitting_on_selection();
+}
+
+bool visible_object_sit()
+{
+ // 'Object Sit' menu item is visible when agent is not sitting on selection
+ bool is_sit_visible = !sitting_on_selection();
+ if (is_sit_visible)
+ {
+ LLMenuItemGL* sit_menu_item = gMenuHolder->getChild<LLMenuItemGL>("Object Sit");
+ // Init default 'Object Sit' menu item label
+ static const LLStringExplicit sit_text(sit_menu_item->getLabel());
+ // Update label
+ std::string label;
+ LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
+ if (node && node->mValid && !node->mSitName.empty())
+ {
+ label.assign(node->mSitName);
+ }
+ else
+ {
+ label = sit_text;
+ }
+ sit_menu_item->setLabel(label);
+ }
+ return is_sit_visible;
+}
+
class LLObjectEnableSitOrStand : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
@@ -5521,34 +5546,6 @@ class LLObjectEnableSitOrStand : public view_listener_t
new_value = true;
}
}
- // Update label
- std::string label;
- std::string sit_text;
- std::string stand_text;
- std::string param = userdata.asString();
- std::string::size_type offset = param.find(",");
- if (offset != param.npos)
- {
- sit_text = param.substr(0, offset);
- stand_text = param.substr(offset+1);
- }
- if (sitting_on_selection())
- {
- label = stand_text;
- }
- else
- {
- LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
- if (node && node->mValid && !node->mSitName.empty())
- {
- label.assign(node->mSitName);
- }
- else
- {
- label = sit_text;
- }
- }
- gMenuHolder->childSetText("Object Sit", label);
return new_value;
}
@@ -6402,7 +6399,6 @@ class LLToolsSelectedScriptAction : public view_listener_t
else
{
llwarns << "Failed to generate LLFloaterScriptQueue with action: " << action << llendl;
- delete queue;
}
return true;
}
@@ -6891,7 +6887,8 @@ class LLToolsEditLinkedParts : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
- BOOL select_individuals = gSavedSettings.getBOOL("EditLinkedParts");
+ BOOL select_individuals = !gSavedSettings.getBOOL("EditLinkedParts");
+ gSavedSettings.setBOOL( "EditLinkedParts", select_individuals );
if (select_individuals)
{
LLSelectMgr::getInstance()->demoteSelectionToIndividuals();
@@ -7626,6 +7623,24 @@ class LLWorldDayCycle : public view_listener_t
}
};
+class LLWorldToggleMovementControls : public view_listener_t
+{
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLBottomTray::getInstance()->toggleMovementControls();
+ return true;
+ }
+};
+
+class LLWorldToggleCameraControls : public view_listener_t
+{
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLBottomTray::getInstance()->toggleCameraControls();
+ return true;
+ }
+};
+
void show_navbar_context_menu(LLView* ctrl, S32 x, S32 y)
{
static LLMenuGL* show_navbar_context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_hide_navbar.xml",
@@ -7745,6 +7760,9 @@ void initialize_menus()
view_listener_t::addMenu(new LLWorldPostProcess(), "World.PostProcess");
view_listener_t::addMenu(new LLWorldDayCycle(), "World.DayCycle");
+ view_listener_t::addMenu(new LLWorldToggleMovementControls(), "World.Toggle.MovementControls");
+ view_listener_t::addMenu(new LLWorldToggleCameraControls(), "World.Toggle.CameraControls");
+
// Tools menu
view_listener_t::addMenu(new LLToolsSelectTool(), "Tools.SelectTool");
view_listener_t::addMenu(new LLToolsSelectOnlyMyObjects(), "Tools.SelectOnlyMyObjects");
@@ -7774,12 +7792,11 @@ void initialize_menus()
view_listener_t::addMenu(new LLToolsEnableUnlink(), "Tools.EnableUnlink");
view_listener_t::addMenu(new LLToolsEnableBuyOrTake(), "Tools.EnableBuyOrTake");
enable.add("Tools.EnableTakeCopy", boost::bind(&enable_object_take_copy));
+ enable.add("Tools.VisibleBuyObject", boost::bind(&tools_visible_buy_object));
+ enable.add("Tools.VisibleTakeObject", boost::bind(&tools_visible_take_object));
view_listener_t::addMenu(new LLToolsEnableSaveToInventory(), "Tools.EnableSaveToInventory");
view_listener_t::addMenu(new LLToolsEnableSaveToObjectInventory(), "Tools.EnableSaveToObjectInventory");
- /*view_listener_t::addMenu(new LLToolsVisibleBuyObject(), "Tools.VisibleBuyObject");
- view_listener_t::addMenu(new LLToolsVisibleTakeObject(), "Tools.VisibleTakeObject");*/
-
// Help menu
// most items use the ShowFloater method
@@ -8002,6 +8019,9 @@ void initialize_menus()
enable.add("Object.EnableDelete", boost::bind(&enable_object_delete));
enable.add("Object.EnableWear", boost::bind(&object_selected_and_point_valid));
+ enable.add("Object.StandUpVisible", boost::bind(&visible_object_stand_up));
+ enable.add("Object.SitVisible", boost::bind(&visible_object_sit));
+
view_listener_t::addMenu(new LLObjectEnableReturn(), "Object.EnableReturn");
view_listener_t::addMenu(new LLObjectEnableReportAbuse(), "Object.EnableReportAbuse");