diff options
author | McCabe Maxsted | 2009-09-06 23:08:02 -0700 |
---|---|---|
committer | McCabe Maxsted | 2009-09-06 23:08:02 -0700 |
commit | 4bbb219eb78fc5d77c86fb7b13f123b52fbef3bc (patch) | |
tree | 88da6f4312c01dc07938166f58b913425a76583a /linden/indra/newview | |
parent | Added Emerald viewer's animation list (diff) | |
download | meta-impy-4bbb219eb78fc5d77c86fb7b13f123b52fbef3bc.zip meta-impy-4bbb219eb78fc5d77c86fb7b13f123b52fbef3bc.tar.gz meta-impy-4bbb219eb78fc5d77c86fb7b13f123b52fbef3bc.tar.bz2 meta-impy-4bbb219eb78fc5d77c86fb7b13f123b52fbef3bc.tar.xz |
Added Emerald viewer's asset browser
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/CMakeLists.txt | 3 | ||||
-rw-r--r-- | linden/indra/newview/llfloaterassetbrowser.cpp | 466 | ||||
-rw-r--r-- | linden/indra/newview/llfloaterassetbrowser.h | 84 | ||||
-rw-r--r-- | linden/indra/newview/llviewermenu.cpp | 43 | ||||
-rw-r--r-- | linden/indra/newview/skins/default/xui/en-us/floater_asset_browser.xml | 29 | ||||
-rw-r--r-- | linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml | 5 |
6 files changed, 627 insertions, 3 deletions
diff --git a/linden/indra/newview/CMakeLists.txt b/linden/indra/newview/CMakeLists.txt index 5a83624..ad044a9 100644 --- a/linden/indra/newview/CMakeLists.txt +++ b/linden/indra/newview/CMakeLists.txt | |||
@@ -122,6 +122,7 @@ set(viewer_SOURCE_FILES | |||
122 | llfloaterabout.cpp | 122 | llfloaterabout.cpp |
123 | llfloateractivespeakers.cpp | 123 | llfloateractivespeakers.cpp |
124 | llfloateranimpreview.cpp | 124 | llfloateranimpreview.cpp |
125 | llfloaterassetbrowser.cpp | ||
125 | llfloaterauction.cpp | 126 | llfloaterauction.cpp |
126 | llfloateravatarinfo.cpp | 127 | llfloateravatarinfo.cpp |
127 | llfloateravatarpicker.cpp | 128 | llfloateravatarpicker.cpp |
@@ -518,6 +519,7 @@ set(viewer_HEADER_FILES | |||
518 | llfloaterabout.h | 519 | llfloaterabout.h |
519 | llfloateractivespeakers.h | 520 | llfloateractivespeakers.h |
520 | llfloateranimpreview.h | 521 | llfloateranimpreview.h |
522 | llfloaterassetbrowser.h | ||
521 | llfloaterauction.h | 523 | llfloaterauction.h |
522 | llfloateravatarinfo.h | 524 | llfloateravatarinfo.h |
523 | llfloateravatarpicker.h | 525 | llfloateravatarpicker.h |
@@ -1027,6 +1029,7 @@ set(viewer_XUI_FILES | |||
1027 | skins/default/xui/en-us/floater_active_speakers.xml | 1029 | skins/default/xui/en-us/floater_active_speakers.xml |
1028 | skins/default/xui/en-us/floater_animation_list.xml | 1030 | skins/default/xui/en-us/floater_animation_list.xml |
1029 | skins/default/xui/en-us/floater_animation_preview.xml | 1031 | skins/default/xui/en-us/floater_animation_preview.xml |
1032 | skins/default/xui/en-us/floater_asset_browser.xml | ||
1030 | skins/default/xui/en-us/floater_auction.xml | 1033 | skins/default/xui/en-us/floater_auction.xml |
1031 | skins/default/xui/en-us/floater_audio_volume.xml | 1034 | skins/default/xui/en-us/floater_audio_volume.xml |
1032 | skins/default/xui/en-us/floater_avatar_picker.xml | 1035 | skins/default/xui/en-us/floater_avatar_picker.xml |
diff --git a/linden/indra/newview/llfloaterassetbrowser.cpp b/linden/indra/newview/llfloaterassetbrowser.cpp new file mode 100644 index 0000000..615d21a --- /dev/null +++ b/linden/indra/newview/llfloaterassetbrowser.cpp | |||
@@ -0,0 +1,466 @@ | |||
1 | /** | ||
2 | * @file llfloaterassetbrowser.cpp | ||
3 | * @brief LLFloaterAssetBrowser class implementation | ||
4 | * Phox wuz hurr | ||
5 | */ | ||
6 | |||
7 | #include "llviewerprecompiledheaders.h" | ||
8 | #include "llfloaterassetbrowser.h" | ||
9 | #include "llinventoryview.h" | ||
10 | #include "llinventorymodel.h" | ||
11 | #include "llviewerimagelist.h" | ||
12 | #include "llbutton.h" | ||
13 | #include "lltextbox.h" | ||
14 | #include "llpreview.h" | ||
15 | #include "llinventorybridge.h" | ||
16 | #include "llagent.h" | ||
17 | #include "lltooldraganddrop.h" | ||
18 | #include "llfocusmgr.h" | ||
19 | #include "llview.h" | ||
20 | |||
21 | // Externs | ||
22 | extern LLInventoryModel gInventory; | ||
23 | |||
24 | // Statics | ||
25 | LLFloaterAssetBrowser* LLFloaterAssetBrowser::sInstance = NULL; | ||
26 | |||
27 | LLFloaterAssetBrowser::LLFloaterAssetBrowser() | ||
28 | : LLFloater("floater_asset_browser") | ||
29 | { | ||
30 | LLUICtrlFactory::getInstance()->buildFloater(this, "floater_asset_browser.xml"); | ||
31 | |||
32 | mInventoryPanel = getChild<LLInventoryPanel>("inventory panel"); | ||
33 | |||
34 | //Open all folders and close them in order to make item list up-to-date | ||
35 | //if(gInventory.getItemCount()==0) | ||
36 | mInventoryPanel->openAllFolders(); | ||
37 | |||
38 | //gInventory.startBackgroundFetch(gInventory.findCategoryUUIDForType(LLAssetType::AT_TEXTURE)); | ||
39 | |||
40 | |||
41 | childSetAction("button next", onClickNext, this); | ||
42 | childSetAction("button previous", onClickPrevious, this); | ||
43 | childSetAction("button refresh", onClickRefresh, this); | ||
44 | |||
45 | initialize(); | ||
46 | createThumbnails(); | ||
47 | mInventoryPanel->closeAllFolders(); | ||
48 | } | ||
49 | |||
50 | // static | ||
51 | void LLFloaterAssetBrowser::show(void*) | ||
52 | { | ||
53 | if (!sInstance) | ||
54 | sInstance = new LLFloaterAssetBrowser(); | ||
55 | |||
56 | sInstance->open(); | ||
57 | } | ||
58 | |||
59 | // virtual | ||
60 | LLFloaterAssetBrowser::~LLFloaterAssetBrowser() | ||
61 | { | ||
62 | clearAssetInfoTexts(); | ||
63 | mTextureAssets.clear(); | ||
64 | mMaxIndex = 0; | ||
65 | mFirstIndex = 0; | ||
66 | mMouseOverIndex = 0; | ||
67 | mMouseOverUUID = LLUUID::null; | ||
68 | mMouseOverAssetUUID = LLUUID::null; | ||
69 | mFloaterTitle = ""; | ||
70 | clearNoAssetsText(); | ||
71 | sInstance=NULL; | ||
72 | } | ||
73 | |||
74 | void LLFloaterAssetBrowser::initialize() | ||
75 | { | ||
76 | mMaxIndex = ITEMS_PER_PAGE; | ||
77 | mFirstIndex = 0; | ||
78 | mAssetInfoLabelList.clear(); | ||
79 | mAssetInfoIndex = 0; | ||
80 | mFloaterHeight = getRect().getHeight(); | ||
81 | mFloaterWidth = getRect().getWidth(); | ||
82 | mMouseOverIndex = 0; | ||
83 | mMouseOverUUID = LLUUID::null; | ||
84 | mMouseOverAssetUUID = LLUUID::null; | ||
85 | mFloaterTitle = ""; | ||
86 | |||
87 | S32 image_top = getRect().getHeight(); | ||
88 | S32 image_bottom = BTN_HEIGHT_SMALL; | ||
89 | S32 image_middle = (image_top + image_bottom) / 2; | ||
90 | S32 line_height = llround(LLFontGL::sSansSerifSmall->getLineHeight()); | ||
91 | |||
92 | mNoAssetsLabel = new LLTextBox("mNoAssetsLabel.", | ||
93 | LLRect(getRect().getWidth()/2, | ||
94 | image_middle + line_height / 2, | ||
95 | getRect().getWidth(), | ||
96 | image_middle - line_height / 2 ), | ||
97 | "No assets found.", | ||
98 | LLFontGL::sSansSerifSmall ); | ||
99 | mNoAssetsLabel->setFollowsAll(); | ||
100 | addChild(mNoAssetsLabel); | ||
101 | mNoAssetsLabel->setVisible(FALSE); | ||
102 | } | ||
103 | |||
104 | void LLFloaterAssetBrowser::createThumbnails() | ||
105 | { | ||
106 | LLViewerInventoryCategory::cat_array_t cats; | ||
107 | LLViewerInventoryItem::item_array_t items; | ||
108 | LLIsType isType(LLAssetType::AT_TEXTURE); | ||
109 | |||
110 | gInventory.collectDescendentsIf(LLUUID::null, | ||
111 | cats, | ||
112 | items, | ||
113 | LLInventoryModel::INCLUDE_TRASH, | ||
114 | isType); | ||
115 | |||
116 | //Get UUID, asset UUID and name | ||
117 | for(S32 i = 0; i < items.count(); i++) | ||
118 | { | ||
119 | LLInventoryItem* itemp = items[i]; | ||
120 | LLAssetSelection temp; | ||
121 | temp.mAssetUUID = itemp->getAssetUUID(); | ||
122 | temp.mUUID = itemp->getUUID(); | ||
123 | temp.mName = itemp->getName(); | ||
124 | temp.mTexturep = NULL; | ||
125 | temp.mAssetRect = LLRect::null; | ||
126 | mTextureAssets.push_back(temp); | ||
127 | } | ||
128 | |||
129 | //Get Texturep | ||
130 | for(S32 i = 0; i < items.count(); i++) | ||
131 | { | ||
132 | mTextureAssets[i].mTexturep = gImageList.getImage(mTextureAssets[i].mAssetUUID, MIPMAP_YES, IMMEDIATE_NO); | ||
133 | mTextureAssets[i].mTexturep->setBoostLevel(LLViewerImage::BOOST_PREVIEW); | ||
134 | //mTextureAssets[i].mTexturep->processTextureStats(); | ||
135 | } | ||
136 | |||
137 | //Generate the asset info text | ||
138 | /*for(S32 i = 0; i < items.count(); i++) | ||
139 | { | ||
140 | LLString asset_info; | ||
141 | LLString dimensions; | ||
142 | |||
143 | asset_info.append(mTextureAssets[i].mName); | ||
144 | |||
145 | //if(mTextureAssets[i].mTexturep->mFullWidth == 0 | ||
146 | //|| mTextureAssets[i].mTexturep->mFullHeight == 0) | ||
147 | |||
148 | dimensions = llformat("\n%d x %d", | ||
149 | mTextureAssets[i].mTexturep->mFullWidth, | ||
150 | mTextureAssets[i].mTexturep->mFullHeight); | ||
151 | asset_info.append(dimensions); | ||
152 | |||
153 | mTextureAssets[i].mAssetInfo = asset_info; | ||
154 | }*/ | ||
155 | |||
156 | mFloaterTitle = llformat("Asset Browser (%d assets fetched)", mTextureAssets.size()); | ||
157 | setTitle(mFloaterTitle); | ||
158 | } | ||
159 | |||
160 | // virtual | ||
161 | BOOL LLFloaterAssetBrowser::handleHover(S32 x, S32 y, MASK mask) | ||
162 | { | ||
163 | if(mTextureAssets.size() > 0) | ||
164 | { | ||
165 | for(U32 i = mFirstIndex; i < mMaxIndex; i++) | ||
166 | { | ||
167 | if(i < mTextureAssets.size()) | ||
168 | { | ||
169 | if(mTextureAssets[i].mAssetRect.pointInRect(x,y)) | ||
170 | { | ||
171 | mMouseOverUUID = mTextureAssets[i].mUUID; | ||
172 | mMouseOverIndex = i; | ||
173 | |||
174 | if(hasMouseCapture()) | ||
175 | { | ||
176 | S32 screen_x; | ||
177 | S32 screen_y; | ||
178 | LLUUID mObjectUUID= LLUUID::null; | ||
179 | const LLViewerInventoryItem *item = gInventory.getItem(mMouseOverUUID); | ||
180 | |||
181 | localPointToScreen(x, y, &screen_x, &screen_y ); | ||
182 | |||
183 | if(item && item->getPermissions().allowCopyBy(gAgent.getID(), gAgent.getGroupID()) | ||
184 | && LLToolDragAndDrop::getInstance()->isOverThreshold(screen_x, screen_y)) | ||
185 | { | ||
186 | EDragAndDropType type; | ||
187 | type = LLAssetType::lookupDragAndDropType(item->getType()); | ||
188 | LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_LIBRARY; | ||
189 | |||
190 | if(!mObjectUUID.isNull()) | ||
191 | { | ||
192 | src = LLToolDragAndDrop::SOURCE_WORLD; | ||
193 | } | ||
194 | else if(item->getPermissions().getOwner() == gAgent.getID()) | ||
195 | { | ||
196 | src = LLToolDragAndDrop::SOURCE_AGENT; | ||
197 | } | ||
198 | LLToolDragAndDrop::getInstance()->beginDrag(type, | ||
199 | item->getUUID(), | ||
200 | src, | ||
201 | mObjectUUID); | ||
202 | return LLToolDragAndDrop::getInstance()->handleHover(x, y, mask); | ||
203 | } | ||
204 | return TRUE; | ||
205 | } | ||
206 | return LLFloater::handleHover(x, y, mask); | ||
207 | } | ||
208 | } | ||
209 | } | ||
210 | return LLFloater::handleHover(x, y, mask); | ||
211 | } | ||
212 | else | ||
213 | { | ||
214 | mMouseOverUUID = LLUUID::null; | ||
215 | return LLFloater::handleHover(x, y, mask); | ||
216 | } | ||
217 | } | ||
218 | |||
219 | // virtual | ||
220 | BOOL LLFloaterAssetBrowser::handleMouseDown(S32 x, S32 y, MASK mask) | ||
221 | { | ||
222 | if(mTextureAssets.size() > 0) | ||
223 | { | ||
224 | if(mTextureAssets[mMouseOverIndex].mAssetRect.pointInRect(x,y)) | ||
225 | { | ||
226 | if(mMouseOverUUID.notNull()) | ||
227 | { | ||
228 | gFocusMgr.setMouseCapture(this); | ||
229 | S32 screen_x; | ||
230 | S32 screen_y; | ||
231 | localPointToScreen(x, y, &screen_x, &screen_y); | ||
232 | LLToolDragAndDrop::getInstance()->setDragStart(screen_x, screen_y); | ||
233 | return TRUE; | ||
234 | } | ||
235 | } | ||
236 | } | ||
237 | return LLFloater::handleMouseDown(x, y, mask); | ||
238 | } | ||
239 | |||
240 | // virtual | ||
241 | BOOL LLFloaterAssetBrowser::handleMouseUp(S32 x, S32 y, MASK mask) | ||
242 | { | ||
243 | if(hasMouseCapture()) | ||
244 | { | ||
245 | gFocusMgr.setMouseCapture(NULL); | ||
246 | return TRUE; | ||
247 | } | ||
248 | return LLFloater::handleMouseUp(x, y, mask); | ||
249 | } | ||
250 | |||
251 | // virtual | ||
252 | BOOL LLFloaterAssetBrowser::handleDoubleClick(S32 x, S32 y, MASK mask) | ||
253 | { | ||
254 | if(mTextureAssets.size() > 0) | ||
255 | { | ||
256 | if(mTextureAssets[mMouseOverIndex].mAssetRect.pointInRect(x,y)) | ||
257 | { | ||
258 | if(mMouseOverUUID.notNull()) | ||
259 | { | ||
260 | open_texture(mMouseOverUUID, mTextureAssets[mMouseOverIndex].mName, FALSE); | ||
261 | return TRUE; | ||
262 | } | ||
263 | } | ||
264 | } | ||
265 | return LLFloater::handleDoubleClick(x, y, mask); | ||
266 | } | ||
267 | |||
268 | // virtual | ||
269 | void LLFloaterAssetBrowser::draw() | ||
270 | { | ||
271 | LLFloater::draw(); | ||
272 | |||
273 | if(mTextureAssets.size() > 0) | ||
274 | { | ||
275 | S32 hor_pos = 0; | ||
276 | S32 ver_pos = 0; | ||
277 | U32 items_per_row = 0; | ||
278 | S32 height = getRect().getHeight()/8; | ||
279 | S32 width = height; | ||
280 | |||
281 | for(U32 i = mFirstIndex; i < mMaxIndex; i++) | ||
282 | { | ||
283 | if(i < mTextureAssets.size()) | ||
284 | { | ||
285 | mTexturep = NULL; | ||
286 | mImageAssetID = mTextureAssets[i].mAssetUUID; | ||
287 | |||
288 | if(mImageAssetID.notNull()) | ||
289 | { | ||
290 | mTexturep = gImageList.getImage(mImageAssetID, MIPMAP_YES, IMMEDIATE_NO); | ||
291 | //mTexturep->setBoostLevel(LLViewerImage::BOOST_PREVIEW); | ||
292 | mTexturep->processTextureStats(); | ||
293 | mTextureAssets[i].mWidth = mTexturep->mFullWidth; | ||
294 | mTextureAssets[i].mHeight = mTexturep->mFullHeight; | ||
295 | } | ||
296 | |||
297 | if(isMinimized()) | ||
298 | { | ||
299 | return; | ||
300 | } | ||
301 | |||
302 | //Border | ||
303 | LLRect border; | ||
304 | border.mLeft = START_POS + ver_pos; | ||
305 | border.mTop = getRect().getHeight() - LLFLOATER_HEADER_SIZE - BORDER_PAD - hor_pos; | ||
306 | border.mRight = border.mLeft + width; | ||
307 | border.mBottom = border.mTop - height; | ||
308 | |||
309 | //Save the rect for each thumbnail | ||
310 | mTextureAssets[i].mAssetRect = border; | ||
311 | |||
312 | //Asset info rect | ||
313 | LLRect info_rect; | ||
314 | info_rect.mLeft = border.mLeft; | ||
315 | info_rect.mTop = border.mBottom - 3; | ||
316 | info_rect.mRight = border.mLeft + 130; | ||
317 | info_rect.mBottom = border.mBottom - 2*llround(LLFontGL::sSansSerifSmall->getLineHeight()); | ||
318 | |||
319 | gl_rect_2d(border, LLColor4::black, FALSE); | ||
320 | |||
321 | // Interior | ||
322 | LLRect interior = border; | ||
323 | interior.stretch(1); | ||
324 | |||
325 | //Draw the image | ||
326 | if(mTexturep) | ||
327 | { | ||
328 | if(mTexturep->getComponents() == 4) | ||
329 | { | ||
330 | gl_rect_2d_checkerboard(interior); | ||
331 | } | ||
332 | |||
333 | gl_draw_scaled_image(interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep); | ||
334 | // Pump the priority | ||
335 | mTexturep->addTextureStats((F32)(interior.getWidth() * interior.getHeight())); | ||
336 | |||
337 | //Generate the asset info text | ||
338 | std::string asset_info; | ||
339 | asset_info.append(mTextureAssets[i].mName); | ||
340 | std::string dimensions = llformat("\n%d x %d", | ||
341 | mTexturep->mFullWidth /*mTextureAssets[i].mWidth*/, | ||
342 | mTexturep->mFullHeight /* mTextureAssets[i].mHeight*/); | ||
343 | asset_info.append(dimensions); | ||
344 | |||
345 | // Draw material info below the asset | ||
346 | // LLTextBox object has to be drawn only once, not non-stop like image | ||
347 | if(mAssetInfoIndex < ITEMS_PER_PAGE && | ||
348 | mAssetInfoIndex < mTextureAssets.size() - mFirstIndex) | ||
349 | { | ||
350 | mAssetInfoLabel = new LLTextBox("Asset Info"/*mTextureAssets[i].mAssetInfo*/, | ||
351 | info_rect, | ||
352 | asset_info, | ||
353 | LLFontGL::sSansSerifSmall); | ||
354 | mAssetInfoLabel->setFollowsAll(); | ||
355 | mAssetInfoLabelList.push_back(mAssetInfoLabel); | ||
356 | addChild(mAssetInfoLabelList[mAssetInfoIndex]); | ||
357 | mAssetInfoLabelList[mAssetInfoIndex]->setVisible(TRUE); | ||
358 | mAssetInfoIndex++; | ||
359 | } | ||
360 | |||
361 | } | ||
362 | else | ||
363 | { | ||
364 | // Draw X | ||
365 | gl_rect_2d(interior, LLColor4::grey, TRUE); | ||
366 | gl_draw_x(interior, LLColor4::black); | ||
367 | } | ||
368 | //Move to the right | ||
369 | ver_pos += getRect().getWidth()/6; | ||
370 | items_per_row++; | ||
371 | |||
372 | //Change the row | ||
373 | if(items_per_row % 4 == 0) | ||
374 | { | ||
375 | ver_pos = 0; | ||
376 | hor_pos += getRect().getHeight()/4; | ||
377 | } | ||
378 | } | ||
379 | }//for | ||
380 | |||
381 | //If the size of the floater has changed, clear the asset info texts | ||
382 | //in order to draw them again into the new position | ||
383 | if(getRect().getWidth() != mFloaterWidth || getRect().getHeight() != mFloaterHeight) | ||
384 | { | ||
385 | clearAssetInfoTexts(); | ||
386 | //Save the size of the current floater | ||
387 | mFloaterWidth = getRect().getWidth(); | ||
388 | mFloaterHeight = getRect().getHeight(); | ||
389 | } | ||
390 | if(mMaxIndex >= mTextureAssets.size()) | ||
391 | { | ||
392 | childDisable("button next"); | ||
393 | childEnable("button previous"); | ||
394 | } | ||
395 | else if(mFirstIndex <= 0) | ||
396 | { | ||
397 | childEnable("button next"); | ||
398 | childDisable("button previous"); | ||
399 | } | ||
400 | else | ||
401 | { | ||
402 | childEnable("button next"); | ||
403 | childEnable("button previous"); | ||
404 | } | ||
405 | } | ||
406 | else | ||
407 | { | ||
408 | //No assets found | ||
409 | mNoAssetsLabel->setVisible(TRUE); | ||
410 | childDisable("button next"); | ||
411 | childDisable("button previous"); | ||
412 | } | ||
413 | } | ||
414 | |||
415 | void LLFloaterAssetBrowser::clearAssetInfoTexts() | ||
416 | { | ||
417 | for(U32 i = 0; i < mAssetInfoLabelList.size(); i++) | ||
418 | { | ||
419 | delete mAssetInfoLabelList[i]; | ||
420 | mAssetInfoLabelList[i] = NULL; | ||
421 | } | ||
422 | mAssetInfoLabelList.clear(); | ||
423 | mAssetInfoIndex = 0; | ||
424 | } | ||
425 | |||
426 | void LLFloaterAssetBrowser::clearNoAssetsText() | ||
427 | { | ||
428 | if(mTextureAssets.size() > 0) | ||
429 | { | ||
430 | delete mNoAssetsLabel; | ||
431 | mNoAssetsLabel = NULL; | ||
432 | } | ||
433 | } | ||
434 | |||
435 | // static | ||
436 | void LLFloaterAssetBrowser::onClickNext(void *userdata) | ||
437 | { | ||
438 | LLFloaterAssetBrowser* self = (LLFloaterAssetBrowser*)userdata; | ||
439 | self->mFirstIndex = self->mMaxIndex; | ||
440 | self->mMaxIndex = self->mFirstIndex + ITEMS_PER_PAGE; | ||
441 | self->clearAssetInfoTexts(); | ||
442 | } | ||
443 | |||
444 | // static | ||
445 | void LLFloaterAssetBrowser::onClickPrevious(void *userdata) | ||
446 | { | ||
447 | LLFloaterAssetBrowser* self = (LLFloaterAssetBrowser*)userdata; | ||
448 | self->mFirstIndex = self->mMaxIndex - (2 * ITEMS_PER_PAGE); | ||
449 | self->mMaxIndex = self->mMaxIndex - ITEMS_PER_PAGE; | ||
450 | self->clearAssetInfoTexts(); | ||
451 | } | ||
452 | |||
453 | // static | ||
454 | void LLFloaterAssetBrowser::onClickRefresh(void *userdata) | ||
455 | { | ||
456 | LLFloaterAssetBrowser* self = (LLFloaterAssetBrowser*)userdata; | ||
457 | for(U32 i = 0; i < self->mTextureAssets.size(); i++) | ||
458 | { | ||
459 | self->mTextureAssets[i].mTexturep = NULL; | ||
460 | } | ||
461 | |||
462 | self->mTextureAssets.clear(); | ||
463 | self->createThumbnails(); | ||
464 | self->clearNoAssetsText(); | ||
465 | self->clearAssetInfoTexts(); | ||
466 | } | ||
diff --git a/linden/indra/newview/llfloaterassetbrowser.h b/linden/indra/newview/llfloaterassetbrowser.h new file mode 100644 index 0000000..76eb3ba --- /dev/null +++ b/linden/indra/newview/llfloaterassetbrowser.h | |||
@@ -0,0 +1,84 @@ | |||
1 | /** | ||
2 | * @file llfloaterassetbrowser.h | ||
3 | * @brief LLFloaterAssetBrowser class implementation | ||
4 | * Phox wuz hurr | ||
5 | */ | ||
6 | |||
7 | #ifndef LL_LLFLOATERASSETBROWSERVIEW_H | ||
8 | #define LL_LLFLOATERASSETBROWSERVIEW_H | ||
9 | |||
10 | #include "llfloater.h" | ||
11 | #include "llinventorymodel.h" | ||
12 | #include "llview.h" | ||
13 | #include "llviewerimage.h" | ||
14 | |||
15 | class LLInventoryPanel; | ||
16 | |||
17 | struct LLAssetSelection | ||
18 | { | ||
19 | LLUUID mUUID; | ||
20 | LLUUID mAssetUUID; | ||
21 | std::string mName; | ||
22 | std::string mAssetInfo; | ||
23 | S32 mWidth; | ||
24 | S32 mHeight; | ||
25 | LLTextBox* mAssetInfoTextBox; | ||
26 | LLPointer<LLViewerImage> mTexturep; | ||
27 | LLRect mAssetRect; | ||
28 | }; | ||
29 | |||
30 | class LLFloaterAssetBrowser : public LLFloater | ||
31 | { | ||
32 | public: | ||
33 | LLFloaterAssetBrowser(); | ||
34 | |||
35 | virtual ~LLFloaterAssetBrowser(); | ||
36 | |||
37 | static void show(void*); | ||
38 | |||
39 | virtual BOOL handleHover(S32 x, S32 y, MASK mask); | ||
40 | virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); | ||
41 | virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); | ||
42 | virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); | ||
43 | virtual void draw(); | ||
44 | |||
45 | static LLFloaterAssetBrowser* getInstance(){ return sInstance; } | ||
46 | |||
47 | private: | ||
48 | void initialize(); | ||
49 | void createThumbnails(); | ||
50 | void clearAssetInfoTexts(); | ||
51 | void clearNoAssetsText(); | ||
52 | |||
53 | static void onClickNext(void *userdata); | ||
54 | static void onClickPrevious(void *userdata); | ||
55 | static void onClickRefresh(void *userdata); | ||
56 | |||
57 | static LLFloaterAssetBrowser* sInstance; | ||
58 | |||
59 | protected: | ||
60 | LLInventoryPanel* mInventoryPanel; | ||
61 | LLUUID mImageAssetID; | ||
62 | LLUUID mMouseOverUUID; | ||
63 | LLUUID mMouseOverAssetUUID; | ||
64 | LLPointer<LLViewerImage> mTexturep; | ||
65 | std::vector<LLAssetSelection> mTextureAssets; | ||
66 | std::vector<LLTextBox*> mAssetInfoLabelList; | ||
67 | U32 mLastIndex; | ||
68 | U32 mMaxIndex; | ||
69 | U32 mFirstIndex; | ||
70 | U32 mAssetInfoIndex; | ||
71 | S32 mFloaterHeight; | ||
72 | S32 mFloaterWidth; | ||
73 | S32 mMouseOverIndex; | ||
74 | LLTextBox* mNoAssetsLabel; | ||
75 | LLTextBox* mAssetInfoLabel; | ||
76 | std::string mFloaterTitle; | ||
77 | }; | ||
78 | |||
79 | static const S32 HPAD = 4; | ||
80 | static const S32 BORDER_PAD = HPAD; | ||
81 | static const U32 ITEMS_PER_PAGE = 16; | ||
82 | static const S32 START_POS = 250; | ||
83 | |||
84 | #endif | ||
diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp index b937894..4c91a0a 100644 --- a/linden/indra/newview/llviewermenu.cpp +++ b/linden/indra/newview/llviewermenu.cpp | |||
@@ -211,6 +211,7 @@ | |||
211 | #include "lltexlayer.h" | 211 | #include "lltexlayer.h" |
212 | 212 | ||
213 | #include "jcfloater_animation_list.h" | 213 | #include "jcfloater_animation_list.h" |
214 | #include "llfloaterassetbrowser.h" | ||
214 | 215 | ||
215 | void init_client_menu(LLMenuGL* menu); | 216 | void init_client_menu(LLMenuGL* menu); |
216 | void init_server_menu(LLMenuGL* menu); | 217 | void init_server_menu(LLMenuGL* menu); |
@@ -7619,6 +7620,41 @@ class LLAdvancedCheckPhantom: public view_listener_t | |||
7619 | }; | 7620 | }; |
7620 | 7621 | ||
7621 | 7622 | ||
7623 | /////////////////// | ||
7624 | // ASSET BROWSER // | ||
7625 | /////////////////// | ||
7626 | |||
7627 | class LLAdvancedToggleAssetBrowser: public view_listener_t | ||
7628 | { | ||
7629 | bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) | ||
7630 | { | ||
7631 | //open the floater | ||
7632 | LLFloaterAssetBrowser::show(0); | ||
7633 | |||
7634 | bool vis = false; | ||
7635 | if(LLFloaterAssetBrowser::getInstance()) | ||
7636 | { | ||
7637 | vis = (bool)LLFloaterAssetBrowser::getInstance()->getVisible(); | ||
7638 | } | ||
7639 | return true; | ||
7640 | } | ||
7641 | }; | ||
7642 | |||
7643 | class LLAdvancedCheckAssetBrowser: public view_listener_t | ||
7644 | { | ||
7645 | bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) | ||
7646 | { | ||
7647 | bool vis = false; | ||
7648 | if(LLFloaterAssetBrowser::getInstance()) | ||
7649 | { | ||
7650 | vis = (bool)LLFloaterAssetBrowser::getInstance()->getVisible(); | ||
7651 | } | ||
7652 | gMenuHolder->findControl(userdata["control"].asString())->setValue(vis); | ||
7653 | return true; | ||
7654 | } | ||
7655 | }; | ||
7656 | |||
7657 | |||
7622 | /////////////////////// | 7658 | /////////////////////// |
7623 | // CLEAR GROUP CACHE // | 7659 | // CLEAR GROUP CACHE // |
7624 | /////////////////////// | 7660 | /////////////////////// |
@@ -9634,9 +9670,6 @@ void initialize_menus() | |||
9634 | addMenu(new LLWorldTeleportHome(), "World.TeleportHome"); | 9670 | addMenu(new LLWorldTeleportHome(), "World.TeleportHome"); |
9635 | addMenu(new LLWorldSetAway(), "World.SetAway"); | 9671 | addMenu(new LLWorldSetAway(), "World.SetAway"); |
9636 | addMenu(new LLWorldSetBusy(), "World.SetBusy"); | 9672 | addMenu(new LLWorldSetBusy(), "World.SetBusy"); |
9637 | addMenu(new LLAdvancedToggleSit(), "Advanced.ToggleSit"); | ||
9638 | addMenu(new LLAdvancedTogglePhantom(), "Advanced.TogglePhantom"); | ||
9639 | addMenu(new LLAdvancedCheckPhantom(), "Advanced.CheckPhantom"); | ||
9640 | 9673 | ||
9641 | addMenu(new LLWorldEnableCreateLandmark(), "World.EnableCreateLandmark"); | 9674 | addMenu(new LLWorldEnableCreateLandmark(), "World.EnableCreateLandmark"); |
9642 | addMenu(new LLWorldEnableSetHomeLocation(), "World.EnableSetHomeLocation"); | 9675 | addMenu(new LLWorldEnableSetHomeLocation(), "World.EnableSetHomeLocation"); |
@@ -9786,6 +9819,10 @@ void initialize_menus() | |||
9786 | addMenu(new LLAdvancedDumpInfoToConsole(), "Advanced.DumpInfoToConsole"); | 9819 | addMenu(new LLAdvancedDumpInfoToConsole(), "Advanced.DumpInfoToConsole"); |
9787 | addMenu(new LLAdvancedReloadSettingsOverrides(), "Advanced.ReloadSettingsOverrides"); | 9820 | addMenu(new LLAdvancedReloadSettingsOverrides(), "Advanced.ReloadSettingsOverrides"); |
9788 | addMenu(new LLAdvancedToggleSit(), "Advanced.ToggleSit"); | 9821 | addMenu(new LLAdvancedToggleSit(), "Advanced.ToggleSit"); |
9822 | addMenu(new LLAdvancedTogglePhantom(), "Advanced.TogglePhantom"); | ||
9823 | addMenu(new LLAdvancedCheckPhantom(), "Advanced.CheckPhantom"); | ||
9824 | addMenu(new LLAdvancedToggleAssetBrowser(),"Advanced.ToggleAssetBrowser"); | ||
9825 | addMenu(new LLAdvancedCheckAssetBrowser(),"Advanced.CheckAssetBrowser"); | ||
9789 | 9826 | ||
9790 | // Advanced > HUD Info | 9827 | // Advanced > HUD Info |
9791 | addMenu(new LLAdvancedToggleHUDInfo(), "Advanced.ToggleHUDInfo"); | 9828 | addMenu(new LLAdvancedToggleHUDInfo(), "Advanced.ToggleHUDInfo"); |
diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_asset_browser.xml b/linden/indra/newview/skins/default/xui/en-us/floater_asset_browser.xml new file mode 100644 index 0000000..13c6b6c --- /dev/null +++ b/linden/indra/newview/skins/default/xui/en-us/floater_asset_browser.xml | |||
@@ -0,0 +1,29 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" standalone="yes" ?> | ||
2 | |||
3 | <floater bottom="-300" can_close="true" can_drag_on_left="false" can_minimize="true" | ||
4 | can_resize="true" enabled="true" follows="left|bottom" height="620" | ||
5 | hidden="false" left="300" min_height="420" min_width="630" | ||
6 | mouse_opaque="true" name="asset browser" title="Asset Browser" width="720"> | ||
7 | |||
8 | <inventory_panel allow_multi_select="false" border="true" bottom="-299" enabled="true" | ||
9 | follows="left|top" height="280" hidden="false" left="10" | ||
10 | mouse_opaque="true" name="inventory panel" | ||
11 | sort_order="TexturePickerSortOrder" width="231"/> | ||
12 | |||
13 | <button bottom="-350" follows="left|top" font="SansSerifSmall" | ||
14 | halign="center" height="20" hidden="false" label="Next >>" | ||
15 | left="160" mouse_opaque="true" name="button next" scale_image="TRUE" | ||
16 | width="80"/> | ||
17 | |||
18 | <button bottom_delta="-30" follows="left|top" font="SansSerifSmall" | ||
19 | halign="center" height="20" hidden="false" label="<< Previous" | ||
20 | left_delta="0" mouse_opaque="true" name="button previous" scale_image="TRUE" | ||
21 | width="80"/> | ||
22 | |||
23 | <button bottom_delta="-30" follows="left|top" font="SansSerifSmall" | ||
24 | halign="center" height="20" hidden="false" label="Refresh" | ||
25 | left_delta="0" mouse_opaque="true" name="button refresh" scale_image="TRUE" | ||
26 | width="80"/> | ||
27 | |||
28 | </floater> | ||
29 | |||
diff --git a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml index b091be2..5407061 100644 --- a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml +++ b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml | |||
@@ -897,6 +897,11 @@ | |||
897 | <on_click function="ShowFloater" userdata="animation list" /> | 897 | <on_click function="ShowFloater" userdata="animation list" /> |
898 | <on_check function="FloaterVisible" userdata="animation list" /> | 898 | <on_check function="FloaterVisible" userdata="animation list" /> |
899 | </menu_item_check> | 899 | </menu_item_check> |
900 | <menu_item_check label="Asset Browser" name="asset browser" | ||
901 | shortcut="alt|shift|a"> | ||
902 | <on_click function="Advanced.ToggleAssetBrowser" userdata="" /> | ||
903 | <on_check function="Advanced.CheckAssetBrowser" userdata="" /> | ||
904 | </menu_item_check> | ||
900 | <menu_item_check name="Show Mouselook Crosshairs" | 905 | <menu_item_check name="Show Mouselook Crosshairs" |
901 | label="Show Mouselook Crosshairs"> | 906 | label="Show Mouselook Crosshairs"> |
902 | <on_click function="ToggleControl" | 907 | <on_click function="ToggleControl" |