summaryrefslogtreecommitdiff
path: root/win/Mainfrm.cpp
diff options
context:
space:
mode:
authorleo2006-02-11 23:43:04 +0000
committerleo2006-02-11 23:43:04 +0000
commit6ccbb0b27366b263042770d481a508dbe7335e34 (patch)
treeddb0be748bc3f2015a2a774246c4da75d6400447 /win/Mainfrm.cpp
parent2ed469d71dcd2bf0df70713963c03569d7bd22e5 (diff)
Better debug console colors.
git-svn-id: http://svn.leocad.org/trunk@470 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'win/Mainfrm.cpp')
-rw-r--r--win/Mainfrm.cpp75
1 files changed, 33 insertions, 42 deletions
diff --git a/win/Mainfrm.cpp b/win/Mainfrm.cpp
index 48fa128..ca4d5e4 100644
--- a/win/Mainfrm.cpp
+++ b/win/Mainfrm.cpp
@@ -39,53 +39,44 @@ void mainframe_listener (int message, void *data, void *user)
static void mainframe_console_func (LC_CONSOLE_LEVEL level, const char* text, void* user_data)
{
- CRichEditCtrl& ctrl = ((CRichEditView *) user_data)->GetRichEditCtrl ();
- CHARFORMAT cf;
- int line, index, length;
+ CRichEditCtrl& ctrl = ((CRichEditView *) user_data)->GetRichEditCtrl ();
+ CHARFORMAT cf;
- cf.cbSize = sizeof (cf);
- cf.dwMask = CFM_COLOR;
- cf.dwEffects = 0;
+ cf.cbSize = sizeof (cf);
+ cf.dwMask = CFM_COLOR;
+ cf.dwEffects = 0;
- switch (level)
- {
- case LC_CONSOLE_ERROR:
- cf.crTextColor = RGB (255, 0, 0);
- break;
-
- case LC_CONSOLE_WARNING:
- cf.crTextColor = RGB (0, 0, 255);
- break;
-
- case LC_CONSOLE_DEBUG:
- cf.crTextColor = RGB (0, 255, 0);
- break;
-
- case LC_CONSOLE_MISC:
- default:
- cf.crTextColor = RGB (0, 0, 0);
- break;
- }
+ switch (level)
+ {
+ case LC_CONSOLE_ERROR:
+ cf.crTextColor = RGB (255, 0, 0);
+ break;
+
+ case LC_CONSOLE_WARNING:
+ cf.crTextColor = RGB (0, 0, 255);
+ break;
+
+ case LC_CONSOLE_DEBUG:
+ cf.crTextColor = RGB (0, 128, 0);
+ break;
+
+ case LC_CONSOLE_MISC:
+ default:
+ cf.crTextColor = RGB (0, 0, 0);
+ break;
+ }
ctrl.SetRedraw(FALSE);
- // select the last line
- line = ctrl.GetLineCount ();
- index = ctrl.LineIndex (line - 1);
- ctrl.SetSel (index, index);
-
- // print text
- ctrl.ReplaceSel (text);
- line = ctrl.GetLineCount ();
- index = ctrl.LineIndex (line - 2);
- length = ctrl.LineLength (line - 2);
- ctrl.SetSel (index, index + length);
- ctrl.SetSelectionCharFormat (cf);
-
- // select the last line
- line = ctrl.GetLineCount ();
- index = ctrl.LineIndex (line - 1);
- ctrl.SetSel (index, index);
+ // Go to the end of the window text.
+ int TextStart = ctrl.GetWindowTextLength();
+ ctrl.SetSel(TextStart, -1);
+
+ // Change color.
+ ctrl.SetSelectionCharFormat(cf);
+
+ // Append new text.
+ ctrl.ReplaceSel(text);
ctrl.SetRedraw(TRUE);
ctrl.InvalidateRect(NULL, FALSE);