From ed873621bbc8dacf97f22998045dba383dced482 Mon Sep 17 00:00:00 2001 From: Cinder <cinder@sdf.org> Date: Thu, 28 Jan 2016 09:11:45 -0700 Subject: [PATCH] Add whisper to chatbar, add whisper/shout to combo menu, fix focus --- indra/newview/llchatbar.cpp | 26 ++++++++++++++----- indra/newview/llchatbar.h | 1 + .../skins/default/xui/en/floater_chatbar.xml | 7 ++--- .../default/xui/en/menu_chatbar_gear.xml | 19 ++++++++++++-- 4 files changed, 41 insertions(+), 12 deletions(-) diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index 2fb95c298f..3ea6fbeeef 100755 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -32,7 +32,6 @@ #include "llfocusmgr.h" #include "llfloaterreg.h" #include "lllineeditor.h" -#include "llmenubutton.h" #include "alchatcommand.h" #include "llagent.h" @@ -60,12 +59,14 @@ private: LLChatBar::LLChatBar(const LLSD& key) : LLFloater(key), - mInputEditor(NULL), + mInputEditor(nullptr), mGestureLabelTimer(), mIsBuilt(FALSE), - mGestureCombo(NULL), + mGestureCombo(nullptr), mObserver(NULL) { + mCommitCallbackRegistrar.add("Chatbar.Shout", boost::bind(&LLChatBar::sendChat, this, CHAT_TYPE_SHOUT)); + mCommitCallbackRegistrar.add("Chatbar.Whisper", boost::bind(&LLChatBar::sendChat, this, CHAT_TYPE_WHISPER)); //setIsChrome(TRUE); } @@ -78,6 +79,10 @@ LLChatBar::~LLChatBar() // LLView destructor cleans up children } +//----------------------------------------------------------------------- +// Overrides +//----------------------------------------------------------------------- + BOOL LLChatBar::postBuild() { // * NOTE: mantipov: getChild with default parameters returns dummy widget. @@ -104,9 +109,10 @@ BOOL LLChatBar::postBuild() return TRUE; } -//----------------------------------------------------------------------- -// Overrides -//----------------------------------------------------------------------- +void LLChatBar::onOpen(const LLSD& key) +{ + mInputEditor->setFocus(TRUE); +} // virtual BOOL LLChatBar::handleKeyHere( KEY key, MASK mask ) @@ -115,12 +121,17 @@ BOOL LLChatBar::handleKeyHere( KEY key, MASK mask ) if( KEY_RETURN == key ) { - if (mask == MASK_CONTROL) + if (mask == MASK_CONTROL && gSavedSettings.getBool("AlchemyEnableKeyboardShout")) { // shout sendChat(CHAT_TYPE_SHOUT); handled = TRUE; } + else if (mask == MASK_SHIFT && gSavedSettings.getBool("AlchemyEnableKeyboardWhisper")) + { + sendChat(CHAT_TYPE_WHISPER); + handled = TRUE; + } else if (mask == MASK_NONE) { // say @@ -342,6 +353,7 @@ void LLChatBar::startChat(const char* line) LLChatBar* bar = LLFloaterReg::getTypedInstance<LLChatBar>("chatbar"); bar->setVisible(TRUE); bar->setFocus(TRUE); + bar->mInputEditor->setFocus(TRUE); if (line) { diff --git a/indra/newview/llchatbar.h b/indra/newview/llchatbar.h index 50cdf0f533..b84d0cf020 100755 --- a/indra/newview/llchatbar.h +++ b/indra/newview/llchatbar.h @@ -48,6 +48,7 @@ public: LLChatBar(const LLSD& key); BOOL postBuild() override; + void onOpen(const LLSD& key) override; BOOL handleKeyHere(KEY key, MASK mask) override; void onFocusLost() override; diff --git a/indra/newview/skins/default/xui/en/floater_chatbar.xml b/indra/newview/skins/default/xui/en/floater_chatbar.xml index 3efad0fa4d..64391bc9fb 100644 --- a/indra/newview/skins/default/xui/en/floater_chatbar.xml +++ b/indra/newview/skins/default/xui/en/floater_chatbar.xml @@ -9,6 +9,7 @@ can_minimize="false" can_resize="true" can_resize_height="false" + can_close="false" layout="topleft" min_width="12" min_height="20" @@ -26,7 +27,7 @@ layout="topleft" top="0" left="1" - right="-25" + right="-27" name="Chat Editor" /> <menu_button follows="right" @@ -36,7 +37,7 @@ image_selected="Toolbar_Middle_Selected" image_unselected="Toolbar_Middle_Off" layout="topleft" - left_pad="0" + left_pad="2" name="chatbar_gear_menu" menu_filename="menu_chatbar_gear.xml" tool_tip="Chatbar options" @@ -49,6 +50,6 @@ width="6" name="drag" image_name="Dragbar" - top="1" + top="0" bottom="-1" /> </floater> diff --git a/indra/newview/skins/default/xui/en/menu_chatbar_gear.xml b/indra/newview/skins/default/xui/en/menu_chatbar_gear.xml index 36d9477528..9b9665f7d8 100644 --- a/indra/newview/skins/default/xui/en/menu_chatbar_gear.xml +++ b/indra/newview/skins/default/xui/en/menu_chatbar_gear.xml @@ -5,7 +5,7 @@ name="menu_chatbar_gear" visible="false"> <menu_item_check - label="Use chat bar" + label="Do not use chat bar" name="NearbyChatInConversations"> <menu_item_check.on_check control="NearbyChatInConversations" /> @@ -31,4 +31,19 @@ function="ToggleControl" parameter="LetterKeysFocusChatBar" /> </menu_item_check> -</toggleable_menu> \ No newline at end of file + <menu_item_separator /> + <menu_item_call + label="Shout (Control)" + layout="topleft" + name="shout"> + <menu_item_call.on_click + function="Chatbar.Shout" /> + </menu_item_call> + <menu_item_call + label="Whisper (Shift)" + layout="topleft" + name="whisper"> + <menu_item_call.on_click + function="Chatbar.Whisper" /> + </menu_item_call> +</toggleable_menu> -- GitLab