GME  13
CurrentProject.cpp
Go to the documentation of this file.
00001 // CurrentProject.cpp: implementation of the CCurrentProject class.
00002 //
00004 
00005 #include "stdafx.h"
00006 #include "gmeactivebrowser.h"
00007 #include "GMEActiveBrowserCtl.h"
00008 #include "CurrentProject.h"
00009 
00010 #ifdef _DEBUG
00011 #undef THIS_FILE
00012 static char THIS_FILE[]=__FILE__;
00013 #define new DEBUG_NEW
00014 #endif
00015 
00017 // Construction/Destruction
00019 
00020 CCurrentProject::CCurrentProject():m_ProjectState(CURRENT_PROJECT_CLOSED)
00021 {
00022         
00023 }
00024 
00025 CCurrentProject::~CCurrentProject()
00026 {
00027 
00028 }
00029 
00030 short CCurrentProject::CreateCurrentProject(LPUNKNOWN pMgaProject)
00031 {
00032         ASSERT(m_ProjectState==CURRENT_PROJECT_CLOSED);
00033 
00034         
00035         CGMEActiveBrowserApp* pApp;
00036         pApp=(CGMEActiveBrowserApp*)AfxGetApp();
00037 
00038         CGMEActiveBrowserCtrl* pCtrl=pApp->GetCtrl();
00039                 
00040         m_MgaContext.CreateContext(pCtrl->m_xEventSink,pMgaProject);
00041         m_ProjectState=CURRENT_PROJECT_OPEN;
00042         
00043 
00044         // Notifying the views
00045         pCtrl->m_pPropFrame->OnOpenProject();
00046 
00047 
00048         return 0;
00049 }
00050 
00051 void CCurrentProject::CloseCurrentProject()
00052 {
00053 
00054         if(m_ProjectState==CURRENT_PROJECT_CLOSED) return;
00055         
00056         // Cleaning up UI               
00057         CGMEActiveBrowserApp* pApp;
00058         pApp=(CGMEActiveBrowserApp*)AfxGetApp();
00059         CGMEActiveBrowserCtrl* pCtrl=pApp->GetCtrl();
00060         pCtrl->m_pPropFrame->OnCloseProject();
00061 
00062         m_MgaContext.CloseContext();
00063 
00064 
00065         m_ProjectState=CURRENT_PROJECT_CLOSED;
00066 }
00067 
00068 
00069 eCurrentProjectState CCurrentProject::GetCurrentProjectState()
00070 {
00071         return m_ProjectState;
00072 }