File: MsgDialogs.c

package info (click to toggle)
gridengine 6.2-4
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 51,532 kB
  • ctags: 51,172
  • sloc: ansic: 418,155; java: 37,080; sh: 22,593; jsp: 7,699; makefile: 5,292; csh: 4,244; xml: 2,901; cpp: 2,086; perl: 1,895; tcl: 1,188; lisp: 669; ruby: 642; yacc: 393; lex: 266
file content (789 lines) | stat: -rw-r--r-- 22,702 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
/* 
 * Motif Tools Library, Version 3.1
 * $Id$
 * 
 * Written by David Flanagan.
 * Copyright (c) 1992-2001 by David Flanagan.
 * All Rights Reserved.  See the file COPYRIGHT for details.
 * This is open source software.  See the file LICENSE for details.
 * There is no warranty for this software.  See NO_WARRANTY for details.
 *
 * $Log$
 * Revision 1.2  2007/05/10 11:01:12  andre
 * AA-2007-05-10-0: Bugfix:    qmon crashes when displaying about dialog
 *                  Bugster:   6555744
 *                  Issue:     2243
 *                  Review:    RD
 *
 * Revision 1.1.1.1  2001/07/18 11:06:02  root
 * Initial checkin.
 *
 * Revision 1.2  2001/06/12 16:25:28  andre
 * *** empty log message ***
 *
 *
 */

#include <Xmt/Xmt.h>
#include <Xmt/DialogsP.h>
#include <Xmt/ScreenP.h>
#include <Xmt/Hash.h>
#include <Xm/DialogS.h>
#include <Xm/MessageB.h>
#include <X11/IntrinsicP.h>


/*
 * Message dialogs are cached per-shell.  This is unlike the Askfor
 * dialogs which are more expensive, are always full_modal, and are cached
 * per screen.  Given a shell, we look up its cache record in the
 * shell_to_cache_table hash table, and get a cached dialog from an array
 * of available dialogs.  (There may be more than one because info dialogs
 * are modeless.  We also maintain an array of help text strings for each
 * dialog that is popped up.  This string is freed when the dialog is popped
 * down.  The popped_up variable is used for the synchronous (AndWait) versions
 * of the message dialogs.  There only needs to be one variable, because
 * synchronous dialogs are always modal, locking out all other input to the
 * shell.
 */

static XmtHashTable shell_to_cache_table;

typedef struct {
    Widget *dialogs;
    String *help_strings;
    short num, max, in_use;
    Boolean popped_up;
} MsgDialogCache;


#if NeedFunctionPrototypes
static void Popdown(Widget dialog, MsgDialogCache *cache)
#else
static void Popdown(dialog, cache)
Widget dialog;
MsgDialogCache *cache;
#endif
{
    int i;

    /* first, actually pop down the dialog */
    XtUnmanageChild(dialog);

    /* figure out what item in the cache we are. */
    for(i=0; i < cache->num; i++) if (cache->dialogs[i] == dialog) break;

    /* free any help text we have */
    if (cache->help_strings[i]) {
	XtFree(cache->help_strings[i]);
	cache->help_strings[i] = NULL;
    }

    /*
     * if there is already a free dialog, destroy this one
     * and remove it from the cache.  Otherwise, just note that
     * we now have one free.
     */
    if (cache->in_use < cache->num) {
	XtDestroyWidget(dialog);
	/* now compress the remaining array elements */
	for(; i < cache->num-1; i++) cache->dialogs[i] = cache->dialogs[i+1];
	cache->num--;
    }
    
    cache->in_use--;
    cache->popped_up = False;  /* stops blocking in ...AndWait functions */
}

#if NeedFunctionPrototypes
static void OkCallback(Widget w, XtPointer tag, XtPointer data)
#else
static void OkCallback(w, tag, data)
Widget w;
XtPointer tag, data;
#endif
{
    MsgDialogCache *cache = (MsgDialogCache *)tag;
    Widget dialog = XtParent(w);

    Popdown(dialog, cache);
}

