[GME-commit]
GMESRC/GME/MgaUtil ClosureDlg.cpp,1.5,1.6 ClosureDlg.h,1.4,1.5
MgaClosure.cpp,1.6,1.7 MgaClosure.h,1.3,1.4
gme-commit at list.isis.vanderbilt.edu
gme-commit at list.isis.vanderbilt.edu
Wed Apr 13 00:37:33 CDT 2005
Update of /project/gme-repository/GMESRC/GME/MgaUtil
In directory escher:/tmp/cvs-serv20648
Modified Files:
ClosureDlg.cpp ClosureDlg.h MgaClosure.cpp MgaClosure.h
Log Message:
ClosureDialog and ClosureCalculation may be invoked separately through COM.
CVS User: Zoltan Molnar, ISIS (zolmol)
Index: MgaClosure.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/MgaClosure.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** MgaClosure.h 27 Sep 2004 21:50:53 -0000 1.3
--- MgaClosure.h 12 Apr 2005 23:37:31 -0000 1.4
***************
*** 23,28 ****
// ------- Properties
! STDMETHOD(SelectiveClosure)( IMgaFCOs *in_fcos, IMgaFolders *in_folders, IMgaFCOs **sel_fcos, IMgaFolders **sel_folders, IMgaFCOs **top_fcos, IMgaFolders **top_folders, int fc, long * options, BSTR *acckinds);
! STDMETHOD(SmartCopy)( IMgaFCOs *in_fcos, IMgaFolders *in_folders, IMgaFCOs **sel_fcos, IMgaFolders **sel_folders, IMgaFCOs **top_fcos, IMgaFolders **top_folders, int options_in, long * options, BSTR *acckinds, BSTR *path);
// ------- Attributes and Methods
--- 23,75 ----
// ------- Properties
! STDMETHOD(SelectiveClosureDlg)
! ( VARIANT_BOOL p_folderContainmentNeeded
! , VARIANT_BOOL* p_refersTo , VARIANT_BOOL* p_referredBy
! , VARIANT_BOOL* p_connections , VARIANT_BOOL* p_connsThroughRefport
! , VARIANT_BOOL* p_setMembers , VARIANT_BOOL* p_memberOfSets
! , VARIANT_BOOL* p_modelContainment , VARIANT_BOOL* p_partOfModels
! , VARIANT_BOOL* p_folderContainment , VARIANT_BOOL* p_partOfFolders
! , VARIANT_BOOL* p_baseTypeOf , VARIANT_BOOL* p_derivedTypesOf
! , long* p_libraryElementHandling // 0: stubs, 1: stop, 2: continue
! , long* p_wrappingMode // 0: miniproject, 1: automatic, 2: as is
! , long* p_kindFilter // -1 = all, otherwise calculate the 0b000rsamf mask, where f = Folders, m = Models, a = Atoms, s = Sets, r = References
! , long* p_options
! , VARIANT_BOOL* p_directionDown
! , VARIANT_BOOL* p_copyToFile // file or clipboard
! , VARIANT_BOOL* p_okPressed // how ended the dialog
! , BSTR *p_userSelFileName
! );
!
! STDMETHOD(SelectiveClosureCalc)
! ( IMgaFCOs *p_initSelFcos , IMgaFolders *p_initSelFolders
! , VARIANT_BOOL p_refersTo , VARIANT_BOOL p_referredBy
! , VARIANT_BOOL p_connections , VARIANT_BOOL p_connsThroughRefport
! , VARIANT_BOOL p_setMembers , VARIANT_BOOL p_memberOfSets
! , VARIANT_BOOL p_modelContainment , VARIANT_BOOL p_partOfModels
! , VARIANT_BOOL p_folderContainment , VARIANT_BOOL p_partOfFolders
! , VARIANT_BOOL p_baseTypeOf , VARIANT_BOOL p_derivedTypesOf
! , long p_libraryElementHandling // 0: stubs, 1: stop, 2: continue
! , long p_wrapping // 0: miniproject, 1: automatic, 2: as is
! , long p_kindFilter // -1 = all, otherwise calculate the 0b000rsamf mask, where f = Folders, m = Models, a = Atoms, s = Sets, r = References
! , VARIANT_BOOL p_directionDown
! , IMgaFCOs **p_selFcos, IMgaFolders **p_selFolders
! , IMgaFCOs **p_topFcos, IMgaFolders **p_topFolders
! , VARIANT_BOOL* p_topCollectionsFilled
! , BSTR *p_acckinds
! );
!
! STDMETHOD(SmartCopy)
! ( IMgaFCOs *in_fcos
! , IMgaFolders *in_folders
! , IMgaFCOs **sel_fcos
! , IMgaFolders **sel_folders
! , IMgaFCOs **top_fcos
! , IMgaFolders **top_folders
! , int options_in
! , long * options
! , BSTR *acckinds
! , BSTR *path
! );
!
// ------- Attributes and Methods
Index: MgaClosure.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/MgaClosure.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** MgaClosure.cpp 13 Oct 2004 15:17:55 -0000 1.6
--- MgaClosure.cpp 12 Apr 2005 23:37:31 -0000 1.7
***************
*** 7,127 ****
#include "MakeClosure.h"
!
! STDMETHODIMP CMgaClosure::SelectiveClosure(
! IMgaFCOs *in_fcos, IMgaFolders *in_folders,
! IMgaFCOs **sel_fcos, IMgaFolders **sel_folders,
! IMgaFCOs **top_fcos, IMgaFolders **top_folders,
! int fc,
! long *pOptions,
! BSTR *pAcceptingKinds
! )
{
AFX_MANAGE_STATE( AfxGetStaticModuleState());
! ASSERT( pOptions);
CWaitCursor w;
CClosureDlg dlg;
! dlg.m_activeFolderContainment = fc != 0;
if ( dlg.DoModal() == IDOK)
{
! int kind_map = 0;//important to set it to 0
! if( dlg.m_includeAllKindsRadio == 0)
! kind_map = -1;//0xffffffff;
! else
! kind_map = kind_map
! | (dlg.m_includeFolders?0x1:0)
! | (dlg.m_includeModels?0x2:0)
! | (dlg.m_includeAtoms?0x4:0)
! | (dlg.m_includeSets?0x8:0)
! | (dlg.m_includeReferences?0x10:0);
!
! CMakeClosure mc(
! in_fcos, in_folders,
! dlg.m_bRefersTo, dlg.m_bReferredBy,
! dlg.m_bConnection, dlg.m_bRefPortConnection,
! dlg.m_bSetMember, dlg.m_bMemberOfSets,
! // compare the containment options with the direction option
! dlg.m_direction?dlg.m_bContainment:0, !dlg.m_direction?dlg.m_bPartOfModels:0,
! dlg.m_direction?dlg.m_bFolderContainment:0, !dlg.m_direction?dlg.m_bPartOfFolders:0,
! dlg.m_bBaseTypes, dlg.m_bDerivedTypes,
! //dlg.m_bDigIntoLibraries,
! dlg.m_libraryHandling /*== 2*/, // in case of "continue" ("go on") only
! dlg.m_wrappingOption,
! dlg.m_direction,
! kind_map);
!
! mc.process(); // do the hard job
!
! // load the results
! mc.getFCOs( sel_fcos);
! mc.getFolders( sel_folders);
! bool normal_tops = !mc.noTopObjs();
!
! if ( normal_tops) // the top fcos/folds is calculated and The RootFolder is not among them
! {
! mc.getTopFCOs( top_fcos);
! mc.getTopFolders( top_folders);
! }
!
! if( normal_tops && // avoid in case of non-normal tops
! dlg.m_wrappingOption > 0 && // avoid in case of miniproject
! mc.isAnyAccepting()) // avoid if is no accepting kind/folder
! {
! std::string res_str;
! //CClosureRes res_dlg;
! //res_dlg.m_metaKindsAndFolders = mc.getAccKindsVector();
! mc.getAccKindsInString( res_str);
! // shows the acc kinds in a dialog
! //res_dlg.DoModal();
! // shows the acc kinds in the console window
! //mc.send2Console( "[Closure] The following kinds may accept the closure:" + res_str + ".");
! CComBSTR acc_kind = res_str.c_str();
! *pAcceptingKinds = acc_kind.Detach();
! }
! *pOptions = 0;
! *pOptions = (dlg.m_libraryHandling == 0)?0x1:0; // in case of "stubs" set the options to 1
! if ( dlg.m_outputOption == 1) // dump to a file
! {
! CComPtr<IMgaDumper> dumper;
! COMTHROW( dumper.CoCreateInstance(L"Mga.MgaDumper") );
! switch( dlg.m_wrappingOption) {
! case 0:
! {
! COMTHROW( dumper->DumpClos( *sel_fcos, *sel_folders, PutInBstr( dlg.m_strOutputFile), *pOptions) );
! break;
! }
! case 1:
! case 2:
! {
! if ( normal_tops)
! COMTHROW( dumper->DumpClosR( *sel_fcos, *sel_folders, PutInBstr( dlg.m_strOutputFile), *top_fcos, *top_folders, *pOptions, 0, *pAcceptingKinds) );
! else
! // dump like in miniproject case from The RootFolder
! // if the data is copied to clipboard then the DumpClosR will call the
! // DumpClos when it will realize the topfco and topfolders are empty
! COMTHROW( dumper->DumpClos( *sel_fcos, *sel_folders, PutInBstr( dlg.m_strOutputFile), *pOptions) );
! *top_fcos = 0;
! *top_folders = 0;
! break;
! }
! } // switch
! *sel_fcos = 0;
! *sel_folders = 0;
! }
! // else: clipboard
}
return S_OK;
}
STDMETHODIMP CMgaClosure::SmartCopy(
--- 7,168 ----
#include "MakeClosure.h"
! STDMETHODIMP CMgaClosure::SelectiveClosureDlg
! ( VARIANT_BOOL p_folderContainmentNeeded
! , VARIANT_BOOL* p_refersTo , VARIANT_BOOL* p_referredBy
! , VARIANT_BOOL* p_connections , VARIANT_BOOL* p_connsThroughRefport
! , VARIANT_BOOL* p_setMembers , VARIANT_BOOL* p_memberOfSets
! , VARIANT_BOOL* p_modelContainment , VARIANT_BOOL* p_partOfModels
! , VARIANT_BOOL* p_folderContainment , VARIANT_BOOL* p_partOfFolders
! , VARIANT_BOOL* p_baseTypeOf , VARIANT_BOOL* p_derivedTypesOf
! , long* p_libraryElementHandling // 0: stubs, 1: stop, 2: continue
! , long* p_wrappingMode // 0: miniproject, 1: automatic, 2: as is
! , long* p_kindFilter // -1 = all, otherwise calculate the 0b000rsamf mask, where f = Folders, m = Models, a = Atoms, s = Sets, r = References
! , long* p_options
! , VARIANT_BOOL* p_directionDown
! , VARIANT_BOOL* p_copyToFile // file or clipboard
! , VARIANT_BOOL* p_okPressed // how ended the dialog
! , BSTR* p_userSelFileName
! )
{
AFX_MANAGE_STATE( AfxGetStaticModuleState());
!
! if
! ( !p_refersTo || !p_referredBy
! || !p_connections || !p_connsThroughRefport
! || !p_setMembers || !p_memberOfSets
! || !p_modelContainment || !p_partOfModels
! || !p_folderContainment || !p_partOfFolders
! || !p_baseTypeOf || !p_derivedTypesOf
! || !p_libraryElementHandling
! || !p_wrappingMode
! || !p_kindFilter
! || !p_options
! || !p_directionDown
! || !p_copyToFile
! || !p_okPressed
! || !p_userSelFileName)
! return E_INVALID_USAGE;
CWaitCursor w;
CClosureDlg dlg;
! dlg.m_activeFolderContainment = p_folderContainmentNeeded == VARIANT_TRUE;
! *p_okPressed = VARIANT_FALSE;
!
if ( dlg.DoModal() == IDOK)
{
! *p_refersTo = dlg.m_bRefersTo ? VARIANT_TRUE: VARIANT_FALSE;
! *p_referredBy = dlg.m_bReferredBy ? VARIANT_TRUE: VARIANT_FALSE;
! *p_connections = dlg.m_bConnection ? VARIANT_TRUE: VARIANT_FALSE;
! *p_connsThroughRefport = dlg.m_bRefPortConnection ? VARIANT_TRUE: VARIANT_FALSE;
! *p_setMembers = dlg.m_bSetMember ? VARIANT_TRUE: VARIANT_FALSE;
! *p_memberOfSets = dlg.m_bMemberOfSets ? VARIANT_TRUE: VARIANT_FALSE;
! *p_modelContainment = dlg.m_bContainment ? VARIANT_TRUE: VARIANT_FALSE;
! *p_partOfModels = dlg.m_bPartOfModels ? VARIANT_TRUE: VARIANT_FALSE;
! *p_folderContainment = dlg.m_bFolderContainment ? VARIANT_TRUE: VARIANT_FALSE;
! *p_partOfFolders = dlg.m_bPartOfFolders ? VARIANT_TRUE: VARIANT_FALSE;
! *p_baseTypeOf = dlg.m_bBaseTypes ? VARIANT_TRUE: VARIANT_FALSE;
! *p_derivedTypesOf = dlg.m_bDerivedTypes ? VARIANT_TRUE: VARIANT_FALSE;
! *p_libraryElementHandling = dlg.m_libraryHandling;
! *p_wrappingMode = dlg.m_wrappingOption;
! *p_kindFilter = dlg.calcKindMask();
! *p_options = (dlg.m_libraryHandling == 0)?0x1:0; // in case of "stubs" set the options to 1
! *p_directionDown = dlg.m_direction == 1 ? VARIANT_TRUE : VARIANT_FALSE;
! *p_copyToFile = dlg.m_outputOption == 1 ? VARIANT_TRUE : VARIANT_FALSE;
! *p_okPressed = VARIANT_TRUE;
! CComBSTR filename( dlg.m_strOutputFile);
! *p_userSelFileName = filename.Detach();
! }
! return S_OK;
! }
! STDMETHODIMP CMgaClosure::SelectiveClosureCalc
! ( IMgaFCOs *p_initSelFcos , IMgaFolders *p_initSelFolders
! , VARIANT_BOOL p_refersTo , VARIANT_BOOL p_referredBy
! , VARIANT_BOOL p_connections , VARIANT_BOOL p_connsThroughRefport
! , VARIANT_BOOL p_setMembers , VARIANT_BOOL p_memberOfSets
! , VARIANT_BOOL p_modelContainment , VARIANT_BOOL p_partOfModels
! , VARIANT_BOOL p_folderContainment , VARIANT_BOOL p_partOfFolders
! , VARIANT_BOOL p_baseTypeOf , VARIANT_BOOL p_derivedTypesOf
! , long p_libraryElementHandling // 0: stubs, 1: stop, 2: continue
! , long p_wrapping // 0: miniproject, 1: automatic, 2: as is
! , long p_kindFilter // -1 = all, otherwise calculate the 0b000rsamf mask, where f = Folders, m = Models, a = Atoms, s = Sets, r = References
! , VARIANT_BOOL p_directionDown
! , IMgaFCOs** p_selFcos, IMgaFolders** p_selFolders
! , IMgaFCOs** p_topFcos, IMgaFolders** p_topFolders
! , VARIANT_BOOL* p_topCollectionsFilled
! , BSTR* p_accKinds
! )
! {
! if
! ( ! p_selFcos
! || ! p_selFolders
! || ! p_topFcos
! || ! p_topFolders
! || ! p_topCollectionsFilled
! || ! p_accKinds)
! return E_INVALID_USAGE;
! int modcont = p_modelContainment == VARIANT_TRUE? 1: 0;
! int folcont = p_folderContainment == VARIANT_TRUE? 1: 0;
! int partmod = p_partOfModels == VARIANT_TRUE? 1: 0;
! int partfol = p_partOfFolders == VARIANT_TRUE? 1: 0;
! CMakeClosure mc
! ( p_initSelFcos
! , p_initSelFolders
! , p_refersTo == VARIANT_TRUE? 1 : 0
! , p_referredBy == VARIANT_TRUE? 1 : 0
! , p_connections == VARIANT_TRUE? 1 : 0
! , p_connsThroughRefport == VARIANT_TRUE? 1 : 0
! , p_setMembers == VARIANT_TRUE? 1 : 0
! , p_memberOfSets == VARIANT_TRUE? 1 : 0
! // compare the containment options with the direction option
! , p_directionDown == VARIANT_TRUE ? modcont:0
! , p_directionDown == VARIANT_FALSE ? partmod:0
! , p_directionDown == VARIANT_TRUE ? folcont:0
! , p_directionDown == VARIANT_FALSE ? partfol:0
! , p_baseTypeOf == VARIANT_TRUE ? 1: 0
! , p_derivedTypesOf == VARIANT_TRUE ? 1: 0
! , (int) p_libraryElementHandling // == 2 // in case of "continue" ("go on") only
! , (int) p_wrapping
! , p_directionDown == VARIANT_TRUE ? 1: 0
! , (int) p_kindFilter
! );
! mc.process(); // do the hard job
! // load the results
! mc.getFCOs( p_selFcos);
! mc.getFolders( p_selFolders);
! bool normal_tops = !mc.noTopObjs();
! if ( normal_tops) // the top fcos/folds is calculated and The RootFolder is not among them
! {
! mc.getTopFCOs( p_topFcos);
! mc.getTopFolders( p_topFolders);
!
! *p_topCollectionsFilled = VARIANT_TRUE;
! }
! else
! *p_topCollectionsFilled = VARIANT_FALSE;
!
! if( normal_tops && // avoid in case of non-normal tops
! p_wrapping > 0 && // avoid in case of miniproject
! mc.isAnyAccepting()) // avoid if is no accepting kind/folder
! {
! std::string res_str;
! mc.getAccKindsInString( res_str);
! CComBSTR acc_kind = res_str.c_str();
! *p_accKinds = acc_kind.Detach();
}
+
return S_OK;
}
+
STDMETHODIMP CMgaClosure::SmartCopy(
Index: ClosureDlg.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/ClosureDlg.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ClosureDlg.h 27 Sep 2004 21:50:53 -0000 1.4
--- ClosureDlg.h 12 Apr 2005 23:37:31 -0000 1.5
***************
*** 103,106 ****
--- 103,108 ----
bool m_includeSets;
bool m_includeReferences;
+
+ long calcKindMask();
};
Index: ClosureDlg.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/ClosureDlg.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ClosureDlg.cpp 28 Sep 2004 22:43:27 -0000 1.5
--- ClosureDlg.cpp 12 Apr 2005 23:37:31 -0000 1.6
***************
*** 308,309 ****
--- 308,325 ----
OnWrapMiniProj();
}
+
+ long CClosureDlg::calcKindMask()
+ {
+ long kind_map = 0;//important to set it to 0
+ if( m_includeAllKindsRadio == 0)
+ kind_map = -1;//0xffffffff;
+ else
+ kind_map = kind_map
+ | (m_includeFolders?0x1:0)
+ | (m_includeModels?0x2:0)
+ | (m_includeAtoms?0x4:0)
+ | (m_includeSets?0x8:0)
+ | (m_includeReferences?0x10:0);
+
+ return kind_map;
+ }
\ No newline at end of file
More information about the GME-commit
mailing list