remove code to new shared file

This commit is contained in:
ehouse 2003-11-16 17:14:28 +00:00
parent 37ef7957ce
commit a2a1baaa8c

View file

@ -26,76 +26,11 @@
#include <ncurses.h>
#include "cursesask.h"
#include "cursesdlgutil.h"
#define ASK_HEIGHT 5
#define PAD 2
#define MAX_LINES 15
#define MIN_WIDTH 25
static void
drawButtons( WINDOW* confWin, XP_U16 line, short spacePerButton,
short numButtons, short curSelButton, char** button1 )
{
short i;
for ( i = 0; i < numButtons; ++i ) {
short len = strlen( *button1 );
if ( i == curSelButton ) {
wstandout( confWin );
}
mvwprintw( confWin, line, ((i+1) * spacePerButton) - (len/2),
"[%s]", *button1 );
if ( i == curSelButton ) {
wstandend( confWin );
}
++button1;
}
wrefresh( confWin );
} /* drawButtons */
/* Figure out how many lines there are and how wide the widest is.
*/
typedef struct FormatInfo {
XP_U16 nLines;
XP_U16 maxLen;
struct {
XP_UCHAR* substr;
XP_U16 len;
} line[MAX_LINES];
} FormatInfo;
static void
measureAskText( XP_UCHAR* question, FormatInfo* fip )
{
XP_U16 i;
XP_U16 maxWidth = 0;
XP_Bool done = XP_FALSE;
for ( i = 0; i < MAX_LINES && !done; ++i ) {
XP_UCHAR* next = strstr( question, XP_CR );
XP_U16 thisWidth;
fip->line[i].substr = question;
if ( !!next ) {
thisWidth = next - question;
} else {
thisWidth = strlen(question);
done = XP_TRUE;
}
fip->line[i].len = thisWidth;
if ( thisWidth > maxWidth ) {
maxWidth = thisWidth;
}
question = next + strlen(XP_CR);
}
fip->nLines = i;
fip->maxLen = maxWidth;
} /* measureAskText */
short
cursesask( CursesAppGlobals* globals, char* question, short numButtons,
char* button1, ... )
@ -148,7 +83,6 @@ cursesask( CursesAppGlobals* globals, char* question, short numButtons,
}
ch = fgetc( stdin );
/* char ch = wgetch( globals->menuWin ); */
switch ( ch ) {
case '\t':
case 'L':