Converge.mesa
Last edited by Pier, May 12, 1983 9:50 am
DIRECTORY
MonitorToolTemp,
MessageWindow,
TJaMGraphics,
JaMFnsDefs,
GraphicsColor,
Graphics,
UserExec,
ViewerClasses,
ViewerOps,
WindowManager;
Converge: PROGRAM IMPORTS MonitorToolTemp, MessageWindow, Graphics, UserExec, ViewerOps, WindowManager SHARES MonitorToolTemp = BEGIN
OPEN MonitorToolTemp, Graphics;
Start: PROC [type: INTEGER ← 525] = {
SELECT type FROM
525 => MonitorToolTemp.StartMonitor[640,480,30,1,100,1200];
768 => MonitorToolTemp.StartMonitor[1024,768,35,1,60,850];
ENDCASE => MessageWindow.Append[message: "Unknown Monitor Type", clearFirst: TRUE];
ViewerOps.PaintViewer[viewer: grid, hint: all];
};
Stop: PROC = {WindowManager.StopColorViewers[];};
PaintPattern: ViewerClasses.PaintProc = TRUSTED {
PaintProc: TYPE = PROC [self: Viewer, context: Graphics.Context, whatChanged: REF ANY, clear: BOOL]
DrawPattern: PROC [context: Graphics.Context, hMin, hStep, hMax, hThick, vMin, vStep, vMax, vThick: REAL] = {
Graphics.SetColor[context, GraphicsColor.black];
Graphics.DrawBox[context, Graphics.GetBounds[context]];
Graphics.SetColor[context, GraphicsColor.white];
FOR h: REAL ← hMin, h+hStep UNTIL h > hMax DO
Graphics.DrawBox[self: context, box: [h, vMin, h+hThick, vMax]];
ENDLOOP;
FOR v: REAL ← vMin, v+vStep UNTIL v > vMax DO
Graphics.DrawBox[self: context, box: [hMin, v, hMax, v+vThick]];
ENDLOOP;
};
bbox: Graphics.Box ← context.GetBounds[];
DrawPattern[context: context, hMin: bbox.xmin, hStep: 25, hMax: bbox.xmax, hThick: 2, vMin: bbox.ymin, vStep: 25, vMax: bbox.ymax, vThick: 2];
};
code starts here
after running user should call Start with vertical lines as argument
grid: ViewerClasses.Viewer;
gridClassRec: ViewerClasses.ViewerClass ← NEW[ViewerClasses.ViewerClassRec];
gridClassRec.paint ← PaintPattern;
ViewerOps.RegisterViewerClass[$GRID, gridClassRec];
grid ← ViewerOps.CreateViewer[flavor: $GRID, info: [name: "GRID"]];
UserExec.DoIt[input: "run MonitorToolTemp; alias converge768 𡤌onverge.Start[768]; alias converge525 𡤌onverge.Start[525];\n "];
UserExec.DoIt[input: "alias ConvergeStop ←WindowManager.StopColorViewers[];\n "];
END.