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

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

#include "EMECCrdT.hpp"
#include "EditMDef.hpp"

//External Modules
#include "CTL.h"
//End of External Modules

class CPA_Meca_ControlView;
class CPA_Meca_MiniStrucView;
class CPA_Meca_Card;

class CPA_Meca_MyDocument
{
public:
	CPA_Meca_MyDocument();
	~CPA_Meca_MyDocument();

//Attributes
public:
	//The lists of Cards
	CPA_Meca_CardTypeList m_clCardTypeList;

	//The list fo all Cards
	CPA_BaseObjectList m_clListOfCards;

	//The current Card Type
	CPA_Meca_CardType *m_pclCurrentCardType;

	//The current Card
	CPA_Meca_Card *m_pclCurrentCard;
	
	//Pointers on the views
	CPA_Meca_ControlView *m_pclControlView;
	CPA_Meca_MiniStrucView *m_pclMiniStrucView;
	CPA_DialogList *m_pclDialogList;

	//
//	CTL_Editor_Control *m_pclFocusedControl;

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

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

//Editor's preferences
//------------------------
	long m_ulListViewHeight;
	long m_ulControlViewHeight;
	long m_ulEditorWidth;

protected:

private:

//Functions
public:
	CPA_Meca_Card *m_pub_fn_vCreateCopyOfCard(CPA_Meca_Card * _pclSourceCard);

	/////////////////////
	// Editor's aspect //
	/////////////////////
	
	//To display a selected Card
	void m_fn_vEditCard(CPA_Meca_Card *pclNewCard);

	//To display a Card Tyep (<--> the associated controls)
	void m_fn_vDisplayCardType(	CPA_Meca_CardType *pclNewCardType,
															BOOL bForcesRepaint = FALSE);

	//To refresh display when Cards have been loaded
	void m_fn_vReInitDisplay();

	//Sets the data pointers of the controls in tree to the current card's ones
	void m_fn_vSetPointersForSelectedCard();

	//Sets the data pointers of the controls in tree to the card's ones
	void m_fn_vSetPointersForCard(CPA_Meca_Card *pclCard);

	//Removes a Card from a Card Type's list
	void m_fn_vRemoveCard(CPA_Meca_Card *);

	//
	void m_fn_vSearchForLoadedCards();
	void m_fn_vLoadUnloadedCards();
	void m_fn_vUpdateUnLoadedCards();

	//
	void m_fn_vCheckSpacesInString(CString &r_csStringToCheck);

	//Preferences
	BOOL m_pub_fn_bSavePreferences();
	BOOL m_pub_fn_bLoadPreferences();

protected:

private:
	void m_fn_vFillCardsTypeList();
	void m_fn_vConstructListOfEnumDescriptors();

	void m_fn_vInitialize();
	void m_fn_vChangeSize();
//	void m_fn_vSetPointersForActor(CPA_CarEditorActor *pclActor);
	
	BOOL m_fn_bReadIniFile();
	BOOL m_fn_bWriteIniFile();

	//Preferences
	void m_pri_fn_vGetEditorCurrentSettings();

};

#endif //_EMECDOC_HPP_


