<> <> <> <> DIRECTORY ChoiceButtons USING [EnumTypeRef], Containers USING [Container], Imager USING [Box, Rectangle, VEC], ImagerColor USING [RGB], ImagerFont USING [Font], Menus USING [Menu], Real USING [NonTrappingNaN], Rope USING [ROPE], TiogaOps USING [Ref], ViewerClasses USING [Viewer]; Graph: CEDAR DEFINITIONS = { <> NumberOfColors: INT = 16; LastEntityColor: INT = 12; NumberOfFonts: INT = 12; NullBox: Imager.Box = [0.0, 0.0, 0.0, 0.0]; NullRect: Imager.Rectangle = [0.0, 0.0, 0.0, 0.0]; NullVec: Imager.VEC = [0.0, 0.0]; UnitLineWidth: REAL = 1.0; NtNan: REAL = Real.NonTrappingNaN; <> Viewer: TYPE = ViewerClasses.Viewer; ROPE: TYPE = Rope.ROPE; ColorIndex: TYPE = INT[0..NumberOfColors); EntityColor: TYPE = ColorIndex[1..LastEntityColor]; FontIndex: TYPE = INT[0..NumberOfFonts); GraphColors: TYPE = REF GraphColorsArray; GraphColorsArray: TYPE = ARRAY ColorIndex OF ImagerColor.RGB; GraphFonts: TYPE = REF GraphFontsArray; GraphFontsArray: TYPE = ARRAY FontIndex OF GraphFont; GraphFont: TYPE = RECORD[ family: ROPE _ NIL, bold, italic: BOOL _ FALSE, vFontSize: INT _ 12, pFontScale: REAL _ 13.0 ]; <<>> <> Texts: TYPE = LIST OF Text; Text: TYPE = REF TextRec; TextRec: TYPE = RECORD[ text: ROPE _ NIL, place: Imager.VEC _ [0.0, 0.0], -- location relative to origion and size of curvebox fontIndex: FontIndex _ 0, colorIndex: ColorIndex _ 0, rotation: REAL _ 0.0, -- angle of rotation, ccw, in degrees. justifX: JustifX _ left, justifY: JustifY _ bottom, id: INT _ 0 -- must be unique among all texts. ]; JustifX: TYPE = {left, center, right}; JustifY: TYPE = {top, center, bottom}; <> EntityList: TYPE = LIST OF Entity; Entity: TYPE = REF EntityRec; EntityRec: TYPE = RECORD[ name, comment: ROPE _ NIL, colorIndex: ColorIndex _ 0, mark: Mark _ none, width: REAL _ UnitLineWidth, oldValues: ValueList _ NIL, group: EntityGroup _ NIL, parent: NestedEntities _ NIL, id: INT _ 0, -- unique among entities. segments: SegmentDataList _ NIL, -- nil iff entity not plotted. lastValue: ValueList _ NIL, lastSegment: SegmentDataList _ NIL ]; ValueList: TYPE = LIST OF REAL; Mark: TYPE = {none, round, square, diamond, cross, dollar, percent}; -- SegmentDataList: TYPE = LIST OF SegmentData; SegmentData: TYPE = REF SegmentDataRec; SegmentDataRec: TYPE = RECORD [ok: BOOL _ FALSE, end, nx, ny, d0: REAL _ 0.0]; <> <> <> <> <> EntityGroup: TYPE = REF EntityGroupRec; EntityGroupRec: TYPE = RECORD [ x: Entity _ NIL, -- x is not in ys or children. ys: NestedEntities _ NIL, id, length: INT _ 0 <> <> ]; NestedEntitiesList: TYPE = LIST OF NestedEntities; NestedEntities: TYPE = REF NestedEntitiesRec; NestedEntitiesRec: TYPE = RECORD[ name, comment: ROPE _ NIL, entityList: EntityList _ NIL, parent: NestedEntities _ NIL, children: NestedEntitiesList _ NIL, node: TiogaOps.Ref _ NIL -- ** readonly for client. ]; <> GRAPH: TYPE = REF GraphRec; GraphRec: TYPE = RECORD [ entityList: EntityList _ NIL, texts: Texts _ NIL, bounds: Imager.Box _ NullBox, -- [xmin, ymin, xmax, ymax] fileName: ROPE _ NIL, -- suggested file name to save the graph. auto: ARRAY AutoType OF BOOL _ ALL[TRUE], -- true: on. division: ARRAY XY OF INT _ ALL[5], caret: ARRAY CaretIndex OF CaretSpec _ ALL[NIL], showSlope: BOOL _ FALSE, target: ARRAY XY OF TargetSpec _ ALL[NIL], grids: ARRAY XY OF BOOL _ ALL[FALSE], -- true: on. color: GraphColors _ NIL, font: GraphFonts _ NIL ]; CaretIndex: TYPE = {primary, secondary, text}; CaretSpec: TYPE = REF CaretSpecRec; CaretSpecRec: TYPE = RECORD[ place: Imager.VEC _ NullVec, on: BOOL _ FALSE ]; <> <> XY: TYPE = {x, y}; TargetSpec: TYPE = REF TargetSpecRec; TargetSpecRec: TYPE = RECORD[ value: REAL _ 0.0, width: REAL _ UnitLineWidth, colorIndex: ColorIndex _ 13, on: BOOL _ FALSE ]; AutoType: TYPE = {divisions, bounds}; <<>> GraphHandle: TYPE = REF GraphHandleRec; -- the root of everything GraphHandleRec: TYPE = RECORD[ <> allTexts: Texts _ NIL, entityGroupList: EntityGroupList _ NIL, entityHash: EntityHash _ NIL, controller: Controller _ NIL, -- nil iff no controller viewer. chart: Chart _ NIL, graph: Graph.GRAPH _ NIL, userEditAllowed: BOOL _ TRUE, mergingBounds: BOOL _ FALSE, boundsToMerge: Imager.Box _ NullBox, lastTextId, lastEntityId: INT _ -1, lastEntityColor: EntityColor _ LastEntityColor, imagerFonts: ARRAY OutputType OF Fonts _ ALL[NIL], <> zoomPt1, zoomPt2: RECORD[set: BOOL _ FALSE, x, y: REAL _ 0.0] _ [], backgroundIndex: BackgroundIndex _ white, -- for display only. colorMap: ColorMap _ mine, colorMode: ColorMode _ color, paintInfo: PaintInfo _ NIL, realRect, axesRect: Imager.Rectangle _ NullRect, <> scale, step: ARRAY XY OF REAL _ ALL[0.0], <> normalLegend: BOOL _ TRUE, waitingGraph: BOOL _ FALSE, selectProcId: INT _ 0, selectProc: PROCESS _ NIL, <> <> locked: BOOL _ FALSE, unlocked: CONDITION ]; Chart: TYPE = REF ChartRec; -- graph viewer and its data ChartRec: TYPE = RECORD[ viewer: Viewer _ NIL, caretState: ARRAY CaretIndex OF CaretState _ ALL[NIL], dirty: BOOL _ FALSE, autoRepaint: BOOL _ TRUE, selectedText: Text _ NIL, selectedEntity: Entity _ NIL, selectedEntityGroup: EntityGroup _ NIL -- no use in this version. ]; CaretState: TYPE = REF CaretStateRec; CaretStateRec: TYPE = RECORD[ x, y: INTEGER _ 0, visible, toBlink: BOOL _ FALSE <<"visible" here means that it can be seen on the chart at this moment.>> <> <> ]; Controller: TYPE = REF ControllerRec; -- controller viewer and its data ControllerRec: TYPE = RECORD[ viewer: Viewer _ NIL, menu: Menus.Menu _ NIL, spec, xys: Containers.Container _ NIL, rule, table: Viewer _ NIL, specVisible, xysVisible, tableVisible: BOOL _ FALSE, textsParent: TiogaOps.Ref _ NIL, swDivisions, divX, divY, swBounds, xmin, ymin, xmax, ymax: Viewer _ NIL, swCaret: ARRAY CaretIndex OF Viewer _ ALL[NIL], caretPlace: ARRAY CaretIndex OF ARRAY XY OF Viewer _ ALL[ALL[NIL]], swSlope, slope: Viewer _ NIL, swTarget, targetValue, targetWidth, targetColor: ARRAY XY OF Viewer _ ALL[NIL], swGrid: ARRAY XY OF Viewer _ ALL[NIL], colorIndex, red, green, blue, fontIndex, fontFamily, swBold, swItalic, vFontSize, pFontScale, textId, textContent, textPlaceX, textPlaceY, textColor, textFont, textRotation, entityId, entityName, entityCmt, entityColor, entityWidth, entityMark, --entityGroupId, --entityValues, <> xyLabel, idOfy, xsecLabel, xat, values, argument: Viewer _ NIL, justifXRef, justifYRef, markRef, operandRef, angleRef: ChoiceButtons.EnumTypeRef _ NIL, auto: ARRAY AutoType OF BOOL _ ALL[TRUE], caretOn: ARRAY CaretIndex OF BOOL _ ALL[FALSE], targetOn, gridOn: ARRAY XY OF BOOL _ ALL[FALSE], slopeOn, boldOn, italicOn: BOOL _ FALSE, justifX: JustifX _ center, justifY: JustifY _ bottom, mark: Mark _ none, operand: Operand _ y, angle: Angle _ radians ]; Fonts: TYPE = REF FontArray; FontArray: TYPE = ARRAY FontIndex OF ImagerFont.Font; EntityGroupList: TYPE = LIST OF EntityGroup; ControlAction: TYPE = {resume, update, remove, next, find, noop}; Operand: TYPE = {y, plottedYs, allX}; Angle: TYPE = {degrees, radians}; <> EntityHashSize: INT = 128; HashIndex: TYPE = INT[0..EntityHashSize); EntityHash: TYPE = REF EntityHashArray; EntityHashArray: TYPE = ARRAY HashIndex OF EntityList; BackgroundIndex: TYPE = {white, gray, darkGray, black, unknown}; ColorMode: TYPE = {color, bw}; ColorMap: TYPE = {mine, cedar, default, replace}; MaxStep: CARDINAL = 6; StepCount: TYPE = INTEGER[0..MaxStep); BWLineState: TYPE = REF LineStateRec; LineStateRec: TYPE = RECORD[ step: StepCount _ 0, progress: REAL _ 0.0 ]; <<>> PaintInfo: TYPE = REF PaintInfoRec; PaintInfoRec: TYPE = RECORD[ item: PaintItem _ all, action: PaintAction _ paint, output: OutputType _ screen, clear, onlyOne: BOOL _ TRUE, -- useful when item = all or rect. rect: Imager.Rectangle _ NullRect, -- useful when item = rect. text: Text _ NIL, -- useful when item = text. entity: Entity _ NIL, -- useful when item = entity. v1, v2: ValueList _ NIL, -- useful when item = tails. v1 is the y values at x1. x1, x2: REAL _ 0.0, -- useful when item = tails. xy: XY _ x ]; PaintAction: TYPE = {erase, paint}; OutputType: TYPE = {interpress, screen}; PaintItem: TYPE = {all, allCurves, rectangle, graphText, graphEntity, tails, target, grid, legend}; GraphProc: TYPE = PROC [handle: GraphHandle]; <<>> <> Error: SIGNAL[atom: ATOM, info: ROPE _ NIL]; <<>> }. CHANGE LOG. SChen, created at October 9, 1985 5:50:27 pm PDT.