/*
///////////////////////////////////////////////////////////////////////////////////////////////////
// Description : Inter.hpp
//   
// Interface DLL class.
// This class is implement the DLL class.              
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// inherit from CPA_ObjectDLLBase
//					
///////////////////////////////////////////////////////////////////////////////////////////////////
// Creation date: 21 jan 1997                        Author: J Thénoz
///////////////////////////////////////////////////////////////////////////////////////////////////
// Modification date:			                      Author: 
// 
//
// 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
*/

#ifndef __WPINTERF_HPP__
#define __WPINTERF_HPP__


class WayPoint;
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
class Way;
class Link2D;
class Link;
class DiaWP;
class DiaWay;
class DiaLink;
class Tangent;
*/
//ENDANNECY Shaitan Nettoyage }
//ROMTEAM Networks (Gabriela Dumitrascu 25/02/98)
class NtwDia;
//ENDROMTEAM Networks (Gabriela Dumitrascu)
class Cursor;
class Way_Interface;
class CPA_tdoNameList;
class Geometry3D;
class EdtList;
// Shaitan Correction {
class Graph;
// End Shaitan Correction }


//-----------------------------------------------------------
// Definition of the types objects
//-----------------------------------------------------------
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
#define C_ucWay       1968
#define C_ucLink      1997
#define C_ucTangent   1945
*/
//ENDANNECY Shaitan Nettoyage }
#define C_ucCursor    1918
//ROMTEAM Networks (Gabriela Dumitrascu 25/02/98)
#define C_ucGraph     1969
#define C_ucConnection 1970
//ENDROMTEAM Networks (Gabriela Dumitrascu)

// Shaitan Correction {
typedef enum tdeLinkDisplayMode_
{
	E_dm_ShowAllLinks,
	E_dm_ShowOutLinks,
	E_dm_ShowInLinks,
	E_dm_ShowNothing
}
tdeLinkDisplayMode;

typedef enum tdeWpSelectMode_
{
	E_sm_AddOrRemoveWP,
	E_sm_PrevWP_Popup,
	E_sm_NextWP_Popup,
	E_sm_NextWP_Key,
	E_sm_PrevWP_Key,
	E_sm_NextWP_Continue,
	E_sm_PrevWP_Continue,
	E_sm_Normal
}
tdeWpSelectMode;
// End Shaitan Correction }

//----------------------------------------------------------
// Object DLL interface class
//----------------------------------------------------------
class Waypoint_Interface : public CPA_ObjectDLLBase
{
private:
	//---- Flags
	BOOL        m_bModifInsertOk;  // Force the acception of the AcceptModifInsert message
	BOOL		m_bModifDeleteOk;	// Force the acception of the AcceptModifDelete message
	BOOL        m_bRunEngine;		// we are runnin the game
	BOOL		m_bStopDraw;		// Stop the effect of fn_vAddObjectsToDraw
	BOOL		m_bCreateMode;		// we are creating a way
	BOOL		m_bMainDll;			// this DLL is the main one ( for popup menu )
	BOOL        m_bRefreshWay;		 
	BOOL        m_bListAlreadyCreated;	// The list is already created by the DLL
	BOOL		m_bAddLink;				// The next waypoint is inserted on a link 
	BOOL		m_bExistWaypointSaveFile; // The waypoint save file exists when we change the map
	BOOL		m_bExistWaySaveFile;		// The way save file exists when we change the map
	BOOL		m_bComputeEngineWaypoint;	// No modif insert actions
	BOOL		m_bNextInstanceInWay;		// The next instance is created in a way
	BOOL		m_bStopSelect;				// selection is lock
	BOOL		m_bFirstBeforeEditor;		// never enter Before Editor function
	BOOL		m_bFirstActivateEditor;		// never enter OnActivateEditor function
	BOOL		m_bSkipOnModifDelete;		// skip OnModifDelete
	BOOL		m_bSkipOnModifInsert;		// skip OnModifInsert
	BOOL		m_bCommandWP;
	BOOL		m_bCommandLink;
	BOOL		m_bDialogOnScreen;			// is the dialog way/WP display on the screen ?
	BOOL		m_bModifRadius;				// Are we in modify radius mode ?
	BOOL		m_bOrientTangent;			// mouse tangent orientation

	//---- general
	CPA_EditorBase* m_poGeomDll;				// Geom Dll
	CPA_DialogList* m_p_oDialogList ;			// dialog list
	CSplitFrame*	m_p_oSplitFrameWP;			// split frame

