From cd17687f01420952712a500107e0f93e7ab8d5f8 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:45:34 -0500 Subject: Second Life viewer sources 1.19.1.0 --- linden/indra/newview/llviewermenu.cpp | 412 ++++++++++++++++++++++------------ 1 file changed, 270 insertions(+), 142 deletions(-) (limited to 'linden/indra/newview/llviewermenu.cpp') diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp index 18bdaad..0f48d7d 100644 --- a/linden/indra/newview/llviewermenu.cpp +++ b/linden/indra/newview/llviewermenu.cpp @@ -94,6 +94,7 @@ #include "llfloaterbuyland.h" #include "llfloaterchat.h" #include "llfloatercustomize.h" +#include "llfloaterdaycycle.h" #include "llfloaterdirectory.h" #include "llfloatereditui.h" #include "llfloaterchatterbox.h" @@ -104,6 +105,7 @@ #include "llfloatergroupinvite.h" #include "llfloatergroups.h" #include "llfloaterhtml.h" +#include "llfloaterhtmlhelp.h" #include "llfloaterinspect.h" #include "llfloaterlagmeter.h" #include "llfloaterland.h" @@ -112,12 +114,16 @@ #include "llfloatermute.h" #include "llfloateropenobject.h" #include "llfloaterpermissionsmgr.h" +#include "llfloaterpostprocess.h" #include "llfloaterpreference.h" #include "llfloaterregioninfo.h" #include "llfloaterreporter.h" #include "llfloaterscriptdebug.h" +#include "llfloaterenvsettings.h" #include "llfloatertest.h" #include "llfloatertools.h" +#include "llfloaterwater.h" +#include "llfloaterwindlight.h" #include "llfloaterworldmap.h" #include "llframestats.h" #include "llframestatview.h" @@ -192,6 +198,9 @@ #include "llappviewer.h" #include "roles_constants.h" #include "llviewerjoystick.h" +#include "llwlanimator.h" +#include "llwlparammanager.h" +#include "llwaterparammanager.h" #include "lltexlayer.h" @@ -244,8 +253,8 @@ LLPieMenu *gPieLand = NULL; // local constants const LLString LANDMARK_MENU_NAME("Landmarks"); -const LLString CLIENT_MENU_NAME("Client"); -const LLString SERVER_MENU_NAME("Server"); +const LLString CLIENT_MENU_NAME("Advanced"); +const LLString SERVER_MENU_NAME("Admin"); const LLString SAVE_INTO_INVENTORY("Save Object Back to My Inventory"); const LLString SAVE_INTO_TASK_INVENTORY("Save Object Back to Object Contents"); @@ -423,7 +432,6 @@ BOOL enable_dehinge(void*); void handle_force_delete(void*); void print_object_info(void*); void print_agent_nvpairs(void*); -void show_debug_menus(); void toggle_debug_menus(void*); void toggle_map( void* user_data ); void export_info_callback(LLAssetInfo *info, void **user_data, S32 result); @@ -612,13 +620,13 @@ void set_underclothes_menu_options() { if (gMenuHolder && gAgent.isTeen()) { - gMenuHolder->getChildByName("Self Underpants", TRUE)->setVisible(FALSE); - gMenuHolder->getChildByName("Self Undershirt", TRUE)->setVisible(FALSE); + gMenuHolder->getChild("Self Underpants", TRUE)->setVisible(FALSE); + gMenuHolder->getChild("Self Undershirt", TRUE)->setVisible(FALSE); } if (gMenuBarView && gAgent.isTeen()) { - gMenuBarView->getChildByName("Menu Underpants", TRUE)->setVisible(FALSE); - gMenuBarView->getChildByName("Menu Undershirt", TRUE)->setVisible(FALSE); + gMenuBarView->getChild("Menu Underpants", TRUE)->setVisible(FALSE); + gMenuBarView->getChild("Menu Undershirt", TRUE)->setVisible(FALSE); } } @@ -655,16 +663,16 @@ void init_menus() gPieSelf = gUICtrlFactory->buildPieMenu("menu_pie_self.xml", gMenuHolder); // TomY TODO: what shall we do about these? - gDetachScreenPieMenu = (LLPieMenu*)gMenuHolder->getChildByName("Object Detach HUD", true); - gDetachPieMenu = (LLPieMenu*)gMenuHolder->getChildByName("Object Detach", true); + gDetachScreenPieMenu = gMenuHolder->getChild("Object Detach HUD", true); + gDetachPieMenu = gMenuHolder->getChild("Object Detach", true); gPieAvatar = gUICtrlFactory->buildPieMenu("menu_pie_avatar.xml", gMenuHolder); gPieObject = gUICtrlFactory->buildPieMenu("menu_pie_object.xml", gMenuHolder); - gAttachScreenPieMenu = (LLPieMenu*)gMenuHolder->getChildByName("Object Attach HUD", true); - gAttachPieMenu = (LLPieMenu*)gMenuHolder->getChildByName("Object Attach", true); - gPieRate = (LLPieMenu*)gMenuHolder->getChildByName("Rate Menu", true); + gAttachScreenPieMenu = gMenuHolder->getChild("Object Attach HUD"); + gAttachPieMenu = gMenuHolder->getChild("Object Attach"); + gPieRate = gMenuHolder->getChild("Rate Menu"); gPieAttachment = gUICtrlFactory->buildPieMenu("menu_pie_attachment.xml", gMenuHolder); @@ -714,8 +722,8 @@ void init_menus() gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", upload_cost); gMenuHolder->childSetLabelArg("Bulk Upload", "[COST]", upload_cost); - gAFKMenu = (LLMenuItemCallGL*)gMenuBarView->getChildByName("Set Away", TRUE); - gBusyMenu = (LLMenuItemCallGL*)gMenuBarView->getChildByName("Set Busy", TRUE); + gAFKMenu = gMenuBarView->getChild("Set Away", TRUE); + gBusyMenu = gMenuBarView->getChild("Set Busy", TRUE); gAttachSubMenu = gMenuBarView->getChildMenuByName("Attach Object", TRUE); gDetachSubMenu = gMenuBarView->getChildMenuByName("Detach Object", TRUE); @@ -1100,17 +1108,26 @@ void init_client_menu(LLMenuGL* menu) menu->append(new LLMenuItemCallGL("Debug Settings", LLFloaterSettingsDebug::show, NULL, NULL)); menu->append(new LLMenuItemCheckGL("View Admin Options", &handle_admin_override_toggle, NULL, &check_admin_override, NULL, 'V', MASK_CONTROL | MASK_ALT)); + + menu->append(new LLMenuItemCallGL("Request Admin Status", + &handle_god_mode, NULL, NULL, 'G', MASK_ALT | MASK_CONTROL)); + + menu->append(new LLMenuItemCallGL("Leave Admin Status", + &handle_leave_god_mode, NULL, NULL, 'G', MASK_ALT | MASK_SHIFT | MASK_CONTROL)); + menu->createJumpKeys(); } void init_debug_world_menu(LLMenuGL* menu) { +/* REMOVE mouse move sun from menu options menu->append(new LLMenuItemCheckGL("Mouse Moves Sun", &menu_toggle_control, NULL, &menu_check_control, (void*)"MouseSun", 'M', MASK_CONTROL|MASK_ALT)); +*/ menu->append(new LLMenuItemCheckGL("Sim Sun Override", &menu_toggle_control, NULL, @@ -1179,6 +1196,7 @@ void init_debug_ui_menu(LLMenuGL* menu) menu->appendSeparator(); menu->append(new LLMenuItemCheckGL("Show Time", menu_toggle_control, NULL, menu_check_control, (void*)"DebugShowTime")); menu->append(new LLMenuItemCheckGL("Show Render Info", menu_toggle_control, NULL, menu_check_control, (void*)"DebugShowRenderInfo")); + menu->append(new LLMenuItemCheckGL("Show Color Under Cursor", menu_toggle_control, NULL, menu_check_control, (void*)"DebugShowColor")); menu->createJumpKeys(); } @@ -1322,6 +1340,9 @@ void init_debug_rendering_menu(LLMenuGL* menu) sub_menu->append(new LLMenuItemCheckGL("Occlusion", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_OCCLUSION)); + sub_menu->append(new LLMenuItemCheckGL("Render Batches", &LLPipeline::toggleRenderDebug, NULL, + &LLPipeline::toggleRenderDebugControl, + (void*)LLPipeline::RENDER_DEBUG_BATCH_SIZE)); sub_menu->append(new LLMenuItemCheckGL("Animated Textures", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_TEXTURE_ANIM)); @@ -1337,18 +1358,15 @@ void init_debug_rendering_menu(LLMenuGL* menu) sub_menu->append(new LLMenuItemCheckGL("Pick Render", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_PICKING)); + sub_menu->append(new LLMenuItemCheckGL("Lights", &LLPipeline::toggleRenderDebug, NULL, + &LLPipeline::toggleRenderDebugControl, + (void*)LLPipeline::RENDER_DEBUG_LIGHTS)); sub_menu->append(new LLMenuItemCheckGL("Particles", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_PARTICLES)); sub_menu->append(new LLMenuItemCheckGL("Composition", &LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_COMPOSITION)); - sub_menu->append(new LLMenuItemCheckGL("ShadowMap", &LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_SHADOW_MAP)); - sub_menu->append(new LLMenuItemCheckGL("LightTrace",&LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_LIGHT_TRACE)); sub_menu->append(new LLMenuItemCheckGL("Glow",&LLPipeline::toggleRenderDebug, NULL, &LLPipeline::toggleRenderDebugControl, (void*)LLPipeline::RENDER_DEBUG_GLOW)); @@ -1373,6 +1391,9 @@ void init_debug_rendering_menu(LLMenuGL* menu) sub_menu->append(new LLMenuItemToggleGL("Randomize Framerate", &gRandomizeFramerate)); sub_menu->append(new LLMenuItemToggleGL("Periodic Slow Frame", &gPeriodicSlowFrame)); + + sub_menu->append(new LLMenuItemToggleGL("Frame Test", &LLPipeline::sRenderFrameTest)); + sub_menu->createJumpKeys(); menu->appendMenu( sub_menu ); @@ -1396,6 +1417,8 @@ void init_debug_rendering_menu(LLMenuGL* menu) item->setEnabled(gGLManager.mHasOcclusionQuery && gFeatureManagerp->isFeatureAvailable("UseOcclusion")); menu->append(item); + item = new LLMenuItemCheckGL("Fast Alpha", menu_toggle_control, NULL, menu_check_control, (void*)"RenderFastAlpha"); + menu->append(item); item = new LLMenuItemCheckGL("Animate Textures", menu_toggle_control, NULL, menu_check_control, (void*)"AnimateTextures"); menu->append(item); @@ -1585,19 +1608,11 @@ void init_server_menu(LLMenuGL* menu) &LLPanelRegionTools::onSaveState, &enable_god_customer_service, NULL)); // menu->append(new LLMenuItemCallGL("Force Join Group", handle_force_join_group)); - - - - menu->appendSeparator(); +// +// menu->appendSeparator(); // // menu->append(new LLMenuItemCallGL( "OverlayTitle", // &handle_show_overlay_title, &enable_god_customer_service, NULL)); - - menu->append(new LLMenuItemCallGL("Request Admin Status", - &handle_god_mode, NULL, NULL, 'G', MASK_ALT | MASK_CONTROL)); - - menu->append(new LLMenuItemCallGL("Leave Admin Status", - &handle_leave_god_mode, NULL, NULL, 'G', MASK_ALT | MASK_SHIFT | MASK_CONTROL)); menu->createJumpKeys(); } @@ -2009,11 +2024,12 @@ class LLSelfEnableRemoveAllAttachments : public view_listener_t if (gAgent.getAvatarObject()) { LLVOAvatar* avatarp = gAgent.getAvatarObject(); - for (LLViewerJointAttachment* attachmentp = avatarp->mAttachmentPoints.getFirstData(); - attachmentp; - attachmentp = avatarp->mAttachmentPoints.getNextData()) + for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); + iter != avatarp->mAttachmentPoints.end(); ) { - if (attachmentp->getObject()) + LLVOAvatar::attachment_map_t::iterator curiter = iter++; + LLViewerJointAttachment* attachment = curiter->second; + if (attachment->getObject()) { new_value = true; break; @@ -2625,12 +2641,10 @@ BOOL check_admin_override(void*) void handle_admin_override_toggle(void*) { - if(!gAgent.getAdminOverride()) - { - gAgent.setAdminOverride(TRUE); - show_debug_menus(); - } - else gAgent.setAdminOverride(FALSE); + gAgent.setAdminOverride(!gAgent.getAdminOverride()); + + // The above may have affected which debug menus are visible + show_debug_menus(); } void handle_god_mode(void*) @@ -2647,7 +2661,6 @@ void set_god_level(U8 god_level) { U8 old_god_level = gAgent.getGodLevel(); gAgent.setGodLevel( god_level ); - show_debug_menus(); gIMMgr->refresh(); gParcelMgr->notifyObservers(); @@ -2679,6 +2692,9 @@ void set_god_level(U8 god_level) LLNotifyBox::showXml("LeavingGodMode", args); } + + // changing god-level can affect which menus we see + show_debug_menus(); } #ifdef TOGGLE_HACKED_GODLIKE_VIEWER @@ -3349,9 +3365,9 @@ class LLEditDuplicate : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - if(gEditMenuHandler) + if(LLEditMenuHandler::gEditMenuHandler) { - gEditMenuHandler->duplicate(); + LLEditMenuHandler::gEditMenuHandler->duplicate(); } return true; } @@ -3361,7 +3377,7 @@ class LLEditEnableDuplicate : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = gEditMenuHandler && gEditMenuHandler->canDuplicate(); + bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDuplicate(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4443,7 +4459,7 @@ class LLEditEnableCut : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = gEditMenuHandler && gEditMenuHandler->canCut(); + bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canCut(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4453,9 +4469,9 @@ class LLEditCut : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - if( gEditMenuHandler ) + if( LLEditMenuHandler::gEditMenuHandler ) { - gEditMenuHandler->cut(); + LLEditMenuHandler::gEditMenuHandler->cut(); } return true; } @@ -4465,7 +4481,7 @@ class LLEditEnableCopy : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = gEditMenuHandler && gEditMenuHandler->canCopy(); + bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canCopy(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4475,9 +4491,9 @@ class LLEditCopy : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - if( gEditMenuHandler ) + if( LLEditMenuHandler::gEditMenuHandler ) { - gEditMenuHandler->copy(); + LLEditMenuHandler::gEditMenuHandler->copy(); } return true; } @@ -4487,7 +4503,7 @@ class LLEditEnablePaste : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = gEditMenuHandler && gEditMenuHandler->canPaste(); + bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canPaste(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4497,9 +4513,9 @@ class LLEditPaste : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - if( gEditMenuHandler ) + if( LLEditMenuHandler::gEditMenuHandler ) { - gEditMenuHandler->paste(); + LLEditMenuHandler::gEditMenuHandler->paste(); } return true; } @@ -4509,7 +4525,7 @@ class LLEditEnableDelete : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = gEditMenuHandler && gEditMenuHandler->canDoDelete(); + bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDoDelete(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4521,9 +4537,9 @@ class LLEditDelete : public view_listener_t { // If a text field can do a deletion, it gets precedence over deleting // an object in the world. - if( gEditMenuHandler && gEditMenuHandler->canDoDelete()) + if( LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDoDelete()) { - gEditMenuHandler->doDelete(); + LLEditMenuHandler::gEditMenuHandler->doDelete(); } // and close any pie/context menus when done @@ -4603,7 +4619,7 @@ class LLEditEnableDeselect : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = gEditMenuHandler && gEditMenuHandler->canDeselect(); + bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDeselect(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4613,9 +4629,9 @@ class LLEditDeselect : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - if( gEditMenuHandler ) + if( LLEditMenuHandler::gEditMenuHandler ) { - gEditMenuHandler->deselect(); + LLEditMenuHandler::gEditMenuHandler->deselect(); } return true; } @@ -4625,7 +4641,7 @@ class LLEditEnableSelectAll : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = gEditMenuHandler && gEditMenuHandler->canSelectAll(); + bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canSelectAll(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4636,9 +4652,9 @@ class LLEditSelectAll : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - if( gEditMenuHandler ) + if( LLEditMenuHandler::gEditMenuHandler ) { - gEditMenuHandler->selectAll(); + LLEditMenuHandler::gEditMenuHandler->selectAll(); } return true; } @@ -4649,7 +4665,7 @@ class LLEditEnableUndo : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = gEditMenuHandler && gEditMenuHandler->canUndo(); + bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canUndo(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4659,9 +4675,9 @@ class LLEditUndo : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - if( gEditMenuHandler && gEditMenuHandler->canUndo() ) + if( LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canUndo() ) { - gEditMenuHandler->undo(); + LLEditMenuHandler::gEditMenuHandler->undo(); } return true; } @@ -4671,7 +4687,7 @@ class LLEditEnableRedo : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = gEditMenuHandler && gEditMenuHandler->canRedo(); + bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canRedo(); gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4681,9 +4697,9 @@ class LLEditRedo : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - if( gEditMenuHandler && gEditMenuHandler->canRedo() ) + if( LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canRedo() ) { - gEditMenuHandler->redo(); + LLEditMenuHandler::gEditMenuHandler->redo(); } return true; } @@ -4729,8 +4745,12 @@ void show_debug_menus() gMenuBarView->setItemVisible(CLIENT_MENU_NAME, debug); gMenuBarView->setItemEnabled(CLIENT_MENU_NAME, debug); - gMenuBarView->setItemVisible(SERVER_MENU_NAME, debug); - gMenuBarView->setItemEnabled(SERVER_MENU_NAME, debug); + + // Server ('Admin') menu hidden when not in godmode. + const bool show_server_menu = debug && (gAgent.getGodLevel() > GOD_NOT); + gMenuBarView->setItemVisible(SERVER_MENU_NAME, show_server_menu); + gMenuBarView->setItemEnabled(SERVER_MENU_NAME, show_server_menu); + //gMenuBarView->setItemVisible(LLString("DebugOptions"), visible); //gMenuBarView->setItemVisible(LLString(AVI_TOOLS), visible); }; @@ -5199,40 +5219,6 @@ void handle_force_unlock(void*) gSelectMgr->getSelection()->applyToObjects(&func); } -class LLWorldForceSun : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - LLString tod = userdata.asString(); - LLVector3 sun_direction; - if (tod == "sunrise") - { - sun_direction.setVec(1.0f, 0.f, 0.2f); - } - else if (tod == "noon") - { - sun_direction.setVec(0.0f, 0.3f, 1.0f); - } - else if (tod == "sunset") - { - sun_direction.setVec(-1.0f, 0.f, 0.2f); - } - else if (tod == "midnight") - { - sun_direction.setVec(0.0f, 0.3f, -1.0f); - } - else - { - gSky.setOverrideSun(FALSE); - return true; - } - sun_direction.normVec(); - gSky.setOverrideSun(TRUE); - gSky.setSunDirection( sun_direction, LLVector3(0.f, 0.f, 0.f)); - return true; - } -}; - void handle_dump_followcam(void*) { LLFollowCamMgr::dump(); @@ -5339,7 +5325,7 @@ class LLShowFloater : public view_listener_t gParcelMgr->selectParcelAt(gAgent.getPositionGlobal()); } - LLFloaterLand::show(); + LLFloaterLand::showInstance(); } else if (floater_name == "buy land") { @@ -5364,25 +5350,7 @@ class LLShowFloater : public view_listener_t } else if (floater_name == "help f1") { -#if LL_LIBXUL_ENABLED - gViewerHtmlHelp.show( gSavedSettings.getString("HelpHomeURL") ); -#endif - } - else if (floater_name == "help in-world") - { -#if LL_LIBXUL_ENABLED - const bool open_app_slurls = true; - LLFloaterHtml::getInstance()->show( - "in-world_help", open_app_slurls ); -#endif - } - else if (floater_name == "help additional") - { -#if LL_LIBXUL_ENABLED - const bool open_app_slurls = true; - LLFloaterHtml::getInstance()->show( - "additional_help", open_app_slurls ); -#endif + gViewerHtmlHelp.show(); } else if (floater_name == "complaint reporter") { @@ -5440,7 +5408,7 @@ class LLFloaterVisible : public view_listener_t } else if (floater_name == "chat history") { - new_value = LLFloaterChat::visible(NULL); + new_value = LLFloaterChat::instanceVisible(); } else if (floater_name == "im") { @@ -5699,9 +5667,9 @@ private: if (selectedObject) { S32 index = userdata.asInteger(); - LLViewerJointAttachment* attachment_point = index > 0 ? - gAgent.getAvatarObject()->mAttachmentPoints[index] : - NULL; + LLViewerJointAttachment* attachment_point = NULL; + if (index > 0) + attachment_point = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, index, (LLViewerJointAttachment*)NULL); confirm_replace_attachment(0, attachment_point); } return true; @@ -5719,10 +5687,18 @@ void near_attach_object(BOOL success, void *user_data) { LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data; - U8 attachment_id; + U8 attachment_id = 0; if (attachment) { - attachment_id = gAgent.getAvatarObject()->mAttachmentPoints.reverseLookup(attachment); + for (LLVOAvatar::attachment_map_t::iterator iter = gAgent.getAvatarObject()->mAttachmentPoints.begin(); + iter != gAgent.getAvatarObject()->mAttachmentPoints.end(); ++iter) + { + if (iter->second == attachment) + { + attachment_id = iter->first; + break; + } + } } else { @@ -5958,7 +5934,7 @@ class LLAttachmentEnableDrop : public view_listener_t if ( object ) { S32 attachmentID = ATTACHMENT_ID_FROM_STATE(object->getState()); - attachment_pt = gAgent.getAvatarObject()->mAttachmentPoints.getIfThere(attachmentID); + attachment_pt = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL); if ( attachment_pt ) { @@ -6326,11 +6302,12 @@ void handle_dump_attachments(void*) return; } - for( LLViewerJointAttachment* attachment = avatar->mAttachmentPoints.getFirstData(); - attachment; - attachment = avatar->mAttachmentPoints.getNextData() ) + for (LLVOAvatar::attachment_map_t::iterator iter = avatar->mAttachmentPoints.begin(); + iter != avatar->mAttachmentPoints.end(); ) { - S32 key = avatar->mAttachmentPoints.getCurrentKeyWithoutIncrement(); + LLVOAvatar::attachment_map_t::iterator curiter = iter++; + LLViewerJointAttachment* attachment = curiter->second; + S32 key = curiter->first; BOOL visible = (attachment->getObject() != NULL && attachment->getObject()->mDrawable.notNull() && !attachment->getObject()->mDrawable->isRenderType(0)); @@ -7107,12 +7084,12 @@ BOOL LLViewerMenuHolderGL::hideMenus() return handled; } -void LLViewerMenuHolderGL::setParcelSelection(LLHandle selection) +void LLViewerMenuHolderGL::setParcelSelection(LLSafeHandle selection) { mParcelSelection = selection; } -void LLViewerMenuHolderGL::setObjectSelection(LLHandle selection) +void LLViewerMenuHolderGL::setObjectSelection(LLSafeHandle selection) { mObjectSelection = selection; } @@ -7120,7 +7097,7 @@ void LLViewerMenuHolderGL::setObjectSelection(LLHandle select const LLRect LLViewerMenuHolderGL::getMenuRect() const { - return LLRect(0, mRect.getHeight() - MENU_BAR_HEIGHT, mRect.getWidth(), STATUS_BAR_HEIGHT); + return LLRect(0, getRect().getHeight() - MENU_BAR_HEIGHT, getRect().getWidth(), STATUS_BAR_HEIGHT); } void handle_save_to_xml(void*) @@ -7163,8 +7140,9 @@ void handle_load_from_xml(void*) void handle_slurl_test(void*) { - LLFloaterHtml::getInstance()->show( - "http://secondlife.com/app/search/slurls.html", "SLURL Test", true); + bool open_app_slurls = true; + bool open_links_externally = false; + LLFloaterHtml::getInstance()->show("http://secondlife.com/app/search/slurls.html", "SLURL Test", open_app_slurls, open_links_externally); } void handle_rebake_textures(void*) @@ -7229,6 +7207,33 @@ class LLViewCheckHighlightTransparent : public view_listener_t } }; +class LLViewBeaconWidth : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + LLString width = userdata.asString(); + if(width == "1") + { + gSavedSettings.setS32("DebugBeaconLineWidth", 1); + } + else if(width == "4") + { + gSavedSettings.setS32("DebugBeaconLineWidth", 4); + } + else if(width == "16") + { + gSavedSettings.setS32("DebugBeaconLineWidth", 16); + } + else if(width == "32") + { + gSavedSettings.setS32("DebugBeaconLineWidth", 32); + } + + return true; + } +}; + + class LLViewToggleBeacon : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -7535,6 +7540,125 @@ class LLToolsSelectTool : public view_listener_t } }; +/// WINDLIGHT callbacks +class LLWorldEnvSettings : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + LLString tod = userdata.asString(); + LLVector3 sun_direction; + + if (tod == "editor") + { + // if not there or is hidden, show it + if( !LLFloaterEnvSettings::isOpen() || + !LLFloaterEnvSettings::instance()->getVisible()) { + LLFloaterEnvSettings::show(); + + // otherwise, close it button acts like a toggle + } + else + { + LLFloaterEnvSettings::instance()->close(); + } + return true; + } + + if (tod == "sunrise") + { + // set the value, turn off animation + LLWLParamManager::instance()->mAnimator.setDayTime(0.25); + LLWLParamManager::instance()->mAnimator.mIsRunning = false; + LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; + + // then call update once + LLWLParamManager::instance()->mAnimator.update( + LLWLParamManager::instance()->mCurParams); + } + else if (tod == "noon") + { + // set the value, turn off animation + LLWLParamManager::instance()->mAnimator.setDayTime(0.567); + LLWLParamManager::instance()->mAnimator.mIsRunning = false; + LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; + + // then call update once + LLWLParamManager::instance()->mAnimator.update( + LLWLParamManager::instance()->mCurParams); + } + else if (tod == "sunset") + { + // set the value, turn off animation + LLWLParamManager::instance()->mAnimator.setDayTime(0.75); + LLWLParamManager::instance()->mAnimator.mIsRunning = false; + LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; + + // then call update once + LLWLParamManager::instance()->mAnimator.update( + LLWLParamManager::instance()->mCurParams); + } + else if (tod == "midnight") + { + // set the value, turn off animation + LLWLParamManager::instance()->mAnimator.setDayTime(0.0); + LLWLParamManager::instance()->mAnimator.mIsRunning = false; + LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; + + // then call update once + LLWLParamManager::instance()->mAnimator.update( + LLWLParamManager::instance()->mCurParams); + } + else + { + LLWLParamManager::instance()->mAnimator.mIsRunning = true; + LLWLParamManager::instance()->mAnimator.mUseLindenTime = true; + } + return true; + } +}; + +/// Water Menu callbacks +class LLWorldWaterSettings : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + // if not there or is hidden, show it + if( !LLFloaterWater::isOpen() || + !LLFloaterWater::instance()->getVisible()) { + LLFloaterWater::show(); + + // otherwise, close it button acts like a toggle + } + else + { + LLFloaterWater::instance()->close(); + } + return true; + } +}; + +/// Post-Process callbacks +class LLWorldPostProcess : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + LLFloaterPostProcess::show(); + return true; + } +}; + +/// Day Cycle callbacks +class LLWorldDayCycle : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + LLFloaterDayCycle::show(); + return true; + } +}; + + + static void addMenu(view_listener_t *menu, const char *name) { sMenus.push_back(menu); @@ -7579,6 +7703,7 @@ void initialize_menus() addMenu(new LLViewShowHoverTips(), "View.ShowHoverTips"); addMenu(new LLViewHighlightTransparent(), "View.HighlightTransparent"); addMenu(new LLViewToggleBeacon(), "View.ToggleBeacon"); + addMenu(new LLViewBeaconWidth(), "View.BeaconWidth"); addMenu(new LLViewToggleRenderType(), "View.ToggleRenderType"); addMenu(new LLViewShowHUDAttachments(), "View.ShowHUDAttachments"); addMenu(new LLViewZoomOut(), "View.ZoomOut"); @@ -7614,8 +7739,11 @@ void initialize_menus() addMenu(new LLWorldEnableBuyLand(), "World.EnableBuyLand"); addMenu(new LLWorldCheckAlwaysRun(), "World.CheckAlwaysRun"); - - addMenu(new LLWorldForceSun(), "World.ForceSun"); + + (new LLWorldEnvSettings())->registerListener(gMenuHolder, "World.EnvSettings"); + (new LLWorldWaterSettings())->registerListener(gMenuHolder, "World.WaterSettings"); + (new LLWorldPostProcess())->registerListener(gMenuHolder, "World.PostProcess"); + (new LLWorldDayCycle())->registerListener(gMenuHolder, "World.DayCycle"); // Tools menu addMenu(new LLToolsSelectTool(), "Tools.SelectTool"); -- cgit v1.1