2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
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
23 /* $TOG: AddFiletype.c /main/8 1999/09/17 15:43:02 mgreess $ */
24 /***************************************************************************/
28 /* Associated Header file: AddFiletype.h */
31 /***************************************************************************/
37 #include <Xm/MwmUtil.h>
38 #include <Xm/DialogS.h>
39 #include <Xm/MenuShell.h>
40 #include <Xm/Separator.h>
42 #include <Xm/ScrolledW.h>
46 #include <Xm/PushBG.h>
56 #include "CreateActionAppShell.h"
59 #define CONTEXT_MACRO_ACCESS 1
60 #include "AddFiletype.h"
61 #undef CONTEXT_MACRO_ACCESS
63 /*******************************************************************************
65 *******************************************************************************/
67 enum mode {NONE, NEW, SAVE, QUIT};
71 enum icon_size_range filetype_icon_size = None_Selected;
73 enum icon_size_range filetype_icon_size;
76 /*******************************************************************************
77 The following are callback functions.
78 *******************************************************************************/
81 /******************************************************************************/
83 /* LayoutCB_AddFiletype */
85 /* INPUT: Widget wid - window id */
86 /* XtPointer cdata - client data */
87 /* XtPointer *cbstruct - callback data */
90 /******************************************************************************/
91 void LayoutCB_AddFiletype(Widget wid, XtPointer cdata, XtPointer cbs)
93 printf("In layout callback of AddFiletype\n");
97 /******************************************************************************/
98 /* activateCB_edit_id_characteristics - bring up file characteristics dialog */
99 /* INPUT: Widget filesel - edit button id */
100 /* XtPointer cdata - client data */
101 /* XtPointer *cbstruct - callback data */
103 /******************************************************************************/
104 void activateCB_edit_id_characteristics (Widget filesel, XtPointer cdata,
105 XmFileSelectionBoxCallbackStruct *cbstruct)
109 XtVaGetValues (AddFiletype,
113 /*FileCharacteristics = create_FileCharacteristics();*/
115 XtVaSetValues (FileCharacteristics,
118 clear_FileCharacteristics_dialog_fields();
119 init_FileCharacteristics_dialog_fields(pFtD);
120 UxPopupInterface (FILE_CHARACTERISTICS, no_grab);
124 static void activateCB_AF_OkButton( Widget UxWidget,
125 XtPointer UxClientData,
126 XtPointer UxCallbackArg)
129 FiletypeData **papArray;
132 /**************************************************************************/
133 /* Check if fields are valid. */
134 /**************************************************************************/
135 if (!AddFiletypeCheckFields()) {
137 /***********************************************************************/
138 /* Get FiletypeData structure that was allocated when Add button on */
139 /* the CreateActionAppShell interface was activated. */
140 /***********************************************************************/
141 XtVaGetValues(AddFiletype, XmNuserData, &pFtD, NULL);
143 /***********************************************************************/
144 /* Get all values from gui */
145 /***********************************************************************/
148 /***********************************************************************/
149 /* If in edit mode, then don't do add type things. */
150 /***********************************************************************/
151 if (!(pFtD->fsInternal & CA_FT_EDIT)) {
153 /********************************************************************/
154 /* Update the Filetype listbox with this new filetype */
155 /********************************************************************/
158 /********************************************************************/
159 /* Update FiletypeData array within the ActionData structure */
160 /********************************************************************/
161 UpdateFiletypeDataArray(pFtD);
165 /***********************************************************************/
166 /* Unset previous set values. */
167 /***********************************************************************/
168 pFtD->fsInternal &= (~(CA_FT_APPLY));
169 pFtD->fsInternal &= (~(CA_FT_EDIT));
171 /***********************************************************************/
172 /* Pop down the AddFiletype interface */
173 /***********************************************************************/
174 UxPopdownInterface(AddFiletype);
178 static void activateCB_AF_ApplyButton( Widget UxWidget,
179 XtPointer UxClientData,
180 XtPointer UxCallbackArg)
184 /**************************************************************************/
185 /* Check if fields are valid. */
186 /**************************************************************************/
187 if (!AddFiletypeCheckFields()) {
189 /***********************************************************************/
190 /* Get FiletypeData structure that was allocated when Add button on */
191 /* the CreateActionAppShell interface was activated. */
192 /***********************************************************************/
193 XtVaGetValues(AddFiletype, XmNuserData, &pFtD, NULL);
195 /***********************************************************************/
196 /* Get all values from gui */
197 /***********************************************************************/
200 /***********************************************************************/
201 /* Set the variable that indicates that Apply button was used. */
202 /***********************************************************************/
203 pFtD->fsInternal |= CA_FT_APPLY;
205 /***********************************************************************/
206 /* If in edit mode, then don't do apply type things. */
207 /***********************************************************************/
208 if (!(pFtD->fsInternal & CA_FT_EDIT)) {
210 /********************************************************************/
211 /* Update the Filetype listbox with this new filetype */
212 /********************************************************************/
213 if (XmListItemExists(CA_FiletypesList, XmStringCreateSimple("NONE"))) {
214 XmListDeleteItem(CA_FiletypesList, XmStringCreateSimple("NONE"));
218 /********************************************************************/
219 /* Update FiletypeData array within the ActionData structure */
220 /********************************************************************/
221 UpdateFiletypeDataArray(pFtD);
227 static void activateCB_AF_CancelButton( Widget UxWidget,
228 XtPointer UxClientData,
229 XtPointer UxCallbackArg)
233 UxPopdownInterface(AddFiletype);
234 XtVaGetValues(AddFiletype, XmNuserData, &pFtD, NULL);
235 if (!((pFtD->fsInternal & CA_FT_APPLY) || (pFtD->fsInternal & CA_FT_EDIT))) {
236 free_Filetypedata(pFtD);
238 pFtD->fsInternal &= (~(CA_FT_APPLY));
239 pFtD->fsInternal &= (~(CA_FT_EDIT));
243 /*******************************************************************************
244 The 'build_' function creates all the widgets
245 using the resource values specified in the Property Editor.
246 *******************************************************************************/
248 static Widget _Uxbuild_AddFiletype(void)
252 Widget AF_CharacteristicsWindow;
253 Widget ActionAreaForm;
254 int ntotalbuttons = 4;
256 Widget AF_ScrolledWindow;
258 Dimension dim1, dim2, dim3;
259 Widget AF_MED_IconForm, AF_TINY_IconForm;
261 char *pre, *suf, *title;
263 XmString emptyString;
267 #define ICON_MIN_HEIGHT 83
268 #define FINDEDIT_SPACING 6
269 #define BORDER_OFFSET 3
271 /* Creation of AddFiletype */
272 _UxParent = UxParent;
273 if ( _UxParent == NULL )
275 _UxParent = UxTopLevel;
278 pre = GETMESSAGE(3, 10, "Create Action");
279 suf = GETMESSAGE(7, 10, "Add Datatype");
280 len = strlen(pre) + strlen(suf) + 4;
281 title = XtMalloc(len);
282 snprintf(title,len - 1, "%s - %s", pre, suf);
284 _UxParent = XtVaCreatePopupShell( "AddFiletype_shell",
285 xmDialogShellWidgetClass, _UxParent,
288 XmNshellUnitType, XmPIXELS,
292 XtAddCallback(_UxParent, XmNpopupCallback, LayoutCB_AddFiletype, NULL);
296 AF_BigForm = XtVaCreateWidget( "AF_BigForm",
299 XmNunitType, XmPIXELS,
300 XmNdialogStyle, XmDIALOG_APPLICATION_MODAL,
301 RES_CONVERT( XmNdialogTitle, title ),
302 XmNautoUnmanage, FALSE,
304 AF_ScrolledWindow = XtVaCreateManagedWidget( "AF_ScrolledWindow",
305 xmScrolledWindowWidgetClass,
307 XmNscrollingPolicy, XmAUTOMATIC,
308 XmNleftAttachment, XmATTACH_FORM,
309 XmNrightAttachment, XmATTACH_FORM,
310 XmNbottomAttachment, XmATTACH_FORM,
311 XmNtopAttachment, XmATTACH_FORM,
313 XtVaSetValues(AF_BigForm, XmNuserData, AF_ScrolledWindow, NULL);
315 AddFiletype = XtVaCreateManagedWidget( "AddFiletype",
320 AddFiletype = XtVaCreateWidget( "AddFiletype",
323 XmNunitType, XmPIXELS,
324 XmNdialogStyle, XmDIALOG_APPLICATION_MODAL,
325 RES_CONVERT( XmNdialogTitle, title ),
326 XmNautoUnmanage, FALSE,
332 XtAddCallback( AddFiletype, XmNhelpCallback,
333 (XtCallbackProc) helpCB_general,
334 (XtPointer) HELP_ADDFILETYPE );
336 /* Creation of AF_FiletypeFamilyNameLabel */
337 AF_FiletypeFamilyNameLabel = XtVaCreateManagedWidget( "AF_FiletypeFamilyNameLabel",
340 RES_CONVERT( XmNlabelString, GETMESSAGE(7, 14, "Name of Datatype Family:")),
341 XmNalignment, XmALIGNMENT_BEGINNING,
343 XmNtopAttachment, XmATTACH_FORM,
345 XmNleftAttachment, XmATTACH_FORM,
347 XmNrightAttachment, XmATTACH_FORM,
350 /* Creation of AF_FileTypeNameTextField */
351 AF_FileTypeNameTextField = XtVaCreateManagedWidget( "AF_FileTypeNameTextField",
352 xmTextFieldWidgetClass,
355 XmNtopWidget, AF_FiletypeFamilyNameLabel,
356 XmNtopAttachment, XmATTACH_WIDGET,
358 XmNleftAttachment, XmATTACH_FORM,
360 XmNrightAttachment, XmATTACH_FORM,
363 ActionAreaForm = XtVaCreateManagedWidget( "ActionAreaForm",
366 XmNnavigationType, XmTAB_GROUP,
368 XmNfractionBase, ((TIGHTNESS * ntotalbuttons) - 1),
370 XmNleftAttachment, XmATTACH_FORM,
372 XmNrightAttachment, XmATTACH_FORM,
374 XmNbottomAttachment, XmATTACH_FORM,
377 /* Creation of AF_OkButton */
378 AF_OkButton = XtVaCreateManagedWidget( "AF_OkButton",
379 xmPushButtonGadgetClass,
381 RES_CONVERT( XmNlabelString, GETMESSAGE(6, 10, "OK")),
382 XmNmultiClick, XmMULTICLICK_DISCARD,
383 XmNleftAttachment, nbutton ?
384 XmATTACH_POSITION : XmATTACH_FORM,
385 XmNleftPosition, TIGHTNESS * nbutton,
386 XmNrightAttachment, nbutton != (ntotalbuttons - 1) ?
387 XmATTACH_POSITION : XmATTACH_FORM,
388 XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1),
391 XtAddCallback( AF_OkButton, XmNactivateCallback,
392 (XtCallbackProc) activateCB_AF_OkButton,
395 /* Creation of AF_ApplyButton */
396 AF_ApplyButton = XtVaCreateManagedWidget( "AF_ApplyButton",
397 xmPushButtonGadgetClass,
399 RES_CONVERT( XmNlabelString, GETMESSAGE(6, 11, "Apply")),
400 XmNleftAttachment, nbutton ?
401 XmATTACH_POSITION : XmATTACH_FORM,
402 XmNleftPosition, TIGHTNESS * nbutton,
403 XmNrightAttachment, nbutton != (ntotalbuttons - 1) ?
404 XmATTACH_POSITION : XmATTACH_FORM,
405 XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1),
408 XtAddCallback( AF_ApplyButton, XmNactivateCallback,
409 (XtCallbackProc) activateCB_AF_ApplyButton,
412 /* Creation of AF_CancelButton */
413 AF_CancelButton = XtVaCreateManagedWidget( "AF_CancelButton",
414 xmPushButtonGadgetClass,
416 RES_CONVERT( XmNlabelString, GETMESSAGE(6, 12, "Cancel")),
417 XmNleftAttachment, nbutton ?
418 XmATTACH_POSITION : XmATTACH_FORM,
419 XmNleftPosition, TIGHTNESS * nbutton,
420 XmNrightAttachment, nbutton != (ntotalbuttons - 1) ?
421 XmATTACH_POSITION : XmATTACH_FORM,
422 XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1),
425 XtAddCallback( AF_CancelButton, XmNactivateCallback,
426 (XtCallbackProc) activateCB_AF_CancelButton,
429 /* Creation of AF_HelpButton */
430 AF_HelpButton = XtVaCreateManagedWidget( "AF_HelpButton",
431 xmPushButtonGadgetClass,
433 RES_CONVERT( XmNlabelString, GETMESSAGE(6, 13, "Help")),
434 XmNuserData, AddFiletype,
435 XmNleftAttachment, nbutton ?
436 XmATTACH_POSITION : XmATTACH_FORM,
437 XmNleftPosition, TIGHTNESS * nbutton,
438 XmNrightAttachment, nbutton != (ntotalbuttons - 1) ?
439 XmATTACH_POSITION : XmATTACH_FORM,
440 XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1),
443 XtAddCallback( AF_HelpButton, XmNactivateCallback,
444 (XtCallbackProc) helpCB_general,
445 (XtPointer) HELP_ADDFILETYPE );
447 /* Creation of AF_IdCharacteristicsLabel */
448 AF_IdCharacteristicsLabel = XtVaCreateManagedWidget( "AF_IdCharacteristicsLabel",
451 RES_CONVERT( XmNlabelString, GETMESSAGE(7, 15, "Identifying Characteristics:")),
452 XmNalignment, XmALIGNMENT_BEGINNING,
454 XmNtopWidget, AF_FileTypeNameTextField,
455 XmNtopAttachment, XmATTACH_WIDGET,
457 XmNleftAttachment, XmATTACH_FORM,
459 XmNrightAttachment, XmATTACH_FORM,
462 /* Creation of AF_IdCharacteristicsText */
463 AF_IdCharacteristicsText = XtVaCreateManagedWidget( "AF_IdCharacteristicsText",
467 XmNeditMode, XmMULTI_LINE_EDIT ,
471 XmNleftAttachment, XmATTACH_FORM,
473 XmNtopWidget, AF_IdCharacteristicsLabel,
474 XmNtopAttachment, XmATTACH_WIDGET,
477 printf("AF_IdCharacteristicsText = %p\n", AF_IdCharacteristicsText);
480 /* Creation of AF_IdCharacteristicsEdit */
481 AF_IdCharacteristicsEdit = XtVaCreateManagedWidget( "AF_IdCharacteristicsEdit",
482 xmPushButtonGadgetClass,
484 RES_CONVERT( XmNlabelString, GETMESSAGE(7, 16, "Edit...")),
485 XmNalignment, XmALIGNMENT_BEGINNING,
486 XmNmultiClick, XmMULTICLICK_DISCARD,
487 XmNnavigationType, XmTAB_GROUP,
488 XmNtraversalOn, TRUE,
490 XmNrightAttachment, XmATTACH_FORM,
491 XmNbottomWidget, AF_IdCharacteristicsText,
492 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
494 XtAddCallback( AF_IdCharacteristicsEdit, XmNactivateCallback,
495 (XtCallbackProc) activateCB_edit_id_characteristics,
497 XtRealizeWidget(AF_IdCharacteristicsEdit);
498 XtVaGetValues(AF_IdCharacteristicsEdit, XmNwidth, &dim1, NULL);
500 XtVaSetValues(AF_IdCharacteristicsText,
501 XmNrightOffset, dim1 + 25,
502 XmNrightAttachment, XmATTACH_FORM,
505 /* Creation of AF_FiletypeIconHelpLabel */
506 AF_FiletypeIconHelpLabel = XtVaCreateManagedWidget( "AF_FiletypeIconHelpLabel",
509 RES_CONVERT( XmNlabelString, GETMESSAGE(7, 17, "Help Text for this Datatype Icon:")),
510 XmNalignment, XmALIGNMENT_BEGINNING,
512 XmNleftAttachment, XmATTACH_FORM,
514 XmNrightAttachment, XmATTACH_FORM,
516 XmNtopWidget, AF_IdCharacteristicsText,
517 XmNtopAttachment, XmATTACH_WIDGET,
521 XtVaSetValues(AF_IdCharacteristicsText,
522 XmNrightWidget, AF_IdCharacteristicsEdit,
523 XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET,
527 /* Creation of AF_FiletypePrintCmdTextField */
528 AF_FiletypePrintCmdTextField = XtVaCreateManagedWidget( "AF_FiletypePrintCmdTextField",
529 xmTextFieldWidgetClass,
532 XmNbottomWidget, AF_OkButton,
533 XmNbottomAttachment, XmATTACH_WIDGET,
535 XmNleftAttachment, XmATTACH_FORM,
537 XmNrightAttachment, XmATTACH_FORM,
540 /* Creation of AF_FiletypePrintCmdLabel */
541 AF_FiletypePrintCmdLabel = XtVaCreateManagedWidget( "AF_FiletypePrintCmdLabel",
544 RES_CONVERT( XmNlabelString, GETMESSAGE(7, 23, "Command to Print this Datatype:")),
545 XmNalignment, XmALIGNMENT_BEGINNING,
547 XmNbottomWidget, AF_FiletypePrintCmdTextField,
548 XmNbottomAttachment, XmATTACH_WIDGET,
550 XmNleftAttachment, XmATTACH_FORM,
552 XmNrightAttachment, XmATTACH_FORM,
555 /* Creation of AF_OpenCmdText */
556 AF_OpenCmdText = XtVaCreateManagedWidget( "AF_OpenCmdText",
561 XmNbottomWidget, AF_FiletypePrintCmdLabel,
562 XmNbottomAttachment, XmATTACH_WIDGET,
564 XmNleftAttachment, XmATTACH_FORM,
566 XmNrightAttachment, XmATTACH_FORM,
568 XmNeditMode, XmMULTI_LINE_EDIT ,
571 /* Creation of AF_OpenFiletypeCmdLabel */
572 AF_OpenFiletypeCmdLabel = XtVaCreateManagedWidget( "AF_OpenFiletypeCmdLabel",
575 RES_CONVERT( XmNlabelString, GETMESSAGE(7, 22, "Command to Open this Datatype:")),
576 XmNalignment, XmALIGNMENT_BEGINNING,
578 XmNbottomWidget, AF_OpenCmdText,
579 XmNbottomAttachment, XmATTACH_WIDGET,
581 XmNleftAttachment, XmATTACH_FORM,
583 XmNrightAttachment, XmATTACH_FORM,
586 /* Creation of AF_CommandsLabel */
587 AF_CommandsLabel = XtVaCreateManagedWidget( "AF_CommandsLabel",
590 XmNalignment, XmALIGNMENT_BEGINNING,
591 RES_CONVERT( XmNlabelString, GETMESSAGE(7, 21, "Commands")),
593 XmNleftAttachment, XmATTACH_FORM,
595 XmNbottomWidget, AF_OpenFiletypeCmdLabel,
596 XmNbottomAttachment, XmATTACH_WIDGET,
599 /* Creation of AF_FiletypeIconForm */
600 AF_FiletypeIconForm = XtVaCreateManagedWidget( "AF_FiletypeIconForm",
603 XmNresizePolicy, XmRESIZE_NONE,
606 XmNbottomWidget, AF_CommandsLabel,
607 XmNbottomAttachment, XmATTACH_WIDGET,
609 XmNleftAttachment, XmATTACH_FORM,
611 XmNrightAttachment, XmATTACH_FORM,
612 XmNshadowType, XmSHADOW_ETCHED_IN,
613 XmNshadowThickness, 3,
617 AF_MED_IconForm = XtVaCreateManagedWidget( "AF_MED_IconForm",
620 XmNresizePolicy, XmRESIZE_NONE,
621 XmNborderWidth, ICON_BORDER_WIDTH,
624 XmNleftAttachment, XmATTACH_POSITION,
625 XmNbottomPosition, 88,
627 XmNbottomAttachment, XmATTACH_POSITION,
630 /* Creation of AF_MED_IconGadget */
631 emptyString = XmStringCreateLocalized("");
633 pIconData = (IconData *)XtMalloc(sizeof(IconData));
634 memset(pIconData, 0, sizeof(IconData));
635 IconDataList[AF_MED] = pIconData;
636 AF_MED_IconGadget = XtVaCreateManagedWidget( "AF_MED_IconGadget",
639 XmNalignment, XmALIGNMENT_CENTER,
640 XmNuserData, pIconData,
641 XmNrecomputeSize, TRUE,
642 XmNstring, emptyString,
643 XmNleftOffset, BORDER_OFFSET,
644 XmNleftAttachment, XmATTACH_FORM,
645 XmNrightOffset, BORDER_OFFSET,
646 XmNrightAttachment, XmATTACH_FORM,
647 XmNtopOffset, BORDER_OFFSET,
648 XmNtopAttachment, XmATTACH_FORM,
649 XmNbottomOffset, BORDER_OFFSET,
650 XmNbottomAttachment, XmATTACH_FORM,
652 pIconData->wid = AF_MED_IconGadget;
653 pIconData->size = Medium_Icon;
654 XtAddCallback( AF_MED_IconGadget, XmNcallback,
655 (XtCallbackProc) activateCB_filetype_icon,
657 createCB_IconGadget(AF_MED_IconGadget, FALSE, Medium_Icon);
658 last_filetype_pushed = AF_MED_IconGadget;
660 AF_TINY_IconForm = XtVaCreateManagedWidget( "AF_TINY_IconForm",
663 XmNresizePolicy, XmRESIZE_NONE,
666 XmNleftAttachment, XmATTACH_POSITION,
667 XmNbottomPosition, 86,
669 XmNbottomAttachment, XmATTACH_POSITION,
672 /* Creation of AF_TINY_IconGadget */
673 pIconData = (IconData *)XtMalloc(sizeof(IconData));
674 memset(pIconData, 0, sizeof(IconData));
675 IconDataList[AF_TINY] = pIconData;
676 AF_TINY_IconGadget = XtVaCreateManagedWidget( "AF_TINY_IconGadget",
679 XmNalignment, XmALIGNMENT_CENTER,
680 XmNuserData, pIconData,
681 XmNrecomputeSize, TRUE,
682 XmNstring, emptyString,
683 XmNleftOffset, BORDER_OFFSET,
684 XmNleftAttachment, XmATTACH_FORM,
685 XmNrightOffset, BORDER_OFFSET,
686 XmNrightAttachment, XmATTACH_FORM,
687 XmNtopOffset, BORDER_OFFSET,
688 XmNtopAttachment, XmATTACH_FORM,
689 XmNbottomOffset, BORDER_OFFSET,
690 XmNbottomAttachment, XmATTACH_FORM,
692 pIconData->wid = AF_TINY_IconGadget;
693 pIconData->size = Tiny_Icon;
694 XtAddCallback( AF_TINY_IconGadget, XmNcallback,
695 (XtCallbackProc) activateCB_filetype_icon,
697 createCB_IconGadget(AF_TINY_IconGadget, FALSE, Tiny_Icon);
699 XmStringFree(emptyString);
701 /* Creation of AF_FiletypeIconsEditButton */
702 AF_FiletypeIconsEditButton = XtVaCreateManagedWidget( "AF_FiletypeIconsEditButton",
703 xmPushButtonGadgetClass,
705 RES_CONVERT( XmNlabelString, GETMESSAGE(6, 20, "Edit Icon...")),
706 XmNalignment, XmALIGNMENT_BEGINNING,
707 XmNmultiClick, XmMULTICLICK_DISCARD,
708 /*XmNnavigationType, XmTAB_GROUP,*/
711 XmNleftAttachment, XmATTACH_POSITION,
713 XtAddCallback( AF_FiletypeIconsEditButton, XmNactivateCallback,
714 (XtCallbackProc) activateCB_edit_icon,
715 (XtPointer) CA_FILETYPE_ICONS );
717 /* Creation of AF_FiletypeIconFindSetButton */
718 AF_FiletypeIconFindSetButton = XtVaCreateManagedWidget( "AF_FiletypeIconFindSetButton",
719 xmPushButtonGadgetClass,
723 RES_CONVERT( XmNlabelString, GETMESSAGE(6, 19, "Find Set...")),
724 XmNalignment, XmALIGNMENT_BEGINNING,
725 /*XmNnavigationType, XmTAB_GROUP,*/
726 XmNmultiClick, XmMULTICLICK_DISCARD,
729 XmNleftAttachment, XmATTACH_POSITION,
731 XtAddCallback( AF_FiletypeIconFindSetButton, XmNactivateCallback,
732 (XtCallbackProc) activateCB_open_FindSet,
733 (XtPointer) CA_FILETYPE_ICONS );
735 /******************************************************************/
736 /* Determine which button is wider, attach the short one onto it */
737 /******************************************************************/
738 XtVaGetValues(AF_FiletypeIconsEditButton, XmNwidth, &dim1, NULL);
739 XtVaGetValues(AF_FiletypeIconFindSetButton, XmNwidth, &dim2, NULL);
741 XtVaSetValues(AF_FiletypeIconFindSetButton,
745 XtVaSetValues(AF_FiletypeIconsEditButton,
749 /******************************************************************/
750 /* Determine vertical positioning for findset and edit buttons */
751 /******************************************************************/
752 /*XtRealizeWidget(AF_FiletypeIconForm);*/
753 XtVaGetValues(AF_FiletypeIconForm, XmNheight, &dim3, NULL);
754 XtVaGetValues(AF_FiletypeIconsEditButton, XmNheight, &dim1, NULL);
755 XtVaGetValues(AF_FiletypeIconFindSetButton, XmNheight, &dim2, NULL);
757 printf("find set size = %d\n", dim2);
758 printf("edit size = %d\n", dim1);
759 printf("icon area form size = %d\n", dim3);
761 if ((int)(dim1 + dim2) + 3*(FINDEDIT_SPACING) > (int)dim3) {
762 XtVaSetValues(AF_FiletypeIconsEditButton,
763 XmNbottomOffset, FINDEDIT_SPACING,
764 XmNbottomAttachment, XmATTACH_FORM,
766 XtVaSetValues(AF_FiletypeIconFindSetButton,
767 XmNbottomOffset, FINDEDIT_SPACING,
768 XmNbottomWidget, AF_FiletypeIconsEditButton,
769 XmNbottomAttachment, XmATTACH_WIDGET,
770 XmNtopOffset, FINDEDIT_SPACING,
771 XmNtopAttachment, XmATTACH_FORM,
774 XtVaSetValues(AF_FiletypeIconsEditButton,
776 XmNtopOffset, (int)(FINDEDIT_SPACING / 2),
777 XmNtopAttachment, XmATTACH_POSITION,
779 XtVaSetValues(AF_FiletypeIconFindSetButton,
780 XmNbottomPosition, 50,
781 XmNbottomOffset, (int)(FINDEDIT_SPACING / 2),
782 XmNbottomAttachment, XmATTACH_POSITION,
786 /******************************************************************/
787 /* Creation of AF_FiletypeIconsBoxLabel */
788 /******************************************************************/
789 AF_FiletypeIconsBoxLabel = XtVaCreateManagedWidget( "AF_FiletypeIconsBoxLabel",
792 RES_CONVERT( XmNlabelString, GETMESSAGE(7, 18, "Datatype Icons:")),
793 XmNalignment, XmALIGNMENT_BEGINNING,
795 XmNbottomWidget, AF_FiletypeIconForm,
796 XmNbottomAttachment, XmATTACH_WIDGET,
798 XmNleftAttachment, XmATTACH_FORM,
800 XmNrightAttachment, XmATTACH_FORM,
803 /* Creation of AF_FiletypeHelpScrolledWindow */
804 AF_FiletypeHelpScrolledWindow = XtVaCreateManagedWidget( "AF_FiletypeHelpScrolledWindow",
805 xmScrolledWindowWidgetClass,
807 XmNscrollingPolicy, XmAPPLICATION_DEFINED,
810 XmNvisualPolicy, XmVARIABLE,
811 XmNscrollBarDisplayPolicy, XmSTATIC,
812 XmNshadowThickness, 0,
814 XmNtopWidget, AF_FiletypeIconHelpLabel,
815 XmNtopAttachment, XmATTACH_WIDGET,
817 XmNbottomWidget, AF_FiletypeIconsBoxLabel,
818 XmNbottomAttachment, XmATTACH_WIDGET,
820 XmNleftAttachment, XmATTACH_FORM,
822 XmNrightAttachment, XmATTACH_FORM,
826 /* Creation of AF_FiletypeHelpText */
827 AF_FiletypeHelpText = XtVaCreateManagedWidget( "AF_FiletypeHelpText",
829 AF_FiletypeHelpScrolledWindow,
830 XmNscrollHorizontal, FALSE,
831 XmNscrollVertical, TRUE,
832 XmNeditMode, XmMULTI_LINE_EDIT ,
839 /* Creation of AF_separator2 */
840 AF_separator2 = XtVaCreateManagedWidget( "AF_separator2",
841 xmSeparatorWidgetClass,
844 XmNleftWidget, AF_CommandsLabel,
845 XmNleftAttachment, XmATTACH_WIDGET,
847 XmNrightAttachment, XmATTACH_FORM,
849 XmNbottomWidget, AF_CommandsLabel,
850 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
854 /* Creation of AF_separator1 */
855 AF_separator1 = XtVaCreateManagedWidget( "AF_separator1",
856 xmSeparatorWidgetClass,
859 XmNbottomWidget, AF_separator2,
860 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
862 XmNleftAttachment, XmATTACH_FORM,
864 XmNrightWidget, AF_CommandsLabel,
865 XmNrightAttachment, XmATTACH_WIDGET,
869 XtVaSetValues(AddFiletype,
870 XmNcancelButton, AF_CancelButton,
871 XmNdefaultButton, AF_OkButton,
872 XmNinitialFocus, AF_FileTypeNameTextField,
875 XtAddCallback( AddFiletype, XmNdestroyCallback,
876 (XtCallbackProc) UxDestroyContextCB,
877 (XtPointer) UxAddFiletypeContext);
880 return ( AF_BigForm );
882 return ( AddFiletype );
886 /*******************************************************************************
887 The following is the 'Interface function' which is the
888 external entry point for creating this interface.
889 This function should be called from your application or from
891 *******************************************************************************/
893 Widget create_AddFiletype(swidget _UxUxParent)
896 _UxCAddFiletype *UxContext;
900 Widget widScrolledWindow;
903 UxAddFiletypeContext = UxContext =
904 (_UxCAddFiletype *) UxNewContext( sizeof(_UxCAddFiletype), False );
906 UxParent = _UxUxParent;
908 rtrn = _Uxbuild_AddFiletype();
910 XtRealizeWidget(rtrn);
911 XtVaGetValues (AddFiletype,
912 XmNheight, &dimHeight,
916 XmNuserData, &widScrolledWindow,
918 XtVaGetValues (widScrolledWindow,
919 XmNverticalScrollBar, &widTmp,
921 XtVaGetValues (widTmp,
928 XmNheight, dimHeight,
935 /*******************************************************************************
937 *******************************************************************************/