From 9ab7d647c155881781f71fd7774a130ddb24a41d Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Thu, 21 Jan 2010 15:09:38 -0800 Subject: EXT-3416 Can't name a new gesture on creation (and renaming is HARD) reviewed by Callum --- indra/newview/llgesturemgr.cpp | 35 +++++++++++++++++++++++++++++++++++ indra/newview/llgesturemgr.h | 3 +++ indra/newview/llinventorymodel.cpp | 4 ++++ indra/newview/llinventoryobserver.h | 5 +++-- 4 files changed, 45 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 82293b4aa0..0ba7bdf613 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -98,6 +98,41 @@ void LLGestureManager::init() // TODO } +void LLGestureManager::changed(U32 mask) +{ + LLInventoryFetchObserver::changed(mask); + + if (mask & LLInventoryObserver::GESTURE) + { + // If there was a gesture label changed, update all the names in the + // active gestures and then notify observers + if (mask & LLInventoryObserver::LABEL) + { + for(item_map_t::iterator it = mActive.begin(); it != mActive.end(); ++it) + { + if(it->second) + { + LLViewerInventoryItem* item = gInventory.getItem(it->first); + if(item) + { + it->second->mName = item->getName(); + } + } + } + notifyObservers(); + } + // If there was a gesture added or removed notify observers + // STRUCTURE denotes that the inventory item has been moved + // In the case of deleting gesture, it is moved to the trash + else if(mask & LLInventoryObserver::ADD || + mask & LLInventoryObserver::REMOVE || + mask & LLInventoryObserver::STRUCTURE) + { + notifyObservers(); + } + } +} + // Use this version when you have the item_id but not the asset_id, // and you KNOW the inventory is loaded. diff --git a/indra/newview/llgesturemgr.h b/indra/newview/llgesturemgr.h index c562587c6f..3dd184ddc7 100644 --- a/indra/newview/llgesturemgr.h +++ b/indra/newview/llgesturemgr.h @@ -140,6 +140,9 @@ public: void removeObserver(LLGestureManagerObserver* observer); void notifyObservers(); + // Overriding so we can update active gesture names and notify observers + void changed(U32 mask); + BOOL matchPrefix(const std::string& in_str, std::string* out_str); // Copy item ids into the vector diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index ef18386e57..ec9ddc49ad 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -755,6 +755,10 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item) gCacheName->get(id, FALSE, boost::bind(&LLViewerInventoryItem::onCallingCardNameLookup, new_item.get(), _1, _2, _3)); } } + else if (new_item->getType() == LLAssetType::AT_GESTURE) + { + mask |= LLInventoryObserver::GESTURE; + } addChangedMask(mask, new_item->getUUID()); return mask; } diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h index c1f192e2bf..d6dded52d4 100644 --- a/indra/newview/llinventoryobserver.h +++ b/indra/newview/llinventoryobserver.h @@ -61,8 +61,9 @@ public: REMOVE = 8, // something deleted STRUCTURE = 16, // structural change (eg item or folder moved) CALLING_CARD = 32, // (eg online, grant status, cancel) - REBUILD = 64, // item UI changed (eg item type different) - SORT = 128, // folder needs to be resorted. + GESTURE = 64, + REBUILD = 128, // item UI changed (eg item type different) + SORT = 256, // folder needs to be resorted. ALL = 0xffffffff }; LLInventoryObserver(); -- cgit v1.2.3