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 +++++++++++++++++++++++++++++------- indra/newview/lltoastnotifypanel.h | 2 ++ 2 files changed, 35 insertions(+), 7 deletions(-) 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 diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h index 9e1eac90b3..f90fca3eaa 100644 --- a/indra/newview/lltoastnotifypanel.h +++ b/indra/newview/lltoastnotifypanel.h @@ -99,6 +99,7 @@ protected: // panel elements LLTextBase* mTextBox; + LLTextEditor* mUserInputBox; LLPanel* mInfoPanel; // a panel, that contains an information LLPanel* mControlPanel; // a panel, that contains buttons (if present) @@ -121,6 +122,7 @@ protected: void disableRespondedOptions(LLNotificationPtr& notification); bool mIsTip; + bool mIsScriptTextBox; bool mAddedDefaultBtn; bool mIsScriptDialog; bool mIsCaution; -- 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 +++++++++++++++++-- .../skins/default/xui/en/panel_notification.xml | 22 ++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) 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; diff --git a/indra/newview/skins/default/xui/en/panel_notification.xml b/indra/newview/skins/default/xui/en/panel_notification.xml index 59ead84127..a816eaccb6 100644 --- a/indra/newview/skins/default/xui/en/panel_notification.xml +++ b/indra/newview/skins/default/xui/en/panel_notification.xml @@ -55,6 +55,28 @@ visible="false" width="285" wrap="true"/> + Date: Mon, 13 Sep 2010 19:53:08 +0100 Subject: Annoying focus hacks to unblock development. --- indra/newview/lltoastnotifypanel.cpp | 1 + indra/newview/skins/default/xui/en/panel_notification.xml | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) 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; } diff --git a/indra/newview/skins/default/xui/en/panel_notification.xml b/indra/newview/skins/default/xui/en/panel_notification.xml index a816eaccb6..ef9e5323f9 100644 --- a/indra/newview/skins/default/xui/en/panel_notification.xml +++ b/indra/newview/skins/default/xui/en/panel_notification.xml @@ -1,5 +1,6 @@ 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(-) 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 89e1f3be753c7c5153261ebb94095f2dee95a991 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Mon, 13 Sep 2010 20:12:50 +0100 Subject: quick stab at a submit button. --- indra/newview/skins/default/xui/en/panel_notification.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/indra/newview/skins/default/xui/en/panel_notification.xml b/indra/newview/skins/default/xui/en/panel_notification.xml index ef9e5323f9..21c45aa5e3 100644 --- a/indra/newview/skins/default/xui/en/panel_notification.xml +++ b/indra/newview/skins/default/xui/en/panel_notification.xml @@ -104,6 +104,14 @@ wrap="true" parse_highlights="true" parse_urls="true"/> +