Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
45
cde/examples/dtaction/Makefile.hp
Normal file
45
cde/examples/dtaction/Makefile.hp
Normal file
@@ -0,0 +1,45 @@
|
||||
# $XConsortium: Makefile.hp /main/2 1996/05/13 11:42:21 drk $
|
||||
##########################################################################
|
||||
#
|
||||
# Makefile for dtdts examples (HP)
|
||||
#
|
||||
# (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 Novell, Inc.
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
CC = cc
|
||||
RM = rm -f
|
||||
|
||||
PROGRAM = actions
|
||||
SOURCES = actions.c
|
||||
OBJECTS = actions.o
|
||||
|
||||
DEFINES =
|
||||
CDEBUGFLAGS = -O
|
||||
CFLAGS = -Aa -z $(DEFINES) $(CDEBUGFLAGS)
|
||||
|
||||
DTINCLUDE = -I/usr/dt/include
|
||||
X11INCLUDE = -I/usr/include/X11R5
|
||||
|
||||
INCLUDES = $(DTINCLUDE) $(X11INCLUDE)
|
||||
|
||||
DTLIBS = -L/usr/dt/lib -lDtSvc -ltt -lXm
|
||||
X11LIBS = -L/usr/lib/X11R5 -lXt -lX11
|
||||
SYSLIBS =
|
||||
|
||||
LIBRARIES = $(DTLIBS) $(X11LIBS) $(SYSLIBS)
|
||||
LDFLAGS =
|
||||
|
||||
.c.o:
|
||||
${CC} -c $(CFLAGS) $(INCLUDES) $<
|
||||
|
||||
all:: $(PROGRAM)
|
||||
|
||||
$(PROGRAM):: $(OBJECTS)
|
||||
${CC} -o $(PROGRAM) $(LDFLAGS) $(OBJECTS) $(LIBRARIES)
|
||||
|
||||
clean::
|
||||
${RM} $(PROGRAM) $(OBJECTS)
|
||||
45
cde/examples/dtaction/Makefile.ibm
Normal file
45
cde/examples/dtaction/Makefile.ibm
Normal file
@@ -0,0 +1,45 @@
|
||||
# $XConsortium: Makefile.ibm /main/2 1996/05/13 11:42:36 drk $
|
||||
##########################################################################
|
||||
#
|
||||
# Makefile for dtdts examples (IBM)
|
||||
#
|
||||
# (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 Novell, Inc.
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
CC = cc
|
||||
RM = rm -f
|
||||
|
||||
PROGRAM = actions
|
||||
SOURCES = actions.c
|
||||
OBJECTS = actions.o
|
||||
|
||||
DEFINES =
|
||||
CDEBUGFLAGS = -O
|
||||
CFLAGS = $(DEFINES) $(CDEBUGFLAGS)
|
||||
|
||||
DTINCLUDE = -I/usr/dt/include
|
||||
X11INCLUDE = -I/usr/include
|
||||
|
||||
INCLUDES = $(DTINCLUDE) $(X11INCLUDE)
|
||||
|
||||
DTLIBS = -L/usr/dt/lib -lDtSvc -lXm
|
||||
X11LIBS = -L/usr/lib -lXt -lX11
|
||||
SYSLIBS =
|
||||
|
||||
LIBRARIES = $(DTLIBS) $(X11LIBS) $(SYSLIBS)
|
||||
LDFLAGS =
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) $(INCLUDES) $<
|
||||
|
||||
all:: $(PROGRAM)
|
||||
|
||||
$(PROGRAM):: $(OBJECTS)
|
||||
$(CC) -o $(PROGRAM) $(LDFLAGS) $(OBJECTS) $(LIBRARIES)
|
||||
|
||||
clean::
|
||||
$(RM) $(PROGRAM) $(OBJECTS)
|
||||
45
cde/examples/dtaction/Makefile.novell
Normal file
45
cde/examples/dtaction/Makefile.novell
Normal file
@@ -0,0 +1,45 @@
|
||||
# $XConsortium: Makefile.novell /main/2 1996/05/13 11:42:53 drk $
|
||||
##########################################################################
|
||||
#
|
||||
# Makefile for dtdts examples (Novell)
|
||||
#
|
||||
# (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 Novell, Inc.
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
CC = cc
|
||||
RM = rm -f
|
||||
|
||||
PROGRAM = actions
|
||||
SOURCES = actions.c
|
||||
OBJECTS = actions.o
|
||||
|
||||
DEFINES =
|
||||
CDEBUGFLAGS = -O
|
||||
CFLAGS = -Xc $(DEFINES) $(CDEBUGFLAGS)
|
||||
|
||||
DTINCLUDE = -I/usr/dt/include
|
||||
X11INCLUDE = -I/usr/X/include
|
||||
|
||||
INCLUDES = $(DTINCLUDE) $(X11INCLUDE)
|
||||
|
||||
DTLIBS = -L/usr/dt/lib -lDtSvc -lXm
|
||||
X11LIBS = -L/usr/X/lib -lXt -lX11
|
||||
SYSLIBS = -lw -lgen -lnsl -lresolv -lsocket -lXIM
|
||||
|
||||
LIBRARIES = $(DTLIBS) $(X11LIBS) $(SYSLIBS)
|
||||
LDFLAGS =
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) $(INCLUDES) $<
|
||||
|
||||
all:: $(PROGRAM)
|
||||
|
||||
$(PROGRAM):: $(OBJECTS)
|
||||
$(CC) -o $(PROGRAM) $(LDFLAGS) $(OBJECTS) $(LIBRARIES)
|
||||
|
||||
clean::
|
||||
$(RM) $(PROGRAM) $(OBJECTS)
|
||||
45
cde/examples/dtaction/Makefile.sun
Normal file
45
cde/examples/dtaction/Makefile.sun
Normal file
@@ -0,0 +1,45 @@
|
||||
# $XConsortium: Makefile.sun /main/2 1996/05/13 11:43:10 drk $
|
||||
##########################################################################
|
||||
#
|
||||
# Makefile for dtwidget examples (SUN)
|
||||
#
|
||||
# (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 Novell, Inc.
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
CC = cc
|
||||
RM = rm -f
|
||||
|
||||
PROGRAM = actions
|
||||
SOURCES = actions.c
|
||||
OBJECTS = actions.o
|
||||
|
||||
DEFINES =
|
||||
CDEBUGFLAGS = -O
|
||||
CFLAGS = $(DEFINES) $(CDEBUGFLAGS)
|
||||
|
||||
DTINCLUDE = -I/usr/dt/include
|
||||
X11INCLUDE = -I/usr/openwin/include
|
||||
|
||||
INCLUDES = $(DTINCLUDE) $(X11INCLUDE)
|
||||
|
||||
DTLIBS = -L/usr/dt/lib -lDtSvc -lXm
|
||||
X11LIBS = -L/usr/openwin/lib -lXt -lX11
|
||||
SYSLIBS = -ldl -lw -lgen
|
||||
|
||||
LIBRARIES = $(DTLIBS) $(X11LIBS) $(SYSLIBS)
|
||||
LDFLAGS = -R/usr/dt/lib:/usr/openwin/lib
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) $(INCLUDES) $<
|
||||
|
||||
all:: $(PROGRAM)
|
||||
|
||||
$(PROGRAM):: $(OBJECTS)
|
||||
$(CC) -o $(PROGRAM) $(LDFLAGS) $(OBJECTS) $(LIBRARIES)
|
||||
|
||||
clean::
|
||||
$(RM) $(PROGRAM) $(OBJECTS)
|
||||
46
cde/examples/dtaction/Makefile.uxp
Normal file
46
cde/examples/dtaction/Makefile.uxp
Normal file
@@ -0,0 +1,46 @@
|
||||
# $XConsortium: Makefile.uxp /main/2 1996/05/13 11:43:31 drk $
|
||||
##########################################################################
|
||||
#
|
||||
# Makefile for dtdts examples (UXP)
|
||||
#
|
||||
# (Fujitsu.patch applied)
|
||||
#
|
||||
# (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 Novell, Inc.
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
CC = cc
|
||||
RM = rm -f
|
||||
|
||||
PROGRAM = actions
|
||||
SOURCES = actions.c
|
||||
OBJECTS = actions.o
|
||||
|
||||
DEFINES =
|
||||
CDEBUGFLAGS = -O
|
||||
CFLAGS = -Xc $(DEFINES) $(CDEBUGFLAGS)
|
||||
|
||||
DTINCLUDE = -I/usr/dt/include
|
||||
|
||||
INCLUDES = $(DTINCLUDE)
|
||||
|
||||
DTLIBS = -L/usr/dt/lib -lDtSvc -ltt -lXm
|
||||
X11LIBS = -lXt -lX11
|
||||
SYSLIBS = -lw -lgen -lnsl -lresolv -lsocket
|
||||
|
||||
LIBRARIES = $(DTLIBS) $(X11LIBS) $(SYSLIBS)
|
||||
LDFLAGS =
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) $(INCLUDES) $<
|
||||
|
||||
all:: $(PROGRAM)
|
||||
|
||||
$(PROGRAM):: $(OBJECTS)
|
||||
$(CC) -o $(PROGRAM) $(LDFLAGS) $(OBJECTS) $(LIBRARIES)
|
||||
|
||||
clean::
|
||||
$(RM) $(PROGRAM) $(OBJECTS)
|
||||
14
cde/examples/dtaction/README
Normal file
14
cde/examples/dtaction/README
Normal file
@@ -0,0 +1,14 @@
|
||||
/* $XConsortium: README /main/2 1996/07/15 13:58:52 drk $ */
|
||||
|
||||
This directory contains demonstrations of the Action API
|
||||
|
||||
actions - Example of using the Action API to invoke actions on a file.
|
||||
|
||||
The application displays two text entry fields. Enter an
|
||||
action name in the first field. To apply the action to a file,
|
||||
move focus to the next text field and enter a file name.
|
||||
Press <Return> to invoke the action. The front panel indicator
|
||||
will flash as the action is being processed.
|
||||
|
||||
Use the dtdts/datatyping demo to display the supported actions
|
||||
for a file or group of files.
|
||||
155
cde/examples/dtaction/actions.c
Normal file
155
cde/examples/dtaction/actions.c
Normal file
@@ -0,0 +1,155 @@
|
||||
/* $XConsortium: actions.c /main/3 1995/10/27 10:37:37 rswiston $ */
|
||||
/*
|
||||
* (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 Novell, Inc.
|
||||
*/
|
||||
|
||||
#include <Xm/XmAll.h>
|
||||
#include <Dt/Dt.h>
|
||||
#include <Dt/Action.h>
|
||||
|
||||
#define ApplicationClass "Dtaction"
|
||||
|
||||
static Widget shell;
|
||||
static XtAppContext appContext;
|
||||
static Widget actionText;
|
||||
static Widget fileText;
|
||||
|
||||
static void CreateWidgets(Widget);
|
||||
static void InvokeActionCb(Widget, XtPointer, XtPointer);
|
||||
static void InvokeAction(char*, char*);
|
||||
static void DbReloadProc(XtPointer);
|
||||
|
||||
void main(int argc, char **argv)
|
||||
{
|
||||
Arg args[20];
|
||||
int n=0;
|
||||
int numArgs = 0;
|
||||
|
||||
shell = XtAppInitialize(&appContext , ApplicationClass, NULL, 0,
|
||||
&argc, argv, NULL, args, n);
|
||||
|
||||
CreateWidgets(shell);
|
||||
|
||||
if (DtInitialize(XtDisplay(shell), shell, argv[0], ApplicationClass)==False) {
|
||||
/* DtInitialize() has already logged an appropriate error msg */
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/* Load the filetype/action databases */
|
||||
DtDbLoad();
|
||||
|
||||
/* Notice changes to the database without needing to restart application */
|
||||
DtDbReloadNotify(DbReloadProc, NULL);
|
||||
|
||||
XtRealizeWidget(shell);
|
||||
XmProcessTraversal(actionText, XmTRAVERSE_CURRENT);
|
||||
|
||||
XtAppMainLoop(appContext);
|
||||
}
|
||||
|
||||
static void CreateWidgets(Widget shell)
|
||||
{
|
||||
Widget messageBox, workArea, w;
|
||||
Arg args[20];
|
||||
int n;
|
||||
XmString labelString;
|
||||
|
||||
labelString = XmStringCreateLocalized("Invoke");
|
||||
|
||||
n = 0;
|
||||
XtSetArg(args[n], XmNdialogType, XmDIALOG_TEMPLATE); n++;
|
||||
XtSetArg(args[n], XmNokLabelString, labelString); n++;
|
||||
messageBox = XmCreateMessageBox(shell, "messageBox", args, n);
|
||||
XtManageChild(messageBox);
|
||||
XmStringFree(labelString);
|
||||
XtAddCallback(messageBox, XmNokCallback, InvokeActionCb, NULL);
|
||||
|
||||
n = 0;
|
||||
XtSetArg(args[n], XmNorientation, XmVERTICAL); n++;
|
||||
XtSetArg(args[n], XmNpacking, XmPACK_COLUMN); n++;
|
||||
XtSetArg(args[n], XmNnumColumns, 2); n++;
|
||||
XtSetArg(args[n], XmNentryAlignment, XmALIGNMENT_END); n++;
|
||||
workArea = XmCreateWorkArea(messageBox, "workArea", args, n);
|
||||
XtManageChild(workArea);
|
||||
|
||||
labelString = XmStringCreateLocalized("Invoke Action:");
|
||||
n = 0;
|
||||
XtSetArg(args[n], XmNlabelString, labelString); n++;
|
||||
w = XmCreateLabel(workArea, "actionLabel", args, n);
|
||||
XtManageChild(w);
|
||||
XmStringFree(labelString);
|
||||
|
||||
labelString = XmStringCreateLocalized("On File:");
|
||||
n = 0;
|
||||
XtSetArg(args[n], XmNlabelString, labelString); n++;
|
||||
w = XmCreateLabel(workArea, "fileLabel", args, n);
|
||||
XtManageChild(w);
|
||||
XmStringFree(labelString);
|
||||
|
||||
n = 0;
|
||||
XtSetArg(args[n], XmNcolumns, 12); n++;
|
||||
actionText = XmCreateTextField(workArea, "actionText", args, n);
|
||||
XtManageChild(actionText);
|
||||
|
||||
n = 0;
|
||||
XtSetArg(args[n], XmNcolumns, 12); n++;
|
||||
fileText = XmCreateTextField(workArea, "fileText", args, n);
|
||||
XtManageChild(fileText);
|
||||
}
|
||||
|
||||
static void DbReloadProc(XtPointer cd)
|
||||
{
|
||||
/* Pick up any dynamic changes to the database files */
|
||||
DtDbLoad();
|
||||
}
|
||||
|
||||
static void InvokeActionCb(Widget w, XtPointer cd, XtPointer cb)
|
||||
{
|
||||
char *action;
|
||||
char *file;
|
||||
|
||||
action = XmTextFieldGetString(actionText);
|
||||
|
||||
if (action == NULL) return;
|
||||
if (strlen(action) == 0) {
|
||||
XtFree(action);
|
||||
return;
|
||||
}
|
||||
|
||||
file = XmTextFieldGetString(fileText);
|
||||
|
||||
InvokeAction(action, file);
|
||||
|
||||
XtFree(action);
|
||||
XtFree(file);
|
||||
|
||||
XmTextFieldSetString(actionText, "");
|
||||
XmTextFieldSetString(fileText, "");
|
||||
|
||||
XmProcessTraversal(actionText, XmTRAVERSE_CURRENT);
|
||||
}
|
||||
|
||||
static void InvokeAction(char *action, char *file)
|
||||
{
|
||||
DtActionArg *ap = NULL;
|
||||
int nap = 0;
|
||||
DtActionInvocationID actionId;
|
||||
|
||||
/* If a file was specified, build the file argument list */
|
||||
|
||||
printf("%s(%s)\n",action,file);
|
||||
if (file != NULL && strlen(file) != 0) {
|
||||
ap = (DtActionArg*) XtCalloc(1, sizeof(DtActionArg));
|
||||
ap[0].argClass = DtACTION_FILE;
|
||||
ap[0].u.file.name = file;
|
||||
nap = 1;
|
||||
}
|
||||
|
||||
/* Invoke the specified action */
|
||||
|
||||
actionId = DtActionInvoke(shell,action,ap,nap,NULL,NULL,NULL,True,NULL,NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user