llviewermenu.cpp 251 KB
Newer Older
James Cook's avatar
James Cook committed
1
2
3
4
/** 
 * @file llviewermenu.cpp
 * @brief Builds menus out of items.
 *
5
 * $LicenseInfo:firstyear=2002&license=viewerlgpl$
6
 * Second Life Viewer Source Code
7
 * Copyright (C) 2014, Linden Research, Inc.
8
9
10
11
12
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation;
 * version 2.1 of the License only.
13
 * 
14
15
16
17
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
18
 * 
19
20
21
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * 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$
James Cook's avatar
James Cook committed
25
26
27
 */

#include "llviewerprecompiledheaders.h"
28
29

#ifdef INCLUDE_VLD
30
#define VLD_FORCE_ENABLE 1
31
32
33
#include "vld.h"
#endif

James Cook's avatar
James Cook committed
34
35
36
#include "llviewermenu.h" 

// linden library includes
37
38
#include "llaudioengine.h"
#include "llstreamingaudio.h"
39
#include "llavatarnamecache.h"	// IDEVO
40
#include "llfloaterreg.h"
41
#include "llfloatersidepanelcontainer.h"
42
#include "llcombobox.h"
Loren Shih's avatar
Loren Shih committed
43
#include "llinventorypanel.h"
44
#include "llnotifications.h"
45
#include "llnotificationsutil.h"
46
#include "llviewereventrecorder.h"
James Cook's avatar
James Cook committed
47
48

// newview includes
49
#include "alavatarcolormgr.h"
James Cook's avatar
James Cook committed
50
#include "llagent.h"
51
#include "llagentaccess.h"
52
#include "llagentcamera.h"
53
#include "llagentui.h"
54
#include "llagentwearables.h"
James Cook's avatar
James Cook committed
55
56
#include "llagentpilot.h"
#include "llcompilequeue.h"
57
#include "llconsole.h"
58
#include "lldaycyclemanager.h"
James Cook's avatar
James Cook committed
59
#include "lldebugview.h"
60
#include "llenvmanager.h"
61
#include "llfacebookconnect.h"
62
#include "llfilepicker.h"
63
#include "llfirstuse.h"
James Cook's avatar
James Cook committed
64
65
#include "llfloaterbuy.h"
#include "llfloaterbuycontents.h"
66
#include "llbuycurrencyhtml.h"
James Cook's avatar
James Cook committed
67
#include "llfloatergodtools.h"
68
#include "llfloaterinventory.h"
69
#include "llfloaterimcontainer.h"
James Cook's avatar
James Cook committed
70
#include "llfloaterland.h"
71
#include "llfloaterimnearbychat.h"
Drake Arconis's avatar
Drake Arconis committed
72
#include "llfloaterparticleeditor.h"
73
74
#include "llfloaterpathfindingcharacters.h"
#include "llfloaterpathfindinglinksets.h"
75
#include "llfloaterpay.h"
James Cook's avatar
James Cook committed
76
#include "llfloaterreporter.h"
77
#include "llfloatersearch.h"
James Cook's avatar
James Cook committed
78
#include "llfloaterscriptdebug.h"
79
#include "llfloatersnapshot.h"
James Cook's avatar
James Cook committed
80
81
#include "llfloatertools.h"
#include "llfloaterworldmap.h"
82
#include "llfloaterbuildoptions.h"
Steven Bennetts's avatar
Steven Bennetts committed
83
#include "llavataractions.h"
Steven Bennetts's avatar
Steven Bennetts committed
84
#include "lllandmarkactions.h"
James Cook's avatar
James Cook committed
85
#include "llgroupmgr.h"
86
#include "lltooltip.h"
87
#include "llhints.h"
James Cook's avatar
James Cook committed
88
89
#include "llhudeffecttrail.h"
#include "llhudmanager.h"
90
#include "llimview.h"
91
#include "llinventorybridge.h"
92
#include "llinventorydefines.h"
93
#include "llinventoryfunctions.h"
James Cook's avatar
James Cook committed
94
#include "llpanellogin.h"
Steven Bennetts's avatar
Steven Bennetts committed
95
#include "llpanelblockedlist.h"
96
#include "llmarketplacefunctions.h"
97
#include "llmenuoptionpathfindingrebakenavmesh.h"
James Cook's avatar
James Cook committed
98
99
#include "llmoveview.h"
#include "llparcel.h"
100
#include "llrootview.h"
101
#include "llsceneview.h"
102
#include "llscenemonitor.h"
James Cook's avatar
James Cook committed
103
#include "llselectmgr.h"
104
#include "llspellcheckmenuhandler.h"
James Cook's avatar
James Cook committed
105
#include "llstatusbar.h"
106
#include "lltexturecache.h"
James Cook's avatar
James Cook committed
107
#include "lltextureview.h"
108
#include "lltoolbarview.h"
James Cook's avatar
James Cook committed
109
110
111
112
#include "lltoolcomp.h"
#include "lltoolmgr.h"
#include "lltoolpie.h"
#include "lltoolselectland.h"
113
#include "lltrans.h"
114
#include "llviewerdisplay.h" //for gWindowResized
115
#include "llviewergenericmessage.h"
116
#include "llviewerhelp.h"
117
#include "llviewermenufile.h"	// init_menu_file()
James Cook's avatar
James Cook committed
118
119
120
121
122
#include "llviewermessage.h"
#include "llviewernetwork.h"
#include "llviewerobjectlist.h"
#include "llviewerparcelmgr.h"
#include "llviewerstats.h"
123
#include "llvoavatarself.h"
124
#include "llvovolume.h"
125
#include "llvoicevivox.h"
James Cook's avatar
James Cook committed
126
127
#include "llworldmap.h"
#include "pipeline.h"
128
#include "llviewerjoystick.h"
129
#include "llwaterparammanager.h"
130
131
#include "llwlanimator.h"
#include "llwlparammanager.h"
Steven Bennetts's avatar
Steven Bennetts committed
132
#include "llfloatercamera.h"
133
#include "lluilistener.h"
134
#include "llappearancemgr.h"
135
#include "lltrans.h"
136
#include "lleconomy.h"
137
#include "lltoolgrab.h"
138
#include "llwindow.h"
139
#include "llpathfindingmanager.h"
140
#include "llstartup.h"
141
#include "boost/unordered_map.hpp"
James Cook's avatar
James Cook committed
142

