Exemple #1
0
void
help_cb(Widget widget, XtPointer client_data, XtPointer call_data)
{
	static Widget help, about;
	Widget *dialog;
	uintptr_t item_no = (uintptr_t)client_data;

	/*@ -usedef -immediatetrans -onlytrans -mustfreefresh -type +charint -ptrcompare @*/
	if (item_no == 0 && !help) {
		Arg args[5];
		int n = 0;
		XmString msg = XmStringCreateLtoR(
		    "XGps displays live data from a GPS unit controlled by\n"
		    "a running gpsd daemon.\n\n"
		    "The list of satellites and their position on the sky\n"
		    "are displayed and the most important live data is\n"
		    "shown in text fields below the skyview.\n",
		    XmFONTLIST_DEFAULT_TAG);
		XtSetArg(args[n], XmNmessageString, msg); n++;
		help = XmCreateInformationDialog(toplevel, "help_dialog",
						 args, (Cardinal)n);
		XtUnmanageChild(XmMessageBoxGetChild(help,
		    XmDIALOG_CANCEL_BUTTON));
		XtUnmanageChild(XmMessageBoxGetChild(help,
		    XmDIALOG_HELP_BUTTON));
	}

	if (item_no == 1 && !about) {
		Arg args[5];
		int n = 0;
		XmString msg = XmStringCreateLtoR(
		    "XGps 3.1.2\n\n"
		    "Copyright (c) 2007 by Marc Balmer <*****@*****.**>\n"
		    "Copyright (c) 2006 by Eric S. Raymond\n"
		    "\nUse at your own risk.\n\n",
		    XmFONTLIST_DEFAULT_TAG);
		XtSetArg(args[n], XmNmessageString, msg);
		n++;
		about = XmCreateInformationDialog(toplevel, "about_dialog",
						  args, (Cardinal)n);
		XtUnmanageChild(XmMessageBoxGetChild(about,
		    XmDIALOG_CANCEL_BUTTON));
		XtUnmanageChild(XmMessageBoxGetChild(about,
		    XmDIALOG_HELP_BUTTON));
	}
	/*@ +usedef +immediatetrans +onlytrans +mustfreefresh +type -charint +ptrcompare @*/

	if (item_no == 0)
		dialog = &help;
	else
		dialog = &about;

	XtManageChild(*dialog);
	/*@i1@*/XtPopup(XtParent(*dialog), XtGrabNone);
}
Exemple #2
0
void
XltHelpOnStrokes(Widget W)
{
static Widget Dialog = NULL;
Widget Shell = W;

	while (!XtIsShell(Shell)) Shell = XtParent(Shell);
	if (Dialog == NULL)
	{
	XmString string;
	XtResource resources[] =
	{
	    {"messageString", "MessageString", XtRString, sizeof(String), XtOffset(AppResourcesPtr, DefaultHelpString), XtRImmediate, DefaultHelp},
	};
	    Dialog = XmCreateInformationDialog(Shell, "HelpOnStrokes", NULL, 0);
	    XtGetSubresources(W,
			      &AppResources,
			      XtName(Dialog),
			      XtClass(Dialog)->core_class.class_name,
			      resources,
			      XtNumber(resources),
			      NULL, 0);
	    string = XmStringCreateLtoR(AppResources.DefaultHelpString, XmFONTLIST_DEFAULT_TAG);
	    XtVaSetValues(Dialog,
		    XmNmessageString, string,
		    NULL);
	    XmStringFree(string);
	    XtUnmanageChild(XmMessageBoxGetChild(Dialog, XmDIALOG_HELP_BUTTON));
	}
	XtManageChild(Dialog);
}
Exemple #3
0
void helpButtPrefCbk()
{
    XmString theXmString, theXmString2;
    Arg      args[8];
    int      argcount;
    Widget   remove;
    Widget   startupPrefsHelpDlgBox;

    argcount = 0;
    theXmString = XM_STRING_CREATE("Help");
    XtSetArg(args[argcount], XmNdialogTitle, theXmString);
    argcount++;
    theXmString2 = XM_STRING_GEN_COMP("This panel sets the startup preferences.\n\
Ok will save them to the user\'s defaults.\n\n\
Set nickname and name you want to use.\nEnter the server you want to connect to.");
    XtSetArg(args[argcount], XmNmessageString, theXmString2);
    argcount++;
    XtSetArg(args[argcount], XmNautoUnmanage, True);
    argcount++;
    startupPrefsHelpDlgBox = XmCreateInformationDialog(startPrefDiag, "help", args, argcount);
    XmStringFree(theXmString);
    XmStringFree(theXmString2);

    /* Now get rid of the things we don't want */
    remove = XmMessageBoxGetChild(startupPrefsHelpDlgBox, XmDIALOG_HELP_BUTTON);
    XtUnmanageChild(remove);
    remove = XmMessageBoxGetChild(startupPrefsHelpDlgBox, XmDIALOG_CANCEL_BUTTON);
    XtUnmanageChild(remove);
    XtManageChild(startupPrefsHelpDlgBox);
}
Exemple #4
0
Widget
err_dialog(Widget widget, char *s)
{
	static Widget dialog;
	XmString t;

	/*@ -mustfreefresh +charint -usedef -statictrans -immediatetrans -onlytrans @*/
	if (!dialog) {
		Arg args[5];
		int n = 0;
		XmString ok = XmStringCreateLocalized("OK");
		XtSetArg(args[n], XmNautoUnmanage, False); n++;
		XtSetArg(args[n], XmNcancelLabelString, ok); n++;
		dialog = XmCreateInformationDialog(widget, "notice", 
						   args, (Cardinal)n);
		XtAddCallback(dialog, XmNcancelCallback, dlg_callback, NULL);
		XtUnmanageChild(XmMessageBoxGetChild(dialog,
		    XmDIALOG_OK_BUTTON));
		XtUnmanageChild(XmMessageBoxGetChild(dialog,
		    XmDIALOG_HELP_BUTTON));
	}
	t = XmStringCreateLocalized(s);
	XtVaSetValues(dialog,
	    XmNmessageString,	t,
	    XmNdialogStyle,	XmDIALOG_FULL_APPLICATION_MODAL,
	    NULL);
	XmStringFree(t);
	XtManageChild(dialog);
	XtPopup(XtParent(dialog), XtGrabNone);
	return dialog;
	/*@ +mustfreefresh -charint +usedef +statictrans +immediatetrans  +onlytrans @*/
}
Exemple #5
0
static void
XlfdCB()
{
  Widget	dialog;
  Arg		args[5];
  char		mess[1024];
  int		n;
  XmString	cs, cs1, cs2;

  sprintf(mess, "%s : %s", resource.file_name, fullpath);
  cs = XmStringCreateLocalized(mess);
  cs1 = XmStringSeparatorCreate();
  cs2 = XmStringConcat(cs, cs1);
  XmStringFree(cs);
  XmStringFree(cs1);
  sprintf(mess, "%s : %s", resource.xlfd_name, fullFontData.xlfdname);
  cs1 = XmStringCreateLocalized(mess);
  cs = XmStringConcat(cs2, cs1);
  XmStringFree(cs1);
  XmStringFree(cs2);
  n = 0;
  XtSetArg (args[n], XmNtitle, resource.l_xlfd_title); n++;
  XtSetArg (args[n], XmNmessageString, cs); n++;
  XtSetArg (args[n], XmNdialogStyle, XmDIALOG_MODELESS); n++;
  dialog = XmCreateInformationDialog (toplevel, "Xlfd_name", args, n);
  XtUnmanageChild (XmMessageBoxGetChild(dialog, XmDIALOG_CANCEL_BUTTON));
  XtUnmanageChild (XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON));
  XtManageChild (dialog);
  XmStringFree(cs);
}
Exemple #6
0
static void 
Help(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
static Widget Dialog = NULL;
char HelpText[] =
   "Generic help for XltFilePicker\n"
   "Type in a file name, or click on Browse\n"
   "to search for one."
   ;

    if (Dialog == NULL)
    {
    Widget ParentShell;
    XmString string;

    	ParentShell = w;
    	while (!XtIsApplicationShell(ParentShell)) ParentShell = XtParent(ParentShell);
    	Dialog = XmCreateInformationDialog(ParentShell, "HelpText", NULL, 0);
    	XtUnmanageChild(XmMessageBoxGetChild(Dialog, XmDIALOG_HELP_BUTTON));
    	string = XmStringCreateLtoR(HelpText,XmFONTLIST_DEFAULT_TAG);
    	XtVaSetValues(Dialog,
    		XmNmessageString, string,
    		NULL);
    }
    XtManageChild(Dialog);
}
Exemple #7
0
void ShowVersionDialog (View view)
{
    Widget dialog;
    Arg al[] = { { XmNmessageString },
		 { XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL } };

    #define programVersion          \
        "vxview version " ## Version ## ", compiled " ## __DATE__ ## "\n\n" \
        "Laboratory for Computational Intelligence\n" \
	"University of British Columbia"

    /* Create a dialog displaying the message: */
    al[0].value = (XtArgVal) XmStringCreateLtoR ((char *) "bla",
						 XmSTRING_DEFAULT_CHARSET);
    dialog = XmCreateInformationDialog (view->view_shell, "version",
					al, XtNumber (al));
    XmStringFree ((XmString) al[0].value);
    XtVaSetValues (XtParent (dialog),
		   XmNdeleteResponse, XmDESTROY, (char *) NULL);
    XtUnmanageChild (XmMessageBoxGetChild (dialog, XmDIALOG_CANCEL_BUTTON));
    XtUnmanageChild (XmMessageBoxGetChild (dialog, XmDIALOG_HELP_BUTTON));
    XtAddCallback (dialog, XmNokCallback,
		   (XtCallbackProc) XtDestroyWidget, NULL);
    XtManageChild (dialog);

    #undef programVersion
}
Exemple #8
0
void
AutoGoManual( void )
{
    static Boolean 	first_time = True;
    int    	   	n;
    Arg		   	args[10];
    XmString		tcs;
    static Widget	Dialog;
    int			save_x, save_y;

    save_x = xisSavePointerX;
    save_y = xisSavePointerY;
    xisSavePointer();

    if (first_time) {

	tcs = XmStringCreateLtoR(ManString, XmSTRING_DEFAULT_CHARSET);

    	n = 0;
	XtSetArg(args[n], XmNx, 500);					n++;
	XtSetArg(args[n], XmNy, 0);					n++;
    	XtSetArg(args[n], XmNmessageString, tcs);			n++;
    	XtSetArg(args[n], XmNbackground, GetColor("#d0d0d8"));		n++;
	XtSetArg(args[n], XmNautoUnmanage, True);			n++;
	XtSetArg(args[n], XmNdefaultPosition, False);			n++;
	XtSetArg(args[n], XmNshadowThickness, 10);			n++;
	XtSetArg(args[n], XmNmarginWidth, 15);				n++;
	XtSetArg(args[n], XmNmarginHeight, 15);                     	n++;
	Dialog = XmCreateInformationDialog(Shell1, "Dialog", args, n);

	XtAddCallback(Dialog, XmNokCallback, UnPostDialogCB, NULL);

	n = 0;
	XtSetArg(args[n], XmNsensitive, False);				n++;
	XtSetValues(XmMessageBoxGetChild(Dialog, XmDIALOG_HELP_BUTTON),
		    args, n);

	XmStringFree(tcs);

	first_time = False;
    }

    XtManageChild(Dialog);

    XtUnmanageChild(XmMessageBoxGetChild(Dialog, XmDIALOG_CANCEL_BUTTON));

    while (AutoManualMode == True)
	xisSynchronize();

    xisProcessObjects();
    xisUpdateObjectAttributes();

    xisRestorePointer();
    xisSavePointerX = save_x;
    xisSavePointerY = save_y;


}
Exemple #9
0
void WNavMotif::message_dialog( char *title, char *text)
{
    Widget 	dialog;
    XmString	text_str;
    XmString	title_str;
    Arg		args[9];
    int		i;
    XEvent 	Event;

    text_str = XmStringCreateLocalized( wnav_dialog_convert_text(text));
    title_str = XmStringCreateLocalized( title);
    i = 0;
    XtSetArg( args[i], XmNmessageString, text_str);
    i++;
    XtSetArg( args[i], XmNdialogTitle, title_str);
    i++;
    XtSetArg( args[i], XmNdialogType, XmDIALOG_MESSAGE);
    i++;
    if ( dialog_width && dialog_height)
    {
        XtSetArg( args[i], XmNwidth, dialog_width);
        i++;
        XtSetArg( args[i], XmNheight, dialog_height);
        i++;
        XtSetArg( args[i], XmNx, dialog_x);
        i++;
        XtSetArg( args[i], XmNy, dialog_y);
        i++;
    }

    dialog = XmCreateInformationDialog( parent_wid, (char*) "Info", args, i);
    XmStringFree( text_str);
    XmStringFree( title_str);

    XtUnmanageChild( XmMessageBoxGetChild( dialog, XmDIALOG_HELP_BUTTON));
    XtUnmanageChild( XmMessageBoxGetChild( dialog, XmDIALOG_CANCEL_BUTTON));

    XtAddCallback( dialog, XmNokCallback, wnav_message_dialog_ok, this);

    // Connect the window manager close-button to exit
    flow_AddCloseVMProtocolCb( XtParent(dialog),
                               (XtCallbackProc)wnav_message_dialog_ok, this);

    XtManageChild( dialog);
    XtPopup( XtParent(dialog), XtGrabNone);

    dialog_ok = 0;

    for (;;)
    {
        XtAppNextEvent( XtWidgetToApplicationContext( dialog), &Event);
        XtDispatchEvent( &Event);
        if ( dialog_ok)
            return;
    }
}
// Show a suggestion named NAME
static void hint_on(const _XtString name)
{
    // Create some `dummy' widget and create a help text for it
    Widget suggestion = 
	verify(XmCreateInformationDialog(find_shell(), XMST(name), 0, 0));

    ImmediateHelpCB(suggestion, XtPointer(0), XtPointer(0));

    DestroyWhenIdle(suggestion);
}
static void Error_popup( char *msg_buf )
{
    Widget dialog;
    Widget temp_widget;
    Widget ok_button;
    XmString ok;
    XmString msg;

    ok = XmStringCreateLocalized( "OK" );

    msg = XmStringCreateLtoR( msg_buf, XmFONTLIST_DEFAULT_TAG );

    dialog = XmCreateInformationDialog( Top_widget, "error", NULL, 0 );

    /* Get rid of Cancel and Help buttons on popup. */

    temp_widget = XmMessageBoxGetChild( dialog, XmDIALOG_CANCEL_BUTTON );
    XtUnmanageChild( temp_widget );

    temp_widget = XmMessageBoxGetChild( dialog, XmDIALOG_HELP_BUTTON );
    XtUnmanageChild( temp_widget );

    /* Set properties of OK button. */

    ok_button = XmMessageBoxGetChild( dialog, XmDIALOG_OK_BUTTON );

    XtVaSetValues( ok_button,
                   XmNforeground, hci_get_read_color( BUTTON_FOREGROUND ),
                   XmNbackground, hci_get_read_color( BUTTON_BACKGROUND ),
                   NULL );

    /* Set properties of popup. */

    XtVaSetValues (dialog,
                   XmNmessageString, msg,
                   XmNokLabelString, ok,
                   XmNbackground, hci_get_read_color( WARNING_COLOR ),
                   XmNforeground, hci_get_read_color( TEXT_FOREGROUND ),
                   XmNdialogStyle, XmDIALOG_PRIMARY_APPLICATION_MODAL,
                   XmNdeleteResponse, XmDESTROY,
                   NULL);

    /* Free allocated space. */

    XmStringFree( ok );
    XmStringFree( msg );

    /* Do this to make popup appear. */

    XtManageChild( dialog );
    XtPopup( Top_widget, XtGrabNone );
}
Exemple #12
0
static void
comp_err(XtPointer closure, int *fd, XtInputId *id)
{
	MGV *m = (MGV *)closure;
	assert(MgvOK(m));

	if(m->child_err == NULL)
		m->child_err = XmCreateInformationDialog(m->main, "childStderr",
								NULL, 0);
	if(!mgv_child_msg(m->child_err, *fd)) {
		XtRemoveInput(*id);
		close(*fd);
	}
}
Exemple #13
0
static void
Help(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
    static Widget Dialog = NULL;
    char HelpText[] =
    "BASIC-style expression evaluator which understands the following\n"
    "operators (all trigonometrical functions use degrees):\n\n"
    "+,-,*,/,^   Addition, subtraction, multiplication, division and power.\n"
    "()          Brackets (overrides operator precedence).\n"
    "ACS expr    Arccosine.\n"
    "ASN expr    Arcsine.\n"
    "ATN expr    Arctangent.\n"
    "COS expr    Cosine.\n"
    "EXP expr    Exponential power.\n"
    "FACT expr   Factorial (expr must be between 0 and 147).\n"
    "LN expr     Natural log (expr must be positive).\n"
    "LOG expr    Log to base 10 (expr must be positive).\n"
    "RND expr    Random number generator.\n"
    "            If expr<0, then expr is used to seed the random number generator.\n"
    "            If 0<=expr<=1, then returns a real number between 0 and 1.\n"
    "            If expr>1, then returns an integer between 1 and expr.\n"
    "SIN expr    Sine.\n"
    "SQRT expr   Square root.\n"
    "TAN expr    Tangent.\n"
    "TIME        Returns the number of seconds since 1st January 1970.\n"
    "\nderived from:\n"
    "calc.c - Floating-point calculator V1.00 (C) Richard K. Lloyd 1992\n"
    "*****@*****.**"
     ;

    if (Dialog == NULL)
    {
	Widget ParentShell;
	XmString string;

	ParentShell = w;
	while (!XtIsApplicationShell(ParentShell))
	    ParentShell = XtParent(ParentShell);
	Dialog = XmCreateInformationDialog(ParentShell, "HelpText", NULL, 0);
	string = XmStringCreateLtoR(HelpText, XmFONTLIST_DEFAULT_TAG);
	XtVaSetValues(Dialog,
		      XmNmessageString, string,
		      NULL);
	XmStringFree(string);
    }
    XtManageChild(Dialog);

}
Exemple #14
0
Fichier : ssX.c Projet : q3k/ski
void prodInfoCallback(CALLBACK_ARGS)
{
    static Widget dialog = NULL;

    if (!dialog) {
	XmString xms;
	Arg arg;

	xms = XmStringCreateLtoR(productInfo(), XmFONTLIST_DEFAULT_TAG);
	XtSetArg(arg, XmNmessageString, xms);
	dialog = XmCreateInformationDialog(cmd, "prodInfo", &arg, 1);
	XmStringFree(xms);
	XtUnmanageChild(XmMessageBoxGetChild(dialog, XmDIALOG_CANCEL_BUTTON));
	XtUnmanageChild(XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON));
    }
    XtManageChild(dialog);
}
Exemple #15
0
void
InfoDialog(
        char *infoString,
        Widget parent,
        Boolean unmapParent )
{
    int             n;
    Arg             args[10];
    static XmString ok = NULL;
    Widget          w;

    /* create the compound string */
    style.tmpXmStr = CMPSTR(infoString);

    if (ok == NULL)
	ok = CMPSTR((String) _DtOkString);

    /* create it */
    n = 0;
    XtSetArg(args[n], XmNokLabelString, ok);                            n++;
    XtSetArg(args[n], XmNmessageString, style.tmpXmStr);                n++;
    XtSetArg(args[n], XmNdialogStyle, XmDIALOG_MODELESS);               n++;
    XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC);                n++;
    w = XmCreateInformationDialog(parent, "Notice", args, n);

    if (unmapParent)
        XtAddCallback (w, XmNokCallback, DestroyCB, parent);
    else
        XtAddCallback (w, XmNokCallback, DestroyCB, NULL);
    XtUnmanageChild ( XmMessageBoxGetChild(w, XmDIALOG_CANCEL_BUTTON) );
    XtUnmanageChild ( XmMessageBoxGetChild(w, XmDIALOG_HELP_BUTTON) );

    /* set the dialog shell parent title */
    n=0;
    XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
    XtSetArg (args[n], XmNtitle, ((char *)GETMESSAGE(2, 2, "Notice")));   n++;
    XtSetValues (XtParent(w), args, n);

    /* free the compound string */
    XmStringFree (style.tmpXmStr);

    /* manage the info dialog */
    XtManageChild(w);

}
Exemple #16
0
static void
CodeAreaCB()
{
    char	mess[256];
    char	tmp[16];
    Widget	dialog;
    Arg		args[5];
    int		n;
    XmString	cs;

    sprintf(mess, "%s : ", resource.codearea);
    switch (fullFontData.cd_set) {
	case FAL_FONT_CS0:
	    strcat(mess, "CS0:");
	    break;
	case FAL_FONT_CS1:
	    strcat(mess, "CS1:");
	    break;
	case FAL_FONT_CS2:
	    strcat(mess, "CS2:");
	    break;
	case FAL_FONT_CS3:
	    strcat(mess, "CS3:");
	    break;
    }

    for (n=0; CodeArea[n].start != -1; n++) {
	sprintf(tmp, " %X - %X ", CodeArea[n].start, CodeArea[n].end);
	strcat(mess, tmp);
    }
    cs = XmStringCreateLocalized(mess);
    n = 0;
    XtSetArg (args[n], XmNtitle, resource.l_codearea_title); n++;
    XtSetArg (args[n], XmNmessageString, cs); n++;
    XtSetArg (args[n], XmNdialogStyle, XmDIALOG_MODELESS); n++;
    XtSetArg (args[n], XmNdefaultButtonType, XmDIALOG_CANCEL_BUTTON); n++;
    dialog = XmCreateInformationDialog (toplevel, "UDCarea", args, n);
    XtUnmanageChild (XmMessageBoxGetChild(dialog, XmDIALOG_CANCEL_BUTTON));
    XtUnmanageChild (XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON));
    XtManageChild (dialog);
    XmStringFree(cs);
}
Exemple #17
0
void display_confirmed_message (Widget parent, char *message)
{

  Confirmed = XmCreateInformationDialog(parent, "confirmedDialog", NULL, 0);
  XtUnmanageChild (XmMessageBoxGetChild (Confirmed, XmDIALOG_CANCEL_BUTTON));
  XtUnmanageChild (XmMessageBoxGetChild (Confirmed, XmDIALOG_HELP_BUTTON));

  XtAddCallback( Confirmed, XmNokCallback,
          (XtCallbackProc) activateCB_Confirmed_OkButton,
          (XtPointer) NULL );

  XtVaSetValues (Confirmed,
                 RES_CONVERT(XmNdialogTitle, GETMESSAGE(6, 41, "Create Action - Confirmation")),
                 RES_CONVERT(XmNmessageString, message),
                 NULL);
  XtRealizeWidget(Confirmed);

  XtManageChild (Confirmed);
  return;
}
Exemple #18
0
void TipOfTheDayCB(Widget w, XtPointer, XtPointer)
{
    static Widget tip_dialog = 0;

    if (tip_dialog == 0)
    {
	Arg args[10];
	Cardinal arg = 0;
	XtSetArg(args[arg], XmNautoUnmanage, False); arg++;
	tip_dialog = 
	    verify(XmCreateInformationDialog(find_shell(w), 
					     XMST("tip_dialog"), 
					     args, arg));

#if XmVersion >= 1002
	arg = 0;
	XtSetArg(args[arg], XmNset, app_data.startup_tips); arg++;
	set_startup_tips_w = 
	    verify(XmCreateToggleButton(tip_dialog, 
					XMST("set_startup_tips"),
					args, arg));
	XtAddCallback(set_startup_tips_w, XmNvalueChangedCallback, 
		      SetStartupTipsCB, 0);

	XtManageChild(set_startup_tips_w);
#endif

	XtAddCallback(tip_dialog, XmNokCallback, UnmanageThisCB, 
		      XtPointer(tip_dialog));
	XtAddCallback(tip_dialog, XmNcancelCallback, PrevTipCB, 0);
	XtAddCallback(tip_dialog, XmNhelpCallback,   NextTipCB, 0);
	XtAddCallback(tip_dialog, XmNunmapCallback,  SaveTipCountCB, 0);
    }

    bool ok = refresh_tip_dialog(tip_dialog);
    if (!ok)
	return;

    manage_and_raise(tip_dialog);
}
Exemple #19
0
void infowin(char *s)
{
    static XmString str;
    char *buf = (char *)"Sorry, no help available for this item";
    if (s == NULL)
    {
        s = buf;
    }
    if (!inwin)
    {
        fprintf(stderr, "%s\n", s);
        return;
    }
    if (info_popup)
    {
        XmStringFree(str);
        str = XmStringCreateLtoR(s, charset);
        XtVaSetValues(info_popup,
                      XmNmessageString, str,
                      NULL);
        XtManageChild(info_popup);
        return;
    }
    str = XmStringCreateLtoR(s, charset);
    info_popup = XmCreateInformationDialog(app_shell, (char *)"Info", NULL, 0);
    XtVaSetValues(info_popup,
                  XmNmessageString, str,
                  XmNdialogTitle, XmStringCreateLtoR((char *)"Info", charset),
                  XmNdialogStyle, XmDIALOG_APPLICATION_MODAL,
                  NULL);
    /*
       XtAddCallback(info_popup, XmNhelpCallback, (XtCallbackProc) info_helpCB,
           (XtPointer) NULL);
    */
    XtUnmanageChild(XmMessageBoxGetChild(info_popup, XmDIALOG_CANCEL_BUTTON));
    XtUnmanageChild(XmMessageBoxGetChild(info_popup, XmDIALOG_HELP_BUTTON));
    XtManageChild(info_popup);
}
Exemple #20
0
void	vi_info_message(Widget parent, String str)
{
    static	Widget	db = NULL;
    XmString	msg = XmStringCreateSimple( str );

    if ( db == NULL )
	db = XmCreateInformationDialog( parent, "Information", NULL, 0 );

    XtVaSetValues( XtParent(db),
		   XmNtitle,		"Information",
		   0
		   );
    XtVaSetValues( db,
		   XmNmessageString,	msg,
		   0
		   );
    XtAddCallback( XtParent(db), XmNpopdownCallback, __vi_cancel_cb, 0 );

    XtUnmanageChild( XmMessageBoxGetChild( db, XmDIALOG_CANCEL_BUTTON ) );
    XtUnmanageChild( XmMessageBoxGetChild( db, XmDIALOG_HELP_BUTTON ) );

    __vi_modal_dialog( db );
}
Exemple #21
0
int SimpleMsgBox(Widget w, char *texta)
{
    XmString        xtext;
    Arg             args[10];
    Widget          dialog;

    if (!w) {
        w = toplevel;
    }

    xtext = XmStringCreateLocalized(texta);
    XtSetArg (args[0], XmNmessageString, xtext);
    dialog = XmCreateInformationDialog(w, "message", args, 1);
    XtFree(xtext);
    XtUnmanageChild( XmMessageBoxGetChild(dialog, XmDIALOG_CANCEL_BUTTON));
    XtUnmanageChild( XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON));
    XtVaSetValues(XtParent(dialog),
                  XmNtitle, "NSHARP",
                  XmNwidth, 1600,
                  NULL);

    XtManageChild(dialog);
    XtPopup(XtParent(dialog), XtGrabNone);
}
Exemple #22
0
void activate( Widget w, XtPointer data, XtPointer call_data )
{
  static Widget box = 0;

  /*printf( "activated\n" );*/

  if( box == 0 )
    box = XmCreateInformationDialog( w, "info", NULL, 0 );

  XtVaSetValues( box,
                 XmNnoResize, True,
                 XtVaTypedArg,
                   XmNdialogTitle, XmRString, "HELP", sizeof( char *),
                 XtVaTypedArg,
                   XmNmessageString, XmRString, text, sizeof( char *),
                 XtVaTypedArg,
                   XmNokLabelString, XmRString, " Close ", sizeof( char *),
                 NULL );

  XtUnmanageChild( XmMessageBoxGetChild( box, XmDIALOG_CANCEL_BUTTON ) );
  XtUnmanageChild( XmMessageBoxGetChild( box, XmDIALOG_HELP_BUTTON ) );

  XtManageChild( box );
}
Exemple #23
0
/* if the product add is okayed, then we check to see if the input is
 * good, and if it is, we bring it up for editing
 */
