[GME-commit] GMESRC/GME/GMEActiveBrowser AggregateContextMenu.cpp,1.19,1.20 AggregateContextMenu.h,1.4,1.5 AggregateTreeCtrl.cpp,1.20,1.21 AggregateTreeCtrl.h,1.5,1.6 GMEActiveBrowser.rc,1.9,1.10 resource.h,1.6,1.7

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Wed Jan 5 13:58:22 CST 2005


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

Modified Files:
	AggregateContextMenu.cpp AggregateContextMenu.h 
	AggregateTreeCtrl.cpp AggregateTreeCtrl.h GMEActiveBrowser.rc 
	resource.h 
Log Message:
Paste Special menu introduced in activebrowser


CVS User: zolmol

Index: AggregateContextMenu.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/GMEActiveBrowser/AggregateContextMenu.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** AggregateContextMenu.cpp	13 Oct 2004 15:17:54 -0000	1.19
--- AggregateContextMenu.cpp	5 Jan 2005 19:58:11 -0000	1.20
***************
*** 86,89 ****
--- 86,93 ----
  			case ID_EDIT_COPYSMART:		OnEditCopySmart();break;
  			case ID_EDIT_PASTE:			OnEditPaste();break;
+ 			case ID_EDIT_PASTESPECIAL_ASREFERENCE:			OnEditPasteSpecialAsReference();break;
+ 			case ID_EDIT_PASTESPECIAL_ASSUBTYPE:			OnEditPasteSpecialAsSubtype();break;
+ 			case ID_EDIT_PASTESPECIAL_ASINSTANCE:			OnEditPasteSpecialAsInstance();break;
+ 			case ID_EDIT_PASTECLOSURE:	OnEditPasteClosure();break;
  			case ID_POPUP_EDIT_DELETE:	OnEditDelete();break;
  
***************
*** 289,292 ****
--- 293,364 ----
  	{
  		if(!m_pParent->m_TreeAggregate.DoDrop(DRAGOP_COPY,&OleDataObject,CPoint(0,0)))
+ 		{
+ 			m_pParent->MessageBox("Cannot paste data from the clipboard. Please select valid target item.","Paste Error",MB_ICONERROR);
+ 		}
+ 	}
+ }
+ 
+ void CAggregateContextMenu::OnEditPasteSpecialAsReference()
+ {
+ 	COleDataObject OleDataObject;
+ 
+ 	if (OleDataObject.AttachClipboard() == FALSE) 
+ 	{
+ 		m_pParent->MessageBox("Cannot recover data from the clipboard.","Paste Error",MB_ICONERROR);
+ 	}
+ 	else
+ 	{
+ 		if(!m_pParent->m_TreeAggregate.DoDrop(DRAGOP_REFERENCE,&OleDataObject,CPoint(0,0)))
+ 		{
+ 			m_pParent->MessageBox("Cannot paste data from the clipboard. Please select valid target item.","Paste Error",MB_ICONERROR);
+ 		}
+ 	}
+ }
+ 
+ void CAggregateContextMenu::OnEditPasteSpecialAsSubtype()
+ {
+ 	COleDataObject OleDataObject;
+ 
+ 	if (OleDataObject.AttachClipboard() == FALSE) 
+ 	{
+ 		m_pParent->MessageBox("Cannot recover data from the clipboard.","Paste Error",MB_ICONERROR);
+ 	}
+ 	else
+ 	{
+ 		if(!m_pParent->m_TreeAggregate.DoDrop(DRAGOP_SUBTYPE,&OleDataObject,CPoint(0,0)))
+ 		{
+ 			m_pParent->MessageBox("Cannot paste data from the clipboard. Please select valid target item.","Paste Error",MB_ICONERROR);
+ 		}
+ 	}
+ }
+ 
+ void CAggregateContextMenu::OnEditPasteSpecialAsInstance()
+ {
+ 	COleDataObject OleDataObject;
+ 
+ 	if (OleDataObject.AttachClipboard() == FALSE) 
+ 	{
+ 		m_pParent->MessageBox("Cannot recover data from the clipboard.","Paste Error",MB_ICONERROR);
+ 	}
+ 	else
+ 	{
+ 		if(!m_pParent->m_TreeAggregate.DoDrop(DRAGOP_INSTANCE,&OleDataObject,CPoint(0,0)))
+ 		{
+ 			m_pParent->MessageBox("Cannot paste data from the clipboard. Please select valid target item.","Paste Error",MB_ICONERROR);
+ 		}
+ 	}
+ }
+ 
+ void CAggregateContextMenu::OnEditPasteClosure()
+ {
+ 	COleDataObject OleDataObject;
+ 
+ 	if (OleDataObject.AttachClipboard() == FALSE) 
+ 	{
+ 		m_pParent->MessageBox("Cannot recover data from the clipboard.","Paste Error",MB_ICONERROR);
+ 	}
+ 	else
+ 	{
+ 		if(!m_pParent->m_TreeAggregate.DoDropWithoutChecking(DRAGOP_COPY,&OleDataObject,CPoint(0,0)))
  		{
  			m_pParent->MessageBox("Cannot paste data from the clipboard. Please select valid target item.","Paste Error",MB_ICONERROR);

Index: AggregateContextMenu.h
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/GMEActiveBrowser/AggregateContextMenu.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** AggregateContextMenu.h	27 Sep 2004 21:54:46 -0000	1.4
--- AggregateContextMenu.h	5 Jan 2005 19:58:12 -0000	1.5
***************
*** 48,51 ****
--- 48,55 ----
  	void OnEditDelete();
  	void OnEditPaste();
+ 	void OnEditPasteSpecialAsReference();
+ 	void OnEditPasteSpecialAsSubtype();
+ 	void OnEditPasteSpecialAsInstance();
+ 	void OnEditPasteClosure();
  	void OnEditCopy();
  	void OnEditCopyClosure();

Index: AggregateTreeCtrl.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/GMEActiveBrowser/AggregateTreeCtrl.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** AggregateTreeCtrl.cpp	29 Oct 2004 16:12:58 -0000	1.20
--- AggregateTreeCtrl.cpp	5 Jan 2005 19:58:12 -0000	1.21
***************
*** 736,742 ****
  }
  
! BOOL CAggregateTreeCtrl::DoDrop(eDragOperation doDragOp, COleDataObject *pDataObject, CPoint point)
  {
  	MGATREECTRL_LOGEVENT("CAggregateTreeCtrl::DoDrop\r\n");
  
  	HTREEITEM hItem= GetSelectedItem();
--- 736,755 ----
  }
  
! BOOL CAggregateTreeCtrl::DoDrop(eDragOperation doDragOp, COleDataObject *pDataObject, CPoint point, bool copy_closure, bool disable_constr_manag)
  {
  	MGATREECTRL_LOGEVENT("CAggregateTreeCtrl::DoDrop\r\n");
+ 	CString _t = "";
+ 	if( doDragOp == DRAGOP_REFERENCE)
+ 		_t = " REFERENCE\r\n";
+ 	if( doDragOp == DRAGOP_SUBTYPE)
+ 		_t = " DERIVE\r\n";
+ 	if( doDragOp == DRAGOP_INSTANCE)
+ 		_t = " INSTANCE\r\n";
+ 	if( doDragOp == DRAGOP_COPY && copy_closure)
+ 		_t = " CLOSURE PASTE\r\n";
+ 	else if( doDragOp == DRAGOP_COPY && !copy_closure)
+ 		_t = " PASTE\r\n";
+ 
+ 	MGATREECTRL_LOGEVENT( _t);
  
  	HTREEITEM hItem= GetSelectedItem();
***************
*** 773,781 ****
  		}
  			
! 		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;
--- 786,794 ----
  		}
  			
! 		if( disable_constr_manag && pMgaContext && pMgaContext->m_ccpConstMgr) COMTHROW( pMgaContext->m_ccpConstMgr->Enable( false));
  
  		bool res = CGMEDataSource::ParseXMLData(pDataObject, ccpTargetObject);
  		
! 		if( disable_constr_manag && pMgaContext && pMgaContext->m_ccpConstMgr) COMTHROW( pMgaContext->m_ccpConstMgr->Enable( true));
  
  		return res?TRUE:FALSE;
***************
*** 992,1014 ****
  							MGACOLL_ITERATE(IMgaFCO,ccpDroppedFCOs)
  							{
! 								CComPtr<IMgaMetaRole> ccpNewMetaRole;
! 								COMTHROW( ccpMgaResolver->get_RefRoleByMeta(ccpTargetModel, NULL, MGACOLL_ITER, &ccpNewMetaRole) );
! 
! 								// Creating name for the new reference:
! 								// ReferencedName+"Ref"
! 								bszSourceName.Empty();
! 								COMTHROW( MGACOLL_ITER->get_Name(&bszSourceName) );
! 								CString strSourceName(bszSourceName);
! 								strSourceName += "Ref";
! 								bszSourceName = strSourceName;
  
! 								CComPtr<IMgaFCO> ccpNewFCO;
  
! 								COMTHROW( ccpTargetModel->CreateReference(ccpNewMetaRole,MGACOLL_ITER,&ccpNewFCO) );
  
! 								ASSERT(ccpNewFCO != NULL);
  
! 								//Rename
! 								COMTHROW( ccpNewFCO->put_Name(bszSourceName));
  							}MGACOLL_ITERATE_END;
  							
--- 1005,1039 ----
  							MGACOLL_ITERATE(IMgaFCO,ccpDroppedFCOs)
  							{
! 								//-acquiring a pointer in the active territory for MGACOLL_ITER
! 								CComPtr<IMgaFCO> ccpFCO;
! 								COMTHROW(pMgaContext->m_ccpTerritory->OpenFCO(MGACOLL_ITER, &ccpFCO));
  
! 								CComPtr<IMgaConnection> conn;
! 								if(ccpFCO.QueryInterface(&conn) != S_OK) { // skip connections, they cannot be referenced
! 									CComPtr<IMgaMetaRole> ccpNewMetaRole;
! 									COMTHROW( ccpMgaResolver->get_RefRoleByMeta(ccpTargetModel, NULL, ccpFCO, &ccpNewMetaRole) );
  
! 									if(ccpNewMetaRole == 0)
! 									{
! 										MGATREECTRL_LOGEVENT("    Cannot create reference.\r\n");
! 									}
! 									else {
! 										CComPtr<IMgaFCO> ccpNewFCO;
! 										COMTHROW( ccpTargetModel->CreateReference(ccpNewMetaRole,ccpFCO,&ccpNewFCO) );
! 										ASSERT(ccpNewFCO != NULL);
  
! 										// Creating name for the new reference:
! 										bszSourceName.Empty();
! 										COMTHROW( ccpFCO->get_Name(&bszSourceName) );
! 										/*
! 										// ReferencedName+"Ref"
! 										CString strSourceName(bszSourceName);
! 										strSourceName += "Ref";
! 										bszSourceName = strSourceName;*/ // commented by zolmol according to DoPasteNative() logic in GMEView.cpp 
  
! 										//Rename
! 										COMTHROW( ccpNewFCO->put_Name(bszSourceName));
! 									}
! 								}
  							}MGACOLL_ITERATE_END;
  							
***************
*** 1016,1065 ****
  				}break;
  				case DRAGOP_INSTANCE:
  				{
! 					CComPtr<IMgaMetaRole> ccpNewMetaRole;
! 					CComPtr<IMgaMetaRole> ccpOldMetaRole;
! 					CComPtr<IMgaMetaFCO> ccpMetaFCO;
! 
  					MGACOLL_ITERATE(IMgaFCO,ccpDroppedFCOs) {
  						
! 						COMTHROW( MGACOLL_ITER->get_Meta(&ccpMetaFCO) );
! 						ASSERT( ccpMetaFCO != NULL);
! 
! 						// Old role can be NULL
! 						COMTHROW( MGACOLL_ITER->get_MetaRole(&ccpOldMetaRole) );
! 						
! 						
! 						COMTHROW( ccpMgaResolver->get_RoleByMeta(ccpTargetModel, ccpMetaFCO, OBJTYPE_NULL, ccpOldMetaRole, NULL, &ccpNewMetaRole) );
! 						CComPtr<IMgaFCO> ccpNewFCO;
! 						COMTHROW( ccpTargetModel->DeriveChildObject(MGACOLL_ITER,ccpNewMetaRole,VARIANT_TRUE,&ccpNewFCO) );
! 
! 					}
! 					MGACOLL_ITERATE_END;
  
! 				}break;
! 				case DRAGOP_SUBTYPE:
! 				{
! 		
! 					CComPtr<IMgaMetaRole> ccpNewMetaRole;
! 					CComPtr<IMgaMetaRole> ccpOldMetaRole;
! 					CComPtr<IMgaMetaFCO> ccpMetaFCO;
  
! 					MGACOLL_ITERATE(IMgaFCO,ccpDroppedFCOs) {
! 						
! 						COMTHROW( MGACOLL_ITER->get_Meta(&ccpMetaFCO) );
  						ASSERT( ccpMetaFCO != NULL);
  
  						// Old role can be NULL
! 						COMTHROW( MGACOLL_ITER->get_MetaRole(&ccpOldMetaRole) );
! 						
  						
  						COMTHROW( ccpMgaResolver->get_RoleByMeta(ccpTargetModel, ccpMetaFCO, OBJTYPE_NULL, ccpOldMetaRole, NULL, &ccpNewMetaRole) );
! 						CComPtr<IMgaFCO> ccpNewFCO;
! 						COMTHROW( ccpTargetModel->DeriveChildObject(MGACOLL_ITER,ccpNewMetaRole,VARIANT_FALSE,&ccpNewFCO) );
  
  					}
  					MGACOLL_ITERATE_END;
  
! 
  				}break;
  				
