X386MON part 02/06

Warren Tucker wht at n4hgf.Mt-Park.GA.US
Sun Feb 17 06:33:49 AEST 1991


Submitted-by: wht at n4hgf
Archive-name: x386monx100/part02

#!/bin/sh
# This is part 02 of x386monx100
# ============= x386mon/Button.c ==============
if test ! -d 'x386mon'; then
    echo 'x - creating directory x386mon'
    mkdir 'x386mon'
fi
if test -f 'x386mon/Button.c' -a X"$1" != X"-c"; then
	echo 'x - skipping x386mon/Button.c (File already exists)'
else
echo 'x - extracting x386mon/Button.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'x386mon/Button.c' &&
X/* #define MyDebug */
X/*+-------------------------------------------------------------------------
X	Button.c - XwtButton widget (derived from Xaw code)
X
X  Defined functions:
X	Button_Destroy(w)
X	Button_alloc_armed_GC(bw)
X	Button_alloc_label_GC(bw)
X	Button_Initialize(request,new)
X	Button_EventHandler(w,event,arg,argcount)
X	Button_QueryGeometry(w,intended,preferred)
X	Button_Realize(w,valueMask,attributes)
X	Button_Redisplay(w,event,region)
X	Button_Resize(w)
X	Button_Calculations(bw)
X	Button_SetValues(current,request,new)
X	XwtCreateButton(parent,name,arglist,argcount)
X	_Reposition(bw,width,height,dx,dy)
X
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:01-12-1991-04:34-wht at n4hgf-x1.00 (flush old edit notes) */
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#define XtStrlen(s)		((s) ? strlen(s): 0)
X
X#include <X11/IntrinsicP.h>
X#include <X11/StringDefs.h>
X#include <stdio.h>
X#include <ctype.h>
X#include "ButtonP.h"
X
X#define offset(field) XtOffset(XwtButtonWidget,b.field)
Xstatic XtResource resources[] = 
X{
X	{XwtNlabelColor,XwtCLabelColor,XtRPixel,sizeof(Pixel),
X		offset(label_color),XtRString,"black"},
X	{XwtNunarmedColor,XwtCUnarmedColor,XtRPixel,sizeof(Pixel),
X		offset(unarmed_color),XtRString,"slate"},
X	{XwtNarmedColor,XwtCArmedColor,XtRPixel,sizeof(Pixel),
X		offset(armed_color),XtRString,"yellow"},
X	{XwtNfont,XwtCFont,XtRFontStruct,sizeof(XFontStruct *),
X		offset(font),XtRString,"fixed"},
X	{XwtNlabel,XwtCLabel,XtRString,sizeof(String),
X		offset(label),XtRString,NULL},
X	{XwtNinternalWidth,XwtCWidth,XtRDimension,sizeof(Dimension),
X		offset(internal_width),XtRImmediate,(caddr_t)1},
X	{XwtNinternalHeight,XwtCHeight,XtRDimension,sizeof(Dimension),
X		offset(internal_height),XtRImmediate,(caddr_t)1},
X	{XwtNactivateCallback,XtCCallback,XtRCallback,sizeof(caddr_t),
X		offset(cb_list), XtRCallback,NULL}
X};
X
Xstatic void Button_Initialize();
Xstatic void Button_Realize();
Xstatic void Button_Resize();
Xstatic void Button_Redisplay();
Xstatic Boolean Button_SetValues();
Xstatic void Button_Destroy();
Xstatic void Button_EventHandler();
Xstatic XtGeometryResult Button_QueryGeometry();
X
Xstatic char defaultTranslations[] =
X	"<Btn1Down>: event()\n\
X	 <Btn1Up>: event()\n\
X	 <EnterWindow>: event()\n\
X	 <LeaveWindow>: event()\n";
X
Xstatic XtActionsRec actionsList[] =
X{
X	{ "event",(XtActionProc)Button_EventHandler }
X};
X
XXwtButtonClassRec ButtonClassRec = 
X{
X	{
X        /* core_class fields */
X#define superclass              (&xmPrimitiveClassRec)
X        /* superclass           */      (WidgetClass)superclass,
X        /* class_name           */      "Button",
X        /* widget_size          */      sizeof(XwtButtonRec),
X        /* class_initialize     */      NULL,
X        /* class_part_initialize*/      NULL,
X        /* class_inited         */      FALSE,
X        /* initialize           */      Button_Initialize,
X        /* initialize_hook      */      NULL,
X        /* realize              */      Button_Realize,
X        /* actions              */      actionsList,
X        /* num_actions          */      XtNumber(actionsList),
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     */      TRUE,
X        /* destroy              */      Button_Destroy,
X        /* resize               */      Button_Resize,
X        /* expose               */      Button_Redisplay,
X        /* set_values           */      Button_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       */      Button_QueryGeometry,
X        /* display_accelerator  */      XtInheritDisplayAccelerator,
X        /* extension            */      NULL
X	}
X};
X
XWidgetClass XwtbuttonWidgetClass = (WidgetClass) &ButtonClassRec;
X
X/*+-------------------------------------------------------------------------
X	Button_Calculations(bw) - Calculate placements and sizes
X--------------------------------------------------------------------------*/
Xstatic void
XButton_Calculations(bw)
XXwtButtonWidget bw;
X{
X	register XFontStruct	*fs = bw->b.font;
X
X	if(bw->b.internal_height < 2)
X		bw->b.internal_height = 2;
X	if(bw->b.internal_width < 2)
X		bw->b.internal_width = 2;
X	bw->b.label_len = XtStrlen(bw->b.label);
X	bw->b.label_width = XTextWidth(fs,bw->b.label,(int)bw->b.label_len) + 1;
X	bw->b.label_height = fs->max_bounds.ascent + fs->max_bounds.descent;
X
X}	/* end of Button_Calculations */
X
X/*+-------------------------------------------------------------------------
X	Button_alloc_label_GC(bw)
X--------------------------------------------------------------------------*/
Xstatic void
XButton_alloc_label_GC(bw)
XXwtButtonWidget bw;
X{
X	XGCValues	values;
X
X	values.foreground	= bw->b.label_color;
X	values.font			= bw->b.font->fid;
X	values.line_width	= 1;
X	values.line_style	= LineSolid;
X	values.cap_style	= CapButt;
X	values.join_style	= JoinMiter;
X
X	bw->b.label_GC = XtGetGC((Widget)bw,
X	    (unsigned)GCForeground | GCFont | GCLineWidth | GCLineStyle |
X		GCCapStyle | GCJoinStyle,&values);
X
X}	/* end of Button_alloc_label_GC */
X
X/*+-------------------------------------------------------------------------
X	Button_alloc_armed_GC(bw)
X--------------------------------------------------------------------------*/
Xstatic void
XButton_alloc_armed_GC(bw)
XXwtButtonWidget bw;
X{
X	XGCValues	values;
X
X	values.foreground = bw->b.armed_color;
X	values.background = bw->b.label_color;
X	bw->b.armed_GC = XtGetGC((Widget)bw,
X		(unsigned)GCForeground | GCBackground,&values);
X
X}	/* end of Button_alloc_armed_GC */
X
X/*+-------------------------------------------------------------------------
X	Button_alloc_unarmed_GC(bw)
X--------------------------------------------------------------------------*/
Xstatic void
XButton_alloc_unarmed_GC(bw)
XXwtButtonWidget bw;
X{
X	XGCValues	values;
X
X	values.foreground = bw->b.unarmed_color;
X	values.background = bw->b.label_color;
X	bw->b.unarmed_GC = XtGetGC((Widget)bw,
X		(unsigned)GCForeground | GCBackground,&values);
X
X}	/* end of Button_alloc_unarmed_GC */
X
X/*+-------------------------------------------------------------------------
X	Button_Initialize(request,new)
X--------------------------------------------------------------------------*/
X/*ARGSUSED*/
Xstatic void
XButton_Initialize(request,new)
XWidget request,new;
X{
X	XwtButtonWidget bw = (XwtButtonWidget)new;
X
X	if(bw->b.label == NULL)
X		bw->b.label = bw->core.name;
X	else 
X		bw->b.label = strcpy(XtMalloc(strlen(bw->b.label) + 1),bw->b.label);
X
X	Button_alloc_label_GC(bw);
X	Button_alloc_armed_GC(bw);
X	Button_alloc_unarmed_GC(bw);
X
X	Button_Calculations(bw);
X
X	bw->core.width = bw->b.label_width + (2 * bw->b.internal_width) + 2;
X	bw->core.height = bw->b.label_height + (2 * bw->b.internal_height) + 2;
X
X	(*XtClass(new)->core_class.resize)((Widget)bw);
X
X}	/* end of Button_Initialize */
X
X/*+-------------------------------------------------------------------------
X	Button_Realize(w,valueMask,attributes)
X--------------------------------------------------------------------------*/
Xstatic void
XButton_Realize(w,valueMask,attributes)
Xregister Widget w;
XMask *valueMask;
XXSetWindowAttributes *attributes;
X{
X	*valueMask |= CWBitGravity;
X	attributes->bit_gravity = NorthWestGravity;
X	(*superclass->core_class.realize)(w,valueMask,attributes);
X
X}	/* end of Button_Realize */
X
X/*+-------------------------------------------------------------------------
X	Button_Redisplay(w,event,region) - expose
X--------------------------------------------------------------------------*/
X/*ARGSUSED*/
Xstatic void
XButton_Redisplay(w,event,region)
XWidget w;
XXEvent *event;
XRegion region;
X{
X	register XwtButtonWidget bw = (XwtButtonWidget)w;
X	GC background_gc;
X
X	if(region && XRectInRegion(region,bw->b.label_x,bw->b.label_y,
X	    bw->b.label_width,bw->b.label_height) == RectangleOut)
X	{
X		return;
X	}
X
X#if defined(MyDebug)
X	printf("Button_Redisplay armed=%d in_window=%d\n",
X		bw->b.armed,bw->b.in_window);
X#endif
X
X	background_gc = (bw->b.armed) ? bw->b.armed_GC : bw->b.unarmed_GC;
X	XFillRectangle(XtDisplay(w),XtWindow(w),background_gc,
X		0,0,bw->core.width,bw->core.height);
X
X	if(bw->b.in_window)
X	{
X		XDrawRectangle(XtDisplay(w),XtWindow(w),bw->b.label_GC,
X			1,1,bw->core.width - 2,bw->core.height - 2);
X	}
X
X	XDrawString(XtDisplay(w),XtWindow(w),bw->b.label_GC,
X		bw->b.label_x,bw->b.label_y + bw->b.font->max_bounds.ascent,
X	    bw->b.label,(int)bw->b.label_len);
X
X}	/* end of Button_Redisplay */
X
X/*+-------------------------------------------------------------------------
X	_Reposition(bw,width,height,dx,dy)
X--------------------------------------------------------------------------*/
Xstatic void
X_Reposition(bw,width,height,dx,dy)
Xregister XwtButtonWidget bw;
XDimension width,height;
XPosition *dx,*dy;
X{
X	Position newPos = bw->b.internal_width;
X	if(newPos < (Position)bw->b.internal_width)
X		newPos = bw->b.internal_width;
X	*dx = newPos - bw->b.label_x;
X	bw->b.label_x = newPos;
X	*dy = (newPos = (height - bw->b.label_height) / 2) - bw->b.label_y;
X	bw->b.label_y = newPos;
X
X}	/* end of _Reposition */
X
X/*+-------------------------------------------------------------------------
X	Button_Resize(w)
X--------------------------------------------------------------------------*/
Xstatic void
XButton_Resize(w)
XWidget w;
X{
X	XwtButtonWidget bw = (XwtButtonWidget)w;
X	Position dx,dy;
X
X	_Reposition(bw,w->core.width,w->core.height,&dx,&dy);
X	if((dx || dy) && XtIsRealized(w))
X	{
X		int old_x = bw->b.label_x - dx;
X		int old_y = bw->b.label_y - dy;
X		XCopyArea(XtDisplay(w),XtWindow(w),XtWindow(w),bw->b.label_GC,
X		    (int)old_x,(int)old_y,
X		    (unsigned)bw->b.label_width,(unsigned)bw->b.label_height,
X		    (int)bw->b.label_x,(int)bw->b.label_y);
X		if(dx)
X		{
X			XClearArea(XtDisplay(w),XtWindow(w),
X			    (dx > 0) ? old_x : (int)bw->b.label_x + bw->b.label_width,
X			    old_y,(unsigned)((dx < 0) ? -dx : dx),
X			    (unsigned)bw->b.label_height,False);
X		}
X		if(dy)
X		{
X			XClearArea(XtDisplay(w),XtWindow(w),
X			    old_x,
X			    (dy > 0) ? old_y : (int)bw->b.label_y + bw->b.label_height,
X			    (unsigned)bw->b.label_width,
X			    (unsigned)((dy < 0) ? -dy : dy),False);
X		}
X	}
X}	/* end of Button_Resize */
X
X/*+-------------------------------------------------------------------------
X	Button_SetValues(current,request,new) - Set specified arguments into widget
X--------------------------------------------------------------------------*/
X/*ARGSUSED*/
Xstatic Boolean
XButton_SetValues(current,request,new)
XWidget current,request,new;
X{
X	XwtButtonWidget curb = (XwtButtonWidget)current;
X	XwtButtonWidget reqb = (XwtButtonWidget)request;
X	XwtButtonWidget newb = (XwtButtonWidget)new;
X	Boolean changed = False;
X
X	if(!newb->b.label)
X		newb->b.label = newb->core.name;
X
X	if(curb->b.label != newb->b.label)
X	{
X		if(curb->b.label != curb->core.name)
X			XtFree((char *)curb->b.label );
X
X		if(newb->b.label != newb->core.name)
X		{
X			newb->b.label = strcpy(
X			    XtMalloc((unsigned)XtStrlen(newb->b.label) + 1),
X			    newb->b.label);
X		}
X		changed = True;
X	}
X
X	if(changed || (curb->b.font != newb->b.font) ||
X	  (curb->b.internal_width != newb->b.internal_width) ||
X	  (curb->b.internal_height != newb->b.internal_height))
X	{
X		Button_Calculations(newb);
X		changed = True;
X	}
X
X	/* calculate the window size */
X	if(newb->b.resize)
X	{
X		if(curb->core.width == reqb->core.width)
X		{
X			newb->core.width =
X			    newb->b.label_width + (2 * newb->b.internal_width) + 2;
X		}
X
X		if(curb->core.height == reqb->core.height)
X		{
X			newb->core.height =
X			    newb->b.label_height + (2 * newb->b.internal_height);
X		}
X	}
X
X	if(curb->b.label_color != newb->b.label_color
X	    || curb->b.font->fid != newb->b.font->fid)
X	{
X		XtReleaseGC(newb,curb->b.label_GC);
X		Button_alloc_label_GC(newb);
X		changed = True;
X	}
X
X	if(curb->b.armed_color != newb->b.armed_color)
X	{
X		XtReleaseGC(newb,curb->b.armed_GC);
X		Button_alloc_armed_GC(newb);
X		changed |= curb->b.armed;
X	}
X
X	if(curb->b.unarmed_color != newb->b.unarmed_color)
X	{
X		XtReleaseGC(newb,curb->b.unarmed_GC);
X		Button_alloc_unarmed_GC(newb);
X		changed |= !curb->b.armed;
X	}
X
X	if((curb->b.internal_width != newb->b.internal_width) ||
X	   (curb->b.internal_height != newb->b.internal_height) || changed)
X	{
X		Position dx,dy;
X		_Reposition(newb,curb->core.width,curb->core.height,&dx,&dy);
X	}
X
X	return(changed);
X
X}	/* end of Button_SetValues */
X
X/*+-------------------------------------------------------------------------
X	Button_Destroy(w)
X--------------------------------------------------------------------------*/
Xstatic void
XButton_Destroy(w)
XWidget w;
X{
X	XwtButtonWidget bw = (XwtButtonWidget)w;
X
X	XtReleaseGC(w,bw->b.label_GC);
X	XtReleaseGC(w,bw->b.armed_GC);
X	XtReleaseGC(w,bw->b.unarmed_GC);
X	if(bw->b.label != bw->core.name)
X		XtFree((char *)bw->b.label);
X
X	XtRemoveAllCallbacks(w,XwtNactivateCallback,bw->b.cb_list);
X
X}	/* end of Button_Destroy */
X
X/*+-------------------------------------------------------------------------
X	Button_QueryGeometry(w,intended,preferred)
X--------------------------------------------------------------------------*/
Xstatic XtGeometryResult
XButton_QueryGeometry(w,intended,preferred)
XWidget w;
XXtWidgetGeometry *intended,*preferred;
X{
X	register XwtButtonWidget bw = (XwtButtonWidget)w;
X
X	preferred->request_mode = CWWidth | CWHeight;
X	preferred->width = bw->b.label_width + (2 * bw->b.internal_width) + 2;
X	preferred->height = bw->b.label_height + (2 * bw->b.internal_height) + 2;
X
X	if( ((intended->request_mode & (CWWidth | CWHeight)) ==
X		(CWWidth | CWHeight)) &&
X	    intended->width == preferred->width &&
X	    intended->height == preferred->height)
X	{
X		return(XtGeometryYes);
X	}
X	else if((preferred->width == w->core.width) &&
X	    (preferred->height == w->core.height))
X	{
X		return(XtGeometryNo);
X	}
X	else
X		return(XtGeometryAlmost);
X
X}	/* end of Button_QueryGeometry */
X
X/*+-------------------------------------------------------------------------
X	event_type_text(type)
X--------------------------------------------------------------------------*/
X#if defined(MyDebug)
Xstatic char *
Xevent_type_text(type)
Xint type;
X{
Xstatic char errant[32];
X
X	switch(type)
X	{
X		case KeyPress: return("KeyPress");
X		case KeyRelease: return("KeyRelease");
X		case ButtonPress: return("ButtonPress");
X		case ButtonRelease: return("ButtonRelease");
X		case MotionNotify: return("MotionNotify");
X		case EnterNotify: return("EnterNotify");
X		case LeaveNotify: return("LeaveNotify");
X		case FocusIn: return("FocusIn");
X		case FocusOut: return("FocusOut");
X		case KeymapNotify: return("KeymapNotify");
X		case Expose: return("Expose");
X		case GraphicsExpose: return("GraphicsExpose");
X		case NoExpose: return("NoExpose");
X		case VisibilityNotify: return("VisibilityNotify");
X		case CreateNotify: return("CreateNotify");
X		case DestroyNotify: return("DestroyNotify");
X		case UnmapNotify: return("UnmapNotify");
X		case MapNotify: return("MapNotify");
X		case MapRequest: return("MapRequest");
X		case ReparentNotify: return("ReparentNotify");
X		case ConfigureNotify: return("ConfigureNotify");
X		case ConfigureRequest: return("ConfigureRequest");
X		case GravityNotify: return("GravityNotify");
X		case ResizeRequest: return("ResizeRequest");
X		case CirculateNotify: return("CirculateNotify");
X		case CirculateRequest: return("CirculateRequest");
X		case PropertyNotify: return("PropertyNotify");
X		case SelectionClear: return("SelectionClear");
X		case SelectionRequest: return("SelectionRequest");
X		case SelectionNotify: return("SelectionNotify");
X		case ColormapNotify: return("ColormapNotify");
X		case ClientMessage: return("ClientMessage");
X		case MappingNotify: return("MappingNotify");
X		default:
X			sprintf(errant,"event %u?",type);
X			return(errant);
X	}
X
X}	/* end of event_type_text */
X#endif
X
X/*+-------------------------------------------------------------------------
X	Button_EventHandler(w,event,arg,argcount)
X--------------------------------------------------------------------------*/
X/*ARGSUSED*/
Xstatic void
XButton_EventHandler(w,event,arg,argcount)
XWidget w;
XXEvent *event;
Xchar **arg;
Xint argcount;
X{
X	register XwtButtonWidget bw = (XwtButtonWidget)w;
X	XwtButtonCallbackStruct cb;
X
X#if defined(MyDebug)
X	printf("Button event %s\n",event_type_text(event->type));
X#endif
X
X	cb.reason = -1;
X	switch(event->type)
X	{
X		case ButtonPress:
X			if(!bw->b.armed)
X			{
X				bw->b.armed = 1;
X				Button_Redisplay(w,event,(Region)0);
X			}
X			break;
X
X		case ButtonRelease:
X			if(bw->b.armed)
X			{
X				bw->b.armed = 0;
X				Button_Redisplay(w,event,(Region)0);
X				cb.reason = XwtRC_ACTIVATE;
X			}
X			break;
X
X		case LeaveNotify:
X			bw->b.in_window = 0;
X			bw->b.armed = 0;
X			Button_Redisplay(w,event,(Region)0);
X			break;
X
X		case EnterNotify:
X			bw->b.in_window = 1;
X			Button_Redisplay(w,event,(Region)0);
X			break;
X	}
X
X	/* invoke callbacks if indicated */
X	if(cb.reason != -1)
X	{
X		cb.event = event;
X		XtCallCallbacks(bw,XwtNactivateCallback,&cb);
X	}
X
X}	/* end of Button_EventHandler */
X
X/*+-------------------------------------------------------------------------
X	XwtCreateButton(parent,name,arglist,argcount) - convenience routine
X--------------------------------------------------------------------------*/
XWidget
XXwtCreateButton(parent,name,arglist,argcount)
XWidget parent;
XString name;
XArgList arglist;
XCardinal argcount;
X{
X	return(XtCreateManagedWidget(name,XwtbuttonWidgetClass,
X		parent,arglist,argcount));
X
X}	/* end of XwtCreateButton */
X
X/*+-------------------------------------------------------------------------
X	XwtButtonSize(w,width,height)
X--------------------------------------------------------------------------*/
Xvoid
XXwtButtonSize(w,width,height)
XWidget w;
XDimension *width;
XDimension *height;
X{
X	register XwtButtonWidget bw = (XwtButtonWidget)w;
X
X	if(!XtIsRealized(w))
X	{
X		Button_Calculations(w);
X		*width = bw->b.label_width + (2 * bw->b.internal_width) + 2;
X		*height = bw->b.label_height + (2 * bw->b.internal_height) + 2;
X	}
X	else
X	{
X		*width = bw->core.width;
X		*height = bw->core.height;
X	}
X
X}	/* end of XwtButtonSize */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of Button.c */
SHAR_EOF
chmod 0644 x386mon/Button.c ||
echo 'restore of x386mon/Button.c failed'
Wc_c="`wc -c < 'x386mon/Button.c'`"
test 19633 -eq "$Wc_c" ||
	echo 'x386mon/Button.c: original size 19633, current size' "$Wc_c"
