home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
INCLUDE
/
DISPDECL.H
< prev
next >
Wrap
Text File
|
1990-11-06
|
11KB
|
298 lines
/*
dispdecl.h
% Declarations for display manager
5/16/88 by Ted.
OWL 1.2a
Copyright (c) 1988, by Oakland Group, Inc.
ALL RIGHTS RESERVED.
Revision History:
-----------------
8/24/88 ted merged driver and mode in to one stub function pointer.
11/22/88 ted Added CheckMouse and ReadEvent functions
12/07/88 ted Put init function into dControl structure.
12/12/88 ted Merged CheckKey and CheckMouse into CheckEvent.
1/18/89 Ted changed call to PlotText for simplified interface.
2/04/89 ted Added pmap control dig element and codes.
2/07/89 Ted added timeout wait arg to hCheckEvent function.
5/09/89 ted Changed Alloc/Free terms to Open/Close.
6/17/89 ted Added evcheck flag to dig.
6/28/89 ted Removed display id info element.
6/28/89 ted Added DC_GETCOLMAP, DC_CLAIMCOLOR, DC_RELEASECOLOR. Removed
colmap from info structure to hide it in DIG.
6/28/89 ted Changed mmwidth/height to x/ypixperm in info structure.
6/28/89 ted Made dControl and pControl return int instead of void.
6/29/89 ted Modified fontreq struct and added mouseshape struct.
7/12/89 ted Converted '_func' prototypes from typedef to macro.
8/08/89 ted Added bmap-to-pmap messages.
8/08/89 ted Moved fontreq_struct out to ofontdesc_struct in oboxdecl.h.
8/30/89 ted Added HC_CLEAREVENTS message.
11/27/89 ted Rearranged dmgr, disp, & dig structs for dispcurr data block chaining.
2/02/90 ted Changed DC_CLAIM/RELEASECOLOR to DC_PV/ALLOC/FINDRGB/MAKERO/FREE msgs, added findcol_struct.
2/14/90 ted Got rid of fontreq_struct. Just use fontdesc_struct.
2/25/90 ted Got rid of enum fixes for lattice 4.0.
3/13/90 ted Added LASTMSG/TYPE vals to enums.
3/21/90 ted Added DC_HIDEMOUSE and DC_SHOWMOUSE messages
3/28/90 jmd ansi-fied
5/08/90 jmd added underscores to func macros for vms compiler
5/11/90 jmd made CheckEvent and ReadEvent return ints
6/01/90 jmd changed _ctype to _ctipe to avoid DG conflict
6/14/90 jdc moved dmode_func definition after _dig_struct definition
8/13/90 bkd added ATTR_BOLD_UNDERLINE, ATTR_BLINK_MASK and
ATTR_DIM_REVERSE
10/31/90 ted made dispinfo ncolors unsigned long instead of long.
11/06/90 ted moved pmapioreq stuff here from pmapdecl.h
*/
/* -------------------------------------------------------------------------- */
typedef enum _disptype {
DTYPE_MONOCHROME,
DTYPE_GREYSCALE,
DTYPE_MAPCOLOR,
DTYPE_TRUECOLOR,
DTYPE_LASTTYPE
} disptype;
/* Curstype declarations */
typedef enum _cursortype {
CURSOR_NONE,
CURSOR_BLOCK,
CURSOR_HALF,
CURSOR_THIN,
CURSOR_DASH,
CURSOR_NORMAL,
CURSOR_LASTTYPE
} cursortype;
/*** Text attributes. ***/
#define ATTR_INVISIBLE ((byte) 0x00)
#define ATTR_NORMAL ((byte) 0x07)
#define ATTR_REVERSE ((byte) 0x70)
#define ATTR_UNDERLINE ((byte) 0x01)
#define ATTR_BLINKING ((byte) 0x87)
#define ATTR_BOLD ((byte) 0x0F)
#define ATTR_BOLD_UNDERLINE ((byte) 0x09)
#define ATTR_BLINK_MASK ((byte) 0x80)
#define ATTR_DIM_REVERSE ((byte) 0x78) /* dim fg on normal bg */
#define BO_LSBYTFIRST ((byte) 0)
#define BO_MSBYTFIRST ((byte) 1)
/* -------------------------------------------------------------------------- */
/* The display device info structure */
#define DEVNAMELEN 22
typedef struct _dispinfo {
char devname[DEVNAMELEN]; /* Text for device's name */
int mode; /* Device Display Mode */
unsigned xpixperm; /* Pixels per meter on display device in x direction */
unsigned ypixperm; /* Pixels per meter on display device in y direction */
pmap_type dispmap; /* Pixmap describing display memory */
unsigned dispaddr; /* address of display buffer(if any) */
odim bytewidth; /* number of bytes in a line of display. */
unsigned ileave; /* display memory interleave factor */
odim ilsize; /* interleave block size */
byte nplanes; /* number of bitplanes in image. */
byte pixbits; /* number of bits per pixel in a plane. */
unsigned long ncolors; /* Number of possible pixel values */
disptype colortype; /* type of display (e.g. Monochrome, Truecolor, etc.) */
ocolmap_type defcolmap; /* Pointer to copy of device default color map */
byte hardcursor; /* Flag for hardware cursor used by this driver */
byte byteorder; /* Code for the processor's byte order in a word */
struct ofont_struct def_font; /* default system font */
} dispinfo_struct;
/* dig_dControl Messages */
typedef enum _dig_dcmsg {
DC_GETINFO,
DC_INITMODE,
DC_RESTOREMODE,
DC_SETATTRCOLS,
DC_GETATTRFG,
DC_GETATTRBG,
DC_SETCOLMAP,
DC_GETCOLMAP,
DC_PVALLOC, /* Alloc an unspecified pixval for read/write */
DC_PVFINDRGB, /* Find a matching pixval, alloc for read only */
DC_PVMAKERO, /* Convert a given pixval from read/write to read-only */
DC_PVFREE, /* Free an allocated pixval */
DC_OPENFONT,
DC_CLOSEFONT,
DC_READCHARATTR, /* only for cmwin isave */
DC_CACHE, /* Hides mouse cursor also */
DC_FLUSH,
DC_HIDEMOUSE,
DC_SHOWMOUSE,
DC_LASTMSG
} dig_dcmsg;
/* dig_pControl Messages */
typedef enum _dig_pcmsg {
PC_OPENPMAP,
PC_CLOSEPMAP,
PC_CLEARPMAP,
PC_COPYPMAP,
PC_PMAPTOBMAP,
PC_BMAPTOPMAP,
PC_SAVEPMAP,
PC_LOADPMAP,
PC_LASTMSG
} dig_pcmsg;
/* dig_hControl Messages */
typedef enum _dig_hcmsg {
HC_OPEN,
HC_CLOSE,
HC_INITMOUSE, /* Inits mouse box to dimensions of display */
HC_DEINITMOUSE,
HC_ISMOUSEON,
HC_SETMOUSEBOX,
HC_SETMOUSESHAPE,
HC_GETMOUSESHAPE,
HC_SETSOUNDON,
HC_SETSOUNDOFF,
HC_GETSOUNDON,
HC_CLEAREVENTS,
HC_PROTECT,
HC_UNPROTECT,
HC_LASTMSG
} dig_hcmsg;
/* Window paint data structure */
typedef struct _ptd {
obj_type win;
opbox *relboxp; /* box for tile relative to window */
VOID *emsgdata; /* message indata (needed for scrolling) */
} ptd_struct;
/* -------------------------------------------------------------------------- */
/* Hardware Dependent Code function types */
#define dig_CloseDIG_func(fname) void fname(struct _dig_struct *_digp)
#define dig_dControl_func(fname) int fname(dig_dcmsg _msg, VOID *_indata, VOID *_outdata)
#define dig_pPlotText_func(fname) void fname(ptd_struct *_ptd, opcoord _x, opcoord _y, char *_charbuf, char _rchar, byte _rattr, int _slen)
#define dig_pDrawCursor_func(fname) void fname(ptd_struct *_ptd, cursortype _ctipe)
#define dig_pClear_func(fname) void fname(ptd_struct *_ptd, opixval _color)
#define dig_pScrollBoxVt_func(fname) void fname(ptd_struct *_ptd, opcoord _n)
#define dig_pScrollBoxHz_func(fname) void fname(ptd_struct *_ptd, opcoord _n)
#define dig_pDrawPixmap_func(fname) void fname(ptd_struct *_ptd, pmap_type _pmap, opbox *_pmboxp)
#define dig_pReadPixmap_func(fname) void fname(ptd_struct *_ptd, pmap_type _pmap, opbox *_pmboxp)
#define dig_pControl_func(fname) int fname(dig_pcmsg _msg, VOID *_indata, VOID *_outdata)
#define dig_hCheckEvent_func(fname) int fname(unsigned _wait)
#define dig_hReadEvent_func(fname) int fname(moupos_struct *_mouposp)
#define dig_hGetShift_func(fname) unsigned fname(void)
#define dig_hTimer_func(fname) unsigned fname(void)
#define dig_hPause_func(fname) void fname(unsigned _duration)
#define dig_hSound_func(fname) void fname(unsigned _pitch, unsigned _duration)
#define dig_hControl_func(fname) int fname(dig_hcmsg _msg, VOID *_indata, VOID *_outdata)
/* -------------------------------------------------------------------------- */
/* Device Interface Group function structure */
typedef struct _dig_struct {
dig_CloseDIG_func ((*CloseDIG)); /* Clean up device interface */
dig_dControl_func ((*dControl)); /* miscellaneous display control */
dig_pDrawCursor_func ((*pDrawCursor)); /* set text cursor position */
dig_pPlotText_func ((*pPlotText)); /* draw text */
dig_pClear_func ((*pClear)); /* clear screen */
dig_pScrollBoxVt_func ((*pScrollBoxVt)); /* scroll vertical */
dig_pScrollBoxHz_func ((*pScrollBoxHz)); /* scroll horizontal */
dig_pDrawPixmap_func ((*pDrawPixmap)); /* draw a region */
dig_pReadPixmap_func ((*pReadPixmap)); /* read a region */
dig_pControl_func ((*pControl)); /* pixel map control */
dig_hCheckEvent_func ((*hCheckEvent)); /* check for keystroke ready */
dig_hReadEvent_func ((*hReadEvent)); /* read key/mouse event */
dig_hGetShift_func ((*hGetShift)); /* get keyboard shift state */
dig_hTimer_func ((*hTimer)); /* system timer */
dig_hPause_func ((*hPause)); /* system timer delay */
dig_hSound_func ((*hSound)); /* sound generator */
dig_hControl_func ((*hControl)); /* miscellaneous hardware control */
unsigned vtscroll:1; /* specifies whether vertical scrolling is supported */
unsigned hzscroll:1; /* specifies whether horizontal scrolling is supported */
unsigned textfree:1; /* specifies whether text position is restricted */
unsigned evcheck:1; /* specifies whether hard_CheckEvent works or not */
int type; /* dig type : specifies supported features */
int version; /* implementation version for the given type */
VOID *data; /* generic data pointer for dig data */
SIZE_T datasize; /* size of dig data block */
} dig_struct;
/* DIG device/mode open function prototype */
#define dmode_func(fname) boolean fname(struct _dig_struct *_digp)
typedef dmode_func ((*dmode_fptr));
typedef struct disp_struct {
dispinfo_struct *info;
unsigned mouse_timeout;
opcoord mouse_distout;
dig_struct dig; /* struct of device interface group fptrs */
} *disp_type;
typedef struct _dmgr {
int id; /* id for which dmgr is the current one */
struct wmgr_struct wmgr;
struct disp_struct disp; /* disp dig data & datasize are last elements */
} dmgr_struct;
/* -------------------------------------------------------------------------- */
/* Message in and outdata structures */
typedef struct _ptarg {
ptd_struct *ptd;
opcoord x;
opcoord y;
char *charbuf;
byte *attrbuf;
int slen;
} ptarg_struct; /* Used for ReadCharAttr dControl method */
typedef struct _setattr {
byte attr;
opixval bg;
opixval fg;
} setattr_struct;
typedef struct _findcol {
orgb_struct *rgb; /* rgb val to try to match */
int maxcdist; /* max distance in rgb space which constitutes a match */
} findcol_struct;
typedef struct _mouseshape {
bmap_type image;
bmap_type mask;
opcoord xhot;
opcoord yhot;
unsigned short tsmask; /* Text mode char/attribute pairs */
unsigned short tcmask;
} mouseshape_struct;
/*#define pmapioreq_func(fname) dig_pControl_func(fname)*/
#define pmapioreq_func(fname) int fname(dig_pcmsg _msg, VOID *_indata, VOID *_outdata)
typedef pmapioreq_func ((*pmapioreq_fptr));
/* -------------------------------------------------------------------------- */