143
// <alchemy> - Includes
Drake Arconis's avatar
Drake Arconis committed
144
#include "llclipboard.h"
145
// </alchemy>
Drake Arconis's avatar
Drake Arconis committed
146

147
using namespace LLAvatarAppearanceDefines;
James Cook's avatar
James Cook committed
148

149
150
typedef LLPointer<LLViewerObject> LLViewerObjectPtr;

151
152
static boost::unordered_map<std::string, LLStringExplicit> sDefaultItemLabels;

James Cook's avatar
James Cook committed
153
154
155
156
157
158
159
160
161
162
BOOL enable_land_build(void*);
BOOL enable_object_build(void*);

LLVOAvatar* find_avatar_from_object( LLViewerObject* object );
LLVOAvatar* find_avatar_from_object( const LLUUID& object_id );

void handle_test_load_url(void*);

//
// Evil hackish imported globals
163
164
165
166
167
168

//extern BOOL	gHideSelectedObjects;
//extern BOOL gAllowSelectAvatar;
//extern BOOL gDebugAvatarRotation;
extern BOOL gDebugClicks;
extern BOOL gDebugWindowProc;
169
170
extern BOOL gShaderProfileFrame;

171
172
//extern BOOL gDebugTextEditorTips;
//extern BOOL gDebugSelectMgr;
James Cook's avatar
James Cook committed
173
174
175
176
177
178
179
180

//
// Globals
//

LLMenuBarGL		*gMenuBarView = NULL;
LLViewerMenuHolderGL	*gMenuHolder = NULL;
LLMenuGL		*gPopupMenuView = NULL;
181
LLMenuGL		*gEditMenu = NULL;
182
LLMenuBarGL		*gLoginMenuBarView = NULL;
James Cook's avatar
James Cook committed
183
184

// Pie menus
185
186
187
188
189
190
LLContextMenu	*gMenuAvatarSelf	= NULL;
LLContextMenu	*gMenuAvatarOther = NULL;
LLContextMenu	*gMenuObject = NULL;
LLContextMenu	*gMenuAttachmentSelf = NULL;
LLContextMenu	*gMenuAttachmentOther = NULL;
LLContextMenu	*gMenuLand	= NULL;
191
LLContextMenu	*gMenuMuteParticle = NULL;
James Cook's avatar
James Cook committed
192

193
const std::string SAVE_INTO_TASK_INVENTORY("Save Object Back to Object Contents");
James Cook's avatar
James Cook committed
194
195
196
197

LLMenuGL* gAttachSubMenu = NULL;
LLMenuGL* gDetachSubMenu = NULL;
LLMenuGL* gTakeOffClothes = NULL;
198
199
200
201
202
203
LLContextMenu* gAttachScreenPieMenu = NULL;
LLContextMenu* gAttachPieMenu = NULL;
LLContextMenu* gAttachBodyPartPieMenus[8];
LLContextMenu* gDetachPieMenu = NULL;
LLContextMenu* gDetachScreenPieMenu = NULL;
LLContextMenu* gDetachBodyPartPieMenus[8];
James Cook's avatar
James Cook committed
204
205
206
207
208
209

//
// Local prototypes

// File Menu
void handle_compress_image(void*);
210

James Cook's avatar
James Cook committed
211
212
213

// Edit menu
void handle_dump_group_info(void *);
214
void handle_dump_capabilities_info(void *);
James Cook's avatar
James Cook committed
215

Adam Moss's avatar
Adam Moss committed
216
// Advanced->Consoles menu
James Cook's avatar
James Cook committed
217
218
219
220
221
222
223
224
void handle_region_dump_settings(void*);
void handle_region_dump_temp_asset_data(void*);
void handle_region_clear_temp_asset_data(void*);

// Object pie menu
BOOL sitting_on_selection();

void near_sit_object();
225
//void label_sit_or_stand(std::string& label, void*);
James Cook's avatar
James Cook committed
226
227
228
229
230
// buy and take alias into the same UI positions, so these
// declarations handle this mess.
BOOL is_selection_buy_not_take();
S32 selection_price();
BOOL enable_take();
231
232
void handle_object_show_inspector();
void handle_avatar_show_inspector();
233
bool confirm_take(const LLSD& notification, const LLSD& response, LLObjectSelectionHandle selection_handle);
234

James Cook's avatar
James Cook committed
235
236
237
238
239
240
241
242
243
void handle_buy_object(LLSaleInfo sale_info);
void handle_buy_contents(LLSaleInfo sale_info);

// Land pie menu
void near_sit_down_point(BOOL success, void *);

// Avatar pie menu

// Debug menu
244
245
246


void velocity_interpolate( void* );
247
void handle_visual_leak_detector_toggle(void*);
James Cook's avatar
James Cook committed
248
249
250
251
252
253
void handle_rebake_textures(void*);
BOOL check_admin_override(void*);
void handle_admin_override_toggle(void*);
#ifdef TOGGLE_HACKED_GODLIKE_VIEWER
void handle_toggle_hacked_godmode(void*);
BOOL check_toggle_hacked_godmode(void*);
254
bool enable_toggle_hacked_godmode(void*);
James Cook's avatar
James Cook committed
255
256
257
258
259
260
#endif

