summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/llfloater.h2
-rw-r--r--indra/newview/llimconversation.cpp31
-rw-r--r--indra/newview/llimconversation.h8
-rw-r--r--indra/newview/llimfloater.cpp18
-rw-r--r--indra/newview/llimfloater.h3
-rw-r--r--indra/newview/llnearbychat.cpp109
-rw-r--r--indra/newview/llnearbychat.h8
7 files changed, 59 insertions, 120 deletions
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 17402b8d63..5be6e6d922 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -324,7 +324,7 @@ public:
virtual void setDocked(bool docked, bool pop_on_undock = true);
virtual void setTornOff(bool torn_off) { mTornOff = torn_off; }
- bool getTornOff() {return mTornOff;}
+ bool isTornOff() {return mTornOff;}
void setOpenPositioning(LLFloaterEnums::EOpenPositioning pos) {mPositioning = pos;}
// Return a closeable floater, if any, given the current focus.
diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp
index ec534b903d..3e23d75d28 100644
--- a/indra/newview/llimconversation.cpp
+++ b/indra/newview/llimconversation.cpp
@@ -94,12 +94,16 @@ BOOL LLIMConversation::postBuild()
mTearOffBtn->setCommitCallback(boost::bind(&LLIMConversation::onTearOffClicked, this));
mChatHistory = getChild<LLChatHistory>("chat_history");
- mInputEditor = getChild<LLChatEntry>("chat_editor");
+ mInputEditor = getChild<LLChatEntry>("chat_editor");
mInputEditor->setTextExpandedCallback(boost::bind(&LLIMConversation::reshapeChatHistory, this));
+ mInputEditor->setCommitOnFocusLost( FALSE );
+ mInputEditor->setPassDelete(TRUE);
+ mInputEditor->setFont(LLViewerChat::getChatFont());
+
mInputEditorTopPad = mChatHistory->getRect().mBottom - mInputEditor->getRect().mTop;
- if (!getTornOff())
+ if (!isTornOff())
{
setOpenPositioning(LLFloaterEnums::POSITIONING_RELATIVE);
}
@@ -221,18 +225,16 @@ bool LLIMConversation::onIMShowModesMenuItemEnable(const LLSD& userdata)
void LLIMConversation::hideOrShowTitle()
{
- bool is_hosted = getHost() != NULL;
-
const LLFloater::Params& default_params = LLFloater::getDefaultParams();
S32 floater_header_size = default_params.header_height;
LLView* floater_contents = getChild<LLView>("contents_view");
LLRect floater_rect = getLocalRect();
- S32 top_border_of_contents = floater_rect.mTop - (is_hosted? 0 : floater_header_size);
+ S32 top_border_of_contents = floater_rect.mTop - (isTornOff()? floater_header_size : 0);
LLRect handle_rect (0, floater_rect.mTop, floater_rect.mRight, top_border_of_contents);
LLRect contents_rect (0, top_border_of_contents, floater_rect.mRight, floater_rect.mBottom);
mDragHandle->setShape(handle_rect);
- mDragHandle->setVisible(! is_hosted);
+ mDragHandle->setVisible(isTornOff());
floater_contents->setShape(contents_rect);
}
@@ -250,9 +252,8 @@ void LLIMConversation::hideAllStandardButtons()
void LLIMConversation::updateHeaderAndToolbar()
{
- bool is_hosted = getHost() != NULL;
-
- if (is_hosted)
+ bool is_torn_off = isTornOff();
+ if (!is_torn_off)
{
hideAllStandardButtons();
}
@@ -261,7 +262,7 @@ void LLIMConversation::updateHeaderAndToolbar()
// Participant list should be visible only in torn off floaters.
bool is_participant_list_visible =
- !is_hosted
+ is_torn_off
&& gSavedSettings.getBOOL("IMShowControlPanel")
&& !mIsP2PChat;
@@ -269,21 +270,21 @@ void LLIMConversation::updateHeaderAndToolbar()
// Display collapse image (<<) if the floater is hosted
// or if it is torn off but has an open control panel.
- bool is_expanded = is_hosted || is_participant_list_visible;
+ bool is_expanded = !is_torn_off || is_participant_list_visible;
mExpandCollapseBtn->setImageOverlay(getString(is_expanded ? "collapse_icon" : "expand_icon"));
// toggle floater's drag handle and title visibility
if (mDragHandle)
{
- mDragHandle->setTitleVisible(!is_hosted);
+ mDragHandle->setTitleVisible(is_torn_off);
}
// The button (>>) should be disabled for torn off P2P conversations.
- mExpandCollapseBtn->setEnabled(is_hosted || !mIsP2PChat);
+ mExpandCollapseBtn->setEnabled(!is_torn_off || !mIsP2PChat);
- mTearOffBtn->setImageOverlay(getString(is_hosted ? "tear_off_icon" : "return_icon"));
+ mTearOffBtn->setImageOverlay(getString(is_torn_off? "return_icon" : "tear_off_icon"));
- mCloseBtn->setVisible(is_hosted && !mIsNearbyChat);
+ mCloseBtn->setVisible(!is_torn_off && !mIsNearbyChat);
enableDisableCallBtn();
diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h
index c3dff96d5d..649c200899 100644
--- a/indra/newview/llimconversation.h
+++ b/indra/newview/llimconversation.h
@@ -99,6 +99,10 @@ protected:
LLParticipantList* mParticipantList;
LLUUID mSessionID;
+ LLChatHistory* mChatHistory;
+ LLChatEntry* mInputEditor;
+ int mInputEditorTopPad; // padding between input field and chat history
+
LLButton* mExpandCollapseBtn;
LLButton* mTearOffBtn;
LLButton* mCloseBtn;
@@ -117,10 +121,6 @@ private:
*/
void reshapeChatHistory();
- LLChatHistory* mChatHistory;
- LLChatEntry* mInputEditor;
- int mInputEditorTopPad; // padding between input field and chat history
-
LLTimer* mRefreshTimer; ///< Defines the rate at which refresh() is called.
};
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 1b08c454b7..3399a88c9e 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -66,11 +66,9 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id)
: LLIMConversation(session_id),
mLastMessageIndex(-1),
mDialog(IM_NOTHING_SPECIAL),
- mInputEditor(NULL),
mSavedTitle(),
mTypingStart(),
mShouldSendTypingState(false),
- mChatHistory(NULL),
mMeTyping(false),
mOtherTyping(false),
mTypingTimer(),
@@ -80,6 +78,7 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id)
mStartConferenceInSameFloater(false)
{
mIsNearbyChat = false;
+
initIMSession(session_id);
setOverlapsScreenChannel(true);
@@ -313,9 +312,8 @@ void LLIMFloater::initIMFloater()
//virtual
BOOL LLIMFloater::postBuild()
{
- LLIMConversation::postBuild();
+ BOOL result = LLIMConversation::postBuild();
- mInputEditor = getChild<LLChatEntry>("chat_editor");
mInputEditor->setMaxTextLength(1023);
// enable line history support for instant message bar
// XXX stinson TODO : resolve merge by adding autoreplace to text editors
@@ -323,19 +321,11 @@ BOOL LLIMFloater::postBuild()
// *TODO Establish LineEditor with autoreplace callback
mInputEditor->setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2));
#endif
-
- LLFontGL* font = LLViewerChat::getChatFont();
- mInputEditor->setFont(font);
mInputEditor->setFocusReceivedCallback( boost::bind(onInputEditorFocusReceived, _1, this) );
mInputEditor->setFocusLostCallback( boost::bind(onInputEditorFocusLost, _1, this) );
mInputEditor->setKeystrokeCallback( boost::bind(onInputEditorKeystroke, _1, this) );
- mInputEditor->setCommitOnFocusLost( FALSE );
- mInputEditor->setPassDelete( TRUE );
-
mInputEditor->setCommitCallback(boost::bind(onSendMsg, _1, this));
-
- mChatHistory = getChild<LLChatHistory>("chat_history");
setDocked(true);
@@ -358,7 +348,7 @@ BOOL LLIMFloater::postBuild()
LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance();
im_box->addConversationListItem(getTitle(), getKey(), this);
- return TRUE;
+ return result;
}
void LLIMFloater::onAddButtonClicked()
@@ -1004,7 +994,7 @@ void LLIMFloater::onInputEditorKeystroke(LLTextEditor* caller, void* userdata)
// Deleting all text counts as stopping typing.
self->setTyping(!text.empty());
- }
+}
void LLIMFloater::setTyping(bool typing)
{
diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h
index 7e45cf42c2..434613ff43 100644
--- a/indra/newview/llimfloater.h
+++ b/indra/newview/llimfloater.h
@@ -184,11 +184,8 @@ private:
LLIMModel::LLIMSession* mSession;
S32 mLastMessageIndex;
- LLChatHistory* mChatHistory;
-
EInstantMessage mDialog;
LLUUID mOtherParticipantUUID;
- LLChatEntry* mInputEditor;
bool mPositioned;
std::string mSavedTitle;
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp
index 3bd5f96add..b628697bbc 100644
--- a/indra/newview/llnearbychat.cpp
+++ b/indra/newview/llnearbychat.cpp
@@ -125,30 +125,24 @@ static LLChatTypeTrigger sChatTypeTriggers[] = {
LLNearbyChat::LLNearbyChat(const LLSD& key)
: LLIMConversation(key),
- mChatBox(NULL),
- mChatHistory(NULL),
//mOutputMonitor(NULL),
mSpeakerMgr(NULL),
mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT)
{
+ mIsNearbyChat = true;
setIsChrome(TRUE);
mKey = LLSD();
- mIsNearbyChat = true;
mSpeakerMgr = LLLocalSpeakerMgr::getInstance();
}
//virtual
BOOL LLNearbyChat::postBuild()
{
- mChatBox = getChild<LLChatEntry>("chat_editor");
-
- mChatBox->setCommitCallback(boost::bind(&LLNearbyChat::onChatBoxCommit, this));
- mChatBox->setKeystrokeCallback(boost::bind(&onChatBoxKeystroke, _1, this));
- mChatBox->setFocusLostCallback(boost::bind(&onChatBoxFocusLost, _1, this));
- mChatBox->setFocusReceivedCallback(boost::bind(&LLNearbyChat::onChatBoxFocusReceived, this));
- mChatBox->setCommitOnFocusLost( FALSE );
- mChatBox->setPassDelete(TRUE);
- mChatBox->setFont(LLViewerChat::getChatFont());
+ BOOL result = LLIMConversation::postBuild();
+ mInputEditor->setCommitCallback(boost::bind(&LLNearbyChat::onChatBoxCommit, this));
+ mInputEditor->setKeystrokeCallback(boost::bind(&onChatBoxKeystroke, _1, this));
+ mInputEditor->setFocusLostCallback(boost::bind(&onChatBoxFocusLost, _1, this));
+ mInputEditor->setFocusReceivedCallback(boost::bind(&LLNearbyChat::onChatBoxFocusReceived, this));
// mOutputMonitor = getChild<LLOutputMonitorCtrl>("chat_zone_indicator");
// mOutputMonitor->setVisible(FALSE);
@@ -180,7 +174,6 @@ BOOL LLNearbyChat::postBuild()
// obsolete, but may be needed for backward compatibility?
gSavedSettings.declareS32("nearbychat_showicons_and_names", 2, "NearByChat header settings", true);
- mChatHistory = getChild<LLChatHistory>("chat_history");
if (gSavedPerAccountSettings.getBOOL("LogShowHistory"))
{
loadHistory();
@@ -190,7 +183,7 @@ BOOL LLNearbyChat::postBuild()
LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance();
im_box->addConversationListItem(getTitle(), LLSD(), this);
- return LLIMConversation::postBuild();
+ return result;
}
// virtual
@@ -227,10 +220,6 @@ bool LLNearbyChat::onNearbyChatCheckContextMenuItem(const LLSD& userdata)
return false;
}
-void LLNearbyChat::getAllowedRect(LLRect& rect)
-{
- rect = gViewerWindow->getWorldViewRectScaled();
-}
////////////////////////////////////////////////////////////////////////////////
//
void LLNearbyChat::onFocusReceived()
@@ -352,10 +341,8 @@ void LLNearbyChat::onTearOffClicked()
{
LLIMConversation::onTearOffClicked();
- LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance();
-
// see CHUI-170: Save torn-off state of the nearby chat between sessions
- BOOL in_the_multifloater = (getHost() == im_box);
+ BOOL in_the_multifloater = !isTornOff();
gSavedSettings.setBOOL("NearbyChatIsNotTornOff", in_the_multifloater);
}
@@ -389,18 +376,12 @@ void LLNearbyChat::onOpen(const LLSD& key)
showTranslationCheckbox(LLTranslate::isTranslationConfigured());
}
-bool LLNearbyChat::applyRectControl()
-{
- setResizeLimits(getMinWidth(), EXPANDED_MIN_HEIGHT);
- return LLFloater::applyRectControl();
-}
-
void LLNearbyChat::onChatFontChange(LLFontGL* fontp)
{
// Update things with the new font whohoo
- if (mChatBox)
+ if (mInputEditor)
{
- mChatBox->setFont(fontp);
+ mInputEditor->setFont(fontp);
}
}
@@ -416,33 +397,20 @@ void LLNearbyChat::show()
{
openFloater(getKey());
}
- setVisible(TRUE);
}
bool LLNearbyChat::isChatVisible() const
{
bool isVisible = false;
-
- if (isChatMultiTab())
- {
- LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance();
- // Is the IM floater container ever null?
- llassert(im_box != NULL);
- if (im_box != NULL)
- {
- if (gSavedSettings.getBOOL("NearbyChatIsNotTornOff"))
- {
- isVisible = (im_box->getVisible() && !im_box->isMinimized());
- }
- else
- {
- isVisible = (getVisible() && !isMinimized());
- }
- }
- }
- else
+ LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance();
+ // Is the IM floater container ever null?
+ llassert(im_box != NULL);
+ if (im_box != NULL)
{
- isVisible = (getVisible() && !isMinimized());
+ isVisible =
+ isChatMultiTab() && gSavedSettings.getBOOL("NearbyChatIsNotTornOff")?
+ im_box->getVisible() && !im_box->isMinimized() :
+ getVisible() && !isMinimized();
}
return isVisible;
@@ -452,22 +420,11 @@ void LLNearbyChat::showHistory()
{
openFloater();
setResizeLimits(getMinWidth(), EXPANDED_MIN_HEIGHT);
-
- bool is_torn_off = getHost() == NULL;
-
- // Reshape and enable resize controls only if it's a torn off floater.
- // Otherwise all the size changes should be handled by LLIMFloaterContainer.
- if (is_torn_off)
- {
- reshape(getRect().getWidth(), mExpandedHeight);
- enableResizeCtrls(true);
- storeRectControl();
- }
}
std::string LLNearbyChat::getCurrentChat()
{
- return mChatBox ? mChatBox->getText() : LLStringUtil::null;
+ return mInputEditor ? mInputEditor->getText() : LLStringUtil::null;
}
// virtual
@@ -516,7 +473,7 @@ void LLNearbyChat::onChatBoxKeystroke(LLTextEditor* caller, void* userdata)
LLNearbyChat* self = (LLNearbyChat *)userdata;
- LLWString raw_text = self->mChatBox->getWText();
+ LLWString raw_text = self->mInputEditor->getWText();
// Can't trim the end, because that will cause autocompletion
// to eat trailing spaces that might be part of a gesture.
@@ -563,17 +520,17 @@ void LLNearbyChat::onChatBoxKeystroke(LLTextEditor* caller, void* userdata)
if (LLGestureMgr::instance().matchPrefix(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->mInputEditor->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part
// Select to end of line, starting from the character
// after the last one the user typed.
- self->mChatBox->selectNext(rest_of_match, false);
+ self->mInputEditor->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->endOfDoc();
+ self->mInputEditor->setText(utf8_trigger + rest_of_match + " "); // keep original capitalization for user-entered part
+ self->mInputEditor->endOfDoc();
}
//llinfos << "GESTUREDEBUG " << trigger
@@ -592,7 +549,7 @@ void LLNearbyChat::onChatBoxFocusLost(LLFocusableElement* caller, void* userdata
void LLNearbyChat::onChatBoxFocusReceived()
{
- mChatBox->setEnabled(!gDisconnected);
+ mInputEditor->setEnabled(!gDisconnected);
}
EChatType LLNearbyChat::processChatTypeTriggers(EChatType type, std::string &str)
@@ -629,9 +586,9 @@ EChatType LLNearbyChat::processChatTypeTriggers(EChatType type, std::string &str
void LLNearbyChat::sendChat( EChatType type )
{
- if (mChatBox)
+ if (mInputEditor)
{
- LLWString text = mChatBox->getWText();
+ LLWString text = mInputEditor->getWText();
LLWStringUtil::trim(text);
LLWStringUtil::replaceChar(text,182,'\n'); // Convert paragraph symbols back into newlines.
if (!text.empty())
@@ -664,7 +621,7 @@ void LLNearbyChat::sendChat( EChatType type )
}
}
- mChatBox->setText(LLStringExplicit(""));
+ mInputEditor->setText(LLStringExplicit(""));
}
gAgent.stopTyping();
@@ -735,7 +692,7 @@ void LLNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD &args)
void LLNearbyChat::onChatBoxCommit()
{
- if (mChatBox->getText().length() > 0)
+ if (mInputEditor->getText().length() > 0)
{
sendChat(CHAT_TYPE_NORMAL);
}
@@ -837,15 +794,15 @@ void LLNearbyChat::startChat(const char* line)
cb->show();
cb->setVisible(TRUE);
cb->setFocus(TRUE);
- cb->mChatBox->setFocus(TRUE);
+ cb->mInputEditor->setFocus(TRUE);
if (line)
{
std::string line_string(line);
- cb->mChatBox->setText(line_string);
+ cb->mInputEditor->setText(line_string);
}
- cb->mChatBox->endOfDoc();
+ cb->mInputEditor->endOfDoc();
}
}
@@ -857,7 +814,7 @@ void LLNearbyChat::stopChat()
if (cb)
{
- cb->mChatBox->setFocus(FALSE);
+ cb->mInputEditor->setFocus(FALSE);
// stop typing animation
gAgent.stopTyping();
diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h
index a0928e67ef..7c58e3037e 100644
--- a/indra/newview/llnearbychat.h
+++ b/indra/newview/llnearbychat.h
@@ -39,7 +39,6 @@
#include "llpanel.h"
class LLResizeBar;
-class LLChatHistory;
class LLNearbyChat
: public LLIMConversation
@@ -73,7 +72,7 @@ public:
void onNearbyChatContextMenuItemClicked(const LLSD& userdata);
bool onNearbyChatCheckContextMenuItem(const LLSD& userdata);
- LLChatEntry* getChatBox() { return mChatBox; }
+ LLChatEntry* getChatBox() { return mInputEditor; }
std::string getCurrentChat();
@@ -98,8 +97,6 @@ protected:
void onChatBoxCommit();
void onChatFontChange(LLFontGL* fontp);
- /* virtual */ bool applyRectControl();
-
/*virtual*/ void onTearOffClicked();
static LLWString stripChannelNumber(const LLWString &mesg, S32* channel);
@@ -113,7 +110,6 @@ protected:
// Which non-zero channel did we last chat on?
static S32 sLastSpecialChatChannel;
- LLChatEntry* mChatBox;
LLOutputMonitorCtrl* mOutputMonitor;
LLLocalSpeakerMgr* mSpeakerMgr;
@@ -121,7 +117,6 @@ protected:
private:
- void getAllowedRect (LLRect& rect);
// prepare chat's params and out one message to chatHistory
void appendMessage(const LLChat& chat, const LLSD &args = 0);
void onNearbySpeakers ();
@@ -130,7 +125,6 @@ private:
LLHandle<LLView> mPopupMenuHandle;
std::vector<LLChat> mMessageArchive;
- LLChatHistory* mChatHistory;
};