llpreviewgesture.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /**
  2. * @file llpreviewgesture.h
  3. * @brief Editing UI for inventory-based gestures.
  4. *
  5. * $LicenseInfo:firstyear=2004&license=viewergpl$
  6. *
  7. * Copyright (c) 2004-2009, 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. #ifndef LL_LLPREVIEWGESTURE_H
  33. #define LL_LLPREVIEWGESTURE_H
  34. #include "llpreview.h"
  35. #include "llmultigesture.h"
  36. class LLMultiGesture;
  37. class LLLineEditor;
  38. class LLTextBox;
  39. class LLCheckBoxCtrl;
  40. class LLComboBox;
  41. class LLScrollListCtrl;
  42. class LLScrollListItem;
  43. class LLButton;
  44. class LLGestureStep;
  45. class LLRadioGroup;
  46. class LLPreviewGesture final : public LLPreview
  47. {
  48. protected:
  49. LOG_CLASS(LLPreviewGesture);
  50. public:
  51. // Pass an object_id if this gesture is inside an object in the world,
  52. // otherwise use LLUUID::null.
  53. static LLPreviewGesture* show(const std::string& title,
  54. const LLUUID& item_id,
  55. const LLUUID& object_id,
  56. bool take_focus = true);
  57. // LLView overrides
  58. bool handleKeyHere(KEY key, MASK mask) override;
  59. bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop,
  60. EDragAndDropType cargo_type, void* cargo_data,
  61. EAcceptance* accept, std::string& tooltip) override;
  62. // LLPanel override
  63. bool postBuild() override;
  64. // LLFloater overrides
  65. bool canClose() override;
  66. void setMinimized(bool minimize) override;
  67. void onClose(bool app_quitting) override;
  68. protected:
  69. LLPreviewGesture();
  70. ~LLPreviewGesture() override;
  71. void init(const LLUUID& item_id, const LLUUID& object_id);
  72. void onUpdateSucceeded();
  73. // Populate various comboboxes
  74. void addModifiers();
  75. void addKeys();
  76. void addAnimations();
  77. void addSounds();
  78. void refresh() override;
  79. void initDefaultGesture();
  80. void loadAsset() override;
  81. static void onLoadComplete(const LLUUID& asset_uuid,
  82. LLAssetType::EType type, void* user_data,
  83. S32 status, LLExtStat);
  84. void loadUIFromGesture(LLMultiGesture* gesture);
  85. void saveIfNeeded();
  86. static void finishInventoryUpload(LLUUID item_id, LLUUID new_asset_id);
  87. static void onSaveComplete(const LLUUID& asset_uuid, void* user_data,
  88. S32 status, LLExtStat);
  89. bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response);
  90. // Write UI back into gesture
  91. LLMultiGesture* createGesture();
  92. // Add a step. Pass the name of the step, like "Animation",
  93. // "Sound", "Chat", or "Wait"
  94. LLScrollListItem* addStep(const enum EStepType step_type);
  95. static void updateLabel(LLScrollListItem* item);
  96. static void onCommitSetDirty(LLUICtrl* ctrl, void* data);
  97. static void onCommitLibrary(LLUICtrl* ctrl, void* data);
  98. static void onCommitStep(LLUICtrl* ctrl, void* data);
  99. static void onCommitAnimation(LLUICtrl* ctrl, void* data);
  100. static void onCommitSound(LLUICtrl* ctrl, void* data);
  101. static void onCommitChat(LLUICtrl* ctrl, void* data);
  102. static void onCommitWait(LLUICtrl* ctrl, void* data);
  103. static void onCommitWaitTime(LLUICtrl* ctrl, void* data);
  104. static void onCommitAnimationTrigger(LLUICtrl* ctrl, void *data);
  105. // Handy function to commit each keystroke
  106. static void onKeystrokeCommit(LLLineEditor* caller, void* data);
  107. static void onClickAdd(void* data);
  108. static void onClickUp(void* data);
  109. static void onClickDown(void* data);
  110. static void onClickDelete(void* data);
  111. static void onCommitActive(LLUICtrl* ctrl, void* data);
  112. static void onClickSave(void* data);
  113. static void onClickPreview(void* data);
  114. static void onDonePreview(LLMultiGesture* gesture, void* data);
  115. LL_INLINE const char* getTitleName() const override { return "Gesture"; }
  116. protected:
  117. // LLPreview contains mDescEditor
  118. LLLineEditor* mTriggerEditor;
  119. LLTextBox* mReplaceText;
  120. LLLineEditor* mReplaceEditor;
  121. LLComboBox* mModifierCombo;
  122. LLComboBox* mKeyCombo;
  123. LLScrollListCtrl* mLibraryList;
  124. LLButton* mAddBtn;
  125. LLButton* mUpBtn;
  126. LLButton* mDownBtn;
  127. LLButton* mDeleteBtn;
  128. LLScrollListCtrl* mStepList;
  129. // Options panels for items in gesture list
  130. LLTextBox* mOptionsText;
  131. LLRadioGroup* mAnimationRadio;
  132. LLComboBox* mAnimationCombo;
  133. LLComboBox* mSoundCombo;
  134. LLLineEditor* mChatEditor;
  135. LLCheckBoxCtrl* mWaitAnimCheck;
  136. LLCheckBoxCtrl* mWaitTimeCheck;
  137. LLLineEditor* mWaitTimeEditor;
  138. LLCheckBoxCtrl* mActiveCheck;
  139. LLButton* mSaveBtn;
  140. LLButton* mPreviewBtn;
  141. LLMultiGesture* mPreviewGesture;
  142. bool mDirty;
  143. };
  144. #endif