/* class world*/
 
#ifndef __CPA_WORLD_HPP__
#define __CPA_WORLD_HPP__
 
#ifdef ACTIVE_EDITOR
/****************************************/
#ifndef CPA_EXPORT
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif
#endif
/****************************************/
 
#include "CPASObj.hpp"
#include "CPALists.hpp"
#include "camslots.hpp"
 
class CPA_ObjectDLLBase;
class DEV_MultiDevice3D;
class CPA_CameraSlots;
class CPA_Interface;
 
class CPA_EXPORT CPA_World
{
private:
	DEV_MultiDevice3D	*m_p_oMultiDevice;
 
protected:
/*CPA2 Corneliu Babiuc (multiple registration) 01-07-98*/
    CPA_List<EDT_ListByDLL>		m_lstRegisterListByDLL;      
    EDT_ListByDLL				m_stRegisterListAllDLLs;     
/*END CPA2 Corneliu Babiuc (multiple registration) 02-07-98*/
    CPA_List<EDT_ListByDLL>		m_lstListByDLL;      
    CPA_List<CPA_SuperObject>	m_stListAllObjects;   
    EDT_ListByDLL				m_stListAllDLLs;     
    CPA_SuperObject				*m_p_oSprObjRoot;
	BOOL						m_bIsTemporary;
	CPA_CameraSlots				m_oCameraSlots;
 
public:
 
	CPA_CameraSlots *GetCameraSlots() { return &m_oCameraSlots;};
	
/* constructors / destructor*/
    CPA_World(CPA_MainWorld *_p_oMainWorld, BOOL bIsTemporary = FALSE);
    virtual ~CPA_World(void);
 
	DEV_MultiDevice3D * GetMultiDevice3D() { return m_p_oMultiDevice; }
	CPA_Interface * GetInterface();
 
