<> <> <> DIRECTORY ChoiceButtons USING [EnumTypeRef], Containers USING [Container], Imager USING [ConstantColor, Context, Rectangle], ImagerFont USING [Font], Graph USING [AutoType, CaretIndex, ColorIndex, GRAPH, Entity, EntityColor, EntityGroup, EntityList, FontIndex, GraphColorsArray, GraphFontsArray, JustifX, JustifY, LastEntityColor, Mark, NullRect, ROPE, Text, Texts, XY, ValueList, Viewer], Menus USING [Menu], TiogaButtons USING [TiogaButton], TiogaOps USING [Ref]; GraphPrivate: CEDAR DEFINITIONS = { OPEN Graph; <<>> <> 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, 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], <> windowTooLow: BOOL _ FALSE, 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, panel: Containers.Container _ NIL, table: Viewer _ NIL, panelVisible, tableNormalized: BOOL _ FALSE, panelHeight: INTEGER _ 400, -- (397 is enough to show everything) 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, xValues, entityId, entityName, entityColor, entityWidth, entityMark, --entityGroupId, --entityValues, <> xsectionX, xsectionYs, 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 _ allY, 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 = {x, y, allY}; Angle: TYPE = {degrees, radians}; <> EntityHashSize: INT = 32; EntityHash: TYPE = REF EntityHashArray; EntityHashArray: TYPE = ARRAY [0..EntityHashSize) 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 ]; GraphProc: TYPE = PROC [handle: GraphHandle _ NIL]; GraphPlaceProc: TYPE = PROC [handle: GraphHandle _ NIL, sx, sy: INTEGER _ 0]; GraphAtomProc: TYPE = PROC [handle: GraphHandle _ NIL, atom: ATOM]; PaintInfo: TYPE = REF PaintInfoRec; PaintInfoRec: TYPE = RECORD[ item: PaintItem _ all, action: PaintAction _ paint, output: OutputType _ screen, clear: 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, rectangle, graphText, graphEntity, tails, target, grid}; <> defaultColorsArray: GraphColorsArray; defaultFontsArray: GraphFontsArray; systemColor: ARRAY ColorIndex OF Imager.ConstantColor; -- exported from GraphViewer.mesa <<>> <> <> ShowController: GraphProc; IsController: PROC [viewer: Viewer] RETURNS [BOOL]; <<>> <> PaintAll: PROC [handle: GraphHandle, clear, clientOnly: BOOL _ TRUE]; PaintRect: PROC [handle: GraphHandle, action: PaintAction _ paint, clear: BOOL _ TRUE, rect: Imager.Rectangle _ NullRect]; PaintText: PROC [handle: GraphHandle, action: PaintAction _ paint, text: Text _ NIL]; PaintEntity: PROC [handle: GraphHandle, action: PaintAction _ paint, entity: Entity _ NIL]; PaintTails: PROC [handle: GraphHandle, action: PaintAction _ paint, v1, v2: ValueList _ NIL, x1, x2: REAL _ 0.0]; PaintTarget: PROC [handle: GraphHandle, action: PaintAction _ paint, choice: XY _ x]; PaintGrids: PROC [handle: GraphHandle, action: PaintAction _ paint, choice: XY _ x]; Paint: GraphProc; <<>> <> Draw: PROC [context: Imager.Context _ NIL, handle: GraphHandle]; <<>> <> SwitchAuto: PROC [handle: GraphHandle, type: AutoType _ bounds]; SwitchCaretVisibility, SwitchCaretBlinking: PROC [handle: GraphHandle, index: CaretIndex _ primary]; SwitchTarget, SwitchGrid: PROC [handle: GraphHandle, xy: XY _ x]; SelectPoint, SelectEntity, SlideOnSameCurve, SelectText, MoveSelText, ZoomIn, ZoomOut, ZoomPoint: GraphPlaceProc; ErasePrimary, MoveXhair2To1, EraseSelEntity, ShowSelEntityOnPanel, JumpLeftAnyCurve, JumpRightAnyCurve, JumpUpAnyCurve, JumpDownAnyCurve, JumpLeftSameCurve, JumpRightSameCurve, EraseSelText, ShowSelTextOnPanel, ZoomWithZoomPts, ClearZoomBox: GraphProc; SlideLeftNSteps, SlideRightNSteps: PROC [handle: GraphHandle, nSteps: INT _ 0]; <<>> <> HandleFromFile: PROC [file: ROPE _ NIL] RETURNS [handle: GraphHandle _ NIL, msg: ROPE _ NIL]; GetGraph: PROC [handle: GraphHandle, file: ROPE _ NIL] RETURNS [msg: ROPE _ NIL]; SaveGraph: PROC [viewer: Viewer, toFile: ROPE _ NIL] RETURNS [msg: ROPE _ NIL]; WriteGraphFile: PROC [ref: REF ANY, file: ROPE _ NIL] RETURNS [msg: ROPE _ NIL]; WriteDataFile: PROC [graph: GRAPH _ NIL, file: ROPE _ NIL] RETURNS [msg: ROPE _ NIL]; <> ChartMenus, ControllerMenus: PROC [] RETURNS [menu: Menus.Menu]; <<>> <> Lock: GraphProc; Unlock: GraphProc; IsLocked: PROC [handle: GraphHandle] RETURNS [BOOL]; CallWithLock: PROC [handle: GraphHandle, proc: GraphProc _ NIL]; LockedPlaceProc: PROC [handle: GraphHandle, sx, sy: INTEGER _ 0, proc: GraphPlaceProc _ NIL]; LockedAtomProc: PROC [handle: GraphHandle, atom: ATOM, proc: GraphAtomProc _ NIL]; Wait: PROC; <> FlipToggleOnPanel: GraphAtomProc; MakePanel: PROC [handle: GraphHandle] RETURNS [lastHeight: INTEGER]; <<>> <> Operate: GraphAtomProc; <<>> <> PanelRemove: GraphAtomProc; RemoveText: PROC[handle: GraphHandle, text: Text]; RemoveEntity: PROC[handle: GraphHandle, entity: Entity]; <<>> <> Resume: GraphAtomProc; ShowText: PROC [handle: GraphHandle, text: Text _ NIL]; ShowEntity: PROC [handle: GraphHandle, entity: Entity _ NIL]; ResumeTextFields: PROC[handle: GraphHandle, text: Text _ NIL]; ResumeEntityFields: PROC [handle: GraphHandle, entity: Entity _ NIL]; <<>> <> MakeTable: PROC[handle: GraphHandle, lastHeight: INTEGER]; AddTextButton: PROC [handle: GraphHandle, text: Text _ NIL] RETURNS [b: TiogaButtons.TiogaButton _ NIL]; AddEntityButton: PROC [handle: GraphHandle, entity: Entity _ NIL] RETURNS [b: TiogaButtons.TiogaButton _ NIL]; <<>> <> Update: GraphAtomProc; <<>> <> ShowChart: GraphProc; IsGraphViewer: PROC [viewer: Viewer] RETURNS [BOOL]; }. <<>> CHANGE LOG. SChen, created at October 9, 1985 5:50:44 pm PDT. <<>>