GME
13
|
00001 // GMEChildFrame.cpp: implementation of the CGMEChildFrame class. 00002 // 00004 00005 #include "stdafx.h" 00006 #include "GMEDoc.h" 00007 #include "GMEChildFrame.h" 00008 #include "GMEApp.h" 00009 #include "MainFrm.h" 00010 00011 00013 // CGMEChildFrame 00014 00015 IMPLEMENT_DYNCREATE(CGMEChildFrame, CView) 00016 00017 CGMEChildFrame* CGMEChildFrame::theInstance = 0; 00019 // Construction/Destruction 00021 00022 CGMEChildFrame::CGMEChildFrame(): 00023 guiMetaModel (NULL) 00024 { 00025 //{{AFX_DATA_INIT(CGMEChildFrame) 00026 //}}AFX_DATA_INIT 00027 00028 VERIFY(theInstance == 0); 00029 theInstance = this; 00030 } 00031 00032 00033 BEGIN_MESSAGE_MAP(CGMEChildFrame, CView) 00034 //{{AFX_MSG_MAP(CGMEChildFrame) 00035 ON_WM_CREATE() 00036 ON_WM_SIZE() 00037 ON_WM_CLOSE() 00038 //}}AFX_MSG_MAP 00039 END_MESSAGE_MAP() 00040 00041 00042 BEGIN_EVENTSINK_MAP(CGMEChildFrame, CView) 00043 //{{AFX_EVENTSINK_MAP(CGMEChildFrame) 00044 ON_EVENT(CGMEChildFrame, IDC_CHILDFRAMECTRL1, 1 /* AspectChanged */, OnAspectChangedGmeViewCtrl, VTS_I4) 00045 ON_EVENT(CGMEChildFrame, IDC_CHILDFRAMECTRL1, 2 /* WriteStatusZoom */, OnWriteStatusZoomGmeViewCtrl, VTS_I4) 00046 //}}AFX_EVENTSINK_MAP 00047 END_EVENTSINK_MAP() 00048 00050 // CGMEChildFrame message handlers 00051 00052 int CGMEChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 00053 { 00054 if (CView::OnCreate(lpCreateStruct) == -1) 00055 return -1; 00056 00057 if (!m_ChildFrame.Create(_T("ChildFrame"), WS_CHILD | WS_VISIBLE, CRect(0, 0, 300, 150), this, IDC_CHILDFRAMECTRL1)) 00058 return -1; 00059 00060 return 0; 00061 } 00062 00063 00064 void CGMEChildFrame::OnSize(UINT nType, int cx, int cy) 00065 { 00066 CView::OnSize(nType, cx, cy); 00067 00068 CRect rc; 00069 GetClientRect(rc); 00070 00071 m_ChildFrame.MoveWindow(rc); 00072 } 00073 00074 00075 void CGMEChildFrame::DoDataExchange(CDataExchange* pDX) 00076 { 00077 //{{AFX_DATA_MAP(CGMEChildFrame) 00078 DDX_Control(pDX, IDC_CHILDFRAMECTRL1, m_ChildFrame); 00079 //}}AFX_DATA_MAP 00080 } 00081 00082 00083 void CGMEChildFrame::OnDraw(CDC* /*pDC*/) 00084 { 00085 } 00086 00087 00088 /* 00089 ActiveX controls do not have their message pump, it is owned by their containers. 00090 The container in case of GME is a kind of control bar, which is treated as a dialog. 00091 Dialog box messages are filtered by ::IsDialogMessage, which does not allow the 00092 default dialog kestroke messages (ESC - close dialog, ENTER - push default button 00093 TAB - next item in the tab order etc...) to be propagated to the controls placed on 00094 the dialog. 00095 00096 Here we avoid calling the default PreTranslateMessage which filtered by 00097 ::IsDialogMessage, dispatch it directly to the controls. 00098 00099 Tihamer 00100 00101 */ 00102 00103 BOOL CGMEChildFrame::PreTranslateMessage(MSG* pMsg) 00104 { 00105 if (pMsg->message == WM_KEYDOWN) { 00106 switch (pMsg->wParam) { 00107 case VK_RETURN: 00108 case VK_ESCAPE: 00109 case VK_DELETE: 00110 // Modification by Volgyesi (undo problems) 00111 case VK_CONTROL: 00112 case 'z': 00113 case 'Z': 00114 // Modification End 00115 ::TranslateMessage(pMsg); 00116 ::DispatchMessage(pMsg); 00117 return TRUE; 00118 } 00119 } 00120 00121 return CView::PreTranslateMessage(pMsg); 00122 } 00123 00124 00125 void CGMEChildFrame::SetProject(CComPtr<IMgaProject> mgaProject) 00126 { 00127 m_ChildFrame.SetCurrentProject(mgaProject); 00128 } 00129 00130 00131 void CGMEChildFrame::SetMetaModel(CGuiMetaModel* meta) 00132 { 00133 LPUNKNOWN pMeta = NULL; 00134 guiMetaModel = meta; 00135 if (meta != NULL) { 00136 CComQIPtr<IMgaMetaModel> iMeta; 00137 iMeta = meta->mgaMeta; 00138 if (iMeta) 00139 pMeta = iMeta; 00140 } 00141 m_ChildFrame.SetMetaModel(pMeta); 00142 } 00143 00144 00145 void CGMEChildFrame::SetModel(CComPtr<IMgaModel> mgaModel) 00146 { 00147 m_ChildFrame.SetModel(mgaModel); 00148 } 00149 00150 00151 void CGMEChildFrame::ChangeAspect(int aspcet) 00152 { 00153 m_ChildFrame.ChangeAspect(aspcet); 00154 } 00155 00156 00157 void CGMEChildFrame::CycleAspect(void) 00158 { 00159 m_ChildFrame.CycleAspect(); 00160 } 00161 00162 00163 void CGMEChildFrame::Invalidate(void) 00164 { 00165 m_ChildFrame.Invalidate(); 00166 } 00167 00168 00169 void CGMEChildFrame::OnAspectChangedGmeViewCtrl(LONG index) 00170 { 00171 CMainFrame::theInstance->ChangePartBrowserAspect(index); 00172 } 00173 00174 00175 void CGMEChildFrame::OnWriteStatusZoomGmeViewCtrl(LONG zoomVal) 00176 { 00177 if (CMainFrame::theInstance != NULL) { 00178 CMainFrame::theInstance->WriteStatusZoom(zoomVal); 00179 } 00180 }