Added option to move script dialogs to any corner or keep them docked to their chiclet. FIRE-11381

master
ziree 2013-08-18 02:56:42 +02:00
parent 7ff86206b5
commit 3906d5be85
5 changed files with 243 additions and 14 deletions

View File

@ -863,10 +863,23 @@
<integer>0</integer>
</map>
<key>ScriptDialogsPosition</key>
<map>
<key>Comment</key>
<string>Holds the position where script llDialog floaters will show up. 1 = docked to chiclet, 2 = top left, 3 = top right, 4 = bottom left, 5 = bottom right, 0 = follow legacy ShowScriptDialogsTopRight</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>S32</string>
<key>Value</key>
<integer>0</integer>
</map>
<!-- Legacy setting, can be removed when ScriptDialogsPosition was adopted -->
<key>ShowScriptDialogsTopRight</key>
<map>
<key>Comment</key>
<string>Show script llDialog floaters always in the top right corner of the screen.</string>
<string>Show script llDialog floaters always in the top right corner of the screen (OBSOLETE, see ScriptDialogsPosition).</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>

View File

@ -495,6 +495,18 @@
<integer>1</integer>
</map>
<key>ScriptDialogsPosition</key>
<map>
<key>Comment</key>
<string>Holds the position where script llDialog floaters will show up. 1 = docked to chiclet, 2 = top left, 3 = top right, 4 = bottom left, 5 = bottom right, 0 = follow legacy ShowScriptDialogsTopRight</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>S32</string>
<key>Value</key>
<integer>3</integer>
</map>
<!-- <FS_Zi> Animated dialogs -->
<key>FSAnimatedScriptDialogs</key>
<map>

View File

@ -43,6 +43,8 @@
#include "llviewerwindow.h"
#include "llfloaterimsession.h"
#include "lltoolbarview.h" // <FS:Zi> script dialogs position
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
@ -105,6 +107,10 @@ bool LLScriptFloater::toggle(const LLUUID& notification_id)
return true;
}
/*
// <FS:Zi> script dialogs position
// Reimplemented the show() method at the end of this file
LLScriptFloater* LLScriptFloater::show(const LLUUID& notification_id)
{
LLScriptFloater* floater = LLFloaterReg::getTypedInstance<LLScriptFloater>("script_floater", notification_id);
@ -167,6 +173,8 @@ LLScriptFloater* LLScriptFloater::show(const LLUUID& notification_id)
return floater;
}
// </FS:Zi>
*/
void LLScriptFloater::setNotificationId(const LLUUID& id)
{
@ -214,7 +222,9 @@ void LLScriptFloater::createForm(const LLUUID& notification_id)
// <FS:Zi> Animated dialogs
// toast_rect.setLeftTopAndSize(toast_rect.mLeft, toast_rect.mTop, panel_rect.getWidth(), panel_rect.getHeight() + getHeaderHeight());
mDesiredHeight=panel_rect.getHeight()+getHeaderHeight();
if(gSavedSettings.getBOOL("FSAnimatedScriptDialogs") && gSavedSettings.getBOOL("ShowScriptDialogsTopRight"))
if(gSavedSettings.getBOOL("FSAnimatedScriptDialogs") &&
(gSavedSettings.getS32("ScriptDialogsPosition")==(eDialogPosition) POS_TOP_LEFT ||
gSavedSettings.getS32("ScriptDialogsPosition")==(eDialogPosition) POS_TOP_RIGHT))
{
mCurrentHeight=0;
mStartTime=LLFrameTimer::getElapsedSeconds();
@ -780,4 +790,149 @@ void LLScriptFloater::draw()
}
// </FS:Zi>
// <FS:Zi> script dialogs position
LLScriptFloater* LLScriptFloater::show(const LLUUID& notification_id)
{
LLScriptFloater* floater = LLFloaterReg::getTypedInstance<LLScriptFloater>("script_floater", notification_id);
floater->setNotificationId(notification_id);
floater->createForm(notification_id);
//LLDialog(LLGiveInventory and LLLoadURL) should no longer steal focus (see EXT-5445)
floater->setAutoFocus(FALSE);
LLScriptFloaterManager::e_object_type floaterType=LLScriptFloaterManager::getObjectType(notification_id);
BOOL chicletsDisabled=gSavedSettings.getBOOL("FSDisableIMChiclets");
if(floaterType==LLScriptFloaterManager::OBJ_SCRIPT)
{
eDialogPosition dialogPos=(eDialogPosition) gSavedSettings.getS32("ScriptDialogsPosition");
if(dialogPos==POS_LEGACY)
{
dialogPos=POS_TOP_RIGHT;
if(!gSavedSettings.getBOOL("ShowScriptDialogsTopRight"))
{
dialogPos=POS_DOCKED;
}
gSavedSettings.setS32("ScriptDialogsPosition",(S32) dialogPos);
}
if(dialogPos==POS_DOCKED && chicletsDisabled)
{
dialogPos=POS_TOP_RIGHT;
}
if(dialogPos!=POS_DOCKED)
{
// undock the dialog
floater->setDocked(false,true);
}
S32 topPad=0;
if(gSavedSettings.getBOOL("ShowNavbarNavigationPanel"))
topPad+=LLUI::getRootView()->getChild<LLView>("location_search_layout")->getRect().getHeight();
if(gSavedSettings.getBOOL("ShowNavbarFavoritesPanel"))
topPad+=LLUI::getRootView()->getChild<LLView>("favorite")->getRect().getHeight();
S32 bottomPad=0;
if(gToolBarView->getToolbar(LLToolBarView::TOOLBAR_BOTTOM)->hasButtons())
bottomPad=gToolBarView->getToolbar(LLToolBarView::TOOLBAR_BOTTOM)->getRect().getHeight();
S32 leftPad=0;
if(gToolBarView->getToolbar(LLToolBarView::TOOLBAR_LEFT)->hasButtons())
leftPad=gToolBarView->getToolbar(LLToolBarView::TOOLBAR_LEFT)->getRect().getWidth();
S32 rightPad=0;
if(gToolBarView->getToolbar(LLToolBarView::TOOLBAR_RIGHT)->hasButtons())
rightPad=gToolBarView->getToolbar(LLToolBarView::TOOLBAR_RIGHT)->getRect().getWidth();
LLRect pos=floater->getRect();
S32 width=pos.getWidth();
S32 height=pos.getHeight();
floater->setSavePosition(true);
switch(dialogPos)
{
case POS_DOCKED:
{
floater->dockToChiclet(true);
break;
}
case POS_TOP_LEFT:
{
pos.setOriginAndSize(leftPad,
gViewerWindow->getWorldViewHeightScaled()-height-topPad,
width,height);
break;
}
case POS_TOP_RIGHT:
{
pos.setOriginAndSize(gViewerWindow->getWorldViewWidthScaled()-width-rightPad,
gViewerWindow->getWorldViewHeightScaled()-height-topPad,
width,height);
break;
}
case POS_BOTTOM_LEFT:
{
pos.setOriginAndSize(leftPad,
bottomPad,
width,height);
break;
}
case POS_BOTTOM_RIGHT:
{
pos.setOriginAndSize(gViewerWindow->getWorldViewWidthScaled()-width-rightPad,
bottomPad,
width,height);
break;
}
default:
{
llwarns << "dialogPos value " << dialogPos << " not handled in switch() statement." << llendl;
}
}
if(dialogPos!=POS_DOCKED)
{
floater->setRect(pos);
floater->savePosition();
floater->restorePosition();
}
}
else
{
floater->setSavePosition(true);
if(chicletsDisabled)
{
LLRect pos=floater->getRect();
S32 width=pos.getWidth();
S32 height=pos.getHeight();
pos.setOriginAndSize(gViewerWindow->getWorldViewWidthScaled()-width,
gViewerWindow->getWorldViewHeightScaled()-height,
width,height);
floater->setRect(pos);
floater->savePosition();
floater->restorePosition();
}
else
{
floater->dockToChiclet(true);
}
}
//LLDialog(LLGiveInventory and LLLoadURL) should no longer steal focus (see EXT-5445)
LLFloaterReg::showTypedInstance<LLScriptFloater>("script_floater", notification_id, FALSE);
return floater;
}
// </FS:Zi>
// EOF

View File

@ -220,6 +220,18 @@ public:
virtual void draw();
// </FS:Zi>
// <FS:Zi> script dialogs position
enum eDialogPosition
{
POS_LEGACY, // Use ShowScriptDialogsTopRight once and convert to one of these
POS_DOCKED,
POS_TOP_LEFT,
POS_TOP_RIGHT,
POS_BOTTOM_LEFT,
POS_BOTTOM_RIGHT
};
// </FS:Zi>
};
#endif //LL_SCRIPTFLOATER_H

