diff options
author | Loren Shih <seraph@lindenlab.com> | 2009-11-24 12:10:10 -0500 |
---|---|---|
committer | Loren Shih <seraph@lindenlab.com> | 2009-11-24 12:10:10 -0500 |
commit | a22bb00530bb779d8e5bb40b68e55767604d88dc (patch) | |
tree | 520019b0c1e8c9cf475d19a60a0322a3c1caea6e /indra/newview/llpanelpermissions.cpp | |
parent | 0904cbe4846192c9897267c9a60175f84881f9ed (diff) | |
parent | 76be5ddc7022508e7d3fcb04165b4a6f64f1d58d (diff) |
merge
--HG--
branch : avatar-pipeline
Diffstat (limited to 'indra/newview/llpanelpermissions.cpp')
-rw-r--r-- | indra/newview/llpanelpermissions.cpp | 71 |
1 files changed, 66 insertions, 5 deletions
diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 0dc010e2e7..d8e0d91d88 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -66,6 +66,65 @@ #include "roles_constants.h" #include "llgroupactions.h" + +U8 string_value_to_click_action(std::string p_value); +std::string click_action_to_string_value( U8 action); + +U8 string_value_to_click_action(std::string p_value) +{ + if(p_value == "Touch") + { + return CLICK_ACTION_TOUCH; + } + if(p_value == "Sit") + { + return CLICK_ACTION_SIT; + } + if(p_value == "Buy") + { + return CLICK_ACTION_BUY; + } + if(p_value == "Pay") + { + return CLICK_ACTION_PAY; + } + if(p_value == "Open") + { + return CLICK_ACTION_OPEN; + } + if(p_value == "Zoom") + { + return CLICK_ACTION_ZOOM; + } + return CLICK_ACTION_TOUCH; +} + +std::string click_action_to_string_value( U8 action) +{ + switch (action) + { + case CLICK_ACTION_TOUCH: + default: + return "Touch"; + break; + case CLICK_ACTION_SIT: + return "Sit"; + break; + case CLICK_ACTION_BUY: + return "Buy"; + break; + case CLICK_ACTION_PAY: + return "Pay"; + break; + case CLICK_ACTION_OPEN: + return "Open"; + break; + case CLICK_ACTION_ZOOM: + return "Zoom"; + break; + } +} + ///---------------------------------------------------------------------------- /// Class llpanelpermissions ///---------------------------------------------------------------------------- @@ -774,7 +833,8 @@ void LLPanelPermissions::refresh() LLComboBox* ComboClickAction = getChild<LLComboBox>("clickaction"); if(ComboClickAction) { - ComboClickAction->setCurrentByIndex((S32)click_action); + std::string combo_value = click_action_to_string_value(click_action); + ComboClickAction->setValue(LLSD(combo_value)); } } childSetEnabled("label click action",is_perm_modify && all_volume); @@ -1015,8 +1075,9 @@ void LLPanelPermissions::onCommitClickAction(LLUICtrl* ctrl, void*) { LLComboBox* box = (LLComboBox*)ctrl; if (!box) return; - - U8 click_action = (U8)box->getCurrentIndex(); + std::string value = box->getValue().asString(); + U8 click_action = string_value_to_click_action(value); + if (click_action == CLICK_ACTION_BUY) { LLSaleInfo sale_info; @@ -1028,8 +1089,8 @@ void LLPanelPermissions::onCommitClickAction(LLUICtrl* ctrl, void*) // Set click action back to its old value U8 click_action = 0; LLSelectMgr::getInstance()->selectionGetClickAction(&click_action); - box->setCurrentByIndex((S32)click_action); - + std::string item_value = click_action_to_string_value(click_action); + box->setValue(LLSD(item_value)); return; } } |