home *** CD-ROM | disk | FTP | other *** search
- /*
- vid.c
-
- % vid_ routines
-
- OWL 1.1
- Copyright (c) 1988, 1989 by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 8/10/88 jmd Added new object stuff
- 8/24/88 ted merged driver and mode in to one stub function pointer.
- */
-
- #include "oakhead.h"
- #include "disppriv.h"
-
- #include "viddecl.h"
- /* -------------------------------------------------------------------------- */
-
- byte vid_GetMap(attr)
- byte attr;
- {
- opixval fg, bg;
- byte colors;
-
- disp_GetAttrColors(attr, &fg, &bg);
- colors = ((byte) fg) & 0x0F;
- colors |= ((byte) bg) << 4;
-
- return(colors);
- }
- /* -------------------------------------------------------------------------- */
-
- char vid_GetChar(row, col)
- int row;
- int col;
- {
- char c;
- byte attr;
-
- cmwin_GetStringAttr(vid_win, row, col, &c, &attr, 1);
- return(c);
- }
- /* -------------------------------------------------------------------------- */
- #define MAXATTRBUF 90
-
- int vid_PutAttr(row, col, attrbuf, slen)
- int row;
- int col;
- byte *attrbuf;
- int slen;
- /*
- Puts slen attribute bytes from attrbuf into the vid_win at row, col.
- Puts at most MAXATTR attrs. The display is refreshed to reflect the new
- attribute bytes.
- Returns the number of bytes actually used.
- */
- {
- static byte abuf[MAXATTRBUF];
- static char cbuf[MAXATTRBUF];
- int len;
-
- if (slen > MAXATTRBUF) slen = MAXATTRBUF;
-
- len = cmwin_GetStringAttr(vid_win, row, col, cbuf, abuf, slen);
-
- memmove(abuf, attrbuf, len);
-
- cmwin_DrawStringAttr(vid_win, row, col, cbuf, abuf, len);
-
- return(len);
- }
- /* -------------------------------------------------------------------------- */
-
- char *vid_GetAttr(row, col, slen)
- int row;
- int col;
- int slen;
- /*
- Returns a pointer to a static buffer containing slen attributes from
- the vid_win at row, col. Returns MAXATTRBUF attrs at most. The buffer is
- not null-terminated.
- */
- {
- char cbuf[MAXATTRBUF];
- static byte abuf[MAXATTRBUF];
-
- if (slen > MAXATTRBUF) slen = MAXATTRBUF;
-
- cmwin_GetStringAttr(vid_win, row, col, cbuf, abuf, slen);
- return((char *) abuf);
- }
- /* -------------------------------------------------------------------------- */
-
- void vid_ScrollWindow(toprow, leftcol, botrow, rightcol, lines, attr)
- int toprow;
- int leftcol;
- int botrow;
- int rightcol;
- int lines;
- byte attr;
- {
- ocbox cbox;
-
- cbox.leftcol = leftcol;
- cbox.rightcol = rightcol;
- cbox.toprow = toprow;
- cbox.botrow = botrow;
-
- cmwin_ScrollBoxVt(vid_win, &cbox, lines);
- /* Note: attr is no longer used to clear opened part */ oak_notused(attr);
- }
- /* -------------------------------------------------------------------------- */
-
- void vid_ClearWindow(toprow, leftcol, botrow, rightcol, attr)
- int toprow;
- int leftcol;
- int botrow;
- int rightcol;
- byte attr;
- {
- ocbox cbox;
-
- cbox.leftcol = leftcol;
- cbox.rightcol = rightcol;
- cbox.toprow = toprow;
- cbox.botrow = botrow;
- cmwin_ClearBox(vid_win, &cbox, (byte)attr);
- }
- /* -------------------------------------------------------------------------- */
-
- void vid_DrawLine(linecp, row1, col1, row2, col2, attr)
- char *linecp;
- int row1;
- int col1;
- int row2;
- int col2;
- byte attr;
- {
- if (row1 == row2) {
- cmwin_DrawHzLine(vid_win, linecp, row1, col1, col2 - col1 + 1, attr);
- }
- else if (col1 == col2) {
- cmwin_DrawVtLine(vid_win, linecp, row1, col1, row2 - row1 + 1, attr);
- }
- }
- /* -------------------------------------------------------------------------- */
-
- void vid_DrawBox(boxcp, row1, col1, row2, col2, attr)
- char *boxcp;
- int row1;
- int col1;
- int row2;
- int col2;
- byte attr;
- {
- ocbox cbox;
-
- cbox.toprow = row1;
- cbox.leftcol = col1;
- cbox.botrow = row2;
- cbox.rightcol= col2;
-
- cmwin_DrawBox(vid_win, boxcp, &cbox, attr);
- }
- /* -------------------------------------------------------------------------- */
-
-