Skip to content
Snippets Groups Projects
Commit 451c3bed authored by deuce's avatar deuce
Browse files

Added showhelp() and timedisplay() to all uifc initializations as NULL

Revert to magic number-based upop() (for now)
parent f1ca1d9a
No related branches found
No related tags found
No related merge requests found
...@@ -138,6 +138,9 @@ int uifcini(uifcapi_t* uifcapi) ...@@ -138,6 +138,9 @@ int uifcini(uifcapi_t* uifcapi)
api->list=ulist; api->list=ulist;
api->input=uinput; api->input=uinput;
api->sethelp=sethelp; api->sethelp=sethelp;
api->showhelp=help;
api->showbuf=NULL;
api->timedisplay=timedisplay;
if(api->scrn_len!=0) { if(api->scrn_len!=0) {
switch(api->scrn_len) { switch(api->scrn_len) {
......
...@@ -171,11 +171,9 @@ ...@@ -171,11 +171,9 @@
#define WIN_PUT (1<<13) /* Allows F6 to Put a menu item */ #define WIN_PUT (1<<13) /* Allows F6 to Put a menu item */
#define WIN_CHE (1<<14) /* Stay active after escape if changes */ #define WIN_CHE (1<<14) /* Stay active after escape if changes */
#define WIN_XTR (1<<15) /* Add extra line at end for inserting at end */ #define WIN_XTR (1<<15) /* Add extra line at end for inserting at end */
#ifdef __unix__
#define WIN_DYN (1<<16) /* Dynamic window - return at least every second */ #define WIN_DYN (1<<16) /* Dynamic window - return at least every second */
#define WIN_HLP (1<<17) /* Parse 'Help codes' */ #define WIN_HLP (1<<17) /* Parse 'Help codes' */
#define WIN_PACK (1<<18) /* Pack text in window (No padding) */ #define WIN_PACK (1<<18) /* Pack text in window (No padding) */
#endif
#define WIN_MID WIN_L2R|WIN_T2B /* Place window in middle of screen */ #define WIN_MID WIN_L2R|WIN_T2B /* Place window in middle of screen */
...@@ -351,7 +349,6 @@ typedef struct { ...@@ -351,7 +349,6 @@ typedef struct {
/****************************************************************************/ /****************************************************************************/
void (*sethelp)(int line, char* file); void (*sethelp)(int line, char* file);
#ifdef __unix__
/****************************************************************************/ /****************************************************************************/
/* Shows the current help text */ /* Shows the current help text */
/****************************************************************************/ /****************************************************************************/
...@@ -368,7 +365,6 @@ typedef struct { ...@@ -368,7 +365,6 @@ typedef struct {
/****************************************************************************/ /****************************************************************************/
void (*timedisplay)(void); void (*timedisplay)(void);
#endif
} uifcapi_t; } uifcapi_t;
/****************************************************************************/ /****************************************************************************/
......
...@@ -181,11 +181,9 @@ int uifcinic(uifcapi_t* uifcapi) ...@@ -181,11 +181,9 @@ int uifcinic(uifcapi_t* uifcapi)
api->list=ulist; api->list=ulist;
api->input=uinput; api->input=uinput;
api->sethelp=sethelp; api->sethelp=sethelp;
#ifdef __unix__
api->showhelp=help; api->showhelp=help;
api->showbuf=showbuf; api->showbuf=showbuf;
api->timedisplay=timedisplay; api->timedisplay=timedisplay;
#endif
#if defined(LOCALE) #if defined(LOCALE)
(void) setlocale(LC_ALL, ""); (void) setlocale(LC_ALL, "");
...@@ -448,7 +446,6 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar ...@@ -448,7 +446,6 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
top=api->scrn_len-height-3-top; top=api->scrn_len-height-3-top;
/* Dynamic Menus */ /* Dynamic Menus */
#ifdef __unix__
if(mode&WIN_DYN if(mode&WIN_DYN
&& cur != NULL && cur != NULL
&& bar != NULL && bar != NULL
...@@ -457,7 +454,6 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar ...@@ -457,7 +454,6 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
&& save_menu_cur==*cur && save_menu_cur==*cur
&& save_menu_bar==*bar) && save_menu_bar==*bar)
is_redraw=1; is_redraw=1;
#endif
if(!is_redraw) { if(!is_redraw) {
if(mode&WIN_SAV && api->savdepth==api->savnum) { if(mode&WIN_SAV && api->savdepth==api->savnum) {
...@@ -682,10 +678,8 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar ...@@ -682,10 +678,8 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
y=top+3+(*cur); y=top+3+(*cur);
} }
#ifdef __unix__
last_menu_cur=cur; last_menu_cur=cur;
last_menu_bar=bar; last_menu_bar=bar;
#endif
while(1) { while(1) {
#if 0 /* debug */ #if 0 /* debug */
gotoxy(30,1); gotoxy(30,1);
...@@ -1148,14 +1142,11 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar ...@@ -1148,14 +1142,11 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
return(-1); } } } return(-1); } } }
else else
mswait(1); mswait(1);
#ifdef __unix__
if(mode&WIN_DYN) { if(mode&WIN_DYN) {
save_menu_cur=*cur; save_menu_cur=*cur;
save_menu_bar=*bar; save_menu_bar=*bar;
return(-2-i); return(-2-i);
} }
#endif
} }
} }
...@@ -1637,33 +1628,30 @@ char *utimestr(time_t *intime) ...@@ -1637,33 +1628,30 @@ char *utimestr(time_t *intime)
/****************************************************************************/ /****************************************************************************/
/* Status popup/down function, see uifc.h for details. */ /* 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) void upop(char *str)
{ {
static char sav[UPOP_COLS*UPOP_ROWS*2]; static char sav[26*3*2];
char buf[UPOP_COLS*UPOP_ROWS*2]; char buf[26*3*2];
int i,j,k; int i,j,k;
reset_dynamic(); reset_dynamic();
hidemouse(); hidemouse();
if(!str) { if(!str) {
puttext(1,UPOP_ROW,UPOP_COLS,UPOP_ROW+UPOP_ROWS,sav); puttext(28,12,53,14,sav);
showmouse(); showmouse();
return; } return; }
gettext(1,UPOP_ROW,UPOP_COLS,UPOP_ROW+UPOP_ROWS,sav); gettext(28,12,53,14,sav);
memset(buf,SP,UPOP_COLS*UPOP_ROWS*2); memset(buf,SP,25*3*2);
for(i=1;i<(UPOP_COLS+1)*UPOP_COLS*2;i+=2) for(i=1;i<26*3*2;i+=2)
buf[i]=(hclr|(bclr<<4)); buf[i]=(hclr|(bclr<<4));
buf[0]=''; buf[0]='';
for(i=2;i<UPOP_COLS*2;i+=2) for(i=2;i<25*2;i+=2)
buf[i]=''; buf[i]='';
buf[i]=''; i+=2; buf[i]=''; i+=2;
buf[i]=''; i+=2; buf[i]=''; i+=2;
i+=2; i+=2;
k=strlen(str); k=strlen(str);
i+=(((UPOP_COLS-k)/2)*2); i+=(((23-k)/2)*2);
for(j=0;j<k;j++,i+=2) { for(j=0;j<k;j++,i+=2) {
buf[i]=str[j]; buf[i]=str[j];
buf[i+1]|=BLINK; } buf[i+1]|=BLINK; }
...@@ -1674,7 +1662,7 @@ void upop(char *str) ...@@ -1674,7 +1662,7 @@ void upop(char *str)
buf[i]=''; buf[i]='';
buf[i]=''; buf[i]='';
puttext(1,UPOP_ROW,UPOP_COLS,UPOP_ROW+UPOP_ROWS,buf); puttext(28,12,53,14,buf);
showmouse(); showmouse();
} }
...@@ -1726,7 +1714,6 @@ void showbuf(int mode, int left, int top, int width, int height, char *title, ch ...@@ -1726,7 +1714,6 @@ void showbuf(int mode, int left, int top, int width, int height, char *title, ch
old_curs=curs_set(0); old_curs=curs_set(0);
/* Dynamic Menus */ /* Dynamic Menus */
#ifdef __unix__
if(mode&WIN_DYN if(mode&WIN_DYN
&& curp != NULL && curp != NULL
&& barp != NULL && barp != NULL
...@@ -1735,7 +1722,6 @@ void showbuf(int mode, int left, int top, int width, int height, char *title, ch ...@@ -1735,7 +1722,6 @@ void showbuf(int mode, int left, int top, int width, int height, char *title, ch
&& save_menu_cur==*curp && save_menu_cur==*curp
&& save_menu_bar==*barp) && save_menu_bar==*barp)
is_redraw=1; is_redraw=1;
#endif
if((savscrn=(char *)MALLOC(api->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" cprintf("UIFC line %d: error allocating %u bytes\r\n"
...@@ -1920,10 +1906,8 @@ void showbuf(int mode, int left, int top, int width, int height, char *title, ch ...@@ -1920,10 +1906,8 @@ void showbuf(int mode, int left, int top, int width, int height, char *title, ch
puttext(1,1,api->scrn_width,api->scrn_len,savscrn); puttext(1,1,api->scrn_width,api->scrn_len,savscrn);
showmouse(); showmouse();
} }
#ifdef __unix__
if(is_redraw) /* Force redraw of menu also. */ if(is_redraw) /* Force redraw of menu also. */
reset_dynamic(); reset_dynamic();
#endif
FREE(savscrn); FREE(savscrn);
FREE(buf); FREE(buf);
if(old_curs != ERR) if(old_curs != ERR)
......
...@@ -77,6 +77,9 @@ int uifcinid(uifcapi_t* uifcapi) ...@@ -77,6 +77,9 @@ int uifcinid(uifcapi_t* uifcapi)
api->list=ulist; api->list=ulist;
api->input=uinput; api->input=uinput;
api->sethelp=sethelp; api->sethelp=sethelp;
api->showhelp=help;
api->showbuf=NULL;
api->timedisplay=NULL;
setvbuf(stdout,NULL,_IONBF,0); setvbuf(stdout,NULL,_IONBF,0);
api->scrn_len=24; api->scrn_len=24;
......
...@@ -797,6 +797,9 @@ int uifcinifltk(uifcapi_t* uifcapi) ...@@ -797,6 +797,9 @@ int uifcinifltk(uifcapi_t* uifcapi)
api->list=ulist; api->list=ulist;
api->input=uinput; api->input=uinput;
api->sethelp=sethelp; api->sethelp=sethelp;
api->showhelp=help;
api->showbuf=NULL;
api->timedisplay=NULL;
api->scrn_len=24; api->scrn_len=24;
api->scrn_width=80; api->scrn_width=80;
......
...@@ -82,6 +82,9 @@ int uifcinix(uifcapi_t* uifcapi) ...@@ -82,6 +82,9 @@ int uifcinix(uifcapi_t* uifcapi)
api->list=ulist; api->list=ulist;
api->input=uinput; api->input=uinput;
api->sethelp=sethelp; api->sethelp=sethelp;
api->showhelp=help;
api->showbuf=NULL;
api->timedisplay=NULL;
setvbuf(stdin,NULL,_IONBF,0); setvbuf(stdin,NULL,_IONBF,0);
setvbuf(stdout,NULL,_IONBF,0); setvbuf(stdout,NULL,_IONBF,0);
......
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