DIRECTORY ChoiceButtons USING [UpdateChoiceButtons], Convert USING [RopeFromInt, RopeFromReal], Graph USING [CaretIndex, ColorIndex, Entity, EntityHashSize, EntityList, FontIndex, GraphHandle, NumberOfColors, NumberOfFonts, ROPE, Text, Texts, XY], GraphConvert USING [RopeFromJustifX, RopeFromJustifY, RopeFromMark, RopeOfSlope, RopeOfXYValues], GraphPrivate USING [GraphAtomProc, PaintEntity, PaintText], GraphUtil USING [AppendEntityList, BlinkMsg, ControllerViewerExits, Crosssection, EntityFromId, GetIntField, GetRealField, HandleNotNil, InitSegAll, InitSegEnd, SpecIndexedEntity, SpecIndexedText, RaiseError, SetIntField, SetRealField, SetToggleColor, TextFromId], IO USING [int, PutFR], Rope USING [Cat, Concat], ViewerTools USING [SetContents]; GraphResume: CEDAR PROGRAM IMPORTS ChoiceButtons, Convert, GraphConvert, GraphPrivate, GraphUtil, IO, Rope, ViewerTools EXPORTS GraphPrivate = { OPEN Graph, GraphPrivate, GraphUtil; ResumeFromPanel: PUBLIC GraphAtomProc = { IF ControllerViewerExits[handle] THEN { OPEN handle; msg: ROPE; i: INT; r: REAL; SELECT atom FROM $Divisions => ResumeDivisionsFields[handle]; $Bounds => ResumeBoundsFields[handle]; $Carets => ResumeCaretsFields[handle]; $Primary => ResumeCaretFields[handle, primary]; $Secondary => ResumeCaretFields[handle, secondary]; $Slope => ResumeSlopeFields[handle]; $TextCaret => ResumeCaretFields[handle, text]; $Targets => ResumeTargetsFields[handle]; $Grids => ResumeGridsFields[handle]; $Color => { [msg, i] _ GetIntField[controller.colorIndex]; IF msg = NIL THEN IF i IN ColorIndex THEN ResumeColorFields[handle, i] ELSE BlinkMsg[Rope.Cat[ "Index must be in [0..", Convert.RopeFromInt[NumberOfColors], ")"]]; }; $Font => { [msg, i]_ GetIntField[controller.fontIndex]; IF msg = NIL THEN IF i IN FontIndex THEN ResumeFontFields[handle, i] ELSE BlinkMsg[Rope.Cat[ "Index must be in [0..", Convert.RopeFromInt[NumberOfFonts], ")"]]; }; $Text => { text: Text _ SpecIndexedText[controller, allTexts]; IF text = NIL THEN BlinkMsg["No text with this id."] ELSE ShowText[handle, text]; }; $Entity => { entity: Entity _ SpecIndexedEntity[controller, entityHash]; IF entity = NIL THEN BlinkMsg["No curve with this id."] ELSE ShowEntity[handle, entity]; }; $XYValues => { msg: ROPE; i: INT; [msg, i] _ GetIntField[controller.idOfy]; IF msg = NIL THEN { entity: Entity _ EntityFromId[entityHash[i MOD EntityHashSize], i]; IF entity = NIL THEN BlinkMsg["No curve with this id."] ELSE ResumeXYValues[handle, entity]; }; }; $Xsection => { [msg, r] _ GetRealField[controller.xat]; IF msg = NIL THEN ResumeCrossSection[handle, r]; }; ENDCASE => RaiseError[$UnknownAtom, "in Resume"]; }; }; -- ResumeFromPanel ShowText: PUBLIC PROC[handle: GraphHandle _ NIL, text: Text _ NIL] = { IF HandleNotNil[handle] AND text # NIL THEN { OPEN handle; IF TextFromId[graph.texts, text.id] = NIL THEN { graph.texts _ CONS[text, graph.texts]; IF chart.viewer # NIL THEN PaintText[handle, text, paint]; }; IF controller # NIL THEN ResumeTextFields[handle, text]; }; }; -- ShowText ShowEntity: PUBLIC PROC[handle: GraphHandle _ NIL, entity: Entity _ NIL] = { IF HandleNotNil[handle] AND entity # NIL THEN { OPEN handle; IF EntityFromId[graph.entityList, entity.id] = NIL THEN { graph.entityList _ AppendEntityList[graph.entityList, CONS[entity, NIL]]; IF entity.group.x.segments = NIL THEN InitSegEnd[entity.group.x]; InitSegAll[entity]; IF chart.viewer # NIL THEN PaintEntity[handle, entity, TRUE, paint]; }; IF controller # NIL THEN ResumeEntityFields[handle, entity]; }; }; -- ShowEntity ResumeDivisionsFields: PROC[handle: GraphHandle] = { OPEN handle; controller.auto[divisions] _ SetToggleColor[controller.swDivisions, graph.auto[divisions]]; SetIntField[controller.divX, graph.division[x]]; SetIntField[controller.divY, graph.division[y]]; }; -- SetDivisionFields ResumeBoundsFields: PUBLIC PROC[handle: GraphHandle] = { OPEN handle; controller.auto[bounds] _ SetToggleColor[controller.swBounds, graph.auto[bounds]]; SetRealField[controller.xmin, graph.bounds.xmin]; SetRealField[controller.ymin, graph.bounds.ymin]; SetRealField[controller.xmax, graph.bounds.xmax]; SetRealField[controller.ymax, graph.bounds.ymax]; }; -- SetBoundsFields ResumeCaretsFields: PROC[handle: GraphHandle] = { OPEN handle; FOR i: CaretIndex IN CaretIndex DO ResumeCaretFields[handle, i] ENDLOOP; ResumeSlopeFields[handle]; }; -- ResumeCaretsFields ResumeCaretFields: PROC [handle: GraphHandle, index: CaretIndex] = { OPEN handle; controller.caretOn[index] _ SetToggleColor[controller.swCaret[index], graph.caret[index].on]; SetRealField[controller.caretPlace[index][x], graph.caret[index].place.x]; SetRealField[controller.caretPlace[index][y], graph.caret[index].place.y]; }; -- ResumeCaretFields ResumeSlopeFields: PROC[handle: GraphHandle] = { OPEN handle; controller.slopeOn _ SetToggleColor[controller.swSlope, graph.showSlope]; IF graph.showSlope THEN ViewerTools.SetContents[controller.slope, GraphConvert.RopeOfSlope[graph.caret[primary].place, graph.caret[secondary].place]]; }; -- ResumeSlopeFields ResumeTargetsFields: PROC[handle: GraphHandle] = { ResumeTargetFields[handle, x]; ResumeTargetFields[handle, y]; }; -- ResumeTargetsFields ResumeTargetFields: PROC [handle: GraphHandle, xy: XY] = { OPEN handle; controller.targetOn[xy] _ SetToggleColor[controller.swTarget[xy], graph.target[xy].on]; SetRealField[controller.targetValue[xy], graph.target[xy].value]; SetRealField[controller.targetWidth[xy], graph.target[xy].width]; }; -- ResumeTargetFields ResumeGridsFields: PROC[handle: GraphHandle] = { OPEN handle; controller.gridOn[x] _ SetToggleColor[controller.swGrid[x], graph.grids[x]]; controller.gridOn[y] _ SetToggleColor[controller.swGrid[y], graph.grids[y]]; }; -- ResumeGridsFields ResumeColorFields: PROC[handle: GraphHandle, index: ColorIndex] = { OPEN handle; SetRealField[controller.red, graph.color[index].R]; SetRealField[controller.green, graph.color[index].G]; SetRealField[controller.blue, graph.color[index].B]; }; -- ResumeColorFields ResumeFontFields: PROC[handle: GraphHandle, index: FontIndex] = { OPEN handle; ViewerTools.SetContents[controller.fontFamily, graph.font[index].family]; controller.boldOn _ SetToggleColor[controller.swBold, graph.font[index].bold]; controller.italicOn _ SetToggleColor[controller.swItalic, graph.font[index].italic]; SetIntField[controller.vFontSize, graph.font[index].vFontSize]; SetRealField[controller.pFontScale, graph.font[index].pFontScale]; }; -- ResumeFontFields ResumeTextFields: PUBLIC PROC [handle: GraphHandle _ NIL, text: Text _ NIL] = { IF HandleNotNil[handle] AND text # NIL THEN { OPEN handle; ViewerTools.SetContents[controller.textContent, text.text]; SetRealField[controller.textPlaceX, text.place.x]; ChoiceButtons.UpdateChoiceButtons[controller.viewer, controller.justifXRef, GraphConvert.RopeFromJustifX[text.justifX]]; controller.justifX _ text.justifX; SetRealField[controller.textPlaceY, text.place.y]; ChoiceButtons.UpdateChoiceButtons[controller.viewer, controller.justifYRef, GraphConvert.RopeFromJustifY[text.justifY]]; controller.justifY _ text.justifY; SetIntField[controller.textColor, text.colorIndex]; SetIntField[controller.textFont, text.fontIndex]; SetRealField[controller.textRotation, text.rotation]; }; }; -- ResumeTextFields ResumeEntityFields: PUBLIC PROC [handle: GraphHandle _ NIL, entity: Entity _ NIL] = { IF ControllerViewerExits[handle] AND entity # NIL THEN { OPEN handle; ViewerTools.SetContents[controller.entityName, entity.name]; ViewerTools.SetContents[controller.entityCmt, entity.comment]; SetIntField[controller.entityColor, entity.colorIndex]; SetRealField[controller.entityWidth, entity.width]; ChoiceButtons.UpdateChoiceButtons[controller.viewer, controller.markRef, GraphConvert.RopeFromMark[entity.mark]]; controller.mark _ entity.mark; }; }; -- ResumeEntityFields ResumeXYValues: PROC [handle: GraphHandle, entity: Entity] = { IF ControllerViewerExits[handle] AND entity # NIL THEN ViewerTools.SetContents[handle.controller.values, GraphConvert.RopeOfXYValues[entity]]; }; -- ResumeXYValues ResumeCrossSection: PROC[handle: GraphHandle, x: REAL] = { OPEN handle; rope, tRope: ROPE _ NIL; ok: BOOL; y: REAL; count: INT _ 0; FOR el: EntityList _ graph.entityList, el.rest UNTIL el = NIL DO [ok, y] _ Crosssection[el.first.group.x.segments, el.first.segments, x]; tRope _ IF ok THEN Convert.RopeFromReal[y] ELSE "*"; rope _ IF rope = NIL THEN tRope ELSE rope.Cat[", ", tRope]; count _ count + 1; IF (count MOD 5) = 0 THEN rope _ rope.Concat[IO.PutFR[" -- %g\n", IO.int[count]]]; ENDLOOP; ViewerTools.SetContents[controller.values, rope]; }; -- ResumeCrossSection }. LOG. SChen, created at October 9, 1985 6:53:56 pm PDT. rGraphResume.mesa, Copyright c 1985 by Xerox Corporation. All rights reserved. Last Edited by: Sweetsun Chen, April 23, 1986 2:29:57 pm PST If handle = nil or controller = nil then error; otherwise: resumes fields values on panel in the entry denoted by atom, if they are not set yet. if atom denotes text or entity and if chart.viewer # nil, then display it on graph viewer. if atom doesn't denote text or entity, then has no effect on graph viewer display. $TargetX => ResumeTargetFields[handle, x]; $TargetY => ResumeTargetFields[handle, y]; $CurveGroup => { [msg, i] _ GetIntField[controller.groupId, "id"]; IF msg = NIL THEN { eg: EntityGroup _ EntityGroupFromId[handle.entityGroupList, i]; IF eg = NIL THEN BlinkMsg[Rope.Concat["There is no curve group with id = ", Convert.RopeFromInt[i]]] ResumeCurveGroupFields[handle, eg]; }; }; Check if it is indeed not plotted. If no, then {add it to end of graph.entityList. Init x and y segments. If plot exits, draw it and its legend.} ResumeXButtonField: PROC[handle: GraphHandle] = { OPEN handle; ViewerTools.SetContents[controller.xValues, GraphConvert.RopeFromSDL[entityGroupList.first.x.segments]]; -- for now. }; -- ResumeXButtonField SetIntField[controller.entityGroupId, entity.groupId]; ViewerTools.SetContents[controller.idOfy, Convert.RopeFromInt[entity.id]]; ResumeXYValues[handle, entity]; ResumeCurveGroupFields: PROC[handle: GraphHandle, eg: EntityGroup] = { OPEN handle; ViewerTools.SetContent[controller.groupName, eg.name]; SetIntField[controller.xId, eg.x.id]; ViewerTools.SetContent[controller.yIds, RopeOfEntityListIds[eg.entityList, eg.x]]; }; -- ResumeCurveGroupFields Κ ˜JšœΟmœ1™Nšœ™Icode™,—šΟk ˜ Jšœžœ˜*Jšœžœ˜*Jšœžœužœžœ˜—Jšœ žœO˜aJšœ žœ)˜;Jšœ žœω˜ˆJšžœžœ˜Jšœžœ˜Jšœ žœ˜ —J˜šœ žœž˜Jšžœ@žœ˜\Jšžœžœ ˜=J˜—šœžœ˜)™:JšœU™UJ™ZJ™R—šžœžœžœ˜4Jšœžœžœžœ˜šžœž˜Jšœ,˜,Jšœ&˜&Jšœ&˜&Jšœ/˜/Jšœ3˜3Jšœ$˜$Jšœ.˜.Jšœ(˜(Jšœ*™*Jšœ*™*Jšœ$˜$šœ ˜ Jšœ.˜.šžœžœž˜Jšžœžœ žœ˜4šžœ˜JšœD˜D——J˜—˜ Jšœ,˜,šžœžœž˜Jšžœžœ žœ˜2šžœ˜JšœC˜C——J˜—šœ ˜ Jšœ3˜3Jšžœžœžœ"˜4Jšžœ˜J˜—šœ ˜ Jšœ;˜;Jšžœ žœžœ#˜7Jšžœ˜ J˜—šœ˜Jšœžœžœ˜Jšœ)˜)šžœžœžœ˜Jšœ+žœ˜CJšžœ žœžœ#˜7Jšžœ ˜$J˜—J˜—šœ˜Jšœ(˜(Jšžœžœžœ˜0J˜—™Jšœ1™1šžœžœžœ™Jšœ?™?JšžœžœžœT™dJšœ#™#J™—J™—Jšžœ*˜1—J˜—JšœΟc˜J˜—š Οnœžœžœžœžœ˜Fš žœžœžœžœžœ˜:šžœ$žœžœ˜0Jšœžœ˜&Jšžœžœžœ ˜:J˜—Jšžœžœžœ ˜8J˜—JšœŸ ˜J˜—š   œžœžœžœžœ˜LJ™’š žœžœ žœžœžœ˜<šžœ-žœžœ˜9Jšœ6žœ žœ˜IJšžœžœžœ˜AJ˜Jšžœžœžœžœ ˜DJ˜—Jšžœžœžœ$˜Jšžœžœ žœžœ˜HJšœ˜JšœŸ˜—J˜š œžœ.žœ˜QJšœ]˜]JšœJ˜JJšœJ˜JJšœŸ˜—J˜š œžœžœ˜=JšœI˜Išžœžœ*˜AJšœT˜T—JšœŸ˜J˜—š œžœ˜2Jšœ˜Jšœ˜JšœŸ˜—J˜š œžœžœžœ˜GJšœW˜WJšœA˜AJšœA˜AJšœŸ˜—J˜š œžœžœ˜=JšœL˜LJšœL˜LJšœŸ˜—J˜š œžœ-žœ˜PJšœ3˜3Jšœ5˜5Jšœ4˜4JšœŸ˜—J˜š œžœ,žœ˜NJšœI˜IJšœN˜NJšœT˜TJšœ?˜?JšœB˜BJšœŸ˜—J˜—š  œžœžœžœžœ˜Oš žœžœžœžœžœ˜:Jšœ;˜;Jšœ3˜3šœK˜KJšœ,˜,—Jšœ"˜"Jšœ3˜3šœK˜KJšœ,˜,—Jšœ"˜"Jšœ4˜4Jšœ1˜1Jšœ6˜6J˜—JšœŸ˜J˜š œžœžœ™>šœ+™+Jšœ=Ÿ ™H—JšœŸ™—J™—š  œžœžœžœžœ˜Uš žœžœ žœžœžœ˜EJšœ<˜˜>Jšœ8˜8Jšœ4˜4šœH˜HJšœ(˜(—Jšœ˜Jšœ7™7JšœJ™JJšœ™J˜—JšœŸ˜J˜š œžœ*˜>šžœžœ žœž˜6JšœW˜W—JšœŸ˜J˜—š œžœ+žœ™SJšœ6™6Jšœ%™%JšœR™RJšœŸ™—J˜š œžœžœžœ˜GJšœ žœžœ˜Jšœžœ˜ Jšœžœ˜Jšœžœ˜šžœ,žœžœž˜@JšœH˜HJšœžœžœžœ˜4Jš œžœžœžœžœ˜;Jšœ˜Jš žœžœžœžœžœ˜RJšžœ˜—Jšœ1˜1JšœŸ˜——J˜J˜šžœ˜J˜1—J˜—…—"1{