--- 1041,1086 ----
  				}break;
  				case DRAGOP_INSTANCE:
+ 				case DRAGOP_SUBTYPE:
  				{
! 					HRESULT hr = S_OK;
  					MGACOLL_ITERATE(IMgaFCO,ccpDroppedFCOs) {
  						
! 						//-acquiring a pointer in the active territory for MGACOLL_ITER
! 						CComPtr<IMgaFCO> ccpFCO;
! 						COMTHROW(pMgaContext->m_ccpTerritory->OpenFCO(MGACOLL_ITER, &ccpFCO));
  
! 						CComBSTR bstr;
! 						COMTHROW(ccpFCO->get_Name(&bstr));
! 						CString fcoName;
! 						CopyTo(bstr,fcoName);
  
! 						CComPtr<IMgaMetaFCO> ccpMetaFCO;
! 						COMTHROW( ccpFCO->get_Meta(&ccpMetaFCO) );
  						ASSERT( ccpMetaFCO != NULL);
  
  						// Old role can be NULL
! 						CComPtr<IMgaMetaRole> ccpOldMetaRole;
! 						COMTHROW( ccpFCO->get_MetaRole(&ccpOldMetaRole) );
  						
+ 						CComPtr<IMgaMetaRole> ccpNewMetaRole;
  						COMTHROW( ccpMgaResolver->get_RoleByMeta(ccpTargetModel, ccpMetaFCO, OBJTYPE_NULL, ccpOldMetaRole, NULL, &ccpNewMetaRole) );
! 						if(ccpNewMetaRole == 0)
! 						{
! 							MGATREECTRL_LOGEVENT("    Cannot insert object derived from "+fcoName+"\r\n");
! 						}
! 						else {
! 							CComPtr<IMgaFCO> ccpNewFCO;
! 							VARIANT_BOOL inst = doDragOp == DRAGOP_INSTANCE? VARIANT_TRUE : VARIANT_FALSE;
! 							if((hr = ccpTargetModel->DeriveChildObject(ccpFCO,ccpNewMetaRole, inst ,&ccpNewFCO)) != S_OK) {
! 								MGATREECTRL_LOGEVENT("    "+fcoName+" cannot be derived.\r\n");
! 								COMTHROW( hr);
! 								break;
! 							}
! 						}
  
  					}
  					MGACOLL_ITERATE_END;
  
! 					bRetVal=TRUE;
  				}break;
  				
