From 4802a6f572b8b6c6e61465e3c6cf6b563fd163e4 Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi Date: Mon, 1 Mar 2010 19:15:40 +0200 Subject: Implemented major sub-task EXT-5722 (hard-coded: Right click on Object > Sit Here and Take are hard-coded) --HG-- branch : product-engine --- indra/newview/llviewermenu.cpp | 62 ++++++++++++---------- indra/newview/skins/default/xui/en/menu_object.xml | 19 +++++-- 2 files changed, 50 insertions(+), 31 deletions(-) (limited to 'indra/newview') 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("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"); diff --git a/indra/newview/skins/default/xui/en/menu_object.xml b/indra/newview/skins/default/xui/en/menu_object.xml index 9436b2cd73..2c97112e38 100644 --- a/indra/newview/skins/default/xui/en/menu_object.xml +++ b/indra/newview/skins/default/xui/en/menu_object.xml @@ -44,11 +44,24 @@ name="Object Sit"> + - + name="EnableSitOrStand" /> + + + + + + -- cgit v1.2.3