FIRE-15988: Add option (FSllOwnerSayToScriptDebugWindow) to route llOwnerSay messages to the script debug window

master
kadah.coba@gmail.com 2015-05-02 01:27:02 -07:00
parent ab490c9102
commit 66ddfbf033
7 changed files with 194 additions and 32 deletions

View File

@ -23296,6 +23296,17 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>0</integer>
</map>
<key>FSllOwnerSayToScriptDebugWindow</key>
<map>
<key>Comment</key>
<string>Show llOwnerSays in script debug window instead of local chat</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
</map>
</llsd>

View File

@ -605,9 +605,14 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg,
// don't show toast and add message to chat history on receive debug message
// with disabled setting showing script errors or enabled setting to show script
// errors in separate window.
if (chat_msg.mChatType == CHAT_TYPE_DEBUG_MSG)
// <FS:Kadah> [FSllOwnerSayToScriptDebugWindow]
// if (chat_msg.mChatType == CHAT_TYPE_DEBUG_MSG)
static LLCachedControl<bool> FSllOwnerSayToScriptDebugWindow(gSavedSettings, "FSllOwnerSayToScriptDebugWindow");
if (chat_msg.mChatType == CHAT_TYPE_DEBUG_MSG || (chat_msg.mChatType == CHAT_TYPE_OWNER && FSllOwnerSayToScriptDebugWindow))
{
if(gSavedSettings.getBOOL("ShowScriptErrors") == FALSE)
// <FS:Kadah> [FSllOwnerSayToScriptDebugWindow] Show llOwnerSays in the script debug window instead of local chat
// if(gSavedSettings.getBOOL("ShowScriptErrors") == FALSE)
if(gSavedSettings.getBOOL("ShowScriptErrors") == FALSE && chat_msg.mChatType == CHAT_TYPE_DEBUG_MSG)
return;
// don't process debug messages from not owned objects, see EXT-7762
@ -627,17 +632,21 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg,
//if (gSavedSettings.getS32("ShowScriptErrorsLocation")== 1)// show error in window //("ScriptErrorsAsChat"))
{
LLColor4 txt_color;
// <FS:Kadah> [FSllOwnerSayToScriptDebugWindow]
// LLColor4 txt_color;
LLViewerChat::getChatColor(chat_msg,txt_color);
// LLViewerChat::getChatColor(chat_msg,txt_color);
LLFloaterScriptDebug::addScriptLine(chat_msg.mText,
chat_msg.mFromName,
txt_color,
chat_msg.mFromID);
// LLFloaterScriptDebug::addScriptLine(chat_msg.mText,
// chat_msg.mFromName,
// txt_color,
// chat_msg.mFromID);
LLFloaterScriptDebug::addScriptLine(chat_msg);
// <FS:Ansariel> Script debug icon
//return;
if (gSavedSettings.getS32("ShowScriptErrorsLocation") == 1)
// <FS:Kadah> [FSllOwnerSayToScriptDebugWindow]
// if (gSavedSettings.getS32("ShowScriptErrorsLocation") == 1)
if (gSavedSettings.getS32("ShowScriptErrorsLocation") == 1 || chat_msg.mChatType == CHAT_TYPE_OWNER)
{
return;
}

View File

@ -35,6 +35,7 @@
#include "llerror.h"
#include "llstring.h"
#include "message.h"
#include "lltrans.h"
// project include
#include "llviewertexteditor.h"
@ -112,47 +113,69 @@ LLFloater* LLFloaterScriptDebug::addOutputWindow(const LLUUID& object_id, bool s
return floaterp;
}
void LLFloaterScriptDebug::addScriptLine(const std::string &utf8mesg, const std::string &user_name, const LLColor4& color, const LLUUID& source_id)
// <FS:Kadah> [FSllOwnerSayToScriptDebugWindow] Show llOwnerSays in the script debug window instead of local chat
// void LLFloaterScriptDebug::addScriptLine(const std::string &utf8mesg, const std::string &user_name, const LLColor4& color, const LLUUID& source_id)
void LLFloaterScriptDebug::addScriptLine(const LLChat& chat)
{
LLViewerObject* objectp = gObjectList.findObject(source_id);
// <FS:Kadah> [FSllOwnerSayToScriptDebugWindow]
// LLViewerObject* objectp = gObjectList.findObject(source_id);
LLViewerObject* objectp = gObjectList.findObject(chat.mFromID);
std::string floater_label;
// Handle /me messages.
std::string prefix = utf8mesg.substr(0, 4);
std::string message = (prefix == "/me " || prefix == "/me'") ? user_name + utf8mesg.substr(3) : utf8mesg;
// <FS:Kadah> [FSllOwnerSayToScriptDebugWindow]
// std::string prefix = utf8mesg.substr(0, 4);
// std::string message = (prefix == "/me " || prefix == "/me'") ? user_name + utf8mesg.substr(3) : utf8mesg;
if (objectp)
{
objectp->setIcon(LLViewerTextureManager::getFetchedTextureFromFile("script_error.j2c", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI));
// <FS:Ansariel> Mark script error icons
objectp->getIcon()->setScriptError();
// </FS:Ansariel> Mark script error icons
// <FS:Kadah> [FSllOwnerSayToScriptDebugWindow]
if (chat.mChatType == CHAT_TYPE_DEBUG_MSG)
{
objectp->setIcon(LLViewerTextureManager::getFetchedTextureFromFile("script_error.j2c", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI));
// <FS:Ansariel> Mark script error icons
objectp->getIcon()->setScriptError();
// </FS:Ansariel> Mark script error icons
}
// </FS:Kadah> [FSllOwnerSayToScriptDebugWindow]
floater_label = llformat("%s (%.0f, %.0f, %.0f)",
user_name.c_str(),
// <FS:Kadah> [FSllOwnerSayToScriptDebugWindow]
// user_name.c_str(),
chat.mFromName.c_str(),
objectp->getPositionRegion().mV[VX],
objectp->getPositionRegion().mV[VY],
objectp->getPositionRegion().mV[VZ]);
}
else
{
floater_label = user_name;
// <FS:Kadah> [FSllOwnerSayToScriptDebugWindow]
// floater_label = user_name;
floater_label = chat.mFromName;
}
addOutputWindow(LLUUID::null);
addOutputWindow(source_id);
// <FS:Kadah> [FSllOwnerSayToScriptDebugWindow]
// addOutputWindow(source_id);
addOutputWindow(chat.mFromID);
// add to "All" floater
LLFloaterScriptDebugOutput* floaterp = LLFloaterReg::getTypedInstance<LLFloaterScriptDebugOutput>("script_debug_output", LLUUID::null);
if (floaterp)
{
floaterp->addLine(message, user_name, color);
// <FS:Kadah> [FSllOwnerSayToScriptDebugWindow]
// floaterp->addLine(message, user_name, color);
floaterp->addLine(chat, chat.mFromName);
}
// add to specific script instance floater
floaterp = LLFloaterReg::getTypedInstance<LLFloaterScriptDebugOutput>("script_debug_output", source_id);
// <FS:Kadah> [FSllOwnerSayToScriptDebugWindow]
// floaterp = LLFloaterReg::getTypedInstance<LLFloaterScriptDebugOutput>("script_debug_output", source_id);
floaterp = LLFloaterReg::getTypedInstance<LLFloaterScriptDebugOutput>("script_debug_output", chat.mFromID);
if (floaterp)
{
floaterp->addLine(message, floater_label, color);
// <FS:Kadah> [FSllOwnerSayToScriptDebugWindow]
// floaterp->addLine(message, floater_label, color);
floaterp->addLine(chat, floater_label);
}
}
@ -179,7 +202,9 @@ LLFloaterScriptDebugOutput::~LLFloaterScriptDebugOutput()
{
}
void LLFloaterScriptDebugOutput::addLine(const std::string &utf8mesg, const std::string &user_name, const LLColor4& color)
// <FS:Kadah> [FSllOwnerSayToScriptDebugWindow]
// void LLFloaterScriptDebugOutput::addLine(const std::string &utf8mesg, const std::string &user_name, const LLColor4& color)
void LLFloaterScriptDebugOutput::addLine(const LLChat& chat, const std::string &user_name)
{
if (mObjectID.isNull())
{
@ -191,8 +216,89 @@ void LLFloaterScriptDebugOutput::addLine(const std::string &utf8mesg, const std:
setTitle(user_name);
setShortTitle(user_name);
}
// <FS:Kadah> [FSllOwnerSayToScriptDebugWindow]
// mHistoryEditor->appendText(utf8mesg, true, LLStyle::Params().color(color));
bool prependNewLineState = mHistoryEditor->getText().size() != 0;
LLColor4 txt_color = LLUIColorTable::instance().getColor("White");
LLViewerChat::getChatColor(chat, txt_color);
mHistoryEditor->appendText(utf8mesg, true, LLStyle::Params().color(color));
//IRC styled /me messages.
std::string prefix = chat.mText.substr(0, 4);
bool irc_me = (prefix == "/me " || prefix == "/me'");
if (chat.mChatType == CHAT_TYPE_OWNER) {
LLFontGL* fontp = LLViewerChat::getChatFont();
std::string font_name = LLFontGL::nameFromFont(fontp);
std::string font_size = LLFontGL::sizeFromFont(fontp);
LLStyle::Params body_message_params;
body_message_params.color(txt_color);
body_message_params.readonly_color(txt_color);
body_message_params.font.name(font_name);
body_message_params.font.size(font_size);
// Delimiter after a name in header copy/past and in plain text mode
std::string delimiter = ": ";
// Don't add any delimiter after name in irc styled messages
if (irc_me || chat.mChatStyle == CHAT_STYLE_IRC)
{
delimiter = LLStringUtil::null;
}
time_t utc_time;
utc_time = time_corrected();
std::string timeStr ="["+ LLTrans::getString("TimeHour")+"]:["+LLTrans::getString("TimeMin")+"]";
LLSD substitution;
substitution["datetime"] = (S32) utc_time;
LLStringUtil::format (timeStr, substitution);
LLStyle::Params timestamp_style(body_message_params);
LLColor4 timestamp_color = LLUIColorTable::instance().getColor("ChatTimestampColor");
timestamp_style.color(timestamp_color);
timestamp_style.readonly_color(timestamp_color);
mHistoryEditor->appendText("[" + timeStr + "] ", prependNewLineState, timestamp_style);
// [RLVa:KB] - Checked: 2010-04-22 (RLVa-1.2.0f) | Added: RLVa-1.2.0f
// NOTE-RLVa: we don't need to do any @shownames or @showloc filtering here because we'll already have an existing URL
std::string url = chat.mURL;
if ( (url.empty()) || (std::string::npos == url.find("objectim")) )
{
// [/RLVa:KB]
// for object IMs, create a secondlife:///app/objectim SLapp
/*std::string*/ url = LLViewerChat::getSenderSLURL(chat, LLSD());
// [RLVa:KB] - Checked: 2010-04-22 (RLVa-1.2.0f) | Added: RLVa-1.2.0f
}
// [/RLVa:KB]
// set the link for the object name to be the objectim SLapp
// (don't let object names with hyperlinks override our objectim Url)
LLStyle::Params link_params(body_message_params);
link_params.color.control = "ChatNameObjectColor";
LLColor4 link_color = LLUIColorTable::instance().getColor("ChatNameObjectColor");
link_params.color = link_color;
link_params.readonly_color = link_color;
link_params.is_link = true;
link_params.link_href = url;
mHistoryEditor->appendText(chat.mFromName + delimiter, false, link_params); // <FS:Zi> FIRE-8600: TAB out of chat history
std::string message = irc_me ? chat.mText.substr(3) : chat.mText;
mHistoryEditor->appendText(message, false, body_message_params);
}
else
{
std::string message = irc_me ? chat.mFromName + chat.mText.substr(3) : chat.mText;
mHistoryEditor->appendText(message, prependNewLineState, LLStyle::Params().color(txt_color));
}
// </FS:Kadah> [FSllOwnerSayToScriptDebugWindow]
mHistoryEditor->blockUndo();
}

View File

@ -28,6 +28,7 @@
#define LL_LLFLOATERSCRIPTDEBUG_H
#include "llmultifloater.h"
#include "llviewerchat.h"
class LLTextEditor;
class LLUUID;
@ -39,7 +40,9 @@ public:
virtual ~LLFloaterScriptDebug();
virtual BOOL postBuild();
static void show(const LLUUID& object_id);
static void addScriptLine(const std::string &utf8mesg, const std::string &user_name, const LLColor4& color, const LLUUID& source_id);
// <FS:Kadah> [FSllOwnerSayToScriptDebugWindow]
// static void addScriptLine(const std::string &utf8mesg, const std::string &user_name, const LLColor4& color, const LLUUID& source_id);
static void addScriptLine(const LLChat& chat);
protected:
// <FS:Ansariel> Script debug icon
@ -57,7 +60,9 @@ public:
LLFloaterScriptDebugOutput(const LLSD& object_id);
~LLFloaterScriptDebugOutput();
void addLine(const std::string &utf8mesg, const std::string &user_name, const LLColor4& color);
// <FS:Kadah> [FSllOwnerSayToScriptDebugWindow]
// void addLine(const std::string &utf8mesg, const std::string &user_name, const LLColor4& color);
void addLine(const LLChat& chat, const std::string &user_name);
virtual BOOL postBuild();

View File

@ -8,7 +8,7 @@
name="script debug floater"
help_topic="script_debug_floater"
save_rect="true"
title="Script Warning/Error"
title="Script Warning/Error/Debug"
width="450">
<tab_container
background_visible="false"

View File

@ -2,7 +2,7 @@
<floater
legacy_header_height="18"
can_resize="false"
height="630"
height="660"
layout="topleft"
name="floater_script_colors"
help_topic="lsl_editor_preferences"
@ -506,12 +506,11 @@
left="8"
right="-8"
top="250"
bottom="-208"
type="string"
length="1"
follows="left|top|right|bottom"
font="Monospace"
height="100"
height="165"
ignore_tab="false"
layout="topleft"
max_length="300"
@ -544,7 +543,7 @@ default
layout="topleft"
left="12"
name="prefs_label"
top="430"
top_pad="6"
width="150">
Script Editor Options:
</text>
@ -638,6 +637,28 @@ default
<button.commit_callback
function="NACL.SetPreprocInclude" />
</button>
<text
follows="left|top"
height="15"
layout="topleft"
left="12"
name="prefs_label"
top_pad="6"
width="150">
Advanced Options:
</text>
<check_box
control_name="FSllOwnerSayToScriptDebugWindow"
follows="left|top"
layout="topleft"
left_delta="5"
height="12"
name="FSllOwnerSayToScriptDebugWindow_checkbox"
top_pad="6"
width="200"
label="Route llOwnerSays to script debug window" />
<button
follows="top|left"
height="23"

View File

@ -738,6 +738,16 @@
width="70">
seconds
</text>
<check_box
control_name="FSllOwnerSayToScriptDebugWindow"
follows="left|top"
layout="topleft"
left="20"
height="12"
name="FSllOwnerSayToScriptDebugWindow_checkbox"
top_pad="6"
width="200"
label="Route llOwnerSays to script debug window" />
</panel>
<!-- Chat: Typing -->