Initial import of the CDE 2.1.30 sources from the Open Group.

This commit is contained in:
Peter Howkins
2012-03-10 18:21:40 +00:00
commit 83b6996daa
18978 changed files with 3945623 additions and 0 deletions

View File

@@ -0,0 +1,914 @@
/* $TOG: AddFiletype.c /main/8 1999/09/17 15:43:02 mgreess $ */
/***************************************************************************/
/* */
/* AddFiletype.c */
/* */
/* Associated Header file: AddFiletype.h */
/* */
/* */
/***************************************************************************/
#include <stdio.h>
#include <sys/stat.h>
#include <Xm/Xm.h>
#include <Xm/MwmUtil.h>
#include <Xm/DialogS.h>
#include <Xm/MenuShell.h>
#include <Xm/Separator.h>
#include <Xm/Text.h>
#include <Xm/ScrolledW.h>
#include <Xm/PushB.h>
#include <Xm/Form.h>
#include <Xm/Text.h>
#include <Xm/PushBG.h>
#include <Xm/TextF.h>
#include <Xm/Label.h>
#include <Xm/Form.h>
#include <Dt/Icon.h>
#include "UxXt.h"
#include "dtcreate.h"
#include "af_aux.h"
#include "CreateActionAppShell.h"
#include "cmncbs.h"
#define CONTEXT_MACRO_ACCESS 1
#include "AddFiletype.h"
#undef CONTEXT_MACRO_ACCESS
/*******************************************************************************
Global declarations.
*******************************************************************************/
/*
enum mode {NONE, NEW, SAVE, QUIT};
Widget activateField;
Widget Licon2;
extern int do_which;
enum icon_size_range filetype_icon_size = None_Selected;
*/
enum icon_size_range filetype_icon_size;
/*******************************************************************************
The following are callback functions.
*******************************************************************************/
#if 0
/******************************************************************************/
/* */
/* LayoutCB_AddFiletype */
/* */
/* INPUT: Widget wid - window id */
/* XtPointer cdata - client data */
/* XtPointer *cbstruct - callback data */
/* OUTPUT: none */
/* */
/******************************************************************************/
void LayoutCB_AddFiletype(Widget wid, XtPointer cdata, XtPointer cbs)
{
printf("In layout callback of AddFiletype\n");
}
#endif
/******************************************************************************/
/* activateCB_edit_id_characteristics - bring up file characteristics dialog */
/* INPUT: Widget filesel - edit button id */
/* XtPointer cdata - client data */
/* XtPointer *cbstruct - callback data */
/* OUTPUT: none */
/******************************************************************************/
void activateCB_edit_id_characteristics (Widget filesel, XtPointer cdata,
XmFileSelectionBoxCallbackStruct *cbstruct)
{
FiletypeData *pFtD;
XtVaGetValues (AddFiletype,
XmNuserData, &pFtD,
NULL);
/*FileCharacteristics = create_FileCharacteristics();*/
XtVaSetValues (FileCharacteristics,
XmNuserData, pFtD,
NULL);
clear_FileCharacteristics_dialog_fields();
init_FileCharacteristics_dialog_fields(pFtD);
UxPopupInterface (FILE_CHARACTERISTICS, no_grab);
return;
}
static void activateCB_AF_OkButton( Widget UxWidget,
XtPointer UxClientData,
XtPointer UxCallbackArg)
{
FiletypeData *pFtD;
FiletypeData **papArray;
int i;
/**************************************************************************/
/* Check if fields are valid. */
/**************************************************************************/
if (!AddFiletypeCheckFields()) {
/***********************************************************************/
/* Get FiletypeData structure that was allocated when Add button on */
/* the CreateActionAppShell interface was activated. */
/***********************************************************************/
XtVaGetValues(AddFiletype, XmNuserData, &pFtD, NULL);
/***********************************************************************/
/* Get all values from gui */
/***********************************************************************/
readAFFromGUI(pFtD);
/***********************************************************************/
/* If in edit mode, then don't do add type things. */
/***********************************************************************/
if (!(pFtD->fsInternal & CA_FT_EDIT)) {
/********************************************************************/
/* Update the Filetype listbox with this new filetype */
/********************************************************************/
AddFiletypeToList();
/********************************************************************/
/* Update FiletypeData array within the ActionData structure */
/********************************************************************/
UpdateFiletypeDataArray(pFtD);
}
/***********************************************************************/
/* Unset previous set values. */
/***********************************************************************/
pFtD->fsInternal &= (~(CA_FT_APPLY));
pFtD->fsInternal &= (~(CA_FT_EDIT));
/***********************************************************************/
/* Pop down the AddFiletype interface */
/***********************************************************************/
UxPopdownInterface(AddFiletype);
}
}
static void activateCB_AF_ApplyButton( Widget UxWidget,
XtPointer UxClientData,
XtPointer UxCallbackArg)
{
FiletypeData *pFtD;
/**************************************************************************/
/* Check if fields are valid. */
/**************************************************************************/
if (!AddFiletypeCheckFields()) {
/***********************************************************************/
/* Get FiletypeData structure that was allocated when Add button on */
/* the CreateActionAppShell interface was activated. */
/***********************************************************************/
XtVaGetValues(AddFiletype, XmNuserData, &pFtD, NULL);
/***********************************************************************/
/* Get all values from gui */
/***********************************************************************/
readAFFromGUI(pFtD);
/***********************************************************************/
/* Set the variable that indicates that Apply button was used. */
/***********************************************************************/
pFtD->fsInternal |= CA_FT_APPLY;
/***********************************************************************/
/* If in edit mode, then don't do apply type things. */
/***********************************************************************/
if (!(pFtD->fsInternal & CA_FT_EDIT)) {
/********************************************************************/
/* Update the Filetype listbox with this new filetype */
/********************************************************************/
if (XmListItemExists(CA_FiletypesList, XmStringCreateSimple("NONE"))) {
XmListDeleteItem(CA_FiletypesList, XmStringCreateSimple("NONE"));
}
AddFiletypeToList();
/********************************************************************/
/* Update FiletypeData array within the ActionData structure */
/********************************************************************/
UpdateFiletypeDataArray(pFtD);
}
}
}
static void activateCB_AF_CancelButton( Widget UxWidget,
XtPointer UxClientData,
XtPointer UxCallbackArg)
{
FiletypeData *pFtD;
UxPopdownInterface(AddFiletype);
XtVaGetValues(AddFiletype, XmNuserData, &pFtD, NULL);
if (!((pFtD->fsInternal & CA_FT_APPLY) || (pFtD->fsInternal & CA_FT_EDIT))) {
free_Filetypedata(pFtD);
} else {
pFtD->fsInternal &= (~(CA_FT_APPLY));
pFtD->fsInternal &= (~(CA_FT_EDIT));
}
}
/*******************************************************************************
The 'build_' function creates all the widgets
using the resource values specified in the Property Editor.
*******************************************************************************/
static Widget _Uxbuild_AddFiletype(void)
{
Widget _UxParent;
char *UxTmp0;
Widget AF_CharacteristicsWindow;
Widget ActionAreaForm;
int ntotalbuttons = 4;
int nbutton = 0;
Widget AF_ScrolledWindow;
Widget AF_BigForm;
Dimension dim1, dim2, dim3;
Widget AF_MED_IconForm, AF_TINY_IconForm;
IconData *pIconData;
char *pre, *suf, *title;
XmString emptyString;
#define TIGHTNESS 20
#define ICON_MIN_HEIGHT 83
#define FINDEDIT_SPACING 6
#define BORDER_OFFSET 3
/* Creation of AddFiletype */
_UxParent = UxParent;
if ( _UxParent == NULL )
{
_UxParent = UxTopLevel;
}
pre = GETMESSAGE(3, 10, "Create Action");
suf = GETMESSAGE(7, 10, "Add Datatype");
title = XtMalloc(strlen(pre) + strlen(suf) + 2);
sprintf(title, "%s - %s", pre, suf);
_UxParent = XtVaCreatePopupShell( "AddFiletype_shell",
xmDialogShellWidgetClass, _UxParent,
XmNx, 422,
XmNy, 148,
XmNshellUnitType, XmPIXELS,
XmNtitle, title,
NULL );
/*
XtAddCallback(_UxParent, XmNpopupCallback, LayoutCB_AddFiletype, NULL);
*/
if (bLowRes) {
AF_BigForm = XtVaCreateWidget( "AF_BigForm",
xmFormWidgetClass,
_UxParent,
XmNunitType, XmPIXELS,
XmNdialogStyle, XmDIALOG_APPLICATION_MODAL,
RES_CONVERT( XmNdialogTitle, title ),
XmNautoUnmanage, FALSE,
NULL );
AF_ScrolledWindow = XtVaCreateManagedWidget( "AF_ScrolledWindow",
xmScrolledWindowWidgetClass,
AF_BigForm,
XmNscrollingPolicy, XmAUTOMATIC,
XmNleftAttachment, XmATTACH_FORM,
XmNrightAttachment, XmATTACH_FORM,
XmNbottomAttachment, XmATTACH_FORM,
XmNtopAttachment, XmATTACH_FORM,
NULL );
XtVaSetValues(AF_BigForm, XmNuserData, AF_ScrolledWindow, NULL);
AddFiletype = XtVaCreateManagedWidget( "AddFiletype",
xmFormWidgetClass,
AF_ScrolledWindow,
NULL );
} else {
AddFiletype = XtVaCreateWidget( "AddFiletype",
xmFormWidgetClass,
_UxParent,
XmNunitType, XmPIXELS,
XmNdialogStyle, XmDIALOG_APPLICATION_MODAL,
RES_CONVERT( XmNdialogTitle, title ),
XmNautoUnmanage, FALSE,
NULL );
}
XtFree(title);
XtAddCallback( AddFiletype, XmNhelpCallback,
(XtCallbackProc) helpCB_general,
(XtPointer) HELP_ADDFILETYPE );
/* Creation of AF_FiletypeFamilyNameLabel */
AF_FiletypeFamilyNameLabel = XtVaCreateManagedWidget( "AF_FiletypeFamilyNameLabel",
xmLabelWidgetClass,
AddFiletype,
RES_CONVERT( XmNlabelString, GETMESSAGE(7, 14, "Name of Datatype Family:")),
XmNalignment, XmALIGNMENT_BEGINNING,
XmNtopOffset, 15,
XmNtopAttachment, XmATTACH_FORM,
XmNleftOffset, 10,
XmNleftAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
NULL );
/* Creation of AF_FileTypeNameTextField */
AF_FileTypeNameTextField = XtVaCreateManagedWidget( "AF_FileTypeNameTextField",
xmTextFieldWidgetClass,
AddFiletype,
XmNtopOffset, 0,
XmNtopWidget, AF_FiletypeFamilyNameLabel,
XmNtopAttachment, XmATTACH_WIDGET,
XmNleftOffset, 10,
XmNleftAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
NULL );
ActionAreaForm = XtVaCreateManagedWidget( "ActionAreaForm",
xmFormWidgetClass,
AddFiletype,
XmNnavigationType, XmTAB_GROUP,
XmNskipAdjust, TRUE,
XmNfractionBase, ((TIGHTNESS * ntotalbuttons) - 1),
XmNleftOffset, 10,
XmNleftAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
XmNbottomOffset, 20,
XmNbottomAttachment, XmATTACH_FORM,
NULL );
/* Creation of AF_OkButton */
AF_OkButton = XtVaCreateManagedWidget( "AF_OkButton",
xmPushButtonGadgetClass,
ActionAreaForm,
RES_CONVERT( XmNlabelString, GETMESSAGE(6, 10, "OK")),
XmNmultiClick, XmMULTICLICK_DISCARD,
XmNleftAttachment, nbutton ?
XmATTACH_POSITION : XmATTACH_FORM,
XmNleftPosition, TIGHTNESS * nbutton,
XmNrightAttachment, nbutton != (ntotalbuttons - 1) ?
XmATTACH_POSITION : XmATTACH_FORM,
XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1),
NULL );
nbutton++;
XtAddCallback( AF_OkButton, XmNactivateCallback,
(XtCallbackProc) activateCB_AF_OkButton,
(XtPointer) NULL );
/* Creation of AF_ApplyButton */
AF_ApplyButton = XtVaCreateManagedWidget( "AF_ApplyButton",
xmPushButtonGadgetClass,
ActionAreaForm,
RES_CONVERT( XmNlabelString, GETMESSAGE(6, 11, "Apply")),
XmNleftAttachment, nbutton ?
XmATTACH_POSITION : XmATTACH_FORM,
XmNleftPosition, TIGHTNESS * nbutton,
XmNrightAttachment, nbutton != (ntotalbuttons - 1) ?
XmATTACH_POSITION : XmATTACH_FORM,
XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1),
NULL );
nbutton++;
XtAddCallback( AF_ApplyButton, XmNactivateCallback,
(XtCallbackProc) activateCB_AF_ApplyButton,
(XtPointer) NULL );
/* Creation of AF_CancelButton */
AF_CancelButton = XtVaCreateManagedWidget( "AF_CancelButton",
xmPushButtonGadgetClass,
ActionAreaForm,
RES_CONVERT( XmNlabelString, GETMESSAGE(6, 12, "Cancel")),
XmNleftAttachment, nbutton ?
XmATTACH_POSITION : XmATTACH_FORM,
XmNleftPosition, TIGHTNESS * nbutton,
XmNrightAttachment, nbutton != (ntotalbuttons - 1) ?
XmATTACH_POSITION : XmATTACH_FORM,
XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1),
NULL );
nbutton++;
XtAddCallback( AF_CancelButton, XmNactivateCallback,
(XtCallbackProc) activateCB_AF_CancelButton,
(XtPointer) NULL );
/* Creation of AF_HelpButton */
AF_HelpButton = XtVaCreateManagedWidget( "AF_HelpButton",
xmPushButtonGadgetClass,
ActionAreaForm,
RES_CONVERT( XmNlabelString, GETMESSAGE(6, 13, "Help")),
XmNuserData, AddFiletype,
XmNleftAttachment, nbutton ?
XmATTACH_POSITION : XmATTACH_FORM,
XmNleftPosition, TIGHTNESS * nbutton,
XmNrightAttachment, nbutton != (ntotalbuttons - 1) ?
XmATTACH_POSITION : XmATTACH_FORM,
XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1),
NULL );
nbutton++;
XtAddCallback( AF_HelpButton, XmNactivateCallback,
(XtCallbackProc) helpCB_general,
(XtPointer) HELP_ADDFILETYPE );
/* Creation of AF_IdCharacteristicsLabel */
AF_IdCharacteristicsLabel = XtVaCreateManagedWidget( "AF_IdCharacteristicsLabel",
xmLabelWidgetClass,
AddFiletype,
RES_CONVERT( XmNlabelString, GETMESSAGE(7, 15, "Identifying Characteristics:")),
XmNalignment, XmALIGNMENT_BEGINNING,
XmNtopOffset, 10,
XmNtopWidget, AF_FileTypeNameTextField,
XmNtopAttachment, XmATTACH_WIDGET,
XmNleftOffset, 10,
XmNleftAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
NULL );
/* Creation of AF_IdCharacteristicsText */
AF_IdCharacteristicsText = XtVaCreateManagedWidget( "AF_IdCharacteristicsText",
xmTextWidgetClass,
AddFiletype,
XmNheight, 90,
XmNeditMode, XmMULTI_LINE_EDIT ,
XmNeditable, FALSE,
XmNrows, 3,
XmNleftOffset, 10,
XmNleftAttachment, XmATTACH_FORM,
XmNtopOffset, 0,
XmNtopWidget, AF_IdCharacteristicsLabel,
XmNtopAttachment, XmATTACH_WIDGET,
NULL );
#ifdef DEBUG
printf("AF_IdCharacteristicsText = %p\n", AF_IdCharacteristicsText);
#endif
/* Creation of AF_IdCharacteristicsEdit */
AF_IdCharacteristicsEdit = XtVaCreateManagedWidget( "AF_IdCharacteristicsEdit",
xmPushButtonGadgetClass,
AddFiletype,
RES_CONVERT( XmNlabelString, GETMESSAGE(7, 16, "Edit...")),
XmNalignment, XmALIGNMENT_BEGINNING,
XmNmultiClick, XmMULTICLICK_DISCARD,
XmNnavigationType, XmTAB_GROUP,
XmNtraversalOn, TRUE,
XmNrightOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
XmNbottomWidget, AF_IdCharacteristicsText,
XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
NULL );
XtAddCallback( AF_IdCharacteristicsEdit, XmNactivateCallback,
(XtCallbackProc) activateCB_edit_id_characteristics,
(XtPointer) NULL );
XtRealizeWidget(AF_IdCharacteristicsEdit);
XtVaGetValues(AF_IdCharacteristicsEdit, XmNwidth, &dim1, NULL);
XtVaSetValues(AF_IdCharacteristicsText,
XmNrightOffset, dim1 + 25,
XmNrightAttachment, XmATTACH_FORM,
NULL);
/* Creation of AF_FiletypeIconHelpLabel */
AF_FiletypeIconHelpLabel = XtVaCreateManagedWidget( "AF_FiletypeIconHelpLabel",
xmLabelWidgetClass,
AddFiletype,
RES_CONVERT( XmNlabelString, GETMESSAGE(7, 17, "Help Text for this Datatype Icon:")),
XmNalignment, XmALIGNMENT_BEGINNING,
XmNleftOffset, 10,
XmNleftAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
XmNtopOffset, 10,
XmNtopWidget, AF_IdCharacteristicsText,
XmNtopAttachment, XmATTACH_WIDGET,
NULL );
/*
XtVaSetValues(AF_IdCharacteristicsText,
XmNrightWidget, AF_IdCharacteristicsEdit,
XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET,
NULL);
*/
/* Creation of AF_FiletypePrintCmdTextField */
AF_FiletypePrintCmdTextField = XtVaCreateManagedWidget( "AF_FiletypePrintCmdTextField",
xmTextFieldWidgetClass,
AddFiletype,
XmNbottomOffset, 15,
XmNbottomWidget, AF_OkButton,
XmNbottomAttachment, XmATTACH_WIDGET,
XmNleftOffset, 10,
XmNleftAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
NULL );
/* Creation of AF_FiletypePrintCmdLabel */
AF_FiletypePrintCmdLabel = XtVaCreateManagedWidget( "AF_FiletypePrintCmdLabel",
xmLabelWidgetClass,
AddFiletype,
RES_CONVERT( XmNlabelString, GETMESSAGE(7, 23, "Command to Print this Datatype:")),
XmNalignment, XmALIGNMENT_BEGINNING,
XmNbottomOffset, 0,
XmNbottomWidget, AF_FiletypePrintCmdTextField,
XmNbottomAttachment, XmATTACH_WIDGET,
XmNleftOffset, 10,
XmNleftAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
NULL );
/* Creation of AF_OpenCmdText */
AF_OpenCmdText = XtVaCreateManagedWidget( "AF_OpenCmdText",
xmTextWidgetClass,
AddFiletype,
XmNeditable, FALSE,
XmNbottomOffset, 15,
XmNbottomWidget, AF_FiletypePrintCmdLabel,
XmNbottomAttachment, XmATTACH_WIDGET,
XmNleftOffset, 10,
XmNleftAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
XmNrows, 1,
XmNeditMode, XmMULTI_LINE_EDIT ,
NULL );
/* Creation of AF_OpenFiletypeCmdLabel */
AF_OpenFiletypeCmdLabel = XtVaCreateManagedWidget( "AF_OpenFiletypeCmdLabel",
xmLabelWidgetClass,
AddFiletype,
RES_CONVERT( XmNlabelString, GETMESSAGE(7, 22, "Command to Open this Datatype:")),
XmNalignment, XmALIGNMENT_BEGINNING,
XmNbottomOffset, 0,
XmNbottomWidget, AF_OpenCmdText,
XmNbottomAttachment, XmATTACH_WIDGET,
XmNleftOffset, 10,
XmNleftAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
NULL );
/* Creation of AF_CommandsLabel */
AF_CommandsLabel = XtVaCreateManagedWidget( "AF_CommandsLabel",
xmLabelWidgetClass,
AddFiletype,
XmNalignment, XmALIGNMENT_BEGINNING,
RES_CONVERT( XmNlabelString, GETMESSAGE(7, 21, "Commands")),
XmNleftOffset, 10,
XmNleftAttachment, XmATTACH_FORM,
XmNbottomOffset, 15,
XmNbottomWidget, AF_OpenFiletypeCmdLabel,
XmNbottomAttachment, XmATTACH_WIDGET,
NULL );
/* Creation of AF_FiletypeIconForm */
AF_FiletypeIconForm = XtVaCreateManagedWidget( "AF_FiletypeIconForm",
xmFormWidgetClass,
AddFiletype,
XmNresizePolicy, XmRESIZE_NONE,
XmNborderWidth, 0,
XmNbottomOffset, 20,
XmNbottomWidget, AF_CommandsLabel,
XmNbottomAttachment, XmATTACH_WIDGET,
XmNleftOffset, 10,
XmNleftAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
XmNshadowType, XmSHADOW_ETCHED_IN,
XmNshadowThickness, 3,
XmNheight, 90,
NULL );
AF_MED_IconForm = XtVaCreateManagedWidget( "AF_MED_IconForm",
xmFormWidgetClass,
AF_FiletypeIconForm,
XmNresizePolicy, XmRESIZE_NONE,
XmNborderWidth, ICON_BORDER_WIDTH,
XmNleftPosition, 16,
XmNleftOffset, 0,
XmNleftAttachment, XmATTACH_POSITION,
XmNbottomPosition, 88,
XmNbottomOffset, 0,
XmNbottomAttachment, XmATTACH_POSITION,
NULL );
/* Creation of AF_MED_IconGadget */
emptyString = XmStringCreateLocalized("");
pIconData = (IconData *)XtMalloc(sizeof(IconData));
memset(pIconData, 0, sizeof(IconData));
IconDataList[AF_MED] = pIconData;
AF_MED_IconGadget = XtVaCreateManagedWidget( "AF_MED_IconGadget",
dtIconGadgetClass,
AF_MED_IconForm,
XmNalignment, XmALIGNMENT_CENTER,
XmNuserData, pIconData,
XmNrecomputeSize, TRUE,
XmNstring, emptyString,
XmNleftOffset, BORDER_OFFSET,
XmNleftAttachment, XmATTACH_FORM,
XmNrightOffset, BORDER_OFFSET,
XmNrightAttachment, XmATTACH_FORM,
XmNtopOffset, BORDER_OFFSET,
XmNtopAttachment, XmATTACH_FORM,
XmNbottomOffset, BORDER_OFFSET,
XmNbottomAttachment, XmATTACH_FORM,
NULL );
pIconData->wid = AF_MED_IconGadget;
pIconData->size = Medium_Icon;
XtAddCallback( AF_MED_IconGadget, XmNcallback,
(XtCallbackProc) activateCB_filetype_icon,
(XtPointer) NULL );
createCB_IconGadget(AF_MED_IconGadget, FALSE, Medium_Icon);
last_filetype_pushed = AF_MED_IconGadget;
AF_TINY_IconForm = XtVaCreateManagedWidget( "AF_TINY_IconForm",
xmFormWidgetClass,
AF_FiletypeIconForm,
XmNresizePolicy, XmRESIZE_NONE,
XmNleftPosition, 41,
XmNleftOffset, -1,
XmNleftAttachment, XmATTACH_POSITION,
XmNbottomPosition, 86,
XmNbottomOffset, 0,
XmNbottomAttachment, XmATTACH_POSITION,
NULL );
/* Creation of AF_TINY_IconGadget */
pIconData = (IconData *)XtMalloc(sizeof(IconData));
memset(pIconData, 0, sizeof(IconData));
IconDataList[AF_TINY] = pIconData;
AF_TINY_IconGadget = XtVaCreateManagedWidget( "AF_TINY_IconGadget",
dtIconGadgetClass,
AF_TINY_IconForm,
XmNalignment, XmALIGNMENT_CENTER,
XmNuserData, pIconData,
XmNrecomputeSize, TRUE,
XmNstring, emptyString,
XmNleftOffset, BORDER_OFFSET,
XmNleftAttachment, XmATTACH_FORM,
XmNrightOffset, BORDER_OFFSET,
XmNrightAttachment, XmATTACH_FORM,
XmNtopOffset, BORDER_OFFSET,
XmNtopAttachment, XmATTACH_FORM,
XmNbottomOffset, BORDER_OFFSET,
XmNbottomAttachment, XmATTACH_FORM,
NULL );
pIconData->wid = AF_TINY_IconGadget;
pIconData->size = Tiny_Icon;
XtAddCallback( AF_TINY_IconGadget, XmNcallback,
(XtCallbackProc) activateCB_filetype_icon,
(XtPointer) NULL );
createCB_IconGadget(AF_TINY_IconGadget, FALSE, Tiny_Icon);
XmStringFree(emptyString);
/* Creation of AF_FiletypeIconsEditButton */
AF_FiletypeIconsEditButton = XtVaCreateManagedWidget( "AF_FiletypeIconsEditButton",
xmPushButtonGadgetClass,
AF_FiletypeIconForm,
RES_CONVERT( XmNlabelString, GETMESSAGE(6, 20, "Edit Icon...")),
XmNalignment, XmALIGNMENT_BEGINNING,
XmNmultiClick, XmMULTICLICK_DISCARD,
/*XmNnavigationType, XmTAB_GROUP,*/
XmNleftPosition, 64,
XmNleftOffset, -1,
XmNleftAttachment, XmATTACH_POSITION,
NULL );
XtAddCallback( AF_FiletypeIconsEditButton, XmNactivateCallback,
(XtCallbackProc) activateCB_edit_icon,
(XtPointer) CA_FILETYPE_ICONS );
/* Creation of AF_FiletypeIconFindSetButton */
AF_FiletypeIconFindSetButton = XtVaCreateManagedWidget( "AF_FiletypeIconFindSetButton",
xmPushButtonGadgetClass,
AF_FiletypeIconForm,
XmNx, 290,
XmNy, 20,
RES_CONVERT( XmNlabelString, GETMESSAGE(6, 19, "Find Set...")),
XmNalignment, XmALIGNMENT_BEGINNING,
/*XmNnavigationType, XmTAB_GROUP,*/
XmNmultiClick, XmMULTICLICK_DISCARD,
XmNleftPosition, 64,
XmNleftOffset, -1,
XmNleftAttachment, XmATTACH_POSITION,
NULL );
XtAddCallback( AF_FiletypeIconFindSetButton, XmNactivateCallback,
(XtCallbackProc) activateCB_open_FindSet,
(XtPointer) CA_FILETYPE_ICONS );
/******************************************************************/
/* Determine which button is wider, attach the short one onto it */
/******************************************************************/
XtVaGetValues(AF_FiletypeIconsEditButton, XmNwidth, &dim1, NULL);
XtVaGetValues(AF_FiletypeIconFindSetButton, XmNwidth, &dim2, NULL);
if (dim1 > dim2) {
XtVaSetValues(AF_FiletypeIconFindSetButton,
XmNwidth, dim1,
NULL);
} else {
XtVaSetValues(AF_FiletypeIconsEditButton,
XmNwidth, dim2,
NULL);
}
/******************************************************************/
/* Determine vertical positioning for findset and edit buttons */
/******************************************************************/
/*XtRealizeWidget(AF_FiletypeIconForm);*/
XtVaGetValues(AF_FiletypeIconForm, XmNheight, &dim3, NULL);
XtVaGetValues(AF_FiletypeIconsEditButton, XmNheight, &dim1, NULL);
XtVaGetValues(AF_FiletypeIconFindSetButton, XmNheight, &dim2, NULL);
#ifdef DEBUG
printf("find set size = %d\n", dim2);
printf("edit size = %d\n", dim1);
printf("icon area form size = %d\n", dim3);
#endif
if ((int)(dim1 + dim2) + 3*(FINDEDIT_SPACING) > (int)dim3) {
XtVaSetValues(AF_FiletypeIconsEditButton,
XmNbottomOffset, FINDEDIT_SPACING,
XmNbottomAttachment, XmATTACH_FORM,
NULL);
XtVaSetValues(AF_FiletypeIconFindSetButton,
XmNbottomOffset, FINDEDIT_SPACING,
XmNbottomWidget, AF_FiletypeIconsEditButton,
XmNbottomAttachment, XmATTACH_WIDGET,
XmNtopOffset, FINDEDIT_SPACING,
XmNtopAttachment, XmATTACH_FORM,
NULL);
} else {
XtVaSetValues(AF_FiletypeIconsEditButton,
XmNtopPosition, 50,
XmNtopOffset, (int)(FINDEDIT_SPACING / 2),
XmNtopAttachment, XmATTACH_POSITION,
NULL);
XtVaSetValues(AF_FiletypeIconFindSetButton,
XmNbottomPosition, 50,
XmNbottomOffset, (int)(FINDEDIT_SPACING / 2),
XmNbottomAttachment, XmATTACH_POSITION,
NULL);
}
/******************************************************************/
/* Creation of AF_FiletypeIconsBoxLabel */
/******************************************************************/
AF_FiletypeIconsBoxLabel = XtVaCreateManagedWidget( "AF_FiletypeIconsBoxLabel",
xmLabelWidgetClass,
AddFiletype,
RES_CONVERT( XmNlabelString, GETMESSAGE(7, 18, "Datatype Icons:")),
XmNalignment, XmALIGNMENT_BEGINNING,
XmNbottomOffset, 0,
XmNbottomWidget, AF_FiletypeIconForm,
XmNbottomAttachment, XmATTACH_WIDGET,
XmNleftOffset, 10,
XmNleftAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
NULL );
/* Creation of AF_FiletypeHelpScrolledWindow */
AF_FiletypeHelpScrolledWindow = XtVaCreateManagedWidget( "AF_FiletypeHelpScrolledWindow",
xmScrolledWindowWidgetClass,
AddFiletype,
XmNscrollingPolicy, XmAPPLICATION_DEFINED,
XmNx, 10,
XmNy, 226,
XmNvisualPolicy, XmVARIABLE,
XmNscrollBarDisplayPolicy, XmSTATIC,
XmNshadowThickness, 0,
XmNtopOffset, 0,
XmNtopWidget, AF_FiletypeIconHelpLabel,
XmNtopAttachment, XmATTACH_WIDGET,
XmNbottomOffset, 10,
XmNbottomWidget, AF_FiletypeIconsBoxLabel,
XmNbottomAttachment, XmATTACH_WIDGET,
XmNleftOffset, 10,
XmNleftAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
XmNheight, 94,
NULL );
/* Creation of AF_FiletypeHelpText */
AF_FiletypeHelpText = XtVaCreateManagedWidget( "AF_FiletypeHelpText",
xmTextWidgetClass,
AF_FiletypeHelpScrolledWindow,
XmNscrollHorizontal, FALSE,
XmNscrollVertical, TRUE,
XmNeditMode, XmMULTI_LINE_EDIT ,
XmNwordWrap, TRUE,
XmNx, 19,
XmNy, 0,
XmNheight, 80,
NULL );
/* Creation of AF_separator2 */
AF_separator2 = XtVaCreateManagedWidget( "AF_separator2",
xmSeparatorWidgetClass,
AddFiletype,
XmNleftOffset, 0,
XmNleftWidget, AF_CommandsLabel,
XmNleftAttachment, XmATTACH_WIDGET,
XmNrightOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
XmNbottomOffset, 10,
XmNbottomWidget, AF_CommandsLabel,
XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
NULL );
#if 0
/* Creation of AF_separator1 */
AF_separator1 = XtVaCreateManagedWidget( "AF_separator1",
xmSeparatorWidgetClass,
AddFiletype,
XmNbottomOffset, 0,
XmNbottomWidget, AF_separator2,
XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNleftOffset, 10,
XmNleftAttachment, XmATTACH_FORM,
XmNrightOffset, 0,
XmNrightWidget, AF_CommandsLabel,
XmNrightAttachment, XmATTACH_WIDGET,
NULL );
#endif
XtVaSetValues(AddFiletype,
XmNcancelButton, AF_CancelButton,
XmNdefaultButton, AF_OkButton,
XmNinitialFocus, AF_FileTypeNameTextField,
NULL );
XtAddCallback( AddFiletype, XmNdestroyCallback,
(XtCallbackProc) UxDestroyContextCB,
(XtPointer) UxAddFiletypeContext);
if (bLowRes) {
return ( AF_BigForm );
} else {
return ( AddFiletype );
}
}
/*******************************************************************************
The following is the 'Interface function' which is the
external entry point for creating this interface.
This function should be called from your application or from
a callback function.
*******************************************************************************/
Widget create_AddFiletype(swidget _UxUxParent)
{
Widget rtrn;
_UxCAddFiletype *UxContext;
Dimension dimHeight;
Dimension dimWidth;
Dimension dimTmp;
Widget widScrolledWindow;
Widget widTmp;
UxAddFiletypeContext = UxContext =
(_UxCAddFiletype *) UxNewContext( sizeof(_UxCAddFiletype), False );
UxParent = _UxUxParent;
rtrn = _Uxbuild_AddFiletype();
if (bLowRes) {
XtRealizeWidget(rtrn);
XtVaGetValues (AddFiletype,
XmNheight, &dimHeight,
XmNwidth, &dimWidth,
NULL);
XtVaGetValues (rtrn,
XmNuserData, &widScrolledWindow,
NULL);
XtVaGetValues (widScrolledWindow,
XmNverticalScrollBar, &widTmp,
NULL);
XtVaGetValues (widTmp,
XmNwidth, &dimTmp,
NULL);
dimHeight += dimTmp;
dimWidth += dimTmp;
XtVaSetValues (rtrn,
XmNheight, dimHeight,
XmNwidth, dimWidth,
NULL);
}
return(rtrn);
}
/*******************************************************************************
END OF FILE
*******************************************************************************/

