GME  13
GMEConsole.cpp
Go to the documentation of this file.
00001 // GMEConsole.cpp : implementation file
00002 //
00003 
00004 #include "stdafx.h"
00005 #include "GMEApp.h"
00006 #include "GMEstd.h"
00007 #include "mainfrm.h"
00008 #include "GMEDoc.h"
00009 #include "GMEView.h"
00010 #include "GMEConsole.h"
00011 #include "guimeta.h"
00012 
00013 CGMEConsole* CGMEConsole::theInstance = 0;
00014 
00015 #ifdef _DEBUG
00016 #define new DEBUG_NEW
00017 #undef THIS_FILE
00018 static char THIS_FILE[] = __FILE__;
00019 #endif
00020 
00022 // CGMEConsole dialog
00023 
00024 
00025 CGMEConsole::CGMEConsole(CWnd* /*pParent =NULL*/)
00026 {
00027         //{{AFX_DATA_INIT(CGMEConsole)
00028                 // NOTE: the ClassWizard will add member initialization here
00029         //}}AFX_DATA_INIT
00030         VERIFY(theInstance == 0);
00031         theInstance = this;
00032 }
00033 
00034 
00035 void CGMEConsole::DoDataExchange(CDataExchange* pDX)
00036 {
00037         CDockablePane::DoDataExchange(pDX);
00038         //{{AFX_DATA_MAP(CGMEConsole)
00039         DDX_Control(pDX, IDC_CONSOLE_CTRL, m_Console);
00040         //}}AFX_DATA_MAP
00041 }
00042 
00043 
00044 BEGIN_MESSAGE_MAP(CGMEConsole, CDockablePane)
00045         //{{AFX_MSG_MAP(CGMEConsole)
00046         ON_WM_CREATE()
00047         ON_WM_SIZE()
00048         //}}AFX_MSG_MAP
00049 END_MESSAGE_MAP()
00050 
00052 // CGMEConsole message handlers
00053 
00054 int CGMEConsole::OnCreate(LPCREATESTRUCT lpCreateStruct) 
00055 {
00056         if (CDockablePane::OnCreate(lpCreateStruct) == -1)
00057                 return -1;
00058         
00059         
00060         if(!m_Console.Create(_T("Console"),WS_CHILD | WS_BORDER | WS_VISIBLE,CRect(0,0,230,300),this,IDC_CONSOLE_CTRL)) {
00061                 ASSERT(FALSE);
00062                 return -1;
00063         }
00064 
00065         /*
00066     m_szFloat = CSize(500,165); 
00067         m_szHorz = CSize(100,165);
00068     m_szVert = CSize(120,400);
00069 */      
00070 /*@@@   m_szFloat = CSize(400,600); 
00071         m_szHorz = CSize(800,80);
00072     m_szVert = CSize(120,400);
00073 */      
00074         return 0;
00075 }
00076 
00077 void CGMEConsole::OnSize(UINT nType, int cx, int cy) 
00078 {
00079         CDockablePane::OnSize(nType, cx, cy);
00080         
00081         CRect rc;
00082         GetClientRect(rc);      
00083         m_Console.MoveWindow(rc);
00084 }
00085 
00086 BEGIN_EVENTSINK_MAP(CGMEConsole, CDockablePane)
00087     //{{AFX_EVENTSINK_MAP(CGMEConsole)
00088         ON_EVENT(CGMEConsole, IDC_CONSOLE_CTRL, 1 /* ClickMGAID */, OnClickMGAIDConsoleCtrl, VTS_BSTR)
00089         //}}AFX_EVENTSINK_MAP
00090 END_EVENTSINK_MAP()
00091 
00092 void CGMEConsole::OnClickMGAIDConsoleCtrl(LPCTSTR objid) 
00093 {
00094         if (CGMEDoc::theInstance) {
00095                 CGMEDoc::theInstance->ShowObject(objid);
00096         }       
00097 }
00098 
00099 void CGMEConsole::Clear()
00100 {
00101         m_Console.Clear();
00102 }
00103 
00104 void CGMEConsole::Message(CString str, short type)
00105 {
00106         // ShowPane(TRUE, FALSE, TRUE);
00107         m_Console.Message(str, type);
00108 }
00109 
00110 CString CGMEConsole::GetContents()
00111 {
00112         return m_Console.GetContents();
00113 }
00114 
00115 void CGMEConsole::SetContents(const CString& contents)
00116 {
00117         m_Console.SetContents(contents);
00118 }
00119 
00120 void CGMEConsole::SetGMEApp(IDispatch *idp)
00121 {
00122         m_Console.SetGMEApp(idp);
00123 }
00124 
00125 void CGMEConsole::SetGMEProj(IDispatch *idp)
00126 {
00127         m_Console.SetGMEProj(idp);
00128 }
00129 
00130 void CGMEConsole::NavigateTo(CString url)
00131 {
00132         m_Console.NavigateTo(url);
00133 }