[GME-commit] GMESRC/GME/GMEActiveBrowser ActiveBrowserPropertyPage.cpp, 1.64, 1.65 ActiveBrowserPropertyPage.h, 1.21, 1.22 AggregateContextMenu.cpp, 1.31, 1.32 AggregateContextMenu.h, 1.11, 1.12 GMEActiveBrowser.vcproj, 1.2, 1.3 resource.h, 1.15, 1.16

Log messages of CVS commits gme-commit at list.isis.vanderbilt.edu
Mon Feb 4 15:56:18 CST 2008


Update of /project/gme-repository/GMESRC/GME/GMEActiveBrowser
In directory escher:/tmp/cvs-serv22120

Modified Files:
	ActiveBrowserPropertyPage.cpp ActiveBrowserPropertyPage.h 
	AggregateContextMenu.cpp AggregateContextMenu.h 
	GMEActiveBrowser.vcproj resource.h 
Log Message:
-Exception handling for Multiuser related info methods.

-FollowReference functionality for references which have their targets in Folders (Follow Reference popup menu item).

-new GotoIUnkPtr( IMgaObject * p_obj) method for selecting the target object in the tree

- at AfxImpl.h not found" compilation problem resolved, by modifing project properties to include "$(VCInstallDir)\atlmfc\src\mfc" instead of "\\Microsoft Visual Studio\VC98\MFC\SRC\".





CVS User: Zoltan Molnar, ISIS (zolmol)

Index: AggregateContextMenu.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/GMEActiveBrowser/AggregateContextMenu.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** AggregateContextMenu.cpp	26 Sep 2007 20:15:53 -0000	1.31
--- AggregateContextMenu.cpp	4 Feb 2008 21:56:16 -0000	1.32
***************
*** 118,121 ****
--- 118,122 ----
  			case ID_POPUP_HELP:			OnHelp();break;
  			case ID_POPUP_SHOWINPARENT: OnShowInParent();break;
+ 			case ID_POPUP_FOLLOWREF:    OnFollowRef();break;
  			case ID_POPUP_READONLY:     OnReadOnly( true);break;
  			case ID_POPUP_READWRITE:    OnReadOnly( false);break;
***************
*** 753,756 ****
--- 754,761 ----
  				}break;
  