View File

@@ -0,0 +1,121 @@
/* $XConsortium: AddFiletype.h /main/5 1995/11/01 16:05:05 rswiston $ */
/*******************************************************************************
AddFiletype.h
This header file is included by AddFiletype.c
*******************************************************************************/
#ifndef _ADDFILETYPE_H_INCLUDED
#define _ADDFILETYPE_H_INCLUDED
#include <stdio.h>
#include <Xm/Xm.h>
#include <Xm/MwmUtil.h>
#include <Xm/DialogS.h>
#include <Xm/MenuShell.h>
#include <Xm/Separator.h>
#include <Xm/Text.h>
#include <Xm/ScrolledW.h>
#include <Xm/PushB.h>
#include <Xm/Form.h>
#include <Xm/Text.h>
#include <Xm/PushBG.h>
#include <Xm/TextF.h>
#include <Xm/Label.h>
#include <Xm/Form.h>
#include "UxXt.h"
/*******************************************************************************
The definition of the context structure:
If you create multiple copies of your interface, the context
structure ensures that your callbacks use the variables for the
correct copy.
For each swidget in the interface, each argument to the Interface
function, and each variable in the Interface Specific section of the
Declarations Editor, there is an entry in the context structure.
and a #define. The #define makes the variable name refer to the
corresponding entry in the context structure.
*******************************************************************************/
typedef struct
{
Widget UxAddFiletype;
Widget UxAF_FiletypeFamilyNameLabel;
Widget UxAF_OkButton;
Widget UxAF_ApplyButton;
Widget UxAF_CancelButton;
Widget UxAF_HelpButton;
Widget UxAF_IdCharacteristicsText;
Widget UxAF_FiletypeIconHelpLabel;
Widget UxAF_IdCharacteristicsEdit;
Widget UxAF_FiletypePrintCmdLabel;
Widget UxAF_OpenFiletypeCmdLabel;
Widget UxAF_CommandsLabel;
Widget UxAF_FiletypeIconForm;
Widget UxAF_MED_IconGadget;
Widget UxAF_TINY_IconGadget;
Widget UxAF_FiletypeIconsEditButton;
Widget UxAF_FiletypeIconFindSetButton;
Widget UxAF_FiletypeIconsBoxLabel;
Widget UxAF_FiletypeHelpScrolledWindow;
Widget UxAF_separator2;
Widget UxAF_separator1;
Widget UxAF_IdCharacteristicsLabel;
swidget UxUxParent;
} _UxCAddFiletype;
#ifdef CONTEXT_MACRO_ACCESS
static _UxCAddFiletype *UxAddFiletypeContext;
#define AddFiletype UxAddFiletypeContext->UxAddFiletype
#define AF_FiletypeFamilyNameLabel UxAddFiletypeContext->UxAF_FiletypeFamilyNameLabel
#define AF_OkButton UxAddFiletypeContext->UxAF_OkButton
#define AF_ApplyButton UxAddFiletypeContext->UxAF_ApplyButton
#define AF_CancelButton UxAddFiletypeContext->UxAF_CancelButton
#define AF_HelpButton UxAddFiletypeContext->UxAF_HelpButton
/*#define AF_IdCharacteristicsText UxAddFiletypeContext->UxAF_IdCharacteristicsText*/
#define AF_FiletypeIconHelpLabel UxAddFiletypeContext->UxAF_FiletypeIconHelpLabel
/*#define AF_IdCharacteristicsEdit UxAddFiletypeContext->UxAF_IdCharacteristicsEdit*/
#define AF_FiletypePrintCmdLabel UxAddFiletypeContext->UxAF_FiletypePrintCmdLabel
#define AF_OpenFiletypeCmdLabel UxAddFiletypeContext->UxAF_OpenFiletypeCmdLabel
#define AF_CommandsLabel UxAddFiletypeContext->UxAF_CommandsLabel
#define AF_FiletypeIconForm UxAddFiletypeContext->UxAF_FiletypeIconForm
/*
#define AF_MED_IconGadget UxAddFiletypeContext->UxAF_MED_IconGadget
#define AF_TINY_IconGadget UxAddFiletypeContext->UxAF_TINY_IconGadget
*/
#define AF_FiletypeIconsEditButton UxAddFiletypeContext->UxAF_FiletypeIconsEditButton
#define AF_FiletypeIconFindSetButton UxAddFiletypeContext->UxAF_FiletypeIconFindSetButton
#define AF_FiletypeIconsBoxLabel UxAddFiletypeContext->UxAF_FiletypeIconsBoxLabel
#define AF_FiletypeHelpScrolledWindow UxAddFiletypeContext->UxAF_FiletypeHelpScrolledWindow
#define AF_separator2 UxAddFiletypeContext->UxAF_separator2
#define AF_separator1 UxAddFiletypeContext->UxAF_separator1
#define AF_IdCharacteristicsLabel UxAddFiletypeContext->UxAF_IdCharacteristicsLabel
#define UxParent UxAddFiletypeContext->UxUxParent
#endif /* CONTEXT_MACRO_ACCESS */
extern Widget AF_FileTypeNameTextField;
extern Widget AF_FiletypePrintCmdTextField;
extern Widget AF_OpenCmdText;
extern Widget AF_FiletypeHelpText;
extern Widget AF_MED_IconGadget;
extern Widget AF_TINY_IconGadget;
/*******************************************************************************
Declarations of global functions.
*******************************************************************************/
void activateCB_edit_id_characteristics (
Widget filesel,
XtPointer cdata,
XmFileSelectionBoxCallbackStruct *cbstruct);
Widget create_AddFiletype(swidget _UxUxParent);
#endif /* _ADDFILETYPE_H_INCLUDED */

View File

@@ -0,0 +1,177 @@
/* $XConsortium: Confirmed.c /main/5 1996/10/15 14:44:45 rswiston $ */
/*******************************************************************************
Confirmed.c
Associated Header file: Confirmed.h
*******************************************************************************/
#include <stdio.h>
#include <Xm/Xm.h>
#include <Xm/MessageB.h>
#include <sys/signal.h>
#include "dtcreate.h"
#include "UxXt.h"
#include "CreateActionAppShell.h"
#define CONTEXT_MACRO_ACCESS 1
#include "Confirmed.h"
#undef CONTEXT_MACRO_ACCESS
/*******************************************************************************
The following are callback functions for Confirmed dialog.
*******************************************************************************/
/******************************************************************************/
/* activateCB_Confirmed_OkButton */
/******************************************************************************/
void activateCB_Confirmed_OkButton( Widget UxWidget,
XtPointer UxClientData,
XtPointer UxCallbackArg)
{
XtDestroyWidget(XtParent(UxWidget));
}
/******************************************************************************/
/* display_confirmed_message */
/* */
/* INPUT: Widget parent - parent to position dialog on. */
/* char *message - message to display in dialog box */
/* OUTPIT: none */
/* */
/******************************************************************************/
void display_confirmed_message (Widget parent, char *message)
{
Confirmed = XmCreateInformationDialog(parent, "confirmedDialog", NULL, 0);
XtUnmanageChild (XmMessageBoxGetChild (Confirmed, XmDIALOG_CANCEL_BUTTON));
XtUnmanageChild (XmMessageBoxGetChild (Confirmed, XmDIALOG_HELP_BUTTON));
XtAddCallback( Confirmed, XmNokCallback,
(XtCallbackProc) activateCB_Confirmed_OkButton,
(XtPointer) NULL );
XtVaSetValues (Confirmed,
RES_CONVERT(XmNdialogTitle, GETMESSAGE(6, 41, "Create Action - Confirmation")),
RES_CONVERT(XmNmessageString, message),
NULL);
XtRealizeWidget(Confirmed);
XtManageChild (Confirmed);
return;
}
/*******************************************************************************
The following are callback functions for Question dialog
*******************************************************************************/
/******************************************************************************/
/* */
/* cancelCB_QuestionDialog */
/* */
/******************************************************************************/
void cancelCB_QuestionDialog(Widget UxWidget,
XtPointer UxClientData,
XtPointer UxCallbackArg)
{
XtDestroyWidget(XtParent(UxWidget));
}
/******************************************************************************/
/* */
/* nosaveCB_QuestionDialog */
/* */
/******************************************************************************/
void nosaveCB_QuestionDialog(Widget UxWidget,
XtPointer UxClientData,
XtPointer UxCallbackArg)
{
XtDestroyWidget(XtParent(UxWidget));
FreeResources();
exit(0);
}
/******************************************************************************/
/* */
/* saveCallbackB_QuestionDialog */
/* */
/******************************************************************************/
void saveCB_QuestionDialog(Widget UxWidget,
XtPointer UxClientData,
XtPointer UxCallbackArg)
{
XtDestroyWidget(XtParent(UxWidget));
/********************************************************************/
/* Activate the save routine. */
/********************************************************************/
activateCB_CA_MB_FileSave((Widget)NULL, (XtPointer)NULL, (XtPointer)NULL);
}
/******************************************************************************/
/* display_question_message */
/* */
/* INPUT: Widget parent - parent to position dialog on. */
/* char *message - message to display in dialog box */
/* OUTPIT: none */
/* */
/******************************************************************************/
void display_question_message (Widget parent, char *message,
char *button1, XtCallbackProc cb_button1,
char *button2, XtCallbackProc cb_button2,
char *button3, XtCallbackProc cb_button3)
{
Widget tmpw;
QuestionDialog = XmCreateQuestionDialog(parent, "questionDialog", NULL, 0);
tmpw = XmMessageBoxGetChild(QuestionDialog, XmDIALOG_OK_BUTTON);
if (button1) {
XtVaSetValues(tmpw,
RES_CONVERT( XmNlabelString, button1),
NULL);
XtAddCallback( QuestionDialog, XmNokCallback,
(XtCallbackProc) cb_button1,
(XtPointer) NULL );
} else {
XtUnmanageChild (tmpw);
}
tmpw = XmMessageBoxGetChild(QuestionDialog, XmDIALOG_CANCEL_BUTTON);
if (button2) {
XtVaSetValues(tmpw,
RES_CONVERT( XmNlabelString, button2),
NULL);
XtAddCallback( QuestionDialog, XmNcancelCallback,
(XtCallbackProc) cb_button2,
(XtPointer) NULL );
} else {
XtUnmanageChild (tmpw);
}
tmpw = XmMessageBoxGetChild(QuestionDialog, XmDIALOG_HELP_BUTTON);
if (button3) {
XtVaSetValues(tmpw,
RES_CONVERT( XmNlabelString, button3),
NULL);
XtAddCallback( QuestionDialog, XmNhelpCallback,
(XtCallbackProc) cb_button3,
(XtPointer) NULL );
} else {
XtUnmanageChild (tmpw);
}
XtVaSetValues (QuestionDialog,
RES_CONVERT(XmNdialogTitle, GETMESSAGE(6, 51, "Create Action - Question")),
RES_CONVERT(XmNmessageString, message),
NULL);
XtManageChild (QuestionDialog);
return;
}
/*******************************************************************************
END OF FILE
*******************************************************************************/

View File

@@ -0,0 +1,37 @@
/* $XConsortium: Confirmed.h /main/4 1995/11/01 16:05:43 rswiston $ */
/*******************************************************************************
Confirmed.h
This header file is included by Confirmed.c
*******************************************************************************/
#ifndef _CONFIRMED_H_INCLUDED
#define _CONFIRMED_H_INCLUDED
#include <stdio.h>
#include <Xm/MessageB.h>
/*******************************************************************************
Declarations of global functions.
*******************************************************************************/
void display_confirmed_message (Widget parent, char *message);
void display_question_message (Widget parent, char *message,
char *button1, XtCallbackProc cb_button1,
char *button2, XtCallbackProc cb_button2,
char *button3, XtCallbackProc cb_button3);
void cancelCB_QuestionDialog(Widget UxWidget,
XtPointer UxClientData,
XtPointer UxCallbackArg);
void saveCB_QuestionDialog(Widget UxWidget,
XtPointer UxClientData,
XtPointer UxCallbackArg);
void nosaveCB_QuestionDialog(Widget UxWidget,
XtPointer UxClientData,
XtPointer UxCallbackArg);
#endif /* _CONFIRMED_H_INCLUDED */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,234 @@
/* $XConsortium: CreateActionAppShell.h /main/4 1995/11/01 16:06:24 rswiston $ */
/******************************************************************************
CreateActionAppShell.h
This header file is included by CreateActionAppShell.c
*******************************************************************************/
#ifndef _CREATEACTIONAPPSHELL_H_INCLUDED
#define _CREATEACTIONAPPSHELL_H_INCLUDED
#include <stdio.h>
#include <Xm/Xm.h>
#include <Xm/MwmUtil.h>
#include <Xm/MenuShell.h>
#include "UxXt.h"
#include "dtcreate.h"
#include <Xm/Text.h>
#include <Xm/ToggleBG.h>
#include <Xm/List.h>
#include <Xm/ScrolledW.h>
#include <Xm/Text.h>
#include <Xm/PushBG.h>
#include <Xm/TextF.h>
#include <Xm/Label.h>
#include <Xm/Form.h>
#include <Xm/CascadeB.h>
#include <Xm/ToggleB.h>
#include <Xm/Separator.h>
#include <Xm/PushB.h>
#include <Xm/RowColumn.h>
#include <Xm/MainW.h>
#include <X11/Shell.h>
/*******************************************************************************
The definition of the context structure:
If you create multiple copies of your interface, the context
structure ensures that your callbacks use the variables for the
correct copy.
For each swidget in the interface, each argument to the Interface
function, and each variable in the Interface Specific section of the
Declarations Editor, there is an entry in the context structure.
and a #define. The #define makes the variable name refer to the
corresponding entry in the context structure.
*******************************************************************************/
typedef struct
{
Widget UxCreateActionMainWindow;
Widget UxCA_MenuBar;
Widget UxCA_MB_FileOption;
Widget UxCA_MB_FileNew;
Widget UxCA_MB_FileOpen;
Widget UxCA_MB_FileSave;
Widget UxCA_MB_Sep;
Widget UxCA_MB_FileExit;
Widget UxCA_MB_FileTop;
Widget UxCA_MB_HelpOption;
Widget UxCA_MB_HelpOverview;
Widget UxCA_MB_HelpTOC;
Widget UxCA_MB_HelpTasks;
Widget UxCA_MB_HelpReference;
Widget UxCA_MB_HelpUsing;
Widget UxCA_MB_HelpAbout;
Widget UxCA_MB_HelpTop;
Widget UxCA_MB_OptionsOption;
Widget UxCA_MB_OptionTop;
Widget UxCA_Form;
Widget UxCA_ActionNameLabel;
Widget UxCA_ActionIconLabel;
Widget UxCA_ActionIconForm;
Widget UxCA_EditIcon_button;
Widget UxCA_FindSet_button;
Widget Uxseparator1;
Widget UxCA_DblClkLabel;
Widget UxCA_HlpTxtLabel;
Widget UxCA_XprtOptionLabel;
Widget UxCA_XprtSep2;
Widget UxCA_ActionOpenLabel;
Widget UxCA_XprtSep1;
Widget UxCA_FiletypesLabel;
Widget Uxform1;
Widget UxCA_DroppableFiletypesLabel;
Widget UxCA_DroppableFiletypesRowColumn;
Widget UxrowColumn1;
Widget UxCA_FiletypesAdd;
Widget UxCA_FiletypesDelete;
Widget UxCA_FiletypesEdit;
Widget UxCA_FiletypesWindow;
Widget UxCA_WindowTypeLabel;
swidget UxUxParent;
} _UxCCreateActionAppShell;
#ifdef CONTEXT_MACRO_ACCESS
static _UxCCreateActionAppShell *UxCreateActionAppShellContext;
#define CreateActionMainWindow UxCreateActionAppShellContext->UxCreateActionMainWindow
#define CA_MenuBar UxCreateActionAppShellContext->UxCA_MenuBar
#define CA_MB_FileOption UxCreateActionAppShellContext->UxCA_MB_FileOption
#define CA_MB_FileNew UxCreateActionAppShellContext->UxCA_MB_FileNew
#define CA_MB_FileOpen UxCreateActionAppShellContext->UxCA_MB_FileOpen
#define CA_MB_FileSave UxCreateActionAppShellContext->UxCA_MB_FileSave
#define CA_MB_Sep UxCreateActionAppShellContext->UxCA_MB_Sep
#define CA_MB_FileExit UxCreateActionAppShellContext->UxCA_MB_FileExit
#define CA_MB_FileTop UxCreateActionAppShellContext->UxCA_MB_FileTop
#define CA_MB_HelpOption UxCreateActionAppShellContext->UxCA_MB_HelpOption
#define CA_MB_HelpOverview UxCreateActionAppShellContext->UxCA_MB_HelpOverview
#define CA_MB_HelpTOC UxCreateActionAppShellContext->UxCA_MB_HelpTOC
#define CA_MB_HelpTasks UxCreateActionAppShellContext->UxCA_MB_HelpTasks
#define CA_MB_HelpReference UxCreateActionAppShellContext->UxCA_MB_HelpReference
#define CA_MB_HelpUsing UxCreateActionAppShellContext->UxCA_MB_HelpUsing
#define CA_MB_HelpAbout UxCreateActionAppShellContext->UxCA_MB_HelpAbout
#define CA_MB_HelpTop UxCreateActionAppShellContext->UxCA_MB_HelpTop
#define CA_MB_OptionsOption UxCreateActionAppShellContext->UxCA_MB_OptionsOption
#define CA_MB_OptionTop UxCreateActionAppShellContext->UxCA_MB_OptionTop
#define CA_Form UxCreateActionAppShellContext->UxCA_Form
#define CA_ActionNameLabel UxCreateActionAppShellContext->UxCA_ActionNameLabel
#define CA_ActionIconLabel UxCreateActionAppShellContext->UxCA_ActionIconLabel
#define CA_ActionIconForm UxCreateActionAppShellContext->UxCA_ActionIconForm
#define CA_EditIcon_button UxCreateActionAppShellContext->UxCA_EditIcon_button
#define CA_FindSet_button UxCreateActionAppShellContext->UxCA_FindSet_button
#define separator1 UxCreateActionAppShellContext->Uxseparator1
#define CA_DblClkLabel UxCreateActionAppShellContext->UxCA_DblClkLabel
#define CA_HlpTxtLabel UxCreateActionAppShellContext->UxCA_HlpTxtLabel
#define CA_XprtOptionLabel UxCreateActionAppShellContext->UxCA_XprtOptionLabel
#define CA_XprtSep2 UxCreateActionAppShellContext->UxCA_XprtSep2
#define CA_ActionOpenLabel UxCreateActionAppShellContext->UxCA_ActionOpenLabel
#define CA_XprtSep1 UxCreateActionAppShellContext->UxCA_XprtSep1
#define CA_FiletypesLabel UxCreateActionAppShellContext->UxCA_FiletypesLabel
#define form1 UxCreateActionAppShellContext->Uxform1
#define CA_DroppableFiletypesLabel UxCreateActionAppShellContext->UxCA_DroppableFiletypesLabel
#define CA_DroppableFiletypesRowColumn UxCreateActionAppShellContext->UxCA_DroppableFiletypesRowColumn
#define rowColumn1 UxCreateActionAppShellContext->UxrowColumn1
#define CA_FiletypesAdd UxCreateActionAppShellContext->UxCA_FiletypesAdd
#define CA_FiletypesDelete UxCreateActionAppShellContext->UxCA_FiletypesDelete
#define CA_FiletypesEdit UxCreateActionAppShellContext->UxCA_FiletypesEdit
#define CA_FiletypesWindow UxCreateActionAppShellContext->UxCA_FiletypesWindow
#define CA_WindowTypeLabel UxCreateActionAppShellContext->UxCA_WindowTypeLabel
#define UxParent UxCreateActionAppShellContext->UxUxParent
#endif /* CONTEXT_MACRO_ACCESS */
/***************************************************************************/
/* */
/* Swidget Macro Definitions */
/* */
/***************************************************************************/
#define CREATE_ACTION_SWID (CreateActionAppShell)
#define ACTION_NAME_SWID (CA_ActionNameTextField)
#define DBL_CLK_CMND_SWID (CA_DblClkText)
#define ACTION_HELP_TXT_SWID (CA_HelpText)
#define HELP_TXT_WINDOW_SWID (CA_HelpTextWindow)
#define FILETYPES_FOR_ACTION_SWID (CA_FiletypesList)
#define ACTION_OPENS_TEXT_SWID (CA_XprtActionOpenText)
#define XWIN_TOGGLE_SWID (CA_WinTypeX)
#define AUTOCLOSE_TOGGLE_SWID (CA_WinTypeAutoClose)
#define MANUALCLOSE_TOGGLE_SWID (CA_WinTypeManualClose)
#define LRG_ICON_BUTTON_SWID (CA_LRG_IconButton)
#define MED_ICON_BUTTON_SWID (CA_MED_IconButton)
#define SML_ICON_BUTTON_SWID (CA_SML_IconButton)
#define TINY_ICON_BUTTON_SWID (CA_TINY_IconButton)
#define LRG_ICON_GADGET_SWID (CA_LRG_IconGadget)
#define MED_ICON_GADGET_SWID (CA_MED_IconGadget)
#define SML_ICON_GADGET_SWID (CA_SML_IconGadget)
#define TINY_ICON_GADGET_SWID (CA_TINY_IconGadget)
#define XPRT_OPTION_FORM_SWID (XprtOptionFrom)
#define EXPERT_OPTIONS_TOGGLE_BUTTON_SWID (ExpertOption)
#define OPEN_FILE_SWID (OpenFile)
#define FILE_CHARACTERISTICS_SWID (FileCharacteristics)
#define WINDOW_TYPE_SWID (CA_WindowType)
#define COLOR_MONO_OPTION_SWID (ColorMonoOption)
/***************************************************************************/
/* */
/* Widget Macro Definitions */
/* */
/***************************************************************************/
#define CREATE_ACTION (UxGetWidget(CREATE_ACTION_SWID))
#define ACTION_NAME (UxGetWidget(ACTION_NAME_SWID))
#define DBL_CLK_CMND (UxGetWidget(DBL_CLK_CMND_SWID))
#define ACTION_HELP_TXT (UxGetWidget(ACTION_HELP_TXT_SWID))
#define HELP_TXT_WINDOW (UxGetWidget(HELP_TXT_WINDOW_SWID))
#define FILETYPES_FOR_ACTION (UxGetWidget(FILETYPES_FOR_ACTION_SWID))
#define ACTION_OPENS_TEXT (UxGetWidget(ACTION_OPENS_TEXT_SWID))
#define XWIN_TOGGLE (UxGetWidget(XWIN_TOGGLE_SWID))
#define AUTOCLOSE_TOGGLE (UxGetWidget(AUTOCLOSE_TOGGLE_SWID))
#define MANUALCLOSE_TOGGLE (UxGetWidget(MANUALCLOSE_TOGGLE_SWID))
#define CA_LRG_ICON_BUTTON (UxGetWidget(LRG_ICON_BUTTON_SWID))
#define CA_MED_ICON_BUTTON (UxGetWidget(MED_ICON_BUTTON_SWID))
#define CA_SML_ICON_BUTTON (UxGetWidget(SML_ICON_BUTTON_SWID))
#define CA_TINY_ICON_BUTTON (UxGetWidget(TINY_ICON_BUTTON_SWID ))
#define CA_LRG_ICON_GADGET (UxGetWidget(LRG_ICON_GADGET_SWID))
#define CA_MED_ICON_GADGET (UxGetWidget(MED_ICON_GADGET_SWID))
#define CA_SML_ICON_GADGET (UxGetWidget(SML_ICON_GADGET_SWID))
#define CA_TINY_ICON_GADGET (UxGetWidget(TINY_ICON_GADGET_SWID ))
#define EXPERT_OPTIONS_TOGGLE_BUTTON (UxGetWidget(EXPERT_OPTIONS_TOGGLE_BUTTON_SWID))
#define XPRT_OPTION_FORM (UxGetWidget(XPRT_OPTION_FORM_SWID))
#define CA_OPEN_FILE (UxGetWidget(OPEN_FILE_SWID))
#define FILE_CHARACTERISTICS (UxGetWidget(FILE_CHARACTERISTICS_SWID))
#define WINDOW_TYPE (UxGetWidget(WINDOW_TYPE_SWID))
#define COLOR_MONO_OPTION (UxGetWidget(COLOR_MONO_OPTION_SWID))
/***************************************************************************/
/* */
/* Structure Access Macros */
/* */
/***************************************************************************/
#define CA_ActionName(ad_struct) (((ActionData *)(ad_struct))->pszName)
#define CA_DblClkAction(ad_struct) (((ActionData *)(ad_struct))->pszCmd)
#define CA_ActionHelpText(ad_struct) (((ActionData *)(ad_struct))->pszHelp)
#define CA_Filetypes(ad_struct) (((ActionData *)(ad_struct))->papFiletypes)
#define CA_FiletypesCount(ad_struct) (((ActionData *)(ad_struct))->cFiletypes)
#define CA_FiletypesForActionList(ad_struct,l) (((ActionData *)(ad_struct))[l]->pszName)
#define CA_ActionOpensText(ad_struct) (((ActionData *)(ad_struct))->pszPrompt)
#define CA_WindowTypeSetting(ad_struct) (((ActionData *)(ad_struct))->fsFlags)
#define CA_Icon(ad_struct) (((ActionData *)(ad_struct))->pszIcon)
#define CA_XprtMode(ad_struct) (((ActionData *)(ad_struct))->)
/*****************************************************************************/
/* Function Declarations */
/*****************************************************************************/
Widget create_applicationShell1(swidget);
void activateCB_CA_MB_FileSave(Widget, XtPointer, XtPointer);
#endif /* _CREATEACTIONAPPSHELL_H_INCLUDED */

View File

