X Desktop Manager(6)

Edward J. Groenendaal eddyg at syma.sussex.ac.uk
Thu Apr 18 06:51:05 AEST 1991


---- Cut Here and unpack ----
#!/bin/sh
# this is part 6 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file code/Xedw/DefIcon.icon continued
#
CurArch=6
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file code/Xedw/DefIcon.icon"
sed 's/^X//' << 'SHAR_EOF' >> code/Xedw/DefIcon.icon
X
X#define default_width 32
X#define default_height 32
Xstatic char default_bits[] = {
X   0xf0, 0xff, 0x7f, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x10, 0x00, 0x40, 0x01,
X   0x10, 0x00, 0x40, 0x02, 0x10, 0x00, 0x40, 0x04, 0x10, 0x00, 0xc0, 0x0f,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0xf0, 0xff, 0xff, 0x0f};
SHAR_EOF
echo "File code/Xedw/DefIcon.icon is complete"
chmod 0644 code/Xedw/DefIcon.icon || echo "restore of code/Xedw/DefIcon.icon fails"
echo "x - extracting code/Xedw/Imakefile (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/Xedw/Imakefile &&
XCC=gcc
XCFLAGS=-g
XSRCS=XedwForm.c XedwList.c
XOBJS=XedwForm.o XedwList.o
X
XNormalLibraryTarget(Xedw, $(OBJS))
SHAR_EOF
chmod 0644 code/Xedw/Imakefile || echo "restore of code/Xedw/Imakefile fails"
echo "x - extracting code/Xedw/Makefile (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/Xedw/Makefile &&
X# Makefile generated by imake - do not edit!
X# $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $
X#
X# The cpp used on this machine replaces all newlines and multiple tabs and
X# spaces in a macro expansion with a single space.  Imake tries to compensate
X# for this, but is not always successful.
X#
X
X###########################################################################
X# Makefile generated from "Imake.tmpl" and <Imakefile>
X# $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $
X#
X# Platform-specific parameters may be set in the appropriate .cf
X# configuration files.  Site-wide parameters may be set in the file
X# site.def.  Full rebuilds are recommended if any parameters are changed.
X#
X# If your C preprocessor doesn't define any unique symbols, you'll need
X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
X# "make Makefile", "make Makefiles", or "make World").
X#
X# If you absolutely can't get imake to work, you'll need to set the
X# variables at the top of each Makefile as well as the dependencies at the
X# bottom (makedepend will do this automatically).
X#
X
X###########################################################################
X# platform-specific configuration parameters - edit macII.cf to change
X
X# platform:  $XConsortium: macII.cf,v 1.16 89/12/22 15:50:50 rws Exp $
X# operating system:  A/UX 2.0
X
X###########################################################################
X# site-specific configuration parameters - edit site.def to change
X
X# site:  $XConsortium: site.def,v 1.21 89/12/06 11:46:50 jim Exp $
X
X            SHELL = /bin/sh
X
X              TOP = .
X      CURRENT_DIR = .
X
X               AR = ar cq
X  BOOTSTRAPCFLAGS = -DmacII
X               CC = gcc -DNOSTDHDRS
X
X         COMPRESS = compress
X              CPP = /lib/cpp $(STD_CPP_DEFINES)
X    PREPROCESSCMD = gcc -DNOSTDHDRS -E $(STD_CPP_DEFINES)
X          INSTALL = install
X               LD = ld
X             LINT = lint
X      LINTLIBFLAG = -o
X         LINTOPTS = -ax
X               LN = ln -s
X             MAKE = make
X               MV = mv
X               CP = cp
X           RANLIB = /bin/true
X  RANLIBINSTFLAGS =
X               RM = rm -f
X     STD_INCLUDES = -I/usr/local/Gnu/lib/gcc-include
X  STD_CPP_DEFINES = -DmacII -DSYSV
X      STD_DEFINES = -DmacII -DSYSV -D_SYSV_SOURCE -D_BSD_SOURCE
X            STRIP = strip
X EXTRA_LOAD_FLAGS =
X  EXTRA_LIBRARIES =
X             TAGS = ctags
X
X           MFLAGS = -$(MAKEFLAGS)
X
X   SIGNAL_DEFINES = -DSIGNALRETURNSINT
X
X    PROTO_DEFINES =
X
X     INSTPGMFLAGS = -u bin -g sysprog -m 0775
X
X     INSTBINFLAGS = -u bin -g sysprog -m 0775
X     INSTUIDFLAGS = -u bin -g sysprog -m 4775
X     INSTLIBFLAGS = -u bin -g sysprog -m 0664
X     INSTINCFLAGS = -u bin -g sysprog -m 0444
X     INSTMANFLAGS = -u bin -g sysprog -m 0444
X     INSTDATFLAGS = -u bin -g sysprog -m 0444
X    INSTKMEMFLAGS = -u bin -g sysprog -m 4775
X
X          DESTDIR = /usr
X
X     TOP_INCLUDES = -I$(INCROOT)
X
X      CDEBUGFLAGS = -O
X        CCOPTIONS =
X      COMPATFLAGS =
X
X      ALLINCLUDES = $(STD_INCLUDES) $(TOP_INCLUDES) $(INCLUDES) $(EXTRA_INCLUDES)
X       ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(DEFINES) $(COMPATFLAGS)
X           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
X        LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
X           LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
X        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS)
X   LDCOMBINEFLAGS = -X -r
X
X        MACROFILE = macII.cf
X           RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut *-
X
X    IMAKE_DEFINES =
X
X         IRULESRC = $(CONFIGDIR)
X        IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
X
X     ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
X			$(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
X			$(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
X
X###########################################################################
X# X Window System Build Parameters
X# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $
X
X###########################################################################
X# X Window System make variables; this need to be coordinated with rules
X# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $
X
X          PATHSEP = /
X        USRLIBDIR = $(DESTDIR)/lib
X           BINDIR = /usr/local/bin/X11
X          INCROOT = $(DESTDIR)/include
X     BUILDINCROOT = $(TOP)
X      BUILDINCDIR = $(BUILDINCROOT)/X11
X      BUILDINCTOP = ..
X           INCDIR = $(INCROOT)/X11
X           ADMDIR = $(DESTDIR)/adm
X           LIBDIR = $(USRLIBDIR)/X11
X        CONFIGDIR = $(LIBDIR)/config
X       LINTLIBDIR = $(USRLIBDIR)/lint
X
X          FONTDIR = $(LIBDIR)/fonts
X         XINITDIR = $(LIBDIR)/xinit
X           XDMDIR = $(LIBDIR)/xdm
X           AWMDIR = $(LIBDIR)/awm
X           TWMDIR = $(LIBDIR)/twm
X           GWMDIR = $(LIBDIR)/gwm
X          MANPATH = /usr/local/catman/x_man
X    MANSOURCEPATH = $(MANPATH)/man
X           MANDIR = $(MANSOURCEPATH)1
X        LIBMANDIR = $(MANSOURCEPATH)3
X      XAPPLOADDIR = $(LIBDIR)/app-defaults
X
X       FONTCFLAGS = -t
X
X     INSTAPPFLAGS = $(INSTDATFLAGS)
X
X            IMAKE = imake
X           DEPEND = makedepend
X              RGB = rgb
X            FONTC = bdftosnf
X        MKFONTDIR = mkfontdir
X        MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier.sh
X
X        CONFIGSRC = $(TOP)/config
X        CLIENTSRC = $(TOP)/clients
X          DEMOSRC = $(TOP)/demos
X           LIBSRC = $(TOP)/lib
X          FONTSRC = $(TOP)/fonts
X       INCLUDESRC = $(TOP)/X11
X        SERVERSRC = $(TOP)/server
X          UTILSRC = $(TOP)/util
X        SCRIPTSRC = $(UTILSRC)/scripts
X       EXAMPLESRC = $(TOP)/examples
X       CONTRIBSRC = $(TOP)/../contrib
X           DOCSRC = $(TOP)/doc
X           RGBSRC = $(TOP)/rgb
X        DEPENDSRC = $(UTILSRC)/makedepend
X         IMAKESRC = $(CONFIGSRC)
X         XAUTHSRC = $(LIBSRC)/Xau
X          XLIBSRC = $(LIBSRC)/X
X           XMUSRC = $(LIBSRC)/Xmu
X       TOOLKITSRC = $(LIBSRC)/Xt
X       AWIDGETSRC = $(LIBSRC)/Xaw
X       OLDXLIBSRC = $(LIBSRC)/oldX
X      XDMCPLIBSRC = $(LIBSRC)/Xdmcp
X      BDFTOSNFSRC = $(FONTSRC)/bdftosnf
X     MKFONTDIRSRC = $(FONTSRC)/mkfontdir
X     EXTENSIONSRC = $(TOP)/extensions
X
X  DEPEXTENSIONLIB = $(USRLIBDIR)/libXext.a
X     EXTENSIONLIB =  -lXext
X
X          DEPXLIB = $(DEPEXTENSIONLIB) $(USRLIBDIR)/libX11.a
X             XLIB = $(EXTENSIONLIB)  -lX11
X
X      DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
X         XAUTHLIB =  -lXau
X
X        DEPXMULIB = $(USRLIBDIR)/libXmu.a
X           XMULIB =  -lXmu
X
X       DEPOLDXLIB = $(USRLIBDIR)/liboldX.a
X          OLDXLIB =  -loldX
X
X      DEPXTOOLLIB = $(USRLIBDIR)/libXt.a
X         XTOOLLIB =  -lXt
X
X        DEPXAWLIB = $(USRLIBDIR)/libXaw.a
X           XAWLIB =  -lXaw
X
X LINTEXTENSIONLIB = $(USRLIBDIR)/llib-lXext.ln
X         LINTXLIB = $(USRLIBDIR)/llib-lX11.ln
X          LINTXMU = $(USRLIBDIR)/llib-lXmu.ln
X        LINTXTOOL = $(USRLIBDIR)/llib-lXt.ln
X          LINTXAW = $(USRLIBDIR)/llib-lXaw.ln
X
X        XWLIBSRC = $(CONTRIBSRC)/toolkits/Xw
X        DEPXWLIB = $(USRLIBDIR)/libXw.a
X        XWLIB =  -lXw
X
X          DEPLIBS = $(LOCAL_LIBRARIES)
X
X         DEPLIBS1 = $(DEPLIBS)
X         DEPLIBS2 = $(DEPLIBS)
X         DEPLIBS3 = $(DEPLIBS)
X
X###########################################################################
X# Imake rules for building libraries, programs, scripts, and data files
X# rules:  $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $
X
X###########################################################################
X# start of Imakefile
X
XCFLAGS=-s -O
XSRCS=XedwForm.c XedwList.c
XOBJS=XedwForm.o XedwList.o
X
Xall:: libXedw.a
X
XlibXedw.a:  $(OBJS)
X	$(RM) $@
X	$(AR) $@  $(OBJS)
X	$(RANLIB) $@
X
X###########################################################################
X# common rules for all Makefiles - do not edit
X
Xemptyrule::
X
Xclean::
X	$(RM_CMD) \#*
X
XMakefile::
X	- at if [ -f Makefile ]; then \
X	echo "	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
X	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
X	else exit 0; fi
X	$(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
X
Xtags::
X	$(TAGS) -w *.[ch]
X	$(TAGS) -xw *.[ch] > TAGS
X
X###########################################################################
X# empty rules for directories that do not have SUBDIRS - do not edit
X
Xinstall::
X	@echo "install in $(CURRENT_DIR) done"
X
Xinstall.man::
X	@echo "install.man in $(CURRENT_DIR) done"
X
XMakefiles::
X
Xincludes::
X
X###########################################################################
X# dependencies generated by makedepend
X
SHAR_EOF
chmod 0644 code/Xedw/Makefile || echo "restore of code/Xedw/Makefile fails"
echo "x - extracting code/Xedw/XedwForm.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/Xedw/XedwForm.c &&
X#include <X11/copyright.h>
X
X/*****************************************************************************
X * XedwForm is a modified version of the Athena Widget Form.
X * Added capabilities :
X *  1) Children may chose not to be resized in any particular plane.
X *  2) Children may chose to extend their widths to the edge of the application.
X *  3) Children may have linked widths and heights.
X * The default is that these capabilities are turned off.
X * See XedwForm.h for resource list.
X *
X * Edward Groenendaal, 20th Feb 1991.
X *
X * Changes to the original source :
X *      1) Changed all references of Form to XedwForm and form to xedwForm.
X *      2) Added resources
X *      3) Rewrote Resize(), Layout() and LayoutChild().
X *****************************************************************************/
X
X#include <X11/IntrinsicP.h>
X#include <X11/StringDefs.h>
X#include <X11/Xmu/Converters.h>
X#include <X11/Xmu/CharSet.h>
X#include <X11/Xaw/XawInit.h>
X#include "XedwFormP.h"
X
X/* Private Definitions */
X
Xstatic int default_value = -99999;
X
X#define Offset(field) XtOffset(XedwFormWidget, xedwForm.field)
Xstatic XtResource resources[] = {
X    {XtNdefaultDistance, XtCThickness, XtRInt, sizeof(int),
X        Offset(default_spacing), XtRImmediate, (caddr_t)4}
X};
X#undef Offset
X
Xstatic XtEdgeType defEdge = XtRubber;
X
X#define Offset(field) XtOffset(XedwFormConstraints, xedwForm.field)
Xstatic XtResource xedwFormConstraintResources[] = {
X  {XtNtop, XtCEdge, XtREdgeType, sizeof(XtEdgeType),
X     Offset(top), XtREdgeType, (XtPointer)&defEdge},
X  {XtNbottom, XtCEdge, XtREdgeType, sizeof(XtEdgeType),
X     Offset(bottom), XtREdgeType, (XtPointer)&defEdge},
X  {XtNleft, XtCEdge, XtREdgeType, sizeof(XtEdgeType),
X     Offset(left), XtREdgeType, (XtPointer)&defEdge},
X  {XtNright, XtCEdge, XtREdgeType, sizeof(XtEdgeType),
X     Offset(right), XtREdgeType, (XtPointer)&defEdge},
X  {XtNhorizDistance, XtCThickness, XtRInt, sizeof(int),
X     Offset(dx), XtRInt, (XtPointer) &default_value},
X  {XtNfromHoriz, XtCWidget, XtRWidget, sizeof(Widget),
X     Offset(horiz_base), XtRWidget, (XtPointer)NULL},
X  {XtNvertDistance, XtCThickness, XtRInt, sizeof(int),
X     Offset(dy), XtRInt, (XtPointer) &default_value},
X  {XtNfromVert, XtCWidget, XtRWidget, sizeof(Widget),
X     Offset(vert_base), XtRWidget, (XtPointer)NULL},
X  {XtNrubberWidth, XtCBoolean, XtRBoolean, sizeof(Boolean),    /* new */
X     Offset(rubber_width), XtRImmediate, (XtPointer) True},
X  {XtNrubberHeight, XtCBoolean, XtRBoolean, sizeof(Boolean),   /* new */
X     Offset(rubber_height), XtRImmediate, (XtPointer) True},
X  {XtNfullWidth, XtCBoolean, XtRBoolean, sizeof(Boolean),      /* new */
X     Offset(full_width), XtRImmediate, (XtPointer) False},
X  {XtNfullHeight, XtCBoolean, XtRBoolean, sizeof(Boolean),     /* new */
X     Offset(full_height), XtRImmediate, (XtPointer) False},
X  {XtNwidthLinked, XtCWidget, XtRWidget, sizeof(Widget),
X     Offset(width_link), XtRWidget, (XtPointer)NULL},         /* new */
X  {XtNheightLinked, XtCWidget, XtRWidget, sizeof(Widget),
X     Offset(height_link), XtRWidget, (XtPointer)NULL},        /* new */
X  {XtNresizable, XtCBoolean, XtRBoolean, sizeof(Boolean),
X     Offset(allow_resize), XtRImmediate, (XtPointer) FALSE},
X};
X#undef Offset
X
Xstatic void ClassInitialize(), ClassPartInitialize(), Initialize(), Resize();
Xstatic void ConstraintInitialize();
Xstatic Boolean SetValues(), ConstraintSetValues();
Xstatic XtGeometryResult GeometryManager(), PreferredGeometry();
Xstatic void ChangeManaged();
Xstatic Boolean Layout(XedwFormWidget, Dimension, Dimension);
X
XXedwFormClassRec xedwFormClassRec = {
X  { /* core_class fields */
X    /* superclass         */    (WidgetClass) &constraintClassRec,
X    /* class_name         */    "XedwForm",
X    /* widget_size        */    sizeof(XedwFormRec),
X    /* class_initialize   */    ClassInitialize,
X    /* class_part_init    */    ClassPartInitialize,
X    /* class_inited       */    FALSE,
X    /* initialize         */    Initialize,
X    /* initialize_hook    */    NULL,
X    /* realize            */    XtInheritRealize,
X    /* actions            */    NULL,
X    /* num_actions        */    0,
X    /* resources          */    resources,
X    /* num_resources      */    XtNumber(resources),
X    /* xrm_class          */    NULLQUARK,
X    /* compress_motion    */    TRUE,
X    /* compress_exposure  */    TRUE,
X    /* compress_enterleave*/    TRUE,
X    /* visible_interest   */    FALSE,
X    /* destroy            */    NULL,
X    /* resize             */    Resize,                      /* new */
X    /* expose             */    XtInheritExpose,
X    /* set_values         */    SetValues,
X    /* set_values_hook    */    NULL,
X    /* set_values_almost  */    XtInheritSetValuesAlmost,
X    /* get_values_hook    */    NULL,
X    /* accept_focus       */    NULL,
X    /* version            */    XtVersion,
X    /* callback_private   */    NULL,
X    /* tm_table           */    NULL,
X    /* query_geometry     */    PreferredGeometry,
X    /* display_accelerator*/    XtInheritDisplayAccelerator,
X    /* extension          */    NULL
X  },
X  { /* composite_class fields */
X    /* geometry_manager   */   GeometryManager,
X    /* change_managed     */   ChangeManaged,
X    /* insert_child       */   XtInheritInsertChild,
X    /* delete_child       */   XtInheritDeleteChild,
X    /* extension          */   NULL
X  },
X  { /* constraint_class fields */
X    /* subresourses       */   xedwFormConstraintResources,
X    /* subresource_count  */   XtNumber(xedwFormConstraintResources),
X    /* constraint_size    */   sizeof(XedwFormConstraintsRec),
X    /* initialize         */   ConstraintInitialize,
X    /* destroy            */   NULL,
X    /* set_values         */   ConstraintSetValues,
X    /* extension          */   NULL
X  },
X  { /* xedwForm_class fields */
X    /* layout             */   Layout                        
X  }
X};
X
XWidgetClass xedwFormWidgetClass = (WidgetClass)&xedwFormClassRec;
X
X/****************************************************************
X *
X * Private Procedures
X *
X ****************************************************************/
X
X
Xstatic XrmQuark XtQChainLeft, XtQChainRight, XtQChainTop,
X  XtQChainBottom, XtQRubber;
X
X#define done(address, type) \
X{ toVal->size = sizeof(type); \
X  toVal->addr = (caddr_t) address; \
X  return; \
X}
X
Xstatic void _CvtStringToEdgeType(XrmValuePtr args, 
X				 Cardinal *num_args, 
X				 XrmValuePtr fromVal, 
X				 XrmValuePtr toVal)
X{
X  static XtEdgeType edgeType;
X  XrmQuark q;
X  char lowerName[1000];
X
X  XmuCopyISOLatin1Lowered (lowerName, (char*)fromVal->addr);
X  q = XrmStringToQuark(lowerName);
X  if (q == XtQChainLeft) {
X    edgeType = XtChainLeft;
X    done(&edgeType, XtEdgeType);
X  }
X  if (q == XtQChainRight) {
X    edgeType = XtChainRight;
X    done(&edgeType, XtEdgeType);
X  }
X  if (q == XtQChainTop) {
X    edgeType = XtChainTop;
X    done(&edgeType, XtEdgeType);
X  }
X  if (q == XtQChainBottom) {
X    edgeType = XtChainBottom;
X    done(&edgeType, XtEdgeType);
X  }
X  if (q == XtQRubber) {
X    edgeType = XtRubber;
X    done(&edgeType, XtEdgeType);
X  }
X  XtStringConversionWarning(fromVal->addr, "edgeType");
X  toVal->addr = NULL;
X  toVal->size = 0;
X}
X
Xstatic void ClassInitialize(void)
X{
X  static XtConvertArgRec parentCvtArgs[] = {
X    {XtBaseOffset, (caddr_t)XtOffset(Widget, core.parent), sizeof(Widget)}
X  };
X  XawInitializeWidgetSet();
X  XtQChainLeft   = XrmStringToQuark("chainleft");
X  XtQChainRight  = XrmStringToQuark("chainright");
X  XtQChainTop    = XrmStringToQuark("chaintop");
X  XtQChainBottom = XrmStringToQuark("chainbottom");
X  XtQRubber      = XrmStringToQuark("rubber");
X  
X  XtAddConverter( XtRString, XtREdgeType, _CvtStringToEdgeType, NULL, 0 );
X  XtAddConverter( XtRString, XtRWidget, XmuCvtStringToWidget,
X		 parentCvtArgs, XtNumber(parentCvtArgs) );
X}
X
Xstatic void ClassPartInitialize(WidgetClass class)
X{
X  register XedwFormWidgetClass c = (XedwFormWidgetClass)class;
X
X  if (((Boolean (*)())c->xedwForm_class.layout) ==  XtInheritLayout)
X    c->xedwForm_class.layout = Layout;
X}
X
X
Xstatic void Initialize(Widget request, Widget new)
X{
X  XedwFormWidget fw = (XedwFormWidget)new;
X
X  fw->xedwForm.old_width = fw->core.width;
X  fw->xedwForm.old_height = fw->core.height;
X  fw->xedwForm.no_refigure = False;
X  fw->xedwForm.needs_relayout = False;
X  fw->xedwForm.resize_in_layout = True;
X}
X
X
Xstatic void RefigureLocations(XedwFormWidget w)
X{
X  if (w->xedwForm.no_refigure) {
X    w->xedwForm.needs_relayout = True;
X  } else {
X    (*((XedwFormWidgetClass)w->core.widget_class)->xedwForm_class.layout)
X      ( w, w->core.width, w->core.height );
X    w->xedwForm.needs_relayout = False;
X  }
X}
X
Xstatic Boolean Layout(XedwFormWidget fw, Dimension width, Dimension height)
X{
X  int num_children = fw->composite.num_children;
X  WidgetList children = fw->composite.children;
X  Widget *childP;
X  Position maxx, maxy;
X  static void LayoutChild();
X  Boolean ret_val;
X  
X  for (childP = children; childP - children < num_children; childP++) {
X    XedwFormConstraints xedwForm =
X      (XedwFormConstraints)(*childP)->core.constraints;
X    xedwForm->xedwForm.layout_state = LayoutPending;
X  }
X
X  maxx = maxy = 1;
X  for (childP = children; childP - children < num_children; childP++) {
X    if (XtIsManaged(*childP)) {
X      Position x, y;
X      LayoutChild(*childP);
X      x = (*childP)->core.x + (*childP)->core.width
X	+ ((*childP)->core.border_width << 1);
X      y = (*childP)->core.y + (*childP)->core.height
X	+ ((*childP)->core.border_width << 1);
X      if (maxx < x) maxx = x;  /* Track width  */
X      if (maxy < y) maxy = y;  /* Track Height */
X    }
X  }
X
X  /* I want to be this big */
X  fw->xedwForm.preferred_width = (maxx += fw->xedwForm.default_spacing);
X  fw->xedwForm.preferred_height = (maxy += fw->xedwForm.default_spacing);
X
X  /* Go back and check to see if any widgets want to be full height or
X   * full width, if so, do it, dont recalculate sizes, assume the programmer
X   * didn't make any silly mistakes like putting another widget to the right
X   * of a full width one. EG.
X   * Should really do this in one pass. 
X   */
X
X  for (childP = children; childP - children < num_children; childP++) {
X    XedwFormConstraints form = (XedwFormConstraints)(*childP)->core.constraints;
X    Position newwidth  = (Position)(*childP)->core.width;
X    Position newheight = (Position)(*childP)->core.height;
X    if (form->xedwForm.full_width == True)
X      form->xedwForm.virtual_width = newwidth = 
X	(maxx - ((form->xedwForm.dx) + 
X		 ((*childP)->core.border_width * 2) + 
X		 ((*childP)->core.x)));
X    if (form->xedwForm.full_height == True)
X      form->xedwForm.virtual_height = newheight = 
X	(maxy - ((form->xedwForm.dy) + 
X		 ((*childP)->core.border_width * 2) +
X		 ((*childP)->core.y)));
X    /* Resize the widget if it has been changed. XtResizeWidget does the checking */
X    XtResizeWidget(*childP, newwidth, newheight, (*childP)->core.border_width);
X  }
X  
X  if (fw->xedwForm.resize_in_layout
X      && (maxx != fw->core.width || maxy != fw->core.height)) {
X    XtGeometryResult result;
X    result = XtMakeResizeRequest(fw, (Dimension)maxx, (Dimension)maxy,
X				 (Dimension*)&maxx, (Dimension*)&maxy );
X    if (result == XtGeometryAlmost)
X      result = XtMakeResizeRequest(fw, (Dimension)maxx, (Dimension)maxy,
X				   NULL, NULL );
X    fw->xedwForm.old_width  = fw->core.width;
X    fw->xedwForm.old_height = fw->core.height;
X    ret_val = (result == XtGeometryYes);
X  } else ret_val = False;
X  
X  return ret_val;
X}
X
X
Xstatic void LayoutChild(Widget w)
X{
X  XedwFormConstraints xedwForm = (XedwFormConstraints)w->core.constraints;
X  Position x, y;
X  Dimension width, height;
X  Widget ref;
X
X  switch (xedwForm->xedwForm.layout_state) {
X    
X  case LayoutPending:
X    xedwForm->xedwForm.layout_state = LayoutInProgress;
X    break;
X
X  case LayoutDone:
X    return;
X
X  case LayoutInProgress:
X    {
X      String subs[2];
X      Cardinal num_subs = 2;
X      subs[0] = w->core.name;
X      subs[1] = w->core.parent->core.name;
X      XtAppWarningMsg(XtWidgetToApplicationContext(w),
X		      "constraintLoop","XedwFormLayout","XawToolkitError",
X		      "constraint loop detected while laying out child '%s'"
X		      " in XedwFormWidget '%s'",
X		      subs, &num_subs);
X      return;
X    }
X  }
X  x = xedwForm->xedwForm.dx;
X  y = xedwForm->xedwForm.dy;
X  if ((ref = xedwForm->xedwForm.width_link) != (Widget)NULL) {
X    LayoutChild(ref);
X    width = xedwForm->xedwForm.virtual_width = ref->core.width;
X    XtResizeWidget(w, width, w->core.height, w->core.border_width);
X  }
X  if ((ref = xedwForm->xedwForm.height_link) != (Widget)NULL) {
X    LayoutChild(ref);
X    height = xedwForm->xedwForm.virtual_height = ref->core.height;
X    XtResizeWidget(w, w->core.width, height, w->core.border_width);
X  }
X  if ((ref = xedwForm->xedwForm.horiz_base) != (Widget)NULL) {
X    LayoutChild(ref);
X    x += ref->core.x + ref->core.width + (ref->core.border_width << 1);
X  }
X  if ((ref = xedwForm->xedwForm.vert_base) != (Widget)NULL) {
X    LayoutChild(ref);
X    y += ref->core.y + ref->core.height + (ref->core.border_width << 1);
X  }
X  XtMoveWidget( w, x, y );
X  xedwForm->xedwForm.layout_state = LayoutDone;
X}
X
X
Xstatic Position TransformCoord(Position loc, 
X			       Dimension old, Dimension new, 
X			       XtEdgeType type)
X{
X  if (type == XtRubber) {
X    if ( ((int) old) > 0)
X      loc = (loc * new) / old;
X  }
X  else if (type == XtChainBottom || type == XtChainRight)
X    loc += (Position)new - (Position)old;
X
X  /* I don't see any problem with returning values less than zero. */
X
X  return (loc);
X}
X
X
Xstatic void Resize(Widget w)
X{
X  XedwFormWidget fw = (XedwFormWidget)w;
X  WidgetList children = fw->composite.children;
X  int num_children = fw->composite.num_children;
X  Widget *childP;
X  Position x, y;
X  Dimension width, height;
X
X  for (childP = children; childP - children < num_children; childP++) {
X    XedwFormConstraints xedwForm = (XedwFormConstraints)(*childP)->core.constraints;
X    if (!XtIsManaged(*childP)) continue;
X    x = TransformCoord( (*childP)->core.x, fw->xedwForm.old_width,
X		       fw->core.width, xedwForm->xedwForm.left );
X    y = TransformCoord( (*childP)->core.y, fw->xedwForm.old_height,
X		       fw->core.height, xedwForm->xedwForm.top );
X    
X    if (xedwForm->xedwForm.rubber_width)
X      xedwForm->xedwForm.virtual_width =
X	TransformCoord((Position)((*childP)->core.x
X				  + xedwForm->xedwForm.virtual_width
X				  + 2 * (*childP)->core.border_width),
X		       fw->xedwForm.old_width, fw->core.width,
X		       xedwForm->xedwForm.right )
X	  - (x + 2 * (*childP)->core.border_width);
X
X    if (xedwForm->xedwForm.rubber_height)
X      xedwForm->xedwForm.virtual_height =
X	TransformCoord((Position)((*childP)->core.y
X				  + xedwForm->xedwForm.virtual_height
X				  + 2 * (*childP)->core.border_width),
X		       fw->xedwForm.old_height, fw->core.height,
X		       xedwForm->xedwForm.bottom )
X	  - ( y + 2 * (*childP)->core.border_width);
X    
X    width = (Dimension)
X      (xedwForm->xedwForm.virtual_width < 1) ? 1 : xedwForm->xedwForm.virtual_width;
X    height = (Dimension)
X      (xedwForm->xedwForm.virtual_height < 1) ? 1 : xedwForm->xedwForm.virtual_height;
X    
X    XtConfigureWidget( *childP, x, y, (Dimension)width, (Dimension)height,
X		      (*childP)->core.border_width );
X  }
X
X  fw->xedwForm.old_width = fw->core.width;
X  fw->xedwForm.old_height = fw->core.height;
X}
X
X
Xstatic XtGeometryResult GeometryManager(Widget w, 
X					XtWidgetGeometry *request, 
X					XtWidgetGeometry *reply)
X{
X  XedwFormConstraints xedwForm = (XedwFormConstraints)w->core.constraints;
X  XtWidgetGeometry allowed;
X
X  if ((request->request_mode & ~(XtCWQueryOnly | CWWidth | CWHeight)) ||
X      !xedwForm->xedwForm.allow_resize)
X    return XtGeometryNo;
X
X  if (request->request_mode & CWWidth)
X    allowed.width = request->width;
X  else
X    allowed.width = w->core.width;
X  
X  if (request->request_mode & CWHeight)
X    allowed.height = request->height;
X  else
X    allowed.height = w->core.height;
X
X  if (allowed.width == w->core.width && allowed.height == w->core.height)
X    return XtGeometryNo;
X
X  if (!(request->request_mode & XtCWQueryOnly)) {
X    /* reset virtual width and height. */
X    xedwForm->xedwForm.virtual_width = w->core.width = allowed.width;
X    xedwForm->xedwForm.virtual_height = w->core.height = allowed.height;
X    RefigureLocations( (XedwFormWidget)w->core.parent );
X  }
X  return XtGeometryYes;
X}
X
X
X
Xstatic Boolean SetValues(Widget current, Widget request, Widget new)
X{
X  return( FALSE );
X}
X
X
Xstatic void ConstraintInitialize(Widget request, Widget new)
X{
X  XedwFormConstraints xedwForm = (XedwFormConstraints)new->core.constraints;
X  XedwFormWidget fw = (XedwFormWidget)new->core.parent;
X
X  xedwForm->xedwForm.virtual_width = (int) new->core.width;
X  xedwForm->xedwForm.virtual_height = (int) new->core.height;
X
X  if (xedwForm->xedwForm.dx == default_value)
X    xedwForm->xedwForm.dx = fw->xedwForm.default_spacing;
X
X  if (xedwForm->xedwForm.dy == default_value)
X    xedwForm->xedwForm.dy = fw->xedwForm.default_spacing;
X}
X
Xstatic Boolean ConstraintSetValues(Widget current, Widget request, Widget new)
X{
X  return( FALSE );
X}
X
Xstatic void ChangeManaged(Widget w)
X{
X  XedwFormWidget fw = (XedwFormWidget)w;
X  XedwFormConstraints xedwForm;
X  WidgetList children, childP;
X  int num_children = fw->composite.num_children;
X  Widget child;
X
X  /*
X   * Reset virtual width and height for all children.
X   */
X
X  for (children = childP = fw->composite.children ;
X       childP - children < num_children; childP++) {
X    child = *childP;
X    if (XtIsManaged(child)) {
X      xedwForm = (XedwFormConstraints)child->core.constraints;
X      if ( child->core.width != 1)
X        xedwForm->xedwForm.virtual_width = (int) child->core.width;
X      if ( child->core.height != 1)
X        xedwForm->xedwForm.virtual_height = (int) child->core.height;
X    }
X  }
X  RefigureLocations( (XedwFormWidget)w );
X}
X
X
Xstatic XtGeometryResult PreferredGeometry(Widget widget, 
X					  XtWidgetGeometry *request, 
X					  XtWidgetGeometry *reply)
X{
X  XedwFormWidget w = (XedwFormWidget)widget;
X
X  reply->width = w->xedwForm.preferred_width;
X  reply->height = w->xedwForm.preferred_height;
X  reply->request_mode = CWWidth | CWHeight;
X  if (  request->request_mode & (CWWidth | CWHeight) ==
X      reply->request_mode & CWWidth | CWHeight
X      && request->width == reply->width
X      && request->height == reply->height)
X    return XtGeometryYes;
X  else if (reply->width == w->core.width && reply->height == w->core.height)
X    return XtGeometryNo;
X  else
X    return XtGeometryAlmost;
X}
X
X
X/**********************************************************************
X *
X * Public routines
X *
X **********************************************************************/
X
X/*
X * Set or reset figuring (ignored if not realized)
X */
X
Xvoid XedwFormDoLayout(Widget w, Boolean doit)
X{
X  register XedwFormWidget fw = (XedwFormWidget)w;
X
X  fw->xedwForm.no_refigure = !doit;
X
X  if ( XtIsRealized(w) && fw->xedwForm.needs_relayout )
X    RefigureLocations( fw );
X}
SHAR_EOF
chmod 0644 code/Xedw/XedwForm.c || echo "restore of code/Xedw/XedwForm.c fails"
echo "x - extracting code/Xedw/XedwForm.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/Xedw/XedwForm.h &&
X/*****************************************************************************
XCopyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
Xand the Massachusetts Institute of Technology, Cambridge, Massachusetts.
X
X                        All Rights Reserved
X
XPermission to use, copy, modify, and distribute this software and its
Xdocumentation for any purpose and without fee is hereby granted,
Xprovided that the above copyright notice appear in all copies and that
Xboth that copyright notice and this permission notice appear in
Xsupporting documentation, and that the names of Digital or MIT not be
Xused in advertising or publicity pertaining to distribution of the
Xsoftware without specific, written prior permission.
X
XDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
XDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
XSOFTWARE.
X
X*****************************************************************************/
X
X#ifndef _XedwForm_h
X#define _XedwForm_h
X
X#include <X11/Constraint.h>
X#include <X11/Xaw/Form.h>
X
X/***********************************************************************
X *
X * XedwForm Widget
X *
X ***********************************************************************/
X
X/* Parameters:
X
X Name               Class               RepType     Default Value
X ----               -----               -------     -------------
X background         Background          Pixel       XtDefaultBackground
X border             BorderColor         Pixel       XtDefaultForeground
X borderWidth        BorderWidth         Dimension   1
X defaultDistance    Thickness           int         4
X destroyCallback    Callback            Pointer     NULL
X height             Height              Dimension   computed at realize
X mappedWhenManaged  MappedWhenManaged   Boolean     True
X sensitive          Sensitive           Boolean     True
X width              Width               Dimension   computed at realize
X x                  Position            Position    0
X y                  Position            Position    0
X
X*/
X
X/* Constraint parameters:
X
X Name               Class               RepType     Default Value
X ----               -----               -------     -------------
X bottom             Edge                XtEdgeType  XtRubber
X fromHoriz          Widget              Widget      (left edge of xedwForm)
X fromVert           Widget              Widget      (top of xedwForm)
X fullHeight         Boolean             Boolean     False
X fullWidth          Boolean             Boolean     False
X horizDistance      Thickness           int         defaultDistance
X left               Edge                XtEdgeType  XtRubber
X resizable          Boolean             Boolean     False
X right              Edge                XtEdgeType  XtRubber
X rubberHeight       Boolean             Boolean     True
X rubberWidth        Boolean             Boolean     True
X top                Edge                XtEdgeType  XtRubber
X vertDistance       Thickness           int         defaultDistance
X widthLinked        Widget              Widget      NULL
X heightLinked       Widget              Widget      NULL
X
X*/
X
X
X
X#define XtNfullHeight "fullHeight"
X#define XtNfullWidth "fullWidth"
X#define XtNrubberHeight "rubberHeight"
X#define XtNrubberWidth "rubberWidth"
X#define XtNwidthLinked "widthLinked"
X#define XtNheightLinked "heightLinked"
X
Xtypedef struct _XedwFormClassRec    *XedwFormWidgetClass;
Xtypedef struct _XedwFormRec     *XedwFormWidget;
X
Xextern WidgetClass xedwFormWidgetClass;
X
Xextern void XedwFormDoLayout(Widget, Boolean);     /* Boolean doit */
X
X
X#endif /* _XedwForm_h */
SHAR_EOF
chmod 0644 code/Xedw/XedwForm.h || echo "restore of code/Xedw/XedwForm.h fails"
echo "x - extracting code/Xedw/XedwFormP.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/Xedw/XedwFormP.h &&
X
X/*****************************************************************************
XCopyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
Xand the Massachusetts Institute of Technology, Cambridge, Massachusetts.
X
X                        All Rights Reserved
X
XPermission to use, copy, modify, and distribute this software and its
Xdocumentation for any purpose and without fee is hereby granted,
Xprovided that the above copyright notice appear in all copies and that
Xboth that copyright notice and this permission notice appear in
Xsupporting documentation, and that the names of Digital or MIT not be
Xused in advertising or publicity pertaining to distribution of the
Xsoftware without specific, written prior permission.
X
XDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
XDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
XSOFTWARE.
X
X******************************************************************************/
X
X/* XedwForm widget private definitions. This Form is identical to the XawForm
X * Widget except for a few added capabilities.
X */
X
X#ifndef _XedwFormP_h
X#define _XedwFormP_h
X
X#include "XedwForm.h"
X#include <X11/Xaw/FormP.h>
X#include <X11/ConstrainP.h>
X
Xtypedef struct {
X    Boolean (*layout)(XedwFormWidget, Dimension, Dimension );
X} XedwFormClassPart;
X
Xtypedef struct _XedwFormClassRec {
X    CoreClassPart       core_class;
X    CompositeClassPart  composite_class;
X    ConstraintClassPart constraint_class;
X    XedwFormClassPart   xedwForm_class;
X} XedwFormClassRec;
X
Xextern XedwFormClassRec xedwFormClassRec;
X
Xtypedef struct _XedwFormPart {
X    /* resources */
X    int         default_spacing;    /* default distance between children */
X
X    /* private state */
X    Dimension   old_width, old_height; /* last known dimensions      */
X    int         no_refigure;        /* no re-layout while > 0        */
X    Boolean     needs_relayout;     /* next time no_refigure == 0    */
X    Boolean     resize_in_layout;   /* should layout() do geom request?  */
X    Dimension   preferred_width, preferred_height; /* cached from layout */
X} XedwFormPart;
X
Xtypedef struct _XedwFormRec {
X    CorePart            core;
X    CompositePart       composite;
X    ConstraintPart      constraint;
X    XedwFormPart        xedwForm;
X} XedwFormRec;
X
Xtypedef struct _XedwFormConstraintsPart {
X/*
X * Constraint Resources.
X */
X    XtEdgeType  top, bottom,    /* where to drag edge on resize     */
X                left, right;
X    int         dx;             /* desired horiz offset         */
X    int         dy;             /* desired vertical offset      */
X    Widget      horiz_base;     /* measure dx from here if non-null */
X    Widget      vert_base;      /* measure dy from here if non-null */
X    Widget      width_link;     /* get width from this widget if non-null */
X    Widget      height_link;    /* get height from this widget if non-null */
X    Boolean     allow_resize;   /* True if child may request resize */
X    Boolean     full_width;     /* True if child wants to be full width */
X    Boolean     full_height;    /* True if child wants to be full height */
X    Boolean     rubber_width;   /* True if the child may resize width */
X    Boolean     rubber_height;  /* True if the child may resize height */
X
X/*
X * Private contstraint resources.
X */
X
X    int         virtual_width, virtual_height;
X
X/*
X * What the size of this child would be if we did not impose the
X * constraint the width and height must be greater than zero (0).
X */
X
X    LayoutState layout_state;   /* temporary layout state       */
X} XedwFormConstraintsPart;
X
Xtypedef struct _XedwFormConstraintsRec {
X    XedwFormConstraintsPart xedwForm;
X} XedwFormConstraintsRec, *XedwFormConstraints;
X
X#endif /* _XawXedwFormP_h */
SHAR_EOF
chmod 0644 code/Xedw/XedwFormP.h || echo "restore of code/Xedw/XedwFormP.h fails"
echo "x - extracting code/Xedw/XedwList.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/Xedw/XedwList.c &&
X/* v0.2 */
X#include <X11/copyright.h>
X
X/*
X * XedwList.c - XedwList widget
X *
X * This is the XedwList widget. It is very similar to the Athena Widget List,
X * except it has the ability to display an icon with the string. Plus allows
X * multiple selections.
X * It allows the user to select one or more items in a list and notifies the
X * application through a callback function.
X *
X *  List Created:   8/13/88
X *  By:     Chris D. Peterson
X *                      MIT X Consortium
X *
X *  Modified to XedwList: 1/26/90
X *  By:     Edward Groenendaal
X *                      University of Sussex, UK.
X */
X
X#include <stdio.h>
X#include <ctype.h>
X
X#include <X11/IntrinsicP.h>
X#include <X11/StringDefs.h>
X
X#include <X11/Xmu/Drawing.h>
X
X#include <X11/Xaw/XawInit.h>
X#include "XedwListP.h"
X
X/*
X * Include bitmap for the default icon
X */
X
X#include "DefIcon.icon"
X
X
X/*
X * Default Translation table.
X */
X
Xstatic char defaultTranslations[] =
X  "!Shift<Btn1Down>: 	        MultipleSet()\n\
X   <Btn1Down>:   	        Set()\n\
X   !Shift<Btn1Down>,<Btn1Up>:   Notify()\n\
X   <Btn1Down>,<Btn1Up>:     	Notify()";
X
X/****************************************************************
X *
X * Full class record constant
X *
X ****************************************************************/
X
X/* Private Data */
X
X#define offset(field) XtOffset(XedwListWidget, field)
X
Xstatic XtResource resources[] = {
X  {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
X     offset(xedwList.foreground), XtRString, "XtDefaultForeground"},
X  {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor),
X     offset(simple.cursor), XtRString, "left_ptr"},
X  {XtNfont,  XtCFont, XtRFontStruct, sizeof(XFontStruct *),
X     offset(xedwList.font),XtRString, "XtDefaultFont"},
X  {XtNxedwList, XtCXedwList, XtRPointer, sizeof(XedwList **), /* XedwList */
X     offset(xedwList.xedwList), XtRString, NULL},
X  {XtNdefaultColumns, XtCColumns, XtRInt,  sizeof(int),
X     offset(xedwList.default_cols), XtRImmediate, (caddr_t)2},
X  {XtNlongest, XtCLongest, XtRInt,  sizeof(int),
X     offset(xedwList.longest), XtRImmediate, (caddr_t)0},
X  {XtNnumberStrings, XtCNumberStrings, XtRInt,  sizeof(int),
X     offset(xedwList.nitems), XtRImmediate, (caddr_t)0},
X  {XtNpasteBuffer, XtCBoolean, XtRBoolean,  sizeof(Boolean),
X     offset(xedwList.paste), XtRString, (caddr_t) "False"},
X  {XtNforceColumns, XtCColumns, XtRBoolean,  sizeof(Boolean),
X     offset(xedwList.force_cols), XtRString, (caddr_t) "False"},
X  {XtNverticalList, XtCBoolean, XtRBoolean,  sizeof(Boolean),
X     offset(xedwList.vertical_cols), XtRString, (caddr_t) "False"},
X  {XtNinternalWidth, XtCWidth, XtRDimension,  sizeof(Dimension),
X     offset(xedwList.internal_width), XtRImmediate, (caddr_t)4},
X  {XtNinternalHeight, XtCHeight, XtRDimension, sizeof(Dimension),
X     offset(xedwList.internal_height), XtRImmediate, (caddr_t)2},
X  {XtNcolumnSpacing, XtCSpacing, XtRDimension,  sizeof(Dimension),
X     offset(xedwList.column_space), XtRImmediate, (caddr_t)10},
X  {XtNrowSpacing, XtCSpacing, XtRDimension,  sizeof(Dimension),
X     offset(xedwList.row_space), XtRImmediate, (caddr_t)10},
X  {XtNiconWidth, XtCWidth, XtRDimension, sizeof(Dimension),       /* IconWidth */
X     offset(xedwList.icon_width), XtRImmediate, (caddr_t)32},
X  {XtNiconHeight, XtCHeight, XtRDimension, sizeof(Dimension),     /* IconHeight */
X     offset(xedwList.icon_height), XtRImmediate, (caddr_t)32},
X  {XtNshowIcons, XtCBoolean, XtRBoolean, sizeof(Boolean),         /* ShowIcons */
X     offset(xedwList.show_icons), XtRString, (caddr_t) "False"},
X  {XtNmSelections, XtCBoolean, XtRBoolean, sizeof(Boolean),       /* Multiple   */
X     offset(xedwList.multiple), XtRString, (caddr_t) "False"},     /* Selections */
X  {XtNdefaultIcon, XtCPixmap, XtRPixmap, sizeof(Pixmap),          /* DefaultIcon */
X     offset(xedwList.default_icon), XtRPixmap, (caddr_t) NULL},
X  {XtNcallback, XtCCallback, XtRCallback, sizeof(caddr_t),
X     offset(xedwList.callback), XtRCallback, NULL},
X};
X
Xstatic void             Initialize   (Widget, Widget);
Xstatic void             ChangeSize   (Widget, Dimension, Dimension);
Xstatic void             Resize       (Widget);
Xstatic void             Redisplay    (Widget, XEvent*, Region);
Xstatic Boolean          Layout       (Widget, Boolean, Boolean, Dimension*, Dimension*);
Xstatic XtGeometryResult PreferredGeom(Widget, XtWidgetGeometry*, XtWidgetGeometry*);
Xstatic Boolean          SetValues    (Widget, Widget, Widget);
Xstatic void             Notify       (Widget, XEvent*, String*, Cardinal*),
X                        Set          (Widget, XEvent*, String*, Cardinal*), 
X                        MultipleSet  (Widget, XEvent*, String*, Cardinal*), 
X                        Unset        (Widget, XEvent*, String*, Cardinal*);
Xstatic Boolean 		IsHighlighted(Widget, int);
Xstatic void		AddNode	     (Widget, int);
Xstatic void		RemoveNode   (Widget, int);
X
Xstatic XtActionsRec actions[] = {
X  {"Notify",         Notify},
X  {"Set",            Set},
X  {"Unset",          Unset},
X  {"MultipleSet",    MultipleSet},
X  {NULL,NULL}
X};
X
XXedwListClassRec xedwListClassRec = {
X  {
X/* core_class fields */
X#define superclass                  (&simpleClassRec)
X    /* superclass               */  (WidgetClass) superclass,
X    /* class_name               */  "XedwList",
X    /* widget_size              */  sizeof(XedwListRec),
X    /* class_initialize         */  XawInitializeWidgetSet,
X    /* class_part_initialize    */  NULL,
X    /* class_inited             */  FALSE,
X    /* initialize               */  Initialize,
X    /* initialize_hook          */  NULL,
X    /* realize                  */  XtInheritRealize,
X    /* actions                  */  actions,
X    /* num_actions              */  XtNumber(actions),
X    /* resources                */  resources,
X    /* num_resources            */  XtNumber(resources),
X    /* xrm_class                */  NULLQUARK,
X    /* compress_motion          */  TRUE,
X    /* compress_exposure        */  FALSE,
X    /* compress_enterleave      */  TRUE,
X    /* visible_interest         */  FALSE,
X    /* destroy                  */  NULL,
X    /* resize                   */  Resize,
X    /* expose                   */  Redisplay,
X    /* set_values               */  SetValues,
X    /* set_values_hook          */  NULL,
X    /* set_values_almost        */  XtInheritSetValuesAlmost,
X    /* get_values_hook          */  NULL,
X    /* accept_focus             */  NULL,
X    /* version                  */  XtVersion,
X    /* callback_private         */  NULL,
X    /* tm_table                 */  defaultTranslations,
X    /* query_geometry           */  PreferredGeom,
X  },
X/* Simple class fields initialization */
X  {
X    /* change_sensitive     */  XtInheritChangeSensitive
X  }
X};
X
XWidgetClass xedwListWidgetClass = (WidgetClass)&xedwListClassRec;
X
X/****************************************************************
X *
X * Private Procedures
X *
X ****************************************************************/
X
Xstatic void GetGCs(Widget w)
X{
X
X  XGCValues   values;
X  XedwListWidget ilw = (XedwListWidget) w;
X
X  values.foreground   = ilw->xedwList.foreground;
X  values.background   = ilw->core.background_pixel; 
X  values.font         = ilw->xedwList.font->fid;
X  ilw->xedwList.normgc = XtGetGC(w, (unsigned) GCBackground | GCForeground | GCFont,
X				 &values);
X
X  values.foreground   = ilw->core.background_pixel; 
X  values.background   = ilw->xedwList.foreground;
X  ilw->xedwList.revgc = XtGetGC(w, (unsigned) GCBackground | GCForeground | GCFont, &values);
X
X  values.tile       = XmuCreateStippledPixmap(XtScreen(w),
X					      ilw->xedwList.foreground,
X					      ilw->core.background_pixel,
X					      ilw->core.depth);
X  values.fill_style = FillTiled;
X
X  ilw->xedwList.graygc = XtGetGC(w, (unsigned) GCFont | GCTile | GCFillStyle,
X				 &values);
X}
X
X/*  Function Name:  ResetXedwList
X *  Description:    Resets the new xedwList when important things change.
X *  Arguments:      w - the widget.
X *                  changex, changey - allow the height or width to change?
X *  Returns: none.
X */
X
Xstatic void ResetXedwList(Widget w, Boolean changex, Boolean changey)
X{
X  XedwListWidget ilw = (XedwListWidget) w;
X  Dimension width = w->core.width;
X  Dimension height = w->core.height;
X  register int i, len;
X
X  /*
X   * If xedwList is NULL then the xedwList will just be the name of the widget,
X   * the icon will be set to the default icon. (defined in XedwListP.h)
X   */
X
X  if (ilw->xedwList.xedwList == NULL) {
X    /* Make room for structure */
X    ilw->xedwList.xedwList = XtNew(XedwList *);
X    ilw->xedwList.xedwList[0] = XtNew(XedwList);
X    ilw->xedwList.xedwList[0]->string = ilw->core.name;
X    ilw->xedwList.xedwList[0]->icon = NULL;
X    ilw->xedwList.nitems = 1;
X  }
X
X  if (ilw->xedwList.nitems == 0)       /* Get number of items. */
X    for ( ; ilw->xedwList.xedwList[ilw->xedwList.nitems] != NULL ; ilw->xedwList.nitems++);
X  
X  if (ilw->xedwList.longest == 0) /* Get column width. */
X    for ( i = 0 ; i < ilw->xedwList.nitems; i++) {
X      len = XTextWidth(ilw->xedwList.font, ilw->xedwList.xedwList[i]->string,
X		       strlen(ilw->xedwList.xedwList[i]->string));
X      if (len > ilw->xedwList.longest)
X	ilw->xedwList.longest = len;
X    }
X
X  /* If longest string is less than the width of a bitmap then the longest is
X   * the width of a bitmap
X   */
X  if (ilw->xedwList.show_icons)
X    if (ilw->xedwList.longest < ilw->xedwList.icon_width)
X      ilw->xedwList.longest = ilw->xedwList.icon_width;
X
X
X  ilw->xedwList.col_width = ilw->xedwList.longest + ilw->xedwList.column_space;
X
X  if (Layout(w, changex, changey, &width, &height))
X    ChangeSize(w, width, height);
X}
X
X/*  Function Name: ChangeSize.
X *  Description: Laysout the widget.
X *  Arguments: w - the widget to try change the size of.
X *  Returns: none.
X */
X
Xstatic void ChangeSize(Widget w, Dimension width, Dimension height)
X{
X  XtWidgetGeometry request, reply;
X
X  request.request_mode = CWWidth | CWHeight;
X  request.width = width;
X  request.height = height;
X
X  switch ( XtMakeGeometryRequest(w, &request, &reply) ) {
X  case XtGeometryYes:
X  case XtGeometryNo:
X    break;
X  case XtGeometryAlmost:
X    Layout(w, (request.height != reply.height),
X	   (request.width != reply.width),
X           &(reply.width), &(reply.height));
X    request = reply;
X    switch (XtMakeGeometryRequest(w, &request, &reply) ) {
X    case XtGeometryYes:
X    case XtGeometryNo:
X      break;
X    case XtGeometryAlmost:
X      request = reply;
X      if (Layout(w, FALSE, FALSE,
X		 &(request.width), &(request.height))) {
X	char buf[BUFSIZ];
X	sprintf(buf, "XedwList Widget: %s %s",
X		"Size Changed when it shouldn't have",
SHAR_EOF
echo "End of part 6"
echo "File code/Xedw/XedwList.c is continued in part 7"
echo "7" > s2_seq_.tmp
exit 0



More information about the Alt.sources mailing list