From d6c028213dfea9585b72bf8e93c80c6f273f1a3b Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Sat, 1 Jun 2024 13:00:02 -0400 Subject: [PATCH] Allow hiding navbar completely --- indra/newview/alviewermenu.cpp | 20 +++++++++ .../newview/app_settings/settings_alchemy.xml | 13 ++++++ indra/newview/llagent.cpp | 2 +- indra/newview/llviewercontrol.cpp | 42 ++++++++++++------- indra/newview/llviewerwindow.cpp | 26 +++++------- .../skins/default/xui/en/menu_hide_navbar.xml | 37 ++++++++++------ 6 files changed, 94 insertions(+), 46 deletions(-) diff --git a/indra/newview/alviewermenu.cpp b/indra/newview/alviewermenu.cpp index dfa9cc3e672..ed8a1d223a4 100644 --- a/indra/newview/alviewermenu.cpp +++ b/indra/newview/alviewermenu.cpp @@ -408,6 +408,23 @@ namespace // *TODO: We want to refresh their attachments too! } + class ALToggleLocationBar : public view_listener_t + { + bool handleEvent(const LLSD& userdata) override + { + const U32 val = userdata.asInteger(); + gSavedSettings.setU32("NavigationBarStyle", val); + return true; + } + }; + + class ALCheckLocationBar : public view_listener_t + { + bool handleEvent(const LLSD& userdata) override + { + return userdata.asInteger() == (S32)gSavedSettings.getU32("NavigationBarStyle"); + } + }; } //////////////////////////////////////////////////////// @@ -442,4 +459,7 @@ void ALViewerMenu::initialize_menus() commit.add("World.SyncAnimations", [](LLUICtrl* ctrl, const LLSD& param) { world_sync_animations(); }); commit.add("View.ToggleCinematicMode", [](LLUICtrl* ctrl, const LLSD& param) { toggle_cinematic_mode(); }); + + view_listener_t::addMenu(new ALToggleLocationBar(), "ToggleLocationBar"); + view_listener_t::addMenu(new ALCheckLocationBar(), "CheckLocationBar"); } diff --git a/indra/newview/app_settings/settings_alchemy.xml b/indra/newview/app_settings/settings_alchemy.xml index 55cc62da81b..797fd079f45 100644 --- a/indra/newview/app_settings/settings_alchemy.xml +++ b/indra/newview/app_settings/settings_alchemy.xml @@ -2042,5 +2042,18 @@ <key>Value</key> <integer>1</integer> </map> + <key>NavigationBarStyle</key> + <map> + <key>Comment</key> + <string> + 0 - none, 1 = mini, 2 = navigation + </string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>U32</string> + <key>Value</key> + <integer>2</integer> + </map> </map> </llsd> diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 4e0236b9e54..b0552fb6e2b 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -2443,7 +2443,7 @@ void LLAgent::endAnimationUpdateUI() gViewerWindow->showCursor(); // show menus gMenuBarView->setVisible(TRUE); - LLNavigationBar::getInstance()->setVisible(TRUE && gSavedSettings.getBOOL("ShowNavbarNavigationPanel")); + LLNavigationBar::getInstance()->setVisible(gSavedSettings.getU32("NavigationBarStyle") == 2); gStatusBar->setVisibleForMouselook(true); static LLCachedControl<bool> show_mini_location_panel(gSavedSettings, "ShowMiniLocationPanel"); diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index f2ec60955b2..eac6c4f2a99 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -600,25 +600,34 @@ bool toggle_agent_pause(const LLSD& newvalue) return true; } -bool toggle_show_navigation_panel(const LLSD& newvalue) +bool navigation_panel_change(const LLSD& newvalue) { - bool value = newvalue.asBoolean(); - - LLNavigationBar::getInstance()->setVisible(value); - gSavedSettings.setBOOL("ShowMiniLocationPanel", !value); + const U32 style = newvalue.asInteger(); + LLPanelTopInfoBar::getInstance()->setVisible(style == 1); + LLNavigationBar::getInstance()->setVisible(style == 2); gViewerWindow->reshapeStatusBarContainer(); return true; } -bool toggle_show_mini_location_panel(const LLSD& newvalue) -{ - bool value = newvalue.asBoolean(); - - LLPanelTopInfoBar::getInstance()->setVisible(value); - gSavedSettings.setBOOL("ShowNavbarNavigationPanel", !value); - - return true; -} +//bool toggle_show_navigation_panel(const LLSD& newvalue) +//{ +// bool value = newvalue.asBoolean(); +// +// LLNavigationBar::getInstance()->setVisible(value); +// gSavedSettings.setBOOL("ShowMiniLocationPanel", !value); +// gViewerWindow->reshapeStatusBarContainer(); +// return true; +//} +// +//bool toggle_show_mini_location_panel(const LLSD& newvalue) +//{ +// bool value = newvalue.asBoolean(); +// +// LLPanelTopInfoBar::getInstance()->setVisible(value); +// gSavedSettings.setBOOL("ShowNavbarNavigationPanel", !value); +// +// return true; +//} bool toggle_show_object_render_cost(const LLSD& newvalue) { @@ -908,8 +917,9 @@ void settings_setup_listeners() setting_setup_signal_listener(gSavedSettings, "QAMode", show_debug_menus); setting_setup_signal_listener(gSavedSettings, "UseDebugMenus", show_debug_menus); setting_setup_signal_listener(gSavedSettings, "AgentPause", toggle_agent_pause); - setting_setup_signal_listener(gSavedSettings, "ShowNavbarNavigationPanel", toggle_show_navigation_panel); - setting_setup_signal_listener(gSavedSettings, "ShowMiniLocationPanel", toggle_show_mini_location_panel); + setting_setup_signal_listener(gSavedSettings, "NavigationBarStyle", navigation_panel_change); + //setting_setup_signal_listener(gSavedSettings, "ShowNavbarNavigationPanel", toggle_show_navigation_panel); + //setting_setup_signal_listener(gSavedSettings, "ShowMiniLocationPanel", toggle_show_mini_location_panel); setting_setup_signal_listener(gSavedSettings, "ShowObjectRenderingCost", toggle_show_object_render_cost); setting_setup_signal_listener(gSavedSettings, "ForceShowGrid", handleForceShowGrid); setting_setup_signal_listener(gSavedSettings, "RenderTransparentWater", handleRenderTransparentWaterChanged); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 793db69bbf1..91ce6181aaf 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2483,8 +2483,8 @@ void LLViewerWindow::initWorldUI() mNavBarBarContainer->addChild(navbar); mNavBarBarContainer->setVisible(TRUE); - - if (!gSavedSettings.getBOOL("ShowNavbarNavigationPanel")) + const U32 location_bar = gSavedSettings.getU32("NavigationBarStyle"); + if (location_bar != 2) { navbar->setVisible(FALSE); } @@ -2493,7 +2493,6 @@ void LLViewerWindow::initWorldUI() reshapeStatusBarContainer(); } - // Top Info bar LLPanel* topinfo_bar_container = getRootView()->getChild<LLPanel>("topinfo_bar_container"); LLPanelTopInfoBar* topinfo_bar = LLPanelTopInfoBar::getInstance(); @@ -2829,7 +2828,7 @@ void LLViewerWindow::setNormalControlsVisible( BOOL visible ) { // when it's time to show navigation bar we need to ensure that the user wants to see it // i.e. ShowNavbarNavigationPanel option is true - navbarp->setVisible( visible && gSavedSettings.getBOOL("ShowNavbarNavigationPanel") ); + navbarp->setVisible( visible && (gSavedSettings.getU32("NavigationBarStyle") == 2)); } } @@ -6535,20 +6534,16 @@ LLRect LLViewerWindow::getChatConsoleRect() void LLViewerWindow::reshapeStatusBarContainer() { - S32 new_height = mStatusBarContainer->getRect().getHeight(); + static S32 original_status_bar_height = mStatusBarContainer->getRect().getHeight(); + S32 new_height = original_status_bar_height; S32 new_width = mStatusBarContainer->getRect().getWidth(); - static LLCachedControl<bool> show_navbar_nav_panel(gSavedSettings, "ShowNavbarNavigationPanel"); - if (show_navbar_nav_panel) + if (gSavedSettings.getU32("NavigationBarStyle") == 2) { // Navigation bar is outside visible area, expand status_bar_container to show it new_height += mNavBarBarContainer->getRect().getHeight(); } - else - { - // collapse status_bar_container - new_height -= mNavBarBarContainer->getRect().getHeight(); - } + mStatusBarContainer ->reshape(new_width, new_height, TRUE); } @@ -6574,10 +6569,9 @@ void LLViewerWindow::setUIVisibility(bool visible) gToolBarView->setToolBarsVisible(visible); } - static LLCachedControl<bool> show_navbar_nav_panel(gSavedSettings, "ShowNavbarNavigationPanel"); - static LLCachedControl<bool> show_miniloc_panel(gSavedSettings, "ShowMiniLocationPanel"); - LLNavigationBar::getInstance()->setVisible(visible ? show_navbar_nav_panel : FALSE); - LLPanelTopInfoBar::getInstance()->setVisible(visible? show_miniloc_panel : FALSE); + const U32 location_bar = gSavedSettings.getU32("NavigationBarStyle"); + LLNavigationBar::getInstance()->setVisible(visible ? (location_bar == 2) : FALSE); + LLPanelTopInfoBar::getInstance()->setVisible(visible ? (location_bar == 1) : FALSE); mStatusBarContainer->setVisible(visible); } diff --git a/indra/newview/skins/default/xui/en/menu_hide_navbar.xml b/indra/newview/skins/default/xui/en/menu_hide_navbar.xml index 1be5f2dc5ec..9e892ce822b 100644 --- a/indra/newview/skins/default/xui/en/menu_hide_navbar.xml +++ b/indra/newview/skins/default/xui/en/menu_hide_navbar.xml @@ -12,24 +12,35 @@ label="Show Navigation & Favorites Bar" layout="topleft" name="ShowNavbarNavigationPanel"> - <on_click - function="ToggleControl" - parameter="ShowNavbarNavigationPanel" /> - <on_check - function="CheckControl" - parameter="ShowNavbarNavigationPanel" /> + <on_click + function="ToggleLocationBar" + parameter="2" /> + <on_check + function="CheckLocationBar" + parameter="2" /> </menu_item_check> <menu_item_check label="Show Mini-Location Bar" layout="topleft" name="ShowMiniLocationPanel"> - <on_click - function="ToggleControl" - parameter="ShowMiniLocationPanel" /> - <on_check - function="CheckControl" - parameter="ShowMiniLocationPanel" /> - </menu_item_check> + <on_click + function="ToggleLocationBar" + parameter="1" /> + <on_check + function="CheckLocationBar" + parameter="1" /> + </menu_item_check> + <menu_item_check + label="Hide Location Bar" + layout="topleft" + name="HideLocationPanels"> + <on_click + function="ToggleLocationBar" + parameter="0" /> + <on_check + function="CheckLocationBar" + parameter="0" /> + </menu_item_check> <menu_item_separator /> <menu_item_check label="Show Menu Search" -- GitLab