@@ -0,0 +1,21 @@
!######################################################################
!#
!# Dtcreate
!#
!# Common Desktop Environment (CDE)
!#
!# Application Defaults for the dtcreate client
!#
!# (c) Copyright 1993, 1994 Hewlett-Packard Company
!# (c) Copyright 1993, 1994 International Business Machines Corp.
!# (c) Copyright 1993, 1994 Sun Microsystems, Inc.
!# (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary
!# of Novell, Inc.
!#
!######################################################################
#include "Dt"
Dtcreate*FC_StartByteTextField.columns: %|nls-2-#6#|
Dtcreate*FC_AndLabel1.fontList: %|nls-3-#|
Dtcreate*FC_AndLabel2.fontList: %|nls-3-#|

View File

@@ -0,0 +1,57 @@
/* $XConsortium: ErrorDialog.c /main/5 1996/10/15 14:46:17 rswiston $ */
/*******************************************************************************
ErrorDialog.c
Associated Header file: ErrorDialog.h
*******************************************************************************/
#include <stdio.h>
#include <Xm/Xm.h>
#include "UxXt.h"
#include "dtcreate.h"
#define CONTEXT_MACRO_ACCESS 1
#include "ErrorDialog.h"
#undef CONTEXT_MACRO_ACCESS
/******************************************************************************/
/* activateCB_ErrorDialog_OkButton */
/******************************************************************************/
void activateCB_ErrorDialog_OkButton( Widget UxWidget,
XtPointer UxClientData,
XtPointer UxCallbackArg)
{
XtDestroyWidget(XtParent(UxWidget));
}
/******************************************************************************/
/* display_error_message - display desired message in error dialog */
/* INPUT: char *message - message to display in dialog box */
/* OUTPIT: none */
/******************************************************************************/
void display_error_message (Widget parent, char *message)
{
ErrorDialog = XmCreateErrorDialog(parent, "errorDialog", NULL, 0);
XtUnmanageChild (XmMessageBoxGetChild (ErrorDialog, XmDIALOG_CANCEL_BUTTON));
XtUnmanageChild (XmMessageBoxGetChild (ErrorDialog, XmDIALOG_HELP_BUTTON));
XtAddCallback( ErrorDialog, XmNokCallback,
(XtCallbackProc) activateCB_ErrorDialog_OkButton,
(XtPointer) NULL );
XtVaSetValues (ErrorDialog,
RES_CONVERT(XmNdialogTitle, GETMESSAGE(6, 31, "Create Action - Error")),
RES_CONVERT(XmNmessageString, message),
NULL);
XtManageChild (ErrorDialog);
return;
}
/*******************************************************************************
END OF FILE
*******************************************************************************/

View File

@@ -0,0 +1,26 @@
/* $XConsortium: ErrorDialog.h /main/4 1995/11/01 16:07:01 rswiston $ */
/*******************************************************************************
ErrorDialog.h
This header file is included by ErrorDialog.c
*******************************************************************************/
#ifndef _ERRORDIALOG_H_INCLUDED
#define _ERRORDIALOG_H_INCLUDED
#include <stdio.h>
#include <Xm/MessageB.h>
extern Widget ErrorDialog;
/*******************************************************************************
Declarations of global functions.
*******************************************************************************/
void display_error_message (Widget parent, char *message);
#endif /* _ERRORDIALOG_H_INCLUDED */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,114 @@
/* $XConsortium: FileCharacteristics.h /main/5 1995/11/01 16:07:48 rswiston $ */
/*******************************************************************************
FileCharacteristics.h
This header file is included by FileCharacteristics.c
*******************************************************************************/
#ifndef _FILECHARACTERISTICS_H_INCLUDED
#define _FILECHARACTERISTICS_H_INCLUDED
#include <stdio.h>
#include <Xm/Xm.h>
#include <Xm/MwmUtil.h>
#include <Xm/DialogS.h>
#include <Xm/MenuShell.h>
#include "UxXt.h"
#include <Xm/RowColumn.h>
#include <Xm/Form.h>
#include <Xm/ToggleBG.h>
#include <Xm/TextF.h>
#include <Xm/Label.h>
#include <Xm/PushBG.h>
#include <Xm/Form.h>
/*******************************************************************************
The definition of the context structure:
If you create multiple copies of your interface, the context
structure ensures that your callbacks use the variables for the
correct copy.
For each swidget in the interface, each argument to the Interface
function, and each variable in the Interface Specific section of the
Declarations Editor, there is an entry in the context structure.
and a #define. The #define makes the variable name refer to the
corresponding entry in the context structure.
*******************************************************************************/
#if 0
typedef struct
{
Widget UxFC_OkButton;
Widget UxFC_ClearButton;
Widget UxFC_CancelButton;
Widget UxFC_HelpButton;
Widget UxFC_MainLabel;
Widget UxFC_NamePatternLabel;
Widget UxFC_PermissionLabel;
Widget UxFC_PermissionToggle;
Widget UxFC_ContentsLabel;
Widget UxFC_ContentsBox;
Widget UxFC_TypeRowColumn;
Widget UxFC_StartByteLabel;
Widget UxFC_TypeLabel;
Widget UxFC_ContentsPatternLabel;
Widget UxFC_EndByteLabel;
Widget UxFC_ContentsToggle;
Widget UxFC_NameOrPathToggle;
swidget UxUxParent;
} _UxCFileCharacteristics;
#ifdef CONTEXT_MACRO_ACCESS
static _UxCFileCharacteristics *UxFileCharacteristicsContext;
#define FC_OkButton UxFileCharacteristicsContext->UxFC_OkButton
#define FC_ClearButton UxFileCharacteristicsContext->UxFC_ClearButton
#define FC_CancelButton UxFileCharacteristicsContext->UxFC_CancelButton
#define FC_HelpButton UxFileCharacteristicsContext->UxFC_HelpButton
#define FC_MainLabel UxFileCharacteristicsContext->UxFC_MainLabel
#define FC_NamePatternLabel UxFileCharacteristicsContext->UxFC_NamePatternLabel
#define FC_PermissionLabel UxFileCharacteristicsContext->UxFC_PermissionLabel
#define FC_PermissionToggle UxFileCharacteristicsContext->UxFC_PermissionToggle
#define FC_ContentsLabel UxFileCharacteristicsContext->UxFC_ContentsLabel
#define FC_ContentsBox UxFileCharacteristicsContext->UxFC_ContentsBox
#define FC_TypeRowColumn UxFileCharacteristicsContext->UxFC_TypeRowColumn
#define FC_StartByteLabel UxFileCharacteristicsContext->UxFC_StartByteLabel
#define FC_TypeLabel UxFileCharacteristicsContext->UxFC_TypeLabel
#define FC_ContentsPatternLabel UxFileCharacteristicsContext->UxFC_ContentsPatternLabel
#define FC_EndByteLabel UxFileCharacteristicsContext->UxFC_EndByteLabel
#define FC_ContentsToggle UxFileCharacteristicsContext->UxFC_ContentsToggle
#define FC_NameOrPathToggle UxFileCharacteristicsContext->UxFC_NameOrPathToggle
#define UxParent UxFileCharacteristicsContext->UxUxParent
#endif /* CONTEXT_MACRO_ACCESS */
extern Widget FileCharacteristics;
extern Widget FC_PermissionText;
extern Widget FC_AndLabel2;
extern Widget FC_ContentsPatternText;
extern Widget FC_StringToggle;
extern Widget FC_ByteToggle;
extern Widget FC_ShortToggle;
extern Widget FC_LongToggle;
extern Widget FC_StartByteTextField;
extern Widget FC_EndByteTextField;
extern Widget FC_NameOrPathText;
extern Widget FC_AndLabel1;
#endif
/*******************************************************************************
Declarations of global functions.
*******************************************************************************/
Widget create_FileCharacteristics(swidget _UxUxParent);
void GetPermissionsPattern(char **ppszPermPattern);
void init_FileCharacteristics_dialog_fields(FiletypeData *pFtD);
void clear_FileCharacteristics_dialog_fields(void);
void ParseAndUpdateID(FiletypeData *pFtD);
Boolean FileCharCheckFields(void);
#endif /* _FILECHARACTERISTICS_H_INCLUDED */

View File

@@ -0,0 +1,115 @@
XCOMM $XConsortium: Imakefile /main/9 1996/10/09 14:04:06 drk $
DESKTOP_VERSION_STRING = DesktopVersionString
XCOMM
XCOMM Imakefile: for DT CreateAction
XCOMM
/* General case INCLUDES DEFINES LOCAL_LIBRARIES
* Each individual architecture may have more or less of the above.
* Use EXTRA_DEFINES and EXTRA_INCLUDES to add defines and includes
* to an individual architecture. There is no equivalent for
* LOCAL_LIBRARIES.
* USE_libraryname in LOCAL_LIBRARIES is by default empty.
* It should be set when necessary to the real library macro name.
*/
INCLUDES = -I.
#if defined (SunArchitecture)
DEPLIBS = $(DEPDTWIDGETLIB) $(DEPDTSVCLIB) \
$(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXLIB)
LOCAL_LIBRARIES = $(DTWIDGETLIB) $(DTSVCLIB) \
$(TTLIB) $(XMLIB) $(XTOOLLIB) $(XLIB)
#else
DEPLIBS = $(DEPDTHELPLIB) $(DEPDTWIDGETLIB) $(DEPDTSVCLIB) \
$(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXLIB)
LOCAL_LIBRARIES = $(DTHELPLIB) $(DTWIDGETLIB) $(DTSVCLIB) \
$(TTLIB) $(XMLIB) $(XTOOLLIB) $(XLIB)
#endif /* SunArchitecture */
SYS_LIBRARIES = -lm
#ifdef AlphaArchitecture
EXTRA_DEFINES = -D_NO_PROTO
#endif
#ifdef HPArchitecture
EXTRA_DEFINES = -Aa +e -DANSICPP -D_POSIX_SOURCE=1 -D_HPUX_SOURCE
#endif
#ifdef RsArchitecture
EXTRA_DEFINES =
SYS_LIBRARIES = -lm -liconv
#endif
#if defined (SunArchitecture)
SYS_LIBRARIES = -lm -ldl -L/opt/SUNWspro/SC2.0.1 -lC
#endif /* SunArchitecture */
#if defined (USLArchitecture)
EXTRA_DEFINES = -D_NO_PROTO
SYS_LIBRARIES = -lm -ldl -lgen
#endif /* SunArchitecture */
#if defined (UXPArchitecture)
EXTRA_DEFINES = -Xt -D_NO_PROTO
SYS_LIBRARIES = -lm -ldl -lgen
#endif /* UXPArchitecture */
SRCS = \
main.c \
AddFiletype.c \
Confirmed.c \
CreateActionAppShell.c \
FileCharacteristics.c \
OpenFile.c \
UxXt.c \
ca_aux.c \
cmncbs.c \
cmnutils.c \
cmnrtns.c \
ErrorDialog.c \
fileio.c \
af_aux.c \
icon_selection_dialog.c \
parser.c \
version.c
OBJS = \
main.o \
AddFiletype.o \
Confirmed.o \
CreateActionAppShell.o \
FileCharacteristics.o \
OpenFile.o \
UxXt.o \
ca_aux.o \
cmncbs.o \
cmnutils.o \
cmnrtns.o \
ErrorDialog.o \
fileio.o \
af_aux.o \
icon_selection_dialog.o \
parser.o \
version.o
NormalLibraryObjectRule()
ComplexProgramTarget(dtcreate)
/***** For dtge make a client_OBJS.o using client_main.o ******/
/***** This implies the existence of client_main.c ******/
/***** dtge hidden symbols *******/
#ifdef BuildHugeObject
#ifdef HPArchitecture
#ifdef __hp9000s300
HIDDEN_SYMBOLS = -h _main -h _HelpOnItemCB -h _CreateHelpDialog \
-h _DisplayHelpDialog -h _ChangeTitle
#else
HIDDEN_SYMBOLS = -h main -h HelpOnItemCB -h CreateHelpDialog \
-h DisplayHelpDialog -h ChangeTitle
#endif
#endif
SpecialRelocatableTarget(dtcreate,$(HIDDEN_SYMBOLS),$(OBJS))
#endif

View File

@@ -0,0 +1,203 @@
/* $XConsortium: OpenFile.c /main/6 1996/10/17 14:06:40 rswiston $ */
/*******************************************************************************
OpenFile.c
Associated Header file: OpenFile.h
*******************************************************************************/
#include <stdio.h>
#include <Xm/Xm.h>
#include <Xm/MwmUtil.h>
#include <Xm/DialogS.h>
#include <Xm/MenuShell.h>
#include <Xm/FileSB.h>
#include <Dt/Icon.h>
#include "UxXt.h"
#include "dtcreate.h"
#include "cmnrtns.h"
#include "ca_aux.h"
#include "fileio.h"
#define CONTEXT_MACRO_ACCESS 1
#include "OpenFile.h"
#undef CONTEXT_MACRO_ACCESS
extern XtPointer
_XmStringUngenerate(XmString, XmStringTag, XmTextType, XmTextType);
/*******************************************************************************
The following are callback functions.
*******************************************************************************/
static void cancelCB_OpenFile( Widget UxWidget,
XtPointer UxClientData,
XtPointer UxCallbackArg )
{
_UxCOpenFile *UxSaveCtx, *UxContext;
UxSaveCtx = UxOpenFileContext;
UxOpenFileContext = UxContext =
(_UxCOpenFile *) UxGetContext( UxWidget );
{
UxPopdownInterface(UxWidget);
}
UxOpenFileContext = UxSaveCtx;
}
static void okCallback_OpenFile( Widget UxWidget,
XtPointer UxClientData,
XtPointer UxCallbackArg )
{
_UxCOpenFile *UxSaveCtx, *UxContext;
XmFileSelectionBoxCallbackStruct *cbs;
/*char *text;*/
int rc;
ActionData ADTmp;
UxSaveCtx = UxOpenFileContext;
UxOpenFileContext = UxContext =
(_UxCOpenFile *) UxGetContext( UxWidget );
{
/********************************************************************/
/* Call file parsing code here! */
/********************************************************************/
cbs = (XmFileSelectionBoxCallbackStruct *)UxCallbackArg;
if (pszFileToEdit) {
XtFree(pszFileToEdit);
}
pszFileToEdit =
_XmStringUngenerate(cbs->value, NULL,
XmCHARSET_TEXT, XmCHARSET_TEXT);
if (pszFileToEdit != (char *)NULL) {
memset(&ADTmp, 0, sizeof(ActionData));
rc = OpenDefinitionFile(pszFileToEdit, &ADTmp);
/*XtFree(text);*/
/*****************************************************************/
/* If everything ok, then clear out data from action structure */
/* and store new data. */
/*****************************************************************/
if (!rc) {
FreeAndClearAD(&AD);
memcpy(&AD, &ADTmp, sizeof(ActionData));
}
}
UxPopdownInterface (UxWidget);
/********************************************************************/
/* If successfully opened and parsed file, then init the fields of */
/* the main window. */
/********************************************************************/
if (!rc) {
clear_CreateActionAppShell_fields();
writeCAToGUI(&AD);
}
}
UxOpenFileContext = UxSaveCtx;
}
static void helpCallback_OpenFile( Widget UxWidget,
XtPointer UxClientData,
XtPointer UxCallbackArg )
{
_UxCOpenFile *UxSaveCtx, *UxContext;
UxSaveCtx = UxOpenFileContext;
UxOpenFileContext = UxContext =
(_UxCOpenFile *) UxGetContext( UxWidget );
{
DisplayHelpDialog(UxWidget, HELP_OPENFILE, UxCallbackArg);
}
UxOpenFileContext = UxSaveCtx;
}
/*******************************************************************************
The 'build_' function creates all the widgets
using the resource values specified in the Property Editor.
*******************************************************************************/
static Widget _Uxbuild_OpenFile(void)
{
Widget _UxParent;
/* Creation of OpenFile */
_UxParent = XtVaCreatePopupShell( "OpenFile_shell",
xmDialogShellWidgetClass, UxTopLevel,
XmNx, 200,
XmNy, 290,
XmNwidth, 398,
XmNheight, 500,
XmNallowShellResize, TRUE,
XmNshellUnitType, XmPIXELS,
XmNtitle, GETMESSAGE(12, 25, "Create Action - Open"),
NULL );
OpenFile = XtVaCreateWidget( "OpenFile",
xmFileSelectionBoxWidgetClass,
_UxParent,
XmNresizePolicy, XmRESIZE_GROW,
XmNunitType, XmPIXELS,
XmNwidth, 398,
XmNheight, 500,
RES_CONVERT( XmNdialogTitle, GETMESSAGE(12, 25, "Create Action - Open")),
RES_CONVERT( XmNdirectory, "" ),
RES_CONVERT( XmNtextString, "" ),
RES_CONVERT( XmNdirSpec, "" ),
XmNdialogType, XmDIALOG_FILE_SELECTION,
XmNtextColumns, 20,
XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL,
XmNallowOverlap, FALSE,
RES_CONVERT( XmNchildPlacement, "place_below_selection" ),
XmNdefaultPosition, FALSE,
RES_CONVERT( XmNdirMask, "" ),
RES_CONVERT( XmNpattern, "" ),
NULL );
XtAddCallback( OpenFile, XmNcancelCallback,
(XtCallbackProc) cancelCB_OpenFile,
(XtPointer) UxOpenFileContext );
XtAddCallback( OpenFile, XmNokCallback,
(XtCallbackProc) okCallback_OpenFile,
(XtPointer) UxOpenFileContext );
XtAddCallback( OpenFile, XmNhelpCallback,
(XtCallbackProc) helpCallback_OpenFile,
(XtPointer) UxOpenFileContext );
XtVaSetValues(OpenFile, XmNuserData, OpenFile, NULL);
UxPutContext( OpenFile, (char *) UxOpenFileContext );
XtAddCallback( OpenFile, XmNdestroyCallback,
(XtCallbackProc) UxDestroyContextCB,
(XtPointer) UxOpenFileContext);
return ( OpenFile );
}
/*******************************************************************************
The following is the 'Interface function' which is the
external entry point for creating this interface.
This function should be called from your application or from
a callback function.
*******************************************************************************/
Widget create_OpenFile(void)
{
Widget rtrn;
_UxCOpenFile *UxContext;
UxOpenFileContext = UxContext =
(_UxCOpenFile *) UxNewContext( sizeof(_UxCOpenFile), False );
rtrn = _Uxbuild_OpenFile();
return(rtrn);
}
/*******************************************************************************
END OF FILE
*******************************************************************************/

View File

@@ -0,0 +1,54 @@
/* $XConsortium: OpenFile.h /main/4 1995/11/01 16:08:37 rswiston $ */
/******************************************************************************
OpenFile.h
This header file is included by OpenFile.c
******************************************************************************/
#ifndef _OPENFILE_H_INCLUDED
#define _OPENFILE_H_INCLUDED
#include <stdio.h>
#include <Xm/Xm.h>
#include <Xm/MwmUtil.h>
#include <Xm/DialogS.h>
#include <Xm/MenuShell.h>
#include "UxXt.h"
#include <Xm/FileSB.h>
/******************************************************************************
The definition of the context structure:
If you create multiple copies of your interface, the context
structure ensures that your callbacks use the variables for the
correct copy.
For each swidget in the interface, each argument to the Interface
function, and each variable in the Interface Specific section of the
Declarations Editor, there is an entry in the context structure.
and a #define. The #define makes the variable name refer to the
corresponding entry in the context structure.
******************************************************************************/
typedef struct
{
Widget UxOpenFile;
} _UxCOpenFile;
#ifdef CONTEXT_MACRO_ACCESS
static _UxCOpenFile *UxOpenFileContext;
#define OpenFile UxOpenFileContext->UxOpenFile
#endif /* CONTEXT_MACRO_ACCESS */
/*******************************************************************************
Declarations of global functions.
*******************************************************************************/
Widget create_OpenFile(void);
#endif /* _OPENFILE_H_INCLUDED */

View File

@@ -0,0 +1,520 @@
static char sccsid[] = "@(#)96 1.4 com/config/UxXt.c, aic, aic324, 9317324f 5/12/93 15:40:01";
/*
* COMPONENT_NAME: AIC AIXwindows Interface Composer
*
* ORIGINS: 58
*
*
* Copyright IBM Corporation 1991, 1993
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation, and that the name of IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
* OR PERFORMANCE OF THIS SOFTWARE.
*/
/*---------------------------------------------------------------------
* $XConsortium: UxXt.c /main/4 1995/11/01 16:08:57 rswiston $
*---------------------------------------------------------------------
*
*
* Copyright (c) 1991, Visual Edge Software Ltd.
*
* ALL RIGHTS RESERVED. Permission to use, copy, modify, and
* distribute this software and its documentation for any purpose
* and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Visual Edge Software not be
* used in advertising or publicity pertaining to distribution of
* the software without specific, written prior permission. The year
* included in the notice is the year of the creation of the work.
*-------------------------------------------------------------------*/
/*------------------------------------------------------------------------
* UxXt.c
*-----------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include <X11/Intrinsic.h>
#include <X11/Shell.h>
#include <X11/StringDefs.h>
#include <X11/Xutil.h>
#include <X11/X.h>
#include <X11/Xmd.h>
#include <X11/Xlib.h>
#include <Xm/Xm.h>
#include <Xm/DialogS.h>
#ifdef UIL_CODE
#include <Mrm/MrmPublic.h>
#endif /* UIL_CODE */
#include "UxXt.h"
static XContext xcontext_id = 0;
/******************************************************************************
NAME: GetTrueToplevel( wgt )
INPUT: Widget wgt - the top user-created widget
RETURN: Widget - the shell widget
DESCRIPTION: Returns the true toplevel of that interface.
This is needed for implicit shells where the widget passed to
one of the Ux functions is not always the shell.
CREATION: Visual Edge Software April 6 1991
-----------------------------------------------------------------------------*/
Widget GetTrueToplevel( Widget wgt )
{
while (wgt && !XtIsShell(wgt))
{
wgt = XtParent(wgt);
}
return wgt;
}
/******************************************************************************
NAME: handle_dialog_child( wgt, manage_func )
INPUT: Widget wgt - the dialogShellWidget
void (*manage_func)() - either XtManageChild
or XtUnmanageChild
RETURN: int - UX_NO_ERROR if successfull
UX_ERROR otherwise
DESCRIPTION: Handles the popping up or popping down of dialog shells
by managing or unmanaging their children.
CREATION: Visual Edge Software Sept 19/91
-----------------------------------------------------------------------------*/
static int handle_dialog_child( Widget wgt, void (*manage_func)(Widget) )
{
int i, num_children;
Widget *children;
int error_flag = UX_ERROR;
XtVaGetValues( wgt,
XmNnumChildren, &num_children,
XmNchildren, &children,
NULL );
/*-----------------------------------------------------
* We manage/unmanage the first rectObj child in the list.
* Note that the check for rectObjClass is necessary since
* some implementations of Motif add protocol children to
* the dialogShell. Additionally, when the LANG is set to
* Japanese, a widget of class Core is created. This widget
* should not be managed. We'll skip it.
*-----------------------------------------------------*/
for (i = 0; i < num_children; i++)
{
if ( XtIsSubclass( children[i], rectObjClass ) &&
(XtClass (children[i]) != coreWidgetClass))
{
(*manage_func)(children[i]);
error_flag = UX_NO_ERROR;
break;
}
}
return ( error_flag );
}
/******************************************************************************
NAME: popup_dialog( wgt, grab_flag )
INPUT: Widget wgt - dialogShell to pop up
XtGrabKind grab_flag - the grab flag
RETURN: void
DESCRIPTION: Pops up a dialogShell.
CREATION: Visual Edge Software Sept 19/91
-----------------------------------------------------------------------------*/
static void popup_dialog( Widget wgt, XtGrabKind grab_flag )
{
if ( handle_dialog_child( wgt, XtManageChild ) == UX_ERROR )
XtPopup( wgt, grab_flag );
}
/******************************************************************************
NAME: UxPopupInterface( wgt, grab_flag )
INPUT: Widget wgt - Widget to popup
XtGrabKind grab_flag - grab flag
RETURN: int UX_ERROR or UX_NO_ERROR
DESCRIPTION: Popups up an interface. The widget should be a toplevel widget.
Note that special handling is required for dialogShells since
those are popped up by managing their children if they have
some.
The grab_flag could be any of:
no_grab (XtGrabNone)
nonexclusive_grab (XtGrabNonexclusive)
exclusive_grab (XtGrabExclusive)
CREATION: Visual Edge Software April 6 1991
-----------------------------------------------------------------------------*/
int UxPopupInterface( Widget wgt, XtGrabKind grab_flag )
{
if (!(wgt = GetTrueToplevel(wgt)))
return ( UX_ERROR );
if ( XtIsSubclass( wgt, xmDialogShellWidgetClass ) )
{
popup_dialog( wgt, grab_flag );
}
else
{
XtPopup( wgt, grab_flag );
}
return ( UX_NO_ERROR );
}
/******************************************************************************
NAME: popdown_dialog( wgt )
INPUT: Widget wgt - dialogShell to popdown
RETURN: void
DESCRIPTION: Pops down a dialogShell.
CREATION: Visual Edge Software Sept 19/91
-----------------------------------------------------------------------------*/
static void popdown_dialog( Widget wgt )
{
if ( handle_dialog_child( wgt, XtUnmanageChild ) == UX_ERROR )
XtPopdown( wgt );
}
/******************************************************************************
NAME: UxPopdownInterface( wgt )
INPUT: Widget wgt - Widget to popdown
RETURN: int UX_ERROR / UX_NO_ERROR
DESCRIPTION: Pops down an interface. The widget should be a toplevel widget.
Note that special handling is required for dialogShells since
those are popped down by unmanaging their children if they have
some.
CREATION: Visual Edge Software April 6 1991
-----------------------------------------------------------------------------*/
int UxPopdownInterface( Widget wgt )
{
if (!(wgt = GetTrueToplevel(wgt)))
return ( UX_ERROR );
if ( XtIsSubclass( wgt, xmDialogShellWidgetClass ) )
{
popdown_dialog( wgt );
}
else
{
XtPopdown( wgt );
}
return ( UX_NO_ERROR );
}
/******************************************************************************
NAME: UxDeleteContextCB( wgt, client_data, call_data )
INPUT: Widget wgt - widget causing the callback
XtPointer client_data - not used
XtPointer call_data - not used
RETURN: void
DESCRIPTION: Deletes the X context entry.
EXT REFERENCES: UxTopLevel, xcontext_id
CREATION: Visual Edge Software April 6 1991
-----------------------------------------------------------------------------*/
void UxDeleteContextCB( Widget wgt, XtPointer client_data,
XtPointer _call_data )
{
XtPointer call_data = _call_data;
(void) XDeleteContext( XtDisplay( UxTopLevel ),
(Window) wgt,
(XContext) client_data );
}
/******************************************************************************
NAME: UxPutContext( wgt, context )
INPUT: Widget wgt - Widget
XtPointer context - context pointer
RETURN: int UX_ERROR / UX_NO_ERROR
DESCRIPTION: Uses the X Context manager to store the given context pointer
in a memory location that is indexed by the given widget id.
Also adds a destroyCallback to delete that context when the
widget is destroyed.
EXT REFERENCES: UxTopLevel, xcontext_id
EXT EFFECTS: xcontext_id
CREATION: Visual Edge Software April 6 1991
-----------------------------------------------------------------------------*/
int UxPutContext( Widget wgt, caddr_t context )
{
int status;
if ( xcontext_id == 0 )
xcontext_id = XUniqueContext();
if ( wgt == NULL )
return ( UX_ERROR );
status = XSaveContext( XtDisplay( UxTopLevel ),
(Window) wgt,
xcontext_id,
(char *) context );
if ( status != 0 )
return ( UX_ERROR );
XtAddCallback (wgt, XmNdestroyCallback,
UxDeleteContextCB, (XtPointer) xcontext_id);
return ( UX_NO_ERROR );
}
/******************************************************************************
NAME: UxGetContext( wgt )
INPUT: Widget wgt - widget
RETURN: caddr_t - the context pointer
DESCRIPTION: Uses the X Context manager to find the context pointer
stored in a memory location indexed by the given widget id.
EXT REFERENCES: UxTopLevel, xcontext_id
CREATION: Visual Edge Software April 6 1991
-----------------------------------------------------------------------------*/
caddr_t UxGetContext( Widget wgt )
{
int status;
caddr_t context;
if ( wgt == NULL )
return ( (caddr_t) NULL );
status = XFindContext( XtDisplay( UxTopLevel ),
(Window) wgt,
xcontext_id,
&context );
if ( status != 0 )
return ( (caddr_t) NULL );
return ( context );
}
/******************************************************************************
NAME: DelayedFreeData ( client_data, id )
INPUT: XtPointer client_data - pointer to be freed
XtIntervalId *id;
RETURN: void
DESCRIPTION: This XtTimerCallbackProc function simply frees the client data.
CREATION: Visual Edge Software April 30 1993
-----------------------------------------------------------------------------*/
static void DelayedFreeData( XtPointer client_data, XtIntervalId *_id)
{
XtIntervalId *id = _id;
if (client_data != NULL) {
XtFree((char *) client_data);
}
}
/******************************************************************************
NAME: UxDestroyContextCB ( wgt, client_data, call_data )
INPUT: Widget wgt - widget
XtPointer client_data - pointer to be freed
XtPointer call_data - not used
RETURN: void
DESCRIPTION: This callback function registers a timeout to free the
context structure. This mechanism is used to ensure that
user's destroyCallbacks are executed before we free the
context structure.
CREATION: Visual Edge Software April 6 1991
-----------------------------------------------------------------------------*/
void UxDestroyContextCB( Widget _wgt, XtPointer client_data,
XtPointer _call_data )
{
Widget wgt = _wgt;
XtPointer call_data = _call_data;
if (client_data != NULL) {
XtAppAddTimeOut(UxAppContext, 0,
DelayedFreeData, client_data);
}
}
/******************************************************************************
NAME: UxConvertFontList( fontlist_str )
INPUT: char *fontlist_str - string form of fontlist
RETURN: XmFontList - fontlist
DESCRIPTION: Converts a fontlist from the resource-file string format
to the XmFontList type expected in C code.
The conversion is done by a call to the built-in Motif convertor
and the return value points into Xt's resource cache
and so the return value should NOT be XmFontListFree'd.
CREATION: Visual Edge Software June 17 1992
-----------------------------------------------------------------------------*/
XmFontList UxConvertFontList( char *fontlist_str )
{
XrmValue from, to;
XmFontList fontlist = NULL;
Boolean status;
from.size = strlen( fontlist_str ) + 1;
from.addr = fontlist_str;
to.size = sizeof(XmFontList);
to.addr = (caddr_t) &fontlist;
status = XtConvertAndStore( UxTopLevel,
XmRString, &from,
XmRFontList, &to );
return ( fontlist );
}
/******************************************************************************
NAME: static ConvertPixmap( file_name, depth )
INPUT: char *file_name - Pixmap file name
int depth - 0 for no depth specified
RETURN: Pixmap
DESCRIPTION: If the depth argument is 0 , then call XmGetPixmap (no depth
argument). Otherwise, call XmGetPixmapByDepth (with depth as
specified by the argument).
Since there is no way of knowing how long the Pixmaps will be
used, they are never destroyed. This is not a serious problem
since XmGetPixmap does not regenerate existing Pixmaps.
It simply keeps a reference count for the number of times a
Pixmap is returned.
CREATION: Visual Edge Software March 31, 1993
-----------------------------------------------------------------------------*/
static Pixmap ConvertPixmap( char *file_name, int depth )
{
XrmValue fg_from, fg_to, bg_from, bg_to;
Pixel fg, bg;
fg_from.size = strlen(XtDefaultForeground);
fg_from.addr = XtDefaultForeground;
fg_to.addr = (XPointer)&fg;
bg_from.size = strlen(XtDefaultBackground);
bg_from.addr = XtDefaultBackground;
bg_to.addr = (XPointer)&bg;
if (!XtConvertAndStore
(UxTopLevel, XtRString, &bg_from, XtRPixel, &bg_to)
|| !XtConvertAndStore
(UxTopLevel, XtRString, &fg_from, XtRPixel, &fg_to)
|| (fg == bg)) {
fg = WhitePixelOfScreen(XtScreen(UxTopLevel));
bg = BlackPixelOfScreen(XtScreen(UxTopLevel));
}
if (depth)
return (XmGetPixmapByDepth
(XtScreen(UxTopLevel), file_name, fg, bg, depth));
else
return (XmGetPixmap(XtScreen(UxTopLevel), file_name, fg, bg));
}
/******************************************************************************
NAME: UxConvertPixmap( file_name )
INPUT: char *file_name - pixmap file name
RETURN: Pixmap - Pixmap
DESCRIPTION: Call ConvertPixmap with depth 0 (Pixmap)
CREATION: Visual Edge Software March 31, 1993
-----------------------------------------------------------------------------*/
Pixmap UxConvertPixmap( char *file_name )
{
return (ConvertPixmap(file_name, 0));
}
/*------------------------------------------------------------------------
* NAME: UxNewContext
* <Allocate a context structure>
* INPUT: size -- of the desired structure
* isSubclass -- nonzero if the requester is a subclass,
* requiring that the result also be
* returned for the base.
* RETURNS: Pointer to a data area of (at least) the desired size.
*------------------------------------------------------------------------*/
void* UxNewContext (size_t size, int isSubclass)
{
static void* LastSubclassResult = 0;
static int LastResultSize = 0;
void * result;
if (LastSubclassResult) {
result = LastSubclassResult;
} else {
result = XtMalloc(size);
}
if (isSubclass) {
LastSubclassResult = result;
if (LastResultSize < size) {
LastResultSize = size;
}
} else {
LastSubclassResult = 0;
LastResultSize = 0;
}
return (result);
}
/** end of file ***/

