[comp.sources.x] v03i084: Xcu -- widget set from Cornell University, Part08/12

argv@island.uu.net (Dan Heller) (04/26/89)

Submitted-by: Gene Dykes <gdykes@tcgould.tn.cornell.edu>
Posting-number: Volume 3, Issue 84
Archive-name: xcu/part08

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then feed it
# into a shell via "sh file" or similar.  To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# If this archive is complete, you will see the following message at the end:
#		"End of archive 8 (of 12)."
# Contents:  Geometry/Geometry.c examples/xcursors/bwcursors.wc
#   src/CuButton.c src/CuCommand.c wlmCompiler/wlc.c
# Wrapped by argv@island on Mon Apr 24 15:41:55 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Geometry/Geometry.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Geometry/Geometry.c'\"
else
echo shar: Extracting \"'Geometry/Geometry.c'\" \(11603 characters\)
sed "s/^X//" >'Geometry/Geometry.c' <<'END_OF_FILE'
X#ifndef lint
Xstatic char Xrcsid[] = "$XConsortium: Geometry.c,v 1.29 88/09/06 16:27:56 jim Exp $";
X/* $oHeader: Geometry.c,v 1.3 88/08/23 11:37:50 asente Exp $ */
X#endif lint
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#include "IntrinsicI.h"
X#include "Shell.h"
X
X/* Public routines */
X
XXtGeometryResult XtMakeGeometryRequest (widget, request, reply)
X    Widget         widget;
X    XtWidgetGeometry *request, *reply;
X{
X    XtWidgetGeometry    junk;
X    XtGeometryHandler manager;
X    XtGeometryResult returnCode;
X    Widget parent = widget->core.parent;
X    XtGeometryMask	changeMask;
X    Boolean managed, parentRealized,widgetRealized;
X    XWindowChanges changes;
X
X    if (parent == NULL) {
X	XtErrorMsg("invalidParent","xtMakeGeometryRequest","XtToolkitError",
X           "XtMakeGeometryRequest - NULL parent.  Use SetValues instead",
X            (String *)NULL, (Cardinal *)NULL); 
X    }
X
X    if (XtIsComposite(parent)) {
X	parentRealized = XtIsRealized(parent);
X	manager = ((CompositeWidgetClass) (parent->core.widget_class))
X    		->composite_class.geometry_manager;
X    } else if (XtIsCompositeObject(parent)) {
X	Widget t = parent->core.parent;
X	while (! XtIsWindowObject(t)) t = t->core.parent;
X	parentRealized = XtIsRealized(t);
X	manager = ((CompositeObjectClass) (parent->core.widget_class))
X    		->composite_class.geometry_manager;
X	
X    } else {
X	/* Should never happen - XtManageChildren should have checked */
X	XtErrorMsg("invalidParent","xtMakeGeometryRequest","XtToolkitError",
X             "XtMakeGeometryRequest - parent not composite",
X              (String *)NULL, (Cardinal *)NULL);
X    }
X
X    if (manager == (XtGeometryHandler) NULL) {
X	XtErrorMsg("invalidGeometryManager","xtMakeGeometryRequest",
X                 "XtToolkitError",
X                 "XtMakeGeometryRequest - parent has no geometry manger",
X                  (String *)NULL, (Cardinal *)NULL);
X    }
X
X    if (widget->core.being_destroyed) return XtGeometryNo;
X
X    if (XtIsWindowObject(widget)) {
X        widgetRealized = XtIsRealized(widget);
X    } else {
X        widgetRealized = FALSE;
X    };
X    managed = XtIsManaged(widget);
X
X    /* see if requesting anything to change */
X    changeMask = 0;
X    if (request->request_mode & CWStackMode
X	&& request->stack_mode != XtSMDontChange) {
X	    changeMask |= CWStackMode;
X	    if (request->request_mode & CWSibling) changeMask |= CWSibling;
X    }
X    if (request->request_mode & CWX
X	&& widget->core.x != request->x) changeMask |= CWX;
X    if (request->request_mode & CWY
X	&& widget->core.y != request->y) changeMask |= CWY;
X    if (request->request_mode & CWWidth
X	&& widget->core.width != request->width) changeMask |= CWWidth;
X    if (request->request_mode & CWHeight
X	&& widget->core.height != request->height) changeMask |= CWHeight;
X    if (request->request_mode & CWBorderWidth
X	&& widget->core.border_width != request->border_width)
X	changeMask |= CWBorderWidth;
X    if (changeMask == NULL) return XtGeometryYes;
X    changeMask |= (request->request_mode & XtCWQueryOnly);
X
X    /* keep record of what the widget looks like before calling geometry mgr */
X    changes.x = widget->core.x ;
X    changes.y = widget->core.y ;
X    changes.width = widget->core.width ;
X    changes.height = widget->core.height ;
X    changes.border_width = widget->core.border_width ;
X
X    if (!managed || !parentRealized) {
X	/* Don't get parent's manager involved--assume the answer is yes */
X	if (changeMask & XtCWQueryOnly) {
X	    /* He was just asking, don't change anything, just tell him yes */
X	    return XtGeometryYes;
X	} else {
X	    /* copy values from request to widget */
X	    if (request->request_mode & CWX)
X		widget->core.x = request->x;
X	    if (request->request_mode & CWY)
X		widget->core.y = request->y;
X	    if (request->request_mode & CWWidth)
X		widget->core.width = request->width;
X	    if (request->request_mode & CWHeight)
X		widget->core.height = request->height;
X	    if (request->request_mode & CWBorderWidth)
X		widget->core.border_width = request->border_width;
X	    if (!parentRealized) return XtGeometryYes;
X	    else returnCode = XtGeometryYes;
X	}
X    } else {
X	/* go ask the widget's geometry manager */
X	if (reply == (XtWidgetGeometry *) NULL) {
X	    returnCode = (*manager)(widget, request, &junk);
X	} else {
X	    returnCode = (*manager)(widget, request, reply);
X	}
X    }
X
X    if (changeMask & XtCWQueryOnly) {
X	/* Just asking about it, don't change any geometry fields */
X	return returnCode;
X    }
X
X    if (returnCode == XtGeometryYes && widgetRealized) {
X	/* reconfigure the window (if needed) */
X	/* determine reconfigurable items by comparing with "old" widget */
X
X	if (changes.x != widget->core.x) {
X	    changeMask |= CWX;
X	    changes.x = widget->core.x;
X	}
X	if (changes.y != widget->core.y) {
X	    changeMask |= CWY;
X	    changes.y = widget->core.y;
X	}
X	if (changes.width != widget->core.width) {
X	    changeMask |= CWWidth;
X	    changes.width = widget->core.width;
X	}
X	if (changes.height != widget->core.height) {
X	    changeMask |= CWHeight;
X	    changes.height = widget->core.height;
X	}
X	if (changes.border_width != widget->core.border_width) {
X	    changeMask |= CWBorderWidth;
X	    changes.border_width = widget->core.border_width;
X	}
X
X	if (changeMask & CWStackMode) {
X	    changes.stack_mode = request->stack_mode;
X	    if (changeMask & CWSibling) 
X		changes.sibling = XtWindow(request->sibling);
X	}
X
X	XConfigureWindow(XtDisplay(widget), XtWindow(widget),
X		changeMask, &changes);
X    } else if (returnCode == XtGeometryDone) returnCode = XtGeometryYes;
X
X    return returnCode;
X} /* XtMakeGeometryRequest */
X
XXtGeometryResult XtMakeResizeRequest
X	(widget, width, height, replyWidth, replyHeight)
X    Widget	widget;
X    Dimension	width, height;
X    Dimension	*replyWidth, *replyHeight;
X{
X    XtWidgetGeometry request, reply;
X    XtGeometryResult r;
X
X    request.request_mode = CWWidth | CWHeight;
X    request.width = width;
X    request.height = height;
X    r = XtMakeGeometryRequest(widget, &request, &reply);
X    if (replyWidth != NULL)
X	if (r == XtGeometryAlmost && reply.request_mode & CWWidth)
X	    *replyWidth = reply.width;
X	else
X	    *replyWidth = width;
X    if (replyHeight != NULL)
X	if (r == XtGeometryAlmost && reply.request_mode & CWHeight)
X	    *replyHeight = reply.height;
X	else
X	    *replyHeight = height;
X    return r;
X} /* XtMakeResizeRequest */
X
Xvoid XtResizeWindow(w)
X    Widget w;
X{
X    if (XtIsRealized(w)) {
X	XWindowChanges changes;
X	changes.width = w->core.width;
X	changes.height = w->core.height;
X	changes.border_width = w->core.border_width;
X	XConfigureWindow(XtDisplay(w), XtWindow(w),
X	    (unsigned) CWWidth | CWHeight | CWBorderWidth, &changes);
X    }
X} /* XtResizeWindow */
X
X
Xvoid XtResizeWidget(w, width, height, borderWidth)
X    Widget w;
X    Dimension height, width, borderWidth;
X{
X    XWindowChanges changes;
X    Cardinal mask = 0;
X
X    if (w->core.width != width) {
X	changes.width = w->core.width = width;
X	mask |= CWWidth;
X    }
X
X    if (w->core.height != height) {
X	changes.height = w->core.height = height;
X	mask |= CWHeight;
X    }
X
X    if (w->core.border_width != borderWidth) {
X	changes.border_width = w->core.border_width = borderWidth;
X	mask |= CWBorderWidth;
X    }
X
X    if (mask != 0) {
X	if (XtIsRealized(w))
X	    XConfigureWindow(XtDisplay(w), XtWindow(w), mask, &changes);
X    if ((mask & (CWWidth | CWHeight)) &&
X	XtClass(w)->core_class.resize != (XtWidgetProc) NULL)
X	    (*(w->core.widget_class->core_class.resize))(w);
X    }
X} /* XtResizeWidget */
X
Xvoid XtConfigureWidget(w, x, y, width, height, borderWidth)
X    Widget w;
X    Position x, y;
X    Dimension height, width, borderWidth;
X{
X    XWindowChanges changes;
X    Cardinal mask = 0;
X
X    if (w->core.x != x) {
X	changes.x = w->core.x = x;
X	mask |= CWX;
X    }
X
X    if (w->core.y != y) {
X	changes.y = w->core.y = y;
X	mask |= CWY;
X    }
X
X    if (w->core.width != width) {
X	changes.width = w->core.width = width;
X	mask |= CWWidth;
X    }
X
X    if (w->core.height != height) {
X	changes.height = w->core.height = height;
X	mask |= CWHeight;
X    }
X
X    if (w->core.border_width != borderWidth) {
X	changes.border_width = w->core.border_width = borderWidth;
X	mask |= CWBorderWidth;
X    }
X
X    if (mask != 0) {
X	if (XtIsRealized(w))
X	    XConfigureWindow(XtDisplay(w), XtWindow(w), mask, &changes);
X    if ((mask & (CWWidth | CWHeight)) &&
X	XtClass(w)->core_class.resize != (XtWidgetProc) NULL)
X	    (*(w->core.widget_class->core_class.resize))(w);
X    }
X} /* XtConfigureWidget */
X
Xvoid XtMoveWidget(w, x, y)
X    Widget w;
X    Position x, y;
X{
X    if ((w->core.x != x) || (w->core.y != y)) {
X	w->core.x = x;
X	w->core.y = y;
X	if (XtIsRealized(w)) {
X	    XMoveWindow(XtDisplay(w), XtWindow(w), w->core.x, w->core.y);
X        }
X    }
X} /* XtMoveWidget */
X
Xvoid XtTranslateCoords(w, x, y, rootx, rooty)
X    register Widget w;
X    Position x, y;
X    register Position *rootx, *rooty;	/* return */
X{
X    Position garbagex, garbagey;
X
X    if (rootx == NULL) rootx = &garbagex;
X    if (rooty == NULL) rooty = &garbagey;
X
X    *rootx = x;
X    *rooty = y;
X
X    for (; w != NULL && ! XtIsShell(w); w = w->core.parent) {
X	*rootx += w->core.x + w->core.border_width;
X	*rooty += w->core.y + w->core.border_width;
X    }
X
X    if (w == NULL)
X        XtWarningMsg("invalidShell","xtTranslateCoords","XtToolkitError",
X                "Widget has no shell ancestor",
X		(String *)NULL, (Cardinal *)NULL);
X    else {
X	*rootx += w->core.x + w->core.border_width;
X	*rooty += w->core.y + w->core.border_width;
X    }
X}
X
XXtGeometryResult XtQueryGeometry(widget, intended, reply)
X    Widget widget;
X    register XtWidgetGeometry *intended; /* parent's changes; may be NULL */
X    XtWidgetGeometry *reply;	/* child's preferred geometry; never NULL */
X{
X    XtWidgetGeometry null_intended;
X    XtGeometryHandler query = XtClass(widget)->core_class.query_geometry;
X    XtGeometryResult result;
X
X    reply->request_mode = 0;
X    if (query != NULL) {
X	if (intended == NULL) {
X	    null_intended.request_mode = 0;
X	    intended = &null_intended;
X	}
X	result = (*query) (widget, intended, reply);
X    }
X    else {
X	result = XtGeometryYes;
X    }
X
X#define FillIn(mask, field) \
X	if (!(reply->request_mode & mask)) reply->field = widget->core.field;
X
X    FillIn(CWX, x);
X    FillIn(CWY, y);
X    FillIn(CWWidth, width);
X    FillIn(CWHeight, height);
X    FillIn(CWBorderWidth, border_width);
X#undef FillIn
X
X    if (!reply->request_mode & CWStackMode) reply->stack_mode =
XXtSMDontChange;
X
X    return result;
X  }