void toggle_show_xui_names(void *);
BOOL check_show_xui_names(void *);

// Debug UI
261

262
void handle_buy_currency_test(void*);
James Cook's avatar
James Cook committed
263
264
265
266
267
268

void handle_god_mode(void*);

// God menu
void handle_leave_god_mode(void*);

269

James Cook's avatar
James Cook committed
270
271
272
273
void handle_reset_view();

void handle_duplicate_in_place(void*);

274

James Cook's avatar
James Cook committed
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
void handle_object_owner_self(void*);
void handle_object_owner_permissive(void*);
void handle_object_lock(void*);
void handle_object_asset_ids(void*);
void force_take_copy(void*);
#ifdef _CORY_TESTING
void force_export_copy(void*);
void force_import_geometry(void*);
#endif

void handle_force_parcel_owner_to_me(void*);
void handle_force_parcel_to_content(void*);
void handle_claim_public_land(void*);

void handle_god_request_avatar_geometry(void *);	// Hack for easy testing of new avatar geometry
void reload_vertex_shader(void *);
void handle_disconnect_viewer(void *);

293
294
295
296
297
void force_error_breakpoint(void *);
void force_error_llerror(void *);
void force_error_bad_memory_access(void *);
void force_error_infinite_loop(void *);
void force_error_software_exception(void *);
298
void force_error_driver_crash(void *);
299

James Cook's avatar
James Cook committed
300
301
void handle_force_delete(void*);
void print_object_info(void*);
302
void print_agent_nvpairs(void*);
James Cook's avatar
James Cook committed
303
void toggle_debug_menus(void*);
304
void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status);
James Cook's avatar
James Cook committed
305
void dump_select_mgr(void*);
306

James Cook's avatar
James Cook committed
307
308
309
310
311
312
313
314
315
void dump_inventory(void*);
void toggle_visibility(void*);
BOOL get_visibility(void*);

// Avatar Pie menu
void request_friendship(const LLUUID& agent_id);

// Tools menu
void handle_selected_texture_info(void*);
316
void handle_selected_material_info();
James Cook's avatar
James Cook committed
317
318
319
320

void handle_dump_followcam(void*);
void handle_viewer_enable_message_log(void*);
void handle_viewer_disable_message_log(void*);
321

James Cook's avatar
James Cook committed
322
323
324
325
326
327
328
329
330
BOOL enable_buy_land(void*);

// Help menu

void handle_test_male(void *);
void handle_test_female(void *);
void handle_dump_attachments(void *);
void handle_dump_avatar_local_textures(void*);
void handle_debug_avatar_textures(void*);
331
332
void handle_grab_baked_texture(void*);
BOOL enable_grab_baked_texture(void*);
333
void handle_dump_region_object_cache(void*);
James Cook's avatar
James Cook committed
334
335

BOOL enable_save_into_task_inventory(void*);
336
337

BOOL enable_detach(const LLSD& = LLSD());
338
339
void menu_toggle_attached_lights(void* user_data);
void menu_toggle_attached_particles(void* user_data);
James Cook's avatar
James Cook committed
340
341
342
343
344
345
346
347
348
349
350

class LLMenuParcelObserver : public LLParcelObserver
{
public:
	LLMenuParcelObserver();
	~LLMenuParcelObserver();
	virtual void changed();
};

static LLMenuParcelObserver* gMenuParcelObserver = NULL;

351
static LLUIListener sUIListener;
352

James Cook's avatar
James Cook committed
353
354
LLMenuParcelObserver::LLMenuParcelObserver()
{
355
	LLViewerParcelMgr::getInstance()->addObserver(this);
James Cook's avatar
James Cook committed
356
357
358
359
}

LLMenuParcelObserver::~LLMenuParcelObserver()
{
360
	LLViewerParcelMgr::getInstance()->removeObserver(this);
James Cook's avatar
James Cook committed
361
362
363
364
}

void LLMenuParcelObserver::changed()
{
365
366
	LLParcel *parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel();
	gMenuHolder->childSetEnabled("Land Buy Pass", LLPanelLandGeneral::enableBuyPass(NULL) && !(parcel->getOwnerID()== gAgent.getID()));
James Cook's avatar
James Cook committed
367
368
369
370
371
372
373
	
	BOOL buyable = enable_buy_land(NULL);
	gMenuHolder->childSetEnabled("Land Buy", buyable);
	gMenuHolder->childSetEnabled("Buy Land...", buyable);
}


374
void initialize_menus();
James Cook's avatar
James Cook committed
375
376
377
378
379
380
381
382
383
384
385
386

//-----------------------------------------------------------------------------
// Initialize main menus
//
// HOW TO NAME MENUS:
//
// First Letter Of Each Word Is Capitalized, Even At Or And
//
// Items that lead to dialog boxes end in "..."
//
// Break up groups of more than 6 items with separators
//-----------------------------------------------------------------------------
Josh Bell's avatar
Josh Bell committed
387
388
389
390
391

void set_underclothes_menu_options()
{
	if (gMenuHolder && gAgent.isTeen())
	{
392
393
		gMenuHolder->getChild<LLView>("Self Underpants")->setVisible(FALSE);
		gMenuHolder->getChild<LLView>("Self Undershirt")->setVisible(FALSE);
Josh Bell's avatar
Josh Bell committed
394
395
396
	}
	if (gMenuBarView && gAgent.isTeen())
	{
397
398
		gMenuBarView->getChild<LLView>("Menu Underpants")->setVisible(FALSE);
		gMenuBarView->getChild<LLView>("Menu Undershirt")->setVisible(FALSE);
Josh Bell's avatar
Josh Bell committed
399
400
401
	}
}