View File

@@ -0,0 +1,202 @@
/* @(#)95 1.3 com/config/UxXt.h, aic, aic324, 9322324a 6/1/93 16:14:00 */
/*
* COMPONENT_NAME: AIC AIXwindows Interface Composer
*
* ORIGINS: 58
*
*
* Copyright IBM Corporation 1991, 1993
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation, and that the name of IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
* OR PERFORMANCE OF THIS SOFTWARE.
*/
/*---------------------------------------------------------------------
* $XConsortium: UxXt.h /main/4 1995/11/01 16:09:11 rswiston $
*---------------------------------------------------------------------
*
*
* Copyright (c) 1991, Visual Edge Software Ltd.
*
* ALL RIGHTS RESERVED. Permission to use, copy, modify, and
* distribute this software and its documentation for any purpose
* and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Visual Edge Software not be
* used in advertising or publicity pertaining to distribution of
* the software without specific, written prior permission. The year
* included in the notice is the year of the creation of the work.
*-------------------------------------------------------------------*/
/*****************************************************************************/
/* UxXt.h */
/*****************************************************************************/
#ifndef _UX_XT_H_INCLUDED
#define _UX_XT_H_INCLUDED
#include <Xm/Xm.h>
#ifdef UIL_CODE
#include <Mrm/MrmPublic.h>
#endif /* UIL_CODE */
#if 0
#ifdef __STDC__
typedef char *caddr_t;
#endif
#endif
/*-----------------------------------------------------
* UXORB_HEADER, if defined, is the include form for
* the header that defines the CORBA Environment type
* and exception type codes.
*
* You can specify a file with a compile option like
* -DUXORB_HEADER='<SomeOrb.h>'
*-----------------------------------------------------*/
#ifdef UXORB_HEADER
#include UXORB_HEADER
#else
/*
* In the absence of an ORB implementation,
* these minimal definitions satisfy our method dispatch code.
*/
typedef enum {
NO_EXCEPTION,
USER_EXCEPTION,
SYSTEM_EXCEPTION
} exception_type;
typedef struct Environment {
exception_type _major;
} Environment;
#endif /* UXORB_HEADER */
/*
* UxEnv is provided as a convenience for use in interface methods.
*/
extern Environment UxEnv;
/* The following macros are used in converting string values to the form
required by the widgets */
#define RES_CONVERT( res_name, res_value) \
XtVaTypedArg, (res_name), XmRString, (res_value), strlen(res_value) + 1
#define UxPutStrRes( wgt, res_name, res_value ) \
XtVaSetValues( wgt, RES_CONVERT( res_name, res_value ), NULL )
#ifndef UX_INTERPRETER /* Omit this section when interpreting the code */
/* The following macros are supplied for compatibility with swidget code */
#define swidget Widget
#define UxWidgetToSwidget(w) (w)
#define UxGetWidget(sw) (sw)
#define UxIsValidSwidget(sw) ((sw) != NULL)
#define NO_PARENT ((Widget) NULL)
#define UxThisWidget (UxWidget)
/* Macros needed for the method support code */
#define UxMalloc(a) (malloc(a))
#define UxRealloc(a,b) (realloc((a), (b)))
#define UxCalloc(a,b) (calloc((a), (b)))
#define UxStrEqual(a,b) (!strcmp((a),(b)))
#define UxGetParent(a) (XtParent((a)))
#define no_grab XtGrabNone
#define nonexclusive_grab XtGrabNonexclusive
#define exclusive_grab XtGrabExclusive
/* The following global variables are defined in the main() function */
extern XtAppContext UxAppContext;
extern Widget UxTopLevel;
extern Display *UxDisplay;
extern int UxScreen;
/* The following are error codes returned by the functions in UxXt.c */
#define UX_ERROR -1
#define UX_NO_ERROR 0
#ifdef UIL_CODE
extern void UxMrmFetchError(MrmHierarchy, char *, Widget, Cardinal);
extern MrmHierarchy UxMrmOpenHierarchy( char *);
extern void UxMrmRegisterClass( char *, Widget (*)(Widget, String, Arg *, Cardinal));
#endif /* UIL_CODE */
/* The following are declarations of the functions in UxXt.c */
extern int UxPopupInterface( Widget wgt, XtGrabKind grab_flag );
extern int UxPopdownInterface( Widget wgt );
extern int UxDestroyInterface( Widget wgt);
extern int UxPutContext( Widget wgt, caddr_t context );
extern caddr_t UxGetContext( Widget wgt );
extern void UxFreeClientDataCB( Widget wgt, XtPointer client_data,
XtPointer call_data );
extern void UxLoadResources( char *fname );
extern XmFontList UxConvertFontList( char *fontlist_str );
extern Pixmap UxConvertPixmap( char *file_name );
extern Pixmap UxConvert_bitmap( char *file_name );
extern wchar_t * UxConvertValueWcs( char *value_str );
extern void UxDestroyContextCB(Widget, XtPointer, XtPointer);
extern void UxDeleteContextCB( Widget, XtPointer, XtPointer);
extern XtArgVal UxRemoveValueFromArgList( Arg *args,
Cardinal *ptr_num_args,
String res_name );
extern Widget UxChildSite( Widget );
extern Widget UxRealWidget( Widget );
extern Widget GetTrueToplevel( Widget );
#ifdef __cplusplus
class _UxCInterface {
public:
virtual swidget childSite (Environment * pEnv) {
if (pEnv)
pEnv->_major = NO_EXCEPTION;
return 0;
}
virtual swidget UxChildSite (swidget sw);
protected:
swidget UxThis;
};
#define CPLUS_ADAPT_CONTEXT(CLASS) \
static inline \
CLASS* UxGetContext(CLASS*self) {return self;} \
static inline\
void* UxGetContext(swidget any) {return ::UxGetContext(any);}
#endif /* _cplusplus */
#endif /* ! UX_INTERPRETER */
#endif /* ! _UX_XT_H_INCLUDED */

View File

@@ -0,0 +1,660 @@
/* $TOG: af_aux.c /main/6 1998/04/06 13:14:19 mgreess $ */
/******************************************************************************/
/* */
/* af_aux - auxiliary functions for add filetype */
/* */
/* Functions to get/set values from/to interface. */
/* Callback routines for AF interface. */
/* */
/******************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <sys/signal.h>
#include <errno.h>
#include <unistd.h>
#include <X11/cursorfont.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <Xm/Xm.h>
#include <Xm/TextF.h>
#include <Xm/RowColumnP.h>
#include <Xm/MessageB.h>
#include <Xm/FileSB.h>
#include <sys/stat.h>
#if defined(AIXV3)
# include <sys/dir.h>
#else
# if defined(__osf__) || defined(linux)
# include <dirent.h>
# else
# include <sys/dirent.h>
# endif
#endif
#include <Dt/Icon.h>
#include "dtcreate.h"
#include "af_aux.h"
#include "cmnutils.h"
#include "cmnrtns.h"
/******************************************************************************/
/* */
/* External Variables */
/* */
/******************************************************************************/
/******************************************************************************/
/* */
/* Variables */
/* */
/******************************************************************************/
/******************************************************************************/
/* */
/* CALLBACK FUNCTIONS */
/* */
/******************************************************************************/
/******************************************************************************/
/* */
/* get_selected_filetype_icon - determines which filetype icon is currently */
/* selected. */
/* */
/* INPUT: none */
/* OUTPUT: Widget wid - id of selected icon gadget */
/* */
/******************************************************************************/
Widget get_selected_filetype_icon (void)
{
if (!last_filetype_pushed) {
last_filetype_pushed = AF_MED_IconGadget;
}
return (last_filetype_pushed);
}
/******************************************************************************/
/* */
/* activateCB_filetype_icon */
/* */
/* INPUT: Widget wid - id of icon gadget */
/* XtPointer client_data - not used */
/* XmPushButtonCallbackStruct *cbs - not used */
/* OUTPUT: none */
/* */
/******************************************************************************/
void activateCB_filetype_icon (Widget wid, XtPointer client_data,
DtIconCallbackStruct *cbs)
{
Time lts, mct = 0;
static Time prev_lts = 0;
if (cbs->reason == XmCR_ACTIVATE) {
#ifdef DEBUG
printf("In activate_filetype_icon callback.\n");
#endif
if (last_filetype_pushed && (last_filetype_pushed != wid)) {
XtVaSetValues(XtParent(last_filetype_pushed), XmNborderWidth, 0, NULL);
}
XtVaSetValues(XtParent(wid), XmNborderWidth, ICON_BORDER_WIDTH, NULL);
last_filetype_pushed = wid;
/********************************************************************/
/* This is the support needed to provide double-click functionality */
/* to the icon gadgets. When double-clicked, the icon editor will */
/* be launched. */
/********************************************************************/
XtVaSetValues(wid, XmNpushButtonClickTime, 0, NULL);
lts = XtLastTimestampProcessed(XtDisplay(wid));
mct = XtGetMultiClickTime(XtDisplay(wid));
if ((prev_lts + mct) > lts) {
prev_lts = XtLastTimestampProcessed(XtDisplay(wid));
} else {
prev_lts = XtLastTimestampProcessed(XtDisplay(wid));
return;
}
#ifdef DEBUG
printf("DblClick icon callback.\n");
#endif
activateCB_edit_icon(wid, CA_FILETYPE_ICONS, cbs);
}
return;
}
/******************************************************************************/
/* */
/* readAFFromGUI - */
/* */
/* */
/* */
/******************************************************************************/
void readAFFromGUI (FiletypeData *pFiletypedata)
{
getAF_FiletypeName(pFiletypedata);
getAF_HelpText(pFiletypedata);
getAF_OpenCmd(pFiletypedata);
getAF_PrintCmd(pFiletypedata);
getAF_Icons(pFiletypedata);
return;
}
/******************************************************************************/
/* */
/* getAF_FiletypeName - get name of filetype family */
/* */
/* INPUT: FiletypeData *pFiletypedata - pointer to filetype data structure */
/* OUTPUT: none */
/* */
/******************************************************************************/
void getAF_FiletypeName (FiletypeData *pFiletypedata)
{
GetWidgetTextString(AF_FileTypeNameTextField, &(pFiletypedata->pszName));
return;
}
/******************************************************************************/
/* */
/* getAF_HelpText - retrieve the Help text for the filetype */
/* */
/* INPUT: FiletypeData *pFiletypedata - pointer to filetype data structure */
/* OUTPUT: none */
/* */
/******************************************************************************/
void getAF_HelpText (FiletypeData *pFiletypedata)
{
GetWidgetTextString(AF_FiletypeHelpText, &(pFiletypedata->pszHelp));
return;
}
/******************************************************************************/
/* */
/* getAF_Icons - store temporary icon names. */
/* */
/* INPUT: FiletypeData *pFiletypedata - pointer to filetype data structure */
/* OUTPUT: none */
/* */
/******************************************************************************/
void getAF_Icons(FiletypeData *pFiletypedata)
{
IconData *pIconData;
/***************************************************************/
/* Medium Pixmap */
/***************************************************************/
pIconData = GetIconDataFromWid(AF_MED_IconGadget);
if ( (pIconData->pmDirtyBit) &&
(pIconData->pmFileName) &&
(strlen(pIconData->pmFileName)) ) {
pFiletypedata->pszMedPmIcon = XtMalloc(strlen(pIconData->pmFileName) + 1);
if (pFiletypedata->pszMedPmIcon) {
strcpy(pFiletypedata->pszMedPmIcon, pIconData->pmFileName);
}
}
pIconData->pmDirtyBit = False;
strcpy(pIconData->pmFileName, "");
/***************************************************************/
/* Medium Bitmap */
/***************************************************************/
if ( (pIconData->bmDirtyBit) &&
(pIconData->bmFileName) &&
(strlen(pIconData->bmFileName)) ) {
pFiletypedata->pszMedBmIcon = XtMalloc(strlen(pIconData->bmFileName) + 1);
if (pFiletypedata->pszMedBmIcon) {
strcpy(pFiletypedata->pszMedBmIcon, pIconData->bmFileName);
}
}
pIconData->bmDirtyBit = False;
strcpy(pIconData->bmFileName, "");
/***************************************************************/
/* Tiny Pixmap */
/***************************************************************/
pIconData = GetIconDataFromWid(AF_TINY_IconGadget);
if ( (pIconData->pmDirtyBit) &&
(pIconData->pmFileName) &&
(strlen(pIconData->pmFileName)) ) {
pFiletypedata->pszTinyPmIcon = XtMalloc(strlen(pIconData->pmFileName) + 1);
if (pFiletypedata->pszTinyPmIcon) {
strcpy(pFiletypedata->pszTinyPmIcon, pIconData->pmFileName);
}
}
pIconData->pmDirtyBit = False;
strcpy(pIconData->pmFileName, "");
/***************************************************************/
/* Tiny Bitmap */
/***************************************************************/
if ( (pIconData->bmDirtyBit) &&
(pIconData->bmFileName) &&
(strlen(pIconData->bmFileName)) ) {
pFiletypedata->pszTinyBmIcon = XtMalloc(strlen(pIconData->bmFileName) + 1);
if (pFiletypedata->pszTinyBmIcon) {
strcpy(pFiletypedata->pszTinyBmIcon, pIconData->bmFileName);
}
}
pIconData->bmDirtyBit = False;
strcpy(pIconData->bmFileName, "");
#if 0
Widget AF_wids[2];
int i;
AF_wids[0] = AF_MED_IconGadget;
AF_wids[1] = AF_TINY_IconGadget;
for (i=0; i < 2; i++) {
/* pixmap */
pIconData = GetIconDataFromWid(AF_wids[i]);
if ( (pIconData->pmDirtyBit) &&
(pIconData->pmFileName) &&
(strlen(pIconData->pmFileName)) ) {
pFiletypedata->pszMedPmIcon = XtMalloc(strlen(pIconData->pmFileName) + 1);
if (pFiletypedata->pszMedPmIcon) {
strcpy(pFiletypedata->pszMedPmIcon, pIconData->pmFileName);
}
}
pIconData->pmDirtyBit = False;
strcpy(pIconData->pmFileName, "");
/* bitmap */
if ( (pIconData->bmDirtyBit) &&
(pIconData->bmFileName) &&
(strlen(pIconData->bmFileName)) ) {
pFiletypedata->pszMedBmIcon = XtMalloc(strlen(pIconData->bmFileName) + 1);
if (pFiletypedata->pszMedBmIcon) {
strcpy(pFiletypedata->pszMedBmIcon, pIconData->bmFileName);
}
}
pIconData->bmDirtyBit = False;
strcpy(pIconData->bmFileName, "");
}
#endif
}
/******************************************************************************/
/* */
/* getAF_OpenCmd - retrieve the Open command string */
/* */
/* INPUT: FiletypeData *pFiletypedata - pointer to filetype data structure */
/* OUTPUT: none */
/* */
/******************************************************************************/
void getAF_OpenCmd (FiletypeData *pFiletypedata)
{
GetWidgetTextString(AF_OpenCmdText, &(pFiletypedata->pszOpenCmd));
return;
}
/******************************************************************************/
/* */
/* getAF_PrintCmd - retrieve Print command string */
/* */
/* INPUT: FiletypeData *pFiletypedata - pointer to filetype data structure */
/* OUTPUT: none */
/* */
/******************************************************************************/
void getAF_PrintCmd (FiletypeData *pFiletypedata)
{
GetWidgetTextString(AF_FiletypePrintCmdTextField, &(pFiletypedata->pszPrintCmd));
return;
}
/******************************************************************************/
/* */
/* init_AddFiletype_dialog_fields */
/* */
/* INPUT: FiletypeData * - pointer to FiletypeData structure */
/* OUTPUT: none */
/* */
/******************************************************************************/
void init_AddFiletype_dialog_fields(FiletypeData *pFtD)
{
char *pszIconFileName = (char *)NULL;
char *pszTmpFile;
if (pFtD->pszName) {
PutWidgetTextString(AF_FileTypeNameTextField, pFtD->pszName);
}
ParseAndUpdateID(pFtD);
if (pFtD->pszHelp) {
PutWidgetTextString(AF_FiletypeHelpText, pFtD->pszHelp);
}
if (pFtD->pszIcon) {
if (bShowPixmaps) {
/*************************/
/* Medium Pixmap */
/*************************/
if (pFtD->pszMedPmIcon) {
SET_ICONGADGET_ICON(AF_MED_IconGadget, pFtD->pszMedPmIcon);
} else {
pszIconFileName = (char *)NULL;
FIND_ICONGADGET_ICON(pFtD->pszIcon, pszIconFileName, DtMEDIUM);
pszTmpFile = GetCorrectIconType(pszIconFileName);
SET_ICONGADGET_ICON(AF_MED_IconGadget, pszTmpFile);
if (pszIconFileName) XtFree(pszIconFileName);
if (pszTmpFile) XtFree(pszTmpFile);
}
/*************************/
/* Tiny Pixmap */
/*************************/
if (pFtD->pszTinyPmIcon) {
SET_ICONGADGET_ICON(AF_TINY_IconGadget, pFtD->pszTinyPmIcon);
} else {
pszIconFileName = (char *)NULL;
FIND_ICONGADGET_ICON(pFtD->pszIcon, pszIconFileName, DtTINY);
pszTmpFile = GetCorrectIconType(pszIconFileName);
SET_ICONGADGET_ICON(AF_TINY_IconGadget, pszTmpFile);
if (pszIconFileName) XtFree(pszIconFileName);
if (pszTmpFile) XtFree(pszTmpFile);
}
} else {
/*************************/
/* Medium Pixmap */
/*************************/
if (pFtD->pszMedBmIcon) {
SET_ICONGADGET_ICON(AF_MED_IconGadget, pFtD->pszMedBmIcon);
} else {
pszIconFileName = (char *)NULL;
FIND_ICONGADGET_ICON(pFtD->pszIcon, pszIconFileName, DtMEDIUM);
pszTmpFile = GetCorrectIconType(pszIconFileName);
SET_ICONGADGET_ICON(AF_MED_IconGadget, pszTmpFile);
if (pszIconFileName) XtFree(pszIconFileName);
if (pszTmpFile) XtFree(pszTmpFile);
}
/*************************/
/* Tiny Pixmap */
/*************************/
if (pFtD->pszTinyBmIcon) {
SET_ICONGADGET_ICON(AF_TINY_IconGadget, pFtD->pszTinyBmIcon);
} else {
pszIconFileName = (char *)NULL;
FIND_ICONGADGET_ICON(pFtD->pszIcon, pszIconFileName, DtTINY);
pszTmpFile = GetCorrectIconType(pszIconFileName);
SET_ICONGADGET_ICON(AF_TINY_IconGadget, pszTmpFile);
if (pszIconFileName) XtFree(pszIconFileName);
if (pszTmpFile) XtFree(pszTmpFile);
}
}
#if 0
/*************************/
/* Tiny Pixmap */
/*************************/
pszIconFileName = (char *)NULL;
if (pFtD->pszTinyPmIcon) {
pszTmpFile = pFtD->pszTinyPmIcon;
} else {
FIND_ICONGADGET_ICON(pFtD->pszIcon, pszIconFileName, DtTINY);
pszTmpFile = pszIconFileName;
}
SET_ICONGADGET_ICON(AF_TINY_IconGadget, pszTmpFile);
if (pszIconFileName) XtFree(pszIconFileName);
} else {
/*************************/
/* Medium Bitmap */
/*************************/
pszIconFileName = (char *)NULL;
if (pFtD->pszMedBmIcon) {
pszTmpFile = pFtD->pszMedBmIcon;
} else {
FIND_ICONGADGET_ICON(pFtD->pszIcon, pszIconFileName, DtMEDIUM);
pszTmpFile = pszIconFileName;
}
SET_ICONGADGET_ICON(AF_MED_IconGadget, pszTmpFile);
if (pszIconFileName) XtFree(pszIconFileName);
/*************************/
/* Tiny Bitmap */
/*************************/
pszIconFileName = (char *)NULL;
if (pFtD->pszTinyBmIcon) {
pszTmpFile = pFtD->pszTinyBmIcon;
} else {
FIND_ICONGADGET_ICON(pFtD->pszIcon, pszIconFileName, DtTINY);
pszTmpFile = pszIconFileName;
}
SET_ICONGADGET_ICON(AF_TINY_IconGadget, pszTmpFile);
if (pszIconFileName) XtFree(pszIconFileName);
}
#endif
}
if (pFtD->pszOpenCmd) {
PutWidgetTextString(AF_OpenCmdText, pFtD->pszOpenCmd);
}
if (pFtD->pszPrintCmd) {
PutWidgetTextString(AF_FiletypePrintCmdTextField, pFtD->pszPrintCmd);
}
return;
}
/******************************************************************************/
/* */
/* clear_AddFiletype_dialog_fields */
/* */
/* INPUT: FiletypeData * - pointer to FiletypeData structure */
/* OUTPUT: none */
/* */
/******************************************************************************/
void clear_AddFiletype_dialog_fields(void)
{
/*char pszFile[MAXBUFSIZE];*/
clear_text(AF_FileTypeNameTextField);
clear_text(AF_IdCharacteristicsText);
clear_text(AF_FiletypeHelpText);
createCB_IconGadget(AF_MED_IconGadget, FALSE, Medium_Icon);
createCB_IconGadget(AF_TINY_IconGadget, FALSE, Tiny_Icon);
/*
SET_ICONGADGET_ICON_AND_EXT(AF_MED_IconGadget, af_med_icon_default, pszFile);
SET_ICONGADGET_ICON_AND_EXT(AF_TINY_IconGadget, af_tiny_icon_default, pszFile);
*/
clear_text(AF_OpenCmdText);
clear_text(AF_FiletypePrintCmdTextField);
return;
}
/******************************************************************************/
/* */
/* free_Filetypedata */
/* */
/* INPUT: FiletypeData * - pointer to FiletypeData structure */
/* OUTPUT: none */
/* */
/******************************************************************************/
void free_Filetypedata(FiletypeData *pFtD)
{
char buffer[MAXFILENAME];
#ifdef DEBUG
printf("Free FiletypeData structure\n"); /* debug */
#endif
if (pFtD->pszName) XtFree(pFtD->pszName);
#if DEBUG
printf("Freed Name\n");
#endif
if (pFtD->pszIcon) XtFree(pFtD->pszIcon);
if (pFtD->pszMedPmIcon) {
#if DEBUG
printf("free_Filetypedata: unlink '%s'\n", pFtD->pszMedPmIcon); /* debug */
#endif
unlink(pFtD->pszMedPmIcon);
XtFree(pFtD->pszMedPmIcon);
}
if (pFtD->pszMedBmIcon) {
#if DEBUG
printf("free_Filetypedata: unlink '%s'\n", pFtD->pszMedBmIcon); /* debug */
#endif
unlink(pFtD->pszMedBmIcon);
/**** remove the mask if it exists ****/
sprintf(buffer, "%s_m", pFtD->pszMedBmIcon);
unlink(buffer);
XtFree(pFtD->pszMedBmIcon);
}
if (pFtD->pszTinyPmIcon) {
#if DEBUG
printf("free_Filetypedata: unlink '%s'\n", pFtD->pszTinyPmIcon); /* debug */
#endif
unlink(pFtD->pszTinyPmIcon);
XtFree(pFtD->pszTinyPmIcon);
}
if (pFtD->pszTinyBmIcon) {
#if DEBUG
printf("free_Filetypedata: unlink '%s'\n", pFtD->pszTinyBmIcon); /* debug */
#endif
unlink(pFtD->pszTinyBmIcon);
/**** remove the mask if it exists ****/
sprintf(buffer, "%s_m", pFtD->pszTinyBmIcon);
unlink(buffer);
XtFree(pFtD->pszTinyBmIcon);
}
if (pFtD->pszHelp) XtFree(pFtD->pszHelp);
if (pFtD->pszOpenCmd) XtFree(pFtD->pszOpenCmd);
if (pFtD->pszPrintCmd) XtFree(pFtD->pszPrintCmd);
if (pFtD->pszPattern) XtFree(pFtD->pszPattern);
if (pFtD->pszPermissions) XtFree(pFtD->pszPermissions);
if (pFtD->pszContents) XtFree(pFtD->pszContents);
XtFree((char *) pFtD);
return;
}
/******************************************************************************/
/* */
/* AddFiletypeToList */
/* */
/* INPUT: none */
/* OUTPUT: none */
/* */
/******************************************************************************/
void AddFiletypeToList(void)
{
if (!XmListItemExists(CA_FiletypesList, XmStringCreateSimple(XmTextFieldGetString(AF_FileTypeNameTextField)))) {
XmListAddItem(CA_FiletypesList, XmStringCreateSimple(XmTextFieldGetString(AF_FileTypeNameTextField)), 0);
}
}
/******************************************************************************/
/* */
/* UpdateFiletypeDataArray */
/* */
/* INPUT: none */
/* OUTPUT: none */
/* */
/******************************************************************************/
void UpdateFiletypeDataArray(FiletypeData *pFtD)
{
FiletypeData **papArray;
int i;
/**************************************************************************/
/* Add this structure to the filetype array in the ActionData structure. */
/**************************************************************************/
papArray = (FiletypeData **) XtMalloc(sizeof(FiletypeData *) * (AD.cFiletypes + 1));
for (i=0; i < AD.cFiletypes; i++) {
papArray[i] = AD.papFiletypes[i];
}
papArray[AD.cFiletypes] = pFtD;
if (AD.papFiletypes) {
XtFree((char *) AD.papFiletypes);
}
AD.papFiletypes = papArray;
AD.cFiletypes++;
}
/******************************************************************************/
/* */
/* AddFiletypeCheckFields */
/* */
/* INPUT: none */
/* OUTPUT: FALSE - no errors found */
/* TRUE - found errors */
/* */
/******************************************************************************/
Boolean AddFiletypeCheckFields(void)
{
char *ptr = (char *)NULL;
Boolean bError = FALSE;
char *msgPtr, *errPtr;
/**************************************************************************/
/* Check if filetype name is present. */
/**************************************************************************/
if (!bError) {
ptr = (char *)NULL;
GetWidgetTextString(AF_FileTypeNameTextField, &ptr);
#ifdef DEBUG
printf("Filetype Family Name = '%s'\n", ptr);
#endif
if (!ptr) {
msgPtr = GETMESSAGE(8, 10, "The Datatype Family Name is missing.\n\
Enter a name in the 'Name of Datatype Family' field.");
errPtr = XtNewString(msgPtr);
display_error_message(AddFiletype, errPtr);
XtFree(errPtr);
XmProcessTraversal(AF_FileTypeNameTextField, XmTRAVERSE_CURRENT);
bError = TRUE;
} else {
XtFree(ptr);
}
}
/**************************************************************************/
/* Check if identifying characteristics are present. */
/**************************************************************************/
if (!bError) {
ptr = (char *)NULL;
GetWidgetTextString(AF_IdCharacteristicsText, &ptr);
#ifdef DEBUG
printf("Identifying Chars = '%s'\n", ptr);
#endif
if (!ptr) {
msgPtr = GETMESSAGE(8, 15,
"The Identifying Characteristics are missing.\n\
You must specify the characteristics before the datatype\n\
can be created. Select the Edit button next to the\n\
Identifying Characteristics list to specify the characteristics.");
errPtr = XtNewString(msgPtr);
display_error_message(AddFiletype, errPtr);
XtFree(errPtr);
XmProcessTraversal(AF_IdCharacteristicsEdit, XmTRAVERSE_CURRENT);
bError = TRUE;
} else {
XtFree(ptr);
}
}
return(bError);
}

