<> <> <> DIRECTORY Graph USING [Entity, EntityList, GraphHandle, PaintAction, PaintInfo, PaintInfoRec, Text, ValueList, XY, Viewer], GraphPrivate, GraphUtil USING [HandleNotNil, ReverseEntityList, 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, updateDivBds, clientOnly: BOOL] = { IF HandleNotNil[handle] THEN { OPEN handle; info: PaintInfo _ NEW[all PaintInfoRec _ [data: all[clear: clear, updateDivBds: updateDivBds]]]; IF ViewerNotNil[chart.viewer] THEN ViewerOps.PaintViewer[ viewer: chart.viewer, hint: IF clientOnly THEN client ELSE all, clearClient: clear, whatChanged: info ]; IF clear THEN { chart.dirty _ FALSE; zoomPt1 _ zoomPt2 _ []; }; }; }; -- PaintAll PaintAllCurves: PUBLIC PROC [handle: GraphHandle, clear: BOOL] = { <> IF HandleNotNil[handle] THEN { info: PaintInfo _ NEW[allCurves PaintInfoRec _ [action: paint, output: screen, data: allCurves[clear: clear]]]; PaintClient[handle, info]; }; }; -- PaintAllCurves PaintRect: PUBLIC PROC [handle: GraphHandle, rect: Imager.Rectangle, clear, updateDivBds: BOOL, action: PaintAction _ paint] = { IF HandleNotNil[handle] THEN { OPEN handle; info: PaintInfo _ NEW[rectangle PaintInfoRec _ [action: action, output: screen, data: rectangle[clear: clear, updateDivBds: updateDivBds, rect: rect]]]; PaintClient[handle, info]; }; }; -- PaintRect PaintText: PUBLIC PROC [handle: GraphHandle, text: Text, action: PaintAction _ paint] = { IF HandleNotNil[handle] AND text # NIL THEN { OPEN handle; info: PaintInfo _ NEW[graphText PaintInfoRec _ [action: action, output: screen, data: graphText[text: text]]]; PaintClient[handle, info]; }; }; -- PaintText PaintEntity: PUBLIC PROC [handle: GraphHandle, entity: Entity, withLegend: BOOL, action: PaintAction _ paint] = { IF HandleNotNil[handle] AND entity # NIL THEN { OPEN handle; info: PaintInfo _ NEW[graphEntity PaintInfoRec _ [action: action, output: screen, data: graphEntity[entity: entity]]]; PaintClient[handle, info]; IF withLegend THEN PaintLegend[handle, entity, action, TRUE]; }; }; -- PaintEntity PaintLegend: PUBLIC PROC [handle: GraphHandle, start: Entity, action: PaintAction _ paint, onlyOne: BOOL] = { <> <> <> IF HandleNotNil[handle] THEN { OPEN handle; info: PaintInfo _ NEW[legend PaintInfoRec _ [action: action, output: screen, data: legend[entity: start, onlyOne: onlyOne]]]; PaintClient[handle, info]; }; }; -- PaintLegend PaintTails: PUBLIC PROC [handle: GraphHandle, x1, x2: REAL, v1, v2: ValueList, entities: EntityList, action: PaintAction _ paint, reversed: BOOL _ TRUE] = { IF HandleNotNil[handle] AND v1 # NIL AND v2 # NIL THEN { OPEN handle; rV1, rV2: ValueList; rEL: EntityList; info: PaintInfo; IF reversed THEN { [rV1, ] _ GraphUtil.ReverseValueList[v1, FALSE]; [rV2, ] _ GraphUtil.ReverseValueList[v2, FALSE]; rEL _ GraphUtil.ReverseEntityList[entities, TRUE]; } ELSE {rV1 _ v1; rV2 _ v2; rEL _ entities}; info _ NEW[tails PaintInfoRec _ [action: action, output: screen, data: tails[x1, x2, rV1, rV2, rEL]]]; PaintClient[handle, info]; }; }; -- PaintTails PaintTarget: PUBLIC PROC [handle: GraphHandle, choice: XY, action: PaintAction _ paint] = { IF HandleNotNil[handle] THEN { OPEN handle; info: PaintInfo _ NEW[target PaintInfoRec _ [action: action, output: screen, data: target[xy: choice]]]; PaintClient[handle, info]; }; }; -- PaintTarget PaintGrids: PUBLIC PROC [handle: GraphHandle, choice: XY, long: BOOL, action: PaintAction _ paint] = { IF HandleNotNil[handle] THEN { OPEN handle; info: PaintInfo _ NEW[grid PaintInfoRec _ [action: action, output: screen, data: grid[xy: choice, long: long]]]; PaintClient[handle, info]; }; }; -- PaintGrids PaintClient: PUBLIC PROC [handle: GraphHandle, info: PaintInfo] = { OPEN handle; viewer: Viewer _ handle.chart.viewer; IF ViewerNotNil[viewer] THEN ViewerOps.PaintViewer[ viewer: viewer, hint: client, clearClient: FALSE, whatChanged: info ]; IF info.action = erase THEN handle.chart.dirty _ TRUE; }; -- PaintClient }. LOG. SChen, created at October 9, 1985 6:10:49 pm PDT