GME
13
|
00001 // ParadigmPropertiesDlg.cpp : implementation file 00002 // 00003 00004 #include "stdafx.h" 00005 #include "gme.h" 00006 #include "GMEApp.h" 00007 #include "GMEstd.h" 00008 #include "ParadigmPropertiesDlg.h" 00009 00010 #ifdef _DEBUG 00011 #define new DEBUG_NEW 00012 #undef THIS_FILE 00013 static char THIS_FILE[] = __FILE__; 00014 #endif 00015 00017 // CParadigmPropertiesDlg dialog 00018 00019 00020 CParadigmPropertiesDlg::CParadigmPropertiesDlg(CWnd* pParent /*=NULL*/) 00021 : CDialog(CParadigmPropertiesDlg::IDD, pParent) 00022 { 00023 //{{AFX_DATA_INIT(CParadigmPropertiesDlg) 00024 //}}AFX_DATA_INIT 00025 } 00026 00027 00028 void CParadigmPropertiesDlg::DoDataExchange(CDataExchange* pDX) 00029 { 00030 CDialog::DoDataExchange(pDX); 00031 //{{AFX_DATA_MAP(CParadigmPropertiesDlg) 00032 DDX_Control(pDX, IDC_PARADIGM_VERSION, version); 00033 DDX_Control(pDX, IDC_PARADIGM_NAME, name); 00034 DDX_Control(pDX, IDC_PARADIGM_GUID, guid); 00035 DDX_Control(pDX, IDC_PARADIGM_MODIFIED, modified); 00036 DDX_Control(pDX, IDC_PARADIGM_CREATED, created); 00037 DDX_Control(pDX, IDC_PARADIGM_COMMENT, comment); 00038 DDX_Control(pDX, IDC_PARADIGM_AUTHOR, author); 00039 //}}AFX_DATA_MAP 00040 } 00041 00042 00043 BEGIN_MESSAGE_MAP(CParadigmPropertiesDlg, CDialog) 00044 //{{AFX_MSG_MAP(CParadigmPropertiesDlg) 00045 //}}AFX_MSG_MAP 00046 END_MESSAGE_MAP() 00047 00049 // CParadigmPropertiesDlg message handlers 00050 00051 BOOL CParadigmPropertiesDlg::OnInitDialog() 00052 { 00053 CDialog::OnInitDialog(); 00054 00055 CComObjPtr<IMgaTerritory> terry; 00056 COMTHROW( theApp.mgaProject->CreateTerritory(NULL, PutOut(terry), NULL) ); 00057 try { 00058 theApp.mgaProject->BeginTransaction(terry,TRANSACTION_READ_ONLY); 00059 CComPtr<IMgaMetaProject> metaProject; 00060 COMTHROW(theApp.mgaProject->get_RootMeta(&metaProject)); 00061 00062 { 00063 CComBSTR bstr; 00064 COMTHROW(metaProject->get_Name(&bstr)); 00065 CString str; 00066 CopyTo(bstr,str); 00067 name.SetWindowText(str); 00068 } 00069 { 00070 CComBSTR bstr; 00071 COMTHROW(metaProject->get_Author(&bstr)); 00072 CString str; 00073 CopyTo(bstr,str); 00074 author.SetWindowText(str); 00075 } 00076 { 00077 CComBSTR bstr; 00078 COMTHROW(metaProject->get_Version(&bstr)); 00079 CString str; 00080 CopyTo(bstr,str); 00081 version.SetWindowText(str); 00082 } 00083 { 00084 CComBSTR bstr; 00085 COMTHROW(metaProject->get_CreatedAt(&bstr)); 00086 CString str; 00087 CopyTo(bstr,str); 00088 created.SetWindowText(str); 00089 } 00090 { 00091 CComBSTR bstr; 00092 COMTHROW(metaProject->get_ModifiedAt(&bstr)); 00093 CString str; 00094 CopyTo(bstr,str); 00095 modified.SetWindowText(str); 00096 } 00097 { 00098 CComBSTR bstr; 00099 COMTHROW(metaProject->get_Comment(&bstr)); 00100 CString str; 00101 CopyTo(bstr,str); 00102 comment.SetWindowText(str); 00103 } 00104 { 00105 CComVariant vguid; 00106 COMTHROW(metaProject->get_GUID(&vguid)); 00107 GUID guid1; 00108 CopyTo(vguid, guid1); 00109 CComBstrObj bstro; 00110 CopyTo(guid1, bstro); 00111 CString str; 00112 CopyTo(bstro, str); 00113 00114 guid.SetWindowText(str); 00115 } 00116 00117 theApp.mgaProject->CommitTransaction(); 00118 } 00119 catch(hresult_exception e) { 00120 theApp.mgaProject->AbortTransaction(); 00121 AfxMessageBox(_T("Error reading paradigm properties")); 00122 } 00123 00124 return TRUE; // return TRUE unless you set the focus to a control 00125 // EXCEPTION: OCX Property Pages should return FALSE 00126 } 00127 00128 BOOL CParadigmPropertiesDlg::PreTranslateMessage(MSG* pMsg) 00129 { 00130 if (pMsg->message == WM_KEYDOWN) 00131 { 00132 switch (pMsg->wParam) 00133 { 00134 case 'A': 00135 { 00136 if (GetKeyState(VK_CONTROL) & 0x8000) 00137 { 00138 CWnd* focus = GetFocus(); 00139 if (focus && focus->IsKindOf(RUNTIME_CLASS(CEdit))) 00140 { 00141 ((CEdit*)GetFocus())->SetSel(0, 1000); 00142 return TRUE; 00143 } 00144 } 00145 } 00146 break; 00147 } 00148 } 00149 return __super::PreTranslateMessage(pMsg); 00150 }