Merged with Chat-NearbyChat head from SL-2.8

--HG--
branch : Chat-NearbyChat
meow-7.2.2
Kitty Barnett 2011-09-29 00:32:58 +02:00
commit 7768379ffb
7 changed files with 49 additions and 12 deletions

View File

@ -144,6 +144,9 @@ LLTextBase::Params::Params()
: cursor_color("cursor_color"),
text_color("text_color"),
text_readonly_color("text_readonly_color"),
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-09-05 (Catznip-3.0.0a) | Added: Catznip-2.8.0b
text_label_color("text_label_color"),
// [/SL:KB]
bg_visible("bg_visible", false),
border_visible("border_visible", false),
bg_readonly_color("bg_readonly_color"),
@ -209,6 +212,10 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p)
mIsSelecting( FALSE ),
mPlainText ( p.plain_text ),
mWordWrap(p.wrap),
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-09-05 (Catznip-3.0.0a) | Added: Catznip-2.8.0b
mLabel(p.label),
mLabelColor(p.text_label_color),
// [/SL:KB]
mUseEllipses( p.use_ellipses ),
mParseHTML(p.parse_urls),
mParseHighlights(p.parse_highlights),
@ -503,6 +510,14 @@ void LLTextBase::drawText()
const S32 text_len = getLength();
if( text_len <= 0 )
{
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-09-05 (Catznip-3.0.0a) | Added: Catznip-2.8.0b
if ( (!hasFocus()) && (mLabel.length()) )
{
mDefaultFont->render(
mLabel.getWString(), 0, mLineInfoList.begin()->mRect.mLeft, mDocumentView->getRect().mBottom, mLabelColor,
LLFontGL::LEFT, LLFontGL::BOTTOM, 0, LLFontGL::NO_SHADOW, S32_MAX, mDocumentView->getRect().getWidth());
}
// [/SL:KB]
return;
}
S32 selection_left = -1;

View File

@ -249,6 +249,9 @@ public:
Optional<LLUIColor> cursor_color,
text_color,
text_readonly_color,
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-09-05 (Catznip-3.0.0a) | Added: Catznip-2.8.0b
text_label_color,
// [/SL:KB]
bg_readonly_color,
bg_writeable_color,
bg_focus_color,
@ -572,6 +575,11 @@ protected:
bool mScrollNeeded; // need to change scroll region because of change to cursor position
S32 mScrollIndex; // index of first character to keep visible in scroll region
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-09-05 (Catznip-3.0.0a) | Added: Catznip-2.8.0b
LLUIString mLabel;
LLUIColor mLabelColor;
// [/SL:KB]
// Fired when a URL link is clicked
commit_signal_t* mURLClickSignal;

View File

@ -501,6 +501,14 @@ BOOL LLNearbyChatBar::handleKeyHere( KEY key, MASK mask )
sendChat(CHAT_TYPE_SHOUT);
handled = TRUE;
}
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-08-20 (Catznip-3.0.0a) | Added: Catznip-2.8.0a
if ( (KEY_RETURN == key) && (mask == MASK_SHIFT) )
{
// Whisper
sendChat(CHAT_TYPE_WHISPER);
handled = TRUE;
}
// [/SL:KB]
return handled;
}

View File

@ -16,7 +16,7 @@ BOOL LLNearbyChatBarMulti::postBuild()
{
m_pChatEditor = findChild<LLTextEditor>("chat_editor");
m_pChatEditor->setCommitCallback(boost::bind(&LLNearbyChatBarMulti::onChatBoxCommit, this));
m_pChatEditor->setCommitCallback(boost::bind(&LLNearbyChatBarMulti::onChatBoxCommit, this, CHAT_TYPE_NORMAL));
m_pChatEditor->setKeystrokeCallback(boost::bind(&LLNearbyChatBarMulti::onChatBoxKeystroke, this, _1));
m_pChatEditor->setFocusLostCallback(boost::bind(&onChatBoxFocusLost, m_pChatEditor));
m_pChatEditor->setFocusReceivedCallback(boost::bind(&onChatBoxFocusReceived, m_pChatEditor));
@ -30,10 +30,18 @@ BOOL LLNearbyChatBarMulti::postBuild()
BOOL LLNearbyChatBarMulti::handleKeyHere(KEY key, MASK mask)
{
BOOL handled = FALSE;
if ( (KEY_RETURN == key) && (MASK_CONTROL == mask) )
if (KEY_RETURN == key)
{
sendChat(CHAT_TYPE_SHOUT);
handled = TRUE;
if (MASK_CONTROL == mask)
{
onChatBoxCommit(CHAT_TYPE_SHOUT);
handled = TRUE;
}
else if (MASK_SHIFT == mask)
{
onChatBoxCommit(CHAT_TYPE_WHISPER);
handled = TRUE;
}
}
else if ( (KEY_UP == key) && (MASK_CONTROL == mask) )
{
@ -64,7 +72,7 @@ BOOL LLNearbyChatBarMulti::handleKeyHere(KEY key, MASK mask)
return handled;
}
void LLNearbyChatBarMulti::onChatBoxCommit()
void LLNearbyChatBarMulti::onChatBoxCommit(EChatType eChatType)
{
if (m_pChatEditor->getLength() > 0)
{
@ -93,7 +101,7 @@ void LLNearbyChatBarMulti::onChatBoxCommit()
mCurrentHistoryLine = mLineHistory.end() - 1;
// Send the chat
sendChat(CHAT_TYPE_NORMAL);
LLNearbyChatBarBase::sendChat(m_pChatEditor, eChatType);
}
gAgent.stopTyping();

View File

@ -17,11 +17,9 @@ public:
virtual BOOL postBuild();
protected:
void onChatBoxCommit();
void onChatBoxCommit(EChatType eChatType);
void onChatBoxKeystroke(LLTextEditor* pTextCtrl);
void sendChat(EChatType type) { LLNearbyChatBarBase::sendChat(m_pChatEditor, type); }
/*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
/*virtual*/ LLWString getChatBoxText();

View File

@ -87,14 +87,13 @@
commit_on_return="true"
follows="all"
height="45"
label="Click here to chat"
layout="topleft"
max_length="1024"
name="chat_editor"
use_ellipses="false"
width="310"
word_wrap="true">
Click here to chat
</text_editor>
word_wrap="true" />
</panel>
</layout_panel>

View File

@ -15,6 +15,7 @@
default_color="TextDefaultColor"
text_color="TextFgColor"
text_readonly_color="TextFgReadOnlyColor"
text_label_color="TextFgTentativeColor"
text_selected_color="White"
h_pad="6"
v_pad="4"