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 @@