/*  > command.h < */
/*********************************************************************/

#ifndef __command_h
#define __command_h 

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) < (b) ? (a) : (b))

#define CLOCK_TICK 100   /* centi-second timer on the Archimedes */

#define MInfo  1     /* main menu entries */
#define MQuit  3
#define MHelp  2

#define ICMPRS 10

#define FXsize    0   /* dialogue box fields */
#define FYsize    1
#define FInterval 2
#define FOk       3

#define MHalt     1  /* window menu entries */
#define ibuf_len 10
#define MResetInt 2

#include "dbox.h"
#include "txt.h" 
#include "image.h"

typedef struct {
 int filing_system;
 int zero_flag;
 char chars[228];
} data;

typedef struct {
 wimp_msghdr hdr;
 data data;
} my_msgstr;

       
/* --- Global variables --- */

menu imgmenu;  
menu main_menu;
dbox d;
txt helpwnd;


wimp_caretstr block;
wimp_palettestr pal;
wimp_palettestr aim_pal,invert_pal;
wimp_paletteword c[16];
sprite_ptr spr_ptr;
char *alloc[200];

int max_col,max_row,alloc_ptr,alloc_bottom,alloc_top,max_signals,
    number_of_signals,Init_Image_Width,Init_Image_Height;
wimp_wstate signal_st[MAXSIG],cmd_st;
BOOL cmdwind_is_open,trace_on,compress;
BOOL don,bon; /*display on/off en bargraph on/off */

/*--- External variables ---*/


extern VENSTER *vp[MAXSIG]; 

unsigned short MAX_LENGTH=65535;     /*Maximale lengte van een record */
unsigned short SAMPLE_RATE=65535;    /* Default sample-rate  *10         */



char father_dir[256];
int taskid;
int change, wimp_mode, width=1280,
    height=1024, OSx, OSy, OSbpp;
int save_ref = -1;
int scrap_ref = -1;
int magnmult,magndiv; 
int r_dit,r_shift;
int k_dit,k_shift,k_limit;
int grey_level=8;
char l_nibble,h_nibble;
sprite_pixtrans trans[256];     /* colour translation table for images    */
sprite_pixtrans wtrans[256];    /* colour translation table for wprintf   */

/*---- system wide globals --*/

extern int wprintf_window;

/* --- Local prototyping --- */
static void aim_mainmenuproc(void *handle, char *hit);
static menu aim_menumaker(void *);
static menu image_menumaker(void *);
static void image_menu_proc(void *, char *);
static void WimpMessage(wimp_msgstr * block);
static void WimpUserDragBox(wimp_box *drg_block);

/* --- Prototyping --- */

BOOL aim_new(void); 
void wimp_exit(void);
void select_grey_level(void);

/* --- External references --- */

void wvdu(char ch);
void wprintf(char *format, ...);
void wprintf_init(void);
void redo_wprintf(int handle);
void reinit_wprintf(int wimp_mode,BOOL init, BOOL display);
char *poll_loop(char * string,int,wimp_eventstr *);
int wgetch(void);
void image_handler(wimp_eventstr *e, void *handle);
void about_aim(void);

VENSTER * Create_ImagePool(unsigned int alloc_size, char *name);

#endif