#if NeedFunctionPrototypes
static void HelpCallback(Widget w, XtPointer tag, XtPointer data)
#else
static void HelpCallback(w, tag, data)
Widget w;
XtPointer tag, data;
#endif
{
    MsgDialogCache *cache = (MsgDialogCache *)tag;
    Widget dialog = XtParent(w);
    XmString msg, help, blank, s1, s2;
    int i;

    /*
     * find the dialog in the cache; this locates the help string.
     */
    for(i=0; i < cache->num-1; i++)
	if (cache->dialogs[i] == dialog) break;

    XtVaGetValues(dialog, XmNmessageString, &msg, NULL);
    blank = XmStringSeparatorCreate();
    help = XmtCreateLocalizedXmString(w, cache->help_strings[i]);
    s1 = XmStringConcat(msg, blank);
    s2 = XmStringConcat(s1, help);
    XtVaSetValues(dialog, XmNmessageString, s2, NULL);
    XmStringFree(msg);
    XmStringFree(blank);
    XmStringFree(help);
    XmStringFree(s1);
    XmStringFree(s2);
    XtSetSensitive(w, False);
}

#if NeedFunctionPrototypes
static void CloseCallback(Widget w, XtPointer tag, XtPointer data)
#else
static void CloseCallback(w, tag, data)
Widget w;
XtPointer tag, data;
#endif
{
    MsgDialogCache *cache = (MsgDialogCache *)tag;
    Widget dialog = ((CompositeWidget)w)->composite.children[0];

    Popdown(dialog, cache);
}


#if NeedFunctionPrototypes
static Widget CreateMessageDialog(Widget shell, MsgDialogCache *cache)
#else
static Widget CreateMessageDialog(shell, cache)
Widget shell;
MsgDialogCache *cache;
#endif
{
    Widget dshell;
    Widget dialog;
    Widget ok, cancel, help;
    Arg args[5];
    int i;

    /*
     * create the dialog shell
     */
    i = 0; 
    XtSetArg(args[i], XmNallowShellResize, True); i++;
    XtSetArg(args[i], XmNdeleteResponse, XmDO_NOTHING); i++;
    dshell = XmCreateDialogShell(shell, XmtMESSAGE_DIALOG_SHELL_NAME,
				 args, i);

    /*
     * Create the message box.
     * Note that each shell and each message box we create has the
     * same name.  This is legal, but means that you cannot specify
     * different resources for different message dialogs from a
     * resource file.  This is not a problem because these widgets are
     * cached and the programmer cannot know in advance which on will
     * be used for what.
     */
    i = 0;
    XtSetArg(args[i], XmNautoUnmanage, False); i++;
    XtSetArg(args[i], XmNdefaultPosition, False); i++;
    dialog = XmCreateMessageBox(dshell, XmtMESSAGE_DIALOG_NAME, args, i);

    /*
     * Register callbacks on the Ok and Help buttons.
     * Get rid of the Cancel button; it is unused.
     */
    ok = XmMessageBoxGetChild(dialog, XmDIALOG_OK_BUTTON);
    cancel = XmMessageBoxGetChild(dialog, XmDIALOG_CANCEL_BUTTON);
    help = XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON);
    XtAddCallback(ok, XmNactivateCallback, OkCallback, cache);
    XtAddCallback(help, XmNactivateCallback, HelpCallback, cache);
    XtUnmanageChild(cancel);

    /*
     * register a callback to handle f.close on the dialog
     */
    XmtAddDeleteCallback(dshell, XmDO_NOTHING, CloseCallback,(XtPointer)cache);

    return dialog;
}

#if NeedFunctionPrototypes
static void DeleteCacheRecord(Widget w, XtPointer tag, XtPointer data)
#else
static void DeleteCacheRecord(w, tag, data)
Widget w;
XtPointer tag, data;
#endif
{
    MsgDialogCache *cache = (MsgDialogCache *)tag;
    int i;

    XtFree((char *)cache->dialogs);  /* the dialogs will be auto. destroyed */
    for(i=0; i < cache->num; i++) XtFree(cache->help_strings[i]);
    XtFree((char *)cache->help_strings);
    XtFree((char *)cache);
    XmtHashTableDelete(shell_to_cache_table, (XtPointer)w);
}

#if NeedFunctionPrototypes
static Widget GetMessageDialog(Widget shell, StringConst help_text,
			       MsgDialogCache **cache_return)