	//----CPA_List
//ANNECY Shaitan Nettoyage (12/05/98) {
//	CPA_List<Way>	m_ListMovingWay;			// List of the Way to redraw by the OnMouving function
//ENDANNECY Shaitan Nettoyage }
	CPA_List<WayPoint> m_ListMovingWP;			// List of the WP to recompute by the OnMouving function
	CPA_List<CPA_SuperObject> m_oLoadListOfWay;	// list of the loaded way
	
	//---- CPA_BaseObjectList
	CPA_BaseObjectList m_oSortedListOfWay;
	CPA_BaseObjectList m_oSortedListOfObjectList;	
	CPA_BaseObjectList m_oSortedListOfNameList;		
	CPA_BaseObjectList m_oSortedListOfFamilly;
	CPA_BaseObjectList m_oSortedListOfActorModel;	
	CPA_BaseObjectList m_oSortedListOfActorInstance;	

	//---- Icon list
	CImageList	m_oIconWayList;	// list of icons for way list

	//---- waypoint management
	MTH3D_tdstVector m_stdCenterWP;	// center in real coordinate of the WP that is beeing moved
	MTH3D_tdstVector m_stdMouseVertex; // vertex of the mouse at the beginning of the draging action
	WayPoint* m_o_ModifRadiusWP; // We modify the radius of this WP
	//CPA2 Gabriela Dumitrascu 98-05-07
// Shaitan Correction {
//	BOOL m_bGraphMove;
//End Shaitan Correction }
	//End CPA2 Gabriela Dumitrascu 98-05-07

//ANNECY Shaitan Nettoyage (12/05/98) {
/*
	//---- way management
	Way*				m_pModifInsertWay;		// ref to the edit way
	WayPoint*			m_poAddWP;				// this is the WP we add to the way in the dialog
	Way*				m_pElasticWay;			// this the way we create
	CPA_SuperObject*	m_p_oGraphicModelLine; // model of graphic line 

	//---- link management
	Link2D*				m_poRButtonLink;		// R button on this link
	Link*				m_poSelectLink;			// we try to move this link
	Tangent* m_poTangentMove;		// Tangent we edit
	Link2D* m_poPlaneMove;			// Plane we rotate	
	Cursor* m_poCursorMove;			// Cursor we translate

	//---- RButton capture
	Tangent*			m_poRButtonDownTangent;	// we make a Rbutton Down on this tangent
	BOOL				m_bRButtonDownTangent;  // m_poRButtonDownTangent is valid

	Way*				m_poRButtonDownWay;	// we make a Rbutton Down on this way
	BOOL				m_bRButtonDownWay;	// m_poRButtonDownWay is valid
*/
//ENDANNECY Shaitan Nettoyage }

	//CPA2 Gabriela Dumitrascu 98-04-07
// Shaitan Correction {
//	BOOL				m_bRButtonDownWayPoint;	// m_poRButtonDownWayPoint is valid
//End Shaitan Correction }
	//End CPA2 Gabriela Dumitrascu 98-04-07


	//---- List management
//ANNECY Shaitan Nettoyage (12/05/98) {
//	CPA_BaseObject*	m_poWay;		// Current way
//ENDANNECY Shaitan Nettoyage }
	CPA_BaseObject*	m_poActor;		// Current actor instance
	CPA_BaseObject*	m_poModel;		// Current actor model
	CPA_BaseObject*	m_poFamilly;	// Current familly
	EdtList* m_poWayList;			// Current Edtlist

	// these datas are very protected and are just used to transmit datas between key down and key up
	GLI_tdst2DVertex	m_stMouseVertex2DCreate;
	MTH3D_tdstVector		m_stMouseVertex3DCreate;
	BOOL				m_bMouseVertexValid;      // These 2 previous values are valid ?    

// Shaitan Correction {
	Graph				* m_pSelectedGraph;
	WayPoint			* m_pDisplayedWayPoint;
	tdeLinkDisplayMode    m_eDisplayMode;
	tdeWpSelectMode		  m_eSelectMode;
	BOOL				  m_bSymetricMode;

	CPA_KeyActionConfiguration	* m_p_oKeyboard;
	
// End Shaitan Correction }

public:
	Waypoint_Interface(void);

//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
//										Dll Base
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------

//    BOOL fn_bPreTranslateMessage(MSG * /*p_stMsg*/);
    void fn_vJustAfterRegistered(void);
    void fn_vConstruct(void);
//    void fn_vRefreshDatas(void);
//	void fn_vLevelChanges (void);
	void fn_vLevelHasChanged (void);

// Editor Modifs
	void fn_vOnModifDelete	(CPA_List<EDT_SaveParents> *pListObjects, tdeTypeModif eType, tdeStatus eStatus);
//	void fn_vOnModifParent	(CPA_List<EDT_SaveParents> *pListObjects, tdeTypeModif eType, tdeStatus eStatus);
//	void fn_vOnModifCopy	(CPA_List<EDT_SaveParents> *pListObjects, tdeTypeModif eType, tdeStatus eStatus);
//	void fn_vOnModifName	(CPA_SuperObject *pEdObj, CString csInitalName, CString csFinalName, tdeTypeModif eType, tdeStatus eStatus);
//	void fn_vOnSelect		(CPA_SuperObject *pEdObj, tdeTypeModif eType, tdeStatus eStatus);

	void fn_vOnModifInsert	(CPA_SuperObject *pEdObj, CPA_SuperObject *pParent,
									 tdstPosition *p_stPosition, tdeTypeModif eType, tdeStatus eStatus);

// Moves
	void fn_vOnModifMove (CPA_List<EDT_SavePos> *pListObjects, CPA_List<EDT_SaveGlobalPos> *pListConcerned, tdeTypeModif eType, tdeStatus eStatus);
	void fn_vOnBeginMove (CPA_List<CPA_SuperObject> *pListObjects, CPA_List<CPA_SuperObject> *pListConcerned, tdeStatus eStatus);
	void fn_vOnMoving	 (CPA_List<CPA_SuperObject> *pListObjects, CPA_List<CPA_SuperObject> *pListConcerned, tdeStatus eStatus);

// permission
	BOOL fn_bAcceptModifDelete		(CPA_List<CPA_SuperObject> *pListObjects, tdeStatus eStatus);
//	BOOL fn_bAcceptModifParent		(CPA_List<CPA_SuperObject> *pListObjects, tdeStatus eStatus);
	BOOL fn_bAcceptModifCopy		(CPA_List<CPA_SuperObject> *pListObjects, tdeStatus eStatus);
	BOOL fn_bAcceptModifTranslate	(CPA_List<CPA_SuperObject> *pListObjects, tdeStatus eStatus);
	BOOL fn_bAcceptModifRotate		(CPA_List<CPA_SuperObject> *pListObjects, tdeStatus eStatus);
	BOOL fn_bAcceptModifInsert		(CPA_SuperObject *pEdObj, CPA_SuperObject *pParent, tdeStatus eStatus);
//	BOOL fn_bAcceptModifScale		(CPA_SuperObject *pEdObj, tdeStatus eStatus);
//	BOOL fn_bAcceptModifName		(CPA_SuperObject *pEdObj, tdeStatus eStatus);
//	BOOL fn_bAcceptMultiSelect		(void);

// to precise selection
	tdeTypeAnswer fn_bAcceptSelect	(CPA_SuperObject *pEdObj, ACP_tdxIndex xIndex, HIE_tdstPickInfo *pPicking, tdeStatus eStatus);

// orient
//	BOOL fn_bAcceptOrientInstance	(CPA_SuperObject *pEdObj);								
//	BOOL fn_bOnClickOrientPosition	(CPA_SuperObject *pEdObj, tdstPosition *pOrientPosition);
//	BOOL fn_bOnOrientingObject		(CPA_SuperObject *pEdObj, tdstPosition *pOrientPosition);
//	BOOL fn_bOnEndOrientObject		(CPA_SuperObject *pEdObj, tdstPosition *pOrientPosition);	



/*===========================================================================
	Dialog List
=========================================================================*/

//	BOOL fn_bSetCustomTest		(CPA_DialogList *pDialog);
//	BOOL fn_bCustomTestFunction (CString csCurrentType, CString csTestName, CPA_BaseObject *pEdObj);


//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
//										Editor Base
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------

// focus
//    void fn_vHasLostFocus	(void);
//    BOOL fn_bHasGainedFocus	(void);
// engine - editor
	void fn_vBeforeEngine (void);
	void fn_vBeforeEditor (void);
// engine
    BOOL fn_bAcceptToRunEngine		(void);
//    BOOL fn_bAcceptToRunTimerEngine	(void);
// end appli
//	void fn_vJustBeforeClosing	(void);
	BOOL fn_bAcceptToExit		(void);
// save
	BOOL fn_bAcceptToSave		(void);
//	void fn_vBeforeSaveAll      (void);
    void fn_vAfterSaveAll       (void);
// Shaitan Correction {
// keys
	BOOL _OnKeyDown (UINT nChar, UINT nRepCnt, UINT nFlags);
	BOOL _OnKeyUp	(UINT nChar, UINT nRepCnt, UINT nFlags);
//End Shaitan Correction }
// mouse
	BOOL _OnMouseMove	  (UINT nFlags, tdstMousePos *p_stPos, MTH3D_tdstVector *p_stVect);
    BOOL _OnLButtonDblClk (UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo);
//    BOOL _OnRButtonDblClk (UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo);
    BOOL _OnLButtonDown	  (UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo);
    BOOL _OnRButtonDown	  (UINT nFlags, tdstMousePos *p_stPos, ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stPickInfo);
    BOOL _OnLButtonUp	  (UINT nFlags, tdstMousePos *p_stPos);
//	BOOL _OnRButtonUp	  (UINT nFlags, tdstMousePos *p_stPos);
// command
//	BOOL _OnCommand			(UINT IDCmdMsg);
//	BOOL _OnUpdateCommandUI	(UINT uiID, CCmdUI *pCmdUI);
// dragdrop
//    BOOL _OnDragDropEnd			(WPARAM wParam, LPARAM lParam);
//    BOOL _OnDragDropMove		(WPARAM wParam, LPARAM lParam);
//    BOOL _OnDragDropLooseFocus	(WPARAM wParam, LPARAM lParam);
//    BOOL _OnDragDropGainFocus	(WPARAM wParam, LPARAM lParam);
// add objects to draw
	void fn_vAddObjectsToDraw	(GLD_tdstViewportAttributes *p1, GLI_tdxHandleToLight p2, DEV_ViewPort* p3);
//	void fn_vAddObjectsToDraw2	(GLD_tdstViewportAttributes *p1, GLI_tdxHandleToLight p2);


/*===========================================================================
	Reinit
=========================================================================*/

//	void fn_vOnChangeDevice (void);
//	void fn_vOnChangeWorld	(void);
//	void fn_vOnChangeRoot	(void);

/*===========================================================================
	Models
=========================================================================*/

//	BOOL fn_bCanDeleteThisModel	(CString csListName, CString csModelType, CString csModelName);
//	void fn_vOnAddModelToList	(CPA_ObjectDLLBase *pOwnerDLL, CString csListName, CString csModelName, tdeTypeModif eType);

/*===========================================================================
	for Dialog List
=========================================================================*/

	CPA_BaseObject  * GetDialogSelection (CPA_DialogList *pDialog, CString csTypeName, tdeListDrawMode eDrawMode);
	void			  GetListsForDialog  (CPA_DialogList *pDialog);

	BOOL fn_bOnSelChangeHierarchyTree	(CPA_DialogList *pDialog, CString csListName, CPA_BaseObject *pSelectedObject, CPA_BaseObject *pSelectedParent);
	BOOL fn_bOnDblClkHierarchyTree		(CPA_DialogList *pDialog, CString csListName, CPA_BaseObject *pSelectedObject, CPA_BaseObject *pSelectedParent);
	BOOL fn_bOnSelChangeListObjects		(CPA_DialogList *pDialog, CString csTypeName, CPA_BaseObject *pSelectedObject, BOOL bUnselect);
	BOOL fn_bOnDblClkListObjects		(CPA_DialogList *pDialog, CString csTypeName, CPA_BaseObject *pSelectedObject);
//	BOOL fn_bCanDragItemInHierarchyTree	(CPA_DialogList *pDialog, CString csTypeName, CPA_BaseObject *pObjectToDrag);
//	BOOL fn_bCanDropItemInHierarchyTree	(CPA_DialogList *pDialog, CString csTypeName, CPA_BaseObject *pObjectToDrop, CPA_BaseObject *pTarget);
//	BOOL fn_bOnDragDropInHierarchyTree	(CPA_DialogList *pDialog, CString csTypeName, CPA_BaseObject *pObject, CPA_BaseObject *pTarget);
	BOOL fn_bOnSelChangeComboList		(CPA_DialogList *pDialog, CString csTypeName);
	BOOL fn_bOnButtonTest				(CPA_DialogList *pDialog, CString csTypeName, tdeListDrawMode eDraw);

