linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #05325
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2859: chat stuff
------------------------------------------------------------
revno: 2859
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Tue 2012-02-07 20:10:02 +0100
message:
chat stuff
modified:
changelog.txt
dcpp/ChatMessage.cpp
dcpp/SettingsManager.cpp
dwt/src/widgets/RichTextBox.cpp
dwt/src/widgets/TextBox.cpp
win32/AspectChat.h
win32/HubFrame.cpp
win32/PrivateFrame.cpp
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt 2012-02-04 17:18:19 +0000
+++ changelog.txt 2012-02-07 19:10:02 +0000
@@ -18,6 +18,7 @@
* Apply user matching definition styles to nicks in chats (poy)
* Fix favorite hub groups on Win XP (poy)
* [L#925659] Safer window cleanup (poy)
+* Reduce chat flickering (bigmuscle)
-- 0.791 2012-01-14 --
* Update translations
=== modified file 'dcpp/ChatMessage.cpp'
--- dcpp/ChatMessage.cpp 2012-02-04 15:43:31 +0000
+++ dcpp/ChatMessage.cpp 2012-02-07 19:10:02 +0000
@@ -92,7 +92,6 @@
if(BOOLSETTING(TIME_STAMPS)) {
tmp = "[" + Util::getShortTimeString(timestamp) + "]";
- message += tmp + " ";
htmlMessage += addSpan("timestamp", tmp, Util::emptyString) + " ";
}
=== modified file 'dcpp/SettingsManager.cpp'
--- dcpp/SettingsManager.cpp 2012-02-04 17:40:35 +0000
+++ dcpp/SettingsManager.cpp 2012-02-07 19:10:02 +0000
@@ -327,7 +327,7 @@
setDefault(USERS_FILTER_FAVORITE, true);
setDefault(USERS_FILTER_QUEUE, false);
setDefault(USERS_FILTER_WAITING, false);
- setDefault(MAX_PM_WINDOWS, 20);
+ setDefault(MAX_PM_WINDOWS, 50);
setSearchTypeDefaults();
=== modified file 'dwt/src/widgets/RichTextBox.cpp'
--- dwt/src/widgets/RichTextBox.cpp 2012-01-27 22:19:56 +0000
+++ dwt/src/widgets/RichTextBox.cpp 2012-02-07 19:10:02 +0000
@@ -201,7 +201,7 @@
bool scroll = scrollIsAtEnd();
{
- util::HoldRedraw hold(this, !scroll);
+ util::HoldRedraw hold(this);
std::pair<int, int> cr = getCaretPosRange();
std::string txt = escapeUnicode(txtRaw);
@@ -213,7 +213,6 @@
size_t len = txtRaw.size();
size_t limit = getTextLimit();
if(length() + len > limit) {
- util::HoldRedraw hold2(this, scroll);
if(len >= limit) {
charsRemoved = length();
} else {
=== modified file 'dwt/src/widgets/TextBox.cpp'
--- dwt/src/widgets/TextBox.cpp 2012-01-13 20:55:20 +0000
+++ dwt/src/widgets/TextBox.cpp 2012-02-07 19:10:02 +0000
@@ -149,14 +149,7 @@
void TextBoxBase::scrollToBottom() {
// this function takes care of various corner cases (not fully scrolled, scrolled too far...)
- const std::pair<int, int> sel = getCaretPosRange();
-
- setSelection(length());
- showCaret();
-
- // restore the previous selection
- setSelection(sel.first, sel.second);
-
+ sendMessage(WM_VSCROLL, SB_BOTTOM);
sendMessage(WM_VSCROLL, SB_BOTTOM);
}
=== modified file 'win32/AspectChat.h'
--- win32/AspectChat.h 2012-02-02 23:16:07 +0000
+++ win32/AspectChat.h 2012-02-07 19:10:02 +0000
@@ -71,27 +71,33 @@
virtual ~AspectChat() { }
-private:
- tstring formatText(const tstring& message) {
- /// @todo factor out to dwt
- /// @todo Text::toT works but _T doesn't, verify this.
- tstring pre;
- if(chat->length() > 0)
- pre += _T("\r\n");
- return Text::toT("{\\urtf1\n") + dwt::RichTextBox::rtfEscape(pre) + message + Text::toT("}\n");
- }
-
-public:
+ /// add a chat message and call addedChat.
void addChat(const tstring& message) {
- chat->addTextSteady(formatText(dwt::RichTextBox::rtfEscape(message)));
+ addChat_(dwt::RichTextBox::rtfEscape(message));
t().addedChat(message);
}
+ /// add a ChatMessage and call addedChat.
void addChat(const ChatMessage& message) {
- chat->addTextSteady(formatText(HtmlToRtf::convert(message.htmlMessage, chat)));
+ addChat_(HtmlToRtf::convert(message.htmlMessage, chat));
t().addedChat(Text::toT(message.message));
}
+ /// just add to the chat; don't call addedChat.
+ void addChatRaw(const tstring& message) {
+ addChat_(dwt::RichTextBox::rtfEscape(message));
+ }
+
+private:
+ /// @internal @param message RTF-formatted message.
+ void addChat_(tstring message) {
+ /// @todo factor out to dwt
+ if(chat->length() > 0)
+ message = _T("\\line\n") + message;
+ chat->addTextSteady(_T("{\\urtf1\n") + message + _T("}\n"));
+ }
+
+protected:
void readLog(const string& logPath, const unsigned setting) {
if(setting == 0)
return;
@@ -117,7 +123,7 @@
const size_t linesCount = lines.size();
for(size_t i = (linesCount > setting) ? (linesCount - setting) : 0; i < linesCount; ++i) {
- addChat(_T("- ") + Text::toT(lines[i]));
+ addChatRaw(_T("- ") + Text::toT(lines[i]));
}
}
=== modified file 'win32/HubFrame.cpp'
--- win32/HubFrame.cpp 2012-02-05 23:14:50 +0000
+++ win32/HubFrame.cpp 2012-02-07 19:10:02 +0000
@@ -536,12 +536,15 @@
}
void HubFrame::addStatus(const tstring& text, bool legitimate /* = true */) {
- status->setText(STATUS_STATUS, Text::toT("[" + Util::getShortTimeString() + "] ") + text);
+ auto message = Text::toT("[" + Util::getShortTimeString() + "] ") + text;
+
+ status->setText(STATUS_STATUS, message);
if(legitimate) {
- if(BOOLSETTING(STATUS_IN_CHAT))
- addChat(_T("*** ") + text);
- else
+ if(BOOLSETTING(STATUS_IN_CHAT)) {
+ addChatRaw(_T("*** ") + message);
+ addedChat(text); // addedChat expects a message with no timestamp
+ } else
setDirty(SettingsManager::BOLD_HUB);
}
=== modified file 'win32/PrivateFrame.cpp'
--- win32/PrivateFrame.cpp 2012-02-05 23:14:50 +0000
+++ win32/PrivateFrame.cpp 2012-02-07 19:10:02 +0000
@@ -209,10 +209,14 @@
}
void PrivateFrame::addStatus(const tstring& text) {
- status->setText(STATUS_STATUS, Text::toT("[" + Util::getShortTimeString() + "] ") + text);
-
- if(BOOLSETTING(STATUS_IN_CHAT))
- addChat(_T("*** ") + text);
+ auto message = Text::toT("[" + Util::getShortTimeString() + "] ") + text;
+
+ status->setText(STATUS_STATUS, message);
+
+ if(BOOLSETTING(STATUS_IN_CHAT)) {
+ addChat(_T("*** ") + message);
+ addedChat(text); // addedChat expects a message with no timestamp
+ }
}
bool PrivateFrame::preClosing() {