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 libraries 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 *******************************************************************************/
37 #include <Xm/MwmUtil.h>
38 #include <Xm/DialogS.h>
39 #include <Xm/MenuShell.h>
40 #include <Xm/RowColumn.h>
42 #include <Xm/ToggleBG.h>
46 #include <Xm/PushBG.h>
48 #include <Xm/ScrolledW.h>
55 #include "ErrorDialog.h"
57 #define CONTEXT_MACRO_ACCESS 1
58 #include "FileCharacteristics.h"
59 #undef CONTEXT_MACRO_ACCESS
61 /*******************************************************************************
62 Includes, Defines, and Global variables from the Declarations Editor:
63 *******************************************************************************/
68 Widget FC_ReadOnToggle, FC_ReadOffToggle, FC_ReadEitherToggle;
69 Widget FC_WriteOnToggle, FC_WriteOffToggle, FC_WriteEitherToggle;
70 Widget FC_ExecuteOnToggle, FC_ExecuteOffToggle, FC_ExecuteEitherToggle;
71 Widget FC_PermissionForm;
74 Widget FC_ExecuteLabel;
76 /******************************************************************************/
78 /* GetPermissionsPattern */
81 /* OUTPUT: permissions pattern in database format */
83 /******************************************************************************/
84 void GetPermissionsPattern(char **ppszPermPattern)
87 if (*ppszPermPattern) {
88 XtFree(*ppszPermPattern);
89 *ppszPermPattern = (char *)NULL;
92 *ppszPermPattern = (char *)XtMalloc(20);
93 memset(*ppszPermPattern, 0, 20);
95 if (XmToggleButtonGadgetGetState(FC_DirectoryToggle)) {
96 strcat(*ppszPermPattern, "d");
98 strcat(*ppszPermPattern, "!d");
101 if (XmToggleButtonGadgetGetState(FC_PermissionToggle)) {
102 /******************************************************************/
104 /******************************************************************/
105 if (XmToggleButtonGadgetGetState(FC_ReadOnToggle)) {
106 strcat(*ppszPermPattern, "&r");
108 if (XmToggleButtonGadgetGetState(FC_ReadOffToggle)) {
109 strcat(*ppszPermPattern, "&!r");
112 /******************************************************************/
113 /* Get Write state */
114 /******************************************************************/
115 if (XmToggleButtonGadgetGetState(FC_WriteOnToggle)) {
116 strcat(*ppszPermPattern, "&w");
118 if (XmToggleButtonGadgetGetState(FC_WriteOffToggle)) {
119 strcat(*ppszPermPattern, "&!w");
122 /******************************************************************/
123 /* Get Execute state */
124 /******************************************************************/
125 if (XmToggleButtonGadgetGetState(FC_ExecuteOnToggle)) {
126 strcat(*ppszPermPattern, "&x");
128 if (XmToggleButtonGadgetGetState(FC_ExecuteOffToggle)) {
129 strcat(*ppszPermPattern, "&!x");
135 if (XmToggleButtonGadgetGetState(FC_PermissionToggle)) {
136 if (XmToggleButtonGadgetGetState(FC_ReadToggle)) {
137 strcat(*ppszPermPattern, "&r");
139 strcat(*ppszPermPattern, "&!r");
141 if (XmToggleButtonGadgetGetState(FC_WriteToggle)) {
142 strcat(*ppszPermPattern, "&w");
144 strcat(*ppszPermPattern, "&!w");
146 if (XmToggleButtonGadgetGetState(FC_ExecuteToggle)) {
147 strcat(*ppszPermPattern, "&x");
149 strcat(*ppszPermPattern, "&!x");
155 /******************************************************************************/
157 /* GetContentsType */
160 /* OUTPUT: contents type selected */
162 /******************************************************************************/
163 ushort GetContentsType(void)
166 if (XmToggleButtonGadgetGetState(FC_StringToggle)) {
167 return((ushort)CA_FT_CNTSTRING);
168 } else if (XmToggleButtonGadgetGetState(FC_ByteToggle)) {
169 return((ushort)CA_FT_CNTBYTE);
170 } else if (XmToggleButtonGadgetGetState(FC_ShortToggle)) {
171 return((ushort)CA_FT_CNTSHORT);
172 } else if (XmToggleButtonGadgetGetState(FC_LongToggle)) {
173 return((ushort)CA_FT_CNTLONG);
178 /******************************************************************************/
180 /* Save_FileChar_Info */
185 /******************************************************************************/
186 void Save_FileChar_Info(void)
190 char *ptr = (char *)NULL;
193 /**************************************************************************/
194 /* Clear file characteristics text widget on the AddFiletype dialog. */
195 /**************************************************************************/
196 XmTextSetString(AF_IdCharacteristicsText, "");
198 /**************************************************************************/
199 /* Get pointer to FiletypeData structure. */
200 /* Also, update the filetypes listbox on the AddFiletype window. */
201 /**************************************************************************/
202 XtVaGetValues(FileCharacteristics,
206 /**************************************************************************/
207 /* Get Name Pattern Info */
208 /**************************************************************************/
209 if (XmToggleButtonGadgetGetState(FC_NameOrPathToggle)) {
210 GetWidgetTextString(FC_NameOrPathText, &(pFtD->pszPattern));
212 printf("Pattern is '%s'\n", pFtD->pszPattern);
215 if (pFtD->pszPattern) {
216 XtFree(pFtD->pszPattern);
217 pFtD->pszPattern = (char *)NULL;
221 /**************************************************************************/
222 /* Get Permission Info */
223 /**************************************************************************/
224 GetPermissionsPattern(&(pFtD->pszPermissions));
226 /**************************************************************************/
227 /* Get Content Pattern Info */
228 /**************************************************************************/
229 if (XmToggleButtonGadgetGetState(FC_ContentsToggle)) {
231 /************************************************************************/
232 /* Save data in structure. */
233 /************************************************************************/
234 GetWidgetTextString(FC_ContentsPatternText, &(pFtD->pszContents));
236 GetWidgetTextString(FC_StartByteTextField, &ptr);
238 pFtD->sStart = atoi(ptr);
243 GetWidgetTextString(FC_EndByteTextField, &ptr);
245 pFtD->sEnd = atoi(ptr);
249 pFtD->fsFlags = GetContentsType();
252 if (pFtD->pszContents) {
253 XtFree(pFtD->pszContents);
254 pFtD->pszContents = (char *)NULL;
259 /**************************************************************************/
260 /* Parse the ID fields in the FiletypeData structure and create a text */
261 /* string for the Identifying Characteristics text field in AddFiletype. */
262 /**************************************************************************/
263 ParseAndUpdateID(pFtD);
267 /******************************************************************************/
269 /* ParseAndUpdateID */
274 /******************************************************************************/
275 void ParseAndUpdateID(FiletypeData *pFtD)
278 char *ptr = (char *)NULL;
281 /**************************************************************************/
282 /* Init size variable. This will be used to indicate size of buffer to */
283 /* allocate to hold text string that will be displayed in FC text widget. */
284 /**************************************************************************/
287 /**************************************************************************/
288 /* Get Name Pattern Info */
289 /**************************************************************************/
290 if (pFtD->pszPattern) {
291 /*size += strlen("Name: ");*/
292 size += strlen(GETMESSAGE(9, 20, "Name Pattern:")) + 1; /* 1 for space */
293 size += strlen(pFtD->pszPattern);
294 size += 1; /* For newline character */
297 /**************************************************************************/
298 /* Get Permission Info */
299 /**************************************************************************/
300 if (pFtD->pszPermissions) {
301 size += strlen(GETMESSAGE(9, 21, "Permission Pattern:")) + 1; /* space */
302 size += strlen(pFtD->pszPermissions);
303 size += 1; /* For newline character */
306 /**************************************************************************/
307 /* Get Content Pattern Info */
308 /**************************************************************************/
309 if (pFtD->pszContents) {
310 size += strlen(GETMESSAGE(9, 28, "Contents:")) + 1; /* 1 for space */
311 size += strlen(pFtD->pszContents);
312 size += 1; /* For newline character */
315 /**************************************************************************/
316 /* Allocate buffer and fill with ID info. */
317 /**************************************************************************/
319 ptr = XtMalloc(size);
321 memset(ptr, 0, size);
322 if (pFtD->pszPattern) {
323 strcat(ptr, GETMESSAGE(9, 20, "Name Pattern:"));
325 strcat(ptr, pFtD->pszPattern);
328 if (pFtD->pszPermissions) {
329 strcat(ptr, GETMESSAGE(9, 21, "Permission Pattern:"));
331 strcat(ptr, pFtD->pszPermissions);
334 if (pFtD->pszContents) {
335 strcat(ptr, GETMESSAGE(9, 28, "Contents:"));
337 strcat(ptr, pFtD->pszContents);
340 XmTextSetString(AF_IdCharacteristicsText, ptr);
346 /*****************************************************************************/
351 /*****************************************************************************/
352 void CalculateAND(void)
354 XtArgVal /* Boolean */ set1, set2, set3, set4;
357 XtVaGetValues(FC_NameOrPathToggle, XmNset, &set1, NULL);
358 XtVaGetValues(FC_PermissionToggle, XmNset, &set2, NULL);
359 XtVaGetValues(FC_ContentsToggle, XmNset, &set3, NULL);
360 XtSetSensitive(FC_AndLabel1, False);
361 XtSetSensitive(FC_AndLabel2, False);
363 cnt = (int)set1 + (int)set2 + (int)set3;
364 if (set1 && (set2 || set3))
365 XtSetSensitive(FC_AndLabel1, True);
367 XtSetSensitive(FC_AndLabel2, True);
370 /*******************************************************************************
371 The following are callback functions.
372 *******************************************************************************/
374 static void activateCB_FC_OkButton( Widget UxWidget,
375 XtPointer UxClientData,
376 XtPointer UxCallbackArg)
379 if (!FileCharCheckFields()) {
380 Save_FileChar_Info();
381 UxPopdownInterface(FileCharacteristics);
385 static void activateCB_FC_ClearButton(Widget UxWidget,
386 XtPointer UxClientData,
387 XtPointer UxCallbackArg)
390 /* Clear_FileChar_Info(); */
391 clear_FileCharacteristics_dialog_fields();
394 static void activateCB_FC_CancelButton(Widget UxWidget,
395 XtPointer UxClientData,
396 XtPointer UxCallbackArg)
399 _UxCFileCharacteristics *UxSaveCtx, *UxContext;
401 UxSaveCtx = UxFileCharacteristicsContext;
402 UxFileCharacteristicsContext = UxContext =
403 (_UxCFileCharacteristics *) UxGetContext( UxWidget );
406 UxPopdownInterface(FileCharacteristics);
409 UxFileCharacteristicsContext = UxSaveCtx;
413 static void valueChangedCB_FC_PermissionToggle(Widget UxWidget,
414 XtPointer UxClientData,
415 XtPointer UxCallbackArg)
417 XtArgVal /* Boolean */ set;
419 XtVaGetValues(UxWidget, XmNset, &set, NULL);
420 XtSetSensitive(FC_PermissionLabel, set);
421 XtSetSensitive(FC_PermissionForm, set);
423 XtSetSensitive(FC_ReadLabel, set);
424 XtSetSensitive(FC_WriteLabel, set);
425 XtSetSensitive(FC_ExecuteLabel, set);
427 XtSetSensitive(FC_ReadOnToggle, set);
428 XtSetSensitive(FC_WriteOnToggle, set);
429 XtSetSensitive(FC_ExecuteOnToggle, set);
431 XtSetSensitive(FC_ReadOffToggle, set);
432 XtSetSensitive(FC_WriteOffToggle, set);
433 XtSetSensitive(FC_ExecuteOffToggle, set);
435 XtSetSensitive(FC_ReadEitherToggle, set);
436 XtSetSensitive(FC_WriteEitherToggle, set);
437 XtSetSensitive(FC_ExecuteEitherToggle, set);
443 static void armCB_FC_StringToggle(Widget UxWidget,
444 XtPointer UxClientData,
445 XtPointe`r UxCallbackArg)
450 static void armCB_FC_ByteToggle(Widget UxWidget,
451 XtPointer UxClientData,
452 XtPointer UxCallbackArg)
457 static void armCB_FC_ShortToggle(Widget UxWidget,
458 XtPointer UxClientData,
459 XtPointer UxCallbackArg)
464 static void armCB_FC_LongToggle( Widget UxWidget,
465 XtPointer UxClientData,
466 XtPointer UxCallbackArg)
472 static void valueChangedCB_FC_ContentsToggle( Widget UxWidget,
473 XtPointer UxClientData,
474 XtPointer UxCallbackArg)
476 XtArgVal /* Boolean */ set;
478 XtVaGetValues(UxWidget, XmNset, &set, NULL);
479 XtSetSensitive(FC_ContentsLabel, set);
480 XtSetSensitive(FC_ContentsBox, set);
482 XmProcessTraversal(FC_ContentsPatternText, XmTRAVERSE_CURRENT);
487 static void valueChangedCB_FC_NameOrPathToggle(Widget UxWidget,
488 XtPointer UxClientData,
489 XtPointer UxCallbackArg)
492 XtArgVal /* Boolean */ set;
494 XtVaGetValues(UxWidget, XmNset, &set, NULL);
495 XtSetSensitive(FC_NamePatternLabel, set);
496 XtSetSensitive(FC_NameOrPathText, set);
498 XmProcessTraversal(FC_NameOrPathText, XmTRAVERSE_CURRENT);
503 /*******************************************************************************
504 The 'build_' function creates all the widgets
505 using the resource values specified in the Property Editor.
506 *******************************************************************************/
508 static Widget _Uxbuild_FileCharacteristics(void)
511 Widget FC_ActionAreaForm;
513 Widget FC_ClearButton;
514 Widget FC_CancelButton;
515 Widget FC_HelpButton;
516 Widget FC_MainLabel1;
517 Widget FC_MainLabel2;
518 Widget FC_TypeFileRowColumn;
520 Widget FC_ReadRowColumn;
521 Widget FC_WriteRowColumn;
522 Widget FC_ExecuteRowColumn;
523 int ntotalbuttons = 4;
526 Widget FC_ScrolledWindow;
528 char *dialog_title, *pre, *suf;
531 /* Creation of FileCharacteristics */
533 _UxParent = UxParent;
534 if ( _UxParent == NULL )
536 _UxParent = UxTopLevel;
540 _UxParent = UxTopLevel;
542 pre = GETMESSAGE(3, 10, "Create Action");
543 suf = GETMESSAGE(9, 10, "Identifying Characteristics");
544 dialog_title = XtMalloc(strlen(pre) + strlen(suf) + 4);
545 sprintf(dialog_title, "%s - %s", pre, suf);
548 _UxParent = XtVaCreatePopupShell( "FileCharacteristics_shell",
549 xmDialogShellWidgetClass, _UxParent,
554 XmNshellUnitType, XmPIXELS,
555 XmNtitle, dialog_title,
557 FC_BigForm = XtVaCreateWidget( "FC_BigForm",
560 XmNunitType, XmPIXELS,
561 XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL,
562 RES_CONVERT( XmNdialogTitle, dialog_title ),
563 XmNautoUnmanage, FALSE,
564 XmNrubberPositioning, FALSE,
566 FC_ScrolledWindow = XtVaCreateManagedWidget( "FC_ScrolledWindow",
567 xmScrolledWindowWidgetClass,
569 XmNscrollingPolicy, XmAUTOMATIC,
570 XmNleftAttachment, XmATTACH_FORM,
571 XmNrightAttachment, XmATTACH_FORM,
572 XmNbottomAttachment, XmATTACH_FORM,
573 XmNtopAttachment, XmATTACH_FORM,
575 XtVaSetValues(FC_BigForm, XmNuserData, FC_ScrolledWindow, NULL);
577 FileCharacteristics = XtVaCreateManagedWidget( "FileCharacteristics",
582 _UxParent = XtVaCreatePopupShell( "FileCharacteristics_shell",
583 xmDialogShellWidgetClass, _UxParent,
586 XmNmwmDecorations, MWM_DECOR_ALL | MWM_DECOR_RESIZEH,
589 XmNshellUnitType, XmPIXELS,
590 XmNtitle, dialog_title,
592 FileCharacteristics = XtVaCreateWidget( "FileCharacteristics",
595 XmNunitType, XmPIXELS,
596 XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL,
597 RES_CONVERT( XmNdialogTitle, dialog_title ),
598 XmNautoUnmanage, FALSE,
599 XmNrubberPositioning, FALSE,
602 XtFree(dialog_title);
603 XtAddCallback( FileCharacteristics, XmNhelpCallback,
604 (XtCallbackProc) helpCB_general,
605 (XtPointer) HELP_FILECHAR );
607 /* Creation of FC_MainLabel1 */
608 FC_MainLabel1 = XtVaCreateManagedWidget( "FC_MainLabel1",
611 XmNalignment, XmALIGNMENT_BEGINNING,
612 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 11, "Include All")),
614 XmNleftAttachment, XmATTACH_FORM,
615 XmNrightAttachment, XmATTACH_FORM,
617 XmNtopAttachment, XmATTACH_FORM,
620 /* Creation of FC_TypeFileRowColumn */
621 FC_TypeFileRowColumn = XtVaCreateManagedWidget( "FC_TypeFileRowColumn",
622 xmRowColumnWidgetClass,
624 XmNradioBehavior, TRUE,
627 XmNorientation, XmVERTICAL,
628 XmNpacking, XmPACK_COLUMN,
629 XmNshadowThickness, 1,
630 XmNleftWidget, FC_MainLabel1,
631 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
633 XmNtopWidget, FC_MainLabel1,
634 XmNtopAttachment, XmATTACH_WIDGET,
637 /* Creation of FC_FileToggle */
638 FC_FileToggle = XtVaCreateManagedWidget( "FC_FileToggle",
639 xmToggleButtonGadgetClass,
640 FC_TypeFileRowColumn,
641 XmNindicatorType, XmONE_OF_MANY,
642 XmNindicatorSize, 17,
643 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 12, "Files")),
647 /* Creation of FC_DirectoryToggle */
648 FC_DirectoryToggle = XtVaCreateManagedWidget( "FC_DirectoryToggle",
649 xmToggleButtonGadgetClass,
650 FC_TypeFileRowColumn,
651 XmNindicatorType, XmONE_OF_MANY,
652 XmNindicatorSize, 17,
653 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 13, "Folders")),
656 /* Creation of FC_MainLabel2 */
657 FC_MainLabel2 = XtVaCreateManagedWidget( "FC_MainLabel2",
660 XmNalignment, XmALIGNMENT_BEGINNING,
661 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 14, "That Match the Following:")),
663 XmNleftAttachment, XmATTACH_FORM,
664 XmNrightAttachment, XmATTACH_FORM,
666 XmNtopWidget, FC_TypeFileRowColumn,
667 XmNtopAttachment, XmATTACH_WIDGET,
670 /* Creation of FC_NamePatternLabel */
671 FC_NamePatternLabel = XtVaCreateManagedWidget( "FC_NamePatternLabel",
674 XmNalignment, XmALIGNMENT_BEGINNING,
675 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 20, "Name Pattern:")),
676 XmNleftWidget, FC_MainLabel2,
677 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
678 XmNrightAttachment, XmATTACH_NONE,
680 XmNtopWidget, FC_MainLabel2,
681 XmNtopAttachment, XmATTACH_WIDGET,
684 /* Creation of FC_NameOrPathText */
685 FC_NameOrPathText = XtVaCreateManagedWidget( "FC_NameOrPathText",
686 xmTextFieldWidgetClass,
690 XmNleftWidget, FC_NamePatternLabel,
691 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
693 XmNtopWidget, FC_NamePatternLabel,
694 XmNtopAttachment, XmATTACH_WIDGET,
697 /* Creation of FC_AndLabel1 */
698 FC_AndLabel1 = XtVaCreateManagedWidget( "FC_AndLabel1",
703 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 27, "AND")),
706 XmNrightAttachment, XmATTACH_FORM,
708 XmNtopWidget, FC_NamePatternLabel,
709 XmNtopAttachment, XmATTACH_WIDGET,
712 XtVaSetValues(FC_NameOrPathText,
714 XmNrightWidget, FC_AndLabel1,
715 XmNrightAttachment, XmATTACH_WIDGET,
719 /* Creation of FC_NameOrPathToggle */
720 FC_NameOrPathToggle = XtVaCreateManagedWidget( "FC_NameOrPathToggle",
721 xmToggleButtonGadgetClass,
723 RES_CONVERT( XmNlabelString, "" ),
725 XmNnavigationType, XmTAB_GROUP,
726 XmNindicatorSize, 20,
727 XmNleftAttachment, XmATTACH_NONE,
729 XmNrightWidget, FC_NameOrPathText,
730 XmNrightAttachment, XmATTACH_WIDGET,
731 XmNtopWidget, FC_NameOrPathText,
732 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
733 XmNbottomAttachment, XmATTACH_NONE,
735 XtAddCallback( FC_NameOrPathToggle, XmNvalueChangedCallback,
736 (XtCallbackProc) valueChangedCB_FC_NameOrPathToggle,
739 /******************************************************************/
741 /* Permission Area creation <<<<<<<>>>>>>>> */
743 /******************************************************************/
744 /* Creation of FC_PermissionLabel */
745 FC_PermissionLabel = XtVaCreateManagedWidget( "FC_PermissionLabel",
750 XmNalignment, XmALIGNMENT_BEGINNING,
751 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 21, "Permission Pattern:")),
753 XmNleftWidget, FC_NameOrPathText,
754 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
755 XmNrightAttachment, XmATTACH_NONE,
757 XmNtopWidget, FC_NameOrPathText,
758 XmNtopAttachment, XmATTACH_WIDGET,
761 FC_PermissionForm = XtVaCreateManagedWidget( "FC_PermissionForm",
764 XmNresizePolicy, XmRESIZE_NONE,
767 XmNleftWidget, FC_PermissionLabel,
768 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
770 XmNtopWidget, FC_PermissionLabel,
771 XmNtopAttachment, XmATTACH_WIDGET,
774 /******************************************************************/
775 /* Creation of FC_ReadRowColumn */
777 /* This is the read row column - on, off, either radio buttons */
778 /******************************************************************/
779 FC_ReadRowColumn = XtVaCreateManagedWidget( "FC_ReadRowColumn",
780 xmRowColumnWidgetClass,
782 XmNradioBehavior, TRUE,
784 XmNorientation, XmVERTICAL,
785 XmNpacking, XmPACK_COLUMN,
786 XmNshadowThickness, 1,
788 XmNrightAttachment, XmATTACH_FORM,
790 XmNtopAttachment, XmATTACH_FORM,
793 /* Creation of FC_ReadOnToggle */
794 FC_ReadOnToggle = XtVaCreateManagedWidget( "FC_ReadOnToggle",
795 xmToggleButtonGadgetClass,
797 XmNindicatorType, XmONE_OF_MANY,
798 XmNindicatorSize, 17,
799 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 43, "On")),
803 /* Creation of FC_ReadOffToggle */
804 FC_ReadOffToggle = XtVaCreateManagedWidget( "FC_ReadOffToggle",
805 xmToggleButtonGadgetClass,
807 XmNindicatorType, XmONE_OF_MANY,
808 XmNindicatorSize, 17,
809 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 44, "Off")),
813 /* Creation of FC_ReadEitherToggle */
814 FC_ReadEitherToggle = XtVaCreateManagedWidget( "FC_ReadEitherToggle",
815 xmToggleButtonGadgetClass,
817 XmNindicatorType, XmONE_OF_MANY,
818 XmNindicatorSize, 17,
819 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 45, "Either")),
823 /******************************************************************/
824 /* Creation of FC_WriteRowColumn */
826 /* This is the write row column - on, off, either radio buttons */
827 /******************************************************************/
828 FC_WriteRowColumn = XtVaCreateManagedWidget( "FC_WriteRowColumn",
829 xmRowColumnWidgetClass,
831 XmNradioBehavior, TRUE,
833 XmNorientation, XmVERTICAL,
834 XmNpacking, XmPACK_COLUMN,
835 XmNshadowThickness, 1,
837 XmNrightAttachment, XmATTACH_FORM,
838 XmNtopWidget, FC_ReadRowColumn,
839 XmNtopAttachment, XmATTACH_WIDGET,
842 /* Creation of FC_WriteOnToggle */
843 FC_WriteOnToggle = XtVaCreateManagedWidget( "FC_WriteOnToggle",
844 xmToggleButtonGadgetClass,
846 XmNindicatorType, XmONE_OF_MANY,
847 XmNindicatorSize, 17,
848 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 43, "On")),
852 /* Creation of FC_WriteOffToggle */
853 FC_WriteOffToggle = XtVaCreateManagedWidget( "FC_WriteOffToggle",
854 xmToggleButtonGadgetClass,
856 XmNindicatorType, XmONE_OF_MANY,
857 XmNindicatorSize, 17,
858 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 44, "Off")),
862 /* Creation of FC_WriteEitherToggle */
863 FC_WriteEitherToggle = XtVaCreateManagedWidget( "FC_WriteEitherToggle",
864 xmToggleButtonGadgetClass,
866 XmNindicatorType, XmONE_OF_MANY,
867 XmNindicatorSize, 17,
868 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 45, "Either")),
872 /******************************************************************/
873 /* Creation of FC_ExecuteRowColumn */
875 /* This is the execute row column - on, off, either radio buttons */
876 /******************************************************************/
877 FC_ExecuteRowColumn = XtVaCreateManagedWidget( "FC_ExecuteRowColumn",
878 xmRowColumnWidgetClass,
880 XmNradioBehavior, TRUE,
882 XmNorientation, XmVERTICAL,
883 XmNpacking, XmPACK_COLUMN,
884 XmNshadowThickness, 1,
886 XmNrightAttachment, XmATTACH_FORM,
887 XmNtopWidget, FC_WriteRowColumn,
888 XmNtopAttachment, XmATTACH_WIDGET,
890 XmNbottomAttachment, XmATTACH_FORM,
893 /* Creation of FC_ExecuteOnToggle */
894 FC_ExecuteOnToggle = XtVaCreateManagedWidget( "FC_ExecuteOnToggle",
895 xmToggleButtonGadgetClass,
897 XmNindicatorType, XmONE_OF_MANY,
898 XmNindicatorSize, 17,
899 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 43, "On")),
903 /* Creation of FC_ExecuteOffToggle */
904 FC_ExecuteOffToggle = XtVaCreateManagedWidget( "FC_ExecuteOffToggle",
905 xmToggleButtonGadgetClass,
907 XmNindicatorType, XmONE_OF_MANY,
908 XmNindicatorSize, 17,
909 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 44, "Off")),
913 /* Creation of FC_ExecuteEitherToggle */
914 FC_ExecuteEitherToggle = XtVaCreateManagedWidget( "FC_ExecuteEitherToggle",
915 xmToggleButtonGadgetClass,
917 XmNindicatorType, XmONE_OF_MANY,
918 XmNindicatorSize, 17,
919 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 45, "Either")),
923 /******************************************************************/
924 /* Creation of Permission Labels */
925 /******************************************************************/
926 FC_ReadLabel = XtVaCreateManagedWidget( "FC_ReadLabel",
929 XmNalignment, XmALIGNMENT_BEGINNING,
930 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 40, "Read:")),
931 XmNrightWidget, FC_ReadRowColumn,
932 XmNrightAttachment, XmATTACH_WIDGET,
934 XmNleftAttachment, XmATTACH_FORM,
935 XmNtopWidget, FC_ReadRowColumn,
936 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
938 FC_WriteLabel = XtVaCreateManagedWidget( "FC_WriteLabel",
941 XmNalignment, XmALIGNMENT_BEGINNING,
942 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 41, "Write:")),
943 XmNrightWidget, FC_WriteRowColumn,
944 XmNrightAttachment, XmATTACH_WIDGET,
946 XmNleftAttachment, XmATTACH_FORM,
947 XmNtopWidget, FC_WriteRowColumn,
948 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
950 FC_ExecuteLabel = XtVaCreateManagedWidget( "FC_ExecuteLabel",
953 XmNalignment, XmALIGNMENT_BEGINNING,
954 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 42, "Execute:")),
955 XmNrightWidget, FC_ExecuteRowColumn,
956 XmNrightAttachment, XmATTACH_WIDGET,
958 XmNleftAttachment, XmATTACH_FORM,
959 XmNtopWidget, FC_ExecuteRowColumn,
960 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
963 /******************************************************************/
964 /* Creation of the AND label for permissions. */
965 /******************************************************************/
966 FC_AndLabel2 = XtVaCreateManagedWidget( "FC_AndLabel2",
971 XmNalignment, XmALIGNMENT_BEGINNING,
972 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 27, "AND")),
975 XmNrightAttachment, XmATTACH_FORM,
977 XmNtopWidget, FC_PermissionLabel,
978 XmNtopAttachment, XmATTACH_WIDGET,
981 XtVaSetValues(FC_PermissionForm,
983 XmNrightWidget, FC_AndLabel2,
984 XmNrightAttachment, XmATTACH_WIDGET,
988 /* Creation of FC_PermissionToggle */
989 FC_PermissionToggle = XtVaCreateManagedWidget( "FC_PermissionToggle",
990 xmToggleButtonGadgetClass,
992 RES_CONVERT( XmNlabelString, "" ),
993 XmNnavigationType, XmTAB_GROUP,
994 XmNindicatorSize, 20,
995 XmNleftAttachment, XmATTACH_NONE,
997 XmNrightWidget, FC_PermissionForm,
998 XmNrightAttachment, XmATTACH_WIDGET,
999 XmNtopWidget, FC_PermissionForm,
1000 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1001 XmNbottomAttachment, XmATTACH_NONE,
1003 XtAddCallback( FC_PermissionToggle, XmNvalueChangedCallback,
1004 (XtCallbackProc) valueChangedCB_FC_PermissionToggle,
1007 /* Creation of FC_ContentsLabel */
1008 FC_ContentsLabel = XtVaCreateManagedWidget( "FC_ContentsLabel",
1010 FileCharacteristics,
1011 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 28, "Contents:")),
1012 XmNsensitive, FALSE,
1013 XmNleftWidget, FC_PermissionForm,
1014 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1015 XmNrightAttachment, XmATTACH_NONE,
1017 XmNtopWidget, FC_PermissionForm,
1018 XmNtopAttachment, XmATTACH_WIDGET,
1021 /* Creation of FC_ContentsBox */
1022 FC_ContentsBox = XtVaCreateManagedWidget( "FC_ContentsBox",
1024 FileCharacteristics,
1025 XmNresizePolicy, XmRESIZE_NONE,
1027 XmNsensitive, FALSE,
1028 XmNleftWidget, FC_ContentsLabel,
1029 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1031 XmNrightAttachment, XmATTACH_FORM,
1033 XmNtopWidget, FC_ContentsLabel,
1034 XmNtopAttachment, XmATTACH_WIDGET,
1037 /* Creation of FC_ContentsToggle */
1038 FC_ContentsToggle = XtVaCreateManagedWidget( "FC_ContentsToggle",
1039 xmToggleButtonGadgetClass,
1040 FileCharacteristics,
1041 RES_CONVERT( XmNlabelString, "" ),
1042 XmNnavigationType, XmTAB_GROUP,
1043 XmNindicatorSize, 20,
1044 XmNleftAttachment, XmATTACH_NONE,
1046 XmNrightWidget, FC_ContentsBox,
1047 XmNrightAttachment, XmATTACH_WIDGET,
1048 XmNtopWidget, FC_ContentsBox,
1049 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1050 XmNbottomAttachment, XmATTACH_NONE,
1052 XtAddCallback( FC_ContentsToggle, XmNvalueChangedCallback,
1053 (XtCallbackProc) valueChangedCB_FC_ContentsToggle,
1056 /* Creation of FC_ContentsPatternLabel */
1057 FC_ContentsPatternLabel = XtVaCreateManagedWidget( "FC_ContentsPatternLabel",
1060 XmNalignment, XmALIGNMENT_BEGINNING,
1061 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 29, "Pattern:")),
1063 XmNleftAttachment, XmATTACH_FORM,
1064 XmNrightAttachment, XmATTACH_NONE,
1066 XmNtopAttachment, XmATTACH_FORM,
1069 /* Creation of FC_ContentsPatternText */
1070 FC_ContentsPatternText = XtVaCreateManagedWidget( "FC_ContentsPatternText",
1071 xmTextFieldWidgetClass,
1075 XmNleftWidget, FC_ContentsPatternLabel,
1076 XmNleftAttachment, XmATTACH_WIDGET,
1078 XmNrightAttachment, XmATTACH_FORM,
1079 XmNbottomAttachment, XmATTACH_NONE,
1080 XmNtopWidget, FC_ContentsPatternLabel,
1081 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1084 /* Creation of FC_TypeLabel */
1085 FC_TypeLabel = XtVaCreateManagedWidget( "FC_TypeLabel",
1088 XmNalignment, XmALIGNMENT_BEGINNING,
1089 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 30, "Type:")),
1090 XmNleftWidget, FC_ContentsPatternLabel,
1091 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1092 XmNbottomAttachment, XmATTACH_NONE,
1094 XmNtopWidget, FC_ContentsPatternLabel,
1095 XmNtopAttachment, XmATTACH_WIDGET,
1098 /* Creation of FC_TypeRowColumn */
1099 FC_TypeRowColumn = XtVaCreateManagedWidget( "FC_TypeRowColumn",
1100 xmRowColumnWidgetClass,
1103 XmNpacking, XmPACK_COLUMN,
1104 XmNradioBehavior, TRUE,
1106 XmNleftWidget, FC_ContentsPatternText,
1107 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1108 XmNrightWidget, FC_ContentsPatternText,
1109 XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET,
1110 XmNbottomAttachment, XmATTACH_NONE,
1111 XmNtopWidget, FC_TypeLabel,
1112 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1115 /* Creation of FC_StringToggle */
1116 FC_StringToggle = XtVaCreateManagedWidget( "FC_StringToggle",
1117 xmToggleButtonGadgetClass,
1119 XmNindicatorType, XmONE_OF_MANY,
1120 XmNindicatorSize, 17,
1121 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 31, "String")),
1125 /* Creation of FC_ByteToggle */
1126 FC_ByteToggle = XtVaCreateManagedWidget( "FC_ByteToggle",
1127 xmToggleButtonGadgetClass,
1129 XmNindicatorType, XmONE_OF_MANY,
1130 XmNindicatorSize, 17,
1131 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 32, "Byte (Hex)")),
1134 /* Creation of FC_ShortToggle */
1135 FC_ShortToggle = XtVaCreateManagedWidget( "FC_ShortToggle",
1136 xmToggleButtonGadgetClass,
1138 XmNindicatorType, XmONE_OF_MANY,
1139 XmNindicatorSize, 17,
1140 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 33, "Short (Decimal)")),
1143 /* Creation of FC_LongToggle */
1144 FC_LongToggle = XtVaCreateManagedWidget( "FC_LongToggle",
1145 xmToggleButtonGadgetClass,
1147 XmNindicatorType, XmONE_OF_MANY,
1148 XmNindicatorSize, 17,
1149 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 34, "Long (Decimal)")),
1152 /* Creation of FC_StartByteLabel */
1153 FC_StartByteLabel = XtVaCreateManagedWidget( "FC_StartByteLabel",
1156 XmNalignment, XmALIGNMENT_BEGINNING,
1157 RES_CONVERT( XmNlabelString, GETMESSAGE(9, 35, "Start Byte:")),
1158 XmNleftWidget, FC_TypeLabel,
1159 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1160 XmNbottomOffset, 15,
1161 XmNbottomAttachment, XmATTACH_FORM,
1163 XmNtopWidget, FC_TypeRowColumn,
1164 XmNtopAttachment, XmATTACH_WIDGET,
1167 /* Creation of FC_StartByteTextField */
1168 FC_StartByteTextField = XtVaCreateManagedWidget( "FC_StartByteTextField",
1169 xmTextFieldWidgetClass,
1171 XmNcursorPosition, 5,
1174 XmNleftWidget, FC_StartByteLabel,
1175 XmNleftAttachment, XmATTACH_WIDGET,
1176 XmNtopWidget, FC_StartByteLabel,
1177 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1180 /* Creation of FC_EndByteLabel */
1181 FC_EndByteLabel = XtVaCreateManagedWidget( "FC_EndByteLabel",
1186 XmNalignment, XmALIGNMENT_BEGINNING,
1187 RES_CONVERT( XmNlabelString, "End byte:" ),
1189 XmNleftWidget, FC_StartByteTextField,
1190 XmNleftAttachment, XmATTACH_WIDGET,
1191 XmNtopWidget, FC_StartByteTextField,
1192 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1195 /* Creation of FC_EndByteTextField */
1196 FC_EndByteTextField = XtVaCreateManagedWidget( "FC_EndByteTextField",
1197 xmTextFieldWidgetClass,
1200 XmNcursorPosition, 5,
1203 XmNleftWidget, FC_EndByteLabel,
1204 XmNleftAttachment, XmATTACH_WIDGET,
1206 XmNrightAttachment, XmATTACH_FORM,
1207 XmNtopWidget, FC_EndByteLabel,
1208 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
1212 FC_ActionAreaForm = XtVaCreateManagedWidget( "FC_ActionAreaForm",
1214 FileCharacteristics,
1215 XmNskipAdjust, TRUE,
1216 XmNfractionBase, ((TIGHTNESS * ntotalbuttons) - 1),
1217 XmNleftWidget, FC_ContentsBox,
1218 XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1220 XmNrightAttachment, XmATTACH_FORM,
1221 XmNbottomOffset, 20,
1222 XmNbottomAttachment, XmATTACH_FORM,
1224 XmNtopWidget, FC_ContentsBox,
1225 XmNtopAttachment, XmATTACH_WIDGET,
1228 /* Creation of FC_OkButton */
1229 FC_OkButton = XtVaCreateManagedWidget( "FC_OkButton",
1230 xmPushButtonGadgetClass,
1232 RES_CONVERT( XmNlabelString, GETMESSAGE(6, 10, "OK")),
1233 XmNleftAttachment, nbutton ?
1234 XmATTACH_POSITION : XmATTACH_FORM,
1235 XmNleftPosition, TIGHTNESS * nbutton,
1236 XmNrightAttachment, nbutton != (ntotalbuttons - 1) ?
1237 XmATTACH_POSITION : XmATTACH_FORM,
1238 XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1),
1241 XtAddCallback( FC_OkButton, XmNactivateCallback,
1242 (XtCallbackProc) activateCB_FC_OkButton,
1245 /* Creation of FC_CancelButton */
1246 FC_CancelButton = XtVaCreateManagedWidget( "FC_CancelButton",
1247 xmPushButtonGadgetClass,
1249 RES_CONVERT( XmNlabelString, GETMESSAGE(6, 12, "Cancel")),
1250 XmNleftAttachment, nbutton ?
1251 XmATTACH_POSITION : XmATTACH_FORM,
1252 XmNleftPosition, TIGHTNESS * nbutton,
1253 XmNrightAttachment, nbutton != (ntotalbuttons - 1) ?
1254 XmATTACH_POSITION : XmATTACH_FORM,
1255 XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1),
1258 XtAddCallback( FC_CancelButton, XmNactivateCallback,
1259 (XtCallbackProc) activateCB_FC_CancelButton,
1262 /* Creation of FC_ClearButton */
1263 FC_ClearButton = XtVaCreateManagedWidget( "FC_ClearButton",
1264 xmPushButtonGadgetClass,
1266 RES_CONVERT( XmNlabelString, GETMESSAGE(6, 14, "Clear")),
1267 XmNleftAttachment, nbutton ?
1268 XmATTACH_POSITION : XmATTACH_FORM,
1269 XmNleftPosition, TIGHTNESS * nbutton,
1270 XmNrightAttachment, nbutton != (ntotalbuttons - 1) ?
1271 XmATTACH_POSITION : XmATTACH_FORM,
1272 XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1),
1275 XtAddCallback( FC_ClearButton, XmNactivateCallback,
1276 (XtCallbackProc) activateCB_FC_ClearButton,
1279 /* Creation of FC_HelpButton */
1280 FC_HelpButton = XtVaCreateManagedWidget( "FC_HelpButton",
1281 xmPushButtonGadgetClass,
1283 RES_CONVERT( XmNlabelString, GETMESSAGE(6, 13, "Help")),
1284 XmNuserData, FileCharacteristics,
1285 XmNleftAttachment, nbutton ?
1286 XmATTACH_POSITION : XmATTACH_FORM,
1287 XmNleftPosition, TIGHTNESS * nbutton,
1288 XmNrightAttachment, nbutton != (ntotalbuttons - 1) ?
1289 XmATTACH_POSITION : XmATTACH_FORM,
1290 XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1),
1293 XtAddCallback( FC_HelpButton, XmNactivateCallback,
1294 (XtCallbackProc) helpCB_general,
1295 (XtPointer) HELP_FILECHAR );
1297 XtVaSetValues(FileCharacteristics,
1298 XmNcancelButton, FC_CancelButton,
1299 XmNdefaultButton, FC_OkButton,
1300 XmNinitialFocus, FC_NameOrPathText,
1303 XtAddCallback( FileCharacteristics, XmNdestroyCallback,
1304 (XtCallbackProc) UxDestroyContextCB,
1308 return ( FC_BigForm );
1310 return ( FileCharacteristics );
1314 /*******************************************************************************
1315 The following is the 'Interface function' which is the
1316 external entry point for creating this interface.
1317 This function should be called from your application or from
1318 a callback function.
1319 *******************************************************************************/
1321 Widget create_FileCharacteristics( swidget _UxUxParent )
1324 XtArgVal /* Dimension */ dimHeight;
1325 XtArgVal /* Dimension */ dimWidth;
1326 XtArgVal /* Dimension */ dimTmp;
1327 Widget widScrolledWindow;
1330 rtrn = _Uxbuild_FileCharacteristics();
1333 XtRealizeWidget(rtrn);
1334 XtVaGetValues (FileCharacteristics,
1335 XmNheight, &dimHeight,
1336 XmNwidth, &dimWidth,
1338 XtVaGetValues (rtrn,
1339 XmNuserData, &widScrolledWindow,
1341 XtVaGetValues (widScrolledWindow,
1342 XmNverticalScrollBar, &widTmp,
1344 XtVaGetValues (widTmp,
1347 dimHeight += dimTmp;
1350 XtVaSetValues (rtrn,
1351 XmNheight, dimHeight,
1359 /******************************************************************************/
1361 /* init_FileCharacteristics_dialog_fields */
1363 /* INPUT: FiletypeData * - pointer to FiletypeData structure */
1366 /******************************************************************************/
1367 void init_FileCharacteristics_dialog_fields(FiletypeData *pFtD)
1369 char buffer[MAXBUFSIZE];
1370 char *pszPerms = (char *)NULL;
1372 /************************************************************************/
1373 /* Initialize name pattern. */
1374 /************************************************************************/
1375 if (pFtD->pszPattern) {
1376 /*XmToggleButtonSetState(FC_NameOrPathToggle, TRUE);*/
1377 XmToggleButtonGadgetSetState(FC_NameOrPathToggle, TRUE, TRUE);
1378 PutWidgetTextString(FC_NameOrPathText, pFtD->pszPattern);
1380 /*XmToggleButtonSetState(FC_NameOrPathToggle, FALSE);*/
1381 XmToggleButtonGadgetSetState(FC_NameOrPathToggle, FALSE, TRUE);
1384 /************************************************************************/
1385 /* Initialize permission pattern. */
1386 /************************************************************************/
1387 if (pFtD->pszPermissions) {
1388 if (strstr(pFtD->pszPermissions, "!d")) {
1389 XmToggleButtonGadgetSetState(FC_FileToggle, TRUE, TRUE);
1391 XmToggleButtonGadgetSetState(FC_DirectoryToggle, TRUE, TRUE);
1393 pszPerms = strchr(pFtD->pszPermissions, 'd');
1397 pszPerms = (char *)NULL;
1403 XmToggleButtonGadgetSetState(FC_PermissionToggle, TRUE, TRUE);
1405 /******************************************************************/
1406 /* Initialize Read permission */
1407 /******************************************************************/
1408 if (strstr(pFtD->pszPermissions, "!r")) {
1409 XmToggleButtonGadgetSetState(FC_ReadOffToggle, TRUE, TRUE);
1411 if (strstr(pFtD->pszPermissions, "r")) {
1412 XmToggleButtonGadgetSetState(FC_ReadOnToggle, TRUE, TRUE);
1414 XmToggleButtonGadgetSetState(FC_ReadEitherToggle, TRUE, TRUE);
1417 /******************************************************************/
1418 /* Initialize Write permission */
1419 /******************************************************************/
1420 if (strstr(pFtD->pszPermissions, "!w")) {
1421 XmToggleButtonGadgetSetState(FC_WriteOffToggle, TRUE, TRUE);
1423 if (strstr(pFtD->pszPermissions, "w")) {
1424 XmToggleButtonGadgetSetState(FC_WriteOnToggle, TRUE, TRUE);
1426 XmToggleButtonGadgetSetState(FC_WriteEitherToggle, TRUE, TRUE);
1429 /******************************************************************/
1430 /* Initialize Execute permission */
1431 /******************************************************************/
1432 if (strstr(pFtD->pszPermissions, "!x")) {
1433 XmToggleButtonGadgetSetState(FC_ExecuteOffToggle, TRUE, TRUE);
1435 if (strstr(pFtD->pszPermissions, "x")) {
1436 XmToggleButtonGadgetSetState(FC_ExecuteOnToggle, TRUE, TRUE);
1438 XmToggleButtonGadgetSetState(FC_ExecuteEitherToggle, TRUE, TRUE);
1443 XmToggleButtonGadgetSetState(FC_PermissionToggle, FALSE, TRUE);
1446 /************************************************************************/
1447 /* Initialize contents pattern. */
1448 /************************************************************************/
1449 if (pFtD->pszContents) {
1450 XmToggleButtonGadgetSetState(FC_ContentsToggle, TRUE, TRUE);
1451 /*XmToggleButtonSetState(FC_ContentsToggle, TRUE);*/
1452 PutWidgetTextString(FC_ContentsPatternText, pFtD->pszContents);
1454 if (pFtD->fsFlags & CA_FT_CNTSTRING)
1455 XmToggleButtonGadgetSetState(FC_StringToggle, TRUE, TRUE);
1456 else if (pFtD->fsFlags & CA_FT_CNTBYTE)
1457 XmToggleButtonGadgetSetState(FC_ByteToggle, TRUE, TRUE);
1458 else if (pFtD->fsFlags & CA_FT_CNTSHORT)
1459 XmToggleButtonGadgetSetState(FC_ShortToggle, TRUE, TRUE);
1460 else if (pFtD->fsFlags & CA_FT_CNTLONG)
1461 XmToggleButtonGadgetSetState(FC_LongToggle, TRUE, TRUE);
1463 sprintf(buffer, "%d", pFtD->sStart);
1464 PutWidgetTextString(FC_StartByteTextField,buffer);
1466 sprintf(buffer, "%d", pFtD->sEnd);
1467 PutWidgetTextString(FC_EndByteTextField, buffer);
1470 XmToggleButtonGadgetSetState(FC_ContentsToggle, FALSE, TRUE);
1471 /*XmToggleButtonSetState(FC_ContentsToggle, FALSE);*/
1476 /******************************************************************************/
1478 /* clear_FileCharacteristics_dialog_fields */
1480 /* INPUT: FiletypeData * - pointer to FiletypeData structure */
1483 /******************************************************************************/
1484 void clear_FileCharacteristics_dialog_fields(void)
1486 /************************************************************************/
1487 /* Clear Files/Directories - set to default */
1488 /************************************************************************/
1489 XmToggleButtonGadgetSetState(FC_FileToggle, TRUE, TRUE);
1491 /************************************************************************/
1492 /* Clear name pattern. */
1493 /************************************************************************/
1494 XmToggleButtonGadgetSetState(FC_NameOrPathToggle, FALSE, TRUE);
1495 clear_text_field(FC_NameOrPathText);
1497 /************************************************************************/
1498 /* Clear permission pattern - set to default */
1499 /************************************************************************/
1500 XmToggleButtonGadgetSetState(FC_PermissionToggle, FALSE, TRUE);
1501 XmToggleButtonGadgetSetState(FC_ReadOnToggle, FALSE, TRUE);
1502 XmToggleButtonGadgetSetState(FC_WriteOnToggle, FALSE, TRUE);
1503 XmToggleButtonGadgetSetState(FC_ExecuteOnToggle, FALSE, TRUE);
1505 XmToggleButtonGadgetSetState(FC_ReadOffToggle, FALSE, TRUE);
1506 XmToggleButtonGadgetSetState(FC_WriteOffToggle, FALSE, TRUE);
1507 XmToggleButtonGadgetSetState(FC_ExecuteOffToggle, FALSE, TRUE);
1509 XmToggleButtonGadgetSetState(FC_ReadEitherToggle, TRUE, TRUE);
1510 XmToggleButtonGadgetSetState(FC_WriteEitherToggle, TRUE, TRUE);
1511 XmToggleButtonGadgetSetState(FC_ExecuteEitherToggle, TRUE, TRUE);
1513 /************************************************************************/
1514 /* Clear contents pattern - set to default */
1515 /************************************************************************/
1516 XmToggleButtonGadgetSetState(FC_ContentsToggle, FALSE, TRUE);
1517 clear_text_field(FC_ContentsPatternText);
1518 XmToggleButtonGadgetSetState(FC_StringToggle, TRUE, TRUE);
1519 clear_text_field(FC_StartByteTextField);
1521 clear_text_field(FC_EndByteTextField);
1527 /******************************************************************************/
1529 /* FileCharCheckFields */
1532 /* OUTPUT: FALSE - no errors found */
1533 /* TRUE - found errors */
1535 /******************************************************************************/
1536 Boolean FileCharCheckFields(void)
1538 char *ptr = (char *)NULL;
1539 Boolean bError = FALSE;
1540 char *msgPtr, *errPtr;
1542 /**************************************************************************/
1543 /* Check to make sure at least one characteristic is selected. */
1544 /**************************************************************************/
1546 if ( !(XmToggleButtonGadgetGetState(FC_NameOrPathToggle)) &&
1547 !(XmToggleButtonGadgetGetState(FC_PermissionToggle)) &&
1548 !(XmToggleButtonGadgetGetState(FC_ContentsToggle)) ) {
1549 msgPtr = GETMESSAGE(10, 30,
1550 "An identifying characteristic has not been selected.\n\
1551 Select one or more of the characteristics\n\
1552 (Name Pattern, Permissions Pattern, or Contents).");
1553 errPtr = XtNewString(msgPtr);
1554 display_error_message(FileCharacteristics, errPtr);
1556 XmProcessTraversal(FC_NameOrPathText, XmTRAVERSE_CURRENT);
1561 /**************************************************************************/
1562 /* Check if name pattern is selected. If so must have a name pattern. */
1563 /**************************************************************************/
1565 if (XmToggleButtonGadgetGetState(FC_NameOrPathToggle)) {
1567 GetWidgetTextString(FC_NameOrPathText, &ptr);
1569 printf("Name Pattern = '%s'\n", ptr);
1572 msgPtr = GETMESSAGE(10, 10, "Name Pattern is missing.\n\
1573 If Name Pattern is selected, a name pattern\n\
1575 errPtr = XtNewString(msgPtr);
1576 display_error_message(FileCharacteristics, errPtr);
1578 XmProcessTraversal(FC_NameOrPathText, XmTRAVERSE_CURRENT);
1586 /**************************************************************************/
1587 /* Check if contents is selected. If so must have a contents pattern. */
1588 /**************************************************************************/
1590 if (XmToggleButtonGadgetGetState(FC_ContentsToggle)) {
1592 GetWidgetTextString(FC_ContentsPatternText, &ptr);
1594 printf("Name Pattern = '%s'\n", ptr);
1597 msgPtr = GETMESSAGE(10, 20, "Contents Pattern is missing.\n\
1598 If Contents is selected, then the Pattern field\n\
1599 under Contents must be filled in.");
1600 errPtr = XtNewString(msgPtr);
1601 display_error_message(FileCharacteristics, errPtr);
1606 /*****************************************************************/
1607 /* Now check to make sure there is a start byte value. */
1608 /*****************************************************************/
1610 GetWidgetTextString(FC_StartByteTextField, &ptr);
1612 msgPtr = GETMESSAGE(10, 25, "Start byte value is missing.\n\
1613 If Contents is selected, then a number must be\n\
1614 entered in the 'Start Byte' field.");
1615 errPtr = XtNewString(msgPtr);
1616 display_error_message(FileCharacteristics, errPtr);
1629 /*******************************************************************************
1631 *******************************************************************************/