From 58d6057076028c13a2dcc6130734a86933dc5864 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Mon, 13 Sep 2010 12:38:12 +0100 Subject: VWR-20756 WIP - start to detect the magic llTextBox() case. --- indra/newview/lltoastnotifypanel.cpp | 40 +++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'indra/newview/lltoastnotifypanel.cpp') diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index ca6efa9d2f..9febcb3d8b 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -33,6 +33,7 @@ // library includes #include "lldbstrings.h" +#include "lllslconstants.h" #include "llnotifications.h" #include "lluiconstants.h" #include "llrect.h" @@ -54,6 +55,7 @@ LLToastNotifyPanel::button_click_signal_t LLToastNotifyPanel::sButtonClickSignal LLToastNotifyPanel::LLToastNotifyPanel(LLNotificationPtr& notification, const LLRect& rect) : LLToastPanel(notification), mTextBox(NULL), +mUserInputBox(NULL), mInfoPanel(NULL), mControlPanel(NULL), mNumOptions(0), @@ -66,15 +68,43 @@ mCloseNotificationOnDestroy(true) { this->setShape(rect); } + // get a form for the notification + LLNotificationFormPtr form(notification->getForm()); + // get number of elements + mNumOptions = form->getNumElements(); + mInfoPanel = getChild("info_panel"); mControlPanel = getChild("control_panel"); BUTTON_WIDTH = gSavedSettings.getS32("ToastButtonWidth"); + // customize panel's attributes - // is it intended for displaying a tip + + // is it intended for displaying a tip? mIsTip = notification->getType() == "notifytip"; - // is it a script dialog + // is it a script dialog? mIsScriptDialog = (notification->getName() == "ScriptDialog" || notification->getName() == "ScriptDialogGroup"); - // is it a caution + // is it a script dialog with llTextBox()? + mIsScriptTextBox = false; + if (mIsScriptDialog) + { + // 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) + { + mIsScriptTextBox = true; + break; + } + } + } + llwarns << "FORM ELEMS " << int(form->getNumElements()) << llendl; + llwarns << "isScriptDialog? " << int(mIsScriptDialog) << llendl; + llwarns << "isScriptTextBox? " << int(mIsScriptTextBox) << llendl; + // is it a caution? // // caution flag can be set explicitly by specifying it in the notification payload, or it can be set implicitly if the // notify xml template specifies that it is a caution @@ -94,10 +124,6 @@ mCloseNotificationOnDestroy(true) setIsChrome(TRUE); // initialize setFocusRoot(!mIsTip); - // get a form for the notification - LLNotificationFormPtr form(notification->getForm()); - // get number of elements - mNumOptions = form->getNumElements(); // customize panel's outfit // preliminary adjust panel's layout -- cgit v1.2.3 From 17d913fef4778234c97b48d26167d6e1f62d8add Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Mon, 13 Sep 2010 13:56:29 +0100 Subject: VWR-20756 WIP - very limping display of llTextBox --- indra/newview/lltoastnotifypanel.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'indra/newview/lltoastnotifypanel.cpp') diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 9febcb3d8b..6413874863 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -148,6 +148,11 @@ mCloseNotificationOnDestroy(true) mTextBox->setVisible(TRUE); mTextBox->setValue(notification->getMessage()); + mUserInputBox = getChild("user_input_box"); + mUserInputBox->setMaxTextLength(254);// FIXME + mUserInputBox->setVisible(FALSE); + mUserInputBox->setEnabled(FALSE); + // add buttons for a script notification if (mIsTip) { @@ -164,6 +169,16 @@ mCloseNotificationOnDestroy(true) LLSD form_element = form->getElement(i); if (form_element["type"].asString() != "button") { + // not a button. + continue; + } + if (form_element["name"].asString() == TEXTBOX_MAGIC_TOKEN) + { + // a textbox pretending to be a button. + // (re)enable the textbox for this panel, and continue. + mUserInputBox->setVisible(TRUE); + mUserInputBox->setEnabled(TRUE); + mUserInputBox->insertText("FOOOOOO!!!!"); continue; } LLButton* new_button = createButton(form_element, TRUE); @@ -278,7 +293,7 @@ LLButton* LLToastNotifyPanel::createButton(const LLSD& form_element, BOOL is_opt p.image_color(LLUIColorTable::instance().getColor("ButtonCautionImageColor")); p.image_color_disabled(LLUIColorTable::instance().getColor("ButtonCautionImageColor")); } - // for the scriptdialog buttons we use fixed button size. This is a limit! + // for the scriptdialog buttons we use fixed button size. This is a limit! if (!mIsScriptDialog && font->getWidth(form_element["text"].asString()) > BUTTON_WIDTH) { p.rect.width = 1; @@ -286,7 +301,7 @@ LLButton* LLToastNotifyPanel::createButton(const LLSD& form_element, BOOL is_opt } else if (mIsScriptDialog && is_ignore_btn) { - // this is ignore button,make it smaller + // this is ignore button, make it smaller p.rect.height = BTN_HEIGHT_SMALL; p.rect.width = 1; p.auto_resize = true; -- cgit v1.2.3 From bf8639dd1830e313f78e65efb0b0bce6a8b82a62 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Mon, 13 Sep 2010 19:53:08 +0100 Subject: Annoying focus hacks to unblock development. --- indra/newview/lltoastnotifypanel.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/lltoastnotifypanel.cpp') diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 6413874863..8cae7d0963 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -178,6 +178,7 @@ mCloseNotificationOnDestroy(true) // (re)enable the textbox for this panel, and continue. mUserInputBox->setVisible(TRUE); mUserInputBox->setEnabled(TRUE); + mUserInputBox->setFocus(TRUE); mUserInputBox->insertText("FOOOOOO!!!!"); continue; } -- cgit v1.2.3 From e171f63f3868ca03a31e64eead32028711b3211d Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Mon, 13 Sep 2010 20:04:05 +0100 Subject: trivial whitespace change... --- indra/newview/lltoastnotifypanel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lltoastnotifypanel.cpp') diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 8cae7d0963..56f71dc43e 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -200,7 +200,7 @@ mCloseNotificationOnDestroy(true) if(h_pad < 2*HPAD) { /* - * Probably it is a scriptdialog toast + * Probably it is a scriptdialog toast * for a scriptdialog toast h_pad can be < 2*HPAD if we have a lot of buttons. * In last case set default h_pad to avoid heaping of buttons */ -- cgit v1.2.3 From 42ed8e8ffadd6bd7d8784084e9a29badf5d75c5c Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 29 Sep 2010 17:03:05 +0100 Subject: response is starting to limp along. --- indra/newview/lltoastnotifypanel.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/lltoastnotifypanel.cpp') diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 51f32331d8..45c031964c 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -527,6 +527,7 @@ void LLToastNotifyPanel::onClickButton(void* data) self->mNotification->setResponder(new_info); } + llwarns << response << llendl; self->mNotification->respond(response); if(is_reusable) -- cgit v1.2.3 From ace8964cf56891202f3d0690d7321656ce1bd1f9 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Thu, 30 Sep 2010 11:13:02 +0100 Subject: more de-crufting. --- indra/newview/lltoastnotifypanel.cpp | 46 ++++-------------------------------- 1 file changed, 5 insertions(+), 41 deletions(-) (limited to 'indra/newview/lltoastnotifypanel.cpp') diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 45c031964c..3f7dc24ade 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -55,7 +55,6 @@ LLToastNotifyPanel::button_click_signal_t LLToastNotifyPanel::sButtonClickSignal LLToastNotifyPanel::LLToastNotifyPanel(LLNotificationPtr& notification, const LLRect& rect, bool show_images) : LLToastPanel(notification), mTextBox(NULL), -mUserInputBox(NULL), mInfoPanel(NULL), mControlPanel(NULL), mNumOptions(0), @@ -68,42 +67,14 @@ mCloseNotificationOnDestroy(true) { this->setShape(rect); } - // get a form for the notification - LLNotificationFormPtr form(notification->getForm()); - // get number of elements - mNumOptions = form->getNumElements(); - mInfoPanel = getChild("info_panel"); mControlPanel = getChild("control_panel"); BUTTON_WIDTH = gSavedSettings.getS32("ToastButtonWidth"); - // customize panel's attributes - // is it intended for displaying a tip? mIsTip = notification->getType() == "notifytip"; // is it a script dialog? mIsScriptDialog = (notification->getName() == "ScriptDialog" || notification->getName() == "ScriptDialogGroup"); - // is it a script dialog with llTextBox()? - mIsScriptTextBox = false; - if (mIsScriptDialog) - { - // 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) - { - mIsScriptTextBox = true; - break; - } - } - } - llwarns << "FORM ELEMS " << int(form->getNumElements()) << llendl; - llwarns << "isScriptDialog? " << int(mIsScriptDialog) << llendl; - llwarns << "isScriptTextBox? " << int(mIsScriptTextBox) << llendl; // is it a caution? // // caution flag can be set explicitly by specifying it in the notification payload, or it can be set implicitly if the @@ -124,6 +95,10 @@ mCloseNotificationOnDestroy(true) setIsChrome(TRUE); // initialize setFocusRoot(!mIsTip); + // get a form for the notification + LLNotificationFormPtr form(notification->getForm()); + // get number of elements + mNumOptions = form->getNumElements(); // customize panel's outfit // preliminary adjust panel's layout @@ -149,11 +124,6 @@ mCloseNotificationOnDestroy(true) mTextBox->setPlainText(!show_images); mTextBox->setValue(notification->getMessage()); - mUserInputBox = getChild("user_input_box"); - mUserInputBox->setMaxTextLength(254);// FIXME - mUserInputBox->setVisible(FALSE); - mUserInputBox->setEnabled(FALSE); - // add buttons for a script notification if (mIsTip) { @@ -176,11 +146,6 @@ mCloseNotificationOnDestroy(true) if (form_element["name"].asString() == TEXTBOX_MAGIC_TOKEN) { // a textbox pretending to be a button. - // (re)enable the textbox for this panel, and continue. - mUserInputBox->setVisible(TRUE); - mUserInputBox->setEnabled(TRUE); - mUserInputBox->setFocus(TRUE); - mUserInputBox->insertText("FOOOOOO!!!!"); continue; } LLButton* new_button = createButton(form_element, TRUE); @@ -295,7 +260,7 @@ LLButton* LLToastNotifyPanel::createButton(const LLSD& form_element, BOOL is_opt p.image_color(LLUIColorTable::instance().getColor("ButtonCautionImageColor")); p.image_color_disabled(LLUIColorTable::instance().getColor("ButtonCautionImageColor")); } - // for the scriptdialog buttons we use fixed button size. This is a limit! + // for the scriptdialog buttons we use fixed button size. This is a limit! if (!mIsScriptDialog && font->getWidth(form_element["text"].asString()) > BUTTON_WIDTH) { p.rect.width = 1; @@ -527,7 +492,6 @@ void LLToastNotifyPanel::onClickButton(void* data) self->mNotification->setResponder(new_info); } - llwarns << response << llendl; self->mNotification->respond(response); if(is_reusable) -- cgit v1.2.3