From 393af9b02347f136818143db0e8b823755df0af9 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Tue, 28 Sep 2010 13:14:07 +0100 Subject: hack hack scratch scratch sketch sketch --- indra/newview/llscriptfloater.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'indra/newview/llscriptfloater.cpp') diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp index 2334f0cde5..0f7223aaf0 100644 --- a/indra/newview/llscriptfloater.cpp +++ b/indra/newview/llscriptfloater.cpp @@ -37,6 +37,7 @@ #include "llscreenchannel.h" #include "llsyswellwindow.h" #include "lltoastnotifypanel.h" +#include "lltoastscripttextbox.h" #include "lltrans.h" #include "llviewerwindow.h" #include "llimfloater.h" @@ -151,10 +152,18 @@ void LLScriptFloater::createForm(const LLUUID& notification_id) // create new form LLRect toast_rect = getRect(); - // LLToastNotifyPanel will fit own content in vertical direction, - // but it needs an initial rect to properly calculate its width - // Use an initial rect of the script floater to make the floater window more configurable. - mScriptForm = new LLToastNotifyPanel(notification, toast_rect); + if (isScriptTextBox()) + { + mScriptForm = new LLToastScriptTextbox(notify, toast_rect); + } + else + { + // LLToastNotifyPanel will fit own content in vertical direction, + // but it needs an initial rect to properly calculate its width + // Use an initial rect of the script floater to make the floater + // window more configurable. + mScriptForm = new LLToastNotifyPanel(notification, toast_rect); + } addChild(mScriptForm); // position form on floater -- cgit v1.2.3 From b6a498c3018976b97c2353be066502e4a298e156 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Tue, 28 Sep 2010 13:41:46 +0100 Subject: iterate iterate. --- indra/newview/llscriptfloater.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'indra/newview/llscriptfloater.cpp') diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp index 0f7223aaf0..678611a943 100644 --- a/indra/newview/llscriptfloater.cpp +++ b/indra/newview/llscriptfloater.cpp @@ -152,9 +152,9 @@ void LLScriptFloater::createForm(const LLUUID& notification_id) // create new form LLRect toast_rect = getRect(); - if (isScriptTextBox()) + if (isScriptTextbox()) { - mScriptForm = new LLToastScriptTextbox(notify, toast_rect); + mScriptForm = new LLToastScriptTextbox(notification); } else { @@ -573,4 +573,11 @@ void LLScriptFloaterManager::setFloaterVisible(const LLUUID& notification_id, bo } } +////////////////////////////////////////////////////////////////// + +bool LLScriptFloater::isScriptTextbox() +{ + return true; +} + // EOF -- cgit v1.2.3 From d2474edf85674aa4fb150caee184fc434915d5e6 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Tue, 28 Sep 2010 17:47:24 +0100 Subject: restore switching logic between textbox/nontextbox, after the refactor. --- indra/newview/llscriptfloater.cpp | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'indra/newview/llscriptfloater.cpp') diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp index 678611a943..825ee0823d 100644 --- a/indra/newview/llscriptfloater.cpp +++ b/indra/newview/llscriptfloater.cpp @@ -32,6 +32,7 @@ #include "llchannelmanager.h" #include "llchiclet.h" #include "llfloaterreg.h" +#include "lllslconstants.h" #include "llnotifications.h" #include "llnotificationsutil.h" #include "llscreenchannel.h" @@ -152,7 +153,7 @@ void LLScriptFloater::createForm(const LLUUID& notification_id) // create new form LLRect toast_rect = getRect(); - if (isScriptTextbox()) + if (isScriptTextbox(notification)) { mScriptForm = new LLToastScriptTextbox(notification); } @@ -575,9 +576,31 @@ void LLScriptFloaterManager::setFloaterVisible(const LLUUID& notification_id, bo ////////////////////////////////////////////////////////////////// -bool LLScriptFloater::isScriptTextbox() +bool LLScriptFloater::isScriptTextbox(LLNotificationPtr notification) { - return true; + // get a form for the notification + LLNotificationFormPtr form(notification->getForm()); + + if (form) + { + // get number of elements + int num_options = form->getNumElements(); + + // if ANY of the buttons have the magic lltextbox string as name, then + // treat the whole dialog as a simple text entry box (i.e. mixed button + // and textbox forms are not supported) + for (int i=0; igetElement(i); + llwarns << form_element << llendl; + if (form_element["name"].asString() == TEXTBOX_MAGIC_TOKEN) + { + return true; + } + } + } + + return false; } // EOF -- cgit v1.2.3 From 7007896f9811022c58fab6e7e320dfb6773b1a71 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 29 Sep 2010 12:23:15 +0100 Subject: trivial comment changes. --- indra/newview/llscriptfloater.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llscriptfloater.cpp') diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp index 825ee0823d..53a5881f4b 100644 --- a/indra/newview/llscriptfloater.cpp +++ b/indra/newview/llscriptfloater.cpp @@ -583,12 +583,12 @@ bool LLScriptFloater::isScriptTextbox(LLNotificationPtr notification) if (form) { - // get number of elements + // get number of elements in the form int num_options = form->getNumElements(); - // if ANY of the buttons have the magic lltextbox string as name, then - // treat the whole dialog as a simple text entry box (i.e. mixed button - // and textbox forms are not supported) + // if ANY of the buttons have the magic lltextbox string as + // name, then treat the whole dialog as a simple text entry + // box (i.e. mixed button and textbox forms are not supported) for (int i=0; igetElement(i); -- cgit v1.2.3 From 5b3f293453af7c54ef5c1913c706982ece8be1d0 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Thu, 30 Sep 2010 12:06:44 +0100 Subject: more de-crufting. --- indra/newview/llscriptfloater.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llscriptfloater.cpp') diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp index 53a5881f4b..170e23e4c5 100644 --- a/indra/newview/llscriptfloater.cpp +++ b/indra/newview/llscriptfloater.cpp @@ -592,7 +592,6 @@ bool LLScriptFloater::isScriptTextbox(LLNotificationPtr notification) for (int i=0; igetElement(i); - llwarns << form_element << llendl; if (form_element["name"].asString() == TEXTBOX_MAGIC_TOKEN) { return true; -- cgit v1.2.3