home *** CD-ROM | disk | FTP | other *** search
- /*** WINDOW.H ***/
-
- /* Written By P.A. McKenzie
- * The C Window Library
- * Copyright (C) 1990 All Rights Reserved
- */
- #if !defined (WINDOW_DEF)
- #define WINDOW_DEF
-
- #ifndef UNKNOWNARGS
- #ifndef __cplusplus
- #define UNKNOWNARGS
- #else
- #define UNKNOWNARGS ...
- #endif
- #endif
-
- /* Window definitions */
-
- #if !defined (MISC_DEF)
- # define MISC_DEF
- # include "misc.h"
- #endif
-
- #if defined (GLOBAL_DEF)
- #define EXTERN
- #else
- #define EXTERN extern
- #endif
-
- #define CWL_NULL ((char *)0)
-
- #include "uscore.h" /* resolves Lattice underscore diffferences */
- #include "key.h" /* Key definitions */
- #include "wstruct.h" /* Window structures */
- #include "werror.h" /* Window error codes */
- #include "proto.h" /* Prototype macro */
- #include "cursor.h" /* cursor routines */
- #include "source.h"
-
-
-
-
- /* define window manifest constants */
-
- #define WIN_NULL_PTR ((WPOINTER)0) /* Null Window Pointer */
- #define VWIN_NULL_PTR ((VWPOINTER)0) /* Null virtual window pointer */
- #define VBLOCK_NULL_PTR ((VBLOCKPTR)0) /* Null video block pointer */
-
- /* Other defines */
-
- #define SAVE 0
- #define RESTORE 1
-
- #define BORDER 1
- #define NOBORDER 0
-
- #define NOATTRIBUTE 0
- #define ATTRIBUTE 1
-
- #define TRUE 1
- #define FALSE 0
-
- #define MAXWIDTH 140 /* Maximum width of the screen in columns */
- #define MAXCOLS 140 /* Maximum columns in a normal window */
-
- #define MAXHEIGHT 80 /* Maximum height of a normal window */
- #define MAXBUFSIZE 1024 /* Maximum internal write buffer size */
-
- #define DMA 1 /* Direct Screen write */
- #define BIOS 0 /* BIOS screen write */
-
- #define WRAP 1 /* Wrap flag in window */
- #define CLIP 0 /* Clip output in window */
-
- #define ANCHORLEFT 1
- #define ANCHORRIGHT 2
- #define ANCHORTOP 1
- #define ANCHORBOTTOM 2
-
- #define UP 1
- #define DOWN 2
- #define LEFT 3
- #define RIGHT 4
-
- #define MAXTAB 50 /* Maximum tab size in windows */
- #define DEFTAB 4 /* Default tab size */
-
-
- #define MAXPAGES 16 /* Maximum number of video pages */
- #define MAXWINDOWS 255 /* Maximum windows including base screen */
-
- #define SHADOWUPLEFT 1 /* Shadow position */
- #define SHADOWUPRIGHT 2 /* " */
- #define SHADOWLOWLEFT 3 /* " */
- #define SHADOWLOWRIGHT 4 /* " */
-
- #define WINDOWCHECK 1 /* Check constant */
- #define WINOPENCHECK 2 /* Check constant */
- #define VWINDOWCHECK 4 /* Check constant */
-
- /* Explosion effects */
- #define NOEFFECT 0
- #define EXPLODE 1
- #define CONTRACT 2
- #define BRICKS 3
- #define MIDDLEROWOUT 4
- #define TOPBOTTOMIN 5
- #define TOPDOWN 6
- #define BOTTOMUP 7
- #define MIDDLECOLOUT 8
- #define LEFTRIGHTIN 9
- #define LEFTTORIGHT 10
- #define RIGHTTOLEFT 11
-
- #define MAX_SPECIAL_EFFECT 11
-
-
- /* define is... macros */
- #define ISBORDER(w) (int) (((w)->stat_info.border_flag)?1:0)
- #define ISWRAP(w) (int) (((w)->stat_info.wrap_flag)?1:0)
- #define ISOPEN(w) (int) (((w)->stat_info.open_flag)?1:0)
- #define ISVISIBLE(w) (int) (((w)->stat_info.visible_flag)?1:0)
- #define ISVIEWPORT(w) (int) (((w)->stat_info.v_window_flag)?1:0)
- #define ISWINDOW(vw) (int) (((vw)->stat_info.viewport_flag)?1:0)
- #define ISBUFSAVE(w) (int) (((w)->stat_info.bufptr_flag)?1:0)
- #define ISSEETHRU(w) (int) (((w)->stat_info.seethru_flag)?1:0)
- #define ISINITIAL(w) (int) (((w)->stat_info.init_flag)?1:0)
- #define ISFROZEN(w) (int) (((w)->stat_info.frozen_flag)?1:0)
- #define ISSHADOW(w) (int) \
- (((w)->shadow_info.shadow_stat.shadow_flag)?1:0)
- #define ISSHADOWTRANS(w) (int) \
- (((w)->shadow_info.shadow_stat.shadow_trans)?1:0)
-
- /* Shadow macros */
- #define SHADOW_POS(w) (int)(((w)->shadow_info.shadow_stat.shadow_pos))
- #define SHADOW_CHAR(w) (int)(((w)->shadow_info.schar))
- #define SHADOW_ATTR(w) (int)(((w)->shadow_info.sattr))
- #define SHADOW_WIDTH(w) (int)(((w)->shadow_info.swidth))
- #define SHADOW_HEIGHT(w) (int)(((w)->shadow_info.sheight))
-
-
- #define VWTYPE(vw) (int) ((vw)->stat_info.vwtype)
- #define VWWRAP(vw) (vw)->stat_info.wrap_flag
-
- #define EDGES(w) ((int)((ISBORDER((w))?2:0)))
- #define EDGEDIF(w) ((int)((ISBORDER((w))?1:-1)))
- #define WLASTROW(w) ((int)((w)->row+(w)->height+EDGEDIF(w)))
- #define WLASTCOL(w) ((int)((w)->col+(w)->width+EDGEDIF(w)))
-
-
- /* Existence macros */
- #define WINDOW_EXIST(w) \
- ((window_ptrs[(w)->wnum] != (w) || (w) == WIN_NULL_PTR)?0:1)
-
- #define VIRTUAL_WINDOW_EXIST(vw) \
- (((virtual_window_ptrs[(vw)->wnum] != (vw)) || \
- (vw) == VWIN_NULL_PTR)?0:1)
-
- /* General window macros */
-
- #define VIEWPORT_ROW(w) ((w)->vwrow)
- #define VIEWPORT_COLUMN(w) ((w)->vwcol)
- #define VIRTUAL_WINDOW(w) ((w)->vwptr)
- #define WINDOW_RANK(w) ((w)->rank)
- #define WINDOW_TEXT_COLOR(w) ((w)->wattr)
- #define WINDOW_BORDER_COLOR(w) ((w)->battr)
- #define WINDOW_PAGENUM(w) ((w)->pagenum)
- #define WINDOW_WIDTH(w) ((w)->width)
- #define WINDOW_HEIGHT(w) ((w)->height)
- #define WINDOW_ROW(w) ((w)->row)
- #define WINDOW_COLUMN(w) ((w)->col)
- #define VWINDOW_COORD_IN_VIEWPORT(w,row,col) \
- ((((col) >= (w)->vwcol) && \
- ((col) <= (w)->vwcol+(w)->width-1) && \
- ((row) >= (w)->vwrow) && \
- ((row) <= (w)->vwrow+(w)->height-1))?1:0)
-
-
- /*****************************
- * Define external variables *
- ****************************/
-
- /*** Colors ***/
-
- EXTERN int black;
- EXTERN int blue;
- EXTERN int green;
- EXTERN int cyan;
- EXTERN int red;
- EXTERN int magenta;
- EXTERN int brown;
- EXTERN int white;
- EXTERN int gray;
- EXTERN int lightblue;
- EXTERN int lightgreen;
- EXTERN int lightcyan;
- EXTERN int lightred;
- EXTERN int lightmagenta;
- EXTERN int yellow;
- EXTERN int lightwhite;
-
- EXTERN unsigned window_edit_key[12];
- /* stores info on keys that are used for the
- window input functions */
- EXTERN WPOINTER *window_trans; /* array of transparent windows */
- EXTERN int window_error_code; /* window error number */
- EXTERN int check_existence_flag;
- EXTERN int override_seethru; /* Overrides seethru window in
- * screen_image */
- EXTERN char input_mask_char; /* Mask character to use for input mask */
- EXTERN int max_window_rank; /* maximum rank number */
- EXTERN int min_window_rank; /* lowest rank number */
- EXTERN int mouse_found; /* returns 1 if mouse found */
-
- EXTERN unsigned explosion_speed[MAX_SPECIAL_EFFECT+1];
- /* Speed of explosions for windows in
- * milliseconds */
-
- EXTERN int num_transparent_shadows[MAXPAGES]; /* Number of shadows */
- EXTERN int total_transparent_shadows; /* Number of transparent
- shadows */
-
- EXTERN unsigned char *screen_image[MAXPAGES]; /* pointer to screen members */
- EXTERN WPOINTER window_rank[MAXWINDOWS+2];
- /* array of windows in rank order */
- EXTERN WPOINTER window_ptrs[MAXWINDOWS+1]; /* array of windows in declaration
- order */
- EXTERN WPOINTER orig_screen[MAXPAGES];
- EXTERN char far *screen_page_offset[MAXPAGES];
- EXTERN VWPOINTER virtual_window_ptrs[MAXWINDOWS+1];
- EXTERN void (*window_error_func) P((int errorcode, char *sourcefile,
- int sourceline, char *funcname));
-
-
- #if __cplusplus
- extern "C" {
- #endif
-
- /* Miscellaneous Routines */
- void AdjustGlobalData P((void));
- int AdjustScreenInfo P((int page));
- char * CharToString P((int));
- char * CreateRepeatedString P((char *str, int num));
- void MakeSound P((unsigned freq, unsigned millisec));
- char * TranslateMaskStringToString P((char *str, char *mask, char *str2,
- int mchar));
- char * TranslateStringToMaskString P((char *str, char *mask, char *str2,
- int mchar, int flag));
- int TranslateMaskPosToStringPos P((char *, int, int));
- int TranslateStringPosToMaskPos P((char *, int, int));
-
- int VirtualClear P((VWPOINTER vw));
- int VirtualClearAttr P((VWPOINTER vw, int attr));
- int VirtualClearRegion P((VWPOINTER vw, unsigned urow, unsigned ucol,
- unsigned lrow, unsigned lcol));
- int VirtualClearRegionAttr P((VWPOINTER vw, unsigned urow,
- unsigned ucol, unsigned lrow,
- unsigned lcol, int attr));
- int VirtualFree P((VWPOINTER vw, int hideflag, int effect));
- int VirtualGetCursorPosition P((VWPOINTER vw, unsigned *row,
- unsigned *col));
- VWPOINTER VirtualInitialize P((int vwtype, unsigned nrows, unsigned ncols,
- int attr));
- int VirtualMoveCursor P((VWPOINTER vw, unsigned row, unsigned col));
- int VirtualPrintf P((VWPOINTER vw, char *format, ...));
- int VirtualPrintfAttr P((VWPOINTER vw, int attr, char *format, ...));
- int VirtualReadAttributes P((VWPOINTER vw, char *buffer, unsigned row,
- unsigned col, unsigned length));
- int VirtualReadCharacters P((VWPOINTER vw, char *buffer, unsigned row,
- unsigned col, unsigned length));
- int VirtualReadCharAndAttr P((VWPOINTER vw, char *buffer, unsigned row,
- unsigned col, unsigned length));
- int VirtualSetWrap P((VWPOINTER vw, int wrapflag));
- int VirtualWriteAttributes P((VWPOINTER vw, char *buffer, unsigned row,
- unsigned col, unsigned length));
- int VirtualWriteCenterString P((VWPOINTER vw, char *string,
- unsigned row));
- int VirtualWriteCenterStringAttr P((VWPOINTER vw, char *string,
- unsigned row, int attr));
- int VirtualWriteCharacters P((VWPOINTER vw, char *buffer, unsigned row,
- unsigned col, unsigned length));
- int VirtualWriteCharAndAttr P((VWPOINTER vw, char *buffer, unsigned row,
- unsigned col, unsigned length));
- int VirtualWriteRepeatAttribute P((VWPOINTER vw, int attr, unsigned row,
- unsigned col, unsigned length));
- int VirtualWriteRepeatCharacter P((VWPOINTER vw, int ch, unsigned row,
- unsigned col, unsigned length));
- int VirtualWriteString P((VWPOINTER vw, char *string, unsigned row,
- unsigned col));
- int VirtualWriteStringAttr P((VWPOINTER vw, char *string, unsigned row,
- unsigned col, int attr));
- int VirtualWriteStringCC P((VWPOINTER vw, char *string, unsigned row,
- unsigned col));
- int VirtualWriteStringCCAttr P((VWPOINTER vw, char *string,
- unsigned row, unsigned col, int attr));
- int VirtualWriteStringRJ P((VWPOINTER vw, char *string, unsigned row,
- unsigned col));
- int VirtualWriteStringRJAttr P((VWPOINTER vw, char *string,
- unsigned row, unsigned col, int attr));
- int VirtualWriteTextToFile P((VWPOINTER vw, char *filename, int mode));
-
- /* Window Functions */
- int WindowAssignToVirtual P((WPOINTER w, VWPOINTER vw, unsigned row,
- unsigned col));
- int WindowClose P((WPOINTER w, int effect));
- int WindowChangeCursor P((WPOINTER w, int shape));
- int WindowChangeBorderAttribute P((WPOINTER w, int attr));
- int WindowChangeTextAttribute P((WPOINTER w, int attr));
- int WindowClear P((WPOINTER w));
- int WindowClearAttr P((WPOINTER w, int attr));
- int WindowClearRegion P((WPOINTER w, int urow, int ucol, int lrow,
- int lcol));
- int WindowClearRegionAttr P((WPOINTER w, int urow, int ucol, int lrow,
- int lcol, int attr));
- int WindowCloseViewport P((WPOINTER w, int hide, int effect));
- int WindowDisplay P((WPOINTER w, int rank, int effect));
- int WindowDrawBox P((WPOINTER w, int urow, int ucol, int lrow,
- int lcol, char *box));
- int WindowDrawBoxAttr P((WPOINTER w, int urow, int ucol, int lrow,
- int lcol, char *box, int attr));
- int WindowDrawBorder P((WPOINTER w, char *box));
- int WindowDrawShadow P((WPOINTER w, int spos, int swidth,
- int sheight, int schar, int sattr, int tflag));
- int WindowFree P((WPOINTER w, int effect));
- int WindowFreeze P((WPOINTER w, int flag));
- int WindowGetCursorPosition P((WPOINTER w, int *row, int *col));
-
- int WindowGetMaskPassword P((WPOINTER w, int row, int col,
- char *buffer, char *mask, int fillchar,
- int passchar, int minchars, int maxwidth,
- int options, char *regexp));
-
- int WindowGetMaskPasswordAttr P((WPOINTER w, int row, int col,
- char *buffer, char *mask,
- int fillchar, int passchar,
- int minchars, int maxwidth,
- int options, int attr, char *regexp));
-
- int WindowGetMaskString P((WPOINTER w, int row, int col, char *buffer,
- char *mask, int fillchar, int minchars,
- int maxwidth, int options, char *regexp));
-
- int WindowGetMaskStringAttr P((WPOINTER w, int row, int col,
- char *buffer, char *mask, int fillchar,
- int minchars, int maxwidth,
- int options, int attr, char *regexp));
-
- int WindowGetPassword P((WPOINTER w, int row, int col, char *buffer,
- int fillchar, int passchar, int minchars,
- int maxwidth, int options, char *regexp));
-
- int WindowGetPasswordAttr P((WPOINTER w, int row, int col,
- char *buffer, int fillchar, int passchar,
- int minchars, int maxwidth, int options,
- int attr, char *regexp));
-
- int WindowGetString P((WPOINTER w, int row, int col, char *buffer,
- int fillchar, int minchars, int maxwidth,
- int options, char *regexp));
-
- int WindowGetStringAttr P((WPOINTER w, int row, int col, char *buffer,
- int fillchar, int minchars, int maxwidth,
- int options, int attr,char *regexp));
-
- int WindowHide P((WPOINTER w, int effect));
- WPOINTER WindowInitialize P((int bordflag, int rows, int cols, int width,
- int height, int wattr, int battr, char *box));
- void WindowInitializeSystem P((void));
- int WindowMakeNormal P((WPOINTER w));
- int WindowMakeSeeThru P((WPOINTER w));
- int WindowMove P((WPOINTER w, int row, int col));
- int WindowMoveCursor P((WPOINTER w, int row, int col));
- int WindowOpen P((WPOINTER w));
- int WindowPositionViewport P((WPOINTER w, unsigned row, unsigned col));
- int WindowPrintf P((WPOINTER w, char *format, ...));
- int WindowPrintfAttr P((WPOINTER w, int attr, char *format, ...));
- int WindowReadCharacters P((WPOINTER w, char *buffer, int row,
- int col, int length));
- int WindowReadAttributes P((WPOINTER w, char *buffer, int row,
- int col, int length));
- int WindowReadCharAndAttr P((WPOINTER w, char *buffer, int row,
- int col, int length));
- int WindowRemoveBorder P((WPOINTER w));
- int WindowRemoveShadow P((WPOINTER w));
- int WindowResizeHeight P((WPOINTER w, int height, int flag));
- int WindowResizeWidth P((WPOINTER w, int width, int flag));
- int WindowSaveInitial P((int page));
- int WindowScroll P((WPOINTER w, int lines, int direct));
- int WindowScrollAttr P((WPOINTER w, int lines, int direct, int attr));
- int WindowScrollRegion P((WPOINTER w, int lines, int urow, int ucol,
- int lrow, int lcol, int direct));
- int WindowScrollRegionAttr P((WPOINTER w, int lines, int urow,
- int ucol, int lrow, int lcol, int direct,
- int attr));
- int WindowScrollViewport P((WPOINTER w, unsigned units, int direct));
- int WindowSetWrap P((WPOINTER w, int flag));
- int WindowSlide P((WPOINTER w, int direct, int num));
- int WindowSyncCursor P((WPOINTER w, int flag));
- int WindowWriteAttributes P((WPOINTER w, char *buffer, int row,
- int col, int length));
- int WindowWriteCharacters P((WPOINTER w, char *buffer, int row,
- int col, int length));
- int WindowWriteCharAndAttr P((WPOINTER w,char *buffer, int row,
- int col, int length));
- int WindowWriteCharactersAttr P((WPOINTER w, char *buffer, int row,
- int col, int attr, int length));
- int WindowWriteCenterString P((WPOINTER w, char *string, int row));
- int WindowWriteCenterStringAttr P((WPOINTER w, char *string, int row,
- int attr));
- int WindowWriteRepeatAttribute P((WPOINTER w, int attr, int row,
- int col, int length));
- int WindowWriteRepeatCharacter P((WPOINTER w, int attr, int row,
- int col, int length));
- int WindowWriteString P((WPOINTER w, char *string, int row, int col));
- int WindowWriteStringAttr P((WPOINTER w, char *string, int row,
- int col, int attr));
- int WindowWriteStringRJ P((WPOINTER w, char *string, int row, int col));
- int WindowWriteStringRJAttr P((WPOINTER w, char *string, int row,
- int col, int attr));
- int WindowWriteStringCC P((WPOINTER w, char *string, int row, int col));
- int WindowWriteStringCCAttr P((WPOINTER w, char *string,int row,
- int col, int attr));
- int WindowWriteTextToFile P((WPOINTER w, char *string, int mode));
-
- #if !defined (SOUND_DEF)
- #define SOUND_DEF
-
- #if defined (POWERC)
- void cwlsound P((UNKNOWNARGS));
- #define sound(x) cwlsound(x)
- #endif
-
- #endif
-
-
- #if !defined (__TURBOC__)
- void delay P((unsigned));
- #if !defined (POWERC)
- void sound P((unsigned));
- #endif
- void nosound P((void));
- #endif
-
-
- #if defined (SOURCE)
- #include "internal.h"
- #endif
-
- #undef P
- #if __cplusplus
- }
- #endif
-
- #endif