/* $XConsortium: StripChart.c,v 1.25 94/04/17 20:12:56 kaleb Exp $ */
/***********************************************************
Copyright (c) 1987, 1988, 1994 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#include <stdio.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
/* Private Data */
};
static int repaint_window();
{ /* core fields */
/* class_name */ "StripChart",
/* size */ sizeof(StripChartRec),
/* class_initialize */ XawInitializeWidgetSet,
/* class_part_initialize */ NULL,
/* class_inited */ FALSE,
/* initialize */ Initialize,
/* initialize_hook */ NULL,
/* realize */ XtInheritRealize,
/* actions */ NULL,
/* num_actions */ 0,
/* resources */ resources,
/* xrm_class */ NULLQUARK,
/* compress_motion */ TRUE,
/* compress_exposure */ XtExposeCompressMultiple |
/* compress_enterleave */ TRUE,
/* visible_interest */ FALSE,
/* destroy */ Destroy,
/* resize */ SetPoints,
/* expose */ Redisplay,
/* set_values */ SetValues,
/* set_values_hook */ NULL,
/* set_values_almost */ NULL,
/* get_values_hook */ NULL,
/* accept_focus */ NULL,
/* version */ XtVersion,
/* callback_private */ NULL,
/* tm_table */ NULL,
/* query_geometry */ XtInheritQueryGeometry,
/* display_accelerator */ XtInheritDisplayAccelerator,
/* extension */ NULL
},
{ /* Simple class fields */
/* change_sensitive */ XtInheritChangeSensitive
}
};
/****************************************************************
*
* Private Procedures
*
****************************************************************/
static void draw_it();
/* Function Name: CreateGC
* Description: Creates the GC's
* Arguments: w - the strip chart widget.
* which - which GC's to create.
* Returns: none
*/
static void
unsigned int which;
{
if (which & FOREGROUND) {
}
}
}
/* Function Name: DestroyGC
* Description: Destroys the GC's
* Arguments: w - the strip chart widget.
* which - which GC's to destroy.
* Returns: none
*/
static void
unsigned int which;
{
if (which & FOREGROUND)
}
/* ARGSUSED */
{
if (w->strip_chart.update > 0)
w->strip_chart.interval = 0;
SetPoints(w);
}
{
if (w->strip_chart.update > 0)
if (w->strip_chart.points)
}
/*
* NOTE: This function really needs to recieve graphics exposure
* events, but since this is not easily supported until R4 I am
* going to hold off until then.
*/
/* ARGSUSED */
Widget w;
{
else
}
/* ARGSUSED */
static void
{
double value;
if (w->strip_chart.update > 0)
w->strip_chart.interval_id =
/* Get the value, stash the point and draw corresponding line. */
return;
/*
* Keep w->strip_chart.max_value up to date, and if this data
* point is off the graph, change the scale to make it fit.
*/
if (XtIsRealized((Widget)w) &&
}
}
if (XtIsRealized((Widget)w)) {
w->strip_chart.interval, y,
/*
* Fill in the graph lines we just painted over.
*/
}
}
} /* draw_it */
/* Blts data according to current size, then redraws the stripChart window.
* Next represents the number of valid points in data. Returns the (possibly)
* adjusted value of next. If next is 0, this routine draws an empty window
* (scale - 1 lines for graph). If next is less than the current window width,
* the returned value is identical to the initial value of next and data is
* unchanged. Otherwise keeps half a window's worth of data. If data is
* changed, then w->strip_chart.max_value is updated to reflect the
* largest data point.
*/
static int
{
int i, j;
int scalewidth = 0;
/* Compute the minimum scale required to graph the data, but don't go
lower than min_scale. */
left = 0;
SetPoints(w);
if (XtIsRealized ((Widget) w))
}
if (XtIsRealized((Widget)w)) {
/* Draw data point lines. */
w->strip_chart.scale);
i, y, (unsigned int) 1,
}
/* Draw graph reference lines */
}
}
return(next);
}
/* Function Name: MoveChart
* Description: moves the chart over when it would run off the end.
* Arguments: w - the load widget.
* Returns: none.
*/
static void
{
double old_max;
int left, i, j;
if (!XtIsRealized((Widget) w)) return;
else {
if (j < 0) j = 0;
}
j * sizeof(double));
/*
* Since we just lost some data, recompute the
* w->strip_chart.max_value.
*/
for (i = 0; i < next; i++) {
}
if (!blit) return; /* we are done... */
return;
}
0, 0);
(int) j, 0,
FALSE);
/* Draw graph reference lines */
left = j;
}
return;
}
/* ARGSUSED */
{
if (w->strip_chart.update > 0)
w->strip_chart.interval_id =
}
new_gc |= FOREGROUND;
}
}
return( ret_val );
}
/* Function Name: SetPoints
* Description: Sets up the polypoint that will be used to draw in
* the graph lines.
* Arguments: w - the StripChart widget.
* Returns: none.
*/
static void
{
int i;
return;
}
/* Draw graph reference lines into clip mask */
points[i - 1].x = 0;
}
}