/* :ts=8 */
#ifndef INTUI_H
#define INTUI_H

#include <intuition/intuition.h>
#include <libraries/dos.h>
#include <exec/types.h>
#include <exec/io.h>
#include <exec/memory.h>
#include <exec/execbase.h>
#include <graphics/text.h>

#include <proto/exec.h>
#include <proto/graphics.h>

#include <exec/memory.h>
#include <exec/tasks.h>

#include <libraries/asl.h>
#include <graphics/view.h>
#include <graphics/gfx.h>
#include <graphics/gfxmacros.h>
#include <graphics/rastport.h>
#include <graphics/text.h>

#include <proto/intuition.h>
#include <proto/gadtools.h>
#include <proto/asl.h>

#include "general.h"
#include "windows.h"

#define SGadget_Info(G) ((struct StringInfo *) (G.SpecialInfo))

typedef struct {
	short	X_Min;
	short	Y_Min;
	short	X_Max;
	short	Y_Max;
	short	X_Center;
	short	Y_Center;
} View_T;


typedef enum {
	W_Main		= 0,
	W_Config	= 1,
	W_KnotInfo	= 2,
	W_ExpandedView	= 3,
	W_Scale_Group	= 4,
	W_Rotate_Group	= 5,
	W_Move_Group	= 6
} Window_Id_T;

#define Max_Nbr_Windows 	7

typedef struct {
	struct Window		*Window;
	struct ViewPort		*ViewPort;
	struct RastPort		*RastPort;
} Window_Info_T;

	/* View id's :  x, y, z and perspective	*/
typedef enum {
	V_X	= 0,
	V_Y	= 1,
	V_Z	= 2,
	V_P	= 3
} View_Id_T;

extern Window_Info_T	Windows[Max_Nbr_Windows];
extern Window_Id_T	Id_Active_Window;

extern View_T	Views_Small[4];
extern View_T	Views_Big[4];
extern View_T	*Views;	/* Points to either Views_Small or Views_Big */

extern unsigned long		MQ_Size_KnotInfo;
extern unsigned long		MQ_Size_Rotate_P;
extern unsigned long		MQ_Size_Rotate_G;
extern unsigned long		MQ_Size_Scale_G;
extern unsigned long		MQ_Size_Move_G;
extern unsigned long		MQ_Size_Move;

	/* TRUE when redrawing for each mouse move event */
extern Boolean_T		Redraw_Always;

extern struct MsgPort		*User_Port;

extern char   Error_Msg[];

void 	Set_Window_Title(char *Title);
void 	Display_Status(char *Message);
void 	Display_Message(char *Message);
void 	Display_Error_Message(char *Message);
int 	Ask_Question(char *Question, char *Choices);
void 	Set_Pointer(Boolean_T Busy);
void 	Set_RMBTrap(Boolean_T On);

void 	Window_Close(Window_Id_T Id);
void 	Window_Open(Window_Id_T Id);
void 	CloseStuff(void);
void 	OpenStuff(void);
void 	Finish(void);
void 	Clear_All(long What);
void 	Clear_Plane(int Plane, long What);
void 	Draw_Main_Background(void);
void 	Handle_Gadget_Event(struct IntuiMessage *Msg);
void 	Handle_Menu_Event(struct IntuiMessage *Msg);
void 	Check_Event(void);
int 	Wait_For_Key(void);

#endif
