Added stacking button to dialogs so it's possible to vrowse open dialogs

master
ziree 2013-08-19 02:03:58 +02:00
parent fc07028437
commit aecb5f12ba
10 changed files with 217 additions and 0 deletions

View File

@ -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

View File

@ -875,6 +875,18 @@
<integer>0</integer>
</map>
<key>DialogStackIconVisible</key>
<map>
<key>Comment</key>
<string>Internal, volatile control that defines if the dialog stack browser icon is visible.</string>
<key>Persist</key>
<integer>0</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<!-- Legacy setting, can be removed when ScriptDialogsPosition was adopted -->
<key>ShowScriptDialogsTopRight</key>
<map>

View File

@ -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::~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<LLUUID>::iterator it=notificationIDs.begin();it!=notificationIDs.end();++it)
{
if(*it==uuid)
{
if(it==notificationIDs.begin())
{
return notificationIDs.back();
}
--it;
return *it;
}
}
return LLUUID::null;
}

View File

@ -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 <list>
class DialogStack
: public LLSingleton<DialogStack>
{
friend class LLSingleton<DialogStack>;
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<LLUUID> notificationIDs;
public:
void push(const LLUUID& uuid);
void pop(const LLUUID& uuid);
const LLUUID& flip(const LLUUID& uuid);
};
#endif // DIALOGSTACK_H

View File

@ -44,6 +44,10 @@
#include "llfloaterimsession.h"
#include "lltoolbarview.h" // <FS:Zi> script dialogs position
// <FS:Zi> Dialog Stacking browser
#include "dialogstack.h"
#include "llbutton.h"
// </FS:Zi>
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
@ -236,8 +240,30 @@ void LLScriptFloater::createForm(const LLUUID& notification_id)
toast_rect.setLeftTopAndSize(toast_rect.mLeft, toast_rect.mTop, panel_rect.getWidth(), mCurrentHeight);
// </FS:Zi>
setShape(toast_rect);
// <FS:Zi> Dialog Stacking browser
mScriptForm->getChild<LLButton>("DialogStackButton")->setCommitCallback(boost::bind(&LLScriptFloater::onStackClicked,this));
if(gSavedSettings.getS32("ScriptDialogsPosition")!=(eDialogPosition) POS_DOCKED)
{
DialogStack::instance().push(notification_id);
}
// </FS:Zi>
}
// <FS:Zi> Dialog Stacking browser
void LLScriptFloater::onStackClicked()
{
LLFloater* floater=LLFloaterReg::getTypedInstance<LLScriptFloater>("script_floater",getNotificationId());
if(floater->isFrontmost())
{
const LLUUID& nextNotification=DialogStack::instance().flip(getNotificationId());
floater=LLFloaterReg::getTypedInstance<LLScriptFloater>("script_floater",nextNotification);
}
gFloaterView->bringToFront(floater,TRUE);
}
// </FS:Zi>
void LLScriptFloater::onClose(bool app_quitting)
{
savePosition();
@ -568,6 +594,8 @@ void LLScriptFloaterManager::onRemoveNotification(const LLUUID& notification_id)
return;
}
DialogStack::instance().pop(notification_id); // <FS:Zi> Dialog Stacking browser
// remove related chiclet
if (LLChicletBar::instanceExists())
{

View File

@ -232,6 +232,8 @@ public:
POS_BOTTOM_RIGHT
};
// </FS:Zi>
void onStackClicked(); // <FS:Zi> Dialog Stacking browser
};
#endif //LL_SCRIPTFLOATER_H

View File

@ -327,6 +327,15 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images )
mTextBox->setReadOnlyColor(script_dialog_fg_color);
}
// </FS:Ansariel>
// <FS:Zi> 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<LLButton>("DialogStackButton")->reshape(0,0,FALSE);
}
// </FS:Zi>
// add buttons for a script notification
if (mIsTip)

View File

@ -927,6 +927,8 @@ with the same filename but different name
<texture name="Icon_Lightshare" file_name="icons/Icon_Lightshare.png" preload="false" />
<texture name="Icon_DialogStack" file_name="icons/Icon_DialogStack.png" preload="false" />
<!-- Higher Resolution 200px Loading Progress Indicator -->
<texture name="ProgressLarge_1" file_name="icons/ProgressLarge_1.png" preload="true" />
<texture name="ProgressLarge_2" file_name="icons/ProgressLarge_2.png" preload="true" />

View File

@ -98,4 +98,18 @@
This panel holds buttons of notification. Change of its size can affect the layout of buttons.
-->
</panel>
<!-- <FS:Zi> Dialog Stacking browser -->
<button
layout="topleft"
follows="right|bottom"
name="DialogStackButton"
visibility_control="DialogStackIconVisible"
image_selected="Icon_DialogStack"
image_unselected="Icon_DialogStack"
width="24"
height="18"
right="-2"
bottom="-2" />
<!-- <FS:Zi> Dialog Stacking browser -->
</panel>

View File

@ -97,4 +97,18 @@
top="0"
width="70" />
</panel>
<!-- <FS:Zi> Dialog Stacking browser -->
<button
layout="topleft"
follows="right|bottom"
name="DialogStackButton"
visibility_control="DialogStackIconVisible"
image_selected="Icon_DialogStack"
image_unselected="Icon_DialogStack"
width="24"
height="18"
right="-2"
bottom="-2" />
<!-- <FS:Zi> Dialog Stacking browser -->
</panel>