From 451c3bed63d043c31330ed15e87bd020d9d8a375 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Tue, 20 May 2003 21:05:58 +0000
Subject: [PATCH] Added showhelp() and timedisplay() to all uifc
 initializations as NULL

Revert to magic number-based upop() (for now)
---
 src/uifc/uifc.c       |  3 +++
 src/uifc/uifc.h       |  4 ----
 src/uifc/uifcc.c      | 34 +++++++++-------------------------
 src/uifc/uifcd.c      |  3 +++
 src/uifc/uifcfltk.cpp |  3 +++
 src/uifc/uifcx.c      |  3 +++
 6 files changed, 21 insertions(+), 29 deletions(-)

diff --git a/src/uifc/uifc.c b/src/uifc/uifc.c
index 6317fd8712..75898973c0 100644
--- a/src/uifc/uifc.c
+++ b/src/uifc/uifc.c
@@ -138,6 +138,9 @@ int uifcini(uifcapi_t* uifcapi)
     api->list=ulist;
     api->input=uinput;
     api->sethelp=sethelp;
+    api->showhelp=help;
+	api->showbuf=NULL;
+	api->timedisplay=timedisplay;
 
     if(api->scrn_len!=0) {
         switch(api->scrn_len) {
diff --git a/src/uifc/uifc.h b/src/uifc/uifc.h
index 68882fdbc6..1cb36cee6d 100644
--- a/src/uifc/uifc.h
+++ b/src/uifc/uifc.h
@@ -171,11 +171,9 @@
 #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_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_HLP 	(1<<17) /* Parse 'Help codes' */
 #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 */
 
@@ -351,7 +349,6 @@ typedef struct {
 /****************************************************************************/
     void    (*sethelp)(int line, char* file);
 
-#ifdef __unix__
 /****************************************************************************/
 /* Shows the current help text												*/
 /****************************************************************************/
@@ -368,7 +365,6 @@ typedef struct {
 /****************************************************************************/
 	void (*timedisplay)(void);
 
-#endif
 } uifcapi_t;
 
 /****************************************************************************/
diff --git a/src/uifc/uifcc.c b/src/uifc/uifcc.c
index 674f04b9e4..f552bb3924 100644
--- a/src/uifc/uifcc.c
+++ b/src/uifc/uifcc.c
@@ -181,11 +181,9 @@ int uifcinic(uifcapi_t* uifcapi)
     api->list=ulist;
     api->input=uinput;
     api->sethelp=sethelp;
-#ifdef __unix__
     api->showhelp=help;
 	api->showbuf=showbuf;
 	api->timedisplay=timedisplay;
-#endif
 
 #if defined(LOCALE)
   (void) setlocale(LC_ALL, "");
@@ -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;
 
 	/* Dynamic Menus */
-#ifdef __unix__
 	if(mode&WIN_DYN
 			&& cur != NULL 
 			&& bar != NULL 
@@ -457,7 +454,6 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
 			&& save_menu_cur==*cur
 			&& save_menu_bar==*bar)
 		is_redraw=1;
-#endif
 
 	if(!is_redraw) {
 		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
 			y=top+3+(*cur);
 	}
 
-	#ifdef __unix__
 	last_menu_cur=cur;
 	last_menu_bar=bar;
-	#endif
 	while(1) {
 	#if 0					/* debug */
 		gotoxy(30,1);
@@ -1148,14 +1142,11 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
 							return(-1); } } }
 		else
 			mswait(1);
-#ifdef __unix__
 		if(mode&WIN_DYN) {
 			save_menu_cur=*cur;
 			save_menu_bar=*bar;
 			return(-2-i);
 		}
-#endif
-
 		}
 }
 
@@ -1637,33 +1628,30 @@ 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[UPOP_COLS*UPOP_ROWS*2];
-	char buf[UPOP_COLS*UPOP_ROWS*2];
+	static char sav[26*3*2];
+	char buf[26*3*2];
 	int i,j,k;
 
 	reset_dynamic();
 	hidemouse();
 	if(!str) {
-		puttext(1,UPOP_ROW,UPOP_COLS,UPOP_ROW+UPOP_ROWS,sav);
+		puttext(28,12,53,14,sav);
 		showmouse();
 		return; }