	BOOL fn_bOnKeyDownInDialog	(CPA_DialogList *pDialog, CString csTypeName, tdeListDrawMode eDraw, 
										 CPA_BaseObject *pSelectedObject, UINT nChar, UINT nRepCnt, UINT nFlags);
//	BOOL fn_bOnKeyUpInDialog	(CPA_DialogList *pDialog, CString csTypeName, tdeListDrawMode eDraw,
//										 CPA_BaseObject *pSelectedObject, UINT nChar, UINT nRepCnt, UINT nFlags);
	void fn_vInitDefaultParameters		(CPA_DialogList *pDialog);

//	void fn_vSetANewTest				(CPA_DialogList *pDialog, CString csCurrentList);
	BOOL fn_bTestFunction				(CString csCurrentType, CString csTestName, CPA_BaseObject *pEdObj);

	CString GetInfoForListItem	(CPA_DialogList *pDialog, CString csListName, CPA_BaseObject *pObject);
//	int		GetIconForListItem	(CPA_DialogList *pDialog, CString csListName, CPA_BaseObject *pObject);
	int		GetStateForListItem (CPA_DialogList *pDialog, CString csListName, CPA_BaseObject *pObject);

//	CPA_BaseObject * GetTreeNodeFirstChild	(CPA_DialogList *pDialog, CString csListName, CPA_BaseObject *pParent);
//	CPA_BaseObject * GetTreeNodeNextChild	(CPA_DialogList *pDialog, CString csListName, CPA_BaseObject *pParent, CPA_BaseObject *pCurrentChild);
//	int				 GetIconForTreeItem		(CPA_DialogList *pDialog, CString csListName, CPA_BaseObject *pObject);
//	int				 GetStateForTreeItem	(CPA_DialogList *pDialog, CString csListName, CPA_BaseObject *pObject);


/*===========================================================================
	Current Editor
=========================================================================*/

	tdePermission fn_eAcceptNewEditor	(CPA_EditorBase *pNewEditor);

	BOOL fn_bCanActivateEditor	(CPA_List<CPA_BaseObject> *pParams);
	void fn_vOnActivateEditor	(CPA_List<CPA_BaseObject> *pParams, BOOL bBackActivated=FALSE);

//	BOOL fn_bCanCloseEditor		(void);
	void fn_vOnCloseEditor		(void);

//	void fn_vBackActiveMe			(void *pMyData);
//	void fn_vEraseWalkDataStructure (void *pMyData);


/*===========================================================================
	Dialog Bar - Mircea Dunka 31 Aug. 1998
=========================================================================*/
	void fn_vDefineDlgBarBtnIcon (tde_DlgBarCategory wCategory, tds_DlgBarBtn *_pDlgBarBtn);

/*===========================================================================
	SubMenus and PopupMenu
=========================================================================*/

    BOOL fn_bDefineSubMenu		(EDT_SubMenu *_p_oEDTSubMenu);
    void _OnSubMenuCommand		(EDT_SubMenu *_p_oEDTSubMenu,UINT uiMsgID);

	BOOL fn_bDefinePopupMenu	(EDT_PopUpMenu *pPopup, CPA_List<CPA_SuperObject> *pSelection, BOOL bAsCurrentEditor);
	void _OnPopUpMenuCommand	(UINT m_IDCmdMsg);

/*===========================================================================
	Coherence
=========================================================================*/

//	BOOL fn_bOnInvalidateLink	(CPA_BaseObject *pOwner, CPA_BaseObject *pReferencedObject, BOOL bDestroyed);
//	void fn_vOnRestoreLink		(CPA_BaseObject *pOwner, CPA_BaseObject *pReferencedObject);
//	void fn_vOnModifyChild		(CPA_BaseObject *pOwner, CPA_BaseObject *pReferencedObject, unsigned long _ulData);

/*===========================================================================
	Draw Flag
=========================================================================*/

//	void fn_vOnModifDrawFlag (CPA_SuperObject *pSuperObject);

/*===========================================================================
	General Purpose
=========================================================================*/

