[GME-commit] GMESRC/GME/ConstraintManager OclViolation.h,1.2,1.3 OCLTree.cpp,1.24,1.25 OclObjectExGME.h,1.2,1.3 OCLObjectExGME.cpp,1.7,1.8 OCLObject.h,1.2,1.3 OCLObject.cpp,1.5,1.6 OCLGMECMFacade.h,1.11,1.12 OCLGMECMFacade.cpp,1.26,1.27 OCLFeatureImplementation.h,1.4,1.5 OclConstraint.h,1.4,1.5 OclConstraint.cpp,1.5,1.6 GMEViolationDialog.h,1.10,1.11 GMEViolationDialog.cpp,1.14,1.15 GMEConstraintBrowserDialog.h,1.5,1.6 GMEConstraintBrowserDialog.cpp,1.11,1.12 ConstraintMgr.h,1.6,1.7 ConstraintMgr.cpp,1.14,1.15

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Mon Jun 14 16:28:27 CDT 2004


Update of /var/lib/gme/GMESRC/GME/ConstraintManager
In directory braindrain:/tmp/cvs-serv13734

Modified Files:
	OclViolation.h OCLTree.cpp OclObjectExGME.h OCLObjectExGME.cpp 
	OCLObject.h OCLObject.cpp OCLGMECMFacade.h OCLGMECMFacade.cpp 
	OCLFeatureImplementation.h OclConstraint.h OclConstraint.cpp 
	GMEViolationDialog.h GMEViolationDialog.cpp 
	GMEConstraintBrowserDialog.h GMEConstraintBrowserDialog.cpp 
	ConstraintMgr.h ConstraintMgr.cpp 
Log Message:
jump to the violating object from CM violations dialog

CVS User: bogyom

Index: OclViolation.h
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/OclViolation.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** OclViolation.h	14 May 2004 15:54:19 -0000	1.2
--- OclViolation.h	14 Jun 2004 20:28:23 -0000	1.3
***************
*** 4,7 ****
--- 4,104 ----
  #include "OCLCommon.h"
  
+ // cannot use _com_ptr_t instead of IUnknown *
+ // because of incluse mess
+ // CComPtr does not work in vectors
+ class PtrVector : public vector<IUnknown *>
+ {
+ public:
+ 	PtrVector() : vector<IUnknown *>()
+ 	{
+ 	}
+ 
+ 	PtrVector(const PtrVector &vect)
+ 	{
+ 		copy(vect);
+ 	}
+ 
+ 	PtrVector & operator =(const PtrVector &vect)
+ 	{
+ 		copy(vect);
+ 		return *this;
+ 	}
+ 
+ 	void copy(const PtrVector &vect)
+ 	{
+ 		int len = size();
+ 		for (int k=0; k<len; k++)
+ 		{
+ 			IUnknown *ptr = (*this)[k];
+ 			if (ptr)
+ 			{
+ 				ptr->Release();
+ 				(*this)[k] = NULL;
+ 			}
+ 		}
+ 		clear();
+ 		int lenx = vect.size();
+ 		for (int kk=0; kk<lenx; kk++)
+ 		{
+ 			IUnknown *ptr = vect[kk];
+ 			if (ptr)
+ 				ptr->AddRef();
+ 			push_back(ptr);
+ 		}
+ 	}
+ 
+ 	virtual ~PtrVector()
+ 	{
+ 		EraseAll();
+ 	}
+ 
+ 	void clear() 
+ 	{
+ 		EraseAll();
+ 		vector<IUnknown *>::clear();
+ 	}
+ 
+ 	void pop_back()
+ 	{
+ 		IUnknown* element = back();
+ 		if (element)
+ 			element->Release();
+ 		vector<IUnknown *>::pop_back();
+ 	}
+ 
+ 	iterator erase(iterator it)
+ 	{
+ 		if (*it)
+ 			(*it)->Release();
+ 		return vector<IUnknown *>::erase(it);
+ 
+ 	}
+ 
+ 	iterator erase(iterator first, iterator last)
+ 	{
+ 		for (iterator t = first; t != last; t++)
+ 		{
+ 			if (*t)
+ 				(*t)->Release();
+ 		}
+ 		return vector<IUnknown *>::erase(first, last);
+ 	}
+ 
+ 	void EraseAll()
+ 	{
+ 		int len = size();
+ 		for (int k=0; k<len; k++)
+ 		{
+ 			IUnknown *ptr = (*this)[k];
+ 			if (ptr)
+ 			{
+ 				ptr->Release();
+ 				(*this)[k] = NULL;
+ 			}
+ 		}
+ 	}
+ 
+ };
+ 
  namespace OclTree
  {
***************
*** 14,17 ****
--- 111,115 ----
  		StringVector				vecVariables;
  		StringVector				vecObjects;
+ 		PtrVector					vecObjectsPtr;
  	};
  

