dtwm: basic multihead(xinerama only) support
[oweals/cde.git] / cde / programs / dtcreate / CreateActionAppShell.c
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $TOG: CreateActionAppShell.c /main/11 1998/10/26 17:17:50 mgreess $ */
24 /*******************************************************************************
25         CreateActionAppShell.c
26
27        Associated Header file: CreateActionAppShell.h
28 *******************************************************************************/
29
30 #include <stdlib.h>
31 #include <stdio.h>
32 #include <sys/stat.h>
33
34 #include <Xm/Xm.h>
35 #include <Xm/MwmUtil.h>
36 #include <Xm/MenuShell.h>
37 #include <Xm/Text.h>
38 #include <Xm/ToggleBG.h>
39 #include <Xm/List.h>
40 #include <Xm/ScrolledW.h>
41 #include <Xm/Text.h>
42 #include <Xm/PushBG.h>
43 #include <Xm/TextF.h>
44 #include <Xm/Label.h>
45 #include <Xm/Form.h>
46 #include <Xm/CascadeB.h>
47 #include <Xm/ToggleB.h>
48 #include <Xm/Separator.h>
49 #include <Xm/PushB.h>
50 #include <Xm/RowColumn.h>
51 #include <Xm/MainW.h>
52 #include <Xm/Protocols.h>
53 #include <Xm/AtomMgr.h>
54
55 #include <X11/Shell.h>
56 #include <X11/cursorfont.h>
57
58 #include <Dt/Dt.h>
59 #include <Dt/Icon.h>
60 #include <Dt/Action.h>
61 #include <Dt/HourGlass.h>
62 #include <Dt/Wsm.h>
63
64 #include "dtcreate.h"
65 #include "UxXt.h"
66 #include "af_aux.h"
67 #include "ca_aux.h"
68 #include "cmncbs.h"
69 #include "cmnrtns.h"
70 #include "fileio.h"
71 #include "Confirmed.h"
72 #include "ErrorDialog.h"
73
74 #define CONTEXT_MACRO_ACCESS 1
75 #include "CreateActionAppShell.h"
76 #undef CONTEXT_MACRO_ACCESS
77
78 /*******************************************************************************
79        Includes, Defines, and Global variables from the Declarations Editor:
80 *******************************************************************************/
81
82 XtArgVal /* Dimension */ winheight, xprtheight, newheight, wintypeheight;
83 Widget    FileTypes;
84
85 /*******************************************************************************
86        The following are callback functions.
87 *******************************************************************************/
88 static char * GetDefinitionFileName( char *pszName);
89 static void  CreateFiles(void);
90 static void  questionCB_ReplaceFile(Widget UxWidget,
91                              XtPointer UxClientData,
92                              XtPointer UxCallbackArg);
93 static void  questionCB_CancelSave(Widget UxWidget,
94                             XtPointer UxClientData,
95                             XtPointer UxCallbackArg);
96
97 static char * GetDefinitionFileName( char *pszName)
98 {
99   char     *pszEnvVar;
100   char     *defname = (char *)NULL;
101   int      bytesneeded = 0;
102   char     *msgPtr, *errPtr;
103   char     *newName;
104
105   /****************************************************************/
106   /* Create definition file name.                                 */
107   /****************************************************************/
108   newName = ReplaceSpaces(pszName);
109   pszEnvVar = getenv("HOME");
110   if ( pszEnvVar && strlen(pszEnvVar) ) {
111      bytesneeded = strlen("/.dt/types/.dt") + strlen(pszEnvVar) + strlen(newName) + 1;
112      defname = (char *)XtMalloc(bytesneeded);
113      sprintf(defname, "%s/.dt/types/%s.dt", pszEnvVar, newName);
114   } else {
115      msgPtr = GETMESSAGE(5, 170,
116          "The HOME environment variable is not set.\n\
117 The HOME environment variable must be set in order\n\
118 for this action to be saved.");
119      errPtr = XtNewString(msgPtr);
120      display_error_message(CreateActionAppShell, errPtr);
121      XtFree(errPtr);
122   }
123   XtFree(newName);
124   return(defname);
125 }
126
127
128 static void  CreateFiles(void)
129 {
130   Boolean  bHaveError = False;
131   ushort   usRc = 0;
132   char     *pszDefName;
133   char     *msgPtr1, *msgPtr2, *fmtPtr, *bufPtr;
134 #ifdef UNDO_CMVC_3571
135   char     *msgPtr3;
136 #endif
137
138   /******************************************************************/
139   /* Create Definition file name.                                   */
140   /******************************************************************/
141   pszDefName = GetDefinitionFileName(AD.pszName);
142   if (!pszDefName) {
143      bHaveError = True;
144   }
145
146   /******************************************************************/
147   /* Create Definition file.                                        */
148   /******************************************************************/
149   if ( !bHaveError && ((usRc = WriteDefinitionFile(pszDefName, &AD)) != 0) ) {
150      bHaveError = TRUE;
151   }
152
153   /******************************************************************/
154   /* Create Action file.                                            */
155   /******************************************************************/
156   if ( !bHaveError && ((usRc = WriteActionFile(&AD)) != 0) ) {
157      bHaveError = TRUE;
158   }
159
160   /******************************************************************/
161   /* Copy icon files to home directory   ~/.dt/icons                */
162   /******************************************************************/
163   if ( !bHaveError && ((usRc = CopyIconFiles(&AD)) != 0) ) {
164      bHaveError = TRUE;
165   }
166
167   /*******************************************************************/
168   /* Reload action database and pop up confirmation message if       */
169   /* operation was successful.                                       */
170   /*******************************************************************/
171   if (!bHaveError) {
172      _DtTurnOnHourGlass(CreateActionAppShell);
173      if (!DbInitDone) {
174         DtInitialize(UxDisplay, UxTopLevel, pszExecName, pszExecName);
175         DtDbLoad();
176         DbInitDone = TRUE;
177      }
178      DtActionInvoke(UxTopLevel, "ReloadActions",
179                       NULL, 0, NULL, NULL, NULL, 0, NULL, NULL);
180
181      _DtTurnOffHourGlass(CreateActionAppShell);
182
183      msgPtr1 = XtNewString(GETMESSAGE(5, 70, "The new action"));
184      msgPtr2 = XtNewString(GETMESSAGE(5, 71,
185               "has been placed in your home folder."));
186 #ifdef UNDO_CMVC_3571
187      msgPtr3 = XtNewString(GETMESSAGE(5, 73,
188               "The action definition file that was created is called:"));
189      fmtPtr = "%s\n\n   %s\n\n%s\n\n%s\n   %s";
190 #else
191      fmtPtr = "%s\n\n   %s\n\n%s";
192 #endif
193
194      bufPtr = XtMalloc((strlen(msgPtr1) + strlen(msgPtr2) +
195                         strlen(AD.pszName) +
196 #ifdef UNDO_CMVC_3571
197                         strlen(msgPtr3) + strlen(pszFile) +
198 #endif
199                         strlen(fmtPtr) + 1) * sizeof(char));
200
201      sprintf(bufPtr, fmtPtr, msgPtr1, AD.pszName, msgPtr2
202 #ifdef UNDO_CMVC_3571
203              , msgPtr3, pszFile
204 #endif
205              );
206
207      display_confirmed_message(CreateActionAppShell, bufPtr);
208
209      XtFree(bufPtr);
210 #ifdef UNDO_CMVC_3571
211      XtFree(msgPtr3);
212 #endif
213      XtFree(msgPtr2);
214      XtFree(msgPtr1);
215
216   }
217
218   /*******************************************************************/
219   /* Update the copy of the AD structure.  This will be used to      */
220   /* determine if the user has saved the most recent data before     */
221   /* exiting.                                                        */
222   /*******************************************************************/
223   FreeAndClearAD(pMyCopyAD);
224   XtFree((char *) pMyCopyAD);
225   pMyCopyAD = copyAD(&AD);
226
227 }
228
229
230 static void  questionCB_ReplaceFile(Widget UxWidget,
231                              XtPointer UxClientData,
232                              XtPointer UxCallbackArg)
233 {
234   CreateFiles();
235   XtDestroyWidget(XtParent(UxWidget));
236 }
237
238 static void  questionCB_CancelSave(Widget UxWidget,
239                             XtPointer UxClientData,
240                             XtPointer UxCallbackArg)
241 {
242   XtDestroyWidget(XtParent(UxWidget));
243 }
244
245
246 void  activateCB_CA_MB_FileSave(Widget UxWidget,
247                                 XtPointer UxClientData,
248                                 XtPointer UxCallbackArg)
249
250 {
251   ushort   usRc = 0;
252   char     *pszActionFile;
253   char     *msgPtr, *bufPtr;
254   Boolean  bHaveError = FALSE;
255   struct   stat statbuf;
256   char     *newName;
257   char     *pszEnvVar;
258
259   /*********************************************************************/
260   /*  Check that required fields are filled in for main window.        */
261   /*********************************************************************/
262   if (!CreateActionAppShellCheckFields()) {
263
264     /*******************************************************************/
265     /*  Query fields from main window and save into structure.         */
266     /*******************************************************************/
267     readCAFromGUI(&AD);
268
269     /*******************************************************************/
270     /*  Write the files.                                               */
271     /*******************************************************************/
272 #ifdef UNDO_CMVC_4662
273     if (pszFileToEdit) {
274        strcpy(pszFile, pszFileToEdit);
275     } else {
276 #endif
277
278        /****************************************************************/
279        /* Create Action file name.                                     */
280        /****************************************************************/
281        newName = ReplaceSpaces(AD.pszName);
282        pszActionFile = NULL;
283        pszEnvVar = getenv("HOME");
284        if ( pszEnvVar && strlen(pszEnvVar) ) {
285           pszActionFile = malloc(strlen(pszEnvVar)+strlen(newName)+10);
286           if (pszActionFile)
287             sprintf(pszActionFile, "%s/%s", pszEnvVar, newName);
288        } else {
289           msgPtr = GETMESSAGE(5, 170,
290               "The HOME environment variable is not set.\n\
291 The HOME environment variable must be set in order\n\
292 for this action to be saved.");
293           bufPtr = XtNewString(msgPtr);
294           display_error_message(CreateActionAppShell, bufPtr);
295           XtFree(bufPtr);
296           bHaveError = TRUE;
297        }
298
299        /****************************************************************/
300        /* Check if action file exists and flag a warning if it does.   */
301        /****************************************************************/
302        if ( (!bHaveError) &&
303             (pszActionFile) &&
304             (!stat(pszActionFile, &statbuf)) ) {
305
306           /* INTERNATIONALIZE */
307           msgPtr = "A file named\n\n   %s\n\n\
308 already exists in your home folder.\n\
309 The existing file may be an application,\n\
310 data file, or an action file.\n\n\
311 What do you want to do?";
312           bufPtr = XtMalloc((strlen(msgPtr) + strlen(newName) + 1) *
313                             sizeof(char));
314           sprintf(bufPtr, msgPtr, newName);
315
316           /* INTERNATIONALIZE */
317           display_question_message(CreateActionAppShell, bufPtr,
318                               "Replace", questionCB_ReplaceFile,
319                               "Cancel Save", questionCB_CancelSave,
320                               (char *)NULL, (XtCallbackProc)NULL);
321           XtFree(bufPtr);
322           XtFree(pszActionFile);
323           bHaveError = True;
324        }
325
326        /****************************************************************/
327        /* Now we are done with the newName variable and can free.      */
328        /****************************************************************/
329        XtFree(newName);
330
331 #ifdef UNDO_CMVC_4662
332     }
333 #endif
334
335     if (!bHaveError) {
336        CreateFiles();
337     }
338
339   }
340 }
341
342 static  void    activateCB_CA_FiletypesDelete( Widget UxWidget,
343                                               XtPointer UxClientData,
344                                               XtPointer UxCallbackArg)
345 {
346   int           *poslist, poscnt;
347   int           *p, n;
348   XmString      *items;
349   FiletypeData  **papArray;
350   int           i, k;
351   int           cnt;
352   Boolean       bFound;
353   char          *msgPtr1, *msgPtr2, *fmtPtr, *errPtr;
354   size_t        len;
355
356   /**************************************************************************/
357   /* Determine the filetypes to delete and delete them.                     */
358   /**************************************************************************/
359   XtVaGetValues(FileTypes, XmNitems, &items, NULL);
360   if (XmListGetSelectedPos(FileTypes, &poslist, &poscnt)) {
361      n = poscnt;
362      p = poslist + (n-1);
363      while (n--) {
364        /*********************************************************************/
365        /* Delete the filetype name from the listbox.                        */
366        /*********************************************************************/
367        XmListDeleteItem(FileTypes, items[*p -1]);
368        p--;
369      }
370
371      /***********************************************************************/
372      /* Remove the filetypes from the filetype array in the ActionData      */
373      /* structure.                                                          */
374      /***********************************************************************/
375      if ((AD.cFiletypes - poscnt) > 0) {
376         if ( papArray = (FiletypeData **) XtMalloc(sizeof(FiletypeData *) * (AD.cFiletypes - poscnt)) ) {
377            cnt = 0;
378            for (i = 0; i < AD.cFiletypes; i++) {
379               bFound = FALSE;
380               for (k = 0; k < poscnt; k++) {
381                 if ((i + 1) == poslist[k]) {
382                    bFound = TRUE;
383                    break;
384                 }
385               }
386               /**************************************************************/
387               /* If did not find this element in the delete list, then add  */
388               /* it back to our good list.                                  */
389               /* Else do not include in the good list and free its memory.  */
390               /**************************************************************/
391               if (!bFound) {
392                  papArray[cnt] = AD.papFiletypes[i];
393                  cnt++;
394               } else {
395                  free_Filetypedata(AD.papFiletypes[i]);
396               }
397            }
398            if (AD.papFiletypes) {
399              XtFree((XtPointer)AD.papFiletypes);
400            }
401            AD.papFiletypes = papArray;
402            AD.cFiletypes = cnt;
403         }
404      } else {
405         /********************************************************************/
406         /* Delete the entire array.                                         */
407         /********************************************************************/
408         for (i = 0; i < AD.cFiletypes; i++) {
409           free_Filetypedata(AD.papFiletypes[i]);
410         }
411         AD.papFiletypes = (FiletypeData **)NULL;
412         AD.cFiletypes = 0;
413      }
414   } else {
415      msgPtr1 = XtNewString(GETMESSAGE(5, 120,
416                   "You have not selected a Datatype from the\n\
417 'Datatypes That Use This Action' list."));
418      msgPtr2 = XtNewString(GETMESSAGE(5, 125,
419                   "Please select the Datatype you would like to Delete."));
420      fmtPtr = "%s\n%s";
421      len = (strlen(msgPtr1) + strlen(msgPtr2) + strlen(fmtPtr) + 2);
422      errPtr = XtMalloc(len);
423      snprintf(errPtr,len - 1, fmtPtr, msgPtr1, msgPtr2);
424      XtFree(msgPtr2);
425      XtFree(msgPtr1);
426      display_error_message(CreateActionAppShell, errPtr);
427      XtFree(errPtr);
428   }
429 }
430
431 #if 0
432 /*****************************************************************************/
433 /*                                                                           */
434 /* valueChangedCB_CA_WinType                                                 */
435 /*                                                                           */
436 /*****************************************************************************/
437 static  void    valueChangedCB_CA_WinType( Widget UxWidget,
438                                            XtPointer UxClientData,
439                                            XtPointer UxCallbackArg)
440 {
441   Boolean bSetToggle;
442
443   bSetToggle = ((XmToggleButtonCallbackStruct *)UxCallbackArg)->set;
444 #ifdef DEBUG
445   printf("Wintype change before %X\n", AD.fsFlags);
446 #endif
447   switch ((int)UxClientData) {
448     case CA_WT_XWINDOWS :
449          if (bSetToggle) AD.fsFlags |= CA_WT_XWINDOWS;
450          else AD.fsFlags &= (~(CA_WT_XWINDOWS));
451          break;
452     case CA_WT_TERM :
453          if (bSetToggle) AD.fsFlags |= CA_WT_TERM;
454          else AD.fsFlags &= (~(CA_WT_TERM));
455          break;
456     case CA_WT_PERMTERM :
457          if (bSetToggle) AD.fsFlags |= CA_WT_PERMTERM;
458          else AD.fsFlags &= (~(CA_WT_PERMTERM));
459          break;
460   }
461 #ifdef DEBUG
462   printf("Wintype change after %X\n", AD.fsFlags);
463 #endif
464 }
465 #endif
466
467 /*****************************************************************************/
468 /*                                                                           */
469 /* valueChangedCB_DroppableFiletypes                                         */
470 /*                                                                           */
471 /*****************************************************************************/
472 static  void    valueChangedCB_DroppableFiletypes( Widget UxWidget,
473                                            XtPointer UxClientData,
474                                            XtPointer UxCallbackArg)
475 {
476   if (((XmToggleButtonCallbackStruct *)UxCallbackArg)->set) {
477     AD.fsFlags |= CA_DF_ONLYFTFILES;
478   } else {
479     AD.fsFlags &= (~(CA_DF_ONLYFTFILES));
480   }
481 }
482
483 /*****************************************************************************/
484 /*                                                                           */
485 /* simpleCB_WindowTypeOptionMenu                                             */
486 /*                                                                           */
487 /*****************************************************************************/
488 static  void    activateCB_WindowTypeOptionMenu( Widget UxWidget,
489                                            XtPointer UxClientData,
490                                            XtPointer UxCallbackArg)
491 {
492   AD.fsFlags &= (~(CA_WT_XWINDOWS | CA_WT_TERM | CA_WT_PERMTERM));
493   switch ((int)(XtArgVal)UxClientData) {
494     case CA_WT_XWINDOWS :
495          AD.fsFlags |= CA_WT_XWINDOWS;
496          break;
497     case CA_WT_TERM :
498          AD.fsFlags |= CA_WT_TERM;
499          break;
500     case CA_WT_PERMTERM :
501          AD.fsFlags |= CA_WT_PERMTERM;
502          break;
503   }
504 }
505
506 /*******************************************************************************
507        The 'build_' function creates all the widgets
508        using the resource values specified in the Property Editor.
509 *******************************************************************************/
510
511 static Widget   _Uxbuild_CreateActionAppShell(void)
512 {
513         Widget               _UxParent;
514         Widget               CA_MB_FileOption_shell;
515         Widget               CA_MB_HelpOption_shell;
516         Widget               CA_MB_Help_Sep1;
517         Widget               CA_MB_Help_Sep2;
518         Widget               CA_MB_OptionsOption_shell;
519         char                 *UxTmp0;
520
521         Widget               CA_WindowType_OptionMenuShell;
522         Widget               CA_WindowType_Pane;
523         Widget               CA_WindowType_OptionMenu;
524         char                 mnemonic[2];
525         XtArgVal /* Dimension */        dim1, dim2;
526         Widget               CA_MED_IconForm, CA_TINY_IconForm, CA_LRG_IconForm;
527         IconData             *pIconData;
528
529         XmString             emptyString;
530         char                 titleBuf[MAXBUFSIZE];
531
532 #define ICON_MIN_HEIGHT      83
533 #define FINDEDIT_SPACING     6
534 #define BORDER_OFFSET        3
535
536         /* Creation of CreateActionAppShell */
537         _UxParent = UxParent;
538         if ( _UxParent == NULL )
539         {
540             _UxParent = UxTopLevel;
541         }
542
543         strcpy(titleBuf, GETMESSAGE(3, 10, "Create Action"));
544         CreateActionAppShell = XtVaCreatePopupShell( "CreateActionAppShell",
545                         applicationShellWidgetClass,
546                         _UxParent,
547                         /*
548                         XmNx, 35,
549                         XmNy, 8,
550                         XmNminWidth, -1,
551                         XmNminHeight, -1,
552                         */
553                         XmNiconName, titleBuf,
554                         XmNtitle, titleBuf,
555                         XmNallowShellResize, TRUE,
556                         XmNheight, 550,
557                         XmNdeleteResponse, XmDO_NOTHING, /* CDExc19440 */
558                         NULL );
559
560         /* CDExc19440 - make sure user doesn't accidentally lose work. */
561         XmAddWMProtocolCallback(CreateActionAppShell,
562                                 XmInternAtom(UxDisplay,
563                                              "WM_DELETE_WINDOW",
564                                              False),
565                                 activateCB_FileQuit,
566                                 (XtPointer)NULL);
567
568         if (bLowRes) {
569            /* Creation of CreateActionMainWindow */
570            CreateActionMainWindow = XtVaCreateManagedWidget( "CreateActionMainWindow",
571                         xmMainWindowWidgetClass,
572                         CreateActionAppShell,
573                         XmNunitType, XmPIXELS,
574                         XmNx, 0,
575                         XmNy, 0,
576                         XmNscrollingPolicy, XmAUTOMATIC,
577                         NULL );
578         } else {
579            /* Creation of CreateActionMainWindow */
580            CreateActionMainWindow = XtVaCreateManagedWidget( "CreateActionMainWindow",
581                         xmMainWindowWidgetClass,
582                         CreateActionAppShell,
583                         XmNunitType, XmPIXELS,
584                         XmNx, 0,
585                         XmNy, 0,
586                         NULL );
587         }
588         XtAddCallback( CreateActionMainWindow, XmNhelpCallback,
589                 (XtCallbackProc) helpCB_general,
590                 (XtPointer) HELP_ONITEM );
591
592         /*********************************************************************/
593         /*                                                                   */
594         /* MenuBar                                                           */
595         /*                                                                   */
596         /*********************************************************************/
597         /* Creation of CA_MenuBar */
598         CA_MenuBar = XtVaCreateManagedWidget( "CA_MenuBar",
599                         xmRowColumnWidgetClass,
600                         CreateActionMainWindow,
601                         XmNrowColumnType, XmMENU_BAR,
602                         XmNmenuAccelerator, "<KeyUp>F10",
603                         XmNpacking, XmPACK_TIGHT,
604                         XmNentryAlignment, XmALIGNMENT_BEGINNING,
605                         XmNorientation, XmHORIZONTAL,
606                         NULL );
607
608         /* Creation of CA_MB_FileOption */
609         CA_MB_FileOption_shell = XtVaCreatePopupShell ("CA_MB_FileOption_shell",
610                         xmMenuShellWidgetClass, CA_MenuBar,
611                         XmNwidth, 1,
612                         XmNheight, 1,
613                         XmNallowShellResize, TRUE,
614                         XmNoverrideRedirect, TRUE,
615                         NULL );
616
617         CA_MB_FileOption = XtVaCreateWidget( "CA_MB_FileOption",
618                         xmRowColumnWidgetClass,
619                         CA_MB_FileOption_shell,
620                         XmNrowColumnType, XmMENU_PULLDOWN,
621                         NULL );
622
623         /* Creation of CA_MB_FileNew */
624         /*
625         mnemonic = GETMESSAGE(2, 21, "N");
626         */
627         strcpy(mnemonic, GETMESSAGE(2, 21, "N"));
628         CA_MB_FileNew = XtVaCreateManagedWidget( "CA_MB_FileNew",
629                         xmPushButtonWidgetClass,
630                         CA_MB_FileOption,
631                         RES_CONVERT( XmNlabelString, GETMESSAGE(2, 20, "New")),
632                         XmNmnemonic, mnemonic[0],
633                         NULL );
634         XtAddCallback( CA_MB_FileNew, XmNactivateCallback,
635                 (XtCallbackProc) activateCB_FileNew,
636                 (XtPointer) NULL );
637
638         /* Creation of CA_MB_FileOpen */
639         /*
640         mnemonic = GETMESSAGE(2, 16, "O");
641         */
642         strcpy(mnemonic, GETMESSAGE(2, 16, "O"));
643         CA_MB_FileOpen = XtVaCreateManagedWidget( "CA_MB_FileOpen",
644                         xmPushButtonWidgetClass,
645                         CA_MB_FileOption,
646                         RES_CONVERT( XmNlabelString, GETMESSAGE(2, 15, "Open...")),
647                         XmNmnemonic, mnemonic[0],
648                         NULL );
649         XtAddCallback( CA_MB_FileOpen, XmNactivateCallback,
650                 (XtCallbackProc) activateCB_FileOpen,
651                 (XtPointer) NULL );
652
653         /* Creation of CA_MB_FileSave */
654         /*
655         mnemonic = GETMESSAGE(2, 26, "S");
656         */
657         strcpy(mnemonic, GETMESSAGE(2, 26, "S"));
658         CA_MB_FileSave = XtVaCreateManagedWidget( "CA_MB_FileSave",
659                         xmPushButtonWidgetClass,
660                         CA_MB_FileOption,
661                         RES_CONVERT( XmNlabelString, GETMESSAGE(2, 25, "Save")),
662                         XmNmnemonic, mnemonic[0],
663                         NULL );
664         XtAddCallback( CA_MB_FileSave, XmNactivateCallback,
665                 (XtCallbackProc) activateCB_CA_MB_FileSave,
666                 (XtPointer) NULL );
667
668         /* Creation of CA_MB_Sep */
669         CA_MB_Sep = XtVaCreateManagedWidget( "CA_MB_Sep",
670                         xmSeparatorWidgetClass,
671                         CA_MB_FileOption,
672                         NULL );
673
674         /* Creation of CA_MB_FileExit */
675         /*
676         mnemonic = GETMESSAGE(2, 31, "x");
677         */
678         strcpy(mnemonic, GETMESSAGE(2, 31, "x"));
679         CA_MB_FileExit = XtVaCreateManagedWidget( "CA_MB_FileExit",
680                         xmPushButtonWidgetClass,
681                         CA_MB_FileOption,
682                         RES_CONVERT( XmNlabelString, GETMESSAGE(2, 30, "Exit")),
683                         XmNmnemonic, mnemonic[0],
684                         NULL );
685         XtAddCallback( CA_MB_FileExit, XmNactivateCallback,
686                 (XtCallbackProc) activateCB_FileQuit,
687                 (XtPointer) NULL );
688
689         /* Creation of CA_MB_FileTop */
690         /*
691         mnemonic = GETMESSAGE(2, 11, "F");
692         */
693         strcpy(mnemonic, GETMESSAGE(2, 11, "F"));
694         CA_MB_FileTop = XtVaCreateManagedWidget( "CA_MB_FileTop",
695                         xmCascadeButtonWidgetClass,
696                         CA_MenuBar,
697                         RES_CONVERT( XmNlabelString, GETMESSAGE(2, 10, "File")),
698                         XmNmnemonic, mnemonic[0],
699                         XmNsubMenuId, CA_MB_FileOption,
700                         NULL );
701
702         /* Creation of CA_MB_HelpOption */
703         CA_MB_HelpOption_shell = XtVaCreatePopupShell ("CA_MB_HelpOption_shell",
704                         xmMenuShellWidgetClass, CA_MenuBar,
705                         XmNwidth, 1,
706                         XmNheight, 1,
707                         XmNallowShellResize, TRUE,
708                         XmNoverrideRedirect, TRUE,
709                         NULL );
710
711         CA_MB_HelpOption = XtVaCreateWidget( "CA_MB_HelpOption",
712                         xmRowColumnWidgetClass,
713                         CA_MB_HelpOption_shell,
714                         XmNrowColumnType, XmMENU_PULLDOWN,
715                         NULL );
716
717         /*
718          * Creation of CA_MB_HelpOverview
719         */
720         strcpy(mnemonic, GETMESSAGE(2, 61, "v"));
721         CA_MB_HelpOverview = XtVaCreateManagedWidget( "CA_MB_HelpOverview",
722                         xmPushButtonWidgetClass,
723                         CA_MB_HelpOption,
724                         RES_CONVERT( XmNlabelString, GETMESSAGE(2, 60, "Overview")),
725                         XmNmnemonic, mnemonic[0],
726                         XmNuserData, CreateActionAppShell,
727                         NULL );
728         XtAddCallback( CA_MB_HelpOverview, XmNactivateCallback,
729                 (XtCallbackProc) helpCB_general,
730                 (XtPointer) HELP_OVERVIEW );
731
732         /*
733          * Creation of CA_MB_HelpTasks
734         */
735         strcpy(mnemonic, GETMESSAGE(2, 71, "T"));
736         CA_MB_HelpTasks = XtVaCreateManagedWidget( "CA_MB_HelpTasks",
737                         xmPushButtonWidgetClass,
738                         CA_MB_HelpOption,
739                         RES_CONVERT( XmNlabelString, GETMESSAGE(2, 70, "Tasks")),
740                         XmNmnemonic, mnemonic[0],
741                         XmNuserData, CreateActionAppShell,
742                         NULL );
743         XtAddCallback( CA_MB_HelpTasks, XmNactivateCallback,
744                 (XtCallbackProc) helpCB_general,
745                 (XtPointer) HELP_TASKS );
746
747 #if 0
748         /* Creation of CA_MB_HelpTOC */
749         /*
750         mnemonic = GETMESSAGE(2, 66, "T");
751         */
752         strcpy(mnemonic, GETMESSAGE(2, 66, "T"));
753         CA_MB_HelpTOC = XtVaCreateManagedWidget( "CA_MB_HelpTOC",
754                         xmPushButtonWidgetClass,
755                         CA_MB_HelpOption,
756                         RES_CONVERT( XmNlabelString, GETMESSAGE(2, 65, "Table Of Contents...")),
757                         XmNmnemonic, mnemonic[0],
758                         XmNuserData, CreateActionAppShell,
759                         NULL );
760 #endif
761         /*
762         * Creation of CA_MB_HelpReference
763         */
764         strcpy(mnemonic, GETMESSAGE(2, 76, "R"));
765         CA_MB_HelpReference = XtVaCreateManagedWidget( "CA_MB_HelpReference",
766                         xmPushButtonWidgetClass,
767                         CA_MB_HelpOption,
768                         RES_CONVERT( XmNlabelString, GETMESSAGE(2, 75, "Reference")),
769                         XmNmnemonic, mnemonic[0],
770                         XmNuserData, CreateActionAppShell,
771                         NULL );
772         XtAddCallback( CA_MB_HelpReference, XmNactivateCallback,
773                 (XtCallbackProc) helpCB_general,
774                 (XtPointer) HELP_REFERENCE );
775
776         /*
777          * Creation of CA_MB_Help_Sep1
778          */
779         CA_MB_Help_Sep1 = XtVaCreateManagedWidget( "CA_MB_Help_Sep1",
780                         xmSeparatorWidgetClass,
781                         CA_MB_HelpOption,
782                         NULL );
783
784         /*
785          * Creation of CA_MB_HelpUsing
786          */
787         strcpy(mnemonic, GETMESSAGE(2, 81, "U"));
788         CA_MB_HelpUsing = XtVaCreateManagedWidget( "CA_MB_HelpUsing",
789                         xmPushButtonWidgetClass,
790                         CA_MB_HelpOption,
791                         RES_CONVERT( XmNlabelString, GETMESSAGE(2, 80, "Using Help")),
792                         XmNmnemonic, mnemonic[0],
793                         XmNuserData, CreateActionAppShell,
794                         NULL );
795         XtAddCallback( CA_MB_HelpUsing, XmNactivateCallback,
796                 (XtCallbackProc) helpCB_general,
797                 (XtPointer) HELP_USING );
798
799         /*
800          * Creation of CA_MB_Help_Sep2
801          */
802         CA_MB_Help_Sep2 = XtVaCreateManagedWidget( "CA_MB_Help_Sep2",
803                         xmSeparatorWidgetClass,
804                         CA_MB_HelpOption,
805                         NULL );
806
807         /*
808          * Creation of CA_MB_HelpAbout
809          */
810         strcpy(mnemonic, GETMESSAGE(2, 86, "A"));
811         CA_MB_HelpAbout = XtVaCreateManagedWidget( "CA_MB_HelpAbout",
812                         xmPushButtonWidgetClass,
813                         CA_MB_HelpOption,
814                         RES_CONVERT( XmNlabelString, GETMESSAGE(2, 85, "About Create Action")),
815                         XmNmnemonic, mnemonic[0],
816                         XmNuserData, CreateActionAppShell,
817                         NULL );
818         XtAddCallback( CA_MB_HelpAbout, XmNactivateCallback,
819                 (XtCallbackProc) helpCB_general,
820                 (XtPointer) HELP_ABOUT );
821
822         /*
823          * Creation of CA_MB_HelpTop
824          */
825         strcpy(mnemonic, GETMESSAGE(2, 54, "H"));
826         CA_MB_HelpTop = XtVaCreateManagedWidget( "CA_MB_HelpTop",
827                         xmCascadeButtonWidgetClass,
828                         CA_MenuBar,
829                         RES_CONVERT( XmNlabelString, GETMESSAGE(2, 53, "Help")),
830                         XmNmnemonic, mnemonic[0],
831                         XmNsubMenuId, CA_MB_HelpOption,
832                         XmNuserData, CreateActionAppShell,
833                         NULL );
834
835         /* Creation of CA_MB_OptionsOption */
836         CA_MB_OptionsOption_shell = XtVaCreatePopupShell ("CA_MB_OptionsOption_shell",
837                         xmMenuShellWidgetClass, CA_MenuBar,
838                         XmNwidth, 1,
839                         XmNheight, 1,
840                         XmNallowShellResize, TRUE,
841                         XmNoverrideRedirect, TRUE,
842                         NULL );
843
844         CA_MB_OptionsOption = XtVaCreateWidget( "CA_MB_OptionsOption",
845                         xmRowColumnWidgetClass,
846                         CA_MB_OptionsOption_shell,
847                         XmNrowColumnType, XmMENU_PULLDOWN,
848                         NULL );
849
850         /* Creation of ColorMonoOption */
851         strcpy(mnemonic, GETMESSAGE(2, 50, "M"));
852         ColorMonoOption = XtVaCreateManagedWidget( "ColorMonoOption",
853                         xmToggleButtonWidgetClass,
854                         CA_MB_OptionsOption,
855                         RES_CONVERT( XmNlabelString, GETMESSAGE(2, 49, "Show Monochrome Icons")),
856                         XmNmnemonic, mnemonic[0],
857                         XmNindicatorSize, 20,
858                         XmNhighlightThickness, 0,
859                         NULL );
860         XtAddCallback( ColorMonoOption, XmNvalueChangedCallback,
861                 (XtCallbackProc) valueChangedCB_ColorMonoOption,
862                 (XtPointer) NULL );
863         createCB_ColorMonoOption(ColorMonoOption);
864
865
866         /* Creation of CA_MB_OptionTop */
867         strcpy(mnemonic, GETMESSAGE(2, 36, "O"));
868         CA_MB_OptionTop = XtVaCreateManagedWidget( "CA_MB_OptionTop",
869                         xmCascadeButtonWidgetClass,
870                         CA_MenuBar,
871                         RES_CONVERT( XmNlabelString, GETMESSAGE(2, 35, "Options")),
872                         XmNmnemonic, mnemonic[0],
873                         XmNsubMenuId, CA_MB_OptionsOption,
874                         NULL );
875
876         /* Creation of CA_Form */
877         CA_Form = XtVaCreateManagedWidget( "CA_Form",
878                         xmFormWidgetClass,
879                         CreateActionMainWindow,
880                         XmNnoResize, FALSE,
881                         XmNresizePolicy, XmRESIZE_ANY,
882                         NULL );
883
884         /*********************************************************************/
885         /*                                                                   */
886         /* Action Name                                                       */
887         /*                                                                   */
888         /*********************************************************************/
889         /* Creation of CA_ActionNameLabel */
890         CA_ActionNameLabel = XtVaCreateManagedWidget( "CA_ActionNameLabel",
891                         xmLabelWidgetClass,
892                         CA_Form,
893                         XmNx, 10,
894                         XmNy, 30,
895                         RES_CONVERT( XmNlabelString, GETMESSAGE(3, 12, "Action Name (Icon Label):")),
896                         XmNalignment, XmALIGNMENT_BEGINNING,
897                         XmNleftOffset, 10,
898                         XmNleftAttachment, XmATTACH_FORM,
899                         XmNtopOffset, 20,
900                         XmNtopAttachment, XmATTACH_FORM,
901                         XmNrightOffset, 10,
902                         XmNrightAttachment, XmATTACH_FORM,
903                         NULL );
904
905         /* Creation of CA_ActionNameTextField */
906         CA_ActionNameTextField = XtVaCreateManagedWidget( "CA_ActionNameTextField",
907                         xmTextFieldWidgetClass,
908                         CA_Form,
909                         XmNx, 10,
910                         XmNy, 50,
911                         XmNtopOffset, 0,
912                         XmNtopWidget, CA_ActionNameLabel,
913                         XmNtopAttachment, XmATTACH_WIDGET,
914                         XmNleftOffset, 10,
915                         XmNleftAttachment, XmATTACH_FORM,
916                         XmNrightOffset, 10,
917                         XmNrightAttachment, XmATTACH_FORM,
918                         NULL );
919 #if 0
920         XtAddCallback( CA_ActionNameTextField, XmNvalueChangedCallback,
921                 (XtCallbackProc) valueChangedCB_CA_ActionNameTextField,
922                 (XtPointer) NULL );
923 #endif
924
925         /*********************************************************************/
926         /*                                                                   */
927         /* Icons                                                             */
928         /*                                                                   */
929         /*********************************************************************/
930         /* Creation of CA_ActionIconLabel */
931         CA_ActionIconLabel = XtVaCreateManagedWidget( "CA_ActionIconLabel",
932                         xmLabelWidgetClass,
933                         CA_Form,
934                         XmNx, 10,
935                         XmNy, 95,
936                         RES_CONVERT( XmNlabelString, GETMESSAGE(3, 13, "Action Icons:")),
937                         XmNalignment, XmALIGNMENT_BEGINNING,
938                         XmNleftOffset, 10,
939                         XmNleftAttachment, XmATTACH_FORM,
940                         XmNtopOffset, 15,
941                         XmNtopWidget, CA_ActionNameTextField,
942                         XmNtopAttachment, XmATTACH_WIDGET,
943                         XmNrightOffset, 10,
944                         XmNrightAttachment, XmATTACH_FORM,
945                         NULL );
946
947         /* Creation of CA_ActionIconForm */
948         CA_ActionIconForm = XtVaCreateManagedWidget( "CA_ActionIconForm",
949                         xmFormWidgetClass,
950                         CA_Form,
951                         XmNresizePolicy, XmRESIZE_NONE,
952                         XmNx, 10,
953                         XmNy, 121,
954                         XmNborderWidth, 0,
955                         XmNnavigationType, XmTAB_GROUP,
956                         XmNtopOffset, 0,
957                         XmNtopWidget, CA_ActionIconLabel,
958                         XmNtopAttachment, XmATTACH_WIDGET,
959                         XmNleftOffset, 10,
960                         XmNleftAttachment, XmATTACH_FORM,
961                         XmNrightOffset, 10,
962                         XmNrightAttachment, XmATTACH_FORM,
963                         XmNshadowThickness, 3,
964                         XmNshadowType, XmSHADOW_ETCHED_IN,
965                         XmNautoUnmanage, FALSE,
966                         XmNnoResize, FALSE,
967                         XmNallowOverlap, TRUE,
968                         XmNmarginHeight, 0,
969                         XmNverticalSpacing, 5,
970                         NULL );
971
972         CA_MED_IconForm = XtVaCreateManagedWidget( "CA_MED_IconForm",
973                         xmFormWidgetClass,
974                         CA_ActionIconForm,
975                         XmNresizePolicy, XmRESIZE_NONE,
976                         XmNborderWidth, ICON_BORDER_WIDTH,
977                         XmNleftPosition, 32,
978                         XmNleftOffset, 0,
979                         XmNleftAttachment, XmATTACH_POSITION,
980                         XmNbottomPosition, 88,
981                         XmNbottomOffset, 0,
982                         XmNbottomAttachment, XmATTACH_POSITION,
983                         NULL );
984
985         /* Creation of CA_MED_IconGadget */
986         emptyString = XmStringCreateLocalized("");
987         pIconData = (IconData *)XtMalloc(sizeof(IconData));
988         memset(pIconData, 0, sizeof(IconData));
989         IconDataList[CA_MED] = pIconData;
990         CA_MED_IconGadget = XtVaCreateManagedWidget( "CA_MED_IconGadget",
991                         dtIconGadgetClass,
992                         CA_MED_IconForm,
993                         XmNalignment, XmALIGNMENT_CENTER,
994                         XmNuserData, pIconData,
995                         XmNstring, emptyString,
996                         XmNrecomputeSize, TRUE,
997                         XmNleftOffset, BORDER_OFFSET,
998                         XmNleftAttachment, XmATTACH_FORM,
999                         XmNrightOffset, BORDER_OFFSET,
1000                         XmNrightAttachment, XmATTACH_FORM,
1001                         XmNtopOffset, BORDER_OFFSET,
1002                         XmNtopAttachment, XmATTACH_FORM,
1003                         XmNbottomOffset, BORDER_OFFSET,
1004                         XmNbottomAttachment, XmATTACH_FORM,
1005                         /*
1006                         XmNleftPosition, 32,
1007                         XmNleftOffset, 0,
1008                         XmNleftAttachment, XmATTACH_POSITION,
1009                         XmNbottomPosition, 88,
1010                         XmNbottomOffset, 0,
1011                         XmNbottomAttachment, XmATTACH_POSITION,
1012                         */
1013                         NULL );
1014         pIconData->wid = CA_MED_IconGadget;
1015         pIconData->size = Medium_Icon;
1016         XtAddCallback( CA_MED_IconGadget, XmNcallback,
1017                 (XtCallbackProc) activateCB_action_icon,
1018                 (XtPointer) NULL );
1019         createCB_IconGadget( CA_MED_IconGadget, TRUE, Medium_Icon );
1020         last_action_pushed = CA_MED_IconGadget;
1021
1022         CA_TINY_IconForm = XtVaCreateManagedWidget( "CA_TINY_IconForm",
1023                         xmFormWidgetClass,
1024                         CA_ActionIconForm,
1025                         XmNresizePolicy, XmRESIZE_NONE,
1026                         XmNborderWidth, 0,
1027                         XmNleftPosition, 52,
1028                         XmNleftOffset, 1,
1029                         XmNleftAttachment, XmATTACH_POSITION,
1030                         XmNbottomPosition, 88,
1031                         XmNbottomOffset, 0,
1032                         XmNbottomAttachment, XmATTACH_POSITION,
1033                         NULL );
1034
1035         /* Creation of CA_TINY_IconGadget */
1036         pIconData = (IconData *)XtMalloc(sizeof(IconData));
1037         memset(pIconData, 0, sizeof(IconData));
1038         IconDataList[CA_TINY] = pIconData;
1039         CA_TINY_IconGadget = XtVaCreateManagedWidget( "CA_TINY_IconGadget",
1040                         dtIconGadgetClass,
1041                         CA_TINY_IconForm,
1042                         XmNalignment, XmALIGNMENT_CENTER,
1043                         XmNuserData, pIconData,
1044                         XmNrecomputeSize, TRUE,
1045                         XmNstring, emptyString,
1046                         XmNleftOffset, BORDER_OFFSET,
1047                         XmNleftAttachment, XmATTACH_FORM,
1048                         XmNrightOffset, BORDER_OFFSET,
1049                         XmNrightAttachment, XmATTACH_FORM,
1050                         XmNtopOffset, BORDER_OFFSET,
1051                         XmNtopAttachment, XmATTACH_FORM,
1052                         XmNbottomOffset, BORDER_OFFSET,
1053                         XmNbottomAttachment, XmATTACH_FORM,
1054                         NULL );
1055         pIconData->wid = CA_TINY_IconGadget;
1056         pIconData->size = Tiny_Icon;
1057         XtAddCallback( CA_TINY_IconGadget, XmNcallback,
1058                 (XtCallbackProc) activateCB_action_icon,
1059                 (XtPointer) NULL );
1060         createCB_IconGadget( CA_TINY_IconGadget, TRUE, Tiny_Icon );
1061
1062         CA_LRG_IconForm = XtVaCreateManagedWidget( "CA_LRG_IconForm",
1063                         xmFormWidgetClass,
1064                         CA_ActionIconForm,
1065                         XmNresizePolicy, XmRESIZE_NONE,
1066                         XmNborderWidth, 0,
1067                         XmNleftPosition, 11,
1068                         XmNleftOffset, -1,
1069                         XmNleftAttachment, XmATTACH_POSITION,
1070                         XmNbottomPosition, 88,
1071                         XmNbottomOffset, 0,
1072                         XmNbottomAttachment, XmATTACH_POSITION,
1073                         NULL );
1074
1075         /* Creation of CA_LRG_IconGadget */
1076         pIconData = (IconData *)XtMalloc(sizeof(IconData));
1077         memset(pIconData, 0, sizeof(IconData));
1078         IconDataList[CA_LRG] = pIconData;
1079         CA_LRG_IconGadget = XtVaCreateManagedWidget( "CA_LRG_IconGadget",
1080                         dtIconGadgetClass,
1081                         CA_LRG_IconForm,
1082                         XmNalignment, XmALIGNMENT_CENTER,
1083                         XmNuserData, pIconData,
1084                         XmNstring, emptyString,
1085                         XmNrecomputeSize, TRUE,
1086                         XmNleftOffset, BORDER_OFFSET,
1087                         XmNleftAttachment, XmATTACH_FORM,
1088                         XmNrightOffset, BORDER_OFFSET,
1089                         XmNrightAttachment, XmATTACH_FORM,
1090                         XmNtopOffset, BORDER_OFFSET,
1091                         XmNtopAttachment, XmATTACH_FORM,
1092                         XmNbottomOffset, BORDER_OFFSET,
1093                         XmNbottomAttachment, XmATTACH_FORM,
1094                         NULL );
1095         pIconData->wid = CA_LRG_IconGadget;
1096         pIconData->size = Large_Icon;
1097         XtAddCallback( CA_LRG_IconGadget, XmNcallback,
1098                 (XtCallbackProc) activateCB_action_icon,
1099                 (XtPointer) NULL );
1100         createCB_IconGadget( CA_LRG_IconGadget, TRUE, Large_Icon );
1101
1102         XmStringFree(emptyString);
1103
1104         /* Creation of CA_EditIcon_button */
1105         CA_EditIcon_button = XtVaCreateManagedWidget( "CA_EditIcon_button",
1106                         xmPushButtonGadgetClass,
1107                         CA_ActionIconForm,
1108                         RES_CONVERT( XmNlabelString, GETMESSAGE(6, 20, "Edit Icon...")),
1109                         XmNalignment, XmALIGNMENT_BEGINNING,
1110                         XmNleftPosition, 68,
1111                         XmNleftOffset, 1,
1112                         XmNleftAttachment, XmATTACH_POSITION,
1113                         XmNtopPosition, 50,
1114                         XmNtopOffset, (int)(FINDEDIT_SPACING / 2),
1115                         XmNtopAttachment, XmATTACH_POSITION,
1116                         NULL );
1117         XtAddCallback( CA_EditIcon_button, XmNactivateCallback,
1118                 (XtCallbackProc) activateCB_edit_icon,
1119                 (XtPointer) CA_ACTION_ICONS );
1120
1121         /* Creation of CA_FindSet_button */
1122         CA_FindSet_button = XtVaCreateManagedWidget( "CA_FindSet_button",
1123                         xmPushButtonGadgetClass,
1124                         CA_ActionIconForm,
1125                         RES_CONVERT( XmNlabelString, GETMESSAGE(6, 19, "Find Set...")),
1126                         XmNalignment, XmALIGNMENT_BEGINNING,
1127                         XmNmultiClick, XmMULTICLICK_DISCARD,
1128                         XmNleftPosition, 68,
1129                         XmNleftOffset, 0,
1130                         XmNleftAttachment, XmATTACH_POSITION,
1131                         XmNbottomPosition, 50,
1132                         XmNbottomOffset, (int)(FINDEDIT_SPACING / 2),
1133                         XmNbottomAttachment, XmATTACH_POSITION,
1134                         NULL );
1135         XtAddCallback( CA_FindSet_button, XmNactivateCallback,
1136                 (XtCallbackProc) activateCB_open_FindSet,
1137                 (XtPointer) CA_ACTION_ICONS );
1138
1139         /******************************************************************/
1140         /* Determine which button is wider, and attach the short on to it */
1141         /******************************************************************/
1142         XtVaGetValues(CA_EditIcon_button, XmNwidth, &dim1, NULL);
1143         XtVaGetValues(CA_FindSet_button, XmNwidth, &dim2, NULL);
1144         if (dim1 > dim2) {
1145            XtVaSetValues(CA_FindSet_button,
1146                          XmNwidth, dim1,
1147                          NULL);
1148         } else {
1149            XtVaSetValues(CA_EditIcon_button,
1150                          XmNwidth, dim2,
1151                          NULL);
1152         }
1153         /******************************************************************/
1154         /* Determine vertical positioning for findset and edit buttons    */
1155         /******************************************************************/
1156         XtVaGetValues(CA_EditIcon_button, XmNheight, &dim1, NULL);
1157         XtVaGetValues(CA_FindSet_button, XmNheight, &dim2, NULL);
1158         if ((int)(dim1 + dim2) + (3*(FINDEDIT_SPACING)) > ICON_MIN_HEIGHT) {
1159            XtVaSetValues(CA_EditIcon_button,
1160                          XmNbottomOffset, FINDEDIT_SPACING,
1161                          XmNbottomAttachment, XmATTACH_FORM,
1162                          NULL);
1163            XtVaSetValues(CA_FindSet_button,
1164                          XmNbottomOffset, FINDEDIT_SPACING,
1165                          XmNbottomWidget, CA_EditIcon_button,
1166                          XmNbottomAttachment, XmATTACH_WIDGET,
1167                          XmNtopOffset, FINDEDIT_SPACING,
1168                          XmNtopAttachment, XmATTACH_FORM,
1169                          NULL);
1170         }
1171
1172
1173         /******************************************************************/
1174         /* Bogus separator to keep ActionIconForm a minimum height        */
1175         /******************************************************************/
1176         separator1 = XtVaCreateManagedWidget( "separator1",
1177                         xmSeparatorWidgetClass,
1178                         CA_ActionIconForm,
1179                         XmNx, 10,
1180                         XmNy, 10,
1181                         XmNwidth, 20,
1182                         XmNheight, ICON_MIN_HEIGHT,
1183                         XmNorientation, XmVERTICAL,
1184                         XmNseparatorType, XmNO_LINE,
1185                         XmNtopOffset, 5,
1186                         XmNtopAttachment, XmATTACH_FORM,
1187                         XmNbottomOffset, 5,
1188                         XmNbottomAttachment, XmATTACH_FORM,
1189                         NULL );
1190
1191         /*********************************************************************/
1192         /*                                                                   */
1193         /* Open Command                                                      */
1194         /*                                                                   */
1195         /*********************************************************************/
1196         /* Creation of CA_DblClkLabel */
1197         CA_DblClkLabel = XtVaCreateManagedWidget( "CA_DblClkLabel",
1198                         xmLabelWidgetClass,
1199                         CA_Form,
1200                         RES_CONVERT( XmNlabelString, GETMESSAGE(3, 22, "Command When Action Is Opened (Double-clicked):")),
1201                         XmNalignment, XmALIGNMENT_BEGINNING,
1202                         XmNleftOffset, 10,
1203                         XmNleftAttachment, XmATTACH_FORM,
1204                         XmNtopOffset, 15,
1205                         XmNtopWidget, CA_ActionIconForm,
1206                         XmNtopAttachment, XmATTACH_WIDGET,
1207                         XmNrightOffset, 10,
1208                         XmNrightAttachment, XmATTACH_FORM,
1209                         NULL );
1210
1211         /* Creation of CA_DblClkText */
1212         CA_DblClkText = XtVaCreateManagedWidget( "CA_DblClkText",
1213                         xmTextFieldWidgetClass,
1214                         CA_Form,
1215                         XmNnavigationType, XmTAB_GROUP,
1216                         XmNtopOffset, 0,
1217                         XmNtopWidget, CA_DblClkLabel,
1218                         XmNtopAttachment, XmATTACH_WIDGET,
1219                         XmNleftOffset, 10,
1220                         XmNleftAttachment, XmATTACH_FORM,
1221                         XmNrightOffset, 10,
1222                         XmNrightAttachment, XmATTACH_FORM,
1223                         XmNrows, 1,
1224                         NULL );
1225
1226         /*********************************************************************/
1227         /*                                                                   */
1228         /* Help Text Label                                                   */
1229         /*                                                                   */
1230         /*********************************************************************/
1231         /* Creation of CA_HlpTxtLabel */
1232         CA_HlpTxtLabel = XtVaCreateManagedWidget( "CA_HlpTxtLabel",
1233                         xmLabelWidgetClass,
1234                         CA_Form,
1235                         RES_CONVERT( XmNlabelString, GETMESSAGE(3, 30, "Help Text For Action Icon:")),
1236                         XmNalignment, XmALIGNMENT_BEGINNING,
1237                         XmNleftOffset, 10,
1238                         XmNleftAttachment, XmATTACH_FORM,
1239                         XmNtopOffset, 15,
1240                         XmNtopWidget, CA_DblClkText,
1241                         XmNtopAttachment, XmATTACH_WIDGET,
1242                         XmNrightOffset, 10,
1243                         XmNrightAttachment, XmATTACH_FORM,
1244                         NULL );
1245
1246         /*********************************************************************/
1247         /*                                                                   */
1248         /* Advanced Features Area                                            */
1249         /*                                                                   */
1250         /*********************************************************************/
1251         /* Creation of XprtOptionForm */
1252         XprtOptionForm = XtVaCreateManagedWidget( "XprtOptionForm",
1253                         xmFormWidgetClass,
1254                         CA_Form,
1255                         XmNresizePolicy, XmRESIZE_ANY,
1256                         XmNleftOffset, 1,
1257                         XmNleftAttachment, XmATTACH_FORM,
1258                         XmNrightOffset, 1,
1259                         XmNrightAttachment, XmATTACH_FORM,
1260                         XmNbottomOffset, 0,
1261                         XmNbottomAttachment, XmATTACH_FORM,
1262                         NULL );
1263
1264         /*********************************************************************/
1265         /*                                                                   */
1266         /* Optional Separator                                                */
1267         /*                                                                   */
1268         /*********************************************************************/
1269
1270         /* Creation of CA_XprtSep1 */
1271         CA_XprtSep1 = XtVaCreateManagedWidget( "CA_XprtSep1",
1272                         xmSeparatorWidgetClass,
1273                         XprtOptionForm,
1274                         XmNleftOffset, 1,
1275                         XmNleftAttachment, XmATTACH_FORM,
1276                         XmNrightOffset, 1,
1277                         XmNrightAttachment, XmATTACH_FORM,
1278                         XmNtopOffset, 0,
1279                         XmNtopAttachment, XmATTACH_FORM,
1280                         NULL );
1281
1282         /*********************************************************************/
1283         /*                                                                   */
1284         /* Prompt Field                                                      */
1285         /*                                                                   */
1286         /*********************************************************************/
1287         /* Creation of CA_ActionOpenLabel */
1288         CA_ActionOpenLabel = XtVaCreateManagedWidget( "CA_ActionOpenLabel",
1289                         xmLabelWidgetClass,
1290                         XprtOptionForm,
1291                         RES_CONVERT( XmNlabelString, GETMESSAGE(4, 11, "When Action Opens, Ask Users for:")),
1292                         XmNalignment, XmALIGNMENT_BEGINNING,
1293                         XmNleftOffset, 10,
1294                         XmNleftAttachment, XmATTACH_FORM,
1295                         XmNrightOffset, 10,
1296                         XmNrightAttachment, XmATTACH_FORM,
1297                         XmNtopOffset, 15,
1298                         XmNtopWidget, CA_XprtSep1,
1299                         XmNtopAttachment, XmATTACH_WIDGET,
1300                         NULL );
1301
1302         /* Creation of CA_XprtActionOpenText */
1303         CA_XprtActionOpenText = XtVaCreateManagedWidget( "CA_XprtActionOpenText",
1304                         xmTextWidgetClass,
1305                         XprtOptionForm,
1306                         XmNvalue, "",
1307                         XmNnavigationType, XmTAB_GROUP,
1308                         XmNleftOffset, 10,
1309                         XmNleftAttachment, XmATTACH_FORM,
1310                         XmNrightOffset, 10,
1311                         XmNrightAttachment, XmATTACH_FORM,
1312                         XmNtopOffset, 0,
1313                         XmNtopWidget, CA_ActionOpenLabel,
1314                         XmNtopAttachment, XmATTACH_WIDGET,
1315                       /*XmNeditMode, XmMULTI_LINE_EDIT,*/
1316                       /*XmNwordWrap, TRUE,*/
1317                         NULL );
1318
1319         /*********************************************************************/
1320         /*                                                                   */
1321         /* Filetypes that use this Action area                               */
1322         /*                                                                   */
1323         /*********************************************************************/
1324         /* Creation of CA_FiletypesLabel */
1325         CA_FiletypesLabel = XtVaCreateManagedWidget( "CA_FiletypesLabel",
1326                         xmLabelWidgetClass,
1327                         XprtOptionForm,
1328                         XmNx, 10,
1329                         XmNy, 122,
1330                         RES_CONVERT( XmNlabelString, GETMESSAGE(4, 12, "Datatypes That Use This Action:")),
1331                         XmNalignment, XmALIGNMENT_BEGINNING,
1332                         XmNleftOffset, 10,
1333                         XmNleftAttachment, XmATTACH_FORM,
1334                         XmNrightOffset, 10,
1335                         XmNrightAttachment, XmATTACH_FORM,
1336                         XmNtopOffset, 15,
1337                         XmNtopWidget, CA_XprtActionOpenText,
1338                         XmNtopAttachment, XmATTACH_WIDGET,
1339                         NULL );
1340
1341         /*********************************************************************/
1342         /*                                                                   */
1343         /* Add, Delete, Edit buttons for Filetypes                           */
1344         /*                                                                   */
1345         /*********************************************************************/
1346         /* Creation of rowColumn1 */
1347         rowColumn1 = XtVaCreateManagedWidget( "rowColumn1",
1348                         xmRowColumnWidgetClass,
1349                         XprtOptionForm,
1350                         XmNnavigationType, XmTAB_GROUP,
1351                         XmNtopOffset, 0,
1352                         XmNtopWidget, CA_FiletypesLabel,
1353                         XmNtopAttachment, XmATTACH_WIDGET,
1354                         XmNrightOffset, 10,
1355                         XmNrightAttachment, XmATTACH_FORM,
1356                         NULL );
1357
1358         /* Creation of CA_FiletypesAdd */
1359         CA_FiletypesAdd = XtVaCreateManagedWidget( "CA_FiletypesAdd",
1360                         xmPushButtonGadgetClass,
1361                         rowColumn1,
1362                         RES_CONVERT( XmNlabelString, GETMESSAGE(4, 13, "Add...")),
1363                         XmNalignment, XmALIGNMENT_BEGINNING,
1364                         XmNmarginLeft, 5,
1365                         XmNmarginRight, 5,
1366                         NULL );
1367         XtAddCallback( CA_FiletypesAdd, XmNactivateCallback,
1368                 (XtCallbackProc) activateCB_add_filetype,
1369                 (XtPointer) NULL );
1370
1371         /* Creation of CA_FiletypesDelete */
1372         CA_FiletypesDelete = XtVaCreateManagedWidget( "CA_FiletypesDelete",
1373                         xmPushButtonGadgetClass,
1374                         rowColumn1,
1375                         RES_CONVERT( XmNlabelString, GETMESSAGE(4, 14, "Delete")),
1376                         XmNalignment, XmALIGNMENT_BEGINNING,
1377                         XmNmarginLeft, 5,
1378                         XmNmarginRight, 5,
1379                         NULL );
1380         XtAddCallback( CA_FiletypesDelete, XmNactivateCallback,
1381                 (XtCallbackProc) activateCB_CA_FiletypesDelete,
1382                 (XtPointer) NULL );
1383
1384         /* Creation of CA_FiletypesEdit */
1385         CA_FiletypesEdit = XtVaCreateManagedWidget( "CA_FiletypesEdit",
1386                         xmPushButtonGadgetClass,
1387                         rowColumn1,
1388                         RES_CONVERT( XmNlabelString, GETMESSAGE(4, 15, "Edit...")),
1389                         XmNalignment, XmALIGNMENT_BEGINNING,
1390                         XmNmarginLeft, 5,
1391                         XmNmarginRight, 5,
1392                         NULL );
1393         XtAddCallback( CA_FiletypesEdit, XmNactivateCallback,
1394                 (XtCallbackProc) activateCB_edit_filetype,
1395                 (XtPointer) NULL );
1396
1397         /*********************************************************************/
1398         /*                                                                   */
1399         /* Filetypes Listbox Area                                            */
1400         /*                                                                   */
1401         /*********************************************************************/
1402         /* Creation of CA_FiletypesWindow */
1403         CA_FiletypesWindow = XtVaCreateManagedWidget( "CA_FiletypesWindow",
1404                         xmScrolledWindowWidgetClass,
1405                         XprtOptionForm,
1406                         XmNx, 10,
1407                         XmNy, 140,
1408                         XmNshadowThickness, 2,
1409                         XmNleftOffset, 10,
1410                         XmNleftAttachment, XmATTACH_FORM,
1411                         XmNtopOffset, 0,
1412                         XmNtopWidget, CA_FiletypesLabel,
1413                         XmNtopAttachment, XmATTACH_WIDGET,
1414                         XmNbottomOffset, 0,
1415                         XmNbottomWidget, rowColumn1,
1416                         XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
1417                         XmNrightOffset, 10,
1418                         XmNrightWidget, rowColumn1,
1419                         XmNrightAttachment, XmATTACH_WIDGET,
1420                         NULL );
1421
1422         /* Creation of CA_FiletypesList */
1423         CA_FiletypesList = XtVaCreateManagedWidget( "CA_FiletypesList",
1424                         xmListWidgetClass,
1425                         CA_FiletypesWindow,
1426                         XmNselectionPolicy, XmSINGLE_SELECT,
1427                         XmNshadowThickness, 0,
1428                         NULL );
1429
1430         /*********************************************************************/
1431         /*                                                                   */
1432         /* Droppable Filetypes Toggle Area                                   */
1433         /*                                                                   */
1434         /*********************************************************************/
1435         /* Creation of CA_DroppableFiletypesLabel */
1436         CA_DroppableFiletypesLabel = XtVaCreateManagedWidget( "CA_DroppableFiletypesLabel",
1437                         xmLabelWidgetClass,
1438                         XprtOptionForm,
1439                         XmNx, 10,
1440                         XmNy, 204,
1441                         XmNalignment, XmALIGNMENT_BEGINNING,
1442                         RES_CONVERT( XmNlabelString, GETMESSAGE(4, 16, "Dropable Datatypes:")),
1443                         XmNleftOffset, 10,
1444                         XmNleftAttachment, XmATTACH_FORM,
1445                         XmNtopOffset, 15,
1446                         XmNtopWidget, rowColumn1,
1447                         XmNtopAttachment, XmATTACH_WIDGET,
1448                         NULL );
1449
1450         if (bLowRes) {
1451            /* Creation of CA_DroppableFiletypesRowColumn */
1452            CA_DroppableFiletypesRowColumn = XtVaCreateManagedWidget( "CA_DroppableFiletypesRowColumn",
1453                            xmRowColumnWidgetClass,
1454                            XprtOptionForm,
1455                            XmNx, 200,
1456                            XmNy, 204,
1457                            RES_CONVERT( XmNlabelString, "" ),
1458                            XmNorientation, XmHORIZONTAL,
1459                            XmNpacking, XmPACK_TIGHT,
1460                            XmNradioBehavior, TRUE,
1461                            XmNwhichButton, 1,
1462                            XmNnavigationType, XmTAB_GROUP,
1463                            XmNtopOffset, 0,
1464                            XmNtopWidget, CA_DroppableFiletypesLabel,
1465                            XmNtopAttachment, XmATTACH_WIDGET,
1466                            XmNbottomOffset, 0,
1467                            XmNbottomAttachment, XmATTACH_FORM,
1468                            XmNleftOffset, 10,
1469                            XmNleftAttachment, XmATTACH_FORM,
1470                            XmNrightOffset, 10,
1471                            XmNrightAttachment, XmATTACH_FORM,
1472                            NULL );
1473         } else {
1474            /* Creation of CA_DroppableFiletypesRowColumn */
1475            CA_DroppableFiletypesRowColumn = XtVaCreateManagedWidget( "CA_DroppableFiletypesRowColumn",
1476                            xmRowColumnWidgetClass,
1477                            XprtOptionForm,
1478                            RES_CONVERT( XmNlabelString, "" ),
1479                            XmNorientation, XmHORIZONTAL,
1480                            XmNpacking, XmPACK_TIGHT,
1481                            XmNradioBehavior, TRUE,
1482                            XmNwhichButton, 1,
1483                            XmNnavigationType, XmTAB_GROUP,
1484                            XmNtopOffset, -7,
1485                            XmNtopWidget, CA_DroppableFiletypesLabel,
1486                            XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1487                            XmNbottomOffset, 0,
1488                            XmNbottomAttachment, XmATTACH_FORM,
1489                            XmNleftOffset, 0,
1490                            XmNleftWidget, CA_DroppableFiletypesLabel,
1491                            XmNleftAttachment, XmATTACH_WIDGET,
1492                            XmNrightOffset, 10,
1493                            XmNrightAttachment, XmATTACH_FORM,
1494                            NULL );
1495         }
1496
1497         /* Creation of CA_AllFiletypesToggle */
1498         CA_AllFiletypesToggle = XtVaCreateManagedWidget( "CA_AllFiletypesToggle",
1499                         xmToggleButtonWidgetClass,
1500                         CA_DroppableFiletypesRowColumn,
1501                         RES_CONVERT( XmNlabelString, GETMESSAGE(4, 17, "All Datatypes")),
1502                         XmNset, TRUE,
1503                         NULL );
1504
1505         /* Creation of CA_FiletypesInListToggle */
1506         CA_FiletypesInListToggle = XtVaCreateManagedWidget( "CA_FiletypesInListToggle",
1507                         xmToggleButtonWidgetClass,
1508                         CA_DroppableFiletypesRowColumn,
1509                         RES_CONVERT( XmNlabelString, GETMESSAGE(4, 18, "Only Above List")),
1510                         NULL );
1511         XtAddCallback( CA_FiletypesInListToggle, XmNvalueChangedCallback,
1512                 (XtCallbackProc) valueChangedCB_DroppableFiletypes,
1513                 (XtPointer) CA_DF_ONLYFTFILES );
1514
1515
1516         /*********************************************************************/
1517         /*                                                                   */
1518         /* Expand button                                                     */
1519         /*                                                                   */
1520         /*********************************************************************/
1521         CA_Expand = XtVaCreateManagedWidget( "CA_Expand",
1522                         xmPushButtonWidgetClass,
1523                         CA_Form,
1524                         RES_CONVERT( XmNlabelString, GETMESSAGE(3, 50, "Advanced")),
1525                         XmNmultiClick, XmMULTICLICK_DISCARD,
1526                         XmNnavigationType, XmTAB_GROUP,
1527                         XmNmarginLeft, 5,
1528                         XmNmarginRight, 5,
1529                         XmNleftOffset, 10,
1530                         XmNleftAttachment, XmATTACH_FORM,
1531                         XmNbottomOffset, 20,
1532                         XmNbottomWidget, XprtOptionForm,
1533                         XmNbottomAttachment, XmATTACH_WIDGET,
1534                         NULL );
1535         XtAddCallback( CA_Expand, XmNactivateCallback,
1536                 (XtCallbackProc) activateCB_ExpertOption,
1537                 (XtPointer) NULL );
1538
1539         /*********************************************************************/
1540         /*                                                                   */
1541         /* Start of WindowType Option Menu                                   */
1542         /*                                                                   */
1543         /*********************************************************************/
1544         CA_WindowType_OptionMenuShell = XtVaCreatePopupShell ("CA_WindowType_OptionMenuShell",
1545                         xmMenuShellWidgetClass,
1546                         CA_Form,
1547                         XmNwidth, 1,
1548                         XmNheight, 1,
1549                         XmNallowShellResize, TRUE,
1550                         XmNoverrideRedirect, TRUE,
1551                         NULL );
1552
1553         CA_WindowType_Pane = XtVaCreateWidget( "CA_WindowType_Pane",
1554                         xmRowColumnWidgetClass,
1555                       /*CA_WindowType,*/
1556                         CA_WindowType_OptionMenuShell,
1557                         XmNrowColumnType, XmMENU_PULLDOWN,
1558                         NULL );
1559
1560         CA_WinTypeX = XtVaCreateManagedWidget( "CA_WinTypeX",
1561                         xmPushButtonWidgetClass,
1562                         CA_WindowType_Pane,
1563                         RES_CONVERT( XmNlabelString, GETMESSAGE(3, 34, "Graphical (X-Window)")),
1564                         NULL );
1565         XtAddCallback( CA_WinTypeX, XmNactivateCallback,
1566                 (XtCallbackProc) activateCB_WindowTypeOptionMenu,
1567                 (XtPointer) CA_WT_XWINDOWS );
1568
1569         CA_WinTypeAutoClose = XtVaCreateManagedWidget( "CA_WinTypeAutoClose",
1570                         xmPushButtonWidgetClass,
1571                         CA_WindowType_Pane,
1572                         RES_CONVERT( XmNlabelString, GETMESSAGE(3, 36, "Terminal (Auto-Close)")),
1573                         NULL );
1574         XtAddCallback( CA_WinTypeAutoClose, XmNactivateCallback,
1575                 (XtCallbackProc) activateCB_WindowTypeOptionMenu,
1576                 (XtPointer) CA_WT_TERM );
1577
1578         CA_WinTypeManualClose = XtVaCreateManagedWidget( "CA_WinTypeManualClose",
1579                         xmPushButtonWidgetClass,
1580                         CA_WindowType_Pane,
1581                         RES_CONVERT( XmNlabelString, GETMESSAGE(3, 38, "Terminal (Manual Close)")),
1582                         NULL );
1583         XtAddCallback( CA_WinTypeManualClose, XmNactivateCallback,
1584                 (XtCallbackProc) activateCB_WindowTypeOptionMenu,
1585                 (XtPointer) CA_WT_PERMTERM );
1586
1587         CA_WinTypeNoOutput = XtVaCreateManagedWidget( "CA_WinTypeNoOutput",
1588                         xmPushButtonWidgetClass,
1589                         CA_WindowType_Pane,
1590                         RES_CONVERT( XmNlabelString, GETMESSAGE(3, 40, "No Output")),
1591                         NULL );
1592         XtAddCallback( CA_WinTypeNoOutput, XmNactivateCallback,
1593                 (XtCallbackProc) activateCB_WindowTypeOptionMenu,
1594                 (XtPointer) CA_WT_XWINDOWS );
1595
1596         CA_WindowType_OptionMenu = XtVaCreateManagedWidget( "CA_WindowType_OptionMenu",
1597                         xmRowColumnWidgetClass,
1598                         CA_Form,
1599                         XmNrowColumnType, XmMENU_OPTION,
1600                         XmNsubMenuId, CA_WindowType_Pane,
1601                         RES_CONVERT( XmNlabelString, GETMESSAGE(3, 32, "Window Type: ")),
1602                         XmNnavigationType, XmTAB_GROUP,
1603                         XmNleftOffset, 10,
1604                         XmNleftAttachment, XmATTACH_FORM,
1605                         XmNrightOffset, 10,
1606                         XmNrightAttachment, XmATTACH_FORM,
1607                         XmNbottomOffset, 15,
1608                         XmNbottomWidget, CA_Expand,
1609                         XmNbottomAttachment, XmATTACH_WIDGET,
1610                         NULL );
1611         CA_WindowTypeArea = CA_WindowType_OptionMenu;
1612
1613         /*********************************************************************/
1614         /*                                                                   */
1615         /* Help Text Window                                                  */
1616         /*                                                                   */
1617         /*********************************************************************/
1618         /* Creation of CA_HelpTextWindow */
1619         CA_HelpTextWindow = XtVaCreateManagedWidget( "CA_HelpTextWindow",
1620                         xmScrolledWindowWidgetClass,
1621                         CA_Form,
1622                         XmNx, 10,
1623                         XmNy, 336,
1624                         XmNshadowThickness, 0,
1625                         XmNtopOffset, 0,
1626                         XmNtopWidget, CA_HlpTxtLabel,
1627                         XmNtopAttachment, XmATTACH_WIDGET,
1628                         XmNleftOffset, 10,
1629                         XmNleftAttachment, XmATTACH_FORM,
1630                         XmNrightOffset, 10,
1631                         XmNrightAttachment, XmATTACH_FORM,
1632                         XmNbottomOffset, 15,
1633                         XmNbottomWidget, CA_WindowTypeArea,
1634                         XmNbottomAttachment, XmATTACH_WIDGET,
1635                         NULL );
1636
1637         /* Creation of CA_HelpText */
1638         CA_HelpText = XtVaCreateManagedWidget( "CA_HelpText",
1639                         xmTextWidgetClass,
1640                         CA_HelpTextWindow,
1641                         XmNeditMode, XmMULTI_LINE_EDIT ,
1642                         XmNscrollVertical, TRUE,
1643                         XmNscrollHorizontal, FALSE,
1644                         XmNwordWrap, TRUE,
1645                         XmNx, 12,
1646                         XmNy, 0,
1647                         XmNrows, 3,
1648                         NULL );
1649
1650         /*********************************************************************/
1651         /*                                                                   */
1652         /* Misc.                                                             */
1653         /*                                                                   */
1654         /*********************************************************************/
1655         XtVaSetValues(CA_MenuBar,
1656                         XmNmenuHelpWidget, CA_MB_HelpTop,
1657                         NULL );
1658
1659         XtAddCallback( CreateActionAppShell, XmNdestroyCallback,
1660                 (XtCallbackProc) UxDestroyContextCB,
1661                 (XtPointer) NULL );
1662
1663         XmMainWindowSetAreas( CreateActionMainWindow, CA_MenuBar, (Widget) NULL,
1664                         (Widget) NULL, (Widget) NULL, CA_Form );
1665
1666         return ( CreateActionAppShell );
1667 }
1668
1669 /*******************************************************************************
1670        The following is the 'Interface function' which is the
1671        external entry point for creating this interface.
1672        This function should be called from your application or from
1673        a callback function.
1674 *******************************************************************************/
1675
1676 Widget  create_applicationShell1(swidget _UxUxParent)
1677 {
1678         Widget                   rtrn;
1679         _UxCCreateActionAppShell *UxContext;
1680         Dimension                dimHeight;
1681         Dimension                dimWidth;
1682         Dimension                dimTmp;
1683         Widget                   widTmp;
1684
1685         UxCreateActionAppShellContext = UxContext =
1686                 (_UxCCreateActionAppShell *) UxNewContext( sizeof(_UxCCreateActionAppShell), False );
1687
1688         UxParent = _UxUxParent;
1689
1690         rtrn = _Uxbuild_CreateActionAppShell();
1691
1692         /******************************************************************/
1693         /* Need to realize app shell widget now, because we need to       */
1694         /* determine initial geometry before the advanced area is         */
1695         /* unmanaged in   set_ca_dialog_height  routine.                  */
1696         /******************************************************************/
1697         XtSetMappedWhenManaged(rtrn, False);
1698         XtRealizeWidget(rtrn);
1699         XmProcessTraversal(CA_ActionNameTextField, XmTRAVERSE_CURRENT);
1700
1701         FileTypes = (Widget)CA_FiletypesList;
1702
1703         set_ca_dialog_height ();
1704
1705         if (sessiondata.useSession) {
1706            XtVaSetValues (CreateActionAppShell,
1707                           XmNx, sessiondata.x,
1708                           XmNy, sessiondata.y,
1709                           XmNwidth, sessiondata.width,
1710                           XmNheight, sessiondata.height,
1711                           XmNinitialState, sessiondata.iconicState,
1712                           NULL);
1713
1714            /* display in workspace */
1715
1716            if (sessiondata.workspaces[0])
1717            {
1718                char *workspaces = sessiondata.workspaces;
1719                char *ptr;
1720                Atom * workspace_atoms = NULL;
1721                int num_workspaces = 0;
1722                do
1723                {
1724                    ptr = strchr (workspaces, '*');
1725                    if (ptr != NULL) *ptr = '\0';
1726
1727                    workspace_atoms = (Atom *) XtRealloc (
1728                                 (char *)workspace_atoms, 
1729                                 sizeof (Atom) * (num_workspaces + 1));
1730                    workspace_atoms[num_workspaces] = XmInternAtom(
1731                                         XtDisplay(CreateActionAppShell),
1732                                         workspaces, True);
1733
1734                    num_workspaces++;                            
1735                    if (ptr != NULL)
1736                    {
1737                        *ptr = '*';
1738                        workspaces = ptr + 1;
1739                    }
1740                } while (ptr != NULL);
1741                DtWsmSetWorkspacesOccupied( XtDisplay(CreateActionAppShell),
1742                                            XtWindow(CreateActionAppShell),
1743                                            workspace_atoms,
1744                                            num_workspaces);
1745                XtFree ((char *) workspace_atoms);
1746                workspace_atoms = NULL;
1747            }
1748         }
1749         else if (bLowRes) {
1750            XtVaGetValues (CA_Form,
1751                           XmNheight, &dimHeight,
1752                           XmNwidth, &dimWidth,
1753                           NULL);
1754            XtVaGetValues (CreateActionMainWindow,
1755                           XmNverticalScrollBar, &widTmp,
1756                           NULL);
1757            XtVaGetValues (widTmp,
1758                           XmNwidth, &dimTmp,
1759                           NULL);
1760            dimHeight += dimTmp;
1761            dimWidth += dimTmp;
1762
1763            XtVaGetValues (CA_MenuBar,
1764                           XmNheight, &dimTmp,
1765                           NULL);
1766            dimHeight += dimTmp;
1767
1768            XtVaSetValues (CreateActionAppShell,
1769                           XmNheight, dimHeight,
1770                           XmNwidth, dimWidth,
1771                           NULL);
1772         }
1773
1774         XtSetMappedWhenManaged(rtrn, True);
1775         XtManageChild(rtrn);
1776
1777         return(rtrn);
1778 }
1779
1780 /*******************************************************************************
1781        END OF FILE
1782 *******************************************************************************/
1783