From 1d20db450c4cc5e13c44590936d7d80dbc318f20 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 12 Nov 2015 00:04:39 +0100 Subject: [PATCH 01/75] FIRE-13863: Enable moving folder links via drag and drop (can be disabled via debug setting "FSEnableMovingFolderLinks"); based on a patch by Satomi Ahn --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llinventorybridge.cpp | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 92d2ccd476..6597c4af30 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -23704,6 +23704,17 @@ Change of this parameter will affect the layout of buttons in notification toast Value 0 + FSEnableMovingFolderLinks + + Comment + Enable moving of folder links via drag and drop + Persist + 1 + Type + Boolean + Value + 1 + diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 7d7478d005..a9d2781e98 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -4484,7 +4484,10 @@ BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop, // DAD_LINK type might mean one of two asset types: AT_LINK or AT_LINK_FOLDER. // If we have an item of AT_LINK_FOLDER type we should process the linked // category being dragged or dropped into folder. - if (inv_item && LLAssetType::AT_LINK_FOLDER == inv_item->getActualType()) + // FIRE-13863: Allow moving folder links + //if (inv_item && LLAssetType::AT_LINK_FOLDER == inv_item->getActualType()) + if (inv_item && LLAssetType::AT_LINK_FOLDER == inv_item->getActualType() && !gSavedSettings.getBOOL("FSEnableMovingFolderLinks")) + // { LLInventoryCategory* linked_category = gInventory.getCategory(inv_item->getLinkedUUID()); if (linked_category) From fce74b37e1654b60c5999e80cecfd24f568cc7c8 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 12 Nov 2015 09:23:41 +0100 Subject: [PATCH 02/75] More banging on things: Finally introduce a "default" parameter for FSNearbyChatControl so we can get rid of string compares on names --- indra/newview/fsnearbychatcontrol.cpp | 12 ++++-------- indra/newview/fsnearbychatcontrol.h | 17 ++++++++++++++--- indra/newview/fsnearbychathub.cpp | 16 +++++++--------- .../ansastorm/xui/en/panel_toolbar_view.xml | 1 + .../skins/default/xui/en/panel_toolbar_view.xml | 1 + .../skins/latency/xui/en/panel_toolbar_view.xml | 1 + .../metaharper/xui/en/panel_toolbar_view.xml | 1 + .../starlight/xui/en/panel_toolbar_view.xml | 1 + .../starlightcui/xui/en/panel_toolbar_view.xml | 1 + .../skins/vintage/xui/en/panel_toolbar_view.xml | 1 + 10 files changed, 32 insertions(+), 20 deletions(-) diff --git a/indra/newview/fsnearbychatcontrol.cpp b/indra/newview/fsnearbychatcontrol.cpp index 26ba7f6038..b07b1361c8 100644 --- a/indra/newview/fsnearbychatcontrol.cpp +++ b/indra/newview/fsnearbychatcontrol.cpp @@ -27,14 +27,8 @@ #include "llviewerprecompiledheaders.h" -// llui -#include "lllineeditor.h" -#include "llspinctrl.h" - -// newview #include "fsnearbychatcontrol.h" #include "fsnearbychathub.h" -#include "fsfloaternearbychat.h" #include "llagent.h" // gAgent #include "llagentcamera.h" // gAgentCamera #include "llautoreplace.h" @@ -43,7 +37,8 @@ static LLDefaultChildRegistry::Register r("fs_nearby_chat_control"); FSNearbyChatControl::FSNearbyChatControl(const FSNearbyChatControl::Params& p) : - LLLineEditor(p) + LLLineEditor(p), + mDefault(p.is_default) { // FIRE-11373: Autoreplace doesn't work in nearby chat bar setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2, _3, _4, _5)); @@ -93,7 +88,7 @@ void FSNearbyChatControl::setFocus(BOOL focus) void FSNearbyChatControl::autohide() { - if (getName() == "default_chat_bar") + if (isDefault()) { if (gSavedSettings.getBOOL("CloseChatOnReturn")) { @@ -142,6 +137,7 @@ BOOL FSNearbyChatControl::handleKeyHere(KEY key, MASK mask) } else if (mask == (MASK_SHIFT | MASK_CONTROL)) { + // linefeed addChar(llwchar(182)); return TRUE; } diff --git a/indra/newview/fsnearbychatcontrol.h b/indra/newview/fsnearbychatcontrol.h index 43a0b22eba..be2a0d14c2 100644 --- a/indra/newview/fsnearbychatcontrol.h +++ b/indra/newview/fsnearbychatcontrol.h @@ -28,13 +28,20 @@ #ifndef FS_NEARBYCHATCONTROL_H #define FS_NEARBYCHATCONTROL_H -#include "llchat.h" #include "lllineeditor.h" class FSNearbyChatControl : public LLLineEditor { public: - struct Params : public LLInitParam::Block {}; + struct Params : public LLInitParam::Block + { + Optional is_default; + + Params() + : is_default("default", false) + { + } + }; FSNearbyChatControl(const Params& p); ~FSNearbyChatControl(); @@ -45,12 +52,16 @@ public: virtual BOOL handleKeyHere(KEY key, MASK mask); + bool isDefault() const { return mDefault; } + private: // Typing in progress, expand gestures etc. static void onKeystroke(LLLineEditor* caller, void* userdata); // Unfocus and autohide chat bar accordingly if we are the default chat bar - void autohide(); + void autohide(); + + bool mDefault; }; #endif // FS_NEARBYCHATCONTROL_H diff --git a/indra/newview/fsnearbychathub.cpp b/indra/newview/fsnearbychathub.cpp index 890b464f7f..f81ca7400d 100644 --- a/indra/newview/fsnearbychathub.cpp +++ b/indra/newview/fsnearbychathub.cpp @@ -504,10 +504,9 @@ void FSNearbyChat::sendChat(LLWString text, EChatType type) // all chat bars call this function and we keep the first or one that's seen as the default void FSNearbyChat::registerChatBar(FSNearbyChatControl* chatBar) { - // TODO: make this a Param option "is_default" - if (!mDefaultChatBar || chatBar->getName() == "default_chat_bar") + if (!mDefaultChatBar || chatBar->isDefault()) { - mDefaultChatBar=chatBar; + mDefaultChatBar = chatBar; } } @@ -520,7 +519,7 @@ void FSNearbyChat::showDefaultChatBar(BOOL visible, const char* text) const } // change settings control to signal button state - gSavedSettings.setBOOL("MainChatbarVisible",visible); + gSavedSettings.setBOOL("MainChatbarVisible", visible); mDefaultChatBar->getParent()->setVisible(visible); mDefaultChatBar->setVisible(visible); @@ -556,11 +555,10 @@ void FSNearbyChat::setFocusedInputEditor(FSNearbyChatControl* inputEditor, BOOL { mFocusedInputEditor = inputEditor; } - - // only remove focus if the request came from the previously active input editor - // to avoid races else if (mFocusedInputEditor == inputEditor) { + // only remove focus if the request came from the previously active input editor + // to avoid races mFocusedInputEditor = NULL; } } @@ -569,7 +567,7 @@ void FSNearbyChat::setFocusedInputEditor(FSNearbyChatControl* inputEditor, BOOL // and the hide chat bar feature in mouselook in llagent.cpp BOOL FSNearbyChat::defaultChatBarIsIdle() const { - if (mFocusedInputEditor && mFocusedInputEditor->getName() == "default_chat_bar") + if (mFocusedInputEditor && mFocusedInputEditor->isDefault()) { return mFocusedInputEditor->getText().empty(); } @@ -581,7 +579,7 @@ BOOL FSNearbyChat::defaultChatBarIsIdle() const // for the "arrow key moves avatar when chat is empty" hack in llviewerwindow.cpp BOOL FSNearbyChat::defaultChatBarHasFocus() const { - if (mFocusedInputEditor && mFocusedInputEditor->getName() == "default_chat_bar") + if (mFocusedInputEditor && mFocusedInputEditor->isDefault()) { return TRUE; } diff --git a/indra/newview/skins/ansastorm/xui/en/panel_toolbar_view.xml b/indra/newview/skins/ansastorm/xui/en/panel_toolbar_view.xml index a87f701276..836c1e526c 100644 --- a/indra/newview/skins/ansastorm/xui/en/panel_toolbar_view.xml +++ b/indra/newview/skins/ansastorm/xui/en/panel_toolbar_view.xml @@ -226,6 +226,7 @@ Date: Thu, 12 Nov 2015 09:45:39 +0100 Subject: [PATCH 03/75] Maintenance: Rename XUI name for FSNearbyChatVoiceControl to "fs_nearby_chat_voice_monitor" for consistence reasons --- indra/newview/fsnearbychatvoicemonitor.cpp | 2 +- .../ansastorm/xui/en/panel_toolbar_view.xml | 20 +++++++++---------- .../default/xui/en/panel_toolbar_view.xml | 20 +++++++++---------- ...r.xml => fs_nearby_chat_voice_monitor.xml} | 4 ++-- .../default/xui/ja/panel_toolbar_view.xml | 1 - .../metaharper/xui/en/panel_toolbar_view.xml | 20 +++++++++---------- .../starlight/xui/en/panel_toolbar_view.xml | 20 +++++++++---------- .../xui/en/panel_toolbar_view.xml | 20 +++++++++---------- 8 files changed, 53 insertions(+), 54 deletions(-) rename indra/newview/skins/default/xui/en/widgets/{nearby_chat_voice_monitor.xml => fs_nearby_chat_voice_monitor.xml} (82%) diff --git a/indra/newview/fsnearbychatvoicemonitor.cpp b/indra/newview/fsnearbychatvoicemonitor.cpp index 904be7b485..2d0779f53c 100644 --- a/indra/newview/fsnearbychatvoicemonitor.cpp +++ b/indra/newview/fsnearbychatvoicemonitor.cpp @@ -29,7 +29,7 @@ #include "fsnearbychatvoicemonitor.h" #include "llvoiceclient.h" -static LLDefaultChildRegistry::Register r("nearby_chat_voice_monitor"); +static LLDefaultChildRegistry::Register r("fs_nearby_chat_voice_monitor"); FSNearbyChatVoiceControl::Params::Params() : voice_monitor_padding("voice_monitor_padding"), diff --git a/indra/newview/skins/ansastorm/xui/en/panel_toolbar_view.xml b/indra/newview/skins/ansastorm/xui/en/panel_toolbar_view.xml index 836c1e526c..9988ad251a 100644 --- a/indra/newview/skins/ansastorm/xui/en/panel_toolbar_view.xml +++ b/indra/newview/skins/ansastorm/xui/en/panel_toolbar_view.xml @@ -224,16 +224,16 @@ parameter="fs_nearby_chat" /> - + - + - - + diff --git a/indra/newview/skins/default/xui/ja/panel_toolbar_view.xml b/indra/newview/skins/default/xui/ja/panel_toolbar_view.xml index b9c8ea072f..dcf59a04a1 100644 --- a/indra/newview/skins/default/xui/ja/panel_toolbar_view.xml +++ b/indra/newview/skins/default/xui/ja/panel_toolbar_view.xml @@ -46,7 +46,6 @@ - + - + - + Date: Thu, 12 Nov 2015 10:12:39 +0100 Subject: [PATCH 04/75] Maintenance: More removal of code duplication - this time: processChatTypeTriggers() --- indra/newview/fsfloaternearbychat.cpp | 45 ++------------------------- indra/newview/fsfloaternearbychat.h | 1 - indra/newview/fsnearbychathub.cpp | 3 +- indra/newview/fsnearbychathub.h | 2 +- 4 files changed, 5 insertions(+), 46 deletions(-) diff --git a/indra/newview/fsfloaternearbychat.cpp b/indra/newview/fsfloaternearbychat.cpp index f729ab46e9..f736bb1746 100644 --- a/indra/newview/fsfloaternearbychat.cpp +++ b/indra/newview/fsfloaternearbychat.cpp @@ -81,16 +81,6 @@ void send_chat_from_nearby_floater(std::string utf8_out_text, EChatType type, S3 // [/RLVa:KB] void really_send_chat_from_nearby_floater(std::string utf8_out_text, EChatType type, S32 channel); -struct LLChatTypeTrigger { - std::string name; - EChatType type; -}; - -static LLChatTypeTrigger sChatTypeTriggers[] = { - { "/whisper" , CHAT_TYPE_WHISPER}, - { "/shout" , CHAT_TYPE_SHOUT} -}; - FSFloaterNearbyChat::FSFloaterNearbyChat(const LLSD& key) : LLFloater(key) ,mChatHistory(NULL) @@ -693,6 +683,7 @@ BOOL FSFloaterNearbyChat::handleKeyHere( KEY key, MASK mask ) } else if (mask == (MASK_SHIFT | MASK_CONTROL)) { + // linefeed if (!gSavedSettings.getBOOL("FSUseSingleLineChatEntry")) { if ((wstring_utf8_length(mInputEditor->getWText()) + wchar_utf8_length('\n')) > mInputEditor->getMaxTextLength()) @@ -746,38 +737,6 @@ void FSFloaterNearbyChat::reshapeChatLayoutPanel() mChatLayoutPanel->reshape(mChatLayoutPanel->getRect().getWidth(), mInputEditor->getRect().getHeight() + mInputEditorPad, FALSE); } -EChatType FSFloaterNearbyChat::processChatTypeTriggers(EChatType type, std::string &str) -{ - U32 length = str.length(); - S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers); - - for (S32 n = 0; n < cnt; n++) - { - if (length >= sChatTypeTriggers[n].name.length()) - { - std::string trigger = str.substr(0, sChatTypeTriggers[n].name.length()); - - if (!LLStringUtil::compareInsensitive(trigger, sChatTypeTriggers[n].name)) - { - U32 trigger_length = sChatTypeTriggers[n].name.length(); - - // It's to remove space after trigger name - if (length > trigger_length && str[trigger_length] == ' ') - trigger_length++; - - str = str.substr(trigger_length, length); - - if (CHAT_TYPE_NORMAL == type) - return sChatTypeTriggers[n].type; - else - break; - } - } - } - - return type; -} - void FSFloaterNearbyChat::sendChat( EChatType type ) { if (mInputEditor) @@ -839,7 +798,7 @@ void FSFloaterNearbyChat::sendChat( EChatType type ) nType = type; } - type = processChatTypeTriggers(nType, utf8_revised_text); + type = FSNearbyChat::processChatTypeTriggers(nType, utf8_revised_text); if (!utf8_revised_text.empty() && cmd_line_chat(utf8_revised_text, type)) { diff --git a/indra/newview/fsfloaternearbychat.h b/indra/newview/fsfloaternearbychat.h index 0b66c0b29d..bd4590ec43 100644 --- a/indra/newview/fsfloaternearbychat.h +++ b/indra/newview/fsfloaternearbychat.h @@ -111,7 +111,6 @@ protected: void onChatBoxCommit(); void onChatTypeChanged(); - EChatType processChatTypeTriggers(EChatType type, std::string &str); void reshapeFloater(bool collapse); void reshapeChatLayoutPanel(); diff --git a/indra/newview/fsnearbychathub.cpp b/indra/newview/fsnearbychathub.cpp index f81ca7400d..554d29d71d 100644 --- a/indra/newview/fsnearbychathub.cpp +++ b/indra/newview/fsnearbychathub.cpp @@ -65,7 +65,7 @@ struct LLChatTypeTrigger { static LLChatTypeTrigger sChatTypeTriggers[] = { { "/whisper" , CHAT_TYPE_WHISPER}, - { "/shout" , CHAT_TYPE_SHOUT} + { "/shout" , CHAT_TYPE_SHOUT} }; S32 FSNearbyChat::sLastSpecialChatChannel = 0; @@ -318,6 +318,7 @@ void FSNearbyChat::sendChatFromViewer(const LLWString& wtext, EChatType type, BO send_chat_from_viewer(utf8_out_text, type, channel); } +// static EChatType FSNearbyChat::processChatTypeTriggers(EChatType type, std::string &str) { U32 length = str.length(); diff --git a/indra/newview/fsnearbychathub.h b/indra/newview/fsnearbychathub.h index 9d89cbc9dd..2dac0c0bc2 100644 --- a/indra/newview/fsnearbychathub.h +++ b/indra/newview/fsnearbychathub.h @@ -57,7 +57,7 @@ public: void sendChat(LLWString text, EChatType type); static LLWString stripChannelNumber(const LLWString &mesg, S32* channel, S32* last_channel, bool* is_set); - EChatType processChatTypeTriggers(EChatType type, std::string &str); + static EChatType processChatTypeTriggers(EChatType type, std::string &str); void sendChatFromViewer(const std::string& utf8text, EChatType type, BOOL animate); void sendChatFromViewer(const LLWString& wtext, EChatType type, BOOL animate); From fd08f9e9f261fac5bcb5b8d4549cf814b02aa333 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 12 Nov 2015 10:41:14 +0100 Subject: [PATCH 05/75] Maintenance: More shooting at code dupes - victims this time: send_chat_from_nearby_floater() and really_send_chat_from_nearby_floater() --- indra/newview/fsfloaternearbychat.cpp | 159 +------------------------- indra/newview/fsnearbychathub.cpp | 124 +++++++++----------- indra/newview/fsnearbychathub.h | 2 + 3 files changed, 60 insertions(+), 225 deletions(-) diff --git a/indra/newview/fsfloaternearbychat.cpp b/indra/newview/fsfloaternearbychat.cpp index f736bb1746..7e0b74510e 100644 --- a/indra/newview/fsfloaternearbychat.cpp +++ b/indra/newview/fsfloaternearbychat.cpp @@ -76,10 +76,6 @@ S32 FSFloaterNearbyChat::sLastSpecialChatChannel = 0; -// [RLVa:KB] - Checked: 2010-02-27 (RLVa-0.2.2) -void send_chat_from_nearby_floater(std::string utf8_out_text, EChatType type, S32 channel); -// [/RLVa:KB] -void really_send_chat_from_nearby_floater(std::string utf8_out_text, EChatType type, S32 channel); FSFloaterNearbyChat::FSFloaterNearbyChat(const LLSD& key) : LLFloater(key) @@ -925,7 +921,7 @@ void FSFloaterNearbyChat::sendChatFromViewer(const LLWString &wtext, EChatType t } } - send_chat_from_nearby_floater(utf8_out_text, type, channel); + send_chat_from_viewer(utf8_out_text, type, channel); } // Exit "chat mode" and do the appropriate focus changes @@ -936,161 +932,10 @@ void FSFloaterNearbyChat::stopChat() if (nearby_chat) { nearby_chat->mInputEditor->setFocus(FALSE); - gAgent.stopTyping(); + gAgent.stopTyping(); } } -//void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel) -// [RLVa:KB] - Checked: 2010-02-27 (RLVa-1.2.0b) | Modified: RLVa-0.2.2a -void send_chat_from_nearby_floater(std::string utf8_out_text, EChatType type, S32 channel) -// [/RLVa:KB] -{ - // [RLVa:KB] - Checked: 2010-02-27 (RLVa-1.2.0b) | Modified: RLVa-1.2.0a - // Only process chat messages (ie not CHAT_TYPE_START, CHAT_TYPE_STOP, etc) - if ( (rlv_handler_t::isEnabled()) && ( (CHAT_TYPE_WHISPER == type) || (CHAT_TYPE_NORMAL == type) || (CHAT_TYPE_SHOUT == type) ) ) - { - if (0 == channel) - { - // (We already did this before, but LLChatHandler::handle() calls this directly) - if ( ((CHAT_TYPE_SHOUT == type) || (CHAT_TYPE_NORMAL == type)) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATNORMAL)) ) - type = CHAT_TYPE_WHISPER; - else if ( (CHAT_TYPE_SHOUT == type) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATSHOUT)) ) - type = CHAT_TYPE_NORMAL; - else if ( (CHAT_TYPE_WHISPER == type) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATWHISPER)) ) - type = CHAT_TYPE_NORMAL; - - // Redirect chat if needed - if ( ( (gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT) || (gRlvHandler.hasBehaviour(RLV_BHVR_REDIREMOTE)) ) && - (gRlvHandler.redirectChatOrEmote(utf8_out_text)) ) ) - { - return; - } - - // Filter public chat if sendchat restricted - if (gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHAT)) - gRlvHandler.filterChat(utf8_out_text, true); - } - else - { - // Don't allow chat on a non-public channel if sendchannel restricted (unless the channel is an exception) - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHANNEL)) && (!gRlvHandler.isException(RLV_BHVR_SENDCHANNEL, channel)) ) - return; - - // Don't allow chat on debug channel if @sendchat, @redirchat or @rediremote restricted (shows as public chat on viewers) - if (CHAT_CHANNEL_DEBUG == channel) - { - bool fIsEmote = RlvUtil::isEmote(utf8_out_text); - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHAT)) || - ((!fIsEmote) && (gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT))) || - ((fIsEmote) && (gRlvHandler.hasBehaviour(RLV_BHVR_REDIREMOTE))) ) - { - return; - } - } - } - } - // [/RLVa:KB] - - // FIRE-787: break up too long chat lines into multiple messages - U32 split = MAX_MSG_BUF_SIZE - 1; - U32 pos = 0; - U32 total = utf8_out_text.length(); - - // Don't break null messages - if(total == 0) - { - really_send_chat_from_nearby_floater(utf8_out_text, type, channel); - } - - while(pos < total) - { - U32 next_split = split; - - if (pos + next_split > total) - { - // just send the rest of the message - next_split = total - pos; - } - else - { - // first, try to split at a space - while((U8(utf8_out_text[pos + next_split]) != ' ') - && (next_split > 0)) - { - --next_split; - } - - if (next_split == 0) - { - next_split = split; - // no space found, split somewhere not in the middle of UTF-8 - while((U8(utf8_out_text[pos + next_split]) >= 0x80) - && (U8(utf8_out_text[pos + next_split]) < 0xC0) - && (next_split > 0)) - { - --next_split; - } - } - - if(next_split == 0) - { - next_split = split; - LL_WARNS("Splitting") << "utf-8 couldn't be split correctly" << LL_ENDL; - } - } - - std::string send = utf8_out_text.substr(pos, next_split); - pos += next_split; - - // *FIXME: Queue messages and wait for server - really_send_chat_from_nearby_floater(send, type, channel); - } - - // moved here so we don't bump the count for every message segment - add(LLStatViewer::CHAT_COUNT,1); - // FIRE-787 -} - -// FIRE-787: break up too long chat lines into multiple messages -// This function just sends the message, with no other processing. Moved out -// of send_chat_from_viewer. -void really_send_chat_from_nearby_floater(std::string utf8_out_text, EChatType type, S32 channel) -{ - LLMessageSystem* msg = gMessageSystem; - - // gMessageSystem can be 0, not sure how it is exactly to reproduce, maybe during viewer shutdown? - if( !msg ) - return; - // - - if(channel >= 0) - { - msg->newMessageFast(_PREHASH_ChatFromViewer); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgentID); - msg->addUUIDFast(_PREHASH_SessionID, gAgentSessionID); - msg->nextBlockFast(_PREHASH_ChatData); - msg->addStringFast(_PREHASH_Message, utf8_out_text); - msg->addU8Fast(_PREHASH_Type, type); - msg->addS32("Channel", channel); - } - else - { - msg->newMessage("ScriptDialogReply"); - msg->nextBlock("AgentData"); - msg->addUUID("AgentID", gAgentID); - msg->addUUID("SessionID", gAgentSessionID); - msg->nextBlock("Data"); - msg->addUUID("ObjectID", gAgentID); - msg->addS32("ChatChannel", channel); - msg->addS32("ButtonIndex", 0); - msg->addString("ButtonLabel", utf8_out_text); - } - - gAgent.sendReliableMessage(); -} -// FIRE-787 - void FSFloaterNearbyChat::updateUnreadMessageNotification(S32 unread_messages, bool muted_history) { BOOL show_muted_history = gSavedSettings.getBOOL("FSShowMutedChatHistory"); diff --git a/indra/newview/fsnearbychathub.cpp b/indra/newview/fsnearbychathub.cpp index 554d29d71d..52966e7b05 100644 --- a/indra/newview/fsnearbychathub.cpp +++ b/indra/newview/fsnearbychathub.cpp @@ -48,15 +48,8 @@ static const U32 NAME_PREDICTION_MINIMUM_LENGTH = 3; -// Fix for bad edge snapping // *HACK* chat bar cannot return its correct height for some reason static const S32 MAGIC_CHAT_BAR_PAD = 5; -// Fix for bad edge snapping - -// FIRE-787: break up too long chat lines into multiple messages -void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel); -void really_send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel); -// FIRE-787 struct LLChatTypeTrigger { std::string name; @@ -68,30 +61,47 @@ static LLChatTypeTrigger sChatTypeTriggers[] = { { "/shout" , CHAT_TYPE_SHOUT} }; -S32 FSNearbyChat::sLastSpecialChatChannel = 0; -FSNearbyChat::FSNearbyChat() : - mDefaultChatBar(NULL), - mFocusedInputEditor(NULL) +// This function just sends the message, with no other processing. Moved out +// of send_chat_from_viewer. +void really_send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel) { - gSavedSettings.getControl("MainChatbarVisible")->getSignal()->connect(boost::bind(&FSNearbyChat::onDefaultChatBarButtonClicked, this)); + LLMessageSystem* msg = gMessageSystem; + + if (!msg) + { + return; + } + + if (channel >= 0) + { + msg->newMessageFast(_PREHASH_ChatFromViewer); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgentID); + msg->addUUIDFast(_PREHASH_SessionID, gAgentSessionID); + msg->nextBlockFast(_PREHASH_ChatData); + msg->addStringFast(_PREHASH_Message, utf8_out_text); + msg->addU8Fast(_PREHASH_Type, type); + msg->addS32("Channel", channel); + } + else + { + msg->newMessage("ScriptDialogReply"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgentID); + msg->addUUID("SessionID", gAgentSessionID); + msg->nextBlock("Data"); + msg->addUUID("ObjectID", gAgentID); + msg->addS32("ChatChannel", channel); + msg->addS32("ButtonIndex", 0); + msg->addString("ButtonLabel", utf8_out_text); + } + + gAgent.sendReliableMessage(); } -FSNearbyChat::~FSNearbyChat() -{ -} - -void FSNearbyChat::onDefaultChatBarButtonClicked() -{ - showDefaultChatBar(gSavedSettings.getBOOL("MainChatbarVisible")); -} - -//void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel) -// [RLVa:KB] - Checked: 2010-02-27 (RLVa-1.2.0b) | Modified: RLVa-0.2.2a void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel) -// [/RLVa:KB] { -// [RLVa:KB] - Checked: 2010-02-27 (RLVa-1.2.0b) | Modified: RLVa-1.2.0a // Only process chat messages (ie not CHAT_TYPE_START, CHAT_TYPE_STOP, etc) if ( (rlv_handler_t::isEnabled()) && ( (CHAT_TYPE_WHISPER == type) || (CHAT_TYPE_NORMAL == type) || (CHAT_TYPE_SHOUT == type) ) ) { @@ -135,9 +145,7 @@ void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channe } } } -// [/RLVa:KB] -// FIRE-787: break up too long chat lines into multiple messages U32 split = MAX_MSG_BUF_SIZE - 1; U32 pos = 0; U32 total = utf8_out_text.length(); @@ -194,51 +202,31 @@ void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channe } // moved here so we don't bump the count for every message segment - add(LLStatViewer::CHAT_COUNT,1); -// FIRE-787 + add(LLStatViewer::CHAT_COUNT, 1); } -// FIRE-787: break up too long chat lines into multiple messages -// This function just sends the message, with no other processing. Moved out -// of send_chat_from_viewer. -void really_send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel) + +////////////////////////////////////////////////////////////////////////////// +// FSNearbyChat +////////////////////////////////////////////////////////////////////////////// + +S32 FSNearbyChat::sLastSpecialChatChannel = 0; + +FSNearbyChat::FSNearbyChat() : + mDefaultChatBar(NULL), + mFocusedInputEditor(NULL) { - LLMessageSystem* msg = gMessageSystem; - - // gMessageSystem can be 0, not sure how it is exactly to reproduce, maybe during viewer shutdown? - if (!msg) - { - return; - } - // - - if (channel >= 0) - { - msg->newMessageFast(_PREHASH_ChatFromViewer); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_ChatData); - msg->addStringFast(_PREHASH_Message, utf8_out_text); - msg->addU8Fast(_PREHASH_Type, type); - msg->addS32("Channel", channel); - } - else - { - msg->newMessage("ScriptDialogReply"); - msg->nextBlock("AgentData"); - msg->addUUID("AgentID", gAgent.getID()); - msg->addUUID("SessionID", gAgent.getSessionID()); - msg->nextBlock("Data"); - msg->addUUID("ObjectID", gAgent.getID()); - msg->addS32("ChatChannel", channel); - msg->addS32("ButtonIndex", 0); - msg->addString("ButtonLabel", utf8_out_text); - } - - gAgent.sendReliableMessage(); + gSavedSettings.getControl("MainChatbarVisible")->getSignal()->connect(boost::bind(&FSNearbyChat::onDefaultChatBarButtonClicked, this)); +} + +FSNearbyChat::~FSNearbyChat() +{ +} + +void FSNearbyChat::onDefaultChatBarButtonClicked() +{ + showDefaultChatBar(gSavedSettings.getBOOL("MainChatbarVisible")); } -// FIRE-787 void FSNearbyChat::sendChatFromViewer(const std::string& utf8text, EChatType type, BOOL animate) { diff --git a/indra/newview/fsnearbychathub.h b/indra/newview/fsnearbychathub.h index 2dac0c0bc2..9a55f2bccd 100644 --- a/indra/newview/fsnearbychathub.h +++ b/indra/newview/fsnearbychathub.h @@ -34,6 +34,8 @@ class FSNearbyChatControl; class LLUICtrl; +void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel); + class FSNearbyChat : public LLSingleton { friend class LLSingleton; From f2dfac8b2281abf7e853e17dc917eff5cc873c56 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 12 Nov 2015 12:01:34 +0100 Subject: [PATCH 06/75] Maintenance: Consolidate sendChatFromViewer() methods into FSNearbyChat::sendChatFromViewer() --- indra/newview/fsfloaternearbychat.cpp | 71 ++------------------------- indra/newview/fsfloaternearbychat.h | 12 ++--- indra/newview/fsnearbychathub.cpp | 6 +++ indra/newview/fsnearbychathub.h | 3 +- 4 files changed, 16 insertions(+), 76 deletions(-) diff --git a/indra/newview/fsfloaternearbychat.cpp b/indra/newview/fsfloaternearbychat.cpp index 7e0b74510e..796200cefb 100644 --- a/indra/newview/fsfloaternearbychat.cpp +++ b/indra/newview/fsfloaternearbychat.cpp @@ -846,82 +846,19 @@ void FSFloaterNearbyChat::onChatTypeChanged() void FSFloaterNearbyChat::sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate) { - sendChatFromViewer(utf8str_to_wstring(utf8text), type, animate); -} - -void FSFloaterNearbyChat::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate) -{ + LLWString wtext = utf8string_to_wstring(utf8text); S32 channel = 0; bool is_set = false; LLWString out_text = FSNearbyChat::stripChannelNumber(wtext, &channel, &sLastSpecialChatChannel, &is_set); - // If "/" is not specified, see if a channel has been set in - // the spinner. + // If "/" is not specified, see if a channel has been set in the spinner. if (!is_set && gSavedSettings.getBOOL("FSNearbyChatbar") && gSavedSettings.getBOOL("FSShowChatChannel")) { - // [FS communication UI] - //channel = (S32)(LLFloaterNearbyChat::getInstance()->getChild("ChatChannel")->get()); channel = (S32)(FSFloaterNearbyChat::getInstance()->getChild("ChatChannel")->get()); - // [FS communication UI] } - std::string utf8_out_text = wstring_to_utf8str(out_text); - std::string utf8_text = wstring_to_utf8str(wtext); - - utf8_text = utf8str_trim(utf8_text); - if (!utf8_text.empty()) - { - utf8_text = utf8str_truncate(utf8_text, MAX_STRING - 1); - } - - // [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.2.0b) | Modified: RLVa-1.2.0b - if ( (0 == channel) && (rlv_handler_t::isEnabled()) ) - { - // Adjust the (public) chat "volume" on chat and gestures (also takes care of playing the proper animation) - if ( ((CHAT_TYPE_SHOUT == type) || (CHAT_TYPE_NORMAL == type)) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATNORMAL)) ) - type = CHAT_TYPE_WHISPER; - else if ( (CHAT_TYPE_SHOUT == type) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATSHOUT)) ) - type = CHAT_TYPE_NORMAL; - else if ( (CHAT_TYPE_WHISPER == type) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATWHISPER)) ) - type = CHAT_TYPE_NORMAL; - - animate &= !gRlvHandler.hasBehaviour( (!RlvUtil::isEmote(utf8_text)) ? RLV_BHVR_REDIRCHAT : RLV_BHVR_REDIREMOTE ); - } - // [/RLVa:KB] - - // Don't animate for chats people can't hear (chat to scripts) - if (animate && (channel == 0)) - { - if (type == CHAT_TYPE_WHISPER) - { - LL_DEBUGS("FSFloaterNearbyChat") << "You whisper " << utf8_text << LL_ENDL; - gAgent.sendAnimationRequest(ANIM_AGENT_WHISPER, ANIM_REQUEST_START); - } - else if (type == CHAT_TYPE_NORMAL) - { - LL_DEBUGS("FSFloaterNearbyChat") << "You say " << utf8_text << LL_ENDL; - gAgent.sendAnimationRequest(ANIM_AGENT_TALK, ANIM_REQUEST_START); - } - else if (type == CHAT_TYPE_SHOUT) - { - LL_DEBUGS("FSFloaterNearbyChat") << "You shout " << utf8_text << LL_ENDL; - gAgent.sendAnimationRequest(ANIM_AGENT_SHOUT, ANIM_REQUEST_START); - } - else - { - LL_INFOS("FSFloaterNearbyChat") << "send_chat_from_viewer() - invalid volume" << LL_ENDL; - return; - } - } - else - { - if (type != CHAT_TYPE_START && type != CHAT_TYPE_STOP) - { - LL_DEBUGS("FSFloaterNearbyChat") << "Channel chat: " << utf8_text << LL_ENDL; - } - } - - send_chat_from_viewer(utf8_out_text, type, channel); + + FSNearbyChat::sendChatFromViewer(wtext, out_text, type, animate, channel); } // Exit "chat mode" and do the appropriate focus changes diff --git a/indra/newview/fsfloaternearbychat.h b/indra/newview/fsfloaternearbychat.h index bd4590ec43..61568670d0 100644 --- a/indra/newview/fsfloaternearbychat.h +++ b/indra/newview/fsfloaternearbychat.h @@ -71,11 +71,11 @@ public: static FSFloaterNearbyChat* findInstance(); static FSFloaterNearbyChat* getInstance(); - + void removeScreenChat(); - + static bool isChatMultiTab(); - + BOOL getVisible(); void onHistoryButtonClicked(); @@ -92,12 +92,9 @@ public: S32 getMessageArchiveLength() {return mMessageArchive.size();} virtual BOOL handleKeyHere( KEY key, MASK mask ); - + static void startChat(const char* line); static void stopChat(); - - static void sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate); - static void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate); void updateUnreadMessageNotification(S32 unread_messages, bool muted_history); void updateShowMutedChatHistory(const LLSD &data); @@ -108,6 +105,7 @@ protected: void onChatBoxFocusReceived(); void sendChat( EChatType type ); + void sendChatFromViewer(const std::string& utf8text, EChatType type, BOOL animate); void onChatBoxCommit(); void onChatTypeChanged(); diff --git a/indra/newview/fsnearbychathub.cpp b/indra/newview/fsnearbychathub.cpp index 52966e7b05..5cf3776050 100644 --- a/indra/newview/fsnearbychathub.cpp +++ b/indra/newview/fsnearbychathub.cpp @@ -247,6 +247,12 @@ void FSNearbyChat::sendChatFromViewer(const LLWString& wtext, EChatType type, BO { channel = (S32)(FSFloaterNearbyChat::getInstance()->getChild("ChatChannel")->get()); } + + sendChatFromViewer(wtext, out_text, type, animate, channel); +} + +void FSNearbyChat::sendChatFromViewer(const LLWString& wtext, const LLWString& out_text, EChatType type, BOOL animate, S32 channel) +{ std::string utf8_out_text = wstring_to_utf8str(out_text); std::string utf8_text = wstring_to_utf8str(wtext); diff --git a/indra/newview/fsnearbychathub.h b/indra/newview/fsnearbychathub.h index 9a55f2bccd..a371f03281 100644 --- a/indra/newview/fsnearbychathub.h +++ b/indra/newview/fsnearbychathub.h @@ -34,8 +34,6 @@ class FSNearbyChatControl; class LLUICtrl; -void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel); - class FSNearbyChat : public LLSingleton { friend class LLSingleton; @@ -62,6 +60,7 @@ public: static EChatType processChatTypeTriggers(EChatType type, std::string &str); void sendChatFromViewer(const std::string& utf8text, EChatType type, BOOL animate); void sendChatFromViewer(const LLWString& wtext, EChatType type, BOOL animate); + static void sendChatFromViewer(const LLWString& wtext, const LLWString& out_text, EChatType type, BOOL animate, S32 channel); void setFocusedInputEditor(FSNearbyChatControl* inputEditor, BOOL focus); From 513c927517d49efb91680747f7ab3764a4c6273b Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 12 Nov 2015 12:54:04 +0100 Subject: [PATCH 07/75] FIRE-4104: Main chat bar doesn't try to send on the channel selected in the nearby chat floater anymore --- indra/newview/fsfloaternearbychat.cpp | 9 ++++++- indra/newview/fsnearbychathub.cpp | 36 +++------------------------ indra/newview/fsnearbychathub.h | 2 +- 3 files changed, 13 insertions(+), 34 deletions(-) diff --git a/indra/newview/fsfloaternearbychat.cpp b/indra/newview/fsfloaternearbychat.cpp index 796200cefb..60ec4d52db 100644 --- a/indra/newview/fsfloaternearbychat.cpp +++ b/indra/newview/fsfloaternearbychat.cpp @@ -713,7 +713,14 @@ BOOL FSFloaterNearbyChat::handleKeyHere( KEY key, MASK mask ) void FSFloaterNearbyChat::onChatBoxKeystroke() { - FSNearbyChat::handleChatBarKeystroke(mInputEditor); + S32 channel = 0; + if (gSavedSettings.getBOOL("FSNearbyChatbar") && + gSavedSettings.getBOOL("FSShowChatChannel")) + { + channel = (S32)(FSFloaterNearbyChat::getInstance()->getChild("ChatChannel")->get()); + } + + FSNearbyChat::handleChatBarKeystroke(mInputEditor, channel); } // static diff --git a/indra/newview/fsnearbychathub.cpp b/indra/newview/fsnearbychathub.cpp index 5cf3776050..3c75f31ec6 100644 --- a/indra/newview/fsnearbychathub.cpp +++ b/indra/newview/fsnearbychathub.cpp @@ -239,15 +239,6 @@ void FSNearbyChat::sendChatFromViewer(const LLWString& wtext, EChatType type, BO S32 channel = 0; bool is_set = false; LLWString out_text = stripChannelNumber(wtext, &channel, &sLastSpecialChatChannel, &is_set); - // If "/" is not specified, see if a channel has been set in - // the spinner. - if (!is_set && - gSavedSettings.getBOOL("FSNearbyChatbar") && - gSavedSettings.getBOOL("FSShowChatChannel")) - { - channel = (S32)(FSFloaterNearbyChat::getInstance()->getChild("ChatChannel")->get()); - } - sendChatFromViewer(wtext, out_text, type, animate, channel); } @@ -443,14 +434,6 @@ void FSNearbyChat::sendChat(LLWString text, EChatType type) S32 channel = 0; bool is_set = false; stripChannelNumber(text, &channel, &sLastSpecialChatChannel, &is_set); - // If "/" is not specified, see if a channel has been set in - // the spinner. - if (!is_set && - gSavedSettings.getBOOL("FSNearbyChatbar") && - gSavedSettings.getBOOL("FSShowChatChannel")) - { - channel = (S32)(FSFloaterNearbyChat::getInstance()->getChild("ChatChannel")->get()); - } std::string utf8text = wstring_to_utf8str(text); // Try to trigger a gesture, if not chat to a script. @@ -606,7 +589,7 @@ bool matchChatTypeTrigger(const std::string& in_str, std::string* out_str) } //static -void FSNearbyChat::handleChatBarKeystroke(LLUICtrl* source) +void FSNearbyChat::handleChatBarKeystroke(LLUICtrl* source, S32 channel /* = 0 */) { LLChatEntry* chat_entry = dynamic_cast(source); LLLineEditor* line_editor = dynamic_cast(source); @@ -631,26 +614,15 @@ void FSNearbyChat::handleChatBarKeystroke(LLUICtrl* source) LLWStringUtil::trimHead(raw_text); S32 length = raw_text.length(); - S32 channel=0; - if (gSavedSettings.getBOOL("FSNearbyChatbar") && - gSavedSettings.getBOOL("FSShowChatChannel")) - { - // [FS communication UI] - //channel = (S32)(LLFloaterNearbyChat::getInstance()->getChild("ChatChannel")->get()); - channel = (S32)(FSFloaterNearbyChat::getInstance()->getChild("ChatChannel")->get()); - // [FS communication UI] - } - - // if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences - // [RLVa:KB] - Checked: 2010-03-26 (RLVa-1.2.0b) | Modified: RLVa-1.0.0d if (length > 0 && raw_text[0] != '/' && (raw_text[0] != ':' || !gSavedSettings.getBOOL("AllowMUpose")) && !gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT)) - // [/RLVa:KB] { // only start typing animation if we are chatting without / on channel 0 -Zi - if(channel==0) + if (channel == 0) + { gAgent.startTyping(); + } } else { diff --git a/indra/newview/fsnearbychathub.h b/indra/newview/fsnearbychathub.h index a371f03281..fc9ceafc6f 100644 --- a/indra/newview/fsnearbychathub.h +++ b/indra/newview/fsnearbychathub.h @@ -67,7 +67,7 @@ public: BOOL defaultChatBarIsIdle() const; BOOL defaultChatBarHasFocus() const; - static void handleChatBarKeystroke(LLUICtrl* source); + static void handleChatBarKeystroke(LLUICtrl* source, S32 channel = 0); FSNearbyChatControl* mFocusedInputEditor; }; From 3cb5b4994eef9964e6b0b25abb535cec973246c8 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 12 Nov 2015 13:06:20 +0100 Subject: [PATCH 08/75] Clean up FSNearbyChat --- indra/newview/fsnearbychathub.cpp | 355 +++++++++++++++--------------- 1 file changed, 179 insertions(+), 176 deletions(-) diff --git a/indra/newview/fsnearbychathub.cpp b/indra/newview/fsnearbychathub.cpp index 3c75f31ec6..c92a356b71 100644 --- a/indra/newview/fsnearbychathub.cpp +++ b/indra/newview/fsnearbychathub.cpp @@ -186,11 +186,10 @@ void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channe } } - if(next_split == 0) + if (next_split == 0) { next_split = split; - LL_WARNS("Splitting") << - "utf-8 couldn't be split correctly" << LL_ENDL; + LL_WARNS("Splitting") << "utf-8 couldn't be split correctly" << LL_ENDL; } } @@ -205,6 +204,29 @@ void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channe add(LLStatViewer::CHAT_COUNT, 1); } +bool matchChatTypeTrigger(const std::string& in_str, std::string* out_str) +{ + U32 in_len = in_str.length(); + S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers); + + for (S32 n = 0; n < cnt; n++) + { + if (in_len > sChatTypeTriggers[n].name.length()) + continue; + + std::string trigger_trunc = sChatTypeTriggers[n].name; + LLStringUtil::truncate(trigger_trunc, in_len); + + if (!LLStringUtil::compareInsensitive(in_str, trigger_trunc)) + { + *out_str = sChatTypeTriggers[n].name; + return true; + } + } + + return false; +} + ////////////////////////////////////////////////////////////////////////////// // FSNearbyChat @@ -223,9 +245,66 @@ FSNearbyChat::~FSNearbyChat() { } -void FSNearbyChat::onDefaultChatBarButtonClicked() +void FSNearbyChat::sendChat(LLWString text, EChatType type) { - showDefaultChatBar(gSavedSettings.getBOOL("MainChatbarVisible")); + LLWStringUtil::trim(text); + + if (!text.empty()) + { + if (type == CHAT_TYPE_OOC) + { + std::string tempText = wstring_to_utf8str( text ); + tempText = gSavedSettings.getString("FSOOCPrefix") + " " + tempText + " " + gSavedSettings.getString("FSOOCPostfix"); + text = utf8str_to_wstring(tempText); + } + + // Check if this is destined for another channel + S32 channel = 0; + bool is_set = false; + stripChannelNumber(text, &channel, &sLastSpecialChatChannel, &is_set); + + std::string utf8text = wstring_to_utf8str(text); + // Try to trigger a gesture, if not chat to a script. + std::string utf8_revised_text; + if (0 == channel) + { + // Convert OOC and MU* style poses + utf8text = applyAutoCloseOoc(utf8text); + utf8text = applyMuPose(utf8text); + + // discard returned "found" boolean + if(!LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text)) + { + utf8_revised_text = utf8text; + } + } + else + { + utf8_revised_text = utf8text; + } + + utf8_revised_text = utf8str_trim(utf8_revised_text); + + EChatType nType; + if (type == CHAT_TYPE_OOC) + { + nType = CHAT_TYPE_NORMAL; + } + else + { + nType = type; + } + + type = processChatTypeTriggers(nType, utf8_revised_text); + + if (!utf8_revised_text.empty() && cmd_line_chat(utf8_revised_text, type)) + { + // Chat with animation + sendChatFromViewer(utf8_revised_text, type, gSavedSettings.getBOOL("PlayChatAnim")); + } + } + + gAgent.stopTyping(); } void FSNearbyChat::sendChatFromViewer(const std::string& utf8text, EChatType type, BOOL animate) @@ -242,6 +321,101 @@ void FSNearbyChat::sendChatFromViewer(const LLWString& wtext, EChatType type, BO sendChatFromViewer(wtext, out_text, type, animate, channel); } +// all chat bars call this function and we keep the first or one that's seen as the default +void FSNearbyChat::registerChatBar(FSNearbyChatControl* chatBar) +{ + if (!mDefaultChatBar || chatBar->isDefault()) + { + mDefaultChatBar = chatBar; + } +} + +// unhide the default nearby chat bar on request (pressing Enter or a letter key) +void FSNearbyChat::showDefaultChatBar(BOOL visible, const char* text) const +{ + if (!mDefaultChatBar) + { + return; + } + + // change settings control to signal button state + gSavedSettings.setBOOL("MainChatbarVisible", visible); + + mDefaultChatBar->getParent()->setVisible(visible); + mDefaultChatBar->setVisible(visible); + mDefaultChatBar->setFocus(visible); + + // Fix for bad edge snapping + if (visible) + { + gFloaterView->setSnapOffsetChatBar(mDefaultChatBar->getRect().getHeight() + MAGIC_CHAT_BAR_PAD); + } + else + { + gFloaterView->setSnapOffsetChatBar(0); + } + + if (!text) + { + return; + } + + if (mDefaultChatBar->getText().empty()) + { + mDefaultChatBar->setText(LLStringExplicit(text)); + mDefaultChatBar->setCursorToEnd(); + } + // Fix for bad edge snapping +} + +// We want to know which nearby chat editor (if any) currently has focus +void FSNearbyChat::setFocusedInputEditor(FSNearbyChatControl* inputEditor, BOOL focus) +{ + if (focus) + { + mFocusedInputEditor = inputEditor; + } + else if (mFocusedInputEditor == inputEditor) + { + // only remove focus if the request came from the previously active input editor + // to avoid races + mFocusedInputEditor = NULL; + } +} + +// for the "arrow key moves avatar when chat is empty" hack in llviewerwindow.cpp +// and the hide chat bar feature in mouselook in llagent.cpp +BOOL FSNearbyChat::defaultChatBarIsIdle() const +{ + if (mFocusedInputEditor && mFocusedInputEditor->isDefault()) + { + return mFocusedInputEditor->getText().empty(); + } + + // if any other chat bar has focus, report "idle", because they're not the default + return TRUE; +} + +// for the "arrow key moves avatar when chat is empty" hack in llviewerwindow.cpp +BOOL FSNearbyChat::defaultChatBarHasFocus() const +{ + if (mFocusedInputEditor && mFocusedInputEditor->isDefault()) + { + return TRUE; + } + + return FALSE; +} + +void FSNearbyChat::onDefaultChatBarButtonClicked() +{ + showDefaultChatBar(gSavedSettings.getBOOL("MainChatbarVisible")); +} + + +////////////////////////////////////////////////////////////////////////////// +// General chat handling methods + void FSNearbyChat::sendChatFromViewer(const LLWString& wtext, const LLWString& out_text, EChatType type, BOOL animate, S32 channel) { std::string utf8_out_text = wstring_to_utf8str(out_text); @@ -417,177 +591,6 @@ LLWString FSNearbyChat::stripChannelNumber(const LLWString &mesg, S32* channel, } } -void FSNearbyChat::sendChat(LLWString text, EChatType type) -{ - LLWStringUtil::trim(text); - - if (!text.empty()) - { - if (type == CHAT_TYPE_OOC) - { - std::string tempText = wstring_to_utf8str( text ); - tempText = gSavedSettings.getString("FSOOCPrefix") + " " + tempText + " " + gSavedSettings.getString("FSOOCPostfix"); - text = utf8str_to_wstring(tempText); - } - - // Check if this is destined for another channel - S32 channel = 0; - bool is_set = false; - stripChannelNumber(text, &channel, &sLastSpecialChatChannel, &is_set); - - std::string utf8text = wstring_to_utf8str(text); - // Try to trigger a gesture, if not chat to a script. - std::string utf8_revised_text; - if (0 == channel) - { - // Convert OOC and MU* style poses - utf8text = applyAutoCloseOoc(utf8text); - utf8text = applyMuPose(utf8text); - - // discard returned "found" boolean - if(!LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text)) - { - utf8_revised_text = utf8text; - } - } - else - { - utf8_revised_text = utf8text; - } - - utf8_revised_text = utf8str_trim(utf8_revised_text); - - EChatType nType; - if (type == CHAT_TYPE_OOC) - { - nType = CHAT_TYPE_NORMAL; - } - else - { - nType = type; - } - - type = processChatTypeTriggers(nType, utf8_revised_text); - - if (!utf8_revised_text.empty() && cmd_line_chat(utf8_revised_text, type)) - { - // Chat with animation - sendChatFromViewer(utf8_revised_text, type, gSavedSettings.getBOOL("PlayChatAnim")); - } - } - - gAgent.stopTyping(); -} - -// all chat bars call this function and we keep the first or one that's seen as the default -void FSNearbyChat::registerChatBar(FSNearbyChatControl* chatBar) -{ - if (!mDefaultChatBar || chatBar->isDefault()) - { - mDefaultChatBar = chatBar; - } -} - -// unhide the default nearby chat bar on request (pressing Enter or a letter key) -void FSNearbyChat::showDefaultChatBar(BOOL visible, const char* text) const -{ - if (!mDefaultChatBar) - { - return; - } - - // change settings control to signal button state - gSavedSettings.setBOOL("MainChatbarVisible", visible); - - mDefaultChatBar->getParent()->setVisible(visible); - mDefaultChatBar->setVisible(visible); - mDefaultChatBar->setFocus(visible); - - // Fix for bad edge snapping - if (visible) - { - gFloaterView->setSnapOffsetChatBar(mDefaultChatBar->getRect().getHeight() + MAGIC_CHAT_BAR_PAD); - } - else - { - gFloaterView->setSnapOffsetChatBar(0); - } - - if (!text) - { - return; - } - - if (mDefaultChatBar->getText().empty()) - { - mDefaultChatBar->setText(LLStringExplicit(text)); - mDefaultChatBar->setCursorToEnd(); - } - // Fix for bad edge snapping -} - -// We want to know which nearby chat editor (if any) currently has focus -void FSNearbyChat::setFocusedInputEditor(FSNearbyChatControl* inputEditor, BOOL focus) -{ - if (focus) - { - mFocusedInputEditor = inputEditor; - } - else if (mFocusedInputEditor == inputEditor) - { - // only remove focus if the request came from the previously active input editor - // to avoid races - mFocusedInputEditor = NULL; - } -} - -// for the "arrow key moves avatar when chat is empty" hack in llviewerwindow.cpp -// and the hide chat bar feature in mouselook in llagent.cpp -BOOL FSNearbyChat::defaultChatBarIsIdle() const -{ - if (mFocusedInputEditor && mFocusedInputEditor->isDefault()) - { - return mFocusedInputEditor->getText().empty(); - } - - // if any other chat bar has focus, report "idle", because they're not the default - return TRUE; -} - -// for the "arrow key moves avatar when chat is empty" hack in llviewerwindow.cpp -BOOL FSNearbyChat::defaultChatBarHasFocus() const -{ - if (mFocusedInputEditor && mFocusedInputEditor->isDefault()) - { - return TRUE; - } - - return FALSE; -} - -bool matchChatTypeTrigger(const std::string& in_str, std::string* out_str) -{ - U32 in_len = in_str.length(); - S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers); - - for (S32 n = 0; n < cnt; n++) - { - if (in_len > sChatTypeTriggers[n].name.length()) - continue; - - std::string trigger_trunc = sChatTypeTriggers[n].name; - LLStringUtil::truncate(trigger_trunc, in_len); - - if (!LLStringUtil::compareInsensitive(in_str, trigger_trunc)) - { - *out_str = sChatTypeTriggers[n].name; - return true; - } - } - - return false; -} - //static void FSNearbyChat::handleChatBarKeystroke(LLUICtrl* source, S32 channel /* = 0 */) { From 4bc01a9965b65a57a26cab055178b208b7cbd337 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 12 Nov 2015 15:48:24 +0100 Subject: [PATCH 09/75] Remove old junk from FSFloaterNearbyChat and replace it with a nice options menu with more or less useful options to start with --- indra/newview/fsfloaternearbychat.cpp | 66 +++++++++++-------- indra/newview/fsfloaternearbychat.h | 16 ++--- indra/newview/llfloaterpreference.cpp | 2 - indra/newview/llviewercontrol.cpp | 6 ++ .../default/xui/de/floater_fs_nearby_chat.xml | 3 + .../default/xui/de/menu_fs_nearby_chat.xml | 7 ++ .../default/xui/en/floater_fs_nearby_chat.xml | 23 +++++++ .../default/xui/en/menu_fs_nearby_chat.xml | 44 +++++++++++++ .../vintage/xui/en/floater_fs_nearby_chat.xml | 25 ++++++- 9 files changed, 151 insertions(+), 41 deletions(-) create mode 100644 indra/newview/skins/default/xui/de/menu_fs_nearby_chat.xml create mode 100644 indra/newview/skins/default/xui/en/menu_fs_nearby_chat.xml diff --git a/indra/newview/fsfloaternearbychat.cpp b/indra/newview/fsfloaternearbychat.cpp index 60ec4d52db..6ce3eba1bf 100644 --- a/indra/newview/fsfloaternearbychat.cpp +++ b/indra/newview/fsfloaternearbychat.cpp @@ -90,6 +90,9 @@ FSFloaterNearbyChat::FSFloaterNearbyChat(const LLSD& key) ,mUnreadMessages(0) ,mUnreadMessagesMuted(0) { + //menu + mEnableCallbackRegistrar.add("ChatOptions.Check", boost::bind(&FSFloaterNearbyChat::onChatOptionsCheckContextMenuItem, this, _2)); + mCommitCallbackRegistrar.add("ChatOptions.Action", boost::bind(&FSFloaterNearbyChat::onChatOptionsContextMenuItemClicked, this, _2)); } FSFloaterNearbyChat::~FSFloaterNearbyChat() @@ -115,21 +118,6 @@ void FSFloaterNearbyChat::updateFSUseNearbyChatConsole(const LLSD &data) BOOL FSFloaterNearbyChat::postBuild() { setIsSingleInstance(TRUE); - - //menu - LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; - LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar; - - enable_registrar.add("NearbyChat.Check", boost::bind(&FSFloaterNearbyChat::onNearbyChatCheckContextMenuItem, this, _2)); - registrar.add("NearbyChat.Action", boost::bind(&FSFloaterNearbyChat::onNearbyChatContextMenuItemClicked, this, _2)); - - LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile("menu_nearby_chat.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - if (menu) - { - mPopupMenuHandle = menu->getHandle(); - } - - gSavedSettings.declareS32("nearbychat_showicons_and_names", 2, "NearByChat header settings"); mInputEditor = getChild("chat_box"); mInputEditor->setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2, _3, _4, _5)); @@ -302,13 +290,6 @@ BOOL FSFloaterNearbyChat::focusFirstItem(BOOL prefer_text_fields, BOOL focus_fla return TRUE; } -void FSFloaterNearbyChat::onNearbySpeakers() -{ - LLSD param; - param["people_panel_tab_name"] = "nearby_panel"; - LLFloaterSidePanelContainer::showPanel("people", "panel_people", param); -} - void FSFloaterNearbyChat::onHistoryButtonClicked() { if (gSavedSettings.getBOOL("FSUseBuiltInHistory")) @@ -321,17 +302,48 @@ void FSFloaterNearbyChat::onHistoryButtonClicked() } } -void FSFloaterNearbyChat::onNearbyChatContextMenuItemClicked(const LLSD& userdata) +void FSFloaterNearbyChat::onChatOptionsContextMenuItemClicked(const LLSD& userdata) { + std::string option = userdata.asString(); + + if (option == "blocklist") + { + if (gSavedSettings.getBOOL("FSUseStandaloneBlocklistFloater")) + { + LLFloaterReg::toggleInstance("fs_blocklist"); + } + else + { + LLPanel* panel = LLFloaterSidePanelContainer::getPanel("people", "panel_people"); + if (!panel) + { + return; + } + + if (panel->isInVisibleChain()) + { + LLFloaterReg::hideInstance("people"); + } + else + { + LLFloaterSidePanelContainer::showPanel("people", "panel_people", LLSD().with("people_panel_tab_name", "blocked_panel")); + } + } + } } -bool FSFloaterNearbyChat::onNearbyChatCheckContextMenuItem(const LLSD& userdata) +bool FSFloaterNearbyChat::onChatOptionsCheckContextMenuItem(const LLSD& userdata) { - std::string str = userdata.asString(); - if (str == "nearby_people") + std::string option = userdata.asString(); + + if (option == "blocklist") { - onNearbySpeakers(); + if (gSavedSettings.getBOOL("FSUseStandaloneBlocklistFloater")) + { + return LLFloaterReg::instanceVisible("fs_blocklist"); + } } + return false; } diff --git a/indra/newview/fsfloaternearbychat.h b/indra/newview/fsfloaternearbychat.h index 61568670d0..5fb876b712 100644 --- a/indra/newview/fsfloaternearbychat.h +++ b/indra/newview/fsfloaternearbychat.h @@ -49,16 +49,16 @@ public: FSFloaterNearbyChat(const LLSD& key); ~FSFloaterNearbyChat(); - BOOL postBuild (); + BOOL postBuild(); /** @param archive true - to save a message to the chat history log */ - void addMessage (const LLChat& message,bool archive = true, const LLSD &args = LLSD()); - void onNearbyChatContextMenuItemClicked(const LLSD& userdata); - bool onNearbyChatCheckContextMenuItem(const LLSD& userdata); + void addMessage(const LLChat& message,bool archive = true, const LLSD &args = LLSD()); + void onChatOptionsContextMenuItemClicked(const LLSD& userdata); + bool onChatOptionsCheckContextMenuItem(const LLSD& userdata); - /*virtual*/ void onOpen (const LLSD& key); + /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ void setVisible(BOOL visible); - /*virtual*/ void setVisible(BOOL visible); void openFloater(const LLSD& key); void clearChatHistory(); @@ -115,10 +115,6 @@ protected: static S32 sLastSpecialChatChannel; private: - void onNearbySpeakers(); - -private: - LLHandle mPopupMenuHandle; FSChatHistory* mChatHistory; FSChatHistory* mChatHistoryMuted; LLChatEntry* mInputEditor; diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index dc3cdc47a8..49ec5ae97c 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -613,8 +613,6 @@ BOOL LLFloaterPreference::postBuild() { // [FS communication UI] //gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLFloaterIMSessionTab::processChatHistoryStyleUpdate, false)); - gSavedSettings.getControl("PlainTextChatHistory")->getSignal()->connect(boost::bind(&FSFloaterIM::processChatHistoryStyleUpdate, _2)); - gSavedSettings.getControl("PlainTextChatHistory")->getSignal()->connect(boost::bind(&FSFloaterNearbyChat::processChatHistoryStyleUpdate, _2)); gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&FSFloaterIM::processChatHistoryStyleUpdate, _2)); gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&FSFloaterNearbyChat::processChatHistoryStyleUpdate, _2)); // [FS communication UI] diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index ebbb1fb9c0..7b6b414531 100755 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -81,6 +81,8 @@ // Firestorm inclues #include "fsfloatercontacts.h" +#include "fsfloaterim.h" +#include "fsfloaternearbychat.h" #include "fsfloaterposestand.h" #include "fsfloaterteleporthistory.h" #include "fslslbridge.h" @@ -1024,6 +1026,10 @@ void settings_setup_listeners() gSavedSettings.getControl("FSUseAzertyKeyboardLayout")->getCommitSignal()->connect(boost::bind(&handleKeyboardLayoutChanged, _2)); + // [FS communication UI] + gSavedSettings.getControl("PlainTextChatHistory")->getSignal()->connect(boost::bind(&FSFloaterIM::processChatHistoryStyleUpdate, _2)); + gSavedSettings.getControl("PlainTextChatHistory")->getSignal()->connect(boost::bind(&FSFloaterNearbyChat::processChatHistoryStyleUpdate, _2)); + gSavedSettings.getControl(RLV_SETTING_MAIN)->getSignal()->connect(boost::bind(&RlvSettings::onChangedSettingMain, _2)); } diff --git a/indra/newview/skins/default/xui/de/floater_fs_nearby_chat.xml b/indra/newview/skins/default/xui/de/floater_fs_nearby_chat.xml index aedb27644f..b54f62cc25 100644 --- a/indra/newview/skins/default/xui/de/floater_fs_nearby_chat.xml +++ b/indra/newview/skins/default/xui/de/floater_fs_nearby_chat.xml @@ -13,6 +13,9 @@ - + + + + From eb9f0c0d4366adad75069794953007f6956aa4ed Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 12 Nov 2015 21:19:53 +0100 Subject: [PATCH 10/75] FIRE-17262: Wrong local teleports on a large opensim region (apparently need to divide by grid unit size) --- indra/newview/llagent.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 5615f128e3..dae10b79f6 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4783,7 +4783,8 @@ void LLAgent::doTeleportViaLocation(const LLVector3d& pos_global) msg->addUUIDFast(_PREHASH_SessionID, getSessionID()); msg->nextBlockFast(_PREHASH_Info); - F32 width = regionp->getWidth(); + // FIRE-17262: Wrong local teleports on a large opensim region (apparently need to divide by grid unit size) + F32 width = REGION_WIDTH_METERS;// regionp->getWidth(); LLVector3 pos(fmod((F32)pos_global.mdV[VX], width), fmod((F32)pos_global.mdV[VY], width), (F32)pos_global.mdV[VZ]); From e578752222fe22eae5b97b3382c44635bae1876b Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 12 Nov 2015 21:28:33 +0100 Subject: [PATCH 11/75] Add missing setting ForceInitialCOFDelay --- indra/newview/app_settings/settings.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 6597c4af30..9a1de908f7 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -23715,6 +23715,17 @@ Change of this parameter will affect the layout of buttons in notification toast Value 1 + ForceInitialCOFDelay + + Comment + Number of seconds to delay initial processing of COF contents + Persist + 1 + Type + F32 + Value + 0.0 + From 1dd7b5b31e0540640e606a059400441907c1bb7f Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 12 Nov 2015 21:38:24 +0100 Subject: [PATCH 12/75] Another lesson in "How to XUI without generating invalid parameter parser errors" --- .../default/xui/en/widgets/notification_list_view.xml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/indra/newview/skins/default/xui/en/widgets/notification_list_view.xml b/indra/newview/skins/default/xui/en/widgets/notification_list_view.xml index 150225af27..abc9ae1306 100644 --- a/indra/newview/skins/default/xui/en/widgets/notification_list_view.xml +++ b/indra/newview/skins/default/xui/en/widgets/notification_list_view.xml @@ -6,13 +6,4 @@ keep_one_selected="false" multi_select="false" opaque="true"> - \ No newline at end of file From ecf17e7621815fe94530b4d50ec8ded9c8ef61ff Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 12 Nov 2015 21:53:39 +0100 Subject: [PATCH 13/75] Fix warnings "LLView::getChild: Making dummy class LLPanel named "attachment_container" in panel_group_notify" and "LLView::getChild: Making dummy class LLTextBox named "attachment_label" in panel_group_notify" --- indra/newview/lltoastgroupnotifypanel.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/indra/newview/lltoastgroupnotifypanel.cpp b/indra/newview/lltoastgroupnotifypanel.cpp index caf46340ae..c2cf9cd506 100755 --- a/indra/newview/lltoastgroupnotifypanel.cpp +++ b/indra/newview/lltoastgroupnotifypanel.cpp @@ -131,17 +131,23 @@ LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(const LLNotificationPtr& notifi BOOL hasInventory = payload["inventory_offer"].isDefined(); // attachment container (if any) - LLPanel* pAttachContainer = getChild("attachment_container"); + LLPanel* pAttachContainer = findChild("attachment_container"); // attachment container label (if any) - LLTextBox* pAttachContainerLabel = getChild("attachment_label"); + LLTextBox* pAttachContainerLabel = findChild("attachment_label"); //attachment text LLTextBox * pAttachLink = getChild("attachment"); //attachment icon LLIconCtrl* pAttachIcon = getChild("attachment_icon", TRUE); //If attachment is empty let it be invisible and not take place at the panel - pAttachContainer->setVisible(hasInventory); - pAttachContainerLabel->setVisible(hasInventory); + if (pAttachContainer) + { + pAttachContainer->setVisible(hasInventory); + } + if (pAttachContainerLabel) + { + pAttachContainerLabel->setVisible(hasInventory); + } pAttachLink->setVisible(hasInventory); pAttachIcon->setVisible(hasInventory); if (hasInventory) { From bf669a1a714f425479206621e7085b25da54c0dd Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 12 Nov 2015 21:53:58 +0100 Subject: [PATCH 14/75] Fix some unnecessary type casts --- indra/newview/llscriptfloater.cpp | 2 +- indra/newview/lltoastgroupnotifypanel.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp index 58bc37e26a..80bb8be01f 100755 --- a/indra/newview/llscriptfloater.cpp +++ b/indra/newview/llscriptfloater.cpp @@ -368,7 +368,7 @@ F32 LLScriptFloater::getCurrentTransparency() { if (mNoTransparency) { - return 1.0; + return 1.0f; } else { diff --git a/indra/newview/lltoastgroupnotifypanel.cpp b/indra/newview/lltoastgroupnotifypanel.cpp index c2cf9cd506..637c07b973 100755 --- a/indra/newview/lltoastgroupnotifypanel.cpp +++ b/indra/newview/lltoastgroupnotifypanel.cpp @@ -266,7 +266,7 @@ F32 LLToastGroupNotifyPanel::getCurrentTransparency() { if (gSavedSettings.getBOOL("FSGroupNotifyNoTransparency")) { - return 1.0; + return 1.0f; } else { From c2b51036a6cf8ceb48c660d7e5e5e9df26e6f665 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Fri, 13 Nov 2015 08:59:27 +0100 Subject: [PATCH 15/75] FIRE-17277: Allow entering animation loop parameters as frames rather than percent; patch by Sei Lisa --- indra/llcharacter/llbvhloader.h | 4 + indra/newview/llfloaterbvhpreview.cpp | 142 +++++++++++++++++- indra/newview/llfloaterbvhpreview.h | 9 ++ .../xui/en/floater_animation_bvh_preview.xml | 48 +++++- 4 files changed, 199 insertions(+), 4 deletions(-) diff --git a/indra/llcharacter/llbvhloader.h b/indra/llcharacter/llbvhloader.h index de16d86ff4..c2c755664e 100755 --- a/indra/llcharacter/llbvhloader.h +++ b/indra/llcharacter/llbvhloader.h @@ -296,6 +296,10 @@ public: ELoadStatus getStatus() { return mStatus; } + // FIRE-17277: Allow entering Loop In/Loop Out as frames + S32 getNumFrames() { return mNumFrames; } + // + protected: // Consumes one line of input from file. diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index 3b1aee77d1..4ad9774397 100755 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -176,6 +176,12 @@ void LLFloaterBvhPreview::setAnimCallbacks() getChild("loop_in_point")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateLoopIn, this, _1)); getChild("loop_out_point")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitLoopOut, this)); getChild("loop_out_point")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateLoopOut, this, _1)); + // FIRE-17277: Allow entering Loop In/Loop Out as frames + getChild("loop_in_frames")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitLoopInFrames, this)); + getChild("loop_in_frames")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateLoopInFrames, this, _1)); + getChild("loop_out_frames")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitLoopOutFrames, this)); + getChild("loop_out_frames")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateLoopOutFrames, this, _1)); + // getChild("hand_pose_combo")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitHandPose, this)); @@ -329,6 +335,20 @@ BOOL LLFloaterBvhPreview::loadBVH() // motion will be returned, but it will be in a load-pending state, as this is a new motion // this motion will not request an asset transfer until next update, so we have a chance to // load the keyframe data locally + // FIRE-17277: Allow entering Loop In/Loop Out as frames + mNumFrames = loaderp->getNumFrames(); + getChild("loop_in_frames")->setMaxValue(LLSD((F32)mNumFrames)); + getChild("loop_out_frames")->setMaxValue(LLSD((F32)mNumFrames)); + // (Re)assign loop frames spinners from loop percentages. + getChild("loop_in_frames")->setValue(LLSD((F32)getChild("loop_in_point")->getValue().asReal() / 100.f * (F32)mNumFrames)); + getChild("loop_out_frames")->setValue(LLSD((F32)getChild("loop_out_point")->getValue().asReal() / 100.f * (F32)mNumFrames)); + + LLUIString out_str = getString("FS_report_frames"); + out_str.setArg("[F]", llformat("%d", mNumFrames)); + out_str.setArg("[S]", llformat("%.1f", loaderp->getDuration())); + out_str.setArg("[FPS]", llformat("%.1f", (F32)mNumFrames / loaderp->getDuration())); + getChild("frames_label")->setValue(LLSD(out_str)); + // // Preview on own avatar //motionp = (LLKeyframeMotion*)mAnimPreview->getDummyAvatar()->createMotion(mMotionID); motionp = dynamic_cast(mAnimPreview->getPreviewAvatar(this)->createMotion(mMotionID)); @@ -869,7 +889,10 @@ void LLFloaterBvhPreview::onCommitLoopIn() if (motionp) { - motionp->setLoopIn((F32)getChild("loop_in_point")->getValue().asReal() / 100.f); + // FIRE-17277: Allow entering Loop In/Loop Out as frames + //motionp->setLoopIn((F32)getChild("loop_in_point")->getValue().asReal() / 100.f); + getChild("loop_in_frames")->setValue(LLSD((F32)getChild("loop_in_point")->getValue().asReal() / 100.f * (F32)mNumFrames)); + // resetMotion(); getChild("loop_check")->setValue(LLSD(TRUE)); onCommitLoop(); @@ -893,13 +916,61 @@ void LLFloaterBvhPreview::onCommitLoopOut() if (motionp) { - motionp->setLoopOut((F32)getChild("loop_out_point")->getValue().asReal() * 0.01f * motionp->getDuration()); + // FIRE-17277: Allow entering Loop In/Loop Out as frames + //motionp->setLoopOut((F32)getChild("loop_out_point")->getValue().asReal() * 0.01f * motionp->getDuration()); + getChild("loop_out_frames")->setValue(LLSD((F32)getChild("loop_out_point")->getValue().asReal() / 100.f * (F32)mNumFrames)); + // resetMotion(); getChild("loop_check")->setValue(LLSD(TRUE)); onCommitLoop(); } } +// FIRE-17277: Allow entering Loop In/Loop Out as frames +//----------------------------------------------------------------------------- +// onCommitLoopInFrames() +//----------------------------------------------------------------------------- +void LLFloaterBvhPreview::onCommitLoopInFrames() +{ + if (!getEnabled() || !mAnimPreview) + return; + + // Preview on own avatar + LLVOAvatar* avatarp = mAnimPreview->getPreviewAvatar(this); + LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); + + if (motionp) + { + getChild("loop_in_point")->setValue(LLSD(mNumFrames == 0 ? 0.f : 100.f * (F32)getChild("loop_in_frames")->getValue().asReal() / (F32)mNumFrames)); + resetMotion(); + getChild("loop_check")->setValue(LLSD(TRUE)); + // The values are actually set here: + onCommitLoop(); + } +} + +//----------------------------------------------------------------------------- +// onCommitLoopOutFrames() +//----------------------------------------------------------------------------- +void LLFloaterBvhPreview::onCommitLoopOutFrames() +{ + if (!getEnabled() || !mAnimPreview) + return; + + // Preview on own avatar + LLVOAvatar* avatarp = mAnimPreview->getPreviewAvatar(this); + LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); + + if (motionp) + { + getChild("loop_out_point")->setValue(LLSD(mNumFrames == 0 ? 100.f : 100.f * (F32)getChild("loop_out_frames")->getValue().asReal() / (F32)mNumFrames)); + resetMotion(); + getChild("loop_check")->setValue(LLSD(TRUE)); + onCommitLoop(); + } +} +// + //----------------------------------------------------------------------------- // onCommitName() //----------------------------------------------------------------------------- @@ -1083,6 +1154,9 @@ bool LLFloaterBvhPreview::validateLoopIn(const LLSD& data) } getChild("loop_in_point")->setValue(LLSD(loop_in_value)); + // FIRE-17277: Allow entering Loop In/Loop Out as frames + getChild("loop_in_frames")->setValue(LLSD(loop_in_value / 100.f * (F32)mNumFrames)); + // return true; } @@ -1111,10 +1185,74 @@ bool LLFloaterBvhPreview::validateLoopOut(const LLSD& data) } getChild("loop_out_point")->setValue(LLSD(loop_out_value)); + // FIRE-17277: Allow entering Loop In/Loop Out as frames + getChild("loop_out_frames")->setValue(LLSD(loop_out_value / 100.f * (F32)mNumFrames)); + // return true; } +// FIRE-17277: Allow entering Loop In/Loop Out as frames +//----------------------------------------------------------------------------- +// validateLoopInFrames() +//----------------------------------------------------------------------------- +bool LLFloaterBvhPreview::validateLoopInFrames(const LLSD& data) +{ + if (!getEnabled()) + return false; + + F32 loop_in_value = (F32)getChild("loop_in_frames")->getValue().asReal(); + F32 loop_out_value = (F32)getChild("loop_out_frames")->getValue().asReal(); + + if (loop_in_value < 0.f) + { + loop_in_value = 0.f; + } + else if (loop_in_value > 100.f) + { + loop_in_value = 100.f; + } + else if (loop_in_value > loop_out_value) + { + loop_in_value = loop_out_value; + } + + getChild("loop_in_frames")->setValue(LLSD(loop_in_value)); + getChild("loop_in_point")->setValue(LLSD(mNumFrames == 0 ? 0.f : 100.f * loop_in_value / (F32)mNumFrames)); + return true; +} + +//----------------------------------------------------------------------------- +// validateLoopOutFrames() +//----------------------------------------------------------------------------- +bool LLFloaterBvhPreview::validateLoopOutFrames(const LLSD& data) +{ + if (!getEnabled()) + return false; + + F32 loop_out_value = (F32)getChild("loop_out_frames")->getValue().asReal(); + F32 loop_in_value = (F32)getChild("loop_in_frames")->getValue().asReal(); + + if (loop_out_value < 0.f) + { + loop_out_value = 0.f; + } + else if (loop_out_value > 100.f) + { + loop_out_value = 100.f; + } + else if (loop_out_value < loop_in_value) + { + loop_out_value = loop_in_value; + } + + getChild("loop_out_frames")->setValue(LLSD(loop_out_value)); + getChild("loop_out_point")->setValue(LLSD(mNumFrames == 0 ? 100.f : 100.f * loop_out_value / (F32)mNumFrames)); + return true; +} +// + + //----------------------------------------------------------------------------- // refresh() //----------------------------------------------------------------------------- diff --git a/indra/newview/llfloaterbvhpreview.h b/indra/newview/llfloaterbvhpreview.h index 6b7e6c3c5d..a803c411ba 100755 --- a/indra/newview/llfloaterbvhpreview.h +++ b/indra/newview/llfloaterbvhpreview.h @@ -116,6 +116,12 @@ public: LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status); + // FIRE-17277: Allow entering Loop In/Loop Out as frames + void onCommitLoopInFrames(); + void onCommitLoopOutFrames(); + bool validateLoopInFrames(const LLSD& data); + bool validateLoopOutFrames(const LLSD& data); + // private: void setAnimCallbacks() ; // Reload animation from disk @@ -146,6 +152,9 @@ protected: // FIRE-2083: Slider in upload animation floater doesn't work LLFrameTimer mTimer; + + // FIRE-17277: Allow entering Loop In/Loop Out as frames + S32 mNumFrames; }; #endif // LL_LLFLOATERBVHPREVIEW_H diff --git a/indra/newview/skins/default/xui/en/floater_animation_bvh_preview.xml b/indra/newview/skins/default/xui/en/floater_animation_bvh_preview.xml index 453a92c5e5..ef02e1e690 100755 --- a/indra/newview/skins/default/xui/en/floater_animation_bvh_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_animation_bvh_preview.xml @@ -2,7 +2,7 @@ Incorrect root joint name, use "hip". + + [F] frm. [S] s. [FPS] fps + + + 300 frm. 30 s. 10 fps + + + Unable to read animation file. We recommend BVH files exported from Poser 4. From 10b12caa9d6b986c21f616f5b5e29dfdb0daa5ae Mon Sep 17 00:00:00 2001 From: Ansariel Date: Fri, 13 Nov 2015 09:00:31 +0100 Subject: [PATCH 16/75] Some tweaks for previous commit --- indra/llcharacter/llbvhloader.h | 2 +- indra/newview/llfloaterbvhpreview.cpp | 4 ++-- .../xui/en/floater_animation_bvh_preview.xml | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/indra/llcharacter/llbvhloader.h b/indra/llcharacter/llbvhloader.h index c2c755664e..cfa7f6ec5b 100755 --- a/indra/llcharacter/llbvhloader.h +++ b/indra/llcharacter/llbvhloader.h @@ -297,7 +297,7 @@ public: ELoadStatus getStatus() { return mStatus; } // FIRE-17277: Allow entering Loop In/Loop Out as frames - S32 getNumFrames() { return mNumFrames; } + S32 getNumFrames() const { return mNumFrames; } // protected: diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index 4ad9774397..beb5a1685a 100755 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -937,7 +937,7 @@ void LLFloaterBvhPreview::onCommitLoopInFrames() // Preview on own avatar LLVOAvatar* avatarp = mAnimPreview->getPreviewAvatar(this); - LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); + LLKeyframeMotion* motionp = dynamic_cast(avatarp->findMotion(mMotionID)); if (motionp) { @@ -959,7 +959,7 @@ void LLFloaterBvhPreview::onCommitLoopOutFrames() // Preview on own avatar LLVOAvatar* avatarp = mAnimPreview->getPreviewAvatar(this); - LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); + LLKeyframeMotion* motionp = dynamic_cast(avatarp->findMotion(mMotionID)); if (motionp) { diff --git a/indra/newview/skins/default/xui/en/floater_animation_bvh_preview.xml b/indra/newview/skins/default/xui/en/floater_animation_bvh_preview.xml index ef02e1e690..7e59fed2c4 100755 --- a/indra/newview/skins/default/xui/en/floater_animation_bvh_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_animation_bvh_preview.xml @@ -2,7 +2,7 @@ - [F] frm. [S] s. [FPS] fps + [F] frm. [S] s. [FPS] FPS - 300 frm. 30 s. 10 fps + 300 frm. 30 s. 10 FPS Date: Fri, 13 Nov 2015 09:00:42 +0100 Subject: [PATCH 17/75] Update German translation --- .../default/xui/de/floater_animation_bvh_preview.xml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/indra/newview/skins/default/xui/de/floater_animation_bvh_preview.xml b/indra/newview/skins/default/xui/de/floater_animation_bvh_preview.xml index 42a8edd94b..4302c61a9f 100755 --- a/indra/newview/skins/default/xui/de/floater_animation_bvh_preview.xml +++ b/indra/newview/skins/default/xui/de/floater_animation_bvh_preview.xml @@ -109,6 +109,9 @@ Maximal erlaubt sind [MAX_LENGTH] Sekunden. Falscher Root-Joint-Name, "hip" verwenden. + + [F] frm. [S] s. [FPS] FPS + Name: @@ -117,8 +120,13 @@ Maximal erlaubt sind [MAX_LENGTH] Sekunden. + + 300 frm. 30 s. 10 FPS + + + Handhaltung @@ -177,9 +185,7 @@ Maximal erlaubt sind [MAX_LENGTH] Sekunden. +