aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewermenu.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:50 -0500
committerJacek Antonelli2008-08-15 23:44:50 -0500
commit89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch)
treebcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/newview/llviewermenu.cpp
parentSecond Life viewer sources 1.13.3.2 (diff)
downloadmeta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz
Second Life viewer sources 1.14.0.0
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewermenu.cpp1078
1 files changed, 509 insertions, 569 deletions
diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp
index ab400de..217fb80 100644
--- a/linden/indra/newview/llviewermenu.cpp
+++ b/linden/indra/newview/llviewermenu.cpp
@@ -63,6 +63,7 @@
63 63
64// newview includes 64// newview includes
65#include "llagent.h" 65#include "llagent.h"
66
66#include "llagentpilot.h" 67#include "llagentpilot.h"
67#include "llbox.h" 68#include "llbox.h"
68#include "llcallingcard.h" 69#include "llcallingcard.h"
@@ -75,7 +76,6 @@
75#include "lldir.h" 76#include "lldir.h"
76#include "lldrawable.h" 77#include "lldrawable.h"
77#include "lldrawpoolalpha.h" 78#include "lldrawpoolalpha.h"
78#include "lldrawpoolhud.h"
79#include "lldrawpooltree.h" 79#include "lldrawpooltree.h"
80#include "llface.h" 80#include "llface.h"
81#include "llfirstuse.h" 81#include "llfirstuse.h"
@@ -107,7 +107,6 @@
107#include "llfloaterland.h" 107#include "llfloaterland.h"
108#include "llfloaterlandholdings.h" 108#include "llfloaterlandholdings.h"
109#include "llfloatermap.h" 109#include "llfloatermap.h"
110#include "llfloateraccounthistory.h"
111#include "llfloaterimagepreview.h" 110#include "llfloaterimagepreview.h"
112#include "llfloatermute.h" 111#include "llfloatermute.h"
113#include "llfloaternamedesc.h" 112#include "llfloaternamedesc.h"
@@ -282,7 +281,6 @@ typedef LLMemberListener<LLView> view_listener_t;
282// 281//
283// Local prototypes 282// Local prototypes
284// 283//
285BOOL enable_attach(void*);
286void handle_leave_group(void *); 284void handle_leave_group(void *);
287 285
288// File Menu 286// File Menu
@@ -294,6 +292,7 @@ BOOL enable_save_as(void *);
294 292
295// Edit menu 293// Edit menu
296void handle_dump_group_info(void *); 294void handle_dump_group_info(void *);
295void handle_dump_capabilities_info(void *);
297void handle_dump_focus(void*); 296void handle_dump_focus(void*);
298 297
299void handle_region_dump_settings(void*); 298void handle_region_dump_settings(void*);
@@ -354,9 +353,6 @@ BOOL check_toggle_hacked_godmode(void*);
354void toggle_glow(void *); 353void toggle_glow(void *);
355BOOL check_glow(void *); 354BOOL check_glow(void *);
356 355
357void toggle_vbo(void *);
358BOOL check_vbo(void *);
359
360void toggle_vertex_shaders(void *); 356void toggle_vertex_shaders(void *);
361BOOL check_vertex_shaders(void *); 357BOOL check_vertex_shaders(void *);
362 358
@@ -438,9 +434,6 @@ BOOL get_visibility(void*);
438void request_friendship(const LLUUID& agent_id); 434void request_friendship(const LLUUID& agent_id);
439 435
440// Tools menu 436// Tools menu
441void handle_first_tool(void*);
442void handle_next_tool(void*);
443void handle_previous_tool(void*);
444void handle_force_unlock(void*); 437void handle_force_unlock(void*);
445void handle_selected_texture_info(void*); 438void handle_selected_texture_info(void*);
446void handle_dump_image_list(void*); 439void handle_dump_image_list(void*);
@@ -448,8 +441,6 @@ void handle_dump_image_list(void*);
448void handle_fullscreen_debug(void*); 441void handle_fullscreen_debug(void*);
449void handle_crash(void*); 442void handle_crash(void*);
450void handle_dump_followcam(void*); 443void handle_dump_followcam(void*);
451void handle_viewer_enable_circuit_log(void*);
452void handle_viewer_disable_circuit_log(void*);
453void handle_viewer_enable_message_log(void*); 444void handle_viewer_enable_message_log(void*);
454void handle_viewer_disable_message_log(void*); 445void handle_viewer_disable_message_log(void*);
455void handle_send_postcard(void*); 446void handle_send_postcard(void*);
@@ -565,52 +556,14 @@ void init_menus()
565 // Main menu bar 556 // Main menu bar
566 // 557 //
567 gMenuHolder = new LLViewerMenuHolderGL(); 558 gMenuHolder = new LLViewerMenuHolderGL();
568 gMenuHolder->setRect(LLRect(0, top - MENU_BAR_HEIGHT, width, STATUS_BAR_HEIGHT)); 559 gMenuHolder->setRect(LLRect(0, top, width, 0));
569 gMenuHolder->setFollowsAll(); 560 gMenuHolder->setFollowsAll();
570 561
571 LLMenuGL::sDefaultMenuContainer = gMenuHolder; 562 LLMenuGL::sMenuContainer = gMenuHolder;
572 563
573 // Initialize actions 564 // Initialize actions
574 initialize_menu_actions(); 565 initialize_menu_actions();
575 566
576 gMenuBarView = (LLMenuBarGL*)gUICtrlFactory->buildMenu("menu_viewer.xml", gMenuHolder);
577 gMenuBarView->setRect(LLRect(0, top, width, top - MENU_BAR_HEIGHT));
578 gViewerWindow->getRootView()->addChild(gMenuBarView);
579
580 // menu holder appears on top of menu bar so you can see the menu title
581 // flash when an item is triggered (the flash occurs in the holder)
582 gViewerWindow->getRootView()->addChild(gMenuHolder);
583
584 gMenuHolder->childSetLabelArg("Upload Image", "[COST]", "10");
585 gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", "10");
586 gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", "10");
587 gMenuHolder->childSetLabelArg("Bulk Upload", "[COST]", "10");
588
589 gAFKMenu = (LLMenuItemCallGL*)gMenuBarView->getChildByName("Set Away", TRUE);
590 gBusyMenu = (LLMenuItemCallGL*)gMenuBarView->getChildByName("Set Busy", TRUE);
591 gAttachSubMenu = gMenuBarView->getChildMenuByName("Attach Object", TRUE);
592 gDetachSubMenu = gMenuBarView->getChildMenuByName("Detach Object", TRUE);
593
594 if (gAgent.mAccess < SIM_ACCESS_MATURE)
595 {
596 gMenuBarView->getChildByName("Menu Underpants", TRUE)->setVisible(FALSE);
597 gMenuBarView->getChildByName("Menu Undershirt", TRUE)->setVisible(FALSE);
598 }
599
600 // TomY TODO convert these two
601 LLMenuGL*menu;
602 menu = new LLMenuGL(CLIENT_MENU_NAME);
603 init_client_menu(menu);
604 gMenuBarView->appendMenu( menu );
605 menu->updateParent(gMenuHolder);
606
607 menu = new LLMenuGL(SERVER_MENU_NAME);
608 init_server_menu(menu);
609 gMenuBarView->appendMenu( menu );
610 menu->updateParent(gMenuHolder);
611
612 gMenuBarView->createJumpKeys();
613
614 /// 567 ///
615 /// Popup menu 568 /// Popup menu
616 /// 569 ///
@@ -653,6 +606,16 @@ void init_menus()
653 /// 606 ///
654 LLColor4 color; 607 LLColor4 color;
655 608
609 LLColor4 pie_color = gColors.getColor("PieMenuBgColor");
610 gPieSelf->setBackgroundColor( pie_color );
611 gPieAvatar->setBackgroundColor( pie_color );
612 gPieObject->setBackgroundColor( pie_color );
613 gPieAttachment->setBackgroundColor( pie_color );
614 gPieLand->setBackgroundColor( pie_color );
615
616 color = gColors.getColor( "MenuPopupBgColor" );
617 gPopupMenuView->setBackgroundColor( color );
618
656 // If we are not in production, use a different color to make it apparent. 619 // If we are not in production, use a different color to make it apparent.
657 if (gInProductionGrid) 620 if (gInProductionGrid)
658 { 621 {
@@ -662,18 +625,45 @@ void init_menus()
662 { 625 {
663 color = gColors.getColor( "MenuNonProductionBgColor" ); 626 color = gColors.getColor( "MenuNonProductionBgColor" );
664 } 627 }
665 628 gMenuBarView = (LLMenuBarGL*)gUICtrlFactory->buildMenu("menu_viewer.xml", gMenuHolder);
629 gMenuBarView->setRect(LLRect(0, top, 0, top - MENU_BAR_HEIGHT));
666 gMenuBarView->setBackgroundColor( color ); 630 gMenuBarView->setBackgroundColor( color );
667 631
668 LLColor4 pie_color = gColors.getColor("PieMenuBgColor"); 632 gMenuHolder->addChild(gMenuBarView);
669 gPieSelf->setBackgroundColor( pie_color ); 633
670 gPieAvatar->setBackgroundColor( pie_color ); 634 // menu holder appears on top of menu bar so you can see the menu title
671 gPieObject->setBackgroundColor( pie_color ); 635 // flash when an item is triggered (the flash occurs in the holder)
672 gPieAttachment->setBackgroundColor( pie_color ); 636 gViewerWindow->getRootView()->addChild(gMenuHolder);
673 gPieLand->setBackgroundColor( pie_color );
674 637
675 color = gColors.getColor( "MenuPopupBgColor" ); 638 gMenuHolder->childSetLabelArg("Upload Image", "[COST]", "10");
676 gPopupMenuView->setBackgroundColor( color ); 639 gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", "10");
640 gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", "10");
641 gMenuHolder->childSetLabelArg("Bulk Upload", "[COST]", "10");
642
643 gAFKMenu = (LLMenuItemCallGL*)gMenuBarView->getChildByName("Set Away", TRUE);
644 gBusyMenu = (LLMenuItemCallGL*)gMenuBarView->getChildByName("Set Busy", TRUE);
645 gAttachSubMenu = gMenuBarView->getChildMenuByName("Attach Object", TRUE);
646 gDetachSubMenu = gMenuBarView->getChildMenuByName("Detach Object", TRUE);
647
648 if (gAgent.mAccess < SIM_ACCESS_MATURE)
649 {
650 gMenuBarView->getChildByName("Menu Underpants", TRUE)->setVisible(FALSE);
651 gMenuBarView->getChildByName("Menu Undershirt", TRUE)->setVisible(FALSE);
652 }
653
654 // TomY TODO convert these two
655 LLMenuGL*menu;
656 menu = new LLMenuGL(CLIENT_MENU_NAME);
657 init_client_menu(menu);
658 gMenuBarView->appendMenu( menu );
659 menu->updateParent(LLMenuGL::sMenuContainer);
660
661 menu = new LLMenuGL(SERVER_MENU_NAME);
662 init_server_menu(menu);
663 gMenuBarView->appendMenu( menu );
664 menu->updateParent(LLMenuGL::sMenuContainer);
665
666 gMenuBarView->createJumpKeys();
677 667
678 // Let land based option enable when parcel changes 668 // Let land based option enable when parcel changes
679 gMenuParcelObserver = new LLMenuParcelObserver(); 669 gMenuParcelObserver = new LLMenuParcelObserver();
@@ -746,6 +736,8 @@ void init_client_menu(LLMenuGL* menu)
746 &handle_region_dump_settings, NULL)); 736 &handle_region_dump_settings, NULL));
747 sub->append(new LLMenuItemCallGL("Group Info to Debug Console", 737 sub->append(new LLMenuItemCallGL("Group Info to Debug Console",
748 &handle_dump_group_info, NULL, NULL)); 738 &handle_dump_group_info, NULL, NULL));
739 sub->append(new LLMenuItemCallGL("Capabilities Info to Debug Console",
740 &handle_dump_capabilities_info, NULL, NULL));
749 sub->createJumpKeys(); 741 sub->createJumpKeys();
750 } 742 }
751 743
@@ -783,6 +775,12 @@ void init_client_menu(LLMenuGL* menu)
783 menu->append(new LLMenuItemToggleGL("Quiet Snapshots to Disk", 775 menu->append(new LLMenuItemToggleGL("Quiet Snapshots to Disk",
784 &gQuietSnapshot)); 776 &gQuietSnapshot));
785 777
778 menu->append(new LLMenuItemCheckGL( "Compress Snapshots to Disk",
779 &menu_toggle_control,
780 NULL,
781 &menu_check_control,
782 (void*)"CompressSnapshotsToDisk"));
783
786 menu->append(new LLMenuItemCheckGL("Show Mouselook Crosshairs", 784 menu->append(new LLMenuItemCheckGL("Show Mouselook Crosshairs",
787 &menu_toggle_control, 785 &menu_toggle_control,
788 NULL, 786 NULL,
@@ -836,10 +834,6 @@ void init_client_menu(LLMenuGL* menu)
836 LLMenuGL* sub = NULL; 834 LLMenuGL* sub = NULL;
837 sub = new LLMenuGL("Network"); 835 sub = new LLMenuGL("Network");
838 836
839 sub->append(new LLMenuItemCallGL("Enable Circuit Log",
840 &handle_viewer_enable_circuit_log, NULL));
841 sub->append(new LLMenuItemCallGL("Disable Circuit Log",
842 &handle_viewer_disable_circuit_log, NULL));
843 sub->append(new LLMenuItemCallGL("Enable Message Log", 837 sub->append(new LLMenuItemCallGL("Enable Message Log",
844 &handle_viewer_enable_message_log, NULL)); 838 &handle_viewer_enable_message_log, NULL));
845 sub->append(new LLMenuItemCallGL("Disable Message Log", 839 sub->append(new LLMenuItemCallGL("Disable Message Log",
@@ -909,6 +903,11 @@ void init_client_menu(LLMenuGL* menu)
909 menu->append(new LLMenuItemToggleGL("Disable Camera Constraints", 903 menu->append(new LLMenuItemToggleGL("Disable Camera Constraints",
910 &LLViewerCamera::sDisableCameraConstraints)); 904 &LLViewerCamera::sDisableCameraConstraints));
911 905
906 menu->append(new LLMenuItemCheckGL("Mouse Smoothing",
907 &menu_toggle_control,
908 NULL,
909 &menu_check_control,
910 (void*) "MouseSmooth"));
912 menu->appendSeparator(); 911 menu->appendSeparator();
913 912
914 menu->append(new LLMenuItemCheckGL( "Console Window", 913 menu->append(new LLMenuItemCheckGL( "Console Window",
@@ -1004,6 +1003,7 @@ void init_debug_ui_menu(LLMenuGL* menu)
1004 menu->append(new LLMenuItemToggleGL("Debug SelectMgr", &gDebugSelectMgr)); 1003 menu->append(new LLMenuItemToggleGL("Debug SelectMgr", &gDebugSelectMgr));
1005 menu->append(new LLMenuItemToggleGL("Debug Clicks", &gDebugClicks)); 1004 menu->append(new LLMenuItemToggleGL("Debug Clicks", &gDebugClicks));
1006 menu->append(new LLMenuItemToggleGL("Debug Views", &LLView::sDebugRects)); 1005 menu->append(new LLMenuItemToggleGL("Debug Views", &LLView::sDebugRects));
1006 menu->append(new LLMenuItemCheckGL("Show Name Tooltips", toggle_show_xui_names, NULL, check_show_xui_names, NULL));
1007 menu->append(new LLMenuItemToggleGL("Debug Mouse Events", &LLView::sDebugMouseHandling)); 1007 menu->append(new LLMenuItemToggleGL("Debug Mouse Events", &LLView::sDebugMouseHandling));
1008 menu->append(new LLMenuItemToggleGL("Debug Keys", &LLView::sDebugKeys)); 1008 menu->append(new LLMenuItemToggleGL("Debug Keys", &LLView::sDebugKeys));
1009 menu->append(new LLMenuItemToggleGL("Debug WindowProc", &gDebugWindowProc)); 1009 menu->append(new LLMenuItemToggleGL("Debug WindowProc", &gDebugWindowProc));
@@ -1036,56 +1036,56 @@ void init_debug_rendering_menu(LLMenuGL* menu)
1036 menu->appendMenu(sub_menu); 1036 menu->appendMenu(sub_menu);
1037 1037
1038 sub_menu->append(new LLMenuItemCheckGL("Simple", 1038 sub_menu->append(new LLMenuItemCheckGL("Simple",
1039 &LLPipeline::toggleRenderType, NULL, 1039 &LLPipeline::toggleRenderTypeControl, NULL,
1040 &LLPipeline::toggleRenderTypeControl, 1040 &LLPipeline::hasRenderTypeControl,
1041 (void*)LLPipeline::RENDER_TYPE_SIMPLE, '1', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); 1041 (void*)LLPipeline::RENDER_TYPE_SIMPLE, '1', MASK_CONTROL|MASK_ALT|MASK_SHIFT));
1042 sub_menu->append(new LLMenuItemCheckGL("Alpha", 1042 sub_menu->append(new LLMenuItemCheckGL("Alpha",
1043 &LLPipeline::toggleRenderType, NULL, 1043 &LLPipeline::toggleRenderTypeControl, NULL,
1044 &LLPipeline::toggleRenderTypeControl, 1044 &LLPipeline::hasRenderTypeControl,
1045 (void*)LLPipeline::RENDER_TYPE_ALPHA, '2', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); 1045 (void*)LLPipeline::RENDER_TYPE_ALPHA, '2', MASK_CONTROL|MASK_ALT|MASK_SHIFT));
1046 sub_menu->append(new LLMenuItemCheckGL("Tree", 1046 sub_menu->append(new LLMenuItemCheckGL("Tree",
1047 &LLPipeline::toggleRenderType, NULL, 1047 &LLPipeline::toggleRenderTypeControl, NULL,
1048 &LLPipeline::toggleRenderTypeControl, 1048 &LLPipeline::hasRenderTypeControl,
1049 (void*)LLPipeline::RENDER_TYPE_TREE, '3', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); 1049 (void*)LLPipeline::RENDER_TYPE_TREE, '3', MASK_CONTROL|MASK_ALT|MASK_SHIFT));
1050 sub_menu->append(new LLMenuItemCheckGL("Character", 1050 sub_menu->append(new LLMenuItemCheckGL("Character",
1051 &LLPipeline::toggleRenderType, NULL, 1051 &LLPipeline::toggleRenderTypeControl, NULL,
1052 &LLPipeline::toggleRenderTypeControl, 1052 &LLPipeline::hasRenderTypeControl,
1053 (void*)LLPipeline::RENDER_TYPE_AVATAR, '4', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); 1053 (void*)LLPipeline::RENDER_TYPE_AVATAR, '4', MASK_CONTROL|MASK_ALT|MASK_SHIFT));
1054 sub_menu->append(new LLMenuItemCheckGL("SurfacePatch", 1054 sub_menu->append(new LLMenuItemCheckGL("SurfacePatch",
1055 &LLPipeline::toggleRenderType, NULL, 1055 &LLPipeline::toggleRenderTypeControl, NULL,
1056 &LLPipeline::toggleRenderTypeControl, 1056 &LLPipeline::hasRenderTypeControl,
1057 (void*)LLPipeline::RENDER_TYPE_TERRAIN, '5', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); 1057 (void*)LLPipeline::RENDER_TYPE_TERRAIN, '5', MASK_CONTROL|MASK_ALT|MASK_SHIFT));
1058 sub_menu->append(new LLMenuItemCheckGL("Sky", 1058 sub_menu->append(new LLMenuItemCheckGL("Sky",
1059 &LLPipeline::toggleRenderType, NULL, 1059 &LLPipeline::toggleRenderTypeControl, NULL,
1060 &LLPipeline::toggleRenderTypeControl, 1060 &LLPipeline::hasRenderTypeControl,
1061 (void*)LLPipeline::RENDER_TYPE_SKY, '6', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); 1061 (void*)LLPipeline::RENDER_TYPE_SKY, '6', MASK_CONTROL|MASK_ALT|MASK_SHIFT));
1062 sub_menu->append(new LLMenuItemCheckGL("Water", 1062 sub_menu->append(new LLMenuItemCheckGL("Water",
1063 &LLPipeline::toggleRenderType, NULL, 1063 &LLPipeline::toggleRenderTypeControl, NULL,
1064 &LLPipeline::toggleRenderTypeControl, 1064 &LLPipeline::hasRenderTypeControl,
1065 (void*)LLPipeline::RENDER_TYPE_WATER, '7', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); 1065 (void*)LLPipeline::RENDER_TYPE_WATER, '7', MASK_CONTROL|MASK_ALT|MASK_SHIFT));
1066 sub_menu->append(new LLMenuItemCheckGL("Ground", 1066 sub_menu->append(new LLMenuItemCheckGL("Ground",
1067 &LLPipeline::toggleRenderType, NULL, 1067 &LLPipeline::toggleRenderTypeControl, NULL,
1068 &LLPipeline::toggleRenderTypeControl, 1068 &LLPipeline::hasRenderTypeControl,
1069 (void*)LLPipeline::RENDER_TYPE_GROUND, '8', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); 1069 (void*)LLPipeline::RENDER_TYPE_GROUND, '8', MASK_CONTROL|MASK_ALT|MASK_SHIFT));
1070 sub_menu->append(new LLMenuItemCheckGL("Volume", 1070 sub_menu->append(new LLMenuItemCheckGL("Volume",
1071 &LLPipeline::toggleRenderType, NULL, 1071 &LLPipeline::toggleRenderTypeControl, NULL,
1072 &LLPipeline::toggleRenderTypeControl, 1072 &LLPipeline::hasRenderTypeControl,
1073 (void*)LLPipeline::RENDER_TYPE_VOLUME, '9', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); 1073 (void*)LLPipeline::RENDER_TYPE_VOLUME, '9', MASK_CONTROL|MASK_ALT|MASK_SHIFT));
1074 sub_menu->append(new LLMenuItemCheckGL("Grass", 1074 sub_menu->append(new LLMenuItemCheckGL("Grass",
1075 &LLPipeline::toggleRenderType, NULL, 1075 &LLPipeline::toggleRenderTypeControl, NULL,
1076 &LLPipeline::toggleRenderTypeControl, 1076 &LLPipeline::hasRenderTypeControl,
1077 (void*)LLPipeline::RENDER_TYPE_GRASS, '0', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); 1077 (void*)LLPipeline::RENDER_TYPE_GRASS, '0', MASK_CONTROL|MASK_ALT|MASK_SHIFT));
1078 sub_menu->append(new LLMenuItemCheckGL("Clouds", 1078 sub_menu->append(new LLMenuItemCheckGL("Clouds",
1079 &LLPipeline::toggleRenderType, NULL, 1079 &LLPipeline::toggleRenderTypeControl, NULL,
1080 &LLPipeline::toggleRenderTypeControl, 1080 &LLPipeline::hasRenderTypeControl,
1081 (void*)LLPipeline::RENDER_TYPE_CLOUDS, '-', MASK_CONTROL|MASK_ALT| MASK_SHIFT)); 1081 (void*)LLPipeline::RENDER_TYPE_CLOUDS, '-', MASK_CONTROL|MASK_ALT| MASK_SHIFT));
1082 sub_menu->append(new LLMenuItemCheckGL("Particles", 1082 sub_menu->append(new LLMenuItemCheckGL("Particles",
1083 &LLPipeline::toggleRenderType, NULL, 1083 &LLPipeline::toggleRenderTypeControl, NULL,
1084 &LLPipeline::toggleRenderTypeControl, 1084 &LLPipeline::hasRenderTypeControl,
1085 (void*)LLPipeline::RENDER_TYPE_PARTICLES, '=', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); 1085 (void*)LLPipeline::RENDER_TYPE_PARTICLES, '=', MASK_CONTROL|MASK_ALT|MASK_SHIFT));
1086 sub_menu->append(new LLMenuItemCheckGL("Bump", 1086 sub_menu->append(new LLMenuItemCheckGL("Bump",
1087 &LLPipeline::toggleRenderType, NULL, 1087 &LLPipeline::toggleRenderTypeControl, NULL,
1088 &LLPipeline::toggleRenderTypeControl, 1088 &LLPipeline::hasRenderTypeControl,
1089 (void*)LLPipeline::RENDER_TYPE_BUMP, '\\', MASK_CONTROL|MASK_ALT|MASK_SHIFT)); 1089 (void*)LLPipeline::RENDER_TYPE_BUMP, '\\', MASK_CONTROL|MASK_ALT|MASK_SHIFT));
1090 sub_menu->createJumpKeys(); 1090 sub_menu->createJumpKeys();
1091 sub_menu = new LLMenuGL("Features"); 1091 sub_menu = new LLMenuGL("Features");
@@ -1106,6 +1106,10 @@ void init_debug_rendering_menu(LLMenuGL* menu)
1106 &LLPipeline::toggleRenderDebugFeature, NULL, 1106 &LLPipeline::toggleRenderDebugFeature, NULL,
1107 &LLPipeline::toggleRenderDebugFeatureControl, 1107 &LLPipeline::toggleRenderDebugFeatureControl,
1108 (void*)LLPipeline::RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES, '4', MASK_ALT|MASK_CONTROL)); 1108 (void*)LLPipeline::RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES, '4', MASK_ALT|MASK_CONTROL));
1109 sub_menu->append(new LLMenuItemCheckGL( "Foot Shadows",
1110 &LLPipeline::toggleRenderDebugFeature, NULL,
1111 &LLPipeline::toggleRenderDebugFeatureControl,
1112 (void*)LLPipeline::RENDER_DEBUG_FEATURE_FOOT_SHADOWS, '5', MASK_ALT|MASK_CONTROL));
1109 sub_menu->append(new LLMenuItemCheckGL("Fog", 1113 sub_menu->append(new LLMenuItemCheckGL("Fog",
1110 &LLPipeline::toggleRenderDebugFeature, NULL, 1114 &LLPipeline::toggleRenderDebugFeature, NULL,
1111 &LLPipeline::toggleRenderDebugFeatureControl, 1115 &LLPipeline::toggleRenderDebugFeatureControl,
@@ -1119,13 +1123,9 @@ void init_debug_rendering_menu(LLMenuGL* menu)
1119 &LLPipeline::toggleRenderDebugFeatureControl, 1123 &LLPipeline::toggleRenderDebugFeatureControl,
1120 (void*)LLPipeline::RENDER_DEBUG_FEATURE_FR_INFO, '8', MASK_ALT|MASK_CONTROL)); 1124 (void*)LLPipeline::RENDER_DEBUG_FEATURE_FR_INFO, '8', MASK_ALT|MASK_CONTROL));
1121 sub_menu->append(new LLMenuItemCheckGL( "Flexible Objects", 1125 sub_menu->append(new LLMenuItemCheckGL( "Flexible Objects",
1122 &LLPipeline::toggleRenderDebugFeature, NULL, 1126 &LLPipeline::toggleRenderDebugFeature, NULL,
1123 &LLPipeline::toggleRenderDebugFeatureControl, 1127 &LLPipeline::toggleRenderDebugFeatureControl,
1124 (void*)LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE, '9', MASK_ALT|MASK_CONTROL)); 1128 (void*)LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE, '9', MASK_ALT|MASK_CONTROL));
1125 sub_menu->append(new LLMenuItemCheckGL( "Chain Faces",
1126 &LLPipeline::toggleRenderDebugFeature, NULL,
1127 &LLPipeline::toggleRenderDebugFeatureControl,
1128 (void*)LLPipeline::RENDER_DEBUG_FEATURE_CHAIN_FACES, '0', MASK_ALT|MASK_CONTROL));
1129 sub_menu->createJumpKeys(); 1129 sub_menu->createJumpKeys();
1130 1130
1131 ///////////////////////////// 1131 /////////////////////////////
@@ -1138,9 +1138,6 @@ void init_debug_rendering_menu(LLMenuGL* menu)
1138 sub_menu->append(new LLMenuItemCheckGL("Verify", &LLPipeline::toggleRenderDebug, NULL, 1138 sub_menu->append(new LLMenuItemCheckGL("Verify", &LLPipeline::toggleRenderDebug, NULL,
1139 &LLPipeline::toggleRenderDebugControl, 1139 &LLPipeline::toggleRenderDebugControl,
1140 (void*)LLPipeline::RENDER_DEBUG_VERIFY)); 1140 (void*)LLPipeline::RENDER_DEBUG_VERIFY));
1141 sub_menu->append(new LLMenuItemCheckGL("AGP Map", &LLPipeline::toggleRenderDebug, NULL,
1142 &LLPipeline::toggleRenderDebugControl,
1143 (void*)LLPipeline::RENDER_DEBUG_AGP_MEM));
1144 sub_menu->append(new LLMenuItemCheckGL("BBoxes", &LLPipeline::toggleRenderDebug, NULL, 1141 sub_menu->append(new LLMenuItemCheckGL("BBoxes", &LLPipeline::toggleRenderDebug, NULL,
1145 &LLPipeline::toggleRenderDebugControl, 1142 &LLPipeline::toggleRenderDebugControl,
1146 (void*)LLPipeline::RENDER_DEBUG_BBOXES)); 1143 (void*)LLPipeline::RENDER_DEBUG_BBOXES));
@@ -1153,12 +1150,24 @@ void init_debug_rendering_menu(LLMenuGL* menu)
1153 sub_menu->append(new LLMenuItemCheckGL("Occlusion", &LLPipeline::toggleRenderDebug, NULL, 1150 sub_menu->append(new LLMenuItemCheckGL("Occlusion", &LLPipeline::toggleRenderDebug, NULL,
1154 &LLPipeline::toggleRenderDebugControl, 1151 &LLPipeline::toggleRenderDebugControl,
1155 (void*)LLPipeline::RENDER_DEBUG_OCCLUSION)); 1152 (void*)LLPipeline::RENDER_DEBUG_OCCLUSION));
1156 sub_menu->append(new LLMenuItemCheckGL("Face Chains", &LLPipeline::toggleRenderDebug, NULL, 1153 sub_menu->append(new LLMenuItemCheckGL("Animated Textures", &LLPipeline::toggleRenderDebug, NULL,
1157 &LLPipeline::toggleRenderDebugControl, 1154 &LLPipeline::toggleRenderDebugControl,
1158 (void*)LLPipeline::RENDER_DEBUG_FACE_CHAINS)); 1155 (void*)LLPipeline::RENDER_DEBUG_TEXTURE_ANIM));
1159 sub_menu->append(new LLMenuItemCheckGL("Texture Priority", &LLPipeline::toggleRenderDebug, NULL, 1156 sub_menu->append(new LLMenuItemCheckGL("Texture Priority", &LLPipeline::toggleRenderDebug, NULL,
1160 &LLPipeline::toggleRenderDebugControl, 1157 &LLPipeline::toggleRenderDebugControl,
1161 (void*)LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY)); 1158 (void*)LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY));
1159 sub_menu->append(new LLMenuItemCheckGL("Texture Area (sqrt(A))",&LLPipeline::toggleRenderDebug, NULL,
1160 &LLPipeline::toggleRenderDebugControl,
1161 (void*)LLPipeline::RENDER_DEBUG_TEXTURE_AREA));
1162 sub_menu->append(new LLMenuItemCheckGL("Face Area (sqrt(A))",&LLPipeline::toggleRenderDebug, NULL,
1163 &LLPipeline::toggleRenderDebugControl,
1164 (void*)LLPipeline::RENDER_DEBUG_FACE_AREA));
1165 sub_menu->append(new LLMenuItemCheckGL("Pick Render", &LLPipeline::toggleRenderDebug, NULL,
1166 &LLPipeline::toggleRenderDebugControl,
1167 (void*)LLPipeline::RENDER_DEBUG_PICKING));
1168 sub_menu->append(new LLMenuItemCheckGL("Particles", &LLPipeline::toggleRenderDebug, NULL,
1169 &LLPipeline::toggleRenderDebugControl,
1170 (void*)LLPipeline::RENDER_DEBUG_PARTICLES));
1162 sub_menu->append(new LLMenuItemCheckGL("Composition", &LLPipeline::toggleRenderDebug, NULL, 1171 sub_menu->append(new LLMenuItemCheckGL("Composition", &LLPipeline::toggleRenderDebug, NULL,
1163 &LLPipeline::toggleRenderDebugControl, 1172 &LLPipeline::toggleRenderDebugControl,
1164 (void*)LLPipeline::RENDER_DEBUG_COMPOSITION)); 1173 (void*)LLPipeline::RENDER_DEBUG_COMPOSITION));
@@ -1168,16 +1177,7 @@ void init_debug_rendering_menu(LLMenuGL* menu)
1168 sub_menu->append(new LLMenuItemCheckGL("LightTrace",&LLPipeline::toggleRenderDebug, NULL, 1177 sub_menu->append(new LLMenuItemCheckGL("LightTrace",&LLPipeline::toggleRenderDebug, NULL,
1169 &LLPipeline::toggleRenderDebugControl, 1178 &LLPipeline::toggleRenderDebugControl,
1170 (void*)LLPipeline::RENDER_DEBUG_LIGHT_TRACE)); 1179 (void*)LLPipeline::RENDER_DEBUG_LIGHT_TRACE));
1171 sub_menu->append(new LLMenuItemCheckGL("Pools", &LLPipeline::toggleRenderDebug, NULL, 1180
1172 &LLPipeline::toggleRenderDebugControl,
1173 (void*)LLPipeline::RENDER_DEBUG_POOLS));
1174 sub_menu->append(new LLMenuItemCheckGL("Queues", &LLPipeline::toggleRenderDebug, NULL,
1175 &LLPipeline::toggleRenderDebugControl,
1176 (void*)LLPipeline::RENDER_DEBUG_QUEUES));
1177 sub_menu->append(new LLMenuItemCheckGL("Map", &LLPipeline::toggleRenderDebug, NULL,
1178 LLPipeline::toggleRenderDebugControl,
1179 (void*)LLPipeline::RENDER_DEBUG_MAP));
1180
1181 sub_menu->append(new LLMenuItemCheckGL("Show Depth Buffer", 1181 sub_menu->append(new LLMenuItemCheckGL("Show Depth Buffer",
1182 &menu_toggle_control, 1182 &menu_toggle_control,
1183 NULL, 1183 NULL,
@@ -1202,8 +1202,6 @@ void init_debug_rendering_menu(LLMenuGL* menu)
1202 1202
1203 menu->appendSeparator(); 1203 menu->appendSeparator();
1204 menu->append(new LLMenuItemCheckGL("Axes", menu_toggle_control, NULL, menu_check_control, (void*)"ShowAxes")); 1204 menu->append(new LLMenuItemCheckGL("Axes", menu_toggle_control, NULL, menu_check_control, (void*)"ShowAxes"));
1205 menu->append(new LLMenuItemCheckGL("Use VBO", toggle_vbo, NULL, check_vbo, NULL));
1206 menu->append(new LLMenuItemCheckGL("Light Glows", toggle_glow, NULL, check_glow, NULL));
1207// menu->append(new LLMenuItemCheckGL("Cull Small Objects", toggle_cull_small, NULL, menu_check_control, (void*)"RenderCullBySize")); 1205// menu->append(new LLMenuItemCheckGL("Cull Small Objects", toggle_cull_small, NULL, menu_check_control, (void*)"RenderCullBySize"));
1208 1206
1209 menu->appendSeparator(); 1207 menu->appendSeparator();
@@ -1228,6 +1226,19 @@ void init_debug_rendering_menu(LLMenuGL* menu)
1228 item = new LLMenuItemCheckGL("Disable Textures", menu_toggle_variable, NULL, menu_check_variable, (void*)&LLViewerImage::sDontLoadVolumeTextures); 1226 item = new LLMenuItemCheckGL("Disable Textures", menu_toggle_variable, NULL, menu_check_variable, (void*)&LLViewerImage::sDontLoadVolumeTextures);
1229 menu->append(item); 1227 menu->append(item);
1230 1228
1229#ifndef LL_RELEASE_FOR_DOWNLOAD
1230 item = new LLMenuItemCheckGL("HTTP Get Textures", menu_toggle_control, NULL, menu_check_control, (void*)"ImagePipelineUseHTTP");
1231 menu->append(item);
1232#endif
1233
1234 item = new LLMenuItemCheckGL("Run Multiple Threads", menu_toggle_control, NULL, menu_check_control, (void*)"RunMultipleThreads");
1235 menu->append(item);
1236
1237#ifndef LL_RELEASE_FOR_DOWNLOAD
1238 item = new LLMenuItemCheckGL("Dynamic Reflections", menu_toggle_control, NULL, menu_check_control, (void*)"RenderDynamicReflections");
1239 menu->append(item);
1240#endif
1241
1231 item = new LLMenuItemCheckGL("Cheesy Beacon", menu_toggle_control, NULL, menu_check_control, (void*)"CheesyBeacon"); 1242 item = new LLMenuItemCheckGL("Cheesy Beacon", menu_toggle_control, NULL, menu_check_control, (void*)"CheesyBeacon");
1232 menu->append(item); 1243 menu->append(item);
1233 1244
@@ -1284,10 +1295,6 @@ void init_debug_avatar_menu(LLMenuGL* menu)
1284 //menu->append(new LLMenuItemToggleGL("Show Attachment Points", &LLVOAvatar::sShowAttachmentPoints)); 1295 //menu->append(new LLMenuItemToggleGL("Show Attachment Points", &LLVOAvatar::sShowAttachmentPoints));
1285 menu->append(new LLMenuItemToggleGL("Show Collision Plane", &LLVOAvatar::sShowFootPlane)); 1296 menu->append(new LLMenuItemToggleGL("Show Collision Plane", &LLVOAvatar::sShowFootPlane));
1286 menu->append(new LLMenuItemToggleGL("Show Collision Skeleton", &LLVOAvatar::sShowCollisionVolumes)); 1297 menu->append(new LLMenuItemToggleGL("Show Collision Skeleton", &LLVOAvatar::sShowCollisionVolumes));
1287 menu->append(new LLMenuItemToggleGL("Software Blending SSE", &gGLManager.mSoftwareBlendSSE));
1288#if 0 // Removed since this feature doesn't actually work as of 1.9.1 --TomY
1289 menu->append(new LLMenuItemToggleGL("Character Load Test", &LLVOAvatar::sAvatarLoadTest));
1290#endif
1291 menu->append(new LLMenuItemToggleGL( "Display Agent Target", &LLAgent::sDebugDisplayTarget)); 1298 menu->append(new LLMenuItemToggleGL( "Display Agent Target", &LLAgent::sDebugDisplayTarget));
1292 menu->append(new LLMenuItemToggleGL( "Debug Rotation", &gDebugAvatarRotation)); 1299 menu->append(new LLMenuItemToggleGL( "Debug Rotation", &gDebugAvatarRotation));
1293 menu->append(new LLMenuItemCallGL("Dump Attachments", handle_dump_attachments)); 1300 menu->append(new LLMenuItemCallGL("Dump Attachments", handle_dump_attachments));
@@ -1325,11 +1332,6 @@ void init_server_menu(LLMenuGL* menu)
1325 &handle_normal_llinfo_log, &enable_god_customer_service)); 1332 &handle_normal_llinfo_log, &enable_god_customer_service));
1326 1333
1327 sub_menu->appendSeparator(); 1334 sub_menu->appendSeparator();
1328 sub_menu->append(new LLMenuItemCallGL("Enable Circuit Log",
1329 &handle_sim_enable_circuit_log, &enable_god_customer_service));
1330 sub_menu->append(new LLMenuItemCallGL("Disable Circuit Log",
1331 &handle_sim_disable_circuit_log, &enable_god_customer_service));
1332 sub_menu->appendSeparator();
1333 sub_menu->append(new LLMenuItemCallGL("Enable Message Log", 1335 sub_menu->append(new LLMenuItemCallGL("Enable Message Log",
1334 &handle_sim_enable_message_log, &enable_god_customer_service)); 1336 &handle_sim_enable_message_log, &enable_god_customer_service));
1335 sub_menu->append(new LLMenuItemCallGL("Disable Message Log", 1337 sub_menu->append(new LLMenuItemCallGL("Disable Message Log",
@@ -1352,7 +1354,8 @@ void init_server_menu(LLMenuGL* menu)
1352 menu->appendMenu(sub); 1354 menu->appendMenu(sub);
1353 1355
1354 sub->append(new LLMenuItemCallGL( "Take Copy", 1356 sub->append(new LLMenuItemCallGL( "Take Copy",
1355 &force_take_copy, &enable_god_customer_service, NULL)); 1357 &force_take_copy, &enable_god_customer_service, NULL,
1358 'O', MASK_SHIFT | MASK_ALT | MASK_CONTROL));
1356#ifdef _CORY_TESTING 1359#ifdef _CORY_TESTING
1357 sub->append(new LLMenuItemCallGL( "Export Copy", 1360 sub->append(new LLMenuItemCallGL( "Export Copy",
1358 &force_export_copy, NULL, NULL)); 1361 &force_export_copy, NULL, NULL));
@@ -1456,7 +1459,7 @@ class LLObjectRateOwner : public view_listener_t
1456 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 1459 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
1457 { 1460 {
1458 // Don't allow rating of group owned objects. 1461 // Don't allow rating of group owned objects.
1459 LLSelectNode* node = gSelectMgr->getFirstRootNode(); 1462 LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode();
1460 if (!node) return true; 1463 if (!node) return true;
1461 if (node->mPermissions->isGroupOwned()) 1464 if (node->mPermissions->isGroupOwned())
1462 { 1465 {
@@ -1542,36 +1545,6 @@ class LLObjectEnableReportAbuse : public view_listener_t
1542 } 1545 }
1543}; 1546};
1544 1547
1545
1546BOOL enable_attach(void*)
1547{
1548 // All root objects must be owned by agent.
1549 BOOL rv = FALSE;
1550 LLViewerObject* obj = gSelectMgr->getFirstRootObject();
1551 if(obj)
1552 {
1553 rv = TRUE;
1554 for(obj = gSelectMgr->getFirstRootObject() ; obj != NULL; obj = gSelectMgr->getNextRootObject())
1555 {
1556 for (U32 child_num = 0; child_num < obj->mChildList.size(); child_num++ )
1557 {
1558 LLViewerObject *child = obj->mChildList[child_num];
1559 if (child->isAvatar())
1560 {
1561 return FALSE;
1562 }
1563 }
1564 if(!obj->permMove())
1565 {
1566 rv = FALSE;
1567 break;
1568 }
1569 }
1570 }
1571 return rv;
1572}
1573
1574
1575class LLObjectTouch : public view_listener_t 1548class LLObjectTouch : public view_listener_t
1576{ 1549{
1577 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 1550 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
@@ -1601,7 +1574,6 @@ class LLObjectTouch : public view_listener_t
1601 msg->addU32Fast(_PREHASH_LocalID, object->mLocalID); 1574 msg->addU32Fast(_PREHASH_LocalID, object->mLocalID);
1602 msg->sendMessage(object->getRegion()->getHost()); 1575 msg->sendMessage(object->getRegion()->getHost());
1603 1576
1604 gSelectMgr->deselectTransient();
1605 return true; 1577 return true;
1606 } 1578 }
1607}; 1579};
@@ -1617,7 +1589,7 @@ class LLObjectEnableTouch : public view_listener_t
1617 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); 1589 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
1618 1590
1619 // Update label based on the node touch name if available. 1591 // Update label based on the node touch name if available.
1620 LLSelectNode* node = gSelectMgr->getFirstRootNode(); 1592 LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode();
1621 if (node && node->mValid && !node->mTouchName.empty()) 1593 if (node && node->mValid && !node->mTouchName.empty())
1622 { 1594 {
1623 gMenuHolder->childSetText("Object Touch", node->mTouchName); 1595 gMenuHolder->childSetText("Object Touch", node->mTouchName);
@@ -1633,7 +1605,7 @@ class LLObjectEnableTouch : public view_listener_t
1633 1605
1634void label_touch(LLString& label, void*) 1606void label_touch(LLString& label, void*)
1635{ 1607{
1636 LLSelectNode* node = gSelectMgr->getFirstRootNode(); 1608 LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode();
1637 if (node && node->mValid && !node->mTouchName.empty()) 1609 if (node && node->mValid && !node->mTouchName.empty())
1638 { 1610 {
1639 label.assign(node->mTouchName); 1611 label.assign(node->mTouchName);
@@ -1649,8 +1621,6 @@ bool handle_object_open()
1649 LLViewerObject* obj = gObjectList.findObject(gLastHitObjectID); 1621 LLViewerObject* obj = gObjectList.findObject(gLastHitObjectID);
1650 if(!obj) return true; 1622 if(!obj) return true;
1651 1623
1652 // transient selection must be made permanent
1653 gSelectMgr->convertTransient();
1654 LLFloaterOpenObject::show(); 1624 LLFloaterOpenObject::show();
1655 return true; 1625 return true;
1656} 1626}
@@ -1711,8 +1681,8 @@ bool toggle_build_mode()
1711 gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD ); 1681 gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD );
1712 } 1682 }
1713 1683
1714 gCurrentToolset = gBasicToolset; 1684 gToolMgr->setCurrentToolset(gBasicToolset);
1715 gCurrentToolset->selectTool( gToolCreate ); 1685 gToolMgr->getCurrentToolset()->selectTool( gToolCreate );
1716 1686
1717 // Could be first use 1687 // Could be first use
1718 LLFirstUse::useBuild(); 1688 LLFirstUse::useBuild();
@@ -1748,8 +1718,8 @@ class LLObjectBuild : public view_listener_t
1748 gViewerWindow->moveCursorToCenter(); 1718 gViewerWindow->moveCursorToCenter();
1749 } 1719 }
1750 1720
1751 gCurrentToolset = gBasicToolset; 1721 gToolMgr->setCurrentToolset(gBasicToolset);
1752 gCurrentToolset->selectTool( gToolCreate ); 1722 gToolMgr->getCurrentToolset()->selectTool( gToolCreate );
1753 1723
1754 // Could be first use 1724 // Could be first use
1755 LLFirstUse::useBuild(); 1725 LLFirstUse::useBuild();
@@ -1762,12 +1732,12 @@ class LLObjectEdit : public view_listener_t
1762 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 1732 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
1763 { 1733 {
1764 gParcelMgr->deselectLand(); 1734 gParcelMgr->deselectLand();
1765 // convert transient selections to permanent
1766 gSelectMgr->convertTransient();
1767 1735
1768 if (gAgent.getFocusOnAvatar() && !gToolMgr->inEdit()) 1736 if (gAgent.getFocusOnAvatar() && !gToolMgr->inEdit())
1769 { 1737 {
1770 if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD || !gSavedSettings.getBOOL("EditCameraMovement")) 1738 LLObjectSelectionHandle selection = gSelectMgr->getSelection();
1739
1740 if (selection->getSelectType() == SELECT_TYPE_HUD || !gSavedSettings.getBOOL("EditCameraMovement"))
1771 { 1741 {
1772 // always freeze camera in space, even if camera doesn't move 1742 // always freeze camera in space, even if camera doesn't move
1773 // so, for example, follow cam scripts can't affect you when in build mode 1743 // so, for example, follow cam scripts can't affect you when in build mode
@@ -1785,9 +1755,9 @@ class LLObjectEdit : public view_listener_t
1785 } 1755 }
1786 } 1756 }
1787 1757
1788 gFloaterTools->open(); 1758 gFloaterTools->open(); /* Flawfinder: ignore */
1789 1759
1790 gCurrentToolset = gBasicToolset; 1760 gToolMgr->setCurrentToolset(gBasicToolset);
1791 gFloaterTools->setEditTool( gToolTranslate ); 1761 gFloaterTools->setEditTool( gToolTranslate );
1792 1762
1793 // Could be first use 1763 // Could be first use
@@ -1800,7 +1770,6 @@ class LLObjectInspect : public view_listener_t
1800{ 1770{
1801 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 1771 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
1802 { 1772 {
1803 gSelectMgr->convertTransient();
1804 LLFloaterInspect::show(); 1773 LLFloaterInspect::show();
1805 return true; 1774 return true;
1806 } 1775 }
@@ -1833,8 +1802,8 @@ class LLLandBuild : public view_listener_t
1833 } 1802 }
1834 1803
1835 1804
1836 gCurrentToolset = gBasicToolset; 1805 gToolMgr->setCurrentToolset(gBasicToolset);
1837 gCurrentToolset->selectTool( gToolCreate ); 1806 gToolMgr->getCurrentToolset()->selectTool( gToolCreate );
1838 1807
1839 // Could be first use 1808 // Could be first use
1840 LLFirstUse::useBuild(); 1809 LLFirstUse::useBuild();
@@ -1922,7 +1891,7 @@ class LLSelfEnableRemoveAllAttachments : public view_listener_t
1922 attachmentp; 1891 attachmentp;
1923 attachmentp = avatarp->mAttachmentPoints.getNextData()) 1892 attachmentp = avatarp->mAttachmentPoints.getNextData())
1924 { 1893 {
1925 if (attachmentp->getObject(0)) 1894 if (attachmentp->getObject())
1926 { 1895 {
1927 new_value = true; 1896 new_value = true;
1928 break; 1897 break;
@@ -2003,7 +1972,7 @@ class LLObjectMute : public view_listener_t
2003 // it's an object 1972 // it's an object
2004 id = object->getID(); 1973 id = object->getID();
2005 1974
2006 LLSelectNode* node = gSelectMgr->getFirstRootNode(); 1975 LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode();
2007 if (node) 1976 if (node)
2008 { 1977 {
2009 name = node->mName; 1978 name = node->mName;
@@ -2023,7 +1992,6 @@ class LLObjectMute : public view_listener_t
2023 gFloaterMute->show(); 1992 gFloaterMute->show();
2024 } 1993 }
2025 1994
2026 gSelectMgr->deselectAll();
2027 return true; 1995 return true;
2028 } 1996 }
2029}; 1997};
@@ -2041,9 +2009,6 @@ bool handle_go_to()
2041 strings.push_back(val); 2009 strings.push_back(val);
2042 send_generic_message("autopilot", strings); 2010 send_generic_message("autopilot", strings);
2043 2011
2044 // Don't select anything
2045 gSelectMgr->deselectTransient();
2046
2047 gParcelMgr->deselectLand(); 2012 gParcelMgr->deselectLand();
2048 2013
2049 if (gAgent.getAvatarObject() && !gSavedSettings.getBOOL("AutoPilotLocksCamera")) 2014 if (gAgent.getAvatarObject() && !gSavedSettings.getBOOL("AutoPilotLocksCamera"))
@@ -2153,7 +2118,7 @@ class LLAvatarDebug : public view_listener_t
2153 } 2118 }
2154 llinfos << "Dumping temporary asset data to simulator logs for avatar " << avatar->getID() << llendl; 2119 llinfos << "Dumping temporary asset data to simulator logs for avatar " << avatar->getID() << llendl;
2155 std::vector<std::string> strings; 2120 std::vector<std::string> strings;
2156 strings.push_back( avatar->getID().getString() ); 2121 strings.push_back(avatar->getID().asString());
2157 LLUUID invoice; 2122 LLUUID invoice;
2158 send_generic_message("dumptempassetdata", strings, invoice); 2123 send_generic_message("dumptempassetdata", strings, invoice);
2159 LLFloaterAvatarTextures::show( avatar->getID() ); 2124 LLFloaterAvatarTextures::show( avatar->getID() );
@@ -2336,18 +2301,18 @@ void handle_leave_group(void *)
2336void append_aggregate(LLString& string, const LLAggregatePermissions& ag_perm, PermissionBit bit, const char* txt) 2301void append_aggregate(LLString& string, const LLAggregatePermissions& ag_perm, PermissionBit bit, const char* txt)
2337{ 2302{
2338 LLAggregatePermissions::EValue val = ag_perm.getValue(bit); 2303 LLAggregatePermissions::EValue val = ag_perm.getValue(bit);
2339 char buffer[MAX_STRING]; 2304 char buffer[MAX_STRING]; /* Flawfinder: ignore */
2340 buffer[0] = '\0'; 2305 buffer[0] = '\0';
2341 switch(val) 2306 switch(val)
2342 { 2307 {
2343 case LLAggregatePermissions::AP_NONE: 2308 case LLAggregatePermissions::AP_NONE:
2344 sprintf(buffer, "* %s None\n", txt); 2309 snprintf(buffer, MAX_STRING, "* %s None\n", txt); /* Flawfinder: ignore */
2345 break; 2310 break;
2346 case LLAggregatePermissions::AP_SOME: 2311 case LLAggregatePermissions::AP_SOME:
2347 sprintf(buffer, "* %s Some\n", txt); 2312 snprintf(buffer, MAX_STRING, "* %s Some\n", txt); /* Flawfinder: ignore */
2348 break; 2313 break;
2349 case LLAggregatePermissions::AP_ALL: 2314 case LLAggregatePermissions::AP_ALL:
2350 sprintf(buffer, "* %s All\n", txt); 2315 snprintf(buffer, MAX_STRING, "* %s All\n", txt); /* Flawfinder: ignore */
2351 break; 2316 break;
2352 case LLAggregatePermissions::AP_EMPTY: 2317 case LLAggregatePermissions::AP_EMPTY:
2353 default: 2318 default:
@@ -2388,9 +2353,9 @@ BOOL enable_buy(void*)
2388{ 2353{
2389 // In order to buy, there must only be 1 purchaseable object in 2354 // In order to buy, there must only be 1 purchaseable object in
2390 // the selection manger. 2355 // the selection manger.
2391 if(gSelectMgr->getRootObjectCount() != 1) return FALSE; 2356 if(gSelectMgr->getSelection()->getRootObjectCount() != 1) return FALSE;
2392 LLViewerObject* obj = NULL; 2357 LLViewerObject* obj = NULL;
2393 LLSelectNode* node = gSelectMgr->getFirstRootNode(); 2358 LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode();
2394 if(node) 2359 if(node)
2395 { 2360 {
2396 obj = node->getObject(); 2361 obj = node->getObject();
@@ -2451,14 +2416,12 @@ void handle_buy_object(LLSaleInfo sale_info)
2451 return; 2416 return;
2452 } 2417 }
2453 2418
2454 gSelectMgr->convertTransient();
2455 LLFloaterBuy::show(sale_info); 2419 LLFloaterBuy::show(sale_info);
2456} 2420}
2457 2421
2458 2422
2459void handle_buy_contents(LLSaleInfo sale_info) 2423void handle_buy_contents(LLSaleInfo sale_info)
2460{ 2424{
2461 gSelectMgr->convertTransient();
2462 LLFloaterBuyContents::show(sale_info); 2425 LLFloaterBuyContents::show(sale_info);
2463} 2426}
2464 2427
@@ -2513,6 +2476,14 @@ void handle_dump_group_info(void *)
2513 //llinfos << "insig " << gAgent.mGroupInsigniaID << llendl; 2476 //llinfos << "insig " << gAgent.mGroupInsigniaID << llendl;
2514} 2477}
2515 2478
2479void handle_dump_capabilities_info(void *)
2480{
2481 LLViewerRegion* regionp = gAgent.getRegion();
2482 if (regionp)
2483 {
2484 regionp->logActiveCapabilities();
2485 }
2486}
2516 2487
2517void handle_dump_focus(void *) 2488void handle_dump_focus(void *)
2518{ 2489{
@@ -2590,10 +2561,12 @@ void set_god_level(U8 god_level)
2590 if (gInProductionGrid) 2561 if (gInProductionGrid)
2591 { 2562 {
2592 gMenuBarView->setBackgroundColor( gColors.getColor( "MenuBarGodBgColor" ) ); 2563 gMenuBarView->setBackgroundColor( gColors.getColor( "MenuBarGodBgColor" ) );
2564 gStatusBar->setBackgroundColor( gColors.getColor( "MenuBarGodBgColor" ) );
2593 } 2565 }
2594 else 2566 else
2595 { 2567 {
2596 gMenuBarView->setBackgroundColor( gColors.getColor( "MenuNonProductionGodBgColor" ) ); 2568 gMenuBarView->setBackgroundColor( gColors.getColor( "MenuNonProductionGodBgColor" ) );
2569 gStatusBar->setBackgroundColor( gColors.getColor( "MenuNonProductionGodBgColor" ) );
2597 } 2570 }
2598 LLNotifyBox::showXml("EnteringGodMode", args); 2571 LLNotifyBox::showXml("EnteringGodMode", args);
2599 } 2572 }
@@ -2603,10 +2576,12 @@ void set_god_level(U8 god_level)
2603 if (gInProductionGrid) 2576 if (gInProductionGrid)
2604 { 2577 {
2605 gMenuBarView->setBackgroundColor( gColors.getColor( "MenuBarBgColor" ) ); 2578 gMenuBarView->setBackgroundColor( gColors.getColor( "MenuBarBgColor" ) );
2579 gStatusBar->setBackgroundColor( gColors.getColor( "MenuBarBgColor" ) );
2606 } 2580 }
2607 else 2581 else
2608 { 2582 {
2609 gMenuBarView->setBackgroundColor( gColors.getColor( "MenuNonProductionBgColor" ) ); 2583 gMenuBarView->setBackgroundColor( gColors.getColor( "MenuNonProductionBgColor" ) );
2584 gStatusBar->setBackgroundColor( gColors.getColor( "MenuNonProductionBgColor" ) );
2610 } 2585 }
2611 LLNotifyBox::showXml("LeavingGodMode", args); 2586 LLNotifyBox::showXml("LeavingGodMode", args);
2612 } 2587 }
@@ -2801,7 +2776,6 @@ bool handle_sit_or_stand()
2801 if (sitting_on_selection()) 2776 if (sitting_on_selection())
2802 { 2777 {
2803 gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); 2778 gAgent.setControlFlags(AGENT_CONTROL_STAND_UP);
2804 gSelectMgr->deselectTransient();
2805 return true; 2779 return true;
2806 } 2780 }
2807 2781
@@ -2822,8 +2796,6 @@ bool handle_sit_or_stand()
2822 gMessageSystem->addVector3Fast(_PREHASH_Offset, offset_single); 2796 gMessageSystem->addVector3Fast(_PREHASH_Offset, offset_single);
2823 2797
2824 object->getRegion()->sendReliableMessage(); 2798 object->getRegion()->sendReliableMessage();
2825
2826 gSelectMgr->deselectTransient();
2827 } 2799 }
2828 return true; 2800 return true;
2829} 2801}
@@ -2838,11 +2810,14 @@ class LLObjectSitOrStand : public view_listener_t
2838 2810
2839void near_sit_down_point(BOOL success, void *) 2811void near_sit_down_point(BOOL success, void *)
2840{ 2812{
2841 gAgent.setFlying(FALSE); 2813 if (success)
2842 gAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); 2814 {
2815 gAgent.setFlying(FALSE);
2816 gAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND);
2843 2817
2844 // Might be first sit 2818 // Might be first sit
2845 LLFirstUse::useSit(); 2819 LLFirstUse::useSit();
2820 }
2846} 2821}
2847 2822
2848class LLLandSit : public view_listener_t 2823class LLLandSit : public view_listener_t
@@ -3182,13 +3157,12 @@ void reset_view_final( BOOL proceed, void* )
3182 gAgent.changeCameraToDefault(); 3157 gAgent.changeCameraToDefault();
3183 3158
3184 gAgent.resetView(!gFloaterTools->getVisible()); 3159 gAgent.resetView(!gFloaterTools->getVisible());
3160 gFloaterTools->close();
3185 3161
3186 gViewerWindow->showCursor(); 3162 gViewerWindow->showCursor();
3187 3163
3188 // Switch back to basic toolset 3164 // Switch back to basic toolset
3189 gCurrentToolset = gBasicToolset; 3165 gToolMgr->setCurrentToolset(gBasicToolset);
3190 gBasicToolset->selectFirstTool();
3191 gToolMgr->useSelectedTool( gBasicToolset );
3192} 3166}
3193 3167
3194class LLViewLookAtLastChatter : public view_listener_t 3168class LLViewLookAtLastChatter : public view_listener_t
@@ -3261,7 +3235,7 @@ class LLEditEnableDuplicate : public view_listener_t
3261 3235
3262void disabled_duplicate(void*) 3236void disabled_duplicate(void*)
3263{ 3237{
3264 if (gSelectMgr->getFirstObject()) 3238 if (gSelectMgr->getSelection()->getFirstObject())
3265 { 3239 {
3266 LLNotifyBox::showXml("CopyFailed"); 3240 LLNotifyBox::showXml("CopyFailed");
3267 } 3241 }
@@ -3291,7 +3265,7 @@ void handle_deed_object_to_group(void*)
3291 3265
3292BOOL enable_deed_object_to_group(void*) 3266BOOL enable_deed_object_to_group(void*)
3293{ 3267{
3294 if(gSelectMgr->isEmpty()) return FALSE; 3268 if(gSelectMgr->getSelection()->isEmpty()) return FALSE;
3295 LLPermissions perm; 3269 LLPermissions perm;
3296 LLUUID group_id; 3270 LLUUID group_id;
3297 3271
@@ -3350,8 +3324,8 @@ void handle_object_owner_permissive(void*)
3350 if(gAgent.isGodlike()) 3324 if(gAgent.isGodlike())
3351 { 3325 {
3352 // do the objects. 3326 // do the objects.
3353 gSelectMgr->setObjectPermissions(PERM_BASE, TRUE, PERM_ALL, TRUE); 3327 gSelectMgr->selectionSetObjectPermissions(PERM_BASE, TRUE, PERM_ALL, TRUE);
3354 gSelectMgr->setObjectPermissions(PERM_OWNER, TRUE, PERM_ALL, TRUE); 3328 gSelectMgr->selectionSetObjectPermissions(PERM_OWNER, TRUE, PERM_ALL, TRUE);
3355 } 3329 }
3356} 3330}
3357 3331
@@ -3367,7 +3341,7 @@ void handle_object_owner_self(void*)
3367// Shortcut to set owner permissions to not editable. 3341// Shortcut to set owner permissions to not editable.
3368void handle_object_lock(void*) 3342void handle_object_lock(void*)
3369{ 3343{
3370 gSelectMgr->setObjectPermissions(PERM_OWNER, FALSE, PERM_MODIFY); 3344 gSelectMgr->selectionSetObjectPermissions(PERM_OWNER, FALSE, PERM_MODIFY);
3371} 3345}
3372 3346
3373void handle_object_asset_ids(void*) 3347void handle_object_asset_ids(void*)
@@ -3412,17 +3386,17 @@ void handle_claim_public_land(void*)
3412 msg->nextBlock("MethodData"); 3386 msg->nextBlock("MethodData");
3413 msg->addString("Method", "claimpublicland"); 3387 msg->addString("Method", "claimpublicland");
3414 msg->addUUID("Invoice", LLUUID::null); 3388 msg->addUUID("Invoice", LLUUID::null);
3415 char buffer[32]; 3389 char buffer[32]; /* Flawfinder: ignore */
3416 sprintf(buffer, "%f", west_south.mV[VX]); 3390 snprintf(buffer, sizeof(buffer), "%f", west_south.mV[VX]); /* Flawfinder: ignore */
3417 msg->nextBlock("ParamList"); 3391 msg->nextBlock("ParamList");
3418 msg->addString("Parameter", buffer); 3392 msg->addString("Parameter", buffer);
3419 sprintf(buffer, "%f", west_south.mV[VY]); 3393 snprintf(buffer, sizeof(buffer), "%f", west_south.mV[VY]); /* Flawfinder: ignore */
3420 msg->nextBlock("ParamList"); 3394 msg->nextBlock("ParamList");
3421 msg->addString("Parameter", buffer); 3395 msg->addString("Parameter", buffer);
3422 sprintf(buffer, "%f", east_north.mV[VX]); 3396 snprintf(buffer, sizeof(buffer), "%f", east_north.mV[VX]); /* Flawfinder: ignore */
3423 msg->nextBlock("ParamList"); 3397 msg->nextBlock("ParamList");
3424 msg->addString("Parameter", buffer); 3398 msg->addString("Parameter", buffer);
3425 sprintf(buffer, "%f", east_north.mV[VY]); 3399 snprintf(buffer, sizeof(buffer), "%f", east_north.mV[VY]); /* Flawfinder: ignore */
3426 msg->nextBlock("ParamList"); 3400 msg->nextBlock("ParamList");
3427 msg->addString("Parameter", buffer); 3401 msg->addString("Parameter", buffer);
3428 gAgent.sendReliableMessage(); 3402 gAgent.sendReliableMessage();
@@ -3519,8 +3493,9 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id)
3519 } 3493 }
3520 //gInventoryView->setPanelOpen(TRUE); 3494 //gInventoryView->setPanelOpen(TRUE);
3521 3495
3496 LLObjectSelectionHandle selection = gSelectMgr->getSelection();
3522 LLViewerObject* object = NULL; 3497 LLViewerObject* object = NULL;
3523 LLSelectNode* node = gSelectMgr->getFirstRootNode(); 3498 LLSelectNode* node = selection->getFirstRootNode();
3524 if(!node) return; 3499 if(!node) return;
3525 object = node->getObject(); 3500 object = node->getObject();
3526 if(!object) return; 3501 if(!object) return;
@@ -3531,7 +3506,7 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id)
3531 // everything that we'll actually be derezzing. 3506 // everything that we'll actually be derezzing.
3532 LLDynamicArray<LLViewerObject*> derez_objects; 3507 LLDynamicArray<LLViewerObject*> derez_objects;
3533 BOOL can_derez_current; 3508 BOOL can_derez_current;
3534 for( ; node != NULL; node = gSelectMgr->getNextRootNode()) 3509 for( ; node != NULL; node = selection->getNextRootNode())
3535 { 3510 {
3536 object = node->getObject(); 3511 object = node->getObject();
3537 if(!object || !node->mValid) continue; 3512 if(!object || !node->mValid) continue;
@@ -3665,42 +3640,47 @@ class LLToolsTakeCopy : public view_listener_t
3665{ 3640{
3666 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 3641 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
3667 { 3642 {
3668 if (gSelectMgr->isEmpty()) return true; 3643 if (gSelectMgr->getSelection()->isEmpty()) return true;
3669 3644
3670 const LLUUID& category_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_OBJECT); 3645 const LLUUID& category_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_OBJECT);
3671 derez_objects(DRD_ACQUIRE_TO_AGENT_INVENTORY, category_id); 3646 derez_objects(DRD_ACQUIRE_TO_AGENT_INVENTORY, category_id);
3672 3647
3673 // Only deselect if we're not building
3674 if (!gToolMgr->inEdit())
3675 {
3676 gSelectMgr->deselectTransient();
3677 }
3678 return true; 3648 return true;
3679 } 3649 }
3680}; 3650};
3681 3651
3682 3652
3683void callback_return_to_owner(S32 option, void* data)
3684{
3685 if (0 == option)
3686 {
3687 // Ignore category ID for this derez destination.
3688 derez_objects(DRD_RETURN_TO_OWNER, LLUUID::null);
3689 }
3690}
3691
3692// You can return an object to its owner if it is on your land. 3653// You can return an object to its owner if it is on your land.
3693class LLObjectReturn : public view_listener_t 3654class LLObjectReturn : public view_listener_t
3694{ 3655{
3695 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 3656 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
3696 { 3657 {
3697 if (gSelectMgr->isEmpty()) return true; 3658 if (gSelectMgr->getSelection()->isEmpty()) return true;
3659
3660 mObjectSelection = gSelectMgr->getEditSelection();
3698 3661
3699 gViewerWindow->alertXml("ReturnToOwner", 3662 gViewerWindow->alertXml("ReturnToOwner",
3700 callback_return_to_owner, 3663 onReturnToOwner,
3701 NULL); 3664 (void*)this);
3702 return true; 3665 return true;
3703 } 3666 }
3667
3668 static void onReturnToOwner(S32 option, void* data)
3669 {
3670 LLObjectReturn* object_return = (LLObjectReturn*)data;
3671
3672 if (0 == option)
3673 {
3674 // Ignore category ID for this derez destination.
3675 derez_objects(DRD_RETURN_TO_OWNER, LLUUID::null);
3676 }
3677
3678 // drop reference to current selection
3679 object_return->mObjectSelection = NULL;
3680 }
3681
3682protected:
3683 LLObjectSelectionHandle mObjectSelection;
3704}; 3684};
3705 3685
3706 3686
@@ -3730,10 +3710,11 @@ class LLObjectEnableReturn : public view_listener_t
3730 } 3710 }
3731 else 3711 else
3732 { 3712 {
3713 LLObjectSelectionHandle selection = gSelectMgr->getSelection();
3733 LLViewerObject* obj = NULL; 3714 LLViewerObject* obj = NULL;
3734 for(obj = gSelectMgr->getFirstRootObject(); 3715 for(obj = selection->getFirstRootObject();
3735 obj; 3716 obj;
3736 obj = gSelectMgr->getNextRootObject()) 3717 obj = selection->getNextRootObject())
3737 { 3718 {
3738 if (obj->isOverAgentOwnedLand() 3719 if (obj->isOverAgentOwnedLand()
3739 || obj->isOverGroupOwnedLand() 3720 || obj->isOverGroupOwnedLand()
@@ -3754,22 +3735,16 @@ class LLObjectEnableReturn : public view_listener_t
3754 3735
3755void force_take_copy(void*) 3736void force_take_copy(void*)
3756{ 3737{
3757 if (gSelectMgr->isEmpty()) return; 3738 if (gSelectMgr->getSelection()->isEmpty()) return;
3758 const LLUUID& category_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_OBJECT); 3739 const LLUUID& category_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_OBJECT);
3759 derez_objects(DRD_FORCE_TO_GOD_INVENTORY, category_id); 3740 derez_objects(DRD_FORCE_TO_GOD_INVENTORY, category_id);
3760
3761 // Only deselect if we're not building
3762 if (!gToolMgr->inEdit())
3763 {
3764 gSelectMgr->deselectTransient();
3765 }
3766} 3741}
3767#ifdef _CORY_TESTING 3742#ifdef _CORY_TESTING
3768 3743
3769void force_export_copy(void*) 3744void force_export_copy(void*)
3770{ 3745{
3771 LLViewerObject* object = NULL; 3746 LLViewerObject* object = NULL;
3772 LLSelectNode* node = gSelectMgr->getFirstNode(); 3747 LLSelectNode* node = gSelectMgr->getSelection()->getFirstNode();
3773 if(!node) return; 3748 if(!node) return;
3774 object = node->getObject(); 3749 object = node->getObject();
3775 if(!object) return; 3750 if(!object) return;
@@ -3790,7 +3765,7 @@ void force_export_copy(void*)
3790 3765
3791 S32 object_index = 0; 3766 S32 object_index = 0;
3792 3767
3793 for( ; node != NULL; node = gSelectMgr->getNextNode()) 3768 for( ; node != NULL; node = gSelectMgr->getSelection()->getNextNode())
3794 { 3769 {
3795 object = node->getObject(); 3770 object = node->getObject();
3796 if(!object || !node->mValid) 3771 if(!object || !node->mValid)
@@ -3831,8 +3806,9 @@ void force_export_copy(void*)
3831 } 3806 }
3832 3807
3833 // Copy the directory + file name 3808 // Copy the directory + file name
3834 char filepath[LL_MAX_PATH]; 3809 char filepath[LL_MAX_PATH]; /* Flawfinder: ignore */
3835 strcpy(filepath, picker.getFirstFile()); 3810 strncpy(filepath, picker.getFirstFile(), LL_MAX_PATH -1); /* Flawfinder: ignore */
3811 filepath[LL_MAX_PATH -1] = '\0';
3836 3812
3837 apr_file_t* fp = ll_apr_file_open(filepath, LL_APR_W); 3813 apr_file_t* fp = ll_apr_file_open(filepath, LL_APR_W);
3838 3814
@@ -3876,7 +3852,7 @@ void force_export_copy(void*)
3876 LLColor4 color = te->getColor(); 3852 LLColor4 color = te->getColor();
3877 apr_file_printf(fp, "\t<Face\n\t\tFaceColor='%d %5f %5f %5f %5f'\n", face, color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW]); 3853 apr_file_printf(fp, "\t<Face\n\t\tFaceColor='%d %5f %5f %5f %5f'\n", face, color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW]);
3878 3854
3879 char texture[UUID_STR_LENGTH]; 3855 char texture[UUID_STR_LENGTH]; /* Flawfinder: ignore */
3880 LLUUID texid = te->getID(); 3856 LLUUID texid = te->getID();
3881 texid.toString(texture); 3857 texid.toString(texture);
3882 F32 sx, sy, ox, oy; 3858 F32 sx, sy, ox, oy;
@@ -3942,8 +3918,9 @@ void force_import_geometry(void*)
3942 return; 3918 return;
3943 } 3919 }
3944 3920
3945 char directory[LL_MAX_PATH]; 3921 char directory[LL_MAX_PATH]; /* Flawfinder: ignore */
3946 strcpy(directory, picker.getFirstFile()); 3922 strncpy(directory, picker.getFirstFile(), LL_MAX_PATH -1); /* Flawfinder: ignore */
3923 directory[LL_MAX_PATH -1] = '\0';
3947 3924
3948 llinfos << "Loading LSG file " << directory << llendl; 3925 llinfos << "Loading LSG file " << directory << llendl;
3949 LLXmlTree *xmlparser = new LLXmlTree(); 3926 LLXmlTree *xmlparser = new LLXmlTree();
@@ -3966,8 +3943,8 @@ void force_import_geometry(void*)
3966 { 3943 {
3967 // get object data 3944 // get object data
3968 // *NOTE: This buffer size is hard coded into scanf() below. 3945 // *NOTE: This buffer size is hard coded into scanf() below.
3969 char name[255]; // Shape 3946 char name[255]; /* Flawfinder: ignore */ // Shape
3970 char description[255]; // Description 3947 char description[255]; /* Flawfinder: ignore */ // Description
3971 U32 material; // Material 3948 U32 material; // Material
3972 F32 sx, sy, sz; // Scale 3949 F32 sx, sy, sz; // Scale
3973 LLVector3 scale; 3950 LLVector3 scale;
@@ -3998,9 +3975,11 @@ void force_import_geometry(void*)
3998 child->getAttributeString("PCode", &attribute); 3975 child->getAttributeString("PCode", &attribute);
3999 pcode = atoi(attribute.c_str()); 3976 pcode = atoi(attribute.c_str());
4000 child->getAttributeString("Shape", &attribute); 3977 child->getAttributeString("Shape", &attribute);
4001 sscanf(attribute.c_str(), "%254s", name); 3978 sscanf( /* Flawfinder: ignore */
3979 attribute.c_str(), "%254s", name);
4002 child->getAttributeString("Description", &attribute); 3980 child->getAttributeString("Description", &attribute);
4003 sscanf(attribute.c_str(), "%254s", description); 3981 sscanf( /* Flawfinder: ignore */
3982 attribute.c_str(), "%254s", description);
4004 child->getAttributeString("Material", &attribute); 3983 child->getAttributeString("Material", &attribute);
4005 material = atoi(attribute.c_str()); 3984 material = atoi(attribute.c_str());
4006 child->getAttributeString("Scale", &attribute); 3985 child->getAttributeString("Scale", &attribute);
@@ -4115,16 +4094,16 @@ void handle_take()
4115{ 4094{
4116 // we want to use the folder this was derezzed from if it's 4095 // we want to use the folder this was derezzed from if it's
4117 // available. Otherwise, derez to the normal place. 4096 // available. Otherwise, derez to the normal place.
4118 if(gSelectMgr->isEmpty()) return; 4097 if(gSelectMgr->getSelection()->isEmpty()) return;
4119 LLSelectNode* node = NULL; 4098 LLSelectNode* node = NULL;
4120 LLViewerObject* object = NULL; 4099 LLViewerObject* object = NULL;
4121 BOOL you_own_everything = TRUE; 4100 BOOL you_own_everything = TRUE;
4122 4101
4123 BOOL locked_but_takeable_object = FALSE; 4102 BOOL locked_but_takeable_object = FALSE;
4124 LLUUID category_id; 4103 LLUUID category_id;
4125 for(node = gSelectMgr->getFirstRootNode(); 4104 for(node = gSelectMgr->getSelection()->getFirstRootNode();
4126 node != NULL; 4105 node != NULL;
4127 node = gSelectMgr->getNextRootNode()) 4106 node = gSelectMgr->getSelection()->getNextRootNode())
4128 { 4107 {
4129 object = node->getObject(); 4108 object = node->getObject();
4130 if(object) 4109 if(object)
@@ -4160,7 +4139,7 @@ void handle_take()
4160 if(category_id.notNull()) 4139 if(category_id.notNull())
4161 { 4140 {
4162 // there is an unambiguous destination. See if this agent has 4141 // there is an unambiguous destination. See if this agent has
4163 // such a location and it is not in the trash. 4142 // such a location and it is not in the trash or library
4164 if(!gInventory.getCategory(category_id)) 4143 if(!gInventory.getCategory(category_id))
4165 { 4144 {
4166 // nope, set to NULL. 4145 // nope, set to NULL.
@@ -4168,12 +4147,20 @@ void handle_take()
4168 } 4147 }
4169 if(category_id.notNull()) 4148 if(category_id.notNull())
4170 { 4149 {
4150 // check trash
4171 LLUUID trash; 4151 LLUUID trash;
4172 trash = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); 4152 trash = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH);
4173 if(category_id == trash || gInventory.isObjectDescendentOf(category_id, trash)) 4153 if(category_id == trash || gInventory.isObjectDescendentOf(category_id, trash))
4174 { 4154 {
4175 category_id.setNull(); 4155 category_id.setNull();
4176 } 4156 }
4157
4158 // check library
4159 if(gInventory.isObjectDescendentOf(category_id, gInventoryLibraryRoot))
4160 {
4161 category_id.setNull();
4162 }
4163
4177 } 4164 }
4178 } 4165 }
4179 if(category_id.isNull()) 4166 if(category_id.isNull())
@@ -4185,10 +4172,8 @@ void handle_take()
4185 4172
4186 !you_own_everything) 4173 !you_own_everything)
4187 { 4174 {
4188
4189 if(locked_but_takeable_object && you_own_everything) 4175 if(locked_but_takeable_object && you_own_everything)
4190 { 4176 {
4191
4192 gViewerWindow->alertXml("ConfirmObjectTakeLock", 4177 gViewerWindow->alertXml("ConfirmObjectTakeLock",
4193 confirm_take, 4178 confirm_take,
4194 (void*)cat_id); 4179 (void*)cat_id);
@@ -4196,7 +4181,6 @@ void handle_take()
4196 } 4181 }
4197 else if(!locked_but_takeable_object && !you_own_everything) 4182 else if(!locked_but_takeable_object && !you_own_everything)
4198 { 4183 {
4199
4200 gViewerWindow->alertXml("ConfirmObjectTakeNoOwn", 4184 gViewerWindow->alertXml("ConfirmObjectTakeNoOwn",
4201 confirm_take, 4185 confirm_take,
4202 (void*)cat_id); 4186 (void*)cat_id);
@@ -4239,9 +4223,9 @@ BOOL enable_take()
4239 } 4223 }
4240 4224
4241 LLViewerObject* object = NULL; 4225 LLViewerObject* object = NULL;
4242 for(LLSelectNode* node = gSelectMgr->getFirstRootNode(); 4226 for(LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode();
4243 node != NULL; 4227 node != NULL;
4244 node = gSelectMgr->getNextRootNode()) 4228 node = gSelectMgr->getSelection()->getNextRootNode())
4245 { 4229 {
4246 object = node->getObject(); 4230 object = node->getObject();
4247 if(!object || !node->mValid) continue; 4231 if(!object || !node->mValid) continue;
@@ -4275,7 +4259,7 @@ class LLToolsBuyOrTake : public view_listener_t
4275{ 4259{
4276 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 4260 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
4277 { 4261 {
4278 if (gSelectMgr->isEmpty()) 4262 if (gSelectMgr->getSelection()->isEmpty())
4279 { 4263 {
4280 return true; 4264 return true;
4281 } 4265 }
@@ -4355,9 +4339,9 @@ class LLToolsEnableBuyOrTake : public view_listener_t
4355BOOL is_selection_buy_not_take() 4339BOOL is_selection_buy_not_take()
4356{ 4340{
4357 LLViewerObject* obj = NULL; 4341 LLViewerObject* obj = NULL;
4358 for(LLSelectNode* node = gSelectMgr->getFirstRootNode(); 4342 for(LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode();
4359 node != NULL; 4343 node != NULL;
4360 node = gSelectMgr->getNextRootNode()) 4344 node = gSelectMgr->getSelection()->getNextRootNode())
4361 { 4345 {
4362 obj = node->getObject(); 4346 obj = node->getObject();
4363 if(obj && !(obj->permYouOwner()) && (node->mSaleInfo.isForSale())) 4347 if(obj && !(obj->permYouOwner()) && (node->mSaleInfo.isForSale()))
@@ -4374,9 +4358,9 @@ S32 selection_price()
4374{ 4358{
4375 LLViewerObject* obj = NULL; 4359 LLViewerObject* obj = NULL;
4376 S32 total_price = 0; 4360 S32 total_price = 0;
4377 for(LLSelectNode* node = gSelectMgr->getFirstRootNode(); 4361 for(LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode();
4378 node != NULL; 4362 node != NULL;
4379 node = gSelectMgr->getNextRootNode()) 4363 node = gSelectMgr->getSelection()->getNextRootNode())
4380 { 4364 {
4381 obj = node->getObject(); 4365 obj = node->getObject();
4382 if(obj && !(obj->permYouOwner()) && (node->mSaleInfo.isForSale())) 4366 if(obj && !(obj->permYouOwner()) && (node->mSaleInfo.isForSale()))
@@ -4425,7 +4409,7 @@ void handle_buy_currency(void*)
4425 4409
4426void handle_buy(void*) 4410void handle_buy(void*)
4427{ 4411{
4428 if (gSelectMgr->isEmpty()) return; 4412 if (gSelectMgr->getSelection()->isEmpty()) return;
4429 4413
4430 LLSaleInfo sale_info; 4414 LLSaleInfo sale_info;
4431 BOOL valid = gSelectMgr->selectGetSaleInfo(sale_info); 4415 BOOL valid = gSelectMgr->selectGetSaleInfo(sale_info);
@@ -4452,7 +4436,7 @@ class LLObjectBuy : public view_listener_t
4452 4436
4453BOOL sitting_on_selection() 4437BOOL sitting_on_selection()
4454{ 4438{
4455 LLSelectNode* node = gSelectMgr->getFirstRootNode(); 4439 LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode();
4456 if (!node) 4440 if (!node)
4457 { 4441 {
4458 return FALSE; 4442 return FALSE;
@@ -4497,7 +4481,7 @@ class LLToolsSaveToObjectInventory : public view_listener_t
4497 { 4481 {
4498 if(gSelectMgr) 4482 if(gSelectMgr)
4499 { 4483 {
4500 LLSelectNode* node = gSelectMgr->getFirstRootNode(); 4484 LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode();
4501 if(node && (node->mValid) && (!node->mFromTaskID.isNull())) 4485 if(node && (node->mValid) && (!node->mFromTaskID.isNull()))
4502 { 4486 {
4503 // *TODO: check to see if the fromtaskid object exists. 4487 // *TODO: check to see if the fromtaskid object exists.
@@ -4516,9 +4500,10 @@ class LLToolsSnapObjectXY : public view_listener_t
4516 F64 snap_size = (F64)gSavedSettings.getF32("GridResolution"); 4500 F64 snap_size = (F64)gSavedSettings.getF32("GridResolution");
4517 4501
4518 LLViewerObject* obj; 4502 LLViewerObject* obj;
4519 for (obj = gSelectMgr->getFirstRootObject(); 4503 LLObjectSelectionHandle selection = gSelectMgr->getSelection();
4504 for (obj = selection->getFirstRootObject();
4520 obj != NULL; 4505 obj != NULL;
4521 obj = gSelectMgr->getNextRootObject()) 4506 obj = selection->getNextRootObject())
4522 { 4507 {
4523 if (obj->permModify()) 4508 if (obj->permModify())
4524 { 4509 {
@@ -4574,11 +4559,12 @@ class LLToolsEnableLink : public view_listener_t
4574 // in component mode, can't link 4559 // in component mode, can't link
4575 if (gSavedSettings.getBOOL("SelectLinkedSet")) 4560 if (gSavedSettings.getBOOL("SelectLinkedSet"))
4576 { 4561 {
4577 if(gSelectMgr->selectGetAllRootsValid() && gSelectMgr->getRootObjectCount() >= 2) 4562 if(gSelectMgr->selectGetAllRootsValid() && gSelectMgr->getSelection()->getRootObjectCount() >= 2)
4578 { 4563 {
4579 for(LLViewerObject* object = gSelectMgr->getFirstRootObject(); 4564 LLObjectSelectionHandle selection = gSelectMgr->getSelection();
4565 for(LLViewerObject* object = selection->getFirstRootObject();
4580 object != NULL; 4566 object != NULL;
4581 object = gSelectMgr->getNextRootObject()) 4567 object = selection->getNextRootObject())
4582 { 4568 {
4583 if(object->permModify()) 4569 if(object->permModify())
4584 { 4570 {
@@ -4603,7 +4589,7 @@ class LLToolsLink : public view_listener_t
4603 return true; 4589 return true;
4604 } 4590 }
4605 4591
4606 S32 object_count = gSelectMgr->getObjectCount(); 4592 S32 object_count = gSelectMgr->getSelection()->getObjectCount();
4607 if (object_count > MAX_CHILDREN_PER_TASK + 1) 4593 if (object_count > MAX_CHILDREN_PER_TASK + 1)
4608 { 4594 {
4609 LLStringBase<char>::format_map_t args; 4595 LLStringBase<char>::format_map_t args;
@@ -4614,7 +4600,7 @@ class LLToolsLink : public view_listener_t
4614 return true; 4600 return true;
4615 } 4601 }
4616 4602
4617 if(gSelectMgr->getRootObjectCount() < 2) 4603 if(gSelectMgr->getSelection()->getRootObjectCount() < 2)
4618 { 4604 {
4619 gViewerWindow->alertXml("CannotLinkIncompleteSet"); 4605 gViewerWindow->alertXml("CannotLinkIncompleteSet");
4620 return true; 4606 return true;
@@ -4644,8 +4630,8 @@ class LLToolsEnableUnlink : public view_listener_t
4644 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 4630 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
4645 { 4631 {
4646 bool new_value = gSelectMgr->selectGetAllRootsValid() && 4632 bool new_value = gSelectMgr->selectGetAllRootsValid() &&
4647 gSelectMgr->getFirstEditableObject() && 4633 gSelectMgr->getSelection()->getFirstEditableObject() &&
4648 !gSelectMgr->getFirstEditableObject()->isAttachment(); 4634 !gSelectMgr->getSelection()->getFirstEditableObject()->isAttachment();
4649 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); 4635 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
4650 return true; 4636 return true;
4651 } 4637 }
@@ -4707,7 +4693,7 @@ void handle_dehinge(void*)
4707 4693
4708BOOL enable_dehinge(void*) 4694BOOL enable_dehinge(void*)
4709{ 4695{
4710 LLViewerObject* obj = gSelectMgr->getFirstEditableObject(); 4696 LLViewerObject* obj = gSelectMgr->getSelection()->getFirstEditableObject();
4711 return obj && !obj->isAttachment(); 4697 return obj && !obj->isAttachment();
4712} 4698}
4713 4699
@@ -5003,7 +4989,7 @@ void toggle_map( void* user_data )
5003 } 4989 }
5004 else 4990 else
5005 { 4991 {
5006 gFloaterMap->open(); 4992 gFloaterMap->open(); /* Flawfinder: ignore */
5007 } 4993 }
5008} 4994}
5009 4995
@@ -5082,8 +5068,8 @@ const char* upload_pick(void* data)
5082 { 5068 {
5083 const char* cur_token = token_iter->c_str(); 5069 const char* cur_token = token_iter->c_str();
5084 5070
5085 if (0 == strnicmp(cur_token, ext, strlen(cur_token)) || 5071 if (0 == strnicmp(cur_token, ext, strlen(cur_token)) || /* Flawfinder: ignore */
5086 0 == strnicmp(cur_token, "*.*", strlen(cur_token))) 5072 0 == strnicmp(cur_token, "*.*", strlen(cur_token))) /* Flawfinder: ignore */
5087 { 5073 {
5088 //valid extension 5074 //valid extension
5089 //or the acceptable extension is any 5075 //or the acceptable extension is any
@@ -5110,7 +5096,7 @@ const char* upload_pick(void* data)
5110 if (type == LLFilePicker::FFLOAD_WAV) 5096 if (type == LLFilePicker::FFLOAD_WAV)
5111 { 5097 {
5112 // pre-qualify wavs to make sure the format is acceptable 5098 // pre-qualify wavs to make sure the format is acceptable
5113 char error_msg[MAX_STRING]; 5099 char error_msg[MAX_STRING]; /* Flawfinder: ignore */
5114 if (check_for_invalid_wav_formats(filename,error_msg)) 5100 if (check_for_invalid_wav_formats(filename,error_msg))
5115 { 5101 {
5116 llinfos << error_msg << ": " << filename << llendl; 5102 llinfos << error_msg << ": " << filename << llendl;
@@ -5213,7 +5199,7 @@ class LLFileUploadBulk : public view_listener_t
5213 char* end_p = strrchr(asset_name_str, '.'); // strip extension if exists 5199 char* end_p = strrchr(asset_name_str, '.'); // strip extension if exists
5214 if( !end_p ) 5200 if( !end_p )
5215 { 5201 {
5216 end_p = asset_name_str + strlen( asset_name_str ); 5202 end_p = asset_name_str + strlen( asset_name_str ); /* Flawfinder: ignore */
5217 } 5203 }
5218 5204
5219 S32 len = llmin( (S32) (DB_INV_ITEM_NAME_STR_LEN), (S32) (end_p - asset_name_str) ); 5205 S32 len = llmin( (S32) (DB_INV_ITEM_NAME_STR_LEN), (S32) (end_p - asset_name_str) );
@@ -5241,15 +5227,23 @@ void upload_error(const char* error_message, const char* label, const std::strin
5241 LLFilePicker::instance().reset(); 5227 LLFilePicker::instance().reset();
5242} 5228}
5243 5229
5230class LLFileEnableCloseWindow : public view_listener_t
5231{
5232 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
5233 {
5234 bool new_value = gFloaterView->getFocusedFloater() != NULL || gSnapshotFloaterView->getFocusedFloater() != NULL;
5235 // horrendously opaque, this code
5236 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
5237 return true;
5238 }
5239};
5240
5244class LLFileCloseWindow : public view_listener_t 5241class LLFileCloseWindow : public view_listener_t
5245{ 5242{
5246 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 5243 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
5247 { 5244 {
5248 LLFloater *top = gFloaterView->getFrontmost(); 5245 LLFloater::closeFocusedFloater();
5249 if (top && top->hasFocus()) 5246
5250 {
5251 LLFloater::closeByMenu( top );
5252 }
5253 return true; 5247 return true;
5254 } 5248 }
5255}; 5249};
@@ -5394,7 +5388,7 @@ void upload_new_resource(const LLString& src_filename, std::string name,
5394 5388
5395 LLString ext = src_filename.substr(src_filename.find_last_of('.')); 5389 LLString ext = src_filename.substr(src_filename.find_last_of('.'));
5396 LLAssetType::EType asset_type = LLAssetType::AT_NONE; 5390 LLAssetType::EType asset_type = LLAssetType::AT_NONE;
5397 char error_message[MAX_STRING]; 5391 char error_message[MAX_STRING]; /* Flawfinder: ignore */
5398 error_message[0] = '\0'; 5392 error_message[0] = '\0';
5399 LLString temp_str; 5393 LLString temp_str;
5400 5394
@@ -5408,7 +5402,8 @@ void upload_new_resource(const LLString& src_filename, std::string name,
5408 LLString short_name = filename.substr(offset); 5402 LLString short_name = filename.substr(offset);
5409 5403
5410 // No extension 5404 // No extension
5411 sprintf(error_message, 5405 snprintf(error_message, /* Flawfinder: ignore */
5406 MAX_STRING,
5412 "No file extension for the file: '%s'\nPlease make sure the file has a correct file extension", 5407 "No file extension for the file: '%s'\nPlease make sure the file has a correct file extension",
5413 short_name.c_str()); 5408 short_name.c_str());
5414 args["[FILE]"] = short_name; 5409 args["[FILE]"] = short_name;
@@ -5422,7 +5417,7 @@ void upload_new_resource(const LLString& src_filename, std::string name,
5422 filename, 5417 filename,
5423 IMG_CODEC_BMP )) 5418 IMG_CODEC_BMP ))
5424 { 5419 {
5425 sprintf(error_message, "Problem with file %s:\n\n%s\n", 5420 snprintf(error_message, MAX_STRING, "Problem with file %s:\n\n%s\n", /* Flawfinder: ignore */
5426 src_filename.c_str(), LLImageBase::getLastError().c_str()); 5421 src_filename.c_str(), LLImageBase::getLastError().c_str());
5427 args["[FILE]"] = src_filename; 5422 args["[FILE]"] = src_filename;
5428 args["[ERROR]"] = LLImageBase::getLastError(); 5423 args["[ERROR]"] = LLImageBase::getLastError();
@@ -5437,7 +5432,7 @@ void upload_new_resource(const LLString& src_filename, std::string name,
5437 filename, 5432 filename,
5438 IMG_CODEC_TGA )) 5433 IMG_CODEC_TGA ))
5439 { 5434 {
5440 sprintf(error_message, "Problem with file %s:\n\n%s\n", 5435 snprintf(error_message, MAX_STRING, "Problem with file %s:\n\n%s\n", /* Flawfinder: ignore */
5441 src_filename.c_str(), LLImageBase::getLastError().c_str()); 5436 src_filename.c_str(), LLImageBase::getLastError().c_str());
5442 args["[FILE]"] = src_filename; 5437 args["[FILE]"] = src_filename;
5443 args["[ERROR]"] = LLImageBase::getLastError(); 5438 args["[ERROR]"] = LLImageBase::getLastError();
@@ -5452,7 +5447,7 @@ void upload_new_resource(const LLString& src_filename, std::string name,
5452 filename, 5447 filename,
5453 IMG_CODEC_JPEG )) 5448 IMG_CODEC_JPEG ))
5454 { 5449 {
5455 sprintf(error_message, "Problem with file %s:\n\n%s\n", 5450 snprintf(error_message, MAX_STRING, "Problem with file %s:\n\n%s\n", /* Flawfinder: ignore */
5456 src_filename.c_str(), LLImageBase::getLastError().c_str()); 5451 src_filename.c_str(), LLImageBase::getLastError().c_str());
5457 args["[FILE]"] = src_filename; 5452 args["[FILE]"] = src_filename;
5458 args["[ERROR]"] = LLImageBase::getLastError(); 5453 args["[ERROR]"] = LLImageBase::getLastError();
@@ -5480,13 +5475,13 @@ void upload_new_resource(const LLString& src_filename, std::string name,
5480 switch(encode_result) 5475 switch(encode_result)
5481 { 5476 {
5482 case LLVORBISENC_DEST_OPEN_ERR: 5477 case LLVORBISENC_DEST_OPEN_ERR:
5483 sprintf(error_message, "Couldn't open temporary compressed sound file for writing: %s\n", filename.c_str()); 5478 snprintf(error_message, MAX_STRING, "Couldn't open temporary compressed sound file for writing: %s\n", filename.c_str()); /* Flawfinder: ignore */
5484 args["[FILE]"] = filename; 5479 args["[FILE]"] = filename;
5485 upload_error(error_message, "CannotOpenTemporarySoundFile", filename, args); 5480 upload_error(error_message, "CannotOpenTemporarySoundFile", filename, args);
5486 break; 5481 break;
5487 5482
5488 default: 5483 default:
5489 sprintf(error_message, "Unknown vorbis encode failure on: %s\n", src_filename.c_str()); 5484 snprintf(error_message, MAX_STRING, "Unknown vorbis encode failure on: %s\n", src_filename.c_str()); /* Flawfinder: ignore */
5490 args["[FILE]"] = src_filename; 5485 args["[FILE]"] = src_filename;
5491 upload_error(error_message, "UnknownVorbisEncodeFailure", filename, args); 5486 upload_error(error_message, "UnknownVorbisEncodeFailure", filename, args);
5492 break; 5487 break;
@@ -5498,26 +5493,29 @@ void upload_new_resource(const LLString& src_filename, std::string name,
5498 { 5493 {
5499 // This is a generic .lin resource file 5494 // This is a generic .lin resource file
5500 asset_type = LLAssetType::AT_OBJECT; 5495 asset_type = LLAssetType::AT_OBJECT;
5501 FILE *in = LLFile::fopen(src_filename.c_str(), "rb"); 5496 FILE* in = LLFile::fopen(src_filename.c_str(), "rb"); /* Flawfinder: ignore */
5502 if (in) 5497 if (in)
5503 { 5498 {
5504 // read in the file header 5499 // read in the file header
5505 char buf[16384]; 5500 char buf[16384]; /* Flawfinder: ignore */
5506 S32 read; 5501 S32 read; /* Flawfinder: ignore */
5507 S32 version; 5502 S32 version;
5508 if (fscanf(in, "LindenResource\nversion %d\n", &version)) 5503 if (fscanf(in, "LindenResource\nversion %d\n", &version))
5509 { 5504 {
5510 if (2 == version) 5505 if (2 == version)
5511 { 5506 {
5512 // *NOTE: This buffer size is hard coded into scanf() below. 5507 // *NOTE: This buffer size is hard coded into scanf() below.
5513 char label[MAX_STRING]; 5508 char label[MAX_STRING]; /* Flawfinder: ignore */
5514 char value[MAX_STRING]; 5509 char value[MAX_STRING]; /* Flawfinder: ignore */
5515 S32 tokens_read; 5510 S32 tokens_read;
5516 while (fgets(buf, 1024, in)) 5511 while (fgets(buf, 1024, in))
5517 { 5512 {
5518 label[0] = '\0'; 5513 label[0] = '\0';
5519 value[0] = '\0'; 5514 value[0] = '\0';
5520 tokens_read = sscanf(buf, "%254s %254s\n", label, value); 5515 tokens_read = sscanf( /* Flawfinder: ignore */
5516 buf,
5517 "%254s %254s\n",
5518 label, value);
5521 5519
5522 llinfos << "got: " << label << " = " << value 5520 llinfos << "got: " << label << " = " << value
5523 << llendl; 5521 << llendl;
@@ -5525,7 +5523,7 @@ void upload_new_resource(const LLString& src_filename, std::string name,
5525 if (EOF == tokens_read) 5523 if (EOF == tokens_read)
5526 { 5524 {
5527 fclose(in); 5525 fclose(in);
5528 sprintf(error_message, "corrupt resource file: %s", src_filename.c_str()); 5526 snprintf(error_message, MAX_STRING, "corrupt resource file: %s", src_filename.c_str()); /* Flawfinder: ignore */
5529 args["[FILE]"] = src_filename; 5527 args["[FILE]"] = src_filename;
5530 upload_error(error_message, "CorruptResourceFile", filename, args); 5528 upload_error(error_message, "CorruptResourceFile", filename, args);
5531 return; 5529 return;
@@ -5553,7 +5551,7 @@ void upload_new_resource(const LLString& src_filename, std::string name,
5553 else 5551 else
5554 { 5552 {
5555 fclose(in); 5553 fclose(in);
5556 sprintf(error_message, "unknown linden resource file version in file: %s", src_filename.c_str()); 5554 snprintf(error_message, MAX_STRING, "unknown linden resource file version in file: %s", src_filename.c_str()); /* Flawfinder: ignore */
5557 args["[FILE]"] = src_filename; 5555 args["[FILE]"] = src_filename;
5558 upload_error(error_message, "UnknownResourceFileVersion", filename, args); 5556 upload_error(error_message, "UnknownResourceFileVersion", filename, args);
5559 return; 5557 return;
@@ -5572,24 +5570,24 @@ void upload_new_resource(const LLString& src_filename, std::string name,
5572 5570
5573 // read in and throw out most of the header except for the type 5571 // read in and throw out most of the header except for the type
5574 fread(buf, header_size, 1, in); 5572 fread(buf, header_size, 1, in);
5575 memcpy(&type_num, buf + 16, sizeof(S16)); 5573 memcpy(&type_num, buf + 16, sizeof(S16)); /* Flawfinder: ignore */
5576 asset_type = (LLAssetType::EType)type_num; 5574 asset_type = (LLAssetType::EType)type_num;
5577 } 5575 }
5578 5576
5579 // copy the file's data segment into another file for uploading 5577 // copy the file's data segment into another file for uploading
5580 FILE *out = LLFile::fopen(filename.c_str(), "wb"); 5578 FILE* out = LLFile::fopen(filename.c_str(), "wb"); /* Flawfinder: ignore */
5581 if (out) 5579 if (out)
5582 { 5580 {
5583 while((read = fread(buf, 1, 16384, in))) 5581 while((read = fread(buf, 1, 16384, in))) /* Flawfinder: ignore */
5584 { 5582 {
5585 fwrite(buf, 1, read, out); 5583 fwrite(buf, 1, read, out); /* Flawfinder: ignore */
5586 } 5584 }
5587 fclose(out); 5585 fclose(out);
5588 } 5586 }
5589 else 5587 else
5590 { 5588 {
5591 fclose(in); 5589 fclose(in);
5592 sprintf(error_message, "Unable to create output file: %s", filename.c_str()); 5590 snprintf(error_message, MAX_STRING, "Unable to create output file: %s", filename.c_str()); /* Flawfinder: ignore */
5593 args["[FILE]"] = filename; 5591 args["[FILE]"] = filename;
5594 upload_error(error_message, "UnableToCreateOutputFile", filename, args); 5592 upload_error(error_message, "UnableToCreateOutputFile", filename, args);
5595 return; 5593 return;
@@ -5604,14 +5602,14 @@ void upload_new_resource(const LLString& src_filename, std::string name,
5604 } 5602 }
5605 else if (LLString::compareInsensitive(ext.c_str(),".bvh") == 0) 5603 else if (LLString::compareInsensitive(ext.c_str(),".bvh") == 0)
5606 { 5604 {
5607 sprintf(error_message, "We do not currently support bulk upload of animation files\n"); 5605 snprintf(error_message, MAX_STRING, "We do not currently support bulk upload of animation files\n"); /* Flawfinder: ignore */
5608 upload_error(error_message, "DoNotSupportBulkAnimationUpload", filename, args); 5606 upload_error(error_message, "DoNotSupportBulkAnimationUpload", filename, args);
5609 return; 5607 return;
5610 } 5608 }
5611 else 5609 else
5612 { 5610 {
5613 // Unknown extension 5611 // Unknown extension
5614 sprintf(error_message, "Unknown file extension %s\nExpected .wav, .tga, .bmp, .jpg, .jpeg, or .bvh", ext.c_str()); 5612 snprintf(error_message, MAX_STRING, "Unknown file extension %s\nExpected .wav, .tga, .bmp, .jpg, .jpeg, or .bvh", ext.c_str()); /* Flawfinder: ignore */
5615 error = TRUE;; 5613 error = TRUE;;
5616 } 5614 }
5617 5615
@@ -5640,7 +5638,7 @@ void upload_new_resource(const LLString& src_filename, std::string name,
5640 } 5638 }
5641 else 5639 else
5642 { 5640 {
5643 sprintf(error_message, "Unable to access output file: %s", filename.c_str()); 5641 snprintf(error_message, MAX_STRING, "Unable to access output file: %s", filename.c_str()); /* Flawfinder: ignore */
5644 error = TRUE; 5642 error = TRUE;
5645 } 5643 }
5646 } 5644 }
@@ -5724,7 +5722,7 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
5724 llinfos << "Desc: " << desc << llendl; 5722 llinfos << "Desc: " << desc << llendl;
5725 lldebugs << "Folder: " << gInventory.findCategoryUUIDForType(destination_folder_type) << llendl; 5723 lldebugs << "Folder: " << gInventory.findCategoryUUIDForType(destination_folder_type) << llendl;
5726 lldebugs << "Asset Type: " << LLAssetType::lookup(asset_type) << llendl; 5724 lldebugs << "Asset Type: " << LLAssetType::lookup(asset_type) << llendl;
5727 std::string url = gAgent.getRegion()->getCapability("NewAgentInventory"); 5725 std::string url = gAgent.getRegion()->getCapability("NewFileAgentInventory");
5728 if (!url.empty()) 5726 if (!url.empty())
5729 { 5727 {
5730 llinfos << "New Agent Inventory via capability" << llendl; 5728 llinfos << "New Agent Inventory via capability" << llendl;
@@ -5738,7 +5736,7 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
5738 std::ostringstream llsdxml; 5736 std::ostringstream llsdxml;
5739 LLSDSerialize::toXML(body, llsdxml); 5737 LLSDSerialize::toXML(body, llsdxml);
5740 lldebugs << "posting body to capability: " << llsdxml.str() << llendl; 5738 lldebugs << "posting body to capability: " << llsdxml.str() << llendl;
5741 LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(uuid, body)); 5739 LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(body, uuid, asset_type));
5742 } 5740 }
5743 else 5741 else
5744 { 5742 {
@@ -5884,7 +5882,7 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result) // St
5884 char* end_p = strrchr(asset_name_str, '.'); // strip extension if exists 5882 char* end_p = strrchr(asset_name_str, '.'); // strip extension if exists
5885 if( !end_p ) 5883 if( !end_p )
5886 { 5884 {
5887 end_p = asset_name_str + strlen( asset_name_str ); 5885 end_p = asset_name_str + strlen( asset_name_str ); /* Flawfinder: ignore */
5888 } 5886 }
5889 5887
5890 S32 len = llmin( (S32) (DB_INV_ITEM_NAME_STR_LEN), (S32) (end_p - asset_name_str) ); 5888 S32 len = llmin( (S32) (DB_INV_ITEM_NAME_STR_LEN), (S32) (end_p - asset_name_str) );
@@ -5903,12 +5901,13 @@ LLUploadDialog *gExportDialog = NULL;
5903 5901
5904void handle_export_selected( void * ) 5902void handle_export_selected( void * )
5905{ 5903{
5906 if (gSelectMgr->isEmpty()) 5904 LLObjectSelectionHandle selection = gSelectMgr->getSelection();
5905 if (selection->isEmpty())
5907 { 5906 {
5908 return; 5907 return;
5909 } 5908 }
5910 llinfos << "Exporting selected objects:" << llendl; 5909 llinfos << "Exporting selected objects:" << llendl;
5911 LLViewerObject *object = gSelectMgr->getFirstRootObject(); 5910 LLViewerObject *object = selection->getFirstRootObject();
5912 5911
5913 gExporterRequestID.generate(); 5912 gExporterRequestID.generate();
5914 gExportDirectory = ""; 5913 gExportDirectory = "";
@@ -5920,7 +5919,7 @@ void handle_export_selected( void * )
5920 msg->addUUIDFast(_PREHASH_RequestID, gExporterRequestID); 5919 msg->addUUIDFast(_PREHASH_RequestID, gExporterRequestID);
5921 msg->addS16Fast(_PREHASH_VolumeDetail, 4); 5920 msg->addS16Fast(_PREHASH_VolumeDetail, 4);
5922 5921
5923 for (; object != NULL; object = gSelectMgr->getNextRootObject()) 5922 for (; object != NULL; object = selection->getNextRootObject())
5924 { 5923 {
5925 msg->nextBlockFast(_PREHASH_ObjectData); 5924 msg->nextBlockFast(_PREHASH_ObjectData);
5926 msg->addUUIDFast(_PREHASH_ObjectID, object->getID()); 5925 msg->addUUIDFast(_PREHASH_ObjectID, object->getID());
@@ -5934,7 +5933,7 @@ void handle_export_selected( void * )
5934BOOL menu_check_build_tool( void* user_data ) 5933BOOL menu_check_build_tool( void* user_data )
5935{ 5934{
5936 S32 index = (intptr_t) user_data; 5935 S32 index = (intptr_t) user_data;
5937 return gCurrentToolset->isToolSelected( index ); 5936 return gToolMgr->getCurrentToolset()->isToolSelected( index );
5938} 5937}
5939 5938
5940void handle_reload_settings(void*) 5939void handle_reload_settings(void*)
@@ -6083,7 +6082,7 @@ class LLToolsLookAtSelection : public view_listener_t
6083 { 6082 {
6084 const F32 PADDING_FACTOR = 2.f; 6083 const F32 PADDING_FACTOR = 2.f;
6085 BOOL zoom = (userdata.asString() == "zoom"); 6084 BOOL zoom = (userdata.asString() == "zoom");
6086 if (!gSelectMgr->isEmpty()) 6085 if (!gSelectMgr->getSelection()->isEmpty())
6087 { 6086 {
6088 gAgent.setFocusOnAvatar(FALSE, ANIMATE); 6087 gAgent.setFocusOnAvatar(FALSE, ANIMATE);
6089 6088
@@ -6096,26 +6095,17 @@ class LLToolsLookAtSelection : public view_listener_t
6096 6095
6097 if (zoom) 6096 if (zoom)
6098 { 6097 {
6099 gAgent.setCameraPosAndFocusGlobal(gSelectMgr->getSelectionCenterGlobal() + LLVector3d(obj_to_cam * distance), gSelectMgr->getSelectionCenterGlobal(), gSelectMgr->getFirstObject()->mID ); 6098 gAgent.setCameraPosAndFocusGlobal(gSelectMgr->getSelectionCenterGlobal() + LLVector3d(obj_to_cam * distance), gSelectMgr->getSelectionCenterGlobal(), gSelectMgr->getSelection()->getFirstObject()->mID );
6100 } 6099 }
6101 else 6100 else
6102 { 6101 {
6103 gAgent.setFocusGlobal( gSelectMgr->getSelectionCenterGlobal(), gSelectMgr->getFirstObject()->mID ); 6102 gAgent.setFocusGlobal( gSelectMgr->getSelectionCenterGlobal(), gSelectMgr->getSelection()->getFirstObject()->mID );
6104 } 6103 }
6105 } 6104 }
6106 return true; 6105 return true;
6107 } 6106 }
6108}; 6107};
6109 6108
6110/*
6111void handle_reset_rotation(void*)
6112{
6113 gSelectMgr->selectionResetRotation();
6114
6115 dialog_refresh_all();
6116}
6117*/
6118
6119class LLAvatarAddFriend : public view_listener_t 6109class LLAvatarAddFriend : public view_listener_t
6120{ 6110{
6121 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 6111 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
@@ -6125,7 +6115,6 @@ class LLAvatarAddFriend : public view_listener_t
6125 { 6115 {
6126 request_friendship(avatar->getID()); 6116 request_friendship(avatar->getID());
6127 } 6117 }
6128 gSelectMgr->deselectTransient();
6129 return true; 6118 return true;
6130 } 6119 }
6131}; 6120};
@@ -6137,54 +6126,47 @@ void complete_give_money(S32 option, void* user_data)
6137 gAgent.clearBusy(); 6126 gAgent.clearBusy();
6138 } 6127 }
6139 6128
6140 LLUUID* object_id = (LLUUID*)user_data; 6129 LLObjectSelectionHandle handle(*(LLObjectSelectionHandle*)user_data);
6130 delete (LLObjectSelectionHandle*)user_data;
6141 6131
6142 LLViewerObject* object = gObjectList.findObject(*object_id); 6132 LLViewerObject* objectp = handle->getPrimaryObject();
6143 if (object) 6133
6134 // Show avatar's name if paying attachment
6135 if (objectp && objectp->isAttachment())
6144 { 6136 {
6145 if (object->isAvatar()) 6137 while (objectp && !objectp->isAvatar())
6138 {
6139 objectp = (LLViewerObject*)objectp->getParent();
6140 }
6141 }
6142
6143 if (objectp)
6144 {
6145 if (objectp->isAvatar())
6146 { 6146 {
6147 const BOOL is_group = FALSE; 6147 const BOOL is_group = FALSE;
6148 LLFloaterPay::payDirectly(&give_money, 6148 LLFloaterPay::payDirectly(&give_money,
6149 *object_id, 6149 objectp->getID(),
6150 is_group); 6150 is_group);
6151 } 6151 }
6152 else 6152 else
6153 { 6153 {
6154 LLFloaterPay::payViaObject(&give_money, *object_id); 6154 LLFloaterPay::payViaObject(&give_money, objectp->getID());
6155 } 6155 }
6156 } 6156 }
6157
6158 delete object_id;
6159} 6157}
6160 6158
6161bool handle_give_money_dialog() 6159bool handle_give_money_dialog()
6162{ 6160{
6163 LLViewerObject *objectp = gViewerWindow->lastObjectHit(); 6161 LLObjectSelectionHandle* handlep = new LLObjectSelectionHandle(gSelectMgr->getSelection());
6164 LLUUID* object_id = new LLUUID();
6165
6166 // Show avatar's name if paying attachment
6167 if (objectp && objectp->isAttachment())
6168 {
6169 while (objectp && !objectp->isAvatar())
6170 {
6171 objectp = (LLViewerObject*)objectp->getParent();
6172 }
6173 }
6174
6175 if (objectp)
6176 {
6177 *object_id = objectp->getID();
6178 }
6179
6180 if (gAgent.getBusy()) 6162 if (gAgent.getBusy())
6181 { 6163 {
6182 // warn users of being in busy mode during a transaction 6164 // warn users of being in busy mode during a transaction
6183 gViewerWindow->alertXml("BusyModePay", complete_give_money, object_id); 6165 gViewerWindow->alertXml("BusyModePay", complete_give_money, handlep);
6184 } 6166 }
6185 else 6167 else
6186 { 6168 {
6187 complete_give_money(1, object_id); 6169 complete_give_money(1, handlep);
6188 } 6170 }
6189 return true; 6171 return true;
6190} 6172}
@@ -6252,7 +6234,7 @@ class LLObjectEnableSitOrStand : public view_listener_t
6252 } 6234 }
6253 else 6235 else
6254 { 6236 {
6255 LLSelectNode* node = gSelectMgr->getFirstRootNode(); 6237 LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode();
6256 if (node && node->mValid && !node->mSitName.empty()) 6238 if (node && node->mValid && !node->mSitName.empty())
6257 { 6239 {
6258 label.assign(node->mSitName); 6240 label.assign(node->mSitName);
@@ -6288,25 +6270,6 @@ void dump_inventory(void*)
6288 gInventory.dumpInventory(); 6270 gInventory.dumpInventory();
6289} 6271}
6290 6272
6291
6292void handle_first_tool(void*)
6293{
6294 gCurrentToolset->selectFirstTool();
6295}
6296
6297
6298void handle_next_tool(void*)
6299{
6300 gCurrentToolset->selectNextTool();
6301}
6302
6303
6304void handle_previous_tool(void*)
6305{
6306 gCurrentToolset->selectPrevTool();
6307}
6308
6309
6310// forcibly unlock an object 6273// forcibly unlock an object
6311void handle_force_unlock(void*) 6274void handle_force_unlock(void*)
6312{ 6275{
@@ -6315,7 +6278,7 @@ void handle_force_unlock(void*)
6315 6278
6316 // Second, lie to the viewer and mark it editable and unowned 6279 // Second, lie to the viewer and mark it editable and unowned
6317 LLViewerObject* object; 6280 LLViewerObject* object;
6318 for (object = gSelectMgr->getFirstObject(); object; object = gSelectMgr->getNextObject() ) 6281 for (object = gSelectMgr->getSelection()->getFirstObject(); object; object = gSelectMgr->getSelection()->getNextObject() )
6319 { 6282 {
6320 object->mFlags |= FLAGS_OBJECT_MOVE; 6283 object->mFlags |= FLAGS_OBJECT_MOVE;
6321 object->mFlags |= FLAGS_OBJECT_MODIFY; 6284 object->mFlags |= FLAGS_OBJECT_MODIFY;
@@ -6377,24 +6340,6 @@ void handle_dump_followcam(void*)
6377 LLFollowCamMgr::dump(); 6340 LLFollowCamMgr::dump();
6378} 6341}
6379 6342
6380void handle_viewer_enable_circuit_log(void*)
6381{
6382 llinfos << "Showing circuit information every " << gMessageSystem->mCircuitPrintFreq << " seconds" << llendl;
6383 gErrorStream.setLevel( LLErrorStream::DEBUG );
6384 gErrorStream.setDebugFlag( LLERR_CIRCUIT_INFO );
6385 // and dump stuff out immediately
6386 gMessageSystem->dumpCircuitInfo();
6387}
6388
6389void handle_viewer_disable_circuit_log(void*)
6390{
6391 llinfos << "Hiding circuit information" << llendl;
6392#if !LL_DEBUG
6393 gErrorStream.setLevel( LLErrorStream::INFO );
6394#endif
6395 gErrorStream.clearDebugFlag( LLERR_CIRCUIT_INFO );
6396}
6397
6398void handle_viewer_enable_message_log(void*) 6343void handle_viewer_enable_message_log(void*)
6399{ 6344{
6400 gMessageSystem->startLogging(); 6345 gMessageSystem->startLogging();
@@ -6470,10 +6415,6 @@ class LLShowFloater : public view_listener_t
6470 { 6415 {
6471 gDebugView->mStatViewp->setVisible(!gDebugView->mStatViewp->getVisible()); 6416 gDebugView->mStatViewp->setVisible(!gDebugView->mStatViewp->getVisible());
6472 } 6417 }
6473 else if (floater_name == "account history")
6474 {
6475 LLFloaterAccountHistory::show(NULL);
6476 }
6477 else if (floater_name == "my land") 6418 else if (floater_name == "my land")
6478 { 6419 {
6479 LLFloaterLandHoldings::show(NULL); 6420 LLFloaterLandHoldings::show(NULL);
@@ -6624,7 +6565,15 @@ class LLPromptShowURL : public view_listener_t
6624 LLString alert = param.substr(0, offset); 6565 LLString alert = param.substr(0, offset);
6625 LLString url = param.substr(offset+1); 6566 LLString url = param.substr(offset+1);
6626 char *url_copy = new char[url.size()+1]; 6567 char *url_copy = new char[url.size()+1];
6627 strcpy(url_copy, url.c_str()); 6568 if (url_copy != NULL)
6569 {
6570 strcpy(url_copy, url.c_str()); /* Flawfinder: ignore */
6571 }
6572 else
6573 {
6574 llerrs << "Memory Allocation Failed" << llendl;
6575 return false;
6576 }
6628 gViewerWindow->alertXml(alert, callback_show_url, url_copy); 6577 gViewerWindow->alertXml(alert, callback_show_url, url_copy);
6629 } 6578 }
6630 else 6579 else
@@ -6656,7 +6605,15 @@ class LLPromptShowFile : public view_listener_t
6656 LLString alert = param.substr(0, offset); 6605 LLString alert = param.substr(0, offset);
6657 LLString file = param.substr(offset+1); 6606 LLString file = param.substr(offset+1);
6658 char *file_copy = new char[file.size()+1]; 6607 char *file_copy = new char[file.size()+1];
6659 strcpy(file_copy, file.c_str()); 6608 if (file_copy != NULL)
6609 {
6610 strcpy(file_copy, file.c_str()); /* Flawfinder: ignore */
6611 }
6612 else
6613 {
6614 llerrs << "Memory Allocation Failed" << llendl;
6615 return false;
6616 }
6660 gViewerWindow->alertXml(alert, callback_show_file, file_copy); 6617 gViewerWindow->alertXml(alert, callback_show_file, file_copy);
6661 } 6618 }
6662 else 6619 else
@@ -6737,8 +6694,8 @@ void handle_focus(void *)
6737 gViewerWindow->moveCursorToCenter(); 6694 gViewerWindow->moveCursorToCenter();
6738 6695
6739 // Switch to camera toolset 6696 // Switch to camera toolset
6740// gCurrentToolset = gCameraToolset; 6697// gToolMgr->setCurrentToolset(gCameraToolset);
6741 gCurrentToolset->selectTool( gToolCamera ); 6698 gToolMgr->getCurrentToolset()->selectTool( gToolCamera );
6742} 6699}
6743 6700
6744class LLLandEdit : public view_listener_t 6701class LLLandEdit : public view_listener_t
@@ -6764,10 +6721,10 @@ class LLLandEdit : public view_listener_t
6764 gParcelMgr->selectParcelAt( gLastHitPosGlobal ); 6721 gParcelMgr->selectParcelAt( gLastHitPosGlobal );
6765 6722
6766 gFloaterTools->showMore(TRUE); 6723 gFloaterTools->showMore(TRUE);
6767 gFloaterView->bringToFront( gFloaterTools ); 6724 gFloaterView->bringToFront( gFloaterTools );
6768 6725
6769 // Switch to land edit toolset 6726 // Switch to land edit toolset
6770 gCurrentToolset->selectTool( gToolParcel ); 6727 gToolMgr->getCurrentToolset()->selectTool( gToolParcel );
6771 return true; 6728 return true;
6772 } 6729 }
6773}; 6730};
@@ -6779,7 +6736,7 @@ class LLWorldEnableBuyLand : public view_listener_t
6779 bool new_value = gParcelMgr->canAgentBuyParcel( 6736 bool new_value = gParcelMgr->canAgentBuyParcel(
6780 gParcelMgr->selectionEmpty() 6737 gParcelMgr->selectionEmpty()
6781 ? gParcelMgr->getAgentParcel() 6738 ? gParcelMgr->getAgentParcel()
6782 : gParcelMgr->getSelectedParcel(), 6739 : gParcelMgr->getParcelSelection()->getParcel(),
6783 false); 6740 false);
6784 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); 6741 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
6785 return true; 6742 return true;
@@ -6789,7 +6746,7 @@ class LLWorldEnableBuyLand : public view_listener_t
6789BOOL enable_buy_land(void*) 6746BOOL enable_buy_land(void*)
6790{ 6747{
6791 return gParcelMgr->canAgentBuyParcel( 6748 return gParcelMgr->canAgentBuyParcel(
6792 gParcelMgr->getSelectedParcel(), false); 6749 gParcelMgr->getParcelSelection()->getParcel(), false);
6793} 6750}
6794 6751
6795 6752
@@ -6810,66 +6767,63 @@ void handle_move(void*)
6810 6767
6811 gViewerWindow->moveCursorToCenter(); 6768 gViewerWindow->moveCursorToCenter();
6812 6769
6813 gCurrentToolset = gBasicToolset; 6770 gToolMgr->setCurrentToolset(gBasicToolset);
6814 gCurrentToolset->selectTool( gToolGrab ); 6771 gToolMgr->getCurrentToolset()->selectTool( gToolGrab );
6815}
6816
6817
6818void near_attach_object(BOOL success, void *user_data)
6819{
6820 LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data;
6821
6822 U8 attachment_id;
6823 if (attachment)
6824 {
6825 attachment_id = gAgent.getAvatarObject()->mAttachmentPoints.reverseLookup(attachment);
6826 }
6827 else
6828 {
6829 // interpret 0 as "default location"
6830 attachment_id = 0;
6831 }
6832
6833 gSelectMgr->sendAttach(attachment_id);
6834} 6772}
6835 6773
6836class LLObjectAttachToAvatar : public view_listener_t 6774class LLObjectAttachToAvatar : public view_listener_t
6837{ 6775{
6776public:
6777 static void setObjectSelection(LLObjectSelectionHandle selection) { sObjectSelection = selection; }
6778
6779private:
6838 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 6780 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
6839 { 6781 {
6840 LLViewerObject* selectedObject = gSelectMgr->getFirstRootObject(); 6782 setObjectSelection(gSelectMgr->getSelection());
6783 LLViewerObject* selectedObject = sObjectSelection->getFirstRootObject();
6841 if (selectedObject) 6784 if (selectedObject)
6842 { 6785 {
6843 confirm_replace_attachment(0, NULL); 6786 S32 index = userdata.asInteger();
6787 LLViewerJointAttachment* attachment_point = index > 0 ?
6788 gAgent.getAvatarObject()->mAttachmentPoints[index] :
6789 NULL;
6790 confirm_replace_attachment(0, attachment_point);
6844 } 6791 }
6845 return true; 6792 return true;
6846 } 6793 }
6794
6795protected:
6796 static LLObjectSelectionHandle sObjectSelection;
6847}; 6797};
6848 6798
6849// move this somewhere global 6799LLObjectSelectionHandle LLObjectAttachToAvatar::sObjectSelection;
6850void handle_attach_to_avatar(void* user_data)
6851{
6852 LLViewerObject* selectedObject = gSelectMgr->getFirstRootObject();
6853 if (selectedObject)
6854 {
6855 LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data;
6856 6800
6857 if (attachment && attachment->getObject(0)) 6801void near_attach_object(BOOL success, void *user_data)
6858 { 6802{
6859 gViewerWindow->alertXml("ReplaceAttachment", confirm_replace_attachment, user_data); 6803 if (success)
6860 } 6804 {
6861 else 6805 LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data;
6862 { 6806
6863 confirm_replace_attachment(0, user_data); 6807 U8 attachment_id;
6864 } 6808 if (attachment)
6865 } 6809 {
6810 attachment_id = gAgent.getAvatarObject()->mAttachmentPoints.reverseLookup(attachment);
6811 }
6812 else
6813 {
6814 // interpret 0 as "default location"
6815 attachment_id = 0;
6816 }
6817 gSelectMgr->sendAttach(attachment_id);
6818 }
6819 LLObjectAttachToAvatar::setObjectSelection(NULL);
6866} 6820}
6821
6867void confirm_replace_attachment(S32 option, void* user_data) 6822void confirm_replace_attachment(S32 option, void* user_data)
6868{ 6823{
6869 if (option == 0/*YES*/) 6824 if (option == 0/*YES*/)
6870 { 6825 {
6871 gSelectMgr->convertTransient(); 6826 LLViewerObject* selectedObject = gSelectMgr->getSelection()->getFirstRootObject();
6872 LLViewerObject* selectedObject = gSelectMgr->getFirstRootObject();
6873 if (selectedObject) 6827 if (selectedObject)
6874 { 6828 {
6875 const F32 MIN_STOP_DISTANCE = 1.f; // meters 6829 const F32 MIN_STOP_DISTANCE = 1.f; // meters
@@ -6936,12 +6890,7 @@ class LLAttachmentDrop : public view_listener_t
6936 // objects. Thus we need to clear the list, make sure it only 6890 // objects. Thus we need to clear the list, make sure it only
6937 // contains the object the user clicked, send the message, 6891 // contains the object the user clicked, send the message,
6938 // then clear the list. 6892 // then clear the list.
6939 // We use deselectAll to update the simulator's notion of what's
6940 // selected, and removeAll just to change things locally.
6941 //gSelectMgr->deselectAll();
6942 //gSelectMgr->selectObjectAndFamily(object);
6943 gSelectMgr->sendDropAttachment(); 6893 gSelectMgr->sendDropAttachment();
6944 gSelectMgr->deselectTransient();
6945 return true; 6894 return true;
6946 } 6895 }
6947}; 6896};
@@ -6951,7 +6900,7 @@ void handle_detach_from_avatar(void* user_data)
6951{ 6900{
6952 LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data; 6901 LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data;
6953 6902
6954 LLViewerObject* attached_object = attachment->getObject(0); 6903 LLViewerObject* attached_object = attachment->getObject();
6955 6904
6956 if (attached_object) 6905 if (attached_object)
6957 { 6906 {
@@ -6972,7 +6921,7 @@ void attach_label(LLString& label, void* user_data)
6972 if (attachmentp) 6921 if (attachmentp)
6973 { 6922 {
6974 label = attachmentp->getName(); 6923 label = attachmentp->getName();
6975 if (attachmentp->getObject(0)) 6924 if (attachmentp->getObject())
6976 { 6925 {
6977 LLViewerInventoryItem* itemp = gInventory.getItem(attachmentp->getItemID()); 6926 LLViewerInventoryItem* itemp = gInventory.getItem(attachmentp->getItemID());
6978 if (itemp) 6927 if (itemp)
@@ -6989,7 +6938,7 @@ void detach_label(LLString& label, void* user_data)
6989 if (attachmentp) 6938 if (attachmentp)
6990 { 6939 {
6991 label = attachmentp->getName(); 6940 label = attachmentp->getName();
6992 if (attachmentp->getObject(0)) 6941 if (attachmentp->getObject())
6993 { 6942 {
6994 LLViewerInventoryItem* itemp = gInventory.getItem(attachmentp->getItemID()); 6943 LLViewerInventoryItem* itemp = gInventory.getItem(attachmentp->getItemID());
6995 if (itemp) 6944 if (itemp)
@@ -7044,10 +6993,9 @@ class LLAttachmentDetach : public view_listener_t
7044 // We use deselectAll to update the simulator's notion of what's 6993 // We use deselectAll to update the simulator's notion of what's
7045 // selected, and removeAll just to change things locally. 6994 // selected, and removeAll just to change things locally.
7046 //RN: I thought it was more useful to detach everything that was selected 6995 //RN: I thought it was more useful to detach everything that was selected
7047 if (gSelectMgr->selectionIsAttachment()) 6996 if (gSelectMgr->getSelection()->isAttachment())
7048 { 6997 {
7049 gSelectMgr->sendDetach(); 6998 gSelectMgr->sendDetach();
7050 gSelectMgr->deselectAll();
7051 } 6999 }
7052 return true; 7000 return true;
7053 } 7001 }
@@ -7164,8 +7112,10 @@ class LLAttachmentEnableDetach : public view_listener_t
7164BOOL object_selected_and_point_valid(void *user_data) 7112BOOL object_selected_and_point_valid(void *user_data)
7165{ 7113{
7166 //LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data; 7114 //LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data;
7115 if (gSelectMgr == NULL) return FALSE;
7167 7116
7168 for (LLViewerObject *object = gSelectMgr->getFirstRootObject(); object; object = gSelectMgr->getNextRootObject()) 7117 LLObjectSelectionHandle selection = gSelectMgr->getSelection();
7118 for (LLViewerObject *object = selection->getFirstRootObject(); object; object = selection->getNextRootObject())
7169 { 7119 {
7170 for (U32 child_num = 0; child_num < object->mChildList.size(); child_num++ ) 7120 for (U32 child_num = 0; child_num < object->mChildList.size(); child_num++ )
7171 { 7121 {
@@ -7176,12 +7126,11 @@ BOOL object_selected_and_point_valid(void *user_data)
7176 } 7126 }
7177 } 7127 }
7178 7128
7179 return ((gSelectMgr != NULL) && 7129 return (selection->getRootObjectCount() == 1) &&
7180 (gSelectMgr->getRootObjectCount() == 1) && 7130 (selection->getFirstRootObject()->getPCode() == LL_PCODE_VOLUME) &&
7181 (gSelectMgr->getFirstRootObject()->getPCode() == LL_PCODE_VOLUME) && 7131 selection->getFirstRootObject()->permYouOwner() &&
7182 gSelectMgr->getFirstRootObject()->permYouOwner() && 7132 !((LLViewerObject*)selection->getFirstRootObject()->getRoot())->isAvatar() &&
7183 !((LLViewerObject*)gSelectMgr->getFirstRootObject()->getRoot())->isAvatar() && 7133 (selection->getFirstRootObject()->getNVPair("AssetContainer") == NULL);
7184 (gSelectMgr->getFirstRootObject()->getNVPair("AssetContainer") == NULL));
7185} 7134}
7186 7135
7187// Also for seeing if object can be attached. See above. 7136// Also for seeing if object can be attached. See above.
@@ -7189,22 +7138,7 @@ class LLObjectEnableWear : public view_listener_t
7189{ 7138{
7190 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 7139 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
7191 { 7140 {
7192 bool new_value = false; 7141 return object_selected_and_point_valid(NULL);
7193 if (gSelectMgr)
7194 {
7195 LLViewerObject* first_root = gSelectMgr->getFirstRootObject();
7196 if (first_root)
7197 {
7198 new_value = gSelectMgr->getRootObjectCount() == 1
7199 && first_root->getPCode() == LL_PCODE_VOLUME
7200 && first_root->permYouOwner()
7201 && !((LLViewerObject*)gSelectMgr->getFirstRootObject()->getRoot())->isAvatar()
7202 && (first_root->getNVPair("AssetContainer") == NULL);
7203 }
7204 }
7205
7206 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
7207 return true;
7208 } 7142 }
7209}; 7143};
7210 7144
@@ -7213,7 +7147,7 @@ BOOL object_attached(void *user_data)
7213{ 7147{
7214 LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data; 7148 LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data;
7215 7149
7216 return attachment->getObject(0) != NULL; 7150 return attachment->getObject() != NULL;
7217} 7151}
7218 7152
7219class LLAvatarSendIM : public view_listener_t 7153class LLAvatarSendIM : public view_listener_t
@@ -7281,9 +7215,9 @@ class LLToolsSelectedScriptAction : public view_listener_t
7281 BOOL scripted = FALSE; 7215 BOOL scripted = FALSE;
7282 BOOL modifiable = FALSE; 7216 BOOL modifiable = FALSE;
7283 7217
7284 for(LLViewerObject* obj = gSelectMgr->getFirstObject(); 7218 for(LLViewerObject* obj = gSelectMgr->getSelection()->getFirstObject();
7285 obj; 7219 obj;
7286 obj = gSelectMgr->getNextObject()) 7220 obj = gSelectMgr->getSelection()->getNextObject())
7287 { 7221 {
7288 scripted = obj->flagScripted(); 7222 scripted = obj->flagScripted();
7289 modifiable = obj->permModify(); 7223 modifiable = obj->permModify();
@@ -7316,9 +7250,9 @@ void handle_reset_selection(void*)
7316 BOOL scripted = FALSE; 7250 BOOL scripted = FALSE;
7317 BOOL modifiable = FALSE; 7251 BOOL modifiable = FALSE;
7318 7252
7319 for(LLViewerObject* obj = gSelectMgr->getFirstObject(); 7253 for(LLViewerObject* obj = gSelectMgr->getSelection()->getFirstObject();
7320 obj; 7254 obj;
7321 obj = gSelectMgr->getNextObject()) 7255 obj = gSelectMgr->getSelection()->getNextObject())
7322 { 7256 {
7323 scripted = obj->flagScripted(); 7257 scripted = obj->flagScripted();
7324 modifiable = obj->permModify(); 7258 modifiable = obj->permModify();
@@ -7349,9 +7283,9 @@ void handle_set_run_selection(void*)
7349 BOOL scripted = FALSE; 7283 BOOL scripted = FALSE;
7350 BOOL modifiable = FALSE; 7284 BOOL modifiable = FALSE;
7351 7285
7352 for(LLViewerObject* obj = gSelectMgr->getFirstObject(); 7286 for(LLViewerObject* obj = gSelectMgr->getSelection()->getFirstObject();
7353 obj; 7287 obj;
7354 obj = gSelectMgr->getNextObject()) 7288 obj = gSelectMgr->getSelection()->getNextObject())
7355 { 7289 {
7356 scripted = obj->flagScripted(); 7290 scripted = obj->flagScripted();
7357 modifiable = obj->permModify(); 7291 modifiable = obj->permModify();
@@ -7382,9 +7316,9 @@ void handle_set_not_run_selection(void*)
7382 BOOL scripted = FALSE; 7316 BOOL scripted = FALSE;
7383 BOOL modifiable = FALSE; 7317 BOOL modifiable = FALSE;
7384 7318
7385 for(LLViewerObject* obj = gSelectMgr->getFirstObject(); 7319 for(LLViewerObject* obj = gSelectMgr->getSelection()->getFirstObject();
7386 obj; 7320 obj;
7387 obj = gSelectMgr->getNextObject()) 7321 obj = gSelectMgr->getSelection()->getNextObject())
7388 { 7322 {
7389 scripted = obj->flagScripted(); 7323 scripted = obj->flagScripted();
7390 modifiable = obj->permModify(); 7324 modifiable = obj->permModify();
@@ -7411,7 +7345,7 @@ void handle_set_not_run_selection(void*)
7411void handle_selected_texture_info(void*) 7345void handle_selected_texture_info(void*)
7412{ 7346{
7413 LLSelectNode* node = NULL; 7347 LLSelectNode* node = NULL;
7414 for (node = gSelectMgr->getFirstNode(); node != NULL; node = gSelectMgr->getNextNode()) 7348 for (node = gSelectMgr->getSelection()->getFirstNode(); node != NULL; node = gSelectMgr->getSelection()->getNextNode())
7415 { 7349 {
7416 if (!node->mValid) continue; 7350 if (!node->mValid) continue;
7417 7351
@@ -7446,7 +7380,7 @@ void handle_selected_texture_info(void*)
7446 std::string image_id_string; 7380 std::string image_id_string;
7447 if (gAgent.isGodlike()) 7381 if (gAgent.isGodlike())
7448 { 7382 {
7449 image_id_string = image_id.getString() + " "; 7383 image_id_string = image_id.asString() + " ";
7450 } 7384 }
7451 msg = llformat("%s%dx%d %s on face ", 7385 msg = llformat("%s%dx%d %s on face ",
7452 image_id_string.c_str(), 7386 image_id_string.c_str(),
@@ -7510,16 +7444,16 @@ void handle_dump_attachments(void*)
7510 attachment = avatar->mAttachmentPoints.getNextData() ) 7444 attachment = avatar->mAttachmentPoints.getNextData() )
7511 { 7445 {
7512 S32 key = avatar->mAttachmentPoints.getCurrentKeyWithoutIncrement(); 7446 S32 key = avatar->mAttachmentPoints.getCurrentKeyWithoutIncrement();
7513 BOOL visible = (attachment->getObject(0) != NULL && 7447 BOOL visible = (attachment->getObject() != NULL &&
7514 attachment->getObject(0)->mDrawable.notNull() && 7448 attachment->getObject()->mDrawable.notNull() &&
7515 !attachment->getObject(0)->mDrawable->isRenderType(0)); 7449 !attachment->getObject()->mDrawable->isRenderType(0));
7516 LLVector3 pos; 7450 LLVector3 pos;
7517 if (visible) pos = attachment->getObject(0)->mDrawable->getPosition(); 7451 if (visible) pos = attachment->getObject()->mDrawable->getPosition();
7518 llinfos << "ATTACHMENT " << key << ": item_id=" << attachment->getItemID() 7452 llinfos << "ATTACHMENT " << key << ": item_id=" << attachment->getItemID()
7519 << (attachment->getObject(0) ? " present " : " absent ") 7453 << (attachment->getObject() ? " present " : " absent ")
7520 << (visible ? "visible " : "invisible ") 7454 << (visible ? "visible " : "invisible ")
7521 << " at " << pos 7455 << " at " << pos
7522 << " and " << (visible ? attachment->getObject(0)->getPosition() : LLVector3::zero) 7456 << " and " << (visible ? attachment->getObject()->getPosition() : LLVector3::zero)
7523 << llendl; 7457 << llendl;
7524 } 7458 }
7525} 7459}
@@ -7598,7 +7532,7 @@ class LLSomethingSelected : public view_listener_t
7598{ 7532{
7599 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 7533 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
7600 { 7534 {
7601 bool new_value = !(gSelectMgr->isEmpty()); 7535 bool new_value = !(gSelectMgr->getSelection()->isEmpty());
7602 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); 7536 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
7603 return true; 7537 return true;
7604 } 7538 }
@@ -7608,7 +7542,8 @@ class LLSomethingSelectedNoHUD : public view_listener_t
7608{ 7542{
7609 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 7543 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
7610 { 7544 {
7611 bool new_value = !(gSelectMgr->isEmpty()) && !(gSelectMgr->getSelectType() == SELECT_TYPE_HUD); 7545 LLObjectSelectionHandle selection = gSelectMgr->getSelection();
7546 bool new_value = !(selection->isEmpty()) && !(selection->getSelectType() == SELECT_TYPE_HUD);
7612 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); 7547 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
7613 return true; 7548 return true;
7614 } 7549 }
@@ -7616,14 +7551,14 @@ class LLSomethingSelectedNoHUD : public view_listener_t
7616 7551
7617BOOL enable_more_than_one_selected(void* ) 7552BOOL enable_more_than_one_selected(void* )
7618{ 7553{
7619 return (gSelectMgr->getObjectCount() > 1); 7554 return (gSelectMgr->getSelection()->getObjectCount() > 1);
7620} 7555}
7621 7556
7622class LLEditableSelected : public view_listener_t 7557class LLEditableSelected : public view_listener_t
7623{ 7558{
7624 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 7559 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
7625 { 7560 {
7626 bool new_value = (gSelectMgr->getFirstEditableObject() != NULL); 7561 bool new_value = (gSelectMgr->getSelection()->getFirstEditableObject() != NULL);
7627 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); 7562 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
7628 return true; 7563 return true;
7629 } 7564 }
@@ -7642,10 +7577,11 @@ class LLToolsEnableTakeCopy : public view_listener_t
7642 if (gInProductionGrid || !gAgent.isGodlike()) 7577 if (gInProductionGrid || !gAgent.isGodlike())
7643# endif 7578# endif
7644 { 7579 {
7645 LLViewerObject* obj = gSelectMgr->getFirstRootObject(); 7580 LLObjectSelectionHandle selection = gSelectMgr->getSelection();
7581 LLViewerObject* obj = selection->getFirstRootObject();
7646 if(obj) 7582 if(obj)
7647 { 7583 {
7648 for( ; obj; obj = gSelectMgr->getNextRootObject()) 7584 for( ; obj; obj = selection->getNextRootObject())
7649 { 7585 {
7650 if(!(obj->permCopy()) || obj->isAttachment()) 7586 if(!(obj->permCopy()) || obj->isAttachment())
7651 { 7587 {
@@ -7665,11 +7601,15 @@ class LLToolsEnableTakeCopy : public view_listener_t
7665BOOL enable_selection_you_own_all(void*) 7601BOOL enable_selection_you_own_all(void*)
7666{ 7602{
7667 LLViewerObject *obj; 7603 LLViewerObject *obj;
7668 for (obj = gSelectMgr->getFirstRootObject(); obj; obj = gSelectMgr->getNextRootObject()) 7604 if (gSelectMgr)
7669 { 7605 {
7670 if (!obj->permYouOwner()) 7606 LLObjectSelectionHandle selection = gSelectMgr->getSelection();
7607 for (obj = selection->getFirstRootObject(); obj; obj = selection->getNextRootObject())
7671 { 7608 {
7672 return FALSE; 7609 if (!obj->permYouOwner())
7610 {
7611 return FALSE;
7612 }
7673 } 7613 }
7674 } 7614 }
7675 7615
@@ -7678,15 +7618,18 @@ BOOL enable_selection_you_own_all(void*)
7678 7618
7679BOOL enable_selection_you_own_one(void*) 7619BOOL enable_selection_you_own_one(void*)
7680{ 7620{
7681 LLViewerObject *obj; 7621 if (gSelectMgr)
7682 for (obj = gSelectMgr->getFirstRootObject(); obj; obj = gSelectMgr->getNextRootObject())
7683 { 7622 {
7684 if (obj->permYouOwner()) 7623 LLObjectSelectionHandle selection = gSelectMgr->getSelection();
7624 LLViewerObject *obj;
7625 for (obj = selection->getFirstRootObject(); obj; obj = selection->getNextRootObject())
7685 { 7626 {
7686 return TRUE; 7627 if (obj->permYouOwner())
7628 {
7629 return TRUE;
7630 }
7687 } 7631 }
7688 } 7632 }
7689
7690 return FALSE; 7633 return FALSE;
7691} 7634}
7692 7635
@@ -7720,9 +7663,9 @@ BOOL enable_save_into_inventory(void*)
7720 { 7663 {
7721 // find the last root 7664 // find the last root
7722 LLSelectNode* last_node = NULL; 7665 LLSelectNode* last_node = NULL;
7723 for(LLSelectNode* node = gSelectMgr->getFirstRootNode(); 7666 for(LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode();
7724 node != NULL; 7667 node != NULL;
7725 node = gSelectMgr->getNextRootNode()) 7668 node = gSelectMgr->getSelection()->getNextRootNode())
7726 { 7669 {
7727 last_node = node; 7670 last_node = node;
7728 } 7671 }
@@ -7766,7 +7709,7 @@ BOOL enable_save_into_task_inventory(void*)
7766{ 7709{
7767 if(gSelectMgr) 7710 if(gSelectMgr)
7768 { 7711 {
7769 LLSelectNode* node = gSelectMgr->getFirstRootNode(); 7712 LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode();
7770 if(node && (node->mValid) && (!node->mFromTaskID.isNull())) 7713 if(node && (node->mValid) && (!node->mFromTaskID.isNull()))
7771 { 7714 {
7772 // *TODO: check to see if the fromtaskid object exists. 7715 // *TODO: check to see if the fromtaskid object exists.
@@ -7807,7 +7750,7 @@ class LLFileEnableUpload : public view_listener_t
7807 7750
7808BOOL enable_export_selected(void *) 7751BOOL enable_export_selected(void *)
7809{ 7752{
7810 if (gSelectMgr->isEmpty()) 7753 if (gSelectMgr->getSelection()->isEmpty())
7811 { 7754 {
7812 return FALSE; 7755 return FALSE;
7813 } 7756 }
@@ -7838,7 +7781,7 @@ class LLToolsEnableToolNotPie : public view_listener_t
7838{ 7781{
7839 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 7782 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
7840 { 7783 {
7841 bool new_value = ( gToolMgr->getCurrentTool(MASK_NONE) != gToolPie ); 7784 bool new_value = ( gToolMgr->getBaseTool() != gToolPie );
7842 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); 7785 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
7843 return true; 7786 return true;
7844 } 7787 }
@@ -7866,6 +7809,18 @@ class LLWorldEnableSetHomeLocation : public view_listener_t
7866 } 7809 }
7867}; 7810};
7868 7811
7812class LLWorldEnableTeleportHome : public view_listener_t
7813{
7814 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
7815 {
7816 LLViewerRegion* regionp = gAgent.getRegion();
7817 bool agent_on_prelude = (regionp && regionp->isPrelude());
7818 bool enable_teleport_home = gAgent.isGodlike() || !agent_on_prelude;
7819 gMenuHolder->findControl(userdata["control"].asString())->setValue(enable_teleport_home);
7820 return true;
7821 }
7822};
7823
7869BOOL enable_region_owner(void*) 7824BOOL enable_region_owner(void*)
7870{ 7825{
7871 if(gAgent.getRegion() && gAgent.getRegion()->getOwner() == gAgent.getID()) 7826 if(gAgent.getRegion() && gAgent.getRegion()->getOwner() == gAgent.getID())
@@ -7893,26 +7848,6 @@ BOOL enable_god_basic(void*)
7893 return gAgent.getGodLevel() > GOD_NOT; 7848 return gAgent.getGodLevel() > GOD_NOT;
7894} 7849}
7895 7850
7896void toggle_vbo(void *)
7897{
7898 gPipeline.mUseVBO = !gPipeline.mUseVBO;
7899
7900 if (!gPipeline.usingAGP())
7901 {
7902 return;
7903 }
7904
7905 gPipeline.setUseAGP(FALSE);
7906 gPipeline.setUseAGP(TRUE);
7907
7908 gSavedSettings.setBOOL("RenderUseVBO", gPipeline.mUseVBO);
7909}
7910
7911BOOL check_vbo(void *)
7912{
7913 return gPipeline.mUseVBO;
7914}
7915
7916#if 0 // 1.9.2 7851#if 0 // 1.9.2
7917void toggle_vertex_shaders(void *) 7852void toggle_vertex_shaders(void *)
7918{ 7853{
@@ -7926,19 +7861,6 @@ BOOL check_vertex_shaders(void *)
7926} 7861}
7927#endif 7862#endif
7928 7863
7929void toggle_glow(void *)
7930{
7931 gRenderLightGlows = !gRenderLightGlows;
7932
7933 gSavedSettings.setBOOL("RenderLightGlows", gRenderLightGlows);
7934}
7935
7936BOOL check_glow(void *)
7937{
7938 return gRenderLightGlows;
7939}
7940
7941
7942void toggle_show_xui_names(void *) 7864void toggle_show_xui_names(void *)
7943{ 7865{
7944 BOOL showXUINames = gSavedSettings.getBOOL("ShowXUINames"); 7866 BOOL showXUINames = gSavedSettings.getBOOL("ShowXUINames");
@@ -8213,10 +8135,10 @@ LLVOAvatar* find_avatar_from_object( const LLUUID& object_id )
8213 8135
8214void handle_disconnect_viewer(void *) 8136void handle_disconnect_viewer(void *)
8215{ 8137{
8216 char message[2048]; 8138 char message[2048]; /* Flawfinder: ignore */
8217 message[0] = '\0'; 8139 message[0] = '\0';
8218 8140
8219 sprintf(message, "Testing viewer disconnect"); 8141 snprintf(message, sizeof(message), "Testing viewer disconnect"); /* Flawfinder: ignore */
8220 8142
8221 do_disconnect(message); 8143 do_disconnect(message);
8222} 8144}
@@ -8227,10 +8149,10 @@ class LLToolsUseSelectionForGrid : public view_listener_t
8227 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 8149 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
8228 { 8150 {
8229 gSelectMgr->clearGridObjects(); 8151 gSelectMgr->clearGridObjects();
8230 8152 LLObjectSelectionHandle selection = gSelectMgr->getSelection();
8231 for (LLViewerObject* objectp = gSelectMgr->getFirstRootObject(); 8153 for (LLViewerObject* objectp = selection->getFirstRootObject();
8232 objectp; 8154 objectp;
8233 objectp = gSelectMgr->getNextRootObject()) 8155 objectp = selection->getNextRootObject())
8234 { 8156 {
8235 gSelectMgr->addGridObject(objectp); 8157 gSelectMgr->addGridObject(objectp);
8236 } 8158 }
@@ -8255,23 +8177,40 @@ void handle_test_load_url(void*)
8255// LLViewerMenuHolderGL 8177// LLViewerMenuHolderGL
8256// 8178//
8257 8179
8180LLViewerMenuHolderGL::LLViewerMenuHolderGL() : LLMenuHolderGL()
8181{
8182}
8183
8258BOOL LLViewerMenuHolderGL::hideMenus() 8184BOOL LLViewerMenuHolderGL::hideMenus()
8259{ 8185{
8260 BOOL handled = LLMenuHolderGL::hideMenus(); 8186 BOOL handled = LLMenuHolderGL::hideMenus();
8261 if (handled) 8187
8262 { 8188 // drop pie menu selection
8263 gSelectMgr->deselectTransient(); 8189 mParcelSelection = NULL;
8264 if (!gFloaterTools->getVisible() && !LLFloaterLand::floaterVisible()) 8190 mObjectSelection = NULL;
8265 { 8191
8266 gParcelMgr->deselectLand();
8267 }
8268 }
8269 gMenuBarView->clearHoverItem(); 8192 gMenuBarView->clearHoverItem();
8270 gMenuBarView->resetMenuTrigger(); 8193 gMenuBarView->resetMenuTrigger();
8271 8194
8272 return handled; 8195 return handled;
8273} 8196}
8274 8197
8198void LLViewerMenuHolderGL::setParcelSelection(LLHandle<LLParcelSelection> selection)
8199{
8200 mParcelSelection = selection;
8201}
8202
8203void LLViewerMenuHolderGL::setObjectSelection(LLHandle<LLObjectSelection> selection)
8204{
8205 mObjectSelection = selection;
8206}
8207
8208
8209const LLRect LLViewerMenuHolderGL::getMenuRect() const
8210{
8211 return LLRect(0, mRect.getHeight() - MENU_BAR_HEIGHT, mRect.getWidth(), STATUS_BAR_HEIGHT);
8212}
8213
8275void handle_save_to_xml(void*) 8214void handle_save_to_xml(void*)
8276{ 8215{
8277 LLFloater* frontmost = gFloaterView->getFrontmost(); 8216 LLFloater* frontmost = gFloaterView->getFrontmost();
@@ -8431,7 +8370,7 @@ class LLViewToggleRenderType : public view_listener_t
8431 LLString type = userdata.asString(); 8370 LLString type = userdata.asString();
8432 if (type == "particles") 8371 if (type == "particles")
8433 { 8372 {
8434 LLPipeline::toggleRenderType((void *)(S32)LLPipeline::RENDER_TYPE_PARTICLES); 8373 LLPipeline::toggleRenderType(LLPipeline::RENDER_TYPE_PARTICLES);
8435 } 8374 }
8436 return true; 8375 return true;
8437 } 8376 }
@@ -8452,12 +8391,11 @@ class LLViewCheckRenderType : public view_listener_t
8452 } 8391 }
8453}; 8392};
8454 8393
8455// TomY TODO: Get rid of these?
8456class LLViewShowHUDAttachments : public view_listener_t 8394class LLViewShowHUDAttachments : public view_listener_t
8457{ 8395{
8458 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 8396 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
8459 { 8397 {
8460 LLDrawPoolHUD::sShowHUDAttachments = !LLDrawPoolHUD::sShowHUDAttachments; 8398 LLPipeline::sShowHUDAttachments = !LLPipeline::sShowHUDAttachments;
8461 return true; 8399 return true;
8462 } 8400 }
8463}; 8401};
@@ -8466,7 +8404,7 @@ class LLViewCheckHUDAttachments : public view_listener_t
8466{ 8404{
8467 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 8405 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
8468 { 8406 {
8469 bool new_value = LLDrawPoolHUD::sShowHUDAttachments; 8407 bool new_value = LLPipeline::sShowHUDAttachments;
8470 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); 8408 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
8471 return true; 8409 return true;
8472 } 8410 }
@@ -8594,23 +8532,23 @@ class LLToolsSelectTool : public view_listener_t
8594 LLString tool_name = userdata.asString(); 8532 LLString tool_name = userdata.asString();
8595 if (tool_name == "focus") 8533 if (tool_name == "focus")
8596 { 8534 {
8597 gCurrentToolset->selectToolByIndex(1); 8535 gToolMgr->getCurrentToolset()->selectToolByIndex(1);
8598 } 8536 }
8599 else if (tool_name == "move") 8537 else if (tool_name == "move")
8600 { 8538 {
8601 gCurrentToolset->selectToolByIndex(2); 8539 gToolMgr->getCurrentToolset()->selectToolByIndex(2);
8602 } 8540 }
8603 else if (tool_name == "edit") 8541 else if (tool_name == "edit")
8604 { 8542 {
8605 gCurrentToolset->selectToolByIndex(3); 8543 gToolMgr->getCurrentToolset()->selectToolByIndex(3);
8606 } 8544 }
8607 else if (tool_name == "create") 8545 else if (tool_name == "create")
8608 { 8546 {
8609 gCurrentToolset->selectToolByIndex(4); 8547 gToolMgr->getCurrentToolset()->selectToolByIndex(4);
8610 } 8548 }
8611 else if (tool_name == "land") 8549 else if (tool_name == "land")
8612 { 8550 {
8613 gCurrentToolset->selectToolByIndex(5); 8551 gToolMgr->getCurrentToolset()->selectToolByIndex(5);
8614 } 8552 }
8615 return true; 8553 return true;
8616 } 8554 }
@@ -8624,6 +8562,7 @@ void initialize_menu_actions()
8624 (new LLFileUploadAnim())->registerListener(gMenuHolder, "File.UploadAnim"); 8562 (new LLFileUploadAnim())->registerListener(gMenuHolder, "File.UploadAnim");
8625 (new LLFileUploadBulk())->registerListener(gMenuHolder, "File.UploadBulk"); 8563 (new LLFileUploadBulk())->registerListener(gMenuHolder, "File.UploadBulk");
8626 (new LLFileCloseWindow())->registerListener(gMenuHolder, "File.CloseWindow"); 8564 (new LLFileCloseWindow())->registerListener(gMenuHolder, "File.CloseWindow");
8565 (new LLFileEnableCloseWindow())->registerListener(gMenuHolder, "File.EnableCloseWindow");
8627 (new LLFileSaveTexture())->registerListener(gMenuHolder, "File.SaveTexture"); 8566 (new LLFileSaveTexture())->registerListener(gMenuHolder, "File.SaveTexture");
8628 (new LLFileTakeSnapshot())->registerListener(gMenuHolder, "File.TakeSnapshot"); 8567 (new LLFileTakeSnapshot())->registerListener(gMenuHolder, "File.TakeSnapshot");
8629 (new LLFileTakeSnapshotToDisk())->registerListener(gMenuHolder, "File.TakeSnapshotToDisk"); 8568 (new LLFileTakeSnapshotToDisk())->registerListener(gMenuHolder, "File.TakeSnapshotToDisk");
@@ -8698,6 +8637,7 @@ void initialize_menu_actions()
8698 8637
8699 (new LLWorldEnableCreateLandmark())->registerListener(gMenuHolder, "World.EnableCreateLandmark"); 8638 (new LLWorldEnableCreateLandmark())->registerListener(gMenuHolder, "World.EnableCreateLandmark");
8700 (new LLWorldEnableSetHomeLocation())->registerListener(gMenuHolder, "World.EnableSetHomeLocation"); 8639 (new LLWorldEnableSetHomeLocation())->registerListener(gMenuHolder, "World.EnableSetHomeLocation");
8640 (new LLWorldEnableTeleportHome())->registerListener(gMenuHolder, "World.EnableTeleportHome");
8701 (new LLWorldEnableBuyLand())->registerListener(gMenuHolder, "World.EnableBuyLand"); 8641 (new LLWorldEnableBuyLand())->registerListener(gMenuHolder, "World.EnableBuyLand");
8702 8642
8703 (new LLWorldCheckAlwaysRun())->registerListener(gMenuHolder, "World.CheckAlwaysRun"); 8643 (new LLWorldCheckAlwaysRun())->registerListener(gMenuHolder, "World.CheckAlwaysRun");