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.cpp125
1 files changed, 70 insertions, 55 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 7438ba6dc5..cb6844f9df 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -45,6 +45,7 @@
#include "llagent.h"
#include "llagentwearables.h"
#include "llagentpilot.h"
+#include "llbottomtray.h"
#include "llcompilequeue.h"
#include "llconsole.h"
#include "lldebugview.h"
@@ -4365,35 +4366,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;
}
};
@@ -5457,6 +5445,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)
@@ -5471,34 +5490,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;
}
@@ -6840,7 +6831,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();
@@ -7575,6 +7567,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",
@@ -7694,6 +7704,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");
@@ -7723,12 +7736,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
@@ -7955,6 +7967,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");