From 9ca4b8219f1a18b11d457d6f18d3c695aba9aed2 Mon Sep 17 00:00:00 2001 From: Richard Nelson <richard@lindenlab.com> Date: Wed, 12 Oct 2011 15:46:45 -0700 Subject: [PATCH] EXP-1275 WIP A UI element or Keyboard shortcut to clear the viewport added confirmation dialog before hiding UI --- indra/llui/llfloater.cpp | 1 + indra/llui/llfloater.h | 3 +- indra/newview/llviewermenu.cpp | 30 ++++++++++++++++++- .../skins/default/xui/en/menu_viewer.xml | 14 ++++----- .../skins/default/xui/en/notifications.xml | 14 +++++++++ 5 files changed, 53 insertions(+), 9 deletions(-) diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 4bcc7c6fe0d..16fe3b8ca68 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -247,6 +247,7 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p) mHeaderHeight(p.header_height), mLegacyHeaderHeight(p.legacy_header_height), mMinimized(FALSE), + mVisibleWhenMinimized(TRUE), mForeground(FALSE), mFirstLook(TRUE), mButtonScale(1.0f), diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 275b508f799..c94aa0207ea 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -212,7 +212,7 @@ class LLFloater : public LLPanel void addDependentFloater(LLFloater* dependent, BOOL reposition = TRUE); void addDependentFloater(LLHandle<LLFloater> dependent_handle, BOOL reposition = TRUE); LLFloater* getDependee() { return (LLFloater*)mDependeeHandle.get(); } - void removeDependentFloater(LLFloater* dependent); + void removeDependentFloater(LLFloater* dependent); BOOL isMinimized() const { return mMinimized; } /// isShown() differs from getVisible() in that isShown() also considers /// isMinimized(). isShown() is true only if visible and not minimized. @@ -420,6 +420,7 @@ class LLFloater : public LLPanel S32 mLegacyHeaderHeight;// HACK see initFloaterXML() BOOL mMinimized; + bool mVisibleWhenMinimized; BOOL mForeground; LLHandle<LLFloater> mDependeeHandle; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 0cbbfae002f..478af6ab7dc 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -3766,9 +3766,37 @@ class LLViewToggleUI : public view_listener_t { bool handleEvent(const LLSD& userdata) { - gViewerWindow->setUIVisibility(!gViewerWindow->getUIVisibility()); + LLNotification::Params params("ConfirmHideUI"); + params.functor.function(boost::bind(&LLViewToggleUI::confirm, this, _1, _2)); + LLSD substitutions; +#if LL_DARWIN + substitutions["SHORTCUT"] = "Cmd+Shift+U"; +#else + substitutions["SHORTCUT"] = "Ctrl+Shift+U"; +#endif + params.substitutions = substitutions; + if (gViewerWindow->getUIVisibility()) + { + // hiding, so show notification + LLNotifications::instance().add(params); + } + else + { + LLNotifications::instance().forceResponse(params, 0); + } + return true; } + + void confirm(const LLSD& notification, const LLSD& response) + { + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + + if (option == 0) // OK + { + gViewerWindow->setUIVisibility(!gViewerWindow->getUIVisibility()); + } + } }; class LLEditDuplicate : public view_listener_t diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index fdbc3d18826..c586e3a098e 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -24,6 +24,13 @@ function="Floater.Toggle" parameter="toybox" /> </menu_item_call> + <menu_item_call + label="Hide all controls" + name="Hide UI" + shortcut="control|shift|U"> + <menu_item_call.on_click + function="View.ToggleUI" /> + </menu_item_call> <menu_item_call label="My Dashboard" name="Manage My Account"> @@ -1719,13 +1726,6 @@ <menu_item_call.on_click function="View.DefaultUISize" /> </menu_item_call> - <menu_item_call - label="Toggle UI" - name="Toggle UI" - shortcut="control|shift|U"> - <menu_item_call.on_click - function="View.ToggleUI" /> - </menu_item_call> <!-- This second, alternative shortcut for Show Advanced Menu is for backward compatibility. The main shortcut has been changed so it's Linux-friendly, where the old shortcut is typically eaten by the window manager. --> <menu_item_check label="Show Advanced Menu - legacy shortcut" diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 087744fea77..6b0ffd9d33c 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -7536,6 +7536,20 @@ The site at '<nolink>[HOST_NAME]</nolink>' in realm ' notext="Don't Quit"/> </notification> + <notification + name="ConfirmHideUI" + label="" + type="alertmodal"> + <unique/> + <tag>confirm</tag> + This action will hide all menu items and buttons. To get them back, click [SHORTCUT] again. + <usetemplate + name="okcancelignore" + yestext="OK" + notext="Cancel" + ignoretext="Confirm before hiding UI"/> + </notification> + <global name="UnsupportedGLRequirements"> You do not appear to have the proper hardware requirements for [APP_NAME]. [APP_NAME] requires an OpenGL graphics card that has multitexture support. If this is the case, you may want to make sure that you have the latest drivers for your graphics card, and service packs and patches for your operating system. -- GitLab