fi
# ============= x386mon/Button.h ==============
if test -f 'x386mon/Button.h' -a X"$1" != X"-c"; then
	echo 'x - skipping x386mon/Button.h (File already exists)'
else
echo 'x - extracting x386mon/Button.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'x386mon/Button.h' &&
X/*+-------------------------------------------------------------------------
X	Button.h - Public definitions for Button widget
X	wht at n4hgf.Mt-Park.GA.US
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:01-12-1991-04:34-wht at n4hgf-x1.00 (flush old edit notes) */
X
X#ifndef _Button_h
X#define _Button_h
X#include "XwtStrings.h"
X
X#define XwtRC_ACTIVATE		1
X
Xextern WidgetClass XwtbuttonWidgetClass;
X
Xtypedef struct _XwtButtonClassRec *XwtButtonWidgetClass;
Xtypedef struct _XwtButtonRec      *XwtButtonWidget;
X
Xtypedef struct XwtButtonCallbackStruct
X{
X	int reason;
X	XEvent *event;
X} XwtButtonCallbackStruct;
X
X#ifdef __STDC__
XWidget XwtCreateButton(
X	Widget parent,
X	String name,
X	ArgList arglist,
X	Cardinal argcount
X	);
Xvoid XwtButtonSize(
X	Widget w,
X	Dimension *width,
X	Dimension *height
X	);
X#else
XWidget XwtCreateButton();
Xvoid XwtButtonSize();
X#endif
X
X#endif /* _XwtButton_h */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of Button.h */
SHAR_EOF
chmod 0644 x386mon/Button.h ||
echo 'restore of x386mon/Button.h failed'
Wc_c="`wc -c < 'x386mon/Button.h'`"
test 975 -eq "$Wc_c" ||
	echo 'x386mon/Button.h: original size 975, current size' "$Wc_c"