void product_edit_add_ok_callback(Widget w, XtPointer client_data, XtPointer call_data) 
{
    XmSelectionBoxCallbackStruct *cbs = (XmSelectionBoxCallbackStruct *)call_data;
    char *new_pid_str, buf[20];
    int i, new_pid, list_size;
    Widget d;
    XmString xmstr;
    
    char sub[25];
    int k, j;

    /* get the new pid in string form */
    XmStringGetLtoR(cbs->value, XmFONTLIST_DEFAULT_TAG, &new_pid_str);



    /* find a number and complain if it isn't one */
    /* skip over any initial spaces */
    k=0;
    while(new_pid_str[k] == ' ') k++;

    /* read in an integer (the prod id) */
    j=0;
    while(isdigit((int)(new_pid_str[k]))) 
        sub[j++] = new_pid_str[k++];
    sub[j] = '\0';
    free(new_pid_str);
    
    /* check if we got digits */
    if(j==0) {
        d = XmCreateErrorDialog(w, "Error", NULL, 0);
        xmstr = XmStringCreateLtoR("The entered value is not a number.\nPlease try again.",
                   XmFONTLIST_DEFAULT_TAG);
        XtVaSetValues(d, XmNmessageString, xmstr, NULL);
        XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_HELP_BUTTON));
        XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_CANCEL_BUTTON));
        XtManageChild(d);
        XmStringFree(xmstr);
        return;
        
    } else 
        new_pid = atoi(sub);


    /* check to see if the number exists already.  if it does, complain */
    for(i=0; i<msg_type_list->size; i++)
        if(new_pid == msg_type_list->keys[i]) {
        d = XmCreateInformationDialog(w, "Error", NULL, 0);
        xmstr = XmStringCreateLtoR("The specified product ID already exists.\nEnter another number.",
                       XmFONTLIST_DEFAULT_TAG);
        XtVaSetValues(d, XmNmessageString, xmstr, NULL);
        XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_HELP_BUTTON));
        XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_CANCEL_BUTTON));
        XtManageChild(d);
        XmStringFree(xmstr);
        return;
    }
    
    /* check to see if the number is within the range produced by the radar */
    if( !((new_pid >=0) && (new_pid <= 1999)) ) {
        d = XmCreateInformationDialog(w, "Error", NULL, 0);
        xmstr = XmStringCreateLtoR("The specified product ID is beyond the valid range.\nEnter another number (1-1999).",
                       XmFONTLIST_DEFAULT_TAG);
        XtVaSetValues(d, XmNmessageString, xmstr, NULL);
        XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_HELP_BUTTON));
        XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_CANCEL_BUTTON));
        XtManageChild(d);
        XmStringFree(xmstr);
        return;
    }
        

    /* if not, add default values for the pid in to the preference fields */
    assoc_insert_i(product_res, new_pid, -1);
    assoc_insert_i(digital_legend_flag, new_pid, -1);
    assoc_insert_s(digital_legend_file, new_pid, ".lgd");
    assoc_insert_s(dig_legend_file_2, new_pid, ".lgd");
    assoc_insert_s(configured_palette, new_pid, ".plt");
    assoc_insert_s(config_palette_2, new_pid, ".plt");
    assoc_insert_i(associated_packet, new_pid, 0);

    assoc_insert_i(msg_type_list, new_pid, -1);
    /* CVG 9.1 - added packet 1 coord override for geographic products */
    assoc_insert_i(packet_1_geo_coord_flag, new_pid, 0);
    
    /* CVG 9.1 - added override of colors for non-2d array packets */
    assoc_insert_s(override_palette, new_pid, ".plt");
    assoc_insert_i(override_packet, new_pid, 0);
    
    /* CVG 9.3 - added elevation flag */
    assoc_insert_i(elev_flag, new_pid, 0);

    assoc_insert_s(legend_units, new_pid, "units"); 
    
    /* then set it up to be edited */
    sprintf(buf, "%d", new_pid);
    xmstr = XmStringCreateLtoR(buf, XmFONTLIST_DEFAULT_TAG);
    

    XtVaSetValues(id_label, XmNlabelString, xmstr, NULL);
     
    XtVaGetValues(pi_list, XmNitemCount, &list_size, NULL);  
    XmListAddItem(pi_list, xmstr, list_size+1);   
    XmListSelectItem(pi_list, xmstr, True);     
    XtVaSetValues(XtParent(pi_list), XmNwidth, 150, NULL);    
    XtUnmanageChild(w); 
