home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / Developer Essentials Jul 90 / DTS Sample Code / Macintosh Sample Code / Monthly Releases (Compressed) / MacDTS.Sample.Code.90.02.sit / SC.014.CPlusTESample / TESample.cp < prev    next >
MacBinary  |  1989-10-01  |  11.9 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
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert MS-DOS Code Page Info (other/dosCodePage) ext Unsupported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Sun Oct 1 00:00:00 1989, modified Sun Oct 1 00:00:00 1989, creator 'MPS ', type ASCII, 11547 bytes "TESample.cp" , at 0x2d9b 316 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 0b 54 45 53 61 6d 70 | 6c 65 2e 63 70 00 00 00 |..TESamp|le.cp...|
|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 2d 1b 00 | 00 01 3c a1 4b 3c 40 a1 |.....-..|..<.K<@.|
|00000060| 4b 3c 40 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |K<@.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 35 ff 00 00 |........|....5...|
|00000080| 2f 2a 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 2d |--------|--------|
|000000d0| 0d 23 0d 23 09 41 70 70 | 6c 65 20 4d 61 63 69 6e |.#.#.App|le Macin|
|000000e0| 74 6f 73 68 20 44 65 76 | 65 6c 6f 70 65 72 20 54 |tosh Dev|eloper T|
|000000f0| 65 63 68 6e 69 63 61 6c | 20 53 75 70 70 6f 72 74 |echnical| Support|
|00000100| 0d 23 0d 23 09 4d 75 6c | 74 69 46 69 6e 64 65 72 |.#.#.Mul|tiFinder|
|00000110| 2d 41 77 61 72 65 20 53 | 69 6d 70 6c 65 20 54 65 |-Aware S|imple Te|
|00000120| 78 74 45 64 69 74 20 53 | 61 6d 70 6c 65 20 41 70 |xtEdit S|ample Ap|
|00000130| 70 6c 69 63 61 74 69 6f | 6e 0d 23 0d 23 09 43 50 |plicatio|n.#.#.CP|
|00000140| 6c 75 73 54 45 53 61 6d | 70 6c 65 0d 23 0d 23 09 |lusTESam|ple.#.#.|
|00000150| 54 45 53 61 6d 70 6c 65 | 2e 63 70 09 2d 09 43 2b |TESample|.cp.-.C+|
|00000160| 2b 20 73 6f 75 72 63 65 | 0d 23 0d 23 09 43 6f 70 |+ source|.#.#.Cop|
|00000170| 79 72 69 67 68 74 20 a9 | 20 31 39 38 39 20 41 70 |yright .| 1989 Ap|
|00000180| 70 6c 65 20 43 6f 6d 70 | 75 74 65 72 2c 20 49 6e |ple Comp|uter, In|
|00000190| 63 2e 0d 23 09 41 6c 6c | 20 72 69 67 68 74 73 20 |c..#.All| rights |
|000001a0| 72 65 73 65 72 76 65 64 | 2e 0d 23 0d 23 09 56 65 |reserved|..#.#.Ve|
|000001b0| 72 73 69 6f 6e 73 3a 09 | 0d 23 09 09 09 31 2e 32 |rsions:.|.#...1.2|
|000001c0| 30 09 09 09 09 09 31 30 | 2f 38 39 0d 23 09 09 09 |0.....10|/89.#...|
|000001d0| 31 2e 31 30 20 09 09 09 | 09 09 30 37 2f 38 39 0d |1.10 ...|..07/89.|
|000001e0| 23 09 09 09 31 2e 30 30 | 20 09 09 09 09 09 30 34 |#...1.00| .....04|
|000001f0| 2f 38 39 0d 23 09 0d 23 | 09 43 6f 6d 70 6f 6e 65 |/89.#..#|.Compone|
|00000200| 6e 74 73 3a 0d 23 09 09 | 09 43 50 6c 75 73 54 45 |nts:.#..|.CPlusTE|
|00000210| 53 61 6d 70 6c 65 2e 6d | 61 6b 65 09 09 4f 63 74 |Sample.m|ake..Oct|
|00000220| 6f 62 65 72 20 31 2c 20 | 31 39 38 39 0d 23 09 09 |ober 1, |1989.#..|
|00000230| 09 54 41 70 70 6c 69 63 | 61 74 69 6f 6e 43 6f 6d |.TApplic|ationCom|
|00000240| 6d 6f 6e 2e 68 09 4f 63 | 74 6f 62 65 72 20 31 2c |mon.h.Oc|tober 1,|
|00000250| 20 31 39 38 39 0d 23 09 | 09 09 54 41 70 70 6c 69 | 1989.#.|..TAppli|
|00000260| 63 61 74 69 6f 6e 2e 68 | 09 09 09 4f 63 74 6f 62 |cation.h|...Octob|
|00000270| 65 72 20 31 2c 20 31 39 | 38 39 0d 23 09 09 09 54 |er 1, 19|89.#...T|
|00000280| 44 6f 63 75 6d 65 6e 74 | 2e 68 09 09 09 09 4f 63 |Document|.h....Oc|
|00000290| 74 6f 62 65 72 20 31 2c | 20 31 39 38 39 0d 23 09 |tober 1,| 1989.#.|
|000002a0| 09 09 54 45 43 6f 6d 6d | 6f 6e 2e 68 09 09 09 09 |..TEComm|on.h....|
|000002b0| 4f 63 74 6f 62 65 72 20 | 31 2c 20 31 39 38 39 0d |October |1, 1989.|
|000002c0| 23 09 09 09 54 45 53 61 | 6d 70 6c 65 2e 68 09 09 |#...TESa|mple.h..|
|000002d0| 09 09 4f 63 74 6f 62 65 | 72 20 31 2c 20 31 39 38 |..Octobe|r 1, 198|
|000002e0| 39 0d 23 09 09 09 54 45 | 44 6f 63 75 6d 65 6e 74 |9.#...TE|Document|
|000002f0| 2e 68 09 09 09 4f 63 74 | 6f 62 65 72 20 31 2c 20 |.h...Oct|ober 1, |
|00000300| 31 39 38 39 0d 23 09 09 | 09 54 41 70 70 6c 69 63 |1989.#..|.TApplic|
|00000310| 61 74 69 6f 6e 2e 63 70 | 09 09 09 4f 63 74 6f 62 |ation.cp|...Octob|
|00000320| 65 72 20 31 2c 20 31 39 | 38 39 0d 23 09 09 09 54 |er 1, 19|89.#...T|
|00000330| 44 6f 63 75 6d 65 6e 74 | 2e 63 70 09 09 09 4f 63 |Document|.cp...Oc|
|00000340| 74 6f 62 65 72 20 31 2c | 20 31 39 38 39 0d 23 09 |tober 1,| 1989.#.|
|00000350| 09 09 54 45 53 61 6d 70 | 6c 65 2e 63 70 09 09 09 |..TESamp|le.cp...|
|00000360| 09 4f 63 74 6f 62 65 72 | 20 31 2c 20 31 39 38 39 |.October| 1, 1989|
|00000370| 0d 23 09 09 09 54 45 44 | 6f 63 75 6d 65 6e 74 2e |.#...TED|ocument.|
|00000380| 63 70 09 09 09 4f 63 74 | 6f 62 65 72 20 31 2c 20 |cp...Oct|ober 1, |
|00000390| 31 39 38 39 0d 23 09 09 | 09 54 45 53 61 6d 70 6c |1989.#..|.TESampl|
|000003a0| 65 47 6c 75 65 2e 61 09 | 09 09 4f 63 74 6f 62 65 |eGlue.a.|..Octobe|
|000003b0| 72 20 31 2c 20 31 39 38 | 39 0d 23 09 09 09 54 41 |r 1, 198|9.#...TA|
|000003c0| 70 70 6c 69 63 61 74 69 | 6f 6e 2e 72 09 09 09 4f |pplicati|on.r...O|
|000003d0| 63 74 6f 62 65 72 20 31 | 2c 20 31 39 38 39 0d 23 |ctober 1|, 1989.#|
|000003e0| 09 09 09 54 45 53 61 6d | 70 6c 65 2e 72 09 09 09 |...TESam|ple.r...|
|000003f0| 09 4f 63 74 6f 62 65 72 | 20 31 2c 20 31 39 38 39 |.October| 1, 1989|
|00000400| 0d 23 0d 23 09 43 50 6c | 75 73 54 45 53 61 6d 70 |.#.#.CPl|usTESamp|
|00000410| 6c 65 20 69 73 20 61 6e | 20 65 78 61 6d 70 6c 65 |le is an| example|
|00000420| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 20 74 68 61 | applica|tion tha|
|00000430| 74 20 64 65 6d 6f 6e 73 | 74 72 61 74 65 73 0d 23 |t demons|trates.#|
|00000440| 09 68 6f 77 20 74 6f 20 | 69 6e 69 74 69 61 6c 69 |.how to |initiali|
|00000450| 7a 65 20 74 68 65 20 63 | 6f 6d 6d 6f 6e 6c 79 20 |ze the c|ommonly |
|00000460| 75 73 65 64 20 74 6f 6f | 6c 62 6f 78 20 6d 61 6e |used too|lbox man|
|00000470| 61 67 65 72 73 2c 0d 23 | 09 6f 70 65 72 61 74 65 |agers,.#|.operate|
|00000480| 20 73 75 63 63 65 73 73 | 66 75 6c 6c 79 20 75 6e | success|fully un|
|00000490| 64 65 72 20 4d 75 6c 74 | 69 46 69 6e 64 65 72 2c |der Mult|iFinder,|
|000004a0| 20 68 61 6e 64 6c 65 20 | 64 65 73 6b 0d 23 09 61 | handle |desk.#.a|
|000004b0| 63 63 65 73 73 6f 72 69 | 65 73 20 61 6e 64 20 63 |ccessori|es and c|
|000004c0| 72 65 61 74 65 2c 20 67 | 72 6f 77 2c 20 61 6e 64 |reate, g|row, and|
|000004d0| 20 7a 6f 6f 6d 20 77 69 | 6e 64 6f 77 73 2e 20 54 | zoom wi|ndows. T|
|000004e0| 68 65 0d 23 09 66 75 6e | 64 61 6d 65 6e 74 61 6c |he.#.fun|damental|
|000004f0| 20 54 65 78 74 45 64 69 | 74 20 74 6f 6f 6c 62 6f | TextEdi|t toolbo|
|00000500| 78 20 63 61 6c 6c 73 20 | 61 6e 64 20 54 65 78 74 |x calls |and Text|
|00000510| 45 64 69 74 20 61 75 74 | 6f 73 63 72 6f 6c 6c 0d |Edit aut|oscroll.|
|00000520| 23 09 61 72 65 20 64 65 | 6d 6f 6e 73 74 72 61 74 |#.are de|monstrat|
|00000530| 65 64 2e 20 49 74 20 61 | 6c 73 6f 20 73 68 6f 77 |ed. It a|lso show|
|00000540| 73 20 68 6f 77 20 74 6f | 20 63 72 65 61 74 65 20 |s how to| create |
|00000550| 61 6e 64 20 6d 61 69 6e | 74 61 69 6e 0d 23 09 73 |and main|tain.#.s|
|00000560| 63 72 6f 6c 6c 62 61 72 | 20 63 6f 6e 74 72 6f 6c |crollbar| control|
|00000570| 73 2e 20 0d 23 0d 23 09 | 54 68 69 73 20 76 65 72 |s. .#.#.|This ver|
|00000580| 73 69 6f 6e 20 6f 66 20 | 54 45 53 61 6d 70 6c 65 |sion of |TESample|
|00000590| 20 68 61 73 20 62 65 65 | 6e 20 73 75 62 73 74 61 | has bee|n substa|
|000005a0| 6e 74 69 61 6c 6c 79 20 | 72 65 77 6f 72 6b 65 64 |ntially |reworked|
|000005b0| 20 69 6e 0d 23 09 43 2b | 2b 20 74 6f 20 73 68 6f | in.#.C+|+ to sho|
|000005c0| 77 20 68 6f 77 20 61 20 | 22 74 79 70 69 63 61 6c |w how a |"typical|
|000005d0| 22 20 6f 62 6a 65 63 74 | 20 6f 72 69 65 6e 74 65 |" object| oriente|
|000005e0| 64 20 70 72 6f 67 72 61 | 6d 20 63 6f 75 6c 64 0d |d progra|m could.|
|000005f0| 23 09 62 65 20 77 72 69 | 74 74 65 6e 2e 20 54 6f |#.be wri|tten. To|
|00000600| 20 74 68 69 73 20 65 6e | 64 2c 20 77 68 61 74 20 | this en|d, what |
|00000610| 77 61 73 20 6f 6e 63 65 | 20 61 20 73 69 6e 67 6c |was once| a singl|
|00000620| 65 20 73 6f 75 72 63 65 | 20 63 6f 64 65 0d 23 09 |e source| code.#.|
|00000630| 66 69 6c 65 20 68 61 73 | 20 62 65 65 6e 20 72 65 |file has| been re|
|00000640| 73 74 72 75 63 74 75 72 | 65 64 20 69 6e 74 6f 20 |structur|ed into |
|00000650| 61 20 73 65 74 20 6f 66 | 20 63 6c 61 73 73 65 73 |a set of| classes|
|00000660| 20 77 68 69 63 68 0d 23 | 09 64 65 6d 6f 6e 73 74 | which.#|.demonst|
|00000670| 72 61 74 65 20 74 68 65 | 20 61 64 76 61 6e 74 61 |rate the| advanta|
|00000680| 67 65 73 20 6f 66 20 6f | 62 6a 65 63 74 2d 6f 72 |ges of o|bject-or|
|00000690| 69 65 6e 74 65 64 20 70 | 72 6f 67 72 61 6d 6d 69 |iented p|rogrammi|
|000006a0| 6e 67 2e 0d 23 0d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |ng..#.--|--------|
|000006b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000006c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000006d0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000006e0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000006f0| 2d 2d 2d 2d 2a 2f 0d 0d | 0d 2f 2a 0d 53 65 67 6d |----*/..|./*.Segm|
|00000700| 65 6e 74 61 74 69 6f 6e | 20 73 74 72 61 74 65 67 |entation| strateg|
|00000710| 79 3a 0d 0d 20 20 20 20 | 54 68 69 73 20 70 72 6f |y:.. |This pro|
|00000720| 67 72 61 6d 20 68 61 73 | 20 6f 6e 6c 79 20 6f 6e |gram has| only on|
|00000730| 65 20 73 65 67 6d 65 6e | 74 2c 20 73 69 6e 63 65 |e segmen|t, since|
|00000740| 20 74 68 65 20 69 73 73 | 75 65 73 0d 20 20 20 20 | the iss|ues. |
|00000750| 73 75 72 72 6f 75 6e 64 | 69 6e 67 20 73 65 67 6d |surround|ing segm|
|00000760| 65 6e 74 61 74 69 6f 6e | 20 77 69 74 68 69 6e 20 |entation| within |
|00000770| 61 20 63 6c 61 73 73 27 | 73 20 6d 65 74 68 6f 64 |a class'|s method|
|00000780| 73 20 68 61 76 65 0d 20 | 20 20 20 6e 6f 74 20 62 |s have. | not b|
|00000790| 65 65 6e 20 69 6e 76 65 | 73 74 69 67 61 74 65 64 |een inve|stigated|
|000007a0| 20 79 65 74 2e 20 57 65 | 20 44 4f 20 75 6e 6c 6f | yet. We| DO unlo|
|000007b0| 61 64 20 74 68 65 20 64 | 61 74 61 0d 20 20 20 20 |ad the d|ata. |
|000007c0| 69 6e 69 74 69 61 6c 69 | 7a 61 74 69 6f 6e 20 73 |initiali|zation s|
|000007d0| 65 67 6d 65 6e 74 20 61 | 74 20 73 74 61 72 74 75 |egment a|t startu|
|000007e0| 70 20 74 69 6d 65 2c 20 | 77 68 69 63 68 20 66 72 |p time, |which fr|
|000007f0| 65 65 73 20 75 70 0d 20 | 20 20 20 73 6f 6d 65 20 |ees up. | some |
|00000800| 6d 65 6d 6f 72 79 20 0d | 0d 53 65 74 50 6f 72 74 |memory .|.SetPort|
|00000810| 20 73 74 72 61 74 65 67 | 79 3a 0d 0d 20 20 20 20 | strateg|y:.. |
|00000820| 54 6f 6f 6c 62 6f 78 20 | 72 6f 75 74 69 6e 65 73 |Toolbox |routines|
|00000830| 20 64 6f 20 6e 6f 74 20 | 63 68 61 6e 67 65 20 74 | do not |change t|
|00000840| 68 65 20 63 75 72 72 65 | 6e 74 20 70 6f 72 74 2e |he curre|nt port.|
|00000850| 20 49 6e 0d 20 20 20 20 | 73 70 69 74 65 20 6f 66 | In. |spite of|
|00000860| 20 74 68 69 73 2c 20 69 | 6e 20 74 68 69 73 20 70 | this, i|n this p|
|00000870| 72 6f 67 72 61 6d 20 77 | 65 20 75 73 65 20 61 20 |rogram w|e use a |
|00000880| 73 74 72 61 74 65 67 79 | 20 6f 66 0d 20 20 20 20 |strategy| of. |
|00000890| 63 61 6c 6c 69 6e 67 20 | 53 65 74 50 6f 72 74 20 |calling |SetPort |
|000008a0| 77 68 65 6e 65 76 65 72 | 20 77 65 20 77 61 6e 74 |whenever| we want|
|000008b0| 20 74 6f 20 64 72 61 77 | 20 6f 72 20 6d 61 6b 65 | to draw| or make|
|000008c0| 20 63 61 6c 6c 73 0d 20 | 20 20 20 77 68 69 63 68 | calls. | which|
|000008d0| 20 64 65 70 65 6e 64 20 | 6f 6e 20 74 68 65 20 63 | depend |on the c|
|000008e0| 75 72 72 65 6e 74 20 70 | 6f 72 74 2e 20 54 68 69 |urrent p|ort. Thi|
|000008f0| 73 20 6d 61 6b 65 73 20 | 75 73 20 6c 65 73 73 0d |s makes |us less.|
|00000900| 20 20 20 20 76 75 6c 6e | 65 72 61 62 6c 65 20 74 | vuln|erable t|
|00000910| 6f 20 62 75 67 73 20 69 | 6e 20 6f 74 68 65 72 20 |o bugs i|n other |
|00000920| 73 6f 66 74 77 61 72 65 | 20 77 68 69 63 68 20 6d |software| which m|
|00000930| 69 67 68 74 20 61 6c 74 | 65 72 0d 20 20 20 20 74 |ight alt|er. t|
|00000940| 68 65 20 63 75 72 72 65 | 6e 74 20 70 6f 72 74 20 |he curre|nt port |
|00000950| 28 73 75 63 68 20 61 73 | 20 74 68 65 20 62 75 67 |(such as| the bug|
|00000960| 20 28 66 65 61 74 75 72 | 65 3f 29 20 69 6e 20 6d | (featur|e?) in m|
|00000970| 61 6e 79 0d 20 20 20 20 | 64 65 73 6b 20 61 63 63 |any. |desk acc|
|00000980| 65 73 73 6f 72 69 65 73 | 20 77 68 69 63 68 20 63 |essories| which c|
|00000990| 68 61 6e 67 65 20 74 68 | 65 20 70 6f 72 74 20 6f |hange th|e port o|
|000009a0| 6e 20 4f 70 65 6e 44 65 | 73 6b 41 63 63 29 2e 0d |n OpenDe|skAcc)..|
|000009b0| 20 20 20 20 48 6f 70 65 | 66 75 6c 6c 79 2c 20 74 | Hope|fully, t|
|000009c0| 68 69 73 20 61 6c 73 6f | 20 6d 61 6b 65 73 20 74 |his also| makes t|
|000009d0| 68 65 20 72 6f 75 74 69 | 6e 65 73 20 66 72 6f 6d |he routi|nes from|
|000009e0| 20 74 68 69 73 0d 20 20 | 20 20 70 72 6f 67 72 61 | this. | progra|
|000009f0| 6d 20 6d 6f 72 65 20 73 | 65 6c 66 2d 63 6f 6e 74 |m more s|elf-cont|
|00000a00| 61 69 6e 65 64 2c 20 73 | 69 6e 63 65 20 74 68 65 |ained, s|ince the|
|00000a10| 79 20 64 6f 6e 27 74 20 | 64 65 70 65 6e 64 20 6f |y don't |depend o|
|00000a20| 6e 0d 20 20 20 20 74 68 | 65 20 63 75 72 72 65 6e |n. th|e curren|
|00000a30| 74 20 70 6f 72 74 20 73 | 65 74 74 69 6e 67 2e 20 |t port s|etting. |
|00000a40| 0d 0d 43 6c 69 70 62 6f | 61 72 64 20 73 74 72 61 |..Clipbo|ard stra|
|00000a50| 74 65 67 79 3a 0d 0d 20 | 20 20 20 54 68 69 73 20 |tegy:.. | This |
|00000a60| 70 72 6f 67 72 61 6d 20 | 64 6f 65 73 20 6e 6f 74 |program |does not|
|00000a70| 20 6d 61 69 6e 74 61 69 | 6e 20 61 20 70 72 69 76 | maintai|n a priv|
|00000a80| 61 74 65 20 73 63 72 61 | 70 2e 0d 20 20 20 20 57 |ate scra|p.. W|
|00000a90| 68 65 6e 65 76 65 72 20 | 61 20 63 75 74 2c 20 63 |henever |a cut, c|
|00000aa0| 6f 70 79 2c 20 6f 72 20 | 70 61 73 74 65 20 6f 63 |opy, or |paste oc|
|00000ab0| 63 75 72 73 2c 20 77 65 | 20 69 6d 70 6f 72 74 2f |curs, we| import/|
|00000ac0| 65 78 70 6f 72 74 0d 20 | 20 20 20 66 72 6f 6d 20 |export. | from |
|00000ad0| 74 68 65 20 70 75 62 6c | 69 63 20 73 63 72 61 70 |the publ|ic scrap|
|00000ae0| 20 74 6f 20 54 65 78 74 | 45 64 69 74 27 73 20 73 | to Text|Edit's s|
|00000af0| 63 72 61 70 20 72 69 67 | 68 74 20 61 77 61 79 2c |crap rig|ht away,|
|00000b00| 0d 20 20 20 20 75 73 69 | 6e 67 20 74 68 65 20 54 |. usi|ng the T|
|00000b10| 45 54 6f 53 63 72 61 70 | 20 61 6e 64 20 54 45 46 |EToScrap| and TEF|
|00000b20| 72 6f 6d 53 63 72 61 70 | 20 72 6f 75 74 69 6e 65 |romScrap| routine|
|00000b30| 73 2e 20 49 66 20 77 65 | 20 64 69 64 0d 20 20 20 |s. If we| did. |
|00000b40| 20 75 73 65 20 61 20 70 | 72 69 76 61 74 65 20 73 | use a p|rivate s|
|00000b50| 63 72 61 70 2c 20 74 68 | 65 20 69 6d 70 6f 72 74 |crap, th|e import|
|00000b60| 2f 65 78 70 6f 72 74 20 | 77 6f 75 6c 64 20 62 65 |/export |would be|
|00000b70| 20 69 6e 20 74 68 65 0d | 20 20 20 20 61 63 74 69 | in the.| acti|
|00000b80| 76 61 74 65 2f 64 65 61 | 63 74 69 76 61 74 65 20 |vate/dea|ctivate |
|00000b90| 65 76 65 6e 74 20 61 6e | 64 20 73 75 73 70 65 6e |event an|d suspen|
|00000ba0| 64 2f 72 65 73 75 6d 65 | 20 65 76 65 6e 74 0d 20 |d/resume| event. |
|00000bb0| 20 20 20 72 6f 75 74 69 | 6e 65 73 2e 20 0d 2a 2f | routi|nes. .*/|
|00000bc0| 0d 0d 23 69 6e 63 6c 75 | 64 65 20 3c 54 79 70 65 |..#inclu|de <Type|
|00000bd0| 73 2e 68 3e 0d 23 69 6e | 63 6c 75 64 65 20 3c 51 |s.h>.#in|clude <Q|
|00000be0| 75 69 63 6b 44 72 61 77 | 2e 68 3e 0d 23 69 6e 63 |uickDraw|.h>.#inc|
|00000bf0| 6c 75 64 65 20 3c 46 6f | 6e 74 73 2e 68 3e 0d 23 |lude <Fo|nts.h>.#|
|00000c00| 69 6e 63 6c 75 64 65 20 | 3c 45 76 65 6e 74 73 2e |include |<Events.|
|00000c10| 68 3e 0d 23 69 6e 63 6c | 75 64 65 20 3c 43 6f 6e |h>.#incl|ude <Con|
|00000c20| 74 72 6f 6c 73 2e 68 3e | 0d 23 69 6e 63 6c 75 64 |trols.h>|.#includ|
|00000c30| 65 20 3c 57 69 6e 64 6f | 77 73 2e 68 3e 0d 23 69 |e <Windo|ws.h>.#i|
|00000c40| 6e 63 6c 75 64 65 20 3c | 4d 65 6e 75 73 2e 68 3e |nclude <|Menus.h>|
|00000c50| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 54 65 78 74 45 |.#includ|e <TextE|
|00000c60| 64 69 74 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |dit.h>.#|include |
|00000c70| 3c 44 69 61 6c 6f 67 73 | 2e 68 3e 0d 23 69 6e 63 |<Dialogs|.h>.#inc|
|00000c80| 6c 75 64 65 20 3c 44 65 | 73 6b 2e 68 3e 0d 23 69 |lude <De|sk.h>.#i|
|00000c90| 6e 63 6c 75 64 65 20 3c | 53 63 72 61 70 2e 68 3e |nclude <|Scrap.h>|
|00000ca0| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 54 6f 6f 6c 55 |.#includ|e <ToolU|
|00000cb0| 74 69 6c 73 2e 68 3e 0d | 23 69 6e 63 6c 75 64 65 |tils.h>.|#include|
|00000cc0| 20 3c 4d 65 6d 6f 72 79 | 2e 68 3e 0d 23 69 6e 63 | <Memory|.h>.#inc|
|00000cd0| 6c 75 64 65 20 3c 53 65 | 67 4c 6f 61 64 2e 68 3e |lude <Se|gLoad.h>|
|00000ce0| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 46 69 6c 65 73 |.#includ|e <Files|
|00000cf0| 2e 68 3e 0d 23 69 6e 63 | 6c 75 64 65 20 3c 4f 53 |.h>.#inc|lude <OS|
|00000d00| 55 74 69 6c 73 2e 68 3e | 0d 23 69 6e 63 6c 75 64 |Utils.h>|.#includ|
|00000d10| 65 20 3c 54 72 61 70 73 | 2e 68 3e 0d 0d 2f 2f 20 |e <Traps|.h>..// |
|00000d20| 6f 75 72 20 63 6c 61 73 | 73 20 64 65 66 69 6e 69 |our clas|s defini|
|00000d30| 74 69 6f 6e 73 0d 23 69 | 6e 63 6c 75 64 65 20 22 |tions.#i|nclude "|
|00000d40| 54 45 44 6f 63 75 6d 65 | 6e 74 2e 68 22 0d 23 69 |TEDocume|nt.h".#i|
|00000d50| 6e 63 6c 75 64 65 20 22 | 54 45 53 61 6d 70 6c 65 |nclude "|TESample|
|00000d60| 2e 68 22 0d 0d 2f 2f 20 | 45 78 74 72 65 6d 65 4e |.h"..// |ExtremeN|
|00000d70| 65 67 20 61 6e 64 20 45 | 78 74 72 65 6d 65 50 6f |eg and E|xtremePo|
|00000d80| 73 20 61 72 65 20 75 73 | 65 64 20 74 6f 20 73 65 |s are us|ed to se|
|00000d90| 74 20 75 70 20 77 69 64 | 65 20 6f 70 65 6e 20 72 |t up wid|e open r|
|00000da0| 65 63 74 61 6e 67 6c 65 | 73 20 61 6e 64 20 72 65 |ectangle|s and re|
|00000db0| 67 69 6f 6e 73 2e 0d 63 | 6f 6e 73 74 20 73 68 6f |gions..c|onst sho|
|00000dc0| 72 74 20 6b 45 78 74 72 | 65 6d 65 4e 65 67 20 3d |rt kExtr|emeNeg =|
|00000dd0| 20 2d 33 32 37 36 38 3b | 0d 63 6f 6e 73 74 20 73 | -32768;|.const s|
|00000de0| 68 6f 72 74 20 6b 45 78 | 74 72 65 6d 65 50 6f 73 |hort kEx|tremePos|
|00000df0| 20 3d 20 33 32 37 36 37 | 20 2d 20 31 3b 20 2f 2f | = 32767| - 1; //|
|00000e00| 20 72 65 71 75 69 72 65 | 64 20 74 6f 20 61 64 64 | require|d to add|
|00000e10| 72 65 73 73 20 61 6e 20 | 6f 6c 64 20 72 65 67 69 |ress an |old regi|
|00000e20| 6f 6e 20 62 75 67 0d 0d | 2f 2f 20 6b 4d 61 78 4f |on bug..|// kMaxO|
|00000e30| 70 65 6e 44 6f 63 75 6d | 65 6e 74 73 20 69 73 20 |penDocum|ents is |
|00000e40| 75 73 65 64 20 74 6f 20 | 64 65 74 65 72 6d 69 6e |used to |determin|
|00000e50| 65 20 77 68 65 74 68 65 | 72 20 61 20 6e 65 77 20 |e whethe|r a new |
|00000e60| 64 6f 63 75 6d 65 6e 74 | 20 63 61 6e 20 62 65 20 |document| can be |
|00000e70| 6f 70 65 6e 65 64 0d 2f | 2f 20 6f 72 20 63 72 65 |opened./|/ or cre|
|00000e80| 61 74 65 64 2e 20 57 65 | 20 6b 65 65 70 20 74 72 |ated. We| keep tr|
|00000e90| 61 63 6b 20 6f 66 20 74 | 68 65 20 6e 75 6d 62 65 |ack of t|he numbe|
|00000ea0| 72 20 6f 66 20 6f 70 65 | 6e 20 64 6f 63 75 6d 65 |r of ope|n docume|
|00000eb0| 6e 74 73 2c 20 61 6e 64 | 20 64 69 73 61 62 6c 65 |nts, and| disable|
|00000ec0| 20 74 68 65 0d 2f 2f 20 | 6d 65 6e 75 20 69 74 65 | the.// |menu ite|
|00000ed0| 6d 73 20 74 68 61 74 20 | 63 72 65 61 74 65 20 61 |ms that |create a|
|00000ee0| 20 6e 65 77 20 64 6f 63 | 75 6d 65 6e 74 20 77 68 | new doc|ument wh|
|00000ef0| 65 6e 20 74 68 65 20 6d | 61 78 69 6d 75 6d 20 69 |en the m|aximum i|
|00000f00| 73 20 72 65 61 63 68 65 | 64 2e 20 49 66 20 74 68 |s reache|d. If th|
|00000f10| 65 0d 2f 2f 20 6e 75 6d | 62 65 72 20 6f 66 20 64 |e.// num|ber of d|
|00000f20| 6f 63 75 6d 65 6e 74 73 | 20 66 61 6c 6c 73 20 62 |ocuments| falls b|
|00000f30| 65 6c 6f 77 20 74 68 65 | 20 6d 61 78 69 6d 75 6d |elow the| maximum|
|00000f40| 2c 20 74 68 65 20 69 74 | 65 6d 73 20 61 72 65 20 |, the it|ems are |
|00000f50| 65 6e 61 62 6c 65 64 20 | 61 67 61 69 6e 2e 20 2a |enabled |again. *|
|00000f60| 2f 0d 63 6f 6e 73 74 20 | 73 68 6f 72 74 09 6b 4d |/.const |short.kM|
|00000f70| 61 78 4f 70 65 6e 44 6f | 63 75 6d 65 6e 74 73 20 |axOpenDo|cuments |
|00000f80| 3d 20 31 3b 0d 09 0d 2f | 2f 20 44 65 66 69 6e 65 |= 1;.../|/ Define|
|00000f90| 20 6d 61 78 20 61 6e 64 | 20 6d 69 6e 20 6d 61 63 | max and| min mac|
|00000fa0| 72 6f 73 20 66 6f 72 20 | 65 66 66 69 63 69 65 6e |ros for |efficien|
|00000fb0| 63 79 2e 0d 23 64 65 66 | 69 6e 65 20 6d 61 78 28 |cy..#def|ine max(|
|00000fc0| 61 2c 62 29 09 09 28 28 | 61 29 20 3e 20 28 62 29 |a,b)..((|a) > (b)|
|00000fd0| 20 3f 20 28 61 29 20 3a | 20 28 62 29 29 0d 23 64 | ? (a) :| (b)).#d|
|00000fe0| 65 66 69 6e 65 20 6d 69 | 6e 28 61 2c 62 29 09 09 |efine mi|n(a,b)..|
|00000ff0| 28 28 61 29 20 3c 20 28 | 62 29 20 3f 20 28 61 29 |((a) < (|b) ? (a)|
|00001000| 20 3a 20 28 62 29 29 0d | 0d 2f 2f 20 4f 75 72 20 | : (b)).|.// Our |
|00001010| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 6f 62 6a 65 |applicat|ion obje|
|00001020| 63 74 2c 20 69 6e 69 74 | 69 61 6c 69 7a 65 64 20 |ct, init|ialized |
|00001030| 69 6e 20 6d 61 69 6e 28 | 29 2e 20 57 65 20 6d 61 |in main(|). We ma|
|00001040| 6b 65 20 69 74 0d 2f 2f | 20 67 6c 6f 62 61 6c 20 |ke it.//| global |
|00001050| 73 6f 20 6f 75 72 20 66 | 75 6e 63 74 69 6f 6e 73 |so our f|unctions|
|00001060| 20 77 68 69 63 68 20 64 | 6f 6e 27 74 20 62 65 6c | which d|on't bel|
|00001070| 6f 6e 67 20 74 6f 20 61 | 6e 79 20 63 6c 61 73 73 |ong to a|ny class|
|00001080| 0d 2f 2f 20 63 61 6e 20 | 66 69 6e 64 20 74 68 65 |.// can |find the|
|00001090| 20 61 63 74 69 76 65 20 | 64 6f 63 75 6d 65 6e 74 | active |document|
|000010a0| 2e 0d 54 45 53 61 6d 70 | 6c 65 2a 20 67 54 68 65 |..TESamp|le* gThe|
|000010b0| 41 70 70 6c 69 63 61 74 | 69 6f 6e 3b 0d 0d 2f 2f |Applicat|ion;..//|
|000010c0| 20 6d 61 69 6e 20 69 73 | 20 74 68 65 20 65 6e 74 | main is| the ent|
|000010d0| 72 79 70 6f 69 6e 74 20 | 74 6f 20 74 68 65 20 70 |rypoint |to the p|
|000010e0| 72 6f 67 72 61 6d 0d 69 | 6e 74 20 6d 61 69 6e 28 |rogram.i|nt main(|
|000010f0| 29 0d 7b 0d 09 2f 2f 20 | 43 72 65 61 74 65 20 6f |).{..// |Create o|
|00001100| 75 72 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 20 6f |ur appli|cation o|
|00001110| 62 6a 65 63 74 2e 20 54 | 68 69 73 20 4d 55 53 54 |bject. T|his MUST|
|00001120| 20 62 65 20 74 68 65 20 | 46 49 52 53 54 20 74 68 | be the |FIRST th|
|00001130| 69 6e 67 0d 09 2f 2f 20 | 64 6f 6e 65 20 69 6e 20 |ing..// |done in |
|00001140| 6d 61 69 6e 28 29 2c 20 | 73 69 6e 63 65 20 69 74 |main(), |since it|
|00001150| 20 69 6e 69 74 69 61 6c | 69 7a 65 73 20 74 68 65 | initial|izes the|
|00001160| 20 54 6f 6f 6c 62 6f 78 | 20 66 6f 72 20 75 73 2e | Toolbox| for us.|
|00001170| 0d 09 67 54 68 65 41 70 | 70 6c 69 63 61 74 69 6f |..gTheAp|plicatio|
|00001180| 6e 20 3d 20 6e 65 77 20 | 54 45 53 61 6d 70 6c 65 |n = new |TESample|
|00001190| 3b 0d 09 2f 2f 20 53 74 | 61 72 74 20 6f 75 72 20 |;..// St|art our |
|000011a0| 6d 61 69 6e 20 65 76 65 | 6e 74 20 6c 6f 6f 70 20 |main eve|nt loop |
|000011b0| 72 75 6e 6e 69 6e 67 2e | 20 54 68 69 73 20 77 6f |running.| This wo|
|000011c0| 6e 27 74 20 72 65 74 75 | 72 6e 20 75 6e 74 69 6c |n't retu|rn until|
|000011d0| 20 75 73 65 72 20 71 75 | 69 74 73 0d 09 69 66 20 | user qu|its..if |
|000011e0| 28 67 54 68 65 41 70 70 | 6c 69 63 61 74 69 6f 6e |(gTheApp|lication|
|000011f0| 20 21 3d 20 6e 69 6c 29 | 09 0d 09 20 20 67 54 68 | != nil)|... gTh|
|00001200| 65 41 70 70 6c 69 63 61 | 74 69 6f 6e 2d 3e 45 76 |eApplica|tion->Ev|
|00001210| 65 6e 74 4c 6f 6f 70 28 | 29 3b 09 0d 09 0d 09 2f |entLoop(|);...../|
|00001220| 2f 20 57 65 20 61 6c 77 | 61 79 73 20 72 65 74 75 |/ We alw|ays retu|
|00001230| 72 6e 20 61 20 76 61 6c | 75 65 2c 20 6c 69 6b 65 |rn a val|ue, like|
|00001240| 20 67 6f 6f 64 20 6c 69 | 74 74 6c 65 20 41 4e 53 | good li|ttle ANS|
|00001250| 49 20 77 6f 72 73 68 69 | 70 70 65 72 73 0d 09 72 |I worshi|ppers..r|
|00001260| 65 74 75 72 6e 20 30 3b | 0d 7d 0d 0d 2f 2f 20 74 |eturn 0;|.}..// t|
|00001270| 68 65 20 63 6f 6e 73 74 | 72 75 63 74 6f 72 20 66 |he const|ructor f|
|00001280| 6f 72 20 6f 75 72 20 63 | 6c 61 73 73 2c 20 63 61 |or our c|lass, ca|
|00001290| 6c 6c 65 64 20 61 75 74 | 6f 6d 61 74 69 63 61 6c |lled aut|omatical|
|000012a0| 6c 79 20 77 68 65 6e 20 | 77 65 20 63 72 65 61 74 |ly when |we creat|
|000012b0| 65 0d 2f 2f 20 61 6e 20 | 69 6e 73 74 61 6e 63 65 |e.// an |instance|
|000012c0| 20 6f 66 20 74 68 69 73 | 20 63 6c 61 73 73 2e 20 | of this| class. |
|000012d0| 49 6e 20 74 68 69 73 20 | 70 61 72 74 69 63 75 6c |In this |particul|
|000012e0| 61 72 20 63 61 73 65 2c | 20 77 65 20 6f 6e 6c 79 |ar case,| we only|
|000012f0| 20 77 61 6e 74 0d 2f 2f | 20 6f 6e 65 20 69 6e 73 | want.//| one ins|
|00001300| 74 61 6e 63 65 20 73 69 | 6e 63 65 20 74 68 65 20 |tance si|nce the |
|00001310| 63 6f 6e 73 74 72 75 63 | 74 6f 72 20 64 6f 65 73 |construc|tor does|
|00001320| 20 61 6c 6c 20 74 68 65 | 20 6d 65 6e 75 20 73 65 | all the| menu se|
|00001330| 74 75 70 73 20 61 6e 64 | 0d 2f 2f 20 63 72 65 61 |tups and|.// crea|
|00001340| 74 65 73 20 6f 75 72 20 | 28 75 6e 74 69 74 6c 65 |tes our |(untitle|
|00001350| 64 29 20 64 6f 63 75 6d | 65 6e 74 2e 0d 54 45 53 |d) docum|ent..TES|
|00001360| 61 6d 70 6c 65 3a 3a 54 | 45 53 61 6d 70 6c 65 28 |ample::T|ESample(|
|00001370| 29 0d 7b 0d 09 48 61 6e | 64 6c 65 09 6d 65 6e 75 |).{..Han|dle.menu|
|00001380| 42 61 72 3b 0d 0d 09 2f | 2f 20 72 65 61 64 20 6d |Bar;.../|/ read m|
|00001390| 65 6e 75 73 20 69 6e 74 | 6f 20 6d 65 6e 75 20 62 |enus int|o menu b|
|000013a0| 61 72 0d 09 6d 65 6e 75 | 42 61 72 20 3d 20 47 65 |ar..menu|Bar = Ge|
|000013b0| 74 4e 65 77 4d 42 61 72 | 28 72 4d 65 6e 75 42 61 |tNewMBar|(rMenuBa|
|000013c0| 72 29 3b 0d 09 2f 2f 20 | 69 6e 73 74 61 6c 6c 20 |r);..// |install |
|000013d0| 6d 65 6e 75 73 0d 09 53 | 65 74 4d 65 6e 75 42 61 |menus..S|etMenuBa|
|000013e0| 72 28 6d 65 6e 75 42 61 | 72 29 3b 0d 09 44 69 73 |r(menuBa|r);..Dis|
|000013f0| 70 6f 73 48 61 6e 64 6c | 65 28 6d 65 6e 75 42 61 |posHandl|e(menuBa|
|00001400| 72 29 3b 0d 09 2f 2f 20 | 61 64 64 20 44 41 20 6e |r);..// |add DA n|
|00001410| 61 6d 65 73 20 74 6f 20 | 41 70 70 6c 65 20 6d 65 |ames to |Apple me|
|00001420| 6e 75 0d 09 41 64 64 52 | 65 73 4d 65 6e 75 28 47 |nu..AddR|esMenu(G|
|00001430| 65 74 4d 48 61 6e 64 6c | 65 28 6d 41 70 70 6c 65 |etMHandl|e(mApple|
|00001440| 29 2c 20 27 44 52 56 52 | 27 29 3b 0d 09 44 72 61 |), 'DRVR|');..Dra|
|00001450| 77 4d 65 6e 75 42 61 72 | 28 29 3b 0d 0d 09 2f 2f |wMenuBar|();...//|
|00001460| 20 63 72 65 61 74 65 20 | 65 6d 70 74 79 20 6d 6f | create |empty mo|
|00001470| 75 73 65 20 72 65 67 69 | 6f 6e 0d 09 66 4d 6f 75 |use regi|on..fMou|
|00001480| 73 65 52 67 6e 20 3d 20 | 4e 65 77 52 67 6e 28 29 |seRgn = |NewRgn()|
|00001490| 3b 0d 09 2f 2f 20 63 72 | 65 61 74 65 20 61 20 73 |;..// cr|eate a s|
|000014a0| 69 6e 67 6c 65 20 65 6d | 70 74 79 20 64 6f 63 75 |ingle em|pty docu|
|000014b0| 6d 65 6e 74 0d 09 44 6f | 4e 65 77 28 29 3b 0d 09 |ment..Do|New();..|
|000014c0| 2f 2f 20 6d 61 6b 65 20 | 73 75 72 65 20 77 65 20 |// make |sure we |
|000014d0| 68 61 76 65 20 61 20 76 | 61 6c 69 64 20 63 75 72 |have a v|alid cur|
|000014e0| 73 6f 72 20 72 65 67 69 | 6f 6e 0d 09 41 64 6a 75 |sor regi|on..Adju|
|000014f0| 73 74 43 75 72 73 6f 72 | 28 29 3b 0d 7d 0d 0d 2f |stCursor|();.}../|
|00001500| 2f 20 54 65 6c 6c 20 54 | 41 70 70 6c 69 63 61 74 |/ Tell T|Applicat|
|00001510| 69 6f 6e 20 63 6c 61 73 | 73 20 68 6f 77 20 6d 75 |ion clas|s how mu|
|00001520| 63 68 20 68 65 61 70 20 | 77 65 20 6e 65 65 64 0d |ch heap |we need.|
|00001530| 6c 6f 6e 67 20 54 45 53 | 61 6d 70 6c 65 3a 3a 48 |long TES|ample::H|
|00001540| 65 61 70 4e 65 65 64 65 | 64 28 29 0d 7b 0d 09 72 |eapNeede|d().{..r|
|00001550| 65 74 75 72 6e 20 28 6b | 4d 69 6e 53 69 7a 65 20 |eturn (k|MinSize |
|00001560| 2a 20 31 30 32 34 29 3b | 0d 7d 0d 0d 2f 2f 20 43 |* 1024);|.}..// C|
|00001570| 61 6c 63 75 6c 61 74 65 | 20 61 20 73 6c 65 65 70 |alculate| a sleep|
|00001580| 20 76 61 6c 75 65 20 66 | 6f 72 20 57 61 69 74 4e | value f|or WaitN|
|00001590| 65 78 74 45 76 65 6e 74 | 2e 20 54 68 69 73 20 74 |extEvent|. This t|
|000015a0| 61 6b 65 73 20 69 6e 74 | 6f 20 61 63 63 6f 75 6e |akes int|o accoun|
|000015b0| 74 20 74 68 65 20 74 68 | 69 6e 67 73 0d 2f 2f 20 |t the th|ings.// |
|000015c0| 74 68 61 74 20 44 6f 49 | 64 6c 65 20 64 6f 65 73 |that DoI|dle does|
|000015d0| 20 77 69 74 68 20 69 64 | 6c 65 20 74 69 6d 65 2e | with id|le time.|
|000015e0| 0d 0d 75 6e 73 69 67 6e | 65 64 20 6c 6f 6e 67 20 |..unsign|ed long |
|000015f0| 54 45 53 61 6d 70 6c 65 | 3a 3a 53 6c 65 65 70 56 |TESample|::SleepV|
|00001600| 61 6c 28 29 0d 7b 0d 09 | 75 6e 73 69 67 6e 65 64 |al().{..|unsigned|
|00001610| 20 6c 6f 6e 67 20 73 6c | 65 65 70 3b 0d 0d 09 73 | long sl|eep;...s|
|00001620| 6c 65 65 70 20 3d 20 6b | 4d 61 78 53 6c 65 65 70 |leep = k|MaxSleep|
|00001630| 54 69 6d 65 3b 09 09 09 | 09 2f 2f 20 64 65 66 61 |Time;...|.// defa|
|00001640| 75 6c 74 20 76 61 6c 75 | 65 20 66 6f 72 20 73 6c |ult valu|e for sl|
|00001650| 65 65 70 0d 09 2f 2f 20 | 69 66 20 77 65 20 61 72 |eep..// |if we ar|
|00001660| 65 6e 27 74 20 69 6e 20 | 62 61 63 6b 67 72 6f 75 |en't in |backgrou|
|00001670| 6e 64 2c 20 6c 65 74 20 | 64 6f 63 75 6d 65 6e 74 |nd, let |document|
|00001680| 20 74 65 6c 6c 20 75 73 | 20 68 6f 77 20 6c 6f 6e | tell us| how lon|
|00001690| 67 20 74 6f 20 73 6c 65 | 65 70 0d 09 69 66 20 28 |g to sle|ep..if (|
|000016a0| 28 21 66 49 6e 42 61 63 | 6b 67 72 6f 75 6e 64 29 |(!fInBac|kground)|
|000016b0| 20 26 26 20 28 66 43 75 | 72 44 6f 63 20 21 3d 20 | && (fCu|rDoc != |
|000016c0| 6e 69 6c 29 29 0d 09 20 | 20 73 6c 65 65 70 20 3d |nil)).. | sleep =|
|000016d0| 20 6d 69 6e 28 73 6c 65 | 65 70 2c 66 43 75 72 44 | min(sle|ep,fCurD|
|000016e0| 6f 63 2d 3e 43 61 6c 63 | 49 64 6c 65 28 29 29 3b |oc->Calc|Idle());|
|000016f0| 0d 09 72 65 74 75 72 6e | 20 73 6c 65 65 70 3b 0d |..return| sleep;.|
|00001700| 7d 0d 0d 2f 2f 20 54 68 | 69 73 20 69 73 20 63 61 |}..// Th|is is ca|
|00001710| 6c 6c 65 64 20 77 68 65 | 6e 65 76 65 72 20 77 65 |lled whe|never we|
|00001720| 20 67 65 74 20 61 20 6e | 75 6c 6c 20 65 76 65 6e | get a n|ull even|
|00001730| 74 20 65 74 20 61 6c 2e | 0d 2f 2f 20 49 74 20 74 |t et al.|.// It t|
|00001740| 61 6b 65 73 20 63 61 72 | 65 20 6f 66 20 6e 65 63 |akes car|e of nec|
|00001750| 65 73 73 61 72 79 20 70 | 65 72 69 6f 64 69 63 20 |essary p|eriodic |
|00001760| 61 63 74 69 6f 6e 73 2e | 20 46 6f 72 20 74 68 69 |actions.| For thi|
|00001770| 73 20 70 72 6f 67 72 61 | 6d 2c 0d 2f 2f 20 69 74 |s progra|m,.// it|
|00001780| 20 63 61 6c 6c 73 20 54 | 45 49 64 6c 65 2e 0d 0d | calls T|EIdle...|
|00001790| 76 6f 69 64 20 54 45 53 | 61 6d 70 6c 65 3a 3a 44 |void TES|ample::D|
|000017a0| 6f 49 64 6c 65 28 29 0d | 7b 0d 09 54 45 44 6f 63 |oIdle().|{..TEDoc|
|000017b0| 75 6d 65 6e 74 2a 20 66 | 54 45 43 75 72 44 6f 63 |ument* f|TECurDoc|
|000017c0| 20 3d 20 28 54 45 44 6f | 63 75 6d 65 6e 74 2a 29 | = (TEDo|cument*)|
|000017d0| 20 66 43 75 72 44 6f 63 | 3b 0d 0d 09 69 66 20 28 | fCurDoc|;...if (|
|000017e0| 20 66 54 45 43 75 72 44 | 6f 63 20 21 3d 20 6e 69 | fTECurD|oc != ni|
|000017f0| 6c 20 29 0d 09 20 20 66 | 54 45 43 75 72 44 6f 63 |l ).. f|TECurDoc|
|00001800| 2d 3e 44 6f 49 64 6c 65 | 28 29 3b 0d 7d 20 2f 2f |->DoIdle|();.} //|
|00001810| 20 44 6f 49 64 6c 65 0d | 0d 2f 2f 20 43 68 61 6e | DoIdle.|.// Chan|
|00001820| 67 65 20 74 68 65 20 63 | 75 72 73 6f 72 27 73 20 |ge the c|ursor's |
|00001830| 73 68 61 70 65 2c 20 64 | 65 70 65 6e 64 69 6e 67 |shape, d|epending|
|00001840| 20 6f 6e 20 69 74 73 20 | 70 6f 73 69 74 69 6f 6e | on its |position|
|00001850| 2e 20 54 68 69 73 20 61 | 6c 73 6f 20 63 61 6c 63 |. This a|lso calc|
|00001860| 75 6c 61 74 65 73 20 61 | 0d 2f 2f 20 72 65 67 69 |ulates a|.// regi|
|00001870| 6f 6e 20 74 68 61 74 20 | 69 6e 63 6c 75 64 65 73 |on that |includes|
|00001880| 20 74 68 65 20 63 75 72 | 73 6f 72 20 66 6f 72 20 | the cur|sor for |
|00001890| 57 61 69 74 4e 65 78 74 | 45 76 65 6e 74 2e 0d 0d |WaitNext|Event...|
|000018a0| 76 6f 69 64 20 54 45 53 | 61 6d 70 6c 65 3a 3a 41 |void TES|ample::A|
|000018b0| 64 6a 75 73 74 43 75 72 | 73 6f 72 28 29 0d 7b 0d |djustCur|sor().{.|
|000018c0| 09 54 45 44 6f 63 75 6d | 65 6e 74 2a 20 66 54 45 |.TEDocum|ent* fTE|
|000018d0| 43 75 72 44 6f 63 20 3d | 20 28 54 45 44 6f 63 75 |CurDoc =| (TEDocu|
|000018e0| 6d 65 6e 74 2a 29 20 66 | 43 75 72 44 6f 63 3b 0d |ment*) f|CurDoc;.|
|000018f0| 0d 09 2f 2f 20 6e 6f 74 | 69 63 65 20 74 68 61 74 |..// not|ice that|
|00001900| 20 77 65 20 64 6f 6e 27 | 74 20 63 68 61 6e 67 65 | we don'|t change|
|00001910| 20 63 75 72 73 6f 72 20 | 69 66 20 66 72 6f 6e 74 | cursor |if front|
|00001920| 20 77 69 6e 64 6f 77 20 | 69 73 6e 27 74 20 6f 75 | window |isn't ou|
|00001930| 72 73 0d 09 69 66 20 28 | 20 28 21 66 49 6e 42 61 |rs..if (| (!fInBa|
|00001940| 63 6b 67 72 6f 75 6e 64 | 29 20 26 26 20 28 66 54 |ckground|) && (fT|
|00001950| 45 43 75 72 44 6f 63 20 | 21 3d 20 6e 69 6c 29 20 |ECurDoc |!= nil) |
|00001960| 29 0d 09 20 20 7b 0d 09 | 09 52 67 6e 48 61 6e 64 |).. {..|.RgnHand|
|00001970| 6c 65 09 61 72 72 6f 77 | 52 67 6e 3b 0d 09 09 52 |le.arrow|Rgn;...R|
|00001980| 67 6e 48 61 6e 64 6c 65 | 09 69 42 65 61 6d 52 67 |gnHandle|.iBeamRg|
|00001990| 6e 3b 0d 09 09 50 6f 69 | 6e 74 09 09 6d 6f 75 73 |n;...Poi|nt..mous|
|000019a0| 65 3b 0d 09 09 0d 09 09 | 2f 2f 20 67 65 74 20 6d |e;......|// get m|
|000019b0| 6f 75 73 65 20 6c 6f 63 | 61 74 69 6f 6e 20 61 6e |ouse loc|ation an|
|000019c0| 64 20 63 6f 6e 76 65 72 | 74 20 74 6f 20 67 6c 6f |d conver|t to glo|
|000019d0| 62 61 6c 20 63 6f 6f 72 | 64 69 6e 61 74 65 73 0d |bal coor|dinates.|
|000019e0| 09 09 47 65 74 4d 6f 75 | 73 65 28 26 6d 6f 75 73 |..GetMou|se(&mous|
|000019f0| 65 29 3b 0d 09 09 4c 6f | 63 61 6c 54 6f 47 6c 6f |e);...Lo|calToGlo|
|00001a00| 62 61 6c 28 26 6d 6f 75 | 73 65 29 3b 0d 0d 09 09 |bal(&mou|se);....|
|00001a10| 2f 2f 20 63 61 6c 63 75 | 6c 61 74 65 20 72 65 67 |// calcu|late reg|
|00001a20| 69 6f 6e 73 20 66 6f 72 | 20 64 69 66 66 65 72 65 |ions for| differe|
|00001a30| 6e 74 20 63 75 72 73 6f | 72 20 73 68 61 70 65 73 |nt curso|r shapes|
|00001a40| 0d 09 09 61 72 72 6f 77 | 52 67 6e 20 3d 20 4e 65 |...arrow|Rgn = Ne|
|00001a50| 77 52 67 6e 28 29 3b 0d | 09 09 69 42 65 61 6d 52 |wRgn();.|..iBeamR|
|00001a60| 67 6e 20 3d 20 4e 65 77 | 52 67 6e 28 29 3b 0d 09 |gn = New|Rgn();..|
|00001a70| 09 2f 2f 20 73 74 61 72 | 74 20 61 72 72 6f 77 52 |.// star|t arrowR|
|00001a80| 67 6e 20 77 69 64 65 20 | 6f 70 65 6e 0d 09 09 53 |gn wide |open...S|
|00001a90| 65 74 52 65 63 74 52 67 | 6e 28 61 72 72 6f 77 52 |etRectRg|n(arrowR|
|00001aa0| 67 6e 2c 20 6b 45 78 74 | 72 65 6d 65 4e 65 67 2c |gn, kExt|remeNeg,|
|00001ab0| 20 6b 45 78 74 72 65 6d | 65 4e 65 67 2c 20 6b 45 | kExtrem|eNeg, kE|
|00001ac0| 78 74 72 65 6d 65 50 6f | 73 2c 20 6b 45 78 74 72 |xtremePo|s, kExtr|
|00001ad0| 65 6d 65 50 6f 73 29 3b | 0d 09 09 2f 2f 20 63 61 |emePos);|...// ca|
|00001ae0| 6c 63 75 6c 61 74 65 20 | 69 42 65 61 6d 52 67 6e |lculate |iBeamRgn|
|00001af0| 0d 09 09 66 54 45 43 75 | 72 44 6f 63 2d 3e 47 65 |...fTECu|rDoc->Ge|
|00001b00| 74 56 69 73 54 45 52 67 | 6e 28 69 42 65 61 6d 52 |tVisTERg|n(iBeamR|
|00001b10| 67 6e 29 3b 0d 09 09 2f | 2f 20 73 75 62 74 72 61 |gn);.../|/ subtra|
|00001b20| 63 74 20 69 42 65 61 6d | 52 67 6e 20 66 72 6f 6d |ct iBeam|Rgn from|
|00001b30| 20 61 72 72 6f 77 52 67 | 6e 20 0d 09 09 44 69 66 | arrowRg|n ...Dif|
|00001b40| 66 52 67 6e 28 61 72 72 | 6f 77 52 67 6e 2c 20 69 |fRgn(arr|owRgn, i|
|00001b50| 42 65 61 6d 52 67 6e 2c | 20 61 72 72 6f 77 52 67 |BeamRgn,| arrowRg|
|00001b60| 6e 29 3b 0d 0d 09 09 2f | 2f 20 63 68 61 6e 67 65 |n);..../|/ change|
|00001b70| 20 74 68 65 20 63 75 72 | 73 6f 72 20 61 6e 64 20 | the cur|sor and |
|00001b80| 74 68 65 20 72 65 67 69 | 6f 6e 20 70 61 72 61 6d |the regi|on param|
|00001b90| 65 74 65 72 20 0d 09 09 | 69 66 20 28 50 74 49 6e |eter ...|if (PtIn|
|00001ba0| 52 67 6e 28 6d 6f 75 73 | 65 2c 20 69 42 65 61 6d |Rgn(mous|e, iBeam|
|00001bb0| 52 67 6e 29 29 0d 09 09 | 20 20 7b 0d 09 09 09 53 |Rgn))...| {....S|
|00001bc0| 65 74 43 75 72 73 6f 72 | 28 2a 47 65 74 43 75 72 |etCursor|(*GetCur|
|00001bd0| 73 6f 72 28 69 42 65 61 | 6d 43 75 72 73 6f 72 29 |sor(iBea|mCursor)|
|00001be0| 29 3b 0d 09 09 09 43 6f | 70 79 52 67 6e 28 69 42 |);....Co|pyRgn(iB|
|00001bf0| 65 61 6d 52 67 6e 2c 20 | 66 4d 6f 75 73 65 52 67 |eamRgn, |fMouseRg|
|00001c00| 6e 29 3b 0d 09 09 20 20 | 7d 0d 09 09 65 6c 73 65 |n);... |}...else|
|00001c10| 0d 09 09 20 20 7b 0d 09 | 09 09 53 65 74 43 75 72 |... {..|..SetCur|
|00001c20| 73 6f 72 28 26 71 64 2e | 61 72 72 6f 77 29 3b 0d |sor(&qd.|arrow);.|
|00001c30| 09 09 09 43 6f 70 79 52 | 67 6e 28 61 72 72 6f 77 |...CopyR|gn(arrow|
|00001c40| 52 67 6e 2c 20 66 4d 6f | 75 73 65 52 67 6e 29 3b |Rgn, fMo|useRgn);|
|00001c50| 0d 09 09 20 20 7d 0d 09 | 09 2f 2f 20 67 65 74 20 |... }..|.// get |
|00001c60| 72 69 64 20 6f 66 20 72 | 65 67 69 6f 6e 73 20 77 |rid of r|egions w|
|00001c70| 65 20 64 6f 6e 27 74 20 | 6e 65 65 64 20 61 6e 79 |e don't |need any|
|00001c80| 6d 6f 72 65 0d 09 09 44 | 69 73 70 6f 73 65 52 67 |more...D|isposeRg|
|00001c90| 6e 28 61 72 72 6f 77 52 | 67 6e 29 3b 0d 09 09 44 |n(arrowR|gn);...D|
|00001ca0| 69 73 70 6f 73 65 52 67 | 6e 28 69 42 65 61 6d 52 |isposeRg|n(iBeamR|
|00001cb0| 67 6e 29 3b 0d 09 20 20 | 7d 0d 7d 20 2f 2f 20 41 |gn);.. |}.} // A|
|00001cc0| 64 6a 75 73 74 43 75 72 | 73 6f 72 0d 0d 2f 2f 20 |djustCur|sor..// |
|00001cd0| 45 6e 61 62 6c 65 20 61 | 6e 64 20 64 69 73 61 62 |Enable a|nd disab|
|00001ce0| 6c 65 20 6d 65 6e 75 73 | 20 62 61 73 65 64 20 6f |le menus| based o|
|00001cf0| 6e 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 73 74 |n the cu|rrent st|
|00001d00| 61 74 65 2e 20 54 68 65 | 0d 2f 2f 20 75 73 65 72 |ate. The|.// user|
|00001d10| 20 63 61 6e 20 6f 6e 6c | 79 20 73 65 6c 65 63 74 | can onl|y select|
|00001d20| 20 65 6e 61 62 6c 65 64 | 20 6d 65 6e 75 20 69 74 | enabled| menu it|
|00001d30| 65 6d 73 2e 20 57 65 20 | 73 65 74 20 75 70 20 61 |ems. We |set up a|
|00001d40| 6c 6c 20 74 68 65 0d 2f | 2f 20 6d 65 6e 75 20 69 |ll the./|/ menu i|
|00001d50| 74 65 6d 73 20 62 65 66 | 6f 72 65 20 63 61 6c 6c |tems bef|ore call|
|00001d60| 69 6e 67 20 4d 65 6e 75 | 53 65 6c 65 63 74 20 6f |ing Menu|Select o|
|00001d70| 72 20 4d 65 6e 75 4b 65 | 79 2c 20 73 69 6e 63 65 |r MenuKe|y, since|
|00001d80| 0d 2f 2f 20 74 68 65 73 | 65 20 61 72 65 20 74 68 |.// thes|e are th|
|00001d90| 65 20 6f 6e 6c 79 20 74 | 69 6d 65 73 20 74 68 61 |e only t|imes tha|
|00001da0| 74 20 61 20 6d 65 6e 75 | 20 69 74 65 6d 20 63 61 |t a menu| item ca|
|00001db0| 6e 20 62 65 20 73 65 6c | 65 63 74 65 64 2e 0d 2f |n be sel|ected../|
|00001dc0| 2f 20 4e 6f 74 65 20 74 | 68 61 74 20 4d 65 6e 75 |/ Note t|hat Menu|
|00001dd0| 53 65 6c 65 63 74 20 69 | 73 20 61 6c 73 6f 20 74 |Select i|s also t|
|00001de0| 68 65 20 6f 6e 6c 79 20 | 74 69 6d 65 20 74 68 65 |he only |time the|
|00001df0| 20 75 73 65 72 20 77 69 | 6c 6c 0d 2f 2f 20 73 65 | user wi|ll.// se|
|00001e00| 65 20 6d 65 6e 75 20 69 | 74 65 6d 73 2e 20 54 68 |e menu i|tems. Th|
|00001e10| 69 73 20 61 70 70 72 6f | 61 63 68 20 74 6f 20 64 |is appro|ach to d|
|00001e20| 65 63 69 64 69 6e 67 20 | 77 68 61 74 20 65 6e 61 |eciding |what ena|
|00001e30| 62 6c 65 2f 0d 2f 2f 20 | 64 69 73 61 62 6c 65 20 |ble/.// |disable |
|00001e40| 73 74 61 74 65 20 61 20 | 6d 65 6e 75 20 69 74 65 |state a |menu ite|
|00001e50| 6d 20 68 61 73 20 74 68 | 65 20 61 64 76 61 6e 74 |m has th|e advant|
|00001e60| 61 67 65 20 6f 66 0d 2f | 2f 20 63 6f 6e 63 65 6e |age of./|/ concen|
|00001e70| 74 72 61 74 69 6e 67 20 | 61 6c 6c 20 74 68 65 20 |trating |all the |
|00001e80| 64 65 63 69 73 69 6f 6e | 2d 6d 61 6b 69 6e 67 20 |decision|-making |
|00001e90| 69 6e 20 6f 6e 65 20 72 | 6f 75 74 69 6e 65 2c 20 |in one r|outine, |
|00001ea0| 61 73 0d 2f 2f 20 6f 70 | 70 6f 73 65 64 20 74 6f |as.// op|posed to|
|00001eb0| 20 62 65 69 6e 67 20 73 | 70 72 65 61 64 20 74 68 | being s|pread th|
|00001ec0| 72 6f 75 67 68 6f 75 74 | 20 74 68 65 20 61 70 70 |roughout| the app|
|00001ed0| 6c 69 63 61 74 69 6f 6e | 2e 20 4f 74 68 65 72 0d |lication|. Other.|
|00001ee0| 2f 2f 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 20 64 |// appli|cation d|
|00001ef0| 65 73 69 67 6e 73 20 6d | 61 79 20 74 61 6b 65 20 |esigns m|ay take |
|00001f00| 61 20 64 69 66 66 65 72 | 65 6e 74 20 61 70 70 72 |a differ|ent appr|
|00001f10| 6f 61 63 68 20 74 68 61 | 74 20 6d 61 79 0d 2f 2f |oach tha|t may.//|
|00001f20| 20 6f 72 20 6d 61 79 20 | 6e 6f 74 20 62 65 20 61 | or may |not be a|
|00001f30| 73 20 76 61 6c 69 64 2e | 20 0d 0d 76 6f 69 64 20 |s valid.| ..void |
|00001f40| 54 45 53 61 6d 70 6c 65 | 3a 3a 41 64 6a 75 73 74 |TESample|::Adjust|
|00001f50| 4d 65 6e 75 73 28 29 0d | 7b 0d 09 57 69 6e 64 6f |Menus().|{..Windo|
|00001f60| 77 50 74 72 09 66 72 6f | 6e 74 6d 6f 73 74 3b 0d |wPtr.fro|ntmost;.|
|00001f70| 09 4d 65 6e 75 48 61 6e | 64 6c 65 09 6d 65 6e 75 |.MenuHan|dle.menu|
|00001f80| 3b 0d 09 6c 6f 6e 67 09 | 09 6f 66 66 73 65 74 3b |;..long.|.offset;|
|00001f90| 0d 09 42 6f 6f 6c 65 61 | 6e 09 09 75 6e 64 6f 3b |..Boolea|n..undo;|
|00001fa0| 0d 09 42 6f 6f 6c 65 61 | 6e 09 09 63 75 74 43 6f |..Boolea|n..cutCo|
|00001fb0| 70 79 43 6c 65 61 72 3b | 0d 09 42 6f 6f 6c 65 61 |pyClear;|..Boolea|
|00001fc0| 6e 09 09 70 61 73 74 65 | 3b 0d 09 54 45 44 6f 63 |n..paste|;..TEDoc|
|00001fd0| 75 6d 65 6e 74 2a 20 66 | 54 45 43 75 72 44 6f 63 |ument* f|TECurDoc|
|00001fe0| 20 3d 20 28 54 45 44 6f | 63 75 6d 65 6e 74 2a 29 | = (TEDo|cument*)|
|00001ff0| 20 66 43 75 72 44 6f 63 | 3b 0d 0d 09 66 72 6f 6e | fCurDoc|;...fron|
|00002000| 74 6d 6f 73 74 20 3d 20 | 46 72 6f 6e 74 57 69 6e |tmost = |FrontWin|
|00002010| 64 6f 77 28 29 3b 0d 0d | 09 6d 65 6e 75 20 3d 20 |dow();..|.menu = |
|00002020| 47 65 74 4d 48 61 6e 64 | 6c 65 28 6d 46 69 6c 65 |GetMHand|le(mFile|
|00002030| 29 3b 0d 09 69 66 20 28 | 20 66 44 6f 63 4c 69 73 |);..if (| fDocLis|
|00002040| 74 2d 3e 4e 75 6d 44 6f | 63 73 28 29 20 3c 20 6b |t->NumDo|cs() < k|
|00002050| 4d 61 78 4f 70 65 6e 44 | 6f 63 75 6d 65 6e 74 73 |MaxOpenD|ocuments|
|00002060| 20 29 0d 09 20 20 45 6e | 61 62 6c 65 49 74 65 6d | ).. En|ableItem|
|00002070| 28 6d 65 6e 75 2c 20 69 | 4e 65 77 29 3b 09 09 09 |(menu, i|New);...|
|00002080| 2f 2f 20 4e 65 77 20 69 | 73 20 65 6e 61 62 6c 65 |// New i|s enable|
|00002090| 64 20 77 68 65 6e 20 77 | 65 20 63 61 6e 20 6f 70 |d when w|e can op|
|000020a0| 65 6e 20 6d 6f 72 65 20 | 64 6f 63 75 6d 65 6e 74 |en more |document|
|000020b0| 73 20 0d 09 65 6c 73 65 | 20 44 69 73 61 62 6c 65 |s ..else| Disable|
|000020c0| 49 74 65 6d 28 6d 65 6e | 75 2c 20 69 4e 65 77 29 |Item(men|u, iNew)|
|000020d0| 3b 0d 09 69 66 20 28 20 | 66 72 6f 6e 74 6d 6f 73 |;..if ( |frontmos|
|000020e0| 74 20 21 3d 20 28 57 69 | 6e 64 6f 77 50 74 72 29 |t != (Wi|ndowPtr)|
|000020f0| 20 6e 69 6c 20 29 09 2f | 2f 20 43 6c 6f 73 65 20 | nil )./|/ Close |
|00002100| 69 73 20 65 6e 61 62 6c | 65 64 20 77 68 65 6e 20 |is enabl|ed when |
|00002110| 74 68 65 72 65 20 69 73 | 20 61 20 77 69 6e 64 6f |there is| a windo|
|00002120| 77 20 74 6f 20 63 6c 6f | 73 65 20 0d 09 20 20 45 |w to clo|se .. E|
|00002130| 6e 61 62 6c 65 49 74 65 | 6d 28 6d 65 6e 75 2c 20 |nableIte|m(menu, |
|00002140| 69 43 6c 6f 73 65 29 3b | 0d 09 65 6c 73 65 20 44 |iClose);|..else D|
|00002150| 69 73 61 62 6c 65 49 74 | 65 6d 28 6d 65 6e 75 2c |isableIt|em(menu,|
|00002160| 20 69 43 6c 6f 73 65 29 | 3b 0d 0d 09 6d 65 6e 75 | iClose)|;...menu|
|00002170| 20 3d 20 47 65 74 4d 48 | 61 6e 64 6c 65 28 6d 45 | = GetMH|andle(mE|
|00002180| 64 69 74 29 3b 0d 09 75 | 6e 64 6f 20 3d 20 66 61 |dit);..u|ndo = fa|
|00002190| 6c 73 65 3b 0d 09 63 75 | 74 43 6f 70 79 43 6c 65 |lse;..cu|tCopyCle|
|000021a0| 61 72 20 3d 20 66 61 6c | 73 65 3b 0d 09 70 61 73 |ar = fal|se;..pas|
|000021b0| 74 65 20 3d 20 66 61 6c | 73 65 3b 0d 09 69 66 20 |te = fal|se;..if |
|000021c0| 28 66 72 6f 6e 74 6d 6f | 73 74 20 21 3d 20 6e 69 |(frontmo|st != ni|
|000021d0| 6c 29 0d 09 20 20 7b 0d | 09 09 69 66 20 28 66 54 |l).. {.|..if (fT|
|000021e0| 45 43 75 72 44 6f 63 20 | 3d 3d 20 6e 69 6c 29 0d |ECurDoc |== nil).|
|000021f0| 09 09 20 20 7b 0d 09 09 | 09 75 6e 64 6f 20 3d 20 |.. {...|.undo = |
|00002200| 74 72 75 65 3b 09 09 09 | 09 2f 2f 20 61 6c 6c 20 |true;...|.// all |
|00002210| 65 64 69 74 69 6e 67 20 | 69 73 20 65 6e 61 62 6c |editing |is enabl|
|00002220| 65 64 20 66 6f 72 20 44 | 41 20 77 69 6e 64 6f 77 |ed for D|A window|
|00002230| 73 20 0d 09 09 09 63 75 | 74 43 6f 70 79 43 6c 65 |s ....cu|tCopyCle|
|00002240| 61 72 20 3d 20 74 72 75 | 65 3b 0d 09 09 09 70 61 |ar = tru|e;....pa|
|00002250| 73 74 65 20 3d 20 74 72 | 75 65 3b 0d 09 09 20 20 |ste = tr|ue;... |
|00002260| 7d 0d 09 09 65 6c 73 65 | 0d 09 09 20 20 7b 0d 09 |}...else|... {..|
|00002270| 09 09 2f 2f 20 43 75 74 | 2c 20 43 6f 70 79 2c 20 |..// Cut|, Copy, |
|00002280| 61 6e 64 20 43 6c 65 61 | 72 20 69 73 20 65 6e 61 |and Clea|r is ena|
|00002290| 62 6c 65 64 20 66 6f 72 | 20 61 70 70 2e 20 77 69 |bled for| app. wi|
|000022a0| 6e 64 6f 77 73 20 77 69 | 74 68 20 73 65 6c 65 63 |ndows wi|th selec|
|000022b0| 74 69 6f 6e 73 20 0d 09 | 09 09 69 66 20 28 20 66 |tions ..|..if ( f|
|000022c0| 54 45 43 75 72 44 6f 63 | 2d 3e 48 61 76 65 53 65 |TECurDoc|->HaveSe|
|000022d0| 6c 65 63 74 69 6f 6e 28 | 29 20 29 0d 09 09 09 20 |lection(|) ).... |
|000022e0| 20 63 75 74 43 6f 70 79 | 43 6c 65 61 72 20 3d 20 | cutCopy|Clear = |
|000022f0| 74 72 75 65 3b 0d 09 09 | 09 2f 2f 20 49 66 20 77 |true;...|.// If w|
|00002300| 65 20 68 61 76 65 20 61 | 6e 79 20 54 45 58 54 20 |e have a|ny TEXT |
|00002310| 69 6e 20 74 68 65 20 73 | 63 72 61 70 2c 20 65 6e |in the s|crap, en|
|00002320| 61 62 6c 65 20 70 61 73 | 74 65 0d 09 09 09 69 66 |able pas|te....if|
|00002330| 20 28 20 47 65 74 53 63 | 72 61 70 28 6e 69 6c 2c | ( GetSc|rap(nil,|
|00002340| 20 27 54 45 58 54 27 2c | 20 26 6f 66 66 73 65 74 | 'TEXT',| &offset|
|00002350| 29 20 29 0d 09 09 09 09 | 70 61 73 74 65 20 3d 20 |) ).....|paste = |
|00002360| 74 72 75 65 3b 20 0d 09 | 09 20 20 7d 0d 09 20 20 |true; ..|. }.. |
|00002370| 7d 0d 09 69 66 20 28 20 | 75 6e 64 6f 20 29 0d 09 |}..if ( |undo )..|
|00002380| 20 20 45 6e 61 62 6c 65 | 49 74 65 6d 28 6d 65 6e | Enable|Item(men|
|00002390| 75 2c 20 69 55 6e 64 6f | 29 3b 0d 09 65 6c 73 65 |u, iUndo|);..else|
|000023a0| 20 44 69 73 61 62 6c 65 | 49 74 65 6d 28 6d 65 6e | Disable|Item(men|
|000023b0| 75 2c 20 69 55 6e 64 6f | 29 3b 0d 09 69 66 20 28 |u, iUndo|);..if (|
|000023c0| 20 63 75 74 43 6f 70 79 | 43 6c 65 61 72 20 29 0d | cutCopy|Clear ).|
|000023d0| 09 20 20 7b 0d 09 09 45 | 6e 61 62 6c 65 49 74 65 |. {...E|nableIte|
|000023e0| 6d 28 6d 65 6e 75 2c 20 | 69 43 75 74 29 3b 0d 09 |m(menu, |iCut);..|
|000023f0| 09 45 6e 61 62 6c 65 49 | 74 65 6d 28 6d 65 6e 75 |.EnableI|tem(menu|
|00002400| 2c 20 69 43 6f 70 79 29 | 3b 0d 09 09 45 6e 61 62 |, iCopy)|;...Enab|
|00002410| 6c 65 49 74 65 6d 28 6d | 65 6e 75 2c 20 69 43 6c |leItem(m|enu, iCl|
|00002420| 65 61 72 29 3b 0d 09 20 | 20 7d 20 0d 09 65 6c 73 |ear);.. | } ..els|
|00002430| 65 0d 09 20 20 7b 0d 09 | 09 44 69 73 61 62 6c 65 |e.. {..|.Disable|
|00002440| 49 74 65 6d 28 6d 65 6e | 75 2c 20 69 43 75 74 29 |Item(men|u, iCut)|
|00002450| 3b 0d 09 09 44 69 73 61 | 62 6c 65 49 74 65 6d 28 |;...Disa|bleItem(|
|00002460| 6d 65 6e 75 2c 20 69 43 | 6f 70 79 29 3b 0d 09 09 |menu, iC|opy);...|
|00002470| 44 69 73 61 62 6c 65 49 | 74 65 6d 28 6d 65 6e 75 |DisableI|tem(menu|
|00002480| 2c 20 69 43 6c 65 61 72 | 29 3b 0d 09 20 20 7d 0d |, iClear|);.. }.|
|00002490| 09 69 66 20 28 20 70 61 | 73 74 65 20 29 0d 09 09 |.if ( pa|ste )...|
|000024a0| 45 6e 61 62 6c 65 49 74 | 65 6d 28 6d 65 6e 75 2c |EnableIt|em(menu,|
|000024b0| 20 69 50 61 73 74 65 29 | 3b 0d 09 65 6c 73 65 20 | iPaste)|;..else |
|000024c0| 44 69 73 61 62 6c 65 49 | 74 65 6d 28 6d 65 6e 75 |DisableI|tem(menu|
|000024d0| 2c 20 69 50 61 73 74 65 | 29 3b 0d 7d 20 2f 2f 20 |, iPaste|);.} // |
|000024e0| 41 64 6a 75 73 74 4d 65 | 6e 75 73 0d 0d 0d 2f 2f |AdjustMe|nus...//|
|000024f0| 20 54 68 69 73 20 69 73 | 20 63 61 6c 6c 65 64 20 | This is| called |
|00002500| 77 68 65 6e 20 61 6e 20 | 69 74 65 6d 20 69 73 20 |when an |item is |
|00002510| 63 68 6f 73 65 6e 20 66 | 72 6f 6d 20 74 68 65 20 |chosen f|rom the |
|00002520| 6d 65 6e 75 20 62 61 72 | 20 28 61 66 74 65 72 20 |menu bar| (after |
|00002530| 63 61 6c 6c 69 6e 67 0d | 2f 2f 20 4d 65 6e 75 53 |calling.|// MenuS|
|00002540| 65 6c 65 63 74 20 6f 72 | 20 4d 65 6e 75 4b 65 79 |elect or| MenuKey|
|00002550| 29 2e 20 49 74 20 64 6f | 65 73 20 74 68 65 20 72 |). It do|es the r|
|00002560| 69 67 68 74 20 74 68 69 | 6e 67 20 66 6f 72 20 65 |ight thi|ng for e|
|00002570| 61 63 68 20 63 6f 6d 6d | 61 6e 64 2e 0d 0d 76 6f |ach comm|and...vo|
|00002580| 69 64 20 54 45 53 61 6d | 70 6c 65 3a 3a 44 6f 4d |id TESam|ple::DoM|
|00002590| 65 6e 75 43 6f 6d 6d 61 | 6e 64 28 73 68 6f 72 74 |enuComma|nd(short|
|000025a0| 20 6d 65 6e 75 49 44 2c | 20 73 68 6f 72 74 20 6d | menuID,| short m|
|000025b0| 65 6e 75 49 74 65 6d 29 | 0d 7b 0d 09 73 68 6f 72 |enuItem)|.{..shor|
|000025c0| 74 09 09 69 74 65 6d 48 | 69 74 3b 0d 09 53 74 72 |t..itemH|it;..Str|
|000025d0| 32 35 35 09 09 64 61 4e | 61 6d 65 3b 0d 09 73 68 |255..daN|ame;..sh|
|000025e0| 6f 72 74 09 09 64 61 52 | 65 66 4e 75 6d 3b 0d 09 |ort..daR|efNum;..|
|000025f0| 57 69 6e 64 6f 77 50 74 | 72 09 77 69 6e 64 6f 77 |WindowPt|r.window|
|00002600| 3b 0d 09 54 45 44 6f 63 | 75 6d 65 6e 74 2a 20 66 |;..TEDoc|ument* f|
|00002610| 54 45 43 75 72 44 6f 63 | 20 3d 20 28 54 45 44 6f |TECurDoc| = (TEDo|
|00002620| 63 75 6d 65 6e 74 2a 29 | 20 66 43 75 72 44 6f 63 |cument*)| fCurDoc|
|00002630| 3b 0d 0d 09 77 69 6e 64 | 6f 77 20 3d 20 46 72 6f |;...wind|ow = Fro|
|00002640| 6e 74 57 69 6e 64 6f 77 | 28 29 3b 0d 09 73 77 69 |ntWindow|();..swi|
|00002650| 74 63 68 20 28 20 6d 65 | 6e 75 49 44 20 29 0d 09 |tch ( me|nuID )..|
|00002660| 20 20 7b 0d 09 09 63 61 | 73 65 20 6d 41 70 70 6c | {...ca|se mAppl|
|00002670| 65 3a 0d 09 09 09 73 77 | 69 74 63 68 20 28 20 6d |e:....sw|itch ( m|
|00002680| 65 6e 75 49 74 65 6d 20 | 29 0d 09 09 09 20 20 7b |enuItem |).... {|
|00002690| 0d 09 09 09 09 63 61 73 | 65 20 69 41 62 6f 75 74 |.....cas|e iAbout|
|000026a0| 3a 09 09 2f 2f 20 62 72 | 69 6e 67 20 75 70 20 61 |:..// br|ing up a|
|000026b0| 6c 65 72 74 20 66 6f 72 | 20 41 62 6f 75 74 20 0d |lert for| About .|
|000026c0| 09 09 09 09 09 69 74 65 | 6d 48 69 74 20 3d 20 41 |.....ite|mHit = A|
|000026d0| 6c 65 72 74 28 72 41 62 | 6f 75 74 41 6c 65 72 74 |lert(rAb|outAlert|
|000026e0| 2c 20 6e 69 6c 29 3b 0d | 09 09 09 09 09 62 72 65 |, nil);.|.....bre|
|000026f0| 61 6b 3b 0d 09 09 09 09 | 64 65 66 61 75 6c 74 3a |ak;.....|default:|
|00002700| 09 09 09 2f 2f 20 61 6c | 6c 20 6e 6f 6e 2d 41 62 |...// al|l non-Ab|
|00002710| 6f 75 74 20 69 74 65 6d | 73 20 69 6e 20 74 68 69 |out item|s in thi|
|00002720| 73 20 6d 65 6e 75 20 61 | 72 65 20 44 41 73 20 65 |s menu a|re DAs e|
|00002730| 74 20 61 6c 20 0d 09 09 | 09 09 09 47 65 74 49 74 |t al ...|...GetIt|
|00002740| 65 6d 28 47 65 74 4d 48 | 61 6e 64 6c 65 28 6d 41 |em(GetMH|andle(mA|
|00002750| 70 70 6c 65 29 2c 20 6d | 65 6e 75 49 74 65 6d 2c |pple), m|enuItem,|
|00002760| 20 64 61 4e 61 6d 65 29 | 3b 0d 09 09 09 09 09 64 | daName)|;......d|
|00002770| 61 52 65 66 4e 75 6d 20 | 3d 20 4f 70 65 6e 44 65 |aRefNum |= OpenDe|
|00002780| 73 6b 41 63 63 28 64 61 | 4e 61 6d 65 29 3b 0d 09 |skAcc(da|Name);..|
|00002790| 09 09 09 09 62 72 65 61 | 6b 3b 0d 09 09 09 20 20 |....brea|k;.... |
|000027a0| 7d 0d 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 63 61 |}....bre|ak;...ca|
|000027b0| 73 65 20 6d 46 69 6c 65 | 3a 0d 09 09 09 73 77 69 |se mFile|:....swi|
|000027c0| 74 63 68 20 28 20 6d 65 | 6e 75 49 74 65 6d 20 29 |tch ( me|nuItem )|
|000027d0| 0d 09 09 09 20 20 7b 0d | 09 09 09 09 63 61 73 65 |.... {.|....case|
|000027e0| 20 69 4e 65 77 3a 0d 09 | 09 09 09 09 44 6f 4e 65 | iNew:..|....DoNe|
|000027f0| 77 28 29 3b 0d 09 09 09 | 09 09 62 72 65 61 6b 3b |w();....|..break;|
|00002800| 0d 09 09 09 09 63 61 73 | 65 20 69 43 6c 6f 73 65 |.....cas|e iClose|
|00002810| 3a 0d 09 09 09 09 09 69 | 66 20 28 66 54 45 43 75 |:......i|f (fTECu|
|00002820| 72 44 6f 63 20 21 3d 20 | 6e 69 6c 29 0d 09 09 09 |rDoc != |nil)....|
|00002830| 09 09 20 20 7b 0d 09 09 | 09 09 09 09 66 44 6f 63 |.. {...|....fDoc|
|00002840| 4c 69 73 74 2d 3e 52 65 | 6d 6f 76 65 44 6f 63 28 |List->Re|moveDoc(|
|00002850| 66 54 45 43 75 72 44 6f | 63 29 3b 0d 09 09 09 09 |fTECurDo|c);.....|
|00002860| 09 09 66 54 45 43 75 72 | 44 6f 63 2d 3e 44 6f 43 |..fTECur|Doc->DoC|
|00002870| 6c 6f 73 65 28 29 3b 0d | 09 09 09 09 09 20 20 7d |lose();.|..... }|
|00002880| 0d 09 09 09 09 09 65 6c | 73 65 20 43 6c 6f 73 65 |......el|se Close|
|00002890| 44 65 73 6b 41 63 63 28 | 28 28 57 69 6e 64 6f 77 |DeskAcc(|((Window|
|000028a0| 50 65 65 6b 29 20 66 57 | 68 69 63 68 57 69 6e 64 |Peek) fW|hichWind|
|000028b0| 6f 77 29 2d 3e 77 69 6e | 64 6f 77 4b 69 6e 64 29 |ow)->win|dowKind)|
|000028c0| 3b 0d 09 09 09 09 09 2f | 2f 20 6d 61 6b 65 20 73 |;....../|/ make s|
|000028d0| 75 72 65 20 6f 75 72 20 | 63 75 72 72 65 6e 74 20 |ure our |current |
|000028e0| 64 6f 63 75 6d 65 6e 74 | 2f 77 69 6e 64 6f 77 20 |document|/window |
|000028f0| 72 65 66 65 72 65 6e 63 | 65 73 20 61 72 65 20 76 |referenc|es are v|
|00002900| 61 6c 69 64 0d 09 09 09 | 09 09 66 57 68 69 63 68 |alid....|..fWhich|
|00002910| 57 69 6e 64 6f 77 20 3d | 20 46 72 6f 6e 74 57 69 |Window =| FrontWi|
|00002920| 6e 64 6f 77 28 29 3b 0d | 09 09 09 09 09 69 66 20 |ndow();.|.....if |
|00002930| 28 66 57 68 69 63 68 57 | 69 6e 64 6f 77 20 21 3d |(fWhichW|indow !=|
|00002940| 20 6e 69 6c 29 0d 09 09 | 09 09 09 20 20 7b 0d 09 | nil)...|... {..|
|00002950| 09 09 09 09 09 66 43 75 | 72 44 6f 63 20 3d 20 66 |.....fCu|rDoc = f|
|00002960| 44 6f 63 4c 69 73 74 2d | 3e 46 69 6e 64 44 6f 63 |DocList-|>FindDoc|
|00002970| 28 66 57 68 69 63 68 57 | 69 6e 64 6f 77 29 3b 0d |(fWhichW|indow);.|
|00002980| 09 09 09 09 09 09 53 65 | 74 50 6f 72 74 28 66 57 |......Se|tPort(fW|
|00002990| 68 69 63 68 57 69 6e 64 | 6f 77 29 3b 0d 09 09 09 |hichWind|ow);....|
|000029a0| 09 09 20 20 7d 0d 09 09 | 09 09 09 65 6c 73 65 20 |.. }...|...else |
|000029b0| 66 43 75 72 44 6f 63 20 | 3d 20 6e 69 6c 3b 0d 09 |fCurDoc |= nil;..|
|000029c0| 09 09 09 09 62 72 65 61 | 6b 3b 0d 09 09 09 09 63 |....brea|k;.....c|
|000029d0| 61 73 65 20 69 51 75 69 | 74 3a 0d 09 09 09 09 09 |ase iQui|t:......|
|000029e0| 54 65 72 6d 69 6e 61 74 | 65 28 29 3b 0d 09 09 09 |Terminat|e();....|
|000029f0| 09 09 62 72 65 61 6b 3b | 0d 09 09 09 20 20 7d 0d |..break;|.... }.|
|00002a00| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 63 61 73 65 |...break|;...case|
|00002a10| 20 6d 45 64 69 74 3a 09 | 09 09 09 09 2f 2f 20 63 | mEdit:.|....// c|
|00002a20| 61 6c 6c 20 53 79 73 74 | 65 6d 45 64 69 74 20 66 |all Syst|emEdit f|
|00002a30| 6f 72 20 44 41 20 65 64 | 69 74 69 6e 67 20 26 20 |or DA ed|iting & |
|00002a40| 4d 75 6c 74 69 46 69 6e | 64 65 72 20 0d 09 09 09 |MultiFin|der ....|
|00002a50| 69 66 20 28 20 21 53 79 | 73 74 65 6d 45 64 69 74 |if ( !Sy|stemEdit|
|00002a60| 28 6d 65 6e 75 49 74 65 | 6d 2d 31 29 20 29 0d 09 |(menuIte|m-1) )..|
|00002a70| 09 09 20 20 7b 0d 09 09 | 09 09 73 77 69 74 63 68 |.. {...|..switch|
|00002a80| 20 28 20 6d 65 6e 75 49 | 74 65 6d 20 29 0d 09 09 | ( menuI|tem )...|
|00002a90| 09 09 20 20 7b 0d 09 09 | 09 09 09 63 61 73 65 20 |.. {...|...case |
|00002aa0| 69 43 75 74 3a 0d 09 09 | 09 09 09 09 66 54 45 43 |iCut:...|....fTEC|
|00002ab0| 75 72 44 6f 63 2d 3e 44 | 6f 43 75 74 28 29 3b 0d |urDoc->D|oCut();.|
|00002ac0| 09 09 09 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 09 |......br|eak;....|
|00002ad0| 09 09 63 61 73 65 20 69 | 43 6f 70 79 3a 0d 09 09 |..case i|Copy:...|
|00002ae0| 09 09 09 09 66 54 45 43 | 75 72 44 6f 63 2d 3e 44 |....fTEC|urDoc->D|
|00002af0| 6f 43 6f 70 79 28 29 3b | 0d 09 09 09 09 09 09 62 |oCopy();|.......b|
|00002b00| 72 65 61 6b 3b 0d 09 09 | 09 09 09 63 61 73 65 20 |reak;...|...case |
|00002b10| 69 50 61 73 74 65 3a 0d | 09 09 09 09 09 09 66 54 |iPaste:.|......fT|
|00002b20| 45 43 75 72 44 6f 63 2d | 3e 44 6f 50 61 73 74 65 |ECurDoc-|>DoPaste|
|00002b30| 28 29 3b 0d 09 09 09 09 | 09 09 62 72 65 61 6b 3b |();.....|..break;|
|00002b40| 0d 09 09 09 09 09 63 61 | 73 65 20 69 43 6c 65 61 |......ca|se iClea|
|00002b50| 72 3a 0d 09 09 09 09 09 | 09 66 54 45 43 75 72 44 |r:......|.fTECurD|
|00002b60| 6f 63 2d 3e 44 6f 43 6c | 65 61 72 28 29 3b 0d 09 |oc->DoCl|ear();..|
|00002b70| 09 09 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 09 09 |.....bre|ak;.....|
|00002b80| 20 20 20 7d 0d 09 09 09 | 20 20 7d 0d 09 09 09 62 | }....| }....b|
|00002b90| 72 65 61 6b 3b 0d 09 20 | 20 7d 0d 09 48 69 6c 69 |reak;.. | }..Hili|
|00002ba0| 74 65 4d 65 6e 75 28 30 | 29 3b 09 09 09 09 09 2f |teMenu(0|);...../|
|00002bb0| 2f 20 75 6e 68 69 67 68 | 6c 69 67 68 74 20 77 68 |/ unhigh|light wh|
|00002bc0| 61 74 20 4d 65 6e 75 53 | 65 6c 65 63 74 20 28 6f |at MenuS|elect (o|
|00002bd0| 72 20 4d 65 6e 75 4b 65 | 79 29 20 68 69 6c 69 74 |r MenuKe|y) hilit|
|00002be0| 65 64 20 0d 7d 20 2f 2f | 20 44 6f 4d 65 6e 75 43 |ed .} //| DoMenuC|
|00002bf0| 6f 6d 6d 61 6e 64 0d 0d | 2f 2f 20 43 72 65 61 74 |ommand..|// Creat|
|00002c00| 65 20 61 20 6e 65 77 20 | 64 6f 63 75 6d 65 6e 74 |e a new |document|
|00002c10| 20 61 6e 64 20 77 69 6e | 64 6f 77 2e 20 0d 0d 76 | and win|dow. ..v|
|00002c20| 6f 69 64 20 54 45 53 61 | 6d 70 6c 65 3a 3a 44 6f |oid TESa|mple::Do|
|00002c30| 4e 65 77 28 29 0d 7b 0d | 09 54 45 44 6f 63 75 6d |New().{.|.TEDocum|
|00002c40| 65 6e 74 2a 20 74 44 6f | 63 3b 0d 0d 09 74 44 6f |ent* tDo|c;...tDo|
|00002c50| 63 20 3d 20 6e 65 77 20 | 54 45 44 6f 63 75 6d 65 |c = new |TEDocume|
|00002c60| 6e 74 28 72 44 6f 63 57 | 69 6e 64 6f 77 29 3b 0d |nt(rDocW|indow);.|
|00002c70| 09 2f 2f 20 69 66 20 77 | 65 20 64 69 64 6e 27 74 |.// if w|e didn't|
|00002c80| 20 67 65 74 20 61 6e 20 | 61 6c 6c 6f 63 61 74 69 | get an |allocati|
|00002c90| 6f 6e 20 65 72 72 6f 72 | 2c 20 61 64 64 20 69 74 |on error|, add it|
|00002ca0| 20 74 6f 20 6c 69 73 74 | 0d 09 69 66 20 28 74 44 | to list|..if (tD|
|00002cb0| 6f 63 20 21 3d 20 6e 69 | 6c 29 0d 09 20 20 66 44 |oc != ni|l).. fD|
|00002cc0| 6f 63 4c 69 73 74 2d 3e | 41 64 64 44 6f 63 28 74 |ocList->|AddDoc(t|
|00002cd0| 44 6f 63 29 3b 0d 7d 20 | 2f 2f 20 44 6f 4e 65 77 |Doc);.} |// DoNew|
|00002ce0| 0d 0d 2f 2f 20 43 6c 65 | 61 6e 20 75 70 20 74 68 |..// Cle|an up th|
|00002cf0| 65 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 61 6e |e applic|ation an|
|00002d00| 64 20 65 78 69 74 73 2e | 20 59 6f 75 20 6d 69 67 |d exits.| You mig|
|00002d10| 68 74 20 77 61 6e 74 20 | 74 6f 20 63 6c 6f 73 65 |ht want |to close|
|00002d20| 20 61 6c 6c 0d 2f 2f 20 | 6f 66 20 79 6f 75 72 20 | all.// |of your |
|00002d30| 64 6f 63 75 6d 65 6e 74 | 73 20 28 61 6e 64 20 61 |document|s (and a|
|00002d40| 73 6b 20 74 68 65 20 75 | 73 65 72 20 74 6f 20 73 |sk the u|ser to s|
|00002d50| 61 76 65 20 74 68 65 6d | 29 20 68 65 72 65 2e 0d |ave them|) here..|
|00002d60| 0d 76 6f 69 64 20 54 45 | 53 61 6d 70 6c 65 3a 3a |.void TE|Sample::|
|00002d70| 54 65 72 6d 69 6e 61 74 | 65 28 29 0d 7b 0d 09 45 |Terminat|e().{..E|
|00002d80| 78 69 74 4c 6f 6f 70 28 | 29 3b 0d 7d 20 2f 2f 20 |xitLoop(|);.} // |
|00002d90| 54 65 72 6d 69 6e 61 74 | 65 0d 0d 00 00 00 00 00 |Terminat|e.......|
|00002da0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002db0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002dc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002dd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002de0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002df0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e00| 00 00 01 00 00 00 01 1e | 00 00 00 1e 00 00 00 1e |........|........|
|00002e10| 2b 40 aa 44 60 20 19 6d | aa 47 00 13 be ad d5 36 |+@.D` .m|.G.....6|
|00002e20| 66 10 70 00 2b 40 aa 44 | 22 2d d4 e6 d3 ad aa 48 |f.p.+@.D|"-.....H|
|00002e30| 0b 54 45 53 61 6d 70 6c | 65 2e 63 70 02 00 00 00 |.TESampl|e.cp....|
|00002e40| 54 45 58 54 4d 50 53 20 | 01 00 00 3c 01 20 00 00 |TEXTMPS |...<. ..|
|00002e50| 00 00 54 45 58 54 4d 50 | 53 20 01 00 00 3c 01 20 |..TEXTMP|S ...<. |
|00002e60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e70| 00 00 a1 4b 04 00 00 00 | 2d 1b 00 00 01 3c 10 28 |...K....|-....<.(|
|00002e80| 00 14 0c 80 00 00 00 a1 | 66 00 00 b4 70 00 28 40 |........|f...p.(@|
|00002e90| 20 6e 00 0c 26 68 00 14 | 60 6e 70 4d b0 13 66 64 | n..&h..|`npM..fd|
|00002ea0| 20 6b 00 08 2f 28 00 18 | 70 00 2f 00 4e ad 09 72 | k../(..|p./.N..r|
|00002eb0| 2d 40 ff f8 20 6b 00 08 | 22 6e ff f8 23 68 00 46 |-@.. k..|"n..#h.F|
|00002ec0| 00 04 20 6e ff f8 21 4c | 00 38 20 6e ff fc 4a a8 |.. n..!L|.8 n..J.|
|00002ed0| 00 28 50 8f 67 0e 20 6e | ff fc 20 68 00 28 20 68 |.(P.g. n|.. h.( h|
|00002ee0| 00 1c 60 04 30 7c 00 00 | 22 6e ff f8 23 48 00 10 |..`.0|..|"n..#H..|
|00002ef0| 20 6e ff f8 41 e8 00 2c | 43 ed d4 5e 20 d9 20 d9 | n..A..,|C..^ . .|
|00002f00| 00 00 00 1a 03 01 40 09 | 00 00 05 33 2e 31 61 38 |......@.|...3.1a8|
|00002f10| 0d 4d 50 57 20 43 2b 2b | 20 33 2e 31 61 39 00 00 |.MPW C++| 3.1a9..|
|00002f20| 01 00 00 00 01 1e 00 00 | 00 1e 00 00 00 1e 00 1b |........|........|
|00002f30| 5f 08 0c 20 00 00 00 1c | 00 1e ff ff 00 00 00 00 |_.. ....|........|
|00002f40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+