View File

@@ -0,0 +1,75 @@
/* $XConsortium: af_aux.h /main/5 1995/11/01 16:09:45 rswiston $ */
/*****************************************************************************/
/* */
/* af_aux.h */
/* */
/* Header file for af_aux.c */
/* */
/*****************************************************************************/
#ifndef _AF_AUX_H_INCLUDED
#define _AF_AUX_H_INCLUDED
#include "UxXt.h"
#ifndef STORAGECLASS
#ifdef NOEXTERN
#define STORAGECLASS
#else
#define STORAGECLASS extern
#endif
#endif
/*****************************************************************************/
/* */
/* Constants */
/* */
/*****************************************************************************/
/*****************************************************************************/
/* */
/* Swidget Macro Definitions */
/* */
/*****************************************************************************/
#define FILE_CHARACTERISTICS_SWID (FileCharacteristics)
#define FA_TINY_ICON_BUTTON_SWID (AF_TinyIconButton)
#define FA_MED_ICON_BUTTON_SWID (AF_MedIconButton)
/*****************************************************************************/
/* */
/* Widget Macro Definitions */
/* */
/*****************************************************************************/
#define FILE_CHARACTERISTICS (UxGetWidget(FILE_CHARACTERISTICS_SWID))
#define FA_TINY_ICON_BUTTON (UxGetWidget(FA_TINY_ICON_BUTTON_SWID))
#define FA_MED_ICON_BUTTON (UxGetWidget(FA_MED_ICON_BUTTON_SWID))
/*****************************************************************************/
/* */
/* Function Declarations */
/* */
/*****************************************************************************/
void load_filetype_icons (Widget, XtPointer, XmFileSelectionBoxCallbackStruct *);
void clear_filetype_icon (void);
Widget get_selected_filetype_icon (void);
void activateCB_filetype_icon (Widget, XtPointer, DtIconCallbackStruct *);
void readAFFromGUI (FiletypeData *);
void getAF_FiletypeName (FiletypeData *);
void getAF_IDChars (FiletypeData *);
void getAF_HelpText (FiletypeData *);
void getAF_Icons (FiletypeData *);
void getAF_OpenCmd (FiletypeData *);
void getAF_PrintCmd (FiletypeData *);
void init_AddFiletype (FiletypeData *);
void free_Filetypedata(FiletypeData *);
void clear_AddFiletype_dialog_fields(void);
void AddFiletypeToList();
void UpdateFiletypeDataArray();
Boolean AddFiletypeCheckFields(void);
#endif /* _AF_AUX_H_INCLUDED */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,108 @@
/* $XConsortium: ca_aux.h /main/5 1995/11/01 16:10:18 rswiston $ */
/***************************************************************************/
/* */
/* Header file for ca_aux.c */
/* */
/***************************************************************************/
#ifndef _CA_AUX_H_INCLUDED
#define _CA_AUX_H_INCLUDED
#include "UxXt.h"
#if defined(USL) || defined(__uxp__)
#if !defined(_DIRENT_H)
#include <dirent.h>
#endif
#if !defined(_DtIcon_h_)
#include <Dt/Icon.h>
#endif
#endif
/***************************************************************************/
/* */
/* Constants */
/* */
/***************************************************************************/
#define EQUAL 0
#define NOT_EQUAL 1
/***************************************************************************/
/* */
/* Macros */
/* */
/***************************************************************************/
/***************************************************************************/
/* */
/* Function Declarations */
/* */
/***************************************************************************/
void readCAFromGUI (struct _ActionData *ca_struct);
void getCAactionName (struct _ActionData *ca_struct);
void getCAdblClkCmd (struct _ActionData *ca_struct);
void getCAactionHelpText (struct _ActionData *ca_struct);
void getCAactionOpensText (struct _ActionData *ca_struct);
void getCAwindowType (struct _ActionData *ca_struct);
void writeCAToGUI (struct _ActionData *ca_struct);
void putCAactionName (struct _ActionData *ca_struct);
void putCAdblClkCmd (struct _ActionData *ca_struct);
void putCAfileTypes (struct _ActionData *ca_struct);
void putCAactionOpensText (struct _ActionData *ca_struct);
void putCAwindowType (struct _ActionData *ca_struct);
void putCAactionHelpText (struct _ActionData *ca_struct);
void putCAactionIcons (struct _ActionData *ca_struct);
void putCAdropFiletypes (ActionData *pAD);
void set_ca_dialog_height (void);
Widget get_selected_action_icon (void);
Boolean CreateActionAppShellCheckFields(void);
void FreeAndClearAD(ActionData *pAD);
void clear_CreateActionAppShell_fields(void);
Boolean compareAD(ActionData *pAD1, ActionData *pAD2);
ActionData *copyAD(ActionData *pAD);
void FreeResources (void);
/***************************************************************************/
/* */
/* Callbacks for Create Action 'File' menu */
/* */
/***************************************************************************/
void activateCB_FileNew (Widget wid, XtPointer cdata,
XtPointer cbstruct);
void activateCB_FileOpen (Widget wid, XtPointer cdata,
XtPointer cbstruct);
void activateCB_FileQuit (Widget wid, XtPointer cdata,
XtPointer cbstruct);
/***************************************************************************/
/* */
/* Callbacks for Create Action 'Options' menu */
/* */
/***************************************************************************/
void activateCB_ExpertOption (Widget wid, XtPointer client_data, XtPointer *cbs);
void valueChangedCB_ColorMonoOption (Widget, XtPointer,
XmToggleButtonCallbackStruct *);
void createCB_ColorMonoOption (Widget);
/***************************************************************************/
/* */
/* Callbacks for Create Action Panel Buttons */
/* */
/***************************************************************************/
void activateCB_action_icon (Widget wid, XtPointer client_data,
DtIconCallbackStruct *cbs);
void activateCB_add_filetype (Widget wid, XtPointer client_data,
XmPushButtonCallbackStruct *cbs);
void activateCB_edit_filetype (Widget wid, XtPointer client_data,
XmPushButtonCallbackStruct *cbs);
#endif /* _CA_AUX_H_INCLUDED */

View File

@@ -0,0 +1,328 @@
/* $TOG: cmncbs.c /main/8 1999/09/17 15:44:29 mgreess $ */
/*****************************************************************************/
/* */
/* cmncbs.c */
/* */
/* Common callbacks */
/* */
/*****************************************************************************/
#include <stdio.h>
#include <sys/signal.h>
#include <X11/cursorfont.h>
#include <Dt/Icon.h>
#include <Dt/Help.h>
#include <Dt/HelpDialog.h>
#include "dtcreate.h"
#include "OpenFile.h"
#include "cmncbs.h"
#include "cmnrtns.h"
#include "CreateActionAppShell.h"
#include "ca_aux.h"
#include "icon_selection_dialog.h"
/******************************************************************************/
/* Initialize global values. */
/******************************************************************************/
Boolean bRegisteredSignal = FALSE;
int (*sigchildRoutine)();
/******************************************************************************/
/* activateCB_open_FindSet - Callback for the "Find Set" button on */
/* CreateActionAppShell and AddFiletype windows. */
/* This callback will pop up the Icon Selection */
/* dialog box. */
/* */
/* INPUT: Widget filesel - file selection box widget id */
/* XtPointer cdata - client data */
/* XmFileSelectionBoxCallbackStruct *cbstruct - callback data */
/* */
/* OUTPUT: none */
/* */
/******************************************************************************/
void activateCB_open_FindSet (Widget find_set_button, XtPointer cdata,
XmFileSelectionBoxCallbackStruct *cbstruct)
{
Widget filter;
Boolean use_bm = False;
static char *use_bm_filter = "*.m.bm";
static char *use_pm_filter = "*.m.pm";
char *search_path;
char *filter_field_title = NULL;
int use_filter_field = False;
char *file_filter;
char **directories_list = GetIconSearchPathList();
int numberOfTopButtons = 0;
void *top_button_one_cb = NULL;
void *top_button_two_cb = NULL;
void *top_button_three_cb = NULL;
char *top_button_one_label = NULL;
char *top_button_two_label = NULL;
char *top_button_three_label = NULL;
int use_icon_name_field = True;
int numberOfBottomButtons = 3;
void *bottom_button_one_cb = (void *)load_icons;
void *bottom_button_two_cb = NULL;
void *bottom_button_three_cb = NULL;
void *bottom_button_four_cb = NULL;
char *bottom_button_one_label = NULL; /* use default */
char *bottom_button_two_label = NULL; /* use default */
char *bottom_button_three_label = NULL; /* use default */
char *bottom_button_four_label = NULL; /* use default */
char *name_field_title;
char *container_title;
char *directory_title;
char *dialog_title, *pre, *suf;
name_field_title = XtNewString(GETMESSAGE(11, 12, "Enter Icon Filename"));
container_title = XtNewString(GETMESSAGE(11, 11, "Icon Files"));
directory_title = XtNewString(GETMESSAGE(11, 30, "Icon Folders"));
pre = GETMESSAGE(3, 10, "Create Action");
suf = GETMESSAGE(6, 18, "Find Set");
dialog_title = XtMalloc(strlen(pre) + strlen(suf) + 2);
sprintf(dialog_title, "%s - %s", pre, suf);
#ifdef DEBUG
printf("activate Find Set button; client_data = %p\n", cdata); /* debug */
#endif
XtVaGetValues (COLOR_MONO_OPTION, XmNset, &use_bm, NULL);
if (use_bm) file_filter = use_bm_filter;
else file_filter = use_pm_filter;
#ifndef _ICONSELECTOR_DESTROY_ENABLED
if (!IconSelector) {
#endif /* _ICONSELECTOR_DESTROY_ENABLED */
IconSelector = create_icon_selection_dialog ((swidget) CreateActionAppShell,
(unsigned char *)dialog_title,
(unsigned char *)filter_field_title,
use_filter_field,
(unsigned char *)file_filter,
(unsigned char *)directory_title,
(unsigned char **)directories_list,
(unsigned char *)container_title,
numberOfTopButtons,
(unsigned char *)top_button_one_label,
(void (*)())top_button_one_cb,
(unsigned char *)top_button_two_label,
(void (*)())top_button_two_cb,
(unsigned char *)top_button_three_label,
(void (*)())top_button_three_cb,
use_icon_name_field,
(unsigned char *)name_field_title,
numberOfBottomButtons,
(unsigned char *)bottom_button_one_label,
(void (*)())bottom_button_one_cb,
(unsigned char *)bottom_button_two_label,
(void (*)())bottom_button_two_cb,
(unsigned char *)bottom_button_three_label,
(void (*)())bottom_button_three_cb,
(unsigned char *)bottom_button_four_label,
(void (*)())bottom_button_four_cb);
#ifndef _ICONSELECTOR_DESTROY_ENABLED
}
#endif /* _ICONSELECTOR_DESTROY_ENABLED */
XtFree(name_field_title);
XtFree(container_title);
XtFree(directory_title);
XtFree(dialog_title);
FreeIconSearchPathList(directories_list);
XtVaSetValues (IconSelector, XmNuserData, cdata, NULL);
UxPopupInterface (IconSelector, no_grab);
XmProcessTraversal(ISD_SelectedIconTextField, XmTRAVERSE_CURRENT);
return;
}
/******************************************************************************/
/* */
/* createCB_IconGadget */
/* */
/* INPUT: Widget wid - icon gadget windet id */
/* Boolean bActionIcons - is this an action widget */
/* enum icon_size_range - size of icon this widget represents */
/* */
/* OUTPUT: none */
/* */
/******************************************************************************/
void createCB_IconGadget(Widget wid,
Boolean bActionIcons,
enum icon_size_range IconSize)
{
SetIconData(wid,
(char *)((bActionIcons) ?
ca_full_icon_default : af_full_icon_default),
IconSize);
}
/******************************************************************************/
/* activateCB_edit_icon - brings up icon editor with selected icon */
/* */
/* INPUT: Widget wid - widget id */
/* XtPointer cd - client data */
/* XmPushButtonCallbackStruct *cbs - callback data */
/* OUTPUT: none */
/* */
/******************************************************************************/
void activateCB_edit_icon (Widget wid, XtPointer client_data,
XmPushButtonCallbackStruct *cbs)
{
char *pszIconToEdit;
Boolean IsActionIcons;
if (bIconEditorDisplayed) return;
if ((int)client_data == CA_ACTION_ICONS) {
IsActionIcons = True;
widSelectedIcon = get_selected_action_icon();
widEditSource = CreateActionAppShell;
} else {
IsActionIcons = False;
widSelectedIcon = (Widget)get_selected_filetype_icon();
widEditSource = AddFiletype;
}
XtVaGetValues (widSelectedIcon, XmNimageName, &pszIconToEdit, NULL);
/***************************************************************/
/* Call routine to send tooltalk message to start icon editor. */
/***************************************************************/
UxDoEditPixmap(widSelectedIcon, pszIconToEdit);
return;
}
/******************************************************************************/
/* */
/* closeCB_mainHelpDialog */
/* */
/* INPUT: Widget wid - widget id */
/* XtPointer cd - client data */
/* XtPointer cbs - callback data */
/* OUTPUT: none */
/* */
/******************************************************************************/
void closeCB_mainHelpDialog(Widget wid, XtPointer client_data,
XtPointer *cbs)
{
XtDestroyWidget(wid);
}
/******************************************************************************/
/* */
/* DisplayHelpDialog */
/* */
/* INPUT: Widget wid - widget id */
/* XtPointer cd - client data */
/* XtPointer cbs - callback data */
/* OUTPUT: none */
/* */
/******************************************************************************/
void DisplayHelpDialog(Widget wid, XtPointer client_data, XtPointer cbs)
{
static Widget mainHelpDialog = NULL;
Widget parent;
int i;
Arg args[10];
char pszTitle[MAXBUFSIZE];
char pszTopic[MAXBUFSIZE];
i = 0;
/***********************************************************************/
/* Get help dialog window title. */
/***********************************************************************/
/*
sprintf(pszTitle, "%s - %s", GETMESSAGE(3, 10, "Create Action"),
GETMESSAGE(2, 53, "Help"));
*/
sprintf(pszTitle, "%s - ", GETMESSAGE(3, 10, "Create Action"));
strcat(pszTitle, GETMESSAGE(2, 53, "Help"));
XtSetArg(args[i], XmNtitle, pszTitle); i++;
/***********************************************************************/
/* Now set the particular helpvolume and topic to view */
/***********************************************************************/
XtSetArg(args[i], DtNhelpType, DtHELP_TYPE_TOPIC); i++;
XtSetArg(args[i], DtNhelpVolume, "CreatAct"); i++;
XtSetArg(args[i], DtNlocationId, pszTopic); i++;
switch ((int)client_data) {
case HELP_OVERVIEW:
strcpy(pszTopic, "_hometopic");
break;
case HELP_TASKS:
strcpy(pszTopic, "Tasks");
break;
case HELP_REFERENCE:
strcpy(pszTopic, "Reference");
break;
case HELP_USING:
strcpy(pszTopic, "_HOMETOPIC");
XtSetArg(args[i], DtNhelpVolume, "Help4Help"); i++;
break;
case HELP_ABOUT:
strcpy(pszTopic, "_copyright");
break;
case HELP_ONITEM:
strcpy(pszTopic, "CreateActionMainWindow");
break;
case HELP_ADDFILETYPE:
strcpy(pszTopic, "AddDatatypeWindow");
break;
case HELP_FILECHAR:
strcpy(pszTopic, "DatatypeCriteriaWindow");
break;
case HELP_ICONSELECTOR:
strcpy(pszTopic, "FindIconSetDialog");
break;
case HELP_OPENFILE:
strcpy(pszTopic, "openDialog");
break;
}
/***********************************************************************/
/* Create the Help dialog. */
/***********************************************************************/
/* **** old method of getting parent ****
XtVaGetValues(wid, XmNuserData, &parent, NULL);
if (!parent) {
parent = wid;
}
*/
parent = GetTrueToplevel(wid);
TurnOnHourGlassAllWindows();
if ( mainHelpDialog == NULL ) {
mainHelpDialog = DtCreateHelpDialog(parent, "mainHelpDialog", args, i);
XtAddCallback(mainHelpDialog, DtNcloseCallback,
(void (*)())closeCB_mainHelpDialog,
(XtPointer)NULL);
XtManageChild(mainHelpDialog);
} else {
XtSetValues( mainHelpDialog, args, i );
}
TurnOffHourGlassAllWindows();
}
/******************************************************************************/
/* */
/* helpCB_general */
/* */
/* INPUT: Widget wid - widget id */
/* XtPointer cd - client data */
/* XtPointer cbs - callback data */
/* OUTPUT: none */
/* */
/******************************************************************************/
void helpCB_general(Widget UxWidget,
XtPointer UxClientData,
XtPointer UxCallbackArg)
{
DisplayHelpDialog(UxWidget, UxClientData, UxCallbackArg);
}

View File

@@ -0,0 +1,31 @@
/* $XConsortium: cmncbs.h /main/4 1995/11/01 16:10:49 rswiston $ */
/***************************************************************************/
/* */
/* cmncbs.h */
/* */
/***************************************************************************/
#ifndef _CMNCBS_H_INCLUDED
#define _CMNCBS_H_INCLUDED
#ifndef STORAGECLASS
#ifdef NOEXTERN
#define STORAGECLASS
#else
#define STORAGECLASS extern
#endif
#endif
/***************************************************************************/
/* */
/* Prototypes for functions */
/* */
/***************************************************************************/
void activateCB_open_FindSet (Widget,XtPointer,XmFileSelectionBoxCallbackStruct *);
void activateCB_edit_icon (Widget,XtPointer,XmPushButtonCallbackStruct *);
void DisplayHelpDialog (Widget, XtPointer, XtPointer);
void helpCB_general (Widget, XtPointer, XtPointer);
#endif /* _CMNCBS_H_INCLUDED */

View File

