[GME-commit] GMESRC/GME/Gme GME.vcproj,1.1,1.2 GMEApp.h,1.26,1.27 GMEConsole.cpp,1.3,1.4 GMEConsole.h,1.3,1.4 GMEOLEApp.cpp,1.9,1.10 GMEOLEApp.h,1.5,1.6 GMEOLEError.h,1.1,1.2 GMEView.h,1.66,1.67 GmeLib.idl,1.9,1.10 MainFrm.cpp,1.28,1.29 MainFrm.h,1.22,1.23 console.cpp,1.3,1.4 console.h,1.3,1.4

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Fri Apr 15 19:24:12 CDT 2005


Update of /project/gme-repository/GMESRC/GME/Gme
In directory escher:/tmp/cvs-serv19080/Gme

Modified Files:
	GME.vcproj GMEApp.h GMEConsole.cpp GMEConsole.h GMEOLEApp.cpp 
	GMEOLEApp.h GMEOLEError.h GMEView.h GmeLib.idl MainFrm.cpp 
	MainFrm.h console.cpp console.h 
Log Message:
GME:
'gme' variable comes to live when gme starts.
'it' variable is available when there is opened model

Mga:
ObjectByPath method can search based on plain name sequences


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: GMEOLEApp.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GMEOLEApp.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** GMEOLEApp.h	12 Jan 2005 17:53:16 -0000	1.5
--- GMEOLEApp.h	15 Apr 2005 18:24:10 -0000	1.6
***************
*** 56,59 ****
--- 56,61 ----
  	afx_msg LPDISPATCH GetMgaProject();
  	afx_msg void SetMgaProject(LPDISPATCH newValue);
+ 	afx_msg LPDISPATCH GetOleIt();
+ 	afx_msg void SetOleIt(LPDISPATCH newValue);
  	afx_msg LPDISPATCH GetPanels();
  	afx_msg void SetPanels(LPDISPATCH newValue);
***************
*** 106,109 ****
--- 108,112 ----
  		STDMETHOD(put_ConsoleContents)(THIS_ BSTR contents);
  		STDMETHOD(get_ConsoleContents)(THIS_ BSTR* contents);
+ 		STDMETHOD(get_OleIt)( THIS_ IGMEOLEIt ** opened_mod);
  
  		STDMETHOD(CreateProject)(THIS_ BSTR metaname, BSTR connstr);

Index: GMEApp.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GMEApp.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** GMEApp.h	14 Sep 2004 14:02:17 -0000	1.26
--- GMEApp.h	15 Apr 2005 18:24:10 -0000	1.27
***************
*** 45,48 ****
--- 45,49 ----
  	CComPtr<IMgaProject> mgaProject;
  	CComPtr<IMgaClient> mgaClient;
+ 	CComPtr<IDispatch>  mOleApp;
  	CComPtr<IMgaMetaProject> mgaMetaProject;
  //  dynamic menus

Index: GMEView.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GMEView.h,v
retrieving revision 1.66
retrieving revision 1.67
diff -C2 -d -r1.66 -r1.67
*** GMEView.h	12 Jan 2005 18:03:33 -0000	1.66
--- GMEView.h	15 Apr 2005 18:24:10 -0000	1.67
***************
*** 25,28 ****
--- 25,29 ----
  {
  	friend class CGMEOLEModel;
+ 	friend class CGMEOLEIt;
  protected: // create from serialization only
  	CGMEView();

Index: MainFrm.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/MainFrm.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** MainFrm.cpp	26 Jan 2005 17:28:27 -0000	1.28
--- MainFrm.cpp	15 Apr 2005 18:24:10 -0000	1.29
***************
*** 101,107 ****
  }
  
  void CMainFrame::OnClose()
  {
! 	m_console.SetGMEApp(NULL); // ???? 
  	CFrameWnd::OnClose();
  }
--- 101,173 ----
  }
  
