[GME-commit] GMESRC/GME/GMEActiveBrowser ActiveBrowserPropertyPage.cpp, 1.60, 1.61 ActiveBrowserPropertyPage.h, 1.18, 1.19 AggregateContextMenu.cpp, 1.28, 1.29 AggregateContextMenu.h, 1.9, 1.10 AggregateTreeCtrl.cpp, 1.27, 1.28 AggregateTreeCtrl.h, 1.8, 1.9 AttachLibDlg.cpp, 1.3, 1.4 GMEActiveBrowser.rc, 1.17, 1.18 resource.h, 1.12, 1.13

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Wed Mar 7 15:29:07 CST 2007


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

Modified Files:
	ActiveBrowserPropertyPage.cpp ActiveBrowserPropertyPage.h 
	AggregateContextMenu.cpp AggregateContextMenu.h 
	AggregateTreeCtrl.cpp AggregateTreeCtrl.h AttachLibDlg.cpp 
	GMEActiveBrowser.rc resource.h 
Log Message:
Dependentlibraries use MGAProject and MgaFolder interfaces instead of 'insider' knowledge.
Menu changes for RootFolder: 
-new item: Check GUID ambiguity
-changed item: Attributes is renamed on the fly to 'Project Preference'

Menu shortcuts rearranged a bit (R: refresh, A: attach, Y: Registry, E: Preference, P: Properties)



CVS User: Zoltan Molnar, ISIS (zolmol)

Index: AggregateContextMenu.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/GMEActiveBrowser/AggregateContextMenu.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** AggregateContextMenu.cpp	18 Jan 2007 16:28:04 -0000	1.28
--- AggregateContextMenu.cpp	7 Mar 2007 21:29:05 -0000	1.29
***************
*** 97,100 ****
--- 97,101 ----
  			case ID_POPUP_REFRESH_LIBRARY: OnRefreshLibrary();break;
  			case ID_POPUP_LIBRARY_DEPENDENCIES: OnLibraryDependencies();break;
+ 			case ID_POPUP_LIBRARY_AMBIGUITYCHK: OnLibraryAmbiguityChk();break;
  
  			case ID_POPUP_SORT_CONSTRAINTS_CHECKALL: OnCheckAllConstraint();break;