#else
static Widget GetMessageDialog(shell, help_text, cache_return)
Widget shell;
String help_text;
MsgDialogCache **cache_return;
#endif
{
    MsgDialogCache *cache;
    Widget dialog = 0, help_button;
    String help;
    
    /* the first time, create the hash table */
    if (!shell_to_cache_table)
	shell_to_cache_table = XmtHashTableCreate(3);

    /* go get or create the cache record for this shell */
    if (!XmtHashTableLookup(shell_to_cache_table, (XtPointer)shell,
			    (XtPointer *)&cache)) {
	cache = (MsgDialogCache *) XtCalloc(1, sizeof(MsgDialogCache));
	XmtHashTableStore(shell_to_cache_table, (XtPointer)shell,
			  (XtPointer)cache);
	/* set a callback on the shell to remove the cache record */
	XtAddCallback(shell, XtNdestroyCallback, DeleteCacheRecord, cache);
    }

    /* grow the arrays in the cache, if needed */
    if (cache->in_use == cache->max) {
	cache->max += 4;
	cache->dialogs = (Widget *)
	    XtRealloc((char *)cache->dialogs, cache->max * sizeof(Widget));
	cache->help_strings = (String *)
	    XtRealloc((char *)cache->help_strings, cache->max*sizeof(String));
    }

    /* make a copy of the help text */
    help = XtNewString(help_text);

    /* create a new widget if necessary */
    if (cache->in_use == cache->num) {
	dialog = CreateMessageDialog(shell, cache);
	cache->dialogs[cache->num] = dialog;
	cache->help_strings[cache->num] = help;
	cache->num++;
    }
    /* or find one in the cache array */
    else {
	int i;
	for(i=0; i < cache->num; i++) {
	    if (!XtIsManaged(cache->dialogs[i])) {
		dialog = cache->dialogs[i];
		cache->help_strings[i] = help;
		break;
	    }
	}
    }

    /*
     * manage or unmanage the Help button, depending on whether
     * there is any help for this dialog
     */
    help_button = XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON);
    if (help_text) {
	XtManageChild(help_button);
	XtSetSensitive(help_button, True);
    }
    else
	XtUnmanageChild(help_button);

    cache->in_use++;
    *cache_return = cache;
    return dialog;
}



typedef struct {
    StringConst message;
    StringConst title;
    StringConst help;
    Pixmap icon;
} MessageDialogData;

static XtResource resources[] = {
{XmtNmessage, XmtCMessage, XtRString,
     sizeof(String), XtOffsetOf(MessageDialogData, message),
     XtRString, NULL},
{XmtNtitle, XmtCTitle, XtRString,
     sizeof(String), XtOffsetOf(MessageDialogData, title),
     XtRString, NULL},
{XmtNhelpText, XmtCHelpText, XtRString,
     sizeof(String), XtOffsetOf(MessageDialogData, help),
     XtRString, NULL},
{XmtNicon, XmtCIcon, XtRPixmap,
     sizeof(Pixmap), XtOffsetOf(MessageDialogData, icon),
     XtRPixmap, (XtPointer) None},
};

#if NeedFunctionPrototypes
Boolean *_XmtDisplayMessage(Widget w,
                            StringConst dialog_name, StringConst dialog_class,
                            StringConst msg_default, va_list *msg_args,
                            StringConst title_default,
                            StringConst help_default, Pixmap icon_default,
                            int type, int style)
#else
Boolean *_XmtDisplayMessage(w, dialog_name, dialog_class,
                            msg_default, msg_args,
                            title_default, help_default, icon_default,
                            type, style)
