// EdIRFrm.hpp : interface of the CEdIAFrame class
//
/////////////////////////////////////////////////////////////////////////////

#ifndef _EDIRFRM_HPP_
#define _EDIRFRM_HPP_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#include "ITF\CPAFrame.hpp"
#include "SCR.h"

#include "EdIRCsLs.hpp"

class CPA_EdIR_DiagView;
class CPA_EdIR_View;
class CPA_EdIR_ButtonView;
class CPA_EdIR_Brain;
class CPA_EdIR_MainBehaviourList;
class CPA_Actor;

typedef enum tdeRulesViewMode_
{
	IntelligenceView,
	ReflexView,
} tdeRulesViewMode;

/////////////////////////////////////////////////////////////////////////////
// class CPA_EdIR_Frame
/////////////////////////////////////////////////////////////////////////////

class COtherSplitterWnd : public CSplitterWnd
{
public:
	virtual int HitTest(CPoint pt) const
	{
		int iRes = CSplitterWnd::HitTest(pt);
		if(iRes == 101)
			return 0;
		return iRes;
	}
};

//class CPA_EdIR_Frame : public CFrameWnd
class CPA_EdIR_Frame : public FRMBase
{
	// Attributes
//ANNECY CB
public:
	CPA_EdIR_Brain														*m_pclBrain;
	//BEGIN ROMTEAM Cristi Petrescu 98-05-
	// for debugger
	BOOL m_bMarkExecutedLines;
	BOOL m_bShowTests;
	//END ROMTEAM Cristi Petrescu 98-05-

	// BEGIN ROMTEAM Cristi Petrescu 98-06-
	CPA_EdIR_Brain	*m_pclDebugBrain;
	// END ROMTEAM Cristi Petrescu 98-06-

//END
	private:
		COtherSplitterWnd															m_clSplitter1;
		COtherSplitterWnd															m_clSplitter2;
//ANNECY CB		CPA_EdIR_Brain														*m_pclBrain;
		CList<CPA_EdIR_Brain *,CPA_EdIR_Brain *>	m_clListOfModifiedBrains;
		BOOL																			m_bKnownWordsFileIsCreated;

	public:
		CPA_EdIR_ConstantList											m_clConstantList;
		

	public:
		CPA_EdIR_Frame();
		DECLARE_DYNCREATE(CPA_EdIR_Frame)

	// Operations
	private:
		void												m_fn_vFillConstantList();

	public:
		CPA_EdIR_DiagView						*m_fn_pclGetDiagrammeView();
		CPA_EdIR_View								*m_fn_pclGetEdRulesView();
		CPA_EdIR_ButtonView					*m_fn_pclGetButtonView();
		void												m_fn_vAModelHasBeenRemoved();
		void												m_fn_vShowBrain(CPA_EdIR_Brain *);
//ANNECY CB
//		CPA_EdIR_Brain							*m_fn_pclUpdateBrain(CPA_EdIR_Brain *,BOOL bCreateDsgVar=TRUE);
//		void												m_fn_vUpdateBehaviours();
		CPA_EdIR_Brain							*m_fn_pclUpdateBrain(CPA_EdIR_Brain *,BOOL bCreateDsgVar=TRUE, BOOL Disp=TRUE);
		void												m_fn_vUpdateBehaviours(BOOL Disp = TRUE);
//END
		void												m_fn_vChangeViewModeOfBehaviours();
		void												m_fn_vCreateNewBehaviour();
		/* CHRISTOPHE QUICK SAVE MODIFICATIONS */
		void												m_fn_vQuickSave();
		/* END CHRISTOPHE QUICK SAVE MODIFICATIONS */
		void												m_fn_vSaveAll();
		void												m_fn_vStopProcess();
		void												m_fn_vCheckBehaviour();
		BOOL												m_fn_bProcessIA(BOOL);
// Shaitan FastC (16/06/98) {
		BOOL												m_fn_bGenerateFastC(BOOL);
//End Shaitan FastC }
		void												m_fn_vPrint();
		void												m_fn_vShowConstant();
		void												m_fn_vAddOneModifiedBrain(CPA_EdIR_Brain *);

