diff options
-rw-r--r-- | indra/newview/CMakeLists.txt | 3 | ||||
-rw-r--r-- | indra/newview/llnotificationhandler.h | 22 | ||||
-rw-r--r-- | indra/newview/llnotificationscripttextboxhandler.cpp | 174 | ||||
-rw-r--r-- | indra/newview/lltoastgroupnotifypanel.cpp | 2 | ||||
-rw-r--r-- | indra/newview/lltoastnotifypanel.cpp | 62 | ||||
-rw-r--r-- | indra/newview/lltoastnotifypanel.h | 2 | ||||
-rw-r--r-- | indra/newview/lltoastscripttextbox.cpp | 214 | ||||
-rw-r--r-- | indra/newview/lltoastscripttextbox.h | 79 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_notification.xml | 34 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_notify_textbox.xml | 101 |
10 files changed, 681 insertions, 12 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index e3b998876f..df6561a6a1 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -306,6 +306,7 @@ set(viewer_SOURCE_FILES llnotificationmanager.cpp llnotificationofferhandler.cpp llnotificationscripthandler.cpp + llnotificationscripttextboxhandler.cpp llnotificationstorage.cpp llnotificationtiphandler.cpp lloutfitslist.cpp @@ -440,6 +441,7 @@ set(viewer_SOURCE_FILES lltoastimpanel.cpp lltoastnotifypanel.cpp lltoastpanel.cpp + lltoastscripttextbox.cpp lltool.cpp lltoolbrush.cpp lltoolcomp.cpp @@ -966,6 +968,7 @@ set(viewer_HEADER_FILES lltoastimpanel.h lltoastnotifypanel.h lltoastpanel.h + lltoastscripttextbox.h lltool.h lltoolbrush.h lltoolcomp.h diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h index 060eccf5c7..0cca878a4f 100644 --- a/indra/newview/llnotificationhandler.h +++ b/indra/newview/llnotificationhandler.h @@ -197,9 +197,29 @@ protected: virtual void initChannel(); // own handlers - void onRejectToast(LLUUID& id); + virtual void onRejectToast(LLUUID& id); }; +/** + * Handler for specific textbox-based script notices. + */ + +class LLScriptTextboxHandler : public LLSysHandler +{ + public: + LLScriptTextboxHandler(e_notification_type type, const LLSD& id); + virtual ~LLScriptTextboxHandler(); + + // base interface functions + virtual bool processNotification(const LLSD& notify); + +protected: + virtual void onDeleteToast(LLToast* toast); + virtual void initChannel(); + + // own handlers + virtual void onRejectToast(LLUUID& id); +}; /** * Handler for group system notices. diff --git a/indra/newview/llnotificationscripttextboxhandler.cpp b/indra/newview/llnotificationscripttextboxhandler.cpp new file mode 100644 index 0000000000..27ece8422e --- /dev/null +++ b/indra/newview/llnotificationscripttextboxhandler.cpp @@ -0,0 +1,174 @@ +/** + * @file llnotificationscripthandler.cpp + * @brief Notification Handler Class for Simple Notifications and Notification Tips + * + * $LicenseInfo:firstyear=2000&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$ + */ + + +#include "llviewerprecompiledheaders.h" // must be first include + +#include "llnotificationhandler.h" +#include "lltoastnotifypanel.h" +#include "llviewercontrol.h" +#include "llviewerwindow.h" +#include "llnotificationmanager.h" +#include "llnotifications.h" +#include "llscriptfloater.h" +#include "lltoastscripttextbox.h" + +using namespace LLNotificationsUI; + +static const std::string SCRIPT_DIALOG ("ScriptDialog"); +static const std::string SCRIPT_DIALOG_GROUP ("ScriptDialogGroup"); +static const std::string SCRIPT_LOAD_URL ("LoadWebPage"); + +//-------------------------------------------------------------------------- +LLScriptTextboxHandler::LLScriptTextboxHandler(e_notification_type type, const LLSD& id) +{ + mType = type; + + // Getting a Channel for our notifications + mChannel = LLChannelManager::getInstance()->createNotificationChannel(); + mChannel->setControlHovering(true); + + LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel); + if(channel) + channel->setOnRejectToastCallback(boost::bind(&LLScriptTextboxHandler::onRejectToast, this, _1)); + +} + +//-------------------------------------------------------------------------- +LLScriptTextboxHandler::~LLScriptTextboxHandler() +{ +} + +//-------------------------------------------------------------------------- +void LLScriptTextboxHandler::initChannel() +{ + S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); + S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth"); + mChannel->init(channel_right_bound - channel_width, channel_right_bound); +} + +//-------------------------------------------------------------------------- +bool LLScriptTextboxHandler::processNotification(const LLSD& notify) +{ + if(!mChannel) + { + return false; + } + + LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID()); + + if(!notification) + return false; + + // arrange a channel on a screen + if(!mChannel->getVisible()) + { + initChannel(); + } + + if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change") + { + if (LLHandlerUtil::canLogToIM(notification)) + { + LLHandlerUtil::logToIMP2P(notification); + } + + if(SCRIPT_DIALOG == notification->getName() || SCRIPT_DIALOG_GROUP == notification->getName() || SCRIPT_LOAD_URL == notification->getName()) + { + LLScriptFloaterManager::getInstance()->onAddNotification(notification->getID()); + } + else + { + LLToastScriptTextbox* notify_box = new LLToastScriptTextbox(notification); + + LLToast::Params p; + p.notif_id = notification->getID(); + p.notification = notification; + p.panel = notify_box; + p.on_delete_toast = boost::bind(&LLScriptTextboxHandler::onDeleteToast, this, _1); + + LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel); + if(channel) + { + channel->addToast(p); + } + + // send a signal to the counter manager + mNewNotificationSignal(); + } + } + else if (notify["sigtype"].asString() == "delete") + { + if(SCRIPT_DIALOG == notification->getName() || SCRIPT_DIALOG_GROUP == notification->getName() || SCRIPT_LOAD_URL == notification->getName()) + { + LLScriptFloaterManager::getInstance()->onRemoveNotification(notification->getID()); + } + else + { + mChannel->killToastByNotificationID(notification->getID()); + } + } + return true; +} + +//-------------------------------------------------------------------------- + +void LLScriptTextboxHandler::onDeleteToast(LLToast* toast) +{ + // send a signal to the counter manager + mDelNotificationSignal(); + + // send a signal to a listener to let him perform some action + // in this case listener is a SysWellWindow and it will remove a corresponding item from its list + mNotificationIDSignal(toast->getNotificationID()); + + LLNotificationPtr notification = LLNotifications::getInstance()->find(toast->getNotificationID()); + + if( notification && + (SCRIPT_DIALOG == notification->getName() || SCRIPT_DIALOG_GROUP == notification->getName()) ) + { + LLScriptFloaterManager::getInstance()->onRemoveNotification(notification->getID()); + } +} + +//-------------------------------------------------------------------------- +void LLScriptTextboxHandler::onRejectToast(LLUUID& id) +{ + LLNotificationPtr notification = LLNotifications::instance().find(id); + + if (notification + && LLNotificationManager::getInstance()->getHandlerForNotification( + notification->getType()) == this) + { + LLNotifications::instance().cancel(notification); + } +} + +//-------------------------------------------------------------------------- + + + + diff --git a/indra/newview/lltoastgroupnotifypanel.cpp b/indra/newview/lltoastgroupnotifypanel.cpp index 4c75b07ae8..bf79492b1e 100644 --- a/indra/newview/lltoastgroupnotifypanel.cpp +++ b/indra/newview/lltoastgroupnotifypanel.cpp @@ -59,7 +59,7 @@ LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(LLNotificationPtr& notification LLGroupData groupData; if (!gAgent.getGroupData(payload["group_id"].asUUID(),groupData)) { - llwarns << "Group notice for unkown group: " << payload["group_id"].asUUID() << llendl; + llwarns << "Group notice for unknown group: " << payload["group_id"].asUUID() << llendl; } //group icon diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 1a1c94674b..7163073de4 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, bool show_images) : 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<LLPanel>("info_panel"); mControlPanel = getChild<LLPanel>("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; i<mNumOptions; ++i) + { + LLSD form_element = form->getElement(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 @@ -123,6 +149,11 @@ mCloseNotificationOnDestroy(true) mTextBox->setPlainText(!show_images); mTextBox->setValue(notification->getMessage()); + mUserInputBox = getChild<LLTextEditor>("user_input_box"); + mUserInputBox->setMaxTextLength(254);// FIXME + mUserInputBox->setVisible(FALSE); + mUserInputBox->setEnabled(FALSE); + // add buttons for a script notification if (mIsTip) { @@ -139,6 +170,17 @@ 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->setFocus(TRUE); + mUserInputBox->insertText("FOOOOOO!!!!"); continue; } LLButton* new_button = createButton(form_element, TRUE); @@ -159,7 +201,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 */ @@ -253,7 +295,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; @@ -261,7 +303,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/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h index 57711b3d80..06f6767ccd 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; diff --git a/indra/newview/lltoastscripttextbox.cpp b/indra/newview/lltoastscripttextbox.cpp new file mode 100644 index 0000000000..a54594e474 --- /dev/null +++ b/indra/newview/lltoastscripttextbox.cpp @@ -0,0 +1,214 @@ +/** + * @file lltoastscripttextbox.cpp + * @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$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "lltoastscripttextbox.h" + +#include "llfocusmgr.h" + +#include "llbutton.h" +#include "lliconctrl.h" +#include "llinventoryfunctions.h" +#include "llnotifications.h" +#include "llviewertexteditor.h" + +#include "lluiconstants.h" +#include "llui.h" +#include "llviewercontrol.h" +#include "lltrans.h" +#include "llstyle.h" + +#include "llglheaders.h" +#include "llagent.h" +#include "llavatariconctrl.h" +#include "llfloaterinventory.h" +#include "llinventorytype.h" + +const S32 LLToastScriptTextbox::DEFAULT_MESSAGE_MAX_LINE_COUNT = 7; + +LLToastScriptTextbox::LLToastScriptTextbox(LLNotificationPtr& notification) +: LLToastPanel(notification), + mInventoryOffer(NULL) +{ + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_notify_textbox.xml"); + const LLSD& payload = notification->getPayload(); + LLGroupData groupData; + if (!gAgent.getGroupData(payload["group_id"].asUUID(),groupData)) + { + llwarns << "Group notice for unknown group: " << payload["group_id"].asUUID() << llendl; + } + + //group icon + LLIconCtrl* pGroupIcon = getChild<LLIconCtrl>("group_icon", TRUE); + pGroupIcon->setValue(groupData.mInsigniaID); + + //header title + const std::string& from_name = payload["sender_name"].asString(); + std::stringstream from; + from << from_name << "/" << groupData.mName; + LLTextBox* pTitleText = getChild<LLTextBox>("title"); + pTitleText->setValue(from.str()); + + //message subject + const std::string& subject = payload["subject"].asString(); + //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<LLViewerTextEditor>("message"); + pMessageText->clear(); + + LLStyle::Params style; + LLFontGL* subject_font = LLFontGL::getFontByName(getString("subject_font")); + if (subject_font) + style.font = subject_font; + pMessageText->appendText(subject, FALSE, 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); + + //attachment + BOOL hasInventory = payload["inventory_offer"].isDefined(); + + //attachment text + LLTextBox * pAttachLink = getChild<LLTextBox>("attachment"); + //attachment icon + LLIconCtrl* pAttachIcon = getChild<LLIconCtrl>("attachment_icon", TRUE); + + //If attachment is empty let it be invisible and not take place at the panel + pAttachLink->setVisible(hasInventory); + pAttachIcon->setVisible(hasInventory); + if (hasInventory) { + pAttachLink->setValue(payload["inventory_name"]); + + mInventoryOffer = new LLOfferInfo(payload["inventory_offer"]); + getChild<LLTextBox>("attachment")->setClickedCallback(boost::bind( + &LLToastScriptTextbox::onClickAttachment, this)); + + LLUIImagePtr attachIconImg = LLInventoryIcon::getIcon(mInventoryOffer->mType, + LLInventoryType::IT_TEXTURE); + pAttachIcon->setValue(attachIconImg->getName()); + } + + //ok button + LLButton* pOkBtn = getChild<LLButton>("btn_ok"); + pOkBtn->setClickedCallback((boost::bind(&LLToastScriptTextbox::onClickOk, this))); + setDefaultBtn(pOkBtn); + + S32 maxLinesCount; + std::istringstream ss( getString("message_max_lines_count") ); + if (!(ss >> maxLinesCount)) + { + maxLinesCount = DEFAULT_MESSAGE_MAX_LINE_COUNT; + } + snapToMessageHeight(pMessageText, maxLinesCount); +} + +// virtual +LLToastScriptTextbox::~LLToastScriptTextbox() +{ +} + +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 + // Then we need to send the inventory declined message + if(mInventoryOffer != NULL) + { + mInventoryOffer->forceResponse(IOR_DECLINE); + mInventoryOffer = NULL; + } + + die(); +} + +void LLToastScriptTextbox::onClickOk() +{ + LLSD response = mNotification->getResponseTemplate(); + mNotification->respond(response); + close(); +} + +void LLToastScriptTextbox::onClickAttachment() +{ + if (mInventoryOffer != NULL) { + mInventoryOffer->forceResponse(IOR_ACCEPT); + + LLTextBox * pAttachLink = getChild<LLTextBox> ("attachment"); + static const LLUIColor textColor = LLUIColorTable::instance().getColor( + "GroupNotifyDimmedTextColor"); + pAttachLink->setColor(textColor); + + LLIconCtrl* pAttachIcon = + getChild<LLIconCtrl> ("attachment_icon", TRUE); + pAttachIcon->setEnabled(FALSE); + + //if attachment isn't openable - notify about saving + if (!isAttachmentOpenable(mInventoryOffer->mType)) { + LLNotifications::instance().add("AttachmentSaved", LLSD(), LLSD()); + } + + mInventoryOffer = NULL; + } +} + +//static +bool LLToastScriptTextbox::isAttachmentOpenable(LLAssetType::EType type) +{ + switch(type) + { + case LLAssetType::AT_LANDMARK: + case LLAssetType::AT_NOTECARD: + case LLAssetType::AT_IMAGE_JPEG: + case LLAssetType::AT_IMAGE_TGA: + case LLAssetType::AT_TEXTURE: + case LLAssetType::AT_TEXTURE_TGA: + return true; + default: + return false; + } +} + diff --git a/indra/newview/lltoastscripttextbox.h b/indra/newview/lltoastscripttextbox.h new file mode 100644 index 0000000000..2d942939bc --- /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 LLToastScriptTextbox +: 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". + LLToastScriptTextbox(LLNotificationPtr& notification); + + /*virtual*/ ~LLToastScriptTextbox(); +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 diff --git a/indra/newview/skins/default/xui/en/panel_notification.xml b/indra/newview/skins/default/xui/en/panel_notification.xml index 59ead84127..21c45aa5e3 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 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <panel + tab_stop="false" background_opaque="false" border_visible="false" background_visible="true" @@ -15,6 +16,7 @@ width="305"> <!-- THIS PANEL CONTROLS TOAST HEIGHT? --> <panel + tab_stop="false" border_visible="false" bevel_style="none" background_visible="true" @@ -58,6 +60,29 @@ <text_editor h_pad="0" v_pad="0" + border_visible="true" + embedded_items="false" + enabled="false" + follows="left|right|top|bottom" + font="SansSerif" + height="85" + layout="topleft" + left="10" + mouse_opaque="false" + name="user_input_box" + read_only="false" + tab_stop="false" + text_color="green" + text_readonly_color="red" + top="50" + visible="false" + width="285" + wrap="true" + parse_highlights="true" + parse_urls="true"/> + <text_editor + h_pad="0" + v_pad="0" bg_readonly_color="0.0 0.0 0.0 0" border_visible="false" embedded_items="false" @@ -79,8 +104,17 @@ wrap="true" parse_highlights="true" parse_urls="true"/> + <button + follows="left|top" + height="25" + layout="topleft" + left_pad="10" + label="Submit" + name="submit" + width="35" /> </panel> <panel + tab_stop="false" background_visible="false" follows="left|right|bottom" height="30" diff --git a/indra/newview/skins/default/xui/en/panel_notify_textbox.xml b/indra/newview/skins/default/xui/en/panel_notify_textbox.xml new file mode 100644 index 0000000000..a0d103e2a3 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_notify_textbox.xml @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<panel + background_visible="true" + height="90" + label="instant_message" + layout="topleft" + left="0" + name="panel_notify_textbox" + top="0" + width="305"> + <string + name="message_max_lines_count" + value="7" /> + <string + name="subject_font" + value="SANSSERIF_BIG" /> + <string + name="date_font" + value="SANSSERIF" /> + <panel + background_visible="true" + follows="top" + height="30" + label="header" + layout="topleft" + left="0" + name="header" + top="0" + width="305"> + <icon + follows="all" + height="20" + layout="topleft" + left="5" + mouse_opaque="true" + name="group_icon" + top="5" + width="20" /> + <text + follows="all" + font="SansSerifBig" + height="20" + layout="topleft" + left_pad="10" + name="title" + text_color="GroupNotifyTextColor" + top="5" + use_ellipses="true" + value="Sender Name / Group Name" + width="230" /> + </panel> + <text_editor + parse_urls="true" + enabled="true" + follows="all" + height="0" + layout="topleft" + left="25" + max_length="2147483647" + name="message" + parse_highlights="true" + read_only="true" + text_color="GroupNotifyTextColor" + top="40" + type="string" + use_ellipses="true" + value="message" + width="270" + word_wrap="true" > + </text_editor> + <icon + bottom="60" + follows="left|bottom|right" + height="15" + layout="topleft" + left="25" + mouse_opaque="true" + name="attachment_icon" + width="15" /> + <text + bottom="60" + follows="left|bottom|right" + font="SansSerif" + height="15" + layout="topleft" + left="45" + name="attachment" + text_color="GroupNotifyTextColor" + value="Attachment" + use_ellipses="true" + width="250" /> + <button + bottom="85" + follows="bottom" + height="20" + label="OK" + layout="topleft" + right="-10" + name="btn_ok" + width="70" /> +</panel> |