+ 			case OBJTYPE_REFERENCE:
+ 				{
+ 					InsertMenu( ID_POPUP_REFRESH_LIBRARY, MF_BYCOMMAND, ID_POPUP_FOLLOWREF, "&Follow Reference");
+ 				}// no break here!
  			default:
  				{
***************
*** 1174,1186 ****
  		CComQIPtr<IMgaFolder> ccpMgaFolder( pUnknown);
  		CComQIPtr<IMgaModel>  ccpMgaModel(  pUnknown);
  
  		MSGTRY 
  		{
  			// Starting transaction
- 			CGMEActiveBrowserApp* pApp=(CGMEActiveBrowserApp*)AfxGetApp();
- 			CMgaContext* pMgaContext=&pApp->m_CurrentProject.m_MgaContext;
  			pMgaContext->BeginTransaction( TRUE); // it is readonly
  
- 			CComBSTR id;
  			if( ccpMgaModel)
  				COMTHROW( ccpMgaModel->get_ID( &id));
--- 1179,1193 ----
  		CComQIPtr<IMgaFolder> ccpMgaFolder( pUnknown);
  		CComQIPtr<IMgaModel>  ccpMgaModel(  pUnknown);
+ 		CComBSTR              id;
+ 
+ 		// preparing for a transaction
+ 		CGMEActiveBrowserApp* pApp=(CGMEActiveBrowserApp*)AfxGetApp();
+ 		CMgaContext* pMgaContext=&pApp->m_CurrentProject.m_MgaContext;
  
  		MSGTRY 
  		{
  			// Starting transaction
  			pMgaContext->BeginTransaction( TRUE); // it is readonly
  
  			if( ccpMgaModel)
  				COMTHROW( ccpMgaModel->get_ID( &id));
***************
*** 1191,1197 ****
  			pMgaContext->CommitTransaction();
  
  			// it will open and commit its own transaction
  			m_pParent->ProjectSourceControlUpdate( id);
! 		} 
  		MSGCATCH("Error while updating source control info!",;)
  
--- 1198,1209 ----
  			pMgaContext->CommitTransaction();
  
+ 		} 
+ 		MSGCATCH("Error while updating source control info!",pMgaContext->AbortTransaction();)
+ 
+ 		MSGTRY 
+ 		{
  			// it will open and commit its own transaction
  			m_pParent->ProjectSourceControlUpdate( id);
! 		}
  		MSGCATCH("Error while updating source control info!",;)
  
***************
*** 1220,1232 ****
  		CComQIPtr<IMgaFolder> ccpMgaFolder( pUnknown);
  		CComQIPtr<IMgaModel>  ccpMgaModel(  pUnknown);
  
  		MSGTRY 
  		{
  			// Starting transaction
- 			CGMEActiveBrowserApp* pApp=(CGMEActiveBrowserApp*)AfxGetApp();
- 			CMgaContext* pMgaContext=&pApp->m_CurrentProject.m_MgaContext;
  			pMgaContext->BeginTransaction( TRUE); // it is readonly
  
- 			CComBSTR id;
  			if( ccpMgaModel)
  				COMTHROW( ccpMgaModel->get_ID( &id));
--- 1232,1247 ----
  		CComQIPtr<IMgaFolder> ccpMgaFolder( pUnknown);
  		CComQIPtr<IMgaModel>  ccpMgaModel(  pUnknown);
+ 		CComBSTR              id;
+ 
+ 		// preparing for a transaction
+ 		CGMEActiveBrowserApp* pApp=(CGMEActiveBrowserApp*)AfxGetApp();
+ 		CMgaContext* pMgaContext=&pApp->m_CurrentProject.m_MgaContext;
+ 
  
  		MSGTRY 
  		{
  			// Starting transaction
  			pMgaContext->BeginTransaction( TRUE); // it is readonly
  
  			if( ccpMgaModel)
  				COMTHROW( ccpMgaModel->get_ID( &id));
***************
*** 1236,1245 ****
  			// Ending transaction
  			pMgaContext->CommitTransaction();
! 			
  			// it will open and commit its own transaction
  			m_pParent->SourceControlObjectOwner( id);
! 		} 
  		MSGCATCH("Error while updating source control info!",;)
  
  		//if( ccpMgaModel || ccpMgaFolder)
  		//	m_pParent->Refresh();
--- 1251,1265 ----
  			// Ending transaction
  			pMgaContext->CommitTransaction();
! 		} 
! 		MSGCATCH("Error while updating source control info!",pMgaContext->AbortTransaction();)
! 
! 		MSGTRY
! 		{
  			// it will open and commit its own transaction
  			m_pParent->SourceControlObjectOwner( id);
! 		}
  		MSGCATCH("Error while updating source control info!",;)
  
+ 
  		//if( ccpMgaModel || ccpMgaFolder)
  		//	m_pParent->Refresh();
***************
*** 1260,1263 ****
--- 1280,1327 ----
  		CGMEActiveBrowserApp* pApp=(CGMEActiveBrowserApp*)AfxGetApp();
  		pApp->GetCtrl()->FireShowInParentMgaObject( pUnknown);
+ 	}
+ }
+ 
+ void CAggregateContextMenu::OnFollowRef()
+ {
+ 	//// Firing the event
+ 	//CGMEActiveBrowserApp* pApp=(CGMEActiveBrowserApp*)AfxGetApp();
+ 	//pApp->GetCtrl()->FireShowInParentMgaObject( pUnknown);
+ 
+ 	HTREEITEM hItem    = m_pParent->m_TreeAggregate.GetSelectedItem();
+ 	LPUNKNOWN pUnknown = NULL;
+ 
+ 	if( m_pParent->m_TreeAggregate.m_MgaMap.LookupObjectUnknown( hItem, pUnknown))
+ 	{
+ 		CComQIPtr<IMgaReference>  ccpMgaRef( pUnknown);
+ 		CComPtr<IMgaFCO>          ccpTgt;
+ 
+ 		// preparing for a transaction
+ 		CGMEActiveBrowserApp* pApp = (CGMEActiveBrowserApp*) AfxGetApp();
+ 		CMgaContext* pMgaContext   = &pApp->m_CurrentProject.m_MgaContext;
+ 
+ 		MSGTRY 
+ 		{
+ 			// Starting transaction
+ 			pMgaContext->BeginTransaction( TRUE); // it is readonly
+ 
+ 
+ 			if( ccpMgaRef)
+ 			{
+ 				COMTHROW( ccpMgaRef->get_Referred( &ccpTgt));
+ 			}
+ 			
+ 			
+ 			// Ending transaction
+ 			pMgaContext->CommitTransaction();
+ 		} 
+ 		MSGCATCH( "Error while following reference!", pMgaContext->AbortTransaction();)
+ 
+ 		MSGTRY			
+ 		{
+ 			if( !ccpTgt) AfxMessageBox( "Null reference can't be followed!");
+ 			else         m_pParent->GotoIUnkPtr( ccpTgt);
+ 		} 
+ 		MSGCATCH( "Error while following reference!", ;)
  	}
  }