fi
# ============= x386mon/ButtonP.h ==============
if test -f 'x386mon/ButtonP.h' -a X"$1" != X"-c"; then
	echo 'x - skipping x386mon/ButtonP.h (File already exists)'
else
echo 'x - extracting x386mon/ButtonP.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'x386mon/ButtonP.h' &&
X/*+-------------------------------------------------------------------------
X	ButtonP.h - XwtButton widget
X	wht at n4hgf.Mt-Park.GA.US
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:01-12-1991-04:34-wht at n4hgf-x1.00 (flush old edit notes) */
X
X#ifndef _XwtButtonP_h
X#define _XwtButtonP_h
X
X#include <Xm/XmP.h>
X#include "Button.h"
X
Xtypedef struct _XwtButtonClassPart
X{
X	int dummy;
X} XwtButtonClassPart;
X
Xtypedef struct _XwtButtonClassRec
X{
X	CoreClassPart core_class;
X	XmPrimitiveClassPart primitive_class;
X	XwtButtonClassPart Button_class;
X} XwtButtonClassRec;
X
Xextern XwtButtonClassRec ButtonClassRec;
X
Xtypedef struct _XwtButtonPart
X{
X	Pixel label_color;
X	Pixel armed_color;
X	Pixel unarmed_color;
X	XFontStruct *font;
X	char *label;
X	Dimension internal_width;
X	Dimension internal_height;
X	XtCallbackList cb_list;
X	Pixmap pixmap;
X	Boolean resize;
X	GC label_GC;
X	GC armed_GC;
X	GC unarmed_GC;
X	Position label_x;
X	Position label_y;
X	Dimension label_width;
X	Dimension label_height;
X	Dimension label_len;
X	unsigned char armed;
X	unsigned char in_window;
X} XwtButtonPart;
X
Xtypedef struct _XwtButtonRec 
X{
X	CorePart core;
X	XmPrimitivePart primitive;
X	XwtButtonPart b;
X} XwtButtonRec;
X
X#endif /* _XwtButtonP_h */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of ButtonP.h */
SHAR_EOF
chmod 0644 x386mon/ButtonP.h ||
echo 'restore of x386mon/ButtonP.h failed'
Wc_c="`wc -c < 'x386mon/ButtonP.h'`"
test 1303 -eq "$Wc_c" ||
	echo 'x386mon/ButtonP.h: original size 1303, current size' "$Wc_c"
