DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T c

⟦33a20c647⟧ TextFile

    Length: 55815 (0xda07)
    Types: TextFile
    Names: »create.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z« 
        └─⟦e5a54fb17⟧ 
            └─⟦this⟧ »pp-5.0/Src/MTAconsole/create.c« 

TextFile

/* create.c: creation for all X widgets */

# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Src/MTAconsole/RCS/create.c,v 5.0 90/09/20 16:19:35 pp Exp Locker: pp $";
# endif

/*
 * $Header: /cs/research/pp/hubris/pp-beta/Src/MTAconsole/RCS/create.c,v 5.0 90/09/20 16:19:35 pp Exp Locker: pp $
 *
 * $Log:	create.c,v $
 * Revision 5.0  90/09/20  16:19:35  pp
 * rcsforce : 5.0 public release
 * 
 */



#include	"console.h"

#define	TOTAL_WIDTH	600
#define VP_HEIGHT	120

static void create_commandwidgets();
static void create_channelwidgets();
static void create_mtawidgets();
static void create_msgwidgets();
static void create_controlwidgets();
static void create_monitorwidgets();
static void create_popupwidgets();
extern char	*myname;
Widget		top,
		mainform,
		topform,
		nextform,
		mainvpane,
		channel_form,
		mta_form,
		msg_form,
		switchform,
		header = NULL,
		error = NULL,
		monitor_viewport,
		control_form;
int		errorUp = 0;

extern char	*ppversion;
extern void client_msg_handler();
extern XFontStruct	*normalFont;
int		strlen_msgall;

Arg	argList[10];

/* ARGSUSED */
create_widgets(display, context)
Display		*display;
XtAppContext	context;
{
	Dimension	ht;

	XtSetArg(argList[0], XtNfont, normalFont);

	XtAddEventHandler(top, NoEventMask, TRUE, client_msg_handler, NULL);
	
	mainform = WidgetCreate("mainform",
				formWidgetClass,
				top,
				NULL);

	mainvpane = WidgetCreate("mainvpane",
				 panedWidgetClass,
				 mainform,
				 NULL);
				 
	create_commandwidgets();
	create_channelwidgets();

	switchform = WidgetCreate("switchForm",
				  formWidgetClass,
				  mainvpane,
				  NULL);
	create_controlwidgets();
	create_popupwidgets(context);
	XtRealizeWidget(top);
	WidgetGet(topform,
		  XtNheight,	&ht,
		  NULL);
	WidgetSet(topform,
		  XtNmin,	ht,
		  XtNmax,	ht,
		  NULL);
	WidgetGet(nextform,
		  XtNheight,	&ht,
		  NULL);
	WidgetSet(nextform,
		  XtNmin,	ht,
		  XtNmax,	ht,
		  NULL);
	WidgetGet(channel_form,
		  XtNheight,	&ht,
		  NULL);
	WidgetSet(channel_form,
		  XtNmin,	ht,
		  XtNmax,	ht,
		  NULL);
	WidgetGet(mta_form,
		  XtNheight,	&ht,
		  NULL);
	WidgetSet(mta_form,
		  XtNmin,	ht,
		  XtNmax,	ht,
		  NULL);
	WidgetGet(msg_form,
		  XtNheight,	&ht,
		  NULL);
	WidgetSet(msg_form,
		  XtNmin,	ht,
		  XtNmax,	ht,
		  NULL);
	create_monitorwidgets();
	XtInstallAllAccelerators(mainform, mainform);
	MapButtons(False); /* can't see before connect */
	MapVolume(False);
}

Widget		quit_command,
		connect_command,
		refresh_command,
		mode_command,
		config_command,
		qcontrol_command,
		total_volume_label,
		total_number_label,
  		time_label,
		load1_label, load2_label,
		load1_sc, load2_sc;

extern void Refresh(),
	    Command(),
	    Connectbutton(),
	    Configure(),
	    QControlPopup(),
	    ChangeMode(),
	    setLoad();
extern double	load1, load2;

extern XFontStruct	*normalFont;
extern unsigned long	timeoutFor;

static void create_commandwidgets()
{
	Widget	pane, form;

	topform = WidgetCreate("generalCommands",
			       formWidgetClass,
			       mainvpane,
			       NULL);

	refresh_command = WidgetCreate("refreshCommand",
				       commandWidgetClass,
				       topform,
				       XtNlabel,	"refresh",
				       NULL);
	if (normalFont != NULL)
		XtSetValues(refresh_command, argList, 1);

	XtAddCallback(refresh_command, XtNcallback, Refresh, NULL);

	quit_command = WidgetCreate("quitCommand",
				    commandWidgetClass,
				    topform,
				    XtNlabel,		"quit",
				    NULL);
	XtAddCallback(quit_command, XtNcallback, Command, quit);
	if (normalFont != NULL)
		XtSetValues(quit_command, argList, 1);

	connect_command = WidgetCreate("connectCommand",
				       commandWidgetClass,
				       topform,
				       XtNlabel, "connect",
				       NULL);
	XtAddCallback(connect_command, XtNcallback, Connectbutton, connect); 
	if (normalFont != NULL)
		XtSetValues(connect_command,argList, 1);

	mode_command = WidgetCreate("modeCommand",
				    commandWidgetClass,
				    topform,
				    XtNlabel, "control",
				    NULL);
	XtAddCallback(mode_command, XtNcallback, ChangeMode, NULL);
	if (normalFont != NULL)
		XtSetValues(mode_command,argList, 1);

	config_command = WidgetCreate("configCommand",
				      commandWidgetClass,
				      topform,
				      XtNlabel, "configuration",
				      NULL);
	XtAddCallback(config_command, XtNcallback, Configure, NULL);
	if (normalFont != NULL)
		XtSetValues(config_command,argList, 1);

	qcontrol_command = WidgetCreate("qcontrolCommand",
					commandWidgetClass,
					topform,
					XtNlabel, "Qmgr control",
					NULL);
	XtAddCallback(qcontrol_command, XtNcallback, QControlPopup, NULL);
	if (normalFont != NULL)
		XtSetValues(qcontrol_command,argList, 1);

	nextform = WidgetCreate("statusForm",
			       formWidgetClass,
			       mainvpane,
			       NULL);

#ifdef	R4
	pane = WidgetCreate("statusPane",
			    panedWidgetClass,
			    nextform,
			    NULL);
	form = WidgetCreate("statusForm1",
			    formWidgetClass,
			    pane,
			    NULL);
	load1_label = WidgetCreate("load1",
				   labelWidgetClass,
				   form,
				   NULL);
	if (normalFont != NULL)
		XtSetValues(load1_label,argList, 1);

	load1_sc = WidgetCreate("load1StripChart",
				stripChartWidgetClass,
				form,
				XtNupdate,	(int) (timeoutFor / 2000),
				NULL);
	XtAddCallback(load1_sc, XtNgetValue, setLoad, &load1);

	form = WidgetCreate("statusForm2",
			    formWidgetClass,
			    pane,
			    NULL);

	load2_label = WidgetCreate("load2",
				   labelWidgetClass,
				   form,
				   NULL);
	if (normalFont != NULL)
		XtSetValues(load2_label,argList, 1);

	load2_sc = WidgetCreate("load2StripChart",
				stripChartWidgetClass,
				form,
				XtNupdate,	(int) (timeoutFor / 2000),
				NULL);
	XtAddCallback(load2_sc, XtNgetValue, setLoad, &load2);
#endif
	
	form = WidgetCreate("statusFormEnd",
			    formWidgetClass,
			    nextform,
			    NULL);
	total_volume_label = WidgetCreate("totalVolume",
					  labelWidgetClass,
					  form,
					  XtNlabel,	"Total volume",
					  NULL);
	if (normalFont != NULL)
		XtSetValues(total_volume_label,argList, 1);

	total_number_label = WidgetCreate("totalNumber",
					  labelWidgetClass,
					  form,
					  XtNlabel,	"Total number of messages",
					  NULL);
	if (normalFont != NULL)
		XtSetValues(total_number_label,argList, 1);

	time_label = WidgetCreate("timeLabel",
				  labelWidgetClass,
				  form,
				  XtNlabel, "qmgr status",
				  NULL);
	XtSetMappedWhenManaged(time_label, False);
	if (normalFont != NULL)
		XtSetValues(time_label,argList, 1);

	header = WidgetCreate("headerLabel",
			      labelWidgetClass,
			      form,
			      XtNlabel,	NO_CONNECTION,
			      NULL);
	if (normalFont != NULL)
		XtSetValues(header,argList, 1);


	error = WidgetCreate("errorLabel",
			     labelWidgetClass,
			     form,
			     XtNlabel,	NO_CONNECTION,
			     NULL);
	if (normalFont != NULL)
		XtSetValues(error,argList, 1);

	XtSetMappedWhenManaged(error, False);
	errorUp = 0;
}


