-- DebugWriteString.mesa
-- last modified by McCreight, March 23, 1983 10:45 AM
-- to allow variable layer
-- written by Hilton, August 4, 1982 1:42 PM

DIRECTORY
ChipUserInt,
ppdddefs,
ppddefs,
ppdefs,
ppfeeddefs,
String,
WriteStringDefs;

DebugWriteString: PROGRAM
IMPORTS ChipUserInt, ppdddefs, ppddefs, ppdefs, ppfeeddefs, WriteStringDefs =

BEGIN OPEN ChipUserInt, ppdddefs, ppddefs, ppdefs, String, WriteStringDefs;

ob: obPtr ← NIL;
min: Point ← [0,0];

DO ENABLE Punt => GOTO Exit;

PutRect: PROCEDURE [r: Rect] =
BEGIN
realRect: Rect ← [
x1: markPnt.x+(scale*r.x1)/8,
y1: markPnt.y+(scale*r.y1)/8,
x2: markPnt.x+(scale*r.x2)/8,
y2: markPnt.y+(scale*r.y2)/8];
ourLp ← insertList[ourLp,
makeList[p: makeRect[x: realRect.x2-realRect.x1,
y: realRect.y2-realRect.y1,
l: IF ppfeeddefs.fbAr=ppfeeddefs.fbAr2 THEN rectLev ELSE favLev],
x: realRect.x1, y: realRect.y1, o: 0, refl: 0]];
END; -- of PutRect --

scale: INTEGER ← RequestInteger[
"Scale? (16 = huge, 1 = small)"L];
s: STRING ← RequestString[s1: "String to be put in selected layer at mark: "L,
lowerCaseOK: TRUE];
repaintRect: Rect ←
[x1: markPnt.x, y1: markPnt.y, x2: markPnt.x, y2: markPnt.y];
ourLp: listPtr ← NIL;
StringToRectangles[s, PutRect ! NoFont =>
{Explain["I need the file ""[indigo]<Chipmonk>WriteString>font.chip"", please!"]; EXIT}];
ReleaseFont[];
FreeString[s];
[ob, min] ← MakeCell[ourLp];
DrawOb[ob, min];
ENDLOOP;

EXITS Exit => NULL;

END. -- of DebugWriteString --