Index: OCLTree.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/OCLTree.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** OCLTree.cpp	31 May 2004 20:38:31 -0000	1.24
--- OCLTree.cpp	14 Jun 2004 20:28:23 -0000	1.25
***************
*** 293,298 ****
--- 293,302 ----
  		ObjectContextStack::StateItemVector vecItems = context.oCtx.GetState();
  		for ( int i = 0 ; i < vecItems.size() ; i++ ) {
+ //			ObjectContextStack::StateItem itemx = vecItems[i];
  			violation.vecVariables.push_back( vecItems[ i ].name );
  			violation.vecObjects.push_back( vecItems[ i ].item.Print() );
+ 			IUnknown* iu;
+ 			iu = vecItems[ i ].item.GetObject();
+ 			violation.vecObjectsPtr.push_back(iu);
  		}
  		context.vecViolations.push_back( violation );
***************
*** 1588,1591 ****
--- 1592,1596 ----
  			// ?? !! terge
  			OclTree::ViolationVector vec = pIMethod->GetViolations();
+ 			pIMethod->ClearViolations();
  			int num = vec.size();
  			for (int kk=0; kk<num; kk++)

Index: OclObjectExGME.h
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/OclObjectExGME.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** OclObjectExGME.h	23 Oct 2002 14:05:00 -0000	1.2
--- OclObjectExGME.h	14 Jun 2004 20:28:23 -0000	1.3
***************
*** 129,132 ****
--- 129,133 ----
  
  			virtual string 	Print() const;
+ 			virtual IUnknown* GetObject() const;
  	};
  

Index: OCLObjectExGME.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/OCLObjectExGME.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** OCLObjectExGME.cpp	18 May 2004 13:30:58 -0000	1.7
--- OCLObjectExGME.cpp	14 Jun 2004 20:28:23 -0000	1.8
***************
*** 191,194 ****
--- 191,201 ----
  	}
  
+ 	IUnknown* Object::GetObject() const
+ 	{
+ 		IUnknown* ret = NULL;
+ 		m_Value.QueryInterface(&ret);
+ 		return ret;
+ 	}
+ 
  //##############################################################################################################################################
  //

Index: OCLObject.h
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/OCLObject.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** OCLObject.h	23 Oct 2002 14:05:00 -0000	1.2
--- OCLObject.h	14 Jun 2004 20:28:23 -0000	1.3
***************
*** 65,68 ****
--- 65,69 ----
  			OclImplementation::Object* 	GetImplementation() const;
  			string							Print() const;
+ 			virtual IUnknown*				GetObject() const;
  	};
  
***************
*** 126,129 ****
--- 127,131 ----
  
  			virtual string Print() const = 0;
+ 			virtual IUnknown* GetObject() const {return NULL;};
  
  			virtual bool IsUndefined() const

Index: OCLObject.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/OCLObject.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** OCLObject.cpp	18 May 2004 13:30:58 -0000	1.5
--- OCLObject.cpp	14 Jun 2004 20:28:23 -0000	1.6
***************
*** 112,115 ****
--- 112,120 ----
  	}
  
