summaryrefslogtreecommitdiff
path: root/indra/newview/llsidetray.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llsidetray.cpp')
-rw-r--r--indra/newview/llsidetray.cpp59
1 files changed, 54 insertions, 5 deletions
diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp
index 3ec1855484..9159f42968 100644
--- a/indra/newview/llsidetray.cpp
+++ b/indra/newview/llsidetray.cpp
@@ -66,6 +66,21 @@ static const std::string TAB_PANEL_CAPTION_TITLE_BOX = "sidetray_tab_title";
LLSideTray* LLSideTray::sInstance = 0;
+/**
+ * Updates visibility of sidetray tabs buttons according to "SidebarWithButtonsVisibility" setting
+ *
+ * @param force_set_visible if true method ignores setting value and set buttons visible.
+ */
+static void update_tabs_buttons_visibility(bool force_set_visible = false)
+{
+ LLView* side_bar_tabs = gViewerWindow->getRootView()->getChildView("side_bar_tabs");
+ if (side_bar_tabs)
+ {
+ BOOL visible = LLUI::sSettingGroups["config"]->getBOOL("SidebarWithButtonsVisibility");
+ side_bar_tabs->setVisible(force_set_visible || visible);
+ }
+}
+
LLSideTray* LLSideTray::getInstance()
{
if (!sInstance)
@@ -258,6 +273,8 @@ LLSideTray::LLSideTray(Params& params)
p.name = "buttons_panel";
p.mouse_opaque = false;
mButtonsPanel = LLUICtrlFactory::create<LLPanel>(p);
+
+ initControlSettings();
}
@@ -547,6 +564,7 @@ void LLSideTray::collapseSideBar()
reflectCollapseChange();
setFocus( FALSE );
+ update_tabs_buttons_visibility();
}
void LLSideTray::expandSideBar()
@@ -572,6 +590,7 @@ void LLSideTray::expandSideBar()
btn->setImageOverlay( mActiveTab->mImageSelected );
}
+ update_tabs_buttons_visibility(true);
}
void LLSideTray::highlightFocused()
@@ -638,6 +657,9 @@ LLPanel* LLSideTray::showPanel (const std::string& panel_name, const LLSD& para
{
panel->onOpen(params);
}
+
+ update_tabs_buttons_visibility(true);
+
return panel;
}
}
@@ -720,11 +742,6 @@ bool LLSideTray::isPanelActive(const std::string& panel_name)
return (panel->getName() == panel_name);
}
-
-// *TODO: Eliminate magic constants.
-static const S32 fake_offset = 132;
-static const S32 fake_top_offset = 18;
-
void LLSideTray::updateSidetrayVisibility()
{
// set visibility of parent container based on collapsed state
@@ -734,3 +751,35 @@ void LLSideTray::updateSidetrayVisibility()
}
}
+void LLSideTray::initControlSettings()
+{
+ // set listeners to process runtime setting changes
+ LLUI::sSettingGroups["config"]->getControl("SidebarWithButtonsVisibility")->getSignal()->connect(boost::bind(&LLSideTray::toggleSidetrayAndTabButtonsVisibility, this, _2));
+
+ // update visibility according to current value
+ toggleSidetrayAndTabButtonsVisibility(LLUI::sSettingGroups["config"]->getBOOL("SidebarWithButtonsVisibility"));
+}
+
+// sidebar visibility is implemented via its expanding/collapsing
+void LLSideTray::toggleSidetrayAndTabButtonsVisibility(const LLSD::Boolean& new_visibility)
+{
+ // If new_visibility==FALSE it gets invisible but still can be expanded in other ways (Ctrl+I to see My Inventory)
+
+ // store collapsed state to restore it properly on next call
+ static bool was_collapsed = false;
+
+ if (!new_visibility && !mCollapsed)
+ {
+ collapseSideBar();
+ was_collapsed = true;
+ }
+ // should be visible: expand only if it was expanded when has been collapsed on previous call
+ else if (new_visibility && was_collapsed)
+ {
+ if (mCollapsed) expandSideBar();
+ was_collapsed = false;
+ }
+
+ update_tabs_buttons_visibility(new_visibility);
+}
+