-not a Macintosh disk-F"GDPaPGDPa%a%vaBH@%uCNF,  8!"@$|Gn"`I N.@A,H<( F<B<H111Bx<kNNF`, 8! "NH@"|J(g g`LNu"_ |a||a0@||9݁g|w|a||NH瀀 |(_@"g2<@gBA?N`Fa`||aPLNu  fBR$N"NBH@&|݁ |B$<0HN~NL@dBgg>N&|)`RNuBBBA*2h/ BBB N _"_$_"H&|݁ |B$<0NNd 0<`L$|J HA H  2I<FFI<<FFfHHFFfHHH?B@L"_2N _0H 2<@I6@o Az:<2`6@oJA~:<26" @n2BDBB(`EB@nAJEkz`z2<HAIL0.NL0.N  / p? O@ 0  0  XO _,_2_!.NBBB/ BBBN08 @ gNu@ f"_E!NH\O/ ?`@&x|N _!@"|xEx En"`CE"|xN"Ҹ< A  33"|@E E4n"`C&E"|@.N _LHNFLN*8&E@CJJKK f`  f `><$CS*<F|4>BRIBC Gff&<CBSC`D GnKG45BQf` f `Ns |0< BXHQ!4 _$_"_!XOHH/8/ $ f0<? QN ! N.x $_$ g ! N.x !C !!LLyp!N\OFN  l0P߀ Aǀ`  6lo6@ 0_an*>]> j 56, l602  ۰Poo A` &ll6p@ 0?۷a?^ ꭕ 5o6, l602 8!ED91kE"0369? CoNGNOS BOOT FAILED TRY A NEWER MACHINE AND BOOT PROM _"_NN o0<BAN o0 _PON _"_$|0<J"PJQN _"_$|0<"PJQNHL$ orD?|?@?e\SFk!!QSWk:CL<HL|hH>L|4H>L|H>SWjTO>SGk\!Q`TSFk QSWk8L|H|L|H|4L|H|hL|H|LSGkQLx _O NNVH8=| f=|G* G, &N(N n"n$n 0.  S@ZeJ S@BBDBG S@gg.BC CJDg720faL`fa:` 320f8<S@`JDg  fa$` fa`  U@o$SBjt`(N&N><`JGg (Ev#$#$QNukJDg`g 3$f(N`BnLN^ _NUNPACK NV;n N^.NuEVINIT NVH,. ^J]g n0`4B?N. f n0`/.//. /.N(n)FLN^ _NEAD_BLONV/ (n Jno./.?././ /.Nj nJPg`RSn`(_N^ _NEAD_SEQHNT"|E.|r |BBByBygRBf~NuLHPPNqNqpS_n.0<QLHPPNqNqpS_n|~By&JM*Np|azJGfb|a|,Mpa`JGfH|a<<AaJGf0Avtp BQvr BQH@02N\LhL"4NtB@6Kd a"JDf`02IP g a JDf`Nub SBg pxNuBDNu><Nu4< vB@bp2IPSCfSBfNuppB@(4<dBC(4< CBC(C"H4<BACSBf(CAg><NuJoNV?-Nh.H|)?NpN^ _TONRAP NV.HgVS@g`J.f& -XмS//<N(/<N+_X-mX . ѭX -Xo<Np`B . TJ.f/-T/<N/<N+_T-mT -Tl<N,N^ _PONGETSPACNV .мS//<N/<NJ-_ .=@ N^.NuINDSPARNVH.. Bg/N0Hހ m0.@I/./<N( 8//<N @n ?.Bg?<BgN(LN^ _ NETMMU NV0. S@g S@gS@g`=|`=|` =|`BnN^ _\ONONV_DEVNVH nCJp"S@n2BgHnNE g BgNN=_   nV@g8B. Bmh|` @BvRF Fo mXf=|;|@`Bm@`|BgN;_hBgN> Ggd G] G^g$ GdfBgN;_@BgN>`<ND`.BgN8JD] D^g<N$ @=BgN>`|`.H@ABpR. .oBg?./N;_"Bg?./Nz;_,Bg?./Nj;_.Bg?./NZ;_0-| nBPLN^.NuEAD_CONNVH nCJp"S@n~`LH6p@J@^H6pA A_gH6p@H"AA1`H @ABpR o;nh0.H@;@@A r<Ё(@&|H@6LN^.NuROCESS_NVLH nCJp"S@n2BgHnNAx/NAx/HndNJndV nxVgB-e`|e  gHnxNA&HA(AL,*<Hnf?-Z E0-NPH///NJnfg<N(A(H/ HndN.JndV TVg B-fmeg`l-eg*0.zlW"-BWD@f-f @g` B-g -Bf|f/ N`B-f  -e -fg/ NLN^.NuNIT_CONNVH+| \+|l+|(|+|t+|+|l+|(|;TN(|;TZ(|;TX&| n!SLN^.NuETVARS NVH/Nt;| ./+@ .м/м+@+|X*<(< E"D +@T&|?-Z0-NS?NHnHmBNJngp+@BAC6 0HnNBBg/-BgN+_ -Э+@PBB<0<H/BgNZN<+_H+mHBG` m @I G~V GTVgd Gl|p@ @8`$ Gf|p@BT`| p@BT H< @"@=A?.??<BgNJRG Gox mI|p@BT mIP|p@/-H/<N 8LN^NuOOTINIT system.configNVH(nB BgN@BgN8HH,BgNp0HѬ f,/, NBgNBgNHH,BgN>0HѬ f,/, NZBgNBgNHH,BgN 0HѬ f:J`f< N/, NBgNBgNHH,BgN0HѬ g<NHBN,BN+_ n/BN  _r Ё0p//-XN /-/-XN&mX:=E E0o<N0<H+@d+| -dЭ\ n2HҀ -Ё"-Ҁ(Bg Э/N0Hѭ -Є+@B</-BgN+_+m` -\Э`+@h -dЭh, n0HІ+@ -Э+@ -Э+@?<f/-/-?<N^-m/ /./-N n LN^ _ NUILD_SYNVH(nBGBF. gB `P-n n0. PoB."` n0. A-H&n/+/<N&  n0>+<+/, N$BgNBgNHH-@BgN0H(٬ JVJ_gB."`4JGW WJGV WgJFf n `H n n/B."n/BgN.  _ BN-_JGf n Q/ n P/N` Q@H/ n P/N|B. n=h-nA-H n-P/./.p/NJGgR-m`Bg n/( n r Ё/ n P/ nP/ | ? Q@?N9_Jlg< N( nQ f|"LN^ _NOADSEG NV/ BBg/-lBgN+_p -p"-Ҁ+Al(|`p}//<N -Пp((|p}//<N -Пp(?<}/-p/-l?<N(_N^.NuLLOC_SCNVHAC 0BgHnN __m_^+m-^gBBg/-BgNX+_`+m-_gBBg/<BgN4 м,BgBgBHnBgHnHnBg/.N g<NACD 0BgHnN p g B-n`.BgBgBHnBgHnHnBg/.N g<Nn .@+@n -Эn+@j` B -@+@n -м@+@j?</-n/-j?<NH <逐n.JfB` .ЇP-@JfB` .ЇP-@-_g -Ї/ -Ї//./.N\`/-/-BBNJ(|p((|t(LN^.NuOAD_DEB SYSTEM.DEBUG2 SYSTEM.DEBUGNVH nCJp"S@n2&n (nBBgHnN gZB /, N BgN FBgN >HH(BgN v0H* f&.B</BgN&B /, N ~//N LN^ _ NOAD_UNPNVBgBgBHn</. /.Bg/.N g<NN^ _ NOAD_LLDNVH(n 0-F|>Jg,, .* Ю(H//<N ( Д-@`,.(.H//<N p-_?//?<N6 .P/N LN^ _NNSTALL_NVH(n=n ~`/, N dBgN _BgN HH(BgN 0H-@Jg .Ѭ `<N .fBN 4(BN ,( GfAqB0pB5pB`ACZ 0z`BgN f_ .ARE EoHn?<?<HnN AC 0HnHzNdg(AqB0pp @A^B @AB`2HnHzN,gAqB0pB5pB`Aqpp| 5pgnBg?/.Hn @AHp @A^Hp</.Nd g<NN?. @A^/0 @A"0Ҽ/?<NPRGinoLLN^ _ NOADCODEkrni NVBBg/-BgN +_?<e/-/-?<NN^.NuAKESUPSNVH(m . R A T&@-kLN^ _ NINDMAINNVBg/-|NN0Hѭ|B</-|BgN+_?<g/-/-|?<NdBg/-tN0HѭtB</-tBgNF+_x?<{/-x/-t?<N*N^.NuREATEOPNV/Jmho@ mFhomFh0-hH.//<N .0<AHЭX"-ToT.N^.NuONFIG_DNV A0C ArC 0AC 0/NHnHm`/NBgHn0N g< N0HnHn/NfBgHnrN g<N/NBg/.Hn$/N;_F/./.Hm`/Nh-MgN/.$?-F/N/N n /B/.$0-FH//N  _ /N&/NN^ _PONOADSYS $ SYSTEM.UNPACK SYSTEM.OS SYSTEM.LLDN NV,_NUTN z+|T mT PVD@MN0HmHmNHm?- -tЭx//-NNިNRN]N (NuN^NuOADER NVHAT(HA<&HHn?-0-H".Ҁ// / N Jng<NLN^.NuEAD_PAGNV0.H H"-"Ҁ-A0.H H@J@=@/.NvAT0.HЈ-@ N^ _TONIND_SENNVH n-h .S/0-H/N ;@8-n p+@4;m:BF` ATIBBlRF Fo=mA-HA<-HBE n0-HА(BnJf<NHn?-0-HЄ//./.NJng<NxBGA0.HЈ&@Bn=knnZ Eo<NJ ATI ( 9s Jlf<N0,n0.ްm8o`RERG`(-L`HLN^.NuPEN_FILNVH(n| @=@~`84p@k|nAP2IDA0 <f 4pAFRGinoLN^.NuHIFTNAMNVH(n @:JEnBn`pp4A4P@R@H. Eo U@<`BFJFo$ R@4A T@4BRBHށSF`Jl D./0.H/N =@LN^ _\ONDHASH NV~H n CJp"S@n2BA&/Nb 8<-HnNBgHn?-N>H/p6/NNBp6/A/NdACp S@n0HnN^J.gHHnHnN .Wgz n/B?.N~  _ `SFRGmfBGBNJFfELN^ _PONOOKUP_ENVH;n ;m?.?-N;nBNAT(HJg<N;l~+l";l ;l;l;lB?,N&_+S&+k*+k.LN^.NuNITMEDINVBg/.HnNr_n .gB/.N-_N^.NuPENINPUNVH(.BGBF Go<N AT:0JEf<N EHl@ ATH"Ұ n n Jf<NHH " n ``RGE`LN^ _ NIND_POSNV-m4/.0-H/N+_4J4]2-8H4]g<N&0-H/-4/Nl .;@: -4g/-4HnHnN/.NN^.NuILLBUF NV0-:mf -4R2-H//NNT0-:ATpRm:N^NuETBYTE NVHBgNHH<BgNH>JGl H м> G=@LN^NuETWORD NVHBgN0H//<N~,BgN0H.Jl޼ Ї-@LN^NuETLONG NVH,. 0-m:>HǼl>JGo0-:ATA//.H/N$H߮Hǜm:0-HnJ4]2-8H4]g<N -4R/HnHnNn-nA<(H/0-H/N*l-EJoZHn?-0-H".Ҁ/?././ NJng<N0-H/./NV(ٮ .Ѯ .ѭ4`:Jo -4R2-H//N"NhJfLN^ _PONOVEMULT//0/2/ AH@B@2/Ё/@" /WXNu// /"/ N2/A" /WXNu// /"/ N/@" /WXNuH>*jD,jD$&BBx㉰mRSDlJjDjDL|NuH0/ oC"4JBAR`$aJBBB`QQ oC"0/H#//IL._NuH oJB@BA"o JBBBlBA`$HR` fQ`RS@`?A"/oL\NuH o0/2/SA"o JBBA@m`Q/o L NuB`$_02 _ @o0 Ao*BBAm"6@SCBoSA`@"H`RCoN$_0"_ _J/ S@m*BABB@m6B$I”@`!Q`QNuHr`HBA oJ"oJB@f`fQ AA/oL\NuH"o J oJv`:H"o J oJBC`&H o J"oJv`H o J"oJBCB@BA@m4`4`fQ@n C`cC"/oL\NuNuNuJoNu:/WMacSupplement 3 (Feb 85)&;f/Nt0. @ g0@#g2S@g6U@g:_@W:/*`$"kT! kW $&$NoL8h4b~:|xL<H T(!h"l,# $ %&H'(,)*@+,-567 => rootcatalogːHp8*:/ڏ&JW  3.0only/ShowInterface.objerfa Modal.textxtxtii6 QDSample.texttii6 BoxesR.textextii62.0only/example/SoundLab.TEXT Boxes.texttextii6 ADeskAccR.textii6  FileR.textxtxtii6QDSampleR.textii63.0only/ProcNames.objcNames.oShowPaint.textii6 SampR.texttextii6 ScrollR.textxtii6 Samp.text.textii6 FileAsm.textxtii6 ModalR.texttxtii6 ADeskAcc.textii6 3.0only/RMaker.objhker.obj3.0only/Xref.objhf.objh  Grow.texttxtxtii6SineGridR.texttii6!ShowPaintR.textii6 SineGrid.textxtii6 3.0only/example/SoundLab.textPicScrapR.textii6 Scroll.textextii6 File.textxtextii6 GrowR.textxtxtii6 PicScrap.texttii62.0only/example/SoundLab.TEXTΞ:/W&8מ;+a;*> L3.0only/example/SoundLab.textΞ:/W&8e;+f;*b h3.0only/ProcNames.objcNames.oΞ:/W&s ;+lsC1 13.0only/RMaker.objhker.objΞ:/W&0,;+s0O? ?3.0only/ShowInterface.objerfaΞ:/W&/+;+z/VF F3.0only/Xref.objhf.objhΞ:/W&r&;+rL> :> ADeskAcc.textii6:/W&9⠳$9& x&ADeskAccR.textii6:/W&F;+./4  Boxes.texttextii6:/ W&;+4  BoxesR.textextii6:/ W& u;+0B  File.textxtextii6:/ W&U;+)   FileAsm.textxtii6:/ W&lҞ;+)  < FileR.textxtxtii6:/ W&۔;+ۗ H Grow.texttxtxtii6:/W& ;+  T GrowR.textxtxtii6:/W&?9;+ h Modal.textxtxtii6:/W& ;+   l ModalR.texttxtii6:/W&в;+6  PicScrap.texttii6:/W& ;+  PicScrapR.textii6:/W&Q;+ŜW  QDSample.texttii6:/W&Lb%Lh$ $QDSampleR.textii6:/W&K;+ѝK  Samp.text.textii6:/W&;+֞ ^  SampR.texttextii6:/W&8;+۞'  Scroll.textextii6:/W&/?|;+/?  ScrollR.textxtii6:/W&;+/a ShowPaint.textii6:/W&   -3. "6F^5D!$ǐ^22 {$X-} {$U-} program showPaint; {Scott Knaster Macintosh Tech Support 5/84 Displays the upper-left corner of a MacPaint document on the screen. Based on Bill Atkinson's document Note: screen sizes are hard-coded for 512 by 342 } {Small and slow version. This version saves memory by doing a CopyBits for each line individually, so it's much slower than the all-at-once method. You can speed it up by making the constant srcBlocks larger, but every srcBlock costs you 512 bytes. Ultra-fast, pig version which reads in the whole picture (needs 24K) then does CopyBits is available from Macintosh Tech Support } #uses &{$U obj/memtypes} memtypes, &{$U obj/quickdraw} quickdraw, &{$U obj/osintf} osintf, &{$U obj/toolintf} toolintf; #const &srcBlocks = 2; {Make this number larger to speed things up. Uses 512 bytes 6for each number increased.} &headerSize = 512; #type &diskBlock = packed array [1..512] of QDbyte; #var &srcBuf : array [1..srcBlocks] of diskBlock; &theBits : packed array [1..72] of byte; &srcPtr, dstPtr : Ptr; &dstBits : bitmap; &error : OSErr; &refNum, scanline, srcSize : integer; &count : longint; &aPort : GrafPort; &debug : text; &showRect, lineRect : Rect; begin #InitGraf (@thePort); #FlushEvents (everyEvent, 0); #InitCursor; #OpenPort (@aPort); #srcSize := srcBlocks * 512; #srcPtr := @srcBuf; #dstBits.rowBytes := 72; #dstBits.baseAddr := @theBits; #SetRect (dstBits.bounds, 0, 0, 576, 1); #dstPtr := pointer (dstBits.baseAddr); #error := FSOpen ('macPic', 0, refNum); #{skip the header} #count := headerSize; #error := FSRead (refNum, count, @srcBuf); #{prime srcBuf} #count := srcSize; #error := FSRead (refNum, count, @srcBuf); #SetRect (lineRect, 0, 0, 512, 1); #SetRect (showRect, 0, 0, 512, 1); #count := count - 512; #{unpack each scanline into dstBits, reading more source as needed} #for scanline := 1 to 342 do &begin )UnpackBits (srcPtr, dstPtr, 72); )CopyBits (dstBits, screenBits, lineRect, showRect, -srcCopy, nil); )dstPtr := pointer (dstBits.baseAddr); )OffsetRect (showRect, 0, 1); )if ord (srcPtr) > (ord (@srcBuf) + srcSize - 512) ,then begin 2srcBuf [1] := srcBuf [srcBlocks]; 2error := FSRead (refNum, count, @srcBuf [2]); 2srcPtr := pointer (ord (srcPtr) + 512 - srcSize); 1end; &end; #error := FSClose (refnum); #repeat until button; end. ShowPaintR.textii6:/W&T㠳ƝT  SineGrid.textxtii6:/W&9;+9 73. "6F^501 ; port ^.UU9&FOR ix := XLB TO XUB DO &BEGIN )FOR iy := YLB TO Gޒ IN ,sqr := FixMulaa(l( t tZ <`aa(a(`:a(̞ ̞Hiy. t tZ < g ΠƠ :F`(.2V ̠Ba(̠ÂFP̨Fx`:a(N"L{$X-} {$R-} {$D-} Program SineGrid; #USES {$U-} &{$U obj/Memtypes } Memtypes, &{$U obj/QuickDraw } QuickDraw, &{$U obj/OSIntf } OSIntf, &{$U obj/ToolIntf } ToolIntf, &{$U obj/FixMath } FixMath, &{$U obj/Graf3D } Graf3D; #CONST &XLB = -10; &XUB = 10; &YLB = -10; &YUB = 10; {array bounds} &keyOrMouse = mDownMask + keyDownMask; #VAR &gPort: GrafPort; &gPort3D: Port3d; &data: ARRAY [XLB..XUB, YLB..YUB] OF Fixed; &dummy: EventRecord; #PROCEDURE CalcData; #VAR &ix, &iy: INTEGER; #BEGIN &FOR ix := XLB TO XUB DO &BEGIN )FOR iy := YLB TO YUB DO ,data[ix, iy] := FracRatio(FracSin(FixRatio(ix, 3)) + -FracCos(FixRatio(iy, 4)), 1073741824); &END #END; #PROCEDURE PlotGrid; #CONST &fYLB = YLB * 65536; &fXLB = XLB * 65536; #VAR &ix, &iy: INTEGER; #BEGIN &FOR ix := XLB TO XUB DO &BEGIN )MoveTo3D(FixRatio(ix, 1), fYLB, data[ix, YLB]); )FOR iy := YLB TO YUB DO ,LineTo3D(FixRatio(ix, 1), FixRatio(iy, 1), data[ix, iy]); &END; &FOR iy := YLB TO YUB DO &BEGIN )MoveTo3D(fXLB, FixRatio(iy, 1), data[XLB, iy]); )FOR ix := XLB TO XUB DO ,LineTo3D(FixRatio(ix, 1), FixRatio(iy, 1), data[ix, iy]); &END; #END; BEGIN {initialization routines} #InitGraf(@thePort); #InitCursor; #HideCursor; #OpenPort(@gPort); #Open3DPort(@gPort3D); {program begins} #CalcData; #PenPat(White); #BackPat(Black); #EraseRect(gPort.portRect); #FrameRect(gPort.portRect); #LookAt(-983040, 655360, 983040, -655360); {LookAt (-15, 10, 15, -10)}; #ViewAngle(1966080); {ViewAngle(30)} #Scale(65536, 65536, 196608); {Scale(1, 1, 3)} #Roll(1966080); {Roll(30)} #Pitch(4587520); {Pitch(70)} #PlotGrid; #WHILE NOT OSEventAvail(keyOrMouse, dummy) DO; END. SineGridR.texttii6:/ W&9ϧ;+9Ϩ >3. "6F^501 ; port B ^9ϧ := FixDiv (Edge, 131072); {Half := Edge / 2} &MoGu Half,-Half); &Linaa(&L t tZ o`aa(a(`:a(̞ ̞H,Eކfix/boxSphe g ΠƠ :F`(.2V ̠Ba(̠ÂFP̨Fx`:a(N"Lexample/SineGrid.rsrc Type CODE "example/SineGridL,0 9ENN1N^$$ ;*;L); ); ; l panel} t.where,fullRect); 2inGoAway: 5BEGIN 5IF TrackGoAway(whichWindow,myEvent.where) THEN 8doneFlag := TRUE; 5END; 2inSysWindow: 5SystemClick(myEvent,whichWindow); 2i8doneFlag := TRUE; 5END; 2inSysWindow: 5SystemClick(myEvent,whichWindow); 2inContent: 5BEGIN 5IF topWindow<>whichWindow THEN 8BEGIN 8SelectWindow(whichWindow); 8topWindow := whichWindow; 8END 5ELSE IF whichWindow=waveWindow {$R-} {$X-} PROGRAM SoundDemo; {"2.0 only" version--uses old Sane library (will also compile from 3.0 with old Sane library and Pascal compiler shipped "with the 3.0 Workshop, not the "post-3.0" compiler)} "{ Program to play with the new proto sound } "{ written by Andy Hertzfeld Oct 3, 1982 } "{ modified for 4 voice ROM sound -- Nov 2, 1982 } "{ for ROM 4T -- Jun 18, 1983 } "{ made to run under ToolBox, OSInterfc -- Jan 8, 1983 } "{ changes for new interfaces -- Jun 26, 1984 } "{ Historical note: since this program was written a long, long time ago, %please note that the programming style is a little strange in places. } #USES {$U-} &{$U Obj/Memtypes } Memtypes, &{$U Obj/QuickDraw } QuickDraw, &{$U Obj/OSIntf } OSIntf, &{$U Obj/ToolIntf } ToolIntf, &{$U Obj/Sane } SANE, &{$U Obj/Elems } Elems; #VAR &tempRect: Rect; &mousePt,myPt: Point; &myEvent: EventRecord; &theFolder: WindowPtr; &doneFlag: Boolean; &theMenu,theItem: INTEGER; &code: INTEGER; &whichWindow: WindowPtr; &whichControl: ControlHandle; &folRect: Rect; &mBox: Rect; &dial1,dial2,dial3,dial4: ControlHandle; &dialV: ControlHandle; &fullRect: Rect; &UserVol: Integer; &soundTblPtr: FTSynthPtr; &MySoundRec: FTSoundRec; {fixed size, so no reason to allocate on heap} &MySynthRec: FTSynthRec; {fixed size, so no reason to allocate on heap} &wave1,wave2,wave3,wave4, sinWave: Wave; &t,I: INTEGER; &waveWindow,topWindow: WindowPtr; &whichWave: INTEGER; &myMenu,menu2,menu3,deskMenu: MenuHandle; &mResult: LongInt; &title1,title2,title3,title4: Str255; &offSwitch: Boolean; &myString: Str255; &refNum: INTEGER; #PROCEDURE SetUpMenus; #{once only initialization for menus} &VAR )I: INTEGER; )menuFile: Text; )drvrType: ResType; &BEGIN )InitMenus; {initialize Unit Menus} )drvrType := 'DRVR'; )myMenu := GetMenu(256); )menu2 := GetMenu(257); )menu3 := GetMenu(258); )deskMenu := GetMenu(1); )AddResMenu(deskMenu,drvrType); )InsertMenu(deskMenu,0); )InsertMenu(myMenu,0); )InsertMenu(menu2,0); )InsertMenu(menu3,0); )DrawMenuBar; &END; #PROCEDURE MakeTheFolder; #{ set up and draw one folder } &VAR )tempRect: Rect; )folName: Str255; )tempPt: Point; &BEGIN )theFolder := GetNewWindow(1,NIL,NIL); )waveWindow := GetNewWindow(2,NIL,theFolder); )topWindow := theFolder; &END; #PROCEDURE MakeTheDials; &VAR )tempRect: Rect; &BEGIN )SetRect(mBox,120,30,280,46); )dial1 := NewControl(theFolder,mBox,' ',TRUE,0,0,8191,ScrollBarProc,1); )SetRect(mBox,120,60,280,76); )dial2 := NewControl(theFolder,mBox,' ',TRUE,0,0,8191,ScrollBarProc,2); )SetRect(mBox,120,90,280,106); )dial3 := NewControl(theFolder,mBox,' ',TRUE,0,0,8191,ScrollBarProc,3); )SetRect(mBox,120,120,280,136); )dial4 := NewControl(theFolder,mBox,' ',TRUE,0,0,8191,ScrollBarProc,4); )SetRect(mBox,76,160,256,192); )dialV := NewControl(theFolder,mBox,' ',TRUE,7,0,7,ScrollBarProc,5); &END; #PROCEDURE LabelControls; &BEGIN )MoveTo(30,42); )DrawString('Channel A'); )MoveTo(30,72); )DrawString('Channel B'); )MoveTo(30,102); )DrawString('Channel C'); )MoveTo(30,132); )DrawString('Channel D'); )MoveTo(140,208); )DrawString('Volume'); &END; #PROCEDURE Triangle(VAR theWave: Wave); #{ make a simple triangle wave } &VAR )I: INTEGER; &BEGIN )FOR I := 0 TO 127 DO ,BEGIN ,theWave[I] := 2*I; ,theWave[255-I] := 2*I; ,END; &END; #FUNCTION sineval (period: INTEGER): INTEGER; #CONST Increment = 3.14159*2/256; {2 pi = waveform period; 256 samples} #VAR newval, holder: extended; #BEGIN (* #{the following line is the code for this routine under SANE for Post-3.0 Pascal} &sineval := Num2Integer ((sin(period * Increment) * 128) + 128); *) &I2X (period, newval); &S2X (Single(Increment), holder); &MulX (holder, newval); &SinX (newval); &I2X (128, holder); &MulX (holder, newval); &AddX (holder, newval); &X2I (newval, period); &sineval := period; #END; #PROCEDURE buildSinWave; #VAR Index : Integer; &BEGIN )SetRnd (Downward); )For Index := 0 to 255 DO ,BEGIN /SinWave[Index] := sineval (Index); ,END; &END; #PROCEDURE mysine(VAR sine: Wave); #BEGIN &Sine := sinWave; #END; #PROCEDURE Square(VAR theWave: Wave); #{ make a simple square wave } &VAR )I: INTEGER; &BEGIN )FOR I := 0 TO 127 DO ,BEGIN ,theWave[I] := ord (255); { ord() is needed because of compiler bug, Gfixed in version 3.0 } ,theWave[255-I] := 0; ,END; &END; #PROCEDURE CopyWave(VAR src,dst: Wave); &VAR )I: INTEGER; &BEGIN )FOR I := 0 TO 255 DO dst[I] := src[I]; &END; #PROCEDURE InitSTab; &VAR )l: LongInt; &BEGIN )WITH soundTblPtr^.sndRec^ DO ,BEGIN ,duration := 8192; ,l := 256; ,sound1Rate := l*GetCtlValue(dial1); ,sound1Phase := 0; ,sound2Rate := l*GetCtlValue(dial2); ,sound2Phase := 0; ,sound3Rate := l*GetCtlValue(dial3); ,sound3Phase := 0; ,sound4Rate := l*GetCtlValue(dial4); ,sound4Phase := 0; ,sound1Wave := @wave1; ,sound2Wave := @wave2; ,sound3Wave := @wave3; ,sound4Wave := @wave4; ,END &END; #PROCEDURE SetPitch(voiceIndex: INTEGER; pitch: INTEGER); &VAR )l: LongInt; &BEGIN )l := 256; )WITH soundTblPtr^.sndRec^ DO ,BEGIN ,CASE voiceIndex OF /1: sound1Rate := l*pitch; /2: sound2Rate := l*pitch; /3: sound3Rate := l*pitch; /4: sound4Rate := l*pitch ,END ,END &END; #PROCEDURE BumpDial(whichControl: ControlHandle; amount: INTEGER); &VAR )v: INTEGER; &BEGIN )v := GetCtlValue(whichControl)+amount; )SetCtlValue(whichControl,v); )If whichControl = dial1 THEN ,SetPitch(1,v) )ELSE If whichControl = dial2 THEN ,SetPitch(2,v) )ELSE If whichControl = dial3 THEN ,SetPitch(3,v) )ELSE If whichControl = dial4 THEN ,SetPitch(4,v) )ELSE ,BEGIN /If v < 0 then v := 0 /Else If v > 7 then v := 7; /SetsoundVol(v) ,END &END; #PROCEDURE ScrollUp(whichControl: ControlHandle; theCode: INTEGER); &BEGIN )IF theCode=inUpButton THEN BumpDial(whichControl,-1); &END; #PROCEDURE ScrollDown(whichControl: ControlHandle; theCode: INTEGER); &BEGIN )IF theCode=inDownButton THEN BumpDial(whichControl,1); &END; #PROCEDURE PageUp(whichControl: ControlHandle; theCode: INTEGER); &BEGIN )IF theCode=inPageUp THEN ,IF whichControl<>dialV THEN /BumpDial(whichControl,-200) ,ELSE /BumpDial(whichControl,-1) &END; #PROCEDURE PageDown(whichControl: ControlHandle; theCode: INTEGER); &BEGIN )IF theCode=inPageDown THEN ,IF whichControl<>dialV THEN /BumpDial(whichControl,200) ,ELSE /BumpDial(whichControl,1); &END; #PROCEDURE DrawTheWave(theWave: Wave); &VAR )I,J: INTEGER; &BEGIN )EraseRect(thePort^.portRect); )FOR I := 0 TO 255 DO ,BEGIN ,J := 255-theWave[I]; ,SetRect(tempRect,I,J,I+1,J+1); ,PaintRect(tempRect); ,END; &END; #PROCEDURE DrawWaveFolder; &BEGIN )SetPort(waveWindow); )CASE whichWave OF )1: ,DrawTheWave(wave1); )2: ,DrawTheWave(wave2); )3: ,DrawTheWave(wave3); )4: DrawTheWave(wave4) )END {case} &END; #PROCEDURE SetNewPt(VAR theWave: Wave; myPt: Point); &VAR )h,v,J: INTEGER; &BEGIN )h := myPt.h; v := myPt.v; )IF (h<0) OR (h>255) THEN EXIT(SetNewPt); )IF (v<0) OR (v>255) THEN EXIT(SetNewPt); )IF v=theWave[h] THEN EXIT(SetNewPt); )J := 255-theWave[h]; )SetRect(tempRect,h,J,h+1,J+1); )EraseRect(tempRect); )tempRect.top := v; tempRect.bottom := tempRect.top+1; )PaintRect(tempRect); )theWave[h] := 255-v; &END; #PROCEDURE EditTheWave(VAR theWave: Wave); &VAR )lastX,lastY: INTEGER; )I: INTEGER; )thePt: Point; &BEGIN )GetMouse(myPt); )lastX := myPt.h; lastY := myPt.v; )WHILE StillDown DO ,BEGIN ,GetMouse(myPt); ,IF myPt.h=lastX THEN /SetNewPt(theWave,myPt) ,ELSE IF myPt.hmyPt.h; /END; ,lastX := myPt.h; lastY := myPt.v; ,END; &END; #PROCEDURE EditWaveForm; &BEGIN )SetPort(waveWindow); )CASE whichWave OF )1: ,EditTheWave(wave1); )2: ,EditTheWave(wave2); )3: ,EditTheWave(wave3); )4: EditTheWave(wave4) )END {case} &END; #PROCEDURE ChangeTheWave(which: INTEGER; VAR theWave: Wave); &BEGIN )CASE which OF )1: ,Triangle(theWave); )2: ,Square(theWave); )3: ,mysine(theWave); )4: ,CopyWave(wave1,theWave); )5: ,CopyWave(wave2,theWave); )6: ,CopyWave(wave3,theWave); )7: CopyWave(wave4,theWave) )END; {case} )DrawWaveFolder; &END; #PROCEDURE ChangeWave(which: INTEGER); &BEGIN )CASE whichWave OF )1: ,ChangeTheWave(which,wave1); )2: ,ChangeTheWave(which,wave2); )3: ,ChangeTheWave(which,wave3); )4: ChangeTheWave(which,wave4) )END {case} &END; #PROCEDURE InitWave; &BEGIN )Triangle(wave1); )Square(wave2); )mysine(wave3); )Triangle(wave4); &END; #BEGIN &InitGraf(@thePort); &InitFonts; &FlushEvents(everyEvent,0); &InitWindows; &SetUpMenus; &SetRect(fullRect,0,20,512,342); &title1 := 'Channel A WaveForm'; &title2 := 'Channel B WaveForm'; &title3 := 'Channel C WaveForm'; &title4 := 'Channel D WaveForm'; &buildSinWave; &MakeTheFolder; &SetPort(theFolder); &MakeTheDials; &LabelControls; &GetSoundVol (UserVol); {save and restore--hope user doesn't use control panel} &doneFlag := FALSE; &SoundTblPtr := @MySynthRec; &SoundTblPtr^.mode := ftMode; &SoundTblPtr^.sndRec := @MySoundRec; &InitWave; &DrawWaveFolder; &SetsoundVol(0); {minimize pop} &InitSTab; &StartSound(Pointer(soundTblPtr),SizeOf (FTSynthRec),NIL); &SetsoundVol(7); &offSwitch := FALSE; &whichWave := 1; &CheckItem(myMenu,1,TRUE); &InitCursor; &REPEAT )SystemTask; )soundTblPtr^.sndRec^.duration := 8192; )IF GetNextEvent(everyEvent,myEvent) THEN ,CASE myEvent.what OF /mouseDown: 2BEGIN 2code := FindWindow(myEvent.where,whichWindow); 2myPt := myEvent.where; 2WITH whichWindow^.portBits.bounds DO 5BEGIN 5myPt.h := myPt.h+left; 5myPt.v := myPt.v+top; 5END; 2Case code of 2inMenuBar: 5BEGIN 5theMenu := 0; theItem := 0; {???} 5mResult := MenuSelect(myEvent.where); 5theMenu := HiWord(mResult); theItem := LoWord(mResult); 5IF (theItem>0) THEN 8CASE theMenu OF 8256: ;BEGIN ;CheckItem(myMenu,whichWave,FALSE); ;CheckItem(myMenu,theItem,TRUE); ;IF whichWave<>theItem THEN >BEGIN >CASE theItem OF >1: ASetWTitle(waveWindow,title1); >2: ASetWTitle(waveWindow,title2); >3: ASetWTitle(waveWindow,title3); >4: SetWTitle(waveWindow,title4) >END; {case} >whichWave := theItem; >DrawWaveFolder; >END ;END; 8257: ;ChangeWave(theItem); 8258: ;IF offSwitch THEN >BEGIN >StartSound(Pointer(soundTblPtr), ISizeOf (FTSynthRec),NIL); >offSwitch := FALSE; >SetItem(menu3,1,'Sound Off'); >END ;ELSE >BEGIN >GetSoundVol (I); >SetSoundVol (0); {minimize pop} >StopSound; >SetSoundVol (I); {restore volume} >offSwitch := TRUE; >SetItem(menu3,1,'Sound On'); >END; 81: ;BEGIN ;GetItem(deskMenu,theItem,myString); ;refNum := OpenDeskAcc(myString) ;END 8END; {case} 5HiLiteMenu(0); 5END; { onMenuBar } 2inDesk: 5BEGIN 5END; 2inDrag: 5DragWindow(whichWindow,myEvent.where,fullRect); 2inGoAway: 5BEGIN 5IF TrackGoAway(whichWindow,myEvent.where) THEN 8doneFlag := TRUE; 5END; 2inSysWindow: 5SystemClick(myEvent,whichWindow); 2inContent: 5BEGIN 5IF topWindow<>whichWindow THEN 8BEGIN 8SelectWindow(whichWindow); 8topWindow := whichWindow; 8END 5ELSE IF whichWindow=waveWindow THEN 8EditWaveForm 5ELSE 8BEGIN 8code := FindControl(myPt,whichWindow,whichControl); 8CASE code OF 8inUpButton: ;t := TrackControl(whichControl,myPt,@ScrollUp); 8inDownButton: ;t := TrackControl(whichControl,myPt,@ScrollDown); 8inPageUp: ;t := TrackControl(whichControl,myPt,@PageUp); 8inPageDown: ;t := TrackControl(whichControl,myPt,@PageDown); 8inThumb: ;BEGIN ;code := TrackControl(whichControl,myPt,NIL); ;BumpDial(whichControl,0); ;END 8END {case} 8END 5END 2END {of case code} /END; { of button down } /updateEvt: 2BEGIN 2whichWindow := WindowPtr(myEvent.message); 2SetPort(whichWindow); 2BeginUpdate(whichWindow); 2IF whichWindow=waveWindow THEN 5DrawWaveFolder 2ELSE 5BEGIN 5DrawControls(whichWindow); 5LabelControls; 5END; 2EndUpdate(whichWindow); 2END; {of update event} /OTHERWISE 2BEGIN 2END; ,END; { of event case } &UNTIL doneFlag; &SetSoundVol (0); &StopSound; &SetSoundVol (UserVol); #END. 9PN1N^;*`W%̩0̨zIS'X̩ . . EXxH:>:>#2-CIS'RTEX̨h̨h$3.0only/example/SoundLab.textxxx3.0only/example/SoundLab.te̐Fx"N.8~.8#2-CEX̨hEX̨h8:#IS'RTEX g'̐FLB.:ISTART.TEX /* {$R-} {$X-} PROGRAM SoundDemo; {3.0 only version--uses new Sane library; requires "post-3.0" Pascal compiler} "{ Program to play with the new proto sound } "{ written by Andy Hertzfeld Oct 3, 1982 } "{ modified for 4 voice ROM sound -- Nov 2, 1982 } "{ for ROM 4T -- Jun 18, 1983 } "{ made to run under ToolBox, OSInterfc -- Jan 8, 1983 } "{ changes for new interfaces -- Jun 26, 1984 } "{ Historical note: since this program was written a long, long time ago, %please note that the programming style is a little strange in places. } #USES {$U-} &{$U Obj/Memtypes } Memtypes, &{$U Obj/QuickDraw } QuickDraw, &{$U Obj/OSIntf } OSIntf, &{$U Obj/ToolIntf } ToolIntf, &{$U Obj/SaneLib } SANE; #VAR &tempRect: Rect; &mousePt,myPt: Point; &myEvent: EventRecord; &theFolder: WindowPtr; &doneFlag: Boolean; &theMenu,theItem: INTEGER; &code: INTEGER; &whichWindow: WindowPtr; &whichControl: ControlHandle; &folRect: Rect; &mBox: Rect; &dial1,dial2,dial3,dial4: ControlHandle; &dialV: ControlHandle; &fullRect: Rect; &UserVol: Integer; &soundTblPtr: FTSynthPtr; &MySoundRec: FTSoundRec; {fixed size, so no reason to allocate on heap} &MySynthRec: FTSynthRec; {fixed size, so no reason to allocate on heap} &wave1,wave2,wave3,wave4, sinWave: Wave; &t,I: INTEGER; &waveWindow,topWindow: WindowPtr; &whichWave: INTEGER; &myMenu,menu2,menu3,deskMenu: MenuHandle; &mResult: LongInt; &title1,title2,title3,title4: Str255; &offSwitch: Boolean; &myString: Str255; &refNum: INTEGER; #PROCEDURE SetUpMenus; #{once only initialization for menus} &VAR )I: INTEGER; )menuFile: Text; )drvrType: ResType; &BEGIN )InitMenus; {initialize Unit Menus} )drvrType := 'DRVR'; )myMenu := GetMenu(256); )menu2 := GetMenu(257); )menu3 := GetMenu(258); )deskMenu := GetMenu(1); )AddResMenu(deskMenu,drvrType); )InsertMenu(deskMenu,0); )InsertMenu(myMenu,0); )InsertMenu(menu2,0); )InsertMenu(menu3,0); )DrawMenuBar; &END; #PROCEDURE MakeTheFolder; #{ set up and draw one folder } &VAR )tempRect: Rect; )folName: Str255; )tempPt: Point; &BEGIN )theFolder := GetNewWindow(1,NIL,NIL); )waveWindow := GetNewWindow(2,NIL,theFolder); )topWindow := theFolder; &END; #PROCEDURE MakeTheDials; &VAR )tempRect: Rect; &BEGIN )SetRect(mBox,120,30,280,46); )dial1 := NewControl(theFolder,mBox,' ',TRUE,0,0,8191,ScrollBarProc,1); )SetRect(mBox,120,60,280,76); )dial2 := NewControl(theFolder,mBox,' ',TRUE,0,0,8191,ScrollBarProc,2); )SetRect(mBox,120,90,280,106); )dial3 := NewControl(theFolder,mBox,' ',TRUE,0,0,8191,ScrollBarProc,3); )SetRect(mBox,120,120,280,136); )dial4 := NewControl(theFolder,mBox,' ',TRUE,0,0,8191,ScrollBarProc,4); )SetRect(mBox,76,160,256,192); )dialV := NewControl(theFolder,mBox,' ',TRUE,7,0,7,ScrollBarProc,5); &END; #PROCEDURE LabelControls; &BEGIN )MoveTo(30,42); )DrawString('Channel A'); )MoveTo(30,72); )DrawString('Channel B'); )MoveTo(30,102); )DrawString('Channel C'); )MoveTo(30,132); )DrawString('Channel D'); )MoveTo(140,208); )DrawString('Volume'); &END; #PROCEDURE Triangle(VAR theWave: Wave); #{ make a simple triangle wave } &VAR )I: INTEGER; &BEGIN )FOR I := 0 TO 127 DO ,BEGIN ,theWave[I] := 2*I; ,theWave[255-I] := 2*I; ,END; &END; #FUNCTION sineval (period: INTEGER): INTEGER; #CONST Increment = pi*2/256; {2 pi = waveform period; 256 samples} #VAR newval, holder: extended; #BEGIN &sineval := Num2Integer ((sin(period * Increment) * 128) + 128); #END; #PROCEDURE buildSinWave; #VAR Index : Integer; &BEGIN )SetRound (Downward); )For Index := 0 to 255 DO ,BEGIN /SinWave[Index] := sineval (Index); ,END; &END; #PROCEDURE mysine(VAR sine: Wave); #BEGIN &Sine := sinWave; #END; #PROCEDURE Square(VAR theWave: Wave); #{ make a simple square wave } &VAR )I: INTEGER; &BEGIN )FOR I := 0 TO 127 DO ,BEGIN ,theWave[I] := ord (255); { ord() is needed because of compiler bug, Gfixed in version 3.0 } ,theWave[255-I] := 0; ,END; &END; #PROCEDURE CopyWave(VAR src,dst: Wave); &VAR )I: INTEGER; &BEGIN )FOR I := 0 TO 255 DO dst[I] := src[I]; &END; #PROCEDURE InitSTab; &VAR )l: LongInt; &BEGIN )WITH soundTblPtr^.sndRec^ DO ,BEGIN ,duration := 8192; ,l := 256; ,sound1Rate := l*GetCtlValue(dial1); ,sound1Phase := 0; ,sound2Rate := l*GetCtlValue(dial2); ,sound2Phase := 0; ,sound3Rate := l*GetCtlValue(dial3); ,sound3Phase := 0; ,sound4Rate := l*GetCtlValue(dial4); ,sound4Phase := 0; ,sound1Wave := @wave1; ,sound2Wave := @wave2; ,sound3Wave := @wave3; ,sound4Wave := @wave4; ,END &END; #PROCEDURE SetPitch(voiceIndex: INTEGER; pitch: INTEGER); &VAR )l: LongInt; &BEGIN )l := 256; )WITH soundTblPtr^.sndRec^ DO ,BEGIN ,CASE voiceIndex OF /1: sound1Rate := l*pitch; /2: sound2Rate := l*pitch; /3: sound3Rate := l*pitch; /4: sound4Rate := l*pitch ,END ,END &END; #PROCEDURE BumpDial(whichControl: ControlHandle; amount: INTEGER); &VAR )v: INTEGER; &BEGIN )v := GetCtlValue(whichControl)+amount; )SetCtlValue(whichControl,v); )If whichControl = dial1 THEN ,SetPitch(1,v) )ELSE If whichControl = dial2 THEN ,SetPitch(2,v) )ELSE If whichControl = dial3 THEN ,SetPitch(3,v) )ELSE If whichControl = dial4 THEN ,SetPitch(4,v) )ELSE ,BEGIN /If v < 0 then v := 0 /Else If v > 7 then v := 7; /SetsoundVol(v) ,END &END; #PROCEDURE ScrollUp(whichControl: ControlHandle; theCode: INTEGER); &BEGIN )IF theCode=inUpButton THEN BumpDial(whichControl,-1); &END; #PROCEDURE ScrollDown(whichControl: ControlHandle; theCode: INTEGER); &BEGIN )IF theCode=inDownButton THEN BumpDial(whichControl,1); &END; #PROCEDURE PageUp(whichControl: ControlHandle; theCode: INTEGER); &BEGIN )IF theCode=inPageUp THEN ,IF whichControl<>dialV THEN /BumpDial(whichControl,-200) ,ELSE /BumpDial(whichControl,-1) &END; #PROCEDURE PageDown(whichControl: ControlHandle; theCode: INTEGER); &BEGIN )IF theCode=inPageDown THEN ,IF whichControl<>dialV THEN /BumpDial(whichControl,200) ,ELSE /BumpDial(whichControl,1); &END; #PROCEDURE DrawTheWave(theWave: Wave); &VAR )I,J: INTEGER; &BEGIN )EraseRect(thePort^.portRect); )FOR I := 0 TO 255 DO ,BEGIN ,J := 255-theWave[I]; ,SetRect(tempRect,I,J,I+1,J+1); ,PaintRect(tempRect); ,END; &END; #PROCEDURE DrawWaveFolder; &BEGIN )SetPort(waveWindow); )CASE whichWave OF )1: ,DrawTheWave(wave1); )2: ,DrawTheWave(wave2); )3: ,DrawTheWave(wave3); )4: DrawTheWave(wave4) )END {case} &END; #PROCEDURE SetNewPt(VAR theWave: Wave; myPt: Point); &VAR )h,v,J: INTEGER; &BEGIN )h := myPt.h; v := myPt.v; )IF (h<0) OR (h>255) THEN EXIT(SetNewPt); )IF (v<0) OR (v>255) THEN EXIT(SetNewPt); )IF v=theWave[h] THEN EXIT(SetNewPt); )J := 255-theWave[h]; )SetRect(tempRect,h,J,h+1,J+1); )EraseRect(tempRect); )tempRect.top := v; tempRect.bottom := tempRect.top+1; )PaintRect(tempRect); )theWave[h] := 255-v; &END; #PROCEDURE EditTheWave(VAR theWave: Wave); &VAR )lastX,lastY: INTEGER; )I: INTEGER; )thePt: Point; &BEGIN )GetMouse(myPt); )lastX := myPt.h; lastY := myPt.v; )WHILE StillDown DO ,BEGIN ,GetMouse(myPt); ,IF myPt.h=lastX THEN /SetNewPt(theWave,myPt) ,ELSE IF myPt.hmyPt.h; /END; ,lastX := myPt.h; lastY := myPt.v; ,END; &END; #PROCEDURE EditWaveForm; &BEGIN )SetPort(waveWindow); )CASE whichWave OF )1: ,EditTheWave(wave1); )2: ,EditTheWave(wave2); )3: ,EditTheWave(wave3); )4: EditTheWave(wave4) )END {case} &END; #PROCEDURE ChangeTheWave(which: INTEGER; VAR theWave: Wave); &BEGIN )CASE which OF )1: ,Triangle(theWave); )2: ,Square(theWave); )3: ,mysine(theWave); )4: ,CopyWave(wave1,theWave); )5: ,CopyWave(wave2,theWave); )6: ,CopyWave(wave3,theWave); )7: CopyWave(wave4,theWave) )END; {case} )DrawWaveFolder; &END; #PROCEDURE ChangeWave(which: INTEGER); &BEGIN )CASE whichWave OF )1: ,ChangeTheWave(which,wave1); )2: ,ChangeTheWave(which,wave2); )3: ,ChangeTheWave(which,wave3); )4: ChangeTheWave(which,wave4) )END {case} &END; #PROCEDURE InitWave; &BEGIN )Triangle(wave1); )Square(wave2); )mysine(wave3); )Triangle(wave4); &END; #BEGIN &InitGraf(@thePort); &InitFonts; &FlushEvents(everyEvent,0); &InitWindows; &SetUpMenus; &SetRect(fullRect,0,20,512,342); &title1 := 'Channel A WaveForm'; &title2 := 'Channel B WaveForm'; &title3 := 'Channel C WaveForm'; &title4 := 'Channel D WaveForm'; &buildSinWave; &MakeTheFolder; &SetPort(theFolder); &MakeTheDials; &LabelControls; &GetSoundVol (UserVol); {save and restore--hope user doesn't use control panel} &doneFlag := FALSE; &SoundTblPtr := @MySynthRec; &SoundTblPtr^.mode := ftMode; &SoundTblPtr^.sndRec := @MySoundRec; &InitWave; &DrawWaveFolder; &SetsoundVol(0); {minimize pop} &InitSTab; &StartSound(Pointer(soundTblPtr),SizeOf (FTSynthRec),NIL); &SetsoundVol(7); &offSwitch := FALSE; &whichWave := 1; &CheckItem(myMenu,1,TRUE); &InitCursor; &REPEAT )SystemTask; )soundTblPtr^.sndRec^.duration := 8192; )IF GetNextEvent(everyEvent,myEvent) THEN ,CASE myEvent.what OF /mouseDown: 2BEGIN 2code := FindWindow(myEvent.where,whichWindow); 2myPt := myEvent.where; 2WITH whichWindow^.portBits.bounds DO 5BEGIN 5myPt.h := myPt.h+left; 5myPt.v := myPt.v+top; 5END; 2Case code of 2inMenuBar: 5BEGIN 5theMenu := 0; theItem := 0; {???} 5mResult := MenuSelect(myEvent.where); 5theMenu := HiWord(mResult); theItem := LoWord(mResult); 5IF (theItem>0) THEN 8CASE theMenu OF 8256: ;BEGIN ;CheckItem(myMenu,whichWave,FALSE); ;CheckItem(myMenu,theItem,TRUE); ;IF whichWave<>theItem THEN >BEGIN >CASE theItem OF >1: ASetWTitle(waveWindow,title1); >2: ASetWTitle(waveWindow,title2); >3: ASetWTitle(waveWindow,title3); >4: SetWTitle(waveWindow,title4) >END; {case} >whichWave := theItem; >DrawWaveFolder; >END ;END; 8257: ;ChangeWave(theItem); 8258: ;IF offSwitch THEN >BEGIN >StartSound(Pointer(soundTblPtr), ISizeOf (FTSynthRec),NIL); >offSwitch := FALSE; >SetItem(menu3,1,'Sound Off'); >END ;ELSE >BEGIN >GetSoundVol (I); >SetSoundVol (0); {minimize pop} >StopSound; >SetSoundVol (I); {restore volume} >offSwitch := TRUE; >SetItem(menu3,1,'Sound On'); >END; 81: ;BEGIN ;GetItem(deskMenu,theItem,myString); ;refNum := OpenDeskAcc(myString) ;END 8END; {case} 5HiLiteMenu(0); 5END; { onMenuBar } 2inDesk: 5BEGIN 5END; 2inDrag: 5DragWindow(whichWindow,myEvent.where,fullRect); 2inGoAway: 5BEGIN 5IF TrackGoAway(whichWindow,myEvent.where) THEN 8doneFlag := TRUE; 5END; 2inSysWindow: 5SystemClick(myEvent,whichWindow); 2inContent: 5BEGIN 5IF topWindow<>whichWindow THEN 8BEGIN 8SelectWindow(whichWindow); 8topWindow := whichWindow; 8END 5ELSE IF whichWindow=waveWindow THEN 8EditWaveForm 5ELSE 8BEGIN 8code := FindControl(myPt,whichWindow,whichControl); 8CASE code OF 8inUpButton: ;t := TrackControl(whichControl,myPt,@ScrollUp); 8inDownButton: ;t := TrackControl(whichControl,myPt,@ScrollDown); 8inPageUp: ;t := TrackControl(whichControl,myPt,@PageUp); 8inPageDown: ;t := TrackControl(whichControl,myPt,@PageDown); 8inThumb: ;BEGIN ;code := TrackControl(whichControl,myPt,NIL); ;BumpDial(whichControl,0); ;END 8END {case} 8END 5END 2END {of case code} /END; { of button down } /updateEvt: 2BEGIN 2whichWindow := WindowPtr(myEvent.message); 2SetPort(whichWindow); 2BeginUpdate(whichWindow); 2IF whichWindow=waveWindow THEN 5DrawWaveFolder 2ELSE 5BEGIN 5DrawControls(whichWindow); 5LabelControls; 5END; 2EndUpdate(whichWindow); 2END; {of update event} /OTHERWISE 2BEGIN 2END; ,END; { of event case } &UNTIL doneFlag; &SetSoundVol (0); &StopSound; &SetSoundVol (UserVol); #END. 5END; 2EndUpdate(whichWindow); 2END; {of update event} /OTHERWISE 2BEGIN 2END; ,END; { of event case } &UNTIL doneFlag; &SetSoundVol (0); &StopSound; &SetSoundVol (UserVol); #END. hPASLIB UCLASCAL/IOPRIMIT8SHELLCOM9PROGCOMM:STDUNIT XIUMAN ZOBJIO [FILEIO \GRAPHS ^TREES _REFS `PARTS aLISTS bMEMMAN cPASDEFS dBLKIOINTfBLOCKIO gPASHEAP h (Rp 0d;f&NNNN'nN-NNNNNN$NNHNNNVN:NN`PASLIB1 PASIOLIB`SgPASinibSULib cObjIOLibdMainProg p"NV,_NUx"8+O+NB"H+_|NJfN`B-Bg m/HmHzHzHzHzN g<N m h+Hx mx/A/A/A/( m0(ANBg` g mB m+hJflBgN.m,m -|/","N]" NuN^NuROCNAME<ProcNames/FnameListPROCNAMES.HELP.TEXTInput File (?): JoNVH:. (md|~`D"n i0S@A0p@ l2SAC"A p2SAC0pA@gBRG Gog l0S@A @ p;h;ELN^ _\ONINDUNAMJoNVH(md|~`F"n i0S@A0p@ l2. 4SBEA p2SAC0pA@gBRG Gog l0. 2SAC@ p;hLN^ _\ONINDTHISJoNVH:. (n&md k0S@A @ p0(mfb|~`<0S@A4p@ k2SAC"A p2SAC0pA@gBRG Gog0S@A A@!LN^ _\ONETFLOC JoNV md h0. 2SAC@ p0(mf0. 2SACA@BN^ _\ONOINTERFJo*NV(H&n(md g8 mhB(HlA?<O"/BgJ_nTBgBg<BgBg4BmHz/~`0S@A A@r!RG Go/,<HgBmHz/JmV2-ʲmVg0-2SACA@JoJ l0-2SAC@ p?<P"/0-2SACA@/0A g/ PN`0-2SACA@ fzHl l0-2SAC@ p?<O"/BgJ_n/,Hn .f~/,Hn .WJ.W .%Wg .fB=n(~`0/,<HnAC -nHz/RGin(o` Hz/`:Hz l0-2SAC@/0Hn*?<" A*?<O"//,<H` HzL/0-2SACA@JoF l0-2SAC@ p?<P"/0-2SACA@/0A g/ PNLN^ _NNTRININBad object file: hMainProgProcName0dJoNV/.<N. g>p*k|nAl2IDA0 <f ~`/- m\(?<xRG G2oN.N^ _TONTOP JoNVH&m(k,gBg@g<N\B,0+A0 gR0,RR@9@R0,Xlo/+-g: lT0,X0A Ao lT0,X"lT2,X1B|B- lT0,X0AJAf /+,`0+@A1X0+AB0 lT0,X0A Af 0,XT@9@X,g- g ko Bg`f lT0,X0A;A0,XR@9@X0-kf|`.0-kf||;| `0,Xlo|LN^NuEXTCHARJoNVB- -l@-HR@@-H mam mzn 0-| ;@-HN0-k|nAp2IDA0 <g--mm`.-H -H -HS@@--fN^NuEADID  JoNVH(mN0-k|onAP2IDA0 <g0-k8?,֠"Ar? SAn?<"2ISAAn2IDAW7 <gN ` m+V m-VgBG m fN`0-k8?,֠"Ar? SAn?<"2ISAAn2IDAW7 <gRG AN`pAA/  < JoNVH(n(l&mN 0-k|onAJ2IDA0 <g0-k8?+֠"Ar? SAn?<"2ISAAn2IDAW7 <gN` m fBG m fN`0-k8?+֠"Ar? SAn?<"2ISAAn2IDAW7 <gRG AN8`pA0-kg&A/0-HR@@A20SA<G\,g\A @ECp VgRG` Gl~/-pHz?|/-p?<[h/-pA/Bgx/-p?<]hHlHm"gBACp@ S@n mpp0h> Gl~/-pHzl?|/-pA/Bgx&mp +g"pAb/- HkbBg/- /-p m?(֠hLN^ _\ONRITEPRO %_CR0000 JoNV/|| m;V - VgN ` - f.~- JG^gN - fRG` m)fSG`NN -V -V -Vg| `&B. -W -Wg Bg/.NNJB-.N^.NuROCHDR JoNVH(n&m\ -gp -W-2-RAmWgN`J/- /- +?<x/- HzBg/- HlBg/- /- |`~N -W -WgRG`V -gL/- /- +?<x/- Hz`Bg/- HlBg/- /- |`SGJG_-@g- gNLN^.NuCANBODY.*** END expected in *** BEGIN expected in JoNVN- -Hk|nAd4JDB0 <Wg -f-gN`/.N -Hk|nA2IDA0 <f8NX- -Hk|nA4JDB0 <WgN&` -f2-  -VgN`-  -WgN-Hk|nA2IDA0 <f.0-k|nAb2IDA0 <gN`NpN` - f- gN0-mN^.NuCANINTE CJoNVH(m|zBg/. d>JGoB,z|{Bg/. d>B,zB,{=GLN^ _PONPENOBJFJoNVH&m0+AB-||NN - f n h/(N0+A0 g(k0,XU@>0+@A:0 lT0P@ @fTE|G]"g0 lT0p@ @eW lT0pA AEWgB`SG`  g0_G|G_"g lT0p@ @ gB`SG`ܺGnR`$/-pHzR nHhHn?<" HnĠtBg` g<Nv|B-LN^.NuROCESSIINTERFACE expected in JoNVH(n&l lob0,Hl0,HH@J@9@ m hHhHl?<?, _g /-pHzPHkHn?<" HnĠt0,A0A>RlJGl|=G LN^.NuEXTBYTEError reading USES file ofJoNVHBG=n |` @/Bg/.N 2 >@RFino=GLN^ _\ONEXTINT JoNVH nCJ""(mJ f=|=|Bg/N>`z/. /<" =@/. /<" =@ lHhHn?<?. _g$/-pHzH nHhHn?<" Hnt=nBg/N*> Gf GfBg?</N8|~`6p@/Bg/N2 @gBRG GogNBg?</N:Bg?</N:Bg?</N0H=@/,?. l|`f n| =@Bg/Nx>`T`F GWJ WgBg?</N 8|~`6p@/Bg/N62 @gBRG GogBg?</N:Bg?</N0H=@Jnf^Bg/N:Bg?</N:Bg?</N:Bg?</N:/,?./, l1nX l|`0/,?. l|` n| =@Bg/Nf> GV@g`( GW GWgBBg?</N8 Gf|~`Bg/N=_6p@ngBRG Gog DoBg?</N:Bg?</N:Bg?</N:Bg?</N:Bg?</Nz:/,?./, l|0.nf l1nX`J0.| l1@X`8`B`2QD nY@=@Bg/NF>=nJGW"Ag`BFLN^ _ NINDUNITError reading USES file ofJoNV nCJp"S@n2HnHn.@R@?"LBgHn/.NJ_n,Bg nHh/. /.Ng/.N n|N^ _ NEADINTEJoNVH n CJp"S@nHnHn?<"L~` 6pARG GopA/Procedure/Function names for 0\MainProgToolsPri&JoNV nB( n,HNN^.NuIE JoNVH(n&m\/- HzBg,@J@o/- HzBg/- HzBgB-JBmlAJ/Bg?<"`?< "?< T?+"?+""Ap? S@n?<"?< "?< THn?<N! n?fj/- <??<x/- HlHlN /- HzBg,@J@o/- HzBg/- HzBg/- HmJBg`/- 0.kf/.N0.kf -J@: R@AJB0 T@AJB0~ ml]AJ0pAJAVgAJ0p@ @ fRG`AJ0p@J@gRml0-lA @1<xB.AJ0p@k6Bg"Ar? SAn?<"2ISAAn2IDAW7 <gAJ0p@=@ n~W"RAAJ0BJBVg:RGAJ0p@=@ nnf AJ"m` AJ`(g nWD@ AJRGRFB` AJB0RG.g0-lA @20AJ0@=@0-lA @RpBg?-lA/N _Sml nHlHz.N~ g/.N4`LN^.NuETARGS ZstdoutSTDOUT: -consolestdinSTDIN: : [? for help] Parameter(s)JoNVHB"H-_ n CJp@"S@n nCJp@"S@n$B.B-JB-KBtBpBgBgHzHmtBgB0Hzʠ(g/NFBgBgHzHmp<B0Hz(g/NB-oB-nBml.g/N6ALC6p S@n|O ./",LN^ _ NNITTOOLRCannot open StdOut.-CONSOLECannot open StdIn.JoNV. gHn,.g/- /- Hz Bg/- N^.NuNDTOOL That's all folks!JoNVH nCJp@"S@n n CJp@"S@n&n(m\=|a`0.| <0.k|nA42IDA0 <f6A4p? S@n?< ?""?< "?< TAp0S@n`T0k|nA42IDA0 <f6A4p? S@n?< ?.""?< "?< TAp0S@nRn nzo@B.BG=|A`20.k|nA 2IDA0 <fRG ARn nZoBn`R0.k|nA 2IDA0 <f.0.k|nAx2IDA0 <gRG ARn nopAA"Kp"S@n/- Hz Bg.@J@o/- HzBg/- HzBg/- HnBgA/A4p? S@n?< ?< "?< T?,"?,""Ap? S@n?< "?< "?< THn?<N$0.lf/- B.4` n?fl/- <??<x/- HnHnNL/- HzBg.@J@o/- HzBg/- HzBg/- HnBg`N n\fx.@=@~`4/- ,?<x/- < ?<x/- ,?<xRGino/- HzNBg/- A"Kp"S@n=l`z.@>`A0p@<0k|nA2IDA0 <f | <A p? S@n?< ?"A0p@?"""?< "?< T Kp0S@n/- ,?<x/- ?<x/- ,?<xSG GlN/- 0.lf|4LN^ _,NETOPTIO: [? for help]OptionsJoNVH&n(k, ,@ +@J@opA0A A)fACp@ S@nA/,  )I JoNVH n CJp@"S@n(nA/`*BgHn0.@AHpBg0.@A/00>Bg?HzHnHn?<" Hn(g |`Bg0.@A/0A/ , gnBg/N gZ|Rl lf(9|/- HzlBgBg< @, g/- HnBg/- `n0.@A/0BgLN^ _ NISTIT More? Cannot open .textJoNVH n CJp@"S@n nCJp@"S@n(m\/- A/<.@J@f*/- ,?<x/- HzBg/- `NHn~`* @AHp?< @AHp?< RG GoA/0|AJ0p@J@g n CJ1pARGRF` np"SA|LN^ _\ONETARG JoNVH nCJp@"S@n nCJp@"S@n nCJp@"S@n nCJp@"S@n n CJp@"S@n&n(m\Bg?."/ Ng |$`jB.$pB3HnHz"gD/- ,?<x/- HzlBg/- 0."H/?<|/- Hz?<x/- .f:(_N^ _NETFROMUH$[.TEXT] n Hk|`B@0-Jg?<PB-JHk|gHk|h n 0 n 0lfLJGf/- ,?<x`2SG/- ,?<x/- < ?<x/- ,?<x` n 0k|nA.2IDA0 <gb n 0k|nAN2IDA0 <Vn\g/- ,?<x`$/- n (?<xRG F "n  n 0k|nA.2IDA0 <f FpLN^ _JNEADKEYBJoNV/ (n||||||||||||(_N^.NuNITDAYSJoNV"n i0. 2.H |0"n i0. R@2.H HAJA|0N^ _PONETDIGITJoNVH/N,HnHn"Jng$ACp S@n0/.A/$`ACp S@n0/.A/$<.0.HdH@J@:.H??< /N.H??< /N.H??</N~ HH@J@J@f|6pHFl 6pH@RG`|??</N??</N??</NLN^.NuETTD $MM/DD/YY HH:MM:SSGet_Time Error!!!&t hPASLIB UCLASCAL/IOPRIMIT8SHELLCOM9PROGCOMM:STDUNIT XBLKIOINTfBLOCKIO gPASHEAP hB]8(JyNv*NPASLIB1 PASIOLIB`SgPASinibSULib cMainProg ]8yJoNVHn,N^NuILLEXECJoNV n CJp@"S@nN/- /- pA?<x/- HzBg/- HnBg/- JngXHz?.A//- HzBg/- 0.H/?<|/- HzBg/- HnBg/- /- Hz\BgHn m\?("ABp? S@n?<"?< "?< TNw&N^ _\ONATALERRLType CLEAR or SPACE to abort.: Error # OsErrs.ErrFatal error. JoNV nCJp@"S@nNb/- /- pA?<x/- HzPBg/- HnBg/- HnT .fNvTB-/- N^.NuRROR Error. JoNV/>JGoHmԠ8Hz?N.N^NuHKHEAPE(&Out of memory (too much resource data)JoNVJ.f /- `.-g/- nN^ _TONINESPACJoNV nAm0.| |A=@ ` 0.|0=@ N^ _TONNUM JoNV nA\ nF_ n0\ n9_g| `B. N^ _TONHECKHEXJoNVH nBB.=| |Hm0 g|Hm0Hn?<pHm0h.@J@fB`NpA0A A*g8B~.@Gm&pOA0pAAOA0p@ @\f.@"TA@oHz(BgN`Bg R@AA0A?NBg T@AA0A?Ng\p/Bg"RACA0B?NB2 AHBg$TBEA0 C?N4LAEA` HzdBgN^TG n//.HnHn?<" _Cp@ S@nRG``t n@J@VD@ LN^.NuYGETLN @hex digit expected after \"\ must be followed by 2 Hex digitsJoNVHm0g Hz&BgNBg/.N_ N^.NuCREADLNPremature end of fileJoNVBg/.NgN^.NuCEREADLJoNV/Hm|?<N.BxBm&Hm(Hm?<@>JGg.HzLHmHz4Hn?<" A?<"/?N.N^NuMINITFI0" (in InitFile)REWRITE Error trying to open "JoNVHJxgN -xм//<" <Hm(/-|??-&;_>JGVmVg HzV?N@Hm(?<>JGg Hz?N LN^NuMCLOSEF<CLOSE Error (in CloseFile)BLOCKWRITE Error (in CloseFile)JoNV n l/- 0. |0A?<x`/- 0. |7A?<xN^ _\ONRITEDIGJoNV0.H?/N0.HH@J@?/NzN^ _TONRITEBYTJoNV/R-g` m|0-zA2.CRx-g>?.N~-{@ g/- < ?<x/-xp /"Jf/- xfBHm(/-|?<@?-&;_>JGV m@Vg Hz&?N~m@&Bx.N^ _TONUTPUTBY" BLOCKWRITE Error (in OutputByte)JoNVBg?.NpNBg?.NpNN^ _TONUTPUTWOJoNVBg/.NpvNBg/.Np^NN^.NuUTPUTLOJoNVH nCJp@"S@n.@<JFf`(=F~`OA0p@?NRRGinoLN^.NuUTPUTSTJoNVH n CJp@"S@nJf`HnHn?<<8JDg.HzHnHzHn?<" A?<"/?N,.BE oBHnHn?<?=_REBG`OA0p@?NRG Go✼`JoHnHn?<?=_BGJoOA0p@?N>RGS`HnBgLN^ _PONUTPUTFI0" (in OutputFile)RESET Error trying to open "JoNV/ n CJp@"S@nJg*-n~`OA0p@?NRio.N^ _PONUTPUTDAJoNV/Jgn-n~`^ @g*Bg n R/p/" A@?0NnN>`(Bg n R/p/" A@?0NmNRio.N^ _PONUTPUTDBJoNVH xm>Hm(/-|?<@?-&<>JGV F@Vg Hz&?Nm@&BxLN^.NuOOUTPUT BLOCKWRITE Error (in DoOutput)JoNVH,.ݭ-g /N&` m P]J^gh m0<P>H <xl <x>HǼl>A0&H m -xЭ|(@/ / ?"L mPH߭xHǜ/N` mHn?< mH ~o><~x?`//<" 8 >JDo/-,/.? m"?=_H-GBnJoV*. <xl <x*&n -xЭ|(@/ / ?"L0.HЅ=@ۭx/N` m"PHǜ`H <xl <x>A0&H m -xЭ|(@/ / ?"L mPH߭xHǜ/Nb`LN^.NuULKXFERJoNV/ m> Gm*/-,Hm0?< m"?;_ m";P m"RPBGOA00p@=@RG m0.N^NuEADBYTEJoNVBgN0@/BgN|2 @=AN^NuEADWORDJoNVBgNV0H//<"BgN0HП-@N^NuEAD3BYTJoNVBgN0H/</"BgNp0HП-@N^NuEADLONGJoNVH m0H".Ҁ. oT//<" S: m" P<mg/-,Hm0?<?;_;F R@ m"0//<". m0LN^.NuKIPOVERJoNV/ nCJp@"S@n;|A+HBmA+H";|HmHn?<<>JGg.HzVHnHz>Hn?<" A?<"/?NJA+H,.N^.NuPENREAD." (in OpenRead)RESET Error trying to open "JoNV/-,Bg;|N^NuLOSEREAJoNV/ nCJp@"S@nA/Hz?<HnA/LHnHm"gxHmHzԠ"g HmBgHmHn?<<>JGg.HzHnHznHn?<" A?<"/?N.ACp@ S@n;|;|Bm A+H,A +H"A+H.N^.NuPENOBJR6" (in OpenRead)RESET Error trying to open ".OBJJoNVH(n > @ g:,<0.H//", HR@A@/Bg/Nf2 9`" HR@A@2.HHAJAtRTLN^ _\ONAPPENDBJoNV/. Bg?.NfNV/. Bg?.Nf~NDN^ _\ONAPPENDWJoNV/. Bg/.NfHN/. Bg/.Nf,NN^ _PONAPPENDLJoNVH n CJp@"S@n(n.@>.g/ ?NJGo*=G|`/ MA0`@?NRFino n W"A g/ BgNn n W"Ag/ BgNTLN^ _ NAPPENDSJoNV/~`/. 0S@A6p@?NRG Go.N^ _PONAPPENDTJoNV=n nam0.| A=@ N^ _TONPCHAR JoNV/ n CJp@"S@n(n.@J@fB.`4JTf8.@T\2CA0B B WgRT`.@T\D@(_N^ _PONCANTOSTJoNVH nCJp@"S@n(nBT|BgA?<"//. N6 n .@P^gH n 0AA0A A-f | n RP`" n 0AA0A A+f n RP n .@P\ n 2CA0B B Vgp n 0AA0A A0\ n 2CA0B B9_g(~0 n 2CA0B@|08`B n RP`` 8GLN^ _ NETINT JoNVH nCJp@"S@n(nB|BgA?<"//. N n .@P^gH n 0AA0A A-f | n RP`" n 0AA0A A+f n RP n .@P\ n 2CA0B B Vgv n 0AA0A A0\ n 2CA0B B9_g.~p //" n 0AA0AHҟp0(`B n RP`ZH//"(GLN^ _ NETLINT JoNV nCJp@"S@n=| nBBgA?<"//. Nf_ n .@P\ n 2CA0B B VgPp n 2CA0BA n//.HnHn?<" _Cp@ S@n n RP`N^ _ NETSTR JoNVH nCJp@"S@nB.~`pBg n 0S@A0p@?NTOA0p@_g>|`4Bg n 0S@A0`@?N MA0`@_g`RF FoRG Go|LN^ _PONATCHTYPJoNV/| AC ~`0 R@A/Bg n2SAC0pA?N2 RG GoHnHzn"TJ_g`P~`0 R@A/Bg n2SAC0pA?NL2 RG GoHnHz""TJ_g`B. .N^.NuATCHOBJ.$.DRVR.WDEF.MDEF.CDEF.KEYC.DSAT.PACK..1234.JoNVB. N^.NuATCHDEBJoNVH n CJp@"S@nHnHz"gHnHn?<<>JGg.HzHnHzHn?<" A?<"/?NJ_fHnHn?<Bg:HnBg. g0.| 2.@nA<`<.=FLN^ _\ONIZEFONT0" (in SizeFont)RESET Error trying to open "JoNVH n CJp@"S@nA?<"/N`/-,Hn?<?<<0.|n@=@0.[@:0.n8N=n. g`A?<"/N~` BgNN|RG GoBgN<?<Nd~` BgNNVRG GoBgN|<BgN@ @H/N=D~`BgNZN"RGinoNPLN^ _\ONROCESSWJoNVH(nBg?. N>, @,gH0,@G9@p2,CA l//,HlHn?<" _Cp@ S@n`9GLN^ _\ONTUFFDIGJoNV/ nCJp@"S@n nCJp@"S@n|=| nB.@=@~`BgOA0p@?NgOA0p@?/N``OA0p@ @ f`HHzHn??<Hn"HnHzHnHzHn?<" A?<"/BgNRGino` n@n V n Vg2HnHzDHnHz:Hn?<" A?<"/BgNh.N^ _NROCESSHV"!: wrong number of hex digits in "" is invalid in "Non-hex digits in HEXA type: "JoNV/ nCJp@"S@n~|g^Hm0gBHzBgN`BHm0Hn?<pHm0h.@J@fBB.`pA0A A*gB`.@J@g,A?<"//.?. A?<"/N.N^ _ NETHEXLIPremature end of fileJoNV nCJp@"S@nBg/.?. A?<"/NgN^ _ NEGETHEXJoNV/ n CJp"S@n2 nCJp"S@n2B..@.A@g`P.@=@~`4BgO6p@?NBgO6p@?N0_g`RGino|.N^ _PONATCHTOKJoNV/. Bg?.NX0A??<HnN^ _\ONPPENDBYJoNV/. Bg?.NXXN/. Bg?.NX8NN^ _\ONPPENDINJoNV/. Bg/.NXN/. Bg/.NWNN^ _PONPPENDLOJoNV/ nCJp@"S@n.@R@>/. S@?N n //. HnHn?<" _Cp@ S@n.@@g* n //. Hz6Hn?<" _Cp@ S@nRG=G.N^ _PONPPENDST JoNV/.?<HzNN^.NuEADPAT patternJoNV/ (n/ ?< HzxNNHn?< HzhN>/ HnHn?<" A"Lp@"S@nHn?<Hz8N/ HnHn?<" A"Lp@"S@n(_N^.NuEADCURScursorJoNVH(nB~`2Hn?<HzBN/ HnHn?<" A"Lp@"S@nRG G oLN^.NuEADICONiconJoNVH nCJp@"S@n(nz.@>JGgvT^2CA0B B WgRT`0AA0A A g:| n 0S@A 2CC1BRTRFT] FWgBg.HzFHnHz` HzBgNL=n~`HnN=|A?<"/HnHnN/ /.N&BgA?<"/HnHnNg/ 0.S@?N=n|`HnNX=|BgA?<"/HnHnNg / ?.Nz` HzBgN؈BgA?<"/HnHnNg / ?.NB` HzlBgNPRFinox` Hz0BgN8RGino0H=@ LN^.NuEADBNDL#The number of references is missing&Global ID missing in bundle references%Local ID missing in bundle references,The number of types in the bundle is missingID of bundle owner is missingJoNVHHnN=|BgA?<"/HnHnN<gN=n~`<|`.Hn?<HzN/.A?<"/BgBgN>RF F oRGino` Hz&BgN־0.@=@ LN^.NuEADICNL<5The first thing in ICN# should be the number of iconsicn#JoNV/ nCJp@"S@nA?<"/Nh0. H/N=n~`/.BgNNdRGinoN.N^ _ NEADTHEFJoNVH(n~HBFBgHnNg=|BgA?<"/HnN>g0.AA0A A.f@Rn.@nm Bg0.AA0A?N>` HzBgNL`60@Bg]@gS@gTW@gY@gW@g`A?<"/Hn?,@<JGoROA0p@n f8lo*0,R@AA0An fRl`|` |`SG`LN^ _\ONETACHARJoNVH(n0,R@AA0A>0. @!gd_@g_@gR@ g`@"g6` ml?- l HhNJ`|0-ܐ|? l Hh NJ`d |09@Rl`T9GRl`J9GRl`@-@=@|`&MA0`@Gf S@?HlNJjRFinoRlLN^ _\ONPDATEMEJoNVH nCJp@"S@n|BnBnBnBnBnRn0.AA0A A V.AnWgB.0.AA0A>Bg?/Ng ?/Nx`A/??<HnRn.@nl/. A?<"/Bg<N/. ?.N/. ?.N/. ?.N/. ?.NLN^ _PONAPPENDMJoNVHn?<NX n0 nBh n| BgHnNvg(/.A?<"/Bg<Nv nRh` n0H n!@ n!nN^.NuEADSTRLJoNVHn?<N n0 nBh n| BgHnNg/.A?<"/BgBgN` n0Y@ n1@ n0H n!@ n!nN^.NuEADLSTRJoNV/ (nHn?<N( nBP| /.?,N/.BN,HnNӒ=|BgA?<"/HnHnNg /.?.N/.BgNHnNL` /.BN/.p/NA/@/.A?<"/Bg<N;|B.BgHnNҦg(A/@/.A?<"/NRm`/.BgN߄ n0H)@)n(_N^.NuEADMENUJoNV/. NҎ nBPN^ _PONEXTLN JoNV/ nCJp@"S@nAC 0~`(O  m h2SAC0pAARG Go m?(A/ HzZHnHzHHnHz8HnHn?<" A?<"/Nͤ.N^.NuRITEERR, ID = in TYPE Bad 1234JoNVB.HnHnNBgA?<"/Hn/.N g HzN`fBgA?<"/Hn/. N g HzbN`6BgA?<"/Hn/.N g Hz"N`|N^ _ NEADVALU.control maximumcontrol minimum control valueJoNVH~B. (nHnHnNA/@A"Lp@"S@nHnHnNBFBgA?<"/HnM @AHpNRF   FW@g  g HzN`THnHnNl||A?<"/HnHnN@BgA?<"/HzLNtg|BgA?<"/HzNPgB,BgA?<"/HzN.g|BgA?<"/HzN gB,.@nnJHnHnNBgA?<"/HnHlNު  g HzhN`DHnHnN^BgA?<"/HnHl N  g Hz"NV`| LN^.NuEADTEMPBrefCon defProcIDNOGOAWAYGOAWAY INVISIBLEVISIBLE boundsRectJoNVH(n nBBgHnNgxBF`/ M @?6NRF Fo/ ?.N.g><`BG/ ?N.g><`BG/ ?N/ /.NBg/ A?<"/N<.@|H n LN^ _PONEADWINDJoNVH(n BgHnNgBgHnHnHnNgBG`/ O @?6NRG Go/ ?.N.g<<`BF/ ?N/ ?.N/ ?.N/ ?.N/ /.NBg/ A?<"/N>.@|H n LN^ _PONEADCONTJoNVH(n <Nv/- HzBgHnHnNBgA?<"/HnHnN g,Hz|HnHzHn?<" A?<"/NBgA?<"/HnHnN۲ g,HzHnHz8Hn?<" A?<"/NBgA?<"/HnHnN` g,HzHnHzHn?<" A?<"/NnBgA?<"/HnHnN g,HzHnHzHn?<" A?<"/NB/ ?.N/ ?.N/ ?.N/ ?.NHnHnNxA?<"/HnHnNXACp S@n0BgA?<"/HnHnNX g,Hz.HnHzHn?<" A?<"/Nf/ ?.N$BgA?<"/HzNg / ?<N`/ BgNA?<"/HnHnNܜACp S@n0BgA?<"/HzvNg / ?<N`/ BgNBgA?<"/HnHnN g,HzHnHzHn?<" A?<"/Nx/ BgN8/ ?.N.HnHnNBgA?<"/HnHnN g,HzHnHzHn?<" A?<"/N/ ?.NBgHnNHnHz@"g,/- Hz,Bg/- HnBg/- <"?<x/- HzBg/- 0.H/?<|/- <,?<x/- 0.H/?<|/- <,?<x/- 0.H/?<|/- <,?<x/- 0.H/?<|/- HzdBg/- 0.H/?<|/- n/Bg/ C?<"/ N$0 _|H LN^ _PONEADDIAL0 -- list :  ""Can't find item list ID in "Can't find refCon in "goAwayVisibleCan't find window proc ID in "*Can't find right coordinate of Dialog in "+Can't find bottom coordinate of Dialog in ")Can't find left coordinate of Dialog in "(Can't find top coordinate of Dialog in "DialogJoNV/ (n<Np/- HzBgHnHnNBgA?<"/HnHnN g,HzRHnHzHn?<" A?<"/N BgA?<"/HnHnNլ g,HzHnHzXHn?<" A?<"/NBgA?<"/HnHnNZ g,HzXHnHzHn?<" A?<"/NhBgA?<"/HnHnN g,HzHnHzHn?<" A?<"/NB/ ?.N/ ?.N/ ?.N/ ?.NHnHnNrBgA?<"/HnHnNԀ g,Hz6HnHz,Hn?<" A?<"/N/ ?.NLHn?<HzN/ HnHn?<" A"Lp@"S@nA/BgNx</ ?N\/ ?NT |H@8=Dz`/ BgNNÜREino0H)@<N/- HzBg/- 0.H/?<|/- Hz\Bg/- /,?<|/- )KJf+n+m` m +nLN^ _TONAKEABMA is Bitmap length forJoNV/ n CJp@"S@nA?<"/N~` nS@?N T@2SAC@A;p V@2SAC@A;p)m0S@A @A;p R@2SAC@A;p)m X@2SAC@A9pRFinoP`;m;m:-BgNr/- HzBg/- 0-H/?<|/- HzBg/- /- Hz`Bg/- 0-H/?<|/- Hz(Bg/- =m|`0S@A @AI80-@|"SAA@> Z@2SAC@A20H)A T@2SAC@A;p V@2SAC@A;p)m R@2SAC@2-A|4SBEAA40Ap9B mf9E`8 |2SAC@"RA4SBEAA40ApH…9BlRFino`;m=m|`0S@A @AI8 S@@|> Z@2SAC@A20H)A T@2SAC@A;p V@2SAC@A;p)m R@2SAC@A20mH A9A |2SAC@"RA4SBEAA40ApH… 9BRFino$LN^NuAKESEGL. jump table entries. There are segments.JoNV/ nCJp@"S@n m0( R@ m1@ Hn?<$N (nHl?<N B)mB| lCp@ S@nB9|p)@BlB9|0"Jf+n+m` m +n-n (_N^.NuEFINECOJoNVH nCJp@"S@n=mBG`BA?<"/N(_9GJlf9| " lf 0,"X@9@"JGg0S@A @A"0X)A`-HgNS@gS@g4`v0-|2SAC@A;p0-@|H+@`D0-@|H+@`20-@|2SAC@A20mH A|H+A)mRGino LN^.NuEFINESEJoNV nCJp@"S@nA?<"/N8NA?<"/NN^.NuAKECODEJoNVH-g:/- Hz~Bg/- -r/?<|/- HzLBg/- BgN| -r Ёr?Nj;m;m-m;m;m-m .Ю( l(</N^ -r/NPp /NH-Hg6S@g S@g`0-|<=m~`\Bg?N=_z`B T@2SAC@A20QA?NVF? R@2SAC@A?0NZF?. GNW GHmW GNW GAW GCW GEW GGW GIW GKW GMW GOWg|`B..N^ _\ONHOULDPAJoNVH>. (n, gBg?/.NRg|`\B,`VB,loL-Hg.S@gS@g`: lH@| T@>`"Hz:BgN`` lH @| T@>=GLN^ _\ONODEFILTInternal logic error!JoNVH n CJp@"S@n<.JFfN`0S@A @AIB.-Hg8S@gS@g0`V0-mr @=ABg?NNdBg?N NX`(0-m2-A@| =A?, N6?,N.-g ,ѭ`A?<"/Nj/, NBBgNp@2@;ABNL 8 mg Y@H/N`PBNh-_ -g4/,p/" =@z`BgBgN/NNREino`/,N~/-, m P^gf  gB?A/ HzRHnHzDHnHz:Hn?<" A?<"/BgNTLN^ _\ONUTPUTCO" of "Cannot find segment JoNV/- n hHh?<Bg/- < ?<x/- n/(Bg/- Hz?< n h@r@?Hn"HnBg/- HzPBg/- n/(?<|/- Hz Bg/- N^.NuRINTOBJ. bytes long. is  JoNVH(n+LBg/,Hz"NgB0,H@H@J@J@fB`&Bg l?<"/BgNt0H)@/ N`2Bg/,HzNg*Bg l?<"/BgNF0H)@/ Nv`Bg/,NgBg l?<"/N0H)@/ N>Bg/,HzRNgpJgj lp0A A.V lr0B B&Vg>=|AprCA l/Hn/,Hn?<" _Cp@ S@n`g<| Hm?<NX mBPBg/-N:0H)@)mB, `Bg/,HzNg:| Hm?<N mBPBg/-N0H)@)mB, `LBg/,HzXNg:| Hm?<N mBP/-N m0H)@)mB, LN^.NuASEOBJEGNRLICN#BNDLFREFANYBRAWBCNTLWINDMENUDITLLSTRSTR#DLOGALRT STRGSTR PICTHEXAICONCURSPAT#PAT DRVRFWIDFONTJoNV/ (nB.(Jg" TXC p Vf |`` T(`(_N^ _PONINDTYPEJoNVH nCJp@"S@nB. =|.@>JGf`-| n\2.CA0B B WgRn`־nl`LAC\ 0|`NBg0.AA0A?N\MA0`@_g`0S@A A RnRF Fo| A?<"/HnHnN*n^2.CA0B B=VgRn`0.AA0A A=f RnA?<"/HnHnNACnp Vf-|STR Bg/.HmN*g`2Hm?<NRm(m()n)nBl +mLN^.NuYPEDEFI STRGTYPEJoNVH nCJp@"S@n n CJp@"S@n&n0+ R@7@ Hn?<$Nr(nHl?<N^B, B)KB| lCp@ S@nHnHz"gB` Hl?<N lCp@ S@n9|p)@9n B9n".@J@o n1mRm` n1|/.NJf+n+m` m +nLN^ _NAKEOBJEJoNVH&n >.(nB.BSBn|BBn_"gOA0p@ @@f z=SBS`rOA0p@ @0\OA0pA A9_g&0 OA0pA@|06|`OA0p@ @-fx`BRG`\g0.@Sg0D@6LN^ _ NETNUM JoNVH nCJp@"S@nB. nB nB nBP n BP.@<JFf`~G\OA0pA A WgRG`޼Gl`8G\OA0pA A,VgRG`޼Gl,HzHnHn?<" A?<"/N `r=GzE\KA0PA A(VgRE`=|n\2.CA0B B)VgRn`ּEl:nl=FBg R@??/./N g`Bg R@??./. /N g n BP| nf`>n]OA0pA A!VgRG`ܾnm0 n/Hn? D?Hn" _Cp@ S@n nB`X n/Hn? D?Hn" _Cp@ S@n n/Hn R@?0.GS@?Hn" _Cp@ S@nLN^ _NARSESTRMissing comma in: JoNV/ nCJp@"S@nHm0Hn?<<>JGg.Hz.HnHzHn?<" A?<"/?N/- /- HzBg/- HnBg/- HzBg/- HnNACp@ S@nHm0 gBgHnNvgBgA?<"/N gBgA?<"/HnHnHnHm/NzgHnHz"gACp@ S@n mXCp VfA?<"/NP`j mXCp VfA?<"/?.N`Np/ _TO>N"_ _020N"_ _020NсyhPASLIB UCLASCAL/IOPRIMIT8SHELLCOM9PROGCOMM:STDUNIT XIUMAN ZOBJIO [FILEIO \GRAPHS ^TREES _REFS `PARTS aLISTS bMEMMAN cPASDEFS dBLKIOINTfBLOCKIO gPASHEAP h(F bMZ[uNN NNNNL N \NNxN NHNNN2`PASLIB1 PASIOLIB`SgPASinibSULib cObjIOLibdMainProg  "NV,_NUD"8+OL+NHB"H+_DA/N/- /- HzzBg/- HzhBg/- HzTBg/- HmBg/- /- HzBg/- /- /- /- HzBg/- /- Hz.Bg/- /- HzBg/- /- HzZBg/- /- HzBg/- /- /- HzBg/- /- Hz(Bg/- /- HzBg/- /- /- Hz~Bg/- /- /- |.mL,mH -D/",HmNHmPN/- `.mL,mH -D/","N]" NuN^NuHOWINTEthat contains the unit. Any number of units may be processed.Rprocess a unit in {$U+} or {$U-} mode, and if {$U-}, the object file (or library)Rthe same information as a Pascal USES statement, i.e., the unit's name, whether toRany unit. The unit is processed in a manner similar to the Compiler and requiresRShowInterface is a Pascal utility that allows you to view the interface section of(c) Apple Computer, Inc. 1984) - 1.5ShowInterface (Ver JoNVH:. (md|~`D"n i0S@A0p@ l2SAC"A p2SAC0pA@gBRG Gog l0S@A @ p;h;ELN^ _\ONINDUNAMJoNVH(md|~`F"n i0S@A0p@ l2. 4SBEA p2SAC0pA@gBRG Gog l0. 2SAC@ p;hLN^ _\ONINDTHISJoNVH:. (n&md k0S@A @ p0(mfb|~`<0S@A4p@ k2SAC"A p2SAC0pA@gBRG Gog0S@A A@!LN^ _\ONETFLOC JoNV md h0. 2SAC@ p0(mf0. 2SACA@BN^ _\ONOINTERFJo*NV(H&n(md g8 mhB(HlA?<O"/BgJ_nTBgBg<BgBg4BmHz/~`0S@A A@r!RG Go/,<HgBmHz/JmV2-mVg0-2SACA@JoJ l0-2SAC@ p?<P"/0-2SACA@/0A g/ PN`0-2SACA@ fzHl l0-2SAC@ p?<O"/BgJ_n/,Hn .f~/,Hn .WJ.W .%Wg .fB=n(~`0/,<HnAC -nHz/RGin(o` Hz/`:Hz l0-2SAC@/0Hn*?<" A*?<O"//,<H` HzL/0-2SACA@JoF l0-2SAC@ p?<P"/0-2SACA@/0A g/ PNLN^ _NNTRININBad object file:  MainProgShowInteMZJoNV-gB-/- Bg`gN.<NNN^ _TONTOP JoNVRm-gX moN/- /- HzBgBg< g<Nj?<P?<P?<P;|`^0-HH@J@J@fL/- <.?<x0-HH@J@J@f*/- 0-H/?<|/- HzBg/- N^NuOUNTLIN linesMore? JoNVH(np4A><`4`@ @ fSG`p`SF FlpB4LN^.NuRIM_TRAJoNVHRf0-dR@HH@J@;@d0-d@AjI fmjJf.0-bA`Rmb-g0-`A`Rm``8 f0,mb-g0,m``Bg@g<N foLp2-bSAA`A`/N- gN/-A`/pA`C`p@ S@n;|b0,mb-g foBp2-`SAA`A`/Nz- g/-A`/pA`C`p@ S@n?- A/ .@<=F~`pFG6pAA`RGino0,\@;@`Rm B-B9nRm(LN^ _TONRITE_A JoNV/ ?< N(0-d@AjI9n;n(Rm (_N^ _TONAKE_NEWJoNV-gJm ^-gBgN?.NB-B$N^ _TONRINT_LIJoNVH>.-g4?< N0-d@AjIJGm9G`Bl m(S@;@(LN^ _TONPACE JoNV/BG` ?< N:RG Gop2-bSAA`A`/NN/-A`/pA`C`p@ S@n;|b-g>p2-`SAA`A`/Nt/-A`/pA`C`p@ S@n;|`BfBmdB$;m,(;m,*|2!B- ;| |.N^NuLUSH_BFJoNV/- g$=m~` @A?0N@RGino.N^NuLUSH_SYJoNV/ Hn?<(n0- R@8)m\+n\(_N^NuINE_OVEJoNV/ Hn?<(n8 )mX+nX(_N^NuOM_OVERJoNVN6?-NNH/- /- m\(?<xJ.f/- Hz*Bg`& .f/- HzBg`/- HzBg/- HzBg/- m h0(RR@H/?<|/- <.?<x/- m hCp@"S@n mCp@"S@nA/LA/LHnHn"N"N^ _TONBORT t!processing aborted at input line Could not format comment, Too many indentation levels, Syntax error detected, JoNV mo<NhRm0-@A1,0.m,0-,mo;m,` Jm,lBm,N^ _TONNDENT_PJoNV0-@A;p,SmN^NuNDENT JoNVH&mB(k ,g"Bg@g<NB,0,Xlo/+BmJ,fX lT0,X0AJAf /+,` lT0,X0A Af$ lT0,XR@0A| ;A0,XT@9@X,g@ ko8Bg`g.~-g"N/-<0+@+u|`$,g|-g - @`||- g0-m?N2;| ` lT0,X0A;A0,XR@9@XRm0-kf*;| - g?-N|0,RR@9@R`( mf;| |`- g?-N0,Xlo|LN^NuET_CHARJoNV/-g:m~`(H @A20AH @AC3Ri.o`B- g8m~`(H @A20AH @AC3Ri.o.N^NuIX_WORDJoNV-gBgNd-g2-g$0-(moN?-N nB(B-`?. NN^ _\ONLOK_COMJoNVH(n -fR<0-(F @o <N`j0-(FmoN0-F2,@>JGlBG`0,m,Gl 0,m,>/,/<" @AjG7GRm F;@(LN^.NuREAK_STJoNV/ (n-gBgNP-gh n fT, gH0-(mo*Jg$, g /.N` mu(m/.N?< N)mf|` ?. NB,(_N^ _\ONT_COM_CJoNV n( g?-/.N:` ?-/.N:NN^.NuOPY_A_CJoNV0-k|nA>2IDA0 <g /.N`N^ _\ONO_COMPI JoNV m+f n  n/(NJ` m-f n B n/(N.N^ _PONWITCH_DJoNV/ m=f n/(N m0\ m9_g^BG m0\ m9_g.0<H Gm  2-|0@> n/(N`nl>.n o>. n0.N^ _ NUM_DIR JoNVH/.Nb0-k|nA2IDA0 <f8-/.N40@#k @WnH0;N @N (6~V4 @N (6~V4Hm/N``Hm/N`RHm/N`DHm/N`6Hm/N`( nHh/N` m+W m-Wg Hm/N`Hm?<?</N`Hm/Nd` m+W m-Wg Hm/NB`2HnBg?</N0.>JmW G]g;G*;G,`| m=f/.Nf m/gNHmBg?</N40-k|nA2IDA0 <f|` m+WD@/.N m/f/.NHm?<?</NSmBB||0-k|nAd2IDA0 <gL mdW mDWg||E` msW mSWg |zF/.Nn` m/fR/.N\Hm?<?</N0Sm0-k|nA2IDA0 <fBm`;m/.N`Hm/N`Hm/N`Hm/N|`Hm?<?</N0-H;@0-H;@0-H;@`Hm/N&`Hm/N`Hm/N `xHmBg?</NH0-R@H;@`TJmRf Hm/N`@Hm/N`2Hm/N`$Hm/N-gAp? S@n?< A8p? S@n?< "ABp? S@n?< "ALp? S@n?< "TAp0S@nAp? S@n?< A8p? S@n?< "ABp? S@n?< "Ap? S@n?< "TAp0S@n`ZAp? S@n?< A8p? S@n?< "ABp? S@n?< "TAp0S@nAp? S@n?< A8p? S@n?< "ABp? S@n?< "TAp0S@n`Hm/NN-gfAp? S@n?< Ap? S@n?< "TAp0S@nAp? S@n?< Ap? S@n?< "TAp0S@n`dAp? S@n?< Ap? S@n?< "TAp0S@nAp? S@n?< Azp? S@n?< "TAp0S@n`Hm/Np-g4Ap? S@n?< A*p? S@n?< "TAp0S@n`|Ap? S@n?< Ap? S@n?< "TAp0S@n`rHm/N`fHm/N`Z m+W m-Wg Hm/N`:HmBg?</N `(0-k|nAr2IDA0 <g/.N0-k|nAJ2IDA0 <fz m]f/.NLN^ _\ONO_FORMAN   JoNVH(n-gt,g` -f ,,g 0-H.`$0-H.JlB`0-*Hl0-*H./. /<" @Al1 І;@(0-(moNnLN^ _PONDJUST_BJoNV-gZ0-(moP nJf m(nN*`8<NZ`. n( g /.N*` m(o /.N`NN^.NuDJUST_SJoNVH(n0.S@?N,-f| n{ W,@g?<{/.N`~}`?<(/.NP?<*/.ND~*NJm^2-mWD@ m$f </.N m[f </.N4 n{ fmg?-/.NNd``J m*g?-/.NNH`-N> m)g-E?<*/.ND m)f?/.N,  n{ Vg ?<)/.Nh//.NLN^ _PONLOCK_COJoNVH:. (nBB,B,,  E{Vg9|0-m(R@m,?N0-,mo NH?-N0-mS@m(o?-NBNN<-mfRN0-(ml 0-ΐm,R@?N0-ΐm(?N`0-(m,R@?NzBgN;md|`F0-(m]--- -тg"N0-Ґm,R@?N.0-Ґm(?N;F E{W,@g?<{/.N~}`?<(/.N?<*/.N~* m$f Bg/.N m[f Bg/.N E{fmg?-/.NN.``N m*g?-/.NN`-N m)gmD?<*/.Ntn m)f?/.N\,  E{Vg ?<)/.N>/.NN~B-B-LN^ _\ONTAT_COMJoNVB.B-mmBn. g?. ?./N0` ?./NnB-N< m W- gN$`B.. g"-g0-(ml0-m(?NB$B-|F!N^ _\ONO_COMMEJoNVRm0-@A1NN^ _TONYMBOL_PJoNV/B-||EB?-N m'f?-N m'VD -g  gBgN@.N^NuTRING_CJoNVH m\ m_g0-@AIH CACp VV,]g H R@`H CACp VWHA0pHk|OnA4JDB0 <WgHApp`|C`|CLN^NuEST_RESJoNVHJV-@gP m o p `pp6A=A~` "AA40BA RGinoB-mJg&n n h/Hnܠ"g|`. n h/Hnܠ"g n-hB` n-PzJW"AggB n h @;@=m~` n h 0p@"AA1RGino-g  gHn?<JfB-;m R`(nHl?<"Hl ?<"BB lCp S@n0.@;@ l p=m~` l "ACRGinoJf+n`g&`'n|FLN^NuOOKUP_IJoNVHB-|x0-k@Ar? SAn?< Ar? SAn?< "2ISAAn2IDAW7 <f|-À-gR m_fx-g ?-N `@NB.`6gB0-@A?0N`0-@A?0N`?-N m_.g"0-2-AA40BAC `0-R@<` A RF FoN -Cf-gBgN --- gp-g6=m~`$ @A20A @AC3RGino`4=m~`$ @A20A @AC3RGino`z-g6=m~`$ @A20A @AC3RGino`>- g4=m~`$ @A20A @AC3RGinoLN^NuLPHA_CHJoNVB-||D0-k|onAB2IDA0 <f0-@A?0N`N^NuEX_CONS~~JoNVB-||D0-k|nA2IDA0 <f ?-N` m.fF?-N m.f Sm|`*0-k|nA2IDA0 <f ?-NP` mEW meWgP?<EN2 m+W m-Wg?-N0-k|nA2IDA0 <f ?-N``* mbW mBWg ?<BN` m#fN|N^NuUMERIC_JoNV|B-0-@#g`S@gZU@gS@gU@gS@gS@gZS@g0S@gbS@gS@g@ gf|7?-N`p|;?-N m=f|:?-N~`J|0-G2-(@moJ$^-"-f$ ]2-G4-,A2-(Bm"m_gJGf~0-,R@nf=m,0.m,GS@H2-,@<m,oh0.R@m f\ -f lL0-(Fm,mn2IDA0 <f -CgN -CgBgN՞ -Cf>--ACpB S@n0N:--ACpB S@n0 -?W2-(m^g?-,N;GFACpB S@n0NB- ;EDACpB S@n0 -?fN -3fNN`F -5fN -CWAC r VWg>--ACpB S@n0N:--ACpB S@n0 -CfF;GFACpB S@n0NDNB- ;EDACpB S@n0N4`F;GFACpB S@n0NB- ;EDACpB S@n0`<CN` -4fN-gN`?-,Nф`<@N4N՜LN^NuARAMETEuniv JoNV/B -CW -4Wg~ -4gN-gH- g<5N0-(m,R@ml0-(m,R@2-֒@?N-g<5N`<5N~0-(mn0-(m,mR@?Nj`BgNbBgNNԺ -4fN -Cf?-,Nv`6 -fg?-,N\N?-N<CN -5f N<CN<NNP?-N;m,*?-,NBgBgBgN<5N?-NӾ;m,*?-,N<?N?<NӠNN<@NN;m,* -4fN-Hk|OnAb2IDA0 <g?-,Nϊ-Hk|OnAt2IDA0 <gVNӊ;m,*.N^NuIELD_LI JoNV/ n CJ""?-N.g`JV-"-f ]g:/./<" @AjI9m,0-(m,n;@(Rm `?-,NμN?-Nv;m,*?-,N΢NVN?-,NΒ< NFNҮ(_N^ _\ONECORD_TJoNV?-N(NN<AN-Hk|OnAt2IDA0 <f&N -=fNhN -3fNXNH`<BN<N<NjNN^NuRRAY_TYJoNVN0-(mn0-(m,?Nт`?-NxN<<@NbNN^NuNUM_TYPJoNV?-NJN<N4-Hk|OnA2IDA0 <gBgNϔ?-N;m,*N-Hk|OnA2IDA0 <f ?-,NNmB-|-Hk|nAR2IDA0 <f HmBgN`nB-N?-,N̼< NpNN^NuLASS_TYJoNV?-N@ -fHnNN`BNЄAVp? S@n?< ?< "?< TN-HS@gF@ g\@gU@g:@gU@g^S@gZ@gW@gY@gJS@gFS@gB`N`Nv`~N(<N<NH`hN -f N<N.`NNr -=f NNb`8 -AfNNP<BNB`NBgN`Hn.N,`N;m,*N^ _TONCAN_TYPJoNV?<?-N&0-(ml0-(m,R@?N`BgN -DfNT -3fNH`N"<4NNN^NuO_LABELJoNV/Ap? S@n?< Ap? S@n?< "TAp0S@nAp? S@n?< Ap? S@n?< "TAp0S@n?<?-NR~ -CfHnN?-,NJN m_2-(m,RAm]g0-(m,R@2-֒@?NV<6N0-(ml0-(m,R@?N͸`BgNͰ;m,*NN;m,* -4fN`BgN m^" g HnBgNBNB`:N;m,*-gdAp? S@n?< Alp? S@n?< "TAp0S@nAp? S@n?< A:p? S@n?< "TAp0S@n.N^NuO_CONST @JoNVAp? S@n?< Anp? S@n?< "TAp0S@nAp? S@n?< A-Jno n CpB"S@n2BmN -2fBN -CgBgNƒACpB S@n0=GACpB S@n0>-Nf;|N<0-(ml0-(m,R@?N`?-NǶ -?fN0  f -5f<5N<CN -4fNNAp? S@n?< Afp? S@n?< "TAp0S@n;m,*<4N2-  -CWACt VW@g?-N -CWACr VWACt VW‚ACpt VW‚ACNt VW‚ACt VW‚AClt VW‚ACJt VW‚gNACp Vf?-,NŠN`ACp VWACr VWg?-,NRN`jACp Vf>?-,N2Nv0-(ml0-(m,R@?N`BgNBgBgBgNN&`N@`-gN`*`BgN& -4fNN;m,*N`BgNLN^ _\ONO_PROCElinline c external forward default override abstract @JoNVRm;m,*-Hk|OnAj2IDA0 <f^|-HY@g*Q@g8Y@gQ@g0_@g U@g"[@g$]@g`(N>`"N`N`N`N<` HmBgN;m,*` -$g -Gg-Hk|OnAj2IDA0 <gfmNN8B-;m* -$V -GV-Hk|OnAj4JDB0 <VgNj`| nBm -$W -GWgB-SmN^NuO_BLOCKJoNVH(m|zBg/. d>JGoB,z|{Bg/. d>B,zB,{=GLN^ _PONPENOBJFJoNV/-g6/- n/(Bg/- Hz0Bg/- Hz Bg/- /- NÆNNN- g>- ml(/- H/?<|/- HzBg/- `r0-HH@J@J@g`Rm0-HH@J@J@fH/- < ?<x0-HH@J@J@f&/- H/?<|/- Hz:Bg/- `Bg` g<N.N^.NuROCESSIP linesmake it more readable.. is a library unit so it will be formatted to JoNVH(n&l lob0,Hl0,HH@J@9@ m hHhHl?<?, _g /-HzP/+Hn?<" Hnt0,A0A>RlJGl|=G LN^.NuEXTBYTEError reading USES file ofJoNVHBG=n |` @/Bg/.N 2 >@RFino=GLN^ _\ONEXTINT JoNVH nCJ""&m|;|B-;|'J f=|=|Bg/N>`z/. /<" =@/. /<" =@ kHhHn?<?. _g$/-Hz n/(Hn?<" Hnt=nBg/N> Gf GfBg?</N8|~`6p@/Bg/N2 @gBRG GogBg?</N:Bg?</Nz:Bg?</Nl0H=@/+?./+(k lT0,X0A Ao lT0,X"lT2,X1B||` n| =@Bg/N">`` GWJ WgTBg?</N8|~`6p@/Bg/N2 @gBRG GogBg?</N:Bg?</N~0H=@JnfTBg/N:Bg?</NV:Bg?</NH:Bg?</N::/+?./+ k1nX`/+?./+B-(k lT0,X0A Ao lT0,X"lT2,X1B||Bm|Bm` n| =@Bg/N> GV@g`V GW GWgBBBg?</Nd8 Gf|~`Bg/N|=_6p@ngBRG Gog DoBg?</N:Bg?</N:Bg?</N:Bg?</N:Bg?</N:/+?./+(k|0.nf9nX` 0.|9@X lT0,X0A Ao lT0,X"lT2,X1B|`8`B`2QD nY@=@Bg/N|>=nJGW"Ag`BFLN^ _ NINDUNITError reading USES file ofJoNV nCJp"S@n2HnHn.@R@?"LBgHn/.NJ_n,Bg nHh/. /.Ng/.N8 n|N^ _ NEADINTEJoNVHAC4 AC( n@=@~`  n0pARGinoB.-QgHmPHnHz/HnN. gBgHmP/N2<JFnVBgHnB/N(g/Nr`fBg` g<N>/-/.HzpHmPHn?<" Hnt`*Bg?Hz>HmPHz0/.Hn?<" Hn(LN^.NuSE * for Unable to open is not in MRMainProginit JoNVAC, 0AC 0AC 0AC 0AC 0ACp S@nACxp S@nA`C^ 0Ajp? S@n?< ADp? S@n?< "TAtp0S@nA~C 0AjC 0Atp? S@n?< Ap? S@n?< "TABp0S@nAtp? S@n?< Ap? S@n?< "TAVp0S@nA8Cb 0A.CJ 0Atp? S@n?< A0p? S@n?< "Ap? S@n?< "TALp0S@n-gAp? S@n?< A8p? S@n?< "ABp? S@n?< "Ap? S@n?< "TAp0S@nAp? S@n?< A8p? S@n?< "ABp? S@n?< "ALp? S@n?< "TAp0S@n-gdAp? S@n?< A p? S@n?< "TAp0S@nAp? S@n?< Ap? S@n?< "TAp0S@n-g2Ap? S@n?< Ap? S@n?< "TAp0S@nAjp? S@n?<AJp? S@n?<"?< "?< TAp0S@nN^NuNIT_SET     @ :`  h B @C`2JoNV|||||||| |!|$|%|'|(|)|*|,|-|-|-|-|-|-|-|-|.|.AC0 0AC 0A,C 0A:C 0AHC 0AVC 0AdC| 0ArC^ 0AC@ 0AC" 0AC 0AC 0AC 0AC 0AC 0ACn 0ACP 0AC2 0A C 0AC 0A(C 0A6C 0ADC 0ARC~ 0A`C` 0AnCB 0A|C$ 0AC 0AC 0AC 0AC 0AC 0ACp 0ACR 0AC4 0AC 0AC 0AC 0A$C 0A2C 0A@C 0ANCb 0A\CD 0AjC& 0AxC 0AC 0p-k|nA2IDA0 <f0A$C 0A2C 0ACr 0p+k|nA2IDA0 <f AC6 0AC 0N^NuNIT_WORleave cycle segment *subclass *methods implementation interface procedure otherwise function subclass methods program *segment repeat record packed downto *leave *cycle while until label const begin array with uses unit type then goto file else case var set not nil mod for end div and to or of in if do JoNV||||||B-|| | |||||!||| | |||'|,|#||||| |"|(|)|||||&||*|+ | | | |% |G|$N^NuNIT_SYMJoNVH(m\&m ngdB-AC .p S@nBBn`$0.@A10.@A1Rn no=|A`60.|a|A2.AA10.|a|A@A1Rn nZoBgBgHz Hz N g<NAC bp S@nB-B-B.Hz &A/HnHz Hz Hz .N.HS@gU@g `<N`RHz Hz N `D|BgHnHmBHz THz Hz Hz HHz DN g<N|B- .fn m (WD@B-Hz hA/HnHlHz HHz N.HS@gS@g$S@gU@g`<N`zHz ^Hz N `l .f(/- ,?<x/- Hz Bg/- `&/- ,?<x/- Hz LBg/- ?<P?<P|.Hk|nA f2IDA0 <f"B-PB-PB.AC "p S@nHmPHz "g&HnHz Hn?<" ACp@ S@n`,HnHz HmPHz Hn?<" ACp@ S@nHnA/HnHz Hz Hz N.Hk^ @nVH0;Nz*z:<N`4HzHz >N `$|Q|`/- ,?<x/- HzBg/- ?<P?<P|`.@J@f|Q|`B-QHnHz"gACPp@ S@n`APCp@ S@nBgHnԠd>JGoB+z|{BgHnԠd>B+zB+{Bg?Hz8(g&?<P?<P?<P||`Bg` g<N| .fB-P/- HzBgAP/Bg?<"`?< "?< T?,"?,""Ap? S@n?<"?< "?< THn?<N" n?f&/- <??<x/- Hz"HzN `|/- 0.lf<NAP/WD@ ARGRFB` AB0RG.g0-A@20A0@=@0-A@RpBg?-A/N_Sm nHlHz.N V g/.N4`LN^.NuETARGS ZstdoutSTDOUT: -consolestdinSTDIN: : [? for help] Parameter(s)JoNVHB"H-_ n CJp@"S@n nCJp@"S@n$B.B-B-BBBgBgHzHmBgB0Hzʠ(g/NFBgBgHzHm<B0Hz(g/NB-B-Bm.g/N6AC6p S@n|O ./",LN^ _ NNITTOOLRCannot open StdOut.-CONSOLECannot open StdIn.JoNV. gHn,.g/- /- Hz Bg/- N^.NuNDTOOL That's all folks!JoNVH&n(k, ,@ +@J@opA0A A)fACp@ S@nA/,  )I JoNVH n CJp@"S@n(nA/`*BgHn0.@AHpBg0.@A/00>Bg?HzHnHn?<" Hn(g |`Bg0.@A/0A/ , gnBg/N gZ|Rl lf(9|/- HzlBgBg< @, g/- HnBg/- `n0.@A/0BgLN^ _ NISTIT More? Cannot open .textJoNVH n CJp@"S@n nCJp@"S@n(m\/- A/<.@J@f*/- ,?<x/- HzBg/- `NHn~`* @AHp?< @AHp?< RG GoA/0|A0p@J@g n C1pARGRF` np"SA|LN^ _\ONETARG JoNV/ n&CJp@"S@n nCJp@"S@n nCJp@"S@n nCJp@"S@n n CJp@"S@n nCJp@"S@nB.*BBgBgHn/.". /.0HzHnHzHn?<" Hn(gt-g"B-|?<P?<P?<PHnA/HnHnHnHz\N$ .f`6 .f HnHnN2 .g|`~gJB-|*.N^ _"NUSTOPEN.TEXT. Cannot open JoNV n$CJp@"S@n nCJp@"S@n nCJp@"S@n nCJp@"S@n n CJp@"S@n nCJp@"S@nBgHn/. </.HnHnHnHnHnN_(N^ _ NUSTCREAJoNVH nCJp@"S@n nCJp@"S@n n CJp@"S@n nCJp@"S@n&n(m\/- HnBgHnHz"g,/- <[?<x/- HnBg/- HzBgHnHz"g,/- <[?<x/- HnBg/- HzBgHnHzx"g,/- <[?<x/- HnBg/- HzFBg/  n Hk|`B@0-g?<PB-Hk|gHk|h n 0 n 0lfLJGf/- ,?<x`2SG/- ,?<x/- < ?<x/- ,?<x` n 0k|nA.2IDA0 <gb n 0k|nAN2IDA0 <Vn\g/- ,?<x`$/- n (?<xRG F "n  n 0k|nA.2IDA0 <f FpLN^ _JNEADKEYBJoNV/ (n||||||||||||(_N^.NuNITDAYSJoNV"n i0. 2.H |0"n i0. R@2.H HAJA|0N^ _PONETDIGITJoNVH/N,HnHn"Jng$ACp S@n0/.A/$`ACp S@n0/.A/$<.0.HdH@J@:.H??< /N.H??< /N.H??</N~ HH@J@J@f|6pHFl 6pH@RG`|??</N??</N??</NLN^.NuETTD $MM/DD/YY HH:MM:SSGet_Time Error!!!hPASLIB UCLASCAL/IOPRIMIT8SHELLCOM9PROGCOMM:STDUNIT XIUMAN ZOBJIO [FILEIO \GRAPHS ^TREES _REFS `PARTS aLISTS bMEMMAN cPASDEFS dBLKIOINTfBLOCKIO gPASHEAP h .( 5 @P)NN,NNNNN4N0LN',NNNNN NN(RN$\NNHN,NLNNN`PASLIB1 PASIOLIB`SgPASinibSULib cObjIOLibdMainProg ."NV,_NUҟ"8+O+NB"H+_NJfhN-gVHz m h/Hm?<" A`Cp! S@n0/- Hm`Bg/- BHm`NBg/- N`B-Bg m/BgN gBg m/HmHzHzHzHzNL g<N m h+H m/A/A/A/( m/BgN mJo$-g/-?< h`/- m?(֠hNNBg` g mB m+hJf(NBgN .m,m -/","N]" NuN^NuREF @Xref/FnameListXREF.HELP.TEXTInput File (?): Processing JoNVH:. (md|~`D"n i0S@A0p@ l2SAC"A p2SAC0pA@gBRG Gog l0S@A @ p;h$;E&LN^ _\ONINDUNAMJoNVH(md|~`F"n i0S@A0p@ l2. 4SBEA p2SAC0pA@gBRG Gog l0. 2SAC@ p;h(LN^ _\ONINDTHISJoNVH:. (n&md k0S@A @ p0(m$fb|~`<0S@A4p@ k2SAC"A p2SAC0pA@gBRG Gog0S@A A @!LN^ _\ONETFLOC JoNV md h0. 2SAC@ p0(m$f0. 2SACA @BN^ _\ONOINTERFJo*NV(H&n(md g8 mhB(HlA*?<O"/BgJ_nTBgBg<BgBg4Bm(Hz/~`0S@A A @r!RG Go/,<HgBm$Hz/Jm$V2-$m(Vg0-&2SACA @JoJ l0-$2SAC@ p?<P"/0-&2SACA @/0A g/ PN`0-&2SACA @ fzHl l0-$2SAC@ p?<O"/BgJ_n/,Hn .f~/,Hn .WJ.W .%Wg .fB=n(~`0/,<HnAC -nHz/RGin(o` Hz/`:Hz l0-$2SAC@/0Hn*?<" A*?<O"//,<H` HzL/0-&2SACA @JoF l0-$2SAC@ p?<P"/0-&2SACA @/0A g/ PNLN^ _NNTRININBad object file: MainProgXref 5 JoNV/.<N. g>p*k|nA2IDA0 <f ~`/- m\(?<xRG G2oN.N^ _TONTOP JoNVH(n *0<mH, "/-HH/".JlBB/?<l _C""""B/?<l _C""""B/?<l _C""""HzHnHzHnHzHnHzHn?<" ACp S@n0@ @+op+Hm?<-@rP@@@?Hn"HnHmHn?<" ACp! S@n0A-H LN^.NuENAVAIL refs] id's/ bytes/[JodNV`H(mB n/?<l _Cdp!"S@n2 nR-g~`0,J5f:HndB l0(RH/?<lHnd?<" AdCdp! S@n0``B0,5HH/?<l _C"""HndHnB l0(RH/?<lHnd?<" AdCdp! S@n0~-gX Ad R@Ad T@Ad V@Ad X@AdZG;|-;|-;| Ad 0,@85&l kT0@@ @f> kT R@0AG| < R@=Fb:` Ad REinboTD>0+XDS@=@ n<Jno8 Fo<< R@=F`:`  kT0@AAdRDREin`opAd/-Ad/p0,LN^.NuISTLINEJozNVzH&m(k,gBg@g<NB,0+5 g-g HmN|`R0,RR@9@R0,Xlo/+-g: lT0,X0A Ao lT0,X"lT2,X1B|B- lT0,X0AJAf /+,`0+@;X0+B5 lT0,X0A Af 0,XT@9@X,gx- gn kofBg`g\-gRHz k/Hnz?<" AzCzp! S@n0/- HnzBg/- BHnzNBg/- ` lT0,X0A;A0,XR@9@X0-kf|`(0-kf||`0,Xlo|LN^NuEXTCHAR Processing JovNVvH&m0+-gPHz/. Hnv?<" AvCvp! S@n0/- HnvBg/- BHnvNBg/- -HR@@0+Hn?<Jfh/- m\(?<x/- HzBg/- HzBg/- - g$/- /. Bg/- HzdBg/- `<(n n "Lp!"S@n2BnJf+n` m!n+nLN^ _\ONEWINCLUn will *not* appear in key list.Include or Use name.*Insufficient memory to allocate space for Processing JoNVH- gl|(mJ.fn/. A/A/A/(A/L gBJ,f6/ A/A/A/(A/LHnHn"g`(l`` n Cp@"S@nA/L g< ,f.A"Lp! S@n0A/LHnHn"g`(l`-g- -gB.`&A/A/A/A/(A/L&m gH/ A/A/A/(A/LHnHn"HnHn"g` &k`B.LN^ _\ONUPINCLUJoNVH(n(l&mN0-k|onAJ2IDA0 <g0-k8?+֠"Ar? SAn?<"2ISAAn2IDAW7 <gN.` m fBG m fN`0-k8?+֠"Ar? SAn?<"2ISAAn2IDAW7 <gRG AN`pA0-kg&A/JGoB,z|{Bg/. d>B,zB,{=GLN^ _PONPENOBJFJoNVH&m/. <N- n hmB-||NN0+5 g(k0,XU@>0+@:5 lT0P@ @fTE|G]"g0 lT0p@ @eW lT0pA AEWgB`SG`  gH_G|G_"g lT0p@ @ gB`SG`ܺGn-g T@9@XHmN`RBg` g<N|B-DLN^ _PONROCESSIJoNVH(n&l lob0,Hl0,HH@J@9@ m hHhHl?<?, _g /-HzPHkHn?<" Hnڠt0,A0A>RlJGl|=G LN^.NuEXTBYTEError reading USES file ofJoNVHBG=n |` @/Bg/.N 2 >@RFino=GLN^ _\ONEXTINT JoNVH nCJ""(mJ f=|=|Bg/N>`z/. /<" =@/. /<" =@ lHhHn?<?. _g$/-HzH nHhHn?<" Hn t=nBg/N*> Gf GfBg?</N8|~`6p@/Bg/N2 @gBRG GogNBg?</N:Bg?</N:Bg?</N0H=@/,?. l|`f n| =@Bg/Nx>`T`F GWJ WgBg?</N 8|~`6p@/Bg/N62 @gBRG GogBg?</N:Bg?</N0H=@Jnf^Bg/N:Bg?</N:Bg?</N:Bg?</N:/,?./, l1nX l|`0/,?. l|` n| =@Bg/Nf> GV@g`( GW GWgBBg?</N8 Gf|~`Bg/N=_6p@ngBRG Gog DoBg?</N:Bg?</N:Bg?</N:Bg?</N:Bg?</Nz:/,?./, l|0.nf l1nX`J0.| l1@X`8`B`2QD nY@=@Bg/NF>=nJGW"Ag`BFLN^ _ NINDUNITError reading USES file ofJoNV nCJp"S@n2HnHn.@R@?"LBgHn/.N J_n8Bg nHh/. /.Ng n hHhr/.N8 n|N^ _ NEADINTEJoNVH n CJ""HnHn?<"L~` 6pARG GopA/0-HR@@A:0B  G^gTA @ECp VgRG`0A0pHU@k @-nH0;Nzj^8^^r8^8|;|Bm`|;|`|`||`rB-;|Bm-g n h,HN `J-g/N`:;||;|Bm` ;||-g:-g4- g*- g JmfRm0-|A;@JmoRm`-g8-g2- g(- g-gJmfB-SmJmoSm`B-Bm-gT-gNRm m-f0-H H@J@|0;@- g"- gJmfJmm 0-|A;@`(Bm-g|- gr-gl- g&- gJmfJmm0-|A;@SmJmm0-H H@J@|0;@SmJmlJmoSmJmn;|`|-g2- g(-g"Rm m-f0-H H@J@|0;@`\-g(-g"Rm m-f0-H H@J@|0;@`,-g&-g Jmm0-H H@J@|0;@Sm|| `LN^.NuESERVEDJoNVH&m-gHn?< ` Hn?<Jfl/- m\(?<x/- HzBg/- HzBg/- k0(RR@H/?<|/- <)?<x/- |`DRJmf+n(n-g)m` k9hRB0+u--g`B~z` 5P@H//"/<".RE EoBx m @-pJf|Hn?<Jfj/- m\(?<x/- HzBg/- HzBg/- k0(RR@H/?<|/- <)?<x/- |`j nC m @! m @! m @! m @1;GRm-gB-HmHm?<"L` nCp Vf&| m @ p!n m @!`H Є//<".TD Dfj/- m\(?<x/- HzxBg/- Hz\Bg/- k0(RR@H/?<|/- <)?<x/- ||g G f`& Gam Gzn | > n RF FoLN^ _PONCASE JoNVH-g/- HzBg/- B.BmBn8- DgBg@g<N՚Rm. g m0.@JgRn`|`ظnot m @"m2.A# m @"m2.A# m @"m2.A# m @"m2.A3 m @BRnB. m @80`2~mn:G` ES@H:JEo0-S@E=@Bn`^Bg@g<NԜ>.JGm< E< m @ pC""""Hm/N m @ pC""""Hm/NACp Vc~`ACp Vf m @ p"m @"qp Vc~` m @-p m @-p m @-p m @=p m @"m"A# m @"m"A# m @"m"A# m @"m"A3 m @! m @! m @! m @1E` m @-p m @-p m @-p m @=p m @"m"A# m @"m"A# m @"m"A# m @"m"A3 m @! m @! m @! m @1E`Rni 0.no H:`rLN^.NuORT SortingJo`NV`H(n m0.@ pp0A> Gam Gzn | > n Pg> n 0p/- m?(֠h/-A/p-g/- ?<xA`Cp! S@n0z`$ T@ m2.A p0PAA`RE Eo| m0.@&pBDBg@g<N4lf2p"SAA`/-A`/pA`Cp! S@n0|BDHg S@g S@g ` ~ `~*`~=-gB/+?<l _C"""`B0+H/?<l _C"""z` ES@6PAA`RE Eo Z@A`\F-gnJ+ofB+HH/?<l _C""" A`( R@r6BA` T@r6BA` V@A`)XF&kRD fp"SAA`/-A`/pLN^ _ NREF1ID JoNVH(mpZk|nA2IDA0 <f-g$/- HzBg/- HzBg/- HnD?<JDf./- m\(?<x/- HzRBg/- `BgHz$HnD<BHzHzHzHzHzNF g<NBG`XBg@g<N HH@J@J@f /.D?,֠h m @Jg/.D?<h` /.D?<.hRG Go/.D?,֠h/.D</N-g -g/-?< h` /-?,֠h- gPBE&m gFBg@g<N RE/-BH/?<lHz/ HnD?<" HnDt&k`J-^- g0-|U@H =@|`0-|U@H=@B-=| -|-.--g/- HzHBg0-S@=@BF`?Hn/NPRFino-g/- /-?,֠hB0-H/?<l _C""""B/-?<l _C""""HzHnHzHnHzHn?<" AHCp S@nHnHBHnHNDHn?<" AHCp! S@n0/-AH/p-g/- /- HnHBg/- LN^NuRINTXRE references id's *** End Xref: !Writing cross-reference listing: . Renter HashTbl plot filename: HashTbl.Distribution Could not get heap space for FCBHashTbl.Distribution.text)Plotting hash table distribution to file JoNVpXk|nA2IDA0 <VD@;|-;|-;| ;|;|BmB-||BmBmB-B-N"N^NuERFILEI5MainProgInit JoNV;|;|;|;|;|;|!;|&;|*;|1ACb A CN AC: AC& A$C A,C A4C AHz:Hz Hz"Hz N^ g<N k-H n/A/A/A/(0+0+B5B`.BgHzHzHzHzHmN" g<N B.+m/-BgBg?<Hm<BHnHzFHz,HzpHzNR g<N BgAp? S@nHzFHzHmN( g<N Bg?<N;_ m(] m^gHHzfHm?<x?<(?<HnN4 .f<N .f HzHz"N: .fpIk|nA2IDA0 <VD@pNk|nA2IDA0 <VD@pPk|nA2IDA0 <VD@pTk|nA2IDA0 <WD@pDk|nA2IDA0 <VD@pSk|nA2IDA0 <WD@-g|pAk|nA2IDA0 <WD@pCk|nA2IDA0 <WD@pBk|nA2IDA0 <VD@pMk|nA2IDA0 <WD@ m (VD@pLk|nA2IDA0 <f|`*pUk|nA2IDA0 <f|`B-Hn-gHn?< Hn?< `Hn?<Hn?< .@Hn8-g0p$k|nA2IDA0 <g(HlHzHn?<" A*Cp S@n`B-*Hz\A*/HnHlHz bytes.*Heap space after allocating hash table is /Insufficient heap space to allocate hash table. is 9Heap space after prompts but before hash table allocationSizeOf(Reference) = Invalid pathname.You must give it some library!Xref/Intrinsic.LibXREF.HELP.TEXT INTRINSIC.LIB$Intrinsic.Lib to use for this Xref: -INTRINSIC.LIB Xref/WidthMaximum output line width: Xref/Options9r, Xref/OutputOutput listing file: CrossRefXref/FnameList Input file: Xref/InputXref/Parameters) - 4.38 Xref (Ver MainProgToolsPri)JoNV nB( n,HNN^.NuIE JoNVH(n&m\/- HzBg,@J@o/- HzBg/- HzBgB-BmA/Bg?<"`?< "?< T?+"?+""Ap? S@n?<"?< "?< THn?<N! n?fj/- <??<x/- HlHlN /- HzBg,@J@o/- HzBg/- HzBg/- HmBg`/- 0.kf/.N0.kf -@: R@AB0 T@AB0~ m]A0pAJAVgA0p@ @ fRG`A0p@J@gRm0-Az@1<xB.A0p@k6Bg"Ar? SAn?<"2ISAAn2IDAW7 <gA0p@=@ n~W"RAA0BJBVg:RGA0p@=@ nnf A"m` A`(g nWD@ ARGRFB` AB0RG.g0-Az@20A0@=@0-Az@RpBg?-A/N _Sm nHlHz.N g/.N4`LN^.NuETARGS ZstdoutSTDOUT: -consolestdinSTDIN: : [? for help] Parameter(s)JoNVHB"H-_ n CJp@"S@n nCJp@"S@n$B.B-B-BBBgBgHzHmBgB0Hzʠ(g/NFBgBgHzHm<B0Hz(g/NB-B-Bm.g/N6AC6p S@n|O ./",LN^ _ NNITTOOLRCannot open StdOut.-CONSOLECannot open StdIn.JoNV. gHn,.g/- /- Hz Bg/- N^.NuNDTOOL That's all folks!JoNVH nCJp@"S@n n CJp@"S@n&n(m\=|a`0.| <0.k|nA42IDA0 <f6A4p? S@n?< ?""?< "?< TAp0S@n`T0k|nA42IDA0 <f6A4p? S@n?< ?.""?< "?< TAp0S@nRn nzo@B.BG=|A`20.k|nA 2IDA0 <fRG ARn nZoBn`R0.k|nA 2IDA0 <f.0.k|nAx2IDA0 <gRG ARn nopAA"Kp"S@n/- Hz Bg.@J@o/- HzBg/- HzBg/- HnBgA/A4p? S@n?< ?< "?< T?,"?,""Ap? S@n?< "?< "?< THn?<Nx0.lf/- B.4` n?fl/- <??<x/- HnHnNL/- HzBg.@J@o/- HzBg/- HzBg/- HnBg`N n\fx.@=@~`4/- ,?<x/- < ?<x/- ,?<xRGino/- HzNBg/- A"Kp"S@n=l`z.@>`A0p@<0k|nA2IDA0 <f | <A p? S@n?< ?"A0p@?"""?< "?< T Kp0S@n/- ,?<x/- ?<x/- ,?<xSG GlN/- 0.lf|4LN^ _,NETOPTIO: [? for help]OptionsJoNVH&n(k, ,@ +@J@opA0A A)fACp@ S@nA/,  )I JoNVH n CJp@"S@n(nA/`*BgHn0.@AHpBg0.@A/00>Bg?HzHnHn?<" Hn(g |`Bg0.@A/0A/ , gnBg/N gZ|Rl lf(9|/- HzlBgBg< @, g/- HnBg/- `n0.@A/0BgLN^ _ NISTIT More? Cannot open .textJoNVH n CJp@"S@n nCJp@"S@n(m\/- A/<.@J@f*/- ,?<x/- HzBg/- `NHn~`* @AHp?< @AHp?< RG GoA/0|A0p@J@g n C1pARGRF` np"SA|LN^ _\ONETARG JoNVBnBg?.A/N\gA/HnHn0J.gBn=n N^ _TONETARGVAJoNVH nCJp@"S@n nCJp@"S@n nCJp@"S@n nCJp@"S@n n CJp@"S@n&n(m\Bg?."/ Ng |$`jB.$pB3HnHz"gD/- ,?<x/- HzlBg/- 0."H/?<|/- Hz?<x/- .f:(_N^ _NETFROMUH$[.TEXT] n Hk|`B@0-g?<PB-Hk|gHk|h n 0 n 0lfLJGf/- ,?<x`2SG/- ,?<x/- < ?<x/- ,?<x` n 0k|nA.2IDA0 <gb n 0k|nAN2IDA0 <Vn\g/- ,?<x`$/- n (?<xRG F "n  n 0k|nA.2IDA0 <f FpLN^ _JNEADKEYBJoNVH nCJp@"S@n&n8.(m\/- HnBg/- <[?<x/- H/?<|/- HzBg?A/ .@V@<B.A/Ap? S@n?,"?,""Ahp? S@n?<"?< "?< THn?<N.@F:B. n?f /- <??<x/- `0.lf/- `A/a̠fFPFPb2a¾FFxaXva̠̖Fb2̠a̠̠&FF̠̠ ̠̠88aXr̠̠) 88,ÂFFFvaĠ̠xN̠8̠a̠L~rUyHH"N̠W;---------------------------------------------------------------- ; Example/aDeskAcc.text ; Example desk accessory ; ; For installation instructions, see the resource definition ; file Example/ADeskAccR.text ; ; Desk Accessory for displaying the heap. ; Written by Jerome Coonen 29 July 83. ; Based on the great-great-grandson of the canonical ; Papa Hertzfeld ornament. ; ; Modification History: ; ; 02-Feb-85 HAA Changed INCLUDEs to use new TLAsm file names ; ;----------------------------------------------------------------- 0.INCLUDE TLAsm/SysEqu.text 0.INCLUDE TLAsm/SysTraps.text 0.INCLUDE TLAsm/QuickEqu.text 0.INCLUDE TLAsm/ToolEqu.text 0.INCLUDE TLAsm/QuickTraps.text 0.INCLUDE TLAsm/ToolTraps.text 0.PROC Uriah cMenuID .EQU -666 ; a random resource ID cSizeRecord .EQU 100 ; random size of ornament storage cMenuHandle .EQU 0 ; offset in orn storage for menu handle cUseHeap .EQU 4 ; set to heap to display cAutoUpdate .EQU 8 ; boolean -- update every 10 seconds? ;Note: The following two equates work as of 2/13/85, but are not guaranteed ; to be dependable in the future: bcMask .EQU $00FFFFFF ; byte count mask tagMask .EQU $C0000000 ; tag field mask OrnEntry 0.WORD $2400 ; ctl-enable = needsTime 0.WORD 300 ; take a hit every 5 seconds 0.WORD $0002 ; mouse down 0.WORD cMenuID ; ; Entry point offset table 0.WORD OrnOpen - OrnEntry ; open routine 0.WORD OrnDone - OrnEntry ; prime 0.WORD OrnCtl - OrnEntry ; control 0.WORD OrnDone - OrnEntry ; status 0.WORD OrnClose - OrnEntry ; close ; Note that the size of the ornament title including the length byte must be even OrnTitle .BYTE 11 ; length of string 0.ASCII 'Uriah Heap ' ; title ; Open Routine -- allocate a window, initialize the count, allocate menu OrnOpen 0MOVEM.L A3-A4,-(SP) ;preserve regs 0MOVE.L A1,A4 ;keep DCE ptr in A4 0TST.L DCtlWindow(A1) ;already have a window? 0BNE GotAWindow ;if so, don't make a new one ; ; now allocate the new window ; 0CLR.L -(SP) ; make room for the result 0CLR.L -(SP) ; allocate on heap 0PEA cBounds ; push the boundsRect 0PEA OrnTitle ; push the title 0CLR.L -(SP) ; invisible/use defProc 0 0MOVEQ #-1,D0 ; get -1 0MOVE.L D0,-(SP) ; behind = -1 0MOVE #$0100,-(SP) ; yes, we have a goAway 0CLR.L -(SP) ; refCon is zero 0_NewWindow ; allocate a new window 0MOVE.L (SP)+,A0 ; get the windowPtr 0MOVE.L A0,DCtlWindow(A4) ; save in the DCE 0MOVE DCtlRefNum(A4),windowKind(A0) ; mark as system window ; ; Font stuff, as though we were going to write in the window. ; 0MOVE #4,TxFont(A0) ; use Gacha 0MOVE #10,TxSize(A0) ; size 10 0MOVE #srcCopy,TxMode(A0) ; ; Get a relocatable block for static values. ; 0MOVE.L #cSizeRecord,D0 ; Get the local storage 0_NewHandle 0MOVE.L A0,DCtlStorage(A4) ; save the storage handle away ; ; Allocate the menu. Initialize the check-off menu items. ; 0SUBQ #4,SP ; make room for menu handle 0MOVE.W #cMenuID,-(SP) ; push menu ID 0PEA cMenuTitle ; Allocate the menu 0_NewMenu 0MOVE.L (SP)+,A2 ; save menu handle in temp. 0MOVE.L DCtlStorage(A4),A3 ; Get the storage handle 0MOVE.L (A3),A3 ; dereference it 0MOVE.L A2,cMenuHandle(A3) ; salt menu handle away in storage 0MOVE.L ApplZone,cUseHeap(A3) ; set so application heap shown 0MOVE.B #$01,cAutoUpdate(A3) ; do automatic updating 0MOVE.L A2,-(SP) 0PEA cMenuItems ; Set the items 0_AppendMenu 0MOVE.L A2,-(SP) ; get the menu handle 0MOVE #2,-(SP) ; application heap 0MOVE.B #1,-(SP) ; push the boolean 0_CheckItem 0MOVE.L A2,-(SP) ; get the menu handle 0MOVE #4,-(SP) ; auto update 0MOVE.B #1,-(SP) ; push the boolean 0_CheckItem GotAWindow 0MOVEM.L (SP)+,A3-A4 ;restore regs OrnDone 0MOVEQ #0,D0 ;no error 0RTS ;all done with open ; ; Close Routine -- to close the ornament, we dispose the window and menu ; OrnClose 0MOVE.L A4,-(SP) ; save A4 0MOVE.L A1,A4 ; save A1=DCE from Pascal routine 0MOVE.L DCtlWindow(A4),-(SP) ; push the window 0CLR.L DCtlWindow(A4) ; we no longer have a window 0_DisposWindow ; dispose it 0BSR CloseStorage ; allocate the menu, etc. 0MOVE.L DCtlStorage(A4),A0 ; Delete the storage area 0_DisposHandle 0MOVE.L (SP)+,A4 ; restore sole saved register 0BRA.S OrnDone ; all done with close ; OrnCtl handles the control messages, which are the heart of the driver. We case out on ; the "opCode" field, which is 64 for "SendEvent", 65 for "Run", 66 for "Cursor", ; and 67 for "Menu". Ignore messages less than 64 or greater than 67. OrnCtl 0MOVEM.L A2-A4,-(SP) ; preserve A3 and A4 0MOVE.L A1,A4 ; keep DCE ptr in A4 0MOVE CSCode(A0),D0 ; get the control opCode 0SUB #64,D0 ; compare message with 64 0BMI.S CtlDone ; < 64 -- just ignore 0BEQ DoCtlEvent ; = 64 -- it's an event 0SUBQ.W #2,D0 ; compare message with 66 0BMI.S DoRun ; = 65 -- run request 0BEQ DoCtlCursor ; = 66 -- cursor 0SUBQ.W #1,D0 ; compare message with 67 0BEQ.S DoMenu ; = 67 -- menu request 0BRA.S CtlDone ; > 67 -- ignore ;------------------------------------------------ ; DoRun 0MOVE.L DCtlStorage(A4),A3 ; get the heap 0MOVE.L (A3),A3 ; dereference it 0TST.B cAutoUpdate(A3) 0BEQ.S @1 0BSR DrawWindow ; then fall through... @1 ;------------------------------------------------ ; CtlDone 0MOVE.L A4,A1 ; return DCE ptr to A1 0MOVEM.L (SP)+,A2-A4 ; A3 and A4 0MOVEQ #0,D0 ; no error 0RTS ; bye-bye ;------------------------------------------------ ; DoMenu 0MOVE.L DCtlStorage(A4),A3 ; get orn storage handle 0MOVE.L (A3),A3 ; dereference it 0MOVE CSParam+2(A0),D0 ; Get the menuItem 0SUBQ #1,D0 ; See if item 1 0BEQ.S SetSysHeap 0SUBQ #1,D0 ; See if item 2 0BEQ.S SetAppHeap 0SUBQ.W #2,D0 ; Can't be 3 0BEQ.S SetAutoUpdate 0SUBQ.W #1,D0 0BEQ.S HandUpdate 0BRA.S CtlDone SetSysHeap 0MOVE.L SysZone,cUseHeap(A3) ; set so sys heap shown 0MOVE.B #00,D0 ; not the application 0BRA.S ToggleHeap SetAppHeap 0MOVE.L ApplZone,cUseHeap(A3) ; set so application heap shown 0MOVE.B #01,D0 ; the application ToggleHeap 0MOVE.B D0,-(SP) 0MOVE.B #2,D1 0BSR.S MarkIt 0MOVE.B (SP)+,D0 0EOR.B #01,D0 ; flip it 0MOVE.B #1,D1 ; 0BSR.S MarkIt ; ; Erase the display window before drawing other window. ; 0MOVEA.L DCtlWindow(A4),A0 ; get port 0PEA portRect(A0) ; push rect for EraseRect 0PEA (A0) ; push the window for SetPort 0_SetPort ; make it the port 0_EraseRect 0BSR DrawWindow 0BRA.S CtlDone ;------------------------------------------------ ; D0 contains boolean true or false ; D1 contains item number ; A3 contains local storage ; markIt 0MOVE.L cMenuHandle(A3),-(SP) ; get the menu handle 0MOVE D1,-(SP) ; push the item 0MOVE.B D0,-(SP) ; push the boolean 0_CheckItem 0RTS ;------------------------------------------------- ; Flip auto-update boolean ; SetAutoUpdate 0MOVE.B cAutoUpdate(A3),D0 ; get auto flag 0EORI.B #1,D0 ; toggle it 0MOVE.B D0,cAutoUpdate(A3) ; replace ;------------------------------------------------- ; Common menu update code ; MarkMenu ,MOVE.W CSParam+2(A0),D1 ; item number ,BSR.S MarkIt ,BRA.S CtlDone ;------------------------------------------------- ; Just redraw the window ; HandUpdate 0BSR DrawWindow 0BRA.S CtlDone ; ; DoCtlCursor might be used to change the cursor shape when over our window ; and back to the arrow when it's not. ; DoCtlCursor 0BRA.S CtlDone ;all done ; ; DoCtlEvent handles the events received by the memWindow ornament. It handles ; mouse down, keyDown and update events ; DoCtlEvent 0MOVE.L A3,-(SP) ;save registers 0MOVE.L CSParam(A0),A3 ;get the event pointer 0MOVE.W EvtNum(A3),D0 ;get the event number ; case out on the event number. We handle events 1 (mouse down), and ; 6 (update event), 0CMP #8,D0 ;is it an activate? 0BEQ DoTheActivate ;if so, go handle it 0SUBQ #1,D0 ;is it mouse down? 0BEQ.S ItsMouseDown ;branch if it is 0SUBQ #2,D0 ;is it key down? 0BEQ.S ItsKeyDown ;branch to handle keyDown 0SUBQ #3,D0 ;is it an update? 0BEQ.S ItsUpdate ;if so, handle it ; its not an event we handle so ignore it CtlEvtDone MOVE.L (SP)+,A3 ;restore registers 0BRA CtlDone ; ignore keyDowns for now ItsKeyDown 0BRA.S CtlEvtDone ;all done ; handle the update event by redrawing the contents of the window ItsUpdate 0MOVE.L EvtMessage(A3),-(SP) ;push the window ptr 0MOVE.L (SP),-(SP) ;push it again 0_BeginUpdate ;set vis to update 0BSR DrawWindow ;draw it 0_EndUpdate 0BRA.S CtlEvtDone ; handle the mouseDown by calling FindControl and tracking the control if its in one ItsMouseDown 0BRA CtlEvtDone ;all done! ; DoTheActivate either puts shows or hides the scroll bar, depending on ; the state of the activate bit. DoTheActivate 0BTST #0,EvtMeta+1(A3) ; activate or de-activate? 0BEQ.S TakeItDown ; if deactivate, take it down ; show the menu 0MOVE.L DCtlStorage(A4),A3 ; Insert the menu item 0MOVE.L (A3),A3 ; dereference it 0MOVE.L cMenuHandle(A3),-(SP) ; 0CLR.W -(SP) ; on the end 0_InsertMenu 0_DrawMenuBar ; Display it 0BRA CtlEvtDone ; all done ; ; hide the menu ; TakeItDown 0MOVE.W #cMenuID,-(SP) ; Delete the menu from bar 0_DeleteMenu 0_DrawMenuBar ; Redisplay it 0BRA CtlEvtDone ; ; CloseStorage deallocates the menu and sets up local memory ; CloseStorage 0MOVE.W #cMenuID,-(SP) ; Delete the menu from bar 0_DeleteMenu 0_DrawMenuBar ; Redisplay it 0MOVE.L DCtlStorage(A4),A0 ; Delete the menu data 0MOVE.L (A0),A0 0MOVE.L cMenuHandle(A0),A0 ; get handle in A0 0_DisposHandle 0RTS ; ; DrawWindow scans the heap and redraws the window. ; DrawWindow ,MOVEM.L D3-D6/A2-A3,-(SP) ; save work regs ,MOVE.L DCtlWindow(A4),-(SP) ; push the window ptr twice for ,MOVE.L (SP),-(SP) ; SizeWindow and setport ; ; Initialize the topLeft pointer (D6) to 0,0. ; Then work down and to the right. ; ,MOVEQ #0,D6 ,MOVE.L DCtlStorage(A4),A3 ; get the heap ,MOVE.L (A3),A3 ; dereference it ,MOVE.L cUseHeap(A3),A3 ; get zone ptr ; ; Size the window by computing the heap extent and dividing by 260 to get ; the number of columns of pixels. Force width up to a multiple of 8 and ; require a minimum. ; ,LEA HeapData(A3),A1 ; ptr to first block ,MOVE.L A1,D1 ,MOVE.L BkLim(A3),D0 ; ptr beyond last usable block ,AND.L maskBC,D1 ,AND.L maskBC,D0 ,SUB.L D1,D0 ; size of heap in bytes ,DIVU #260,D0 ; number of pixel columns ,LSR.L #3,D0 ; divide by eight... ,ADDQ.L #1,D0 ; round up... ,LSL.L #3,D0 ; and multiply by eight ,CMPI.W #152,D0 ; a reasonable minimum ,BHS.S @2 ,MOVE.W #152,D0 @2 ,MOVE.W D0,-(SP) ; width ,MOVE.W #260,-(SP) ; fixed height ,MOVE.B #0,-(SP) ; FALSE, no update ,_SizeWindow ,_SetPort ; make it the port ,LEA HeapData(A3),A0 ; ptr to first block, for loop Continue ; ; Compute the next pointer right away. For the purposes of displaying even ; blocks of 8 bytes, round the first pointer down to nearest 8-byte block. ; ,MOVE.L tagBC(A0),D0 ; size/tag ,MOVE.L handle(A0),D1 ; handle ,MOVE.L D0,D2 ,ANDI.L #BCMask,D0 ; block size in bytes ,MOVEA.L D0,A2 ,ADDA.L A0,A2 ; ptr to next block ,MOVE.L A0,D0 ,ANDI.L #$FFFFFFF8,D0 ; kill low 3 bits ,SUB.L A2,D0 ,NEG.L D0 ,LSR.L #3,D0 ; number of indicator lines ; ; Now set up the pen pattern in A0 for call to display routine. ; ,MOVEA.L 0(A5),A1 ; get global ptr for graphics ,LEA white(A1),A0 ; pen pattern for nonrelocatable ,AND.L #TagMask,D2 ,BEQ.S FreeBlock ,BGT.S GotBlock ; ; Classify the relocatable blocks as ; (1) unlocked and not purged ; (2) locked ; (3) purged ; ,LEA dkGray(A1),A0 ; assume (1) unlk and not prgbl ,MOVE.B 0(A3,D1),D1 ; master ptr, if relocatable ,BMI.S LockedBlock ,ADD.B D1,D1 ; get purgeable bit in sign ,BPL.S GotBlock ,LEA PurgeablePat,A0 ; purgeable relocatable ,BRA.S GotBlock LockedBlock ,LEA ltGray(A1),A0 ; locked relocatable block ,BRA.S GotBlock FreeBlock ,LEA black(A1),A0 ; free block GotBlock ,BSR.S ShowLines ,MOVEA.L A2,A0 ; get next block pointer ,CMP.L bkLim(A3),A0 ; see if at end ,BNE Continue ,MOVEM.L (SP)+,D3-D6/A2-A3 ,RTS ;------------------------------------------------ ; Display D0.W lines of pattern (A0) ; D6 is the current topLeft pointer, which is updated ; after each block is displayed. ; ShowLines ,MOVE.W D0,D3 ; safe place for index ,PEA (A0) ,_PenPat ; pen pattern for PaintRect ShQuickEntry ,MOVE.L D6,D0 ; top/left ,MOVE.L D6,D1 ; will be bottom/right ,ADDQ.W #8,D1 ; right := left + 8 ,SWAP D1 ; align bottom in low word ,ADD.W D3,D1 ; tentative bottom ,CMPI.W #260,D1 ; farther down than 260? ,BHS.S ShTwoBlocks ,SWAP D1 ; align bottom/right ,MOVE.L D1,D6 ; new top/left ,SUBQ.W #8,D6 ; convert top/right to top/left ,BRA.S PaintTheRect ; Easy case -- paint and go ; ; If there is a spillover, just paint the rest of this column ; and fake another call to routine. ; ShTwoBlocks ,SUBI.W #260,D1 ; what's left after this column ,MOVE.W D1,D3 ; the next count ,MOVE.W #260,D1 ; set bottom to the real bottom ,SWAP D1 ; align bottom/right ,MOVEQ #0,D6 ; next top will be zero ,MOVE.W D1,D6 ; this right will be next left ,BSR.S PaintTheRect ,BRA.S ShQuickEntry ;------------------------------------------------ ; D0 = top/left ; D1 = bottom/right ; PaintTheRect ,MOVEM.L D0-D1,-(SP) ; push rect value ,PEA (SP) ,_PaintRect ,ADDQ.L #8,SP ; kill rect value ,RTS FreePat .WORD $FFFF, $FFFF, $FFFF, $FFFF RelPat .WORD $AAAA, $AAAA, $AAAA, $AAAA NonRelPat .WORD $0000, $0000, $0000, $0000 PurgeablePat .WORD $E7E7, $E7E7, $E7E7, $E7E7 LockedPat .WORD $BDBD, $BDBD, $BDBD, $BDBD cMenuTitle .BYTE 6 0.ASCII 'Uriah ' cMenuItems .BYTE 52 0.ASCII 'System;Application;-------' ; 26 each 0.ASCII ';Auto-Refresh;Hand-Refresh' cBounds .WORD 42,0,302,200 0.END 3. "6F^9exD!$ǐ^OOs./4nto SYSTEM 0N> =@šL vL vextex&b2ad¾FFxaXv ̞%o?3:&&̜*example/ADeskAccR.text --- resource definition file for example/ADeskAcc.text * *To create and install this desk accessory: * assemble the file example/ADeskAcc.text * run this file (example/ADeskAccR.text) through RMaker * use Resource Mover to copy & paste the resulting DRVR resource into SYSTEM example/ADeskAcc.rsrc type DRVR #example/ADeskAcc!Uriah,25 9FO ^KK 4ct(testRect, HiWord(pt1.x), HiWord(pt1.y), HiWord(pt2.x), 0HiWord(pt2.y)); ,InSetRect(testRect, -1, -1); ,IF SectRect(myRect, testRect, testRect) THEN EXIT(MakeBox) ,END; )myBox.pt1 := p1; )myBox.pt2 := p2; ){ calc midpoint of box and its distance from the eye } #(* p1.x := FixDiv(p1.x + p2.x, 131072); )p1.y := FixDiv(p1.y + p2.y, 131072); )p1.z := FixDiv(p1.z + p2.z, 131072); )Transform(p1, p2); )myBox.dist :={$X-} {$R-} {$D-} PROGRAM Boxes; #USES {$U-} &{$U obj/Memtypes } Memtypes, &{$U obj/QuickDraw } QuickDraw, &{$U obj/OSIntf } OSIntf, &{$U obj/ToolIntf } ToolIntf, &{$U obj/FixMath } FixMath, &{$U obj/Graf3D } Graf3D; {Note: This file must be linked with obj/FixAsm and obj/Graf3D. 'To build using example/exec, add these two files to the link list.} #CONST &boxCount = 15; &keyOrMouse = mDownMask + keyDownMask; #TYPE &Box3D = RECORD 1pt1: Point3D; 1pt2: Point3D; +(* dist: fixed; *) .END; #VAR &myPort: GrafPort; &myPort3D: Port3D; &boxArray: ARRAY [0..boxCount] OF Box3D; &nBoxes: INTEGER; &i: INTEGER; &dummy: EventRecord; (* #FUNCTION Distance(pt1, pt2: Point3D): fixed; &VAR )dx,dy,dz: fixed; )shift: INTEGER; &BEGIN )dx := pt2.X - pt1.X; )dy := pt2.Y - pt1.Y; )dz := pt2.Z - pt1.Z; ({Note: if |dx|, |dy| or |dz| > 181, overflow will occur. To avoid this, )at some sacrifice of precision, all three are factored down as needed. )(181 squared = 32761, about the limit of fixed point.)} )shift := 6; {equal to divide by 128, = square root of 16384. 6(Fixed and Frac differ by a factor of 16384.)} )WHILE ABS(dx) + ABS(dy) + ABS(dz) > 11862015 DO {conservative, 181*65536-1} )BEGIN ,dx := FixDiv(dx, 262144); {divide by 4} ,dy := FixDiv(dy, 262144); ,dz := FixDiv(dz, 262144); ,shift := shift - 1; {shift will never go to zero, don't worry} )END; )Distance := *BitSR(FracSqrt(FixMul(dx,dx) + FixMul(dy,dy) + FixMul(dz,dz)), shift); &END; *) #PROCEDURE DrawBrick(pt1, pt2: Point3D); #{ draws a 3D brick with shaded faces. } #{ only shades correctly in one direction } &VAR )tempRgn: RgnHandle; &BEGIN )tempRgn := NewRgn; )OpenRgn; )MoveTo3D(pt1.X, pt1.Y, pt1.Z); { front face, y=y1 } )LineTo3D(pt1.X, pt1.Y, pt2.Z); )LineTo3D(pt2.X, pt1.Y, pt2.Z); )LineTo3D(pt2.X, pt1.Y, pt1.Z); )LineTo3D(pt1.X, pt1.Y, pt1.Z); )CloseRgn(tempRgn); )FillRgn(tempRgn, white); )OpenRgn; )MoveTo3D(pt1.X, pt1.Y, pt2.Z); { top face, z=z2 } )LineTo3D(pt1.X, pt2.Y, pt2.Z); )LineTo3D(pt2.X, pt2.Y, pt2.Z); )LineTo3D(pt2.X, pt1.Y, pt2.Z); )LineTo3D(pt1.X, pt1.Y, pt2.Z); )CloseRgn(tempRgn); )FillRgn(tempRgn, gray); )OpenRgn; )MoveTo3D(pt2.X, pt1.Y, pt1.Z); { right face, x=x2 } )LineTo3D(pt2.X, pt1.Y, pt2.Z); )LineTo3D(pt2.X, pt2.Y, pt2.Z); )LineTo3D(pt2.X, pt2.Y, pt1.Z); )LineTo3D(pt2.X, pt1.Y, pt1.Z); )CloseRgn(tempRgn); )FillRgn(tempRgn, black); )PenPat(white); )MoveTo3D(pt2.X, pt2.Y, pt2.Z); { outline right } )LineTo3D(pt2.X, pt2.Y, pt1.Z); )LineTo3D(pt2.X, pt1.Y, pt1.Z); )PenNormal; )DisposeRgn(tempRgn); &END; #PROCEDURE MakeBox; &VAR )myBox: Box3D; )i, j, h, v: INTEGER; )p1, p2: Point3D; )myRect: Rect; )testRect: Rect; &BEGIN )p1.x := FixRatio((Random mod 70 - 15), 1); )p1.y := FixRatio((Random mod 70 - 10), 1); )p1.z := 0; )p2.x := p1.x + FixRatio((10 + ABS(Random) MOD 30), 1); )p2.y := p1.y + FixRatio((10 + ABS(Random) MOD 45), 1); )p2.z := p1.z + FixRatio((10 + ABS(Random) MOD 35), 1); ){ reject box if it intersects one already in list } )SetRect(myRect, HiWord(p1.x), HiWord(p1.y), HiWord(p2.x), HiWord(p2.y)); )FOR i := 0 TO nBoxes - 1 DO ,BEGIN ,WITH boxArray[i] DO /SetRect(testRect, HiWord(pt1.x), HiWord(pt1.y), HiWord(pt2.x), 0HiWord(pt2.y)); ,InSetRect(testRect, -1, -1); ,IF SectRect(myRect, testRect, testRect) THEN EXIT(MakeBox) ,END; )myBox.pt1 := p1; )myBox.pt2 := p2; ){ calc midpoint of box and its distance from the eye } #(* p1.x := FixDiv(p1.x + p2.x, 131072); )p1.y := FixDiv(p1.y + p2.y, 131072); )p1.z := FixDiv(p1.z + p2.z, 131072); )Transform(p1, p2); )myBox.dist := Distance(p2, myPort3D.eye); { distance to eye } )i := 0; )boxArray[nBoxes].dist := myBox.dist; { sentinel } )WHILE myBox.dist > boxArray[i].dist DO ,i := i + 1; { insert in order of dist } #*) )i := 0; )boxArray[nBoxes].pt1 := myBox.pt1; { sentinel } )boxArray[nBoxes].pt2 := myBox.pt2; )WHILE )((myBox.pt1.y > boxArray[i].pt2.y) AND (myBox.pt2.y > boxArray[i].pt1.y)) OR )((myBox.pt1.x < boxArray[i].pt2.x) AND (myBox.pt2.x < boxArray[i].pt1.x)) DO ,i := i + 1; { insert in order of dist } )FOR j := nBoxes DOWNTO i + 1 DO boxArray[j] := boxArray[j - 1]; )boxArray[i] := myBox; )nBoxes := nBoxes + 1; &END; BEGIN { main program } #FlushEvents(everyEvent, 0); #InitGraf(@thePort); #InitCursor; #HideCursor; #OpenPort(@myPort); #Open3DPort(@myPort3D); #ViewPort(myPort.portRect); { put the image in this rect } #LookAt(FixRatio(-100, 1), FixRatio(75, 1), FixRatio(100, 1), &FixRatio(-75, 1)); { aim the camera into 3D space } #ViewAngle(FixRatio(30, 1)); { choose lens focal length } #Identity; #Roll(FixRatio(20, 1)); #Pitch(FixRatio(70, 1)); { roll and pitch the plane } #REPEAT &nBoxes := 0; &REPEAT )MakeBox &UNTIL nBoxes=boxCount; &PenPat(white); &BackPat(black); &EraseRect(myPort.portRect); &FOR i := -10 TO 10 DO )BEGIN )MoveTo3D(FixRatio(i*10, 1), FixRatio(-100, 1), 0); )LineTo3D(FixRatio(i*10, 1), FixRatio(100, 1), 0); )END; &FOR i := -10 TO 10 DO )BEGIN )MoveTo3D(FixRatio(-100, 1), FixRatio(i*10, 1), 0); )LineTo3D(FixRatio(100, 1), FixRatio(i*10, 1), 0); )END; &FOR i := nBoxes-1 DOWNTO 0 DO DrawBrick(boxArray[i].pt1,boxArray[i].pt2); #UNTIL OSEventAvail(keyOrMouse, dummy); END. 3. "6F^9D!$ǐ^ 0Aacd): BFFLFFF@`>`̣fFPFP[aa(¾FFx`va(̣a̠jạa(̠BFF&FF̣̣ ̣̣88`ṛ̣,88,ÂFFFv`ĠTjx̣`̣`̣L~rUSUHH"ṆWexample/boxes.rsrc Type CODE example/boxesl,0 3. "6F^9D!$ǐ^*;;e)supplement) t BFFLFFF@a>a̘rfFPFPb2a¾FFxaXva̘̍(̌b2̘b2̘a̘rFF&FF̘r̘ ̘̘88aXr̘̘,88,ÂFFFvaĠx̘a̘ra̘rL~rUCUCHH"N̘pW{ File -- Example code for a text editor } { -- by Cary Clark, Macintosh Technical Support } PROGRAM MyFile; { Please read 'Instructions' and 'More Info', included on the MacStuff 2 disk. } {$DECL BUG} {$SETC BUG := 0} {One good way of debugging code is to write status information to one of the serial ports. Even while debugging code which uses one of the ports, the other can be used for transmitting information to an external terminal. In this program, the compile time variable BUG is set to either -1, 0 or 1 according to the extent of the debugging information required. Since compile time variables or constants are used, setting a single flag should cause the resulting program to have no more code than is required by the debugging level requested. If BUG is set equal to -1, then no debugging information appears; this is as you would want the end user to see your product. BUG set to 0 provides an additional menu bar called 'debug' that can display the amount of memory available, compact memory, and discard segments and resources resident in memory. You can do something similar to display some debugging information on the Mac itself if you do not have a terminal, but the penalty here is that you may spend much of your time debugging the code which is intended to debug some other part of the program. Obviously, creating and maintaining a window on a screen full of other windows in untested code is a difficult thing to do. BUG set to 1 adds an additional item to the 'debug' menu that writes various runtime information to an external terminal. This is the preferred method of debugging, since it does not interfere with the Macintosh display. Even if you do not have a separate terminal, you can use the LISA terminal program to act as one. Since writing a lot of debugging information to a serial port can slow the program down, I would recommend a way of turning the information on and off. In this program, the variable DEBUG is set to true or false in the beginning of one of the first procedures executed, SETUP, to provide debugging information. The DEBUG variable may also be set by the bottom item on the rightmost menu.} {$U-} {Turn off the Lisa Libraries. This is required by Workshop.} {$X-} {Turn off stack expansion. This is a Lisa concept, not needed on Mac.} {$R-} {Turn off range checking.} {$IFC BUG > -1} #{$D+} {Put the procedures name just after it in the code, to help in debugging} {$ELSEC} #{$D-} {Do not include the procedure name in the 'production' code} {$ENDC} {$L-} {don't list the interfaces} USES #{$U Obj/MemTypes } MemTypes, #{$U Obj/QuickDraw } QuickDraw, #{$U Obj/OSIntf } OSIntf, #{$U Obj/ToolIntf } ToolIntf, #{$U Obj/PackIntf } PackIntf, #{$U Obj/MacPrint } MacPrint, #{$U Obj/PasLibIntf } PasLibIntf; {$L+} {just list the program} CONST #appleMenu = 1; #FileMenu = 2; #EditMenu = 3; #DebugMenu = 4; {These constants are declared for this application to distinguish between the various types of windows that it can create. The number is stored in the window field windowkind.} #MyDocument = 8; #Clipboard = 9; #FreeMemory = 10; {$IFC BUG = -1} #lastMenu = 3; { number of menus w/o debug} {$ELSEC} #lastMenu = 4; { number of menus w/ debug} {$ENDC} #lf = CHR(10); { At present, information written to the external terminal 8needs its own linefeed.} {$IFC BUG < 1} #debug = FALSE; { compiler will discard code after 'If debug ...'} {$ENDC} TYPE #ProcOrFunc = (proc, func, neither); #edset = set of 1..9; #LomemPtr = ^LongInt; #MyData = RECORD {each document window keeps a handle to this in WRefCon} .TERecord: TEHandle; {the text associated with this document} .FileVolume: INTEGER; {which volume, if loaded from disk} .changed: BOOLEAN; {the document is 'dirty'} .titled: BOOLEAN; {the document has never been saved to disk} ,END; #MyDataPtr = ^MyData; #MyDataHandle = ^MyDataPtr; { <<< this little beauty does a form feed when you print this out. 'Copy and Paste it to move it to your source code} {Here are a ton of global variables. This is not a good programming example. You professionals, of course, will keep the number of globals in your own programs to a much smaller number than shown here.} {these first six values are changed as windows are activated} VAR #MyWindow: WindowPtr; #MyPeek: WindowPeek; {MyPeek is the same as MyWindow} #WindowData: MyDataHandle; {this record is pointed to by the WRefCon.} #hTE: TEHandle; {The active text edit handle} #vScroll: ControlHandle; {The active vertical scroll bar.} #whichpart: INTEGER; {The last button pressed} #topline: INTEGER; {the value of VScroll, also the visible top line.} #printhdl: THPrint; {initialized in SetUp, used by MyPrint} #myMenus: ARRAY %[1..lastMenu] OF MenuHandle; {Handles to all of the menus} #growRect, {contains how big and small the window can grow} #dragRect: Rect; {contains where the window can be dragged} #tempwindow: WindowPtr; {window referenced by GetNextEvent (bad pgmming.)} #theChar: CHAR; {keyboard input goes here} #myPoint: Point; {the point where an event took place} #lastCount: INTEGER; {last scrap count, to see if it has changed} #lastPaste: INTEGER; {the scrap value when the last paste was made} #doneFlag: BOOLEAN; {set when the user quits the program} #myEvent: EventRecord; {returned by GetNextEvent} #scrapwind: WindowPtr; {the ClipBoard window, which contains the scrap} #iBeamHdl: CursHandle; {the text editing cursor} #watchHdl: CursHandle; {the wait cursor} #windownum: LongInt; {the # of untitled windows opened} #windowpos: LongInt; {the # of windows opened} #MyFileTypes: SFTypeList; {same as txtfile, in a format for Standard File} #firstchar: INTEGER; {position of first character on top visible line} #printflag: BOOLEAN; {the user selected 'Print' from the File menu} #finderprint: BOOLEAN; {the user selected 'Print' from the Finder} #Dlogptr: DialogPtr; {the dialog box used when printing from Finder} #printing: BOOLEAN; {printing is currently in progress} #printport: grafptr; {port preserved during background printing} #numfiles: INTEGER; {number of files selected in finder} #applLimit, {a pointer to the bottom of the stack area} #heapend: LomemPtr; {a pointer to the end of the application heap} #dummy: Handle; {a temporary handle used to grow the heap} {$IFC BUG > -1} #FreeWind: WindowPtr; {the free memory window} #oldmem: LongInt; {the last amount of free memory} {$ENDC} {$IFC BUG = 1} #debug: BOOLEAN; {$ENDC} #debugger: text; {the external terminal file} {------------------------------------------------------------------------------------} PROCEDURE AutoScroll; EXTERNAL; {This assembly routine is called by the innerds of TextEdit when the user drags a selection range outside of the current window.} FUNCTION NewPtrClear (byteCount: Size): Ptr; EXTERNAL; {The NewPtr and NewHandle traps have a bit that clears the memory reserved by the call when set. This assembly sets that bit for the NewPtr trap.} PROCEDURE MainEventLoop; FORWARD; {This is declared forward so the printing can take the main event loop as a procedure to execute while it is idleing} FUNCTION MyGrowZone (cbNeeded: Size) : Size; FORWARD; {This is declared forward so that it can be resident in the blank segment, which is always loaded, and still be referenced by the SetUp procedure} {$S Utilities} {------------------------------------------------------------------------------------} PROCEDURE DebugInProc (prockind: ProcOrFunc; where: str255; location: ptr); {This procedure writes the executing routine's name and location in memory on the external terminal. The location is especially important in a program like this that has segments.} BEGIN {$IFC BUG = 1} "Write (debugger, 'in '); "IF prockind = proc THEN Write (debugger, 'Procedure '); "IF prockind = func THEN Write (debugger, 'Function '); "Writeln (debugger, where, ' @ ', ORD4(location), lf) {$ENDC} END; {------------------------------------------------------------------------------------} PROCEDURE SetScrollMax; Var cr : INTEGER; $return : char; $max: INTEGER; BEGIN {This adjusts the scroll value so that the scroll bar range is not allowed to exceed the end of the text. Also, the scroll bar is disabled if the max is set equal to the min, which is zero. The formula for determining the range is somewhat complex. Sorry.} "IF debug THEN debuginproc (proc, 'SetScrollMax', @SetScrollMax); "WITH hTE^^, hTE^^.viewrect DO "BEGIN $cr := 0; $return := CHR(13); $IF teLength > 0 THEN &IF Munger (htext, teLength-1, Pointer(ORD4(@return)+1), 1, NIL, 1) > 0 &THEN cr := 1; $max := nLines + cr - (bottom - top+1) DIV lineHeight; $IF max < 0 THEN max := 0; $SetCtlMax (VScroll, max); $IF debug THEN Writeln (debugger, 'vscrollmax =', max,lf); $topline := -destrect.top DIV lineheight; $SetCtlValue (vscroll, topline); $IF debug THEN Writeln (debugger, 'topline =',topline,lf) "END; END; {------------------------------------------------------------------------------------} PROCEDURE ScrollText (showcaret: BOOLEAN); {called to either show the caret after an action like 'Copy'; also called to adjust the text within the window after the window is resized. The same formula used in SetScrollMax is used here as well. Don't worry about how this works, too much. This possibly could be made much simpler.} Var bottomline, viewlines, SelLine, scrlAmount, numlines, blanklines, newtop %,return: INTEGER; BEGIN "IF debug THEN DebugInProc (proc, 'ScrollText', @ScrollText); "WITH hTE^^ DO "BEGIN $scrlAmount := 0; $numlines := nlines; {if the last character is a carriage return, add 1 to numlines} $return := $0D00; $IF teLength > 0 THEN &IF Munger (htext, teLength-1, @return, 1, NIL, 1) > 0 &THEN numlines := numlines + 1; $WITH HTE^^.viewrect DO %viewlines := (bottom - top+1) DIV lineHeight; {don't count partial lines} $topline := -destrect.top DIV lineheight; $bottomline := topline + viewlines - 1; $IF showcaret $THEN $BEGIN &selLine := 0; &WHILE (selLine+1 < nlines) AND (selstart >=linestarts[selLine+1]) DO 'selLine := selLine + 1; %{if selstart = selend is @ a cr, then add 1 to selstline} &IF (selstart = selend) AND (selstart > 0) THEN &IF Munger (htext, selstart-1, Pointer(ORD4(@return)+1), 1, NIL, 1) = selstart-1 &THEN selLine := selLine + 1; &IF debug THEN &BEGIN (Write (debugger, 'selstart=',selstart:5,'; selLine=',selLine:5); (IF selstart > 0 THEN &END; &IF SelLine > bottomline THEN &BEGIN (scrlAmount := bottomline - SelLine; (IF numlines - SelLine > viewlines DIV 2 (THEN scrlAmount := scrlAmount - viewlines DIV 2 (ELSE ScrlAMount := ScrlAmount - numlines + SelLine + 1 &END; &IF SelLine < topline THEN &BEGIN (scrlAmount := topline - SelLine; (IF selLine > viewlines DIV 2 (THEN scrlAmount := scrlAmount + viewlines DIV 2 (ELSE ScrlAMount := ScrlAmount + selLine &END $END; $IF scrlAmount = 0 THEN $BEGIN &blanklines := viewlines - numlines + topline; &IF blanklines < 0 THEN blanklines := 0; &IF (blanklines > 0) AND (topline > 0) THEN &BEGIN (scrlAmount := blanklines; (IF scrlAmount > topline THEN scrlAmount := topline &END; &IF NOT showcaret THEN &BEGIN (newtop := 0; (WHILE (newtop+1 < nlines) AND (firstchar >= linestarts[newtop+1]) DO )newtop := newtop + 1; (IF (newtop <> topline) AND (ABS(newtop - topline) > ABS(scrlAmount)) THEN )scrlAmount := topline - newtop &END $END; $IF debug THEN $BEGIN &Write (debugger, 'newtop=',newtop:4,'; blanklines=',blanklines:4); &Writeln (debugger, '; newtop - topline=',newtop - topline,lf) $END; $IF scrlamount <> 0 THEN $BEGIN &IF selstart = selend THEN TEDeactivate (hTE); &TEScroll (0, scrlAmount * lineheight, hTE); &IF selstart = selend THEN TEActivate (hTE) $END; $IF debug THEN Writeln (debugger, 'scrlAmount=',scrlAmount:4,lf); $SetScrollMax "END END; {------------------------------------------------------------------------------------} PROCEDURE ToggleScrap; Var temppeek: windowPeek; $getwhich: INTEGER; $showhidestr: Str255; BEGIN {The clipboard comes and goes, here. The last item in the editmenu is alternately made to read, 'Show Clipboard' and 'Hide Clipboard'.} "IF debug THEN DebugInProc (proc, 'ToggleScrap', @ToggleScrap); "IF ScrapWind = NIL THEN {make it appear} "BEGIN $scrapwind := GetNewWindow (257, NIL, Pointer (-1)); $Temppeek := windowPeek (scrapwind); $Temppeek^.windowkind := Clipboard; $SetPort (scrapwind); $InvalRect (scrapwind^.Portrect); $GetWhich := 5 {hide clipboard} "END "ELSE {make it disappear} "BEGIN $DisposeWindow (scrapwind); $Scrapwind := NIL; $GetWhich := 4 {show clipboard} "END; "GetIndString (showhidestr, 256, getwhich); "SetItem (myMenus[EditMenu], 9, showhidestr); END; {$IFC BUG > -1} {------------------------------------------------------------------------------------} PROCEDURE ToggleFree; Var temppeek: windowpeek; $getwhich: INTEGER; $showhidestr: Str255; BEGIN {just about the same as ToggleClipboard, above. This is just for debugging fun.} "IF debug THEN DebugInProc (proc, 'ToggleFree', @ToggleFree); "IF FreeWind = NIL THEN {make it appear} "BEGIN $Freewind := GetNewWindow (258, NIL, Pointer (-1)); $Temppeek := windowPeek (Freewind); $Temppeek^.windowkind := FreeMemory; $SetPort (Freewind); $InvalRect (Freewind^.Portrect); $GetWhich := 3; "END "ELSE {make it disappear} "BEGIN $DisposeWindow (Freewind); $Freewind := NIL; $GetWhich := 2 "END; "GetIndString (showhidestr, 257, getwhich); "SetItem (myMenus[DebugMenu], 1, showhidestr); END; {$ENDC} {------------------------------------------------------------------------------------} PROCEDURE SetViewRect; BEGIN {text edit's view rect is inset in the content of the window, to prevent it from running into the lefthand side or the scroll bar.} "IF debug THEN DebugInProc (proc, 'SetViewRect', @SetViewRect); "WITH hTE^^.viewrect DO "BEGIN $hTE^^.viewrect := MyWindow^.portRect; $left := left +4; $right := right -15 "END END; {------------------------------------------------------------------------------------} PROCEDURE MoveScrollBar; BEGIN {When the window is resized, the scroll bar needs to be stretched to fit.} "IF debug THEN DebugInProc (proc, 'MoveScrollBar', @MoveScrollBar); "WITH MyWindow^.portRect DO "BEGIN $HideControl(vScroll); $MoveControl(vScroll,right-15,top-1); $SizeControl(vScroll,16,bottom-top-13); $ShowControl(vScroll) "END END; {------------------------------------------------------------------------------------} PROCEDURE GrowWnd; { Handles growing and sizing the window and manipulating the update region. } VAR longStuff: RECORD CASE INTEGER OF &1 : (longResult : LONGINT); {Information returned by MenuSelect} &2 : (height, {Which menu was selected} +width : INTEGER) {Which item within the menu} $END; $height, width, newvert, oldstart: INTEGER; $tRect, oldportrect: Rect; BEGIN "IF debug THEN DebugInProc (proc, 'GrowWnd', @GrowWnd); "WITH longStuff DO "BEGIN $longResult := GrowWindow(MyWindow,myEvent.where,growRect); $IF longResult = 0 THEN EXIT(GrowWnd); $Setcursor (watchhdl^^); {because the word wrap could take a second or two} $SizeWindow(MyWindow,width,height,TRUE); { Now draw the newly sized window. } $InvalRect (MyWindow^.portrect); $IF MyPeek^.windowkind = MyDocument THEN {it's not the clipboard} $BEGIN &MoveScrollBar; &WITH MyWindow^.portRect DO &BEGIN (width := right-left-19; (height := bottom-top &END; &WITH HTE^^ DO &BEGIN (destrect.right := destrect.left + width; (viewrect.right := viewrect.left + width; (viewrect.bottom := viewrect.top + height; (firstchar := hTE^^.linestarts [topline]; (TECalText (hTE); {re-wrap the text to fit the new screen.} ({if the rectangle is grown such that there is now blank space on the bottom (of the screen, backpedal the screen to fill it back up, if there is enough (scrolled off the screen to do so. Otherwise, the first character in the top line on (the screen should continue to be somewhere on the top line after resizing} (ScrollText (FALSE); &END $END "END END; { of GrowWnd } {------------------------------------------------------------------------------------} PROCEDURE MyActivate; VAR tRect : rect; BEGIN {activate events occur when one window appears in front of another. This takes care of hiliting the scroll bar and deactivating the insertion caret or the text selection.} "IF debug THEN DebugInProc (proc, 'MyActivate', @MyActivate); "MyWindow := windowPtr (MyEvent.message); "MyPeek := windowPeek (MyWindow); "IF MyPeek^.windowkind in [MyDocument,Clipboard] THEN "BEGIN {redraw the scrollbar area, if a document or the clipboard} $SetPort (MyWindow); $tRect := MyWindow^.portRect; $tRect.left := tRect.right-16; $InvalRect(tRect) "END; "IF MyPeek^.windowkind = MyDocument THEN "BEGIN {make global variables point to the information associated with this window} $WindowData := MyDataHandle (GetWRefCon (MyWindow)); $VScroll := ControlHandle (MyPeek^.ControlList); $hTE := WindowData^^.TERecord; $IF ODD (myEvent.modifiers) $THEN $BEGIN {this window is now top most} &TEActivate(hTE); &ShowControl (VScroll); &topline := GetCtlValue (VScroll) $END $ELSE $BEGIN {this window is no longer top most} &HideControl (VScroll); &TEDeactivate(hTE); &hTE := NIL {a document is no longer on top} $END "END END; { of activateEvt } {------------------------------------------------------------------------------------} PROCEDURE DialogueDeactivate; var temprect: rect; BEGIN {This routine takes care of cases where, for instance, a modal dialog is about to pop up in front of all the other windows. Since the Dialog Manager handles all activate events for you, you do not get a chance to 'turn off' the controls associated with the window. This routine is called just before the dialog box makes its appearance, and takes care of the hiliting as if an activate event had occured.} "IF debug THEN DebugInProc (proc, 'DialogueDeactivate', @DialogueDeactivate); "IF hTE <> NIL THEN {for documents, only} "BEGIN $TEDeactivate(hTE); $HideControl (VScroll); $SetCursor (arrow) "END; "IF (frontwindow <> NIL) AND (Mypeek^.windowkind IN [MyDocument, Clipboard]) THEN "BEGIN {this is a little kludgy, but it works.} $Mypeek^.hilited := FALSE; {DrawGrowIcon will now unhilite.} $temprect := MyWindow^.PortRect; $temprect.left := temprect.right - 15; $Cliprect (temprect); {clipaway the horizontal scrollbar part} $DrawGrowIcon (MyWindow); $Cliprect (MyWindow^.PortRect); $Mypeek^.hilited := TRUE {fix things back} "END END; {$S READFILE} {------------------------------------------------------------------------------------} Function ReadFile (VrefNo: INTEGER; FName : str255) : BOOLEAN; Var refNo, io : INTEGER; $logEOF: LongInt; $errin: str255; {------------------------------------------------------------------------------------} "Procedure DiskRErr (io : INTEGER); "Var str: str255; &readfromstr, loadedstr, str1: Str255; &dummy: INTEGER; "BEGIN {A generic error is reported to the user if something goes wrong. Amazingly little can go wrong, since the user does not get the chance to do things like type file names, remove the disk himself, and so on. About the only error that could happen is: an error occured while reading the disk (damaged media or hardware) Can you think of anything else? A similar routine further down handles writing to disk. Note that in both reading and writing, the entire file is handled by a single read/write call, and no 'disk buffer' needs to be specified by the programmer.} $IF debug THEN $BEGIN &DebugInProc (func, 'DiskRErr', @DiskRErr); &Writeln (debugger, errin, ' err = ', io, lf) $END; $GetIndString (readfromstr, 256, 9); {this says 'reading from'} $GetIndString (loadedstr ,256, 11); {this says 'loaded'} $IF io = IOErr $THEN GetIndString (str, 256, 21) {this says 'IO error'} $ELSE $BEGIN &NumToString (io, str1); &GetIndString (str, 256, 22); {this is the generic 'ID ='} &str := Concat (str, str1) $END; $Paramtext (readfromstr, FName, loadedstr, str); $SetCursor (arrow); $dummy := StopAlert (256, NIL); {discribe error to user in generic way.} $Exit (readfile) "END; BEGIN "IF debug THEN "BEGIN $DebugInProc (func, 'ReadFile', @ReadFile); $writeln (debugger, 'volume = ', vrefno, '; file = ', fname, lf) "END; "SetCursor (watchHdl^^); "ReadFile := FALSE; "io := FSOpen (Fname, VRefNo, RefNo); {$IFC BUG = 1} {these debugging statements are for the external terminal, only} "errin := 'FSOpen'; {$ENDC} "IF io <> 0 THEN DiskRErr (io); "io := GetEOF (RefNo, logEOF); {$IFC BUG = 1} "errin := 'GetEOF'; {$ENDC} "IF io <> 0 THEN DiskRErr (io); "{add code here: if file is too large, then notify user and truncate} "SetHandleSize (hTE^^.hText, logEOF); "IF debug THEN IF memerror<>0 THEN Writeln (debugger, 'memerr = ',memerror:4); "io := FSRead (refNo, logEOF, hTE^^.hText^); {$IFC BUG = 1} "errin := 'FSRead'; {$ENDC} "IF io <> 0 THEN DiskRErr (io); "io := FSClose (refNo); {$IFC BUG = 1} $errin := 'FSClose'; {$ENDC} "IF io <> 0 THEN DiskRErr (io); "hTE^^.teLength := logEOF; "IF NOT finderprint THEN {if printing from the finder, no window or editing #information is needed} "BEGIN $TESetSelect (0,0,hTE); $TECalText (hTE); $Invalrect (hTE^^.viewrect); $SetScrollMax; $WindowData^^.titled := TRUE; $WindowData^^.changed := FALSE; $WindowData^^.FileVolume := VRefNo "END; "ReadFile := TRUE {everything worked out OK} END; {------------------------------------------------------------------------------------} PROCEDURE MakeAWindow (str : str255; disk : BOOLEAN); Var bounds: rect; BEGIN {A window is created here, and all associated data structures are linked to it} "IF debug THEN DebugInProc (proc, 'MakeAWindow', @MakeAWindow); "windowpos := windowpos + 1; {this position it is created to on the screen} "bounds.left := windowpos MOD 16 * 20 + 5; "bounds.top := windowpos MOD 11 * 20 + 45; "bounds.right := bounds.left + 200; "bounds.bottom := bounds.top + 100; "MyWindow := NewWindow(NIL, bounds, str, TRUE, 0, Pointer(-1), TRUE, 0); "SetPort (MyWindow); "Mypeek := windowPeek (MyWindow); "TextFont (applFont); "DrawChar (' '); SetFontLock (TRUE); "Mypeek^.windowkind := MyDocument; {a number > 8 identifies the type of window} "hTE := TENew(MyWindow^.portRect, MyWindow^.portRect); "WindowData := MyDataHandle (NewHandle (8)); {1 handle, an integer, and 2 booleans} "SetWRefCon (MyWindow, ORD(WindowData)); "WindowData^^.TERecord := hTE; "SetViewRect; "hTE^^.destrect := hTE^^.viewrect; "WindowData^^.changed := FALSE; "WindowData^^.titled := FALSE; "vScroll := GetNewControl(256,MyWindow); "MoveScrollBar; "topline := 0; "hTE^^.clikLoop := @AutoScroll END; {------------------------------------------------------------------------------------} PROCEDURE MyGetFile; Var reply: SFReply; $wher: point; $temprect: rect; $tempport:grafptr; $copyIt, foundIt : BOOLEAN; {if the name is already in use, this will be true} $temppeek: Windowpeek; $tempstr, oldfname: str255; $str: str255; $tempdata: MyDataHandle; BEGIN {This calls Standard File to allow the user to choose the document on disk that she wishes to edit.} "IF debug THEN DebugInProc (proc, 'MyGetFile', @MyGetFile); "wher.h := 90; "wher.v := 100; "DialogueDeactivate; "SFGetFile (wher, '', NIL, 1, MyFileTypes, NIL, reply); "WITH Reply DO "IF good THEN "BEGIN ${check to see if this name already resides on a document window. If so, change %the title to 'Copy of ' and remember to check it as untitled? after the readfile} $foundit := FALSE; $oldfname := fname; $REPEAT &temppeek := windowPeek(Frontwindow); ©It := FALSE; &IF temppeek <> NIL THEN &REPEAT (GetWTitle (windowPtr (temppeek), tempstr); (IF tempstr = fname THEN (BEGIN *tempdata := MyDataHandle(temppeek^.refCon); *IF tempdata^^.FileVolume = vrefnum THEN *BEGIN ,copyIt := TRUE; ,foundIt := TRUE *END (END; (temppeek := temppeek^.nextwindow &UNTIL (temppeek = NIL) OR copyIt; &GetIndString (str, 256, 16);{copy of} &IF copyIt THEN fname := Concat (str,fname); $UNTIL NOT copyIt; $IF foundIt THEN $BEGIN &Paramtext (fname,'','',''); ©It := (NoteAlert (258, NIL) = OK) $END; $IF NOT foundIt OR copyIt THEN $BEGIN &MakeAWindow (fname, TRUE); &IF ReadFile (vrefnum, oldfname) &THEN &BEGIN (IF foundIt THEN windowdata^^.titled := FALSE &END &ELSE &BEGIN (TEDispose (hTE); (hTE := NIL; (DisposHandle (Handle (WindowData)); (IF debug THEN Writeln (debugger, 'dispose WindowData; memerr = ', MemError, lf); (DisposeWindow (MyWindow) &END $END "END END; {------------------------------------------------------------------------------------} PROCEDURE OpenAWindow; VAR s: str255; $untitled: Str255; BEGIN {this creates a new window that is untitled and empty.} "IF debug THEN DebugInProc (proc, 'OpenAWindow', @OpenAWindow); "{see if enough mem exists to open a window} "NumToString(windownum, s); "windownum := windownum + 1; "GetIndString (untitled, 256, 1); "MakeAWindow (Concat (untitled, s), FALSE); END; {$S WRITFILE} {------------------------------------------------------------------------------------} FUNCTION WriteFile (vRefNo: INTEGER; fName : str255) : BOOLEAN; var refNo, io : INTEGER; $txtlength : longint; $errin : str255; {------------------------------------------------------------------------------------} "PROCEDURE DiskWErr (io : INTEGER); "Var str:str255; &writetostr, savedstr, str1: Str255; &dummy, errstr: INTEGER; "BEGIN "{This is just about the same as DiskRErr (read). Since a few more errors can #happen during a write, the structure is just a little different} $IF debug THEN $BEGIN &DebugInProc (proc, 'DiskWErr', @DiskWErr); &Writeln (debugger, errin, ' err = ', io, lf) $END; $GetIndString (writetostr,256,10);{read resource for writeto} $GetIndString (savedstr,256,12);{read resource for saved} $errstr := 0; $Case io of &DskFulErr : errstr := 17; &DirFulErr : errstr := 18; &FLckdErr : errstr := 19; &VLckdErr, WPrErr : errstr := 20; &IOErr : errstr := 21; &OTHERWISE &BEGIN (NumToString (io, str); (GetIndString (str1,256,22);{ID = } (str := Concat (str1,str) &END $END; $IF errstr <> 0 THEN GetIndString (str,256,errstr); $Paramtext (writetostr,FName,savedstr,str); $SetCursor (arrow); $dummy := StopAlert (256, NIL); $io := FSClose (refNo); $Exit (writefile) "END; BEGIN {this isn't very different from read file. The only complication is finding out if the file exists. If it doesn't, create it. Also, assign the information that the finder needs to properly associate it with this application.} "IF debug THEN DebugInProc (proc, 'WriteFile', @WriteFile); "SetCursor (watchHdl^^); "WriteFile := FALSE; "io := FSOpen(FName, VRefNo, refNo); {$IFC BUG = 1} "errin := 'FSOpen'; {once again, these only benefit the external debugger.} {$ENDC} "IF debug THEN Writeln (debugger, 'file RefNum =', refNo, lf); "IF io = {file not found Err} -43 THEN "BEGIN $io := Create (FName,VRefNo,'CARY','TEXT'); {$IFC BUG = 1} $errin := 'Create'; {$ENDC} $IF io <> 0 THEN DiskWErr (io); $io := FSOpen(FName, VRefNo, refNo); {$IFC BUG = 1} $errin := 'FSOpen'; {$ENDC} $IF debug THEN Writeln (debugger, 'file RefNum = ', refNo, lf); $IF io <> 0 THEN DiskWErr (io) "END {Create} "ELSE IF io <> 0 THEN DiskWErr (io); "WITH hTE^^ DO "BEGIN $txtLength := teLength; $io := FSWrite (refNo, txtLength, hText^); "END; {$IFC BUG = 1} "errin := 'FSWrite'; {$ENDC} "IF io <> 0 THEN DiskWErr (io); "io := SetEOF (refNo, txtlength); {$IFC BUG = 1} "errin := 'SetEOF'; {$ENDC} IF io <> 0 THEN DiskWErr (io); "io := FSClose (refNo); {$IFC BUG = 1} "errin := 'FSClose'; {$ENDC} "IF io <> 0 THEN DiskWErr (io); "io := FlushVol (NIL, VrefNo); {this is important; without it, if the program died "(not possible as a result of a programming mistake, of course), the directory #information on the disk would not be accurate.} {$IFC BUG = 1} "errin := 'FlushVol'; {$ENDC} "IF io <> 0 THEN DiskWErr (io); "IF not windowdata^^.titled THEN "BEGIN $SetWTitle(MyWindow, FName); $WindowData^^.filevolume := VRefNo "END; "WindowData^^.titled := TRUE; "WindowData^^.changed := FALSE; "WriteFile := TRUE {everything is OK.} END; {------------------------------------------------------------------------------------} FUNCTION MyPutFile (Filename: str255): BOOLEAN; Var reply: SFReply; $wher: point; $Namestr: Str255; $temprect: rect; $tempport:grafptr; BEGIN {The user can select the name of the file that they wish to save the document with.} "IF debug THEN DebugInProc (func, 'MyPutFile', @MyPutFile); "MyPutFile := FALSE; "GetIndString (namestr,256,2); "wher.h := 100; "wher.v := 100; "DialogueDeactivate; "SFPutFile (wher, Namestr, Filename, NIL, reply); "WITH Reply DO "BEGIN $IF debug THEN Writeln (debugger, 'reply.good = ', good, lf); $IF good THEN MyPutFile := WriteFile (vrefnum, fname) "END; "IF debug THEN Writeln (debugger, 'release reserror = ', reserror, lf) END; {------------------------------------------------------------------------------------} PROCEDURE CloseAWindow; VAR itemhit: INTEGER; $DBoxPtr: DialogPtr; $str,str1: str255; $Goodwrite: BOOLEAN; $temprect: rect; $NamePtr: ^Str255; $typ: INTEGER; $itemhdl: handle; $box:rect; BEGIN {All sorts of windows can be closed through this single routine, which is accessed by the user through the go-away box on the window, or the Close item in the File menu, or by quitting the program.} "IF debug THEN DebugInProc (proc, 'CloseAWindow', @CloseAWindow); "MyPeek := windowPeek (FrontWindow); "Case Mypeek^.windowkind of "MyDocument : "BEGIN $GetWTitle (MyWindow, str); $itemhit := 0; $IF WindowData^^.changed THEN {give the user the chance to save his data before %you throw it away.} $BEGIN &DialogueDeactivate; &IF doneflag THEN &BEGIN (GetIndString (str1,256,8); (IF debug THEN Writeln (debugger, 'err = ', Reserror, lf); &END &ELSE str1 := ''; &Paramtext (str,str1,'',''); &ItemHit := CautionAlert (259, NIL) $END; $IF debug THEN Writeln (debugger, 'itemhit = ', itemhit, lf); $Goodwrite := FALSE; $IF NOT windowdata^^.titled THEN str := ''; $IF itemhit = OK {save} THEN &IF WindowData^^.titled &THEN GoodWrite := WriteFile (WindowData^^.FileVolume, str) &ELSE Goodwrite := MyPutFile (str); $IF GoodWrite OR (itemhit IN [0, 3] {discard}) THEN $BEGIN &TEDispose (hTE); &hTE := NIL; &DisposHandle (Handle (WindowData)); &DisposeWindow (MyWindow) $END; $IF itemhit = Cancel THEN doneflag := FALSE "END; "Clipboard : ToggleScrap; {$IFC BUG > -1} "FreeMemory: ToggleFree; {$ENDC} $OTHERWISE CloseDeskAcc (MyPeek^.windowkind) {can't be anything else} "END {Case} END; {$S AboutMyPgm} {------------------------------------------------------------------------------------} PROCEDURE AboutMyEditor; const mousekey = mDownMask+keyDownMask; var str1hdl: stringHandle; $str2: Str255; $MyWindow: WindowPtr; $width, height, counter, strwidth, strdepth, factor, remainder, adjust: INTEGER; $newcount: longint; $txtinfo: fontinfo; $temprect, trect1: rect; $offscreen, tempbits: bitmap; $sz: size; BEGIN {this bit of fluff shows an inadequate method of telling the user something about my program, but it was fun to do.} "IF debug THEN DebugInProc (proc, 'AboutMyEditor', @AboutMyEditor); "DialogueDeactivate; "str1hdl := stringHandle(GetResource('CARY',0)); IF debug THEN Writeln (debugger, 'err = ', Reserror, lf); "GetIndString (str2,256,3); IF debug THEN Writeln (debugger, 'err = ', Reserror, lf); "HLock (Handle(str1hdl)); "MyWindow := GetNewWindow (256, NIL, Pointer (-1)); "SetPort (MyWindow); "TextFont (NewYork); "TextSize (12); "GetFontInfo (TxtInfo); "width := MyWindow^.portrect.right - MyWindow^.portrect.left; "height := MyWindow^.portrect.bottom - MyWindow^.portrect.top; "strwidth := StringWidth (str1hdl^^); "IF StringWidth (str2) > strwidth THEN strwidth := StringWidth (str2); "WITH TxtInfo DO "BEGIN $strdepth := ascent*2+descent*2+leading+1; $WITH offscreen DO $BEGIN &rowbytes := (strwidth + 15) DIV 16 * 2;{rowbytes needs to be even} &SetRect (bounds, 0,0,strwidth,strdepth); &baseaddr := NewPtrClear (rowbytes * strdepth); &IF debug THEN Writeln (debugger, 'err = ', Memerror, lf); $END; $tempbits := MyWindow^.portbits; $SetPortBits (offscreen); $MoveTo ((strwidth - StringWidth (str1hdl^^)) DIV 2, ascent); $DrawString (str1hdl^^); $MoveTo ((strwidth - StringWidth (str2)) DIV 2, strdepth-descent); $DrawString (str2) "END; "HUnlock (Handle (str1hdl)); "SetPortBits (tempbits); "factor := strwidth DIV strdepth; "remainder := strwidth MOD strdepth; "SetRect (trect1, (width - remainder) DIV 2 - factor, height DIV 2 - 1, $(width + remainder) DIV 2 + factor, height DIV 2 + 1); "counter := 1; "REPEAT $SystemTask; $CopyBits (offscreen, MyWindow^.portbits, offscreen.bounds, trect1, srcCopy, NIL); $InsetRect (trect1, -factor, -1); $counter := counter + 2; "UNTIL EventAvail (mousekey, MyEvent) OR (counter >= strdepth); "newcount := TickCount + 300; {5 seconds} "REPEAT $SystemTask "UNTIL EventAvail (mousekey, MyEvent) OR (TickCount > newcount); "temprect := offscreen.bounds; "OffsetRect (temprect, (width-strwidth) DIV 2, (height-strdepth) DIV 2); "trect1 := offscreen.bounds; "WITH MyWindow^, temprect DO "WHILE NOT EventAvail(mousekey,MyEvent) AND $(trect1.right-factor * 2> trect1.left) DO "BEGIN $SystemTask; {the clock still ticks!} $factor := trect1.right DIV strdepth; $IF left > 0 THEN InsetRect (temprect, -factor, -2) $ELSE IF top > 0 THEN $BEGIN &InsetRect (trect1, factor, 0); &InsetRect (temprect, 0, -2) $END ELSE InsetRect (trect1, factor, 2); $CopyBits (offscreen, portbits, trect1, temprect, srcCopy, NIL); "END; "DisposPtr(offscreen.baseaddr); "IF debug THEN Writeln (debugger, 'err = ', Memerror, lf); "DisposeWindow (MyWindow) END; {$S MyPrint } {------------------------------------------------------------------------------------} PROCEDURE CheckButton; var bool : BOOLEAN; $item : INTEGER; BEGIN "bool := GetNextEvent (mDownMask+keyDownMask, MyEvent); "item := 0; "IF (myEvent.what = keydown) AND (BitAnd (myEvent.message, 255) = 13) "THEN item := 1 "ELSE "IF IsDialogEvent (myEvent) THEN bool := DialogSelect (myEvent, dlogptr, item); "IF item = 1 THEN PrSetError (iPrAbort); END; {------------------------------------------------------------------------------------} PROCEDURE MyPrint(finderFile:INTEGER; filename: str255); Const bottommargin = 20; {amount of space on the margins of the page in pixels} &leftmargin = 30; &rightmargin = 10; Var MyPPort: TPPrPort; $txt: handle; $txtptr: ptr; $pglen, start, finish, counter, count2, loop, io, numpages: INTEGER; $temprect, tmprect2, pagerect: rect; $status: TPrStatus; $userOK, canceldialog: BOOLEAN; $s: string[1]; $str: str255; $numToGo, numdone: str255; $temp: str255; $MyLngth: array [1..99] of INTEGER; BEGIN {For heavyweight programmers only. All modes of printing are handled by Macprint. The only things you have to do are: #image each page, using QuickDraw (or something that uses QuickDraw); #Do it once for the number of copies the user specified in draft mode only. #You do not have to worry with: %copies in normal or high res. %which pages the user chose to print. %tall, wide, etc. "Remember, these Page Setup dialog is printer specific. It will not always be the "same, so don't write any code around it. "The reason this program is heavily segmented is that printing normal or high-res "on line takes gobs of memory (in this example, up to 25K.) You may minimize the "by omitting 1 line below and creating a spooled file instead. "The finderprint boolean determines whether printing is has been selected while the "user is running the application, or whether it was selected from the finder. In the "application, printing is done in the background. From the finder, a simple dialog "is presented instead. Because printing takes a large amount of memory, up to 25K, "background printing is only possible if the memory required by the foreground "process can be kept to a minimum. Since this program does not yet have strong "memory full checking, you should set the debugging compile time variable DEBUG "to -1, and remove MacsBug from the Mac disk, to give the program a realistic amount "of free memory. MacsBug, when active, can use up to 16K. "Printing is not re-entrant. If your main program loop is the print idle proc, "as below, disable the Page Setup item and change 'Print' to 'Stop Printing' "in the File menu.} "IF debug THEN DebugInProc (proc, 'MyPrint', @MyPrint); "printflag := FALSE; "IF debug THEN #writeln (debugger, 'finderPrint =', finderprint, '; finderFile =', finderfile, lf); "userOK := TRUE; "IF finderfile = 1 THEN "BEGIN $SetCursor (arrow); $userOK := PrJobDialog (PrintHdl) "END; "IF userOK THEN "BEGIN ${try to see if enough memory exists to *1) duplicate the text portion of the te record *2) allow the printing pieces to be resident *3) allow the largest possible segment to be loaded by the main event loop *if so, allow the printing to go on in the background. *Otherwise, put up the 'press a button to cancel' dialog} $SetCursor (watchhdl^^); $IF NOT finderprint THEN numfiles := 1; $canceldialog := finderprint; $IF NOT canceldialog THEN $BEGIN &txt := NewHandle (hte^^.telength+16000); &{this calculation should be made considering: *the current font size *the printing mode (draft, normal, hires) *the textstyle overhead, if any *blank segment overhead *largest segment + largest local data *global data overhead --- 16000 is a crude, unprofessional approximation} &IF txt = NIL THEN canceldialog := TRUE &ELSE &BEGIN (disposHandle (txt); (txt := hte^^.hText; (ResrvMem (hte^^.teLength); (io := HandToHand (txt); &END $END; $IF canceldialog THEN $BEGIN &NumToString (finderFile, numToGo); &NumToString (numfiles, numdone); &Paramtext (filename,numToGo,numdone,''); &dlogptr := GetNewDialog (257, NIL, Pointer(-1)); &DrawDialog (dlogptr); &printHdl^^.prJob.pIdleProc := @CheckButton; &txt := hte^^.hText $END $ELSE $BEGIN &GetIndString (temp,256,15); {change to 'Stop Printing'} &SetItem (myMenus[fileMenu], 8, temp); &printing := TRUE; &printHdl^^.prJob.pIdleProc := @MainEventLoop; &GetPort (printport); {get the port to be restored at the top of the 'main event loop} $END; ${for now, approximate a full page} $MyPPort := PrOpenDoc (PrintHdl, NIL, NIL); $WITH hTE^^, printhdl^^.prinfo DO $BEGIN &pagerect := rpage; &pagerect.left := pagerect.left + leftmargin; &pagerect.right := pagerect.right - rightmargin; &pagerect.bottom := pagerect.bottom - bottommargin &- (pagerect.bottom - bottommargin) MOD lineheight {get rid of partial line}; &temprect := destrect; &destrect := pagerect; &TECalText (hTE) $END; {TECalText could cause the memory manager to move the hTE and PrintHdl %handles. So, the 'WITH' statement is required below; the alternative would %be to use 1 'WITH' and 'HLock' the handles. Note that 'WITH' is much more %than a lexical convenience. It actually causes the compiler to optimize code %about the fields of hTE^^ and printhdl^^.prinfo} $WITH hTE^^, printhdl^^.prinfo DO $BEGIN &tmprect2 := viewrect; &pglen := (rpage.bottom - rpage.top - bottommargin) DIV lineheight; &finish := nlines; &start := 0; &counter := 1; &WHILE start < finish DO &BEGIN (IF finish - start > pglen (THEN MyLngth[counter] := linestarts[start + pglen] - linestarts[start] (ELSE MyLngth[counter] := teLength - linestarts[start]; IF debug THEN BEGIN "Writeln (debugger,'MyLngth[',counter:1,'] = ', MyLngth[counter]:5, '; start = ', start:5, '; pglen = ', pglen:5, lf); "Writeln (debugger, 'finish = ', finish:5, '; teLength = ', teLength:5, '; ORD(txt) = ', ord4(txt),lf) END; (start := start + pglen; (counter := counter + 1; &END; {While start < finish} &numpages := counter - 1; &IF NOT finderprint THEN &BEGIN (destrect := temprect; (TECalText (hTE) &END $END; $IF debug THEN Writeln (debugger,'BJDocLoop = ', PrintHdl^^.prjob.BJDocLoop,lf); $IF PrintHdl^^.prjob.BJDocLoop = BSpoolLoop $THEN loop := 1 $ELSE loop := PrintHdl^^.prjob.iCopies; $SetPort (GrafPtr(MyPPort)); $TextFont (applFont); $DrawChar (' '); SetFontLock (TRUE); $IF PrintHdl^^.prjob.BJDocLoop <> BSpoolLoop THEN SetCursor (arrow); $FOR counter := 1 to loop DO $BEGIN &Hlock (txt); &txtptr := txt^; &FOR count2 := 1 to numpages DO &BEGIN {if background printing, duplicate txt handle before starting} (PrOpenPage (MyPPort, NIL); (TextBox (txtptr, MyLngth[count2], pagerect, teJustLeft); (PrClosePage (MyPPort); (txtptr := Pointer (ORD4(txtptr) + MyLngth[count2]); (start := start + pglen &END; {For count2} &HUnlock (txt); $END; {For counter} $PrCloseDoc (MyPPort); $IF PrintHdl^^.prjob.BJDocLoop = BSpoolLoop THEN $BEGIN 'SetCursor (arrow); 'PRPicFile (Printhdl, NIL, NIL, NIL, status) {omit this for spooled files.} $END; $IF canceldialog THEN DisposDialog (dlogptr) $ELSE $BEGIN &disposHandle (txt); &printing := FALSE; &GetIndString (temp,256,14); {change to 'Print'} &SetItem (myMenus[fileMenu], 8, temp); &SetPort (printport) $END "END END; {$S EditMenu} {------------------------------------------------------------------------------------} Procedure EditMain (theItem: INTEGER; commandkey : BOOLEAN); const undo = 1; &cut = 3; &kopy = 4; {'Copy' is a Pascal string function} &paste = 5; &clear = 6; &selectAll = 7; &clipbored = 9; {'ClipBoard' is already used as a windowkind constant} VAR DeskAccUp , dummy: BOOLEAN; $Dscrap: PScrapStuff; $off: LongInt; $ticks: LongInt; $tempport: grafptr; $box: rect; $itemhdl, hdl: handle; $typ, io, tempstart, tempend: INTEGER; $tempptr: ptr; $TextLength: INTEGER; $Ptr2ScrapLength: LomemPtr; $topwindow: WindowPeek; BEGIN {Since the Edit menu does so much, it has been broken up into a separate procedure. It does not yet support undo, but does support Cutting, Copying and Pasting between the Desk Scrap and the TextEdit Scrap.} "DeskAccUp := FALSE; "IF (theItem < selectAll) and NOT CommandKey THEN DeskAccUp := SystemEdit(theItem-1); "topwindow := WindowPeek(FrontWindow); "IF (theItem > Clear) OR NOT DeskAccUp THEN "BEGIN $IF theItem in [cut, kopy] THEN $BEGIN 'tempend := hTE^^.selend; 'tempstart := hte^^.selstart $END; $IF debug THEN Writeln (debugger, 'not system edit', lf); ${ Delay so menu title will stay lit a little only if Command key } ${ equivalent was typed. } $IF commandkey THEN $BEGIN &ticks := TickCount + 10; &REPEAT UNTIL ticks <= TickCount $END; {** see if enough memory exists for move} $CASE theItem OF $undo: ; { no Undo/Z in this example } $cut: TECut(hTE); { Cut/X } $kopy: TECopy(hTE); { Copy/C } $paste: &BEGIN { Paste/V } (DScrap := InfoScrap; (IF DScrap^.scrapState <> LastPaste THEN (BEGIN *LastPaste := DScrap^.scrapState; *io := GetScrap (NIL, 'TEXT', off); *IF debug THEN Writeln (debugger, 'io = ', io); *IF io > 0 THEN {**?? enough space to paste} *BEGIN ,io := GetScrap (TEScrapHandle, 'TEXT', off); ,Ptr2ScrapLength := LomemPtr ($AB0); ,Ptr2ScrapLength^ := BitShift (io, 16);{***???***} *END (END; (TEPaste(hTE); &END; $clear: TEDelete(hTE); { Clear } $selectall: TeSetSelect(0,65535,hTE); { Select All/A } $clipbored: ToggleScrap { Show, Hide Clipboard } $END; { of item case } $IF theItem in [cut,kopy] THEN $BEGIN &io := ZeroScrap; &IF debug THEN Writeln (debugger, 'zero scrap err =', io, lf); &TextLength := GetHandleSize (TEScrapHandle); &IF debug THEN Writeln (debugger, 'TEScrapHandle @',ORD4(TEScrapHandle^),'; TextLength = ',textlength,lf); &Hlock (TEScrapHandle); &io := PutScrap (TextLength, 'TEXT', TEScrapHandle^); &IF debug THEN Writeln (debugger, 'put scrap err =', io, lf); &HUnlock (TEScrapHandle) $END; $IF theItem in [cut,clear,paste] THEN Windowdata^^.changed := TRUE; $IF (theItem in [cut..clear]) THEN ScrollText (TRUE) "END {not systemedit} END; { of editMain } {$S Command } {------------------------------------------------------------------------------------} PROCEDURE MyDisable; "const newitem = 1; (openitem = 2; (closeitem = 3; (saveitem = 4; (saveasitem = 5; (revertitem = 6; (pagesetupitem = 7; (printitem = 8; (quititem = 9; (undoitem = 1; (cutitem = 3; (copyitem = 4; (pasteitem = 5; (clearitem = 6; (selectallitem = 7; (clipboreditem = 9; var counter: INTEGER; $DScrap: PScrapStuff; $temppeek: windowpeek; $stycount: styleitem; $off : LongInt; {------------------------------------------------------------------------------------} "PROCEDURE KillFE (fileitems, edititems : edset); "var counter : INTEGER; "BEGIN {This guy disables the items in the File and Edit menus. This approach has a real disadvantage: If an entire menu should be disabled at some given time, there is no convenient way to do a DrawMenuBar here to disable the item in the bar itself.} $IF debug THEN $BEGIN &DebugInProc (proc, 'KillFE', @KillFE); &Write (debugger, 'file:'); &FOR counter := newitem to quititem DO 'IF counter in fileitems THEN Write (debugger, counter:2, ','); &Write (debugger, '; edit:'); &FOR counter := undoitem to clipboreditem DO 'IF counter in edititems THEN Write (debugger, counter:2, ','); &Writeln (debugger, lf) $END; $FOR counter := 1 to 9 DO $BEGIN &IF counter in fileitems THEN DisableItem (myMenus[FileMenu], counter); &IF counter in edititems THEN DisableItem (myMenus[EditMenu], counter); $END "END; BEGIN {This part goes through all of the applicable elements of the frontmost window, if any and from that decides what operations are allowable at this time.} "IF debug THEN DebugInProc (proc, 'MyDisable', @MyDisable); "FOR counter := 1 to 9 DO "BEGIN $EnableItem (myMenus[FileMenu], counter); $IF counter in [UndoItem,CutItem..SelectAllItem,ClipboredItem] &THEN EnableItem (myMenus[EditMenu], counter) "END; "IF printing THEN KillFE ([PageSetupItem],[]); {page setup, if printing} "IF Frontwindow = Nil "THEN KillFE ([CloseItem..PrintItem],[UndoItem..SelectAllItem]) "ELSE "BEGIN $Mypeek := windowPeek (FrontWindow); $Case Mypeek^.windowkind of $MyDocument: BEGIN *KillFE ([], [UndoItem]); *IF NOT WindowData^^.titled THEN KillFE ([SaveItem,RevertItem], []); *IF NOT WindowData^^.changed THEN KillFE ([SaveItem,RevertItem], []); *IF hTE^^.teLength = 0 THEN ,KillFE ([SaveItem,SaveAsItem,PageSetupItem,PrintItem], [SelectAllItem]); *IF hTE^^.selstart = hTE^^.selend THEN ,KillFE ([], [CutItem,CopyItem,ClearItem]); *IF GetScrap (NIL, 'TEXT', off) = noTypeErr THEN KillFE ([], [PasteItem]); (END; $Clipboard,FreeMemory: KillFE ([SaveItem..PrintItem], [UndoItem, CutItem..SelectAllItem]); &OTHERWISE KillFE ([SaveItem..PrintItem], [SelectAllItem]) {system window} $END {Case} "END; "IF printing THEN EnableItem (MyMenus[filemenu], PrintItem) {stop printing} END; {------------------------------------------------------------------------------------} PROCEDURE DoCommand (commandkey: BOOLEAN); VAR name, s, str: str255; $bstr: string[5]; $dummy: size; $err : BOOLEAN; $num, refnum, theMenu, theItem: INTEGER; $tempPeek: WindowPeek; $mresult, ticks: longint; $dipeek: DialogPeek; $box: rect; $itemhdl: handle; $typ: INTEGER; $menuStuff: RECORD CASE INTEGER OF &1 : (menuResult : LONGINT); {Information returned by MenuSelect} &2 : (theMenu, {Which menu was selected} +theItem : INTEGER) {Which item within the menu} $END; BEGIN {This handles the actions that are initiated through the Menu Manager} "IF debug THEN DebugInProc (proc, 'DoCommand', @DoCommand); "MyDisable; "WITH menuStuff DO "BEGIN $IF Commandkey $THEN menuResult := MenuKey(theChar) $ELSE menuResult := MenuSelect (myEvent.where); $CASE theMenu OF &appleMenu: {enough memory to allow desk accessory to open} &BEGIN (IF theItem = 1 (THEN AboutMyEditor (ELSE (BEGIN *GetItem(myMenus[appleMenu],theItem,name); *refNum := OpenDeskAcc(name) (END &END; &FileMenu: &BEGIN (IF FrontWindow <> NIL THEN )IF MyPeek^.WindowKind = MyDocument THEN +IF windowdata^^.titled +THEN GetWTitle (FrontWindow, str) +ELSE str := ''; (Case TheItem of *1: OpenAWindow; { New } *2: MyGetFile; { Open } *3: CloseAWindow; { Close } *4: err := { Save } 0WriteFile (windowdata^^.FileVolume, str); *5: err := MyPutFile (str); { Save As } *6: BEGIN { Revert to Saved } 0IF CautionAlert(257, NIL)=OK THEN 2err := ReadFile (windowdata^^.FileVolume, str); 0ScrollText (FALSE) {which is the user interfacy thing to do? Edisplay the top of the file, or display Ethe position in the file the user was looking @ Ewhen he said revert. Should I also maintain the Eflashing caret position?} .END; *7: BEGIN 0PrOpen; 0IF PrStlDialog (PrintHdl) { Page Setup } 0THEN ; 0PrClose .END; 0{eventually, store info in document resource fork} *8: IF NOT printing { Print } .THEN Printflag := TRUE .ELSE PrSetError(iPrAbort); *9: doneFlag := TRUE; { Quit } (END &END; $EditMenu: EditMain (theItem, commandkey); "{$IFC BUG > -1} $100: &Case theItem OF &1: ToggleFree; &2: dummy := MaxMem (dummy); "{$IFC BUG = 1} &3: BEGIN ,debug := NOT debug; ,CheckItem (MyMenus[DebugMenu], 3, debug) *END "{$ENDC} &END { of debug } "{$ENDC} $END; { of menu case } $HiliteMenu(0) "END END; { of DoCommand } {------------------------------------------------------------------------------------} PROCEDURE DrawWindow; VAR tempPort : GrafPtr; $tempscrap: handle; $scraplength, off: longint; $temprect, rectToErase: rect; $str: str255; $tempPeek: WindowPeek; $whichwindow: windowptr; $temphTE: TEHandle; $tempdata: mydatahandle; BEGIN { Draws the content region of the given window, after erasing whatever "was there before. } "IF debug THEN DebugInProc (proc, 'DrawWindow', @DrawWindow); "WhichWindow := WindowPtr (MyEvent.message); "BeginUpdate(WhichWindow); "GetPort (tempPort); "SetPort (WhichWindow); "tempPeek := WindowPeek (WhichWindow); "Case tempPeek^.windowkind of "MyDocument : $BEGIN &temprect := WhichWindow^.portrect; &tempData := MyDataHandle (GetWRefCon (WhichWindow)); &temphTE := tempData^^.TERecord; &IF tempPeek^.hilited THEN temprect.top := temprect.bottom - 15; &temprect.left := temprect.right - 15; &ClipRect (temprect); &DrawGrowIcon(WhichWindow); &Cliprect (WhichWindow^.portrect); &DrawControls (WhichWindow); &{this only erases the window past the end of text, if any} &WITH temphTE^^ DO &IF nlines - topline < (viewrect.bottom - viewrect.top + lineheight) 'DIV lineheight THEN &BEGIN (rectToErase := viewrect; (rectToErase.top := (nlines - topline) * lineheight; (EraseRect (rectToErase) &END; &TEUpdate(WhichWindow^.visRgn^^.rgnBBox, temphTE) $END; "ClipBoard : "BEGIN $tempscrap := NewHandle (0); $ScrapLength := GetScrap (tempscrap, 'TEXT', off); $EraseRect (WhichWindow^.portrect); $temprect := Whichwindow^.portrect; $temprect.left := temprect.left + 4; $temprect.right := temprect.right-15; $IF ScrapLength > 0 THEN $BEGIN &HLock (tempScrap); &Textbox (tempscrap^, scrapLength, temprect, teJustLeft); &HUnlock (tempScrap) $END; $DisposHandle (tempscrap); $temprect := WhichWindow^.portrect; $temprect.left := temprect.right - 15; $ClipRect (temprect); $DrawGrowIcon (WhichWindow); $ClipRect (whichwindow^.portrect) "END; {$IFC BUG > -1} "FreeMemory: $BEGIN &EraseRect(whichwindow^.portrect); &MoveTo (5, 12); &PLSetWrPort (whichwindow); &Write (FreeMem); $END; {$ENDC} "END; {Case} "SetPort (tempPort); "EndUpdate(WhichWindow) END; { of DrawWindow } {$S CONTROL} {------------------------------------------------------------------------------------} PROCEDURE ScrollBits; VAR oldvert: INTEGER; BEGIN {If the visible information has changed, scroll the window here.} "IF debug THEN DebugInProc (proc, 'ScrollBits', @ScrollBits); "oldvert := topline; "topline := GetCtlValue(vScroll); "TEScroll (0, (oldvert - topline)*hTE^^.lineheight, hTE) END; {------------------------------------------------------------------------------------} PROCEDURE TrackScroll(theControl: ControlHandle; partCode: INTEGER); {This routine adjusts the value of the scrollbar.} Var amount, StartValue : INTEGER; $up : BOOLEAN; BEGIN "up := partcode IN [inUpButton, inPageUp]; {TRUE if scrolling page up} "StartValue := GetCtlValue (theControl); {the initial control value} "IF {the scrollbar value is decreased, and it is not already at the minimum} %((up AND (StartValue > GetCtlMin (theControl))) "OR {the scrollbar value is increased, and it is not already at the maximum} %((NOT up) AND (StartValue < GetCtlMax (theControl)))) "AND {to prevent tracking as the page up or down area disappears} %(whichpart = partCode) "THEN "BEGIN $IF up THEN amount := -1 ELSE amount := 1; {set the direction} $IF partCode IN [inPageUp, inPageDown] THEN {change the movement to a full page} $WITH HTE^^.viewrect DO &amount := amount * (bottom - top) DIV hTE^^.lineheight; $SetCtlValue(theControl, StartValue+amount); $ScrollBits "END END; {of TrackScroll} {------------------------------------------------------------------------------------} PROCEDURE MyControls; Var t, code: INTEGER; $AControl: ControlHandle; $dummy: INTEGER; BEGIN {controls} {This routine handles the scrollbar} "IF debug THEN DebugInProc (proc, 'MyControls', @MyControls); "whichPart := FindControl (MyPoint, MyWindow, AControl); IF debug THEN Writeln (debugger, 'whichpart = ', whichpart, lf); IF debug THEN Writeln (debugger, 'ORD( AControl = ', ORD ( AControl), lf); "{adjust scrollbar range} "IF AControl <> NIL THEN "BEGIN $VScroll := AControl; $IF whichPart = inThumb THEN $BEGIN &dummy := TrackControl (VScroll, MyPoint, NIL); &ScrollBits $END {of whichpart} $ELSE dummy := TrackControl (VScroll, MyPoint, @TrackScroll) "END {AControl <> NIL} END; {controls} {$S Initial } {------------------------------------------------------------------------------------} PROCEDURE SetUp; VAR counter, vRefNum : INTEGER; $DScrap : PScrapStuff; $hdl, hAppparms : handle; $off : longint; $apName : Str255; $NameHdl : Handle; $strhdl : StringHandle; $dummyrect : rect; $dummy : BOOLEAN; $FinderFile : INTEGER; $myport : GrafPtr; $message : INTEGER; $document : appFile; $temprgn: rgnhandle; $extdebug: Str255; BEGIN {Initialization for a variety of things is done here. This code is 'discarded' after it is executed by an UnLoadSeg. Another good way of initializing a large number of variables would be to create a custom resource which contains initial values for all globals. Then, if the globals are fields in a handle, a single 'GetResource' would initialize all fields.} "InitFonts; {I need fonts} "FlushEvents(everyEvent,0); {start with a clean slate} "TEInit; {I need TextEdit} "InitDialogs(NIL); {and I need dialogs, even when printing from Finder} "PrintHdl := THPrint (NewHandle (SizeOf(TPrint))); "PrOpen; "PrintDefault (PrintHdl); "getAppParms(apName,vRefNum,hAppParms); "{** one day, get file info for apName, to use folder info as appropriate} "iBeamHdl := GetCursor(IBeamCursor); "HNoPurge (Handle(iBeamHdl));{???} "watchHdl := GetCursor(WatchCursor); "HNoPurge (Handle(watchHdl));{???} "CountAppFiles(message, numfiles); "IF debug THEN Writeln (debugger, 'numfiles=',numfiles,lf); "finderprint := (message = 1); "IF finderprint {User selected 'print' from the Finder} THEN "BEGIN $GetWMgrPort (myPort); $SetPort (myPort); $temprgn := NewRgn; $GetClip (temprgn); $dummyrect := screenbits.bounds; $dummyrect.bottom := dummyrect.top + 16; $ClipRect (dummyrect); $TextBox (pointer(ORD(@apName)+1),ORD(Length(apName)),dummyrect,teJustCenter); $SetClip (temprgn); $DisposeRgn (temprgn); $FOR FinderFile := 1 to numfiles DO $BEGIN &GetAppFiles(FinderFile, document); &WITH document DO &IF ftype = 'TEXT' THEN &BEGIN (dummyrect := screenbits.bounds; (dummyrect.bottom := dummyrect.top + 16; (InsetRect (dummyrect,10,2); (SetPort (myPort); {to allow text measure in TeCalText} (hTE := TENew(dummyrect, dummyrect); (dummy := ReadFile (vRefNum, fName); {assume that page setup is read in as well} (Unloadseg (@ReadFile); (MyPrint(FinderFile, fName); (SetCursor (watchhdl^^); (TEDispose (hTE); {dispose of text edit stuff} (ClrAppFiles (FinderFile) &END $END; $hTE := NIL; $PrClose "END "ELSE "BEGIN $PrClose; $InitMenus; { initialize Menu Manager } $myMenus[appleMenu] := GetMenu(appleMenu); $AddResMenu(myMenus[1],'DRVR'); { desk accessories } $FOR counter := FileMenu to EditMenu DO myMenus[counter] := GetMenu(counter); "{$IFC BUG > -1} $myMenus[DebugMenu] := GetMenu(100); { temporary debug menu } "{$ENDC} "{$IFC BUG = 1} $GetIndString (extdebug,257,1); $AppendMenu (myMenus[DebugMenu], extdebug); $CheckItem (MyMenus[DebugMenu], 3, debug); "{$ENDC} $FOR counter:=1 TO lastMenu DO InsertMenu(myMenus[counter],0); $DrawMenuBar; $dragRect := screenbits.bounds; $dragrect.top := dragrect.top + 20; {leave room for menu bar} $growRect := dragRect; $InsetRect (dragrect, 4, 4); {leave some of dragged rectangle on screen} $growrect.left := {replace this with the max font width + constant} 80; $growrect.top := 80 {18 + 16*3 + slop?}; $doneFlag := FALSE; $printflag := FALSE; $printing := FALSE; $windownum := 1; $windowpos := 0; $MyFileTypes[0] := 'TEXT'; $DScrap := InfoScrap; $LastCount := DScrap^.scrapCount - 1; $LastPaste := LastCount; $Scrapwind := NIL; $FOR counter := 1 to numfiles DO $BEGIN &GetAppFiles (counter, document); &WITH document DO &IF ftype = 'TEXT' THEN &BEGIN (MakeAWindow (fName, TRUE); {**could async open while this is going on} (IF counter < numfiles THEN DialogueDeactivate; (IF NOT ReadFile (vRefNum, fName) THEN (BEGIN *TEDispose (hTE); *hTE := NIL; *DisposHandle (Handle (WindowData)); *DisposeWindow (MyWindow) (END &END $END; $IF Frontwindow = NIL THEN OpenaWindow; "{$IFC BUG > -1} $Freewind := NIL "{$ENDC} "END END; { of SetUp} {$S } {------------------------------------------------------------------------------------} PROCEDURE CursorAdjust; VAR mousePt: Point; $tempport: grafptr; $temppeek: Windowpeek; BEGIN { Take care of application tasks which should be executed when the machine has "nothing else to do, like changing the cursor from an arrow to an I-Beam when it "is over text that can be edited. } {$IFC BUG >-1} { If the amount of free memory is being displayed in its own window, and if it has "changed, then create an update event so that the correct value will be displayed.} "IF (FreeWind <> NIL) "AND (FreeMem <> OldMem) THEN "BEGIN $OldMem := FreeMem; $GetPort (tempport); $SetPort (FreeWind); $InvalRect (FreeWind^.portrect); $SetPort (tempport) "END; {$ENDC} "GetMouse(mousePt); {where the cursor is, currently (local to the topmost window)} "IF hTE <> NIL {if text edit is currently active, (document window is topmost)} "THEN "BEGIN $TEIdle (hTE); $IF (PtInRect(mousePt, hTE^^.viewrect)) {In the text edit viewrect area,} $THEN SetCursor(iBeamHdl^^) { make the cursor an I-beam.} $ELSE SetCursor(arrow) "END "ELSE "BEGIN ${let desk accessories set their own?} $temppeek := windowPeek(FrontWindow); $IF temppeek = NIL THEN SetCursor (arrow) $ELSE IF temppeek^.windowkind > 1 THEN SetCursor (Arrow) "END END; {------------------------------------------------------------------------------------} FUNCTION MyGrowZone; BEGIN {This function is called by the memory manager whenever more memory is requested than available. The only time you'll see it in this program is when it initally runs (which is normal) and when it is not checking memory availability when it should. Your program should not rely on resolving memory problems here, because it could be called by the ROM, where, at present, insufficient memory cases are not always handled gracefully.} "IF GZCritical THEN "BEGIN $IF debug THEN Writeln (debugger, 'myGrow cbneeded = ', cbneeded, lf); ${Make all data stuctures, including user data, that can be safely released, %purgable. If the user has data in memory that has not yet been saved, and if %you were not expecting this routine to be called, then the call came from ROM %and is important to give the user the chance to save their work. Even if %their data is successfully saved, it is likely that the program will have to %restart or quit to the Finder.} ${could unload segment EditMain and others? Zero scrap?} $SetFontLock (FALSE); {at least let go of the application font} "END; "MyGrowZone := 0 {for now, the memory requests fails unconditionally} END; {------------------------------------------------------------------------------------} PROCEDURE MainEventLoop; Var code: INTEGER; {the type of mousedown event} $dummy: BOOLEAN; $str : str255; $tempport : Grafptr; $DScrap: PScrapstuff; BEGIN {This event loop handles most of the communications between this program and events taking place in the outside world. This procedure is also called as the printer idle procedure so that the program appears to be doing background printing.} "IF printing THEN "BEGIN $getport (tempport); $setport (printport) "END; "REPEAT $CursorAdjust; $SystemTask; {See if a desk accessory has changed the scrap. If so, create an update event to redraw the clipboard.} $DScrap := InfoScrap; $IF (DScrap^.scrapCount <> LastCount) AND (ScrapWind <> NIL) THEN $BEGIN &LastCount := DScrap^.scrapCount; &Getport (tempport); &Setport (scrapwind); &InvalRect (scrapwind^.portrect); &Setport (tempport) $END; $IF printflag THEN $BEGIN &GetWTitle (MyWindow, str); &PrOpen; &Myprint(1, str); {number of files to print, what to call it} &PrClose $END; $IF GetNextEvent(everyEvent,myEvent) THEN $CASE myEvent.what OF $mouseDown: &BEGIN (code := FindWindow(myEvent.where,tempWindow); (CASE code OF *inMenuBar: DoCommand(FALSE); *inSysWindow: SystemClick(myEvent,tempWindow); *inDrag: DragWindow(tempWindow,myEvent.where,dragRect); *inGoAway: IF TrackGoAway(tempWindow,myEvent.where) THEN CloseAWindow; *inGrow: IF Mypeek^.windowkind in [MyDocument,Clipboard] THEN GrowWnd; *inContent: ,BEGIN .IF tempWindow <> FrontWindow .THEN SelectWindow (tempWindow) .ELSE .IF hTE <> NIL THEN .BEGIN 0MyPoint := MyEvent.where; 0GlobalToLocal (MyPoint); 0IF PtInRect (MyPoint, hTE^^.viewrect) 0THEN 0BEGIN 2IF debug THEN Writeln (debugger, 'point in HTE viewrect', lf); 2IF (BitAnd (myEvent.modifiers, ShiftKey) <> 0 ) { Shift key pressed } 2THEN TEClick (MyPoint, TRUE, hTE) 2ELSE TEClick (MyPoint, FALSE, hTE); 0END 0ELSE MyControls .END { hTE <> NIL } ,END { in Content } *END { of code case } (END; { of mouseDown } &keyDown, autoKey: (BEGIN *theChar := CHR(BitAnd(myEvent.message,255)); { Mac characters use 8 bits } *IF BitAnd(myEvent.modifiers,CmdKey) <> 0 { Command key pressed } *THEN DoCommand(TRUE) *ELSE IF hTE <> NIL THEN *BEGIN ,TEKey(theChar,hTE); ,windowdata^^.changed := TRUE; ,ScrollText (TRUE); *END (END; { of keyDown } &activateEvt: MyActivate; &updateEvt: DrawWindow; $END { of event case } $ELSE &IF (Myevent.what = nullEvent) AND doneflag AND (FrontWindow <> NIL) &THEN CloseAWindow; $UnloadSeg (@ScrollText); {segment Utilities} $UnloadSeg (@ReadFile); {segment ReadFile} $UnloadSeg (@WriteFile); {segment WritFile} $UnloadSeg (@AboutMyEditor); {segment AboutMyPgm} $UnloadSeg (@DoCommand); {segment DoCommand} $UnloadSeg (@EditMain); {segment EditMenu} $UnloadSeg (@MyControls); {segment Control} $IF NOT printing THEN UnloadSeg (@MyPrint); "UNTIL (doneFlag AND (FrontWindow = NIL)) OR Printing; "IF doneFlag AND (FrontWindow = NIL) THEN "BEGIN $ClearMenuBar; {prevent the user from doing anything until printing is through} $DrawMenuBar; $SetCursor (watchhdl^^) "END; "IF printing THEN "BEGIN $getport (printport); $setport (tempport) "END END; BEGIN { main program } {Some things need to be set up outside of the initialization segment, to allow the nonrelocatable objects that they create to be located as low in memory as possible.} {$IFC BUG = 1} {This code is only included for external terminal debugging} "debug := FALSE;{if you want debugging on as soon as the program starts, set it here} "Reset (debugger, '.BOUT'); {the serial port not used for downloading from Lisa} {$ENDC} "IF debug THEN "BEGIN $Writeln (debugger, lf, lf); $DebugInProc (proc, 'SetUp', @Setup) "END; {The program only executes the code when it is first run, but it could have gotten here in two ways. The user may have opened the application or one of its documents, or the user may have chosen to print a document. In any case, some common initialization is needed.} "SetGrowZone (@MyGrowZone); {just in case something goes wrong..} "MaxApplZone; {The application needs to grow the heap to the maximum size, 1but does not want to purge any of the preloaded resources. } "MoreMasters; MoreMasters; MoreMasters; {Each call to MoreMasters creates Ka block of master ponters. The Ksystem will call MoreMasters when it Kneeds master pointers, but since master Kpointer blocks are non-relocatable, Kexplicitly calling it a few times early Kin a program helps to prevent heap Kfragmentation. } "InitGraf(@thePort); {I need QuickDraw} "InitWindows; {I need windows} "SetUp; "UnloadSeg (@Setup); "IF NOT finderprint THEN MainEventLoop; "SetCursor (watchHdl^^); END. 3. "6F^9D!$ǐ^ ((n) ro to stay in TEClick 0RLFFF@o>ǫfFPFP̌̌¾FFxlrv̨̌----------------F̨̣̣̌̌&FF̨̨ ̨̨88lrr̨̨ b88,ÂFFFvoĠ̣x4̨8̨ǫL~rULHH"N̨W; Example/FileAsm ; an example of how to call assembly from Pascal, and Pascal from assembly ; ; MODIFICATION HISTORY ; ; 06-Feb-84 CRC New Today ; 26-Jun-84 CRC Changed to use AutoScroll to use Pascal proc TrackScroll ; NewPtrClear stolen from Rony Sebok's "NewPtr" in OSTraps ; ;----------------------------------------------------------------------------------- ; ; Procedure AutoScroll; ; ; The location of this procedure is passed to TextEdit in the clikLoop field. ; It is called by TextEdit when the user drags a selection range outside of the ; viewrect. This calls the pascal procedures TrackScroll to cause the screen to ; scroll, if possible, and the selection range to be extended. ; ;----------------------------------------------------------------------------------- ; 0.NOLIST 0.INCLUDE TlAsm/QuickEqu.Text 0.INCLUDE TlAsm/QuickTraps.Text 0.INCLUDE TlAsm/SysEqu.Text 0.INCLUDE TlAsm/SysTraps.Text 0.INCLUDE TlAsm/ToolEqu.Text 0.INCLUDE TlAsm/ToolTraps.Text 0.LIST 0.PROC AutoScroll,0 ;offsets for Pascal globals MyWindow .EQU -4 ;offset for current application window VScroll .EQU -20 ;the window's vertical scroll bar whichPart .EQU -22 ;the last button pushed 0.REF TrackScroll ;Get the mouse location to see if scrolling is required 0PEA temppoint 0_GetMouse ;get local mouse point to D0 0MOVE.W temppoint,D0 ;Check if we're in the text rect. TextEdit passes the currently edited record in A3. 0LEA Condition,A0 ;a place to store the condition code 0CMP.W TEViewRect+Top(A3),D0 ;compare with the viewrect top 0BLT.S OutOfRect ;branch if mouse moves above top 0CMP.W TEViewRect+Bottom(A3),D0 ;is mouse below the bottom? 0BLE.S NoMove ;no, don't scroll. ;TextEdit sets the clip region to the viewrect. To allow the scrollbar to be redrawn, ;the clip is set to the entire window. OutOfRect MOVE SR,(A0) ;save whether outside top, bottom 0MOVE.L MyWindow(A5),A0 ;global MyWindowPtr 0PEA PortRect(A0) ;global MyWindowPtr^.portrect 0_ClipRect ;set the application's clip 0MOVE.L VScroll(A5),-(SP) ;push handle for scroll, below ;now scroll up or down 0MOVE Condition,CCR ;get back top or bottom condition 0BLT.S OffTop ;We're off the bottom. Act as if the user is pressing scrollbar's down arrow 0MOVE.W #inDownButton,-(SP) ;scroll down. 0BRA.S OT2 ;go scroll it ;We're off the top. Do a scroll Up. OffTop MOVE.W #inUpButton,-(SP) ;Scroll up. OT2 MOVE.W (SP), whichPart(A5) ;satisfy TrackScroll condition 0JSR TrackScroll ;Pascal routine. 0PEA TEViewRect(A3) 0_ClipRect ;restore TextEdit's clip region ;a non-zero code returned in DO tells TextEdit to stay in the TEClick routine. NoMove MOVEQ #-1,D0 ;return non-zero to stay in TEClick 0RTS Condition temppoint .LONG 0 ;----------------------------------------------------------------------------------- ; ; Function NewPtrClear(byteCount: Size): Ptr; ; ; Returns a pointer to a newly allocated non-relocatable block of memory byteCount ; bytes long. NewPtr will set the area of memory reserved by it to zero if the ; 'clear' bit in the NewPtr trap is set. NewHandle has a 'clear' bit as well. ; ;----------------------------------------------------------------------------------- 0.FUNC NewPtrClear 0.REF SaveRetA1 0Move.L (SP)+,A1 ;get return address 0Move.L (SP)+,D0 ;get the byte count 0_NewPtr ,CLEAR ;ask OS to do request 0Move.L A0,(SP) ;return result ptr on stack 0JMP SaveRetA1 ;save result code and return via A1 0.END 3. "6F^5D!$ǐ^C۔* FileResDef -- Resource input for sample application named File * Written by Macintosh User Education Example/File.Rsrc Type CARY = STR ,0 (32) File, by Cary Clark Version 1.0 July 3, 1984 Type FREF ,128 APPL 0 ,129 TEXT 1 Type BNDL ,128 CARY 0 2 ICN# 2 0 128 1 129 FREF 2 0 128 1 129 Type ICN# ,128 2 00000000 00000000 00000000 00020000 00050000 00088038 00104044 00202082 00401102 00800A82 01000544 02000AA8 04001550 08002AA0 10005540 2000AAA0 40001510 80010A08 40000410 20030820 1003A040 08038080 04000100 02000200 01000400 00800800 00401000 00202000 00104000 00088000 00050000 00020000 00000000 00000000 00000000 00020000 00070000 000F8038 001FC07C 003FE0FE 007FF1FE 00FFFBFE 01FFFFFC 03FFFFF8 07FFFFF0 0FFFFFE0 1FFFFFC0 3FFFFFE0 7FFFFFF0 FFFFFFF8 7FFFFFF0 3FFFFFE0 1FFFFFC0 0FFFFF80 07FFFF00 03FFFE00 01FFFC00 00FFF800 007FF000 003FE000 001FC000 000F8000 00070000 00020000 ,129 2 0FFFF800 08000400 08000600 08000500 08000480 08000438 08000444 08000682 08000102 08000282 08000544 08000AA8 08001550 08002AA0 08005550 0800AA90 08001510 08010A10 08000410 08030810 0803A010 08038010 08000010 08000010 08000010 08000010 08000010 08000010 08000010 08000010 08000010 0FFFFFF0 0FFFF800 0FFFFC00 0FFFFE00 0FFFFF00 0FFFFF80 0FFFFFF8 0FFFFFFC 0FFFFFFE 0FFFFFFE 0FFFFFFE 0FFFFFFC 0FFFFFF8 0FFFFFF0 0FFFFFE0 0FFFFFF0 0FFFFFF0 0FFFFFF0 0FFFFFF0 0FFFFFF0 0FFFFFF0 0FFFFFF0 0FFFFFF0 0FFFFFF0 0FFFFFF0 0FFFFFF0 0FFFFFF0 0FFFFFF0 0FFFFFF0 0FFFFFF0 0FFFFFF0 0FFFFFF0 0FFFFFF0 Type MENU ",1 (4) "\14 $About File $(- ",2 (4) "File $New $Open $Close $Save $Save As $Revert to Saved $Page Setup $Print $Quit ",3 (4) "Edit $Undo/Z $(- $Cut/X $Copy/C $Paste/V $Clear $Select All/A $(- $Show Clipboard ",100 (4) "Debug $Show FreeMem $Compact Memory * document window Type WIND ",256 (32) x "50 30 158 482 "Visible NoGoAway "2 "0 ",257 (32) Clipboard "262 4 337 446 "Visible GoAway "0 "0 ",258 (32) FreeMem "320 442 339 511 "Visible NoGoAway "0 "0 * vertical scroll bar Type CNTL ",256 (4) x "-1 395 236 411 "invisible "16 "0 "0 0 0 Type DITL ",256 (32) "4 $BtnItem Enabled $65 13 85 83 Yes $BtnItem Enabled $95 300 115 370 Cancel $BtnItem Enabled $95 13 115 83 No $StatText Disabled $8 60 60 370 Do you want to save changes made to '^0'^1? ",257 (32) "3 $BtnItem Enabled $90 267 110 337 OK $StatText Disabled $10 60 70 350 An error occured while ^0 the disk. The file '^1' was not ^2. $StatText Disabled $90 10 110 260 ^3 ",258 (32) "3 $BtnItem Enabled $62 300 82 370 Cancel $StatText Disabled $5 10 60 370 The document '^0' is being spooled to disk and printed. $StatText Disabled $62 10 82 270 ^1 of ^2. ",259 (32) "3 $BtnItem Enabled $90 13 110 83 OK $BtnItem Enabled $90 267 110 337 Cancel $StatText Disabled $10 60 70 350 Are you sure you want to go back to the old version of this file? You will lose any changes that you have made. ",260 (32) "3 $BtnItem Enabled $90 13 110 83 OK $BtnItem Enabled $90 267 110 337 Cancel $StatText Disabled $10 60 70 350 A file by that name is already open. '^0' will be opened instead. Type DLOG * this is the 'press cancel to stop printing' dialog ",257 (32) "40 66 125 446 "Visible 1 NoGoAway 0 "258 Type ALRT * a stop alert - an error occured while reading or writing the disk ",256 (32) "60 81 180 431 "257 "5555 * a caution alert - a file is changed and 'Revert to Saved' is chosen ",257 (32) "60 81 180 431 "259 "CCCC * a note alert - the file selected is already on the desktop ",258 (32) "60 81 180 431 "260 "CCCC * a caution alert - the file is being closed, but has not yet been saved ",259 (32) "60 66 180 446 "256 "4444 Type STR# ",256 (36) Untitled- Save this document as: This example was written to demonstrate the Macintosh User Interface. Show Clipboard Hide Clipboard -6 -7 before quitting reading from writing to loaded saved -13 Print Stop Printing Copy of\20 This disk is full. The disk directory is full. This file The disk is locked. The disk is unreadable. ID =\20 ",257 (36) External Debugger Show FreeMem Hide FreeMem Type CODE "Example/fileL,0 5"S@nHnHz^ {$X-} PROGRAM Grow; "{ Grow -- Scroll bars and a resizable window added to Edit } "{ by Cary Clark, Macintosh Technical Support } "{ SK 6/23 Added if GetNextEvent, SetPort in update event } "{This program is a sample. Don't use it as a skeleton or template; instead, #understand each line and redo it yourself, only better!} "{ Note: you can now find a much better way to do scrolling in $Example/Scroll.text} #USES {$U-} &{$U Obj/Memtypes } Memtypes, &{$U Obj/QuickDraw } QuickDraw, &{$U Obj/OSIntf } OSIntf, &{$U Obj/ToolIntf } ToolIntf; #CONST &lastMenu = 3; { number of menus } &appleMenu = 1; { menu ID for desk accessory menu } &fileMenu = 256; { menu ID for File menu } &editMenu = 257; { menu ID for Edit menu } #VAR &myMenus: ARRAY [1..lastMenu] OF MenuHandle; &growRect,dragRect,pRect,tRect: Rect; &doneFlag,temp: BOOLEAN; &myEvent: EventRecord; &code,refNum,MyControl,t: INTEGER; &wRecord: WindowRecord; &theWindow,whichWindow: WindowPtr; &theMenu,theItem: INTEGER; &theChar: CHAR; &ticks: LongInt; &hTE: TEHandle; &hCurs: CursHandle; &iBeam: Cursor; &hScroll,vScroll,whichControl: ControlHandle; &TheOrigin: point; &savePort: GrafPtr; #PROCEDURE SetUpMenus; #{ Once-only initialization for menus } &VAR )i: INTEGER; &BEGIN )InitMenus; { initialize Menu Manager } )myMenus[1] := GetMenu(appleMenu); )AddResMenu(myMenus[1],'DRVR'); { desk accessories } )myMenus[2] := GetMenu(fileMenu); )myMenus[3] := GetMenu(editMenu); )FOR i := 1 TO lastMenu DO InsertMenu(myMenus[i],0); )DrawMenuBar; &END; { of SetUpMenus } #PROCEDURE CursorAdjust; #{ Makes cursor be I-beam inside the (active) application window's } #{ content region (except for size box and scroll bar areas). } &VAR )mousePt: point; &BEGIN )GetMouse(mousePt); )IF theWindow=FrontWindow THEN ,BEGIN ,IF (PtInRect(mousePt,pRect)) THEN /SetCursor(iBeam) ,ELSE /SetCursor(arrow); ,END; &END; #PROCEDURE DoCommand(mResult: LongInt); &VAR )name: STR255; &BEGIN )theMenu := HiWord(mResult); theItem := LoWord(mResult); )CASE theMenu OF ,appleMenu: /BEGIN /GetItem(myMenus[1],theItem,name); /refNum := OpenDeskAcc(name); /END; ,fileMenu: doneFlag := TRUE; { Quit } ,editMenu: /BEGIN /IF NOT SystemEdit(theItem-1) THEN 2BEGIN 2SetPort(theWindow); 2ClipRect(pRect); /{ Delay so menu title will stay lit a little while if Command key } 2{ equivalent was typed. } 2if myEvent.what <> mouseDown 5then Delay (30, ticks); 2CASE theItem OF 53: TECut(hTE); 54: TECopy(hTE); 55: TEPaste(hTE); 2END; { of item case } 2END; /END; { of editMenu } )END; { of menu case } )HiliteMenu(0); &END; { of DoCommand } #PROCEDURE MoveScrollBars; &BEGIN )WITH theWindow^.portRect DO ,BEGIN ,HideControl(vScroll); ,MoveControl(vScroll,right-15,top-1); ,SizeControl(vScroll,16,bottom-top-13); ,ShowControl(vScroll); ,HideControl(hScroll); ,MoveControl(hScroll,left-1,bottom-15); ,SizeControl(hScroll,right-left-13,16); ,ShowControl(hScroll) ,END &END; #PROCEDURE ResizePRect; &BEGIN )pRect := thePort^.portRect; )pRect.left := pRect.left+4; pRect.right := pRect.right-15; )pRect.bottom := pRect.bottom-15 &END; #PROCEDURE GrowWnd(whichWindow: WindowPtr); #{ Handles growing and sizing the window and manipulating } #{ the update region. } &VAR )longResult: LongInt; )height,width: INTEGER; )tRect: Rect; &BEGIN )longResult := GrowWindow(whichWindow,myEvent.where,growRect); )IF longResult=0 THEN EXIT(GrowWnd); )height := HiWord(longResult); width := LoWord(longResult); ){ Add the old "scroll bar area" to the update region so it will } ){ be redrawn (for when the window is enlarged). } )tRect := whichWindow^.portRect; tRect.left := tRect.right-16; )InvalRect(tRect); )tRect := whichWindow^.portRect; tRect.top := tRect.bottom-16; )InvalRect(tRect); ){ Now draw the newly sized window. } )SizeWindow(whichWindow,width,height,TRUE); )MoveScrollBars; )ResizePRect; ){ Adjust the view rectangle for TextEdit. } )hTE^^.viewRect := pRect; ){ Add the new "scroll bar area" to the update region so it will } ){ be redrawn (for when the window is made smaller). } )tRect := whichWindow^.portRect; tRect.left := tRect.right-16; )InvalRect(tRect); )tRect := whichWindow^.portRect; tRect.top := tRect.bottom-16; )InvalRect(tRect); &END; { of GrowWnd } #PROCEDURE DrawWindow(whichWindow: WindowPtr); #{ Draws the content region of the given window, after erasing whatever } #{ was there before. } &VAR )i: INTEGER; &BEGIN )ClipRect(whichWindow^.portRect); )EraseRect(whichWindow^.portRect); )DrawGrowIcon(whichWindow); )DrawControls(whichWindow); )TEUpdate(pRect,hTE) &END; { of DrawWindow } #PROCEDURE ScrollBits; &VAR )oldOrigin: point; )dh,dv: INTEGER; &BEGIN )WITH theWindow^ DO ,BEGIN ,oldOrigin := TheOrigin; ,TheOrigin.h := 4*GetCtlValue(hScroll); ,TheOrigin.v := 4*GetCtlValue(vScroll); ,dh := oldOrigin.h-TheOrigin.h; ,dv := oldOrigin.v-TheOrigin.v; ,TEScroll(dh,dv,hTE) ,END &END; #PROCEDURE ScrollUp(whichControl: ControlHandle; theCode: INTEGER); &BEGIN )IF theCode=inUpButton THEN ,BEGIN ,SetCtlValue(whichControl,GetCtlValue(whichControl)-1); ,ScrollBits ,END &END; #PROCEDURE ScrollDown(whichControl: ControlHandle; theCode: INTEGER); &BEGIN )IF theCode=inDownButton THEN ,BEGIN ,SetCtlValue(whichControl,GetCtlValue(whichControl)+1); ,ScrollBits ,END &END; #PROCEDURE PageScroll(code,amount: INTEGER); &VAR )myPt: point; &BEGIN )REPEAT ,GetMouse(myPt); ,IF TestControl(whichControl,myPt)=code THEN /BEGIN /SetCtlValue(whichControl,GetCtlValue(whichControl)+amount); /ScrollBits /END )UNTIL NOT StillDown; &END; #BEGIN { main program } &InitGraf(@thePort); &InitFonts; &FlushEvents(everyEvent,0); &InitWindows; &SetUpMenus; &TEInit; &InitDialogs(NIL); &SetCursor(arrow); &SetRect(dragRect,4,24,508,338); &SetRect(growRect,100,60,512,302); &doneFlag := FALSE; &theWindow := GetNewWindow(256,@wRecord,POINTER(-1)); &SetPort(theWindow); &theWindow^.txFont := 2; &ResizePRect; &hTE := TENew(pRect,pRect); &hCurs := GetCursor (iBeamCursor); iBeam := hCurs^^; &vScroll := GetNewControl(256,theWindow); &hScroll := GetNewControl(257,theWindow); &TheOrigin.h := 0; TheOrigin.v := 0; &REPEAT )CursorAdjust; )SystemTask; )TEIdle(hTE); )if GetNextEvent(everyEvent,myEvent) then )CASE myEvent.what OF ,mouseDown: /BEGIN /code := FindWindow(myEvent.where,whichWindow); /CASE code OF 2inMenuBar: DoCommand(MenuSelect(myEvent.where)); 2inSysWindow: SystemClick(myEvent,whichWindow); 2inDrag: DragWindow(whichWindow,myEvent.where,dragRect); 2inGoAway: 5IF TrackGoAway(whichWindow,myEvent.where) THEN 8doneFlag := TRUE; 2inGrow: 5IF whichWindow=FrontWindow THEN 8GrowWnd(whichWindow) 5ELSE 8SelectWindow(whichWindow); 2inContent: 5BEGIN 5IF whichWindow<>FrontWindow THEN 8SelectWindow(whichWindow) 5ELSE 8BEGIN {front} 8GlobalToLocal(myEvent.where); 8IF PtInRect(myEvent.where,pRect) THEN ;IF BitAnd(myEvent.modifiers,512)<>0 { Shift key pressed A} >THEN >TEClick(myEvent.where,TRUE,hTE) ;ELSE >TEClick(myEvent.where,FALSE,hTE) 8ELSE ;BEGIN {controls} ;MyControl := FindControl(myEvent.where,whichWindow, TwhichControl); ;CASE MyControl OF >inUpButton: At := TrackControl(whichControl,myEvent.where, S@ScrollUp); >inDownButton: At := TrackControl(whichControl,myEvent.where, S@ScrollDown); >inPageUP: PageScroll(MyControl,-10); >inPageDown: PageScroll(MyControl,10); >inThumb: ABEGIN At := TrackControl(whichControl,myEvent.where, FNIL); AScrollBits AEND ;END {Case MyControl} ;END {controls} 8END {front} 5END {in Content} /END { of code case } /END; { of mouseDown } ,keyDown,autoKey: /BEGIN /IF theWindow=FrontWindow THEN 2BEGIN 2theChar := CHR(myEvent.message MOD 256); 2IF BitAnd(myEvent.modifiers,256)<>0 { Command key pressed } 5THEN 5DoCommand(MenuKey(theChar)) 2ELSE 5TEKey(theChar,hTE) 2END /END; { of keyDown } ,activateEvt: /BEGIN /DrawGrowIcon(theWindow); /IF ODD(myEvent.modifiers) THEN { window is becoming active } 2BEGIN 2SetPort (theWindow); 2TEActivate(hTE); 2ShowControl(vScroll); 2ShowControl(hScroll) 2END /ELSE 2BEGIN 2TEDeactivate(hTE); 2HideControl(vScroll); 2HideControl(hScroll) 2END /END; { of activateEvt } ,updateEvt: /BEGIN /GetPort (savePort); /SetPort (theWindow); /BeginUpdate(theWindow); /DrawWindow(theWindow); /EndUpdate(theWindow); /SetPort (savePort); /END { of updateEvt } )END { of event case } &UNTIL doneFlag #END. 3. "6F^9xaD!$ǐ^NN ISTART.T6 TDZlr̍(̌̌lř̜t̜Z%lr ̍(̌̌FFF̜t̜Ɯ* example/growR -- Resource definintion file for sample application example/Grow * Written by Macintosh Technical Support * 6/23 SK Added menu 1, standard edit menu, removed i-beam cursor example/Grow.Rsrc Type MENU ",1 "\14 ",256 "File $Quit ",257 "Edit $Undo/Z $(- $Cut/X $Copy/C $Paste/V Type WIND ",256 "A Sample "50 40 300 450 "Visible GoAway "0 "0 Type CNTL ",256 "vertical scroll bar "-1 395 236 411 "Visible "16 "0 "0 0 50 ",257 "horizontal scroll bar "235 -1 251 396 "Visible "16 "0 "0 0 50 Type GROW= STR ,0 Grow Version 1.0 - January 8, 1984 Type CODE "Example/growL,0 5ht^XX Td.8~.8'F'. . F'xJh:>:>'F'̘̘$Intrfc/ToolIntf.TextxxNJIntrfc/ToolIntf.TextTextxt̉FJ" . 8. :H H  '@]̑8`H'F)@l%L:@#'J'̘ OSERRS.ERR6:":"9)e noI{$X-} {$U-} {$R-} {To avoid bug in range checking of MacPasLib} {Scott Knaster Macintosh Technical Support 5/10/84} program modal; #uses &{$U Obj/Memtypes } Memtypes, &{$U Obj/QuickDraw } QuickDraw, &{$U Obj/OSIntf } OSIntf, &{$U Obj/ToolIntf } ToolIntf, &{$U Obj/PackIntf } PackIntf; #const &numItems = 16; &numRadGroups = 2; &numChks = 1; &OKBtn = OK; {OK and Cancel constants defined by Dialog Mgr;} &cancelBtn = Cancel; &stopChk = 14; &textItem = 6; {item number for editable text item} &btnOff = 0; &btnOn = 1; &noWrap = -1; #{I have radio buttons handled as sets. Don't do it this way! A much better way is $to put the default setting and the "group" number in the control's refCon field. Then, when a $radio button is turned on, the code will walk through the control list (probably with GetDItem) $, check each control to make sure it's a radio button, and turn it off if its group was hit. } $var { Note that for both radio buttons and check boxes, I don't need to keep a "nowOn" field - the $Control's value field works fine.} &radSet : packed array [1..numRadGroups] of packed record PdefaultOn, nowOn : 0..255; Pbtns : set of 1..numItems; Xend; {record} &chkBoxes : packed array [1..numChks] of packed record Pdefault : btnOff..btnOn; Pbtn : 1..numItems; Nend; &index : integer; &debug : text; &theDialog : DialogPtr;{pointer to dialog record - returned by GetNewDialog} &itemHit : integer; {item where event occurred - returned by ModalDialog} &{the next three things are returned by GetDItem :} &theType : integer; {gives the type of the item requested} &theTextHdl, theOkHdl, itemHdl, radHdl : handle; {gives a handle to the item} &txtBox, OKbox, itemBox, radBox : Rect; {gives the display rectangle of the item} &theText : str255; {text of the edit item - returned by GetIText} &iBeamHdl : CursHandle; {handle to the special cursor} &theDlogPeek : DialogPeek; {also a pointer to a dialog record - this type Bof pointer is required to set up the editable Btext for no word wrap} &wasDown : boolean; {used to obscure cursor after a click in the text} &teHdl : teHandle; &paperDef : integer; #function theFilter (theDialog : DialogPtr; var theEvent : EventRecord; 4var item : integer) : boolean; #{This function is called by ModalDialog for every event that occurs while it's $in control. It's used to perform special filtering (hence the clever name) $of events before letting ModalDialog take over. For example, we use it to $change the cursor to an I-beam when it's on editable text and to obscure $(hide) the I-beam cursor after the user clicks in editable text (a la Lisa). $We must also tell ModalDialog that a press of Return or Enter by the user $should be treated the same as if he had clicked on the OK button $(per user interface standards).} #const %crCode = 13; {ASCII code generated by Return and Enter keys. Note that} %enterCode = 3; {this is good for any keyboard, no matter how it's mapped 9or what language the user speaks (keypad too)} #var &mouseLoc : Point; &finalTicks : longint; #begin &itemHit := 0; {We return these two values. Initialize them.} &theFilter := false; &{Frill: When you click in editable text and start typing, TextEdit calls 'ObscureCursor, which hides the cursor until you move the mouse again. 'This keeps the cursor from getting in your way while you type. Lisa 'editing adds a nice touch: the cursor is obscured as soon as you click, 'before you start typing. This stuff does the same thing. 'It would be nice if we could just wait for a MouseUp event in the text, 'but TextEdit "eats" the MouseUp event when it calls WaitMouseUp instead 'of StillDown; so, we do it this way.} &if wasDown and not StillDown )then begin 1ObscureCursor; {User clicked in editable text} 1wasDown := false; {Reset "mouse down" flag} .end; &case theEvent.what of )nullEvent : begin {Nothing is going on, so fix the cursor} 8GetMouse (mouseLoc); 8if PtInRect (mouseLoc, txtBox) {box is TextEdit's box} ;then SetCursor (iBeamHdl^^) ;else SetCursor (arrow); {make sure it's an arrow} 5end; )mouseDown : begin 0GlobalToLocal (theEvent.where); {because PtInRect wants it that way} 0if PtInRect (theEvent.where, txtBox) {Set mouse down flag} Cthen wasDown := true;{if mouse down in text box} 0LocalToGlobal (theEvent.where); {because Dlog Mgr wants it that way} 5end; )keyDown, autoKey : 2begin 5if (theEvent.message mod 256) in [crCode, enterCode] 5then {user pressed Return or Enter} 8begin ;GetDItem (theDialog, OKbtn, theType, theOkHdl, OKbox); ;HiliteControl (ControlHandle (theOkHdl), JbtnOn); {make it look...} ;Delay (3, finalTicks); {...like the OK button was hit} ;theFilter := true; {dialog is over} ;itemHit := OKBtn; {simulate user hitting OK} 5end 2end &end {case theEvent.what} #end; {function theFilter} begin {main program} #InitGraf (@thePort); {the big five inits} #InitFonts; #InitWindows; #TEInit; #InitDialogs (nil); #reset (debug, '.bout'); #iBeamHdl := GetCursor (iBeamCursor); {load special cursor} #wasDown := false; {just initializing here} #{The next chunk of code is used to set up the radio button and check box $data structures. It should be done during initialization of the program. $Since the settings must exist between incarnations of the dialog box, $these variables must not be local to the procedure that puts up the box.} #radSet [1].btns := [8, 9]; #radSet [1].defaultOn := 8; #radSet [1].nowOn := radSet [1].defaultOn; #radSet [2].btns := [11, 12, 13]; #radSet [2].defaultOn := 12; #radSet [2].nowOn := radSet [2].defaultOn; #chkBoxes [1].btn := stopChk; #chkBoxes [1].default := btnOn; {default 'Stop printing' check box to on} #{The following loop actually does the dialog. It should be called each $time you want the dialog to happen.} &repeat )FlushEvents (everyEvent, 0); {this throws out leftover clicks, keys} )theDialog := GetNewDialog (1000, nil, pointer (-1)); /{this "draws" the dialog box (but it's invisible)} )for index := 1 to numRadGroups do {initialize default radio buttons} ,begin /GetDItem (theDialog, radSet [index].defaultOn, theType, itemHdl, itemBox); /SetCtlValue (ControlHandle (itemHdl), btnOn); ,end; )for index := 1 to numChks do {Initialize default check boxes} ,begin /GetDItem (theDialog, chkBoxes [index].btn, theType, itemHdl, itemBox); /SetCtlValue (ControlHandle (itemHdl), chkBoxes [index].default); 5{set default value of check box} ,end; )GetDItem (theDialog, textItem, theType, theTextHdl, txtBox); ,{this tells us three things: (1), theTextHdl is a handle to the editable -text, which we need to find out the text later; (2), txtBox tells us -where the text is, so we can change the pointer to an I-beam when -it moves over the text; and (3), theType tells us the type of the -item, which in this case we already know is editable text} )theDlogPeek := DialogPeek (theDialog); {get peek-type pointer to dialog...} )theDlogPeek^.textH^^.crOnly := noWrap; {...so we can turn off word wrap} )SetPort (theDialog); {this makes later GlobalToLocal calls work right} )ShowWindow (theDialog); {here I am!} )InitCursor; {we're ready, show an arrow} ,repeat /ModalDialog (@theFilter,itemHit); {calls theFilter for every event} /GetDItem (theDialog, itemHit, theType, itemHdl, itemBox); 5{find out what was hit} 0case theType of 3chkCtrl + ctrlItem : {check box was hit; toggle its state} 6SetCtlValue (ControlHandle (itemHdl), 6BitXor (GetCtlValue (ControlHandle (itemHdl)), 1)); 3radCtrl + ctrlItem : begin {radio button was hit} 6index := 1; 6while not (itemHit in radSet [index].btns) 8do index := index + 1; {find out which set Pof buttons was hit} 6GetDItem (theDialog, radSet [index].nowOn, theType, @radHdl, radBox); {get handle to button now on} 6SetCtlValue (ControlHandle (radHdl), btnOff); {old button off} 6SetCtlValue (ControlHandle (itemHdl), btnOn); {new button on} 6radSet [index].nowOn := itemHit; {update data structure} Hend; {radCtrl case} 0end; {case theType} ,until itemHit in [OKBtn, cancelBtn]; /{dialog ends when user hits a button (or presses Return or Enter, 0which theFilter makes look like a hit on the OK button)} )if itemHit = cancelBtn ,then begin {Revert radio buttons to their 8settings before dialog was 8called.} 5for index := 1 to numRadGroups do 7radSet [index].nowOn := radSet [index].defaultOn; #{Note that I don't have to revert the checkboxes, since their "default" $field has not been changed.} 1end ,else begin {Update default settings} 5for index := 1 to numRadGroups do 7radSet [index].defaultOn := radSet [index].nowOn; 5for index := 1 to numChks do 8begin ;GetDItem (theDialog, chkBoxes [index].btn, theType, EitemHdl, itemBox); ;chkBoxes [index].default := BGetCtlValue (ControlHandle (itemHdl)); 8end 1end; )GetIText (theTextHdl, theText); {this tells us the text that the user entered} ){do something with it - what?} &until theText = 'quit'; {all done if user typed 'quit'} end. 3. "6F^9exD!$ǐ^BKKh6ISTART.T0N>} 0 0 13312 13312 -128 APPLFMOV! Font Editor 0 0 32768 32768 -128 APPL Number of fil* resource definition file for modal.text example/modal.rsrc Type DLOG #,1000 #33 110 333 390 #Invisible 1 NoGoAway 0 #1000 Type DITL #,1000 #16 #BtnItem Enabled #15 196 35 254 OK #BtnItem Enabled #45 196 65 254 Cancel #IconItem Disabled #10 10 42 42 #1000 #StatText Disabled #20 50 40 180 Print the document #StatText Disabled #75 10 95 50 Title: #EditText Enabled #77 60 92 225 #StatText Disabled #102 10 122 100 Paper size: #RadioItem Enabled #126 18 141 140 8 1/2" by 11" #RadioItem Enabled #126 160 141 270 8 1/2" by 14" #StatText Disabled #151 10 171 100 Print Quality: #RadioItem Enabled #175 18 195 75 High #RadioItem Enabled #175 105 195 183 Standard #RadioItem Enabled #175 200 195 260 Draft #ChkItem Enabled #205 10 220 235 Stop printing after each page #UserItem Disabled #235 62 255 210 #StatText Disabled #265 68 285 250 Type "quit" to exit Type ICON #,1000 #0000 0000 #0000 0000 #03FF FFC0 #0600 0060 #0D11 1130 #1844 4458 #1111 1108 #1000 0008 #1000 0008 #1FFF FFF8 #0000 0000 #1FFF FFF8 #0000 0000 #3BBB BBB8 #6EEE EEEE #0000 0000 #3FFF FFFC #2000 0004 #3FFF FFFC #0000 0000 #7FFF FFFE #7FFF FFFE #0000 0000 #1FFF FFF8 #1000 0008 #1444 4448 #1000 0008 #1911 1118 #0C00 0030 #0600 0060 #03FF FFC0 #0000 0000 Type CODE #example/modall,0 3. "6F^50^)0 , d,:dxtRc.Te"jFȠc.Text>ÀxtTzÚÒ>òYYRR@TԠ  T*\Mv{$U-} {$X-} program scrap; {Scott Knaster, Macintosh Tech Support, 6/4/84 Displays the PICT scrap. Clever part is extracting original frameRect from the picture. Some things to do: add desk accessory support & edit menu; use WindowPic field } #uses &{$U Obj/Memtypes } Memtypes, &{$U Obj/QuickDraw } QuickDraw, &{$U Obj/OSIntf } OSIntf, &{$U Obj/ToolIntf } ToolIntf, &{$U Obj/PackIntf } PackIntf; #var %theWindow : WindowPtr; %theScrap : Handle; %thePict : PicHandle; %rectPtr : ^Rect; %offset, result : longint; %theFrame : Rect; begin #InitGraf (@thePort); {standard initialization stuff} #InitFonts; #InitWindows; #TEInit; #InitDialogs (nil); #theWindow := GetNewWindow (256, nil, pointer (-1)); #SetPort (theWindow); #theScrap := NewHandle (0); #result := GetScrap (theScrap, 'PICT', offset); #InitCursor; #if result < 0 {error code returned} &then begin )MoveTo (5, 50); )DrawString ('Nothing of type PICT in scrap'); +end &else begin {got something} )thePict := PicHandle (theScrap); .{extract the original frame} )theFrame := thePict^^.picFrame; .{Move the frame down and to the right a little} )OffsetRect (theFrame, -theFrame.left + 15, -theFrame.top + 20); )HLock (Handle (thePict)); *{"Always lock a picHandle before doing DrawPicture." - C. Clark, 1984} )DrawPicture (thePict, theFrame); )HUnlock (Handle (thePict)); +end; #MoveTo (130, 230); #TextFace ([bold]); #DrawString ('Press mouse button to exit'); #repeat until button; end. 3. "6F^56D!$ǐ^ Qexample/picscrap.Rsrc Type WIND ",256 Desk Scrap "50 40 300 450 "Visible NoGoAway "0 "0 Type CODE #example/picscrapl,0 58?^2a<.<5Lb{$X-} PROGRAM QDSample; "{ QDSample -- Macintosh adaptation of Lisa QuickDraw example. } "{ by Paul Zemlin, Macintosh Technical Support } #USES {$U-} &{$U Obj/Memtypes } Memtypes, &{$U Obj/QuickDraw } QuickDraw, &{$U Obj/OSIntf } OSIntf, &{$U Obj/ToolIntf } ToolIntf; TYPE IconData = ARRAY[0..95] OF INTEGER; #CONST &lastMenu = 2; { number of menus } &appleMenu = 1; { menu ID for desk accessory menu } &fileMenu = 256; { menu ID for File menu } #VAR &myMenus : ARRAY [1..lastMenu] OF MenuHandle; &dragRect ,prect, growrect : Rect; &doneFlag,temp : BOOLEAN; &myEvent : EventRecord; &code, refNum, MyControl,t : INTEGER; &theMenu, theItem, whichIcon : INTEGER; &scale : INTEGER; &wRecord : WindowRecord; &theWindow, whichWindow : WindowPtr; &icons : ARRAY[0..5] OF IconData; &hScroll, vScroll, whichControl : ControlHandle; &theOrigin : Point; &theUpdateRgn : RgnHandle; #PROCEDURE InitIcons; #{ Manually stuff some icons. Normally we would read them from a file } #BEGIN %{ Lisa } %StuffHex(@icons[0, 0],'000000000000000000000000000000000000001FFFFFFFFC'); %StuffHex(@icons[0,12],'00600000000601800000000B0600000000130FFFFFFFFFA3'); %StuffHex(@icons[0,24],'18000000004311FFFFF00023120000080F231200000BF923'); %StuffHex(@icons[0,36],'120000080F23120000080023120000080023120000080F23'); %StuffHex(@icons[0,48],'1200000BF923120000080F2312000008002311FFFFF00023'); %StuffHex(@icons[0,60],'08000000004307FFFFFFFFA30100000000260FFFFFFFFE2C'); %StuffHex(@icons[0,72],'18000000013832AAAAA8A9F0655555515380C2AAAA82A580'); %StuffHex(@icons[0,84],'800000000980FFFFFFFFF300800000001600FFFFFFFFFC00'); %{ Printer } %StuffHex(@icons[1, 0],'000000000000000000000000000000000000000000000000'); %StuffHex(@icons[1,12],'00000000000000007FFFFF00000080000280000111514440'); %StuffHex(@icons[1,24],'0002000008400004454510400004000017C00004A5151000'); %StuffHex(@icons[1,36],'0004000010000004A54510000004000017FE00F4A5151003'); %StuffHex(@icons[1,48],'0184000013870327FFFFF10F06400000021B0CFFFFFFFC37'); %StuffHex(@icons[1,60],'18000000006B3000000000D77FFFFFFFFFABC00000000356'); %StuffHex(@icons[1,72],'8000000001AC87F000000158841000CCC1B087F000CCC160'); %StuffHex(@icons[1,84],'8000000001C0C000000003807FFFFFFFFF0007800001E000'); %{ Trash Can } %StuffHex(@icons[2, 0],'000001FC000000000E0600000000300300000000C0918000'); %StuffHex(@icons[2,12],'00013849800000026C4980000004C0930000000861260000'); %StuffHex(@icons[2,24],'0010064FE0000031199830000020E6301800002418E00800'); %StuffHex(@icons[2,36],'0033E3801C0000180E002C00000FF801CC0000047FFE0C00'); %StuffHex(@icons[2,48],'000500004C000005259A4C000005250A4C00000525FA4C00'); %StuffHex(@icons[2,60],'000524024C00000524924C00600524924C0090E524924C7C'); %StuffHex(@icons[2,72],'932524924C82A44524924D01C88524924CF10C4524924C09'); %StuffHex(@icons[2,84],'0784249258E70003049233100000E000E40800001FFFC3F0'); %{ tray } %StuffHex(@icons[3, 0],'000000000000000000000000000000000000000000000000'); %StuffHex(@icons[3,12],'0000000000000000000000000000000000000007FFFFFFF0'); %StuffHex(@icons[3,24],'000E00000018001A00000038003600000078006A000000D8'); %StuffHex(@icons[3,36],'00D7FFFFFFB801AC000003580358000006B807FC000FFD58'); %StuffHex(@icons[3,48],'040600180AB80403FFF00D58040000000AB8040000000D58'); %StuffHex(@icons[3,60],'040000000AB807FFFFFFFD5806AC00000AB8055800000D58'); %StuffHex(@icons[3,72],'06B000000AB807FC000FFD70040600180AE00403FFF00DC0'); %StuffHex(@icons[3,84],'040000000B80040000000F00040000000E0007FFFFFFFC00'); %{ File Cabinet } %StuffHex(@icons[4, 0],'0007FFFFFC00000800000C00001000001C00002000003400'); %StuffHex(@icons[4,12],'004000006C0000FFFFFFD40000800000AC0000BFFFFED400'); %StuffHex(@icons[4,24],'00A00002AC0000A07F02D40000A04102AC0000A07F02D400'); %StuffHex(@icons[4,36],'00A00002AC0000A08082D40000A0FF82AC0000A00002D400'); %StuffHex(@icons[4,48],'00A00002AC0000BFFFFED40000800000AC0000BFFFFED400'); %StuffHex(@icons[4,60],'00A00002AC0000A07F02D40000A04102AC0000A07F02D400'); %StuffHex(@icons[4,72],'00A00002AC0000A08082D40000A0FF82AC0000A00002D800'); %StuffHex(@icons[4,84],'00A00002B00000BFFFFEE00000800000C00000FFFFFF8000'); %{ drawer } %StuffHex(@icons[5, 0],'000000000000000000000000000000000000000000000000'); %StuffHex(@icons[5,12],'000000000000000000000000000000000000000000000000'); %StuffHex(@icons[5,24],'000000000000000000000000000000000000000000000000'); %StuffHex(@icons[5,36],'00000000000000000000000000000000000000001FFFFFF0'); %StuffHex(@icons[5,48],'0000380000300000680000700000D80000D0003FFFFFF1B0'); %StuffHex(@icons[5,60],'0020000013500020000016B000201FE01D50002010201AB0'); %StuffHex(@icons[5,72],'00201FE01560002000001AC0002000001580002020101B00'); %StuffHex(@icons[5,84],'00203FF01600002000001C00002000001800003FFFFFF000'); #END; #PROCEDURE DrawIcon(whichIcon,h,v: INTEGER); {DrawAnIcon => DrawIcon} #VAR 'srcBits : BitMap; 'srcRect, dstRect : Rect; #BEGIN %srcBits.baseAddr:=@icons[whichIcon]; %srcBits.rowBytes:=6; %SetRect(srcBits.bounds,0,0,48,32); %srcRect:=srcBits.bounds; %dstRect:=srcRect; %OffsetRect(dstRect,h,v); %CopyBits(srcBits,theWindow^.portBits,srcRect,dstRect,srcOr,Nil); #END; #PROCEDURE DrawStuff; #VAR i: INTEGER; 'tempRect : Rect; 'myPoly : PolyHandle; 'myRgn : RgnHandle; 'myPattern : Pattern; #BEGIN %StuffHex(@myPattern,'8040200002040800'); %{ draw two horizontal lines across the top } %MoveTo(0,18); %LineTo(719,18); %MoveTo(0,20); %LineTo(719,20); %{ draw divider lines } %MoveTo(0,134); %LineTo(719,134); %MoveTo(0,248); %LineTo(719,248); %MoveTo(240,21); %LineTo(240,363); %MoveTo(480,21); %LineTo(480,363); %{ draw title } %TextFont(0); %MoveTo(210,14); %DrawString('Look what you can draw with QuickDraw'); %{--------- draw text samples --------- } %MoveTo(80,34); DrawString('Text'); %TextFace([bold]); %MoveTo(70,55); DrawString('Bold'); %TextFace([italic]); %MoveTo(70,70); DrawString('Italic'); %TextFace([underline]); %MoveTo(70,85); DrawString('Underline'); %TextFace([outline]); %MoveTo(70,100); DrawString('Outline'); %TextFace([shadow]); %MoveTo(70,115); DrawString('Shadow'); %TextFace([]); { restore to normal } %{ --------- draw line samples --------- } %MoveTo(330,34); DrawString('Lines'); %MoveTo(280,25); Line(160,40); %PenSize(3,2); %MoveTo(280,35); Line(160,40); %PenSize(6,4); %MoveTo(280,46); Line(160,40); %PenSize(12,8); %PenPat(gray); %MoveTo(280,61); Line(160,40); %PenSize(15,10); %PenPat(myPattern); %MoveTo(280,80); Line(160,40); %PenNormal; %{ --------- draw rectangle samples --------- } %MoveTo(560,34); DrawString('Rectangles'); %SetRect(tempRect,510,40,570,70); %FrameRect(tempRect); %OffsetRect(tempRect,25,15); %PenSize(3,2); %EraseRect(tempRect); %FrameRect(tempRect); %OffsetRect(tempRect,25,15); %PaintRect(tempRect); %OffsetRect(tempRect,25,15); %PenNormal; %FillRect(tempRect,gray); %FrameRect(tempRect); %OffsetRect(tempRect,25,15); %FillRect(tempRect,myPattern); %FrameRect(tempRect); %{ --------- draw roundRect samples --------- } %MoveTo(70,148); DrawString('RoundRects'); %SetRect(tempRect,30,150,90,180); %FrameRoundRect(tempRect,30,20); %OffsetRect(tempRect,25,15); %PenSize(3,2); %EraseRoundRect(tempRect,30,20); %FrameRoundRect(tempRect,30,20); %OffsetRect(tempRect,25,15); %PaintRoundRect(tempRect,30,20); %OffsetRect(tempRect,25,15); %PenNormal; %FillRoundRect(tempRect,30,20,gray); %FrameRoundRect(tempRect,30,20); %OffsetRect(tempRect,25,15); %FillRoundRect(tempRect,30,20,myPattern); %FrameRoundRect(tempRect,30,20); %{ --------- draw bitmap samples --------- } %MoveTo(320,148); DrawString('BitMaps'); %DrawIcon(0,266,156); %DrawIcon(1,336,156); %DrawIcon(2,406,156); %DrawIcon(3,266,196); %DrawIcon(4,336,196); %DrawIcon(5,406,196); %{ --------- draw ARC samples --------- } %MoveTo(570,148); DrawString('Arcs'); %SetRect(tempRect,520,153,655,243); %FillArc(tempRect,135,65,dkGray); %FillArc(tempRect,200,130,myPattern); %FillArc(tempRect,330,75,gray); %FrameArc(tempRect,135,270); %OffsetRect(tempRect,20,0); %PaintArc(tempRect,45,90); %{ --------- draw polygon samples --------- } %MoveTo(80,262); DrawString('Polygons'); %myPoly:=OpenPoly; 'MoveTo(30,290); 'LineTo(30,280); 'LineTo(50,265); 'LineTo(90,265); 'LineTo(80,280); 'LineTo(95,290); 'LineTo(30,290); %ClosePoly; { end of definition } %FramePoly(myPoly); %OffsetPoly(myPoly,25,15); %PenSize(3,2); %ErasePoly(myPoly); %FramePoly(myPoly); %OffsetPoly(myPoly,25,15); %PaintPoly(myPoly); %OffsetPoly(myPoly,25,15); %PenNormal; %FillPoly(myPoly,gray); %FramePoly(myPoly); %OffsetPoly(myPoly,25,15); %FillPoly(myPoly,myPattern); %FramePoly(myPoly); %KillPoly(myPoly); %{ --------- demonstrate regions --------- } %MoveTo(320,262); DrawString('Regions'); %myRgn:=NewRgn; %OpenRgn; 'ShowPen; 'SetRect(tempRect,260,270,460,350); 'FrameRoundRect(tempRect,24,16); 'MoveTo(275,335); { define triangular hole } 'LineTo(325,285); 'LineTo(375,335); 'LineTo(275,335); 'SetRect(tempRect,365,277,445,325); { oval hole } 'FrameOval(tempRect); 'HidePen; %CloseRgn(myRgn); { end of definition } %DisposeRgn(myRgn); %{ --------- draw oval samples --------- } %MoveTo(580,262); DrawString('Ovals'); %SetRect(tempRect,510,264,570,294); %FrameOval(tempRect); %OffsetRect(tempRect,25,15); %PenSize(3,2); %EraseOval(tempRect); %FrameOval(tempRect); %OffsetRect(tempRect,25,15); %PaintOval(tempRect); %OffsetRect(tempRect,25,15); %PenNormal; %FillOval(tempRect,gray); %FrameOval(tempRect); %OffsetRect(tempRect,25,15); %FillOval(tempRect,myPattern); %FrameOval(tempRect); #END; { DrawStuff } #PROCEDURE MoveScrollBars; &BEGIN )WITH theWindow^.portRect DO ,BEGIN ,HideControl(vScroll); ,MoveControl(vScroll,right-15,top-1); ,SizeControl(vScroll,16,bottom-top-13); ,ShowControl(vScroll); ,HideControl(hScroll); ,MoveControl(hScroll,left-1,bottom-15); ,SizeControl(hScroll,right-left-13,16); ,ShowControl(hScroll) ,END &END; #PROCEDURE ResizePRect; #{ pRect is the window's content region, minus the scroll bars } &BEGIN )pRect := thePort^.portRect; )pRect.right := pRect.right-15; )pRect.bottom := pRect.bottom-15 &END; #PROCEDURE GrowWnd (whichWindow: WindowPtr); #{ Handles growing and sizing the window and manipulating } #{ the update region. } &VAR )longResult: LongInt; )height,width: INTEGER; )tRect: Rect; &BEGIN )longResult := GrowWindow(whichWindow,myEvent.where,growRect); )IF longResult=0 THEN EXIT(GrowWnd); )height := HiWord(longResult); width := LoWord(longResult); ){ Add the old "scroll bar area" to the update region so it will } ){ be redrawn (for when the window is enlarged). } )tRect := whichWindow^.portRect; )tRect.left := tRect.right - 16; )InvalRect(tRect); )tRect := whichWindow^.portRect; )tRect.top := tRect.bottom - 16; )InvalRect(tRect); ){ Now draw the newly sized window. } )SizeWindow(whichWindow,width,height,TRUE); )MoveScrollBars; )ResizePRect; ){ Add the new "scroll bar area" to the update region so it will } ){ be redrawn (for when the window is made smaller). } )tRect := whichWindow^.portRect; tRect.left := tRect.right-16; )InvalRect(tRect); )tRect := whichWindow^.portRect; tRect.top := tRect.bottom-16; )InvalRect(tRect); &END; { of GrowWnd } #PROCEDURE DrawWindow(whichWindow: WindowPtr); #{ Draws the content region of theWindow } &VAR )tRect : Rect; &BEGIN )ClipRect (theWindow^.portRect); )DrawGrowIcon(theWindow); )IF theWindow = FrontWindow THEN DrawControls(theWindow); ){ Now set up a clip area which excludes the scroll bars } )tRect := theWindow^.portRect; )tRect.bottom := tRect.bottom - 16; )tRect.right := tRect.right - 16; ){Now compensate for any scrolling which has been done } )OffsetRect (tRect, theOrigin.h, theOrigin.v); )ClipRect (tRect); ){ Change the origin to compensate for any scrolling which has been done } )SetOrigin (theOrigin.h, theOrigin.v); )DrawStuff; )SetOrigin (0, 0); )ClipRect (theWindow^.portRect); { Reset the clip area } 'END; { of DrawWindow } #PROCEDURE ScrollBits; &VAR )oldOrigin : point; )dh,dv : INTEGER; )tRect : Rect; &BEGIN ,oldOrigin := theOrigin; ,theOrigin.h := 4 * GetCtlValue(hScroll); ,theOrigin.v := 4 * GetCtlValue(vScroll); ,dh := oldOrigin.h - theOrigin.h; ,dv := oldOrigin.v - theOrigin.v; ,theUpdateRgn := NewRgn; ,ScrollRect (pRect, dh, dv, theUpdateRgn); ,{ Have scrolled in junk...need to redraw } ,SetOrigin (theOrigin.h, theOrigin.v); ,OffsetRect (theUpdateRgn^^.rgnBBox, theOrigin.h, theOrigin.v); ,ClipRect (theUpdateRgn^^.rgnBBox); ,DrawStuff; ,DisposeRgn (theUpdateRgn); ,SetOrigin (0, 0); ,ClipRect (theWindow^.portRect); &END; #PROCEDURE ScrollUp(whichControl: ControlHandle; theCode: INTEGER); &BEGIN )IF theCode=inUpButton THEN ,BEGIN ,SetCtlValue(whichControl,GetCtlValue(whichControl)-1); ,ScrollBits ,END &END; #PROCEDURE ScrollDown(whichControl: ControlHandle; theCode: INTEGER); &BEGIN )IF theCode=inDownButton THEN ,BEGIN ,SetCtlValue(whichControl,GetCtlValue(whichControl)+1); ,ScrollBits ,END &END; #PROCEDURE PageScroll(code,amount: INTEGER); &VAR )myPt: point; &BEGIN )REPEAT ,GetMouse(myPt); ,IF TestControl(whichControl,myPt)=code THEN /BEGIN /SetCtlValue(whichControl,GetCtlValue(whichControl)+amount); /ScrollBits /END )UNTIL NOT StillDown; &END; #PROCEDURE SetUpMenus; #{ Once-only initialization for menus } &VAR )i: INTEGER; &BEGIN )InitMenus; { initialize Menu Manager } )myMenus[1] := GetMenu(appleMenu); )AddResMenu(myMenus[1],'DRVR'); { desk accessories } )myMenus[2] := GetMenu(fileMenu); )FOR i := 1 TO lastMenu DO InsertMenu(myMenus[i],0); )DrawMenuBar; &END; { of SetUpMenus } #PROCEDURE DoCommand(mResult: LongInt); &VAR )name: STR255; &BEGIN )theMenu := HiWord(mResult); theItem := LoWord(mResult); )CASE theMenu OF ,appleMenu: /BEGIN /GetItem(myMenus[1],theItem,name); /refNum := OpenDeskAcc(name); /END; ,fileMenu: doneFlag := TRUE; { Quit } )END; { of menu case } )HiliteMenu(0); &END; { of DoCommand } #BEGIN { main program } &InitGraf(@thePort); &InitFonts; &FlushEvents(everyEvent,0); &InitWindows; &SetUpMenus; &InitDialogs(NIL); &SetCursor(arrow); &SetRect(dragRect,4,24,508,338); &SetRect(growRect,100,60,512,302); &doneFlag := FALSE; &InitCursor; &InitIcons; &theWindow := GetNewWindow(256,@wRecord,POINTER(-1)); &SetPort(theWindow); &theWindow^.txFont := 2; &ResizePRect; &vScroll := GetNewControl(256,theWindow); &hScroll := GetNewControl(257,theWindow); &theOrigin.h := 0; theOrigin.v := 0; &REPEAT )SystemTask; )temp := GetNextEvent(everyEvent,myEvent); )CASE myEvent.what OF ,mouseDown: /BEGIN /code := FindWindow(myEvent.where,whichWindow); /CASE code OF 2inMenuBar: DoCommand(MenuSelect(myEvent.where)); 2inSysWindow: SystemClick(myEvent,whichWindow); 2inDrag: DragWindow(whichWindow,myEvent.where,dragRect); 2inGoAway: 5IF TrackGoAway(whichWindow,myEvent.where) THEN 8doneFlag := TRUE; 2inGrow: 5IF whichWindow=FrontWindow THEN 8GrowWnd(whichWindow) 5ELSE 8SelectWindow(whichWindow); 2inContent: 5BEGIN 5IF whichWindow<>FrontWindow THEN 8SelectWindow(whichWindow) 5ELSE 8BEGIN {front} 8GlobalToLocal(myEvent.where); 8IF NOT PtInRect(myEvent.where,pRect) THEN ;BEGIN {controls} ;MyControl := FindControl(myEvent.where,whichWindow, TwhichControl); ;CASE MyControl OF >inUpButton: At := TrackControl(whichControl,myEvent.where, S@ScrollUp); >inDownButton: At := TrackControl(whichControl,myEvent.where, S@ScrollDown); >inPageUP: PageScroll(MyControl,-10); >inPageDown: PageScroll(MyControl,10); >inThumb: ABEGIN At := TrackControl(whichControl,myEvent.where, FNIL); AScrollBits AEND ;END {Case MyControl} ;END {controls} 8END {front} 5END {in Content} /END; { of code case } /END; { of mouseDown } ,activateEvt: /BEGIN /SetPort (theWindow); /DrawGrowIcon(theWindow); /IF ODD(myEvent.modifiers) THEN { window is becoming active } 2BEGIN 2ShowControl(vScroll); 2ShowControl(hScroll); 2END /ELSE 2BEGIN 2HideControl(vScroll); 2HideControl(hScroll) 2END /END; { of activateEvt } ,updateEvt: /BEGIN /BeginUpdate(theWindow); /EraseRect (theWindow^.portRect); /DrawWindow(theWindow); /EndUpdate(theWindow); /END { of updateEvt } )END { of event case } &UNTIL doneFlag #END. 3. "6F^5D!$ǐ^K* QDsampleR -- Resource input for sample application named QDSample * Written by Macintosh Technical Support Example/QDSample.Rsrc Type MENU ",1 "\14 ",256 "File $Quit Type WIND ",256 "QuickDraw Example "50 40 300 450 "Visible GoAway "0 "0 Type CNTL ",256 "vertical scroll bar "-1 395 236 411 "Visible "16 "0 "0 0 50 ",257 "horizontal scroll bar "235 -1 251 396 "Visible "16 "0 "0 0 50 Type CODE "Example/QDSampleL,0 3. "6F^9. D!$ǐ^''wr to end update} } sed} F̣̣.jDHH4^̣DœĽĽD4̋¬LLZHȞLHĎD4̋*%̌D̋ { it's the active window and make it } ,THEN SelectWindow(whichWindow) { active if not } ,ELSE .BEGIN {it's already active: call QuickDraw to } .GlobalToLocal(myEvent.whePROGRAM Sample; { Sample -- A small sample application written by Macintosh User Education } { It displays a single, fixed-size window in which the user can enter and edit text. } { The following two compiler commands are required for the Lisa Workshop. } {$X-} {turn off automatic stack expansion, since it's not needed on Macintosh} {$U-} {turn off Lisa libraries} { The USES clause brings in the units containing the Pascal interfaces. } { The $U expression tells the compiler what file to look in for the specified unit.} USES {$U Obj/MemTypes } MemTypes, {basic Memory Manager data types} %{$U Obj/QuickDraw} QuickDraw, {interface to QuickDraw} %{$U Obj/OSIntf } OSIntf, {interface to the Operating System} %{$U Obj/ToolIntf } ToolIntf; {interface to the Toolbox} CONST appleID = 128; {resource IDs/menu IDs for Apple, File, and Edit menus} &fileID = 129; &editID = 130; &appleM = 1; {index for each menu in myMenus (array of menu handles)} &fileM = 2; &editM = 3; &menuCount = 3; {total number of menus} &windowID = 128; {resource ID for application's window} &undoCommand = 1; {menu item numbers identifying commands in Edit menu} &cutCommand = 3; ©Command = 4; &pasteCommand = 5; &clearCommand = 6; VAR myMenus: ARRAY[1..menuCount] OF MenuHandle; {array of handles to the menus} $dragRect: Rect; {rectangle used to mark boundaries for dragging window} $txRect: Rect; {rectangle for text in application window} $textH: TEHandle; {handle to information about the text} $theChar: CHAR; {character typed on the keyboard or keypad} $extended: BOOLEAN; {TRUE if user is Shift-clicking} $doneFlag: BOOLEAN; {TRUE if user has chosen Quit command} $myEvent: EventRecord; {information about an event} $wRecord: WindowRecord; {information about the application window} $myWindow: WindowPtr; {pointer to wRecord} $whichWindow: WindowPtr; {pointer to window in which mouse button was pressed} PROCEDURE SetUpMenus; { Set up menus and menu bar } "VAR i: INTEGER; "BEGIN "{ Read menu descriptions from resource file into memory and store handles } "{ in myMenus array } "myMenus[appleM] := GetMenu(appleID); {read Apple menu from resource file} "AddResMenu(myMenus[appleM],'DRVR'); {add desk accessory names to Apple menu} "myMenus[fileM] := GetMenu(fileID); {read File menu from resource file} "myMenus[editM] := GetMenu(editID); {read Edit menu from resource file} "FOR i:=1 TO menuCount DO InsertMenu(myMenus[i],0); {install menus in menu bar } "DrawMenuBar; { and draw menu bar} "END; {of SetUpMenus} PROCEDURE DoCommand (mResult: LONGINT); { Execute command specified by mResult, the result of MenuSelect } "VAR theItem: INTEGER; {menu item number from mResult low-order word} &theMenu: INTEGER; {menu number from mResult high-order word} &name: Str255; {desk accessory name} &temp: INTEGER; "BEGIN "theItem := LoWord(mResult); {call Toolbox Utility routines to set } "theMenu := HiWord(mResult); { menu item number and menu number} "CASE theMenu OF {case on menu ID} "appleID: $BEGIN {call Menu Manager to get desk accessory } $GetItem(myMenus[appleM],theItem,name); { name, and call Desk Manager to open } $temp := OpenDeskAcc(name); { accessory (OpenDeskAcc result not used)} $SetPort(myWindow); {call QuickDraw to restore application } $END; {of appleID} { window as grafPort to draw in (may have } K{ been changed during OpenDeskAcc)} "fileID: $doneFlag := TRUE; {quit (main loop repeats until doneFlag is TRUE)} "editID: $BEGIN {call Desk Manager to handle editing command if } $IF NOT SystemEdit(theItem-1) { desk accessory window is the active window} &THEN {application window is the active window} (CASE theItem OF {case on menu item (command) number} (cutCommand: TECut(textH); {call TextEdit to handle command} (copyCommand: TECopy(textH); (pasteCommand: TEPaste(textH); (clearCommand: TEDelete(textH); (END; {of item case} $END; {of editID} "END; {of menu case} {to indicate completion of command, call } "HiliteMenu(0); { Menu Manager to unhighlight menu title } B{ (highlighted by MenuSelect)} "END; {of DoCommand} BEGIN {main program} { Initialization } InitGraf(@thePort); {initialize QuickDraw} InitFonts; {initialize Font Manager} FlushEvents(everyEvent,0); {call OS Event Manager to discard any previous events} InitWindows; {initialize Window Manager} InitMenus; {initialize Menu Manager} TEInit; {initialize TextEdit} InitDialogs(NIL); {initialize Dialog Manager} InitCursor; {call QuickDraw to make cursor (pointer) an arrow} SetUpMenus; {set up menus and menu bar} WITH screenBits.bounds DO {call QuickDraw to set dragging boundaries; ensure at } "SetRect(dragRect,4,24,right-4,bottom-4); { least 4 by 4 pixels will remain visible} doneFlag := FALSE; {flag to detect when Quit command is chosen} myWindow := GetNewWindow(windowID,@wRecord,POINTER(-1)); {put up application window} SetPort(myWindow); {call QuickDraw to set current grafPort to this window} txRect := thePort^.portRect; {rectangle for text in window; call QuickDraw to bring } InsetRect(txRect,4,0); { it in 4 pixels from left and right edges of window} textH := TENew(txRect,txRect); {call TextEdit to prepare for receiving text} { Main event loop } REPEAT {call Desk Manager to perform any periodic } "SystemTask; { actions defined for desk accessories} "TEIdle(textH); {call TextEdit to make vertical bar blink} "IF GetNextEvent(everyEvent,myEvent) {call Toolbox Event Manager to get the next } $THEN { event that the application should handle} &CASE myEvent.what OF {case on event type} &mouseDown: {mouse button down: call Window Manager to learn where} (CASE FindWindow(myEvent.where,whichWindow) OF (inSysWindow: {desk accessory window: call Desk Manager to handle it} *SystemClick(myEvent,whichWindow); (inMenuBar: {menu bar: call Menu Manager to learn which command; } *DoCommand(MenuSelect(myEvent.where)); { then execute it} (inDrag: {title bar: call Window Manager to drag} *DragWindow(whichWindow,myEvent.where,dragRect); (inContent: {body of application window: } *BEGIN { call Window Manager to check whether } *IF whichWindow <> FrontWindow { it's the active window and make it } ,THEN SelectWindow(whichWindow) { active if not } ,ELSE .BEGIN {it's already active: call QuickDraw to } .GlobalToLocal(myEvent.where); { convert to window coordinates for } L{ TEClick, use Toolbox Utility BitAnd to } .extended := BitAnd(myEvent.modifiers,shiftKey) <> 0; { test for Shift } .TEClick(myEvent.where,extended,textH); { key down, and call TextEdit } .END; { to process the event} *END; {of inContent} (END; {of mouseDown} &keyDown, autoKey: {key pressed once or held down to repeat} (BEGIN (theChar := CHR(BitAnd(myEvent.message,charCodeMask)); {get the character} (IF BitAnd(myEvent.modifiers,cmdKey) <> 0 {if Command key down, call Menu } *THEN DoCommand(MenuKey(theChar)) { Manager to learn which command,} *ELSE TEKey(theChar,textH); { then execute it; else pass } (END; { character to TextEdit} &activateEvt: (BEGIN (IF BitAnd(myEvent.modifiers,activeFlag) <> 0 *THEN {application window is becoming active: } ,BEGIN { call TextEdit to highlight selection } ,TEActivate(textH); { or display blinking vertical bar, and call } ,DisableItem(myMenus[editM],undoCommand); { Menu Manager to disable } ,END { Undo (since application doesn't support Undo)} *ELSE ,BEGIN {application window is becoming inactive: } ,TEDeactivate(textH); { unhighlight selection or remove blinking } ,EnableItem(myMenus[editM],undoCommand); { vertical bar, and enable } ,END; { Undo (since desk accessory may support it)} (END; {of activateEvt} &updateEvt: {window appearance needs updating} (BEGIN (BeginUpdate(WindowPtr(myEvent.message)); {call Window Manager to begin update} (EraseRect(thePort^.portRect); {call QuickDraw to erase text area} (TEUpdate(thePort^.portRect,textH); {call TextEdit to update the text} (EndUpdate(WindowPtr(myEvent.message)); {call Window Manager to end update} (END; {of updateEvt} &END; {of event case} UNTIL doneFlag; END. 3. "6F^9xaD!$ǐ^ ' example/Grow trfc/PasLibIntf.text Zlr̍(̌̌lr:̲̌4̲\* example/SampR -- Resource input for small sample application * Written by Macintosh User Education example/Samp.Rsrc Type SAMP = STR ",0 Samp Version 1.0 -- July 25, 1984 Type MENU ",128 *** the apple symbol *** "\14 ",129 "File $Quit ",130 "Edit $(Undo/Z $(- $Cut/X $Copy/C $Paste/V $Clear Type WIND ",128 "Sample "50 40 300 450 "Visible NoGoAway "4 "0 Type CODE "example/SampL,0 9*X ^(/?|^̤d$̤\̣8LĢLZĢ.̣.$̤\–L^@.̣¦LLL̤d̤\^̣L@LZ@Lr̤d̤\^̣$̤\8̣*̠̠P*̠̠88^Ķ̠%88,FFFúj. 8."N{$X-} {$R-} PROGRAM Scroll; {------------------------------------------------------------------------------------ %This is a simple program to demonstrate how to use scroll bars. %You can scroll text or graphics or both. %You can scroll horizontally or vertically. %By Cary Clark, Macintosh Technical Support %Copyright Apple Computer Inc., 1984 -----------------------------------------------------------------------------------} #USES &{$U-} &{$U Obj/MemTypes } MemTypes, &{$U Obj/QuickDraw } QuickDraw, &{$U Obj/OSIntf } OSIntf, &{$U Obj/ToolIntf } ToolIntf; #CONST &Horizontal = 1; {These are the choices in the menu 'Scroll Bar'} &Vertical = 2; &TextItem = 4; &Graphics = 5; &FileMenu = 1; {Resource numbers and position in the Menu bar} &ScrollMenu = 2; &NumOfRects = 30; {quantity of rectangles and strings to scroll around} &NumOfStrings = 55; #TYPE &MyRectData = ARRAY [1..NumOfRects] OF Rect; {Graphics structure: } &MyRectPtr = ^MyRectData; { an array of rectangles} &MyRectHdl = ^MyRectPtr; #VAR &hTE: TEHandle; {TextEdit handle} &hScroll, {Horizontal scroll bar} &vScroll: ControlHandle; {Vertical scroll bar} &MyWindow: WindowPtr; {Document window} &hdlScrollMenu: MenuHandle; {Handle to the menu items} &MyRect: MyRectHdl; {Handle to array of rectangles} &originalPart: INTEGER; {1st part of the scroll bar hit} &PageCorner, {Location of the upper left hand page corner} &EventPoint: Point; {Where an event took place} &growBoxRect, {area of the window reserved for the grow box} &MyViewRect: Rect; {display rectangle containing scrollable data} &doneFlag, {Set TRUE when the user selects 'Quit'} &showText, {Set TRUE when text can be scrolled} &showGraphics: BOOLEAN; {Set TRUE when graphics can be scrolled} {-----------------------------------------------------------------------------------} #PROCEDURE SetUpData; {This procedure initializes two data structures; a TextEdit record and an array of rectangles. Initially, only text and the vertical scrollbar will be displayed.} &VAR )MyString: StringHandle; {Temporary container for a string in the Gresource fork} )counter: INTEGER; {Counters must be local to the procedure} )destRect: Rect; {Rectangle containing the larger-than-the- Gscreen page} &BEGIN {The TextEdit record is initialized by reading in a string from the application's resource fork and then inserting it a number of times into the TextEdit record.} )MyString := GetString(256); {Get some text to play around with} {Set the view as the portrect less the vertical scrollbar area. The TextEdit destRect will be set to the current window width plus an arbitrary value.} )MyViewRect := MyWindow^.portrect; )destRect := MyViewRect; )destRect.right := destRect.right + 300; )PageCorner.h := - destRect.left; )PageCorner.v := - destRect.top; )MyViewRect.right := MyViewRect.right - 15; {subtract width of scrollbar} )hTE := TENew(destRect, MyViewRect); )HLock(Pointer(MyString)); {Can't move if we are going to point to the text} )FOR counter := 1 TO NumOfStrings DO {Create a TE record full of the string.} ,TEInsert(Pointer(Ord4(MyString^) + 1), {past the string's length byte} -Length(MyString^^), hTE); )HUnLock(Pointer(MyString)); {Free to move again} ){Now, create a structure of rectangles.} )MyRect := Pointer(NewHandle(Sizeof(MyRectData))); {240 bytes } )FOR counter := 1 TO NumOfRects DO ,SetRect(MyRect^^[counter], counter * 23, counter * 20, counter * -23 + 50, counter * 20 + 50); )showText := TRUE; )showGraphics := FALSE; )ShowWindow(MyWindow); {Display the window and the text it contains} )vScroll := GetNewControl(256, MyWindow); {vertical scrollbar} )hScroll := GetNewControl(257, MyWindow); {horizontal scrollbar, not shown} )SetRect(growBoxRect, vScroll^^.contrlRect.left+1, *vScroll^^.contrlRect.bottom+1, myWindow^.portRect.right, *myWindow^.portRect.bottom); {This area is set up for ValidRect, below.} )CheckItem(hdlScrollMenu, Vertical, TRUE); )CheckItem(hdlScrollMenu, TextItem, TRUE) &END; {of SetUpData} {------------------------------------------------------------------------------------} #PROCEDURE GrafUpdate(whatpart: Rect); {This is roughly the equivalent of what TEUpdate does with text. The upper left hand corner of the page is moved up and to the left to simulate a view further down and to the right. To more accurately resemble a Toolbox routine like TEUpdate, this procedure should also preserve the current clip region and origin.} &VAR )count: INTEGER; )dummyRect: Rect; &BEGIN )SetOrigin(PageCorner.h, PageCorner.v); {negative moves the origin left, up} )OffsetRect(whatpart, PageCorner.h, PageCorner.v); {move the update rect.} )ClipRect(whatpart); {only redraw the portion that the user requests} )FOR count := 1 TO NumOfRects DO +{Redraw the object if it intersects the update rectangle} ,IF SectRect(MyRect^^[count], whatpart, dummyRect) /THEN FrameRect(MyRect^^[count]); )SetOrigin(0, 0); {reset the origin back to the upper left hand corner} )ClipRect(MyWindow^.portrect); {reset the clip region to the entire window} &END; {of GrafUpdate} {------------------------------------------------------------------------------------} #PROCEDURE ScrollBits; {This routine scrolls horizontally and vertically both graphics and text. If you are only scrolling text, only the TEScroll is required. If you are only scrolling graphics, then only the ScrollRect and GrafUpDate is needed.} &VAR )vChange, hChange, vScrollValue, hScrollValue: INTEGER; )AnUpdateRgn: RgnHandle; &BEGIN )vScrollValue := GetCtlValue(vScroll); {These values will be used a lot so} )hScrollValue := GetCtlValue(hScroll); {they are temporary variables.} {find the vertical and horizontal change} )vChange := PageCorner.v - vScrollValue; {the vertical difference} )hChange := PageCorner.h - hScrollValue; {the horizontal difference} {record the values for next time} )PageCorner.v := vScrollValue; )PageCorner.h := hScrollValue; {for pure text, only a TEScroll is required} )IF showText AND NOT showGraphics ,THEN TEScroll(hChange, vChange, hTE); {For graphics, a ScrollRect will move the visible bits on the screen. The region returned by ScrollRect indicates what part of the window needs to be updated.} )IF showGraphics ,THEN BEGIN /AnUpdateRgn := NewRgn; /ScrollRect(MyViewRect, hChange, vChange, AnUpdateRgn); {This draws the new text. The clipping is necessary because normally TextEdit redraws the entire character height and perhaps only a partial character scroll was done. Since TextEdit erases before it draws, the text, if any, is drawn before the graphics.} /IF showText 2THEN 5WITH hTE^^.destRect DO BEGIN 8left := - hScrollValue; 8top := - vScrollValue; 8ClipRect(AnUpdateRgn^^.rgnbbox); 8TEUpdate(AnUpdateRgn^^.rgnbbox, hTE); 8ClipRect(MyWindow^.portrect) 5END; {of showText} /GrafUpdate(AnUpdateRgn^^.rgnbbox); {Fill in the newly exposed region.} /DisposeRgn(AnUpdateRgn) ,END {of showGraphics} &END; {of ScrollBits} {------------------------------------------------------------------------------------} #PROCEDURE TrackScroll(theControl: ControlHandle; partCode: INTEGER); {This routine adjusts the value of the scrollbar. A reasonable change would be to adjust the minimum scroll amount to equal the text's lineheight.} &VAR )amount, )StartValue: INTEGER; )up: BOOLEAN; &BEGIN )up := (partCode = inUpButton) OR (partCode = inPageUp); {TRUE if ,scrolling up} )StartValue := GetCtlValue(theControl); {the initial control value} )IF {The scrollbar value is decreased, and it is not already at the minimum.} +((up AND (StartValue > GetCtlMin(theControl))) OR {The scrollbar value is increased, and it is not already at the maximum.} +((NOT up) AND (StartValue < GetCtlMax(theControl)))) AND {to prevent tracking as the page up or down area disappears} +(originalPart = partCode) ,THEN BEGIN /IF up 2THEN 5amount := - 1 2ELSE 5amount := 1; {set the direction} /IF (partCode = inPageUp) OR (partCode = inPageDown) 2THEN BEGIN 5{change the movement to a full page} 5WITH MyViewRect DO 8IF theControl = vScroll ;THEN >amount := amount * (bottom - top) ;ELSE >amount := amount * (right - left) 2END; {of partCode} /SetCtlValue(theControl, StartValue + amount); /ScrollBits ,END &END; {of TrackScroll} {-----------------------------------------------------------------------------------} #PROCEDURE MyControls; {respond to a mouse down event in one of the controls} &VAR )dummy: INTEGER; )theControl: ControlHandle; &BEGIN {Get control and part.} )originalPart := FindControl(EventPoint, MyWindow, theControl); )IF originalPart = inThumb ,THEN BEGIN {Thumb is tracked until it is released; then the bits are scrolled.} /dummy := TrackControl(theControl, EventPoint, NIL); /ScrollBits ,END {of whichpart} {For the arrows and the page changes, scroll while the mouse is held down.} ,ELSE /dummy := TrackControl(theControl, EventPoint, @TrackScroll) &END; {of Mycontrols} {-----------------------------------------------------------------------------------} #PROCEDURE MainEventLoop; {Respond to menu selections, the scrollbars, and update events.} &VAR )myEvent: EventRecord; {All of the information about the event} )menuResult: LONGINT; {Information returned by MenuSelect} )theMenu, {Which menu was selected} )theItem: INTEGER; {Which item within the menu} )checked: BOOLEAN; {Is the menu item checked} )MarkChar: Char; {The checkmark character} )tempWindow: WindowPtr; )tempRect: Rect; &BEGIN )REPEAT ,checked := GetNextEvent(everyEvent, myEvent); {checked here is ignored} ,CASE myEvent.what OF /mouseDown: BEGIN {the user pressed or is holding the mouse button down} 2CASE FindWindow(myEvent.where, tempWindow) OF 5inMenuBar: BEGIN {the mouseDown was in the menu bar} 8menuResult := MenuSelect(myEvent.where); 8theMenu := HiWord(menuResult); 8theItem := LoWord(menuResult); 8CASE theMenu OF ;FileMenu: doneFlag := TRUE; { Quit } ;ScrollMenu: BEGIN {The items in the menu are used to keep track of the user has chosen thus far. These lines toggle the checkmark in the menu and leave the result in the variable checked.}  Chr(checkmark); Horizontal: BEGIN ?InvalRect(hScroll^^.contrlrect); ?IF checked @THEN BEGIN AShowControl(hScroll); AMyViewRect.bottom := hScroll^^.contrlrect.top @END {checked} @ELSE BEGIN {not checked} AHideControl(hScroll); AMyViewRect.bottom := hScroll^^.contrlrect.bottom @END {not checked} >END; {horizontal} >Vertical: BEGIN ?InvalRect(vScroll^^.contrlrect); ?IF checked @THEN BEGIN AShowControl(vScroll); AMyViewRect.right := vScroll^^.contrlrect.left @END {checked} @ELSE BEGIN {not checked} AHideControl(vScroll); AMyViewRect.right := vScroll^^.contrlrect.right @END {not checked} >END; {vertical} >TextItem: BEGIN {Since we have dereferenced the destrect, no calls in the scope of this WITH should cause a memory compaction.} ?showText := checked; ?IF checked @THEN AWITH hTE^^.destRect DO BEGIN Btop := - GetCtlValue(vScroll); Bleft := - GetCtlValue(hScroll); AEND {of checked} >END; {of textItem} ?graphicsItem: showGraphics := checked; =END; {of CASE} =IF showText >THEN hTE^^.viewrect := MyViewRect ;END {of inMenuBar} 8END; {of FindWindow CASE} 8HiliteMenu(0) 5END; {of mouseDown} 5inContent: {The rectangles making up the controls are the part of the window outside the view.} 8BEGIN 8EventPoint := myEvent.where; 8GlobalToLocal(EventPoint); 8IF NOT PtInRect(EventPoint, MyViewRect) ;THEN MyControls 5END {in Content} 2END {of CASE} /END; {of mouseDown} /updateEvent: {In response to InvalRects, the appropriate text or graphics is erased and redrawn. The BeginUpdate causes the VisRgn to be replaced by the intersection of the VisRgn and the UpdateRgn.} 2BEGIN 2BeginUpdate(MyWindow); 2EraseRect(MyViewRect); {start with a clean slate} 2IF showText 5THEN TEUpdate(MyWindow^.VisRgn^^.rgnbbox, hTE); {Call GrafUpdate with the intersection, if any, of the VisRgn and the view} 2IF showGraphics AND SectRect(MyWindow^.VisRgn^^.rgnbbox, 3MyViewRect, tempRect) 5THEN GrafUpdate(tempRect); 2EndUpdate(MyWindow) /END {of updateEvent} ,END {of event CASE} )UNTIL doneFlag &END; {------------------------------------------------------------------------------------} #BEGIN &InitGraf(@ThePort); {initialize QuickDraw} &InitWindows; {initialize Window Manager; clear desktop and menubar} &InitFonts; {initialize Font Manager} &FlushEvents(everyEvent, 0); {throw away any stray events} &TEInit; {initialize TextEdit} &InitMenus; {initialize Menu Manager} &hdlScrollMenu := GetMenu(FileMenu); {(hdlScrollMenu is ignored)} &InsertMenu(hdlScrollMenu, 0); &hdlScrollMenu := GetMenu(ScrollMenu); &InsertMenu(hdlScrollMenu, 0); &DrawMenuBar; &doneFlag := FALSE; {user 'Quit' flag} &MyWindow := GetNewWindow(256, NIL, Pointer( - 1)); {get window to work within} &SetPort(MyWindow); {point to window} &TextFont(applFont); {select default application font} &SetUpData; {initialize user data and controls} &InitCursor; {change the watch into an arrow} &MainEventLoop {handle events until we are through} #END. 3. "6F^9trD!$ǐ^!77s/`hFF̞̞N(̞̞88^ô̞88,FFF¸l,^ƴ3Example/Scroll.Rsrc * This is the resource file for Scroll, a simple program to demonstrate * the use of scroll bars. Type SCRL = STR ",256 Scroll by Cary Clark, Macintosh Technical Support V7/5 Apple, 1984 Type MENU ",1(4) "File $Quit ",2(4) "Scroll Bar $Horizontal $Vertical $(- $Text $Graphics * a document window Type WIND ",256(4) A Scrolling Example "40 20 339 480 "Invisible NoGoAway "0 "0 * the vertical scroll bar Type CNTL ",256(4) x "-1 445 285 461 "Visible "16 "0 "0 0 400 * the horizontal scroll bar ",257(4) x "284 -1 300 446 "Invisible "16 "0 "0 0 300 Type STR ,256(4) "Please refer to the Control Manager manual for more information about scroll bars. Type CODE "Example/ScrollL,0 3. "6F^5D!$ǐ^T* example/showpaintR -- Resource file example/showPaint.Rsrc Type CODE #example/showpaintl,0      ;O           './-0.1/2031423 8 97 :8 ;9 <: ;!?!@>!A?!@MNLOMPNQORPSQTRUS VT WU XV YW ZX[Y\Z][^\_]`^a_b`cadbecfdgefijhkiljmknlompnqo rp sq tr us vtwuxvywzx{y|z}{~|}~      !"#$%&'()*+,-./0      !"#$%&'()*+,-./0123456789:;<=>                                    ! " # $ % & ' ( ) * +  ,! -" .#! /$" 0%# 1&$ 2'% 3(& 4)' 5*( 6+) 7,* 8-+ 9., :/- ;0. <1/ =20 >31 ?42 @53 A64 B75 C86 D97 E8 ; <: =; >< ?= @> A? B@ CA DB EC FD GE HF IG JH KI LJ MK NL OM PN QO RP SQ TR US VT WU XV YW ZX [Y !\Z "][ #^\ $_] %`^ &a_ 'b` (ca )db *ec +fd ,ge -hf .ig /jh 0ki 1lj 2mk 3nl 4om 5pn 6qo 7rp 8sq 9tr :us ;vt ?@ABCDEFGHIJKLMNOPQRST U V  W  X  Y Z [\]^_`abcdefghijk l!m" n#!o$"p%#q&$r'%s(&t)'u*(v+)w,*x-+y.,z/-{0.|1/}20~31425364758697:8;9:=><?=@>A?B@CADBEC FD GE FIJHKILJMKNLOMPNQO RP SQ RUVTWUXVYWZX[Y\Z][ ^\ _] `^ a_ b`cadbecfdgefijhkijmnlompnqorpsqtrus vt wu xv yw zx{y|z}{~|}~      !"#