/*=========================================================================
*
* CPAInterf.hpp
*
*
* Version			1.0
* Creation date
* Revision date
*
* Shaitan
*=======================================================================*/
#ifdef ACTIVE_EDITOR
 
#ifndef __CPA_INTERFACE_HPP__
#define __CPA_INTERFACE_HPP__
 
/****************************************/
#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 "itf/CPADllb.hpp"
#include "itf/CPAEnum.hpp"
#include "itf/CPASObj.hpp"
#include "itf/CPAFileO.hpp"
#include "itf/CPAWorld.hpp"
#include "itf/FRMbsmn.hpp"
#include "itf/FRMSplit.hpp"
#include "itf/CPAdSel.hpp"
#include "itf/CPAdPref.hpp"
#include "itf/CPAdPerm.hpp"
#include "itf/CPASpec.hpp"
#include "itf/CPAModel.hpp"
#include "itf/CPAdIns.hpp"
#include "itf/camdllb.hpp"
#include "itf/CPAdOpt.hpp"
#include "itf/CPAdTip.hpp"
 
class DEV_MultiDevice;
class CPA_MainWorld;
class CPA_HierarchyEditor;
 
typedef enum tdeMouseMovePlane_
{
	E_mmp_Standard = 1,
	E_mmp_Warped
} 
tdeMouseMovePlane;
 
typedef enum tdeBVMode_
{
	E_bv_None,
	E_bv_Sectors,
	E_bv_Actors,
	E_bv_Objects,
	E_bv_Elements
}
tdeBVMode;
 
typedef enum tdeStatusBar_
{
	E_sb_InstanceInfo,
	E_sb_InstanceToCamera,
	E_sb_CameraInfo
}
tdeStatusBar;
 
#define C_szInterfaceIniFile "CPAPref.ini"
#define C_lNbMaxUsers 50
 
/*===========================================================================
*		Description:	Class CPA_Interface
*		Creation date:
*		Author:			Shaitan
*
*---------------------------------------------------------------------------
*		Revision date:                        Author:
*=========================================================================*/
class CPA_EXPORT CPA_Interface : public CObject
{
/*#################################################################################*/
/* MEMBERS*/
/*#################################################################################*/
 
protected:
	DEV_MultiDevice	*m_p_oMultiDevice;
	CPA_MainWorld	*m_p_oMainWorld;
 
	CPA_HierarchyEditor		*m_p_oEditor;
 
/* Popup*/
	EDT_PopUpMenu				  m_oPopUpMenu;
 
/* Select Mode */
	CComboBox					* m_pComboSelectMode;
	CString						  m_csSelectMode;
	BOOL						  m_bLinkMode;
 
/* Models */
	CPA_List<EDT_ModelsByType>	  m_stListOfModelsByType;
	EDT_ModelsByType			* m_pListAllModels;
	CBitmapList					  m_stListAllBitmaps;
	EDT_Model					* m_pCurrentModel;
 
/* Selection */
	CPA_DialogSelect			  m_oDialogSelect;
	BOOL						  m_bDeltaSelect;
	BOOL						  m_bFullSelect;
	BOOL						  m_bIgnoreFlags;
 
/* Model Frame*/
	CPA_DialogInsert			* m_pDialogInsert;
	CSplitFrame					* m_pModelFrame;
 
/* Specific Editor */
	CPA_SpecificInterface		  m_oSpecificInterface;
 
/* Hierarchy State*/
	BOOL						  m_bInitialState;
 
/* Camera Mode*/
	tdeTargetType				  m_ePreviousMode;
	BOOL						  m_bAutoTarget;
	BOOL						  m_bAutoZoom;
 
/* Camera Move Mode */
	BOOL						  m_bMoveCamera; 
 
/* Constraint for X,Y and Z axes*/
	BOOL						  m_bConsX;
	BOOL						  m_bConsY;
	BOOL						  m_bConsZ;
	BOOL						  m_bPyramidMode;
 
 
/* Pyramid Selection */
    /* Begin Point*/
	tdstMousePos                  m_stSelectionStartVertex;
	/* Selection Vertex (closest to camera)*/
	tdstMousePos                  m_stSelectionVertexTopLeft;
	tdstMousePos                  m_stSelectionVertexTopRight;
	tdstMousePos                  m_stSelectionVertexBottomRight;
	tdstMousePos                  m_stSelectionVertexBottomLeft;
	/* Far Selection Vertex (farthest to camera)*/
	tdstMousePos                  m_stFarSelectionVertexTopLeft;
	tdstMousePos                  m_stFarSelectionVertexTopRight;
	tdstMousePos                  m_stFarSelectionVertexBottomRight;
	tdstMousePos                  m_stFarSelectionVertexBottomLeft;
	/* Pyramid Modes*/
	BOOL                          m_bSelectionFrameVisible;
	BOOL                          m_bSelectionFrameCreating;
	BOOL                          m_bPyramidDepthChanging;
 
/* Object mouse move mode*/
	BOOL                          m_bModeIsObjectMouseMove;
	/* The axis of the plane where the mouse moves (in camera coordinates)*/
	MTH3D_tdstVector              m_stMouseXAxe, m_stMouseYAxe;
	MTH3D_tdstVector              m_stLastMoveXAxe, m_stLastMoveYAxe;
	MTH3D_tdstVector              m_stMouseMovePlaneCenter;
	BOOL                          m_bLastMovePlaneRemembered; /*true when true !*/
	tdeMouseMovePlane             m_eMouseMovePlane; /*true when true !*/
	/* Z in Selection Frames*/
	double						  m_dfZNearSelectionFrame;
	double						  m_dfZFarSelectionFrame;
	/* Normals to Pyramid Faces*/
	MTH3D_tdstVector              m_stNormaleTop;
	MTH3D_tdstVector              m_stNormaleBottom;
	MTH3D_tdstVector              m_stNormaleRight;
	MTH3D_tdstVector              m_stNormaleLeft;
	MTH3D_tdstVector              m_stNormaleNear;
	MTH3D_tdstVector              m_stNormaleFar;
	/* Mouse Coord.*/
	POINT						  m_stMouseFixPoint;
 
