[GME-commit] GMESRC/SDK/BON BONImpl.cpp, 1.37, 1.38 BONImpl.h, 1.23, 1.24

Log messages of CVS commits gme-commit at list.isis.vanderbilt.edu
Thu Oct 18 14:00:59 CDT 2007


Update of /project/gme-repository/GMESRC/SDK/BON
In directory escher:/tmp/cvs-serv5048

Modified Files:
	BONImpl.cpp BONImpl.h 
Log Message:
Method for finding out which objects are selected in the activebrowser.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: BONImpl.h
===================================================================
RCS file: /project/gme-repository/GMESRC/SDK/BON/BONImpl.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** BONImpl.h	9 Nov 2006 17:24:46 -0000	1.23
--- BONImpl.h	18 Oct 2007 19:00:56 -0000	1.24
***************
*** 79,84 ****
--- 79,87 ----
  	typedef Util::ComPtr<IMgaConnPoint>	ConnPointPtr;
  	typedef Util::ComPtr<IMgaFCOs> 		FCOsPtr;
+ 	typedef Util::ComPtr<IMgaObjects>       ObjsPtr;
  
  	typedef Util::ComPtr<IGMEOLEApp> 		GMEAppPtr;
+ 	typedef Util::ComPtr<IGMEOLEColl>               GMECollPtr;
+ 	typedef Util::ComPtr<IGMEOLEPanel>              GMEPanelPtr;
  
  	typedef std::set<ObjectImpl*>				ObjectSet;
***************
*** 186,189 ****
--- 189,199 ----
  			int						getGMEVersionMinor();
  			int						getGMEVersionPatchLevel();
+ 
+ 			// this can't be called from the middle of a transaction
+ 			// so commit before & begin after as follows:
+ 			//  project->commitOnly();
+ 			//  ObjsPtr os = project->getSelectedObjsFromBrowser();
+ 			//  project->beginOnly();
+ 			ObjsPtr					getSelectedObjsFromBrowser();
  
  			void					saveProject();

Index: BONImpl.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/SDK/BON/BONImpl.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** BONImpl.cpp	9 Nov 2006 17:24:46 -0000	1.37
--- BONImpl.cpp	18 Oct 2007 19:00:56 -0000	1.38
***************
*** 959,962 ****
--- 959,1010 ----
  		return m_gme;
  	}
+ 	
+ 	// Call this method outside of transactions !!!
+ 	// Because bon2component's invokeEx is already executed inside a transaction
+ 	// you should first commit, use this method, then to begin a new transaction.
+ 	// E.g.:
+ 	//  project->commitOnly();
+ 	//  ObjsPtr os = project->getSelectedObjsFromBrowser();
+ 	//  project->beginOnly();
+ 	ObjsPtr ProjectImpl::getSelectedObjsFromBrowser() 
+ 	{
+ 		GMEAppPtr g = getGME();
+ 		GMECollPtr coll;
+ 		if( g) COMTHROW( g->get_Panels( coll.Addr()));
+ 		long cnt;
+ 		if( coll) COMTHROW( coll->get_Count( &cnt));
+ 		if( cnt > 0)
+ 		{
+ 			CComQIPtr<IDispatch> pDispatch;
+ 			// the ActiveBrowser is the first panel:
+ 			COMTHROW( coll->get_Item( 1, &pDispatch)); 
+ 			if( pDispatch)
+ 			{
+ 				GMEPanelPtr panel;
+ 				COMTHROW( pDispatch.QueryInterface( panel.Addr()));
+ 				CComBSTR nm;
+ 				COMTHROW( panel->get_Name( &nm));
+ 				ASSERT( nm == CComBSTR("Browser"));
+ 				CComQIPtr<IDispatch> pi;
+ 				COMTHROW( panel->get_Interface( &pi));
+ 				CComDispatchDriver dd;
+ 				dd = pi;
+ 				CComVariant w;
+ 
+ 				// this method call must be invoked outside of transactions
+ 				// becaue it will begin & commit one
+ 				HRESULT hw = dd.Invoke0( 4, &w); // invokes [id(4)] IUnknown* GetSelectedMgaObjects();
+ 				                                 // see GMEActiveBrowser.odl in GME/GMEActiveBrowser/ [source code tree]
+ 				
+ 				if( hw == S_OK && w.vt == VT_UNKNOWN && w.punkVal != 0)
+ 				{
+ 					CComQIPtr<IMgaObjects> objs( w.punkVal);
+ 					return objs;
+ 				}
+ 			}
+ 		}
+ 	
+ 		return ObjsPtr();
+ 	}
  
  	bool ProjectImpl::isGMEAvailable() const



More information about the GME-commit mailing list