keys: Rope.ROPE;
SELECT bttn
FROM
$Boxes, $Circles, $Xs, $Octagons => drawMode ← bttn;
$Black => currentColor ← ImagerColor.ColorFromRGB[ [ R: 0.0, G: 0.0, B: 0.0 ] ];
$White => currentColor ← ImagerColor.ColorFromRGB[ [ R: 1.0, G: 1.0, B: 1.0 ] ];
$Red => currentColor ← ImagerColor.ColorFromRGB[ [ R: 1.0, G: 0.0, B: 0.0 ] ];
$Green => currentColor ← ImagerColor.ColorFromRGB[ [ R: 0.0, G: 1.0, B: 0.0 ] ];
$Blue => currentColor ← ImagerColor.ColorFromRGB[ [ R: 0.0, G: 0.0, B: 1.0 ] ];
$Puce => currentColor ← ImagerColor.ColorFromRGB[ [ R: 0.5, G: 0.2, B: 0.4 ] ];
$Spiral => DrawSpiral[];
$LeftButton, $LeftHeld => {
displayList[displayListPtr] ← [currentColor, drawMode, [x, y] ];
SELECT drawMode
FROM
$Xs => DrawX[displayList[displayListPtr].place, size];
$Boxes => DrawBox[displayList[displayListPtr].place, size];
$Circles => DrawCircle[displayList[displayListPtr].place, size];
$Octagons => DrawOct[displayList[displayListPtr].place, size];
ENDCASE;
displayListPtr ← displayListPtr + 1;
IF displayListPtr = displayList.length THEN { -- get longer display list
newList: REF DisplayList ← NEW[ DisplayList[displayList.length + 32] ];
FOR i: NAT IN [0..displayListPtr) DO newList[i] ← displayList[i]; ENDLOOP;
displayList ← newList;
};
};
$MiddleButton => ShowRope[ x, y, Rope.Cat["MiddleButton ", keys] ];
$RightButton => ShowRope[ x, y, Rope.Cat["RightButton ", keys] ];
$MiddleHeld => ShowRope[ x, y, Rope.Cat["MiddleHeld ", keys] ];
$RightHeld => ShowRope[ x, y, Rope.Cat["RightHeld ", keys] ];