		CPA_Actor										*m_fn_pclGetModel();
		CPA_EdIR_MainBehaviourList	*m_fn_pclGetIntelligenceBehaviours();
		CPA_EdIR_MainBehaviourList	*m_fn_pclGetReflexBehaviours();
		CPA_EdIR_MainBehaviourList	*m_fn_pclGetDeclarations();
		// BEGIN CPA2 Cristi Petrescu 98-03-
		CPA_EdIR_MainBehaviourList	*m_fn_pclGetMacros();
		// END CPA2 Cristi Petrescu 98-03-
		// BEGIN ROMTEAM CPA2 Cristi Petrescu 98-04-
		CPA_EdIR_MainBehaviourList	*m_fn_pclGetSubrs();
		// END ROMTEAM CPA2 Cristi Petrescu 98-04-

		//interface with action editor
		void								m_fn_vGetActionList(CStringList *);
		void								*m_fn_pvGetStateHandle(CString);

		//for debugger
		void								m_fn_vSetRulesEditorReadOnly(BOOL bReadOnly=TRUE);
		void								m_fn_vChangeRulesView(tdeRulesViewMode);
		void								m_fn_vSetOrRemoveOneBreakPoint(long,long);

		//BEGIN ROMTEAM Cristi Petrescu 98-05-
		void								m_fn_vMarkExecutedLines (void) {m_bMarkExecutedLines = TRUE;};
		void								m_fn_vShowTestsAndActions (void) {m_bMarkExecutedLines = FALSE; m_bShowTests = TRUE;};
		void								m_fn_vShowActions (void) {m_bMarkExecutedLines = FALSE; m_bShowTests = FALSE;};
		//END ROMTEAM Cristi Petrescu 98-05-

		//for load script
		void														m_fn_vLoadBrain(CPA_Actor *,CString);
		static SCR_tde_Anl_ReturnValue	m_fn_tdeCallBackLoadIntelligence(SCR_tdst_File_Description *,char *,char *[],SCR_tde_Anl_Action);
		static SCR_tde_Anl_ReturnValue	m_fn_tdeCallBackLoadReflex(SCR_tdst_File_Description *,char *,char *[],SCR_tde_Anl_Action);
		static SCR_tde_Anl_ReturnValue	m_fn_tdeCallBackLoadDeclaration(SCR_tdst_File_Description *,char *,char *[],SCR_tde_Anl_Action);
		// BEGIN CPA2 Cristi Petrescu 98-03-
		static SCR_tde_Anl_ReturnValue	m_fn_tdeCallBackLoadMacro(SCR_tdst_File_Description *,char *,char *[],SCR_tde_Anl_Action);
		// END CPA2 Cristi Petrescu 98-03-
		// BEGIN ROMTEAM CPA2 Cristi Petrescu 98-04-
		static SCR_tde_Anl_ReturnValue	m_fn_tdeCallBackLoadSubr(SCR_tdst_File_Description *,char *,char *[],SCR_tde_Anl_Action);
		// END ROMTEAM CPA2 Cristi Petrescu 98-04-
		static SCR_tde_Anl_ReturnValue	m_fn_tdeCreateMainBehaviour(SCR_tdst_File_Description *,char *,char *[],SCR_tde_Anl_Action);

		//interface
		void	m_fn_vCreateEditor();
		void	m_fn_vLevelChanges();
		BOOL	m_fn_bAcceptToRunEngine();
		BOOL	m_fn_bAcceptToSave();
		void	m_fn_vBeforeSaveAll();
		void	m_fn_vAfterSaveAll();
		void	m_fn_vBeforeEngine();
		void	m_fn_vBeforeEditor();

	// Overrides
		// ClassWizard generated virtual function overrides
		//{{AFX_VIRTUAL(CPA_EdIR_Frame)
		public:
		//virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
		//virtual BOOL Create(LPCTSTR,LPCTSTR,DWORD dwStyle=WS_OVERLAPPEDWINDOW,const RECT& rect=rectDefault,CWnd* pParentWnd=NULL,LPCTSTR lpszMenuName=NULL,DWORD dwExStyle=0,CCreateContext* pContext=NULL);
		protected:
		virtual BOOL OnCreateClient(LPCREATESTRUCT,CCreateContext* pContext);
		//}}AFX_VIRTUAL
		//afx_msg UINT OnNcHitTest( CPoint );

	// Implementation
	public:
		virtual ~CPA_EdIR_Frame();
#ifdef _DEBUG
		virtual void AssertValid() const;
		virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
	protected:
		//{{AFX_MSG(CPA_EdIR_Frame)
			afx_msg void OnDestroy();
			afx_msg void OnSysCommand(UINT,LPARAM);
			afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
			afx_msg void OnSetFocus(CWnd* pOldWnd);
	//}}AFX_MSG

		DECLARE_MESSAGE_MAP()
};

#endif //_EDIRFRM_HPP_
