aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/floaterlocalassetbrowse.H
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/floaterlocalassetbrowse.H')
-rw-r--r--linden/indra/newview/floaterlocalassetbrowse.H305
1 files changed, 305 insertions, 0 deletions
diff --git a/linden/indra/newview/floaterlocalassetbrowse.H b/linden/indra/newview/floaterlocalassetbrowse.H
new file mode 100644
index 0000000..6ee1c75
--- /dev/null
+++ b/linden/indra/newview/floaterlocalassetbrowse.H
@@ -0,0 +1,305 @@
1/**
2* @file floaterlocalassetbrowse.h
3* @brief Local texture support
4*
5* $LicenseInfo:firstyear=2009&license=viewergpl$
6*
7* Copyright (c) 2010, author unknown
8*
9* Imprudence Viewer Source Code
10* The source code in this file ("Source Code") is provided to you
11* under the terms of the GNU General Public License, version 2.0
12* ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in
13* this distribution, or online at
14* http://secondlifegrid.net/programs/open_source/licensing/gplv2
15*
16* There are special exceptions to the terms and conditions of the GPL as
17* it is applied to this Source Code. View the full text of the exception
18* in the file doc/FLOSS-exception.txt in this software distribution, or
19* online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
20*
21* By copying, modifying or distributing this software, you acknowledge
22* that you have read and understood your obligations described above,
23* and agree to abide by those obligations.
24*
25* ALL SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO
26* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
27* COMPLETENESS OR PERFORMANCE.
28* $/LicenseInfo$
29*/
30
31/* Local Asset Browser: header
32
33tag: vaa emerald local_asset_browser
34
35*/
36
37
38#ifndef VAA_LOCALBROWSER
39#define VAA_LOCALBROWSER
40
41#include "llfloater.h"
42#include "llscrolllistctrl.h"
43#include "lltexturectrl.h"
44#include "lldrawable.h"
45
46
47/*=======================================*/
48/* Global structs / enums / defines */
49/*=======================================*/
50
51#define LF_FLOATER_EXPAND_WIDTH 735
52#define LF_FLOATER_CONTRACT_WIDTH 415
53#define LF_FLOATER_HEIGHT 260
54
55#define LOCAL_USE_MIPMAPS true
56#define LOCAL_DISCARD_LEVEL 0
57#define NO_IMAGE LLUUID::null
58
59#define TIMER_HEARTBEAT 3.0
60
61#define SLAM_FOR_DEBUG true
62
63enum bitmaplist_cols
64{
65 BITMAPLIST_COL_NAME,
66 BITMAPLIST_COL_ID
67};
68
69/* upload & sculpt update related */
70struct affected_object
71{
72 LLViewerObject* object;
73 std::vector<LLFace*> face_list;
74 bool local_sculptmap;
75
76};
77
78/* texture picker defines */
79
80#define LOCAL_TEXTURE_PICKER_NAME "texture picker"
81#define LOCAL_TEXTURE_PICKER_LIST_NAME "local_name_list"
82#define LOCAL_TEXTURE_PICKER_RECURSE true
83#define LOCAL_TEXTURE_PICKER_CREATEIFMISSING true
84
85
86/*=======================================*/
87/* LocalBitmap: unit class */
88/*=======================================*/
89/*
90 The basic unit class responsible for
91 containing one loaded local texture.
92*/
93
94class LocalBitmap
95{
96 public:
97 LocalBitmap(std::string filename);
98 virtual ~LocalBitmap(void);
99 friend class LocalAssetBrowser;
100
101 public: /* [enums, typedefs, etc] */
102 enum link_status
103 {
104 LINK_UNKNOWN, /* default fallback */
105 LINK_ON,
106 LINK_OFF,
107 LINK_BROKEN,
108 LINK_UPDATING /* currently redundant, but left in case necessary later. */
109 };
110
111 enum extension_type
112 {
113 IMG_EXTEN_BMP,
114 IMG_EXTEN_TGA,
115 IMG_EXTEN_JPG,
116 IMG_EXTEN_PNG
117 };
118
119 enum bitmap_type
120 {
121 TYPE_TEXTURE = 0,
122 TYPE_SCULPT = 1,
123 TYPE_LAYER = 2
124 };
125
126 public: /* [information query functions] */
127 std::string getShortName(void);
128 std::string getFileName(void);
129 LLUUID getID(void);
130 LLSD getLastModified(void);
131 std::string getLinkStatus(void);
132 bool getUpdateBool(void);
133 void setType( S32 );
134 bool getIfValidBool(void);
135 S32 getType(void);
136 void getDebugInfo(void);
137
138 private: /* [maintenence functions] */
139 void updateSelf(void);
140 bool decodeSelf(LLImageRaw* rawimg);
141 void setUpdateBool(void);
142
143 LocalBitmap* getThis(void);
144 std::vector<LLFace*> getFaceUsesThis(LLDrawable*);
145 std::vector<affected_object> getUsingObjects(bool seek_by_type = true,
146 bool seek_textures = false, bool seek_sculptmaps = false);
147
148 protected: /* [basic properties] */
149 std::string shortname;
150 std::string filename;
151 extension_type extension;
152 LLUUID id;
153 LLSD last_modified;
154 link_status linkstatus;
155 bool keep_updating;
156 bool valid;
157 S32 bitmap_type;
158 bool sculpt_dirty;
159 bool volume_dirty;
160};
161
162/*=======================================*/
163/* LocalAssetBrowser: main class */
164/*=======================================*/
165/*
166 Responsible for internal workings.
167 Instantiated at the top of the source file.
168 Sits in memory until the viewer is closed.
169
170*/
171
172
173class LocalAssetBrowser
174{
175 public:
176 LocalAssetBrowser();
177 virtual ~LocalAssetBrowser();
178 friend class FloaterLocalAssetBrowser;
179 friend class LocalAssetBrowserTimer;
180 static void UpdateTextureCtrlList(LLScrollListCtrl*);
181 static void setLayerUpdated(bool toggle) { mLayerUpdated = toggle; }
182 static void setSculptUpdated(bool toggle) { mSculptUpdated = toggle; }
183 static void AddBitmap(void);
184 static void DelBitmap( std::vector<LLScrollListItem*>, S32 column = BITMAPLIST_COL_ID );
185
186 /* UpdateTextureCtrlList was made public cause texturectrl requests it once on spawn
187 ( added: when it's own add/remove funcs are used. )
188 i've made it update on spawn instead of on pressing 'local' because the former does it once,
189 the latter - each time the button's pressed. */
190
191 private:
192 static void onChangeHappened(void);
193 static void onUpdateBool(LLUUID);
194 static void onSetType(LLUUID, S32);
195 static LocalBitmap* GetBitmapUnit(LLUUID);
196 static bool IsDoingUpdates(void);
197 static void PingTimer(void);
198 static void PerformTimedActions(void);
199 static void PerformSculptUpdates(LocalBitmap*);
200
201 protected:
202 static std::vector<LocalBitmap*> loaded_bitmaps;
203 typedef std::vector<LocalBitmap*>::iterator local_list_iter;
204 static bool mLayerUpdated;
205 static bool mSculptUpdated;
206};
207
208/*==================================================*/
209/* FloaterLocalAssetBrowser : interface class */
210/*==================================================*/
211/*
212 Responsible for talking to the user.
213 Instantiated by user request.
214 Destroyed when the floater is closed.
215
216*/
217class FloaterLocalAssetBrowser : public LLFloater
218{
219public:
220 FloaterLocalAssetBrowser();
221 virtual ~FloaterLocalAssetBrowser();
222 static void show(void*);
223
224
225
226private:
227 /* Widget related callbacks */
228 // Button callback declarations
229 static void onClickAdd(void* userdata);
230 static void onClickDel(void* userdata);
231 static void onClickMore(void* userdata);
232 static void onClickLess(void* userdata);
233 static void onClickUpload(void* userdata);
234
235 // ScrollList callback declarations
236 static void onChooseBitmapList(LLUICtrl* ctrl, void* userdata);
237
238 // Checkbox callback declarations
239 static void onClickUpdateChkbox(LLUICtrl* ctrl, void* userdata);
240
241 // Combobox type select
242 static void onCommitTypeCombo(LLUICtrl* ctrl, void* userdata);
243
244 // Widgets
245 LLButton* mAddBtn;
246 LLButton* mDelBtn;
247 LLButton* mMoreBtn;
248 LLButton* mLessBtn;
249 LLButton* mUploadBtn;
250
251 LLScrollListCtrl* mBitmapList;
252 LLScrollListCtrl* mUsedList;
253 LLTextureCtrl* mTextureView;
254 LLCheckBoxCtrl* mUpdateChkBox;
255
256 LLLineEditor* mPathTxt;
257 LLLineEditor* mUUIDTxt;
258 LLLineEditor* mNameTxt;
259
260 LLTextBox* mLinkTxt;
261 LLTextBox* mTimeTxt;
262 LLComboBox* mTypeComboBox;
263
264 LLTextBox* mCaptionPathTxt;
265 LLTextBox* mCaptionUUIDTxt;
266 LLTextBox* mCaptionLinkTxt;
267 LLTextBox* mCaptionNameTxt;
268 LLTextBox* mCaptionTimeTxt;
269
270 /* static pointer to self, wai? oh well. */
271 static FloaterLocalAssetBrowser* sLFInstance;
272
273 // non-widget functions
274 static void FloaterResize(bool expand);
275 static void UpdateRightSide(void);
276
277public:
278 static void UpdateBitmapScrollList(void);
279
280
281};
282
283/*==================================================*/
284/* LocalAssetBrowserTimer : timer class */
285/*==================================================*/
286/*
287 A small, simple timer class inheriting from
288 LLEventTimer, responsible for pinging the
289 LocalAssetBrowser class to perform it's
290 updates / checks / etc.
291
292*/
293class LocalAssetBrowserTimer : public LLEventTimer
294{
295 public:
296 LocalAssetBrowserTimer();
297 ~LocalAssetBrowserTimer();
298 virtual BOOL tick();
299 void start();
300 void stop();
301 bool isRunning();
302};
303
304#endif
305