PageRenderTime 442ms CodeModel.GetById 101ms app.highlight 112ms RepoModel.GetById 163ms app.codeStats 1ms

/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
  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
 27#ifndef LL_LLPREVIEWGESTURE_H
 28#define LL_LLPREVIEWGESTURE_H
 29
 30#include "llassettype.h"
 31#include "llpreview.h"
 32#include "llmultigesture.h"
 33
 34class LLLineEditor;
 35class LLTextBox;
 36class LLCheckBoxCtrl;
 37class LLComboBox;
 38class LLScrollListCtrl;
 39class LLScrollListItem;
 40class LLButton;
 41class LLRadioGroup;
 42class LLVFS;
 43
 44class LLPreviewGesture : public LLPreview
 45{
 46public:
 47	// Pass an object_id if this gesture is inside an object in the world,
 48	// otherwise use LLUUID::null.
 49	static LLPreviewGesture* show(const LLUUID& item_id, const LLUUID& object_id);
 50
 51	LLPreviewGesture(const LLSD& key);
 52	virtual ~LLPreviewGesture();
 53
 54	// LLView
 55	/*virtual*/ void draw();
 56	/*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
 57	/*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 58									 EDragAndDropType cargo_type,
 59									 void* cargo_data,
 60									 EAcceptance* accept,
 61									 std::string& tooltip_msg);
 62
 63	// LLPanel
 64	/*virtual*/ BOOL postBuild();
 65
 66	// LLFloater
 67	/*virtual*/ BOOL canClose();
 68	/*virtual*/ void onClose(bool app_quitting);
 69	/*virtual*/ void onUpdateSucceeded();
 70	/*virtual*/ void refresh();
 71
 72protected:
 73	// Populate various comboboxes
 74	void addModifiers();
 75	void addKeys();
 76	void addAnimations();
 77	void addSounds();
 78
 79	void initDefaultGesture();
 80
 81	void loadAsset();
 82
 83	static void onLoadComplete(LLVFS *vfs,
 84							   const LLUUID& asset_uuid,
 85							   LLAssetType::EType type,
 86							   void* user_data, S32 status, LLExtStat ext_status);
 87
 88	void loadUIFromGesture(LLMultiGesture* gesture);
 89
 90	void saveIfNeeded();
 91
 92	static void onSaveComplete(const LLUUID& asset_uuid,
 93							   void* user_data,
 94							   S32 status, LLExtStat ext_status);
 95
 96	bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response);
 97
 98	// Write UI back into gesture
 99	LLMultiGesture* createGesture();
100
101	// Add a step.  Pass the name of the step, like "Animation",
102	// "Sound", "Chat", or "Wait"
103	LLScrollListItem* addStep(const enum EStepType step_type);
104	
105	void onVisibilityChange ( const LLSD& new_visibility );
106	
107	static std::string getLabel(std::vector<std::string> labels);
108	static void updateLabel(LLScrollListItem* item);
109
110	static void onCommitSetDirty(LLUICtrl* ctrl, void* data);
111	static void onCommitLibrary(LLUICtrl* ctrl, void* data);
112	static void onCommitStep(LLUICtrl* ctrl, void* data);
113	static void onCommitAnimation(LLUICtrl* ctrl, void* data);
114	static void onCommitSound(LLUICtrl* ctrl, void* data);
115	static void onCommitChat(LLUICtrl* ctrl, void* data);
116	static void onCommitWait(LLUICtrl* ctrl, void* data);
117	static void onCommitWaitTime(LLUICtrl* ctrl, void* data);
118
119	static void onCommitAnimationTrigger(LLUICtrl* ctrl, void *data);
120
121	// Handy function to commit each keystroke
122	static void onKeystrokeCommit(LLLineEditor* caller, void* data);
123
124	static void onClickAdd(void* data);
125	static void onClickUp(void* data);
126	static void onClickDown(void* data);
127	static void onClickDelete(void* data);
128
129	static void onCommitActive(LLUICtrl* ctrl, void* data);
130	static void onClickSave(void* data);
131	static void onClickPreview(void* data);
132
133	static void onDonePreview(LLMultiGesture* gesture, void* data);
134
135private:
136	// LLPreview contains mDescEditor
137	LLLineEditor*	mTriggerEditor;
138	LLTextBox*		mReplaceText;
139	LLLineEditor*	mReplaceEditor;
140	LLComboBox*		mModifierCombo;
141	LLComboBox*		mKeyCombo;
142
143	LLScrollListCtrl*	mLibraryList;
144	LLButton*			mAddBtn;
145	LLButton*			mUpBtn;
146	LLButton*			mDownBtn;
147	LLButton*			mDeleteBtn;
148	LLScrollListCtrl*	mStepList;
149
150	// Options panels for items in gesture list
151	LLTextBox*			mOptionsText;
152	LLRadioGroup*		mAnimationRadio;
153	LLComboBox*			mAnimationCombo;
154	LLComboBox*			mSoundCombo;
155	LLLineEditor*		mChatEditor;
156	LLCheckBoxCtrl*		mWaitAnimCheck;
157	LLCheckBoxCtrl*		mWaitTimeCheck;
158	LLLineEditor*		mWaitTimeEditor;
159
160	LLCheckBoxCtrl*		mActiveCheck;
161	LLButton*			mSaveBtn;
162	LLButton*			mPreviewBtn;
163
164	LLMultiGesture*		mPreviewGesture;
165	BOOL mDirty;
166};
167
168#endif // LL_LLPREVIEWGESTURE_H