+ 	IUnknown* Object::GetObject() const
+ 	{
+ 		return ( IsUndefined() ) ? NULL : Ptr()->GetObject();
+ 	}
+ 
  }; // namespace OclMeta
  

Index: OCLGMECMFacade.h
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/OCLGMECMFacade.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** OCLGMECMFacade.h	31 May 2004 20:33:00 -0000	1.11
--- OCLGMECMFacade.h	14 Jun 2004 20:28:23 -0000	1.12
***************
*** 92,100 ****
  					void								LoadUserConstraints( OclGme::ConstraintVector& vecFaileds );
  
! 					HRESULT 							EvaluateAll();
! 					HRESULT 							Evaluate( CComPtr<IMgaObject> spObject );
! 					HRESULT							Evaluate( const OclCommonEx::ObjectVector& vecObjects );
! 					HRESULT 							Evaluate( CComPtr<IMgaObject> spObject, unsigned long ulCurrentEventMask );
! 					HRESULT 							EvaluateConstraints( EvaluationRecordVector& vecInputs, bool bShowProgress );
  		private :
  					void								updateLineno(EvaluationRecord &rec);
--- 92,100 ----
  					void								LoadUserConstraints( OclGme::ConstraintVector& vecFaileds );
  
! 					HRESULT 							EvaluateAll(IUnknown **punk);
! 					HRESULT 							Evaluate( CComPtr<IMgaObject> spObject, IUnknown **punk);
! 					HRESULT								Evaluate( const OclCommonEx::ObjectVector& vecObjects, IUnknown **punk);
! 					HRESULT 							Evaluate( CComPtr<IMgaObject> spObject, unsigned long ulCurrentEventMask);
! 					HRESULT 							EvaluateConstraints( EvaluationRecordVector& vecInputs, bool bShowProgress, IUnknown **punk );
  		private :
  					void								updateLineno(EvaluationRecord &rec);

Index: OCLGMECMFacade.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/OCLGMECMFacade.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** OCLGMECMFacade.cpp	31 May 2004 20:38:31 -0000	1.26
--- OCLGMECMFacade.cpp	14 Jun 2004 20:28:23 -0000	1.27
***************
*** 69,72 ****
--- 69,78 ----
  			}
  
+ 			void ClearViolations()
+ 			{
+ 				m_spFunction->ClearViolations();
+ 			}
+ 
+ 
  			void operator()()
  			{
***************
*** 647,651 ****
  	}
  
! 	HRESULT Facade::EvaluateConstraints( EvaluationRecordVector& vecInputs, bool bShowProgress )
  	{
  		// Initialization
--- 653,657 ----
  	}
  
! 	HRESULT Facade::EvaluateConstraints( EvaluationRecordVector& vecInputs, bool bShowProgress, IUnknown **punk )
  	{
  		// Initialization
***************
*** 657,661 ****
  			dlgProgress.DoModeless( vecInputs.size() );
  
! 		CViolationDialog dlgErrors( m_bViolationDlgExpanded );
  
  		int iViolationCount= 0;
--- 663,667 ----
  			dlgProgress.DoModeless( vecInputs.size() );
  
! 		CViolationDialog dlgErrors( m_bViolationDlgExpanded, NULL, m_spProject );
  
  		int iViolationCount= 0;
***************
*** 668,671 ****
--- 674,678 ----
  
  			OclGme::SpConstraint constraint = vecInputs[ i ].spConstraint;
+ //			vecInputs[ i ].vecViolations.clear();
  			// Level condition for terminating the evaluation
  
***************
*** 682,685 ****
--- 689,693 ----
  			vecInputs[ i ].spObject = vecInputs[ i ].spConstraint->Evaluate( context, m_infoEvaluation.bEnabledSCLogical, m_infoEvaluation.bEnabledSCIterator, m_infoEvaluation.bEnabledTracking );
  			vecInputs[ i ].vecViolations = vecInputs[ i ].spConstraint->GetViolations();
+ 			vecInputs[ i ].spConstraint->ClearViolations();
  
  			// Refresh Progress
***************
*** 712,715 ****
--- 720,724 ----
  			}
  			lPriority = vecInputs[ i ].spConstraint->GetPriority();