    long OnQueryAction	(CPA_EditorBase * /*p_oSender*/, WPARAM, LPARAM);
//    long OnQueryInfos	(CPA_EditorBase * /*p_oSender*/, WPARAM, LPARAM);
//    long OnQueryOpen	(CPA_EditorBase * /*p_oSender*/, WPARAM, LPARAM);
//    long OnQueryClose	(CPA_EditorBase * /*p_oSender*/, WPARAM, LPARAM);

/*===========================================================================
	Reachable Objects
=========================================================================*/

//	BOOL fn_bLoadBaseObject		(CPA_BaseObject *p_oObject);


//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
//									Object DllBase
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------

// hierarchy
//	CPA_SuperObject *	GetNewEditorInstance		(HIE_tdxHandleToSuperObject pEngineInstance);
//	void				fn_vBuildNewEditorInstance	(CPA_SuperObject *pEditorInstance, HIE_tdxHandleToSuperObject pEngineInstance);
//	void				fn_vUpdateEditorInstance	(CPA_SuperObject *pEditorInstance, HIE_tdxHandleToSuperObject pEngineInstance);
//	BOOL				fn_bCanHandleThisType		(long lEngineType);
// models & instances
	void			fn_vInitListByType		(CPA_World *pWorld);
	void			fn_vInitListsOfModels	(void);
//	void			fn_vSaveListModels		(CString csListName, CPA_List<EDT_Model> *pListModels);
//	CString			fn_csLoadListModels		(void);
//	EDT_Model		* GetNewModel			(CString csListName);
//	BOOL			fn_bCanLoadNewModel		(CString csListName);
//	BOOL			fn_bCanDeleteModel		(CString csListName);
//	BOOL			fn_bCanSaveListModels	(CString csListName);
//	BOOL			fn_bCanLoadListModels	(void);
//	void			fn_vOnLoadNewModel		(CString csListName, EDT_Model *pNewModel);

	CPA_SuperObject * GetNewInstance		 (CString csTypeName, CString csModelName, CPA_SuperObject *pParent);
	tdeTypeSO		  GetTypeInstance		 (CString csTypeName, CString csModelName);
//ANNECY Shaitan EmptySectors 25/02/98
	tdeSaveStatus	  GetStatusInstance		 (CString csTypeName, CString csModelName);
//ENDANNECY Shaitan EmptySectors
	CPA_SuperObject * GetParentForInsertion	 (CString csTypeName, CString csModelName, tdstPosition *p_stPosition);
//	BOOL			fn_bChooseInsertPosition (CPA_SuperObject *pNewInstance, CPA_SuperObject *pParent, tdstPosition *p_stPosition);

// objects
//	CPA_BaseObject * GetNewObject (CString csObjectFile, CString csObjectName, FILE *p_fFile, CPA_MainWorld *p_oMainWorld);
	CPA_BaseObject * Duplicate	  (CPA_BaseObject *pObject, CPA_SuperObject *pNewSuperObject);

	CPA_SuperObject * GetCopyOfProtectedChild (CPA_SuperObject *pInitialChild, CPA_SuperObject *pNewOwner);

// permissions for EvtEditor
	BOOL fn_bAcceptAsParent			(CPA_BaseObject *pChild, CPA_BaseObject *pParent);
//	BOOL fn_bAcceptAsChild			(CPA_BaseObject *pParent, CPA_BaseObject *pChild);

// for bounding volumes
//	void fn_vComputeBoundingVolume(CPA_BaseObject *pObject);
	ACP_tdxHandleOfObject fn_hGetBoundingVolume(CPA_BaseObject *_pObj);

// when insertion is canceled
//	void fn_vOnCancelInsertion (CPA_SuperObject *pInstance);

// Shaitan Correction {
	// to scale editor objects
 	CPA_SuperObject * GetVisualSuperObject (CPA_SuperObject *pInstance);
//End Shaitan Correction }
	
	void fn_vUpdateObjectList (CPA_BaseObject *p_oObject, tdeUpdate eType);
	EDT_Model * fn_pstLoadNewDescriptor (void);

//--------------------------------------------------- Load
//ROMTEAM Networks (Gabriela Dumitrascu 25/02/98)
	void fn_vLoadGraph (void);
//ENDROMTEAM Networks (Gabriela Dumitrascu)
	void fn_vLoadWaypoint (void);
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
	void fn_vLoadWay (void);
	void fn_vInsertWaySon (void);
	Way* fn_pCreateWayFromEngine ( WP_tdhWay hWay, CPA_BaseObject* poOwner, CString csName, CString csReferencedSectionName );
*/
//ENDANNECY Shaitan Nettoyage }

//--------------------------------------------------- copy of way
//ANNECY Shaitan Nettoyage (12/05/98) {
//	CPA_SuperObject* fn_pCopyWay ( Way* poWay );
//ENDANNECY Shaitan Nettoyage }

