1 /*****************************************************************************
2   FILE           : $Source: /projects/higgs1/SNNS/CVS/SNNS/xgui/sources/ui_xWidgets.c,v $
3   SHORTNAME      : xWidgets
4   SNNS VERSION   : 4.2
5 
6   PURPOSE        : easy creating of labels, string-edit, buttons, radio-buttons
7   NOTES          :
8 
9   AUTHOR         : Tilman Sommer
10   DATE           : 13.7.1990
11 
12   CHANGED BY     : Michael Vogt, Guenter Mamier
13   RCS VERSION    : $Revision: 2.30 $
14   LAST CHANGE    : $Date: 1998/03/03 14:10:49 $
15 
16     Copyright (c) 1990-1995  SNNS Group, IPVR, Univ. Stuttgart, FRG
17     Copyright (c) 1996-1998  SNNS Group, WSI, Univ. Tuebingen, FRG
18 
19 ******************************************************************************/
20 #include <config.h>
21 #include <stdlib.h>
22 #include <stdio.h>
23 #include <string.h>
24 
25 #include "ui.h"
26 #include "ui_action.h"
27 #include "ui_main.h"
28 #include "ui_mainP.h"
29 
30 #include <X11/Shell.h>
31 #include <X11/Xaw3d/Form.h>
32 #include <X11/Xaw3d/List.h>
33 #include <X11/Xaw3d/Command.h>
34 #include <X11/Xaw3d/Toggle.h>
35 #include <X11/Xaw3d/AsciiText.h>
36 #include <X11/Xaw3d/AsciiSrc.h>
37 #include <X11/Xaw3d/Label.h>
38 #include <X11/Xaw3d/MenuButton.h>
39 #include <X11/Xaw3d/Scrollbar.h>
40 
41 #ifndef Widgets
42 #include <X11/Intrinsic.h>
43 #endif
44 
45 #include "error.xbm"
46 #include "windows.xbm"
47 #include "selected.xbm"
48 #include "flags.xbm"
49 #include "ok.xbm"
50 #include "yes.xbm"
51 #include "no.xbm"
52 #include "save.xbm"
53 #include "load.xbm"
54 #include "first.xbm"
55 #include "prev.xbm"
56 #include "next.xbm"
57 #include "last.xbm"
58 #include "def.xbm"
59 #include "set.xbm"
60 #include "done.xbm"
61 #include "select.xbm"
62 #include "add.xbm"
63 #include "delete.xbm"
64 #include "delete_cand_units.xbm"
65 #include "choose.xbm"
66 #include "new.xbm"
67 #include "newL.xbm"
68 #include "look.xbm"
69 #include "more.xbm"
70 #include "topics.xbm"
71 #include "step.xbm"
72 #include "test.xbm"
73 #include "stop.xbm"
74 #include "reset.xbm"
75 #include "info.xbm"
76 #include "single.xbm"
77 #include "all.xbm"
78 #include "layers.xbm"
79 #include "setup.xbm"
80 #include "freeze.xbm"
81 #include "icon.xbm"
82 #include "show.xbm"
83 #include "mode.xbm"
84 #include "options.xbm"
85 #include "on.xbm"
86 #include "off.xbm"
87 #include "value.xbm"
88 #include "direction.xbm"
89 #include "shuffle.xbm"
90 #include "colors.xbm"
91 #include "modify.xbm"
92 #include "goto.xbm"
93 #include "init.xbm"
94 #include "connect.xbm"
95 #include "disconnect.xbm"
96 #include "standard.xbm"
97 #include "feedforward.xbm"
98 #include "net.xbm"
99 #include "pat.xbm"
100 #include "cfg.xbm"
101 #include "txt.xbm"
102 #include "help.xbm"
103 #include "print.xbm"
104 #include "printer.xbm"
105 #include "postscript.xbm"
106 #include "eps.xbm"
107 #include "dina4.xbm"
108 #include "dina3.xbm"
109 #include "usletter.xbm"
110 #include "file.xbm"
111 #include "portrait.xbm"
112 #include "landscape.xbm"
113 #include "network.xbm"
114 #include "fixed.xbm"
115 #include "value2.xbm"
116 #include "rectangle.xbm"
117 #include "circle.xbm"
118 #include "solid2.xbm"
119 #include "trans.xbm"
120 #include "cancel.xbm"
121 #include "create.xbm"
122 #include "clear.xbm"
123 #include "append.xbm"
124 #include "res.xbm"
125 #include "default.xbm"
126 #include "text.xbm"
127 #include "selection.xbm"
128 #include "background.xbm"
129 #include "maspar.xbm"
130 #include "view.xbm"
131 #include "norm.xbm"
132 #include "super3d.xbm"
133 #include "zoomin.xbm"
134 #include "zoomout.xbm"
135 #include "winner.xbm"
136 #include "use.xbm"
137 #include "delSet.xbm"
138 #include "subpat.xbm"
139 #include "parallel.xbm"
140 #include "valid.xbm"
141 #include "sel_func.xbm"
142 #include "fileP.xbm"
143 #include "controlP.xbm"
144 #include "infoP.xbm"
145 #include "display2.xbm"
146 #include "display3d.xbm"
147 #include "graph.xbm"
148 #include "bignet.xbm"
149 #include "pruning.xbm"
150 #include "print2.xbm"
151 #include "cascade.xbm"
152 #include "analyser.xbm"
153 #include "kohonen2.xbm"
154 #include "weights.xbm"
155 #include "inversion.xbm"
156 #include "projection.xbm"
157 #include "help2.xbm"
158 #include "quit.xbm"
159 #include "grid.xbm"
160 #include "enter.xbm"
161 #include "insert.xbm"
162 #include "overwrite.xbm"
163 #include "plane_to_edit.xbm"
164 #include "link_to_edit.xbm"
165 #include "type.xbm"
166 #include "pos.xbm"
167 #include "full_connection.xbm"
168 #include "shortcut_connection.xbm"
169 #include "create_td_net.xbm"
170 #include "create_net.xbm"
171 #include "jog.xbm"
172 #include "editors.xbm"
173 #include "classesP.xbm"
174 
175 /* ui_x...FromAsciiWidget */
176 #define MAX_INPUT_BUFLEN 20
177 
178 #include "ui_xWidgets.ph"
179 
180 
181 #ifdef _UNUSED_FUNCTIONS_
182 /*****************************************************************************
183   FUNCTION :  ui_addString
184 
185   PURPOSE  : adds a string to a specified array of (char *)
186   NOTES    :
187   RETURNS  :
188   UPDATE   : 1.5.1990
189 ******************************************************************************/
190 
191 
192 
ui_addString(char ** arrayPtr,int * numItems,int * allocatedItems,char * string)193 void ui_addString(char **arrayPtr,int *numItems, int *allocatedItems,char *string)
194 {
195     if (*numItems == *allocatedItems) {
196 	*allocatedItems += 10;
197 	arrayPtr =
198 	    (char **) XtRealloc(*arrayPtr, sizeof(String) * (*allocatedItems));
199     }
200     arrayPtr[(*numItems)++] = XtNewString(string);
201 }
202 
203 #endif
204 
205 /*****************************************************************************
206   FUNCTION :  ui_xAddListEntry
207 
208   PURPOSE  : adds a list entry to the specified list-widget
209   NOTES    : Changed version of the function Okay in the example program
210              xwidgets.c of the Athena Toolkit.
211   RETURNS  : void
212   UPDATE   : 1.5.1990
213 ******************************************************************************/
214 
215 
216 
ui_xAddListEntry(struct SimpleListType * listDescriptorPtr,String string)217 void ui_xAddListEntry(struct SimpleListType *listDescriptorPtr,String string)
218 {
219     if (listDescriptorPtr->noOfItems == listDescriptorPtr->noOfAllocItems) {
220 	listDescriptorPtr->noOfAllocItems += 10;
221 	 (listDescriptorPtr->listPtr) =
222 	    (String *) XtRealloc((char *) listDescriptorPtr->listPtr,
223 				 (unsigned int) sizeof(String *) * listDescriptorPtr->noOfAllocItems);
224     }
225     (listDescriptorPtr->listPtr)[(listDescriptorPtr->noOfItems)++] =
226 	XtNewString(string);
227     XawListChange(listDescriptorPtr->listWidget, listDescriptorPtr->listPtr,
228 		  listDescriptorPtr->noOfItems, 0, True);
229 }
230 
231 
232 
233 
234 
235 
236 /*****************************************************************************
237   FUNCTION :                   ui_xSetResize
238 
239   PURPOSE  : used to set the resize resource of a asciiText widget
240   NOTES    :
241   RETURNS  : void
242   UPDATE   :
243 *****************************************************************************/
244 
ui_xSetResize(Widget widget,Boolean state)245 void ui_xSetResize(Widget widget,Boolean state)
246 {
247     Cardinal      n;
248     Arg           args[3];
249 
250     n = 0;
251     if (state)
252 	XtSetArg(args[n], XtNresize, XawtextResizeWidth);
253     else
254 	XtSetArg(args[n], XtNresize, XawtextResizeNever);
255 
256     n++;
257     XtSetArg(args[n], XtNresizable, state); n++;
258     XtSetValues(widget, args, n);
259 }
260 
261 
262 /*****************************************************************************
263   FUNCTION :                   ui_xSetLabel
264 
265   PURPOSE  : used to set the label of a widget
266   NOTES    :
267   RETURNS  : void
268   UPDATE   :
269 *****************************************************************************/
270 
ui_xSetLabel(Widget widget,char * newLabel)271 void ui_xSetLabel(Widget widget,char *newLabel)
272 {
273     Cardinal      n;
274     Arg           args[2];
275 
276     n = 0;
277     XtSetArg(args[n], XtNlabel, newLabel); n++;
278     XtSetValues(widget, args, n);
279 }
280 
281 
282 
283 /*****************************************************************************
284   FUNCTION :                   ui_xSetString
285 
286   PURPOSE  : used to set the string resource of a widget
287   NOTES    :
288   RETURNS  : void
289   UPDATE   :
290 *****************************************************************************/
291 
ui_xSetString(Widget widget,char * contents)292 void ui_xSetString(Widget widget,char *contents)
293 {
294     Cardinal      n;
295     Arg           args[3];
296     uint           lenContents;
297     char          editBuf[MAXPATHLEN+1];
298 
299     if (contents == NULL)
300 	lenContents = 0;
301     else {
302 	lenContents = strlen(contents);
303 	if (lenContents > MAXPATHLEN) lenContents = MAXPATHLEN;
304 	strncpy(editBuf,contents,lenContents);
305     }
306 
307     editBuf[lenContents] = '\0';
308 
309     n = 0;
310     XtSetArg(args[n], XtNstring,editBuf); n++;
311     XtSetArg(args[n], XtNinsertPosition, lenContents); n++;
312     XtSetValues(widget, args, n);
313 }
314 
315 
316 
317 
318 /*****************************************************************************
319   FUNCTION : ui_xStringFromAsciiWidget
320 
321   PURPOSE  : used to get a string from an ascii widget
322   NOTES    :
323   RETURNS  : void
324   UPDATE   :
325 *****************************************************************************/
326 
ui_xStringFromAsciiWidget(Widget widget,char * stringVar,int maxLen)327 void ui_xStringFromAsciiWidget(Widget widget,char *stringVar,int maxLen)
328 {
329     Widget        asciiSrc;
330     XawTextBlock  textBlock;
331     Cardinal      n;
332     Arg           args[5];
333 
334     n = 0;
335     XtSetArg(args[n], XtNtextSource, &asciiSrc); n++;
336     XtGetValues(widget, args, n);
337 
338     (void) XawTextSourceRead(asciiSrc, 0, &textBlock, maxLen-1);
339 
340     if (textBlock.length > maxLen-1)
341 	textBlock.length = maxLen-1;
342 
343     strncpy(stringVar, textBlock.ptr,(uint) textBlock.length);
344     stringVar[textBlock.length] = '\0';  /* this is for safeness */
345 }
346 
347 
348 
349 
350 
351 
352 /*****************************************************************************
353   FUNCTION : ui_xFloatFromAsciiWidget
354 
355   PURPOSE  : used to get a string from a PANEL_TEXT item and transform it
356              to an float.
357   NOTES    :
358   RETURNS  : The numerical value hold from panelItem
359   UPDATE   :
360 *****************************************************************************/
361 
ui_xFloatFromAsciiWidget(Widget widget)362 float ui_xFloatFromAsciiWidget(Widget widget)
363 {
364     Widget        asciiSrc;
365     XawTextBlock  textBlock;
366     char          buf[MAX_INPUT_BUFLEN + 1];
367     Cardinal      n;
368     Arg           args[5];
369     float         rVal;
370 
371     n = 0;
372     XtSetArg(args[n], XtNtextSource, &asciiSrc); n++;
373     XtGetValues(widget, args, n);
374 
375     (void) XawTextSourceRead(asciiSrc, 0, &textBlock, MAX_INPUT_BUFLEN);
376 
377     if (textBlock.length > MAX_INPUT_BUFLEN)
378 	textBlock.length = MAX_INPUT_BUFLEN;
379 
380     strncpy(buf, textBlock.ptr, (uint) textBlock.length);
381     buf[textBlock.length] = '\0';  /* this is for safeness */
382     if (strlen(buf) == 0) return(0.0);
383     else {
384 	sscanf(buf,"%g", &rVal);
385 	return(rVal);
386     }
387 }
388 
389 
390 /*****************************************************************************
391   FUNCTION : ui_xUtilIntFromAsciiWidget
392 
393   PURPOSE  : used to get a string from a PANEL_TEXT item and transform it
394              to an integer.
395   NOTES    :
396   RETURNS  : The numerical value hold from panelItem
397   UPDATE   :
398 *****************************************************************************/
399 
ui_xIntFromAsciiWidget(Widget widget)400 int ui_xIntFromAsciiWidget(Widget widget)
401 {
402     Widget        asciiSrc;
403     XawTextBlock  textBlock;
404     char          buf[MAX_INPUT_BUFLEN + 1];
405     Cardinal      n;
406     Arg           args[5];
407 
408     n = 0;
409     XtSetArg(args[n], XtNtextSource, &asciiSrc); n++;
410     XtGetValues(widget, args, n);
411 
412     (void) XawTextSourceRead(asciiSrc, 0, &textBlock, MAX_INPUT_BUFLEN);
413 
414     if (textBlock.length > MAX_INPUT_BUFLEN)
415 	textBlock.length = MAX_INPUT_BUFLEN;
416 
417     strncpy(buf, textBlock.ptr,(uint) textBlock.length);
418     buf[textBlock.length] = '\0';  /* this is for safeness */
419     if (strlen(buf) == 0) return(0);
420     else return(atoi(buf));
421 }
422 
423 
424 
425 
426 
427 /*****************************************************************************
428   FUNCTION : ui_xGetDimensions
429 
430   PURPOSE  : get width and height of specified widget
431   NOTES    :
432   RETURNS  : void
433   UPDATE   : 1.2.1990
434 ******************************************************************************/
435 
ui_xGetDimensions(Widget widget,Dimension * width,Dimension * height)436 void ui_xGetDimensions(Widget widget,Dimension *width,Dimension *height)
437 {
438     Cardinal   n;
439     Arg	       args[15];
440 
441     n = 0;
442     XtSetArg(args[n], XtNwidth,  width); n++;
443     XtSetArg(args[n], XtNheight, height); n++;
444     XtGetValues(widget, args, n);
445 }
446 
447 
448 
449 /*****************************************************************************
450   FUNCTION : ui_xGetToggleState
451 
452   PURPOSE  : returns the state of the specified toggle
453   NOTES    : TRUE means PUSHED;
454 
455   RETURNS  : State of the Toggle
456   UPDATE   : 26.8.1990
457 ******************************************************************************/
458 
ui_xGetToggleState(Widget w)459 Bool ui_xGetToggleState(Widget w)
460 {
461     Cardinal  n;
462     Arg       args[2];
463     Boolean   state;
464 
465     n=0;
466     XtSetArg(args[n], XtNstate, &state); n++;
467     XtGetValues(w, args, n);
468     return(state == TRUE); /* prevents compatibiltiy problems */
469 }
470 
471 
472 
473 
474 /*****************************************************************************
475   FUNCTION : ui_xSetToggleState
476 
477   PURPOSE  : sets the state of the specified toggle
478   NOTES    :
479   RETURNS  : void
480   UPDATE   : 26.8.1990
481 ******************************************************************************/
482 
ui_xSetToggleState(Widget w,Bool state)483 void ui_xSetToggleState(Widget w,Bool state)
484 {
485     Cardinal n;
486     Arg       args[2];
487 
488     n=0;
489     XtSetArg(args[n], XtNstate, (Boolean) state); n++;
490     XtSetValues(w, args, n);
491 }
492 
493 
494 
495 /*****************************************************************************
496   FUNCTION : ui_setToggles
497 
498   PURPOSE  : toggles one of the radio button groups. Also resets all the other
499              buttons in the group
500   RETURNS  : void
501   NOTES    : sets the toggle variable to the new value
502 
503   UPDATE   : 14.11.97
504 *****************************************************************************/
ui_setToggles(int index,int * new,int max,Widget widgets[])505 void ui_setToggles (int index, int *new, int max, Widget widgets[])
506 {
507    int i;
508 
509    for(i=0; i<max; i++)
510        ui_xSetToggleState(widgets[i], FALSE);
511    ui_xSetToggleState(widgets[index], TRUE);
512    *new = index;
513 }
514 
515 
516 
517 
518 /*****************************************************************************
519   FUNCTION : ui_xCreateLabelItem
520 
521   PURPOSE  : create a label widget
522   NOTES    :
523   RETURNS  : The Widgetnumber of the Label
524   UPDATE   : 15.5.1990
525 ******************************************************************************/
526 
527 
ui_xCreateLabelItem(char * name,Widget parent,Dimension width,Widget left,Widget top)528 Widget   ui_xCreateLabelItem(char *name,Widget parent,Dimension width,Widget left,Widget top)
529 {
530     Cardinal n;
531     Widget   w;
532     Arg	     args[15];
533 
534     n = 0;
535     if (strcmp(name,"noSel") == 0) {
536 	XtSetArg(args[n], XtNbitmap,
537 		 (Pixmap) XCreateBitmapFromData(ui_display,
538 						XDefaultRootWindow(ui_display),
539 						selected_bits, selected_width,
540 						selected_height)); n++;
541     }
542     if (strcmp(name,"flags") == 0) {
543 	XtSetArg(args[n], XtNbitmap,
544 		 (Pixmap) XCreateBitmapFromData(ui_display,
545 						XDefaultRootWindow(ui_display),
546 						flags_bits, flags_width,
547 						flags_height)); n++;
548     }
549     XtSetArg(args[n], XtNborderWidth, 0); n++;
550     if (width != 0) {
551 	XtSetArg(args[n], XtNwidth, (XtArgVal) width); n++;
552 	XtSetArg(args[n], XtNresize, FALSE); n++;
553     } else {
554 	XtSetArg(args[n], XtNresizable, True); n++;
555 	XtSetArg(args[n], XtNresize,    TRUE); n++;
556     }
557     XtSetArg(args[n], XtNjustify, XtJustifyLeft); n++;
558 /*    XtSetArg(args[n], XtNinternalHeight, 1); n++;
559     XtSetArg(args[n], XtNinternalWidth , 1); n++;
560 */    XtSetArg(args[n], XtNfromHoriz, left); n++;
561     XtSetArg(args[n], XtNfromVert , top);  n++;
562     XtSetArg(args[n], XtNleft  , XtChainLeft); n++;
563     XtSetArg(args[n], XtNright , XtChainLeft); n++;
564     XtSetArg(args[n], XtNtop   , XtChainTop); n++;
565     XtSetArg(args[n], XtNbottom, XtChainTop); n++;
566     w = XtCreateManagedWidget(name, labelWidgetClass, parent, args, n);
567     return(w);
568 }
569 
570 /*****************************************************************************
571   FUNCTION : ui_xCreateFrameLabelItem
572 
573   PURPOSE  : create a label widget
574   NOTES    :
575   RETURNS  : The Widgetnumber of the Label
576   UPDATE   : 15.5.1990
577 ******************************************************************************/
ui_xCreateFrameLabelItem(char * name,Widget parent,Dimension width,Widget left,Widget top)578 Widget   ui_xCreateFrameLabelItem(char *name,Widget parent,Dimension width,Widget left,Widget top)
579 {
580     Cardinal n;
581     Widget   w;
582     Arg	     args[15];
583 
584     n = 0;
585     if (strcmp(name,"noSel") == 0) {
586 	XtSetArg(args[n], XtNbitmap,
587 		 (Pixmap) XCreateBitmapFromData(ui_display,
588 						XDefaultRootWindow(ui_display),
589 						selected_bits, selected_width,
590 						selected_height)); n++;
591     }
592     if (strcmp(name,"flags") == 0) {
593 	XtSetArg(args[n], XtNbitmap,
594 		 (Pixmap) XCreateBitmapFromData(ui_display,
595 						XDefaultRootWindow(ui_display),
596 						flags_bits, flags_width,
597 						flags_height)); n++;
598     }
599     XtSetArg(args[n], XtNborderWidth, 1); n++;
600     if (width != 0) {
601 	XtSetArg(args[n], XtNheight, 17); n++;
602 	XtSetArg(args[n], XtNwidth, (XtArgVal) width); n++;
603 	XtSetArg(args[n], XtNresize, FALSE); n++;
604     } else {
605 	XtSetArg(args[n], XtNresizable, True); n++;
606 	XtSetArg(args[n], XtNresize,    TRUE); n++;
607     }
608     XtSetArg(args[n], XtNjustify, XtJustifyLeft); n++;
609     XtSetArg(args[n], XtNinternalHeight, 3); n++;
610     XtSetArg(args[n], XtNinternalWidth , 4); n++;
611     XtSetArg(args[n], XtNfromHoriz, left); n++;
612     XtSetArg(args[n], XtNfromVert , top);  n++;
613     XtSetArg(args[n], XtNleft  , XtChainLeft); n++;
614     XtSetArg(args[n], XtNright , XtChainLeft); n++;
615     XtSetArg(args[n], XtNtop   , XtChainTop); n++;
616     XtSetArg(args[n], XtNbottom, XtChainTop); n++;
617     w = XtCreateManagedWidget(name, labelWidgetClass, parent, args, n);
618     return(w);
619 }
620 
621 
622 /*****************************************************************************
623   FUNCTION : ui_xCreateFrameLabelItemCentered
624 
625   PURPOSE  : create a label widget
626   NOTES    : text is centered
627   RETURNS  : The Widgetnumber of the Label
628   UPDATE   : 15.5.1990
629 ******************************************************************************/
630 
ui_xCreateFrameLabelItemCentered(char * name,Widget parent,Dimension width,Widget left,Widget top)631 Widget ui_xCreateFrameLabelItemCentered (char *name, Widget parent,
632 					 Dimension width,
633 					 Widget left, Widget top)
634 
635 {
636 
637     Cardinal n;
638     Widget   w;
639     Arg	     args[15];
640 
641     n = 0;
642     XtSetArg (args [n], XtNborderWidth, 1); n++;
643     if (width != 0)
644     {
645 	XtSetArg (args [n], XtNheight, 17); n++;
646 	XtSetArg (args [n], XtNwidth, (XtArgVal) width); n++;
647 	XtSetArg (args [n], XtNresize, FALSE); n++;
648     }
649     else
650     {
651 	XtSetArg (args [n], XtNresizable, True); n++;
652 	XtSetArg (args [n], XtNresize, TRUE); n++;
653     }
654     XtSetArg (args [n], XtNjustify, XtJustifyCenter); n++;
655     XtSetArg (args [n], XtNinternalHeight, 3); n++;
656     XtSetArg (args [n], XtNinternalWidth, 4); n++;
657     XtSetArg (args [n], XtNfromHoriz, left); n++;
658     XtSetArg (args [n], XtNfromVert, top);  n++;
659     XtSetArg (args [n], XtNleft, XtChainLeft); n++;
660     XtSetArg (args [n], XtNright, XtChainLeft); n++;
661     XtSetArg (args [n], XtNtop, XtChainTop); n++;
662     XtSetArg (args [n], XtNbottom, XtChainTop); n++;
663 
664     w = XtCreateManagedWidget (name, labelWidgetClass, parent, args, n);
665 
666     return(w);
667 
668 }
669 
670 
671 /*****************************************************************************
672   FUNCTION : ui_xCreateDialogItem
673 
674   PURPOSE  : create an ascii text widget (edit type = string)
675   NOTES    :
676   RETURNS  : The Widgetnumber of the text Widget
677   UPDATE   : 1.2.1990
678 ******************************************************************************/
679 
680 
681 
ui_xCreateDialogItem(char * name,Widget parent,char * contents,Dimension width,Widget left,Widget top)682 Widget  ui_xCreateDialogItem(char *name,Widget parent,char *contents,Dimension  width,Widget left,Widget top)
683 {
684     Cardinal        n;
685     Widget          w;
686     Arg	            args[25];
687     char            buf[MAXPATHLEN+1];
688     static XtActionsRec
689 	ActionRec [] = {{"ui_noreturn",(XtActionProc) ui_noreturn},
690 			{"ui_moveup",(XtActionProc) ui_moveup},
691 			{"ui_movedown",(XtActionProc) ui_movedown},
692 			{"ui_moveleft",(XtActionProc) ui_moveleft},
693 			{"ui_moveright",(XtActionProc) ui_moveright}};
694     XtTranslations Translation;
695 
696     uint lenContents;
697 
698     if (contents == NULL)
699 	lenContents = 0;
700     else {
701 	lenContents = strlen(contents);
702 	if (lenContents > MAXPATHLEN) lenContents = MAXPATHLEN;
703     }
704     strncpy(buf,contents,lenContents);
705     buf[lenContents] = '\0';
706 
707 
708     n = 0;
709     XtSetArg(args[n], XtNborderWidth,  1); n++;
710     XtSetArg(args[n], XtNstring   , buf); n++;
711     if (width != 0) {
712 	XtSetArg(args[n], XtNresize   , XawtextResizeNever); n++;
713 	XtSetArg(args[n], XtNwidth    , width);  n++;
714     } else {
715 	XtSetArg(args[n], XtNwidth    , 8*lenContents + 20);  n++;
716 	XtSetArg(args[n], XtNresizable, True); n++;
717 	XtSetArg(args[n], XtNresize   , XawtextResizeWidth); n++;
718     }
719     XtSetArg(args[n], XtNscrollHorizontal, XawtextScrollNever); n++;
720     XtSetArg(args[n], XtNscrollVertical  , XawtextScrollNever); n++;
721     XtSetArg(args[n], XtNinsertPosition  , lenContents);  n++;
722     XtSetArg(args[n], XtNeditType , XawtextEdit);  n++;
723     XtSetArg(args[n], XtNtype     , XawAsciiString);  n++;
724     XtSetArg(args[n], XtNfromVert , top);  n++;
725     XtSetArg(args[n], XtNfromHoriz, left);  n++;
726     XtSetArg(args[n], XtNleft  , XtChainLeft); n++;
727     XtSetArg(args[n], XtNright , XtChainLeft); n++;
728     XtSetArg(args[n], XtNtop   , XtChainTop); n++;
729     XtSetArg(args[n], XtNbottom, XtChainTop); n++;
730     w = XtCreateManagedWidget(name, asciiTextWidgetClass, parent, args, n);
731 #ifndef _HPUX_SOURCE
732     XtAppAddActions (ui_appContext, ActionRec, XtNumber (ActionRec));
733     Translation = XtParseTranslationTable ("<Key>Return: ui_noreturn()");
734     XtOverrideTranslations (w, Translation);
735     Translation = XtParseTranslationTable ("<Key>Up: ui_moveup()");
736     XtOverrideTranslations (w, Translation);
737     Translation = XtParseTranslationTable ("<Key>Down: ui_movedown()");
738     XtOverrideTranslations (w, Translation);
739 /*
740     Translation = XtParseTranslationTable ("<Key>Tab: ui_moveleft()");
741     XtOverrideTranslations (w, Translation);
742 */
743     Translation = XtParseTranslationTable ("<Key>Tab: ui_moveright()");
744     XtOverrideTranslations (w, Translation);
745 #endif
746     return(w);
747 }
748 
749 
750 
751 /*****************************************************************************
752   FUNCTION : ui_xCreateButtonItem
753 
754   PURPOSE  : create a command widget
755   NOTES    :
756   RETURNS  : The Widgetnumber of the command widget
757   UPDATE   : 18.5.1990
758 ******************************************************************************/
759 
ui_xCreateButtonItem(char * name,Widget parent,Widget left,Widget top)760 Widget  ui_xCreateButtonItem(char *name,Widget parent,Widget left,Widget top)
761 {
762     Cardinal n;
763     Widget   w;
764     Arg	     args[15];
765 
766     n = 0;
767     if (strcmp(name,"3dP") == 0) {
768 	XtSetArg(args[n], XtNbitmap,
769 		 (Pixmap) XCreateBitmapFromData(ui_display,
770 						XDefaultRootWindow(ui_display),
771 						display3d_bits, display2_width,
772 						display2_height)); n++;
773     }
774     else if (strcmp(name,"add") == 0) {
775 	XtSetArg(args[n], XtNbitmap,
776 		 (Pixmap) XCreateBitmapFromData(ui_display,
777 						XDefaultRootWindow(ui_display),
778 						add_bits, add_width,
779 						add_height)); n++;
780     }
781     else if (strcmp(name,"all") == 0) {
782 	XtSetArg(args[n], XtNbitmap,
783 		 (Pixmap) XCreateBitmapFromData(ui_display,
784 						XDefaultRootWindow(ui_display),
785 						all_bits, all_width,
786 						all_height)); n++;
787     }
788     else if (strcmp(name,"analyzeP") == 0) {
789 	XtSetArg(args[n], XtNbitmap,
790 		 (Pixmap) XCreateBitmapFromData(ui_display,
791 						XDefaultRootWindow(ui_display),
792 						analyser_bits, display2_width,
793 						display2_height)); n++;
794     }
795     else if (strcmp(name,"cancel") == 0) {
796         XtSetArg(args[n], XtNbitmap,
797                  (Pixmap) XCreateBitmapFromData(ui_display,
798                                                 XDefaultRootWindow(ui_display),
799                                                 cancel_bits, cancel_width,
800                                                 cancel_height)); n++;
801     }
802     else if (strcmp(name,"cascadeP") == 0) {
803 	XtSetArg(args[n], XtNbitmap,
804 		 (Pixmap) XCreateBitmapFromData(ui_display,
805 						XDefaultRootWindow(ui_display),
806 						cascade_bits, display2_width,
807 						display2_height)); n++;
808     }
809     else if (strcmp(name,"choose") == 0) {
810 	XtSetArg(args[n], XtNbitmap,
811 		 (Pixmap) XCreateBitmapFromData(ui_display,
812 						XDefaultRootWindow(ui_display),
813 						choose_bits, choose_width,
814 						choose_height)); n++;
815     }
816     else if (strcmp(name,"classesP") == 0) {
817 	XtSetArg(args[n], XtNbitmap,
818 		 (Pixmap) XCreateBitmapFromData(ui_display,
819 						XDefaultRootWindow(ui_display),
820 						classesP_bits, classesP_width,
821 						classesP_height)); n++;
822     }
823     else if (strcmp (name, "clear") == 0){
824         XtSetArg(args[n], XtNbitmap,
825 		 (Pixmap) XCreateBitmapFromData(ui_display,
826 						XDefaultRootWindow(ui_display),
827 						clear_bits, clear_width,
828 						clear_height)); n++;
829     }
830     else if (strcmp(name,"color") == 0) {
831 	XtSetArg(args[n], XtNbitmap,
832 		 (Pixmap) XCreateBitmapFromData(ui_display,
833 						XDefaultRootWindow(ui_display),
834 						color_bits, color_width,
835 						color_height)); n++;
836     }
837     else if (strcmp(name,"controlP") == 0) {
838 	XtSetArg(args[n], XtNbitmap,
839 		 (Pixmap) XCreateBitmapFromData(ui_display,
840 						XDefaultRootWindow(ui_display),
841 						controlP_bits, controlP_width,
842 						controlP_height)); n++;
843     }
844     else if (strcmp (name, "create_net") == 0) {
845         XtSetArg(args[n], XtNbitmap,
846 		 (Pixmap) XCreateBitmapFromData(ui_display,
847 						XDefaultRootWindow(ui_display),
848 						create_net_bits,
849 						create_net_width,
850 						create_net_height)); n++;
851     }
852     else if (strcmp (name, "create_td_net") == 0) {
853         XtSetArg(args[n], XtNbitmap,
854 		 (Pixmap) XCreateBitmapFromData(ui_display,
855 						XDefaultRootWindow(ui_display),
856 						create_td_net_bits,
857 						create_td_net_width,
858 						create_td_net_height)); n++;
859     }
860     else if (strcmp(name,"default") == 0) {
861 	XtSetArg(args[n], XtNbitmap,
862 		 (Pixmap) XCreateBitmapFromData(ui_display,
863 						XDefaultRootWindow(ui_display),
864 						def_bits, def_width,
865 						def_height)); n++;
866     }
867     else if (strcmp(name,"default2") == 0) {
868         XtSetArg(args[n], XtNbitmap,
869                  (Pixmap) XCreateBitmapFromData(ui_display,
870                                                 XDefaultRootWindow(ui_display),
871                                                 default_bits, default_width,
872 						default_height)); n++;
873     }
874     else if (strcmp(name,"delete") == 0) {
875 	XtSetArg(args[n], XtNbitmap,
876 		 (Pixmap) XCreateBitmapFromData(ui_display,
877 						XDefaultRootWindow(ui_display),
878 						delete_bits, delete_width,
879 						delete_height)); n++;
880     }
881     else if (strcmp (name, "delete_cand_units") == 0){
882         XtSetArg(args[n], XtNbitmap,
883 		 (Pixmap)XCreateBitmapFromData(ui_display,
884 					      XDefaultRootWindow (ui_display),
885 					      delete_cand_units_bits,
886 					      delete_cand_units_width,
887 					      delete_cand_units_height)); n++;
888     }
889     else if (strcmp(name,"displayP") == 0) {
890 	XtSetArg(args[n], XtNbitmap,
891 		 (Pixmap) XCreateBitmapFromData(ui_display,
892 						XDefaultRootWindow(ui_display),
893 						display2_bits, display2_width,
894 						display2_height)); n++;
895     }
896     else if (strcmp(name,"done") == 0) {
897 	XtSetArg(args[n], XtNbitmap,
898 		 (Pixmap) XCreateBitmapFromData(ui_display,
899 						XDefaultRootWindow(ui_display),
900 						done_bits, done_width,
901 						done_height)); n++;
902     }
903     else if (strcmp (name, "enter") == 0) {
904         XtSetArg(args[n], XtNbitmap,
905 		 (Pixmap) XCreateBitmapFromData(ui_display,
906 						XDefaultRootWindow(ui_display),
907 						enter_bits, enter_width,
908 						enter_height)); n++;
909     }
910     else if (strcmp(name,"error") == 0) {
911 	XtSetArg(args[n], XtNbitmap,
912 		 (Pixmap) XCreateBitmapFromData(ui_display,
913 						XDefaultRootWindow(ui_display),
914 						error_bits, error_width,
915 						error_height)); n++;
916     }
917     else if (strcmp(name,"fileP") == 0) {
918 	XtSetArg(args[n], XtNbitmap,
919 		 (Pixmap) XCreateBitmapFromData(ui_display,
920 						XDefaultRootWindow(ui_display),
921 						fileP_bits, fileP_width,
922 						fileP_height)); n++;
923     }
924     else if (strcmp(name,"first") == 0) {
925 	XtSetArg(args[n], XtNbitmap,
926 		 (Pixmap) XCreateBitmapFromData(ui_display,
927 						XDefaultRootWindow(ui_display),
928 						first_bits, first_width,
929 						first_height)); n++;
930     }
931     else if (strcmp (name, "full_connection") == 0) {
932         XtSetArg(args[n], XtNbitmap,
933 		 (Pixmap) XCreateBitmapFromData(ui_display,
934 						XDefaultRootWindow(ui_display),
935 						full_connection_bits,
936 						full_connection_width,
937 						full_connection_height)); n++;
938     }
939     else if (strcmp(name,"goto") == 0) {
940 	XtSetArg(args[n], XtNbitmap,
941 		 (Pixmap) XCreateBitmapFromData(ui_display,
942 						XDefaultRootWindow(ui_display),
943 						goto_bits, goto_width,
944 						goto_height)); n++;
945     }
946     else if (strcmp(name,"graphP") == 0) {
947 	XtSetArg(args[n], XtNbitmap,
948 		 (Pixmap) XCreateBitmapFromData(ui_display,
949 						XDefaultRootWindow(ui_display),
950 						graph_bits, display2_width,
951 						display2_height)); n++;
952     }
953     else if (strcmp(name,"help") == 0) {
954 	XtSetArg(args[n], XtNbitmap,
955 		 (Pixmap) XCreateBitmapFromData(ui_display,
956 						XDefaultRootWindow(ui_display),
957 						help_bits, help_width,
958 						help_height)); n++;
959     }
960     else if (strcmp(name,"helpP") == 0) {
961 	XtSetArg(args[n], XtNbitmap,
962 		 (Pixmap) XCreateBitmapFromData(ui_display,
963 						XDefaultRootWindow(ui_display),
964 						help2_bits, display2_width,
965 						display2_height)); n++;
966     }
967     else if (strcmp(name,"info") == 0) {
968 	XtSetArg(args[n], XtNbitmap,
969 		 (Pixmap) XCreateBitmapFromData(ui_display,
970 						XDefaultRootWindow(ui_display),
971 						info_bits, info_width,
972 						info_height)); n++;
973     }
974     else if (strcmp(name,"infoP") == 0) {
975 	XtSetArg(args[n], XtNbitmap,
976 		 (Pixmap) XCreateBitmapFromData(ui_display,
977 						XDefaultRootWindow(ui_display),
978 						infoP_bits, infoP_width,
979 						infoP_height)); n++;
980     }
981     else if (strcmp(name,"init") == 0) {
982 	XtSetArg(args[n], XtNbitmap,
983 		 (Pixmap) XCreateBitmapFromData(ui_display,
984 						XDefaultRootWindow(ui_display),
985 						init_bits, init_width,
986 						init_height)); n++;
987     }
988     else if (strcmp (name, "insert") == 0){
989         XtSetArg(args[n], XtNbitmap,
990 		 (Pixmap) XCreateBitmapFromData(ui_display,
991 						XDefaultRootWindow(ui_display),
992 						insert_bits,insert_width,
993 						insert_height)); n++;
994     }
995     else if (strcmp(name,"inversionP") == 0) {
996 	XtSetArg(args[n], XtNbitmap,
997 		 (Pixmap) XCreateBitmapFromData(ui_display,
998 						XDefaultRootWindow(ui_display),
999 						inversion_bits, inversion_width,
1000 						inversion_height)); n++;
1001     }
1002     else if (strcmp(name,"jog") == 0) {
1003 	XtSetArg(args[n], XtNbitmap,
1004 		 (Pixmap) XCreateBitmapFromData(ui_display,
1005 						XDefaultRootWindow(ui_display),
1006 						jog_bits, jog_width,
1007 						jog_height)); n++;
1008     }
1009     else if (strcmp(name,"kohonenP") == 0) {
1010 	XtSetArg(args[n], XtNbitmap,
1011 		 (Pixmap) XCreateBitmapFromData(ui_display,
1012 						XDefaultRootWindow(ui_display),
1013 						kohonen2_bits, kohonen2_width,
1014 						kohonen2_height)); n++;
1015     }
1016     else if (strcmp(name,"last") == 0) {
1017 	XtSetArg(args[n], XtNbitmap,
1018 		 (Pixmap) XCreateBitmapFromData(ui_display,
1019 						XDefaultRootWindow(ui_display),
1020 						last_bits, last_width,
1021 						last_height)); n++;
1022     }
1023     else if (strcmp(name,"layers") == 0) {
1024 	XtSetArg(args[n], XtNbitmap,
1025 		 (Pixmap) XCreateBitmapFromData(ui_display,
1026 						XDefaultRootWindow(ui_display),
1027 						layers_bits, layers_width,
1028 						layers_height)); n++;
1029     }
1030     else if (strcmp (name, "link_to_edit") == 0){
1031         XtSetArg(args[n], XtNbitmap,
1032 		 (Pixmap) XCreateBitmapFromData(ui_display,
1033 						XDefaultRootWindow(ui_display),
1034 						link_to_edit_bits,
1035 						link_to_edit_width,
1036 						link_to_edit_height)); n++;
1037     }
1038     else if (strcmp(name,"load") == 0) {
1039 	XtSetArg(args[n], XtNbitmap,
1040 		 (Pixmap) XCreateBitmapFromData(ui_display,
1041 						XDefaultRootWindow(ui_display),
1042 						load_bits, load_width,
1043 						load_height)); n++;
1044     }
1045     else if (strcmp(name,"look") == 0) {
1046 	XtSetArg(args[n], XtNbitmap,
1047 		 (Pixmap) XCreateBitmapFromData(ui_display,
1048 						XDefaultRootWindow(ui_display),
1049 						look_bits, look_width,
1050 						look_height)); n++;
1051     }
1052     else if (strcmp(name,"maspar") == 0) {
1053 	XtSetArg(args[n], XtNbitmap,
1054 		 (Pixmap) XCreateBitmapFromData(ui_display,
1055 						XDefaultRootWindow(ui_display),
1056 						maspar_bits, maspar_width,
1057 						maspar_height)); n++;
1058     }
1059     else if (strcmp(name,"modify") == 0) {
1060 	XtSetArg(args[n], XtNbitmap,
1061 		 (Pixmap) XCreateBitmapFromData(ui_display,
1062 						XDefaultRootWindow(ui_display),
1063 						modify_bits, modify_width,
1064 						modify_height)); n++;
1065     }
1066     else if (strcmp(name,"more") == 0) {
1067 	XtSetArg(args[n], XtNbitmap,
1068 		 (Pixmap) XCreateBitmapFromData(ui_display,
1069 						XDefaultRootWindow(ui_display),
1070 						more_bits, more_width,
1071 						more_height)); n++;
1072     }
1073     else if (strcmp(name,"multiStep") == 0) {
1074 	XtSetArg(args[n], XtNbitmap,
1075 		 (Pixmap) XCreateBitmapFromData(ui_display,
1076 						XDefaultRootWindow(ui_display),
1077 						step_bits, step_width,
1078 						step_height)); n++;
1079     }
1080     else if (strcmp(name,"network") == 0) {
1081 	XtSetArg(args[n], XtNbitmap,
1082 		 (Pixmap) XCreateBitmapFromData(ui_display,
1083 						XDefaultRootWindow(ui_display),
1084 						network_bits, network_width,
1085 						network_height)); n++;
1086     }
1087     else if (strcmp(name,"new") == 0) {
1088 	XtSetArg(args[n], XtNbitmap,
1089 		 (Pixmap) XCreateBitmapFromData(ui_display,
1090 						XDefaultRootWindow(ui_display),
1091 						new_bits, new_width,
1092 						new_height)); n++;
1093     }
1094     else if (strcmp(name,"newL") == 0) {
1095 	XtSetArg(args[n], XtNbitmap,
1096 		 (Pixmap) XCreateBitmapFromData(ui_display,
1097 						XDefaultRootWindow(ui_display),
1098 						newL_bits, newL_width,
1099 						newL_height)); n++;
1100     }
1101     else if (strcmp(name,"next") == 0) {
1102 	XtSetArg(args[n], XtNbitmap,
1103 		 (Pixmap) XCreateBitmapFromData(ui_display,
1104 						XDefaultRootWindow(ui_display),
1105 						next_bits, next_width,
1106 						next_height)); n++;
1107     }
1108     else if (strcmp(name,"no") == 0) {
1109 	XtSetArg(args[n], XtNbitmap,
1110 		 (Pixmap) XCreateBitmapFromData(ui_display,
1111 						XDefaultRootWindow(ui_display),
1112 						no_bits, no_width,
1113 						no_height)); n++;
1114     }
1115     else if (strcmp(name,"ok") == 0) {
1116 	XtSetArg(args[n], XtNbitmap,
1117 		 (Pixmap) XCreateBitmapFromData(ui_display,
1118 						XDefaultRootWindow(ui_display),
1119 						ok_bits, ok_width,
1120 						ok_height)); n++;
1121     }
1122     else if (strcmp (name, "overwrite") == 0){
1123         XtSetArg(args[n], XtNbitmap,
1124 		 (Pixmap) XCreateBitmapFromData(ui_display,
1125 						XDefaultRootWindow(ui_display),
1126 						overwrite_bits,overwrite_width,
1127 						overwrite_height)); n++;
1128     }
1129     else if (strcmp (name, "plane_to_edit") == 0){
1130         XtSetArg(args[n], XtNbitmap,
1131 		 (Pixmap) XCreateBitmapFromData(ui_display,
1132 						XDefaultRootWindow(ui_display),
1133 						plane_to_edit_bits,
1134 						plane_to_edit_width,
1135 						plane_to_edit_height)); n++;
1136     }
1137     else if (strcmp (name, "pos") == 0){
1138         XtSetArg(args[n], XtNbitmap,
1139 		 (Pixmap) XCreateBitmapFromData(ui_display,
1140 						XDefaultRootWindow(ui_display),
1141 						pos_bits,pos_width,
1142 						pos_height)); n++;
1143     }
1144     else if (strcmp(name,"prev") == 0) {
1145 	XtSetArg(args[n], XtNbitmap,
1146 		 (Pixmap) XCreateBitmapFromData(ui_display,
1147 						XDefaultRootWindow(ui_display),
1148 						prev_bits, prev_width,
1149 						prev_height)); n++;
1150     }
1151     else if (strcmp(name,"print") == 0) {
1152 	XtSetArg(args[n], XtNbitmap,
1153 		 (Pixmap) XCreateBitmapFromData(ui_display,
1154 						XDefaultRootWindow(ui_display),
1155 						print_bits, print_width,
1156 						print_height)); n++;
1157     }
1158     else if (strcmp(name,"printP") == 0) {
1159 	XtSetArg(args[n], XtNbitmap,
1160 		 (Pixmap) XCreateBitmapFromData(ui_display,
1161 						XDefaultRootWindow(ui_display),
1162 						print2_bits, display2_width,
1163 						display2_height)); n++;
1164     }
1165     else if (strcmp(name,"projectP") == 0) {
1166 	XtSetArg(args[n], XtNbitmap,
1167 		 (Pixmap) XCreateBitmapFromData(ui_display,
1168 						XDefaultRootWindow(ui_display),
1169 						projection_bits, display2_width,
1170 						display2_height)); n++;
1171     }
1172     else if (strcmp(name,"prunP") == 0) {
1173 	XtSetArg(args[n], XtNbitmap,
1174 		 (Pixmap) XCreateBitmapFromData(ui_display,
1175 						XDefaultRootWindow(ui_display),
1176 						pruning_bits, display2_width,
1177 						display2_height)); n++;
1178     }
1179     else if (strcmp(name,"quitP") == 0) {
1180 	XtSetArg(args[n], XtNbitmap,
1181 		 (Pixmap) XCreateBitmapFromData(ui_display,
1182 						XDefaultRootWindow(ui_display),
1183 						quit_bits, display2_width,
1184 						display2_height)); n++;
1185     }
1186     else if (strcmp(name,"reset") == 0) {
1187 	XtSetArg(args[n], XtNbitmap,
1188 		 (Pixmap) XCreateBitmapFromData(ui_display,
1189 						XDefaultRootWindow(ui_display),
1190 						reset_bits, reset_width,
1191 						reset_height)); n++;
1192     }
1193     else if (strcmp(name,"save") == 0) {
1194 	XtSetArg(args[n], XtNbitmap,
1195 		 (Pixmap) XCreateBitmapFromData(ui_display,
1196 						XDefaultRootWindow(ui_display),
1197 						save_bits, save_width,
1198 						save_height)); n++;
1199     }
1200     else if (strcmp(name,"select") == 0) {
1201 	XtSetArg(args[n], XtNbitmap,
1202 		 (Pixmap) XCreateBitmapFromData(ui_display,
1203 						XDefaultRootWindow(ui_display),
1204 						select_bits, select_width,
1205 						select_height)); n++;
1206     }
1207     else if (strcmp(name,"set") == 0) {
1208 	XtSetArg(args[n], XtNbitmap,
1209 		 (Pixmap) XCreateBitmapFromData(ui_display,
1210 						XDefaultRootWindow(ui_display),
1211 						set_bits, set_width,
1212 						set_height)); n++;
1213     }
1214     else if (strcmp(name,"setup") == 0) {
1215 	XtSetArg(args[n], XtNbitmap,
1216 		 (Pixmap) XCreateBitmapFromData(ui_display,
1217 						XDefaultRootWindow(ui_display),
1218 						setup_bits, setup_width,
1219 						setup_height)); n++;
1220     }
1221     else if (strcmp (name, "shortcut_connection") == 0) {
1222         XtSetArg(args[n], XtNbitmap,
1223 		 (Pixmap) XCreateBitmapFromData(ui_display,
1224 						XDefaultRootWindow(ui_display),
1225 						shortcut_connection_bits,
1226 						shortcut_connection_width,
1227 						shortcut_connection_height));
1228 	n++;
1229     }
1230     else if (strcmp(name,"single") == 0) {
1231 	XtSetArg(args[n], XtNbitmap,
1232 		 (Pixmap) XCreateBitmapFromData(ui_display,
1233 						XDefaultRootWindow(ui_display),
1234 						single_bits, single_width,
1235 						single_height)); n++;
1236     }
1237     else if (strcmp(name,"stop") == 0) {
1238 	XtSetArg(args[n], XtNbitmap,
1239 		 (Pixmap) XCreateBitmapFromData(ui_display,
1240 						XDefaultRootWindow(ui_display),
1241 						stop_bits, stop_width,
1242 						stop_height)); n++;
1243     }
1244     else if (strcmp(name,"STree") == 0) {
1245 	XtSetArg(args[n], XtNbitmap,
1246 		 (Pixmap) XCreateBitmapFromData(ui_display,
1247 						XDefaultRootWindow(ui_display),
1248 						stree_bits, stree_width,
1249 						stree_height)); n++;
1250     }
1251     else if (strcmp(name,"subpat") == 0) {
1252 	XtSetArg(args[n], XtNbitmap,
1253 		 (Pixmap) XCreateBitmapFromData(ui_display,
1254 						XDefaultRootWindow(ui_display),
1255 						subpat_bits, subpat_width,
1256 						subpat_height)); n++;
1257     }
1258     else if (strcmp(name,"super3d") == 0) {
1259 	XtSetArg(args[n], XtNbitmap,
1260 		 (Pixmap) XCreateBitmapFromData(ui_display,
1261 						XDefaultRootWindow(ui_display),
1262 						super3d_bits, super3d_width,
1263 						super3d_height)); n++;
1264     }
1265     else if (strcmp(name,"test") == 0) {
1266 	XtSetArg(args[n], XtNbitmap,
1267 		 (Pixmap) XCreateBitmapFromData(ui_display,
1268 						XDefaultRootWindow(ui_display),
1269 						test_bits, test_width,
1270 						test_height)); n++;
1271     }
1272     else if (strcmp(name,"topics") == 0) {
1273 	XtSetArg(args[n], XtNbitmap,
1274 		 (Pixmap) XCreateBitmapFromData(ui_display,
1275 						XDefaultRootWindow(ui_display),
1276 						topics_bits, topics_width,
1277 						topics_height)); n++;
1278     }
1279     else if (strcmp (name, "type") == 0){
1280         XtSetArg(args[n], XtNbitmap,
1281 		 (Pixmap) XCreateBitmapFromData(ui_display,
1282 						XDefaultRootWindow(ui_display),
1283 						type_bits,type_width,
1284 						type_height)); n++;
1285     }
1286     else if (strcmp(name,"validate") == 0) {
1287 	XtSetArg(args[n], XtNbitmap,
1288 		 (Pixmap) XCreateBitmapFromData(ui_display,
1289 						XDefaultRootWindow(ui_display),
1290 						valid_bits, valid_width,
1291 						valid_height)); n++;
1292     }
1293     else if (strcmp(name,"view") == 0) {
1294 	XtSetArg(args[n], XtNbitmap,
1295 		 (Pixmap) XCreateBitmapFromData(ui_display,
1296 						XDefaultRootWindow(ui_display),
1297 						view_bits, view_width,
1298 						view_height)); n++;
1299     }
1300     else if (strcmp(name,"weightsP") == 0) {
1301 	XtSetArg(args[n], XtNbitmap,
1302 		 (Pixmap) XCreateBitmapFromData(ui_display,
1303 						XDefaultRootWindow(ui_display),
1304 						weights_bits, display2_width,
1305 						display2_height)); n++;
1306     }
1307     else if (strcmp(name,"yes") == 0) {
1308 	XtSetArg(args[n], XtNbitmap,
1309 		 (Pixmap) XCreateBitmapFromData(ui_display,
1310 						XDefaultRootWindow(ui_display),
1311 						yes_bits, yes_width,
1312 						yes_height)); n++;
1313     }
1314     else if (strcmp(name,"zoomin") == 0) {
1315 	XtSetArg(args[n], XtNbitmap,
1316 		 (Pixmap) XCreateBitmapFromData(ui_display,
1317 						XDefaultRootWindow(ui_display),
1318 						zoomin_bits, zoomin_width,
1319 						zoomin_height)); n++;
1320     }
1321     else if (strcmp(name,"zoomout") == 0) {
1322 	XtSetArg(args[n], XtNbitmap,
1323 		 (Pixmap) XCreateBitmapFromData(ui_display,
1324 						XDefaultRootWindow(ui_display),
1325 						zoomout_bits, zoomout_width,
1326 						zoomout_height)); n++;
1327     }
1328     XtSetArg(args[n], XtNborderWidth, 0 /*!*/); n++;
1329     XtSetArg(args[n], XtNinternalHeight, 1); n++;
1330     XtSetArg(args[n], XtNinternalWidth , 1); n++;
1331     XtSetArg(args[n], XtNfromVert , top);  n++;
1332     XtSetArg(args[n], XtNfromHoriz, left);  n++;
1333     XtSetArg(args[n], XtNleft  , XtChainLeft); n++;
1334     XtSetArg(args[n], XtNright , XtChainLeft); n++;
1335     XtSetArg(args[n], XtNtop   , XtChainTop); n++;
1336     XtSetArg(args[n], XtNbottom, XtChainTop); n++;
1337     w = XtCreateManagedWidget(name, commandWidgetClass, parent, args, n);
1338     return(w);
1339 }
1340 
1341 
1342 
1343 /*****************************************************************************
1344   FUNCTION : ui_xCreateMenuButtonItem
1345 
1346   PURPOSE  : create a menu button widget
1347   NOTES    :
1348   RETURNS  : The Widgetnumber
1349   UPDATE   : 13.7.1990
1350 ******************************************************************************/
1351 
ui_xCreateMenuButtonItem(char * name,Widget parent,Widget left,Widget top)1352 Widget  ui_xCreateMenuButtonItem(char *name,Widget parent,Widget left,Widget top)
1353 {
1354     Cardinal n;
1355     Widget   w;
1356     Arg	     args[15];
1357 
1358     n = 0;
1359     XtSetArg(args[n], XtNborderWidth, 0 /*!*/); n++;
1360     if (strcmp(name,"color") == 0) {
1361 	XtSetArg(args[n], XtNbitmap,
1362 		 (Pixmap) XCreateBitmapFromData(ui_display,
1363 						XDefaultRootWindow(ui_display),
1364 						color_bits, color_width,
1365 						color_height)); n++;
1366     }
1367     else if (strcmp(name,"editors") == 0) {
1368 	XtSetArg(args[n], XtNbitmap,
1369 		 (Pixmap) XCreateBitmapFromData(ui_display,
1370 						XDefaultRootWindow(ui_display),
1371 						editors_bits, editors_width,
1372 						editors_height)); n++;
1373     }
1374     else if (strcmp(name,"windows") == 0) {
1375 	XtSetArg(args[n], XtNbitmap,
1376 		 (Pixmap) XCreateBitmapFromData(ui_display,
1377 						XDefaultRootWindow(ui_display),
1378 						windows_bits, windows_width,
1379 						windows_height)); n++;
1380     }
1381     else if (strcmp(name,"icon") == 0) {
1382 	XtSetArg(args[n], XtNbitmap,
1383 		 (Pixmap) XCreateBitmapFromData(ui_display,
1384 						XDefaultRootWindow(ui_display),
1385 						icon_bits, icon_width,
1386 						icon_height)); n++;
1387     }
1388     else if (strcmp(name,"show") == 0) {
1389 	XtSetArg(args[n], XtNbitmap,
1390 		 (Pixmap) XCreateBitmapFromData(ui_display,
1391 						XDefaultRootWindow(ui_display),
1392 						show_bits, show_width,
1393 						show_height)); n++;
1394     }
1395     else if (strcmp(name,"mode") == 0) {
1396 	XtSetArg(args[n], XtNbitmap,
1397 		 (Pixmap) XCreateBitmapFromData(ui_display,
1398 						XDefaultRootWindow(ui_display),
1399 						mode_bits, mode_width,
1400 						mode_height)); n++;
1401     }
1402     else if (strcmp(name,"options") == 0) {
1403 	XtSetArg(args[n], XtNbitmap,
1404 		 (Pixmap) XCreateBitmapFromData(ui_display,
1405 						XDefaultRootWindow(ui_display),
1406 						options_bits, options_width,
1407 						options_height)); n++;
1408     }
1409     else if (strcmp(name,"use") == 0) {
1410 	XtSetArg(args[n], XtNbitmap,
1411 		 (Pixmap) XCreateBitmapFromData(ui_display,
1412 						XDefaultRootWindow(ui_display),
1413 						use_bits, use_width,
1414 						use_height)); n++;
1415     }
1416     else if (strcmp(name,"del") == 0) {
1417 	XtSetArg(args[n], XtNbitmap,
1418 		 (Pixmap) XCreateBitmapFromData(ui_display,
1419 						XDefaultRootWindow(ui_display),
1420 						delSet_bits, delSet_width,
1421 						delSet_height)); n++;
1422     }
1423     else if (strcmp(name,"func") == 0) {
1424 	XtSetArg(args[n], XtNbitmap,
1425 		 (Pixmap) XCreateBitmapFromData(ui_display,
1426 						XDefaultRootWindow(ui_display),
1427 						sel_func_bits, sel_func_width,
1428 						sel_func_height)); n++;
1429     }
1430     else if (strcmp(name,"bignetP") == 0) {
1431 	XtSetArg(args[n], XtNbitmap,
1432 		 (Pixmap) XCreateBitmapFromData(ui_display,
1433 						XDefaultRootWindow(ui_display),
1434 						bignet_bits, display2_width,
1435 						display2_height)); n++;
1436     }
1437     else{
1438 	    XtSetArg(args[n], XtNborderWidth, 1 /*!*/); n++;
1439     }
1440 
1441     XtSetArg(args[n], XtNinternalHeight, 1); n++;
1442     XtSetArg(args[n], XtNinternalWidth , 1); n++;
1443     XtSetArg(args[n], XtNfromVert , top);  n++;
1444     XtSetArg(args[n], XtNfromHoriz, left);  n++;
1445     XtSetArg(args[n], XtNleft  , XtChainLeft); n++;
1446     XtSetArg(args[n], XtNright , XtChainLeft); n++;
1447     XtSetArg(args[n], XtNtop   , XtChainTop); n++;
1448     XtSetArg(args[n], XtNbottom, XtChainTop); n++;
1449     w = XtCreateManagedWidget(name, menuButtonWidgetClass, parent, args, n);
1450     return(w);
1451 }
1452 
1453 
1454 
1455 /*****************************************************************************
1456   FUNCTION : ui_xCreateToggleItem
1457 
1458   PURPOSE  : create a toggle widget
1459   NOTES    :
1460   RETURNS  : The Widgetnumber
1461   UPDATE   : 26.6.1990
1462 ******************************************************************************/
1463 
ui_xCreateToggleItem(char * name,Widget parent,Widget group,Widget left,Widget top)1464 Widget  ui_xCreateToggleItem(char *name,Widget  parent,Widget  group,Widget  left,Widget  top)
1465 {
1466     Cardinal n;
1467     Widget   w;
1468     Arg	     args[15];
1469 
1470     n = 0;
1471     if (strcmp(name,"on") == 0) {
1472 	XtSetArg(args[n], XtNbitmap,
1473 		 (Pixmap) XCreateBitmapFromData(ui_display,
1474 						XDefaultRootWindow(ui_display),
1475 						on_bits, on_width,
1476 						on_height)); n++;
1477     }
1478     if (strcmp(name,"off") == 0) {
1479 	XtSetArg(args[n], XtNbitmap,
1480 		 (Pixmap) XCreateBitmapFromData(ui_display,
1481 						XDefaultRootWindow(ui_display),
1482 						off_bits, off_width,
1483 						off_height)); n++;
1484     }
1485     if (strcmp(name,"value") == 0) {
1486 	XtSetArg(args[n], XtNbitmap,
1487 		 (Pixmap) XCreateBitmapFromData(ui_display,
1488 						XDefaultRootWindow(ui_display),
1489 						value_bits, value_width,
1490 						value_height)); n++;
1491     }
1492     if (strcmp(name,"direction") == 0) {
1493 	XtSetArg(args[n], XtNbitmap,
1494 		 (Pixmap) XCreateBitmapFromData(ui_display,
1495 						XDefaultRootWindow(ui_display),
1496 						direction_bits, direction_width,
1497 						direction_height)); n++;
1498     }
1499     if (strcmp(name,"shuffle") == 0) {
1500 	XtSetArg(args[n], XtNbitmap,
1501 		 (Pixmap) XCreateBitmapFromData(ui_display,
1502 						XDefaultRootWindow(ui_display),
1503 						shuffle_bits, shuffle_width,
1504 						shuffle_height)); n++;
1505     }
1506     if (strcmp(name,"freeze") == 0) {
1507 	XtSetArg(args[n], XtNbitmap,
1508 		 (Pixmap) XCreateBitmapFromData(ui_display,
1509 						XDefaultRootWindow(ui_display),
1510 						freeze_bits, freeze_width,
1511 						freeze_height)); n++;
1512     }
1513     if (strcmp(name,"connect") == 0) {
1514 	XtSetArg(args[n], XtNbitmap,
1515 		 (Pixmap) XCreateBitmapFromData(ui_display,
1516 						XDefaultRootWindow(ui_display),
1517 						connect_bits, connect_width,
1518 						connect_height)); n++;
1519     }
1520     if (strcmp(name,"disconnect") == 0) {
1521 	XtSetArg(args[n], XtNbitmap,
1522 		 (Pixmap) XCreateBitmapFromData(ui_display,
1523 						XDefaultRootWindow(ui_display),
1524 						disconnect_bits, disconnect_width,
1525 						disconnect_height)); n++;
1526     }
1527     if (strcmp(name,"standard") == 0) {
1528 	XtSetArg(args[n], XtNbitmap,
1529 		 (Pixmap) XCreateBitmapFromData(ui_display,
1530 						XDefaultRootWindow(ui_display),
1531 						standard_bits, standard_width,
1532 						standard_height)); n++;
1533     }
1534     if (strcmp(name,"feedforward") == 0) {
1535 	XtSetArg(args[n], XtNbitmap,
1536 		 (Pixmap) XCreateBitmapFromData(ui_display,
1537 						XDefaultRootWindow(ui_display),
1538 						feedforward_bits, feedforward_width,
1539 						feedforward_height)); n++;
1540     }
1541     if (strcmp(name,"net") == 0) {
1542 	XtSetArg(args[n], XtNbitmap,
1543 		 (Pixmap) XCreateBitmapFromData(ui_display,
1544 						XDefaultRootWindow(ui_display),
1545 						net_bits, net_width,
1546 						net_height)); n++;
1547     }
1548     if (strcmp(name,"pat") == 0) {
1549 	XtSetArg(args[n], XtNbitmap,
1550 		 (Pixmap) XCreateBitmapFromData(ui_display,
1551 						XDefaultRootWindow(ui_display),
1552 						pat_bits, pat_width,
1553 						pat_height)); n++;
1554     }
1555     if (strcmp(name,"cfg") == 0) {
1556 	XtSetArg(args[n], XtNbitmap,
1557 		 (Pixmap) XCreateBitmapFromData(ui_display,
1558 						XDefaultRootWindow(ui_display),
1559 						cfg_bits, cfg_width,
1560 						cfg_height)); n++;
1561     }
1562     if (strcmp(name,"txt") == 0) {
1563 	XtSetArg(args[n], XtNbitmap,
1564 		 (Pixmap) XCreateBitmapFromData(ui_display,
1565 						XDefaultRootWindow(ui_display),
1566 						txt_bits, txt_width,
1567 						txt_height)); n++;
1568     }
1569     if (strcmp(name,"printer") == 0) {
1570 	XtSetArg(args[n], XtNbitmap,
1571 		 (Pixmap) XCreateBitmapFromData(ui_display,
1572 						XDefaultRootWindow(ui_display),
1573 						printer_bits, printer_width,
1574 						printer_height)); n++;
1575     }
1576     if (strcmp(name,"file") == 0) {
1577 	XtSetArg(args[n], XtNbitmap,
1578 		 (Pixmap) XCreateBitmapFromData(ui_display,
1579 						XDefaultRootWindow(ui_display),
1580 						file_bits, file_width,
1581 						file_height)); n++;
1582     }
1583     if (strcmp(name,"postscript") == 0) {
1584 	XtSetArg(args[n], XtNbitmap,
1585 		 (Pixmap) XCreateBitmapFromData(ui_display,
1586 						XDefaultRootWindow(ui_display),
1587 						postscript_bits, postscript_width,
1588 						postscript_height)); n++;
1589     }
1590     if (strcmp(name,"eps") == 0) {
1591 	XtSetArg(args[n], XtNbitmap,
1592 		 (Pixmap) XCreateBitmapFromData(ui_display,
1593 						XDefaultRootWindow(ui_display),
1594 						eps_bits, eps_width,
1595 						eps_height)); n++;
1596     }
1597     if (strcmp(name,"dina4") == 0) {
1598 	XtSetArg(args[n], XtNbitmap,
1599 		 (Pixmap) XCreateBitmapFromData(ui_display,
1600 						XDefaultRootWindow(ui_display),
1601 						dina4_bits, dina4_width,
1602 						dina4_height)); n++;
1603     }
1604     if (strcmp(name,"dina3") == 0) {
1605 	XtSetArg(args[n], XtNbitmap,
1606 		 (Pixmap) XCreateBitmapFromData(ui_display,
1607 						XDefaultRootWindow(ui_display),
1608 						dina3_bits, dina3_width,
1609 						dina3_height)); n++;
1610     }
1611     if (strcmp(name,"usletter") == 0) {
1612 	XtSetArg(args[n], XtNbitmap,
1613 		 (Pixmap) XCreateBitmapFromData(ui_display,
1614 						XDefaultRootWindow(ui_display),
1615 						usletter_bits, usletter_width,
1616 						usletter_height)); n++;
1617     }
1618     if (strcmp(name,"portrait") == 0) {
1619 	XtSetArg(args[n], XtNbitmap,
1620 		 (Pixmap) XCreateBitmapFromData(ui_display,
1621 						XDefaultRootWindow(ui_display),
1622 						portrait_bits, portrait_width,
1623 						portrait_height)); n++;
1624     }
1625     if (strcmp(name,"landscape") == 0) {
1626 	XtSetArg(args[n], XtNbitmap,
1627 		 (Pixmap) XCreateBitmapFromData(ui_display,
1628 						XDefaultRootWindow(ui_display),
1629 						landscape_bits, landscape_width,
1630 						landscape_height)); n++;
1631     }
1632     if (strcmp(name,"fixed") == 0) {
1633 	XtSetArg(args[n], XtNbitmap,
1634 		 (Pixmap) XCreateBitmapFromData(ui_display,
1635 						XDefaultRootWindow(ui_display),
1636 						fixed_bits, fixed_width,
1637 						fixed_height)); n++;
1638     }
1639     if (strcmp(name,"value2") == 0) {
1640 	XtSetArg(args[n], XtNbitmap,
1641 		 (Pixmap) XCreateBitmapFromData(ui_display,
1642 						XDefaultRootWindow(ui_display),
1643 						value2_bits, value2_width,
1644 						value2_height)); n++;
1645     }
1646     if (strcmp(name,"rectangle") == 0) {
1647 	XtSetArg(args[n], XtNbitmap,
1648 		 (Pixmap) XCreateBitmapFromData(ui_display,
1649 						XDefaultRootWindow(ui_display),
1650 						rectangle_bits, rectangle_width,
1651 						rectangle_height)); n++;
1652     }
1653     if (strcmp(name,"circle") == 0) {
1654 	XtSetArg(args[n], XtNbitmap,
1655 		 (Pixmap) XCreateBitmapFromData(ui_display,
1656 						XDefaultRootWindow(ui_display),
1657 						circle_bits, circle_width,
1658 						circle_height)); n++;
1659     }
1660     if (strcmp(name,"solid2") == 0) {
1661 	XtSetArg(args[n], XtNbitmap,
1662 		 (Pixmap) XCreateBitmapFromData(ui_display,
1663 						XDefaultRootWindow(ui_display),
1664 						solid2_bits, solid2_width,
1665 						solid2_height)); n++;
1666     }
1667     if (strcmp(name,"trans") == 0) {
1668 	XtSetArg(args[n], XtNbitmap,
1669 		 (Pixmap) XCreateBitmapFromData(ui_display,
1670 						XDefaultRootWindow(ui_display),
1671 						trans_bits, trans_width,
1672 						trans_height)); n++;
1673     }
1674     if (strcmp(name,"create") == 0) {
1675         XtSetArg(args[n], XtNbitmap,
1676                  (Pixmap) XCreateBitmapFromData(ui_display,                                                 XDefaultRootWindow(ui_display),
1677                                                 create_bits, create_width,
1678                                                 create_height)); n++;
1679     }
1680     if (strcmp(name,"append") == 0) {
1681         XtSetArg(args[n], XtNbitmap,
1682                  (Pixmap) XCreateBitmapFromData(ui_display,
1683                                                 XDefaultRootWindow(ui_display),
1684                                                 append_bits, append_width,
1685                                                 append_height)); n++;
1686     }
1687     if (strcmp(name,"res") == 0) {
1688         XtSetArg(args[n], XtNbitmap,
1689                  (Pixmap) XCreateBitmapFromData(ui_display,
1690                                                 XDefaultRootWindow(ui_display),
1691                                                 res_bits, res_width,
1692                                                 res_height)); n++;
1693     }
1694     if (strcmp(name,"yes") == 0) {
1695         XtSetArg(args[n], XtNbitmap,
1696                  (Pixmap) XCreateBitmapFromData(ui_display,
1697                                                 XDefaultRootWindow(ui_display),
1698                                                 yes_bits, yes_width,
1699                                                 yes_height)); n++;
1700     }
1701     if (strcmp(name,"no") == 0) {
1702         XtSetArg(args[n], XtNbitmap,
1703                  (Pixmap) XCreateBitmapFromData(ui_display,
1704                                                 XDefaultRootWindow(ui_display),
1705                                                 no_bits, no_width,
1706                                                 no_height)); n++;
1707     }
1708     if (strcmp(name,"text") == 0) {
1709         XtSetArg(args[n], XtNbitmap,
1710                  (Pixmap) XCreateBitmapFromData(ui_display,
1711                                                 XDefaultRootWindow(ui_display),
1712                                                 text_bits, text_width,
1713                                                 text_height)); n++;
1714     }
1715     if (strcmp(name,"selection") == 0) {
1716         XtSetArg(args[n], XtNbitmap,
1717                  (Pixmap) XCreateBitmapFromData(ui_display,
1718                                                 XDefaultRootWindow(ui_display),
1719                                                 selection_bits, selection_width,
1720                                                 selection_height)); n++;
1721     }
1722     if (strcmp(name,"background") == 0) {
1723         XtSetArg(args[n], XtNbitmap,
1724                  (Pixmap) XCreateBitmapFromData(ui_display,
1725                                                 XDefaultRootWindow(ui_display),
1726                                                 background_bits, background_width,
1727                                                 background_height)); n++;
1728     }
1729     if (strcmp(name,"norm") == 0) {
1730 	XtSetArg(args[n], XtNbitmap,
1731 		 (Pixmap) XCreateBitmapFromData(ui_display,
1732 						XDefaultRootWindow(ui_display),
1733 						norm_bits, norm_width,
1734 						norm_height)); n++;
1735     }
1736     if (strcmp(name,"parallel") == 0) {
1737 	XtSetArg(args[n], XtNbitmap,
1738 		 (Pixmap) XCreateBitmapFromData(ui_display,
1739 						XDefaultRootWindow(ui_display),
1740 						parallel_bits, parallel_width,
1741 						parallel_height)); n++;
1742     }
1743     if (strcmp (name, "grid") == 0) {
1744 	XtSetArg (args[n], XtNbitmap,
1745 		  (Pixmap) XCreateBitmapFromData(ui_display,
1746 						 XDefaultRootWindow(ui_display),
1747 						 grid_bits, grid_width,
1748 						 grid_height)); n++;
1749     }
1750 
1751     XtSetArg(args[n], XtNborderWidth, 0 /*!*/); n++;
1752     XtSetArg(args[n], XtNradioGroup, group); n++;
1753     XtSetArg(args[n], XtNinternalHeight, 1); n++;
1754     XtSetArg(args[n], XtNinternalWidth , 1); n++;
1755     XtSetArg(args[n], XtNfromVert , top);  n++;
1756     XtSetArg(args[n], XtNfromHoriz, left);  n++;
1757     XtSetArg(args[n], XtNleft  , XtChainLeft); n++;
1758     XtSetArg(args[n], XtNright , XtChainLeft); n++;
1759     XtSetArg(args[n], XtNtop   , XtChainTop); n++;
1760     XtSetArg(args[n], XtNbottom, XtChainTop); n++;
1761     w = XtCreateManagedWidget(name, toggleWidgetClass, parent, args, n);
1762     return(w);
1763 }
1764 
1765 
1766 
1767 /*****************************************************************************
1768   FUNCTION : ui_xCreateScrollbarItem
1769 
1770   PURPOSE  : create a scrollbar widget
1771   NOTES    :
1772   RETURNS  : THE Widgetnumber
1773   UPDATE   : 2.8.1990
1774 ******************************************************************************/
1775 
ui_xCreateScrollbarItem(char * name,Widget parent,Dimension length,float topOfThumb,Widget left,Widget top)1776 Widget  ui_xCreateScrollbarItem(char *name,Widget parent,Dimension length,float topOfThumb,Widget left,Widget top)
1777 {
1778     Cardinal n;
1779     Widget   w;
1780     Arg	     args[20];
1781 
1782 
1783     n = 0;
1784     XtSetArg(args[n], XtNborderWidth, 1); n++;
1785     XtSetArg(args[n], XtNlength, length); n++;
1786     XtSetArg(args[n], XtNthickness, 15); n++;
1787 
1788     /* see X11R4, Athena, pg. 37: setting float resources */
1789     /* But it doesn't work ! */
1790   /*  if (sizeof(float) > sizeof(XtArgVal)) {
1791 	XtSetArg(args[n], XtNtopOfThumb, &topOfThumb); n++;
1792     } else {
1793 	XtArgVal *l_top = (XtArgVal *) &topOfThumb;
1794 	XtSetArg(args[n], XtNtopOfThumb, *l_top); n++;
1795     } */
1796 
1797 
1798 /*    XtSetArg(args[n], XtNinternalHeight, 1); n++;
1799     XtSetArg(args[n], XtNinternalWidth , 1); n++;
1800 */
1801     XtSetArg(args[n], XtNfromVert , top);  n++;
1802     XtSetArg(args[n], XtNfromHoriz, left);  n++;
1803     XtSetArg(args[n], XtNleft  , XtChainLeft); n++;
1804     XtSetArg(args[n], XtNright , XtChainLeft); n++;
1805     XtSetArg(args[n], XtNtop   , XtChainTop); n++;
1806     XtSetArg(args[n], XtNbottom, XtChainTop); n++;
1807     w = XtCreateManagedWidget(name, scrollbarWidgetClass, parent, args, n);
1808     XawScrollbarSetThumb(w,topOfThumb,-1.0);
1809     return(w);
1810 }
1811 
1812 
1813 
1814 /*****************************************************************************
1815   FUNCTION : ui_noreturn
1816 
1817   PURPOSE  : dummy function to suppress the execution of RETURN in a Dialog
1818              widget
1819   NOTES    :
1820   RETURNS  :
1821   UPDATE   : 07.12.1994
1822 ******************************************************************************/
ui_noreturn(Widget w,Widget pannel,caddr_t call_data)1823 static void ui_noreturn(Widget w,Widget pannel,caddr_t call_data)
1824 {
1825     /* do nothing */
1826 }
1827 
1828 
1829 
1830 /*****************************************************************************
1831   FUNCTION : ui_moveup
1832 
1833   PURPOSE  : move the mouse pointer to the widget above the current one
1834   NOTES    :
1835   RETURNS  :
1836   UPDATE   : 07.12.1994
1837 ******************************************************************************/
ui_moveup(Widget w,Widget pannel,caddr_t call_data)1838 static void ui_moveup(Widget w,Widget pannel,caddr_t call_data)
1839 {
1840     Dimension h;
1841     Arg       args[2];
1842 
1843     XtSetArg    (args[0], XtNheight, &h);
1844     XtGetValues (w, args, 1);
1845     XWarpPointer(ui_display, DefaultRootWindow(ui_display), None,
1846 		 0, 0, 0, 0, 0, -h-4);
1847 }
1848 
1849 
1850 /*****************************************************************************
1851   FUNCTION : ui_movedown
1852 
1853   PURPOSE  : move the mouse pointer to the widget below the current one
1854   NOTES    :
1855   RETURNS  :
1856   UPDATE   : 07.12.1994
1857 ******************************************************************************/
ui_movedown(Widget w,Widget pannel,caddr_t call_data)1858 static void ui_movedown(Widget w,Widget pannel,caddr_t call_data)
1859 {
1860     Dimension h;
1861     Arg       args[2];
1862 
1863     XtSetArg    (args[0], XtNheight, &h);
1864     XtGetValues (w, args, 1);
1865     XWarpPointer(ui_display,DefaultRootWindow(ui_display),None,0,0,0,0,0,h+4);
1866 
1867 }
1868 
1869 
1870 /*****************************************************************************
1871   FUNCTION : ui_moveleft
1872 
1873   PURPOSE  : move the mouse pointer to the widget to the left of the current one
1874   NOTES    :
1875   RETURNS  :
1876   UPDATE   : 07.12.1994
1877 ******************************************************************************/
ui_moveleft(Widget w,Widget pannel,caddr_t call_data)1878 static void ui_moveleft(Widget w,Widget pannel,caddr_t call_data)
1879 {
1880     Position  nx,ny;
1881     Widget    leftWidget;
1882     int       pos=-1;
1883     Arg       args[4];
1884     Cardinal  n;
1885 
1886     XtSetArg    (args[0], XtNfromHoriz, &leftWidget);
1887     XtGetValues (w, args, 1);
1888     n=0;
1889     XtSetArg    (args[n], XtNx, &nx);n++;
1890     XtSetArg    (args[n], XtNy, &ny);n++;
1891     XtSetArg    (args[n], XtNinsertPosition, &pos);n++;
1892     XtGetValues (leftWidget, args, n);
1893     XWarpPointer(ui_display, None, DefaultRootWindow(ui_display),
1894 		 0, 0, 0, 0, nx+8*pos, ny);
1895 }
1896 
1897 
1898 
1899 /*****************************************************************************
1900   FUNCTION : ui_moveright
1901 
1902   PURPOSE  : move the mouse pointer to the widget to the right of the current
1903              one
1904   NOTES    :
1905   RETURNS  :
1906   UPDATE   : 07.12.1994
1907 ******************************************************************************/
ui_moveright(Widget w,Widget pannel,caddr_t call_data)1908 static void ui_moveright(Widget w,Widget pannel,caddr_t call_data)
1909 {
1910     Dimension wi;
1911     Arg       args[2];
1912 
1913     XtSetArg    (args[0], XtNwidth, &wi);
1914     XtGetValues (w, args, 1);
1915     XWarpPointer(ui_display,DefaultRootWindow(ui_display),None,0,0,0,0,wi+5,0);
1916 }
1917 
1918 
1919 
1920 /*****************************************************************************
1921   FUNCTION : ui_checkWindowPosition
1922 
1923   PURPOSE  : checks, if the widget is completely visible an moves the
1924              window if necessary
1925   NOTES    :
1926   RETURNS  : void
1927   UPDATE   :
1928 ******************************************************************************/
1929 
ui_checkWindowPosition(Widget w)1930 void ui_checkWindowPosition(Widget w)
1931 
1932 {
1933     int                DisplayX, DisplayY;
1934     int                n;
1935     Arg                args[15];
1936     Dimension          WindowX, WindowY;
1937     Dimension          WindowWidth, WindowHeight;
1938 
1939 #define WINDOW_HEADER 30
1940 
1941     /* Getting the size of the screen */
1942     DisplayX = DisplayWidth (ui_display, DefaultScreen(ui_display));
1943     DisplayY = DisplayHeight (ui_display, DefaultScreen(ui_display));
1944 
1945     /* Getting the size and position of the window */
1946     XtRealizeWidget(w);
1947     n = 0;
1948     XtSetArg(args[n], XtNx, &WindowX);       n++;
1949     XtSetArg(args[n], XtNy, &WindowY);       n++;
1950     XtSetArg(args[n], XtNwidth, &WindowWidth);   n++;
1951     XtSetArg(args[n], XtNheight, &WindowHeight);  n++;
1952     XtGetValues(w, args, n);
1953 
1954     /* Calculating the new position */
1955     if ((WindowWidth+WindowX) > DisplayX)
1956 	WindowX = DisplayX-WindowWidth;
1957     if (DisplayX-WindowWidth < 0)
1958 	WindowX = 0;
1959     if ((WindowHeight+WindowY+WINDOW_HEADER) > DisplayY)
1960         WindowY = DisplayY-WindowHeight-WINDOW_HEADER;
1961     if (DisplayY-WindowHeight-WINDOW_HEADER < 0)
1962  	WindowY = 0;
1963 
1964     /* Setting the new position */
1965     n = 0;
1966     XtSetArg(args[n], XtNx, WindowX);       n++;
1967     XtSetArg(args[n], XtNy, WindowY);       n++;
1968     XtSetValues(w, args, n);
1969 }
1970 
1971 
1972 /*****************************************************************************
1973   FUNCTION : ui_xDontResizeWidget
1974 
1975   PURPOSE  : reads the current height and width of the widget and sets it
1976              as min and max
1977   NOTES    :
1978   RETURNS  : void
1979 
1980   UPDATE   :
1981 ******************************************************************************/
1982 
ui_xDontResizeWidget(Widget w)1983 void ui_xDontResizeWidget (Widget w)
1984 
1985 {
1986   int n;
1987   Arg args[5];
1988   Position x, y;
1989 
1990   n=0;
1991   XtSetArg (args[n], XtNwidth, &x);   n++;
1992   XtSetArg (args[n], XtNheight, &y);  n++;
1993   XtGetValues  (w, args,  n);
1994   n=0;
1995   XtSetArg (args[n], XtNmaxWidth, x);   n++;
1996   XtSetArg (args[n], XtNmaxHeight, y);  n++;
1997   XtSetArg (args[n], XtNminWidth, x);   n++;
1998   XtSetArg (args[n], XtNminHeight, y);  n++;
1999   XtSetValues  (w, args,  n);
2000 }
2001 /* end of file */
2002 
2003 
2004 
2005