home *** CD-ROM | disk | FTP | other *** search
/ Eagles Nest BBS 8 / Eagles_Nest_Mac_Collection_Disc_8.TOAST / Developer Environments / MPWPascal / PExamples / TESample.p < prev    next >
MacBinary  |  1988-11-30  |  48.3 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert ZX81 Sinclair BASIC (image/sinclairBASIC) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert bsdiff patch (other/bsdiffPatch) ext Unsupported
1% dexvert imgdiff patch (other/imgdiffPatch) ext Unsupported
1% dexvert WSUS Patch Storage File (other/wsusPatchStorageFile) ext Unsupported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Wed Nov 30 12:00:00 1988, modified Wed Nov 30 12:00:00 1988, creator 'MPS ', type ASCII, 47994 bytes "TESample.p" , at 0xbbfa 1193 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0a 54 45 53 61 6d 70 | 6c 65 2e 70 00 00 00 00 |..TESamp|le.p....|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 bb 7a 00 | 00 04 a9 9f b9 d9 90 9f |......z.|........|
|00000060| b9 d9 90 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 8b a3 00 00 |........|........|
|00000080| 7b 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |{-------|--------|
|00000090| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 0d |--------|-------.|
|000000d0| 23 0d 23 09 41 70 70 6c | 65 20 4d 61 63 69 6e 74 |#.#.Appl|e Macint|
|000000e0| 6f 73 68 20 44 65 76 65 | 6c 6f 70 65 72 20 54 65 |osh Deve|loper Te|
|000000f0| 63 68 6e 69 63 61 6c 20 | 53 75 70 70 6f 72 74 0d |chnical |Support.|
|00000100| 23 0d 23 09 4d 75 6c 74 | 69 46 69 6e 64 65 72 2d |#.#.Mult|iFinder-|
|00000110| 41 77 61 72 65 20 53 69 | 6d 70 6c 65 20 54 65 78 |Aware Si|mple Tex|
|00000120| 74 45 64 69 74 20 53 61 | 6d 70 6c 65 20 41 70 70 |tEdit Sa|mple App|
|00000130| 6c 69 63 61 74 69 6f 6e | 0d 23 0d 23 09 54 45 53 |lication|.#.#.TES|
|00000140| 61 6d 70 6c 65 0d 23 0d | 23 09 54 45 53 61 6d 70 |ample.#.|#.TESamp|
|00000150| 6c 65 2e 70 09 2d 09 50 | 61 73 63 61 6c 20 53 6f |le.p.-.P|ascal So|
|00000160| 75 72 63 65 0d 23 0d 23 | 09 43 6f 70 79 72 69 67 |urce.#.#|.Copyrig|
|00000170| 68 74 20 a9 20 31 39 38 | 38 20 41 70 70 6c 65 20 |ht . 198|8 Apple |
|00000180| 43 6f 6d 70 75 74 65 72 | 2c 20 49 6e 63 2e 0d 23 |Computer|, Inc..#|
|00000190| 09 41 6c 6c 20 72 69 67 | 68 74 73 20 72 65 73 65 |.All rig|hts rese|
|000001a0| 72 76 65 64 2e 0d 23 0d | 23 09 56 65 72 73 69 6f |rved..#.|#.Versio|
|000001b0| 6e 73 3a 09 31 2e 30 09 | 09 09 09 09 30 38 2f 38 |ns:.1.0.|....08/8|
|000001c0| 38 0d 23 09 09 09 09 31 | 2e 30 31 09 09 09 09 31 |8.#....1|.01....1|
|000001d0| 31 2f 38 38 0d 23 0d 23 | 09 43 6f 6d 70 6f 6e 65 |1/88.#.#|.Compone|
|000001e0| 6e 74 73 3a 09 54 45 53 | 61 6d 70 6c 65 2e 70 09 |nts:.TES|ample.p.|
|000001f0| 09 09 4e 6f 76 65 6d 62 | 65 72 20 31 2c 20 31 39 |..Novemb|er 1, 19|
|00000200| 38 38 0d 23 09 09 09 09 | 54 45 53 61 6d 70 6c 65 |88.#....|TESample|
|00000210| 2e 63 09 09 09 4e 6f 76 | 65 6d 62 65 72 20 31 2c |.c...Nov|ember 1,|
|00000220| 20 31 39 38 38 0d 23 09 | 09 09 09 54 45 53 61 6d | 1988.#.|...TESam|
|00000230| 70 6c 65 47 6c 75 65 2e | 61 09 09 4e 6f 76 65 6d |pleGlue.|a..Novem|
|00000240| 62 65 72 20 31 2c 20 31 | 39 38 38 0d 23 09 09 09 |ber 1, 1|988.#...|
|00000250| 09 54 45 53 61 6d 70 6c | 65 2e 72 09 09 09 4e 6f |.TESampl|e.r...No|
|00000260| 76 65 6d 62 65 72 20 31 | 2c 20 31 39 38 38 0d 23 |vember 1|, 1988.#|
|00000270| 09 09 09 09 54 45 53 61 | 6d 70 6c 65 2e 68 09 09 |....TESa|mple.h..|
|00000280| 09 4e 6f 76 65 6d 62 65 | 72 20 31 2c 20 31 39 38 |.Novembe|r 1, 198|
|00000290| 38 0d 23 09 09 09 09 5b | 50 5d 54 45 53 61 6d 70 |8.#....[|P]TESamp|
|000002a0| 6c 65 2e 6d 61 6b 65 09 | 4e 6f 76 65 6d 62 65 72 |le.make.|November|
|000002b0| 20 31 2c 20 31 39 38 38 | 0d 23 09 09 09 09 5b 43 | 1, 1988|.#....[C|
|000002c0| 5d 54 45 53 61 6d 70 6c | 65 2e 6d 61 6b 65 09 4e |]TESampl|e.make.N|
|000002d0| 6f 76 65 6d 62 65 72 20 | 31 2c 20 31 39 38 38 0d |ovember |1, 1988.|
|000002e0| 23 0d 23 09 54 45 53 61 | 6d 70 6c 65 20 69 73 20 |#.#.TESa|mple is |
|000002f0| 61 6e 20 65 78 61 6d 70 | 6c 65 20 61 70 70 6c 69 |an examp|le appli|
|00000300| 63 61 74 69 6f 6e 20 74 | 68 61 74 20 64 65 6d 6f |cation t|hat demo|
|00000310| 6e 73 74 72 61 74 65 73 | 20 68 6f 77 20 0d 23 09 |nstrates| how .#.|
|00000320| 74 6f 20 69 6e 69 74 69 | 61 6c 69 7a 65 20 74 68 |to initi|alize th|
|00000330| 65 20 63 6f 6d 6d 6f 6e | 6c 79 20 75 73 65 64 20 |e common|ly used |
|00000340| 74 6f 6f 6c 62 6f 78 20 | 6d 61 6e 61 67 65 72 73 |toolbox |managers|
|00000350| 2c 20 6f 70 65 72 61 74 | 65 20 0d 23 09 73 75 63 |, operat|e .#.suc|
|00000360| 63 65 73 73 66 75 6c 6c | 79 20 75 6e 64 65 72 20 |cessfull|y under |
|00000370| 4d 75 6c 74 69 46 69 6e | 64 65 72 2c 20 68 61 6e |MultiFin|der, han|
|00000380| 64 6c 65 20 64 65 73 6b | 20 61 63 63 65 73 73 6f |dle desk| accesso|
|00000390| 72 69 65 73 20 61 6e 64 | 20 0d 23 09 63 72 65 61 |ries and| .#.crea|
|000003a0| 74 65 2c 20 67 72 6f 77 | 2c 20 61 6e 64 20 7a 6f |te, grow|, and zo|
|000003b0| 6f 6d 20 77 69 6e 64 6f | 77 73 2e 20 54 68 65 20 |om windo|ws. The |
|000003c0| 66 75 6e 64 61 6d 65 6e | 74 61 6c 20 54 65 78 74 |fundamen|tal Text|
|000003d0| 45 64 69 74 20 0d 23 09 | 74 6f 6f 6c 62 6f 78 20 |Edit .#.|toolbox |
|000003e0| 63 61 6c 6c 73 20 61 6e | 64 20 54 65 78 74 45 64 |calls an|d TextEd|
|000003f0| 69 74 20 61 75 74 6f 73 | 63 72 6f 6c 6c 20 61 72 |it autos|croll ar|
|00000400| 65 20 64 65 6d 6f 6e 73 | 74 72 61 74 65 64 2e 20 |e demons|trated. |
|00000410| 49 74 20 0d 23 09 61 6c | 73 6f 20 73 68 6f 77 73 |It .#.al|so shows|
|00000420| 20 68 6f 77 20 74 6f 20 | 63 72 65 61 74 65 20 61 | how to |create a|
|00000430| 6e 64 20 6d 61 69 6e 74 | 61 69 6e 20 73 63 72 6f |nd maint|ain scro|
|00000440| 6c 6c 62 61 72 20 63 6f | 6e 74 72 6f 6c 73 2e 0d |llbar co|ntrols..|
|00000450| 23 0d 23 09 49 74 20 64 | 6f 65 73 20 6e 6f 74 20 |#.#.It d|oes not |
|00000460| 62 79 20 61 6e 79 20 6d | 65 61 6e 73 20 64 65 6d |by any m|eans dem|
|00000470| 6f 6e 73 74 72 61 74 65 | 20 61 6c 6c 20 74 68 65 |onstrate| all the|
|00000480| 20 74 65 63 68 6e 69 71 | 75 65 73 20 79 6f 75 20 | techniq|ues you |
|00000490| 0d 23 09 6e 65 65 64 20 | 66 6f 72 20 61 20 6c 61 |.#.need |for a la|
|000004a0| 72 67 65 20 61 70 70 6c | 69 63 61 74 69 6f 6e 2e |rge appl|ication.|
|000004b0| 20 49 6e 20 70 61 72 74 | 69 63 75 6c 61 72 2c 20 | In part|icular, |
|000004c0| 53 61 6d 70 6c 65 20 64 | 6f 65 73 20 6e 6f 74 20 |Sample d|oes not |
|000004d0| 0d 23 09 63 6f 76 65 72 | 20 65 78 63 65 70 74 69 |.#.cover| excepti|
|000004e0| 6f 6e 20 68 61 6e 64 6c | 69 6e 67 2c 20 6d 75 6c |on handl|ing, mul|
|000004f0| 74 69 70 6c 65 20 77 69 | 6e 64 6f 77 73 2f 64 6f |tiple wi|ndows/do|
|00000500| 63 75 6d 65 6e 74 73 2c | 20 0d 23 09 73 6f 70 68 |cuments,| .#.soph|
|00000510| 69 73 74 69 63 61 74 65 | 64 20 6d 65 6d 6f 72 79 |isticate|d memory|
|00000520| 20 6d 61 6e 61 67 65 6d | 65 6e 74 2c 20 70 72 69 | managem|ent, pri|
|00000530| 6e 74 69 6e 67 2c 20 6f | 72 20 75 6e 64 6f 2e 20 |nting, o|r undo. |
|00000540| 41 6c 6c 20 6f 66 20 0d | 23 09 74 68 65 73 65 20 |All of .|#.these |
|00000550| 61 72 65 20 76 69 74 61 | 6c 20 70 61 72 74 73 20 |are vita|l parts |
|00000560| 6f 66 20 61 20 6e 6f 72 | 6d 61 6c 20 66 75 6c 6c |of a nor|mal full|
|00000570| 2d 73 69 7a 65 64 20 61 | 70 70 6c 69 63 61 74 69 |-sized a|pplicati|
|00000580| 6f 6e 2e 0d 23 0d 23 09 | 54 68 69 73 20 61 70 70 |on..#.#.|This app|
|00000590| 6c 69 63 61 74 69 6f 6e | 20 69 73 20 61 6e 20 65 |lication| is an e|
|000005a0| 78 61 6d 70 6c 65 20 6f | 66 20 74 68 65 20 66 6f |xample o|f the fo|
|000005b0| 72 6d 20 6f 66 20 61 20 | 4d 61 63 69 6e 74 6f 73 |rm of a |Macintos|
|000005c0| 68 20 0d 23 09 61 70 70 | 6c 69 63 61 74 69 6f 6e |h .#.app|lication|
|000005d0| 3b 20 69 74 20 69 73 20 | 4e 4f 54 20 61 20 74 65 |; it is |NOT a te|
|000005e0| 6d 70 6c 61 74 65 2e 20 | 49 74 20 69 73 20 4e 4f |mplate. |It is NO|
|000005f0| 54 20 69 6e 74 65 6e 64 | 65 64 20 74 6f 20 62 65 |T intend|ed to be|
|00000600| 20 0d 23 09 75 73 65 64 | 20 61 73 20 61 20 66 6f | .#.used| as a fo|
|00000610| 75 6e 64 61 74 69 6f 6e | 20 66 6f 72 20 74 68 65 |undation| for the|
|00000620| 20 6e 65 78 74 20 77 6f | 72 6c 64 2d 63 6c 61 73 | next wo|rld-clas|
|00000630| 73 2c 20 62 65 73 74 2d | 73 65 6c 6c 69 6e 67 2c |s, best-|selling,|
|00000640| 20 0d 23 09 36 30 30 4b | 20 61 70 70 6c 69 63 61 | .#.600K| applica|
|00000650| 74 69 6f 6e 2e 20 41 20 | 73 74 69 63 6b 20 66 69 |tion. A |stick fi|
|00000660| 67 75 72 65 20 64 72 61 | 77 69 6e 67 20 6f 66 20 |gure dra|wing of |
|00000670| 74 68 65 20 68 75 6d 61 | 6e 20 62 6f 64 79 20 6d |the huma|n body m|
|00000680| 61 79 20 0d 23 09 62 65 | 20 61 20 67 6f 6f 64 20 |ay .#.be| a good |
|00000690| 65 78 61 6d 70 6c 65 20 | 6f 66 20 74 68 65 20 66 |example |of the f|
|000006a0| 6f 72 6d 20 66 6f 72 20 | 61 20 70 61 69 6e 74 69 |orm for |a painti|
|000006b0| 6e 67 2c 20 62 75 74 20 | 74 68 61 74 20 64 6f 65 |ng, but |that doe|
|000006c0| 73 20 6e 6f 74 20 0d 23 | 09 6d 65 61 6e 20 69 74 |s not .#|.mean it|
|000006d0| 20 73 68 6f 75 6c 64 20 | 62 65 20 75 73 65 64 20 | should |be used |
|000006e0| 61 73 20 74 68 65 20 62 | 61 73 69 73 20 66 6f 72 |as the b|asis for|
|000006f0| 20 74 68 65 20 6e 65 78 | 74 20 4d 6f 6e 61 20 4c | the nex|t Mona L|
|00000700| 69 73 61 2e 0d 23 0d 23 | 09 57 65 20 72 65 63 6f |isa..#.#|.We reco|
|00000710| 6d 6d 65 6e 64 20 74 68 | 61 74 20 79 6f 75 20 72 |mmend th|at you r|
|00000720| 65 76 69 65 77 20 74 68 | 69 73 20 70 72 6f 67 72 |eview th|is progr|
|00000730| 61 6d 20 6f 72 20 53 61 | 6d 70 6c 65 20 62 65 66 |am or Sa|mple bef|
|00000740| 6f 72 65 20 0d 23 09 62 | 65 67 69 6e 6e 69 6e 67 |ore .#.b|eginning|
|00000750| 20 61 20 6e 65 77 20 61 | 70 70 6c 69 63 61 74 69 | a new a|pplicati|
|00000760| 6f 6e 2e 20 53 61 6d 70 | 6c 65 20 69 73 20 61 20 |on. Samp|le is a |
|00000770| 73 69 6d 70 6c 65 20 61 | 70 70 2e 20 77 68 69 63 |simple a|pp. whic|
|00000780| 68 20 64 6f 65 73 6e d5 | 74 20 0d 23 09 75 73 65 |h doesn.|t .#.use|
|00000790| 20 54 65 78 74 45 64 69 | 74 20 6f 72 20 74 68 65 | TextEdi|t or the|
|000007a0| 20 43 6f 6e 74 72 6f 6c | 20 4d 61 6e 61 67 65 72 | Control| Manager|
|000007b0| 2e 0d 23 0d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |..#.----|--------|
|000007c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000007d0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000007e0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000007f0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000800| 2d 2d 7d 0d 0d 0d 50 52 | 4f 47 52 41 4d 20 54 45 |--}...PR|OGRAM TE|
|00000810| 53 61 6d 70 6c 65 3b 0d | 0d 0d 7b 53 65 67 6d 65 |Sample;.|..{Segme|
|00000820| 6e 74 61 74 69 6f 6e 20 | 73 74 72 61 74 65 67 79 |ntation |strategy|
|00000830| 3a 0d 0d 20 54 68 69 73 | 20 70 72 6f 67 72 61 6d |:.. This| program|
|00000840| 20 63 6f 6e 73 69 73 74 | 73 20 6f 66 20 74 68 72 | consist|s of thr|
|00000850| 65 65 20 73 65 67 6d 65 | 6e 74 73 2e 20 4d 61 69 |ee segme|nts. Mai|
|00000860| 6e 20 63 6f 6e 74 61 69 | 6e 73 20 6d 6f 73 74 20 |n contai|ns most |
|00000870| 6f 66 20 74 68 65 20 63 | 6f 64 65 2c 0d 20 69 6e |of the c|ode,. in|
|00000880| 63 6c 75 64 69 6e 67 20 | 74 68 65 20 4d 50 57 20 |cluding |the MPW |
|00000890| 6c 69 62 72 61 72 69 65 | 73 2c 20 61 6e 64 20 74 |librarie|s, and t|
|000008a0| 68 65 20 6d 61 69 6e 20 | 70 72 6f 67 72 61 6d 2e |he main |program.|
|000008b0| 20 49 6e 69 74 69 61 6c | 69 7a 65 20 63 6f 6e 74 | Initial|ize cont|
|000008c0| 61 69 6e 73 0d 20 63 6f | 64 65 20 74 68 61 74 20 |ains. co|de that |
|000008d0| 69 73 20 6f 6e 6c 79 20 | 75 73 65 64 20 6f 6e 63 |is only |used onc|
|000008e0| 65 2c 20 64 75 72 69 6e | 67 20 73 74 61 72 74 75 |e, durin|g startu|
|000008f0| 70 2c 20 61 6e 64 20 63 | 61 6e 20 62 65 20 75 6e |p, and c|an be un|
|00000900| 6c 6f 61 64 65 64 20 61 | 66 74 65 72 20 74 68 65 |loaded a|fter the|
|00000910| 0d 20 70 72 6f 67 72 61 | 6d 20 73 74 61 72 74 73 |. progra|m starts|
|00000920| 2e 20 25 41 35 49 6e 69 | 74 20 69 73 20 61 75 74 |. %A5Ini|t is aut|
|00000930| 6f 6d 61 74 69 63 61 6c | 6c 79 20 63 72 65 61 74 |omatical|ly creat|
|00000940| 65 64 20 62 79 20 74 68 | 65 20 4c 69 6e 6b 65 72 |ed by th|e Linker|
|00000950| 20 74 6f 20 69 6e 69 74 | 69 61 6c 69 7a 65 0d 20 | to init|ialize. |
|00000960| 67 6c 6f 62 61 6c 73 20 | 66 6f 72 20 74 68 65 20 |globals |for the |
|00000970| 4d 50 57 20 6c 69 62 72 | 61 72 69 65 73 20 61 6e |MPW libr|aries an|
|00000980| 64 20 69 73 20 75 6e 6c | 6f 61 64 65 64 20 72 69 |d is unl|oaded ri|
|00000990| 67 68 74 20 61 77 61 79 | 2e 7d 0d 0d 0d 7b 53 65 |ght away|.}...{Se|
|000009a0| 74 50 6f 72 74 20 73 74 | 72 61 74 65 67 79 3a 0d |tPort st|rategy:.|
|000009b0| 0d 20 54 6f 6f 6c 62 6f | 78 20 72 6f 75 74 69 6e |. Toolbo|x routin|
|000009c0| 65 73 20 64 6f 20 6e 6f | 74 20 63 68 61 6e 67 65 |es do no|t change|
|000009d0| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 70 6f 72 | the cur|rent por|
|000009e0| 74 2e 20 49 6e 20 73 70 | 69 74 65 20 6f 66 20 74 |t. In sp|ite of t|
|000009f0| 68 69 73 2c 20 69 6e 20 | 74 68 69 73 0d 20 70 72 |his, in |this. pr|
|00000a00| 6f 67 72 61 6d 20 77 65 | 20 75 73 65 20 61 20 73 |ogram we| use a s|
|00000a10| 74 72 61 74 65 67 79 20 | 6f 66 20 63 61 6c 6c 69 |trategy |of calli|
|00000a20| 6e 67 20 53 65 74 50 6f | 72 74 20 77 68 65 6e 65 |ng SetPo|rt whene|
|00000a30| 76 65 72 20 77 65 20 77 | 61 6e 74 20 74 6f 20 64 |ver we w|ant to d|
|00000a40| 72 61 77 20 6f 72 0d 20 | 6d 61 6b 65 20 63 61 6c |raw or. |make cal|
|00000a50| 6c 73 20 77 68 69 63 68 | 20 64 65 70 65 6e 64 20 |ls which| depend |
|00000a60| 6f 6e 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 70 |on the c|urrent p|
|00000a70| 6f 72 74 2e 20 54 68 69 | 73 20 6d 61 6b 65 73 20 |ort. Thi|s makes |
|00000a80| 75 73 20 6c 65 73 73 20 | 76 75 6c 6e 65 72 61 62 |us less |vulnerab|
|00000a90| 6c 65 0d 20 74 6f 20 62 | 75 67 73 20 69 6e 20 6f |le. to b|ugs in o|
|00000aa0| 74 68 65 72 20 73 6f 66 | 74 77 61 72 65 20 77 68 |ther sof|tware wh|
|00000ab0| 69 63 68 20 6d 69 67 68 | 74 20 61 6c 74 65 72 20 |ich migh|t alter |
|00000ac0| 74 68 65 20 63 75 72 72 | 65 6e 74 20 70 6f 72 74 |the curr|ent port|
|00000ad0| 20 28 73 75 63 68 20 61 | 73 20 74 68 65 0d 20 62 | (such a|s the. b|
|00000ae0| 75 67 20 28 66 65 61 74 | 75 72 65 3f 29 20 69 6e |ug (feat|ure?) in|
|00000af0| 20 6d 61 6e 79 20 64 65 | 73 6b 20 61 63 63 65 73 | many de|sk acces|
|00000b00| 73 6f 72 69 65 73 20 77 | 68 69 63 68 20 63 68 61 |sories w|hich cha|
|00000b10| 6e 67 65 20 74 68 65 20 | 70 6f 72 74 20 6f 6e 20 |nge the |port on |
|00000b20| 4f 70 65 6e 44 65 73 6b | 41 63 63 29 2e 0d 20 48 |OpenDesk|Acc).. H|
|00000b30| 6f 70 65 66 75 6c 6c 79 | 2c 20 74 68 69 73 20 61 |opefully|, this a|
|00000b40| 6c 73 6f 20 6d 61 6b 65 | 73 20 74 68 65 20 72 6f |lso make|s the ro|
|00000b50| 75 74 69 6e 65 73 20 66 | 72 6f 6d 20 74 68 69 73 |utines f|rom this|
|00000b60| 20 70 72 6f 67 72 61 6d | 20 6d 6f 72 65 20 73 65 | program| more se|
|00000b70| 6c 66 2d 63 6f 6e 74 61 | 69 6e 65 64 2c 0d 20 73 |lf-conta|ined,. s|
|00000b80| 69 6e 63 65 20 74 68 65 | 79 20 64 6f 6e 27 74 20 |ince the|y don't |
|00000b90| 64 65 70 65 6e 64 20 6f | 6e 20 74 68 65 20 63 75 |depend o|n the cu|
|00000ba0| 72 72 65 6e 74 20 70 6f | 72 74 20 73 65 74 74 69 |rrent po|rt setti|
|00000bb0| 6e 67 2e 7d 0d 0d 0d 7b | 43 6c 69 70 62 6f 61 72 |ng.}...{|Clipboar|
|00000bc0| 64 20 73 74 72 61 74 65 | 67 79 3a 0d 0d 20 54 68 |d strate|gy:.. Th|
|00000bd0| 69 73 20 70 72 6f 67 72 | 61 6d 20 64 6f 65 73 20 |is progr|am does |
|00000be0| 6e 6f 74 20 6d 61 69 6e | 74 61 69 6e 20 61 20 70 |not main|tain a p|
|00000bf0| 72 69 76 61 74 65 20 73 | 63 72 61 70 2e 20 57 68 |rivate s|crap. Wh|
|00000c00| 65 6e 65 76 65 72 20 61 | 20 63 75 74 2c 20 63 6f |enever a| cut, co|
|00000c10| 70 79 2c 20 6f 72 20 70 | 61 73 74 65 0d 20 6f 63 |py, or p|aste. oc|
|00000c20| 63 75 72 73 2c 20 77 65 | 20 69 6d 70 6f 72 74 2f |curs, we| import/|
|00000c30| 65 78 70 6f 72 74 20 66 | 72 6f 6d 20 74 68 65 20 |export f|rom the |
|00000c40| 70 75 62 6c 69 63 20 73 | 63 72 61 70 20 74 6f 20 |public s|crap to |
|00000c50| 54 65 78 74 45 64 69 74 | 27 73 20 73 63 72 61 70 |TextEdit|'s scrap|
|00000c60| 20 72 69 67 68 74 20 61 | 77 61 79 2c 0d 20 75 73 | right a|way,. us|
|00000c70| 69 6e 67 20 74 68 65 20 | 54 45 54 6f 53 63 72 61 |ing the |TEToScra|
|00000c80| 70 20 61 6e 64 20 54 45 | 46 72 6f 6d 53 63 72 61 |p and TE|FromScra|
|00000c90| 70 20 72 6f 75 74 69 6e | 65 73 2e 20 49 66 20 77 |p routin|es. If w|
|00000ca0| 65 20 64 69 64 20 75 73 | 65 20 61 20 70 72 69 76 |e did us|e a priv|
|00000cb0| 61 74 65 20 73 63 72 61 | 70 2c 0d 20 74 68 65 20 |ate scra|p,. the |
|00000cc0| 69 6d 70 6f 72 74 2f 65 | 78 70 6f 72 74 20 77 6f |import/e|xport wo|
|00000cd0| 75 6c 64 20 62 65 20 69 | 6e 20 74 68 65 20 61 63 |uld be i|n the ac|
|00000ce0| 74 69 76 61 74 65 2f 64 | 65 61 63 74 69 76 61 74 |tivate/d|eactivat|
|00000cf0| 65 20 65 76 65 6e 74 20 | 61 6e 64 20 73 75 73 70 |e event |and susp|
|00000d00| 65 6e 64 2f 72 65 73 75 | 6d 65 0d 20 65 76 65 6e |end/resu|me. even|
|00000d10| 74 20 72 6f 75 74 69 6e | 65 73 2e 7d 0d 0d 7b 24 |t routin|es.}..{$|
|00000d20| 44 2b 7d 0d 0d 55 53 45 | 53 0d 09 4d 65 6d 54 79 |D+}..USE|S..MemTy|
|00000d30| 70 65 73 2c 20 51 75 69 | 63 6b 44 72 61 77 2c 20 |pes, Qui|ckDraw, |
|00000d40| 4f 53 49 6e 74 66 2c 20 | 54 6f 6f 6c 49 6e 74 66 |OSIntf, |ToolIntf|
|00000d50| 2c 20 54 72 61 70 73 3b | 0d 0d 0d 43 4f 4e 53 54 |, Traps;|...CONST|
|00000d60| 0d 0d 09 7b 31 2e 30 31 | 20 2d 20 63 68 61 6e 67 |...{1.01| - chang|
|00000d70| 65 64 20 63 6f 6e 73 74 | 61 6e 74 73 20 74 6f 20 |ed const|ants to |
|00000d80| 62 65 67 69 6e 20 77 69 | 74 68 20 27 6b 27 20 66 |begin wi|th 'k' f|
|00000d90| 6f 72 20 63 6f 6e 73 69 | 73 74 65 6e 63 79 2c 20 |or consi|stency, |
|00000da0| 65 78 63 65 70 74 20 66 | 6f 72 20 72 65 73 6f 75 |except f|or resou|
|00000db0| 72 63 65 20 49 44 73 7d | 0d 09 7b 6b 54 65 78 74 |rce IDs}|..{kText|
|00000dc0| 4d 61 72 67 69 6e 20 69 | 73 20 74 68 65 20 6e 75 |Margin i|s the nu|
|00000dd0| 6d 62 65 72 20 6f 66 20 | 70 69 78 65 6c 73 20 77 |mber of |pixels w|
|00000de0| 65 20 6c 65 61 76 65 20 | 62 6c 61 6e 6b 20 61 74 |e leave |blank at|
|00000df0| 20 74 68 65 20 65 64 67 | 65 20 6f 66 20 74 68 65 | the edg|e of the|
|00000e00| 20 77 69 6e 64 6f 77 2e | 7d 0d 09 6b 54 65 78 74 | window.|}..kText|
|00000e10| 4d 61 72 67 69 6e 09 09 | 09 09 3d 20 32 3b 0d 0d |Margin..|..= 2;..|
|00000e20| 09 7b 6b 4d 61 78 4f 70 | 65 6e 44 6f 63 75 6d 65 |.{kMaxOp|enDocume|
|00000e30| 6e 74 73 20 69 73 20 75 | 73 65 64 20 74 6f 20 64 |nts is u|sed to d|
|00000e40| 65 74 65 72 6d 69 6e 65 | 20 77 68 65 74 68 65 72 |etermine| whether|
|00000e50| 20 61 20 6e 65 77 20 64 | 6f 63 75 6d 65 6e 74 20 | a new d|ocument |
|00000e60| 63 61 6e 20 62 65 20 6f | 70 65 6e 65 64 0d 09 20 |can be o|pened.. |
|00000e70| 6f 72 20 63 72 65 61 74 | 65 64 2e 20 57 65 20 6b |or creat|ed. We k|
|00000e80| 65 65 70 20 74 72 61 63 | 6b 20 6f 66 20 74 68 65 |eep trac|k of the|
|00000e90| 20 6e 75 6d 62 65 72 20 | 6f 66 20 6f 70 65 6e 20 | number |of open |
|00000ea0| 64 6f 63 75 6d 65 6e 74 | 73 2c 20 61 6e 64 20 64 |document|s, and d|
|00000eb0| 69 73 61 62 6c 65 20 74 | 68 65 0d 09 20 6d 65 6e |isable t|he.. men|
|00000ec0| 75 20 69 74 65 6d 73 20 | 74 68 61 74 20 63 72 65 |u items |that cre|
|00000ed0| 61 74 65 20 61 20 6e 65 | 77 20 64 6f 63 75 6d 65 |ate a ne|w docume|
|00000ee0| 6e 74 20 77 68 65 6e 20 | 74 68 65 20 6d 61 78 69 |nt when |the maxi|
|00000ef0| 6d 75 6d 20 69 73 20 72 | 65 61 63 68 65 64 2e 20 |mum is r|eached. |
|00000f00| 49 66 20 74 68 65 0d 09 | 20 6e 75 6d 62 65 72 20 |If the..| number |
|00000f10| 6f 66 20 64 6f 63 75 6d | 65 6e 74 73 20 66 61 6c |of docum|ents fal|
|00000f20| 6c 73 20 62 65 6c 6f 77 | 20 74 68 65 20 6d 61 78 |ls below| the max|
|00000f30| 69 6d 75 6d 2c 20 74 68 | 65 20 69 74 65 6d 73 20 |imum, th|e items |
|00000f40| 61 72 65 20 65 6e 61 62 | 6c 65 64 20 61 67 61 69 |are enab|led agai|
|00000f50| 6e 2e 7d 0d 09 6b 4d 61 | 78 4f 70 65 6e 44 6f 63 |n.}..kMa|xOpenDoc|
|00000f60| 75 6d 65 6e 74 73 09 09 | 3d 20 31 3b 0d 09 0d 09 |uments..|= 1;....|
|00000f70| 7b 6b 4d 61 78 44 6f 63 | 57 69 64 74 68 20 69 73 |{kMaxDoc|Width is|
|00000f80| 20 61 6e 20 61 72 62 69 | 74 72 61 72 79 20 6e 75 | an arbi|trary nu|
|00000f90| 6d 62 65 72 20 75 73 65 | 64 20 74 6f 20 73 70 65 |mber use|d to spe|
|00000fa0| 63 69 66 79 20 74 68 65 | 20 77 69 64 74 68 20 6f |cify the| width o|
|00000fb0| 66 20 74 68 65 20 54 45 | 52 65 63 27 73 0d 09 64 |f the TE|Rec's..d|
|00000fc0| 65 73 74 69 6e 61 74 69 | 6f 6e 20 72 65 63 74 61 |estinati|on recta|
|00000fd0| 6e 67 6c 65 20 73 6f 20 | 74 68 61 74 20 77 6f 72 |ngle so |that wor|
|00000fe0| 64 20 77 72 61 70 20 61 | 6e 64 20 68 6f 72 69 7a |d wrap a|nd horiz|
|00000ff0| 6f 6e 74 61 6c 20 73 63 | 72 6f 6c 6c 69 6e 67 20 |ontal sc|rolling |
|00001000| 63 61 6e 20 62 65 0d 09 | 64 65 6d 6f 6e 73 74 72 |can be..|demonstr|
|00001010| 61 74 65 64 2e 7d 0d 09 | 6b 4d 61 78 44 6f 63 57 |ated.}..|kMaxDocW|
|00001020| 69 64 74 68 09 09 09 3d | 20 35 37 36 3b 0d 09 0d |idth...=| 576;...|
|00001030| 09 7b 6b 4d 69 6e 44 6f | 63 44 69 6d 20 69 73 20 |.{kMinDo|cDim is |
|00001040| 75 73 65 64 20 74 6f 20 | 6c 69 6d 69 74 20 74 68 |used to |limit th|
|00001050| 65 20 6d 69 6e 69 6d 75 | 6d 20 64 69 6d 65 6e 73 |e minimu|m dimens|
|00001060| 69 6f 6e 20 6f 66 20 61 | 20 77 69 6e 64 6f 77 20 |ion of a| window |
|00001070| 77 68 65 6e 20 47 72 6f | 77 57 69 6e 64 6f 77 0d |when Gro|wWindow.|
|00001080| 09 69 73 20 63 61 6c 6c | 65 64 2e 7d 0d 09 6b 4d |.is call|ed.}..kM|
|00001090| 69 6e 44 6f 63 44 69 6d | 09 09 09 09 3d 20 36 34 |inDocDim|....= 64|
|000010a0| 3b 0d 09 0d 09 7b 6b 43 | 6f 6e 74 72 6f 6c 49 6e |;....{kC|ontrolIn|
|000010b0| 76 69 73 69 62 6c 65 20 | 69 73 20 75 73 65 64 20 |visible |is used |
|000010c0| 74 6f 20 27 74 75 72 6e | 20 6f 66 66 27 20 63 6f |to 'turn| off' co|
|000010d0| 6e 74 72 6f 6c 73 20 28 | 69 2e 65 2e 2c 20 63 61 |ntrols (|i.e., ca|
|000010e0| 75 73 65 20 74 68 65 20 | 63 6f 6e 74 72 6f 6c 20 |use the |control |
|000010f0| 6e 6f 74 0d 09 74 6f 20 | 62 65 20 72 65 64 72 61 |not..to |be redra|
|00001100| 77 6e 20 61 73 20 61 20 | 72 65 73 75 6c 74 20 6f |wn as a |result o|
|00001110| 66 20 73 6f 6d 65 20 43 | 6f 6e 74 72 6f 6c 20 4d |f some C|ontrol M|
|00001120| 61 6e 61 67 65 72 20 63 | 61 6c 6c 20 73 75 63 68 |anager c|all such|
|00001130| 20 61 73 20 53 65 74 43 | 74 6c 56 61 6c 75 65 29 | as SetC|tlValue)|
|00001140| 0d 09 62 79 20 62 65 69 | 6e 67 20 70 75 74 20 69 |..by bei|ng put i|
|00001150| 6e 74 6f 20 74 68 65 20 | 63 6f 6e 74 72 6c 56 69 |nto the |contrlVi|
|00001160| 73 20 66 69 65 6c 64 20 | 6f 66 20 74 68 65 20 72 |s field |of the r|
|00001170| 65 63 6f 72 64 2e 20 6b | 43 6f 6e 74 72 6f 6c 56 |ecord. k|ControlV|
|00001180| 69 73 69 62 6c 65 20 69 | 73 20 75 73 65 64 0d 09 |isible i|s used..|
|00001190| 74 68 65 20 73 61 6d 65 | 20 77 61 79 20 74 6f 20 |the same| way to |
|000011a0| 27 74 75 72 6e 20 6f 6e | 27 20 74 68 65 20 63 6f |'turn on|' the co|
|000011b0| 6e 74 72 6f 6c 2e 7d 0d | 09 6b 43 6f 6e 74 72 6f |ntrol.}.|.kContro|
|000011c0| 6c 49 6e 76 69 73 69 62 | 6c 65 09 09 3d 20 30 3b |lInvisib|le..= 0;|
|000011d0| 0d 09 6b 43 6f 6e 74 72 | 6f 6c 56 69 73 69 62 6c |..kContr|olVisibl|
|000011e0| 65 09 09 09 3d 20 24 46 | 46 3b 0d 09 0d 09 7b 6b |e...= $F|F;....{k|
|000011f0| 53 63 72 6f 6c 6c 42 61 | 72 41 64 6a 75 73 74 20 |ScrollBa|rAdjust |
|00001200| 61 6e 64 20 6b 53 63 72 | 6f 6c 6c 42 61 72 57 69 |and kScr|ollBarWi|
|00001210| 64 74 68 20 61 72 65 20 | 75 73 65 64 20 69 6e 20 |dth are |used in |
|00001220| 63 61 6c 63 75 6c 61 74 | 69 6e 67 0d 09 76 61 6c |calculat|ing..val|
|00001230| 75 65 73 20 66 6f 72 20 | 63 6f 6e 74 72 6f 6c 20 |ues for |control |
|00001240| 70 6f 73 69 74 69 6f 6e | 69 6e 67 20 61 6e 64 20 |position|ing and |
|00001250| 73 69 7a 69 6e 67 2e 7d | 0d 09 6b 53 63 72 6f 6c |sizing.}|..kScrol|
|00001260| 6c 62 61 72 57 69 64 74 | 68 09 09 09 3d 20 31 36 |lbarWidt|h...= 16|
|00001270| 3b 0d 09 6b 53 63 72 6f | 6c 6c 62 61 72 41 64 6a |;..kScro|llbarAdj|
|00001280| 75 73 74 09 09 3d 20 6b | 53 63 72 6f 6c 6c 62 61 |ust..= k|Scrollba|
|00001290| 72 57 69 64 74 68 20 2d | 20 31 3b 0d 09 0d 09 7b |rWidth -| 1;....{|
|000012a0| 6b 53 63 72 6f 6c 6c 54 | 77 65 65 6b 20 63 6f 6d |kScrollT|week com|
|000012b0| 70 65 6e 73 61 74 65 73 | 20 66 6f 72 20 6f 66 66 |pensates| for off|
|000012c0| 2d 62 79 2d 6f 6e 65 20 | 72 65 71 75 69 72 65 6d |-by-one |requirem|
|000012d0| 65 6e 74 73 20 6f 66 20 | 74 68 65 20 73 63 72 6f |ents of |the scro|
|000012e0| 6c 6c 62 61 72 73 0d 20 | 09 74 6f 20 68 61 76 65 |llbars. |.to have|
|000012f0| 20 62 6f 72 64 65 72 73 | 20 63 6f 69 6e 63 69 64 | borders| coincid|
|00001300| 65 20 77 69 74 68 20 74 | 68 65 20 67 72 6f 77 62 |e with t|he growb|
|00001310| 6f 78 2e 7d 0d 09 6b 53 | 63 72 6f 6c 6c 54 77 65 |ox.}..kS|crollTwe|
|00001320| 65 6b 09 09 09 3d 20 32 | 3b 0d 09 0d 09 7b 6b 43 |ek...= 2|;....{kC|
|00001330| 72 43 68 61 72 20 69 73 | 20 75 73 65 64 20 74 6f |rChar is| used to|
|00001340| 20 6d 61 74 63 68 20 77 | 69 74 68 20 61 20 63 61 | match w|ith a ca|
|00001350| 72 72 69 61 67 65 20 72 | 65 74 75 72 6e 20 77 68 |rriage r|eturn wh|
|00001360| 65 6e 20 63 61 6c 63 75 | 6c 61 74 69 6e 67 20 74 |en calcu|lating t|
|00001370| 68 65 0d 09 6e 75 6d 62 | 65 72 20 6f 66 20 6c 69 |he..numb|er of li|
|00001380| 6e 65 73 20 69 6e 20 74 | 68 65 20 54 65 78 74 45 |nes in t|he TextE|
|00001390| 64 69 74 20 72 65 63 6f | 72 64 2e 20 6b 44 65 6c |dit reco|rd. kDel|
|000013a0| 43 68 61 72 20 69 73 20 | 75 73 65 64 20 74 6f 20 |Char is |used to |
|000013b0| 63 68 65 63 6b 20 66 6f | 72 0d 09 64 65 6c 65 74 |check fo|r..delet|
|000013c0| 65 20 69 6e 20 6b 65 79 | 44 6f 77 6e 73 2e 7d 0d |e in key|Downs.}.|
|000013d0| 09 6b 43 52 43 68 61 72 | 09 09 09 09 09 3d 20 31 |.kCRChar|.....= 1|
|000013e0| 33 3b 0d 09 6b 44 65 6c | 43 68 61 72 09 09 09 09 |3;..kDel|Char....|
|000013f0| 3d 20 38 3b 0d 09 0d 09 | 7b 6b 42 75 74 74 6f 6e |= 8;....|{kButton|
|00001400| 53 63 72 6f 6c 6c 20 69 | 73 20 68 6f 77 20 6d 61 |Scroll i|s how ma|
|00001410| 6e 79 20 70 69 78 65 6c | 73 20 74 6f 20 73 63 72 |ny pixel|s to scr|
|00001420| 6f 6c 6c 20 68 6f 72 69 | 7a 6f 6e 74 61 6c 6c 79 |oll hori|zontally|
|00001430| 20 77 68 65 6e 20 74 68 | 65 20 62 75 74 74 6f 6e | when th|e button|
|00001440| 20 70 61 72 74 0d 09 6f | 66 20 74 68 65 20 68 6f | part..o|f the ho|
|00001450| 72 69 7a 6f 6e 74 61 6c | 20 73 63 72 6f 6c 6c 62 |rizontal| scrollb|
|00001460| 61 72 20 69 73 20 70 72 | 65 73 73 65 64 2e 7d 0d |ar is pr|essed.}.|
|00001470| 09 6b 42 75 74 74 6f 6e | 53 63 72 6f 6c 6c 09 09 |.kButton|Scroll..|
|00001480| 09 3d 20 34 3b 0d 09 0d | 09 7b 6b 4d 61 78 54 45 |.= 4;...|.{kMaxTE|
|00001490| 4c 65 6e 67 74 68 20 69 | 73 20 61 6e 20 61 72 62 |Length i|s an arb|
|000014a0| 69 74 72 61 72 79 20 6e | 75 6d 62 65 72 20 75 73 |itrary n|umber us|
|000014b0| 65 64 20 74 6f 20 6c 69 | 6d 69 74 20 74 68 65 20 |ed to li|mit the |
|000014c0| 6c 65 6e 67 74 68 20 6f | 66 20 74 65 78 74 20 69 |length o|f text i|
|000014d0| 6e 20 74 68 65 20 54 45 | 52 65 63 0d 09 73 6f 20 |n the TE|Rec..so |
|000014e0| 74 68 61 74 20 76 61 72 | 69 6f 75 73 20 65 72 72 |that var|ious err|
|000014f0| 6f 72 73 20 77 6f 6e 27 | 74 20 6f 63 63 75 72 20 |ors won'|t occur |
|00001500| 66 72 6f 6d 20 74 6f 6f | 20 6d 61 6e 79 20 63 68 |from too| many ch|
|00001510| 61 72 61 63 74 65 72 73 | 20 69 6e 20 74 68 65 20 |aracters| in the |
|00001520| 74 65 78 74 2e 7d 0d 09 | 6b 4d 61 78 54 45 4c 65 |text.}..|kMaxTELe|
|00001530| 6e 67 74 68 09 09 09 3d | 20 33 32 30 30 30 3b 0d |ngth...=| 32000;.|
|00001540| 0d 09 7b 6b 53 79 73 45 | 6e 76 69 72 6f 6e 73 56 |..{kSysE|nvironsV|
|00001550| 65 72 73 69 6f 6e 20 69 | 73 20 70 61 73 73 65 64 |ersion i|s passed|
|00001560| 20 74 6f 20 53 79 73 45 | 6e 76 69 72 6f 6e 73 20 | to SysE|nvirons |
|00001570| 74 6f 20 74 65 6c 6c 20 | 69 74 20 77 68 69 63 68 |to tell |it which|
|00001580| 20 76 65 72 73 69 6f 6e | 20 6f 66 20 74 68 65 0d | version| of the.|
|00001590| 09 20 53 79 73 45 6e 76 | 52 65 63 20 77 65 20 75 |. SysEnv|Rec we u|
|000015a0| 6e 64 65 72 73 74 61 6e | 64 2e 7d 0d 09 6b 53 79 |nderstan|d.}..kSy|
|000015b0| 73 45 6e 76 69 72 6f 6e | 73 56 65 72 73 69 6f 6e |sEnviron|sVersion|
|000015c0| 09 09 3d 20 31 3b 0d 0d | 09 7b 6b 4f 53 45 76 65 |..= 1;..|.{kOSEve|
|000015d0| 6e 74 20 69 73 20 74 68 | 65 20 65 76 65 6e 74 20 |nt is th|e event |
|000015e0| 6e 75 6d 62 65 72 20 6f | 66 20 74 68 65 20 73 75 |number o|f the su|
|000015f0| 73 70 65 6e 64 2f 72 65 | 73 75 6d 65 20 61 6e 64 |spend/re|sume and|
|00001600| 20 6d 6f 75 73 65 2d 6d | 6f 76 65 64 20 65 76 65 | mouse-m|oved eve|
|00001610| 6e 74 73 20 73 65 6e 74 | 0d 09 20 62 79 20 4d 75 |nts sent|.. by Mu|
|00001620| 6c 74 69 46 69 6e 64 65 | 72 2e 20 4f 6e 63 65 20 |ltiFinde|r. Once |
|00001630| 77 65 20 64 65 74 65 72 | 6d 69 6e 65 20 74 68 61 |we deter|mine tha|
|00001640| 74 20 61 6e 20 65 76 65 | 6e 74 20 69 73 20 61 6e |t an eve|nt is an|
|00001650| 20 6f 73 45 76 65 6e 74 | 2c 20 77 65 20 6c 6f 6f | osEvent|, we loo|
|00001660| 6b 20 61 74 20 74 68 65 | 0d 09 20 68 69 67 68 20 |k at the|.. high |
|00001670| 62 79 74 65 20 6f 66 20 | 74 68 65 20 6d 65 73 73 |byte of |the mess|
|00001680| 61 67 65 20 73 65 6e 74 | 20 74 6f 20 64 65 74 65 |age sent| to dete|
|00001690| 72 6d 69 6e 65 20 77 68 | 69 63 68 20 6b 69 6e 64 |rmine wh|ich kind|
|000016a0| 20 69 74 20 69 73 2e 20 | 54 6f 20 64 69 66 66 65 | it is. |To diffe|
|000016b0| 72 65 6e 74 69 61 74 65 | 0d 09 20 73 75 73 70 65 |rentiate|.. suspe|
|000016c0| 6e 64 20 61 6e 64 20 72 | 65 73 75 6d 65 20 65 76 |nd and r|esume ev|
|000016d0| 65 6e 74 73 20 77 65 20 | 63 68 65 63 6b 20 74 68 |ents we |check th|
|000016e0| 65 20 72 65 73 75 6d 65 | 4d 61 73 6b 20 62 69 74 |e resume|Mask bit|
|000016f0| 2e 7d 0d 09 6b 4f 53 45 | 76 65 6e 74 09 09 09 09 |.}..kOSE|vent....|
|00001700| 3d 20 61 70 70 34 45 76 | 74 3b 09 7b 65 76 65 6e |= app4Ev|t;.{even|
|00001710| 74 20 75 73 65 64 20 62 | 79 20 4d 75 6c 74 69 46 |t used b|y MultiF|
|00001720| 69 6e 64 65 72 7d 0d 09 | 6b 53 75 73 70 65 6e 64 |inder}..|kSuspend|
|00001730| 52 65 73 75 6d 65 4d 65 | 73 73 61 67 65 09 3d 20 |ResumeMe|ssage.= |
|00001740| 31 3b 09 09 7b 68 69 67 | 68 20 62 79 74 65 20 6f |1;..{hig|h byte o|
|00001750| 66 20 73 75 73 70 65 6e | 64 2f 72 65 73 75 6d 65 |f suspen|d/resume|
|00001760| 20 65 76 65 6e 74 20 6d | 65 73 73 61 67 65 7d 0d | event m|essage}.|
|00001770| 09 6b 52 65 73 75 6d 65 | 4d 61 73 6b 09 09 09 09 |.kResume|Mask....|
|00001780| 3d 20 31 3b 09 09 7b 62 | 69 74 20 6f 66 20 6d 65 |= 1;..{b|it of me|
|00001790| 73 73 61 67 65 20 66 69 | 65 6c 64 20 66 6f 72 20 |ssage fi|eld for |
|000017a0| 72 65 73 75 6d 65 20 76 | 73 2e 20 73 75 73 70 65 |resume v|s. suspe|
|000017b0| 6e 64 7d 0d 09 6b 4d 6f | 75 73 65 4d 6f 76 65 64 |nd}..kMo|useMoved|
|000017c0| 4d 65 73 73 61 67 65 09 | 09 3d 20 24 46 41 3b 09 |Message.|.= $FA;.|
|000017d0| 09 7b 68 69 67 68 20 62 | 79 74 65 20 6f 66 20 6d |.{high b|yte of m|
|000017e0| 6f 75 73 65 2d 6d 6f 76 | 65 64 20 65 76 65 6e 74 |ouse-mov|ed event|
|000017f0| 20 6d 65 73 73 61 67 65 | 7d 0d 0d 09 7b 31 2e 30 | message|}...{1.0|
|00001800| 31 20 2d 20 6b 4d 69 6e | 48 65 61 70 20 2d 20 54 |1 - kMin|Heap - T|
|00001810| 68 69 73 20 69 73 20 74 | 68 65 20 6d 69 6e 69 6d |his is t|he minim|
|00001820| 75 6d 20 72 65 73 75 6c | 74 20 66 72 6f 6d 20 74 |um resul|t from t|
|00001830| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 0d 09 20 65 |he follo|wing.. e|
|00001840| 71 75 61 74 69 6f 6e 3a | 0d 09 09 09 0d 09 09 09 |quation:|........|
|00001850| 4f 52 44 28 47 65 74 41 | 70 70 6c 4c 69 6d 69 74 |ORD(GetA|pplLimit|
|00001860| 29 20 2d 20 4f 52 44 28 | 41 70 70 6c 69 63 5a 6f |) - ORD(|ApplicZo|
|00001870| 6e 65 29 0d 09 09 09 0d | 09 20 66 6f 72 20 74 68 |ne).....|. for th|
|00001880| 65 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 74 6f |e applic|ation to|
|00001890| 20 72 75 6e 2e 20 49 74 | 20 77 69 6c 6c 20 69 6e | run. It| will in|
|000018a0| 73 75 72 65 20 74 68 61 | 74 20 65 6e 6f 75 67 68 |sure tha|t enough|
|000018b0| 20 6d 65 6d 6f 72 79 20 | 77 69 6c 6c 0d 09 20 62 | memory |will.. b|
|000018c0| 65 20 61 72 6f 75 6e 64 | 20 66 6f 72 20 72 65 61 |e around| for rea|
|000018d0| 73 6f 6e 61 62 6c 65 2d | 73 69 7a 65 64 20 73 63 |sonable-|sized sc|
|000018e0| 72 61 70 73 2c 20 46 4b | 45 59 73 2c 20 65 74 63 |raps, FK|EYs, etc|
|000018f0| 2e 20 74 6f 20 65 78 69 | 73 74 20 77 69 74 68 20 |. to exi|st with |
|00001900| 74 68 65 0d 09 20 61 70 | 70 6c 69 63 61 74 69 6f |the.. ap|plicatio|
|00001910| 6e 2c 20 61 6e 64 20 73 | 74 69 6c 6c 20 67 69 76 |n, and s|till giv|
|00001920| 65 20 74 68 65 20 61 70 | 70 6c 69 63 61 74 69 6f |e the ap|plicatio|
|00001930| 6e 20 73 6f 6d 65 20 27 | 62 72 65 61 74 68 69 6e |n some '|breathin|
|00001940| 67 20 72 6f 6f 6d 27 2e | 0d 09 20 54 6f 20 64 65 |g room'.|.. To de|
|00001950| 72 69 76 65 20 74 68 69 | 73 20 6e 75 6d 62 65 72 |rive thi|s number|
|00001960| 2c 20 77 65 20 72 61 6e | 20 75 6e 64 65 72 20 61 |, we ran| under a|
|00001970| 20 4d 75 6c 74 69 46 69 | 6e 64 65 72 20 70 61 72 | MultiFi|nder par|
|00001980| 74 69 74 69 6f 6e 20 74 | 68 61 74 20 77 61 73 0d |tition t|hat was.|
|00001990| 09 20 6f 75 72 20 72 65 | 71 75 65 73 74 65 64 20 |. our re|quested |
|000019a0| 6d 69 6e 69 6d 75 6d 20 | 73 69 7a 65 2c 20 61 73 |minimum |size, as|
|000019b0| 20 67 69 76 65 6e 20 69 | 6e 20 74 68 65 20 27 53 | given i|n the 'S|
|000019c0| 49 5a 45 27 20 72 65 73 | 6f 75 72 63 65 2e 7d 0d |IZE' res|ource.}.|
|000019d0| 09 20 0d 09 6b 4d 69 6e | 48 65 61 70 09 3d 20 32 |. ..kMin|Heap.= 2|
|000019e0| 39 20 2a 20 31 30 32 34 | 3b 0d 09 0d 09 7b 31 2e |9 * 1024|;....{1.|
|000019f0| 30 31 20 2d 20 6b 4d 69 | 6e 53 70 61 63 65 20 2d |01 - kMi|nSpace -|
|00001a00| 20 54 68 69 73 20 69 73 | 20 74 68 65 20 6d 69 6e | This is| the min|
|00001a10| 69 6d 75 6d 20 72 65 73 | 75 6c 74 20 66 72 6f 6d |imum res|ult from|
|00001a20| 20 50 75 72 67 65 53 70 | 61 63 65 2c 20 77 68 65 | PurgeSp|ace, whe|
|00001a30| 6e 20 63 61 6c 6c 65 64 | 0d 09 20 61 74 20 69 6e |n called|.. at in|
|00001a40| 69 74 69 61 6c 69 7a 61 | 74 69 6f 6e 20 74 69 6d |itializa|tion tim|
|00001a50| 65 2c 20 66 6f 72 20 74 | 68 65 20 61 70 70 6c 69 |e, for t|he appli|
|00001a60| 63 61 74 69 6f 6e 20 74 | 6f 20 72 75 6e 2e 20 54 |cation t|o run. T|
|00001a70| 68 69 73 20 6e 75 6d 62 | 65 72 20 61 63 74 73 0d |his numb|er acts.|
|00001a80| 09 20 61 73 20 61 20 64 | 6f 75 62 6c 65 2d 63 68 |. as a d|ouble-ch|
|00001a90| 65 63 6b 20 74 6f 20 69 | 6e 73 75 72 65 20 74 68 |eck to i|nsure th|
|00001aa0| 61 74 20 74 68 65 72 65 | 20 72 65 61 6c 6c 79 20 |at there| really |
|00001ab0| 69 73 20 65 6e 6f 75 67 | 68 20 6d 65 6d 6f 72 79 |is enoug|h memory|
|00001ac0| 20 66 6f 72 20 74 68 65 | 0d 09 20 61 70 70 6c 69 | for the|.. appli|
|00001ad0| 63 61 74 69 6f 6e 20 74 | 6f 20 72 75 6e 2c 20 69 |cation t|o run, i|
|00001ae0| 6e 63 6c 75 64 69 6e 67 | 20 77 68 61 74 20 68 61 |ncluding| what ha|
|00001af0| 73 20 62 65 65 6e 20 74 | 61 6b 65 6e 20 75 70 20 |s been t|aken up |
|00001b00| 61 6c 72 65 61 64 79 20 | 62 79 0d 09 20 70 72 65 |already |by.. pre|
|00001b10| 2d 6c 6f 61 64 65 64 20 | 72 65 73 6f 75 72 63 65 |-loaded |resource|
|00001b20| 73 2c 20 74 68 65 20 73 | 63 72 61 70 2c 20 63 6f |s, the s|crap, co|
|00001b30| 64 65 2c 20 61 6e 64 20 | 6f 74 68 65 72 20 73 75 |de, and |other su|
|00001b40| 6e 64 72 79 20 6d 65 6d | 6f 72 79 20 62 6c 6f 63 |ndry mem|ory bloc|
|00001b50| 6b 73 2e 7d 0d 09 20 0d | 09 6b 4d 69 6e 53 70 61 |ks.}.. .|.kMinSpa|
|00001b60| 63 65 09 3d 20 32 30 20 | 2a 20 31 30 32 34 3b 0d |ce.= 20 |* 1024;.|
|00001b70| 09 0d 09 7b 6b 45 78 74 | 72 65 6d 65 4e 65 67 20 |...{kExt|remeNeg |
|00001b80| 61 6e 64 20 6b 45 78 74 | 72 65 6d 65 50 6f 73 20 |and kExt|remePos |
|00001b90| 61 72 65 20 75 73 65 64 | 20 74 6f 20 73 65 74 20 |are used| to set |
|00001ba0| 75 70 20 77 69 64 65 20 | 6f 70 65 6e 20 72 65 63 |up wide |open rec|
|00001bb0| 74 61 6e 67 6c 65 73 20 | 61 6e 64 20 72 65 67 69 |tangles |and regi|
|00001bc0| 6f 6e 73 2e 7d 0d 09 6b | 45 78 74 72 65 6d 65 4e |ons.}..k|ExtremeN|
|00001bd0| 65 67 09 09 3d 20 2d 33 | 32 37 36 38 3b 0d 09 6b |eg..= -3|2768;..k|
|00001be0| 45 78 74 72 65 6d 65 50 | 6f 73 09 09 3d 20 33 32 |ExtremeP|os..= 32|
|00001bf0| 37 36 37 20 2d 20 31 3b | 09 7b 72 65 71 75 69 72 |767 - 1;|.{requir|
|00001c00| 65 64 20 66 6f 72 20 6f | 6c 64 20 72 65 67 69 6f |ed for o|ld regio|
|00001c10| 6e 20 62 75 67 7d 0d 09 | 0d 09 7b 6b 54 45 53 6c |n bug}..|..{kTESl|
|00001c20| 6f 70 20 70 72 6f 76 69 | 64 65 73 20 73 6f 6d 65 |op provi|des some|
|00001c30| 20 65 78 74 72 61 20 73 | 65 63 75 72 69 74 79 20 | extra s|ecurity |
|00001c40| 77 68 65 6e 20 70 72 65 | 2d 66 6c 69 67 68 74 69 |when pre|-flighti|
|00001c50| 6e 67 20 65 64 69 74 20 | 63 6f 6d 6d 61 6e 64 73 |ng edit |commands|
|00001c60| 2e 7d 0d 09 6b 54 45 53 | 6c 6f 70 09 09 09 3d 20 |.}..kTES|lop...= |
|00001c70| 31 30 32 34 3b 0d 0d 09 | 7b 6b 45 72 72 53 74 72 |1024;...|{kErrStr|
|00001c80| 69 6e 67 73 20 69 73 20 | 74 68 65 20 72 65 73 6f |ings is |the reso|
|00001c90| 75 72 63 65 20 49 44 20 | 66 6f 72 20 74 68 65 20 |urce ID |for the |
|00001ca0| 65 72 72 6f 72 20 73 74 | 72 69 6e 67 73 20 53 54 |error st|rings ST|
|00001cb0| 52 23 20 72 65 73 6f 75 | 72 63 65 2e 7d 0d 09 6b |R# resou|rce.}..k|
|00001cc0| 45 72 72 53 74 72 69 6e | 67 73 09 09 3d 20 31 32 |ErrStrin|gs..= 12|
|00001cd0| 38 3b 0d 0d 09 7b 54 68 | 65 20 66 6f 6c 6c 6f 77 |8;...{Th|e follow|
|00001ce0| 69 6e 67 20 61 72 65 20 | 69 6e 64 69 63 69 65 73 |ing are |indicies|
|00001cf0| 20 69 6e 74 6f 20 53 54 | 52 23 20 72 65 73 6f 75 | into ST|R# resou|
|00001d00| 72 63 65 73 2e 7d 0d 09 | 65 57 72 6f 6e 67 4d 61 |rces.}..|eWrongMa|
|00001d10| 63 68 69 6e 65 09 3d 20 | 31 3b 0d 09 65 53 6d 61 |chine.= |1;..eSma|
|00001d20| 6c 6c 53 69 7a 65 09 09 | 3d 20 32 3b 0d 09 65 4e |llSize..|= 2;..eN|
|00001d30| 6f 4d 65 6d 6f 72 79 09 | 09 3d 20 33 3b 0d 09 65 |oMemory.|.= 3;..e|
|00001d40| 4e 6f 53 70 61 63 65 43 | 75 74 09 09 3d 20 34 3b |NoSpaceC|ut..= 4;|
|00001d50| 0d 09 65 4e 6f 43 75 74 | 09 09 09 3d 20 35 3b 0d |..eNoCut|...= 5;.|
|00001d60| 09 65 4e 6f 43 6f 70 79 | 09 09 09 3d 20 36 3b 0d |.eNoCopy|...= 6;.|
|00001d70| 09 65 45 78 63 65 65 64 | 50 61 73 74 65 09 3d 20 |.eExceed|Paste.= |
|00001d80| 37 3b 0d 09 65 4e 6f 53 | 70 61 63 65 50 61 73 74 |7;..eNoS|pacePast|
|00001d90| 65 09 3d 20 38 3b 0d 09 | 65 4e 6f 57 69 6e 64 6f |e.= 8;..|eNoWindo|
|00001da0| 77 09 09 3d 20 39 3b 0d | 09 65 45 78 63 65 65 64 |w..= 9;.|.eExceed|
|00001db0| 43 68 61 72 09 09 3d 20 | 31 30 3b 0d 09 65 4e 6f |Char..= |10;..eNo|
|00001dc0| 50 61 73 74 65 09 09 3d | 20 31 31 3b 0d 09 0d 09 |Paste..=| 11;....|
|00001dd0| 7b 54 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 63 |{The fol|lowing c|
|00001de0| 6f 6e 73 74 61 6e 74 73 | 20 61 72 65 20 61 6c 6c |onstants| are all|
|00001df0| 20 72 65 73 6f 75 72 63 | 65 20 49 44 73 2c 20 63 | resourc|e IDs, c|
|00001e00| 6f 72 72 65 73 70 6f 6e | 64 69 6e 67 20 74 6f 20 |orrespon|ding to |
|00001e10| 72 65 73 6f 75 72 63 65 | 73 20 69 6e 20 53 61 6d |resource|s in Sam|
|00001e20| 70 6c 65 2e 72 2e 7d 0d | 09 72 4d 65 6e 75 42 61 |ple.r.}.|.rMenuBa|
|00001e30| 72 09 3d 20 31 32 38 3b | 09 09 09 09 09 7b 61 70 |r.= 128;|.....{ap|
|00001e40| 70 6c 69 63 61 74 69 6f | 6e 27 73 20 6d 65 6e 75 |plicatio|n's menu|
|00001e50| 20 62 61 72 7d 0d 09 72 | 41 62 6f 75 74 41 6c 65 | bar}..r|AboutAle|
|00001e60| 72 74 09 3d 20 31 32 38 | 3b 09 09 09 09 09 7b 61 |rt.= 128|;.....{a|
|00001e70| 62 6f 75 74 20 61 6c 65 | 72 74 7d 0d 09 72 55 73 |bout ale|rt}..rUs|
|00001e80| 65 72 41 6c 65 72 74 09 | 3d 20 31 32 39 3b 09 09 |erAlert.|= 129;..|
|00001e90| 09 09 09 7b 75 73 65 72 | 20 65 72 72 6f 72 20 61 |...{user| error a|
|00001ea0| 6c 65 72 74 7d 0d 09 72 | 44 6f 63 57 69 6e 64 6f |lert}..r|DocWindo|
|00001eb0| 77 09 3d 20 31 32 38 3b | 09 09 09 09 09 7b 61 70 |w.= 128;|.....{ap|
|00001ec0| 70 6c 69 63 61 74 69 6f | 6e 27 73 20 77 69 6e 64 |plicatio|n's wind|
|00001ed0| 6f 77 7d 0d 09 72 56 53 | 63 72 6f 6c 6c 09 3d 20 |ow}..rVS|croll.= |
|00001ee0| 31 32 38 3b 09 09 09 09 | 09 7b 76 65 72 74 69 63 |128;....|.{vertic|
|00001ef0| 61 6c 20 73 63 72 6f 6c | 6c 62 61 72 20 63 6f 6e |al scrol|lbar con|
|00001f00| 74 72 6f 6c 7d 0d 09 72 | 48 53 63 72 6f 6c 6c 09 |trol}..r|HScroll.|
|00001f10| 3d 20 31 32 39 3b 09 09 | 09 09 09 7b 68 6f 72 69 |= 129;..|...{hori|
|00001f20| 7a 6f 6e 74 61 6c 20 73 | 63 72 6f 6c 6c 62 61 72 |zontal s|crollbar|
|00001f30| 20 63 6f 6e 74 72 6f 6c | 7d 0d 0d 09 7b 54 68 65 | control|}...{The|
|00001f40| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 63 6f 6e 73 74 | followi|ng const|
|00001f50| 61 6e 74 73 20 61 72 65 | 20 75 73 65 64 20 74 6f |ants are| used to|
|00001f60| 20 69 64 65 6e 74 69 66 | 79 20 6d 65 6e 75 73 20 | identif|y menus |
|00001f70| 61 6e 64 20 74 68 65 69 | 72 20 69 74 65 6d 73 2e |and thei|r items.|
|00001f80| 20 54 68 65 20 6d 65 6e | 75 20 49 44 73 0d 09 20 | The men|u IDs.. |
|00001f90| 68 61 76 65 20 61 6e 20 | 22 6d 22 20 70 72 65 66 |have an |"m" pref|
|00001fa0| 69 78 20 61 6e 64 20 74 | 68 65 20 69 74 65 6d 20 |ix and t|he item |
|00001fb0| 6e 75 6d 62 65 72 73 20 | 77 69 74 68 69 6e 20 65 |numbers |within e|
|00001fc0| 61 63 68 20 6d 65 6e 75 | 20 68 61 76 65 20 61 6e |ach menu| have an|
|00001fd0| 20 22 69 22 20 70 72 65 | 66 69 78 2e 7d 0d 09 6d | "i" pre|fix.}..m|
|00001fe0| 41 70 70 6c 65 09 09 3d | 20 31 32 38 3b 09 09 09 |Apple..=| 128;...|
|00001ff0| 09 09 7b 41 70 70 6c 65 | 20 6d 65 6e 75 7d 0d 09 |..{Apple| menu}..|
|00002000| 69 41 62 6f 75 74 09 09 | 3d 20 31 3b 0d 0d 09 6d |iAbout..|= 1;...m|
|00002010| 46 69 6c 65 09 09 3d 20 | 31 32 39 3b 09 09 09 09 |File..= |129;....|
|00002020| 09 7b 46 69 6c 65 20 6d | 65 6e 75 7d 0d 09 69 4e |.{File m|enu}..iN|
|00002030| 65 77 09 09 3d 20 31 3b | 0d 09 69 43 6c 6f 73 65 |ew..= 1;|..iClose|
|00002040| 09 09 3d 20 34 3b 0d 09 | 69 51 75 69 74 09 09 3d |..= 4;..|iQuit..=|
|00002050| 20 31 32 3b 0d 0d 09 6d | 45 64 69 74 09 09 3d 20 | 12;...m|Edit..= |
|00002060| 31 33 30 3b 09 09 09 09 | 09 7b 45 64 69 74 20 6d |130;....|.{Edit m|
|00002070| 65 6e 75 7d 0d 09 69 55 | 6e 64 6f 09 09 3d 20 31 |enu}..iU|ndo..= 1|
|00002080| 3b 0d 09 69 43 75 74 09 | 09 3d 20 33 3b 0d 09 69 |;..iCut.|.= 3;..i|
|00002090| 43 6f 70 79 09 09 3d 20 | 34 3b 0d 09 69 50 61 73 |Copy..= |4;..iPas|
|000020a0| 74 65 09 09 3d 20 35 3b | 0d 09 69 43 6c 65 61 72 |te..= 5;|..iClear|
|000020b0| 09 09 3d 20 36 3b 0d 0d | 0d 54 59 50 45 0d 09 7b |..= 6;..|.TYPE..{|
|000020c0| 41 20 44 6f 63 75 6d 65 | 6e 74 52 65 63 6f 72 64 |A Docume|ntRecord|
|000020d0| 20 63 6f 6e 74 61 69 6e | 73 20 74 68 65 20 57 69 | contain|s the Wi|
|000020e0| 6e 64 6f 77 52 65 63 6f | 72 64 20 66 6f 72 20 6f |ndowReco|rd for o|
|000020f0| 6e 65 20 6f 66 20 6f 75 | 72 20 64 6f 63 75 6d 65 |ne of ou|r docume|
|00002100| 6e 74 20 77 69 6e 64 6f | 77 73 2c 0d 09 20 61 73 |nt windo|ws,.. as|
|00002110| 20 77 65 6c 6c 20 61 73 | 20 74 68 65 20 54 45 48 | well as| the TEH|
|00002120| 61 6e 64 6c 65 20 66 6f | 72 20 74 68 65 20 74 65 |andle fo|r the te|
|00002130| 78 74 20 77 65 20 61 72 | 65 20 65 64 69 74 69 6e |xt we ar|e editin|
|00002140| 67 2e 20 57 65 20 68 61 | 76 65 20 61 64 64 65 64 |g. We ha|ve added|
|00002150| 20 66 69 65 6c 64 73 20 | 74 6f 0d 09 20 68 6f 6c | fields |to.. hol|
|00002160| 64 20 74 68 65 20 43 6f | 6e 74 72 6f 6c 48 61 6e |d the Co|ntrolHan|
|00002170| 64 6c 65 73 20 74 6f 20 | 74 68 65 20 76 65 72 74 |dles to |the vert|
|00002180| 69 63 61 6c 20 61 6e 64 | 20 68 6f 72 69 7a 6f 6e |ical and| horizon|
|00002190| 74 61 6c 20 73 63 72 6f | 6c 6c 62 61 72 73 20 61 |tal scro|llbars a|
|000021a0| 6e 64 20 74 6f 20 68 6f | 6c 64 0d 09 20 74 68 65 |nd to ho|ld.. the|
|000021b0| 20 61 64 64 72 65 73 73 | 20 6f 66 20 74 68 65 20 | address| of the |
|000021c0| 64 65 66 61 75 6c 74 20 | 63 6c 69 6b 4c 6f 6f 70 |default |clikLoop|
|000021d0| 20 74 68 61 74 20 67 65 | 74 73 20 61 74 74 61 63 | that ge|ts attac|
|000021e0| 68 65 64 20 74 6f 20 61 | 20 54 45 52 65 63 20 77 |hed to a| TERec w|
|000021f0| 68 65 6e 20 79 6f 75 20 | 63 61 6c 6c 0d 09 20 54 |hen you |call.. T|
|00002200| 45 41 75 74 6f 56 69 65 | 77 2e 20 4f 74 68 65 72 |EAutoVie|w. Other|
|00002210| 20 64 6f 63 75 6d 65 6e | 74 20 66 69 65 6c 64 73 | documen|t fields|
|00002220| 20 63 61 6e 20 62 65 20 | 61 64 64 65 64 20 74 6f | can be |added to|
|00002230| 20 74 68 69 73 20 72 65 | 63 6f 72 64 20 61 73 20 | this re|cord as |
|00002240| 6e 65 65 64 65 64 2e 20 | 46 6f 72 0d 09 20 61 20 |needed. |For.. a |
|00002250| 73 69 6d 69 6c 61 72 20 | 65 78 61 6d 70 6c 65 2c |similar |example,|
|00002260| 20 73 65 65 20 68 6f 77 | 20 74 68 65 20 57 69 6e | see how| the Win|
|00002270| 64 6f 77 20 4d 61 6e 61 | 67 65 72 20 61 6e 64 20 |dow Mana|ger and |
|00002280| 44 69 61 6c 6f 67 20 4d | 61 6e 61 67 65 72 20 61 |Dialog M|anager a|
|00002290| 64 64 20 66 69 65 6c 64 | 73 0d 09 20 61 66 74 65 |dd field|s.. afte|
|000022a0| 72 20 74 68 65 20 47 72 | 61 66 50 6f 72 74 2e 7d |r the Gr|afPort.}|
|000022b0| 0d 09 44 6f 63 75 6d 65 | 6e 74 52 65 63 6f 72 64 |..Docume|ntRecord|
|000022c0| 09 3d 20 52 45 43 4f 52 | 44 0d 09 09 64 6f 63 57 |.= RECOR|D...docW|
|000022d0| 69 6e 64 6f 77 09 3a 20 | 57 69 6e 64 6f 77 52 65 |indow.: |WindowRe|
|000022e0| 63 6f 72 64 3b 0d 09 09 | 64 6f 63 54 45 09 09 3a |cord;...|docTE..:|
|000022f0| 20 54 45 48 61 6e 64 6c | 65 3b 0d 09 09 64 6f 63 | TEHandl|e;...doc|
|00002300| 56 53 63 72 6f 6c 6c 09 | 3a 20 43 6f 6e 74 72 6f |VScroll.|: Contro|
|00002310| 6c 48 61 6e 64 6c 65 3b | 0d 09 09 64 6f 63 48 53 |lHandle;|...docHS|
|00002320| 63 72 6f 6c 6c 09 3a 20 | 43 6f 6e 74 72 6f 6c 48 |croll.: |ControlH|
|00002330| 61 6e 64 6c 65 3b 0d 09 | 09 64 6f 63 43 6c 69 6b |andle;..|.docClik|
|00002340| 09 09 3a 20 50 72 6f 63 | 50 74 72 3b 0d 09 45 4e |..: Proc|Ptr;..EN|
|00002350| 44 3b 0d 09 44 6f 63 75 | 6d 65 6e 74 50 65 65 6b |D;..Docu|mentPeek|
|00002360| 09 3d 20 5e 44 6f 63 75 | 6d 65 6e 74 52 65 63 6f |.= ^Docu|mentReco|
|00002370| 72 64 3b 0d 0d 0d 56 41 | 52 0d 09 7b 54 68 65 20 |rd;...VA|R..{The |
|00002380| 22 67 22 20 70 72 65 66 | 69 78 20 69 73 20 75 73 |"g" pref|ix is us|
|00002390| 65 64 20 74 6f 20 65 6d | 70 68 61 73 69 7a 65 20 |ed to em|phasize |
|000023a0| 74 68 61 74 20 61 20 76 | 61 72 69 61 62 6c 65 20 |that a v|ariable |
|000023b0| 69 73 20 67 6c 6f 62 61 | 6c 2e 7d 0d 0d 09 7b 47 |is globa|l.}...{G|
|000023c0| 4d 61 63 20 69 73 20 75 | 73 65 64 20 74 6f 20 68 |Mac is u|sed to h|
|000023d0| 6f 6c 64 20 74 68 65 20 | 72 65 73 75 6c 74 20 6f |old the |result o|
|000023e0| 66 20 61 20 53 79 73 45 | 6e 76 69 72 6f 6e 73 20 |f a SysE|nvirons |
|000023f0| 63 61 6c 6c 2e 20 54 68 | 69 73 20 6d 61 6b 65 73 |call. Th|is makes|
|00002400| 0d 09 20 69 74 20 63 6f | 6e 76 65 6e 69 65 6e 74 |.. it co|nvenient|
|00002410| 20 66 6f 72 20 61 6e 79 | 20 72 6f 75 74 69 6e 65 | for any| routine|
|00002420| 20 74 6f 20 63 68 65 63 | 6b 20 74 68 65 20 65 6e | to chec|k the en|
|00002430| 76 69 72 6f 6e 6d 65 6e | 74 2e 20 49 74 20 69 73 |vironmen|t. It is|
|00002440| 0d 09 20 67 6c 6f 62 61 | 6c 20 69 6e 66 6f 72 6d |.. globa|l inform|
|00002450| 61 74 69 6f 6e 2c 20 61 | 6e 79 77 61 79 2e 7d 0d |ation, a|nyway.}.|
|00002460| 09 67 4d 61 63 09 09 09 | 09 3a 20 53 79 73 45 6e |.gMac...|.: SysEn|
|00002470| 76 52 65 63 3b 09 7b 73 | 65 74 20 75 70 20 62 79 |vRec;.{s|et up by|
|00002480| 20 49 6e 69 74 69 61 6c | 69 7a 65 7d 0d 0d 09 7b | Initial|ize}...{|
|00002490| 47 48 61 73 57 61 69 74 | 4e 65 78 74 45 76 65 6e |GHasWait|NextEven|
|000024a0| 74 20 69 73 20 73 65 74 | 20 61 74 20 73 74 61 72 |t is set| at star|
|000024b0| 74 75 70 2c 20 61 6e 64 | 20 74 65 6c 6c 73 20 77 |tup, and| tells w|
|000024c0| 68 65 74 68 65 72 20 74 | 68 65 20 57 61 69 74 4e |hether t|he WaitN|
|000024d0| 65 78 74 45 76 65 6e 74 | 0d 09 20 74 72 61 70 20 |extEvent|.. trap |
|000024e0| 69 73 20 61 76 61 69 6c | 61 62 6c 65 2e 20 49 66 |is avail|able. If|
|000024f0| 20 69 74 20 69 73 20 66 | 61 6c 73 65 2c 20 77 65 | it is f|alse, we|
|00002500| 20 6b 6e 6f 77 20 74 68 | 61 74 20 77 65 20 6d 75 | know th|at we mu|
|00002510| 73 74 20 63 61 6c 6c 20 | 47 65 74 4e 65 78 74 45 |st call |GetNextE|
|00002520| 76 65 6e 74 2e 7d 0d 09 | 67 48 61 73 57 61 69 74 |vent.}..|gHasWait|
|00002530| 4e 65 78 74 45 76 65 6e | 74 09 3a 20 42 4f 4f 4c |NextEven|t.: BOOL|
|00002540| 45 41 4e 3b 09 09 7b 73 | 65 74 20 75 70 20 62 79 |EAN;..{s|et up by|
|00002550| 20 49 6e 69 74 69 61 6c | 69 7a 65 7d 0d 0d 09 7b | Initial|ize}...{|
|00002560| 47 49 6e 42 61 63 6b 67 | 72 6f 75 6e 64 20 69 73 |GInBackg|round is|
|00002570| 20 6d 61 69 6e 74 61 69 | 6e 65 64 20 62 79 20 6f | maintai|ned by o|
|00002580| 75 72 20 4f 53 45 76 65 | 6e 74 20 68 61 6e 64 6c |ur OSEve|nt handl|
|00002590| 69 6e 67 20 72 6f 75 74 | 69 6e 65 73 2e 20 41 6e |ing rout|ines. An|
|000025a0| 79 20 70 61 72 74 20 6f | 66 0d 09 20 74 68 65 20 |y part o|f.. the |
|000025b0| 70 72 6f 67 72 61 6d 20 | 63 61 6e 20 63 68 65 63 |program |can chec|
|000025c0| 6b 20 69 74 20 74 6f 20 | 66 69 6e 64 20 6f 75 74 |k it to |find out|
|000025d0| 20 69 66 20 69 74 20 69 | 73 20 63 75 72 72 65 6e | if it i|s curren|
|000025e0| 74 6c 79 20 69 6e 20 74 | 68 65 20 62 61 63 6b 67 |tly in t|he backg|
|000025f0| 72 6f 75 6e 64 2e 7d 0d | 09 67 49 6e 42 61 63 6b |round.}.|.gInBack|
|00002600| 67 72 6f 75 6e 64 09 09 | 3a 20 42 4f 4f 4c 45 41 |ground..|: BOOLEA|
|00002610| 4e 3b 09 09 7b 6d 61 69 | 6e 74 61 69 6e 65 64 20 |N;..{mai|ntained |
|00002620| 62 79 20 49 6e 69 74 69 | 61 6c 69 7a 65 20 61 6e |by Initi|alize an|
|00002630| 64 20 44 6f 45 76 65 6e | 74 7d 0d 0d 09 7b 47 4e |d DoEven|t}...{GN|
|00002640| 75 6d 44 6f 63 75 6d 65 | 6e 74 73 20 69 73 20 75 |umDocume|nts is u|
|00002650| 73 65 64 20 74 6f 20 6b | 65 65 70 20 74 72 61 63 |sed to k|eep trac|
|00002660| 6b 20 6f 66 20 68 6f 77 | 20 6d 61 6e 79 20 6f 70 |k of how| many op|
|00002670| 65 6e 20 64 6f 63 75 6d | 65 6e 74 73 20 74 68 65 |en docum|ents the|
|00002680| 72 65 20 61 72 65 0d 09 | 20 61 74 20 61 6e 79 20 |re are..| at any |
|00002690| 74 69 6d 65 2e 20 49 74 | 20 69 73 20 6d 61 69 6e |time. It| is main|
|000026a0| 74 61 69 6e 65 64 20 62 | 79 20 74 68 65 20 72 6f |tained b|y the ro|
|000026b0| 75 74 69 6e 65 73 20 74 | 68 61 74 20 6f 70 65 6e |utines t|hat open|
|000026c0| 20 61 6e 64 20 63 6c 6f | 73 65 20 64 6f 63 75 6d | and clo|se docum|
|000026d0| 65 6e 74 73 2e 7d 0d 09 | 67 4e 75 6d 44 6f 63 75 |ents.}..|gNumDocu|
|000026e0| 6d 65 6e 74 73 09 09 3a | 20 49 4e 54 45 47 45 52 |ments..:| INTEGER|
|000026f0| 3b 09 09 7b 6d 61 69 6e | 74 61 69 6e 65 64 20 62 |;..{main|tained b|
|00002700| 79 20 49 6e 69 74 69 61 | 6c 69 7a 65 2c 20 44 6f |y Initia|lize, Do|
|00002710| 4e 65 77 2c 20 61 6e 64 | 20 44 6f 43 6c 6f 73 65 |New, and| DoClose|
|00002720| 57 69 6e 64 6f 77 7d 0d | 0d 09 0d 7b 24 53 20 49 |Window}.|...{$S I|
|00002730| 6e 69 74 69 61 6c 69 7a | 65 7d 0d 46 55 4e 43 54 |nitializ|e}.FUNCT|
|00002740| 49 4f 4e 20 54 72 61 70 | 41 76 61 69 6c 61 62 6c |ION Trap|Availabl|
|00002750| 65 28 74 4e 75 6d 62 65 | 72 3a 20 49 4e 54 45 47 |e(tNumbe|r: INTEG|
|00002760| 45 52 3b 20 74 54 79 70 | 65 3a 20 54 72 61 70 54 |ER; tTyp|e: TrapT|
|00002770| 79 70 65 29 3a 20 42 4f | 4f 4c 45 41 4e 3b 0d 0d |ype): BO|OLEAN;..|
|00002780| 7b 43 68 65 63 6b 20 74 | 6f 20 73 65 65 20 69 66 |{Check t|o see if|
|00002790| 20 61 20 67 69 76 65 6e | 20 74 72 61 70 20 69 73 | a given| trap is|
|000027a0| 20 69 6d 70 6c 65 6d 65 | 6e 74 65 64 2e 20 54 68 | impleme|nted. Th|
|000027b0| 69 73 20 69 73 20 6f 6e | 6c 79 20 75 73 65 64 20 |is is on|ly used |
|000027c0| 62 79 20 74 68 65 0d 20 | 49 6e 69 74 69 61 6c 69 |by the. |Initiali|
|000027d0| 7a 65 20 72 6f 75 74 69 | 6e 65 20 69 6e 20 74 68 |ze routi|ne in th|
|000027e0| 69 73 20 70 72 6f 67 72 | 61 6d 2c 20 73 6f 20 77 |is progr|am, so w|
|000027f0| 65 20 70 75 74 20 69 74 | 20 69 6e 20 74 68 65 20 |e put it| in the |
|00002800| 49 6e 69 74 69 61 6c 69 | 7a 65 20 73 65 67 6d 65 |Initiali|ze segme|
|00002810| 6e 74 2e 7d 0d 0d 42 45 | 47 49 4e 0d 09 7b 43 68 |nt.}..BE|GIN..{Ch|
|00002820| 65 63 6b 20 61 6e 64 20 | 73 65 65 20 69 66 20 74 |eck and |see if t|
|00002830| 68 65 20 74 72 61 70 20 | 65 78 69 73 74 73 2e 20 |he trap |exists. |
|00002840| 4f 6e 20 36 34 4b 20 52 | 4f 4d 20 6d 61 63 68 69 |On 64K R|OM machi|
|00002850| 6e 65 73 2c 20 74 54 79 | 70 65 20 77 69 6c 6c 20 |nes, tTy|pe will |
|00002860| 62 65 20 69 67 6e 6f 72 | 65 64 2e 7d 0d 0d 09 54 |be ignor|ed.}...T|
|00002870| 72 61 70 41 76 61 69 6c | 61 62 6c 65 20 3a 3d 20 |rapAvail|able := |
|00002880| 4e 47 65 74 54 72 61 70 | 41 64 64 72 65 73 73 28 |NGetTrap|Address(|
|00002890| 74 4e 75 6d 62 65 72 2c | 20 74 54 79 70 65 29 20 |tNumber,| tType) |
|000028a0| 3c 3e 20 47 65 74 54 72 | 61 70 41 64 64 72 65 73 |<> GetTr|apAddres|
|000028b0| 73 28 5f 55 6e 69 6d 70 | 6c 65 6d 65 6e 74 65 64 |s(_Unimp|lemented|
|000028c0| 29 3b 0d 45 4e 44 3b 20 | 7b 54 72 61 70 41 76 61 |);.END; |{TrapAva|
|000028d0| 69 6c 61 62 6c 65 7d 0d | 0d 0d 7b 24 53 20 4d 61 |ilable}.|..{$S Ma|
|000028e0| 69 6e 7d 0d 46 55 4e 43 | 54 49 4f 4e 20 49 73 44 |in}.FUNC|TION IsD|
|000028f0| 41 57 69 6e 64 6f 77 28 | 77 69 6e 64 6f 77 3a 20 |AWindow(|window: |
|00002900| 57 69 6e 64 6f 77 50 74 | 72 29 3a 20 42 4f 4f 4c |WindowPt|r): BOOL|
|00002910| 45 41 4e 3b 0d 0d 7b 43 | 68 65 63 6b 20 69 66 20 |EAN;..{C|heck if |
|00002920| 61 20 77 69 6e 64 6f 77 | 20 62 65 6c 6f 6e 67 73 |a window| belongs|
|00002930| 20 74 6f 20 61 20 64 65 | 73 6b 20 61 63 63 65 73 | to a de|sk acces|
|00002940| 73 6f 72 79 2e 7d 0d 0d | 42 45 47 49 4e 0d 09 49 |sory.}..|BEGIN..I|
|00002950| 46 20 77 69 6e 64 6f 77 | 20 3d 20 4e 49 4c 20 54 |F window| = NIL T|
|00002960| 48 45 4e 0d 09 09 49 73 | 44 41 57 69 6e 64 6f 77 |HEN...Is|DAWindow|
|00002970| 20 3a 3d 20 46 41 4c 53 | 45 0d 09 45 4c 53 45 09 | := FALS|E..ELSE.|
|00002980| 7b 44 41 20 77 69 6e 64 | 6f 77 73 20 68 61 76 65 |{DA wind|ows have|
|00002990| 20 6e 65 67 61 74 69 76 | 65 20 77 69 6e 64 6f 77 | negativ|e window|
|000029a0| 4b 69 6e 64 73 7d 0d 09 | 09 49 73 44 41 57 69 6e |Kinds}..|.IsDAWin|
|000029b0| 64 6f 77 20 3a 3d 20 57 | 69 6e 64 6f 77 50 65 65 |dow := W|indowPee|
|000029c0| 6b 28 77 69 6e 64 6f 77 | 29 5e 2e 77 69 6e 64 6f |k(window|)^.windo|
|000029d0| 77 4b 69 6e 64 20 3c 20 | 30 3b 0d 45 4e 44 3b 20 |wKind < |0;.END; |
|000029e0| 7b 49 73 44 41 57 69 6e | 64 6f 77 7d 0d 0d 0d 7b |{IsDAWin|dow}...{|
|000029f0| 24 53 20 4d 61 69 6e 7d | 0d 46 55 4e 43 54 49 4f |$S Main}|.FUNCTIO|
|00002a00| 4e 20 49 73 41 70 70 57 | 69 6e 64 6f 77 28 77 69 |N IsAppW|indow(wi|
|00002a10| 6e 64 6f 77 3a 20 57 69 | 6e 64 6f 77 50 74 72 29 |ndow: Wi|ndowPtr)|
|00002a20| 3a 20 42 4f 4f 4c 45 41 | 4e 3b 0d 0d 7b 43 68 65 |: BOOLEA|N;..{Che|
|00002a30| 63 6b 20 69 66 20 61 20 | 77 69 6e 64 6f 77 20 62 |ck if a |window b|
|00002a40| 65 6c 6f 6e 67 73 20 74 | 6f 20 74 68 65 20 61 70 |elongs t|o the ap|
|00002a50| 70 6c 69 63 61 74 69 6f | 6e 2e 7d 0d 0d 42 45 47 |plicatio|n.}..BEG|
|00002a60| 49 4e 0d 09 49 46 20 77 | 69 6e 64 6f 77 20 3d 20 |IN..IF w|indow = |
|00002a70| 4e 49 4c 20 54 48 45 4e | 0d 09 09 49 73 41 70 70 |NIL THEN|...IsApp|
|00002a80| 57 69 6e 64 6f 77 20 3a | 3d 20 46 41 4c 53 45 0d |Window :|= FALSE.|
|00002a90| 09 45 4c 53 45 09 7b 61 | 70 70 6c 69 63 61 74 69 |.ELSE.{a|pplicati|
|00002aa0| 6f 6e 20 77 69 6e 64 6f | 77 73 20 68 61 76 65 20 |on windo|ws have |
|00002ab0| 6e 6f 6e 2d 6e 65 67 61 | 74 69 76 65 20 77 69 6e |non-nega|tive win|
|00002ac0| 64 6f 77 4b 69 6e 64 73 | 7d 0d 09 09 49 73 41 70 |dowKinds|}...IsAp|
|00002ad0| 70 57 69 6e 64 6f 77 20 | 3a 3d 20 57 69 6e 64 6f |pWindow |:= Windo|
|00002ae0| 77 50 65 65 6b 28 77 69 | 6e 64 6f 77 29 5e 2e 77 |wPeek(wi|ndow)^.w|
|00002af0| 69 6e 64 6f 77 4b 69 6e | 64 20 3e 3d 20 30 3b 0d |indowKin|d >= 0;.|
|00002b00| 45 4e 44 3b 20 7b 49 73 | 41 70 70 57 69 6e 64 6f |END; {Is|AppWindo|
|00002b10| 77 7d 0d 0d 0d 7b 24 53 | 20 4d 61 69 6e 7d 0d 50 |w}...{$S| Main}.P|
|00002b20| 52 4f 43 45 44 55 52 45 | 20 41 6c 65 72 74 55 73 |ROCEDURE| AlertUs|
|00002b30| 65 72 28 65 72 72 6f 72 | 3a 20 49 4e 54 45 47 45 |er(error|: INTEGE|
|00002b40| 52 29 3b 0d 0d 7b 44 69 | 73 70 6c 61 79 20 61 6e |R);..{Di|splay an|
|00002b50| 20 61 6c 65 72 74 20 74 | 68 61 74 20 74 65 6c 6c | alert t|hat tell|
|00002b60| 73 20 74 68 65 20 75 73 | 65 72 20 61 6e 20 65 72 |s the us|er an er|
|00002b70| 72 6f 72 20 6f 63 63 75 | 72 72 65 64 2c 20 74 68 |ror occu|rred, th|
|00002b80| 65 6e 20 65 78 69 74 20 | 74 68 65 20 70 72 6f 67 |en exit |the prog|
|00002b90| 72 61 6d 2e 0d 20 54 68 | 69 73 20 72 6f 75 74 69 |ram.. Th|is routi|
|00002ba0| 6e 65 20 69 73 20 75 73 | 65 64 20 61 73 20 61 6e |ne is us|ed as an|
|00002bb0| 20 75 6c 74 69 6d 61 74 | 65 20 62 61 69 6c 2d 6f | ultimat|e bail-o|
|00002bc0| 75 74 20 66 6f 72 20 73 | 65 72 69 6f 75 73 20 65 |ut for s|erious e|
|00002bd0| 72 72 6f 72 73 20 74 68 | 61 74 20 70 72 6f 68 69 |rrors th|at prohi|
|00002be0| 62 69 74 0d 20 74 68 65 | 20 63 6f 6e 74 69 6e 75 |bit. the| continu|
|00002bf0| 61 74 69 6f 6e 20 6f 66 | 20 74 68 65 20 61 70 70 |ation of| the app|
|00002c00| 6c 69 63 61 74 69 6f 6e | 2e 20 45 72 72 6f 72 73 |lication|. Errors|
|00002c10| 20 74 68 61 74 20 64 6f | 20 6e 6f 74 20 72 65 71 | that do| not req|
|00002c20| 75 69 72 65 20 74 68 65 | 20 74 65 72 6d 69 6e 61 |uire the| termina|
|00002c30| 74 69 6f 6e 0d 20 6f 66 | 20 74 68 65 20 61 70 70 |tion. of| the app|
|00002c40| 6c 69 63 61 74 69 6f 6e | 20 73 68 6f 75 6c 64 20 |lication| should |
|00002c50| 62 65 20 68 61 6e 64 6c | 65 64 20 69 6e 20 61 20 |be handl|ed in a |
|00002c60| 64 69 66 66 65 72 65 6e | 74 20 6d 61 6e 6e 65 72 |differen|t manner|
|00002c70| 2e 20 45 72 72 6f 72 20 | 63 68 65 63 6b 69 6e 67 |. Error |checking|
|00002c80| 20 61 6e 64 0d 20 72 65 | 70 6f 72 74 69 6e 67 20 | and. re|porting |
|00002c90| 68 61 73 20 61 20 70 6c | 61 63 65 20 65 76 65 6e |has a pl|ace even|
|00002ca0| 20 69 6e 20 74 68 65 20 | 73 69 6d 70 6c 65 73 74 | in the |simplest|
|00002cb0| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 2e 20 54 68 | applica|tion. Th|
|00002cc0| 65 20 65 72 72 6f 72 20 | 6e 75 6d 62 65 72 20 69 |e error |number i|
|00002cd0| 73 20 75 73 65 64 0d 20 | 74 6f 20 69 6e 64 65 78 |s used. |to index|
|00002ce0| 20 61 6e 20 27 53 54 52 | 23 27 20 72 65 73 6f 75 | an 'STR|#' resou|
|00002cf0| 72 63 65 20 73 6f 20 74 | 68 61 74 20 61 20 72 65 |rce so t|hat a re|
|00002d00| 6c 65 76 61 6e 74 20 6d | 65 73 73 61 67 65 20 63 |levant m|essage c|
|00002d10| 61 6e 20 62 65 20 64 69 | 73 70 6c 61 79 65 64 2e |an be di|splayed.|
|00002d20| 7d 0d 20 0d 56 41 52 0d | 09 69 74 65 6d 48 69 74 |}. .VAR.|.itemHit|
|00002d30| 09 3a 20 49 4e 54 45 47 | 45 52 3b 0d 09 6d 65 73 |.: INTEG|ER;..mes|
|00002d40| 73 61 67 65 09 3a 20 53 | 74 72 32 35 35 3b 0d 42 |sage.: S|tr255;.B|
|00002d50| 45 47 49 4e 0d 09 53 65 | 74 43 75 72 73 6f 72 28 |EGIN..Se|tCursor(|
|00002d60| 61 72 72 6f 77 29 3b 0d | 09 47 65 74 49 6e 64 53 |arrow);.|.GetIndS|
|00002d70| 74 72 69 6e 67 28 6d 65 | 73 73 61 67 65 2c 20 6b |tring(me|ssage, k|
|00002d80| 45 72 72 53 74 72 69 6e | 67 73 2c 20 65 72 72 6f |ErrStrin|gs, erro|
|00002d90| 72 29 3b 0d 09 50 61 72 | 61 6d 54 65 78 74 28 6d |r);..Par|amText(m|
|00002da0| 65 73 73 61 67 65 2c 20 | 27 27 2c 20 27 27 2c 20 |essage, |'', '', |
|00002db0| 27 27 29 3b 0d 09 69 74 | 65 6d 48 69 74 20 3a 3d |'');..it|emHit :=|
|00002dc0| 20 41 6c 65 72 74 28 72 | 55 73 65 72 41 6c 65 72 | Alert(r|UserAler|
|00002dd0| 74 2c 20 4e 49 4c 29 3b | 0d 45 4e 44 3b 20 7b 41 |t, NIL);|.END; {A|
|00002de0| 6c 65 72 74 55 73 65 72 | 7d 0d 0d 0d 7b 24 53 20 |lertUser|}...{$S |
|00002df0| 4d 61 69 6e 7d 0d 50 52 | 4f 43 45 44 55 52 45 20 |Main}.PR|OCEDURE |
|00002e00| 47 65 74 54 45 52 65 63 | 74 28 77 69 6e 64 6f 77 |GetTERec|t(window|
|00002e10| 3a 20 57 69 6e 64 6f 77 | 50 74 72 3b 20 56 41 52 |: Window|Ptr; VAR|
|00002e20| 20 74 65 52 65 63 74 3a | 20 52 65 63 74 29 3b 0d | teRect:| Rect);.|
|00002e30| 0d 7b 72 65 74 75 72 6e | 20 61 20 72 65 63 74 61 |.{return| a recta|
|00002e40| 6e 67 6c 65 20 74 68 61 | 74 20 69 73 20 69 6e 73 |ngle tha|t is ins|
|00002e50| 65 74 20 66 72 6f 6d 20 | 74 68 65 20 70 6f 72 74 |et from |the port|
|00002e60| 52 65 63 74 20 62 79 20 | 74 68 65 20 73 69 7a 65 |Rect by |the size|
|00002e70| 20 6f 66 0d 74 68 65 20 | 73 63 72 6f 6c 6c 62 61 | of.the |scrollba|
|00002e80| 72 73 20 61 6e 64 20 61 | 20 6c 69 74 74 6c 65 20 |rs and a| little |
|00002e90| 65 78 74 72 61 20 6d 61 | 72 67 69 6e 2e 7d 0d 0d |extra ma|rgin.}..|
|00002ea0| 42 45 47 49 4e 0d 09 74 | 65 52 65 63 74 20 3a 3d |BEGIN..t|eRect :=|
|00002eb0| 20 77 69 6e 64 6f 77 5e | 2e 70 6f 72 74 52 65 63 | window^|.portRec|
|00002ec0| 74 3b 0d 09 49 6e 73 65 | 74 52 65 63 74 28 74 65 |t;..Inse|tRect(te|
|00002ed0| 52 65 63 74 2c 20 6b 54 | 65 78 74 4d 61 72 67 69 |Rect, kT|extMargi|
|00002ee0| 6e 2c 20 6b 54 65 78 74 | 4d 61 72 67 69 6e 29 3b |n, kText|Margin);|
|00002ef0| 09 09 09 7b 61 64 6a 75 | 73 74 20 66 6f 72 20 6d |...{adju|st for m|
|00002f00| 61 72 67 69 6e 7d 0d 09 | 74 65 52 65 63 74 2e 62 |argin}..|teRect.b|
|00002f10| 6f 74 74 6f 6d 20 3a 3d | 20 74 65 52 65 63 74 2e |ottom :=| teRect.|
|00002f20| 62 6f 74 74 6f 6d 20 2d | 20 6b 53 63 72 6f 6c 6c |bottom -| kScroll|
|00002f30| 62 61 72 41 64 6a 75 73 | 74 3b 09 7b 61 6e 64 20 |barAdjus|t;.{and |
|00002f40| 66 6f 72 20 74 68 65 20 | 73 63 72 6f 6c 6c 62 61 |for the |scrollba|
|00002f50| 72 73 7d 0d 09 74 65 52 | 65 63 74 2e 72 69 67 68 |rs}..teR|ect.righ|
|00002f60| 74 20 3a 3d 20 74 65 52 | 65 63 74 2e 72 69 67 68 |t := teR|ect.righ|
|00002f70| 74 20 2d 20 6b 53 63 72 | 6f 6c 6c 62 61 72 41 64 |t - kScr|ollbarAd|
|00002f80| 6a 75 73 74 3b 0d 45 4e | 44 3b 20 7b 47 65 74 54 |just;.EN|D; {GetT|
|00002f90| 45 52 65 63 74 7d 0d 0d | 0d 7b 24 53 20 4d 61 69 |ERect}..|.{$S Mai|
|00002fa0| 6e 7d 0d 46 55 4e 43 54 | 49 4f 4e 20 44 6f 43 6c |n}.FUNCT|ION DoCl|
|00002fb0| 6f 73 65 57 69 6e 64 6f | 77 28 77 69 6e 64 6f 77 |oseWindo|w(window|
|00002fc0| 3a 20 57 69 6e 64 6f 77 | 50 74 72 29 20 3a 20 42 |: Window|Ptr) : B|
|00002fd0| 4f 4f 4c 45 41 4e 3b 0d | 0d 7b 43 6c 6f 73 65 20 |OOLEAN;.|.{Close |
|00002fe0| 61 20 77 69 6e 64 6f 77 | 2e 20 54 68 69 73 20 68 |a window|. This h|
|00002ff0| 61 6e 64 6c 65 73 20 64 | 65 73 6b 20 61 63 63 65 |andles d|esk acce|
|00003000| 73 73 6f 72 79 20 61 6e | 64 20 61 70 70 6c 69 63 |ssory an|d applic|
|00003010| 61 74 69 6f 6e 20 77 69 | 6e 64 6f 77 73 2e 7d 0d |ation wi|ndows.}.|
|00003020| 0d 7b 20 31 2e 30 31 20 | 2d 20 41 74 20 74 68 69 |.{ 1.01 |- At thi|
|00003030| 73 20 70 6f 69 6e 74 2c | 20 69 66 20 74 68 65 72 |s point,| if ther|
|00003040| 65 20 77 61 73 20 61 20 | 64 6f 63 75 6d 65 6e 74 |e was a |document|
|00003050| 20 61 73 73 6f 63 69 61 | 74 65 64 20 77 69 74 68 | associa|ted with|
|00003060| 20 61 0d 20 77 69 6e 64 | 6f 77 2c 20 79 6f 75 20 | a. wind|ow, you |
|00003070| 63 6f 75 6c 64 20 64 6f | 20 61 6e 79 20 64 6f 63 |could do| any doc|
|00003080| 75 6d 65 6e 74 20 73 61 | 76 69 6e 67 20 70 72 6f |ument sa|ving pro|
|00003090| 63 65 73 73 69 6e 67 20 | 69 66 20 69 74 20 69 73 |cessing |if it is|
|000030a0| 20 27 64 69 72 74 79 27 | 2e 0d 20 44 6f 43 6c 6f | 'dirty'|.. DoClo|
|000030b0| 73 65 57 69 6e 64 6f 77 | 20 77 6f 75 6c 64 20 72 |seWindow| would r|
|000030c0| 65 74 75 72 6e 20 54 52 | 55 45 20 69 66 20 74 68 |eturn TR|UE if th|
|000030d0| 65 20 77 69 6e 64 6f 77 | 20 61 63 74 75 61 6c 6c |e window| actuall|
|000030e0| 79 20 63 6c 6f 73 65 64 | 2c 20 69 2e 65 2e 2c 0d |y closed|, i.e.,.|
|000030f0| 20 74 68 65 20 75 73 65 | 72 20 64 69 64 6e d5 74 | the use|r didn.t|
|00003100| 20 63 61 6e 63 65 6c 20 | 66 72 6f 6d 20 61 20 73 | cancel |from a s|
|00003110| 61 76 65 20 64 69 61 6c | 6f 67 2e 20 54 68 69 73 |ave dial|og. This|
|00003120| 20 72 65 73 75 6c 74 20 | 69 73 20 68 61 6e 64 79 | result |is handy|
|00003130| 20 77 68 65 6e 0d 20 74 | 68 65 20 75 73 65 72 20 | when. t|he user |
|00003140| 71 75 69 74 73 20 61 6e | 20 61 70 70 6c 69 63 61 |quits an| applica|
|00003150| 74 69 6f 6e 2c 20 62 75 | 74 20 74 68 65 6e 20 63 |tion, bu|t then c|
|00003160| 61 6e 63 65 6c 73 20 74 | 68 65 20 73 61 76 65 20 |ancels t|he save |
|00003170| 6f 66 20 61 20 64 6f 63 | 75 6d 65 6e 74 0d 20 61 |of a doc|ument. a|
|00003180| 73 73 6f 63 69 61 74 65 | 64 20 77 69 74 68 20 61 |ssociate|d with a|
|00003190| 20 77 69 6e 64 6f 77 2e | 7d 0d 0d 42 45 47 49 4e | window.|}..BEGIN|
|000031a0| 0d 09 44 6f 43 6c 6f 73 | 65 57 69 6e 64 6f 77 20 |..DoClos|eWindow |
|000031b0| 3a 3d 20 54 52 55 45 3b | 0d 09 49 46 20 49 73 44 |:= TRUE;|..IF IsD|
|000031c0| 41 57 69 6e 64 6f 77 28 | 77 69 6e 64 6f 77 29 20 |AWindow(|window) |
|000031d0| 54 48 45 4e 0d 09 09 43 | 6c 6f 73 65 44 65 73 6b |THEN...C|loseDesk|
|000031e0| 41 63 63 28 57 69 6e 64 | 6f 77 50 65 65 6b 28 77 |Acc(Wind|owPeek(w|
|000031f0| 69 6e 64 6f 77 29 5e 2e | 77 69 6e 64 6f 77 4b 69 |indow)^.|windowKi|
|00003200| 6e 64 29 0d 09 45 4c 53 | 45 20 49 46 20 49 73 41 |nd)..ELS|E IF IsA|
|00003210| 70 70 57 69 6e 64 6f 77 | 28 77 69 6e 64 6f 77 29 |ppWindow|(window)|
|00003220| 20 54 48 45 4e 20 42 45 | 47 49 4e 0d 09 09 57 49 | THEN BE|GIN...WI|
|00003230| 54 48 20 44 6f 63 75 6d | 65 6e 74 50 65 65 6b 28 |TH Docum|entPeek(|
|00003240| 77 69 6e 64 6f 77 29 5e | 20 44 4f 0d 09 09 09 49 |window)^| DO....I|
|00003250| 46 20 64 6f 63 54 45 20 | 3c 3e 20 4e 49 4c 20 54 |F docTE |<> NIL T|
|00003260| 48 45 4e 0d 09 09 09 09 | 54 45 44 69 73 70 6f 73 |HEN.....|TEDispos|
|00003270| 65 28 64 6f 63 54 45 29 | 3b 09 09 7b 64 69 73 70 |e(docTE)|;..{disp|
|00003280| 6f 73 65 20 74 68 65 20 | 54 45 48 61 6e 64 6c 65 |ose the |TEHandle|
|00003290| 7d 0d 09 09 44 69 73 70 | 6f 73 65 57 69 6e 64 6f |}...Disp|oseWindo|
|000032a0| 77 28 77 69 6e 64 6f 77 | 29 3b 0d 09 09 67 4e 75 |w(window|);...gNu|
|000032b0| 6d 44 6f 63 75 6d 65 6e | 74 73 20 3a 3d 20 67 4e |mDocumen|ts := gN|
|000032c0| 75 6d 44 6f 63 75 6d 65 | 6e 74 73 20 2d 20 31 3b |umDocume|nts - 1;|
|000032d0| 0d 09 45 4e 44 3b 0d 45 | 4e 44 3b 20 7b 44 6f 43 |..END;.E|ND; {DoC|
|000032e0| 6c 6f 73 65 57 69 6e 64 | 6f 77 7d 0d 0d 0d 7b 24 |loseWind|ow}...{$|
|000032f0| 53 20 4d 61 69 6e 7d 0d | 50 52 4f 43 45 44 55 52 |S Main}.|PROCEDUR|
|00003300| 45 20 41 64 6a 75 73 74 | 56 69 65 77 52 65 63 74 |E Adjust|ViewRect|
|00003310| 28 64 6f 63 54 45 3a 20 | 54 45 48 61 6e 64 6c 65 |(docTE: |TEHandle|
|00003320| 29 3b 0d 0d 7b 55 70 64 | 61 74 65 20 74 68 65 20 |);..{Upd|ate the |
|00003330| 54 45 52 65 63 27 73 20 | 76 69 65 77 20 72 65 63 |TERec's |view rec|
|00003340| 74 20 73 6f 20 74 68 61 | 74 20 69 74 20 69 73 20 |t so tha|t it is |
|00003350| 74 68 65 20 67 72 65 61 | 74 65 73 74 20 6d 75 6c |the grea|test mul|
|00003360| 74 69 70 6c 65 20 6f 66 | 0d 74 68 65 20 6c 69 6e |tiple of|.the lin|
|00003370| 65 48 65 69 67 68 74 20 | 61 6e 64 20 73 74 69 6c |eHeight |and stil|
|00003380| 6c 20 66 69 74 73 20 69 | 6e 20 74 68 65 20 6f 6c |l fits i|n the ol|
|00003390| 64 20 76 69 65 77 52 65 | 63 74 2e 7d 0d 0d 42 45 |d viewRe|ct.}..BE|
|000033a0| 47 49 4e 0d 09 57 49 54 | 48 20 64 6f 63 54 45 5e |GIN..WIT|H docTE^|
|000033b0| 5e 20 44 4f 20 42 45 47 | 49 4e 0d 09 09 76 69 65 |^ DO BEG|IN...vie|
|000033c0| 77 52 65 63 74 2e 62 6f | 74 74 6f 6d 20 3a 3d 20 |wRect.bo|ttom := |
|000033d0| 28 28 28 76 69 65 77 52 | 65 63 74 2e 62 6f 74 74 |(((viewR|ect.bott|
|000033e0| 6f 6d 20 2d 20 76 69 65 | 77 52 65 63 74 2e 74 6f |om - vie|wRect.to|
|000033f0| 70 29 20 44 49 56 20 6c | 69 6e 65 48 65 69 67 68 |p) DIV l|ineHeigh|
|00003400| 74 29 20 2a 0d 09 09 09 | 09 09 09 09 6c 69 6e 65 |t) *....|....line|
|00003410| 48 65 69 67 68 74 29 20 | 2b 20 76 69 65 77 52 65 |Height) |+ viewRe|
|00003420| 63 74 2e 74 6f 70 3b 0d | 09 45 4e 44 3b 0d 45 4e |ct.top;.|.END;.EN|
|00003430| 44 3b 20 7b 41 64 6a 75 | 73 74 56 69 65 77 52 65 |D; {Adju|stViewRe|
|00003440| 63 74 7d 0d 0d 0d 7b 24 | 53 20 4d 61 69 6e 7d 0d |ct}...{$|S Main}.|
|00003450| 50 52 4f 43 45 44 55 52 | 45 20 41 64 6a 75 73 74 |PROCEDUR|E Adjust|
|00003460| 54 45 28 77 69 6e 64 6f | 77 3a 20 57 69 6e 64 6f |TE(windo|w: Windo|
|00003470| 77 50 74 72 29 3b 0d 0d | 7b 53 63 72 6f 6c 6c 20 |wPtr);..|{Scroll |
|00003480| 74 68 65 20 54 45 52 65 | 63 20 61 72 6f 75 6e 64 |the TERe|c around|
|00003490| 20 74 6f 20 6d 61 74 63 | 68 20 75 70 20 74 6f 20 | to matc|h up to |
|000034a0| 74 68 65 20 70 6f 74 65 | 6e 74 69 61 6c 6c 79 20 |the pote|ntially |
|000034b0| 75 70 64 61 74 65 64 20 | 73 63 72 6f 6c 6c 62 61 |updated |scrollba|
|000034c0| 72 0d 76 61 6c 75 65 73 | 2e 20 54 68 69 73 20 69 |r.values|. This i|
|000034d0| 73 20 72 65 61 6c 6c 79 | 20 75 73 65 66 75 6c 20 |s really| useful |
|000034e0| 77 68 65 6e 20 74 68 65 | 20 77 69 6e 64 6f 77 20 |when the| window |
|000034f0| 72 65 73 69 7a 65 73 20 | 73 75 63 68 20 74 68 61 |resizes |such tha|
|00003500| 74 20 74 68 65 0d 73 63 | 72 6f 6c 6c 62 61 72 73 |t the.sc|rollbars|
|00003510| 20 62 65 63 6f 6d 65 20 | 69 6e 61 63 74 69 76 65 | become |inactive|
|00003520| 20 61 6e 64 20 74 68 65 | 20 54 45 52 65 63 20 68 | and the| TERec h|
|00003530| 61 64 20 62 65 65 6e 20 | 70 72 65 76 69 6f 75 73 |ad been |previous|
|00003540| 6c 79 20 73 63 72 6f 6c | 6c 65 64 2e 7d 0d 0d 56 |ly scrol|led.}..V|
|00003550| 41 52 0d 09 76 61 6c 75 | 65 09 3a 20 49 4e 54 45 |AR..valu|e.: INTE|
|00003560| 47 45 52 3b 0d 42 45 47 | 49 4e 0d 09 57 49 54 48 |GER;.BEG|IN..WITH|
|00003570| 20 44 6f 63 75 6d 65 6e | 74 50 65 65 6b 28 77 69 | Documen|tPeek(wi|
|00003580| 6e 64 6f 77 29 5e 20 44 | 4f 20 42 45 47 49 4e 0d |ndow)^ D|O BEGIN.|
|00003590| 09 09 54 45 53 63 72 6f | 6c 6c 28 28 64 6f 63 54 |..TEScro|ll((docT|
|000035a0| 45 5e 5e 2e 76 69 65 77 | 52 65 63 74 2e 6c 65 66 |E^^.view|Rect.lef|
|000035b0| 74 20 2d 20 64 6f 63 54 | 45 5e 5e 2e 64 65 73 74 |t - docT|E^^.dest|
|000035c0| 52 65 63 74 2e 6c 65 66 | 74 29 20 2d 20 47 65 74 |Rect.lef|t) - Get|
|000035d0| 43 74 6c 56 61 6c 75 65 | 28 64 6f 63 48 53 63 72 |CtlValue|(docHScr|
|000035e0| 6f 6c 6c 29 2c 0d 09 09 | 09 09 28 64 6f 63 54 45 |oll),...|..(docTE|
|000035f0| 5e 5e 2e 76 69 65 77 52 | 65 63 74 2e 74 6f 70 20 |^^.viewR|ect.top |
|00003600| 2d 20 64 6f 63 54 45 5e | 5e 2e 64 65 73 74 52 65 |- docTE^|^.destRe|
|00003610| 63 74 2e 74 6f 70 29 20 | 2d 0d 09 09 09 09 09 28 |ct.top) |-......(|
|00003620| 47 65 74 43 74 6c 56 61 | 6c 75 65 28 64 6f 63 56 |GetCtlVa|lue(docV|
|00003630| 53 63 72 6f 6c 6c 29 20 | 2a 20 64 6f 63 54 45 5e |Scroll) |* docTE^|
|00003640| 5e 2e 6c 69 6e 65 48 65 | 69 67 68 74 29 2c 0d 09 |^.lineHe|ight),..|
|00003650| 09 09 09 64 6f 63 54 45 | 29 3b 0d 09 45 4e 44 3b |...docTE|);..END;|
|00003660| 0d 45 4e 44 3b 20 7b 41 | 64 6a 75 73 74 54 45 7d |.END; {A|djustTE}|
|00003670| 0d 0d 0d 7b 24 53 20 4d | 61 69 6e 7d 0d 50 52 4f |...{$S M|ain}.PRO|
|00003680| 43 45 44 55 52 45 20 41 | 64 6a 75 73 74 48 56 28 |CEDURE A|djustHV(|
|00003690| 69 73 56 65 72 74 3a 20 | 42 4f 4f 4c 45 41 4e 3b |isVert: |BOOLEAN;|
|000036a0| 20 63 6f 6e 74 72 6f 6c | 3a 20 43 6f 6e 74 72 6f | control|: Contro|
|000036b0| 6c 48 61 6e 64 6c 65 3b | 20 64 6f 63 54 45 3a 20 |lHandle;| docTE: |
|000036c0| 54 45 48 61 6e 64 6c 65 | 3b 20 63 61 6e 52 65 64 |TEHandle|; canRed|
|000036d0| 72 61 77 3a 20 42 4f 4f | 4c 45 41 4e 29 3b 0d 0d |raw: BOO|LEAN);..|
|000036e0| 7b 43 61 6c 63 75 6c 61 | 74 65 20 74 68 65 20 6e |{Calcula|te the n|
|000036f0| 65 77 20 63 6f 6e 74 72 | 6f 6c 20 6d 61 78 69 6d |ew contr|ol maxim|
|00003700| 75 6d 20 76 61 6c 75 65 | 20 61 6e 64 20 63 75 72 |um value| and cur|
|00003710| 72 65 6e 74 20 76 61 6c | 75 65 2c 20 77 68 65 74 |rent val|ue, whet|
|00003720| 68 65 72 20 69 74 20 69 | 73 20 74 68 65 20 68 6f |her it i|s the ho|
|00003730| 72 69 7a 6f 6e 74 61 6c | 20 6f 72 0d 76 65 72 74 |rizontal| or.vert|
|00003740| 69 63 61 6c 20 73 63 72 | 6f 6c 6c 62 61 72 2e 20 |ical scr|ollbar. |
|00003750| 54 68 65 20 76 65 72 74 | 69 63 61 6c 20 6d 61 78 |The vert|ical max|
|00003760| 20 69 73 20 63 61 6c 63 | 75 6c 61 74 65 64 20 62 | is calc|ulated b|
|00003770| 79 20 63 6f 6d 70 61 72 | 69 6e 67 20 74 68 65 20 |y compar|ing the |
|00003780| 6e 75 6d 62 65 72 20 6f | 66 20 6c 69 6e 65 73 20 |number o|f lines |
|00003790| 74 6f 20 74 68 65 0d 76 | 65 72 74 69 63 61 6c 20 |to the.v|ertical |
|000037a0| 73 69 7a 65 20 6f 66 20 | 74 68 65 20 76 69 65 77 |size of |the view|
|000037b0| 52 65 63 74 2e 20 54 68 | 65 20 68 6f 72 69 7a 6f |Rect. Th|e horizo|
|000037c0| 6e 74 61 6c 20 6d 61 78 | 20 69 73 20 63 61 6c 63 |ntal max| is calc|
|000037d0| 75 6c 61 74 65 64 20 62 | 79 20 63 6f 6d 70 61 72 |ulated b|y compar|
|000037e0| 69 6e 67 20 74 68 65 20 | 6d 61 78 69 6d 75 6d 20 |ing the |maximum |
|000037f0| 64 6f 63 75 6d 65 6e 74 | 0d 77 69 64 74 68 20 74 |document|.width t|
|00003800| 6f 20 74 68 65 20 77 69 | 64 74 68 20 6f 66 20 74 |o the wi|dth of t|
|00003810| 68 65 20 76 69 65 77 52 | 65 63 74 2e 20 54 68 65 |he viewR|ect. The|
|00003820| 20 63 75 72 72 65 6e 74 | 20 76 61 6c 75 65 73 20 | current| values |
|00003830| 61 72 65 20 73 65 74 20 | 62 79 20 63 6f 6d 70 61 |are set |by compa|
|00003840| 72 69 6e 67 20 74 68 65 | 20 6f 66 66 73 65 74 20 |ring the| offset |
|00003850| 62 65 74 77 65 65 6e 0d | 74 68 65 20 76 69 65 77 |between.|the view|
|00003860| 20 61 6e 64 20 64 65 73 | 74 69 6e 61 74 69 6f 6e | and des|tination|
|00003870| 20 72 65 63 74 73 2e 20 | 49 66 20 6e 65 63 65 73 | rects. |If neces|
|00003880| 73 61 72 79 20 61 6e 64 | 20 77 65 20 63 61 6e 52 |sary and| we canR|
|00003890| 65 64 72 61 77 2c 20 68 | 61 76 65 20 74 68 65 20 |edraw, h|ave the |
|000038a0| 63 6f 6e 74 72 6f 6c 20 | 62 65 20 72 65 2d 64 72 |control |be re-dr|
|000038b0| 61 77 6e 20 62 79 0d 63 | 61 6c 6c 69 6e 67 20 53 |awn by.c|alling S|
|000038c0| 68 6f 77 43 6f 6e 74 72 | 6f 6c 2e 7d 0d 0d 56 41 |howContr|ol.}..VA|
|000038d0| 52 0d 09 76 61 6c 75 65 | 2c 20 6c 69 6e 65 73 2c |R..value|, lines,|
|000038e0| 20 6d 61 78 09 3a 20 49 | 4e 54 45 47 45 52 3b 0d | max.: I|NTEGER;.|
|000038f0| 09 6f 6c 64 56 61 6c 75 | 65 2c 20 6f 6c 64 4d 61 |.oldValu|e, oldMa|
|00003900| 78 09 3a 20 49 4e 54 45 | 47 45 52 3b 0d 42 45 47 |x.: INTE|GER;.BEG|
|00003910| 49 4e 0d 09 6f 6c 64 56 | 61 6c 75 65 20 3a 3d 20 |IN..oldV|alue := |
|00003920| 47 65 74 43 74 6c 56 61 | 6c 75 65 28 63 6f 6e 74 |GetCtlVa|lue(cont|
|00003930| 72 6f 6c 29 3b 0d 09 6f | 6c 64 4d 61 78 20 3a 3d |rol);..o|ldMax :=|
|00003940| 20 47 65 74 43 74 6c 4d | 61 78 28 63 6f 6e 74 72 | GetCtlM|ax(contr|
|00003950| 6f 6c 29 3b 0d 09 49 46 | 20 69 73 56 65 72 74 20 |ol);..IF| isVert |
|00003960| 54 48 45 4e 20 42 45 47 | 49 4e 0d 09 09 6c 69 6e |THEN BEG|IN...lin|
|00003970| 65 73 20 3a 3d 20 64 6f | 63 54 45 5e 5e 2e 6e 4c |es := do|cTE^^.nL|
|00003980| 69 6e 65 73 3b 0d 09 09 | 7b 73 69 6e 63 65 20 6e |ines;...|{since n|
|00003990| 4c 69 6e 65 73 20 69 73 | 6e d5 74 20 72 69 67 68 |Lines is|n.t righ|
|000039a0| 74 20 69 66 20 74 68 65 | 20 6c 61 73 74 20 63 68 |t if the| last ch|
|000039b0| 61 72 61 63 74 65 72 20 | 69 73 20 61 20 72 65 74 |aracter |is a ret|
|000039c0| 75 72 6e 2c 20 63 68 65 | 63 6b 20 66 6f 72 20 74 |urn, che|ck for t|
|000039d0| 68 61 74 20 63 61 73 65 | 7d 0d 09 09 49 46 20 50 |hat case|}...IF P|
|000039e0| 74 72 28 4f 52 44 28 64 | 6f 63 54 45 5e 5e 2e 68 |tr(ORD(d|ocTE^^.h|
|000039f0| 54 65 78 74 5e 29 20 2b | 20 64 6f 63 54 45 5e 5e |Text^) +| docTE^^|
|00003a00| 2e 74 65 4c 65 6e 67 74 | 68 20 2d 20 31 29 5e 20 |.teLengt|h - 1)^ |
|00003a10| 3d 20 6b 43 52 43 68 61 | 72 20 54 48 45 4e 0d 09 |= kCRCha|r THEN..|
|00003a20| 09 09 6c 69 6e 65 73 20 | 3a 3d 20 6c 69 6e 65 73 |..lines |:= lines|
|00003a30| 20 2b 20 31 3b 0d 09 09 | 6d 61 78 20 3a 3d 20 6c | + 1;...|max := l|
|00003a40| 69 6e 65 73 20 2d 20 28 | 28 64 6f 63 54 45 5e 5e |ines - (|(docTE^^|
|00003a50| 2e 76 69 65 77 52 65 63 | 74 2e 62 6f 74 74 6f 6d |.viewRec|t.bottom|
|00003a60| 20 2d 20 64 6f 63 54 45 | 5e 5e 2e 76 69 65 77 52 | - docTE|^^.viewR|
|00003a70| 65 63 74 2e 74 6f 70 29 | 20 44 49 56 20 64 6f 63 |ect.top)| DIV doc|
|00003a80| 54 45 5e 5e 2e 6c 69 6e | 65 48 65 69 67 68 74 29 |TE^^.lin|eHeight)|
|00003a90| 3b 0d 09 45 4e 44 20 45 | 4c 53 45 0d 09 09 6d 61 |;..END E|LSE...ma|
|00003aa0| 78 20 3a 3d 20 6b 4d 61 | 78 44 6f 63 57 69 64 74 |x := kMa|xDocWidt|
|00003ab0| 68 20 2d 20 28 64 6f 63 | 54 45 5e 5e 2e 76 69 65 |h - (doc|TE^^.vie|
|00003ac0| 77 52 65 63 74 2e 72 69 | 67 68 74 20 2d 20 64 6f |wRect.ri|ght - do|
|00003ad0| 63 54 45 5e 5e 2e 76 69 | 65 77 52 65 63 74 2e 6c |cTE^^.vi|ewRect.l|
|00003ae0| 65 66 74 29 3b 0d 09 49 | 46 20 6d 61 78 20 3c 20 |eft);..I|F max < |
|00003af0| 30 20 54 48 45 4e 20 6d | 61 78 20 3a 3d 20 30 3b |0 THEN m|ax := 0;|
|00003b00| 09 09 09 7b 63 68 65 63 | 6b 20 66 6f 72 20 6e 65 |...{chec|k for ne|
|00003b10| 67 61 74 69 76 65 20 76 | 61 6c 75 65 73 7d 0d 09 |gative v|alues}..|
|00003b20| 53 65 74 43 74 6c 4d 61 | 78 28 63 6f 6e 74 72 6f |SetCtlMa|x(contro|
|00003b30| 6c 2c 20 6d 61 78 29 3b | 0d 09 49 46 20 69 73 56 |l, max);|..IF isV|
|00003b40| 65 72 74 20 54 48 45 4e | 0d 09 09 76 61 6c 75 65 |ert THEN|...value|
|00003b50| 20 3a 3d 20 28 64 6f 63 | 54 45 5e 5e 2e 76 69 65 | := (doc|TE^^.vie|
|00003b60| 77 52 65 63 74 2e 74 6f | 70 20 2d 20 64 6f 63 54 |wRect.to|p - docT|
|00003b70| 45 5e 5e 2e 64 65 73 74 | 52 65 63 74 2e 74 6f 70 |E^^.dest|Rect.top|
|00003b80| 29 20 44 49 56 20 64 6f | 63 54 45 5e 5e 2e 6c 69 |) DIV do|cTE^^.li|
|00003b90| 6e 65 48 65 69 67 68 74 | 0d 09 45 4c 53 45 0d 09 |neHeight|..ELSE..|
|00003ba0| 09 76 61 6c 75 65 20 3a | 3d 20 64 6f 63 54 45 5e |.value :|= docTE^|
|00003bb0| 5e 2e 76 69 65 77 52 65 | 63 74 2e 6c 65 66 74 20 |^.viewRe|ct.left |
|00003bc0| 2d 20 64 6f 63 54 45 5e | 5e 2e 64 65 73 74 52 65 |- docTE^|^.destRe|
|00003bd0| 63 74 2e 6c 65 66 74 3b | 0d 09 49 46 20 76 61 6c |ct.left;|..IF val|
|00003be0| 75 65 20 3c 20 30 20 54 | 48 45 4e 0d 09 09 76 61 |ue < 0 T|HEN...va|
|00003bf0| 6c 75 65 20 3a 3d 20 30 | 0d 09 45 4c 53 45 20 49 |lue := 0|..ELSE I|
|00003c00| 46 20 76 61 6c 75 65 20 | 3e 20 6d 61 78 20 54 48 |F value |> max TH|
|00003c10| 45 4e 0d 09 09 76 61 6c | 75 65 20 3a 3d 20 6d 61 |EN...val|ue := ma|
|00003c20| 78 3b 09 09 09 09 09 7b | 70 69 6e 20 74 68 65 20 |x;.....{|pin the |
|00003c30| 76 61 6c 75 65 20 74 6f | 20 77 69 74 68 69 6e 20 |value to| within |
|00003c40| 72 61 6e 67 65 7d 0d 09 | 53 65 74 43 74 6c 56 61 |range}..|SetCtlVa|
|00003c50| 6c 75 65 28 63 6f 6e 74 | 72 6f 6c 2c 20 76 61 6c |lue(cont|rol, val|
|00003c60| 75 65 29 3b 0d 09 49 46 | 20 63 61 6e 52 65 64 72 |ue);..IF| canRedr|
|00003c70| 61 77 20 26 20 28 20 28 | 6d 61 78 20 3c 3e 20 6f |aw & ( (|max <> o|
|00003c80| 6c 64 4d 61 78 29 20 7c | 20 28 76 61 6c 75 65 20 |ldMax) || (value |
|00003c90| 3c 3e 20 6f 6c 64 56 61 | 6c 75 65 29 20 29 20 54 |<> oldVa|lue) ) T|
|00003ca0| 48 45 4e 0d 09 09 53 68 | 6f 77 43 6f 6e 74 72 6f |HEN...Sh|owContro|
|00003cb0| 6c 28 63 6f 6e 74 72 6f | 6c 29 3b 09 09 09 7b 63 |l(contro|l);...{c|
|00003cc0| 68 65 63 6b 20 74 6f 20 | 73 65 65 20 69 66 20 74 |heck to |see if t|
|00003cd0| 68 65 20 63 6f 6e 74 72 | 6f 6c 20 63 61 6e 20 62 |he contr|ol can b|
|00003ce0| 65 20 72 65 2d 64 72 61 | 77 6e 7d 0d 45 4e 44 3b |e re-dra|wn}.END;|
|00003cf0| 20 7b 41 64 6a 75 73 74 | 48 56 7d 0d 0d 0d 7b 24 | {Adjust|HV}...{$|
|00003d00| 53 20 4d 61 69 6e 7d 0d | 50 52 4f 43 45 44 55 52 |S Main}.|PROCEDUR|
|00003d10| 45 20 41 64 6a 75 73 74 | 53 63 72 6f 6c 6c 56 61 |E Adjust|ScrollVa|
|00003d20| 6c 75 65 73 28 77 69 6e | 64 6f 77 3a 20 57 69 6e |lues(win|dow: Win|
|00003d30| 64 6f 77 50 74 72 3b 20 | 63 61 6e 52 65 64 72 61 |dowPtr; |canRedra|
|00003d40| 77 3a 20 42 4f 4f 4c 45 | 41 4e 29 3b 0d 0d 7b 53 |w: BOOLE|AN);..{S|
|00003d50| 69 6d 70 6c 79 20 63 61 | 6c 6c 20 74 68 65 20 63 |imply ca|ll the c|
|00003d60| 6f 6d 6d 6f 6e 20 61 64 | 6a 75 73 74 20 72 6f 75 |ommon ad|just rou|
|00003d70| 74 69 6e 65 20 66 6f 72 | 20 74 68 65 20 76 65 72 |tine for| the ver|
|00003d80| 74 69 63 61 6c 20 61 6e | 64 20 68 6f 72 69 7a 6f |tical an|d horizo|
|00003d90| 6e 74 61 6c 20 73 63 72 | 6f 6c 6c 62 61 72 73 2e |ntal scr|ollbars.|
|00003da0| 7d 0d 0d 42 45 47 49 4e | 0d 09 57 49 54 48 20 44 |}..BEGIN|..WITH D|
|00003db0| 6f 63 75 6d 65 6e 74 50 | 65 65 6b 28 77 69 6e 64 |ocumentP|eek(wind|
|00003dc0| 6f 77 29 5e 20 44 4f 20 | 42 45 47 49 4e 0d 09 09 |ow)^ DO |BEGIN...|
|00003dd0| 41 64 6a 75 73 74 48 56 | 28 54 52 55 45 2c 20 64 |AdjustHV|(TRUE, d|
|00003de0| 6f 63 56 53 63 72 6f 6c | 6c 2c 20 64 6f 63 54 45 |ocVScrol|l, docTE|
|00003df0| 2c 20 63 61 6e 52 65 64 | 72 61 77 29 3b 0d 09 09 |, canRed|raw);...|
|00003e00| 41 64 6a 75 73 74 48 56 | 28 46 41 4c 53 45 2c 20 |AdjustHV|(FALSE, |
|00003e10| 64 6f 63 48 53 63 72 6f | 6c 6c 2c 20 64 6f 63 54 |docHScro|ll, docT|
|00003e20| 45 2c 20 63 61 6e 52 65 | 64 72 61 77 29 3b 0d 09 |E, canRe|draw);..|
|00003e30| 45 4e 44 3b 0d 45 4e 44 | 3b 20 7b 41 64 6a 75 73 |END;.END|; {Adjus|
|00003e40| 74 53 63 72 6f 6c 6c 56 | 61 6c 75 65 73 7d 0d 0d |tScrollV|alues}..|
|00003e50| 0d 7b 24 53 20 4d 61 69 | 6e 7d 0d 50 52 4f 43 45 |.{$S Mai|n}.PROCE|
|00003e60| 44 55 52 45 20 41 64 6a | 75 73 74 53 63 72 6f 6c |DURE Adj|ustScrol|
|00003e70| 6c 53 69 7a 65 73 28 77 | 69 6e 64 6f 77 3a 20 57 |lSizes(w|indow: W|
|00003e80| 69 6e 64 6f 77 50 74 72 | 29 3b 0d 0d 7b 52 65 2d |indowPtr|);..{Re-|
|00003e90| 63 61 6c 63 75 6c 61 74 | 65 20 74 68 65 20 70 6f |calculat|e the po|
|00003ea0| 73 69 74 69 6f 6e 20 61 | 6e 64 20 73 69 7a 65 20 |sition a|nd size |
|00003eb0| 6f 66 20 74 68 65 20 76 | 69 65 77 52 65 63 74 20 |of the v|iewRect |
|00003ec0| 61 6e 64 20 74 68 65 20 | 73 63 72 6f 6c 6c 62 61 |and the |scrollba|
|00003ed0| 72 73 2e 0d 20 6b 53 63 | 72 6f 6c 6c 54 77 65 65 |rs.. kSc|rollTwee|
|00003ee0| 6b 20 63 6f 6d 70 65 6e | 73 61 74 65 73 20 66 6f |k compen|sates fo|
|00003ef0| 72 20 6f 66 66 2d 62 79 | 2d 6f 6e 65 20 72 65 71 |r off-by|-one req|
|00003f00| 75 69 72 65 6d 65 6e 74 | 73 20 6f 66 20 74 68 65 |uirement|s of the|
|00003f10| 20 73 63 72 6f 6c 6c 62 | 61 72 73 0d 20 74 6f 20 | scrollb|ars. to |
|00003f20| 68 61 76 65 20 62 6f 72 | 64 65 72 73 20 63 6f 69 |have bor|ders coi|
|00003f30| 6e 63 69 64 65 20 77 69 | 74 68 20 74 68 65 20 67 |ncide wi|th the g|
|00003f40| 72 6f 77 62 6f 78 2e 7d | 0d 0d 56 41 52 0d 09 74 |rowbox.}|..VAR..t|
|00003f50| 65 52 65 63 74 09 3a 20 | 52 65 63 74 3b 0d 42 45 |eRect.: |Rect;.BE|
|00003f60| 47 49 4e 0d 09 47 65 74 | 54 45 52 65 63 74 28 77 |GIN..Get|TERect(w|
|00003f70| 69 6e 64 6f 77 2c 20 74 | 65 52 65 63 74 29 3b 09 |indow, t|eRect);.|
|00003f80| 09 09 09 09 09 09 09 09 | 09 7b 73 74 61 72 74 20 |........|.{start |
|00003f90| 77 69 74 68 20 74 65 52 | 65 63 74 7d 0d 09 57 49 |with teR|ect}..WI|
|00003fa0| 54 48 20 44 6f 63 75 6d | 65 6e 74 50 65 65 6b 28 |TH Docum|entPeek(|
|00003fb0| 77 69 6e 64 6f 77 29 5e | 2c 20 77 69 6e 64 6f 77 |window)^|, window|
|00003fc0| 5e 2e 70 6f 72 74 52 65 | 63 74 20 44 4f 20 42 45 |^.portRe|ct DO BE|
|00003fd0| 47 49 4e 0d 09 09 64 6f | 63 54 45 5e 5e 2e 76 69 |GIN...do|cTE^^.vi|
|00003fe0| 65 77 52 65 63 74 20 3a | 3d 20 74 65 52 65 63 74 |ewRect :|= teRect|
|00003ff0| 3b 0d 09 09 41 64 6a 75 | 73 74 56 69 65 77 52 65 |;...Adju|stViewRe|
|00004000| 63 74 28 64 6f 63 54 45 | 29 3b 09 09 09 09 09 09 |ct(docTE|);......|
|00004010| 09 09 09 09 7b 73 6e 61 | 70 20 74 6f 20 6e 65 61 |....{sna|p to nea|
|00004020| 72 65 73 74 20 6c 69 6e | 65 7d 0d 09 09 4d 6f 76 |rest lin|e}...Mov|
|00004030| 65 43 6f 6e 74 72 6f 6c | 28 64 6f 63 56 53 63 72 |eControl|(docVScr|
|00004040| 6f 6c 6c 2c 20 72 69 67 | 68 74 20 2d 20 6b 53 63 |oll, rig|ht - kSc|
|00004050| 72 6f 6c 6c 62 61 72 41 | 64 6a 75 73 74 2c 20 2d |rollbarA|djust, -|
|00004060| 31 29 3b 0d 09 09 53 69 | 7a 65 43 6f 6e 74 72 6f |1);...Si|zeContro|
|00004070| 6c 28 64 6f 63 56 53 63 | 72 6f 6c 6c 2c 20 6b 53 |l(docVSc|roll, kS|
|00004080| 63 72 6f 6c 6c 62 61 72 | 57 69 64 74 68 2c 20 28 |crollbar|Width, (|
|00004090| 62 6f 74 74 6f 6d 20 2d | 20 74 6f 70 29 20 2d 0d |bottom -| top) -.|
|000040a0| 09 09 09 09 09 09 28 6b | 53 63 72 6f 6c 6c 62 61 |......(k|Scrollba|
|000040b0| 72 41 64 6a 75 73 74 20 | 2d 20 6b 53 63 72 6f 6c |rAdjust |- kScrol|
|000040c0| 6c 54 77 65 65 6b 29 29 | 3b 0d 09 09 4d 6f 76 65 |lTweek))|;...Move|
|000040d0| 43 6f 6e 74 72 6f 6c 28 | 64 6f 63 48 53 63 72 6f |Control(|docHScro|
|000040e0| 6c 6c 2c 20 2d 31 2c 20 | 62 6f 74 74 6f 6d 20 2d |ll, -1, |bottom -|
|000040f0| 20 6b 53 63 72 6f 6c 6c | 62 61 72 41 64 6a 75 73 | kScroll|barAdjus|
|00004100| 74 29 3b 0d 09 09 53 69 | 7a 65 43 6f 6e 74 72 6f |t);...Si|zeContro|
|00004110| 6c 28 64 6f 63 48 53 63 | 72 6f 6c 6c 2c 20 28 72 |l(docHSc|roll, (r|
|00004120| 69 67 68 74 20 2d 20 6c | 65 66 74 29 20 2d 20 28 |ight - l|eft) - (|
|00004130| 6b 53 63 72 6f 6c 6c 62 | 61 72 41 64 6a 75 73 74 |kScrollb|arAdjust|
|00004140| 20 2d 0d 09 09 09 09 09 | 09 6b 53 63 72 6f 6c 6c | -......|.kScroll|
|00004150| 54 77 65 65 6b 29 2c 20 | 6b 53 63 72 6f 6c 6c 62 |Tweek), |kScrollb|
|00004160| 61 72 57 69 64 74 68 29 | 3b 0d 09 45 4e 44 3b 0d |arWidth)|;..END;.|
|00004170| 45 4e 44 3b 20 7b 41 64 | 6a 75 73 74 53 63 72 6f |END; {Ad|justScro|
|00004180| 6c 6c 53 69 7a 65 73 7d | 0d 0d 0d 7b 24 53 20 4d |llSizes}|...{$S M|
|00004190| 61 69 6e 7d 0d 50 52 4f | 43 45 44 55 52 45 20 41 |ain}.PRO|CEDURE A|
|000041a0| 64 6a 75 73 74 53 63 72 | 6f 6c 6c 62 61 72 73 28 |djustScr|ollbars(|
|000041b0| 77 69 6e 64 6f 77 3a 20 | 57 69 6e 64 6f 77 50 74 |window: |WindowPt|
|000041c0| 72 3b 20 6e 65 65 64 73 | 52 65 73 69 7a 65 3a 20 |r; needs|Resize: |
|000041d0| 42 4f 4f 4c 45 41 4e 29 | 3b 0d 0d 7b 54 75 72 6e |BOOLEAN)|;..{Turn|
|000041e0| 20 6f 66 66 20 74 68 65 | 20 63 6f 6e 74 72 6f 6c | off the| control|
|000041f0| 73 20 62 79 20 6a 61 6d | 6d 69 6e 67 20 61 20 7a |s by jam|ming a z|
|00004200| 65 72 6f 20 69 6e 74 6f | 20 74 68 65 69 72 20 63 |ero into| their c|
|00004210| 6f 6e 74 72 6c 56 69 73 | 20 66 69 65 6c 64 73 20 |ontrlVis| fields |
|00004220| 28 48 69 64 65 43 6f 6e | 74 72 6f 6c 20 65 72 61 |(HideCon|trol era|
|00004230| 73 65 73 20 74 68 65 6d | 0d 61 6e 64 20 77 65 20 |ses them|.and we |
|00004240| 64 6f 6e 27 74 20 77 61 | 6e 74 20 74 68 61 74 29 |don't wa|nt that)|
|00004250| 2e 20 49 66 20 74 68 65 | 20 63 6f 6e 74 72 6f 6c |. If the| control|
|00004260| 73 20 61 72 65 20 74 6f | 20 62 65 20 72 65 73 69 |s are to| be resi|
|00004270| 7a 65 64 20 61 73 20 77 | 65 6c 6c 2c 20 63 61 6c |zed as w|ell, cal|
|00004280| 6c 20 74 68 65 20 70 72 | 6f 63 65 64 75 72 65 20 |l the pr|ocedure |
|00004290| 74 6f 20 64 6f 20 74 68 | 61 74 2c 0d 74 68 65 6e |to do th|at,.then|
|000042a0| 20 63 61 6c 6c 20 74 68 | 65 20 70 72 6f 63 65 64 | call th|e proced|
|000042b0| 75 72 65 20 74 6f 20 61 | 64 6a 75 73 74 20 74 68 |ure to a|djust th|
|000042c0| 65 20 6d 61 78 69 6d 75 | 6d 20 61 6e 64 20 63 75 |e maximu|m and cu|
|000042d0| 72 72 65 6e 74 20 76 61 | 6c 75 65 73 2e 20 46 69 |rrent va|lues. Fi|
|000042e0| 6e 61 6c 6c 79 20 72 65 | 2d 65 6e 61 62 6c 65 20 |nally re|-enable |
|000042f0| 74 68 65 20 63 6f 6e 74 | 72 6f 6c 73 0d 62 79 20 |the cont|rols.by |
|00004300| 6a 61 6d 6d 69 6e 67 20 | 61 20 24 46 46 20 69 6e |jamming |a $FF in|
|00004310| 20 74 68 65 69 72 20 63 | 6f 6e 74 72 6c 56 69 73 | their c|ontrlVis|
|00004320| 20 66 69 65 6c 64 73 2e | 7d 0d 0d 56 41 52 0d 09 | fields.|}..VAR..|
|00004330| 6f 6c 64 4d 61 78 2c 20 | 6f 6c 64 56 61 6c 09 3a |oldMax, |oldVal.:|
|00004340| 20 49 4e 54 45 47 45 52 | 3b 0d 42 45 47 49 4e 0d | INTEGER|;.BEGIN.|
|00004350| 09 57 49 54 48 20 44 6f | 63 75 6d 65 6e 74 50 65 |.WITH Do|cumentPe|
|00004360| 65 6b 28 77 69 6e 64 6f | 77 29 5e 20 44 4f 20 42 |ek(windo|w)^ DO B|
|00004370| 45 47 49 4e 0d 09 09 7b | 46 69 72 73 74 2c 20 74 |EGIN...{|First, t|
|00004380| 75 72 6e 20 76 69 73 69 | 62 69 6c 69 74 79 20 6f |urn visi|bility o|
|00004390| 66 20 73 63 72 6f 6c 6c | 62 61 72 73 20 6f 66 66 |f scroll|bars off|
|000043a0| 20 73 6f 20 77 65 20 77 | 6f 6e d5 74 20 67 65 74 | so we w|on.t get|
|000043b0| 20 75 6e 77 61 6e 74 65 | 64 20 72 65 64 72 61 77 | unwante|d redraw|
|000043c0| 69 6e 67 7d 0d 09 09 64 | 6f 63 56 53 63 72 6f 6c |ing}...d|ocVScrol|
|000043d0| 6c 5e 5e 2e 63 6f 6e 74 | 72 6c 56 69 73 20 3a 3d |l^^.cont|rlVis :=|
|000043e0| 20 6b 43 6f 6e 74 72 6f | 6c 49 6e 76 69 73 69 62 | kContro|lInvisib|
|000043f0| 6c 65 3b 09 7b 74 75 72 | 6e 20 74 68 65 6d 20 6f |le;.{tur|n them o|
|00004400| 66 66 7d 0d 09 09 64 6f | 63 48 53 63 72 6f 6c 6c |ff}...do|cHScroll|
|00004410| 5e 5e 2e 63 6f 6e 74 72 | 6c 56 69 73 20 3a 3d 20 |^^.contr|lVis := |
|00004420| 6b 43 6f 6e 74 72 6f 6c | 49 6e 76 69 73 69 62 6c |kControl|Invisibl|
|00004430| 65 3b 0d 09 09 49 46 20 | 6e 65 65 64 73 52 65 73 |e;...IF |needsRes|
|00004440| 69 7a 65 20 54 48 45 4e | 09 09 09 09 09 09 09 09 |ize THEN|........|
|00004450| 7b 6d 6f 76 65 20 61 6e | 64 20 73 69 7a 65 20 69 |{move an|d size i|
|00004460| 66 20 6e 65 65 64 65 64 | 7d 0d 09 09 09 41 64 6a |f needed|}....Adj|
|00004470| 75 73 74 53 63 72 6f 6c | 6c 53 69 7a 65 73 28 77 |ustScrol|lSizes(w|
|00004480| 69 6e 64 6f 77 29 3b 0d | 09 09 41 64 6a 75 73 74 |indow);.|..Adjust|
|00004490| 53 63 72 6f 6c 6c 56 61 | 6c 75 65 73 28 77 69 6e |ScrollVa|lues(win|
|000044a0| 64 6f 77 2c 20 4e 4f 54 | 20 6e 65 65 64 73 52 65 |dow, NOT| needsRe|
|000044b0| 73 69 7a 65 29 3b 09 7b | 66 6f 6f 6c 20 77 69 74 |size);.{|fool wit|
|000044c0| 68 20 6d 61 78 20 61 6e | 64 20 63 75 72 72 65 6e |h max an|d curren|
|000044d0| 74 20 76 61 6c 75 65 7d | 0d 09 09 7b 4e 6f 77 2c |t value}|...{Now,|
|000044e0| 20 72 65 73 74 6f 72 65 | 20 76 69 73 69 62 69 6c | restore| visibil|
|000044f0| 69 74 79 20 69 6e 20 63 | 61 73 65 20 77 65 20 6e |ity in c|ase we n|
|00004500| 65 76 65 72 20 68 61 64 | 20 74 6f 20 53 68 6f 77 |ever had| to Show|
|00004510| 43 6f 6e 74 72 6f 6c 20 | 64 75 72 69 6e 67 20 61 |Control |during a|
|00004520| 64 6a 75 73 74 6d 65 6e | 74 7d 0d 09 09 64 6f 63 |djustmen|t}...doc|
|00004530| 56 53 63 72 6f 6c 6c 5e | 5e 2e 63 6f 6e 74 72 6c |VScroll^|^.contrl|
|00004540| 56 69 73 20 3a 3d 20 6b | 43 6f 6e 74 72 6f 6c 56 |Vis := k|ControlV|
|00004550| 69 73 69 62 6c 65 3b 09 | 09 7b 74 75 72 6e 20 74 |isible;.|.{turn t|
|00004560| 68 65 6d 20 6f 6e 7d 0d | 09 09 64 6f 63 48 53 63 |hem on}.|..docHSc|
|00004570| 72 6f 6c 6c 5e 5e 2e 63 | 6f 6e 74 72 6c 56 69 73 |roll^^.c|ontrlVis|
|00004580| 20 3a 3d 20 6b 43 6f 6e | 74 72 6f 6c 56 69 73 69 | := kCon|trolVisi|
|00004590| 62 6c 65 3b 0d 09 45 4e | 44 3b 0d 45 4e 44 3b 20 |ble;..EN|D;.END; |
|000045a0| 7b 41 64 6a 75 73 74 53 | 63 72 6f 6c 6c 62 61 72 |{AdjustS|crollbar|
|000045b0| 73 7d 0d 0d 0d 7b 24 53 | 20 4d 61 69 6e 7d 0d 7b |s}...{$S| Main}.{|
|000045c0| 24 50 55 53 48 7d 20 7b | 24 5a 2b 7d 0d 50 52 4f |$PUSH} {|$Z+}.PRO|
|000045d0| 43 45 44 55 52 45 20 50 | 61 73 63 61 6c 43 6c 69 |CEDURE P|ascalCli|
|000045e0| 6b 4c 6f 6f 70 3b 0d 0d | 7b 47 65 74 73 20 63 61 |kLoop;..|{Gets ca|
|000045f0| 6c 6c 65 64 20 66 72 6f | 6d 20 6f 75 72 20 61 73 |lled fro|m our as|
|00004600| 73 65 6d 62 6c 79 20 6c | 61 6e 67 75 61 67 65 20 |sembly l|anguage |
|00004610| 72 6f 75 74 69 6e 65 2c | 20 41 73 6d 43 6c 69 6b |routine,| AsmClik|
|00004620| 4c 6f 6f 70 2c 20 77 68 | 69 63 68 20 69 73 20 69 |Loop, wh|ich is i|
|00004630| 6e 0d 20 74 75 72 6e 20 | 63 61 6c 6c 65 64 20 62 |n. turn |called b|
|00004640| 79 20 74 68 65 20 54 45 | 43 6c 69 63 6b 20 74 6f |y the TE|Click to|
|00004650| 6f 6c 62 6f 78 20 72 6f | 75 74 69 6e 65 2e 20 53 |olbox ro|utine. S|
|00004660| 61 76 65 73 20 74 68 65 | 20 77 69 6e 64 6f 77 73 |aves the| windows|
|00004670| 20 63 6c 69 70 20 72 65 | 67 69 6f 6e 2c 0d 20 73 | clip re|gion,. s|
|00004680| 65 74 73 20 69 74 20 74 | 6f 20 74 68 65 20 70 6f |ets it t|o the po|
|00004690| 72 74 52 65 63 74 2c 20 | 61 64 6a 75 73 74 73 20 |rtRect, |adjusts |
|000046a0| 74 68 65 20 73 63 72 6f | 6c 6c 62 61 72 20 76 61 |the scro|llbar va|
|000046b0| 6c 75 65 73 20 74 6f 20 | 6d 61 74 63 68 20 74 68 |lues to |match th|
|000046c0| 65 20 54 45 20 73 63 72 | 6f 6c 6c 0d 20 61 6d 6f |e TE scr|oll. amo|
|000046d0| 75 6e 74 2c 20 74 68 65 | 6e 20 72 65 73 74 6f 72 |unt, the|n restor|
|000046e0| 65 73 20 74 68 65 20 63 | 6c 69 70 20 72 65 67 69 |es the c|lip regi|
|000046f0| 6f 6e 2e 7d 0d 0d 56 41 | 52 0d 09 77 69 6e 64 6f |on.}..VA|R..windo|
|00004700| 77 09 3a 20 57 69 6e 64 | 6f 77 50 74 72 3b 0d 09 |w.: Wind|owPtr;..|
|00004710| 72 65 67 69 6f 6e 09 3a | 20 52 67 6e 48 61 6e 64 |region.:| RgnHand|
|00004720| 6c 65 3b 0d 42 45 47 49 | 4e 0d 09 77 69 6e 64 6f |le;.BEGI|N..windo|
|00004730| 77 20 3a 3d 20 46 72 6f | 6e 74 57 69 6e 64 6f 77 |w := Fro|ntWindow|
|00004740| 3b 0d 09 72 65 67 69 6f | 6e 20 3a 3d 20 4e 65 77 |;..regio|n := New|
|00004750| 52 67 6e 3b 0d 09 47 65 | 74 43 6c 69 70 28 72 65 |Rgn;..Ge|tClip(re|
|00004760| 67 69 6f 6e 29 3b 09 09 | 09 09 09 7b 73 61 76 65 |gion);..|...{save|
|00004770| 20 74 68 65 20 6f 6c 64 | 20 63 6c 69 70 7d 0d 09 | the old| clip}..|
|00004780| 43 6c 69 70 52 65 63 74 | 28 77 69 6e 64 6f 77 5e |ClipRect|(window^|
|00004790| 2e 70 6f 72 74 52 65 63 | 74 29 3b 09 09 09 7b 73 |.portRec|t);...{s|
|000047a0| 65 74 20 74 68 65 20 6e | 65 77 20 63 6c 69 70 7d |et the n|ew clip}|
|000047b0| 0d 09 41 64 6a 75 73 74 | 53 63 72 6f 6c 6c 56 61 |..Adjust|ScrollVa|
|000047c0| 6c 75 65 73 28 77 69 6e | 64 6f 77 2c 20 54 52 55 |lues(win|dow, TRU|
|000047d0| 45 29 3b 09 7b 70 61 73 | 73 20 54 52 55 45 20 66 |E);.{pas|s TRUE f|
|000047e0| 6f 72 20 63 61 6e 52 65 | 64 72 61 77 7d 0d 09 53 |or canRe|draw}..S|
|000047f0| 65 74 43 6c 69 70 28 72 | 65 67 69 6f 6e 29 3b 09 |etClip(r|egion);.|
|00004800| 09 09 09 09 7b 72 65 73 | 74 6f 72 65 20 74 68 65 |....{res|tore the|
|00004810| 20 6f 6c 64 20 63 6c 69 | 70 7d 0d 09 44 69 73 70 | old cli|p}..Disp|
|00004820| 6f 73 65 52 67 6e 28 72 | 65 67 69 6f 6e 29 3b 0d |oseRgn(r|egion);.|
|00004830| 45 4e 44 3b 20 7b 50 61 | 73 63 61 6c 43 6c 69 6b |END; {Pa|scalClik|
|00004840| 4c 6f 6f 70 7d 0d 7b 24 | 50 4f 50 7d 0d 0d 0d 7b |Loop}.{$|POP}...{|
|00004850| 24 53 20 4d 61 69 6e 7d | 0d 7b 24 50 55 53 48 7d |$S Main}|.{$PUSH}|
|00004860| 20 7b 24 5a 2b 7d 0d 46 | 55 4e 43 54 49 4f 4e 20 | {$Z+}.F|UNCTION |
|00004870| 47 65 74 4f 6c 64 43 6c | 69 6b 4c 6f 6f 70 20 3a |GetOldCl|ikLoop :|
|00004880| 20 50 72 6f 63 50 74 72 | 3b 0d 0d 7b 47 65 74 73 | ProcPtr|;..{Gets|
|00004890| 20 63 61 6c 6c 65 64 20 | 66 72 6f 6d 20 6f 75 72 | called |from our|
|000048a0| 20 61 73 73 65 6d 62 6c | 79 20 6c 61 6e 67 75 61 | assembl|y langua|
|000048b0| 67 65 20 72 6f 75 74 69 | 6e 65 2c 20 41 73 6d 43 |ge routi|ne, AsmC|
|000048c0| 6c 69 6b 4c 6f 6f 70 2c | 20 77 68 69 63 68 20 69 |likLoop,| which i|
|000048d0| 73 20 69 6e 0d 74 75 72 | 6e 20 63 61 6c 6c 65 64 |s in.tur|n called|
|000048e0| 20 62 79 20 74 68 65 20 | 54 45 43 6c 69 63 6b 20 | by the |TEClick |
|000048f0| 74 6f 6f 6c 62 6f 78 20 | 72 6f 75 74 69 6e 65 2e |toolbox |routine.|
|00004900| 20 49 74 20 72 65 74 75 | 72 6e 73 20 74 68 65 20 | It retu|rns the |
|00004910| 61 64 64 72 65 73 73 20 | 6f 66 20 74 68 65 0d 64 |address |of the.d|
|00004920| 65 66 61 75 6c 74 20 63 | 6c 69 6b 4c 6f 6f 70 20 |efault c|likLoop |
|00004930| 72 6f 75 74 69 6e 65 20 | 74 68 61 74 20 77 61 73 |routine |that was|
|00004940| 20 70 75 74 20 69 6e 74 | 6f 20 74 68 65 20 54 45 | put int|o the TE|
|00004950| 52 65 63 20 62 79 20 54 | 45 41 75 74 6f 56 69 65 |Rec by T|EAutoVie|
|00004960| 77 20 74 6f 0d 41 73 6d | 43 6c 69 6b 4c 6f 6f 70 |w to.Asm|ClikLoop|
|00004970| 20 73 6f 20 74 68 61 74 | 20 69 74 20 63 61 6e 20 | so that| it can |
|00004980| 63 61 6c 6c 20 69 74 2e | 7d 0d 0d 42 45 47 49 4e |call it.|}..BEGIN|
|00004990| 0d 09 47 65 74 4f 6c 64 | 43 6c 69 6b 4c 6f 6f 70 |..GetOld|ClikLoop|
|000049a0| 20 3a 3d 20 44 6f 63 75 | 6d 65 6e 74 50 65 65 6b | := Docu|mentPeek|
|000049b0| 28 46 72 6f 6e 74 57 69 | 6e 64 6f 77 29 5e 2e 64 |(FrontWi|ndow)^.d|
|000049c0| 6f 63 43 6c 69 6b 3b 0d | 45 4e 44 3b 20 7b 47 65 |ocClik;.|END; {Ge|
|000049d0| 74 4f 6c 64 43 6c 69 6b | 4c 6f 6f 70 7d 0d 7b 24 |tOldClik|Loop}.{$|
|000049e0| 50 4f 50 7d 0d 0d 0d 50 | 52 4f 43 45 44 55 52 45 |POP}...P|ROCEDURE|
|000049f0| 20 41 73 6d 43 6c 69 6b | 4c 6f 6f 70 3b 20 45 58 | AsmClik|Loop; EX|
|00004a00| 54 45 52 4e 41 4c 3b 0d | 0d 7b 41 20 72 65 66 65 |TERNAL;.|.{A refe|
|00004a10| 72 65 6e 63 65 20 74 6f | 20 6f 75 72 20 61 73 73 |rence to| our ass|
|00004a20| 65 6d 62 6c 79 20 6c 61 | 6e 67 75 61 67 65 20 72 |embly la|nguage r|
|00004a30| 6f 75 74 69 6e 65 20 74 | 68 61 74 20 67 65 74 73 |outine t|hat gets|
|00004a40| 20 61 74 74 61 63 68 65 | 64 20 74 6f 20 74 68 65 | attache|d to the|
|00004a50| 20 63 6c 69 6b 4c 6f 6f | 70 0d 66 69 65 6c 64 20 | clikLoo|p.field |
|00004a60| 6f 66 20 6f 75 72 20 54 | 45 20 72 65 63 6f 72 64 |of our T|E record|
|00004a70| 2e 7d 0d 0d 0d 7b 24 53 | 20 4d 61 69 6e 7d 0d 50 |.}...{$S| Main}.P|
|00004a80| 52 4f 43 45 44 55 52 45 | 20 44 6f 4e 65 77 3b 0d |ROCEDURE| DoNew;.|
|00004a90| 0d 7b 43 72 65 61 74 65 | 20 61 20 6e 65 77 20 64 |.{Create| a new d|
|00004aa0| 6f 63 75 6d 65 6e 74 20 | 61 6e 64 20 77 69 6e 64 |ocument |and wind|
|00004ab0| 6f 77 2e 7d 0d 0d 56 41 | 52 0d 09 67 6f 6f 64 2c |ow.}..VA|R..good,|
|00004ac0| 20 69 67 6e 6f 72 65 09 | 09 3a 20 42 4f 4f 4c 45 | ignore.|.: BOOLE|
|00004ad0| 41 4e 3b 0d 09 73 74 6f | 72 61 67 65 09 09 09 09 |AN;..sto|rage....|
|00004ae0| 3a 20 50 74 72 3b 0d 09 | 77 69 6e 64 6f 77 09 09 |: Ptr;..|window..|
|00004af0| 09 09 3a 20 57 69 6e 64 | 6f 77 50 74 72 3b 0d 09 |..: Wind|owPtr;..|
|00004b00| 64 65 73 74 52 65 63 74 | 2c 20 76 69 65 77 52 65 |destRect|, viewRe|
|00004b10| 63 74 09 3a 20 52 65 63 | 74 3b 0d 0d 42 45 47 49 |ct.: Rec|t;..BEGI|
|00004b20| 4e 0d 09 73 74 6f 72 61 | 67 65 20 3a 3d 20 4e 65 |N..stora|ge := Ne|
|00004b30| 77 50 74 72 28 53 49 5a | 45 4f 46 28 44 6f 63 75 |wPtr(SIZ|EOF(Docu|
|00004b40| 6d 65 6e 74 52 65 63 6f | 72 64 29 29 3b 0d 09 49 |mentReco|rd));..I|
|00004b50| 46 20 73 74 6f 72 61 67 | 65 20 3c 3e 20 4e 49 4c |F storag|e <> NIL|
|00004b60| 20 54 48 45 4e 20 42 45 | 47 49 4e 0d 09 09 77 69 | THEN BE|GIN...wi|
|00004b70| 6e 64 6f 77 20 3a 3d 20 | 47 65 74 4e 65 77 57 69 |ndow := |GetNewWi|
|00004b80| 6e 64 6f 77 28 72 44 6f | 63 57 69 6e 64 6f 77 2c |ndow(rDo|cWindow,|
|00004b90| 20 73 74 6f 72 61 67 65 | 2c 20 57 69 6e 64 6f 77 | storage|, Window|
|00004ba0| 50 74 72 28 2d 31 29 29 | 3b 0d 09 09 49 46 20 77 |Ptr(-1))|;...IF w|
|00004bb0| 69 6e 64 6f 77 20 3c 3e | 20 4e 49 4c 20 54 48 45 |indow <>| NIL THE|
|00004bc0| 4e 20 42 45 47 49 4e 0d | 09 09 09 67 4e 75 6d 44 |N BEGIN.|...gNumD|
|00004bd0| 6f 63 75 6d 65 6e 74 73 | 20 3a 3d 20 67 4e 75 6d |ocuments| := gNum|
|00004be0| 44 6f 63 75 6d 65 6e 74 | 73 20 2b 20 31 3b 09 7b |Document|s + 1;.{|
|00004bf0| 74 68 69 73 20 77 69 6c | 6c 20 62 65 20 64 65 63 |this wil|l be dec|
|00004c00| 72 65 6d 65 6e 74 65 64 | 20 77 68 65 6e 20 77 65 |remented| when we|
|00004c10| 20 63 61 6c 6c 20 44 6f | 43 6c 6f 73 65 57 69 6e | call Do|CloseWin|
|00004c20| 64 6f 77 7d 0d 09 09 09 | 67 6f 6f 64 20 3a 3d 20 |dow}....|good := |
|00004c30| 46 41 4c 53 45 3b 0d 09 | 09 09 53 65 74 50 6f 72 |FALSE;..|..SetPor|
|00004c40| 74 28 77 69 6e 64 6f 77 | 29 3b 0d 09 09 09 57 49 |t(window|);....WI|
|00004c50| 54 48 20 77 69 6e 64 6f | 77 5e 2c 20 44 6f 63 75 |TH windo|w^, Docu|
|00004c60| 6d 65 6e 74 50 65 65 6b | 28 77 69 6e 64 6f 77 29 |mentPeek|(window)|
|00004c70| 5e 20 44 4f 20 42 45 47 | 49 4e 0d 09 09 09 09 47 |^ DO BEG|IN.....G|
|00004c80| 65 74 54 45 52 65 63 74 | 28 77 69 6e 64 6f 77 2c |etTERect|(window,|
|00004c90| 20 76 69 65 77 52 65 63 | 74 29 3b 0d 09 09 09 09 | viewRec|t);.....|
|00004ca0| 64 65 73 74 52 65 63 74 | 20 3a 3d 20 76 69 65 77 |destRect| := view|
|00004cb0| 52 65 63 74 3b 0d 09 09 | 09 09 64 65 73 74 52 65 |Rect;...|..destRe|
|00004cc0| 63 74 2e 72 69 67 68 74 | 20 3a 3d 20 64 65 73 74 |ct.right| := dest|
|00004cd0| 52 65 63 74 2e 6c 65 66 | 74 20 2b 20 6b 4d 61 78 |Rect.lef|t + kMax|
|00004ce0| 44 6f 63 57 69 64 74 68 | 3b 0d 09 09 09 09 64 6f |DocWidth|;.....do|
|00004cf0| 63 54 45 20 3a 3d 20 54 | 45 4e 65 77 28 64 65 73 |cTE := T|ENew(des|
|00004d00| 74 52 65 63 74 2c 20 76 | 69 65 77 52 65 63 74 29 |tRect, v|iewRect)|
|00004d10| 3b 0d 09 09 09 09 41 64 | 6a 75 73 74 56 69 65 77 |;.....Ad|justView|
|00004d20| 52 65 63 74 28 64 6f 63 | 54 45 29 3b 0d 09 09 09 |Rect(doc|TE);....|
|00004d30| 09 54 45 41 75 74 6f 56 | 69 65 77 28 54 52 55 45 |.TEAutoV|iew(TRUE|
|00004d40| 2c 20 64 6f 63 54 45 29 | 3b 0d 09 09 09 09 64 6f |, docTE)|;.....do|
|00004d50| 63 43 6c 69 6b 20 3a 3d | 20 64 6f 63 54 45 5e 5e |cClik :=| docTE^^|
|00004d60| 2e 63 6c 69 6b 4c 6f 6f | 70 3b 0d 09 09 09 09 64 |.clikLoo|p;.....d|
|00004d70| 6f 63 54 45 5e 5e 2e 63 | 6c 69 6b 4c 6f 6f 70 20 |ocTE^^.c|likLoop |
|00004d80| 3a 3d 20 40 41 73 6d 43 | 6c 69 6b 4c 6f 6f 70 3b |:= @AsmC|likLoop;|
|00004d90| 0d 09 09 09 09 49 46 20 | 64 6f 63 54 45 20 3c 3e |.....IF |docTE <>|
|00004da0| 20 4e 49 4c 20 54 48 45 | 4e 0d 09 09 09 09 09 67 | NIL THE|N......g|
|00004db0| 6f 6f 64 20 3a 3d 20 54 | 52 55 45 3b 09 09 09 09 |ood := T|RUE;....|
|00004dc0| 7b 69 66 20 54 45 4e 65 | 77 20 73 75 63 63 65 65 |{if TENe|w succee|
|00004dd0| 64 65 64 2c 20 77 65 20 | 68 61 76 65 20 61 20 67 |ded, we |have a g|
|00004de0| 6f 6f 64 20 64 6f 63 75 | 6d 65 6e 74 7d 0d 09 09 |ood docu|ment}...|
|00004df0| 09 09 49 46 20 67 6f 6f | 64 20 54 48 45 4e 20 42 |..IF goo|d THEN B|
|00004e00| 45 47 49 4e 0d 09 09 09 | 09 09 64 6f 63 56 53 63 |EGIN....|..docVSc|
|00004e10| 72 6f 6c 6c 20 3a 3d 20 | 47 65 74 4e 65 77 43 6f |roll := |GetNewCo|
|00004e20| 6e 74 72 6f 6c 28 72 56 | 53 63 72 6f 6c 6c 2c 20 |ntrol(rV|Scroll, |
|00004e30| 77 69 6e 64 6f 77 29 3b | 0d 09 09 09 09 09 67 6f |window);|......go|
|00004e40| 6f 64 20 3a 3d 20 28 64 | 6f 63 56 53 63 72 6f 6c |od := (d|ocVScrol|
|00004e50| 6c 20 3c 3e 20 4e 49 4c | 29 3b 0d 09 09 09 09 45 |l <> NIL|);.....E|
|00004e60| 4e 44 3b 0d 09 09 09 09 | 49 46 20 67 6f 6f 64 20 |ND;.....|IF good |
|00004e70| 54 48 45 4e 20 42 45 47 | 49 4e 0d 09 09 09 09 09 |THEN BEG|IN......|
|00004e80| 64 6f 63 48 53 63 72 6f | 6c 6c 20 3a 3d 20 47 65 |docHScro|ll := Ge|
|00004e90| 74 4e 65 77 43 6f 6e 74 | 72 6f 6c 28 72 48 53 63 |tNewCont|rol(rHSc|
|00004ea0| 72 6f 6c 6c 2c 20 77 69 | 6e 64 6f 77 29 3b 0d 09 |roll, wi|ndow);..|
|00004eb0| 09 09 09 09 67 6f 6f 64 | 20 3a 3d 20 28 64 6f 63 |....good| := (doc|
|00004ec0| 48 53 63 72 6f 6c 6c 20 | 3c 3e 20 4e 49 4c 29 3b |HScroll |<> NIL);|
|00004ed0| 0d 09 09 09 09 45 4e 44 | 3b 0d 09 09 09 09 49 46 |.....END|;.....IF|
|00004ee0| 20 67 6f 6f 64 20 54 48 | 45 4e 20 42 45 47 49 4e | good TH|EN BEGIN|
|00004ef0| 0d 09 09 09 09 09 7b 46 | 41 4c 53 45 20 74 6f 20 |......{F|ALSE to |
|00004f00| 41 64 6a 75 73 74 53 63 | 72 6f 6c 6c 56 61 6c 75 |AdjustSc|rollValu|
|00004f10| 65 73 20 6d 65 61 6e 73 | 20 6d 75 73 6e d5 74 20 |es means| musn.t |
|00004f20| 72 65 64 72 61 77 3b 20 | 74 65 63 68 6e 69 63 61 |redraw; |technica|
|00004f30| 6c 6c 79 2c 20 6f 66 20 | 63 6f 75 72 73 65 2c 0d |lly, of |course,.|
|00004f40| 09 09 09 09 09 74 68 65 | 20 77 69 6e 64 6f 77 20 |.....the| window |
|00004f50| 69 73 20 68 69 64 64 65 | 6e 20 73 6f 20 69 74 20 |is hidde|n so it |
|00004f60| 77 6f 75 6c 64 6e d5 74 | 20 6d 61 74 74 65 72 20 |wouldn.t| matter |
|00004f70| 77 68 65 74 68 65 72 20 | 77 65 20 63 61 6c 6c 65 |whether |we calle|
|00004f80| 64 20 53 68 6f 77 43 6f | 6e 74 72 6f 6c 20 6f 72 |d ShowCo|ntrol or|
|00004f90| 20 6e 6f 74 2e 7d 0d 09 | 09 09 09 09 41 64 6a 75 | not.}..|....Adju|
|00004fa0| 73 74 53 63 72 6f 6c 6c | 56 61 6c 75 65 73 28 77 |stScroll|Values(w|
|00004fb0| 69 6e 64 6f 77 2c 20 46 | 41 4c 53 45 29 3b 0d 09 |indow, F|ALSE);..|
|00004fc0| 09 09 09 09 53 68 6f 77 | 57 69 6e 64 6f 77 28 77 |....Show|Window(w|
|00004fd0| 69 6e 64 6f 77 29 3b 09 | 09 09 7b 69 66 20 74 68 |indow);.|..{if th|
|00004fe0| 65 20 64 6f 63 75 6d 65 | 6e 74 20 69 73 20 67 6f |e docume|nt is go|
|00004ff0| 6f 64 2c 20 6d 61 6b 65 | 20 74 68 65 20 77 69 6e |od, make| the win|
|00005000| 64 6f 77 20 76 69 73 69 | 62 6c 65 7d 0d 09 09 09 |dow visi|ble}....|
|00005010| 09 45 4e 44 20 45 4c 53 | 45 20 42 45 47 49 4e 0d |.END ELS|E BEGIN.|
|00005020| 09 09 09 09 09 69 67 6e | 6f 72 65 20 3a 3d 20 44 |.....ign|ore := D|
|00005030| 6f 43 6c 6f 73 65 57 69 | 6e 64 6f 77 28 77 69 6e |oCloseWi|ndow(win|
|00005040| 64 6f 77 29 3b 09 7b 6f | 74 68 65 72 77 69 73 65 |dow);.{o|therwise|
|00005050| 20 72 65 67 72 65 74 20 | 77 65 20 65 76 65 72 20 | regret |we ever |
|00005060| 63 72 65 61 74 65 64 20 | 69 74 2e 2e 2e 7d 0d 09 |created |it...}..|
|00005070| 09 09 09 09 41 6c 65 72 | 74 55 73 65 72 28 65 4e |....Aler|tUser(eN|
|00005080| 6f 57 69 6e 64 6f 77 29 | 3b 09 09 09 09 7b 61 6e |oWindow)|;....{an|
|00005090| 64 20 74 65 6c 6c 20 75 | 73 65 72 7d 0d 09 09 09 |d tell u|ser}....|
|000050a0| 09 45 4e 44 0d 09 09 09 | 45 4e 44 3b 0d 09 09 45 |.END....|END;...E|
|000050b0| 4e 44 20 45 4c 53 45 0d | 09 09 09 44 69 73 70 6f |ND ELSE.|...Dispo|
|000050c0| 73 50 74 72 28 73 74 6f | 72 61 67 65 29 3b 09 09 |sPtr(sto|rage);..|
|000050d0| 09 09 09 7b 67 65 74 20 | 72 69 64 20 6f 66 20 74 |...{get |rid of t|
|000050e0| 68 65 20 73 74 6f 72 61 | 67 65 20 69 66 20 69 74 |he stora|ge if it|
|000050f0| 20 69 73 20 6e 65 76 65 | 72 20 75 73 65 64 7d 0d | is neve|r used}.|
|00005100| 09 45 4e 44 3b 0d 45 4e | 44 3b 20 7b 44 6f 4e 65 |.END;.EN|D; {DoNe|
|00005110| 77 7d 0d 0d 0d 7b 24 53 | 20 4d 61 69 6e 7d 0d 50 |w}...{$S| Main}.P|
|00005120| 52 4f 43 45 44 55 52 45 | 20 42 69 67 42 61 64 45 |ROCEDURE| BigBadE|
|00005130| 72 72 6f 72 28 65 72 72 | 6f 72 3a 20 49 4e 54 45 |rror(err|or: INTE|
|00005140| 47 45 52 29 3b 0d 42 45 | 47 49 4e 0d 09 41 6c 65 |GER);.BE|GIN..Ale|
|00005150| 72 74 55 73 65 72 28 65 | 72 72 6f 72 29 3b 0d 09 |rtUser(e|rror);..|
|00005160| 45 78 69 74 54 6f 53 68 | 65 6c 6c 3b 0d 45 4e 44 |ExitToSh|ell;.END|
|00005170| 3b 0d 0d 0d 7b 24 53 20 | 49 6e 69 74 69 61 6c 69 |;...{$S |Initiali|
|00005180| 7a 65 7d 0d 50 52 4f 43 | 45 44 55 52 45 20 49 6e |ze}.PROC|EDURE In|
|00005190| 69 74 69 61 6c 69 7a 65 | 3b 0d 0d 7b 53 65 74 20 |itialize|;..{Set |
|000051a0| 75 70 20 74 68 65 20 77 | 68 6f 6c 65 20 77 6f 72 |up the w|hole wor|
|000051b0| 6c 64 2c 20 69 6e 63 6c | 75 64 69 6e 67 20 67 6c |ld, incl|uding gl|
|000051c0| 6f 62 61 6c 20 76 61 72 | 69 61 62 6c 65 73 2c 20 |obal var|iables, |
|000051d0| 54 6f 6f 6c 62 6f 78 20 | 6d 61 6e 61 67 65 72 73 |Toolbox |managers|
|000051e0| 2c 0d 20 6d 65 6e 75 73 | 2c 20 61 6e 64 20 61 20 |,. menus|, and a |
|000051f0| 73 69 6e 67 6c 65 20 62 | 6c 61 6e 6b 20 64 6f 63 |single b|lank doc|
|00005200| 75 6d 65 6e 74 2e 7d 0d | 0d 7b 31 2e 30 31 20 2d |ument.}.|.{1.01 -|
|00005210| 20 54 68 65 20 63 6f 64 | 65 20 74 68 61 74 20 75 | The cod|e that u|
|00005220| 73 65 64 20 74 6f 20 62 | 65 20 70 61 72 74 20 6f |sed to b|e part o|
|00005230| 66 20 46 6f 72 63 65 45 | 6e 76 69 72 6f 6e 73 20 |f ForceE|nvirons |
|00005240| 68 61 73 20 62 65 65 6e | 20 6d 6f 76 65 64 20 69 |has been| moved i|
|00005250| 6e 74 6f 0d 20 74 68 69 | 73 20 6d 6f 64 75 6c 65 |nto. thi|s module|
|00005260| 2e 20 49 66 20 61 6e 20 | 65 72 72 6f 72 20 69 73 |. If an |error is|
|00005270| 20 64 65 74 65 63 74 65 | 64 2c 20 69 6e 73 74 65 | detecte|d, inste|
|00005280| 61 64 20 6f 66 20 6d 65 | 72 65 6c 79 20 64 6f 69 |ad of me|rely doi|
|00005290| 6e 67 20 61 6e 20 45 78 | 69 74 54 6f 53 68 65 6c |ng an Ex|itToShel|
|000052a0| 6c 2c 0d 20 77 68 69 63 | 68 20 6c 65 61 76 65 73 |l,. whic|h leaves|
|000052b0| 20 74 68 65 20 75 73 65 | 72 20 77 69 74 68 6f 75 | the use|r withou|
|000052c0| 74 20 6d 75 63 68 20 74 | 6f 20 67 6f 20 6f 6e 2c |t much t|o go on,|
|000052d0| 20 77 65 20 63 61 6c 6c | 20 41 6c 65 72 74 55 73 | we call| AlertUs|
|000052e0| 65 72 2c 20 77 68 69 63 | 68 20 70 75 74 73 0d 20 |er, whic|h puts. |
|000052f0| 75 70 20 61 20 73 69 6d | 70 6c 65 20 61 6c 65 72 |up a sim|ple aler|
|00005300| 74 20 74 68 61 74 20 6a | 75 73 74 20 73 61 79 73 |t that j|ust says|
|00005310| 20 61 6e 20 65 72 72 6f | 72 20 6f 63 63 75 72 72 | an erro|r occurr|
|00005320| 65 64 20 61 6e 64 20 74 | 68 65 6e 20 63 61 6c 6c |ed and t|hen call|
|00005330| 73 20 45 78 69 74 54 6f | 53 68 65 6c 6c 2e 0d 20 |s ExitTo|Shell.. |
|00005340| 53 69 6e 63 65 20 74 68 | 65 72 65 20 69 73 20 6e |Since th|ere is n|
|00005350| 6f 20 6f 74 68 65 72 20 | 63 6c 65 61 6e 75 70 20 |o other |cleanup |
|00005360| 6e 65 65 64 65 64 20 61 | 74 20 74 68 69 73 20 70 |needed a|t this p|
|00005370| 6f 69 6e 74 20 69 66 20 | 61 6e 20 65 72 72 6f 72 |oint if |an error|
|00005380| 20 69 73 20 64 65 74 65 | 63 74 65 64 2c 0d 20 74 | is dete|cted,. t|
|00005390| 68 69 73 20 66 6f 72 6d | 20 6f 66 20 65 72 72 6f |his form| of erro|
|000053a0| 72 2d 20 68 61 6e 64 6c | 69 6e 67 20 69 73 20 61 |r- handl|ing is a|
|000053b0| 63 63 65 70 74 61 62 6c | 65 2e 20 49 66 20 6d 6f |cceptabl|e. If mo|
|000053c0| 72 65 20 73 6f 70 68 69 | 73 74 69 63 61 74 65 64 |re sophi|sticated|
|000053d0| 20 65 72 72 6f 72 20 72 | 65 63 6f 76 65 72 79 0d | error r|ecovery.|
|000053e0| 20 69 73 20 6e 65 65 64 | 65 64 2c 20 61 6e 20 65 | is need|ed, an e|
|000053f0| 78 63 65 70 74 69 6f 6e | 20 6d 65 63 68 61 6e 69 |xception| mechani|
|00005400| 73 6d 2c 20 73 75 63 68 | 20 61 73 20 69 73 20 70 |sm, such| as is p|
|00005410| 72 6f 76 69 64 65 64 20 | 62 79 20 53 69 67 6e 61 |rovided |by Signa|
|00005420| 6c 73 2c 20 63 61 6e 20 | 62 65 20 75 73 65 64 2e |ls, can |be used.|
|00005430| 7d 0d 0d 56 41 52 0d 09 | 6d 65 6e 75 42 61 72 09 |}..VAR..|menuBar.|
|00005440| 09 09 09 3a 20 48 61 6e | 64 6c 65 3b 0d 09 74 6f |...: Han|dle;..to|
|00005450| 74 61 6c 2c 20 63 6f 6e | 74 69 67 09 09 3a 20 4c |tal, con|tig..: L|
|00005460| 6f 6e 67 49 6e 74 3b 0d | 09 69 67 6e 6f 72 65 52 |ongInt;.|.ignoreR|
|00005470| 65 73 75 6c 74 09 09 3a | 20 42 4f 4f 4c 45 41 4e |esult..:| BOOLEAN|
|00005480| 3b 0d 09 65 76 65 6e 74 | 09 09 09 09 3a 20 45 76 |;..event|....: Ev|
|00005490| 65 6e 74 52 65 63 6f 72 | 64 3b 0d 09 63 6f 75 6e |entRecor|d;..coun|
|000054a0| 74 2c 20 69 67 6e 6f 72 | 65 45 72 72 6f 72 09 3a |t, ignor|eError.:|
|000054b0| 20 49 4e 54 45 47 45 52 | 3b 0d 09 0d 09 50 52 4f | INTEGER|;....PRO|
|000054c0| 43 45 44 55 52 45 20 42 | 69 67 42 61 64 45 72 72 |CEDURE B|igBadErr|
|000054d0| 6f 72 28 65 72 72 6f 72 | 3a 20 49 4e 54 45 47 45 |or(error|: INTEGE|
|000054e0| 52 29 3b 0d 09 42 45 47 | 49 4e 0d 09 09 41 6c 65 |R);..BEG|IN...Ale|
|000054f0| 72 74 55 73 65 72 28 65 | 72 72 6f 72 29 3b 0d 09 |rtUser(e|rror);..|
|00005500| 09 45 78 69 74 54 6f 53 | 68 65 6c 6c 3b 0d 09 45 |.ExitToS|hell;..E|
|00005510| 4e 44 3b 0d 0d 42 45 47 | 49 4e 0d 09 67 48 61 73 |ND;..BEG|IN..gHas|
|00005520| 57 61 69 74 4e 65 78 74 | 45 76 65 6e 74 20 3a 3d |WaitNext|Event :=|
|00005530| 20 54 72 61 70 41 76 61 | 69 6c 61 62 6c 65 28 5f | TrapAva|ilable(_|
|00005540| 57 61 69 74 4e 65 78 74 | 45 76 65 6e 74 2c 20 54 |WaitNext|Event, T|
|00005550| 6f 6f 6c 54 72 61 70 29 | 3b 0d 09 67 49 6e 42 61 |oolTrap)|;..gInBa|
|00005560| 63 6b 67 72 6f 75 6e 64 | 20 3a 3d 20 46 41 4c 53 |ckground| := FALS|
|00005570| 45 3b 0d 0d 09 49 6e 69 | 74 47 72 61 66 28 40 74 |E;...Ini|tGraf(@t|
|00005580| 68 65 50 6f 72 74 29 3b | 0d 09 49 6e 69 74 46 6f |hePort);|..InitFo|
|00005590| 6e 74 73 3b 0d 09 49 6e | 69 74 57 69 6e 64 6f 77 |nts;..In|itWindow|
|000055a0| 73 3b 0d 09 49 6e 69 74 | 4d 65 6e 75 73 3b 0d 09 |s;..Init|Menus;..|
|000055b0| 54 45 49 6e 69 74 3b 0d | 09 49 6e 69 74 44 69 61 |TEInit;.|.InitDia|
|000055c0| 6c 6f 67 73 28 4e 49 4c | 29 3b 0d 09 49 6e 69 74 |logs(NIL|);..Init|
|000055d0| 43 75 72 73 6f 72 3b 0d | 0d 09 7b 43 61 6c 6c 20 |Cursor;.|..{Call |
|000055e0| 4d 50 50 4f 70 65 6e 20 | 61 6e 64 20 41 54 50 4c |MPPOpen |and ATPL|
|000055f0| 6f 61 64 20 61 74 20 74 | 68 69 73 20 70 6f 69 6e |oad at t|his poin|
|00005600| 74 20 74 6f 20 69 6e 69 | 74 69 61 6c 69 7a 65 20 |t to ini|tialize |
|00005610| 41 70 70 6c 65 54 61 6c | 6b 2c 0d 09 20 69 66 20 |AppleTal|k,.. if |
|00005620| 79 6f 75 20 61 72 65 20 | 75 73 69 6e 67 20 69 74 |you are |using it|
|00005630| 2e 7d 0d 09 7b 4e 4f 54 | 45 20 2d 2d 20 49 74 20 |.}..{NOT|E -- It |
|00005640| 69 73 20 6e 6f 20 6c 6f | 6e 67 65 72 20 6e 65 63 |is no lo|nger nec|
|00005650| 65 73 73 61 72 79 2c 20 | 61 6e 64 20 61 63 74 75 |essary, |and actu|
|00005660| 61 6c 6c 79 20 75 6e 68 | 65 61 6c 74 68 79 2c 20 |ally unh|ealthy, |
|00005670| 74 6f 20 63 68 65 63 6b | 0d 09 20 50 6f 72 74 42 |to check|.. PortB|
|00005680| 55 73 65 20 61 6e 64 20 | 53 50 43 6f 6e 66 69 67 |Use and |SPConfig|
|00005690| 20 62 65 66 6f 72 65 20 | 6f 70 65 6e 69 6e 67 20 | before |opening |
|000056a0| 41 70 70 6c 65 54 61 6c | 6b 2e 20 54 68 65 20 64 |AppleTal|k. The d|
|000056b0| 72 69 76 65 72 73 20 61 | 72 65 20 63 61 70 61 62 |rivers a|re capab|
|000056c0| 6c 65 0d 09 20 6f 66 20 | 63 68 65 63 6b 69 6e 67 |le.. of |checking|
|000056d0| 20 66 6f 72 20 70 6f 72 | 74 20 61 76 61 69 6c 61 | for por|t availa|
|000056e0| 62 69 6c 69 74 79 20 74 | 68 65 6d 73 65 6c 76 65 |bility t|hemselve|
|000056f0| 73 2e 7d 0d 09 0d 09 7b | 4e 6f 77 20 74 68 69 73 |s.}....{|Now this|
|00005700| 20 6e 65 78 74 20 62 69 | 74 20 6f 66 20 63 6f 64 | next bi|t of cod|
|00005710| 65 20 6d 61 79 20 6d 61 | 6b 65 20 79 6f 75 20 74 |e may ma|ke you t|
|00005720| 6f 73 73 20 79 6f 75 72 | 20 63 6f 6f 6b 69 65 73 |oss your| cookies|
|00005730| 2c 20 62 75 74 20 69 74 | 20 69 73 0d 09 20 6e 65 |, but it| is.. ne|
|00005740| 63 65 73 73 61 72 79 20 | 74 6f 20 61 6c 6c 6f 77 |cessary |to allow|
|00005750| 20 74 68 65 20 64 65 66 | 61 75 6c 74 20 62 75 74 | the def|ault but|
|00005760| 74 6f 6e 20 6f 66 20 6f | 75 72 20 61 6c 65 72 74 |ton of o|ur alert|
|00005770| 20 62 65 20 6f 75 74 6c | 69 6e 65 64 2e 7d 0d 09 | be outl|ined.}..|
|00005780| 20 0d 09 46 4f 52 20 63 | 6f 75 6e 74 20 3a 3d 20 | ..FOR c|ount := |
|00005790| 31 20 54 4f 20 33 20 44 | 4f 0d 09 09 69 67 6e 6f |1 TO 3 D|O...igno|
|000057a0| 72 65 52 65 73 75 6c 74 | 20 3a 3d 20 47 65 74 4e |reResult| := GetN|
|000057b0| 65 78 74 45 76 65 6e 74 | 28 65 76 65 72 79 45 76 |extEvent|(everyEv|
|000057c0| 65 6e 74 2c 20 65 76 65 | 6e 74 29 3b 0d 09 0d 09 |ent, eve|nt);....|
|000057d0| 7b 49 67 6e 6f 72 65 20 | 74 68 65 20 65 72 72 6f |{Ignore |the erro|
|000057e0| 72 20 72 65 74 75 72 6e | 65 64 20 66 72 6f 6d 20 |r return|ed from |
|000057f0| 53 79 73 45 6e 76 69 72 | 6f 6e 73 3b 20 65 76 65 |SysEnvir|ons; eve|
|00005800| 6e 20 69 66 20 61 6e 20 | 65 72 72 6f 72 20 6f 63 |n if an |error oc|
|00005810| 63 75 72 72 65 64 2c 0d | 09 20 74 68 65 20 53 79 |curred,.|. the Sy|
|00005820| 73 45 6e 76 69 72 6f 6e | 73 20 67 6c 75 65 20 77 |sEnviron|s glue w|
|00005830| 69 6c 6c 20 66 69 6c 6c | 20 69 6e 20 74 68 65 20 |ill fill| in the |
|00005840| 53 79 73 45 6e 76 52 65 | 63 2e 20 59 6f 75 20 63 |SysEnvRe|c. You c|
|00005850| 61 6e 20 73 61 76 65 20 | 61 20 72 65 64 75 6e 64 |an save |a redund|
|00005860| 61 6e 74 0d 09 20 63 61 | 6c 6c 20 74 6f 20 53 79 |ant.. ca|ll to Sy|
|00005870| 73 45 6e 76 69 72 6f 6e | 73 20 62 79 20 63 61 6c |sEnviron|s by cal|
|00005880| 6c 69 6e 67 20 69 74 20 | 61 66 74 65 72 20 69 6e |ling it |after in|
|00005890| 69 74 69 61 6c 69 7a 69 | 6e 67 20 41 70 70 6c 65 |itializi|ng Apple|
|000058a0| 54 61 6c 6b 2e 7d 0d 09 | 20 0d 09 69 67 6e 6f 72 |Talk.}..| ..ignor|
|000058b0| 65 45 72 72 6f 72 20 3a | 3d 20 53 79 73 45 6e 76 |eError :|= SysEnv|
|000058c0| 69 72 6f 6e 73 28 6b 53 | 79 73 45 6e 76 69 72 6f |irons(kS|ysEnviro|
|000058d0| 6e 73 56 65 72 73 69 6f | 6e 2c 20 67 4d 61 63 29 |nsVersio|n, gMac)|
|000058e0| 3b 0d 09 0d 09 7b 4d 61 | 6b 65 20 73 75 72 65 20 |;....{Ma|ke sure |
|000058f0| 74 68 61 74 20 74 68 65 | 20 6d 61 63 68 69 6e 65 |that the| machine|
|00005900| 20 68 61 73 20 61 74 20 | 6c 65 61 73 74 20 31 32 | has at |least 12|
|00005910| 38 4b 20 52 4f 4d 73 2e | 20 49 66 20 69 74 20 64 |8K ROMs.| If it d|
|00005920| 6f 65 73 6e 27 74 2c 20 | 65 78 69 74 2e 7d 0d 09 |oesn't, |exit.}..|
|00005930| 0d 09 49 46 20 67 4d 61 | 63 2e 6d 61 63 68 69 6e |..IF gMa|c.machin|
|00005940| 65 54 79 70 65 20 3c 20 | 30 20 54 48 45 4e 20 42 |eType < |0 THEN B|
|00005950| 69 67 42 61 64 45 72 72 | 6f 72 28 65 57 72 6f 6e |igBadErr|or(eWron|
|00005960| 67 4d 61 63 68 69 6e 65 | 29 3b 0d 09 0d 09 7b 31 |gMachine|);....{1|
|00005970| 2e 30 31 20 2d 20 57 65 | 20 75 73 65 64 20 74 6f |.01 - We| used to|
|00005980| 20 6d 61 6b 65 20 61 20 | 63 68 65 63 6b 20 66 6f | make a |check fo|
|00005990| 72 20 6d 65 6d 6f 72 79 | 20 61 74 20 74 68 69 73 |r memory| at this|
|000059a0| 20 70 6f 69 6e 74 20 62 | 79 20 65 78 61 6d 69 6e | point b|y examin|
|000059b0| 69 6e 67 20 41 70 70 6c | 4c 69 6d 69 74 2c 0d 09 |ing Appl|Limit,..|
|000059c0| 20 41 70 70 6c 69 63 5a | 6f 6e 65 2c 20 61 6e 64 | ApplicZ|one, and|
|000059d0| 20 53 74 61 63 6b 53 70 | 61 63 65 20 61 6e 64 20 | StackSp|ace and |
|000059e0| 63 6f 6d 70 61 72 69 6e | 67 20 74 68 61 74 20 74 |comparin|g that t|
|000059f0| 6f 20 74 68 65 20 6d 69 | 6e 69 6d 75 6d 20 73 69 |o the mi|nimum si|
|00005a00| 7a 65 20 77 65 20 74 6f | 6c 64 0d 09 20 4d 75 6c |ze we to|ld.. Mul|
|00005a10| 74 69 46 69 6e 64 65 72 | 20 77 65 20 6e 65 65 64 |tiFinder| we need|
|00005a20| 65 64 2e 20 54 68 69 73 | 20 64 69 64 20 6e 6f 74 |ed. This| did not|
|00005a30| 20 77 6f 72 6b 20 77 65 | 6c 6c 20 62 65 63 61 75 | work we|ll becau|
|00005a40| 73 65 20 69 74 20 61 73 | 73 75 6d 65 64 20 74 6f |se it as|sumed to|
|00005a50| 6f 20 6d 75 63 68 20 61 | 62 6f 75 74 0d 09 20 74 |o much a|bout.. t|
|00005a60| 68 65 20 72 65 6c 61 74 | 69 6f 6e 73 68 69 70 20 |he relat|ionship |
|00005a70| 62 65 74 77 65 65 6e 20 | 77 68 61 74 20 77 65 20 |between |what we |
|00005a80| 61 73 6b 65 64 20 4d 75 | 6c 74 69 46 69 6e 64 65 |asked Mu|ltiFinde|
|00005a90| 72 20 66 6f 72 20 61 6e | 64 20 77 68 61 74 20 77 |r for an|d what w|
|00005aa0| 65 20 77 6f 75 6c 64 20 | 61 63 74 75 61 6c 6c 79 |e would |actually|
|00005ab0| 0d 09 20 67 65 74 20 62 | 61 63 6b 2c 20 61 73 20 |.. get b|ack, as |
|00005ac0| 77 65 6c 6c 20 61 73 20 | 68 6f 77 20 74 6f 20 6d |well as |how to m|
|00005ad0| 65 61 73 75 72 65 20 69 | 74 2e 20 49 6e 73 74 65 |easure i|t. Inste|
|00005ae0| 61 64 2c 20 77 65 20 77 | 69 6c 6c 20 75 73 65 20 |ad, we w|ill use |
|00005af0| 61 6e 20 61 6c 74 65 72 | 6e 61 74 65 0d 09 20 6d |an alter|nate.. m|
|00005b00| 65 74 68 6f 64 20 63 6f | 6d 70 72 69 73 65 64 20 |ethod co|mprised |
|00005b10| 6f 66 20 74 77 6f 20 73 | 74 65 70 73 2e 7d 0d 09 |of two s|teps.}..|
|00005b20| 20 0d 09 7b 49 74 20 69 | 73 20 62 65 74 74 65 72 | ..{It i|s better|
|00005b30| 20 74 6f 20 66 69 72 73 | 74 20 63 68 65 63 6b 20 | to firs|t check |
|00005b40| 74 68 65 20 73 69 7a 65 | 20 6f 66 20 74 68 65 20 |the size| of the |
|00005b50| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 68 65 61 70 |applicat|ion heap|
|00005b60| 20 61 67 61 69 6e 73 74 | 20 61 20 76 61 6c 75 65 | against| a value|
|00005b70| 0d 09 20 74 68 61 74 20 | 79 6f 75 20 68 61 76 65 |.. that |you have|
|00005b80| 20 64 65 74 65 72 6d 69 | 6e 65 64 20 69 73 20 74 | determi|ned is t|
|00005b90| 68 65 20 73 6d 61 6c 6c | 65 73 74 20 68 65 61 70 |he small|est heap|
|00005ba0| 20 74 68 65 20 61 70 70 | 6c 69 63 61 74 69 6f 6e | the app|lication|
|00005bb0| 20 63 61 6e 20 72 65 61 | 73 6f 6e 61 62 6c 79 0d | can rea|sonably.|
|00005bc0| 09 20 77 6f 72 6b 20 69 | 6e 2e 20 54 68 69 73 20 |. work i|n. This |
|00005bd0| 6e 75 6d 62 65 72 20 73 | 68 6f 75 6c 64 20 62 65 |number s|hould be|
|00005be0| 20 64 65 72 69 76 65 64 | 20 62 79 20 65 78 61 6d | derived| by exam|
|00005bf0| 69 6e 69 6e 67 20 74 68 | 65 20 73 69 7a 65 20 6f |ining th|e size o|
|00005c00| 66 20 74 68 65 20 68 65 | 61 70 20 74 68 61 74 0d |f the he|ap that.|
|00005c10| 09 20 69 73 20 61 63 74 | 75 61 6c 6c 79 20 70 72 |. is act|ually pr|
|00005c20| 6f 76 69 64 65 64 20 62 | 79 20 4d 75 6c 74 69 46 |ovided b|y MultiF|
|00005c30| 69 6e 64 65 72 20 77 68 | 65 6e 20 74 68 65 20 6d |inder wh|en the m|
|00005c40| 69 6e 69 6d 75 6d 20 73 | 69 7a 65 20 72 65 71 75 |inimum s|ize requ|
|00005c50| 65 73 74 65 64 20 69 73 | 20 75 73 65 64 2e 0d 09 |ested is| used...|
|00005c60| 20 54 68 65 20 64 65 72 | 69 76 61 74 69 6f 6e 20 | The der|ivation |
|00005c70| 6f 66 20 74 68 65 20 6d | 69 6e 69 6d 75 6d 20 73 |of the m|inimum s|
|00005c80| 69 7a 65 20 72 65 71 75 | 65 73 74 65 64 20 66 72 |ize requ|ested fr|
|00005c90| 6f 6d 20 4d 75 6c 74 69 | 46 69 6e 64 65 72 20 69 |om Multi|Finder i|
|00005ca0| 73 20 64 65 73 63 72 69 | 62 65 64 0d 09 20 69 6e |s descri|bed.. in|
|00005cb0| 20 53 61 6d 70 6c 65 2e | 68 2e 20 54 68 65 20 63 | Sample.|h. The c|
|00005cc0| 68 65 63 6b 20 73 68 6f | 75 6c 64 20 62 65 20 6d |heck sho|uld be m|
|00005cd0| 61 64 65 20 62 65 63 61 | 75 73 65 20 74 68 65 20 |ade beca|use the |
|00005ce0| 70 72 65 66 65 72 72 65 | 64 20 73 69 7a 65 20 63 |preferre|d size c|
|00005cf0| 61 6e 20 65 6e 64 20 75 | 70 0d 09 20 62 65 69 6e |an end u|p.. bein|
|00005d00| 67 20 73 65 74 20 73 6d | 61 6c 6c 65 72 20 74 68 |g set sm|aller th|
|00005d10| 61 6e 20 74 68 65 20 6d | 69 6e 69 6d 75 6d 20 73 |an the m|inimum s|
|00005d20| 69 7a 65 20 62 79 20 74 | 68 65 20 75 73 65 72 2e |ize by t|he user.|
|00005d30| 20 54 68 69 73 20 65 78 | 74 72 61 20 63 68 65 63 | This ex|tra chec|
|00005d40| 6b 20 61 63 74 73 20 74 | 6f 0d 09 20 69 6e 73 75 |k acts t|o.. insu|
|00005d50| 72 65 20 74 68 61 74 20 | 79 6f 75 72 20 61 70 70 |re that |your app|
|00005d60| 6c 69 63 61 74 69 6f 6e | 20 69 73 20 73 74 61 72 |lication| is star|
|00005d70| 74 69 6e 67 20 66 72 6f | 6d 20 61 20 73 6f 6c 69 |ting fro|m a soli|
|00005d80| 64 20 6d 65 6d 6f 72 79 | 20 66 6f 75 6e 64 61 74 |d memory| foundat|
|00005d90| 69 6f 6e 2e 7d 0d 09 20 | 0d 09 49 46 20 4f 52 44 |ion.}.. |..IF ORD|
|00005da0| 28 47 65 74 41 70 70 6c | 4c 69 6d 69 74 29 20 2d |(GetAppl|Limit) -|
|00005db0| 20 4f 52 44 28 41 70 70 | 6c 69 63 5a 6f 6e 65 29 | ORD(App|licZone)|
|00005dc0| 20 3c 20 6b 4d 69 6e 48 | 65 61 70 20 54 48 45 4e | < kMinH|eap THEN|
|00005dd0| 20 42 69 67 42 61 64 45 | 72 72 6f 72 28 65 53 6d | BigBadE|rror(eSm|
|00005de0| 61 6c 6c 53 69 7a 65 29 | 3b 0d 09 0d 09 7b 4e 65 |allSize)|;....{Ne|
|00005df0| 78 74 2c 20 6d 61 6b 65 | 20 73 75 72 65 20 74 68 |xt, make| sure th|
|00005e00| 61 74 20 65 6e 6f 75 67 | 68 20 6d 65 6d 6f 72 79 |at enoug|h memory|
|00005e10| 20 69 73 20 66 72 65 65 | 20 66 6f 72 20 79 6f 75 | is free| for you|
|00005e20| 72 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 74 6f |r applic|ation to|
|00005e30| 20 72 75 6e 2e 20 49 74 | 0d 09 20 69 73 20 70 6f | run. It|.. is po|
|00005e40| 73 73 69 62 6c 65 20 66 | 6f 72 20 61 20 73 69 74 |ssible f|or a sit|
|00005e50| 75 61 74 69 6f 6e 20 74 | 6f 20 61 72 69 73 65 20 |uation t|o arise |
|00005e60| 77 68 65 72 65 20 74 68 | 65 20 68 65 61 70 20 6d |where th|e heap m|
|00005e70| 61 79 20 68 61 76 65 20 | 62 65 65 6e 20 6f 66 20 |ay have |been of |
|00005e80| 72 65 71 75 69 72 65 64 | 0d 09 20 73 69 7a 65 2c |required|.. size,|
|00005e90| 20 62 75 74 20 61 20 6c | 61 72 67 65 20 73 63 72 | but a l|arge scr|
|00005ea0| 61 70 20 77 61 73 20 6c | 6f 61 64 65 64 20 77 68 |ap was l|oaded wh|
|00005eb0| 69 63 68 20 6c 65 66 74 | 20 74 6f 6f 20 6c 69 74 |ich left| too lit|
|00005ec0| 74 6c 65 20 6d 65 6d 6f | 72 79 2e 20 54 6f 20 63 |tle memo|ry. To c|
|00005ed0| 68 65 63 6b 20 66 6f 72 | 0d 09 20 74 68 69 73 2c |heck for|.. this,|
|00005ee0| 20 63 61 6c 6c 20 50 75 | 72 67 65 53 70 61 63 65 | call Pu|rgeSpace|
|00005ef0| 20 61 6e 64 20 63 6f 6d | 70 61 72 65 20 74 68 65 | and com|pare the|
|00005f00| 20 72 65 73 75 6c 74 20 | 77 69 74 68 20 61 20 76 | result |with a v|
|00005f10| 61 6c 75 65 20 74 68 61 | 74 20 79 6f 75 20 68 61 |alue tha|t you ha|
|00005f20| 76 65 20 64 65 74 65 72 | 6d 69 6e 65 64 0d 09 20 |ve deter|mined.. |
|00005f30| 69 73 20 74 68 65 20 6d | 69 6e 69 6d 75 6d 20 61 |is the m|inimum a|
|00005f40| 6d 6f 75 6e 74 20 6f 66 | 20 66 72 65 65 20 6d 65 |mount of| free me|
|00005f50| 6d 6f 72 79 20 79 6f 75 | 72 20 61 70 70 6c 69 63 |mory you|r applic|
|00005f60| 61 74 69 6f 6e 20 6e 65 | 65 64 73 20 61 74 20 69 |ation ne|eds at i|
|00005f70| 6e 69 74 69 61 6c 69 7a | 61 74 69 6f 6e 2e 0d 09 |nitializ|ation...|
|00005f80| 20 54 68 69 73 20 6e 75 | 6d 62 65 72 20 63 61 6e | This nu|mber can|
|00005f90| 20 62 65 20 64 65 72 69 | 76 65 64 20 73 65 76 65 | be deri|ved seve|
|00005fa0| 72 61 6c 20 64 69 66 66 | 65 72 65 6e 74 20 77 61 |ral diff|erent wa|
|00005fb0| 79 73 2e 20 4f 6e 65 20 | 77 61 79 20 74 68 61 74 |ys. One |way that|
|00005fc0| 20 69 73 20 66 61 69 72 | 6c 79 0d 09 20 73 74 72 | is fair|ly.. str|
|00005fd0| 61 69 67 68 74 66 6f 72 | 77 61 72 64 20 69 73 20 |aightfor|ward is |
|00005fe0| 74 6f 20 72 75 6e 20 74 | 68 65 20 61 70 70 6c 69 |to run t|he appli|
|00005ff0| 63 61 74 69 6f 6e 20 69 | 6e 20 74 68 65 20 6d 69 |cation i|n the mi|
|00006000| 6e 69 6d 75 6d 20 73 69 | 7a 65 20 63 6f 6e 66 69 |nimum si|ze confi|
|00006010| 67 75 72 61 74 69 6f 6e | 0d 09 20 61 73 20 64 65 |guration|.. as de|
|00006020| 73 63 72 69 62 65 64 20 | 70 72 65 76 69 6f 75 73 |scribed |previous|
|00006030| 6c 79 2e 20 43 61 6c 6c | 20 50 75 72 67 65 53 70 |ly. Call| PurgeSp|
|00006040| 61 63 65 20 61 74 20 69 | 6e 69 74 69 61 6c 69 7a |ace at i|nitializ|
|00006050| 61 74 69 6f 6e 20 61 6e | 64 20 65 78 61 6d 69 6e |ation an|d examin|
|00006060| 65 20 74 68 65 20 76 61 | 6c 75 65 0d 09 20 72 65 |e the va|lue.. re|
|00006070| 74 75 72 6e 65 64 2e 20 | 48 6f 77 65 76 65 72 2c |turned. |However,|
|00006080| 20 79 6f 75 20 73 68 6f | 75 6c 64 20 6d 61 6b 65 | you sho|uld make|
|00006090| 20 73 75 72 65 20 74 68 | 61 74 20 74 68 69 73 20 | sure th|at this |
|000060a0| 72 65 73 75 6c 74 20 69 | 73 20 6e 6f 74 20 62 65 |result i|s not be|
|000060b0| 69 6e 67 20 6d 6f 64 69 | 66 69 65 64 0d 09 20 62 |ing modi|fied.. b|
|000060c0| 79 20 74 68 65 20 73 63 | 72 61 70 27 73 20 70 72 |y the sc|rap's pr|
|000060d0| 65 73 65 6e 63 65 2e 20 | 59 6f 75 20 63 61 6e 20 |esence. |You can |
|000060e0| 64 6f 20 74 68 61 74 20 | 62 79 20 63 61 6c 6c 69 |do that |by calli|
|000060f0| 6e 67 20 5a 65 72 6f 53 | 63 72 61 70 20 62 65 66 |ng ZeroS|crap bef|
|00006100| 6f 72 65 20 63 61 6c 6c | 69 6e 67 0d 09 20 50 75 |ore call|ing.. Pu|
|00006110| 72 67 65 53 70 61 63 65 | 2e 20 4d 61 6b 65 20 73 |rgeSpace|. Make s|
|00006120| 75 72 65 20 74 6f 20 72 | 65 6d 6f 76 65 20 74 68 |ure to r|emove th|
|00006130| 61 74 20 63 61 6c 6c 20 | 62 65 66 6f 72 65 20 73 |at call |before s|
|00006140| 68 69 70 70 69 6e 67 2c | 20 74 68 6f 75 67 68 2e |hipping,| though.|
|00006150| 7d 0d 09 20 0d 09 7b 2a | 20 5a 65 72 6f 53 63 72 |}.. ..{*| ZeroScr|
|00006160| 61 70 3b 20 2a 7d 0d 09 | 50 75 72 67 65 53 70 61 |ap; *}..|PurgeSpa|
|00006170| 63 65 28 74 6f 74 61 6c | 2c 20 63 6f 6e 74 69 67 |ce(total|, contig|
|00006180| 29 3b 0d 09 49 46 20 74 | 6f 74 61 6c 20 3c 20 6b |);..IF t|otal < k|
|00006190| 4d 69 6e 53 70 61 63 65 | 20 54 48 45 4e 0d 09 09 |MinSpace| THEN...|
|000061a0| 49 46 20 55 6e 6c 6f 61 | 64 53 63 72 61 70 20 3c |IF Unloa|dScrap <|
|000061b0| 3e 20 6e 6f 45 72 72 20 | 54 48 45 4e 0d 09 09 09 |> noErr |THEN....|
|000061c0| 42 69 67 42 61 64 45 72 | 72 6f 72 28 65 4e 6f 4d |BigBadEr|ror(eNoM|
|000061d0| 65 6d 6f 72 79 29 0d 09 | 09 45 4c 53 45 20 42 45 |emory)..|.ELSE BE|
|000061e0| 47 49 4e 0d 09 09 09 50 | 75 72 67 65 53 70 61 63 |GIN....P|urgeSpac|
|000061f0| 65 28 74 6f 74 61 6c 2c | 20 63 6f 6e 74 69 67 29 |e(total,| contig)|
|00006200| 3b 0d 09 09 09 49 46 20 | 74 6f 74 61 6c 20 3c 20 |;....IF |total < |
|00006210| 6b 4d 69 6e 53 70 61 63 | 65 20 54 48 45 4e 0d 09 |kMinSpac|e THEN..|
|00006220| 09 09 09 42 69 67 42 61 | 64 45 72 72 6f 72 28 65 |...BigBa|dError(e|
|00006230| 4e 6f 4d 65 6d 6f 72 79 | 29 3b 0d 09 09 45 4e 44 |NoMemory|);...END|
|00006240| 3b 0d 0d 09 7b 54 68 65 | 20 65 78 74 72 61 20 62 |;...{The| extra b|
|00006250| 65 6e 65 66 69 74 20 74 | 6f 20 77 61 69 74 69 6e |enefit t|o waitin|
|00006260| 67 20 75 6e 74 69 6c 20 | 61 66 74 65 72 20 74 68 |g until |after th|
|00006270| 65 20 54 6f 6f 6c 62 6f | 78 20 4d 61 6e 61 67 65 |e Toolbo|x Manage|
|00006280| 72 73 20 68 61 76 65 20 | 62 65 65 6e 20 69 6e 69 |rs have |been ini|
|00006290| 74 69 61 6c 69 7a 65 64 | 0d 09 20 74 6f 20 63 68 |tialized|.. to ch|
|000062a0| 65 63 6b 20 6d 65 6d 6f | 72 79 20 69 73 20 74 68 |eck memo|ry is th|
|000062b0| 61 74 20 77 65 20 63 61 | 6e 20 6e 6f 77 20 67 69 |at we ca|n now gi|
|000062c0| 76 65 20 74 68 65 20 75 | 73 65 72 20 61 6e 20 61 |ve the u|ser an a|
|000062d0| 6c 65 72 74 20 74 6f 20 | 74 65 6c 6c 20 68 65 72 |lert to |tell her|
|000062e0| 2f 68 69 6d 20 77 68 61 | 74 0d 09 20 68 61 70 70 |/him wha|t.. happ|
|000062f0| 65 6e 65 64 2e 20 41 6c | 74 68 6f 75 67 68 20 69 |ened. Al|though i|
|00006300| 74 20 69 73 20 70 6f 73 | 73 69 62 6c 65 20 74 68 |t is pos|sible th|
|00006310| 61 74 20 74 68 65 20 6d | 65 6d 6f 72 79 20 73 69 |at the m|emory si|
|00006320| 74 75 61 74 69 6f 6e 20 | 63 6f 75 6c 64 20 62 65 |tuation |could be|
|00006330| 20 77 6f 72 73 65 6e 65 | 64 20 62 79 0d 09 20 64 | worsene|d by.. d|
|00006340| 69 73 70 6c 61 79 69 6e | 67 20 61 6e 20 61 6c 65 |isplayin|g an ale|
|00006350| 72 74 2c 20 4d 75 6c 74 | 69 46 69 6e 64 65 72 20 |rt, Mult|iFinder |
|00006360| 77 6f 75 6c 64 20 67 72 | 61 63 65 66 75 6c 6c 79 |would gr|acefully|
|00006370| 20 65 78 69 74 20 74 68 | 65 20 61 70 70 6c 69 63 | exit th|e applic|
|00006380| 61 74 69 6f 6e 20 77 69 | 74 68 0d 09 20 61 6e 20 |ation wi|th.. an |
|00006390| 69 6e 66 6f 72 6d 61 74 | 69 76 65 20 61 6c 65 72 |informat|ive aler|
|000063a0| 74 20 69 66 20 6d 65 6d | 6f 72 79 20 62 65 63 61 |t if mem|ory beca|
|000063b0| 6d 65 20 63 72 69 74 69 | 63 61 6c 2e 20 48 65 72 |me criti|cal. Her|
|000063c0| 65 20 77 65 20 61 72 65 | 20 61 63 74 69 6e 67 20 |e we are| acting |
|000063d0| 6d 6f 72 65 0d 09 20 69 | 6e 20 61 20 70 72 65 76 |more.. i|n a prev|
|000063e0| 65 6e 74 61 74 69 76 65 | 20 6d 61 6e 6e 65 72 20 |entative| manner |
|000063f0| 74 6f 20 61 76 6f 69 64 | 20 66 75 74 75 72 65 20 |to avoid| future |
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.