fi
# ============= x386mon/XwtStrings.h ==============
if test -f 'x386mon/XwtStrings.h' -a X"$1" != X"-c"; then
	echo 'x - skipping x386mon/XwtStrings.h (File already exists)'
else
echo 'x - extracting x386mon/XwtStrings.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'x386mon/XwtStrings.h' &&
X/*+-------------------------------------------------------------------------
X	XwtStrings.h -Xwt widget string definitions
X	wht at n4hgf.Mt-Park.GA.US
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:01-12-1991-04:34-wht at n4hgf-x1.00 (flush old edit notes) */
X
X#if !defined(_XwtStringdefs_h)
X#define _XwtStringdefs_h
X
X#define XwtNactivateCallback    "activateCallback"
X#define XwtNarmedColor          "armedColor"
X#define XwtNfont                "font"
X#define XwtNinternalHeight      "internalHeight"
X#define XwtNinternalWidth       "internalWidth"
X#define XwtNlabel               "label"
X#define XwtNlabelColor          "labelColor"
X#define XwtNlabelFont           "labelFont"
X#define XwtNlabelWidth          "labelWidth"
X#define XwtNunarmedColor        "unarmedColor"
X#define XwtNvalue               "value"
X#define XwtNvalueFont           "valueFont"
X#define XwtNvalueColor          "valueColor"
X#define XwtNvalueWidth          "valueWidth"
X
X#define XwtCArmedColor          "ArmedColor"
X#define XwtCFont                "Font"
X#define XwtCHeight              "Height"
X#define XwtCLabel               "Label"
X#define XwtCLabelColor          "LabelColor"
X#define XwtCLabelWidth          "LabelWidth"
X#define XwtCUnarmedColor        "UnarmedColor"
X#define XwtCValue               "Value"
X#define XwtCValueColor          "ValueColor"
X#define XwtCValueFont           "ValueFont"
X#define XwtCValueWidth          "ValueWidth"
X#define XwtCWidth               "Width"
X
X#endif /* _XwtStringdefs_h */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of XwtStrings.h */
SHAR_EOF
chmod 0644 x386mon/XwtStrings.h ||
echo 'restore of x386mon/XwtStrings.h failed'
Wc_c="`wc -c < 'x386mon/XwtStrings.h'`"
test 1597 -eq "$Wc_c" ||
	echo 'x386mon/XwtStrings.h: original size 1597, current size' "$Wc_c"
fi
# ============= x386mon/bootinfo.c ==============
if test -f 'x386mon/bootinfo.c' -a X"$1" != X"-c"; then
	echo 'x - skipping x386mon/bootinfo.c (File already exists)'
