Whitespace
This commit is contained in:
parent
2458539dc7
commit
a6e2ded980
@ -1,7 +1,7 @@
|
|||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*
|
*
|
||||||
* MemStripChart Widget
|
* MemStripChart Widget
|
||||||
* from StripChart Widget derived
|
* from StripChart Widget derived
|
||||||
*
|
*
|
||||||
* Author: Hans-Helmut B"uhmann 20. Jan. 1996
|
* Author: Hans-Helmut B"uhmann 20. Jan. 1996
|
||||||
*
|
*
|
||||||
@ -165,10 +165,10 @@ CreateGC(MemStripChartWidget w, unsigned int which)
|
|||||||
static void
|
static void
|
||||||
DestroyGC(MemStripChartWidget w, unsigned int which)
|
DestroyGC(MemStripChartWidget w, unsigned int which)
|
||||||
{
|
{
|
||||||
if (which & FOREGROUND)
|
if (which & FOREGROUND)
|
||||||
XtReleaseGC((Widget) w, w->mem_strip_chart.fgGC);
|
XtReleaseGC((Widget) w, w->mem_strip_chart.fgGC);
|
||||||
|
|
||||||
if (which & HIGHLIGHT)
|
if (which & HIGHLIGHT)
|
||||||
XtReleaseGC((Widget) w, w->mem_strip_chart.hiGC);
|
XtReleaseGC((Widget) w, w->mem_strip_chart.hiGC);
|
||||||
|
|
||||||
if (which & CODE) {
|
if (which & CODE) {
|
||||||
@ -229,7 +229,7 @@ DrawMemStrip(MemStripChartWidget w, unsigned int x)
|
|||||||
|
|
||||||
if (w->mem_strip_chart.valuedata[x].buffer != 0.0) {
|
if (w->mem_strip_chart.valuedata[x].buffer != 0.0) {
|
||||||
top = (int) (w->core.height
|
top = (int) (w->core.height
|
||||||
- (int)(w->core.height * (1.0 - w->mem_strip_chart.valuedata[x].free))
|
- (int)(w->core.height * (1.0 - w->mem_strip_chart.valuedata[x].free))
|
||||||
/ w->mem_strip_chart.scale);
|
/ w->mem_strip_chart.scale);
|
||||||
XFillRectangle(XtDisplay(w), XtWindow(w), w->mem_strip_chart.bufferGC,
|
XFillRectangle(XtDisplay(w), XtWindow(w), w->mem_strip_chart.bufferGC,
|
||||||
x, top, (unsigned int) 1, bottom - top);
|
x, top, (unsigned int) 1, bottom - top);
|
||||||
@ -246,7 +246,7 @@ DrawMemStrip(MemStripChartWidget w, unsigned int x)
|
|||||||
}
|
}
|
||||||
if (w->mem_strip_chart.valuedata[x].swap != 0.0) {
|
if (w->mem_strip_chart.valuedata[x].swap != 0.0) {
|
||||||
top = (int) (w->core.height
|
top = (int) (w->core.height
|
||||||
- (int)(w->core.height * (1.0 + w->mem_strip_chart.valuedata[x].swap))
|
- (int)(w->core.height * (1.0 + w->mem_strip_chart.valuedata[x].swap))
|
||||||
/ w->mem_strip_chart.scale);
|
/ w->mem_strip_chart.scale);
|
||||||
XFillRectangle(XtDisplay(w), XtWindow(w), w->mem_strip_chart.swapGC,
|
XFillRectangle(XtDisplay(w), XtWindow(w), w->mem_strip_chart.swapGC,
|
||||||
x, top, (unsigned int) 1, bottom - top);
|
x, top, (unsigned int) 1, bottom - top);
|
||||||
@ -261,7 +261,7 @@ static void Initialize (Widget greq, Widget gnew, ArgList args, Cardinal *num_ar
|
|||||||
if (w->mem_strip_chart.update > 0)
|
if (w->mem_strip_chart.update > 0)
|
||||||
w->mem_strip_chart.interval_id = XtAppAddTimeOut(
|
w->mem_strip_chart.interval_id = XtAppAddTimeOut(
|
||||||
XtWidgetToApplicationContext(gnew),
|
XtWidgetToApplicationContext(gnew),
|
||||||
w->mem_strip_chart.update * MS_PER_SEC,
|
w->mem_strip_chart.update * MS_PER_SEC,
|
||||||
draw_it, (XtPointer) gnew);
|
draw_it, (XtPointer) gnew);
|
||||||
CreateGC(w, (unsigned int) ALL_GCS);
|
CreateGC(w, (unsigned int) ALL_GCS);
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ static void Initialize (Widget greq, Widget gnew, ArgList args, Cardinal *num_ar
|
|||||||
w->mem_strip_chart.points = NULL;
|
w->mem_strip_chart.points = NULL;
|
||||||
SetPoints(w);
|
SetPoints(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Destroy (Widget gw)
|
static void Destroy (Widget gw)
|
||||||
{
|
{
|
||||||
MemStripChartWidget w = (MemStripChartWidget)gw;
|
MemStripChartWidget w = (MemStripChartWidget)gw;
|
||||||
@ -284,7 +284,7 @@ static void Destroy (Widget gw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NOTE: This function really needs to recieve graphics exposure
|
* NOTE: This function really needs to recieve graphics exposure
|
||||||
* events, but since this is not easily supported until R4 I am
|
* events, but since this is not easily supported until R4 I am
|
||||||
* going to hold off until then.
|
* going to hold off until then.
|
||||||
*/
|
*/
|
||||||
@ -301,13 +301,13 @@ static void Redisplay(Widget w, XEvent *event, Region region)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
static void
|
static void
|
||||||
draw_it(XtPointer client_data, XtIntervalId *id)
|
draw_it(XtPointer client_data, XtIntervalId *id)
|
||||||
{
|
{
|
||||||
MemStripChartWidget w = (MemStripChartWidget)client_data;
|
MemStripChartWidget w = (MemStripChartWidget)client_data;
|
||||||
MemStripChartCallbackData value;
|
MemStripChartCallbackData value;
|
||||||
double usedmem;
|
double usedmem;
|
||||||
|
|
||||||
if (w->mem_strip_chart.update > 0)
|
if (w->mem_strip_chart.update > 0)
|
||||||
w->mem_strip_chart.interval_id =
|
w->mem_strip_chart.interval_id =
|
||||||
XtAppAddTimeOut(XtWidgetToApplicationContext( (Widget) w),
|
XtAppAddTimeOut(XtWidgetToApplicationContext( (Widget) w),
|
||||||
@ -323,15 +323,15 @@ draw_it(XtPointer client_data, XtIntervalId *id)
|
|||||||
|
|
||||||
XtCallCallbacks( (Widget)w, XtNgetValue, (XtPointer)&value );
|
XtCallCallbacks( (Widget)w, XtNgetValue, (XtPointer)&value );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Keep w->mem_strip_chart.max_value up to date, and if this data
|
* Keep w->mem_strip_chart.max_value up to date, and if this data
|
||||||
* point is off the graph, change the scale to make it fit.
|
* point is off the graph, change the scale to make it fit.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
usedmem = 1.0 + value.swap;
|
usedmem = 1.0 + value.swap;
|
||||||
if (usedmem > w->mem_strip_chart.max_value) {
|
if (usedmem > w->mem_strip_chart.max_value) {
|
||||||
w->mem_strip_chart.max_value = usedmem;
|
w->mem_strip_chart.max_value = usedmem;
|
||||||
if (XtIsRealized((Widget)w) &&
|
if (XtIsRealized((Widget)w) &&
|
||||||
w->mem_strip_chart.max_value > w->mem_strip_chart.scale) {
|
w->mem_strip_chart.max_value > w->mem_strip_chart.scale) {
|
||||||
XClearWindow( XtDisplay (w), XtWindow (w));
|
XClearWindow( XtDisplay (w), XtWindow (w));
|
||||||
w->mem_strip_chart.interval = repaint_window(w, 0, (int) w->core.width);
|
w->mem_strip_chart.interval = repaint_window(w, 0, (int) w->core.width);
|
||||||
@ -343,7 +343,7 @@ draw_it(XtPointer client_data, XtIntervalId *id)
|
|||||||
|
|
||||||
/* XXX DrawMemStrip(w, w->mem_strip_chart.interval, value); */
|
/* XXX DrawMemStrip(w, w->mem_strip_chart.interval, value); */
|
||||||
DrawMemStrip(w, w->mem_strip_chart.interval);
|
DrawMemStrip(w, w->mem_strip_chart.interval);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fill in the graph lines we just painted over.
|
* Fill in the graph lines we just painted over.
|
||||||
*/
|
*/
|
||||||
@ -370,7 +370,7 @@ draw_it(XtPointer client_data, XtIntervalId *id)
|
|||||||
* largest data point.
|
* largest data point.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
repaint_window(MemStripChartWidget w, int left, int width)
|
repaint_window(MemStripChartWidget w, int left, int width)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
@ -393,7 +393,7 @@ repaint_window(MemStripChartWidget w, int left, int width)
|
|||||||
|
|
||||||
SetPoints(w);
|
SetPoints(w);
|
||||||
|
|
||||||
if (XtIsRealized ((Widget) w))
|
if (XtIsRealized ((Widget) w))
|
||||||
XClearWindow (XtDisplay (w), XtWindow (w));
|
XClearWindow (XtDisplay (w), XtWindow (w));
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -445,20 +445,20 @@ MoveChart(MemStripChartWidget w, Boolean blit)
|
|||||||
if (j < 0) j = 0;
|
if (j < 0) j = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) memmove((char *)(w->mem_strip_chart.valuedata),
|
(void) memmove((char *)(w->mem_strip_chart.valuedata),
|
||||||
(char *)(w->mem_strip_chart.valuedata + next - j),
|
(char *)(w->mem_strip_chart.valuedata + next - j),
|
||||||
j * sizeof(MemStripChartCallbackData));
|
j * sizeof(MemStripChartCallbackData));
|
||||||
next = w->mem_strip_chart.interval = j;
|
next = w->mem_strip_chart.interval = j;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Since we just lost some data, recompute the
|
* Since we just lost some data, recompute the
|
||||||
* w->mem_strip_chart.max_value.
|
* w->mem_strip_chart.max_value.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
old_max = w->mem_strip_chart.max_value;
|
old_max = w->mem_strip_chart.max_value;
|
||||||
w->mem_strip_chart.max_value = 0.0;
|
w->mem_strip_chart.max_value = 0.0;
|
||||||
for (i = 0; i < next; i++) {
|
for (i = 0; i < next; i++) {
|
||||||
if (w->mem_strip_chart.valuedata[i].swap + 1.0 > w->mem_strip_chart.max_value)
|
if (w->mem_strip_chart.valuedata[i].swap + 1.0 > w->mem_strip_chart.max_value)
|
||||||
w->mem_strip_chart.max_value = w->mem_strip_chart.valuedata[i].swap + 1.0;
|
w->mem_strip_chart.max_value = w->mem_strip_chart.valuedata[i].swap + 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -475,8 +475,8 @@ MoveChart(MemStripChartWidget w, Boolean blit)
|
|||||||
(unsigned int) j, (unsigned int) w->core.height,
|
(unsigned int) j, (unsigned int) w->core.height,
|
||||||
0, 0);
|
0, 0);
|
||||||
|
|
||||||
XClearArea(XtDisplay((Widget)w), XtWindow((Widget)w),
|
XClearArea(XtDisplay((Widget)w), XtWindow((Widget)w),
|
||||||
(int) j, 0,
|
(int) j, 0,
|
||||||
(unsigned int) w->core.width - j, (unsigned int)w->core.height,
|
(unsigned int) w->core.width - j, (unsigned int)w->core.height,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
@ -510,12 +510,12 @@ static Boolean SetValues (Widget current, Widget request, Widget new, ArgList ar
|
|||||||
|
|
||||||
if ( w->mem_strip_chart.min_scale > (int) ((w->mem_strip_chart.max_value) + 1) )
|
if ( w->mem_strip_chart.min_scale > (int) ((w->mem_strip_chart.max_value) + 1) )
|
||||||
ret_val = TRUE;
|
ret_val = TRUE;
|
||||||
|
|
||||||
if ( w->mem_strip_chart.fgpixel != old->mem_strip_chart.fgpixel ) {
|
if ( w->mem_strip_chart.fgpixel != old->mem_strip_chart.fgpixel ) {
|
||||||
new_gc |= FOREGROUND;
|
new_gc |= FOREGROUND;
|
||||||
ret_val = True;
|
ret_val = True;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( w->mem_strip_chart.hipixel != old->mem_strip_chart.hipixel ) {
|
if ( w->mem_strip_chart.hipixel != old->mem_strip_chart.hipixel ) {
|
||||||
new_gc |= HIGHLIGHT;
|
new_gc |= HIGHLIGHT;
|
||||||
ret_val = True;
|
ret_val = True;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user