	/* user prefix*/
	CPA_DialogPrefix			  m_oDialogPrefix;
	CString						  m_a_csUserNames[C_lNbMaxUsers];
	CString						  m_a_csUserPrefix[C_lNbMaxUsers];
	CString						  m_a_csAuthorized[C_lNbMaxUsers];
	CString						  m_a_csProhibited[C_lNbMaxUsers];
	BOOL						  m_bUseUserPreferences;
	long						  m_lNbAuthorized;
	long						  m_lNbProhibited;
	long						  m_lNbUsers;
	CString						  m_csUserPrefix;
	/* languages*/
	CString						  m_csCurrentLanguage;
	/* names*/
	CPA_DialogPermission		  m_oDialogPermission;
	BOOL						  m_bIsLoadingWorld;
	long						  m_lNbObjectsRenamed;
 
	/* options*/
	CPA_DialogOption			  m_oDialogOption;
	float						  m_fPyramidalDepth;
	float						  m_fCameraTargetDepth;
	
	/* display parameters*/
	tdeBVMode					  m_eBVMode;
	BOOL						  m_bScaleObject;
	int							  m_iShowCenter;
 
	/* selection parameters*/
	BOOL						  m_bLockSelection;
	BOOL						  m_bFixedDepth;
	BOOL						  m_bRealTime;
 
	/* status bar parameters*/
	tdeStatusBar				  m_eStatusBarMode;
	BOOL						  m_bDisplayDistance;
 
	/* Show Center*/
	ACP_tdxHandleOfMaterial		  m_hCenterMaterial ;
	ACP_tdxHandleOfTexture		  m_pTexBar;
	BOOL						  m_bLoaded;
 
	/* Mouse Swap*/
	BOOL						  m_bAutomaticSwap;
	BOOL						  m_bCursorInFirstScreen;
	tdeForceSwap				  m_eForceSwap;
 
	/* Tip of Day*/
	CPA_DialogTip				  m_oDialogTip;
	BOOL						  m_bDisplayTipOfDay;
 
 
/*#################################################################################*/
/* PUBLIC FUNCTIONS*/
/*#################################################################################*/
 
public:
 
/*===========================================================================
	Inits
=========================================================================*/
 
	CPA_Interface  (void);
	~CPA_Interface (void);
 
	void Create (void);
	void Init	(void);
 