else
echo 'x - extracting x386mon/bootinfo.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'x386mon/bootinfo.c' &&
X/*+-------------------------------------------------------------------------
X	bootinfo.c - x386mon bootinfo struct display
X
X  Defined functions:
X	bmemf_text(flags)
X	draw_Bootinfo(x,y)
X
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:01-12-1991-04:35-wht at n4hgf-x1.00 (flush old edit notes) */
X
X#include "unixincs.h"
X#define WANT_MON_EXTERNS
X#include "x386mon.h"
X#include "buttons.h"
X#include "utoa.h"
X#include "disp_info.h"
X
X#if defined(HAS_BOOTINFO)
X
Xstatic int line_style = LineSolid;
Xstatic int cap_style = CapButt;
Xstatic int join_style = JoinMiter;
X
X/*+-------------------------------------------------------------------------
X	bmemf_text(flags)
X--------------------------------------------------------------------------*/
Xchar *
Xbmemf_text(flags)
Xulong flags;
X{
Xstatic char hex_errant[16];
Xulong orig_flags = flags;
X
X#if defined(B_MEM_DOWN)		/* SCO only */
X	flags &= ~B_MEM_DOWN;
X#endif
X#if defined(B_MEM_BASE)		/* ISC only (or is it SVR3.2.2?) */
X	flags &= ~B_MEM_BASE;
X#endif
X#if defined(B_MEM_EXPANS)	/* ISC */
X	flags &= ~B_MEM_EXPANS;
X#endif
X#if defined(B_MEM_SHADOW)	/* ISC */
X	flags &= ~B_MEM_SHADOW;
X#endif
X#if defined(B_MEM_TREV)		/* ISC */
X	flags &= ~B_MEM_TREV;
X#endif
X
X	if(!flags)
X		return("    ");
X	switch(flags)
X	{
X#if defined(B_MEM_RSRVD)
X		case B_MEM_RSRVD: return("RSVD");
X#endif
X#if defined(B_MEM_KBSS)
X		case B_MEM_KBSS:  return("KBSS");
X#endif
X#if defined(B_MEM_KTEXT)
X		case B_MEM_KTEXT: return("KTXT");
X#endif
X#if defined(B_MEM_KDATA)
X		case B_MEM_KDATA: return("KDTA");
X#endif
X#if defined(B_MEM_NODMA)
X		case B_MEM_NODMA: return("NODM");
X#endif
X#if defined(B_MEM_CANTDMA)
X		case B_MEM_CANTDMA: return("NODM");
X#endif
X	}
X	sprintf(hex_errant,"%04x",(ushort)orig_flags);
X	return(hex_errant);
X}	/* end of bmemf_text */
X
X/*+-------------------------------------------------------------------------
X	ISC_machinetype_text(machine)
X--------------------------------------------------------------------------*/
X#if defined(ME_COMPAQVGA)	/* ISC machdep.h */
Xchar *
XISC_machinetype_text(machine)
Xunsigned char machine;
X{
X	switch(machine)
X	{
X#if defined(M_UNKNOWN)	/* some ISC bootinfo.h do not have these */
X		case M_UNKNOWN:
X			return("");
X			break;
X#endif
X#if defined(M_COMPAQ)
X		case M_COMPAQ:
X			return("Compaq");
X			break;
X#endif
X#if defined(M_PS2)
X		case M_PS2:
X			return("PS/2");
X			break;
X#endif
X#if defined(M_AT)
X		case M_AT:
X			return("Generic 386");
X			break;
X#endif
X#if defined(M_ATT)
X		case M_ATT:
X			return("AT&T 6386");
X			break;
X#endif
X#if defined(M_ATT5)
X		case M_ATT5:
X			return("AT&T 6386");
X			break;
X#endif
X#if defined(M_M380)
X		case M_M380:
X			return("Olivetti M380");
X			break;
X#endif
X#if defined(M_DELL)
X		case M_DELL:
X			return("Dell 386");
X			break;
X#endif
X#if defined(M_D325)
X		case M_D325:
X			return("Dell 325");
X			break;
X#endif
X#if defined(M_ALR)
X		case M_ALR:
X			return("Adv Logic Res");
X			break;
X#endif
X#if defined(M_ZDS)
X		case M_ZDS:
X			return("Zenith Data");
X			break;
X#endif
X	}
X	return("i386");
X}	/* end of ISC_machinetype_text */
X#endif
X
X/*+-------------------------------------------------------------------------
X	ISC_displaytype_text(adapter)
X--------------------------------------------------------------------------*/
X#if defined(ME_COMPAQVGA)	/* ISC machdep.h */
Xchar *
XISC_displaytype_text(adapter)
Xunsigned char adapter;
X{
X
X	switch(adapter)
X	{
X		case ME_UNKNOWN:
X			return("unknown to sys");
X			break;
X		case ME_EGA:
X			return("EGA");
X			break;
X		case ME_CGA80:
X			return("CGA");
X			break;
X		case ME_MONO:
X			return("MONO");
X			break;
X		case ME_COMPAQHR:
X			return("Compaq mono");
X			break;
X		case ME_Z449:
X			return("Zenith Z449");
X			break;
X		case ME_T5100:
X			return("Toshiba T5100");
X			break;
X		case ME_COMPAQVGA:
X			return("Compaq VGA");
X			break;
X		case ME_OTHERVGA:
X			return("VGA");
X			break;
X#if defined(ME_PVGA1)
X		case ME_PVGA1:
X			return("Paradise VGA1");
X			break;
X#endif /*ME_PVGA1*/
X#if defined(ME_V7VGA)
X		case ME_V7VGA:
X			return("Video 7 VGA");
X			break;
X#endif /*ME_V7VGA*/
X	}
X	return("???");
X}	/* end of ISC_displaytype_text */
X#endif
X
X/*+-------------------------------------------------------------------------
X	draw_Bootinfo(x,y)
X--------------------------------------------------------------------------*/
Xvoid
Xdraw_Bootinfo(x,y)
Xint x;
Xint y;
X{
Xregister itmp;
Xregister struct bootmem *bmem;
Xchar *cptr;
Xchar s80[80];
Xint fwidth = FWIDTH;
Xint fheight = FHEIGHT;
Xint len;
Xint x2 = x;
Xint yl1 = y + (FASCENT / 2);
Xint yl2 = y + (fheight / 2) - 1;
Xint ys  = y + FASCENT;
X
X	switch(current_display_mode)
X	{
X		case BUTTON_main:
X			break;
X		default:
X			return;
X	}
X
X	if(DrawAreaXYWH.height < (y + (fheight * 2)))
X		return;
X
X	cptr = "---Bootinfo-----------";
X	len = strlen(cptr);
X	/* the "background" bar */
X	XSetForeground(display,gc,colorSlate.pixel);
X	XSetLineAttributes(display,gc,fheight,line_style,cap_style,join_style);
X	XDrawLine(display,window,gc, x,yl1, x + (len * fwidth),yl1);
X
X	/* draw the black line before "Bootinfo" */
X	XSetForeground(display,gc,foreground);
X	XSetLineAttributes(display,gc,FASCENT / 2, line_style,cap_style,join_style);
X	XDrawLine(display,window,gc,
X		x2,yl1,
X		x2 + (len = (fwidth * 3)) - FGAP,yl1);
X	x2 += len;
X
X	/* draw "Bootinfo" */
X	cptr = "Bootinfo";
X	XDrawString(display,window,gc, x2,  ys, cptr,len = strlen(cptr));
X	XDrawString(display,window,gc, x2+1,ys, cptr,len);
X	x2 += fwidth * len;
X
X	/* draw the black line after "Bootinfo" */
X	XDrawLine(display,window,gc,
X		x2 + FGAP + 1,yl1,
X		x2 + (len = (fwidth * 11)),yl1);
X	x2 += len;
X	y += fheight;
X
X#if defined(M_UNIX)	/* ISC doesn't have this in struct */
X	disp_static_long_units(x,y,"basemem  ",7,"k",bootinfo.basemem / 1024);
X	y += fheight;
X	disp_static_long_units(x,y,"extmem   ",7,"k",bootinfo.extmem / 1024);
X	y += fheight;
X#endif
X#if defined(ME_COMPAQVGA)	/* ISC machdep.h */
X	sprintf(s80,"machine %14.14s",
X		ISC_machinetype_text(bootinfo.machenv.machine));
X	XDrawString(display,window,gc, x,y + FASCENT,s80,strlen(s80));
X	y += fheight;
X	sprintf(s80,"disp %17.17s",
X		ISC_displaytype_text(bootinfo.machenv.adapter));
X	XDrawString(display,window,gc, x,y + FASCENT,s80,strlen(s80));
X	y += fheight;
X#endif
X	strcpy(s80,"bflags   ");
X	ultoda_lz(s80 + strlen(s80),8,bootinfo.bootflags);
X	disp_static_text(x,y,s80);
X	y += fheight;
X
X	cptr = "memory available      ";
X	XDrawString(display,window,gc, x,y + FASCENT, cptr,strlen(cptr));
X	y += fheight;
X
X	for(itmp = 0; itmp < bootinfo.memavailcnt; itmp++)
X	{
X		bmem = &bootinfo.memavail[itmp];
X#if defined(B_MEM_DOWN)
X		if(bmem->flags & B_MEM_DOWN)
X		{
X			bmem->base -= bmem->extent;
X			bmem->flags &= ~B_MEM_DOWN;
X		}
X#endif
X		sprintf(s80,"%08lx %08lx %s",bmem->base,bmem->extent,
X			bmemf_text(bmem->flags));
X		XDrawString(display,window,gc, x,y + FASCENT,s80,strlen(s80));
X		y += fheight;
X	}
X
X	cptr = "memory used           ";
X	XDrawString(display,window,gc, x,y + FASCENT, cptr,strlen(cptr));
X	y += fheight;
X	for(itmp = 0; itmp < bootinfo.memusedcnt; itmp++)
X	{
X		bmem = &bootinfo.memused[itmp];
X#if defined(B_MEM_DOWN)
X		if(bmem->flags & B_MEM_DOWN)
X		{
X			bmem->base -= bmem->extent;
X			bmem->flags &= ~B_MEM_DOWN;
X		}
X#endif
X		sprintf(s80,"%08lx %08lx %s",bmem->base,bmem->extent,
X			bmemf_text(bmem->flags));
X		XDrawString(display,window,gc, x,y + FASCENT,s80,strlen(s80));
X		y += fheight;
X	}
X
X}	/* end of draw_Bootinfo */
X
X#endif /* HAS_BOOTINFO */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of bootinfo.c */
SHAR_EOF
chmod 0644 x386mon/bootinfo.c ||
echo 'restore of x386mon/bootinfo.c failed'
Wc_c="`wc -c < 'x386mon/bootinfo.c'`"
test 7379 -eq "$Wc_c" ||
	echo 'x386mon/bootinfo.c: original size 7379, current size' "$Wc_c"
