[GME-commit] GMESRC/GME/Mga MgaFCO.h, 1.28, 1.29 MgaFCO.cpp, 1.38, 1.39 MgaFolder.h, 1.8, 1.9 MgaProject.cpp, 1.68, 1.69 MgaProject.h, 1.32, 1.33

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Wed Mar 7 16:04:34 CST 2007


Update of /project/gme-repository/GMESRC/GME/Mga
In directory escher:/tmp/cvs-serv23677

Modified Files:
	MgaFCO.h MgaFCO.cpp MgaFolder.h MgaProject.cpp MgaProject.h 
Log Message:
Some interfaces added.
Undosize inquired from MgaRegistrar on every MgaProject::Open, OpenEx, CreateEx.
Valif if is in (0, 100).


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: MgaFolder.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaFolder.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** MgaFolder.h	28 Nov 2005 22:09:15 -0000	1.8
--- MgaFolder.h	7 Mar 2007 22:04:32 -0000	1.9
***************
*** 67,70 ****
--- 67,75 ----
  	STDMETHOD(RefreshParent)(IMgaFolder *parent) { return inFCO->RefreshParent( parent); }
  
+ 	STDMETHOD(AttachLibraryV3)(BSTR libname, VARIANT_BOOL ungroup, IMgaFolder **nf) 
+ 												{ return inFCO->AttachLibraryV3(libname, ungroup, nf); }
+ 	STDMETHOD(RefreshLibraryV3)(BSTR libname, VARIANT_BOOL ungroup, long *numOfErrors) 
+ 												{ return inFCO->RefreshLibraryV3(libname, ungroup, numOfErrors); }
+ 
  	STDMETHOD(AttachLibrary)(BSTR libname, IMgaFolder **nf) 
  												{ return inFCO->AttachLibrary(libname, nf); }
***************
*** 75,78 ****
--- 80,88 ----
  	STDMETHOD(put_LibraryName)(BSTR libname) 
  												{ return inFCO->put_LibraryName(libname); }
+ 
+ 	STDMETHOD(GetVirtuallyIncludedBy)( IMgaFolders** pDep) { return inFCO->GetVirtuallyIncludedBy( pDep); }
+ 	STDMETHOD(SetVirtuallyIncludedBy)( IMgaFolders*  pDep) { return inFCO->SetVirtuallyIncludedBy( pDep); }
+ 	STDMETHOD(GetVirtuallyIncludes)  ( IMgaFolders** pDep) { return inFCO->GetVirtuallyIncludes  ( pDep); }
+ 	STDMETHOD(SetVirtuallyIncludes)  ( IMgaFolders*  pDep) { return inFCO->SetVirtuallyIncludes  ( pDep); }
  	STDMETHOD(get_ChildRelIDCounter)(long *pVal) { 
  		return inFCO->get_ChildRelIDCounter(pVal); }