	static void StaticInit (void);
 
 
/*===========================================================================
	Get Functions
=========================================================================*/
/* acces*/
	DEV_MultiDevice		*	GetMultiDevice		(void)		{ return m_p_oMultiDevice; }
	CPA_MainWorld		*	GetMainWorld		(void)		{ return m_p_oMainWorld; }
	CPA_HierarchyEditor	*	GetEvtEditor		(void)		{ return m_p_oEditor; }
 
	DEV_MultiDevice3D	*	GetMultiDevice3D	(void)		{ return (DEV_MultiDevice3D *) m_p_oMultiDevice; }
	CPA_EditorBase		*	GetEditor			(void);
 
	FRMBaseMenu			*	GetFrameBase		(void);		
	CPA_World			*	GetCurrentWorld		(void);		
 
/* select mode*/
	CComboBox		*	GetComboSelectMode	(void)		{ return m_pComboSelectMode; }
	CString				GetSelectMode		(void)		{ return m_csSelectMode; }
	BOOL				GetLinkMode			(void)		{ return m_bLinkMode; }
 
/* models*/
	CPA_List<EDT_ModelsByType>	* GetListOfModelsByType			(void)	{ return &m_stListOfModelsByType; }
	EDT_ModelsByType			* GetListAllModels				(void)	{ return m_pListAllModels; }
	CBitmapList					* GetBitmapList					(void)	{ return &m_stListAllBitmaps; }
	EDT_Model					* GetCurrentModel				(void)	{ return m_pCurrentModel; }
	
/* selection*/
	CPA_DialogSelect		*	GetDialogSelect	(void)	{ return &m_oDialogSelect; }
	BOOL						fn_bDeltaSelect	(void)	{ return m_bDeltaSelect; }
	BOOL						fn_bFullSelect	(void)	{ return m_bFullSelect; }
	BOOL						fn_bIgnoreFlags	(void)	{ return m_bIgnoreFlags; }
 
/* Model Frame*/
	CPA_DialogInsert		* GetDialogInsert	(void)	{ return m_pDialogInsert; }
	CSplitFrame				* GetModelFrame		(void)	{ return m_pModelFrame; }
 
/* specific editor*/
	CPA_SpecificInterface	*	GetSpecificInterface	(void)	{ return &m_oSpecificInterface; }
 
/* hierarchy state*/
	BOOL	fn_bIsInitialState	(void) { return m_bInitialState; }
 
/* camera mode*/
	BOOL	fn_bAutoTarget		(void) { return m_bAutoTarget; }
	BOOL	fn_bAutoZoom		(void) { return m_bAutoZoom; }
 
/* camera move mode */
	BOOL	fn_bMoveCamera		(void) { return m_bMoveCamera; } 
 
/* constraint the X,Y and Z axes*/
	BOOL	fn_bConsX		(void) { return m_bConsX; }
	BOOL	fn_bConsY		(void) { return m_bConsY; }
	BOOL	fn_bConsZ		(void) { return m_bConsZ; }
 
/* display*/
	int		GetShowcenter			(void)			{ return m_iShowCenter; }
 
/* selection*/
	BOOL	GetLockSelection		(void)			{ return m_bLockSelection; }
 
/* statusbar*/
	tdeStatusBar		GetStatusBarMode	(void)	{ return m_eStatusBarMode; }
	BOOL				GetDisplayDistance	(void)	{ return m_bDisplayDistance; }
 
/* option*/
	BOOL	GetFixedDepthPyramid	(void)			{ return m_bFixedDepth; }
	BOOL	GetRealTimePyramid		(void)			{ return m_bRealTime; }
	float	GetPyramidalDepth		(void)			{ return m_fPyramidalDepth; }
	float	GetCameraTargetDepth	(void)			{ return m_fCameraTargetDepth; }
	BOOL    GetPyramidDepthMode		(void)			{ return m_bPyramidMode;}
 
 
/*===========================================================================
	Set Functions
=========================================================================*/
 
	void SetMainWorld		(CPA_MainWorld *p_oMainWorld);
	void SetMultiDevice		(DEV_MultiDevice *p_oMultiDevice);
 
	void SetHierarchyEditor (CPA_HierarchyEditor *p_oEditor) { m_p_oEditor = p_oEditor; }
 
	void SetSelectMode		(CString csSelectMode);
	void SetLinkMode		(BOOL bLinkMode)		{ m_bLinkMode = bLinkMode; }
 
