summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-01-22 12:21:59 -0800
committerTofu Linden <tofu.linden@lindenlab.com>2010-01-22 12:21:59 -0800
commitefe8b578db5a18194b41ccf3d4b5014a936753c1 (patch)
treeb89ebde171ad317d97e6ec29a36a604547daf687 /indra
parent3889d4329962cc497bccbc8bbe9e6678ab3c9e6c (diff)
parent3b0ba0c2d7f48a5d1cf2adcbc87c9eaf4d8f6564 (diff)
merge.
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/lldictionary.h2
-rw-r--r--indra/newview/llappearancemgr.cpp22
-rw-r--r--indra/newview/llappearancemgr.h10
-rw-r--r--indra/newview/llinventorybridge.cpp42
-rw-r--r--indra/newview/llinventorypanel.cpp8
-rw-r--r--indra/newview/llinventorypanel.h2
-rw-r--r--indra/newview/llpaneloutfitsinventory.cpp40
-rw-r--r--indra/newview/llpaneloutfitsinventory.h24
-rw-r--r--indra/newview/skins/default/xui/en/panel_outfits_inventory.xml2
9 files changed, 104 insertions, 48 deletions
diff --git a/indra/llcommon/lldictionary.h b/indra/llcommon/lldictionary.h
index 95178b41e7..8c86a8560e 100644
--- a/indra/llcommon/lldictionary.h
+++ b/indra/llcommon/lldictionary.h
@@ -76,7 +76,7 @@ public:
return dictionary_iter->first;
}
}
- llassert(false);
+ llwarns << "Lookup on " << name << " failed" << llendl;
return Index(-1);
}
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 61d60fdff9..03180b6a9d 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -428,7 +428,7 @@ static void onWearableAssetFetch(LLWearable* wearable, void* data)
holder->mResolved += 1;
}
-LLUUID LLAppearanceManager::getCOF()
+const LLUUID LLAppearanceManager::getCOF() const
{
return gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
}
@@ -1311,3 +1311,23 @@ void LLAppearanceManager::linkRegisteredAttachments()
}
mRegisteredAttachments.clear();
}
+
+BOOL LLAppearanceManager::getIsInCOF(const LLUUID& obj_id) const
+{
+ return gInventory.isObjectDescendentOf(obj_id, getCOF());
+}
+
+BOOL LLAppearanceManager::getIsProtectedCOFItem(const LLUUID& obj_id) const
+{
+ if (!getIsInCOF(obj_id)) return FALSE;
+ const LLInventoryObject *obj = gInventory.getObject(obj_id);
+ if (!obj) return FALSE;
+
+ // Can't delete bodyparts, since this would be equivalent to removing the item.
+ if (obj->getType() == LLAssetType::AT_BODYPART) return TRUE;
+
+ // Can't delete the folder link, since this is saved for bookkeeping.
+ if (obj->getActualType() == LLAssetType::AT_LINK_FOLDER) return TRUE;
+
+ return FALSE;
+}
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index 517face777..dd50b482cf 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -59,7 +59,7 @@ public:
LLPointer<LLInventoryCallback> cb);
// Find the Current Outfit folder.
- LLUUID getCOF();
+ const LLUUID getCOF() const;
// Finds the folder link to the currently worn outfit
const LLViewerInventoryItem *getBaseOutfitLink();
@@ -132,6 +132,14 @@ private:
std::set<LLUUID> mRegisteredAttachments;
bool mAttachmentInvLinkEnabled;
bool mOutfitIsDirty;
+
+ //////////////////////////////////////////////////////////////////////////////////
+ // Item-specific convenience functions
+public:
+ // Is this in the COF?
+ BOOL getIsInCOF(const LLUUID& obj_id) const;
+ // Is this in the COF and can the user delete it from the COF?
+ BOOL getIsProtectedCOFItem(const LLUUID& obj_id) const;
};
#define SUPPORT_ENSEMBLES 0
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index f91bbaff68..6c9c7d15be 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -185,6 +185,11 @@ BOOL LLInvFVBridge::isItemRemovable()
{
return FALSE;
}
+ if (LLAppearanceManager::instance().getIsProtectedCOFItem(mUUID))
+ {
+ return FALSE;
+ }
+
const LLInventoryObject *obj = model->getItem(mUUID);
if (obj && obj->getIsLinkType())
{
@@ -574,8 +579,8 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
disabled_items.push_back(std::string("Paste As Link"));
}
}
- items.push_back(std::string("Paste Separator"));
+ items.push_back(std::string("Paste Separator"));
if (obj && obj->getIsLinkType() && !get_is_item_worn(mUUID))
{
@@ -712,14 +717,7 @@ BOOL LLInvFVBridge::isAgentInventory() const
BOOL LLInvFVBridge::isCOFFolder() const
{
- const LLInventoryModel* model = getInventoryModel();
- if(!model) return TRUE;
- const LLUUID cof_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
- if (mUUID == cof_id || model->isObjectDescendentOf(mUUID, cof_id))
- {
- return TRUE;
- }
- return FALSE;
+ return LLAppearanceManager::instance().getIsInCOF(mUUID);
}
BOOL LLInvFVBridge::isItemPermissive() const
@@ -3798,8 +3796,25 @@ void LLGestureBridge::openItem()
BOOL LLGestureBridge::removeItem()
{
- // Force close the preview window, if it exists
- LLGestureManager::instance().deactivateGesture(mUUID);
+ // Grab class information locally since *this may be deleted
+ // within this function. Not a great pattern...
+ const LLInventoryModel* model = getInventoryModel();
+ if(!model)
+ {
+ return FALSE;
+ }
+ const LLUUID item_id = mUUID;
+
+ // This will also force close the preview window, if it exists.
+ // This may actually delete *this, if mUUID is in the COF.
+ LLGestureManager::instance().deactivateGesture(item_id);
+
+ // If deactivateGesture deleted *this, then return out immediately.
+ if (!model->getObject(item_id))
+ {
+ return TRUE;
+ }
+
return LLItemBridge::removeItem();
}
@@ -4593,7 +4608,10 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
getClipboardEntries(true, items, disabled_items, flags);
- items.push_back(std::string("Wearable Separator"));
+ if (!is_sidepanel)
+ {
+ items.push_back(std::string("Wearable Separator"));
+ }
items.push_back(std::string("Wearable Edit"));
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 9141d50829..7e71ac90b4 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -682,6 +682,14 @@ void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_foc
mFolders->setSelectionByID(obj_id, take_keyboard_focus);
}
+void LLInventoryPanel::setSelectCallback(const LLFolderView::signal_t::slot_type& cb)
+{
+ if (mFolders)
+ {
+ mFolders->setSelectCallback(cb);
+ }
+}
+
void LLInventoryPanel::clearSelection()
{
mFolders->clearSelection();
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index 09533b52f1..ccff795a51 100644
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -123,7 +123,7 @@ public:
// Call this method to set the selection.
void openAllFolders();
void setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus);
- void setSelectCallback(const LLFolderView::signal_t::slot_type& cb) { if (mFolders) mFolders->setSelectCallback(cb); }
+ void setSelectCallback(const LLFolderView::signal_t::slot_type& cb);
void clearSelection();
LLInventoryFilter* getFilter();
void setFilterTypes(U64 filter, LLInventoryFilter::EFilterType = LLInventoryFilter::FILTERTYPE_OBJECT);
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index fd5ce7a46d..cf903958ee 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -61,6 +61,9 @@
#include "llviewercontrol.h"
+static const std::string OUTFITS_TAB_NAME = "outfitslist_tab";
+static const std::string COF_TAB_NAME = "cof_tab";
+
static LLRegisterPanelClassWrapper<LLPanelOutfitsInventory> t_inventory("panel_outfits_inventory");
bool LLPanelOutfitsInventory::sShowDebugEditor = false;
@@ -267,7 +270,7 @@ void LLPanelOutfitsInventory::onSaveCommit(const std::string& outfit_name)
if (mAppearanceTabs)
{
- mAppearanceTabs->selectTabByName("outfitslist_tab");
+ mAppearanceTabs->selectTabByName(OUTFITS_TAB_NAME);
}
}
@@ -503,8 +506,7 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
if (command_name == "wear")
{
- const BOOL is_my_outfits = (mActivePanel->getName() == "outfitslist_tab");
- if (!is_my_outfits)
+ if (isCOFPanelActive())
{
return FALSE;
}
@@ -558,17 +560,15 @@ bool LLPanelOutfitsInventory::handleDragAndDropToTrash(BOOL drop, EDragAndDropTy
void LLPanelOutfitsInventory::initTabPanels()
{
- mTabPanels.resize(2);
-
- LLInventoryPanel *cof_panel = getChild<LLInventoryPanel>("cof_tab");
+ LLInventoryPanel *cof_panel = getChild<LLInventoryPanel>(COF_TAB_NAME);
cof_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
- mTabPanels[0] = cof_panel;
-
- LLInventoryPanel *myoutfits_panel = getChild<LLInventoryPanel>("outfitslist_tab");
+ mTabPanels.push_back(cof_panel);
+
+ LLInventoryPanel *myoutfits_panel = getChild<LLInventoryPanel>(OUTFITS_TAB_NAME);
myoutfits_panel->setFilterTypes(1LL << LLFolderType::FT_OUTFIT, LLInventoryFilter::FILTERTYPE_CATEGORY);
myoutfits_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
- mTabPanels[1] = myoutfits_panel;
-
+ mTabPanels.push_back(myoutfits_panel);
+
for (tabpanels_vec_t::iterator iter = mTabPanels.begin();
iter != mTabPanels.end();
++iter)
@@ -615,19 +615,19 @@ void LLPanelOutfitsInventory::onTabChange()
updateVerbs();
}
-LLInventoryPanel* LLPanelOutfitsInventory::getActivePanel()
-{
- return mActivePanel;
-}
-
-bool LLPanelOutfitsInventory::isTabPanel(LLInventoryPanel *panel)
+BOOL LLPanelOutfitsInventory::isTabPanel(LLInventoryPanel *panel) const
{
- for(tabpanels_vec_t::iterator it = mTabPanels.begin();
+ for(tabpanels_vec_t::const_iterator it = mTabPanels.begin();
it != mTabPanels.end();
++it)
{
if (*it == panel)
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
+}
+
+BOOL LLPanelOutfitsInventory::isCOFPanelActive() const
+{
+ return (getActivePanel()->getName() == COF_TAB_NAME);
}
diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h
index 76110e2a3f..ab25ef0a49 100644
--- a/indra/newview/llpaneloutfitsinventory.h
+++ b/indra/newview/llpaneloutfitsinventory.h
@@ -78,24 +78,26 @@ protected:
bool getIsCorrectType(const LLFolderViewEventListener *listenerp) const;
private:
- LLSidepanelAppearance* mParent;
- LLSaveFolderState* mSavedFolderState;
- LLTabContainer* mAppearanceTabs;
- std::string mFilterSubString;
+ LLSidepanelAppearance* mParent;
+ LLSaveFolderState* mSavedFolderState;
+ LLTabContainer* mAppearanceTabs;
+ std::string mFilterSubString;
public:
//////////////////////////////////////////////////////////////////////////////////
// tab panels
- LLInventoryPanel* getActivePanel();
- bool isTabPanel(LLInventoryPanel *panel);
+ LLInventoryPanel* getActivePanel() { return mActivePanel; }
+ const LLInventoryPanel* getActivePanel() const { return mActivePanel; }
+ BOOL isTabPanel(LLInventoryPanel *panel) const;
protected:
- void initTabPanels();
- void onTabSelectionChange(LLInventoryPanel* tab_panel, const std::deque<LLFolderViewItem*> &items, BOOL user_action);
- void onTabChange();
-
+ void initTabPanels();
+ void onTabSelectionChange(LLInventoryPanel* tab_panel, const std::deque<LLFolderViewItem*> &items, BOOL user_action);
+ void onTabChange();
+ BOOL isCOFPanelActive() const;
+
private:
- LLInventoryPanel* mActivePanel;
+ LLInventoryPanel* mActivePanel;
typedef std::vector<LLInventoryPanel *> tabpanels_vec_t;
tabpanels_vec_t mTabPanels;
diff --git a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml
index 8895484326..710ca733e0 100644
--- a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml
@@ -45,7 +45,7 @@
left="0"
top="0"
mouse_opaque="true"
- name="cof_accordionpanel"
+ name="cof_tab"
start_folder="Current Outfit"
width="313" />
</tab_container>