GraphUtil.mesa, Copyright © 1985 by Xerox Corporation. All rights reserved.
Last edited:
Sweetsun Chen, November 23, 1985 5:57:10 pm PST
Christian Le Cocq April 27, 1987 3:43:11 pm PDT
DIRECTORY
Buttons USING [Button],
Graph USING [BackgroundIndex, Chart, ColorIndex, Controller, Entity, EntityGroup, EntityGroupList, EntityList, GraphHandle, NullRect, NullVec, OutputType, ROPE, SegmentDataList, Text, Texts, ValueList, Viewer, XY],
Imager USING [Box, ConstantColor, Rectangle, VEC],
ImagerColor USING [RGB],
ImagerFont USING [Font];
GraphUtil: CEDAR DEFINITIONS = { OPEN Graph;
error checking
Error: SIGNAL[atom: ATOM, info: ROPENIL];
RaiseError: PROC [atom: ATOM, msg: ROPENIL];
BlinkMsg: PROC [msg: ROPENIL];
HandleNotNil: PROC [handle: GraphHandle, msg: ROPENIL, debug: BOOLFALSE] RETURNS [ok: BOOL];
ChartNotNil: PROC [chart: Chart, msg: ROPENIL, debug: BOOLFALSE] RETURNS [ok: BOOL];
ViewerNotNil: PROC [viewer: Viewer, msg: ROPENIL, debug: BOOLFALSE] RETURNS [ok: BOOL];
GraphViewerExits: PROC [handle: GraphHandle, msg: ROPENIL, debug: BOOLFALSE] RETURNS [ok: BOOL];
ControllerNotNil: PROC [c: Controller, msg: ROPENIL, debug: BOOLFALSE] RETURNS [ok: BOOL];
ControllerViewerExits: PROC [handle: GraphHandle, msg: ROPENIL, debug: BOOLFALSE] RETURNS [ok: BOOL];
BoundsValid: PROC [box: Imager.Box] 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: BOOLTRUE] RETURNS [ok: BOOLTRUE];
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 [Imager.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, x, y: INTEGER] RETURNS [BOOL];
CrossSegment: PROC [xseg, yseg: SegmentDataList, at: REAL] RETURNS [ok: BOOL, v1, v2: Imager.VEC];
InterOrExtraPolate: PROC [v1, v2: Imager.VEC, x: REAL] RETURNS [REAL];
Crosssection: PROC [xseg, yseg: SegmentDataList, at: REAL] RETURNS [ok: BOOL, value: REAL];
RealToScreen: PROC [handle: GraphHandle, r: REAL, xy: XY ← x] RETURNS [REAL];
RealToScreenI: PROC [handle: GraphHandle, r: REAL, xy: XY ← x] RETURNS [INTEGER];
RealToScreenRel: PROC [handle: GraphHandle, r: REAL, xy: XY ← x] RETURNS [REAL];
RealVecToScreenVec: PROC [handle: GraphHandle, vec: Imager.VEC] RETURNS [Imager.VEC];
ScreenToReal: PROC [handle: GraphHandle, s: REAL, xy: XY ← x] RETURNS [REAL];
ScreenIToReal: PROC [handle: GraphHandle, s: INTEGER, xy: XY ← x] RETURNS [REAL];
ScreenIToRealVec: PROC [handle: GraphHandle, sx, sy: INTEGER] RETURNS [Imager.VEC];
TextPosToChartPos: PROC [axesRect: Imager.Rectangle, textPos: Imager.VEC] RETURNS [x, y: INTEGER];
ChartPosToTextPos: PROC [axesRect: Imager.Rectangle, chartPos: Imager.VEC] RETURNS [textPos: Imager.VEC];
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: BOOLTRUE, paint: BOOLTRUE] RETURNS [BOOL];
SetIntField: PROC [field: Viewer ← NIL, value: INT ← 0];
GetIntField: PROC [field: Viewer ← NIL, showMsg: BOOLTRUE] RETURNS [msg: ROPENIL, int: INT ← 0];
SetRealField: PROC [field: Viewer ← NIL, value: REAL ← 0.0];
GetRealField: PROC [field: Viewer ← NIL, showMsg: BOOLTRUE] RETURNS [msg: ROPENIL, real: REAL ← 0.0];
text and entity
FullName: PROC [entity: Entity] RETURNS [fullName: ROPE];
FontHeight: PROC [font: ImagerFont.Font] RETURNS [height: REAL];
RopeSize: PROC [rope: ROPE, font: ImagerFont.Font] RETURNS [width, height: REAL];
RemoveTextFromList: PROC [text: Text, texts: Texts];
RemoveEntityFromList: PROC [entity: Entity, entityList: EntityList];
TextFromId: PROC [texts: Texts, id: INT] RETURNS [text: Text];
EntityFromId: PROC [entityList: EntityList, id: INT] RETURNS [entity: Entity];
SpecIndexedText: PROC [controller: Controller, texts: Texts] RETURNS [text: Text];
SpecIndexedEntity: PROC [controller: Controller, ref: REF ANYNIL] RETURNS [entity: Entity];
killOld below only "partially" kills the old list.
ReverseTexts: PROC [old: Texts, killOld: BOOLTRUE] RETURNS [new: Texts];
ReverseEntityList: PROC [old: EntityList, killOld: BOOLTRUE] RETURNS [new: EntityList];
ReverseValueList: PROC [old: ValueList, killOld: BOOLTRUE] RETURNS [new, last: ValueList];
CopyValueList: PUBLIC PROC [old: ValueList, killOld: BOOLTRUE] RETURNS [new, last: ValueList];
ReverseSDL: PROC [old: SegmentDataList, killOld: BOOLTRUE] RETURNS [new, last: SegmentDataList ← NIL]; -- killOld only "partially" kill the old.
InitSegEnd: PROC [entity: Entity];
SetSegments: PUBLIC PROC [entity: Entity]; -- called when x and y's segment.end's are intialized.
InitSegAll: PROC [entity: Entity];
UpdateSegEnd: PROC [entity: Entity, values: ValueList];
UpdateSegAll: PROC [entity: Entity, values: ValueList];
LengthOfVL: PROC [valueList: ValueList] RETURNS [INT];
LengthOfEL: PROC [entityList: EntityList, group: EntityGroup ← NIL] RETURNS [INT];
LengthOfSDL: PROC [segmentDataList: SegmentDataList ← NIL] RETURNS [INT];
AppendX: PROC [xEntity: Entity, newx: REAL] RETURNS [oldx: REAL];
AppendY: PROC [entity: Entity, y, x1, x2: REAL] RETURNS [oldy: REAL];
AppendTexts: PROC [first, second: Texts] RETURNS [new: Texts];
AppendEntityList: PROC [first, second: EntityList] RETURNS [new: EntityList];
AppendEGL: PROC [first, second: EntityGroupList] RETURNS [new: EntityGroupList];
NewTextId: PROC [handle: GraphHandle, tryId: INT] RETURNS [newId: INT];
NewEntityId: PROC [handle: GraphHandle, tryId: INT] RETURNS [newId: INT];
NewGroupId: PROC [handle: GraphHandle, tryId: INT] RETURNS [newId: INT];
graph
MergeGraph: PROC [handle: GraphHandle, graph: GRAPH, paint: BOOLTRUE];
ReplaceGraph: PROC[handle: GraphHandle, graph: GRAPH, paint: BOOLTRUE];
strings
FileFromSelection: PROC [wDir: ROPENIL] RETURNS [file, msg: ROPENIL];
ReplaceFileExt: PROC [file: ROPE, extension: ROPENIL] RETURNS [new: ROPE];
WDirOfViewer: PROC [viewer: Viewer] RETURNS [wDir: ROPENIL];
viewer, handle, properties
HandleFromViewer: PROC [viewer: Viewer ← NIL] RETURNS [GraphHandle];
VanillaHandle: PROC [] RETURNS [GraphHandle];
Cleanup: PROC [handle: GraphHandle, full: BOOLTRUE] 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: BOOLTRUE];
DataBounds: PROC [entityList: EntityList, old: Imager.Box] RETURNS [Imager.Box];
Print: PROC[handle: GraphHandle, file: ROPE] RETURNS [msg: ROPENIL];
NotANumber: PROC [r: REAL] RETURNS [BOOL] = INLINE {
RETURN[LOOPHOLE[r, LONG CARDINAL] = 17740000001B]};
NotANan: PROC [r: REAL] RETURNS [BOOL] = INLINE {
RETURN[LOOPHOLE[r, LONG CARDINAL] # 17740000001B]};
}.
LOG.
SChen, August 14, 1985 7:30:22 pm PDT, created.