	void SetCurrentModel	(EDT_Model *pModel);
 
	void SetInitialState	(BOOL bInitialState)	{ m_bInitialState = bInitialState; }
 
/* selection*/
	void SetDeltaSelect		(BOOL bDeltaSelect)		{ m_bDeltaSelect = bDeltaSelect; }
	void SetFullSelect		(BOOL bFullSelect)		{ m_bFullSelect = bFullSelect; }
	void SetIgnoreFlags		(BOOL bIgnoreFlags)		{ m_bIgnoreFlags = bIgnoreFlags; }
	void SetLockSelection	(BOOL bLockSel)			{ m_bLockSelection = bLockSel;}
 
/* options*/
	void SetPyramidDepthMode	(BOOL bMode)		{ m_bPyramidMode = bMode;}
	void SetFixedDepthPyramid	(BOOL bFix)			{ m_bFixedDepth = bFix;}
	void SetRealTimePyramid		(BOOL bRealTime)	{ m_bRealTime = bRealTime;}
	void SetPyramidalDepth		(float fDepth)		{ m_fPyramidalDepth = fDepth; }
	void SetCameraTargetDepth	(float fDepth)		{ m_fCameraTargetDepth = fDepth; }
	
/* display*/
	void SetShowcenter			(int iShow);
 
/* status bar*/
	void SetStatusBarMode		(tdeStatusBar eMode)	{ m_eStatusBarMode = eMode; }
	void SetDisplayDistance		(BOOL bDisp)			{ m_bDisplayDistance = bDisp;}
 
/*===========================================================================
	Update Functions
=========================================================================*/
 
	void fn_vUpdateAll			(tdeModeChange eMode);
	void fn_vUpdatePositions	(void);
	void fn_vChangeWorld		(void);
	void fn_vChangeRoot			(void);
	void fn_vBeforeEditor		(void);
	void fn_vUpdateEditor		(void);
 
	CString	GetTypeSelected		 (void);
	BOOL	fn_bIsSelectionValid (void);
 
	void fn_vCancelAllModes			(void);
	void fn_vCancelAllDrawingFlags	(void);
 
/*===========================================================================
	Select Mode
=========================================================================*/
 
	void fn_vInitSelectMode		(void);
	void fn_vOnChangeSelectMode (void);
	void fn_vOnChangeLinkMode	(void);
	void fn_vChangeSelectMode	(CString csSelectMode);
	void fn_vUpdateLink			(CString csCurrentMode);
 
/*===========================================================================
	Selection
=========================================================================*/
 
	void fn_vAddSelectedObject			(CPA_SuperObject *pNewObj, BOOL bUpdateDisplay = TRUE);
	void fn_vRemoveSelectedObject		(CPA_SuperObject *pEdObj, BOOL bUpdateDisplay = TRUE);
	void fn_vCancelCurrentSelection		(BOOL bUpdateDisplay = TRUE);
 
	tdeTypeAnswer	fn_bCanSelect		(CPA_SuperObject *pObjectToSelect, ACP_tdxIndex xIndex = 0, HIE_tdstPickInfo *pPicking = NULL);
	BOOL			fn_bSelectObject	(CPA_SuperObject *pSelectedObject, BOOL bCenter, BOOL bCheck = TRUE);
 
	void fn_vUpdateSelection			(CPA_SuperObject *pSelectedObject, tdeSelectMode eMode);
	void fn_vSetLocalColor				(CPA_SuperObject *pEdObj, tdeLightMode eMode);
 
/*===========================================================================
	Selection (Get Functions)
=========================================================================*/
 
	CPA_List<CPA_SuperObject> * GetSelectedObjects			(CPA_ObjectDLLBase *p_oDLL);
	CPA_List<CPA_SuperObject> * GetMouseSelection			(ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stObject, CString csTypeName);
	CPA_List<CPA_SuperObject> * GetMouseSelection			(ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stObject, CString a_csValidTypes[], long lNbTypes);
	CPA_SuperObject			  * GetUserMouseSelection		(ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stObject, CString csTypeName);
	CPA_SuperObject			  * GetUserMouseSelection		(ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stObject, CString a_csValidTypes[], long lNbTypes);
 
