summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-06-19 11:35:20 -0700
committerMerov Linden <merov@lindenlab.com>2012-06-19 11:35:20 -0700
commit3af9d7c0535c8d94b194952c98196bac1d8c3dda (patch)
tree68b347e9303f814de271cc27f38f19ae5a6fa4e2 /indra/newview
parentb882fe3b8dde9338c092922672015f975ca09587 (diff)
parentad4ae5583534197cb00c13d769e504fcde4d19d5 (diff)
Merge pull from richard/viewer-chui
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llexpandabletextbox.cpp4
-rw-r--r--indra/newview/llgrouplist.cpp2
-rw-r--r--indra/newview/llimconversation.cpp7
-rw-r--r--indra/newview/llimconversation.h3
-rw-r--r--indra/newview/llimfloater.cpp34
-rw-r--r--indra/newview/llimfloater.h17
-rw-r--r--indra/newview/llimfloatercontainer.cpp3
-rw-r--r--indra/newview/llnearbychat.cpp10
-rw-r--r--indra/newview/llnearbychat.h1
-rw-r--r--indra/newview/llpaneltopinfobar.cpp2
-rw-r--r--indra/newview/lltoastgroupnotifypanel.cpp2
-rw-r--r--indra/newview/lltoastpanel.cpp2
-rw-r--r--indra/newview/lltoastscripttextbox.cpp2
-rwxr-xr-xindra/newview/llviewerwindow.cpp2
-rw-r--r--indra/newview/skins/default/xui/en/floater_im_session.xml9
-rw-r--r--indra/newview/skins/default/xui/en/widgets/text.xml1
16 files changed, 65 insertions, 36 deletions
diff --git a/indra/newview/llexpandabletextbox.cpp b/indra/newview/llexpandabletextbox.cpp
index 935dcb74b0..a50184460b 100644
--- a/indra/newview/llexpandabletextbox.cpp
+++ b/indra/newview/llexpandabletextbox.cpp
@@ -150,7 +150,7 @@ void LLExpandableTextBox::LLTextBoxEx::showExpandText()
std::pair<S32, S32> visible_lines = getVisibleLines(true);
S32 last_line = visible_lines.second - 1;
- LLStyle::Params expander_style(getDefaultStyleParams());
+ LLStyle::Params expander_style(getStyleParams());
expander_style.font.style = "UNDERLINE";
expander_style.color = LLUIColorTable::instance().getColor("HTMLLinkColor");
LLExpanderSegment* expanderp = new LLExpanderSegment(new LLStyle(expander_style), getLineStart(last_line), getLength() + 1, mExpanderLabel, *this);
@@ -166,7 +166,7 @@ void LLExpandableTextBox::LLTextBoxEx::hideExpandText()
if (mExpanderVisible)
{
// this will overwrite the expander segment and all text styling with a single style
- LLStyleConstSP sp(new LLStyle(getDefaultStyleParams()));
+ LLStyleConstSP sp(new LLStyle(getStyleParams()));
LLNormalTextSegment* segmentp = new LLNormalTextSegment(sp, 0, getLength() + 1, *this);
insertSegment(segmentp);
diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp
index 2de891565c..aba3d74d87 100644
--- a/indra/newview/llgrouplist.cpp
+++ b/indra/newview/llgrouplist.cpp
@@ -406,7 +406,7 @@ void LLGroupListItem::setActive(bool active)
// *BUG: setName() overrides the style params.
// Active group should be bold.
- LLFontDescriptor new_desc(mGroupNameBox->getDefaultFont()->getFontDesc());
+ LLFontDescriptor new_desc(mGroupNameBox->getFont()->getFontDesc());
// *NOTE dzaporozhan
// On Windows LLFontGL::NORMAL will not remove LLFontGL::BOLD if font
diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp
index 3e2b208874..ead87e3ed5 100644
--- a/indra/newview/llimconversation.cpp
+++ b/indra/newview/llimconversation.cpp
@@ -236,6 +236,13 @@ void LLIMConversation::updateHeaderAndToolbar()
mCloseBtn->setVisible(is_hosted);
enableDisableCallBtn();
+
+ showTranslationCheckbox();
+}
+
+void LLIMConversation::showTranslationCheckbox(BOOL show)
+{
+ getChild<LLUICtrl>("translate_chat_checkbox_lp")->setVisible(mIsNearbyChat? show : FALSE);
}
// static
diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h
index d31ae0808a..66401b9a3c 100644
--- a/indra/newview/llimconversation.h
+++ b/indra/newview/llimconversation.h
@@ -56,6 +56,9 @@ public:
*/
static bool isChatMultiTab();
+ // show/hide the translation check box
+ void showTranslationCheckbox(const BOOL visible = FALSE);
+
// LLFloater overrides
/*virtual*/ void onOpen(const LLSD& key);
/*virtual*/ BOOL postBuild();
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 14fcd602fc..882637151d 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -44,7 +44,7 @@
#include "llimfloatercontainer.h" // to replace separate IM Floaters with multifloater container
#include "llinventoryfunctions.h"
//#include "lllayoutstack.h"
-#include "lllineeditor.h"
+#include "llchatentry.h"
#include "lllogchat.h"
#include "llscreenchannel.h"
#include "llsyswellwindow.h"
@@ -64,6 +64,7 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id)
mLastMessageIndex(-1),
mDialog(IM_NOTHING_SPECIAL),
mInputEditor(NULL),
+ mInputEditorTopPad(0),
mSavedTitle(),
mTypingStart(),
mShouldSendTypingState(false),
@@ -200,7 +201,9 @@ void LLIMFloater::sendMsg()
{
if (mInputEditor)
{
- LLWString text = mInputEditor->getConvertedText();
+ LLWString text = mInputEditor->getWText();
+ LLWStringUtil::trim(text);
+ LLWStringUtil::replaceChar(text,182,'\n'); // Convert paragraph symbols back into newlines.
if(!text.empty())
{
// Truncate and convert to UTF8 for transport
@@ -297,26 +300,26 @@ BOOL LLIMFloater::postBuild()
{
LLIMConversation::postBuild();
- mInputEditor = getChild<LLLineEditor>("chat_editor");
+ mInputEditor = getChild<LLChatEntry>("chat_editor");
mInputEditor->setMaxTextLength(1023);
// enable line history support for instant message bar
- mInputEditor->setEnableLineHistory(TRUE);
LLFontGL* font = LLViewerChat::getChatFont();
mInputEditor->setFont(font);
mInputEditor->setFocusReceivedCallback( boost::bind(onInputEditorFocusReceived, _1, this) );
mInputEditor->setFocusLostCallback( boost::bind(onInputEditorFocusLost, _1, this) );
- mInputEditor->setKeystrokeCallback( onInputEditorKeystroke, this );
+ mInputEditor->setKeystrokeCallback( boost::bind(onInputEditorKeystroke, _1, this) );
mInputEditor->setCommitOnFocusLost( FALSE );
- mInputEditor->setRevertOnEsc( FALSE );
- mInputEditor->setReplaceNewlinesWithSpaces( FALSE );
mInputEditor->setPassDelete( TRUE );
- childSetCommitCallback("chat_editor", onSendMsg, this);
+ 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");
@@ -890,7 +893,7 @@ void LLIMFloater::onInputEditorFocusLost(LLFocusableElement* caller, void* userd
}
// static
-void LLIMFloater::onInputEditorKeystroke(LLLineEditor* caller, void* userdata)
+void LLIMFloater::onInputEditorKeystroke(LLTextEditor* caller, void* userdata)
{
LLIMFloater* self = (LLIMFloater*) userdata;
std::string text = self->mInputEditor->getText();
@@ -1087,7 +1090,7 @@ private:
BOOL LLIMFloater::inviteToSession(const uuid_vec_t& ids)
{
LLViewerRegion* region = gAgent.getRegion();
- bool is_region_exist = !!region;
+ bool is_region_exist = region != NULL;
if (is_region_exist)
{
@@ -1168,6 +1171,17 @@ 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 333340c696..1992bd930c 100644
--- a/indra/newview/llimfloater.h
+++ b/indra/newview/llimfloater.h
@@ -37,7 +37,9 @@
class LLAvatarName;
class LLButton;
-class LLLineEditor;
+class LLChatEntry;
+class LLTextEditor;
+class LLPanelChatControlPanel;
class LLChatHistory;
class LLInventoryItem;
class LLInventoryCategory;
@@ -142,7 +144,7 @@ private:
void appendMessage(const LLChat& chat, const LLSD &args = 0);
static void onInputEditorFocusReceived( LLFocusableElement* caller,void* userdata );
static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata);
- static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata);
+ static void onInputEditorKeystroke(LLTextEditor* caller, void* userdata);
void setTyping(bool typing);
void onAddButtonClicked();
void onAvatarPicked(const uuid_vec_t& ids, const std::vector<LLAvatarName> names);
@@ -161,6 +163,13 @@ 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);
@@ -171,9 +180,11 @@ private:
LLChatHistory* mChatHistory;
+ int mInputEditorTopPad; // padding between input field and chat history
+
EInstantMessage mDialog;
LLUUID mOtherParticipantUUID;
- LLLineEditor* mInputEditor;
+ LLChatEntry* mInputEditor;
bool mPositioned;
std::string mSavedTitle;
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index 04fb2f3b9a..10188febab 100644
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -96,8 +96,7 @@ void LLIMFloaterContainer::onOpen(const LLSD& key)
// If there's *no* conversation open so far, we force the opening of the nearby chat conversation
// *TODO: find a way to move this to XML as a default panel or something like that
LLSD name("chat_bar");
- LLSD key("");
- LLFloaterReg::toggleInstanceOrBringToFront(name,key);
+ LLFloaterReg::toggleInstanceOrBringToFront(name);
}
/*
if (key.isDefined())
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp
index fbaf451412..1b2d9b6801 100644
--- a/indra/newview/llnearbychat.cpp
+++ b/indra/newview/llnearbychat.cpp
@@ -130,6 +130,7 @@ LLNearbyChat::LLNearbyChat(const LLSD& key)
mSpeakerMgr(NULL),
mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT)
{
+ mKey = LLSD();
mIsNearbyChat = true;
mSpeakerMgr = LLLocalSpeakerMgr::getInstance();
}
@@ -382,11 +383,6 @@ LLNearbyChat* LLNearbyChat::getInstance()
return LLFloaterReg::getTypedInstance<LLNearbyChat>("chat_bar");
}
-//static
-//LLNearbyChat* LLNearbyChat::findInstance()
-//{
-// return LLFloaterReg::findTypedInstance<LLNearbyChat>("chat_bar");
-//}
void LLNearbyChat::showHistory()
{
@@ -397,10 +393,6 @@ void LLNearbyChat::showHistory()
storeRectControl();
}
-void LLNearbyChat::showTranslationCheckbox(BOOL show)
-{
- getChild<LLUICtrl>("translate_chat_checkbox_lp")->setVisible(show);
-}
BOOL LLNearbyChat::tick()
{
diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h
index bc0e54de15..3dc94ce0da 100644
--- a/indra/newview/llnearbychat.h
+++ b/indra/newview/llnearbychat.h
@@ -87,7 +87,6 @@ public:
static void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate);
void showHistory();
- void showTranslationCheckbox(BOOL show);
protected:
static BOOL matchChatTypeTrigger(const std::string& in_str, std::string* out_str);
diff --git a/indra/newview/llpaneltopinfobar.cpp b/indra/newview/llpaneltopinfobar.cpp
index 280cc11179..854deb00d0 100644
--- a/indra/newview/llpaneltopinfobar.cpp
+++ b/indra/newview/llpaneltopinfobar.cpp
@@ -230,7 +230,7 @@ void LLPanelTopInfoBar::buildLocationString(std::string& loc_str, bool show_coor
void LLPanelTopInfoBar::setParcelInfoText(const std::string& new_text)
{
LLRect old_rect = getRect();
- const LLFontGL* font = mParcelInfoText->getDefaultFont();
+ const LLFontGL* font = mParcelInfoText->getFont();
S32 new_text_width = font->getWidth(new_text);
mParcelInfoText->setText(new_text);
diff --git a/indra/newview/lltoastgroupnotifypanel.cpp b/indra/newview/lltoastgroupnotifypanel.cpp
index 707d2d9765..ed350ea144 100644
--- a/indra/newview/lltoastgroupnotifypanel.cpp
+++ b/indra/newview/lltoastgroupnotifypanel.cpp
@@ -112,7 +112,7 @@ LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(const LLNotificationPtr& notifi
style.font = date_font;
pMessageText->appendText(timeStr + "\n", TRUE, style);
- style.font = pMessageText->getDefaultFont();
+ style.font = pMessageText->getFont();
pMessageText->appendText(message, TRUE, style);
//attachment
diff --git a/indra/newview/lltoastpanel.cpp b/indra/newview/lltoastpanel.cpp
index e20d516392..09f8dcf83c 100644
--- a/indra/newview/lltoastpanel.cpp
+++ b/indra/newview/lltoastpanel.cpp
@@ -68,7 +68,7 @@ void LLToastPanel::snapToMessageHeight(LLTextBase* message, S32 maxLineCount)
if (message->getVisible())
{
S32 heightDelta = 0;
- S32 maxTextHeight = message->getDefaultFont()->getLineHeight() * maxLineCount;
+ S32 maxTextHeight = message->getFont()->getLineHeight() * maxLineCount;
LLRect messageRect = message->getRect();
S32 oldTextHeight = messageRect.getHeight();
diff --git a/indra/newview/lltoastscripttextbox.cpp b/indra/newview/lltoastscripttextbox.cpp
index 2529ec865a..45fbabad59 100644
--- a/indra/newview/lltoastscripttextbox.cpp
+++ b/indra/newview/lltoastscripttextbox.cpp
@@ -65,7 +65,7 @@ LLToastScriptTextbox::LLToastScriptTextbox(const LLNotificationPtr& notification
pMessageText->clear();
LLStyle::Params style;
- style.font = pMessageText->getDefaultFont();
+ style.font = pMessageText->getFont();
pMessageText->appendText(message, TRUE, style);
//submit button
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 7f14e021fd..016da1d994 100755
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2555,7 +2555,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 = LLFloaterReg::getTypedInstance<LLNearbyChat>("chat_bar")->getChatBox();
+ LLLineEditor* chat_editor = LLNearbyChat::getInstance()->getChatBox();
if (chat_editor)
{
// passing NULL here, character will be added later when it is handled by character handler.
diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml
index a4695b8c09..f6d5b20a65 100644
--- a/indra/newview/skins/default/xui/en/floater_im_session.xml
+++ b/indra/newview/skins/default/xui/en/floater_im_session.xml
@@ -242,18 +242,21 @@
bottom="-1"
follows="left|right|bottom"
tab_group="1">
- <line_editor
+ <text_editor
bottom="0"
+ expand_lines_count="5"
follows="left|right|bottom"
font="SansSerifSmall"
visible="true"
height="20"
+ is_expandable="true"
label="To"
layout="bottomleft"
name="chat_editor"
tab_group="3"
- width="220">
- </line_editor>
+ width="240"
+ wrap="true">
+ </text_editor>
</panel>
</layout_panel>
</layout_stack>
diff --git a/indra/newview/skins/default/xui/en/widgets/text.xml b/indra/newview/skins/default/xui/en/widgets/text.xml
index 134f2d7522..2102074674 100644
--- a/indra/newview/skins/default/xui/en/widgets/text.xml
+++ b/indra/newview/skins/default/xui/en/widgets/text.xml
@@ -9,6 +9,7 @@
h_pad="0"
allow_scroll="false"
text_readonly_color="LabelTextColor"
+ text_tentative_color="TextFgTentativeColor"
bg_writeable_color="FloaterDefaultBackgroundColor"
use_ellipses="false"
bg_visible="false"