-	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)
+	gettext(28,12,53,14,sav);
+	memset(buf,SP,25*3*2);
+	for(i=1;i<26*3*2;i+=2)
 		buf[i]=(hclr|(bclr<<4));
 		buf[0]='Ú';
-	for(i=2;i<UPOP_COLS*2;i+=2)
+	for(i=2;i<25*2;i+=2)
         buf[i]='Ä';
 		buf[i]='¿'; i+=2;
         buf[i]='³'; i+=2;
 	i+=2;
 	k=strlen(str);
-	i+=(((UPOP_COLS-k)/2)*2);
+	i+=(((23-k)/2)*2);
 	for(j=0;j<k;j++,i+=2) {
 		buf[i]=str[j];
 		buf[i+1]|=BLINK; }
@@ -1674,7 +1662,7 @@ void upop(char *str)
         buf[i]='Ä';
     buf[i]='Ù';
 
-	puttext(1,UPOP_ROW,UPOP_COLS,UPOP_ROW+UPOP_ROWS,buf);
+	puttext(28,12,53,14,buf);
 	showmouse();
 }
 
@@ -1726,7 +1714,6 @@ void showbuf(int mode, int left, int top, int width, int height, char *title, ch
 	old_curs=curs_set(0);
 
 	/* Dynamic Menus */
-#ifdef __unix__
 	if(mode&WIN_DYN
 			&& curp != NULL 
 			&& barp != NULL 
@@ -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_bar==*barp)
 		is_redraw=1;
-#endif
 
 	if((savscrn=(char *)MALLOC(api->scrn_width*api->scrn_len*2))==NULL) {
 		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
 		puttext(1,1,api->scrn_width,api->scrn_len,savscrn);
 		showmouse();
 	}
-#ifdef __unix__
 	if(is_redraw)			/* Force redraw of menu also. */
 		reset_dynamic();
-#endif
 	FREE(savscrn);
 	FREE(buf);
 	if(old_curs != ERR)
diff --git a/src/uifc/uifcd.c b/src/uifc/uifcd.c
index 3cc8e2d6c5..1439101052 100644
--- a/src/uifc/uifcd.c
+++ b/src/uifc/uifcd.c
@@ -77,6 +77,9 @@ int uifcinid(uifcapi_t* uifcapi)
     api->list=ulist;
     api->input=uinput;
     api->sethelp=sethelp;
+    api->showhelp=help;
+	api->showbuf=NULL;
+	api->timedisplay=NULL;
 
     setvbuf(stdout,NULL,_IONBF,0);
     api->scrn_len=24;
diff --git a/src/uifc/uifcfltk.cpp b/src/uifc/uifcfltk.cpp
index 33337964a5..3403d1e53b 100644
--- a/src/uifc/uifcfltk.cpp
+++ b/src/uifc/uifcfltk.cpp
@@ -797,6 +797,9 @@ int uifcinifltk(uifcapi_t* uifcapi)
     api->list=ulist;
     api->input=uinput;
     api->sethelp=sethelp;
+    api->showhelp=help;
+	api->showbuf=NULL;
+	api->timedisplay=NULL;
 
     api->scrn_len=24;
 	api->scrn_width=80;
diff --git a/src/uifc/uifcx.c b/src/uifc/uifcx.c
index c6ef299118..947d833e3c 100644
--- a/src/uifc/uifcx.c
+++ b/src/uifc/uifcx.c
@@ -82,6 +82,9 @@ int uifcinix(uifcapi_t* uifcapi)
     api->list=ulist;
     api->input=uinput;
     api->sethelp=sethelp;
+    api->showhelp=help;
+	api->showbuf=NULL;
+	api->timedisplay=NULL;
 
     setvbuf(stdin,NULL,_IONBF,0);
     setvbuf(stdout,NULL,_IONBF,0);
-- 
GitLab