diff --git a/indra/llcommon/llchat.h b/indra/llcommon/llchat.h index a3cad38b94..2823b770db 100644 --- a/indra/llcommon/llchat.h +++ b/indra/llcommon/llchat.h @@ -45,6 +45,7 @@ typedef enum e_chat_type CHAT_TYPE_WHISPER = 0, CHAT_TYPE_NORMAL = 1, CHAT_TYPE_SHOUT = 2, + CHAT_TYPE_OOC = 3, CHAT_TYPE_START = 4, CHAT_TYPE_STOP = 5, CHAT_TYPE_DEBUG_MSG = 6, diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index e909fbfec3..1d388b5fc7 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2,6 +2,43 @@ + + PhoenixOOCPrefix + + Comment + Prefix to mark OOC chat + Persist + 1 + Type + String + Value + (( + + PhoenixOOCPostfix + + Comment + Postfix to mark OOC chat + Persist + 1 + Type + String + Value + )) + + + + PhoenixPlayChatAnimation + + Comment + Play the avatar chat animations, e.g. shouting + Persist + 1 + Type + Boolean + Value + 1 + + ShowScriptDialogsTopRight Comment diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index c7e7757f3d..b4609d9543 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -137,6 +137,9 @@ BOOL LLChatBar::postBuild() mIsBuilt = TRUE; + PhoenixPlayChatAnimation = gSavedSettings.getBOOL("PhoenixPlayChatAnimation"); + gSavedSettings.getControl("PhoenixPlayChatAnimation")->getSignal()->connect(boost::bind(&LLChatBar::updatePhoenixPlayChatAnimation, this, _2)); + return TRUE; } @@ -157,6 +160,18 @@ BOOL LLChatBar::handleKeyHere( KEY key, MASK mask ) sendChat(CHAT_TYPE_SHOUT); handled = TRUE; } + else if (mask == MASK_SHIFT) + { + // whisper + sendChat(CHAT_TYPE_WHISPER); + handled = TRUE; + } + else if (mask == MASK_ALT) + { + // OOC + sendChat(CHAT_TYPE_OOC); + handled = TRUE; + } else if (mask == MASK_NONE) { // say @@ -356,6 +371,10 @@ LLWString LLChatBar::stripChannelNumber(const LLWString &mesg, S32* channel) } } +void LLChatBar::updatePhoenixPlayChatAnimation(const LLSD &data) +{ + PhoenixPlayChatAnimation = data.asBoolean(); +} void LLChatBar::sendChat( EChatType type ) { @@ -364,6 +383,14 @@ void LLChatBar::sendChat( EChatType type ) LLWString text = mInputEditor->getConvertedText(); if (!text.empty()) { + if(type == CHAT_TYPE_OOC) + { + std::string tempText = mInputEditor->getText(); + tempText = gSavedSettings.getString("PhoenixOOCPrefix") + " " + tempText + " " + gSavedSettings.getString("PhoenixOOCPostfix"); + mInputEditor->setText(tempText); + text = utf8str_to_wstring(tempText); + } + // store sent line in history, duplicates will get filtered if (mInputEditor) mInputEditor->updateHistory(); // Check if this is destined for another channel @@ -437,10 +464,16 @@ void LLChatBar::sendChat( EChatType type ) utf8_revised_text = utf8str_trim(utf8_revised_text); + EChatType nType; + if(type == CHAT_TYPE_OOC) + nType = CHAT_TYPE_NORMAL; + else + nType = type; + if (!utf8_revised_text.empty()) { // Chat with animation - sendChatFromViewer(utf8_revised_text, type, TRUE); + sendChatFromViewer(utf8_revised_text, nType, PhoenixPlayChatAnimation); } } } diff --git a/indra/newview/llchatbar.h b/indra/newview/llchatbar.h index 26ef5f1535..dfa189c042 100644 --- a/indra/newview/llchatbar.h +++ b/indra/newview/llchatbar.h @@ -89,6 +89,8 @@ public: static void startChat(const char* line); static void stopChat(); + void updatePhoenixPlayChatAnimation(const LLSD &data); + protected: void sendChat(EChatType type); void updateChat(); @@ -105,6 +107,8 @@ protected: LLComboBox* mGestureCombo; LLChatBarGestureObserver* mObserver; + + BOOL PhoenixPlayChatAnimation; }; extern LLChatBar *gChatBar; diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index dd499f4339..f88f4fa065 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -471,10 +471,51 @@ void LLNearbyChat::onInputEditorKeystroke(LLLineEditor* caller, void* userdata) void LLNearbyChat::onSendMsg( LLUICtrl* ctrl, void* userdata ) { LLNearbyChat* self = (LLNearbyChat*)userdata; - LLNearbyChatBar::getInstance()->onChatBoxCommit(); + LLNearbyChatBar::getInstance()->sendChat(CHAT_TYPE_NORMAL); self->mInputEditor->setText(LLStringExplicit("")); } +// virtual +BOOL LLNearbyChat::handleKeyHere( KEY key, MASK mask ) +{ + BOOL handled = FALSE; + + if( KEY_RETURN == key ) + { + if (mask == MASK_CONTROL) + { + // shout + LLNearbyChatBar::getInstance()->sendChat(CHAT_TYPE_SHOUT); + handled = TRUE; + } + else if (mask == MASK_SHIFT) + { + // whisper + LLNearbyChatBar::getInstance()->sendChat(CHAT_TYPE_WHISPER); + handled = TRUE; + } + else if (mask == MASK_ALT) + { + // OOC + LLNearbyChatBar::getInstance()->sendChat(CHAT_TYPE_OOC); + handled = TRUE; + } + // Ansariel: For some reason we don't get an unmasked return here. + // So we use the child commit callback that invokes + // LLNearbyChat::onSendMsg() to handle this case. + //else if (mask == MASK_NONE) + //{ + // // say + // LLNearbyChatBar::getInstance()->sendChat(CHAT_TYPE_NORMAL); + // handled = TRUE; + //} + } + + if (handled == TRUE) mInputEditor->setText(LLStringExplicit("")); + + return handled; +} + BOOL LLNearbyChat::matchChatTypeTrigger(const std::string& in_str, std::string* out_str) { U32 in_len = in_str.length(); diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h index 7439e989fc..199b5eebad 100644 --- a/indra/newview/llnearbychat.h +++ b/indra/newview/llnearbychat.h @@ -91,6 +91,8 @@ private: static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata); static BOOL matchChatTypeTrigger(const std::string& in_str, std::string* out_str); + virtual BOOL handleKeyHere( KEY key, MASK mask ); + private: LLHandle mPopupMenuHandle; LLChatHistory* mChatHistory; diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index 6b695c5a76..bfdceddc63 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -433,6 +433,9 @@ BOOL LLNearbyChatBar::postBuild() mOutputMonitor = getChild("chat_zone_indicator"); mOutputMonitor->setVisible(FALSE); + PhoenixPlayChatAnimation = gSavedSettings.getBOOL("PhoenixPlayChatAnimation"); + gSavedSettings.getControl("PhoenixPlayChatAnimation")->getSignal()->connect(boost::bind(&LLNearbyChatBar::updatePhoenixPlayChatAnimation, this, _2)); + return TRUE; } @@ -464,20 +467,33 @@ BOOL LLNearbyChatBar::handleKeyHere( KEY key, MASK mask ) { BOOL handled = FALSE; - if( KEY_RETURN == key && mask == MASK_CONTROL) + if( KEY_RETURN == key ) { - // shout - sendChat(CHAT_TYPE_SHOUT); - handled = TRUE; + if (mask == MASK_CONTROL) + { + // shout + sendChat(CHAT_TYPE_SHOUT); + handled = TRUE; + } + else if (mask == MASK_SHIFT) + { + // whisper + sendChat(CHAT_TYPE_WHISPER); + handled = TRUE; + } + else if (mask == MASK_ALT) + { + // OOC + sendChat(CHAT_TYPE_OOC); + handled = TRUE; + } + else if (mask == MASK_NONE) + { + // say + sendChat( CHAT_TYPE_NORMAL ); + handled = TRUE; + } } -//-TT Satomi Ahn - Patch MU_OOC - else if( KEY_RETURN == key && mask == MASK_SHIFT) - { - // whisper - sendChat(CHAT_TYPE_WHISPER); - handled = TRUE; - } -//-TT Satomi Ahn - Patch MU_OOC return handled; } @@ -626,6 +642,11 @@ EChatType LLNearbyChatBar::processChatTypeTriggers(EChatType type, std::string & return type; } +void LLNearbyChatBar::updatePhoenixPlayChatAnimation(const LLSD &data) +{ + PhoenixPlayChatAnimation = data.asBoolean(); +} + void LLNearbyChatBar::sendChat( EChatType type ) { if (mChatBox) @@ -633,6 +654,14 @@ void LLNearbyChatBar::sendChat( EChatType type ) LLWString text = mChatBox->getConvertedText(); if (!text.empty()) { + if(type == CHAT_TYPE_OOC) + { + std::string tempText = mChatBox->getText(); + tempText = gSavedSettings.getString("PhoenixOOCPrefix") + " " + tempText + " " + gSavedSettings.getString("PhoenixOOCPostfix"); + mChatBox->setText(tempText); + text = utf8str_to_wstring(tempText); + } + // store sent line in history, duplicates will get filtered mChatBox->updateHistory(); // Check if this is destined for another channel @@ -705,12 +734,18 @@ void LLNearbyChatBar::sendChat( EChatType type ) utf8_revised_text = utf8str_trim(utf8_revised_text); - type = processChatTypeTriggers(type, 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, TRUE); + sendChatFromViewer(utf8_revised_text, type, PhoenixPlayChatAnimation); } } diff --git a/indra/newview/llnearbychatbar.h b/indra/newview/llnearbychatbar.h index b211e4b48b..b611476b4f 100644 --- a/indra/newview/llnearbychatbar.h +++ b/indra/newview/llnearbychatbar.h @@ -123,13 +123,14 @@ public: void onChatBoxCommit(); void setText(const LLStringExplicit &new_text); + void sendChat( EChatType type ); + void updatePhoenixPlayChatAnimation(const LLSD &data); + protected: static BOOL matchChatTypeTrigger(const std::string& in_str, std::string* out_str); static void onChatBoxKeystroke(LLLineEditor* caller, void* userdata); - void sendChat( EChatType type ); - static LLWString stripChannelNumber(const LLWString &mesg, S32* channel); EChatType processChatTypeTriggers(EChatType type, std::string &str); @@ -141,6 +142,8 @@ protected: LLLineEditor* mChatBox; LLOutputMonitorCtrl* mOutputMonitor; LLLocalSpeakerMgr* mSpeakerMgr; + + BOOL PhoenixPlayChatAnimation; }; #endif diff --git a/indra/newview/skins/default/xui/de/panel_preferences_chat.xml b/indra/newview/skins/default/xui/de/panel_preferences_chat.xml index 8086128dd7..97bcaf4fd7 100644 --- a/indra/newview/skins/default/xui/de/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/de/panel_preferences_chat.xml @@ -9,6 +9,7 @@ + diff --git a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml index 3c72a282a2..cc30bbd9ac 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml @@ -77,6 +77,16 @@ name="play_typing_animation" top_pad="5" width="400" /> +