From aecb5f12ba0786f71023e85d0b81d42e5fbc9a54 Mon Sep 17 00:00:00 2001 From: ziree Date: Mon, 19 Aug 2013 02:03:58 +0200 Subject: [PATCH] Added stacking button to dialogs so it's possible to vrowse open dialogs --- indra/newview/CMakeLists.txt | 2 + indra/newview/app_settings/settings.xml | 12 +++ indra/newview/dialogstack.cpp | 80 +++++++++++++++++++ indra/newview/dialogstack.h | 54 +++++++++++++ indra/newview/llscriptfloater.cpp | 28 +++++++ indra/newview/llscriptfloater.h | 2 + indra/newview/lltoastnotifypanel.cpp | 9 +++ .../skins/default/textures/textures.xml | 2 + .../default/xui/en/panel_notification.xml | 14 ++++ .../default/xui/en/panel_notify_textbox.xml | 14 ++++ 10 files changed, 217 insertions(+) create mode 100644 indra/newview/dialogstack.cpp create mode 100644 indra/newview/dialogstack.h diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 510caaa503..81dd27c3b8 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -117,6 +117,7 @@ set(viewer_SOURCE_FILES aoengine.cpp aoset.cpp chatbar_as_cmdline.cpp + dialogstack.cpp exoflickr.cpp exoflickrauth.cpp exogroupmutelist.cpp @@ -803,6 +804,7 @@ set(viewer_HEADER_FILES aoengine.h aoset.h chatbar_as_cmdline.h + dialogstack.h exoflickr.h exoflickrauth.h exogroupmutelist.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 58d9f23e61..636e7f5c14 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -875,6 +875,18 @@ 0 + DialogStackIconVisible + + Comment + Internal, volatile control that defines if the dialog stack browser icon is visible. + Persist + 0 + Type + Boolean + Value + 0 + + ShowScriptDialogsTopRight diff --git a/indra/newview/dialogstack.cpp b/indra/newview/dialogstack.cpp new file mode 100644 index 0000000000..28d46bddb4 --- /dev/null +++ b/indra/newview/dialogstack.cpp @@ -0,0 +1,80 @@ +/** + * @file dialogstack.cpp + * @brief Keeps track of number of stacked dialogs + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2013, Zi Ree @ Second Life + * + * 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 + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "dialogstack.h" + +#include "llviewercontrol.h" + +DialogStack::DialogStack() : + LLSingleton() +{ +} + +DialogStack::~DialogStack() +{ +} + +void DialogStack::update() +{ + // show dialog stack browse icon when more than one dialog is on the screen + gSavedSettings.setBOOL("DialogStackIconVisible",(notificationIDs.size()>1)); +} + +void DialogStack::push(const LLUUID& uuid) +{ + notificationIDs.push_back(uuid); + update(); +} + +void DialogStack::pop(const LLUUID& uuid) +{ + if(notificationIDs.empty()) + { + llwarns << "Dialog Stack count was 0 when pop() was called." << llendl; + } + else + { + notificationIDs.remove(uuid); + update(); + } +} + +const LLUUID& DialogStack::flip(const LLUUID& uuid) +{ + for (std::list::iterator it=notificationIDs.begin();it!=notificationIDs.end();++it) + { + if(*it==uuid) + { + if(it==notificationIDs.begin()) + { + return notificationIDs.back(); + } + --it; + return *it; + } + } + return LLUUID::null; +} diff --git a/indra/newview/dialogstack.h b/indra/newview/dialogstack.h new file mode 100644 index 0000000000..e5ce347595 --- /dev/null +++ b/indra/newview/dialogstack.h @@ -0,0 +1,54 @@ +/** + * @file dialogstack.h + * @brief Keeps track of number of stacked dialogs + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2013, Zi Ree @ Second Life + * + * 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 + * $/LicenseInfo$ + */ + +#ifndef DIALOGSTACK_H +#define DIALOGSTACK_H + +#include "llsingleton.h" + +#include + +class DialogStack +: public LLSingleton +{ + friend class LLSingleton; + + private: + DialogStack(); + ~DialogStack(); + + protected: + void update(); + + // since we can't push a floater to the back we need to keep our own list of notification ids + // to know which one to bring to the front instead + std::list notificationIDs; + + public: + void push(const LLUUID& uuid); + void pop(const LLUUID& uuid); + const LLUUID& flip(const LLUUID& uuid); +}; + +#endif // DIALOGSTACK_H diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp index dc476ddb10..285919effc 100755 --- a/indra/newview/llscriptfloater.cpp +++ b/indra/newview/llscriptfloater.cpp @@ -44,6 +44,10 @@ #include "llfloaterimsession.h" #include "lltoolbarview.h" // script dialogs position +// Dialog Stacking browser +#include "dialogstack.h" +#include "llbutton.h" +// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// @@ -236,8 +240,30 @@ void LLScriptFloater::createForm(const LLUUID& notification_id) toast_rect.setLeftTopAndSize(toast_rect.mLeft, toast_rect.mTop, panel_rect.getWidth(), mCurrentHeight); // setShape(toast_rect); + + // Dialog Stacking browser + mScriptForm->getChild("DialogStackButton")->setCommitCallback(boost::bind(&LLScriptFloater::onStackClicked,this)); + + if(gSavedSettings.getS32("ScriptDialogsPosition")!=(eDialogPosition) POS_DOCKED) + { + DialogStack::instance().push(notification_id); + } + // } +// Dialog Stacking browser +void LLScriptFloater::onStackClicked() +{ + LLFloater* floater=LLFloaterReg::getTypedInstance("script_floater",getNotificationId()); + if(floater->isFrontmost()) + { + const LLUUID& nextNotification=DialogStack::instance().flip(getNotificationId()); + floater=LLFloaterReg::getTypedInstance("script_floater",nextNotification); + } + gFloaterView->bringToFront(floater,TRUE); +} +// + void LLScriptFloater::onClose(bool app_quitting) { savePosition(); @@ -568,6 +594,8 @@ void LLScriptFloaterManager::onRemoveNotification(const LLUUID& notification_id) return; } + DialogStack::instance().pop(notification_id); // Dialog Stacking browser + // remove related chiclet if (LLChicletBar::instanceExists()) { diff --git a/indra/newview/llscriptfloater.h b/indra/newview/llscriptfloater.h index ac51f2d2ab..fcd99235e6 100755 --- a/indra/newview/llscriptfloater.h +++ b/indra/newview/llscriptfloater.h @@ -232,6 +232,8 @@ public: POS_BOTTOM_RIGHT }; // + + void onStackClicked(); // Dialog Stacking browser }; #endif //LL_SCRIPTFLOATER_H diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 92210f409e..cc8be6b705 100755 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -327,6 +327,15 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images ) mTextBox->setReadOnlyColor(script_dialog_fg_color); } // + // Dialog Stacking browser + // hide the stacking button for things that are not scripting dialogs etc. + else if(mNotification->getName()!="LoadWebPage") + { + // setting size to 0,0 becuase button visibility is dictated by a control variable, + // so we need a different way to hide this button. + getChild("DialogStackButton")->reshape(0,0,FALSE); + } + // // add buttons for a script notification if (mIsTip) diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 94ba671545..49b7b27ae1 100755 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -927,6 +927,8 @@ with the same filename but different name + + diff --git a/indra/newview/skins/default/xui/en/panel_notification.xml b/indra/newview/skins/default/xui/en/panel_notification.xml index fb0969f635..b7667043ff 100755 --- a/indra/newview/skins/default/xui/en/panel_notification.xml +++ b/indra/newview/skins/default/xui/en/panel_notification.xml @@ -98,4 +98,18 @@ This panel holds buttons of notification. Change of its size can affect the layout of buttons. --> + + +