+ //			vecInputs[ i ].vecViolations.clear();
  		}
  
***************
*** 733,736 ****
--- 742,747 ----
  			int iResult = dlgErrors.DoModal();
  			m_bViolationDlgExpanded = dlgErrors.IsExpanded();
+ 			if (punk)
+ 				dlgErrors.GetGotoPunk(punk);
  			return ( iResult != IDOK ) ? E_MGA_CONSTRAINT_VIOLATION : S_OK;
  		}
***************
*** 810,814 ****
  	}
  
! 	HRESULT Facade::EvaluateAll()
  	{
  		AfxGetApp()->DoWaitCursor( 1 );
--- 821,825 ----
  	}
  
! 	HRESULT Facade::EvaluateAll(IUnknown **punk)
  	{
  		AfxGetApp()->DoWaitCursor( 1 );
***************
*** 818,825 ****
  		CollectConstraints( spRootFolder.p, true, vecInputs );
  		AfxGetApp()->DoWaitCursor( -1 );
! 		return EvaluateConstraints( vecInputs, true );
  	}
  
! 	HRESULT Facade::Evaluate( CComPtr<IMgaObject> spObject )
  	{
  		AfxGetApp()->DoWaitCursor( 1 );
--- 829,836 ----
  		CollectConstraints( spRootFolder.p, true, vecInputs );
  		AfxGetApp()->DoWaitCursor( -1 );
! 		return EvaluateConstraints( vecInputs, true, punk );
  	}
  
! 	HRESULT Facade::Evaluate( CComPtr<IMgaObject> spObject, IUnknown **punk )
  	{
  		AfxGetApp()->DoWaitCursor( 1 );
***************
*** 827,834 ****
  		CollectConstraints( spObject, vecInputs );
  		AfxGetApp()->DoWaitCursor( -1 );
! 		return EvaluateConstraints( vecInputs, true );
  	}
  
! 	HRESULT Facade::Evaluate( const OclCommonEx::ObjectVector& vecObjects )
  	{
  		AfxGetApp()->DoWaitCursor( 1 );
--- 838,845 ----
  		CollectConstraints( spObject, vecInputs );
  		AfxGetApp()->DoWaitCursor( -1 );
! 		return EvaluateConstraints( vecInputs, true, punk );
  	}
  
! 	HRESULT Facade::Evaluate( const OclCommonEx::ObjectVector& vecObjects, IUnknown **punk)
  	{
  		AfxGetApp()->DoWaitCursor( 1 );
***************
*** 837,844 ****
  			CollectConstraints( vecObjects[ i ].p, vecInputs );
  		AfxGetApp()->DoWaitCursor( -1 );
! 		return EvaluateConstraints( vecInputs, true );
  	}
  
! 	HRESULT Facade::Evaluate( CComPtr<IMgaObject> spObject, unsigned long ulCurrentEventMask )
  	{
  		AfxGetApp()->DoWaitCursor( 1 );
--- 848,855 ----
  			CollectConstraints( vecObjects[ i ].p, vecInputs );
  		AfxGetApp()->DoWaitCursor( -1 );
! 		return EvaluateConstraints( vecInputs, true, punk );
  	}
  
! 	HRESULT Facade::Evaluate( CComPtr<IMgaObject> spObject, unsigned long ulCurrentEventMask)
  	{
  		AfxGetApp()->DoWaitCursor( 1 );
***************
*** 849,853 ****
  			CollectConstraints( spObject, ulCurrentEventMask, 0, vecInputs );
  		AfxGetApp()->DoWaitCursor( -1 );
! 		return EvaluateConstraints( vecInputs, false );
  	}
  
--- 860,864 ----
  			CollectConstraints( spObject, ulCurrentEventMask, 0, vecInputs );
  		AfxGetApp()->DoWaitCursor( -1 );