	CPA_SuperObject * GetPickingSelection	(tdeSelectMode eModeSelect, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stObject, tdstMousePos *p_stPos, BOOL *bWillDoDialog, CPA_SuperObject *pPreviousSelection = NULL);
	CPA_SuperObject * GetDialogSelection	(tdeSelectMode eModeSelect);
 
	CPA_SuperObject * GetFirstSelection		(tdeSelectMode eSelect, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo, CString csTypeName = "");
 
	long fn_lFindSelectionInDepth		(tdeSelectMode eSelect, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo, CString csTypeName = "");
	long fn_lFindSelectionInHierarchy	(tdeSelectMode eSelect, CPA_SuperObject *pFirstSelect, CString csTypeName = "");
 
/*CPA2 Corneliu Babiuc (multiple registration) 02-07-98*/
/*===========================================================================
	Registration
=========================================================================*/
	void fn_vAddRegisteredObject		(CPA_SuperObject *pNewObj);
	void fn_vRemoveRegisteredObject		(CPA_SuperObject *pEdObj);
	void fn_vCancelCurrentRegistration	();
	void fn_vUpdateRegistrationFromSelection				(CPA_List<CPA_SuperObject> * p_lstSelection);
	CPA_SuperObject * GetPreviousRegistration				(CPA_SuperObject *pEdObj);
	CPA_List<CPA_SuperObject> * GetRegisteredObjects		(CPA_ObjectDLLBase *p_oDLL);
/*CPA2 Corneliu Babiuc (multiple registration) 02-07-98*/
 
/*===========================================================================
	Lists (Get Functions)
=========================================================================*/
 
	CPA_List<CPA_SuperObject> * GetObjectListByType			(CString csTypeName, CPA_ObjectDLLBase *p_oDLL = NULL);
	CPA_BaseObjectList		  * GetSortedListByType			(CString csTypeName, CPA_ObjectDLLBase *p_oDLL = NULL);
	EDT_ListByType			  * GetListWithTypeName			(CString csTypeName, CPA_ObjectDLLBase *p_oDLL = NULL);
 
	EDT_ModelsByType		  * GetModelsWithTypeName		(CString csTypeName);
	CPA_SuperObject			  * GetNewInstance				(CString csTypeName, CString csModel);
 
	CPA_SuperObject			  * GetEditorObject				(HIE_tdxHandleToSuperObject hSupObj);
	CPA_SuperObject			  * GetSuperObject				(CString csTypeName, CString csName);
 
	CPA_SuperObject			  * GetPreviousSelection		(CPA_SuperObject *pEdObj);
 
/*===========================================================================
	Models
=========================================================================*/
 
	void fn_vInitListOfModelsByType (CPA_List<CPA_ObjectDLLBase> *pListOfObjectDLLs);
	BOOL fn_bAddANewModelList		(CString csListName, CPA_ObjectDLLBase *pObjectDLL);
	BOOL fn_bAddANewModel			(EDT_Model *pModel, CString csListName, CPA_ObjectDLLBase *pObjectDLL);
	BOOL fn_bRemoveAModel			(CString csModelName, CString csListName);
 
	/* load & save*/
	BOOL fn_bIsAlreadyLoaded		(CString csListName);
	BOOL fn_bLoadModelList			(CString csFileName, CString csListName, CPA_ObjectDLLBase *p_oDLL);
	void fn_vSaveModelList			(CString csFileName, CString csListName, CPA_ObjectDLLBase *p_oDLL, CPA_List<EDT_Model> *pListModels);
 
	static void					 CallBackSaveModelList	(SCR_tdst_File_Description *p_stFile, char *szSectionName, void *p_vData, SCR_tde_Ntfy_Action eAction);
	static SCRIPT_tdeReturnValue CallBackLoadModelList	(SCR_tdst_File_Description *p_stFile, char *szSectionName, char *szParams[], SCR_tde_Anl_Action eAction);
 
/*===========================================================================
	Hierarchy
=========================================================================*/
 