+ void CMainFrame::setGmeOleApp( CGMEOLEApp * the_ole_app)
+ {
+ 	mGmeOleApp = the_ole_app;
+ 
+ 	IDispatch *disp;							// REFCOUNT is initially 1 ( ONE )
+ 
+ 	disp = mGmeOleApp->GetIDispatch(FALSE);	// do not increment the refcount
+ 
+ 	ULONG ul;
+ 	ul = disp->AddRef();ul = disp->Release();
+ 
+ 	m_console.SetGMEApp(disp); // ???? // increments the refcount to 2 (since it stores the value in a smart pointer)
+ 
+ 	ul = disp->AddRef();ul = disp->Release();
+ 
+ 	// decrement the refcount, relying on the other components maintaining the correct refcounts
+ 	//this line is needed either in setGmeOleApp or here
+ 	ul = mGmeOleApp->GetIDispatch(FALSE)->Release();
+ 	//ul = mGmeOleApp->GetIDispatch(FALSE)->Release(); //decrement the refcount to 1
+ 
+ 	// later when a project is opened the "mGmeOleApp" will be registered as a client of the "MgaProject", thus
+ 	// it will be incremented once again the refcount
+ 	
+ 	// when the project is closed, then the CGMEApp::CloseProject will erase this reference to the "mGmeOleApp"  with a  "mgaClient = NULL;" call
+ 
+ 	// so the Mga component is referencing the GmeOleApp by its MgaProject's client member
+ 	//        Console compt is referencing the GmeOleApp by its member
+ 	//
+ 	// beware that when the main GME would like to destruct the Console upon exiting
+ 	// then the Console has to be the last referring to the GmeOleApp, so that it 
+ 	// can be 
+ }
+ 
+ void CMainFrame::setMgaProj()
+ {
+ 	IDispatch *disp;
+ 
+ 	disp = mGmeOleApp->GetIDispatch(FALSE);	// do not increment the refcount
+ 
+ 	ULONG ul;
+ 	ul = disp->AddRef();ul = disp->Release();
+ 
+ 	m_console.SetGMEProj(disp);
+ 
+ 	ul = disp->AddRef();ul = disp->Release();
+ 	//ul = mGmeOleApp->GetIDispatch(FALSE)->Release(); //decrement the refcount to 1
+ }
+ 
+ void CMainFrame::clearGmeOleApp()
+ {
+ 	m_console.SetGMEProj( 0 );
+ 	m_console.SetGMEApp( 0 );
+ 
+ 	//this line is needed either in setGmeOleApp or here
+ 	//mGmeOleApp->GetIDispatch(FALSE)->Release();
+ 
+ 	// make sure
+ 	mGmeOleApp = 0;
+ }
+ 
+ void CMainFrame::clearMgaProj()
+ {
+ 	m_console.SetGMEProj( 0 );
+ }
+ 
+ 
  void CMainFrame::OnClose()
  {
! 	clearGmeOleApp();
  	CFrameWnd::OnClose();
  }

Index: MainFrm.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/MainFrm.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** MainFrm.h	2 Dec 2004 22:01:36 -0000	1.22
--- MainFrm.h	15 Apr 2005 18:24:10 -0000	1.23
***************
*** 16,19 ****
--- 16,20 ----
  #include "GMESearch.h"
  #include "PanningWindow.h"
+ #include "GMEOLEApp.h"
  // #include "..\include\stl\string"
  //#include <string>
***************
*** 76,79 ****
--- 77,87 ----
  	int m_nTimePaneNo;
  	virtual ~CMainFrame();
+ 
+ 	void setGmeOleApp( CGMEOLEApp * the_ole_app);
+ 	void setMgaProj();
+ 	void clearGmeOleApp();
+ 	void clearMgaProj();
+ 	CGMEOLEApp *       mGmeOleApp;
+ 
  #ifdef _DEBUG
  	virtual void AssertValid() const;

Index: console.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/console.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** console.cpp	26 Jan 2005 17:28:28 -0000	1.3
--- console.cpp	15 Apr 2005 18:24:10 -0000	1.4
***************
*** 18,23 ****
  CConsole::~CConsole()
  {
! 	static BYTE parms[] = VTS_DISPATCH;
! 	InvokeHelper(5, DISPATCH_METHOD, VT_EMPTY, NULL, parms, NULL); 
  }
  