fi
# ============= x386mon/buttons.c ==============
if test -f 'x386mon/buttons.c' -a X"$1" != X"-c"; then
	echo 'x - skipping x386mon/buttons.c (File already exists)'
else
echo 'x - extracting x386mon/buttons.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'x386mon/buttons.c' &&
X/*+-------------------------------------------------------------------------
X	buttons.c - X386MON button and status message handler
X	wht at n4hgf.Mt-Park.GA.US
X
X  Defined functions:
X	disp_msg(pixel,msg)
X	draw_MyButton(num,pixel,init_struct)
X	invalidate_last_DispMsg()
X	place_MyButtons_all_off()
X	point_to_MyButton(x,y)
X	turn_off_MyButton(button_number)
X	turn_off_all_MyButtons()
X	turn_on_MyButton(button_number,pixel)
X
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:01-12-1991-04:35-wht at n4hgf-x1.00 (flush old edit notes) */
X
X#include "unixincs.h"
X#define WANT_MON_EXTERNS
X#include "x386mon.h"
X#include <X11/StringDefs.h>
X#define WANT_MyButton_PRIVATES
X#include "buttons.h"
X#include "Button.h"
X
X/*
X * the ordering of this struct is dependent on
X * assignment of BUTTON_... defines in button.h
X */
XMyButton MyButtons[] =
X{
X	{ "main",0,&colorCyan,   0},
X	{ "ps",  0,&colorYellow, 0},
X	{ "Ps",  0,&colorYellow, 0},
X	{ "quit",0,&colorRed,    0},
X};
X
X#define MyButtons_QUAN XtNumber(MyButtons)
X
Xint MyButtons_next_tlx;
Xint DispMsg_tlx;
X
X#if defined(__STDC__)
XWidget
Xcreate_button(
X	Widget parent,
X	Dimension x,
X	Dimension y,
X	char *label,
X	Pixel armedColor,
X	caddr_t callback,
X	caddr_t client_data,
X	Dimension *pWidth
X	);
X#endif
X
X/*+-------------------------------------------------------------------------
X	create_button(parent,x,y,label,armedColor,callback,client_data,pWidth)
X
XReturn widget id and width of widget
X--------------------------------------------------------------------------*/
XWidget
Xcreate_button(parent,x,y,label,armedColor,callback,client_data,pWidth)
XWidget parent;
XDimension x;
XDimension y;
Xchar *label;
XPixel armedColor;
Xcaddr_t callback;
Xcaddr_t client_data;
XDimension *pWidth;
X{
XArg args[64];
Xint argcount = 0;
XWidget w;
XDimension height;
X
X	XtSetArg(args[argcount],XtNx,x);
X	argcount++;
X	XtSetArg(args[argcount],XtNy,y);
X	argcount++;
X	XtSetArg(args[argcount],XwtNlabel,label);
X	argcount++;
X	XtSetArg(args[argcount],XwtNfont,currentMyFont->font_struct);
X	argcount++;
X	XtSetArg(args[argcount],XwtNlabelColor,colorBlack.pixel);
X	argcount++;
X	XtSetArg(args[argcount],XwtNarmedColor,armedColor);
X	argcount++;
X	XtSetArg(args[argcount],XwtNunarmedColor,colorSlate.pixel);
X	argcount++;
X
X	w = XwtCreateButton(parent,label,args,argcount);
X	XtAddCallback(w,XwtNactivateCallback,
X		(XtCallbackProc)callback,(caddr_t)client_data);
X
X	XtManageChild(w);
X	XwtButtonSize(w,pWidth,&height);
X	return(w);
X
X}	/* end of create_button */
X
X/*+-------------------------------------------------------------------------
X	turn_on_MyButton(button_number,pixel)
X--------------------------------------------------------------------------*/
Xvoid
Xturn_on_MyButton(button_number,pixel)
Xint button_number;
Xunsigned long pixel;
X{
XArg args[1];
Xint argcount = 0;
X
X	XtSetArg(args[argcount],XwtNunarmedColor,pixel);
X	argcount++;
X
X	XtSetValues(MyButtons[button_number].w,args,argcount);
X	MyButtons[button_number].state = 1;
X
X}	/* end of turn_on_MyButton */
X
X/*+-------------------------------------------------------------------------
X	turn_off_MyButton(button_number)
X--------------------------------------------------------------------------*/
Xvoid
Xturn_off_MyButton(button_number)
Xint button_number;
X{
X	turn_on_MyButton(button_number,colorSlate.pixel);
X	MyButtons[button_number].state = 0;
X
X}	/* end of turn_off_MyButton */
X
X/*+-------------------------------------------------------------------------
X	turn_off_all_MyButtons()
X--------------------------------------------------------------------------*/
Xvoid
Xturn_off_all_MyButtons()
X{
Xint ibutt;
X
X	for(ibutt = 0; ibutt < MyButtons_QUAN; ibutt++)
X	{
X		if(MyButtons[ibutt].state)
X			turn_off_MyButton(ibutt);
X	}
X
X}	/* end of turn_off_all_MyButtons */
X
X/*+-------------------------------------------------------------------------
X	_Button_callback(w,client_data,call_data)
X--------------------------------------------------------------------------*/
Xvoid
X_Button_callback(w,client_data,call_data)
XWidget	w;				/* widget id */
Xcaddr_t	client_data;	/* data from application */
Xcaddr_t	call_data;		/* data from widget class */
X{
XXwtButtonCallbackStruct *cs = (XwtButtonCallbackStruct *)call_data;
X
X	set_display_mode((int)client_data);
X
X}	/* end of _Button_callback */
X
X/*+-------------------------------------------------------------------------
X	place_MyButtons_all_off()
X--------------------------------------------------------------------------*/
Xvoid
Xplace_MyButtons_all_off()
X{
Xint ibutt;
XDimension width;
Xstatic char MyButtons_inited = 0;
X
X	if(MyButtons_inited)
X	{
X		turn_off_all_MyButtons();
X		return;
X	}
X
X	MyButtons_inited = 1;
X	MyButtons_next_tlx = MyButton_TLX;
X	for(ibutt = 0; ibutt < MyButtons_QUAN; ibutt++)
X	{
X		MyButtons[ibutt].w = create_button(DrawAreaW,
X			MyButtons_next_tlx,MyButton_TLY,
X			MyButtons[ibutt].label,
X			MyButtons[ibutt].armedColor->pixel,
X			(caddr_t)_Button_callback,
X			(caddr_t)ibutt,&width);
X		MyButtons_next_tlx += width + 2;
X	}
X
X	DispMsg_tlx = MyButtons_next_tlx + (FWIDTH * 2);
X
X}	/* end of place_MyButtons_all_off */
X
Xunsigned long last_DispMsg_pixel = -1;
Xchar last_DispMsg_msg[80] = {0x01,0x00};
X
X/*+-------------------------------------------------------------------------
X	disp_msg(pixel,msg)
X
XThis is put in here because the message area is on the second
X"line" of the window from the right of the buttons to the right hand
Xside of the window
X--------------------------------------------------------------------------*/
Xvoid
Xdisp_msg(pixel,msg)
Xunsigned long pixel;
Xchar *msg;
X{
Xregister int y = (FHEIGHT * 1);
X
X	if(!window)
X		return;
X	if((pixel == last_DispMsg_pixel) && !strcmp(msg,last_DispMsg_msg))
X		return;
X	XClearArea(display,window,
X		DispMsg_tlx,y,DrawAreaXYWH.width - DispMsg_tlx,FHEIGHT,0);
X	XSetForeground(display,gc,pixel);
X	XDrawString(display,window,gc,
X		DispMsg_tlx,y + FASCENT,msg,strlen(msg));
X	last_DispMsg_pixel = pixel;
X	strcpy(last_DispMsg_msg,msg);
X}	/* end of disp_msg */
X
X/*+-------------------------------------------------------------------------
X	invalidate_last_DispMsg()
X--------------------------------------------------------------------------*/
Xvoid
Xinvalidate_last_DispMsg()
X{
X	last_DispMsg_pixel = -1;
X	last_DispMsg_msg[0] = 0x01;
X	last_DispMsg_msg[1] = 0x00;
X}	/* end of invalidate_last_DispMsg */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of buttons.c */
SHAR_EOF
chmod 0644 x386mon/buttons.c ||
echo 'restore of x386mon/buttons.c failed'
Wc_c="`wc -c < 'x386mon/buttons.c'`"
test 6315 -eq "$Wc_c" ||
	echo 'x386mon/buttons.c: original size 6315, current size' "$Wc_c"
