[GME-commit] GMESRC/GME/MgaUtil ClosureDlg.cpp,1.7,1.8 MakeClosure.cpp,1.16,1.17 MgaClosure.cpp,1.10,1.11 MgaClosure.h,1.6,1.7

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Tue Aug 15 18:37:45 CDT 2006


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

Modified Files:
	ClosureDlg.cpp MakeClosure.cpp MgaClosure.cpp MgaClosure.h 
Log Message:
Put/GetLastClosureId methods introd.
Automatic closure id setting if needed.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: MgaClosure.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/MgaClosure.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** MgaClosure.h	8 Aug 2006 19:12:06 -0000	1.6
--- MgaClosure.h	15 Aug 2006 17:37:43 -0000	1.7
***************
*** 24,27 ****
--- 24,30 ----
  // ------- Properties
  
+ 	STDMETHOD(GetLastClosureId)( IMgaProject* p_project, long* p_pMarkWith);
+ 	STDMETHOD(PutLastClosureId)( IMgaProject* p_project, long  p_iMarkWith);
+ 
  	STDMETHOD(SelectiveClosureDlg)
  		( VARIANT_BOOL  p_folderContainmentNeeded
***************
*** 78,82 ****
  // ------- Attributes and Methods
  public:
! 
  };
  
--- 81,85 ----
  // ------- Attributes and Methods
  public:
! 	static const wchar_t* m_projLastClosureNode;
  };
  

Index: MgaClosure.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/MgaClosure.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** MgaClosure.cpp	8 Aug 2006 19:12:06 -0000	1.10
--- MgaClosure.cpp	15 Aug 2006 17:37:43 -0000	1.11
***************
*** 9,12 ****
--- 9,55 ----
  #include "MakeSimpleClosure.h"
  
+ const wchar_t* CMgaClosure::m_projLastClosureNode = L"lastClosureId";
+ 
+ STDMETHODIMP CMgaClosure::GetLastClosureId( IMgaProject* p_project, long* p_pMarkWith)
+ {
+ 	AFX_MANAGE_STATE( AfxGetStaticModuleState());
+ 	if( !p_pMarkWith) return E_INVALID_USAGE;
+ 	if( !p_project)   return E_INVALID_USAGE;
+ 
+ 	CComObjPtr<IMgaFolder> rf;
+ 	COMTHROW( p_project->get_RootFolder( PutOut( rf)));
+ 
+ 	CString cst0;
+ 	COMTHROW( rf->get_RegistryValue( CComBSTR( m_projLastClosureNode), PutOut( cst0)));
+ 	
+ 	int t_val = -1;
+ 	if( 1 == _stscanf( (LPCTSTR) cst0, "%i", &t_val))
+ 	{
+ 		*p_pMarkWith = t_val;
+ 	}
+ 	else
+ 	{
+ 		*p_pMarkWith = -1;
+ 	}
+ 
+ 	return S_OK;
+ }
+ 
+ STDMETHODIMP CMgaClosure::PutLastClosureId( IMgaProject* p_project, long p_iMarkWith)
+ {
+ 	AFX_MANAGE_STATE( AfxGetStaticModuleState());
+ 	if( !p_project)  return E_INVALID_USAGE;
+ 	if( p_iMarkWith == -1) return E_INVALID_USAGE;
+ 
+ 	CComObjPtr<IMgaFolder> rf;
+ 	COMTHROW( p_project->get_RootFolder( PutOut( rf)));
+ 
+ 	CString cst;
+ 	cst.Format( "%i", p_iMarkWith);
+ 
+ 	COMTHROW( rf->put_RegistryValue( CComBSTR( m_projLastClosureNode), CComBSTR( cst)));
+ 	return S_OK;
+ }
+ 
  STDMETHODIMP CMgaClosure::SelectiveClosureDlg
  	( VARIANT_BOOL  p_folderContainmentNeeded
***************
*** 51,54 ****
--- 94,98 ----
  	CClosureDlg dlg;
  	dlg.m_activeFolderContainment = p_folderContainmentNeeded == VARIANT_TRUE;
+ 	if( *p_markWith != -1) dlg.m_iMarkVal = *p_markWith;
  	*p_okPressed = VARIANT_FALSE;
  

Index: ClosureDlg.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/ClosureDlg.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ClosureDlg.cpp	8 Aug 2006 19:12:06 -0000	1.7
--- ClosureDlg.cpp	15 Aug 2006 17:37:43 -0000	1.8
***************
*** 151,154 ****
--- 151,160 ----
  
  	m_ctrlMarkVal.EnableWindow( m_bMarkObjs);
+ 	if( m_iMarkVal != -1)
+ 	{
+ 		TCHAR buf[12];
+ 		_stprintf( buf, "%i", m_iMarkVal);
+ 		m_ctrlMarkVal.SetWindowText( buf);
+ 	}
  
  	//m_bConnection = TRUE;

Index: MakeClosure.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/MakeClosure.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** MakeClosure.cpp	8 Aug 2006 19:12:06 -0000	1.16
--- MakeClosure.cpp	15 Aug 2006 17:37:43 -0000	1.17
***************
*** 691,699 ****
  		COMTHROW( obj->get_RegistryValue( CComBSTR( m_markerNode), &buf0));
  
! 		wchar_t buf1[12];
! 		swprintf( buf1, L",%i", m_markWith);
! 		buf0.Append( buf1);
  		
! 		COMTHROW( obj->put_RegistryValue( CComBSTR( m_markerNode), buf0));
  	}
  }
--- 691,710 ----
  		COMTHROW( obj->get_RegistryValue( CComBSTR( m_markerNode), &buf0));
  
! 		// check if the new marker appears already in the marker list
! 		std::string str_buf;
! 		CopyTo( buf0, str_buf);
! 
! 		char buf1[12];
! 		sprintf( buf1, ",%i", m_markWith);
! 		std::string new_mrk( buf1);
! 
! 		str_buf += ","; // will ease the eos comparison
! 		new_mrk += ","; // and the exact match is guaranteed
  		
! 		if( str_buf.find( new_mrk) == std::string::npos) // if marker not present
! 		{
! 			buf0.Append( buf1); // insert new marker into list & update
! 			COMTHROW( obj->put_RegistryValue( CComBSTR( m_markerNode), buf0));
! 		}
  	}
  }



More information about the GME-commit mailing list