/*
 * wimp.h --- declarations for Napsaterm graphical interface 
 *
 * Authors: Pekka Pessi <Pekka.Pessi@hut.fi>
 *          Chris Newman,
 *          Todd Williamson.
 *
 * Copyright (c) 1989, 1993 by authors.  All Rights Reserved
 *
 * Permission is granted to copy, modify, and use this as long
 * as this notice remains intact.  This is a nifty program.
 *
 * DISCLAIMER: the authors of this program are not responsible
 * for any damage or other problems caused by it.
 *
 * Created      : Sat Nov 13 06:55:40 1993 ppessi
 * Last modified: Sat May 14 17:14:44 1994 ppessi
 *
 * $Log: wimp.h,v $
 * Revision 3.2  1994/05/14  14:15:19  ppessi
 * Merged changes from Napsaterm 3.5 by R. Knop
 *
 * Revision 3.1  1994/01/07  22:51:54  ppessi
 * Version 3 beta
 *
 * Revision 2.1  93/11/17  15:40:44  ppessi
 * Restructured drawing routines (amigadisplay.c) 
 * and windowing routines (wimp.c)
 * 
 * Revision 2.0  93/11/15  03:32:45  ppessi
 * Version 2 initial revision
 * 
 */

/*
 * These depend on Intuition/used font 
 */
extern struct geometry {
  short left, top;		/* in pixels */
  short width, height;		/* as characters */
  short x, y;			/* in pixels */
  short xoff, yoff;		/* in window coordinates */
  struct fontdimen {
    short w, h, b;		/* current font dimensions */
  } font; 
} wm;

#define	POSX(num)	(wm.xoff + (num) * wm.font.w)
#define	POSY(num)	(wm.yoff + (num) * wm.font.h)
#define	GETXPOS(x)	(((x) - wm.xoff) / wm.font.w)
#define	GETYPOS(y)	(((y) - wm.yoff) / wm.font.h)

/*
 * Declarations for drawing routines
 */
int initdrawing(struct RastPort *rastport);
void deinitdrawing(void);
void showbanner(struct RastPort *rp, char *text);

/* 
 * Declarations for fonts
 */
void initfonts(void);
void deinitfonts(void);
void setfont(register struct RastPort *rastport, register ULONG style);

/* The styles that we ask for */
#define	STYLE_MASK (UNDERLINE | BOLD | ITALIC)
#define	ATTRIB_MASK (UNDERLINE | BOLD | ITALIC | ALTERNATE | DOUBLE1 | DOUBLE2)

/*
 * Declarations for selections
 */
#define LBDOWN 	1		/* actions for doselection() */
#define LBUP   	2
#define LMOVE	4
char *grabSelection(void);
void extendSelection(int sx, int sy, int ex, int ey);
int isSelection(void);
void clearSelection(void);
void invertSelection(void);
void killSelection(void);
void doselection(int action, int x, int y);

/*
 * Declarations for keyboard handling
 */
void dokeys(struct IntuiMessage *msg);
void initkeys(void);
void deinitkeys(void);

void *setmap(const char *, void *);
int parsekeymap(char *s, void *);

/*
 * Declarations for menus
 */
void domenu(register struct IntuiMessage *msg);
void initmenus(void);
void deinitmenus(void);

/* 
 * Nations
 */
#define CHARSETSIZE 256

/* national_kmap provides mapping from 
 * the ascii codes to the national character codes
 */
extern unsigned char national_show[CHARSETSIZE];

/* national_kmap provides mapping from 
 * the keyboard Latin1 codes to the national character codes
 */
extern unsigned char national_send[CHARSETSIZE];

void setnation(unsigned int n);
void setnation_byname(const char *name);
const char *getnationname(unsigned int n);
unsigned int getnationnumber(void);

void initnations(void);
void deinitnations(void);


/* added RKNOP 940328 */
/* keypad constants */
#define KEYP_NUMERIC 0
#define KEYP_APPL 1
/* end added RKNOP */
