[GME-commit] GMESRC/GME/GMEActiveBrowser ActiveBrowserPropertyPage.cpp,1.35,1.36 ActiveBrowserPropertyPage.h,1.8,1.9 AggregateContextMenu.cpp,1.17,1.18 AggregateContextMenu.h,1.3,1.4 AggregateTreeCtrl.cpp,1.18,1.19 GMEActiveBrowser.rc,1.8,1.9 resource.h,1.5,1.6

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Mon Sep 27 17:54:49 CDT 2004


Update of /var/lib/gme/GMESRC/GME/GMEActiveBrowser
In directory braindrain:/tmp/cvs-serv14008

Modified Files:
	ActiveBrowserPropertyPage.cpp ActiveBrowserPropertyPage.h 
	AggregateContextMenu.cpp AggregateContextMenu.h 
	AggregateTreeCtrl.cpp GMEActiveBrowser.rc resource.h 
Log Message:
Copy smart introduced.


CVS User: zolmol

Index: ActiveBrowserPropertyPage.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** ActiveBrowserPropertyPage.cpp	30 Jun 2004 17:50:46 -0000	1.35
--- ActiveBrowserPropertyPage.cpp	27 Sep 2004 21:54:46 -0000	1.36
***************
*** 12,15 ****
--- 12,18 ----
  #include "AttachLibDlg.h"
  
+ #include "CommonMfc.h"
+ 
+ 
  #define GET_X_LPARAM(lp)                        ((int)(short)LOWORD(lp))
  #define GET_Y_LPARAM(lp)                        ((int)(short)HIWORD(lp))
***************
*** 912,915 ****
--- 915,919 ----
  		CComObjPtr<IMgaFolders> sel_folders, top_folders;
  		long options;
+ 		CComBstrObj acckinds;
  
  		COMTHROW( cl.CoCreateInstance(L"Mga.MgaClosure") );
***************
*** 923,927 ****
  			PutOut( top_folders), 
  			is_any_folder_selected?1:0,
! 			&options));
  
  		if ( sel_fcos || sel_folders) // if both null the operation is not needed (either dumped to file already or unsuccessful)
--- 927,933 ----
  			PutOut( top_folders), 
  			is_any_folder_selected?1:0,
! 			&options,
! 			PutOut( acckinds)
! 			));
  
  		if ( sel_fcos || sel_folders) // if both null the operation is not needed (either dumped to file already or unsuccessful)
***************
*** 939,943 ****
--- 945,1106 ----
  			if ( top_folders)	pGMEClosureDataSource->SetTopNodes( top_folders);
  
+ 
  			pGMEClosureDataSource->SetOptions( options);