402
void set_merchant_SLM_menu()
403
{
404
405
406
	gMenuHolder->getChild<LLView>("MarketplaceListings")->setVisible((BOOL)LLGridManager::getInstance()->isInSecondlife());
	LLCommand* command = LLCommandManager::instance().getCommand("marketplacelistings");
	gToolBarView->enableCommand(command->id(), LLGridManager::getInstance()->isInSecondlife());
407
408
409
410
411
412
413
414
}

void set_merchant_outbox_menu(U32 status, const LLSD& content)
{
    // If the merchant is fully migrated, the API is disabled (503) and we won't show the old menu item.
    // In all other cases, we show it.
    if (status != MarketplaceErrorCodes::IMPORT_SERVER_API_DISABLED)
    {
415
        gMenuHolder->getChild<LLView>("MerchantOutbox")->setVisible((BOOL)LLGridManager::getInstance()->isInSecondlife());
416
417
418
419
420
421
422
    }
}

void check_merchant_status()
{
    if (!gSavedSettings.getBOOL("InventoryOutboxDisplayBoth"))
    {
423
424
425
426
        // Reset the SLM status: we actually want to check again, that's the point of calling check_merchant_status()
        LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED);
        
        // Hide SLM related menu item
427
        gMenuHolder->getChild<LLView>("MarketplaceListings")->setVisible(FALSE);
428
        
429
430
431
        // Also disable the toolbar button for Marketplace Listings
        LLCommand* command = LLCommandManager::instance().getCommand("marketplacelistings");
		gToolBarView->enableCommand(command->id(), false);
432
        
433
        // Launch an SLM test connection to get the merchant status
434
        LLMarketplaceData::instance().initializeSLM(boost::bind(&set_merchant_SLM_menu));
435
436
437
438
439
440
441
442
443
444
445

        // Do the Merchant Outbox init only once per session
        if (LLMarketplaceInventoryImporter::instance().getMarketPlaceStatus() == MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED)
        {
            // Hide merchant outbox related menu item
            gMenuHolder->getChild<LLView>("MerchantOutbox")->setVisible(FALSE);
            
            // Launch a Merchant Outbox test connection to get the migration status
            LLMarketplaceInventoryImporter::instance().setStatusReportCallback(boost::bind(&set_merchant_outbox_menu,_1, _2));
            LLMarketplaceInventoryImporter::instance().initialize();
        }
446
447
448
    }
}

