diff options
author | Loren Shih <seraph@lindenlab.com> | 2009-12-15 11:48:55 -0500 |
---|---|---|
committer | Loren Shih <seraph@lindenlab.com> | 2009-12-15 11:48:55 -0500 |
commit | 045e3e06579d533619208fb415399e68714244e3 (patch) | |
tree | 96c064a703b9f606151e699ae2f537cfeae14e48 /indra | |
parent | 88b73b1146e39cc9fe150fe82870c811545a507a (diff) |
EXT-3199 : Re-enable task inspection inventory sidepanel
Re-added the task sidepanel.
Fixed bottom button layout.
Edit mode now always returns true for inventory sidepanels.
--HG--
branch : avatar-pipeline
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llsidepanelinventorysubpanel.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llsidepaneliteminfo.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llsidepaneltaskinfo.cpp | 246 | ||||
-rw-r--r-- | indra/newview/llsidepaneltaskinfo.h | 36 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/sidepanel_task_info.xml | 20 |
5 files changed, 182 insertions, 138 deletions
diff --git a/indra/newview/llsidepanelinventorysubpanel.cpp b/indra/newview/llsidepanelinventorysubpanel.cpp index 793904faa8..56e342c3ce 100644 --- a/indra/newview/llsidepanelinventorysubpanel.cpp +++ b/indra/newview/llsidepanelinventorysubpanel.cpp @@ -95,7 +95,9 @@ void LLSidepanelInventorySubpanel::setIsEditing(BOOL edit) BOOL LLSidepanelInventorySubpanel::getIsEditing() const { - return mIsEditing; + + return TRUE; // Default everything to edit mode since we're not using an edit button anymore. + // return mIsEditing; } void LLSidepanelInventorySubpanel::reset() diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp index 25518d87d6..1965e634b6 100644 --- a/indra/newview/llsidepaneliteminfo.cpp +++ b/indra/newview/llsidepaneliteminfo.cpp @@ -172,7 +172,7 @@ void LLSidepanelItemInfo::refresh() } } - if (!getIsEditing()) + if (!getIsEditing() || !item) { const std::string no_item_names[]={ "LabelItemName", @@ -261,18 +261,6 @@ void LLSidepanelItemInfo::refreshFromItem(LLInventoryItem* item) GP_OBJECT_MANIPULATE) && is_obj_modify && is_complete; - const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - bool item_in_trash = item->getUUID() == trash_id || gInventory.isObjectDescendentOf(item->getUUID(), trash_id); - - if (is_modifiable && !item_in_trash) - { - setIsEditing(TRUE); - } - else - { - setIsEditing(FALSE); - } - childSetEnabled("LabelItemNameTitle",TRUE); childSetEnabled("LabelItemName",is_modifiable && !is_calling_card); // for now, don't allow rename of calling cards childSetText("LabelItemName",item->getName()); diff --git a/indra/newview/llsidepaneltaskinfo.cpp b/indra/newview/llsidepaneltaskinfo.cpp index 2c40e948de..50cec3184d 100644 --- a/indra/newview/llsidepaneltaskinfo.cpp +++ b/indra/newview/llsidepaneltaskinfo.cpp @@ -101,13 +101,25 @@ BOOL LLSidepanelTaskInfo::postBuild() mBuyBtn = getChild<LLButton>("buy_btn"); mBuyBtn->setClickedCallback(boost::bind(&LLSidepanelTaskInfo::onBuyButtonClicked, this)); - childSetPrevalidate("Object Name",LLLineEditor::prevalidateASCIIPrintableNoPipe); - childSetPrevalidate("Object Description",LLLineEditor::prevalidateASCIIPrintableNoPipe); - mLabelGroupName = getChild<LLNameBox>("Group Name Proxy"); - childSetCommitCallback("checkbox for sale",onClickForSale,this); - + childSetCommitCallback("Object Name", LLSidepanelTaskInfo::onCommitName,this); + childSetPrevalidate("Object Name", LLLineEditor::prevalidateASCIIPrintableNoPipe); + childSetCommitCallback("Object Description", LLSidepanelTaskInfo::onCommitDesc,this); + childSetPrevalidate("Object Description", LLLineEditor::prevalidateASCIIPrintableNoPipe); + getChild<LLUICtrl>("button set group")->setCommitCallback(boost::bind(&LLSidepanelTaskInfo::onClickGroup,this)); + childSetCommitCallback("checkbox share with group", &LLSidepanelTaskInfo::onCommitGroupShare,this); + childSetAction("button deed", &LLSidepanelTaskInfo::onClickDeedToGroup,this); + childSetCommitCallback("checkbox allow everyone move", &LLSidepanelTaskInfo::onCommitEveryoneMove,this); + childSetCommitCallback("checkbox allow everyone copy", &LLSidepanelTaskInfo::onCommitEveryoneCopy,this); + childSetCommitCallback("checkbox for sale", &LLSidepanelTaskInfo::onCommitSaleInfo,this); + childSetCommitCallback("sale type", &LLSidepanelTaskInfo::onCommitSaleType,this); + childSetCommitCallback("Edit Cost", &LLSidepanelTaskInfo::onCommitSaleInfo, this); + childSetCommitCallback("checkbox next owner can modify", &LLSidepanelTaskInfo::onCommitNextOwnerModify,this); + childSetCommitCallback("checkbox next owner can copy", &LLSidepanelTaskInfo::onCommitNextOwnerCopy,this); + childSetCommitCallback("checkbox next owner can transfer", &LLSidepanelTaskInfo::onCommitNextOwnerTransfer,this); + childSetCommitCallback("clickaction", &LLSidepanelTaskInfo::onCommitClickAction,this); + childSetCommitCallback("search_check", &LLSidepanelTaskInfo::onCommitIncludeInSearch,this); return TRUE; } @@ -860,7 +872,7 @@ static bool callback_deed_to_group(const LLSD& notification, const LLSD& respons return FALSE; } -void LLSidepanelTaskInfo::onClickDeedToGroup() +void LLSidepanelTaskInfo::onClickDeedToGroup(void *data) { LLNotificationsUtil::add("DeedObjectToGroup", LLSD(), LLSD(), callback_deed_to_group); } @@ -869,121 +881,149 @@ void LLSidepanelTaskInfo::onClickDeedToGroup() /// Permissions checkboxes ///---------------------------------------------------------------------------- -void LLSidepanelTaskInfo::onCommitPerm(LLCheckBoxCtrl *ctrl, U8 field, U32 perm) +// static +void LLSidepanelTaskInfo::onCommitPerm(LLUICtrl *ctrl, void *data, U8 field, U32 perm) { - const LLViewerObject* object = mObjectSelection->getFirstRootObject(); - if (!object) return; + LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(); + if(!object) return; - BOOL new_state = ctrl->get(); + // Checkbox will have toggled itself + // LLSidepanelTaskInfo* self = (LLSidepanelTaskInfo*)data; + LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl; + BOOL new_state = check->get(); + LLSelectMgr::getInstance()->selectionSetObjectPermissions(field, new_state, perm); } -void LLSidepanelTaskInfo::onCommitGroupShare() +// static +void LLSidepanelTaskInfo::onCommitGroupShare(LLUICtrl *ctrl, void *data) { - LLCheckBoxCtrl *ctrl = getChild<LLCheckBoxCtrl>("checkbox share with group"); - onCommitPerm(ctrl, PERM_GROUP, PERM_MODIFY | PERM_MOVE | PERM_COPY); + onCommitPerm(ctrl, data, PERM_GROUP, PERM_MODIFY | PERM_MOVE | PERM_COPY); } -void LLSidepanelTaskInfo::onCommitEveryoneMove() +// static +void LLSidepanelTaskInfo::onCommitEveryoneMove(LLUICtrl *ctrl, void *data) { - LLCheckBoxCtrl *ctrl = getChild<LLCheckBoxCtrl>("checkbox allow everyone move"); - onCommitPerm(ctrl, PERM_EVERYONE, PERM_MOVE); + onCommitPerm(ctrl, data, PERM_EVERYONE, PERM_MOVE); } -void LLSidepanelTaskInfo::onCommitEveryoneCopy() +// static +void LLSidepanelTaskInfo::onCommitEveryoneCopy(LLUICtrl *ctrl, void *data) { - LLCheckBoxCtrl *ctrl = getChild<LLCheckBoxCtrl>("checkbox allow everyone copy"); - onCommitPerm(ctrl, PERM_EVERYONE, PERM_COPY); + onCommitPerm(ctrl, data, PERM_EVERYONE, PERM_COPY); } -void LLSidepanelTaskInfo::onCommitNextOwnerModify() +// static +void LLSidepanelTaskInfo::onCommitNextOwnerModify(LLUICtrl* ctrl, void* data) { - LLCheckBoxCtrl *ctrl = getChild<LLCheckBoxCtrl>("checkbox next owner can modify"); - onCommitPerm(ctrl, PERM_NEXT_OWNER, PERM_MODIFY); + //llinfos << "LLSidepanelTaskInfo::onCommitNextOwnerModify" << llendl; + onCommitPerm(ctrl, data, PERM_NEXT_OWNER, PERM_MODIFY); } -void LLSidepanelTaskInfo::onCommitNextOwnerCopy() +// static +void LLSidepanelTaskInfo::onCommitNextOwnerCopy(LLUICtrl* ctrl, void* data) { - LLCheckBoxCtrl *ctrl = getChild<LLCheckBoxCtrl>("checkbox next owner can copy"); - onCommitPerm(ctrl, PERM_NEXT_OWNER, PERM_COPY); + //llinfos << "LLSidepanelTaskInfo::onCommitNextOwnerCopy" << llendl; + onCommitPerm(ctrl, data, PERM_NEXT_OWNER, PERM_COPY); } -void LLSidepanelTaskInfo::onCommitNextOwnerTransfer() +// static +void LLSidepanelTaskInfo::onCommitNextOwnerTransfer(LLUICtrl* ctrl, void* data) { - LLCheckBoxCtrl *ctrl = getChild<LLCheckBoxCtrl>("checkbox next owner can transfer"); - onCommitPerm(ctrl, PERM_NEXT_OWNER, PERM_TRANSFER); + //llinfos << "LLSidepanelTaskInfo::onCommitNextOwnerTransfer" << llendl; + onCommitPerm(ctrl, data, PERM_NEXT_OWNER, PERM_TRANSFER); } -void LLSidepanelTaskInfo::onCommitName() +// static +void LLSidepanelTaskInfo::onCommitName(LLUICtrl*, void* data) { - LLLineEditor* tb = getChild<LLLineEditor>("Object Name"); - LLSelectMgr::getInstance()->selectionSetObjectName(tb->getText()); + //llinfos << "LLSidepanelTaskInfo::onCommitName()" << llendl; + LLSidepanelTaskInfo* self = (LLSidepanelTaskInfo*)data; + LLLineEditor* tb = self->getChild<LLLineEditor>("Object Name"); + if(tb) + { + LLSelectMgr::getInstance()->selectionSetObjectName(tb->getText()); +// LLSelectMgr::getInstance()->selectionSetObjectName(self->mLabelObjectName->getText()); + } } -void LLSidepanelTaskInfo::onCommitDesc() + +// static +void LLSidepanelTaskInfo::onCommitDesc(LLUICtrl*, void* data) { - LLLineEditor* le = getChild<LLLineEditor>("Object Description"); - LLSelectMgr::getInstance()->selectionSetObjectDescription(le->getText()); + //llinfos << "LLSidepanelTaskInfo::onCommitDesc()" << llendl; + LLSidepanelTaskInfo* self = (LLSidepanelTaskInfo*)data; + LLLineEditor* le = self->getChild<LLLineEditor>("Object Description"); + if(le) + { + LLSelectMgr::getInstance()->selectionSetObjectDescription(le->getText()); + } } -void LLSidepanelTaskInfo::onCommitSaleInfo() +// static +void LLSidepanelTaskInfo::onCommitSaleInfo(LLUICtrl*, void* data) { - setAllSaleInfo(); + LLSidepanelTaskInfo* self = (LLSidepanelTaskInfo*)data; + self->setAllSaleInfo(); } -void LLSidepanelTaskInfo::onCommitSaleType() +// static +void LLSidepanelTaskInfo::onCommitSaleType(LLUICtrl*, void* data) { - setAllSaleInfo(); + LLSidepanelTaskInfo* self = (LLSidepanelTaskInfo*)data; + self->setAllSaleInfo(); } + void LLSidepanelTaskInfo::setAllSaleInfo() { - llinfos << "LLSidepanelTaskInfo::setAllSaleInfo()" << llendl; - LLSaleInfo::EForSale sale_type = LLSaleInfo::FS_NOT; + LLCheckBoxCtrl *checkPurchase = getChild<LLCheckBoxCtrl>("checkbox for sale"); + // Set the sale type if the object(s) are for sale. - if (checkPurchase && checkPurchase->get()) + if(checkPurchase && checkPurchase->get()) { sale_type = static_cast<LLSaleInfo::EForSale>(getChild<LLComboBox>("sale type")->getValue().asInteger()); } S32 price = -1; - const LLSpinCtrl *edit_price = getChild<LLSpinCtrl>("Edit Cost"); + + LLSpinCtrl *edit_price = getChild<LLSpinCtrl>("Edit Cost"); price = (edit_price->getTentative()) ? DEFAULT_PRICE : edit_price->getValue().asInteger(); + // If somehow an invalid price, turn the sale off. if (price < 0) sale_type = LLSaleInfo::FS_NOT; - LLSaleInfo sale_info(sale_type, price); - LLSelectMgr::getInstance()->selectionSetObjectSaleInfo(sale_info); - // If turned off for-sale, make sure click-action buy is turned - // off as well - if (sale_type == LLSaleInfo::FS_NOT) - { - U8 click_action = 0; - LLSelectMgr::getInstance()->selectionGetClickAction(&click_action); - if (click_action == CLICK_ACTION_BUY) - { - LLSelectMgr::getInstance()->selectionSetClickAction(CLICK_ACTION_TOUCH); - } - } -} + LLSaleInfo old_sale_info; + LLSelectMgr::getInstance()->selectGetSaleInfo(old_sale_info); -// static -void LLSidepanelTaskInfo::onClickForSale(LLUICtrl* ctrl, void* data) -{ - LLSidepanelTaskInfo* self = (LLSidepanelTaskInfo*)data; - self->updateUIFromSaleInfo(); -} + LLSaleInfo new_sale_info(sale_type, price); + LLSelectMgr::getInstance()->selectionSetObjectSaleInfo(new_sale_info); + + U8 old_click_action = 0; + LLSelectMgr::getInstance()->selectionGetClickAction(&old_click_action); -void LLSidepanelTaskInfo::updateUIFromSaleInfo() -{ - /* - TODO: Update sale button enable/disable state and default - sale button settings when this sale button is enabled/disabled. - */ + if (old_sale_info.isForSale() + && !new_sale_info.isForSale() + && old_click_action == CLICK_ACTION_BUY) + { + // If turned off for-sale, make sure click-action buy is turned + // off as well + LLSelectMgr::getInstance()-> + selectionSetClickAction(CLICK_ACTION_TOUCH); + } + else if (new_sale_info.isForSale() + && !old_sale_info.isForSale() + && old_click_action == CLICK_ACTION_TOUCH) + { + // If just turning on for-sale, preemptively turn on one-click buy + // unless user have a different click action set + LLSelectMgr::getInstance()-> + selectionSetClickAction(CLICK_ACTION_BUY); + } } struct LLSelectionPayable : public LLSelectedObjectFunctor @@ -997,8 +1037,35 @@ struct LLSelectionPayable : public LLSelectedObjectFunctor } }; +static 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; +} + +// static +void LLSidepanelTaskInfo::onCommitClickAction(LLUICtrl* ctrl, void*) +{ + LLComboBox* box = (LLComboBox*)ctrl; + if (!box) return; + std::string value = box->getValue().asString(); + U8 click_action = string_value_to_click_action(value); + doClickAction(click_action); +} + // static -void LLSidepanelTaskInfo::onCommitClickAction(U8 click_action) +void LLSidepanelTaskInfo::doClickAction(U8 click_action) { if (click_action == CLICK_ACTION_BUY) { @@ -1020,7 +1087,7 @@ void LLSidepanelTaskInfo::onCommitClickAction(U8 click_action) { // Verify object has script with money() handler LLSelectionPayable payable; - const BOOL can_pay = mObjectSelection->applyToObjects(&payable); + bool can_pay = LLSelectMgr::getInstance()->getSelection()->applyToObjects(&payable); if (!can_pay) { // Warn, but do it anyway. @@ -1031,10 +1098,11 @@ void LLSidepanelTaskInfo::onCommitClickAction(U8 click_action) } // static -void LLSidepanelTaskInfo::onCommitIncludeInSearch() +void LLSidepanelTaskInfo::onCommitIncludeInSearch(LLUICtrl* ctrl, void* data) { - LLCheckBoxCtrl *ctrl = getChild<LLCheckBoxCtrl>("search_check"); - LLSelectMgr::getInstance()->selectionSetIncludeInSearch(ctrl->get()); + LLCheckBoxCtrl* box = (LLCheckBoxCtrl*)ctrl; + llassert(box); + LLSelectMgr::getInstance()->selectionSetIncludeInSearch(box->get()); } // virtual @@ -1042,13 +1110,15 @@ void LLSidepanelTaskInfo::updateVerbs() { LLSidepanelInventorySubpanel::updateVerbs(); + /* mOpenBtn->setVisible(!getIsEditing()); mPayBtn->setVisible(!getIsEditing()); mBuyBtn->setVisible(!getIsEditing()); - - mOpenBtn->setEnabled(enable_object_open()); //const LLViewerObject *obj = getFirstSelectedObject(); //mEditBtn->setEnabled(obj && obj->permModify()); + */ + + mOpenBtn->setEnabled(enable_object_open()); } void LLSidepanelTaskInfo::onOpenButtonClicked() @@ -1061,28 +1131,28 @@ void LLSidepanelTaskInfo::onOpenButtonClicked() void LLSidepanelTaskInfo::onPayButtonClicked() { - onCommitClickAction(CLICK_ACTION_PAY); + doClickAction(CLICK_ACTION_PAY); } void LLSidepanelTaskInfo::onBuyButtonClicked() { - onCommitClickAction(CLICK_ACTION_BUY); + doClickAction(CLICK_ACTION_BUY); } // virtual void LLSidepanelTaskInfo::save() { - onCommitGroupShare(); - onCommitEveryoneMove(); - onCommitEveryoneCopy(); - onCommitNextOwnerModify(); - onCommitNextOwnerCopy(); - onCommitNextOwnerTransfer(); - onCommitName(); - onCommitDesc(); - onCommitSaleInfo(); - onCommitSaleType(); - onCommitIncludeInSearch(); + onCommitGroupShare(getChild<LLCheckBoxCtrl>("checkbox share with group"), this); + onCommitEveryoneMove(getChild<LLCheckBoxCtrl>("checkbox allow everyone move"), this); + onCommitEveryoneCopy(getChild<LLCheckBoxCtrl>("checkbox allow everyone copy"), this); + onCommitNextOwnerModify(getChild<LLCheckBoxCtrl>("checkbox next owner can modify"), this); + onCommitNextOwnerCopy(getChild<LLCheckBoxCtrl>("checkbox next owner can copy"), this); + onCommitNextOwnerTransfer(getChild<LLCheckBoxCtrl>("checkbox next owner can transfer"), this); + onCommitName(getChild<LLLineEditor>("Object Name"), this); + onCommitDesc(getChild<LLLineEditor>("Object Description"), this); + onCommitSaleInfo(NULL, this); + onCommitSaleType(NULL, this); + onCommitIncludeInSearch(getChild<LLCheckBoxCtrl>("search_check"), this); } void LLSidepanelTaskInfo::setObjectSelection(LLObjectSelectionHandle selection) diff --git a/indra/newview/llsidepaneltaskinfo.h b/indra/newview/llsidepaneltaskinfo.h index 7c6d9983ae..cf36c20767 100644 --- a/indra/newview/llsidepaneltaskinfo.h +++ b/indra/newview/llsidepaneltaskinfo.h @@ -72,28 +72,30 @@ protected: static void onClickRelease(void*); void onClickGroup(); void cbGroupID(LLUUID group_id); + static void onClickDeedToGroup(void*); - void onClickDeedToGroup(); - void onCommitPerm(LLCheckBoxCtrl* ctrl, U8 field, U32 perm); - void onCommitGroupShare(); - void onCommitEveryoneMove(); - void onCommitEveryoneCopy(); - void onCommitNextOwnerModify(); - void onCommitNextOwnerCopy(); - void onCommitNextOwnerTransfer(); - void onCommitName(); - void onCommitDesc(); - void onCommitSaleInfo(); - void onCommitSaleType(); - - void onCommitClickAction(U8 click_action); - void onCommitIncludeInSearch(); + static void onCommitPerm(LLUICtrl *ctrl, void *data, U8 field, U32 perm); + static void onCommitGroupShare(LLUICtrl *ctrl, void *data); + + static void onCommitEveryoneMove(LLUICtrl *ctrl, void *data); + static void onCommitEveryoneCopy(LLUICtrl *ctrl, void *data); + + static void onCommitNextOwnerModify(LLUICtrl* ctrl, void* data); + static void onCommitNextOwnerCopy(LLUICtrl* ctrl, void* data); + static void onCommitNextOwnerTransfer(LLUICtrl* ctrl, void* data); + + static void onCommitName(LLUICtrl* ctrl, void* data); + static void onCommitDesc(LLUICtrl* ctrl, void* data); + + static void onCommitSaleInfo(LLUICtrl* ctrl, void* data); + static void onCommitSaleType(LLUICtrl* ctrl, void* data); void setAllSaleInfo(); - static void onClickForSale(LLUICtrl* ctrl, void *data); - void updateUIFromSaleInfo(); + static void onCommitClickAction(LLUICtrl* ctrl, void* data); + static void onCommitIncludeInSearch(LLUICtrl* ctrl, void*); + static void doClickAction(U8 click_action); void disableAll(); private: diff --git a/indra/newview/skins/default/xui/en/sidepanel_task_info.xml b/indra/newview/skins/default/xui/en/sidepanel_task_info.xml index eff2ca1fcd..5b379b54e3 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_task_info.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_task_info.xml @@ -487,7 +487,7 @@ height="25" label="Open" layout="topleft" - left_pad="5" + left="5" name="open_btn" top="0" width="60" /> @@ -509,23 +509,5 @@ name="buy_btn" top="0" width="60" /> - <button - follows="bottom|right" - height="25" - label="Cancel" - layout="topleft" - name="cancel_btn" - right="-1" - top="0" - width="70" /> - <button - follows="bottom|right" - height="25" - label="Save" - layout="topleft" - name="save_btn" - left_pad="-135" - top="0" - width="60" /> </panel> </panel>
\ No newline at end of file |