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.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 +++++++++-- indra/newview/llscriptfloater.h | 2 ++ indra/newview/lltoastscripttextbox.cpp | 2 +- indra/newview/lltoastscripttextbox.h | 4 ++-- 4 files changed, 14 insertions(+), 5 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 diff --git a/indra/newview/llscriptfloater.h b/indra/newview/llscriptfloater.h index da70bb4334..fec81704d8 100644 --- a/indra/newview/llscriptfloater.h +++ b/indra/newview/llscriptfloater.h @@ -203,6 +203,8 @@ protected: void dockToChiclet(bool dock); private: + bool isScriptTextbox(); + LLToastNotifyPanel* mScriptForm; LLUUID mNotificationId; LLUUID mObjectId; diff --git a/indra/newview/lltoastscripttextbox.cpp b/indra/newview/lltoastscripttextbox.cpp index b203579362..7fef346ae5 100644 --- a/indra/newview/lltoastscripttextbox.cpp +++ b/indra/newview/lltoastscripttextbox.cpp @@ -51,7 +51,7 @@ const S32 LLToastScriptTextbox::DEFAULT_MESSAGE_MAX_LINE_COUNT = 7; LLToastScriptTextbox::LLToastScriptTextbox(LLNotificationPtr& notification) -: LLToastPanel(notification), +: LLToastNotifyPanel(notification), mInventoryOffer(NULL) { buildFromFile( "panel_notify_textbox.xml"); diff --git a/indra/newview/lltoastscripttextbox.h b/indra/newview/lltoastscripttextbox.h index 2d942939bc..86fe93cf66 100644 --- a/indra/newview/lltoastscripttextbox.h +++ b/indra/newview/lltoastscripttextbox.h @@ -28,7 +28,7 @@ #define LL_LLTOASTSCRIPTTEXTBOX_H #include "llfontgl.h" -#include "lltoastpanel.h" +#include "lltoastnotifypanel.h" #include "lldarray.h" #include "lltimer.h" #include "llviewermessage.h" @@ -42,7 +42,7 @@ class LLButton; * Replaces class LLGroupNotifyBox. */ class LLToastScriptTextbox -: public LLToastPanel +: public LLToastNotifyPanel { public: void close(); -- cgit v1.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 ++++++++++++++++++++++++++--- indra/newview/llscriptfloater.h | 3 ++- 2 files changed, 28 insertions(+), 4 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 diff --git a/indra/newview/llscriptfloater.h b/indra/newview/llscriptfloater.h index fec81704d8..dc52baa115 100644 --- a/indra/newview/llscriptfloater.h +++ b/indra/newview/llscriptfloater.h @@ -28,6 +28,7 @@ #define LL_SCRIPTFLOATER_H #include "lltransientdockablefloater.h" +#include "llnotificationptr.h" class LLToastNotifyPanel; @@ -203,7 +204,7 @@ protected: void dockToChiclet(bool dock); private: - bool isScriptTextbox(); + bool isScriptTextbox(LLNotificationPtr notification); LLToastNotifyPanel* mScriptForm; LLUUID mNotificationId; -- cgit v1.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.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 - indra/newview/llviewermessage.cpp | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) (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; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 02d27be4ec..dfd7b1092a 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -6175,8 +6175,7 @@ const char* SCRIPT_DIALOG_HEADER = "Script Dialog:\n"; bool callback_script_dialog(const LLSD& notification, const LLSD& response) { LLNotificationForm form(notification["form"]); - //std::string button = "booya";//LLNotification::getSelectedOptionName(response); - llwarns << "ok: " << response << llendl; + std::string rtn_text; S32 button_idx; button_idx = LLNotification::getSelectedOption(notification, response); @@ -6191,7 +6190,7 @@ bool callback_script_dialog(const LLSD& notification, const LLSD& response) { rtn_text = LLNotification::getSelectedOptionName(response); } - llwarns << "rtn: " << rtn_text << " btnidx: " << button_idx << llendl; + // Didn't click "Ignore" if (button_idx != -1) { -- cgit v1.3