GraphUtil.mesa, Copyright © 1985 by Xerox Corporation. All rights reserved.
Last edited:
Sweetsun Chen, October 18, 1985 4:30:38 pm PDT
DIRECTORY
Buttons USING [Button],
Graph USING [ColorIndex, Entity, EntityGroup, EntityList, GRAPH, NullBox, NullRect, NullVec, ROPE, SegmentDataList, Text, Texts, ValueList, Viewer, XY],
GraphPrivate USING [BackgroundIndex, Chart, Controller, GraphHandle, GraphProc, OutputType],
Imager USING [Box, ConstantColor, Rectangle, VEC],
ImagerColor USING [RGB],
ImagerColorDefs USING [ConstantColor],
ImagerFont USING [Font];
GraphUtil:
CEDAR
DEFINITIONS = {
OPEN Graph, GraphPrivate;
error checking
Error: SIGNAL[atom: ATOM, info: ROPE ← NIL];
RaiseError: PROC [atom: ATOM, msg: ROPE ← NIL];
BlinkMsg: PROC [msg: ROPE ← NIL];
HandleNotNil: PROC [handle: GraphHandle ← NIL, msg: ROPE ← NIL, debug: BOOL ← FALSE] RETURNS [ok: BOOL ← TRUE];
ViewerNotNil: PROC [viewer: Viewer ← NIL, msg: ROPE ← NIL, debug: BOOL ← FALSE] RETURNS [ok: BOOL ← TRUE];
ChartNotNil: PROC [chart: Chart ← NIL, msg: ROPE ← NIL, debug: BOOL ← FALSE] RETURNS [ok: BOOL ← TRUE];
ControllerNotNil: PROC [c: Controller ← NIL, msg: ROPE ← NIL, debug: BOOL ← FALSE] RETURNS [ok: BOOL ← TRUE];
EntityGroupNotNil: PROC [eg: EntityGroup ← NIL, msg: ROPE ← NIL, debug: BOOL ← FALSE] RETURNS [ok: BOOL ← TRUE];
EntityListNotNil: PROC [el: EntityList ← NIL, msg: ROPE ← NIL, debug: BOOL ← FALSE] RETURNS [ok: BOOL ← TRUE];
EntityNotNil: PROC [entity: Entity ← NIL, msg: ROPE ← NIL, debug: BOOL ← FALSE] RETURNS [ok: BOOL ← TRUE];
ValueListNotNil: PROC [vl: ValueList ← NIL, msg: ROPE ← NIL, debug: BOOL ← FALSE] RETURNS [ok: BOOL ← TRUE];
TextNotNil: PROC [text: Text ← NIL, msg: ROPE ← NIL, debug: BOOL ← FALSE] RETURNS [ok: BOOL ← TRUE];
FontNotNil: PROC [font: REF ANY ← NIL, msg: ROPE ← NIL, debug: BOOL ← FALSE] RETURNS [ok: BOOL ← TRUE];
BoundsValid: PROC [box: Imager.Box ← NullBox] RETURNS [BOOL];
DivisionsValid: PROC [divX, divY: INT] RETURNS [BOOL];
RectangleValid: PROC[rect: Imager.Rectangle ← NullRect] RETURNS [BOOL];
colors
ColorValueOk: PROC [value: REAL ← 0.0, blinkMsg: BOOL ← TRUE] RETURNS [ok: BOOL ← TRUE];
ForegroundColor: PROC [background: BackgroundIndex ← white, output: OutputType ← screen] RETURNS [Imager.ConstantColor];
BackgroundColor: PROC [background: BackgroundIndex ← white, output: OutputType ← screen] RETURNS [Imager.ConstantColor];
UseMyColors: PROC [handle: GraphHandle];
SetColor: PROC [index: ColorIndex ← 0, rgb: ImagerColor.RGB ← [0, 0, 0]] RETURNS [ImagerColorDefs.ConstantColor];
UseDefaultColors: PROC [handle: GraphHandle ← NIL];
UseCedarColors: PROC [];
SetCursorForBackgroundIndex: PROC [bkgnd: BackgroundIndex ← white];
UseDefaultFonts:
PROC [handle: GraphHandle];
handle must not be nil !!
UseMyFonts:
PROC [handle: GraphHandle];
handle can not be nil !! display is not altered.
coordinates and coordinates transformation
InViewer: PROC [viewer: Viewer ← NIL, x, y: INTEGER ← 0] RETURNS [BOOL];
CrossSegment: PROC [xseg, yseg: SegmentDataList ← NIL, at: REAL ← 0.0] RETURNS [ok: BOOL ← FALSE, v1, v2: Imager.VEC ← NullVec];
InterOrExtraPolate: PROC [v1, v2: Imager.VEC ← NullVec, x: REAL ← 0.0] RETURNS [REAL];
Crosssections: PROC [xseg, yseg: SegmentDataList ← NIL, at: REAL ← 0.0] RETURNS [ok: BOOL ← FALSE, value: REAL];
RealToScreen: PROC [handle: GraphHandle, r: REAL ← 0.0, xy: XY ← x] RETURNS [REAL];
RealToScreenI: PROC [handle: GraphHandle, r: REAL ← 0.0, xy: XY ← x] RETURNS [INTEGER];
RealToScreenRel: PROC [handle: GraphHandle, r: REAL ← 0.0, xy: XY ← x] RETURNS [REAL];
RealVecToScreenVec: PROC [handle: GraphHandle, vec: Imager.VEC ← NullVec] RETURNS [Imager.VEC];
ScreenToReal: PROC [handle: GraphHandle, s: REAL ← 0.0, xy: XY ← x] RETURNS [REAL];
ScreenIToReal: PROC [handle: GraphHandle, s: INTEGER ← 0, xy: XY ← x] RETURNS [REAL];
ScreenIToRealVec: PROC [handle: GraphHandle ← NIL, sx, sy: INTEGER ← 0] RETURNS [Imager.VEC ← NullVec];
TextPosToChartPos: PROC [axesRect: Imager.Rectangle ← NullRect, textPos: Imager.VEC ← NullVec] RETURNS [chartPos: Imager.VEC ← NullVec];
ChartPosToTextPos: PROC [axesRect: Imager.Rectangle ← NullRect, chartPos: Imager.VEC ← NullVec] RETURNS [textPos: Imager.VEC ← NullVec];
TextRect: PROC[text: Text ← NIL, font: ImagerFont.Font ← NIL, axesRect: Imager.Rectangle ← NullRect] RETURNS [rect: Imager.Rectangle ← NullRect, hotPoint: Imager.VEC ← NullVec];
panel fields
SetToggleColor: PROC[switch: Buttons.Button ← NIL, on: BOOL ← TRUE, paint: BOOL ← TRUE] RETURNS [BOOL];
SetIntField: PROC [field: Viewer ← NIL, value: INT ← 0];
GetIntField: PROC [field: Viewer ← NIL, showMsg: BOOL ← TRUE] RETURNS [msg: ROPE ← NIL, int: INT ← 0];
SetRealField: PROC [field: Viewer ← NIL, value: REAL ← 0.0];
GetRealField: PROC [field: Viewer ← NIL, showMsg: BOOL ← TRUE] RETURNS [msg: ROPE ← NIL, real: REAL ← 0.0];
text and entity
FullName: PROC [entity: Entity ← NIL] RETURNS [fullName: ROPE ← NIL];
FontHeight: PROC [font: ImagerFont.Font ← NIL] RETURNS [height: REAL ← 0];
RemoveTextFromList: PROC [text: Text ← NIL, texts: Texts ← NIL];
RemoveEntityFromList: PROC [entity: Entity ← NIL, entityList: EntityList ← NIL];
TextFromId: PROC [texts: Texts ← NIL, id: INT ← 0] RETURNS [text: Text ← NIL];
EntityFromId: PROC [ref: REF ANY ← NIL, id: INT ← 0] RETURNS [entity: Entity ← NIL];
PanelIndexedText: PROC [controller: Controller ← NIL, texts: Texts ← NIL] RETURNS [text: Text ← NIL];
PanelIndexedEntity:
PROC [controller: Controller ←
NIL, ref:
REF
ANY ←
NIL]
RETURNS [entity: Entity ←
NIL];
killOld below only "partially" kills the old list.
ReverseTexts: PROC [old: Texts, killOld: BOOL ← TRUE] RETURNS [new: Texts ← NIL];
ReverseEntityList: PROC [old: EntityList, killOld: BOOL ← TRUE] RETURNS [new: EntityList ← NIL];
ReverseValueList: PROC [old: ValueList ← NIL, killOld: BOOL ← TRUE] RETURNS [new: ValueList ← NIL];
CopyValueList: PUBLIC PROC [old: ValueList ← NIL] RETURNS [new: ValueList ← NIL];
ReverseSDL: PROC [old: SegmentDataList ← NIL, killOld: BOOL ← TRUE] RETURNS [new: SegmentDataList ← NIL]; -- killOld only "partially" kill the old.
InitSegEnd: PROC [entity: Entity ← NIL];
InitSegAll: PROC [entity: Entity ← NIL];
UpdateSegEnd: PROC [entity: Entity ← NIL, values: ValueList];
UpdateSegAll: PROC [entity: Entity ← NIL, values: ValueList];
graph
MergeGraph: PROC [handle: GraphHandle, graph: GRAPH ← NIL, paint: BOOL ← TRUE];
strings
FileFromSelection: PROC [] RETURNS [file, msg: ROPE ← NIL];
ReplaceFileExt: PROC [file: ROPE, extension: ROPE ← NIL] RETURNS [ROPE];
viewer, handle, properties
HandleFromViewer: PROC [viewer: Viewer ← NIL] RETURNS [GraphHandle];
VanillaHandle: PROC [] RETURNS [GraphHandle];
Cleanup: PROC [handle: GraphHandle, full: BOOL ← TRUE] RETURNS [GraphHandle];
AddProp: PROC [object: REF ANY, prop: ATOM, val: REF ANY];
FetchProp: PROC [object: REF ANY, prop: ATOM] RETURNS [val: REF ANY];
misc
Almost: PROC [p, q: REAL] RETURNS [a: BOOL ← TRUE];
DataBounds: PROC [entityList: EntityList ← NIL] RETURNS [Imager.Box];
Print: GraphProc;
}.
LOG.
SChen, August 14, 1985 7:30:22 pm PDT, created.