From 0777f53e2f2d773fa536b3c62e16455ce7bbbcce Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 10 Dec 2012 14:47:17 -0500 Subject: SH-3606 WIP - replaced several LLInventoryCallback subclasses with boost::func equivalents --- indra/newview/llfloatergesture.cpp | 45 ++++++++++++++------------------------ 1 file changed, 16 insertions(+), 29 deletions(-) (limited to 'indra/newview/llfloatergesture.cpp') diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index 56051ff684..4054eba1aa 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -65,40 +65,27 @@ private: LLFloaterGesture* mFloater; }; //----------------------------- -// GestureCallback +// gesture callback funcs //----------------------------- -class GestureShowCallback : public LLInventoryCallback +void gesture_show_cb(const LLUUID &inv_item) { -public: - void fire(const LLUUID &inv_item) - { - LLPreviewGesture::show(inv_item, LLUUID::null); - } -}; + LLPreviewGesture::show(inv_item, LLUUID::null); +} -class GestureCopiedCallback : public LLInventoryCallback +void gesture_copied_cb(const LLUUID &inv_item, LLFloaterGesture* floater) { -private: - LLFloaterGesture* mFloater; - -public: - GestureCopiedCallback(LLFloaterGesture* floater): mFloater(floater) - {} - void fire(const LLUUID &inv_item) + if(floater) { - if(mFloater) - { - mFloater->addGesture(inv_item,NULL,mFloater->getChild("gesture_list")); - - // EXP-1909 (Pasted gesture displayed twice) - // The problem is that addGesture is called here for the second time for the same item (which is copied) - // First time addGesture is called from LLFloaterGestureObserver::changed(), which is a callback for inventory - // change. So we need to refresh the gesture list to avoid duplicates. - mFloater->refreshAll(); - } + floater->addGesture(inv_item,NULL,floater->getChild("gesture_list")); + + // EXP-1909 (Pasted gesture displayed twice) + // The problem is that addGesture is called here for the second time for the same item (which is copied) + // First time addGesture is called from LLFloaterGestureObserver::changed(), which is a callback for inventory + // change. So we need to refresh the gesture list to avoid duplicates. + floater->refreshAll(); } -}; +} //--------------------------------------------------------------------------- // LLFloaterGesture @@ -448,7 +435,7 @@ void LLFloaterGesture::onClickPlay() void LLFloaterGesture::onClickNew() { - LLPointer cb = new GestureShowCallback(); + LLPointer cb = new LLBoostFuncInventoryCallback(gesture_show_cb); create_inventory_item(gAgent.getID(), gAgent.getSessionID(), LLUUID::null, LLTransactionID::tnull, "New Gesture", "", LLAssetType::AT_GESTURE, LLInventoryType::IT_GESTURE, NOT_WEARABLE, PERM_MOVE | PERM_TRANSFER, cb); @@ -520,7 +507,7 @@ void LLFloaterGesture::onCopyPasteAction(const LLSD& command) return; LLInventoryCategory* gesture_dir = gInventory.getCategory(mGestureFolderID); llassert(gesture_dir); - LLPointer cb = new GestureCopiedCallback(this); + LLPointer cb = new LLBoostFuncInventoryCallback(boost::bind(gesture_copied_cb, _1, this)); for(LLDynamicArray::iterator it = ids.begin(); it != ids.end(); it++) { -- cgit v1.2.3