XmStringFree(xmstr);
  
}
Exemple #24
0
int WNavMotif::continue_dialog( char *title, char *text)
{
    Widget 	dialog;
    XmString	text_str;
    XmString	title_str;
    XmString	continue_str;
    XmString	quit_str;
    Arg		args[10];
    int		i;
    XEvent 	Event;

    text_str = XmStringCreateLocalized( wnav_dialog_convert_text(text));
    title_str = XmStringCreateLocalized( title);
    continue_str = XmStringCreateLocalized( (char*) "Continue");
    quit_str = XmStringCreateLocalized( (char*) "Quit");
    i = 0;
    XtSetArg( args[i], XmNmessageString, text_str);
    i++;
    XtSetArg( args[i], XmNdialogTitle, title_str);
    i++;
    XtSetArg( args[i], XmNcancelLabelString, quit_str);
    i++;
    XtSetArg( args[i], XmNokLabelString, continue_str);
    i++;
    XtSetArg( args[i], XmNdialogType, XmDIALOG_WARNING);
    i++;
    if ( dialog_width && dialog_height)
    {
        XtSetArg( args[i], XmNwidth, dialog_width);
        i++;
        XtSetArg( args[i], XmNheight, dialog_height);
        i++;
        XtSetArg( args[i], XmNx, dialog_x);
        i++;
        XtSetArg( args[i], XmNy, dialog_y);
        i++;
    }

    dialog = XmCreateInformationDialog( parent_wid, (char*) "Info", args, i);
    XmStringFree( text_str);
    XmStringFree( title_str);
    XmStringFree( quit_str);
    XmStringFree( continue_str);

    XtUnmanageChild( XmMessageBoxGetChild( dialog, XmDIALOG_HELP_BUTTON));

    XtAddCallback( dialog, XmNokCallback, wnav_message_dialog_ok, this);
    XtAddCallback( dialog, XmNcancelCallback, wnav_message_dialog_cancel, this);

    flow_AddCloseVMProtocolCb( XtParent(dialog),
                               (XtCallbackProc)wnav_message_dialog_cancel, this);

    XtManageChild( dialog);
    XtPopup( XtParent(dialog), XtGrabNone);

    dialog_ok = 0;
    dialog_cancel = 0;
    dialog_help = 0;

    for (;;)
    {
        XtAppNextEvent( XtWidgetToApplicationContext( dialog), &Event);
        XtDispatchEvent( &Event);
        if ( dialog_ok)
            return 1;
        if ( dialog_cancel)
            return 0;
    }
}
Exemple #25
0
/*+++++++++++++++++++++++++++++++++++++++*/
static void 
ButtonCB(
        Widget w,
        XtPointer client_data,
        XtPointer call_data )
{
  int         n;
  Arg         args[MAX_ARGS];
  char        *resPtr;
  Boolean     state;
  Boolean     changeFlag = 0;
  DtDialogBoxCallbackStruct *cb = (DtDialogBoxCallbackStruct *) call_data;
  
  switch (cb->button_position)
    {
    case OK_BUTTON:
      
      XtUnmanageChild (w);
      
      /* create the Dtwm resource specs for xrdb */
      
      state = XmToggleButtonGadgetGetState (dtwm.explicitTG);
      if ( state != dtwm.origKeyboardFocusPolicy)
	{
	  sprintf(dtwmRes, "Dtwm.keyboardFocusPolicy: %s\n",
		  XmToggleButtonGadgetGetState (dtwm.pointerTG)
		  ? POINTER_STR : EXPLICIT_STR);
	  changeFlag = 1;
	}
      
      /* write out FocusAutoRaise if toggle has changed or if
       * KeyboardFocusPolicy has changed.  FAR default value is 
       * based off of KFP so must set explicitly or visible toggle 
       * will be inacurate */
      state = XmToggleButtonGadgetGetState (dtwm.autoRaiseTG);
      if (state !=  dtwm.origFocusAutoRaise || changeFlag)
	{
	  sprintf(dtwmRes+strlen(dtwmRes), "Dtwm*focusAutoRaise: %s\n",
		  XmToggleButtonGadgetGetState (dtwm.autoRaiseTG)
		  ? "True" : "False");
	  changeFlag = 1;
	}
      
      state = !XmToggleButtonGadgetGetState (dtwm.secStackTG);
      if ( state != dtwm.origSecStack)
	{
	  sprintf(dtwmRes+strlen(dtwmRes), "Dtwm*secondariesOnTop: %s\n",
		  XmToggleButtonGadgetGetState (dtwm.secStackTG)
		  ? "False" : "True");
	  changeFlag = 1;
	}
      
      state = XmToggleButtonGadgetGetState (dtwm.moveOpaqueTG);
      if ( state != dtwm.origMoveOpaque)
	{
	  sprintf(dtwmRes+strlen(dtwmRes), "Dtwm*moveOpaque: %s\n",
		  XmToggleButtonGadgetGetState (dtwm.moveOpaqueTG)
		  ? "True" : "False");
	  changeFlag = 1;
	}
      
      state = XmToggleButtonGadgetGetState (dtwm.iconBoxTG);
      if (state != dtwm.origUseIconBox)
	{
	  sprintf(dtwmRes+strlen(dtwmRes), "Dtwm*useIconBox: %s\n",
		  XmToggleButtonGadgetGetState (dtwm.iconBoxTG)
		  ? "True" : "False");
	  changeFlag = 1;
	}
      
      if (changeFlag)
	{
	  if (dtwm.warnDialog == NULL)
	    {
	      n = 0;
	      XtSetArg(args[n], XmNokLabelString, CMPSTR((String) _DtOkString)); n++;
	      XtSetArg(args[n], XmNcancelLabelString, CMPSTR((String) _DtCancelString)); n++;
	      XtSetArg(args[n], XmNborderWidth, 3); n++;
	      XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC ); n++;
	      XtSetArg(args[n], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL); n++; 
	      XtSetArg(args[n], XmNdialogTitle, CMPSTR((char *)GETMESSAGE(2,2, "Notice"))); n++;
	      XtSetArg(args[n], XmNmessageString, CMPSTR(WARN_MSG)); n++;
              dtwm.warnDialog = XmCreateInformationDialog(style.shell, "warnDialog", args, n);
	      
	      XtUnmanageChild (XmMessageBoxGetChild(dtwm.warnDialog, XmDIALOG_HELP_BUTTON)); 
	      
	      XtAddCallback(dtwm.warnDialog, XmNokCallback, okWarnCB, 
			    client_data); 
	      XtAddCallback(dtwm.warnDialog, XmNcancelCallback, cancelWarnCB, 
			    client_data); 
	    }
	  XtManageChild(dtwm.warnDialog);  
	   
	}
      break;
      
      
    case CANCEL_BUTTON:
    
      /* reset to dtwm values from when dialog is mapped */ 
      XtUnmanageChild(w);
      
      XmToggleButtonGadgetSetState (dtwm.pointerTG, 
				    dtwm.origKeyboardFocusPolicy ? POINTER : EXPLICIT , True); 
      
      XmToggleButtonGadgetSetState (dtwm.explicitTG, 
				    dtwm.origKeyboardFocusPolicy ? EXPLICIT : POINTER , True); 
      
      XmToggleButtonGadgetSetState (dtwm.autoRaiseTG, 
				    dtwm.origFocusAutoRaise ? True : False , True); 
      
      XmToggleButtonGadgetSetState (dtwm.secStackTG, 
				    dtwm.origSecStack ? False : True , True); 
      
      XmToggleButtonGadgetSetState (dtwm.moveOpaqueTG, 
				    dtwm.origMoveOpaque ? True : False , True); 
      
      XmToggleButtonGadgetSetState (dtwm.iconBoxTG, 
				    dtwm.origUseIconBox ? True : False , True); 
      
      XmToggleButtonGadgetSetState (dtwm.desktopTG, 
				    dtwm.origUseIconBox ? False : True , True); 
      
      break;
    
  case HELP_BUTTON:
    XtCallCallbacks(style.dtwmDialog, XmNhelpCallback, (XtPointer)NULL);
    break;
    
  default:
    break;
  }
}
Exemple #26
0
int WNavMotif::confirm_dialog( char *title, char *text, int display_cancel,
                               int *cancel)
{
    Widget 	dialog;
    XmString	text_str;
    XmString	title_str;
    XmString	no_str;
    XmString	yes_str;
    XmString	cancel_str;
    Arg		args[14];
    int		i;
    XEvent 	Event;

    text_str = XmStringCreateLocalized( wnav_dialog_convert_text(text));
    title_str = XmStringCreateLocalized( title);
    no_str = XmStringCreateLocalized( (char*) "No");
    yes_str = XmStringCreateLocalized( (char*) "Yes");
    cancel_str = XmStringCreateLocalized( (char*) "Cancel");
    i = 0;
    XtSetArg( args[i], XmNmessageString, text_str);
    i++;
    XtSetArg( args[i], XmNdialogTitle, title_str);
    i++;
    XtSetArg( args[i], XmNcancelLabelString, no_str);
    i++;
    XtSetArg( args[i], XmNokLabelString, yes_str);
    i++;
    XtSetArg( args[i], XmNhelpLabelString, cancel_str);
    i++;
    XtSetArg( args[i], XmNdialogType, XmDIALOG_WARNING);
    i++;
    if ( dialog_width && dialog_height)
    {
        XtSetArg( args[i], XmNwidth, dialog_width);
        i++;
        XtSetArg( args[i], XmNheight, dialog_height);
        i++;
        XtSetArg( args[i], XmNx, dialog_x);
        i++;
        XtSetArg( args[i], XmNy, dialog_y);
        i++;
    }

    dialog = XmCreateInformationDialog( parent_wid, (char*) "Info", args, i);
    XmStringFree( text_str);
    XmStringFree( title_str);
    XmStringFree( no_str);
    XmStringFree( yes_str);
    XmStringFree( cancel_str);

    if ( !display_cancel)
        XtUnmanageChild( XmMessageBoxGetChild( dialog, XmDIALOG_HELP_BUTTON));

    XtAddCallback( dialog, XmNokCallback, wnav_message_dialog_ok, this);
    XtAddCallback( dialog, XmNcancelCallback, wnav_message_dialog_cancel, this);
    XtAddCallback( dialog, XmNhelpCallback, wnav_message_dialog_help, this);

    // Connect the window manager close-button to exit
    if ( !display_cancel)
        flow_AddCloseVMProtocolCb( XtParent(dialog),
                                   (XtCallbackProc)wnav_message_dialog_cancel, this);
    else
        flow_AddCloseVMProtocolCb( XtParent(dialog),
                                   (XtCallbackProc)wnav_message_dialog_help, this);

    XtManageChild( dialog);
    XtPopup( XtParent(dialog), XtGrabNone);

    dialog_ok = 0;
    dialog_cancel = 0;
    dialog_help = 0;

    for (;;)
    {
        XtAppNextEvent( XtWidgetToApplicationContext( dialog), &Event);
        XtDispatchEvent( &Event);
        if ( dialog_ok)
        {
            if ( display_cancel)
                *cancel = 0;
            return 1;
        }
        if ( dialog_cancel)
        {
            if ( display_cancel)
                *cancel = 0;
            return 0;
        }
        if ( dialog_help)
        {
            *cancel = 1;
            XtDestroyWidget( dialog);
            return 0;
        }
    }
}
Exemple #27
0
/* if the site add is okayed, then we check to see if the input is
 * good, and if it is, we bring it up for editing
 */