***************
*** 1073,1076 ****
--- 1094,1103 ----
  
  	return bRetVal;
+ }
+ 
+ BOOL CAggregateTreeCtrl::DoDropWithoutChecking(eDragOperation doDragOp, COleDataObject *pDataObject, CPoint point)
+ {
+ 	MGATREECTRL_LOGEVENT("CAggregateTreeCtrl::DoDropWithoutChecking\r\n");
+ 	return DoDrop( doDragOp, pDataObject, point, true, true);
  }
  

Index: AggregateTreeCtrl.h
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/GMEActiveBrowser/AggregateTreeCtrl.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** AggregateTreeCtrl.h	29 Oct 2004 16:12:58 -0000	1.5
--- AggregateTreeCtrl.h	5 Jan 2005 19:58:12 -0000	1.6
***************
*** 26,30 ****
      
  	void SetItemProperties(HTREEITEM hItem);
! 	BOOL DoDrop(eDragOperation doDragOp, COleDataObject *pDataObject, CPoint point);
  	BOOL IsRelevantDropTarget(CPoint point,CImageList*);
  	void RestoreState();
--- 26,31 ----
      
  	void SetItemProperties(HTREEITEM hItem);
! 	BOOL DoDrop(eDragOperation doDragOp, COleDataObject *pDataObject, CPoint point, bool copy_closure = false, bool disable_constr_manag = false);
! 	BOOL DoDropWithoutChecking(eDragOperation doDragOp, COleDataObject *pDataObject, CPoint point);
  	BOOL IsRelevantDropTarget(CPoint point,CImageList*);
  	void RestoreState();