	void fn_vSetNextInstanceInWay (void) { m_bNextInstanceInWay=TRUE;  }
	void fn_vSetModifDeleteOk (BOOL bModifDeleteOk) { m_bModifDeleteOk=bModifDeleteOk; }

//-------------------------------------------------- Dialog management
	void fn_vRefreshWaypointCoordinate (void);
	void fn_vRefreshList (void);
	void fn_vRefreshTestButton (void);
	void fn_vSaveDialogsPreferences (void);
	void fn_vSwapLinkDialog ( BOOL bOrientationMode );

//----------------------------------------------------------- Edition
	void fn_vEdit (WayPoint* poWP);
//ANNECY Shaitan Nettoyage (12/05/98) {
//	void fn_vEdit (Way* p_oWay, int iWpPos=0);
//	void fn_vEdit (Link* p_oLink);
//ENDANNECY Shaitan Nettoyage }


// Is there a waypoint in any way ?
//ANNECY Shaitan Nettoyage (12/05/98) {
//	BOOL fn_bWaypointInAWay ( WayPoint* poWP );
//ENDANNECY Shaitan Nettoyage }

//----------------------------------------------------------- Refresh Screen
	void fn_vRefreshScreen (void);
	void fn_vRefreshDisplayControl (void);

//--------------------------------------------------- other functions
	void fn_vComputeAbsoluteMatrix (CPA_SuperObject* psoWP);
	void fn_vComputeNewRelativeMatrix (HIE_tdxHandleToSuperObject _hSprObj);
	void fn_vComputeRelativeMatrix (CPA_SuperObject* poSuperObject, CPA_SuperObject* poParentSuperObject);


//------------------------------------------------------------- Draw	
	void fn_vDrawAllWP (void);
	void fn_vSetRefreshWay ( BOOL bRefreshWay ) { m_bRefreshWay = bRefreshWay; } 

//--------------------------------------- Selected objects in lists
	CPA_BaseObject* fn_pGetSelectedFamilly (void) { return m_poFamilly; }
	CPA_BaseObject* fn_pGetSelectedModel (void) { return m_poModel; }
	CPA_BaseObject* fn_pGetSelectedInstance (void) { return m_poActor; }
//ANNECY Shaitan Nettoyage (12/05/98) {
//	CPA_BaseObject* fn_pGetSelectedWay (void) { return m_poWay; }
//ENDANNECY Shaitan Nettoyage }
	EdtList*	fn_pGetSelectedEdtList (void) { return m_poWayList; }
	CPA_DialogList* fn_pGetDialogList (void) { return m_p_oDialogList; }

//--------------------------------------- Get new graphical instances	
	CPA_SuperObject* fn_pGetNewSymbolicalGraphicObject (void);
	CPA_SuperObject* fn_pGetNewSphericalGraphicObject (void);
	CPA_SuperObject* fn_pGetNewLineGraphicObject (void);
	CPA_SuperObject* fn_pGetNewTangentGraphicObject (GEO_tdstColor* pstColor);
	CPA_SuperObject* fn_pGetNewPlaneGraphicObject(void);
	CPA_SuperObject* fn_pGetNewCursorGraphicObject (void);
// Shaitan Correction  {
//	CPA_SuperObject* fn_pGetNewConnectionGraphicObject (int iGraph, int iNode, int iArc);
	CPA_SuperObject* fn_pCreateConnectionGraphicObject (Graph *pGraph, WayPoint *pSrcWP, WayPoint *pDstWP, long lCapacity, long lWeight);
//End Shaitan Correction }

	inline void fn_vRefreshHierarchyList (void);


//---------------------------------------- File Management
	//--- waypoint
	CString Waypoint_Interface::fn_csGetWaypointSaveFileName (void);
	BOOL fn_bIsExistWaypointFile (void) { return m_bExistWaypointSaveFile;  }
	void fn_vSetExistWaypointFile (BOOL bExistWaypointSaveFile) { m_bExistWaypointSaveFile=bExistWaypointSaveFile; }
	BOOL fn_bExistWaypointSaveFile (void);

	//--- way
	CString Waypoint_Interface::fn_csGetWaySaveFileName (void);
	BOOL fn_bIsExistWayFile (void) { return m_bExistWaySaveFile;  }
	void fn_vSetExistWayFile (BOOL bExistWaySaveFile) { m_bExistWaySaveFile=bExistWaySaveFile; }
	BOOL fn_bExistWaySaveFile (void);


	//--- important function that convert way in EdtList to Real way to edit
//ANNECY Shaitan Nettoyage (12/05/98) {
//	BOOL fn_bComputeRealWay (Way** ppoWay);
//ENDANNECY Shaitan Nettoyage }