Index: GMEActiveBrowser.vcproj
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/GMEActiveBrowser/GMEActiveBrowser.vcproj,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** GMEActiveBrowser.vcproj	16 Jan 2007 17:48:06 -0000	1.2
--- GMEActiveBrowser.vcproj	4 Feb 2008 21:56:16 -0000	1.3
***************
*** 4,7 ****
--- 4,8 ----
  	Version="7.10"
  	Name="GMEActiveBrowser"
+ 	RootNamespace="GMEActiveBrowser"
  	SccProjectName=""
  	SccLocalPath=""
***************
*** 25,29 ****
  				Optimization="2"
  				InlineFunctionExpansion="1"
! 				AdditionalIncludeDirectories="C:\Program Files\Microsoft Visual Studio\VC98\MFC\SRC\,..\Common,..\include\STLport,..\Interfaces"
  				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
  				StringPooling="TRUE"
--- 26,30 ----
  				Optimization="2"
  				InlineFunctionExpansion="1"
! 				AdditionalIncludeDirectories="..\Common;..\include\STLport;..\Interfaces;&quot;$(VCInstallDir)\atlmfc\src\mfc&quot;"
  				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
  				StringPooling="TRUE"
***************
*** 101,105 ****
  				Name="VCCLCompilerTool"
  				Optimization="0"
! 				AdditionalIncludeDirectories="C:\Program Files\Microsoft Visual Studio\VC98\MFC\SRC\,..\Common,..\include\STLport,..\Interfaces"
  				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
  				BasicRuntimeChecks="3"
--- 102,106 ----
  				Name="VCCLCompilerTool"
  				Optimization="0"
! 				AdditionalIncludeDirectories="..\Common;..\include\STLport;..\Interfaces;&quot;$(VCInstallDir)\atlmfc\src\mfc&quot;"
  				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
  				BasicRuntimeChecks="3"

Index: AggregateContextMenu.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/GMEActiveBrowser/AggregateContextMenu.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** AggregateContextMenu.h	26 Sep 2007 20:15:53 -0000	1.11
--- AggregateContextMenu.h	4 Feb 2008 21:56:16 -0000	1.12
***************
*** 45,48 ****
--- 45,49 ----
  	void OnHelp();
  	void OnShowInParent();
+ 	void OnFollowRef();
  	void OnRegistry();
  	void OnPreferences();

