summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llimconversation.cpp22
-rw-r--r--indra/newview/llimconversation.h14
-rw-r--r--indra/newview/llimfloater.cpp15
-rw-r--r--indra/newview/llimfloater.h9
-rw-r--r--indra/newview/llnearbychat.cpp25
-rw-r--r--indra/newview/llnearbychat.h6
-rwxr-xr-xindra/newview/llviewerwindow.cpp5
7 files changed, 52 insertions, 44 deletions
diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp
index f12821352b..bbbc9fcffd 100644
--- a/indra/newview/llimconversation.cpp
+++ b/indra/newview/llimconversation.cpp
@@ -29,6 +29,8 @@
#include "llimconversation.h"
+#include "llchatentry.h"
+#include "llchathistory.h"
#include "lldraghandle.h"
#include "llfloaterreg.h"
#include "llimfloater.h"
@@ -47,6 +49,9 @@ LLIMConversation::LLIMConversation(const LLUUID& session_id)
, mCloseBtn(NULL)
, mSessionID(session_id)
, mParticipantList(NULL)
+ , mChatHistory(NULL)
+ , mInputEditor(NULL)
+ , mInputEditorTopPad(0)
{
mCommitCallbackRegistrar.add("IMSession.Menu.Action",
boost::bind(&LLIMConversation::onIMSessionMenuItemClicked, this, _2));
@@ -86,6 +91,12 @@ BOOL LLIMConversation::postBuild()
mTearOffBtn = getChild<LLButton>("tear_off_btn");
mTearOffBtn->setCommitCallback(boost::bind(&LLIMConversation::onTearOffClicked, this));
+ mChatHistory = getChild<LLChatHistory>("chat_history");
+ mInputEditor = getChild<LLChatEntry>("chat_editor");
+
+ mInputEditor->setTextExpandedCallback(boost::bind(&LLIMConversation::reshapeChatHistory, this));
+ mInputEditorTopPad = mChatHistory->getRect().mBottom - mInputEditor->getRect().mTop;
+
if (!getTornOff())
{
setOpenPositioning(LLFloaterEnums::POSITIONING_RELATIVE);
@@ -242,6 +253,17 @@ void LLIMConversation::updateHeaderAndToolbar()
showTranslationCheckbox();
}
+void LLIMConversation::reshapeChatHistory()
+{
+ LLRect chat_rect = mChatHistory->getRect();
+ LLRect input_rect = mInputEditor->getRect();
+
+ int delta_height = chat_rect.mBottom - (input_rect.mTop + mInputEditorTopPad);
+
+ chat_rect.setLeftTopAndSize(chat_rect.mLeft, chat_rect.mTop, chat_rect.getWidth(), chat_rect.getHeight() + delta_height);
+ mChatHistory->setShape(chat_rect);
+}
+
void LLIMConversation::showTranslationCheckbox(BOOL show)
{
getChild<LLUICtrl>("translate_chat_checkbox_lp")->setVisible(mIsNearbyChat? show : FALSE);
diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h
index 66401b9a3c..f4b8a38242 100644
--- a/indra/newview/llimconversation.h
+++ b/indra/newview/llimconversation.h
@@ -35,6 +35,8 @@
#include "lleventtimer.h"
class LLPanelChatControlPanel;
+class LLChatEntry;
+class LLChatHistory;
class LLIMConversation
: public LLTransientDockableFloater
@@ -102,6 +104,18 @@ protected:
private:
/// Update floater header and toolbar buttons when hosted/torn off state is toggled.
void updateHeaderAndToolbar();
+
+ /**
+ * Adjusts chat history height to fit vertically with input chat field
+ * and avoid overlapping, since input chat field can be vertically expanded.
+ * Implementation: chat history bottom "follows" top+top_pad of input chat field
+ */
+ void reshapeChatHistory();
+
+
+ LLChatHistory* mChatHistory;
+ LLChatEntry* mInputEditor;
+ int mInputEditorTopPad; // padding between input field and chat history
};
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 4b954de738..98ebc82f99 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -64,7 +64,6 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id)
mLastMessageIndex(-1),
mDialog(IM_NOTHING_SPECIAL),
mInputEditor(NULL),
- mInputEditorTopPad(0),
mSavedTitle(),
mTypingStart(),
mShouldSendTypingState(false),
@@ -314,12 +313,9 @@ BOOL LLIMFloater::postBuild()
mInputEditor->setPassDelete( TRUE );
mInputEditor->setCommitCallback(boost::bind(onSendMsg, _1, this));
- mInputEditor->setTextExpandedCallback(boost::bind(&LLIMFloater::reshapeChatHistory, this));
mChatHistory = getChild<LLChatHistory>("chat_history");
- mInputEditorTopPad = mChatHistory->getRect().mBottom - mInputEditor->getRect().mTop;
-
setDocked(true);
mTypingStart = LLTrans::getString("IM_typing_start_string");
@@ -1171,17 +1167,6 @@ void LLIMFloater::removeTypingIndicator(const LLIMInfo* im_info)
}
}
-void LLIMFloater::reshapeChatHistory()
-{
- LLRect chat_rect = mChatHistory->getRect();
- LLRect input_rect = mInputEditor->getRect();
-
- int delta_height = chat_rect.mBottom - (input_rect.mTop + mInputEditorTopPad);
-
- chat_rect.setLeftTopAndSize(chat_rect.mLeft, chat_rect.mTop, chat_rect.getWidth(), chat_rect.getHeight() + delta_height);
- mChatHistory->setShape(chat_rect);
-}
-
// static
void LLIMFloater::closeHiddenIMToasts()
{
diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h
index 1992bd930c..6847efedf1 100644
--- a/indra/newview/llimfloater.h
+++ b/indra/newview/llimfloater.h
@@ -163,13 +163,6 @@ private:
// Remove the "User is typing..." indicator.
void removeTypingIndicator(const LLIMInfo* im_info = NULL);
- /**
- * Adjusts chat history height to fit vertically with input chat field
- * and avoid overlapping, since input chat field can be vertically expanded.
- * Implementation: chat history bottom "follows" top+top_pad of input chat field
- */
- void reshapeChatHistory();
-
static void closeHiddenIMToasts();
static void confirmLeaveCallCallback(const LLSD& notification, const LLSD& response);
@@ -180,8 +173,6 @@ private:
LLChatHistory* mChatHistory;
- int mInputEditorTopPad; // padding between input field and chat history
-
EInstantMessage mDialog;
LLUUID mOtherParticipantUUID;
LLChatEntry* mInputEditor;
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp
index 1b2d9b6801..29ab4384cb 100644
--- a/indra/newview/llnearbychat.cpp
+++ b/indra/newview/llnearbychat.cpp
@@ -30,6 +30,7 @@
#include "lliconctrl.h"
#include "llappviewer.h"
+#include "llchatentry.h"
#include "llfloaterreg.h"
#include "lltrans.h"
#include "llimfloatercontainer.h"
@@ -138,19 +139,14 @@ LLNearbyChat::LLNearbyChat(const LLSD& key)
//virtual
BOOL LLNearbyChat::postBuild()
{
- mChatBox = getChild<LLLineEditor>("chat_editor");
+ mChatBox = getChild<LLChatEntry>("chat_editor");
mChatBox->setCommitCallback(boost::bind(&LLNearbyChat::onChatBoxCommit, this));
- mChatBox->setKeystrokeCallback(&onChatBoxKeystroke, this);
+ mChatBox->setKeystrokeCallback(boost::bind(&onChatBoxKeystroke, _1, this));
mChatBox->setFocusLostCallback(boost::bind(&onChatBoxFocusLost, _1, this));
mChatBox->setFocusReceivedCallback(boost::bind(&LLNearbyChat::onChatBoxFocusReceived, this));
- mChatBox->setIgnoreArrowKeys( FALSE );
mChatBox->setCommitOnFocusLost( FALSE );
- mChatBox->setRevertOnEsc( FALSE );
- mChatBox->setIgnoreTab(TRUE);
mChatBox->setPassDelete(TRUE);
- mChatBox->setReplaceNewlinesWithSpaces(FALSE);
- mChatBox->setEnableLineHistory(TRUE);
mChatBox->setFont(LLViewerChat::getChatFont());
// mOutputMonitor = getChild<LLOutputMonitorCtrl>("chat_zone_indicator");
@@ -459,7 +455,7 @@ BOOL LLNearbyChat::matchChatTypeTrigger(const std::string& in_str, std::string*
return string_was_found;
}
-void LLNearbyChat::onChatBoxKeystroke(LLLineEditor* caller, void* userdata)
+void LLNearbyChat::onChatBoxKeystroke(LLTextEditor* caller, void* userdata)
{
LLFirstUse::otherAvatarChatFirst(false);
@@ -513,17 +509,16 @@ void LLNearbyChat::onChatBoxKeystroke(LLLineEditor* caller, void* userdata)
{
std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size());
self->mChatBox->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part
- S32 outlength = self->mChatBox->getLength(); // in characters
// Select to end of line, starting from the character
// after the last one the user typed.
- self->mChatBox->setSelection(length, outlength);
+ self->mChatBox->selectNext(rest_of_match, false);
}
else if (matchChatTypeTrigger(utf8_trigger, &utf8_out_str))
{
std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size());
self->mChatBox->setText(utf8_trigger + rest_of_match + " "); // keep original capitalization for user-entered part
- self->mChatBox->setCursorToEnd();
+ self->mChatBox->endOfDoc();
}
//llinfos << "GESTUREDEBUG " << trigger
@@ -581,11 +576,11 @@ void LLNearbyChat::sendChat( EChatType type )
{
if (mChatBox)
{
- LLWString text = mChatBox->getConvertedText();
+ LLWString text = mChatBox->getWText();
+ LLWStringUtil::trim(text);
+ LLWStringUtil::replaceChar(text,182,'\n'); // Convert paragraph symbols back into newlines.
if (!text.empty())
{
- // store sent line in history, duplicates will get filtered
- mChatBox->updateHistory();
// Check if this is destined for another channel
S32 channel = 0;
stripChannelNumber(text, &channel);
@@ -794,7 +789,7 @@ void LLNearbyChat::startChat(const char* line)
cb->mChatBox->setText(line_string);
}
- cb->mChatBox->setCursorToEnd();
+ cb->mChatBox->endOfDoc();
}
}
diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h
index 3dc94ce0da..c9aa69a912 100644
--- a/indra/newview/llnearbychat.h
+++ b/indra/newview/llnearbychat.h
@@ -71,7 +71,7 @@ public:
void onNearbyChatContextMenuItemClicked(const LLSD& userdata);
bool onNearbyChatCheckContextMenuItem(const LLSD& userdata);
- LLLineEditor* getChatBox() { return mChatBox; }
+ LLChatEntry* getChatBox() { return mChatBox; }
//virtual void draw();
@@ -90,7 +90,7 @@ public:
protected:
static BOOL matchChatTypeTrigger(const std::string& in_str, std::string* out_str);
- static void onChatBoxKeystroke(LLLineEditor* caller, void* userdata);
+ static void onChatBoxKeystroke(LLTextEditor* caller, void* userdata);
static void onChatBoxFocusLost(LLFocusableElement* caller, void* userdata);
void onChatBoxFocusReceived();
@@ -113,7 +113,7 @@ protected:
// Which non-zero channel did we last chat on?
static S32 sLastSpecialChatChannel;
- LLLineEditor* mChatBox;
+ LLChatEntry* mChatBox;
LLOutputMonitorCtrl* mOutputMonitor;
LLLocalSpeakerMgr* mSpeakerMgr;
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 016da1d994..258bc5b698 100755
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -56,6 +56,7 @@
// linden library includes
#include "llaudioengine.h" // mute on minimize
+#include "llchatentry.h"
#include "indra_constants.h"
#include "llassetstorage.h"
#include "llerrorcontrol.h"
@@ -2492,7 +2493,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
if (nearby_chat)
{
- LLLineEditor* chat_editor = nearby_chat->getChatBox();
+ LLChatEntry* chat_editor = nearby_chat->getChatBox();
// arrow keys move avatar while chatting hack
if (chat_editor && chat_editor->hasFocus())
@@ -2555,7 +2556,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
if ( gSavedSettings.getS32("LetterKeysFocusChatBar") && !gAgentCamera.cameraMouselook() &&
!keyboard_focus && key < 0x80 && (mask == MASK_NONE || mask == MASK_SHIFT) )
{
- LLLineEditor* chat_editor = LLNearbyChat::getInstance()->getChatBox();
+ LLChatEntry* chat_editor = LLNearbyChat::getInstance()->getChatBox();
if (chat_editor)
{
// passing NULL here, character will be added later when it is handled by character handler.