PageRenderTime 56ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llpreviewgesture.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 168 lines | 99 code | 32 blank | 37 comment | 0 complexity | a62ffd764d46e3f41ddd2268f3199c24 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llpreviewgesture.h
  3. * @brief Editing UI for inventory-based gestures.
  4. *
  5. * $LicenseInfo:firstyear=2004&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLPREVIEWGESTURE_H
  27. #define LL_LLPREVIEWGESTURE_H
  28. #include "llassettype.h"
  29. #include "llpreview.h"
  30. #include "llmultigesture.h"
  31. class LLLineEditor;
  32. class LLTextBox;
  33. class LLCheckBoxCtrl;
  34. class LLComboBox;
  35. class LLScrollListCtrl;
  36. class LLScrollListItem;
  37. class LLButton;
  38. class LLRadioGroup;
  39. class LLVFS;
  40. class LLPreviewGesture : public LLPreview
  41. {
  42. public:
  43. // Pass an object_id if this gesture is inside an object in the world,
  44. // otherwise use LLUUID::null.
  45. static LLPreviewGesture* show(const LLUUID& item_id, const LLUUID& object_id);
  46. LLPreviewGesture(const LLSD& key);
  47. virtual ~LLPreviewGesture();
  48. // LLView
  49. /*virtual*/ void draw();
  50. /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
  51. /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
  52. EDragAndDropType cargo_type,
  53. void* cargo_data,
  54. EAcceptance* accept,
  55. std::string& tooltip_msg);
  56. // LLPanel
  57. /*virtual*/ BOOL postBuild();
  58. // LLFloater
  59. /*virtual*/ BOOL canClose();
  60. /*virtual*/ void onClose(bool app_quitting);
  61. /*virtual*/ void onUpdateSucceeded();
  62. /*virtual*/ void refresh();
  63. protected:
  64. // Populate various comboboxes
  65. void addModifiers();
  66. void addKeys();
  67. void addAnimations();
  68. void addSounds();
  69. void initDefaultGesture();
  70. void loadAsset();
  71. static void onLoadComplete(LLVFS *vfs,
  72. const LLUUID& asset_uuid,
  73. LLAssetType::EType type,
  74. void* user_data, S32 status, LLExtStat ext_status);
  75. void loadUIFromGesture(LLMultiGesture* gesture);
  76. void saveIfNeeded();
  77. static void onSaveComplete(const LLUUID& asset_uuid,
  78. void* user_data,
  79. S32 status, LLExtStat ext_status);
  80. bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response);
  81. // Write UI back into gesture
  82. LLMultiGesture* createGesture();
  83. // Add a step. Pass the name of the step, like "Animation",
  84. // "Sound", "Chat", or "Wait"
  85. LLScrollListItem* addStep(const enum EStepType step_type);
  86. void onVisibilityChange ( const LLSD& new_visibility );
  87. static std::string getLabel(std::vector<std::string> labels);
  88. static void updateLabel(LLScrollListItem* item);
  89. static void onCommitSetDirty(LLUICtrl* ctrl, void* data);
  90. static void onCommitLibrary(LLUICtrl* ctrl, void* data);
  91. static void onCommitStep(LLUICtrl* ctrl, void* data);
  92. static void onCommitAnimation(LLUICtrl* ctrl, void* data);
  93. static void onCommitSound(LLUICtrl* ctrl, void* data);
  94. static void onCommitChat(LLUICtrl* ctrl, void* data);
  95. static void onCommitWait(LLUICtrl* ctrl, void* data);
  96. static void onCommitWaitTime(LLUICtrl* ctrl, void* data);
  97. static void onCommitAnimationTrigger(LLUICtrl* ctrl, void *data);
  98. // Handy function to commit each keystroke
  99. static void onKeystrokeCommit(LLLineEditor* caller, void* data);
  100. static void onClickAdd(void* data);
  101. static void onClickUp(void* data);
  102. static void onClickDown(void* data);
  103. static void onClickDelete(void* data);
  104. static void onCommitActive(LLUICtrl* ctrl, void* data);
  105. static void onClickSave(void* data);
  106. static void onClickPreview(void* data);
  107. static void onDonePreview(LLMultiGesture* gesture, void* data);
  108. private:
  109. // LLPreview contains mDescEditor
  110. LLLineEditor* mTriggerEditor;
  111. LLTextBox* mReplaceText;
  112. LLLineEditor* mReplaceEditor;
  113. LLComboBox* mModifierCombo;
  114. LLComboBox* mKeyCombo;
  115. LLScrollListCtrl* mLibraryList;
  116. LLButton* mAddBtn;
  117. LLButton* mUpBtn;
  118. LLButton* mDownBtn;
  119. LLButton* mDeleteBtn;
  120. LLScrollListCtrl* mStepList;
  121. // Options panels for items in gesture list
  122. LLTextBox* mOptionsText;
  123. LLRadioGroup* mAnimationRadio;
  124. LLComboBox* mAnimationCombo;
  125. LLComboBox* mSoundCombo;
  126. LLLineEditor* mChatEditor;
  127. LLCheckBoxCtrl* mWaitAnimCheck;
  128. LLCheckBoxCtrl* mWaitTimeCheck;
  129. LLLineEditor* mWaitTimeEditor;
  130. LLCheckBoxCtrl* mActiveCheck;
  131. LLButton* mSaveBtn;
  132. LLButton* mPreviewBtn;
  133. LLMultiGesture* mPreviewGesture;
  134. BOOL mDirty;
  135. };
  136. #endif // LL_LLPREVIEWGESTURE_H