Widget		channels,
		channel_header,
		channel_commands,
		channel_stop,
		channel_start,
		channel_clear,
		channel_cacheadd,
		channel_downforce,
		channel_label,
		channel_info,
		channel_all,
		channel_viewport;

extern struct chan_struct	*currentchan;
extern int			max_chan_border,
				read_currentchan;
char				*curlabel,
				*channel_info_str,
				*create_channel_header();
int				channel_info_strlen;

static void create_channelwidgets()
{
	Widget	temp_form;
	char	*str;

	channel_form = WidgetCreate("channelForm",
				    formWidgetClass,
				    mainvpane,
				    NULL);

	channel_header = WidgetCreate("channelHeader",
				      labelWidgetClass,
				      channel_form,
				      NULL);
	if (normalFont != NULL)
		XtSetValues(channel_header,argList, 1);

	WidgetGet(channel_header,
		  XtNlabel,	&str,
		  NULL);
	
	/* check for ap defaults */
	if (lexequ(str, "channelHeader") == 0) {
		printf("The application defaults aren't installed!\n");
		exit(1);
	}
	channel_commands = WidgetCreate("channelCommands",
					boxWidgetClass,
					channel_form,
					NULL);

	channel_info = WidgetCreate("channelInfo",
				    commandWidgetClass,
				    channel_commands,
				    XtNlabel,	"info",
				    NULL);
	if (normalFont != NULL)
		XtSetValues(channel_info,argList, 1);
	XtAddCallback(channel_info, XtNcallback, Command, chaninfo);

	channel_stop = WidgetCreate("channelStop",
				    commandWidgetClass,
				    channel_commands,
				    XtNlabel,	"disable",
				    NULL);
	if (normalFont != NULL)
		XtSetValues(channel_stop,argList, 1);

	XtAddCallback(channel_stop, XtNcallback, Command, chanstop);

	channel_start = WidgetCreate("channelStart",
				     commandWidgetClass,
				     channel_commands,
				     XtNlabel,	"enable",
				     NULL);
	if (normalFont != NULL)
		XtSetValues(channel_start,argList, 1);

	XtAddCallback(channel_start, XtNcallback, Command, chanstart);

	channel_clear = WidgetCreate("channelClear",
				     commandWidgetClass,
				     channel_commands,
				     NULL);
	if (normalFont != NULL)
		XtSetValues(channel_clear,argList, 1);

	XtAddCallback(channel_clear, XtNcallback, Command, chanclear);

	channel_cacheadd = WidgetCreate("channelCacheadd",
					commandWidgetClass,
					channel_commands,
					NULL);
	if (normalFont != NULL)
		XtSetValues(channel_cacheadd,argList, 1);

	XtAddCallback(channel_cacheadd, XtNcallback, Command, chancacheadd);

	channel_downforce = WidgetCreate("channelDownforce",
				     commandWidgetClass,
				     channel_commands,
				     NULL);
	if (normalFont != NULL)
		XtSetValues(channel_downforce,argList, 1);

	XtAddCallback (channel_downforce, XtNcallback, Command, chandownforce);


	currentchan = NULL;
	read_currentchan = 0;
	curlabel = create_channel_header();
	channel_label = WidgetCreate("channelLabel",
				     labelWidgetClass,
				     channel_form,
				     XtNlabel,	curlabel,
				     NULL);
	free(curlabel);
	if (normalFont != NULL)
		XtSetValues(channel_label,argList, 1);

	temp_form = WidgetCreate("channelForm2",
				 formWidgetClass,
				 mainvpane,
				 NULL);

	channel_viewport = WidgetCreate("channelViewport",
					viewportWidgetClass,
					temp_form,
					NULL);
	
	channels = WidgetCreate("channels",
				boxWidgetClass,
				channel_viewport,
				XtNvSpace,	(2*max_chan_border +1),
				NULL);

	channel_info_strlen = BUFSIZ;
	channel_info_str = calloc(1, (unsigned) channel_info_strlen);
	channel_all = WidgetCreate("channelAll",
				   asciiStringWidgetClass,
				   temp_form,
#ifdef R4
				   XtNuseStringInPlace,	True,
#endif
				   XtNlength,	channel_info_strlen,
				   XtNstring,	channel_info_str,
				   XtNtextOptions, scrollVertical,
				   NULL);
	XtSetMappedWhenManaged(channel_all,False);
	XtSetMappedWhenManaged(channel_form, False);
	XtSetSensitive(channel_commands,FALSE);
}

Widget	control_vpane;

static void create_controlwidgets()
{
	control_form = WidgetCreate("controlForm",
				    formWidgetClass,
				    switchform,
				    NULL);

	control_vpane = WidgetCreate("controlVpane",
				     panedWidgetClass,
				     control_form,
				     NULL);
	create_mtawidgets();
	create_msgwidgets();
}

Widget		mta_divider,
		mta_commands,
		mta_stop,
		mta_start,
		mta_clear,
		mta_cacheadd,
		mta_force,
		mta_downforce,
		mta_label,
		mta_info,
		mta_all,
		mta_viewport,
		mtas;
extern struct mta_struct	*currentmta;
extern int			read_currentmta;
extern int			max_mta_border;
extern char			*create_mta_header();
char				*mta_info_str;
int				mta_info_strlen;

static void create_mtawidgets()
{
	Widget	temp_form;

	mta_form = WidgetCreate("mtaForm",
				formWidgetClass,
				control_vpane,
				NULL);

	mta_divider = WidgetCreate("mtaDivider",
				   labelWidgetClass,
				   mta_form,
				   NULL);
	if (normalFont != NULL)
		XtSetValues(mta_divider,argList, 1);

	mta_commands = WidgetCreate("mtaCommands",
				    boxWidgetClass,
				    mta_form,
				    NULL);
	XtSetSensitive(mta_commands, FALSE);

	mta_info = WidgetCreate("mtaInfo",
				commandWidgetClass,
				mta_commands,
				XtNlabel,	"info",
				NULL);
	if (normalFont != NULL)
		XtSetValues(mta_info,argList, 1);

	XtAddCallback(mta_info, XtNcallback, Command, mtainfo);

	mta_stop = WidgetCreate("mtaStop",
				commandWidgetClass,
				mta_commands,
				XtNlabel,	"disable",
				NULL);
	if (normalFont != NULL)
		XtSetValues(mta_stop,argList, 1);

	XtAddCallback(mta_stop, XtNcallback, Command, mtastop);

	mta_start = WidgetCreate("mtaStart",
				 commandWidgetClass,
				 mta_commands,
				 XtNlabel,	"enable",
				 NULL);
	if (normalFont != NULL)
		XtSetValues(mta_start,argList, 1);

	XtAddCallback(mta_start, XtNcallback, Command, mtastart);

	mta_clear = WidgetCreate("mtaClear",
				 commandWidgetClass,
				 mta_commands,
				 NULL);
	if (normalFont != NULL)
		XtSetValues(mta_clear,argList, 1);

	XtAddCallback(mta_clear, XtNcallback, Command, mtaclear);

	mta_cacheadd = WidgetCreate("mtaCacheadd",
				    commandWidgetClass,
				    mta_commands,
				    NULL);
	if (normalFont != NULL)
		XtSetValues(mta_cacheadd,argList, 1);

	XtAddCallback(mta_cacheadd, XtNcallback, Command, mtacacheadd);

	mta_force = WidgetCreate("mtaForce",
				 commandWidgetClass,
				 mta_commands,
				 NULL);
	if (normalFont != NULL)
		XtSetValues(mta_force,argList, 1);

	XtAddCallback(mta_force, XtNcallback, Command, mtaforce);

	mta_downforce = WidgetCreate("mtaDownforce",
				     commandWidgetClass,
				     mta_commands,
				     NULL);
	if (normalFont != NULL)
		XtSetValues(mta_downforce,argList, 1);

	XtAddCallback (mta_downforce, XtNcallback, Command, mtadownforce);

	currentmta = NULL;
	read_currentmta = 0;
	curlabel = create_mta_header();
	mta_label = WidgetCreate("mtaLabel",
				 labelWidgetClass,
				 mta_form,
				 XtNlabel, curlabel,
				 NULL);
	free(curlabel);
	if (normalFont != NULL)
		XtSetValues(mta_label,argList, 1);

	temp_form = WidgetCreate("mtaForm2",
				 formWidgetClass,
				 control_vpane,
				 NULL);

	mta_viewport = WidgetCreate("mtaViewport",
				    viewportWidgetClass,
				    temp_form,
				    NULL);
	mtas = WidgetCreate("mtas",
			    formWidgetClass,
			    mta_viewport,
			    XtNdefaultDistance, (2*max_mta_border+1),
			    NULL);
	mta_info_strlen = BUFSIZ;
	mta_info_str = calloc(1, (unsigned) mta_info_strlen);
	mta_all = WidgetCreate("mtaAll",
			       asciiStringWidgetClass,
			       temp_form,
#ifdef R4
			       XtNuseStringInPlace,	True,
#endif
			       XtNlength,	mta_info_strlen,
			       XtNstring,	mta_info_str,
			       XtNtextOptions,	scrollVertical,
			       NULL);
	XtSetMappedWhenManaged(mta_all,False);
}

