[GME-commit] GMESRC/GME/Core CoreProject.h, 1.10, 1.11 CoreProject.cpp, 1.16, 1.17

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Wed Mar 7 15:04:42 CST 2007


Update of /project/gme-repository/GMESRC/GME/Core
In directory escher:/tmp/cvs-serv23169

Modified Files:
	CoreProject.h CoreProject.cpp 
Log Message:
UndoSize can be set upon Create/OpenProject.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: CoreProject.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Core/CoreProject.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** CoreProject.cpp	26 Jan 2005 17:28:24 -0000	1.16
--- CoreProject.cpp	7 Mar 2007 21:04:40 -0000	1.17
***************
*** 15,18 ****
--- 15,19 ----
  
  CCoreProject::CCoreProject()
+ 	: m_maxUndoStep( MAX_UNDO_STEP) // = 10, keep value in sync with CMgaProject::getMaxUndoSize()'s default
  {
  	status = 0;
***************
*** 167,170 ****
--- 168,177 ----
  }
  
+ STDMETHODIMP CCoreProject::OpenProject2(BSTR connection, long p_undoSize, ICoreMetaProject *p, VARIANT_BOOL *ro_mode)
+ {
+ 	setMaxUndoStep( p_undoSize);
+ 	return OpenProject( connection, p, ro_mode);
+ }
+ 
  STDMETHODIMP CCoreProject::OpenProject(BSTR connection, ICoreMetaProject *p, VARIANT_BOOL *ro_mode)
  {
***************
*** 255,258 ****
--- 262,271 ----
  }
  
+ STDMETHODIMP CCoreProject::CreateProject2(BSTR connection, long p_undoSize, ICoreMetaProject *p)
+ {
+ 	setMaxUndoStep( p_undoSize);
+ 	return CreateProject( connection, p);
+ }
+ 
  STDMETHODIMP CCoreProject::CreateProject(BSTR connection, ICoreMetaProject *p)
  {
***************
*** 381,386 ****
  			// note that in a read-transaction we might have redo_count > 0
  
! 			ASSERT( undos.size() <= MAX_UNDO_STEP + 1);
! 			ASSERT( undos.size() <= MAX_UNDO_STEP || (transtype & TRANSTYPE_READ) != 0 );
  
  			BeginNestedTr();
--- 394,399 ----
  			// note that in a read-transaction we might have redo_count > 0
  
! 			ASSERT( undos.size() <= m_maxUndoStep + 1);
! 			ASSERT( undos.size() <= m_maxUndoStep || (transtype & TRANSTYPE_READ) != 0 );
  
  			BeginNestedTr();
***************
*** 394,398 ****
  					TryDiscardLastItem();
  
! 				while( undos.size() >= MAX_UNDO_STEP )
  					TryDiscardLastItem();
  
--- 407,412 ----
  					TryDiscardLastItem();
  
! 				ASSERT( m_maxUndoStep); // m_maxUndoStep better not be 0 (chance of infinite loop)
! 				while( undos.size() >= m_maxUndoStep )
  					TryDiscardLastItem();
  
***************
*** 854,858 ****
  	COMTHROW( storage->BeginTransaction() );
  
! 	ASSERT( undos.size() <= MAX_UNDO_STEP );
  	undos.push_front();
  
--- 868,872 ----
  	COMTHROW( storage->BeginTransaction() );
  
! 	ASSERT( undos.size() <= m_maxUndoStep );
  	undos.push_front();
  
***************
*** 1336,1337 ****
--- 1350,1358 ----
  	return storage;
  }
+ 
+ //inline 
+ void CCoreProject::setMaxUndoStep( long p_undoSize)
+ {
+ 	if( p_undoSize > 0 && p_undoSize < 100)
+ 		m_maxUndoStep = (unsigned long) p_undoSize;
+ }
\ No newline at end of file

Index: CoreProject.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Core/CoreProject.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** CoreProject.h	12 Feb 2007 18:44:45 -0000	1.10
--- CoreProject.h	7 Mar 2007 21:04:40 -0000	1.11
***************
*** 17,21 ****
  
  
! #define MAX_UNDO_STEP			1
  
  // --------------------------- typedefs
--- 17,21 ----
  
  
! #define MAX_UNDO_STEP			10
  
  // --------------------------- typedefs
***************
*** 88,91 ****
--- 88,94 ----
  	STDMETHOD(CreateProject)(BSTR connection, ICoreMetaProject *p);
  	STDMETHOD(DeleteProject)(BSTR connection);
+ 	// undosize
+ 	STDMETHOD(OpenProject2)(BSTR connection, long pUndoSize, ICoreMetaProject *p, VARIANT_BOOL *ro_mode = NULL);
+ 	STDMETHOD(CreateProject2)(BSTR connection, long pUndoSize, ICoreMetaProject *p);
  
  	STDMETHOD(get_Object)(metaid_type metaid, objid_type objid, ICoreObject **p);
***************
*** 131,134 ****
--- 134,139 ----
  	created_territorys_type created_territorys;
  
+ 	unsigned long    m_maxUndoStep;
+ 	inline void      setMaxUndoStep( long p_undoSize);
  // ------- Status
  



More information about the GME-commit mailing list