	BOOL fn_bInsertObjectInHierarchy (CPA_SuperObject *pEdObj, CPA_SuperObject *pParent, BOOL bUseEditManager = TRUE, BOOL bUpdateModif = TRUE, BOOL bSelect = TRUE, BOOL pBlock = FALSE);
	BOOL fn_bInsertAsPreviousBrother (CPA_SuperObject *pEdObj, CPA_SuperObject *pBrother, BOOL bUseEditManager = TRUE, BOOL bUpdateModif = TRUE, BOOL bSelect = TRUE, BOOL pBlock = FALSE);
	BOOL fn_bDeleteObjectInHierarchy (CPA_SuperObject *pEdObj, BOOL bUseEditManager = TRUE, BOOL bUpdateModif = TRUE, BOOL bDestroySuperObject = FALSE, BOOL bSelect = TRUE, BOOL pBlock = FALSE);
 
	CPA_SuperObject * GetNewSuperObject	(HIE_tdxHandleToSuperObject hEngineSO, 
										 tdeSaveStatus eStatus, tdeTypeSO eTypeSO = C_NoType, 
										 CString csName = "", CString csEngineFileName = "");
 
	CPA_SuperObject * GetNewSuperObject	(tdeSaveStatus eStatus, tdeTypeSO eTypeSO = C_NoType, 
										 CString csName = "", CString csEngineFileName = "");
 
	CPA_SuperObject * GetCopyOfSuperObject	(CPA_SuperObject *pModel);
 
/*===========================================================================
	Files
=========================================================================*/
 
	CPA_FileObject * GetFileObject (CString csFileName);
 
/*===========================================================================
	Pyramid selection
=========================================================================*/
 
	void fn_vInitPyramidDepth					(BOOL bInitMove);
	void fn_vInitSelectionPyramid				(tdstMousePos *p_stPos);
	BOOL fn_bDoSelectionPyramid					(tdstMousePos *p_stPos);
	void fn_vDrawSelectionFrame					(GLD_tdstViewportAttributes *p1);
	void fn_vEndSelectionPyramid				(void);
 
 
/*===========================================================================
	object moving
=========================================================================*/
 
	void fn_vEnterObjectMouseMoveMode	(void);
	void fn_vLeaveObjectMouseMoveMode	(void);
	void fn_vSetMouseMovePlane			(tdeMouseMovePlane _eMMP);
 
	void SetPlaneForMouseMove		(MTH3D_tdstVector *p_stX_Axe, MTH3D_tdstVector *p_stY_Axe);
	void RememberLastMouseMovePlane	(MTH3D_tdstVector *p_stX_Axe, MTH3D_tdstVector *p_stY_Axe);
	void SetMovePlaneCenter			(MTH3D_tdstVector *p_stPosition);
	void GetPlaneForMouseMove		(MTH3D_tdstVector *p_stX_Axe, MTH3D_tdstVector *p_stY_Axe);
	void fn_vDrawMoveObjectFrame	(GLD_tdstViewportAttributes *p1);
	void fn_vDrawSuperObjectsAxis	(GLD_tdstViewportAttributes *p1);
 
	void fn_vTranslate (CPA_SuperObject *pSelected,MTH3D_tdstVector *p_stVector, BOOL bAbsolute);
 
	tdeMouseMovePlane fn_eGetMouseMovePlane		 (void);
	BOOL			  fn_bGetObjectMouseMoveMode (void);
 
 
/*===========================================================================
	Popup menu
=========================================================================*/
 
	void fn_vDisplayPopupMenu	(tdstMousePos *p_stCoords);
	void fn_vDisplayMenuCommand (UINT IDCmdMsg);
 
    BOOL fn_bDefineSubMenu		(EDT_SubMenu *_p_oEDTSubMenu);
    void _OnSubMenuCommand		(EDT_SubMenu *_p_oEDTSubMenu,UINT uiMsgID);
 
/*===========================================================================
	Drawing
=========================================================================*/
 
	void fn_vCenterOnObject (CPA_SuperObject *pTarget, BOOL bZoom, BOOL bKeepTargeted);
	void fn_vZoomOnObject	(CPA_SuperObject *pTarget);
	void SetAutoTarget		(BOOL bAutoTarget);
	void SetAutoZoom		(BOOL bAutoZoom);
	void SetMoveCamera		(BOOL bMoveCamera) { m_bMoveCamera = bMoveCamera; }; 
 
	/*constrained X,Y and Z axes*/
	void SetConsX		(BOOL bCons);
	void SetConsY		(BOOL bCons);
	void SetConsZ		(BOOL bCons);
 