! 		return EvaluateConstraints( vecInputs, false, NULL);
  	}
  

Index: OCLFeatureImplementation.h
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/OCLFeatureImplementation.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** OCLFeatureImplementation.h	30 Apr 2004 21:08:48 -0000	1.4
--- OCLFeatureImplementation.h	14 Jun 2004 20:28:23 -0000	1.5
***************
*** 231,234 ****
--- 231,235 ----
  			virtual 	void Finalize() { Feature::Finalize(); TypeableFeature::Finalize(); ParametralFeature::Finalize(); }
  			virtual		OclTree::ViolationVector GetViolations() {OclTree::ViolationVector vec; return vec;}
+ 			virtual		void ClearViolations() {}
  
  	};

Index: OclConstraint.h
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/OclConstraint.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** OclConstraint.h	20 Nov 2002 18:08:00 -0000	1.4
--- OclConstraint.h	14 Jun 2004 20:28:23 -0000	1.5
***************
*** 115,118 ****
--- 115,119 ----
  
  					OclTree::ViolationVector 					GetViolations();
+ 					void										ClearViolations();
  	};
  }; // namespace Ocl

Index: OclConstraint.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/OclConstraint.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** OclConstraint.cpp	18 May 2004 13:30:58 -0000	1.5
--- OclConstraint.cpp	14 Jun 2004 20:28:23 -0000	1.6
***************
*** 321,323 ****
--- 321,331 ----
  	}
  
+ 	void Constraint::ClearViolations()
+ 	{
+ 		int db = m_vecViolations.size();
+ 		m_vecViolations.clear();;
+ 		db = m_vecViolations.size();
+ 	}
+ 
+ 
  }; // namespace Ocl

