// Text of project Dot2Dot written on 11/20/95 at 5:59 PM // Beginning of text file Project Data /* Dot2Dot Project Data Copyright: © Apple Computer, Inc. 1993-1995. All Rights Reserved. */ refNum := OpenResFileX("Dot2Dot.rsrc"); DefConst('kMrT,GetPICTAsBits("MrT",true)); CloseResFileX(refNum); 42; // End of text file Project Data // Beginning of file Dot2Dot.t // Before Script for "baseView" nil // Copyright © 1993-1995 Apple Computer, Inc. All rights reserved. baseView := {title: "Dot2Dot", viewBounds: {top: 0, left: 0, right: 240, bottom: 336}, viewEffect: 67083429, viewSetupFormScript: func() begin // resize to fit on all "small" newtons. local b := GetAppParams(); constant kMaxWidth := 240; constant kMaxHeight := 336; self.viewBounds := RelBounds(b.appAreaLeft, b.appAreaTop, MIN(b.appAreaWidth, kMaxWidth), MIN(b.appAreaHeight, kMaxHeight)); end, debug: "baseView", _proto: @157 }; drawingArea := {viewFlags: 529, viewFormat: 336, viewBounds: {left: 0, top: 40, right: 230, bottom: 270}, viewDrawScript: func() // draw points based on polygon information begin // then draw points based on the polygon (pensize 2) :DrawShape(thePolygon, {penSize: 2}); end, thePolygon: nil, viewClickScript: func(unit) // detect clicks and create a polygon based on the clicking begin // get global coordinates local temp := :GlobalBox(); // get pen down locations newX := GetPoint(unitFirstX, unit); newY := GetPoint(unitFirstY, unit); // calculate the real values (local coordinates) newX := newX - temp.left; newY := newY - temp.top; // store these points into the pointArray pointArray := SetAdd(pointArray, newX, nil); pointArray := SetAdd(pointArray, newY, nil); // build a new polygon shape thePolygon := nil; thePolygon := MakePolygon(pointArray); If length(pointArray) = 2*14 then SetValue(self,'icon,kMrT); // then force redraw :Dirty(); end, newX: nil, newY: nil, pointArray: nil, viewSetupFormScript: func() begin pointArray := []; thePolygon := MakePolygon(pointArray); end, eraseArea: func() // erase the contents of the viewbounds rect begin :DrawShape(MakeRect(viewbounds.top, viewBounds.left, viewBounds.bottom, viewBounds.right), {fillPattern: 1}); end, ZapArray: func() // zap array to zero, and force a redraw (in other words erase!) begin SetLength(pointArray, 0); thePolygon := MakePolygon(pointArray); :Dirty(); end, viewJustify: 16, icon: GetPictAsBits("MrT", 1), debug: "drawingArea" , viewClass: 76 }; AddStepForm(baseView, drawingArea); StepDeclare(baseView, drawingArea, 'drawingArea); theInfo := {text: "I pity the fool who connects the dots", viewBounds: {left: 18, top: 18, right: 218, bottom: 34}, debug: "theInfo", _proto: @218 }; AddStepForm(baseView, theInfo); wipeOut := {text: "Erase Poly", viewBounds: {left: 0, top: 276, right: 100, bottom: 296}, buttonClickScript: func() // call Erase function inside DrawingArea begin drawingArea:ZapArray(); SetValue(drawingArea,'icon,nil); end, viewJustify: 8388630, debug: "wipeOut", _proto: @226 }; AddStepForm(baseView, wipeOut); constant |layout_Dot2Dot.t| := baseView; // End of file Dot2Dot.t