Index: ActiveBrowserPropertyPage.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** ActiveBrowserPropertyPage.h	26 Sep 2007 20:15:53 -0000	1.21
--- ActiveBrowserPropertyPage.h	4 Feb 2008 21:56:16 -0000	1.22
***************
*** 54,57 ****
--- 54,58 ----
  
  	void GotoIUnk(BSTR Id);
+ 	void GotoIUnkPtr( IMgaObject * p_obj);
  	void Refresh();
  	void OnMgaEvent(CComPtr<IMgaObject> ccpMgaObject, unsigned long lEventMask);

Index: resource.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/GMEActiveBrowser/resource.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** resource.h	26 Sep 2007 20:15:53 -0000	1.15
--- resource.h	4 Feb 2008 21:56:16 -0000	1.16
***************
*** 86,89 ****
--- 86,90 ----
  #define ID_USERS_OWNER                  32810
  #define ID_USERS_ACTIVE                 32811
+ #define ID_POPUP_FOLLOWREF              32812
  
  // Next default values for new objects
***************
*** 92,96 ****
  #ifndef APSTUDIO_READONLY_SYMBOLS
  #define _APS_NEXT_RESOURCE_VALUE        220
! #define _APS_NEXT_COMMAND_VALUE         32812
  #define _APS_NEXT_CONTROL_VALUE         221
  #define _APS_NEXT_SYMED_VALUE           104
--- 93,97 ----
  #ifndef APSTUDIO_READONLY_SYMBOLS
  #define _APS_NEXT_RESOURCE_VALUE        220
! #define _APS_NEXT_COMMAND_VALUE         32813
  #define _APS_NEXT_CONTROL_VALUE         221
  #define _APS_NEXT_SYMED_VALUE           104

Index: ActiveBrowserPropertyPage.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -C2 -d -r1.64 -r1.65
*** ActiveBrowserPropertyPage.cpp	26 Sep 2007 20:15:53 -0000	1.64
--- ActiveBrowserPropertyPage.cpp	4 Feb 2008 21:56:15 -0000	1.65
***************
*** 2338,2341 ****
--- 2338,2459 ----
  }
  
