GME
13
|
00001 // GMEObjectInspector.cpp: implementation of the CGMEObjectInspector class. 00002 // 00004 00005 #include "stdafx.h" 00006 #include "GMEApp.h" 00007 #include "GMEstd.h" 00008 #include "mainfrm.h" 00009 #include "GMEDoc.h" 00010 #include "GMEView.h" 00011 #include "GMEObjectInspector.h" 00012 #include "guimeta.h" 00013 00014 CGMEObjectInspector* CGMEObjectInspector::theInstance = 0; 00016 // Construction/Destruction 00018 00019 CGMEObjectInspector::CGMEObjectInspector() 00020 { 00021 //{{AFX_DATA_INIT(CGMEObjectInspector) 00022 //}}AFX_DATA_INIT 00023 00024 VERIFY(theInstance == 0); 00025 theInstance = this; 00026 } 00027 00028 00029 void CGMEObjectInspector::DoDataExchange(CDataExchange* pDX) 00030 { 00031 //{{AFX_DATA_MAP(CGMEObjectInspector) 00032 DDX_Control(pDX, IDC_OBJECT_INSPECTOR_CTRL, m_ObjectInspector); 00033 //}}AFX_DATA_MAP 00034 } 00035 00036 00037 00038 BEGIN_MESSAGE_MAP(CGMEObjectInspector, CDockablePane) 00039 //{{AFX_MSG_MAP(CGMEObjectInspector) 00040 ON_WM_CREATE() 00041 ON_WM_SIZE() 00042 //}}AFX_MSG_MAP 00043 END_MESSAGE_MAP() 00044 00045 BEGIN_EVENTSINK_MAP(CGMEObjectInspector, CDockablePane) 00046 //{{AFX_EVENTSINK_MAP(CGMEBrowser) 00047 ON_EVENT(CGMEObjectInspector, IDC_OBJECT_INSPECTOR_CTRL, 1 /* RootFolderNameChanged */, OnRootFolderNameChangedGmeObjectInspectorCtrl, VTS_NONE) 00048 ON_EVENT(CGMEObjectInspector, IDC_OBJECT_INSPECTOR_CTRL, 2 /* ConvertPathToCustom */, OnConvertPathToCustomGmeObjectInspectorCtrl, VTS_UNKNOWN) 00049 //}}AFX_EVENTSINK_MAP 00050 END_EVENTSINK_MAP() 00051 00052 int CGMEObjectInspector::OnCreate(LPCREATESTRUCT lpCreateStruct) 00053 { 00054 if (CDockablePane::OnCreate(lpCreateStruct) == -1) 00055 return -1; 00056 00057 if(!m_ObjectInspector.Create(_T("ObjectInspector"),WS_CHILD | WS_VISIBLE,CRect(0,0,230,300),this,IDC_OBJECT_INSPECTOR_CTRL)) 00058 return -1; 00059 00060 return 0; 00061 } 00062 00063 void CGMEObjectInspector::OnSize(UINT nType, int cx, int cy) 00064 { 00065 CDockablePane::OnSize(nType, cx, cy); 00066 00067 CRect rc; 00068 GetClientRect(rc); 00069 m_ObjectInspector.MoveWindow(rc); 00070 00071 } 00072 00073 00074 void CGMEObjectInspector::SetProject(CComPtr<IMgaProject>& mgaProject) 00075 { 00076 m_ObjectInspector.SetMgaProject(mgaProject); 00077 } 00078 00079 00080 void CGMEObjectInspector::CloseProject() 00081 { 00082 m_ObjectInspector.SetMgaProject(NULL); 00083 } 00084 00085 00086 void CGMEObjectInspector::SetObjects(LPUNKNOWN pUnknown) 00087 { 00088 m_ObjectInspector.SetMgaObject(pUnknown); 00089 } 00090 00091 LPUNKNOWN CGMEObjectInspector::GetObjects() 00092 { 00093 return m_ObjectInspector.GetMgaObject(); 00094 } 00095 00096 /* 00097 ActiveX controls do not have their message pump, it is owned by their containers. 00098 The container in case of GME is a kind of control bar, which is treated as a dialog. 00099 Dialog box messages are filtered by ::IsDialogMessage, which does not allow the 00100 default dialog kestroke messages (ESC - close dialog, ENTER - push default button 00101 TAB - next item in the tab order etc...) to be propagated to the controls placed on 00102 the dialog. 00103 00104 Here we avoid calling the default PreTranslateMessage which filtered by 00105 ::IsDialogMessage, dispatch it directly to the controls. 00106 00107 Tihamer 00108 00109 */ 00110 00111 BOOL CGMEObjectInspector::PreTranslateMessage(MSG* pMsg) 00112 { 00113 if( pMsg->message == WM_KEYDOWN ) 00114 { 00115 switch(pMsg->wParam) 00116 { 00117 case VK_RETURN: 00118 case VK_ESCAPE: 00119 case VK_DELETE: 00120 // Modification by Volgyesi (undo problems) 00121 case VK_CONTROL: 00122 case 'z': 00123 case 'Z': 00124 // Modification End 00125 case VK_TAB: // for JIRA GME-178 00126 ::TranslateMessage(pMsg); 00127 ::DispatchMessage(pMsg); 00128 return TRUE; 00129 } 00130 } 00131 00132 return CDockablePane::PreTranslateMessage(pMsg); 00133 } 00134 00135 00136 void CGMEObjectInspector::ShowPanel(long panelID) 00137 { 00138 CMainFrame::theInstance->ShowObjectInspector(); 00139 m_ObjectInspector.ShowPanel(panelID); 00140 } 00141 00142 void CGMEObjectInspector::CyclePanel( VARIANT_BOOL frwd) 00143 { 00144 CMainFrame::theInstance->ShowObjectInspector(); 00145 m_ObjectInspector.CyclePanel( frwd); 00146 } 00147 00148 void CGMEObjectInspector::OnRootFolderNameChangedGmeObjectInspectorCtrl() 00149 { 00150 theApp.UpdateProjectName(); 00151 } 00152 00153 void CGMEObjectInspector::OnConvertPathToCustomGmeObjectInspectorCtrl(LPUNKNOWN pMgaObject) 00154 { 00155 CComPtr<IUnknown> sunk(pMgaObject); 00156 CGMEDoc::theInstance->ConvertPathToCustom(sunk); 00157 }