From 8d9b7625aa2360ff0609679f3d38651270810cc2 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Tue, 6 Jul 2004 16:01:50 +0000 Subject: [PATCH] Fix od_conio to use a single-line status bar. This fixes everything! od_cio is now working 100%. Whee! --- src/conio/od_cio.c | 84 +++++++++++++++++++++++++++++++++------------- 1 file changed, 61 insertions(+), 23 deletions(-) diff --git a/src/conio/od_cio.c b/src/conio/od_cio.c index 4ad7386e9e..0597a97007 100644 --- a/src/conio/od_cio.c +++ b/src/conio/od_cio.c @@ -1,4 +1,5 @@ #include <stdarg.h> +#include <stdio.h> #include <OpenDoor.h> #include "conio.h" @@ -10,16 +11,19 @@ const int OD_tabs[10]={9,17,25,33,41,49,57,65,73,80}; int OD_puttext(int sx, int sy, int ex, int ey, unsigned char *fill) { + struct text_info ti; + + gettextinfo(&ti); if( sx < 1 - || sx > 80 + || sx > ti.screenwidth || sy < 1 - || sy > 23 + || sy > ti.screenheight || ex < sx || ey < sy || ex < 1 - || ex > 80 + || ex > ti.screenwidth || ey < 1 - || ey > 23) + || ey > ti.screenheight) return(0); return(od_puttext(sx,sy,ex,ey,fill)); @@ -27,16 +31,19 @@ int OD_puttext(int sx, int sy, int ex, int ey, unsigned char *fill) int OD_gettext(int sx, int sy, int ex, int ey, unsigned char *fill) { + struct text_info ti; + + gettextinfo(&ti); if( sx < 1 - || sx > 80 + || sx > ti.screenwidth || sy < 1 - || sy > 23 + || sy > ti.screenheight || ex < sx || ey < sy || ex < 1 - || ex > 80 + || ex > ti.screenwidth || ey < 1 - || ey > 23) + || ey > ti.screenheight) return(0); return(od_gettext(sx,sy,ex,ey,fill)); @@ -169,6 +176,7 @@ void OD_delay(long msec) int OD_wherey(void) { int row,col; + struct text_info ti; od_get_cursor(&row,&col); return(row); @@ -177,6 +185,7 @@ int OD_wherey(void) int OD_wherex(void) { int row,col; + struct text_info ti; od_get_cursor(&row,&col); return(col); @@ -230,20 +239,29 @@ int OD_putch(unsigned char ch) break; default: gettextinfo(&ti); - if(wherey()==ti.winbottom-ti.wintop+1 - && wherex()==ti.winright-ti.winleft+1) { - od_putch(ch); - wscroll(); - gotoxy(ti.winleft,ti.cury); + if(OD_wherey()==ti.screenheight + && OD_wherex()==ti.screenwidth) { + if(_wscroll) { + od_putch(ch); + gotoxy(ti.winleft,ti.cury); + } } else { - if(wherex()==ti.winright-ti.winleft+1) { + if(wherey()==ti.winbottom-ti.wintop+1 + && wherex()==ti.winright-ti.winleft+1) { od_putch(ch); - gotoxy(ti.winleft,ti.cury+1); + wscroll(); + gotoxy(ti.winleft,ti.cury); } else { - od_putch(ch); - gotoxy(ti.curx+1,ti.cury); + if(wherex()==ti.winright-ti.winleft+1) { + od_putch(ch); + gotoxy(ti.winleft,ti.cury+1); + } + else { + od_putch(ch); + gotoxy(ti.curx+1,ti.cury); + } } } break; @@ -254,20 +272,26 @@ int OD_putch(unsigned char ch) void OD_gotoxy(int x, int y) { - if( x<1 - || x > 80 - || y < 1 - || y > 23) + struct text_info ti; + char ansi[16]; + + gettextinfo(&ti); + + if(x>ti.screenwidth + || x < 1 + || y>ti.screenheight + || y<1) return; + sprintf(ansi,"%c[%d;%dH",27,y,x); od_set_cursor(y,x); } void OD_gettextinfo(struct text_info *info) { info->currmode=3; - info->screenheight=23; - info->screenwidth=80; + info->screenheight=od_control.user_screen_length?od_control.user_screen_length:23; + info->screenwidth=od_control.user_screenwidth?od_control.user_screenwidth:80; info->curx=wherex(); info->cury=wherey(); info->attribute=OD_attr; @@ -321,7 +345,21 @@ void OD_textmode(int mode) { } +ODAPIDEF void ODCALL OD_pers(BYTE btOperation) +{ + switch(btOperation) { + case PEROP_UPDATE1: + case PEROP_DISPLAY1: + ODScrnSetAttribute(0x70); + ODScrnSetCursorPos(1, 25); + ODScrnDisplayString("Design me a better ONE-LINE Status Bar! (Include Custom Keys Descriptions etc) "); + } +} + void OD_initciowrap(long mode) { + od_control.od_mps=INCLUDE_MPS; + od_add_personality("CONIO",1,24,OD_pers); + od_set_personality("CONIO"); od_init(); } -- GitLab