From c273067ceedd8f612a0cf2ba0f315690b940f8b5 Mon Sep 17 00:00:00 2001 From: Kitty Barnett <develop@catznip.com> Date: Tue, 7 Sep 2010 05:02:05 +0200 Subject: [PATCH] - fixed : inventory sidebar tab should be hidden if undocked when @showinv=n restricted --HG-- branch : RLVa --- indra/newview/llsidetray.cpp | 26 ++++++++++++++++++++++++++ indra/newview/llsidetray.h | 4 ++++ indra/newview/rlvui.cpp | 20 ++++++++++++++++++-- 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index 83fcdb566e..d3e16a35b0 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -540,6 +540,32 @@ bool LLSideTray::isTabAttached(const std::string& name) return std::find(mTabs.begin(), mTabs.end(), tab) != mTabs.end(); } +// [RLVa:KB] - Checked: 2010-09-07 (RLVa-1.2.1a) | Added: RLVa-1.2.1a +void LLSideTray::toggleTabDocked(const std::string& strTabName) +{ + if (!isTabAttached(strTabName)) + { + for (child_vector_iter_t itTab = mDetachedTabs.begin(); itTab != mDetachedTabs.end(); ++itTab) + { + LLSideTrayTab* pTab = *itTab; + if (strTabName == pTab->getName()) + { + pTab->toggleTabDocked(); + return; + } + } + } + else + { + LLSideTrayTab* pTab = getTab(strTabName); + if (pTab) + { + pTab->toggleTabDocked(); + } + } +} +// [/RLVa:KB] + bool LLSideTray::hasTabs() { // The open/close tab doesn't count. diff --git a/indra/newview/llsidetray.h b/indra/newview/llsidetray.h index d7198973ef..7f6b543025 100644 --- a/indra/newview/llsidetray.h +++ b/indra/newview/llsidetray.h @@ -176,6 +176,10 @@ public: bool isTabAttached (const std::string& name); +// [RLVa:KB] - Checked: 2010-09-07 (RLVa-1.2.1a) | Added: RLVa-1.2.1a + void toggleTabDocked(const std::string& strTabName); +// [/RLVa:KB] + protected: bool hasTabs (); diff --git a/indra/newview/rlvui.cpp b/indra/newview/rlvui.cpp index 685bd87cff..6d55b076ec 100644 --- a/indra/newview/rlvui.cpp +++ b/indra/newview/rlvui.cpp @@ -170,18 +170,33 @@ void RlvUIEnabler::onToggleSetEnv() } } -// Checked: 2010-08-24 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a +// Checked: 2010-09-07 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a void RlvUIEnabler::onToggleShowInv() { bool fEnable = !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWINV); // - // Enable/disable the "My Inventory" button on the sidebar button panel + // Enable/disable the "My Inventory" sidebar tab // LLSideTray* pSideTray = LLSideTray::getInstance(); RLV_ASSERT(pSideTray); if (pSideTray) { + // If the inventory sidebar tab is currently undocked we need to redock it first + if ( (!fEnable) && (!pSideTray->isTabAttached("sidebar_inventory")) ) + { + // NOTE: redocking will expand the sidebar and select the redocked tab so we need enough information to undo that again + bool fCollapsed = pSideTray->getCollapsed(); + const LLPanel* pActiveTab = pSideTray->getActiveTab(); + + pSideTray->toggleTabDocked("sidebar_inventory"); + + if (pActiveTab) + pSideTray->selectTabByName(pActiveTab->getName()); + if (fCollapsed) + pSideTray->collapseSideBar(); + } + LLButton* pInvBtn = pSideTray->getButtonFromName("sidebar_inventory"); RLV_ASSERT(pInvBtn); if (pInvBtn) @@ -209,6 +224,7 @@ void RlvUIEnabler::onToggleShowInv() // Enable/disable the "My Outfits" panel on the "My Appearance" sidebar tab // LLPanelOutfitsInventory* pAppearancePanel = LLPanelOutfitsInventory::findInstance(); + RLV_ASSERT(pAppearancePanel); if (pAppearancePanel) { LLTabContainer* pAppearanceTabs = pAppearancePanel->getAppearanceTabs(); -- GitLab