END_OF_FILE
echo shar: NEWLINE appended to \"'Geometry/Geometry.c'\"
if test 11604 -ne `wc -c <'Geometry/Geometry.c'`; then
    echo shar: \"'Geometry/Geometry.c'\" unpacked with wrong size!
fi
# end of 'Geometry/Geometry.c'
fi
if test -f 'examples/xcursors/bwcursors.wc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'examples/xcursors/bwcursors.wc'\"
else
echo shar: Extracting \"'examples/xcursors/bwcursors.wc'\" \(9061 characters\)
sed "s/^X//" >'examples/xcursors/bwcursors.wc' <<'END_OF_FILE'
X#WLDL
X3
X
X5 CuWlm
X5
X6 shadow 4 (True) 6 Global
X10 foreground 5 (Black) 6 Global
X10 background 5 (White) 6 Global
X24 CuCommand.internalHeight 2 (10) 6 Global
X10 facetWidth 1 (5) 6 Global
X0
X0
X1
X
X  5 CuTbl
X  2
X  12 equalColumns 4 (True) 5 Local
X  12 formatString 21 (padding(3);c c c c c.) 5 Local
X  0
X  0
X  80
X
X    9 CuCommand
X    2
X    6 cursor 5 (xterm) 5 Local
X    4 name 5 (xterm) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 5 (watch) 5 Local
X    4 name 5 (watch) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 8 (ur_angle) 5 Local
X    4 name 8 (ur_angle) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 8 (umbrella) 5 Local
X    4 name 8 (umbrella) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 8 (ul_angle) 5 Local
X    4 name 8 (ul_angle) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 4 (trek) 5 Local
X    4 name 4 (trek) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 7 (top_tee) 5 Local
X    4 name 7 (top_tee) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 8 (top_side) 5 Local
X    4 name 8 (top_side) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 16 (top_right_corner) 5 Local
X    4 name 16 (top_right_corner) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 15 (top_left_corner) 5 Local
X    4 name 15 (top_left_corner) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 14 (top_left_arrow) 5 Local
X    4 name 14 (top_left_arrow) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 6 (tcross) 5 Local
X    4 name 6 (tcross) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 6 (target) 5 Local
X    4 name 6 (target) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 4 (star) 5 Local
X    4 name 4 (star) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 8 (spraycan) 5 Local
X    4 name 8 (spraycan) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 6 (spider) 5 Local
X    4 name 6 (spider) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 6 (sizing) 5 Local
X    4 name 6 (sizing) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 7 (shuttle) 5 Local
X    4 name 7 (shuttle) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 17 (sb_v_double_arrow) 5 Local
X    4 name 17 (sb_v_double_arrow) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 11 (sb_up_arrow) 5 Local
X    4 name 11 (sb_up_arrow) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 14 (sb_right_arrow) 5 Local
X    4 name 14 (sb_right_arrow) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 13 (sb_left_arrow) 5 Local
X    4 name 13 (sb_left_arrow) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 17 (sb_h_double_arrow) 5 Local
X    4 name 17 (sb_h_double_arrow) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 13 (sb_down_arrow) 5 Local
X    4 name 13 (sb_down_arrow) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 8 (sailboat) 5 Local
X    4 name 8 (sailboat) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 8 (rtl_logo) 5 Local
X    4 name 8 (rtl_logo) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 11 (rightbutton) 5 Local
X    4 name 11 (rightbutton) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 9 (right_tee) 5 Local
X    4 name 9 (right_tee) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 10 (right_side) 5 Local
X    4 name 10 (right_side) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 9 (right_ptr) 5 Local
X    4 name 9 (right_ptr) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 14 (question_arrow) 5 Local
X    4 name 14 (question_arrow) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 4 (plus) 5 Local
X    4 name 4 (plus) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 6 (pirate) 5 Local
X    4 name 6 (pirate) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 6 (pencil) 5 Local
X    4 name 6 (pencil) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 5 (mouse) 5 Local
X    4 name 5 (mouse) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 12 (middlebutton) 5 Local
X    4 name 12 (middlebutton) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 3 (man) 5 Local
X    4 name 3 (man) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 8 (lr_angle) 5 Local
X    4 name 8 (lr_angle) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 8 (ll_angle) 5 Local
X    4 name 8 (ll_angle) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 10 (leftbutton) 5 Local
X    4 name 10 (leftbutton) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 8 (left_tee) 5 Local
X    4 name 8 (left_tee) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 9 (left_side) 5 Local
X    4 name 9 (left_side) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 8 (left_ptr) 5 Local
X    4 name 8 (left_ptr) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 10 (iron_cross) 5 Local
X    4 name 10 (iron_cross) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 4 (icon) 5 Local
X    4 name 4 (icon) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 5 (heart) 5 Local
X    4 name 5 (heart) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 5 (hand2) 5 Local
X    4 name 5 (hand2) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 5 (hand1) 5 Local
X    4 name 5 (hand1) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 5 (gumby) 5 Local
X    4 name 5 (gumby) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 7 (gobbler) 5 Local
X    4 name 7 (gobbler) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 5 (fleur) 5 Local
X    4 name 5 (fleur) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 8 (exchange) 5 Local
X    4 name 8 (exchange) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 10 (draped_box) 5 Local
X    4 name 10 (draped_box) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 11 (draft_small) 5 Local
X    4 name 11 (draft_small) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 11 (draft_large) 5 Local
X    4 name 11 (draft_large) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 12 (double_arrow) 5 Local
X    4 name 12 (double_arrow) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 6 (dotbox) 5 Local
X    4 name 6 (dotbox) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 3 (dot) 5 Local
X    4 name 3 (dot) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 13 (diamond_cross) 5 Local
X    4 name 13 (diamond_cross) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 9 (crosshair) 5 Local
X    4 name 9 (crosshair) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 13 (cross_reverse) 5 Local
X    4 name 13 (cross_reverse) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 5 (cross) 5 Local
X    4 name 5 (cross) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 10 (coffee_mug) 5 Local
X    4 name 10 (coffee_mug) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 5 (clock) 5 Local
X    4 name 5 (clock) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 6 (circle) 5 Local
X    4 name 6 (circle) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 10 (center_ptr) 5 Local
X    4 name 10 (center_ptr) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 10 (box_spiral) 5 Local
X    4 name 10 (box_spiral) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 10 (bottom_tee) 5 Local
X    4 name 10 (bottom_tee) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 11 (bottom_side) 5 Local
X    4 name 11 (bottom_side) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 19 (bottom_right_corner) 5 Local
X    4 name 19 (bottom_right_corner) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 18 (bottom_left_corner) 5 Local
X    4 name 18 (bottom_left_corner) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 8 (bogosity) 5 Local
X    4 name 8 (bogosity) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 4 (boat) 5 Local
X    4 name 4 (boat) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 14 (based_arrow_up) 5 Local
X    4 name 14 (based_arrow_up) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 16 (based_arrow_down) 5 Local
X    4 name 16 (based_arrow_down) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 5 (arrow) 5 Local
X    4 name 5 (arrow) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 8 (X_cursor) 5 Local
X    4 name 8 (X_cursor) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 8 (X_cursor) 5 Local
X    4 name 8 (X_cursor) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 8 (X_cursor) 5 Local
X    4 name 8 (X_cursor) 5 Local
X    0
X    0
X    0
X
X    9 CuCommand
X    2
X    6 cursor 8 (X_cursor) 5 Local
X    4 name 8 (X_cursor) 5 Local
X    0
X    0
X    0

