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: FileCharacteristics.c /main/7 1999/09/17 15:43:31 mgreess $ */
25 /*******************************************************************************
28 Associated Header file: FileCharacteristics.h
29 *******************************************************************************/
36 #include <Xm/MwmUtil.h>
37 #include <Xm/DialogS.h>
38 #include <Xm/MenuShell.h>
39 #include <Xm/RowColumn.h>
41 #include <Xm/ToggleBG.h>
44 #include <Xm/PushBG.h>
46 #include <Xm/ScrolledW.h>
52 #define CONTEXT_MACRO_ACCESS 1
53 #include "FileCharacteristics.h"
54 #undef CONTEXT_MACRO_ACCESS
56 /*******************************************************************************
57 Includes, Defines, and Global variables from the Declarations Editor:
58 *******************************************************************************/
63 Widget FC_ReadOnToggle, FC_ReadOffToggle, FC_ReadEitherToggle;
64 Widget FC_WriteOnToggle, FC_WriteOffToggle, FC_WriteEitherToggle;
65 Widget FC_ExecuteOnToggle, FC_ExecuteOffToggle, FC_ExecuteEitherToggle;
66 Widget FC_PermissionForm;
69 Widget FC_ExecuteLabel;
71 /******************************************************************************/
73 /* GetPermissionsPattern */
76 /* OUTPUT: permissions pattern in database format */
78 /******************************************************************************/
79 void GetPermissionsPattern(char **ppszPermPattern)
82 if (*ppszPermPattern) {
83 XtFree(*ppszPermPattern);
84 *ppszPermPattern = (char *)NULL;
87 *ppszPermPattern = (char *)XtMalloc(20);
88 memset(*ppszPermPattern, 0, 20);
90 if (XmToggleButtonGadgetGetState(FC_DirectoryToggle)) {
91 strcat(*ppszPermPattern, "d");
93 strcat(*ppszPermPattern, "!d");
96 if (XmToggleButtonGadgetGetState(FC_PermissionToggle)) {
97 /******************************************************************/
99 /******************************************************************/
100 if (XmToggleButtonGadgetGetState(FC_ReadOnToggle)) {
101 strcat(*ppszPermPattern, "&r");
103 if (XmToggleButtonGadgetGetState(FC_ReadOffToggle)) {
104 strcat(*ppszPermPattern, "&!r");
107 /******************************************************************/
108 /* Get Write state */
109 /******************************************************************/
110 if (XmToggleButtonGadgetGetState(FC_WriteOnToggle)) {
111 strcat(*ppszPermPattern, "&w");
113 if (XmToggleButtonGadgetGetState(FC_WriteOffToggle)) {
114 strcat(*ppszPermPattern, "&!w");
117 /******************************************************************/
118 /* Get Execute state */
119 /******************************************************************/
120 if (XmToggleButtonGadgetGetState(FC_ExecuteOnToggle)) {
121 strcat(*ppszPermPattern, "&x");
123 if (XmToggleButtonGadgetGetState(FC_ExecuteOffToggle)) {
124 strcat(*ppszPermPattern, "&!x");
130 if (XmToggleButtonGadgetGetState(FC_PermissionToggle)) {
131 if (XmToggleButtonGadgetGetState(FC_ReadToggle)) {
132 strcat(*ppszPermPattern, "&r");
134 strcat(*ppszPermPattern, "&!r");
136 if (XmToggleButtonGadgetGetState(FC_WriteToggle)) {
137 strcat(*ppszPermPattern, "&w");
139 strcat(*ppszPermPattern, "&!w");
141 if (XmToggleButtonGadgetGetState(FC_ExecuteToggle)) {
142 strcat(*ppszPermPattern, "&x");
144 strcat(*ppszPermPattern, "&!x");
150 /******************************************************************************/
152 /* GetContentsType */
155 /* OUTPUT: contents type selected */
157 /******************************************************************************/
158 ushort GetContentsType(void)
161 if (XmToggleButtonGadgetGetState(FC_StringToggle)) {
162 return((ushort)CA_FT_CNTSTRING);
163 } else if (XmToggleButtonGadgetGetState(FC_ByteToggle)) {
164 return((ushort)CA_FT_CNTBYTE);
165 } else if (XmToggleButtonGadgetGetState(FC_ShortToggle)) {
166 return((ushort)CA_FT_CNTSHORT);
167 } else if (XmToggleButtonGadgetGetState(FC_LongToggle)) {
168 return((ushort)CA_FT_CNTLONG);
172 /******************************************************************************/
174 /* Save_FileChar_Info */
179 /******************************************************************************/
180 void Save_FileChar_Info(void)
184 char *ptr = (char *)NULL;
187 /**************************************************************************/
188 /* Clear file characteristics text widget on the AddFiletype dialog. */
189 /**************************************************************************/
190 XmTextSetString(AF_IdCharacteristicsText, "");
192 /**************************************************************************/
193 /* Get pointer to FiletypeData structure. */
194 /* Also, update the filetypes listbox on the AddFiletype window. */
195 /**************************************************************************/
196 XtVaGetValues(FileCharacteristics,
200 /**************************************************************************/
201 /* Get Name Pattern Info */
202 /**************************************************************************/
203 if (XmToggleButtonGadgetGetState(FC_NameOrPathToggle)) {
204 GetWidgetTextString(FC_NameOrPathText, &(pFtD->pszPattern));
206 printf("Pattern is '%s'\n", pFtD->pszPattern);
209 if (pFtD->pszPattern) {
210 XtFree(pFtD->pszPattern);
211 pFtD->pszPattern = (char *)NULL;
215 /**************************************************************************/
216 /* Get Permission Info */
217 /**************************************************************************/
218 GetPermissionsPattern(&(pFtD->pszPermissions));
220 /**************************************************************************/
221 /* Get Content Pattern Info */
222 /**************************************************************************/
223 if (XmToggleButtonGadgetGetState(FC_ContentsToggle)) {
225 /************************************************************************/
226 /* Save data in structure. */
227 /************************************************************************/
228 GetWidgetTextString(FC_ContentsPatternText, &(pFtD->pszContents));
230 GetWidgetTextString(FC_StartByteTextField, &ptr);
232 pFtD->sStart = atoi(ptr);
237 GetWidgetTextString(FC_EndByteTextField, &ptr);
239 pFtD->sEnd = atoi(ptr);
243 pFtD->fsFlags = GetContentsType();
246 if (pFtD->pszContents) {
247 XtFree(pFtD->pszContents);
248 pFtD->pszContents = (char *)NULL;
253 /**************************************************************************/
254 /* Parse the ID fields in the FiletypeData structure and create a text */
255 /* string for the Identifying Characteristics text field in AddFiletype. */
256 /**************************************************************************/
257 ParseAndUpdateID(pFtD);
261 /******************************************************************************/
263 /* ParseAndUpdateID */
268 /******************************************************************************/
269 void ParseAndUpdateID(FiletypeData *pFtD)
272 char *ptr = (char *)NULL;
275 /**************************************************************************/
276 /* Init size variable. This will be used to indicate size of buffer to */
277 /* allocate to hold text string that will be displayed in FC text widget. */
278 /**************************************************************************/
281 /**************************************************************************/
282 /* Get Name Pattern Info */
283 /**************************************************************************/
284 if (pFtD->pszPattern) {
285 /*size += strlen("Name: ");*/
286 size += strlen(GETMESSAGE(9, 20, "Name Pattern:")) + 1; /* 1 for space */
287 size += strlen(pFtD->pszPattern);
288 size += 1; /* For newline character */
291 /**************************************************************************/
292 /* Get Permission Info */
293 /**************************************************************************/
294 if (pFtD->pszPermissions) {
295 size += strlen(GETMESSAGE(9, 21, "Permission Pattern:")) + 1; /* space */
296 size += strlen(pFtD->pszPermissions);
297 size += 1; /* For newline character */
300 /**************************************************************************/
301 /* Get Content Pattern Info */
302 /**************************************************************************/
303 if (pFtD->pszContents) {
304 size += strlen(GETMESSAGE(9, 28, "Contents:")) + 1; /* 1 for space */
305 size += strlen(pFtD->pszContents);
306 size += 1; /* For newline character */
309 /**************************************************************************/
310 /* Allocate buffer and fill with ID info. */
311 /**************************************************************************/
313 ptr = XtMalloc(size);
315 memset(ptr, 0, size);
316 if (pFtD->pszPattern) {
317 strcat(ptr, GETMESSAGE(9, 20, "Name Pattern:"));
319 strcat(ptr, pFtD->pszPattern);
322 if (pFtD->pszPermissions) {
323 strcat(ptr, GETMESSAGE(9, 21, "Permission Pattern:"));
325 strcat(ptr, pFtD->pszPermissions);
328 if (pFtD->pszContents) {
329 strcat(ptr, GETMESSAGE(9, 28, "Contents:"));
331 strcat(ptr, pFtD->pszContents);
334 XmTextSetString(AF_IdCharacteristicsText, ptr);
340 /*****************************************************************************/
345 /*****************************************************************************/
346 void CalculateAND(void)
348 Boolean set1, set2, set3, set4;
351 XtVaGetValues(FC_NameOrPathToggle, XmNset, &set1, NULL);
352 XtVaGetValues(FC_PermissionToggle, XmNset, &set2, NULL);
353 XtVaGetValues(FC_ContentsToggle, XmNset, &set3, NULL);
354 XtSetSensitive(FC_AndLabel1, False);
355 XtSetSensitive(FC_AndLabel2, False);
357 cnt = (int)set1 + (int)set2 + (int)set3;
358 if (set1 && (set2 || set3))
359 XtSetSensitive(FC_AndLabel1, True);
361 XtSetSensitive(FC_AndLabel2, True);
364 /*******************************************************************************
365 The following are callback functions.
366 *******************************************************************************/
368 static void activateCB_FC_OkButton( Widget UxWidget,
369 XtPointer UxClientData,
370 XtPointer UxCallbackArg)
373 if (!FileCharCheckFields()) {
374 Save_FileChar_Info();
375 UxPopdownInterface(FileCharacteristics);
379 static void activateCB_FC_ClearButton(Widget UxWidget,
380 XtPointer UxClientData,
381 XtPointer UxCallbackArg)
384 /* Clear_FileChar_Info(); */
385 clear_FileCharacteristics_dialog_fields();
388 static void activateCB_FC_CancelButton(Widget UxWidget,
389 XtPointer UxClientData,
390 XtPointer UxCallbackArg)
393 _UxCFileCharacteristics *UxSaveCtx, *UxContext;
395 UxSaveCtx = UxFileCharacteristicsContext;
396 UxFileCharacteristicsContext = UxContext =
397 (_UxCFileCharacteristics *) UxGetContext( UxWidget );
400 UxPopdownInterface(FileCharacteristics);
403 UxFileCharacteristicsContext = UxSaveCtx;
407 static void valueChangedCB_FC_PermissionToggle(Widget UxWidget,
408 XtPointer UxClientData,
409 XtPointer UxCallbackArg)
413 XtVaGetValues(UxWidget, XmNset, &set, NULL);
414 XtSetSensitive(FC_PermissionLabel, set);
415 XtSetSensitive(FC_PermissionForm, set);
417 XtSetSensitive(FC_ReadLabel, set);
418 XtSetSensitive(FC_WriteLabel, set);
419 XtSetSensitive(FC_ExecuteLabel, set);
421 XtSetSensitive(FC_ReadOnToggle, set);
422 XtSetSensitive(FC_WriteOnToggle, set);
423 XtSetSensitive(FC_ExecuteOnToggle, set);
425 XtSetSensitive(FC_ReadOffToggle, set);
426 XtSetSensitive(FC_WriteOffToggle, set);
427 XtSetSensitive(FC_ExecuteOffToggle, set);
429 XtSetSensitive(FC_ReadEitherToggle, set);
430 XtSetSensitive(FC_WriteEitherToggle, set);
431 XtSetSensitive(FC_ExecuteEitherToggle, set);
437 static void armCB_FC_StringToggle(Widget UxWidget,
438 XtPointer UxClientData,
439 XtPointe`r UxCallbackArg)
444 static void armCB_FC_ByteToggle(Widget UxWidget,
445 XtPointer UxClientData,
446 XtPointer UxCallbackArg)
451 static void armCB_FC_ShortToggle(Widget UxWidget,
452 XtPointer UxClientData,
453 XtPointer UxCallbackArg)
458 static void armCB_FC_LongToggle( Widget UxWidget,
459 XtPointer UxClientData,
460 XtPointer UxCallbackArg)
466 static void valueChangedCB_FC_ContentsToggle( Widget UxWidget,
467 XtPointer UxClientData,
468 XtPointer UxCallbackArg)
472 XtVaGetValues(UxWidget, XmNset, &set, NULL);
473 XtSetSensitive(FC_ContentsLabel, set);
474 XtSetSensitive(FC_ContentsBox, set);
476 XmProcessTraversal(FC_ContentsPatternText, XmTRAVERSE_CURRENT);
481 static void valueChangedCB_FC_NameOrPathToggle(Widget UxWidget,
482 XtPointer UxClientData,
483 XtPointer UxCallbackArg)
488 XtVaGetValues(UxWidget, XmNset, &set, NULL);
489 XtSetSensitive(FC_NamePatternLabel, set);
490 XtSetSensitive(FC_NameOrPathText, set);
492 XmProcessTraversal(FC_NameOrPathText, XmTRAVERSE_CURRENT);
497 /*******************************************************************************
498 The 'build_' function creates all the widgets
499 using the resource values specified in the Property Editor.
500 *******************************************************************************/
502 static Widget _Uxbuild_FileCharacteristics(void)
505 Widget FC_ActionAreaForm;
507 Widget FC_ClearButton;
508 Widget FC_CancelButton;
509 Widget FC_HelpButton;
510 Widget FC_MainLabel1;
511 Widget FC_MainLabel2;
512 Widget FC_TypeFileRowColumn;
514 Widget FC_ReadRowColumn;
515 Widget FC_WriteRowColumn;
516 Widget FC_ExecuteRowColumn;
517 int ntotalbuttons = 4;
520 Widget FC_ScrolledWindow;
522 char *dialog_title, *pre, *suf;
525 /* Creation of FileCharacteristics */
527 _UxParent = UxParent;
528 if ( _UxParent == NULL )
530 _UxParent = UxTopLevel;
534 _UxParent = UxTopLevel;
536 pre = GETMESSAGE(3, 10, "Create Action");
537 suf = GETMESSAGE(9, 10, "Identifying Characteristics");
538 dialog_title = XtMalloc(strlen(pre) + strlen(suf) + 4);
539 sprintf(dialog_title, "%s - %s", pre, suf);
542 _UxParent = XtVaCreatePopupShell( "FileCharacteristics_shell",
543 xmDialogShellWidgetClass, _UxParent,
548 XmNshellUnitType, XmPIXELS,
549 XmNtitle, dialog_title,
551 FC_BigForm = XtVaCreateWidget( "FC_BigForm",
554 XmNunitType, XmPIXELS,
555 XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL,
556 RES_CONVERT( XmNdialogTitle, dialog_title ),
557 XmNautoUnmanage, FALSE,
558 XmNrubberPositioning, FALSE,
560 FC_ScrolledWindow = XtVaCreateManagedWidget( "FC_ScrolledWindow",
561 xmScrolledWindowWidgetClass,
563 XmNscrollingPolicy, XmAUTOMATIC,
564 XmNleftAttachment, XmATTACH_FORM,
565 XmNrightAttachment, XmATTACH_FORM,
566 XmNbottomAttachment, XmATTACH_FORM,
567 XmNtopAttachment, XmATTACH_FORM,
569 XtVaSetValues(FC_BigForm, XmNuserData, FC_ScrolledWindow, NULL);
571 FileCharacteristics = XtVaCreateManagedWidget( "FileCharacteristics",
576 _UxParent = XtVaCreatePopupShell( "FileCharacteristics_shell",
577 xmDialogShellWidgetClass, _UxParent,
580 XmNmwmDecorations, MWM_DECOR_ALL | MWM_DECOR_RESIZEH,
583 XmNshellUnitType, XmPIXELS,
584 XmNtitle, dialog_title,
586 FileCharacteristics = XtVaCreateWidget( "FileCharacteristics",
589 XmNunitType, XmPIXELS,
590 XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL,
591 RES_CONVERT( XmNdialogTitle, dialog_title ),
592 XmNautoUnmanage, FALSE,
593 XmNrubberPositioning, FALSE,
596 XtFree(dialog_title);
597 XtAddCallback( FileCharacteristics, XmNhelpCallback,
598 (XtCallbackProc) helpCB_general,
599 (XtPointer) HELP_FILECHAR );
601 /* Creation of FC_MainLabel1 */
602 FC_MainLabel1 = XtVaCreateManagedWidget( "FC_MainLabel1",
605 XmNalignment, XmALIGNMENT_BEGINNING,
606 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 11, "Include All")),
608 XmNleftAttachment, XmATTACH_FORM,
609 XmNrightAttachment, XmATTACH_FORM,
611 XmNtopAttachment, XmATTACH_FORM,
614 /* Creation of FC_TypeFileRowColumn */
615 FC_TypeFileRowColumn = XtVaCreateManagedWidget( "FC_TypeFileRowColumn",
616 xmRowColumnWidgetClass,
618 XmNradioBehavior, TRUE,
621 XmNorientation, XmVERTICAL,
622 XmNpacking, XmPACK_COLUMN,
623 XmNshadowThickness, 1,
624 XmNleftWidget, FC_MainLabel1,
625 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
627 XmNtopWidget, FC_MainLabel1,
628 XmNtopAttachment, XmATTACH_WIDGET,
631 /* Creation of FC_FileToggle */
632 FC_FileToggle = XtVaCreateManagedWidget( "FC_FileToggle",
633 xmToggleButtonGadgetClass,
634 FC_TypeFileRowColumn,
635 XmNindicatorType, XmONE_OF_MANY,
636 XmNindicatorSize, 17,
637 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 12, "Files")),
641 /* Creation of FC_DirectoryToggle */
642 FC_DirectoryToggle = XtVaCreateManagedWidget( "FC_DirectoryToggle",
643 xmToggleButtonGadgetClass,
644 FC_TypeFileRowColumn,
645 XmNindicatorType, XmONE_OF_MANY,
646 XmNindicatorSize, 17,
647 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 13, "Folders")),
650 /* Creation of FC_MainLabel2 */
651 FC_MainLabel2 = XtVaCreateManagedWidget( "FC_MainLabel2",
654 XmNalignment, XmALIGNMENT_BEGINNING,
655 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 14, "That Match the Following:")),
657 XmNleftAttachment, XmATTACH_FORM,
658 XmNrightAttachment, XmATTACH_FORM,
660 XmNtopWidget, FC_TypeFileRowColumn,
661 XmNtopAttachment, XmATTACH_WIDGET,
664 /* Creation of FC_NamePatternLabel */
665 FC_NamePatternLabel = XtVaCreateManagedWidget( "FC_NamePatternLabel",
668 XmNalignment, XmALIGNMENT_BEGINNING,
669 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 20, "Name Pattern:")),
670 XmNleftWidget, FC_MainLabel2,
671 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
672 XmNrightAttachment, XmATTACH_NONE,
674 XmNtopWidget, FC_MainLabel2,
675 XmNtopAttachment, XmATTACH_WIDGET,
678 /* Creation of FC_NameOrPathText */
679 FC_NameOrPathText = XtVaCreateManagedWidget( "FC_NameOrPathText",
680 xmTextFieldWidgetClass,
684 XmNleftWidget, FC_NamePatternLabel,
685 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
687 XmNtopWidget, FC_NamePatternLabel,
688 XmNtopAttachment, XmATTACH_WIDGET,
691 /* Creation of FC_AndLabel1 */
692 FC_AndLabel1 = XtVaCreateManagedWidget( "FC_AndLabel1",
697 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 27, "AND")),
700 XmNrightAttachment, XmATTACH_FORM,
702 XmNtopWidget, FC_NamePatternLabel,
703 XmNtopAttachment, XmATTACH_WIDGET,
706 XtVaSetValues(FC_NameOrPathText,
708 XmNrightWidget, FC_AndLabel1,
709 XmNrightAttachment, XmATTACH_WIDGET,
713 /* Creation of FC_NameOrPathToggle */
714 FC_NameOrPathToggle = XtVaCreateManagedWidget( "FC_NameOrPathToggle",
715 xmToggleButtonGadgetClass,
717 RES_CONVERT( XmNlabelString, "" ),
719 XmNnavigationType, XmTAB_GROUP,
720 XmNindicatorSize, 20,
721 XmNleftAttachment, XmATTACH_NONE,
723 XmNrightWidget, FC_NameOrPathText,
724 XmNrightAttachment, XmATTACH_WIDGET,
725 XmNtopWidget, FC_NameOrPathText,
726 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
727 XmNbottomAttachment, XmATTACH_NONE,
729 XtAddCallback( FC_NameOrPathToggle, XmNvalueChangedCallback,
730 (XtCallbackProc) valueChangedCB_FC_NameOrPathToggle,
733 /******************************************************************/
735 /* Permission Area creation <<<<<<<>>>>>>>> */
737 /******************************************************************/
738 /* Creation of FC_PermissionLabel */
739 FC_PermissionLabel = XtVaCreateManagedWidget( "FC_PermissionLabel",
744 XmNalignment, XmALIGNMENT_BEGINNING,
745 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 21, "Permission Pattern:")),
747 XmNleftWidget, FC_NameOrPathText,
748 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
749 XmNrightAttachment, XmATTACH_NONE,
751 XmNtopWidget, FC_NameOrPathText,
752 XmNtopAttachment, XmATTACH_WIDGET,
755 FC_PermissionForm = XtVaCreateManagedWidget( "FC_PermissionForm",
758 XmNresizePolicy, XmRESIZE_NONE,
761 XmNleftWidget, FC_PermissionLabel,
762 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
764 XmNtopWidget, FC_PermissionLabel,
765 XmNtopAttachment, XmATTACH_WIDGET,
768 /******************************************************************/
769 /* Creation of FC_ReadRowColumn */
771 /* This is the read row column - on, off, either radio buttons */
772 /******************************************************************/
773 FC_ReadRowColumn = XtVaCreateManagedWidget( "FC_ReadRowColumn",
774 xmRowColumnWidgetClass,
776 XmNradioBehavior, TRUE,
778 XmNorientation, XmVERTICAL,
779 XmNpacking, XmPACK_COLUMN,
780 XmNshadowThickness, 1,
782 XmNrightAttachment, XmATTACH_FORM,
784 XmNtopAttachment, XmATTACH_FORM,
787 /* Creation of FC_ReadOnToggle */
788 FC_ReadOnToggle = XtVaCreateManagedWidget( "FC_ReadOnToggle",
789 xmToggleButtonGadgetClass,
791 XmNindicatorType, XmONE_OF_MANY,
792 XmNindicatorSize, 17,
793 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 43, "On")),
797 /* Creation of FC_ReadOffToggle */
798 FC_ReadOffToggle = XtVaCreateManagedWidget( "FC_ReadOffToggle",
799 xmToggleButtonGadgetClass,
801 XmNindicatorType, XmONE_OF_MANY,
802 XmNindicatorSize, 17,
803 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 44, "Off")),
807 /* Creation of FC_ReadEitherToggle */
808 FC_ReadEitherToggle = XtVaCreateManagedWidget( "FC_ReadEitherToggle",
809 xmToggleButtonGadgetClass,
811 XmNindicatorType, XmONE_OF_MANY,
812 XmNindicatorSize, 17,
813 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 45, "Either")),
817 /******************************************************************/
818 /* Creation of FC_WriteRowColumn */
820 /* This is the write row column - on, off, either radio buttons */
821 /******************************************************************/
822 FC_WriteRowColumn = XtVaCreateManagedWidget( "FC_WriteRowColumn",
823 xmRowColumnWidgetClass,
825 XmNradioBehavior, TRUE,
827 XmNorientation, XmVERTICAL,
828 XmNpacking, XmPACK_COLUMN,
829 XmNshadowThickness, 1,
831 XmNrightAttachment, XmATTACH_FORM,
832 XmNtopWidget, FC_ReadRowColumn,
833 XmNtopAttachment, XmATTACH_WIDGET,
836 /* Creation of FC_WriteOnToggle */
837 FC_WriteOnToggle = XtVaCreateManagedWidget( "FC_WriteOnToggle",
838 xmToggleButtonGadgetClass,
840 XmNindicatorType, XmONE_OF_MANY,
841 XmNindicatorSize, 17,
842 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 43, "On")),
846 /* Creation of FC_WriteOffToggle */
847 FC_WriteOffToggle = XtVaCreateManagedWidget( "FC_WriteOffToggle",
848 xmToggleButtonGadgetClass,
850 XmNindicatorType, XmONE_OF_MANY,
851 XmNindicatorSize, 17,
852 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 44, "Off")),
856 /* Creation of FC_WriteEitherToggle */
857 FC_WriteEitherToggle = XtVaCreateManagedWidget( "FC_WriteEitherToggle",
858 xmToggleButtonGadgetClass,
860 XmNindicatorType, XmONE_OF_MANY,
861 XmNindicatorSize, 17,
862 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 45, "Either")),
866 /******************************************************************/
867 /* Creation of FC_ExecuteRowColumn */
869 /* This is the execute row column - on, off, either radio buttons */
870 /******************************************************************/
871 FC_ExecuteRowColumn = XtVaCreateManagedWidget( "FC_ExecuteRowColumn",
872 xmRowColumnWidgetClass,
874 XmNradioBehavior, TRUE,
876 XmNorientation, XmVERTICAL,
877 XmNpacking, XmPACK_COLUMN,
878 XmNshadowThickness, 1,
880 XmNrightAttachment, XmATTACH_FORM,
881 XmNtopWidget, FC_WriteRowColumn,
882 XmNtopAttachment, XmATTACH_WIDGET,
884 XmNbottomAttachment, XmATTACH_FORM,
887 /* Creation of FC_ExecuteOnToggle */
888 FC_ExecuteOnToggle = XtVaCreateManagedWidget( "FC_ExecuteOnToggle",
889 xmToggleButtonGadgetClass,
891 XmNindicatorType, XmONE_OF_MANY,
892 XmNindicatorSize, 17,
893 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 43, "On")),
897 /* Creation of FC_ExecuteOffToggle */
898 FC_ExecuteOffToggle = XtVaCreateManagedWidget( "FC_ExecuteOffToggle",
899 xmToggleButtonGadgetClass,
901 XmNindicatorType, XmONE_OF_MANY,
902 XmNindicatorSize, 17,
903 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 44, "Off")),
907 /* Creation of FC_ExecuteEitherToggle */
908 FC_ExecuteEitherToggle = XtVaCreateManagedWidget( "FC_ExecuteEitherToggle",
909 xmToggleButtonGadgetClass,
911 XmNindicatorType, XmONE_OF_MANY,
912 XmNindicatorSize, 17,
913 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 45, "Either")),
917 /******************************************************************/
918 /* Creation of Permission Labels */
919 /******************************************************************/
920 FC_ReadLabel = XtVaCreateManagedWidget( "FC_ReadLabel",
923 XmNalignment, XmALIGNMENT_BEGINNING,
924 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 40, "Read:")),
925 XmNrightWidget, FC_ReadRowColumn,
926 XmNrightAttachment, XmATTACH_WIDGET,
928 XmNleftAttachment, XmATTACH_FORM,
929 XmNtopWidget, FC_ReadRowColumn,
930 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
932 FC_WriteLabel = XtVaCreateManagedWidget( "FC_WriteLabel",
935 XmNalignment, XmALIGNMENT_BEGINNING,
936 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 41, "Write:")),
937 XmNrightWidget, FC_WriteRowColumn,
938 XmNrightAttachment, XmATTACH_WIDGET,
940 XmNleftAttachment, XmATTACH_FORM,
941 XmNtopWidget, FC_WriteRowColumn,
942 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
944 FC_ExecuteLabel = XtVaCreateManagedWidget( "FC_ExecuteLabel",
947 XmNalignment, XmALIGNMENT_BEGINNING,
948 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 42, "Execute:")),
949 XmNrightWidget, FC_ExecuteRowColumn,
950 XmNrightAttachment, XmATTACH_WIDGET,
952 XmNleftAttachment, XmATTACH_FORM,
953 XmNtopWidget, FC_ExecuteRowColumn,
954 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
957 /******************************************************************/
958 /* Creation of the AND label for permissions. */
959 /******************************************************************/
960 FC_AndLabel2 = XtVaCreateManagedWidget( "FC_AndLabel2",
965 XmNalignment, XmALIGNMENT_BEGINNING,
966 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 27, "AND")),
969 XmNrightAttachment, XmATTACH_FORM,
971 XmNtopWidget, FC_PermissionLabel,
972 XmNtopAttachment, XmATTACH_WIDGET,
975 XtVaSetValues(FC_PermissionForm,
977 XmNrightWidget, FC_AndLabel2,
978 XmNrightAttachment, XmATTACH_WIDGET,
982 /* Creation of FC_PermissionToggle */
983 FC_PermissionToggle = XtVaCreateManagedWidget( "FC_PermissionToggle",
984 xmToggleButtonGadgetClass,
986 RES_CONVERT( XmNlabelString, "" ),
987 XmNnavigationType, XmTAB_GROUP,
988 XmNindicatorSize, 20,
989 XmNleftAttachment, XmATTACH_NONE,
991 XmNrightWidget, FC_PermissionForm,
992 XmNrightAttachment, XmATTACH_WIDGET,
993 XmNtopWidget, FC_PermissionForm,
994 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
995 XmNbottomAttachment, XmATTACH_NONE,
997 XtAddCallback( FC_PermissionToggle, XmNvalueChangedCallback,
998 (XtCallbackProc) valueChangedCB_FC_PermissionToggle,
1001 /* Creation of FC_ContentsLabel */
1002 FC_ContentsLabel = XtVaCreateManagedWidget( "FC_ContentsLabel",
1004 FileCharacteristics,
1005 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 28, "Contents:")),
1006 XmNsensitive, FALSE,
1007 XmNleftWidget, FC_PermissionForm,
1008 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1009 XmNrightAttachment, XmATTACH_NONE,
1011 XmNtopWidget, FC_PermissionForm,
1012 XmNtopAttachment, XmATTACH_WIDGET,
1015 /* Creation of FC_ContentsBox */
1016 FC_ContentsBox = XtVaCreateManagedWidget( "FC_ContentsBox",
1018 FileCharacteristics,
1019 XmNresizePolicy, XmRESIZE_NONE,
1021 XmNsensitive, FALSE,
1022 XmNleftWidget, FC_ContentsLabel,
1023 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1025 XmNrightAttachment, XmATTACH_FORM,
1027 XmNtopWidget, FC_ContentsLabel,
1028 XmNtopAttachment, XmATTACH_WIDGET,
1031 /* Creation of FC_ContentsToggle */
1032 FC_ContentsToggle = XtVaCreateManagedWidget( "FC_ContentsToggle",
1033 xmToggleButtonGadgetClass,
1034 FileCharacteristics,
1035 RES_CONVERT( XmNlabelString, "" ),
1036 XmNnavigationType, XmTAB_GROUP,
1037 XmNindicatorSize, 20,
1038 XmNleftAttachment, XmATTACH_NONE,
1040 XmNrightWidget, FC_ContentsBox,
1041 XmNrightAttachment, XmATTACH_WIDGET,
1042 XmNtopWidget, FC_ContentsBox,
1043 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1044 XmNbottomAttachment, XmATTACH_NONE,
1046 XtAddCallback( FC_ContentsToggle, XmNvalueChangedCallback,
1047 (XtCallbackProc) valueChangedCB_FC_ContentsToggle,
1050 /* Creation of FC_ContentsPatternLabel */
1051 FC_ContentsPatternLabel = XtVaCreateManagedWidget( "FC_ContentsPatternLabel",
1054 XmNalignment, XmALIGNMENT_BEGINNING,
1055 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 29, "Pattern:")),
1057 XmNleftAttachment, XmATTACH_FORM,
1058 XmNrightAttachment, XmATTACH_NONE,
1060 XmNtopAttachment, XmATTACH_FORM,
1063 /* Creation of FC_ContentsPatternText */
1064 FC_ContentsPatternText = XtVaCreateManagedWidget( "FC_ContentsPatternText",
1065 xmTextFieldWidgetClass,
1069 XmNleftWidget, FC_ContentsPatternLabel,
1070 XmNleftAttachment, XmATTACH_WIDGET,
1072 XmNrightAttachment, XmATTACH_FORM,
1073 XmNbottomAttachment, XmATTACH_NONE,
1074 XmNtopWidget, FC_ContentsPatternLabel,
1075 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1078 /* Creation of FC_TypeLabel */
1079 FC_TypeLabel = XtVaCreateManagedWidget( "FC_TypeLabel",
1082 XmNalignment, XmALIGNMENT_BEGINNING,
1083 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 30, "Type:")),
1084 XmNleftWidget, FC_ContentsPatternLabel,
1085 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1086 XmNbottomAttachment, XmATTACH_NONE,
1088 XmNtopWidget, FC_ContentsPatternLabel,
1089 XmNtopAttachment, XmATTACH_WIDGET,
1092 /* Creation of FC_TypeRowColumn */
1093 FC_TypeRowColumn = XtVaCreateManagedWidget( "FC_TypeRowColumn",
1094 xmRowColumnWidgetClass,
1097 XmNpacking, XmPACK_COLUMN,
1098 XmNradioBehavior, TRUE,
1100 XmNleftWidget, FC_ContentsPatternText,
1101 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1102 XmNrightWidget, FC_ContentsPatternText,
1103 XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET,
1104 XmNbottomAttachment, XmATTACH_NONE,
1105 XmNtopWidget, FC_TypeLabel,
1106 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1109 /* Creation of FC_StringToggle */
1110 FC_StringToggle = XtVaCreateManagedWidget( "FC_StringToggle",
1111 xmToggleButtonGadgetClass,
1113 XmNindicatorType, XmONE_OF_MANY,
1114 XmNindicatorSize, 17,
1115 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 31, "String")),
1119 /* Creation of FC_ByteToggle */
1120 FC_ByteToggle = XtVaCreateManagedWidget( "FC_ByteToggle",
1121 xmToggleButtonGadgetClass,
1123 XmNindicatorType, XmONE_OF_MANY,
1124 XmNindicatorSize, 17,
1125 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 32, "Byte (Hex)")),
1128 /* Creation of FC_ShortToggle */
1129 FC_ShortToggle = XtVaCreateManagedWidget( "FC_ShortToggle",
1130 xmToggleButtonGadgetClass,
1132 XmNindicatorType, XmONE_OF_MANY,
1133 XmNindicatorSize, 17,
1134 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 33, "Short (Decimal)")),
1137 /* Creation of FC_LongToggle */
1138 FC_LongToggle = XtVaCreateManagedWidget( "FC_LongToggle",
1139 xmToggleButtonGadgetClass,
1141 XmNindicatorType, XmONE_OF_MANY,
1142 XmNindicatorSize, 17,
1143 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 34, "Long (Decimal)")),
1146 /* Creation of FC_StartByteLabel */
1147 FC_StartByteLabel = XtVaCreateManagedWidget( "FC_StartByteLabel",
1150 XmNalignment, XmALIGNMENT_BEGINNING,
1151 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 35, "Start Byte:")),
1152 XmNleftWidget, FC_TypeLabel,
1153 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1154 XmNbottomOffset, 15,
1155 XmNbottomAttachment, XmATTACH_FORM,
1157 XmNtopWidget, FC_TypeRowColumn,
1158 XmNtopAttachment, XmATTACH_WIDGET,
1161 /* Creation of FC_StartByteTextField */
1162 FC_StartByteTextField = XtVaCreateManagedWidget( "FC_StartByteTextField",
1163 xmTextFieldWidgetClass,
1165 XmNcursorPosition, 5,
1168 XmNleftWidget, FC_StartByteLabel,
1169 XmNleftAttachment, XmATTACH_WIDGET,
1170 XmNtopWidget, FC_StartByteLabel,
1171 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1174 /* Creation of FC_EndByteLabel */
1175 FC_EndByteLabel = XtVaCreateManagedWidget( "FC_EndByteLabel",
1180 XmNalignment, XmALIGNMENT_BEGINNING,
1181 RES_CONVERT( XmNlabelString, "End byte:" ),
1183 XmNleftWidget, FC_StartByteTextField,
1184 XmNleftAttachment, XmATTACH_WIDGET,
1185 XmNtopWidget, FC_StartByteTextField,
1186 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1189 /* Creation of FC_EndByteTextField */
1190 FC_EndByteTextField = XtVaCreateManagedWidget( "FC_EndByteTextField",
1191 xmTextFieldWidgetClass,
1194 XmNcursorPosition, 5,
1197 XmNleftWidget, FC_EndByteLabel,
1198 XmNleftAttachment, XmATTACH_WIDGET,
1200 XmNrightAttachment, XmATTACH_FORM,
1201 XmNtopWidget, FC_EndByteLabel,
1202 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1206 FC_ActionAreaForm = XtVaCreateManagedWidget( "FC_ActionAreaForm",
1208 FileCharacteristics,
1209 XmNskipAdjust, TRUE,
1210 XmNfractionBase, ((TIGHTNESS * ntotalbuttons) - 1),
1211 XmNleftWidget, FC_ContentsBox,
1212 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1214 XmNrightAttachment, XmATTACH_FORM,
1215 XmNbottomOffset, 20,
1216 XmNbottomAttachment, XmATTACH_FORM,
1218 XmNtopWidget, FC_ContentsBox,
1219 XmNtopAttachment, XmATTACH_WIDGET,
1222 /* Creation of FC_OkButton */
1223 FC_OkButton = XtVaCreateManagedWidget( "FC_OkButton",
1224 xmPushButtonGadgetClass,
1226 RES_CONVERT( XmNlabelString, GETMESSAGE(6, 10, "OK")),
1227 XmNleftAttachment, nbutton ?
1228 XmATTACH_POSITION : XmATTACH_FORM,
1229 XmNleftPosition, TIGHTNESS * nbutton,
1230 XmNrightAttachment, nbutton != (ntotalbuttons - 1) ?
1231 XmATTACH_POSITION : XmATTACH_FORM,
1232 XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1),
1235 XtAddCallback( FC_OkButton, XmNactivateCallback,
1236 (XtCallbackProc) activateCB_FC_OkButton,
1239 /* Creation of FC_CancelButton */
1240 FC_CancelButton = XtVaCreateManagedWidget( "FC_CancelButton",
1241 xmPushButtonGadgetClass,
1243 RES_CONVERT( XmNlabelString, GETMESSAGE(6, 12, "Cancel")),
1244 XmNleftAttachment, nbutton ?
1245 XmATTACH_POSITION : XmATTACH_FORM,
1246 XmNleftPosition, TIGHTNESS * nbutton,
1247 XmNrightAttachment, nbutton != (ntotalbuttons - 1) ?
1248 XmATTACH_POSITION : XmATTACH_FORM,
1249 XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1),
1252 XtAddCallback( FC_CancelButton, XmNactivateCallback,
1253 (XtCallbackProc) activateCB_FC_CancelButton,
1256 /* Creation of FC_ClearButton */
1257 FC_ClearButton = XtVaCreateManagedWidget( "FC_ClearButton",
1258 xmPushButtonGadgetClass,
1260 RES_CONVERT( XmNlabelString, GETMESSAGE(6, 14, "Clear")),
1261 XmNleftAttachment, nbutton ?
1262 XmATTACH_POSITION : XmATTACH_FORM,
1263 XmNleftPosition, TIGHTNESS * nbutton,
1264 XmNrightAttachment, nbutton != (ntotalbuttons - 1) ?
1265 XmATTACH_POSITION : XmATTACH_FORM,
1266 XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1),
1269 XtAddCallback( FC_ClearButton, XmNactivateCallback,
1270 (XtCallbackProc) activateCB_FC_ClearButton,
1273 /* Creation of FC_HelpButton */
1274 FC_HelpButton = XtVaCreateManagedWidget( "FC_HelpButton",
1275 xmPushButtonGadgetClass,
1277 RES_CONVERT( XmNlabelString, GETMESSAGE(6, 13, "Help")),
1278 XmNuserData, FileCharacteristics,
1279 XmNleftAttachment, nbutton ?
1280 XmATTACH_POSITION : XmATTACH_FORM,
1281 XmNleftPosition, TIGHTNESS * nbutton,
1282 XmNrightAttachment, nbutton != (ntotalbuttons - 1) ?
1283 XmATTACH_POSITION : XmATTACH_FORM,
1284 XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1),
1287 XtAddCallback( FC_HelpButton, XmNactivateCallback,
1288 (XtCallbackProc) helpCB_general,
1289 (XtPointer) HELP_FILECHAR );
1291 XtVaSetValues(FileCharacteristics,
1292 XmNcancelButton, FC_CancelButton,
1293 XmNdefaultButton, FC_OkButton,
1294 XmNinitialFocus, FC_NameOrPathText,
1297 XtAddCallback( FileCharacteristics, XmNdestroyCallback,
1298 (XtCallbackProc) UxDestroyContextCB,
1302 return ( FC_BigForm );
1304 return ( FileCharacteristics );
1308 /*******************************************************************************
1309 The following is the 'Interface function' which is the
1310 external entry point for creating this interface.
1311 This function should be called from your application or from
1312 a callback function.
1313 *******************************************************************************/
1315 Widget create_FileCharacteristics( swidget _UxUxParent )
1318 Dimension dimHeight;
1321 Widget widScrolledWindow;
1324 rtrn = _Uxbuild_FileCharacteristics();
1327 XtRealizeWidget(rtrn);
1328 XtVaGetValues (FileCharacteristics,
1329 XmNheight, &dimHeight,
1330 XmNwidth, &dimWidth,
1332 XtVaGetValues (rtrn,
1333 XmNuserData, &widScrolledWindow,
1335 XtVaGetValues (widScrolledWindow,
1336 XmNverticalScrollBar, &widTmp,
1338 XtVaGetValues (widTmp,
1341 dimHeight += dimTmp;
1344 XtVaSetValues (rtrn,
1345 XmNheight, dimHeight,
1353 /******************************************************************************/
1355 /* init_FileCharacteristics_dialog_fields */
1357 /* INPUT: FiletypeData * - pointer to FiletypeData structure */
1360 /******************************************************************************/
1361 void init_FileCharacteristics_dialog_fields(FiletypeData *pFtD)
1363 char buffer[MAXBUFSIZE];
1364 char *pszPerms = (char *)NULL;
1366 /************************************************************************/
1367 /* Initialize name pattern. */
1368 /************************************************************************/
1369 if (pFtD->pszPattern) {
1370 /*XmToggleButtonSetState(FC_NameOrPathToggle, TRUE);*/
1371 XmToggleButtonGadgetSetState(FC_NameOrPathToggle, TRUE, TRUE);
1372 PutWidgetTextString(FC_NameOrPathText, pFtD->pszPattern);
1374 /*XmToggleButtonSetState(FC_NameOrPathToggle, FALSE);*/
1375 XmToggleButtonGadgetSetState(FC_NameOrPathToggle, FALSE, TRUE);
1378 /************************************************************************/
1379 /* Initialize permission pattern. */
1380 /************************************************************************/
1381 if (pFtD->pszPermissions) {
1382 if (strstr(pFtD->pszPermissions, "!d")) {
1383 XmToggleButtonGadgetSetState(FC_FileToggle, TRUE, TRUE);
1385 XmToggleButtonGadgetSetState(FC_DirectoryToggle, TRUE, TRUE);
1387 pszPerms = strchr(pFtD->pszPermissions, 'd');
1391 pszPerms = (char *)NULL;
1397 XmToggleButtonGadgetSetState(FC_PermissionToggle, TRUE, TRUE);
1399 /******************************************************************/
1400 /* Initialize Read permission */
1401 /******************************************************************/
1402 if (strstr(pFtD->pszPermissions, "!r")) {
1403 XmToggleButtonGadgetSetState(FC_ReadOffToggle, TRUE, TRUE);
1405 if (strstr(pFtD->pszPermissions, "r")) {
1406 XmToggleButtonGadgetSetState(FC_ReadOnToggle, TRUE, TRUE);
1408 XmToggleButtonGadgetSetState(FC_ReadEitherToggle, TRUE, TRUE);
1411 /******************************************************************/
1412 /* Initialize Write permission */
1413 /******************************************************************/
1414 if (strstr(pFtD->pszPermissions, "!w")) {
1415 XmToggleButtonGadgetSetState(FC_WriteOffToggle, TRUE, TRUE);
1417 if (strstr(pFtD->pszPermissions, "w")) {
1418 XmToggleButtonGadgetSetState(FC_WriteOnToggle, TRUE, TRUE);
1420 XmToggleButtonGadgetSetState(FC_WriteEitherToggle, TRUE, TRUE);
1423 /******************************************************************/
1424 /* Initialize Execute permission */
1425 /******************************************************************/
1426 if (strstr(pFtD->pszPermissions, "!x")) {
1427 XmToggleButtonGadgetSetState(FC_ExecuteOffToggle, TRUE, TRUE);
1429 if (strstr(pFtD->pszPermissions, "x")) {
1430 XmToggleButtonGadgetSetState(FC_ExecuteOnToggle, TRUE, TRUE);
1432 XmToggleButtonGadgetSetState(FC_ExecuteEitherToggle, TRUE, TRUE);
1437 XmToggleButtonGadgetSetState(FC_PermissionToggle, FALSE, TRUE);
1440 /************************************************************************/
1441 /* Initialize contents pattern. */
1442 /************************************************************************/
1443 if (pFtD->pszContents) {
1444 XmToggleButtonGadgetSetState(FC_ContentsToggle, TRUE, TRUE);
1445 /*XmToggleButtonSetState(FC_ContentsToggle, TRUE);*/
1446 PutWidgetTextString(FC_ContentsPatternText, pFtD->pszContents);
1448 if (pFtD->fsFlags & CA_FT_CNTSTRING)
1449 XmToggleButtonGadgetSetState(FC_StringToggle, TRUE, TRUE);
1450 else if (pFtD->fsFlags & CA_FT_CNTBYTE)
1451 XmToggleButtonGadgetSetState(FC_ByteToggle, TRUE, TRUE);
1452 else if (pFtD->fsFlags & CA_FT_CNTSHORT)
1453 XmToggleButtonGadgetSetState(FC_ShortToggle, TRUE, TRUE);
1454 else if (pFtD->fsFlags & CA_FT_CNTLONG)
1455 XmToggleButtonGadgetSetState(FC_LongToggle, TRUE, TRUE);
1457 sprintf(buffer, "%d", pFtD->sStart);
1458 PutWidgetTextString(FC_StartByteTextField,buffer);
1460 sprintf(buffer, "%d", pFtD->sEnd);
1461 PutWidgetTextString(FC_EndByteTextField, buffer);
1464 XmToggleButtonGadgetSetState(FC_ContentsToggle, FALSE, TRUE);
1465 /*XmToggleButtonSetState(FC_ContentsToggle, FALSE);*/
1470 /******************************************************************************/
1472 /* clear_FileCharacteristics_dialog_fields */
1474 /* INPUT: FiletypeData * - pointer to FiletypeData structure */
1477 /******************************************************************************/
1478 void clear_FileCharacteristics_dialog_fields(void)
1480 /************************************************************************/
1481 /* Clear Files/Directories - set to default */
1482 /************************************************************************/
1483 XmToggleButtonGadgetSetState(FC_FileToggle, TRUE, TRUE);
1485 /************************************************************************/
1486 /* Clear name pattern. */
1487 /************************************************************************/
1488 XmToggleButtonGadgetSetState(FC_NameOrPathToggle, FALSE, TRUE);
1489 clear_text_field(FC_NameOrPathText);
1491 /************************************************************************/
1492 /* Clear permission pattern - set to default */
1493 /************************************************************************/
1494 XmToggleButtonGadgetSetState(FC_PermissionToggle, FALSE, TRUE);
1495 XmToggleButtonGadgetSetState(FC_ReadOnToggle, FALSE, TRUE);
1496 XmToggleButtonGadgetSetState(FC_WriteOnToggle, FALSE, TRUE);
1497 XmToggleButtonGadgetSetState(FC_ExecuteOnToggle, FALSE, TRUE);
1499 XmToggleButtonGadgetSetState(FC_ReadOffToggle, FALSE, TRUE);
1500 XmToggleButtonGadgetSetState(FC_WriteOffToggle, FALSE, TRUE);
1501 XmToggleButtonGadgetSetState(FC_ExecuteOffToggle, FALSE, TRUE);
1503 XmToggleButtonGadgetSetState(FC_ReadEitherToggle, TRUE, TRUE);
1504 XmToggleButtonGadgetSetState(FC_WriteEitherToggle, TRUE, TRUE);
1505 XmToggleButtonGadgetSetState(FC_ExecuteEitherToggle, TRUE, TRUE);
1507 /************************************************************************/
1508 /* Clear contents pattern - set to default */
1509 /************************************************************************/
1510 XmToggleButtonGadgetSetState(FC_ContentsToggle, FALSE, TRUE);
1511 clear_text_field(FC_ContentsPatternText);
1512 XmToggleButtonGadgetSetState(FC_StringToggle, TRUE, TRUE);
1513 clear_text_field(FC_StartByteTextField);
1515 clear_text_field(FC_EndByteTextField);
1521 /******************************************************************************/
1523 /* FileCharCheckFields */
1526 /* OUTPUT: FALSE - no errors found */
1527 /* TRUE - found errors */
1529 /******************************************************************************/
1530 Boolean FileCharCheckFields(void)
1532 char *ptr = (char *)NULL;
1533 Boolean bError = FALSE;
1534 char *msgPtr, *errPtr;
1536 /**************************************************************************/
1537 /* Check to make sure at least one characteristic is selected. */
1538 /**************************************************************************/
1540 if ( !(XmToggleButtonGadgetGetState(FC_NameOrPathToggle)) &&
1541 !(XmToggleButtonGadgetGetState(FC_PermissionToggle)) &&
1542 !(XmToggleButtonGadgetGetState(FC_ContentsToggle)) ) {
1543 msgPtr = GETMESSAGE(10, 30,
1544 "An identifying characteristic has not been selected.\n\
1545 Select one or more of the characteristics\n\
1546 (Name Pattern, Permissions Pattern, or Contents).");
1547 errPtr = XtNewString(msgPtr);
1548 display_error_message(FileCharacteristics, errPtr);
1550 XmProcessTraversal(FC_NameOrPathText, XmTRAVERSE_CURRENT);
1555 /**************************************************************************/
1556 /* Check if name pattern is selected. If so must have a name pattern. */
1557 /**************************************************************************/
1559 if (XmToggleButtonGadgetGetState(FC_NameOrPathToggle)) {
1561 GetWidgetTextString(FC_NameOrPathText, &ptr);
1563 printf("Name Pattern = '%s'\n", ptr);
1566 msgPtr = GETMESSAGE(10, 10, "Name Pattern is missing.\n\
1567 If Name Pattern is selected, a name pattern\n\
1569 errPtr = XtNewString(msgPtr);
1570 display_error_message(FileCharacteristics, errPtr);
1572 XmProcessTraversal(FC_NameOrPathText, XmTRAVERSE_CURRENT);
1580 /**************************************************************************/
1581 /* Check if contents is selected. If so must have a contents pattern. */
1582 /**************************************************************************/
1584 if (XmToggleButtonGadgetGetState(FC_ContentsToggle)) {
1586 GetWidgetTextString(FC_ContentsPatternText, &ptr);
1588 printf("Name Pattern = '%s'\n", ptr);
1591 msgPtr = GETMESSAGE(10, 20, "Contents Pattern is missing.\n\
1592 If Contents is selected, then the Pattern field\n\
1593 under Contents must be filled in.");
1594 errPtr = XtNewString(msgPtr);
1595 display_error_message(FileCharacteristics, errPtr);
1600 /*****************************************************************/
1601 /* Now check to make sure there is a start byte value. */
1602 /*****************************************************************/
1604 GetWidgetTextString(FC_StartByteTextField, &ptr);
1606 msgPtr = GETMESSAGE(10, 25, "Start byte value is missing.\n\
1607 If Contents is selected, then a number must be\n\
1608 entered in the 'Start Byte' field.");
1609 errPtr = XtNewString(msgPtr);
1610 display_error_message(FileCharacteristics, errPtr);
1623 /*******************************************************************************
1625 *******************************************************************************/