diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/newview/llfloatersidetraytab.cpp | 45 | ||||
-rw-r--r-- | indra/newview/llfloatersidetraytab.h | 47 | ||||
-rw-r--r-- | indra/newview/llpanelgroup.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llpanelgroup.h | 2 | ||||
-rw-r--r-- | indra/newview/llsidetray.cpp | 49 | ||||
-rw-r--r-- | indra/newview/llsidetray.h | 13 | ||||
-rw-r--r-- | indra/newview/llviewerfloaterreg.cpp | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_side_bar_tab.xml | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_landmark_info.xml | 2 |
10 files changed, 146 insertions, 34 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 88dfb1a081..592f772549 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -204,6 +204,7 @@ set(viewer_SOURCE_FILES llfloatersearch.cpp llfloatersellland.cpp llfloatersettingsdebug.cpp + llfloatersidetraytab.cpp llfloatersnapshot.cpp llfloatertelehub.cpp llfloatertestinspectors.cpp @@ -729,6 +730,7 @@ set(viewer_HEADER_FILES llfloatersearch.h llfloatersellland.h llfloatersettingsdebug.h + llfloatersidetraytab.h llfloatersnapshot.h llfloatertelehub.h llfloatertestinspectors.h diff --git a/indra/newview/llfloatersidetraytab.cpp b/indra/newview/llfloatersidetraytab.cpp new file mode 100644 index 0000000000..f13b4db3a0 --- /dev/null +++ b/indra/newview/llfloatersidetraytab.cpp @@ -0,0 +1,45 @@ +/** + * @file llfloatersidetraytab.cpp + * @brief LLFloaterSideTrayTab class definition + * + * $LicenseInfo:firstyear=2010&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloatersidetraytab.h" + +// newview includes +#include "lltransientfloatermgr.h" + +LLFloaterSideTrayTab::LLFloaterSideTrayTab(const LLSD& key, const Params& params) +: LLFloater(key, params) +{ + // Prevent transient floaters (e.g. IM windows) from hiding + // when this floater is clicked. + LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::GLOBAL, this); +} + +LLFloaterSideTrayTab::~LLFloaterSideTrayTab() +{ + LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::GLOBAL, this); +} diff --git a/indra/newview/llfloatersidetraytab.h b/indra/newview/llfloatersidetraytab.h new file mode 100644 index 0000000000..e47f82e8ba --- /dev/null +++ b/indra/newview/llfloatersidetraytab.h @@ -0,0 +1,47 @@ +/** + * @file llfloatersidetraytab.h + * @brief LLFloaterSideTrayTab class definition + * + * $LicenseInfo:firstyear=2010&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLFLOATERSIDETRAYTAB_H +#define LL_LLFLOATERSIDETRAYTAB_H + +#include "llfloater.h" + +/** + * When a side tray tab gets detached, it's wrapped in an instance of this class. + * + * This class helps to make sure that clicking a detached side tray tab doesn't + * make transient floaters (e.g. IM windows) hide, so that it's possible to + * drag an inventory item from detached My Inventory window to a docked IM window, + * i.e. share the item (see VWR-22891). + */ +class LLFloaterSideTrayTab : public LLFloater +{ +public: + LLFloaterSideTrayTab(const LLSD& key, const Params& params = getDefaultParams()); + ~LLFloaterSideTrayTab(); +}; + +#endif // LL_LLFLOATERSIDETRAYTAB_H diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index e42057e93a..62ed7acb15 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -112,6 +112,7 @@ void LLPanelGroup::onOpen(const LLSD& key) if(!key.has("action")) { setGroupID(group_id); + getChild<LLAccordionCtrl>("groups_accordion")->expandDefaultTab(); return; } @@ -176,11 +177,6 @@ BOOL LLPanelGroup::postBuild() LLPanelGroupTab* panel_notices = findChild<LLPanelGroupTab>("group_notices_tab_panel"); LLPanelGroupTab* panel_land = findChild<LLPanelGroupTab>("group_land_tab_panel"); - if (LLAccordionCtrl* accordion_ctrl = getChild<LLAccordionCtrl>("groups_accordion")) - { - setVisibleCallback(boost::bind(&LLPanelGroup::onVisibilityChange, this, _2, accordion_ctrl)); - } - if(panel_general) mTabs.push_back(panel_general); if(panel_roles) mTabs.push_back(panel_roles); if(panel_notices) mTabs.push_back(panel_notices); @@ -304,14 +300,6 @@ void LLPanelGroup::onBtnCancel() onBackBtnClick(); } -void LLPanelGroup::onVisibilityChange(const LLSD &in_visible_chain, LLAccordionCtrl* accordion_ctrl) -{ - if (in_visible_chain.asBoolean() && accordion_ctrl != NULL) - { - accordion_ctrl->expandDefaultTab(); - } -} - void LLPanelGroup::changed(LLGroupChange gc) { for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it) diff --git a/indra/newview/llpanelgroup.h b/indra/newview/llpanelgroup.h index 86875d2da3..b494c7d403 100644 --- a/indra/newview/llpanelgroup.h +++ b/indra/newview/llpanelgroup.h @@ -36,7 +36,6 @@ class LLOfferInfo; const S32 UPDATE_MEMBERS_PER_FRAME = 500; // Forward declares -class LLAccordionCtrl; class LLPanelGroupTab; class LLTabContainer; class LLAgent; @@ -97,7 +96,6 @@ protected: void onBackBtnClick(); void onBtnJoin(); void onBtnCancel(); - void onVisibilityChange(const LLSD &in_visible_chain, LLAccordionCtrl* accordion_ctrl); static void onBtnApply(void*); static void onBtnRefresh(void*); diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index 7af3ad9896..1d32b58948 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -244,9 +244,7 @@ void LLSideTrayTab::toggleTabDocked() LLFloater* floater_tab = LLFloaterReg::getInstance("side_bar_tab", tab_name); if (!floater_tab) return; - LLFloaterReg::toggleInstance("side_bar_tab", tab_name); - - bool docking = !LLFloater::isShown(floater_tab); + bool docking = LLFloater::isShown(floater_tab); // Hide the "Tear Off" button when a tab gets undocked // and show "Dock" button instead. @@ -261,6 +259,10 @@ void LLSideTrayTab::toggleTabDocked() { undock(floater_tab); } + + // Open/close the floater *after* we reparent the tab panel, + // so that it doesn't receive redundant visibility change notifications. + LLFloaterReg::toggleInstance("side_bar_tab", tab_name); } void LLSideTrayTab::dock() @@ -282,7 +284,7 @@ void LLSideTrayTab::dock() if (side_tray->getCollapsed()) { - side_tray->expandSideBar(); + side_tray->expandSideBar(false); } } @@ -291,6 +293,10 @@ void LLSideTrayTab::undock(LLFloater* floater_tab) LLSideTray* side_tray = getSideTray(); if (!side_tray) return; + // Remember whether the tab have been active before detaching + // because removeTab() will change active tab. + bool was_active = side_tray->getActiveTab() == this; + // Remove the tab from Side Tray's tabs list. // We have to do it despite removing the tab from Side Tray's child view tree // by addChild(). Otherwise the tab could be accessed by the pointer in LLSideTray::mTabs. @@ -300,7 +306,12 @@ void LLSideTrayTab::undock(LLFloater* floater_tab) return; } - setVisible(true); // *HACK: restore visibility after being hidden by LLSideTray::selectTabByName(). + // If we're undocking while side tray is collapsed we need to explicitly show the panel. + if (!getVisible()) + { + setVisible(true); + } + floater_tab->addChild(this); floater_tab->setTitle(mTabTitle); @@ -334,7 +345,7 @@ void LLSideTrayTab::undock(LLFloater* floater_tab) side_tray->collapseSideBar(); } - if (side_tray->getActiveTab() != this) + if (!was_active) { // When a tab other then current active tab is detached from Side Tray // onOpen() should be called as tab visibility is changed. @@ -618,8 +629,9 @@ bool LLSideTray::selectTabByIndex(size_t index) return selectTabByName(sidebar_tab->getName()); } -bool LLSideTray::selectTabByName (const std::string& name) +bool LLSideTray::selectTabByName(const std::string& name, bool keep_prev_visible) { + LLSideTrayTab* tab_to_keep_visible = NULL; LLSideTrayTab* new_tab = getTab(name); if (!new_tab) return false; @@ -630,6 +642,8 @@ bool LLSideTray::selectTabByName (const std::string& name) //deselect old tab if (mActiveTab) { + // Keep previously active tab visible if requested. + if (keep_prev_visible) tab_to_keep_visible = mActiveTab; toggleTabButton(mActiveTab); } @@ -650,9 +664,17 @@ bool LLSideTray::selectTabByName (const std::string& name) for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) { LLSideTrayTab* sidebar_tab = *child_it; + + bool vis = sidebar_tab == mActiveTab; + + // Force keeping the tab visible if requested. + vis |= sidebar_tab == tab_to_keep_visible; + // When the last tab gets detached, for a short moment the "Toggle Sidebar" pseudo-tab // is shown. So, to avoid the flicker we make sure it never gets visible. - sidebar_tab->setVisible(sidebar_tab == mActiveTab && (*child_it)->getName() != "sidebar_openclose"); + vis &= (*child_it)->getName() != "sidebar_openclose"; + + sidebar_tab->setVisible(vis); } return true; } @@ -741,7 +763,7 @@ bool LLSideTray::removeTab(LLSideTrayTab* tab) { child_vector_iter_t next_tab_it = (tab_it < (mTabs.end() - 1)) ? tab_it + 1 : mTabs.begin(); - selectTabByName((*next_tab_it)->getName()); + selectTabByName((*next_tab_it)->getName(), true); // Don't hide the tab being removed. } // Remove the tab. @@ -1016,7 +1038,7 @@ void LLSideTray::collapseSideBar() setFocus( FALSE ); } -void LLSideTray::expandSideBar() +void LLSideTray::expandSideBar(bool open_active) { mCollapsed = false; LLSideTrayTab* openclose_tab = getTab("sidebar_openclose"); @@ -1024,8 +1046,11 @@ void LLSideTray::expandSideBar() { mCollapseButton->setImageOverlay( openclose_tab->mImageSelected ); } - LLSD key;//empty - mActiveTab->onOpen(key); + + if (open_active) + { + mActiveTab->onOpen(LLSD()); + } reflectCollapseChange(); diff --git a/indra/newview/llsidetray.h b/indra/newview/llsidetray.h index 248def8e3d..4e79007c13 100644 --- a/indra/newview/llsidetray.h +++ b/indra/newview/llsidetray.h @@ -76,9 +76,12 @@ public: // interface functions /** - * Select tab with specific name and set it active - */ - bool selectTabByName (const std::string& name); + * Select tab with specific name and set it active + * + * @param name Tab to switch to. + * @param keep_prev_visible Whether to keep the previously selected tab visible. + */ + bool selectTabByName (const std::string& name, bool keep_prev_visible = false); /** * Select tab with specific index and set it active @@ -119,8 +122,10 @@ public: /* * expand SideBar + * + * @param open_active Whether to call onOpen() for the active tab. */ - void expandSideBar (); + void expandSideBar(bool open_active = true); /** diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 8728298575..b6f2d34663 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -86,6 +86,7 @@ #include "llfloaterscriptlimits.h" #include "llfloatersellland.h" #include "llfloatersettingsdebug.h" +#include "llfloatersidetraytab.h" #include "llfloatersnapshot.h" #include "llfloatertelehub.h" #include "llfloatertestinspectors.h" @@ -234,7 +235,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("script_limits", "floater_script_limits.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptLimits>); LLFloaterReg::add("sell_land", "floater_sell_land.xml", &LLFloaterSellLand::buildFloater); LLFloaterReg::add("settings_debug", "floater_settings_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSettingsDebug>); - LLFloaterReg::add("side_bar_tab", "floater_side_bar_tab.xml",&LLFloaterReg::build<LLFloater>); + LLFloaterReg::add("side_bar_tab", "floater_side_bar_tab.xml", &LLFloaterReg::build<LLFloaterSideTrayTab>); LLFloaterReg::add("stats", "floater_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloater>); LLFloaterReg::add("start_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterRunQueue>); LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNotRunQueue>); diff --git a/indra/newview/skins/default/xui/en/floater_side_bar_tab.xml b/indra/newview/skins/default/xui/en/floater_side_bar_tab.xml index bf0913fde7..9f14e9ae0a 100644 --- a/indra/newview/skins/default/xui/en/floater_side_bar_tab.xml +++ b/indra/newview/skins/default/xui/en/floater_side_bar_tab.xml @@ -2,7 +2,8 @@ <floater can_close="false" can_resize="true" - min_width="150" + min_width="333" + min_height="440" save_rect="true" save_visibility="true" > diff --git a/indra/newview/skins/default/xui/en/panel_landmark_info.xml b/indra/newview/skins/default/xui/en/panel_landmark_info.xml index c5d6aced7a..f8ae238148 100644 --- a/indra/newview/skins/default/xui/en/panel_landmark_info.xml +++ b/indra/newview/skins/default/xui/en/panel_landmark_info.xml @@ -57,7 +57,7 @@ translate="false" value="Parcel_R_Dark" /> <button - follows="top|right" + follows="top|left" height="24" image_hover_unselected="BackButton_Over" image_pressed="BackButton_Press" |