diff options
author | Jacek Antonelli | 2009-04-30 13:04:20 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-04-30 13:07:16 -0500 |
commit | ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch) | |
tree | 8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/newview/llviewerwindow.cpp | |
parent | Second Life viewer sources 1.22.11 (diff) | |
download | meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2 meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz |
Second Life viewer sources 1.23.0-RC
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llviewerwindow.cpp | 275 |
1 files changed, 135 insertions, 140 deletions
diff --git a/linden/indra/newview/llviewerwindow.cpp b/linden/indra/newview/llviewerwindow.cpp index 1a9a208..def1ecc 100644 --- a/linden/indra/newview/llviewerwindow.cpp +++ b/linden/indra/newview/llviewerwindow.cpp | |||
@@ -17,7 +17,8 @@ | |||
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | 22 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -100,7 +101,6 @@ | |||
100 | #include "llfloatereditui.h" // HACK JAMESDEBUG for ui editor | 101 | #include "llfloatereditui.h" // HACK JAMESDEBUG for ui editor |
101 | #include "llfloaterland.h" | 102 | #include "llfloaterland.h" |
102 | #include "llfloaterinspect.h" | 103 | #include "llfloaterinspect.h" |
103 | #include "llfloatermap.h" | ||
104 | #include "llfloaternamedesc.h" | 104 | #include "llfloaternamedesc.h" |
105 | #include "llfloaterpreference.h" | 105 | #include "llfloaterpreference.h" |
106 | #include "llfloatersnapshot.h" | 106 | #include "llfloatersnapshot.h" |
@@ -183,6 +183,9 @@ | |||
183 | #include "llviewernetwork.h" | 183 | #include "llviewernetwork.h" |
184 | #include "llpostprocess.h" | 184 | #include "llpostprocess.h" |
185 | 185 | ||
186 | #include "llfloatertest.h" // HACK! | ||
187 | #include "llfloaternotificationsconsole.h" | ||
188 | |||
186 | #if LL_WINDOWS | 189 | #if LL_WINDOWS |
187 | #include <tchar.h> // For Unicode conversion methods | 190 | #include <tchar.h> // For Unicode conversion methods |
188 | #endif | 191 | #endif |
@@ -190,7 +193,7 @@ | |||
190 | // | 193 | // |
191 | // Globals | 194 | // Globals |
192 | // | 195 | // |
193 | void render_ui(); | 196 | void render_ui(F32 zoom_factor = 1.f, int subfield = 0); |
194 | LLBottomPanel* gBottomPanel = NULL; | 197 | LLBottomPanel* gBottomPanel = NULL; |
195 | 198 | ||
196 | extern BOOL gDebugClicks; | 199 | extern BOOL gDebugClicks; |
@@ -247,6 +250,7 @@ std::string LLViewerWindow::sMovieBaseName; | |||
247 | extern void toggle_debug_menus(void*); | 250 | extern void toggle_debug_menus(void*); |
248 | 251 | ||
249 | 252 | ||
253 | |||
250 | //////////////////////////////////////////////////////////////////////////// | 254 | //////////////////////////////////////////////////////////////////////////// |
251 | // | 255 | // |
252 | // LLDebugText | 256 | // LLDebugText |
@@ -442,7 +446,7 @@ public: | |||
442 | if (gPipeline.mBatchCount > 0) | 446 | if (gPipeline.mBatchCount > 0) |
443 | { | 447 | { |
444 | addText(xpos, ypos, llformat("Batch min/max/mean: %d/%d/%d", gPipeline.mMinBatchSize, gPipeline.mMaxBatchSize, | 448 | addText(xpos, ypos, llformat("Batch min/max/mean: %d/%d/%d", gPipeline.mMinBatchSize, gPipeline.mMaxBatchSize, |
445 | gPipeline.mMeanBatchSize)); | 449 | gPipeline.mTrianglesDrawn/gPipeline.mBatchCount)); |
446 | 450 | ||
447 | gPipeline.mMinBatchSize = gPipeline.mMaxBatchSize; | 451 | gPipeline.mMinBatchSize = gPipeline.mMaxBatchSize; |
448 | gPipeline.mMaxBatchSize = 0; | 452 | gPipeline.mMaxBatchSize = 0; |
@@ -459,9 +463,46 @@ public: | |||
459 | 463 | ||
460 | ypos += y_inc; | 464 | ypos += y_inc; |
461 | 465 | ||
466 | addText(xpos,ypos, llformat("%d Lights visible", LLPipeline::sVisibleLightCount)); | ||
467 | |||
468 | ypos += y_inc; | ||
469 | |||
462 | LLVertexBuffer::sBindCount = LLImageGL::sBindCount = | 470 | LLVertexBuffer::sBindCount = LLImageGL::sBindCount = |
463 | LLVertexBuffer::sSetCount = LLImageGL::sUniqueCount = | 471 | LLVertexBuffer::sSetCount = LLImageGL::sUniqueCount = |
464 | gPipeline.mNumVisibleNodes = 0; | 472 | gPipeline.mNumVisibleNodes = LLPipeline::sVisibleLightCount = 0; |
473 | } | ||
474 | if (gSavedSettings.getBOOL("DebugShowRenderMatrices")) | ||
475 | { | ||
476 | addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[12], gGLProjection[13], gGLProjection[14], gGLProjection[15])); | ||
477 | ypos += y_inc; | ||
478 | |||
479 | addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[8], gGLProjection[9], gGLProjection[10], gGLProjection[11])); | ||
480 | ypos += y_inc; | ||
481 | |||
482 | addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[4], gGLProjection[5], gGLProjection[6], gGLProjection[7])); | ||
483 | ypos += y_inc; | ||
484 | |||
485 | addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[0], gGLProjection[1], gGLProjection[2], gGLProjection[3])); | ||
486 | ypos += y_inc; | ||
487 | |||
488 | addText(xpos, ypos, "Projection Matrix"); | ||
489 | ypos += y_inc; | ||
490 | |||
491 | |||
492 | addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[12], gGLModelView[13], gGLModelView[14], gGLModelView[15])); | ||
493 | ypos += y_inc; | ||
494 | |||
495 | addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[8], gGLModelView[9], gGLModelView[10], gGLModelView[11])); | ||
496 | ypos += y_inc; | ||
497 | |||
498 | addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[4], gGLModelView[5], gGLModelView[6], gGLModelView[7])); | ||
499 | ypos += y_inc; | ||
500 | |||
501 | addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[0], gGLModelView[1], gGLModelView[2], gGLModelView[3])); | ||
502 | ypos += y_inc; | ||
503 | |||
504 | addText(xpos, ypos, "View Matrix"); | ||
505 | ypos += y_inc; | ||
465 | } | 506 | } |
466 | if (gSavedSettings.getBOOL("DebugShowColor")) | 507 | if (gSavedSettings.getBOOL("DebugShowColor")) |
467 | { | 508 | { |
@@ -514,7 +555,7 @@ public: | |||
514 | iter != mLineList.end(); ++iter) | 555 | iter != mLineList.end(); ++iter) |
515 | { | 556 | { |
516 | const Line& line = *iter; | 557 | const Line& line = *iter; |
517 | LLFontGL::sMonospace->renderUTF8(line.text, 0, (F32)line.x, (F32)line.y, mTextColor, | 558 | LLFontGL::getFontMonospace()->renderUTF8(line.text, 0, (F32)line.x, (F32)line.y, mTextColor, |
518 | LLFontGL::LEFT, LLFontGL::TOP, | 559 | LLFontGL::LEFT, LLFontGL::TOP, |
519 | LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE); | 560 | LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE); |
520 | } | 561 | } |
@@ -1342,8 +1383,9 @@ void LLViewerWindow::handleDataCopy(LLWindow *window, S32 data_type, void *data) | |||
1342 | case SLURL_MESSAGE_TYPE: | 1383 | case SLURL_MESSAGE_TYPE: |
1343 | // received URL | 1384 | // received URL |
1344 | std::string url = (const char*)data; | 1385 | std::string url = (const char*)data; |
1345 | const bool from_external_browser = true; | 1386 | LLWebBrowserCtrl* web = NULL; |
1346 | if (LLURLDispatcher::dispatch(url, from_external_browser)) | 1387 | const bool trusted_browser = false; |
1388 | if (LLURLDispatcher::dispatch(url, web, trusted_browser)) | ||
1347 | { | 1389 | { |
1348 | // bring window to foreground, as it has just been "launched" from a URL | 1390 | // bring window to foreground, as it has just been "launched" from a URL |
1349 | mWindow->bringToFront(); | 1391 | mWindow->bringToFront(); |
@@ -1421,6 +1463,12 @@ LLViewerWindow::LLViewerWindow( | |||
1421 | mIsFullscreenChecked(false), | 1463 | mIsFullscreenChecked(false), |
1422 | mCurrResolutionIndex(0) | 1464 | mCurrResolutionIndex(0) |
1423 | { | 1465 | { |
1466 | LLNotificationChannel::buildChannel("VW_alerts", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alert")); | ||
1467 | LLNotificationChannel::buildChannel("VW_alertmodal", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alertmodal")); | ||
1468 | |||
1469 | LLNotifications::instance().getChannel("VW_alerts")->connectChanged(&LLViewerWindow::onAlert); | ||
1470 | LLNotifications::instance().getChannel("VW_alertmodal")->connectChanged(&LLViewerWindow::onAlert); | ||
1471 | |||
1424 | // Default to application directory. | 1472 | // Default to application directory. |
1425 | LLViewerWindow::sSnapshotBaseName = "Snapshot"; | 1473 | LLViewerWindow::sSnapshotBaseName = "Snapshot"; |
1426 | LLViewerWindow::sMovieBaseName = "SLmovie"; | 1474 | LLViewerWindow::sMovieBaseName = "SLmovie"; |
@@ -1532,8 +1580,6 @@ LLViewerWindow::LLViewerWindow( | |||
1532 | // Can't have spaces in settings.ini strings, so use underscores instead and convert them. | 1580 | // Can't have spaces in settings.ini strings, so use underscores instead and convert them. |
1533 | LLStringUtil::replaceChar(mOverlayTitle, '_', ' '); | 1581 | LLStringUtil::replaceChar(mOverlayTitle, '_', ' '); |
1534 | 1582 | ||
1535 | LLAlertDialog::setDisplayCallback(alertCallback); // call this before calling any modal dialogs | ||
1536 | |||
1537 | // sync the keyboard's setting with the saved setting | 1583 | // sync the keyboard's setting with the saved setting |
1538 | gSavedSettings.getControl("NumpadControl")->firePropertyChanged(); | 1584 | gSavedSettings.getControl("NumpadControl")->firePropertyChanged(); |
1539 | 1585 | ||
@@ -1616,7 +1662,9 @@ void LLViewerWindow::initBase() | |||
1616 | gFloaterView->setVisible(TRUE); | 1662 | gFloaterView->setVisible(TRUE); |
1617 | 1663 | ||
1618 | gSnapshotFloaterView = new LLSnapshotFloaterView("Snapshot Floater View", full_window); | 1664 | gSnapshotFloaterView = new LLSnapshotFloaterView("Snapshot Floater View", full_window); |
1619 | gSnapshotFloaterView->setVisible(TRUE); | 1665 | // Snapshot floater must start invisible otherwise it eats all |
1666 | // the tooltips. JC | ||
1667 | gSnapshotFloaterView->setVisible(FALSE); | ||
1620 | 1668 | ||
1621 | // Console | 1669 | // Console |
1622 | llassert( !gConsole ); | 1670 | llassert( !gConsole ); |
@@ -1722,13 +1770,24 @@ void adjust_rect_top_right(const std::string& control, const LLRect& window) | |||
1722 | } | 1770 | } |
1723 | } | 1771 | } |
1724 | 1772 | ||
1773 | // *TODO: Adjust based on XUI XML | ||
1774 | const S32 TOOLBAR_HEIGHT = 64; | ||
1775 | |||
1776 | void adjust_rect_bottom_left(const std::string& control, const LLRect& window) | ||
1777 | { | ||
1778 | LLRect r = gSavedSettings.getRect(control); | ||
1779 | if (r.mLeft == 0 && r.mBottom == 0) | ||
1780 | { | ||
1781 | r.setOriginAndSize(0, TOOLBAR_HEIGHT, r.getWidth(), r.getHeight()); | ||
1782 | gSavedSettings.setRect(control, r); | ||
1783 | } | ||
1784 | } | ||
1785 | |||
1725 | void adjust_rect_bottom_center(const std::string& control, const LLRect& window) | 1786 | void adjust_rect_bottom_center(const std::string& control, const LLRect& window) |
1726 | { | 1787 | { |
1727 | LLRect r = gSavedSettings.getRect(control); | 1788 | LLRect r = gSavedSettings.getRect(control); |
1728 | if (r.mLeft == 0 && r.mBottom == 0) | 1789 | if (r.mLeft == 0 && r.mBottom == 0) |
1729 | { | 1790 | { |
1730 | // *TODO: Adjust based on XUI XML | ||
1731 | const S32 TOOLBAR_HEIGHT = 64; | ||
1732 | r.setOriginAndSize( | 1791 | r.setOriginAndSize( |
1733 | window.getWidth()/2 - r.getWidth()/2, | 1792 | window.getWidth()/2 - r.getWidth()/2, |
1734 | TOOLBAR_HEIGHT, | 1793 | TOOLBAR_HEIGHT, |
@@ -1787,6 +1846,23 @@ void LLViewerWindow::adjustRectanglesForFirstUse(const LLRect& window) | |||
1787 | 1846 | ||
1788 | adjust_rect_top_left("FloaterBuildOptionsRect", window); | 1847 | adjust_rect_top_left("FloaterBuildOptionsRect", window); |
1789 | 1848 | ||
1849 | adjust_rect_bottom_left("FloaterActiveSpeakersRect", window); | ||
1850 | |||
1851 | adjust_rect_bottom_left("FloaterBumpRect", window); | ||
1852 | |||
1853 | adjust_rect_bottom_left("FloaterRegionInfo", window); | ||
1854 | |||
1855 | adjust_rect_bottom_left("FloaterEnvRect", window); | ||
1856 | |||
1857 | adjust_rect_bottom_left("FloaterAdvancedSkyRect", window); | ||
1858 | |||
1859 | adjust_rect_bottom_left("FloaterAdvancedWaterRect", window); | ||
1860 | |||
1861 | adjust_rect_bottom_left("FloaterDayCycleRect", window); | ||
1862 | |||
1863 | adjust_rect_top_right("FloaterStatisticsRect", window); | ||
1864 | |||
1865 | |||
1790 | // bottom-right | 1866 | // bottom-right |
1791 | r = gSavedSettings.getRect("FloaterInventoryRect"); | 1867 | r = gSavedSettings.getRect("FloaterInventoryRect"); |
1792 | if (r.mLeft == 0 && r.mBottom == 0) | 1868 | if (r.mLeft == 0 && r.mBottom == 0) |
@@ -1840,16 +1916,6 @@ void LLViewerWindow::initWorldUI() | |||
1840 | gHoverView = new LLHoverView(std::string("gHoverView"), full_window); | 1916 | gHoverView = new LLHoverView(std::string("gHoverView"), full_window); |
1841 | gHoverView->setVisible(TRUE); | 1917 | gHoverView->setVisible(TRUE); |
1842 | mRootView->addChild(gHoverView); | 1918 | mRootView->addChild(gHoverView); |
1843 | |||
1844 | // | ||
1845 | // Map | ||
1846 | // | ||
1847 | // TODO: Move instance management into class | ||
1848 | gFloaterMap = new LLFloaterMap(std::string("Map")); | ||
1849 | gFloaterMap->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); | ||
1850 | |||
1851 | // keep onscreen | ||
1852 | gFloaterView->adjustToFitScreen(gFloaterMap, FALSE); | ||
1853 | 1919 | ||
1854 | gIMMgr = LLIMMgr::getInstance(); | 1920 | gIMMgr = LLIMMgr::getInstance(); |
1855 | 1921 | ||
@@ -1932,7 +1998,6 @@ void LLViewerWindow::shutdownViews() | |||
1932 | gFloaterView = NULL; | 1998 | gFloaterView = NULL; |
1933 | gMorphView = NULL; | 1999 | gMorphView = NULL; |
1934 | 2000 | ||
1935 | gFloaterMap = NULL; | ||
1936 | gHUDView = NULL; | 2001 | gHUDView = NULL; |
1937 | 2002 | ||
1938 | gNotifyBoxView = NULL; | 2003 | gNotifyBoxView = NULL; |
@@ -2148,7 +2213,7 @@ void LLViewerWindow::setNormalControlsVisible( BOOL visible ) | |||
2148 | 2213 | ||
2149 | void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid) | 2214 | void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid) |
2150 | { | 2215 | { |
2151 | LLStringUtil::format_map_t args; | 2216 | LLSD args; |
2152 | LLColor4 new_bg_color; | 2217 | LLColor4 new_bg_color; |
2153 | 2218 | ||
2154 | if(god_mode && LLViewerLogin::getInstance()->isInProductionGrid()) | 2219 | if(god_mode && LLViewerLogin::getInstance()->isInProductionGrid()) |
@@ -2201,12 +2266,6 @@ void LLViewerWindow::draw() | |||
2201 | stop_glerror(); | 2266 | stop_glerror(); |
2202 | 2267 | ||
2203 | LLUI::setLineWidth(1.f); | 2268 | LLUI::setLineWidth(1.f); |
2204 | //popup alerts from the UI | ||
2205 | LLAlertInfo alert; | ||
2206 | while (LLPanel::nextAlert(alert)) | ||
2207 | { | ||
2208 | alertXml(alert.mLabel, alert.mArgs); | ||
2209 | } | ||
2210 | 2269 | ||
2211 | LLUI::setLineWidth(1.f); | 2270 | LLUI::setLineWidth(1.f); |
2212 | // Reset any left-over transforms | 2271 | // Reset any left-over transforms |
@@ -2315,7 +2374,7 @@ void LLViewerWindow::draw() | |||
2315 | { | 2374 | { |
2316 | // Used for special titles such as "Second Life - Special E3 2003 Beta" | 2375 | // Used for special titles such as "Second Life - Special E3 2003 Beta" |
2317 | const S32 DIST_FROM_TOP = 20; | 2376 | const S32 DIST_FROM_TOP = 20; |
2318 | LLFontGL::sSansSerifBig->renderUTF8( | 2377 | LLFontGL::getFontSansSerifBig()->renderUTF8( |
2319 | mOverlayTitle, 0, | 2378 | mOverlayTitle, 0, |
2320 | llround( getWindowWidth() * 0.5f), | 2379 | llround( getWindowWidth() * 0.5f), |
2321 | getWindowHeight() - DIST_FROM_TOP, | 2380 | getWindowHeight() - DIST_FROM_TOP, |
@@ -2390,6 +2449,17 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) | |||
2390 | } | 2449 | } |
2391 | } | 2450 | } |
2392 | 2451 | ||
2452 | // Debugging view for unified notifications -- we need Ctrl+Shift+Alt to get it | ||
2453 | // since Ctrl+Shift maps to Nighttime under windlight. | ||
2454 | if ((MASK_SHIFT & mask) | ||
2455 | && (MASK_CONTROL & mask) | ||
2456 | && (MASK_ALT & mask) | ||
2457 | && ('N' == key || 'n' == key)) | ||
2458 | { | ||
2459 | LLFloaterNotificationConsole::showInstance(); | ||
2460 | return TRUE; | ||
2461 | } | ||
2462 | |||
2393 | // handle escape key | 2463 | // handle escape key |
2394 | //if (key == KEY_ESCAPE && mask == MASK_NONE) | 2464 | //if (key == KEY_ESCAPE && mask == MASK_NONE) |
2395 | //{ | 2465 | //{ |
@@ -3433,9 +3503,9 @@ void LLViewerWindow::schedulePick(LLPickInfo& pick_info) | |||
3433 | LLGLState scissor_state(GL_SCISSOR_TEST); | 3503 | LLGLState scissor_state(GL_SCISSOR_TEST); |
3434 | scissor_state.enable(); | 3504 | scissor_state.enable(); |
3435 | glScissor(pick_info.mScreenRegion.mLeft, pick_info.mScreenRegion.mBottom, pick_info.mScreenRegion.getWidth(), pick_info.mScreenRegion.getHeight()); | 3505 | glScissor(pick_info.mScreenRegion.mLeft, pick_info.mScreenRegion.mBottom, pick_info.mScreenRegion.getWidth(), pick_info.mScreenRegion.getHeight()); |
3436 | glClearColor(0.f, 0.f, 0.f, 0.f); | 3506 | glClearColor(0.f, 0.f, 0.f, 0.f); |
3437 | glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | 3507 | glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); |
3438 | //glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | 3508 | //glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); |
3439 | } | 3509 | } |
3440 | 3510 | ||
3441 | // build perspective transform and picking viewport | 3511 | // build perspective transform and picking viewport |
@@ -3988,6 +4058,10 @@ void LLViewerWindow::playSnapshotAnimAndSound() | |||
3988 | 4058 | ||
3989 | BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type) | 4059 | BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type) |
3990 | { | 4060 | { |
4061 | return rawSnapshot(raw, preview_width, preview_height, FALSE, FALSE, show_ui, do_rebuild, type); | ||
4062 | |||
4063 | // *TODO below code was broken in deferred pipeline | ||
4064 | /* | ||
3991 | if ((!raw) || preview_width < 10 || preview_height < 10) | 4065 | if ((!raw) || preview_width < 10 || preview_height < 10) |
3992 | { | 4066 | { |
3993 | return FALSE; | 4067 | return FALSE; |
@@ -4019,7 +4093,7 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p | |||
4019 | LLVOAvatar::updateFreezeCounter(1) ; //pause avatar updating for one frame | 4093 | LLVOAvatar::updateFreezeCounter(1) ; //pause avatar updating for one frame |
4020 | 4094 | ||
4021 | S32 w = preview_width ; | 4095 | S32 w = preview_width ; |
4022 | S32 h = preview_height ; | 4096 | S32 h = preview_height ; |
4023 | LLVector2 display_scale = mDisplayScale ; | 4097 | LLVector2 display_scale = mDisplayScale ; |
4024 | mDisplayScale.setVec((F32)w / mWindowRect.getWidth(), (F32)h / mWindowRect.getHeight()) ; | 4098 | mDisplayScale.setVec((F32)w / mWindowRect.getWidth(), (F32)h / mWindowRect.getHeight()) ; |
4025 | LLRect window_rect = mWindowRect; | 4099 | LLRect window_rect = mWindowRect; |
@@ -4058,7 +4132,7 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p | |||
4058 | gltype = GL_UNSIGNED_BYTE ; | 4132 | gltype = GL_UNSIGNED_BYTE ; |
4059 | } | 4133 | } |
4060 | 4134 | ||
4061 | raw->resize(w, h, glpixel_length); | 4135 | raw->resize(w, h, glpixel_length); |
4062 | glReadPixels(0, 0, w, h, glformat, gltype, raw->getData()); | 4136 | glReadPixels(0, 0, w, h, glformat, gltype, raw->getData()); |
4063 | 4137 | ||
4064 | if(SNAPSHOT_TYPE_DEPTH == type) | 4138 | if(SNAPSHOT_TYPE_DEPTH == type) |
@@ -4120,7 +4194,7 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p | |||
4120 | 4194 | ||
4121 | gSavedSettings.setS32("RenderName", render_name); | 4195 | gSavedSettings.setS32("RenderName", render_name); |
4122 | 4196 | ||
4123 | return TRUE; | 4197 | return TRUE;*/ |
4124 | } | 4198 | } |
4125 | 4199 | ||
4126 | // Saves the image from the screen to the specified filename and path. | 4200 | // Saves the image from the screen to the specified filename and path. |
@@ -4170,7 +4244,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei | |||
4170 | F32 ratio = llmin( (F32)window_width / image_width , (F32)window_height / image_height) ; | 4244 | F32 ratio = llmin( (F32)window_width / image_width , (F32)window_height / image_height) ; |
4171 | snapshot_width = (S32)(ratio * image_width) ; | 4245 | snapshot_width = (S32)(ratio * image_width) ; |
4172 | snapshot_height = (S32)(ratio * image_height) ; | 4246 | snapshot_height = (S32)(ratio * image_height) ; |
4173 | scale_factor = llmax(1.0f, 1.0f / ratio) ; | 4247 | scale_factor = llmax(1.0f, 1.0f / ratio) ; |
4174 | } | 4248 | } |
4175 | else //the scene(window) proportion needs to be maintained. | 4249 | else //the scene(window) proportion needs to be maintained. |
4176 | { | 4250 | { |
@@ -4187,7 +4261,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei | |||
4187 | 4261 | ||
4188 | snapshot_width = image_width; | 4262 | snapshot_width = image_width; |
4189 | snapshot_height = image_height; | 4263 | snapshot_height = image_height; |
4190 | target.allocate(snapshot_width, snapshot_height, GL_RGBA, TRUE, LLTexUnit::TT_RECT_TEXTURE, TRUE); | 4264 | target.allocate(snapshot_width, snapshot_height, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, TRUE); |
4191 | window_width = snapshot_width; | 4265 | window_width = snapshot_width; |
4192 | window_height = snapshot_height; | 4266 | window_height = snapshot_height; |
4193 | scale_factor = 1.f; | 4267 | scale_factor = 1.f; |
@@ -4264,9 +4338,10 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei | |||
4264 | } | 4338 | } |
4265 | else | 4339 | else |
4266 | { | 4340 | { |
4267 | display(do_rebuild, scale_factor, subimage_x+(subimage_y*llceil(scale_factor)), TRUE); | 4341 | const U32 subfield = subimage_x+(subimage_y*llceil(scale_factor)); |
4342 | display(do_rebuild, scale_factor, subfield, TRUE); | ||
4268 | // Required for showing the GUI in snapshots? See DEV-16350 for details. JC | 4343 | // Required for showing the GUI in snapshots? See DEV-16350 for details. JC |
4269 | render_ui(); | 4344 | render_ui(scale_factor, subfield); |
4270 | } | 4345 | } |
4271 | 4346 | ||
4272 | S32 subimage_x_offset = llclamp(buffer_x_offset - (subimage_x * window_width), 0, window_width); | 4347 | S32 subimage_x_offset = llclamp(buffer_x_offset - (subimage_x * window_width), 0, window_width); |
@@ -4563,7 +4638,7 @@ void LLViewerWindow::stopGL(BOOL save_state) | |||
4563 | gBumpImageList.destroyGL(); | 4638 | gBumpImageList.destroyGL(); |
4564 | stop_glerror(); | 4639 | stop_glerror(); |
4565 | 4640 | ||
4566 | LLFontGL::destroyGL(); | 4641 | LLFontGL::destroyAllGL(); |
4567 | stop_glerror(); | 4642 | stop_glerror(); |
4568 | 4643 | ||
4569 | LLVOAvatar::destroyGL(); | 4644 | LLVOAvatar::destroyGL(); |
@@ -4650,23 +4725,12 @@ void LLViewerWindow::restoreGL(const std::string& progress_message) | |||
4650 | 4725 | ||
4651 | void LLViewerWindow::initFonts(F32 zoom_factor) | 4726 | void LLViewerWindow::initFonts(F32 zoom_factor) |
4652 | { | 4727 | { |
4653 | LLFontGL::destroyGL(); | 4728 | LLFontGL::destroyAllGL(); |
4654 | LLFontGL::initDefaultFonts( gSavedSettings.getF32("FontScreenDPI"), | 4729 | LLFontGL::initDefaultFonts( gSavedSettings.getF32("FontScreenDPI"), |
4655 | mDisplayScale.mV[VX] * zoom_factor, | 4730 | mDisplayScale.mV[VX] * zoom_factor, |
4656 | mDisplayScale.mV[VY] * zoom_factor, | 4731 | mDisplayScale.mV[VY] * zoom_factor, |
4657 | gSavedSettings.getString("FontMonospace"), | 4732 | gDirUtilp->getAppRODataDir(), |
4658 | gSavedSettings.getF32("FontSizeMonospace"), | 4733 | LLUICtrlFactory::getXUIPaths()); |
4659 | gSavedSettings.getString("FontSansSerif"), | ||
4660 | gSavedSettings.getString("FontSansSerifFallback"), | ||
4661 | gSavedSettings.getF32("FontSansSerifFallbackScale"), | ||
4662 | gSavedSettings.getF32("FontSizeSmall"), | ||
4663 | gSavedSettings.getF32("FontSizeMedium"), | ||
4664 | gSavedSettings.getF32("FontSizeLarge"), | ||
4665 | gSavedSettings.getF32("FontSizeHuge"), | ||
4666 | gSavedSettings.getString("FontSansSerifBold"), | ||
4667 | gSavedSettings.getF32("FontSizeMedium"), | ||
4668 | gDirUtilp->getAppRODataDir() | ||
4669 | ); | ||
4670 | } | 4734 | } |
4671 | void LLViewerWindow::toggleFullscreen(BOOL show_progress) | 4735 | void LLViewerWindow::toggleFullscreen(BOOL show_progress) |
4672 | { | 4736 | { |
@@ -4737,8 +4801,6 @@ BOOL LLViewerWindow::checkSettings() | |||
4737 | } | 4801 | } |
4738 | 4802 | ||
4739 | mResDirty = false; | 4803 | mResDirty = false; |
4740 | // This will force a state update the next frame. | ||
4741 | mStatesDirty = true; | ||
4742 | } | 4804 | } |
4743 | 4805 | ||
4744 | BOOL is_fullscreen = mWindow->getFullscreen(); | 4806 | BOOL is_fullscreen = mWindow->getFullscreen(); |
@@ -4889,10 +4951,10 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, | |||
4889 | 4951 | ||
4890 | if (!result_first_try) | 4952 | if (!result_first_try) |
4891 | { | 4953 | { |
4892 | LLStringUtil::format_map_t args; | 4954 | LLSD args; |
4893 | args["[RESX]"] = llformat("%d",size.mX); | 4955 | args["RESX"] = llformat("%d",size.mX); |
4894 | args["[RESY]"] = llformat("%d",size.mY); | 4956 | args["RESY"] = llformat("%d",size.mY); |
4895 | alertXml("ResolutionSwitchFail", args); | 4957 | LLNotifications::instance().add("ResolutionSwitchFail", args); |
4896 | size = old_size; // for reshape below | 4958 | size = old_size; // for reshape below |
4897 | } | 4959 | } |
4898 | 4960 | ||
@@ -5007,72 +5069,18 @@ S32 LLViewerWindow::getChatConsoleBottomPad() | |||
5007 | 5069 | ||
5008 | //---------------------------------------------------------------------------- | 5070 | //---------------------------------------------------------------------------- |
5009 | 5071 | ||
5010 | // static | ||
5011 | bool LLViewerWindow::alertCallback(S32 modal) | ||
5012 | { | ||
5013 | if (gNoRender) | ||
5014 | { | ||
5015 | return false; | ||
5016 | } | ||
5017 | else | ||
5018 | { | ||
5019 | // if (modal) // we really always want to take you out of mouselook | ||
5020 | { | ||
5021 | // If we're in mouselook, the mouse is hidden and so the user can't click | ||
5022 | // the dialog buttons. In that case, change to First Person instead. | ||
5023 | if( gAgent.cameraMouselook() ) | ||
5024 | { | ||
5025 | gAgent.changeCameraToDefault(); | ||
5026 | } | ||
5027 | } | ||
5028 | return true; | ||
5029 | } | ||
5030 | } | ||
5031 | |||
5032 | LLAlertDialog* LLViewerWindow::alertXml(const std::string& xml_filename, | ||
5033 | LLAlertDialog::alert_callback_t callback, void* user_data) | ||
5034 | { | ||
5035 | LLStringUtil::format_map_t args; | ||
5036 | return alertXml( xml_filename, args, callback, user_data ); | ||
5037 | } | ||
5038 | 5072 | ||
5039 | LLAlertDialog* LLViewerWindow::alertXml(const std::string& xml_filename, const LLStringUtil::format_map_t& args, | 5073 | //static |
5040 | LLAlertDialog::alert_callback_t callback, void* user_data) | 5074 | bool LLViewerWindow::onAlert(const LLSD& notify) |
5041 | { | 5075 | { |
5042 | if (gNoRender) | 5076 | LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID()); |
5043 | { | ||
5044 | llinfos << "Alert: " << xml_filename << llendl; | ||
5045 | if (callback) | ||
5046 | { | ||
5047 | callback(-1, user_data); | ||
5048 | } | ||
5049 | return NULL; | ||
5050 | } | ||
5051 | |||
5052 | // If we're in mouselook, the mouse is hidden and so the user can't click | ||
5053 | // the dialog buttons. In that case, change to First Person instead. | ||
5054 | if( gAgent.cameraMouselook() ) | ||
5055 | { | ||
5056 | gAgent.changeCameraToDefault(); | ||
5057 | } | ||
5058 | |||
5059 | // Note: object adds, removes, and destroys itself. | ||
5060 | return LLAlertDialog::showXml( xml_filename, args, callback, user_data ); | ||
5061 | } | ||
5062 | 5077 | ||
5063 | LLAlertDialog* LLViewerWindow::alertXmlEditText(const std::string& xml_filename, const LLStringUtil::format_map_t& args, | ||
5064 | LLAlertDialog::alert_callback_t callback, void* user_data, | ||
5065 | LLAlertDialog::alert_text_callback_t text_callback, void *text_data, | ||
5066 | const LLStringUtil::format_map_t& edit_args, BOOL draw_asterixes) | ||
5067 | { | ||
5068 | if (gNoRender) | 5078 | if (gNoRender) |
5069 | { | 5079 | { |
5070 | llinfos << "Alert: " << xml_filename << llendl; | 5080 | llinfos << "Alert: " << notification->getName() << llendl; |
5071 | if (callback) | 5081 | notification->respond(LLSD::emptyMap()); |
5072 | { | 5082 | LLNotifications::instance().cancel(notification); |
5073 | callback(-1, user_data); | 5083 | return false; |
5074 | } | ||
5075 | return NULL; | ||
5076 | } | 5084 | } |
5077 | 5085 | ||
5078 | // If we're in mouselook, the mouse is hidden and so the user can't click | 5086 | // If we're in mouselook, the mouse is hidden and so the user can't click |
@@ -5081,20 +5089,7 @@ LLAlertDialog* LLViewerWindow::alertXmlEditText(const std::string& xml_filename, | |||
5081 | { | 5089 | { |
5082 | gAgent.changeCameraToDefault(); | 5090 | gAgent.changeCameraToDefault(); |
5083 | } | 5091 | } |
5084 | 5092 | return false; | |
5085 | // Note: object adds, removes, and destroys itself. | ||
5086 | LLAlertDialog* alert = LLAlertDialog::createXml( xml_filename, args, callback, user_data ); | ||
5087 | if (alert) | ||
5088 | { | ||
5089 | if (text_callback) | ||
5090 | { | ||
5091 | alert->setEditTextCallback(text_callback, text_data); | ||
5092 | } | ||
5093 | alert->setEditTextArgs(edit_args); | ||
5094 | alert->setDrawAsterixes(draw_asterixes); | ||
5095 | alert->show(); | ||
5096 | } | ||
5097 | return alert; | ||
5098 | } | 5093 | } |
5099 | 5094 | ||
5100 | //////////////////////////////////////////////////////////////////////////// | 5095 | //////////////////////////////////////////////////////////////////////////// |