1 /* file_dlg.c - part of asedit program */
2 /*
3  * Copyright 1991 - 1994,  Andrzej Stochniol, London, UK
4  *
5  * ASEDIT text editor, both binary and source (hereafter, Software) is
6  * copyrighted by Andrzej Stochniol (hereafter, AS) and ownership remains
7  * with AS.
8  *
9  * AS grants you (hereafter, Licensee) a license to use the Software
10  * for academic, research and internal business purposes only, without a
11  * fee.  Licensee may distribute the binary and source code (if released)
12  * to third parties provided that the copyright notice and this statement
13  * appears on all copies and that no charge is associated with such copies.
14  *
15  * Licensee may make derivative works.  However, if Licensee distributes
16  * any derivative work based on or derived from the Software, then
17  * Licensee will:
18  * (1) notify AS regarding its distribution of the derivative work, and
19  * (2) clearly notify users that such derivative work is a modified version
20  *      and not the original ASEDIT distributed by AS.
21  *
22  * Any Licensee wishing to make commercial use of the Software should
23  * contact AS to negotiate an appropriate license for such commercial use.
24  * Commercial use includes:
25  * (1) integration of all or part of the source code into a product for sale
26  *     or license by or on behalf of Licensee to third parties, or
27  * (2) distribution of the binary code or source code to third parties that
28  *     need it to utilize a commercial product sold or licensed by or on
29  *     behalf of Licensee.
30  *
31  * A. STOCHNIOL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS
32  * SOFTWARE FOR ANY PURPOSE.  IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR
33  * IMPLIED WARRANTY.  IN NO EVENT SHALL A. STOCHNIOL BE LIABLE FOR ANY
34  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
35  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
36  * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
37  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
38  *
39  * By using or copying this Software, Licensee agrees to abide by the
40  * copyright law and all other applicable laws, and the terms of this
41  * license.
42  * AS shall have the right to terminate this license immediately by
43  * written notice upon Licensee's breach of, or non-compliance with, any
44  * of its terms.  Licensee may be held legally responsible for any
45  * copyright infringement that is caused or encouraged by Licensee's
46  * failure to abide by the terms of this license.
47  *
48  *
49  * 	Andrzej Stochniol	(A.Stochniol@ic.ac.uk)
50  * 	30 Hatch Road
51  * 	London SW16 4PN
52  * 	UK
53  */
54 
55 
56 #include <stdio.h>
57 #include <string.h>
58 
59 #include <Xm/FileSB.h>
60 #include <Xm/MessageB.h>
61 #include <Xm/SelectioB.h>
62 #include <Xm/Frame.h>
63 #include <Xm/ToggleB.h>
64 #include <Xm/Label.h>
65 #include <Xm/RowColumn.h>
66 #include <Xm/Form.h>
67 #include <Xm/Separator.h>
68 #include <Xm/Text.h>
69 #include "asedit.h"
70 
71 
72 
73 
74 /*****************************  show_open_dialog  **************************
75 **
76 **  Show open_dialog for the specified asedit window. If it does not exist yet
77 **  create it first as a child of menu_bar.
78 */
79 
80 #ifdef _NO_PROTO
show_open_dialog(win)81 void show_open_dialog (win)
82 	aseditWindowStruct *win;
83 #else  /* ! _NO_PROTO */
84 
85 void show_open_dialog (aseditWindowStruct *win)
86 #endif
87 {
88     if(win->open_dialog == NULL)	/* first create a dialog for opening a file  */
89     {
90 	Arg		al[5];		/*  arg list		*/
91 	register  int	ac = 0;		/*  arg count		*/
92 	Widget		frame;		/* frame for view_only_toggle */
93 
94 
95 	win->open_dialog = XmCreateFileSelectionDialog(win->menu_bar,
96 			   "open_dialog", al, ac);
97 
98 	XtAddCallback (win->open_dialog, XmNokCallback,
99 		(XtCallbackProc)DialogOkCB,     mk_asdat_w(win, DIALOG_OPEN));
100 	XtAddCallback (win->open_dialog, XmNcancelCallback,
101 		(XtCallbackProc)DialogCancelCB, mk_asdat_w(win, DIALOG_OPEN));
102 	XtAddCallback (win->open_dialog, XmNhelpCallback,
103 		(XtCallbackProc)HelpCB,         mk_asdat_w(win, DIALOG_OPEN));
104 
105 	if(lstr.useOldColorSetup)
106 	{
107 	    /* set the colours for editable widgets */
108 	    Widget 		kids[3];	/*  children widgets 	*/
109 
110 	    kids[0] = XmFileSelectionBoxGetChild(win->open_dialog, XmDIALOG_TEXT);
111 	    kids[1] = XmFileSelectionBoxGetChild(win->open_dialog, XmDIALOG_FILTER_TEXT);
112 	    ac =0;
113 	    XtSetArg(al[ac], XmNbackground, select_menu_background); ac++;
114 	    XtSetValues(kids[0], al, ac);
115 	    XtSetValues(kids[1], al, ac);
116 	}
117 
118 	ac = 0;
119 	frame = XmCreateFrame(win->open_dialog, "frame", al,ac);
120 
121 	    win->view_only_toggle =  XmCreateToggleButton(frame, "open_view_only", al,ac);
122 
123 
124 #if (XmVersion == 1000)
125 	XmAddTabGroup (win->view_only_toggle);
126 #endif
127 	XtManageChild(win->view_only_toggle);
128 
129 
130 	XtManageChild(frame);
131     }
132 
133     asManageDialog (win->open_dialog);
134 
135 }   /* show_open_dialog */
136 
137 
138 
139 /*****************************  show_save_as_dialog  **************************
140 **
141 **  Show save_as_dialog for the specified asedit window with a supplied proposed
142 **  (suggested) filename. If save_as_dialog widget does not exist yet
143 **  create it first as a child of menu_bar.
144 */
145 
146 #ifdef _NO_PROTO
show_save_as_dialog(win,proposed_fname)147 void show_save_as_dialog (win, proposed_fname)
148 	aseditWindowStruct *win;
149 	char *proposed_fname;
150 #else  /* ! _NO_PROTO */
151 
152 void show_save_as_dialog (aseditWindowStruct *win, char *proposed_fname)
153 #endif
154 {
155 
156     Arg                 al[5];          /*  arg list            */
157     register  int       ac = 0;         /*  arg count           */
158     XmString  xmstr;            	/* work XmString */
159     Widget    text;             	/* text widget inside the dialog */
160 
161     if(win->save_as_dialog == NULL)
162     {
163 
164         /* create save as dialog */
165         XtSetArg (al[ac], XmNautoUnmanage, False);    ac++;
166 
167 	win->save_as_dialog = XmCreateFileSelectionDialog(win->menu_bar,
168                            "save_dialog", al, ac);
169 
170         XtAddCallback (win->save_as_dialog, XmNokCallback,
171                 (XtCallbackProc)DialogOkCB,     mk_asdat_w(win, DIALOG_SAVE_AS) );
172         XtAddCallback (win->save_as_dialog, XmNcancelCallback,
173                 (XtCallbackProc)DialogCancelCB, mk_asdat_w(win, DIALOG_SAVE_AS) );
174         XtAddCallback (win->save_as_dialog,XmNhelpCallback,
175                 (XtCallbackProc)HelpCB,         mk_asdat_w(win, DIALOG_SAVE_AS) );
176 
177 	text = XmFileSelectionBoxGetChild(win->save_as_dialog, XmDIALOG_TEXT);
178 
179 	if(lstr.useOldColorSetup)
180 	{
181 	    /* set the colours for editable widgets */
182 	    Widget          kids[3];        /*  children widgets    */
183 
184 	    kids[0] = text;
185 	    kids[1] = XmFileSelectionBoxGetChild(win->save_as_dialog, XmDIALOG_FILTER_TEXT);
186 	    ac =0;
187 	    XtSetArg(al[ac], XmNbackground, select_menu_background); ac++;
188 	    XtSetValues(kids[0], al, ac);
189 	    XtSetValues(kids[1], al, ac);
190 	}
191 
192 
193 	/* set a special callback to set the focus to the text widget
194 	   when the dialog gets its first focus */
195 
196 	/* unfortunately the idea of setting the keyboard focus to a specific
197            widget when the dialog gets the focus for the first time (using
198            two functions: focusCB, focusTO) DOES NOT work properly on DEC
199            computers with X11R4 and Motif 1.1 !!! so we are making conditional
200            compilation for all such calls.
201            (I have tried also the idea when we register the focus callbacks
202            AFTER all widgets have been managed, but UNFORTUNATELY it didn't
203            work either. Other ways of setting the focus into a predefined
204            widget using keyboard traversal failed as well, mainly because the
205            widget, and all of its ancestors,  does need to be realized BEFORE
206            you call XmProcessTraversal !
207            So I have reluctantly decided to use conditional compilation
208            #ifndef XFOCUS_BUG whenever necessary).
209         **/
210 
211 #ifndef XFOCUS_BUG
212         XtAddCallback(win->save_as_dialog, XmNfocusCallback,
213 			(XtCallbackProc)focusCB, (XtPointer)text);
214 #endif
215 
216 	/* moved here from a place below the "}" to avoid a buggy setting
217           ** on DG_UX (Motif 1.2.1) **/
218         ac = 0;
219         xmstr = XmStringCreateLtoR (proposed_fname, charset);
220 
221         XtSetArg(al[ac], XmNtextString, xmstr);  ac++;
222         XtSetValues(win->save_as_dialog, al, ac);
223         XmStringFree(xmstr);        /* free memory allocated for XmString */
224         /* now select all of the text in the text widget so when user start
225            typing the proposed file name would be replaced straightaway
226            Do that only for non-NULL or zero lenght strings...
227            (first get the text widget)
228          */
229 
230     }
231     text = XmSelectionBoxGetChild(win->save_as_dialog, XmDIALOG_TEXT);
232     if(proposed_fname && strlen(proposed_fname))
233     {
234         asManageDialog (win->save_as_dialog);
235 
236 	/* the best do NOT use it at all it makes some users confused,
237 	   and we switched that off when the DG_UX version was
238 	   generated
239 	*/
240         /***DG_UX XmTextSetSelection(text, 0, XmTextGetLastPosition(text),
241                                 CurrentTime);**/   /* *USE* the CurrentTime */
242                          /**win->timestamp_search_request);***/ /* that trick wroks only every other time ...*/
243                         /** XtLastTimestampProcessed( display)); **this work only every other time ....
244                         **/
245 
246     }
247     else asManageDialog(win->save_as_dialog);
248 
249     /* set the keyboard focus to the text widget each time the dialog pops-up */
250 #if (XmVersion == 1000)
251     _XmProcessTraversal( text, XmTRAVERSE_CURRENT);  /** private f. in Motif 1.0 **/
252 #else
253 		/* DG_UX */
254     XmProcessTraversal( text, XmTRAVERSE_CURRENT);
255 #endif
256 
257 
258 
259 }   /* show_save_as_dialog */
260 
261 
262 /*****************************  show_insert_dialog  **************************
263 **
264 **  Show insert_dialog for the specified asedit window. If it does not exist yet
265 **  create it first as a child of menu_bar.
266 */
267 
268 #ifdef _NO_PROTO
show_insert_dialog(win)269 void show_insert_dialog (win)
270         aseditWindowStruct *win;
271 #else  /* ! _NO_PROTO */
272 
273 void show_insert_dialog (aseditWindowStruct *win)
274 #endif
275 {
276     if(win->insert_dialog == NULL)        /* first create a dialog for inserting a file  */
277     {
278 	Arg             al[5];          /*  arg list            */
279         register  int   ac = 0;         /*  arg count           */
280 
281         win->insert_dialog = XmCreateFileSelectionDialog(win->menu_bar,
282                            "insert_dialog", al, ac);
283 
284         XtAddCallback (win->insert_dialog, XmNokCallback,
285                 (XtCallbackProc)DialogOkCB,     mk_asdat_w(win, DIALOG_INSERT));
286         XtAddCallback (win->insert_dialog, XmNcancelCallback,
287                 (XtCallbackProc)DialogCancelCB, mk_asdat_w(win, DIALOG_INSERT));
288         XtAddCallback (win->insert_dialog, XmNhelpCallback,
289                 (XtCallbackProc)HelpCB,         mk_asdat_w(win, DIALOG_INSERT));
290 
291 	if(lstr.useOldColorSetup)
292 	{
293 	    /* set the colours for editable widgets */
294 	    Widget          kids[3];        /*  children widgets    */
295 
296 	    kids[0] = XmFileSelectionBoxGetChild(win->insert_dialog, XmDIALOG_TEXT);
297 	    kids[1] = XmFileSelectionBoxGetChild(win->insert_dialog, XmDIALOG_FILTER_TEXT);
298 	    ac =0;
299 	    XtSetArg(al[ac], XmNbackground, select_menu_background); ac++;
300 	    XtSetValues(kids[0], al, ac);
301 	    XtSetValues(kids[1], al, ac);
302 	}
303 
304     }
305 
306     asManageDialog (win->insert_dialog);
307 
308 }   /* show_insert_dialog */
309 
310 
311 
312 
313 /*****************************  show_print_dialog  **************************
314 **
315 **  Show print_dialog for the specified asedit window.
316 **  If print_dialog widget does not exist yet
317 **  create it first as a child of menu_bar.
318 */
319 
320 #ifdef _NO_PROTO
show_print_dialog(win)321 void show_print_dialog (win)
322 	aseditWindowStruct *win;
323 #else  /* ! _NO_PROTO */
324 
325 void show_print_dialog (aseditWindowStruct *win)
326 #endif
327 {
328 
329 
330     Arg                 al[10];          /*  arg list            */
331     register  int       ac = 0;         /*  arg count           */
332     XmString  xmstr;            /* work XmString */
333     Widget    text;             /* text widget inside the prompt dialog */
334 
335     if(win->print_dialog == NULL)
336     {
337         /* create print dialog */
338 	Widget range_radio_box, form;
339 	Widget frame, print_selection_toggle, range_title;
340 	Widget kid[4];
341 
342 	XtSetArg (al[ac], XmNautoUnmanage, False);    ac++;
343 	win->print_dialog = XmCreateSelectionDialog(win->menu_bar, "print_dialog", al, ac);
344 
345 	/* unmanage unneeded apply button */
346 	kid[0] = XmSelectionBoxGetChild(win->print_dialog, XmDIALOG_APPLY_BUTTON);
347 	XtUnmanageChild (kid[0]);
348 
349 	XtAddCallback (win->print_dialog, XmNokCallback,
350 		(XtCallbackProc)DialogOkCB,     mk_asdat_w(win, DIALOG_PRINT_NEW) );
351 	XtAddCallback (win->print_dialog, XmNcancelCallback,
352 		(XtCallbackProc)DialogCancelCB, mk_asdat_w(win, DIALOG_PRINT_NEW) );
353 	XtAddCallback (win->print_dialog,XmNhelpCallback,
354 		(XtCallbackProc)HelpCB,         mk_asdat_w(win, DIALOG_PRINT_NEW) );
355 
356 	text = XmSelectionBoxGetChild(win->print_dialog, XmDIALOG_TEXT);
357 
358 	if(lstr.useOldColorSetup)
359 	{
360 	    /* set the colour for the editable text widget */
361 	    ac =0;
362 	    XtSetArg(al[ac], XmNbackground, select_menu_background); ac++;
363 	    XtSetValues(text, al, ac);
364 	}
365 
366 	ac = 0;
367 	form = XmCreateForm ( win->print_dialog, "form", al, ac );
368 
369 	ac = 0;
370 	XtSetArg(al[ac], XmNtopAttachment,   XmATTACH_FORM); ac++;
371 	XtSetArg(al[ac], XmNleftAttachment,  XmATTACH_FORM); ac++;
372 	range_title = XmCreateLabel ( form, "range_title", al, ac );
373 
374 	ac=0;
375 	XtSetArg(al[ac], XmNtopAttachment,   XmATTACH_WIDGET);  ac++;
376 	XtSetArg(al[ac], XmNtopWidget,       range_title);    ac++;
377 	XtSetArg(al[ac], XmNleftAttachment,  XmATTACH_FORM);    ac++;
378 	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);    ac++;
379 
380 	    {	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM);    ac++; }
381 
382 	frame = XmCreateFrame ( form, "frame", al, ac );
383 
384 	ac=0;
385 	range_radio_box = XmCreateRadioBox( frame, "range_radio_box", al, ac );
386 #if (XmVersion == 1000)
387 	XmAddTabGroup (range_radio_box);
388 #endif
389 
390 	ac=0;
391 	print_selection_toggle =  XmCreateToggleButton(range_radio_box, "selection", al,ac);
392 	ac = 0;
393 	win->print_complete_toggle =  XmCreateToggleButton(range_radio_box, "complete", al,ac);
394 
395 	checkRadioBoxSetting(range_radio_box, 0);	/* check (& correct) the toggle button settings
396 							   done by the user through resources */
397 
398 
399 
400 	/* manage the children and manage the manager parents as we ascend back up*/
401 
402 	ac = 0;
403 	kid[ac++] = print_selection_toggle;
404 	kid[ac++] = win->print_complete_toggle;
405 	XtManageChildren(kid, ac);
406 	XtManageChild(range_radio_box);
407 	XtManageChild(frame);
408 
409 	ac = 0;
410 	kid[ac++] = range_title;
411 	XtManageChildren(kid, ac);
412 	XtManageChild(form);
413 
414 
415 
416 	/* set a special callback to set the focus to the text widget
417 	   when the dialog gets its first focus */
418 
419 #ifndef XFOCUS_BUG
420 	XtAddCallback(win->print_dialog, XmNfocusCallback,
421 			(XtCallbackProc)focusCB, (XtPointer)text);
422 #endif
423     }
424     text = XmSelectionBoxGetChild(win->print_dialog, XmDIALOG_TEXT);
425 
426     asManageDialog(win->print_dialog);
427 
428     /* set the keyboard focus to the text widget each time the dialog pops-up */
429 #if (XmVersion == 1000)
430     _XmProcessTraversal( text, XmTRAVERSE_CURRENT);  /** private f. in Motif 1.0 **/
431 #else
432     XmProcessTraversal( text, XmTRAVERSE_CURRENT);
433 #endif
434 
435 
436 }   /* show_print_dialog */
437 
438 
439 
440 /***********************  show_save_changes_dialog  ************************
441 **
442 **  Show save_changes_dialog for the specified asedit window. If it does not
443 **  exist yet create it first as a child of ** toplevel ** (it must be
444 **  possible to show the dialog even when the asedit window is iconized !!)
445 */
446 
447 #ifdef _NO_PROTO
show_save_changes_dialog(win)448 void show_save_changes_dialog (win)
449 	aseditWindowStruct *win;
450 #else  /* ! _NO_PROTO */
451 
452 void show_save_changes_dialog (aseditWindowStruct *win)
453 #endif
454 {
455     Arg			al[7];		/*  arg list		*/
456     register  int	ac = 0;		/*  arg count		*/
457     char 		work[326];
458     XmString		xmstr;		/*  work XmString */
459     Widget		label;
460 
461     if(win->save_changes_dialog == NULL)	/* first create the dialog  */
462     {
463 	Dimension width, height;
464 
465 	/* create save changes warning dialog */
466 	XtSetArg(al[ac], XmNdialogStyle, XmDIALOG_PRIMARY_APPLICATION_MODAL); ac++;
467 	XtSetArg (al[ac], XmNautoUnmanage, False);    ac++;
468 	XtSetArg (al[ac], XmNdefaultPosition, False); ac++;
469 
470 
471 #ifdef PRE_127_PIXMAPS
472 	win->save_changes_dialog = create_4buttons_image_dialog( toplevel, "save_warning",
473 				      "as_warning_image", (char *)lstr.fq_save_changes, al, ac);
474 #else
475 	/* new 1.27 approach */
476 	win->save_changes_dialog = create_4buttons_dialog( toplevel, "save_warning",
477 				      xm_excl_mark, (char *)lstr.fq_save_changes, al, ac);
478 #endif
479 	ac = 0;
480 	XtSetArg(al[ac], XmNwidth,  &width);    ac++;
481         XtSetArg(al[ac], XmNheight, &height);   ac++;
482 	XtGetValues (win->save_changes_dialog, al, ac);
483 
484 	/* initially position the dialog in the middle of the screen */
485 	ac = 0;
486 	XtSetArg(al[ac], XmNx, (int)(WidthOfScreen(XtScreen(toplevel))-width)/2);  ac++;
487 	XtSetArg(al[ac], XmNy, (int)(HeightOfScreen(XtScreen(toplevel))-height)/2);  ac++;
488 	XtSetValues (win->save_changes_dialog, al, ac);
489 
490 	XtAddCallback (win->save_changes_dialog, XmNokCallback,
491 		       (XtCallbackProc)DialogOkCB, 	mk_asdat_w(win, DIALOG_SAVE_CHANGES) );
492         XtAddCallback (win->save_changes_dialog, XmNapplyCallback,            /* No answer */
493                         (XtCallbackProc)DialogApplyCB,  mk_asdat_w(win, DIALOG_SAVE_CHANGES) );
494 	XtAddCallback (win->save_changes_dialog, XmNcancelCallback,
495 		       (XtCallbackProc)DialogCancelCB,  mk_asdat_w(win, DIALOG_SAVE_CHANGES) );
496 	XtAddCallback (win->save_changes_dialog, XmNhelpCallback,
497 		       (XtCallbackProc)HelpCB, mk_asdat_w(win, DIALOG_SAVE_CHANGES) );
498     }
499 
500     /* get the label widget inside save_changes_dialog from the userData resource */
501     ac = 0;
502     XtSetArg(al[ac], XmNuserData, &label);  ac++;
503     XtGetValues(win->save_changes_dialog, al, ac);
504 
505     ac = 0;
506     sprintf(work, (char *)lstr.fq_save_changes, win->filename);
507 
508     xmstr = XmStringCreateLtoR(work, charset);
509     XtSetArg(al[ac], XmNlabelString, xmstr );  ac++;
510     XtSetValues(label, al, ac);
511     XmStringFree(xmstr);
512 
513     asManageDialog (win->save_changes_dialog);
514 
515 
516 }   /* show_save_changes_dialog */
517 
518 
519 
520 /***********************  show_overwrite_question  ************************
521 **
522 **  Show overwrite_question for the specified asedit window. If it does not
523 **  exist yet create it first as a child of menu_bar.
524 */
525 
526 #ifdef _NO_PROTO
show_overwrite_question(win,filename)527 void show_overwrite_question (win, filename)
528 	aseditWindowStruct *win;
529 	char 	           *filename;
530 #else  /* ! _NO_PROTO */
531 
532 void show_overwrite_question (aseditWindowStruct *win, char *filename)
533 #endif
534 {
535     Arg			al[5];		/*  arg list		*/
536     register  int	ac = 0;		/*  arg count		*/
537     char 		work[326];
538     XmString		xmstr;		/*  work XmString */
539 
540 
541     if(win->overwrite_question == NULL)	/* first create the dialog  */
542     {
543 
544 	/* create the overwrite_question widget */
545 	ac = 0;
546 	strcpy(work, (char *)lstr.fq_overwrite);	/* it will be set properly below */
547 	xmstr = XmStringCreateLtoR(work, charset);
548 	XtSetArg(al[ac], XmNdialogStyle, XmDIALOG_PRIMARY_APPLICATION_MODAL); ac++;
549 	XtSetArg (al[ac], XmNautoUnmanage, False);    ac++;
550 	XtSetArg(al[ac], XmNmessageString, xmstr );  ac++;
551 	win->overwrite_question = XmCreateQuestionDialog (win->menu_bar, "overwrite_question",al,ac);
552 	XmStringFree(xmstr);		/* free memory allocated for XmString */
553 
554 	XtAddCallback (win->overwrite_question, XmNokCallback,
555 			(XtCallbackProc)DialogOkCB,     mk_asdat_w(win, QUESTION_OVERWRITE) );
556 	XtAddCallback (win->overwrite_question, XmNcancelCallback,
557 			(XtCallbackProc)DialogCancelCB, mk_asdat_w(win, QUESTION_OVERWRITE) );
558 	XtAddCallback (win->overwrite_question, XmNhelpCallback,
559 			(XtCallbackProc)HelpCB,         mk_asdat_w(win, QUESTION_OVERWRITE) );
560 
561     }
562     ac = 0;
563     sprintf(work, (char *)lstr.fq_overwrite, filename);
564 
565     xmstr = XmStringCreateLtoR(work, charset);
566     XtSetArg(al[ac], XmNmessageString, xmstr );  ac++;
567     XtSetValues(win->overwrite_question, al, ac);
568     XmStringFree(xmstr);
569     asManageDialog (win->overwrite_question);
570 
571 }   /*  show_overwrite_question */
572 
573 
574 #ifdef PRE_127_PIXMAPS
575 
576 #include "warning.xbm"
577 #include "question.xbm"
578 
579 #endif
580 
581 /*****************************  install_as_images  **************************
582 **
583 **	Install as's images needed by asedit in different dialogs.
584 */
585 #ifdef _NO_PROTO
install_as_images(parent)586 void install_as_images (parent)
587     Widget parent;
588 #else  /* ! _NO_PROTO */
589 
590 void install_as_images (Widget parent)
591 #endif
592 {
593     XImage		*image;		/*  image for warning pixmap	*/
594     XImage		*image2;
595     Pixel           foreground;     /*  dialog foreground             */
596     Pixel           background;     /*  dialog background             */
597     Arg             al[10];         /*  arg list                      */
598     register int    ac;             /*  arg count                     */
599 
600 
601 
602     /* get the colours to be used for pixmap */
603     ac = 0;
604     XtSetArg(al[ac], XmNforeground, &foreground); ac++;
605     XtSetArg(al[ac], XmNbackground, &background); ac++;
606     XtGetValues(parent, al, ac);
607 
608 #ifdef PRE_127_PIXMAPS
609 
610     image = CreateDefaultImage (warning_bits, warning_width, warning_height);
611     XmInstallImage (image, "as_warning_image");
612 
613     image2 = CreateDefaultImage (question_bits, question_width, question_height);
614     XmInstallImage (image2, "as_question_image");
615 
616 #if !defined(__alpha) && !defined(GET_PIXMAP_BUG)
617     xm_question_mark = XmGetPixmap(XtScreen(parent), "as_question_image",
618                              foreground, background);
619 #else
620     /* on DEC ALPHA using OSF 1 when XmGetPixmap is called we get core dump, i.e
621        something is wrongly implemented with the CacheImage, so we use the following
622        workaround....
623     */
624     xm_question_mark = XCreatePixmapFromBitmapData(display, DefaultRootWindow (display),
625 	(char *) question_bits, question_width, question_height,
626 	foreground, background,
627 	DefaultDepthOfScreen (DefaultScreenOfDisplay (display)));
628 
629 #endif /* !GET_PIXMAP_BUG */
630 
631 #else
632     /* New from 1.27 way of getting 2 pixmaps needed in dialogs that have 4 buttons;
633        (actually it is old 1.1 approach which was withrawn because of worries about
634         breaking in Motif 1.2; but this did not happen);
635        We implement this again to use nice SGI IRIX 5.x pixmaps in our dialogs
636        Two extra widgets are created only for the purpose of getting the pixmaps.
637     */
638 
639     {
640 	Widget tmp_question, tmp_excl;
641 
642 	ac = 0;
643 	tmp_question = XmCreateQuestionDialog (parent, "tmp_question",al,ac);
644 	/* in the next call use "save_warning" instead of "tmp_excl" to get the necessary background for the pixmap */
645         tmp_excl     = XmCreateWarningDialog(  parent, "save_warning", al, ac);
646         /* get the question mark pixmap from above box ... - GLOBAL data */
647         ac = 0;
648         XtSetArg(al[ac], XmNsymbolPixmap, &xm_question_mark);  ac++;
649         XtGetValues(tmp_question, al, ac);
650 
651         /* get the exclaimation point pixmap from above box ... - GLOBAL data */
652         ac = 0;
653         XtSetArg(al[ac], XmNsymbolPixmap, &xm_excl_mark);  ac++;
654         XtGetValues(tmp_excl, al, ac);
655     }
656 #endif /* !PRE_127_PIXMAPS */
657 
658 }   /* install_as_images */
659 
660 
661 
662