<> <> <> DIRECTORY Graph USING [Entity, GraphHandle, GraphProc, NullRect, PaintAction, Text, ValueList, XY, Viewer], GraphPrivate, GraphUtil USING [HandleNotNil, ReverseValueList, ViewerNotNil], Imager USING [Rectangle], ViewerOps USING [PaintViewer]; GraphDisplay: CEDAR PROGRAM IMPORTS GraphUtil, ViewerOps EXPORTS GraphPrivate = { OPEN Graph, GraphUtil; <> <> <> PaintAll: PUBLIC PROC [handle: GraphHandle, clear, clientOnly: BOOL _ TRUE] = { 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 PaintAllCurves: PUBLIC PROC [handle: GraphHandle, clear: BOOL _ FALSE] = { <> IF HandleNotNil[handle] THEN { handle.paintInfo.item _ allCurves; handle.paintInfo.action _ paint; handle.paintInfo.clear _ clear; PaintClient[handle]; }; }; -- PaintAllCurves PaintRect: PUBLIC PROC [handle: GraphHandle, action: PaintAction _ paint, clear: BOOL _ TRUE, 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, 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, action: PaintAction _ paint, entity: Entity _ NIL, withLegend: BOOL _ TRUE] = { IF HandleNotNil[handle] AND entity # NIL THEN { OPEN handle; paintInfo.item _ graphEntity; paintInfo.action _ action; paintInfo.entity _ entity; paintInfo.clear _ FALSE; PaintClient[handle]; IF withLegend THEN PaintLegend[handle, action, entity, TRUE]; }; }; -- PaintEntity PaintTails: PUBLIC PROC [handle: GraphHandle, action: PaintAction _ paint, v1, v2: ValueList _ NIL, x1, x2: REAL _ 0.0, reversed: BOOL _ TRUE] = { IF HandleNotNil[handle] AND v1 # NIL AND v2 # NIL THEN { OPEN handle; paintInfo.item _ tails; paintInfo.action _ action; paintInfo.clear _ FALSE; IF reversed THEN [paintInfo.v1, ] _ GraphUtil.ReverseValueList[v1, FALSE] ELSE paintInfo.v1 _ v1; IF reversed THEN [paintInfo.v2, ] _ GraphUtil.ReverseValueList[v2, FALSE] ELSE paintInfo.v2 _ v2; paintInfo.x1 _ x1; paintInfo.x2 _ x2; PaintClient[handle]; }; }; -- PaintTails PaintTarget: PUBLIC PROC [handle: GraphHandle, 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, 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 PaintLegend: PUBLIC PROC [handle: GraphHandle, action: PaintAction _ paint, start: Entity, onlyOne: BOOL _ FALSE] = { <> <> <> IF HandleNotNil[handle] THEN { OPEN handle; paintInfo.item _ legend; paintInfo.action _ action; paintInfo.clear _ FALSE; paintInfo.entity _ start; paintInfo.onlyOne _ onlyOne; PaintClient[handle]; }; }; -- PaintLegend PaintClient: PUBLIC GraphProc = { OPEN handle; viewer: Viewer _ handle.chart.viewer; IF ViewerNotNil[viewer] THEN ViewerOps.PaintViewer[ viewer: viewer, hint: client, clearClient: FALSE, 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