James Cook's avatar
James Cook committed
449
450
451
void init_menus()
{
	// Initialize actions
452
	initialize_menus();
James Cook's avatar
James Cook committed
453
454
455
456
457
458
459

	///
	/// Popup menu
	///
	/// The popup menu is now populated by the show_context_menu()
	/// method.
	
460
461
462
463
	LLMenuGL::Params menu_params;
	menu_params.name = "Popup";
	menu_params.visible = false;
	gPopupMenuView = LLUICtrlFactory::create<LLMenuGL>(menu_params);
James Cook's avatar
James Cook committed
464
465
466
	gMenuHolder->addChild( gPopupMenuView );

	///
467
	/// Context menus
James Cook's avatar
James Cook committed
468
	///
469

470
471
	const widget_registry_t& registry =
		LLViewerMenuHolderGL::child_registry_t::instance();
472
	gEditMenu = LLUICtrlFactory::createFromFile<LLMenuGL>("menu_edit.xml", gMenuHolder, registry);
473
474
475
476
	gMenuAvatarSelf = LLUICtrlFactory::createFromFile<LLContextMenu>(
		"menu_avatar_self.xml", gMenuHolder, registry);
	gMenuAvatarOther = LLUICtrlFactory::createFromFile<LLContextMenu>(
		"menu_avatar_other.xml", gMenuHolder, registry);
James Cook's avatar
James Cook committed
477

478
479
	gDetachScreenPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Detach HUD", true);
	gDetachPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Detach", true);
James Cook's avatar
James Cook committed
480

481
482
	gMenuObject = LLUICtrlFactory::createFromFile<LLContextMenu>(
		"menu_object.xml", gMenuHolder, registry);
James Cook's avatar
James Cook committed
483

484
485
	gAttachScreenPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Attach HUD");
	gAttachPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Attach");
James Cook's avatar
James Cook committed
486

487
488
489
490
	gMenuAttachmentSelf = LLUICtrlFactory::createFromFile<LLContextMenu>(
		"menu_attachment_self.xml", gMenuHolder, registry);
	gMenuAttachmentOther = LLUICtrlFactory::createFromFile<LLContextMenu>(
		"menu_attachment_other.xml", gMenuHolder, registry);
James Cook's avatar
James Cook committed
491

492
493
	gMenuLand = LLUICtrlFactory::createFromFile<LLContextMenu>(
		"menu_land.xml", gMenuHolder, registry);
James Cook's avatar
James Cook committed
494

495
496
497
	gMenuMuteParticle = LLUICtrlFactory::createFromFile<LLContextMenu>(
		"menu_mute_particle.xml", gMenuHolder, registry);

James Cook's avatar
James Cook committed
498
499
500
501
502
	///
	/// set up the colors
	///
	LLColor4 color;

503
	LLColor4 context_menu_color = LLUIColorTable::instance().getColor("MenuPopupBgColor");
504
	
505
506
507
508
509
	gMenuAvatarSelf->setBackgroundColor( context_menu_color );
	gMenuAvatarOther->setBackgroundColor( context_menu_color );
	gMenuObject->setBackgroundColor( context_menu_color );
	gMenuAttachmentSelf->setBackgroundColor( context_menu_color );
	gMenuAttachmentOther->setBackgroundColor( context_menu_color );
510

511
	gMenuLand->setBackgroundColor( context_menu_color );
512

513
	color = LLUIColorTable::instance().getColor( "MenuPopupBgColor" );
514
515
	gPopupMenuView->setBackgroundColor( color );

James Cook's avatar
James Cook committed
516
	// If we are not in production, use a different color to make it apparent.
Cinder's avatar
Cinder committed
517
	if (LLGridManager::getInstance()->isInSLBeta())
James Cook's avatar
James Cook committed
518
	{
Cinder's avatar
Cinder committed
519
		color = LLUIColorTable::instance().getColor( "MenuNonProductionBgColor" );
James Cook's avatar
James Cook committed
520
521
522
	}
	else
	{
Cinder's avatar
Cinder committed
523
		color = LLUIColorTable::instance().getColor( "MenuBarBgColor" );
James Cook's avatar
James Cook committed
524
	}
525
526
527

	LLView* menu_bar_holder = gViewerWindow->getRootView()->getChildView("menu_bar_holder");

528
	gMenuBarView = LLUICtrlFactory::getInstance()->createFromFile<LLMenuBarGL>("menu_viewer.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
529
	gMenuBarView->setRect(LLRect(0, menu_bar_holder->getRect().mTop, 0, menu_bar_holder->getRect().mTop - MENU_BAR_HEIGHT));
James Cook's avatar
James Cook committed
530
531
	gMenuBarView->setBackgroundColor( color );

532
	menu_bar_holder->addChild(gMenuBarView);
533
  
Cinder's avatar
Cinder committed
534
535
    gViewerWindow->setMenuBackgroundColor(false,
        !LLGridManager::getInstance()->isInSLBeta());
James Cook's avatar
James Cook committed
536

537
	// Assume L$10 for now, the server will tell us the real cost at login
538
	// *TODO:Also fix cost in llfolderview.cpp for Inventory menus
539
540
541
542
543
544
	S32 cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
	std::string upload_cost;
	if (LLGridManager::getInstance()->isInSecondlife())
		upload_cost = cost > 0 ? llformat("L$%d", cost) : llformat("L$%d", gSavedSettings.getU32("DefaultUploadCost"));
	else
		upload_cost = cost > 0 ? llformat("L$%d", cost) : LLTrans::getString("Free");
545
546
547
548
	gMenuHolder->childSetLabelArg("Upload Image", "[COST]", upload_cost);
	gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", upload_cost);
	gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", upload_cost);
	gMenuHolder->childSetLabelArg("Bulk Upload", "[COST]", upload_cost);
Dave Parks's avatar
Dave Parks committed
549
	
550
551
	gAttachSubMenu = gMenuBarView->findChildMenuByName("Attach Object", TRUE);
	gDetachSubMenu = gMenuBarView->findChildMenuByName("Detach Object", TRUE);
552

553
554
555
556
557
558
559
	// Don't display the Memory console menu if the feature is turned off
	LLMenuItemCheckGL *memoryMenu = gMenuBarView->getChild<LLMenuItemCheckGL>("Memory", TRUE);
	if (memoryMenu)
	{
		memoryMenu->setVisible(FALSE);
	}

560
	gMenuBarView->createJumpKeys();
James Cook's avatar
James Cook committed
561
562
563
564

	// Let land based option enable when parcel changes
	gMenuParcelObserver = new LLMenuParcelObserver();

565
	gLoginMenuBarView = LLUICtrlFactory::getInstance()->createFromFile<LLMenuBarGL>("menu_login.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
566
	gLoginMenuBarView->arrangeAndClear();
567
	LLRect menuBarRect = gLoginMenuBarView->getRect();
568
569
	menuBarRect.setLeftTopAndSize(0, menu_bar_holder->getRect().getHeight(), menuBarRect.getWidth(), menuBarRect.getHeight());
	gLoginMenuBarView->setRect(menuBarRect);
570
	gLoginMenuBarView->setBackgroundColor( color );
571
	menu_bar_holder->addChild(gLoginMenuBarView);
572
	
573
574
	// tooltips are on top of EVERYTHING, including menus
	gViewerWindow->getRootView()->sendChildToFront(gToolTipView);
James Cook's avatar
James Cook committed
575
576
}

577
578
579
///////////////////
// SHOW CONSOLES //
///////////////////
Josh Bell's avatar
Josh Bell committed
580
581


582
class LLAdvancedToggleConsole : public view_listener_t
James Cook's avatar
James Cook committed
583
{
584
	bool handleEvent(const LLSD& userdata)
James Cook's avatar
James Cook committed
585
	{
586
587
588
589
590
591
592
		std::string console_type = userdata.asString();
		if ("texture" == console_type)
		{
			toggle_visibility( (void*)gTextureView );
		}
		else if ("debug" == console_type)
		{
593
			toggle_visibility( (void*)static_cast<LLUICtrl*>(gDebugView->mDebugConsolep));
594
595
596
		}
		else if ("fast timers" == console_type)
		{
597
			LLFloaterReg::toggleInstance("block_timers");
598
		}
599
600
601
602
		else if ("scene view" == console_type)
		{
			toggle_visibility( (void*)gSceneView);
		}
603
604
605
606
		else if ("scene monitor" == console_type)
		{
			toggle_visibility( (void*)gSceneMonitorView);
		}
607

608
		return true;
James Cook's avatar
James Cook committed
609
	}
610
611
612
613
};
class LLAdvancedCheckConsole : public view_listener_t
{
	bool handleEvent(const LLSD& userdata)
James Cook's avatar
James Cook committed
614
	{
615
616
617
618
619
620
621
622
623
624
625
626
		std::string console_type = userdata.asString();
		bool new_value = false;
		if ("texture" == console_type)
		{
			new_value = get_visibility( (void*)gTextureView );
		}
		else if ("debug" == console_type)
		{
			new_value = get_visibility( (void*)((LLView*)gDebugView->mDebugConsolep) );
		}
		else if ("fast timers" == console_type)
		{
627
			new_value = LLFloaterReg::instanceVisible("block_timers");
628
		}
629
630
631
632
		else if ("scene view" == console_type)
		{
			new_value = get_visibility( (void*) gSceneView);
		}
633
634
635
636
		else if ("scene monitor" == console_type)
		{
			new_value = get_visibility( (void*) gSceneMonitorView);
		}
637
		
638
639
640
		return new_value;
	}
};
James Cook's avatar
James Cook committed
641
642


643
644
645
//////////////////////////
// DUMP INFO TO CONSOLE //
//////////////////////////
James Cook's avatar
James Cook committed
646
647


648
class LLAdvancedDumpInfoToConsole : public view_listener_t
James Cook's avatar
James Cook committed
649
{
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
	bool handleEvent(const LLSD& userdata)
	{
		std::string info_type = userdata.asString();
		if ("region" == info_type)
		{
			handle_region_dump_settings(NULL);
		}
		else if ("group" == info_type)
		{
			handle_dump_group_info(NULL);
		}
		else if ("capabilities" == info_type)
		{
			handle_dump_capabilities_info(NULL);
		}
		return true;
	}
};
James Cook's avatar
James Cook committed
668
669


670
671
672
//////////////
// HUD INFO //
//////////////
James Cook's avatar
James Cook committed
673
674


675
676
677
class LLAdvancedToggleHUDInfo : public view_listener_t
{
	bool handleEvent(const LLSD& userdata)
James Cook's avatar
James Cook committed
678
	{
679
		std::string info_type = userdata.asString();
James Cook's avatar
James Cook committed
680

681
682
683
684
685
686
687
688
689
690
691
692
		if ("camera" == info_type)
		{
			gDisplayCameraPos = !(gDisplayCameraPos);
		}
		else if ("wind" == info_type)
		{
			gDisplayWindInfo = !(gDisplayWindInfo);
		}
		else if ("fov" == info_type)
		{
			gDisplayFOV = !(gDisplayFOV);
		}
693
694
695
696
		else if ("badge" == info_type)
		{
			gDisplayBadge = !(gDisplayBadge);
		}
697
		return true;
James Cook's avatar
James Cook committed
698
	}
699
};
James Cook's avatar
James Cook committed
700

701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
class LLAdvancedCheckHUDInfo : public view_listener_t
{
	bool handleEvent(const LLSD& userdata)
	{
		std::string info_type = userdata.asString();
		bool new_value = false;
		if ("camera" == info_type)
		{
			new_value = gDisplayCameraPos;
		}
		else if ("wind" == info_type)
		{
			new_value = gDisplayWindInfo;
		}
		else if ("fov" == info_type)
		{
			new_value = gDisplayFOV;
		}
719
720
721
722
		else if ("badge" == info_type)
		{
			new_value = gDisplayBadge;
		}
723
		return new_value;
James Cook's avatar
James Cook committed
724
	}
725
};
James Cook's avatar
James Cook committed
726

727
728
729
730
731
732
733
734
735
736
737
738
739
740

//////////////
// FLYING   //
//////////////

class LLAdvancedAgentFlyingInfo : public view_listener_t
{
	bool handleEvent(const LLSD&)
	{
		return gAgent.getFlying();
	}
};


741
742
743
///////////////////////
// CLEAR GROUP CACHE //
///////////////////////
744

745
746
747
748
749
750
751
752
class LLAdvancedClearGroupCache : public view_listener_t
{
	bool handleEvent(const LLSD& userdata)
	{
		LLGroupMgr::debugClearAllGroups(NULL);
		return true;
	}
};
753

James Cook's avatar
James Cook committed
754
755
756



757
758
759
760
/////////////////
// RENDER TYPE //
/////////////////
U32 render_type_from_string(std::string render_type)
James Cook's avatar
James Cook committed
761
{
762
	if ("simple" == render_type)
James Cook's avatar
James Cook committed
763
	{
764
765
766
767
768
769
770
771
772
773
774
775
776
777
		return LLPipeline::RENDER_TYPE_SIMPLE;
	}
	else if ("alpha" == render_type)
	{
		return LLPipeline::RENDER_TYPE_ALPHA;
	}
	else if ("tree" == render_type)
	{
		return LLPipeline::RENDER_TYPE_TREE;
	}
	else if ("character" == render_type)
	{
		return LLPipeline::RENDER_TYPE_AVATAR;
	}
Loren Shih's avatar
Loren Shih committed
778
	else if ("surfacePatch" == render_type)
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
	{
		return LLPipeline::RENDER_TYPE_TERRAIN;
	}
	else if ("sky" == render_type)
	{
		return LLPipeline::RENDER_TYPE_SKY;
	}
	else if ("water" == render_type)
	{
		return LLPipeline::RENDER_TYPE_WATER;
	}
	else if ("ground" == render_type)
	{
		return LLPipeline::RENDER_TYPE_GROUND;
	}
	else if ("volume" == render_type)
	{
		return LLPipeline::RENDER_TYPE_VOLUME;
	}
	else if ("grass" == render_type)
	{
		return LLPipeline::RENDER_TYPE_GRASS;
	}
	else if ("clouds" == render_type)
	{
		return LLPipeline::RENDER_TYPE_CLOUDS;
	}
	else if ("particles" == render_type)
	{
		return LLPipeline::RENDER_TYPE_PARTICLES;
	}
	else if ("bump" == render_type)
	{
		return LLPipeline::RENDER_TYPE_BUMP;
	}
	else
	{
		return 0;
James Cook's avatar
James Cook committed
817
818
819
820
	}
}


821
class LLAdvancedToggleRenderType : public view_listener_t
James Cook's avatar
James Cook committed
822
{
823
824
825
826
827
	bool handleEvent(const LLSD& userdata)
	{
		U32 render_type = render_type_from_string( userdata.asString() );
		if ( render_type != 0 )
		{
Drake Arconis's avatar
Drake Arconis committed
828
			LLPipeline::toggleRenderTypeControl( reinterpret_cast<void*>(static_cast<intptr_t>(render_type)) ); // <alchemy/>
829
830
831
832
		}
		return true;
	}
};
James Cook's avatar
James Cook committed
833
834


835
class LLAdvancedCheckRenderType : public view_listener_t
James Cook's avatar
James Cook committed
836
{
837
838
839
840
	bool handleEvent(const LLSD& userdata)
	{
		U32 render_type = render_type_from_string( userdata.asString() );
		bool new_value = false;
James Cook's avatar
James Cook committed
841

842
843
		if ( render_type != 0 )
		{
Drake Arconis's avatar
Drake Arconis committed
844
			new_value = LLPipeline::hasRenderTypeControl( reinterpret_cast<void*>(static_cast<intptr_t>(render_type)) ); // <alchemy/>
845
		}
James Cook's avatar
James Cook committed
846

847
848
849
		return new_value;
	}
};
James Cook's avatar
James Cook committed
850

Steven Bennetts's avatar
Steven Bennetts committed
851

852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
/////////////
// FEATURE //
/////////////
U32 feature_from_string(std::string feature)
{ 
	if ("ui" == feature)
	{ 
		return LLPipeline::RENDER_DEBUG_FEATURE_UI;
	}
	else if ("selected" == feature)
	{
		return LLPipeline::RENDER_DEBUG_FEATURE_SELECTED;
	}
	else if ("highlighted" == feature)
	{
		return LLPipeline::RENDER_DEBUG_FEATURE_HIGHLIGHTED;
	}
	else if ("dynamic textures" == feature)
	{
		return LLPipeline::RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES;
	}
	else if ("foot shadows" == feature)
	{
		return LLPipeline::RENDER_DEBUG_FEATURE_FOOT_SHADOWS;
	}
	else if ("fog" == feature)
	{
		return LLPipeline::RENDER_DEBUG_FEATURE_FOG;
	}
	else if ("fr info" == feature)
	{
		return LLPipeline::RENDER_DEBUG_FEATURE_FR_INFO;
	}
	else if ("flexible" == feature)
	{
		return LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE;
	}
	else
	{
		return 0;
	}
};
894

895

896
897
class LLAdvancedToggleFeature : public view_listener_t
{
898
899
900
901
902
	bool handleEvent(const LLSD& userdata)
	{
		U32 feature = feature_from_string( userdata.asString() );
		if ( feature != 0 )
		{
Drake Arconis's avatar
Drake Arconis committed
903
			LLPipeline::toggleRenderDebugFeature( reinterpret_cast<void*>(static_cast<intptr_t>(feature))); // <alchemy/>
904
905
906
907
		}
		return true;
	}
};
908

909
910
class LLAdvancedCheckFeature : public view_listener_t
{
911
	bool handleEvent(const LLSD& userdata)
Richard Linden's avatar
Richard Linden committed
912
913
914
{
	U32 feature = feature_from_string( userdata.asString() );
	bool new_value = false;
915

Richard Linden's avatar
Richard Linden committed
916
917
	if ( feature != 0 )
	{
Drake Arconis's avatar
Drake Arconis committed
918
		new_value = LLPipeline::toggleRenderDebugFeatureControl( reinterpret_cast<void*>(static_cast<intptr_t>(feature))); // <alchemy/>
919
	}
Richard Linden's avatar
Richard Linden committed
920
921
922

	return new_value;
}
923
};
James Cook's avatar
James Cook committed
924

925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
class LLAdvancedCheckDisplayTextureDensity : public view_listener_t
{
	bool handleEvent(const LLSD& userdata)
	{
		std::string mode = userdata.asString();
		if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY))
		{
			return mode == "none";
		}
		if (mode == "current")
		{
			return LLViewerTexture::sDebugTexelsMode == LLViewerTexture::DEBUG_TEXELS_CURRENT;
		}
		else if (mode == "desired")
		{
			return LLViewerTexture::sDebugTexelsMode == LLViewerTexture::DEBUG_TEXELS_DESIRED;
		}
		else if (mode == "full")
		{
			return LLViewerTexture::sDebugTexelsMode == LLViewerTexture::DEBUG_TEXELS_FULL;
		}
		return false;
	}
};

