Commit 16814eb6 authored by rswindell's avatar rswindell
Browse files

Added scrn_width to uifcapi_t, changed SCRN_RIGHT macro to use api->scrn_width

instead of assuming a local/global variable exists named scrn_width.
parent d330abd4
......@@ -191,6 +191,7 @@ int uifcini(uifcapi_t* uifcapi)
,txtinfo.screenwidth);
return(-3);
}
api->scrn_width=txtinfo.screenwidth;
#ifndef __FLAT__
......
......@@ -181,7 +181,7 @@
#define SCRN_TOP 3
#define SCRN_LEFT 5
#define SCRN_RIGHT (scrn_width-6)
#define SCRN_RIGHT (api->scrn_width-6)
/* Bits in 'mode' for getkey and getstr */
#define K_UPPER (1L<<0) /* Converts all letters to upper case */
......@@ -281,6 +281,10 @@ typedef struct {
/****************************************************************************/
uint scrn_len;
/****************************************************************************/
/* Screen Width */
/****************************************************************************/
uint scrn_width;
/****************************************************************************/
/* ESC key delay for curses */
/****************************************************************************/
uint esc_delay;
......
......@@ -99,7 +99,6 @@ static win_t sav[MAX_BUFS];
static uint max_opts=MAX_OPTS;
static uifcapi_t* api;
static int lastattr=0;
static int scrn_width;
/* Prototypes */
static int uprintf(int x, int y, unsigned char attr, char *fmt,...);
......@@ -235,7 +234,7 @@ int uifcinic(uifcapi_t* uifcapi)
return(-2);
}
api->scrn_len--; /* account for status line */
scrn_width=width;
api->scrn_width=width;
if(width<80) {
......@@ -347,7 +346,7 @@ int uscrn(char *str)
clrtoeol();
gotoxy(3,1);
cputs(str);
if(!puttext(1,2,scrn_width,api->scrn_len,blk_scrn))
if(!puttext(1,2,api->scrn_width,api->scrn_len,blk_scrn))
return(-1);
gotoxy(1,api->scrn_len+1);
clrtoeol();
......@@ -1638,30 +1637,33 @@ char *utimestr(time_t *intime)
/****************************************************************************/
/* Status popup/down function, see uifc.h for details. */
/****************************************************************************/
#define UPOP_ROW 12
#define UPOP_ROWS 3
#define UPOP_COLS 80
void upop(char *str)
{
static char sav[26*3*2];
char buf[26*3*2];
static char sav[UPOP_COLS*UPOP_ROWS*2];
char buf[UPOP_COLS*UPOP_ROWS*2];
int i,j,k;
reset_dynamic();
hidemouse();
if(!str) {
puttext(28,12,53,14,sav);
puttext(1,UPOP_ROW,UPOP_COLS,UPOP_ROW+UPOP_ROWS,sav);
showmouse();
return; }
gettext(28,12,53,14,sav);
memset(buf,SP,25*3*2);
for(i=1;i<26*3*2;i+=2)
gettext(1,UPOP_ROW,UPOP_COLS,UPOP_ROW+UPOP_ROWS,sav);
memset(buf,SP,UPOP_COLS*UPOP_ROWS*2);
for(i=1;i<(UPOP_COLS+1)*UPOP_COLS*2;i+=2)
buf[i]=(hclr|(bclr<<4));
buf[0]='';
for(i=2;i<25*2;i+=2)
for(i=2;i<UPOP_COLS*2;i+=2)
buf[i]='';
buf[i]=''; i+=2;
buf[i]=''; i+=2;
i+=2;
k=strlen(str);
i+=(((23-k)/2)*2);
i+=(((UPOP_COLS-k)/2)*2);
for(j=0;j<k;j++,i+=2) {
buf[i]=str[j];
buf[i+1]|=BLINK; }
......@@ -1672,7 +1674,7 @@ void upop(char *str)
buf[i]='';
buf[i]='';
puttext(28,12,53,14,buf);
puttext(1,UPOP_ROW,UPOP_COLS,UPOP_ROW+UPOP_ROWS,buf);
showmouse();
}
......@@ -1707,12 +1709,12 @@ void showbuf(int mode, int left, int top, int width, int height, char *title, ch
height=(api->scrn_len-3)-top;
if(!width || width<strlen(title)+6)
width=strlen(title)+6;
if(width>scrn_width)
width=scrn_width;
if(width>api->scrn_width)
width=api->scrn_width;
if(mode&WIN_L2R)
left=(scrn_width-width)/2+1;
left=(api->scrn_width-width)/2+1;
else if(mode&WIN_RHT)
left=scrn_width-(width+4+left);
left=api->scrn_width-(width+4+left);
if(mode&WIN_T2B)
top=(api->scrn_len/2)-(height/2)-2;
else if(mode&WIN_BOT)
......@@ -1735,9 +1737,9 @@ void showbuf(int mode, int left, int top, int width, int height, char *title, ch
is_redraw=1;
#endif
if((savscrn=(char *)MALLOC(scrn_width*api->scrn_len*2))==NULL) {
if((savscrn=(char *)MALLOC(api->scrn_width*api->scrn_len*2))==NULL) {
cprintf("UIFC line %d: error allocating %u bytes\r\n"
,__LINE__,scrn_width*25*2);
,__LINE__,api->scrn_width*25*2);
curs_set(1);
return; }
if((buf=(char *)MALLOC(width*height*2))==NULL) {
......@@ -1747,7 +1749,7 @@ void showbuf(int mode, int left, int top, int width, int height, char *title, ch
curs_set(1);
return; }
hidemouse();
gettext(1,1,scrn_width,api->scrn_len,savscrn);
gettext(1,1,api->scrn_width,api->scrn_len,savscrn);
if(!is_redraw) {
memset(buf,SP,width*height*2);
......@@ -1915,7 +1917,7 @@ void showbuf(int mode, int left, int top, int width, int height, char *title, ch
#endif
hidemouse();
puttext(1,1,scrn_width,api->scrn_len,savscrn);
puttext(1,1,api->scrn_width,api->scrn_len,savscrn);
showmouse();
}
#ifdef __unix__
......
......@@ -799,6 +799,7 @@ int uifcinifltk(uifcapi_t* uifcapi)
api->sethelp=sethelp;
api->scrn_len=24;
api->scrn_width=80;
api->mode |= UIFC_MOUSE;
// Fl::scheme("plastic");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment