From 2ab9fbf019b579e0130b75769bd3c862040480a8 Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Thu, 13 May 2010 13:25:02 +0300 Subject: EXT-7218 FIXED added a delete button for attachment items (panel outfit edit) added a deletable wearable item, predecessor of a clothing item, which is used for attachment items Reviewed by Neal Orman and Mike Antipov at https://codereview.productengine.com/secondlife/r/377 --HG-- branch : product-engine --- indra/newview/llcofwearables.cpp | 17 ++++- indra/newview/llcofwearables.h | 1 + indra/newview/llwearableitemslist.cpp | 49 ++++++++++++--- indra/newview/llwearableitemslist.h | 48 +++++++------- .../xui/en/panel_deletable_wearable_list_item.xml | 73 ++++++++++++++++++++++ 5 files changed, 156 insertions(+), 32 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/panel_deletable_wearable_list_item.xml diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp index c73aa5f415..498aeec682 100644 --- a/indra/newview/llcofwearables.cpp +++ b/indra/newview/llcofwearables.cpp @@ -150,7 +150,7 @@ void LLCOFWearables::populateAttachmentsAndBodypartsLists(const LLInventoryModel LLPanelInventoryListItemBase* item_panel = NULL; if (item_type == LLAssetType::AT_OBJECT) { - item_panel = LLPanelInventoryListItemBase::create(item); + item_panel = buildAttachemntListItem(item); mAttachments->addItem(item_panel, item->getUUID(), ADD_BOTTOM, false); } else if (item_type == LLAssetType::AT_BODYPART) @@ -232,6 +232,21 @@ LLPanelBodyPartsListItem* LLCOFWearables::buildBodypartListItem(LLViewerInventor return item_panel; } +LLPanelDeletableWearableListItem* LLCOFWearables::buildAttachemntListItem(LLViewerInventoryItem* item) +{ + llassert(item); + if (!item) return NULL; + + LLPanelDeletableWearableListItem* item_panel = LLPanelDeletableWearableListItem::create(item); + if (!item_panel) return NULL; + + //setting callbacks + //*TODO move that item panel's inner structure disclosing stuff into the panels + item_panel->childSetAction("btn_delete", mCOFCallbacks.mDeleteWearable); + + return item_panel; +} + void LLCOFWearables::populateClothingList(LLAppearanceMgr::wearables_by_type_t& clothing_by_type) { llassert(clothing_by_type.size() == LLWearableType::WT_COUNT); diff --git a/indra/newview/llcofwearables.h b/indra/newview/llcofwearables.h index 2d26bf781f..32acba5a3e 100644 --- a/indra/newview/llcofwearables.h +++ b/indra/newview/llcofwearables.h @@ -132,6 +132,7 @@ protected: LLPanelClothingListItem* buildClothingListItem(LLViewerInventoryItem* item, bool first, bool last); LLPanelBodyPartsListItem* buildBodypartListItem(LLViewerInventoryItem* item); + LLPanelDeletableWearableListItem* buildAttachemntListItem(LLViewerInventoryItem* item); LLFlatListView* mAttachments; LLFlatListView* mClothing; diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index 26f6bc47cd..bac66d966a 100644 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -103,7 +103,7 @@ LLPanelClothingListItem* LLPanelClothingListItem::create(LLViewerInventoryItem* } LLPanelClothingListItem::LLPanelClothingListItem(LLViewerInventoryItem* item) - : LLPanelWearableListItem(item) + : LLPanelDeletableWearableListItem(item) { } @@ -118,18 +118,13 @@ void LLPanelClothingListItem::init() BOOL LLPanelClothingListItem::postBuild() { - LLPanelInventoryListItemBase::postBuild(); + LLPanelDeletableWearableListItem::postBuild(); - addWidgetToLeftSide("btn_delete"); addWidgetToRightSide("btn_move_up"); addWidgetToRightSide("btn_move_down"); addWidgetToRightSide("btn_lock"); addWidgetToRightSide("btn_edit"); - LLButton* delete_btn = getChild("btn_delete"); - // Reserve space for 'delete' button event if it is invisible. - setLeftWidgetsWidth(delete_btn->getRect().mRight); - setWidgetsVisible(false); reshapeWidgets(); @@ -176,6 +171,46 @@ BOOL LLPanelBodyPartsListItem::postBuild() return TRUE; } + +// static +LLPanelDeletableWearableListItem* LLPanelDeletableWearableListItem::create(LLViewerInventoryItem* item) +{ + LLPanelDeletableWearableListItem* list_item = NULL; + if(item) + { + list_item = new LLPanelDeletableWearableListItem(item); + list_item->init(); + } + return list_item; +} + +LLPanelDeletableWearableListItem::LLPanelDeletableWearableListItem(LLViewerInventoryItem* item) +: LLPanelWearableListItem(item) +{ +} + +void LLPanelDeletableWearableListItem::init() +{ + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_deletable_wearable_list_item.xml"); +} + +BOOL LLPanelDeletableWearableListItem::postBuild() +{ + LLPanelWearableListItem::postBuild(); + + addWidgetToLeftSide("btn_delete"); + + LLButton* delete_btn = getChild("btn_delete"); + // Reserve space for 'delete' button event if it is invisible. + setLeftWidgetsWidth(delete_btn->getRect().mRight); + + setWidgetsVisible(false); + reshapeWidgets(); + + return TRUE; +} + + ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h index b7f3fd0dff..5e3202c687 100644 --- a/indra/newview/llwearableitemslist.h +++ b/indra/newview/llwearableitemslist.h @@ -67,12 +67,35 @@ protected: LLPanelWearableListItem(LLViewerInventoryItem* item); }; + +class LLPanelDeletableWearableListItem : public LLPanelWearableListItem +{ + LOG_CLASS(LLPanelDeletableWearableListItem); +public: + + static LLPanelDeletableWearableListItem* create(LLViewerInventoryItem* item); + + virtual ~LLPanelDeletableWearableListItem() {}; + + /*virtual*/ BOOL postBuild(); + + /** + * Make button visible during mouse over event. + */ + inline void setShowDeleteButton(bool show) { setShowWidget("btn_delete", show); } + +protected: + LLPanelDeletableWearableListItem(LLViewerInventoryItem* item); + + /*virtual*/ void init(); +}; + /** * @class LLPanelClothingListItem * * Provides buttons for editing, moving, deleting a wearable. */ -class LLPanelClothingListItem : public LLPanelWearableListItem +class LLPanelClothingListItem : public LLPanelDeletableWearableListItem { LOG_CLASS(LLPanelClothingListItem); public: @@ -86,7 +109,6 @@ public: /** * Make button visible during mouse over event. */ - inline void setShowDeleteButton(bool show) { setShowWidget("btn_delete", show); } inline void setShowMoveUpButton(bool show) { setShowWidget("btn_move_up", show); } inline void setShowMoveDownButton(bool show) { setShowWidget("btn_move_down", show); } @@ -125,28 +147,6 @@ protected: }; -class LLPanelDeletableWearableListItem : public LLPanelWearableListItem -{ - LOG_CLASS(LLPanelDeletableWearableListItem); -public: - - static LLPanelDeletableWearableListItem* create(LLViewerInventoryItem* item); - - virtual ~LLPanelDeletableWearableListItem(); - - /*virtual*/ BOOL postBuild(); - - /** - * Make button visible during mouse over event. - */ - inline void setShowDeleteButton(bool show) { setShowWidget("btn_delete", show); } - -protected: - LLPanelDeletableWearableListItem(LLViewerInventoryItem* item); - - /*virtual*/ void init(); -}; - /** * @class LLPanelDummyClothingListItem * diff --git a/indra/newview/skins/default/xui/en/panel_deletable_wearable_list_item.xml b/indra/newview/skins/default/xui/en/panel_deletable_wearable_list_item.xml new file mode 100644 index 0000000000..2f37b9d3c9 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_deletable_wearable_list_item.xml @@ -0,0 +1,73 @@ + + + + +