Widget		msg_divider,
		msg_commands,
		msg_stop,
		msg_start,
		msg_clear,
		msg_cacheadd,
		msg_force,
		msg_label,
		msg_info,
		msg_all,
		msgs_showall,
		msg_viewport,
		msgs;

extern struct msg_struct	*currentmsg;
extern char			*create_msg_header();
extern void			MsgsShowAll();
char				*msg_info_str;
int				msg_info_strlen;

static void create_msgwidgets()
{
	Widget	temp_form;

	msg_form = WidgetCreate("msgForm",
				formWidgetClass,
				control_vpane,
				NULL);

	msg_divider = WidgetCreate("msgDivider",
				   labelWidgetClass,
				   msg_form,
				   NULL);
	if (normalFont != NULL)
		XtSetValues(msg_divider,argList, 1);

	msg_commands = WidgetCreate("msgCommands",
				    boxWidgetClass,
				    msg_form,
				    NULL);
	XtSetSensitive(msg_commands, FALSE);

	msg_info = WidgetCreate("msgInfo",
				commandWidgetClass,
				msg_commands,
				XtNlabel,	"info",
				NULL);
	if (normalFont != NULL)
		XtSetValues(msg_info,argList, 1);
	XtAddCallback(msg_info, XtNcallback, Command, msginfo);
		
	msgs_showall = WidgetCreate("msgShowall",
				    commandWidgetClass,
				    msg_commands,
				    NULL);
	if (normalFont != NULL)
		XtSetValues(msgs_showall,argList, 1);
	XtAddCallback(msgs_showall, XtNcallback, MsgsShowAll, NULL);
	XtSetMappedWhenManaged(msgs_showall, False);

	msg_stop = WidgetCreate("msgStop",
				commandWidgetClass,
				msg_commands,
				XtNlabel, "freeze",
				NULL);
	if (normalFont != NULL)
		XtSetValues(msg_stop,argList, 1);
	XtAddCallback(msg_stop, XtNcallback, Command, msgstop);

	msg_start = WidgetCreate("msgStart",
				 commandWidgetClass,
				 msg_commands,
				 XtNlabel,	"thaw",
				 NULL);
	if (normalFont != NULL)
		XtSetValues(msg_start,argList, 1);
	XtAddCallback(msg_start, XtNcallback, Command, msgstart);

	msg_clear = WidgetCreate("msgClear",
				 commandWidgetClass,
				 msg_commands,
				 NULL);
	if (normalFont != NULL)
		XtSetValues(msg_clear,argList, 1);
	XtAddCallback(msg_clear, XtNcallback, Command, msgclear);

	msg_cacheadd = WidgetCreate("msgCacheadd",
				    commandWidgetClass,
				    msg_commands,
				    NULL);
	if (normalFont != NULL)
		XtSetValues(msg_cacheadd,argList, 1);

	XtAddCallback(msg_cacheadd, XtNcallback, Command, msgcacheadd);

	msg_force = WidgetCreate("msgForce",
				 commandWidgetClass,
				 msg_commands,
				 NULL);
	if (normalFont != NULL)
		XtSetValues(msg_force,argList, 1);

	XtAddCallback(msg_force, XtNcallback, Command, msgforce);

	currentmsg = NULL;
	curlabel = create_msg_header();
	msg_label = WidgetCreate("msgLabel",
				 labelWidgetClass,
				 msg_form,
				 XtNlabel, curlabel,
				 NULL);
	free(curlabel);
	if (normalFont != NULL)
		XtSetValues(msg_label,argList, 1);
	temp_form = WidgetCreate("msgForm2",
				 formWidgetClass,
				 control_vpane,
				 NULL);

	msg_viewport = WidgetCreate("msgViewport",
				    viewportWidgetClass,
				    temp_form,
				    NULL);
	msgs = WidgetCreate("msgs",
			    formWidgetClass,
			    msg_viewport,
			    NULL);

	msg_info_strlen = BUFSIZ;
	msg_info_str = calloc(1, (unsigned) msg_info_strlen);
	msg_all = WidgetCreate("msgAll",
			       asciiStringWidgetClass,
			       temp_form,
#ifdef R4
			       XtNuseStringInPlace,	True,
#endif
			       XtNlength,	msg_info_strlen,
			       XtNstring,	msg_info_str,
			       XtNtextOptions,	scrollVertical | scrollHorizontal,
			       NULL);
	strlen_msgall = 0;
	XtSetMappedWhenManaged(msg_all,False);
}

display_channelinfo_string(str)
char	*str;
{
	Arg	args[2];
	XtTextSource	old, new;
	char		*oldstr = channel_info_str;
	channel_info_strlen = strlen(str);
	channel_info_str = strdup(str);
	
	XtSetArg(args[0], XtNstring, channel_info_str);
	XtSetArg(args[1], XtNlength, channel_info_strlen);
	new = XtStringSourceCreate(channel_all,
				   args,
				   2);
	old = XtTextGetSource(channel_all);
	XtTextSetSource(channel_all, new, (XtTextPosition) 0);
	XtStringSourceDestroy(old);
	free(oldstr);
}

display_mtainfo_string(str)
char	*str;
{
	Arg	args[2];
	XtTextSource	old, new;
	char		*oldstr = mta_info_str;
	mta_info_strlen = strlen(str);
	mta_info_str = strdup(str);
	
	XtSetArg(args[0], XtNstring, mta_info_str);
	XtSetArg(args[1], XtNlength, mta_info_strlen);
	new = XtStringSourceCreate(mta_all,
				   args,
				   2);
	old = XtTextGetSource(mta_all);
	XtTextSetSource(mta_all, new, (XtTextPosition) 0);
	XtStringSourceDestroy(old);
	free(oldstr);
}

display_msginfo_string(str)
char	*str;
{
	Arg	args[2];
	XtTextSource	old, new;
	char		*oldstr = msg_info_str;
	msg_info_strlen = strlen(str);
	msg_info_str = strdup(str);
	
	XtSetArg(args[0], XtNstring, msg_info_str);
	XtSetArg(args[1], XtNlength, msg_info_strlen);
	new = XtStringSourceCreate(msg_all,
				   args,
				   2);
	old = XtTextGetSource(msg_all);
	XtTextSetSource(msg_all, new, (XtTextPosition) 0);
	XtStringSourceDestroy(old);
	free(oldstr);
}

Widget	monitor_form;

static void create_monitorwidgets()
{
	Dimension	wid,
			ht;
	WidgetGet(control_form,
		  XtNwidth, 	&wid,
		  XtNheight,	&ht,
		  NULL);

	monitor_viewport = WidgetCreate("monitorViewport",
					viewportWidgetClass,
					switchform,
					XtNwidth,	wid, /*TOTAL_WIDTH,*/
					XtNheight,	ht,  /* (2*VP_HEIGHT+4*26),*/
					XtNmanaged,	FALSE,
					NULL);

	monitor_form = WidgetCreate("monitorForm",
				    formWidgetClass,
				    monitor_viewport,
				    XtNwidth,	wid,
				    XtNheight,	ht,
				    NULL);
	XtManageChild(monitor_viewport);
	XtSetMappedWhenManaged(monitor_viewport, True);
	XtSetMappedWhenManaged(control_form, False);
}

/* \f

 */
/* popups */

Popup_menu 	*yesno,
		*one,
		*two,
		*three,
		*config,
		*connectpopup,
		*qcontrol;
Widget	qversion,
	refresh_toggle,
	reconnect_toggle,
	backoff_toggle,
	confirm_toggle,
	heur_toggle,
	percent_form,
	line_form,
	auth_toggle;

extern void 	previousField(),
		nextField(),
		thisField(),
		myinsert_char(),
		mydelete_char(),
		mymenupopdown(),
		curChan(),
		excl_curChan(),
		readChan(),
		curMta(),
		excl_curMta(),
		readMta(),
		curMsg(),
		excl_curMsg(),
		readMsg(),
		chanMode(),
		chanModeRead(),
		chanRefresh(),
		mtaMode(),
		mtaModeRead(),
		mtaRefresh(),
		QControl(),
		popup_OK(),
		popup_NOTOK(),
		config_OK(),
		connectpopup_OK(),
		configToggle(),
		heurToggle();
extern int	autoRefresh,
		autoReconnect,
		backoff,
		confirm,
		auth;
int		newautoRefresh,
		newautoReconnect,
		newbackoff,
		newconfirm,
		newauth;
Heuristic	newheur;
extern Heuristic heuristic;
unsigned long	newTimes;

