THEN {
t ¬ NEW[ToolRep ¬ activeTool^];
t.outerData ¬ Controls.OuterViewer[name: name, column: left, buttons: extraButtons, controls: extraControls, controlSizes: controlSizes, destroyProc: OuterDestroy, icon: icon];
IF client
#
[]
THEN
{
activeClients ¬ CONS[client, activeClients];
ViewerOps.AddProp[t.outerData.parent, $ToolClient, NEW[Client ¬ client]];
};
IF NOT noOpen THEN ViewerOps.OpenIcon[t.outerData.parent];
}
ELSE {
Enumerate: ViewerOps.EnumProc ~ {ViewerOps.PaintViewer[v, caption]};
NewButton:
PROC [name:
ROPE, proc: ClickProc, guarded:
BOOL ¬
FALSE] ~ {
t.buttons ¬ CONS[Controls.ClickButton[name, proc, t, 0,,,,,, guarded], t.buttons];
};
RawViewers.SetColorWorld[ViewersWorldInstance.GetWorld[], $dense];
ViewerOps.EnumerateViewers[Enumerate]; -- fix up caption and icon colors
SetActiveTool[t ¬ NEW[ToolRep ¬ toolSettings]];
IF t.ipStrokeWidth = 2.0
THEN t.ipStrokeWidth ¬ 1.0;
-- better default
(actually, add another field: strokeWidth, for use with screen display)
t.activeViews ¬ LIST[0];
t.ops ¬ ops;
t.client ¬ client;
IF t.cmd =
NIL THEN
t.cmd ¬ NARROW[ProcessProps.GetProp[$CommanderHandle], Commander.Handle];
IF NOT Rope.IsEmpty[name] THEN t.name ¬ name;
t.camera ¬ G3dControl.InitCameraControl[
proc: G3dTool.Controller,
clientData: t,
fieldOfView: camera.fieldOfView,
proxyMode: eye,
scale: camera.scale,
move: camera.move,
rotate: camera.rotate];
G3dControl.SetArcBallSize[t.camera.arcBall, arcBallSize];
Context3dOk[t];
t.background ¬ background;
t.buttons ¬ extraButtons;
IF ops.io THEN NewButton["IO", G3dTool.IOOpsButton];
IF ops.lines THEN NewButton["Draw", G3dTool.DrawOpsButton];
IF ops.light THEN NewButton["Light", G3dTool.LightOpsButton];
IF ops.shape THEN NewButton["Shapes", G3dTool.ShapeOpsButton];
IF ops.render THEN NewButton["Render", G3dTool.RenderOpsButton];
IF ops.render THEN NewButton["Render", G3dTool.RenderButton];
IF ops.animation THEN NewButton["Animate", G3dTool.AnimateOpsButton];
IF ops.scene THEN NewButton["Scene", G3dTool.SceneOpsButton];
IF ops.texture THEN NewButton["Texture", G3dTool.TextureOpsButton];
IF ops.render THEN NewButton["Abort Render", G3dTool.AbortButton, TRUE];
IF ops.help THEN NewButton["Help", G3dTool.HelpButton];
IF ops.stop THEN NewButton["STOP", G3dTool.StopButton, TRUE];
t.controls ¬ G3dControl.AddCameraControl[extraControls, t.camera, useArcBalls];
IF nViews > 0
THEN {
t.outerData ¬ Controls.OuterViewer[
name: name,
column: left,
buttons: t.buttons,
controls: t.controls,
controlSizes: controlSizes,
typescriptHeight: typescriptHeight,
graphicsHeight: graphicsHeight,
mouseProc: G3dTool.Mouse,
destroyProc: Destroy,
drawProc: DoDraw,
noOpen: TRUE,
icon: IF icon # document THEN icon ELSE defaultIcon,
clientData: t];
t.outer ¬ t.outerData.parent;
t.outer.label ¬ name;
t.typescript ¬ t.outerData.typescript;
t.graphics ¬ t.outerData.graphics;
t.views ¬ MakeViews[t, nViews];
IF
NOT noOpen
THEN [] ¬ CedarProcess.Fork[OpenViewer, t];
Only upon return does the application have a Tool, which it needs if it is to draw.
Thus, we give the client some time with a Tool before drawing the viewer:
};
};