END_OF_FILE
echo shar: NEWLINE appended to \"'examples/xcursors/bwcursors.wc'\"
if test 9062 -ne `wc -c <'examples/xcursors/bwcursors.wc'`; then
    echo shar: \"'examples/xcursors/bwcursors.wc'\" unpacked with wrong size!
fi
# end of 'examples/xcursors/bwcursors.wc'
fi
if test -f 'src/CuButton.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'src/CuButton.c'\"
else
echo shar: Extracting \"'src/CuButton.c'\" \(9887 characters\)
sed "s/^X//" >'src/CuButton.c' <<'END_OF_FILE'
X#include "disclaimer.h"
X
X/*
X * CuButton.c - CuButton widget
X */
X
X#define XtStrlen(s)	((s) ? strlen(s) : 0)
X
X  /* The following are defined for the reader's convenience.  Any
X     Xt..Field macro in this code just refers to some field in
X     one of the substructures of the WidgetRec.  */
X
X#include <X11/Xos.h>
X#include <ctype.h>
X#include <X11/StringDefs.h>
X#include <X11/IntrinsicP.h>
X#include "CuButtonP.h"
X#include "CuButtonI.h"
X
X/****************************************************************
X *
X * Full class record constant
X *
X ****************************************************************/
X
X/* Private Data */
X
Xstatic char defaultTranslations[] =
X    "<Btn1Down>:	notify(down) \n\
X     <Btn1Up>:		notify(up)\n\
X     <EnterWindow>:	highlight() \n\
X     <LeaveWindow>:	unhighlight()";
X
Xstatic Boolean defFalse = False;
X
X#define offset(field) XtOffset(CuButtonWidget, field)
Xstatic XtResource resources[] = { 
X
X   {XtNcallback, XtCCallback, XtRCallback, sizeof(caddr_t), 
X      offset(button.callbacks), XtRCallback, (caddr_t)NULL},
X   {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor),
X      offset(simple.cursor), XtRString, "dot"},
X   {XtNset, XtCBoolean, XtRBoolean, sizeof(Boolean),
X      offset(button.set), XtRBoolean, (caddr_t)&defFalse},
X};
X#undef offset
X
Xstatic XtActionsRec actionsList[] =
X{
X  {"notify",		Notify},
X  {"highlight",		Highlight},
X  {"unhighlight",	Unhighlight},
X};
X
X  /* ...ClassData must be initialized at compile time.  Must
X     initialize all substructures.
X  */
X#define superclass		(&cuLabelClassRec)
XCuButtonClassRec cuButtonClassRec =
X{
X  {
X    (WidgetClass) &cuLabelClassRec,	/* superclass		  */	
X    "CuButton",				/* class_name		  */
X    sizeof(CuButtonRec),		/* size			  */
X    NULL,				/* class_initialize	  */
X    NULL,				/* class_part_initialize  */
X    FALSE,				/* class_inited		  */
X    Initialize,				/* initialize		  */
X    NULL,				/* initialize_hook	  */
X    XtInheritRealize,			/* realize		  */
X    actionsList,			/* actions		  */
X    XtNumber(actionsList),		/* num_actions		  */
X    resources,				/* resources		  */
X    XtNumber(resources),		/* resource_count	  */
X    NULLQUARK,				/* xrm_class		  */
X    FALSE,				/* compress_motion	  */
X    TRUE,				/* compress_exposure	  */
X    TRUE,				/* compress_enterleave    */
X    FALSE,				/* visible_interest	  */
X    Destroy,				/* destroy		  */
X    XtInheritResize,			/* resize		  */
X    Redisplay,				/* expose		  */
X    SetValues,				/* set_values		  */
X    NULL,				/* set_values_hook	  */
X    XtInheritSetValuesAlmost,		/* set_values_almost	  */
X    NULL,				/* get_values_hook	  */
X    NULL,				/* accept_focus		  */
X    XtVersion,				/* version		  */
X    NULL,				/* callback_private	  */
X    defaultTranslations,		/* tm_table		  */
X    XtInheritQueryGeometry,		/* query_geometry	  */
X    XtInheritDisplayAccelerator,	/* display accelerator	  */
X    NULL,				/* extension		  */
X  },  /* CoreClass fields initialization */
X  {
X    XtInheritChangeSensitive, /* Simple Class fields */
X    XtInheritDrawFacets,
X    XtInheritDrawHighlight
X  },  /* SimpleClass fields initialization */
X  {
X    XtInheritRedisplayText,
X  },  /* LabelClass fields initialization */
X  {
X    0
X  },  /* CuButtonClass fields initialization */
X};
X
X  /* for public consumption */
XWidgetClass cuButtonWidgetClass = (WidgetClass) &cuButtonClassRec;
X
Xstatic void GetnormalGC () ;
Xstatic void GetgrayGC () ;
X
X/****************************************************************
X *
X * Private Procedures
X *
X ****************************************************************/
X
Xstatic void Get_inverseGC(cbw)
X    CuButtonWidget cbw;
X{
X    XGCValues	values;
X
X    /* Set up a GC for inverse (set) state */
X
X    values.foreground   = ComWforeground;
X    values.font		= ComWfont->fid;
X    values.fill_style   = FillSolid;
X
X    ComWinverseGC = XtGetGC((Widget)cbw,
X    	(unsigned) GCForeground | GCFont | GCFillStyle, &values);
X}
X
Xstatic void Get_inverseTextGC(cbw)
X    CuButtonWidget cbw;
X{
X    XGCValues	values;
X
X    /* Set up a GC for inverse (set) state */
X
X    if (cbw->simple.shadow)
X	values.foreground   = cbw->simple.background_pixel;
X    else
X	values.foreground   = ComWbackground; /* default is White */
X    values.font		= ComWfont->fid;
X    values.fill_style   = FillSolid;
X
X    ComWinverseTextGC = XtGetGC((Widget)cbw,
X    	(unsigned) GCForeground | GCFont | GCFillStyle, &values);
X}
X
Xstatic void Get_highlightGC(cbw)
X    CuButtonWidget cbw;
X{
X    XGCValues	values;
X    
X    /* Set up a GC for highlighted state.  It has a thicker
X       line width for the highlight border */
X
X    values.foreground   = ComWforeground;
X
X    ComWhighlightGC = XtGetGC((Widget)cbw,
X    	(unsigned) GCForeground, &values);
X}
X
X/***** **** *** ** * GetgrayGC * ** *** **** *****/
X
Xstatic void
XGetgrayGC(cbw)
X    CuButtonWidget cbw;
X{
XXGCValues	values;
X
Xvalues.foreground = cbw->label.foreground ;
Xvalues.font	  = cbw->label.font->fid ;
Xvalues.tile       = XmuCreateStippledPixmap (XtScreen((Widget)cbw),
X					     cbw->label.foreground,
X					     cbw->core.background_pixel,
X					     cbw->core.depth) ;
Xvalues.fill_style = FillTiled ;
X
Xcbw->button.gray_GC = XtGetGC(
X    (Widget)cbw, 
X    (unsigned) GCForeground | GCFont | GCTile | GCFillStyle, 
X    &values);
Xreturn ;
X}
X
X/***** **** *** ** * GetnormalGC * ** *** **** *****/
X
Xstatic void
XGetnormalGC (cbw)
X    CuButtonWidget cbw ;
X{
XXGCValues	values ;
X
Xvalues.foreground	= cbw->label.foreground ;
Xvalues.font		= cbw->label.font->fid ;
X
Xcbw->button.normal_GC = XtGetGC(
X    (Widget)cbw,
X    (unsigned) GCForeground | GCFont,
X    &values) ;
Xreturn ;
X}
X
X
X/* ARGSUSED */
Xstatic void Initialize(request, new)
X Widget request, new;
X{
X    CuButtonWidget cbw = (CuButtonWidget) new;
X
X    Get_inverseGC(cbw);
X    Get_inverseTextGC(cbw);
X    Get_highlightGC(cbw);
X    GetnormalGC (cbw) ;
X    GetgrayGC (cbw) ;
X
X      /* init flags for state */
X    ComWhighlighted = FALSE;  
X    ComWdisplayHighlighted = FALSE;
X    ComWdisplaySet = FALSE;
X
X} 
X
X/***************************
X*
X*  Action Procedures
X*
X***************************/
X
X/* ARGSUSED */
Xstatic void Highlight(w,event,params,num_params)
X     Widget w;
X     XEvent *event;
X     String *params;		/* unused */
X     Cardinal *num_params;	/* unused */
X{
X  CuButtonWidget cbw = (CuButtonWidget)w;
X  ComWhighlighted = TRUE;
X  Redisplay(w, event, (Region)NULL);
X}
X
X/* ARGSUSED */
Xstatic void Unhighlight(w,event,params,num_params)
X     Widget w;
X     XEvent *event;
X     String *params;		/* unused */
X     Cardinal *num_params;	/* unused */
X{
X  CuButtonWidget cbw = (CuButtonWidget)w;
X  ComWhighlighted = FALSE;
X  Redisplay(w, event, (Region)NULL);
X}
X
X/* ARGSUSED */
Xstatic void Notify(w,event,params,num_params)
X     Widget w;
X     XEvent *event;
X     String *params;		/* unused */
X     Cardinal *num_params;	/* unused */
X{
X  /* if (ComWset) */
X      XtCallCallbacks(w, XtNcallback, params[0]);
X}
X/*
X * Repaint the widget window
X */
X
X/************************
X*
X*  REDISPLAY (DRAW)
X*
X************************/
X
X/* ARGSUSED */
Xstatic void Redisplay(w, event, region)
X    Widget w;
X    XEvent *event;		/* unused */
X    Region region;		/* unused */
X{
XCuButtonWidget cbw = (CuButtonWidget) w;
X
X/* Here's the scoop:  If the button is normal,
X  you show the text.  If the button is highlighted but 
X  not set, you draw a thick border and show the text.
X  If the button is set, draw the button and text
X  in inverse. */
X
X/* Note that Redisplay must remember the state of its last
X  draw to determine whether to erase the window before
X  redrawing to avoid flicker.  If the state is the same,
X  the window just needs to redraw (even on an expose). */
X
X
X/*
X * if it is not highlighted and it used to be highlighted and it is not set, or
X * if it is not set and it used to be set
X *   --> Clear the window
X * else if it is set
X *   --> Fill the window with black
X */
Xcbw->label.needs_fill = False ;
X
Xif (
X    (!ComWset && ComWdisplaySet)
X   )
X    {
X    cbw->label.background_GC = ComWinverseTextGC ;
X    cbw->label.needs_fill = True ;
X    }
Xelse if (ComWset)
X    {
X    /*
X     * Don't clear the window if the button's in a set condition;
X     * instead, fill it with black to avoid flicker. (Must fill
X     * with black in case it was an expose)
X     */
X    cbw->label.background_GC = ComWinverseGC ;
X    cbw->label.needs_fill = True ;
X    }
X
X/* draw the string:  there are three different "styles" for it,
X    all in separate GCs */
X
Xif (ComWsensitive)
X    {
X    if (ComWset)
X	{
X	cbw->label.sensitive_text_GC = ComWinverseTextGC ;
X	}
X    else
X	{
X	cbw->label.sensitive_text_GC = ComWnormalGC ;
X	}
X    }
Xelse
X    {
X    cbw->label.insensitive_text_GC = ComWgrayGC ;
X    }
X
X(*superclass->core_class.expose)( w, event, region ) ;
X
XComWdisplayHighlighted = ComWhighlighted;
XComWdisplaySet = ComWset;
X
Xreturn ;
X}
X
X
X/* ARGSUSED */
Xstatic void Destroy(w)
X    Widget w;
X{
X  /* must free GCs and pixmaps */
X}
X
X
X/*
X * Set specified arguments into widget
X */
X/* ARGSUSED */
Xstatic Boolean SetValues (current, request, new)
X    Widget current, request, new;
X{
X    CuButtonWidget cbw = (CuButtonWidget) current;
X    CuButtonWidget newcbw = (CuButtonWidget) new;
X
X    if (XtCField(newcbw,sensitive) != ComWsensitive &&
X	!XtCField(newcbw,sensitive)) {  /* about to become insensitive? */
X	newcbw->button.set = FALSE;	/* yes, then anticipate unset */
X	newcbw->simple.highlighted = FALSE;
X    }
X
X     if (XtLField(newcbw,foreground) != ComWforeground)
X       {
X         XtDestroyGC(ComWinverseGC);
X	 Get_inverseGC(newcbw);
X         XtDestroyGC(ComWhighlightGC);
X	 Get_highlightGC(newcbw);
X       }
X    else 
X      {
X	if (XtCField(newcbw,background_pixel) != ComWbackground ||
X	     XtLField(newcbw,font) != ComWfont) {
X	     XtDestroyGC(ComWinverseTextGC);
X	     Get_inverseTextGC(newcbw);
X	     }
X      }
X     
X    return (XtCField(newcbw, sensitive) != ComWsensitive ||
X	    XtBField(newcbw, set) != ComWset ||
X	    newcbw->simple.highlighted != ComWhighlighted);
X}