Widget w;
StringConst dialog_name, dialog_class;
StringConst msg_default;
va_list *msg_args;
StringConst title_default, help_default;
Pixmap icon_default;
int type;
int style;
#endif
{
    Widget shell;
    Widget dialog;
    MessageDialogData data;
    XmString msg, title;
    Arg args[5];
    char buffer[20000];
    MsgDialogCache *cache;
    int i;
    static String message_title_default;
    static String info_title_default;
    static String error_title_default;
    static String warning_title_default;

    /*
     * go figure out which shell the dialog is cached for.
     * make sure it is not a menu shell.
     */
    shell = XmtGetShell(w);
    while(XtIsOverrideShell(shell)) shell = XmtGetShell(XtParent(shell));

    /* localize title defaults, first time only */
    if (!message_title_default) {
	message_title_default = XmtLocalize2(w,XmtMESSAGE_DIALOG_TITLE_DEFAULT,
					     "XmtDisplayMessage",
					     "messageTitle");
	info_title_default = XmtLocalize2(w, XmtINFO_DIALOG_TITLE_DEFAULT,
					  "XmtDisplayMessage", "helpTitle");
	error_title_default = XmtLocalize2(w, XmtERROR_DIALOG_TITLE_DEFAULT,
					   "XmtDisplayMessage", "errorTitle");
	warning_title_default = XmtLocalize2(w,XmtWARNING_DIALOG_TITLE_DEFAULT,
					     "XmtDisplayMessage",
					     "warningTitle");
    }

    /* If NULL arguments were supplied, set up defaults */
    if (msg_default == NULL) msg_default = "";
    if (title_default == NULL) {
	switch(type) {
	case XmDIALOG_MESSAGE:
	    title_default = message_title_default; break;
	case XmDIALOG_INFORMATION:
	    title_default = info_title_default; break;
	case XmDIALOG_ERROR:
	    title_default = error_title_default; break;
	case XmDIALOG_WARNING:
	    title_default = warning_title_default; break;
	}
    }

    if ((dialog_class == NULL)&& (dialog_name != NULL)) {
	switch(type) {
	case XmDIALOG_MESSAGE:
	    dialog_class = XmtCMessageDialog;
	    break;
	case XmDIALOG_INFORMATION:
	    dialog_class = XmtCInformationDialog;
	    break;
   	case XmDIALOG_ERROR:
	    dialog_class = XmtCErrorDialog;
	    break;
	case XmDIALOG_WARNING:
	    dialog_class = XmtCWarningDialog;
	    break;
	}
    }

    /*
     * If this message has a name, look up its resources.
     * Note that we look up resources under whatever shell is closest
     * to the widget that requested this dialog.
     */
    if (dialog_name != NULL) {
	resources[0].default_addr = (XtPointer) msg_default;
	resources[1].default_addr = (XtPointer) title_default;
	resources[2].default_addr = (XtPointer) help_default;
	resources[3].default_addr = (XtPointer) icon_default;
	XtGetSubresources(shell, (XtPointer)&data,
			  dialog_name, dialog_class,
			  resources, XtNumber(resources), NULL, 0);
    }
    else { /* otherwise set them ourselves */
	data.message = msg_default;
	data.title = title_default;
	data.help = help_default;
	data.icon = icon_default;
    }

    /* find a dialog to reuse or create a new one */
    dialog = GetMessageDialog(shell, data.help, &cache);

    /*
     * if there were printf args, sprintf the message.
     * If there was a default message, and it was overridden,
     * check whether the arguments of the new message match
     * so we don't get a core dump
     */
    if (msg_args) {
	if (msg_default && (msg_default != data.message)) {
	    if (!XmtCheckPrintfFormat(msg_default, data.message)) {
		XmtWarningMsg("XmtDisplayMessage", "badfmt",
			      "message specified for dialog '%s' has bad format.\n\tUsing default message.",
			      dialog_name);
		data.message = msg_default;
	    }
	}
	vsnprintf(buffer, sizeof(buffer), data.message, *msg_args);
	data.message = buffer;
    }
    
    /* create XmStrings */
    msg = XmtCreateLocalizedXmString(w, data.message);
    title = XmtCreateLocalizedXmString(w, data.title);
    
    /*
     * reset the type of the dialog so that the next call will change it.
     * This is reqired to reset a custom icon back to the default icon
     * when the type doesn't change
     */
    XtSetArg(args[0], XmNdialogType, XmDIALOG_MESSAGE);
    XtSetValues(dialog, args, 1);

    /* set the message and title and dialog type */
    i = 0;
    XtSetArg(args[i], XmNdialogTitle, title); i++;
    XtSetArg(args[i], XmNmessageString, msg); i++;
    XtSetArg(args[i], XmNdialogType, type); i++;
    XtSetArg(args[i], XmNdialogStyle, style); i++;
    if (data.icon || type == XmDIALOG_MESSAGE) {
	XtSetArg(args[i], XmNsymbolPixmap,
		 data.icon?data.icon:XmUNSPECIFIED_PIXMAP);
	i++;
    }
    XtSetValues(dialog, args, i);

    /* free the XmStrings */
    XmStringFree(msg);
    XmStringFree(title);
    
    /* tell the dialog who it is transient for */
    XtVaSetValues(XtParent(dialog), XtNtransientFor, shell, NULL);

    /* Now position the dialog over the shell and pop it up */
    XmtDialogPosition(dialog, shell);
    cache->popped_up = True;
    XtManageChild(dialog);
    return &cache->popped_up;
}

