#include <chat.h>
Public Member Functions | |
ChatBuffer (u32 scrollback) | |
~ChatBuffer ()=default | |
void | addLine (const std::wstring &name, const std::wstring &text) |
void | clear () |
u32 | getLineCount () const |
const ChatLine & | getLine (u32 index) const |
void | step (f32 dtime) |
void | deleteOldest (u32 count) |
void | deleteByAge (f32 maxAge) |
u32 | getRows () const |
void | reformat (u32 cols, u32 rows) |
const ChatFormattedLine & | getFormattedLine (u32 row) const |
void | scroll (s32 rows) |
void | scrollAbsolute (s32 scroll) |
void | scrollBottom () |
bool | getLinesModified () const |
void | resetLinesModified () |
u32 | formatChatLine (const ChatLine &line, u32 cols, std::vector< ChatFormattedLine > &destination) const |
void | resize (u32 scrollback) |
Protected Member Functions | |
s32 | getTopScrollPos () const |
s32 | getBottomScrollPos () const |
Private Attributes | |
u32 | m_scrollback |
std::vector< ChatLine > | m_unformatted |
u32 | m_cols = 0 |
u32 | m_rows = 0 |
s32 | m_scroll = 0 |
std::vector< ChatFormattedLine > | m_formatted |
ChatFormattedLine | m_empty_formatted_line |
bool | m_cache_clickable_chat_weblinks |
irr::video::SColor | m_cache_chat_weblink_color |
bool | m_lines_modified = true |
ChatBuffer::ChatBuffer | ( | u32 | scrollback | ) |
References ChatFormattedLine::first, g_settings, Settings::get(), Settings::getBool(), m_cache_chat_weblink_color, m_cache_clickable_chat_weblinks, m_empty_formatted_line, m_scrollback, and parseColorString().
|
default |
void ChatBuffer::addLine | ( | const std::wstring & | name, |
const std::wstring & | text ) |
References deleteOldest(), formatChatLine(), getBottomScrollPos(), m_cols, m_formatted, m_lines_modified, m_rows, m_scroll, m_scrollback, and m_unformatted.
Referenced by ChatBackend::addMessage().
void ChatBuffer::clear | ( | ) |
References m_formatted, m_lines_modified, m_scroll, and m_unformatted.
Referenced by ChatBackend::clearRecentChat().
void ChatBuffer::deleteByAge | ( | f32 | maxAge | ) |
References deleteOldest(), and m_unformatted.
Referenced by ChatBackend::step().
void ChatBuffer::deleteOldest | ( | u32 | count | ) |
References getBottomScrollPos(), m_formatted, m_lines_modified, m_scroll, m_unformatted, sanity_check, and scrollAbsolute().
Referenced by addLine(), deleteByAge(), and resize().
u32 ChatBuffer::formatChatLine | ( | const ChatLine & | line, |
u32 | cols, | ||
std::vector< ChatFormattedLine > & | destination ) const |
References ChatFormattedFragment::column, ChatFormattedLine::first, ChatFormattedLine::fragments, EnrichedString::getString(), m_cache_chat_weblink_color, m_cache_clickable_chat_weblinks, EnrichedString::setDefaultColor(), EnrichedString::size(), EnrichedString::substr(), ChatFormattedFragment::text, ChatFormattedFragment::weblink, and wide_to_utf8().
Referenced by addLine(), and reformat().
|
protected |
References m_formatted, and m_rows.
Referenced by addLine(), deleteOldest(), reformat(), scrollAbsolute(), and scrollBottom().
const ChatFormattedLine & ChatBuffer::getFormattedLine | ( | u32 | row | ) | const |
References m_empty_formatted_line, m_formatted, and m_scroll.
Referenced by GUIChatConsole::drawText(), and GUIChatConsole::weblinkClick().
const ChatLine & ChatBuffer::getLine | ( | u32 | index | ) | const |
References getLineCount(), and m_unformatted.
Referenced by ChatBackend::getRecentChat().
u32 ChatBuffer::getLineCount | ( | ) | const |
References m_unformatted.
Referenced by getLine(), and ChatBackend::getRecentChat().
|
inline |
References m_lines_modified.
u32 ChatBuffer::getRows | ( | ) | const |
References m_rows.
Referenced by GUIChatConsole::drawPrompt(), GUIChatConsole::drawText(), ChatBackend::scrollPageDown(), and ChatBackend::scrollPageUp().
|
protected |
References m_formatted, and m_rows.
Referenced by scrollAbsolute().
void ChatBuffer::reformat | ( | u32 | cols, |
u32 | rows ) |
References formatChatLine(), getBottomScrollPos(), m_cols, m_formatted, m_rows, m_scroll, m_unformatted, scrollAbsolute(), and scrollBottom().
Referenced by ChatBackend::reformat().
|
inline |
References m_lines_modified.
Referenced by Game::updateChat().
void ChatBuffer::resize | ( | u32 | scrollback | ) |
References deleteOldest(), m_scrollback, and m_unformatted.
Referenced by ChatBackend::applySettings().
void ChatBuffer::scroll | ( | s32 | rows | ) |
References m_scroll, and scrollAbsolute().
Referenced by ChatBackend::scroll(), scrollAbsolute(), ChatBackend::scrollPageDown(), and ChatBackend::scrollPageUp().
void ChatBuffer::scrollAbsolute | ( | s32 | scroll | ) |
References getBottomScrollPos(), getTopScrollPos(), m_scroll, and scroll().
Referenced by deleteOldest(), reformat(), and scroll().
void ChatBuffer::scrollBottom | ( | ) |
References getBottomScrollPos(), and m_scroll.
Referenced by reformat().
void ChatBuffer::step | ( | f32 | dtime | ) |
References m_unformatted.
Referenced by ChatBackend::step().
|
private |
Referenced by ChatBuffer(), and formatChatLine().
|
private |
Referenced by ChatBuffer(), and formatChatLine().
|
private |
Referenced by addLine(), and reformat().
|
private |
Referenced by ChatBuffer(), and getFormattedLine().
|
private |
Referenced by addLine(), clear(), deleteOldest(), getBottomScrollPos(), getFormattedLine(), getTopScrollPos(), and reformat().
|
private |
Referenced by addLine(), clear(), deleteOldest(), getLinesModified(), and resetLinesModified().
|
private |
Referenced by addLine(), getBottomScrollPos(), getRows(), getTopScrollPos(), and reformat().
|
private |
Referenced by addLine(), clear(), deleteOldest(), getFormattedLine(), reformat(), scroll(), scrollAbsolute(), and scrollBottom().
|
private |
Referenced by ChatBuffer(), addLine(), and resize().
|
private |
Referenced by addLine(), clear(), deleteByAge(), deleteOldest(), getLine(), getLineCount(), reformat(), resize(), and step().