PageRenderTime 27ms CodeModel.GetById 10ms app.highlight 12ms RepoModel.GetById 2ms app.codeStats 0ms

/indra/newview/llpreviewtexture.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 99 lines | 56 code | 15 blank | 28 comment | 0 complexity | 4aff7edad1470c56071890d05e13061a MD5 | raw file
 1/** 
 2 * @file llpreviewtexture.h
 3 * @brief LLPreviewTexture class definition
 4 *
 5 * $LicenseInfo:firstyear=2002&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_LLPREVIEWTEXTURE_H
28#define LL_LLPREVIEWTEXTURE_H
29
30#include "llpreview.h"
31#include "llbutton.h"
32#include "llframetimer.h"
33#include "llviewertexture.h"
34
35class LLComboBox;
36class LLImageRaw;
37
38class LLPreviewTexture : public LLPreview
39{
40public:
41	LLPreviewTexture(const LLSD& key);
42	~LLPreviewTexture();
43
44	virtual void		draw();
45
46	virtual BOOL		canSaveAs() const;
47	virtual void		saveAs();
48
49	virtual void		loadAsset();
50	virtual EAssetStatus	getAssetStatus();
51	
52	virtual void		reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
53	virtual void 		onFocusReceived();
54	
55	static void			onFileLoadedForSave( 
56							BOOL success,
57							LLViewerFetchedTexture *src_vi,
58							LLImageRaw* src, 
59							LLImageRaw* aux_src,
60							S32 discard_level, 
61							BOOL final,
62							void* userdata );
63	void 				openToSave();
64	
65	static void			onSaveAsBtn(void* data);
66
67	/*virtual*/ void setObjectID(const LLUUID& object_id);
68protected:
69	void				init();
70	/* virtual */ BOOL	postBuild();
71	bool				setAspectRatio(const F32 width, const F32 height);
72	static void			onAspectRatioCommit(LLUICtrl*,void* userdata);
73	
74private:
75	void				updateImageID(); // set what image is being uploaded.
76	void				updateDimensions();
77	LLUUID				mImageID;
78	LLPointer<LLViewerFetchedTexture>		mImage;
79	S32                 mImageOldBoostLevel;
80	std::string			mSaveFileName;
81	LLFrameTimer		mSavedFileTimer;
82	BOOL				mLoadingFullImage;
83	BOOL                mShowKeepDiscard;
84	BOOL                mCopyToInv;
85
86	// Save the image once it's loaded.
87	BOOL                mPreviewToSave;
88
89	// This is stored off in a member variable, because the save-as
90	// button and drag and drop functionality need to know.
91	BOOL mIsCopyable;
92	BOOL mUpdateDimensions;
93	S32 mLastHeight;
94	S32 mLastWidth;
95	F32 mAspectRatio;	
96
97	LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList ; 
98};
99#endif  // LL_LLPREVIEWTEXTURE_H