aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewermenu.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-09-06 18:24:57 -0500
committerJacek Antonelli2008-09-06 18:25:07 -0500
commit798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch)
tree1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/newview/llviewermenu.cpp
parentSecond Life viewer sources 1.20.15 (diff)
downloadmeta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz
Second Life viewer sources 1.21.0-RC
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewermenu.cpp768
1 files changed, 406 insertions, 362 deletions
diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp
index 3e99384..d78847e 100644
--- a/linden/indra/newview/llviewermenu.cpp
+++ b/linden/indra/newview/llviewermenu.cpp
@@ -128,6 +128,7 @@
128#include "llfloaterwater.h" 128#include "llfloaterwater.h"
129#include "llfloaterwindlight.h" 129#include "llfloaterwindlight.h"
130#include "llfloaterworldmap.h" 130#include "llfloaterworldmap.h"
131#include "llfloatermemleak.h"
131#include "llframestats.h" 132#include "llframestats.h"
132#include "llframestatview.h" 133#include "llframestatview.h"
133#include "llfasttimerview.h" 134#include "llfasttimerview.h"
@@ -255,24 +256,12 @@ LLPieMenu *gPieAttachment = NULL;
255LLPieMenu *gPieLand = NULL; 256LLPieMenu *gPieLand = NULL;
256 257
257// local constants 258// local constants
258const LLString LANDMARK_MENU_NAME("Landmarks"); 259const std::string LANDMARK_MENU_NAME("Landmarks");
259const LLString CLIENT_MENU_NAME("Advanced"); 260const std::string CLIENT_MENU_NAME("Advanced");
260const LLString SERVER_MENU_NAME("Admin"); 261const std::string SERVER_MENU_NAME("Admin");
261 262
262const LLString SAVE_INTO_INVENTORY("Save Object Back to My Inventory"); 263const std::string SAVE_INTO_INVENTORY("Save Object Back to My Inventory");
263const LLString SAVE_INTO_TASK_INVENTORY("Save Object Back to Object Contents"); 264const std::string SAVE_INTO_TASK_INVENTORY("Save Object Back to Object Contents");
264
265#if LL_WINDOWS
266static const char* SOUND_EXTENSIONS = ".wav";
267static const char* IMAGE_EXTENSIONS = ".tga .bmp .jpg .jpeg .png";
268static const char* ANIM_EXTENSIONS = ".bvh";
269#ifdef _CORY_TESTING
270static const char* GEOMETRY_EXTENSIONS = ".slg";
271#endif
272static const char* XML_EXTENSIONS = ".xml";
273static const char* SLOBJECT_EXTENSIONS = ".slobject";
274#endif
275static const char* ALL_FILE_EXTENSIONS = "*.*";
276 265
277LLMenuGL* gAttachSubMenu = NULL; 266LLMenuGL* gAttachSubMenu = NULL;
278LLMenuGL* gDetachSubMenu = NULL; 267LLMenuGL* gDetachSubMenu = NULL;
@@ -316,7 +305,7 @@ void handle_region_clear_temp_asset_data(void*);
316BOOL sitting_on_selection(); 305BOOL sitting_on_selection();
317 306
318void near_sit_object(); 307void near_sit_object();
319void label_sit_or_stand(LLString& label, void*); 308void label_sit_or_stand(std::string& label, void*);
320// buy and take alias into the same UI positions, so these 309// buy and take alias into the same UI positions, so these
321// declarations handle this mess. 310// declarations handle this mess.
322BOOL is_selection_buy_not_take(); 311BOOL is_selection_buy_not_take();
@@ -328,7 +317,7 @@ BOOL enable_buy(void*);
328void handle_buy(void *); 317void handle_buy(void *);
329void handle_buy_object(LLSaleInfo sale_info); 318void handle_buy_object(LLSaleInfo sale_info);
330void handle_buy_contents(LLSaleInfo sale_info); 319void handle_buy_contents(LLSaleInfo sale_info);
331void label_touch(LLString& label, void*); 320void label_touch(std::string& label, void*);
332 321
333// Land pie menu 322// Land pie menu
334void near_sit_down_point(BOOL success, void *); 323void near_sit_down_point(BOOL success, void *);
@@ -339,7 +328,6 @@ void handle_talk_to(void *userdata);
339 328
340// Debug menu 329// Debug menu
341void show_permissions_control(void*); 330void show_permissions_control(void*);
342void load_url_local_file(const char* file_name);
343void toggle_build_options(void* user_data); 331void toggle_build_options(void* user_data);
344#if 0 // Unused 332#if 0 // Unused
345void handle_audio_status_1(void*); 333void handle_audio_status_1(void*);
@@ -502,10 +490,12 @@ BOOL enable_selection_you_own_one(void*);
502BOOL enable_save_into_inventory(void*); 490BOOL enable_save_into_inventory(void*);
503BOOL enable_save_into_task_inventory(void*); 491BOOL enable_save_into_task_inventory(void*);
504BOOL enable_not_thirdperson(void*); 492BOOL enable_not_thirdperson(void*);
505BOOL enable_export_selected(void *); 493// BOOL enable_export_selected(void *);
506BOOL enable_have_card(void*); 494BOOL enable_have_card(void*);
507BOOL enable_detach(void*); 495BOOL enable_detach(void*);
508BOOL enable_region_owner(void*); 496BOOL enable_region_owner(void*);
497void menu_toggle_attached_lights(void* user_data);
498void menu_toggle_attached_particles(void* user_data);
509 499
510class LLLandmarkObserver : public LLInventoryObserver 500class LLLandmarkObserver : public LLInventoryObserver
511{ 501{
@@ -712,7 +702,7 @@ void init_menus()
712 gMenuBarView->setRect(LLRect(0, top, 0, top - MENU_BAR_HEIGHT)); 702 gMenuBarView->setRect(LLRect(0, top, 0, top - MENU_BAR_HEIGHT));
713 gMenuBarView->setBackgroundColor( color ); 703 gMenuBarView->setBackgroundColor( color );
714 704
715 gMenuBarView->setItemVisible("Tools", FALSE); 705 // gMenuBarView->setItemVisible("Tools", FALSE);
716 gMenuBarView->arrange(); 706 gMenuBarView->arrange();
717 707
718 gMenuHolder->addChild(gMenuBarView); 708 gMenuHolder->addChild(gMenuBarView);
@@ -725,7 +715,7 @@ void init_menus()
725 LLViewerLogin::getInstance()->isInProductionGrid()); 715 LLViewerLogin::getInstance()->isInProductionGrid());
726 716
727 // *TODO:Get the cost info from the server 717 // *TODO:Get the cost info from the server
728 const LLString upload_cost("10"); 718 const std::string upload_cost("10");
729 gMenuHolder->childSetLabelArg("Upload Image", "[COST]", upload_cost); 719 gMenuHolder->childSetLabelArg("Upload Image", "[COST]", upload_cost);
730 gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", upload_cost); 720 gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", upload_cost);
731 gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", upload_cost); 721 gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", upload_cost);
@@ -792,6 +782,7 @@ void init_landmark_menu(LLMenuGL* menu)
792 // clear existing menu, as we might be rebuilding as result of inventory update 782 // clear existing menu, as we might be rebuilding as result of inventory update
793 clear_landmark_menu(menu); 783 clear_landmark_menu(menu);
794 784
785 // *TODO: Translate
795 menu->append(new LLMenuItemCallGL("Organize Landmarks", 786 menu->append(new LLMenuItemCallGL("Organize Landmarks",
796 &manage_landmarks, NULL)); 787 &manage_landmarks, NULL));
797 menu->append(new LLMenuItemCallGL("New Landmark...", 788 menu->append(new LLMenuItemCallGL("New Landmark...",
@@ -808,7 +799,7 @@ void init_landmark_menu(LLMenuGL* menu)
808 for(S32 i = 0; i < count; ++i) 799 for(S32 i = 0; i < count; ++i)
809 { 800 {
810 LLInventoryItem* item = items->get(i); 801 LLInventoryItem* item = items->get(i);
811 LLString landmark_name = item->getName(); 802 std::string landmark_name = item->getName();
812 LLUUID* landmark_id_ptr = new LLUUID( item->getUUID() ); 803 LLUUID* landmark_id_ptr = new LLUUID( item->getUUID() );
813 LLMenuItemCallGL* menu_item = 804 LLMenuItemCallGL* menu_item =
814 new LLMenuItemCallGL(landmark_name, landmark_menu_action, 805 new LLMenuItemCallGL(landmark_name, landmark_menu_action,
@@ -847,9 +838,10 @@ void init_client_menu(LLMenuGL* menu)
847 LLMenuGL* sub_menu = NULL; 838 LLMenuGL* sub_menu = NULL;
848 839
849 //menu->append(new LLMenuItemCallGL("Permissions Control", &show_permissions_control)); 840 //menu->append(new LLMenuItemCallGL("Permissions Control", &show_permissions_control));
850 841 // this is now in the view menu so we don't need it here!
851// this is now in the view menu so we don't need it here! 842
852 { 843 {
844 // *TODO: Translate
853 LLMenuGL* sub = new LLMenuGL("Consoles"); 845 LLMenuGL* sub = new LLMenuGL("Consoles");
854 menu->appendMenu(sub); 846 menu->appendMenu(sub);
855 sub->append(new LLMenuItemCheckGL("Frame Console", 847 sub->append(new LLMenuItemCheckGL("Frame Console",
@@ -871,22 +863,7 @@ void init_client_menu(LLMenuGL* menu)
871 &get_visibility, 863 &get_visibility,
872 debugview, 864 debugview,
873 '4', MASK_CONTROL|MASK_SHIFT ) ); 865 '4', MASK_CONTROL|MASK_SHIFT ) );
874#if 0 // Unused
875 {
876 LLMenuGL* sub = new LLMenuGL("Audio");
877 menu->appendMenu(sub);
878 866
879 sub->append(new LLMenuItemCallGL("Global Pos",
880 &handle_audio_status_1, NULL, NULL ,'5', MASK_CONTROL|MASK_SHIFT) );
881 sub->append(new LLMenuItemCallGL("Cone",
882 &handle_audio_status_2, NULL, NULL ,'6', MASK_CONTROL|MASK_SHIFT) );
883 sub->append(new LLMenuItemCallGL("Local Pos",
884 &handle_audio_status_3, NULL, NULL ,'7', MASK_CONTROL|MASK_SHIFT) );
885 sub->append(new LLMenuItemCallGL("Duration",
886 &handle_audio_status_4, NULL, NULL ,'8', MASK_CONTROL|MASK_SHIFT) );
887 sub->createJumpKeys();
888 }
889#endif
890 sub->append(new LLMenuItemCheckGL("Fast Timers", 867 sub->append(new LLMenuItemCheckGL("Fast Timers",
891 &toggle_visibility, 868 &toggle_visibility,
892 NULL, 869 NULL,
@@ -1059,8 +1036,7 @@ void init_client_menu(LLMenuGL* menu)
1059 menu->appendSeparator(); 1036 menu->appendSeparator();
1060 1037
1061 menu->append(new LLMenuItemToggleGL("Show Updates", 1038 menu->append(new LLMenuItemToggleGL("Show Updates",
1062 &gShowObjectUpdates, 1039 &gShowObjectUpdates));
1063 'U', MASK_ALT | MASK_SHIFT | MASK_CONTROL));
1064 1040
1065 menu->appendSeparator(); 1041 menu->appendSeparator();
1066 1042
@@ -1168,7 +1144,7 @@ void handle_export_menus_to_xml(void*)
1168 llwarns << "No file" << llendl; 1144 llwarns << "No file" << llendl;
1169 return; 1145 return;
1170 } 1146 }
1171 const char* filename = picker.getFirstFile(); 1147 std::string filename = picker.getFirstFile();
1172 1148
1173 llofstream out(filename); 1149 llofstream out(filename);
1174 LLXMLNodePtr node = gMenuBarView->getXML(); 1150 LLXMLNodePtr node = gMenuBarView->getXML();
@@ -1385,12 +1361,10 @@ void init_debug_rendering_menu(LLMenuGL* menu)
1385 sub_menu->append(new LLMenuItemCheckGL("Glow",&LLPipeline::toggleRenderDebug, NULL, 1361 sub_menu->append(new LLMenuItemCheckGL("Glow",&LLPipeline::toggleRenderDebug, NULL,
1386 &LLPipeline::toggleRenderDebugControl, 1362 &LLPipeline::toggleRenderDebugControl,
1387 (void*)LLPipeline::RENDER_DEBUG_GLOW)); 1363 (void*)LLPipeline::RENDER_DEBUG_GLOW));
1364 sub_menu->append(new LLMenuItemCheckGL("Raycasting", &LLPipeline::toggleRenderDebug, NULL,
1365 &LLPipeline::toggleRenderDebugControl,
1366 (void*)LLPipeline::RENDER_DEBUG_RAYCAST));
1388 1367
1389 sub_menu->append(new LLMenuItemCheckGL("Show Depth Buffer",
1390 &menu_toggle_control,
1391 NULL,
1392 &menu_check_control,
1393 (void*)"ShowDepthBuffer"));
1394 sub_menu->append(new LLMenuItemToggleGL("Show Select Buffer", &gDebugSelect)); 1368 sub_menu->append(new LLMenuItemToggleGL("Show Select Buffer", &gDebugSelect));
1395 1369
1396 sub_menu->append(new LLMenuItemCallGL("Vectorize Perf Test", &run_vectorize_perf_test)); 1370 sub_menu->append(new LLMenuItemCallGL("Vectorize Perf Test", &run_vectorize_perf_test));
@@ -1457,6 +1431,23 @@ void init_debug_rendering_menu(LLMenuGL* menu)
1457 1431
1458 item = new LLMenuItemCheckGL("Cheesy Beacon", menu_toggle_control, NULL, menu_check_control, (void*)"CheesyBeacon"); 1432 item = new LLMenuItemCheckGL("Cheesy Beacon", menu_toggle_control, NULL, menu_check_control, (void*)"CheesyBeacon");
1459 menu->append(item); 1433 menu->append(item);
1434
1435 item = new LLMenuItemCheckGL("Attached Lights", menu_toggle_attached_lights, NULL, menu_check_control, (void*)"RenderAttachedLights");
1436 menu->append(item);
1437
1438 item = new LLMenuItemCheckGL("Attached Particles", menu_toggle_attached_particles, NULL, menu_check_control, (void*)"RenderAttachedParticles");
1439 menu->append(item);
1440
1441#ifndef LL_RELEASE_FOR_DOWNLOAD
1442 menu->appendSeparator();
1443 menu->append(new LLMenuItemCallGL("Memory Leaking Simulation", LLFloaterMemLeak::show, NULL, NULL));
1444#else
1445 if(gSavedSettings.getBOOL("QAMode"))
1446 {
1447 menu->appendSeparator();
1448 menu->append(new LLMenuItemCallGL("Memory Leaking Simulation", LLFloaterMemLeak::show, NULL, NULL));
1449 }
1450#endif
1460 1451
1461 menu->createJumpKeys(); 1452 menu->createJumpKeys();
1462} 1453}
@@ -1531,37 +1522,6 @@ void init_debug_baked_texture_menu(LLMenuGL* menu)
1531 1522
1532void init_server_menu(LLMenuGL* menu) 1523void init_server_menu(LLMenuGL* menu)
1533{ 1524{
1534 /*
1535 {
1536 // These messages are now trusted. We can write scripts to do
1537 // this, and the message is unchecked for source.
1538 LLMenuGL* sub_menu = NULL;
1539 sub_menu = new LLMenuGL("Sim Logging");
1540
1541 sub_menu->append(new LLMenuItemCallGL("Turn off llinfos Log",
1542 &handle_reduce_llinfo_log, &enable_god_customer_service));
1543
1544 sub_menu->append(new LLMenuItemCallGL("Normal Logging",
1545 &handle_normal_llinfo_log, &enable_god_customer_service));
1546
1547 sub_menu->appendSeparator();
1548 sub_menu->append(new LLMenuItemCallGL("Enable Message Log",
1549 &handle_sim_enable_message_log, &enable_god_customer_service));
1550 sub_menu->append(new LLMenuItemCallGL("Disable Message Log",
1551 &handle_sim_disable_message_log, &enable_god_customer_service));
1552
1553 sub_menu->appendSeparator();
1554
1555 sub_menu->append(new LLMenuItemCallGL("Fetch Message Log",
1556 &handle_sim_fetch_message_log, &enable_god_customer_service));
1557
1558 sub_menu->append(new LLMenuItemCallGL("Fetch Log",
1559 &handle_sim_fetch_log, &enable_god_customer_service));
1560
1561 menu->appendMenu( sub_menu );
1562 }
1563 */
1564
1565 { 1525 {
1566 LLMenuGL* sub = new LLMenuGL("Object"); 1526 LLMenuGL* sub = new LLMenuGL("Object");
1567 menu->appendMenu(sub); 1527 menu->appendMenu(sub);
@@ -1685,7 +1645,11 @@ class LLObjectReportAbuse : public view_listener_t
1685{ 1645{
1686 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 1646 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
1687 { 1647 {
1688 LLFloaterReporter::showFromObject(gLastHitObjectID); 1648 LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
1649 if (objectp)
1650 {
1651 LLFloaterReporter::showFromObject(objectp->getID());
1652 }
1689 return true; 1653 return true;
1690 } 1654 }
1691}; 1655};
@@ -1695,7 +1659,7 @@ class LLObjectEnableReportAbuse : public view_listener_t
1695{ 1659{
1696 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 1660 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
1697 { 1661 {
1698 bool new_value = !gLastHitObjectID.isNull(); 1662 bool new_value = LLSelectMgr::getInstance()->getSelection()->getObjectCount() != 0;
1699 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); 1663 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
1700 return true; 1664 return true;
1701 } 1665 }
@@ -1705,9 +1669,11 @@ class LLObjectTouch : public view_listener_t
1705{ 1669{
1706 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 1670 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
1707 { 1671 {
1708 LLViewerObject* object = gObjectList.findObject(gLastHitObjectID); 1672 LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
1709 if (!object) return true; 1673 if (!object) return true;
1710 1674
1675 LLPickInfo pick = LLToolPie::getInstance()->getPick();
1676
1711 LLMessageSystem *msg = gMessageSystem; 1677 LLMessageSystem *msg = gMessageSystem;
1712 1678
1713 msg->newMessageFast(_PREHASH_ObjectGrab); 1679 msg->newMessageFast(_PREHASH_ObjectGrab);
@@ -1717,6 +1683,13 @@ class LLObjectTouch : public view_listener_t
1717 msg->nextBlockFast( _PREHASH_ObjectData); 1683 msg->nextBlockFast( _PREHASH_ObjectData);
1718 msg->addU32Fast( _PREHASH_LocalID, object->mLocalID); 1684 msg->addU32Fast( _PREHASH_LocalID, object->mLocalID);
1719 msg->addVector3Fast(_PREHASH_GrabOffset, LLVector3::zero ); 1685 msg->addVector3Fast(_PREHASH_GrabOffset, LLVector3::zero );
1686 msg->nextBlock("SurfaceInfo");
1687 msg->addVector3("UVCoord", LLVector3(pick.mUVCoords));
1688 msg->addVector3("STCoord", LLVector3(pick.mSTCoords));
1689 msg->addS32Fast(_PREHASH_FaceIndex, pick.mObjectFace);
1690 msg->addVector3("Position", pick.mIntersection);
1691 msg->addVector3("Normal", pick.mNormal);
1692 msg->addVector3("Binormal", pick.mBinormal);
1720 msg->sendMessage( object->getRegion()->getHost()); 1693 msg->sendMessage( object->getRegion()->getHost());
1721 1694
1722 // *NOTE: Hope the packets arrive safely and in order or else 1695 // *NOTE: Hope the packets arrive safely and in order or else
@@ -1728,6 +1701,13 @@ class LLObjectTouch : public view_listener_t
1728 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); 1701 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
1729 msg->nextBlockFast(_PREHASH_ObjectData); 1702 msg->nextBlockFast(_PREHASH_ObjectData);
1730 msg->addU32Fast(_PREHASH_LocalID, object->mLocalID); 1703 msg->addU32Fast(_PREHASH_LocalID, object->mLocalID);
1704 msg->nextBlock("SurfaceInfo");
1705 msg->addVector3("UVCoord", LLVector3(pick.mUVCoords));
1706 msg->addVector3("STCoord", LLVector3(pick.mSTCoords));
1707 msg->addS32Fast(_PREHASH_FaceIndex, pick.mObjectFace);
1708 msg->addVector3("Position", pick.mIntersection);
1709 msg->addVector3("Normal", pick.mNormal);
1710 msg->addVector3("Binormal", pick.mBinormal);
1731 msg->sendMessage(object->getRegion()->getHost()); 1711 msg->sendMessage(object->getRegion()->getHost());
1732 1712
1733 return true; 1713 return true;
@@ -1740,7 +1720,7 @@ class LLObjectEnableTouch : public view_listener_t
1740{ 1720{
1741 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 1721 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
1742 { 1722 {
1743 LLViewerObject* obj = gObjectList.findObject(gLastHitObjectID); 1723 LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
1744 bool new_value = obj && obj->flagHandleTouch(); 1724 bool new_value = obj && obj->flagHandleTouch();
1745 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); 1725 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
1746 1726
@@ -1759,7 +1739,7 @@ class LLObjectEnableTouch : public view_listener_t
1759 } 1739 }
1760}; 1740};
1761 1741
1762void label_touch(LLString& label, void*) 1742void label_touch(std::string& label, void*)
1763{ 1743{
1764 LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); 1744 LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
1765 if (node && node->mValid && !node->mTouchName.empty()) 1745 if (node && node->mValid && !node->mTouchName.empty())
@@ -1774,7 +1754,7 @@ void label_touch(LLString& label, void*)
1774 1754
1775bool handle_object_open() 1755bool handle_object_open()
1776{ 1756{
1777 LLViewerObject* obj = gObjectList.findObject(gLastHitObjectID); 1757 LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
1778 if(!obj) return true; 1758 if(!obj) return true;
1779 1759
1780 LLFloaterOpenObject::show(); 1760 LLFloaterOpenObject::show();
@@ -1795,7 +1775,7 @@ class LLObjectEnableOpen : public view_listener_t
1795 { 1775 {
1796 // Look for contents in root object, which is all the LLFloaterOpenObject 1776 // Look for contents in root object, which is all the LLFloaterOpenObject
1797 // understands. 1777 // understands.
1798 LLViewerObject* obj = gObjectList.findObject(gLastHitObjectID); 1778 LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
1799 bool new_value = (obj != NULL); 1779 bool new_value = (obj != NULL);
1800 if (new_value) 1780 if (new_value)
1801 { 1781 {
@@ -1821,35 +1801,62 @@ class LLViewCheckBuildMode : public view_listener_t
1821 1801
1822bool toggle_build_mode() 1802bool toggle_build_mode()
1823{ 1803{
1824 if (LLToolMgr::getInstance()->inEdit()) 1804 if (LLToolMgr::getInstance()->inBuildMode())
1825 { 1805 {
1826 // just reset the view, will pull us out of edit mode 1806 if (gSavedSettings.getBOOL("EditCameraMovement"))
1827 handle_reset_view(); 1807 {
1828 1808 // just reset the view, will pull us out of edit mode
1809 handle_reset_view();
1810 }
1811 else
1812 {
1813 // manually disable edit mode, but do not affect the camera
1814 gAgent.resetView(false);
1815 gFloaterTools->close();
1816 gViewerWindow->showCursor();
1817 }
1829 // avoid spurious avatar movements pulling out of edit mode 1818 // avoid spurious avatar movements pulling out of edit mode
1830 LLViewerJoystick::getInstance()->moveAvatar(true); 1819 LLViewerJoystick::getInstance()->moveAvatar(true);
1831 } 1820 }
1832 else 1821 else
1833 { 1822 {
1834 if (LLViewerJoystick::getInstance()->getOverrideCamera()) 1823 ECameraMode camMode = gAgent.getCameraMode();
1824 if (CAMERA_MODE_MOUSELOOK == camMode || CAMERA_MODE_CUSTOMIZE_AVATAR == camMode)
1835 { 1825 {
1836 handle_toggle_flycam(); 1826 // pull the user out of mouselook or appearance mode when entering build mode
1827 handle_reset_view();
1837 } 1828 }
1838 1829
1839 if (gAgent.getFocusOnAvatar() && gSavedSettings.getBOOL("EditCameraMovement") ) 1830 if (gSavedSettings.getBOOL("EditCameraMovement"))
1840 { 1831 {
1841 // zoom in if we're looking at the avatar 1832 // camera should be set
1842 gAgent.setFocusOnAvatar(FALSE, ANIMATE); 1833 if (LLViewerJoystick::getInstance()->getOverrideCamera())
1843 gAgent.setFocusGlobal(gAgent.getPositionGlobal() + 2.0 * LLVector3d(gAgent.getAtAxis())); 1834 {
1844 gAgent.cameraZoomIn(0.666f); 1835 handle_toggle_flycam();
1845 gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD ); 1836 }
1837
1838 if (gAgent.getFocusOnAvatar())
1839 {
1840 // zoom in if we're looking at the avatar
1841 gAgent.setFocusOnAvatar(FALSE, ANIMATE);
1842 gAgent.setFocusGlobal(gAgent.getPositionGlobal() + 2.0 * LLVector3d(gAgent.getAtAxis()));
1843 gAgent.cameraZoomIn(0.666f);
1844 gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD );
1845 }
1846 } 1846 }
1847 1847
1848
1848 LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); 1849 LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
1849 LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() ); 1850 LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() );
1850 1851
1851 // Could be first use 1852 // Could be first use
1852 LLFirstUse::useBuild(); 1853 LLFirstUse::useBuild();
1854
1855 gAgent.resetView(false);
1856
1857 // avoid spurious avatar movements
1858 LLViewerJoystick::getInstance()->moveAvatar(true);
1859
1853 } 1860 }
1854 return true; 1861 return true;
1855} 1862}
@@ -1895,14 +1902,14 @@ class LLObjectBuild : public view_listener_t
1895 { 1902 {
1896 // zoom in if we're looking at the avatar 1903 // zoom in if we're looking at the avatar
1897 gAgent.setFocusOnAvatar(FALSE, ANIMATE); 1904 gAgent.setFocusOnAvatar(FALSE, ANIMATE);
1898 gAgent.setFocusGlobal(gLastHitPosGlobal + gLastHitObjectOffset, gLastHitObjectID); 1905 gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick());
1899 gAgent.cameraZoomIn(0.666f); 1906 gAgent.cameraZoomIn(0.666f);
1900 gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD ); 1907 gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD );
1901 gViewerWindow->moveCursorToCenter(); 1908 gViewerWindow->moveCursorToCenter();
1902 } 1909 }
1903 else if ( gSavedSettings.getBOOL("EditCameraMovement") ) 1910 else if ( gSavedSettings.getBOOL("EditCameraMovement") )
1904 { 1911 {
1905 gAgent.setFocusGlobal(gLastHitPosGlobal + gLastHitObjectOffset, gLastHitObjectID); 1912 gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick());
1906 gViewerWindow->moveCursorToCenter(); 1913 gViewerWindow->moveCursorToCenter();
1907 } 1914 }
1908 1915
@@ -1935,13 +1942,17 @@ class LLObjectEdit : public view_listener_t
1935 else 1942 else
1936 { 1943 {
1937 gAgent.setFocusOnAvatar(FALSE, ANIMATE); 1944 gAgent.setFocusOnAvatar(FALSE, ANIMATE);
1945 LLViewerObject* selected_objectp = selection->getFirstRootObject();
1946 if (selected_objectp)
1947 {
1938 // zoom in on object center instead of where we clicked, as we need to see the manipulator handles 1948 // zoom in on object center instead of where we clicked, as we need to see the manipulator handles
1939 gAgent.setFocusGlobal(gLastHitPosGlobal /*+ gLastHitObjectOffset*/, gLastHitObjectID); 1949 gAgent.setFocusGlobal(selected_objectp->getPositionGlobal(), selected_objectp->getID());
1940 gAgent.cameraZoomIn(0.666f); 1950 gAgent.cameraZoomIn(0.666f);
1941 gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD ); 1951 gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD );
1942 gViewerWindow->moveCursorToCenter(); 1952 gViewerWindow->moveCursorToCenter();
1943 } 1953 }
1944 } 1954 }
1955 }
1945 1956
1946 gFloaterTools->open(); /* Flawfinder: ignore */ 1957 gFloaterTools->open(); /* Flawfinder: ignore */
1947 1958
@@ -1980,7 +1991,7 @@ class LLLandBuild : public view_listener_t
1980 { 1991 {
1981 // zoom in if we're looking at the avatar 1992 // zoom in if we're looking at the avatar
1982 gAgent.setFocusOnAvatar(FALSE, ANIMATE); 1993 gAgent.setFocusOnAvatar(FALSE, ANIMATE);
1983 gAgent.setFocusGlobal(gLastHitPosGlobal + gLastHitObjectOffset, gLastHitObjectID); 1994 gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick());
1984 gAgent.cameraZoomIn(0.666f); 1995 gAgent.cameraZoomIn(0.666f);
1985 gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD ); 1996 gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD );
1986 gViewerWindow->moveCursorToCenter(); 1997 gViewerWindow->moveCursorToCenter();
@@ -1988,7 +1999,7 @@ class LLLandBuild : public view_listener_t
1988 else if ( gSavedSettings.getBOOL("EditCameraMovement") ) 1999 else if ( gSavedSettings.getBOOL("EditCameraMovement") )
1989 { 2000 {
1990 // otherwise just move focus 2001 // otherwise just move focus
1991 gAgent.setFocusGlobal(gLastHitPosGlobal + gLastHitObjectOffset, gLastHitObjectID); 2002 gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick());
1992 gViewerWindow->moveCursorToCenter(); 2003 gViewerWindow->moveCursorToCenter();
1993 } 2004 }
1994 2005
@@ -2055,8 +2066,18 @@ class LLEnableEdit : public view_listener_t
2055{ 2066{
2056 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 2067 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
2057 { 2068 {
2058 bool new_value = gAgent.isGodlike() || !gAgent.inPrelude(); 2069 // *HACK: The new "prelude" Help Islands have a build sandbox area,
2059 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); 2070 // so users need the Edit and Create pie menu options when they are
2071 // there. Eventually this needs to be replaced with code that only
2072 // lets you edit objects if you have permission to do so (edit perms,
2073 // group edit, god). See also lltoolbar.cpp. JC
2074 bool enable = true;
2075 if (gAgent.inPrelude())
2076 {
2077 enable = LLViewerParcelMgr::getInstance()->agentCanBuild()
2078 || LLSelectMgr::getInstance()->getSelection()->isAttachment();
2079 }
2080 gMenuHolder->findControl(userdata["control"].asString())->setValue(enable);
2060 return true; 2081 return true;
2061 } 2082 }
2062}; 2083};
@@ -2106,15 +2127,19 @@ BOOL enable_has_attachments(void*)
2106//--------------------------------------------------------------------------- 2127//---------------------------------------------------------------------------
2107void handle_follow(void *userdata) 2128void handle_follow(void *userdata)
2108{ 2129{
2109 // follow a given avatar, ID in gLastHitObjectID 2130 // follow a given avatar by ID
2110 gAgent.startFollowPilot(gLastHitObjectID); 2131 LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
2132 if (objectp)
2133 {
2134 gAgent.startFollowPilot(objectp->getID());
2135 }
2111} 2136}
2112 2137
2113class LLObjectEnableMute : public view_listener_t 2138class LLObjectEnableMute : public view_listener_t
2114{ 2139{
2115 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 2140 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
2116 { 2141 {
2117 LLViewerObject* object = gViewerWindow->lastObjectHit(); 2142 LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
2118 bool new_value = (object != NULL); 2143 bool new_value = (object != NULL);
2119 if (new_value) 2144 if (new_value)
2120 { 2145 {
@@ -2123,7 +2148,7 @@ class LLObjectEnableMute : public view_listener_t
2123 { 2148 {
2124 // It's an avatar 2149 // It's an avatar
2125 LLNameValue *lastname = avatar->getNVPair("LastName"); 2150 LLNameValue *lastname = avatar->getNVPair("LastName");
2126 BOOL is_linden = lastname && !LLString::compareStrings(lastname->getString(), "Linden"); 2151 BOOL is_linden = lastname && !LLStringUtil::compareStrings(lastname->getString(), "Linden");
2127 BOOL is_self = avatar->isSelf(); 2152 BOOL is_self = avatar->isSelf();
2128 new_value = !is_linden && !is_self; 2153 new_value = !is_linden && !is_self;
2129 } 2154 }
@@ -2137,11 +2162,11 @@ class LLObjectMute : public view_listener_t
2137{ 2162{
2138 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 2163 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
2139 { 2164 {
2140 LLViewerObject* object = gViewerWindow->lastObjectHit(); 2165 LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
2141 if (!object) return true; 2166 if (!object) return true;
2142 2167
2143 LLUUID id; 2168 LLUUID id;
2144 LLString name; 2169 std::string name;
2145 LLMute::EType type; 2170 LLMute::EType type;
2146 LLVOAvatar* avatar = find_avatar_from_object(object); 2171 LLVOAvatar* avatar = find_avatar_from_object(object);
2147 if (avatar) 2172 if (avatar)
@@ -2193,11 +2218,12 @@ bool handle_go_to()
2193 // JAMESDEBUG try simulator autopilot 2218 // JAMESDEBUG try simulator autopilot
2194 std::vector<std::string> strings; 2219 std::vector<std::string> strings;
2195 std::string val; 2220 std::string val;
2196 val = llformat("%g", gLastHitPosGlobal.mdV[VX]); 2221 LLVector3d pos = LLToolPie::getInstance()->getPick().mPosGlobal;
2222 val = llformat("%g", pos.mdV[VX]);
2197 strings.push_back(val); 2223 strings.push_back(val);
2198 val = llformat("%g", gLastHitPosGlobal.mdV[VY]); 2224 val = llformat("%g", pos.mdV[VY]);
2199 strings.push_back(val); 2225 strings.push_back(val);
2200 val = llformat("%g", gLastHitPosGlobal.mdV[VZ]); 2226 val = llformat("%g", pos.mdV[VZ]);
2201 strings.push_back(val); 2227 strings.push_back(val);
2202 send_generic_message("autopilot", strings); 2228 send_generic_message("autopilot", strings);
2203 2229
@@ -2266,15 +2292,15 @@ class LLAvatarFreeze : public view_listener_t
2266{ 2292{
2267 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 2293 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
2268 { 2294 {
2269 LLVOAvatar* avatar = find_avatar_from_object( gViewerWindow->lastObjectHit() ); 2295 LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getFirstObject() );
2270 if( avatar ) 2296 if( avatar )
2271 { 2297 {
2272 LLUUID* avatar_id = new LLUUID( avatar->getID() ); 2298 LLUUID* avatar_id = new LLUUID( avatar->getID() );
2273 LLString fullname = avatar->getFullname(); 2299 std::string fullname = avatar->getFullname();
2274 2300
2275 if (!fullname.empty()) 2301 if (!fullname.empty())
2276 { 2302 {
2277 LLString::format_map_t args; 2303 LLStringUtil::format_map_t args;
2278 args["[AVATAR_NAME]"] = fullname; 2304 args["[AVATAR_NAME]"] = fullname;
2279 gViewerWindow->alertXml("FreezeAvatarFullname", 2305 gViewerWindow->alertXml("FreezeAvatarFullname",
2280 args, 2306 args,
@@ -2316,7 +2342,7 @@ class LLAvatarDebug : public view_listener_t
2316{ 2342{
2317 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 2343 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
2318 { 2344 {
2319 LLVOAvatar* avatar = find_avatar_from_object( gViewerWindow->lastObjectHit() ); 2345 LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getFirstObject() );
2320 if( avatar ) 2346 if( avatar )
2321 { 2347 {
2322 avatar->dumpLocalTextures(); 2348 avatar->dumpLocalTextures();
@@ -2368,15 +2394,15 @@ class LLAvatarEject : public view_listener_t
2368{ 2394{
2369 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 2395 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
2370 { 2396 {
2371 LLVOAvatar* avatar = find_avatar_from_object( gViewerWindow->lastObjectHit() ); 2397 LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getFirstObject() );
2372 if( avatar ) 2398 if( avatar )
2373 { 2399 {
2374 LLUUID* avatar_id = new LLUUID( avatar->getID() ); 2400 LLUUID* avatar_id = new LLUUID( avatar->getID() );
2375 LLString fullname = avatar->getFullname(); 2401 std::string fullname = avatar->getFullname();
2376 2402
2377 if (!fullname.empty()) 2403 if (!fullname.empty())
2378 { 2404 {
2379 LLString::format_map_t args; 2405 LLStringUtil::format_map_t args;
2380 args["[AVATAR_NAME]"] = fullname; 2406 args["[AVATAR_NAME]"] = fullname;
2381 gViewerWindow->alertXml("EjectAvatarFullname", 2407 gViewerWindow->alertXml("EjectAvatarFullname",
2382 args, 2408 args,
@@ -2398,7 +2424,7 @@ class LLAvatarEnableFreezeEject : public view_listener_t
2398{ 2424{
2399 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 2425 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
2400 { 2426 {
2401 LLVOAvatar* avatar = find_avatar_from_object( gViewerWindow->lastObjectHit() ); 2427 LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getFirstObject() );
2402 bool new_value = (avatar != NULL); 2428 bool new_value = (avatar != NULL);
2403 2429
2404 if (new_value) 2430 if (new_value)
@@ -2423,11 +2449,11 @@ class LLAvatarGiveCard : public view_listener_t
2423 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 2449 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
2424 { 2450 {
2425 llinfos << "handle_give_card()" << llendl; 2451 llinfos << "handle_give_card()" << llendl;
2426 LLViewerObject* dest = gViewerWindow->lastObjectHit(); 2452 LLViewerObject* dest = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
2427 if(dest && dest->isAvatar()) 2453 if(dest && dest->isAvatar())
2428 { 2454 {
2429 bool found_name = false; 2455 bool found_name = false;
2430 LLString::format_map_t args; 2456 LLStringUtil::format_map_t args;
2431 LLNameValue* nvfirst = dest->getNVPair("FirstName"); 2457 LLNameValue* nvfirst = dest->getNVPair("FirstName");
2432 LLNameValue* nvlast = dest->getNVPair("LastName"); 2458 LLNameValue* nvlast = dest->getNVPair("LastName");
2433 if(nvfirst && nvlast) 2459 if(nvfirst && nvlast)
@@ -2496,63 +2522,34 @@ void handle_leave_group(void *)
2496{ 2522{
2497 if (gAgent.getGroupID() != LLUUID::null) 2523 if (gAgent.getGroupID() != LLUUID::null)
2498 { 2524 {
2499 LLString::format_map_t args; 2525 LLStringUtil::format_map_t args;
2500 args["[GROUP]"] = gAgent.mGroupName; 2526 args["[GROUP]"] = gAgent.mGroupName;
2501 gViewerWindow->alertXml("GroupLeaveConfirmMember", args, callback_leave_group); 2527 gViewerWindow->alertXml("GroupLeaveConfirmMember", args, callback_leave_group);
2502 } 2528 }
2503} 2529}
2504 2530
2505void append_aggregate(LLString& string, const LLAggregatePermissions& ag_perm, PermissionBit bit, const char* txt) 2531void append_aggregate(std::string& string, const LLAggregatePermissions& ag_perm, PermissionBit bit, const char* txt)
2506{ 2532{
2507 LLAggregatePermissions::EValue val = ag_perm.getValue(bit); 2533 LLAggregatePermissions::EValue val = ag_perm.getValue(bit);
2508 char buffer[MAX_STRING]; /* Flawfinder: ignore */ 2534 std::string buffer;
2509 buffer[0] = '\0';
2510 switch(val) 2535 switch(val)
2511 { 2536 {
2512 case LLAggregatePermissions::AP_NONE: 2537 case LLAggregatePermissions::AP_NONE:
2513 snprintf(buffer, MAX_STRING, "* %s None\n", txt); /* Flawfinder: ignore */ 2538 buffer = llformat( "* %s None\n", txt);
2514 break; 2539 break;
2515 case LLAggregatePermissions::AP_SOME: 2540 case LLAggregatePermissions::AP_SOME:
2516 snprintf(buffer, MAX_STRING, "* %s Some\n", txt); /* Flawfinder: ignore */ 2541 buffer = llformat( "* %s Some\n", txt);
2517 break; 2542 break;
2518 case LLAggregatePermissions::AP_ALL: 2543 case LLAggregatePermissions::AP_ALL:
2519 snprintf(buffer, MAX_STRING, "* %s All\n", txt); /* Flawfinder: ignore */ 2544 buffer = llformat( "* %s All\n", txt);
2520 break; 2545 break;
2521 case LLAggregatePermissions::AP_EMPTY: 2546 case LLAggregatePermissions::AP_EMPTY:
2522 default: 2547 default:
2523 break; 2548 break;
2524 } 2549 }
2525 string.append(buffer); 2550 string.append(buffer);
2526} 2551}
2527 2552
2528const char* build_extensions_string(LLFilePicker::ELoadFilter filter)
2529{
2530 switch(filter)
2531 {
2532#if LL_WINDOWS
2533 case LLFilePicker::FFLOAD_IMAGE:
2534 return IMAGE_EXTENSIONS;
2535 case LLFilePicker::FFLOAD_WAV:
2536 return SOUND_EXTENSIONS;
2537 case LLFilePicker::FFLOAD_ANIM:
2538 return ANIM_EXTENSIONS;
2539 case LLFilePicker::FFLOAD_SLOBJECT:
2540 return SLOBJECT_EXTENSIONS;
2541#ifdef _CORY_TESTING
2542 case LLFilePicker::FFLOAD_GEOMETRY:
2543 return GEOMETRY_EXTENSIONS;
2544#endif
2545 case LLFilePicker::FFLOAD_XML:
2546 return XML_EXTENSIONS;
2547 case LLFilePicker::FFLOAD_ALL:
2548 return ALL_FILE_EXTENSIONS;
2549#endif
2550 default:
2551 return ALL_FILE_EXTENSIONS;
2552 }
2553}
2554
2555
2556BOOL enable_buy(void*) 2553BOOL enable_buy(void*)
2557{ 2554{
2558 // In order to buy, there must only be 1 purchaseable object in 2555 // In order to buy, there must only be 1 purchaseable object in
@@ -2595,7 +2592,7 @@ void handle_buy_object(LLSaleInfo sale_info)
2595 } 2592 }
2596 2593
2597 LLUUID owner_id; 2594 LLUUID owner_id;
2598 LLString owner_name; 2595 std::string owner_name;
2599 BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); 2596 BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name);
2600 if (!owners_identical) 2597 if (!owners_identical)
2601 { 2598 {
@@ -2691,9 +2688,9 @@ void handle_dump_region_object_cache(void*)
2691 2688
2692void handle_dump_focus(void *) 2689void handle_dump_focus(void *)
2693{ 2690{
2694 LLView *view = gFocusMgr.getKeyboardFocus(); 2691 LLUICtrl *ctrl = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
2695 2692
2696 llinfos << "Keyboard focus " << (view ? view->getName() : "(none)") << llendl; 2693 llinfos << "Keyboard focus " << (ctrl ? ctrl->getName() : "(none)") << llendl;
2697} 2694}
2698 2695
2699class LLSelfStandUp : public view_listener_t 2696class LLSelfStandUp : public view_listener_t
@@ -2761,7 +2758,7 @@ void set_god_level(U8 god_level)
2761 LLViewerLogin::getInstance()->isInProductionGrid()); 2758 LLViewerLogin::getInstance()->isInProductionGrid());
2762 } 2759 }
2763 2760
2764 LLString::format_map_t args; 2761 LLStringUtil::format_map_t args;
2765 if(god_level > GOD_NOT) 2762 if(god_level > GOD_NOT)
2766 { 2763 {
2767 args["[LEVEL]"] = llformat("%d",(S32)god_level); 2764 args["[LEVEL]"] = llformat("%d",(S32)god_level);
@@ -2809,7 +2806,7 @@ void process_grant_godlike_powers(LLMessageSystem* msg, void**)
2809 } 2806 }
2810} 2807}
2811 2808
2812void load_url_local_file(const char* file_name) 2809void load_url_local_file(const std::string& file_name)
2813{ 2810{
2814 if( gAgent.cameraMouselook() ) 2811 if( gAgent.cameraMouselook() )
2815 { 2812 {
@@ -2833,7 +2830,7 @@ void load_url_local_file(const char* file_name)
2833 full_path.append(gDirUtilp->getDirDelimiter()); 2830 full_path.append(gDirUtilp->getDirDelimiter());
2834 full_path.append(file_name); 2831 full_path.append(file_name);
2835 2832
2836 LLWeb::loadURL(full_path.c_str()); 2833 LLWeb::loadURL(full_path);
2837} 2834}
2838 2835
2839/* 2836/*
@@ -2909,7 +2906,7 @@ class LLAvatarEnableAddFriend : public view_listener_t
2909{ 2906{
2910 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 2907 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
2911 { 2908 {
2912 LLVOAvatar* avatar = find_avatar_from_object(gViewerWindow->lastObjectHit()); 2909 LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getFirstObject());
2913 bool new_value = avatar && !is_agent_friend(avatar->getID()); 2910 bool new_value = avatar && !is_agent_friend(avatar->getID());
2914 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); 2911 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
2915 return true; 2912 return true;
@@ -2921,8 +2918,8 @@ void request_friendship(const LLUUID& dest_id)
2921 LLViewerObject* dest = gObjectList.findObject(dest_id); 2918 LLViewerObject* dest = gObjectList.findObject(dest_id);
2922 if(dest && dest->isAvatar()) 2919 if(dest && dest->isAvatar())
2923 { 2920 {
2924 LLString fullname; 2921 std::string fullname;
2925 LLString::format_map_t args; 2922 LLStringUtil::format_map_t args;
2926 LLNameValue* nvfirst = dest->getNVPair("FirstName"); 2923 LLNameValue* nvfirst = dest->getNVPair("FirstName");
2927 LLNameValue* nvlast = dest->getNVPair("LastName"); 2924 LLNameValue* nvlast = dest->getNVPair("LastName");
2928 if(nvfirst && nvlast) 2925 if(nvfirst && nvlast)
@@ -2935,8 +2932,7 @@ void request_friendship(const LLUUID& dest_id)
2935 } 2932 }
2936 if (!fullname.empty()) 2933 if (!fullname.empty())
2937 { 2934 {
2938 LLPanelFriends::requestFriendship(dest_id, fullname); 2935 LLPanelFriends::requestFriendshipDialog(dest_id, fullname);
2939 LLNotifyBox::showXml("OfferedFriendship", args);
2940 } 2936 }
2941 else 2937 else
2942 { 2938 {
@@ -2950,16 +2946,22 @@ class LLEditEnableCustomizeAvatar : public view_listener_t
2950{ 2946{
2951 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 2947 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
2952 { 2948 {
2953 bool new_value = gAgent.getWearablesLoaded(); 2949 LLVOAvatar* avatar = gAgent.getAvatarObject();
2954 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); 2950
2951 bool enabled = ((avatar && avatar->isFullyLoaded()) &&
2952 (gAgent.getWearablesLoaded()));
2953
2954 gMenuHolder->findControl(userdata["control"].asString())->setValue(enabled);
2955 return true; 2955 return true;
2956 } 2956 }
2957}; 2957};
2958 2958
2959// only works on pie menu
2959bool handle_sit_or_stand() 2960bool handle_sit_or_stand()
2960{ 2961{
2961 LLViewerObject *object = gObjectList.findObject(gLastHitNonFloraObjectID); 2962 LLPickInfo pick = LLToolPie::getInstance()->getPick();
2962 if (!object) 2963 LLViewerObject *object = pick.getObject();;
2964 if (!object || pick.mPickType == LLPickInfo::PICK_FLORA)
2963 { 2965 {
2964 return true; 2966 return true;
2965 } 2967 }
@@ -2974,17 +2976,13 @@ bool handle_sit_or_stand()
2974 2976
2975 if (object && object->getPCode() == LL_PCODE_VOLUME) 2977 if (object && object->getPCode() == LL_PCODE_VOLUME)
2976 { 2978 {
2977 LLVector3d offset_double = gViewerWindow->lastNonFloraObjectHitOffset();
2978 LLVector3 offset_single;
2979 offset_single.setVec(offset_double);
2980
2981 gMessageSystem->newMessageFast(_PREHASH_AgentRequestSit); 2979 gMessageSystem->newMessageFast(_PREHASH_AgentRequestSit);
2982 gMessageSystem->nextBlockFast(_PREHASH_AgentData); 2980 gMessageSystem->nextBlockFast(_PREHASH_AgentData);
2983 gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); 2981 gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
2984 gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); 2982 gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
2985 gMessageSystem->nextBlockFast(_PREHASH_TargetObject); 2983 gMessageSystem->nextBlockFast(_PREHASH_TargetObject);
2986 gMessageSystem->addUUIDFast(_PREHASH_TargetID, object->mID); 2984 gMessageSystem->addUUIDFast(_PREHASH_TargetID, object->mID);
2987 gMessageSystem->addVector3Fast(_PREHASH_Offset, offset_single); 2985 gMessageSystem->addVector3Fast(_PREHASH_Offset, pick.mObjectOffset);
2988 2986
2989 object->getRegion()->sendReliableMessage(); 2987 object->getRegion()->sendReliableMessage();
2990 } 2988 }
@@ -3018,7 +3016,7 @@ class LLLandSit : public view_listener_t
3018 gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); 3016 gAgent.setControlFlags(AGENT_CONTROL_STAND_UP);
3019 LLViewerParcelMgr::getInstance()->deselectLand(); 3017 LLViewerParcelMgr::getInstance()->deselectLand();
3020 3018
3021 LLVector3d posGlobal = gLastHitPosGlobal; 3019 LLVector3d posGlobal = LLToolPie::getInstance()->getPick().mPosGlobal;
3022 3020
3023 LLQuaternion target_rot; 3021 LLQuaternion target_rot;
3024 if (gAgent.getAvatarObject()) 3022 if (gAgent.getAvatarObject())
@@ -3631,17 +3629,17 @@ void handle_claim_public_land(void*)
3631 msg->nextBlock("MethodData"); 3629 msg->nextBlock("MethodData");
3632 msg->addString("Method", "claimpublicland"); 3630 msg->addString("Method", "claimpublicland");
3633 msg->addUUID("Invoice", LLUUID::null); 3631 msg->addUUID("Invoice", LLUUID::null);
3634 char buffer[32]; /* Flawfinder: ignore */ 3632 std::string buffer;
3635 snprintf(buffer, sizeof(buffer), "%f", west_south.mV[VX]); /* Flawfinder: ignore */ 3633 buffer = llformat( "%f", west_south.mV[VX]);
3636 msg->nextBlock("ParamList"); 3634 msg->nextBlock("ParamList");
3637 msg->addString("Parameter", buffer); 3635 msg->addString("Parameter", buffer);
3638 snprintf(buffer, sizeof(buffer), "%f", west_south.mV[VY]); /* Flawfinder: ignore */ 3636 buffer = llformat( "%f", west_south.mV[VY]);
3639 msg->nextBlock("ParamList"); 3637 msg->nextBlock("ParamList");
3640 msg->addString("Parameter", buffer); 3638 msg->addString("Parameter", buffer);
3641 snprintf(buffer, sizeof(buffer), "%f", east_north.mV[VX]); /* Flawfinder: ignore */ 3639 buffer = llformat( "%f", east_north.mV[VX]);
3642 msg->nextBlock("ParamList"); 3640 msg->nextBlock("ParamList");
3643 msg->addString("Parameter", buffer); 3641 msg->addString("Parameter", buffer);
3644 snprintf(buffer, sizeof(buffer), "%f", east_north.mV[VY]); /* Flawfinder: ignore */ 3642 buffer = llformat( "%f", east_north.mV[VY]);
3645 msg->nextBlock("ParamList"); 3643 msg->nextBlock("ParamList");
3646 msg->addString("Parameter", buffer); 3644 msg->addString("Parameter", buffer);
3647 gAgent.sendReliableMessage(); 3645 gAgent.sendReliableMessage();
@@ -4152,11 +4150,11 @@ class LLToolsEnableBuyOrTake : public view_listener_t
4152 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); 4150 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
4153 4151
4154 // Update label 4152 // Update label
4155 LLString label; 4153 std::string label;
4156 LLString buy_text; 4154 std::string buy_text;
4157 LLString take_text; 4155 std::string take_text;
4158 LLString param = userdata["data"].asString(); 4156 std::string param = userdata["data"].asString();
4159 LLString::size_type offset = param.find(","); 4157 std::string::size_type offset = param.find(",");
4160 if (offset != param.npos) 4158 if (offset != param.npos)
4161 { 4159 {
4162 buy_text = param.substr(0, offset); 4160 buy_text = param.substr(0, offset);
@@ -4250,7 +4248,7 @@ void show_buy_currency(const char* extra)
4250 } 4248 }
4251 mesg << "Go to " << BUY_CURRENCY_URL << "\nfor information on purchasing currency?"; 4249 mesg << "Go to " << BUY_CURRENCY_URL << "\nfor information on purchasing currency?";
4252 4250
4253 LLString::format_map_t args; 4251 LLStringUtil::format_map_t args;
4254 if (extra != NULL) 4252 if (extra != NULL)
4255 { 4253 {
4256 args["[EXTRA]"] = extra; 4254 args["[EXTRA]"] = extra;
@@ -4444,7 +4442,7 @@ class LLToolsLink : public view_listener_t
4444 S32 object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); 4442 S32 object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount();
4445 if (object_count > MAX_CHILDREN_PER_TASK + 1) 4443 if (object_count > MAX_CHILDREN_PER_TASK + 1)
4446 { 4444 {
4447 LLStringBase<char>::format_map_t args; 4445 LLStringUtil::format_map_t args;
4448 args["[COUNT]"] = llformat("%d", object_count); 4446 args["[COUNT]"] = llformat("%d", object_count);
4449 int max = MAX_CHILDREN_PER_TASK+1; 4447 int max = MAX_CHILDREN_PER_TASK+1;
4450 args["[MAX]"] = llformat("%d", max); 4448 args["[MAX]"] = llformat("%d", max);
@@ -4463,7 +4461,7 @@ class LLToolsLink : public view_listener_t
4463 return true; 4461 return true;
4464 } 4462 }
4465 LLUUID owner_id; 4463 LLUUID owner_id;
4466 LLString owner_name; 4464 std::string owner_name;
4467 if(!LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name)) 4465 if(!LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name))
4468 { 4466 {
4469 // we don't actually care if you're the owner, but novices are 4467 // we don't actually care if you're the owner, but novices are
@@ -4503,13 +4501,31 @@ class LLToolsStopAllAnimations : public view_listener_t
4503{ 4501{
4504 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 4502 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
4505 { 4503 {
4506 LLVOAvatar* avatarp = gAgent.getAvatarObject(); 4504 LLVOAvatar* avatarp = gAgent.getAvatarObject();
4507 4505 if (avatarp)
4508 if (!avatarp) return true; 4506 {
4509 4507 avatarp->deactivateAllMotions();
4510 avatarp->deactivateAllMotions(); 4508 avatarp->startDefaultMotions();
4511 4509 }
4512 avatarp->processAnimationStateChanges(); 4510 return true;
4511 }
4512};
4513
4514class LLToolsReleaseKeys : public view_listener_t
4515{
4516 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
4517 {
4518 gAgent.forceReleaseControls();
4519
4520 return true;
4521 }
4522};
4523
4524class LLToolsEnableReleaseKeys : public view_listener_t
4525{
4526 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
4527 {
4528 gMenuHolder->findControl(userdata["control"].asString())->setValue( gAgent.anyControlGrabbed() );
4513 return true; 4529 return true;
4514 } 4530 }
4515}; 4531};
@@ -4842,8 +4858,8 @@ void show_debug_menus()
4842 gMenuBarView->setItemVisible(SERVER_MENU_NAME, show_server_menu); 4858 gMenuBarView->setItemVisible(SERVER_MENU_NAME, show_server_menu);
4843 gMenuBarView->setItemEnabled(SERVER_MENU_NAME, show_server_menu); 4859 gMenuBarView->setItemEnabled(SERVER_MENU_NAME, show_server_menu);
4844 4860
4845 //gMenuBarView->setItemVisible(LLString("DebugOptions"), visible); 4861 //gMenuBarView->setItemVisible("DebugOptions", visible);
4846 //gMenuBarView->setItemVisible(LLString(AVI_TOOLS), visible); 4862 //gMenuBarView->setItemVisible(std::string(AVI_TOOLS), visible);
4847 4863
4848 gMenuBarView->arrange(); // clean-up positioning 4864 gMenuBarView->arrange(); // clean-up positioning
4849 }; 4865 };
@@ -4873,43 +4889,43 @@ void toggle_map( void* user_data )
4873} 4889}
4874 4890
4875 4891
4876LLUUID gExporterRequestID; 4892// LLUUID gExporterRequestID;
4877LLString gExportDirectory; 4893// std::string gExportDirectory;
4878 4894
4879LLUploadDialog *gExportDialog = NULL; 4895// LLUploadDialog *gExportDialog = NULL;
4880 4896
4881void handle_export_selected( void * ) 4897// void handle_export_selected( void * )
4882{ 4898// {
4883 LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); 4899// LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
4884 if (selection->isEmpty()) 4900// if (selection->isEmpty())
4885 { 4901// {
4886 return; 4902// return;
4887 } 4903// }
4888 llinfos << "Exporting selected objects:" << llendl; 4904// llinfos << "Exporting selected objects:" << llendl;
4889 4905
4890 gExporterRequestID.generate(); 4906// gExporterRequestID.generate();
4891 gExportDirectory = ""; 4907// gExportDirectory = "";
4892 4908
4893 LLMessageSystem* msg = gMessageSystem; 4909// LLMessageSystem* msg = gMessageSystem;
4894 msg->newMessageFast(_PREHASH_ObjectExportSelected); 4910// msg->newMessageFast(_PREHASH_ObjectExportSelected);
4895 msg->nextBlockFast(_PREHASH_AgentData); 4911// msg->nextBlockFast(_PREHASH_AgentData);
4896 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); 4912// msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
4897 msg->addUUIDFast(_PREHASH_RequestID, gExporterRequestID); 4913// msg->addUUIDFast(_PREHASH_RequestID, gExporterRequestID);
4898 msg->addS16Fast(_PREHASH_VolumeDetail, 4); 4914// msg->addS16Fast(_PREHASH_VolumeDetail, 4);
4899 4915
4900 for (LLObjectSelection::root_iterator iter = selection->root_begin(); 4916// for (LLObjectSelection::root_iterator iter = selection->root_begin();
4901 iter != selection->root_end(); iter++) 4917// iter != selection->root_end(); iter++)
4902 { 4918// {
4903 LLSelectNode* node = *iter; 4919// LLSelectNode* node = *iter;
4904 LLViewerObject* object = node->getObject(); 4920// LLViewerObject* object = node->getObject();
4905 msg->nextBlockFast(_PREHASH_ObjectData); 4921// msg->nextBlockFast(_PREHASH_ObjectData);
4906 msg->addUUIDFast(_PREHASH_ObjectID, object->getID()); 4922// msg->addUUIDFast(_PREHASH_ObjectID, object->getID());
4907 llinfos << "Object: " << object->getID() << llendl; 4923// llinfos << "Object: " << object->getID() << llendl;
4908 } 4924// }
4909 msg->sendReliable(gAgent.getRegion()->getHost()); 4925// msg->sendReliable(gAgent.getRegion()->getHost());
4910 4926
4911 gExportDialog = LLUploadDialog::modalUploadDialog("Exporting selected objects..."); 4927// gExportDialog = LLUploadDialog::modalUploadDialog("Exporting selected objects...");
4912} 4928// }
4913 4929
4914BOOL menu_check_build_tool( void* user_data ) 4930BOOL menu_check_build_tool( void* user_data )
4915{ 4931{
@@ -5114,7 +5130,7 @@ class LLAvatarInviteToGroup : public view_listener_t
5114{ 5130{
5115 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 5131 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
5116 { 5132 {
5117 LLVOAvatar* avatar = find_avatar_from_object( gViewerWindow->lastObjectHit() ); 5133 LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getFirstObject() );
5118 if(avatar) 5134 if(avatar)
5119 { 5135 {
5120 invite_to_group(avatar->getID()); 5136 invite_to_group(avatar->getID());
@@ -5127,7 +5143,7 @@ class LLAvatarAddFriend : public view_listener_t
5127{ 5143{
5128 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 5144 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
5129 { 5145 {
5130 LLVOAvatar* avatar = find_avatar_from_object( gViewerWindow->lastObjectHit() ); 5146 LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getFirstObject() );
5131 if(avatar && !is_agent_friend(avatar->getID())) 5147 if(avatar && !is_agent_friend(avatar->getID()))
5132 { 5148 {
5133 request_friendship(avatar->getID()); 5149 request_friendship(avatar->getID());
@@ -5200,11 +5216,11 @@ class LLEnablePayObject : public view_listener_t
5200{ 5216{
5201 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 5217 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
5202 { 5218 {
5203 LLVOAvatar* avatar = find_avatar_from_object(gViewerWindow->lastObjectHit()); 5219 LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getFirstObject());
5204 bool new_value = (avatar != NULL); 5220 bool new_value = (avatar != NULL);
5205 if (!new_value) 5221 if (!new_value)
5206 { 5222 {
5207 LLViewerObject* object = gViewerWindow->lastObjectHit(); 5223 LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
5208 if( object ) 5224 if( object )
5209 { 5225 {
5210 LLViewerObject *parent = (LLViewerObject *)object->getParent(); 5226 LLViewerObject *parent = (LLViewerObject *)object->getParent();
@@ -5224,8 +5240,9 @@ class LLObjectEnableSitOrStand : public view_listener_t
5224 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 5240 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
5225 { 5241 {
5226 bool new_value = false; 5242 bool new_value = false;
5227 LLViewerObject* dest_object = NULL; 5243 LLViewerObject* dest_object = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
5228 if((dest_object = gObjectList.findObject(gLastHitObjectID))) 5244
5245 if(dest_object)
5229 { 5246 {
5230 if(dest_object->getPCode() == LL_PCODE_VOLUME) 5247 if(dest_object->getPCode() == LL_PCODE_VOLUME)
5231 { 5248 {
@@ -5235,11 +5252,11 @@ class LLObjectEnableSitOrStand : public view_listener_t
5235 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); 5252 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
5236 5253
5237 // Update label 5254 // Update label
5238 LLString label; 5255 std::string label;
5239 LLString sit_text; 5256 std::string sit_text;
5240 LLString stand_text; 5257 std::string stand_text;
5241 LLString param = userdata["data"].asString(); 5258 std::string param = userdata["data"].asString();
5242 LLString::size_type offset = param.find(","); 5259 std::string::size_type offset = param.find(",");
5243 if (offset != param.npos) 5260 if (offset != param.npos)
5244 { 5261 {
5245 sit_text = param.substr(0, offset); 5262 sit_text = param.substr(0, offset);
@@ -5326,7 +5343,7 @@ class LLShowFloater : public view_listener_t
5326{ 5343{
5327 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 5344 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
5328 { 5345 {
5329 LLString floater_name = userdata.asString(); 5346 std::string floater_name = userdata.asString();
5330 if (floater_name == "gestures") 5347 if (floater_name == "gestures")
5331 { 5348 {
5332 LLFloaterGesture::toggleVisibility(); 5349 LLFloaterGesture::toggleVisibility();
@@ -5426,7 +5443,7 @@ class LLShowFloater : public view_listener_t
5426 } 5443 }
5427 else if (floater_name == "help tutorial") 5444 else if (floater_name == "help tutorial")
5428 { 5445 {
5429 LLFloaterHUD::show(); 5446 LLFloaterHUD::showHUD();
5430 } 5447 }
5431 else if (floater_name == "complaint reporter") 5448 else if (floater_name == "complaint reporter")
5432 { 5449 {
@@ -5471,8 +5488,8 @@ class LLFloaterVisible : public view_listener_t
5471{ 5488{
5472 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 5489 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
5473 { 5490 {
5474 LLString control_name = userdata["control"].asString(); 5491 std::string control_name = userdata["control"].asString();
5475 LLString floater_name = userdata["data"].asString(); 5492 std::string floater_name = userdata["data"].asString();
5476 bool new_value = false; 5493 bool new_value = false;
5477 if (floater_name == "friends") 5494 if (floater_name == "friends")
5478 { 5495 {
@@ -5515,12 +5532,12 @@ class LLFloaterVisible : public view_listener_t
5515 } 5532 }
5516}; 5533};
5517 5534
5518void callback_show_url(S32 option, void* url) 5535void callback_show_url(S32 option, void* data)
5519{ 5536{
5520 const char* urlp = (const char*)url; 5537 std::string* urlp = (std::string*)data;
5521 if (0 == option) 5538 if (0 == option)
5522 { 5539 {
5523 LLWeb::loadURL(urlp); 5540 LLWeb::loadURL(*urlp);
5524 } 5541 }
5525 delete urlp; 5542 delete urlp;
5526} 5543}
@@ -5529,22 +5546,13 @@ class LLPromptShowURL : public view_listener_t
5529{ 5546{
5530 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 5547 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
5531 { 5548 {
5532 LLString param = userdata.asString(); 5549 std::string param = userdata.asString();
5533 LLString::size_type offset = param.find(","); 5550 std::string::size_type offset = param.find(",");
5534 if (offset != param.npos) 5551 if (offset != param.npos)
5535 { 5552 {
5536 LLString alert = param.substr(0, offset); 5553 std::string alert = param.substr(0, offset);
5537 LLString url = param.substr(offset+1); 5554 std::string url = param.substr(offset+1);
5538 char *url_copy = new char[url.size()+1]; 5555 std::string* url_copy = new std::string(url);
5539 if (url_copy != NULL)
5540 {
5541 strcpy(url_copy, url.c_str()); /* Flawfinder: ignore */
5542 }
5543 else
5544 {
5545 llerrs << "Memory Allocation Failed" << llendl;
5546 return false;
5547 }
5548 gViewerWindow->alertXml(alert, callback_show_url, url_copy); 5556 gViewerWindow->alertXml(alert, callback_show_url, url_copy);
5549 } 5557 }
5550 else 5558 else
@@ -5555,12 +5563,12 @@ class LLPromptShowURL : public view_listener_t
5555 } 5563 }
5556}; 5564};
5557 5565
5558void callback_show_file(S32 option, void* filename) 5566void callback_show_file(S32 option, void* data)
5559{ 5567{
5560 const char* filenamep = (const char*)filename; 5568 std::string* filenamep = (std::string*)data;
5561 if (0 == option) 5569 if (0 == option)
5562 { 5570 {
5563 load_url_local_file(filenamep); 5571 load_url_local_file(*filenamep);
5564 } 5572 }
5565 delete filenamep; 5573 delete filenamep;
5566} 5574}
@@ -5569,22 +5577,13 @@ class LLPromptShowFile : public view_listener_t
5569{ 5577{
5570 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 5578 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
5571 { 5579 {
5572 LLString param = userdata.asString(); 5580 std::string param = userdata.asString();
5573 LLString::size_type offset = param.find(","); 5581 std::string::size_type offset = param.find(",");
5574 if (offset != param.npos) 5582 if (offset != param.npos)
5575 { 5583 {
5576 LLString alert = param.substr(0, offset); 5584 std::string alert = param.substr(0, offset);
5577 LLString file = param.substr(offset+1); 5585 std::string file = param.substr(offset+1);
5578 char *file_copy = new char[file.size()+1]; 5586 std::string* file_copy = new std::string(file);
5579 if (file_copy != NULL)
5580 {
5581 strcpy(file_copy, file.c_str()); /* Flawfinder: ignore */
5582 }
5583 else
5584 {
5585 llerrs << "Memory Allocation Failed" << llendl;
5586 return false;
5587 }
5588 gViewerWindow->alertXml(alert, callback_show_file, file_copy); 5587 gViewerWindow->alertXml(alert, callback_show_file, file_copy);
5589 } 5588 }
5590 else 5589 else
@@ -5606,7 +5605,11 @@ class LLShowAgentProfile : public view_listener_t
5606 } 5605 }
5607 else if (userdata.asString() == "hit object") 5606 else if (userdata.asString() == "hit object")
5608 { 5607 {
5609 agent_id = gLastHitObjectID; 5608 LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
5609 if (objectp)
5610 {
5611 agent_id = objectp->getID();
5612 }
5610 } 5613 }
5611 else 5614 else
5612 { 5615 {
@@ -5642,12 +5645,12 @@ void handle_focus(void *)
5642 { 5645 {
5643 // zoom in if we're looking at the avatar 5646 // zoom in if we're looking at the avatar
5644 gAgent.setFocusOnAvatar(FALSE, ANIMATE); 5647 gAgent.setFocusOnAvatar(FALSE, ANIMATE);
5645 gAgent.setFocusGlobal(gLastHitPosGlobal + gLastHitObjectOffset, gLastHitObjectID); 5648 gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick());
5646 gAgent.cameraZoomIn(0.666f); 5649 gAgent.cameraZoomIn(0.666f);
5647 } 5650 }
5648 else 5651 else
5649 { 5652 {
5650 gAgent.setFocusGlobal(gLastHitPosGlobal + gLastHitObjectOffset, gLastHitObjectID); 5653 gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick());
5651 } 5654 }
5652 5655
5653 gViewerWindow->moveCursorToCenter(); 5656 gViewerWindow->moveCursorToCenter();
@@ -5665,19 +5668,19 @@ class LLLandEdit : public view_listener_t
5665 { 5668 {
5666 // zoom in if we're looking at the avatar 5669 // zoom in if we're looking at the avatar
5667 gAgent.setFocusOnAvatar(FALSE, ANIMATE); 5670 gAgent.setFocusOnAvatar(FALSE, ANIMATE);
5668 gAgent.setFocusGlobal(gLastHitPosGlobal + gLastHitObjectOffset, gLastHitObjectID); 5671 gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick());
5669 5672
5670 gAgent.cameraOrbitOver( F_PI * 0.25f ); 5673 gAgent.cameraOrbitOver( F_PI * 0.25f );
5671 gViewerWindow->moveCursorToCenter(); 5674 gViewerWindow->moveCursorToCenter();
5672 } 5675 }
5673 else if ( gSavedSettings.getBOOL("EditCameraMovement") ) 5676 else if ( gSavedSettings.getBOOL("EditCameraMovement") )
5674 { 5677 {
5675 gAgent.setFocusGlobal(gLastHitPosGlobal + gLastHitObjectOffset, gLastHitObjectID); 5678 gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick());
5676 gViewerWindow->moveCursorToCenter(); 5679 gViewerWindow->moveCursorToCenter();
5677 } 5680 }
5678 5681
5679 5682
5680 LLViewerParcelMgr::getInstance()->selectParcelAt( gLastHitPosGlobal ); 5683 LLViewerParcelMgr::getInstance()->selectParcelAt( LLToolPie::getInstance()->getPick().mPosGlobal );
5681 5684
5682 gFloaterTools->showMore(TRUE); 5685 gFloaterTools->showMore(TRUE);
5683 gFloaterView->bringToFront( gFloaterTools ); 5686 gFloaterView->bringToFront( gFloaterTools );
@@ -5715,13 +5718,13 @@ void handle_move(void*)
5715 { 5718 {
5716 // zoom in if we're looking at the avatar 5719 // zoom in if we're looking at the avatar
5717 gAgent.setFocusOnAvatar(FALSE, ANIMATE); 5720 gAgent.setFocusOnAvatar(FALSE, ANIMATE);
5718 gAgent.setFocusGlobal(gLastHitPosGlobal + gLastHitObjectOffset, gLastHitObjectID); 5721 gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick());
5719 5722
5720 gAgent.cameraZoomIn(0.666f); 5723 gAgent.cameraZoomIn(0.666f);
5721 } 5724 }
5722 else 5725 else
5723 { 5726 {
5724 gAgent.setFocusGlobal(gLastHitPosGlobal + gLastHitObjectOffset, gLastHitObjectID); 5727 gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick());
5725 } 5728 }
5726 5729
5727 gViewerWindow->moveCursorToCenter(); 5730 gViewerWindow->moveCursorToCenter();
@@ -5823,7 +5826,7 @@ class LLAttachmentDrop : public view_listener_t
5823 { 5826 {
5824 // Called when the user clicked on an object attached to them 5827 // Called when the user clicked on an object attached to them
5825 // and selected "Drop". 5828 // and selected "Drop".
5826 LLViewerObject *object = gViewerWindow->lastObjectHit(); 5829 LLViewerObject *object = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
5827 if (!object) 5830 if (!object)
5828 { 5831 {
5829 llwarns << "handle_drop_attachment() - no object to drop" << llendl; 5832 llwarns << "handle_drop_attachment() - no object to drop" << llendl;
@@ -5882,7 +5885,7 @@ void handle_detach_from_avatar(void* user_data)
5882 } 5885 }
5883} 5886}
5884 5887
5885void attach_label(LLString& label, void* user_data) 5888void attach_label(std::string& label, void* user_data)
5886{ 5889{
5887 LLViewerJointAttachment* attachmentp = (LLViewerJointAttachment*)user_data; 5890 LLViewerJointAttachment* attachmentp = (LLViewerJointAttachment*)user_data;
5888 if (attachmentp) 5891 if (attachmentp)
@@ -5893,13 +5896,13 @@ void attach_label(LLString& label, void* user_data)
5893 LLViewerInventoryItem* itemp = gInventory.getItem(attachmentp->getItemID()); 5896 LLViewerInventoryItem* itemp = gInventory.getItem(attachmentp->getItemID());
5894 if (itemp) 5897 if (itemp)
5895 { 5898 {
5896 label += LLString(" (") + itemp->getName() + LLString(")"); 5899 label += std::string(" (") + itemp->getName() + std::string(")");
5897 } 5900 }
5898 } 5901 }
5899 } 5902 }
5900} 5903}
5901 5904
5902void detach_label(LLString& label, void* user_data) 5905void detach_label(std::string& label, void* user_data)
5903{ 5906{
5904 LLViewerJointAttachment* attachmentp = (LLViewerJointAttachment*)user_data; 5907 LLViewerJointAttachment* attachmentp = (LLViewerJointAttachment*)user_data;
5905 if (attachmentp) 5908 if (attachmentp)
@@ -5910,7 +5913,7 @@ void detach_label(LLString& label, void* user_data)
5910 LLViewerInventoryItem* itemp = gInventory.getItem(attachmentp->getItemID()); 5913 LLViewerInventoryItem* itemp = gInventory.getItem(attachmentp->getItemID());
5911 if (itemp) 5914 if (itemp)
5912 { 5915 {
5913 label += LLString(" (") + itemp->getName() + LLString(")"); 5916 label += std::string(" (") + itemp->getName() + std::string(")");
5914 } 5917 }
5915 } 5918 }
5916 } 5919 }
@@ -5923,7 +5926,7 @@ class LLAttachmentDetach : public view_listener_t
5923 { 5926 {
5924 // Called when the user clicked on an object attached to them 5927 // Called when the user clicked on an object attached to them
5925 // and selected "Detach". 5928 // and selected "Detach".
5926 LLViewerObject *object = gViewerWindow->lastObjectHit(); 5929 LLViewerObject *object = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
5927 if (!object) 5930 if (!object)
5928 { 5931 {
5929 llwarns << "handle_detach() - no object to detach" << llendl; 5932 llwarns << "handle_detach() - no object to detach" << llendl;
@@ -6003,7 +6006,7 @@ class LLAttachmentEnableDrop : public view_listener_t
6003 // in your inventory. Therefore, we disable the drop option until the 6006 // in your inventory. Therefore, we disable the drop option until the
6004 // item is in your inventory 6007 // item is in your inventory
6005 6008
6006 LLViewerObject* object = gViewerWindow->lastObjectHit(); 6009 LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
6007 LLViewerJointAttachment* attachment_pt = NULL; 6010 LLViewerJointAttachment* attachment_pt = NULL;
6008 LLInventoryItem* item = NULL; 6011 LLInventoryItem* item = NULL;
6009 6012
@@ -6045,7 +6048,7 @@ class LLAttachmentEnableDrop : public view_listener_t
6045 6048
6046BOOL enable_detach(void*) 6049BOOL enable_detach(void*)
6047{ 6050{
6048 LLViewerObject* object = gViewerWindow->lastObjectHit(); 6051 LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
6049 if (!object) return FALSE; 6052 if (!object) return FALSE;
6050 if (!object->isAttachment()) return FALSE; 6053 if (!object->isAttachment()) return FALSE;
6051 6054
@@ -6085,9 +6088,12 @@ BOOL object_selected_and_point_valid(void *user_data)
6085 { 6088 {
6086 LLSelectNode* node = *iter; 6089 LLSelectNode* node = *iter;
6087 LLViewerObject* object = node->getObject(); 6090 LLViewerObject* object = node->getObject();
6088 for (U32 child_num = 0; child_num < object->mChildList.size(); child_num++ ) 6091 LLViewerObject::const_child_list_t& child_list = object->getChildren();
6092 for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
6093 iter != child_list.end(); iter++)
6089 { 6094 {
6090 if (object->mChildList[child_num]->isAvatar()) 6095 LLViewerObject* child = *iter;
6096 if (child->isAvatar())
6091 { 6097 {
6092 return FALSE; 6098 return FALSE;
6093 } 6099 }
@@ -6149,10 +6155,10 @@ class LLAvatarSendIM : public view_listener_t
6149{ 6155{
6150 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 6156 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
6151 { 6157 {
6152 LLVOAvatar* avatar = find_avatar_from_object( gViewerWindow->lastObjectHit() ); 6158 LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getFirstObject() );
6153 if(avatar) 6159 if(avatar)
6154 { 6160 {
6155 LLString name("IM"); 6161 std::string name("IM");
6156 LLNameValue *first = avatar->getNVPair("FirstName"); 6162 LLNameValue *first = avatar->getNVPair("FirstName");
6157 LLNameValue *last = avatar->getNVPair("LastName"); 6163 LLNameValue *last = avatar->getNVPair("LastName");
6158 if (first && last) 6164 if (first && last)
@@ -6243,11 +6249,15 @@ class LLToolsSelectedScriptAction : public view_listener_t
6243{ 6249{
6244 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 6250 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
6245 { 6251 {
6246 LLString action = userdata.asString(); 6252 std::string action = userdata.asString();
6247 LLFloaterScriptQueue* queue = NULL; 6253 LLFloaterScriptQueue* queue = NULL;
6248 if (action == "compile") 6254 if (action == "compile mono")
6249 { 6255 {
6250 queue = LLFloaterCompileQueue::create(); 6256 queue = LLFloaterCompileQueue::create(TRUE);
6257 }
6258 if (action == "compile lsl")
6259 {
6260 queue = LLFloaterCompileQueue::create(FALSE);
6251 } 6261 }
6252 else if (action == "reset") 6262 else if (action == "reset")
6253 { 6263 {
@@ -6408,7 +6418,7 @@ BOOL menu_ui_enabled(void *user_data)
6408void menu_toggle_control( void* user_data ) 6418void menu_toggle_control( void* user_data )
6409{ 6419{
6410 BOOL checked = gSavedSettings.getBOOL( static_cast<char*>(user_data) ); 6420 BOOL checked = gSavedSettings.getBOOL( static_cast<char*>(user_data) );
6411 if (LLString(static_cast<char*>(user_data)) == "HighResSnapshot" && !checked) 6421 if (std::string(static_cast<char*>(user_data)) == "HighResSnapshot" && !checked)
6412 { 6422 {
6413 // High Res Snapshot active, must uncheck RenderUIInSnapshot 6423 // High Res Snapshot active, must uncheck RenderUIInSnapshot
6414 gSavedSettings.setBOOL( "RenderUIInSnapshot", FALSE ); 6424 gSavedSettings.setBOOL( "RenderUIInSnapshot", FALSE );
@@ -6422,7 +6432,7 @@ class LLToggleControl : public view_listener_t
6422{ 6432{
6423 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 6433 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
6424 { 6434 {
6425 LLString control_name = userdata.asString(); 6435 std::string control_name = userdata.asString();
6426 BOOL checked = gSavedSettings.getBOOL( control_name ); 6436 BOOL checked = gSavedSettings.getBOOL( control_name );
6427 if (control_name == "HighResSnapshot" && !checked) 6437 if (control_name == "HighResSnapshot" && !checked)
6428 { 6438 {
@@ -6464,6 +6474,18 @@ BOOL enable_land_selected( void* )
6464 return !(LLViewerParcelMgr::getInstance()->selectionEmpty()); 6474 return !(LLViewerParcelMgr::getInstance()->selectionEmpty());
6465} 6475}
6466 6476
6477void menu_toggle_attached_lights(void* user_data)
6478{
6479 menu_toggle_control(user_data);
6480 LLPipeline::sRenderAttachedLights = gSavedSettings.getBOOL("RenderAttachedLights");
6481}
6482
6483void menu_toggle_attached_particles(void* user_data)
6484{
6485 menu_toggle_control(user_data);
6486 LLPipeline::sRenderAttachedParticles = gSavedSettings.getBOOL("RenderAttachedParticles");
6487}
6488
6467class LLSomethingSelected : public view_listener_t 6489class LLSomethingSelected : public view_listener_t
6468{ 6490{
6469 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 6491 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
@@ -6490,16 +6512,36 @@ BOOL enable_more_than_one_selected(void* )
6490 return (LLSelectMgr::getInstance()->getSelection()->getObjectCount() > 1); 6512 return (LLSelectMgr::getInstance()->getSelection()->getObjectCount() > 1);
6491} 6513}
6492 6514
6515static bool is_editable_selected()
6516{
6517 return (LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() != NULL);
6518}
6519
6493class LLEditableSelected : public view_listener_t 6520class LLEditableSelected : public view_listener_t
6494{ 6521{
6495 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 6522 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
6496 { 6523 {
6497 bool new_value = (LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() != NULL); 6524 gMenuHolder->findControl(userdata["control"].asString())->setValue(is_editable_selected());
6498 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
6499 return true; 6525 return true;
6500 } 6526 }
6501}; 6527};
6502 6528
6529class LLEditableSelectedMono : public view_listener_t
6530{
6531 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
6532 {
6533 LLViewerRegion* region = gAgent.getRegion();
6534 if(region && gMenuHolder && gMenuHolder->findControl(userdata["control"].asString()))
6535 {
6536 bool have_cap = (! region->getCapability("UpdateScriptTask").empty());
6537 bool selected = is_editable_selected() && have_cap;
6538 gMenuHolder->findControl(userdata["control"].asString())->setValue(selected);
6539 return true;
6540 }
6541 return false;
6542 }
6543};
6544
6503class LLToolsEnableTakeCopy : public view_listener_t 6545class LLToolsEnableTakeCopy : public view_listener_t
6504{ 6546{
6505 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 6547 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
@@ -6676,22 +6718,22 @@ BOOL enable_not_thirdperson(void*)
6676} 6718}
6677 6719
6678 6720
6679BOOL enable_export_selected(void *) 6721// BOOL enable_export_selected(void *)
6680{ 6722// {
6681 if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) 6723// if (LLSelectMgr::getInstance()->getSelection()->isEmpty())
6682 { 6724// {
6683 return FALSE; 6725// return FALSE;
6684 } 6726// }
6685 if (!gExporterRequestID.isNull()) 6727// if (!gExporterRequestID.isNull())
6686 { 6728// {
6687 return FALSE; 6729// return FALSE;
6688 } 6730// }
6689 if (!LLUploadDialog::modalUploadIsFinished()) 6731// if (!LLUploadDialog::modalUploadIsFinished())
6690 { 6732// {
6691 return FALSE; 6733// return FALSE;
6692 } 6734// }
6693 return TRUE; 6735// return TRUE;
6694} 6736// }
6695 6737
6696class LLViewEnableMouselook : public view_listener_t 6738class LLViewEnableMouselook : public view_listener_t
6697{ 6739{
@@ -6925,7 +6967,11 @@ void handle_dump_avatar_local_textures(void*)
6925 6967
6926void handle_debug_avatar_textures(void*) 6968void handle_debug_avatar_textures(void*)
6927{ 6969{
6928 LLFloaterAvatarTextures::show(gLastHitObjectID); 6970 LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
6971 if (objectp)
6972 {
6973 LLFloaterAvatarTextures::show(objectp->getID());
6974 }
6929} 6975}
6930 6976
6931void handle_grab_texture(void* data) 6977void handle_grab_texture(void* data)
@@ -6941,7 +6987,7 @@ void handle_grab_texture(void* data)
6941 LLUUID folder_id(gInventory.findCategoryUUIDForType(asset_type)); 6987 LLUUID folder_id(gInventory.findCategoryUUIDForType(asset_type));
6942 if(folder_id.notNull()) 6988 if(folder_id.notNull())
6943 { 6989 {
6944 LLString name = "Baked "; 6990 std::string name = "Baked ";
6945 switch (index) 6991 switch (index)
6946 { 6992 {
6947 case LLVOAvatar::TEX_EYES_BAKED: 6993 case LLVOAvatar::TEX_EYES_BAKED:
@@ -6978,7 +7024,7 @@ void handle_grab_texture(void* data)
6978 PERM_NONE, 7024 PERM_NONE,
6979 PERM_NONE, 7025 PERM_NONE,
6980 next_owner_perm); 7026 next_owner_perm);
6981 S32 creation_date_now = time_corrected(); 7027 time_t creation_date_now = time_corrected();
6982 LLPointer<LLViewerInventoryItem> item 7028 LLPointer<LLViewerInventoryItem> item
6983 = new LLViewerInventoryItem(item_id, 7029 = new LLViewerInventoryItem(item_id,
6984 folder_id, 7030 folder_id,
@@ -6987,7 +7033,7 @@ void handle_grab_texture(void* data)
6987 asset_type, 7033 asset_type,
6988 inv_type, 7034 inv_type,
6989 name, 7035 name,
6990 "", 7036 LLStringUtil::null,
6991 LLSaleInfo::DEFAULT, 7037 LLSaleInfo::DEFAULT,
6992 LLInventoryItem::II_FLAGS_NONE, 7038 LLInventoryItem::II_FLAGS_NONE,
6993 creation_date_now); 7039 creation_date_now);
@@ -7064,12 +7110,7 @@ LLVOAvatar* find_avatar_from_object( const LLUUID& object_id )
7064 7110
7065void handle_disconnect_viewer(void *) 7111void handle_disconnect_viewer(void *)
7066{ 7112{
7067 char message[2048]; /* Flawfinder: ignore */ 7113 LLAppViewer::instance()->forceDisconnect("Testing viewer disconnect");
7068 message[0] = '\0';
7069
7070 snprintf(message, sizeof(message), "Testing viewer disconnect"); /* Flawfinder: ignore */
7071
7072 LLAppViewer::instance()->forceDisconnect(message);
7073} 7114}
7074 7115
7075void force_error_breakpoint(void *) 7116void force_error_breakpoint(void *)
@@ -7175,20 +7216,20 @@ void handle_save_to_xml(void*)
7175 return; 7216 return;
7176 } 7217 }
7177 7218
7178 LLString default_name = "floater_"; 7219 std::string default_name = "floater_";
7179 default_name += frontmost->getTitle(); 7220 default_name += frontmost->getTitle();
7180 default_name += ".xml"; 7221 default_name += ".xml";
7181 7222
7182 LLString::toLower(default_name); 7223 LLStringUtil::toLower(default_name);
7183 LLString::replaceChar(default_name, ' ', '_'); 7224 LLStringUtil::replaceChar(default_name, ' ', '_');
7184 LLString::replaceChar(default_name, '/', '_'); 7225 LLStringUtil::replaceChar(default_name, '/', '_');
7185 LLString::replaceChar(default_name, ':', '_'); 7226 LLStringUtil::replaceChar(default_name, ':', '_');
7186 LLString::replaceChar(default_name, '"', '_'); 7227 LLStringUtil::replaceChar(default_name, '"', '_');
7187 7228
7188 LLFilePicker& picker = LLFilePicker::instance(); 7229 LLFilePicker& picker = LLFilePicker::instance();
7189 if (picker.getSaveFile(LLFilePicker::FFSAVE_XML, default_name.c_str())) 7230 if (picker.getSaveFile(LLFilePicker::FFSAVE_XML, default_name))
7190 { 7231 {
7191 LLString filename = picker.getFirstFile(); 7232 std::string filename = picker.getFirstFile();
7192 LLUICtrlFactory::getInstance()->saveToXML(frontmost, filename); 7233 LLUICtrlFactory::getInstance()->saveToXML(frontmost, filename);
7193 } 7234 }
7194} 7235}
@@ -7198,7 +7239,7 @@ void handle_load_from_xml(void*)
7198 LLFilePicker& picker = LLFilePicker::instance(); 7239 LLFilePicker& picker = LLFilePicker::instance();
7199 if (picker.getOpenFile(LLFilePicker::FFLOAD_XML)) 7240 if (picker.getOpenFile(LLFilePicker::FFLOAD_XML))
7200 { 7241 {
7201 LLString filename = picker.getFirstFile(); 7242 std::string filename = picker.getFirstFile();
7202 LLFloater* floater = new LLFloater("sample_floater"); 7243 LLFloater* floater = new LLFloater("sample_floater");
7203 LLUICtrlFactory::getInstance()->buildFloater(floater, filename); 7244 LLUICtrlFactory::getInstance()->buildFloater(floater, filename);
7204 } 7245 }
@@ -7281,7 +7322,7 @@ class LLViewBeaconWidth : public view_listener_t
7281{ 7322{
7282 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 7323 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
7283 { 7324 {
7284 LLString width = userdata.asString(); 7325 std::string width = userdata.asString();
7285 if(width == "1") 7326 if(width == "1")
7286 { 7327 {
7287 gSavedSettings.setS32("DebugBeaconLineWidth", 1); 7328 gSavedSettings.setS32("DebugBeaconLineWidth", 1);
@@ -7308,7 +7349,7 @@ class LLViewToggleBeacon : public view_listener_t
7308{ 7349{
7309 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 7350 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
7310 { 7351 {
7311 LLString beacon = userdata.asString(); 7352 std::string beacon = userdata.asString();
7312 if (beacon == "scriptsbeacon") 7353 if (beacon == "scriptsbeacon")
7313 { 7354 {
7314 LLPipeline::toggleRenderScriptedBeacons(NULL); 7355 LLPipeline::toggleRenderScriptedBeacons(NULL);
@@ -7377,7 +7418,7 @@ class LLViewCheckBeaconEnabled : public view_listener_t
7377{ 7418{
7378 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 7419 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
7379 { 7420 {
7380 LLString beacon = userdata["data"].asString(); 7421 std::string beacon = userdata["data"].asString();
7381 bool new_value = false; 7422 bool new_value = false;
7382 if (beacon == "scriptsbeacon") 7423 if (beacon == "scriptsbeacon")
7383 { 7424 {
@@ -7423,7 +7464,7 @@ class LLViewToggleRenderType : public view_listener_t
7423{ 7464{
7424 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 7465 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
7425 { 7466 {
7426 LLString type = userdata.asString(); 7467 std::string type = userdata.asString();
7427 if (type == "hideparticles") 7468 if (type == "hideparticles")
7428 { 7469 {
7429 LLPipeline::toggleRenderType(LLPipeline::RENDER_TYPE_PARTICLES); 7470 LLPipeline::toggleRenderType(LLPipeline::RENDER_TYPE_PARTICLES);
@@ -7436,7 +7477,7 @@ class LLViewCheckRenderType : public view_listener_t
7436{ 7477{
7437 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 7478 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
7438 { 7479 {
7439 LLString type = userdata["data"].asString(); 7480 std::string type = userdata["data"].asString();
7440 bool new_value = false; 7481 bool new_value = false;
7441 if (type == "hideparticles") 7482 if (type == "hideparticles")
7442 { 7483 {
@@ -7470,8 +7511,8 @@ class LLEditEnableTakeOff : public view_listener_t
7470{ 7511{
7471 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 7512 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
7472 { 7513 {
7473 LLString control_name = userdata["control"].asString(); 7514 std::string control_name = userdata["control"].asString();
7474 LLString clothing = userdata["data"].asString(); 7515 std::string clothing = userdata["data"].asString();
7475 bool new_value = false; 7516 bool new_value = false;
7476 if (clothing == "shirt") 7517 if (clothing == "shirt")
7477 { 7518 {
@@ -7518,7 +7559,7 @@ class LLEditTakeOff : public view_listener_t
7518{ 7559{
7519 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 7560 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
7520 { 7561 {
7521 LLString clothing = userdata.asString(); 7562 std::string clothing = userdata.asString();
7522 if (clothing == "shirt") 7563 if (clothing == "shirt")
7523 { 7564 {
7524 LLAgent::userRemoveWearable((void*)WT_SHIRT); 7565 LLAgent::userRemoveWearable((void*)WT_SHIRT);
@@ -7576,7 +7617,7 @@ class LLToolsSelectTool : public view_listener_t
7576{ 7617{
7577 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 7618 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
7578 { 7619 {
7579 LLString tool_name = userdata.asString(); 7620 std::string tool_name = userdata.asString();
7580 if (tool_name == "focus") 7621 if (tool_name == "focus")
7581 { 7622 {
7582 LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(1); 7623 LLToolMgr::getInstance()->getCurrentToolset()->selectToolByIndex(1);
@@ -7606,7 +7647,7 @@ class LLWorldEnvSettings : public view_listener_t
7606{ 7647{
7607 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 7648 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
7608 { 7649 {
7609 LLString tod = userdata.asString(); 7650 std::string tod = userdata.asString();
7610 LLVector3 sun_direction; 7651 LLVector3 sun_direction;
7611 7652
7612 if (tod == "editor") 7653 if (tod == "editor")
@@ -7720,7 +7761,7 @@ class LLWorldDayCycle : public view_listener_t
7720 7761
7721 7762
7722 7763
7723static void addMenu(view_listener_t *menu, const char *name) 7764static void addMenu(view_listener_t *menu, const std::string& name)
7724{ 7765{
7725 sMenus.push_back(menu); 7766 sMenus.push_back(menu);
7726 menu->registerListener(gMenuHolder, name); 7767 menu->registerListener(gMenuHolder, name);
@@ -7821,6 +7862,8 @@ void initialize_menus()
7821 addMenu(new LLToolsLink(), "Tools.Link"); 7862 addMenu(new LLToolsLink(), "Tools.Link");
7822 addMenu(new LLToolsUnlink(), "Tools.Unlink"); 7863 addMenu(new LLToolsUnlink(), "Tools.Unlink");
7823 addMenu(new LLToolsStopAllAnimations(), "Tools.StopAllAnimations"); 7864 addMenu(new LLToolsStopAllAnimations(), "Tools.StopAllAnimations");
7865 addMenu(new LLToolsReleaseKeys(), "Tools.ReleaseKeys");
7866 addMenu(new LLToolsEnableReleaseKeys(), "Tools.EnableReleaseKeys");
7824 addMenu(new LLToolsLookAtSelection(), "Tools.LookAtSelection"); 7867 addMenu(new LLToolsLookAtSelection(), "Tools.LookAtSelection");
7825 addMenu(new LLToolsBuyOrTake(), "Tools.BuyOrTake"); 7868 addMenu(new LLToolsBuyOrTake(), "Tools.BuyOrTake");
7826 addMenu(new LLToolsTakeCopy(), "Tools.TakeCopy"); 7869 addMenu(new LLToolsTakeCopy(), "Tools.TakeCopy");
@@ -7928,4 +7971,5 @@ void initialize_menus()
7928 addMenu(new LLSomethingSelected(), "SomethingSelected"); 7971 addMenu(new LLSomethingSelected(), "SomethingSelected");
7929 addMenu(new LLSomethingSelectedNoHUD(), "SomethingSelectedNoHUD"); 7972 addMenu(new LLSomethingSelectedNoHUD(), "SomethingSelectedNoHUD");
7930 addMenu(new LLEditableSelected(), "EditableSelected"); 7973 addMenu(new LLEditableSelected(), "EditableSelected");
7974 addMenu(new LLEditableSelectedMono(), "EditableSelectedMono");
7931} 7975}