Index: GMEActiveBrowser.rc
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/GMEActiveBrowser/GMEActiveBrowser.rc,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** GMEActiveBrowser.rc	27 Sep 2004 21:54:46 -0000	1.9
--- GMEActiveBrowser.rc	5 Jan 2005 19:58:12 -0000	1.10
***************
*** 362,365 ****
--- 362,375 ----
          MENUITEM "Copy &Smart",                 ID_EDIT_COPYSMART
          MENUITEM "&Paste",                      ID_EDIT_PASTE
+         POPUP "Pas&te Special"
+         BEGIN
+             MENUITEM "As Reference",                ID_EDIT_PASTESPECIAL_ASREFERENCE
+ 
+             MENUITEM "As Subtype",                  ID_EDIT_PASTESPECIAL_ASSUBTYPE
+ 
+             MENUITEM "As Instance",                 ID_EDIT_PASTESPECIAL_ASINSTANCE
+ 
+             MENUITEM "Closure/Smart",               ID_EDIT_PASTECLOSURE
+         END
          MENUITEM SEPARATOR
          MENUITEM "Delete",                      ID_POPUP_EDIT_DELETE

Index: resource.h
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/GMEActiveBrowser/resource.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** resource.h	27 Sep 2004 21:54:46 -0000	1.6
--- resource.h	5 Jan 2005 19:58:12 -0000	1.7
***************
*** 66,69 ****
--- 66,73 ----
  #define ID_EDIT_COPYSMART               32790
  #define ID_POPUP_SELECTCOPY_CONNECTIONS 32793
+ #define ID_EDIT_PASTECLOSURE            32795
+ #define ID_EDIT_PASTESPECIAL_ASSUBTYPE  32796
+ #define ID_EDIT_PASTESPECIAL_ASINSTANCE 32797
+ #define ID_EDIT_PASTESPECIAL_ASREFERENCE 32798
  
  // Next default values for new objects
***************
*** 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
--- 76,80 ----
  #ifndef APSTUDIO_READONLY_SYMBOLS
  #define _APS_NEXT_RESOURCE_VALUE        220
! #define _APS_NEXT_COMMAND_VALUE         32799
  #define _APS_NEXT_CONTROL_VALUE         218
  #define _APS_NEXT_SYMED_VALUE           104



More information about the GME-commit mailing list