class LLAdvancedSetDisplayTextureDensity : public view_listener_t
{
	bool handleEvent(const LLSD& userdata)
	{
		std::string mode = userdata.asString();
		if (mode == "none")
		{
			if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == TRUE) 
			{
				gPipeline.toggleRenderDebug((void*)LLPipeline::RENDER_DEBUG_TEXEL_DENSITY);
			}
			LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_OFF;
		}
		else if (mode == "current")
		{
			if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == FALSE) 
			{
				gPipeline.toggleRenderDebug((void*)LLPipeline::RENDER_DEBUG_TEXEL_DENSITY);
			}
			LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_CURRENT;
		}
		else if (mode == "desired")
		{
			if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == FALSE) 
			{
				gPipeline.toggleRenderDebug((void*)LLPipeline::RENDER_DEBUG_TEXEL_DENSITY);
			}
			gPipeline.setRenderDebugFeatureControl(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY, true);
			LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_DESIRED;
		}
		else if (mode == "full")
		{
			if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == FALSE) 
			{
				gPipeline.toggleRenderDebug((void*)LLPipeline::RENDER_DEBUG_TEXEL_DENSITY);
			}
			LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_FULL;
		}
		return true;
	}
};

992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005

//////////////////
// INFO DISPLAY //
//////////////////
U32 info_display_from_string(std::string info_display)
{
	if ("verify" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_VERIFY;
	}
	else if ("bboxes" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_BBOXES;
	}
1006
1007
1008
1009
	else if ("normals" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_NORMALS;
	}
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
	else if ("points" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_POINTS;
	}
	else if ("octree" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_OCTREE;
	}
	else if ("shadow frusta" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA;
	}
Dave Parks's avatar
Dave Parks committed
1022
1023
1024
1025
	else if ("physics shapes" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES;
	}
1026
1027
1028
1029
1030
1031
1032
1033
	else if ("occlusion" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_OCCLUSION;
	}
	else if ("render batches" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_BATCH_SIZE;
	}
1034
1035
1036
1037
	else if ("update type" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_UPDATE_TYPE;
	}
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
	else if ("texture anim" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_TEXTURE_ANIM;
	}
	else if ("texture priority" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY;
	}
	else if ("shame" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_SHAME;
	}
	else if ("texture area" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_TEXTURE_AREA;
	}
	else if ("face area" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_FACE_AREA;
	}
1058
1059
1060
1061
	else if ("lod info" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_LOD_INFO;
	}
1062
1063
1064
1065
	else if ("build queue" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_BUILD_QUEUE;
	}
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
	else if ("lights" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_LIGHTS;
	}
	else if ("particles" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_PARTICLES;
	}
	else if ("composition" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_COMPOSITION;
	}
1078
1079
1080
1081
	else if ("attachment bytes" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_ATTACHMENT_BYTES;
	}
1082
1083
1084
1085
1086
1087
1088
1089
	else if ("glow" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_GLOW;
	}
	else if ("collision skeleton" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_AVATAR_VOLUME;
	}
1090
1091
1092
1093
	else if ("joints" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_AVATAR_JOINTS;
	}
1094
1095
1096
1097
	else if ("raycast" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_RAYCAST;
	}
1098
1099
1100
1101
	else if ("agent target" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_AGENT_TARGET;
	}
1102
1103
1104
1105
	else if ("sculpt" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_SCULPTED;
	}
1106
1107
1108
1109
	else if ("wind vectors" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_WIND_VECTORS;
	}
1110
1111
1112
1113
	else if ("texel density" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_TEXEL_DENSITY;
	}
1114
1115
1116
1117
	else if ("rendercomplexity" == info_display)
	{
		return LLPipeline::RENDER_DEBUG_RENDER_COMPLEXITY;
	}
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
	else
	{
		return 0;
	}
};