fi
# ============= x386mon/buttons.h ==============
if test -f 'x386mon/buttons.h' -a X"$1" != X"-c"; then
	echo 'x - skipping x386mon/buttons.h (File already exists)'
else
echo 'x - extracting x386mon/buttons.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'x386mon/buttons.h' &&
X
X/*+-------------------------------------------------------------------------
X	buttons.h
X	wht at n4hgf.Mt-Park.GA.US
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:01-12-1991-04:35-wht at n4hgf-x1.00 (flush old edit notes) */
X
X/*
X * the order of these defines are dependent on
X * the order of the MyButtons declaration in buttons.c
X */
X#define BUTTON_main	0
X#define BUTTON_ps	1
X#define BUTTON_Ps	2
X#define BUTTON_quit	3
X
X#if defined(WANT_MyButton_PRIVATES)
Xtypedef struct MyButtonStruct
X{
X	char *label;				/* Button label */
X	Widget w;					/* Button widget ID */
X	XColor *armedColor;			/* background color when button pushed */
X	char state;					/* on or off */
X} MyButton;
X#endif
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of buttons.h */
SHAR_EOF
chmod 0644 x386mon/buttons.h ||
echo 'restore of x386mon/buttons.h failed'
Wc_c="`wc -c < 'x386mon/buttons.h'`"
test 782 -eq "$Wc_c" ||
	echo 'x386mon/buttons.h: original size 782, current size' "$Wc_c"
fi
# ============= x386mon/config.h ==============
if test -f 'x386mon/config.h' -a X"$1" != X"-c"; then
	echo 'x - skipping x386mon/config.h (File already exists)'
else
echo 'x - extracting x386mon/config.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'x386mon/config.h' &&
X
X/*+-------------------------------------------------------------------------
X	config.h - X386MON configuration
X	wht at n4hgf.Mt-Park.GA.US
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:01-12-1991-04:36-wht-creation */
X
X#if !defined(M_UNIX)
X#include "in.this.release.you.have.some.work.to.do"
X/* assuming SCO ODT 1.0/UNIX 3.2.1 or later/MOTIF 1.0/X11R3 */
X#endif
X
X#define SVR32
X#define HAS_BOOTINFO
X#define HAS_FTIME
X
X/*
X * SCO UNIX 3.2.0 has unusual user struct process segment size values
X * (here we assume * 3.2.1 or later; non-SCO ignores this)
X */
X/* #define SCO_USIZE_BROKEN */	/* define this for 3.2.0 */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of config.h */
SHAR_EOF
chmod 0644 x386mon/config.h ||
echo 'restore of x386mon/config.h failed'
Wc_c="`wc -c < 'x386mon/config.h'`"
test 718 -eq "$Wc_c" ||
	echo 'x386mon/config.h: original size 718, current size' "$Wc_c"
fi
# ============= x386mon/disp_info.c ==============
if test -f 'x386mon/disp_info.c' -a X"$1" != X"-c"; then
	echo 'x - skipping x386mon/disp_info.c (File already exists)'
