Auto-scroll ConversationView, fix RunView append
This commit is contained in:
parent
20c6b9fc30
commit
9245dc7135
|
@ -136,9 +136,9 @@ ConversationView::ImMessage(BMessage* msg)
|
||||||
case IM_MESSAGE_SENT:
|
case IM_MESSAGE_SENT:
|
||||||
case IM_LOGS_RECEIVED:
|
case IM_LOGS_RECEIVED:
|
||||||
{
|
{
|
||||||
|
_AppendOrEnqueueMessage(msg);
|
||||||
if (im_what == IM_MESSAGE_SENT)
|
if (im_what == IM_MESSAGE_SENT)
|
||||||
fReceiveView->ScrollToBottom();
|
fReceiveView->ScrollToBottom();
|
||||||
_AppendOrEnqueueMessage(msg);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IM_ROOM_JOINED:
|
case IM_ROOM_JOINED:
|
||||||
|
@ -146,12 +146,14 @@ ConversationView::ImMessage(BMessage* msg)
|
||||||
BMessage msg;
|
BMessage msg;
|
||||||
msg.AddString("body", "** You joined the room.\n");
|
msg.AddString("body", "** You joined the room.\n");
|
||||||
_AppendOrEnqueueMessage(&msg);
|
_AppendOrEnqueueMessage(&msg);
|
||||||
|
fReceiveView->ScrollToBottom();
|
||||||
}
|
}
|
||||||
case IM_ROOM_CREATED:
|
case IM_ROOM_CREATED:
|
||||||
{
|
{
|
||||||
BMessage msg;
|
BMessage msg;
|
||||||
msg.AddString("body", "** You created the room.\n");
|
msg.AddString("body", "** You created the room.\n");
|
||||||
_AppendOrEnqueueMessage(&msg);
|
_AppendOrEnqueueMessage(&msg);
|
||||||
|
fReceiveView->ScrollToBottom();
|
||||||
}
|
}
|
||||||
case IM_ROOM_PARTICIPANT_JOINED:
|
case IM_ROOM_PARTICIPANT_JOINED:
|
||||||
{
|
{
|
||||||
|
@ -373,6 +375,7 @@ ConversationView::_UserMessage(const char* format, const char* bodyFormat,
|
||||||
BMessage newMsg;
|
BMessage newMsg;
|
||||||
newMsg.AddString("body", newBody);
|
newMsg.AddString("body", newBody);
|
||||||
_AppendOrEnqueueMessage(&newMsg);
|
_AppendOrEnqueueMessage(&newMsg);
|
||||||
|
fReceiveView->ScrollToBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include <Locale.h>
|
#include <Locale.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <PopUpMenu.h>
|
#include <PopUpMenu.h>
|
||||||
#include <ScrollBar.h>
|
|
||||||
#include <TextView.h>
|
#include <TextView.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
|
@ -98,18 +97,21 @@ RunView::Insert(const char* text, const text_run_array* runs)
|
||||||
if (lastEnd < specStart) {
|
if (lastEnd < specStart) {
|
||||||
BString normie;
|
BString normie;
|
||||||
buf.CopyCharsInto(normie, lastEnd, specStart - lastEnd);
|
buf.CopyCharsInto(normie, lastEnd, specStart - lastEnd);
|
||||||
BTextView::Insert(normie.String(), runs);
|
BTextView::Insert(TextLength(), normie.String(), normie.Length(),
|
||||||
|
runs);
|
||||||
}
|
}
|
||||||
BString special;
|
BString special;
|
||||||
buf.CopyCharsInto(special, specStart, specEnd - specStart);
|
buf.CopyCharsInto(special, specStart, specEnd - specStart);
|
||||||
BTextView::Insert(special.String(), &fUrlRun);
|
BTextView::Insert(TextLength(), special.String(), special.Length(),
|
||||||
|
&fUrlRun);
|
||||||
|
|
||||||
lastEnd = specEnd;
|
lastEnd = specEnd;
|
||||||
}
|
}
|
||||||
if (lastEnd < length) {
|
if (lastEnd < length) {
|
||||||
BString remaining;
|
BString remaining;
|
||||||
buf.CopyCharsInto(remaining, lastEnd, length - lastEnd);
|
buf.CopyCharsInto(remaining, lastEnd, length - lastEnd);
|
||||||
BTextView::Insert(remaining.String(), runs);
|
BTextView::Insert(TextLength(), remaining.String(), remaining.Length(),
|
||||||
|
runs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ŝarĝante…
Reference in New Issue