//================================================================
// libE3D
//
// 3DWindow header file
//
// AUTHOR:  Gabor Nagy
// DATE:    2026-Apr-25 21:52:55
//
// Copyright (C) 1996-2026 By Gabor Nagy. All rights reserved.
//================================================================
#ifndef _E3D_WindowAdv_h
#define _E3D_WindowAdv_h

#ifndef _E3D_Window_h
#include <E3D/UI/Window.h>
#endif

#include <Xe/Menu.h>     // For XeMenuRec

#ifndef _E3D_Item_h
#include <E3D/Item.h>    // For picking
#endif


#ifndef _E3D_Rendering_h
#include <E3D/Rendering.h>
#endif

/*
#ifndef _E3D_Panel_h
#include <E3D/UI/Panel.h>
#endif
*/

#ifndef _E3D_Window_h
#include <E3D/UI/Window.h>
#endif

#ifndef _E3D_ModeStack_h
#include <E3D/UI/ModeStack.h>
#endif


// Wrapper for glXMakeCurrent()
//


#if defined (__cplusplus) && (!(defined (__CPLUSLIBS)))
extern "C" {
#endif


// Header content flags for 3D windows
//
#define E3dHF_NONE         0x0000
#define E3dHF_VIEWMODE     0x0001
#define E3dHF_CAMERA       0x0002
#define E3dHF_SETTINGS     0x0004
#define E3dHF_DISPLAYMODE  0x0008
#define E3dHF_SIZE         0x0010
#define E3dHF_ALL          0x001F


enum
{
	E3dCaptureAABUFFER = 1,
	E3dCaptureFINAL
};


typedef struct E3dpWindow_S  E3dpWindow;


//------------------------------------------------------------------------
// Picking
//------------------------------------------------------------------------
#define E3dWindow_PointPickItems(p3DWindow, pScene, pTarget, pPickedItems,  pX, pY)\
	E3dWindow_RectanglePickItems(p3DWindow, pScene, pTarget, pPickedItems, pX - (E3dp_Prefs.PickPointSize) / 2, pY - (E3dp_Prefs.PickPointSize / 2), E3dp_Prefs.PickPointSize, E3dp_Prefs.PickPointSize)

typedef struct
{
	int            Reason;
	int            PtrX, PtrY;     // Pointer position
	E3dWindow*     E3DWindow;      // 3DWindow the where the Pick occured

	E3dCamera*     Camera;         // The Camera from which the pick was performed
	E3dModel*      CameraModel;    // The Camera's Model (Cameras may be instantiated, so their transforms are specified in Models)

	E3dCoord3      RayOrigin, RayDirection,  // The ray that was cast to pick an object
	               WorldPosition;
	E3dCoordinate  SnapToXV, SnapToYV, SnapToZV;

	unsigned int   Modifiers;
	int            Button;
	EBool          SnapToX, SnapToY, SnapToZ,
	               HighlightedItemChanged;    // The highlighted Edge, Vertex etc. changed as a result of a pointer move
} E3dPickCallbackStruct;

extern ECoreClass  E3dPickCallbackStruct_class[];


typedef void  (*E3dPickCallbackFunc)(E3dPickCallbackStruct* PPickStruct, EPointer PClientData,  const EIndex PNumOfPickedItems, E3dItem* PPickedItems);
//------------------------------------------------------------------------



#ifndef _E3dPanel
#define _E3dPanel
typedef struct E3dPanel_S   E3dPanel;
typedef struct E3dPanel_S*  E3dPanelPtr;
EList_t(E3dPanelPtr);
#endif


#define MAX_MODELWINDOWNUM  4
#define E3dpMAIN_WINDOW     1

typedef struct
{
	int        ActiveComponent;
	EObject*   Object;            // Manipulated object (e.g. Node)
	E3dMatrix  LocalToClipMatrix;
	E3dPlane   TangentPlane;
	E3dCoord3  UnitDragTangent;
} E3dManipulator;



#define E3dpViewCore\
	E3dViewCore;\
	XeWidget  ViewModeBW, HeaderMatrixW

typedef struct
{
	E3dpViewCore;
} E3dpView;


#define E3dCustomViewCore\
	E3dpViewCore;\
	E3dGridSettings  GridSettings  /* Custom views have their own grid settings, separate from 3D Views. */

typedef struct
{
	E3dCustomViewCore;
} E3dCustomView;

typedef struct
{
	E3dCustomViewCore;

// Window header
//
	XeWidget  LayoutOrientationBW;
	char      Orientation;

// Dialog boxes are shared, so these are static globals in View_Schematics.c (for now?)
//
//XeWidget  TopMatrixW, LinkStyleMatrixW, LinkStyleShortestW, LinkStyleCurvedW, LinkStylePerpendicularW;
//XeWidget  ShowObjectsBW, ShowPolyGroupsBW;
	EBool  ReLayoutAfterCollapse, ReLayoutAfterExpand;
	EBool  AutoFrame;
} E3dSchematicsView;


typedef struct
{
	E3dCustomViewCore;

	uint16_t  SelectionMode,  // Click on TexCoord boundary (E3dSelBOUNDARY) box or the texture-space Geometry (E3dSelGEOMETRY)
	          FramingMode;    // Frame TexCoord boundary (E3dSelBOUNDARY) box or the texture-space Geometry (E3dSelGEOMETRY)
	EBool     ShowAll, FollowSelection, ShowFaces;
	XeWidget  ShowAllW, SelectionMode_GeometryW, FollowSelectionW;
} E3dTextureView;


#define E3dAnimStackSelOpNONE  -1
#define E3dAnimStackSelOpADD   -2

typedef struct
{
	E3dCustomViewCore;

	EBool       AutoFrame;

	XeWidget    LinearBW, BezierBW, HermiteBW;
	XeWidget    AnimStackTextFieldW;XeMenuRec*  AnimStacksMenuBar;XeMenuRec*  AnimStacksMenu;XeWidget  AnimStackActiveW;
	int         Interpolation;
	int16_t     PrevStackSelectorOp;  // For middle-clicking on the AnimStack selector, E3dAnimStackSelOpNONE, etc. or the index of the previous AnimStack
} E3dAnimationView;



// 3DWindow settings
//
typedef struct
{
	E3dCoordinate  SnapToPointRadiusSq, SnapToEdgeRadiusSq, SnapToSurfaceRadiusSq;

	int            EdgeSteps;
	EBool          SnapToPointOnUnselected, SnapToPointOnSelected,
	               SnapToEdgeOnUnselected, SnapToEdgeOnSelected,
	               SnapToSurfaceOnUnselected, SnapToSurfaceOnSelected,
	               UseEdgeSteps;
} E3dWindowSettings;


typedef struct
{
	EIndex            ID;
	E3dCoord3         V0, V1, V2, V3;     // World coordinates
	E3dCoordinate     CornerRadius;

	EIndex            NVertices;
	E3dGLCoordinate*  WorldVertices;
	E3dGLCoordinate*  ScreenVertices;

	EcRGBAiColor      FrameRGBAiColor, AreaRGBAiColor;
} E3dArea, *E3dAreaPtr;
EListA_t(E3dAreaPtr);

typedef struct
{
	E3dWindow*    E3DWindow;
	E3dArea*      Area;
	XeIntervalId  TimerID;
	float         FadeTime, TimeLeft, TimeStep;
} E3dAreaFader;


typedef struct
{
	E3dCoord3      Position, AimPoint, UpVector;E3dCoordinate  BankAngle;
	E3dCoordinate  FieldOfView;
	E3dCoord2      Mag;

	E3dCoordinate  Lon, Lat;
} E3dFlyToTransform;


enum
{
	E3dBUTTON_PRESS = 1,
	E3dBUTTON_RELEASE,
	E3dPOINTER_MOTION
};



typedef struct
{
	E3dFlyToTransform  TransformStart, TransformEnd;
	EBool              DoRedraws;
} E3dFlyTo;


struct E3dpWindow_S
{
	E3dWindowCore;

	E3dPanel*           Panel;

	unsigned int        SizeFlags;                   // E3dZOOM, E3dZOOMHORIZ, E3dZOOMVERT
	unsigned int        HeaderFlags;                 // E3dHF_VIEWMODE, E3dHF_CAMERA, E3dHF_SETTINGS, E3dHF_DISPLAYMODE, E3dHF_SIZE

	E3dWindowSettings   Settings;

	E3dRendererSet*     RendererSet;

	E3dView*            LastViewMode;
	uint32_t            tViewModeID, tLastViewModeID;  // Temporary. Used only for saving/loading from files.


// For animating "Frame Camera to"
//
	E3dFlyTo            CameraFlyTo;

	float               FieldOfViewMin, FieldOfViewMax;  // Field of view range

	int                 CSStereoBlendingFunct;           // Blending function for anaglyph stereoscopic display

// Window header
//
	XeWidget            MatrixW;
	XeWidget            HeaderW;

	XeMenuRec*          ViewModeMenuBar;
	XeWidget            ViewModeCascadeBW;

	XeMenuRec*          CameraMenuBar;
	XeMenuRec*          CameraSelectorMenu;
	XeWidget            CameraCascadeBW;

	XeMenuRec*          RenderingModeMenuBar;
	XeWidget            RenderingModeCascadeBW;


	unsigned long       LastEventProcessed;              // Serial number of last X event

	E3dpView*           TopView;
	E3dpView*           FrontView;
	E3dpView*           RightView;

// We have statically allocated structs for these, because we have preferences save/load set up for them (E3dFIXME add support for saving prefs, even if a ViewClass is implemented by a plugin)
//
	E3dSchematicsView   SSchematicsView;
	E3dTextureView      STextureView;            // Texture ST editing
	E3dAnimationView    SAnimationView;          // Function curves

// These will point to the statically allocated structs above.
//
	E3dCustomView*      SchematicsView;
	E3dCustomView*      TextureView;
	E3dCustomView*      AnimationView;

	XeWidget            WindowSettingsButtonW;

	EList(, XeWidget, RendererWidgets);           // One for each RendererClass

	XeWidget            TexturesBW, SizeButtonW;

	XeWidget            FrameW;
	XeWidget            GLXW;                   // The GLX widget

	XeIntervalId        RendererProgressUpdateTimer;
	EBool               (*CameraControlFunc)(E3dWindow* P3DWindow,  const int PPtrX, const int PPtrY,  const uint8_t PAction, const int PButton, const unsigned int PModifiers);

	EListA_s(, E3dAreaPtr, Areas);

// EBool flags at the end (padding)
//
	EBool               PassResizeToRenderer;
	EBool               LiveRedraw;           // When TRUE, the window is being redrawn continously, (e.g. 60Hz for an HMD), so don't redraw it explicitly (e.g. while doing a camera fly-to, or an animation playback).

#ifdef EX11
	Window              X_Window;
#endif
};




//--------------------------------
// GUI.c
//--------------------------------
extern E3dWindow*   E3dp_Active3DWindow;    // The active window
extern E3dWindow*   E3dp_Main3DWindow;

extern EObjectClass   E3dpWindow_class[];
extern EResourceList  E3dpWindow_resources;

//--------------------------------
// GL/Scene.c
//--------------------------------
extern void            E3dNode_GLDrawCenter(E3dNode* PNode,  const E3dDrawContext* PDrawContext);
extern void            E3dSpecialObject_Draw(E3dModel* PModel, E3dObject* PObject,  E3dWindow* P3DWindow, E3dScene* PScene, E3dRenderer* PRenderer, E3dDrawContext* PDrawContext);
extern void            E3dModel_DrawExtras(E3dRenderer* PRenderer, const E3dDrawContext* PDrawContext, E3dGPUContext* PGPUContext,  E3dModel* PModel);
extern E3dHWDrawFlags  E3dNode_GLDrawComponentObjects(E3dWindow* P3DWindow, E3dRenderer* PRenderer, E3dDrawContext* PDrawContext,  E3dNode* PNode);
extern void            E3dItems_Draw(E3dWindow* P3DWindow, const uint32_t PSubCameraID, E3dDrawContext* PDrawContext,  E3dDrawItem* PItems, const EIndex PNItems,  const E3dMatrix PWorldToViewerMatrix, const EBool PDrawCamera);


//--------------------------------
// Panel/GL/Display.c
//--------------------------------
extern void  E3dGL_FontInit(void);
extern void  E3dGL_FontFree(void);
extern void  E3dWindow_AcceleratorsVisualize(E3dWindow* P3DWindow, E3dRenderer* PRenderer, const E3dDisplayFlags PDisplayFlags, const int PSSAAMult,  E3dScene* PScene);

//--------------------------------
// GL/Window.c
//--------------------------------
extern void  E3dView_FreeGLData(E3dView* PView);
extern int   E3dView_GLDrawForPick2D(E3dpWindow* P3DWindow, E3dScene* PScene, const E3dItemFlags PPickTargets,  const EIndex PX, const EIndex PY,  const EIndex PSizeX, const EIndex PSizeY,  E3dPickGlobals* PPickGlobals,  GLuint* PGLPickBuffer);

extern void  E3dWindow_Draw2DRectangle(E3dWindow* P3DWindow, E3dScene* PScene,  const E3dCoordinate PX1, const E3dCoordinate PY1,  const E3dCoordinate PX2, const E3dCoordinate PY2, EcRGBAiColor* PFrameRGBAiColor, EcRGBAiColor* PAreaRGBAiColor);
extern void  E3dWindow_Draw2DRectangleWorld(const E3dWindow* P3DWindow,  const E3dCoordinate PX1, const E3dCoordinate PY1,  const E3dCoordinate PX2, const E3dCoordinate PY2,  const EcRGBAiColor* PFrameRGBAiColor, const EcRGBAiColor* PAreaRGBAiColor);

extern void  _E3dWindow_DrawManipulators(E3dWindow* P3DWindow, E3dRenderer* PRenderer, E3dDrawContext* PDrawContext, E3dScene* PScene,  const int PPtrX, const int PPtrY,  const EBool PForPick, E3dManipulator*** PManipulatorsP, EIndex* PNumOfManipulatorsP);



//--------------------------------
// Panel/View_3D.c
//--------------------------------
extern int   E3dp_View3DSelectionBBox(E3dScene* PScene, E3dBBox* PAllBBox, const unsigned int PWhatToInclude);


//--------------------------------
// Panel/3DWindow.c
//--------------------------------
extern EBool  _E3dp_BrokenSwapbuffers;
extern EBool  _E3dp_ExposeBufferInOS;

extern EObjectClass  E3dWindow_class[];

extern E3dViewClass  E3dPerspectiveView_class[];
extern E3dViewClass  E3dTopView_class[];
extern E3dViewClass  E3dFrontView_class[];
extern E3dViewClass  E3dRightView_class[];
extern E3dViewClass  E3dSchematicsView_class[];
extern E3dViewClass  E3dTextureView_class[];
extern E3dViewClass  E3dAnimationView_class[];


extern EBool         E3dp_RedrawEnabled;


EList(extern, E3dObjectSelection, _E3dp_NodeSelections);
EList(extern, E3dObjectSelection, _E3dp_ObjectSelections);

extern void   E3dp_StoreNodeAndObjectSelection(E3dScene* const PScene);

extern E3dUserInputContext  E3dp_UserInputContext;

extern E3dAreaFader         _E3dp_ZoomIntoRegionAreaFader;
extern E3dAreaFader         _E3dp_TagPointsAreaFader;
extern E3dAreaFader         _E3dp_SelectNodesAreaFader;
extern E3dAreaFader         _E3dp_SelectObjectsAreaFader;


extern EpImage*    E3dWindow_GetImage(E3dWindow* P3DWindow, E3dRenderer* PRenderer, EpImage* PDImage);

extern XeString    E3dWindow_GetInfoOnObjectUnderPointer(E3dWindow* P3DWindow, E3dScene* PScene, const E3dPointerMode* PPointerMode, const int PDragSelectButton,  const int PX, const int PY);

extern E3dCamera*  E3dWindow_GetCameraByViewClass(E3dWindow* P3DWindow, const E3dViewClass* PClass,  E3dModel** PCameraModelP);
extern int         E3dWindow_SetCameraByViewClass(E3dWindow* P3DWindow, const E3dViewClass* PClass,  E3dCamera* PCamera, E3dModel* PCameraModel);
extern int         E3dWindow_SetLastCameraByViewClass(E3dpWindow* P3DWindow, E3dViewClass* PClass,  E3dCamera* PCamera, E3dModel* PCameraModel);

extern E3dCamera*  E3dWindow_GetActiveCamera(const E3dWindow* P3DWindow, E3dModel** PCameraModelP);

extern void        E3dWindows_RedrawByMode(const unsigned int PViewModes, const E3dDisplayFlags PDisplayMode, const EChangeFlags PChangeFlags);
extern void        E3dWindows_SwapBuffers(const EBool PIgnoreLiveRedraw);

extern void        E3dWindow_VerifyPointerMode(E3dpWindow* P3DWindow);

extern void        E3dWindow_FrameXYView(E3dWindow* P3DWindow, E3dScene* PScene,  E3dCoord3* PMin, E3dCoord3* PMax, E3dCoordinate PXMult, E3dCoordinate PYMult);

extern void        E3dWindows_ResetViewModeAndRenderer(void);

extern void        E3dWindow_UpdateCameras(E3dWindow* P3DWindow);
extern EBool       E3dWindow_ResetCameras(E3dWindow* P3DWindow, E3dScene* PScene, const EBool PFlyTo);
extern void        E3dWindows_ResetCameras(E3dScene* PScene, const EBool PFlyTo);

extern E3dArea*    E3dWindow_AreaAdd(E3dWindow* const P3DWindow, E3dCoordinate PX1, E3dCoordinate PY1, E3dCoordinate PX2, E3dCoordinate PY2, const EcRGBAiColor* PFrameRGBAiColor, const EcRGBAiColor* PAreaRGBAiColor);
extern EBool       E3dWindow_AreaRemove(E3dWindow* P3DWindow, E3dArea* PArea);
extern void        E3dWindow_AreaChange(E3dWindow* const P3DWindow, E3dArea* PArea, E3dCoordinate PX1, E3dCoordinate PY1, E3dCoordinate PX2, E3dCoordinate PY2, const EcRGBAiColor* PFrameRGBAiColor, const EcRGBAiColor* PAreaRGBAiColor);
extern void        E3dWindow_AreaFadeOut(E3dWindow* PWindow, E3dArea* PArea, E3dAreaFader* PFader);
extern void        E3dp_AreaCancel(E3dAreaFader* PFader);


// Private functions
//
extern EChangeFlags _E3dWindow_ProcessSelect(E3dWindow* P3DWindow, E3dScene* PScene,  const int PPtrX, const int PPtrY,  const int PButton, const unsigned int PModifiers, E3dUserInputContext* PUserInputContext);
extern void         _E3dWindow_ProcessPick(E3dWindow* P3DWindow, E3dScene* PScene,  const int PPtrX, int const PPtrY,  const int PButton, const unsigned int PModifiers, const EBool PMotion);
extern void         _E3dWindow_ButtonRelease(E3dWindow* P3DWindow, E3dScene* PScene,  const int PPtrX, const int PPtrY,  const int PButton, const unsigned int PModifiers);

extern void         _E3dp_AddOther3DWindowsNoCameraMove(E3dWindow* P3DWindow, E3dScene* PScene,  E3dWindow*** PFlyToWindowsP, EIndex* PNumOfFlyToWindowsP);



//--------------------------------
// Panel/3DWindow_X.c
//--------------------------------
#define E3dWindowSettingsPanelCore\
	E3dWindow*  Edited3DWindow;\
	XeWidget    DialogBoxW;\
	XeWidget    RendererStatsLabelW

typedef struct
{
	E3dWindowSettingsPanelCore;
} E3dWindowSettingsPanel;


extern E3dpWindow*    E3dpWindow_New(const char* PName, const char* PCameraName, E3dRendererSet* PRendererSet);

extern E3dpWindow*    E3dPanel_AddWindow(E3dPanel* P3DPanel, const char* PName, const uint16_t PWindowFlags, const uint32_t PHeaderFlags, E3dViewClass* PViewClass, const E3dRendererClass* PRendererClass);
extern void           E3dPanel_WindowsCameraUpdate(E3dPanel* P3DPanel);

extern EBool          E3dWindow_IsNormal3DView(E3dWindow* P3DWindow);
extern E3dViewClass*  E3dp_ViewModeEnumToClass(const int PViewMode);

extern E3dGridSettings*     E3dWindow_GetGridSettings(E3dWindow* P3DWindow);
extern E3dOverlaySettings*  E3dWindow_OverlaySettings(E3dWindow* P3DWindow);

extern void           _E3dp_CheckKeyboardState(XeDisplay* PDisplay, E3dWindow* P3DWindow, unsigned int PKeyState,  const EIndex PPtrX, const EIndex PPtrY);

extern void           _E3dEH_HeaderWidgets(XeWidget PW, XeEvent* PEvent, EPointer PClientData, EBool* PCdr);

extern void           E3dEH_GLXDrawWidgetWindow(XeWidget PW, XeEvent* PEvent, EPointer PClientData, EBool* PCdr);

extern void           E3dpWindow_UpdateUI(E3dpWindow* P3DWindow);

extern EBool          E3dWindow_GetPointerPosition(E3dWindow* P3DWindow,  int* PX, int* PY);

extern void           E3dWindow_BorderOnOff(E3dpWindow* P3DWindow);
extern void           E3dPanel_WindowBordersOnOff(E3dPanel* P3DPanel);

extern int            E3dWindow_WaitForInitialize(E3dWindow* P3DWindow, E3dRenderer* PRenderer);

extern void           E3dWindow_Exit(void);


//--------------------------------
// GL/Window.c
//--------------------------------
extern void          E3dGL_SetUpAA(const E3dGPUAA* PAA);

extern int	         E3dWindow_DrawAxes(const E3dWindow* P3DWindow, const E3dDrawContext* PDrawContext,
                      const char* PString0, const EcRGBAp8Color PColor0,  const char* PString1, const EcRGBAp8Color PColor1,  const char* PString2, const EcRGBAp8Color PColor2);

extern void          E3dWindow_DrawGrid(E3dWindow* P3DWindow, const E3dRenderer* PRenderer,  E3dCamera* PCamera, E3dModel* PCameraModel,  const E3dDrawContext* PDrawContext, const EBool PUsingLighting);
extern int           E3dWindow_GLMakeCurrent(E3dWindow* P3DWindow);
extern int           E3dWindow_SwapBuffers(E3dWindow* P3DWindow);

extern int           E3dGraphicsAPI_Init(const ETime PTimeOut_ms);


//--------------------------------
// Panel/Display.c
//--------------------------------

extern E3dRenderer*  E3dWindow_Renderer(E3dWindow* P3DWindow);
extern E3dRenderer*  E3dWindow_RendererByClass(E3dWindow* P3DWindow, const E3dRendererClass* PClass);

extern void          E3dWindow_Clear(E3dWindow* P3DWindow, E3dRenderer* PRenderer);
extern int           E3dWindow_Redraw(E3dWindow* P3DWindow, E3dScene* PScene,  EChangeFlags PSceneChangeFlags, const EChangeFlags PRendererChangeFlags,  const EBool PSwapBuffers);
extern void          E3dWindows_RedrawByChangeFlags(E3dScene* PScene, const EChangeFlags PSceneChangeFlags);
extern void          E3dWindows_RedrawByChangeFlagsExt(E3dScene* PScene, const EChangeFlags PSceneChangeFlags,  E3dWindow* PExcludeThisWindow, const EBool PIgnoreLiveRedraw, const EBool PSwapBuffers);
extern void          E3dWindows_Redraw(E3dScene* PScene);
extern void          E3dWindows_RedrawByCamera(E3dScene* PScene,  E3dCamera* PCamera, E3dModel* PCameraModel, const EChangeFlags PSceneChangeFlags);

extern void          E3dWindow_FinishDrawing(E3dWindow* P3DWindow, E3dScene* PScene, EpGPUFrameBuffer* PFBO, E3dRenderer* PRenderer, const E3dDisplayFlags PDisplayFlags, const E3dGPUAA* PAA, const int PAAMult, const EBool PHDR);

extern EBool         E3dWindow_NeedsFullWindowPass(const E3dWindow* P3DWindow, const int PAAMult);

extern void          _E3dWindow_UpdateSettingsDialog(E3dpWindow* P3DWindow, const EBool PNew);
extern void          _E3dpCB_WindowSettings(XeWidget PW, EPointer PClientData, EPointer PCallData);
extern void          _E3dWindow_SettingsClose(void);
extern E3dWindowSettingsPanel*  E3dWindow_BeingEdited(const E3dWindow* P3DWindow);

//----------------------------------------
// Panel/Pick.c
//----------------------------------------
extern int                  E3dp_PickMode;
extern E3dPickCallbackFunc  E3dp_PickCallbacFunc;
extern EPointer             E3dp_PickCallbackClientData;
extern int                  E3dp_PickBufferSize;


extern void            E3dp_PickFree(void);
extern int             E3dp_PickRequest(const XeString PMessage, const int PWhat,  E3dPickCallbackFunc PCallbackProc, EPointer PCallbackClientData,  const int PTimeOut, const EBool PActivateOnMotion);
extern void            E3dp_PickStop(void);
extern void            E3dp_PickResume(void);
extern void            E3dp_PickEnd(void);
extern void            E3dp_PickAbort(void);

extern E3dCamera*      E3dWindow_CastPrimaryRay(E3dWindow* P3DWindow, const int PMX, const int PMY, E3dRay* PRay, E3dModel** PCameraModelP);

extern void            E3dp_ItemsPrint(const E3dItem* PItems, const EIndex PItems_Count);

extern int             E3dWindow_RectanglePickItems(E3dWindow* P3DWindow, E3dScene* PScene, const E3dItemFlags PPickTargets, E3dItem* PItems,  E3dPixelCoordinate PX, E3dPixelCoordinate PY,  E3dPixelCoordinate PSizeX, E3dPixelCoordinate PSizeY);
extern const E3dItem*  E3dp_PickGetRelevantItem(const E3dItem* PItems, const int PItems_Count, const unsigned int PPickMode);

extern void   _E3dpEH_GLXDrawWidget(XeWidget PW, XeEvent* PEvent, EPointer PClientData, EBool* PCdr);
extern void   _E3dWindow_SetHighlight(E3dWindow* P3DWindow, const EBool PHighlight);


extern void  E3dWindows_AnimationStackSelectorUpdate(const EBool PUpdateLists);

extern void                   E3dRenderer_ApplyChanges(E3dpWindow* P3DpWindow, const EBool PToAllWindows, EChangeFlags PChangeFlags, EChangeFlags PRendererChangeFlags,  void (*PFunc)(const EObject* PSrc, EObject* PDst));


#if defined (__cplusplus) && (!(defined (__CPLUSLIBS)))
}	// Close scope of 'extern "C"' declaration
#endif

#endif	// _E3D_WindowAdv_h
