DIRECTORY
ChoiceButtons USING [UpdateChoiceButtons],
Convert USING [RopeFromInt, RopeFromReal],
Graph USING [CaretIndex, ColorIndex, Entity, EntityList, FontIndex, NumberOfColors, NumberOfFonts, ROPE, Text, Texts, XY],
GraphConvert USING [RopeFromJustifX, RopeFromJustifY, RopeFromMark, RopeFromSDL, RopeOfSlope],
GraphPrivate USING [EntityGroupList, GraphAtomProc, GraphHandle, PaintEntity, PaintText],
GraphUtil USING [BlinkMsg, ControllerNotNil, Crosssections, EntityFromId, GetIntField, GetRealField, HandleNotNil, InitSegAll, PanelIndexedEntity, PanelIndexedText, RaiseError, SetIntField, SetRealField, SetToggleColor, TextFromId],
Rope USING [Cat],
ViewerTools USING [SetContents];
GraphResume:
CEDAR
PROGRAM
IMPORTS ChoiceButtons, Convert, GraphConvert, GraphPrivate, GraphUtil, Rope, ViewerTools
EXPORTS GraphPrivate = { OPEN Graph, GraphPrivate, GraphUtil;
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 ← CONS[entity, graph.entityList];
InitSegAll[entity];
IF chart.viewer # NIL THEN PaintEntity[handle, paint, entity];
};
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:
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];
};
}; -- ResumeTextFields
ResumeEntityFields:
PUBLIC
PROC [handle: GraphHandle ←
NIL, entity: Entity ←
NIL] = {
IF HandleNotNil[handle]
AND entity #
NIL
THEN {
OPEN handle;
ViewerTools.SetContents[controller.entityName, entity.name];
SetIntField[controller.entityColor, entity.colorIndex];
SetRealField[controller.entityWidth, entity.width];
ChoiceButtons.UpdateChoiceButtons[controller.viewer, controller.markRef,
GraphConvert.RopeFromMark[entity.mark]];
SetIntField[controller.entityGroupId, entity.groupId];
ViewerTools.SetContents[controller.entityValues, GraphConvert.RopeFromSDL[entity.segments]];
};
}; -- ResumeEntityFields
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
ResumeCrossSectionFields:
PROC[handle: GraphHandle, x:
REAL] = {
OPEN handle;
rope, tRope: ROPE ← NIL;
ok: BOOL;
y: REAL;
FOR el: EntityList ← graph.entityList, el.rest
UNTIL el =
NIL
DO
[ok, y] ← Crosssections[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];
ENDLOOP;
rope.Concat["]"];
ViewerTools.SetContents[controller.xsectionYs, rope];
}; -- ResumeCrossSectionFields
}.