***************
*** 394,398 ****
  			if( m_pParent->m_TreeAggregate.m_MgaMap.LookupObjectUnknown(hSelItem,pUnknown))
  			{
! 				if( m_pParent->m_TreeAggregate.IsLibrary(pUnknown))
  				{
  					CComQIPtr<IMgaFolder> ccpMgaFolder(pUnknown);
--- 395,402 ----
  			if( m_pParent->m_TreeAggregate.m_MgaMap.LookupObjectUnknown(hSelItem,pUnknown))
  			{
! 				bool has_dependency = true;
! 				// deletion of libraries which have some dependency
! 				// (either _includes or _includedBy) is confirmed
! 				if( m_pParent->m_TreeAggregate.IsLibrary(pUnknown, &has_dependency) && has_dependency)
  				{
  					CComQIPtr<IMgaFolder> ccpMgaFolder(pUnknown);
***************
*** 669,694 ****
  			{
  				// Folder is not FCO - limited operations				
! 				EnableMenuItem(ID_POPUP_ATTRIBUTES,MF_GRAYED);
! 				EnableMenuItem(ID_POPUP_PREFERENCES,MF_GRAYED);
! 				// EnableMenuItem(ID_POPUP_REGISTRY,MF_GRAYED);
! 
! 				if( hItem == m_pParent->m_TreeAggregate.GetRootItem())
! 					EnableMenuItem( ID_POPUP_ATTACH_LIBRARY, MF_ENABLED);
! 				else
! 					DeleteMenu( ID_POPUP_ATTACH_LIBRARY, MF_BYCOMMAND);
  
! 				if(!m_pParent->m_TreeAggregate.IsLibrary(MgaObjectProxy.m_pMgaObject))
  				{
! 					DeleteMenu( ID_POPUP_REFRESH_LIBRARY, MF_BYCOMMAND);
  				}
  				else
  				{
! 					InsertMenu(ID_POPUP_REFRESH_LIBRARY, MF_BYCOMMAND|MF_STRING, ID_POPUP_LIBRARY_DEPENDENCIES, "&Library dependencies");
! 					DeleteMenu(ID_POPUP_ATTRIBUTES, MF_BYCOMMAND);
! 					DeleteMenu(ID_POPUP_PREFERENCES, MF_BYCOMMAND);
! 					EnableMenuItem(ID_POPUP_REFRESH_LIBRARY, MF_ENABLED);
  				}
  
  
  				
  				EnableMenuItem(ID_POPUP_CONSTRAINTS_CHECK,MF_GRAYED);
--- 673,705 ----
  			{
  				// Folder is not FCO - limited operations				
! 				DeleteMenu(ID_POPUP_PREFERENCES, MF_BYCOMMAND);
  
! 				if( hItem == m_pParent->m_TreeAggregate.GetRootItem()) // RootFolder
  				{
! 					ModifyMenu( ID_POPUP_REFRESH_LIBRARY, MF_BYCOMMAND, ID_POPUP_LIBRARY_AMBIGUITYCHK, "Chec&k GUID ambiguity...");
! 					ModifyMenu( ID_POPUP_ATTRIBUTES, MF_BYCOMMAND|MF_STRING, ID_POPUP_ATTRIBUTES, "&Project Preferences");
  				}
  				else
  				{
! 					DeleteMenu( ID_POPUP_ATTRIBUTES, MF_BYCOMMAND);    // no Attributes
! 
! 					// it is a regular folder or library folder
! 					bool has_dependency;
! 					if( m_pParent->m_TreeAggregate.IsLibrary(MgaObjectProxy.m_pMgaObject, &has_dependency))
! 					{   // library folder
! 						if( has_dependency)
! 							InsertMenu( ID_POPUP_REFRESH_LIBRARY, MF_BYCOMMAND|MF_STRING, ID_POPUP_LIBRARY_DEPENDENCIES, "&Dependencies...");
! 						
! 						DeleteMenu( ID_POPUP_ATTACH_LIBRARY, MF_BYCOMMAND);
! 					}
! 					else
! 					{   // regular folder
! 						DeleteMenu( ID_POPUP_REFRESH_LIBRARY, MF_BYCOMMAND);
! 						DeleteMenu( ID_POPUP_ATTACH_LIBRARY, MF_BYCOMMAND);
! 					}
  				}
  
  
+ 
  				
  				EnableMenuItem(ID_POPUP_CONSTRAINTS_CHECK,MF_GRAYED);
***************
*** 1136,1139 ****
--- 1147,1155 ----
  {
  	m_pParent->LibraryDependencies();
+ }
+ 
+ void CAggregateContextMenu::OnLibraryAmbiguityChk()
+ {
+ 	m_pParent->LibraryAmbiguityChk();
  }
  

Index: AttachLibDlg.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/GMEActiveBrowser/AttachLibDlg.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** AttachLibDlg.cpp	16 Jan 2007 17:48:06 -0000	1.3
--- AttachLibDlg.cpp	7 Mar 2007 21:29:05 -0000	1.4
***************
*** 68,71 ****
--- 68,72 ----
  BOOL CAttachLibDlg::OnInitDialog() 
  {
+ 	// convenience for beta-testers
  	int pos = m_strConnString.Find( " (optimized)");
  	if( pos != -1) // remove if found
***************
*** 74,77 ****
--- 75,79 ----
  		m_strConnString = m_strConnString.Left( pos);
  	}
+ 	// end of special section // REMOVE later
  
  	CDialog::OnInitDialog();

Index: ActiveBrowserPropertyPage.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -d -r1.60 -r1.61
*** ActiveBrowserPropertyPage.cpp	17 Jan 2007 21:28:57 -0000	1.60
--- ActiveBrowserPropertyPage.cpp	7 Mar 2007 21:29:05 -0000	1.61
***************
*** 14,18 ****
  #include "Parser.h"
  #include "CommonMfc.h"
! 
  
  #define GET_X_LPARAM(lp)                        ((int)(short)LOWORD(lp))
--- 14,19 ----
  #include "Parser.h"
  #include "CommonMfc.h"
! #include <map>
! #include <vector>
  
  #define GET_X_LPARAM(lp)                        ((int)(short)LOWORD(lp))
***************
*** 1520,1536 ****
  		if( dlg.m_strConnString.Find( ".") == -1) dlg.m_strConnString += ".mga";
  
- 		if( dlg.m_bOptimized)
- 		{
- 			int pos = dlg.m_strConnString.Find( " (optimized)");
- 			if( pos == -1) // add if not found
- 				dlg.m_strConnString += " (optimized)";
- 		}
- 		else
- 		{
- 			int pos = dlg.m_strConnString.Find( " (optimized)");
- 			if( pos != -1) // remove if option indicates 'not optimized' and string still found (on attach should not happen)
- 				dlg.m_strConnString = dlg.m_strConnString.Left( pos);
- 		}
- 
  		MSGTRY {
  			HTREEITEM hItem = m_TreeAggregate.GetFirstSelectedItem();
--- 1521,1524 ----
***************
*** 1554,1558 ****
  					pMgaContext->BeginTransaction(FALSE);
  
! 					COMTHROW(ccpFolder->AttachLibrary(CComBSTR(dlg.m_strConnString), NULL));
  					pMgaContext->CommitTransaction();
  					
--- 1542,1546 ----
  					pMgaContext->BeginTransaction(FALSE);
  
! 					COMTHROW(ccpFolder->AttachLibraryV3( CComBSTR( dlg.m_strConnString), dlg.m_bOptimized, NULL));
  					pMgaContext->CommitTransaction();
  					
***************
*** 1599,1602 ****
--- 1587,1596 ----
  			CComBSTR bszLibName;						
  			COMTHROW(ccpFolder->get_LibraryName(&bszLibName));
+ 			ASSERT( bszLibName); // it should be a library
+ 
+ 			bool was_opt = false;
+ 			if( bszLibName)
+ 				was_opt = CAggregateTreeCtrl::IsUngroupedLibrary( ccpFolder); // was optimized/ungrouped
+ 
  			pMgaContext->CommitTransaction();
  		
***************
*** 1611,1633 ****
  			dlg.m_strConnString=bszLibName;
  			dlg.m_strCaption="Refresh Library";
  
  			if(dlg.DoModal() == IDOK) 
  			{
- 				if( dlg.m_bOptimized)
- 				{
- 					int pos = dlg.m_strConnString.Find( " (optimized)");
- 					if( pos == -1) // add if not found
- 						dlg.m_strConnString += " (optimized)";
- 				}
- 				else
- 				{
- 					int pos = dlg.m_strConnString.Find( " (optimized)");
- 					if( pos != -1) // remove if option indicates 'not optimized' and string is still found
- 						dlg.m_strConnString = dlg.m_strConnString.Left( pos);
- 				}
- 
  				pMgaContext->BeginTransaction(FALSE);
  					
! 				COMTHROW(ccpFolder->RefreshLibrary(CComBSTR(dlg.m_strConnString)) );
  				ccpFolder.Release();
  				pMgaContext->CommitTransaction();
--- 1605,1616 ----
  			dlg.m_strConnString=bszLibName;
  			dlg.m_strCaption="Refresh Library";
+ 			dlg.m_bOptimized = was_opt;
  
  			if(dlg.DoModal() == IDOK) 
  			{
  				pMgaContext->BeginTransaction(FALSE);
  					
! 				long errs;
! 				COMTHROW(ccpFolder->RefreshLibraryV3( CComBSTR( dlg.m_strConnString), dlg.m_bOptimized, &errs) );
  				ccpFolder.Release();
  				pMgaContext->CommitTransaction();
***************
*** 1638,1694 ****
  }
  
- void createMsg( CMgaContext* pMgaContext, CString p_msgText, const CString& p_val, CString& p_msg)
- {
- 	const CString& val = p_val;
- 	CString&       msg = p_msg;
- 
- 	int i = 0;
- 	CString lst;
- 	CString token;
- 	CString nfnd;
- 	token = val.Tokenize( "\n", i);
- 	while( token != "")
- 	{
- 		bool error = true;
- 		try {
- 			CComPtr<IMgaObject> obj;
- 			if( SUCCEEDED( pMgaContext->m_ccpProject->GetObjectByID( CComBSTR( token), &obj)))
- 			{
- 				CComQIPtr<IMgaFolder> fld( obj);
- 				long stat;
- 				COMTHROW( obj->get_Status( &stat));
- 				if( fld && stat == OBJECT_EXISTS)
- 				{
- 					CComBSTR connstr;
- 					COMTHROW( fld->get_LibraryName( &connstr));
- 					if( connstr && connstr.Length() > 0) 
- 					{
- 						CString cs; 
- 						CopyTo( connstr, cs);
- 						lst += cs + " [ " + token + " ]\n";
- 						error = false;
- 					}
- 				}
- 			}
- 		} catch( hresult_exception&) {
- 			ASSERT(0);
- 		}
- 
- 		if( error)
- 		{
- 			nfnd += "Not found [ " + token + " ]\n";
- 		}
- 
- 		token = val.Tokenize( "\n", i);
- 	}
- 
- 	msg = p_msgText + (lst.IsEmpty()?"None":lst);
- 
- 	if( !nfnd.IsEmpty())
- 	{
- 		msg += CString("\nErrors:\n") + nfnd;
- 	}
- }
- 
  void CAggregatePropertyPage::LibraryDependencies()
  {
--- 1621,1624 ----
***************
*** 1726,1744 ****
  				msg0 = "Library [" + msg0 + "] dependencies";
  
! 				CComBSTR incby_value;
! 				CComBSTR incls_value;
! 				CComBSTR incby_path( L"_includedBy");
! 				CComBSTR incls_path( L"_includes");
! 
! 				COMTHROW( ccpFolder->get_RegistryValue( incby_path, &incby_value));
! 				COMTHROW( ccpFolder->get_RegistryValue( incls_path, &incls_value));
  
! 				CString val1, val2;
! 				CopyTo( incby_value, val1);
! 				CopyTo( incls_value, val2);
  
  				CString msg1, msg2;
! 				createMsg( pMgaContext, "Included virtually in:\n", val1, msg1);
! 				createMsg( pMgaContext, "Virtually includes:\n", val2, msg2);
  
  				AfxMessageBox( msg0 + "\n\n" + msg1 + "\n\n" + msg2, MB_ICONINFORMATION);
--- 1656,1667 ----
  				msg0 = "Library [" + msg0 + "] dependencies";
  
! 				CComPtr<IMgaFolders> coll_inc, coll_iby;
  
! 				COMTHROW( ccpFolder->GetVirtuallyIncludedBy( &coll_iby));
! 				COMTHROW( ccpFolder->GetVirtuallyIncludes  ( &coll_inc));
  
  				CString msg1, msg2;
! 				composeInfo( "Included virtually in:\n", coll_iby, msg1);
! 				composeInfo( "Virtually includes:\n", coll_inc, msg2);
  
  				AfxMessageBox( msg0 + "\n\n" + msg1 + "\n\n" + msg2, MB_ICONINFORMATION);
***************
*** 3915,3917 ****
--- 3838,3966 ----
  		Refresh();
  	}
+ }
+ 
+ void CAggregatePropertyPage::LibraryAmbiguityChk()
+ {
+ 	CGMEActiveBrowserApp* pApp=(CGMEActiveBrowserApp*)AfxGetApp();
+ 	CMgaContext* pMgaContext=&pApp->m_CurrentProject.m_MgaContext;
+ 
+ 	HTREEITEM hItem = m_TreeAggregate.GetFirstSelectedItem();
+ 	if (hItem != NULL) 
+ 	{ 
+ 		
+ 		LPUNKNOWN pUnknown;
+ 		
+ 		if(!m_TreeAggregate.m_MgaMap.LookupObjectUnknown(hItem,pUnknown))return;
+ 					
+ 		CComQIPtr<IMgaFolder> ccpFolder(pUnknown);
+ 		if(!ccpFolder)return;
+ 
+ 		MSGTRY {
+ 			
+ 			CGMEActiveBrowserApp* pApp=(CGMEActiveBrowserApp*)AfxGetApp();
+ 			CMgaContext* pMgaContext=&pApp->m_CurrentProject.m_MgaContext;
+ 
+ 			CComBSTR msg;
+ 			pMgaContext->BeginTransaction(FALSE);
+ 
+ 			CComPtr<IMgaFolders> fols;
+ 			std::map< CComBSTR, std::vector< CComBSTR > > guidmap;
+ 			
+ 			// the rootfolder's guid might have a guid conflict also
+ 			CComBSTR gd_of_project;
+ 			COMTHROW( ccpFolder->GetGuidDisp( &gd_of_project));
+ 			// save its guid
+ 			guidmap[ gd_of_project].push_back( CComBSTR( "Main Project"));
+ 
+ 			// check toplevel folders
+ 			COMTHROW( ccpFolder->get_ChildFolders( &fols));
+ 			long len = 0;
+ 			if( fols) COMTHROW( fols->get_Count( &len));
+ 			for( long i = 1; i <= len; ++i)
+ 			{
+ 				CComPtr<IMgaFolder> fol;
+ 				COMTHROW( fols->get_Item( i, &fol));
+ 
+ 				if( !fol) { ASSERT(0); continue; }
+ 
+ 				CComBSTR bszLibName;
+ 				COMTHROW( fol->get_LibraryName(&bszLibName));
+ 
+ 				if( bszLibName) // if library
+ 				{
+ 					CComBSTR gd;
+ 					COMTHROW( fol->GetGuidDisp( &gd));
+ 
+ 					// save its guid
+ 					guidmap[ gd].push_back( bszLibName);
+ 				}
+ 			}
+ 		
+ 			for( std::map< CComBSTR, std::vector< CComBSTR > >::iterator it = guidmap.begin(), en = guidmap.end(); it != en; ++it)
+ 			{
+ 				if( it->second.size() > 1) // duplicates found
+ 				{
+ 					if( msg.Length() > 0) msg.Append( "\n\n");
+ 					msg.AppendBSTR( it->first);
+ 					msg.Append( "\nShared by multiple toplevel libraries:");
+ 					for( unsigned int i = 0; i < it->second.size(); ++i)
+ 					{
+ 						msg.Append( "\n\t");
+ 						msg.AppendBSTR( it->second[i]);
+ 					}
+ 				}
+ 			}
+ 			if( msg.Length() != 0)
+ 			{
+ 				CString msgs;
+ 				CopyTo( msg, msgs);
+ 				AfxMessageBox( msgs, MB_OK | MB_ICONSTOP);
+ 			}
+ 			else
+ 				AfxMessageBox( "No duplicate GUID found among the toplevel libraries.", MB_ICONINFORMATION);
+ 
+ 			//pMgaContext->CommitTransaction();
+ 			pMgaContext->AbortTransaction();
+ 
+ 		} MSGCATCH("Error while analyzing library guid ambiguities",pMgaContext->AbortTransaction();)	
+ 		//Refresh();
+ 	}
+ }
+ 
+ //static
+ void CAggregatePropertyPage::composeInfo( CString p_msgText, CComPtr<IMgaFolders>& coll, CString& p_msg)
+ {
+ 	CString&       msg = p_msg;
+ 	CString        lst;
+ 
+ 	long len = 0;
+ 	if( coll) COMTHROW( coll->get_Count( &len));
+ 	for( long i = 1; i <= len; ++i)
+ 	{
+ 		CComPtr<IMgaFolder> ele;
+ 		COMTHROW( coll->get_Item( i, &ele));
+ 
+ 		ASSERT( ele);
+ 		if( ele)
+ 		{
+ 			long stat = OBJECT_ZOMBIE;
+ 			COMTHROW( ele->get_Status( &stat));
+ 			if( stat == OBJECT_EXISTS)
+ 			{
+ 				CComBSTR connstr;
+ 				CComBSTR guiddsp;
+ 				COMTHROW( ele->get_LibraryName( &connstr));
+ 				COMTHROW( ele->GetGuidDisp( &guiddsp));
+ 				if( connstr && connstr.Length() > 0) 
+ 				{
+ 					CString cs, gs;
+ 					CopyTo( connstr, cs);
+ 					CopyTo( guiddsp, gs);
+ 					lst += cs + " " + gs + "\n";
+ 				}
+ 			}
+ 		}
+ 	}
+ 
+ 	msg = p_msgText + (lst.IsEmpty()?"None":lst);
  }

Index: AggregateContextMenu.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/GMEActiveBrowser/AggregateContextMenu.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** AggregateContextMenu.h	16 Jan 2007 17:48:06 -0000	1.9
--- AggregateContextMenu.h	7 Mar 2007 21:29:05 -0000	1.10
***************
*** 25,28 ****
--- 25,29 ----
  	void OnAttachLibrary();
  	void OnLibraryDependencies();
+ 	void OnLibraryAmbiguityChk();
  
  	UINT m_nSelectionCount;

Index: ActiveBrowserPropertyPage.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** ActiveBrowserPropertyPage.h	16 Jan 2007 17:48:06 -0000	1.18
--- ActiveBrowserPropertyPage.h	7 Mar 2007 21:29:05 -0000	1.19
***************
*** 30,33 ****
--- 30,34 ----
  	void AttachLibrary();
  	void LibraryDependencies();
+ 	void LibraryAmbiguityChk();
  	bool askUserAndDeleteLibrary( CComPtr<IMgaFolder> p_ccpFolder);
  
***************
*** 127,131 ****
  	void reqBuildAggregateTree(HTREEITEM hParent,IMgaObject* pIMgaObject, int nDepthLevel, int nCounter=0, bool bWithUpdate=false);
  
! 
  
  };
--- 128,132 ----
  	void reqBuildAggregateTree(HTREEITEM hParent,IMgaObject* pIMgaObject, int nDepthLevel, int nCounter=0, bool bWithUpdate=false);
  
! 	static void composeInfo( CString p_msgText, CComPtr<IMgaFolders>& coll, CString& p_msg);
  
  };

Index: AggregateTreeCtrl.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/GMEActiveBrowser/AggregateTreeCtrl.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** AggregateTreeCtrl.h	31 Aug 2005 19:24:11 -0000	1.8
--- AggregateTreeCtrl.h	7 Mar 2007 21:29:05 -0000	1.9
***************
*** 22,26 ****
  	BOOL m_bIsStateStored;
  public:
! 	BOOL IsLibrary(LPUNKNOWN pUnknown);
  
      
--- 22,27 ----
  	BOOL m_bIsStateStored;
  public:
! 	BOOL IsLibrary(LPUNKNOWN pUnknown, bool *p_ptrIsDependent = 0);
! 	static bool IsUngroupedLibrary(CComPtr<IMgaFolder> ptr);
  
      

Index: resource.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/GMEActiveBrowser/resource.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** resource.h	16 Jan 2007 17:48:06 -0000	1.12
--- resource.h	7 Mar 2007 21:29:05 -0000	1.13
***************
*** 78,81 ****
--- 78,82 ----
  #define ID_POPUP_SHOWINPARENT           32803
  #define ID_POPUP_LIBRARY_DEPENDENCIES   32804
+ #define ID_POPUP_LIBRARY_AMBIGUITYCHK   32806
  #define ID_POPUP_READONLY               32805
  #define ID_POPUP_READWRITE              32807

Index: AggregateTreeCtrl.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/GMEActiveBrowser/AggregateTreeCtrl.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** AggregateTreeCtrl.cpp	13 Mar 2006 19:24:24 -0000	1.27
--- AggregateTreeCtrl.cpp	7 Mar 2007 21:29:05 -0000	1.28
***************
*** 95,102 ****
  	if(otObjectType==OBJTYPE_FOLDER)
  	{
! 		if(IsLibrary(pUnknown))
  		{
  			tvInsert.item.iImage=10;
  			tvInsert.item.iSelectedImage=10;
  		}
  	}
--- 95,108 ----
  	if(otObjectType==OBJTYPE_FOLDER)
  	{
! 		bool has_dep;
! 		if(IsLibrary(pUnknown, &has_dep))
  		{
  			tvInsert.item.iImage=10;
  			tvInsert.item.iSelectedImage=10;
+ 			if( has_dep)
+ 			{
+ 				tvInsert.item.iImage=54;
+ 				tvInsert.item.iSelectedImage=54;
+ 			}
  		}
  	}
***************
*** 176,183 ****
  	if(otObjectType==OBJTYPE_FOLDER)
  	{
! 		if(IsLibrary(pUnknown))
  		{
  			tvInsert.item.iImage=10;
  			tvInsert.item.iSelectedImage=10;
  		}
  			
--- 182,195 ----
  	if(otObjectType==OBJTYPE_FOLDER)
  	{
! 		bool has_dep;
! 		if(IsLibrary(pUnknown, &has_dep))
  		{
  			tvInsert.item.iImage=10;
  			tvInsert.item.iSelectedImage=10;
+ 			if( has_dep)
+ 			{
+ 				tvInsert.item.iImage=54;
+ 				tvInsert.item.iSelectedImage=54;
+ 			}
  		}
  			
***************
*** 1256,1260 ****
  
  
! BOOL CAggregateTreeCtrl::IsLibrary(LPUNKNOWN pUnknown)
  {
  
--- 1268,1272 ----
  
  
! BOOL CAggregateTreeCtrl::IsLibrary(LPUNKNOWN pUnknown, bool *p_ptrHasAnyDependency /*= 0*/)
  {
  
***************
*** 1271,1274 ****
--- 1283,1292 ----
  	CComBSTR bszLibName;						
  	COMTHROW(ccpFolder->get_LibraryName(&bszLibName));
+ 
+ 	if( bszLibName && p_ptrHasAnyDependency)  // user interested in the dependency status
+ 	{
+ 		*p_ptrHasAnyDependency = IsUngroupedLibrary( ccpFolder);
+ 	}
+ 
  	pMgaContext->CommitTransaction();
  
***************
*** 1282,1283 ****
--- 1300,1321 ----
  }
  
+ //static
+ bool CAggregateTreeCtrl::IsUngroupedLibrary(CComPtr<IMgaFolder> pLibPtr)
+ {
+ 	ASSERT( pLibPtr);
+ 	if( !pLibPtr) return false;
+ 
+ 	bool retv = true;
+ 	CComPtr<IMgaFolders> c1, c2;
+ 	COMTHROW( pLibPtr->GetVirtuallyIncludedBy( &c1));
+ 	COMTHROW( pLibPtr->GetVirtuallyIncludes( &c2));
+ 	long l1( 0), l2( 0);
+ 	if( c1) COMTHROW( c1->get_Count( &l1));
+ 	if( c2) COMTHROW( c2->get_Count( &l2));
+ 	if( l1 == 0 && l2 == 0)
+ 	{
+ 		retv = false;
+ 	}
+ 
+ 	return retv;
+ }
\ No newline at end of file

Index: GMEActiveBrowser.rc
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/GMEActiveBrowser/GMEActiveBrowser.rc,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** GMEActiveBrowser.rc	16 Jan 2007 17:48:06 -0000	1.17
--- GMEActiveBrowser.rc	7 Mar 2007 21:29:05 -0000	1.18
***************
*** 194,204 ****
  FONT 8, "MS Sans Serif", 0, 0, 0x0
  BEGIN
!     EDITTEXT        IDC_CONN_STRING,37,30,198,14,ES_AUTOHSCROLL
!     PUSHBUTTON      "...",IDC_BROWSE,245,30,14,14
      DEFPUSHBUTTON   "OK",IDOK,76,53,50,14
      PUSHBUTTON      "Cancel",IDCANCEL,153,53,50,14
!     CONTROL         "Optimized",IDC_CHECKOPTIMIZED,"Button",BS_AUTOCHECKBOX | 
!                     WS_TABSTOP,191,15,47,10
!     LTEXT           "Mga Connection String:",IDC_STATIC,37,14,75,8
      ICON            IDI_LIBRARY,IDC_STATIC,8,12,20,20
  END
--- 194,204 ----
  FONT 8, "MS Sans Serif", 0, 0, 0x0
  BEGIN
!     EDITTEXT        IDC_CONN_STRING,37,20,198,14,ES_AUTOHSCROLL
!     PUSHBUTTON      "...",IDC_BROWSE,245,20,14,14
!     CONTROL         "Optimize (Ungroup Inner Libraries)",IDC_CHECKOPTIMIZED,
!                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,38,36,122,12
      DEFPUSHBUTTON   "OK",IDOK,76,53,50,14
      PUSHBUTTON      "Cancel",IDCANCEL,153,53,50,14
!     LTEXT           "Mga Connection String:",IDC_STATIC,37,9,75,8
      ICON            IDI_LIBRARY,IDC_STATIC,8,12,20,20
  END
***************
*** 290,294 ****
          MENUITEM "&Properties",                 ID_POPUP_PROPERTIES
          MENUITEM "&Attributes",                 ID_POPUP_ATTRIBUTES
!         MENUITEM "&Preferences",                ID_POPUP_PREFERENCES
          MENUITEM SEPARATOR
          MENUITEM "&Undo",                       ID_POPUP_EDIT_UNDO
--- 290,294 ----
          MENUITEM "&Properties",                 ID_POPUP_PROPERTIES
          MENUITEM "&Attributes",                 ID_POPUP_ATTRIBUTES
!         MENUITEM "Pr&eferences",                ID_POPUP_PREFERENCES
          MENUITEM SEPARATOR
          MENUITEM "&Undo",                       ID_POPUP_EDIT_UNDO
***************
*** 345,352 ****
          MENUITEM "&Properties",                 ID_POPUP_PROPERTIES
          MENUITEM "&Attributes",                 ID_POPUP_ATTRIBUTES
!         MENUITEM "&Preferences",                ID_POPUP_PREFERENCES
!         MENUITEM "&Registry...",                ID_POPUP_REGISTRY
          MENUITEM "&Attach Library...",          ID_POPUP_ATTACH_LIBRARY
!         MENUITEM "&Refresh Library",            ID_POPUP_REFRESH_LIBRARY
          MENUITEM SEPARATOR
          MENUITEM "INSERTIONS",                  ID_POPUP_INSERTIONS
--- 345,352 ----
          MENUITEM "&Properties",                 ID_POPUP_PROPERTIES
          MENUITEM "&Attributes",                 ID_POPUP_ATTRIBUTES
!         MENUITEM "Pr&eferences",                ID_POPUP_PREFERENCES
!         MENUITEM "Registr&y...",                ID_POPUP_REGISTRY
          MENUITEM "&Attach Library...",          ID_POPUP_ATTACH_LIBRARY
!         MENUITEM "&Refresh Library...",         ID_POPUP_REFRESH_LIBRARY
          MENUITEM SEPARATOR
          MENUITEM "INSERTIONS",                  ID_POPUP_INSERTIONS



More information about the GME-commit mailing list