← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2494: fix Rich Edit bg painting

 

------------------------------------------------------------
revno: 2494
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sat 2011-04-16 16:24:56 +0200
message:
  fix Rich Edit bg painting
modified:
  dwt/src/widgets/RichTextBox.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 'dwt/src/widgets/RichTextBox.cpp'
--- dwt/src/widgets/RichTextBox.cpp	2011-04-16 14:19:18 +0000
+++ dwt/src/widgets/RichTextBox.cpp	2011-04-16 14:24:56 +0000
@@ -67,10 +67,13 @@
 	if(cs.font)
 		setFont(cs.font);
 
-	setBackgroundColor((cs.backgroundColor == -1) ? ::GetSysColor(COLOR_WINDOW) : cs.backgroundColor);
+	COLORREF bg = (cs.backgroundColor == -1) ? ::GetSysColor(COLOR_WINDOW) : cs.backgroundColor;
+	COLORREF fg = (cs.foregroundColor == -1) ? ::GetSysColor(COLOR_WINDOWTEXT) : cs.foregroundColor;
+
+	setBackgroundColor(bg);
 
 	CHARFORMAT textFormat = { sizeof(CHARFORMAT), CFM_COLOR };
-	textFormat.crTextColor = (cs.foregroundColor == -1) ? ::GetSysColor(COLOR_WINDOWTEXT) : cs.foregroundColor;
+	textFormat.crTextColor = fg;
 	setDefaultCharFormat(textFormat);
 
 	setScrollBarHorizontally(cs.scrollBarHorizontallyFlag);
@@ -81,11 +84,11 @@
 	/* unlike other common controls, Rich Edits ignore WM_PRINTCLIENT messages. as per
 	<http://msdn.microsoft.com/en-us/library/bb787875(VS.85).aspx>, we have to handle the printing
 	by ourselves. this is crucial for taskbar thumbnails and "Aero Peek" previews. */
-	onPrinting([this, cs](Canvas& canvas) {
+	onPrinting([this, bg](Canvas& canvas) {
 		Rectangle rect(GCC_WTF->getClientSize());
 
 		// paint a background in case the text doesn't span the whole box.
-		canvas.fill(rect, Brush(cs.backgroundColor));
+		canvas.fill(rect, Brush(bg));
 
 		::FORMATRANGE format = { canvas.handle(), canvas.handle() };
 		format.rc = rect;