GraphControl.mesa
Sweetsun Chen, September 6, 1985 8:26:10 pm PDT
CEDAR MONITOR
= {
ActionProc: TYPE = PROC[handle: GraphHandle, atom: Atom];
Toggle: PUBLIC ENTRY PROC[handle: GraphHandle ← NIL, atom: Atom ← NIL] = {
CheckNil[handle, $NilHandle];
SELECT atom FROM
$AutoDiv =>
$AutoBounds
$Primary, $Secondary
$TargetXOn, $TargetYOn
$GridX, GridY
Buttons.SetDisplayStyle
}; -- Toggle
Operate: PUBLIC ENTRY PROC = {};
Buttons.SetDisplayStyle
Control: PUBLIC ENTRY PROC[handle: GraphHandle ← NIL, action: ControlAction, atom: Atom] = {
msg: ROPE = "in Control";
CheckNil[handle, $NilHandle, msg];
CheckNil[handle.controller, $NilController, msg];
CheckNil[handle.graph, $NilGraph, msg];
SELECT action FROM
reset => CntrlReset[handle, atom]; -- see GraphCntrlReset.mesa
set => CntrlSet[handle, atom];
show => CntrlShow[handle, atom];
next => CntrlNext[handle, atom];
find => CntrlFind[handle, atom];
remove => CntrlRemove[handle, atom];
ENDCASE => RaiseError[$UnknowAction, "in Control"];
}; -- Control
CntrlSet: ActionProc = {
Set values. Affects panel only.
}; -- CntrlSet
CntrlShow: ActionProc = {
Reset values, if not set yet; display on chart if not yet displayed; update display on chart if already displayed.
CntrlReset[handle, atom];
SELECT atom FROM
$Divisions => ResetDivisionsFields[handle];
$Bounds => ResetBoundsFields[handle];
$Carets => ResetCaretsFields[handle];
$Targets => ResetTargetsFields[handle];
$Grids => ResetGridsFields[handle];
$Color => {
msg: ROPE;
index: INT;
[msg, index] ← GetIntField[controller.colorIndex];
IF msg # NIL THEN BlinkMsg[msg.Concat[" in parsing the index field."]]
ELSE IF index NOT IN ColorIndex THEN BlinkMsg[
Rope.Cat["Index must be in [0..", Convert.RopeFromInt[NumberOfColors], ")"]]
ELSE ResetColorFields[handle];
};
$Font => {
msg: ROPE;
index: INT;
[msg, index]← GetIntField[controller.fontIndex];
IF msg # NIL THEN BlinkMsg[msg.Concat[" in parsing the index field."]]
ELSE IF index NOT IN FontIndex THEN BlinkMsg[
Rope.Cat["Index must be in [0..", Convert.RopeFromInt[NumberOfFonts], ")"]]
ELSE ResetFontFields[handle];
};
$Text => {
msg: ROPE;
id: INT;
[msg, id] ← GetIntField[controller.textId];
IF msg # NIL THEN BlinkMsg[msg.Concat[" in parsing the id field."]]
ELSE {
text: Text ← TextFromId[handle.texts, id];
IF text = NIL THEN BlinkMsg[Rope.Concat["There is no text with id = ", Rope.RopeFromInt[id]]]
ELSE ResetTextFields[handle, text];
};
};
$Entity => {
msg: ROPE;
id: INT;
[msg, id] ← GetIntField[controller.entityId];
IF msg # NIL THEN BlinkMsg[msg.Concat[" in parsing the id field."]]
ELSE {
entity: Entity ← EntityFromId[controller.entityHash, id];
IF entity = NIL THEN BlinkMsg[Rope.Concat["There is no curve with id = ", Rope.RopeFromInt[id]]]
ELSE ResetCurveFields[handle, curve];
};
};
$CurveGroup => {
msg: ROPE;
id: INT;
[msg, id] ← GetIntField[controller.entityId];
IF msg # NIL THEN BlinkMsg[msg.Concat[" in parsing the id field."]]
ELSE {
eg: EntityGroup ← EntityGroupFromId[handle.entityGroupList, id];
IF eg = NIL THEN BlinkMsg[Rope.Concat["There is no curve group with id = ", Rope.RopeFromInt[id]]]
ResetCurveGroupFields[handle, cg];
};
};
$Crosssection => {
};
ENDCASE => RaiseError[$UnknownAtom, "in CntrlReset"];
}; -- CntrlShow
CntrlNext: ActionProc = {
SELECT atom FROM
}; -- CntrlNext
CntrlFind: ActionProc = {
SELECT atom FROM
}; -- CntrlFind
CntrlRemove: ActionProc = {
}; -- CntrlRemove
}.