XtActionsRec	actionTable[] = {
{"previousField",	previousField},
{"nextField",		nextField},
{"thisField",		thisField},
{"myinsert_char",	myinsert_char},
{"mydelete_char",	mydelete_char},
{"mymenupopdown",	mymenupopdown},
{"curChan",		curChan},
{"excl_curChan",	excl_curChan},
{"readChan",		readChan},
{"curMta",		curMta},
{"excl_curMta",		excl_curMta},
{"readMta",		readMta},
{"curMsg",		curMsg},
{"excl_curMsg",		excl_curMsg},
{"readMsg",		readMsg},
{"chanMode",		chanMode},
{"chanModeRead",	chanModeRead},
{"chanRefresh",		chanRefresh},
{"mtaMode",		mtaMode},
{"mtaModeRead",		mtaModeRead},
{"mtaRefresh",		mtaRefresh},
};

XtTranslations	channel_monitorTranslations,
		mta_monitorTranslations,
		passwdTranslations;

/*static char	*channel_translationTable =
	"<Btn1Up>:	curChan() readChan()\n\
	<Btn2Up>:	excl_curChan()\n\
	<Btn3Up>:	readChan()\n";*/
static char	*channel_monitortranslationTable =
	"<Btn1Up>:	chanModeRead()\n\
	<Btn2Up>:	chanMode()\n\
	<Btn3Up>:	chanRefresh()\n";
/*static char	*mta_translationTable =
	"<Btn1Up>:	curMta() readMta()\n\
	<Btn2Up>:	excl_curMta()\n\
	<Btn3Up>:	readMta()\n";*/
static char	*mta_monitortranslationTable =
	"<Btn1Up>:	mtaModeRead()\n\
	<Btn2Up>:	mtaMode()\n\
	<Btn3Up>:	mtaRefresh()\n";
/*static char	*msg_translationTable =
	"<Btn1Up>:	curMsg() readMsg()\n\
	<Btn2Up>:	excl_curMsg()\n\
	<Btn3Up>:	readMsg()\n";*/
/*static char	*text_translationTable =
	"<Key>Up:	previousField()\n\
	<Key>Down:	nextField()\n\
	<Key>Tab:	nextField()\n\
	<Btn1Down>:	thisField() select-start()\n";*/
static char	*passwd_translationTable =
	"<Key>Up:	previousField()\n\
	<Key>Down:	nextField()\n\
	<Key>Tab:	nextField()\n\
	<Btn1Down>:	thisField()\n\
	<Key>Delete:	mydelete_char()\n\
	<Key>BackSpace: mydelete_char()\n\
	<Key>:		myinsert_char()\n";
/*static char	*qcontrol_translationTable =
	"<BtnUp>:	mymenupopdown()\n\
	<Leave>:	mymenupopdown()\n";*/

/*static char	*OKAcceleratorTable = 
	"#override\n\
<Key>Return:	set() notify()";*/

static XtCallbackRec config_OK_callbacks[] = {
{config_OK,	NULL},
{NULL,		NULL},
};

static Arg config_OK_args[] = {
{XtNfromVert,	NULL},
{XtNfromHoriz,	NULL},
{XtNcallback,	(XtArgVal) config_OK_callbacks},
};

static XtCallbackRec connectpopup_OK_callbacks[] = {
{connectpopup_OK,	NULL},
{NULL,		NULL},
};

static Arg connectpopup_OK_args[] = {
{XtNfromVert,	NULL},
{XtNfromHoriz,	NULL},
{XtNcallback,	(XtArgVal) connectpopup_OK_callbacks},
};

static void create_defaultHostspopup()
{
}