END_OF_FILE
echo shar: NEWLINE appended to \"'src/CuButton.c'\"
if test 9888 -ne `wc -c <'src/CuButton.c'`; then
    echo shar: \"'src/CuButton.c'\" unpacked with wrong size!
fi
# end of 'src/CuButton.c'
fi
if test -f 'src/CuCommand.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'src/CuCommand.c'\"
else
echo shar: Extracting \"'src/CuCommand.c'\" \(10510 characters\)
sed "s/^X//" >'src/CuCommand.c' <<'END_OF_FILE'
X/*
X * CuCommand.c - CuCommand button widget
X *
X */
X
X#define XtStrlen(s)	((s) ? strlen(s) : 0)
X
X  /* The following are defined for the reader's convenience.  Any
X     Xt..Field macro in this code just refers to some field in
X     one of the substructures of the WidgetRec.  */
X
X#include "disclaimer.h"
X#include <stdio.h>
X#include <X11/Xos.h>
X#include <ctype.h>
X#include <X11/StringDefs.h>
X#include <X11/IntrinsicP.h>
X#include "CuCommandP.h"
X#include "CuCommandI.h"
X
X/****************************************************************
X *
X * Full class record constant
X *
X ****************************************************************/
X
X/* Private Data */
X
Xstatic char defaultTranslations[] =
X    "<Btn1Down>:	set() \n\
X     <Btn1Up>:		notify() unset() \n\
X     <EnterWindow>:	highlight() \n\
X     <LeaveWindow>:	unset(NoRedisplay) unhighlight()";
X
X#define offset(field) XtOffset(CuCommandWidget, field)
Xstatic XtResource resources[] = { 
X
X   {XtNcallback, XtCCallback, XtRCallback, sizeof(caddr_t), 
X      offset(command.callbacks), XtRCallback, (caddr_t)NULL},
X   {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor),
X      offset(simple.cursor), XtRString, "target"},
X};
X#undef offset
X
Xstatic XtActionsRec actionsList[] =
X{
X  {"set",		Set},
X  {"notify",		Notify},
X  {"highlight",		Highlight},
X  {"unset",		Unset},
X  {"unhighlight",	Unhighlight},
X};
X
X  /* ...ClassData must be initialized at compile time.  Must
X     initialize all substructures.  (Actually, last two here
X     need not be initialized since not used.)
X  */
X#define superclass		(&cuLabelClassRec)
XCuCommandClassRec cuCommandClassRec = {
X  {
X    (WidgetClass) &cuLabelClassRec,	/* superclass		  */	
X    "CuCommand",			/* class_name		  */
X    sizeof(CuCommandRec),		/* size			  */
X    NULL,				/* class_initialize	  */
X    NULL,				/* class_part_initialize  */
X    FALSE,				/* class_inited		  */
X    Initialize,				/* initialize		  */
X    NULL,				/* initialize_hook	  */
X    XtInheritRealize,			/* realize		  */
X    actionsList,			/* actions		  */
X    XtNumber(actionsList),		/* num_actions		  */
X    resources,				/* resources		  */
X    XtNumber(resources),		/* resource_count	  */
X    NULLQUARK,				/* xrm_class		  */
X    FALSE,				/* compress_motion	  */
X    TRUE,				/* compress_exposure	  */
X    TRUE,				/* compress_enterleave    */
X    FALSE,				/* visible_interest	  */
X    Destroy,				/* destroy		  */
X    XtInheritResize,			/* resize		  */
X    Redisplay,				/* expose		  */
X    SetValues,				/* set_values		  */
X    NULL,				/* set_values_hook	  */
X    XtInheritSetValuesAlmost,		/* set_values_almost	  */
X    NULL,				/* get_values_hook	  */
X    NULL,				/* accept_focus		  */
X    XtVersion,				/* version		  */
X    NULL,				/* callback_private	  */
X    defaultTranslations,		/* tm_table		  */
X    NULL,				/* query_geometry	  */
X    XtInheritDisplayAccelerator,	/* display accelerator	  */
X    NULL,				/* extension		  */
X  },
X  {
X    XtInheritChangeSensitive, /* Simple Class fields */
X    XtInheritDrawFacets,
X    XtInheritDrawHighlight
X  },
X  {
X    XtInheritRedisplayText,  /* Label Class field */
X  },
X  {
X    0,                                     /* field not used    */
X  },  /* CuCommandClass fields initialization */
X};
X
Xstatic void GetnormalGC () ;
Xstatic void GetgrayGC () ;
X
X  /* for public consumption */
XWidgetClass cuCommandWidgetClass = (WidgetClass) &cuCommandClassRec;
X
X/****************************************************************
X *
X * Private Procedures
X *
X ****************************************************************/
X
Xstatic void Get_inverseGC(cbw)
X    CuCommandWidget cbw;
X{
X    XGCValues	values;
X
X    /* Set up a GC for inverse (set) state */
X
X    values.foreground   = ComWforeground;
X    values.font		= ComWfont->fid;
X    values.fill_style   = FillSolid;
X
X    ComWinverseGC = XtGetGC((Widget)cbw,
X    	(unsigned) GCForeground | GCFont | GCFillStyle, &values);
X}
X
Xstatic void Get_inverseTextGC(cbw)
X    CuCommandWidget cbw;
X{
X    XGCValues	values;
X
X    /* Set up a GC for inverse (set) state */
X
X    if (cbw->simple.shadow)
X	values.foreground   = cbw->simple.background_pixel;
X    else
X	values.foreground   = ComWbackground; /* default is White */
X    values.font		= ComWfont->fid;
X    values.fill_style   = FillSolid;
X    values.line_width   = ComWhighlightThickness > 1
X			  ? ComWhighlightThickness : 0;
X
X    ComWinverseTextGC = XtGetGC((Widget)cbw,
X    	(unsigned) GCLineWidth | GCForeground | GCFont | GCFillStyle, &values);
X}
X
Xstatic void Get_highlightGC(cbw)
X    CuCommandWidget cbw;
X{
X    XGCValues	values;
X    
X    /* Set up a GC for highlighted state.  It has a thicker
X       line width for the highlight border */
X
X    values.foreground   = ComWforeground;
X    values.line_width   = ComWhighlightThickness > 1
X			  ? ComWhighlightThickness : 0;
X
X    ComWhighlightGC = XtGetGC((Widget)cbw,
X    	(unsigned) GCForeground | GCLineWidth, &values);
X}
X
X/***** **** *** ** * GetgrayGC * ** *** **** *****/
X
Xstatic void
XGetgrayGC(cbw)
X    CuCommandWidget cbw;
X{
XXGCValues	values;
X
Xvalues.foreground = cbw->label.foreground ;
Xvalues.font	  = cbw->label.font->fid ;
Xvalues.tile       = XmuCreateStippledPixmap (XtScreen((Widget)cbw),
X					     cbw->label.foreground,
X					     cbw->core.background_pixel,
X					     cbw->core.depth) ;
Xvalues.fill_style = FillTiled ;
X
Xcbw->command.gray_GC = XtGetGC(
X    (Widget)cbw, 
X    (unsigned) GCForeground | GCFont | GCTile | GCFillStyle, 
X    &values);
Xreturn ;
X}
X
X/***** **** *** ** * GetnormalGC * ** *** **** *****/
X
Xstatic void
XGetnormalGC (cbw)
X    CuCommandWidget cbw ;
X{
XXGCValues	values ;
X
Xvalues.foreground	= cbw->label.foreground ;
Xvalues.font		= cbw->label.font->fid ;
X
Xcbw->command.normal_GC = XtGetGC(
X    (Widget)cbw,
X    (unsigned) GCForeground | GCFont,
X    &values) ;
Xreturn ;
X}
X
X
X/* ARGSUSED */
Xstatic void Initialize(request, new)
X Widget request, new;
X{
X    CuCommandWidget cbw = (CuCommandWidget) new;
X
X    Get_inverseGC(cbw);
X    Get_inverseTextGC(cbw);
X    Get_highlightGC(cbw);
X    GetnormalGC (cbw) ;
X    GetgrayGC (cbw) ;
X
X      /* init flags for state */
X    ComWset = FALSE;
X    ComWhighlighted = FALSE;  
X    ComWdisplayHighlighted = FALSE;
X    ComWdisplaySet = FALSE;
X
X} 
X
X/***************************
X*
X*  Action Procedures
X*
X***************************/
X
X/* ARGSUSED */
Xstatic void Set(w,event,params,num_params)
X     Widget w;
X     XEvent *event;
X     String *params;		/* unused */
X     Cardinal *num_params;	/* unused */
X{
X  CuCommandWidget cbw = (CuCommandWidget)w;
X  ComWset = TRUE;
X  Redisplay(w, event, (Region)NULL);
X}
X
X/* ARGSUSED */
Xstatic void Unset(w,event,params,num_params)
X     Widget w;
X     XEvent *event;
X     String *params;		/* unused */
X     Cardinal *num_params;
X{
X  CuCommandWidget cbw = (CuCommandWidget)w;
X  ComWset = FALSE;
X  if (*num_params == 0)
X      Redisplay(w, event, (Region)NULL);
X}
X
X/* ARGSUSED */
Xstatic void Highlight(w,event,params,num_params)
X     Widget w;
X     XEvent *event;
X     String *params;		/* unused */
X     Cardinal *num_params;	/* unused */
X{
X  CuCommandWidget cbw = (CuCommandWidget)w;
X  ComWhighlighted = TRUE;
X  Redisplay(w, event, (Region)NULL);
X}
X
X/* ARGSUSED */
Xstatic void Unhighlight(w,event,params,num_params)
X     Widget w;
X     XEvent *event;
X     String *params;		/* unused */
X     Cardinal *num_params;	/* unused */
X{
X  CuCommandWidget cbw = (CuCommandWidget)w;
X  ComWhighlighted = FALSE;
X  Redisplay(w, event, (Region)NULL);
X}
X
X/* ARGSUSED */
Xstatic void Notify(w,event,params,num_params)
X     Widget w;
X     XEvent *event;
X     String *params;		/* unused */
X     Cardinal *num_params;	/* unused */
X{
X  CuCommandWidget cbw = (CuCommandWidget)w;
X  if (ComWset)
X      XtCallCallbacks(w, XtNcallback, NULL);
X}
X/*
X * Repaint the widget window
X */
X
X/************************
X*
X*  REDISPLAY (DRAW)
X*
X************************/
X
X/* ARGSUSED */
Xstatic void Redisplay(w, event, region)
X    Widget w;
X    XEvent *event;		/* unused */
X    Region region;		/* unused */
X{
X   CuCommandWidget cbw = (CuCommandWidget) w;
X
X   /* Here's the scoop:  If the command button button is normal,
X      you show the text.  If the command button is highlighted but 
X      not set, you draw a thick border and show the text.
X      If the command button is set, draw the button and text
X      in inverse. */
X
X   /* Note that Redisplay must remember the state of its last
X      draw to determine whether to erase the window before
X      redrawing to avoid flicker.  If the state is the same,
X      the window just needs to redraw (even on an expose). */
X
Xcbw->label.needs_fill = False ;
X
Xif (
X    (!ComWset && ComWdisplaySet)
X   )
X    {
X    cbw->label.background_GC = ComWinverseTextGC ;
X    cbw->label.needs_fill = True ;
X    }
Xelse if (ComWset)
X    {
X    /*
X     * Don't clear the window if the button's in a set condition;
X     * instead, fill it with black to avoid flicker. (Must fill
X     * with black in case it was an expose)
X     */
X    cbw->label.background_GC = ComWinverseGC ;
X    cbw->label.needs_fill = True ;
X    }
X
X/* draw the string:  there are three different "styles" for it,
X    all in separate GCs */
X
Xif (ComWsensitive)
X    {
X    if (ComWset)
X	{
X	cbw->label.sensitive_text_GC = ComWinverseTextGC ;
X	}
X    else
X	{
X	cbw->label.sensitive_text_GC = ComWnormalGC ;
X	}
X    }
Xelse
X    {
X    cbw->label.insensitive_text_GC = ComWgrayGC ;
X    }
X
X(*superclass->core_class.expose)( w, event, region ) ;
X
XComWdisplayHighlighted = ComWhighlighted;
XComWdisplaySet = ComWset;
X
X}
X
X
X/* ARGSUSED */
Xstatic void Destroy(w)
X    Widget w;
X{
X  /* must free GCs and pixmaps */
X}
X
X
X/*
X * Set specified arguments into widget
X */
X/* ARGSUSED */
Xstatic Boolean SetValues (current, request, new)
X    Widget current, request, new;
X{
X    CuCommandWidget cbw = (CuCommandWidget) current;
X    CuCommandWidget newcbw = (CuCommandWidget) new;
X
X    if (XtCField(newcbw,sensitive) != ComWsensitive &&
X	!XtCField(newcbw,sensitive)) {  /* about to become insensitive? */
X	XtCBField(newcbw,set) = FALSE;	/* yes, then anticipate unset */
X	newcbw->simple.highlighted = FALSE;
X    }
X
X     if (XtLField(newcbw,foreground) != ComWforeground)
X       {
X         XtDestroyGC(ComWinverseGC);
X	 Get_inverseGC(newcbw);
X         XtDestroyGC(ComWhighlightGC);
X	 Get_highlightGC(newcbw);
X       }
X    else 
X      {
X	if (XtCField(newcbw,background_pixel) != ComWbackground ||
X	     XtLField(newcbw,font) != ComWfont) {
X	     XtDestroyGC(ComWinverseTextGC);
X	     Get_inverseTextGC(newcbw);
X	     }
X      }
X     
X    return (XtCField(newcbw, sensitive) != ComWsensitive ||
X	    newcbw->simple.highlighted != ComWhighlighted);
X}

