GraphDisplay.mesa, Copyright © 1985 by Xerox Corporation. All rights reserved.
Last edited:
Sweetsun Chen, October 16, 1985 8:19:44 pm PDT
DIRECTORY
Graph USING [Entity, NullRect, Text, ValueList, XY, Viewer],
GraphPrivate USING [GraphHandle, GraphProc, PaintAction],
GraphUtil USING [HandleNotNil, ViewerNotNil],
Imager USING [Rectangle],
ViewerOps USING [PaintViewer];
GraphDisplay: CEDAR PROGRAM
IMPORTS GraphUtil, ViewerOps
EXPORTS GraphPrivate = {
OPEN Graph, GraphPrivate, GraphUtil;
This module deals with screen display (erase or paint).
All public proc's in the module call Print with proper PaintInfo, which in turn calls Draw in GraphDraw.
handle, handle.chart, and handle.chart.viewer should not be nil when any of these public paint procs are called.
PaintAll: PUBLIC PROC [handle: GraphHandle ← NIL, clear, clientOnly: BOOLTRUE] = {
IF HandleNotNil[handle] THEN { OPEN handle;
paintInfo.item ← all;
paintInfo.action ← paint;
paintInfo.clear ← clear;
IF clientOnly THEN PaintClient[handle]
ELSE IF ViewerNotNil[chart.viewer] THEN ViewerOps.PaintViewer[
viewer: chart.viewer,
hint: all,
clearClient: clear,
whatChanged: handle.paintInfo
];
chart.dirty ← FALSE;
IF clear THEN zoomPt1 ← zoomPt2 ← [];
};
}; -- PaintAll
PaintRect: PUBLIC PROC [handle: GraphHandle ← NIL, action: PaintAction ← paint, clear: BOOLTRUE, rect: Imager.Rectangle ← NullRect] = {
IF HandleNotNil[handle] THEN { OPEN handle;
paintInfo.item ← rectangle;
paintInfo.action ← action;
paintInfo.clear ← clear;
paintInfo.rect ← rect;
PaintClient[handle];
};
}; -- PaintRect
PaintText: PUBLIC PROC [handle: GraphHandle ← NIL, action: PaintAction ← paint, text: Text ← NIL] = {
IF HandleNotNil[handle] AND text # NIL THEN { OPEN handle;
paintInfo.item ← graphText;
paintInfo.action ← action;
paintInfo.text ← text;
paintInfo.clear ← FALSE;
PaintClient[handle];
};
}; -- PaintText
PaintEntity: PUBLIC PROC [handle: GraphHandle ← NIL, action: PaintAction ← paint, entity: Entity ← NIL] = {
IF HandleNotNil[handle] AND entity # NIL THEN { OPEN handle;
paintInfo.item ← graphEntity;
paintInfo.action ← action;
paintInfo.entity ← entity;
paintInfo.clear ← FALSE;
PaintClient[handle];
};
}; -- PaintEntity
PaintTails: PUBLIC PROC [handle: GraphHandle ← NIL, action: PaintAction ← paint, v1, v2: ValueList ← NIL, x1, x2: REAL ← 0.0] = {
IF HandleNotNil[handle] AND v1 # NIL AND v2 # NIL THEN { OPEN handle;
paintInfo.item ← tails;
paintInfo.action ← action;
paintInfo.clear ← FALSE;
paintInfo.v1 ← v1;
paintInfo.v2 ← v2;
paintInfo.x1 ← x1;
paintInfo.x2 ← x2;
PaintClient[handle];
};
}; -- PaintTails
PaintTarget: PUBLIC PROC [handle: GraphHandle ← NIL, action: PaintAction ← paint, choice: XY ← x] = {
IF HandleNotNil[handle] THEN { OPEN handle;
paintInfo.item ← target;
paintInfo.action ← action;
paintInfo.clear ← FALSE;
paintInfo.xy ← choice;
PaintClient[handle];
};
}; -- PaintTarget
PaintGrids: PUBLIC PROC [handle: GraphHandle ← NIL, action: PaintAction ← paint, choice: XY ← x] = {
IF HandleNotNil[handle] THEN { OPEN handle;
paintInfo.item ← grid;
paintInfo.action ← action;
paintInfo.clear ← FALSE;
paintInfo.xy ← choice;
PaintClient[handle];
};
}; -- PaintGrids
PaintClient: PUBLIC GraphProc = { OPEN handle;
viewer: Viewer ← handle.chart.viewer;
IF ViewerNotNil[viewer] THEN ViewerOps.PaintViewer[
viewer: viewer,
hint: client,
clearClient: handle.paintInfo.clear,
whatChanged: handle.paintInfo
];
IF handle.paintInfo.action = erase THEN handle.chart.dirty ← TRUE;
}; -- PaintClient
}.
LOG.
SChen, created at October 9, 1985 6:10:49 pm PDT