From 35962b54e0afa14cd89eb028efb13787802c18a0 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Mon, 13 Sep 2010 20:39:15 +0100 Subject: Start to break the lltextbox toast into its own toast class instead of mega-overloading the generic notification panel. --- indra/newview/lltoastscripttextbox.h | 79 ++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 indra/newview/lltoastscripttextbox.h (limited to 'indra/newview/lltoastscripttextbox.h') diff --git a/indra/newview/lltoastscripttextbox.h b/indra/newview/lltoastscripttextbox.h new file mode 100644 index 0000000000..4890ee1dea --- /dev/null +++ b/indra/newview/lltoastscripttextbox.h @@ -0,0 +1,79 @@ +/** + * @file lltoastscripttextbox.h + * @brief Panel for script llTextBox dialogs + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLTOASTSCRIPTTEXTBOX_H +#define LL_LLTOASTSCRIPTTEXTBOX_H + +#include "llfontgl.h" +#include "lltoastpanel.h" +#include "lldarray.h" +#include "lltimer.h" +#include "llviewermessage.h" +#include "llnotificationptr.h" + +class LLButton; + +/** + * Toast panel for group notification. + * + * Replaces class LLGroupNotifyBox. + */ +class LLToastGroupNotifyPanel +: public LLToastPanel +{ +public: + void close(); + + static bool onNewNotification(const LLSD& notification); + + + // Non-transient messages. You can specify non-default button + // layouts (like one for script dialogs) by passing various + // numbers in for "layout". + LLToastGroupNotifyPanel(LLNotificationPtr& notification); + + /*virtual*/ ~LLToastGroupNotifyPanel(); +protected: + void onClickOk(); + void onClickAttachment(); +private: + static bool isAttachmentOpenable(LLAssetType::EType); + + static const S32 DEFAULT_MESSAGE_MAX_LINE_COUNT; + + LLButton* mSaveInventoryBtn; + + LLUUID mGroupID; + LLOfferInfo* mInventoryOffer; +}; + +// This view contains the stack of notification windows. +//extern LLView* gGroupNotifyBoxView; + +const S32 GROUP_LAYOUT_DEFAULT = 0; +const S32 GROUP_LAYOUT_SCRIPT_DIALOG = 1; + +#endif -- cgit v1.3 From 34a55f2f05036d465ae1ddad5031a3e3f892d549 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Mon, 20 Sep 2010 13:04:56 +0100 Subject: make this at least build, but no real flesh yet. --- indra/newview/lltoastscripttextbox.cpp | 18 +++++++++--------- indra/newview/lltoastscripttextbox.h | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'indra/newview/lltoastscripttextbox.h') diff --git a/indra/newview/lltoastscripttextbox.cpp b/indra/newview/lltoastscripttextbox.cpp index bb06976d40..a54594e474 100644 --- a/indra/newview/lltoastscripttextbox.cpp +++ b/indra/newview/lltoastscripttextbox.cpp @@ -48,9 +48,9 @@ #include "llfloaterinventory.h" #include "llinventorytype.h" -const S32 LLToastGroupNotifyPanel::DEFAULT_MESSAGE_MAX_LINE_COUNT = 7; +const S32 LLToastScriptTextbox::DEFAULT_MESSAGE_MAX_LINE_COUNT = 7; -LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(LLNotificationPtr& notification) +LLToastScriptTextbox::LLToastScriptTextbox(LLNotificationPtr& notification) : LLToastPanel(notification), mInventoryOffer(NULL) { @@ -125,7 +125,7 @@ LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(LLNotificationPtr& notification mInventoryOffer = new LLOfferInfo(payload["inventory_offer"]); getChild("attachment")->setClickedCallback(boost::bind( - &LLToastGroupNotifyPanel::onClickAttachment, this)); + &LLToastScriptTextbox::onClickAttachment, this)); LLUIImagePtr attachIconImg = LLInventoryIcon::getIcon(mInventoryOffer->mType, LLInventoryType::IT_TEXTURE); @@ -134,7 +134,7 @@ LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(LLNotificationPtr& notification //ok button LLButton* pOkBtn = getChild("btn_ok"); - pOkBtn->setClickedCallback((boost::bind(&LLToastGroupNotifyPanel::onClickOk, this))); + pOkBtn->setClickedCallback((boost::bind(&LLToastScriptTextbox::onClickOk, this))); setDefaultBtn(pOkBtn); S32 maxLinesCount; @@ -147,11 +147,11 @@ LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(LLNotificationPtr& notification } // virtual -LLToastGroupNotifyPanel::~LLToastGroupNotifyPanel() +LLToastScriptTextbox::~LLToastScriptTextbox() { } -void LLToastGroupNotifyPanel::close() +void LLToastScriptTextbox::close() { // The group notice dialog may be an inventory offer. // If it has an inventory save button and that button is still enabled @@ -165,14 +165,14 @@ void LLToastGroupNotifyPanel::close() die(); } -void LLToastGroupNotifyPanel::onClickOk() +void LLToastScriptTextbox::onClickOk() { LLSD response = mNotification->getResponseTemplate(); mNotification->respond(response); close(); } -void LLToastGroupNotifyPanel::onClickAttachment() +void LLToastScriptTextbox::onClickAttachment() { if (mInventoryOffer != NULL) { mInventoryOffer->forceResponse(IOR_ACCEPT); @@ -196,7 +196,7 @@ void LLToastGroupNotifyPanel::onClickAttachment() } //static -bool LLToastGroupNotifyPanel::isAttachmentOpenable(LLAssetType::EType type) +bool LLToastScriptTextbox::isAttachmentOpenable(LLAssetType::EType type) { switch(type) { diff --git a/indra/newview/lltoastscripttextbox.h b/indra/newview/lltoastscripttextbox.h index 4890ee1dea..2d942939bc 100644 --- a/indra/newview/lltoastscripttextbox.h +++ b/indra/newview/lltoastscripttextbox.h @@ -41,7 +41,7 @@ class LLButton; * * Replaces class LLGroupNotifyBox. */ -class LLToastGroupNotifyPanel +class LLToastScriptTextbox : public LLToastPanel { public: @@ -53,9 +53,9 @@ public: // Non-transient messages. You can specify non-default button // layouts (like one for script dialogs) by passing various // numbers in for "layout". - LLToastGroupNotifyPanel(LLNotificationPtr& notification); + LLToastScriptTextbox(LLNotificationPtr& notification); - /*virtual*/ ~LLToastGroupNotifyPanel(); + /*virtual*/ ~LLToastScriptTextbox(); protected: void onClickOk(); void onClickAttachment(); -- 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/lltoastscripttextbox.h') 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 dd6a77c9e1baeec7276d3599b73d5cde384e810f Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Thu, 30 Sep 2010 12:01:36 +0100 Subject: xui / panel format cleanup. --- indra/newview/lltoastscripttextbox.cpp | 48 ++++------------------ indra/newview/lltoastscripttextbox.h | 25 +---------- .../skins/default/xui/en/panel_notify_textbox.xml | 19 ++++----- 3 files changed, 18 insertions(+), 74 deletions(-) (limited to 'indra/newview/lltoastscripttextbox.h') diff --git a/indra/newview/lltoastscripttextbox.cpp b/indra/newview/lltoastscripttextbox.cpp index 95f70eda88..581bb9519c 100644 --- a/indra/newview/lltoastscripttextbox.cpp +++ b/indra/newview/lltoastscripttextbox.cpp @@ -31,8 +31,6 @@ #include "llfocusmgr.h" #include "llbutton.h" -#include "lliconctrl.h" -#include "llinventoryfunctions.h" #include "llnotifications.h" #include "llviewertexteditor.h" @@ -44,59 +42,30 @@ #include "llglheaders.h" #include "llagent.h" -#include "llavatariconctrl.h" -#include "llfloaterinventory.h" -#include "llinventorytype.h" -const S32 LLToastScriptTextbox::DEFAULT_MESSAGE_MAX_LINE_COUNT = 7; +const S32 LLToastScriptTextbox::DEFAULT_MESSAGE_MAX_LINE_COUNT= 7; LLToastScriptTextbox::LLToastScriptTextbox(LLNotificationPtr& notification) -: LLToastNotifyPanel(notification), - mInventoryOffer(NULL) +: LLToastNotifyPanel(notification) { buildFromFile( "panel_notify_textbox.xml"); const LLSD& payload = notification->getPayload(); - llwarns << "PAYLOAD " << payload << llendl; - llwarns << "TYPE " << notification->getType() << llendl; - llwarns << "MESSAGE " << notification->getMessage() << llendl; - llwarns << "LABEL " << notification->getLabel() << llendl; - llwarns << "URL " << notification->getURL() << llendl; //message body const std::string& message = payload["message"].asString(); - std::string timeStr = "["+LLTrans::getString("UTCTimeWeek")+"],[" - +LLTrans::getString("UTCTimeDay")+"] [" - +LLTrans::getString("UTCTimeMth")+"] [" - +LLTrans::getString("UTCTimeYr")+"] [" - +LLTrans::getString("UTCTimeHr")+"]:[" - +LLTrans::getString("UTCTimeMin")+"]:[" - +LLTrans::getString("UTCTimeSec")+"] [" - +LLTrans::getString("UTCTimeTimezone")+"]"; - const LLDate timeStamp = notification->getDate(); - LLDate notice_date = timeStamp.notNull() ? timeStamp : LLDate::now(); - LLSD substitution; - substitution["datetime"] = (S32) notice_date.secondsSinceEpoch(); - LLStringUtil::format(timeStr, substitution); - LLViewerTextEditor* pMessageText = getChild("message"); pMessageText->clear(); LLStyle::Params style; - - LLFontGL* date_font = LLFontGL::getFontByName(getString("date_font")); - if (date_font) - style.font = date_font; - pMessageText->appendText(timeStr + "\n", TRUE, style); - style.font = pMessageText->getDefaultFont(); pMessageText->appendText(message, TRUE, style); - //ok button - LLButton* pOkBtn = getChild("btn_ok"); - pOkBtn->setClickedCallback((boost::bind(&LLToastScriptTextbox::onClickOk, this))); - setDefaultBtn(pOkBtn); + //submit button + LLButton* pSubmitBtn = getChild("btn_submit"); + pSubmitBtn->setClickedCallback((boost::bind(&LLToastScriptTextbox::onClickSubmit, this))); + setDefaultBtn(pSubmitBtn); S32 maxLinesCount; std::istringstream ss( getString("message_max_lines_count") ); @@ -104,7 +73,7 @@ LLToastScriptTextbox::LLToastScriptTextbox(LLNotificationPtr& notification) { maxLinesCount = DEFAULT_MESSAGE_MAX_LINE_COUNT; } - snapToMessageHeight(pMessageText, maxLinesCount); + //snapToMessageHeight(pMessageText, maxLinesCount); } // virtual @@ -118,14 +87,13 @@ void LLToastScriptTextbox::close() } #include "lllslconstants.h" -void LLToastScriptTextbox::onClickOk() +void LLToastScriptTextbox::onClickSubmit() { LLViewerTextEditor* pMessageText = getChild("message"); if (pMessageText) { LLSD response = mNotification->getResponseTemplate(); - //response["OH MY GOD WHAT A HACK"] = "woot"; response[TEXTBOX_MAGIC_TOKEN] = pMessageText->getText(); if (response[TEXTBOX_MAGIC_TOKEN].asString().empty()) { diff --git a/indra/newview/lltoastscripttextbox.h b/indra/newview/lltoastscripttextbox.h index 86fe93cf66..ae3b545e0a 100644 --- a/indra/newview/lltoastscripttextbox.h +++ b/indra/newview/lltoastscripttextbox.h @@ -27,19 +27,13 @@ #ifndef LL_LLTOASTSCRIPTTEXTBOX_H #define LL_LLTOASTSCRIPTTEXTBOX_H -#include "llfontgl.h" #include "lltoastnotifypanel.h" -#include "lldarray.h" -#include "lltimer.h" -#include "llviewermessage.h" #include "llnotificationptr.h" class LLButton; /** - * Toast panel for group notification. - * - * Replaces class LLGroupNotifyBox. + * Toast panel for scripted llTextbox notifications. */ class LLToastScriptTextbox : public LLToastNotifyPanel @@ -49,7 +43,6 @@ public: static bool onNewNotification(const LLSD& notification); - // Non-transient messages. You can specify non-default button // layouts (like one for script dialogs) by passing various // numbers in for "layout". @@ -57,23 +50,9 @@ public: /*virtual*/ ~LLToastScriptTextbox(); protected: - void onClickOk(); - void onClickAttachment(); + void onClickSubmit(); private: - static bool isAttachmentOpenable(LLAssetType::EType); - static const S32 DEFAULT_MESSAGE_MAX_LINE_COUNT; - - LLButton* mSaveInventoryBtn; - - LLUUID mGroupID; - LLOfferInfo* mInventoryOffer; }; -// This view contains the stack of notification windows. -//extern LLView* gGroupNotifyBoxView; - -const S32 GROUP_LAYOUT_DEFAULT = 0; -const S32 GROUP_LAYOUT_SCRIPT_DIALOG = 1; - #endif diff --git a/indra/newview/skins/default/xui/en/panel_notify_textbox.xml b/indra/newview/skins/default/xui/en/panel_notify_textbox.xml index dcd1e29e17..0fc84f0f3c 100644 --- a/indra/newview/skins/default/xui/en/panel_notify_textbox.xml +++ b/indra/newview/skins/default/xui/en/panel_notify_textbox.xml @@ -1,7 +1,7 @@ -