#if NeedVarargsPrototypes
void XmtDisplayMessage(Widget w, StringConst name, StringConst class,
		       StringConst message, StringConst title,
		       StringConst help, Pixmap icon,
		       int modality, int type, ...)
#else
void XmtDisplayMessage(w, name, class, message, title, help, icon,
		       modality, type, va_alist)
Widget w;
String name, class, message, title, help;
Pixmap icon;
int modality, type;
va_dcl
#endif
{
    va_list args;
    
    Va_start(args, type);
    _XmtDisplayMessage(w, name, class, message, &args, title, help, icon,
		       type, modality);
    va_end(args);
}

#if NeedFunctionPrototypes
void XmtDisplayMessageVaList(Widget w, StringConst name, StringConst class,
			     StringConst message, StringConst title,
			     StringConst help, Pixmap icon,
			     int modality, int type, va_list args)
#else
void XmtDisplayMessageVaList(w, name, class, message, title, help, icon,
			     modality, type, args)
Widget w;
String name, class, message, title, help;
Pixmap icon;
int modality, type;
va_list args;
#endif
{
    _XmtDisplayMessage(w, name, class, message, &args, title, help, icon,
		       type, modality);
}


#if NeedVarargsPrototypes
void XmtDisplayMessageAndWait(Widget w, StringConst name, StringConst class,
			      StringConst message, StringConst title,
			      StringConst help, Pixmap icon,
			      int modality, int type, ...)
#else
void XmtDisplayMessageAndWait(w, name, class, message, title, help, icon,
			      modality, type, va_alist)
Widget w;
String name, class, message, title, help;
Pixmap icon;
int modality, type;
va_dcl
#endif
{
    va_list args;
    Boolean *block;
    
    if (modality == XmDIALOG_MODELESS) {
	XmtWarningMsg("XmtDisplayMessageAndWait", "modality",
		      "Can't use a modeless dialog with a blocking function.");
	modality = XmDIALOG_PRIMARY_APPLICATION_MODAL;
    }

    Va_start(args, type);
    block = _XmtDisplayMessage(w, name, class, message, &args,
			       title, help, icon, type, modality);
    va_end(args);
    XmtBlock(w, block);
}


#if NeedFunctionPrototypes
void XmtDisplayMessageAndWaitVaList(Widget w, StringConst name, 
				    StringConst class,
				    StringConst message, StringConst title,
				    StringConst help, Pixmap icon,
				    int modality, int type, va_list args)
#else
void XmtDisplayMessageAndWaitVaList(w, name, class, message, title, help, icon,
				    modality, type, args)
Widget w;
String name, class, message, title, help;
Pixmap icon;
int modality, type;
va_list args;
#endif
{
    Boolean *block;
    
    if (modality == XmDIALOG_MODELESS) {
	XmtWarningMsg("XmtDisplayMessageAndWaitVaList", "modality",
		      "Can't use a modeless dialog with a blocking function.");
	modality = XmDIALOG_PRIMARY_APPLICATION_MODAL;
    }
    
    block = _XmtDisplayMessage(w, name, class, message, &args,
			       title, help, icon, type, modality);
    XmtBlock(w, block);
}


#if NeedFunctionPrototypes
void XmtDisplayInformation(Widget w, StringConst dialog_name,
			   StringConst msg_default, StringConst title_default)
#else
void XmtDisplayInformation(w, dialog_name, msg_default, title_default)
Widget w;
StringConst dialog_name;
StringConst msg_default;
StringConst title_default;
#endif
{
    (void)_XmtDisplayMessage(w, dialog_name, XmtCInformationDialog,
			     msg_default, NULL,
			     title_default, NULL, None, 
		             XmDIALOG_INFORMATION, XmDIALOG_MODELESS);
}

#if NeedFunctionPrototypes
void XmtDisplayWarning(Widget w, StringConst dialog_name,
		       StringConst msg_default)
#else
void XmtDisplayWarning(w, dialog_name, msg_default)
Widget w;
StringConst dialog_name;
StringConst msg_default;
#endif
{
    (void)_XmtDisplayMessage(w, dialog_name, XmtCWarningDialog,
			     msg_default, NULL, NULL, NULL, 
			     None, XmDIALOG_WARNING, 
			     XmDIALOG_PRIMARY_APPLICATION_MODAL);
}