--- 18,24 ----
  CConsole::~CConsole()
  {
! // commented out by zolmol
! //	static BYTE parms[] = VTS_DISPATCH;
! //	InvokeHelper(5, DISPATCH_METHOD, VT_EMPTY, NULL, parms, NULL); 
  }
  
***************
*** 71,73 ****
--- 72,80 ----
  	static BYTE parms[] = VTS_DISPATCH;
  	InvokeHelper(5, DISPATCH_METHOD, VT_EMPTY, NULL, parms, idp);
+ }
+ 
+ void CConsole::SetGMEProj(IDispatch *idp)
+ {
+ 	static BYTE parms[] = VTS_DISPATCH;
+ 	InvokeHelper(6, DISPATCH_METHOD, VT_EMPTY, NULL, parms, idp);
  }

Index: GMEOLEError.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GMEOLEError.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** GMEOLEError.h	17 Dec 2003 13:45:02 -0000	1.1
--- GMEOLEError.h	15 Apr 2005 18:24:10 -0000	1.2
***************
*** 11,14 ****
--- 11,16 ----
  #define ID_ERROR_ASPECT_INVALID		(ID_ERROR_FIRST + 6)
  #define ID_ERROR_PANEL_INVALID		(ID_ERROR_FIRST + 7)
+ #define ID_ERROR_PTR_INVALID		(ID_ERROR_FIRST + 8)
+ #define ID_ERROR_NOT_FOUND			(ID_ERROR_FIRST + 9)
  
  #define PRECONDITION_ACTIVE_PROJECT \
***************
*** 54,57 ****
--- 56,80 ----
  	} 
  
+ #define PRECONDITION_VALID_PTR( x, y) \
+ 	if ( (!x)) { \
+ 		AfxThrowOleDispatchException(ID_ERROR_PTR_INVALID, \
+ 			_T(y)); \
+ 	} 
+ 
+ #define SHOW_ERROR( z) \
+ 	{ \
+ 		AfxThrowOleDispatchException(ID_ERROR_NOT_FOUND, \
+ 			_T(z)); \
+ 	} 
+ 
+ #define THROW_IF_NULL( x, y) \
+ 	if ( (!x)) { \
+ 		throw y; \
+ 	} 
+ 
+ #define THROW_IF_BOOL( x, y) \
+ 	if ( (x)) { \
+ 		throw y; \
+ 	} 
  
  #endif // !defined(_GMEOLEERROR_H_)

Index: GMEConsole.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GMEConsole.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** GMEConsole.cpp	26 Jan 2005 17:28:27 -0000	1.3
--- GMEConsole.cpp	15 Apr 2005 18:24:10 -0000	1.4
***************
*** 119,121 ****
--- 119,126 ----
  {
  	m_Console.SetGMEApp(idp);
+ }
+ 
+ void CGMEConsole::SetGMEProj(IDispatch *idp)
+ {
+ 	m_Console.SetGMEProj(idp);
  }

Index: console.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/console.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** console.h	26 Jan 2005 17:28:28 -0000	1.3
--- console.h	15 Apr 2005 18:24:10 -0000	1.4
***************
*** 52,55 ****
--- 52,56 ----
  	void AboutBox();
  	void SetGMEApp(IDispatch *idp);
+ 	void SetGMEProj(IDispatch *idp);
  };
  

Index: GMEConsole.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GMEConsole.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** GMEConsole.h	12 Jan 2005 17:53:16 -0000	1.3
--- GMEConsole.h	15 Apr 2005 18:24:10 -0000	1.4
***************
*** 26,29 ****
--- 26,30 ----
  	void SetContents(const CString& contents);
  	void SetGMEApp(IDispatch *idp);
+ 	void SetGMEProj(IDispatch *idp);
  	IDispatch * GetInterface() {return NULL;};
  

Index: GMEOLEApp.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GMEOLEApp.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** GMEOLEApp.cpp	12 Jan 2005 17:53:16 -0000	1.9
--- GMEOLEApp.cpp	15 Apr 2005 18:24:10 -0000	1.10
***************
*** 15,18 ****
--- 15,19 ----
  #include "GMEOLEModel.h"
  #include "GMEOLEPanel.h"
