home *** CD-ROM | disk | FTP | other *** search
- /*
- dispprot.h
-
- % Header for display manager
-
- 5/16/88 by Ted.
-
- OWL 1.1
- 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.
- 12/16/88 jmd made ddisp_GetWidth/Height into functions
- 1/18/89 Ted Changed call to PlotText for simplified interface.
- 3/20/89 Ted Made everything refer to static curr_dmgr.
- 5/09/89 ted Changed Alloc/Free terms to Open/Close.
- 5/11/89 ted Added macros for setting and getting the CloseDIG fptr.
- 7/29/89 ted Resurrected disp_GetInfo() macro.
- 8/07/89 ted Made GetShift() related macros return 1 or 0, nothing else.
- 8/14/89 jmd Added disp_EvCheck() macros
- 8/31/89 jmd Added disp_EvCheck() macros (again)
- 9/11/89 jmd Added disp_IsMouseTrapped() macro
- */
- /* -------------------------------------------------------------------------- */
- /* Global display manager structure declarations */
-
- OEXTERN dmgr_struct curr_dmgrstruc;
- #define curr_dmgr (&curr_dmgrstruc)
- #define curr_wmgr (&curr_dmgrstruc.wmgr)
- #define disp_id() (curr_dmgr->id)
- /* -------------------------------------------------------------------------- */
- /* Prototypes */
-
- /* dispinit.c */
- extern boolean disp_Init(_arg2(dmode_fptr dmode, class_fptr backwin));
- extern void disp_Close(_arg1(void));
-
- /* dispreinit.c */
- extern boolean disp_ReInit(_arg1(dmode_fptr dmode));
-
- /* dispcurr.c */
- extern VOID *disp_GetCurrent(_arg1(void));
- extern boolean disp_SetCurrent(_arg1(VOID *dmgrp));
-
- /* disp.c */
- extern boolean disp_Ok(_arg1(void));
- extern int disp_GetHeight(_arg1(void));
- extern int disp_GetWidth(_arg1(void));
- extern ofont_type disp_OpenFont(_arg1(fontreq_struct *fontreq));
- extern void disp_CloseFont(_arg1(ofont_type font));
-
- /* Character attribute mapping */
- extern void disp_SetAttrColors(_arg3(byte attr, opixval bg, opixval fg));
- extern opixval disp_GetAttrFgColor(_arg1(byte attr));
- extern opixval disp_GetAttrBgColor(_arg1(byte attr));
-
- #define disp_SetMapEntry(attr, bg, fg) \
- disp_SetAttrColors(attr, bg, fg)
- #define disp_GetMapEntry(attr, bgp, fgp) \
- disp_GetAttrColors(attr, bgp, fgp)
-
- /* Hardware pixval-to-RGB color palette mapping */
- extern void disp_SetColMapEntry(_arg4(opixval icol,
- olevel red, olevel green, olevel blue));
- /* border-to-window coordinate mapping */
- extern boolean ptd_SetInner(_arg3(ptd_struct *ptd, ptd_struct *inptd, opbox *inboxp));
-
- /* dispmono.c */
- extern void disp_MapMono(_arg1(boolean));
-
- /* dispclr.c */
- extern void disp_Clear(_arg1(opixval color));
- extern void disp_Repaint(_arg1(void));
- /* -------------------------------------------------------------------------- */
- /* Device info request macros */
-
- #define disp_GetInfo() (curr_dmgr->disp.info)
- #define disp_GetMode() (disp_GetInfo()->mode)
- #define disp_GetPixWidth() pmap_GetWidth(disp_GetInfo()->dispmap)
- #define disp_GetPixHeight() pmap_GetHeight(disp_GetInfo()->dispmap)
- #define disp_GetColMapNentries() (disp_GetInfo()->defcolmap.nentries)
- #define disp_GetDefColMapp() (disp_GetInfo()->defcolmap)
- #define disp_GetColors() (disp_GetInfo()->ncolors)
- #define disp_hardcursor() (disp_GetInfo()->hardcursor)
- #define disp_GetByteOrder() (disp_GetInfo()->byteorder)
- #define disp_dispmap() (disp_GetInfo()->dispmap)
- #define disp_GetDefFont() (&disp_GetInfo()->def_font)
-
- #define disp_vtscroll() ((boolean) curr_dmgr->disp.dig.vtscroll)
- #define disp_hzscroll() ((boolean) curr_dmgr->disp.dig.hzscroll)
- #define disp_TextFree() ((boolean) curr_dmgr->disp.dig.textfree)
- #define disp_type() (curr_dmgr->disp.dig.type)
- #define disp_version() (curr_dmgr->disp.dig.version)
-
- #define disp_EvCheck() ((boolean) curr_dmgr->disp.dig.evcheck)
- #define disp_SetEvCheck(c) (curr_dmgr->disp.dig.evcheck = (c))
-
- #define disp_MouseDistout() (curr_dmgr->disp.mouse_distout)
- #define disp_MouseTimeout() (curr_dmgr->disp.mouse_timeout)
-
- #define disp_clipbox(boxp) pmap_clipbox(disp_dispmap(), boxp)
- #define disp_clippoint(xp, yp) pmap_clippoint(disp_dispmap(), xp, yp)
- /* -------------------------------------------------------------------------- */
- /* DIG control function ptr macros */
-
- #define disp_Control(msg, indata, outdata) \
- (*curr_dmgr->disp.dig.dControl)(msg, (VOID *)(indata), (VOID *)(outdata))
-
- #define pmap_Control(msg, indata, outdata) \
- (*curr_dmgr->disp.dig.pControl)(msg, (VOID *)(indata), (VOID *)(outdata))
-
- #define hard_Control(msg, indata, outdata) \
- (*curr_dmgr->disp.dig.hControl)(msg, (VOID *)(indata), (VOID *)(outdata))
-
- #define disp_CloseDIG() \
- ((*curr_dmgr->disp.dig.CloseDIG)(&curr_dmgr->disp.dig), curr_dmgr->disp.dig.data = NULL)
-
- /* Macros for getting and setting the CloseDIG function ptr */
- #define disp_GetCloseDIG() (curr_dmgr->disp.dig.CloseDIG)
- #define disp_SetCloseDIG(cd) (curr_dmgr->disp.dig.CloseDIG = (cd))
- /* -------------------------------------------------------------------------- */
- /* DIG ptd function ptr macros */
-
- #define ptd_DrawCursor(ptd, ctype) (*curr_dmgr->disp.dig.pDrawCursor)(ptd, ctype)
-
- #define ptd_PlotText(ptd, x, y, cbuf, rc, ra, slen) \
- (*curr_dmgr->disp.dig.pPlotText)(ptd, x, y, cbuf, rc, ra, slen)
-
- #define ptd_Clear(ptd, color) (*curr_dmgr->disp.dig.pClear)(ptd, color)
-
- #define ptd_ScrollBoxVt(ptd, n) (*curr_dmgr->disp.dig.pScrollBoxVt)(ptd, n)
-
- #define ptd_ScrollBoxHz(ptd, n) (*curr_dmgr->disp.dig.pScrollBoxHz)(ptd, n)
-
- #define ptd_DrawPixmap(ptd, pixmap, pmboxp) \
- (*curr_dmgr->disp.dig.pDrawPixmap)(ptd, pixmap, pmboxp)
-
- #define ptd_ReadPixmap(ptd, pixmap, pmboxp) \
- (*curr_dmgr->disp.dig.pReadPixmap)(ptd, pixmap, pmboxp)
-
- #define ptd_PlotTextbuf(ptd, x, y, cbuf, ra, slen) \
- ptd_PlotText(ptd, x, y, cbuf, 0, ra, slen)
-
- #define ptd_PlotChar(ptd, x, y, rc, ra, slen) \
- ptd_PlotText(ptd, x, y, NULL, rc, ra, slen)
-
- #define ptd_EraseCursor(ptd) \
- ptd_DrawCursor(ptd, CURSOR_NONE)
- /* -------------------------------------------------------------------------- */
- /* Disp function macros */
-
- #define disp_InitMode() disp_Control(DC_INITMODE, NULL, NULL)
- #define disp_RestoreMode() disp_Control(DC_RESTOREMODE, NULL, NULL)
-
- #define disp_Cache() disp_Control(DC_CACHE, NULL, NULL)
- #define disp_Flush() disp_Control(DC_FLUSH, NULL, NULL)
- #define disp_HideMouse() disp_Cache()
- #define disp_ShowMouse() disp_Flush()
-
- #define disp_IsTrappedMouse() (curr_wmgr->trapmousewin != NULL)
-
- /* Character attribute mapping */
- #define disp_GetAttrColors(attr, bgp, fgp) \
- (*(bgp) = disp_GetAttrBgColor(attr), \
- *(fgp) = disp_GetAttrFgColor(attr))
-
- #define disp_getattrbg(attrp, bgp) disp_Control(DC_GETATTRBG, attrp, bgp)
- #define disp_getattrfg(attrp, fgp) disp_Control(DC_GETATTRFG, attrp, fgp)
-
- /* Hardware pixval-to-RGB color palette mapping */
- #define disp_SetColMap(colmap) disp_Control(DC_SETCOLMAP, (VOID *)colmap, NULL)
- #define disp_GetColMap(colmap) disp_Control(DC_GETCOLMAP, NULL, (VOID *)colmap)
- #define disp_SetColMapDefault() disp_SetColMap(disp_GetDefColMapp())
- /* -------------------------------------------------------------------------- */
- /* Hardware functions and function ptr macros */
-
- /* kbread.c */
- extern unsigned kb_Read(_arg1(void));
- extern boolean kb_CheckWait(_arg1(unsigned wait));
- extern void kb_Clear(_arg1(void)); /* clear keyboard buffer function */
-
- /* mouseini.c */
- extern boolean hard_InitMouse(_arg1(void));
- extern void hard_DeinitMouse(_arg1(void));
-
- #define hard_GetMouseTimeout() (curr_dmgr->disp.mouse_timeout)
- #define hard_SetMouseTimeout(t) (curr_dmgr->disp.mouse_timeout = (t))
-
- #define kb_Check() kb_CheckWait(0)
- #define hard_CheckEvent(wait) (*curr_dmgr->disp.dig.hCheckEvent)(wait)
- #define hard_ReadEvent(evp) (*curr_dmgr->disp.dig.hReadEvent)(evp)
- #define kb_GetShift() (*curr_dmgr->disp.dig.hGetShift)()
-
- #define kb_Shift() ((kb_GetShift() & 0x03) != 0)
- #define kb_Control() ((kb_GetShift() & 0x04) != 0)
- #define kb_Alt() ((kb_GetShift() & 0x08) != 0)
- #define kb_ScrollLock() ((kb_GetShift() & 0x10) != 0)
- #define kb_NumLock() ((kb_GetShift() & 0x20) != 0)
- #define kb_CapsLock() ((kb_GetShift() & 0x40) != 0)
- #define kb_Insert() ((kb_GetShift() & 0x80) != 0)
- #define ascii(key) ((char)((key) & 0x00FF))
-
- #define TIMER_LIMIT ((unsigned)(10*60*100)) /* Ten minutes in hundredths */
-
- #define hard_Timer() (*curr_dmgr->disp.dig.hTimer)()
- #define hard_Pause(duration) (*curr_dmgr->disp.dig.hPause)(duration)
- #define hard_Sound(pitch, duration) \
- (*curr_dmgr->disp.dig.hSound)(pitch, duration)
-
- #define hard_Tone() hard_Sound(1500, 1)
-
- /* Alias hard_Speaker to hard_Sound */
- #define hard_Speaker(pitch, dur) hard_Sound(pitch, dur)
- #define tone() hard_Tone()
-
- #define hard_SetSound(on) \
- ((on) ? hard_Control(HC_SETSOUNDON, NULL, NULL) : \
- hard_Control(HC_SETSOUNDOFF, NULL, NULL))
-
- #define hard_IsSoundOn() ((boolean)hard_Control(HC_GETSOUNDON, NULL, NULL))
- #define hard_IsMouseOn() ((boolean)hard_Control(HC_ISMOUSEON, NULL, NULL))
-
- /** reentrancy protection functions **/
- #define hard_ProtectDmgr() hard_Control(HC_PROTECT, NULL, NULL)
- #define hard_UnProtectDmgr() hard_Control(HC_UNPROTECT, NULL, NULL)
- /* -------------------------------------------------------------------------- */
-
-