class LLAdvancedToggleInfoDisplay : public view_listener_t
{
	bool handleEvent(const LLSD& userdata)
	{
		U32 info_display = info_display_from_string( userdata.asString() );

1130
1131
		LL_INFOS("ViewerMenu") << "toggle " << userdata.asString() << LL_ENDL;
		
1132
1133
		if ( info_display != 0 )
		{
Drake Arconis's avatar
Drake Arconis committed
1134
			LLPipeline::toggleRenderDebug( reinterpret_cast<void*>(static_cast<intptr_t>(info_display))); // <alchemy/>
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
		}

		return true;
	}
};


class LLAdvancedCheckInfoDisplay : public view_listener_t
{
	bool handleEvent(const LLSD& userdata)
	{
		U32 info_display = info_display_from_string( userdata.asString() );
		bool new_value = false;

		if ( info_display != 0 )
		{
Drake Arconis's avatar
Drake Arconis committed
1151
			new_value = LLPipeline::toggleRenderDebugControl( reinterpret_cast<void*>(static_cast<intptr_t>(info_display))); // <alchemy/>
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
		}

		return new_value;
	}
};


///////////////////////////
//// RANDOMIZE FRAMERATE //
///////////////////////////


class LLAdvancedToggleRandomizeFramerate : public view_listener_t
{
	bool handleEvent(const LLSD& userdata)
	{
		gRandomizeFramerate = !(gRandomizeFramerate);
		return true;
	}
};

