aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerwindow.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:54 -0500
committerJacek Antonelli2008-08-15 23:44:54 -0500
commitb2afb8800bb033a04bb3ecdf0363068d56648ef1 (patch)
tree3568129b5bbddb47cd39d622b4137a8fbff4abaf /linden/indra/newview/llviewerwindow.cpp
parentSecond Life viewer sources 1.14.0.1 (diff)
downloadmeta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.zip
meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.gz
meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.bz2
meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.xz
Second Life viewer sources 1.15.0.2
Diffstat (limited to 'linden/indra/newview/llviewerwindow.cpp')
-rw-r--r--linden/indra/newview/llviewerwindow.cpp439
1 files changed, 373 insertions, 66 deletions
diff --git a/linden/indra/newview/llviewerwindow.cpp b/linden/indra/newview/llviewerwindow.cpp
index a4d38f8..9498dbd 100644
--- a/linden/indra/newview/llviewerwindow.cpp
+++ b/linden/indra/newview/llviewerwindow.cpp
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * Second Life Viewer Source Code
7 * The source code in this file ("Source Code") is provided by Linden Lab 8 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0 9 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement 10 * ("GPL"), unless you have obtained a separate licensing agreement
@@ -62,7 +63,6 @@
62#include "llxfermanager.h" 63#include "llxfermanager.h"
63#include "message.h" 64#include "message.h"
64#include "object_flags.h" 65#include "object_flags.h"
65#include "text_out.h"
66#include "lltimer.h" 66#include "lltimer.h"
67#include "timing.h" 67#include "timing.h"
68#include "llviewermenu.h" 68#include "llviewermenu.h"
@@ -353,7 +353,216 @@ void LLViewerWindow::printFeedback()
353} 353}
354#endif //SABINRIG 354#endif //SABINRIG
355 355
356////////////////////////////////////////////////////////////////////////////
357//
358// LLDebugText
359//
360
361class LLDebugText
362{
363private:
364 struct Line
365 {
366 Line(const std::string& in_text, S32 in_x, S32 in_y) : text(in_text), x(in_x), y(in_y) {}
367 std::string text;
368 S32 x,y;
369 };
370
371 LLViewerWindow *mWindow;
372
373 typedef std::vector<Line> line_list_t;
374 line_list_t mLineList;
375 LLColor4 mTextColor;
376
377public:
378 LLDebugText(LLViewerWindow* window) : mWindow(window) {}
379
380 void addText(S32 x, S32 y, const std::string &text)
381 {
382 mLineList.push_back(Line(text, x, y));
383 }
384
385 void update()
386 {
387 std::string wind_vel_text;
388 std::string wind_vector_text;
389 std::string rwind_vel_text;
390 std::string rwind_vector_text;
391 std::string audio_text;
392
393 // Draw the statistics in a light gray
394 // and in a thin font
395 mTextColor = LLColor4( 0.86f, 0.86f, 0.86f, 1.f );
396
397 // Draw stuff growing up from right lower corner of screen
398 U32 xpos = mWindow->getWindowWidth() - 350;
399 U32 ypos = 64;
400 const U32 y_inc = 20;
401
402 if (gSavedSettings.getBOOL("DebugShowTime"))
403 {
404 const U32 y_inc2 = 15;
405 for (std::map<S32,LLFrameTimer>::reverse_iterator iter = gDebugTimers.rbegin();
406 iter != gDebugTimers.rend(); ++iter)
407 {
408 S32 idx = iter->first;
409 LLFrameTimer& timer = iter->second;
410 F32 time = timer.getElapsedTimeF32();
411 S32 hours = (S32)(time / (60*60));
412 S32 mins = (S32)((time - hours*(60*60)) / 60);
413 S32 secs = (S32)((time - hours*(60*60) - mins*60));
414 addText(xpos, ypos, llformat(" Debug %d: %d:%02d:%02d", idx, hours,mins,secs)); ypos += y_inc2;
415 }
416
417 F32 time = gFrameTimeSeconds;
418 S32 hours = (S32)(time / (60*60));
419 S32 mins = (S32)((time - hours*(60*60)) / 60);
420 S32 secs = (S32)((time - hours*(60*60) - mins*60));
421 addText(xpos, ypos, llformat("Time: %d:%02d:%02d", hours,mins,secs)); ypos += y_inc;
422 }
423
424 if (gDisplayCameraPos)
425 {
426 std::string camera_view_text;
427 std::string camera_center_text;
428 std::string agent_view_text;
429 std::string agent_left_text;
430 std::string agent_center_text;
431 std::string agent_root_center_text;
432
433 LLVector3d tvector; // Temporary vector to hold data for printing.
434
435 // Update camera center, camera view, wind info every other frame
436 tvector = gAgent.getPositionGlobal();
437 agent_center_text = llformat("AgentCenter %f %f %f",
438 (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
439
440 if (gAgent.getAvatarObject())
441 {
442 tvector = gAgent.getPosGlobalFromAgent(gAgent.getAvatarObject()->mRoot.getWorldPosition());
443 agent_root_center_text = llformat("AgentRootCenter %f %f %f",
444 (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
445 }
446 else
447 {
448 agent_root_center_text = "---";
449 }
450
356 451
452 tvector = LLVector4(gAgent.getFrameAgent().getAtAxis());
453 agent_view_text = llformat("AgentAtAxis %f %f %f",
454 (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
455
456 tvector = LLVector4(gAgent.getFrameAgent().getLeftAxis());
457 agent_left_text = llformat("AgentLeftAxis %f %f %f",
458 (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
459
460 tvector = gAgent.getCameraPositionGlobal();
461 camera_center_text = llformat("CameraCenter %f %f %f",
462 (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
463
464 tvector = LLVector4(gCamera->getAtAxis());
465 camera_view_text = llformat("CameraAtAxis %f %f %f",
466 (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
467
468 addText(xpos, ypos, agent_center_text); ypos += y_inc;
469 addText(xpos, ypos, agent_root_center_text); ypos += y_inc;
470 addText(xpos, ypos, agent_view_text); ypos += y_inc;
471 addText(xpos, ypos, agent_left_text); ypos += y_inc;
472 addText(xpos, ypos, camera_center_text); ypos += y_inc;
473 addText(xpos, ypos, camera_view_text); ypos += y_inc;
474 }
475
476 if (gDisplayWindInfo)
477 {
478 wind_vel_text = llformat("Wind velocity %.2f m/s", gWindVec.magVec());
479 wind_vector_text = llformat("Wind vector %.2f %.2f %.2f", gWindVec.mV[0], gWindVec.mV[1], gWindVec.mV[2]);
480 rwind_vel_text = llformat("RWind vel %.2f m/s", gRelativeWindVec.magVec());
481 rwind_vector_text = llformat("RWind vec %.2f %.2f %.2f", gRelativeWindVec.mV[0], gRelativeWindVec.mV[1], gRelativeWindVec.mV[2]);
482
483 addText(xpos, ypos, wind_vel_text); ypos += y_inc;
484 addText(xpos, ypos, wind_vector_text); ypos += y_inc;
485 addText(xpos, ypos, rwind_vel_text); ypos += y_inc;
486 addText(xpos, ypos, rwind_vector_text); ypos += y_inc;
487 }
488 if (gDisplayWindInfo)
489 {
490 if (gAudiop)
491 {
492 audio_text= llformat("Audio for wind: %d", gAudiop->isWindEnabled());
493 }
494 addText(xpos, ypos, audio_text); ypos += y_inc;
495 }
496 if (gDisplayFOV)
497 {
498 addText(xpos, ypos, llformat("FOV: %2.1f deg", RAD_TO_DEG * gCamera->getView()));
499 ypos += y_inc;
500 }
501 if (gSavedSettings.getBOOL("DebugShowRenderInfo"))
502 {
503 if (gPipeline.getUseVertexShaders() == 0)
504 {
505 addText(xpos, ypos, "Shaders Disabled");
506 ypos += y_inc;
507 }
508 addText(xpos, ypos, llformat("%d MB Vertex Data", LLVertexBuffer::sAllocatedBytes/(1024*1024)));
509 ypos += y_inc;
510
511 addText(xpos, ypos, llformat("%d Pending Lock", LLVertexBuffer::sLockedList.size()));
512 ypos += y_inc;
513
514 addText(xpos, ypos, llformat("%d Vertex Buffers", LLVertexBuffer::sGLCount));
515 ypos += y_inc;
516 }
517
518 if (LLPipeline::getRenderParticleBeacons(NULL))
519 {
520 addText(xpos, ypos, "Viewing particle beacons (blue)");
521 ypos += y_inc;
522 }
523 if (LLPipeline::toggleRenderTypeControlNegated((void*)LLPipeline::RENDER_TYPE_PARTICLES))
524 {
525 addText(xpos, ypos, "Hiding particles");
526 ypos += y_inc;
527 }
528 if (LLPipeline::getRenderPhysicalBeacons(NULL))
529 {
530 addText(xpos, ypos, "Viewing physical object beacons (green)");
531 ypos += y_inc;
532 }
533 if (LLPipeline::getRenderScriptedBeacons(NULL))
534 {
535 addText(xpos, ypos, "Viewing scripted object beacons (red)");
536 ypos += y_inc;
537 }
538 if (LLPipeline::getRenderSoundBeacons(NULL))
539 {
540 addText(xpos, ypos, "Viewing sound beacons (yellow)");
541 ypos += y_inc;
542 }
543 }
544
545 void draw()
546 {
547 for (line_list_t::iterator iter = mLineList.begin();
548 iter != mLineList.end(); ++iter)
549 {
550 const Line& line = *iter;
551 LLFontGL::sMonospace->renderUTF8(line.text, 0, (F32)line.x, (F32)line.y, mTextColor,
552 LLFontGL::LEFT, LLFontGL::TOP,
553 LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE);
554 }
555 mLineList.clear();
556 }
557
558};
559
560void LLViewerWindow::updateDebugText()
561{
562 mDebugText->update();
563}
564
565////////////////////////////////////////////////////////////////////////////
357// 566//
358// LLViewerWindow 567// LLViewerWindow
359// 568//
@@ -420,12 +629,20 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask
420 } 629 }
421 630
422 // Topmost view gets a chance before the hierarchy 631 // Topmost view gets a chance before the hierarchy
423 LLView* top_view = gFocusMgr.getTopView(); 632 LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
424 if (top_view) 633 BOOL mouse_over_top_ctrl = FALSE;
634 if (top_ctrl)
425 { 635 {
426 S32 local_x, local_y; 636 S32 local_x, local_y;
427 top_view->screenPointToLocal( x, y, &local_x, &local_y ); 637 top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
428 if (top_view->pointInView(local_x, local_y) && top_view->handleMouseDown(local_x, local_y, mask)) return TRUE; 638 if (top_ctrl->pointInView(local_x, local_y))
639 {
640 mouse_over_top_ctrl = TRUE;
641 if(top_ctrl->handleMouseDown(local_x, local_y, mask))
642 {
643 return TRUE;
644 }
645 }
429 } 646 }
430 647
431 // Give the UI views a chance to process the click 648 // Give the UI views a chance to process the click
@@ -436,6 +653,11 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask
436 llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl; 653 llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl;
437 LLView::sMouseHandlerMessage = ""; 654 LLView::sMouseHandlerMessage = "";
438 } 655 }
656 if (top_ctrl && top_ctrl->hasFocus() && !mouse_over_top_ctrl)
657 {
658 // always defocus top view if we click off of it
659 top_ctrl->setFocus(FALSE);
660 }
439 return TRUE; 661 return TRUE;
440 } 662 }
441 else if (LLView::sDebugMouseHandling) 663 else if (LLView::sDebugMouseHandling)
@@ -443,6 +665,12 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask
443 llinfos << "Left Mouse Down not handled by view" << llendl; 665 llinfos << "Left Mouse Down not handled by view" << llendl;
444 } 666 }
445 667
668 if (top_ctrl && top_ctrl->hasFocus() && !mouse_over_top_ctrl)
669 {
670 // always defocus top view if we click off of it
671 top_ctrl->setFocus(FALSE);
672 }
673
446 if (gDisconnected) 674 if (gDisconnected)
447 { 675 {
448 return FALSE; 676 return FALSE;
@@ -498,12 +726,20 @@ BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK ma
498 } 726 }
499 727
500 // Check for hit on UI. 728 // Check for hit on UI.
501 LLView* top_view = gFocusMgr.getTopView(); 729 LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
502 if (top_view) 730 BOOL mouse_over_top_ctrl = FALSE;
731 if (top_ctrl)
503 { 732 {
504 S32 local_x, local_y; 733 S32 local_x, local_y;
505 top_view->screenPointToLocal( x, y, &local_x, &local_y ); 734 top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
506 if (top_view->pointInView(local_x, local_y) && top_view->handleDoubleClick(local_x, local_y, mask)) return TRUE; 735 if (top_ctrl->pointInView(local_x, local_y))
736 {
737 mouse_over_top_ctrl = TRUE;
738 if(top_ctrl->handleDoubleClick(local_x, local_y, mask))
739 {
740 return TRUE;
741 }
742 }
507 } 743 }
508 744
509 if (mRootView->handleDoubleClick(x, y, mask)) 745 if (mRootView->handleDoubleClick(x, y, mask))
@@ -513,6 +749,11 @@ BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK ma
513 llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl; 749 llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl;
514 LLView::sMouseHandlerMessage = ""; 750 LLView::sMouseHandlerMessage = "";
515 } 751 }
752 if (top_ctrl && top_ctrl->hasFocus() && !mouse_over_top_ctrl)
753 {
754 // always defocus top view if we click off of it
755 top_ctrl->setFocus(FALSE);
756 }
516 return TRUE; 757 return TRUE;
517 } 758 }
518 else if (LLView::sDebugMouseHandling) 759 else if (LLView::sDebugMouseHandling)
@@ -520,7 +761,13 @@ BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK ma
520 llinfos << "Left Mouse Down not handled by view" << llendl; 761 llinfos << "Left Mouse Down not handled by view" << llendl;
521 } 762 }
522 763
523 // Why is this here? JC 9/3/2002 764 if (top_ctrl && top_ctrl->hasFocus() && !mouse_over_top_ctrl)
765 {
766 // always defocus top view if we click off of it
767 top_ctrl->setFocus(FALSE);
768 }
769
770 // Why is this here? JC 9/3/2002
524 if (gNoRender) 771 if (gNoRender)
525 { 772 {
526 return TRUE; 773 return TRUE;
@@ -593,12 +840,12 @@ BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
593 return mouse_captor->handleMouseUp(local_x, local_y, mask); 840 return mouse_captor->handleMouseUp(local_x, local_y, mask);
594 } 841 }
595 842
596 LLView* top_view = gFocusMgr.getTopView(); 843 LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
597 if (top_view) 844 if (top_ctrl)
598 { 845 {
599 S32 local_x, local_y; 846 S32 local_x, local_y;
600 top_view->screenPointToLocal( x, y, &local_x, &local_y ); 847 top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
601 handled = top_view->pointInView(local_x, local_y) && top_view->handleMouseUp(local_x, local_y, mask); 848 handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleMouseUp(local_x, local_y, mask);
602 } 849 }
603 850
604 if( !handled ) 851 if( !handled )
@@ -689,12 +936,20 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK
689 return mouse_captor->handleRightMouseDown(local_x, local_y, mask); 936 return mouse_captor->handleRightMouseDown(local_x, local_y, mask);
690 } 937 }
691 938
692 LLView* top_view = gFocusMgr.getTopView(); 939 LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
693 if (top_view) 940 BOOL mouse_over_top_ctrl = FALSE;
941 if (top_ctrl)
694 { 942 {
695 S32 local_x, local_y; 943 S32 local_x, local_y;
696 top_view->screenPointToLocal( x, y, &local_x, &local_y ); 944 top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
697 if (top_view->pointInView(local_x, local_y) && top_view->handleRightMouseDown(local_x, local_y, mask)) return TRUE; 945 if (top_ctrl->pointInView(local_x, local_y))
946 {
947 mouse_over_top_ctrl = TRUE;
948 if(top_ctrl->handleRightMouseDown(local_x, local_y, mask))
949 {
950 return TRUE;
951 }
952 }
698 } 953 }
699 954
700 if( mRootView->handleRightMouseDown(x, y, mask) ) 955 if( mRootView->handleRightMouseDown(x, y, mask) )
@@ -704,6 +959,11 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK
704 llinfos << "Right Mouse Down" << LLView::sMouseHandlerMessage << llendl; 959 llinfos << "Right Mouse Down" << LLView::sMouseHandlerMessage << llendl;
705 LLView::sMouseHandlerMessage = ""; 960 LLView::sMouseHandlerMessage = "";
706 } 961 }
962 if (top_ctrl && top_ctrl->hasFocus() && !mouse_over_top_ctrl)
963 {
964 // always defocus top view if we click off of it
965 top_ctrl->setFocus(FALSE);
966 }
707 return TRUE; 967 return TRUE;
708 } 968 }
709 else if (LLView::sDebugMouseHandling) 969 else if (LLView::sDebugMouseHandling)
@@ -711,6 +971,12 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK
711 llinfos << "Right Mouse Down not handled by view" << llendl; 971 llinfos << "Right Mouse Down not handled by view" << llendl;
712 } 972 }
713 973
974 if (top_ctrl && top_ctrl->hasFocus() && !mouse_over_top_ctrl)
975 {
976 // always defocus top view if we click off of it
977 top_ctrl->setFocus(FALSE);
978 }
979
714 if (gToolMgr) 980 if (gToolMgr)
715 { 981 {
716 if(gToolMgr->getCurrentTool()->handleRightMouseDown( x, y, mask ) ) 982 if(gToolMgr->getCurrentTool()->handleRightMouseDown( x, y, mask ) )
@@ -792,12 +1058,12 @@ BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK m
792 return mouse_captor->handleRightMouseUp(local_x, local_y, mask); 1058 return mouse_captor->handleRightMouseUp(local_x, local_y, mask);
793 } 1059 }
794 1060
795 LLView* top_view = gFocusMgr.getTopView(); 1061 LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
796 if (top_view) 1062 if (top_ctrl)
797 { 1063 {
798 S32 local_x, local_y; 1064 S32 local_x, local_y;
799 top_view->screenPointToLocal( x, y, &local_x, &local_y ); 1065 top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
800 handled = top_view->pointInView(local_x, local_y) && top_view->handleRightMouseUp(local_x, local_y, mask); 1066 handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleRightMouseUp(local_x, local_y, mask);
801 } 1067 }
802 1068
803 if( !handled ) 1069 if( !handled )
@@ -931,7 +1197,7 @@ void LLViewerWindow::handleFocusLost(LLWindow *window)
931 { 1197 {
932 gToolMgr->onAppFocusLost(); 1198 gToolMgr->onAppFocusLost();
933 } 1199 }
934 gFocusMgr.setMouseCapture( NULL, NULL ); 1200 gFocusMgr.setMouseCapture( NULL );
935 1201
936 if (gMenuBarView) 1202 if (gMenuBarView)
937 { 1203 {
@@ -1224,6 +1490,8 @@ LLViewerWindow::LLViewerWindow(
1224 1490
1225 LLFontManager::initClass(); 1491 LLFontManager::initClass();
1226 1492
1493 // Initialize OpenGL Renderer
1494
1227 if (!gFeatureManagerp->isFeatureAvailable("RenderVBO") || 1495 if (!gFeatureManagerp->isFeatureAvailable("RenderVBO") ||
1228 !gGLManager.mHasVertexBufferObject) 1496 !gGLManager.mHasVertexBufferObject)
1229 { 1497 {
@@ -1236,8 +1504,27 @@ LLViewerWindow::LLViewerWindow(
1236 // stuff like AGP if we think that it'll crash the viewer. 1504 // stuff like AGP if we think that it'll crash the viewer.
1237 // 1505 //
1238 gFeatureManagerp->initGraphicsFeatureMasks(); 1506 gFeatureManagerp->initGraphicsFeatureMasks();
1507
1508 // The ATI Mobility Radeon with 1.15.0 causes crashes in FMOD on startup for
1509 // unknown reasons, but only if you have an old settings.ini file.
1510 // In this case, force the graphics settings back to recommended, but only
1511 // do it once. JC
1512 std::string gpu_string = gFeatureManagerp->getGPUString();
1513 LLString::toLower(gpu_string);
1514 bool upgrade_to_1_15 = (gSavedSettings.getString("LastRunVersion") != "1.15.0");
1515 bool mobility_radeon = (gpu_string.find("mobility radeon") != std::string::npos);
1516 bool mobility_radeon_upgrade_hack = upgrade_to_1_15 && mobility_radeon;
1517 if (mobility_radeon_upgrade_hack)
1518 {
1519 llinfos << "1.15.0 update on Mobility Radeon" << llendl;
1520 llinfos << "Forcing recommended graphics settings" << llendl;
1521 llinfos << "Forcing audio off" << llendl;
1522 gUseAudio = FALSE;
1523 }
1524
1239 if (gFeatureManagerp->isSafe() 1525 if (gFeatureManagerp->isSafe()
1240 || (gSavedSettings.getS32("LastFeatureVersion") != gFeatureManagerp->getVersion())) 1526 || (gSavedSettings.getS32("LastFeatureVersion") != gFeatureManagerp->getVersion())
1527 || mobility_radeon_upgrade_hack)
1241 { 1528 {
1242 gFeatureManagerp->applyRecommendedFeatures(); 1529 gFeatureManagerp->applyRecommendedFeatures();
1243 } 1530 }
@@ -1249,16 +1536,30 @@ LLViewerWindow::LLViewerWindow(
1249 idx = LLViewerImageList::getMaxVideoRamSetting(-2); // get max recommended setting 1536 idx = LLViewerImageList::getMaxVideoRamSetting(-2); // get max recommended setting
1250 gSavedSettings.setS32("GraphicsCardMemorySetting", idx); 1537 gSavedSettings.setS32("GraphicsCardMemorySetting", idx);
1251 } 1538 }
1252 1539
1540 // If we crashed while initializng GL stuff last time, disable certain features
1541 if (gSavedSettings.getBOOL("RenderInitError"))
1542 {
1543 mInitAlert = "DisplaySettingsNoShaders";
1544 gSavedSettings.setBOOL("VertexShaderEnable", FALSE);
1545 }
1546
1253 if (!gNoRender) 1547 if (!gNoRender)
1254 { 1548 {
1255 // 1549 //
1256 // Initialize GL stuff 1550 // Initialize GL stuff
1257 // 1551 //
1258 1552
1553 // Set this flag in case we crash while initializing GL
1554 gSavedSettings.setBOOL("RenderInitError", TRUE);
1555 gSavedSettings.saveToFile( gSettingsFileName, TRUE );
1556
1259 gPipeline.init(); 1557 gPipeline.init();
1260 stop_glerror(); 1558 stop_glerror();
1261 initGLDefaults(); 1559 initGLDefaults();
1560
1561 gSavedSettings.setBOOL("RenderInitError", FALSE);
1562 gSavedSettings.saveToFile( gSettingsFileName, TRUE );
1262 } 1563 }
1263 1564
1264 // 1565 //
@@ -1303,6 +1604,9 @@ LLViewerWindow::LLViewerWindow(
1303 1604
1304 // sync the keyboard's setting with the saved setting 1605 // sync the keyboard's setting with the saved setting
1305 gSavedSettings.getControl("NumpadControl")->firePropertyChanged(); 1606 gSavedSettings.getControl("NumpadControl")->firePropertyChanged();
1607
1608 mDebugText = new LLDebugText(this);
1609
1306} 1610}
1307 1611
1308void LLViewerWindow::initGLDefaults() 1612void LLViewerWindow::initGLDefaults()
@@ -1651,6 +1955,8 @@ void LLViewerWindow::initWorldUI()
1651 1955
1652LLViewerWindow::~LLViewerWindow() 1956LLViewerWindow::~LLViewerWindow()
1653{ 1957{
1958 delete mDebugText;
1959
1654 gSavedSettings.setS32("FloaterViewBottom", gFloaterView->getRect().mBottom); 1960 gSavedSettings.setS32("FloaterViewBottom", gFloaterView->getRect().mBottom);
1655 1961
1656 // Cleanup global views 1962 // Cleanup global views
@@ -1864,6 +2170,10 @@ void LLViewerWindow::reshape(S32 width, S32 height)
1864 } 2170 }
1865} 2171}
1866 2172
2173void LLViewerWindow::drawDebugText()
2174{
2175 mDebugText->draw();
2176}
1867 2177
1868void LLViewerWindow::draw() 2178void LLViewerWindow::draw()
1869{ 2179{
@@ -1935,7 +2245,7 @@ void LLViewerWindow::draw()
1935 2245
1936 { 2246 {
1937 LLGLSTexture gls_texture; 2247 LLGLSTexture gls_texture;
1938 show_text_gl(); 2248 drawDebugText();
1939 } 2249 }
1940 2250
1941 if (gToolMgr) 2251 if (gToolMgr)
@@ -1947,7 +2257,7 @@ void LLViewerWindow::draw()
1947 if( gAgent.cameraMouselook() ) 2257 if( gAgent.cameraMouselook() )
1948 { 2258 {
1949 drawMouselookInstructions(); 2259 drawMouselookInstructions();
1950 stop_glerror(); 2260 stop_glerror();
1951 } 2261 }
1952 2262
1953 // Draw all nested UI views. 2263 // Draw all nested UI views.
@@ -1955,16 +2265,16 @@ void LLViewerWindow::draw()
1955 mRootView->draw(); 2265 mRootView->draw();
1956 2266
1957 // Draw optional on-top-of-everyone view 2267 // Draw optional on-top-of-everyone view
1958 LLView* top_view = gFocusMgr.getTopView(); 2268 LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
1959 if (top_view && top_view->getVisible()) 2269 if (top_ctrl && top_ctrl->getVisible())
1960 { 2270 {
1961 S32 screen_x, screen_y; 2271 S32 screen_x, screen_y;
1962 top_view->localPointToScreen(0, 0, &screen_x, &screen_y); 2272 top_ctrl->localPointToScreen(0, 0, &screen_x, &screen_y);
1963 2273
1964 glMatrixMode(GL_MODELVIEW); 2274 glMatrixMode(GL_MODELVIEW);
1965 LLUI::pushMatrix(); 2275 LLUI::pushMatrix();
1966 LLUI::translate( (F32) screen_x, (F32) screen_y, 0.f); 2276 LLUI::translate( (F32) screen_x, (F32) screen_y, 0.f);
1967 top_view->draw(); 2277 top_ctrl->draw();
1968 LLUI::popMatrix(); 2278 LLUI::popMatrix();
1969 } 2279 }
1970 2280
@@ -2084,7 +2394,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
2084 // cursor modes, etc, and re-enable. 2394 // cursor modes, etc, and re-enable.
2085 //if (gFocusMgr.getMouseCapture()) 2395 //if (gFocusMgr.getMouseCapture())
2086 //{ 2396 //{
2087 // gFocusMgr.setMouseCapture(NULL, NULL); 2397 // gFocusMgr.setMouseCapture(NULL);
2088 // return TRUE; 2398 // return TRUE;
2089 //} 2399 //}
2090 } 2400 }
@@ -2150,10 +2460,10 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
2150 2460
2151 // Topmost view gets a chance before the hierarchy 2461 // Topmost view gets a chance before the hierarchy
2152 // *FIX: get rid of this? 2462 // *FIX: get rid of this?
2153 LLView* top_view = gFocusMgr.getTopView(); 2463 LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
2154 if (top_view) 2464 if (top_ctrl)
2155 { 2465 {
2156 if( top_view->handleKey( key, mask, TRUE ) ) 2466 if( top_ctrl->handleKey( key, mask, TRUE ) )
2157 { 2467 {
2158 return TRUE; 2468 return TRUE;
2159 } 2469 }
@@ -2226,8 +2536,8 @@ BOOL LLViewerWindow::handleUnicodeChar(llwchar uni_char, MASK mask)
2226 } 2536 }
2227 2537
2228 // Topmost view gets a chance before the hierarchy 2538 // Topmost view gets a chance before the hierarchy
2229 LLView* top_view = gFocusMgr.getTopView(); 2539 LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
2230 if (top_view && top_view->handleUnicodeChar( uni_char, FALSE ) ) 2540 if (top_ctrl && top_ctrl->handleUnicodeChar( uni_char, FALSE ) )
2231 { 2541 {
2232 return TRUE; 2542 return TRUE;
2233 } 2543 }
@@ -2263,13 +2573,13 @@ void LLViewerWindow::handleScrollWheel(S32 clicks)
2263 return; 2573 return;
2264 } 2574 }
2265 2575
2266 LLView* top_view = gFocusMgr.getTopView(); 2576 LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
2267 if (top_view) 2577 if (top_ctrl)
2268 { 2578 {
2269 S32 local_x; 2579 S32 local_x;
2270 S32 local_y; 2580 S32 local_y;
2271 top_view->screenPointToLocal( mCurrentMousePoint.mX, mCurrentMousePoint.mY, &local_x, &local_y ); 2581 top_ctrl->screenPointToLocal( mCurrentMousePoint.mX, mCurrentMousePoint.mY, &local_x, &local_y );
2272 if (top_view->handleScrollWheel(local_x, local_y, clicks)) return; 2582 if (top_ctrl->handleScrollWheel(local_x, local_y, clicks)) return;
2273 } 2583 }
2274 2584
2275 if (mRootView->handleScrollWheel(mCurrentMousePoint.mX, mCurrentMousePoint.mY, clicks) ) 2585 if (mRootView->handleScrollWheel(mCurrentMousePoint.mX, mCurrentMousePoint.mY, clicks) )
@@ -2415,8 +2725,8 @@ BOOL LLViewerWindow::handlePerFrameHover()
2415 2725
2416 BOOL handled = FALSE; 2726 BOOL handled = FALSE;
2417 2727
2418 BOOL handled_by_top_view = FALSE; 2728 BOOL handled_by_top_ctrl = FALSE;
2419 LLView* top_view = gFocusMgr.getTopView(); 2729 LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
2420 2730
2421 LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); 2731 LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
2422 if( mouse_captor ) 2732 if( mouse_captor )
@@ -2438,12 +2748,12 @@ BOOL LLViewerWindow::handlePerFrameHover()
2438 } 2748 }
2439 else 2749 else
2440 { 2750 {
2441 if (top_view) 2751 if (top_ctrl)
2442 { 2752 {
2443 S32 local_x, local_y; 2753 S32 local_x, local_y;
2444 top_view->screenPointToLocal( x, y, &local_x, &local_y ); 2754 top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
2445 handled = top_view->pointInView(local_x, local_y) && top_view->handleHover(local_x, local_y, mask); 2755 handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleHover(local_x, local_y, mask);
2446 handled_by_top_view = TRUE; 2756 handled_by_top_ctrl = TRUE;
2447 } 2757 }
2448 2758
2449 if ( !handled ) 2759 if ( !handled )
@@ -2530,11 +2840,11 @@ BOOL LLViewerWindow::handlePerFrameHover()
2530 mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); 2840 mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
2531 tool_tip_handled = mouse_captor->handleToolTip( local_x, local_y, tool_tip_msg, &screen_sticky_rect ); 2841 tool_tip_handled = mouse_captor->handleToolTip( local_x, local_y, tool_tip_msg, &screen_sticky_rect );
2532 } 2842 }
2533 else if (handled_by_top_view) 2843 else if (handled_by_top_ctrl)
2534 { 2844 {
2535 S32 local_x, local_y; 2845 S32 local_x, local_y;
2536 top_view->screenPointToLocal( x, y, &local_x, &local_y ); 2846 top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
2537 tool_tip_handled = top_view->handleToolTip( local_x, local_y, tool_tip_msg, &screen_sticky_rect ); 2847 tool_tip_handled = top_ctrl->handleToolTip( local_x, local_y, tool_tip_msg, &screen_sticky_rect );
2538 } 2848 }
2539 else 2849 else
2540 { 2850 {
@@ -3026,7 +3336,7 @@ void LLViewerWindow::hitObjectOrLandGlobalAsync(S32 x, S32 y_from_bot, MASK mask
3026 glViewport(scaled_x - (PICK_HALF_WIDTH + 2), scaled_y - (PICK_HALF_WIDTH + 2), PICK_DIAMETER + 4, PICK_DIAMETER + 4); 3336 glViewport(scaled_x - (PICK_HALF_WIDTH + 2), scaled_y - (PICK_HALF_WIDTH + 2), PICK_DIAMETER + 4, PICK_DIAMETER + 4);
3027 stop_glerror(); 3337 stop_glerror();
3028 3338
3029 glClearColor(0.f, 0.f, 0.f, 1.f); 3339 glClearColor(0.f, 0.f, 0.f, 0.f);
3030 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 3340 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
3031 3341
3032 // Draw the objects so the user can select them. 3342 // Draw the objects so the user can select them.
@@ -3117,7 +3427,7 @@ void LLViewerWindow::hitUIElementAsync(S32 x, S32 y_from_bot, MASK mask, void (*
3117 glViewport(x - (PICK_HALF_WIDTH + 2), y_from_bot - (PICK_HALF_WIDTH + 2), PICK_DIAMETER + 4, PICK_DIAMETER + 4); 3427 glViewport(x - (PICK_HALF_WIDTH + 2), y_from_bot - (PICK_HALF_WIDTH + 2), PICK_DIAMETER + 4, PICK_DIAMETER + 4);
3118 stop_glerror(); 3428 stop_glerror();
3119 3429
3120 glClearColor(0.f, 0.f, 0.f, 1.f); 3430 glClearColor(0.f, 0.f, 0.f, 0.f);
3121 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); 3431 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
3122 3432
3123 // Draw the objects so the user can select them. 3433 // Draw the objects so the user can select them.
@@ -3993,7 +4303,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
3993 gDisplaySwapBuffers = FALSE; 4303 gDisplaySwapBuffers = FALSE;
3994 if (type == SNAPSHOT_TYPE_OBJECT_ID) 4304 if (type == SNAPSHOT_TYPE_OBJECT_ID)
3995 { 4305 {
3996 glClearColor(0.f, 0.f, 0.f, 1.f); 4306 glClearColor(0.f, 0.f, 0.f, 0.f);
3997 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 4307 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
3998 4308
3999 gCamera->setZoomParameters(scale_factor, subimage_x+(subimage_y*llceil(scale_factor))); 4309 gCamera->setZoomParameters(scale_factor, subimage_x+(subimage_y*llceil(scale_factor)));
@@ -4174,9 +4484,9 @@ BOOL LLViewerWindow::childHasKeyboardFocus(const LLView* parent) const
4174 return gFocusMgr.childHasKeyboardFocus( parent ); 4484 return gFocusMgr.childHasKeyboardFocus( parent );
4175} 4485}
4176 4486
4177void LLViewerWindow::setMouseCapture(LLMouseHandler* new_captor,void (*on_capture_lost)(LLMouseHandler* old_captor)) 4487void LLViewerWindow::setMouseCapture(LLMouseHandler* new_captor)
4178{ 4488{
4179 gFocusMgr.setMouseCapture( new_captor, on_capture_lost ); 4489 gFocusMgr.setMouseCapture( new_captor );
4180} 4490}
4181 4491
4182LLMouseHandler* LLViewerWindow::getMouseCaptor() const 4492LLMouseHandler* LLViewerWindow::getMouseCaptor() const
@@ -4184,11 +4494,6 @@ LLMouseHandler* LLViewerWindow::getMouseCaptor() const
4184 return gFocusMgr.getMouseCapture(); 4494 return gFocusMgr.getMouseCapture();
4185} 4495}
4186 4496
4187BOOL LLViewerWindow::hasMouseCapture(const LLMouseHandler* possible_captor) const
4188{
4189 return possible_captor == gFocusMgr.getMouseCapture();
4190}
4191
4192S32 LLViewerWindow::getWindowHeight() const 4497S32 LLViewerWindow::getWindowHeight() const
4193{ 4498{
4194 return mVirtualWindowRect.getHeight(); 4499 return mVirtualWindowRect.getHeight();
@@ -4209,19 +4514,19 @@ S32 LLViewerWindow::getWindowDisplayWidth() const
4209 return mWindowRect.getWidth(); 4514 return mWindowRect.getWidth();
4210} 4515}
4211 4516
4212LLView* LLViewerWindow::getTopView() const 4517LLUICtrl* LLViewerWindow::getTopCtrl() const
4213{ 4518{
4214 return gFocusMgr.getTopView(); 4519 return gFocusMgr.getTopCtrl();
4215} 4520}
4216 4521
4217BOOL LLViewerWindow::hasTopView(LLView* view) const 4522BOOL LLViewerWindow::hasTopCtrl(LLView* view) const
4218{ 4523{
4219 return view == gFocusMgr.getTopView(); 4524 return view == gFocusMgr.getTopCtrl();
4220} 4525}
4221 4526
4222void LLViewerWindow::setTopView(LLView* new_top,void (*on_top_lost)(LLView* old_top)) 4527void LLViewerWindow::setTopCtrl(LLUICtrl* new_top)
4223{ 4528{
4224 gFocusMgr.setTopView( new_top, on_top_lost ); 4529 gFocusMgr.setTopCtrl( new_top );
4225} 4530}
4226 4531
4227void LLViewerWindow::setupViewport(S32 x_offset, S32 y_offset) 4532void LLViewerWindow::setupViewport(S32 x_offset, S32 y_offset)
@@ -4829,6 +5134,8 @@ LLAlertDialog* LLViewerWindow::alertXmlEditText(const std::string& xml_filename,
4829 return alert; 5134 return alert;
4830} 5135}
4831 5136
5137////////////////////////////////////////////////////////////////////////////
5138
4832LLBottomPanel::LLBottomPanel(const LLString &name, const LLRect &rect) : 5139LLBottomPanel::LLBottomPanel(const LLString &name, const LLRect &rect) :
4833 LLPanel(name, rect, FALSE), 5140 LLPanel(name, rect, FALSE),
4834 mIndicator(NULL) 5141 mIndicator(NULL)