/************************************************************************/
/* EICK SOFTWARE MODULE HEADER  *****************************************/
/************************************************************************/
/*   (c) Copyright Eick Systems, Inc.,					*/
/* 	 1989  All Rights Reserved 					*/
/*									*/
/* MODULE NAME : gemutil.h						*/
/* PRODUCT(S)  : 							*/
/*									*/
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE :				*/
/*									*/
/* MODIFICATION LOG :							*/
/*  Date     Who   Rev			Comments			*/
/* --------  ---  ------   -------------------------------------------	*/
/* 06/06/89  MDE   1.00    New						*/
/************************************************************************/

/*************************************************************************/
/* DEFINES                                                                                                           */
/*************************************************************************/

#define TRUE 1
#define FALSE 0
              /* Select the type of window to use                     	*/
#define WI_KIND         (SIZER|MOVER|FULLER|CLOSER|NAME)

#define NO_WINDOW (-1)
                                        /* Minimum size of the window                           */
#define MIN_WIDTH  (2*gl_wbox)
#define MIN_HEIGHT (3*gl_hbox)


/************************************************************************/
/* Defines for character I/O device selection						*/

#define PRT     0
#define AUX     1 
#define CONSOLE 2
#define MIDI    3
#define KEYPORT 4

/************************************************************************/
/* EXTERNAL VARIABLES                                                                                   */
/************************************************************************/

extern int      gl_apid;

/************************************************************************/
/* GLOBAL VARIABLES                                                                                             */
/************************************************************************/
/* GEM related variables                                                                                */

extern int     menu_id ;       /* our menu id (accessory only)  	*/

/* These variables are set when the graf_handle fun  is called  		*/
/* which is done first thing.                                   		*/
extern int    gl_hchar; 	/* height of a character in pixels  		*/              
extern int    gl_wchar;     /* width                            		*/
extern int    gl_wbox;      /* width of a character sized box   		*/
extern int    gl_hbox;      /* height                           		*/
extern int    gr_handle;    /* physical workstation handle      		*/

/* The virtual workstation handle is ret'd by v_opnvwk, given   		*/
/* the physical handle (gr_handle).                                     */
extern int vw_handle;        /* virtual workstation handle       		*/

/* The parameters below are set when the window is opened               */
extern int    wi_handle;    /* window handle                            */
extern int 	  xdesk;        /* desktop size, location parameters		*/
extern int    ydesk;        /* in pixels.                               */
extern int    hdesk;
extern int    wdesk;

/* Current window size and location parameters, updated when    	*/
/* the window in manipulated.                                                                   */
extern int    xwork;
extern int    ywork;
extern int    hwork;
extern int    wwork;

/* These variables are used to hold the 'old' window size, for  	*/
/* when the window is 'fulled', so that it can be restored.             */
extern int    xold;
extern int    yold;
extern int    hold;
extern int    wold;

/*  This is the handle of the currently topped window                   */
extern int     top_window;                     /* handle of topped window                              */

/* These parameters are used to handle data returned from the   	*/
/* event handler - event_multi.                                                                 */
extern int     msgbuff[17];	   /* event message buffer                                                     */
extern int     keycode;        /* keycode returned by event-keyboard                   */
extern int     mx,my;          /* mouse x and y pos.                                                   */
extern int     butdown;        /* button state tested for, UP/DOWN                             */
extern int     ret;            /* dummy return variable                                                */

/* General state variables.                                                                             */
extern int     m_hidden;               /* current state of cursor                                      */
extern int     w_fulled;               /* current state of window                                      */

/* VDI function in/out arrays                                                                   */
/* These are not generally used directly, but are used by the   	*/
/* GEM binding routines.                                                                                */
extern int     contrl[12];     /* function control parameters                          */
extern int     intin[128];     /* integer input array                                          */
extern int     ptsin[128];     /* input coordinate array                                       */
extern int     intout[128];    /* integer output array                                         */
extern int     ptsout[128];    /* output coordinate array                                      */

/* The pointer below will be set to point to a 32k buffer for   	*/
/* storing screen image before puting up forms, etc.                    */
extern char *scr_buf;          /* screen sized buffer           	*/