	void SetMultiDevice(DEV_MultiDevice3D *p_oMDev) {m_p_oMultiDevice = p_oMDev; }
    void fn_vSetRoot(CPA_SuperObject *_p_SprObj);
	void InitWorldForDrawing();
    CPA_SuperObject *GetRoot()                                     { return m_p_oSprObjRoot; }
 
/*  Editor Messages Functions overload*/
    virtual BOOL fn_bAcceptModifDelete      (CPA_ObjectDLLBase *pDLLBase)	{ return TRUE; }
    virtual BOOL fn_bAcceptModifParent      (CPA_ObjectDLLBase *pDLLBase)	{ return TRUE; }
    virtual BOOL fn_bAcceptModifCopy        (CPA_ObjectDLLBase *pDLLBase)	{ return TRUE; }
    virtual BOOL fn_bAcceptModifTranslate   (CPA_ObjectDLLBase *pDLLBase)	{ return TRUE; }
    virtual BOOL fn_bAcceptModifRotate      (CPA_ObjectDLLBase *pDLLBase)	{ return TRUE; }
    virtual BOOL fn_bAcceptModifScale       (CPA_ObjectDLLBase *pDLLBase)	{ return TRUE; }
    virtual BOOL fn_bAcceptModifInsert      (CPA_ObjectDLLBase *pDLLBase)	{ return TRUE; }
    virtual BOOL fn_bAcceptModifName        (CPA_ObjectDLLBase *pDLLBase)	{ return TRUE; }
    virtual BOOL fn_bAcceptSelect           (CPA_ObjectDLLBase *pDLLBase)	{ return TRUE; }
	virtual BOOL fn_bAcceptMultiSelect		(void) { return TRUE; }
    /* Called before editor timer execution*/
    virtual BOOL fn_bAcceptToRunTimerEngine(void) { return TRUE; };
 
/* inits*/
    void fn_vCreateListFromHierarchy    (CPA_List<CPA_ObjectDLLBase> *_p_oListOfObjectDLL);
    void fn_vInitListAllObjects         (CPA_SuperObject *pEdObj);
    void fn_vInitListObjects            (CPA_List<CPA_ObjectDLLBase> *_p_oListOfObjectDLL);
	void fn_vAddANewListByType			(char *szTypeName, CPA_ObjectDLLBase *pObjectDLL);
/* Lists by types*/
    void fn_vReinitListObjects   (void);
    void fn_vReinitSortedList    (void);
    void fn_vFillListObjects     (CPA_SuperObject *pEdObj);
/* Accessing the lists*/
    CPA_List<CPA_SuperObject>	* GetListAllObjects		(void)  { return (&m_stListAllObjects); }
	CPA_List<EDT_ListByDLL>		* GetListOfListByDLL	(void)  { return (&m_lstListByDLL); }
    EDT_ListByDLL				* GetListAllDLLs		(void)  { return (&m_stListAllDLLs); }
/*CPA2 Corneliu Babiuc (multiple registration) 01-07-98*/
	CPA_List<EDT_ListByDLL>		* GetListOfRegisteredListByDLL	(void)  { return (&m_lstRegisterListByDLL); }
    EDT_ListByDLL				* GetRegisterListAllDLLs		(void)  { return (&m_stRegisterListAllDLLs); }
/*CPA2 Corneliu Babiuc (multiple registration) 01-07-98*/
 
/* Lists of super-objects*/
	void fn_vUpdateListObjects (CPA_SuperObject *pEdObj, tdeListUpdateMode eType, BOOL bUpdateObject = TRUE);
	void fn_vUpdateSelectLists (CPA_SuperObject *pEdObj, tdeListUpdateMode eType, BOOL bIsSelected);
/*CPA2 Corneliu Babiuc (multiple registration) 01-07-98*/
	void fn_vUpdateRegisterLists			(CPA_SuperObject *pEdObj, tdeListUpdateMode eType, BOOL bIsSelected);
	EDT_ListByDLL * GetListFromObject		(CPA_List<EDT_ListByDLL> *p_lstListByDLL, CPA_SuperObject *pEdObj);
	EDT_ListByDLL * GetListFromObjectDLL	(CPA_List<EDT_ListByDLL> *p_lstListByDLL, CPA_ObjectDLLBase *p_oDLL);
	EDT_ListByDLL * GetListFromObjectDLL	(CPA_ObjectDLLBase *p_oDLL)	{return GetListFromObjectDLL(&m_lstListByDLL, p_oDLL); };
	EDT_ListByDLL * GetListFromObject		(CPA_SuperObject *pEdObj)	{return GetListFromObject(&m_lstListByDLL, pEdObj); };
/*END CPA2 Corneliu Babiuc (multiple registration) 02-07-98*/
 
	CPA_List<CPA_SuperObject> * GetListSelected			(void)  { return &m_stListAllDLLs.m_stListSelected; }
	CPA_SuperObject	*			GetSingleSelection		(void)  { return (m_stListAllDLLs.m_stListSelected.FindElementFromIndex(0)); }
	long						GetCountSelected		(void)  { return (m_stListAllDLLs.m_stListSelected.GetCount()); }
 
/*CPA2 Corneliu Babiuc (multiple registration) 01-07-98*/
	CPA_List<CPA_SuperObject> * GetListRegistered		(void)  { return &m_stRegisterListAllDLLs.m_stListSelected; }
	CPA_SuperObject	*			GetSingleRegistration	(void)  { return (m_stRegisterListAllDLLs.m_stListSelected.FindElementFromIndex(0)); }
	long						GetCountRegistered		(void)  { return (m_stRegisterListAllDLLs.m_stListSelected.GetCount()); }
/*END CPA2 Corneliu Babiuc (multiple registration) 02-07-98*/
 
/* fill world*/
	void fn_vInsertSuperObjectInNewWorld (CPA_SuperObject *pEdObj, CPA_SuperObject *pParent, BOOL bUpdateDrawing = TRUE);
	void fn_vDeleteSuperObjectInNewWorld (CPA_SuperObject *pEdObj, BOOL bUpdateDrawing = TRUE);
 
/* check editor*/
	BOOL fn_bIsTemporaryWorld (void) { return m_bIsTemporary; }
	void fn_vSetTemporary (BOOL bIsTemporary = TRUE) { m_bIsTemporary = bIsTemporary; }
 
};
 
 
#endif /*ACTIVE_EDITOR*/
 
#endif  /* __CPA_WORLD_HPP__*/
