[GME-commit] GMESRC/GME/MgaUtil ClosureSimple.cpp,1.1,1.2 ClosureSimple.h,1.1,1.2 MakeSimpleClosure.cpp,1.1,1.2 MakeSimpleClosure.h,1.1,1.2 MgaClosure.cpp,1.8,1.9 MgaUtil.rc,1.49,1.50 resource.h,1.30,1.31

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Thu Jul 21 17:56:46 CDT 2005


Update of /project/gme-repository/GMESRC/GME/MgaUtil
In directory escher:/tmp/cvs-serv1410

Modified Files:
	ClosureSimple.cpp ClosureSimple.h MakeSimpleClosure.cpp 
	MakeSimpleClosure.h MgaClosure.cpp MgaUtil.rc resource.h 
Log Message:
Introducing kind filter feature into smartcopy.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: ClosureSimple.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/ClosureSimple.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ClosureSimple.cpp	19 Jul 2005 17:35:17 -0000	1.1
--- ClosureSimple.cpp	21 Jul 2005 16:56:44 -0000	1.2
***************
*** 16,19 ****
--- 16,23 ----
  	, m_bCont(FALSE)
  	, m_bFoldCont(FALSE)
+ 	, m_bConn(FALSE)
+ 	, m_bRef(FALSE)
+ 	, m_bAtom(FALSE)
+ 	, m_bSet(FALSE)
  {
  }
***************
*** 30,33 ****
--- 34,41 ----
  	DDX_Check(pDX, IDC_CHECK1, m_bCont);
  	DDX_Check(pDX, IDC_CHECK6, m_bFoldCont);
+ 	DDX_Check(pDX, IDC_EXCONN, m_bConn);
+ 	DDX_Check(pDX, IDC_EXREF, m_bRef);
+ 	DDX_Check(pDX, IDC_EXATOM, m_bAtom);
+ 	DDX_Check(pDX, IDC_EXSET, m_bSet);
  }
  
***************
*** 52,54 ****
  	              // EXCEPTION: OCX Property Pages should return FALSE
  }
- 
--- 60,61 ----

Index: MgaUtil.rc
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/MgaUtil.rc,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** MgaUtil.rc	19 Jul 2005 17:35:17 -0000	1.49
--- MgaUtil.rc	21 Jul 2005 16:56:44 -0000	1.50
***************
*** 563,567 ****
  END
  
! IDD_CLOSURESIMPLECP DIALOGEX 0, 0, 186, 55
  STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | 
      WS_SYSMENU
--- 563,567 ----
  END
  
! IDD_CLOSURESIMPLECP DIALOGEX 0, 0, 186, 90
  STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | 
      WS_SYSMENU
***************
*** 572,579 ****
      PUSHBUTTON      "Cancel",IDCANCEL,129,24,50,14
      CONTROL         "Containment",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | 
!                     WS_TABSTOP,16,16,79,10
      CONTROL         "Folder Containment",IDC_CHECK6,"Button",BS_AUTOCHECKBOX | 
!                     WS_TABSTOP,16,33,79,10
!     GROUPBOX        "Process down through",IDC_STATIC,7,3,109,46
  END
  
--- 572,588 ----
      PUSHBUTTON      "Cancel",IDCANCEL,129,24,50,14
      CONTROL         "Containment",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | 
!                     WS_TABSTOP,16,13,79,10
      CONTROL         "Folder Containment",IDC_CHECK6,"Button",BS_AUTOCHECKBOX | 
!                     WS_TABSTOP,16,25,79,10
!     CONTROL         "Connections",IDC_EXCONN,"Button",BS_AUTOCHECKBOX | 
!                     WS_TABSTOP,16,53,55,10
!     CONTROL         "References",IDC_EXREF,"Button",BS_AUTOCHECKBOX | 
!                     WS_TABSTOP,16,65,53,10
!     CONTROL         "Atoms",IDC_EXATOM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
!                     76,53,34,10
!     CONTROL         "Sets",IDC_EXSET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
!                     76,65,30,10
!     GROUPBOX        "Process down through",IDC_STATIC,7,3,108,35
!     GROUPBOX        "Exclude",IDC_STATIC,7,42,108,40
  END
  
***************
*** 821,825 ****
          RIGHTMARGIN, 179
          TOPMARGIN, 7
!         BOTTOMMARGIN, 48
      END
  END
--- 830,834 ----
          RIGHTMARGIN, 179
          TOPMARGIN, 7
!         BOTTOMMARGIN, 83
      END
  END

Index: MgaClosure.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/MgaClosure.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** MgaClosure.cpp	19 Jul 2005 17:35:17 -0000	1.8
--- MgaClosure.cpp	21 Jul 2005 16:56:44 -0000	1.9
***************
*** 190,195 ****
  	dlg.m_enableFolderChkBox = any_fold;
  
! 	// remain silent if no user interaction needed really
! 	if( any_cont) res = dlg.DoModal() == IDOK;
  
  	if( res)
--- 190,194 ----
  	dlg.m_enableFolderChkBox = any_fold;
  
! 	res = dlg.DoModal() == IDOK;
  
  	if( res)
***************
*** 200,203 ****
--- 199,206 ----
  			, dlg.m_bCont     // need containment?
  			, dlg.m_bFoldCont // need folder containment?
+ 			, dlg.m_bAtom == TRUE // exclude atoms?
+ 			, dlg.m_bConn == TRUE //  -//-   conns?
+ 			, dlg.m_bRef == TRUE  //  -//-   refs?
+ 			, dlg.m_bSet == TRUE  //  -//-   sets?
  			);
  

