summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermenu.cpp
diff options
context:
space:
mode:
authorEugene Mutavchi <emutavchi@productengine.com>2010-03-01 19:15:40 +0200
committerEugene Mutavchi <emutavchi@productengine.com>2010-03-01 19:15:40 +0200
commit4802a6f572b8b6c6e61465e3c6cf6b563fd163e4 (patch)
tree7e114b9c23b104a7c5cfc6193a4855cf60492dc2 /indra/newview/llviewermenu.cpp
parent604537b23557ed8f2b0fba88b5b58e21da4417ce (diff)
Implemented major sub-task EXT-5722 (hard-coded: Right click on Object > Sit Here and Take are hard-coded)
--HG-- branch : product-engine
Diffstat (limited to 'indra/newview/llviewermenu.cpp')
-rw-r--r--indra/newview/llviewermenu.cpp62
1 files changed, 34 insertions, 28 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 15c72fdef1..bc3b8ac9d6 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -5501,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)
@@ -5515,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;
}
@@ -8016,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");