void site_edit_add_ok_callback(Widget w, XtPointer client_data, XtPointer call_data) 
{
    XmSelectionBoxCallbackStruct *cbs = (XmSelectionBoxCallbackStruct *)call_data;
    char *new_sid_str, buf[20];
    int i, new_sid, list_size;
    Widget d;
    XmString xmstr;
    
    char sub[25];
    int k, j;

    /* get the new pid in string form */
    XmStringGetLtoR(cbs->value, XmFONTLIST_DEFAULT_TAG, &new_sid_str);


    /* find a number and complain if it isn't one */
    /* skip over any initial spaces */
    k=0;
    while(new_sid_str[k] == ' ') k++;

    /* read in an integer (the prod id) */
    j=0;
    while(isdigit((int)(new_sid_str[k]))) 
        sub[j++] = new_sid_str[k++];
    sub[j] = '\0';
    free(new_sid_str);
    
    /* check if we got digits */
    if(j==0) {
        d = XmCreateErrorDialog(w, "Error", NULL, 0);
        xmstr = XmStringCreateLtoR("The entered value is not a number.\nPlease try again.",
                   XmFONTLIST_DEFAULT_TAG);
        XtVaSetValues(d, XmNmessageString, xmstr, NULL);
        XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_HELP_BUTTON));
        XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_CANCEL_BUTTON));
        XtManageChild(d);
        XmStringFree(xmstr);
        return;
        
    } else 
        new_sid = atoi(sub);



    /* check to see if the number exists already.  if it does, complain */
    for(i=0; i<icao_list->size; i++)
        if(new_sid == icao_list->keys[i]) {
            d = XmCreateInformationDialog(w, "Error", NULL, 0);
            xmstr = XmStringCreateLtoR("The specified site ID number already exists.",
                           XmFONTLIST_DEFAULT_TAG);
            XtVaSetValues(d, XmNmessageString, xmstr, NULL);
            XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_HELP_BUTTON));
            XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_CANCEL_BUTTON));
            XtManageChild(d);
            return;
        }

    /* check to see if the number is within a defined range */
    if( !((new_sid >=0) && (new_sid <= 999)) &&  /*  WSR-88D */
        !((new_sid >=3000) && (new_sid <= 3050)) ) { /*  TDWR */
            d = XmCreateInformationDialog(w, "Error", NULL, 0);
            xmstr = XmStringCreateLtoR("The specified site ID is not in a defined range.\n 0-999 for WSR-88D; 3000-3050 for TDWR",
                           XmFONTLIST_DEFAULT_TAG);
            XtVaSetValues(d, XmNmessageString, xmstr, NULL);
            XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_HELP_BUTTON));
            XtUnmanageChild(XmMessageBoxGetChild(d, XmDIALOG_CANCEL_BUTTON));
            XtManageChild(d);
            return;
    }

    /* if not, add default values for the pid in to the preference fields */
    assoc_insert_i(radar_type_list, new_sid, 0);
    assoc_insert_s(icao_list, new_sid, " ");    
    
    /* then set it up to be edited */
    sprintf(buf, "%d", new_sid);
    xmstr = XmStringCreateLtoR(buf, XmFONTLIST_DEFAULT_TAG);
    
    XtVaSetValues(site_id_label, XmNlabelString, xmstr, NULL);
    
    XtVaGetValues(si_list, XmNitemCount, &list_size, NULL);
    XmListAddItem(si_list, xmstr, list_size+1);
    XmListSelectItem(si_list, xmstr, True);
    XtVaSetValues(XtParent(si_list), XmNwidth, 130, NULL);
    XtUnmanageChild(w);
}
Exemple #28
0
void CreateAboutD(Widget parent)
{
    Arg
        args[10];
            
    int
        n;
         
    XmString   
        xmstr;
            
    /****

    Pixmap
        apix=(Pixmap) NULL;
         
    Pixel
        fg,
        bg; 

    *******/

    XtAppContext app=XtWidgetToApplicationContext(GtoplevelW);
    XitAddXmStringConverter(app);
  
    xmstr=XmStringCreateSimple("About mxascii");
    n=0;
    XtSetArg (args[n], XmNautoUnmanage, True); n++;
    XtSetArg (args[n], XmNdialogStyle, XmDIALOG_MODELESS); n++;
    XtSetArg (args[n], XmNdialogTitle, xmstr);      n++;
 
    aboutdW=XmCreateInformationDialog(parent,"aboutd",
        args,n);

    XmStringFree(xmstr);
 
    XtUnmanageChild(XmMessageBoxGetChild(aboutdW,XmDIALOG_HELP_BUTTON));
    XtUnmanageChild(XmMessageBoxGetChild(aboutdW,XmDIALOG_CANCEL_BUTTON));
 
#ifdef DO_ICON
    XtVaGetValues(aboutdW,
        XmNforeground,&fg,
        XmNbackground,&bg,
        NULL);
 
    apix=XCreatePixmapFromBitmapData(Gdisplay,
        Grootwindow,
        mxkicon_bits,
        mxkicon_width,
        mxkicon_height,
        bg, 
        fg,
        Gdepth);
 

    if (apix != (Pixmap) NULL)
        XtVaSetValues(aboutdW,
            XmNsymbolPixmap,apix,
            NULL);
#endif

}
Exemple #29
0
Widget XmCreateInformationDialog_TNK(Widget parent, String name, ArgList arglist,Cardinal argcount) { return XmCreateInformationDialog(parent, name, arglist, argcount);}
Exemple #30
0
void 
MakeDialog( DialogType dtype )
{
    register int i, j;

    int		width;
    
    FILE	*fp, *fopen();
    char	buffer[128];
    char	*str;

    Widget	w, text;
    Dimension	txt_width, txt_height;
    XmString	ok, cancel, nw, sv;

    Widget      tlev;

    /*
     *  do things common to all dialogs...
     */

    ok     = ReadCatalogXms(MC_LABEL_SET, MC_OK_LABEL, MC_DEF_OK_LABEL);
    cancel = ReadCatalogXms(MC_LABEL_SET, MC_CANCEL_LABEL, MC_DEF_CANCEL_LABEL);

    i = InitArg(MessageBox);
    XtSetArg(argt[i], XmNmarginHeight,		MBOX_MARGIN_HEIGHT	); i++;
    XtSetArg(argt[i], XmNmarginWidth,		MBOX_MARGIN_WIDTH	); i++;
    XtSetArg(argt[i], XmNshadowThickness,	SHADOW_THICKNESS	); i++;
    XtSetArg(argt[i], XmNokLabelString,		ok			); i++;
    XtSetArg(argt[i], XmNcancelLabelString,	cancel			); i++;
    XtSetArg(argt[i], XmNnoResize,		False			); i++;
    XtSetArg(argt[i], XmNresizePolicy,		XmRESIZE_ANY		); i++;

    /*
     *  create the various dialogs...
     */

    /* JET - check the matte widget, and if non-null, well use that as
     * the parent for dialogs.  Otherwise use table (the original
     * toplevel widget for this func).  This is useful for Xinerama so
     * that child dialogs are centered on the matte, and not the whole
     * SLS screen.
     */
    if (matte != (Widget)NULL)
      tlev = matte;
    else
      tlev = table;


    switch (dtype) {

    case error:
	xmstr = ReadCatalogXms(MC_ERROR_SET, MC_LOGIN, "");
	XtSetArg(argt[i], XmNmessageString,		xmstr		); i++;

	w = XmCreateErrorDialog(tlev, "error_message", argt, i);
	XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_CANCEL_BUTTON));
	XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_HELP_BUTTON));

	error_message = w;
	break;


    case help:
	xmstr = ReadCatalogXms(MC_HELP_SET, MC_HELP, MC_DEF_HELP);
	XtSetArg(argt[i], XmNmessageString,		xmstr		); i++;
	w = XmCreateInformationDialog(tlev, "help_message", argt, i);
	XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_CANCEL_BUTTON));
        XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_HELP_BUTTON));

        txt_width = DisplayWidth (XtDisplay(w), DefaultScreen(XtDisplay(w)));
        txt_height = DisplayHeight (XtDisplay(w), DefaultScreen(XtDisplay(w)));
        txt_width = (txt_width > 850) ? 800 : txt_width - 50;
        txt_height = (txt_height > 900) ? 750 : txt_height - 150;
        i = InitArg(Text);
        XtSetArg(argt[i], XmNheight, txt_height); i++;
        XtSetArg(argt[i], XmNwidth, txt_width); i++;
        XtSetArg(argt[i], XmNeditMode, XmMULTI_LINE_EDIT); i++;
        XtSetArg(argt[i], XmNscrollBarDisplayPolicy, XmAS_NEEDED); i++;
        XtSetArg(argt[i], XmNscrollingPolicy, XmAUTOMATIC); i++;
        XtSetArg(argt[i], XmNeditable, False); i++;
	str = (char*) ReadCatalog(MC_HELP_SET, MC_HELP, MC_DEF_HELP);
        XtSetArg(argt[i], XmNvalue, strdup(str)); i++;
        text = XmCreateScrolledText(w, "help_message_text", argt, i);

        XtManageChild(text);
        XtManageChild(w);
        help_message = w;
	break;


    case copyright:
	if ((fp = fopen(COPYRIGHT,"r")) == NULL)
