From 452e41d86fe5732c8735e4eb5d41b419c735b531 Mon Sep 17 00:00:00 2001 From: Leslee Griffith Date: Thu, 27 May 1999 03:47:36 +0000 Subject: [PATCH] commit of gtapi for os2 --- harbour/source/rtl/gtos2.c | 110 +++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 harbour/source/rtl/gtos2.c diff --git a/harbour/source/rtl/gtos2.c b/harbour/source/rtl/gtos2.c new file mode 100644 index 0000000000..7703aeba2a --- /dev/null +++ b/harbour/source/rtl/gtos2.c @@ -0,0 +1,110 @@ +/* + * GTOS2.C: Video subsystem for OS/2 compilers. + * + * This module is based on VIDMGR by Andrew Clarke and modified for + * the Harbour project + */ + +#define INCL_KBD +#define INCL_VIO +#define INCL_DOSPROCESS + +#include +#include +#include + +#ifndef KBDTRF_FINAL_CHAR_IN +#define KBDTRF_FINAL_CHAR_IN FINAL_CHAR_IN +#endif + +static void gtSetCursorSize(char start, char end); +static void gtGetCursorSize(char *start, char *end); + +void gtInit(void) +{ +} + +void gtDone(void) +{ +} + +char gtGetScreenWidth(void) +{ + VIOMODEINFO vi; + vi.cb = sizeof(VIOMODEINFO); + VioGetMode(&vi, 0); + return vi.col; +} + +char gtGetScreenHeight(void) +{ + VIOMODEINFO vi; + vi.cb = sizeof(VIOMODEINFO); + VioGetMode(&vi, 0); + return vi.row; +} + +void gtGotoXY(char x, char y) +{ + VioSetCurPos((USHORT) (y - 1), (USHORT) (x - 1), 0); +} + +static void gtSetCursorSize(char start, char end) +{ + VIOCURSORINFO vi; + vi.yStart = start; + vi.cEnd = end; + vi.cx = 0; + vi.attr = 0; + VioSetCurType(&vi, 0); +} + +static void gtGetCursorSize(char *start, char *end) +{ + VIOCURSORINFO vi; + VioGetCurType(&vi, 0); + *start = vi.yStart; + *end = vi.cEnd; +} + +void gtSetCursorStyle(int style) +{ + /* TODO: need to implement this */ +} + +int gtGetCursorStyle(void) +{ + /* TODO: need to implement this */ + int rc=0; + + return(rc); +} + +void gtPuts(char x, char y, char attr, char *str) +{ + VioWrtCharStrAtt(str, (USHORT) strlen(str), (USHORT) (y - 1), (USHORT) (x - 1), (PBYTE) &attr, 0); +} + +void gtGetText(char x1, char y1, char x2, char y2, char *dest) +{ + USHORT width; + char y; + width = (USHORT) ((x2 - x1 + 1) * 2); + for (y = y1; y <= y2; y++) + { + VioReadCellStr((PBYTE) dest, &width, (USHORT) (y - 1), (USHORT) (x1 - 1), 0); + dest += width; + } +} + +void gtPutText(char x1, char y1, char x2, char y2, char *srce) +{ + USHORT width; + char y; + width = (USHORT) ((x2 - x1 + 1) * 2); + for (y = y1; y <= y2; y++) + { + VioWrtCellStr((PBYTE) srce, width, (USHORT) (y - 1), (USHORT) (x1 - 1), 0); + srce += width; + } +}