summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorleo2001-12-04 17:59:01 +0000
committerleo2001-12-04 17:59:01 +0000
commit26778001fa2296fb129762fd7e0728caef13a151 (patch)
treecac149b7114e2114087861c61e15a660239b9da2
parent5a86ba19f529e433846b5a6fef0f9f038b70d900 (diff)
Debug console
git-svn-id: http://svn.leocad.org/trunk@274 c7d43263-9d01-0410-8a33-9dba5d9f93d6
-rw-r--r--win/LeoCAD.dsp34
-rw-r--r--win/Mainfrm.cpp66
-rw-r--r--win/Mainfrm.h2
3 files changed, 96 insertions, 6 deletions
diff --git a/win/LeoCAD.dsp b/win/LeoCAD.dsp
index 3955c11..61cbe11 100644
--- a/win/LeoCAD.dsp
+++ b/win/LeoCAD.dsp
@@ -1,5 +1,5 @@
# Microsoft Developer Studio Project File - Name="LeoCAD" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
@@ -22,6 +22,7 @@ CFG=LeoCAD - Win32 Debug
!MESSAGE
# Begin Project
+# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
@@ -43,8 +44,8 @@ RSC=rc.exe
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../common" /I "../win" /D "NDEBUG" /D "WIN32" /D "LC_WINDOWS" /Yu"stdafx.h" /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
@@ -68,9 +69,9 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Gm /Gi /GX /Zi /Od /I "../common" /I "../win" /D "_DEBUG" /D "WIN32" /D "LC_WINDOWS" /Yu"stdafx.h" /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
+# ADD CPP /nologo /G6 /MTd /W3 /Gm /Gi /GX /ZI /Od /I "../common" /I "../win" /D "_DEBUG" /D "WIN32" /D "LC_WINDOWS" /Yu"stdafx.h" /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
@@ -984,6 +985,23 @@ SOURCE=..\Common\camera.h
# End Source File
# Begin Source File
+SOURCE=..\common\console.cpp
+
+!IF "$(CFG)" == "LeoCAD - Win32 Release"
+
+!ELSEIF "$(CFG)" == "LeoCAD - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\console.h
+# End Source File
+# Begin Source File
+
SOURCE=..\common\curve.cpp
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
@@ -1240,5 +1258,9 @@ SOURCE=..\common\view.cpp
SOURCE=..\common\view.h
# End Source File
# End Group
+# Begin Source File
+
+SOURCE=..\docs\CHANGES.txt
+# End Source File
# End Target
# End Project
diff --git a/win/Mainfrm.cpp b/win/Mainfrm.cpp
index 237a670..9ebf34c 100644
--- a/win/Mainfrm.cpp
+++ b/win/Mainfrm.cpp
@@ -2,6 +2,7 @@
//
#include "stdafx.h"
+#include <afxrich.h>
#include "LeoCAD.h"
#include "MainFrm.h"
#include "Camera.h"
@@ -9,6 +10,8 @@
#include "message.h"
#include "globals.h"
#include "mainwnd.h"
+#include "cadview.h"
+#include "console.h"
#include "Print.h"
@@ -40,6 +43,55 @@ 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;
+
+ 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;
+ }
+
+ // 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);
+}
+
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
@@ -205,6 +257,8 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
main_window->SetXID (this);
+ console.SetWindowCallback (&mainframe_console_func, m_wndSplitter.GetPane (1, 0));
+
return 0;
}
@@ -975,3 +1029,15 @@ void CMainFrame::OnViewNewView()
CW_USEDEFAULT, CW_USEDEFAULT, 200, 100,
m_hWnd, (HMENU)0, hInst, view);
}
+
+BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
+{
+ m_wndSplitter.CreateStatic (this, 2, 1, WS_CHILD | WS_VISIBLE, AFX_IDW_PANE_FIRST);
+
+ m_wndSplitter.CreateView (0, 0, RUNTIME_CLASS (CCADView), CSize (0, 1000), pContext);
+ m_wndSplitter.CreateView (1, 0, RUNTIME_CLASS (CRichEditView), CSize (0, 0), pContext);
+ m_wndSplitter.SetRowInfo (1, 50, 0);
+ ((CRichEditView *) m_wndSplitter.GetPane (1, 0))->GetRichEditCtrl ().SetReadOnly (TRUE);
+
+ return TRUE;
+}
diff --git a/win/Mainfrm.h b/win/Mainfrm.h
index 24d3319..e2c268d 100644
--- a/win/Mainfrm.h
+++ b/win/Mainfrm.h
@@ -36,6 +36,7 @@ public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
+ virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
//}}AFX_VIRTUAL
// Implementation
@@ -53,6 +54,7 @@ public:
CFlatToolBar m_wndToolsBar;
CFlatToolBar m_wndAnimationBar;
CPiecesBar m_wndPiecesBar;
+ CSplitterWnd m_wndSplitter;
protected:
CModifyDialog m_wndModifyDlg;