Index: GMEViolationDialog.h
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/GMEViolationDialog.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** GMEViolationDialog.h	31 May 2004 20:32:43 -0000	1.10
--- GMEViolationDialog.h	14 Jun 2004 20:28:23 -0000	1.11
***************
*** 17,20 ****
--- 17,23 ----
  namespace OclGmeCM {
  	struct EvaluationRecord;
+ 	#include <string>
+ 
+ 	using namespace std;
  
  //##############################################################################################################################################
***************
*** 34,50 ****
  // ============================================================
  
  private :
  	CImageList						m_lstErrorImages;
  	CImageList						m_lstConstraintImages;
  	CImageList						m_lstLineImages;
  	vector<EvaluationRecord>		m_vecRecords;
! 	bool								m_bAbort;
! 	bool								m_bOK;
! 	bool								m_bExpanded;
! 	int									m_iSelected;
! 	int 									m_iSelectedConstraint;
! 	int									m_iSelectedError;
  
  public :
  	void AddItem( const EvaluationRecord& item );
  	void EnableAbort();
--- 37,64 ----
  // ============================================================
  
+ 
  private :
+ 	CComPtr<IMgaProject>			m_spProject;
+ 
  	CImageList						m_lstErrorImages;
  	CImageList						m_lstConstraintImages;
  	CImageList						m_lstLineImages;
  	vector<EvaluationRecord>		m_vecRecords;
! 	bool							m_bAbort;
! 	bool							m_bOK;
! 	bool							m_bExpanded;
! 	int								m_iSelected;
! 	int 							m_iSelectedConstraint;
! 	int								m_iSelectedError;
! 	int								m_iSelectedVariable;
! 	CComPtr<IUnknown> m_gotopunk;
  
  public :
+ 	void GetGotoPunk(IUnknown ** ppunk) 
+ 	{
+ 		*ppunk=NULL; 
+ 		if (m_gotopunk) 
+ 			m_gotopunk.CopyTo(ppunk); 
+ 	}
  	void AddItem( const EvaluationRecord& item );
  	void EnableAbort();
***************
*** 57,60 ****
--- 71,75 ----
  	void SelectError( bool bNext );
  	void DisplayErrorItem();
+ 	void GotoObject();
  	void DisplayConstraintItem();
  	void RefreshWidgets( bool bNewConstraint );
***************
*** 68,72 ****
  // Construction
  public:
! 	CViolationDialog( bool bExpanded, CWnd* pParent = NULL);   // standard constructor
  
  // Dialog Data
--- 83,87 ----
  // Construction
  public:
! 	CViolationDialog( bool bExpanded, CWnd* pParent, IMgaProject *project);   // standard constructor
  
  // Dialog Data
***************
*** 110,113 ****
--- 125,129 ----
  	afx_msg void OnClickConstraints(NMHDR* pNMHDR, LRESULT* pResult);
  	afx_msg void OnClickErrors(NMHDR* pNMHDR, LRESULT* pResult);
+ 	afx_msg void OnClickVariable(NMHDR* pNMHDR, LRESULT* pResult);
  	afx_msg void OnKeyDownErrors(NMHDR* pNMHDR, LRESULT* pResult);
  	afx_msg void OnSelectionChangedTab(NMHDR* pNMHDR, LRESULT* pResult);

Index: GMEViolationDialog.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/GMEViolationDialog.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** GMEViolationDialog.cpp	31 May 2004 20:33:00 -0000	1.14
--- GMEViolationDialog.cpp	14 Jun 2004 20:28:23 -0000	1.15
***************
*** 10,13 ****
--- 10,14 ----
  #include "OCLCommonEx.h"
  #include "OCLGMECMFacade.h"
+ #include "afximpl.h"
  
  #ifdef _DEBUG
***************
*** 19,22 ****
--- 20,24 ----
  namespace OclGmeCM {
  
+ 	using namespace std;
  	struct SortStruct
  	{
***************
*** 33,39 ****
  //##############################################################################################################################################
  
! CViolationDialog::CViolationDialog( bool bExpanded, CWnd* pParent /*=NULL*/)
! 	: CDialog(CViolationDialog::IDD, pParent), m_bExpanded( bExpanded ), m_bAbort( false ), m_bOK( false ), m_iSelected( 0 ), m_iSelectedConstraint( 0 ), m_iSelectedError( 0 )
  {
  	//{{AFX_DATA_INIT(CViolationDialog)
  	//}}AFX_DATA_INIT
--- 35,43 ----
  //##############################################################################################################################################
  
! CViolationDialog::CViolationDialog( bool bExpanded, CWnd* pParent /*=NULL*/, IMgaProject *project)
! 	: CDialog(CViolationDialog::IDD, pParent), m_bExpanded( bExpanded ), m_bAbort( false ), m_bOK( false ), m_iSelected( 0 ), 
! 		m_iSelectedConstraint( 0 ), m_iSelectedError( 0 ), m_iSelectedVariable( 0 )
  {
+ 	m_spProject = project;
  	//{{AFX_DATA_INIT(CViolationDialog)
  	//}}AFX_DATA_INIT
***************
*** 69,72 ****
--- 73,77 ----
  	ON_NOTIFY(NM_CLICK, CVD_LSTCONSTRAINTS, OnClickConstraints)
  	ON_NOTIFY(NM_CLICK, CVD_LSTERRORS, OnClickErrors)
+ 	ON_NOTIFY(NM_CLICK, CVD_LSTOBJECTS, OnClickVariable)
  	ON_NOTIFY(LVN_KEYDOWN, CVD_LSTERRORS, OnKeyDownErrors)
  	ON_NOTIFY(TCN_SELCHANGE, CVD_TABCONTEXT, OnSelectionChangedTab)
***************
*** 322,325 ****
--- 327,336 ----
  }
  
+ void CViolationDialog::OnClickVariable(NMHDR* pNMHDR, LRESULT* pResult)
+ {
+ 	m_iSelectedVariable = min( max( m_lstObjects.GetSelectionMark(), 0 ), m_lstObjects.GetItemCount() - 1 );
+ 	GotoObject();
+ }
+ 
  void CViolationDialog::OnClickErrors(NMHDR* pNMHDR, LRESULT* pResult)
  {
***************
*** 446,450 ****
  
  			LVITEM lvItem;
! 			lvItem.mask = /*LVIF_NORECOMPUTE |*/ LVIF_TEXT;
  			lvItem.iItem = m_lstObjects.GetItemCount();
  			lvItem.iSubItem = 0;
--- 457,461 ----
  
  			LVITEM lvItem;
! 			lvItem.mask = /*LVIF_NORECOMPUTE |*/ LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM;
  			lvItem.iItem = m_lstObjects.GetItemCount();
  			lvItem.iSubItem = 0;
***************
*** 697,701 ****
  			if ( m_lstConstraints.GetItemData( i ) == m_iSelectedConstraint ) {
  				m_iSelected = i;
! 				RefreshWidgets( false );
  				return;
  			}
--- 708,712 ----
  			if ( m_lstConstraints.GetItemData( i ) == m_iSelectedConstraint ) {
  				m_iSelected = i;
! 			 	RefreshWidgets( false );
  				return;
  			}
***************
*** 719,721 ****
--- 730,743 ----
  	}
  
+ 	void CViolationDialog::GotoObject()
+ 	{
+ 		DWORD lparam = m_lstObjects.GetItemData(m_iSelectedVariable);
+ 		OclTree::Violation vi = m_vecRecords[ m_iSelectedConstraint ].vecViolations[ m_iSelectedError ];
+ 		m_gotopunk = vi.vecObjectsPtr[lparam];
+ 		if (m_gotopunk)
+ 			CDialog::OnOK();
+ 	}
+ 
+ 
  }; // namespace OclGmeCM
+ 

Index: GMEConstraintBrowserDialog.h
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/GMEConstraintBrowserDialog.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** GMEConstraintBrowserDialog.h	20 Nov 2002 17:14:00 -0000	1.5
--- GMEConstraintBrowserDialog.h	14 Jun 2004 20:28:23 -0000	1.6
***************
*** 116,121 ****
--- 116,129 ----
  	private :
  		CSettingsPage 			m_pageSettings;
+ 		CComPtr<IUnknown>		m_gotoPunk;
  
  	public :
+ 		void GetGotoPunk(IUnknown ** ppunk) 
+ 		{
+ 			*ppunk=NULL; 
+ 			if (m_gotoPunk) 
+ 				m_gotoPunk.CopyTo(ppunk); 
+ 		}
+ 
  		CImageList 				m_lstObjectImages;
  		CImageList				m_lstStateImages;

Index: GMEConstraintBrowserDialog.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/GMEConstraintBrowserDialog.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** GMEConstraintBrowserDialog.cpp	29 Jan 2003 22:01:00 -0000	1.11
--- GMEConstraintBrowserDialog.cpp	14 Jun 2004 20:28:23 -0000	1.12
***************
*** 235,239 ****
  	AfxGetApp()->DoWaitCursor( -1 );
  
! 	m_pFacade->EvaluateConstraints( vecRecords, true );
  }
  
--- 235,245 ----
  	AfxGetApp()->DoWaitCursor( -1 );
  
! 	m_pFacade->EvaluateConstraints( vecRecords, true,  &m_gotoPunk);
! 	 // ?? !! gotoPunk
! 	if (m_gotoPunk)
! 	{
! 		ApplyChanges();
! 		CDialog::OnOK();
! 	}
  }
  

Index: ConstraintMgr.h
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/ConstraintMgr.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ConstraintMgr.h	20 Nov 2002 23:01:00 -0000	1.6
--- ConstraintMgr.h	14 Jun 2004 20:28:23 -0000	1.7
***************
*** 82,85 ****
--- 82,86 ----
  private:
  
+ 	void GotoViolatorObject(CComPtr<IUnknown> &gotoPunk);
  	CComObjPtr<IMgaTerritory> 	m_spTerritory;
  	CComObjPtr<CMgrEventSink> 	m_spEventSink;

Index: ConstraintMgr.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/ConstraintMgr.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** ConstraintMgr.cpp	27 Nov 2002 15:49:00 -0000	1.14
--- ConstraintMgr.cpp	14 Jun 2004 20:28:23 -0000	1.15
***************
*** 28,31 ****
--- 28,60 ----
  //
  //##############################################################################################################################################
+ void CConstraintMgr::GotoViolatorObject(CComPtr<IUnknown> &gotoPunk)
+ {
+ 	if (!gotoPunk)
+ 		return;
+ 		
+ 	COMTRY 
+ 	{	
+ 		CComBSTR app("GME.Application");
+ 		CComPtr<IMgaClient> client;
+ 		COMTHROW(m_spProject->GetClientByName((BSTR)app, &client));
+ 
+ 		IDispatch* gui=NULL;
+ 		COMTHROW(client->get_OLEServer(&gui));
+ 		COleDispatchDriver dispdrv(gui); 
+ 		
+ 		const BYTE BASED_CODE partypes[] = VTS_UNKNOWN;
+ 		try
+ 		{
+ 			dispdrv.InvokeHelper(32, DISPATCH_METHOD, VT_EMPTY, NULL, partypes, (IUnknown*)gotoPunk);
+ 		}
+ 		catch (CException* e)			
+ 		{
+ 		}
+ 	} 
+ 	catch(hresult_exception &e) 
+ 	{ 
+ 		return ; 
+ 	} 
+ }
  
  STDMETHODIMP CConstraintMgr::ObjectsInvokeEx( IMgaProject *p, IMgaObject *o, IMgaObjects* os, long k )
***************
*** 36,39 ****
--- 65,69 ----
  		return S_OK;
  
+ 	CComPtr<IUnknown> gotoPunk;
  	COMTRY {
  
***************
*** 53,59 ****
  			else
  				COMTHROW( m_spProject->AbortTransaction() );
! 
  			m_Facade.m_bEnabledEvents = true;
  
  			return S_OK;
  		}
--- 83,91 ----
  			else
  				COMTHROW( m_spProject->AbortTransaction() );
! 			
  			m_Facade.m_bEnabledEvents = true;
  
+ 			dlgConstraints.GetGotoPunk(&gotoPunk);
+ 			GotoViolatorObject(gotoPunk);
  			return S_OK;
  		}
