/*
 =======================================================================================
  Name        : TPGMyDoc.hpp
  Author      : David Reizer
  Description : Document class for Particle Generator editor Tool DLL
 =======================================================================================
  Modification -> Author : Vincent Lhullier
 =======================================================================================
 */

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#ifndef _TPGMYDOC_HPP_
#define _TPGMYDOC_HPP_
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include <afxtempl.h>

#include "ACP_Base.h"
#include "IncITF.h"
#include "CTL.h"

#include "TPG_OGen.hpp"
#include "TPG_OEnv.hpp"
#include "TPG_OSys.hpp"
#include "TPG_OSrc.hpp"
#include "TPG_Spri.hpp"
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
class TPG_View;
class TPG_Sprite;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

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

  /*
   * Attributes
   */
  public:

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

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

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

	CPA_DialogList					*m_pub_p_clDialogList;
	CPA_PartGen_Generator			*m_pub_p_clCurrentGenerator;
	CPA_PartGen_System				*m_pub_p_clCurrentSystem;
	CPA_PartGen_Source				*m_pub_p_clCurrentSource;
	CPA_PartGen_Environment			*m_pub_p_clCurrentEnv;
	CList<TPG_Sprite*,TPG_Sprite*>	m_pub_clListOfSprites;

	CTL_Editor_ControlList			m_pub_clGeneratorControlList;
	CTL_Editor_ControlList			m_pub_clSourceControlList;
	CTL_Editor_ControlList			m_pub_clSystemControlList;
	CTL_Editor_ControlList			m_pub_clEnvControlList;

  private:
	CTL_Editor_EnumDescriptorList	m_pri_clEnumDescriptorList;
	CTL_Editor_MaskList				m_pri_clMaskDescriptorList;

  /*
   * Functions
   */
  public:
	// Update functions
	void m_pub_fn_vUpdateGenerator	( CPA_PartGen_Generator* );
	void m_pub_fn_vUpdateSource		( CPA_PartGen_Source* );
	void m_pub_fn_vUpdateSystem		( CPA_PartGen_System* );
	void m_pub_fn_vUpdateEnv		( CPA_PartGen_Environment* );

	void m_pub_fn_vDisplayCurrentGenerator();

	// Delete functions
	void m_pub_fn_vDeleteGenerator();
	void m_pub_fn_vDeleteSource();
	void m_pub_fn_vDeleteSystem();
	void m_pub_fn_vDeleteEnv();

	/* searched for engine element */
	void m_pub_fn_vSearchForLoadedGenerators();
	void m_pub_fn_vSearchForLoadedSources();
	void m_pub_fn_vSearchForLoadedSystems();
	void m_pub_fn_vSearchForLoadedEnvironments();
	void m_pub_fn_vSearchForUnLoadedGeneratorsAndSources();
	void m_pub_fn_vSearchForUnLoadedSystems();
	void m_pub_fn_vSearchForUnLoadedEnvironments();

	void m_pub_fn_vFillListOfSprites();

	TPG_View* m_pub_fn_p_clGetView();

	void m_pub_fn_vFillControlLists();

	void m_pub_fn_vBuildAllEnumDescriptors();
	void m_pub_fn_vUpdateChangingEnumDescriptors();

	CTL_Editor_EnumDescriptor * m_pub_fn_p_clGetEnumDescriptorByName( CString );
	CTL_Editor_MaskDescriptor * m_pub_fn_p_clGetMaskDescriptorByName( CString );

  private:
	void m_pri_fn_vUpdateSource( CPA_PartGen_Source* );
	void m_pri_fn_vUpdateSystem( CPA_PartGen_System* );
	void m_pri_fn_vUpdateEnv( CPA_PartGen_Environment* );

	void m_pri_fn_vFillGeneratorControlList();
	void m_pri_fn_vFillSourceControlList();
	void m_pri_fn_vFillSystemControlList();
	void m_pri_fn_vFillEnvControlList();
	void m_pri_fn_vCreateControl( CTL_Editor_ControlList* );

	void m_pri_fn_vFillEnumDescriptorWithList( CTL_Editor_EnumDescriptor *, CList<TPG_Sprite*,TPG_Sprite*>* );

	void m_pri_fn_vFillEnumDescriptorWithBaseObjectList( CTL_Editor_EnumDescriptor*, CPA_BaseObjectList* );
	void m_pri_fn_vFillEnumDescriptorWithLinkTable( CTL_Editor_EnumDescriptor*, SCR_tdst_Link_Table* );

	void m_pri_fn_vBuildConstantEnumDescriptors();
	void m_pri_fn_vBuildChangingEnumDescriptors();
	void m_pri_fn_vBuildConstantMasks();
};


#endif //_TPGMYDOC_HPP_
