Compare commits
3 Commits
1c6a774e03
...
0752aab1d4
Author | SHA1 | Date |
---|---|---|
Pascal Abresch | 0752aab1d4 | |
Adrien Destugues | 8a07ba1ea0 | |
Adrien Destugues | 640aaa2449 |
|
@ -1,4 +1,4 @@
|
|||
cmake_minimum_required (VERSION 2.8)
|
||||
cmake_minimum_required (VERSION 3.20)
|
||||
|
||||
# projectname is the same as the main-executable
|
||||
project(Renga)
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -65,31 +65,31 @@ TalkView::TalkView(const gloox::JID *user, string group_room,
|
|||
_status_view = new StatusView();
|
||||
_status_view->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
|
||||
|
||||
_chat = new ChatTextView("chat", B_WILL_DRAW | B_FRAME_EVENTS);
|
||||
_chat_scroller = new BScrollView("chat_scroller", _chat, B_WILL_DRAW, false, true);
|
||||
_chat->TargetedByScrollView(_chat_scroller);
|
||||
_chat->SetFontSize(12.0);
|
||||
_chat->SetWordWrap(true);
|
||||
_chat->SetStylable(true);
|
||||
_chat->MakeEditable(false);
|
||||
timeline = new ChatTextView("timeline", B_WILL_DRAW | B_FRAME_EVENTS);
|
||||
timelineScroller = new BScrollView("timelineScroller", timeline, B_WILL_DRAW, false, true);
|
||||
timeline->TargetedByScrollView(timelineScroller);
|
||||
timeline->SetFontSize(12.0);
|
||||
timeline->SetWordWrap(true);
|
||||
timeline->SetStylable(true);
|
||||
timeline->MakeEditable(false);
|
||||
|
||||
// message control
|
||||
rgb_color text_color = ui_color(B_PANEL_TEXT_COLOR);
|
||||
BFont text_font(be_plain_font);
|
||||
|
||||
_message = new BTextView("message", &text_font, &text_color, B_WILL_DRAW);
|
||||
_message_scroller = new BScrollView("message_scroller", _message, B_WILL_DRAW, false, false);
|
||||
messageInput = new BTextView("messageInput", &text_font, &text_color, B_WILL_DRAW);
|
||||
messageInputScroller = new BScrollView("messageInputScroller", messageInput, B_WILL_DRAW, false, false);
|
||||
|
||||
_message->TargetedByScrollView(_message_scroller);
|
||||
_message->SetWordWrap(true);
|
||||
messageInput->TargetedByScrollView(messageInputScroller);
|
||||
messageInput->SetWordWrap(true);
|
||||
|
||||
// editing filter for messaging
|
||||
_message->AddFilter(new EditingFilter(_message, this));
|
||||
messageInput->AddFilter(new EditingFilter(messageInput, this));
|
||||
|
||||
// handle splits
|
||||
BSplitView* _split_talk = new BSplitView(B_VERTICAL);
|
||||
_split_talk->AddChild(_chat_scroller);
|
||||
_split_talk->AddChild(_message_scroller);
|
||||
_split_talk->AddChild(timelineScroller);
|
||||
_split_talk->AddChild(messageInputScroller);
|
||||
_split_talk->SetItemWeight(0, 12, false);
|
||||
_split_talk->SetItemWeight(1, 1, false);
|
||||
_split_talk->SetSpacing(0);
|
||||
|
@ -119,7 +119,7 @@ TalkView::TalkView(const gloox::JID *user, string group_room,
|
|||
AddChild(_split_group_people);
|
||||
AddChild(_status_view);
|
||||
|
||||
_message->MakeFocus(true);
|
||||
messageInput->MakeFocus(true);
|
||||
|
||||
// generate window title
|
||||
char buffer[1024];
|
||||
|
@ -185,8 +185,8 @@ void TalkView::FrameResized(float width, float height)
|
|||
{
|
||||
BView::FrameResized(width, height);
|
||||
|
||||
BRect chat_rect = _chat->Frame();
|
||||
BRect message_rect = _message->Frame();
|
||||
BRect chat_rect = timeline->Frame();
|
||||
BRect message_rect = messageInput->Frame();
|
||||
|
||||
chat_rect.OffsetTo(B_ORIGIN);
|
||||
message_rect.OffsetTo(B_ORIGIN);
|
||||
|
@ -194,11 +194,11 @@ void TalkView::FrameResized(float width, float height)
|
|||
chat_rect.InsetBy(2.0, 2.0);
|
||||
message_rect.InsetBy(2.0, 2.0);
|
||||
|
||||
_chat->SetTextRect(chat_rect);
|
||||
_message->SetTextRect(message_rect);
|
||||
timeline->SetTextRect(chat_rect);
|
||||
messageInput->SetTextRect(message_rect);
|
||||
|
||||
_chat->Invalidate();
|
||||
_chat_scroller->Invalidate();
|
||||
timeline->Invalidate();
|
||||
timelineScroller->Invalidate();
|
||||
}
|
||||
|
||||
|
||||
|
@ -281,7 +281,7 @@ void TalkView::MessageReceived(BMessage *msg) {
|
|||
}
|
||||
|
||||
case JAB_CHAT_SENT: {
|
||||
string message = _message->Text();
|
||||
string message = messageInput->Text();
|
||||
|
||||
// eliminate empty messages
|
||||
if (message.empty())
|
||||
|
@ -292,17 +292,17 @@ void TalkView::MessageReceived(BMessage *msg) {
|
|||
// we go through main app?
|
||||
gloox::MUCRoom* room = (gloox::MUCRoom*)TalkManager::Instance()
|
||||
->IsExistingWindowToGroup(GetGroupRoom());
|
||||
room->send(_message->Text());
|
||||
room->send(messageInput->Text());
|
||||
} else
|
||||
_session->send(_message->Text());
|
||||
_session->send(messageInput->Text());
|
||||
|
||||
// user part
|
||||
NewMessage(message);
|
||||
|
||||
// GUI
|
||||
_message->ScrollToOffset(0);
|
||||
_message->SetText("");
|
||||
_message->MakeFocus(true);
|
||||
messageInput->ScrollToOffset(0);
|
||||
messageInput->SetText("");
|
||||
messageInput->MakeFocus(true);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -409,18 +409,18 @@ void TalkView::AddToTalk(string username, string message, user_type type) {
|
|||
BString messageString = BString(message.c_str());
|
||||
|
||||
if (BlabberSettings::Instance()->Tag("show-timestamp"))
|
||||
_chat->Insert(_chat->TextLength(), time_stamp.c_str(), time_stamp.size(), &tra_thin_black);
|
||||
timeline->Insert(timeline->TextLength(), time_stamp.c_str(), time_stamp.size(), &tra_thin_black);
|
||||
|
||||
if (messageString.StartsWith("/me ")) {
|
||||
messageString.ReplaceFirst("/me", username.c_str());
|
||||
if (type == MAIN_RECIPIENT)
|
||||
_chat->Insert(_chat->TextLength(), messageString, messageString.Length(), &tra_thick_blue);
|
||||
timeline->Insert(timeline->TextLength(), messageString, messageString.Length(), &tra_thick_blue);
|
||||
else
|
||||
_chat->Insert(_chat->TextLength(), messageString, messageString.Length(), &tra_thick_red);
|
||||
timeline->Insert(timeline->TextLength(), messageString, messageString.Length(), &tra_thick_red);
|
||||
|
||||
_chat->Insert(_chat->TextLength(), "\n", 1, &tra_thin_black);
|
||||
timeline->Insert(timeline->TextLength(), "\n", 1, &tra_thin_black);
|
||||
if (type == LOCAL)
|
||||
_chat->ScrollTo(0.0, _chat->Bounds().bottom);
|
||||
timeline->ScrollTo(0.0, timeline->Bounds().bottom);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -429,8 +429,8 @@ void TalkView::AddToTalk(string username, string message, user_type type) {
|
|||
if (!IsGroupChat() || !BlabberSettings::Instance()->Tag("exclude-groupchat-sounds"))
|
||||
SoundSystem::Instance()->PlayMessageSound();
|
||||
|
||||
_chat->Insert(_chat->TextLength(), username.c_str(), username.size(), &tra_thick_blue);
|
||||
_chat->Insert(_chat->TextLength(), ": ", 2, &tra_thin_black);
|
||||
timeline->Insert(timeline->TextLength(), username.c_str(), username.size(), &tra_thick_blue);
|
||||
timeline->Insert(timeline->TextLength(), ": ", 2, &tra_thin_black);
|
||||
|
||||
// Highlight messages when they mention the nickname
|
||||
if (messageString.IFindFirst(_group_username.c_str()) != B_ERROR) {
|
||||
|
@ -445,19 +445,19 @@ void TalkView::AddToTalk(string username, string message, user_type type) {
|
|||
GenerateHyperlinkText(message, tr_thin_black, &this_array);
|
||||
}
|
||||
} else if (type == LOCAL) {
|
||||
_chat->Insert(_chat->TextLength(), username.c_str(), username.size(), &tra_thick_red);
|
||||
_chat->Insert(_chat->TextLength(), ": ", 2, &tra_thin_black);
|
||||
timeline->Insert(timeline->TextLength(), username.c_str(), username.size(), &tra_thick_red);
|
||||
timeline->Insert(timeline->TextLength(), ": ", 2, &tra_thin_black);
|
||||
|
||||
GenerateHyperlinkText(message, tr_thin_black, &this_array);
|
||||
} else { // SYSTEM messages
|
||||
GenerateHyperlinkText(message, tr_thick_black, &this_array);
|
||||
}
|
||||
_chat->Insert(_chat->TextLength(), message.c_str(), message.size(), this_array);
|
||||
timeline->Insert(timeline->TextLength(), message.c_str(), message.size(), this_array);
|
||||
free(this_array);
|
||||
|
||||
_chat->Insert(_chat->TextLength(), "\n", 1, &tra_thin_black);
|
||||
timeline->Insert(timeline->TextLength(), "\n", 1, &tra_thin_black);
|
||||
if (type == LOCAL)
|
||||
_chat->ScrollTo(0.0, _chat->Bounds().bottom);
|
||||
timeline->ScrollTo(0.0, timeline->Bounds().bottom);
|
||||
}
|
||||
|
||||
|
||||
|
@ -798,13 +798,13 @@ void TalkView::RevealPreviousHistory() {
|
|||
return;
|
||||
|
||||
if (_chat_index == -1)
|
||||
_chat_buffer = _message->Text();
|
||||
_chat_buffer = messageInput->Text();
|
||||
|
||||
// go back
|
||||
++_chat_index;
|
||||
|
||||
// update text
|
||||
_message->SetText(_chat_history[_chat_index].c_str());
|
||||
messageInput->SetText(_chat_history[_chat_index].c_str());
|
||||
}
|
||||
|
||||
|
||||
|
@ -818,10 +818,10 @@ void TalkView::RevealNextHistory() {
|
|||
|
||||
// last buffer
|
||||
if (_chat_index == -1) {
|
||||
_message->SetText(_chat_buffer.c_str());
|
||||
messageInput->SetText(_chat_buffer.c_str());
|
||||
} else {
|
||||
// update text
|
||||
_message->SetText(_chat_history[_chat_index].c_str());
|
||||
messageInput->SetText(_chat_history[_chat_index].c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,10 +89,10 @@ private:
|
|||
// GUI
|
||||
StatusView *_status_view;
|
||||
|
||||
BScrollView *_chat_scroller;
|
||||
BScrollView *_message_scroller;
|
||||
ChatTextView *_chat;
|
||||
BTextView *_message;
|
||||
BScrollView *timelineScroller;
|
||||
BScrollView *messageInputScroller;
|
||||
ChatTextView *timeline;
|
||||
BTextView *messageInput;
|
||||
|
||||
BListView *_people;
|
||||
|
||||
|
|
Loading…
Reference in New Issue