static void create_popupwidgets(context)
XtAppContext	context;
{
	Widget	OKwg,
	NOTOKwg,
	label,
	version;
	Arg	arg[2];
	int	i;
	char	*str = NULL;
	XtAppAddActions(context, actionTable, XtNumber(actionTable));
	passwdTranslations = XtParseTranslationTable(passwd_translationTable);
	channel_monitorTranslations = XtParseTranslationTable(channel_monitortranslationTable);
	mta_monitorTranslations = XtParseTranslationTable(mta_monitortranslationTable);
	create_defaultHostspopup();

	XtSetArg(arg[0], XtNallowShellResize, True);
	XtSetArg(arg[1], XtNinput, True);

	qcontrol = (Popup_menu *) calloc(1, sizeof(*qcontrol));
	qcontrol->popup = XtCreatePopupShell("qcontrol",
					     overrideShellWidgetClass,
					     qcontrol_command,
					     arg,
					     2);
	qcontrol->form = WidgetCreate("qcontrolForm",
				      boxWidgetClass,
				      qcontrol->popup,
				      NULL);

	label = WidgetCreate("increaseMaxChannels",
			     commandWidgetClass,
			     qcontrol->form,
			     NULL);
	XtAddCallback(label, XtNcallback, 
		      QControl, int_Qmgr_QMGROp_increasemaxchans);
	if (normalFont != NULL)
		XtSetValues(label,argList, 1);
	label = WidgetCreate("decreaseMaxChannels",
			     commandWidgetClass,
			     qcontrol->form,
			     NULL);
	XtAddCallback(label, XtNcallback, 
		      QControl, int_Qmgr_QMGROp_decreasemaxchans);
	if (normalFont != NULL)
		XtSetValues(label,argList, 1);
	
	label = WidgetCreate("enableSubmission",
			     commandWidgetClass,
			     qcontrol->form,
			     NULL);
	XtAddCallback(label, XtNcallback, 
		      QControl, int_Qmgr_QMGROp_enableSubmission);
	if (normalFont != NULL)
		XtSetValues(label,argList, 1);
	
	label = WidgetCreate("disableSubmission",
			     commandWidgetClass,
			     qcontrol->form,
			     NULL);
	XtAddCallback(label, XtNcallback, 
		      QControl, int_Qmgr_QMGROp_disableSubmission);
	if (normalFont != NULL)
		XtSetValues(label,argList, 1);
	
	label = WidgetCreate("enableAll",
			     commandWidgetClass,
			     qcontrol->form,
			     NULL);
	XtAddCallback(label, XtNcallback, 
		      QControl, int_Qmgr_QMGROp_enableAll);
	if (normalFont != NULL)
		XtSetValues(label,argList, 1);
	
	label = WidgetCreate("disableAll",
			     commandWidgetClass,
			     qcontrol->form,
			     NULL);
	XtAddCallback(label, XtNcallback, 
		      QControl, int_Qmgr_QMGROp_disableAll);
	if (normalFont != NULL)
		XtSetValues(label,argList, 1);
		
	label = WidgetCreate("rereadQ",
			     commandWidgetClass,
			     qcontrol->form,
			     NULL);
	XtAddCallback(label, XtNcallback, 
		      QControl, int_Qmgr_QMGROp_rereadQueue);
	if (normalFont != NULL)
		XtSetValues(label,argList, 1);
	
	label = WidgetCreate("restartQmgr",
			     commandWidgetClass,
			     qcontrol->form,
			     NULL);
	XtAddCallback(label, XtNcallback, 
		      QControl, int_Qmgr_QMGROp_restart);
	if (normalFont != NULL)
		XtSetValues(label,argList, 1);
	
	label = WidgetCreate("gracefulStop",
			     commandWidgetClass,
			     qcontrol->form,
			     NULL);
	XtAddCallback(label, XtNcallback, 
		      QControl, int_Qmgr_QMGROp_gracefulTerminate);
	if (normalFont != NULL)
		XtSetValues(label,argList, 1);
	
	label = WidgetCreate("emergencyStop",
			     commandWidgetClass,
			     qcontrol->form,
			     NULL);
	XtAddCallback(label, XtNcallback, 
		      QControl, int_Qmgr_QMGROp_abort);
	if (normalFont != NULL)
		XtSetValues(label,argList, 1);
	
	yesno = (Popup_menu *) calloc(1, sizeof(*yesno));

	yesno->popup = XtCreatePopupShell("yesno_popup",
					  overrideShellWidgetClass,
					  quit_command,
					  arg,
					  2);

	yesno->form = WidgetCreate("yesnoForm",
				   formWidgetClass,
				   yesno->popup,
				   NULL);

	OKwg = WidgetCreate("yesnoOK",
			    commandWidgetClass,
			    yesno->form,
			    NULL);
	if (normalFont != NULL)
		XtSetValues(OKwg,argList, 1);
	yesno->op = unknown;
	XtAddCallback(OKwg, XtNcallback, popup_OK, &(yesno->op));

	NOTOKwg = WidgetCreate("yesnoNotok",
			       commandWidgetClass,
			       yesno->form,
			       NULL);
	if (normalFont != NULL)
		XtSetValues(NOTOKwg,argList, 1);
	XtAddCallback(NOTOKwg, XtNcallback, popup_NOTOK, &(yesno->op));
	XtInstallAllAccelerators(yesno->form, yesno->form);

	one = (Popup_menu *) calloc(1, sizeof(*one));
	one->tuple = (Popup_tuple *) calloc(1, sizeof(Popup_tuple));
	one->numberOftuples = 1;
	one->popup = XtCreatePopupShell("onetext_popup",
					overrideShellWidgetClass,
					quit_command,
					arg,
					2);

	one->form = WidgetCreate("oneForm",
				 formWidgetClass,
				 one->popup,
				 NULL);

	OKwg = WidgetCreate("oneOk",
			    commandWidgetClass,
			    one->form,
			    NULL);
	one->op = unknown;
	if (normalFont != NULL)
		XtSetValues(OKwg,argList, 1);
	XtAddCallback(OKwg, XtNcallback, popup_OK, &(one->op));

	NOTOKwg = WidgetCreate("oneNotok",
			       commandWidgetClass,
			       one->form,
			       NULL);
	if (normalFont != NULL)
		XtSetValues(NOTOKwg,argList, 1);
	XtAddCallback(NOTOKwg, XtNcallback, popup_NOTOK, &(one->op));

	one->tuple[0].label = WidgetCreate("oneLabelOne",
					   labelWidgetClass,
					   one->form,
					   XtNlabel, "clear cache on channel ",
					   NULL);
	if (normalFont != NULL)
		XtSetValues(one->tuple[0].label,argList, 1);

	one->tuple[0].str = malloc(MAX_EDIT_STRING+1);
	if (normalFont != NULL)
	one->tuple[0].text = WidgetCreate("oneTextOne",
					  asciiStringWidgetClass,
					  one->form,
#ifdef R4
					  XtNuseStringInPlace,	True,
#endif
					  XtNstring, one->tuple[0].str,
					  XtNtextOptions, (resizeWidth | scrollOnOverflow),
					  XtNlength, MAX_EDIT_STRING,
					  XtNfont,	normalFont,
					  NULL);
	else
	one->tuple[0].text = WidgetCreate("oneTextOne",
					  asciiStringWidgetClass,
					  one->form,
#ifdef R4
					  XtNuseStringInPlace,	True,
#endif
					  XtNstring, one->tuple[0].str,
					  XtNtextOptions, (resizeWidth | scrollOnOverflow),
					  XtNlength, MAX_EDIT_STRING,
					  NULL);

	XtInstallAllAccelerators(one->tuple[0].text, one->form);

	two = (Popup_menu *) calloc(1, sizeof(*two));
	two->tuple = (Popup_tuple *) calloc(2, sizeof(Popup_tuple));
	two->numberOftuples = 2;
	two->popup = XtCreatePopupShell("twotext_popup",
					overrideShellWidgetClass,
					quit_command,
					arg,
					2);
	two->form  = WidgetCreate("twoForm",
				  formWidgetClass,
				  two->popup,
				  NULL);
	OKwg = WidgetCreate("twoOk",
			    commandWidgetClass,
			    two->form,
			    NULL);
	if (normalFont != NULL)
		XtSetValues(OKwg,argList, 1);
	two->op = unknown;
	XtAddCallback(OKwg, XtNcallback, popup_OK, &(two->op));

	NOTOKwg = WidgetCreate("twoNotok",
			       commandWidgetClass,
			       two->form,
			       NULL);
	if (normalFont != NULL)
		XtSetValues(NOTOKwg,argList, 1);

	XtAddCallback(NOTOKwg, XtNcallback, popup_NOTOK, &(two->op));

	two->tuple[0].label = WidgetCreate("twoLabelOne",
					   labelWidgetClass,
					   two->form,
					   XtNlabel, "clear cache on channel",
					   NULL);
	if (normalFont != NULL)
		XtSetValues(two->tuple[0].label,argList, 1);

	two->tuple[0].str = malloc(MAX_EDIT_STRING+1);
	if (normalFont != NULL)
	two->tuple[0].text = WidgetCreate("twoTextOne",
					  asciiStringWidgetClass,
					  two->form,
#ifdef R4
					  XtNuseStringInPlace,	True,
#endif
					  XtNstring, two->tuple[0].str,
					  XtNtextOptions, (resizeWidth | scrollOnOverflow),
					  XtNlength, MAX_EDIT_STRING,
					  XtNfont,	normalFont,
					  NULL);
	else
	two->tuple[0].text = WidgetCreate("twoTextOne",
					  asciiStringWidgetClass,
					  two->form,
#ifdef R4
					  XtNuseStringInPlace,	True,
#endif
					  XtNstring, two->tuple[0].str,
					  XtNtextOptions, (resizeWidth | scrollOnOverflow),
					  XtNlength, MAX_EDIT_STRING,
					  NULL);

	two->tuple[1].label = WidgetCreate("twoLabelTwo",
					   labelWidgetClass,
					   two->form,
					   XtNlabel, "clear cache on channel",
					   NULL);
	if (normalFont != NULL)
		XtSetValues(two->tuple[1].label,argList, 1);

	two->tuple[1].str = malloc(MAX_EDIT_STRING+1);
	if (normalFont != NULL)
	two->tuple[1].text = WidgetCreate("twoTextTwo",
					  asciiStringWidgetClass,
					  two->form,
#ifdef R4
					  XtNuseStringInPlace,	True,
#endif
					  XtNstring, two->tuple[1].str,
					  XtNtextOptions, (resizeWidth | scrollOnOverflow),
					  XtNlength, MAX_EDIT_STRING,
					  XtNfont,		normalFont,
					  NULL);
	else
	two->tuple[1].text = WidgetCreate("twoTextTwo",
					  asciiStringWidgetClass,
					  two->form,
#ifdef R4
					  XtNuseStringInPlace,	True,
#endif
					  XtNstring, two->tuple[1].str,
					  XtNtextOptions, (resizeWidth | scrollOnOverflow),
					  XtNlength, MAX_EDIT_STRING,
					  NULL);

	XtInstallAllAccelerators(two->tuple[0].text, two->form);
	XtInstallAllAccelerators(two->tuple[1].text, two->form);
	
	three = (Popup_menu *) calloc(1, sizeof(*three));
	three->op = unknown;
	three->tuple = (Popup_tuple *) calloc(3, sizeof(Popup_tuple));
	three->numberOftuples = 3;
	three->popup = XtCreatePopupShell("threetext_popup",
					  overrideShellWidgetClass,
					  quit_command,
					  arg,
					  2);
	three->form  = WidgetCreate("threeForm",
				    formWidgetClass,
				    three->popup,
				    XtNborderWidth,	0,
				    NULL);
	OKwg = WidgetCreate("threeOk",
			    commandWidgetClass,
			    three->form,
			    NULL);
	if (normalFont != NULL)
		XtSetValues(OKwg,argList, 1);
	XtAddCallback(OKwg, XtNcallback, popup_OK, &(three->op));

	NOTOKwg = WidgetCreate("threeNotok",
			       commandWidgetClass,
			       three->form,
			       NULL);
	if (normalFont != NULL)
		XtSetValues(NOTOKwg,argList, 1);
	XtAddCallback(NOTOKwg, XtNcallback, popup_NOTOK, &(three->op));

	three->tuple[0].label = WidgetCreate("threeLabelOne",
					     labelWidgetClass,
					     three->form,
					     XtNlabel, "clear cache on channel",
					     NULL);

	if (normalFont != NULL)
		XtSetValues(three->tuple[0].label,argList, 1);
	three->tuple[0].str = malloc(MAX_EDIT_STRING+1);
	if (normalFont != NULL)
	three->tuple[0].text = WidgetCreate("threeTextOne",
					    asciiStringWidgetClass,
					    three->form,
#ifdef R4
					    XtNuseStringInPlace,	True,
#endif
					    XtNstring, three->tuple[0].str,
					    XtNtextOptions, (resizeWidth | scrollOnOverflow),
					    XtNlength, MAX_EDIT_STRING,
					    NULL);
	else
	three->tuple[0].text = WidgetCreate("threeTextOne",
					    asciiStringWidgetClass,
					    three->form,
#ifdef R4
					    XtNuseStringInPlace,	True,
#endif
					    XtNstring, three->tuple[0].str,
					    XtNtextOptions, (resizeWidth | scrollOnOverflow),
					    XtNfont,		normalFont,
					    XtNlength, MAX_EDIT_STRING,
					    NULL);

	three->tuple[1].label = WidgetCreate("threeLabelTwo",
					     labelWidgetClass,
					     three->form,
					     XtNlabel, "clear cache on channel",
					     NULL);
	if (normalFont != NULL)
		XtSetValues(three->tuple[1].label,argList, 1);

	three->tuple[1].str = malloc(MAX_EDIT_STRING+1);
	if (normalFont == NULL)
	three->tuple[1].text = WidgetCreate("threeTextTwo",
					    asciiStringWidgetClass,
					    three->form,
#ifdef R4
					    XtNuseStringInPlace,	True,
#endif
					    XtNstring, three->tuple[1].str,
					    XtNtextOptions, (resizeWidth | scrollOnOverflow),
					    XtNlength, MAX_EDIT_STRING,
					    NULL);
	else
	three->tuple[1].text = WidgetCreate("threeTextTwo",
					    asciiStringWidgetClass,
					    three->form,
#ifdef R4
					    XtNuseStringInPlace,	True,
#endif
					    XtNstring, three->tuple[1].str,
					    XtNtextOptions, (resizeWidth | scrollOnOverflow),
					    XtNfont,		normalFont,
					    XtNlength, MAX_EDIT_STRING,
					    NULL);

	three->tuple[2].label = WidgetCreate("threeLabelThree",
					     labelWidgetClass,
					     three->form,
					     XtNlabel, "clear cache on channel",
					     NULL);
	if (normalFont != NULL)
		XtSetValues(three->tuple[2].label,argList, 1);
	three->tuple[2].str = malloc(MAX_EDIT_STRING+1);
	if (normalFont == NULL)
	three->tuple[2].text = WidgetCreate("threeTextThree",
					    asciiStringWidgetClass,
					    three->form,
#ifdef R4
					    XtNuseStringInPlace,	True,
#endif
					    XtNstring, three->tuple[2].str,
					    XtNtextOptions, (resizeWidth | scrollOnOverflow),
					    XtNlength, MAX_EDIT_STRING,
					    NULL);
	else
	three->tuple[2].text = WidgetCreate("threeTextThree",
					    asciiStringWidgetClass,
					    three->form,
#ifdef R4
					    XtNuseStringInPlace,	True,
#endif
					    XtNstring, three->tuple[2].str,
					    XtNtextOptions, (resizeWidth | scrollOnOverflow),
					    XtNlength, MAX_EDIT_STRING,
					    XtNfont,		normalFont,
					    NULL);

	XtInstallAllAccelerators(three->tuple[0].text, three->form);
	XtInstallAllAccelerators(three->tuple[1].text, three->form);
	XtInstallAllAccelerators(three->tuple[2].text, three->form);

	config = (Popup_menu *) calloc(1, sizeof(*config));
	config->op = unknown;
	config->numberOftuples = 8;
	config->tuple = (Popup_tuple *) calloc((unsigned)config->numberOftuples,
					       sizeof(Popup_tuple));

	config->popup = XtCreatePopupShell("config_popup",
					   overrideShellWidgetClass,
					   config_command,
					   arg,
					   2);
	config->form = WidgetCreate("configForm",
				    formWidgetClass,
				    config->popup,
				    NULL);

	OKwg = WidgetCreate("configOk",
			    commandWidgetClass,
			    config->form,
			    NULL);
	XtAddCallback(OKwg, XtNcallback, config_OK, NULL);
	if (normalFont != NULL)
		XtSetValues(OKwg,argList, 1);

	NOTOKwg = WidgetCreate("configNotok",
			       commandWidgetClass,
			       config->form,
			       NULL);
	XtAddCallback(NOTOKwg, XtNcallback, popup_NOTOK, &(config->op));
	if (normalFont != NULL)
		XtSetValues(NOTOKwg,argList, 1);

	label = WidgetCreate("versionLabel",
			     labelWidgetClass,
			     config->form,
			     NULL);
	if (normalFont != NULL)
		XtSetValues(label,argList, 1);
	
	version = WidgetCreate("configVersion",
			       labelWidgetClass,
			       config->form,
			       XtNlabel, ppversion,
			       NULL);
	if (normalFont != NULL)
		XtSetValues(version,argList, 1);
	
	label = WidgetCreate("qmgrVersionLabel",
			     labelWidgetClass,
			     config->form,
			     NULL);
	if (normalFont != NULL)
		XtSetValues(label,argList, 1);
	qversion = WidgetCreate("qmgrVersion",
			       labelWidgetClass,
			       config->form,
			       NULL);
	if (normalFont != NULL)
		XtSetValues(qversion,argList, 1);
			       
	label = WidgetCreate("autoRefreshLabel",
			     labelWidgetClass,
			     config->form,
			     NULL);
	if (normalFont != NULL)
		XtSetValues(label,argList, 1);
	
	refresh_toggle = WidgetCreate("autoRefreshToggle",
				      commandWidgetClass,
				      config->form,
				      XtNlabel, (autoRefresh == TRUE) ? "enabled" : "disabled",
				      NULL);
	if (normalFont != NULL)
		XtSetValues(refresh_toggle,argList, 1);

	XtAddCallback(refresh_toggle, XtNcallback, configToggle, &newautoRefresh);
				      
	config->tuple[REFRESH].label = WidgetCreate("refreshIntervalLabel",
						    labelWidgetClass,
						    config->form,
						    NULL);
	if (normalFont != NULL)
		XtSetValues(config->tuple[REFRESH].label,argList, 1);

	config->tuple[REFRESH].str = malloc(MAX_EDIT_STRING+1);
	if (normalFont == NULL)
	config->tuple[REFRESH].text = WidgetCreate("refreshIntervalText",
						   asciiStringWidgetClass,
						   config->form,
#ifdef R4
						   XtNuseStringInPlace,	True,
#endif
						   XtNstring, config->tuple[REFRESH].str,
						   XtNtextOptions, (resizeWidth | scrollOnOverflow),
						   XtNlength, MAX_EDIT_STRING,
						   NULL);
	else
	config->tuple[REFRESH].text = WidgetCreate("refreshIntervalText",
						   asciiStringWidgetClass,
						   config->form,
#ifdef R4
						   XtNuseStringInPlace,	True,
#endif
						   XtNstring, config->tuple[REFRESH].str,
						   XtNtextOptions, (resizeWidth | scrollOnOverflow),
						   XtNlength, MAX_EDIT_STRING,
						   XtNfont,		normalFont,
						   NULL);

	config->tuple[INACTIVE].label = WidgetCreate("inactiveLabel",
						     labelWidgetClass,
						     config->form,
						     NULL);
	if (normalFont != NULL)
		XtSetValues(config->tuple[INACTIVE].label,argList, 1);

	config->tuple[INACTIVE].str = malloc(MAX_EDIT_STRING+1);

	if (normalFont == NULL)
	config->tuple[INACTIVE].text = WidgetCreate("inactiveText",
						    asciiStringWidgetClass,
						    config->form,
#ifdef R4
						    XtNuseStringInPlace,	True,
#endif
						    XtNstring, config->tuple[INACTIVE].str,
						    XtNtextOptions, (resizeWidth | scrollOnOverflow),
						    XtNlength, MAX_EDIT_STRING,
						    NULL);
	else
	config->tuple[INACTIVE].text = WidgetCreate("inactiveText",
						    asciiStringWidgetClass,
						    config->form,
#ifdef R4
						    XtNuseStringInPlace,	True,
#endif
						    XtNstring, config->tuple[INACTIVE].str,
						    XtNtextOptions, (resizeWidth | scrollOnOverflow),
						    XtNlength, MAX_EDIT_STRING,
						    XtNfont,		normalFont,
						    NULL);

	label = WidgetCreate("autoReconnectLabel",
			     labelWidgetClass,
			     config->form,
			     NULL);
	if (normalFont != NULL)
		XtSetValues(label,argList, 1);
	
	reconnect_toggle = WidgetCreate("autoReconnectToggle",
					commandWidgetClass,
					config->form,
					XtNlabel, (autoReconnect == TRUE) ? "enabled" : "disabled",
					NULL);
	if (normalFont != NULL)
		XtSetValues(reconnect_toggle,argList, 1);
	XtAddCallback(reconnect_toggle, XtNcallback, configToggle, &newautoReconnect);

	config->tuple[START].label = WidgetCreate("arStartLabel",
						  labelWidgetClass,
						  config->form,
						  NULL);
	if (normalFont != NULL)
		XtSetValues(config->tuple[START].label,argList, 1);
	config->tuple[START].str = malloc(MAX_EDIT_STRING+1);

	if (normalFont == NULL)
	config->tuple[START].text = WidgetCreate("arStartText",
						 asciiStringWidgetClass,
						 config->form,
#ifdef R4
						 XtNuseStringInPlace,	True,
#endif
						 XtNstring, config->tuple[START].str,
						 XtNtextOptions, (resizeWidth | scrollOnOverflow),
						 XtNlength, MAX_EDIT_STRING,
						 NULL);
	else
	config->tuple[START].text = WidgetCreate("arStartText",
						 asciiStringWidgetClass,
						 config->form,
#ifdef R4
						 XtNuseStringInPlace,	True,
#endif
						 XtNstring, config->tuple[START].str,
						 XtNtextOptions, (resizeWidth | scrollOnOverflow),
						 XtNlength, MAX_EDIT_STRING,
						 XtNfont,		normalFont,
						 NULL);

	label = WidgetCreate("backOffLabel",
			     labelWidgetClass,
			     config->form,
			     NULL);
	if (normalFont != NULL)
		XtSetValues(label,argList, 1);

	backoff_toggle = WidgetCreate("backOffToggle",
				      commandWidgetClass,
				      config->form,
				      XtNlabel, (backoff == TRUE) ? "enabled" : "disabled",
				      NULL);
	if (normalFont != NULL)
		XtSetValues(backoff_toggle,argList, 1);

	XtAddCallback(backoff_toggle, XtNcallback, configToggle, &newbackoff);

	config->tuple[BACKOFF].label = WidgetCreate("boIncLabel",
						    labelWidgetClass,
						    config->form,
						    NULL);
	if (normalFont != NULL)
		XtSetValues(config->tuple[BACKOFF].label,argList, 1);

	config->tuple[BACKOFF].str = malloc(MAX_EDIT_STRING+1);

	if (normalFont == NULL)
	config->tuple[BACKOFF].text = WidgetCreate("boIncText",
						   asciiStringWidgetClass,
						   config->form,
#ifdef R4
						   XtNuseStringInPlace,	True,
#endif
						   XtNstring, config->tuple[BACKOFF].str,
						   XtNtextOptions, (resizeWidth | scrollOnOverflow),
						   XtNlength, MAX_EDIT_STRING,
						   NULL);
	else
	config->tuple[BACKOFF].text = WidgetCreate("boIncText",
						   asciiStringWidgetClass,
						   config->form,
#ifdef R4
						   XtNuseStringInPlace,	True,
#endif
						   XtNstring, config->tuple[BACKOFF].str,
						   XtNtextOptions, (resizeWidth | scrollOnOverflow),
						   XtNlength, MAX_EDIT_STRING,
						   XtNfont,		normalFont,
						   NULL);
				   
	config->tuple[CONNECTMAX].label = WidgetCreate("maxRCIntLabel",
						       labelWidgetClass,
						       config->form,
						       NULL);
	if (normalFont != NULL)
		XtSetValues(config->tuple[CONNECTMAX].label,argList, 1);

	config->tuple[CONNECTMAX].str = malloc(MAX_EDIT_STRING+1);
	if (normalFont == NULL)
	config->tuple[CONNECTMAX].text = WidgetCreate("maxRCIntText",
						      asciiStringWidgetClass,
						      config->form,
#ifdef R4
						      XtNuseStringInPlace,	True,
#endif
						      XtNstring, config->tuple[CONNECTMAX].str,
						      XtNtextOptions, (resizeWidth | scrollOnOverflow),
						      XtNlength, MAX_EDIT_STRING,
						      NULL);
	else
	config->tuple[CONNECTMAX].text = WidgetCreate("maxRCIntText",
						      asciiStringWidgetClass,
						      config->form,
#ifdef R4
						      XtNuseStringInPlace,	True,
#endif
						      XtNstring, config->tuple[CONNECTMAX].str,
						      XtNtextOptions, (resizeWidth | scrollOnOverflow),
						      XtNlength, MAX_EDIT_STRING,
						      XtNfont,		normalFont,
						      NULL);

	label = WidgetCreate("confPopupLabel",
			     labelWidgetClass,
			     config->form,
			     NULL);
	if (normalFont != NULL)
		XtSetValues(label,argList, 1);
	confirm_toggle = WidgetCreate ("confPopupToggle",
				       commandWidgetClass,
				       config->form,
				       XtNlabel, (confirm == TRUE) ? "enabled" : "disabled",
				       NULL);
	if (normalFont != NULL)
		XtSetValues(confirm_toggle,argList, 1);
	XtAddCallback(confirm_toggle, XtNcallback, configToggle, &newconfirm);

	label = WidgetCreate ("heurLabel",
			      labelWidgetClass,
			      config->form,
			      NULL);
	if (normalFont != NULL)
		XtSetValues(label,argList, 1);
	
	switch (heuristic) {
	    case percentage:
		str = PERCENT_BASED;
		break;
	    case all:
		str = ALL_BASED;
		break;
	    default:
		heuristic = line;
	    case line:
		str = LINE_BASED;
		break;
	}
	heur_toggle = WidgetCreate("heurToggle",
				   commandWidgetClass,
				   config->form,
				   XtNlabel, str,
				   NULL);
	newheur = heuristic;
	if (normalFont != NULL)
		XtSetValues(heur_toggle,argList, 1);
	XtAddCallback(heur_toggle, XtNcallback, heurToggle, &newheur);

	percent_form = WidgetCreate("percentForm",
				    formWidgetClass,
				    config->form,
				    NULL);	

	config->tuple[PERCENT].label = WidgetCreate ("percentLabel",
						     labelWidgetClass,
						     percent_form,
						     NULL);
	if (normalFont != NULL)
		XtSetValues(config->tuple[PERCENT].label,argList, 1);
	config->tuple[PERCENT].str = malloc(MAX_EDIT_STRING+1);
	if (normalFont == NULL)
	config->tuple[PERCENT].text = WidgetCreate("percentText",
						   asciiStringWidgetClass,
						   percent_form,
#ifdef R4
						   XtNuseStringInPlace,	True,
#endif
						   XtNstring, config->tuple[PERCENT].str,
						   XtNtextOptions, (resizeWidth | scrollOnOverflow),
						   XtNlength, MAX_EDIT_STRING,
						   NULL);
	else
	config->tuple[PERCENT].text = WidgetCreate("percentText",
						   asciiStringWidgetClass,
						   percent_form,
#ifdef R4
						   XtNuseStringInPlace,	True,
#endif
						   XtNstring, config->tuple[PERCENT].str,
						   XtNtextOptions, (resizeWidth | scrollOnOverflow),
						   XtNlength, MAX_EDIT_STRING,
						   XtNfont,		normalFont,
						   NULL);

	config->tuple[MINBADMTA].label = WidgetCreate ("numBadMtasLabel",
						     labelWidgetClass,
						     percent_form,
						     NULL);
	if (normalFont != NULL)
		XtSetValues(config->tuple[MINBADMTA].label,argList, 1);
	config->tuple[MINBADMTA].str = malloc(MAX_EDIT_STRING+1);
	if (normalFont == NULL)
	config->tuple[MINBADMTA].text = WidgetCreate("numBadMtasText",
						   asciiStringWidgetClass,
						   percent_form,
#ifdef R4
						   XtNuseStringInPlace,	True,
#endif
						   XtNstring, config->tuple[MINBADMTA].str,
						   XtNtextOptions, (resizeWidth | scrollOnOverflow),
						   XtNlength, MAX_EDIT_STRING,
						   NULL);
	else
	config->tuple[MINBADMTA].text = WidgetCreate("numBadMtasText",
						   asciiStringWidgetClass,
						   percent_form,
#ifdef R4
						   XtNuseStringInPlace,	True,
#endif
						   XtNstring, config->tuple[MINBADMTA].str,
						   XtNtextOptions, (resizeWidth | scrollOnOverflow),
						   XtNlength, MAX_EDIT_STRING,
						     XtNfont,		normalFont,
						   NULL);

	line_form = WidgetCreate("lineForm",
				 formWidgetClass,
				 config->form,
				 NULL);
	config->tuple[LINEMAX].label = WidgetCreate ("lineLabel",
						     labelWidgetClass,
						     line_form,
						     NULL);
	if (normalFont != NULL)
		XtSetValues(config->tuple[LINEMAX].label,argList, 1);
	config->tuple[LINEMAX].str = malloc(MAX_EDIT_STRING+1);
	if (normalFont == NULL)
		config->tuple[LINEMAX].text = WidgetCreate("lineText",
						   asciiStringWidgetClass,
						   line_form,
#ifdef R4
						   XtNuseStringInPlace,	True,
#endif
						   XtNstring, config->tuple[LINEMAX].str,
						   XtNtextOptions, (resizeWidth | scrollOnOverflow),
						   XtNlength, MAX_EDIT_STRING,
						   NULL);
	else 		config->tuple[LINEMAX].text = WidgetCreate("lineText",
						   asciiStringWidgetClass,
						   line_form,
#ifdef R4
						   XtNuseStringInPlace,	True,
#endif
						   XtNstring, config->tuple[LINEMAX].str,
						   XtNtextOptions, (resizeWidth | scrollOnOverflow),
						   XtNlength, MAX_EDIT_STRING,
			  XtNfont,		normalFont,
						   NULL);

	switch (heuristic) {
	    case percentage:
		XtSetMappedWhenManaged (line_form, FALSE);
		break;
	    case line:
		XtSetMappedWhenManaged (percent_form, FALSE);
		break;
	    case all:
		XtSetMappedWhenManaged (line_form, FALSE);
		XtSetMappedWhenManaged (percent_form, FALSE);
		break;
	}

	
	for (i = 0; i < config->numberOftuples; i++) {
		XtInstallAllAccelerators(config->tuple[i].text, config->form);
	}

	connectpopup = (Popup_menu *) calloc(1, sizeof(Popup_menu));
	connectpopup->op = connect;
	connectpopup->tuple = (Popup_tuple *) calloc(4, sizeof(Popup_tuple));
	connectpopup->numberOftuples = 4;

	connectpopup->popup = XtCreatePopupShell("connectpopup",
						 overrideShellWidgetClass,
						 connect_command,
						 arg,
						 2);
	connectpopup->form = WidgetCreate("connectForm",
					  formWidgetClass,
					  connectpopup->popup,
					  NULL);
	OKwg = WidgetCreate("connectOk",
			    commandWidgetClass,
			    connectpopup->form,
			    NULL);
	XtAddCallback(OKwg, XtNcallback, connectpopup_OK, NULL);
	if (normalFont != NULL)
		XtSetValues(OKwg,argList, 1);
	NOTOKwg = WidgetCreate("connectNotok",
			       commandWidgetClass,
			       connectpopup->form,
			       NULL);
	if (normalFont != NULL)
		XtSetValues(NOTOKwg,argList, 1);
	XtAddCallback(NOTOKwg, XtNcallback, popup_NOTOK, &(connectpopup->op));

	connectpopup->tuple[0].label = WidgetCreate("connectToLabel",
						    labelWidgetClass,
						    connectpopup->form,
						    NULL);
	if (normalFont != NULL)
		XtSetValues(connectpopup->tuple[0].label,argList, 1);
	connectpopup->tuple[0].str = malloc(MAX_EDIT_STRING+1);
	if (normalFont != NULL) 
	connectpopup->tuple[0].text = WidgetCreate("connectToText",
						   asciiStringWidgetClass,
						   connectpopup->form,
#ifdef R4
						   XtNuseStringInPlace,	True,
#endif
						   XtNstring,		connectpopup->tuple[0].str,
						   XtNtextOptions,	(resizeWidth | scrollOnOverflow),
						   XtNlength,		MAX_EDIT_STRING,
						   XtNfont,		normalFont,
						   NULL);
	else
	connectpopup->tuple[0].text = WidgetCreate("connectToText",
						   asciiStringWidgetClass,
						   connectpopup->form,
#ifdef R4
						   XtNuseStringInPlace,	True,
#endif
						   XtNstring,		connectpopup->tuple[0].str,
						   XtNtextOptions,	(resizeWidth | scrollOnOverflow),
						   XtNlength,		MAX_EDIT_STRING,
						   XtNfont,		normalFont,
						   NULL);
	connectpopup->tuple[1].label = WidgetCreate("taiFileLabel",
						    labelWidgetClass,
						    connectpopup->form,
						    NULL);
	if (normalFont != NULL)
		XtSetValues(connectpopup->tuple[1].label,argList, 1);
	connectpopup->tuple[1].str = malloc(MAX_EDIT_STRING+1);
	if (normalFont == NULL)
		connectpopup->tuple[1].text = WidgetCreate("taiFileText",
						   asciiStringWidgetClass,
						   connectpopup->form,
#ifdef R4
						   XtNuseStringInPlace,	True,
#endif
						   XtNstring,		connectpopup->tuple[1].str,
						   XtNtextOptions,	(resizeWidth | scrollOnOverflow),
						   XtNlength,		MAX_EDIT_STRING,
						   NULL);
	else
		connectpopup->tuple[1].text = WidgetCreate("taiFileText",
						   asciiStringWidgetClass,
						   connectpopup->form,
#ifdef R4
						   XtNuseStringInPlace,	True,
#endif
						   XtNstring,		connectpopup->tuple[1].str,
						   XtNtextOptions,	(resizeWidth | scrollOnOverflow),
						   XtNlength,		MAX_EDIT_STRING,
			  XtNfont,		normalFont,
						   NULL);

	label = WidgetCreate("authLabel",
			     labelWidgetClass,
			     connectpopup->form,
			     NULL);
	if (normalFont != NULL)
		XtSetValues(label,argList, 1);
	auth_toggle = WidgetCreate("authToggle",
				   commandWidgetClass,
				   connectpopup->form,
				   XtNlabel, (auth == TRUE) ? "enabled" : "disabled",
				   NULL);
	if (normalFont != NULL)
		XtSetValues(auth_toggle,argList, 1);
	XtAddCallback(auth_toggle, XtNcallback,	configToggle, &newauth);

	connectpopup->tuple[2].label = WidgetCreate("userLabel",
						    labelWidgetClass,
						    connectpopup->form,
						    NULL);
	if (normalFont != NULL)
		XtSetValues(connectpopup->tuple[2].label,argList, 1);
	connectpopup->tuple[2].str = malloc(MAX_EDIT_STRING+1);
if (normalFont == NULL)
	connectpopup->tuple[2].text = WidgetCreate("userText",
						   asciiStringWidgetClass,
						   connectpopup->form,
#ifdef R4
						   XtNuseStringInPlace,	True,
#endif
						   XtNstring,		connectpopup->tuple[2].str,
						   XtNtextOptions,	(resizeWidth | scrollOnOverflow),
						   XtNlength,		MAX_EDIT_STRING,
						   NULL);
else
	connectpopup->tuple[2].text = WidgetCreate("userText",
						   asciiStringWidgetClass,
						   connectpopup->form,
#ifdef R4
						   XtNuseStringInPlace,	True,
#endif
						   XtNstring,		connectpopup->tuple[2].str,
						   XtNtextOptions,	(resizeWidth | scrollOnOverflow),
						   XtNlength,		MAX_EDIT_STRING,
			  XtNfont,		normalFont,
						   NULL);

	connectpopup->tuple[3].label = WidgetCreate("passwdLabel",
						    labelWidgetClass,
						    connectpopup->form,
						    NULL);
	if (normalFont != NULL)
		XtSetValues(connectpopup->tuple[3].label,argList, 1);
	connectpopup->tuple[3].str = malloc(MAX_EDIT_STRING+1);
if (normalFont == NULL)
	connectpopup->tuple[3].text = WidgetCreate("passwdText",
						   asciiStringWidgetClass,
						   connectpopup->form,
#ifdef R4
						   XtNuseStringInPlace,	True,
#endif
						   XtNstring,		connectpopup->tuple[3].str,
						   XtNtextOptions,	(resizeWidth | scrollOnOverflow),
						   XtNlength,		MAX_EDIT_STRING,
						   NULL);
else
	connectpopup->tuple[3].text = WidgetCreate("passwdText",
						   asciiStringWidgetClass,
						   connectpopup->form,
#ifdef R4
						   XtNuseStringInPlace,	True,
#endif
						   XtNstring,		connectpopup->tuple[3].str,
						   XtNtextOptions,	(resizeWidth | scrollOnOverflow),
						   XtNlength,		MAX_EDIT_STRING,
			  XtNfont,		normalFont,
						   NULL);
	XtOverrideTranslations(connectpopup->tuple[3].text, passwdTranslations);
	XtInstallAllAccelerators(connectpopup->tuple[0].text, 
				 connectpopup->form);
	XtInstallAllAccelerators(connectpopup->tuple[1].text, 
				 connectpopup->form);
	XtInstallAllAccelerators(connectpopup->tuple[2].text, 
				 connectpopup->form);
	XtInstallAllAccelerators(connectpopup->tuple[3].text, 
				 connectpopup->form);
}

