From d0cda13235079c6626ebc7bbe4de542784d50fa0 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 11 Oct 2011 22:49:00 -0700 Subject: EXP-1275 FIX A UI element or Keyboard shortcut to clear the viewport Ctrl+Shift+U now toggles UI and hides floaters refactored main_view.xml made all members of llviewerwindow private --- indra/llui/llmenugl.cpp | 2 +- indra/newview/llappviewer.cpp | 20 +-- indra/newview/lldirpicker.cpp | 4 +- indra/newview/llfilepicker.cpp | 20 +-- indra/newview/llinventorybridge.cpp | 2 +- indra/newview/lllandmarkactions.cpp | 2 +- indra/newview/lltoolbarview.cpp | 7 + indra/newview/lltoolbarview.h | 2 + indra/newview/lltoolgun.cpp | 4 +- indra/newview/llviewerdisplay.cpp | 14 +- indra/newview/llviewermenu.cpp | 16 +- indra/newview/llviewerwindow.cpp | 42 +++-- indra/newview/llviewerwindow.h | 13 +- indra/newview/skins/default/xui/en/main_view.xml | 173 +++++++-------------- indra/newview/skins/default/xui/en/menu_viewer.xml | 7 + 15 files changed, 160 insertions(+), 168 deletions(-) (limited to 'indra') diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index badba7a416..3ef8d8ff35 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -1731,7 +1731,7 @@ void LLMenuGL::setCanTearOff(BOOL tear_off) { LLMenuItemTearOffGL::Params p; mTearOffItem = LLUICtrlFactory::create(p); - addChildInBack(mTearOffItem); + addChild(mTearOffItem); } else if (!tear_off && mTearOffItem != NULL) { diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 5077a0a596..4d02093d2e 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1217,7 +1217,7 @@ bool LLAppViewer::mainLoop() if (gViewerWindow) { LLFastTimer t2(FTM_MESSAGES); - gViewerWindow->mWindow->processMiscNativeEvents(); + gViewerWindow->getWindow()->processMiscNativeEvents(); } pingMainloopTimeout("Main:GatherInput"); @@ -1230,7 +1230,7 @@ bool LLAppViewer::mainLoop() llwarns << " Someone took over my signal/exception handler (post messagehandling)!" << llendl; } - gViewerWindow->mWindow->gatherInput(); + gViewerWindow->getWindow()->gatherInput(); } #if 1 && !LL_RELEASE_FOR_DOWNLOAD @@ -1259,9 +1259,9 @@ bool LLAppViewer::mainLoop() // Scan keyboard for movement keys. Command keys and typing // are handled by windows callbacks. Don't do this until we're // done initializing. JC - if ((gHeadlessClient || gViewerWindow->mWindow->getVisible()) + if ((gHeadlessClient || gViewerWindow->getWindow()->getVisible()) && gViewerWindow->getActive() - && !gViewerWindow->mWindow->getMinimized() + && !gViewerWindow->getWindow()->getMinimized() && LLStartUp::getStartupState() == STATE_STARTED && (gHeadlessClient || !gViewerWindow->getShowProgress()) && !gFocusMgr.focusLocked()) @@ -1340,7 +1340,7 @@ bool LLAppViewer::mainLoop() } // yield cooperatively when not running as foreground window - if ( (gViewerWindow && !gViewerWindow->mWindow->getVisible()) + if ( (gViewerWindow && !gViewerWindow->getWindow()->getVisible()) || !gFocusMgr.getAppHasFocus()) { // Sleep if we're not rendering, or the window is minimized. @@ -2920,7 +2920,7 @@ bool LLAppViewer::initWindow() if (gSavedSettings.getBOOL("WindowMaximized")) { - gViewerWindow->mWindow->maximize(); + gViewerWindow->getWindow()->maximize(); } // @@ -2963,7 +2963,7 @@ bool LLAppViewer::initWindow() if (gSavedSettings.getBOOL("WindowMaximized")) { - gViewerWindow->mWindow->maximize(); + gViewerWindow->getWindow()->maximize(); } LLUI::sWindow = gViewerWindow->getWindow(); @@ -2975,7 +2975,7 @@ bool LLAppViewer::initWindow() gViewerWindow->initBase(); // show viewer window - //gViewerWindow->mWindow->show(); + //gViewerWindow->getWindow()->show(); LL_INFOS("AppInit") << "Window initialization done." << LL_ENDL; return true; @@ -3009,12 +3009,12 @@ void LLAppViewer::cleanupSavedSettings() // as we don't track it in callbacks if(NULL != gViewerWindow) { - BOOL maximized = gViewerWindow->mWindow->getMaximized(); + BOOL maximized = gViewerWindow->getWindow()->getMaximized(); if (!maximized) { LLCoordScreen window_pos; - if (gViewerWindow->mWindow->getPosition(&window_pos)) + if (gViewerWindow->getWindow()->getPosition(&window_pos)) { gSavedSettings.setS32("WindowX", window_pos.mX); gSavedSettings.setS32("WindowY", window_pos.mY); diff --git a/indra/newview/lldirpicker.cpp b/indra/newview/lldirpicker.cpp index dd243397a1..1e03582a29 100644 --- a/indra/newview/lldirpicker.cpp +++ b/indra/newview/lldirpicker.cpp @@ -217,12 +217,12 @@ OSStatus LLDirPicker::doNavChooseDialog() error = NavCreateChooseFolderDialog(&mNavOptions, &doNavCallbackEvent, NULL, NULL, &navRef); - gViewerWindow->mWindow->beforeDialog(); + gViewerWindow->getWindow()->beforeDialog(); if (error == noErr) error = NavDialogRun(navRef); - gViewerWindow->mWindow->afterDialog(); + gViewerWindow->getWindow()->afterDialog(); if (error == noErr) error = NavDialogGetReply(navRef, &navReply); diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index 8c0ed29855..4897cf1885 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -653,12 +653,12 @@ OSStatus LLFilePicker::doNavChooseDialog(ELoadFilter filter) // (It is destroyed by NavDialogDispose() below.) error = NavCreateChooseFileDialog(&mNavOptions, NULL, NULL, NULL, navOpenFilterProc, (void*)(&filter), &navRef); - gViewerWindow->mWindow->beforeDialog(); + gViewerWindow->getWindow()->beforeDialog(); if (error == noErr) error = NavDialogRun(navRef); - gViewerWindow->mWindow->afterDialog(); + gViewerWindow->getWindow()->afterDialog(); if (error == noErr) error = NavDialogGetReply(navRef, &navReply); @@ -808,13 +808,13 @@ OSStatus LLFilePicker::doNavSaveDialog(ESaveFilter filter, const std::string& fi } } - gViewerWindow->mWindow->beforeDialog(); + gViewerWindow->getWindow()->beforeDialog(); // Run the dialog if (error == noErr) error = NavDialogRun(navRef); - gViewerWindow->mWindow->afterDialog(); + gViewerWindow->getWindow()->afterDialog(); if (error == noErr) error = NavDialogGetReply(navRef, &navReply); @@ -1204,7 +1204,7 @@ BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename return FALSE; } - gViewerWindow->mWindow->beforeDialog(); + gViewerWindow->getWindow()->beforeDialog(); reset(); @@ -1284,7 +1284,7 @@ BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename rtn = (getFileCount() == 1); } - gViewerWindow->mWindow->afterDialog(); + gViewerWindow->getWindow()->afterDialog(); return rtn; } @@ -1299,7 +1299,7 @@ BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking ) return FALSE; } - gViewerWindow->mWindow->beforeDialog(); + gViewerWindow->getWindow()->beforeDialog(); reset(); @@ -1337,7 +1337,7 @@ BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking ) rtn = (getFileCount() == 1); } - gViewerWindow->mWindow->afterDialog(); + gViewerWindow->getWindow()->afterDialog(); return rtn; } @@ -1352,7 +1352,7 @@ BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter ) return FALSE; } - gViewerWindow->mWindow->beforeDialog(); + gViewerWindow->getWindow()->beforeDialog(); reset(); @@ -1370,7 +1370,7 @@ BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter ) rtn = !mFiles.empty(); } - gViewerWindow->mWindow->afterDialog(); + gViewerWindow->getWindow()->afterDialog(); return rtn; } diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 2066cbc6b2..9fe73fc940 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1185,7 +1185,7 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) std::string buffer; asset_id.toString(buffer); - gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(buffer)); + gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(buffer)); return; } else if ("copy" == action) diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp index f2aec20611..6625a194fb 100644 --- a/indra/newview/lllandmarkactions.cpp +++ b/indra/newview/lllandmarkactions.cpp @@ -413,7 +413,7 @@ void LLLandmarkActions::copySLURLtoClipboard(const LLUUID& landmarkInventoryItem void copy_slurl_to_clipboard_callback(const std::string& slurl) { - gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(slurl)); + gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(slurl)); LLSD args; args["SLURL"] = slurl; LLNotificationsUtil::add("CopySLURL", args); diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 7977faeab7..7273574203 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -456,3 +456,10 @@ void LLToolBarView::onEndDrag() } stopDragTool(); } + +void LLToolBarView::setToolBarsVisible(bool visible) +{ + mToolbarBottom->getParent()->setVisible(visible); + mToolbarLeft->getParent()->setVisible(visible); + mToolbarRight->getParent()->setVisible(visible); +} diff --git a/indra/newview/lltoolbarview.h b/indra/newview/lltoolbarview.h index 6623e63f8a..01ff137c15 100644 --- a/indra/newview/lltoolbarview.h +++ b/indra/newview/lltoolbarview.h @@ -72,6 +72,8 @@ public: // Loads the toolbars from the existing user or default settings bool loadToolbars(bool force_default = false); // return false if load fails + void setToolBarsVisible(bool visible); + static bool loadDefaultToolbars(); static void startDragTool( S32 x, S32 y, const LLUUID& uuid); diff --git a/indra/newview/lltoolgun.cpp b/indra/newview/lltoolgun.cpp index 68af3d73d2..857d105361 100644 --- a/indra/newview/lltoolgun.cpp +++ b/indra/newview/lltoolgun.cpp @@ -56,7 +56,7 @@ void LLToolGun::handleSelect() { gViewerWindow->hideCursor(); gViewerWindow->moveCursorToCenter(); - gViewerWindow->mWindow->setMouseClipping(TRUE); + gViewerWindow->getWindow()->setMouseClipping(TRUE); mIsSelected = TRUE; } @@ -64,7 +64,7 @@ void LLToolGun::handleDeselect() { gViewerWindow->moveCursorToCenter(); gViewerWindow->showCursor(); - gViewerWindow->mWindow->setMouseClipping(FALSE); + gViewerWindow->getWindow()->setMouseClipping(FALSE); mIsSelected = FALSE; } diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 19326c4e30..d6512207ae 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -114,8 +114,8 @@ void render_disconnected_background(); void display_startup() { if ( !gViewerWindow->getActive() - || !gViewerWindow->mWindow->getVisible() - || gViewerWindow->mWindow->getMinimized() ) + || !gViewerWindow->getWindow()->getVisible() + || gViewerWindow->getWindow()->getMinimized() ) { return; } @@ -157,7 +157,7 @@ void display_startup() LLGLState::checkStates(); LLGLState::checkTextureChannels(); - gViewerWindow->mWindow->swapBuffers(); + gViewerWindow->getWindow()->swapBuffers(); glClear(GL_DEPTH_BUFFER_BIT); } @@ -223,7 +223,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) { //skip render on frames where window has been resized gGL.flush(); glClear(GL_COLOR_BUFFER_BIT); - gViewerWindow->mWindow->swapBuffers(); + gViewerWindow->getWindow()->swapBuffers(); gPipeline.resizeScreenTexture(); gResizeScreenTexture = FALSE; gWindowResized = FALSE; @@ -260,8 +260,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // In fact, must explicitly check the minimized state before drawing. // Attempting to draw into a minimized window causes a GL error. JC if ( !gViewerWindow->getActive() - || !gViewerWindow->mWindow->getVisible() - || gViewerWindow->mWindow->getMinimized() ) + || !gViewerWindow->getWindow()->getVisible() + || gViewerWindow->getWindow()->getMinimized() ) { // Clean up memory the pools may have allocated if (rebuild) @@ -1237,7 +1237,7 @@ void render_ui(F32 zoom_factor, int subfield) if (gDisplaySwapBuffers) { LLFastTimer t(FTM_SWAP); - gViewerWindow->mWindow->swapBuffers(); + gViewerWindow->getWindow()->swapBuffers(); } gDisplaySwapBuffers = TRUE; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index bc0f38dd77..da1b149b59 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -446,11 +446,13 @@ void init_menus() { color = LLUIColorTable::instance().getColor( "MenuNonProductionBgColor" ); } + + LLView* menu_bar_holder = gViewerWindow->getRootView()->getChildView("menu_bar_holder"); + gMenuBarView = LLUICtrlFactory::getInstance()->createFromFile("menu_viewer.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - gMenuBarView->setRect(LLRect(0, top, 0, top - MENU_BAR_HEIGHT)); + gMenuBarView->setRect(LLRect(0, menu_bar_holder->getRect().mTop, 0, menu_bar_holder->getRect().mTop - MENU_BAR_HEIGHT)); gMenuBarView->setBackgroundColor( color ); - LLView* menu_bar_holder = gViewerWindow->getRootView()->getChildView("menu_bar_holder"); menu_bar_holder->addChild(gMenuBarView); gViewerWindow->setMenuBackgroundColor(false, @@ -3762,6 +3764,15 @@ class LLViewDefaultUISize : public view_listener_t } }; +class LLViewToggleUI : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + gViewerWindow->setUIVisibility(!gViewerWindow->getUIVisibility()); + return true; + } +}; + class LLEditDuplicate : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -7926,6 +7937,7 @@ void initialize_menus() view_listener_t::addMenu(new LLZoomer(1/1.2f), "View.ZoomIn"); view_listener_t::addMenu(new LLZoomer(DEFAULT_FIELD_OF_VIEW, false), "View.ZoomDefault"); view_listener_t::addMenu(new LLViewDefaultUISize(), "View.DefaultUISize"); + view_listener_t::addMenu(new LLViewToggleUI(), "View.ToggleUI"); view_listener_t::addMenu(new LLViewEnableMouselook(), "View.EnableMouselook"); view_listener_t::addMenu(new LLViewEnableJoystickFlycam(), "View.EnableJoystickFlycam"); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index fae3ee9081..2473d41a35 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -76,7 +76,6 @@ #include "lltimer.h" #include "timing.h" #include "llviewermenu.h" -#include "lltoolbarview.h" #include "lltooltip.h" #include "llmediaentry.h" #include "llurldispatcher.h" @@ -147,6 +146,7 @@ #include "lltexturefetch.h" #include "lltextureview.h" #include "lltool.h" +#include "lltoolbarview.h" #include "lltoolcomp.h" #include "lltooldraganddrop.h" #include "lltoolface.h" @@ -1339,7 +1339,7 @@ BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated) { if (activated) { - mActive = TRUE; + mActive = true; send_agent_resume(); gAgent.clearAFK(); @@ -1348,7 +1348,7 @@ BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated) } else { - mActive = FALSE; + mActive = false; // if the user has chosen to go Away automatically after some time, then go Away when minimizing if (gSavedSettings.getS32("AFKTimeout")) @@ -1531,7 +1531,8 @@ LLViewerWindow::LLViewerWindow( BOOL fullscreen, BOOL ignore_pixel_depth) // fullscreen is no longer used : mWindow(NULL), - mActive(TRUE), + mActive(true), + mUIVisible(true), mWindowRectRaw(0, height, width, 0), mWindowRectScaled(0, height, width, 0), mWorldViewRectRaw(0, height, width, 0), @@ -1771,7 +1772,6 @@ void LLViewerWindow::initBase() // placeholder widget that controls where "world" is rendered mWorldViewPlaceholder = main_view->getChildView("world_view_rect")->getHandle(); - mFloaterViewHolder = main_view->getChildView("floater_view_holder")->getHandle(); mPopupView = main_view->getChild("popup_holder"); mHintHolder = main_view->getChild("hint_holder")->getHandle(); mLoginPanelHolder = main_view->getChild("login_panel_holder")->getHandle(); @@ -1882,7 +1882,7 @@ void LLViewerWindow::initWorldUI() gStatusBar->setShape(status_bar_container->getLocalRect()); // sync bg color with menu bar gStatusBar->setBackgroundColor( gMenuBarView->getBackgroundColor().get() ); - status_bar_container->addChild(gStatusBar); + status_bar_container->addChildInBack(gStatusBar); status_bar_container->setVisible(TRUE); // Navigation bar @@ -1922,8 +1922,7 @@ void LLViewerWindow::initWorldUI() hud_rect.mTop -= gMenuBarView->getRect().getHeight(); } gHUDView = new LLHUDView(hud_rect); - // put behind everything else in the UI - getRootView()->addChildInBack(gHUDView); + getRootView()->addChild(gHUDView); } LLPanel* panel_ssf_container = getRootView()->getChild("stand_stop_flying_container"); @@ -4084,7 +4083,7 @@ static S32 BORDERWIDTH = 0; void LLViewerWindow::movieSize(S32 new_width, S32 new_height) { LLCoordScreen size; - gViewerWindow->mWindow->getSize(&size); + gViewerWindow->getWindow()->getSize(&size); if ( (size.mX != new_width + BORDERWIDTH) ||(size.mY != new_height + BORDERHEIGHT)) { @@ -4095,7 +4094,7 @@ void LLViewerWindow::movieSize(S32 new_width, S32 new_height) BORDERHEIGHT = size.mY- y; LLCoordScreen new_size(new_width + BORDERWIDTH, new_height + BORDERHEIGHT); - gViewerWindow->mWindow->setSize(new_size); + gViewerWindow->getWindow()->setSize(new_size); } } @@ -4979,6 +4978,29 @@ bool LLViewerWindow::onAlert(const LLSD& notify) return false; } +void LLViewerWindow::setUIVisibility(bool visible) +{ + mUIVisible = visible; + + if (gToolBarView) + { + gToolBarView->setToolBarsVisible(visible); + } + + mRootView->getChildView("nav_bar_container")->setVisible(visible); + mRootView->getChildView("status_bar_container")->setVisible(visible); + + if (!visible) + { + gFloaterView->closeAllChildren(false); + } +} + +bool LLViewerWindow::getUIVisibility() +{ + return mUIVisible; +} + //////////////////////////////////////////////////////////////////////////// // // LLPickInfo diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 872eb12753..3afca3073d 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -143,6 +143,8 @@ public: void adjustRectanglesForFirstUse(const LLRect& window); void adjustControlRectanglesForFirstUse(const LLRect& window); void initWorldUI(); + void setUIVisibility(bool); + bool getUIVisibility(); BOOL handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down); @@ -282,7 +284,6 @@ public: void updateKeyboardFocus(); void updateWorldViewRect(bool use_full_window=false); - LLView* getFloaterViewHolder() { return mFloaterViewHolder.get(); } LLView* getToolBarHolder() { return mToolBarHolder.get(); } LLView* getHintHolder() { return mHintHolder.get(); } LLView* getLoginPanelHolder() { return mLoginPanelHolder.get(); } @@ -394,11 +395,10 @@ private: S32 getChatConsoleBottomPad(); // Vertical padding for child console rect, varied by bottom clutter LLRect getChatConsoleRect(); // Get optimal cosole rect. -public: +private: LLWindow* mWindow; // graphical window object - -protected: - BOOL mActive; + bool mActive; + bool mUIVisible; LLRect mWindowRectRaw; // whole window, including UI LLRect mWindowRectScaled; // whole window, scaled by UI size @@ -444,7 +444,6 @@ protected: std::string mInitAlert; // Window / GL initialization requires an alert LLHandle mWorldViewPlaceholder; // widget that spans the portion of screen dedicated to rendering the 3d world - LLHandle mFloaterViewHolder; // container for floater_view LLHandle mToolBarHolder; // container for toolbars LLHandle mHintHolder; // container for hints LLHandle mLoginPanelHolder; // container for login panel @@ -458,13 +457,11 @@ protected: boost::scoped_ptr mViewerWindowListener; -protected: static std::string sSnapshotBaseName; static std::string sSnapshotDir; static std::string sMovieBaseName; -private: // Object temporarily hovered over while dragging LLPointer mDragHoveredObject; }; diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml index 96d070ae50..2c07e8e35f 100644 --- a/indra/newview/skins/default/xui/en/main_view.xml +++ b/indra/newview/skins/default/xui/en/main_view.xml @@ -8,98 +8,71 @@ tab_stop="false" name="main_view" width="1024"> + + top="0"> + + + - - + - - - - - - - - - - - + - + left="0" + follows="all" + height="500" + mouse_opaque="false" + name="login_panel_holder" + width="1024"/> - - - - + width="1024"/> - + follows="all" + layout="topleft" + height="500" + width="1024" + top="0" + left="0" + mouse_opaque="false" + tab_stop="false"/> - - - + + + +