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 ‚GraphDisplay.mesa, Copyright c 1985 by Xerox Corporation. All rights reserved. Last edited: Sweetsun Chen, November 15, 1985 5:52:42 pm PST 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. refresh the axes and anything inside the axes. Plot legends of entities (starting from start). If start is nil, clean the place after the last legend entry. If onlyOne, only the legend for the starting entity is plotted. Κ8˜JšœΟmœ1™O™ Icode™/—J˜šΟk ˜ JšœžœJžœ ˜aJ˜ Jšœ žœ0˜?Jšœžœ ˜Jšœ žœ˜J˜—šœžœž˜Jšžœ˜Jšžœ˜—J˜Jšžœ˜J™7J™hJ™pJ˜š Οnœžœžœ*žœžœ˜Ošžœžœžœ˜+Jšœ˜Jšœ˜Jšœ˜Jšžœ žœ˜&šžœžœžœ˜>Jšœ˜Jšœ ˜ Jšœ˜Jšœ˜J˜—Jšœžœ˜Jšžœžœ˜%J˜—JšœΟc ˜—J˜š Ÿœžœžœžœžœ˜JJ™.šžœžœ˜Jšœ"˜"Jšœ ˜ Jšœ˜Jšœ˜J˜—Jšœ ˜—J˜š Ÿ œžœžœ;žœžœ(˜„šžœžœžœ˜+J˜Jšœ˜Jšœ˜Jšœ˜J˜J˜—Jšœ  ˜—J˜šŸ œžœžœAžœ˜_š žœžœžœžœžœ˜:Jšœ˜Jšœ˜Jšœ˜Jšœžœ˜J˜J˜—Jšœ  ˜—J˜š Ÿ œžœžœEžœžœžœ˜~š žœžœ žœžœžœ˜