// Definitions for the class CMyDocument
/////////////////////////////////////////////
#ifndef _IAD_DOC_HPP_
#define _IAD_DOC_HPP_

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

#include <afxtempl.h>

#include "IADEdtTr.hpp"

class IAD_ControlView;
class IAD_ResultView;
class CPA_Actor;
//BEGIN ROMTEAM Cristi Petrescu 98-05-
class IAD_VariableView;
//END ROMTEAM Cristi Petrescu 98-05-

//######################################################################
typedef struct TID_stFindInfo
{
	BOOL bSimpleSearch;
	CString	csSimpleSearchString;
 	BOOL bSimpleSearch_CaseSensitive;
	BOOL bSimpleSearch_Exact;

	enum AIDebug_tdeSectionType_ eNodeType;
 	BOOL bName_CaseSensitive;
	BOOL bName_Exact;
	BOOL bValue_CaseSensitive;
	BOOL bRetValue_CaseSensitive;
	BOOL bValue_Exact;
	BOOL bRetValue_Exact;
	CString	csName;
	CString	csRetValue;
	CString	csValue;
	
	BOOL bAllLevels;
	long lBeginningLevel;
	long lEndLevel;

} TID_tdstFindInfo;

//######################################################################
class IAD_MyDocument
{
public:
	IAD_MyDocument();
	~IAD_MyDocument();

//Attributes
public:

	//Pointers on the views
	IAD_ControlView *m_pclControlView;
	IAD_ResultView *m_pclResultView;
	//BEGIN ROMTEAM Cristi Petrescu 98-05-
	IAD_VariableView *m_pclVariableView;
	//END ROMTEAM Cristi Petrescu 98-05-

//Editor's setup variables
//------------------------
	CString m_csIniFileName;

//Editor's Help variables
//------------------------
	CString m_csHelpFileNameAndPath;

	BOOL m_pub_bIsDeletingTree;

protected:

private:
	CList<IAD_EditorTreeNode *, IAD_EditorTreeNode *> m_pri_clListOfFoundNodes;
	long m_pri_lCurrentIndexInFoundItemsList;

	TID_tdstFindInfo m_pri_tdstFindInfo;

	struct IAD_stInternalActorDescription *m_pri_p_stSelectedActor;

	BOOL m_pri_bDebuggerIsOn;

//Functions
public:
	struct AI_tdstMind_ *m_pub_fn_p_stGetMindOfActor(struct IAD_stInternalActorDescription *_p_stInternalActor);
	void m_pub_fn_vDisplaySetup();

	HTREEITEM m_pub_fn_hFindInTree(	IAD_EditorTreeNode *_pclRoot,
																	TID_tdstFindInfo *_p_tdstFindInfo);
	HTREEITEM m_pub_fn_hFindNextInTree();
	HTREEITEM m_pub_fn_hFindPreviousInTree();
 
	TID_tdstFindInfo *m_pub_p_tdstGetFindInfo();

	struct IAD_stInternalActorDescription *m_pub_fn_p_stGetSelectedActor();
	void m_pub_fn_vSetSelectedActor(struct IAD_stInternalActorDescription *_p_stNewSelectedActor);

	void m_pub_fn_vFreeEditorTraceForActor(struct IAD_stInternalActorDescription *_p_stActorToFree);
	void m_pub_fn_vFreeEditorTraceForEditedActor();
	void m_pub_fn_vReInitEditorTraceForActors();

	BOOL m_pub_fn_bIsDebuggerOn();
	void m_pub_fn_vSetDebuggerOn(BOOL _bDebuggerOn = TRUE);

protected:

private:
	void m_pri_fn_vFindInOneLevelOfTree(IAD_EditorTreeNode *_pclParentNode,
																			TID_tdstFindInfo *_p_tdstFindInfo);
	BOOL m_pri_fn_bNodeRespectsFindCriteria(IAD_EditorTreeNode *_pclNode,
																			TID_tdstFindInfo *_p_tdstFindInfo);
	BOOL m_pri_fn_bCompareStringsWithCriteria(CString _csString1,
																						CString _csString2,
																						BOOL _bMatchCase,
																						BOOL _bExact);

	void m_pri_fn_vFreeNodes(IAD_EditorTreeNode *_pclParentNode);

	//Ini file
	BOOL m_fn_bReadIniFile();
	BOOL m_fn_bWriteIniFile();

};

#endif //_IAD_DOC_HPP_