	BOOL fn_bWorldIsGrided		(void);
	BOOL fn_bWorldIsWired		(void);
	BOOL fn_bWorldIsTextured	(void);
	void fn_vChangeWorldMask	(long lOption, BOOL bAdd);
 
	void fn_vComputeAllBound	(void);
	void fn_vComputeBoundRecurs	(CPA_SuperObject *pFather);
 
	tdeBVMode	fn_eGetBVMode		(void)				{ return m_eBVMode; }
	void		fn_vSetBVMode		(tdeBVMode eBVMode);
	void		fn_vSetDisplayBV	(BOOL bDisplayBV, CPA_SuperObject *pSupObj, BOOL bRecursive);
 
	void	fn_vComputeSuperObjectsCenters	(GLD_tdstViewportAttributes *p1);
	void	fn_vDrawSuperObjectsCenters		(GLD_tdstViewportAttributes *p1);
	void	fn_vGetScreenProjection			(CPA_SuperObject *obj, MTH3D_tdstVector *prj);
 
/*===========================================================================
	Drawing
=========================================================================*/
 
	void fn_vSaveDisplayMode	(void);
	void fn_vLoadDisplayMode	(void);
 
	void fn_vSaveOptions		(void);
	void fn_vLoadOptions		(void);
 
	BOOL fn_bIsScaleActive	(void)			{ return m_bScaleObject ; }
	void fn_bSetScaleActive	(BOOL bScale)	{  m_bScaleObject = bScale ;}
	void fn_vScale	 (void);
	void fn_vReScale (void);
 
	void fn_vDoDialogOptions (void);
 
/*===========================================================================
	Language
=========================================================================*/
 
	void	fn_vSaveLanguage		(CString csLanguage);
	CString	fn_csGetCurrentLanguage (void)		{ return m_csCurrentLanguage; }
 
/*===========================================================================
	User Prefix
=========================================================================*/
 
	long GetNbObjectsRenamed	(void)				{ return m_lNbObjectsRenamed; }
	void fn_vAddRenamedObject	(void)				{ m_lNbObjectsRenamed++; }
	void SetNbObjectsRenamed	(long lNbRenamed)	{ m_lNbObjectsRenamed = lNbRenamed; }
	
	BOOL fn_bIsLoadingWorld		(void)				{ return m_bIsLoadingWorld; }
	void SetLoadingWorld		(BOOL bLoading)		{ m_bIsLoadingWorld = bLoading; }
 
	CString GetUserPrefix		(void)				{ return m_csUserPrefix; }
	CString GetUserPrefix		(long lIndex)		{ return (lIndex != -1) ? m_a_csUserPrefix[lIndex] : ""; }
	CString GetUserName			(long lIndex)		{ return (lIndex != -1) ? m_a_csUserNames[lIndex] : "<Unknown>"; }
 
	CString GetPrefixedName		(const CString csName);
	BOOL	fn_bCanModifyObject	(CPA_BaseObject *pObject);
 
	void fn_vAddAuthorization	(const CString csPrefix);
	BOOL fn_bIsAuthorized		(const CString csPrefix);
 
	void fn_vAddProhibition		(const CString csPrefix);
	BOOL fn_bIsProhibited		(const CString csPrefix);
 
	void fn_vSaveUserPrefix		(CString csUserPrefix);
	void fn_vSaveAuthorizations	(void);
	void fn_vSaveProhibitions	(void);
 
	BOOL fn_bUseUserPreferences (void)		{ return m_bUseUserPreferences; }
	void fn_vUseUserPreferences (BOOL bUse) { m_bUseUserPreferences = bUse; }
 
/*===========================================================================
	Mouse move
=========================================================================*/
 
	BOOL		 fn_bGetAutomaticSwap	(void)						{ return m_bAutomaticSwap;}
	BOOL		 fn_bSetAutomaticSwap	(BOOL bASwap)				{ return m_bAutomaticSwap = bASwap;}
 
	tdeForceSwap fn_eSetForceSwap		(tdeForceSwap eForceSwap)	{ return m_eForceSwap = eForceSwap;}
	tdeForceSwap fn_eGetForceSwap		(void)						{ return m_eForceSwap;}
	
/*===========================================================================
	TipOfDay
=========================================================================*/
 
