1 /* $TOG: FileCharacteristics.c /main/7 1999/09/17 15:43:31 mgreess $ */
3 /*******************************************************************************
6 Associated Header file: FileCharacteristics.h
7 *******************************************************************************/
14 #include <Xm/MwmUtil.h>
15 #include <Xm/DialogS.h>
16 #include <Xm/MenuShell.h>
17 #include <Xm/RowColumn.h>
19 #include <Xm/ToggleBG.h>
22 #include <Xm/PushBG.h>
24 #include <Xm/ScrolledW.h>
30 #define CONTEXT_MACRO_ACCESS 1
31 #include "FileCharacteristics.h"
32 #undef CONTEXT_MACRO_ACCESS
34 /*******************************************************************************
35 Includes, Defines, and Global variables from the Declarations Editor:
36 *******************************************************************************/
41 Widget FC_ReadOnToggle, FC_ReadOffToggle, FC_ReadEitherToggle;
42 Widget FC_WriteOnToggle, FC_WriteOffToggle, FC_WriteEitherToggle;
43 Widget FC_ExecuteOnToggle, FC_ExecuteOffToggle, FC_ExecuteEitherToggle;
44 Widget FC_PermissionForm;
47 Widget FC_ExecuteLabel;
49 /******************************************************************************/
51 /* GetPermissionsPattern */
54 /* OUTPUT: permissions pattern in database format */
56 /******************************************************************************/
57 void GetPermissionsPattern(char **ppszPermPattern)
60 if (*ppszPermPattern) {
61 XtFree(*ppszPermPattern);
62 *ppszPermPattern = (char *)NULL;
65 *ppszPermPattern = (char *)XtMalloc(20);
66 memset(*ppszPermPattern, 0, 20);
68 if (XmToggleButtonGadgetGetState(FC_DirectoryToggle)) {
69 strcat(*ppszPermPattern, "d");
71 strcat(*ppszPermPattern, "!d");
74 if (XmToggleButtonGadgetGetState(FC_PermissionToggle)) {
75 /******************************************************************/
77 /******************************************************************/
78 if (XmToggleButtonGadgetGetState(FC_ReadOnToggle)) {
79 strcat(*ppszPermPattern, "&r");
81 if (XmToggleButtonGadgetGetState(FC_ReadOffToggle)) {
82 strcat(*ppszPermPattern, "&!r");
85 /******************************************************************/
87 /******************************************************************/
88 if (XmToggleButtonGadgetGetState(FC_WriteOnToggle)) {
89 strcat(*ppszPermPattern, "&w");
91 if (XmToggleButtonGadgetGetState(FC_WriteOffToggle)) {
92 strcat(*ppszPermPattern, "&!w");
95 /******************************************************************/
96 /* Get Execute state */
97 /******************************************************************/
98 if (XmToggleButtonGadgetGetState(FC_ExecuteOnToggle)) {
99 strcat(*ppszPermPattern, "&x");
101 if (XmToggleButtonGadgetGetState(FC_ExecuteOffToggle)) {
102 strcat(*ppszPermPattern, "&!x");
108 if (XmToggleButtonGadgetGetState(FC_PermissionToggle)) {
109 if (XmToggleButtonGadgetGetState(FC_ReadToggle)) {
110 strcat(*ppszPermPattern, "&r");
112 strcat(*ppszPermPattern, "&!r");
114 if (XmToggleButtonGadgetGetState(FC_WriteToggle)) {
115 strcat(*ppszPermPattern, "&w");
117 strcat(*ppszPermPattern, "&!w");
119 if (XmToggleButtonGadgetGetState(FC_ExecuteToggle)) {
120 strcat(*ppszPermPattern, "&x");
122 strcat(*ppszPermPattern, "&!x");
128 /******************************************************************************/
130 /* GetContentsType */
133 /* OUTPUT: contents type selected */
135 /******************************************************************************/
136 ushort GetContentsType(void)
139 if (XmToggleButtonGadgetGetState(FC_StringToggle)) {
140 return((ushort)CA_FT_CNTSTRING);
141 } else if (XmToggleButtonGadgetGetState(FC_ByteToggle)) {
142 return((ushort)CA_FT_CNTBYTE);
143 } else if (XmToggleButtonGadgetGetState(FC_ShortToggle)) {
144 return((ushort)CA_FT_CNTSHORT);
145 } else if (XmToggleButtonGadgetGetState(FC_LongToggle)) {
146 return((ushort)CA_FT_CNTLONG);
150 /******************************************************************************/
152 /* Save_FileChar_Info */
157 /******************************************************************************/
158 void Save_FileChar_Info(void)
162 char *ptr = (char *)NULL;
165 /**************************************************************************/
166 /* Clear file characteristics text widget on the AddFiletype dialog. */
167 /**************************************************************************/
168 XmTextSetString(AF_IdCharacteristicsText, "");
170 /**************************************************************************/
171 /* Get pointer to FiletypeData structure. */
172 /* Also, update the filetypes listbox on the AddFiletype window. */
173 /**************************************************************************/
174 XtVaGetValues(FileCharacteristics,
178 /**************************************************************************/
179 /* Get Name Pattern Info */
180 /**************************************************************************/
181 if (XmToggleButtonGadgetGetState(FC_NameOrPathToggle)) {
182 GetWidgetTextString(FC_NameOrPathText, &(pFtD->pszPattern));
184 printf("Pattern is '%s'\n", pFtD->pszPattern);
187 if (pFtD->pszPattern) {
188 XtFree(pFtD->pszPattern);
189 pFtD->pszPattern = (char *)NULL;
193 /**************************************************************************/
194 /* Get Permission Info */
195 /**************************************************************************/
196 GetPermissionsPattern(&(pFtD->pszPermissions));
198 /**************************************************************************/
199 /* Get Content Pattern Info */
200 /**************************************************************************/
201 if (XmToggleButtonGadgetGetState(FC_ContentsToggle)) {
203 /************************************************************************/
204 /* Save data in structure. */
205 /************************************************************************/
206 GetWidgetTextString(FC_ContentsPatternText, &(pFtD->pszContents));
208 GetWidgetTextString(FC_StartByteTextField, &ptr);
210 pFtD->sStart = atoi(ptr);
215 GetWidgetTextString(FC_EndByteTextField, &ptr);
217 pFtD->sEnd = atoi(ptr);
221 pFtD->fsFlags = GetContentsType();
224 if (pFtD->pszContents) {
225 XtFree(pFtD->pszContents);
226 pFtD->pszContents = (char *)NULL;
231 /**************************************************************************/
232 /* Parse the ID fields in the FiletypeData structure and create a text */
233 /* string for the Identifying Characteristics text field in AddFiletype. */
234 /**************************************************************************/
235 ParseAndUpdateID(pFtD);
239 /******************************************************************************/
241 /* ParseAndUpdateID */
246 /******************************************************************************/
247 void ParseAndUpdateID(FiletypeData *pFtD)
250 char *ptr = (char *)NULL;
253 /**************************************************************************/
254 /* Init size variable. This will be used to indicate size of buffer to */
255 /* allocate to hold text string that will be displayed in FC text widget. */
256 /**************************************************************************/
259 /**************************************************************************/
260 /* Get Name Pattern Info */
261 /**************************************************************************/
262 if (pFtD->pszPattern) {
263 /*size += strlen("Name: ");*/
264 size += strlen(GETMESSAGE(9, 20, "Name Pattern:")) + 1; /* 1 for space */
265 size += strlen(pFtD->pszPattern);
266 size += 1; /* For newline character */
269 /**************************************************************************/
270 /* Get Permission Info */
271 /**************************************************************************/
272 if (pFtD->pszPermissions) {
273 size += strlen(GETMESSAGE(9, 21, "Permission Pattern:")) + 1; /* space */
274 size += strlen(pFtD->pszPermissions);
275 size += 1; /* For newline character */
278 /**************************************************************************/
279 /* Get Content Pattern Info */
280 /**************************************************************************/
281 if (pFtD->pszContents) {
282 size += strlen(GETMESSAGE(9, 28, "Contents:")) + 1; /* 1 for space */
283 size += strlen(pFtD->pszContents);
284 size += 1; /* For newline character */
287 /**************************************************************************/
288 /* Allocate buffer and fill with ID info. */
289 /**************************************************************************/
291 ptr = XtMalloc(size);
293 memset(ptr, 0, size);
294 if (pFtD->pszPattern) {
295 strcat(ptr, GETMESSAGE(9, 20, "Name Pattern:"));
297 strcat(ptr, pFtD->pszPattern);
300 if (pFtD->pszPermissions) {
301 strcat(ptr, GETMESSAGE(9, 21, "Permission Pattern:"));
303 strcat(ptr, pFtD->pszPermissions);
306 if (pFtD->pszContents) {
307 strcat(ptr, GETMESSAGE(9, 28, "Contents:"));
309 strcat(ptr, pFtD->pszContents);
312 XmTextSetString(AF_IdCharacteristicsText, ptr);
318 /*****************************************************************************/
323 /*****************************************************************************/
324 void CalculateAND(void)
326 Boolean set1, set2, set3, set4;
329 XtVaGetValues(FC_NameOrPathToggle, XmNset, &set1, NULL);
330 XtVaGetValues(FC_PermissionToggle, XmNset, &set2, NULL);
331 XtVaGetValues(FC_ContentsToggle, XmNset, &set3, NULL);
332 XtSetSensitive(FC_AndLabel1, False);
333 XtSetSensitive(FC_AndLabel2, False);
335 cnt = (int)set1 + (int)set2 + (int)set3;
336 if (set1 && (set2 || set3))
337 XtSetSensitive(FC_AndLabel1, True);
339 XtSetSensitive(FC_AndLabel2, True);
342 /*******************************************************************************
343 The following are callback functions.
344 *******************************************************************************/
346 static void activateCB_FC_OkButton( Widget UxWidget,
347 XtPointer UxClientData,
348 XtPointer UxCallbackArg)
351 if (!FileCharCheckFields()) {
352 Save_FileChar_Info();
353 UxPopdownInterface(FileCharacteristics);
357 static void activateCB_FC_ClearButton(Widget UxWidget,
358 XtPointer UxClientData,
359 XtPointer UxCallbackArg)
362 /* Clear_FileChar_Info(); */
363 clear_FileCharacteristics_dialog_fields();
366 static void activateCB_FC_CancelButton(Widget UxWidget,
367 XtPointer UxClientData,
368 XtPointer UxCallbackArg)
371 _UxCFileCharacteristics *UxSaveCtx, *UxContext;
373 UxSaveCtx = UxFileCharacteristicsContext;
374 UxFileCharacteristicsContext = UxContext =
375 (_UxCFileCharacteristics *) UxGetContext( UxWidget );
378 UxPopdownInterface(FileCharacteristics);
381 UxFileCharacteristicsContext = UxSaveCtx;
385 static void valueChangedCB_FC_PermissionToggle(Widget UxWidget,
386 XtPointer UxClientData,
387 XtPointer UxCallbackArg)
391 XtVaGetValues(UxWidget, XmNset, &set, NULL);
392 XtSetSensitive(FC_PermissionLabel, set);
393 XtSetSensitive(FC_PermissionForm, set);
395 XtSetSensitive(FC_ReadLabel, set);
396 XtSetSensitive(FC_WriteLabel, set);
397 XtSetSensitive(FC_ExecuteLabel, set);
399 XtSetSensitive(FC_ReadOnToggle, set);
400 XtSetSensitive(FC_WriteOnToggle, set);
401 XtSetSensitive(FC_ExecuteOnToggle, set);
403 XtSetSensitive(FC_ReadOffToggle, set);
404 XtSetSensitive(FC_WriteOffToggle, set);
405 XtSetSensitive(FC_ExecuteOffToggle, set);
407 XtSetSensitive(FC_ReadEitherToggle, set);
408 XtSetSensitive(FC_WriteEitherToggle, set);
409 XtSetSensitive(FC_ExecuteEitherToggle, set);
415 static void armCB_FC_StringToggle(Widget UxWidget,
416 XtPointer UxClientData,
417 XtPointe`r UxCallbackArg)
422 static void armCB_FC_ByteToggle(Widget UxWidget,
423 XtPointer UxClientData,
424 XtPointer UxCallbackArg)
429 static void armCB_FC_ShortToggle(Widget UxWidget,
430 XtPointer UxClientData,
431 XtPointer UxCallbackArg)
436 static void armCB_FC_LongToggle( Widget UxWidget,
437 XtPointer UxClientData,
438 XtPointer UxCallbackArg)
444 static void valueChangedCB_FC_ContentsToggle( Widget UxWidget,
445 XtPointer UxClientData,
446 XtPointer UxCallbackArg)
450 XtVaGetValues(UxWidget, XmNset, &set, NULL);
451 XtSetSensitive(FC_ContentsLabel, set);
452 XtSetSensitive(FC_ContentsBox, set);
454 XmProcessTraversal(FC_ContentsPatternText, XmTRAVERSE_CURRENT);
459 static void valueChangedCB_FC_NameOrPathToggle(Widget UxWidget,
460 XtPointer UxClientData,
461 XtPointer UxCallbackArg)
466 XtVaGetValues(UxWidget, XmNset, &set, NULL);
467 XtSetSensitive(FC_NamePatternLabel, set);
468 XtSetSensitive(FC_NameOrPathText, set);
470 XmProcessTraversal(FC_NameOrPathText, XmTRAVERSE_CURRENT);
475 /*******************************************************************************
476 The 'build_' function creates all the widgets
477 using the resource values specified in the Property Editor.
478 *******************************************************************************/
480 static Widget _Uxbuild_FileCharacteristics(void)
483 Widget FC_ActionAreaForm;
485 Widget FC_ClearButton;
486 Widget FC_CancelButton;
487 Widget FC_HelpButton;
488 Widget FC_MainLabel1;
489 Widget FC_MainLabel2;
490 Widget FC_TypeFileRowColumn;
492 Widget FC_ReadRowColumn;
493 Widget FC_WriteRowColumn;
494 Widget FC_ExecuteRowColumn;
495 int ntotalbuttons = 4;
498 Widget FC_ScrolledWindow;
500 char *dialog_title, *pre, *suf;
503 /* Creation of FileCharacteristics */
505 _UxParent = UxParent;
506 if ( _UxParent == NULL )
508 _UxParent = UxTopLevel;
512 _UxParent = UxTopLevel;
514 pre = GETMESSAGE(3, 10, "Create Action");
515 suf = GETMESSAGE(9, 10, "Identifying Characteristics");
516 dialog_title = XtMalloc(strlen(pre) + strlen(suf) + 2);
517 sprintf(dialog_title, "%s - %s", pre, suf);
520 _UxParent = XtVaCreatePopupShell( "FileCharacteristics_shell",
521 xmDialogShellWidgetClass, _UxParent,
526 XmNshellUnitType, XmPIXELS,
527 XmNtitle, dialog_title,
529 FC_BigForm = XtVaCreateWidget( "FC_BigForm",
532 XmNunitType, XmPIXELS,
533 XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL,
534 RES_CONVERT( XmNdialogTitle, dialog_title ),
535 XmNautoUnmanage, FALSE,
536 XmNrubberPositioning, FALSE,
538 FC_ScrolledWindow = XtVaCreateManagedWidget( "FC_ScrolledWindow",
539 xmScrolledWindowWidgetClass,
541 XmNscrollingPolicy, XmAUTOMATIC,
542 XmNleftAttachment, XmATTACH_FORM,
543 XmNrightAttachment, XmATTACH_FORM,
544 XmNbottomAttachment, XmATTACH_FORM,
545 XmNtopAttachment, XmATTACH_FORM,
547 XtVaSetValues(FC_BigForm, XmNuserData, FC_ScrolledWindow, NULL);
549 FileCharacteristics = XtVaCreateManagedWidget( "FileCharacteristics",
554 _UxParent = XtVaCreatePopupShell( "FileCharacteristics_shell",
555 xmDialogShellWidgetClass, _UxParent,
558 XmNmwmDecorations, MWM_DECOR_ALL | MWM_DECOR_RESIZEH,
561 XmNshellUnitType, XmPIXELS,
562 XmNtitle, dialog_title,
564 FileCharacteristics = XtVaCreateWidget( "FileCharacteristics",
567 XmNunitType, XmPIXELS,
568 XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL,
569 RES_CONVERT( XmNdialogTitle, dialog_title ),
570 XmNautoUnmanage, FALSE,
571 XmNrubberPositioning, FALSE,
574 XtFree(dialog_title);
575 XtAddCallback( FileCharacteristics, XmNhelpCallback,
576 (XtCallbackProc) helpCB_general,
577 (XtPointer) HELP_FILECHAR );
579 /* Creation of FC_MainLabel1 */
580 FC_MainLabel1 = XtVaCreateManagedWidget( "FC_MainLabel1",
583 XmNalignment, XmALIGNMENT_BEGINNING,
584 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 11, "Include All")),
586 XmNleftAttachment, XmATTACH_FORM,
587 XmNrightAttachment, XmATTACH_FORM,
589 XmNtopAttachment, XmATTACH_FORM,
592 /* Creation of FC_TypeFileRowColumn */
593 FC_TypeFileRowColumn = XtVaCreateManagedWidget( "FC_TypeFileRowColumn",
594 xmRowColumnWidgetClass,
596 XmNradioBehavior, TRUE,
599 XmNorientation, XmVERTICAL,
600 XmNpacking, XmPACK_COLUMN,
601 XmNshadowThickness, 1,
602 XmNleftWidget, FC_MainLabel1,
603 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
605 XmNtopWidget, FC_MainLabel1,
606 XmNtopAttachment, XmATTACH_WIDGET,
609 /* Creation of FC_FileToggle */
610 FC_FileToggle = XtVaCreateManagedWidget( "FC_FileToggle",
611 xmToggleButtonGadgetClass,
612 FC_TypeFileRowColumn,
613 XmNindicatorType, XmONE_OF_MANY,
614 XmNindicatorSize, 17,
615 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 12, "Files")),
619 /* Creation of FC_DirectoryToggle */
620 FC_DirectoryToggle = XtVaCreateManagedWidget( "FC_DirectoryToggle",
621 xmToggleButtonGadgetClass,
622 FC_TypeFileRowColumn,
623 XmNindicatorType, XmONE_OF_MANY,
624 XmNindicatorSize, 17,
625 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 13, "Folders")),
628 /* Creation of FC_MainLabel2 */
629 FC_MainLabel2 = XtVaCreateManagedWidget( "FC_MainLabel2",
632 XmNalignment, XmALIGNMENT_BEGINNING,
633 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 14, "That Match the Following:")),
635 XmNleftAttachment, XmATTACH_FORM,
636 XmNrightAttachment, XmATTACH_FORM,
638 XmNtopWidget, FC_TypeFileRowColumn,
639 XmNtopAttachment, XmATTACH_WIDGET,
642 /* Creation of FC_NamePatternLabel */
643 FC_NamePatternLabel = XtVaCreateManagedWidget( "FC_NamePatternLabel",
646 XmNalignment, XmALIGNMENT_BEGINNING,
647 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 20, "Name Pattern:")),
648 XmNleftWidget, FC_MainLabel2,
649 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
650 XmNrightAttachment, XmATTACH_NONE,
652 XmNtopWidget, FC_MainLabel2,
653 XmNtopAttachment, XmATTACH_WIDGET,
656 /* Creation of FC_NameOrPathText */
657 FC_NameOrPathText = XtVaCreateManagedWidget( "FC_NameOrPathText",
658 xmTextFieldWidgetClass,
662 XmNleftWidget, FC_NamePatternLabel,
663 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
665 XmNtopWidget, FC_NamePatternLabel,
666 XmNtopAttachment, XmATTACH_WIDGET,
669 /* Creation of FC_AndLabel1 */
670 FC_AndLabel1 = XtVaCreateManagedWidget( "FC_AndLabel1",
675 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 27, "AND")),
678 XmNrightAttachment, XmATTACH_FORM,
680 XmNtopWidget, FC_NamePatternLabel,
681 XmNtopAttachment, XmATTACH_WIDGET,
684 XtVaSetValues(FC_NameOrPathText,
686 XmNrightWidget, FC_AndLabel1,
687 XmNrightAttachment, XmATTACH_WIDGET,
691 /* Creation of FC_NameOrPathToggle */
692 FC_NameOrPathToggle = XtVaCreateManagedWidget( "FC_NameOrPathToggle",
693 xmToggleButtonGadgetClass,
695 RES_CONVERT( XmNlabelString, "" ),
697 XmNnavigationType, XmTAB_GROUP,
698 XmNindicatorSize, 20,
699 XmNleftAttachment, XmATTACH_NONE,
701 XmNrightWidget, FC_NameOrPathText,
702 XmNrightAttachment, XmATTACH_WIDGET,
703 XmNtopWidget, FC_NameOrPathText,
704 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
705 XmNbottomAttachment, XmATTACH_NONE,
707 XtAddCallback( FC_NameOrPathToggle, XmNvalueChangedCallback,
708 (XtCallbackProc) valueChangedCB_FC_NameOrPathToggle,
711 /******************************************************************/
713 /* Permission Area creation <<<<<<<>>>>>>>> */
715 /******************************************************************/
716 /* Creation of FC_PermissionLabel */
717 FC_PermissionLabel = XtVaCreateManagedWidget( "FC_PermissionLabel",
722 XmNalignment, XmALIGNMENT_BEGINNING,
723 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 21, "Permission Pattern:")),
725 XmNleftWidget, FC_NameOrPathText,
726 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
727 XmNrightAttachment, XmATTACH_NONE,
729 XmNtopWidget, FC_NameOrPathText,
730 XmNtopAttachment, XmATTACH_WIDGET,
733 FC_PermissionForm = XtVaCreateManagedWidget( "FC_PermissionForm",
736 XmNresizePolicy, XmRESIZE_NONE,
739 XmNleftWidget, FC_PermissionLabel,
740 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
742 XmNtopWidget, FC_PermissionLabel,
743 XmNtopAttachment, XmATTACH_WIDGET,
746 /******************************************************************/
747 /* Creation of FC_ReadRowColumn */
749 /* This is the read row column - on, off, either radio buttons */
750 /******************************************************************/
751 FC_ReadRowColumn = XtVaCreateManagedWidget( "FC_ReadRowColumn",
752 xmRowColumnWidgetClass,
754 XmNradioBehavior, TRUE,
756 XmNorientation, XmVERTICAL,
757 XmNpacking, XmPACK_COLUMN,
758 XmNshadowThickness, 1,
760 XmNrightAttachment, XmATTACH_FORM,
762 XmNtopAttachment, XmATTACH_FORM,
765 /* Creation of FC_ReadOnToggle */
766 FC_ReadOnToggle = XtVaCreateManagedWidget( "FC_ReadOnToggle",
767 xmToggleButtonGadgetClass,
769 XmNindicatorType, XmONE_OF_MANY,
770 XmNindicatorSize, 17,
771 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 43, "On")),
775 /* Creation of FC_ReadOffToggle */
776 FC_ReadOffToggle = XtVaCreateManagedWidget( "FC_ReadOffToggle",
777 xmToggleButtonGadgetClass,
779 XmNindicatorType, XmONE_OF_MANY,
780 XmNindicatorSize, 17,
781 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 44, "Off")),
785 /* Creation of FC_ReadEitherToggle */
786 FC_ReadEitherToggle = XtVaCreateManagedWidget( "FC_ReadEitherToggle",
787 xmToggleButtonGadgetClass,
789 XmNindicatorType, XmONE_OF_MANY,
790 XmNindicatorSize, 17,
791 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 45, "Either")),
795 /******************************************************************/
796 /* Creation of FC_WriteRowColumn */
798 /* This is the write row column - on, off, either radio buttons */
799 /******************************************************************/
800 FC_WriteRowColumn = XtVaCreateManagedWidget( "FC_WriteRowColumn",
801 xmRowColumnWidgetClass,
803 XmNradioBehavior, TRUE,
805 XmNorientation, XmVERTICAL,
806 XmNpacking, XmPACK_COLUMN,
807 XmNshadowThickness, 1,
809 XmNrightAttachment, XmATTACH_FORM,
810 XmNtopWidget, FC_ReadRowColumn,
811 XmNtopAttachment, XmATTACH_WIDGET,
814 /* Creation of FC_WriteOnToggle */
815 FC_WriteOnToggle = XtVaCreateManagedWidget( "FC_WriteOnToggle",
816 xmToggleButtonGadgetClass,
818 XmNindicatorType, XmONE_OF_MANY,
819 XmNindicatorSize, 17,
820 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 43, "On")),
824 /* Creation of FC_WriteOffToggle */
825 FC_WriteOffToggle = XtVaCreateManagedWidget( "FC_WriteOffToggle",
826 xmToggleButtonGadgetClass,
828 XmNindicatorType, XmONE_OF_MANY,
829 XmNindicatorSize, 17,
830 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 44, "Off")),
834 /* Creation of FC_WriteEitherToggle */
835 FC_WriteEitherToggle = XtVaCreateManagedWidget( "FC_WriteEitherToggle",
836 xmToggleButtonGadgetClass,
838 XmNindicatorType, XmONE_OF_MANY,
839 XmNindicatorSize, 17,
840 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 45, "Either")),
844 /******************************************************************/
845 /* Creation of FC_ExecuteRowColumn */
847 /* This is the execute row column - on, off, either radio buttons */
848 /******************************************************************/
849 FC_ExecuteRowColumn = XtVaCreateManagedWidget( "FC_ExecuteRowColumn",
850 xmRowColumnWidgetClass,
852 XmNradioBehavior, TRUE,
854 XmNorientation, XmVERTICAL,
855 XmNpacking, XmPACK_COLUMN,
856 XmNshadowThickness, 1,
858 XmNrightAttachment, XmATTACH_FORM,
859 XmNtopWidget, FC_WriteRowColumn,
860 XmNtopAttachment, XmATTACH_WIDGET,
862 XmNbottomAttachment, XmATTACH_FORM,
865 /* Creation of FC_ExecuteOnToggle */
866 FC_ExecuteOnToggle = XtVaCreateManagedWidget( "FC_ExecuteOnToggle",
867 xmToggleButtonGadgetClass,
869 XmNindicatorType, XmONE_OF_MANY,
870 XmNindicatorSize, 17,
871 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 43, "On")),
875 /* Creation of FC_ExecuteOffToggle */
876 FC_ExecuteOffToggle = XtVaCreateManagedWidget( "FC_ExecuteOffToggle",
877 xmToggleButtonGadgetClass,
879 XmNindicatorType, XmONE_OF_MANY,
880 XmNindicatorSize, 17,
881 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 44, "Off")),
885 /* Creation of FC_ExecuteEitherToggle */
886 FC_ExecuteEitherToggle = XtVaCreateManagedWidget( "FC_ExecuteEitherToggle",
887 xmToggleButtonGadgetClass,
889 XmNindicatorType, XmONE_OF_MANY,
890 XmNindicatorSize, 17,
891 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 45, "Either")),
895 /******************************************************************/
896 /* Creation of Permission Labels */
897 /******************************************************************/
898 FC_ReadLabel = XtVaCreateManagedWidget( "FC_ReadLabel",
901 XmNalignment, XmALIGNMENT_BEGINNING,
902 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 40, "Read:")),
903 XmNrightWidget, FC_ReadRowColumn,
904 XmNrightAttachment, XmATTACH_WIDGET,
906 XmNleftAttachment, XmATTACH_FORM,
907 XmNtopWidget, FC_ReadRowColumn,
908 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
910 FC_WriteLabel = XtVaCreateManagedWidget( "FC_WriteLabel",
913 XmNalignment, XmALIGNMENT_BEGINNING,
914 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 41, "Write:")),
915 XmNrightWidget, FC_WriteRowColumn,
916 XmNrightAttachment, XmATTACH_WIDGET,
918 XmNleftAttachment, XmATTACH_FORM,
919 XmNtopWidget, FC_WriteRowColumn,
920 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
922 FC_ExecuteLabel = XtVaCreateManagedWidget( "FC_ExecuteLabel",
925 XmNalignment, XmALIGNMENT_BEGINNING,
926 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 42, "Execute:")),
927 XmNrightWidget, FC_ExecuteRowColumn,
928 XmNrightAttachment, XmATTACH_WIDGET,
930 XmNleftAttachment, XmATTACH_FORM,
931 XmNtopWidget, FC_ExecuteRowColumn,
932 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
935 /******************************************************************/
936 /* Creation of the AND label for permissions. */
937 /******************************************************************/
938 FC_AndLabel2 = XtVaCreateManagedWidget( "FC_AndLabel2",
943 XmNalignment, XmALIGNMENT_BEGINNING,
944 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 27, "AND")),
947 XmNrightAttachment, XmATTACH_FORM,
949 XmNtopWidget, FC_PermissionLabel,
950 XmNtopAttachment, XmATTACH_WIDGET,
953 XtVaSetValues(FC_PermissionForm,
955 XmNrightWidget, FC_AndLabel2,
956 XmNrightAttachment, XmATTACH_WIDGET,
960 /* Creation of FC_PermissionToggle */
961 FC_PermissionToggle = XtVaCreateManagedWidget( "FC_PermissionToggle",
962 xmToggleButtonGadgetClass,
964 RES_CONVERT( XmNlabelString, "" ),
965 XmNnavigationType, XmTAB_GROUP,
966 XmNindicatorSize, 20,
967 XmNleftAttachment, XmATTACH_NONE,
969 XmNrightWidget, FC_PermissionForm,
970 XmNrightAttachment, XmATTACH_WIDGET,
971 XmNtopWidget, FC_PermissionForm,
972 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
973 XmNbottomAttachment, XmATTACH_NONE,
975 XtAddCallback( FC_PermissionToggle, XmNvalueChangedCallback,
976 (XtCallbackProc) valueChangedCB_FC_PermissionToggle,
979 /* Creation of FC_ContentsLabel */
980 FC_ContentsLabel = XtVaCreateManagedWidget( "FC_ContentsLabel",
983 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 28, "Contents:")),
985 XmNleftWidget, FC_PermissionForm,
986 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
987 XmNrightAttachment, XmATTACH_NONE,
989 XmNtopWidget, FC_PermissionForm,
990 XmNtopAttachment, XmATTACH_WIDGET,
993 /* Creation of FC_ContentsBox */
994 FC_ContentsBox = XtVaCreateManagedWidget( "FC_ContentsBox",
997 XmNresizePolicy, XmRESIZE_NONE,
1000 XmNleftWidget, FC_ContentsLabel,
1001 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1003 XmNrightAttachment, XmATTACH_FORM,
1005 XmNtopWidget, FC_ContentsLabel,
1006 XmNtopAttachment, XmATTACH_WIDGET,
1009 /* Creation of FC_ContentsToggle */
1010 FC_ContentsToggle = XtVaCreateManagedWidget( "FC_ContentsToggle",
1011 xmToggleButtonGadgetClass,
1012 FileCharacteristics,
1013 RES_CONVERT( XmNlabelString, "" ),
1014 XmNnavigationType, XmTAB_GROUP,
1015 XmNindicatorSize, 20,
1016 XmNleftAttachment, XmATTACH_NONE,
1018 XmNrightWidget, FC_ContentsBox,
1019 XmNrightAttachment, XmATTACH_WIDGET,
1020 XmNtopWidget, FC_ContentsBox,
1021 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1022 XmNbottomAttachment, XmATTACH_NONE,
1024 XtAddCallback( FC_ContentsToggle, XmNvalueChangedCallback,
1025 (XtCallbackProc) valueChangedCB_FC_ContentsToggle,
1028 /* Creation of FC_ContentsPatternLabel */
1029 FC_ContentsPatternLabel = XtVaCreateManagedWidget( "FC_ContentsPatternLabel",
1032 XmNalignment, XmALIGNMENT_BEGINNING,
1033 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 29, "Pattern:")),
1035 XmNleftAttachment, XmATTACH_FORM,
1036 XmNrightAttachment, XmATTACH_NONE,
1038 XmNtopAttachment, XmATTACH_FORM,
1041 /* Creation of FC_ContentsPatternText */
1042 FC_ContentsPatternText = XtVaCreateManagedWidget( "FC_ContentsPatternText",
1043 xmTextFieldWidgetClass,
1047 XmNleftWidget, FC_ContentsPatternLabel,
1048 XmNleftAttachment, XmATTACH_WIDGET,
1050 XmNrightAttachment, XmATTACH_FORM,
1051 XmNbottomAttachment, XmATTACH_NONE,
1052 XmNtopWidget, FC_ContentsPatternLabel,
1053 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1056 /* Creation of FC_TypeLabel */
1057 FC_TypeLabel = XtVaCreateManagedWidget( "FC_TypeLabel",
1060 XmNalignment, XmALIGNMENT_BEGINNING,
1061 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 30, "Type:")),
1062 XmNleftWidget, FC_ContentsPatternLabel,
1063 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1064 XmNbottomAttachment, XmATTACH_NONE,
1066 XmNtopWidget, FC_ContentsPatternLabel,
1067 XmNtopAttachment, XmATTACH_WIDGET,
1070 /* Creation of FC_TypeRowColumn */
1071 FC_TypeRowColumn = XtVaCreateManagedWidget( "FC_TypeRowColumn",
1072 xmRowColumnWidgetClass,
1075 XmNpacking, XmPACK_COLUMN,
1076 XmNradioBehavior, TRUE,
1078 XmNleftWidget, FC_ContentsPatternText,
1079 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1080 XmNrightWidget, FC_ContentsPatternText,
1081 XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET,
1082 XmNbottomAttachment, XmATTACH_NONE,
1083 XmNtopWidget, FC_TypeLabel,
1084 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1087 /* Creation of FC_StringToggle */
1088 FC_StringToggle = XtVaCreateManagedWidget( "FC_StringToggle",
1089 xmToggleButtonGadgetClass,
1091 XmNindicatorType, XmONE_OF_MANY,
1092 XmNindicatorSize, 17,
1093 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 31, "String")),
1097 /* Creation of FC_ByteToggle */
1098 FC_ByteToggle = XtVaCreateManagedWidget( "FC_ByteToggle",
1099 xmToggleButtonGadgetClass,
1101 XmNindicatorType, XmONE_OF_MANY,
1102 XmNindicatorSize, 17,
1103 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 32, "Byte (Hex)")),
1106 /* Creation of FC_ShortToggle */
1107 FC_ShortToggle = XtVaCreateManagedWidget( "FC_ShortToggle",
1108 xmToggleButtonGadgetClass,
1110 XmNindicatorType, XmONE_OF_MANY,
1111 XmNindicatorSize, 17,
1112 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 33, "Short (Decimal)")),
1115 /* Creation of FC_LongToggle */
1116 FC_LongToggle = XtVaCreateManagedWidget( "FC_LongToggle",
1117 xmToggleButtonGadgetClass,
1119 XmNindicatorType, XmONE_OF_MANY,
1120 XmNindicatorSize, 17,
1121 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 34, "Long (Decimal)")),
1124 /* Creation of FC_StartByteLabel */
1125 FC_StartByteLabel = XtVaCreateManagedWidget( "FC_StartByteLabel",
1128 XmNalignment, XmALIGNMENT_BEGINNING,
1129 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 35, "Start Byte:")),
1130 XmNleftWidget, FC_TypeLabel,
1131 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1132 XmNbottomOffset, 15,
1133 XmNbottomAttachment, XmATTACH_FORM,
1135 XmNtopWidget, FC_TypeRowColumn,
1136 XmNtopAttachment, XmATTACH_WIDGET,
1139 /* Creation of FC_StartByteTextField */
1140 FC_StartByteTextField = XtVaCreateManagedWidget( "FC_StartByteTextField",
1141 xmTextFieldWidgetClass,
1143 XmNcursorPosition, 5,
1146 XmNleftWidget, FC_StartByteLabel,
1147 XmNleftAttachment, XmATTACH_WIDGET,
1148 XmNtopWidget, FC_StartByteLabel,
1149 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1152 /* Creation of FC_EndByteLabel */
1153 FC_EndByteLabel = XtVaCreateManagedWidget( "FC_EndByteLabel",
1158 XmNalignment, XmALIGNMENT_BEGINNING,
1159 RES_CONVERT( XmNlabelString, "End byte:" ),
1161 XmNleftWidget, FC_StartByteTextField,
1162 XmNleftAttachment, XmATTACH_WIDGET,
1163 XmNtopWidget, FC_StartByteTextField,
1164 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1167 /* Creation of FC_EndByteTextField */
1168 FC_EndByteTextField = XtVaCreateManagedWidget( "FC_EndByteTextField",
1169 xmTextFieldWidgetClass,
1172 XmNcursorPosition, 5,
1175 XmNleftWidget, FC_EndByteLabel,
1176 XmNleftAttachment, XmATTACH_WIDGET,
1178 XmNrightAttachment, XmATTACH_FORM,
1179 XmNtopWidget, FC_EndByteLabel,
1180 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1184 FC_ActionAreaForm = XtVaCreateManagedWidget( "FC_ActionAreaForm",
1186 FileCharacteristics,
1187 XmNskipAdjust, TRUE,
1188 XmNfractionBase, ((TIGHTNESS * ntotalbuttons) - 1),
1189 XmNleftWidget, FC_ContentsBox,
1190 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1192 XmNrightAttachment, XmATTACH_FORM,
1193 XmNbottomOffset, 20,
1194 XmNbottomAttachment, XmATTACH_FORM,
1196 XmNtopWidget, FC_ContentsBox,
1197 XmNtopAttachment, XmATTACH_WIDGET,
1200 /* Creation of FC_OkButton */
1201 FC_OkButton = XtVaCreateManagedWidget( "FC_OkButton",
1202 xmPushButtonGadgetClass,
1204 RES_CONVERT( XmNlabelString, GETMESSAGE(6, 10, "OK")),
1205 XmNleftAttachment, nbutton ?
1206 XmATTACH_POSITION : XmATTACH_FORM,
1207 XmNleftPosition, TIGHTNESS * nbutton,
1208 XmNrightAttachment, nbutton != (ntotalbuttons - 1) ?
1209 XmATTACH_POSITION : XmATTACH_FORM,
1210 XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1),
1213 XtAddCallback( FC_OkButton, XmNactivateCallback,
1214 (XtCallbackProc) activateCB_FC_OkButton,
1217 /* Creation of FC_CancelButton */
1218 FC_CancelButton = XtVaCreateManagedWidget( "FC_CancelButton",
1219 xmPushButtonGadgetClass,
1221 RES_CONVERT( XmNlabelString, GETMESSAGE(6, 12, "Cancel")),
1222 XmNleftAttachment, nbutton ?
1223 XmATTACH_POSITION : XmATTACH_FORM,
1224 XmNleftPosition, TIGHTNESS * nbutton,
1225 XmNrightAttachment, nbutton != (ntotalbuttons - 1) ?
1226 XmATTACH_POSITION : XmATTACH_FORM,
1227 XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1),
1230 XtAddCallback( FC_CancelButton, XmNactivateCallback,
1231 (XtCallbackProc) activateCB_FC_CancelButton,
1234 /* Creation of FC_ClearButton */
1235 FC_ClearButton = XtVaCreateManagedWidget( "FC_ClearButton",
1236 xmPushButtonGadgetClass,
1238 RES_CONVERT( XmNlabelString, GETMESSAGE(6, 14, "Clear")),
1239 XmNleftAttachment, nbutton ?
1240 XmATTACH_POSITION : XmATTACH_FORM,
1241 XmNleftPosition, TIGHTNESS * nbutton,
1242 XmNrightAttachment, nbutton != (ntotalbuttons - 1) ?
1243 XmATTACH_POSITION : XmATTACH_FORM,
1244 XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1),
1247 XtAddCallback( FC_ClearButton, XmNactivateCallback,
1248 (XtCallbackProc) activateCB_FC_ClearButton,
1251 /* Creation of FC_HelpButton */
1252 FC_HelpButton = XtVaCreateManagedWidget( "FC_HelpButton",
1253 xmPushButtonGadgetClass,
1255 RES_CONVERT( XmNlabelString, GETMESSAGE(6, 13, "Help")),
1256 XmNuserData, FileCharacteristics,
1257 XmNleftAttachment, nbutton ?
1258 XmATTACH_POSITION : XmATTACH_FORM,
1259 XmNleftPosition, TIGHTNESS * nbutton,
1260 XmNrightAttachment, nbutton != (ntotalbuttons - 1) ?
1261 XmATTACH_POSITION : XmATTACH_FORM,
1262 XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1),
1265 XtAddCallback( FC_HelpButton, XmNactivateCallback,
1266 (XtCallbackProc) helpCB_general,
1267 (XtPointer) HELP_FILECHAR );
1269 XtVaSetValues(FileCharacteristics,
1270 XmNcancelButton, FC_CancelButton,
1271 XmNdefaultButton, FC_OkButton,
1272 XmNinitialFocus, FC_NameOrPathText,
1275 XtAddCallback( FileCharacteristics, XmNdestroyCallback,
1276 (XtCallbackProc) UxDestroyContextCB,
1280 return ( FC_BigForm );
1282 return ( FileCharacteristics );
1286 /*******************************************************************************
1287 The following is the 'Interface function' which is the
1288 external entry point for creating this interface.
1289 This function should be called from your application or from
1290 a callback function.
1291 *******************************************************************************/
1293 Widget create_FileCharacteristics( swidget _UxUxParent )
1296 Dimension dimHeight;
1299 Widget widScrolledWindow;
1302 rtrn = _Uxbuild_FileCharacteristics();
1305 XtRealizeWidget(rtrn);
1306 XtVaGetValues (FileCharacteristics,
1307 XmNheight, &dimHeight,
1308 XmNwidth, &dimWidth,
1310 XtVaGetValues (rtrn,
1311 XmNuserData, &widScrolledWindow,
1313 XtVaGetValues (widScrolledWindow,
1314 XmNverticalScrollBar, &widTmp,
1316 XtVaGetValues (widTmp,
1319 dimHeight += dimTmp;
1322 XtVaSetValues (rtrn,
1323 XmNheight, dimHeight,
1331 /******************************************************************************/
1333 /* init_FileCharacteristics_dialog_fields */
1335 /* INPUT: FiletypeData * - pointer to FiletypeData structure */
1338 /******************************************************************************/
1339 void init_FileCharacteristics_dialog_fields(FiletypeData *pFtD)
1341 char buffer[MAXBUFSIZE];
1342 char *pszPerms = (char *)NULL;
1344 /************************************************************************/
1345 /* Initialize name pattern. */
1346 /************************************************************************/
1347 if (pFtD->pszPattern) {
1348 /*XmToggleButtonSetState(FC_NameOrPathToggle, TRUE);*/
1349 XmToggleButtonGadgetSetState(FC_NameOrPathToggle, TRUE, TRUE);
1350 PutWidgetTextString(FC_NameOrPathText, pFtD->pszPattern);
1352 /*XmToggleButtonSetState(FC_NameOrPathToggle, FALSE);*/
1353 XmToggleButtonGadgetSetState(FC_NameOrPathToggle, FALSE, TRUE);
1356 /************************************************************************/
1357 /* Initialize permission pattern. */
1358 /************************************************************************/
1359 if (pFtD->pszPermissions) {
1360 if (strstr(pFtD->pszPermissions, "!d")) {
1361 XmToggleButtonGadgetSetState(FC_FileToggle, TRUE, TRUE);
1363 XmToggleButtonGadgetSetState(FC_DirectoryToggle, TRUE, TRUE);
1365 pszPerms = strchr(pFtD->pszPermissions, 'd');
1369 pszPerms = (char *)NULL;
1375 XmToggleButtonGadgetSetState(FC_PermissionToggle, TRUE, TRUE);
1377 /******************************************************************/
1378 /* Initialize Read permission */
1379 /******************************************************************/
1380 if (strstr(pFtD->pszPermissions, "!r")) {
1381 XmToggleButtonGadgetSetState(FC_ReadOffToggle, TRUE, TRUE);
1383 if (strstr(pFtD->pszPermissions, "r")) {
1384 XmToggleButtonGadgetSetState(FC_ReadOnToggle, TRUE, TRUE);
1386 XmToggleButtonGadgetSetState(FC_ReadEitherToggle, TRUE, TRUE);
1389 /******************************************************************/
1390 /* Initialize Write permission */
1391 /******************************************************************/
1392 if (strstr(pFtD->pszPermissions, "!w")) {
1393 XmToggleButtonGadgetSetState(FC_WriteOffToggle, TRUE, TRUE);
1395 if (strstr(pFtD->pszPermissions, "w")) {
1396 XmToggleButtonGadgetSetState(FC_WriteOnToggle, TRUE, TRUE);
1398 XmToggleButtonGadgetSetState(FC_WriteEitherToggle, TRUE, TRUE);
1401 /******************************************************************/
1402 /* Initialize Execute permission */
1403 /******************************************************************/
1404 if (strstr(pFtD->pszPermissions, "!x")) {
1405 XmToggleButtonGadgetSetState(FC_ExecuteOffToggle, TRUE, TRUE);
1407 if (strstr(pFtD->pszPermissions, "x")) {
1408 XmToggleButtonGadgetSetState(FC_ExecuteOnToggle, TRUE, TRUE);
1410 XmToggleButtonGadgetSetState(FC_ExecuteEitherToggle, TRUE, TRUE);
1415 XmToggleButtonGadgetSetState(FC_PermissionToggle, FALSE, TRUE);
1418 /************************************************************************/
1419 /* Initialize contents pattern. */
1420 /************************************************************************/
1421 if (pFtD->pszContents) {
1422 XmToggleButtonGadgetSetState(FC_ContentsToggle, TRUE, TRUE);
1423 /*XmToggleButtonSetState(FC_ContentsToggle, TRUE);*/
1424 PutWidgetTextString(FC_ContentsPatternText, pFtD->pszContents);
1426 if (pFtD->fsFlags & CA_FT_CNTSTRING)
1427 XmToggleButtonGadgetSetState(FC_StringToggle, TRUE, TRUE);
1428 else if (pFtD->fsFlags & CA_FT_CNTBYTE)
1429 XmToggleButtonGadgetSetState(FC_ByteToggle, TRUE, TRUE);
1430 else if (pFtD->fsFlags & CA_FT_CNTSHORT)
1431 XmToggleButtonGadgetSetState(FC_ShortToggle, TRUE, TRUE);
1432 else if (pFtD->fsFlags & CA_FT_CNTLONG)
1433 XmToggleButtonGadgetSetState(FC_LongToggle, TRUE, TRUE);
1435 sprintf(buffer, "%d", pFtD->sStart);
1436 PutWidgetTextString(FC_StartByteTextField,buffer);
1438 sprintf(buffer, "%d", pFtD->sEnd);
1439 PutWidgetTextString(FC_EndByteTextField, buffer);
1442 XmToggleButtonGadgetSetState(FC_ContentsToggle, FALSE, TRUE);
1443 /*XmToggleButtonSetState(FC_ContentsToggle, FALSE);*/
1448 /******************************************************************************/
1450 /* clear_FileCharacteristics_dialog_fields */
1452 /* INPUT: FiletypeData * - pointer to FiletypeData structure */
1455 /******************************************************************************/
1456 void clear_FileCharacteristics_dialog_fields(void)
1458 /************************************************************************/
1459 /* Clear Files/Directories - set to default */
1460 /************************************************************************/
1461 XmToggleButtonGadgetSetState(FC_FileToggle, TRUE, TRUE);
1463 /************************************************************************/
1464 /* Clear name pattern. */
1465 /************************************************************************/
1466 XmToggleButtonGadgetSetState(FC_NameOrPathToggle, FALSE, TRUE);
1467 clear_text_field(FC_NameOrPathText);
1469 /************************************************************************/
1470 /* Clear permission pattern - set to default */
1471 /************************************************************************/
1472 XmToggleButtonGadgetSetState(FC_PermissionToggle, FALSE, TRUE);
1473 XmToggleButtonGadgetSetState(FC_ReadOnToggle, FALSE, TRUE);
1474 XmToggleButtonGadgetSetState(FC_WriteOnToggle, FALSE, TRUE);
1475 XmToggleButtonGadgetSetState(FC_ExecuteOnToggle, FALSE, TRUE);
1477 XmToggleButtonGadgetSetState(FC_ReadOffToggle, FALSE, TRUE);
1478 XmToggleButtonGadgetSetState(FC_WriteOffToggle, FALSE, TRUE);
1479 XmToggleButtonGadgetSetState(FC_ExecuteOffToggle, FALSE, TRUE);
1481 XmToggleButtonGadgetSetState(FC_ReadEitherToggle, TRUE, TRUE);
1482 XmToggleButtonGadgetSetState(FC_WriteEitherToggle, TRUE, TRUE);
1483 XmToggleButtonGadgetSetState(FC_ExecuteEitherToggle, TRUE, TRUE);
1485 /************************************************************************/
1486 /* Clear contents pattern - set to default */
1487 /************************************************************************/
1488 XmToggleButtonGadgetSetState(FC_ContentsToggle, FALSE, TRUE);
1489 clear_text_field(FC_ContentsPatternText);
1490 XmToggleButtonGadgetSetState(FC_StringToggle, TRUE, TRUE);
1491 clear_text_field(FC_StartByteTextField);
1493 clear_text_field(FC_EndByteTextField);
1499 /******************************************************************************/
1501 /* FileCharCheckFields */
1504 /* OUTPUT: FALSE - no errors found */
1505 /* TRUE - found errors */
1507 /******************************************************************************/
1508 Boolean FileCharCheckFields(void)
1510 char *ptr = (char *)NULL;
1511 Boolean bError = FALSE;
1512 char *msgPtr, *errPtr;
1514 /**************************************************************************/
1515 /* Check to make sure at least one characteristic is selected. */
1516 /**************************************************************************/
1518 if ( !(XmToggleButtonGadgetGetState(FC_NameOrPathToggle)) &&
1519 !(XmToggleButtonGadgetGetState(FC_PermissionToggle)) &&
1520 !(XmToggleButtonGadgetGetState(FC_ContentsToggle)) ) {
1521 msgPtr = GETMESSAGE(10, 30,
1522 "An identifying characteristic has not been selected.\n\
1523 Select one or more of the characteristics\n\
1524 (Name Pattern, Permissions Pattern, or Contents).");
1525 errPtr = XtNewString(msgPtr);
1526 display_error_message(FileCharacteristics, errPtr);
1528 XmProcessTraversal(FC_NameOrPathText, XmTRAVERSE_CURRENT);
1533 /**************************************************************************/
1534 /* Check if name pattern is selected. If so must have a name pattern. */
1535 /**************************************************************************/
1537 if (XmToggleButtonGadgetGetState(FC_NameOrPathToggle)) {
1539 GetWidgetTextString(FC_NameOrPathText, &ptr);
1541 printf("Name Pattern = '%s'\n", ptr);
1544 msgPtr = GETMESSAGE(10, 10, "Name Pattern is missing.\n\
1545 If Name Pattern is selected, a name pattern\n\
1547 errPtr = XtNewString(msgPtr);
1548 display_error_message(FileCharacteristics, errPtr);
1550 XmProcessTraversal(FC_NameOrPathText, XmTRAVERSE_CURRENT);
1558 /**************************************************************************/
1559 /* Check if contents is selected. If so must have a contents pattern. */
1560 /**************************************************************************/
1562 if (XmToggleButtonGadgetGetState(FC_ContentsToggle)) {
1564 GetWidgetTextString(FC_ContentsPatternText, &ptr);
1566 printf("Name Pattern = '%s'\n", ptr);
1569 msgPtr = GETMESSAGE(10, 20, "Contents Pattern is missing.\n\
1570 If Contents is selected, then the Pattern field\n\
1571 under Contents must be filled in.");
1572 errPtr = XtNewString(msgPtr);
1573 display_error_message(FileCharacteristics, errPtr);
1578 /*****************************************************************/
1579 /* Now check to make sure there is a start byte value. */
1580 /*****************************************************************/
1582 GetWidgetTextString(FC_StartByteTextField, &ptr);
1584 msgPtr = GETMESSAGE(10, 25, "Start byte value is missing.\n\
1585 If Contents is selected, then a number must be\n\
1586 entered in the 'Start Byte' field.");
1587 errPtr = XtNewString(msgPtr);
1588 display_error_message(FileCharacteristics, errPtr);
1601 /*******************************************************************************
1603 *******************************************************************************/