-not a Macintosh disk-DPi`KJDBH@%L)[hNP"N,L 8!"@$|Gn"`I N.@A,H<( F<B<H111.Bx<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 _!@"|xEz En"`CE"|xN"Ҹ< A  33"|@E E4n"`C&E"|@.N _LHNFLN*8&E@<<'CJJKK f`  f `><$CS*<FF4>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/A lNNu _.NHL$ 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 H>8$O&j.(j4,*8:*,BB6*2SCCn`8CL0@D@04"F K0HEY@2< Vb,g`aJaBVgbHE6SCCo`p`HE4RBCo8B@ j(0 j$L| _pN am znNu _"_$_$0H2< @`Q`BQBNNV;n *N^.NuEVINIT NVH,. ^J]g n0`4B?N. f n0`/.//. /.N6(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?-,N.H|)?NN^ _TONRAP NV.HgVS@g`J.f& -`мS//<N/<NB+_`-m` . ѭ` -`o<Np`B . \J.f/-\/<N4/<N+_\-m\ -\l<N,N^ _PONGETSPACNV .мS//<N/<N-_ .=@ N^.NuINDSPARNVH.. Bg/N0Hހ m0.@I/./<N 8//<Np @n ?.Bg?<BgNLN^ _ NETMMU NVH+| d+|l+|(+||+|+|t+|(|;TV(|;T|(|.;Tz&| n!SLN^.NuETVARS NVH/Nt;| .䐼/+@ .м/м+@+|`*<(< E"D +@\&|?-|0-VS?NHnHmJNJngp+@JBBg/-BgNz+_ -Э+@XBB<0<H/BgNPN+_P+mPBG` m @I G~V GTVgd Gl|p@ @8`$ Gf|p@BT`| p@BT H< @"@=A?.??<BgNRG Gox mI|p@BT mIP|p@/-P/<N* 8LN^NuOOTINITNVH(nB BgNBgNHH,BgN0HѬ f,/, N"BgNBgNHH,BgN0HѬ f,/, NBgNrBgNjHH,BgN0HѬ f:Jf< N/, NBgN2BgN*HH,BgNb0HѬ g<NLBN,BN+_ n/BN|  _r Ё0p//-`N/-/-`N&m`:=E E0o<N0<H+@l+| -lЭd n2HҀ -Ё"-Ҁ(Bg Э/N0Hѭ -Є+@B</-BgN+_+mh -dЭh+@p -lЭp, n0HІ+@ -Э+@ -Э+@?<f/-/-?<Nb-m/ /./-N n LN^ _ NUILD_SYNVH(nBGBF. gB `P-n n0. PoB."` n0. A-H&n/+/<N  n0>+<+/, NBgN<BgN4HH-@BgNj0H(٬ JVJ_gB."`4JGW WJGV WgJFf n `H n n/B."n/BgN2  _ BNB-_JGf n Q/ n P/Nr` Q@H/ n P/NZ|B. n=h-nA-H n-P/./.p/N JGgR-mBg n/( n r Ё/ n P/ nP/ | ? Q@?N9_Jlg< N, nQ f|"LN^ _NOADSEG NVHBBg/-tBgN+_x -x"-Ҁ+At(|`p}//<Nn -Пx((|p}//<NN -Пx(?<}/-x/-t?<N&|BSLN^.NuLLOC_SCNVHAC 0BgHnNz_m+m-gBBg/-BgNP+_`+m-gBBg/<BgN, м,BgBgBHnBgHnHnBg/.N g<NACD 0BgHnN  g B-n`.BgBgBHnBgHnHnBg/.Nx g<Nf .@+@ -Э+@` B -@+@ -м@+@?</-/-?<N@ <逐.JfB` .ЇP-@JfB` .ЇP-@-g -Ї/ -Ї//./.N`/-/-BBN(|p((|t(LN^.NuOAD_DEB SYSTEM.DEBUG2 SYSTEM.DEBUGNVH nCJp"S@n2&n (nBBgHnN dgZB /, N NBgN BgN HH(BgN0H* f&.B</BgN&B /, N //NlLN^ _ NOAD_UNPNVBgBgBHn</. /.Bg/.N g<NN^ _ NOAD_LLDNVH(n 0-N|>Jg,, .* Ю(H//<N( Д-@`,.(.H//<N-_?//?<N. .P/NdLN^ _NNSTALL_NVH(n=n ~`/, N BgN p_BgN fHH(BgN 0H-@Jg .Ѭ `<N~ .fBN (BN ( GfAB0pB5pB`ACZ 0z`BgN _ .ARE EoHn?<?<HnNAC 0HnHzNg(AB0pp @AB @AB`2HnHzNPgAB0pB5pB`App| 5pgnBg?/.Hn @AHp @AHp</.NX g<NF?. @A/0 @A"0Ҽ/?<NHRGinoLLN^ _ NOADCODEkrni NVBBg/-BgN+_?<e/-/-?<NN^.NuAKESUPSNVH(m . R A T&@-kLN^ _ NINDMAINNVBg/-NF0HѭB</-BgNx+_?<g/-/-?<N\Bg/-|N 0Hѭ|B</-|BgN>+_?<{/-/-|?<N"N^.NuLLOC_OPNV A0C ArC 0AC 0/NLHnHm/NFBgHn0N g< NHnHn/NBgHnrN g<N^/NZBg/.Hn$/N;_N/./.Hm/N-UgNj/.$?-N/N@/N2 n /B/.$0-NH//NR  _ /NBNj+_N^ _PONOADSYS $ SYSTEM.UNPACK SYSTEM.OS SYSTEM.LLDN :NV,_NUvN ,+|v mv PVD@UNHmHmNHm?- -|Э//-NzNZN N]N NuN^NuOADER NVHAv(HA^&HHn?-.0-0H".Ҁ// / NrJng<NLN^.NuEAD_PAGNV0.HBH"-DҀ-A0.HBH@J@=@/.NvAv0.HЈ-@ N^ _TONIND_SENNVBH nCJp"S@n2 n BBgA/A/Nz-m2Av(H&L U.=m6B|`A^-HHAv(BE`:HnN?-.0-0H".ҀH҅///.HNhؼJnNg<NRE Eom6l^Bn So4 X/ U/0S@?A/?<$Hn/. N n gRn G0.D@@20HҌ-A n-P`/ /?A/?<$Hn/. NRFinBo$ n g< G0.D@@20HҌ-A/.HnP?<NN n/B?.vN4  _ LN^ _ ND_SEARCNVH n-h .S/0-:H/N ;@Z-n p+@V;m:\BF` AvIBBlRF Fo=mHnNBgHn?->N>H/p6/NNZBp6/A/NACp S@n0HnN^J.gHHnHnN .Wgz n/B?.N  _ `SFRGm>fBGBNJFfELN^ _PONOOKUP_ENVH.<A"G";n .;m.,?.?-.N;n0BN&Av(HJg<NH;l~:+lD;lB;l>;l@;l<;T8;l26+l.2 2f<N m8lB?,N&_+SH+kL+kPLN^.NuNITMEDINV m8lBg/.HnN2_`/.HnHnNn .gB/.N-_N^.NuPENINPUNVH(.BGBF Go<NR Av:0JEf<N8 EHl@ AvH"Ұ n n Jf<NHH " n ``RGE`LN^ _ NIND_POSNV-mV/.0-:H/N+_VJV]2-ZHV]g<N0-:H/-V/N2 .;@\ -Vg/-VHnHnN/.N"N^.NuILLBUF NV0-\m:f -VR2-:H//NNT0-\AvpRm\N^NuETBYTE NVHBgNHH<BgNH>JGl H м> G=@LN^NuETWORD NVHBgN0H//<ND,BgN0H.Jl޼ Ї-@LN^NuETLONG NVH,. 0-:m\>HǼl>JGo0-\AvA//.H/NH߮Hǜm\0-:HnJV]2-ZHV]g<N -VR/HnHnNn-nA^(H/0-:H/N*l-EJoZHn?-.0-0H".Ҁ/?././ NjJng<N~0-:H/./N(ٮ .Ѯ .ѭV`:Jo -VR2-:H//NNhJfLN^ _PONOVEMULTNVH(n0,k @nH0;N *6BN\BgHlN_`n/,N`dBgN_`XBgN9_`LBN)_`@/,/,N:`2&l.,/ ?-.0-0H", Ҁ/?,/ /NP`<NhLN^.NuRIVER_C//0/2/ AH@B@2/Ё/@" /WXNuNV// /"/N:/A" N^/WXNuNV// /"/N/@" N^/WXNuH>*jD,jD$HBJBf6B@H@g4HB04"B@H@`$&BBxԂрҁmRQJjDjDL|NuNuNuJoNu$_0 _"_J @o4$ Tg,2ABAgSBgS@2@ISA QS@kQN$_0 _"_J`!QN$_02 _`QNHBB oJ0/2/gk gRBSAn` R gSBRAk?B/oL\NuHBB oJ0/2/gk fRBSAn` R fSBRAk?B/oL\NuHr`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\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`QNuG5TK5̆V{t̆^H :a$kTfk:)$ "#." #"##%& !  M Q U  [_cD X, 8! "$F.1 .1m$*Ask.TEXTLLo$*AskDir.TEXTLםL $*Install.TEXTLYZ$*Other Files.TEXTN]3]E.8$MRECIPES.TEXT KC$MSAMDIALOG.TEXT-y$MSAMPLE.TEXTAA$MTWOTEXT.TEXTFnI$PRECIPES.TEXT / $PSAMDIALOG.TEXT1-y$PSAMPLE.TEXT&H#$PTWOTEXT.TEXTZ H $UFIXUTEXT.OBJJJ$URECIPES.TEXT k=TDD$URECIPES2.TEXT pT$USAMDIALOG.TEXTT_T $USAMDIALOG2.TEXTMTXX$USAMPLE.TEXT&Tx$USAMPLE2.TEXT&Tލ,,$UTWOTEXT.TEXT~殝T$UTWOTEXT2.TEXTqʜq88$XRECIPES.TEXT KC$XSAMDIALOG.TEXT-zH.$XSAMPLE.TEXTGH$XTWOTEXT.TEXTK+b$XTWOTEXT.TEXTK+b$XTWOTEXT.TEXTK+b*{(${T11}PHRASEsX)*(jj@NNNNNNN*Other Files.TEXTTEXTt.TEXT~]V]3]ENV n  M *Ask.TEXTTEXT. . ̎]WLLoNV n  Q *AskDir.TEXTTEXT. . ̎]XLםLNV n  U *Install.TEXTTEXT. . ̎]YLYZNV n  [ MRECIPES.TEXTTEXT. . ̎]Z蝨KCNV n  _ URECIPES.TEXTTEXTxSn`N^ _PONН][k=TNV n " c"URECIPES2.TEXTTEXTSn`N^ _PONН]\pTNV n   PRECIPES.TEXTTEXT. . ̎]]/NV n   XRECIPES.TEXTTEXT. . ̎]^ǝKCNV n   UFIXUTEXT.OBJ.OBJ. . ̎]_JJNV n   MSAMDIALOG.TEXTTEXT. . ̎]`ѝ-yNV n  USAMDIALOG.TEXTTEXTn`N^ _PONН]aT_֝T NV n   USAMDIALOG2.TEXTTEXT`N^ _PONН]bM۝TNV n , ,PSAMDIALOG.TEXTTEXT. . ̎]c1ߝ-yNV n  XSAMDIALOG.TEXTTEXT. . ̎]d-zH.NV n   MSAMPLE.TEXTTEXT. . ̎]eA蜵ANV n   USAMPLE.TEXTTEXTxSn`N^ _PONН]f&TxUNV n   USAMPLE2.TEXTTEXTxSn`N^ _PONН]g&TލTNV n   PSAMPLE.TEXTTEXT. . ̎]h&H#NV n   XSAMPLE.TEXTTEXT. . ̎]iGHNV n   MTWOTEXT.TEXTTEXT. . ̎]jFnINV n   UTWOTEXT.TEXTTEXTxSn`N^ _PONН]k~殝TNV n  UTWOTEXT2.TEXTTEXTSn`N^ _PONН]lqʝ qNV n   PTWOTEXT.TEXTTEXT. . ̎]mZ HNV n   XTWOTEXT.TEXTTEXT. . ̎]nK+bNV n  *install..TEXT..TEXT NV n  *install..TEXT..TEXT NV n  EXEC(sample) SET sample TO UPPERCASE(sample) IF sample='RECIPES' THEN $RETURN 'UFIXUTEXT.OBJ' ENDIF IF sample='TWOTEXT' THEN $RETURN 'UFIXUTEXT.OBJ' ENDIF RETURN '' ENDEXEC 3. "6F^9EXD!$ǐ^lLne default answer. (b+pJ̫̑xv̐pJ@̫̫̐p(bEXEC(prompt,default,ln,temp) ${ Ask the user the yes/no question, prompt, giving default as the default answer. &Returns 'Y' or 'N'. } SET default TO COPY(UPPERCASE(default),1,1) IF (default <> 'Y') AND (default <> 'N') THEN $SET default TO '' ENDIF SET ln TO '' WHILE ln = '' DO $IF default <> '' THEN (SET temp TO CONCAT(' [', default, ']') $ELSE (SET temp TO '' $ENDIF $SET temp TO "[prompt] (Y or N)[temp] " $REQUEST ln WITH temp $SET ln TO TRIMBLANKS(ln) $IF ln = '' THEN (SET ln to default $ENDIF $SET ln TO UPPERCASE(ln) $IF (ln <> 'Y') AND (ln <> 'N') THEN (SET ln TO '' $ENDIF ENDWHILE RETURN ln ENDEXEC 3. "6F^9n)D!$ǐ^  nL-' THEN (SET ln TO "[ln]-" $ELSEIF (ln = '#PREFIX') OR (ln = '-#PREFIX') THEN (SET ln TO '' $ELSEIF(f.}pJ̫̑xv̐pJ@̫̫̐pSE ,S(f.}pJ̑R̢P̑xv̐FFFpp̫.FPFP\̑N̐ÆFFxpJ@̫-̫ĀZ̢PxFPF̑N̫̐FFxFF.@ppJŊ̫-̫EXEC(prompt,ln,temp,default) ({ Given a prompt such as 'Enter directory to which to copy sources', this ,exec file returns a directory as '--' or '' (means the prefix volume); ,the that is entered is used as the default the next time this is run. } ${ Set up the prompt string & default (if any) } RESET COMMBUFR, 'TK Install' READLN (COMMBUFR) default IF (default <> '') AND (default <> 'EOF') THEN $SET temp TO CONCAT('[', default, ']') ELSE $SET temp TO '[prefix volume]' $SET default TO '' ENDIF SET prompt TO "[prompt] [temp] " WHILE TRUE DO $REQUEST ln WITH prompt $SET ln TO UPPERCASE(TRIMBLANKS(ln)) ({ Put the input into the proper form } $IF (ln = '#PREFIX') OR (ln = '-#PREFIX') THEN (SET ln TO '' $ELSEIF COPY(ln,1,1)='-' THEN (SET ln TO "[ln]-" $ELSEIF ln = '' THEN (IF default <> '' THEN ,SET ln TO "-[default]-" (ELSE ,SET ln TO '' (ENDIF $ELSE (SET ln TO "-[ln]-" $ENDIF +{ ln now is of the form '--' or ''} $IF temp = '' THEN (RETURN temp $ENDIF $SET temp TO COPY(ln,1,Length(ln)-1) $IF Exists(temp) THEN (REWRITE COMMBUFR, 'TK Install' (WRITELN (COMMBUFR) COPY(ln,2,Length(ln)-2) (RETURN ln $ENDIF $WRITELN "The directory '[temp]' does not exist." ENDWHILE ENDEXEC 3. "6F^9DED!$ǐ^ $$BYY̛R6 TD$EXEC(sample,dir,others) $ $CLEAR SCREEN $ F{} $ $ { Ask about each sample program on the diskette } $RESETCAT '-LOWER-X=.TEXT' $REPEAT $$WRITELN $$SET sample TO UPPERCASE(NEXTFILE) $$IF sample <> '' THEN ($SET sample TO COPY(sample,2,POS('.',sample)-2) ($IF <-LOWER-*Ask(Do you want to install U[sample]?,Y) = 'Y' THEN ,$SET dir TO <-LOWER-*AskDir(Where do you want to put U[sample]?) ,B{}-LOWER-M[sample].TEXT,[dir]$ ,B{}-LOWER-U[sample]=.TEXT,[dir]$ ,Y{} ,B{}-LOWER-P[sample].TEXT,[dir]$ ,B{}-LOWER-X[sample].TEXT,[dir]$ ,$ ,$SET others TO <-LOWER-*Other Files([sample]) ,$IF others <> '' THEN 0B{}-LOWER-[others],[dir]$ 0$IF POS('=',others) <> '0' THEN 4Y 0$ENDIF ,$ENDIF ($ENDIF $$ENDIF $UNTIL sample = '' $ Q{} $ $DOIT $WriteLn 'Installation Completed.' $ENDEXEC 3. "6F^9. D!$ǐ^ ! !eKCdon't change the opening rectangle 3. "6F^PROGRAM MRecipes; USES ${$U UObject } UObject, ${$U QuickDraw } QuickDraw, ${$U UDraw } UDraw, ${$U UABC } UABC, ${$U UUnivText } UTKUniversalText, ${$U UText } UText, ${$U UFixUText } UFixUText, ${$U UDialog } UDialog, ${$U URecipes } URecipes; CONST $phraseVersion = 1; BEGIN $process := TMyProcess.CREATE; $process.Commence(phraseVersion); $process.Run; $process.Complete(TRUE); END. 3. "6F^9WiD!$ǐ^ j,,OT BOOLEAN; OVERRIDE; (FUNCTION TMyWindow.NewCommand(cmdNumber: TCmdNumber): TCommand; OVERRIDE; (PROCEDURE TMyWindow.PerformLast(cmdPhase: TCmdPhase); OVERRIDE; (END; IMPLEMENTATION "{$I URecipes2.text} END. ${Sample Program demonstrating the Text Building Block} ${Copyright 1984, Apple Computer Inc.} UNIT URecipes; {Yes! It's a cook book!} INTERFACE USES ${$U UObject} UObject, ${$U QuickDraw} QuickDraw, ${$U UDraw} UDraw, ${$U UABC} UABC, ${$U UUnivText} UTKUniversalText, {Must use this even if you're not dealing with Universal Text} ${$U UText} UText, ${$U UDialog} UDialog; {$SETC debugMe := fDBGOK } CONST {Menu and phrase numbers; must match corresponding entry in PRecipes} (cmdRefresh = 3000; (uOneColumn = 3001; (uTwoColumn = 3002; (uTraceRecipe = 3003; (uAddRecipe = 3004; (uDeleteRecipe = 3005; (uAddIngred = 3006; (uInsIngred = 3007; (uDeleteIngred = 3008; (uRecipeDialog = 3009; (uDrawRects = 3010; (uCopyRecipe = 3020; (uPasteRecipe = 3021; (phTypeIn = 4001; TYPE $TFoodTypes = (mainCourse, soup, appetizer, sandwich, dessert, noFood); <{**************************************} <{******** SUBCLASSES ***********} <{**************************************} $TRecipe = SUBCLASS OF TObject (name: TString; {The recipe name (ex: "Brownies")} (ingredients: TList; {of TString: one string per ingredient description} (directions: TList; {of TParagraph: a multi-paragraph explanation how to prepare the recipe} &{Creation} (FUNCTION TRecipe.CREATE(object: TObject; heap: THeap; itsName: TString; itsIngredients: TList; hitsDirections: TList): TRecipe; (PROCEDURE TRecipe.Free; OVERRIDE; (FUNCTION TRecipe.Clone(heap: THeap): TObject; OVERRIDE; ({$IFC fDebugMethods} (PROCEDURE TRecipe.Fields(PROCEDURE Field(nameAndType: S255)); OVERRIDE; ({$ENDC} (FUNCTION TRecipe.MakeIntoImage(itsView: TView): TRecipeImage; (END; {A displayable version of TRecipe; only one of these exists at a time since only one recipe is displayed at a time} $TRecipeImage = SUBCLASS OF TImage (name: TTextImage; (ingredients: TList; {of TTextImage} (twoColumn: BOOLEAN; {TRUE => two column directions; one column otherwise (NOT IMPLEMENTED)} (directions: TTextImage; (changed: BOOLEAN; {checked before copying to the clipboard} &{Creation} (FUNCTION TRecipeImage.CREATE(object: TObject; heap: THeap; itsView: TView; nameImage: TTextImage; DingredList: TList; direcImage: TTextImage): TRecipeImage; (PROCEDURE TRecipeImage.Free; OVERRIDE; ({$IFC fDebugMethods} (PROCEDURE TRecipeImage.Fields(PROCEDURE Field(nameAndType: S255)); OVERRIDE; ({$ENDC} (FUNCTION TRecipeImage.CursorAt(mouseLPt: LPoint): TCursorNumber; OVERRIDE; (FUNCTION TRecipeImage.DismantleImage: TRecipe; (PROCEDURE TRecipeImage.Draw; OVERRIDE; (FUNCTION TRecipeImage.ImageAt(mouseLPt: LPoint; VAR ingredIndex: LONGINT): TTextImage; (PROCEDURE TRecipeImage.MousePress(mouseLPt: LPoint); OVERRIDE; (END; {This is the view of the upper left panel, the chapter titles display} $TCookBookView = SUBCLASS OF TView &{Variables} ({This sample program has a fixed list of chapter titles. The reader may wish to make this more )flexible by allowing a variable number of custom chapter titles} (headings: ARRAY [mainCourse..dessert] OF TList; {array of lists of recipes} &{Creation} (FUNCTION TCookBookView.CREATE(object: TObject; heap: THeap; itsPanel: TPanel; `itsExtent: LRect): TCookBookView; ({$IFC fDebugMethods} (PROCEDURE TCookBookView.Fields(PROCEDURE Field(nameAndType: S255)); OVERRIDE; ({$ENDC} &{Display} (PROCEDURE TCookBookView.Draw; OVERRIDE; &{Mousing} (PROCEDURE TCookBookView.MousePress(mouseLPt: LPoint); OVERRIDE; (END; {This is the view of the lower left panel, the recipe titles display} $TChapterView = SUBCLASS OF TView &{Variables} (foodType: TFoodType; {the foodType of the current displayed chapter} (recipes: TList; {of TRecipe; the recipes in this chapter} (editImage: TTextImage; {Used when one is editing a recipe title} &{Creation} (FUNCTION TChapterView.CREATE(object: TObject; heap: THeap; itsPanel: TPanel; `itsExtent: LRect): TChapterView; ({$IFC fDebugMethods} (PROCEDURE TChapterView.Fields(PROCEDURE Field(nameAndType: S255)); OVERRIDE; ({$ENDC} &{Display} (PROCEDURE TChapterView.ChangeFood(food: TFoodTypes); (FUNCTION TChapterView.CursorAt(mouseLPt: LPoint): TCursorNumber; OVERRIDE; (PROCEDURE TChapterView.Draw; OVERRIDE; &{Mousing} (PROCEDURE TChapterView.MousePress(mouseLPt: LPoint); OVERRIDE; (FUNCTION TChapterView.NewRecipe(recipeName: STR255): TRecipe; (END; {This is the view of the right panel, the display of the selected recipe} $TRecipeView = SUBCLASS OF TView (recipeImage: TRecipeImage; {currently displayed recipe} (canEdit: BOOLEAN; {TRUE => this recipe is editable (ALWAYS TRUE IN SAMPLE)} &{Creation} (FUNCTION TRecipeView.CREATE(object: TObject; heap: THeap; itsPanel: TPanel; `itsExtent: LRect): TRecipeView; ({$IFC fDebugMethods} (PROCEDURE TRecipeView.Fields(PROCEDURE Field(nameAndType: S255)); OVERRIDE; ({$ENDC} &{Display} (PROCEDURE TRecipeView.ChangeRecipe(recipe: TRecipe); (FUNCTION TRecipeView.CreateSecondTxtImg: TTextImage; (FUNCTION TRecipeView.CursorAt(mouseLPt: LPoint): TCursorNumber; OVERRIDE; (PROCEDURE TRecipeView.Draw; OVERRIDE; (PROCEDURE TRecipeView.FreeRecipeImage; (PROCEDURE TRecipeView.ScrollStuff(ingredIndex: LONGINT; moveDown: BOOLEAN); &{Mousing} (PROCEDURE TRecipeView.MousePress(mouseLPt: LPoint); OVERRIDE; (END; {TRecipeClipView and TClipSelection are used when a recipe is copied to the clipboard} $TRecipeClipView = SUBCLASS OF TView (foodtype: TFoodType; (recipe: TRecipe; &{Creation} (FUNCTION TRecipeClipView.CREATE(object: TObject; heap: THeap; itsPanel: TPanel; itsExtent: LRect; PitsFoodType: TFoodType; itsRecipe: TRecipe): TRecipeClipView; &{Display} (PROCEDURE TRecipeClipView.Draw; OVERRIDE; (END; $TClipSelection = SUBCLASS OF TSelection &{Creation} (FUNCTION TClipSelection.CREATE(object: TObject; heap: THeap; itsView: TView): TClipSelection; 'END; {This selection is created when one clicks on a chapter title in the cookBookView} $TBookSelection = SUBCLASS OF TSelection &{Variables} (currFood: TFoodTypes; &{Creation} (FUNCTION TBookSelection.CREATE(object: TObject; heap: THeap; itsView: TView; GitsAnchorLPt: LPoint; whatFood: TFoodTypes): TBookSelection; ({$IFC fDebugMethods} (PROCEDURE TBookSelection.Fields(PROCEDURE Field(nameAndType: S255)); OVERRIDE; ({$ENDC} &{Display} (PROCEDURE TBookSelection.Deselect; OVERRIDE; (PROCEDURE TBookSelection.Highlight(highTransit: THighTransit); OVERRIDE; 'END; {This is a general selection class for anyone who wants to use text selections as coSelections of their main selection. The coSelection mechanism is the only way to override some of the Text Building Blocks text selection behaviour since text selections cannot be subclassed. There are numerous examples of text selection overrides in this sample program. TTextCoverSelection's main purpose in this example is to intercept calls to CanDoCommand to restrict the typeStyles one can choose.} $TTextCoverSelection = SUBCLASS OF TSelection &{Variables} &{Creation} (FUNCTION TTextCoverSelection.CREATE(object: TObject; heap: THeap; itsView: TView; XitsAnchorLPt: LPoint): TTextCoverSelection; (FUNCTION TTextCoverSelection.CanDoCommand(cmdNumber: TCmdNumber; VAR checkIt: BOOLEAN): BOOLEAN; ,OVERRIDE; 'END; {This selection is created when one clicks on a recipe title in the chapterView. It is a subclass of TTextCoverSelection because, if the user clicks twice on a recipe title, she is allowed to edit it} $TChapSelection = SUBCLASS OF TTextCoverSelection &{Variables} (recipeIndex: INTEGER; &{Creation} (FUNCTION TChapSelection.CREATE(object: TObject; heap: THeap; itsView: TView; XitsAnchorLPt: LPoint): TChapSelection; (PROCEDURE TChapSelection.Free; OVERRIDE; (FUNCTION TChapSelection.Clone(heap: THeap): TObject; OVERRIDE; ({$IFC fDebugMethods} (PROCEDURE TChapSelection.Fields(PROCEDURE Field(nameAndType: S255)); OVERRIDE; ({$ENDC} (PROCEDURE TChapSelection.AddRecipe(recipeName: STR255); (PROCEDURE TChapSelection.KeyReturn; OVERRIDE; (FUNCTION TChapSelection.NewCommand(cmdNumber: TCmdNumber): TCommand; OVERRIDE; &{Display} (PROCEDURE TChapSelection.Deselect; OVERRIDE; (PROCEDURE TChapSelection.Highlight(highTransit: THighTransit); OVERRIDE; 'END; {This selection is created when one clicks on a recipe title in the recipeView} $TNameSelection = SUBCLASS OF TTextCoverSelection &{Creation} (FUNCTION TNameSelection.CREATE(object: TObject; heap: THeap; itsView: TView; XitsAnchorLPt: LPoint): TNameSelection; (PROCEDURE TNameSelection.KeyReturn; OVERRIDE; 'END; {This selection is created when one clicks on an ingredient in the recipeView} $TIngredSelection = SUBCLASS OF TTextCoverSelection &{Variables} (ingredients: TList; {list of ingredient text images} (ingredIndex: INTEGER; {Index into recipeImage.ingredients} &{Creation} (FUNCTION TIngredSelection.CREATE(object: TObject; heap: THeap; itsView: TView; XitsAnchorLPt: LPoint; itsIngredients: TList; Xindex: INTEGER): TIngredSelection; ({$IFC fDebugMethods} (PROCEDURE TIngredSelection.Fields(PROCEDURE Field(nameAndType: S255)); OVERRIDE; ({$ENDC} (FUNCTION TIngredSelection.CanDoCommand(cmdNumber: TCmdNumber; VAR checkIt: BOOLEAN) K: BOOLEAN; OVERRIDE; (PROCEDURE TIngredSelection.KeyReturn; OVERRIDE; (PROCEDURE TIngredSelection.KeyTab(fBackward: BOOLEAN); OVERRIDE; (FUNCTION TIngredSelection.NewCommand(cmdNumber: TCmdNumber): TCommand; OVERRIDE; 'END; {This selection is created when one clicks in the directions in the recipeView} $TDirecSelection = SUBCLASS OF TTextCoverSelection &{Variables} &{Creation} (FUNCTION TDirecSelection.CREATE(object: TObject; heap: THeap; itsView: TView; XitsAnchorLPt: LPoint): TDirecSelection; (FUNCTION TDirecSelection.CanDoCommand(cmdNumber: TCmdNumber; VAR checkIt: BOOLEAN): BOOLEAN; OVERRIDE; (END; {These two subclasses wre here so we can do some tricks as described in the implementation} $TChapTextImage = SUBCLASS OF TTextImage (refCount: INTEGER; (FUNCTION TChapTextImage.CREATE(object: TObject; heap: THeap; itsView: TView; DitsLRect: LRect; itsText: TText; isGrowable: BOOLEAN): TChapTextImage; ({$IFC fDebugMethods} (PROCEDURE TChapTextImage.Fields(PROCEDURE Field(nameAndType: S255)); OVERRIDE; ({$ENDC} (PROCEDURE TChapTextImage.ChangeRefCountBy(delta: INTEGER); (PROCEDURE TChapTextImage.FilterAndDo( 8actualObj: TObject; PROCEDURE DoToObject(filteredObj: TObject)); OVERRIDE; (FUNCTION TChapTextImage.NewParaImage(itsParagraph: TEditPara; itsLRect: LRect; DlineTop: LONGINT; lineLeft: LONGINT): TParaImage; OVERRIDE; (END; $TChapParaImage = SUBCLASS OF TParaImage (FUNCTION TChapParaImage.CREATE(object: TObject; heap: THeap; itsView: TView; itsParagraph: TEditPara; ?itsLRect: LRect; lineTop: LONGINT; lineLeft: LONGINT): TChapParaImage; (PROCEDURE TChapParaImage.FilterAndDo( 8actualObj: TObject; PROCEDURE DoToObject(filteredObj: TObject)); OVERRIDE; (END; {************************************* COMMANDS **********************************************} {NOTE: Some of these commands are not fully implemented} $TAddIngredCmd = SUBCLASS OF TCommand (ingredients: TList; (ingredIndex: INTEGER; (FUNCTION TAddIngredCmd.CREATE(object: TObject; heap: THeap; itsImage: TImage; cmdNumber: TCmdNumber; SitsIngredients: TList; itsIndex: INTEGER): TAddIngredCmd; ({$IFC fDebugMethods} (PROCEDURE TAddIngredCmd.Fields(PROCEDURE Field(nameAndType: S255)); OVERRIDE; ({$ENDC} (PROCEDURE TAddIngredCmd.Perform(cmdPhase: TCmdPhase); OVERRIDE; (END; $TDelIngredCmd = SUBCLASS OF TCommand (ingredients: TList; (ingredIndex: INTEGER; (ingredSelection: TIngredSelection; (saveTextImage: TTextImage; (FUNCTION TDelIngredCmd.CREATE(object: TObject; heap: THeap; itsImage: TImage; PitsSelection: TIngredSelection; PitsIngredients: TList; itsIndex: INTEGER): TDelIngredCmd; ({$IFC fDebugMethods} (PROCEDURE TDelIngredCmd.Fields(PROCEDURE Field(nameAndType: S255)); OVERRIDE; ({$ENDC} (PROCEDURE TDelIngredCmd.Commit; OVERRIDE; (PROCEDURE TDelIngredCmd.Perform(cmdPhase: TCmdPhase); OVERRIDE; (END; $TDelRecipeCmd = SUBCLASS OF TCommand (recipeIndex: INTEGER; (FUNCTION TDelRecipeCmd.CREATE(object: TObject; heap: THeap; itsImage: TImage; hitsIndex: INTEGER): TDelRecipeCmd; ({$IFC fDebugMethods} (PROCEDURE TDelRecipeCmd.Fields(PROCEDURE Field(nameAndType: S255)); OVERRIDE; ({$ENDC} (PROCEDURE TDelRecipeCmd.Commit; OVERRIDE; (PROCEDURE TDelRecipeCmd.Perform(cmdPhase: TCmdPhase); OVERRIDE; (END; $TCopyRecipeCmd = SUBCLASS OF TCutCopyCommand (recipeIndex: INTEGER; (FUNCTION TCopyRecipeCmd.CREATE(object: TObject; heap: THeap; HitsImage: TImage; itsIndex: INTEGER): TCopyRecipeCmd; ({$IFC fDebugMethods} (PROCEDURE TCopyRecipeCmd.Fields(PROCEDURE Field(nameAndType: S255)); OVERRIDE; ({$ENDC} (PROCEDURE TCopyRecipeCmd.DoCutCopy(clipSelection: TSelection; deleteOriginal: BOOLEAN; IcmdPhase: TCmdPhase); OVERRIDE; (END; $TPasteRecipeCmd = SUBCLASS OF TPasteCommand (FUNCTION TPasteRecipeCmd.CREATE(object: TObject; heap: THeap; itsImage: TImage): TPasteRecipeCmd; (PROCEDURE TPasteRecipeCmd.DoPaste(clipSelection: TSelection; Ppic: PicHandle; cmdPhase: TCmdPhase); OVERRIDE; (END; {Subclasses that are always required so that we operate in the application's environment rather than the ToolKit's generic environment} $TMyProcess = SUBCLASS OF TProcess &{Creation/Destruction} (FUNCTION TMyProcess.CREATE: TMyProcess; (PROCEDURE TMyProcess.Commence(phraseVersion: INTEGER); OVERRIDE; (FUNCTION TMyProcess.NewDocManager(volumePrefix: TFilePath; openAsTool: BOOLEAN) G: TDocManager; OVERRIDE; (END; $TMyDocManager = SUBCLASS OF TDocManager &{Creation/Destruction} (FUNCTION TMyDocManager.CREATE(object: TObject; heap: THeap; itsPathPrefix: TFilePath): TMyDocManager; (FUNCTION TMyDocManager.NewWindow(heap: THeap; wmgrID: TWindowID): TWindow; OVERRIDE; (END; $TMyWindow = SUBCLASS OF TWindow &{Variables} (styleSheet: TStyleSheet; (cookBookPanel: TPanel; (chapterPanel: TPanel; (recipePanel: TPanel; (dialogWindow: TDialogWindow; (dialog: TDialog; (inputFrame: TInputFrame; (okayToHilite: BOOLEAN; {kludge described in implementation of PerformLast} &{Creation/Destruction} (FUNCTION TMyWindow.CREATE(object: TObject; heap: THeap; itsWmgrID: TWindowID): TMyWindow; ({$IFC fDebugMethods} (PROCEDURE TMyWindow.Fields(PROCEDURE Field(nameAndType: S255)); OVERRIDE; ({$ENDC} &{Document Creation} (PROCEDURE TMyWindow.BlankStationery; OVERRIDE; &{Commands} (FUNCTION TMyWindow.CanDoCommand(cmdNumber: TCmdNumber; VAR checkIt: BOOLEAN): BOOLEAN; OVERRIDE; (FUNCTION TMyWindow.NewCommand(cmdNumber: TCmdNumber): TCommand; OVERRIDE; (PROCEDURE TMyWindow.PerformLast(cmdPhase: TCmdPhase); OVERRIDE; (END; IMPLEMENTATION "{$I URecipes2.text} END. 3. "6F^9BOD!$ǐ^--n/ with Undo. ELF.NewCommand(cmdNumber); ,END; ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TMyWindow(pJ̭̑v̑XpJ@̑X̭̭pNDC} (;This is a sample phrase file for ToolKit applications ;NOTE: The wording of the alerts may not conform to the standards of the ; first release applications 1 3 2300 $-#BOOT-TK/PABC ; Apple building block phrase files can be included here 1000 Cook Book ; Other application alerts can be included here, numbered between 1001 and 32000 4001 Type in the new Recipe name:@50,50 4002 caution cancel alert Are you sure that you want to delete the "^1" recipe?^L^L NOTE: If you click OK you will not be able to change your mind, even with Undo. 0 1 File/Print Set Aside Everything#101 Set Aside#102 - Save & Put Away#103 Save & Continue#107 Revert to Previous Version#108 - Format for Printer ...#104 Print ...#105 Monitor the Printer ...#106 2 $-#BOOT-TK/PABC~Edit - Copy Recipe#3020 Paste Recipe#3021 3 Cook Book Add Recipe ...#3009 Remove Recipe#3005 - Insert Ingredient Before This One#3007 Add Ingredient After This One#3006 Remove Ingredient#3008 4 Typestyles Plain Text/P#351 Underline/U#354 Bold/B#352 Italic/I#353 Hollow#356 Shadow#355 - Modern#320 Classic#321 - 8 Point 20 Pitch#330 8 Point 15 Pitch#331 10 Point 12 Pitch#332 12 Point 10 Pitch#333 12 Point#334 14 Point#335 98 Testing Refresh#3000 Draw Rectangles#3010 Trace#3003 99 $-#BOOT-TK/PABC~Debug 100 $-#BOOT-TK/PABC~Buzzwords 1000 $-#BOOT-TK/PABC~Clipboard File/Print 1001 $-#BOOT-TK/PABC~Page Layout 0 3. "6F^9. D!$ǐ^eKCdon't change the opening rectangle 3. "6F^; This is a file of info for building the Recipes program ; ;First is the tool number and tool volume (the tool volume defaults to the prefix volume) 200 ; ;There are no files that need to be assembled $ ; ;There are no building blocks/other units that need to be compile $ ;Link in UFixUText and map its segments UFixUText +M FixText1 +M FixText2 $ ;Install parameters (handles documents; more than 1 doc; change open rect) Y Y Y 0 40 720 330 Recipe $ This line will end the input to the InstallTool program. UFIXUTEXVHACKMETHFixText1$6200000HACKMETHUFIXUTEXUCLASCALLJoNVH(m&m k.( l"l0,@21A&p k!GLN^NuDSTARTPASFixText2$9200000STARTPASTTKREADUTTKREADUtTPARAFORTPARAFOR:JoNV/ (n, glBBB/,N l P h8 P h P/(N)_BBg l P/(/,N)_BBB/,NB?<?:>N)_Bl`& l P h P9hB l P/(N)_(_N^.NuENDPASTEFixText2$0300000ENDPASTE4JoNV/ (n, g/,N/,N(_N^.Nu,GETPARAGFixText2$1300000GETPARAGUFIXUTEX$JoNVH(n, gZBg l P?(B/,N BEBB/,N l P h P>(JGo  gFA-H n P&P l PX-H n7h n7h n7h  l P!l|BgH/ l P/( N=_ n fH/ l P/( NSGRlx?Bg l P/( Bg?/,N l Ph l P0(A@p l P0(A@p? G?/./,NG` gRlxgg n ` n BF`Bg/. /,N_LN^ _PONЁINSTEXT FixText2$2300000INSTEXT $0300000ENDPASTE,$1300000GETPARAG2$9200000STARTPAS>JoNV/ (nBl l P)h8 l P h< P9h l P h< P)h)lB,,gBBg?,/,N_Bg0,S@?/,Ng?< ?,/,NRl9|B,/.NBgHl/.Ngf0,H l P"(Ҁ9A?,Bg/,Bg l P?(/,N 0,H l P"(Ҁ9A,g/,/, l P/(N|)lBgHl/.NgB l P0,H"(?BB/,N l P/(N/,N)_ l P/( l P h8 P h P h P/(NBg/,N/,NBgBg/,?, l P0,H"(?/,N ?, l P0,H"(?B/,N /,NBl`|,g,gB l P0,H"(? l P/(/,N)_Bg/,N/,NBgBg/,?, l P0,H"(?/,N ?, l P0,H"(?B/,N /,N/,/, l P/(NB l P h< P0,HШ/ l P h P/(N)_RlBl`$,g,g?< ?,/,NRlRl/.N(_N^.Nu6ADDDELTAFixText2$4300000ADDDELTA@JoNV/ (n(l l P h< P?( ?,/. N (_N^ _PONЁ8ADJUST FixText2$3300000ADJUST $4300000ADDDELTAJoNVH&nHz/ k P h< P/(N KP-H n P P-H nA<-H n P(P)k)k9k 9k0+HЬS)@)l n1kP nB(DLN^.NuINSERTTEFixText2$8200000INSERTTE$3300000ADJUST $2300000INSTEXT >JoNVJV. @gHz/Hz//.NN^ _NЁ6%_CR1000FixText1$5300000%_CR1000$6200000HACKMETH6$8200000INSERTTE&%_CLASS %_CLASS *UFIXUTEX~xrlf`ZTNHB<2.JoNVHzHzHmBgBg?<XN?<NNA+HN||||||||||||||||||||||||||||N^NuTINSERTITFIXINSEUFIXUTEXFixText1ufixutexUFIXUTEX$5300000%_CR1000"utext UTEXT utkuniveUTKUNIVEuabc UABC udraw UDRAW uobject UOBJECT %_UNIT %_UNIT 0JoNVNNNNNNNN^Nu( {This unit fixes a bug with UText, where pasting universal text containing a 14 Point or $20 Pitch font would crash with a check range error, accessing the uvFont array. The $only access was made in TInsertionPoint.InsertText. To fix the problem we subclass $TInsertionPoint.InsertText, but install a pointer to the revised method in TInsertionPoint's $method table.} {$SETC CalcNumbers := FALSE} {IF TRUE, calculate level/method numbers, else use CONSTs} {$SETC Debug := FALSE} INTERFACE {$E ERRORS} {$E+} USES ${$U LIBPL/UCLASCAL} UClascal, ${$U UObject} UObject, ${$U QuickDraw} QuickDraw, ${$U UDraw} UDraw, ${$U UABC} UABC, ${$U UUnivText} UTKUniversalText, ${$U UText} UText; TYPE $TFixInsertionPoint = SUBCLASS OF TInsertionPoint (FUNCTION TFixInsertionPoint.CREATE: TFixInsertionPoint; ABSTRACT; (PROCEDURE TFixInsertionPoint.InsertText(text: TText; isParaSelection: BOOLEAN; TisWordSelection: BOOLEAN; TuniversalText: BOOLEAN); OVERRIDE; (END; IMPLEMENTATION 3. "6F^9. D!$ǐ^  d-y the lF4F4F`[̤x4̥f<̥T[̥TxLB\G8UDD":̥RR.3L.3T@F{$SETC Rulers := FALSE} PROGRAM MSamDialog; {26Jan84 13:36} USES "{$CLASSES+} ${$U UObject } UObject, "{$CLASSES-} ${$U QuickDraw } QuickDraw, "{$CLASSES+} ${$U UDraw } UDraw, ${$U UABC } UABC, ${$U UUnivText} UTKUniversalText, {+SW+} ${$U UText } UText, ${$U UDialog } UDialog, {$IFC Rulers} ${$U URuler } URuler, {$ENDC} ${$U USamDialog} USamDialog; CONST $phraseVersion = 1; BEGIN $process := TMyProcess.CREATE; $process.Commence(phraseVersion); $process.Run; $process.Complete(TRUE); END. 3. "6F^9neD!$ǐ^#W2'2'eT n: TButton);} (END; $TExtraDialog = SUBCLASS OF TDialog {a second Dialog seen in the same view as the TScaleDialog} (FUNCTION {TExtraDialog.}CREATE(object: TObject; itsHeap: THeap; itsPanel: TPanel): TExtraDialog; (END; $TFrameSampleDialog = SUBCLASS OF TDialog {Examples of input frame use} (FUNCTION {TFrameSampleDialog.}CREATE(object: TObject; itsHeap: THeap; itsPanel: TPanel) J: TFrameSampleDialog; '{PROCEDURE TFrUNIT USamDialog; {Copyright 1983 by Apple Computer, Inc} (* $A sample application to illustrate use of the Dialog Building Block $5April1984 01:00 *) INTERFACE USES ${$U UObject} UObject, ${$U QuickDraw} QuickDraw, ${$U UDraw} UDraw, ${$U UABC} UABC, ${$U UUnivText} UTKUniversalText, ${$U UText} UText, ${$U UDialog} UDialog; CONST $uSamDiVersion = 'Dialog Sample 5Apr84 01:00'; $diCopyright = 'Copyright 1984 by Apple Computer, Inc.'; $samDiTraceLevel = 12; {BP level used for all methods in this unit} { Menu constants for the test application } { The Test Dialogs } $muTest = 2101; {put up test dialog in a dialog Box (it's also seen in the main window)} $muScale = 2102; {put up LisaProject's time scale dialog box} $muFrameSample = 2103; {Examples of alternative input-frame parameters} $muPrMgr = 2104; {chunk of print manager-like dialog} $muOneNumber = 2105; {simple dialog to obtain one number} $xxOnLilac = 1100; {the four phrases which will be refreshed from the phrase file, not} $xxOffLilac = 1101; { from the Resource file } $xxWren = 1102; $xxTroglodyte = 1103; TYPE $TMyProcess = SUBCLASS OF TProcess (FUNCTION {TMyProcess.}CREATE: TMyProcess; '{FUNCTION TMyProcess. NewDocManager(volumePrefix: TFilePath; openAsTool: BOOLEAN): TDocManager;} (END; $TMyDocManager = SUBCLASS OF TDocManager (FUNCTION {TMyDocManager.}CREATE(object: TObject; itsHeap: THeap; itsPathPrefix: TFilePath) F: TMyDocManager; '{FUNCTION TMyDocManager. NewWindow(heap: THeap; wmgrID: TWindowID): TWindow;} (END; $TMyDialogView = SUBCLASS OF TDialogView {NOTE: We only subclass TDialogView here to illustrate how Uclient-defined non-dialog features can be incorporated Uinto a view which shows dialogs} (FUNCTION {TMyDialogView.}CREATE(object: TObject; itsHeap: THeap; itsExtentLRect: LRect; 4itsPanel: TPanel; inDialogBox: BOOLEAN): TMyDialogView; (END; $TDemoDialog = SUBCLASS OF TDialog {Big dialog that illustrates almost everything} (reportMessage: TImageWithID; (FUNCTION {TDemoDialog.}CREATE(object: TObject; itsHeap: THeap; itsPanel: TPanel; DinDialogBox: BOOLEAN): TDemoDialog; '{PROCEDURE TDemoDialog. ButtonPushed(button: TButton);} (PROCEDURE {TDemoDialog.}ChangeReportMessage(newString: S255); '{PROCEDURE TDemoDialog. CheckboxHit(checkbox: TCheckbox);} '{PROCEDURE TDemoDialog. Draw;} (END; $TMyFootball = SUBCLASS OF TImageWithID {illustration of a user-defined subclass of TDialogImage} 'FUNCTION {TMyFootball.}CREATE(object: TObject; itsHeap: THeap; itsView: TView): TMyFootball; &{PROCEDURE TMyFootball. Draw;} 'END; $TScaleDialog = SUBCLASS OF TDialog {LisaProject-like Time-scale dialog + multiple dialog images} (FUNCTION {TScaleDialog.}CREATE(object: TObject; itsheap: THeap; itsPanel:TPanel): TScaleDialog; '{PROCEDURE TScaleDialog. ButtonPushed(button: TButton);} (END; $TExtraDialog = SUBCLASS OF TDialog {a second Dialog seen in the same view as the TScaleDialog} (FUNCTION {TExtraDialog.}CREATE(object: TObject; itsHeap: THeap; itsPanel: TPanel): TExtraDialog; (END; $TFrameSampleDialog = SUBCLASS OF TDialog {Examples of input frame use} (FUNCTION {TFrameSampleDialog.}CREATE(object: TObject; itsHeap: THeap; itsPanel: TPanel) J: TFrameSampleDialog; '{PROCEDURE TFrameSampleDialog. ButtonPushed(button: TButton);} (END; $TPrMgrDialog = SUBCLASS OF TDialog { a piece of print-manager-like dialog to illustrate Kdynamic adding/deleting of components } (FUNCTION {TPrMgrDialog.}CREATE(object: TObject; itsHeap: THeap;itsPanel: TPanel): TPrMgrDialog; '{PROCEDURE TPrMgrDialog. CheckboxHit(checkbox: TCheckbox; toggleDirection: BOOLEAN);} (END; $TMyWindow = SUBCLASS OF TWindow (scaleWindow: TDialogWindow; (frameWindow: TDialogWindow; (prMgrWindow: TDialogWindow; (demoWindow: TDialogWindow; (demoDialog: TDemoDialog; {the dialog seen in the main window} (FUNCTION {TMyWindow.}CREATE(object: TObject; itsHeap: THeap; itsWmgrID: TWindowID): TMyWindow; '{PROCEDURE TMyWindow. CanDoCommand(cmdNumber: TCmdNumber; VAR checkIt: BOOLEAN): BOOLEAN;} '{PROCEDURE TMyWindow. BlankStationery;} '{FUNCTION TMyWindow. NewCommand(cmdNumber: TCmdNumber): TCommand;} (END; IMPLEMENTATION {$I USamDialog2.TEXT} END. 3. "6F^9; D!$ǐ^!50#0#;Tew(SELF.selectPanel.view)).SeizeControl; ); t fr} F TDialog {a second Dialog seen in the same view as the TScaleDialog} (FUNCTION {TExtraDialog.}CREATE(object: TObject; itsHeap: THeap; i(dialogView := TMyDialogView.CREATE(NIL, SELF.Heap, extentLRect, panel, TRUE); (demoDialog := TDemoDialog.CREATE(NIL, SELF.Heap, panel, TRUE); (dialogView.AddDialog(demoDialog); (SELF.demoWindow := dialogWindow; (dialogView.paintFr{USamDialog2, INCLUDE file from USamDialog, to illustrate use of the Dialog Manager} (* "11Apr84 19:30 PrMgrDialog has diGiveToMainWindow as its response to down in main window "05 April 1984 02:00 Preliminary Spring Release -- NOT using latest TDialog.New... methods yet *) {$IFC fRngABC} {$R+} {$ELSEC} {$R-} {$ENDC} {$IFC fSymABC} {$D+} {$ELSEC} {$D-} {$ENDC} METHODS OF TMyProcess; $FUNCTION {TMyProcess.}CREATE{: TMyProcess}; $BEGIN ({$IFC fTrace}BP(samDiTraceLevel);{$ENDC} (SELF := TMyProcess(TProcess.CREATE(NewObject(mainHeap, THISCLASS), mainHeap)); ({$IFC fDbgOK} (WRITELN(uSamDiVersion, ' ', uDialogVersion); ({$ENDC} ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION {TMyProcess.}NewDocManager{(volumePrefix: TFilePath; openAsTool: BOOLEAN): TDocManager}; $BEGIN ({$IFC fTrace}BP(samDiTraceLevel);{$ENDC} (NewDocManager := TMyDocManager.CREATE(NIL, mainHeap, volumePrefix); ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TMyDocManager; $FUNCTION {TMyDocManager.}CREATE{(object: TObject; itsHeap: THeap; itsPathPrefix: TFilePath) B: TMyDocManager}; $BEGIN ({$IFC fTrace}BP(samDiTraceLevel);{$ENDC} (IF object = NIL THEN ,object := NewObject(itsHeap, THISCLASS); (SELF := TMyDocManager(TDocManager.CREATE(object, itsHeap, itsPathPrefix)); ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION {TMyDocManager.}NewWindow{(heap: THeap; wmgrID: TWindowID): TWindow}; $BEGIN ({$IFC fTrace}BP(samDiTraceLevel);{$ENDC} (NewWindow := TMyWindow.CREATE(NIL, heap, wmgrID); ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TMyDialogView; $FUNCTION {TMyDialogView.}CREATE{(object: TObject; itsHeap: THeap; itsExtentLRect: LRect; 0itsPanel: TPanel; inDialogBox: BOOLEAN): TMyDialogView}; $BEGIN ({$IFC fTrace}BP(samDiTraceLevel);{$ENDC} (IF object = NIL THEN ,object := NewObject(itsHeap, THISCLASS); (SELF := TMyDialogView(TDialogView.CREATE(object, itsHeap, itsExtentLRect, itsPanel, NIL, screenRes)); ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE {TMyDialogView.}XDraw; ${illustrates another way to add client embellishments; Frames the 'reportMessage' rectangle} $BEGIN &{$IFC fTrace}BP(samDiTraceLevel);{$ENDC} &PenNormal; &FrameLRect(TDemoDialog(SELF.rootDialog.children.First).reportMessage.extentLRect); &{$IFC fTrace}EP;{$ENDC} $END; $FUNCTION {TMyDialogView.}XCursorAt{(mouseLPt: LPoint): TCursorNumber}; $BEGIN ({$IFC fTrace}BP(samDiTraceLevel);{$ENDC} (IF LRectHasLPt(TDemoDialog( 8SELF.rootDialog.children.First).reportMessage.extentLRect, mouseLPt) THEN ,XCursorAt := fingerCursor (ELSE ,XCursorAt := arrowCursor; &{$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TDemoDialog; $FUNCTION {TDemoDialog.}CREATE{(object: TObject; itsHeap: THeap; itsPanel: TPanel; inDialogBox: BOOLEAN): 4TDemoDialog)}; $VAR cluster: TCluster; (location: LPoint; (itsChars: S255; (reportMessage: TImageWithID; (inputFrame: TInputFrame; (checkbox: TCheckbox; (button: TButton; (anotherButton: TButton; (extent: LRect; (legend: TLegend; (smallType: TTypeStyle; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (IF object = NIL THEN ,object := NewObject(itsHeap, THISCLASS); (SELF := TDemoDialog(TDialog.CREATE(object, itsHeap, 'TEST', itsPanel.view)); (IF inDialogBox THEN ,BEGIN ,SELF.AddOKButton(noCmdNumber); ,SELF.AddCancelButton(noCmdNumber); ,END; (MakeTypeStyle(famModern, size15Pitch, [{$IFC libraryVersion <= 20} eFaceBold {$ELSEC} bold {$ENDC}], 0smallType); (legend := SELF.AddStdLegend('Mild', 40, 100, smallType); (legend := SELF.AddStdLegend('Spicy', 340, 100, smallType); (cluster := SELF.AddRowOfBoxes('Test Row', 80, 90, 8, 21, 18, 12, 14); ({Add a row of 8 checkboxes, with ID numbers 21 ,through 28, each 18 x 12 pixels, allowing 14 pixels spacing between adjacent boxes; )Call this cluster "Test Row", and have the first box start at (80, 90)} ({ ********************** Define a Cluster of Checkboxes *********************** } (cluster := SELF.AddStdCluster('Sizes', 80, 60); {locate the cluster at (80,60)} (checkbox := cluster.AddAlignedCheckbox('small', TRUE); (checkbox := cluster.AddAlignedCheckbox('medium', FALSE); (checkbox := cluster.AddAlignedCheckbox('large', FALSE); ({ ********************** Define a giant Free Checkboxes *********************** } (checkbox := SELF.AddBigFreeCheckbox('Lilac-Breasted Roller', 40, 170); ({ ********************** Define another free checkbox, whose text will change ********************* } (checkbox := SELF.AddBigFreeCheckbox('Wren', 40, 210); ({ *************************** Define the "NEXT" Button **************************** } (button := SELF.AddStdButton('NEXT', 420, 60, TButton(SELF.ObjectWithIDNumber(phCancel)), 8noCmdNumber); {this makes this button [always be the same size as the CANCEL button; [if not in dialog box, it will evaluate to NIL} ({These three buttons will always have the same size:} (button := SELF.AddStdButton('Obote', 100, 250, NIL, noCmdNumber); (anotherButton := SELF.AddStdButton('Moi', 300, 250, button, noCmdNumber); (button := SELF.AddStdButton('Nyerere', 500, 250, anotherButton, noCmdNumber); (reportMessage := TImageWithID.CREATE(NIL, SELF.Heap, zeroLRect, 'Report Box', SELF.view, TRUE); (reportMessage.AddImage(NewSysLegend(SELF.Heap, 'Report Box', 20, 24, SELF.view)); (SELF.reportMessage := reportMessage; (legend := TLegend(reportMessage.children.First); (legend.isEditable := FALSE; {it's important to realize why!} (SELF.AddImage(reportMessage); {make it a child so it'll be drawn, offset, etc., automatically} (inputFrame := SELF.AddStdInputFrame('Give me some Keys:', 330, 145, 6); (inputFrame.SupplantContents('A, Eb'); (SELF.AddImage(TMyFootball.CREATE(NIL, itsHeap, SELF.view)); ({$IFC fTrace}EP;{$ENDC} $END; ${$IFC fDebugMethods} $PROCEDURE {TDemoDialog.}Fields{(PROCEDURE Field(nameAndType: S255))}; $BEGIN (SUPERSELF.Fields(Field); (Field('reportMessage: TImageWithID'); (Field(''); $END; ${$ENDC} $PROCEDURE {TDemoDialog.}ButtonPushed{(button: TButton)}; *VAR newReport: S255; $BEGIN ({$IFC fTrace}BP(samDiTraceLevel);{$ENDC} (IF (button.idNumber = phOK) OR (button.idNumber = phCancel) THEN ,SUPERSELF.ButtonPushed(button) {will dismiss dialog box} (ELSE ,BEGIN ,SELF.ChangeReportMessage(CONCAT('>>> Button "', button.id, '" pushed <<<')); ,TDialogView(SELF.view).AbandonThatButton; ,END; ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE {TDemoDialog.}ChangeReportMessage{(newString: S255)}; (VAR extentToInval: LRect; {will incorporate old extent, new extent, and the extra pixels for the box} ,newExtent: LRect; ,legend: TLegend; $BEGIN ({$IFC fTrace}BP(samDiTraceLevel);{$ENDC} (extentToInval := SELF.reportMessage.extentLRect; (legend := TLegend(SELF.reportMessage.children.First); (legend.ChangeString(newString); (newExtent := legend.extentLRect; (InsetLRect(newExtent, -7, -5); (UnionLRect(SELF.reportMessage.extentLRect, newExtent, extentToInval); (SELF.reportMessage.Resize(newExtent); (InsetLRect(extentToInval, -1, -1); (SELF.view.panel.InvalLRect(extentToInval); ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE {TDemoDialog.}CheckboxHit{(checkbox: TCheckbox; toggleDirection: BOOLEAN)}; (VAR newString: S255; $BEGIN ({$IFC fTrace}BP(samDiTraceLevel);{$ENDC} (IF checkbox.HasId('Lilac-Breasted Roller') THEN ,BEGIN ,IF toggleDirection THEN 0process.GetAlert(xxOnLilac, newString) ,ELSE 0process.GetAlert(xxOffLilac, newString); ,SELF.ChangeReportMessage(newString); ,END (ELSE (IF checkbox.HasId('Wren') THEN {it's the free checkbox whose STRING we wish to change} ,BEGIN ,IF toggleDirection THEN 0process.GetAlert(xxTroglodyte, newString) ,ELSE 0process.GetAlert(xxWren, newString); ,checkbox.ChangeLabel(newString); ,SELF.ChangeReportMessage(newString); ,END (ELSE ,SELF.ChangeReportMessage(checkBox.id); &{$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TMyFootball; {a simple-minded illustration of a user-defined dialogImage} %FUNCTION {TMyFootball.}CREATE{(object: TObject; itsHeap: THeap; itsView: TView): TMyFootball}; *VAR extentLRect: LRect; $BEGIN ({$IFC fTrace}BP(samDiTraceLevel);{$ENDC} (SetLRect(extentLRect, 490, 190, 560, 220); (IF object = NIL THEN ,object := NewObject(itsHeap, THISCLASS); (SELF := TMyFootball(TImageWithID.CREATE(object, itsHeap, extentLRect, 'Fuball', itsView, FALSE)); ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION {TMyFootball.}CursorAt{(mouseLPt: LPoint): TCursorNumber}; (BEGIN ,{$IFC fTrace}BP(samDiTraceLevel);{$ENDC} ,IF SELF.Hit(mouseLPt) THEN 0CursorAt := smCrossCursor ,ELSE 0CursorAt := noCursor; ,{$IFC fTrace}EP;{$ENDC} (END; #PROCEDURE {TMyFootball.}Draw; %BEGIN *{$IFC fTrace}BP(samDiTraceLevel);{$ENDC} *PenNormal; *PaintLOval(SELF.extentLRect); *{$IFC fTrace}EP;{$ENDC} %END; END; METHODS OF TScaleDialog; (FUNCTION {TScaleDialog.}CREATE{(object: TObject; itsheap: THeap; itsPanel:TPanel): TScaleDialog}; (VAR cluster: TCluster; ,location: LPoint; ,checkbox: TCheckbox; ,legend: TLegend; $BEGIN ({$IFC fTrace}BP(samDiTraceLevel);{$ENDC} (IF object = NIL THEN ,object := NewObject(itsHeap, THISCLASS); (SELF := TScaleDialog(TDialog.CREATE(object, itsHeap, 'SCAL', itsPanel.view)); (legend := SELF.AddSysLegend('There are 2 Dialogs in this view; this is in one of them', 30, 28); (cluster := SELF.AddStdCluster('Scale Cluster', 50, 80); (checkbox := cluster.AddAlignedCheckbox('1 Week', TRUE); (checkbox := cluster.AddAlignedCheckbox('2 Weeks', FALSE); (checkbox := cluster.AddAlignedCheckbox('4 Weeks', FALSE); (checkbox := cluster.AddAlignedCheckbox('8 Weeks', FALSE); (legend := SELF.AddSysLegend('Time Scale of Chart:', 10, 62); (SELF.AddOKButton(noCmdNumber); (SELF.AddCancelButton(noCmdNumber); (SELF.SetDefaultButton(TButton(SELF.ObjectWithIDNumber(phCancel))); ({$IFC fTrace}EP;{$ENDC} $END; "PROCEDURE {TScaleDialog.}ButtonPushed{(button: TButton)}; 'VAR cluster: TCluster; +demoDialog: TDemoDialog; {the main-window Dialog of this test program} 'BEGIN ,{$IFC fTrace}BP(samDiTraceLevel);{$ENDC} ,cluster := TCluster(SELF.ObjWithId('Scale Cluster')); ,demoDialog := TMyWindow(currentWindow).demoDialog; ,IF button.idNumber = phOK THEN 0demoDialog.ChangeReportMessage( 5CONCAT('Current Scale Choice is ', cluster.hilitBox.id)) {strictly speaking, bshd get these from phrase file} ,ELSE {it was CANCEL} 0demoDialog.ChangeReportMessage( 5'Cancel dismissal'); ,SUPERSELF.ButtonPushed(button); {dismiss dialog box} ,{$IFC fTrace}EP;{$ENDC} 'END; END; METHODS OF TExtraDialog; $FUNCTION {TExtraDialog.}CREATE{(object: TObject; itsheap: THeap; itsPanel:TPanel): TExtraDialog}; $VAR cluster: TCluster; (checkbox: TCheckbox; (legend: TLegend; $BEGIN ({$IFC fTrace}BP(samDiTraceLevel);{$ENDC} ,IF object = NIL THEN 0object := NewObject(itsHeap, THISCLASS); ,SELF := TExtraDialog(TDialog.CREATE(object, itsHeap, 'EXTR', itsPanel.view)); ,legend := SELF.AddSysLegend('This is the "Extra" Dialog', 140, 140); ,cluster := SELF.AddStdCluster('doors', 120, 180); ,checkbox := cluster.AddAlignedCheckbox('Indoors', TRUE); ,checkbox := cluster.AddAlignedCheckbox('Outdoors', FALSE); ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TPrMgrDialog; $FUNCTION {TPrMgrDialog.}CREATE{(object: TObject; itsHeap: THeap; itsPanel: TPanel): TPrMgrDialog}; $VAR cluster: TCluster; (checkbox: TCheckbox; %BEGIN ({$IFC fTrace}BP(10);{$ENDC} (IF object = NIL THEN ,object := NewObject(itsHeap, THISCLASS); (SELF := TPrMgrDialog(TDialog.CREATE(object, itsHeap, 'PRMG', itsPanel.view)); (SELF.AddOKButton(noCmdNumber); (SELF.AddCancelButton(noCmdNumber); (cluster := SELF.AddStdCluster('which kind', 180, 24); (checkbox := cluster.AddAlignedCheckbox('Daisy', FALSE); (checkbox := cluster.AddAlignedCheckbox('Dot Matrix', TRUE); (cluster := SELF.AddStdCluster('LANDPORT', 180, 50); (checkbox := cluster.AddAlignedCheckbox('Landscape', FALSE); (checkbox := cluster.AddAlignedCheckbox('Portrait', TRUE); (cluster := SELF.AddStdCluster('which wheel', 180, 50); (checkbox := cluster.AddAlignedCheckbox('Round Wheel', FALSE); (checkbox := cluster.AddAlignedCheckbox('Square Wheel', TRUE); (SELF.ActivateImage(cluster, FALSE); {initially, make this guy inactive} (cluster := SELF.AddStdCluster('LOHIRES', 180, 80); (checkbox := cluster.AddAlignedCheckbox('Normal Resolution', TRUE); (checkbox := cluster.AddAlignedCheckbox('High Resolution', FALSE); ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE {TPrMgrDialog.}CheckboxHit{(checkbox: TCheckbox; toggleDirection: BOOLEAN)}; (BEGIN ,{$IFC fTrace}BP(samDiTraceLevel);{$ENDC} ,IF checkbox.HasId('Daisy') THEN 0SELF.ActivateImage(SELF.ObjWithId('which wheel'), toggleDirection) ,ELSE ,IF checkbox.HasId('Dot Matrix') THEN 0BEGIN 0SELF.ActivateImage(SELF.ObjWithId('LANDPORT'), toggleDirection); 0SELF.ActivateImage(SELF.ObjWithId('LOHIRES'), toggleDirection); 0END ,ELSE 0SUPERSELF.CheckboxHit(checkbox, toggleDirection); {as a matter of form} ,{$IFC fTrace}EP;{$ENDC} (END; END; METHODS OF TFrameSampleDialog; $FUNCTION {TFrameSampleDialog.}CREATE{(object: TObject; itsHeap: THeap; itsPanel: TPanel) E: TFrameSampleDialog}; (VAR inputFrame: TInputFrame; ,promptLoc: LPoint; ,inputLoc: LPoint; ,borders: Rect; ,bigTypeStyle: TTypeStyle; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (IF object = NIL THEN ,object := NewObject(itsHeap, THISCLASS); (SELF := TFrameSampleDialog(TDialog.CREATE(object, itsHeap, 'COLW', itsPanel.view)); (SELF.AddOKButton(noCmdNumber); (SELF.AddCancelButton(noCmdNumber); (inputFrame := SELF.AddStdInputFrame('Standard frame, 4 chars', 50, 50, 4); (inputFrame.SupplantContents('248'); (SetLPt(promptLoc, 340, 50); (SetLPt(inputLoc, 540, 50); (inputFrame := SELF.AddInputFrame('Do not draw hit rect', promptLoc, sysTypeStyle, -inputLoc, stdInputTypeStyle, 4, stdFrameBorders, TRUE, FALSE); (inputFrame.SupplantContents('1088'); (SetLPt(promptLoc, 50, 108); (SetLPt(inputLoc, 250, 108); (inputFrame := SELF.AddInputFrame('Do not draw input rect', promptLoc, sysTypeStyle, ,inputLoc, stdInputTypeStyle, 4, stdFrameBorders, FALSE, TRUE); (SetLPt(promptLoc, 340, 108); (SetLPt(inputLoc, 540, 108); (borders := stdFrameBorders; {+} (InsetRect(borders, 10, 6); {make smaller borders} {+} (inputFrame := SELF.AddInputFrame('Smaller Borders', promptLoc, sysTypeStyle, /inputLoc, stdInputTypeStyle, 4, borders, TRUE, TRUE); (inputFrame.SupplantContents('1981'); (SetLPt(promptLoc, 50, 188); (SetLPt(inputLoc, 330, 188); (MakeTypeStyle(famModern, size18Point, [], bigTypeStyle); {+} (inputFrame := SELF.AddInputFrame('Big Prompt Font', promptLoc, bigTypeStyle, /inputLoc, stdInputTypeStyle, 4, stdFrameBorders, FALSE, TRUE); (inputFrame.SupplantContents('Omo'); (SetLPt(promptLoc, 400, 188); (SetLPt(inputLoc, 550, 188); (inputFrame := SELF.AddInputFrame('Big Input Font', promptLoc, sysTypeStyle, 0inputLoc, bigTypeStyle, 4, stdFrameBorders, TRUE, FALSE); (inputFrame.SupplantContents('241'); ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE {TFrameSampleDialog.}ButtonPushed{(button: TButton)}; (VAR stdString: S255; $BEGIN ({$IFC fTrace}BP(samDiTraceLevel);{$ENDC} (TInputFrame(SELF.ObjWithId('STANDARD ')).GetContents(stdString); (IF button.idNumber = phOK THEN ,TMyWindow(currentWindow).demoDialog.ChangeReportMessage( 0CONCAT( 'At OK dismissal of FrameSample, contents of the "standard" box is ', stdString)); (SUPERSELF.ButtonPushed(button); {dismiss the dialog box} ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE {TFrameSampleDialog.}PrepareToAppear; {+SW+} $BEGIN ({$IFC fTrace}BP(samDiTraceLevel);{$ENDC} (SELF.SelectInputFrame(TInputFrame(SELF.ObjWithID('STANDARD ')));{come up selecting entire icontents of 1st fr} ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TMyWindow; $FUNCTION {TMyWindow.}CREATE{(object: TObject; itsHeap: THeap; itsWmgrID: TWindowID): TMyWindow}; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (IF object = NIL THEN ,object := NewObject(itsHeap, THISCLASS); (SELF := TMyWindow(TWindow.CREATE(object, itsHeap, itsWmgrID, TRUE)); ({$IFC fTrace}EP;{$ENDC} $END; ${$IFC fDebugMethods} $PROCEDURE {TMyWindow.}Fields{(PROCEDURE Field(nameAndType: S255))}; $BEGIN (SUPERSELF.Fields(Field); (Field('scaleWindow: TDialogWindow'); (Field('frameSampleDialog: TDialogWindow'); (Field('prMgrWindow: TDialogWindow'); (Field('demoWindow: TDialogWindow'); (Field('demoDialog: TDemoDialog'); (Field(''); $END; ${$ENDC} $PROCEDURE {TMyWindow.}BlankStationery; (VAR panel: TPanel; ,dialogView: TDialogView; ,dialogWindow: TDialogWindow; ,dialog: TDialog; ,extentLRect: LRect; ,demoDialog: TDemoDialog; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} #{ Set up the panel and view for the main window } (panel := TPanel.CREATE(NIL, SELF.Heap, SELF, 30, 20, [aScroll, aSplit], [aScroll, aSplit]); (SetLRect(extentLRect, 0, 0, 700, 360); (dialogView := TMyDialogView.CREATE(NIL, SELF.Heap, extentLRect, panel, FALSE); (demoDialog := TDemoDialog.CREATE(NIL, SELF.Heap, panel, FALSE); (dialogView.AddDialog(demoDialog); (SELF.demoDialog := demoDialog; #{ Set up the Scale Dialog } (dialogWindow := NewStdDialogWindow(SELF.Heap, 210, diDismiss, diAccept, diDismiss); (SELF.scaleWindow := dialogWindow; (dialogView := dialogWindow.dialogView; (dialogView.AddDialog( ,TScaleDialog.CREATE(NIL, SELF.Heap, dialogWindow.selectPanel)); (dialogView.AddDialog( ,TExtraDialog.CREATE(NIL, SELF.Heap, dialogWindow.selectPanel)); ({NOTE: The 'Scale Window' shows TWO different dialogs, to test the multiple-dialog feature} #{ Set up the Frame Sample dialog } 'dialogWindow := NewStdDialogWindow(SELF.Heap, 300, diAccept, diAccept, diRefuse); 'SELF.frameWindow := dialogWindow; 'dialogWindow.dialogView.AddDialog(TFrameSampleDialog.CREATE(NIL, SELF.Heap, dialogWindow.selectPanel)); "{ Set up the Print Manager dialog } (dialogWindow := NewStdDialogWindow(SELF.Heap, 120, diAccept, diAccept, diGiveToMainWindow); {+SW+} (SELF.prMgrWindow := dialogWindow; (dialogWindow.dialogView.AddDialog(TPrMgrDialog.CREATE(NIL, SELF.Heap, dialogWindow.selectPanel)); "{ Set up another version of the main-window demo dialog, but this time shown in a dialog box ((illustrates why it would've been SO NICE to use NewStdDialogWindow) } (dialogWindow := TDialogWindow.CREATE(NIL, SELF.Heap, FALSE, 300, diAccept, diAccept, diRefuse); (panel := TPanel.CREATE(NIL, SELF.Heap, dialogWindow, 30, 20, :[aScroll,aSplit], [aScroll,aSplit]); (dialogWindow.controlPanel := panel; (noPad.RectToLRect(panel.innerRect, extentLRect); (SetLRect(extentLRect, 0, 0, screenBits.bounds.right, screenBits.bounds.bottom - 20); (dialogView := TMyDialogView.CREATE(NIL, SELF.Heap, extentLRect, panel, TRUE); (demoDialog := TDemoDialog.CREATE(NIL, SELF.Heap, panel, TRUE); (dialogView.AddDialog(demoDialog); (SELF.demoWindow := dialogWindow; (dialogView.paintFreeBoxes := TRUE; {make it thus differ from the the main-window dialog} ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION {TMyWindow.}CanDoCommand{(cmdNumber: TCmdNumber; VAR checkIt: BOOLEAN): BOOLEAN}; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (CASE cmdNumber OF ,muTest, muScale, muFrameSample, muPrMgr, uEditDialog: 0CanDoCommand := SELF.dialogBox = NIL; ,OTHERWISE 0CanDoCommand := SUPERSELF.CanDoCommand(cmdNumber, checkIt); ,END; ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION {TMyWindow.}NewCommand{(cmdNumber: TCmdNumber): TCommand}; $VAR dialog: TDialog; (dialogWindow: TDialogWindow; $BEGIN %{$IFC fTrace}BP(10);{$ENDC} %NewCommand := NIL; %CASE cmdNumber OF ,muTest: { put up standard Test test dialog box } /SELF.PutUpDialogBox(SELF.demoWindow); ,muScale: {put up LisaProjects TIME SCALE dialog} /SELF.PutUpDialogBox(SELF.scaleWindow); ,muFrameSample: {put up LisaCalc-like column width dialog} /BEGIN /SELF.PutUpDialogBox(SELF.frameWindow); /END; ,muPrMgr: {put up Print-manager-like dialog} /SELF.PutUpDialogBox(SELF.prMgrWindow); ,uEditDialog: {must be a request to edit the Main-window dialog} 0TDialogDesignWindow.CREATE(NIL, SELF.Heap, TDialogView(SELF.selectPanel.view)).SeizeControl; ,OTHERWISE /NewCommand := SUPERSELF.NewCommand(cmdNumber); (END; ({$IFC fTrace}EP;{$ENDC} $END; END; 3. "6F^9BCD!$ǐ^,DDd-y the lF4F4F`[̤x4̥f<̥T[̥TxLB\G8UDD":̥RR.3L.3T@F; PSamDialog.TEXT for Dialog Building Block test application ; ; 28March84 ; ; Copyright 1984 by Apple Computer, Inc ; ;NOTE: The wording of the alerts may not conform to the standards of the ; first release applications 1 3 2300 $-#boot-tk/PABC 1100 Lilac Box Turned On 1101 Off went the Lilac Box 1102 Wren 1103 Troglodytes troglodytes 0 1 $-#boot-tk/PABC~File/Print 2 $-#boot-tk/PABC~Edit 3 Type Style Plain Text/P#351 Underline/U#354 Bold/B#352 Italic/I#353 Hollow#356 Shadow#355 - Modern#320 Classic#321 - 8 Point 20 Pitch#330 8 Point 15 Pitch#331 10 Point 12 Pitch#332 12 Point 10 Pitch#333 12 Point#334 14 Point#335 18 Point#336 24 Point#337 6 Sample Dialogs Demo Dialog#2101 Time Scale#2102 Input Frames#2103 Printer Choice#2104 99 $-#boot-tk/PABC~Debug 100 $-#boot-tk/PABC~Buzzwords 1000 $-#boot-tk/PABC~Clipboard File/Print 0 3. "6F^9plD!$ǐ^ eH.don't change the opening rectangle (_pJH̓v̓zpJ@̓zHpp3z;The next 2 lines specify the default tool number and tool volume 207 ;no assembler files $ ;no building blocks $ ;nothing else to link in $ ;install parameters: we handle documents; we handle >1 document; we don't change the opening rectangle y y n SamDialog $ 3. "6F^5D!$ǐ^APROGRAM MSample; USES ${$U UObject} UObject, ${$IFC LibraryVersion <= 20} ${$U UFont} UFont, ${$ENDC} ${$U QuickDraw} QuickDraw, ${$U UDraw} UDraw, ${$U UABC} UABC, ${$U UUnivText} UTKUniversalText, {+SW+} ${$U UText} UText, ${$U UDialog} UDialog, ${$U USample} USample; CONST $phraseVersion = 1; BEGIN $process := TSamProcess.CREATE; $process.Commence(phraseVersion); $process.Run; $process.Complete(TRUE); END. 3. "6F^9D!$ǐ^!0#0#Tw3. "6F^9D!$ǐ^:W:W${Copyright 1984, Apple Computer Inc.} UNIT USample; INTERFACE {$E ERRORS} {$E+} USES ${$U UObject} UObject, ${$U QuickDraw} QuickDraw, ${$U UDraw} UDraw, ${$U UABC} UABC; CONST $myCursor = 100; {application-defined cursor} $uWhoAmI = 4000; $phWhoAmI = 1002; $phWhoError = 1003; $uShowPanel = 4100; $uHidePanel = 4101; $uRequestAlert = 4102; $uThirdOnTop = 4103; TYPE "{Subclasses of Generic Classes} $TSamProcess = SUBCLASS OF TProcess &{Creation/Destruction} (FUNCTION {TSamProcess.}CREATE: TSamProcess; '{FUNCTION TSamProcess. NewDocManager(volumePrefix: TFilePath; openAsTool: BOOLEAN): TDocManager;} &{Mouse Tracking} '{PROCEDURE TSamProcess. DoCursorChange(cursorNumber: TCursorNumber);} (END; $TSamDocManager = SUBCLASS OF TDocManager &{Creation/Destruction} (FUNCTION {TSamDocManager.}CREATE(object: TObject; heap: THeap; itsPathPrefix: TFilePath) B: TSamDocManager; '{FUNCTION TSamDocManager. NewWindow(heap: THeap; wmgrID: TWindowID): TWindow;} (END; $TSamWindow = SUBCLASS OF TWindow &{Variables} (secondPanel: TPanel; (thirdPanel: TPanel; (panelShows: BOOLEAN; {TRUE iff thirdPanel is showing} (division: INTEGER; {what percent to use in panel.Divide & panel.Insert (50 or -50)} &{Creation/Destruction} (FUNCTION {TSamWindow.}CREATE(object: TObject; heap: THeap; itsWmgrID: TWindowID): TSamWindow; &{Document Creation} '{PROCEDURE TSamWindow. BlankStationery;} &{Commands} '{FUNCTION TSamWindow. CanDoCommand{(cmdNumber: TCmdNumber; checkIt: BOOLEAN): BOOLEAN;} '{FUNCTION TSamWindow. NewCommand(cmdNumber: TCmdNumber): TCommand;} (END; {Cross-panel drag stuff} $TXPView = SUBCLASS OF TView (hasCircle: BOOLEAN; (circleLRect: LRect; (isThird: BOOLEAN; (FUNCTION TXPView.CREATE(object: TObject; heap: THeap; DitsPanel: TPanel; itsExtent: LRect): TXPView; ({$IFC fDbgOK} (PROCEDURE TXPView.Fields(PROCEDURE Field(nameAndType: S255)); OVERRIDE; ({$ENDC} (FUNCTION TXPView.CursorAt(mouseLPt: LPoint): TCursorNumber; OVERRIDE; (PROCEDURE TXPView.Draw; OVERRIDE; (PROCEDURE TXPView.MousePress(mouseLPt: LPoint); OVERRIDE; (END; $TXPSelection = SUBCLASS OF TSelection (currLRect: LRect; (FUNCTION TXPSelection.CREATE(object: TObject; heap: THeap; DitsView: TView; itsAnchorLPt: LPoint; itsRect: LRect): TXPSelection; ({$IFC fDbgOK} (PROCEDURE TXPSelection.Fields(PROCEDURE Field(nameAndType: S255)); OVERRIDE; ({$ENDC} (PROCEDURE TXPSelection.MouseMove(mouseLPt: LPoint); OVERRIDE; (PROCEDURE TXPSelection.MouseRelease; OVERRIDE; (END; IMPLEMENTATION "{$I USample2.text} END. 3. "6F^9; D!$ǐ^(j7$7$.Tތ); , itsAnchorLPt)); : TXPSelection; nager}; 3. "6F^({$IFC fTrace}BP(11);{$ENDC} (XPSelection := TXPSelection(selection); (WITH XPSelection DO ,BEGIN ,x := anchorLPt.h - currLRect.left; ,y := anchorLPt.v - currLRect.top; ,END; (WITH lPtInView DO ,{$H-} ,SetLRect(SELF.circleLRe{USAMPLE2} VAR $specialCursor: Cursor; $thirdPat: LPattern; METHODS OF TSamProcess; $FUNCTION {TSamProcess.}CREATE{: TSamProcess}; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (SELF := TSamProcess(TProcess.CREATE(NewObject(mainHeap, THISCLASS), mainHeap)); ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE {TSamProcess.}DoCursorChange{(cursorNumber: TCursorNumber)}; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (IF cursorNumber = myCursor THEN ,SetCursor(specialCursor) (ELSE ,TProcess.DoCursorChange(cursorNumber); ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION {TSamProcess.}NewDocManager{(volumePrefix: TFilePath; openAsTool: BOOLEAN): TDocManager}; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (NewDocManager := TSamDocManager.CREATE(NIL, mainHeap, volumePrefix); ({$IFC fTrace}EP;{$ENDC} $END; BEGIN {Class initialization} ${ build the application-defined cursor } $WITH specialCursor DO (BEGIN (hotSpot.h := 1; (hotSpot.v := 1; (StuffHex(@data, '00007E0040004880448000801F80000000000000000000000000000000000000'); (StuffHex(@mask, 'FFC0FFC0FFC0FFC0FFC0FFC0FFC0FFC000000000000000000000000000000000'); (END; $StuffHex(@thirdPat, '7088083008887000'); END; METHODS OF TSamDocManager; $FUNCTION {TSamDocManager.}CREATE{(object: TObject; heap: THeap; itsPathPrefix: TFilePath) C: TSamDocManager}; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TSamDocManager(TDocManager.CREATE(object, heap, itsPathPrefix)); ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION {TSamDocManager.}NewWindow{(heap: THeap; wmgrID: TWindowID):TWindow}; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (NewWindow := TSamWindow.CREATE(NIL, heap, wmgrID); ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TSamWindow; $FUNCTION {TSamWindow.}CREATE{(object: TObject; heap: THeap; itsWmgrID: TWindowID): TWindow}; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TSamWindow(TWindow.CREATE(object, heap, itsWmgrID, TRUE)); (SELF.secondPanel := NIL; (SELF.thirdPanel := NIL; (SELF.panelShows := FALSE; (SELF.division := 50; ({$IFC fTrace}EP;{$ENDC} $END; ${$IFC fDebugMethods} $PROCEDURE {TSamWindow.}Fields{(PROCEDURE Field(nameAndType: S255))}; $BEGIN (SUPERSELF.Fields(Field); (Field('secondPanel: TPanel'); (Field('thirdPanel: TPanel'); (Field('panelShows: BOOLEAN'); (Field('division: INTEGER'); (Field(''); $END; ${$ENDC} $PROCEDURE {TSamWindow.}BlankStationery; (VAR viewLRect: LRect; ,panel: TPanel; ,xpView: TXPView; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (SetLRect(viewLRect, 0, 0, 500, 500); (panel := TPanel.CREATE(NIL, SELF.Heap, SELF, 0, 0, [aScroll, aSplit], [aScroll, aSplit]); (xpView := TXPView.CREATE(NIL, SELF.Heap, panel, viewLRect); (xpView.hasCircle := TRUE; ({$H-} (SetLRect(xpView.circleLRect, 10, 10, 100, 70); ({$H+} (panel := panel.Divide(h, 50, percentFromEdge, [userCanResizeIt, windowCanResizeIt], >0, [aBar, aScroll, aSplit], [aBar, aScroll, aSplit]); (xpView := TXPView.CREATE(NIL, SELF.Heap, panel, viewLRect); (xpView.hasCircle := FALSE; (SELF.secondPanel := panel; (panel := SELF.secondPanel.Divide(v, SELF.division, percentFromEdge, @[userCanResizeIt, windowCanResizeIt], >0, [aBar, aScroll, aSplit], [aBar, aScroll, aSplit]); (xpView := TXPView.CREATE(NIL, SELF.Heap, panel, viewLRect); (xpView.isThird := TRUE; (xpView.hasCircle := FALSE; (SELF.thirdPanel := panel; (SELF.panelShows := TRUE; ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION {TSamWindow.}CanDoCommand{(cmdNumber: TCmdNumber; checkIt: BOOLEAN): BOOLEAN}; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (CASE cmdNumber OF ,uWhoAmI, uRequestAlert: 0CanDoCommand := TRUE; ,uShowPanel, uHidePanel: 0BEGIN 0checkIt := ((cmdNumber = uShowPanel) AND SELF.panelShows) OR ;((cmdNumber = uHidePanel) AND NOT SELF.panelShows); 0CanDoCommand := TRUE; 0END; ,uThirdOnTop: 0BEGIN 0CanDoCommand := NOT SELF.panelShows; 0checkIt := SELF.division > 0; 0END; ,OTHERWISE 0CanDoCommand := SUPERSELF.CanDoCommand(cmdNumber, checkIt); ,END; ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION {TSamWindow.}NewCommand{(cmdNumber: TCmdNumber): TCommand}; (VAR error: INTEGER; ,eOffset: INTEGER; ,name: TFilePath; ,erStr: S255; ,offStr: S255; ,thirdPanel: TPanel; ,sibling: TArea; $BEGIN ({$IFC fTrace}BP(12);{$ENDC} (NewCommand := NIL; (CASE cmdNumber OF ,uWhoAmI: 0BEGIN *{$H-} SELF.PrefixToName(error, eOffset, currentDocument.files.volumePrefix, name); {$H+} 0IF error <= 0 THEN 4BEGIN 4process.ArgAlert(1, name); 4process.Note(phWhoAmI); 4END 0ELSE 4BEGIN 4IntToStr(error, @erStr); 4IntToStr(eOffset, @offStr); 4process.ArgAlert(1, erStr); 4process.ArgAlert(2, offStr); 4process.Stop(phWhoError); 4END; 0END; ,uShowPanel: 0BEGIN 0IF NOT SELF.panelShows THEN 4SELF.secondPanel.Insert(SELF.thirdPanel, v,SELF.division, percentFromEdge, P[userCanResizeIt, windowCanResizeIt]); 0SELF.panelShows := TRUE; 0END; ,uHidePanel: 0BEGIN 0IF SELF.panelShows THEN 4BEGIN 4thirdPanel := SELF.thirdPanel; 4sibling := thirdPanel.parentBranch.OtherChild(thirdPanel); 4thirdPanel.Remove; 4IF InClass(sibling, TPanel) THEN 8TPanel(sibling).DecideAboutBars(sibling.outerRect); 4SELF.panelShows := FALSE; 4END; 0END; ,uThirdOnTop: 0SELF.division := -SELF.division; ,uRequestAlert: 0BEGIN 0process.Stop(1001); 0END; ,OTHERWISE 0NewCommand := SUPERSELF.NewCommand(cmdNumber); ,END; ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TXPView; $FUNCTION TXPView.CREATE(object: TObject; heap: THeap; itsPanel: TPanel; itsExtent: LRect): TXPView; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TXPView(itsPanel.NewView(object, itsExtent, TPrintManager.CREATE(NIL, heap), PstdMargins, TRUE)); (SELF.isThird := FALSE; ({$IFC fTrace}EP;{$ENDC} $END; {$IFC fTrace} $PROCEDURE TXPView.Fields(PROCEDURE Field(nameAndType: S255)); $BEGIN (TView.Fields(Field); (Field('hasCircle: BOOLEAN'); (Field('circleLRect: LRect'); (Field('isThird: BOOLEAN'); (Field(''); $END; {$ENDC} ({If the mouse is in the view containing the circle, display the small cross; )If the mouse is in the circle, display the application-defined cursor; )This is does not follow the user interface standard, but does illustrate how to ,change the cursor.} $FUNCTION TXPView.CursorAt(mouseLPt: LPoint): TCursorNumber; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (CursorAt := arrowCursor; (IF SELF.hasCircle THEN ,IF LRectHasLPt(SELF.circleLRect, mouseLPt) THEN 0CursorAt := myCursor ,ELSE 0CursorAt := smCrossCursor; ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION TXPView.DoReceive(selection: TSelection; lPtInView: LPoint): BOOLEAN; $VAR XPSelection: TXPSelection; (x,y: LONGINT; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (XPSelection := TXPSelection(selection); (WITH XPSelection DO ,BEGIN ,x := anchorLPt.h - currLRect.left; ,y := anchorLPt.v - currLRect.top; ,END; (WITH lPtInView DO ,{$H-} ,SetLRect(SELF.circleLRect, h-x, v-y, h+90-x, v+60-y); ,{$H+} (SELF.hasCircle := TRUE; (SELF.panel.InvalLRect(SELF.circleLRect); (selection := selection.FreedAndReplacedBy(SELF.NoSelection); (DoReceive := TRUE; ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TXPView.Draw; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (IF SELF.isThird THEN ,FillLRect(SELF.extentLRect, thirdPat); (IF SELF.hasCircle THEN ,BEGIN ,PenNormal; ,FillLOval(SELF.circleLRect, lPatGray); ,FrameLOval(SELF.circleLRect); ,END; ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TXPView.MousePress(mouseLPt: LPoint); $VAR selection: TSelection; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (IF SELF.hasCircle AND LPtInLRect(mouseLPt, SELF.circleLRect) THEN ,BEGIN ,SELF.panel.BeginSelection; {+SW+} ,SELF.panel.InvalLRect(SELF.circleLRect); ,SELF.hasCircle := FALSE; ,SELF.panel.window.Update(TRUE); ,selection := SELF.panel.selection.FreedAndReplacedBy( 1 document; we don't change the opening rectangle y y n Sample $ 3. "6F^9. D!$ǐ^LIa); extRange.firstIndex + numParas)); AND (TClassInfo), numClasses, @growClasses, limClasses, maxClasses, 'Classes', ORD(pClasses)); (limClasses := RAllocate(SIZEOF(TPSliceTable), numCPROGRAM MTwoText; USES ${$U UObject } UObject, {$IFC LibraryVersion <= 20} ${$U UFont} UFont, {$ENDC} ${$U QuickDraw } QuickDraw, ${$U UDraw } UDraw, ${$U UABC } UABC, ${$U UUnivText } UTKUniversalText, ${$U UText } UText, ${$U UTwoText } UTwoText, ${$U UFixUText } UFixUText; CONST $phraseVersion = 1; BEGIN $process := TMyProcess.CREATE; $process.Commence(phraseVersion); $process.Run; $process.Complete(TRUE); END. (cmdNumber); (END; ({$IFC fTrace}EP;{$ENDC} $END; END; G5TK5̆V{t̆^H :a$kTk:)$ "#." #"##%& ! 3. "6F^9; D!$ǐ^KZ,Z, T1pSelection.Hig2ck} add l } 2 2mand(cmdNumber: TCmdNumber): TCommand; OVERRIDE; (PROCEDURE TMyWindow.PerformLast(cmdPhase: TCmdPhase); OVERRIDE; (END; IMPLEMENTATION8{If you look at PerformLast below and the Highlight methods, you will see  NIL THEN ,CursorAt := textCursor (ELSE ,CursorAt := SUPERSELF.CursorAt(mouseLPt); ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION TRecipeImage.DismantleImage: TRecipe; $VAR nameStr: TString; (direcList: TList; (ingredList: TList; (recipe: TRecipe; (FUNCTION CreateString(textImage: TTextImage): TString; (VAR para: TEditPara; ,str: TString; (BEGIN ,para := TEditPara(textImage.text.paragraphs.First); ,str := TString.CREATE(NIL, SELF.Heap, para.size); ,str.InsManyAt(1, para, 1, para.size); ,CreateString := str; (END; (PROCEDURE InstallString(obj: TObject); (BEGIN ,ingredList.InsLast(CreateString(TTextImage(obj))); (END; (PROCEDURE AddParagraph(obj: TObject); (VAR paragraph: TParagraph; ,editPara: TEditPara; (BEGIN ,editPara := TEditPara(obj); ,paragraph := TParagraph.CREATE(NIL, SELF.heap, editPara.size, editPara.format.dfltTStyle); ,paragraph.ReplPara(0, 0, editPara, 0, editPara.size); ,direcList.InsLast(paragraph); (END; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (nameStr := CreateString(SELF.name); (ingredList := TList.CREATE(NIL, SELF.Heap, 0); (SELF.ingredients.Each(InstallString); (direcList := TList.CREATE(NIL, SELF.Heap, 0); (SELF.directions.text.paragraphs.Each(AddParagraph); (recipe := TRecipe.CREATE(NIL, SELF.Heap, nameStr, ingredList, direcList); (DismantleImage := recipe; ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TRecipeImage.Draw; $VAR r: LRect; (i: INTEGER; (x: LONGINT; (y: LONGINT; (PROCEDURE DrawEach(obj: TObject); (BEGIN ,IF fDrawRects THEN 0BEGIN 0PenSize(1,1); 0FrameLRect(TTextImage(obj).extentLRect); 0END; ,SetQDTypeStyle(ingredStyle); ,WITH TTextImage(obj).extentLRect DO {$H-} 0BEGIN 0MoveToL(left - 6, (top+bottom) DIV 2 + 2); 0DrawChar(''); 0END; ,TTextImage(obj).Draw; (END; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (PenNormal; (SELF.name.Draw; (SELF.ingredients.Each(DrawEach); ({draw dashed line between ingredients and directions} (r := TTextImage(SELF.ingredients.Last).extentLRect; (x := 25; (y := r.bottom + 5; (PenSize(2,2); (FOR i := 1 TO 11 DO ,BEGIN ,MoveToL(x, y); ,LineToL(x + 30, y); ,x := x + 45; ,END; (IF fDrawRects THEN ,BEGIN ,PenSize(1,1); ,FrameLRect(SELF.directions.extentLRect); ,END; (SELF.directions.Draw; ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION TRecipeImage.ImageAt(mouseLPt: LPoint; VAR ingredIndex: LONGINT): TTextImage; $VAR hitTxtImage: TTextImage; (s: TListScanner; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (hitTxtImage := NIL; (ingredIndex := 0; (IF LPtInLRect(mouseLPt, SELF.name.extentLRect) THEN ,hitTxtImage := SELF.name (ELSE IF LPtInLRect(mouseLPt, SELF.directions.extentLRect) THEN ,hitTxtImage := SELF.directions (ELSE ,BEGIN ,s := SELF.ingredients.Scanner; ,WHILE s.Scan(hitTxtImage) DO 0IF LPtInLRect(mouseLPt, hitTxtImage.extentLRect) THEN 4BEGIN 4ingredIndex := s.position; 4s.Done; 4END; ,END; (ImageAt := hitTxtImage; ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TRecipeImage.MousePress(mouseLPt: LPoint); $VAR hitTxtImage: TTextImage; (noSelection: TSelection; (panelSelection: TSelection; (needNewSel: BOOLEAN; (ingredIndex: LONGINT; (heap: THeap; (textImage: TTextImage; ({$IFC debugMe} (str: S255; ({$ENDC} $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (heap := SELF.Heap; (panelSelection := SELF.view.panel.selection; ({The user has clicked the mouse in the recipe panel. The first thing we need to do is see )which textImage the mouse was over, if any} (hitTxtImage := SELF.ImageAt(mouseLPt, ingredIndex); ({$IFC debugMe} (IF fRecipeTrace THEN ,BEGIN ,LIntToHex(ORD(hitTxtImage), @str); ,WriteLn('** In TRecipeImage.MousePress, hitTxtImg = ', str); ,END; ({$ENDC} ({If the mouse was not over any textImage we simply want to Deselect} (IF hitTxtImage = NIL THEN ,{Calling BeginSelection automatically dehighlights and frees the current selection in all -panels and replaces them with a NoSelection. Note that in this application we override -this behaviour for the two left panels (see TBookSelection.DeSelect and TChapSelection.DeSelect)} ,SELF.view.panel.BeginSelection (ELSE ,BEGIN ,{The mouse was over a textImage so we want to create a cover selection specific to which -textImage was clicked upon. We will then call the textImage's MousePress which will -establish a textSelection in our cover selection's coSelection field. -First, however we need to see if we have already done the above on a previous click, since -if we click again on the same textImage there is no need to CREATE a whole new cover -selection. We discover we need to CREATE a new cover selection if there is no current -coSelection at all or, if there is one, it's textImage is not the one that we just now -clicked on} ,needNewSel := FALSE; ,IF panelSelection.coSelection = NIL THEN 0needNewSel := TRUE ,ELSE IF TTextSelection(panelSelection.coSelection).textImage <> hitTxtImage THEN 0needNewSel := TRUE; ,IF needNewSel THEN 0BEGIN 0SELF.view.panel.BeginSelection; 0IF hitTxtImage = SELF.name THEN 4BEGIN 4panelSelection := panelSelection.FreedAndReplacedBy( HTNameSelection.CREATE(NIL, heap, SELF.view, mouseLPt)); 4{Clicking on the recipe name requires special treatment because we want any editing 5of the title to be reflected in the title displayed in the chapter panel. Thus we 5call CreateSecondTxtImg which creates all the necessary data structures} 4textImage := TRecipeView(SELF.view).CreateSecondTxtImg; 4END 0ELSE IF hitTxtImage = SELF.directions THEN 4panelSelection := panelSelection.FreedAndReplacedBy( HTDirecSelection.CREATE(NIL, heap, SELF.view, mouseLPt)) 0ELSE 4panelSelection := panelSelection.FreedAndReplacedBy( HTIngredSelection.CREATE(NIL, heap, SELF.view, mouseLPt, TSELF.ingredients, ingredIndex)); 0{When we CREATE a cover selection, we need to set its coSelection field to NoSelection 1beacause MousePress below will try to Free and replace it with a textSelection} 0noSelection := SELF.view.NoSelection; 0panelSelection.coSelection := noSelection; 0END ,ELSE IF hitTxtImage = SELF.name THEN 0{The user has clicked a second or greater time on the name field in the recipe. 1Normally all selections are automatically turned off by the Text Building block 1in textImage.MousePress which would turn off the insertion point in the chapter 1panel, but it cannot automatically turn off selections in other panels if the 1selection is a coSelection of the panel selection, so we must do it ourselves here} 0BEGIN 0panelSelection := TMyWindow(SELF.view.panel.window).chapterPanel.selection.coSelection; 0TMyWindow(SELF.view.panel.window).chapterPanel.Highlight(panelSelection, hOnToOff); 0END; ,hitTxtImage.MousePress(mouseLPt); ,END; ({Until we can think of something better, always set changed flag if the user clicks here} (SELF.changed := TRUE; ({$IFC fTrace}EP;{$ENDC} $END; BEGIN {$IFC debugMe} $fDrawRects := FALSE; {$ENDC} END; METHODS OF TCookBookView; $FUNCTION TCookBookView.CREATE(object: TObject; heap: THeap; itsPanel: TPanel; `itsExtent: LRect): TCookBookView; $VAR aList: TList; (food: TFoodType; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TCookBookView(itsPanel.NewView(object, itsExtent, NIL, stdMargins, FALSE)); (FOR food := mainCourse TO dessert DO ,BEGIN ,aList := TList.CREATE(NIL, heap, 0); ,SELF.headings[food] := aList; ,END; ({$IFC fTrace}EP;{$ENDC} $END; #{$IFC fDebugMethods} $PROCEDURE TCookBookView.Fields(PROCEDURE Field(nameAndType: S255)); $BEGIN (SUPERSELF.Fields(Field); (Field('headings: ARRAY [1..5] OF TList'); (Field(''); $END; ${$ENDC} $PROCEDURE TCookBookView.Draw; $VAR food: TFoodType; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (PenNormal; (PenSize(1,1); (SetQDTypeStyle(cbStyle); (FOR food := mainCourse TO dessert DO ,BEGIN ,MoveToL(titlesLRect[food].left + 10, titlesLRect[food].top + 10); ,DrawString(foodTitles[food]); ,END; ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TCookBookView.MousePress(mouseLPt: LPoint); $VAR food: TFoodType; (bookSel: TBookSelection; (chapView: TChapterView; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (SELF.panel.BeginSelection; (bookSel := TBookSelection(SELF.panel.selection); (chapView := TChapterView(TMyWindow(SELF.panel.window).chapterPanel.view); (titlesLRect[noFood] := SELF.extentLrect; (food := mainCourse; (WHILE NOT LPtInLRect(mouseLPt, titlesLRect[food]) DO ,food := SUCC(food); (IF bookSel.currFood <> food THEN ,BEGIN ,SELF.panel.Highlight(bookSel, hOnToOff); ,bookSel.currFood := food; ,SELF.panel.Highlight(bookSel, hOffToOn); ,chapView.ChangeFood(food); ,END; ({$IFC fTrace}EP;{$ENDC} $END; {Creation Block} BEGIN ${SHOULD READ FROM PHRASE FILE!!!} $foodTitles[mainCourse] := 'Main Courses'; $foodTitles[soup] := 'Soups'; $foodTitles[appetizer] := 'Appetizers'; $foodTitles[sandwich] := 'Sandwiches'; $foodTitles[dessert] := 'Desserts'; $SetLRect(titlesLRect[mainCourse], 10, 5, 170, 20); $SetLRect(titlesLRect[soup], 10, 20, 170, 35); $SetLRect(titlesLRect[appetizer], 10, 35, 170, 50); $SetLRect(titlesLRect[sandwich], 10, 50, 170, 65); $SetLRect(titlesLRect[dessert], 10, 65, 170, 80); END; METHODS OF TChapterView; $FUNCTION TChapterView.CREATE(object: TObject; heap: THeap; itsPanel: TPanel; `itsExtent: LRect): TChapterView; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TChapterView(itsPanel.NewView(object, itsExtent, NIL, stdMargins, FALSE)); (WITH SELF DO ,BEGIN ,recipes := NIL; ,editImage := NIL; ,foodType := noFood; ,END; ({$IFC fTrace}EP;{$ENDC} $END; #{$IFC fDebugMethods} $PROCEDURE TChapterView.Fields(PROCEDURE Field(nameAndType: S255)); $BEGIN (SUPERSELF.Fields(Field); (Field('foodType: INTEGER'); (Field('recipes: TList'); (Field('editImage: TTextImage'); (Field(''); $END; ${$ENDC} $PROCEDURE TChapterView.ChangeFood(food: TFoodTypes); $VAR recipeView: TRecipeView; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} ({This forces the last commmand to Commit so we don't have to hang on to old data structures )just in case the user wants to Undo. (Hence, of course, the user cannot Undo after bringing )up a new chapter)} (SELF.panel.window.CommitLast; (SELF.panel.window.SaveCommand(NIL); (recipeView := TRecipeView(TMyWindow(SELF.panel.window).recipePanel.view); (recipeView.FreeRecipeImage; (SELF.foodType := food; (IF food = noFood THEN ,SELF.recipes := NIL (ELSE ,SELF.recipes := TCookBookView(TMyWindow(SELF.panel.window).cookBookPanel.view).headings[food]; (TChapSelection(SELF.panel.selection).recipeIndex := 0; (SELF.panel.Invalidate; ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION TChapterView.CursorAt(mouseLPt: LPoint): TCursorNumber; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (IF SELF.editImage <> NIL THEN ,IF LPtInLRect(mouseLPt, SELF.editImage.extentLRect) THEN 0CursorAt := textCursor ,ELSE 0CursorAt := arrowCursor (ELSE ,CursorAt := SUPERSELF.CursorAt(mouseLPt); ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TChapterView.Draw; $VAR r: LRect; (x: LONGINT; (y: LONGINT; (index: INTEGER; (theIndex: INTEGER; (PROCEDURE DrawIt(obj: TObject); (VAR name: TString; (BEGIN ,index := index + 1; ,IF index = theIndex THEN 0BEGIN 0TTextImage(TRecipeView(TMyWindow( 4SELF.panel.window).recipePanel.view).recipeImage.name.text.txtImgList.Last).Draw; 0SetQDTypeStyle(chapDfltStyle); 0END ,ELSE 0BEGIN 0MoveToL(x, y); 0name := TRecipe(obj).name; 0name.Draw(1, name.size); 0y := y + 14; 0END; (END; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (PenNormal; (SetQDTypeStyle(chapDfltStyle); (IF SELF.panel.selection.coSelection <> NIL THEN ,theIndex := TChapSelection(SELF.panel.selection).recipeIndex (ELSE ,theIndex := 0; (x := 10; (y := 14; (index := 0; (IF SELF.recipes <> NIL THEN ,IF SELF.recipes.size > 0 THEN 0SELF.recipes.Each(DrawIt) ,ELSE 0BEGIN 0MoveToL(10, 14); 0TextFace([italic]); 0DrawString('no recipes'); 0END; ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TChapterView.MousePress(mouseLPt: LPoint); $VAR recipe: TRecipe; (currRecipe: TRecipe; (recipeView: TRecipeView; (chapSelection: TChapSelection; (textImage: TTextImage; (index: INTEGER; (selection: TSelection; (noSelection: TSelection; (FUNCTION FindRecipe(lPt: LPoint): TRecipe; (VAR stillLooking: BOOLEAN; ,x: LONGINT; (BEGIN ,x := 14; ,index := 0; ,stillLooking := SELF.recipes.size > 0; ,WHILE stillLooking DO 0BEGIN 0index := index + 1; 0IF lPt.v < x THEN 4stillLooking := FALSE 0ELSE 4IF index >= SELF.recipes.size THEN 8BEGIN 8stillLooking := FALSE; 8index := 0; 8END 4ELSE 8x := x + 14; 0END; ,IF index = 0 THEN 0FindRecipe := NIL ,ELSE 0FindRecipe := TRecipe(SELF.recipes.At(index)); (END; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (IF SELF.recipes <> NIL THEN ,BEGIN ,recipe := FindRecipe(mouseLPt); ,recipeView := TRecipeView(TMyWindow(SELF.panel.window).recipePanel.view); ,chapSelection := TChapSelection(SELF.panel.selection); ,IF chapSelection.recipeIndex <> 0 THEN 0currRecipe := TRecipe(SELF.recipes.At(chapSelection.recipeIndex)) ,ELSE 0currRecipe := NIL; ,IF currRecipe <> recipe THEN 0BEGIN 0SELF.panel.BeginSelection; 0recipeView.ChangeRecipe(recipe); 0chapSelection.panel.Highlight(chapSelection, hOnToOff); 0chapSelection.recipeindex := index; 0chapSelection.panel.Highlight(chapSelection, hOffToOn); 0SELF.editImage := NIL; 0END ,ELSE IF recipe <> NIL THEN 0BEGIN 0{The user has clicked a second time on the same recipe name, which means she wants 1to edit it. Thus we need to set up a textImage in this panel that points to the 1same text object as the name in the recipe panel. When we do this, editing of the 1recipe name will be reflected in both panels simultaneously. CreateSecondTxtImg also 1unhighlights the chapterSelection and installs a NoSelection in its coSelection field. 1Notice that CreateSecondTxtImg is also called when the user clicks on the recipe name 1in the recipe panel (See TRecipeImage.MousePress)} 0IF chapSelection.coSelection = NIL THEN 4BEGIN 4SELF.panel.BeginSelection; 4textImage := recipeView.CreateSecondTxtImg; 4selection := recipeView.panel.selection.FreedAndReplacedBy( HTNameSelection.CREATE(NIL, SELF.Heap, recipeView, mouseLPt)); 4noSelection := recipeView.NoSelection; 4selection.coSelection := noSelection; 4textImage.MousePress(mouseLPt); 4END 0ELSE 4BEGIN 4{We must explicitly turn off the highlighting of the name in the recipe panel because 5the text building block is unable to do this automatically when coSelections are used} 4selection := recipeView.panel.selection.coSelection; 4recipeView.panel.Highlight(selection, hOnToOff); 4SELF.editImage.MousePress(mouseLPt); 4END 0END ,ELSE 0SELF.editImage := NIL; ,END; ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION TChapterView.NewRecipe(recipeName: STR255): TRecipe; $VAR itsName: TString; (firstIngred: TString; (itsIngredients: TList; (itsDirections: TList; (firstPara: TParagraph; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (itsName := TString.CREATE(NIL, SELF.Heap, Length(recipeName)); (itsName.InsPStrAt(1, @recipeName); (NewRecipe := TRecipe.CREATE(NIL, SELF.Heap, itsName, NIL, NIL); ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TRecipeView; $FUNCTION TRecipeView.CREATE(object: TObject; heap: THeap; itsPanel: TPanel; `itsExtent: LRect): TRecipeView; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TRecipeView(itsPanel.NewView(object, itsExtent, TPrintManager.CREATE(NIL, heap), pstdMargins, FALSE)); (WITH SELF DO ,BEGIN ,recipeImage := NIL; ,{The Reader may wish to use this field to disallow editing of recipes} ,canEdit := TRUE; ,END; ({$IFC fTrace}EP;{$ENDC} $END; #{$IFC fDebugMethods} $PROCEDURE TRecipeView.Fields(PROCEDURE Field(nameAndType: S255)); $BEGIN (SUPERSELF.Fields(Field); (Field('recipeImage: TRecipeImage'); (Field('canEdit: BOOLEAN'); (Field(''); $END; ${$ENDC} $PROCEDURE TRecipeView.ChangeRecipe(recipe: TRecipe); $VAR recipeImage: TRecipeImage; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} ({This forces the last commmand to Commit so we don't have to hang on to old data structures )just in case the user wants to Undo. (Hence, of course, the user cannot Undo after bringing )up a new recipe)} (SELF.panel.window.CommitLast; (SELF.panel.window.SaveCommand(NIL); (SELF.FreeRecipeImage; (IF recipe <> NIL THEN ,BEGIN ,recipeImage := recipe.MakeIntoImage(SELF); ,SELF.recipeImage := recipeImage; ,END; ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION TRecipeView.CreateSecondTxtImg: TTextImage; ${This routine is called when the user clicks on the recipe name either the first time in the recipe %panel (this view's panel) or the second time on the name in the chapterPanel. (See TRecipeImage. %MousePress and TChapterView.Mousepress.) Here we CREATE a TChapTextImage of the name in the %chapter panel. (See TChapTextImage.FilterAndDo for discussion of why we sub-classed TTextImage.) %Also in this routine we unhighlight the current chapter panel selection and install a NoSelection %in the coSelection field. The calling routine will next call textImage.MousePress to install the %textSelection in the coSelection. Finally, in this routine, we call RecomputeImages which will %compute the paraImage for the chapter panel} $VAR name: TTextImage; (textImage: TTextImage; (chapView: TChapterView; (r: LRect; (fInfo: FontInfo; (recipeIndex: LONGINT; (selection: TSelection; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (chapView := TChapterView(TMyWindow(SELF.panel.window).chapterPanel.view); (name := SELF.recipeImage.name; (recipeIndex := TChapSelection(chapView.panel.selection).recipeIndex; (SetQDTypeSTyle(chapDfltStyle); (GetFontInfo(fInfo); (SetLRect(r, 10, recipeIndex * 14 - fInfo.ascent, 150, (recipeIndex + 1) * 14 - fInfo.ascent); (textImage := TChapTextImage.CREATE(NIL, SELF.Heap, chapView, r, name.text, FALSE); (name.text.txtImgList.InsLast(textImage); (textImage.RecomputeImage(actionNone, TRUE); (chapView.panel.Highlight(chapView.panel.selection, hOnToOff); (selection := chapView.NoSelection; (chapView.panel.selection.coSelection := selection; (textImage.RecomputeImages(actionNone, TRUE); (SELF.recipeImage.changed := TRUE; (chapView.editImage := textImage; (CreateSecondTxtImg := textImage; ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION TRecipeView.CursorAt(mouseLPt: LPoint): TCursorNumber; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (IF SELF.recipeImage <> NIL THEN ,CursorAt := SELF.recipeImage.CursorAt(mouseLPt) (ELSE ,CursorAt := SUPERSELF.CursorAt(mouseLPt); ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TRecipeView.Draw; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (IF SELF.recipeImage <> NIL THEN ,SELF.recipeImage.Draw; ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TRecipeView.FreeRecipeImage; $VAR chapPanel: TPanel; (chapView: TChapterView; (chapSelection: TChapSelection; (recipe: TRecipe; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (IF SELF.recipeImage <> NIL THEN ,BEGIN ,IF SELF.recipeImage.changed THEN 0BEGIN 0recipe := SELF.recipeImage.DismantleImage; 0chapPanel := TMyWindow(SELF.panel.window).chapterPanel; 0chapView := TChapterView(chapPanel.view); 0chapSelection := TChapSelection(chapPanel.selection); 0chapView.recipes.PutAt(chapSelection.recipeIndex, recipe, TRUE); 0END; ,SELF.recipeImage.Free; ,SELF.recipeImage := NIL; ,END; (SELF.panel.Invalidate; ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TRecipeView.MousePress(mouseLPt: LPoint); $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (IF SELF.canEdit AND (SELF.recipeImage <> NIL) THEN ,SELF.recipeImage.MousePress(mouseLPt) (ELSE ,BEGIN ,{Alert about can't edit; use menu to enable; (based on recipeImage NIL or not} {*} ,END; ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TRecipeView.ScrollStuff(ingredIndex: LONGINT; moveDown: BOOLEAN); {This routine is called when an ingredient is inserted or deleted. It updates the appropriate text image's extentLRects and then calls QuickDraw's ScrollRect to Scroll the correct portion of the view up or down. Notice we use ScrollRect here instead of the normal paradigm of invalidating a portion of the screen and waiting for TWindow.Update to tell us to Draw. We're doing it here for speed; scrolling is faster than redrawing, but we have to know exactly what's going on on the screen lest we scroll something that should not have moved} $VAR recipeImage: TRecipeImage; (delta: INTEGER; (scanIndex: LONGINT; (s: TListScanner; (textImage: TTextImage; (deltaLPt: LPoint; (lr: LRect; (r: Rect; (top: LONGINT; (PROCEDURE ScrollIt; (BEGIN ,thePad.LRectToRect(lr, r); ,ScrollRect(r, 0, delta, rHandle); ,thePad.InvalRect(rHandle^^.rgnBBox); (END; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (recipeImage := SELF.recipeImage; (IF moveDown THEN ,BEGIN ,scanIndex := ingredIndex; ,delta := ingredHeight; ,END (ELSE ,BEGIN ,scanIndex := ingredIndex - 1; ,delta := -ingredHeight; ,END; (SetLPt(deltaLpt, 0, delta); (s := recipeImage.ingredients.ScannerFrom(scanIndex, scanForward); (WHILE s.Scan(textImage) DO ,textImage.OffSetBy(deltaLPt); (recipeImage.directions.OffsetBy(deltaLPt); (IF ingredIndex <= recipeImage.ingredients.size THEN ,top := TTextImage(recipeImage.ingredients.At(ingredIndex)).extentLRect.top (ELSE ,top := TTextImage(recipeImage.ingredients.Last).extentLRect.bottom; (SetLRect(lr, 0, top, 500, SELF.extentLRect.bottom); (SELF.panel.OnAllPadsDo(ScrollIt); ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TRecipeClipView; $FUNCTION TRecipeClipView.CREATE(object: TObject; heap: THeap; itsPanel: TPanel; itsExtent: LRect; PitsFoodType: TFoodType; itsRecipe: TRecipe): TRecipeClipView; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TRecipeClipView(itsPanel.NewView(object, itsExtent, NIL, stdMargins, FALSE)); (WITH SELF DO ,BEGIN ,foodType := itsFoodType; ,recipe := itsRecipe; ,END; ({$IFC fTrace}EP;{$ENDC} $END; #{$IFC fDebugMethods} $PROCEDURE TRecipeClipView.Fields(PROCEDURE Field(nameAndType: S255)); $BEGIN (SUPERSELF.Fields(Field); (Field('foodType: INTEGER'); (Field('recipe: TRecipe'); (Field(''); $END; ${$ENDC} $PROCEDURE TRecipeClipView.Draw; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (IF SELF.recipe <> NIL THEN ,BEGIN ,SetQDTypeStyle(nameInRecipeStyle); ,MoveToL(10, 10); ,SELF.recipe.name.Draw(1, SELF.recipe.name.size); ,END; ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TClipSelection; $FUNCTION TClipSelection.CREATE(object: TObject; heap: THeap; itsView: TView): TClipSelection; $BEGIN ({$IFC fTrace}BP(9);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TClipSelection(TSelection.CREATE(object, heap, itsView, somethingKind, zeroLPt)); ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TBookSelection; $FUNCTION TBookSelection.CREATE(object: TObject; heap: THeap; itsView: TView; GitsAnchorLPt: LPoint; whatFood: TFoodTypes): TBookSelection; $BEGIN ({$IFC fTrace}BP(9);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TBookSelection(TSelection.CREATE(object, heap, itsView, somethingKind, itsAnchorLPt)); (SELF.currFood := whatFood; ({$IFC fTrace}EP;{$ENDC} $END; #{$IFC fDebugMethods} $PROCEDURE TBookSelection.Fields(PROCEDURE Field(nameAndType: S255)); $BEGIN (SUPERSELF.Fields(Field); (Field('currFood: INTEGER'); (Field(''); $END; ${$ENDC} $PROCEDURE TBookSelection.Deselect; $VAR selection: TSelection; $BEGIN ({$IFC fTrace}BP(7);{$ENDC} ({When a selection is created, panel.BeginSelection is called which calls selection.Deselect )for each panel in the window. The default of Deselect is to unHighlight and replace SELF )with a noSelection. But in our case we don't want to do either of those when someone is )editing in the recipe panel so we override deselect to do nothing} ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TBookSelection.Highlight(highTransit: THighTransit); $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (SetPenState(highPen[highTransit]); (IF (SELF.currFood <> noFood) AND TMyWindow(SELF.window).okayToHilite THEN ,CASE highTransit OF 0hOnToDim: 4BEGIN 4InvrtLRect(titlesLRect[SELF.currFood]); {this is the same as hOnToOff} 4SELF.Highlight(hOffToDim); {this is NOT the same as just doing `FrameLRect(titlesLRect[SELF.currFood]); ]because the pen state is different} 4END; 0hDimToOn: 4BEGIN 4SELF.Highlight(hDimToOff); 4InvrtLRect(titlesLRect[SELF.currFood]); {this is the same as hOnToOff} 4END; 0hOffToDim, hDimToOff: 4BEGIN 4FrameLRect(titlesLRect[SELF.currFood]); 4END; 0OTHERWISE 4PaintLRect(titlesLRect[SELF.currFood]); ,END; ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TTextCoverSelection; $FUNCTION TTextCoverSelection.CREATE(object: TObject; heap: THeap; itsView: TView; XitsAnchorLPt: LPoint): TTextCoverSelection; $BEGIN ({$IFC fTrace}BP(9);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TTextCoverSelection(TSelection.CREATE(object, heap, itsView, somethingKind, itsAnchorLPt)); ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION TTextCoverSelection.CanDoCommand(cmdNumber: TCmdNumber; VAR checkIt: BOOLEAN): BOOLEAN; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (CASE cmdNumber OF ,uModern, uClassic, u20Pitch, u15Pitch, u12Pitch, u10Pitch, ,u12Point, u14Point, u18Point, u24Point: 0BEGIN 0CanDoCommand := FALSE; 0END; ,uPlain, uBold, uItalic, uUnderline, uShadow, uOutline: 0BEGIN 0CanDoCommand := FALSE; 0END; ,uPaste: 0BEGIN 0CanDoCommand := FALSE; 0END; ,OTHERWISE 0CanDoCommand := SUPERSELF.CanDoCommand(cmdNumber, checkIt); ,END; ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TChapSelection; $FUNCTION TChapSelection.CREATE(object: TObject; heap: THeap; itsView: TView; GitsAnchorLPt: LPoint): TChapSelection; $BEGIN ({$IFC fTrace}BP(9);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TChapSelection(TSelection.CREATE(object, heap, itsView, somethingKind, itsAnchorLPt)); (WITH SELF DO ,BEGIN ,recipeIndex := 0; ,END; ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TChapSelection.Free; $BEGIN ({$IFC fTrace}BP(9);{$ENDC} (IF SELF.coSelection <> NIL THEN ,TChapTextImage(TTextSelection(SELF.coSelection).textImage).ChangeRefCountBy(-1); (SUPERSELF.Free; ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION TChapSelection.Clone(heap: THeap): TObject; $BEGIN ({$IFC fTrace}BP(9);{$ENDC} (Clone := SUPERSELF.Clone(heap); (IF SELF.coSelection <> NIL THEN ,TChapTextImage(TTextSelection(SELF.coSelection).textImage).ChangeRefCountBy(1); ({$IFC fTrace}EP;{$ENDC} $END; #{$IFC fDebugMethods} $PROCEDURE TChapSelection.Fields(PROCEDURE Field(nameAndType: S255)); $BEGIN (SUPERSELF.Fields(Field); (Field('recipeIndex: INTEGER'); (Field(''); $END; ${$ENDC} $PROCEDURE TChapSelection.AddRecipe(recipeName: STR255); $VAR chapView: TChapterView; (str: STR255; (newRecipe: TRecipe; (s: TListScanner; (recipe: TRecipe; (inserted: BOOLEAN; (recipes: TList; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} ,chapView := TChapterView(SELF.view); ,recipes := chapView.recipes; ,newRecipe := chapView.NewRecipe(recipeName); ,TRecipeView(TMyWindow(SELF.window).recipePanel.view).ChangeRecipe(newRecipe); ,s := recipes.Scanner; ,inserted := FALSE; ,WHILE s.Scan(recipe) DO 0BEGIN 0recipe.name.ToPStr(@str); 0IF recipeName < str THEN 4BEGIN 4inserted := TRUE; 4SELF.recipeIndex := s.position; 4s.Skip(-1); 4s.Append(newRecipe); 4s.Done; 4END; 0END; ,IF NOT inserted THEN 0BEGIN 0recipes.InsLast(newRecipe); 0SELF.recipeIndex := recipes.size; 0END; ,chapView.panel.Invalidate; ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TChapSelection.Deselect; $VAR selection: TSelection; $BEGIN ({$IFC fTrace}BP(7);{$ENDC} ({When a selection is created, panel.BeginSelection is called which calls selection.Deselect )for each panel in the window. The default of Deselect is to unHighlight and replace SELF )with a NoSelection. But in our case we want the recipe name to remain highlighted when )someone is editing in the recipe panel so we override Deselect so that it does not Free )the selection. )However, if someone was editing the recipe name, then we want to, unhighlight whatever )textSelections existed and rehighlight the entire recipe name} )IF SELF.coSelection <> NIL THEN ,BEGIN ,SELF.panel.Highlight(SELF.coSelection, hOnToOff); ,TChapTextImage(TTextSelection(SELF.coSelection).textImage).ChangeRefCountBy(-1); ,SELF.coSelection.Free; ,SELF.coSelection := NIL; ,SELF.panel.Highlight(SELF, hOffToOn); ,END; ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TChapSelection.Highlight(highTransit: THighTransit); $VAR r: LRect; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (SetPenState(highPen[highTransit]); (IF SELF.coSelection = NIL THEN ,BEGIN ,IF (SELF.recipeIndex <> 0) AND TMyWindow(SELF.window).okayToHilite THEN 0BEGIN 0SetLRect(r, 5, SELF.recipeIndex*14 - 10, 150, SELF.recipeIndex*14 + 4); 0CASE highTransit OF 4hOnToDim: 8BEGIN 8InvrtLRect(r); {this is the same as hOnToOff} 8SELF.Highlight(hOffToDim); {this is NOT the same as just doing dFrameLRect(titlesLRect[SELF.currFood]); abecause the pen state is different} 8END; 4hDimToOn: 8BEGIN 8SELF.Highlight(hDimToOff); 8InvrtLRect(r); {this is the same as hOnToOff} 8END; 4hOffToDim, hDimToOff: 8BEGIN 8FrameLRect(r); 8END; 4OTHERWISE 8PaintLRect(r); 4END; 0END; ,END (ELSE ,SELF.coSelection.Highlight(highTransit); ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TChapSelection.KeyReturn; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} ({We don't want to allow multiple paragraphs when someone is editing the name, so we )override KeyReturn to do nothing} ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION TChapSelection.NewCommand(cmdNumber: TCmdNumber): TCommand; $VAR heap: THeap; (inputString: S255; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (heap := SELF.heap; (NewCommand := NIL; (CASE cmdNumber OF ,{Adding a recipe is NOT undoable. We do not create a command here, although AddRecipe -indirectly Commits the last command via TRecipeView.ChangeRecipe. The user can simply -delete the recipe if she didn't really want it} ,uAddRecipe: 0BEGIN 0TMyWindow(SELF.window).inputFrame.GetContents(inputString); 0IF inputString <> '' THEN 4SELF.AddRecipe(inputString); 0TMyWindow(SELF.window).recipePanel.selection.MarkChanged; 0END; ,OTHERWISE 0NewCommand := SUPERSELF.NewCommand(cmdNumber); ,END; ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TNameSelection; $FUNCTION TNameSelection.CREATE(object: TObject; heap: THeap; itsView: TView; XitsAnchorLPt: LPoint): TNameSelection; $BEGIN ({$IFC fTrace}BP(9);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TNameSelection(TTextCoverSelection.CREATE(object, heap, itsView, itsAnchorLPt)); ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TNameSelection.KeyReturn; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} ({We don't want to allow multiple paragraphs when someone is editing the name, so we )override KeyReturn to do nothing} ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TIngredSelection; $FUNCTION TIngredSelection.CREATE(object: TObject; heap: THeap; itsView: TView; XitsAnchorLPt: LPoint; itsIngredients: TList; Xindex: INTEGER): TIngredSelection; $BEGIN ({$IFC fTrace}BP(9);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TIngredSelection(TTextCoverSelection.CREATE(object, heap, itsView, itsAnchorLPt)); (WITH SELF DO ,BEGIN ,ingredients := itsIngredients; ,ingredIndex := index; ,END; ({$IFC fTrace}EP;{$ENDC} $END; #{$IFC fDebugMethods} $PROCEDURE TIngredSelection.Fields(PROCEDURE Field(nameAndType: S255)); $BEGIN (SUPERSELF.Fields(Field); (Field('ingredients: TList'); (Field('ingredIndex: INTEGER'); (Field(''); $END; ${$ENDC} $FUNCTION TIngredSelection.CanDoCommand(cmdNumber: TCmdNumber; VAR checkIt: BOOLEAN): BOOLEAN; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (CASE cmdNumber OF ,uAddIngred, uInsIngred: 0BEGIN 0CanDoCommand := TRUE; 0END; ,uDeleteIngred: 0BEGIN 0CanDoCommand := SELF.ingredients.size > 1; 0END; ,OTHERWISE 0CanDoCommand := SUPERSELF.CanDoCommand(cmdNumber, checkIt); ,END; ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TIngredSelection.KeyReturn; $VAR recipeImage: TRecipeImage; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (recipeImage := TRecipeView(SELF.view).recipeImage; (SELF.coSelection.KeyPause; (IF SELF.ingredIndex = recipeImage.ingredients.size THEN ,SELF.window.PerformCommand(TAddIngredCmd.CREATE(NIL, SELF.Heap, SELF.view, uAddIngredient, \SELF.ingredients, SELF.ingredIndex + 1)) (ELSE ,SELF.view.MousePress(TTextImage(SELF.ingredients.At(SELF.ingredIndex+1)).extentLRect.topLeft); ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TIngredSelection.KeyTab(fBackward: BOOLEAN); $VAR textRange: TTextRange; (textImage: TTextImage; (str: S255; (selection: TSelection; (i: INTEGER; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (textRange := TTextSelection(SELF.coSelection).textRange; (textImage := TTextSelection(SELF.coSelection).textImage; (IF textRange.firstLP < tabColumn THEN ,BEGIN ,IF tabColumn > textRange.firstPara.size THEN 0BEGIN 0str := ''; 0FOR i := 1 TO tabColumn - textRange.firstPara.size DO 4str := Concat(str, ' '); 0textRange.firstPara.ReplPStr(textRange.firstPara.size, 0, @str); 0TParaImage(textImage.imageList.First).InvalLinesWith(0, MAXINT); 0textImage.text.RecomputeImages; 0END; ,SELF.coSelection.panel.Highlight(SELF.coSelection, hOnToOff); ,selection := SELF.coSelection.FreedAndReplacedBy(TInsertionPoint.CREATE(NIL, SELF.Heap, @SELF.view, textImage, zeroLPt, textRange.firstPara, 1, tabColumn)); ,selection.panel.Highlight(selection, hOffToOn); ,END; ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION TIngredSelection.NewCommand(cmdNumber: TCmdNumber): TCommand; $VAR heap: THeap; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (heap := SELF.heap; (CASE cmdNumber OF ,uAddIngred, uInsIngred: 0BEGIN 0NewCommand := TAddIngredCmd.CREATE(NIL, heap, SELF.view, cmdNumber, SELF.ingredients, LSELF.ingredIndex + (uInsIngred - cmdNumber)); 0END; ,uDeleteIngred: 0NewCommand := TDelIngredCmd.CREATE(NIL, heap, SELF.view, YSELF, SELF.ingredients, SELF.ingredIndex); ,OTHERWISE 0NewCommand := SUPERSELF.NewCommand(cmdNumber); ,END; ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TDirecSelection; $FUNCTION TDirecSelection.CREATE(object: TObject; heap: THeap; itsView: TView; XitsAnchorLPt: LPoint): TDirecSelection; $BEGIN ({$IFC fTrace}BP(9);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TDirecSelection(TTextCoverSelection.CREATE(object, heap, itsView, itsAnchorLPt)); ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION TDirecSelection.CanDoCommand(cmdNumber: TCmdNumber; VAR checkIt: BOOLEAN): BOOLEAN; (VAR dummy: BOOLEAN; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (CASE cmdNumber OF ,u18Point, u24Point: 0BEGIN 0CanDoCommand := FALSE; {don't allow these sizes} 0END; ({for the command numbers ,uModern, uClassic, u20Pitch, u15Pitch, u12Pitch, u10Pitch, ,u12Point, u14Point, ,uPlain, uBold, uItalic, uUnderline, uShadow, uOutline )we can just call SELF.coSelection.CanDoCommand because we know that we have a coSelection that )is a TTextSelection. TTextSelections always enable typestyle commands and (at no extra )charge) check off the appropriate menu items.} ,uModern, uClassic, u20Pitch, u15Pitch, u12Pitch, u10Pitch, ,u12Point, u14Point, ,uPlain, uBold, uItalic, uUnderline, uShadow, uOutline: 0CanDoCommand := SELF.coSelection.CanDoCommand(cmdNumber, checkIt); ,uPaste: {allow pasting into the directions} 0BEGIN 0CanDoCommand := TRUE; 0END; ,OTHERWISE 0CanDoCommand := SUPERSELF.CanDoCommand(cmdNumber, checkIt); ,END; ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TChapTextImage; $FUNCTION TChapTextImage.CREATE(object: TObject; heap: THeap; itsView: TView; DitsLRect: LRect; itsText: TText; isGrowable: BOOLEAN): TChapTextImage; $VAR imgList: TList; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TChapTextImage(TTextImage.CREATE(object, heap, itsView, itsLRect, itsText, isGrowable)); (SELF.refCount := 1; ({$IFC fTrace}EP;{$ENDC} $END; #{$IFC fDebugMethods} $PROCEDURE TChapTextImage.Fields(PROCEDURE Field(nameAndType: S255)); $BEGIN (SUPERSELF.Fields(Field); (Field('refCount: INTEGER'); (Field(''); $END; ${$ENDC} $PROCEDURE TChapTextImage.ChangeRefCountBy(delta: INTEGER); $VAR editPara: TEditPara; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (SELF.refCount := SELF.refCount + delta; (IF SELF.refCount <= 0 THEN ,BEGIN ,TChapterView(SELF.view).editImage := NIL; ,editPara := TEditPara(SELF.text.paragraphs.First); ,editPara.images.DelObject(SELF.imageList.First, FALSE); ,SELF.text.txtImgList.DelObject(SELF, TRUE); ,END; ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TChapTextImage.FilterAndDo(actualObj: TObject; PROCEDURE DoToObject(filteredObj: TObject)); $VAR saveStyles: TArray; (saveDflt: TTypeStyle; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} ({This procedure does our own bit of filtering on the paragraph. We're getting a little fancy )in that when the recipe name is being edited we want the editing to be reflected in both panels )at the same time. However, we want the names in the two panels to appear in a different type )style. Since all access to the paragraph's typeStyles goes through FilterAndDo, we override )it to stuff in our version of the paragraph's character runs array. Notice that we can only )do this because we don't allow typeStyle changes on the recipe title. If we did, this would )cause strange ambiguities with conflicting filters. (I don't even want to think about it!)} (saveStyles := TParaImage(actualObject).paragraph.typeStyles; (saveDflt := TParaImage(actualObject).paragraph.format.dfltTStyle; (TParaImage(actualObject).paragraph.typeStyles := chapStyles; (TParaImage(actualObject).paragraph.format.dfltTStyle := chapDfltStyle; (SUPERSELF.FilterAndDo(actualObject, DoToObject); (TParaImage(actualObject).paragraph.typeStyles := saveStyles; (TParaImage(actualObject).paragraph.format.dfltTStyle := saveDflt; ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION TChapTextImage.NewParaImage(itsParagraph: TEditPara; itsLRect: LRect; DlineTop: LONGINT; lineLeft: LONGINT): TParaImage; $VAR paraImage: TParaImage; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (paraImage := TChapParaImage.CREATE(NIL, SELF.Heap, SELF.view, itsParagraph, itsLRect, lineTop, KlineLeft); (paraImage.textImage := SELF; (itsParagraph.InsImage(paraImage); (NewParaImage := paraImage; ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TChapParaImage; $FUNCTION TChapParaImage.CREATE(object: TObject; heap: THeap; itsView: TView; itsParagraph: TEditPara; ?itsLRect: LRect; lineTop: LONGINT; lineLeft: LONGINT): TChapParaImage; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TChapParaImage(TParaImage.CREATE(object, heap, itsView, itsParagraph, itsLRect, XlineTop, lineLeft)); ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TChapParaImage.FilterAndDo{(actualObj: TObject; PROCEDURE DoToObject(filteredObj: TObject))}; $VAR saveStyles: TArray; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} ({See the comments for TChapTextImage.FilterAndDo} (SELF.textImage.FilterAndDo(actualObj, DoToObject); ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TAddIngredCmd; $FUNCTION TAddIngredCmd.CREATE(object: TObject; heap: THeap; itsImage: TImage; cmdNumber: TCmdNumber; SitsIngredients: TList; itsIndex: INTEGER): TAddIngredCmd; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TAddIngredCmd(TCommand.CREATE(object, heap, cmdNumber, itsImage, FALSE, revealAll)); (WITH SELF DO ,BEGIN ,ingredients := itsIngredients; ,ingredIndex := itsIndex; ,unHiliteBefore[doPhase] := FALSE; ,unHiliteBefore[redoPhase] := FALSE; ,END; ({$IFC fTrace}EP;{$ENDC} $END; {$IFC fDebugMethods} $PROCEDURE TAddIngredCmd.Fields(PROCEDURE Field(nameAndType: S255)); $BEGIN (SUPERSELF.Fields(Field); (Field('ingredients: TList'); (Field('ingredIndex: INTEGER'); (Field(''); $END; {$ENDC} $PROCEDURE TAddIngredCmd.Perform(cmdPhase: TCmdPhase); $VAR textImage: TTextImage; (text: TText; (imageLRect: LRect; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (CASE cmdPhase OF ,doPhase, redoPhase: 0BEGIN 0text := TText.CREATE(NIL, SELF.Heap, TMyWindow(TView(SELF.image).panel.window).styleSheet); 0imageLRect := TTextImage(SELF.ingredients.At( LMin(SELF.ingredIndex, SELF.ingredients.size))).extentLRect; 0IF SELF.ingredIndex > SELF.ingredients.size THEN 4OffSetLRect(imageLRect, 0, ingredHeight); 0textImage := text.DfltTextImage(TView(SELF.image), imageLRect, FALSE); 0SELF.ingredients.InsAt(SELF.ingredIndex, textImage); 0TRecipeView(SELF.image).ScrollStuff(SELF.ingredIndex, TRUE); 0TRecipeView(SELF.image).MousePress(textImage.extentLRect.topLeft); 0END; ,undoPhase: 0BEGIN 0END; ,END; (TView(SELF.image).panel.selection.MarkChanged; ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TDelIngredCmd; $FUNCTION TDelIngredCmd.CREATE(object: TObject; heap: THeap; itsImage: TImage; PitsSelection: TIngredSelection; PitsIngredients: TList; itsIndex: INTEGER): TDelIngredCmd; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TDelIngredCmd(TCommand.CREATE(object, heap, uDeleteIngred, itsImage, TRUE, revealAll)); (WITH SELF DO ,BEGIN ,ingredients := itsIngredients; ,ingredIndex := itsIndex; ,ingredSelection := itsSelection; ,unHiliteBefore[undoPhase] := FALSE; ,END; ({$IFC fTrace}EP;{$ENDC} $END; {$IFC fDebugMethods} $PROCEDURE TDelIngredCmd.Fields(PROCEDURE Field(nameAndType: S255)); $BEGIN (SUPERSELF.Fields(Field); (Field('ingredients: TList'); (Field('ingredIndex: INTEGER'); (Field('ingredSelection: TIngredSelection'); (Field('saveTextImage: TTextImage'); (Field(''); $END; {$ENDC} $PROCEDURE TDelIngredCmd.Commit; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (IF SELF.saveTextImage <> NIL THEN ,SELF.saveTextImage.text.Free; ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TDelIngredCmd.Perform(cmdPhase: TCmdPhase); $VAR textImage: TTextImage; (mouseLPt: LPoint; (newIndex: LONGINT; (selection: TSelection; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (CASE cmdPhase OF ,doPhase, redoPhase: 0BEGIN 0textImage := TTextImage(SELF.ingredients.At(SELF.ingredIndex)); 0SELF.saveTextImage := textImage; 0SELF.ingredients.DelAt(SELF.ingredIndex, FALSE); 0newIndex := Min(SELF.ingredIndex, SELF.ingredients.size); 0textImage := TTextImage(SELF.ingredients.At(newIndex)); 0selection := SELF.ingredSelection.coSelection.FreedAndReplacedBy( DTInsertionPoint.CREATE( LNIL, SELF.Heap, TView(SELF.image), textImage, LzeroLPt, TEditPara(textImage.text.paragraphs.First), 1, 0)); 0TRecipeView(SELF.image).ScrollStuff(SELF.ingredIndex, FALSE); 0END; ,undoPhase: 0BEGIN 0SELF.ingredients.InsAt(SELF.ingredIndex, SELF.saveTextImage); 0TRecipeView(SELF.image).ScrollStuff(SELF.ingredIndex, TRUE); 0TRecipeView(SELF.image).MousePress(SELF.saveTextImage.extentLRect.topLeft); 0END; ,END; (TView(SELF.image).panel.selection.MarkChanged; ({$IFC fTrace}EP;{$ENDC} $END; END; {An exercise for the reader is to make this undoable; then, of course you would not need to confirm $the command with the user in TMyWindow.NewCommand.} METHODS OF TDelRecipeCmd; $FUNCTION TDelRecipeCmd.CREATE(object: TObject; heap: THeap; itsImage: TImage; hitsIndex: INTEGER): TDelRecipeCmd; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TDelRecipeCmd(TCommand.CREATE(object, heap, uDeleteRecipe, itsImage, FALSE, revealAll)); (WITH SELF DO ,BEGIN ,recipeIndex := itsIndex; ,END; ({$IFC fTrace}EP;{$ENDC} $END; {$IFC fDebugMethods} $PROCEDURE TDelRecipeCmd.Fields(PROCEDURE Field(nameAndType: S255)); $BEGIN (SUPERSELF.Fields(Field); (Field('recipeIndex: INTEGER'); (Field(''); $END; {$ENDC} $PROCEDURE TDelRecipeCmd.Commit; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TDelRecipeCmd.Perform(cmdPhase: TCmdPhase); $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (CASE cmdPhase OF ,doPhase: 0BEGIN 0END; ,redoPhase: 0BEGIN 0END; ,undoPhase: 0BEGIN 0END; ,END; ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TCopyRecipeCmd; $FUNCTION TCopyRecipeCmd.CREATE(object: TObject; heap: THeap; HitsImage: TImage; itsIndex: INTEGER): TCopyRecipeCmd; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TCopyRecipeCmd( 8TCutCopyCommand.CREATE(object, heap, uCopyRecipe, itsImage, FALSE)); (WITH SELF DO ,BEGIN ,recipeIndex := itsIndex; ,END; ({$IFC fTrace}EP;{$ENDC} $END; {$IFC fDebugMethods} $PROCEDURE TCopyRecipeCmd.Fields(PROCEDURE Field(nameAndType: S255)); $BEGIN (SUPERSELF.Fields(Field); (Field('recipeIndex: INTEGER'); (Field(''); $END; {$ENDC} $PROCEDURE TCopyRecipeCmd.DoCutCopy(clipSelection: TSelection; deleteOriginal: BOOLEAN; IcmdPhase: TCmdPhase); $VAR clipHeap: THeap; (clipPanel: TPanel; (clipView: TRecipeClipView; (viewLRect: LRect; (clipRecipe: TRecipe; (selection: TSelection; (recipeImage: TRecipeImage; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (CASE cmdPhase OF ,doPhase, redoPhase: 0BEGIN 0clipHeap := clipSelection.heap; 0clipPanel := clipSelection.panel; 0recipeImage := TRecipeView(TMyWindow(TView( HSELF.image).panel.window).recipePanel.view).recipeImage; 0IF recipeImage.changed THEN 4clipRecipe := recipeImage.DismantleImage 0ELSE 4clipRecipe := TRecipe(TChapterView(SELF.image).recipes.At(SELF.recipeIndex)); 0clipRecipe := TRecipe(clipRecipe.Clone(clipHeap)); 0SetLRect(viewLRect, 0, 0, 500, 100); 0clipView := TRecipeClipView.CREATE(NIL, clipHeap, clipPanel, viewLRect, \TChapterView(SELF.image).foodType, clipRecipe); 0selection := clipSelection.FreedAndReplacedBy(TClipSelection.CREATE(NIL, clipHeap, clipView)); 0END; ,undoPhase: 0BEGIN 0END; ,END; (TView(SELF.image).panel.selection.MarkChanged; ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TPasteRecipeCmd; $FUNCTION TPasteRecipeCmd.CREATE(object: TObject; heap: THeap; itsImage: TImage): TPasteRecipeCmd; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TPasteRecipeCmd(TPasteCommand.CREATE(object, heap, uPasteRecipe, itsImage)); (SELF.undoable := FALSE; ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE TPasteRecipeCmd.DoPaste(clipSelection: TSelection; Ppic: PicHandle; cmdPhase: TCmdPhase); $VAR clipView: TRecipeClipView; (recipe: TRecipe; (pasteRecipe: TRecipe; (myWindow: TMyWindow; (recipeView: TRecipeView; (chapView: TChapterView; (recipes: TList; (s: TListScanner; (inserted: BOOLEAN; (recipeName: S255; (str: S255; (recipeImage: TRecipeImage; (bookSel: TBookSelection; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (CASE cmdPhase OF ,doPhase, redoPhase: 0BEGIN 0IF InClass(clipSelection.view, TRecipeClipView) THEN 4BEGIN 4clipView := TRecipeClipView(clipSelection.view); 4pasteRecipe := TRecipe(clipView.recipe.Clone(SELF.Heap)); 4myWindow := TMyWindow(TView(SELF.image).panel.window); 4myWindow.okayToHilite := TRUE; 4recipeView := TRecipeView(myWindow.recipePanel.view); 4chapView := TChapterView(myWindow.chapterPanel.view); 4recipes := TCookBookView(myWindow.cookBookPanel.view).headings[clipView.foodType]; 4pasteRecipe.name.ToPStr(@recipeName); 4s := recipes.Scanner; 4inserted := FALSE; 4WHILE s.Scan(recipe) DO 8BEGIN 8recipe.name.ToPStr(@str); 8IF recipeName < str THEN  noFood; ,uDeleteRecipe: 0WITH SELF.chapterPanel DO 8{We are always assured of having a TChapSelection in the chapterPanel,  NIL) AND D(TChapSelection(selection).recipeIndex <> 0); {$IFC debugMe} ,cmdRefresh: 0CanDoCommand := TRUE; ,uDrawRects: 0BEGIN 0CanDoCommand := TRUE; 0checkIt := fDrawRects; 0END; ,uTraceRecipe: 0BEGIN 0CanDoCommand := TRUE; 0checkIt := fRecipeTrace; 0END; {$ENDC} ,uCopyRecipe: 0BEGIN 0CanDoCommand := TRecipeView(SELF.recipePanel.view).recipeImage <> NIL; 0END; ,uPasteRecipe: 0BEGIN 0clipboard.Inspect; 0CanDoCommand := clipBoard.hasView; 0END; ,uOneColumn: 0BEGIN 0CanDoCommand := FALSE; {recipe panel has contents} {*} 0checkIt := FALSE; {currentlyOneColumn} 0END; ,uTwoColumn: 0BEGIN 0CanDoCommand := FALSE; {recipe panel has contents} 0checkIt := FALSE; {currentlyTwoColumn} {*} 0END; ,OTHERWISE 0CanDoCommand := SUPERSELF.CanDoCommand(cmdNumber, checkIt); ,END; ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION TMyWindow.NewCommand(cmdNumber: TCmdNumber): TCommand; $VAR selection: TSelection; (chapView: TChapterView; (chapSel: TChapSelection; (recipe: TRecipe; (oldRecipe: TRecipe; (s: S255; (newIndex: INTEGER; (PROCEDURE InvalAll(obj: TObject); (BEGIN ,TPanel(obj).Invalidate; (END; $BEGIN ({$IFC fTrace}BP(12);{$ENDC} (NewCommand := NIL; (CASE cmdNumber OF ,uRecipeDialog: 0IF SELF.dialogBox = NIL THEN 4BEGIN 4SELF.chapterPanel.BeginSelection; 4SELF.PutUpDialogBox(SELF.dialogWindow); 4SELF.inputFrame.SupplantContents(''); 4SELF.dialog.SelectInputFrame(SELF.inputFrame); 4END; ,uCopyRecipe: 0BEGIN 0NewCommand := TCopyRecipeCmd.CREATE(NIL, SELF.Heap, SELF.chapterPanel.view, TTChapSelection(SELF.chapterPanel.selection).recipeIndex); 0END; ,uPasteRecipe: 0BEGIN 0NewCommand := TPasteRecipeCmd.CREATE(NIL, SELF.Heap, SELF.cookBookPanel.view); 0END; ,uDeleteRecipe: 0BEGIN 0WITH SELF.chapterPanel DO 4BEGIN 4chapView := TChapterView(view); 4chapSel := TChapSelection(selection); 4END; 0oldRecipe := TRecipe(chapView.recipes.At(chapSel.recipeIndex)); 0oldRecipe.name.ToPStr(@s); 0process.ArgAlert(1, s); 0IF process.Caution(phReallyDelRecipe) THEN 8{Delete Recipe is not undoable (an exercise for the reader would be to  0 THEN 8recipe := TRecipe(chapView.recipes.At(newIndex)) 4ELSE 8recipe := NIL; 4TRecipeView(SELF.recipePanel.view).ChangeRecipe(recipe); 4oldRecipe.Free; 4chapSel.recipeIndex := newIndex; 4chapSel.MarkChanged; 4NewCommand := TCommand.CREATE(NIL, SELF.Heap, uDeleteRecipe, LchapView, FALSE, revealNone); 4SELF.cookbookPanel.Highlight(SELF.cookbookPanel.selection, hOffToOn); 4SELF.Update(TRUE); 8{do the updating & highlighting of the chapter panel here because of the itsPrintable: BOOLEAN): TTwoBoxView}; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TTwoBoxView(itsPanel.NewView(object, itsExtent, TPrintManager.CREATE(NIL, heap), MstdMargins, TRUE)); ({$IFC fTrace}EP;{$ENDC} $END; #{$IFC fDebugMethods} $PROCEDURE {TTwoBoxView.}Fields{(PROCEDURE Field(nameAndType: S255))}; $BEGIN (TView.Fields(Field); (Field('txtImg1: TTextImage'); (Field('txtImg2: TTextImage'); $END; ${$ENDC} $FUNCTION {TTwoBoxView.}CursorAt{(mouseLPt: LPoint): TCursor}; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (IF LPtInLRect(mouseLPt, SELF.txtImg1.extentLRect) THEN ,CursorAt := textCursor (ELSE IF LPtInLRect(mouseLPt, SELF.txtImg2.extentLRect) THEN ,CursorAt := textCursor (ELSE ,CursorAt := SUPERSELF.CursorAt(mouseLPt); ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE {TTwoBoxView.}Draw; $VAR r: LRect; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (PenNormal; (PenSize(1,1); (r := SELF.txtImg1.extentLRect; (InsetLRect(r, -4, -6); (FrameLRect(r); (r := SELF.txtImg2.extentLRect; (InsetLRect(r, -4, -6); (FrameLRect(r); (SELF.txtImg1.Draw; ({$IFC fTrace}EP;{$ENDC} $END; %PROCEDURE {TTwoBoxView.}MousePress{(mouseLPt: LPoint)}; %VAR panel: TPanel; )aSelection: TSelection; (PROCEDURE NoSelInPanels(obj: TObject); (VAR panel: TPanel; (BEGIN ,panel := TPanel(obj); ,panel.Highlight(panel.selection, hOnToOff); ,aSelection := panel.Selection.FreedAndReplacedBy(panel.view.NoSelection); ,panel.Highlight(panel.selection, hOffToOn); (END; %BEGIN ({$IFC fTrace}BP(11);{$ENDC} (panel := SELF.panel; (IF LPtInLRect(mouseLPt, SELF.txtImg1.extentLRect) THEN ,SELF.txtImg1.MousePress(mouseLpt) (ELSE IF LPtInLRect(mouseLPt, SELF.txtImg2.extentLRect) THEN ,SELF.txtImg2.MousePress(mouseLpt) (ELSE ,SELF.panel.window.panels.Each(NoSelInPanels); ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION TTwoBoxView.OKToDrawIn(lRectInView: LRect): BOOLEAN; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (OKToDrawIn := drawingOK; ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION {TTwoBoxView.}SeesSameAs{(image: TImage): BOOLEAN; DEFAULT}; $BEGIN ({$IFC fTrace}BP(3);{$ENDC} (SeesSameAs := (image.view = SELF) OR InClass(image.view, TOneBoxView); ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TOneBoxView; $FUNCTION {TOneBoxView.}CREATE{(object: TObject; heap: THeap; itsPanel: TPanel; itsExtent: LRect; >itsPrintable: BOOLEAN): TOneBoxView}; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TOneBoxView(itsPanel.NewView(object, itsExtent, TPrintManager.CREATE(NIL, heap), MstdMargins, TRUE)); ({$IFC fTrace}EP;{$ENDC} $END; #{$IFC fDebugMethods} $PROCEDURE {TOneBoxView.}Fields{(PROCEDURE Field(nameAndType: S255))}; $BEGIN (TView.Fields(Field); (Field('txtImg: TTextImage'); $END; ${$ENDC} $FUNCTION {TTwoBoxView.}CursorAt{(mouseLPt: LPoint): TCursor}; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (IF LPtInLRect(mouseLPt, SELF.txtImg.extentLRect) THEN ,CursorAt := textCursor (ELSE ,CursorAt := SUPERSELF.CursorAt(mouseLPt); ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE {TOneBoxView.}Draw; $VAR r: LRect; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (PenNormal; (PenSize(1,1); (r := SELF.txtImg.extentLRect; (InsetLRect(r, -4, -6); (FrameLRect(r); (SELF.txtImg.Draw; ({$IFC fTrace}EP;{$ENDC} $END; %PROCEDURE {TOneBoxView.}MousePress{(mouseLPt: LPoint)}; %VAR panel: TPanel; )aSelection: TSelection; (PROCEDURE NoSelInPanels(obj: TObject); (VAR panel: TPanel; (BEGIN ,panel := TPanel(obj); ,panel.Highlight(panel.selection, hOnToOff); ,aSelection := panel.Selection.FreedAndReplacedBy(panel.view.NoSelection); ,panel.Highlight(panel.selection, hOffToOn); (END; %BEGIN ({$IFC fTrace}BP(11);{$ENDC} (panel := SELF.panel; (IF LPtInLRect(mouseLPt, SELF.txtImg.extentLRect) THEN ,SELF.txtImg.MousePress(mouseLpt) (ELSE ,SELF.panel.window.panels.Each(NoSelInPanels); ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION TOneBoxView.OKToDrawIn(lRectInView: LRect): BOOLEAN; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (OKToDrawIn := drawingOK; ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION {TOneBoxView.}SeesSameAs{(image: TImage): BOOLEAN; DEFAULT}; $BEGIN ({$IFC fTrace}BP(3);{$ENDC} (SeesSameAs := (image.view = SELF) OR InClass(image.view, TTwoBoxView); ({$IFC fTrace}EP;{$ENDC} $END; BEGIN $drawingOK := TRUE; END; METHODS OF TSideView; $FUNCTION {TSideView.}CREATE{(object: TObject; heap: THeap; itsPanel: TPanel; itsExtent: LRect; >itsPrintable: BOOLEAN): TSideView}; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TSideView(itsPanel.NewView(object, itsExtent, NIL, stdMargins, TRUE)); {$H-} SetLRect(SELF.r, 10, 10, 130, 150); {$H+} ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE {TSideView.}Draw; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (PenNormal; (PenSize(1,1); (FrameLOval(SELF.r); ({$IFC fTrace}EP;{$ENDC} $END; %PROCEDURE {TSideView.}MousePress{(mouseLPt: LPoint)}; %VAR panel: TPanel; )aSelection: TSelection; (PROCEDURE NoSelInPanels(obj: TObject); (VAR panel: TPanel; (BEGIN ,panel := TPanel(obj); ,panel.Highlight(panel.selection, hOnToOff); ,aSelection := panel.Selection.FreedAndReplacedBy(panel.view.NoSelection); ,panel.Highlight(panel.selection, hOffToOn); (END; %BEGIN ({$IFC fTrace}BP(11);{$ENDC} (panel := SELF.panel; (panel.window.panels.Each(NoSelInPanels); (IF LPtInLRect(mouseLPt, SELF.r) THEN ,aSelection := SELF.panel.selection.FreedAndReplacedBy( 8TSideSelection.CREATE(NIL, SELF.Heap, SELF, mouseLPt)); (panel.Highlight(panel.selection, hOffToOn); ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TSideSelection; $FUNCTION {TSideSelection.}CREATE{(object: TObject; heap: THeap; itsView: TView; GitsAnchorLPt: LPoint): TSideSelection}; $BEGIN ({$IFC fTrace}BP(9);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TSideSelection(TSelection.CREATE(object, heap, itsView, somethingKind, itsAnchorLPt)); ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE {TSideSelection.}Highlight{(highTransit: THighTransit}; $VAR sideView: TSideView; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (SetPenState(highPen[highTransit]); (PenSize(4,4); (sideView := TSideView(SELF.view); (FrameLOval(sideView.r); ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TMyProcess; $FUNCTION {TMyProcess.}CREATE{: TMyProcess}; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (SELF := TMyProcess(TProcess.CREATE(NewObject(mainHeap, THISCLASS), mainHeap)); ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION {TMyProcess.}NewDocManager{(volumePrefix: TFilePath): TDocManager}; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (NewDocManager := TMyDocManager.CREATE(NIL, mainHeap, volumePrefix); ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TMyDocManager; $FUNCTION {TMyDocManager.}CREATE{(object: TObject; heap: THeap; itsPathPrefix: TFilePath): TMyDocManager}; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TMyDocManager(TDocManager.CREATE(object, heap, itsPathPrefix)); ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION {TMyDocManager.}NewWindow{(heap: THeap; wmgrID: TWindowID):TWindow}; $BEGIN ({$IFC fTrace}BP(11);{$ENDC} (NewWindow := TMyWindow.CREATE(NIL, heap, wmgrID); ({$IFC fTrace}EP;{$ENDC} $END; END; METHODS OF TMyWindow; $FUNCTION {TMyWindow.}CREATE{(object: TObject; heap: THeap; itsWmgrID: TWindowID): TMyWindow}; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (IF object = NIL THEN ,object := NewObject(heap, THISCLASS); (SELF := TMyWindow(TWindow.CREATE(object, heap, itsWmgrID, TRUE)); ({$IFC fTrace}EP;{$ENDC} $END; $PROCEDURE {TMyWindow.}BlankStationery; $VAR viewLRect: LRect; (r: Rect; (panel: TPanel; (sidePanel: TPanel; (topPanel: TPanel; (twoBoxView: TTwoBoxView; (oneBoxView: TOneBoxView; (aSelection: TSelection; (txtImg1: TTextImage; (txtImg2: TTextImage; (imageLRect: LRect; (paraFormat: TParaFormat; (text: TText; (paragraph: TEditPara; (sideView: TSideView; (styleSheet: TStyleSheet; $BEGIN ({$IFC fTrace}BP(10);{$ENDC} (SetLRect(viewLRect, 0, 0, 5000, 3000); O{v,h} (panel := TPanel.CREATE(NIL, SELF.Heap, SELF, 20, 30, [aScroll, aSplit], [aScroll, aSplit]); (twoBoxView := TTwoBoxView.CREATE(NIL, SELF.Heap, panel, viewLRect, TRUE); ({CREATE TWO TEXTIMAGES WITH DIFFERENT SIZE BOXES} (SetLRect(imageLRect, 50, 20, 250, 150); (styleSheet := TStyleSheet.CREATE(NIL, SELF.Heap); (SELF.styleSheet := styleSheet; (paraFormat := TParaFormat.CREATE(NIL, SELF.Heap, styleSheet); (WITH paraFormat DO ,BEGIN ,firstIndent := cHorizMarg*4; ,leftIndent := cHorizMarg; ,rightIndent := cHorizMarg; ,spaceBelowPara := cVertMarg*2; ,END; (text := TText.CREATE(NIL, SELF.Heap, styleSheet); (paragraph := TEditPara.CREATE(NIL, SELF.Heap, 0, paraFormat); (text.paragraphs.InsLast(paragraph); (txtImg1 := TTextImage.CREATE(NIL, SELF.Heap, twoBoxView, imageLRect, text, FALSE); ({Put this textImage on text's textImage list. NOTE: We do NOT put txtImg2 on the list )since it is not a "head" text image} (text.txtImgList.InsLast(txtImg1); (* {Create an initial paraimage} (txtImg1.imageList.InsLast(txtImg1.NewParaImage(paragraph, imageLRect, 0, 0)); *) (SetLRect(imageLRect, 350, 40, 500, 175); (txtImg2 := TTextImage.CREATE(NIL, SELF.Heap, twoBoxView, imageLRect, text, FALSE); ({Set up the links and back links and set the second textImage's headTxtImg to txtImg1} (txtImg1.nextTxtImg := txtImg2; (txtImg1.tailTxtImg := txtImg2; (txtImg2.prevTxtImg := txtImg1; (txtImg2.headTxtImg := txtImg1; (twoBoxView.txtImg1 := txtImg1; (twoBoxView.txtImg2 := txtImg2; (txtImg1.RecomputeImages(actionNone, TRUE); ({CREATE Side panel} (sidePanel := panel.Divide(h, 25, percentFromEdge, [windowCanResizeIt, userCanResizeIt], >0, [], []); (sideView := TSideView.CREATE(NIL, SELF.Heap, sidePanel, viewLRect, TRUE); ({CREATE top panel} (topPanel := panel.Divide(v, 33, percentFromEdge, [userCanResizeIt], >50, [aScroll, aSplit], [aScroll, aSplit]); (oneBoxView := TOneBoxView.CREATE(NIL, SELF.Heap, topPanel, viewLRect, TRUE); (SetLRect(imageLRect, 20, 10, 520, 70); (txtImg1 := TTextImage.CREATE(NIL, SELF.Heap, oneBoxView, imageLRect, text, FALSE); ({Put this textImage on text's textImage list.} (text.txtImgList.InsLast(txtImg1); ({Create an initial paraimage} (* txtImg1.imageList.InsLast(txtImg1.NewParaImage(paragraph, imageLRect, 0, 0)); *) (txtImg1.RecomputeImages(actionNone, TRUE); (oneBoxView.txtImg := txtImg1; ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION {TMyWindow.}CanDoCommand{(cmdNumber: TCmdNumber; VAR checkIt: BOOLEAN): BOOLEAN}; $BEGIN ({$IFC fTrace}BP(12);{$ENDC} (CASE cmdNumber OF ,cmdRefresh: 0CanDoCommand := TRUE; ,cmdTrUPara: 0BEGIN 0CanDoCommand := TRUE; 0checkIt := fParaTrace; 0END; ,cmdTrUText: 0BEGIN 0CanDoCommand := TRUE; 0checkIt := fTextTrace; 0END; ,uToggleOK: 0BEGIN 0CanDoCommand := TRUE; 0checkIt := drawingOK; 0END; ,testUnivText: 0CanDoCommand := TRUE; ,OTHERWISE 0CanDoCommand := SUPERSELF.CanDoCommand(cmdNumber, checkIt); ,END; ({$IFC fTrace}EP;{$ENDC} $END; $FUNCTION {TMyWindow.}NewCommand{(cmdNumber: TCmdNumber): TCommand}; $VAR twoBoxView: TTwoBoxView; (selection: TSelection; (PROCEDURE InvalAll(obj: TObject); (BEGIN ,TPanel(obj).Invalidate; (END; $BEGIN ({$IFC fTrace}BP(12);{$ENDC} (NewCommand := NIL; (CASE cmdNumber OF %(* uSelAll: 0BEGIN 0twoBoxView := SELF.selectPanel.view; 0SELF.selectPanel.Highlight(SELF.selectPanel.selection, hOnToOff); 0selection := SELF.selectPanel.selection.FreedAndReplacedBy T(twoBoxView.txtImg1.text.SelectAll(twoBoxView.txtImg1)); 0END; $*) ,cmdRefresh: 0SELF.panels.Each(InvalAll); ,cmdTrUPara: 0fParaTrace := NOT fParaTrace; ,cmdTrUText: 0fTextTrace := NOT fTextTrace; ,uToggleOK: 0drawingOK := NOT drawingOK; ,testUnivText: 0IF clipBoard.hasUniversalText THEN 4WriteLn('The clipboard has universal text!') 0ELSE 4WriteLn('The clipboard does NOT have universal text!'); ,OTHERWISE 0NewCommand := SUPERSELF.NewCommand(cmdNumber); ,END; ({$IFC fTrace}EP;{$ENDC} $END; END; 3. "6F^9 D!$ǐ^ACCH3. "6F^1 3 2300 $-#boot-tk/PABC ; Apple building block phrase files can be included here ; *** SW 20Jan84 13:15 added print items; added clipboard page-layout menu item 1000 TwoText ; PROCEDURE {TMyWindow.}NewCommand ; cantUndo = 1001; 1001 caution cancel alert You will not be able to undo ClearAll. 3333 ;triples array for selecting words (double click) xAx x9x x$x x%x x.9 x.% 9,9 A'A 0 1 File/Print Set Aside Everything#101 Set Aside#102 - Save & Put Away#103 Save & Continue#107 Revert to Previous Version#108 - Format for Printer ...#104 Print 1-box ...#2001 Print 1-box As Is#2002 Print 2-box ...#2003 Print 2-box As Is#2004 Monitor the Printer ...#106 2 $-#boot-tk/PABC~Edit - Select All of Text/A#204 - Ask About Universal Text#888 ;NOTE: Application should probably construct their own Type Style menu, based on the ; styles that they support. 3 Type Style Plain Text/P#351 Underline/U#354 Bold/B#352 Italic/I#353 Hollow#356 Shadow#355 - Modern#320 Classic#321 - 8 Point 20 Pitch#330 8 Point 15 Pitch#331 10 Point 12 Pitch#332 12 Point 10 Pitch#333 12 Point#334 14 Point#335 18 Point#336 24 Point#337 5 $-#boot-tk/PABC~Page Layout 90 TextBug Refresh the Window #3000 - Trace UPara #3001 - Trace UText #3002 - Okay To Draw #3004 99 $-#boot-tk/PABC~Debug 100 $-#boot-tk/PABC~Buzzwords Typing#2000 Clear#208 1000 $-#boot-tk/PABC~Clipboard File/Print 1001 $-#boot-tk/PABC~Page Layout 0 3. "6F^9hiD!$ǐ^  nK+a rect) prefix volume) 3. "6F^;The next 2 lines specify the default tool number and tool volume 208 ;no assembler files $ ;no building blocks $ ;Link in UFixUText and map its segments UFixUText +M FixText1 +M FixText2 $ ;install parameters: we handle documents; we handle >1 document; we don't change the opening rectangle y y n TwoText $ %F B-LOWER-MRECIPES.TEXT,$ B-LOWER-URECIPES=.TEXT,$ Y B-LOWER-PRECIPES.TEXT,$ B-LOWER-XRECIPES.TEXT,$ B-LOWER-UFIXUTEXT.OBJ,$ B-LOWER-MSAMDIALOG.TEXT,$ B-LOWER-USAMDIALOG=.TEXT,$ Y B-LOWER-PSAMDIALOG.TEXT,$ B-LOWER-XSAMDIALOG.TEXT,$ B-LOWER-MSAMPLE.TEXT,$ B-LOWER-USAMPLE=.TEXT,$ Y B-LOWER-PSAMPLE.TEXT,$ B-LOWER-XSAMPLE.TEXT,$ B-LOWER-MTWOTEXT.TEXT,$ B-LOWER-UTWOTEXT=.TEXT,$ Y B-LOWER-PTWOTEXT.TEXT,$ B-LOWER-XTWOTEXT.TEXT,$ B-LOWER-UFIXUTEXT.OBJ,$ Q %% %%% $$$$$$$$$$ $ $ $ $ $$$$$$$$$$$$$ O  ?NOMPNORSQTRSVWUXVYWZXY\][^\] ` a_ b` a d ec fd ge hf ig jh ki lj mk nl om pn qo rp sq tr us vt wu xv yw zx {y |z }{ ~| } ~     !                     !"#$%&'()*+          + O                    ! "  #! $" %# &$ '% (& )' *( +) ,* -+ ., /- 0. !1/ "20 #31 $42 %53 &64 '75 (86 )97 *:8 +;9 ,<: -=; .>< /?= 0@> 1A? 2B@ 3CA 4DB 5EC 6FD 7GE 8HF 9IG :JH ;KI NL ?OM @PN AQO BRP CSQ DTR EUS FVT GWU HXV IYW JZX K[Y L\Z M][ N^\ O_] P`^ Qa_ Rb` Sca Tdb Uec Vfd Wge Xhf Yig Zjh [ki \lj ]mk ^nl _om `pn aqo brp csq dtr eus fvt gwu hxv iyw jzx k{y l|z m}{ n~| o} p~ q r s t u v w x y z { | } ~                    %