From e02ae7d5a4d63b369323802fa3f8e04cb56c7c80 Mon Sep 17 00:00:00 2001 From: ziree Date: Sat, 7 Jan 2012 01:27:45 +0100 Subject: [PATCH] Making clrchat command line option work, removed in-code disabling of not-yet-implemented command line options --- indra/newview/chatbar_as_cmdline.cpp | 12 +++++------- indra/newview/fspanelprefs.cpp | 18 +----------------- indra/newview/fspanelprefs.h | 9 +-------- indra/newview/llchathistory.cpp | 4 ++++ indra/newview/llnearbychat.cpp | 8 +++++++- indra/newview/llnearbychat.h | 1 + .../xui/en/panel_preferences_firestorm.xml | 2 ++ 7 files changed, 21 insertions(+), 33 deletions(-) diff --git a/indra/newview/chatbar_as_cmdline.cpp b/indra/newview/chatbar_as_cmdline.cpp index 990f29d55d..c6407d4a14 100644 --- a/indra/newview/chatbar_as_cmdline.cpp +++ b/indra/newview/chatbar_as_cmdline.cpp @@ -42,6 +42,7 @@ #include "llworld.h" #include "lluuid.h" #include "llviewercontrol.h" +#include "llnearbychat.h" #include "material_codes.h" #include "llvolume.h" @@ -969,20 +970,17 @@ bool cmd_line_chat(std::string revised_text, EChatType type, bool from_gesture) } #endif -#if 0 //Uh, what do i do here? LGG can you help me here? + else if(command == std::string(sFSCmdLineClearChat)) { - LLFloaterChat* chat = LLFloaterChat::getInstance(LLSD()); + LLNearbyChat* chat = LLFloaterReg::getTypedInstance("nearby_chat", LLSD()); if(chat) { - LLViewerTextEditor* history_editor = chat->getChild("Chat History Editor"); - LLViewerTextEditor* history_editor_with_mute = chat->getChild("Chat History Editor with mute"); - history_editor->clear(); - history_editor_with_mute->clear(); + chat->clearChatHistory(); return false; } } -#endif + else if(command == "zdrop") { std::string setting; diff --git a/indra/newview/fspanelprefs.cpp b/indra/newview/fspanelprefs.cpp index 585010aad3..d02f7640f1 100644 --- a/indra/newview/fspanelprefs.cpp +++ b/indra/newview/fspanelprefs.cpp @@ -16,7 +16,7 @@ static LLRegisterPanelClassWrapper t_pref_fs("panel_preference_firestorm"); -PanelPreferenceFirestorm::PanelPreferenceFirestorm() : LLPanelPreference(), m_calcLineEditor(NULL), m_acLineEditor(NULL), m_tp2LineEditor(NULL), m_clearchatLineEditor(NULL), m_musicLineEditor(NULL) +PanelPreferenceFirestorm::PanelPreferenceFirestorm() : LLPanelPreference() { } @@ -36,22 +36,6 @@ BOOL PanelPreferenceFirestorm::postBuild() getChild("refresh_beams")->setCommitCallback(boost::bind(&PanelPreferenceFirestorm::refreshBeamLists, this)); getChild("delete_beam")->setCommitCallback(boost::bind(&PanelPreferenceFirestorm::onBeamDelete, this)); - m_tp2LineEditor = getChild("FSCmdLineTP2"); - m_clearchatLineEditor = getChild("FSCmdLineClearChat"); - m_musicLineEditor = getChild("FSCmdLineMusic"); - if(m_tp2LineEditor) - { - m_tp2LineEditor->setEnabled(FALSE); - } - if(m_clearchatLineEditor) - { - m_clearchatLineEditor->setEnabled(FALSE); - } - if(m_musicLineEditor) - { - m_musicLineEditor->setEnabled(FALSE); - } - //WS: Set the combo_box vars and refresh/reload them m_UseLegacyClienttags = getChild("UseLegacyClienttags"); m_ColorClienttags = getChild("ColorClienttags"); diff --git a/indra/newview/fspanelprefs.h b/indra/newview/fspanelprefs.h index 1ba1412993..6259cb58c3 100644 --- a/indra/newview/fspanelprefs.h +++ b/indra/newview/fspanelprefs.h @@ -25,15 +25,8 @@ public: void applyTagCombos(); protected: - LLLineEditor* m_calcLineEditor; - LLLineEditor* m_acLineEditor; - LLLineEditor* m_tp2LineEditor; - LLLineEditor* m_clearchatLineEditor; - LLLineEditor* m_musicLineEditor; - LLLineEditor* m_aoLineEditor; - LLComboBox* m_UseLegacyClienttags; LLComboBox* m_ColorClienttags; LLComboBox* m_ClientTagsVisibility; }; -#endif \ No newline at end of file +#endif diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 2ba37c43fb..077abec34d 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -759,6 +759,10 @@ void LLChatHistory::onClickMoreText() void LLChatHistory::clear() { mLastFromName.clear(); + // workaround: Setting the text to an empty line before clear() gets rid of + // the scrollbar, if present, which otherwise would get stuck until the next + // line was appended. -Zi + mEditor->setText(std::string(" \n")); mEditor->clear(); mLastFromID = LLUUID::null; } diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 792fc9a290..8d5c221f2d 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -457,9 +457,15 @@ void LLNearbyChat::getAllowedRect(LLRect& rect) rect = gViewerWindow->getWorldViewRectScaled(); } -void LLNearbyChat::updateChatHistoryStyle() +// exported here for "clrchat" command line -Zi +void LLNearbyChat::clearChatHistory() { mChatHistory->clear(); +} + +void LLNearbyChat::updateChatHistoryStyle() +{ + clearChatHistory(); LLSD do_not_log; do_not_log["do_not_log"] = true; diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h index 2a02ca0274..d8eb026e3e 100644 --- a/indra/newview/llnearbychat.h +++ b/indra/newview/llnearbychat.h @@ -69,6 +69,7 @@ public: virtual void setRect (const LLRect &rect); + void clearChatHistory(); virtual void updateChatHistoryStyle(); static void processChatHistoryStyleUpdate(const LLSD& newvalue); diff --git a/indra/newview/skins/default/xui/en/panel_preferences_firestorm.xml b/indra/newview/skins/default/xui/en/panel_preferences_firestorm.xml index b1aee35447..7774d62367 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_firestorm.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_firestorm.xml @@ -1031,6 +1031,7 @@