View File

@ -372,18 +372,55 @@
name="ScriptDialogOption_2"
value="2"/>
</combo_box>
<check_box
control_name="ShowScriptDialogsTopRight"
height="16"
initial_value="true"
label="Script Dialogs in Top Right"
<text
type="string"
left="5"
top_pad="6"
width="140"
follows="left|top"
height="16"
layout="topleft"
name="ScriptDialogsPositionLabel">
Script Dialogs Position:
</text>
<combo_box
control_name="ScriptDialogsPosition"
height="23"
layout="topleft"
left="5"
name="ShowScriptDialogsTopRight"
tool_tip="Set this to move script dialog notifications to the top right corner of the screen (Classic V1.x behavior)."
top_pad="2"
width="256" />
left_pad="10"
top_delta="-5"
name="ScriptDialogsPositionDropdown"
tool_tip="Choose where script dialogs (menus) come up on your screen."
width="180">
<combo_box.item
label="Importing old Value"
name="ScriptDialogPositionOption_0"
value="0"/>
<combo_box.item
label="Docked to Chiclet"
name="ScriptDialogPositionOption_1"
value="1"/>
<combo_box.item
label="Top Left"
name="ScriptDialogPositionOption_2"
value="2"/>
<combo_box.item
label="Top Right"
name="ScriptDialogPositionOption_3"
value="3"/>
<combo_box.item
label="Bottom Left"
name="ScriptDialogPositionOption_4"
value="4"/>
<combo_box.item
label="Bottom Right"
name="ScriptDialogPositionOption_5"
value="5"/>
</combo_box>
<check_box
control_name="FSAnimatedScriptDialogs"
enabled_control="ShowScriptDialogsTopRight"
@ -393,7 +430,7 @@
layout="topleft"
left="15"
name="FSAnimatedScriptDialogs"
tool_tip="Set this to make script dialogs animate when opening (Classic V1.x behavior)."
tool_tip="Set this to make script dialogs animate when opening (Classic V1.x behavior). Only works when dialogs open from the top down."
top_pad="2"
width="256" />
<check_box