@@ -0,0 +1,852 @@
/* $XConsortium: cmnrtns.c /main/4 1995/11/01 16:11:08 rswiston $ */
/*****************************************************************************/
/* */
/* cmnrnts.c */
/* */
/* Common routines */
/* */
/*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <Dt/Icon.h>
#include <X11/cursorfont.h>
#include "UxXt.h"
#include "dtcreate.h"
#include "CreateActionAppShell.h"
#include "fileio.h"
#include "cmnrtns.h"
/*****************************************************************************/
/* */
/* GetBaseName */
/* */
/*****************************************************************************/
char * GetBaseName(char *pszFileName)
{
char *name;
name = strrchr(pszFileName, '/');
if (name) {
name = strtok(name, "/");
return(name);
} else {
return(pszFileName);
}
}
/*****************************************************************************/
/* */
/* ReplaceSpaces */
/* */
/*****************************************************************************/
char * ReplaceSpaces(char *pszName)
{
char *newName;
char *ptr;
newName = (char *)XtMalloc(strlen(pszName) + 1);
memset(newName, 0, sizeof(newName));
strcpy(newName, pszName);
ptr = strrchr(newName, ' ');
if (ptr) {
ptr = newName;
while ((*ptr) && (ptr = strchr(ptr, ' '))) {
*ptr = '_';
ptr++;
}
}
return(newName);
}
#if 0
/*****************************************************************************/
/* */
/* GetExtName */
/* */
/*****************************************************************************/
char * GetExtName(char *pszFileName)
{
char *type;
type = strrchr(pszFileName, '.');
if (type) {
type = strtok(type, ".");
return(type);
} else {
return(NULL);
}
}
#endif
#if 0
/*****************************************************************************/
/* */
/* GetPathName */
/* */
/*****************************************************************************/
char * GetPathName(char *pszFileName)
{
char *ptr;
char *pszPath;
pszPath = (char *)malloc(strlen(pszFileName) + 1);
strcpy(pszPath, pszFileName);
ptr = strrchr(pszPath, '/');
if (ptr) {
*ptr = '\0';
} else {
free(pszPath);
pszPath = (char *)NULL;
}
return(pszPath);
}
#endif
#if 0
/*****************************************************************************/
/* */
/* Change_IconGadget_IconType */
/* */
/*****************************************************************************/
void Change_IconGadget_IconType(Widget widIconGadget, char *pszNewType)
{
char *pszOldName;
char pszNewName[MAXBUFSIZE];
char *tmpptr;
ushort rc;
XtVaGetValues(widIconGadget, XmNimageName, &pszOldName, NULL);
if (pszOldName) {
tmpptr = strrchr(pszOldName, '.');
*tmpptr = '\0';
sprintf(pszNewName, "%s.%s", pszOldName, pszNewType);
#ifdef DEBUG
printf("monochrome name is '%s'\n", pszNewName); /* debug */
#endif
if (check_file_exists(pszNewName)) {
SET_ICONGADGET_ICON(widIconGadget, pszNewName);
} else {
SET_ICONGADGET_ICON(widIconGadget, "");
}
}
}
#endif
#if 0
/*****************************************************************************/
/* */
/* Change_IconName_IconType */
/* */
/*****************************************************************************/
char * Change_IconName_IconType(char *pszOldName, char *pszNewType)
{
char *tmpptr;
ushort rc;
char *pszNewName = (char *)NULL;
if (pszOldName) {
pszNewName = (char *)malloc(strlen(pszOldName) + 10);
tmpptr = strrchr(pszOldName, '.');
*tmpptr = '\0';
sprintf(pszNewName, "%s.%s", pszOldName, pszNewType);
#ifdef DEBUG
printf("new icon name is '%s'\n", pszNewName);
#endif
if (!check_file_exists(pszNewName)) {
free(pszNewName);
pszNewName = (char *)NULL;
}
}
return(pszNewName);
}
#endif
/******************************************************************************/
/* */
/* GetCoreName */
/* */
/******************************************************************************/
char * GetCoreName(char *pszFullName)
{
char *name;
char *ptr;
char *newName;
name = strrchr(pszFullName, '/');
if (name) {
name = strtok(name, "/");
} else {
name = pszFullName;
}
newName = (char *)malloc(strlen(name) + 1);
memset(newName, 0, sizeof(newName));
strcpy(newName, name);
ptr = strrchr(newName, '.');
if (ptr) {
*ptr = '\0';
}
return(newName);
}
/******************************************************************************/
/* */
/* load_icons - puts selected icons into the appropriate icon gadget. */
/* */
/* INPUT: Widget wid - OK button on Open File dialog, */
/* XtPointer client_data */
/* XmFileSelectionBoxCallbackStruct *cbs */
/* OUTPUT: none */
/* */
/******************************************************************************/
void load_icons (Widget wid, XtPointer client_data,
XmFileSelectionBoxCallbackStruct *cbs)
{
char *full_name, *path_and_base_name, *type_name, *size_name;
char *base_name;
char *ptr;
int iSource;
FiletypeData *pFtD;
/*****************************************/
/* Get icon name and separate into parts */
/*****************************************/
full_name = (char *)client_data;
path_and_base_name = (char *)malloc(strlen(full_name)+1);
strcpy(path_and_base_name, full_name);
/*****************************************/
/* Strip off icon type extension. */
/*****************************************/
ptr = strrchr(path_and_base_name, '.');
if (ptr) {
type_name = strtok(ptr, ".");
*ptr = '\0';
} else {
type_name = (char *)NULL;
}
/*****************************************/
/* Get size extention. */
/*****************************************/
ptr = strrchr(path_and_base_name, '.');
if (ptr) {
size_name = strtok(ptr, ".");
*ptr = '\0';
} else {
size_name = (char *)NULL;
}
#ifdef DEBUG
printf("path&base = %s\n", path_and_base_name); /* debug */
printf("type = %s\n", type_name); /* debug */
printf("size = %s\n", size_name); /* debug */
#endif
/* ***** cmvc 6715 *****
if ((!path_and_base_name) || (!type_name) || (!size_name)) {
printf ("'%s' is not a proper icon file name!\n", full_name);
}
else
*/
{
XtVaGetValues(IconSelector, XmNuserData, &iSource, NULL);
base_name = GetBaseName(path_and_base_name);
ptr = XtMalloc(strlen(base_name) + 1);
strcpy(ptr, base_name);
switch (iSource) {
case CA_ACTION_ICONS:
AD.pszIcon = ptr;
SetIconData(CA_LRG_IconGadget, path_and_base_name, Large_Icon);
SetIconData(CA_MED_IconGadget, path_and_base_name, Medium_Icon);
SetIconData(CA_TINY_IconGadget, path_and_base_name, Tiny_Icon);
break;
case CA_FILETYPE_ICONS:
XtVaGetValues(AddFiletype, XmNuserData, &pFtD, NULL);
pFtD->pszIcon = ptr;
SetIconData(AF_MED_IconGadget, path_and_base_name, Medium_Icon);
SetIconData(AF_TINY_IconGadget, path_and_base_name, Tiny_Icon);
break;
}
}
free(path_and_base_name);
return;
}
/******************************************************************************/
/* */
/* GetWidgetTextString */
/* */
/* INPUT: Widget wid - TextField widget to get string from. */
/* Pointer to variable to store string */
/* */
/* OUTPUT: none */
/* */
/******************************************************************************/
void GetWidgetTextString (Widget wid, char **ppszText)
{
char *pszTmp;
if (*ppszText) {
XtFree(*ppszText);
*ppszText = (char *)NULL;
}
if (XmIsTextField(wid)) {
pszTmp = XmTextFieldGetString (wid);
} else if (XmIsText(wid)) {
pszTmp = XmTextGetString (wid);
}
if (pszTmp) {
if (!strcmp(pszTmp, "")) {
XtFree(pszTmp);
pszTmp = (char *)NULL;
}
*ppszText = pszTmp;
}
}
/******************************************************************************/
/* */
/* PutWidgetTextString */
/* */
/* INPUT: Widget wid - Widget whose text string is being set */
/* Pointer to text string. */
/* */
/* OUTPUT: none */
/* */
/******************************************************************************/
void PutWidgetTextString (Widget wid, char *pszText)
{
if (pszText) {
if (XmIsTextField(wid)) {
XmTextFieldSetString (wid, pszText);
} else if (XmIsText(wid)) {
XmTextSetString (wid, pszText);
}
}
}
/******************************************************************************/
/* */
/* GetIconSearchPathList */
/* */
/* INPUT: none */
/* */
/* OUTPUT: none */
/* */
/******************************************************************************/
char **GetIconSearchPathList(void)
{
char *iconpath = (char *)NULL;
char *ptr;
char *tmpptr;
char *strip;
char *path;
int i;
int count;
int size;
char **pplist;
char *lang;
int langsize;
static char *default_list1[] = {"~/.dt/icons", "/etc/dt/appconfig/icons/C", "/usr/dt/appconfig/icons/C"};
static char *default_list2[] = {"/etc/dt/appconfig/icons/C", "/usr/dt/appconfig/icons/C"};
char **default_list;
Boolean bFound;
char *pszEnvVar;
/**************************************************************************/
/* Get contents of icon search path environment variable. */
/**************************************************************************/
pszEnvVar = getenv("XMICONSEARCHPATH");
if ( pszEnvVar && strlen(pszEnvVar) ) {
iconpath = (char *)malloc(strlen(pszEnvVar) + 1);
strcpy(iconpath, pszEnvVar);
}
/**************************************************************************/
/* If no iconpath then return an appropriate default. */
/**************************************************************************/
if (!iconpath) {
pszEnvVar = getenv("HOME");
if (pszEnvVar && strlen(pszEnvVar)) {
default_list = default_list1;
count = sizeof(default_list1)/sizeof(void *);
} else {
default_list = default_list2;
count = sizeof(default_list2)/sizeof(void *);
}
pplist = (char **)calloc((count + 1), sizeof(void *));
for (i=0; i < count; i++) {
if (strchr(default_list[i], '~')) {
if (pszEnvVar && strlen(pszEnvVar)) {
pplist[i] = calloc(strlen(default_list[i]) + strlen(pszEnvVar) + 1, sizeof(char));
strcpy(pplist[i], pszEnvVar);
} else {
pplist[i] = calloc(strlen(default_list[i]) + 1, sizeof(char));
}
strcat(pplist[i], &(default_list[i][1]));
} else {
pplist[i] = calloc(strlen(default_list[i]) + 1,sizeof(char));
strcpy(pplist[i], default_list[i]);
}
}
return(pplist);
}
#ifdef DEBUG
printf("Path = %s\n", iconpath);
#endif
/**************************************************************************/
/* Iterate through the search path once to get total count of individual */
/* paths within the search path. */
/**************************************************************************/
count = 0;
ptr = iconpath;
while (ptr) {
tmpptr = ptr;
ptr = strchr(ptr, ':');
/*printf("ptr = %s\n", ptr);*/
if (tmpptr != ptr) {
count++;
if ((ptr) && (ptr[1] != '\0')) {
for (; ptr[0] == ':'; ptr++);
} else {
ptr = (char *)NULL;
}
}
}
/**************************************************************************/
/* Debug information. */
/**************************************************************************/
#ifdef DEBUG
printf("IconSearchPath = %s\n", iconpath);
printf("# of paths = %d\n", count);
#endif
/**************************************************************************/
/* Get contents of lang environment variable. */
/**************************************************************************/
lang = getenv("LANG");
if (lang) {
langsize = strlen(lang);
} else {
langsize = 0;
}
/**************************************************************************/
/* Allocate the array of pointers to store the individual path strings. */
/**************************************************************************/
pplist = (char **)calloc((count+1), sizeof(void *));
/**************************************************************************/
/* Iterate through again to allocate space for each individual path and */
/* store that path. */
/**************************************************************************/
count = 0;
ptr = iconpath;
while (ptr) {
tmpptr = ptr;
ptr = strchr(ptr, ':');
if (tmpptr != ptr) {
/*********************************************************************/
/* Make tmpptr the path. Also move to the next path in the search */
/* path. */
/*********************************************************************/
strip = ptr;
if ((ptr) && (ptr[1] != '\0')) {
for (; ptr[0] == ':'; ptr++);
*strip = '\0';
} else {
if (ptr) {
*strip = '\0';
}
ptr = (char *)NULL;
}
/*********************************************************************/
/* If %L in path, then add size of lang variable to it when */
/* allocating array for path. */
/*********************************************************************/
if (strip = strstr(tmpptr, "%L")) {
path = malloc(strlen(tmpptr) + langsize + 1);
} else {
path = malloc(strlen(tmpptr) + 1);
}
strcpy(path, tmpptr);
/*********************************************************************/
/* Strip off the /%B... stuff off of the path if there is some. */
/*********************************************************************/
if (strip = strstr(path, "%B")) {
*strip = '\0';
}
/*********************************************************************/
/* Now replace %L with lang variable. */
/*********************************************************************/
if (strip = strstr(path, "%L")) {
*strip = '\0';
if (langsize) {
strcat(path, lang);
}
}
/*********************************************************************/
/* Remove slash from end of path if there is one. */
/*********************************************************************/
size = strlen(path);
if (size > 0) {
if (path[size - 1] == '/') {
path[size - 1] = '\0';
}
#ifdef DEBUG
printf("new path = %s\n", path);
#endif
/***************************************************************/
/* See if path is already in our list. */
/***************************************************************/
bFound = FALSE;
for (i=0; (i < count) && (!bFound); i++) {
if (!(strcmp(pplist[i], path))) {
bFound = TRUE;
}
}
/***************************************************************/
/* If not in list, then add to list. */
/***************************************************************/
if (!bFound) {
pplist[count] = path;
count++;
/***************************************************************/
/* Else, just free resources. */
/***************************************************************/
} else {
free(path);
}
}
#ifdef DEBUG
printf("Path%d = %s\n", count, pplist[count]);
#endif
#if 0
**** moving this up a bit in the code ****
/*********************************************************************/
/* Get the next path in the icon search path. */
/*********************************************************************/
if ((ptr) && (ptr[1] != '\0')) {
for (; ptr[0] == ':'; ptr++);
} else {
ptr = (char *)NULL;
}
#endif
}
}
free(iconpath);
return(pplist);
}
/******************************************************************************/
/* */
/* FreeIconSearchPathList */
/* */
/* INPUT: none */
/* */
/* OUTPUT: none */
/* */
/******************************************************************************/
void FreeIconSearchPathList(char **pplist)
{
char *ptr;
int i;
/**************************************************************************/
/* Iterate through the search path once to get total count of individual */
/* paths within the search path. */
/**************************************************************************/
if (pplist) {
for (i = 0; pplist[i]; free(pplist[i]), i++);
/*
i = 0;
while (pplist[i]) {
free(pplist[i]);
}
*/
free(pplist);
}
}
/******************************************************************************/
/* */
/* TurnOnHourGlassAllWindows */
/* */
/* INPUT: none */
/* */
/* OUTPUT: none */
/* */
/******************************************************************************/
void TurnOnHourGlassAllWindows()
{
_DtTurnOnHourGlass(CreateActionAppShell);
if ( (AddFiletype) &&
(XtIsRealized(AddFiletype)) &&
(XtIsManaged(AddFiletype)) ) {
_DtTurnOnHourGlass(AddFiletype);
}
if ( (FileCharacteristics) &&
(XtIsRealized(FileCharacteristics)) &&
(XtIsManaged(FileCharacteristics)) ) {
_DtTurnOnHourGlass(FileCharacteristics);
}
if ( (IconSelector) &&
(XtIsRealized(IconSelector)) &&
(XtIsManaged(IconSelector)) ) {
_DtTurnOnHourGlass(IconSelector);
}
if ( (OpenFile) &&
(XtIsRealized(OpenFile)) &&
(XtIsManaged(OpenFile)) ) {
_DtTurnOnHourGlass(OpenFile);
}
}
/******************************************************************************/
/* */
/* TurnOffHourGlassAllWindows */
/* */
/* INPUT: none */
/* */
/* OUTPUT: none */
/* */
/******************************************************************************/
void TurnOffHourGlassAllWindows()
{
_DtTurnOffHourGlass(CreateActionAppShell);
if ( (AddFiletype) &&
(XtIsRealized(AddFiletype)) &&
(XtIsManaged(AddFiletype)) ) {
_DtTurnOffHourGlass(AddFiletype);
}
if ( (FileCharacteristics) &&
(XtIsRealized(FileCharacteristics)) &&
(XtIsManaged(FileCharacteristics)) ) {
_DtTurnOffHourGlass(FileCharacteristics);
}
if ( (IconSelector) &&
(XtIsRealized(IconSelector)) &&
(XtIsManaged(IconSelector)) ) {
_DtTurnOffHourGlass(IconSelector);
}
if ( (OpenFile) &&
(XtIsRealized(OpenFile)) &&
(XtIsManaged(OpenFile)) ) {
_DtTurnOffHourGlass(OpenFile);
}
}
/******************************************************************************/
/* */
/* SetIconData */
/* */
/* INPUT: icon gadget widget id */
/* icon file base name */
/* */
/* OUTPUT: none */
/* */
/******************************************************************************/
void SetIconData(Widget wid, char *pszIconFile, enum icon_size_range enumIconSize)
{
char pmFileName[MAXBUFSIZE];
char bmFileName[MAXBUFSIZE];
char pszSize[MAX_EXT_SIZE];
IconData *pIconData;
char *pszName;
#if 0
switch (enumIconSize) {
case Large_Icon :
strcpy(pszSize, LARGE_EXT);
break;
case Medium_Icon :
strcpy(pszSize, MEDIUM_EXT);
break;
case Tiny_Icon :
strcpy(pszSize, TINY_EXT);
break;
}
sprintf(pmFileName, "%s%s%s", pszIconFile, pszSize, PIXMAP_EXT );
sprintf(bmFileName, "%s%s%s", pszIconFile, pszSize, BITMAP_EXT );
#endif
pszName = CreateIconName((char *)NULL, pszIconFile, enumIconSize, PIXMAP_EXT, FALSE);
strcpy(pmFileName, pszName);
if (pszName) XtFree(pszName);
pszName = CreateIconName((char *)NULL, pszIconFile, enumIconSize, BITMAP_EXT, FALSE);
strcpy(bmFileName, pszName);
if (pszName) XtFree(pszName);
pIconData = GetIconDataFromWid(wid);
if (pIconData) {
if ( (pIconData->pmDirtyBit) &&
(pIconData->pmFileName) &&
(strlen(pIconData->pmFileName)) ) {
#ifdef DEBUG
printf("SetIconData: unlink '%s'\n", pIconData->pmFileName); /* debug */
#endif
unlink(pIconData->pmFileName);
pIconData->pmDirtyBit = False;
}
strcpy(pIconData->pmFileName, pmFileName);
if ( (pIconData->bmDirtyBit) &&
(pIconData->bmFileName) &&
(strlen(pIconData->bmFileName)) ) {
#ifdef DEBUG
printf("SetIconData: unlink '%s'\n", pIconData->bmFileName); /* debug */
#endif
unlink(pIconData->bmFileName);
pIconData->bmDirtyBit = False;
}
strcpy(pIconData->bmFileName, bmFileName);
if (bShowPixmaps) {
SET_ICONGADGET_ICON(wid, pmFileName);
} else {
SET_ICONGADGET_ICON(wid, bmFileName);
}
}
}
/******************************************************************************/
/* */
/* GetCorrectIconType */
/* */
/* INPUT: icon file name */
/* */
/* OUTPUT: correct icon type of icon file name passed */
/* */
/******************************************************************************/
char * GetCorrectIconType(char *pszIconFile)
{
char *pszTmp;
char *ptr;
char pszNewType[MAX_EXT_SIZE];
if (bShowPixmaps) {
strcpy(pszNewType, PIXMAP_EXT);
} else {
strcpy(pszNewType, BITMAP_EXT);
}
if (pszIconFile) {
pszTmp = XtMalloc(strlen(pszIconFile) + strlen(pszNewType) + 1);
if (!pszTmp) return((char *)NULL);
strcpy(pszTmp, pszIconFile);
ptr = strrchr(pszTmp, '.');
if (ptr) {
strcpy(ptr, pszNewType);
}
} else {
pszTmp = (char *)NULL;
}
return (pszTmp);
}
/******************************************************************************/
/* */
/* CreateMaskName */
/* */
/* INPUT: icon file name */
/* */
/* OUTPUT: mask file name for icon name passed in */
/* */
/******************************************************************************/
char * CreateMaskName(char *pszIconName)
{
char *pszTmpName;
char *ptr;
char *pszNewName;
char *type_name;
char *size_name;
char type_ext[MAX_EXT_SIZE + 2];
char size_ext[MAX_EXT_SIZE + 2];
int bytesneeded = 0;
/***************************************************************/
/* initialize temp arrays */
/***************************************************************/
type_ext[0] = '\0';
size_ext[0] = '\0';
/***************************************************************/
/* alloc memory for temporary name */
/***************************************************************/
pszTmpName = (char *)XtMalloc(strlen(pszIconName) + 1);
if (pszTmpName) {
strcpy(pszTmpName, pszIconName);
} else {
return((char *)NULL);
}
/*****************************************/
/* Strip off icon type extension. */
/*****************************************/
ptr = strrchr(pszTmpName, '.');
if (ptr) {
type_name = strtok(ptr, ".");
*ptr = '\0';
} else {
type_name = (char *)NULL;
}
/*****************************************/
/* Get size extention. */
/*****************************************/
ptr = strrchr(pszTmpName, '.');
if (ptr) {
size_name = strtok(ptr, ".");
*ptr = '\0';
} else {
size_name = (char *)NULL;
}
/*****************************************/
/* Alloc the storage for the new name */
/*****************************************/
bytesneeded += ((pszTmpName) ? strlen(pszTmpName) : 0);
bytesneeded += strlen("_m..");
bytesneeded += ((size_name) ? strlen(size_name) : 0);
bytesneeded += ((type_name) ? strlen(type_name) : 0);
pszNewName = (char *)XtMalloc(bytesneeded + 1);
/*****************************************/
/* Create extension names */
/*****************************************/
if (size_name) {
sprintf(size_ext, ".%s", size_name);
}
if (type_name) {
sprintf(type_ext, ".%s", type_name);
}
/*****************************************/
/* And construct the new name from pieces*/
/*****************************************/
if (pszNewName) {
if (size_name) {
sprintf(pszNewName, "%s%s_m%s", pszTmpName, size_ext, type_ext);
} else {
sprintf(pszNewName, "%s_m%s%s", pszTmpName, size_ext, type_ext);
}
}
if (pszTmpName) XtFree(pszTmpName);
#ifdef DEBUG
printf("Mask file name = '%s'\n", pszNewName); /* debug */
#endif
return(pszNewName);
}

View File

@@ -0,0 +1,95 @@
/* $XConsortium: cmnrtns.h /main/5 1995/11/01 16:11:28 rswiston $ */
#include <Dt/IconFile.h>
/***************************************************************************/
/* */
/* cmnrtns.h */
/* */
/***************************************************************************/
#ifndef _CMNRTNS_H_INCLUDED
#define _CMNRTNS_H_INCLUDED
#ifndef STORAGECLASS
#ifdef NOEXTERN
#define STORAGECLASS
#else
#define STORAGECLASS extern
#endif
#endif
/***************************************************************************/
/* */
/* Macro Declarations */
/* */
/***************************************************************************/
#define SET_ICONGADGET_ICON_AND_EXT(widIconGadget,pszIconFileName, pszBuffer) {\
sprintf(pszBuffer, "%s%s", pszIconFileName, bShowPixmaps ? PIXMAP_EXT : BITMAP_EXT); \
XtVaSetValues (widIconGadget, \
XmNimageName, "", \
NULL); \
/*printf("setting icon to = '%s'\n", pszBuffer);*/ \
XtVaSetValues (widIconGadget, \
XmNimageName, pszBuffer, \
NULL); \
}
#define SET_ICONGADGET_ICON(widIconGadget,pszIconFileName) { \
/*printf("setting icon to = '%s'\n", pszIconFileName);*/ \
XtVaSetValues (widIconGadget, \
XmNimageName, "", \
NULL); \
XtVaSetValues (widIconGadget, \
XmNimageName, pszIconFileName, \
NULL); \
}
#define FIND_ICONGADGET_ICON(pszIcon,pszFile,size) { \
pszFile = (char *)NULL; \
pszFile = _DtGetIconFileName(XtScreen(CreateActionAppShell), \
NULL, \
pszIcon, \
NULL, \
size); \
}
#define CHANGE_ICONGADGET_ICON(widIconGadget,buffer,name,size,type) { \
sprintf(buffer, "%s.%s.%s", name, size, type); \
if (check_file_exists(buffer)) { \
SET_ICONGADGET_ICON(widIconGadget, buffer); \
} else { \
SET_ICONGADGET_ICON(widIconGadget, ""); \
} \
}
#define SET_TOGGLEBUTTON(widToggleButton,bState) { \
XtVaSetValues (widToggleButton, \
XmNset, bState, \
NULL); \
}
/***************************************************************************/
/* */
/* Prototypes for functions */
/* */
/***************************************************************************/
ushort WriteDefinitionFile(char *, ActionData *);
ushort WriteActionFile(ActionData *);
void Change_IconGadget_IconType(Widget, char *);
void load_icons (Widget wid, XtPointer client_data,
XmFileSelectionBoxCallbackStruct *cbs);
void GetWidgetTextString(Widget, char **);
void PutWidgetTextString (Widget wid, char *pszText);
char * GetCoreName(char *pszFullName);
char **GetIconSearchPathList(void);
void FreeIconSearchPathList(char **);
void TurnOnHourGlassAllWindows();
void TurnOffHourGlassAllWindows();
char * ReplaceSpaces(char *pszName);
void SetIconData(Widget, char *, enum icon_size_range);
char * GetCorrectIconType(char *);
char * CreateMaskName(char *);
IconData * GetIconDataFromWid(Widget);
#endif /* _CMNRTNS_H_INCLUDED */

View File

@@ -0,0 +1,138 @@
/* $XConsortium: cmnutils.c /main/4 1995/11/01 16:11:47 rswiston $ */
/***************************************************************************/
/* */
/* Utility Functions */
/* */
/***************************************************************************/
#include <stdio.h>
#include <stdarg.h>
#include <Xm/Xm.h>
#include <Xm/RowColumnP.h>
#include <Xm/MessageB.h>
#include <Xm/Text.h>
#include "cmnutils.h"
/********************************************************************************/
/* countItems - counts the number of items in a null terminated array */
/* INPUT: char **items - null terminated array */
/* OUTPUT: int lcv - number of items in array */
/********************************************************************************/
int countItems (char **items)
{
int lcv = 0;
/*
while (items[lcv]) {
lcv++;
}
*/
if (items) {
for (lcv = 0; items[lcv]; lcv++);
}
return (lcv);
}
/********************************************************************************/
/* TextStringsToXmStrings - Given an array of C text strings returns an */
/* array of XmStrings. */
/* INPUT: char **text_strings - array of C style strings */
/* OUTPUT: XmStringTable xmstrings - an array Motif compound strings */
/********************************************************************************/
XmStringTable TextStringsToXmStrings (char **text_strings)
{
XmStringTable xmstrings = NULL;
int count, lcv;
if (text_strings) {
count = countItems (text_strings);
xmstrings = (XmStringTable) calloc (sizeof(XmString), (count));
for (lcv = 0; lcv < count; lcv++)
xmstrings[lcv] = (XmString) XmStringCreateSimple (text_strings[lcv]);
}
return ((XmStringTable)xmstrings);
}
/********************************************************************************/
/* XmStringToText - Given an XmString returns a C character text string. */
/* INPUT: XmString xmstring - a Motif compound string */
/* OUTPUT: char *text_string - C style string */
/********************************************************************************/
char *XmStringToText (XmString xmstring)
{
XmStringContext context;
XmStringCharSet charset;
XmStringDirection direction;
Boolean separator;
char *text_string = NULL, *temp = NULL;
text_string = (char *)calloc (1, sizeof (char));
if (xmstring) {
if (!XmStringInitContext (&context, xmstring)) {
printf("Can't convert compound string.\n");
return (NULL);
}
while (XmStringGetNextSegment (context, &temp, &charset,
&direction, &separator)) {
text_string = (char *)realloc (text_string, strlen (temp)+1);
if (text_string == NULL) {
printf("Can't allocate space for file name.\n");
return (NULL);
}
text_string = strcpy(text_string, temp);
}
XmStringFreeContext(context);
}
return (text_string);
}
/********************************************************************************/
/* delete_all_list_items - removes all items from a list box */
/* INPUT: Widget list - id of list widget */
/* OUTPUT: none */
/********************************************************************************/
void delete_all_list_items (Widget list)
{
int item_count = 0;
XtVaGetValues (list, XmNitemCount, &item_count, NULL);
if (item_count > 0) {
XmListDeleteItemsPos (list, item_count, 1);
}
return;
}
/********************************************************************************/
/* clear_text_field - removes any text from a text field */
/* INPUT: Widget textfield - id of text widget */
/* OUTPUT: none */
/********************************************************************************/
void clear_text_field (Widget textfield)
{
XmTextPosition last_pos;
char *empty = "";
last_pos = XmTextGetLastPosition (textfield);
XmTextReplace (textfield, 0, last_pos, empty);
return;
}
/********************************************************************************/
/* clear_text - removes any text from a text widget */
/* INPUT: Widget textwid - id of text widget */
/* OUTPUT: none */
/********************************************************************************/
void clear_text (Widget textwid)
{
XmTextPosition last_pos;
char *empty = "";
last_pos = XmTextGetLastPosition (textwid);
XmTextReplace (textwid, 0, last_pos, empty);
return;
}

View File

@@ -0,0 +1,38 @@
/* $XConsortium: cmnutils.h /main/5 1995/11/01 16:12:06 rswiston $ */
/***************************************************************************/
/* */
/* cmnutils.h */
/* */
/***************************************************************************/
#ifndef _CMNUTILS_H_INCLUDED
#define _CMNUTILS_H_INCLUDED
#include <Xm/Xm.h>
/********************************************************************************/
/* */
/* Function Declarations */
/* */
/********************************************************************************/
XmStringTable TextStringsToXmStrings (char **);
char *XmStringToText (XmString);
char **XmStringsToTextStrings (void);
int countItems (char **);
void ffree_string_array (void);
Widget findOptionMenuButtonID (void);
void free_string_array (void);
char *getLabelString (void);
Widget getOptionMenuHistory (void);
void setOptionMenuHistoryByText (void);
void setOptionMenuHistoryByWidget (void);
void show_warning_dialog (void);
Widget show_working_dialog (void);
void show_info_dialog (void);
void free_XmStringTable (XmStringTable table);
#endif /* _CMNUTILS_H_INCLUDED */

View File

@@ -0,0 +1,504 @@
!######################################################################
!#
!# dtcreate.ddf
!#
!# Dialog description file for the dtcreate client.
!#
!# Hewlett-Packard Visual User Environment
!#
!# Copyright (c) 1990 Hewlett-Packard Company
!#
!# $XConsortium: dtcreate.ddf /main/3 1995/11/01 16:12:22 rswiston $
!#
!######################################################################
! The dialogs defined in this file are used by dtcreate. To display
! the main Create Action dialog:
! 1) Open the General toolbox from the tools slide-up
! panel.
! 2) Open the Utilities container.
! 3) Double-click the CreateAction icon.
!
! In this block, localize title and helpTitle. If the online help has
! been localized, the helpLocation resource may also require localization.
!
createAction.type: CustomFormDialog
createAction.useApplicationShell: True
createAction.title: %|nls-1-#Create Action#|
createAction.helpTitle: %|nls-2-#Create Action - Help#|
createAction.helpType: Topic
createAction.helpVolume: Dtmisc
createAction.helpLocation: ToUseMakeActionTA
createAction.hasInitialFocus: name
createAction.dialogButtons: apply,close,help
createAction.subfields: \
nameLabel,name,\
commandLineLabel,commandLine,\
commandType,\
optLabel,sep1,sep2,\
promptLabel,prompt,\
largeIconLabel,largeIcon,\
smallIconLabel,smallIcon,\
descriptionLabel,description
!
! In this block, localize label.
!
createAction.apply.label: %|nls-5-#Apply#|
createAction.apply.isDefault: True
createAction.apply.action: f.returnValues
!
! In this block, localize label.
!
createAction.close.label: %|nls-6-#Close#|
createAction.close.isDefault: False
createAction.close.action: f.returnValues
!
! In this block, localize label.
!
createAction.help.label: %|nls-7-#Help#|
createAction.help.isDefault: False
createAction.help.action: f.help
!
! In this block, localize label.
!
createAction.nameLabel.type: LabelField
createAction.nameLabel.topOffset: 20
createAction.nameLabel.leftOffset: 20
createAction.nameLabel.topAttachment: XmATTACH_FORM
createAction.nameLabel.leftAttachment: XmATTACH_FORM
createAction.nameLabel.label: %|nls-10-#Name:#|
createAction.name.type: TextField
createAction.name.crMovesToNextTextField: True
createAction.name.topAttachment: XmATTACH_OPPOSITE_WIDGET
createAction.name.topWidget: nameLabel
createAction.name.topOffset: -7
createAction.name.leftAttachment: XmATTACH_WIDGET
createAction.name.leftWidget: nameLabel
createAction.name.leftOffset: 10
createAction.name.rightAttachment: XmATTACH_FORM
createAction.name.rightOffset: 10
!
! In this block, localize label.
!
createAction.commandLineLabel.type: LabelField
createAction.commandLineLabel.topOffset: 20
createAction.commandLineLabel.leftOffset: 20
createAction.commandLineLabel.topAttachment: XmATTACH_WIDGET
createAction.commandLineLabel.topWidget: nameLabel
createAction.commandLineLabel.leftAttachment: XmATTACH_FORM
createAction.commandLineLabel.label: %|nls-11-#Command Line:#|
createAction.commandLine.type: TextField
createAction.commandLine.crMovesToNextTextField: True
createAction.commandLine.lines: 1
createAction.commandLine.topAttachment: XmATTACH_WIDGET
createAction.commandLine.topWidget: commandLineLabel
createAction.commandLine.topOffset: 5
createAction.commandLine.leftAttachment: XmATTACH_FORM
createAction.commandLine.leftOffset: 40
createAction.commandLine.rightAttachment: XmATTACH_FORM
createAction.commandLine.rightOffset: 10
!
! In this block, localize label, xWin.label, noOut.label,
! term.label, and termClose.label
!
createAction.commandType.type: OptionMenuField
createAction.commandType.topAttachment: XmATTACH_WIDGET
createAction.commandType.topWidget: commandLine
createAction.commandType.topOffset: 20
createAction.commandType.leftAttachment: XmATTACH_FORM
createAction.commandType.leftOffset: 20
createAction.commandType.rightAttachment: XmATTACH_FORM
createAction.commandType.rightOffset: 10
createAction.commandType.label: %|nls-12-#Window Type:#|
createAction.commandType.options: xWin,noOut,term,termClose
createAction.commandType.xWin.label: %|nls-13-#X Windows#|
createAction.commandType.noOut.label: %|nls-14-#No Output#|
createAction.commandType.term.label: %|nls-15-#Terminal#|
createAction.commandType.termClose.label: %|nls-16-#Terminal (auto-close)#|
createAction.commandType.active: term
createAction.commandType.spacing: 35
!
! In this block, localize label
!
createAction.optLabel.type: LabelField
createAction.optLabel.topOffset: 30
createAction.optLabel.leftOffset: 100
createAction.optLabel.topAttachment: XmATTACH_WIDGET
createAction.optLabel.topWidget: commandType
createAction.optLabel.leftAttachment: XmATTACH_FORM
createAction.optLabel.label: %|nls-17-#Optional Fields#|
createAction.sep1.type: SeparatorField
createAction.sep1.orientation: Horizontal
createAction.sep1.separatorType: SHADOW_ETCHED_OUT
createAction.sep1.topAttachment: XmATTACH_OPPOSITE_WIDGET
createAction.sep1.topWidget: optLabel
createAction.sep1.topOffset: 10
createAction.sep1.leftAttachment: XmATTACH_FORM
createAction.sep1.rightAttachment: XmATTACH_WIDGET
createAction.sep1.rightWidget: optLabel
createAction.sep1.rightOffset: 5
createAction.sep2.type: SeparatorField
createAction.sep2.orientation: Horizontal
createAction.sep2.separatorType: SHADOW_ETCHED_OUT
createAction.sep2.topAttachment: XmATTACH_OPPOSITE_WIDGET
createAction.sep2.topWidget: optLabel
createAction.sep2.topOffset: 10
createAction.sep2.leftAttachment: XmATTACH_WIDGET
createAction.sep2.leftWidget: optLabel
createAction.sep2.leftOffset: 5
createAction.sep2.rightAttachment: XmATTACH_FORM
!
! In this block, localize label
!
createAction.promptLabel.type: LabelField
createAction.promptLabel.topOffset: 20
createAction.promptLabel.leftOffset: 20
createAction.promptLabel.topAttachment: XmATTACH_WIDGET
createAction.promptLabel.topWidget: optLabel
createAction.promptLabel.leftAttachment: XmATTACH_FORM
createAction.promptLabel.label: %|nls-18-#Filename Prompt:#|
createAction.prompt.type: TextField
createAction.prompt.crMovesToNextTextField: True
createAction.prompt.lines: 1
createAction.prompt.topAttachment: XmATTACH_WIDGET
createAction.prompt.topWidget: promptLabel
createAction.prompt.topOffset: 5
createAction.prompt.leftAttachment: XmATTACH_FORM
createAction.prompt.leftOffset: 40
createAction.prompt.rightAttachment: XmATTACH_FORM
createAction.prompt.rightOffset: 10
!
! In this block, localize label
!
createAction.largeIconLabel.type: LabelField
createAction.largeIconLabel.topOffset: 30
createAction.largeIconLabel.leftOffset: 20
createAction.largeIconLabel.topAttachment: XmATTACH_WIDGET
createAction.largeIconLabel.topWidget: prompt
createAction.largeIconLabel.leftAttachment: XmATTACH_FORM
createAction.largeIconLabel.label: %|nls-19-#Large Icon:#|
createAction.largeIcon.type: TextField
createAction.largeIcon.crMovesToNextTextField: True
createAction.largeIcon.topAttachment: XmATTACH_OPPOSITE_WIDGET
createAction.largeIcon.topWidget: largeIconLabel
createAction.largeIcon.topOffset: -7
createAction.largeIcon.leftAttachment: XmATTACH_WIDGET
createAction.largeIcon.leftWidget: largeIconLabel
createAction.largeIcon.leftOffset: 20
createAction.largeIcon.rightAttachment: XmATTACH_FORM
createAction.largeIcon.rightOffset: 10
!
! In this block, localize label
!
createAction.smallIconLabel.type: LabelField
createAction.smallIconLabel.topOffset: 20
createAction.smallIconLabel.leftOffset: 20
createAction.smallIconLabel.topAttachment: XmATTACH_WIDGET
createAction.smallIconLabel.topWidget: largeIconLabel
createAction.smallIconLabel.leftAttachment: XmATTACH_FORM
createAction.smallIconLabel.label: %|nls-20-#Small Icon:#|
createAction.smallIcon.type: TextField
createAction.smallIcon.topAttachment: XmATTACH_OPPOSITE_WIDGET
createAction.smallIcon.topWidget: smallIconLabel
createAction.smallIcon.topOffset: -7
createAction.smallIcon.leftAttachment: XmATTACH_OPPOSITE_WIDGET
createAction.smallIcon.leftWidget: largeIcon
createAction.smallIcon.rightAttachment: XmATTACH_FORM
createAction.smallIcon.rightOffset: 10
!
! In this block, localize label
!
createAction.descriptionLabel.type: LabelField
createAction.descriptionLabel.topOffset: 20
createAction.descriptionLabel.leftOffset: 20
createAction.descriptionLabel.topAttachment: XmATTACH_WIDGET
createAction.descriptionLabel.topWidget: smallIconLabel
createAction.descriptionLabel.leftAttachment: XmATTACH_FORM
createAction.descriptionLabel.label: %|nls-21-#Description:#|
createAction.description.type: TextField
createAction.description.lines: 4
createAction.description.topAttachment: XmATTACH_WIDGET
createAction.description.topWidget: descriptionLabel
createAction.description.topOffset: 5
createAction.description.leftAttachment: XmATTACH_FORM
createAction.description.leftOffset: 40
createAction.description.rightAttachment: XmATTACH_FORM
createAction.description.rightOffset: 10
createAction.description.bottomAttachment: XmATTACH_FORM
createAction.description.bottomOffset: 20
!
! To display this dialog:
! 1. Run CreateAction
! 2. Type something in the 'Command Line:' field but not
! the 'Name:' field.
! 3. Press 'OK'
!
! In this block, localize title, ok.label, and message.
!
noName.type: ErrorDialog
noName.title: %|nls-3-#Create Action - Error#|
noName.helpTitle: %|nls-2-#Create Action - Help#|
noName.helpType: Topic
noName.helpVolume: Dtmisc
noName.helpLocation: ToUseMakeActionTA
noName.dialogButtons: ok
noName.ok.label: %|nls-8-#OK#|
noName.ok.isDefault: True
noName.ok.action: f.unpost
noName.message: %|nls-22-#You must supply a name....#|
!
! To display this dialog:
! 1. Run CreateAction
! 2. Type something in the 'Name:' field but not
! the 'Command Line:' field.
! 3. Press 'OK'
!
! In this block, localize title, ok.label, and message.
!
noExecString.type: ErrorDialog
noExecString.title: %|nls-3-#Create Action - Error#|
noExecString.helpTitle: %|nls-2-#Create Action - Help#|
noExecString.helpType: Topic
noExecString.helpVolume: Dtmisc
noExecString.helpLocation: ToUseMakeActionTA
noExecString.dialogButtons: ok
noExecString.ok.label: %|nls-8-#OK#|
noExecString.ok.isDefault: True
noExecString.ok.action: f.unpost
noExecString.message: %|nls-23-#You must supply a command....#|
!
! To display this dialog:
! 1. Run CreateAction
! 2. Do not type in anything
! 3. Press 'OK'
!
! In this block, localize title, ok.label, and message.
!
noNameOrExec.type: ErrorDialog
noNameOrExec.title: %|nls-3-#Create Action - Error#|
noNameOrExec.helpTitle: %|nls-2-#Create Action - Help#|
noNameOrExec.helpType: Topic
noNameOrExec.helpVolume: Dtmisc
noNameOrExec.helpLocation: ToUseMakeActionTA
noNameOrExec.dialogButtons: ok
noNameOrExec.ok.label: %|nls-8-#OK#|
noNameOrExec.ok.isDefault: True
noNameOrExec.ok.action: f.unpost
noNameOrExec.message: \
%|nls-24-#You must supply a name and....#|
!
! To display this dialog:
! 1. Run CreateAction
! 2. Type something in the 'Name:' field that contains
! a blank
! 3. Press 'OK'
!
! In this block, localize title, ok.label, and message.
!
foundBlank.type: ErrorDialog
foundBlank.title: %|nls-3-#Create Action - Error#|
foundBlank.helpTitle: %|nls-2-#Create Action - Help#|
foundBlank.helpType: Topic
foundBlank.helpVolume: Dtmisc
foundBlank.helpLocation: ToUseMakeActionTA
foundBlank.dialogButtons: ok
foundBlank.ok.label: %|nls-8-#OK#|
foundBlank.ok.isDefault: True
foundBlank.ok.action: f.unpost
foundBlank.message: %|nls-25-#The action name....#|
!
! To display this dialog:
! 1. Run CreateAction
! 2. Type something longer than 11 characters in the 'Name:' field.
! 3. Type something in the 'Command Line:' field.
! 4. Press 'OK'
!
! In this block, localize title, ok.label, cancel.label, and message.
!
longName.type: WarningDialog
longName.title: %|nls-4-#Create Action - Warning#|
longName.helpTitle: %|nls-2-#Create Action - Help#|
longName.helpType: Topic
longName.helpVolume: Dtmisc
longName.helpLocation: ToUseMakeActionTA
longName.dialogButtons: ok,cancel
longName.ok.label: %|nls-8-#OK#|
longName.ok.isDefault: True
longName.ok.action: f.unpost
longName.cancel.label: %|nls-9-#Cancel#|
longName.cancel.action: f.unpost
longName.message: \
%|nls-26-#The following action name....#|
!
! To display this dialog:
! 1. Run CreateAction
! 2. Fill out the 'Name:' field.
! 3. Type 'foo | bar' in the 'Command Line:' field.
! 4. Press 'OK'
!
! In this block, localize title, ok.label, and message.
!
needShell.type: ErrorDialog
needShell.title: %|nls-3-#Create Action - Error#|
needShell.helpTitle: %|nls-2-#Create Action - Help#|
needShell.helpType: Topic
needShell.helpVolume: Dtmisc
needShell.helpLocation: ToUseMakeActionTA
needShell.dialogButtons: ok
needShell.ok.label: %|nls-8-#OK#|
needShell.ok.isDefault: True
needShell.ok.action: f.unpost
needShell.message: \
%|nls-27-#The command line for your....#|
!
! To display this dialog:
! 1. Run CreateAction
! 2. Fill out the 'Name:' field.
! 3. Type 'echo $*' in the 'Command Line:' field.
! 4. Type 'Quote "' in the 'Filename Prompt:' field.
! 5. Press 'OK'
!
! In this block, localize title, ok.label, and message.
!
promptQuote.type: ErrorDialog
promptQuote.title: %|nls-3-#Create Action - Error#|
promptQuote.helpTitle: %|nls-2-#Create Action - Help#|
promptQuote.helpType: Topic
promptQuote.helpVolume: Dtmisc
promptQuote.helpLocation: ToUseMakeActionTA
promptQuote.dialogButtons: ok
promptQuote.ok.label: %|nls-8-#OK#|
promptQuote.ok.isDefault: True
promptQuote.ok.action: f.unpost
promptQuote.message: \
%|nls-28-#The 'Filename Prompt:' field....#|
!
! To display this dialog:
! 1. Run CreateAction
! 2. Fill out the 'Name:' field.
! 3. Type 'echo hi' in the 'Command Line:' field.
! 4. Type 'Filename:' in the 'Filename Prompt:' field.
! 5. Press 'OK'
!
! In this block, localize title, ok.label, and message.
!
unusedPrompt.type: ErrorDialog
unusedPrompt.title: %|nls-3-#Create Action - Error#|
unusedPrompt.helpTitle: %|nls-2-#Create Action - Help#|
unusedPrompt.helpType: Topic
unusedPrompt.helpVolume: Dtmisc
unusedPrompt.helpLocation: ToUseMakeActionTA
unusedPrompt.dialogButtons: ok
unusedPrompt.ok.label: %|nls-8-#OK#|
unusedPrompt.ok.isDefault: True
unusedPrompt.ok.action: f.unpost
unusedPrompt.message: \
%|nls-29-#The cmd line must use....#|
!
! To display this dialog:
! 1. Touch $HOME/.dt/types/test.vf
! 2. chmod 444 $HOME/.dt/types/test.vf
! 3. Run CreateAction
! 4. Type 'test' in the 'Name:' field.
! 5. Type 'echo hi' in the 'Command Line:' field.
! 6. Press 'OK'
!
! In this block, localize title, ok.label, and message
!
notWritable.type: ErrorDialog
notWritable.title: %|nls-3-#Create Action - Error#|
notWritable.helpTitle: %|nls-2-#Create Action - Help#|
notWritable.helpType: Topic
notWritable.helpVolume: Dtmisc
notWritable.helpLocation: ToUseMakeActionTA
notWritable.dialogButtons: ok
notWritable.ok.label: %|nls-8-#OK#|
notWritable.ok.isDefault: True
notWritable.ok.action: f.unpost
notWritable.message: \
%|nls-30-#The following action definition....#|
!
! To display this dialog:
! 1. rm $HOME/.dt/types/test.vf $HOME/.dt/types/tools/test
! 2. Run CreateAction
! 3. Type 'test' in the 'Name:' field.
! 4. Type 'echo hi' in the 'Command Line:' field.
! 5. Press 'OK'
!
! In this block, localize title, ok.label, and message.
!
actionExists.type: InformationDialog
actionExists.title: %|nls-1-#Create Action#|
actionExists.helpTitle: %|nls-2-#Create Action - Help#|
actionExists.helpType: Topic
actionExists.helpVolume: Dtmisc
actionExists.helpLocation: ToUseMakeActionTA
actionExists.dialogButtons: ok
actionExists.ok.label: %|nls-8-#OK#|
actionExists.ok.isDefault: True
actionExists.ok.action: f.unpost
actionExists.message: \
%|nls-32-#You have defined....#|\
\n\
%|nls-33-#If you are running....#|
!
! To display this dialog:
! 1. rm $HOME/.dt/types/test.vf
! 2. touch $HOME/.dt/types/tools/test
! 3. chmod 444 $HOME/.dt/types/tools/test
! 4. Run CreateAction
! 5. Type 'test' in the 'Name:' field.
! 6. Type 'echo hi' in the 'Command Line:' field.
! 7. Press 'OK'
!
! In this block, localize title, ok.label, and message
!
actionDoesntExist.type: InformationDialog
actionDoesntExist.title: %|nls-1-#Create Action#|
actionDoesntExist.helpTitle: %|nls-2-#Create Action - Help#|
actionDoesntExist.helpType: Topic
actionDoesntExist.helpVolume: Dtmisc
actionDoesntExist.helpLocation: ToUseMakeActionTA
actionDoesntExist.dialogButtons: ok
actionDoesntExist.ok.label: %|nls-8-#OK#|
actionDoesntExist.ok.isDefault: True
actionDoesntExist.ok.action: f.unpost
actionDoesntExist.message: \
%|nls-32-#You have defined....#|\
\n\
%|nls-31-#An icon for this action....#|

