forked from siana/SingularityViewer
/
llviewermenu.cpp
9647 lines (8414 loc) · 290 KB
/
llviewermenu.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
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
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
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
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
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
992
993
994
995
996
997
998
999
1000
/**
* @file llviewermenu.cpp
* @brief Builds menus out of items.
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
* Second Life Viewer Source Code
* Copyright (c) 2002-2009, Linden Research, Inc.
*
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llviewermenu.h"
// linden library includes
#include "llanimationstates.h" // For ANIM_AGENT_AWAY
#include "llavatarnamecache.h" // IDEVO
#include "llinventorypanel.h"
#include "llnotifications.h"
#include "llnotificationsutil.h"
#include "llfeaturemanager.h"
#include "llsecondlifeurls.h"
// <edit>
#include "llfloaterblacklist.h"
// </edit>
#include "statemachine/aifilepicker.h"
// newview includes
#include "lfsimfeaturehandler.h"
#include "llagent.h"
#include "llagentcamera.h"
#include "llappearancemgr.h"
#include "llagentwearables.h"
#include "llagentpilot.h"
#include "llavatarpropertiesprocessor.h"
#include "llcallingcard.h"
#include "llcompilequeue.h"
#include "llconsole.h"
#include "lldebugview.h"
#include "llenvmanager.h"
#include "llfirstuse.h"
#include "llfloateravatartextures.h"
#include "llfloaterbuy.h"
#include "llfloaterbuycontents.h"
#include "llfloaterbuycurrency.h"
#include "llfloaterbuyland.h"
#include "llfloaterchat.h"
#include "llfloatercustomize.h"
#include "llfloaterdirectory.h"
#include "llfloatereditui.h"
#include "llfloaterfonttest.h"
#include "llfloatergodtools.h"
#include "llfloaterhtmlcurrency.h"
#include "llfloaterland.h"
#include "llfloatermute.h"
#include "llfloateropenobject.h"
#include "llfloaterpathfindingcharacters.h"
#include "llfloaterpathfindinglinksets.h"
#include "llfloaterregiondebugconsole.h"
#include "llfloaterregioninfo.h"
#include "llfloaterreporter.h"
#include "llfloatersettingsdebug.h"
#include "llfloatertest.h"
#include "llfloatertools.h"
#include "llfloaterworldmap.h"
#include "llfloatermemleak.h"
#include "llframestats.h"
#include "llavataractions.h"
#include "llgivemoney.h"
#include "llgroupmgr.h"
#include "llhoverview.h"
#include "llhudeffecttrail.h"
#include "llhudmanager.h"
#include "llinventoryfunctions.h"
#include "llmimetypes.h"
#include "llmenuoptionpathfindingrebakenavmesh.h"
#include "llmutelist.h"
#include "llnotify.h"
#include "llparcel.h"
#include "llregioninfomodel.h"
#include "llselectmgr.h"
#include "llstatusbar.h"
#include "lltextureview.h"
#include "lltoolcomp.h"
#include "lltoolgrab.h"
#include "lltoolmgr.h"
#include "lltoolpie.h"
#include "lltoolselectland.h"
#include "lltrans.h"
#include "lluictrlfactory.h"
#include "llvelocitybar.h"
#include "llviewercamera.h"
#include "llviewergenericmessage.h"
#include "llviewerjoystick.h"
#include "llviewertexturelist.h" // gTextureList
#include "llviewermenufile.h" // init_menu_file()
#include "llviewermessage.h"
#include "llviewernetwork.h"
#include "llviewerobjectlist.h"
#include "llviewerparcelmgr.h"
#include "llvoavatarself.h"
#include "llworld.h"
#include "llworldmap.h"
#include "pipeline.h"
#include "llfloaternotificationsconsole.h"
// <edit>
#include "llfloatermessagelog.h"
#include "shfloatermediaticker.h"
#include "llpacketring.h"
#include "aihttpview.h"
// </edit>
#include "scriptcounter.h"
#include "llviewerobjectbackup.h"
#include "llagentui.h"
#include "llpathfindingmanager.h"
#include <boost/lexical_cast.hpp>
#include "lltexturecache.h"
#include "llvovolume.h"
#include "hippogridmanager.h"
#include "wlfPanel_AdvSettings.h"
using namespace LLOldEvents;
using namespace LLAvatarAppearanceDefines;
void init_client_menu(LLMenuGL* menu);
void init_server_menu(LLMenuGL* menu);
typedef LLPointer<LLViewerObject> LLViewerObjectPtr;
typedef std::vector<LLMenuItemCallGL*> custom_menu_item_list_t;
custom_menu_item_list_t gCustomMenuItems;
void init_debug_world_menu(LLMenuGL* menu);
void init_debug_rendering_menu(LLMenuGL* menu);
void init_debug_ui_menu(LLMenuGL* menu);
void init_debug_xui_menu(LLMenuGL* menu);
void init_debug_avatar_menu(LLMenuGL* menu);
// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1a)
#include "rlvactions.h"
#include "rlvhandler.h"
#include "rlvfloaters.h"
#include "rlvlocks.h"
void init_debug_rlva_menu(LLMenuGL* menu);
// [/RLVa:KB]
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
class AIHTTPView;
void add_wave_listeners();
void add_dae_listeners();
void add_radar_listeners();
//extern BOOL gHideSelectedObjects;
//extern BOOL gAllowSelectAvatar;
//extern BOOL gDebugAvatarRotation;
extern BOOL gDebugClicks;
extern BOOL gDebugWindowProc;
extern BOOL gDebugTextEditorTips;
extern BOOL gShowOverlayTitle;
extern BOOL gOcclusionCull;
extern AIHTTPView* gHttpView;
extern LLMenuGL* sScrollListMenus[1];
//
// Globals
//
LLMenuBarGL *gMenuBarView = NULL;
LLViewerMenuHolderGL *gMenuHolder = NULL;
LLMenuGL *gPopupMenuView = NULL;
LLMenuBarGL *gLoginMenuBarView = NULL;
// Pie menus
LLContextMenu *gPieSelf = NULL;
LLContextMenu *gPieAvatar = NULL;
LLContextMenu *gPieObject = NULL;
LLContextMenu *gPieAttachment = NULL;
LLContextMenu *gPieLand = NULL;
// local constants
const std::string CLIENT_MENU_NAME("Advanced");
const std::string SERVER_MENU_NAME("Admin");
const std::string SAVE_INTO_INVENTORY("Save Object Back to My Inventory");
const std::string SAVE_INTO_TASK_INVENTORY("Save Object Back to Object Contents");
LLMenuGL* gAttachSubMenu = NULL;
LLMenuGL* gDetachSubMenu = NULL;
LLMenuGL* gTakeOffClothes = NULL;
LLMenuGL* gMeshesAndMorphsMenu = NULL;
LLContextMenu* gPieRate = NULL;
LLContextMenu* gAttachScreenPieMenu = NULL;
LLContextMenu* gAttachPieMenu = NULL;
LLContextMenu* gAttachBodyPartPieMenus[8];
LLContextMenu* gDetachPieMenu = NULL;
LLContextMenu* gDetachScreenPieMenu = NULL;
LLContextMenu* gDetachBodyPartPieMenus[8];
LLMenuItemCallGL* gAFKMenu = NULL;
LLMenuItemCallGL* gBusyMenu = NULL;
typedef LLMemberListener<LLView> view_listener_t;
//
// Local prototypes
// File Menu
void handle_compress_image(void*);
BOOL enable_save_as(void *);
// Edit menu
void handle_dump_group_info(void *);
void handle_dump_capabilities_info(void *);
void handle_dump_focus(void*);
// Advanced->Consoles menu
void handle_show_notifications_console(void*);
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();
//void label_sit_or_stand(std::string& label, void*);
// 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();
bool confirm_take(const LLSD& notification, const LLSD& response, LLObjectSelectionHandle selection_handle);
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
void handle_talk_to(void *userdata);
// Debug menu
void handle_agent_stop_moving(void*);
void print_packets_lost(void*);
void drop_packet(void*);
void velocity_interpolate( void* );
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*);
#endif
void toggle_show_xui_names(void *);
BOOL check_show_xui_names(void *);
// Debug UI
void handle_web_search_demo(void*);
void handle_web_browser_test(void*);
void handle_buy_currency_test(void*);
void handle_save_to_xml(void*);
void handle_load_from_xml(void*);
void handle_god_mode(void*);
// God menu
void handle_leave_god_mode(void*);
//Generic handler for singleton-based floaters.
template<typename T>
BOOL handle_singleton_check(void *)
{
return T::instanceExists();
}
template<typename T>
void handle_singleton_toggle(void *)
{
if(!T::instanceExists())
T::getInstance();
else
T::getInstance()->close();
}
// <edit>
void handle_fake_away_status(void*);
// <dogmode> for pose stand
LLUUID current_pose = LLUUID::null;
bool on_pose_stand;
void set_current_pose(std::string anim)
{
on_pose_stand = true;
gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_STOP);
current_pose.set(anim);
gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_START);
gAgent.sendAgentSetAppearance();
}
void handle_pose_stand_stop(void*)
{
if (on_pose_stand)
{
on_pose_stand = false;
gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_STOP);
current_pose = LLUUID::null;
gAgent.sendAgentSetAppearance();
}
}
void cleanup_pose_stand()
{
handle_pose_stand_stop(NULL);
}
BOOL handle_check_pose(void* userdata) { return current_pose.notNull(); }
void handle_open_message_log(void*);
// </edit>
void handle_reset_view();
void handle_duplicate_in_place(void*);
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_personal_settings_overrides(void *);
void reload_vertex_shader(void *);
void slow_mo_animations(void *);
void handle_disconnect_viewer(void *);
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 *);
void force_error_driver_crash(void *);
void handle_force_delete(void*);
void print_object_info(void*);
void print_agent_nvpairs(void*);
void toggle_debug_menus(void*);
void export_info_callback(LLAssetInfo *info, void **user_data, S32 result);
void export_data_callback(LLVFS *vfs, const LLUUID& uuid, LLAssetType::EType type, void **user_data, S32 result);
void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status);
BOOL menu_check_build_tool( void* user_data );
void handle_reload_settings(void*);
void focus_here(void*);
void dump_select_mgr(void*);
void dump_volume_mgr(void*);
void dump_inventory(void*);
void edit_ui(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*);
void handle_dump_image_list(void*);
void handle_crash(void*);
void handle_dump_followcam(void*);
void handle_viewer_enable_message_log(void*);
void handle_viewer_disable_message_log(void*);
BOOL enable_buy_land(void*);
// Help menu
void handle_buy_currency(void*);
void handle_test_male(void *);
void handle_test_female(void *);
void handle_toggle_pg(void*);
void handle_dump_attachments(void *);
void handle_dump_avatar_local_textures(void*);
void handle_meshes_and_morphs(void*);
void handle_mesh_save_llm(void* data);
void handle_mesh_save_current_obj(void*);
void handle_mesh_save_obj(void*);
void handle_mesh_load_obj(void*);
void handle_morph_save_obj(void*);
void handle_morph_load_obj(void*);
void handle_debug_avatar_textures(void*);
void handle_dump_region_object_cache(void*);
void menu_toggle_double_click_control(void*);
BOOL menu_ui_enabled(void *user_data);
BOOL menu_check_control( void* user_data);
void menu_toggle_variable( void* user_data );
BOOL menu_check_variable( void* user_data);
BOOL enable_land_selected( void* );
BOOL enable_more_than_one_selected(void* );
BOOL enable_selection_you_own_all(void*);
BOOL enable_selection_you_own_one(void*);
BOOL enable_save_into_inventory(void*);
BOOL enable_save_into_task_inventory(void*);
BOOL enable_detach(const LLSD& = LLSD());
BOOL is_god_customer_service(void*);
void menu_toggle_attached_lights(void* user_data);
void menu_toggle_attached_particles(void* user_data);
void handle_dump_archetype_xml(void *);
void handle_dump_archetype_xml_continued(LLVOAvatar* avatar, AIFilePicker* filepicker);
void region_change();
void parse_simulator_features();
void custom_selected(void* user_data);
void advanced_toggle_wireframe(void*);
BOOL advanced_check_wireframe(void*);
void reset_vertex_buffers(void *user_data)
{
gPipeline.clearRebuildGroups();
gPipeline.resetVertexBuffers();
}
class LLMenuParcelObserver : public LLParcelObserver
{
public:
LLMenuParcelObserver();
~LLMenuParcelObserver();
virtual void changed();
};
static LLMenuParcelObserver* gMenuParcelObserver = NULL;
LLMenuParcelObserver::LLMenuParcelObserver()
{
LLViewerParcelMgr::getInstance()->addObserver(this);
}
LLMenuParcelObserver::~LLMenuParcelObserver()
{
LLViewerParcelMgr::getInstance()->removeObserver(this);
}
void LLMenuParcelObserver::changed()
{
gMenuHolder->childSetEnabled("Land Buy Pass", LLPanelLandGeneral::enableBuyPass(NULL));
BOOL buyable = enable_buy_land(NULL);
gMenuHolder->childSetEnabled("Land Buy", buyable);
gMenuHolder->childSetEnabled("Buy Land...", buyable);
}
//-----------------------------------------------------------------------------
// Menu Construction
//-----------------------------------------------------------------------------
// code required to calculate anything about the menus
void pre_init_menus()
{
// static information
LLMenuGL::setDefaultBackgroundColor( gColors.getColor( "MenuDefaultBgColor" ) );
LLMenuItemGL::sEnabledColor = gColors.getColor( "MenuItemEnabledColor" );
LLMenuItemGL::sDisabledColor = gColors.getColor( "MenuItemDisabledColor" );
LLMenuItemGL::sHighlightBackground = gColors.getColor( "MenuItemHighlightBgColor" );
LLMenuItemGL::sHighlightForeground = gColors.getColor( "MenuItemHighlightFgColor" );
}
void initialize_menus();
//-----------------------------------------------------------------------------
// 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
//-----------------------------------------------------------------------------
void set_underclothes_menu_options()
{
if (gMenuHolder && gAgent.isTeen())
{
gMenuHolder->getChild<LLView>("Self Underpants")->setVisible(FALSE);
gMenuHolder->getChild<LLView>("Self Undershirt")->setVisible(FALSE);
}
if (gMenuBarView && gAgent.isTeen())
{
gMenuBarView->getChild<LLView>("Menu Underpants")->setVisible(FALSE);
gMenuBarView->getChild<LLView>("Menu Undershirt")->setVisible(FALSE);
}
}
static std::vector<LLPointer<view_listener_t> > sMenus;
void build_pie_menus()
{
if (gPieSelf) delete gPieSelf;
gPieSelf = LLUICtrlFactory::getInstance()->buildContextMenu("menu_pie_self.xml", gMenuHolder);
// TomY TODO: what shall we do about these?
gDetachScreenPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Detach HUD", true);
gDetachPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Detach", true);
if (gPieAvatar) delete gPieAvatar;
gPieAvatar = LLUICtrlFactory::getInstance()->buildContextMenu("menu_pie_avatar.xml", gMenuHolder);
if (gPieObject) delete gPieObject;
gPieObject = LLUICtrlFactory::getInstance()->buildContextMenu("menu_pie_object.xml", gMenuHolder);
gAttachScreenPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Attach HUD");
gAttachPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Attach");
gPieRate = gMenuHolder->getChild<LLContextMenu>("Rate Menu");
if (gPieAttachment) delete gPieAttachment;
gPieAttachment = LLUICtrlFactory::getInstance()->buildContextMenu("menu_pie_attachment.xml", gMenuHolder);
if (gPieLand) delete gPieLand;
gPieLand = LLUICtrlFactory::getInstance()->buildContextMenu("menu_pie_land.xml", gMenuHolder);
}
void rebuild_context_menus()
{
llassert_always(gMenuHolder);
if (!gMenuHolder) return; // This should never happen, if it does, don't do anything, menus haven't been built yet or were destroyed.
gMenuHolder->hideMenus();
build_pie_menus();
if (!gAgentAvatarp) return; // The agent's avatar isn't here yet, don't bother with the dynamic attach/detach submenus.
gAgentAvatarp->buildContextMenus();
}
void init_menus()
{
S32 top = gViewerWindow->getRootView()->getRect().getHeight();
S32 width = gViewerWindow->getRootView()->getRect().getWidth();
//
// Main menu bar
//
gMenuHolder = new LLViewerMenuHolderGL();
gMenuHolder->setRect(LLRect(0, top, width, 0));
gMenuHolder->setFollowsAll();
LLMenuGL::sMenuContainer = gMenuHolder;
// Initialize actions
initialize_menus();
///
/// Popup menu
///
/// The popup menu is now populated by the show_context_menu()
/// method.
gPopupMenuView = new LLMenuGL( "Popup" );
gPopupMenuView->setVisible( FALSE );
gMenuHolder->addChild( gPopupMenuView );
///
/// Pie menus
///
build_pie_menus();
gSavedSettings.getControl("LiruUseContextMenus")->getSignal()->connect(boost::bind(rebuild_context_menus));
///
/// set up the colors
///
LLColor4 color;
color = gColors.getColor( "MenuPopupBgColor" );
gPopupMenuView->setBackgroundColor( color );
// If we are not in production, use a different color to make it apparent.
if (LLViewerLogin::getInstance()->isInProductionGrid())
{
color = gColors.getColor( "MenuBarBgColor" );
}
else
{
color = gColors.getColor( "MenuNonProductionBgColor" );
}
gMenuBarView = (LLMenuBarGL*)LLUICtrlFactory::getInstance()->buildMenu("menu_viewer.xml", gMenuHolder);
gMenuBarView->setRect(LLRect(0, top, 0, top - MENU_BAR_HEIGHT));
gMenuBarView->setBackgroundColor( color );
// gMenuBarView->setItemVisible("Tools", FALSE);
gMenuBarView->needsArrange();
gMenuHolder->addChild(gMenuBarView);
// menu holder appears on top of menu bar so you can see the menu title
// flash when an item is triggered (the flash occurs in the holder)
gViewerWindow->getRootView()->addChild(gMenuHolder);
gViewerWindow->setMenuBackgroundColor(false,
LLViewerLogin::getInstance()->isInProductionGrid());
// Assume L$10 for now, the server will tell us the real cost at login
const std::string upload_cost("10");
std::string fee = gHippoGridManager->getConnectedGrid()->getCurrencySymbol() + "10";
gMenuHolder->childSetLabelArg("Upload Image", "[UPLOADFEE]", fee);
gMenuHolder->childSetLabelArg("Upload Sound", "[UPLOADFEE]", fee);
gMenuHolder->childSetLabelArg("Upload Animation", "[UPLOADFEE]", fee);
gMenuHolder->childSetLabelArg("Bulk Upload", "[UPLOADFEE]", fee);
gMenuHolder->childSetLabelArg("Buy and Sell L$...", "[CURRENCY]",
gHippoGridManager->getConnectedGrid()->getCurrencySymbol());
gAFKMenu = gMenuBarView->getChild<LLMenuItemCallGL>("Set Away", TRUE);
gBusyMenu = gMenuBarView->getChild<LLMenuItemCallGL>("Set Busy", TRUE);
gAttachSubMenu = gMenuBarView->getChildMenuByName("Attach Object", TRUE);
gDetachSubMenu = gMenuBarView->getChildMenuByName("Detach Object", TRUE);
// <dogmode>
// Add in the pose stand -------------------------------------------
/*LLMenuGL* sub = new LLMenuGL("Pose Stand...");
menu->addChild(sub);
sub->addChild(new LLMenuItemCallGL( "Legs Together Arms Out", &handle_pose_stand_ltao, NULL));
sub->addChild(new LLMenuItemCallGL( "Legs Together Arms Half", &handle_pose_stand_ltah, NULL));
sub->addChild(new LLMenuItemCallGL( "Legs Together Arms Down", &handle_pose_stand_ltad, NULL));
sub->addChild(new LLMenuItemCallGL( "Legs Out Arms Up", &handle_pose_stand_loau, NULL));
sub->addChild(new LLMenuItemCallGL( "Legs Out Arms Out", &handle_pose_stand_loao, NULL));
sub->addChild(new LLMenuItemCallGL( "Legs Half Arms Out", &handle_pose_stand_lhao, NULL));
sub->addChild(new LLMenuItemCallGL( "Stop Pose Stand", &handle_pose_stand_stop, NULL));
// </dogmode> ------------------------------------------------------*/
// TomY TODO convert these two
LLMenuGL*menu;
menu = new LLMenuGL(CLIENT_MENU_NAME);
menu->setCanTearOff(TRUE);
init_client_menu(menu);
gMenuBarView->addChild( menu );
rlvMenuToggleVisible();
menu = new LLMenuGL(SERVER_MENU_NAME);
menu->setCanTearOff(TRUE);
init_server_menu(menu);
gMenuBarView->addChild( menu );
gMenuBarView->createJumpKeys();
// Let land based option enable when parcel changes
gMenuParcelObserver = new LLMenuParcelObserver();
//
// Debug menu visiblity
//
show_debug_menus();
gLoginMenuBarView = (LLMenuBarGL*)LLUICtrlFactory::getInstance()->buildMenu("menu_login.xml", gMenuHolder);
menu = new LLMenuGL(CLIENT_MENU_NAME);
menu->setCanTearOff(FALSE);
menu->addChild(new LLMenuItemCallGL("Debug Settings...", handle_singleton_toggle<LLFloaterSettingsDebug>, NULL, NULL));
// Debugging view for unified notifications: CTRL-SHIFT-5
menu->addChild(new LLMenuItemCallGL("Notifications Console...", handle_show_notifications_console, NULL, NULL, '5', MASK_CONTROL|MASK_SHIFT));
menu->addChild(new LLMenuItemCallGL("Load from XML...", handle_load_from_xml));
gLoginMenuBarView->addChild(menu);
menu->updateParent(LLMenuGL::sMenuContainer);
gLoginMenuBarView->arrangeAndClear();
LLRect menuBarRect = gLoginMenuBarView->getRect();
menuBarRect.setLeftTopAndSize(0, gMenuHolder->getRect().getHeight(), gMenuHolder->getRect().getWidth(), menuBarRect.getHeight());
gLoginMenuBarView->setRect(menuBarRect);
/*gLoginMenuBarView->setRect(LLRect(menuBarRect.mLeft, menuBarRect.mTop,
gViewerWindow->getRootView()->getRect().getWidth() - menuBarRect.mLeft,
menuBarRect.mBottom));*/
gLoginMenuBarView->setBackgroundColor( color );
gMenuHolder->addChild(gLoginMenuBarView);
// Singu Note: Initialize common ScrollListMenus here
sScrollListMenus[0] = LLUICtrlFactory::getInstance()->buildMenu("menu_avs_list.xml", gMenuHolder);
//sScrollListMenus[1] = LLUICtrlFactory::getInstance()->buildMenu("menu_groups_list.xml"); // Singu TODO
LLView* ins = gMenuBarView->getChildView("insert_world", true, false);
ins->setVisible(false);
ins = gMenuBarView->getChildView("insert_agent", true, false);
ins->setVisible(false);
ins = gMenuBarView->getChildView("insert_tools", true, false);
ins->setVisible(false);
/* Singu Note: When the advanced and/or admin menus are made xml, these should be uncommented.
ins = gMenuBarView->getChildView("insert_advanced", true, false);
ins->setVisible(false);
ins = gMenuBarView->getChildView("insert_admin", true, false);
ins->setVisible(false);*/
gAgent.addRegionChangedCallback(®ion_change);
}
void init_client_menu(LLMenuGL* menu)
{
LLMenuGL* sub_menu = NULL;
{
// *TODO: Translate
LLMenuGL* sub = new LLMenuGL("Consoles");
sub->setCanTearOff(TRUE);
menu->addChild(sub);
sub->addChild(new LLMenuItemCheckGL("Frame Console",
&toggle_visibility,
NULL,
&get_visibility,
(void*)gDebugView->mFrameStatView,
'2', MASK_CONTROL|MASK_SHIFT ) );
sub->addChild(new LLMenuItemCheckGL("Texture Console",
&toggle_visibility,
NULL,
&get_visibility,
(void*)gTextureView,
'3', MASK_CONTROL|MASK_SHIFT ) );
LLView* debugview = gDebugView->mDebugConsolep;
sub->addChild(new LLMenuItemCheckGL("Debug Console",
&toggle_visibility,
NULL,
&get_visibility,
debugview,
'4', MASK_CONTROL|MASK_SHIFT ) );
if(gAuditTexture)
{
sub->addChild(new LLMenuItemCheckGL("Texture Size Console",
&toggle_visibility,
NULL,
&get_visibility,
(void*)gTextureSizeView,
'5', MASK_CONTROL|MASK_SHIFT ) );
sub->addChild(new LLMenuItemCheckGL("Texture Category Console",
&toggle_visibility,
NULL,
&get_visibility,
(void*)gTextureCategoryView,
'6', MASK_CONTROL|MASK_SHIFT ) );
}
sub->addChild(new LLMenuItemCheckGL("HTTP Console",
&toggle_visibility,
NULL,
&get_visibility,
(void*)gHttpView,
'7', MASK_CONTROL|MASK_SHIFT ) );
sub->addChild(new LLMenuItemCheckGL("Region Debug Console", handle_singleton_toggle<LLFloaterRegionDebugConsole>, NULL, handle_singleton_check<LLFloaterRegionDebugConsole>,NULL,'`', MASK_CONTROL|MASK_SHIFT));
sub->addChild(new LLMenuItemCheckGL("Fast Timers",
&toggle_visibility,
NULL,
&get_visibility,
(void*)gDebugView->mFastTimerView,
'9', MASK_CONTROL|MASK_SHIFT ) );
sub->addSeparator();
// Debugging view for unified notifications
sub->addChild(new LLMenuItemCallGL("Notifications Console...",
&handle_show_notifications_console, NULL, NULL, '5', MASK_CONTROL|MASK_SHIFT ));
sub->addSeparator();
sub->addChild(new LLMenuItemCallGL("Region Info to Debug Console",
&handle_region_dump_settings, NULL));
sub->addChild(new LLMenuItemCallGL("Group Info to Debug Console",
&handle_dump_group_info, NULL, NULL));
sub->addChild(new LLMenuItemCallGL("Capabilities Info to Debug Console",
&handle_dump_capabilities_info, NULL, NULL));
sub->createJumpKeys();
}
// neither of these works particularly well at the moment
/*menu->addChild(new LLMenuItemCallGL( "Reload UI XML", &reload_ui,
NULL, NULL) );*/
/*menu->addChild(new LLMenuItemCallGL("Reload settings/colors",
&handle_reload_settings, NULL, NULL));*/
menu->addChild(new LLMenuItemCallGL("Reload personal setting overrides",
&reload_personal_settings_overrides));
sub_menu = new LLMenuGL("HUD Info");
{
sub_menu->setCanTearOff(TRUE);
sub_menu->addChild(new LLMenuItemCheckGL("Velocity",
&toggle_visibility,
NULL,
&get_visibility,
(void*)gVelocityBar));
sub_menu->addChild(new LLMenuItemToggleGL("Camera", &gDisplayCameraPos ) );
sub_menu->addChild(new LLMenuItemToggleGL("Wind", &gDisplayWindInfo) );
sub_menu->addChild(new LLMenuItemToggleGL("FOV", &gDisplayFOV ) );
sub_menu->createJumpKeys();
}
menu->addChild(sub_menu);
menu->addSeparator();
menu->addChild(new LLMenuItemCheckGL( "High-res Snapshot",
&menu_toggle_control,
NULL,
&menu_check_control,
(void*)"HighResSnapshot"));
menu->addChild(new LLMenuItemCheckGL( "Quiet Snapshots to Disk",
&menu_toggle_control,
NULL,
&menu_check_control,
(void*)"QuietSnapshotsToDisk"));
menu->addChild(new LLMenuItemCheckGL("Show Mouselook Crosshairs",
&menu_toggle_control,
NULL,
&menu_check_control,
(void*)"ShowCrosshairs"));
menu->addChild(new LLMenuItemCheckGL("Debug Permissions",
&menu_toggle_control,
NULL,
&menu_check_control,
(void*)"DebugPermissions"));
// <dogmode>
#ifdef TOGGLE_HACKED_GODLIKE_VIEWER
if (!LLViewerLogin::getInstance()->isInProductionGrid())
{
menu->addChild(new LLMenuItemCheckGL("Hacked Godmode",
&handle_toggle_hacked_godmode,
NULL,
&check_toggle_hacked_godmode,
(void*)"HackedGodmode"));
}
#endif
// </dogmode>
menu->addChild(new LLMenuItemCallGL("Clear Group Cache",
LLGroupMgr::debugClearAllGroups));
menu->addChild(new LLMenuItemCheckGL("Use Web Map Tiles", menu_toggle_control, NULL, menu_check_control, (void*)"UseWebMapTiles"));
menu->addSeparator();
sub_menu = new LLMenuGL("Rendering");
sub_menu->setCanTearOff(TRUE);
init_debug_rendering_menu(sub_menu);
menu->addChild(sub_menu);
sub_menu = new LLMenuGL("World");
sub_menu->setCanTearOff(TRUE);
init_debug_world_menu(sub_menu);
menu->addChild(sub_menu);
// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.1b | OK
sub_menu = new LLMenuGL("RLVa Embedded");
init_debug_rlva_menu(sub_menu);
menu->addChild(sub_menu);
// Top Level Menu as well
sub_menu = new LLMenuGL("RLVa Main");
init_debug_rlva_menu(sub_menu);
gMenuBarView->addChild(sub_menu);
// [/RLVa:KB]
sub_menu = new LLMenuGL("UI");
sub_menu->setCanTearOff(TRUE);
init_debug_ui_menu(sub_menu);
menu->addChild(sub_menu);
sub_menu = new LLMenuGL("XUI");
sub_menu->setCanTearOff(TRUE);
init_debug_xui_menu(sub_menu);
menu->addChild(sub_menu);
sub_menu = new LLMenuGL("Character");
sub_menu->setCanTearOff(TRUE);
init_debug_avatar_menu(sub_menu);
menu->addChild(sub_menu);
{
LLMenuGL* sub = NULL;
sub = new LLMenuGL("Network");
sub->setCanTearOff(TRUE);
sub->addChild(new LLMenuItemCallGL( "Message Log", &handle_open_message_log, NULL));
sub->addChild(new LLMenuItemCallGL("Enable Message Log",
&handle_viewer_enable_message_log, NULL));
sub->addChild(new LLMenuItemCallGL("Disable Message Log",
&handle_viewer_disable_message_log, NULL));
sub->addSeparator();
sub->addChild(new LLMenuItemCheckGL("Velocity Interpolate Objects",
&velocity_interpolate,
NULL,
&menu_check_control,
(void*)"VelocityInterpolate"));
sub->addChild(new LLMenuItemCheckGL("Ping Interpolate Object Positions",
&menu_toggle_control,
NULL,
&menu_check_control,
(void*)"PingInterpolate"));
sub->addSeparator();
sub->addChild(new LLMenuItemCallGL("Drop a Packet",
&drop_packet, NULL, NULL,
'L', MASK_ALT | MASK_CONTROL));
menu->addChild( sub );
sub->createJumpKeys();
}
{
LLMenuGL* sub = NULL;
sub = new LLMenuGL("Recorder");
sub->setCanTearOff(TRUE);
sub->addChild(new LLMenuItemCheckGL("Full Session Logging", &menu_toggle_control, NULL, &menu_check_control, (void*)"StatsSessionTrackFrameStats"));
sub->addChild(new LLMenuItemCallGL("Start Logging", &LLFrameStats::startLogging, NULL));
sub->addChild(new LLMenuItemCallGL("Stop Logging", &LLFrameStats::stopLogging, NULL));
sub->addChild(new LLMenuItemCallGL("Log 10 Seconds", &LLFrameStats::timedLogging10, NULL));
sub->addChild(new LLMenuItemCallGL("Log 30 Seconds", &LLFrameStats::timedLogging30, NULL));
sub->addChild(new LLMenuItemCallGL("Log 60 Seconds", &LLFrameStats::timedLogging60, NULL));
sub->addSeparator();
sub->addChild(new LLMenuItemCallGL("Start Playback", &LLAgentPilot::startPlayback, NULL));
sub->addChild(new LLMenuItemCallGL("Stop Playback", &LLAgentPilot::stopPlayback, NULL));
sub->addChild(new LLMenuItemToggleGL("Loop Playback", &LLAgentPilot::sLoop) );
sub->addChild(new LLMenuItemCallGL("Start Record", &LLAgentPilot::startRecord, NULL));
sub->addChild(new LLMenuItemCallGL("Stop Record", &LLAgentPilot::saveRecord, NULL));
menu->addChild( sub );
sub->createJumpKeys();
}
{
LLMenuGL* sub = NULL;
sub = new LLMenuGL("Media");
sub->setCanTearOff(TRUE);
sub->addChild(new LLMenuItemCallGL("Reload MIME types", &LLMIMETypes::reload));
sub->addChild(new LLMenuItemCallGL("Web Browser Test", &handle_web_browser_test, NULL, NULL, KEY_F1));
menu->addChild( sub );
sub->createJumpKeys();