diff options
author | Paul ProductEngine <pguslisty@productengine.com> | 2011-09-29 21:43:07 +0300 |
---|---|---|
committer | Paul ProductEngine <pguslisty@productengine.com> | 2011-09-29 21:43:07 +0300 |
commit | 9d3fc5d930bd1dae07771350080e5140c0113891 (patch) | |
tree | 924267e6b3c6ade89519c21d2670233588fb8bf9 /indra/newview | |
parent | 6a463a41fec89c7f1eadb77c16eeae169ff777d0 (diff) |
EXP-1209 FIXED Sidetray removed.
- Removed all sidetray dependencies and the sidetray itself.
- Also removed LLFloaterSidetrayTab and LLSidetrayListener as unused.
Diffstat (limited to 'indra/newview')
64 files changed, 29 insertions, 2431 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 59e1ca10e6..c488d51ba5 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -229,7 +229,6 @@ set(viewer_SOURCE_FILES llfloatersellland.cpp llfloatersettingsdebug.cpp llfloatersidepanelcontainer.cpp - llfloatersidetraytab.cpp llfloatersnapshot.cpp llfloatersounddevices.cpp llfloatertelehub.cpp @@ -442,8 +441,6 @@ set(viewer_SOURCE_FILES llsidepanelinventorysubpanel.cpp llsidepaneliteminfo.cpp llsidepaneltaskinfo.cpp - llsidetray.cpp - llsidetraylistener.cpp llsidetraypanelcontainer.cpp llsky.cpp llslurl.cpp @@ -794,7 +791,6 @@ set(viewer_HEADER_FILES llfloatersellland.h llfloatersettingsdebug.h llfloatersidepanelcontainer.h - llfloatersidetraytab.h llfloatersnapshot.h llfloatersounddevices.h llfloatertelehub.h @@ -1002,8 +998,6 @@ set(viewer_HEADER_FILES llsidepanelinventorysubpanel.h llsidepaneliteminfo.h llsidepaneltaskinfo.h - llsidetray.h - llsidetraylistener.h llsidetraypanelcontainer.h llsky.h llslurl.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 148b80e817..3d3185600b 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9921,17 +9921,6 @@ <key>Value</key> <integer>0</integer> </map> - <key>SidebarCameraMovement</key> - <map> - <key>Comment</key> - <string>Reflects world rect changing while changing sidebar visibility.</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>0</integer> - </map> <key>GroupListShowIcons</key> <map> <key>Comment</key> diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 404cd8e5b6..ccbf6bf932 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -43,7 +43,6 @@ #include "llnotificationsutil.h" #include "lloutfitobserver.h" #include "llsidepanelappearance.h" -#include "llsidetray.h" #include "lltexlayer.h" #include "lltooldraganddrop.h" #include "llviewerregion.h" diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index c638f881a5..e5369dc2b8 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -44,7 +44,6 @@ #include "lloutfitslist.h" #include "llselectmgr.h" #include "llsidepanelappearance.h" -#include "llsidetray.h" #include "llviewerobjectlist.h" #include "llvoavatar.h" #include "llvoavatarself.h" @@ -2466,7 +2465,8 @@ public: // add may be processed after login process is finished if (mShowPanel) { - LLSideTray::getInstance()->showPanel("panel_outfits_inventory", key); + LLFloaterSidePanelContainer::showPanel("appearance", "panel_outfits_inventory", key); + } LLOutfitsList *outfits_list = dynamic_cast<LLOutfitsList*>(LLFloaterSidePanelContainer::getPanel("appearance", "outfitslist_tab")); diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 43c8750b02..7b75bbf430 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -81,7 +81,6 @@ #include "llviewermenufile.h" #include "llvoicechannel.h" #include "llvoavatarself.h" -#include "llsidetray.h" #include "llurlmatch.h" #include "lltextutil.h" #include "lllogininstance.h" @@ -3499,8 +3498,6 @@ void LLAppViewer::requestQuit() gFloaterView->closeAllChildren(true); } - LLSideTray::getInstance()->notifyChildren(LLSD().with("request","quit")); - send_stats(); gLogoutTimer.reset(); @@ -4559,10 +4556,6 @@ void LLAppViewer::idleShutdown() return; } - if (LLSideTray::getInstance()->notifyChildren(LLSD().with("request","wait_quit"))) - { - return; - } diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index fb7517a98b..b14c02a5d6 100755 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -61,7 +61,6 @@ #include "llpaneloutfitedit.h" #include "llpanelprofile.h" #include "llrecentpeople.h" -#include "llsidetray.h" #include "lltrans.h" #include "llviewercontrol.h" #include "llviewerobjectlist.h" diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 19061c55ca..98712f1334 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -48,7 +48,6 @@ #include "llimfloater.h" // for LLIMFloater #include "llnearbychatbar.h" #include "llnearbychatbarlistener.h" -#include "llsidetray.h" #include "llspeakbutton.h" #include "llsplitbutton.h" #include "llsyswellwindow.h" diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index d6773b8b29..7a444edd43 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -59,8 +59,6 @@ #include "llviewercontrol.h" -#include "llsidetray.h"//for blocked objects panel - static LLDefaultChildRegistry::Register<LLChatHistory> r("chat_history"); const static std::string NEW_LINE(rawstr_to_utf8("\n")); diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp index 80e0cca780..54598f90c8 100644 --- a/indra/newview/llcofwearables.cpp +++ b/indra/newview/llcofwearables.cpp @@ -41,7 +41,6 @@ #include "llviewermenu.h" #include "llwearableitemslist.h" #include "llpaneloutfitedit.h" -#include "llsidetray.h" #include "lltrans.h" static LLRegisterPanelClassWrapper<LLCOFWearables> t_cof_wearables("cof_wearables"); @@ -160,11 +159,6 @@ public: protected: static void replaceWearable(const LLUUID& item_id) { - // *TODO: Most probable that accessing to LLPanelOutfitEdit instance should be: - // LLSideTray::getInstance()->getSidepanelAppearance()->getPanelOutfitEdit() - // without casting. Getter methods provides possibility to check and construct - // absent instance. Explicit relations between components avoids situations - // when we tries to construct instance with unsatisfied implicit input conditions. LLPanelOutfitEdit * panel_outfit_edit = dynamic_cast<LLPanelOutfitEdit*> (LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit")); @@ -236,8 +230,6 @@ protected: LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar; LLUUID selected_id = mUUIDs.back(); - // *HACK* need to pass pointer to LLPanelOutfitEdit instead of LLSideTray::getInstance()->getPanel(). - // LLSideTray::getInstance()->getPanel() is rather slow variant LLPanelOutfitEdit* panel_oe = dynamic_cast<LLPanelOutfitEdit*>(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit")); registrar.add("BodyPart.Replace", boost::bind(&LLPanelOutfitEdit::onReplaceMenuItemClicked, panel_oe, selected_id)); registrar.add("BodyPart.Edit", boost::bind(LLAgentWearables::editWearable, selected_id)); diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 1eabf32b9f..6dcfa95a0e 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -45,7 +45,6 @@ #include "llfloaterworldmap.h" #include "lllandmarkactions.h" #include "llnotificationsutil.h" -#include "llsidetray.h" #include "lltoggleablemenu.h" #include "llviewerinventory.h" #include "llviewermenu.h" diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index d8b6b2e966..47c86ae549 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -67,7 +67,6 @@ #include "llscrolllistctrl.h" #include "llscrolllistitem.h" #include "llsliderctrl.h" -#include "llsidetray.h" #include "lltabcontainer.h" #include "lltrans.h" #include "llviewercontrol.h" @@ -1497,11 +1496,7 @@ void LLFloaterPreference::onChangeMaturity() // but the UI for this will still be enabled void LLFloaterPreference::onClickBlockList() { - // don't create side tray on demand - if (LLSideTray::instanceCreated()) - { - LLFloaterSidePanelContainer::showPanel("people", "panel_block_list_sidetray", LLSD()); - } + LLFloaterSidePanelContainer::showPanel("people", "panel_block_list_sidetray", LLSD()); } void LLFloaterPreference::onDoubleClickCheckBox(LLUICtrl* ctrl) diff --git a/indra/newview/llfloatersidetraytab.cpp b/indra/newview/llfloatersidetraytab.cpp deleted file mode 100644 index 9f15e62d84..0000000000 --- a/indra/newview/llfloatersidetraytab.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @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" -#include "llsidetray.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); -} - -void LLFloaterSideTrayTab::onClose(bool app_quitting) -{ - // The floater is already being closed, so don't toggle it once more (that may crash viewer). - LLSideTray::getInstance()->setTabDocked(getName(), /* dock = */ true, /* toggle_floater = */ false); -} diff --git a/indra/newview/llfloatersidetraytab.h b/indra/newview/llfloatersidetraytab.h deleted file mode 100644 index 89f2444a0e..0000000000 --- a/indra/newview/llfloatersidetraytab.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @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(); - - void onClose(bool app_quitting); -}; - -#endif // LL_LLFLOATERSIDETRAYTAB_H diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp index cbbd66d868..623ebb76f2 100644 --- a/indra/newview/llgroupactions.cpp +++ b/indra/newview/llgroupactions.cpp @@ -38,7 +38,6 @@ #include "llgroupmgr.h" #include "llimview.h" // for gIMMgr #include "llnotificationsutil.h" -#include "llsidetray.h" #include "llstatusbar.h" // can_afford_transaction() #include "llimfloater.h" #include "groupchatlistener.h" diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 50a9c56518..14d85246e9 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -55,15 +55,9 @@ #include "llinventorymodel.h" #include "llrootview.h" #include "llspeakers.h" -#include "llsidetray.h" #include "llviewerchat.h" -static const S32 RECT_PADDING_NOT_INIT = -1; -static const S32 RECT_PADDING_NEED_RECALC = -2; - -S32 LLIMFloater::sAllowedRectRightPadding = RECT_PADDING_NOT_INIT; - LLIMFloater::LLIMFloater(const LLUUID& session_id) : LLTransientDockableFloater(NULL, true, session_id), mControlPanel(NULL), @@ -472,41 +466,9 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id) return floater; } -//static -bool LLIMFloater::resetAllowedRectPadding() -{ - //reset allowed rect right padding if "SidebarCameraMovement" option - //or sidebar state changed - sAllowedRectRightPadding = RECT_PADDING_NEED_RECALC ; - return true; -} - void LLIMFloater::getAllowedRect(LLRect& rect) { - if (sAllowedRectRightPadding == RECT_PADDING_NOT_INIT) //wasn't initialized - { - gSavedSettings.getControl("SidebarCameraMovement")->getSignal()->connect(boost::bind(&LLIMFloater::resetAllowedRectPadding)); - - LLSideTray* side_bar = LLSideTray::getInstance(); - side_bar->setVisibleWidthChangeCallback(boost::bind(&LLIMFloater::resetAllowedRectPadding)); - sAllowedRectRightPadding = RECT_PADDING_NEED_RECALC; - } - rect = gViewerWindow->getWorldViewRectScaled(); - if (sAllowedRectRightPadding == RECT_PADDING_NEED_RECALC) //recalc allowed rect right padding - { - LLPanel* side_bar_tabs = - gViewerWindow->getRootView()->getChild<LLPanel> ( - "side_bar_tabs"); - sAllowedRectRightPadding = side_bar_tabs->getRect().getWidth(); - LLTransientFloaterMgr::getInstance()->addControlView(side_bar_tabs); - - if (gSavedSettings.getBOOL("SidebarCameraMovement") == FALSE) - { - sAllowedRectRightPadding += LLSideTray::getInstance()->getVisibleWidth(); - } - } - rect.mRight -= sAllowedRectRightPadding; } void LLIMFloater::setDocked(bool docked, bool pop_on_undock) diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index 5158f6c1f7..8a3020ea10 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -156,10 +156,6 @@ private: static void closeHiddenIMToasts(); - static bool resetAllowedRectPadding(); - //need to keep this static for performance issues - static S32 sAllowedRectRightPadding; - static void confirmLeaveCallCallback(const LLSD& notification, const LLSD& response); LLPanelChatControlPanel* mControlPanel; diff --git a/indra/newview/llinspectobject.cpp b/indra/newview/llinspectobject.cpp index 29d7a4a6b0..026c8a0923 100644 --- a/indra/newview/llinspectobject.cpp +++ b/indra/newview/llinspectobject.cpp @@ -46,7 +46,6 @@ #include "llmenubutton.h" #include "llresmgr.h" // getMonetaryString #include "llsafehandle.h" -#include "llsidetray.h" #include "lltextbox.h" // for description truncation #include "lltoggleablemenu.h" #include "lltrans.h" diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index b6041c7f31..2066cbc6b2 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -60,7 +60,6 @@ #include "llpreviewtexture.h" #include "llselectmgr.h" #include "llsidepanelappearance.h" -#include "llsidetray.h" #include "lltrans.h" #include "llviewerassettype.h" #include "llviewerfoldertype.h" diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index acec02b507..21a026bcf7 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -71,7 +71,6 @@ #include "llscrollbar.h" #include "llscrollcontainer.h" #include "llselectmgr.h" -#include "llsidetray.h" #include "llsidepanelinventory.h" #include "lltabcontainer.h" #include "lltooldraganddrop.h" diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 27db28367c..b0f9cb28e6 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -43,7 +43,6 @@ #include "llinventoryfunctions.h" #include "llinventorymodelbackgroundfetch.h" #include "llsidepanelinventory.h" -#include "llsidetray.h" #include "llviewerattachmenu.h" #include "llviewerfoldertype.h" #include "llvoavatarself.h" diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index f519ad759e..025181ead5 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -49,7 +49,6 @@ #include "lllandmarkactions.h" #include "lllandmarklist.h" #include "llteleporthistory.h" -#include "llsidetray.h" #include "llslurl.h" #include "llstatusbar.h" // getHealth() #include "lltrans.h" diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp index 4c0823874c..fc264db5af 100644 --- a/indra/newview/llnavigationbar.cpp +++ b/indra/newview/llnavigationbar.cpp @@ -45,7 +45,6 @@ #include "llpaneltopinfobar.h" #include "llteleporthistory.h" #include "llsearchcombobox.h" -#include "llsidetray.h" #include "llslurl.h" #include "llurlregistry.h" #include "llurldispatcher.h" diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index a16ea0e7d3..9eaa64a124 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -32,7 +32,6 @@ #include "llrootview.h" //#include "llchatitemscontainerctrl.h" #include "lliconctrl.h" -#include "llsidetray.h" #include "llfloatersidepanelcontainer.h" #include "llfocusmgr.h" #include "llresizebar.h" diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index c2739867b1..1dc4d796ab 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -42,7 +42,6 @@ #include "llmenubutton.h" #include "llnotificationsutil.h" #include "lloutfitobserver.h" -#include "llsidetray.h" #include "lltoggleablemenu.h" #include "lltransutil.h" #include "llviewermenu.h" diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp index 856dabb6b7..5c85ec438c 100644 --- a/indra/newview/llpanelblockedlist.cpp +++ b/indra/newview/llpanelblockedlist.cpp @@ -38,7 +38,6 @@ // project include #include "llfloateravatarpicker.h" #include "llfloatersidepanelcontainer.h" -#include "llsidetray.h" #include "llsidetraypanelcontainer.h" static LLRegisterPanelClassWrapper<LLPanelBlockedList> t_panel_blocked_list("panel_block_list_sidetray"); diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index 70dcf61d7d..ae217958f0 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -50,7 +50,6 @@ #include "llpanelgroupnotices.h" #include "llpanelgroupgeneral.h" -#include "llsidetray.h" #include "llaccordionctrltab.h" #include "llaccordionctrl.h" diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp index e370f2f622..0295ad151f 100644 --- a/indra/newview/llpanelimcontrolpanel.cpp +++ b/indra/newview/llpanelimcontrolpanel.cpp @@ -40,7 +40,6 @@ #include "llparticipantlist.h" #include "llimview.h" #include "llvoicechannel.h" -#include "llsidetray.h" #include "llspeakers.h" #include "lltrans.h" diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index 1b9eb4813b..a65631b8d8 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -52,7 +52,6 @@ #include "llmenubutton.h" #include "llplacesinventorybridge.h" #include "llplacesinventorypanel.h" -#include "llsidetray.h" #include "lltoggleablemenu.h" #include "llviewermenu.h" #include "llviewerregion.h" diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index c1341af2ef..6562b259c3 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -52,7 +52,6 @@ #include "llviewermenu.h" #include "llviewertexturelist.h" #include "llsidepanelinventory.h" -#include "llsidetray.h" const std::string FILTERS_FILENAME("filters.xml"); diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index a336472fc0..d1aea51a09 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -59,8 +59,6 @@ LLPanelMarketplaceInbox::~LLPanelMarketplaceInbox() // virtual BOOL LLPanelMarketplaceInbox::postBuild() { - LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLPanelMarketplaceInbox::handleLoginComplete, this)); - LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMarketplaceInbox::onFocusReceived, this)); return TRUE; @@ -74,12 +72,6 @@ void LLPanelMarketplaceInbox::onSelectionChange() } -void LLPanelMarketplaceInbox::handleLoginComplete() -{ - // Set us up as the class to drive the badge value for the sidebar_inventory button - LLSideTray::getInstance()->setTabButtonBadgeDriver("sidebar_inventory", this); -} - LLInventoryPanel * LLPanelMarketplaceInbox::setupInventoryPanel() { LLView * inbox_inventory_placeholder = getChild<LLView>("inbox_inventory_placeholder"); diff --git a/indra/newview/llpanelmarketplaceinbox.h b/indra/newview/llpanelmarketplaceinbox.h index 705a095cf0..3531518e51 100644 --- a/indra/newview/llpanelmarketplaceinbox.h +++ b/indra/newview/llpanelmarketplaceinbox.h @@ -28,11 +28,10 @@ #define LL_LLPANELMARKETPLACEINBOX_H #include "llpanel.h" -#include "llsidetray.h" class LLInventoryPanel; -class LLPanelMarketplaceInbox : public LLPanel, public LLSideTrayTabBadgeDriver +class LLPanelMarketplaceInbox : public LLPanel { public: @@ -61,7 +60,6 @@ public: std::string getBadgeString() const; private: - void handleLoginComplete(); void onSelectionChange(); diff --git a/indra/newview/llpanelmarketplaceoutbox.cpp b/indra/newview/llpanelmarketplaceoutbox.cpp index c0de5deb0a..d4f9654e6e 100644 --- a/indra/newview/llpanelmarketplaceoutbox.cpp +++ b/indra/newview/llpanelmarketplaceoutbox.cpp @@ -40,7 +40,6 @@ #include "llpanelmarketplaceinbox.h" #include "llsdutil.h" #include "llsidepanelinventory.h" -#include "llsidetray.h" #include "lltimer.h" #include "llviewernetwork.h" #include "llagent.h" diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp index 4d86fa15df..0b687009bf 100644 --- a/indra/newview/llpanelme.cpp +++ b/indra/newview/llpanelme.cpp @@ -72,20 +72,6 @@ BOOL LLPanelMe::postBuild() void LLPanelMe::onOpen(const LLSD& key) { LLPanelProfile::onOpen(key); - - // Removed this action as per SOCIAL-431 The first time a new resident opens the profile tab - // in the sidebar, they see the old profile editing panel - // - //// Force Edit My Profile if this is the first time when user is opening Me Panel (EXT-5068) - //bool opened = gSavedSettings.getBOOL("MePanelOpened"); - //// In some cases Side Tray my call onOpen() twice, check getCollapsed() to be sure this - //// is the last time onOpen() is called - //if( !opened && !LLSideTray::getInstance()->getCollapsed() ) - //{ - // buildEditPanel(); - // openPanel(mEditPanel, getAvatarId()); - // gSavedSettings.setBOOL("MePanelOpened", true); - //} } void LLPanelMe::buildEditPanel() diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 44364b5831..98ea680504 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -57,7 +57,6 @@ #include "llpreviewtexture.h" #include "llscrollcontainer.h" #include "llselectmgr.h" -#include "llsidetray.h" #include "llstatusbar.h" #include "lltooldraganddrop.h" #include "lltrans.h" diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index 3ac0d6616b..f90236f6f2 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -41,7 +41,6 @@ #include "llpanelwearing.h" #include "llsaveoutfitcombobtn.h" #include "llsidepanelappearance.h" -#include "llsidetray.h" #include "llviewerfoldertype.h" static const std::string OUTFITS_TAB_NAME = "outfitslist_tab"; diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 86e481d953..80c431f481 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -57,7 +57,6 @@ #include "llinventoryobserver.h" #include "llnetmap.h" #include "llpanelpeoplemenus.h" -#include "llsidetray.h" #include "llsidetraypanelcontainer.h" #include "llrecentpeople.h" #include "llviewercontrol.h" // for gSavedSettings @@ -1452,7 +1451,7 @@ bool LLPanelPeople::notifyChildren(const LLSD& info) container->onOpen(LLSD().with(LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME, getName())); } else - LLSideTray::getInstance()->collapseSideBar(); + LLFloaterReg::hideFloaterInstance("people"); return true; // this notification is only supposed to be handled by task panels } diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index 0129ac753a..7f8f9b29af 100644 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -65,7 +65,6 @@ #include "llpanelplaceprofile.h" #include "llpanelteleporthistory.h" #include "llremoteparcelrequest.h" -#include "llsidetray.h" #include "llteleporthistorystorage.h" #include "lltoggleablemenu.h" #include "llviewerinventory.h" diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp index 52dd70f005..79171dbcb9 100644 --- a/indra/newview/llpanelteleporthistory.cpp +++ b/indra/newview/llpanelteleporthistory.cpp @@ -31,7 +31,6 @@ #include "llfloaterworldmap.h" #include "llpanelteleporthistory.h" -#include "llsidetray.h" #include "llworldmap.h" #include "llteleporthistorystorage.h" #include "lltextutil.h" diff --git a/indra/newview/llpaneltopinfobar.cpp b/indra/newview/llpaneltopinfobar.cpp index b6e32dba78..5ed23d2f42 100644 --- a/indra/newview/llpaneltopinfobar.cpp +++ b/indra/newview/llpaneltopinfobar.cpp @@ -36,7 +36,6 @@ #include "lllocationinputctrl.h" #include "llnotificationsutil.h" #include "llparcel.h" -#include "llsidetray.h" #include "llslurl.h" #include "llstatusbar.h" #include "lltrans.h" diff --git a/indra/newview/llpaneltopinfobar.h b/indra/newview/llpaneltopinfobar.h index 583e91d15e..e934b522be 100644 --- a/indra/newview/llpaneltopinfobar.h +++ b/indra/newview/llpaneltopinfobar.h @@ -148,7 +148,7 @@ private: void setParcelInfoText(const std::string& new_text); /** - * Implementation of LLDestroyClass<LLSideTray> + * Implementation of LLDestroyClass<T> */ static void destroyClass() { diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp index 87e9bb7b28..e2801c09bd 100644 --- a/indra/newview/llpanelwearing.cpp +++ b/indra/newview/llpanelwearing.cpp @@ -36,7 +36,6 @@ #include "llinventorymodel.h" #include "llinventoryobserver.h" #include "llmenubutton.h" -#include "llsidetray.h" #include "llviewermenu.h" #include "llwearableitemslist.h" #include "llsdserialize.h" diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index e3bc67a414..a3b0574bca 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -41,7 +41,6 @@ #include "llsyswellwindow.h" #include "llimfloater.h" #include "llscriptfloater.h" -#include "llsidetray.h" #include <algorithm> @@ -83,25 +82,8 @@ bool LLScreenChannelBase::isHovering() return mHoveredToast->isHovered(); } -void LLScreenChannelBase::resetPositionAndSize() -{ - LLRect rc = gViewerWindow->getWorldViewRectScaled(); - updatePositionAndSize(rc, rc); -} - void LLScreenChannelBase::updatePositionAndSize(LLRect old_world_rect, LLRect new_world_rect) { - /* - take sidetray into account - screenchannel should not overlap sidetray - */ - S32 world_rect_padding = 0; - if (gSavedSettings.getBOOL("SidebarCameraMovement") == FALSE - && LLSideTray::instanceCreated ()) - { - world_rect_padding += LLSideTray::getInstance()->getVisibleWidth(); - } - - S32 top_delta = old_world_rect.mTop - new_world_rect.mTop; LLRect this_rect = getRect(); @@ -111,10 +93,10 @@ void LLScreenChannelBase::updatePositionAndSize(LLRect old_world_rect, LLRect ne case CA_LEFT : break; case CA_CENTRE : - this_rect.setCenterAndSize( (new_world_rect.getWidth() - world_rect_padding) / 2, new_world_rect.getHeight() / 2, this_rect.getWidth(), this_rect.getHeight()); + this_rect.setCenterAndSize( (new_world_rect.getWidth()) / 2, new_world_rect.getHeight() / 2, this_rect.getWidth(), this_rect.getHeight()); break; case CA_RIGHT : - this_rect.setLeftTopAndSize(new_world_rect.mRight - world_rect_padding - this_rect.getWidth(), + this_rect.setLeftTopAndSize(new_world_rect.mRight - this_rect.getWidth(), this_rect.mTop, this_rect.getWidth(), this_rect.getHeight()); @@ -126,12 +108,6 @@ void LLScreenChannelBase::updatePositionAndSize(LLRect old_world_rect, LLRect ne void LLScreenChannelBase::init(S32 channel_left, S32 channel_right) { - if(LLSideTray::instanceCreated()) - { - LLSideTray* side_bar = LLSideTray::getInstance(); - side_bar->setVisibleWidthChangeCallback(boost::bind(&LLScreenChannelBase::resetPositionAndSize, this)); - } - // top and bottom set by updateBottom() setRect(LLRect(channel_left, 0, channel_right, 0)); updateBottom(); @@ -203,17 +179,6 @@ std::list<LLToast*> LLScreenChannel::findToasts(const Matcher& matcher) //-------------------------------------------------------------------------- void LLScreenChannel::updatePositionAndSize(LLRect old_world_rect, LLRect new_world_rect) { - /* - take sidetray into account - screenchannel should not overlap sidetray - */ - S32 world_rect_padding = 0; - if (gSavedSettings.getBOOL("SidebarCameraMovement") == FALSE - && LLSideTray::instanceCreated ()) - { - world_rect_padding += LLSideTray::getInstance()->getVisibleWidth(); - } - - LLRect this_rect = getRect(); switch(mChannelAlignment) @@ -226,7 +191,7 @@ void LLScreenChannel::updatePositionAndSize(LLRect old_world_rect, LLRect new_wo return; case CA_RIGHT : this_rect.mTop = (S32) (new_world_rect.getHeight() * getHeightRatio()); - this_rect.setLeftTopAndSize(new_world_rect.mRight - world_rect_padding - this_rect.getWidth(), + this_rect.setLeftTopAndSize(new_world_rect.mRight - this_rect.getWidth(), this_rect.mTop, this_rect.getWidth(), this_rect.getHeight()); diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h index d207d13981..8f11c82673 100644 --- a/indra/newview/llscreenchannel.h +++ b/indra/newview/llscreenchannel.h @@ -59,7 +59,6 @@ public: // Channel's outfit-functions // update channel's size and position in the World View virtual void updatePositionAndSize(LLRect old_world_rect, LLRect new_world_rect); - void resetPositionAndSize(); // initialization of channel's shape and position virtual void init(S32 channel_left, S32 channel_right); diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index a356013830..853656905c 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -42,7 +42,6 @@ #include "lloutfitobserver.h" #include "llpaneleditwearable.h" #include "llpaneloutfitsinventory.h" -#include "llsidetray.h" #include "lltextbox.h" #include "lluictrlfactory.h" #include "llviewercontrol.h" @@ -164,7 +163,6 @@ void LLSidepanelAppearance::onOpen(const LLSD& key) else { // Switch to the requested panel. - // *TODO: replace this crap with LLSideTrayPanelContainer std::string type = key["type"].asString(); if (type == "my_outfits") { diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 0226896f54..f9dc70ccc0 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -282,19 +282,20 @@ BOOL LLSidepanelInventory::postBuild() enableOutbox(gSavedSettings.getBOOL("InventoryDisplayOutbox")); // Trigger callback for after login so we can setup to track inbox and outbox changes after initial inventory load - LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLSidepanelInventory::handleLoginComplete, this)); + LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLSidepanelInventory::updateInboxOutbox, this)); } gSavedSettings.getControl("InventoryDisplayInbox")->getCommitSignal()->connect(boost::bind(&handleInventoryDisplayInboxChanged)); gSavedSettings.getControl("InventoryDisplayOutbox")->getCommitSignal()->connect(boost::bind(&handleInventoryDisplayOutboxChanged)); + updateInboxOutbox(); // Update the verbs buttons state. updateVerbs(); return TRUE; } -void LLSidepanelInventory::handleLoginComplete() +void LLSidepanelInventory::updateInboxOutbox() { // // Track inbox and outbox folder changes diff --git a/indra/newview/llsidepanelinventory.h b/indra/newview/llsidepanelinventory.h index b7d11f7f9b..4e34926a4b 100644 --- a/indra/newview/llsidepanelinventory.h +++ b/indra/newview/llsidepanelinventory.h @@ -47,7 +47,7 @@ public: virtual ~LLSidepanelInventory(); private: - void handleLoginComplete(); + void updateInboxOutbox(); public: void observeInboxOutboxCreation(); diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp deleted file mode 100644 index 55d6378ad8..0000000000 --- a/indra/newview/llsidetray.cpp +++ /dev/null @@ -1,1489 +0,0 @@ -/** - * @file llsidetray.cpp - * @brief SideBar implementation - * - * $LicenseInfo:firstyear=2009&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 "lltextbox.h" - -#include "llagentcamera.h" -#include "llappviewer.h" -#include "llbadge.h" -#include "llbottomtray.h" -#include "llfloaterreg.h" -#include "llfirstuse.h" -#include "llhints.h" -#include "llsidetray.h" -#include "llviewerwindow.h" -#include "llaccordionctrl.h" -#include "llfocusmgr.h" -#include "llrootview.h" -#include "llnavigationbar.h" -#include "llpanelmarketplaceinbox.h" - -#include "llaccordionctrltab.h" - -#include "llfloater.h" //for gFloaterView -#include "lliconctrl.h"//for OpenClose tab icon -#include "llsidetraypanelcontainer.h" -#include "llscreenchannel.h" -#include "llchannelmanager.h" -#include "llwindow.h"//for SetCursor -#include "lltransientfloatermgr.h" - -#include "llsidepanelappearance.h" - -#include "llsidetraylistener.h" - -//#include "llscrollcontainer.h" - -using namespace std; -using namespace LLNotificationsUI; - -class LLSideTrayButton; - -static LLRootViewRegistry::Register<LLSideTray> t1("side_tray"); -static LLDefaultChildRegistry::Register<LLSideTrayTab> t2("sidetray_tab"); - -static const S32 BOTTOM_BAR_PAD = 5; - -static const std::string COLLAPSED_NAME = "<<"; -static const std::string EXPANDED_NAME = ">>"; - -static const std::string TAB_PANEL_CAPTION_NAME = "sidetray_tab_panel"; -static const std::string TAB_PANEL_CAPTION_TITLE_BOX = "sidetray_tab_title"; - -LLSideTray* LLSideTray::sInstance = 0; - -static LLSideTrayListener sSideTrayListener(LLSideTray::getInstance); - -// static -LLSideTray* LLSideTray::getInstance() -{ - if (!sInstance) - { - sInstance = LLUICtrlFactory::createFromFile<LLSideTray>("panel_side_tray.xml",NULL, LLRootView::child_registry_t::instance()); - sInstance->setXMLFilename("panel_side_tray.xml"); - } - - return sInstance; -} - -// static -bool LLSideTray::instanceCreated () -{ - return sInstance!=0; -} - -////////////////////////////////////////////////////////////////////////////// -// LLSideTrayTab -// Represents a single tab in the side tray, only used by LLSideTray -////////////////////////////////////////////////////////////////////////////// - -class LLSideTrayTab: public LLPanel -{ - LOG_CLASS(LLSideTrayTab); - friend class LLUICtrlFactory; - friend class LLSideTray; -public: - - struct Params - : public LLInitParam::Block<Params, LLPanel::Params> - { - // image name - Optional<std::string> image; - Optional<std::string> image_selected; - Optional<std::string> tab_title; - Optional<std::string> description; - Optional<LLBadge::Params> badge; - - Params() - : image("image"), - image_selected("image_selected"), - tab_title("tab_title","no title"), - description("description","no description"), - badge("badge") - {}; - }; -protected: - LLSideTrayTab(const Params& params); - - void dock(LLFloater* floater_tab); - void undock(LLFloater* floater_tab); - - LLSideTray* getSideTray(); - -public: - virtual ~LLSideTrayTab(); - - /*virtual*/ BOOL postBuild (); - /*virtual*/ bool addChild (LLView* view, S32 tab_group); - - - void reshape (S32 width, S32 height, BOOL called_from_parent = TRUE); - - static LLSideTrayTab* createInstance (); - - const std::string& getDescription () const { return mDescription;} - - void onOpen (const LLSD& key); - - void toggleTabDocked(bool toggle_floater = true); - void setDocked(bool dock); - bool isDocked() const; - - BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - - LLPanel* getPanel(); - - LLButton* createButton(bool allowTearOff, LLUICtrl::commit_callback_t callback); - -private: - std::string mTabTitle; - std::string mImage; - std::string mImageSelected; - std::string mDescription; - - LLView* mMainPanel; - - bool mHasBadge; - LLBadge::Params mBadgeParams; - LLSideTrayButton* mSideTrayButton; -}; - -////////////////////////////////////////////////////////////////////////////// -// LLSideTrayButton -// Side Tray tab button with "tear off" handling. -////////////////////////////////////////////////////////////////////////////// - -class LLSideTrayButton : public LLButton -{ -public: - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) - { - // Route future Mouse messages here preemptively. (Release on mouse up.) - // No handler needed for focus lost since this class has no state that depends on it. - gFocusMgr.setMouseCapture(this); - - localPointToScreen(x, y, &mDragLastScreenX, &mDragLastScreenY); - - // Note: don't pass on to children - return TRUE; - } - - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) - { - // We only handle the click if the click both started and ended within us - if( !hasMouseCapture() ) return FALSE; - - S32 screen_x; - S32 screen_y; - localPointToScreen(x, y, &screen_x, &screen_y); - - S32 delta_x = screen_x - mDragLastScreenX; - S32 delta_y = screen_y - mDragLastScreenY; - - LLSideTray* side_tray = LLSideTray::getInstance(); - - // Check if the tab we are dragging is docked. - if (!side_tray->isTabAttached(mTabName)) return FALSE; - - // Same value is hardcoded in LLDragHandle::handleHover(). - const S32 undock_threshold = 12; - - // Detach a tab if it has been pulled further than undock_threshold. - if (delta_x <= -undock_threshold || delta_x >= undock_threshold || - delta_y <= -undock_threshold || delta_y >= undock_threshold) - { - LLSideTrayTab* tab = side_tray->getTab(mTabName); - if (!tab) return FALSE; - - tab->setDocked(false); - - LLFloater* floater_tab = LLFloaterReg::getInstance("side_bar_tab", tab->getName()); - if (!floater_tab) return FALSE; - - LLRect original_rect = floater_tab->getRect(); - S32 header_snap_y = floater_tab->getHeaderHeight() / 2; - S32 snap_x = screen_x - original_rect.mLeft - original_rect.getWidth() / 2; - S32 snap_y = screen_y - original_rect.mTop + header_snap_y; - - // Move the floater to appear "under" the mouse pointer. - floater_tab->setRect(original_rect.translate(snap_x, snap_y)); - - // Snap the mouse pointer to the center of the floater header - // and call 'mouse down' event handler to begin dragging. - floater_tab->handleMouseDown(original_rect.getWidth() / 2, - original_rect.getHeight() - header_snap_y, - mask); - - return TRUE; - } - - return FALSE; - } - - void setBadgeDriver(LLSideTrayTabBadgeDriver* driver) - { - mBadgeDriver = driver; - } - - void setVisible(BOOL visible) - { - setBadgeVisibility(visible); - - LLButton::setVisible(visible); - } - -protected: - LLSideTrayButton(const LLButton::Params& p) - : LLButton(p) - , mDragLastScreenX(0) - , mDragLastScreenY(0) - , mBadgeDriver(NULL) - { - // Find out the tab name to use in handleHover(). - size_t pos = getName().find("_button"); - llassert(pos != std::string::npos); - mTabName = getName().substr(0, pos); - } - - friend class LLUICtrlFactory; - - void draw() - { - if (mBadgeDriver) - { - setBadgeLabel(mBadgeDriver->getBadgeString()); - } - - LLButton::draw(); - } - -private: - S32 mDragLastScreenX; - S32 mDragLastScreenY; - - std::string mTabName; - LLSideTrayTabBadgeDriver* mBadgeDriver; -}; - - -//////////////////////////////////////////////////// -// LLSideTrayTab implementation -//////////////////////////////////////////////////// - -LLSideTrayTab::LLSideTrayTab(const Params& p) -: LLPanel(), - mTabTitle(p.tab_title), - mImage(p.image), - mImageSelected(p.image_selected), - mDescription(p.description), - mMainPanel(NULL), - mBadgeParams(p.badge), - mSideTrayButton(NULL) -{ - mHasBadge = p.badge.isProvided(); -} - -LLSideTrayTab::~LLSideTrayTab() -{ -} - -bool LLSideTrayTab::addChild(LLView* view, S32 tab_group) -{ - if(mMainPanel == 0 && TAB_PANEL_CAPTION_NAME != view->getName())//skip our caption panel - mMainPanel = view; - return LLPanel::addChild(view,tab_group); - //return res; -} - -//virtual -BOOL LLSideTrayTab::postBuild() -{ - LLPanel* title_panel = LLUICtrlFactory::getInstance()->createFromFile<LLPanel>("panel_side_tray_tab_caption.xml",this, child_registry_t::instance()); - string name = title_panel->getName(); - LLPanel::addChild(title_panel); - - title_panel->getChild<LLTextBox>(TAB_PANEL_CAPTION_TITLE_BOX)->setValue(mTabTitle); - - getChild<LLButton>("undock")->setCommitCallback(boost::bind(&LLSideTrayTab::setDocked, this, false)); - getChild<LLButton>("dock")->setCommitCallback(boost::bind(&LLSideTrayTab::setDocked, this, true)); - - return LLPanel::postBuild(); -} - -static const S32 splitter_margin = 1; - -void LLSideTrayTab::reshape (S32 width, S32 height, BOOL called_from_parent ) -{ - LLPanel::reshape(width, height, called_from_parent); - LLView* title_panel = findChildView(TAB_PANEL_CAPTION_NAME, true); - if (!title_panel) - { - // not fully constructed yet - return; - } - - S32 title_height = title_panel->getRect().getHeight(); - title_panel->setOrigin( 0, height - title_height ); - title_panel->reshape(width,title_height); - - LLRect sRect; - sRect.setLeftTopAndSize( splitter_margin, height - title_height - splitter_margin, - width - 2*splitter_margin, height - title_height - 2*splitter_margin); - mMainPanel->setShape(sRect); -} - -void LLSideTrayTab::onOpen (const LLSD& key) -{ - LLPanel *panel = getPanel(); - if(panel) - panel->onOpen(key); -} - -// Attempts to get the existing side tray instance. -// Needed to avoid recursive calls of LLSideTray::getInstance(). -LLSideTray* LLSideTrayTab::getSideTray() -{ - // First, check if the side tray is our parent (i.e. we're attached). - LLSideTray* side_tray = dynamic_cast<LLSideTray*>(getParent()); - if (!side_tray) - { - // Detached? Ok, check if the instance exists at all/ - if (LLSideTray::instanceCreated()) - { - side_tray = LLSideTray::getInstance(); - } - else - { - llerrs << "No safe way to get the side tray instance" << llendl; - } - } - - return side_tray; -} - -void LLSideTrayTab::toggleTabDocked(bool toggle_floater /* = true */) -{ - // *FIX: Calling this method twice per frame would crash the viewer. - - std::string tab_name = getName(); - - LLFloater* floater_tab = LLFloaterReg::getInstance("side_bar_tab", tab_name); - if (!floater_tab) return; - - bool docking = !isDocked(); - - if (mSideTrayButton) - { - mSideTrayButton->setVisible(docking); - } - - // Hide the "Tear Off" button when a tab gets undocked - // and show "Dock" button instead. - getChild<LLButton>("undock")->setVisible(docking); - getChild<LLButton>("dock")->setVisible(!docking); - - if (docking) - { - dock(floater_tab); - } - else - { - undock(floater_tab); - } - - // Open/close the floater *after* we reparent the tab panel, - // so that it doesn't receive redundant visibility change notifications. - if (toggle_floater) - { - LLFloaterReg::toggleInstance("side_bar_tab", tab_name); - } -} - -// Same as toggleTabDocked() apart from making sure that we do exactly what we want. -void LLSideTrayTab::setDocked(bool dock) -{ - if (isDocked() == dock) - { - llwarns << "Tab " << getName() << " is already " << (dock ? "docked" : "undocked") << llendl; - return; - } - - toggleTabDocked(); -} - -bool LLSideTrayTab::isDocked() const -{ - return dynamic_cast<LLSideTray*>(getParent()) != NULL; -} - -BOOL LLSideTrayTab::handleScrollWheel(S32 x, S32 y, S32 clicks) -{ - // Let children handle the event - LLUICtrl::handleScrollWheel(x, y, clicks); - - // and then eat it to prevent in-world scrolling (STORM-351). - return TRUE; -} - -void LLSideTrayTab::dock(LLFloater* floater_tab) -{ - LLSideTray* side_tray = getSideTray(); - if (!side_tray) return; - - // Before docking the tab, reset its (and its children's) transparency to default (STORM-688). - floater_tab->updateTransparency(TT_DEFAULT); - - if (!side_tray->addTab(this)) - { - llwarns << "Failed to add tab " << getName() << " to side tray" << llendl; - return; - } - - setRect(side_tray->getLocalRect()); - reshape(getRect().getWidth(), getRect().getHeight()); - - // Select the re-docked tab. - side_tray->selectTabByName(getName()); - - if (side_tray->getCollapsed()) - { - side_tray->expandSideBar(false); - } -} - -static void on_minimize(LLSidepanelAppearance* panel, LLSD minimized) -{ - if (!panel) return; - bool visible = !minimized.asBoolean(); - LLSD visibility; - visibility["visible"] = visible; - // Do not reset accordion state on minimize (STORM-375) - visibility["reset_accordion"] = false; - panel->updateToVisibility(visibility); -} - -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. - if (!side_tray->removeTab(this)) - { - llwarns << "Failed to remove tab " << getName() << " from side tray" << llendl; - return; - } - - // 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); - floater_tab->setName(getName()); - - // Resize handles get obscured by added panel so move them to front. - floater_tab->moveResizeHandlesToFront(); - - // Reshape the floater if needed. - LLRect floater_rect; - if (floater_tab->hasSavedRect()) - { - // We've got saved rect for the floater, hence no need to reshape it. - floater_rect = floater_tab->getLocalRect(); - } - else - { - // Detaching for the first time. Reshape the floater. - floater_rect = side_tray->getLocalRect(); - - // Reduce detached floater height by small BOTTOM_BAR_PAD not to make it flush with the bottom bar. - floater_rect.mBottom += LLBottomTray::getInstance()->getRect().getHeight() + BOTTOM_BAR_PAD; - floater_rect.makeValid(); - floater_tab->reshape(floater_rect.getWidth(), floater_rect.getHeight()); - } - - // Reshape the panel. - { - LLRect panel_rect = floater_tab->getLocalRect(); - panel_rect.mTop -= floater_tab->getHeaderHeight(); - panel_rect.makeValid(); - setRect(panel_rect); - reshape(panel_rect.getWidth(), panel_rect.getHeight()); - } - - // Set FOLLOWS_ALL flag for the tab to follow floater dimensions upon resizing. - setFollowsAll(); - - // Camera view may need to be changed for appearance panel(STORM-301) on minimize of floater, - // so setting callback here. - if (getName() == "sidebar_appearance") - { - LLSidepanelAppearance* panel_appearance = dynamic_cast<LLSidepanelAppearance*>(getPanel()); - if(panel_appearance) - { - floater_tab->setMinimizeCallback(boost::bind(&on_minimize, panel_appearance, _2)); - } - } - - if (!side_tray->getCollapsed()) - { - side_tray->collapseSideBar(); - } - - 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. - onOpen(LLSD()); - } -} - -LLPanel* LLSideTrayTab::getPanel() -{ - LLPanel* panel = dynamic_cast<LLPanel*>(mMainPanel); - return panel; -} - -LLSideTrayTab* LLSideTrayTab::createInstance () -{ - LLSideTrayTab::Params tab_params; - tab_params.tab_title("openclose"); - - LLSideTrayTab* tab = LLUICtrlFactory::create<LLSideTrayTab>(tab_params); - return tab; -} - -// Now that we know the definition of LLSideTrayTab, we can implement -// tab_cast. -template <> -LLPanel* tab_cast<LLPanel*>(LLSideTrayTab* tab) { return tab; } - -////////////////////////////////////////////////////////////////////////////// -// LLSideTray -////////////////////////////////////////////////////////////////////////////// - -LLSideTray::Params::Params() -: collapsed("collapsed",false), - tab_btn_image_normal("tab_btn_image",LLUI::getUIImage("taskpanel/TaskPanel_Tab_Off.png")), - tab_btn_image_selected("tab_btn_image_selected",LLUI::getUIImage("taskpanel/TaskPanel_Tab_Selected.png")), - default_button_width("tab_btn_width",32), - default_button_height("tab_btn_height",32), - default_button_margin("tab_btn_margin",0) -{} - -//virtual -LLSideTray::LLSideTray(const Params& params) - : LLPanel(params) - ,mActiveTab(0) - ,mCollapsed(false) - ,mCollapseButton(0) -{ - mCollapsed=params.collapsed; - - LLUICtrl::CommitCallbackRegistry::Registrar& commit = LLUICtrl::CommitCallbackRegistry::currentRegistrar(); - - // register handler function to process data from the xml. - // panel_name should be specified via "parameter" attribute. - commit.add("SideTray.ShowPanel", boost::bind(&LLSideTray::showPanel, this, _2, LLUUID::null)); - commit.add("SideTray.Toggle", boost::bind(&LLSideTray::onToggleCollapse, this)); - commit.add("SideTray.Collapse", boost::bind(&LLSideTray::collapseSideBar, this)); - LLTransientFloaterMgr::getInstance()->addControlView(this); - LLView* side_bar_tabs = gViewerWindow->getRootView()->getChildView("side_bar_tabs"); - if (side_bar_tabs != NULL) - { - LLTransientFloaterMgr::getInstance()->addControlView(side_bar_tabs); - } - - LLPanel::Params p; - p.name = "buttons_panel"; - p.mouse_opaque = false; - mButtonsPanel = LLUICtrlFactory::create<LLPanel>(p); -} - - -BOOL LLSideTray::postBuild() -{ - createButtons(); - - arrange(); - selectTabByName("sidebar_home"); - - if(mCollapsed) - collapseSideBar(); - - setMouseOpaque(false); - - LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLSideTray::handleLoginComplete, this)); - - // Remember original tabs order, so that we can restore it if user detaches and then re-attaches a tab. - for (child_vector_const_iter_t it = mTabs.begin(); it != mTabs.end(); ++it) - { - std::string tab_name = (*it)->getName(); - mOriginalTabOrder.push_back(tab_name); - } - - //EXT-8045 - //connect all already created channels to reflect sidetray collapse/expand - std::vector<LLChannelManager::ChannelElem>& channels = LLChannelManager::getInstance()->getChannelList(); - for(std::vector<LLChannelManager::ChannelElem>::iterator it = channels.begin();it!=channels.end();++it) - { - if ((*it).channel) - { - setVisibleWidthChangeCallback(boost::bind(&LLScreenChannelBase::resetPositionAndSize, (*it).channel)); - } - } - - return true; -} - -void LLSideTray::setTabButtonBadgeDriver(std::string tabName, LLSideTrayTabBadgeDriver* driver) -{ - mTabButtonBadgeDrivers[tabName] = driver; -} - -void LLSideTray::handleLoginComplete() -{ - //reset tab to "home" tab if it was changesd during login process - selectTabByName("sidebar_home"); - - for (badge_map_t::iterator it = mTabButtonBadgeDrivers.begin(); it != mTabButtonBadgeDrivers.end(); ++it) - { - LLButton* button = mTabButtons[it->first]; - LLSideTrayButton* side_button = dynamic_cast<LLSideTrayButton*>(button); - - if (side_button) - { - side_button->setBadgeDriver(it->second); - } - else - { - llwarns << "Unable to find button " << it->first << " to set the badge driver. " << llendl; - } - } - - detachTabs(); -} - -LLSideTrayTab* LLSideTray::getTab(const std::string& name) -{ - return findChild<LLSideTrayTab>(name,false); -} - -bool LLSideTray::isTabAttached(const std::string& name) -{ - LLSideTrayTab* tab = getTab(name); - llassert(tab); - if (!tab) return false; - - return std::find(mTabs.begin(), mTabs.end(), tab) != mTabs.end(); -} - -bool LLSideTray::hasTabs() -{ - // The open/close tab doesn't count. - return mTabs.size() > 1; -} - -void LLSideTray::toggleTabButton(LLSideTrayTab* tab) -{ - if(tab == NULL) - return; - std::string name = tab->getName(); - std::map<std::string,LLButton*>::iterator it = mTabButtons.find(name); - if(it != mTabButtons.end()) - { - LLButton* btn = it->second; - bool new_state = !btn->getToggleState(); - btn->setToggleState(new_state); - // Only highlight the tab if side tray is expanded (STORM-157). - btn->setImageOverlay( new_state && !getCollapsed() ? tab->mImageSelected : tab->mImage ); - } -} - -LLPanel* LLSideTray::openChildPanel(LLSideTrayTab* tab, const std::string& panel_name, const LLSD& params) -{ - LLView* view = tab->findChildView(panel_name, true); - if (!view) return NULL; - - std::string tab_name = tab->getName(); - - bool tab_attached = isTabAttached(tab_name); - - if (tab_attached && LLUI::sSettingGroups["config"]->getBOOL("OpenSidePanelsInFloaters")) - { - tab->setDocked(false); - tab_attached = false; - } - - // Select tab and expand Side Tray only when a tab is attached. - if (tab_attached) - { - selectTabByName(tab_name); - if (mCollapsed) - expandSideBar(); - } - else - { - LLFloater* floater_tab = LLFloaterReg::getInstance("side_bar_tab", tab_name); - if (!floater_tab) return NULL; - - floater_tab->openFloater(tab_name); - } - - LLSideTrayPanelContainer* container = dynamic_cast<LLSideTrayPanelContainer*>(view->getParent()); - if (container) - { - LLSD new_params = params; - new_params[LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME] = panel_name; - container->onOpen(new_params); - - return container->getCurrentPanel(); - } - - LLPanel* panel = dynamic_cast<LLPanel*>(view); - if (panel) - { - panel->onOpen(params); - } - - return panel; -} - -bool LLSideTray::selectTabByIndex(size_t index) -{ - if(index>=mTabs.size()) - return false; - - LLSideTrayTab* sidebar_tab = mTabs[index]; - return selectTabByName(sidebar_tab->getName()); -} - -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; - - // Bail out if already selected. - if (new_tab == mActiveTab) - return false; - - //deselect old tab - if (mActiveTab) - { - // Keep previously active tab visible if requested. - if (keep_prev_visible) tab_to_keep_visible = mActiveTab; - toggleTabButton(mActiveTab); - } - - //select new tab - mActiveTab = new_tab; - - if (mActiveTab) - { - toggleTabButton(mActiveTab); - LLSD key;//empty - mActiveTab->onOpen(key); - } - - //arrange(); - - //hide all tabs - show active tab - child_vector_const_iter_t child_it; - 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. - vis &= (*child_it)->getName() != "sidebar_openclose"; - - sidebar_tab->setVisible(vis); - } - return true; -} - -bool LLSideTray::addChild(LLView* view, S32 tab_group) -{ - LLSideTrayTab* tab_panel = dynamic_cast<LLSideTrayTab*>(view); - - if (tab_panel) - { - mTabs.push_back(tab_panel); - } - - return LLUICtrl::addChild(view, tab_group); -} - -bool LLSideTray::removeTab(LLSideTrayTab* tab) -{ - if (!tab) return false; - std::string tab_name = tab->getName(); - - // Look up the tab in the list of known tabs. - child_vector_iter_t tab_it = std::find(mTabs.begin(), mTabs.end(), tab); - if (tab_it == mTabs.end()) - { - llwarns << "Cannot find tab named " << tab_name << llendl; - return false; - } - - // Find the button corresponding to the tab. - button_map_t::iterator btn_it = mTabButtons.find(tab_name); - if (btn_it == mTabButtons.end()) - { - llwarns << "Cannot find button for tab named " << tab_name << llendl; - return false; - } - LLButton* btn = btn_it->second; - - // Deselect the tab. - if (mActiveTab == tab) - { - // Select the next tab (or first one, if we're removing the last tab), - // skipping the fake open/close tab (STORM-155). - child_vector_iter_t next_tab_it = tab_it; - do - { - next_tab_it = (next_tab_it < (mTabs.end() - 1)) ? next_tab_it + 1 : mTabs.begin(); - } - while ((*next_tab_it)->getName() == "sidebar_openclose"); - - selectTabByName((*next_tab_it)->getName(), true); // Don't hide the tab being removed. - } - - // Remove the tab. - removeChild(tab); - mTabs.erase(tab_it); - - // Add the tab to detached tabs list. - mDetachedTabs.push_back(tab); - - // Remove the button from the buttons panel so that it isn't drawn anymore. - mButtonsPanel->removeChild(btn); - - // Re-arrange remaining tabs. - arrange(); - - return true; -} - -bool LLSideTray::addTab(LLSideTrayTab* tab) -{ - if (tab == NULL) return false; - - std::string tab_name = tab->getName(); - - // Make sure the tab isn't already in the list. - if (std::find(mTabs.begin(), mTabs.end(), tab) != mTabs.end()) - { - llwarns << "Attempt to re-add existing tab " << tab_name << llendl; - return false; - } - - // Look up the corresponding button. - button_map_t::const_iterator btn_it = mTabButtons.find(tab_name); - if (btn_it == mTabButtons.end()) - { - llwarns << "Tab " << tab_name << " has no associated button" << llendl; - return false; - } - LLButton* btn = btn_it->second; - - // Insert the tab at its original position. - LLUICtrl::addChild(tab); - { - tab_order_vector_const_iter_t new_tab_orig_pos = - std::find(mOriginalTabOrder.begin(), mOriginalTabOrder.end(), tab_name); - llassert(new_tab_orig_pos != mOriginalTabOrder.end()); - child_vector_iter_t insert_pos = mTabs.end(); - - for (child_vector_iter_t tab_it = mTabs.begin(); tab_it != mTabs.end(); ++tab_it) - { - tab_order_vector_const_iter_t cur_tab_orig_pos = - std::find(mOriginalTabOrder.begin(), mOriginalTabOrder.end(), (*tab_it)->getName()); - llassert(cur_tab_orig_pos != mOriginalTabOrder.end()); - - if (new_tab_orig_pos < cur_tab_orig_pos) - { - insert_pos = tab_it; - break; - } - } - - mTabs.insert(insert_pos, tab); - } - - // Add the button to the buttons panel so that it's drawn again. - mButtonsPanel->addChildInBack(btn); - - // Arrange tabs after inserting a new one. - arrange(); - - // Remove the tab from the list of detached tabs. - child_vector_iter_t tab_it = std::find(mDetachedTabs.begin(), mDetachedTabs.end(), tab); - if (tab_it != mDetachedTabs.end()) - { - mDetachedTabs.erase(tab_it); - } - - return true; -} - -LLButton* LLSideTrayTab::createButton(bool allowTearOff, LLUICtrl::commit_callback_t callback) -{ - static LLSideTray::Params sidetray_params(LLUICtrlFactory::getDefaultParams<LLSideTray>()); - - LLRect rect; - rect.setOriginAndSize(0, 0, sidetray_params.default_button_width, sidetray_params.default_button_height); - - LLButton::Params bparams; - - // Append "_button" to the side tray tab name - std::string button_name = getName() + "_button"; - bparams.name(button_name); - bparams.follows.flags (FOLLOWS_LEFT | FOLLOWS_TOP); - bparams.rect (rect); - bparams.tab_stop(false); - bparams.image_unselected(sidetray_params.tab_btn_image_normal); - bparams.image_selected(sidetray_params.tab_btn_image_selected); - bparams.image_disabled(sidetray_params.tab_btn_image_normal); - bparams.image_disabled_selected(sidetray_params.tab_btn_image_selected); - - if (mHasBadge) - { - bparams.badge = mBadgeParams; - } - - LLButton* button; - if (allowTearOff) - { - mSideTrayButton = LLUICtrlFactory::create<LLSideTrayButton>(bparams); - - button = mSideTrayButton; - } - else - { - // "Open/Close" button shouldn't allow "tear off" - // hence it is created as LLButton instance. - button = LLUICtrlFactory::create<LLButton>(bparams); - } - - button->setClickedCallback(callback); - - button->setToolTip(mTabTitle); - - if(mImage.length()) - { - button->setImageOverlay(mImage); - } - - return button; -} - -void LLSideTray::createButtons() -{ - //create buttons for tabs - child_vector_const_iter_t child_it = mTabs.begin(); - for ( ; child_it != mTabs.end(); ++child_it) - { - LLSideTrayTab* sidebar_tab = *child_it; - - std::string name = sidebar_tab->getName(); - - // The "OpenClose" button will open/close the whole panel - if (name == "sidebar_openclose") - { - mCollapseButton = sidebar_tab->createButton(false, boost::bind(&LLSideTray::onToggleCollapse, this)); - - mButtonsPanel->addChildInBack(mCollapseButton); - - LLHints::registerHintTarget("side_panel_btn", mCollapseButton->getHandle()); - } - else - { - LLButton* button = sidebar_tab->createButton(true, boost::bind(&LLSideTray::onTabButtonClick, this, name)); - - mButtonsPanel->addChildInBack(button); - - mTabButtons[name] = button; - } - } - - LLHints::registerHintTarget("inventory_btn", mTabButtons["sidebar_inventory"]->getHandle()); -} - -void LLSideTray::processTriState () -{ - if(mCollapsed) - expandSideBar(); - else - { -#if 0 // *TODO: EXT-2092 - - // Tell the active task panel to switch to its default view - // or collapse side tray if already on the default view. - LLSD info; - info["task-panel-action"] = "handle-tri-state"; - mActiveTab->notifyChildren(info); -#else - collapseSideBar(); -#endif - } -} - -void LLSideTray::onTabButtonClick(string name) -{ - LLSideTrayTab* tab = getTab(name); - if (!tab) return; - - if(tab == mActiveTab) - { - processTriState (); - return; - } - selectTabByName (name); - if(mCollapsed) - expandSideBar(); -} - -void LLSideTray::onToggleCollapse() -{ - LLFirstUse::notUsingSidePanel(false); - if(mCollapsed) - { - expandSideBar(); - //selectTabByName("sidebar_openclose"); - } - else - collapseSideBar(); -} - - -void LLSideTray::reflectCollapseChange() -{ - updateSidetrayVisibility(); - - setFocus(!mCollapsed); - - gFloaterView->refresh(); -} - -void LLSideTray::arrange() -{ - static LLSideTray::Params sidetray_params(LLUICtrlFactory::getDefaultParams<LLSideTray>()); - - updateSidetrayVisibility(); - - LLRect ctrl_rect; - ctrl_rect.setLeftTopAndSize(0, - mButtonsPanel->getRect().getHeight() - sidetray_params.default_button_width, - sidetray_params.default_button_width, - sidetray_params.default_button_height); - - mCollapseButton->setRect(ctrl_rect); - - //arrange tab buttons - //arrange tab buttons - child_vector_const_iter_t child_it; - int offset = (sidetray_params.default_button_height+sidetray_params.default_button_margin)*2; - for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) - { - LLSideTrayTab* sidebar_tab = *child_it; - - ctrl_rect.setLeftTopAndSize(0, - mButtonsPanel->getRect().getHeight()-offset, - sidetray_params.default_button_width, - sidetray_params.default_button_height); - - if(mTabButtons.find(sidebar_tab->getName()) == mTabButtons.end()) - continue; - - LLButton* btn = mTabButtons[sidebar_tab->getName()]; - - btn->setRect(ctrl_rect); - offset+=sidetray_params.default_button_height; - offset+=sidetray_params.default_button_margin; - - btn->setVisible(ctrl_rect.mBottom > 0); - } - - //arrange tabs - for ( child_vector_t::iterator child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) - { - LLSideTrayTab* sidebar_tab = *child_it; - sidebar_tab->setShape(getLocalRect()); - } - - // The tab buttons should be shown only if there is at least one non-detached tab. - // Also hide them in mouse-look mode. - mButtonsPanel->setVisible(hasTabs() && !gAgentCamera.cameraMouselook()); -} - -// Detach those tabs that were detached when the viewer exited last time. -void LLSideTray::detachTabs() -{ - // copy mTabs because LLSideTray::toggleTabDocked() modifies it. - child_vector_t tabs = mTabs; - - for (child_vector_const_iter_t it = tabs.begin(); it != tabs.end(); ++it) - { - LLSideTrayTab* tab = *it; - - std::string floater_ctrl_name = LLFloater::getControlName("side_bar_tab", LLSD(tab->getName())); - std::string vis_ctrl_name = LLFloaterReg::getVisibilityControlName(floater_ctrl_name); - if (!LLFloater::getControlGroup()->controlExists(vis_ctrl_name)) continue; - - bool is_visible = LLFloater::getControlGroup()->getBOOL(vis_ctrl_name); - if (!is_visible) continue; - - llassert(isTabAttached(tab->getName())); - tab->setDocked(false); - } -} - -void LLSideTray::collapseSideBar() -{ - mCollapsed = true; - // Reset all overlay images, because there is no "selected" tab when the - // whole side tray is hidden. - child_vector_const_iter_t it = mTabs.begin(); - for ( ; it != mTabs.end(); ++it ) - { - LLSideTrayTab* tab = *it; - std::string name = tab->getName(); - std::map<std::string,LLButton*>::const_iterator btn_it = - mTabButtons.find(name); - if (btn_it != mTabButtons.end()) - { - LLButton* btn = btn_it->second; - btn->setImageOverlay( tab->mImage ); - } - } - - // OpenClose tab doesn't put its button in mTabButtons - LLSideTrayTab* openclose_tab = getTab("sidebar_openclose"); - if (openclose_tab) - { - mCollapseButton->setImageOverlay( openclose_tab->mImage ); - } - //mActiveTab->setVisible(FALSE); - reflectCollapseChange(); - setFocus( FALSE ); -} - -void LLSideTray::expandSideBar(bool open_active) -{ - mCollapsed = false; - LLSideTrayTab* openclose_tab = getTab("sidebar_openclose"); - if (openclose_tab) - { - mCollapseButton->setImageOverlay( openclose_tab->mImageSelected ); - } - - if (open_active) - { - mActiveTab->onOpen(LLSD()); - } - - reflectCollapseChange(); - - - std::string name = mActiveTab->getName(); - std::map<std::string,LLButton*>::const_iterator btn_it = - mTabButtons.find(name); - if (btn_it != mTabButtons.end()) - { - LLButton* btn = btn_it->second; - btn->setImageOverlay( mActiveTab->mImageSelected ); - } -} - -void LLSideTray::highlightFocused() -{ - /* uncomment in case something change - if(!mActiveTab) - return; - BOOL dependent_has_focus = gFocusMgr.childHasKeyboardFocus(this); - setBackgroundOpaque( dependent_has_focus ); - mActiveTab->setBackgroundOpaque( dependent_has_focus ); - */ -} - -//virtual -BOOL LLSideTray::handleMouseDown (S32 x, S32 y, MASK mask) -{ - BOOL ret = LLPanel::handleMouseDown(x,y,mask); - if(ret) - setFocus(true); - return ret; -} - -void LLSideTray::reshape(S32 width, S32 height, BOOL called_from_parent) -{ - LLPanel::reshape(width, height, called_from_parent); - if(!mActiveTab) - return; - - arrange(); -} - -// This is just LLView::findChildView specialized to restrict the search to LLPanels. -// Optimization for EXT-4068 to avoid searching down to the individual item level -// when inventories are large. -LLPanel *findChildPanel(LLPanel *panel, const std::string& name, bool recurse) -{ - for (LLView::child_list_const_iter_t child_it = panel->beginChild(); - child_it != panel->endChild(); ++child_it) - { - LLPanel *child_panel = dynamic_cast<LLPanel*>(*child_it); - if (!child_panel) - continue; - if (child_panel->getName() == name) - return child_panel; - } - if (recurse) - { - for (LLView::child_list_const_iter_t child_it = panel->beginChild(); - child_it != panel->endChild(); ++child_it) - { - LLPanel *child_panel = dynamic_cast<LLPanel*>(*child_it); - if (!child_panel) - continue; - LLPanel *found_panel = findChildPanel(child_panel,name,recurse); - if (found_panel) - { - return found_panel; - } - } - } - return NULL; -} - -/** - * Activate tab with "panel_name" panel - * if no such tab - return false, otherwise true. - * TODO* In some cases a pointer to a panel of - * a specific class may be needed so this method - * would need to use templates. - */ -LLPanel* LLSideTray::showPanel (const std::string& panel_name, const LLSD& params) -{ - LLPanel* new_panel = NULL; - - // Look up the tab in the list of detached tabs. - child_vector_const_iter_t child_it; - for ( child_it = mDetachedTabs.begin(); child_it != mDetachedTabs.end(); ++child_it) - { - new_panel = openChildPanel(*child_it, panel_name, params); - if (new_panel) break; - } - - // Look up the tab in the list of attached tabs. - for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) - { - new_panel = openChildPanel(*child_it, panel_name, params); - if (new_panel) break; - } - - return new_panel; -} - -bool LLSideTray::hidePanel(const std::string& panel_name) -{ - bool panelHidden = false; - - LLPanel* panelp = getPanel(panel_name); - - if (panelp) - { - LLView* parentp = panelp->getParent(); - - // Collapse the side bar if the panel or the panel's parent is an attached tab - if (isTabAttached(panel_name) || (parentp && isTabAttached(parentp->getName()))) - { - collapseSideBar(); - panelHidden = true; - } - else - { - panelHidden = LLFloaterReg::hideInstance("side_bar_tab", panel_name); - - if (!panelHidden) - { - // Look up the panel in the list of detached tabs. - for (child_vector_const_iter_t child_it = mDetachedTabs.begin(); child_it != mDetachedTabs.end(); ++child_it) - { - LLPanel *detached_panel = dynamic_cast<LLPanel*>(*child_it); - - if (detached_panel) - { - // Hide this detached panel if it is a parent of our panel - if (findChildPanel(detached_panel, panel_name, true) != NULL) - { - panelHidden = LLFloaterReg::hideInstance("side_bar_tab", detached_panel->getName()); - break; - } - } - } - } - } - } - - return panelHidden; -} - -void LLSideTray::togglePanel(LLPanel* &sub_panel, const std::string& panel_name, const LLSD& params) -{ - if(!sub_panel) - return; - - // If a panel is visible and attached to Side Tray (has LLSideTray among its ancestors) - // it should be toggled off by collapsing Side Tray. - if (sub_panel->isInVisibleChain() && sub_panel->hasAncestor(this)) - { - LLSideTray::getInstance()->collapseSideBar(); - } - else - { - LLSideTray::getInstance()->showPanel(panel_name, params); - } -} - -LLPanel* LLSideTray::getPanel(const std::string& panel_name) -{ - // Look up the panel in the list of detached tabs. - for ( child_vector_const_iter_t child_it = mDetachedTabs.begin(); child_it != mDetachedTabs.end(); ++child_it) - { - LLPanel *panel = findChildPanel(*child_it,panel_name,true); - if(panel) - { - return panel; - } - } - - // Look up the panel in the list of attached tabs. - for ( child_vector_const_iter_t child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) - { - LLPanel *panel = findChildPanel(*child_it,panel_name,true); - if(panel) - { - return panel; - } - } - return NULL; -} - -LLPanel* LLSideTray::getActivePanel() -{ - if (mActiveTab && !mCollapsed) - { - return mActiveTab->getPanel(); - } - return NULL; -} - -bool LLSideTray::isPanelActive(const std::string& panel_name) -{ - LLPanel *panel = getActivePanel(); - if (!panel) return false; - return (panel->getName() == panel_name); -} - -void LLSideTray::setTabDocked(const std::string& tab_name, bool dock, bool toggle_floater /* = true*/) -{ - // Lookup tab by name. - LLSideTrayTab* tab = getTab(tab_name); - if (!tab) - { // not a docked tab, look through detached tabs - for(child_vector_iter_t tab_it = mDetachedTabs.begin(), tab_end_it = mDetachedTabs.end(); - tab_it != tab_end_it; - ++tab_it) - { - if ((*tab_it)->getName() == tab_name) - { - tab = *tab_it; - break; - } - } - - } - - llassert(tab != NULL); - - // Toggle its dock state. - if (tab && tab->isDocked() != dock) - { - tab->toggleTabDocked(toggle_floater); - } -} - - -void LLSideTray::updateSidetrayVisibility() -{ - // set visibility of parent container based on collapsed state - LLView* parent = getParent(); - if (parent) - { - bool old_visibility = parent->getVisible(); - bool new_visibility = !mCollapsed && !gAgentCamera.cameraMouselook(); - - if (old_visibility != new_visibility) - { - parent->setVisible(new_visibility); - - // Signal change of visible width. - //llinfos << "Visible: " << new_visibility << llendl; - mVisibleWidthChangeSignal(this, new_visibility); - } - } -} - -S32 LLSideTray::getVisibleWidth() -{ - return (isInVisibleChain() && !mCollapsed) ? getRect().getWidth() : 0; -} - -void LLSideTray::setVisibleWidthChangeCallback(const commit_signal_t::slot_type& cb) -{ - mVisibleWidthChangeSignal.connect(cb); -} diff --git a/indra/newview/llsidetray.h b/indra/newview/llsidetray.h deleted file mode 100644 index 17158329dc..0000000000 --- a/indra/newview/llsidetray.h +++ /dev/null @@ -1,260 +0,0 @@ -/** - * @file LLSideTray.h - * @brief SideBar header file - * - * $LicenseInfo:firstyear=2004&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_LLSIDETRAY_H_ -#define LL_LLSIDETRAY_H_ - -#include "llpanel.h" -#include "string" - -class LLAccordionCtrl; -class LLSideTrayTab; - -// Define an interface for side tab button badge values -class LLSideTrayTabBadgeDriver -{ -public: - virtual std::string getBadgeString() const = 0; -}; - -// Deal with LLSideTrayTab being opaque. Generic do-nothing cast... -template <class T> -T tab_cast(LLSideTrayTab* tab) { return tab; } -// specialized for implementation in presence of LLSideTrayTab definition -template <> -LLPanel* tab_cast<LLPanel*>(LLSideTrayTab* tab); - -// added inheritance from LLDestroyClass<LLSideTray> to enable Side Tray perform necessary actions -// while disconnecting viewer in LLAppViewer::disconnectViewer(). -// LLDestroyClassList::instance().fireCallbacks() calls destroyClass method. See EXT-245. -class LLSideTray : public LLPanel, private LLDestroyClass<LLSideTray> -{ - friend class LLUICtrlFactory; - friend class LLDestroyClass<LLSideTray>; - friend class LLSideTrayTab; - friend class LLSideTrayButton; -public: - - LOG_CLASS(LLSideTray); - - struct Params - : public LLInitParam::Block<Params, LLPanel::Params> - { - // initial state - Optional<bool> collapsed; - Optional<LLUIImage*> tab_btn_image_normal, - tab_btn_image_selected; - - Optional<S32> default_button_width, - default_button_height, - default_button_margin; - - Params(); - }; - - static LLSideTray* getInstance (); - static bool instanceCreated (); -protected: - LLSideTray(const Params& params); - typedef std::vector<LLSideTrayTab*> child_vector_t; - typedef child_vector_t::iterator child_vector_iter_t; - typedef child_vector_t::const_iterator child_vector_const_iter_t; - typedef child_vector_t::reverse_iterator child_vector_reverse_iter_t; - typedef child_vector_t::const_reverse_iterator child_vector_const_reverse_iter_t; - typedef std::vector<std::string> tab_order_vector_t; - typedef tab_order_vector_t::const_iterator tab_order_vector_const_iter_t; - -public: - - // interface functions - - /** - * 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 - */ - bool selectTabByIndex(size_t index); - - /** - * Activate tab with "panel_name" panel - * if no such tab - return NULL, otherwise a pointer to the panel - * Pass params as array, or they may be overwritten(example - params["name"]="nearby") - */ - LLPanel* showPanel (const std::string& panel_name, const LLSD& params = LLSD()); - - bool hidePanel (const std::string& panel_name); - - /** - * Toggling Side Tray tab which contains "sub_panel" child of "panel_name" panel. - * If "sub_panel" is not visible Side Tray is opened to display it, - * otherwise Side Tray is collapsed. - * params are passed to "panel_name" panel onOpen(). - */ - void togglePanel (LLPanel* &sub_panel, const std::string& panel_name, const LLSD& params = LLSD()); - - /* - * get the panel (don't show it or do anything else with it) - */ - LLPanel* getPanel (const std::string& panel_name); - LLPanel* getActivePanel (); - bool isPanelActive (const std::string& panel_name); - - void setTabDocked(const std::string& tab_name, bool dock, bool toggle_floater = true); - - /* - * get the panel of given type T (don't show it or do anything else with it) - */ - template <typename T> - T* getPanel(const std::string& panel_name) - { - T* panel = dynamic_cast<T*>(getPanel(panel_name)); - if (!panel) - { - llwarns << "Child named \"" << panel_name << "\" of type " << typeid(T*).name() << " not found" << llendl; - return NULL; - } - return panel; - } - - /* - * collapse SideBar, hiding visible tab and moving tab buttons - * to the right corner of the screen - */ - void collapseSideBar (); - - /* - * expand SideBar - * - * @param open_active Whether to call onOpen() for the active tab. - */ - void expandSideBar(bool open_active = true); - - - /** - *hightlight if focused. manly copypaste from highlightFocusedFloater - */ - void highlightFocused(); - - void setVisible(BOOL visible) - { - if (getParent()) getParent()->setVisible(visible); - } - - LLPanel* getButtonsPanel() { return mButtonsPanel; } - - bool getCollapsed() { return mCollapsed; } - - void setTabButtonBadgeDriver(std::string tabName, LLSideTrayTabBadgeDriver* driver); - -public: - virtual ~LLSideTray(){}; - - virtual BOOL postBuild(); - - BOOL handleMouseDown (S32 x, S32 y, MASK mask); - - void reshape (S32 width, S32 height, BOOL called_from_parent = TRUE); - - - /** - * @return side tray width if it's visible and expanded, 0 otherwise. - * - * Not that width of the tab buttons is not included. - * - * @see setVisibleWidthChangeCallback() - */ - S32 getVisibleWidth(); - - void setVisibleWidthChangeCallback(const commit_signal_t::slot_type& cb); - - void updateSidetrayVisibility(); - - void handleLoginComplete(); - - bool isTabAttached (const std::string& name); - -protected: - bool addChild (LLView* view, S32 tab_group); - bool removeTab (LLSideTrayTab* tab); // Used to detach tabs temporarily - bool addTab (LLSideTrayTab* tab); // Used to re-attach tabs - bool hasTabs (); - - const LLSideTrayTab* getActiveTab() const { return mActiveTab; } - LLSideTrayTab* getTab(const std::string& name); - - void createButtons (); - - void arrange (); - void detachTabs (); - void reflectCollapseChange(); - void processTriState (); - - void toggleTabButton (LLSideTrayTab* tab); - - LLPanel* openChildPanel (LLSideTrayTab* tab, const std::string& panel_name, const LLSD& params); - - void onTabButtonClick(std::string name); - void onToggleCollapse(); - -private: - // Implementation of LLDestroyClass<LLSideTray> - static void destroyClass() - { - // Disable SideTray to avoid crashes. EXT-245 - if (LLSideTray::instanceCreated()) - LLSideTray::getInstance()->setEnabled(FALSE); - } - -private: - // Since we provide no public way to query mTabs and mDetachedTabs, give - // LLSideTrayListener friend access. - friend class LLSideTrayListener; - LLPanel* mButtonsPanel; - typedef std::map<std::string,LLButton*> button_map_t; - button_map_t mTabButtons; - typedef std::map<std::string,LLSideTrayTabBadgeDriver*> badge_map_t; - badge_map_t mTabButtonBadgeDrivers; - child_vector_t mTabs; - child_vector_t mDetachedTabs; - tab_order_vector_t mOriginalTabOrder; - LLSideTrayTab* mActiveTab; - - commit_signal_t mVisibleWidthChangeSignal; - - LLButton* mCollapseButton; - bool mCollapsed; - - static LLSideTray* sInstance; -}; - -#endif - diff --git a/indra/newview/llsidetraylistener.cpp b/indra/newview/llsidetraylistener.cpp deleted file mode 100644 index cd6fa28948..0000000000 --- a/indra/newview/llsidetraylistener.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/** - * @file llsidetraylistener.cpp - * @author Nat Goodspeed - * @date 2011-02-15 - * @brief Implementation for llsidetraylistener. - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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$ - */ - -// Precompiled header -#include "llviewerprecompiledheaders.h" -// associated header -#include "llsidetraylistener.h" -// STL headers -// std headers -// external library headers -// other Linden headers -#include "llsidetray.h" -#include "llsdutil.h" - -LLSideTrayListener::LLSideTrayListener(const Getter& getter): - LLEventAPI("LLSideTray", - "Operations on side tray (e.g. query state, query tabs)"), - mGetter(getter) -{ - add("getCollapsed", "Send on [\"reply\"] an [\"open\"] Boolean", - &LLSideTrayListener::getCollapsed, LLSDMap("reply", LLSD())); - add("getTabs", - "Send on [\"reply\"] a map of tab names and info about them", - &LLSideTrayListener::getTabs, LLSDMap("reply", LLSD())); - add("getPanels", - "Send on [\"reply\"] data about panels available with SideTray.ShowPanel", - &LLSideTrayListener::getPanels, LLSDMap("reply", LLSD())); -} - -void LLSideTrayListener::getCollapsed(const LLSD& event) const -{ - sendReply(LLSDMap("open", ! mGetter()->getCollapsed()), event); -} - -void LLSideTrayListener::getTabs(const LLSD& event) const -{ - LLSD reply; - - LLSideTray* tray = mGetter(); - LLSD::Integer ord(0); - for (LLSideTray::child_list_const_iter_t chi(tray->beginChild()), chend(tray->endChild()); - chi != chend; ++chi, ++ord) - { - LLView* child = *chi; - // How much info is important? Toss in as much as seems reasonable for - // each tab. But to me, at least for the moment, the most important - // item is the tab name. - LLSD info; - // I like the idea of returning a map keyed by tab name. But as - // compared to an array of maps, that loses sequence information. - // Address that by indicating the original order in each map entry. - info["ord"] = ord; - info["visible"] = bool(child->getVisible()); - info["enabled"] = bool(child->getEnabled()); - info["available"] = child->isAvailable(); - reply[child->getName()] = info; - } - - sendReply(reply, event); -} - -static LLSD getTabInfo(LLPanel* tab) -{ - LLSD panels; - for (LLPanel::tree_iterator_t ti(tab->beginTreeDFS()), tend(tab->endTreeDFS()); - ti != tend; ++ti) - { - // *ti is actually an LLView*, which had better not be NULL - LLView* view(*ti); - if (! view) - { - LL_ERRS("LLSideTrayListener") << "LLSideTrayTab '" << tab->getName() - << "' has a NULL child LLView*" << LL_ENDL; - } - - // The logic we use to decide what "panel" names to return is heavily - // based on LLSideTray::showPanel(): the function that actually - // implements the "SideTray.ShowPanel" operation. showPanel(), in - // turn, depends on LLSideTray::openChildPanel(): when - // openChildPanel() returns non-NULL, showPanel() stops searching - // attached and detached LLSideTrayTab tabs. - - // For each LLSideTrayTab, openChildPanel() first calls - // findChildView(panel_name, true). In other words, panel_name need - // not be a direct LLSideTrayTab child, it's sought recursively. - // That's why we use (begin|end)TreeDFS() in this loop. - - // But this tree_iterator_t loop will actually traverse every widget - // in every panel. Returning all those names will not help our caller: - // passing most such names to openChildPanel() would not do what we - // want. Even though the code suggests that passing ANY valid - // side-panel widget name to openChildPanel() will open the tab - // containing that widget, results could get confusing since followup - // (onOpen()) logic wouldn't be invoked, and showPanel() wouldn't stop - // searching because openChildPanel() would return NULL. - - // We must filter these LLView items, using logic that (sigh!) mirrors - // openChildPanel()'s own. - - // openChildPanel() returns a non-NULL LLPanel* when either: - // - the LLView is a direct child of an LLSideTrayPanelContainer - // - the LLView is itself an LLPanel. - // But as LLSideTrayPanelContainer can directly contain LLView items - // that are NOT themselves LLPanels (e.g. "sidebar_me" contains an - // LLButton called "Jump Right Arrow"), we'd better focus only on - // LLSideTrayPanelContainer children that are themselves LLPanel - // items. Which means that the second test completely subsumes the - // first. - LLPanel* panel(dynamic_cast<LLPanel*>(view)); - if (panel) - { - // Maybe it's overkill to construct an LLSD::Map for each panel, but - // the possibility remains that we might want to deliver more info - // about each panel than just its name. - panels.append(LLSDMap("name", panel->getName())); - } - } - - return LLSDMap("panels", panels); -} - -void LLSideTrayListener::getPanels(const LLSD& event) const -{ - LLSD reply; - - LLSideTray* tray = mGetter(); - // Iterate through the attached tabs. - LLSD::Integer ord(0); - for (LLSideTray::child_vector_t::const_iterator - ati(tray->mTabs.begin()), atend(tray->mTabs.end()); - ati != atend; ++ati) - { - // We don't have access to LLSideTrayTab: the class definition is - // hidden in llsidetray.cpp. But as LLSideTrayTab isa LLPanel, use the - // LLPanel API. Unfortunately, without the LLSideTrayTab definition, - // the compiler doesn't even know this LLSideTrayTab* is an LLPanel*. - // Persuade it. - LLPanel* tab(tab_cast<LLPanel*>(*ati)); - reply[tab->getName()] = getTabInfo(tab).with("attached", true).with("ord", ord); - } - - // Now iterate over the detached tabs. These can also be opened via - // SideTray.ShowPanel. - ord = 0; - for (LLSideTray::child_vector_t::const_iterator - dti(tray->mDetachedTabs.begin()), dtend(tray->mDetachedTabs.end()); - dti != dtend; ++dti) - { - LLPanel* tab(tab_cast<LLPanel*>(*dti)); - reply[tab->getName()] = getTabInfo(tab).with("attached", false).with("ord", ord); - } - - sendReply(reply, event); -} diff --git a/indra/newview/llsidetraylistener.h b/indra/newview/llsidetraylistener.h deleted file mode 100644 index 51e2137762..0000000000 --- a/indra/newview/llsidetraylistener.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @file llsidetraylistener.h - * @author Nat Goodspeed - * @date 2011-02-15 - * @brief - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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$ - */ - -#if ! defined(LL_LLSIDETRAYLISTENER_H) -#define LL_LLSIDETRAYLISTENER_H - -#include "lleventapi.h" -#include <boost/function.hpp> - -class LLSideTray; -class LLSD; - -class LLSideTrayListener: public LLEventAPI -{ - typedef boost::function<LLSideTray*()> Getter; - -public: - LLSideTrayListener(const Getter& getter); - -private: - void getCollapsed(const LLSD& event) const; - void getTabs(const LLSD& event) const; - void getPanels(const LLSD& event) const; - - Getter mGetter; -}; - -#endif /* ! defined(LL_LLSIDETRAYLISTENER_H) */ diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 749acea6c1..4511a4806a 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -131,7 +131,6 @@ #include "llsecondlifeurls.h" #include "llselectmgr.h" #include "llsky.h" -#include "llsidetray.h" #include "llstatview.h" #include "llstatusbar.h" // sendMoneyBalanceRequest(), owns L$ balance #include "llsurface.h" diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp index 477718d118..f6d7ceeec3 100644 --- a/indra/newview/llurldispatcher.cpp +++ b/indra/newview/llurldispatcher.cpp @@ -36,7 +36,6 @@ #include "llfloaterworldmap.h" #include "llpanellogin.h" #include "llregionhandle.h" -#include "llsidetray.h" #include "llslurl.h" #include "llstartup.h" // gStartupState #include "llweb.h" diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 0b3b8e23a5..174a4d6409 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -95,7 +95,6 @@ #include "llfloatersellland.h" #include "llfloatersettingsdebug.h" #include "llfloatersidepanelcontainer.h" -#include "llfloatersidetraytab.h" #include "llfloatersnapshot.h" #include "llfloatersounddevices.h" #include "llfloatertelehub.h" @@ -276,7 +275,6 @@ 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<LLFloaterSideTrayTab>); LLFloaterReg::add("sound_devices", "floater_sound_devices.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSoundDevices>); LLFloaterReg::add("stats", "floater_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloater>); LLFloaterReg::add("start_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterRunQueue>); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 50fb5a00e4..f8ef81b9f4 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -45,7 +45,6 @@ #include "llinventorymodel.h" #include "llinventorymodelbackgroundfetch.h" #include "llgesturemgr.h" -#include "llsidetray.h" #include "llinventorybridge.h" #include "llinventorypanel.h" diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 5e781e0e4c..fbfde711a9 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -83,7 +83,6 @@ #include "llrootview.h" #include "llsceneview.h" #include "llselectmgr.h" -#include "llsidetray.h" #include "llstatusbar.h" #include "lltextureview.h" #include "lltoolcomp.h" @@ -3348,15 +3347,6 @@ bool enable_sitdown_self() return isAgentAvatarValid() && !gAgentAvatarp->isSitting() && !gAgent.getFlying(); } -// Used from the login screen to aid in UI work on side tray -void handle_show_side_tray() -{ - LLSideTray* side_tray = LLSideTray::getInstance(); - LLView* root = gViewerWindow->getRootView(); - // automatically removes and re-adds if there already - root->addChild(side_tray); -} - // Toggle one of "People" panel tabs in side tray. class LLTogglePanelPeopleTab : public view_listener_t { @@ -3367,21 +3357,11 @@ class LLTogglePanelPeopleTab : public view_listener_t LLSD param; param["people_panel_tab_name"] = panel_name; - static LLPanel* friends_panel = NULL; - static LLPanel* groups_panel = NULL; - static LLPanel* nearby_panel = NULL; - - if (panel_name == "friends_panel") - { - return togglePeoplePanel(friends_panel, panel_name, param); - } - else if (panel_name == "groups_panel") - { - return togglePeoplePanel(groups_panel, panel_name, param); - } - else if (panel_name == "nearby_panel") + if ( panel_name == "friends_panel" + || panel_name == "groups_panel" + || panel_name == "nearby_panel") { - return togglePeoplePanel(nearby_panel, panel_name, param); + return togglePeoplePanel(panel_name, param); } else { @@ -3389,16 +3369,20 @@ class LLTogglePanelPeopleTab : public view_listener_t } } - static bool togglePeoplePanel(LLPanel* &panel, const std::string& panel_name, const LLSD& param) + static bool togglePeoplePanel(const std::string& panel_name, const LLSD& param) { + LLPanel *panel = LLFloaterSidePanelContainer::getPanel("people", panel_name); if(!panel) + return false; + + if (panel->isInVisibleChain()) { - panel = LLSideTray::getInstance()->getPanel(panel_name); - if(!panel) - return false; + LLFloaterReg::hideInstance("people"); + } + else + { + LLFloaterSidePanelContainer::showPanel("people", "panel_people", param) ; } - - LLSideTray::getInstance()->togglePanel(panel, "panel_people", param); return true; } @@ -8067,7 +8051,6 @@ void initialize_menus() view_listener_t::addMenu(new LLAdvancedCheckDebugKeys(), "Advanced.CheckDebugKeys"); view_listener_t::addMenu(new LLAdvancedToggleDebugWindowProc(), "Advanced.ToggleDebugWindowProc"); view_listener_t::addMenu(new LLAdvancedCheckDebugWindowProc(), "Advanced.CheckDebugWindowProc"); - commit.add("Advanced.ShowSideTray", boost::bind(&handle_show_side_tray)); // Advanced > XUI commit.add("Advanced.ReloadColorSettings", boost::bind(&LLUIColorTable::loadFromSettings, LLUIColorTable::getInstance())); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 5665a68add..1c07d36e7e 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -74,7 +74,6 @@ #include "llrecentpeople.h" #include "llscriptfloater.h" #include "llselectmgr.h" -#include "llsidetray.h" #include "llstartup.h" #include "llsky.h" #include "llslurl.h" @@ -6800,7 +6799,7 @@ void process_covenant_reply(LLMessageSystem* msg, void**) LLPanelLandCovenant::updateEstateOwnerName(owner_name); LLFloaterBuyLand::updateEstateOwnerName(owner_name); - LLPanelPlaceProfile* panel = LLSideTray::getInstance()->getPanel<LLPanelPlaceProfile>("panel_place_profile"); + LLPanelPlaceProfile* panel = LLFloaterSidePanelContainer::getPanel<LLPanelPlaceProfile>("places", "panel_place_profile"); if (panel) { panel->updateEstateName(estate_name); @@ -6934,7 +6933,7 @@ void onCovenantLoadComplete(LLVFS *vfs, LLPanelLandCovenant::updateCovenantText(covenant_text); LLFloaterBuyLand::updateCovenantText(covenant_text, asset_uuid); - LLPanelPlaceProfile* panel = LLSideTray::getInstance()->getPanel<LLPanelPlaceProfile>("panel_place_profile"); + LLPanelPlaceProfile* panel = LLFloaterSidePanelContainer::getPanel<LLPanelPlaceProfile>("places", "panel_place_profile"); if (panel) { panel->updateCovenantText(covenant_text); diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index b308e952ad..0a9fae68a6 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -51,7 +51,6 @@ #include "llpreviewtexture.h" #include "llscrollbar.h" #include "llscrollcontainer.h" -#include "llsidetray.h" #include "lltooldraganddrop.h" #include "lltooltip.h" #include "lltrans.h" diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 6c9ee17a76..149f9893d7 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -133,7 +133,6 @@ #include "llpreviewtexture.h" #include "llprogressview.h" #include "llresmgr.h" -#include "llsidetray.h" #include "llselectmgr.h" #include "llrootview.h" #include "llrendersphere.h" @@ -1773,7 +1772,6 @@ void LLViewerWindow::initBase() // placeholder widget that controls where "world" is rendered mWorldViewPlaceholder = main_view->getChildView("world_view_rect")->getHandle(); - mNonSideTrayView = main_view->getChildView("non_side_tray_view")->getHandle(); mFloaterViewHolder = main_view->getChildView("floater_view_holder")->getHandle(); mPopupView = main_view->getChild<LLPopupView>("popup_holder"); mHintHolder = main_view->getChild<LLView>("hint_holder")->getHandle(); @@ -1934,22 +1932,6 @@ void LLViewerWindow::initWorldUI() panel_ssf_container->addChild(panel_stand_stop_flying); panel_ssf_container->setVisible(TRUE); - // put sidetray in container - LLPanel* side_tray_container = getRootView()->getChild<LLPanel>("side_tray_container"); - LLSideTray* sidetrayp = LLSideTray::getInstance(); - sidetrayp->setShape(side_tray_container->getLocalRect()); - // don't follow right edge to avoid spurious resizes, since we are using a fixed width layout - sidetrayp->setFollows(FOLLOWS_LEFT|FOLLOWS_TOP|FOLLOWS_BOTTOM); - side_tray_container->addChild(sidetrayp); - side_tray_container->setVisible(FALSE); - - // put sidetray buttons in their own panel - LLPanel* buttons_panel = sidetrayp->getButtonsPanel(); - LLPanel* buttons_panel_container = getRootView()->getChild<LLPanel>("side_bar_tabs"); - buttons_panel->setShape(buttons_panel_container->getLocalRect()); - buttons_panel->setFollowsAll(); - buttons_panel_container->addChild(buttons_panel); - // Load and make the toolbars visible // Note: we need to load the toolbars only *after* the user is logged in and IW if (gToolBarView) @@ -3310,9 +3292,6 @@ void LLViewerWindow::updateKeyboardFocus() // make sure floater visible order is in sync with tab order gFloaterView->syncFloaterTabOrder(); } - - if(LLSideTray::instanceCreated())//just getInstance will create sidetray. we don't want this - LLSideTray::getInstance()->highlightFocused(); } static LLFastTimer::DeclareTimer FTM_UPDATE_WORLD_VIEW("Update World View"); @@ -3336,12 +3315,6 @@ void LLViewerWindow::updateWorldViewRect(bool use_full_window) new_world_rect.mTop = llround((F32)new_world_rect.mTop * mDisplayScale.mV[VY]); } - if (gSavedSettings.getBOOL("SidebarCameraMovement") == FALSE) - { - // use right edge of window, ignoring sidebar - new_world_rect.mRight = mWindowRectRaw.mRight; - } - if (mWorldViewRectRaw != new_world_rect) { mWorldViewRectRaw = new_world_rect; diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 47e0fdeab1..872eb12753 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -282,7 +282,6 @@ public: void updateKeyboardFocus(); void updateWorldViewRect(bool use_full_window=false); - LLView* getNonSideTrayView() { return mNonSideTrayView.get(); } LLView* getFloaterViewHolder() { return mFloaterViewHolder.get(); } LLView* getToolBarHolder() { return mToolBarHolder.get(); } LLView* getHintHolder() { return mHintHolder.get(); } @@ -445,7 +444,6 @@ protected: std::string mInitAlert; // Window / GL initialization requires an alert LLHandle<LLView> mWorldViewPlaceholder; // widget that spans the portion of screen dedicated to rendering the 3d world - LLHandle<LLView> mNonSideTrayView; // parent of world view + bottom bar, etc...everything but the side tray LLHandle<LLView> mFloaterViewHolder; // container for floater_view LLHandle<LLView> mToolBarHolder; // container for toolbars LLHandle<LLView> mHintHolder; // container for hints diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index 276e8f462d..d8aa0b7d5c 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -37,7 +37,6 @@ #include "llinventorymodel.h" #include "llinventoryobserver.h" #include "llsidepanelappearance.h" -#include "llsidetray.h" #include "lltexlayer.h" #include "lltexglobalcolor.h" #include "lltrans.h" diff --git a/indra/newview/llworldview.cpp b/indra/newview/llworldview.cpp deleted file mode 100644 index f5dc2a5290..0000000000 --- a/indra/newview/llworldview.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @file llworldview.cpp - * @brief LLWorldView class implementation - * - * $LicenseInfo:firstyear=2001&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 "llworldview.h" - -#include "llviewercontrol.h" -#include "llsidetray.h" -///////////////////////////////////////////////////// -// LLFloaterView - -static LLDefaultChildRegistry::Register<LLWorldView> r("world_view"); - -LLWorldView::LLWorldView(const Params& p) -: LLUICtrl (p) -{ - gSavedSettings.getControl("SidebarCameraMovement")->getSignal()->connect(boost::bind(&LLWorldView::toggleSidebarCameraMovement, this, _2)); -} - -void LLWorldView::reshape(S32 width, S32 height, BOOL called_from_parent) -{ - //if (FALSE == gSavedSettings.getBOOL("SidebarCameraMovement") ) - //{ - // LLView* main_view = LLUI::getRootView()->findChild<LLView>("main_view"); - // if(main_view) - // { - // width = main_view->getRect().getWidth(); - // } - //} - - LLUICtrl::reshape(width, height, called_from_parent); -} -void LLWorldView::toggleSidebarCameraMovement(const LLSD::Boolean& new_visibility) -{ - reshape(getParent()->getRect().getWidth(),getRect().getHeight()); -} - diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml index 6ece01b2ba..d8f593715f 100644 --- a/indra/newview/skins/default/xui/en/main_view.xml +++ b/indra/newview/skins/default/xui/en/main_view.xml @@ -90,14 +90,6 @@ top="0" visible="false" width="1024"/> - <panel follows="right|top|bottom" - height="500" - mouse_opaque="false" - name="side_bar_tabs" - right="500" - tab_stop="false" - top="0" - width="32"/> <panel bottom="500" follows="left|right|bottom" height="25" @@ -116,17 +108,6 @@ visible="false"/> </layout_stack> </layout_panel> - <!-- side tray --> - <layout_panel auto_resize="false" - follows="top|bottom" - height="500" - min_width="333" - mouse_opaque="false" - tab_stop="false" - name="side_tray_container" - user_resize="false" - visible="false" - width="333"/> </layout_stack> <panel top="0" follows="all" diff --git a/indra/newview/skins/default/xui/en/menu_login.xml b/indra/newview/skins/default/xui/en/menu_login.xml index bb58dd500f..80e310a873 100644 --- a/indra/newview/skins/default/xui/en/menu_login.xml +++ b/indra/newview/skins/default/xui/en/menu_login.xml @@ -93,14 +93,6 @@ parameter="ui_preview" /> </menu_item_call> <menu_item_separator /> - <!-- Broken - <menu_item_call - label="Show Side Tray" - name="Show Side Tray"> - <menu_item_call.on_click - function="Advanced.ShowSideTray" /> - </menu_item_call> - --> <menu create_jump_keys="true" label="UI Tests" diff --git a/indra/newview/skins/default/xui/en/panel_preferences_move.xml b/indra/newview/skins/default/xui/en/panel_preferences_move.xml index 1a8aae7f91..c131649fc8 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_move.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_move.xml @@ -86,16 +86,6 @@ name="appearance_camera_movement" tool_tip="Use automatic camera positioning while in edit mode" width="242" /> - <check_box - control_name="SidebarCameraMovement" - follows="left|top" - height="16" - initial_value="true" - label="Sidebar" - layout="topleft" - name="appearance_sidebar_positioning" - tool_tip="Use automatic camera positioning for sidebar" - width="242" /> <icon follows="left|top" height="18" |