summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrew Dyukov <adyukov@productengine.com>2010-07-15 21:07:16 +0300
committerAndrew Dyukov <adyukov@productengine.com>2010-07-15 21:07:16 +0300
commita97485fa60f1b1f29d8109b79450ab993880529c (patch)
treee5a1cc233a66f974ce7ff778207a0ca2e0de4211 /indra/newview
parent875fb0d72bd39789f506e59ec79bc7252012bfb7 (diff)
EXT-8385 FIXED Fixed simultaneous availability to click "Sit here" and "Stand Up" on object.
Made only one of them enabled in the same time, didn't make disabled one invisible because it was decided so in EXT-8094. - This bug is the result of EXT-8094 fix. Corrected logic of enabling "Sit here" and "Stand up" both in xml and code. - Removed class LLObjectEnableSitOrStand because it's not needed anymore, and it's handleEvent() method duplicates is_object_sittable() function. - Renamed Object.EnableSit to Object.EnableGearSit because its name is now used for enabling object menu sit, and this "simple" version is used only from object inspector's gear menu. Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/761 --HG-- branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llviewermenu.cpp42
-rw-r--r--indra/newview/skins/default/xui/en/menu_inspect_object_gear.xml2
-rw-r--r--indra/newview/skins/default/xui/en/menu_object.xml10
3 files changed, 14 insertions, 40 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 635cc361f3..7cca118392 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -3627,7 +3627,7 @@ class LLEnableEditShape : public view_listener_t
}
};
-bool enable_sit_object()
+bool is_object_sittable()
{
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
@@ -5513,17 +5513,17 @@ bool enable_pay_object()
return false;
}
-bool visible_object_stand_up()
+bool enable_object_stand_up()
{
- // 'Object Stand Up' menu item is visible when agent is sitting on selection
+ // 'Object Stand Up' menu item is enabled when agent is sitting on selection
return sitting_on_selection();
}
-bool visible_object_sit()
+bool enable_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)
+ // 'Object Sit' menu item is enabled when agent is not sitting on selection
+ bool sitting_on_sel = sitting_on_selection();
+ if (!sitting_on_sel)
{
LLMenuItemGL* sit_menu_item = gMenuHolder->getChild<LLMenuItemGL>("Object Sit");
// Init default 'Object Sit' menu item label
@@ -5541,28 +5541,9 @@ bool visible_object_sit()
}
sit_menu_item->setLabel(label);
}
- return is_sit_visible;
+ return !sitting_on_sel && is_object_sittable();
}
-class LLObjectEnableSitOrStand : public view_listener_t
-{
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = false;
- LLViewerObject* dest_object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
-
- if(dest_object)
- {
- if(dest_object->getPCode() == LL_PCODE_VOLUME)
- {
- new_value = true;
- }
- }
-
- return new_value;
- }
-};
-
void dump_select_mgr(void*)
{
LLSelectMgr::getInstance()->dump();
@@ -8067,7 +8048,7 @@ void initialize_menus()
view_listener_t::addMenu(new LLObjectBuild(), "Object.Build");
commit.add("Object.Touch", boost::bind(&handle_object_touch));
commit.add("Object.SitOrStand", boost::bind(&handle_object_sit_or_stand));
- enable.add("Object.EnableSit", boost::bind(&enable_sit_object));
+ enable.add("Object.EnableGearSit", boost::bind(&is_object_sittable));
commit.add("Object.Delete", boost::bind(&handle_object_delete));
view_listener_t::addMenu(new LLObjectAttachToAvatar(), "Object.AttachToAvatar");
view_listener_t::addMenu(new LLObjectReturn(), "Object.Return");
@@ -8084,12 +8065,11 @@ void initialize_menus()
commit.add("Object.Take", boost::bind(&handle_take));
enable.add("Object.EnableOpen", boost::bind(&enable_object_open));
view_listener_t::addMenu(new LLObjectEnableTouch(), "Object.EnableTouch");
- view_listener_t::addMenu(new LLObjectEnableSitOrStand(), "Object.EnableSitOrStand");
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));
+ enable.add("Object.EnableStandUp", boost::bind(&enable_object_stand_up));
+ enable.add("Object.EnableSit", boost::bind(&enable_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_inspect_object_gear.xml b/indra/newview/skins/default/xui/en/menu_inspect_object_gear.xml
index 22df02cd7e..b6f00ef6d1 100644
--- a/indra/newview/skins/default/xui/en/menu_inspect_object_gear.xml
+++ b/indra/newview/skins/default/xui/en/menu_inspect_object_gear.xml
@@ -22,7 +22,7 @@
<menu_item_call.on_click
function="InspectObject.Sit"/>
<menu_item_call.on_visible
- function="Object.EnableSit" />
+ function="Object.EnableGearSit" />
</menu_item_call>
<menu_item_call
label="Pay"
diff --git a/indra/newview/skins/default/xui/en/menu_object.xml b/indra/newview/skins/default/xui/en/menu_object.xml
index 397e61c97a..b6cc222e96 100644
--- a/indra/newview/skins/default/xui/en/menu_object.xml
+++ b/indra/newview/skins/default/xui/en/menu_object.xml
@@ -45,10 +45,7 @@
<menu_item_call.on_click
function="Object.SitOrStand" />
<menu_item_call.on_enable
- function="Object.SitVisible" />
- <menu_item_call.on_enable
- function="Object.EnableSitOrStand"
- name="EnableSitOrStand" />
+ function="Object.EnableSit" />
</menu_item_call>
<menu_item_call
enabled="false"
@@ -57,10 +54,7 @@
<menu_item_call.on_click
function="Object.SitOrStand" />
<menu_item_call.on_enable
- function="Object.StandUpVisible" />
- <menu_item_call.on_enable
- function="Object.EnableSitOrStand"
- name="EnableSitOrStand" />
+ function="Object.EnableStandUp" />
</menu_item_call>
<menu_item_call
label="Object Profile"