else
echo 'x - extracting x386mon/disp_info.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'x386mon/disp_info.c' &&
X/*+-------------------------------------------------------------------------
X	disp_info.c - X386MON display several types of fixed width fields
X	wht at n4hgf.Mt-Park.GA.US
X
X  Defined functions:
X	disp_info(x,y,label,flen,value)
X	disp_info_units_color(x,y,label,flen,units,value,pixel)
X	disp_info_text(x,y,pixel,textstr)
X	disp_info_units(x,y,label,flen,units,value)
X	disp_static(x,y,label,flen,value)
X	disp_static_text(x,y,pixel,textstr)
X	disp_static_units(x,y,label,flen,units,value)
X
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:01-12-1991-04:35-wht at n4hgf-x1.00 (flush old edit notes) */
X
X#include "unixincs.h"
X#include "x386mon.h"
X#include "utoa.h"
X#include "disp_info.h"
X
X/*+-------------------------------------------------------------------------
X	disp_info(x,y,label,flen,value)
X--------------------------------------------------------------------------*/
Xvoid
Xdisp_info(x,y,label,flen,value)
Xregister x,y;
Xchar *label;
Xint flen;
Xlong value;
X{
Xregister fwidth = FWIDTH;
Xint llen = strlen(label);
Xchar s32[32];
X
X	if(redrawing_entire_DrawArea)
X	{
X		XSetForeground(display,gc,colorBlue.pixel);
X		XDrawString(display,window,gc,x,y + FASCENT,label,llen);
X	}
X	x += (llen * fwidth);
X	ultoda(s32,flen,value);
X	llen = strlen(s32);
X	XClearArea(display,window,x,y,fwidth * llen,FHEIGHT,0);
X	XSetForeground(display,gc,colorGreen.pixel);
X	XDrawString(display,window,gc,x,y + FASCENT,s32,llen);
X
X}	/* end of disp_info */
X
X/*+-------------------------------------------------------------------------
X	disp_static(x,y,label,flen,value)
X--------------------------------------------------------------------------*/
Xvoid
Xdisp_static(x,y,label,flen,value)
Xregister x,y;
Xchar *label;
Xint flen;
Xlong value;
X{
Xregister fwidth;
Xint llen;
Xchar s32[32];
X
X	if(redrawing_entire_DrawArea)
X	{
X		fwidth = FWIDTH;
X		llen = strlen(label);
X
X		XSetForeground(display,gc,colorBlue.pixel);
X		XDrawString(display,window,gc,x,y + FASCENT,label,llen);
X		x += (llen * fwidth);
X		ultoda(s32,flen,value);
X		XDrawString(display,window,gc,x,y + FASCENT,s32,strlen(s32));
X	}
X
X}	/* end of disp_static */
X
X/*+-------------------------------------------------------------------------
X	disp_info_units_color(x,y,label,flen,units,value,pixel)
X--------------------------------------------------------------------------*/
Xvoid
Xdisp_info_units_color(x,y,label,flen,units,value,pixel)
Xregister x,y;
Xchar *label;
Xint flen;
Xchar *units;
Xlong value;
XPixel pixel;
X{
Xregister fwidth = FWIDTH;
Xregister itmp;
Xint llen = strlen(label);
Xchar s32[32];
X
X	if(redrawing_entire_DrawArea)
X	{
X		XSetForeground(display,gc,colorBlue.pixel);
X		XDrawString(display,window,gc,x,y + FASCENT,label,llen);
X	}
X	x += (llen * fwidth);
X	ultoda(s32,flen,value);
X	llen = strlen(s32);
X	XClearArea(display,window,x,y,itmp = fwidth * llen,FHEIGHT,0);
X	XSetForeground(display,gc,pixel);
X	XDrawString(display,window,gc,x,y + FASCENT,s32,llen);
X	if(redrawing_entire_DrawArea)
X		XDrawString(display,window,gc,x + itmp,y + FASCENT,units,strlen(units));
X
X}	/* end of disp_info_units_color */
X
X/*+-------------------------------------------------------------------------
X	disp_info_units(x,y,label,flen,units,value)
X--------------------------------------------------------------------------*/
Xvoid
Xdisp_info_units(x,y,label,flen,units,value)
Xregister x,y;
Xchar *label;
Xint flen;
Xchar *units;
Xlong value;
X{
X	disp_info_units_color(x,y,label,flen,units,value,colorGreen.pixel);
X}	/* end of disp_info_units */
X
X/*+-------------------------------------------------------------------------
X	disp_static_units(x,y,label,flen,units,value)
X--------------------------------------------------------------------------*/
Xvoid
Xdisp_static_units(x,y,label,flen,units,value)
Xregister x,y;
Xchar *label;
Xint flen;
Xchar *units;
Xlong value;
X{
Xregister fwidth;
Xregister len;
Xchar s32[32];
X
X	if(redrawing_entire_DrawArea)
X	{
X		fwidth = FWIDTH;
X		len = strlen(label);
X		XSetForeground(display,gc,colorBlue.pixel);
X		XDrawString(display,window,gc,x,y + FASCENT,label,len);
X		x += (len * fwidth);
X		ultoda(s32,flen,value);
X		XDrawString(display,window,gc,x,y + FASCENT,s32,strlen(s32));
X		len = strlen(s32);
X		x += (len * fwidth);
X		XDrawString(display,window,gc,x,y + FASCENT,units,strlen(units));
X	}
X
X}	/* end of disp_static_units */
X
X/*+-------------------------------------------------------------------------
X	disp_info_text(x,y,pixel,textstr)
X
Xreturns length of string
X--------------------------------------------------------------------------*/
Xint
Xdisp_info_text(x,y,pixel,textstr)
Xint x;
Xint y;
Xunsigned long pixel;
Xchar *textstr;
X{
Xregister len = strlen(textstr);
X
X	XClearArea(display,window,x,y,FWIDTH * len,FHEIGHT,0);
X	XSetForeground(display,gc,pixel);
X	XDrawString(display,window,gc,x,y + FASCENT,textstr,len);
X	return(len * FWIDTH);
X}	/* end of disp_info_text */
X
X/*+-------------------------------------------------------------------------
X	disp_static_text(x,y,pixel,textstr)
X--------------------------------------------------------------------------*/
Xvoid
Xdisp_static_text(x,y,textstr)
Xint x;
Xint y;
Xchar *textstr;
X{
X	XSetForeground(display,gc,colorBlue.pixel);
X	XDrawString(display,window,gc,x,y + FASCENT,textstr,strlen(textstr));
X}	/* end of disp_static_text */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of disp_static.c */
SHAR_EOF
chmod 0644 x386mon/disp_info.c ||
echo 'restore of x386mon/disp_info.c failed'
Wc_c="`wc -c < 'x386mon/disp_info.c'`"
test 5281 -eq "$Wc_c" ||
	echo 'x386mon/disp_info.c: original size 5281, current size' "$Wc_c"
fi
true || echo 'restore of x386mon/disp_info.h failed'
echo End of part 2, continue with part 3
exit 0
 
-----------------------------------------------------------------------
Warren Tucker, TuckerWare   gatech!n4hgf!wht or wht at n4hgf.Mt-Park.GA.US
Many [Nobel physics] prizes  have been given  to people for  telling us
the universe is not as simple as we thought it was. -Stephen Hawking in
A Brief History of Time     In computing, there are no such prizes. -me



More information about the Alt.sources mailing list