	//--- return EdtList used by the actor
	EdtList* fn_poGetEdtListUseByActor (CPA_BaseObject* poActorInstance);
	CPA_BaseObject* fn_pGetActorUsingAList (EdtList* poEdtList);


protected :
	void fn_vPick ( ACP_tdxIndex* pxNbPicked, HIE_aDEF_stTabOfPickInfo& ra_stPickInfo, tdstMousePos *p_stPos);
//ANNECY Shaitan Nettoyage (12/05/98) {
//	void fn_vAddWayPoint (void);
//ENDANNECY Shaitan Nettoyage }
	CPA_SuperObject* fn_pExplorePicking (ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stObject, long lTypeObject, ACP_tdxIndex* pxFindIndex=NULL );
	CPA_SuperObject* fn_pFirstSuperObjectPicked (HIE_tdstPickInfo *p_stObject);
	CPA_SuperObject* fn_pFirstSuperObjectPickedInDynamicHierarchy (ACP_tdxIndex xIndex, HIE_tdstPickInfo *p_stObject);

//----------- tools
	// extract a reachable object from the list
	CPA_BaseObject* fn_pSelectWayPointParam ( CPA_List<CPA_BaseObject> *pParams );
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
	CPA_BaseObject* fn_pSelectWayParam ( CPA_List<CPA_BaseObject> *pParams );
	CPA_BaseObject* fn_pSelectLinkParam ( CPA_List<CPA_BaseObject> *pParams );
*/
//ENDANNECY Shaitan Nettoyage }

	// set the list of Way
	void fn_vSetCursor ( UINT i );
	void fn_vSetCursor ( LPCTSTR lpszResourceName );


//--------------------------------------------------- Lists management
	void fn_vEditWayList ( CPA_List<CPA_BaseObject>* poList );
	CPA_SuperObject* fn_pCreateEmptyWay (char* pszName, CPA_BaseObject* poFamilly);
//ANNECY Shaitan Nettoyage (12/05/98) {
/*
	void fn_vFillListOfWay (void);
	void fn_vGetListOfWaySuperObject ( CPA_List<CPA_BaseObject>* poSuperObjectList );
*/
//ENDANNECY Shaitan Nettoyage }

	void fn_vEditListOfWay			( CPA_BaseObject* poObjectList );
	void fn_vEditListOfActorModel		( CPA_BaseObject* poFamilly, BOOL bChange=TRUE );
	void fn_vEditListOfActorInstance	( CPA_BaseObject* poActorModel, BOOL bChange=TRUE );

	void fn_vEditListOfFamilly		( BOOL bChange=TRUE );
	

	CPA_BaseObject* fn_pGetOwnerOfList ( CString csTypeList );

	BOOL fn_bIsSuperObjectInStaticHierarchy (CPA_SuperObject* poSuperObject);

	void fn_vCreateVirtualWaypoint (void);
	void fn_vDeleteVirtualWaypoint (void);
	BOOL fn_bIsSubSectionInSection ( CString csFullPath, CString csSearchPath );

	void fn_vInitGameMaterial ( Geometry3D* poGeomObject, ACP_tdxHandleOfElement hElement, float fR, float fG, float fB );

	// modification of EdtList
	void fn_vNotifyAllEdtList ( CPA_tdoNameList* poNameList );

	void fn_vCleanHierarchy(void);

// Shaitan Correction {
public:
	
	tdeLinkDisplayMode	GetDisplayMode (void) { return m_eDisplayMode; }
	void				SetDisplayMode (tdeLinkDisplayMode eNewMode);

	Graph	 * GetSelectedGraph		(void) { return m_pSelectedGraph; }
	WayPoint * GetDisplayedWaypoint (void) { return m_pDisplayedWayPoint; }

	void fn_vSelectGraph			(Graph *pGraph);
	void fn_vSetDisplayedWaypoint	(WayPoint *pWaypoint, BOOL bCenter = FALSE);
	void fn_vUpdateConnections		(void);

	void fn_vUpdateEditor (tdeModeChange eMode);

	void fn_vSetSymetricMode (BOOL bSymetric)	{ m_bSymetricMode = bSymetric; }
	BOOL fn_bGetSymetricMode (void)				{ return m_bSymetricMode; }

};
// End Shaitan Correction }

extern tdstDLLIdentity     g_stWayPointIdentity;


#endif // __WPINTERF_HPP__




