← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2841: Rich Edits use \highlight, not \cb / \chshdng0\chcbpat to set the background

 

------------------------------------------------------------
revno: 2841
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sat 2012-01-28 12:36:54 +0100
message:
  Rich Edits use \highlight, not \cb / \chshdng0\chcbpat to set the background
modified:
  win32/HubFrame.cpp
  win32/HubFrame.h


--
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 'win32/HubFrame.cpp'
--- win32/HubFrame.cpp	2012-01-27 22:19:56 +0000
+++ win32/HubFrame.cpp	2012-01-28 11:36:54 +0000
@@ -562,16 +562,17 @@
 
 		nick = chat->rtfEscape(nick);
 		if(style.textColor != -1 || style.bgColor != -1) {
-			// {{\\colortbl;\\red1\\green1\\blue1;\\red2\\green2\\blue2;}\\cf1\\cb2 nick}
-			tstring colors = _T("{{\\colortbl;");
+			// {{\\colortbl\\red0\\green0\\blue0;\\red1\\green1\\blue1;}\\cf0\\highlight1 nick}
+			tstring colors = _T("{{\\colortbl");
 			tstring colSel;
 			if(style.textColor != -1) {
 				colors += toRTF(style.textColor);
-				colSel += _T("\\cf1");
+				colSel += _T("\\cf0");
 			}
 			if(style.bgColor != -1) {
 				colors += toRTF(style.bgColor);
-				colSel += (style.textColor != -1) ? _T("\\cb2") : _T("\\cb1");
+				colSel += _T("\\highlight");
+				colSel += (style.textColor != -1) ? _T("1") : _T("0");
 			}
 			nick = colors + _T("}") + colSel + _T(" ") + nick + _T("}");
 		}
@@ -599,19 +600,25 @@
 }
 
 void HubFrame::addChat(const ChatMessage& message) {
-	auto text = format(message);
-
-	ChatType::addChat(text.second);
+	addChat(format(message));
+}
+
+void HubFrame::addChat(const tstring& text) {
+	addChat(make_pair(text, chat->rtfEscape(text)));
+}
+
+void HubFrame::addChat(const FormattedChatMessage& message) {
+	ChatType::addChat(message.second);
 
 	{
 		auto u = url;
-		WinUtil::notify(WinUtil::NOTIFICATION_MAIN_CHAT, text.first, [this, u] { activateWindow(u); });
+		WinUtil::notify(WinUtil::NOTIFICATION_MAIN_CHAT, message.first, [this, u] { activateWindow(u); });
 	}
 	setDirty(SettingsManager::BOLD_HUB);
 
 	if(BOOLSETTING(LOG_MAIN_CHAT)) {
 		ParamMap params;
-		params["message"] = [&text] { return Text::fromT(text.first); };
+		params["message"] = [&message] { return Text::fromT(message.first); };
 		client->getHubIdentity().getParams(params, "hub", false);
 		params["hubURL"] = [this] { return client->getHubUrl(); };
 		client->getMyIdentity().getParams(params, "my", true);
@@ -619,12 +626,6 @@
 	}
 }
 
-void HubFrame::addChat(const tstring& text) {
-	// this doesn't get often called so we can afford the fromT retardedness.
-	ChatMessage message = { Text::fromT(text) };
-	addChat(message);
-}
-
 void HubFrame::addStatus(const tstring& text, bool legitimate /* = true */) {
 	status->setText(STATUS_STATUS, Text::toT("[" + Util::getShortTimeString() + "] ") + text);
 

=== modified file 'win32/HubFrame.h'
--- win32/HubFrame.h	2012-01-27 22:19:56 +0000
+++ win32/HubFrame.h	2012-01-28 11:36:54 +0000
@@ -201,6 +201,7 @@
 	FormattedChatMessage format(const ChatMessage& message, int* pmInfo = nullptr) const;
 	void addChat(const ChatMessage& message);
 	void addChat(const tstring& text);
+	void addChat(const FormattedChatMessage& message);
 	void addStatus(const tstring& text, bool legitimate = true);
 
 	pair<size_t, tstring> getStatusUsers() const;