Index: MgaFCO.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaFCO.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** MgaFCO.cpp	2 Feb 2007 21:00:18 -0000	1.38
--- MgaFCO.cpp	7 Mar 2007 22:04:32 -0000	1.39
***************
*** 1169,1172 ****
--- 1169,1173 ----
  HRESULT FCO::GetGuidDisp( BSTR *p_pGuidStr)
  {
+ 	// keep logic in sync with LibImgHelper::GetItsGuid() in MgaLibOps.cpp
  	COMTRY {
  		CheckRead();

Index: MgaFCO.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaFCO.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** MgaFCO.h	2 Feb 2007 21:00:18 -0000	1.28
--- MgaFCO.h	7 Mar 2007 22:04:32 -0000	1.29
***************
*** 535,542 ****
  
  	HRESULT ChangeObject(IMgaMetaRole *r, IMgaMetaFCO *kind);
! 	HRESULT AttachLibrary(BSTR libname, IMgaFolder **nf, long relid = 0);
  	HRESULT RefreshLibrary(BSTR libname);
  	HRESULT get_LibraryName(BSTR *libname);
  	HRESULT put_LibraryName(BSTR libname);
  	HRESULT get_ChildRelIDCounter(long *pVal);
  	HRESULT put_ChildRelIDCounter(long pVal);
--- 535,558 ----
  
  	HRESULT ChangeObject(IMgaMetaRole *r, IMgaMetaFCO *kind);
! 
! 	// Library
! 	HRESULT doAttach(  BSTR libname, VARIANT_BOOL ungroup, IMgaFolder **nf);
! 	HRESULT doRefresh( BSTR libname, VARIANT_BOOL ungroup, long *numOfErrors);
! 	HRESULT AttachLibraryV3(BSTR libname, VARIANT_BOOL ungrouped, IMgaFolder **nf);
! 	HRESULT RefreshLibraryV3(BSTR libname, VARIANT_BOOL ungrouped, long *numOfErrors);
! 
! 	HRESULT AttachLibrary(BSTR libname, IMgaFolder **nf);
  	HRESULT RefreshLibrary(BSTR libname);
  	HRESULT get_LibraryName(BSTR *libname);
  	HRESULT put_LibraryName(BSTR libname);
+ 
+ 	HRESULT GetVirtuallyIncludedBy( IMgaFolders** pDep);
+ 	HRESULT SetVirtuallyIncludedBy( IMgaFolders*  pDep);
+ 	HRESULT GetVirtuallyIncludes  ( IMgaFolders** pDep);
+ 	HRESULT SetVirtuallyIncludes  ( IMgaFolders*  pDep);
+ 
+ 	void prepareDepInfo2Coll( CComBSTR& pInfo, IMgaFolders** p_resultColl);
+ 	void prepareColl2DepInfo( IMgaFolders* pDep, CComBSTR& pResInfo);
+ 
  	HRESULT get_ChildRelIDCounter(long *pVal);
  	HRESULT put_ChildRelIDCounter(long pVal);

Index: MgaProject.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaProject.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** MgaProject.h	21 Jul 2006 19:11:40 -0000	1.32
--- MgaProject.h	7 Mar 2007 22:04:32 -0000	1.33
***************
*** 160,163 ****
--- 160,164 ----
  	STDMETHOD(RegisterClient)(BSTR name, IDispatch *OLEServer, IMgaClient **client);
  	STDMETHOD(GetClientByName)(BSTR name, IMgaClient **client);
+ 	STDMETHOD(GetTopLibraries)(BSTR name, IMgaFolders **res);
  	ICoreProject* dataproject;
  	void ObjMark(IMgaObject *s, long mask);
***************
*** 215,218 ****
--- 216,222 ----
  #endif
  	bool    alreadynested();
+ 
+ 	int getMaxUndoSize();
+ 
  public:
  	long preferences;

Index: MgaProject.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaProject.cpp,v
retrieving revision 1.68
retrieving revision 1.69
diff -C2 -d -r1.68 -r1.69
*** MgaProject.cpp	21 Jul 2006 19:11:40 -0000	1.68
--- MgaProject.cpp	7 Mar 2007 22:04:32 -0000	1.69
***************
*** 178,182 ****
  		if(paradigmGUID.vt != VT_EMPTY) connGUID = paradigmGUID;
  		COMTHROW(OpenParadigm(paradigmname, &connGUID));
! 		COMTHROW(dataproject->CreateProject(projectname, genericproject));
  		opened = UNCHANGED;
  		guidstat = DIRTY;
--- 178,184 ----
  		if(paradigmGUID.vt != VT_EMPTY) connGUID = paradigmGUID;
  		COMTHROW(OpenParadigm(paradigmname, &connGUID));
! 	
! 		int undosize = getMaxUndoSize();
! 		COMTHROW(dataproject->CreateProject2(projectname, undosize, genericproject));
  		opened = UNCHANGED;
  		guidstat = DIRTY;
***************
*** 249,253 ****
  		VARIANT_BOOL ro;
  
! 		COMTHROW(dataproject->OpenProject(projectname, genericproject, &ro));
  		
  		projconn = projectname;
--- 251,256 ----
  		VARIANT_BOOL ro;
  
! 		int undosize = getMaxUndoSize();
! 		COMTHROW(dataproject->OpenProject2(projectname, undosize, genericproject, &ro));
  		
  		projconn = projectname;
***************
*** 370,374 ****
  		CreateCoreMetaProject(genericproject, true); // will upgrade if old version
  
! 		COMTHROW(dataproject->OpenProject(projectname, genericproject, ro_mode));
  		
  		projconn = projectname;
--- 373,378 ----
  		CreateCoreMetaProject(genericproject, true); // will upgrade if old version
  
! 		int undosize = getMaxUndoSize();
! 		COMTHROW(dataproject->OpenProject2(projectname, undosize, genericproject, ro_mode));
  		
  		projconn = projectname;
***************
*** 1799,1802 ****
--- 1803,1866 ----
  }
  
+ int CMgaProject::getMaxUndoSize()
+ {
+ 	int retval = 10; // keep in sync with the default value in CoreProject.h
+ 	try
+ 	{
+ 		CComPtr<IMgaRegistrar> mgareg;
+ 		COMTHROW(mgareg.CoCreateInstance(OLESTR("MGA.MgaRegistrar")));
+ 		CComBSTR undo_size;
+ 		COMTHROW( mgareg->GetUndoQueueSize( REGACCESS_USER, &undo_size));
+ 		TCHAR p[3] = { 0, 0, 0}; // max = 99
+ 		unsigned int len = (undo_size)? undo_size.Length(): 0;
+ 		if( len != 0 && len <= sizeof( p) - 1)
+ 		{
+ 			CopyTo( undo_size, len, p, len); // strcpy
+ 			int val = _tstoi( p); // atoi
+ 			if( val > 0 && val < 100) // requirement is to be above 0 and below 100
+ 				retval = val;
+ 		}
+ 	}
+ 	catch( hresult_exception&)
+ 	{
+ 		retval = 10;
+ 	}
+ 
+ 	return retval;
+ }
+ 
+ STDMETHODIMP CMgaProject::GetTopLibraries(BSTR pDispGuid, IMgaFolders **pVal)
+ {
+ 	COMTRY {
+ 		CHECK_INSTRPAR( pDispGuid);
+ 		CREATECOLLECTION_FOR(IMgaFolder,q);
  
+ 		CComPtr<IMgaFolder> rootf;
+ 		COMTHROW( get_RootFolder( &rootf));
+ 		CoreObj crf( rootf);
+ 		CoreObjs children = crf[ATTRID_FPARENT+ATTRID_COLLECTION];
+ 		ITERATE_THROUGH(children) {
+ 			if( ITER.GetMetaID() != DTID_FOLDER) continue;
+ 			long perm = ITER[ATTRID_PERMISSIONS];
+ 			if( perm & LIBROOT_FLAG)
+ 			{
+ 				FCO *lib = ObjForCore( ITER);
+ 				if( lib) 
+ 				{
+ 					CComBSTR gd;
+ 					COMTHROW( lib->GetGuidDisp( &gd));
+ 
+ 					if( gd == pDispGuid)
+ 					{
+ 						CComPtr<IMgaFolder> fld;
+ 						lib->getinterface( &fld);
+ 						q->Add( fld);
+ 					}
+ 				}
+ 			}
+ 		}
+ 		*pVal = q.Detach();
+ 	}
+     COMCATCH(;);
+ }
  



More information about the GME-commit mailing list