MapVolume(bool)
int	bool;
{
	XtSetMappedWhenManaged(total_volume_label, bool);
	XtSetMappedWhenManaged(total_number_label, bool);
}

MapButtons(bool)
int	bool;
{
	/* various buttons that need auth */
	XtSetMappedWhenManaged(qcontrol_command, bool);

	XtSetMappedWhenManaged(channel_stop, bool);
	XtSetMappedWhenManaged(channel_start, bool);
	XtSetMappedWhenManaged(channel_cacheadd, bool);
	XtSetMappedWhenManaged(channel_downforce, bool);
	XtSetMappedWhenManaged(channel_clear, bool);

	XtSetMappedWhenManaged(mta_stop, bool);
	XtSetMappedWhenManaged(mta_start, bool);
	XtSetMappedWhenManaged(mta_cacheadd, bool);
	XtSetMappedWhenManaged(mta_force, bool);
	XtSetMappedWhenManaged(mta_downforce, bool);
	XtSetMappedWhenManaged(mta_clear, bool);

	XtSetMappedWhenManaged(msg_stop, bool);
	XtSetMappedWhenManaged(msg_start, bool);
	XtSetMappedWhenManaged(msg_cacheadd, bool);
	XtSetMappedWhenManaged(msg_force, bool);
	XtSetMappedWhenManaged(msg_clear, bool);
}