Index: ClosureSimple.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/ClosureSimple.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ClosureSimple.h	19 Jul 2005 17:35:17 -0000	1.1
--- ClosureSimple.h	21 Jul 2005 16:56:44 -0000	1.2
***************
*** 17,20 ****
--- 17,21 ----
  	bool m_enableContainChkBox;
  	bool m_enableFolderChkBox;
+ 
  protected:
  	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
***************
*** 27,29 ****
--- 28,38 ----
  	BOOL m_bFoldCont;
  	
+ 	// exclude connections?
+ 	BOOL m_bConn;
+ 	// exclude references?
+ 	BOOL m_bRef;
+ 	// exclude atoms?
+ 	BOOL m_bAtom;
+ 	// exclude sets?
+ 	BOOL m_bSet;
  };

Index: resource.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/resource.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** resource.h	19 Jul 2005 17:35:17 -0000	1.30
--- resource.h	21 Jul 2005 16:56:44 -0000	1.31
***************
*** 197,200 ****
--- 197,204 ----
  #define IDC_SHOWHIDEBUTTON              2260
  #define IDC_REDERIVEBUTTON              2261
+ #define IDC_EXCONN                      2262
+ #define IDC_EXREF                       2263
+ #define IDC_EXATOM                      2264
+ #define IDC_EXSET                       2265
  #define ID_CNTX_ADDNODE                 32774
  #define ID_CNTX_CLEARNODE               32775
***************
*** 208,212 ****
  #define _APS_NEXT_RESOURCE_VALUE        2071
  #define _APS_NEXT_COMMAND_VALUE         32778
! #define _APS_NEXT_CONTROL_VALUE         2262
  #define _APS_NEXT_SYMED_VALUE           2091
  #endif
--- 212,216 ----
  #define _APS_NEXT_RESOURCE_VALUE        2071
  #define _APS_NEXT_COMMAND_VALUE         32778
! #define _APS_NEXT_CONTROL_VALUE         2266
  #define _APS_NEXT_SYMED_VALUE           2091
  #endif

Index: MakeSimpleClosure.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/MakeSimpleClosure.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MakeSimpleClosure.h	19 Jul 2005 17:35:17 -0000	1.1
--- MakeSimpleClosure.h	21 Jul 2005 16:56:44 -0000	1.2
***************
*** 12,15 ****
--- 12,19 ----
  			, int containment
  			, int folder_containment
+ 			, bool excl_atom
+ 			, bool excl_conn
+ 			, bool excl_ref
+ 			, bool excl_set
  			)
  		: CMakeClosure
***************
*** 33,36 ****
--- 37,44 ----
  			, -1 //all kinds
  			)
+ 		, m_bExclAtom( excl_atom)
+ 		, m_bExclConn( excl_conn)
+ 		, m_bExclRef( excl_ref)
+ 		, m_bExclSet( excl_set)
  	{ }
  
***************
*** 43,49 ****
--- 51,62 ----
  	/*virtual*/ void preProcess();
  	/*virtual*/ void postProcess();
+ 	bool removeExcludedKinds();
  	void manageGuid( CComObjPtr<IMgaObject> obj);
  
   protected:
+ 	bool m_bExclAtom;
+ 	bool m_bExclConn;
+ 	bool m_bExclRef;
+ 	bool m_bExclSet;
  
  };

Index: MakeSimpleClosure.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/MakeSimpleClosure.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MakeSimpleClosure.cpp	19 Jul 2005 17:35:17 -0000	1.1
--- MakeSimpleClosure.cpp	21 Jul 2005 16:56:44 -0000	1.2
***************
*** 104,107 ****
--- 104,114 ----
  void CSimpleSelectClosure::postProcess()
  {
+ 	//remove specified unneeded kinds 
+ 	if( removeExcludedKinds()) 
+ 	{   // all objects were removed by the filter
+ 		send2Console( "[Smart Copy] No object in selection.");
+ 		return;
+ 	}
+ 
  	// sort the elements based on: basetypes first, connections last rule
  	std::sort( m_selFcos.begin(), m_selFcos.end(), ConnsAndDerivsLast());
***************
*** 120,123 ****
--- 127,159 ----
  	if( !res_str.empty()) send2Console( "[Smart Copy] The following kinds may accept the copied data: " + res_str + ".");
  	else send2Console( "[Smart Copy] Possible accepting kind not found based on the meta.");
+ }
+ 
+ bool CSimpleSelectClosure::removeExcludedKinds()
+ {
+ 	// we filter out the excluded kinds even from the initially selected objects
+ 	// that is why we don't use the base's kindfilter mechanism (that filters out
+ 	// only children of models, folders)
+ 	// worth to mention: connections are initially selected by the GUI if both of
+ 	// their ends is selected also, thus it may happen that the user would like
+ 	// connections excluded, but if they are initially selected by the mechanism
+ 	// outlined above then the base's filter would not catch that
+ 	CComObjPtrVector<IMgaFCO>::iterator it = m_selFcos.begin();
+ 	while( it != m_selFcos.end())
+ 	{
+ 		CComQIPtr<IMgaAtom> a = *it;
+ 		CComQIPtr<IMgaConnection> c = *it;
+ 		CComQIPtr<IMgaReference> r = *it;
+ 		CComQIPtr<IMgaSet> s = *it;
+ 
+ 		if( m_bExclAtom && a // if atom and atoms need to be excluded OR
+ 		 || m_bExclConn && c // ...
+ 		 || m_bExclRef  && r
+ 		 || m_bExclSet  && s)
+ 			it = m_selFcos.erase( it); // erase will step forward the iterator
+ 		else
+ 			++it;
+ 	}
+ 	
+ 	return m_selFcos.size() + m_selFolds.size() == 0; // all objects were removed by the filter
  }
  



More information about the GME-commit mailing list