/************************************************************************/
/*  MULTI_DO DEFINITIONS                                        	*/
/************************************************************************/

extern int multi_do ();

extern (*ac_op_fun)();		/* ACCESSORY OPEN			*/
extern (*ac_cl_fun)();		/* ACCESSORY CLOSE			*/
extern (*but_fun)();		/* BUTTON EVENT				*/
extern (*kb_fun)();		/* KEYBOARD EVENT			*/
extern (*timer_fun)();		/* TIMER EVENT				*/
extern (*menu_fun)();		/* MENU ITEM SELECTED			*/
extern (*redraw_fun)();		/* WINDOW REDRAW FUNCTION		*/


/* MULTI_DO control variables						*/
/* These variables control the actions allowed by multi_do		*/

extern int multi_quit;	   	/* quit flag                   	 	*/
extern int w_type;
extern int wmin_w;		/* Window minimum size 			*/
extern int wmin_h;
extern int evnt_allowed;	/* events allowed 			*/
extern long timer_val;		/* timer event timeout (ms)		*/
			
extern int m_clicks;		/* number of clicks req'd		*/
extern int m_mask;		/* bit 0 = left allowed, 1 right	*/
extern int m_dir;		/* 1 == button down, 0 = up		*/ 

				/* 0 == entry event, 1 == exit		*/
extern int r1x;			/* coordinates for rectangle 1		*/
extern int r1y;
extern int r1w;
extern int r1h;
				/* rectangle 2 monitor param		*/
extern int r2_state;		/* 0 == entry event, 1 == exit		*/
extern int r2x;			/* coordinates for rectangle 2		*/
extern int r2y;
extern int r2w;
extern int r2h;

/************************************************************************/
/*  UTILITY ROUTINES.                                                   */
/************************************************************************/
/* These routines hide/show the mouse.                                                  */

extern hide_mouse();
extern show_mouse();

/************************************************************************/
/* open and initialize virtual workstation                              */
/* This function must be called after 'gr_handle' has been              */
/* initialized, and before using any screen functions                   */
/* Returns the workstation handle                                       */
/************************************************************************/

/* This array is written with workstation parameters after              */
/* v_opnwk is called.                                                   */

#define NUM_COLORS work_out[13]

extern int work_out[57];

extern int open_vwork();

extern int mono_flag;
extern int med_flag;
extern int low_flag;

/************************************************************************/
/* set clipping rectangle                                               */
/* This function turns on clipping, which limits screen op's to 	*/
/* a specified region of the screen.                                    */
/************************************************************************/

extern set_clip();

extern clear_clip();

/************************************************************************/
/* open window                                                          */
/* This function opens a window, returns the window handle.             */
/* Input params select window type, title, window size & locat. 	*/
/************************************************************************/

extern int open_window();

/************************************************************************/
/* Given a rectangle to be redrawn, this routine looks at each  	*/
/* rectangle that makes up the window.                                  */
/************************************************************************/

extern do_redraw();
extern OBJECT *menuptr;        /* main menu object tree pointer         */

extern int save_dial;		/* flag to cause screen to be saved	*/
extern int form_shrink;		/* flag to use box grow			*/
extern int form_grow;		/* flag to use box shrink		*/

extern do_bj_dial();
extern do_rj_dial();
extern do_dialog();

/************************************************************************/
/* Functions to save/restore sections of the screen.                    */
/* Used here to save/restore space used by dialog boxes                 */


extern scrn_save ();
extern scrn_restore ();

extern get_rnd_x ();
extern get_rnd_y ();

extern wait_msg ();


extern int_print ();

extern int x_offset;
extern int y_offset;;

/************************************************************************/
/* Function to get file path and name from user.			*/
/* Returns !0 for select OK, then result is in global var's		*/
/* Pass in the file name and extension to be used, uses default		*/
/* drive and path.												*/

#define PATH_LEN	70
#define FNAME_LEN	20

extern char gu_path[PATH_LEN+1];	/* selected path		*/
extern char gu_file[FNAME_LEN+1];	/* selected file		*/

extern int sel_file ();
extern char *get_fname ();