+ #include "GMEOLEIt.h"
  #include "GMEEventLogger.h"
  
***************
*** 75,78 ****
--- 76,80 ----
  	DISP_PROPERTY_EX(CGMEOLEApp, "Panels", GetPanels, SetPanels, VT_DISPATCH)
  	DISP_PROPERTY_EX(CGMEOLEApp, "ConsoleContents", GetConsoleContents, SetConsoleContents, VT_BSTR)
+ 	DISP_PROPERTY_EX(CGMEOLEApp, "OleIt", GetOleIt, SetOleIt, VT_DISPATCH)
  	DISP_FUNCTION(CGMEOLEApp, "CreateProject", CreateProject, VT_EMPTY, VTS_BSTR VTS_BSTR)
  	DISP_FUNCTION(CGMEOLEApp, "OpenProject", OpenProject, VT_EMPTY, VTS_BSTR)
***************
*** 544,547 ****
--- 546,568 ----
  }
  
+ LPDISPATCH CGMEOLEApp::GetOleIt() 
+ {
+ 	CGMEEventLogger::LogGMEEvent("CGMEOLEApp::GetOleIt()\r\n");
+ 
+ 	// PRECONDITIONS: None
+ 
+ 	CGMEOLEIt* opened = new CGMEOLEIt();
+ 	LPDISPATCH rr = opened->GetIDispatch( FALSE);
+ 
+ 	return rr;
+ }
+ 
+ void CGMEOLEApp::SetOleIt(LPDISPATCH) 
+ {
+ 	CGMEEventLogger::LogGMEEvent("CGMEOLEApp::SetOleIt()\r\n");
+ 
+ 	SetNotSupported();
+ }
+ 
  LPDISPATCH CGMEOLEApp::GetPanels() 
  {
***************
*** 740,743 ****
--- 761,777 ----
  		LPDISPATCH lpDisp = pThis->GetMgaProject();
  		lpDisp->QueryInterface(IID_IMgaProject, (LPVOID*)project);
+ 		return NOERROR;
+ 	}
+ 	CATCH_ALL_DUAL
+ }
+ 
+ STDMETHODIMP CGMEOLEApp::XDual::get_OleIt( IGMEOLEIt** model)
+ {
+ 	METHOD_PROLOGUE(CGMEOLEApp, Dual)
+ 
+ 	TRY_DUAL(IID_IGMEOLEApp)
+ 	{
+ 		LPDISPATCH lpDisp = pThis->GetOleIt();
+ 		lpDisp->QueryInterface(IID_IGMEOLEIt, (LPVOID*)model);
  		return NOERROR;
  	}

Index: GME.vcproj
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GME.vcproj,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** GME.vcproj	26 Jan 2005 17:28:27 -0000	1.1
--- GME.vcproj	15 Apr 2005 18:24:10 -0000	1.2
***************
*** 753,756 ****
--- 753,759 ----
  			</File>
  			<File
+ 				RelativePath=".\GMEOLEIt.cpp">
+ 			</File>
+ 			<File
  				RelativePath="GMEOLEModel.cpp">
  				<FileConfiguration
***************
*** 1616,1619 ****
--- 1619,1625 ----
  			<File
  				RelativePath="GMEOLEError.h">
+ 			</File>
+ 			<File
+ 				RelativePath=".\GMEOLEIt.h">
  			</File>
  			<File

Index: GmeLib.idl
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GmeLib.idl,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** GmeLib.idl	19 Aug 2004 09:31:25 -0000	1.9
--- GmeLib.idl	15 Apr 2005 18:24:10 -0000	1.10
***************
*** 30,33 ****
--- 30,42 ----
  	};
  
+ 	//  Class information for CGMEOLEIt
+ 
+ 	[ uuid(A19756E1-56AB-4ae5-974A-B3766E190697) ]
+ 	coclass It
+ 	{
+ 		[default] interface IGMEOLEIt;
+ 		interface ISupportErrorInfo;
+ 	};
+ 
  	//  Class information for CGMEOLEModel
  



More information about the GME-commit mailing list