View File

@@ -0,0 +1,364 @@
/* $XConsortium: dtcreate.h /main/5 1996/09/17 11:01:43 rswiston $ */
/***************************************************************************/
/* */
/* dtcreate.h */
/* */
/***************************************************************************/
#ifndef _DTCREATE_H_INCLUDED
#define _DTCREATE_H_INCLUDED
#define __TOOLTALK
#include <Xm/Xm.h>
#include <nl_types.h>
#include <sys/param.h>
#ifndef STORAGECLASS
#ifdef NOEXTERN
#define STORAGECLASS
#else
#define STORAGECLASS extern
#endif
#endif
/***************************************************************************/
/* */
/* Constant Declarations */
/* */
/***************************************************************************/
#define TRUE 1
#define FALSE 0
#define Psz (char *)
#define MAXFILENAME MAXPATHLEN
#define MAXBUFSIZE 256
/*******************************************************************/
/* Icon Sizes */
/*******************************************************************/
#define CA_LRG_ICON_SIZE 48
#define CA_MED_ICON_SIZE 32
#define CA_SML_ICON_SIZE 24
#define CA_TINY_ICON_SIZE 16
/*******************************************************************/
/* FILE SELECTION WIDGET VALUES */
/*******************************************************************/
#define CA_ACTION_ICONS 1
#define CA_FILETYPE_ICONS 2
#define CA_FILE 3
/*******************************************************************/
/* ActionData fsFlags values */
/*******************************************************************/
#define CA_WT_XWINDOWS 0x0001
#define CA_WT_TERM 0x0002
#define CA_WT_PERMTERM 0x0004
#define CA_WT_SHELLTERM 0x0008
#define CA_DF_ONLYFTFILES 0x0010
/*******************************************************************/
/* Filetype flags. */
/*******************************************************************/
#define CA_FT_CNTSTRING 0x0001
#define CA_FT_CNTBYTE 0x0002
#define CA_FT_CNTSHORT 0x0004
#define CA_FT_CNTLONG 0x0008
/*******************************************************************/
/* Filetype Internal flags */
/*******************************************************************/
#define CA_FT_APPLY 0x0001
#define CA_FT_EDIT 0x0002
/*******************************************************************/
/* Icon filename extensions */
/*******************************************************************/
#define LARGE_EXT ".l"
#define MEDIUM_EXT ".m"
#define SMALL_EXT ".t"
#define TINY_EXT ".t"
#define PIXMAP_EXT ".pm"
#define BITMAP_EXT ".bm"
#define MAX_EXT_SIZE 5
#define EXT_DELIMITER '.'
#define ICON_BORDER_WIDTH 1
#define ICON_NUMBER 5
/*******************************************************************/
/* Help Ids */
/*******************************************************************/
#define HELP_OVERVIEW 1
#define HELP_TASKS 2
#define HELP_REFERENCE 3
#define HELP_USING 4
#define HELP_ABOUT 5
#define HELP_ONITEM 6
#define HELP_ADDFILETYPE 10
#define HELP_FILECHAR 20
#define HELP_ICONSELECTOR 30
#define HELP_OPENFILE 40
/*****************************************************************************/
/* */
/* enums */
/* */
/*****************************************************************************/
enum icon_size_range {None_Selected, Large_Icon, Medium_Icon, Small_Icon, Tiny_Icon};
enum icon_data_range {CA_LRG, CA_MED, CA_TINY, AF_MED, AF_TINY};
/***************************************************************************/
/* */
/* Structure Declarations */
/* */
/***************************************************************************/
typedef struct _FiletypeData *pFiletypeData;
typedef struct _FiletypeData {
char *pszName;
char *pszIcon;
char *pszMedPmIcon;
char *pszMedBmIcon;
char *pszTinyPmIcon;
char *pszTinyBmIcon;
char *pszHelp;
char *pszOpenCmd;
char *pszPrintCmd;
char *pszPattern;
char *pszPermissions;
char *pszContents;
int sStart;
int sEnd;
ushort fsFlags;
ushort fsInternal;
} FiletypeData;
typedef struct _ActionData *pActionData;
typedef struct _ActionData {
char *pszName;
char *pszIcon;
char *pszCmd;
char *pszHelp;
char *pszPrompt;
FiletypeData **papFiletypes;
short cFiletypes;
ushort fsFlags;
} ActionData;
typedef struct {
char *pszSessionFile;
Boolean useSession;
Boolean showExpert;
int iconicState;
Position x, y;
Dimension width, height;
char workspaces[256];
} SessionData, *SessionDataPtr;
typedef struct {
Widget wid;
char *pmMsgID;
char *bmMsgID;
char pmFileName[MAXPATHLEN];
char bmFileName[MAXPATHLEN];
Boolean pmDirtyBit;
Boolean bmDirtyBit;
enum icon_size_range size;
} IconData, *IconDataPtr;
/***************************************************************************/
/* */
/* Macro Declarations */
/* */
/***************************************************************************/
#define GETMESSAGE(set, number, defstr) catgets(nlmsg_fd, set, number, defstr)
/***************************************************************************/
/* */
/* Global Variable Declarations */
/* */
/***************************************************************************/
/*******************************************************************/
/* Global variables that are not being initialized. */
/*******************************************************************/
STORAGECLASS ActionData AD;
STORAGECLASS ActionData *pMyCopyAD;
STORAGECLASS char *pszFileToEdit;
STORAGECLASS Cursor watch_cursor;
STORAGECLASS Widget widEditSource;
STORAGECLASS Boolean bIconEditorDisplayed;
STORAGECLASS nl_catd nlmsg_fd;
STORAGECLASS char *pszExecName;
STORAGECLASS Widget widSelectedIcon;
STORAGECLASS Boolean bLowRes;
STORAGECLASS IconData *IconDataList[ICON_NUMBER];
/**********************************************************/
/* CreateActionAppShell globals. */
/**********************************************************/
STORAGECLASS Widget CreateActionAppShell;
STORAGECLASS Widget ExpertOption;
STORAGECLASS Widget ColorMonoOption;
STORAGECLASS Widget CA_ActionNameTextField;
STORAGECLASS Widget CA_MED_IconGadget;
STORAGECLASS Widget CA_SML_IconGadget;
STORAGECLASS Widget CA_TINY_IconGadget;
STORAGECLASS Widget CA_LRG_IconGadget;
STORAGECLASS Widget CA_DblClkText;
STORAGECLASS Widget XprtOptionForm;
STORAGECLASS Widget CA_XprtActionOpenText;
STORAGECLASS Widget CA_FiletypesList;
STORAGECLASS Widget CA_WindowTypeArea;
STORAGECLASS Widget CA_WindowType;
STORAGECLASS Widget CA_Expand;
#if 0
STORAGECLASS Widget CA_WindowType_OptionMenuShell;
STORAGECLASS Widget CA_WindowType_Pane;
#endif
STORAGECLASS Widget CA_WinTypeX;
STORAGECLASS Widget CA_WinTypeAutoClose;
STORAGECLASS Widget CA_WinTypeManualClose;
STORAGECLASS Widget CA_WinTypeNoOutput;
STORAGECLASS Widget CA_HelpTextWindow;
STORAGECLASS Widget CA_HelpText;
STORAGECLASS Widget CA_AllFiletypesToggle;
STORAGECLASS Widget CA_FiletypesInListToggle;
/**********************************************************/
/* AddFiletype globals. */
/**********************************************************/
STORAGECLASS Widget AddFiletype;
STORAGECLASS Widget AF_FileTypeNameTextField;
STORAGECLASS Widget AF_IdCharacteristicsText;
STORAGECLASS Widget AF_IdCharacteristicsEdit;
STORAGECLASS Widget AF_FiletypePrintCmdTextField;
STORAGECLASS Widget AF_OpenCmdText;
STORAGECLASS Widget AF_FiletypeHelpText;
STORAGECLASS Widget AF_MED_IconGadget;
STORAGECLASS Widget AF_TINY_IconGadget;
/**********************************************************/
/* FileCharacteristics globals */
/**********************************************************/
STORAGECLASS Widget FileCharacteristics;
STORAGECLASS Widget FC_DirectoryToggle;
STORAGECLASS Widget FC_FileToggle;
STORAGECLASS Widget FC_AndLabel2;
STORAGECLASS Widget FC_ContentsPatternText;
STORAGECLASS Widget FC_StringToggle;
STORAGECLASS Widget FC_ByteToggle;
STORAGECLASS Widget FC_ShortToggle;
STORAGECLASS Widget FC_LongToggle;
STORAGECLASS Widget FC_StartByteTextField;
/*
STORAGECLASS Widget FC_EndByteTextField;
*/
STORAGECLASS Widget FC_NameOrPathText;
STORAGECLASS Widget FC_AndLabel1;
STORAGECLASS Widget FC_PermissionForm;
STORAGECLASS Widget FC_ReadToggle;
STORAGECLASS Widget FC_WriteToggle;
STORAGECLASS Widget FC_ExecuteToggle;
STORAGECLASS Widget FC_NamePatternLabel;
STORAGECLASS Widget FC_PermissionLabel;
STORAGECLASS Widget FC_PermissionToggle;
STORAGECLASS Widget FC_ContentsLabel;
STORAGECLASS Widget FC_ContentsBox;
STORAGECLASS Widget FC_TypeRowColumn;
STORAGECLASS Widget FC_StartByteLabel;
STORAGECLASS Widget FC_TypeLabel;
STORAGECLASS Widget FC_ContentsPatternLabel;
/*
STORAGECLASS Widget FC_EndByteLabel;
*/
STORAGECLASS Widget FC_ContentsToggle;
STORAGECLASS Widget FC_NameOrPathToggle;
/**********************************************************/
/* icon_selection_dialog globals */
/**********************************************************/
STORAGECLASS Widget ISD_SelectedIconTextField;
/**********************************************************/
/* Other dialog globals */
/**********************************************************/
STORAGECLASS SessionData sessiondata;
/*******************************************************************/
/* Global variables that are being initialized. */
/*******************************************************************/
#ifdef NOEXTERN
STORAGECLASS enum icon_size_range action_icon_size = None_Selected;
STORAGECLASS enum icon_size_range filetype_icon_size = None_Selected;
STORAGECLASS int pidIconEditor = 0;
STORAGECLASS Boolean bShowPixmaps = TRUE;
STORAGECLASS Widget IconSelector = (Widget)NULL;
STORAGECLASS Boolean DbInitDone = FALSE;
STORAGECLASS Widget OpenFile = (Widget)NULL;
STORAGECLASS Widget Confirmed = (Widget)NULL;
STORAGECLASS Widget QuestionDialog = (Widget)NULL;
STORAGECLASS Widget ErrorDialog = (Widget)NULL;
STORAGECLASS Widget last_action_pushed = (Widget)NULL;
STORAGECLASS Widget last_filetype_pushed = (Widget)NULL;
STORAGECLASS const char *ca_icon_default = "Dtactn";
STORAGECLASS const char *ca_full_icon_default = "/usr/dt/appconfig/icons/C/Dtactn";
STORAGECLASS const char *ca_lrg_icon_default = "/usr/dt/appconfig/icons/C/Dtactn.l";
STORAGECLASS const char *ca_med_icon_default = "/usr/dt/appconfig/icons/C/Dtactn.m";
STORAGECLASS const char *ca_sml_icon_default = "/usr/dt/appconfig/icons/C/Dtactn.s";
STORAGECLASS const char *ca_tiny_icon_default = "/usr/dt/appconfig/icons/C/Dtactn.t";
STORAGECLASS const char *af_icon_default = "Dtdata";
STORAGECLASS const char *af_full_icon_default = "/usr/dt/appconfig/icons/C/Dtdata";
STORAGECLASS const char *af_lrg_icon_default = "/usr/dt/appconfig/icons/C/Dtdata.l";
STORAGECLASS const char *af_med_icon_default = "/usr/dt/appconfig/icons/C/Dtdata.m";
STORAGECLASS const char *af_sml_icon_default = "/usr/dt/appconfig/icons/C/Dtdata.s";
STORAGECLASS const char *af_tiny_icon_default = "/usr/dt/appconfig/icons/C/Dtdata.t";
#else /* NOEXTERN */
STORAGECLASS enum icon_size_range action_icon_size;
STORAGECLASS enum icon_size_range filetype_icon_size;
STORAGECLASS int pidIconEditor;
STORAGECLASS Boolean bShowPixmaps;
STORAGECLASS Widget IconSelector;
STORAGECLASS Boolean DbInitDone;
STORAGECLASS Widget OpenFile;
STORAGECLASS Widget Confirmed;
STORAGECLASS Widget QuestionDialog;
STORAGECLASS Widget ErrorDialog;
STORAGECLASS Widget last_action_pushed;
STORAGECLASS Widget last_filetype_pushed;
STORAGECLASS const char *ca_icon_default;
STORAGECLASS const char *ca_full_icon_default;
STORAGECLASS const char *ca_lrg_icon_default;
STORAGECLASS const char *ca_med_icon_default;
STORAGECLASS const char *ca_sml_icon_default;
STORAGECLASS const char *ca_tiny_icon_default;
STORAGECLASS const char *af_icon_default;
STORAGECLASS const char *af_full_icon_default;
STORAGECLASS const char *af_lrg_icon_default;
STORAGECLASS const char *af_med_icon_default;
STORAGECLASS const char *af_sml_icon_default;
STORAGECLASS const char *af_tiny_icon_default;
#endif /* NOEXTERN */
#endif /* _DTCREATE_H_INCLUDED */

View File

@@ -0,0 +1,392 @@
$ $TOG: dtcreate.msg /main/4 1999/09/17 17:21:36 mgreess $
$ %Z%%M% %I% %W% %G% %U%
$
$ COMPONENT_NAME: dtcreate
$
$ FUNCTIONS: none
$
$ ORIGINS: 27
$
$
$ (C) COPYRIGHT International Business Machines Corp. 1993
$ All Rights Reserved
$ Licensed Materials - Property of IBM
$ US Government Users Restricted Rights - Use, duplication or
$ disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
$
$ ** Description:
$ ** ------------
$ ** This is the source message catalog file for dtcreate.
$set 2
$ *****************************************************************************
$ **
$ ** Message set for menu options on main window
$ **
$ *****************************************************************************
10 File
11 F
15 Open...
16 O
20 New
21 N
25 Save
26 S
30 Exit
31 x
35 Options
36 O
40 Show Advanced Functions
41 A
42 Icon View
43 I
44 Color
46 C
47 Monochrome
48 M
49 Show Monochrome Icons
50 M
53 Help
54 H
60 Overview
61 v
65 Table of Contents
66 C
70 Tasks
71 T
75 Reference
76 R
80 Using Help
81 U
85 About Create Action
86 A
$set 3
$ *****************************************************************************
$ **
$ ** Message set for main Create Action window
$ **
$ *****************************************************************************
10 Create Action
12 Action Name (Icon Label):
13 Action Icons:
20 Command When Action Icon Is Double-clicked:
21 Command To Execute When Double-clicked:
22 Command When Action Is Opened (Double-clicked):
30 Help Text For Action Icon:
32 Window Type:
34 Graphical (X-Window)
36 Terminal (Auto-Close)
38 Terminal (Manual Close)
40 No Output
50 Advanced
52 Basic
$set 4
$ *****************************************************************************
$ **
$ ** Message set for main Create Action window advanced function area
$ **
$ *****************************************************************************
10 Optional
11 When Action Opens, Ask Users for:
12 Datatypes That Use This Action:
13 Add...
14 Delete
15 Edit...
16 Dropable Datatypes:
17 All Datatypes
18 Only Above List
$set 5
$ *****************************************************************************
$ **
$ ** Error and Information message set for main Create Action window
$ **
$ *****************************************************************************
10 The Action Name is missing.\n\
Please enter a name in the 'Action Name' field.
$
15 The execute command is missing.\n\
Please enter a command in the\n\
'Command When Action Is Opened (Double-clicked)' field.
$
20 The 'Datatypes That Use This Action' list is empty.\n\
You have selected 'Only Above List' in the\n\
'Dropable Datatypes' field.\n\
Change the Dropable Datatype choice to 'All Datatypes'\n\
or add at least one datatype to the list.
$
25 An action and datatype definition file already exists\n\
with this Action Name.\n\
You can cancel the Save and change your Action Name\n\
or you can overwrite the existing definition file.\n\
Do you wish to overwrite the existing definition file?
$
30 A variable name is missing in the\n\
'Command When Action Is Opened (Double-clicked)' field.\n\
Add a variable name for the label you have entered\n\
in the 'When Action Opens, Ask Users for' field.\n\
Valid variable names are $*, $1, $2, ..., $9.
$
35 These changes have not been saved.\n\
Do you wish to save these changes before you Exit?
$
40 The current changes have not been saved.\n\
Do you want to save this action before clearing\n\
the fields for a New action?
$
45 The current changes have not been saved.\n\
Do you want to save these changes before clearing\n\
the fields to load another action definition file?
$
50 The Action Name contains one or more illegal\n\
characters.\n\
The following characters should not be used in a name:\n\
/ \ " ' ; ( ) ~ ! $ { } < > # @ | &
$
55 Could not create the following file:
$
60 Could not open the following file:
$
65 Could not load the following file because it was\n\
not originally created by the Create Action tool:
$
66 Could not load the file because it has been altered by some\n\
other means other than Create Action. This could have been caused\n\
by modifying the file with a text editor or some other tool.
$
67 Create Action can only edit files that were created\n\
and edited by Create Action.
$
68 Could not load the following file:
$
$ The following messages are all part of the same message dialog
70 The new action
71 has been placed in your home folder.
73 The action definition file that was created is called:
$
80 Could not find all of the sizes of the icon\n\
you have selected.
$
85 Could not start the Icon Editor.
$
90 Could not parse the following file:
$
95 Could not find the following icon file within the icon\n\
search path.
$
98 The icon you have selected is not in the icon search path.\n\
You must move the icon to a directory in the icon search\n\
path so that the icon will be displayed properly within desktop\n\
environment.\n\
Select 'Ok' if you want to use this icon.\n\
Select 'Cancel' if you want to select a different icon.
$
$ ONLY TRANSLATE "Usage" and "filename"
110 Usage: dtcreate [<filename>] [-?]
$
120 You have not selected a Datatype from the\n\
'Datatypes That Use This Action' list.
125 Please select the Datatype you would like to Delete.
130 Please select the Datatype you would like to Edit.
$
150 Your current work has not been saved.
152 Don't Save
154 Cancel Close
$
160 Could not save session to file:
162 Could not restore session from file:
$
$ TRANSLATORS: DO NOT TRANSLATE the word "HOME" in the following message
170 The HOME environment variable is not set.\n\
The HOME environment variable must be set in order\n\
for this action to be saved.
$set 6
$ *****************************************************************************
$ **
$ ** General message set for dialogs
$ **
$ *****************************************************************************
10 Ok
11 Apply
12 Cancel
13 Help
14 Clear
18 Find Set
19 Find Set...
20 Edit Icon...
31 Create Action - Error
41 Create Action - Confirmation
46 Create Action - Information
51 Create Action - Question
$set 7
$ *****************************************************************************
$ **
$ ** Message set for Add Datatype and Edit Datatype dialogs
$ **
$ *****************************************************************************
10 Add Datatype
11 Edit Datatype
14 Name of Datatype Family:
15 Identifying Characteristics:
16 Edit...
17 Help Text for this Datatype Icon:
18 Datatype Icons:
21 Commands
22 Command to Open this Datatype:
23 Command to Print this Datatype:
30 Open
31 Print
$set 8
$ *****************************************************************************
$ **
$ ** Error and Information message set for
$ ** Add Datatype and Edit Datatype dialogs
$ **
$ *****************************************************************************
10 The Datatype Family Name is missing.\n\
Enter a name in the 'Name of Datatype Family' field.
$
15 The Identifying Characteristics are missing.\n\
You must specify the characteristics before the datatype\n\
can be created. Select the Edit button next to the\n\
Identifying Characteristics list to specify the characteristics.
$
20 The 'Name of Datatype Family' field contains one or more\n\
illegal characters.\n\
The following characters should not be used in a name:\n\
/ \ " ' ; ( ) ~ ! $ { } < > # @ | &
$
25 A Datatype Family with this name already exists.\n\
Please change the name in the 'Name of Datatype Family'\n\
field.
$set 9
$ *****************************************************************************
$ **
$ ** Message set for Identifying Characteristics dialog
$ **
$ *****************************************************************************
10 Identifying Characteristics
11 Include All
12 Files
13 Folders
14 That Match The Following:
20 Name Pattern:
21 Permission Pattern:
22 Readable
24 Writeable
25 Executable
27 AND
28 Contents:
29 Pattern:
30 Type:
31 String
32 Byte (Hex)
33 Short (Decimal)
34 Long (Decimal)
35 Start Byte:
40 Read:
41 Write:
42 Execute:
43 On
44 Off
45 Either
$set 10
$ *****************************************************************************
$ **
$ ** Error and Information message set for Identifying Characteristics dialog
$ **
$ *****************************************************************************
10 Name Pattern is missing.\n\
If Name Pattern is selected, a name pattern\n\
must be entered.
$
15 Permissions choice is missing.\n\
If Permission Pattern is selected, one or\n\
more of the choices under Permission\n\
Pattern must be selected.
$
20 Contents Pattern is missing.\n\
If Contents is selected, then the Pattern field\n\
under Contents must be filled in.
$
25 Start byte value is missing.\n\
If Contents is selected, then a number must be\n\
entered in the 'Start Byte' field.
$
30 An identifying characteristic has not been selected.\n\
Select one or more of the characteristics\n\
(Name Pattern, Permissions Pattern, or Contents).
$
45 The Name Pattern contains one or more illegal\n\
characters.\n\
The following characters should not be used in\n\
a Name Pattern:\n\
/ \ " ' ; ( ) ~ ! $ { } < > # @ | &
$
46 The Contents Pattern does not match the format for\n\
the contents Type you have selected.\n\
Retype the Contents Pattern in the correct format or\n\
change the Type so that it matches the Contents Pattern.
$
47 The Start Byte field contains illegal characters.\n\
This field can only accept numbers in a decimal format.
$
48 Using the Contents Pattern may significantly slow\n\
down your File Manager performance.\n\
When Contents Pattern is used, the File Manager must\n\
search the contents of all files in a folder before\n\
it can open that folder. This means that folders\n\
will open more slowly.\n\
Therefore, it is recommended that you only use name and\n\
permissions patterns.
$set 11
$ *****************************************************************************
$ **
$ ** Message set for Icon Selection Dialog
$ **
$ *****************************************************************************
10 Directories
11 Icon Files
12 Enter Icon Filename
20 Loading icons. Please wait.
30 Icon Folders
50 The Icon Filename entered is invalid.\n\
Please enter a valid icon file name in the\n\
'Enter Icon Filename' field.
$ ONLY TRANSLATE "Empty". Do not translate the brackets "[" and "]".
60 [Empty]
$set 12
$ *****************************************************************************
$ **
$ ** Message set for Open File Dialog
$ **
$ *****************************************************************************
10 Filter
11 Directories
12 Files
13 Selection
20 Open File
25 Create Action - Open
$set 13
$ *****************************************************************************
$ **
$ ** Message set for DieFromToolTalkError Dialog
$ **
$ *****************************************************************************
$ These are the messages for the ToolTalk error dialog
$ "-NEW"
1 Create Action - Error
$ "-NEW"
2 "Could not connect to ToolTalk:\n%s\nExiting ..."
$ "-NEW"
3 OK

