diff options
author | Eugene Mutavchi <emutavchi@productengine.com> | 2010-03-01 19:15:40 +0200 |
---|---|---|
committer | Eugene Mutavchi <emutavchi@productengine.com> | 2010-03-01 19:15:40 +0200 |
commit | 4802a6f572b8b6c6e61465e3c6cf6b563fd163e4 (patch) | |
tree | 7e114b9c23b104a7c5cfc6193a4855cf60492dc2 | |
parent | 604537b23557ed8f2b0fba88b5b58e21da4417ce (diff) |
Implemented major sub-task EXT-5722 (hard-coded: Right click on Object > Sit Here and Take are hard-coded)
--HG--
branch : product-engine
-rw-r--r-- | indra/newview/llviewermenu.cpp | 62 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_object.xml | 19 |
2 files changed, 50 insertions, 31 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"); 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"> <menu_item_call.on_click function="Object.SitOrStand" /> + <menu_item_call.on_visible + function="Object.SitVisible" /> <menu_item_call.on_enable function="Object.EnableSitOrStand" - name="EnableSitOrStand" - parameter="Sit Here,Stand Up" /> - </menu_item_call> + name="EnableSitOrStand" /> + </menu_item_call> + <menu_item_call + enabled="false" + label="Stand Up" + name="Object Stand Up"> + <menu_item_call.on_click + function="Object.SitOrStand" /> + <menu_item_call.on_visible + function="Object.StandUpVisible" /> + <menu_item_call.on_enable + function="Object.EnableSitOrStand" + name="EnableSitOrStand" /> + </menu_item_call> <menu_item_call label="Object Profile" name="Object Inspect"> |