+ 			pGMEClosureDataSource->SetAcceptingKinds( acckinds);
+ 
+ 			pGMEClosureDataSource->CacheDescriptor( &GMEDataDescriptor);
+ 
+ 			pGMEClosureDataSource->SetClipboard();
+ 			pGMEClosureDataSource->FlushClipboard();
+ 		}
+ 	}
+ 	else
+ 	{
+ 		MessageBox("No object selected","Copy Error", MB_ICONERROR);
+ 	}
+ }
+ 
+ void CAggregatePropertyPage::DoCopySmart( int k /*= 0*/)
+ {
+ 	bool all_containers = true;
+ 	bool all_refs = true;
+ 	bool all_sets = true;
+ 	bool all_conns = true;
+ 
+ 	bool any_container = false;
+ 	bool any_ref = false;
+ 	bool any_set = false;
+ 	bool any_conn = false;
+ 
+ 	CGMEActiveBrowserApp * pApp = (CGMEActiveBrowserApp*) AfxGetApp();
+ 	CMgaContext * pMgaContext = &pApp->m_CurrentProject.m_MgaContext;
+ 	
+ 	CComObjPtr<IMgaFCOs> ccpSelectedFCOs;
+ 	CComObjPtr<IMgaFolders> ccpSelectedFolders;
+ 	COMTHROW( ccpSelectedFCOs.CoCreateInstance( L"Mga.MgaFCOs"));
+ 	COMTHROW( ccpSelectedFolders.CoCreateInstance( L"Mga.MgaFolders"));
+ 
+ 	typedef CTypedPtrList< CPtrList, CRect *> CRectList;
+ 	CRectList rectSelectedList;
+ 	CRect rectItem;
+ 	CRect rectFrame(0,0,0,0);
+ 
+ 
+ 	for( HTREEITEM hItem = m_TreeAggregate.GetFirstSelectedItem(); 
+ 		hItem; 
+ 		hItem = m_TreeAggregate.GetNextSelectedItem( hItem))
+ 	{
+ 		CMgaObjectProxy ObjectProxy;
+ 		if( m_TreeAggregate.m_MgaMap.LookupObjectProxy( hItem, ObjectProxy))
+ 		{
+ 			all_containers &= (ObjectProxy.m_TypeInfo == OBJTYPE_MODEL || ObjectProxy.m_TypeInfo == OBJTYPE_FOLDER);
+ 			all_refs  &= (ObjectProxy.m_TypeInfo == OBJTYPE_REFERENCE);
+ 			all_sets  &= (ObjectProxy.m_TypeInfo == OBJTYPE_SET);
+ 			all_conns &= (ObjectProxy.m_TypeInfo == OBJTYPE_CONNECTION);
+ 
+ 			any_container |= (ObjectProxy.m_TypeInfo == OBJTYPE_MODEL || ObjectProxy.m_TypeInfo == OBJTYPE_FOLDER);
+ 			any_ref  |= (ObjectProxy.m_TypeInfo == OBJTYPE_REFERENCE);
+ 			any_set  |= (ObjectProxy.m_TypeInfo == OBJTYPE_SET);
+ 			any_conn |= (ObjectProxy.m_TypeInfo == OBJTYPE_CONNECTION);
+ 
+ 			if ( ObjectProxy.m_TypeInfo == OBJTYPE_MODEL			// FCOs: connection too
+ 			   || ObjectProxy.m_TypeInfo == OBJTYPE_ATOM
+ 			   || ObjectProxy.m_TypeInfo == OBJTYPE_REFERENCE
+ 			   || ObjectProxy.m_TypeInfo == OBJTYPE_SET
+ 			   || ObjectProxy.m_TypeInfo == OBJTYPE_CONNECTION)
+ 			{
+ 				CComQIPtr<IMgaFCO> ccpMgaFCO( ObjectProxy.m_pMgaObject);
+ 				if( ccpMgaFCO)
+ 				{
+ 					// Finding the rectangle of the selected item
+ 					m_TreeAggregate.GetItemRect( hItem, rectItem, TRUE);
+ 					// Computing the frame of all rectangles
+ 					rectFrame.UnionRect( rectFrame, rectItem);
+ 
+ 					// Adding to the selected rectangle list to create the image
+ 					rectSelectedList.AddTail( new CRect( rectItem));
+ 					
+ 					// Append to the selected FCO list
+ 					ccpSelectedFCOs->Append( ccpMgaFCO);
+ 				}
+ 			}
+ 			else if ( ObjectProxy.m_TypeInfo == OBJTYPE_FOLDER )
+ 			{
+ 				CComQIPtr<IMgaFolder> ccpMgaFolder( ObjectProxy.m_pMgaObject);
+ 				if( ccpMgaFolder)
+ 				{
+ 					{
+ 						// Finding the rectangle of the selected item
+ 						m_TreeAggregate.GetItemRect( hItem, rectItem, TRUE);
+ 						// Computing the frame of all rectangles
+ 						rectFrame.UnionRect( rectFrame, rectItem);
+ 
+ 						// Adding to the selected rectangle list to create the image
+ 						rectSelectedList.AddTail( new CRect( rectItem));
+ 						
+ 						// Append to the selected FCO list
+ 						ccpSelectedFolders->Append( ccpMgaFolder);
+ 					}
+ 				}
+ 			}
+ 		}		
+ 	}
+ 	
+ 	if ( rectSelectedList.GetCount()!=0)
+ 	{
+ 		CComPtr<IMgaClosure> cl;
+ 		CComObjPtr<IMgaFCOs> sel_fcos, top_fcos;
+ 		CComObjPtr<IMgaFolders> sel_folders, top_folders;
+ 		long options;
+ 		CComBstrObj acckinds; 
+ 		CComBstrObj path; 
+ 
+ 		// if container selected then it must be lonely (no multiple selection)
+ 		// if container selected no other kinds allowed
+ 		if( any_container && !all_containers || rectSelectedList.GetCount() > 1 && all_containers)
+ 		{
+ 			MessageBox("Invalid selection for smart copy. You can select either one container or several non-containers.","Copy Error", MB_ICONERROR);
+ 			return;
+ 		}
+ 
+ 		if( any_container) k |= 1024;
+ 
+ 		if( any_ref) k |= 2048;
+ 		if( any_set) k |= 4096;
+ 		if( any_conn) k |= 8192;
+ 
+ 		COMTHROW( cl.CoCreateInstance(L"Mga.MgaClosure") );
+ 		
+ 		COMTHROW( cl->SmartCopy( 
+ 			ccpSelectedFCOs, 
+ 			ccpSelectedFolders, 
+ 			PutOut( sel_fcos), 
+ 			PutOut( sel_folders), 
+ 			PutOut( top_fcos), 
+ 			PutOut( top_folders), 
+ 			k,
+ 			&options,
+ 			PutOut( acckinds),
+ 			PutOut( path)
+ 			));
+ 
+ 		if ( sel_fcos || sel_folders) // if both null the operation is not needed (either dumped to file already or unsuccessful)
+ 		{
+ 			CRectList dummyAnnList;
+ 
+ 			CGMEDataDescriptor GMEDataDescriptor( rectSelectedList, dummyAnnList, rectFrame.TopLeft(), CPoint( 0,0));
+ 
+ 			CGMEClosureDataSource * pGMEClosureDataSource = new CGMEClosureDataSource( pMgaContext->m_ccpProject);
+ 			
+ 			if ( sel_fcos)		pGMEClosureDataSource->SetNodes( sel_fcos);
+ 			if ( sel_folders)	pGMEClosureDataSource->SetFolders( sel_folders);
+ 
+ 			if ( top_fcos)		pGMEClosureDataSource->SetTopNodes( top_fcos);
+ 			if ( top_folders)	pGMEClosureDataSource->SetTopNodes( top_folders);
+ 
+ 
+ 			pGMEClosureDataSource->SetOptions( options);
+ 			pGMEClosureDataSource->SetAbsPathPart( path);
+ 			pGMEClosureDataSource->SetAcceptingKinds( acckinds);
  
  			pGMEClosureDataSource->CacheDescriptor( &GMEDataDescriptor);

Index: ActiveBrowserPropertyPage.h
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** ActiveBrowserPropertyPage.h	2 Jun 2004 22:15:47 -0000	1.8
--- ActiveBrowserPropertyPage.h	27 Sep 2004 21:54:46 -0000	1.9
***************
*** 33,36 ****
--- 33,37 ----
  	void DoCopy();
  	void DoCopyClosure();
+ 	void DoCopySmart( int k = 0);
  	
  	CComboEdit m_ComboEditCtrl;

Index: AggregateContextMenu.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/GMEActiveBrowser/AggregateContextMenu.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** AggregateContextMenu.cpp	14 Sep 2004 14:13:22 -0000	1.17
--- AggregateContextMenu.cpp	27 Sep 2004 21:54:46 -0000	1.18
***************
*** 84,87 ****
--- 84,88 ----
  			case ID_EDIT_COPY:			OnEditCopy();break;
  			case ID_EDIT_COPYCLOSURE:	OnEditCopyClosure();break;
+ 			case ID_EDIT_COPYSMART:		OnEditCopySmart();break;
  			case ID_EDIT_PASTE:			OnEditPaste();break;
  			case ID_POPUP_EDIT_DELETE:	OnEditDelete();break;
***************
*** 269,272 ****
--- 270,279 ----
  	CPoint ptDummy;
  	m_pParent->DoCopyClosure();
+ }
+ 
+ void CAggregateContextMenu::OnEditCopySmart()
+ {
+ 	CPoint ptDummy;
+ 	m_pParent->DoCopySmart();
  }
  

Index: AggregateContextMenu.h
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/GMEActiveBrowser/AggregateContextMenu.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** AggregateContextMenu.h	2 Jun 2004 22:15:47 -0000	1.3
--- AggregateContextMenu.h	27 Sep 2004 21:54:46 -0000	1.4
***************
*** 50,53 ****
--- 50,54 ----
  	void OnEditCopy();
  	void OnEditCopyClosure();
+ 	void OnEditCopySmart();
  	void OnEditCut();
  	void OnEditRedo();

Index: AggregateTreeCtrl.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/GMEActiveBrowser/AggregateTreeCtrl.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** AggregateTreeCtrl.cpp	29 Jun 2004 17:49:10 -0000	1.18
--- AggregateTreeCtrl.cpp	27 Sep 2004 21:54:46 -0000	1.19
***************
*** 748,752 ****
  	CGMEActiveBrowserApp* pApp=(CGMEActiveBrowserApp*)AfxGetApp();
  	CMgaContext* pMgaContext=&pApp->m_CurrentProject.m_MgaContext;
- 
  	
  	// Setting up the drop target 
--- 748,751 ----
***************
*** 770,774 ****
  		}
  			
! 		return (CGMEDataSource::ParseXMLData(pDataObject, ccpTargetObject) ? TRUE : FALSE);
  	}
  	// PETER: end
