aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra
diff options
context:
space:
mode:
authorunknown2008-12-22 10:34:37 -0700
committerunknown2008-12-22 10:34:37 -0700
commitba793d2be3a63d89dd8a5842322b754da803ac18 (patch)
tree4aee07f8a86912fb321500289a475c62fea757f6 /linden/indra
parentresolved merge conflicts (diff)
downloadmeta-impy-ba793d2be3a63d89dd8a5842322b754da803ac18.zip
meta-impy-ba793d2be3a63d89dd8a5842322b754da803ac18.tar.gz
meta-impy-ba793d2be3a63d89dd8a5842322b754da803ac18.tar.bz2
meta-impy-ba793d2be3a63d89dd8a5842322b754da803ac18.tar.xz
Buy and Take now separated in the pie menu.
Diffstat (limited to 'linden/indra')
-rw-r--r--linden/indra/newview/llviewermenu.cpp105
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/menu_pie_object.xml16
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml6
3 files changed, 17 insertions, 110 deletions
diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp
index 3bf390e..97f3761 100644
--- a/linden/indra/newview/llviewermenu.cpp
+++ b/linden/indra/newview/llviewermenu.cpp
@@ -303,8 +303,6 @@ void near_sit_object();
303void label_sit_or_stand(std::string& label, void*); 303void label_sit_or_stand(std::string& label, void*);
304// buy and take alias into the same UI positions, so these 304// buy and take alias into the same UI positions, so these
305// declarations handle this mess. 305// declarations handle this mess.
306BOOL is_selection_buy_not_take();
307S32 selection_price();
308BOOL enable_take(); 306BOOL enable_take();
309void handle_take(); 307void handle_take();
310void confirm_take(S32 option, void* data); 308void confirm_take(S32 option, void* data);
@@ -3928,7 +3926,7 @@ BOOL enable_take()
3928 return FALSE; 3926 return FALSE;
3929} 3927}
3930 3928
3931class LLToolsBuyOrTake : public view_listener_t 3929class LLToolsTake : public view_listener_t
3932{ 3930{
3933 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 3931 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
3934 { 3932 {
@@ -3936,115 +3934,24 @@ class LLToolsBuyOrTake : public view_listener_t
3936 { 3934 {
3937 return true; 3935 return true;
3938 } 3936 }
3939
3940 if (is_selection_buy_not_take())
3941 {
3942 S32 total_price = selection_price();
3943
3944 if (total_price <= gStatusBar->getBalance() || total_price == 0)
3945 {
3946 handle_buy(NULL);
3947 }
3948 else
3949 {
3950 LLFloaterBuyCurrency::buyCurrency(
3951 "Buying this costs", total_price);
3952 }
3953 }
3954 else 3937 else
3955 { 3938 {
3956 handle_take(); 3939 handle_take();
3940 return true;
3957 } 3941 }
3958 return true;
3959 } 3942 }
3960}; 3943};
3961 3944
3962class LLToolsEnableBuyOrTake : public view_listener_t 3945class LLToolsEnableTake : public view_listener_t
3963{ 3946{
3964 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 3947 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
3965 { 3948 {
3966 bool is_buy = is_selection_buy_not_take(); 3949 bool new_value = enable_take();
3967 bool new_value = is_buy ? enable_buy(NULL) : enable_take();
3968 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); 3950 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
3969
3970 // Update label
3971 std::string label;
3972 std::string buy_text;
3973 std::string take_text;
3974 std::string param = userdata["data"].asString();
3975 std::string::size_type offset = param.find(",");
3976 if (offset != param.npos)
3977 {
3978 buy_text = param.substr(0, offset);
3979 take_text = param.substr(offset+1);
3980 }
3981 if (is_buy)
3982 {
3983 label = buy_text;
3984 }
3985 else
3986 {
3987 label = take_text;
3988 }
3989 gMenuHolder->childSetText("Pie Object Take", label);
3990 gMenuHolder->childSetText("Menu Object Take", label);
3991
3992 return true; 3951 return true;
3993 } 3952 }
3994}; 3953};
3995 3954
3996// This is a small helper function to determine if we have a buy or a
3997// take in the selection. This method is to help with the aliasing
3998// problems of putting buy and take in the same pie menu space. After
3999// a fair amont of discussion, it was determined to prefer buy over
4000// take. The reasoning follows from the fact that when users walk up
4001// to buy something, they will click on one or more items. Thus, if
4002// anything is for sale, it becomes a buy operation, and the server
4003// will group all of the buy items, and copyable/modifiable items into
4004// one package and give the end user as much as the permissions will
4005// allow. If the user wanted to take something, they will select fewer
4006// and fewer items until only 'takeable' items are left. The one
4007// exception is if you own everything in the selection that is for
4008// sale, in this case, you can't buy stuff from yourself, so you can
4009// take it.
4010// return value = TRUE if selection is a 'buy'.
4011// FALSE if selection is a 'take'
4012BOOL is_selection_buy_not_take()
4013{
4014 for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin();
4015 iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++)
4016 {
4017 LLSelectNode* node = *iter;
4018 LLViewerObject* obj = node->getObject();
4019 if(obj && !(obj->permYouOwner()) && (node->mSaleInfo.isForSale()))
4020 {
4021 // you do not own the object and it is for sale, thus,
4022 // it's a buy
4023 return TRUE;
4024 }
4025 }
4026 return FALSE;
4027}
4028
4029S32 selection_price()
4030{
4031 S32 total_price = 0;
4032 for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin();
4033 iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++)
4034 {
4035 LLSelectNode* node = *iter;
4036 LLViewerObject* obj = node->getObject();
4037 if(obj && !(obj->permYouOwner()) && (node->mSaleInfo.isForSale()))
4038 {
4039 // you do not own the object and it is for sale.
4040 // Add its price.
4041 total_price += node->mSaleInfo.getSalePrice();
4042 }
4043 }
4044
4045 return total_price;
4046}
4047
4048void callback_show_buy_currency(S32 option, void*) 3955void callback_show_buy_currency(S32 option, void*)
4049{ 3956{
4050 if (0 == option) 3957 if (0 == option)
@@ -9858,7 +9765,7 @@ void initialize_menus()
9858 addMenu(new LLToolsReleaseKeys(), "Tools.ReleaseKeys"); 9765 addMenu(new LLToolsReleaseKeys(), "Tools.ReleaseKeys");
9859 addMenu(new LLToolsEnableReleaseKeys(), "Tools.EnableReleaseKeys"); 9766 addMenu(new LLToolsEnableReleaseKeys(), "Tools.EnableReleaseKeys");
9860 addMenu(new LLToolsLookAtSelection(), "Tools.LookAtSelection"); 9767 addMenu(new LLToolsLookAtSelection(), "Tools.LookAtSelection");
9861 addMenu(new LLToolsBuyOrTake(), "Tools.BuyOrTake"); 9768 addMenu(new LLToolsTake(), "Tools.Take");
9862 addMenu(new LLToolsTakeCopy(), "Tools.TakeCopy"); 9769 addMenu(new LLToolsTakeCopy(), "Tools.TakeCopy");
9863 addMenu(new LLToolsSaveToInventory(), "Tools.SaveToInventory"); 9770 addMenu(new LLToolsSaveToInventory(), "Tools.SaveToInventory");
9864 addMenu(new LLToolsSaveToObjectInventory(), "Tools.SaveToObjectInventory"); 9771 addMenu(new LLToolsSaveToObjectInventory(), "Tools.SaveToObjectInventory");
@@ -9868,7 +9775,7 @@ void initialize_menus()
9868 addMenu(new LLToolsEnableToolNotPie(), "Tools.EnableToolNotPie"); 9775 addMenu(new LLToolsEnableToolNotPie(), "Tools.EnableToolNotPie");
9869 addMenu(new LLToolsEnableLink(), "Tools.EnableLink"); 9776 addMenu(new LLToolsEnableLink(), "Tools.EnableLink");
9870 addMenu(new LLToolsEnableUnlink(), "Tools.EnableUnlink"); 9777 addMenu(new LLToolsEnableUnlink(), "Tools.EnableUnlink");
9871 addMenu(new LLToolsEnableBuyOrTake(), "Tools.EnableBuyOrTake"); 9778 addMenu(new LLToolsEnableTake(), "Tools.EnableTake");
9872 addMenu(new LLToolsEnableTakeCopy(), "Tools.EnableTakeCopy"); 9779 addMenu(new LLToolsEnableTakeCopy(), "Tools.EnableTakeCopy");
9873 addMenu(new LLToolsEnableSaveToInventory(), "Tools.SaveToInventory"); 9780 addMenu(new LLToolsEnableSaveToInventory(), "Tools.SaveToInventory");
9874 addMenu(new LLToolsEnableSaveToObjectInventory(), "Tools.SaveToObjectInventory"); 9781 addMenu(new LLToolsEnableSaveToObjectInventory(), "Tools.SaveToObjectInventory");
diff --git a/linden/indra/newview/skins/default/xui/en-us/menu_pie_object.xml b/linden/indra/newview/skins/default/xui/en-us/menu_pie_object.xml
index df9b2a0..e471115 100644
--- a/linden/indra/newview/skins/default/xui/en-us/menu_pie_object.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/menu_pie_object.xml
@@ -4,9 +4,9 @@
4 <on_click function="Object.Open" /> 4 <on_click function="Object.Open" />
5 <on_enable function="Object.EnableOpen" /> 5 <on_enable function="Object.EnableOpen" />
6 </menu_item_call> 6 </menu_item_call>
7 <menu_item_call enabled="false" label="Create" mouse_opaque="true" name="Create"> 7 <menu_item_call enabled="false" label="Buy..." mouse_opaque="true" name="Buy...">
8 <on_click function="Object.Build" /> 8 <on_click function="Object.Buy" />
9 <on_enable function="EnableEdit" /> 9 <on_enable function="Object.EnableBuy" />
10 </menu_item_call> 10 </menu_item_call>
11 <menu_item_call enabled="false" label="Touch" mouse_opaque="true" name="Object Touch"> 11 <menu_item_call enabled="false" label="Touch" mouse_opaque="true" name="Object Touch">
12 <on_click function="Object.Touch" /> 12 <on_click function="Object.Touch" />
@@ -17,8 +17,8 @@
17 <on_enable function="Object.EnableSitOrStand" userdata="Sit Here,Stand Up" /> 17 <on_enable function="Object.EnableSitOrStand" userdata="Sit Here,Stand Up" />
18 </menu_item_call> 18 </menu_item_call>
19 <menu_item_call enabled="false" label="Take" mouse_opaque="true" name="Pie Object Take"> 19 <menu_item_call enabled="false" label="Take" mouse_opaque="true" name="Pie Object Take">
20 <on_click function="Tools.BuyOrTake" /> 20 <on_click function="Tools.Take" />
21 <on_enable function="Tools.EnableBuyOrTake" userdata="Buy,Take" /> 21 <on_enable function="Tools.EnableTake" />
22 </menu_item_call> 22 </menu_item_call>
23 <menu_item_call enabled="false" label="Pay..." mouse_opaque="true" name="Pay..."> 23 <menu_item_call enabled="false" label="Pay..." mouse_opaque="true" name="Pay...">
24 <on_click function="PayObject" /> 24 <on_click function="PayObject" />
@@ -63,9 +63,9 @@
63 <on_enable function="Object.EnableInspect" /> 63 <on_enable function="Object.EnableInspect" />
64 </menu_item_call> 64 </menu_item_call>
65 </pie_menu> 65 </pie_menu>
66 <menu_item_call enabled="false" label="Buy..." mouse_opaque="true" name="Buy..."> 66 <menu_item_call enabled="false" label="Create" mouse_opaque="true" name="Create">
67 <on_click function="Object.Buy" /> 67 <on_click function="Object.Build" />
68 <on_enable function="Object.EnableBuy" /> 68 <on_enable function="EnableEdit" />
69 </menu_item_call> 69 </menu_item_call>
70 </pie_menu> 70 </pie_menu>
71 <menu_item_call enabled="false" label="Edit..." mouse_opaque="true" name="Edit..."> 71 <menu_item_call enabled="false" label="Edit..." mouse_opaque="true" name="Edit...">
diff --git a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml
index 682acb9..48f59de 100644
--- a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml
@@ -696,9 +696,9 @@
696 <on_enable function="Tools.SomethingSelectedNoHUD" /> 696 <on_enable function="Tools.SomethingSelectedNoHUD" />
697 </menu_item_call> 697 </menu_item_call>
698 <menu_item_call name="Menu Object Take" enabled="false" 698 <menu_item_call name="Menu Object Take" enabled="false"
699 label="Buy Object" visible="false"> 699 label="Take" visible="false">
700 <on_click function="Tools.BuyOrTake" userdata="" /> 700 <on_click function="Tools.Take" userdata="" />
701 <on_enable function="Tools.EnableBuyOrTake" userdata="Buy,Take" /> 701 <on_enable function="Tools.EnableTake" />
702 </menu_item_call> 702 </menu_item_call>
703 <menu_item_call name="Take Copy" enabled="false" 703 <menu_item_call name="Take Copy" enabled="false"
704 label="Take Copy"> 704 label="Take Copy">