***************
*** 68,76 ****
  
  			if ( ! o && ! os )
! 				m_Facade.EvaluateAll();
  			else if ( o ) {
  				CComPtr<IMgaObject> spObject;
  				COMTHROW( spTerritory->OpenObj( o, &spObject ) );
! 				m_Facade.Evaluate( spObject );
  			}
  			if ( os ) {
--- 100,108 ----
  
  			if ( ! o && ! os )
! 				m_Facade.EvaluateAll(&gotoPunk);
  			else if ( o ) {
  				CComPtr<IMgaObject> spObject;
  				COMTHROW( spTerritory->OpenObj( o, &spObject ) );
! 				m_Facade.Evaluate( spObject, &gotoPunk );
  			}
  			if ( os ) {
***************
*** 81,87 ****
  					vecObjects.push_back( spObject.p );
  				} MGACOLL_ITERATE_END;
! 				m_Facade.Evaluate( vecObjects );
  			}
  			COMTHROW( p->AbortTransaction() );
  
  		} catch ( hresult_exception hEx ) {
--- 113,122 ----
  					vecObjects.push_back( spObject.p );
  				} MGACOLL_ITERATE_END;
! 				m_Facade.Evaluate( vecObjects, &gotoPunk );
  			}
  			COMTHROW( p->AbortTransaction() );
+ 			// ?? !! gotoPunk
+ 			GotoViolatorObject(gotoPunk);
+ 
  
  		} catch ( hresult_exception hEx ) {
***************
*** 126,130 ****
  
  	COMTRY {
! 		return m_Facade.Evaluate( obj, eventmask );
  	} COMCATCH( ; )
  }
--- 161,165 ----
  
  	COMTRY {
! 		return m_Facade.Evaluate( obj, eventmask);
  	} COMCATCH( ; )
  }



More information about the GME-commit mailing list