--- 769,779 ----
  		}
  			
! 		if( pMgaContext && pMgaContext->m_ccpConstMgr) COMTHROW( pMgaContext->m_ccpConstMgr->Enable( false));
! 
! 		bool res = CGMEDataSource::ParseXMLData(pDataObject, ccpTargetObject);
! 		
! 		if( pMgaContext && pMgaContext->m_ccpConstMgr) COMTHROW( pMgaContext->m_ccpConstMgr->Enable( true));
! 
! 		return res?TRUE:FALSE;
  	}
  	// PETER: end
***************
*** 863,870 ****
  		else if(MgaObjectProxy.m_TypeInfo==OBJTYPE_MODEL) // If the drop target is a model
  		{
! 			long fol_cnt;
! 			COMTHROW( ccpDroppedFolders->get_Count( &fol_cnt));
! 			if ( fol_cnt > 0)
! 				AfxMessageBox("Cannot insert folders into a model");
  
  			CComQIPtr<IMgaModel> ccpTargetModel(MgaObjectProxy.m_pMgaObject);
--- 868,878 ----
  		else if(MgaObjectProxy.m_TypeInfo==OBJTYPE_MODEL) // If the drop target is a model
  		{
! 			long fol_cnt = 0;
! 			if( ccpDroppedFolders)
! 			{
! 				COMTHROW( ccpDroppedFolders->get_Count( &fol_cnt));
! 				if ( fol_cnt > 0)
! 					AfxMessageBox("Cannot insert folders into a model");
! 			}
  
  			CComQIPtr<IMgaModel> ccpTargetModel(MgaObjectProxy.m_pMgaObject);

Index: GMEActiveBrowser.rc
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/GMEActiveBrowser/GMEActiveBrowser.rc,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** GMEActiveBrowser.rc	2 Jun 2004 22:15:47 -0000	1.8
--- GMEActiveBrowser.rc	27 Sep 2004 21:54:46 -0000	1.9
***************
*** 300,303 ****
--- 300,304 ----
          MENUITEM "&Copy",                       ID_EDIT_COPY
          MENUITEM "C&opy Closure",               ID_EDIT_COPYCLOSURE
+         MENUITEM "Copy &Smart",                 ID_EDIT_COPYSMART
          MENUITEM SEPARATOR
          MENUITEM "Delete",                      ID_POPUP_EDIT_DELETE
***************
*** 359,362 ****
--- 360,364 ----
          MENUITEM "&Copy",                       ID_EDIT_COPY
          MENUITEM "C&opy Closure",               ID_EDIT_COPYCLOSURE
+         MENUITEM "Copy &Smart",                 ID_EDIT_COPYSMART
          MENUITEM "&Paste",                      ID_EDIT_PASTE
          MENUITEM SEPARATOR

Index: resource.h
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/GMEActiveBrowser/resource.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** resource.h	2 Jun 2004 22:15:47 -0000	1.5
--- resource.h	27 Sep 2004 21:54:46 -0000	1.6
***************
*** 64,67 ****
--- 64,69 ----
  #define ID_POPUP_REFRESH_LIBRARY        32788
  #define ID_EDIT_COPYCLOSURE             32789
+ #define ID_EDIT_COPYSMART               32790
+ #define ID_POPUP_SELECTCOPY_CONNECTIONS 32793
  
  // Next default values for new objects
***************
*** 70,74 ****
  #ifndef APSTUDIO_READONLY_SYMBOLS
  #define _APS_NEXT_RESOURCE_VALUE        220
! #define _APS_NEXT_COMMAND_VALUE         32790
  #define _APS_NEXT_CONTROL_VALUE         218
  #define _APS_NEXT_SYMED_VALUE           104
--- 72,76 ----
  #ifndef APSTUDIO_READONLY_SYMBOLS
  #define _APS_NEXT_RESOURCE_VALUE        220
! #define _APS_NEXT_COMMAND_VALUE         32794
  #define _APS_NEXT_CONTROL_VALUE         218
  #define _APS_NEXT_SYMED_VALUE           104



More information about the GME-commit mailing list