From 3906d5be85e7e4a6ac0134808967b62376bd73d7 Mon Sep 17 00:00:00 2001 From: ziree Date: Sun, 18 Aug 2013 02:56:42 +0200 Subject: [PATCH] Added option to move script dialogs to any corner or keep them docked to their chiclet. FIRE-11381 --- indra/newview/app_settings/settings.xml | 15 +- .../newview/app_settings/settings_phoenix.xml | 12 ++ indra/newview/llscriptfloater.cpp | 157 +++++++++++++++++- indra/newview/llscriptfloater.h | 12 ++ .../default/xui/en/panel_preferences_UI.xml | 61 +++++-- 5 files changed, 243 insertions(+), 14 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 47e03dd7b6..58d9f23e61 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -863,10 +863,23 @@ 0 + ScriptDialogsPosition + + Comment + 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 + Persist + 1 + Type + S32 + Value + 0 + + + ShowScriptDialogsTopRight Comment - Show script llDialog floaters always in the top right corner of the screen. + Show script llDialog floaters always in the top right corner of the screen (OBSOLETE, see ScriptDialogsPosition). Persist 1 Type diff --git a/indra/newview/app_settings/settings_phoenix.xml b/indra/newview/app_settings/settings_phoenix.xml index 3512a12ec2..c2f6c66f63 100644 --- a/indra/newview/app_settings/settings_phoenix.xml +++ b/indra/newview/app_settings/settings_phoenix.xml @@ -495,6 +495,18 @@ 1 + ScriptDialogsPosition + + Comment + 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 + Persist + 1 + Type + S32 + Value + 3 + + FSAnimatedScriptDialogs diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp index 82d1015ce6..007ecb3b72 100755 --- a/indra/newview/llscriptfloater.cpp +++ b/indra/newview/llscriptfloater.cpp @@ -43,6 +43,8 @@ #include "llviewerwindow.h" #include "llfloaterimsession.h" +#include "lltoolbarview.h" // script dialogs position + ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// @@ -105,6 +107,10 @@ bool LLScriptFloater::toggle(const LLUUID& notification_id) return true; } +/* +// script dialogs position +// Reimplemented the show() method at the end of this file + LLScriptFloater* LLScriptFloater::show(const LLUUID& notification_id) { LLScriptFloater* floater = LLFloaterReg::getTypedInstance("script_floater", notification_id); @@ -167,6 +173,8 @@ LLScriptFloater* LLScriptFloater::show(const LLUUID& notification_id) return floater; } +// +*/ void LLScriptFloater::setNotificationId(const LLUUID& id) { @@ -214,7 +222,9 @@ void LLScriptFloater::createForm(const LLUUID& notification_id) // 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() } // +// script dialogs position +LLScriptFloater* LLScriptFloater::show(const LLUUID& notification_id) +{ + LLScriptFloater* floater = LLFloaterReg::getTypedInstance("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("location_search_layout")->getRect().getHeight(); + + if(gSavedSettings.getBOOL("ShowNavbarFavoritesPanel")) + topPad+=LLUI::getRootView()->getChild("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("script_floater", notification_id, FALSE); + + return floater; +} +// + // EOF diff --git a/indra/newview/llscriptfloater.h b/indra/newview/llscriptfloater.h index 8d03d50e96..ac51f2d2ab 100755 --- a/indra/newview/llscriptfloater.h +++ b/indra/newview/llscriptfloater.h @@ -220,6 +220,18 @@ public: virtual void draw(); // + +// 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 + }; +// }; #endif //LL_SCRIPTFLOATER_H diff --git a/indra/newview/skins/default/xui/en/panel_preferences_UI.xml b/indra/newview/skins/default/xui/en/panel_preferences_UI.xml index d76f1193f3..200838beb6 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_UI.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_UI.xml @@ -372,18 +372,55 @@ name="ScriptDialogOption_2" value="2"/> - - + Script Dialogs Position: + + + + left_pad="10" + top_delta="-5" + name="ScriptDialogsPositionDropdown" + tool_tip="Choose where script dialogs (menus) come up on your screen." + width="180"> + + + + + + + + +