+ void CAggregatePropertyPage::GotoIUnkPtr( IMgaObject * p_obj)
+ {
+ 	if( !p_obj) return;
+ 
+ 	bool worked = false;
+ 	IUnknown *pUnknown = NULL;
+ 
+ 	CGMEActiveBrowserApp* pApp = (CGMEActiveBrowserApp*)AfxGetApp();
+ 	CMgaContext* pMgaContext = &pApp->m_CurrentProject.m_MgaContext;
+ 
+ 	MSGTRY
+ 	{
+ 		// Starting transaction
+ 		pMgaContext->BeginTransaction();
+ 		HTREEITEM hNewItem;
+ 
+ 		CComPtr<IMgaObject>  obj        ( p_obj);
+ 		COMTHROW( p_obj->QueryInterface( &pUnknown));
+ 
+ 		if( !obj) 
+ 			throw hresult_exception( E_INVALIDARG);
+ 
+ 		//if(m_TreeAggregate.m_MgaMap.SearchTreeItem(Id,hNewItem, pUnknown))
+ 		if( m_TreeAggregate.m_MgaMap.LookupTreeItem( pUnknown, hNewItem))
+ 		{
+ 						m_TreeAggregate.EnsureVisible(hNewItem);
+ 						m_TreeAggregate.ClearSelection(TRUE);
+ 						m_TreeAggregate.SelectItem(hNewItem);
+ 						m_TreeAggregate.SetFocus();			
+ 						m_TreeAggregate.Invalidate();
+ 						worked = true;
+ 		}
+ 		else // expand the tree until item reached
+ 		{
+ 			//CComPtr<IMgaProject> project = pMgaContext->m_ccpProject;
+ 			CComPtr<IMgaObject> parent;
+ 			CComPtr<IMgaObject> iitem = obj;
+ 
+ 			// coll of ptrs
+ 			CComObjPtr<IMgaObjects> coll;
+ 			COMTHROW( coll.CoCreateInstance( L"Mga.MgaObjects"));
+ 			if( !coll) 
+ 				throw hresult_exception( E_INVALIDARG);
+ 
+ 			// strings of ids
+ 			_bstr_t id;
+ 			_bstr_t item[ 100];
+ 			int     itemcount = 0;
+ 
+ 			pMgaContext->BeginTransaction( TRUE); // read-only transaction
+ 
+ 			// coll of ptrs
+ 			COMTHROW( coll->Append( obj));
+ 
+ 			// strings of ids
+ 			CComBSTR Id;
+ 			COMTHROW( obj->get_ID( &Id));
+ 			item[ itemcount++] = Id;
+ 
+ 			do
+ 			{
+ 				COMTHROW( iitem->GetParent( &parent));
+ 
+ 				// coll of ptrs
+ 				COMTHROW( coll->Append( parent));
+ 
+ 				// strings of ids
+ 				BSTR bstrid = NULL;
+ 				COMTHROW(parent->get_ID(&bstrid));
+ 				id = bstrid;
+ 				item[itemcount++] = id;
+ 
+ 				iitem = parent;
+ 				parent.Release();
+ 			} while( !m_TreeAggregate.m_MgaMap.LookupTreeItem( iitem, hNewItem));
+ 			//} while( !m_TreeAggregate.m_MgaMap.SearchTreeItem( (wchar_t*)((char*)id), hNewItem, pUnknown));
+ 
+ 			pMgaContext->CommitTransaction();
+ 			
+ 			// open the parents in backward order
+ 			worked = true;
+ 			m_TreeAggregate.EnsureVisible(hNewItem);
+ 			m_TreeAggregate.ClearSelection(TRUE);
+ 			m_TreeAggregate.SelectItem(hNewItem);
+ 			m_TreeAggregate.SendMessage(WM_KEYDOWN, (WPARAM)107, (LPARAM)0);
+ 			for (itemcount-=2; itemcount > 0; itemcount--) // valid itemcount range will be: from last-1 to 1
+ 			{
+ 				CComPtr<IMgaObject> obj_i;
+ 				COMTHROW( coll->get_Item( itemcount + 1, &obj_i)); // plus 1
+ 
+ 				//if (m_TreeAggregate.m_MgaMap.SearchTreeItem((wchar_t*)((char*)item[itemcount]),hNewItem, pUnknown))
+ 				if( m_TreeAggregate.m_MgaMap.LookupTreeItem( obj_i, hNewItem))
+ 				{
+ 					m_TreeAggregate.EnsureVisible( hNewItem);
+ 					m_TreeAggregate.ClearSelection( TRUE);
+ 					m_TreeAggregate.SelectItem( hNewItem);
+ 					m_TreeAggregate.SendMessage( WM_KEYDOWN, (WPARAM)107, (LPARAM)0);
+ 				}
+ 			}
+ 			
+ 			CComPtr<IMgaObject> obj_1st;
+ 			COMTHROW( coll->get_Item( 1, &obj_1st));
+ 			//if (m_TreeAggregate.m_MgaMap.SearchTreeItem(item[0],hNewItem, pUnknown))
+ 			if( m_TreeAggregate.m_MgaMap.LookupTreeItem( obj_1st, hNewItem))
+ 			{
+ 				m_TreeAggregate.EnsureVisible( hNewItem);
+ 				m_TreeAggregate.ClearSelection( TRUE);
+ 				m_TreeAggregate.SelectItem( hNewItem);
+ 			}
+ 		}
+ 		pMgaContext->CommitTransaction();
+ 	}
+ 	MSGCATCH( "Error completing the operation", pMgaContext->AbortTransaction();)
+ 
+ 	if( worked)
+ 		pApp->GetCtrl()->FireClickMgaObject( pUnknown);
+ }
+ 
  
  void CAggregatePropertyPage::Refresh()



More information about the GME-commit mailing list