Skip to content
Snippets Groups Projects
Commit 8d9b7625 authored by deuce's avatar deuce
Browse files

Fix od_conio to use a single-line status bar. This fixes everything!

od_cio is now working 100%.  Whee!
parent 698fc429
No related branches found
No related tags found
No related merge requests found
#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();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment