MakeTool:
PUBLIC PROC [
name: ROPE,
valueProc: ValueProc,
extraButtons: ButtonList ¬ NIL,
extraControls: ControlList ¬ NIL,
clientData: REF ANY ¬ NIL,
clientDraw: DrawProc ¬ NIL,
startProc: StartProc ¬ NIL,
scale: REAL ¬ 1.0,
move: Pair ¬ [0.0, 0.0],
toolSettings: G2dImplicitTool.ToolRep ¬ []]
RETURNS [t: Tool]
~ {
AddButton:
PROC [name:
ROPE, proc: ClickProc, guarded:
BOOL ¬
FALSE] ~ {
extraButtons ¬ CONS[Controls.ClickButton[name, proc, t,,,,,,, guarded], extraButtons];
};
t ¬ NEW[G2dImplicitTool.ToolRep ¬ toolSettings];
AddButton["IO", IOButton];
AddButton["Display", DisplayButton];
AddButton["Curve", CurveButton];
AddButton["STOP", StopButton, TRUE];
AddButton["Animation", AnimationButton];
extraControls ¬ CONS[t.scale ¬ Controls.NewControl["Scale",, t, 0, 2, scale, Cam], extraControls];
extraControls ¬ CONS[t.moveX ¬Controls.NewControl["X",, t, -2, 2, move.x, Cam], extraControls];
extraControls ¬ CONS[t.moveY ¬Controls.NewControl["Y",, t, -2, 2, move.y, Cam], extraControls];
t.startProc ¬ startProc;
t.valueProc ¬ valueProc;
t.clientDraw ¬ clientDraw;
t.clientData ¬ clientData;
t.buttons ¬ extraButtons;
t.outerData ¬ Controls.OuterViewer[
name: name,
buttons: extraButtons,
controls: extraControls,
typescriptHeight: 18,
graphicsHeight: 300,
destroyProc: Destroy,
drawProc: Draw,
noOpen: TRUE,
icon: icon,
clientData: t];
t.graphics ¬ t.outerData.graphics;
t.outerData.parent.label ¬ name;
t.typescript ¬ t.outerData.typescript;
[] ¬ CedarProcess.Fork[OpenViewer, t]; -- don't ask client to draw till after tool returned
};