#if defined( __hp_osf )
	    xmstr = XmStringCreate("Cannot open copyright file '/usr/X11/copyright'.",
				XmFONTLIST_DEFAULT_TAG);
#else
	    xmstr = XmStringCreate("Cannot open copyright file '/etc/copyright'.",
				XmFONTLIST_DEFAULT_TAG);
#endif
	else {
	    xmstr = (XmString) NULL;
	
	    while (fgets(buffer, 128, fp) != NULL) {
		j = strlen(buffer);
		if ( buffer[j-1] == '\n' ) buffer[j-1] = '\0';
	    
		if ( xmstr != NULL )
		    xmstr = XmStringConcat(xmstr, XmStringSeparatorCreate());

		xmstr = XmStringConcat(xmstr,
	    			       XmStringCreate(buffer,
				       XmFONTLIST_DEFAULT_TAG));
	    }	    
	}

	fclose(fp);
	XtSetArg(argt[i], XmNmessageString,		xmstr		); i++;

	w = XmCreateInformationDialog(tlev, "copyright_msg", argt, i);
	XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_CANCEL_BUTTON));
	XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_HELP_BUTTON));
	
	XtAddCallback(w, XmNokCallback, CopyrightCB, (XtPointer) 0);    

	copyright_msg = w;
	break;
    

    case hostname:
	    
	nw = ReadCatalogXms(MC_LABEL_SET, MC_NW_LABEL,  MC_DEF_NW_LABEL);
	sv = ReadCatalogXms(MC_LABEL_SET, MC_START_LABEL, MC_DEF_START_LABEL);

	xmstr = ReadCatalogXms(MC_HELP_SET, MC_SYSTEM, MC_DEF_SYSTEM);
	XtSetArg(argt[i], XmNmessageString,		xmstr		); i++;
	XtSetArg(argt[i], XmNokLabelString,		nw		); i++;
	XtSetArg(argt[i], XmNcancelLabelString,		sv		); i++;

	w = XmCreateWarningDialog(tlev, "hostname_msg", argt, i);

	XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_HELP_BUTTON));

	XmStringFree(nw);
	XmStringFree(sv);

	hostname_message = w;
	break;


    case expassword:

	xmstr = ReadCatalogXms(MC_ERROR_SET, MC_PASSWD_EXPIRED, 
			    MC_DEF_PASSWD_EXPIRED);
	XtSetArg(argt[i], XmNmessageString,		xmstr		); i++;

	w = XmCreateQuestionDialog(tlev, "password_msg", argt, i);

	XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_HELP_BUTTON));

	passwd_message = w;
	break;


    case help_chooser:
	xmstr = ReadCatalogXms(MC_HELP_SET, MC_HELP_CHOOSER, MC_DEF_HELP_CHOOSER);

	w = XmCreateInformationDialog(tlev, "help_message", argt, i);
        XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_CANCEL_BUTTON));
        XtUnmanageChild(XmMessageBoxGetChild(w,XmDIALOG_HELP_BUTTON));

        txt_width = DisplayWidth (XtDisplay(w), DefaultScreen(XtDisplay(w)));
        txt_height = DisplayHeight (XtDisplay(w), DefaultScreen(XtDisplay(w)));
        txt_width = (txt_width > 850) ? 800 : txt_width - 50;
        txt_height = (txt_height > 900) ? 750 : txt_height - 150;
        i = InitArg(Text);
        XtSetArg(argt[i], XmNheight, txt_height); i++;
        XtSetArg(argt[i], XmNwidth, txt_width); i++;
        XtSetArg(argt[i], XmNeditMode, XmMULTI_LINE_EDIT); i++;
        XtSetArg(argt[i], XmNscrollBarDisplayPolicy, XmAS_NEEDED); i++;
        XtSetArg(argt[i], XmNscrollingPolicy, XmAUTOMATIC); i++;
        XtSetArg(argt[i], XmNeditable, False); i++;
        str = (char*)
	      ReadCatalog(MC_HELP_SET, MC_HELP_CHOOSER, MC_DEF_HELP_CHOOSER);
        XtSetArg(argt[i], XmNvalue, strdup(str)); i++;
        text = XmCreateScrolledText(w, "help_message_text", argt, i);

        XtManageChild(text);
        XtManageChild(w);
        help_message = w;
        break;
    }