View File

@@ -0,0 +1,439 @@
#!/bin/ksh
#######################################################################
#
# dtcreate
#
# The shell-script which implements dtcreate (a.k.a. CreateAction).
#
# Hewlett-Packard Visual User Environment
#
# Copyright (c) 1990 Hewlett-Packard Company
#
# @(#) $XConsortium: dtcreate.sh /main/3 1995/11/01 16:13:20 rswiston $
#
######################################################################
#####################################################################
#
# determine_system - determines the system name and then sets
# the global variables _SIGUSR1 and _SIGUSR2 accordingly.
#
determine_system ()
{
sys_name=`uname`
case ${sys_name} in
HP-UX)
_SIGUSR1=16
_SIGUSR2=17
;;
AIX)
_SIGUSR1=30
_SIGUSR2=31
;;
*)
_SIGUSR1=16
_SIGUSR2=17
;;
esac
}
#####################################################################
#
# getvalue accepts two arguments, the name of the resource whose
# value is desired and the name of the file where it is contained.
# The value of the resource is returned in $VALUE.
#
getvalue ()
{
VALUE=`grep $1 $2 | sed -e "s/[^:]*: *//"`
}
enabledialog ()
{
# Sending SIGUSR1 to the dtdialog process tells it to reenable
# the dialog.
kill -${_SIGUSR1} $1
}
toggleinvaliddialog ()
{
# Sending SIGIUSR2 to the dtdialog process tells it to either
# go to the invalid state (put up the invalid cursor) or go
# back to its previous state (either active or busy).
kill -${_SIGUSR2} $1
}
dismissdialog ()
{
# Sending SIGINT to the dtdialog process tells it to remove the
# dialog and die.
kill -2 $1
}
##############################################################
#
# checkprocess accepts a single argument with is a process-id.
# If the specified process is running (as reported by ps -ef),
# checkprocess returns 1. If it isn't running, checkprocess
# returns 0.
#
checkprocess ()
{
RUNNING=`ps -ef | cut -c 9-14 | grep -c $1`
if [ "$RUNNING" = "0" ] ; then
return 0
else
return 1
fi
}
# This is the main callback that is called whenever the user presses
# one of the buttons on the CreateAction dialog.
actioncallback ()
{
# Check which button on the dialog was invoked. The Help button
# is automatically handled by dtdialog, so it is only the apply
# and close buttons that we care about.
getvalue selectedButton $DIALOG_OUTPUT
if [ "$VALUE" = "apply" ] ; then
checkactionvalues
else
cleanupandexit
fi
}
checkactionvalues ()
{
# Read all the values in from the dialog.
getvalue windowId $DIALOG_OUTPUT
CREATEACTION_WID=$VALUE
getvalue name.text $DIALOG_OUTPUT
ACTION=$VALUE
getvalue largeIcon.text $DIALOG_OUTPUT
LICON=$VALUE
getvalue smallIcon.text $DIALOG_OUTPUT
SICON=$VALUE
getvalue description.text $DIALOG_OUTPUT
DESCRIPTION=`echo $VALUE | tr -s "\012" " "`
getvalue commandLine.text $DIALOG_OUTPUT
EXECSTRING=$VALUE
getvalue prompt.text $DIALOG_OUTPUT
PROMPT=$VALUE
getvalue commandType.active $DIALOG_OUTPUT
if [ "$VALUE" = "xWin" -o "$VALUE" = "noOut" ] ; then
WINDOWTYPE="NO_STDIO"
elif [ "$VALUE" = "term" ] ; then
WINDOWTYPE="PERM_TERMINAL"
else
WINDOWTYPE="TERMINAL"
fi
BAIL_OUT=""
# Make sure that an action name and an exec-string were provided.
if [ ! "$BAIL_OUT" -a ! "$ACTION" -a ! "$EXECSTRING" ] ; then
dtdialog -descFile dtcreate.ddf -dialogName noNameOrExec \
-transientFor $CREATEACTION_WID &
SECONDARY_DIALOG_PIDS[${NUM_SECONDARY_DIALOGS}]=$!
let NUM_SECONDARY_DIALOGS=${NUM_SECONDARY_DIALOGS}+1
enabledialog $CREATEACTION_PID
BAIL_OUT="yes"
fi
if [ ! "$BAIL_OUT" -a ! "$ACTION" ] ; then
dtdialog -descFile dtcreate.ddf -dialogName noName \
-transientFor $CREATEACTION_WID &
SECONDARY_DIALOG_PIDS[${NUM_SECONDARY_DIALOGS}]=$!
let NUM_SECONDARY_DIALOGS=${NUM_SECONDARY_DIALOGS}+1
enabledialog $CREATEACTION_PID
BAIL_OUT="yes"
fi
if [ ! "$BAIL_OUT" -a ! "$EXECSTRING" ] ; then
dtdialog -descFile dtcreate.ddf -dialogName noExecString \
-transientFor $CREATEACTION_WID &
SECONDARY_DIALOG_PIDS[${NUM_SECONDARY_DIALOGS}]=$!
let NUM_SECONDARY_DIALOGS=${NUM_SECONDARY_DIALOGS}+1
enabledialog $CREATEACTION_PID
BAIL_OUT="yes"
fi
# Make sure the action name does not contain any blanks.
if [ ! "$BAIL_OUT" -a `echo $ACTION | grep -c ' '` -eq 1 ] ; then
dtdialog -descFile dtcreate.ddf -dialogName foundBlank \
-transientFor $CREATEACTION_WID &
SECONDARY_DIALOG_PIDS[${NUM_SECONDARY_DIALOGS}]=$!
let NUM_SECONDARY_DIALOGS=${NUM_SECONDARY_DIALOGS}+1
enabledialog $CREATEACTION_PID
BAIL_OUT="yes"
fi
if [ ! "$BAIL_OUT" ] ; then
# Check the vf file we want to write to. If it exists and
# isn't writable, complain.
VF_DIR=$HOME/.dt/types
# Hack warning! Do temporary dt stuff.
if [[ $doDT = 1 ]] then
VF_FILE=$VF_DIR/$ACTION.dt
else
VF_FILE=$VF_DIR/$ACTION.vf
fi
if [ -f $VF_FILE -a ! -w $VF_FILE ] ; then
dtdialog -descFile dtcreate.ddf \
-dialogName notWritable \
-transientFor $CREATEACTION_WID \
$VF_FILE &
SECONDARY_DIALOG_PIDS[${NUM_SECONDARY_DIALOGS}]=$!
let NUM_SECONDARY_DIALOGS=${NUM_SECONDARY_DIALOGS}+1
enabledialog $CREATEACTION_PID
BAIL_OUT="yes"
fi
fi
# Check if the action name is longer than 11 characters.
# If so, warn about the problems with short filename
# systems and give the user a chance to change it. This is a
# modal dialog (not run in background) because the user has to
# make a choice.
if [ ! "$BAIL_OUT" -a `echo $ACTION | wc -c` -gt 11 ] ; then
toggleinvaliddialog $CREATEACTION_PID
dtdialog -descFile dtcreate.ddf \
-dialogName longName \
-transientFor $CREATEACTION_WID $ACTION
if [ $? -eq 2 ] ; then
enabledialog $CREATEACTION_PID
BAIL_OUT="yes"
else
toggleinvaliddialog $CREATEACTION_PID
fi
fi
# Check that if the exec-string uses any shell features (e.g. pipes),
# that a shell is explicitly specified.
if [ ! "$BAIL_OUT" -a `echo $EXECSTRING | grep -c '[|&;<>]'` -eq 1 -a\
! `echo $EXECSTRING | grep -c 'sh '` -eq 1 ] ; \
then
dtdialog -descFile dtcreate.ddf -dialogName needShell \
-transientFor $CREATEACTION_WID &
SECONDARY_DIALOG_PIDS[${NUM_SECONDARY_DIALOGS}]=$!
let NUM_SECONDARY_DIALOGS=${NUM_SECONDARY_DIALOGS}+1
enabledialog $CREATEACTION_PID
BAIL_OUT="yes"
fi
# Check that the prompt string does not contain quotes. I
# think there is a bug here that a single backquote (`) is not
# detected. I need to figure out the correct grep expression
# to catch it.
QUOTES=`echo \'$PROMPT\' | tr '!$%&(-\\\/"' '%%%%%%%%%' | fgrep -c %`
if [ ! "$BAIL_OUT" -a $QUOTES -eq 1 ] ; then
dtdialog -descFile dtcreate.ddf \
-transientFor $CREATEACTION_WID \
-dialogName promptQuote &
SECONDARY_DIALOG_PIDS[${NUM_SECONDARY_DIALOGS}]=$!
let NUM_SECONDARY_DIALOGS=${NUM_SECONDARY_DIALOGS}+1
enabledialog $CREATEACTION_PID
BAIL_OUT="yes"
fi
# Check that if a prompt is supplied, that the action calls for
# arguments.
if [ ! "$BAIL_OUT" ] ; then
if [ "$PROMPT" -a \
`echo $EXECSTRING | grep -c "\$[*0-9]"` -eq 0 ] ; then
dtdialog -descFile dtcreate.ddf \
-transientFor $CREATEACTION_WID \
-dialogName unusedPrompt &
SECONDARY_DIALOG_PIDS[${NUM_SECONDARY_DIALOGS}]=$!
let NUM_SECONDARY_DIALOGS=${NUM_SECONDARY_DIALOGS}+1
enabledialog $CREATEACTION_PID
BAIL_OUT="yes"
fi
fi
# If no errors were caught, create the action and reenable the
# dialog.
if [ ! "$BAIL_OUT" ] ; then
createaction
enabledialog $CREATEACTION_PID
fi
}
createaction ()
{
# If the vf file already exists, we are going to copy it to a temp
# file and comment out the definition for the current action.
# Make sure that this temp file doesn't already exist so that an old
# one doesn't get used by mistake.
OLD_FILE=/tmp/`basename $0`2_$$
rm -f ${OLD_FILE}
if [ -w $VF_FILE ] ; then
sed -e "/^ACTION ${ACTION}[ ]*$/,/^[END|}]/s/^/\# /" \
${VF_FILE} > ${OLD_FILE}
fi
# Write out the new action definition.
echo "\n#\n# Action created by dtcreate\n#" > $VF_FILE
echo "ACTION $ACTION" > $VF_FILE
echo "{" >> $VF_FILE
if [ "${LICON}" ] ; then
echo "\tLARGE_ICON\t\t$LICON" >> $VF_FILE
fi
if [ "${SICON}" ] ; then
echo "\tSMALL_ICON\t\t$SICON" >> $VF_FILE
fi
if [ "${DESCRIPTION}" ] ; then
echo "\tDESCRIPTION\t$DESCRIPTION" >> $VF_FILE
fi
echo "\tTYPE\t\tCOMMAND" >>$VF_FILE
if [ "${EXECSTRING}" ] ; then
# Process the exec-string and look for $*, $1, $2, etc.
# These must be translated into DT's syntax of
# %(File)Arg_n%. Also insert the prompt string if one
# was supplied.
echo "\tEXEC_STRING\t\c" >>$VF_FILE
if [ "$PROMPT" ] ; then
echo $EXECSTRING | sed \
-e "s/\$\*/%(File)Arg_1\"$PROMPT\"% %(File)Args%/" \
-e "s/\$\([1-9]\)/%(File)Arg_\1\"$PROMPT\"%/" \
-e "s/\$\([1-9]\)/%(File)Arg_\1%/g" \
>> $VF_FILE
else
echo $EXECSTRING | sed \
-e "s/\$\*/%(File)Args%/g" \
-e "s/\$\([1-9]\)/%(File)Arg_\1%/g" >> $VF_FILE
fi
fi
if [ "${WINDOWTYPE}" ] ; then
echo "\tWINDOW_TYPE\t$WINDOWTYPE" >> $VF_FILE
fi
echo "}" >>$VF_FILE
# If the temp file with the old contents of the vf file exists,
# stick it on the end of the file we just created.
if [ -r ${OLD_FILE} ] ; then
echo "\n#\n# Commented out by dtcreate\n#" >> $VF_FILE
cat ${OLD_FILE} >> ${VF_FILE}
rm ${OLD_FILE}
fi
#
# Invoke ReloadActions so that the new action
# will be read.
dtaction -timeout 1 ReloadActions
#
# Create the action copy file in the home directory.
if [ -w ${TOOLBOX} -a ! -f ${TOOLBOX}/${ACTION} ] ; then
touch ${TOOLBOX}/${ACTION}
chmod 755 ${TOOLBOX}/${ACTION}
fi
# Check whether the action exists in the Home directory. (Either we
# just created it or it may have already existed.)
if [ -x ${TOOLBOX}/${ACTION} ] ; then
dtdialog -descFile dtcreate.ddf -dialogName actionExists \
-transientFor $CREATEACTION_WID \
$ACTION $VF_FILE &
SECONDARY_DIALOG_PIDS[${NUM_SECONDARY_DIALOGS}]=$!
let NUM_SECONDARY_DIALOGS=${NUM_SECONDARY_DIALOGS}+1
else
dtdialog -descFile dtcreate.ddf \
-dialogName actionDoesntExist \
-transientFor $CREATEACTION_WID \
$ACTION $VF_FILE &
SECONDARY_DIALOG_PIDS[${NUM_SECONDARY_DIALOGS}]=$!
let NUM_SECONDARY_DIALOGS=${NUM_SECONDARY_DIALOGS}+1
fi
}
cleanupandexit()
{
# Dismiss any secondary dialogs (e.g. Help, warnings, errors)
# that have been created.
if [ NUM_SECONDARY_DIALOGS -gt 0 ]; then
for PID in ${SECONDARY_DIALOG_PIDS[*]}
do
checkprocess $PID
if [ $? -eq 1 ] ; then
dismissdialog $PID
fi
done
fi
dismissdialog $CREATEACTION_PID
rm -f ${DIALOG_OUTPUT}
}
#####################################################################
# Main
#
#set -xv
DIALOG_OUTPUT=/tmp/`basename $0`$$
#TOOLBOX=$HOME/.dt/types/tools
TOOLBOX=$HOME
NUM_SECONDARY_DIALOGS=0
determine_system
# Hack warning: This is to determine if should create .dt file or .vf file.
if [[ -f /opt/dt/types/useFT ]] then
doDT=0
else
doDT=1
fi
# Set up the callback function that is invoked when the user
# presses any of the dialog buttons.
trap "actioncallback" ${_SIGUSR1}
# Invoke dtdialog and pass in the process-ID of this script.
# When the user presses any of the dialog buttons, dtdialog
# will send us a signal which will cause the callback function
# to be called.
PARENT_PID=$$
dtdialog -descFile dtcreate.ddf -dialogName createAction -returnWinId \
-signal SIGUSR1 -ppid $PARENT_PID -outFile $DIALOG_OUTPUT &
# Keep track of the process-ID of the dtdialog process that is
# managing the main CreateAction dialog. We need this process-ID so
# that we can send it signals to do things such as reenable it.
CREATEACTION_PID=$!
# Sit in a loop as long as the main CreateAction dialog is up. The
# signals cause the 'wait' call to exit and I don't know of any way to
# determine whether the wait existed due to a signal or because the
# process died. Therefore we have to explicitly check if the process
# is alive.
EXIT=0
while [ $EXIT -eq 0 ] ; do
wait $CREATEACTION_PID
checkprocess $CREATEACTION_PID
if [ $? -eq 0 ] ; then
EXIT=1
fi
done
exit 0

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,35 @@
/* $XConsortium: fileio.h /main/5 1995/11/01 16:14:03 rswiston $ */
/***************************************************************************/
/* */
/* fileio.h */
/* */
/***************************************************************************/
#ifndef _FILEIO_H_INCLUDED
#define _FILEIO_H_INCLUDED
#ifndef STORAGECLASS
#ifdef NOEXTERN
#define STORAGECLASS
#else
#define STORAGECLASS extern
#endif
#endif
/***************************************************************************/
/* */
/* Prototypes for functions */
/* */
/***************************************************************************/
ushort WriteDefinitionFile(char *, ActionData *);
ushort WriteActionFile(ActionData *);
Boolean check_file_exists(char *);
int OpenDefinitionFile(char *, ActionData *);
ushort CopyIconFiles(ActionData *);
char * CreateIconName(char *, char *, enum icon_size_range, char *, Boolean);
Boolean ActionHasIcon (void);
Boolean FiletypeHasIcon (FiletypeData *);
#endif /* _FILEIO_H_INCLUDED */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,185 @@
/* $XConsortium: icon_selection_dialog.h /main/4 1995/11/01 16:14:48 rswiston $ */
/*******************************************************************************
icon_selection_dialog.h
This header file is included by icon_selection_dialog.c
*******************************************************************************/
#ifndef _ICON_SELECTION_DIALOG_INCLUDED
#define _ICON_SELECTION_DIALOG_INCLUDED
#include <stdio.h>
#include <Xm/Xm.h>
#include <Xm/MwmUtil.h>
#include <Xm/DialogS.h>
#include <Xm/MenuShell.h>
#include "UxXt.h"
#include <Xm/List.h>
#include <Xm/ScrolledW.h>
#include <Xm/Label.h>
#include <Xm/TextF.h>
#include <Xm/SeparatoG.h>
#include <Xm/PushB.h>
#include <Xm/Form.h>
#include <Xm/Form.h>
/*******************************************************************************
The definition of the context structure:
If you create multiple copies of your interface, the context
structure ensures that your callbacks use the variables for the
correct copy.
For each swidget in the interface, each argument to the Interface
function, and each variable in the Interface Specific section of the
Declarations Editor, there is an entry in the context structure.
and a #define. The #define makes the variable name refer to the
corresponding entry in the context structure.
*******************************************************************************/
typedef struct
{
Widget Uxicon_selection_dialog;
Widget Uxbottom_button_form;
Widget Uxbottom_button1;
Widget Uxbottom_button2;
Widget Uxbottom_button3;
Widget Uxbottom_button4;
Widget UxseparatorGadget1;
Widget Uxicon_name_text_field;
Widget Uxicon_name_textfield_label;
Widget Uxfilter_textfield_label;
Widget Uxfilter_text_field;
Widget Uxdirectory_list_label;
Widget Uxicon_container_label;
Widget Uxtop_button_form;
Widget Uxtop_button1;
Widget Uxtop_button2;
Widget Uxtop_button3;
Widget Uxdir_scrolled_list;
Widget Uxicon_scrolled_win;
Widget Uxicon_scrolled_container;
unsigned char *Uxcont_title;
swidget UxUxParent;
unsigned char *Uxdialog_title;
unsigned char *Uxfilter_field_title;
int Uxuse_filter_field;
unsigned char *Uxfile_filter;
unsigned char *Uxdirectory_title;
unsigned char **Uxdirectories_list;
unsigned char *Uxcontainer_title;
int UxnumberOfTopButtons;
unsigned char *Uxtop_button_one_label;
void (*Uxtop_button_one_cb)();
unsigned char *Uxtop_button_two_label;
void (*Uxtop_button_two_cb)();
unsigned char *Uxtop_button_three_label;
void (*Uxtop_button_three_cb)();
int Uxuse_icon_name_field;
unsigned char *Uxname_field_title;
int UxnumberOfBottomButtons;
unsigned char *Uxbottom_button_one_label;
void (*Uxbottom_button_one_cb)();
unsigned char *Uxbottom_button_two_label;
void (*Uxbottom_button_two_cb)();
unsigned char *Uxbottom_button_three_label;
void (*Uxbottom_button_three_cb)();
unsigned char *Uxbottom_button_four_label;
void (*Uxbottom_button_four_cb)();
} _UxCicon_selection_dialog;
#ifdef CONTEXT_MACRO_ACCESS
static _UxCicon_selection_dialog *UxIcon_selection_dialogContext;
#define icon_selection_dialog UxIcon_selection_dialogContext->Uxicon_selection_dialog
#define bottom_button_form UxIcon_selection_dialogContext->Uxbottom_button_form
#define bottom_button1 UxIcon_selection_dialogContext->Uxbottom_button1
#define bottom_button2 UxIcon_selection_dialogContext->Uxbottom_button2
#define bottom_button3 UxIcon_selection_dialogContext->Uxbottom_button3
#define bottom_button4 UxIcon_selection_dialogContext->Uxbottom_button4
#define separatorGadget1 UxIcon_selection_dialogContext->UxseparatorGadget1
#define icon_name_text_field UxIcon_selection_dialogContext->Uxicon_name_text_field
#define icon_name_textfield_label UxIcon_selection_dialogContext->Uxicon_name_textfield_label
#define filter_textfield_label UxIcon_selection_dialogContext->Uxfilter_textfield_label
#define filter_text_field UxIcon_selection_dialogContext->Uxfilter_text_field
#define directory_list_label UxIcon_selection_dialogContext->Uxdirectory_list_label
#define icon_container_label UxIcon_selection_dialogContext->Uxicon_container_label
#define top_button_form UxIcon_selection_dialogContext->Uxtop_button_form
#define top_button1 UxIcon_selection_dialogContext->Uxtop_button1
#define top_button2 UxIcon_selection_dialogContext->Uxtop_button2
#define top_button3 UxIcon_selection_dialogContext->Uxtop_button3
#define dir_scrolled_list UxIcon_selection_dialogContext->Uxdir_scrolled_list
#define icon_scrolled_win UxIcon_selection_dialogContext->Uxicon_scrolled_win
#define icon_scrolled_container UxIcon_selection_dialogContext->Uxicon_scrolled_container
#define cont_title UxIcon_selection_dialogContext->Uxcont_title
#define UxParent UxIcon_selection_dialogContext->UxUxParent
#define dialog_title UxIcon_selection_dialogContext->Uxdialog_title
#define filter_field_title UxIcon_selection_dialogContext->Uxfilter_field_title
#define use_filter_field UxIcon_selection_dialogContext->Uxuse_filter_field
#define file_filter UxIcon_selection_dialogContext->Uxfile_filter
#define directory_title UxIcon_selection_dialogContext->Uxdirectory_title
#define directories_list UxIcon_selection_dialogContext->Uxdirectories_list
#define container_title UxIcon_selection_dialogContext->Uxcontainer_title
#define numberOfTopButtons UxIcon_selection_dialogContext->UxnumberOfTopButtons
#define top_button_one_label UxIcon_selection_dialogContext->Uxtop_button_one_label
#define top_button_one_cb UxIcon_selection_dialogContext->Uxtop_button_one_cb
#define top_button_two_label UxIcon_selection_dialogContext->Uxtop_button_two_label
#define top_button_two_cb UxIcon_selection_dialogContext->Uxtop_button_two_cb
#define top_button_three_label UxIcon_selection_dialogContext->Uxtop_button_three_label
#define top_button_three_cb UxIcon_selection_dialogContext->Uxtop_button_three_cb
#define use_icon_name_field UxIcon_selection_dialogContext->Uxuse_icon_name_field
#define name_field_title UxIcon_selection_dialogContext->Uxname_field_title
#define numberOfBottomButtons UxIcon_selection_dialogContext->UxnumberOfBottomButtons
#define bottom_button_one_label UxIcon_selection_dialogContext->Uxbottom_button_one_label
#define bottom_button_one_cb UxIcon_selection_dialogContext->Uxbottom_button_one_cb
#define bottom_button_two_label UxIcon_selection_dialogContext->Uxbottom_button_two_label
#define bottom_button_two_cb UxIcon_selection_dialogContext->Uxbottom_button_two_cb
#define bottom_button_three_label UxIcon_selection_dialogContext->Uxbottom_button_three_label
#define bottom_button_three_cb UxIcon_selection_dialogContext->Uxbottom_button_three_cb
#define bottom_button_four_label UxIcon_selection_dialogContext->Uxbottom_button_four_label
#define bottom_button_four_cb UxIcon_selection_dialogContext->Uxbottom_button_four_cb
#endif /* CONTEXT_MACRO_ACCESS */
/*******************************************************************************
Declarations of global functions.
*******************************************************************************/
Widget create_icon_selection_dialog(swidget,
unsigned char *,
unsigned char *,
int,
unsigned char *,
unsigned char *,
unsigned char **,
unsigned char *,
int,
unsigned char *,
void (*)(),
unsigned char *,
void (*)(),
unsigned char *,
void (*)(),
int,
unsigned char *,
int,
unsigned char *,
void (*)(),
unsigned char *,
void (*)(),
unsigned char *,
void (*)(),
unsigned char *,
void (*)()
);
#endif /* _ICON_SELECTION_DIALOG_INCLUDED */
/*******************************************************************************
Platform specifics
*******************************************************************************/
#ifdef SVR4
#define dirent_struct dirent_t
#else
#define dirent_struct dirent
#endif

1371
cde/programs/dtcreate/main.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,30 @@
# $XConsortium: nlsREADME.txt /main/2 1996/11/11 11:23:55 drk $
#############################################################################
#
# Component: dtcreate
#
############################################################################
Introduction
------------
This directory contains the files for dtcreate. Dtcreate is
the HP DT component which provides the CreateAction dialog
box. Dtcreate is implemented as a ksh script which uses
dtdialog for all of its dialogs.
Because dtcreate uses dtdialog, all of the dtcreate dialog
boxes are described in Dialog Description Files (DDF). For
general information on localizing DDF's, see the "Localizing
Dtdialog DDF Files" section in the NLS Cookbook.
Each dialog that is defined in the dtcreate DDF is
accompanied by comments describing how to cause the dialog to
be posted in normal usage.
Files to be localized
---------------------
File Name Target Name
--------- -----------
dtcreate.ddf /usr/dt/dialogs/%L/dtcreate.ddf

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,44 @@
/* $XConsortium: parser.h /main/5 1996/03/25 09:20:09 rswiston $ */
/***************************************************************************/
/* */
/* parser.h */
/* */
/***************************************************************************/
/* Field id Definitions for Actiondata Datastructure */
enum {
DATA_ATTRIBUTES=1 ,
DATA_CRITERIA ,
ACTION_OPEN ,
ACTION_PRINT_FTYPE,
ACTION_PRINT
};
/* Field id Definitions for Filetypedata Datastructure */
enum {
ACTION_NAME=1,
ACTION_CMD ,
ACTION_ICO ,
ACTION_HELP
};
/* Tabletype definitions */
#define ACTION_TABLE 1
#define FILETYPE_TABLE 2
#define HELP_TEXT 3
/* Function prototype definitions */
int GetActionData(FILE *, ActionData *);
/* Error code Defines */
#define ACTION_FILEOPEN_ERROR 1
#define ACTION_FILE_MUCKED 2
#define ACTION_DATA_ERROR 3
/***************************************************************************/
/* Platform specifics */
/***************************************************************************/
#ifdef SVR4
#define bzero(pbuffer, size) memset(pbuffer, 0, size)
#endif

View File

@@ -0,0 +1,5 @@
#include <include/hpversion.h>
#ifndef lint
version_tag("dtcreate: $XConsortium: version.c /main/5 1996/08/30 15:29:02 drk $")
#endif /* lint */