llfloatergesture.cpp
上传用户:king477883
上传日期:2021-03-01
资源大小:9553k
文件大小:19k
源码类别:

游戏引擎

开发平台:

C++ Builder

  1. /** 
  2.  * @file llfloatergesture.cpp
  3.  * @brief Read-only list of gestures from your inventory.
  4.  *
  5.  * $LicenseInfo:firstyear=2002&license=viewergpl$
  6.  * 
  7.  * Copyright (c) 2002-2010, Linden Research, Inc.
  8.  * 
  9.  * Second Life Viewer Source Code
  10.  * The source code in this file ("Source Code") is provided by Linden Lab
  11.  * to you under the terms of the GNU General Public License, version 2.0
  12.  * ("GPL"), unless you have obtained a separate licensing agreement
  13.  * ("Other License"), formally executed by you and Linden Lab.  Terms of
  14.  * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15.  * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16.  * 
  17.  * There are special exceptions to the terms and conditions of the GPL as
  18.  * it is applied to this Source Code. View the full text of the exception
  19.  * in the file doc/FLOSS-exception.txt in this software distribution, or
  20.  * online at
  21.  * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22.  * 
  23.  * By copying, modifying or distributing this software, you acknowledge
  24.  * that you have read and understood your obligations described above,
  25.  * and agree to abide by those obligations.
  26.  * 
  27.  * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28.  * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29.  * COMPLETENESS OR PERFORMANCE.
  30.  * $/LicenseInfo$
  31.  */
  32. #include "llviewerprecompiledheaders.h"
  33. #include "llfloatergesture.h"
  34. #include "llinventory.h"
  35. #include "llinventorybridge.h"
  36. #include "llinventorymodel.h"
  37. #include "llinventoryclipboard.h"
  38. #include "llagent.h"
  39. #include "llappearancemgr.h"
  40. #include "llclipboard.h"
  41. #include "llgesturemgr.h"
  42. #include "llkeyboard.h"
  43. #include "llmenugl.h"
  44. #include "llmultigesture.h"
  45. #include "llpreviewgesture.h"
  46. #include "llscrolllistctrl.h"
  47. #include "lltrans.h"
  48. #include "llviewergesture.h"
  49. #include "llviewermenu.h" 
  50. #include "llviewerinventory.h"
  51. #include "llviewercontrol.h"
  52. BOOL item_name_precedes( LLInventoryItem* a, LLInventoryItem* b )
  53. {
  54. return LLStringUtil::precedesDict( a->getName(), b->getName() );
  55. }
  56. class LLFloaterGestureObserver : public LLGestureManagerObserver
  57. {
  58. public:
  59. LLFloaterGestureObserver(LLFloaterGesture* floater) : mFloater(floater) {}
  60. virtual ~LLFloaterGestureObserver() {}
  61. virtual void changed() { mFloater->refreshAll(); }
  62. private:
  63. LLFloaterGesture* mFloater;
  64. };
  65. //-----------------------------
  66. // GestureCallback
  67. //-----------------------------
  68. class GestureShowCallback : public LLInventoryCallback
  69. {
  70. public:
  71. void fire(const LLUUID &inv_item)
  72. {
  73. LLPreviewGesture::show(inv_item, LLUUID::null);
  74. }
  75. };
  76. class GestureCopiedCallback : public LLInventoryCallback
  77. {
  78. private:
  79. LLFloaterGesture* mFloater;
  80. public:
  81. GestureCopiedCallback(LLFloaterGesture* floater): mFloater(floater)
  82. {}
  83. void fire(const LLUUID &inv_item)
  84. {
  85. if(mFloater)
  86. {
  87. mFloater->addGesture(inv_item,NULL,mFloater->getChild<LLScrollListCtrl>("gesture_list"));
  88. }
  89. }
  90. };
  91. //---------------------------------------------------------------------------
  92. // LLFloaterGesture
  93. //---------------------------------------------------------------------------
  94. LLFloaterGesture::LLFloaterGesture(const LLSD& key)
  95. : LLFloater(key)
  96. {
  97. mObserver = new LLFloaterGestureObserver(this);
  98. LLGestureManager::instance().addObserver(mObserver);
  99. mCommitCallbackRegistrar.add("Gesture.Action.ToogleActiveState", boost::bind(&LLFloaterGesture::onActivateBtnClick, this));
  100. mCommitCallbackRegistrar.add("Gesture.Action.ShowPreview", boost::bind(&LLFloaterGesture::onClickEdit, this));
  101. mCommitCallbackRegistrar.add("Gesture.Action.CopyPaste", boost::bind(&LLFloaterGesture::onCopyPasteAction, this, _2));
  102. mCommitCallbackRegistrar.add("Gesture.Action.SaveToCOF", boost::bind(&LLFloaterGesture::addToCurrentOutFit, this));
  103. mEnableCallbackRegistrar.add("Gesture.EnableAction", boost::bind(&LLFloaterGesture::isActionEnabled, this, _2));
  104. }
  105. void LLFloaterGesture::done()
  106. {
  107. //this method can be called twice: for GestureFolder and once after loading all sudir of GestureFolder
  108. if (gInventory.isCategoryComplete(mGestureFolderID))
  109. {
  110. LL_DEBUGS("Gesture")<< "mGestureFolderID loaded" << LL_ENDL;
  111. // we load only gesture folder without childred.
  112. LLInventoryModel::cat_array_t* categories;
  113. LLInventoryModel::item_array_t* items;
  114. LLInventoryFetchDescendentsObserver::folder_ref_t unloaded_folders;
  115. LL_DEBUGS("Gesture")<< "Get subdirs of Gesture Folder...." << LL_ENDL;
  116. gInventory.getDirectDescendentsOf(mGestureFolderID, categories, items);
  117. if (categories->empty())
  118. {
  119. gInventory.removeObserver(this);
  120. LL_INFOS("Gesture")<< "Gesture dos NOT contains sub-directories."<< LL_ENDL;
  121. return;
  122. }
  123. LL_DEBUGS("Gesture")<< "There are " << categories->size() << " Folders "<< LL_ENDL;
  124. for (LLInventoryModel::cat_array_t::iterator it = categories->begin(); it != categories->end(); it++)
  125. {
  126. if (!gInventory.isCategoryComplete(it->get()->getUUID()))
  127. {
  128. unloaded_folders.push_back(it->get()->getUUID());
  129. LL_DEBUGS("Gesture")<< it->get()->getName()<< " Folder added to fetchlist"<< LL_ENDL;
  130. }
  131. }
  132. if (!unloaded_folders.empty())
  133. {
  134. LL_DEBUGS("Gesture")<< "Fetching subdirectories....." << LL_ENDL;
  135. fetchDescendents(unloaded_folders);
  136. }
  137. else
  138. {
  139. LL_DEBUGS("Gesture")<< "All Gesture subdirectories have been loaded."<< LL_ENDL;
  140. gInventory.removeObserver(this);
  141. buildGestureList();
  142. }
  143. }
  144. else
  145. {
  146. LL_WARNS("Gesture")<< "Gesture list was NOT loaded"<< LL_ENDL;
  147. }
  148. }
  149. // virtual
  150. LLFloaterGesture::~LLFloaterGesture()
  151. {
  152. LLGestureManager::instance().removeObserver(mObserver);
  153. delete mObserver;
  154. mObserver = NULL;
  155. gInventory.removeObserver(this);
  156. }
  157. // virtual
  158. BOOL LLFloaterGesture::postBuild()
  159. {
  160. std::string label;
  161. label = getTitle();
  162. setTitle(label);
  163. mGestureList = getChild<LLScrollListCtrl>("gesture_list");
  164. mGestureList->setCommitCallback(boost::bind(&LLFloaterGesture::onCommitList, this));
  165. mGestureList->setDoubleClickCallback(boost::bind(&LLFloaterGesture::onClickPlay, this));
  166. getChild<LLUICtrl>("edit_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickEdit, this));
  167. getChild<LLUICtrl>("play_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickPlay, this));
  168. getChild<LLUICtrl>("stop_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickPlay, this));
  169. getChild<LLButton>("activate_btn")->setClickedCallback(boost::bind(&LLFloaterGesture::onActivateBtnClick, this));
  170. getChild<LLUICtrl>("new_gesture_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickNew, this));
  171. getChild<LLButton>("del_btn")->setClickedCallback(boost::bind(&LLFloaterGesture::onDeleteSelected, this));
  172. childSetVisible("play_btn", true);
  173. childSetVisible("stop_btn", false);
  174. setDefaultBtn("play_btn");
  175. mGestureFolderID = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE, false);
  176. folder_ref_t folders;
  177. folders.push_back(mGestureFolderID);
  178. //perform loading Gesture directory anyway to make sure that all subdirectory are loaded too. See method done() for details.
  179. gInventory.addObserver(this);
  180. fetchDescendents(folders);
  181. if (mGestureList)
  182. {
  183. buildGestureList();
  184. mGestureList->setFocus(TRUE);
  185. const BOOL ascending = TRUE;
  186. mGestureList->sortByColumn(std::string("name"), ascending);
  187. mGestureList->selectFirstItem();
  188. }
  189. // Update button labels
  190. onCommitList();
  191. return TRUE;
  192. }
  193. void LLFloaterGesture::refreshAll()
  194. {
  195. if (!mGestureList) return;
  196. buildGestureList();
  197. if (mSelectedID.isNull())
  198. {
  199. mGestureList->selectFirstItem();
  200. }
  201. else
  202. {
  203. if (! mGestureList->setCurrentByID(mSelectedID))
  204. {
  205. mGestureList->selectFirstItem();
  206. }
  207. }
  208. // Update button labels
  209. onCommitList();
  210. }
  211. void LLFloaterGesture::buildGestureList()
  212. {
  213. S32 scroll_pos = mGestureList->getScrollPos();
  214. std::vector<LLUUID> selected_items;
  215. getSelectedIds(selected_items);
  216. LL_DEBUGS("Gesture")<< "Rebuilding gesture list "<< LL_ENDL;
  217. mGestureList->deleteAllItems();
  218. LLGestureManager::item_map_t::const_iterator it;
  219. const LLGestureManager::item_map_t& active_gestures = LLGestureManager::instance().getActiveGestures();
  220. for (it = active_gestures.begin(); it != active_gestures.end(); ++it)
  221. {
  222. addGesture(it->first,it->second, mGestureList);
  223. }
  224. if (gInventory.isCategoryComplete(mGestureFolderID))
  225. {
  226. LLIsType is_gesture(LLAssetType::AT_GESTURE);
  227. LLInventoryModel::cat_array_t categories;
  228. LLInventoryModel::item_array_t items;
  229. gInventory.collectDescendentsIf(mGestureFolderID, categories, items,
  230. LLInventoryModel::EXCLUDE_TRASH, is_gesture);
  231. for (LLInventoryModel::item_array_t::iterator it = items.begin(); it!= items.end(); ++it)
  232. {
  233. LLInventoryItem* item = it->get();
  234. if (active_gestures.find(item->getUUID()) == active_gestures.end())
  235. {
  236. // if gesture wasn't loaded yet, we can display only name
  237. addGesture(item->getUUID(), NULL, mGestureList);
  238. }
  239. }
  240. }
  241. // attempt to preserve scroll position through re-builds
  242. // since we do re-build whenever something gets dirty
  243. for(std::vector<LLUUID>::iterator it = selected_items.begin(); it != selected_items.end(); it++)
  244. {
  245. mGestureList->selectByID(*it);
  246. }
  247. mGestureList->setScrollPos(scroll_pos);
  248. }
  249. void LLFloaterGesture::addGesture(const LLUUID& item_id , LLMultiGesture* gesture,LLCtrlListInterface * list )
  250. {
  251. // Note: Can have NULL item if inventory hasn't arrived yet.
  252. static std::string item_name = getString("loading");
  253. LLInventoryItem* item = gInventory.getItem(item_id);
  254. if (item)
  255. {
  256. item_name = item->getName();
  257. }
  258. static std::string font_style = "NORMAL";
  259. // If gesture is playing, bold it
  260. LLSD element;
  261. element["id"] = item_id;
  262. if (gesture)
  263. {
  264. if (gesture->mPlaying)
  265. {
  266. font_style = "BOLD";
  267. }
  268. item_name = gesture->mName;
  269. element["columns"][0]["column"] = "trigger";
  270. element["columns"][0]["value"] = gesture->mTrigger;
  271. element["columns"][0]["font"]["name"] = "SANSSERIF";
  272. element["columns"][0]["font"]["style"] = font_style;
  273. std::string key_string = LLKeyboard::stringFromKey(gesture->mKey);
  274. std::string buffer;
  275. if (gesture->mKey == KEY_NONE)
  276. {
  277. buffer = "---";
  278. key_string = "~~~"; // alphabetize to end
  279. }
  280. else
  281. {
  282. buffer = LLKeyboard::stringFromAccelerator(gesture->mMask,
  283. gesture->mKey);
  284. }
  285. element["columns"][1]["column"] = "shortcut";
  286. element["columns"][1]["value"] = buffer;
  287. element["columns"][1]["font"]["name"] = "SANSSERIF";
  288. element["columns"][1]["font"]["style"] = font_style;
  289. // hidden column for sorting
  290. element["columns"][2]["column"] = "key";
  291. element["columns"][2]["value"] = key_string;
  292. element["columns"][2]["font"]["name"] = "SANSSERIF";
  293. element["columns"][2]["font"]["style"] = font_style;
  294. // Only add "playing" if we've got the name, less confusing. JC
  295. if (item && gesture->mPlaying)
  296. {
  297. item_name += " " + getString("playing");
  298. }
  299. element["columns"][3]["column"] = "name";
  300. element["columns"][3]["value"] = item_name;
  301. element["columns"][3]["font"]["name"] = "SANSSERIF";
  302. element["columns"][3]["font"]["style"] = font_style;
  303. }
  304. else
  305. {
  306. element["columns"][0]["column"] = "trigger";
  307. element["columns"][0]["value"] = "";
  308. element["columns"][0]["font"]["name"] = "SANSSERIF";
  309. element["columns"][0]["font"]["style"] = font_style;
  310. element["columns"][0]["column"] = "trigger";
  311. element["columns"][0]["value"] = "---";
  312. element["columns"][0]["font"]["name"] = "SANSSERIF";
  313. element["columns"][0]["font"]["style"] = font_style;
  314. element["columns"][2]["column"] = "key";
  315. element["columns"][2]["value"] = "~~~";
  316. element["columns"][2]["font"]["name"] = "SANSSERIF";
  317. element["columns"][2]["font"]["style"] = font_style;
  318. element["columns"][3]["column"] = "name";
  319. element["columns"][3]["value"] = item_name;
  320. element["columns"][3]["font"]["name"] = "SANSSERIF";
  321. element["columns"][3]["font"]["style"] = font_style;
  322. }
  323. LLScrollListItem* sl_item = list->addElement(element, ADD_BOTTOM);
  324. if(sl_item)
  325. {
  326. LLFontGL::StyleFlags style = LLGestureManager::getInstance()->isGestureActive(item_id) ? LLFontGL::BOLD : LLFontGL::NORMAL;
  327. // *TODO find out why ["font"]["style"] does not affect font style
  328. ((LLScrollListText*)sl_item->getColumn(0))->setFontStyle(style);
  329. }
  330. }
  331. void LLFloaterGesture::getSelectedIds(std::vector<LLUUID>& ids)
  332. {
  333. std::vector<LLScrollListItem*> items = mGestureList->getAllSelected();
  334. for(std::vector<LLScrollListItem*>::const_iterator it = items.begin(); it != items.end(); it++)
  335. {
  336. ids.push_back((*it)->getUUID());
  337. }
  338. }
  339. bool LLFloaterGesture::isActionEnabled(const LLSD& command)
  340. {
  341. // paste copy_uuid edit_gesture
  342. std::string command_name = command.asString();
  343. if("paste" == command_name)
  344. {
  345. if(!LLInventoryClipboard::instance().hasContents())
  346. return false;
  347. LLDynamicArray<LLUUID> ids;
  348. LLInventoryClipboard::instance().retrieve(ids);
  349. for(LLDynamicArray<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++)
  350. {
  351. LLInventoryItem* item = gInventory.getItem(*it);
  352. if(item && item->getInventoryType() == LLInventoryType::IT_GESTURE)
  353. {
  354. return true;
  355. }
  356. }
  357. return false;
  358. }
  359. else if("copy_uuid" == command_name || "edit_gesture" == command_name)
  360. {
  361. return mGestureList->getAllSelected().size() == 1;
  362. }
  363. return true;
  364. }
  365. void LLFloaterGesture::onClickPlay()
  366. {
  367. const LLUUID& item_id = mGestureList->getCurrentID();
  368. if(item_id.isNull()) return;
  369. LL_DEBUGS("Gesture")<<" Trying to play gesture id: "<< item_id <<LL_ENDL;
  370. if(!LLGestureManager::instance().isGestureActive(item_id))
  371. {
  372. // we need to inform server about gesture activating to be consistent with LLPreviewGesture and  LLGestureComboList.
  373. BOOL inform_server = TRUE;
  374. BOOL deactivate_similar = FALSE;
  375. LLGestureManager::instance().setGestureLoadedCallback(item_id, boost::bind(&LLFloaterGesture::playGesture, this, item_id));
  376. LLViewerInventoryItem *item = gInventory.getItem(item_id);
  377. llassert(item);
  378. if (item)
  379. {
  380. LLGestureManager::instance().activateGestureWithAsset(item_id, item->getAssetUUID(), inform_server, deactivate_similar);
  381. LL_DEBUGS("Gesture")<< "Activating gesture with inventory ID: " << item_id <<LL_ENDL;
  382. }
  383. }
  384. else
  385. {
  386. playGesture(item_id);
  387. }
  388. }
  389. void LLFloaterGesture::onClickNew()
  390. {
  391. LLPointer<LLInventoryCallback> cb = new GestureShowCallback();
  392. create_inventory_item(gAgent.getID(), gAgent.getSessionID(),
  393. LLUUID::null, LLTransactionID::tnull, "New Gesture", "", LLAssetType::AT_GESTURE,
  394. LLInventoryType::IT_GESTURE, NOT_WEARABLE, PERM_MOVE | PERM_TRANSFER, cb);
  395. }
  396. void LLFloaterGesture::onActivateBtnClick()
  397. {
  398. std::vector<LLUUID> ids;
  399. getSelectedIds(ids);
  400. if(ids.empty())
  401. return;
  402. LLGestureManager* gm = LLGestureManager::getInstance();
  403. std::vector<LLUUID>::const_iterator it = ids.begin();
  404. BOOL first_gesture_state = gm->isGestureActive(*it);
  405. BOOL is_mixed = FALSE;
  406. while( ++it != ids.end() )
  407. {
  408. if(first_gesture_state != gm->isGestureActive(*it))
  409. {
  410. is_mixed = TRUE;
  411. break;
  412. }
  413. }
  414. for(std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); it++)
  415. {
  416. if(is_mixed)
  417. {
  418. gm->activateGesture(*it);
  419. }
  420. else
  421. {
  422. if(first_gesture_state)
  423. {
  424. gm->deactivateGesture(*it);
  425. }
  426. else
  427. {
  428. gm->activateGesture(*it);
  429. }
  430. }
  431. }
  432. }
  433. void LLFloaterGesture::onCopyPasteAction(const LLSD& command)
  434. {
  435. std::string command_name  = command.asString();
  436. // since we select this comman inventory item had  already arrived .
  437. if("copy_gesture" == command_name)
  438. {
  439. std::vector<LLUUID> ids;
  440. getSelectedIds(ids);
  441. // make sure that clopboard is empty
  442. LLInventoryClipboard::instance().reset();
  443. for(std::vector<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++)
  444. {
  445. LLInventoryItem* item = gInventory.getItem(*it);
  446. if(item  && item->getInventoryType() == LLInventoryType::IT_GESTURE)
  447. {
  448. LLInventoryClipboard::instance().add(item->getUUID());
  449. }
  450. }
  451. }
  452. else if ("paste" == command_name)
  453. {
  454. LLInventoryClipboard& clipbord = LLInventoryClipboard::instance();
  455. LLDynamicArray<LLUUID> ids;
  456. clipbord.retrieve(ids);
  457. if(ids.empty() || !gInventory.isCategoryComplete(mGestureFolderID))
  458. return;
  459. LLInventoryCategory* gesture_dir = gInventory.getCategory(mGestureFolderID);
  460. llassert(gesture_dir);
  461. LLPointer<GestureCopiedCallback> cb = new GestureCopiedCallback(this);
  462. for(LLDynamicArray<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++)
  463. {
  464. LLInventoryItem* item = gInventory.getItem(*it);
  465. if(gesture_dir && item && item->getInventoryType() == LLInventoryType::IT_GESTURE)
  466. {
  467. LLStringUtil::format_map_t string_args;
  468. string_args["[COPY_NAME]"] = item->getName();
  469. LL_DEBUGS("Gesture")<< "Copying gesture " << item->getName() << "  "<< item->getUUID() << " into "
  470. << gesture_dir->getName() << "  "<< gesture_dir->getUUID() << LL_ENDL;
  471. copy_inventory_item(gAgent.getID(), item->getPermissions().getOwner(), item->getUUID(), 
  472. gesture_dir->getUUID(), getString("copy_name", string_args), cb);
  473. }
  474. }
  475. clipbord.reset();
  476. }
  477. else if ("copy_uuid" == command_name)
  478. {
  479. gClipboard.copyFromString(utf8str_to_wstring(mGestureList->getCurrentID().asString()), mGestureList->getCurrentID());
  480. }
  481. }
  482. void LLFloaterGesture::onClickEdit()
  483. {
  484. const LLUUID& item_id = mGestureList->getCurrentID();
  485. LLInventoryItem* item = gInventory.getItem(item_id);
  486. if (!item) return;
  487. LLPreviewGesture* previewp = LLPreviewGesture::show(item_id, LLUUID::null);
  488. if (!previewp->getHost())
  489. {
  490. previewp->setRect(gFloaterView->findNeighboringPosition(this, previewp));
  491. }
  492. }
  493. void LLFloaterGesture::onCommitList()
  494. {
  495. const LLUUID& item_id = mGestureList->getCurrentID();
  496. mSelectedID = item_id;
  497. if (LLGestureManager::instance().isGesturePlaying(item_id))
  498. {
  499. childSetVisible("play_btn", false);
  500. childSetVisible("stop_btn", true);
  501. }
  502. else
  503. {
  504. childSetVisible("play_btn", true);
  505. childSetVisible("stop_btn", false);
  506. }
  507. }
  508. void LLFloaterGesture::onDeleteSelected()
  509. {
  510. std::vector<LLUUID> ids;
  511. getSelectedIds(ids);
  512. if(ids.empty())
  513. return;
  514. const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
  515. LLGestureManager* gm = LLGestureManager::getInstance();
  516. for(std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); it++)
  517. {
  518. const LLUUID& selected_item = *it;
  519. LLInventoryItem* inv_item = gInventory.getItem(selected_item);
  520. if (inv_item && inv_item->getInventoryType() == LLInventoryType::IT_GESTURE)
  521. {
  522. if(gm->isGestureActive(selected_item))
  523. {
  524. gm->deactivateGesture(selected_item);
  525. }
  526. LLInventoryModel::update_list_t update;
  527. LLInventoryModel::LLCategoryUpdate old_folder(inv_item->getParentUUID(), -1);
  528. update.push_back(old_folder);
  529. LLInventoryModel::LLCategoryUpdate new_folder(trash_id, 1);
  530. update.push_back(new_folder);
  531. gInventory.accountForUpdate(update);
  532. LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(inv_item);
  533. new_item->setParent(trash_id);
  534. // no need to restamp it though it's a move into trash because
  535. // it's a brand new item already.
  536. new_item->updateParentOnServer(FALSE);
  537. gInventory.updateItem(new_item);
  538. }
  539. }
  540. gInventory.notifyObservers();
  541. buildGestureList();
  542. }
  543. void LLFloaterGesture::addToCurrentOutFit()
  544. {
  545. std::vector<LLUUID> ids;
  546. getSelectedIds(ids);
  547. LLAppearanceManager* am = LLAppearanceManager::getInstance();
  548. for(std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); it++)
  549. {
  550. am->addCOFItemLink(*it);
  551. }
  552. }
  553. void LLFloaterGesture::playGesture(LLUUID item_id)
  554. {
  555. LL_DEBUGS("Gesture")<<"Playing gesture "<< item_id<<LL_ENDL;
  556. if (LLGestureManager::instance().isGesturePlaying(item_id))
  557. {
  558. LLGestureManager::instance().stopGesture(item_id);
  559. }
  560. else
  561. {
  562. LLGestureManager::instance().playGesture(item_id);
  563. }
  564. }