#if NeedFunctionPrototypes
void XmtDisplayError(Widget w, StringConst dialog_name,
		     StringConst msg_default)
#else
void XmtDisplayError(w, dialog_name, msg_default)
Widget w;
StringConst dialog_name;
StringConst msg_default;
#endif
{
      (void)_XmtDisplayMessage(w, dialog_name, XmtCErrorDialog,
			       msg_default, NULL, NULL, NULL, 
			       None, XmDIALOG_ERROR,
			       XmDIALOG_PRIMARY_APPLICATION_MODAL);
}


#if NeedVarargsPrototypes
void XmtDisplayWarningMsg(Widget w, StringConst name,
			  StringConst msg_default,
			  StringConst title_default,
			  StringConst help_default,
			  ...)
#else
void XmtDisplayWarningMsg(w, name, msg_default, title_default, help_default,
			  va_alist)
Widget w;
String name, title_default, help_default, msg_default;
va_dcl
#endif
{
    va_list args;

    Va_start(args, help_default);
    (void)_XmtDisplayMessage(w, name, XmtCWarningDialog,
			     msg_default, &args,
			     title_default, help_default, None, 
			     XmDIALOG_WARNING,
			     XmDIALOG_PRIMARY_APPLICATION_MODAL);
    va_end(args);
}

#if NeedVarargsPrototypes
void XmtDisplayErrorMsg(Widget w, StringConst name,
			StringConst msg_default,
			StringConst title_default,
			StringConst help_default,
			...)
#else
void XmtDisplayErrorMsg(w, name, msg_default, title_default, help_default,
			va_alist)
Widget w;
String name, title_default, help_default, msg_default;
va_dcl
#endif
{
    va_list args;

    Va_start(args, help_default);
    (void)_XmtDisplayMessage(w, name, XmtCErrorDialog,
			     msg_default, &args,
			     title_default, help_default, None,
			     XmDIALOG_ERROR,
			     XmDIALOG_PRIMARY_APPLICATION_MODAL);
    va_end(args);
}

#if NeedVarargsPrototypes
void XmtDisplayInformationMsg(Widget w, StringConst name,
			      StringConst msg_default,
			      StringConst title_default,
			      StringConst help_default,
			      ...)
#else
void XmtDisplayInformationMsg(w, name,
			      msg_default, title_default, help_default,
			      va_alist)
Widget w;
String name, title_default, help_default, msg_default;
va_dcl
#endif
{
    va_list args;

    Va_start(args, help_default);
    (void)_XmtDisplayMessage(w, name, XmtCInformationDialog,
			     msg_default, &args,
			     title_default, help_default, None,
			     XmDIALOG_INFORMATION, XmDIALOG_MODELESS);
    va_end(args);
}

#if NeedVarargsPrototypes
void XmtDisplayWarningMsgAndWait(Widget w, StringConst name,
				 StringConst msg_default,
				 StringConst title_default,
				 StringConst help_default,
				 ...) 
#else
void XmtDisplayWarningMsgAndWait(w, name,
				 msg_default, title_default, help_default,
				 va_alist)
Widget w;
String name, title_default, help_default, msg_default;
va_dcl
#endif
{
    va_list args;
    Boolean *block;

    Va_start(args, help_default);
    block = _XmtDisplayMessage(w, name, XmtCWarningDialog,
			       msg_default, &args,
			       title_default, help_default, None,
			       XmDIALOG_WARNING,
			       XmDIALOG_PRIMARY_APPLICATION_MODAL);
    va_end(args);
    XmtBlock(w, block);
}

#if NeedVarargsPrototypes
void XmtDisplayErrorMsgAndWait(Widget w, StringConst name,
			       StringConst msg_default,
			       StringConst title_default,
			       StringConst help_default,
			       ...)
#else
void XmtDisplayErrorMsgAndWait(w, name,
			       msg_default, title_default, help_default,
			       va_alist)
Widget w;
String name, title_default, help_default, msg_default;
va_dcl
#endif
{
    va_list args;
    Boolean *block;

    Va_start(args, help_default);
    block = _XmtDisplayMessage(w, name, XmtCErrorDialog,
			       msg_default, &args,
			       title_default, help_default, None,
			       XmDIALOG_ERROR,
			       XmDIALOG_PRIMARY_APPLICATION_MODAL);
    va_end(args);
    XmtBlock(w, block);
}