	void fn_vDisplayTipOfDay (CString csEditor, CString csTag, BOOL bFirstTime);
 
/* Begin Silviu Simen Select by sector*/
/*===========================================================================
	Sector Selection
=========================================================================*/
 
	void	SelectBySector (void);
/* End Silviu Simen Select by sector*/
 
 
/*#################################################################################*/
/* PROTECTED FUNCTIONS*/
/*#################################################################################*/
 
protected:
 
/*===========================================================================
	Selection
=========================================================================*/
 
	BOOL fn_bCanBeSelected		(CPA_SuperObject *pEdObj, CString csTypeName, BOOL bCheckSelect);
	void fn_vSendMessageSelect	(CPA_SuperObject *pEdObj, tdeTypeModif eType);
 
/*===========================================================================
	Pyramid
=========================================================================*/
 
	void fn_vChangePyramidDepth					(tdstMousePos *p_stPos);
	void fn_vCreateSelectionFrame				(tdstMousePos *p_stPos);
	void fn_vCalculateSelectionPyramidNormals	(void);
	BOOL fn_bIsVertexInSelectionPyramid			(MTH3D_tdstVector *p_stVertex);
    void fn_vSelectObjectsInPyramid				(void);
	void fn_vSetZCamera							(GLD_tdhDevice hDev,GLD_tdhViewport hVp,MTH3D_tdstVector *p_stSrcVertex,MTH3D_tdstVector *p_stDstVertex,double z);
 
/*===========================================================================
	Drawing
=========================================================================*/
 
	void SetDrawingFlags	(CPA_SuperObject *pEdObj, tdeDrawingFlag eNewFlag);
 
/*===========================================================================
	Language
=========================================================================*/
	
	void	fn_vInitLanguage			(void);
 
/*===========================================================================
	User Prefix
=========================================================================*/
	
	void	fn_vInitUserPrefix		(void);
 
	BOOL	fn_bLoadListOfUsers		(void);
	void	fn_vLoadAuthorizations	(void);
	void	fn_vLoadProhibitions	(void);
 
	long	GetPrefixIndex			(const CString csPrefix);
	CString GetUserFromUsersFile	(void);
};
 
 
/* access*/
#define M_GetMultiDevice3D()		GetInterface()->GetMultiDevice3D()
#define M_GetEditManager()			GetInterface()->GetMultiDevice()->GetEditManager()
#define M_GetMainWorld()			GetInterface()->GetMainWorld()
#define M_GetWorld()				GetInterface()->GetCurrentWorld()
#define M_GetEditor()				GetInterface()->GetEditor()
#define M_GetEvtEditor()			GetInterface()->GetEvtEditor()
 
#define M_GetObjectDLLList()		(M_GetMainWorld()->GetListOfObjectDLLBase())
#define M_GetToolDLLList()			(M_GetMainWorld()->GetListOfToolDLLBase())
#define M_GetEditorList()			(M_GetMainWorld()->GetListOfEditorBase())
 
/* members*/
#define M_GetSelectMode()			GetInterface()->GetSelectMode()
#define M_GetCurrentModel()			GetInterface()->GetCurrentModel()
#define M_GetListOfModelsByType()	GetInterface()->GetListOfModelsByType()
 
/* functions*/
#define M_CancelSelection()		GetInterface()->fn_vCancelCurrentSelection()
 
/* main world members*/
#define M_GetCurrentEditor()	((CPA_DLLBase *) GetInterface()->GetMainWorld()->GetCurrentEditor())
/* world members*/
#define M_GetListSelected()		M_GetWorld()->GetListSelected()
#define M_GetSingleSelection()	M_GetWorld()->GetSingleSelection()
#define M_GetCountSelected()	M_GetWorld()->GetCountSelected()
#define M_GetListAllDLLs()		M_GetWorld()->GetListAllDLLs()
#define M_GetListAllTypes()		M_GetWorld()->GetListAllTypes()
#define M_GetListAllObjects()	M_GetWorld()->GetListAllObjects()
#define M_GetListOfListByDLL()	M_GetWorld()->GetListOfListByDLL()
 
/* editor members*/
#define M_IsCurrentEditor()			GetInterface()->GetEditor()->fn_bIsCurrentEditor()
 
 
#endif /* __CPA_INTERFACE__HPP__*/
#endif /* ACTIVE_EDITOR*/