class LLAdvancedCheckRandomizeFramerate : public view_listener_t
{
	bool handleEvent(const LLSD& userdata)
	{
		bool new_value = gRandomizeFramerate;
		return new_value;
	}
};

///////////////////////////
//// PERIODIC SLOW FRAME //
///////////////////////////


class LLAdvancedTogglePeriodicSlowFrame : public view_listener_t
{
	bool handleEvent(const LLSD& userdata)
	{
		gPeriodicSlowFrame = !(gPeriodicSlowFrame);
		return true;
	}
};

class LLAdvancedCheckPeriodicSlowFrame : public view_listener_t
{
	bool handleEvent(const LLSD& userdata)
	{
		bool new_value = gPeriodicSlowFrame;
		return new_value;
	}
};



////////////////
// FRAME TEST //
////////////////


class LLAdvancedToggleFrameTest : public view_listener_t
{
	bool handleEvent(const LLSD& userdata)
	{
		LLPipeline::sRenderFrameTest = !(LLPipeline::sRenderFrameTest);
		return true;
	}
};

class LLAdvancedCheckFrameTest : public view_listener_t
{
	bool handleEvent(const LLSD& userdata)
	{
		bool new_value = LLPipeline::sRenderFrameTest;
		return new_value;
	}
};


///////////////////////////
// SELECTED TEXTURE INFO //
///////////////////////////


class LLAdvancedSelectedTextureInfo : public view_listener_t
{
	bool handleEvent(const LLSD& userdata)
	{
		handle_selected_texture_info(NULL);
		return true;
	}
};

//////////////////////
// TOGGLE WIREFRAME //
//////////////////////

class LLAdvancedToggleWireframe : public view_listener_t
{
	bool handleEvent(const LLSD& userdata)
	{
		gUseWireframe = !(gUseWireframe);
1254
		gWindowResized = TRUE;
1255
1256
		LLPipeline::updateRenderDeferred();
		gPipeline