END_OF_FILE
echo shar: NEWLINE appended to \"'src/CuCommand.c'\"
if test 10511 -ne `wc -c <'src/CuCommand.c'`; then
    echo shar: \"'src/CuCommand.c'\" unpacked with wrong size!
fi
# end of 'src/CuCommand.c'
fi
if test -f 'wlmCompiler/wlc.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'wlmCompiler/wlc.c'\"
else
echo shar: Extracting \"'wlmCompiler/wlc.c'\" \(10197 characters\)
sed "s/^X//" >'wlmCompiler/wlc.c' <<'END_OF_FILE'
X/* *
X * * This code is completely original.  Permission is granted to do with
X * * it as one wishes.  I disclaim any responsibility whatsoever for
X * * any bad things that may happen because of using it.
X * */
X
X#include <stdio.h>
X#include <X11/Xos.h>
X#include <sys/stat.h>
X#include <X11/IntrinsicP.h>
X#include <X11/StringDefs.h>
X#include <X11/Cardinals.h>
X#include <X11/Xresource.h>
X#include <X11/StringDefs.h>
X#include "CuStack.h"
X#include "wlc.h"
X
X/* Private Definitions */
X
Xstatic int wlm_bug, lex_bug, yacc_bug, stack_bug, real_bug, list_bug, call_bug ;
Xstatic char error_text[200] ;
X
X/* Declarations of "private" calls */
X
Xstatic void	read_layout () ;
Xstatic void	compile () ;
Xstatic void	fetus_print () ;
Xstatic void	managed_print () ;
Xstatic void	resources_print () ;
Xstatic void	directives_print () ;
Xstatic void	pad_print () ;
X
Xstatic int	input () ;
Xstatic void	unput () ;
Xstatic void	yyerror () ;
Xstatic int	yywrap () ;
X
X/**
X ***
X **** Wlm Compiler
X ***
X **/
X
X#define WLM_MAX_UNPUT 100
X#define WLM_MAX_CONTEXT 1000
X
Xtypedef struct
X    {
X    String input_buffer ;
X    Cardinal input_pointer ;
X    char unput_buffer[WLM_MAX_UNPUT] ;
X    Cardinal unput_pointer ;
X    char context_buffer[WLM_MAX_CONTEXT] ;
X    int context_ptr ; /* must not be Cardinal */
X    Cardinal line_number ;
X    String cur_file ;
X    } WlmInputRecord ;
X
Xstatic WlmInputRecord *layout_input ;
X
Xstatic WlmCompilerPart _ww, *ww = &_ww ;
X
Xmain (argc, argv)
X    int argc ;
X    char *argv[] ;
X{
Xchar *input_file ;
Xint argv_length ;
Xif (argc < 2)
X    {
X    fprintf (stderr, "Usage: %s WLDL_file\n", argv[0]) ;
X    exit (1) ;
X    }
X
Xargv_length = strlen(argv[1]) ;
Xif (strcmp(&argv[1][argv_length-3], ".wl") == 0)
X    {
X    /* This permits extensioned or extensionless input */
X    argv[1][argv_length-3] = '\0' ;
X    argv_length -= 3 ;
X    }
Xww->compiled_file = XtMalloc (argv_length + 4) ;
Xww->class_file = XtMalloc (argv_length + 4) ;
Xww->wldl_file = XtMalloc (argv_length + 4) ;
Xinput_file = XtMalloc (argv_length + 4) ;
Xsprintf (ww->compiled_file, "%s.wc", argv[1]) ;
Xsprintf (ww->class_file, "%s.cl", argv[1]) ;
Xsprintf (ww->wldl_file, "%s.lw", argv[1]) ;
Xsprintf (input_file, "%s.wl", argv[1]) ;
X
X/*
X * We'll read the file as one big string, then parse it.
X */
X
Xlayout_input = (WlmInputRecord *) XtMalloc (sizeof (WlmInputRecord)) ;
Xread_layout (input_file, layout_input) ;
Xyyparse () ;
Xcompile (ww->child_stack) ;
X
Xexit (0) ;
X}
X
X/***** **** *** ** * read_layout * ** *** **** *****/
X
Xstatic void
Xread_layout (file, layout_input)
X    String file ;
X    WlmInputRecord *layout_input ;
X{
XFILE *fd ;
Xstruct stat buf ;
X
Xfd = fopen (file, "r") ;
Xif (fd <= 0)
X    {
X    char *my_text = "Wlm: Couldn't open (%s) for reading\n" ;
X    char *etext = XtMalloc (strlen(my_text) + strlen(file)) ;
X    sprintf (etext, my_text, file) ;
X    XtError (etext) ;
X    }
X
X/*
X * Find out how big the layout file is.
X * Read it in as one big chunk.
X * Initialize some useful variables
X */
X
Xfstat (fileno(fd), &buf) ;
Xlayout_input->input_buffer = XtMalloc (buf.st_size + 1) ;
Xfread (layout_input->input_buffer, buf.st_size, 1, fd) ;
Xlayout_input->input_buffer[buf.st_size] = '\0' ;
X
XCu_copy_ds (&layout_input->cur_file, file) ; /* for error messages */
Xlayout_input->input_pointer = 0 ;
Xlayout_input->unput_pointer = 0 ;
Xlayout_input->line_number = 1 ;
Xfclose (fd) ;
X
Xreturn ;
X}
X
Xtypedef struct WlmClassnameList
X    {
X    String name ;
X    struct WlmClassnameList *next ;
X    } WlmClassnameList ;
X
Xstatic WlmClassnameList *list ;
X
Xtypedef struct WlmWldlList
X    {
X    String name ;
X    struct WlmWldlList *next ;
X    } WlmWldlList ;
X
Xstatic WlmClassnameList *listC ;
Xstatic WlmWldlList *listW ;
X
Xstatic void
Xcompile (stack)
X    Stack *stack ;
X{
XFILE *fd ;
XWlmClassnameList *chkC ;
XWlmWldlList *chkW ;
X
XlistC = NULL ;
Xfd = fopen (ww->compiled_file, "w") ;
Xfprintf (fd, "#WLDL\n") ;
Xfprintf (fd, "%d\n", ww->max_depth) ;
Xfetus_print (fd, (Fetus *)Cu_stack_peek(stack, STACK_NEXT_POP), 0) ;
Xfclose (fd) ;
X
Xfd = fopen (ww->class_file, "w") ;
Xfor (chkC=listC;  chkC != NULL;  chkC = chkC->next)
X    {
X    fprintf (fd, "%s\n", chkC->name) ;
X    }
Xfclose (fd) ;
X
Xfd = fopen (ww->wldl_file, "w") ;
Xfor (chkW=listW;  chkW != NULL;  chkW = chkW->next)
X    {
X    fprintf (fd, "%s\n", chkW->name) ;
X    }
Xfclose (fd) ;
X
Xreturn ;
X}
X
X#define LSTRNG(x) strlen(x), x
X
Xstatic void
Xfetus_print (fd, fetus, pad)
X    FILE *fd ;
X    Fetus *fetus ;
X    int pad ;
X{
XResource *resource ;
XDirective *directive ;
XWlmManageItem *managed ;
XCardinal j ;
X
XWlmClassnameList *chk ;
Xfor (chk=listC;  chk != NULL;  chk = chk->next)
X    {
X    if (strcmp (chk->name, fetus->class_name) == 0)
X	break ;
X    }
Xif (chk == NULL)
X    {
X    chk = listC ;
X    listC = (WlmClassnameList *) XtMalloc (sizeof (WlmClassnameList)) ;
X    listC->name = fetus->class_name ;
X    listC->next = chk ;
X    }
X
Xfprintf (fd, "\n") ;
Xpad_print (fd, pad) ;
Xfprintf (fd, "%d %s\n", LSTRNG(fetus->class_name)) ;
X
Xpad_print (fd, pad) ;
Xfprintf (fd, "%d\n", fetus->n_resources) ;
Xfor (resource=fetus->resource;  resource != NULL;  resource=resource->next)
X    {
X    resources_print (fd, resource, pad) ;
X    if (strcmp (fetus->class_name, "Wlm") == 0 &&
X        strcmp (resource->name, "file") == 0)
X	{
X	WlmWldlList *save = listW ;
X	listW = (WlmWldlList *) XtMalloc (sizeof (WlmWldlList)) ;
X	listW->name = resource->value ;
X	listW->next = save ;
X	}
X    }
X
Xpad_print (fd, pad) ;
Xfprintf (fd, "%d\n", fetus->n_directives) ;
Xfor (directive=fetus->directives;  directive != NULL; directive=directive->next)
X    directives_print (fd, directive, pad) ;
X
Xpad_print (fd, pad) ;
Xfprintf (fd, "%d\n", fetus->n_manage_list) ;
Xfor (managed=fetus->manage_list;  managed != NULL; managed=managed->next)
X    managed_print (fd, managed, pad) ;
X
Xpad_print (fd, pad) ;
Xfprintf (fd, "%d\n", fetus->n_children) ;
Xpad += 2 ;
Xfor (j=0;  j < fetus->n_children;  j++)
X    fetus_print (fd, fetus->children[j], pad) ;
X
Xreturn ;
X}
X
Xstatic void
Xmanaged_print (fd, managed, pad)
X    FILE *fd ;
X    WlmManageItem *managed ;
X    int pad ;
X{
Xpad_print (fd, pad) ;
Xfprintf (fd, "%d (%s) %d %s %d (%s)\n",
X    LSTRNG(managed->widget), LSTRNG(managed->type), LSTRNG(managed->value)) ;
Xreturn ;
X}
X
Xstatic void
Xresources_print (fd, resource, pad)
X    FILE *fd ;
X    Resource *resource ;
X    int pad ;
X{
Xpad_print (fd, pad) ;
Xfprintf (fd, "%d %s %d (%s) %d %s\n",
X    LSTRNG(resource->name), LSTRNG(resource->value),
X    (resource->context == WlmLocalContext) ? strlen("Local") : strlen("Global"),
X    (resource->context == WlmLocalContext) ? "Local" : "Global") ;
Xreturn ;
X}
X
Xstatic void
Xdirectives_print (fd, directive, pad)
X    FILE *fd ;
X    Directive *directive ;
X    int pad ;
X{
XCardinal i ;
Xpad_print (fd, pad) ;
Xfprintf (fd, "%d %s %d %s %d %s %d %d %s\n",
X    LSTRNG(directive->callback_name), LSTRNG(directive->target_class),
X    LSTRNG(directive->target_name), directive->n_call_comparisons,
X    directive->resource.name ?
X	strlen("XtSetValues") : strlen("PublicFunction"),
X    directive->resource.name ?
X	"XtSetValues" : "PublicFunction") ;
X
Xpad += 1 ;
Xfor (i=0;  i < directive->n_call_comparisons;  i++)
X    {
X    Cardinal j ;
X    static char *op_text[] = { "==", "!=", ">", "<", ">=", "<=" } ;
X
X    pad_print (fd, pad) ;
X    fprintf (fd, "%d %s %d (%s) %d %d %s %d :",
X	LSTRNG(directive->call_data_converter[i]),
X	LSTRNG(directive->call_data[i]),
X	directive->call_data_operator[i],
X	LSTRNG(op_text[(int)directive->call_data_operator[i]]),
X	directive->n_call_indices[i]) ;
X
X    for (j=0;  j < directive->n_call_indices[i];  j++)
X	fprintf (fd, " %d", directive->call_data_index[i][j]) ;
X    fprintf (fd, "\n") ;
X    }
Xpad -= 1 ;
X
Xif (directive->resource.name)
X    {
X    pad_print (fd, pad) ;
X    fprintf (fd, "%d %s %d (%s) %d %s %d (%s)\n",
X	LSTRNG(directive->target_class), LSTRNG(directive->target_name),
X	LSTRNG(directive->resource.name), LSTRNG(directive->resource.value)
X	) ; 
X    }
Xelse
X    {
X    Cardinal i ;
X    pad_print (fd, pad) ;
X    fprintf (fd, "%d %s %d\n", LSTRNG(directive->procedure),
X		directive->n_arguments) ;
X
X    for (i=0;  i < directive->n_arguments;  i++)
X	{
X	pad_print (fd, pad) ;
X	fprintf (fd, "%d %s %d (%s)\n",
X	    LSTRNG(directive->argument_converters[i]),
X	    LSTRNG(directive->argument_strings[i])) ;
X	}
X    }
X
Xreturn ;
X}
X
Xstatic void
Xpad_print (fd, pad)
X    FILE *fd ;
X    int pad ;
X{
Xwhile (pad--)
X    fprintf (fd, " ") ;
Xreturn ;
X}
X
X
X/**
X ** The routines used to parse a wlm description
X **/
X
X/***** **** *** ** * "yyerror" * ** *** **** *****/
X
Xstatic void
Xyyerror (s)
X    char *s ;
X{
XCardinal length ;
XCardinal ptr ;
XCardinal i ;
XString my_text = "Wlm: Parsing error (%s)\nLine # %d in file '%s':\n" ;
XString etext ;
Xlength = strlen(my_text) + strlen(s) + WLM_MAX_CONTEXT + 20 ;
Xetext = XtMalloc (length) ;
Xsprintf (etext, my_text, s, layout_input->line_number, layout_input->cur_file) ;
Xstrcat (etext, layout_input->context_buffer) ;
XXtError (etext) ;
X}
X
X/***** **** *** ** * the lex input routine * ** *** **** *****/
X
Xstatic int
Xinput ()
X{
Xint t ;
Xif (layout_input->unput_pointer)
X    {
X    t = layout_input->unput_buffer[layout_input->unput_pointer-1] ;
X    layout_input->unput_pointer-- ;
X    }
Xelse
X    {
X    t = layout_input->input_buffer[layout_input->input_pointer++] ;
X    }
X
Xif (t == '\n')
X    {
X    layout_input->line_number++ ;
X    layout_input->context_ptr = 0 ;
X    }
Xelse
Xif (layout_input->context_ptr < WLM_MAX_CONTEXT)
X    {
X    layout_input->context_buffer[layout_input->context_ptr++] = t ;
X    layout_input->context_buffer[layout_input->context_ptr] = '\0' ;
X    }
Xelse
X    {
X    sprintf (error_text,
X	    "Insufficient context buffer space for input character (%c)\n", t) ;
X    XtWarning (error_text) ;
X    }
X
Xreturn t ;
X}
X
X/***** **** *** ** * the lex unput routine * ** *** **** *****/
X
Xstatic void
Xunput (c)
X    int c ;
X{
Xlayout_input->unput_buffer[layout_input->unput_pointer++] = c ;
X
X/*
X * Just wipe out currrent line context characters.  Don't try to retrieve those
X * already cycled out. (It seems highly unlikely that anything significant
X * will ever be lost by this.)
X */
X
Xif (layout_input->context_ptr > 0)
X    layout_input->context_ptr-- ;
X
Xif (c == '\n')
X    if (layout_input->line_number > 1)
X	layout_input->line_number-- ;
X
Xreturn ;
X}
X
X#include "wlc.y.c"
X

END_OF_FILE
echo shar: NEWLINE appended to \"'wlmCompiler/wlc.c'\"
if test 10198 -ne `wc -c <'wlmCompiler/wlc.c'`; then
    echo shar: \"'wlmCompiler/wlc.c'\" unpacked with wrong size!
fi
# end of 'wlmCompiler/wlc.c'
fi
echo shar: End of archive 8 \(of 12\).
cp /dev/null ark8isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 12 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0