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.89.06.sit / SC.014.CPlusTESample / TEDocument.cp < prev    next >
MacBinary  |  1989-04-01  |  24.1 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, Sat Apr 1 15:02:04 1989, modified Sat Apr 1 15:02:04 1989, creator 'MPS ', type ASCII, 24177 bytes "TEDocument.cp" , at 0x5ef1 382 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 0d 54 45 44 6f 63 75 | 6d 65 6e 74 2e 63 70 00 |..TEDocu|ment.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 00 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 5e 71 00 | 00 01 7e a0 5a db 3c a0 |.....^q.|..~.Z.<.|
|00000060| 5a db 3c 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |Z.<.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 fa 3f 00 00 |........|.....?..|
|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 44 6f 63 75 6d 65 | 6e 74 2e 63 70 09 2d 09 |TEDocume|nt.cp.-.|
|00000160| 43 2b 2b 20 73 6f 75 72 | 63 65 0d 23 0d 23 09 43 |C++ sour|ce.#.#.C|
|00000170| 6f 70 79 72 69 67 68 74 | 20 a9 20 31 39 38 39 20 |opyright| . 1989 |
|00000180| 41 70 70 6c 65 20 43 6f | 6d 70 75 74 65 72 2c 20 |Apple Co|mputer, |
|00000190| 49 6e 63 2e 0d 23 09 41 | 6c 6c 20 72 69 67 68 74 |Inc..#.A|ll right|
|000001a0| 73 20 72 65 73 65 72 76 | 65 64 2e 0d 23 0d 23 09 |s reserv|ed..#.#.|
|000001b0| 56 65 72 73 69 6f 6e 73 | 3a 09 0d 23 09 09 09 31 |Versions|:..#...1|
|000001c0| 2e 30 30 20 09 09 09 09 | 09 30 34 2f 38 39 0d 23 |.00 ....|.04/89.#|
|000001d0| 0d 23 09 43 6f 6d 70 6f | 6e 65 6e 74 73 3a 0d 23 |.#.Compo|nents:.#|
|000001e0| 09 09 09 43 50 6c 75 73 | 54 45 53 61 6d 70 6c 65 |...CPlus|TESample|
|000001f0| 2e 6d 61 6b 65 09 09 41 | 70 72 69 6c 20 31 2c 20 |.make..A|pril 1, |
|00000200| 31 39 38 39 0d 23 09 09 | 09 54 41 70 70 6c 69 63 |1989.#..|.TApplic|
|00000210| 61 74 69 6f 6e 43 6f 6d | 6d 6f 6e 2e 68 09 41 70 |ationCom|mon.h.Ap|
|00000220| 72 69 6c 20 31 2c 20 31 | 39 38 39 0d 23 09 09 09 |ril 1, 1|989.#...|
|00000230| 54 41 70 70 6c 69 63 61 | 74 69 6f 6e 2e 68 09 09 |TApplica|tion.h..|
|00000240| 09 41 70 72 69 6c 20 31 | 2c 20 31 39 38 39 0d 23 |.April 1|, 1989.#|
|00000250| 09 09 09 54 44 6f 63 75 | 6d 65 6e 74 2e 68 09 09 |...TDocu|ment.h..|
|00000260| 09 09 41 70 72 69 6c 20 | 31 2c 20 31 39 38 39 0d |..April |1, 1989.|
|00000270| 23 09 09 09 54 45 43 6f | 6d 6d 6f 6e 2e 68 09 09 |#...TECo|mmon.h..|
|00000280| 09 09 41 70 72 69 6c 20 | 31 2c 20 31 39 38 39 0d |..April |1, 1989.|
|00000290| 23 09 09 09 54 45 53 61 | 6d 70 6c 65 2e 68 09 09 |#...TESa|mple.h..|
|000002a0| 09 09 41 70 72 69 6c 20 | 31 2c 20 31 39 38 39 0d |..April |1, 1989.|
|000002b0| 23 09 09 09 54 45 44 6f | 63 75 6d 65 6e 74 2e 68 |#...TEDo|cument.h|
|000002c0| 09 09 09 41 70 72 69 6c | 20 31 2c 20 31 39 38 39 |...April| 1, 1989|
|000002d0| 0d 23 09 09 09 54 41 70 | 70 6c 69 63 61 74 69 6f |.#...TAp|plicatio|
|000002e0| 6e 2e 63 70 09 09 09 41 | 70 72 69 6c 20 31 2c 20 |n.cp...A|pril 1, |
|000002f0| 31 39 38 39 0d 23 09 09 | 09 54 44 6f 63 75 6d 65 |1989.#..|.TDocume|
|00000300| 6e 74 2e 63 70 09 09 09 | 41 70 72 69 6c 20 31 2c |nt.cp...|April 1,|
|00000310| 20 31 39 38 39 0d 23 09 | 09 09 54 45 53 61 6d 70 | 1989.#.|..TESamp|
|00000320| 6c 65 2e 63 70 09 09 09 | 09 41 70 72 69 6c 20 31 |le.cp...|.April 1|
|00000330| 2c 20 31 39 38 39 0d 23 | 09 09 09 54 45 44 6f 63 |, 1989.#|...TEDoc|
|00000340| 75 6d 65 6e 74 2e 63 70 | 09 09 09 41 70 72 69 6c |ument.cp|...April|
|00000350| 20 31 2c 20 31 39 38 39 | 0d 23 09 09 09 54 45 53 | 1, 1989|.#...TES|
|00000360| 61 6d 70 6c 65 47 6c 75 | 65 2e 61 09 09 09 41 70 |ampleGlu|e.a...Ap|
|00000370| 72 69 6c 20 31 2c 20 31 | 39 38 39 0d 23 09 09 09 |ril 1, 1|989.#...|
|00000380| 54 41 70 70 6c 69 63 61 | 74 69 6f 6e 2e 72 09 09 |TApplica|tion.r..|
|00000390| 09 41 70 72 69 6c 20 31 | 2c 20 31 39 38 39 0d 23 |.April 1|, 1989.#|
|000003a0| 09 09 09 54 45 53 61 6d | 70 6c 65 2e 72 09 09 09 |...TESam|ple.r...|
|000003b0| 09 41 70 72 69 6c 20 31 | 2c 20 31 39 38 39 0d 23 |.April 1|, 1989.#|
|000003c0| 0d 23 09 43 50 6c 75 73 | 54 45 53 61 6d 70 6c 65 |.#.CPlus|TESample|
|000003d0| 20 69 73 20 61 6e 20 65 | 78 61 6d 70 6c 65 20 61 | is an e|xample a|
|000003e0| 70 70 6c 69 63 61 74 69 | 6f 6e 20 74 68 61 74 20 |pplicati|on that |
|000003f0| 64 65 6d 6f 6e 73 74 72 | 61 74 65 73 0d 23 09 68 |demonstr|ates.#.h|
|00000400| 6f 77 20 74 6f 20 69 6e | 69 74 69 61 6c 69 7a 65 |ow to in|itialize|
|00000410| 20 74 68 65 20 63 6f 6d | 6d 6f 6e 6c 79 20 75 73 | the com|monly us|
|00000420| 65 64 20 74 6f 6f 6c 62 | 6f 78 20 6d 61 6e 61 67 |ed toolb|ox manag|
|00000430| 65 72 73 2c 0d 23 09 6f | 70 65 72 61 74 65 20 73 |ers,.#.o|perate s|
|00000440| 75 63 63 65 73 73 66 75 | 6c 6c 79 20 75 6e 64 65 |uccessfu|lly unde|
|00000450| 72 20 4d 75 6c 74 69 46 | 69 6e 64 65 72 2c 20 68 |r MultiF|inder, h|
|00000460| 61 6e 64 6c 65 20 64 65 | 73 6b 0d 23 09 61 63 63 |andle de|sk.#.acc|
|00000470| 65 73 73 6f 72 69 65 73 | 20 61 6e 64 20 63 72 65 |essories| and cre|
|00000480| 61 74 65 2c 20 67 72 6f | 77 2c 20 61 6e 64 20 7a |ate, gro|w, and z|
|00000490| 6f 6f 6d 20 77 69 6e 64 | 6f 77 73 2e 20 54 68 65 |oom wind|ows. The|
|000004a0| 0d 23 09 66 75 6e 64 61 | 6d 65 6e 74 61 6c 20 54 |.#.funda|mental T|
|000004b0| 65 78 74 45 64 69 74 20 | 74 6f 6f 6c 62 6f 78 20 |extEdit |toolbox |
|000004c0| 63 61 6c 6c 73 20 61 6e | 64 20 54 65 78 74 45 64 |calls an|d TextEd|
|000004d0| 69 74 20 61 75 74 6f 73 | 63 72 6f 6c 6c 0d 23 09 |it autos|croll.#.|
|000004e0| 61 72 65 20 64 65 6d 6f | 6e 73 74 72 61 74 65 64 |are demo|nstrated|
|000004f0| 2e 20 49 74 20 61 6c 73 | 6f 20 73 68 6f 77 73 20 |. It als|o shows |
|00000500| 68 6f 77 20 74 6f 20 63 | 72 65 61 74 65 20 61 6e |how to c|reate an|
|00000510| 64 20 6d 61 69 6e 74 61 | 69 6e 0d 23 09 73 63 72 |d mainta|in.#.scr|
|00000520| 6f 6c 6c 62 61 72 20 63 | 6f 6e 74 72 6f 6c 73 2e |ollbar c|ontrols.|
|00000530| 20 0d 23 0d 23 09 54 68 | 69 73 20 76 65 72 73 69 | .#.#.Th|is versi|
|00000540| 6f 6e 20 6f 66 20 54 45 | 53 61 6d 70 6c 65 20 68 |on of TE|Sample h|
|00000550| 61 73 20 62 65 65 6e 20 | 73 75 62 73 74 61 6e 74 |as been |substant|
|00000560| 69 61 6c 6c 79 20 72 65 | 77 6f 72 6b 65 64 20 69 |ially re|worked i|
|00000570| 6e 0d 23 09 43 2b 2b 20 | 74 6f 20 73 68 6f 77 20 |n.#.C++ |to show |
|00000580| 68 6f 77 20 61 20 22 74 | 79 70 69 63 61 6c 22 20 |how a "t|ypical" |
|00000590| 6f 62 6a 65 63 74 20 6f | 72 69 65 6e 74 65 64 20 |object o|riented |
|000005a0| 70 72 6f 67 72 61 6d 20 | 63 6f 75 6c 64 0d 23 09 |program |could.#.|
|000005b0| 62 65 20 77 72 69 74 74 | 65 6e 2e 20 54 6f 20 74 |be writt|en. To t|
|000005c0| 68 69 73 20 65 6e 64 2c | 20 77 68 61 74 20 77 61 |his end,| what wa|
|000005d0| 73 20 6f 6e 63 65 20 61 | 20 73 69 6e 67 6c 65 20 |s once a| single |
|000005e0| 73 6f 75 72 63 65 20 63 | 6f 64 65 0d 23 09 66 69 |source c|ode.#.fi|
|000005f0| 6c 65 20 68 61 73 20 62 | 65 65 6e 20 72 65 73 74 |le has b|een rest|
|00000600| 72 75 63 74 75 72 65 64 | 20 69 6e 74 6f 20 61 20 |ructured| into a |
|00000610| 73 65 74 20 6f 66 20 63 | 6c 61 73 73 65 73 20 77 |set of c|lasses w|
|00000620| 68 69 63 68 0d 23 09 64 | 65 6d 6f 6e 73 74 72 61 |hich.#.d|emonstra|
|00000630| 74 65 20 74 68 65 20 61 | 64 76 61 6e 74 61 67 65 |te the a|dvantage|
|00000640| 73 20 6f 66 20 6f 62 6a | 65 63 74 2d 6f 72 69 65 |s of obj|ect-orie|
|00000650| 6e 74 65 64 20 70 72 6f | 67 72 61 6d 6d 69 6e 67 |nted pro|gramming|
|00000660| 2e 0d 23 0d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |..#.----|--------|
|00000670| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000680| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000690| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000006a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000006b0| 2d 2d 2a 2f 0d 0d 0d 2f | 2a 0d 53 65 67 6d 65 6e |--*/.../|*.Segmen|
|000006c0| 74 61 74 69 6f 6e 20 73 | 74 72 61 74 65 67 79 3a |tation s|trategy:|
|000006d0| 0d 0d 20 20 20 20 54 68 | 69 73 20 70 72 6f 67 72 |.. Th|is progr|
|000006e0| 61 6d 20 68 61 73 20 6f | 6e 6c 79 20 6f 6e 65 20 |am has o|nly one |
|000006f0| 73 65 67 6d 65 6e 74 2c | 20 73 69 6e 63 65 20 74 |segment,| since t|
|00000700| 68 65 20 69 73 73 75 65 | 73 0d 20 20 20 20 73 75 |he issue|s. su|
|00000710| 72 72 6f 75 6e 64 69 6e | 67 20 73 65 67 6d 65 6e |rroundin|g segmen|
|00000720| 74 61 74 69 6f 6e 20 77 | 69 74 68 69 6e 20 61 20 |tation w|ithin a |
|00000730| 63 6c 61 73 73 27 73 20 | 6d 65 74 68 6f 64 73 20 |class's |methods |
|00000740| 68 61 76 65 0d 20 20 20 | 20 6e 6f 74 20 62 65 65 |have. | not bee|
|00000750| 6e 20 69 6e 76 65 73 74 | 69 67 61 74 65 64 20 79 |n invest|igated y|
|00000760| 65 74 2e 20 57 65 20 44 | 4f 20 75 6e 6c 6f 61 64 |et. We D|O unload|
|00000770| 20 74 68 65 20 64 61 74 | 61 0d 20 20 20 20 69 6e | the dat|a. in|
|00000780| 69 74 69 61 6c 69 7a 61 | 74 69 6f 6e 20 73 65 67 |itializa|tion seg|
|00000790| 6d 65 6e 74 20 61 74 20 | 73 74 61 72 74 75 70 20 |ment at |startup |
|000007a0| 74 69 6d 65 2c 20 77 68 | 69 63 68 20 66 72 65 65 |time, wh|ich free|
|000007b0| 73 20 75 70 0d 20 20 20 | 20 73 6f 6d 65 20 6d 65 |s up. | some me|
|000007c0| 6d 6f 72 79 20 0d 0d 53 | 65 74 50 6f 72 74 20 73 |mory ..S|etPort s|
|000007d0| 74 72 61 74 65 67 79 3a | 0d 0d 20 20 20 20 54 6f |trategy:|.. To|
|000007e0| 6f 6c 62 6f 78 20 72 6f | 75 74 69 6e 65 73 20 64 |olbox ro|utines d|
|000007f0| 6f 20 6e 6f 74 20 63 68 | 61 6e 67 65 20 74 68 65 |o not ch|ange the|
|00000800| 20 63 75 72 72 65 6e 74 | 20 70 6f 72 74 2e 20 49 | current| port. I|
|00000810| 6e 0d 20 20 20 20 73 70 | 69 74 65 20 6f 66 20 74 |n. sp|ite of t|
|00000820| 68 69 73 2c 20 69 6e 20 | 74 68 69 73 20 70 72 6f |his, in |this pro|
|00000830| 67 72 61 6d 20 77 65 20 | 75 73 65 20 61 20 73 74 |gram we |use a st|
|00000840| 72 61 74 65 67 79 20 6f | 66 0d 20 20 20 20 63 61 |rategy o|f. ca|
|00000850| 6c 6c 69 6e 67 20 53 65 | 74 50 6f 72 74 20 77 68 |lling Se|tPort wh|
|00000860| 65 6e 65 76 65 72 20 77 | 65 20 77 61 6e 74 20 74 |enever w|e want t|
|00000870| 6f 20 64 72 61 77 20 6f | 72 20 6d 61 6b 65 20 63 |o draw o|r make c|
|00000880| 61 6c 6c 73 0d 20 20 20 | 20 77 68 69 63 68 20 64 |alls. | which d|
|00000890| 65 70 65 6e 64 20 6f 6e | 20 74 68 65 20 63 75 72 |epend on| the cur|
|000008a0| 72 65 6e 74 20 70 6f 72 | 74 2e 20 54 68 69 73 20 |rent por|t. This |
|000008b0| 6d 61 6b 65 73 20 75 73 | 20 6c 65 73 73 0d 20 20 |makes us| less. |
|000008c0| 20 20 76 75 6c 6e 65 72 | 61 62 6c 65 20 74 6f 20 | vulner|able to |
|000008d0| 62 75 67 73 20 69 6e 20 | 6f 74 68 65 72 20 73 6f |bugs in |other so|
|000008e0| 66 74 77 61 72 65 20 77 | 68 69 63 68 20 6d 69 67 |ftware w|hich mig|
|000008f0| 68 74 20 61 6c 74 65 72 | 0d 20 20 20 20 74 68 65 |ht alter|. the|
|00000900| 20 63 75 72 72 65 6e 74 | 20 70 6f 72 74 20 28 73 | current| port (s|
|00000910| 75 63 68 20 61 73 20 74 | 68 65 20 62 75 67 20 28 |uch as t|he bug (|
|00000920| 66 65 61 74 75 72 65 3f | 29 20 69 6e 20 6d 61 6e |feature?|) in man|
|00000930| 79 0d 20 20 20 20 64 65 | 73 6b 20 61 63 63 65 73 |y. de|sk acces|
|00000940| 73 6f 72 69 65 73 20 77 | 68 69 63 68 20 63 68 61 |sories w|hich cha|
|00000950| 6e 67 65 20 74 68 65 20 | 70 6f 72 74 20 6f 6e 20 |nge the |port on |
|00000960| 4f 70 65 6e 44 65 73 6b | 41 63 63 29 2e 0d 20 20 |OpenDesk|Acc).. |
|00000970| 20 20 48 6f 70 65 66 75 | 6c 6c 79 2c 20 74 68 69 | Hopefu|lly, thi|
|00000980| 73 20 61 6c 73 6f 20 6d | 61 6b 65 73 20 74 68 65 |s also m|akes the|
|00000990| 20 72 6f 75 74 69 6e 65 | 73 20 66 72 6f 6d 20 74 | routine|s from t|
|000009a0| 68 69 73 0d 20 20 20 20 | 70 72 6f 67 72 61 6d 20 |his. |program |
|000009b0| 6d 6f 72 65 20 73 65 6c | 66 2d 63 6f 6e 74 61 69 |more sel|f-contai|
|000009c0| 6e 65 64 2c 20 73 69 6e | 63 65 20 74 68 65 79 20 |ned, sin|ce they |
|000009d0| 64 6f 6e 27 74 20 64 65 | 70 65 6e 64 20 6f 6e 0d |don't de|pend on.|
|000009e0| 20 20 20 20 74 68 65 20 | 63 75 72 72 65 6e 74 20 | the |current |
|000009f0| 70 6f 72 74 20 73 65 74 | 74 69 6e 67 2e 20 0d 0d |port set|ting. ..|
|00000a00| 43 6c 69 70 62 6f 61 72 | 64 20 73 74 72 61 74 65 |Clipboar|d strate|
|00000a10| 67 79 3a 0d 0d 20 20 20 | 20 54 68 69 73 20 70 72 |gy:.. | This pr|
|00000a20| 6f 67 72 61 6d 20 64 6f | 65 73 20 6e 6f 74 20 6d |ogram do|es not m|
|00000a30| 61 69 6e 74 61 69 6e 20 | 61 20 70 72 69 76 61 74 |aintain |a privat|
|00000a40| 65 20 73 63 72 61 70 2e | 0d 20 20 20 20 57 68 65 |e scrap.|. Whe|
|00000a50| 6e 65 76 65 72 20 61 20 | 63 75 74 2c 20 63 6f 70 |never a |cut, cop|
|00000a60| 79 2c 20 6f 72 20 70 61 | 73 74 65 20 6f 63 63 75 |y, or pa|ste occu|
|00000a70| 72 73 2c 20 77 65 20 69 | 6d 70 6f 72 74 2f 65 78 |rs, we i|mport/ex|
|00000a80| 70 6f 72 74 0d 20 20 20 | 20 66 72 6f 6d 20 74 68 |port. | from th|
|00000a90| 65 20 70 75 62 6c 69 63 | 20 73 63 72 61 70 20 74 |e public| scrap t|
|00000aa0| 6f 20 54 65 78 74 45 64 | 69 74 27 73 20 73 63 72 |o TextEd|it's scr|
|00000ab0| 61 70 20 72 69 67 68 74 | 20 61 77 61 79 2c 0d 20 |ap right| away,. |
|00000ac0| 20 20 20 75 73 69 6e 67 | 20 74 68 65 20 54 45 54 | using| the TET|
|00000ad0| 6f 53 63 72 61 70 20 61 | 6e 64 20 54 45 46 72 6f |oScrap a|nd TEFro|
|00000ae0| 6d 53 63 72 61 70 20 72 | 6f 75 74 69 6e 65 73 2e |mScrap r|outines.|
|00000af0| 20 49 66 20 77 65 20 64 | 69 64 0d 20 20 20 20 75 | If we d|id. u|
|00000b00| 73 65 20 61 20 70 72 69 | 76 61 74 65 20 73 63 72 |se a pri|vate scr|
|00000b10| 61 70 2c 20 74 68 65 20 | 69 6d 70 6f 72 74 2f 65 |ap, the |import/e|
|00000b20| 78 70 6f 72 74 20 77 6f | 75 6c 64 20 62 65 20 69 |xport wo|uld be i|
|00000b30| 6e 20 74 68 65 0d 20 20 | 20 20 61 63 74 69 76 61 |n the. | activa|
|00000b40| 74 65 2f 64 65 61 63 74 | 69 76 61 74 65 20 65 76 |te/deact|ivate ev|
|00000b50| 65 6e 74 20 61 6e 64 20 | 73 75 73 70 65 6e 64 2f |ent and |suspend/|
|00000b60| 72 65 73 75 6d 65 20 65 | 76 65 6e 74 0d 20 20 20 |resume e|vent. |
|00000b70| 20 72 6f 75 74 69 6e 65 | 73 2e 20 0d 2a 2f 0d 0d | routine|s. .*/..|
|00000b80| 2f 2f 20 4d 61 63 20 49 | 6e 63 6c 75 64 65 73 0d |// Mac I|ncludes.|
|00000b90| 23 69 6e 63 6c 75 64 65 | 20 3c 54 79 70 65 73 2e |#include| <Types.|
|00000ba0| 68 3e 0d 23 69 6e 63 6c | 75 64 65 20 3c 51 75 69 |h>.#incl|ude <Qui|
|00000bb0| 63 6b 44 72 61 77 2e 68 | 3e 0d 23 69 6e 63 6c 75 |ckDraw.h|>.#inclu|
|00000bc0| 64 65 20 3c 46 6f 6e 74 | 73 2e 68 3e 0d 23 69 6e |de <Font|s.h>.#in|
|00000bd0| 63 6c 75 64 65 20 3c 45 | 76 65 6e 74 73 2e 68 3e |clude <E|vents.h>|
|00000be0| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 43 6f 6e 74 72 |.#includ|e <Contr|
|00000bf0| 6f 6c 73 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |ols.h>.#|include |
|00000c00| 3c 57 69 6e 64 6f 77 73 | 2e 68 3e 0d 23 69 6e 63 |<Windows|.h>.#inc|
|00000c10| 6c 75 64 65 20 3c 4d 65 | 6e 75 73 2e 68 3e 0d 23 |lude <Me|nus.h>.#|
|00000c20| 69 6e 63 6c 75 64 65 20 | 3c 54 65 78 74 45 64 69 |include |<TextEdi|
|00000c30| 74 2e 68 3e 0d 23 69 6e | 63 6c 75 64 65 20 3c 44 |t.h>.#in|clude <D|
|00000c40| 69 61 6c 6f 67 73 2e 68 | 3e 0d 23 69 6e 63 6c 75 |ialogs.h|>.#inclu|
|00000c50| 64 65 20 3c 44 65 73 6b | 2e 68 3e 0d 23 69 6e 63 |de <Desk|.h>.#inc|
|00000c60| 6c 75 64 65 20 3c 53 63 | 72 61 70 2e 68 3e 0d 23 |lude <Sc|rap.h>.#|
|00000c70| 69 6e 63 6c 75 64 65 20 | 3c 54 6f 6f 6c 55 74 69 |include |<ToolUti|
|00000c80| 6c 73 2e 68 3e 0d 23 69 | 6e 63 6c 75 64 65 20 3c |ls.h>.#i|nclude <|
|00000c90| 4d 65 6d 6f 72 79 2e 68 | 3e 0d 23 69 6e 63 6c 75 |Memory.h|>.#inclu|
|00000ca0| 64 65 20 3c 53 65 67 4c | 6f 61 64 2e 68 3e 0d 23 |de <SegL|oad.h>.#|
|00000cb0| 69 6e 63 6c 75 64 65 20 | 3c 46 69 6c 65 73 2e 68 |include |<Files.h|
|00000cc0| 3e 0d 23 69 6e 63 6c 75 | 64 65 20 3c 4f 53 55 74 |>.#inclu|de <OSUt|
|00000cd0| 69 6c 73 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |ils.h>.#|include |
|00000ce0| 3c 54 72 61 70 73 2e 68 | 3e 0d 0d 23 69 6e 63 6c |<Traps.h|>..#incl|
|00000cf0| 75 64 65 20 22 54 45 44 | 6f 63 75 6d 65 6e 74 2e |ude "TED|ocument.|
|00000d00| 68 22 0d 23 69 6e 63 6c | 75 64 65 20 22 54 45 53 |h".#incl|ude "TES|
|00000d10| 61 6d 70 6c 65 2e 68 22 | 0d 0d 65 78 74 65 72 6e |ample.h"|..extern|
|00000d20| 20 22 43 22 20 7b 20 0d | 09 2f 2f 20 70 72 6f 74 | "C" { .|.// prot|
|00000d30| 6f 74 79 70 65 73 20 66 | 6f 72 20 66 75 6e 63 74 |otypes f|or funct|
|00000d40| 69 6f 6e 73 20 74 68 61 | 74 20 64 6f 6e 27 74 20 |ions tha|t don't |
|00000d50| 62 65 6c 6f 6e 67 20 74 | 6f 20 61 6e 79 20 6f 6e |belong t|o any on|
|00000d60| 65 20 63 6c 61 73 73 0d | 09 70 61 73 63 61 6c 20 |e class.|.pascal |
|00000d70| 43 6c 69 6b 4c 6f 6f 70 | 50 72 6f 63 50 74 72 20 |ClikLoop|ProcPtr |
|00000d80| 47 65 74 4f 6c 64 43 6c | 69 6b 4c 6f 6f 70 28 76 |GetOldCl|ikLoop(v|
|00000d90| 6f 69 64 29 3b 0d 09 70 | 61 73 63 61 6c 20 76 6f |oid);..p|ascal vo|
|00000da0| 69 64 20 50 61 73 63 61 | 6c 43 6c 69 6b 4c 6f 6f |id Pasca|lClikLoo|
|00000db0| 70 28 76 6f 69 64 29 3b | 0d 09 76 6f 69 64 20 43 |p(void);|..void C|
|00000dc0| 6f 6d 6d 6f 6e 41 63 74 | 69 6f 6e 28 43 6f 6e 74 |ommonAct|ion(Cont|
|00000dd0| 72 6f 6c 48 61 6e 64 6c | 65 20 63 6f 6e 74 72 6f |rolHandl|e contro|
|00000de0| 6c 2c 73 68 6f 72 74 2a | 20 61 6d 6f 75 6e 74 29 |l,short*| amount)|
|00000df0| 3b 0d 09 70 61 73 63 61 | 6c 20 76 6f 69 64 20 56 |;..pasca|l void V|
|00000e00| 41 63 74 69 6f 6e 50 72 | 6f 63 28 43 6f 6e 74 72 |ActionPr|oc(Contr|
|00000e10| 6f 6c 48 61 6e 64 6c 65 | 20 63 6f 6e 74 72 6f 6c |olHandle| control|
|00000e20| 2c 73 68 6f 72 74 20 70 | 61 72 74 29 3b 0d 09 70 |,short p|art);..p|
|00000e30| 61 73 63 61 6c 20 76 6f | 69 64 20 48 41 63 74 69 |ascal vo|id HActi|
|00000e40| 6f 6e 50 72 6f 63 28 43 | 6f 6e 74 72 6f 6c 48 61 |onProc(C|ontrolHa|
|00000e50| 6e 64 6c 65 20 63 6f 6e | 74 72 6f 6c 2c 73 68 6f |ndle con|trol,sho|
|00000e60| 72 74 20 70 61 72 74 29 | 3b 0d 09 2f 2f 20 74 68 |rt part)|;..// th|
|00000e70| 69 73 20 72 6f 75 74 69 | 6e 65 20 69 73 20 77 72 |is routi|ne is wr|
|00000e80| 69 74 74 65 6e 20 69 6e | 20 41 73 73 65 6d 62 6c |itten in| Assembl|
|00000e90| 65 72 2c 20 73 69 6e 63 | 65 20 69 74 20 6e 65 65 |er, sinc|e it nee|
|00000ea0| 64 73 20 74 6f 20 74 77 | 65 61 6b 20 72 65 67 69 |ds to tw|eak regi|
|00000eb0| 73 74 65 72 73 0d 09 76 | 6f 69 64 20 41 53 4d 43 |sters..v|oid ASMC|
|00000ec0| 4c 49 4b 4c 4f 4f 50 28 | 29 3b 0d 7d 3b 0d 0d 2f |LIKLOOP(|);.};../|
|00000ed0| 2f 20 6b 54 65 78 74 4d | 61 72 67 69 6e 20 69 73 |/ kTextM|argin is|
|00000ee0| 20 74 68 65 20 6e 75 6d | 62 65 72 20 6f 66 20 70 | the num|ber of p|
|00000ef0| 69 78 65 6c 73 20 77 65 | 20 6c 65 61 76 65 20 62 |ixels we| leave b|
|00000f00| 6c 61 6e 6b 20 61 74 20 | 74 68 65 20 65 64 67 65 |lank at |the edge|
|00000f10| 20 6f 66 20 74 68 65 20 | 77 69 6e 64 6f 77 2e 0d | of the |window..|
|00000f20| 63 6f 6e 73 74 20 73 68 | 6f 72 74 20 6b 54 65 78 |const sh|ort kTex|
|00000f30| 74 4d 61 72 67 69 6e 20 | 3d 20 32 3b 0d 0d 2f 2f |tMargin |= 2;..//|
|00000f40| 20 6b 4d 61 78 44 6f 63 | 57 69 64 74 68 20 69 73 | kMaxDoc|Width is|
|00000f50| 20 61 6e 20 61 72 62 69 | 74 72 61 72 79 20 6e 75 | an arbi|trary nu|
|00000f60| 6d 62 65 72 20 75 73 65 | 64 20 74 6f 20 73 70 65 |mber use|d to spe|
|00000f70| 63 69 66 79 20 74 68 65 | 20 77 69 64 74 68 20 6f |cify the| width o|
|00000f80| 66 20 74 68 65 20 54 45 | 52 65 63 27 73 0d 2f 2f |f the TE|Rec's.//|
|00000f90| 20 64 65 73 74 69 6e 61 | 74 69 6f 6e 20 72 65 63 | destina|tion rec|
|00000fa0| 74 61 6e 67 6c 65 20 73 | 6f 20 74 68 61 74 20 77 |tangle s|o that w|
|00000fb0| 6f 72 64 20 77 72 61 70 | 20 61 6e 64 20 68 6f 72 |ord wrap| and hor|
|00000fc0| 69 7a 6f 6e 74 61 6c 20 | 73 63 72 6f 6c 6c 69 6e |izontal |scrollin|
|00000fd0| 67 20 63 61 6e 20 62 65 | 0d 2f 2f 20 64 65 6d 6f |g can be|.// demo|
|00000fe0| 6e 73 74 72 61 74 65 64 | 2e 0d 63 6f 6e 73 74 20 |nstrated|..const |
|00000ff0| 73 68 6f 72 74 09 6b 4d | 61 78 44 6f 63 57 69 64 |short.kM|axDocWid|
|00001000| 74 68 20 3d 20 35 37 36 | 3b 0d 09 0d 2f 2f 20 6b |th = 576|;...// k|
|00001010| 4d 69 6e 44 6f 63 44 69 | 6d 20 69 73 20 75 73 65 |MinDocDi|m is use|
|00001020| 64 20 74 6f 20 6c 69 6d | 69 74 20 74 68 65 20 6d |d to lim|it the m|
|00001030| 69 6e 69 6d 75 6d 20 64 | 69 6d 65 6e 73 69 6f 6e |inimum d|imension|
|00001040| 20 6f 66 20 61 20 77 69 | 6e 64 6f 77 20 77 68 65 | of a wi|ndow whe|
|00001050| 6e 20 47 72 6f 77 57 69 | 6e 64 6f 77 0d 2f 2f 20 |n GrowWi|ndow.// |
|00001060| 69 73 20 63 61 6c 6c 65 | 64 2e 0d 63 6f 6e 73 74 |is calle|d..const|
|00001070| 20 73 68 6f 72 74 09 6b | 4d 69 6e 44 6f 63 44 69 | short.k|MinDocDi|
|00001080| 6d 20 3d 20 36 34 3b 0d | 09 0d 2f 2f 20 6b 4d 61 |m = 64;.|..// kMa|
|00001090| 78 54 45 4c 65 6e 67 74 | 68 20 69 73 20 61 6e 20 |xTELengt|h is an |
|000010a0| 61 72 62 69 74 72 61 72 | 79 20 6e 75 6d 62 65 72 |arbitrar|y number|
|000010b0| 20 75 73 65 64 20 74 6f | 20 6c 69 6d 69 74 20 74 | used to| limit t|
|000010c0| 68 65 20 6c 65 6e 67 74 | 68 20 6f 66 20 74 65 78 |he lengt|h of tex|
|000010d0| 74 20 69 6e 20 74 68 65 | 20 54 45 52 65 63 0d 2f |t in the| TERec./|
|000010e0| 2f 20 73 6f 20 74 68 61 | 74 20 76 61 72 69 6f 75 |/ so tha|t variou|
|000010f0| 73 20 65 72 72 6f 72 73 | 20 77 6f 6e 27 74 20 6f |s errors| won't o|
|00001100| 63 63 75 72 20 66 72 6f | 6d 20 74 6f 6f 20 6d 61 |ccur fro|m too ma|
|00001110| 6e 79 20 63 68 61 72 61 | 63 74 65 72 73 20 62 65 |ny chara|cters be|
|00001120| 69 6e 67 20 69 6e 20 74 | 68 65 20 74 65 78 74 2e |ing in t|he text.|
|00001130| 0d 63 6f 6e 73 74 20 73 | 68 6f 72 74 09 6b 4d 61 |.const s|hort.kMa|
|00001140| 78 54 45 4c 65 6e 67 74 | 68 20 3d 20 33 32 30 30 |xTELengt|h = 3200|
|00001150| 30 3b 0d 0d 2f 2f 20 6b | 43 6f 6e 74 72 6f 6c 49 |0;..// k|ControlI|
|00001160| 6e 76 69 73 69 62 6c 65 | 20 69 73 20 75 73 65 64 |nvisible| is used|
|00001170| 20 74 68 65 20 73 61 6d | 65 20 77 61 79 20 74 6f | the sam|e way to|
|00001180| 20 27 74 75 72 6e 20 6f | 6e 27 20 74 68 65 20 63 | 'turn o|n' the c|
|00001190| 6f 6e 74 72 6f 6c 2e 0d | 63 6f 6e 73 74 20 73 68 |ontrol..|const sh|
|000011a0| 6f 72 74 20 6b 43 6f 6e | 74 72 6f 6c 56 69 73 69 |ort kCon|trolVisi|
|000011b0| 62 6c 65 20 3d 20 30 78 | 46 46 3b 0d 0d 2f 2f 20 |ble = 0x|FF;..// |
|000011c0| 53 63 72 6f 6c 6c 42 61 | 72 41 64 6a 75 73 74 2c |ScrollBa|rAdjust,|
|000011d0| 20 47 72 6f 77 42 6f 78 | 41 64 6a 75 73 74 2c 20 | GrowBox|Adjust, |
|000011e0| 61 6e 64 20 53 63 72 6f | 6c 6c 42 61 72 20 77 69 |and Scro|llBar wi|
|000011f0| 64 74 68 20 61 72 65 20 | 75 73 65 64 20 69 6e 20 |dth are |used in |
|00001200| 63 61 6c 63 75 6c 61 74 | 69 6e 67 0d 2f 2f 20 76 |calculat|ing.// v|
|00001210| 61 6c 75 65 73 20 66 6f | 72 20 63 6f 6e 74 72 6f |alues fo|r contro|
|00001220| 6c 20 70 6f 73 69 74 69 | 6f 6e 69 6e 67 20 61 6e |l positi|oning an|
|00001230| 64 20 73 69 7a 69 6e 67 | 2e 0d 63 6f 6e 73 74 20 |d sizing|..const |
|00001240| 73 68 6f 72 74 20 6b 53 | 63 72 6f 6c 6c 62 61 72 |short kS|crollbar|
|00001250| 41 64 6a 75 73 74 20 3d | 20 31 35 3b 0d 63 6f 6e |Adjust =| 15;.con|
|00001260| 73 74 20 73 68 6f 72 74 | 20 6b 47 72 6f 77 62 6f |st short| kGrowbo|
|00001270| 78 41 64 6a 75 73 74 20 | 3d 20 31 35 3b 0d 63 6f |xAdjust |= 15;.co|
|00001280| 6e 73 74 20 73 68 6f 72 | 74 20 6b 53 63 72 6f 6c |nst shor|t kScrol|
|00001290| 6c 62 61 72 57 69 64 74 | 68 20 3d 20 31 36 3b 0d |lbarWidt|h = 16;.|
|000012a0| 0d 2f 2f 20 6b 54 45 53 | 6c 6f 70 20 70 72 6f 76 |.// kTES|lop prov|
|000012b0| 69 64 65 73 20 73 6f 6d | 65 20 65 78 74 72 61 20 |ides som|e extra |
|000012c0| 73 65 63 75 72 69 74 79 | 20 77 68 65 6e 20 70 72 |security| when pr|
|000012d0| 65 2d 66 6c 69 67 68 74 | 69 6e 67 20 65 64 69 74 |e-flight|ing edit|
|000012e0| 20 63 6f 6d 6d 61 6e 64 | 73 2e 0d 63 6f 6e 73 74 | command|s..const|
|000012f0| 20 73 68 6f 72 74 20 6b | 54 45 53 6c 6f 70 20 3d | short k|TESlop =|
|00001300| 20 31 30 32 34 3b 0d 0d | 2f 2f 20 6b 53 63 72 6f | 1024;..|// kScro|
|00001310| 6c 6c 54 77 65 65 6b 20 | 63 6f 6d 70 65 6e 73 61 |llTweek |compensa|
|00001320| 74 65 73 20 66 6f 72 20 | 6f 66 66 2d 62 79 2d 6f |tes for |off-by-o|
|00001330| 6e 65 20 72 65 71 75 69 | 72 65 6d 65 6e 74 73 20 |ne requi|rements |
|00001340| 6f 66 20 74 68 65 20 73 | 63 72 6f 6c 6c 62 61 72 |of the s|crollbar|
|00001350| 73 0d 2f 2f 20 74 6f 20 | 68 61 76 65 20 62 6f 72 |s.// to |have bor|
|00001360| 64 65 72 73 20 63 6f 69 | 6e 63 69 64 65 20 77 69 |ders coi|ncide wi|
|00001370| 74 68 20 74 68 65 20 67 | 72 6f 77 62 6f 78 2e 0d |th the g|rowbox..|
|00001380| 63 6f 6e 73 74 20 73 68 | 6f 72 74 20 6b 53 63 72 |const sh|ort kScr|
|00001390| 6f 6c 6c 54 77 65 65 6b | 20 3d 20 32 3b 0d 09 0d |ollTweek| = 2;...|
|000013a0| 2f 2f 20 6b 43 72 43 68 | 61 72 20 69 73 20 75 73 |// kCrCh|ar is us|
|000013b0| 65 64 20 74 6f 20 6d 61 | 74 63 68 20 77 69 74 68 |ed to ma|tch with|
|000013c0| 20 61 20 63 61 72 72 69 | 61 67 65 20 72 65 74 75 | a carri|age retu|
|000013d0| 72 6e 20 77 68 65 6e 20 | 63 61 6c 63 75 6c 61 74 |rn when |calculat|
|000013e0| 69 6e 67 20 74 68 65 0d | 2f 2f 20 6e 75 6d 62 65 |ing the.|// numbe|
|000013f0| 72 20 6f 66 20 6c 69 6e | 65 73 20 69 6e 20 74 68 |r of lin|es in th|
|00001400| 65 20 54 65 78 74 45 64 | 69 74 20 72 65 63 6f 72 |e TextEd|it recor|
|00001410| 64 2e 20 6b 44 65 6c 43 | 68 61 72 20 69 73 20 75 |d. kDelC|har is u|
|00001420| 73 65 64 20 74 6f 20 63 | 68 65 63 6b 20 66 6f 72 |sed to c|heck for|
|00001430| 0d 2f 2f 20 64 65 6c 65 | 74 65 20 69 6e 20 6b 65 |.// dele|te in ke|
|00001440| 79 44 6f 77 6e 73 2e 0d | 63 6f 6e 73 74 20 73 68 |yDowns..|const sh|
|00001450| 6f 72 74 20 6b 43 72 43 | 68 61 72 20 3d 20 31 33 |ort kCrC|har = 13|
|00001460| 3b 0d 63 6f 6e 73 74 20 | 73 68 6f 72 74 20 6b 44 |;.const |short kD|
|00001470| 65 6c 43 68 61 72 20 3d | 20 38 3b 0d 0d 2f 2f 20 |elChar =| 8;..// |
|00001480| 44 65 66 69 6e 65 20 48 | 69 57 72 64 20 61 6e 64 |Define H|iWrd and|
|00001490| 20 4c 6f 57 72 64 20 6d | 61 63 72 6f 73 20 66 6f | LoWrd m|acros fo|
|000014a0| 72 20 65 66 66 69 63 69 | 65 6e 63 79 2e 0d 23 64 |r effici|ency..#d|
|000014b0| 65 66 69 6e 65 20 48 69 | 57 72 64 28 61 4c 6f 6e |efine Hi|Wrd(aLon|
|000014c0| 67 29 09 28 28 28 61 4c | 6f 6e 67 29 20 3e 3e 20 |g).(((aL|ong) >> |
|000014d0| 31 36 29 20 26 20 30 78 | 46 46 46 46 29 0d 23 64 |16) & 0x|FFFF).#d|
|000014e0| 65 66 69 6e 65 20 4c 6f | 57 72 64 28 61 4c 6f 6e |efine Lo|Wrd(aLon|
|000014f0| 67 29 09 28 28 61 4c 6f | 6e 67 29 20 26 20 30 78 |g).((aLo|ng) & 0x|
|00001500| 46 46 46 46 29 0d 0d 2f | 2f 20 44 65 66 69 6e 65 |FFFF)../|/ Define|
|00001510| 20 54 6f 70 4c 65 66 74 | 20 61 6e 64 20 42 6f 74 | TopLeft| and Bot|
|00001520| 52 69 67 68 74 20 6d 61 | 63 72 6f 73 20 66 6f 72 |Right ma|cros for|
|00001530| 20 63 6f 6e 76 65 6e 69 | 65 6e 63 65 2e 20 4e 6f | conveni|ence. No|
|00001540| 74 69 63 65 20 74 68 65 | 20 69 6d 70 6c 69 63 69 |tice the| implici|
|00001550| 74 0d 2f 2f 20 64 65 70 | 65 6e 64 65 6e 63 79 20 |t.// dep|endency |
|00001560| 6f 6e 20 74 68 65 20 6f | 72 64 65 72 69 6e 67 20 |on the o|rdering |
|00001570| 6f 66 20 66 69 65 6c 64 | 73 20 77 69 74 68 69 6e |of field|s within|
|00001580| 20 61 20 52 65 63 74 0d | 23 64 65 66 69 6e 65 20 | a Rect.|#define |
|00001590| 54 6f 70 4c 65 66 74 28 | 61 52 65 63 74 29 09 28 |TopLeft(|aRect).(|
|000015a0| 2a 20 28 50 6f 69 6e 74 | 20 2a 29 20 26 28 61 52 |* (Point| *) &(aR|
|000015b0| 65 63 74 29 2e 74 6f 70 | 29 0d 23 64 65 66 69 6e |ect).top|).#defin|
|000015c0| 65 20 42 6f 74 52 69 67 | 68 74 28 61 52 65 63 74 |e BotRig|ht(aRect|
|000015d0| 29 09 28 2a 20 28 50 6f | 69 6e 74 20 2a 29 20 26 |).(* (Po|int *) &|
|000015e0| 28 61 52 65 63 74 29 2e | 62 6f 74 74 6f 6d 29 0d |(aRect).|bottom).|
|000015f0| 0d 2f 2f 20 6e 6f 74 69 | 63 65 20 74 68 61 74 20 |.// noti|ce that |
|00001600| 77 65 20 70 61 73 73 20 | 74 68 65 20 72 65 73 49 |we pass |the resI|
|00001610| 44 20 70 61 72 61 6d 65 | 74 65 72 20 75 70 20 74 |D parame|ter up t|
|00001620| 6f 20 6f 75 72 20 62 61 | 73 65 20 63 6c 61 73 73 |o our ba|se class|
|00001630| 2c 0d 2f 2f 20 77 68 69 | 63 68 20 61 63 74 75 61 |,.// whi|ch actua|
|00001640| 6c 6c 79 20 63 72 65 61 | 74 65 73 20 74 68 65 20 |lly crea|tes the |
|00001650| 77 69 6e 64 6f 77 20 66 | 6f 72 20 75 73 0d 54 45 |window f|or us.TE|
|00001660| 44 6f 63 75 6d 65 6e 74 | 3a 3a 54 45 44 6f 63 75 |Document|::TEDocu|
|00001670| 6d 65 6e 74 28 73 68 6f | 72 74 20 72 65 73 49 44 |ment(sho|rt resID|
|00001680| 29 09 3a 20 28 72 65 73 | 49 44 29 0d 7b 0d 09 42 |).: (res|ID).{..B|
|00001690| 6f 6f 6c 65 61 6e 20 67 | 6f 6f 64 3b 0d 09 52 65 |oolean g|ood;..Re|
|000016a0| 63 74 20 64 65 73 74 52 | 65 63 74 2c 20 76 69 65 |ct destR|ect, vie|
|000016b0| 77 52 65 63 74 3b 0d 0d | 09 67 6f 6f 64 20 3d 20 |wRect;..|.good = |
|000016c0| 66 61 6c 73 65 3b 0d 09 | 53 65 74 50 6f 72 74 28 |false;..|SetPort(|
|000016d0| 66 44 6f 63 57 69 6e 64 | 6f 77 29 3b 0d 09 47 65 |fDocWind|ow);..Ge|
|000016e0| 74 54 45 52 65 63 74 28 | 26 76 69 65 77 52 65 63 |tTERect(|&viewRec|
|000016f0| 74 29 3b 0d 09 64 65 73 | 74 52 65 63 74 20 3d 20 |t);..des|tRect = |
|00001700| 76 69 65 77 52 65 63 74 | 3b 0d 09 64 65 73 74 52 |viewRect|;..destR|
|00001710| 65 63 74 2e 72 69 67 68 | 74 20 3d 20 64 65 73 74 |ect.righ|t = dest|
|00001720| 52 65 63 74 2e 6c 65 66 | 74 20 2b 20 6b 4d 61 78 |Rect.lef|t + kMax|
|00001730| 44 6f 63 57 69 64 74 68 | 3b 0d 09 66 44 6f 63 54 |DocWidth|;..fDocT|
|00001740| 45 20 3d 20 54 45 4e 65 | 77 28 26 64 65 73 74 52 |E = TENe|w(&destR|
|00001750| 65 63 74 2c 20 26 76 69 | 65 77 52 65 63 74 29 3b |ect, &vi|ewRect);|
|00001760| 0d 09 0d 09 67 6f 6f 64 | 20 3d 20 66 44 6f 63 54 |....good| = fDocT|
|00001770| 45 20 21 3d 20 6e 69 6c | 3b 09 2f 2f 20 69 66 20 |E != nil|;.// if |
|00001780| 54 45 4e 65 77 20 73 75 | 63 63 65 65 64 65 64 2c |TENew su|cceeded,|
|00001790| 20 77 65 20 68 61 76 65 | 20 61 20 67 6f 6f 64 20 | we have| a good |
|000017a0| 64 6f 63 75 6d 65 6e 74 | 20 0d 0d 09 69 66 20 28 |document| ...if (|
|000017b0| 20 67 6f 6f 64 20 29 0d | 09 20 20 7b 0d 09 09 2f | good ).|. {.../|
|000017c0| 2f 20 73 65 74 20 75 70 | 20 54 45 20 72 65 63 6f |/ set up| TE reco|
|000017d0| 72 64 0d 09 09 41 64 6a | 75 73 74 56 69 65 77 52 |rd...Adj|ustViewR|
|000017e0| 65 63 74 28 29 3b 0d 09 | 09 54 45 41 75 74 6f 56 |ect();..|.TEAutoV|
|000017f0| 69 65 77 28 74 72 75 65 | 2c 20 66 44 6f 63 54 45 |iew(true|, fDocTE|
|00001800| 29 3b 0d 09 09 66 44 6f | 63 43 6c 69 6b 20 3d 20 |);...fDo|cClik = |
|00001810| 28 2a 66 44 6f 63 54 45 | 29 2d 3e 63 6c 69 6b 4c |(*fDocTE|)->clikL|
|00001820| 6f 6f 70 3b 0d 09 09 28 | 2a 66 44 6f 63 54 45 29 |oop;...(|*fDocTE)|
|00001830| 2d 3e 63 6c 69 6b 4c 6f | 6f 70 20 3d 20 28 43 6c |->clikLo|op = (Cl|
|00001840| 69 6b 4c 6f 6f 70 50 72 | 6f 63 50 74 72 29 20 41 |ikLoopPr|ocPtr) A|
|00001850| 53 4d 43 4c 49 4b 4c 4f | 4f 50 3b 0d 0d 09 09 2f |SMCLIKLO|OP;..../|
|00001860| 2f 20 67 65 74 20 76 65 | 72 74 69 63 61 6c 20 73 |/ get ve|rtical s|
|00001870| 63 72 6f 6c 6c 62 61 72 | 0d 09 09 66 44 6f 63 56 |crollbar|...fDocV|
|00001880| 53 63 72 6f 6c 6c 20 3d | 20 47 65 74 4e 65 77 43 |Scroll =| GetNewC|
|00001890| 6f 6e 74 72 6f 6c 28 72 | 56 53 63 72 6f 6c 6c 2c |ontrol(r|VScroll,|
|000018a0| 20 66 44 6f 63 57 69 6e | 64 6f 77 29 3b 0d 09 09 | fDocWin|dow);...|
|000018b0| 67 6f 6f 64 20 3d 20 28 | 66 44 6f 63 56 53 63 72 |good = (|fDocVScr|
|000018c0| 6f 6c 6c 20 21 3d 20 6e | 69 6c 29 3b 0d 09 20 20 |oll != n|il);.. |
|000018d0| 7d 0d 09 69 66 20 28 20 | 67 6f 6f 64 29 0d 09 20 |}..if ( |good).. |
|000018e0| 20 7b 0d 09 09 66 44 6f | 63 48 53 63 72 6f 6c 6c | {...fDo|cHScroll|
|000018f0| 20 3d 20 47 65 74 4e 65 | 77 43 6f 6e 74 72 6f 6c | = GetNe|wControl|
|00001900| 28 72 48 53 63 72 6f 6c | 6c 2c 20 66 44 6f 63 57 |(rHScrol|l, fDocW|
|00001910| 69 6e 64 6f 77 29 3b 0d | 09 09 67 6f 6f 64 20 3d |indow);.|..good =|
|00001920| 20 28 66 44 6f 63 48 53 | 63 72 6f 6c 6c 20 21 3d | (fDocHS|croll !=|
|00001930| 20 6e 69 6c 29 3b 0d 09 | 20 20 7d 0d 09 0d 09 69 | nil);..| }....i|
|00001940| 66 20 28 20 67 6f 6f 64 | 20 29 09 09 09 09 2f 2f |f ( good| )....//|
|00001950| 20 67 6f 6f 64 3f 20 d1 | 20 61 64 6a 75 73 74 20 | good? .| adjust |
|00001960| 26 20 64 72 61 77 20 74 | 68 65 20 63 6f 6e 74 72 |& draw t|he contr|
|00001970| 6f 6c 73 2c 20 64 72 61 | 77 20 74 68 65 20 77 69 |ols, dra|w the wi|
|00001980| 6e 64 6f 77 0d 09 20 20 | 7b 0d 09 09 41 64 6a 75 |ndow.. |{...Adju|
|00001990| 73 74 53 63 72 6f 6c 6c | 56 61 6c 75 65 73 28 74 |stScroll|Values(t|
|000019a0| 72 75 65 29 3b 0d 09 09 | 53 68 6f 77 57 69 6e 64 |rue);...|ShowWind|
|000019b0| 6f 77 28 66 44 6f 63 57 | 69 6e 64 6f 77 29 3b 0d |ow(fDocW|indow);.|
|000019c0| 09 20 20 7d 0d 09 65 6c | 73 65 0d 09 20 20 7b 0d |. }..el|se.. {.|
|000019d0| 09 09 2f 2f 20 74 65 6c | 6c 20 75 73 65 72 20 77 |..// tel|l user w|
|000019e0| 65 20 66 61 69 6c 65 64 | 0d 09 09 41 6c 65 72 74 |e failed|...Alert|
|000019f0| 55 73 65 72 28 6b 54 45 | 44 6f 63 45 72 72 53 74 |User(kTE|DocErrSt|
|00001a00| 72 69 6e 67 73 2c 65 4e | 6f 57 69 6e 64 6f 77 29 |rings,eN|oWindow)|
|00001a10| 3b 20 0d 09 20 20 7d 0d | 7d 0d 0d 2f 2f 20 41 74 |; .. }.|}..// At|
|00001a20| 20 74 68 69 73 20 70 6f | 69 6e 74 2c 20 69 66 20 | this po|int, if |
|00001a30| 74 68 65 72 65 20 77 61 | 73 20 61 20 64 6f 63 75 |there wa|s a docu|
|00001a40| 6d 65 6e 74 20 61 73 73 | 6f 63 69 61 74 65 64 20 |ment ass|ociated |
|00001a50| 77 69 74 68 20 61 0d 2f | 2f 20 77 69 6e 64 6f 77 |with a./|/ window|
|00001a60| 2c 20 79 6f 75 20 63 6f | 75 6c 64 20 64 6f 20 61 |, you co|uld do a|
|00001a70| 6e 79 20 64 6f 63 75 6d | 65 6e 74 20 73 61 76 69 |ny docum|ent savi|
|00001a80| 6e 67 20 70 72 6f 63 65 | 73 73 69 6e 67 20 69 66 |ng proce|ssing if|
|00001a90| 20 69 74 20 69 73 20 27 | 64 69 72 74 79 27 2e 0d | it is '|dirty'..|
|00001aa0| 2f 2f 20 44 6f 43 6c 6f | 73 65 57 69 6e 64 6f 77 |// DoClo|seWindow|
|00001ab0| 20 77 6f 75 6c 64 20 72 | 65 74 75 72 6e 20 74 72 | would r|eturn tr|
|00001ac0| 75 65 20 69 66 20 74 68 | 65 20 77 69 6e 64 6f 77 |ue if th|e window|
|00001ad0| 20 61 63 74 75 61 6c 6c | 79 20 63 6c 6f 73 65 64 | actuall|y closed|
|00001ae0| 2c 20 69 2e 65 2e 2c 0d | 2f 2f 20 74 68 65 20 75 |, i.e.,.|// the u|
|00001af0| 73 65 72 20 64 69 64 6e | d5 74 20 63 61 6e 63 65 |ser didn|.t cance|
|00001b00| 6c 20 66 72 6f 6d 20 61 | 20 73 61 76 65 20 64 69 |l from a| save di|
|00001b10| 61 6c 6f 67 2e 20 54 68 | 69 73 20 72 65 73 75 6c |alog. Th|is resul|
|00001b20| 74 20 69 73 20 68 61 6e | 64 79 20 77 68 65 6e 0d |t is han|dy when.|
|00001b30| 2f 2f 20 74 68 65 20 75 | 73 65 72 20 71 75 69 74 |// the u|ser quit|
|00001b40| 73 20 61 6e 20 61 70 70 | 6c 69 63 61 74 69 6f 6e |s an app|lication|
|00001b50| 2c 20 62 75 74 20 74 68 | 65 6e 20 63 61 6e 63 65 |, but th|en cance|
|00001b60| 6c 73 20 74 68 65 20 73 | 61 76 65 20 6f 66 20 61 |ls the s|ave of a|
|00001b70| 20 64 6f 63 75 6d 65 6e | 74 0d 2f 2f 20 61 73 73 | documen|t.// ass|
|00001b80| 6f 63 69 61 74 65 64 20 | 77 69 74 68 20 61 20 77 |ociated |with a w|
|00001b90| 69 6e 64 6f 77 2e 0d 0d | 54 45 44 6f 63 75 6d 65 |indow...|TEDocume|
|00001ba0| 6e 74 3a 3a 7e 54 45 44 | 6f 63 75 6d 65 6e 74 28 |nt::~TED|ocument(|
|00001bb0| 76 6f 69 64 29 0d 7b 0d | 09 48 69 64 65 57 69 6e |void).{.|.HideWin|
|00001bc0| 64 6f 77 28 66 44 6f 63 | 57 69 6e 64 6f 77 29 3b |dow(fDoc|Window);|
|00001bd0| 0d 09 69 66 20 28 20 66 | 44 6f 63 54 45 20 21 3d |..if ( f|DocTE !=|
|00001be0| 20 6e 69 6c 20 29 0d 09 | 20 20 54 45 44 69 73 70 | nil )..| TEDisp|
|00001bf0| 6f 73 65 28 66 44 6f 63 | 54 45 29 3b 09 09 09 2f |ose(fDoc|TE);.../|
|00001c00| 2f 20 64 69 73 70 6f 73 | 65 20 74 68 65 20 54 45 |/ dispos|e the TE|
|00001c10| 48 61 6e 64 6c 65 20 69 | 66 20 77 65 20 67 6f 74 |Handle i|f we got|
|00001c20| 20 66 61 72 20 65 6e 6f | 75 67 68 20 74 6f 20 6d | far eno|ugh to m|
|00001c30| 61 6b 65 20 6f 6e 65 20 | 0d 09 69 66 20 28 20 66 |ake one |..if ( f|
|00001c40| 44 6f 63 56 53 63 72 6f | 6c 6c 20 21 3d 20 6e 69 |DocVScro|ll != ni|
|00001c50| 6c 20 29 0d 09 20 20 44 | 69 73 70 6f 73 65 43 6f |l ).. D|isposeCo|
|00001c60| 6e 74 72 6f 6c 28 66 44 | 6f 63 56 53 63 72 6f 6c |ntrol(fD|ocVScrol|
|00001c70| 6c 29 3b 0d 09 69 66 20 | 28 20 66 44 6f 63 48 53 |l);..if |( fDocHS|
|00001c80| 63 72 6f 6c 6c 20 21 3d | 20 6e 69 6c 20 29 0d 09 |croll !=| nil )..|
|00001c90| 20 20 44 69 73 70 6f 73 | 65 43 6f 6e 74 72 6f 6c | Dispos|eControl|
|00001ca0| 28 66 44 6f 63 48 53 63 | 72 6f 6c 6c 29 3b 0d 09 |(fDocHSc|roll);..|
|00001cb0| 2f 2f 20 62 61 73 65 20 | 63 6c 61 73 73 20 64 65 |// base |class de|
|00001cc0| 73 74 72 75 63 74 6f 72 | 20 77 69 6c 6c 20 64 69 |structor| will di|
|00001cd0| 73 70 6f 73 65 20 6f 66 | 20 77 69 6e 64 6f 77 0d |spose of| window.|
|00001ce0| 7d 0d 0d 76 6f 69 64 20 | 54 45 44 6f 63 75 6d 65 |}..void |TEDocume|
|00001cf0| 6e 74 3a 3a 44 6f 5a 6f | 6f 6d 28 73 68 6f 72 74 |nt::DoZo|om(short|
|00001d00| 20 70 61 72 74 43 6f 64 | 65 29 0d 7b 0d 09 52 65 | partCod|e).{..Re|
|00001d10| 63 74 20 74 52 65 63 74 | 3b 0d 0d 09 74 52 65 63 |ct tRect|;...tRec|
|00001d20| 74 20 3d 20 66 44 6f 63 | 57 69 6e 64 6f 77 2d 3e |t = fDoc|Window->|
|00001d30| 70 6f 72 74 52 65 63 74 | 3b 0d 09 45 72 61 73 65 |portRect|;..Erase|
|00001d40| 52 65 63 74 28 26 74 52 | 65 63 74 29 3b 0d 09 5a |Rect(&tR|ect);..Z|
|00001d50| 6f 6f 6d 57 69 6e 64 6f | 77 28 66 44 6f 63 57 69 |oomWindo|w(fDocWi|
|00001d60| 6e 64 6f 77 2c 20 70 61 | 72 74 43 6f 64 65 2c 20 |ndow, pa|rtCode, |
|00001d70| 66 44 6f 63 57 69 6e 64 | 6f 77 20 3d 3d 20 46 72 |fDocWind|ow == Fr|
|00001d80| 6f 6e 74 57 69 6e 64 6f | 77 28 29 29 3b 0d 09 41 |ontWindo|w());..A|
|00001d90| 64 6a 75 73 74 53 63 72 | 6f 6c 6c 62 61 72 73 28 |djustScr|ollbars(|
|00001da0| 74 72 75 65 29 3b 09 09 | 2f 2f 20 61 64 6a 75 73 |true);..|// adjus|
|00001db0| 74 2c 20 72 65 64 72 61 | 77 20 61 6e 79 77 61 79 |t, redra|w anyway|
|00001dc0| 20 0d 09 41 64 6a 75 73 | 74 54 45 28 29 3b 0d 09 | ..Adjus|tTE();..|
|00001dd0| 49 6e 76 61 6c 52 65 63 | 74 28 26 74 52 65 63 74 |InvalRec|t(&tRect|
|00001de0| 29 3b 09 09 09 2f 2f 20 | 69 6e 76 61 6c 69 64 61 |);...// |invalida|
|00001df0| 74 65 20 74 68 65 20 77 | 68 6f 6c 65 20 63 6f 6e |te the w|hole con|
|00001e00| 74 65 6e 74 20 0d 09 2f | 2f 20 74 68 65 20 73 63 |tent ../|/ the sc|
|00001e10| 72 6f 6c 6c 62 61 72 73 | 20 77 65 72 65 20 74 61 |rollbars| were ta|
|00001e20| 6b 65 6e 20 63 61 72 65 | 20 6f 66 20 62 79 20 41 |ken care| of by A|
|00001e30| 64 6a 75 73 74 53 63 72 | 6f 6c 6c 62 61 72 73 2c |djustScr|ollbars,|
|00001e40| 20 73 6f 20 76 61 6c 69 | 64 61 74 65 20 d5 65 6d | so vali|date .em|
|00001e50| 20 0d 09 74 52 65 63 74 | 20 3d 20 28 2a 66 44 6f | ..tRect| = (*fDo|
|00001e60| 63 56 53 63 72 6f 6c 6c | 29 2d 3e 63 6f 6e 74 72 |cVScroll|)->contr|
|00001e70| 6c 52 65 63 74 3b 0d 09 | 56 61 6c 69 64 52 65 63 |lRect;..|ValidRec|
|00001e80| 74 28 26 74 52 65 63 74 | 29 3b 0d 09 74 52 65 63 |t(&tRect|);..tRec|
|00001e90| 74 20 3d 20 28 2a 66 44 | 6f 63 48 53 63 72 6f 6c |t = (*fD|ocHScrol|
|00001ea0| 6c 29 2d 3e 63 6f 6e 74 | 72 6c 52 65 63 74 3b 0d |l)->cont|rlRect;.|
|00001eb0| 09 56 61 6c 69 64 52 65 | 63 74 28 26 74 52 65 63 |.ValidRe|ct(&tRec|
|00001ec0| 74 29 3b 0d 7d 0d 0d 2f | 2f 20 43 61 6c 6c 65 64 |t);.}../|/ Called|
|00001ed0| 20 77 68 65 6e 20 61 20 | 6d 6f 75 73 65 44 6f 77 | when a |mouseDow|
|00001ee0| 6e 20 6f 63 63 75 72 73 | 20 69 6e 20 74 68 65 20 |n occurs| in the |
|00001ef0| 67 72 6f 77 20 62 6f 78 | 20 6f 66 20 61 6e 20 61 |grow box| of an a|
|00001f00| 63 74 69 76 65 20 77 69 | 6e 64 6f 77 2e 20 0d 0d |ctive wi|ndow. ..|
|00001f10| 76 6f 69 64 20 54 45 44 | 6f 63 75 6d 65 6e 74 3a |void TED|ocument:|
|00001f20| 3a 44 6f 47 72 6f 77 28 | 45 76 65 6e 74 52 65 63 |:DoGrow(|EventRec|
|00001f30| 6f 72 64 2a 20 74 68 65 | 45 76 65 6e 74 29 0d 7b |ord* the|Event).{|
|00001f40| 0d 09 6c 6f 6e 67 20 67 | 72 6f 77 52 65 73 75 6c |..long g|rowResul|
|00001f50| 74 3b 0d 09 52 65 63 74 | 20 74 52 65 63 74 2c 20 |t;..Rect| tRect, |
|00001f60| 74 52 65 63 74 32 3b 0d | 09 0d 09 74 52 65 63 74 |tRect2;.|...tRect|
|00001f70| 20 3d 20 71 64 2e 73 63 | 72 65 65 6e 42 69 74 73 | = qd.sc|reenBits|
|00001f80| 2e 62 6f 75 6e 64 73 3b | 0d 09 74 52 65 63 74 2e |.bounds;|..tRect.|
|00001f90| 6c 65 66 74 20 3d 20 6b | 4d 69 6e 44 6f 63 44 69 |left = k|MinDocDi|
|00001fa0| 6d 3b 0d 09 74 52 65 63 | 74 2e 74 6f 70 20 3d 20 |m;..tRec|t.top = |
|00001fb0| 6b 4d 69 6e 44 6f 63 44 | 69 6d 3b 0d 09 67 72 6f |kMinDocD|im;..gro|
|00001fc0| 77 52 65 73 75 6c 74 20 | 3d 20 47 72 6f 77 57 69 |wResult |= GrowWi|
|00001fd0| 6e 64 6f 77 28 66 44 6f | 63 57 69 6e 64 6f 77 2c |ndow(fDo|cWindow,|
|00001fe0| 20 74 68 65 45 76 65 6e | 74 2d 3e 77 68 65 72 65 | theEven|t->where|
|00001ff0| 2c 20 26 74 52 65 63 74 | 29 3b 0d 09 2f 2f 20 73 |, &tRect|);..// s|
|00002000| 65 65 20 69 66 20 69 74 | 20 72 65 61 6c 6c 79 20 |ee if it| really |
|00002010| 63 68 61 6e 67 65 64 20 | 73 69 7a 65 20 0d 09 69 |changed |size ..i|
|00002020| 66 20 28 20 67 72 6f 77 | 52 65 73 75 6c 74 20 21 |f ( grow|Result !|
|00002030| 3d 20 30 20 29 0d 09 20 | 20 7b 0d 09 09 74 52 65 |= 0 ).. | {...tRe|
|00002040| 63 74 20 3d 20 28 2a 66 | 44 6f 63 54 45 29 2d 3e |ct = (*f|DocTE)->|
|00002050| 76 69 65 77 52 65 63 74 | 3b 0d 09 09 53 69 7a 65 |viewRect|;...Size|
|00002060| 57 69 6e 64 6f 77 28 66 | 44 6f 63 57 69 6e 64 6f |Window(f|DocWindo|
|00002070| 77 2c 20 4c 6f 57 72 64 | 28 67 72 6f 77 52 65 73 |w, LoWrd|(growRes|
|00002080| 75 6c 74 29 2c 20 48 69 | 57 72 64 28 67 72 6f 77 |ult), Hi|Wrd(grow|
|00002090| 52 65 73 75 6c 74 29 2c | 20 74 72 75 65 29 3b 0d |Result),| true);.|
|000020a0| 09 09 41 64 6a 75 73 74 | 53 63 72 6f 6c 6c 62 61 |..Adjust|Scrollba|
|000020b0| 72 73 28 74 72 75 65 29 | 3b 0d 09 09 41 64 6a 75 |rs(true)|;...Adju|
|000020c0| 73 74 54 45 28 29 3b 0d | 09 09 2f 2f 20 63 61 6c |stTE();.|..// cal|
|000020d0| 63 75 6c 61 74 65 20 26 | 20 76 61 6c 69 64 61 74 |culate &| validat|
|000020e0| 65 20 74 68 65 20 72 65 | 67 69 6f 6e 20 74 68 61 |e the re|gion tha|
|000020f0| 74 20 68 61 73 6e d5 74 | 20 63 68 61 6e 67 65 64 |t hasn.t| changed|
|00002100| 20 73 6f 20 69 74 20 77 | 6f 6e d5 74 20 67 65 74 | so it w|on.t get|
|00002110| 20 72 65 64 72 61 77 6e | 0d 09 09 2f 2f 20 4e 6f | redrawn|...// No|
|00002120| 74 65 3a 20 77 65 20 63 | 6f 70 79 20 72 65 63 74 |te: we c|opy rect|
|00002130| 61 6e 67 6c 65 73 20 73 | 6f 20 74 68 61 74 20 77 |angles s|o that w|
|00002140| 65 20 64 6f 6e 27 74 20 | 74 61 6b 65 20 61 64 64 |e don't |take add|
|00002150| 72 65 73 73 20 6f 66 20 | 6f 62 6a 65 63 74 20 66 |ress of |object f|
|00002160| 69 65 6c 64 73 2e 0d 09 | 09 74 52 65 63 74 32 20 |ields...|.tRect2 |
|00002170| 3d 20 28 2a 66 44 6f 63 | 54 45 29 2d 3e 76 69 65 |= (*fDoc|TE)->vie|
|00002180| 77 52 65 63 74 3b 0d 09 | 09 28 76 6f 69 64 29 20 |wRect;..|.(void) |
|00002190| 53 65 63 74 52 65 63 74 | 28 26 74 52 65 63 74 2c |SectRect|(&tRect,|
|000021a0| 20 26 74 52 65 63 74 32 | 2c 20 26 74 52 65 63 74 | &tRect2|, &tRect|
|000021b0| 29 3b 0d 09 09 74 52 65 | 63 74 32 20 3d 20 66 44 |);...tRe|ct2 = fD|
|000021c0| 6f 63 57 69 6e 64 6f 77 | 2d 3e 70 6f 72 74 52 65 |ocWindow|->portRe|
|000021d0| 63 74 3b 20 49 6e 76 61 | 6c 52 65 63 74 28 26 74 |ct; Inva|lRect(&t|
|000021e0| 52 65 63 74 32 29 3b 0d | 09 09 56 61 6c 69 64 52 |Rect2);.|..ValidR|
|000021f0| 65 63 74 28 26 74 52 65 | 63 74 29 3b 0d 09 09 74 |ect(&tRe|ct);...t|
|00002200| 52 65 63 74 32 20 3d 20 | 28 2a 66 44 6f 63 56 53 |Rect2 = |(*fDocVS|
|00002210| 63 72 6f 6c 6c 29 2d 3e | 63 6f 6e 74 72 6c 52 65 |croll)->|contrlRe|
|00002220| 63 74 3b 20 56 61 6c 69 | 64 52 65 63 74 28 26 74 |ct; Vali|dRect(&t|
|00002230| 52 65 63 74 32 29 3b 0d | 09 09 74 52 65 63 74 32 |Rect2);.|..tRect2|
|00002240| 20 3d 20 28 2a 66 44 6f | 63 48 53 63 72 6f 6c 6c | = (*fDo|cHScroll|
|00002250| 29 2d 3e 63 6f 6e 74 72 | 6c 52 65 63 74 3b 20 56 |)->contr|lRect; V|
|00002260| 61 6c 69 64 52 65 63 74 | 28 26 74 52 65 63 74 32 |alidRect|(&tRect2|
|00002270| 29 3b 0d 09 20 20 7d 0d | 7d 0d 0d 76 6f 69 64 20 |);.. }.|}..void |
|00002280| 54 45 44 6f 63 75 6d 65 | 6e 74 3a 3a 44 6f 43 6f |TEDocume|nt::DoCo|
|00002290| 6e 74 65 6e 74 28 45 76 | 65 6e 74 52 65 63 6f 72 |ntent(Ev|entRecor|
|000022a0| 64 2a 20 74 68 65 45 76 | 65 6e 74 29 0d 7b 0d 09 |d* theEv|ent).{..|
|000022b0| 50 6f 69 6e 74 20 6d 6f | 75 73 65 3b 0d 09 43 6f |Point mo|use;..Co|
|000022c0| 6e 74 72 6f 6c 48 61 6e | 64 6c 65 20 63 6f 6e 74 |ntrolHan|dle cont|
|000022d0| 72 6f 6c 3b 0d 09 73 68 | 6f 72 74 20 70 61 72 74 |rol;..sh|ort part|
|000022e0| 2c 20 76 61 6c 75 65 3b | 0d 09 42 6f 6f 6c 65 61 |, value;|..Boolea|
|000022f0| 6e 20 73 68 69 66 74 44 | 6f 77 6e 3b 0d 09 52 65 |n shiftD|own;..Re|
|00002300| 63 74 20 74 65 52 65 63 | 74 3b 0d 0d 09 53 65 74 |ct teRec|t;...Set|
|00002310| 50 6f 72 74 28 66 44 6f | 63 57 69 6e 64 6f 77 29 |Port(fDo|cWindow)|
|00002320| 3b 0d 09 6d 6f 75 73 65 | 20 3d 20 74 68 65 45 76 |;..mouse| = theEv|
|00002330| 65 6e 74 2d 3e 77 68 65 | 72 65 3b 09 09 09 09 09 |ent->whe|re;.....|
|00002340| 09 09 2f 2f 20 67 65 74 | 20 74 68 65 20 63 6c 69 |..// get| the cli|
|00002350| 63 6b 20 70 6f 73 69 74 | 69 6f 6e 20 0d 09 47 6c |ck posit|ion ..Gl|
|00002360| 6f 62 61 6c 54 6f 4c 6f | 63 61 6c 28 26 6d 6f 75 |obalToLo|cal(&mou|
|00002370| 73 65 29 3b 0d 09 47 65 | 74 54 45 52 65 63 74 28 |se);..Ge|tTERect(|
|00002380| 26 74 65 52 65 63 74 29 | 3b 0d 09 69 66 20 28 20 |&teRect)|;..if ( |
|00002390| 50 74 49 6e 52 65 63 74 | 28 6d 6f 75 73 65 2c 20 |PtInRect|(mouse, |
|000023a0| 26 74 65 52 65 63 74 29 | 20 29 0d 09 20 20 7b 0d |&teRect)| ).. {.|
|000023b0| 09 09 2f 2a 20 73 65 65 | 20 69 66 20 77 65 20 6e |../* see| if we n|
|000023c0| 65 65 64 20 74 6f 20 65 | 78 74 65 6e 64 20 74 68 |eed to e|xtend th|
|000023d0| 65 20 73 65 6c 65 63 74 | 69 6f 6e 20 2a 2f 0d 09 |e select|ion */..|
|000023e0| 09 73 68 69 66 74 44 6f | 77 6e 20 3d 20 28 74 68 |.shiftDo|wn = (th|
|000023f0| 65 45 76 65 6e 74 2d 3e | 6d 6f 64 69 66 69 65 72 |eEvent->|modifier|
|00002400| 73 20 26 20 73 68 69 66 | 74 4b 65 79 29 20 21 3d |s & shif|tKey) !=|
|00002410| 20 30 3b 09 2f 2a 20 65 | 78 74 65 6e 64 20 69 66 | 0;./* e|xtend if|
|00002420| 20 53 68 69 66 74 20 69 | 73 20 64 6f 77 6e 20 2a | Shift i|s down *|
|00002430| 2f 0d 09 09 54 45 43 6c | 69 63 6b 28 6d 6f 75 73 |/...TECl|ick(mous|
|00002440| 65 2c 20 73 68 69 66 74 | 44 6f 77 6e 2c 20 66 44 |e, shift|Down, fD|
|00002450| 6f 63 54 45 29 3b 0d 09 | 20 20 7d 0d 09 65 6c 73 |ocTE);..| }..els|
|00002460| 65 0d 09 20 20 7b 0d 09 | 09 70 61 72 74 20 3d 20 |e.. {..|.part = |
|00002470| 46 69 6e 64 43 6f 6e 74 | 72 6f 6c 28 6d 6f 75 73 |FindCont|rol(mous|
|00002480| 65 2c 20 66 44 6f 63 57 | 69 6e 64 6f 77 2c 20 26 |e, fDocW|indow, &|
|00002490| 63 6f 6e 74 72 6f 6c 29 | 3b 0d 09 09 73 77 69 74 |control)|;...swit|
|000024a0| 63 68 20 28 20 70 61 72 | 74 20 29 0d 09 09 20 20 |ch ( par|t )... |
|000024b0| 7b 0d 09 09 09 63 61 73 | 65 20 30 3a 0d 09 09 09 |{....cas|e 0:....|
|000024c0| 09 2f 2f 20 64 6f 20 6e | 6f 74 68 69 6e 67 20 69 |.// do n|othing i|
|000024d0| 66 20 6e 6f 74 20 69 6e | 20 61 20 63 6f 6e 74 72 |f not in| a contr|
|000024e0| 6f 6c 0d 09 09 09 09 62 | 72 65 61 6b 3b 0d 09 09 |ol.....b|reak;...|
|000024f0| 09 63 61 73 65 20 69 6e | 54 68 75 6d 62 3a 0d 09 |.case in|Thumb:..|
|00002500| 09 09 09 76 61 6c 75 65 | 20 3d 20 47 65 74 43 74 |...value| = GetCt|
|00002510| 6c 56 61 6c 75 65 28 63 | 6f 6e 74 72 6f 6c 29 3b |lValue(c|ontrol);|
|00002520| 0d 09 09 09 09 70 61 72 | 74 20 3d 20 54 72 61 63 |.....par|t = Trac|
|00002530| 6b 43 6f 6e 74 72 6f 6c | 28 63 6f 6e 74 72 6f 6c |kControl|(control|
|00002540| 2c 20 6d 6f 75 73 65 2c | 20 6e 69 6c 29 3b 0d 09 |, mouse,| nil);..|
|00002550| 09 09 09 69 66 20 28 20 | 70 61 72 74 20 21 3d 20 |...if ( |part != |
|00002560| 30 20 29 0d 09 09 09 09 | 20 20 7b 0d 09 09 09 09 |0 ).....| {.....|
|00002570| 09 76 61 6c 75 65 20 2d | 3d 20 47 65 74 43 74 6c |.value -|= GetCtl|
|00002580| 56 61 6c 75 65 28 63 6f | 6e 74 72 6f 6c 29 3b 0d |Value(co|ntrol);.|
|00002590| 09 09 09 09 09 2f 2f 20 | 76 61 6c 75 65 20 6e 6f |.....// |value no|
|000025a0| 77 20 68 61 73 20 43 48 | 41 4e 47 45 20 69 6e 20 |w has CH|ANGE in |
|000025b0| 76 61 6c 75 65 3b 20 69 | 66 20 76 61 6c 75 65 20 |value; i|f value |
|000025c0| 63 68 61 6e 67 65 64 2c | 20 73 63 72 6f 6c 6c 20 |changed,| scroll |
|000025d0| 0d 09 09 09 09 09 69 66 | 20 28 20 76 61 6c 75 65 |......if| ( value|
|000025e0| 20 21 3d 20 30 20 29 0d | 09 09 09 09 09 09 69 66 | != 0 ).|......if|
|000025f0| 20 28 20 63 6f 6e 74 72 | 6f 6c 20 3d 3d 20 66 44 | ( contr|ol == fD|
|00002600| 6f 63 56 53 63 72 6f 6c | 6c 20 29 0d 09 09 09 09 |ocVScrol|l ).....|
|00002610| 09 09 09 54 45 53 63 72 | 6f 6c 6c 28 30 2c 20 76 |...TEScr|oll(0, v|
|00002620| 61 6c 75 65 20 2a 20 28 | 2a 66 44 6f 63 54 45 29 |alue * (|*fDocTE)|
|00002630| 2d 3e 6c 69 6e 65 48 65 | 69 67 68 74 2c 20 66 44 |->lineHe|ight, fD|
|00002640| 6f 63 54 45 29 3b 0d 09 | 09 09 09 09 09 65 6c 73 |ocTE);..|.....els|
|00002650| 65 20 54 45 53 63 72 6f | 6c 6c 28 76 61 6c 75 65 |e TEScro|ll(value|
|00002660| 2c 20 30 2c 20 66 44 6f | 63 54 45 29 3b 0d 09 09 |, 0, fDo|cTE);...|
|00002670| 09 09 20 20 7d 0d 09 09 | 09 09 62 72 65 61 6b 3b |.. }...|..break;|
|00002680| 0d 09 09 09 64 65 66 61 | 75 6c 74 3a 09 09 09 09 |....defa|ult:....|
|00002690| 09 09 2f 2f 20 74 68 65 | 79 20 63 6c 69 63 6b 65 |..// the|y clicke|
|000026a0| 64 20 69 6e 20 61 6e 20 | 61 72 72 6f 77 2c 20 73 |d in an |arrow, s|
|000026b0| 6f 20 74 72 61 63 6b 20 | 26 20 73 63 72 6f 6c 6c |o track |& scroll|
|000026c0| 20 0d 09 09 09 09 69 66 | 20 28 20 63 6f 6e 74 72 | .....if| ( contr|
|000026d0| 6f 6c 20 3d 3d 20 66 44 | 6f 63 56 53 63 72 6f 6c |ol == fD|ocVScrol|
|000026e0| 6c 20 29 0d 09 09 09 09 | 09 76 61 6c 75 65 20 3d |l ).....|.value =|
|000026f0| 20 54 72 61 63 6b 43 6f | 6e 74 72 6f 6c 28 63 6f | TrackCo|ntrol(co|
|00002700| 6e 74 72 6f 6c 2c 20 6d | 6f 75 73 65 2c 20 28 50 |ntrol, m|ouse, (P|
|00002710| 72 6f 63 50 74 72 29 20 | 56 41 63 74 69 6f 6e 50 |rocPtr) |VActionP|
|00002720| 72 6f 63 29 3b 0d 09 09 | 09 09 65 6c 73 65 20 76 |roc);...|..else v|
|00002730| 61 6c 75 65 20 3d 20 54 | 72 61 63 6b 43 6f 6e 74 |alue = T|rackCont|
|00002740| 72 6f 6c 28 63 6f 6e 74 | 72 6f 6c 2c 20 6d 6f 75 |rol(cont|rol, mou|
|00002750| 73 65 2c 20 28 50 72 6f | 63 50 74 72 29 20 48 41 |se, (Pro|cPtr) HA|
|00002760| 63 74 69 6f 6e 50 72 6f | 63 29 3b 0d 09 09 09 09 |ctionPro|c);.....|
|00002770| 62 72 65 61 6b 3b 0d 09 | 09 20 20 7d 0d 09 20 20 |break;..|. }.. |
|00002780| 7d 0d 7d 0d 0d 76 6f 69 | 64 20 54 45 44 6f 63 75 |}.}..voi|d TEDocu|
|00002790| 6d 65 6e 74 3a 3a 44 6f | 4b 65 79 44 6f 77 6e 28 |ment::Do|KeyDown(|
|000027a0| 45 76 65 6e 74 52 65 63 | 6f 72 64 2a 20 74 68 65 |EventRec|ord* the|
|000027b0| 45 76 65 6e 74 29 0d 7b | 0d 09 63 68 61 72 20 6b |Event).{|..char k|
|000027c0| 65 79 3b 0d 0d 09 69 66 | 20 28 74 68 65 45 76 65 |ey;...if| (theEve|
|000027d0| 6e 74 2d 3e 6d 6f 64 69 | 66 69 65 72 73 20 26 20 |nt->modi|fiers & |
|000027e0| 63 6d 64 4b 65 79 29 09 | 2f 2f 20 64 6f 6e 27 74 |cmdKey).|// don't|
|000027f0| 20 70 72 6f 63 65 73 73 | 20 63 6f 6d 6d 61 6e 64 | process| command|
|00002800| 20 63 68 61 72 61 63 74 | 65 72 73 0d 09 20 20 72 | charact|ers.. r|
|00002810| 65 74 75 72 6e 3b 0d 09 | 6b 65 79 20 3d 20 74 68 |eturn;..|key = th|
|00002820| 65 45 76 65 6e 74 2d 3e | 6d 65 73 73 61 67 65 20 |eEvent->|message |
|00002830| 26 20 63 68 61 72 43 6f | 64 65 4d 61 73 6b 3b 0d |& charCo|deMask;.|
|00002840| 09 2f 2f 20 77 65 20 68 | 61 76 65 20 61 20 63 68 |.// we h|ave a ch|
|00002850| 61 72 2e 20 66 6f 72 20 | 6f 75 72 20 77 69 6e 64 |ar. for |our wind|
|00002860| 6f 77 3b 20 73 65 65 20 | 69 66 20 77 65 20 61 72 |ow; see |if we ar|
|00002870| 65 20 73 74 69 6c 6c 20 | 62 65 6c 6f 77 20 54 65 |e still |below Te|
|00002880| 78 74 45 64 69 74 d5 73 | 0d 09 2f 2f 20 6c 69 6d |xtEdit.s|..// lim|
|00002890| 69 74 20 66 6f 72 20 74 | 68 65 20 6e 75 6d 62 65 |it for t|he numbe|
|000028a0| 72 20 6f 66 20 63 68 61 | 72 61 63 74 65 72 73 0d |r of cha|racters.|
|000028b0| 09 69 66 20 28 28 6b 65 | 79 20 3d 3d 20 6b 44 65 |.if ((ke|y == kDe|
|000028c0| 6c 43 68 61 72 29 20 7c | 7c 0d 09 09 28 28 2a 66 |lChar) |||...((*f|
|000028d0| 44 6f 63 54 45 29 2d 3e | 74 65 4c 65 6e 67 74 68 |DocTE)->|teLength|
|000028e0| 20 2d 20 28 28 2a 66 44 | 6f 63 54 45 29 2d 3e 73 | - ((*fD|ocTE)->s|
|000028f0| 65 6c 45 6e 64 20 2d 20 | 28 2a 66 44 6f 63 54 45 |elEnd - |(*fDocTE|
|00002900| 29 2d 3e 73 65 6c 53 74 | 61 72 74 29 20 2b 20 31 |)->selSt|art) + 1|
|00002910| 20 3c 20 6b 4d 61 78 54 | 45 4c 65 6e 67 74 68 29 | < kMaxT|ELength)|
|00002920| 20 29 0d 09 20 20 7b 0d | 09 09 54 45 4b 65 79 28 | ).. {.|..TEKey(|
|00002930| 6b 65 79 2c 20 66 44 6f | 63 54 45 29 3b 0d 09 09 |key, fDo|cTE);...|
|00002940| 41 64 6a 75 73 74 53 63 | 72 6f 6c 6c 62 61 72 73 |AdjustSc|rollbars|
|00002950| 28 66 61 6c 73 65 29 3b | 0d 09 09 41 64 6a 75 73 |(false);|...Adjus|
|00002960| 74 54 45 28 29 3b 0d 09 | 20 20 7d 0d 09 65 6c 73 |tTE();..| }..els|
|00002970| 65 20 41 6c 65 72 74 55 | 73 65 72 28 6b 54 45 44 |e AlertU|ser(kTED|
|00002980| 6f 63 45 72 72 53 74 72 | 69 6e 67 73 2c 65 45 78 |ocErrStr|ings,eEx|
|00002990| 63 65 65 64 43 68 61 72 | 29 3b 0d 7d 0d 0d 76 6f |ceedChar|);.}..vo|
|000029a0| 69 64 20 54 45 44 6f 63 | 75 6d 65 6e 74 3a 3a 44 |id TEDoc|ument::D|
|000029b0| 6f 41 63 74 69 76 61 74 | 65 28 42 6f 6f 6c 65 61 |oActivat|e(Boolea|
|000029c0| 6e 20 62 65 63 6f 6d 69 | 6e 67 41 63 74 69 76 65 |n becomi|ngActive|
|000029d0| 29 0d 7b 0d 09 69 66 20 | 28 20 62 65 63 6f 6d 69 |).{..if |( becomi|
|000029e0| 6e 67 41 63 74 69 76 65 | 20 29 0d 09 20 20 7b 0d |ngActive| ).. {.|
|000029f0| 09 09 52 67 6e 48 61 6e | 64 6c 65 09 74 65 6d 70 |..RgnHan|dle.temp|
|00002a00| 52 67 6e 3b 0d 09 09 52 | 67 6e 48 61 6e 64 6c 65 |Rgn;...R|gnHandle|
|00002a10| 09 63 6c 69 70 52 67 6e | 3b 0d 09 09 52 65 63 74 |.clipRgn|;...Rect|
|00002a20| 09 09 67 72 6f 77 52 65 | 63 74 3b 0d 09 09 52 65 |..growRe|ct;...Re|
|00002a30| 63 74 09 09 74 52 65 63 | 74 3b 0d 0d 09 09 2f 2f |ct..tRec|t;....//|
|00002a40| 20 73 69 6e 63 65 20 77 | 65 20 64 6f 6e d5 74 20 | since w|e don.t |
|00002a50| 77 61 6e 74 20 54 45 41 | 63 74 69 76 61 74 65 20 |want TEA|ctivate |
|00002a60| 74 6f 20 64 72 61 77 20 | 61 20 73 65 6c 65 63 74 |to draw |a select|
|00002a70| 69 6f 6e 20 69 6e 20 61 | 6e 20 61 72 65 61 20 77 |ion in a|n area w|
|00002a80| 68 65 72 65 0d 09 09 2f | 2f 20 77 65 d5 72 65 20 |here.../|/ we.re |
|00002a90| 67 6f 69 6e 67 20 74 6f | 20 65 72 61 73 65 20 61 |going to| erase a|
|00002aa0| 6e 64 20 72 65 64 72 61 | 77 2c 20 77 65 d5 6c 6c |nd redra|w, we.ll|
|00002ab0| 20 63 6c 69 70 20 6f 75 | 74 20 74 68 65 20 75 70 | clip ou|t the up|
|00002ac0| 64 61 74 65 20 72 65 67 | 69 6f 6e 0d 09 09 2f 2f |date reg|ion...//|
|00002ad0| 20 62 65 66 6f 72 65 20 | 63 61 6c 6c 69 6e 67 20 | before |calling |
|00002ae0| 69 74 2e 0d 09 09 74 65 | 6d 70 52 67 6e 20 3d 20 |it....te|mpRgn = |
|00002af0| 4e 65 77 52 67 6e 28 29 | 3b 0d 09 09 63 6c 69 70 |NewRgn()|;...clip|
|00002b00| 52 67 6e 20 3d 20 4e 65 | 77 52 67 6e 28 29 3b 0d |Rgn = Ne|wRgn();.|
|00002b10| 09 09 2f 2f 20 73 61 76 | 65 20 6f 6c 64 20 75 70 |..// sav|e old up|
|00002b20| 64 61 74 65 20 72 65 67 | 69 6f 6e 0d 09 09 43 6f |date reg|ion...Co|
|00002b30| 70 79 52 67 6e 28 28 28 | 57 69 6e 64 6f 77 50 65 |pyRgn(((|WindowPe|
|00002b40| 65 6b 29 20 66 44 6f 63 | 57 69 6e 64 6f 77 29 2d |ek) fDoc|Window)-|
|00002b50| 3e 75 70 64 61 74 65 52 | 67 6e 2c 20 74 65 6d 70 |>updateR|gn, temp|
|00002b60| 52 67 6e 29 3b 0d 09 09 | 2f 2f 20 70 75 74 20 69 |Rgn);...|// put i|
|00002b70| 74 20 69 6e 20 6c 6f 63 | 61 6c 20 63 6f 6f 72 64 |t in loc|al coord|
|00002b80| 73 0d 09 09 4f 66 66 73 | 65 74 52 67 6e 28 74 65 |s...Offs|etRgn(te|
|00002b90| 6d 70 52 67 6e 2c 20 66 | 44 6f 63 57 69 6e 64 6f |mpRgn, f|DocWindo|
|00002ba0| 77 2d 3e 70 6f 72 74 42 | 69 74 73 2e 62 6f 75 6e |w->portB|its.boun|
|00002bb0| 64 73 2e 6c 65 66 74 2c | 20 66 44 6f 63 57 69 6e |ds.left,| fDocWin|
|00002bc0| 64 6f 77 2d 3e 70 6f 72 | 74 42 69 74 73 2e 62 6f |dow->por|tBits.bo|
|00002bd0| 75 6e 64 73 2e 74 6f 70 | 29 3b 0d 09 09 47 65 74 |unds.top|);...Get|
|00002be0| 43 6c 69 70 28 63 6c 69 | 70 52 67 6e 29 3b 0d 09 |Clip(cli|pRgn);..|
|00002bf0| 09 2f 2f 20 73 75 62 74 | 72 61 63 74 20 75 70 64 |.// subt|ract upd|
|00002c00| 61 74 65 52 67 6e 20 66 | 72 6f 6d 20 63 6c 69 70 |ateRgn f|rom clip|
|00002c10| 52 67 6e 0d 09 09 44 69 | 66 66 52 67 6e 28 63 6c |Rgn...Di|ffRgn(cl|
|00002c20| 69 70 52 67 6e 2c 20 74 | 65 6d 70 52 67 6e 2c 20 |ipRgn, t|empRgn, |
|00002c30| 74 65 6d 70 52 67 6e 29 | 3b 0d 09 09 2f 2f 20 6d |tempRgn)|;...// m|
|00002c40| 61 6b 65 20 69 74 20 74 | 68 65 20 6e 65 77 20 63 |ake it t|he new c|
|00002c50| 6c 69 70 52 67 6e 0d 09 | 09 53 65 74 43 6c 69 70 |lipRgn..|.SetClip|
|00002c60| 28 74 65 6d 70 52 67 6e | 29 3b 0d 09 09 54 45 41 |(tempRgn|);...TEA|
|00002c70| 63 74 69 76 61 74 65 28 | 66 44 6f 63 54 45 29 3b |ctivate(|fDocTE);|
|00002c80| 0d 09 09 2f 2f 20 72 65 | 73 74 6f 72 65 20 74 68 |...// re|store th|
|00002c90| 65 20 66 75 6c 6c 2d 62 | 6c 6f 77 6e 20 63 6c 69 |e full-b|lown cli|
|00002ca0| 70 52 67 6e 0d 09 09 53 | 65 74 43 6c 69 70 28 63 |pRgn...S|etClip(c|
|00002cb0| 6c 69 70 52 67 6e 29 3b | 0d 09 09 2f 2f 20 67 65 |lipRgn);|...// ge|
|00002cc0| 74 20 72 69 64 20 6f 66 | 20 74 65 6d 70 20 72 65 |t rid of| temp re|
|00002cd0| 67 69 6f 6e 73 0d 09 09 | 44 69 73 70 6f 73 65 52 |gions...|DisposeR|
|00002ce0| 67 6e 28 74 65 6d 70 52 | 67 6e 29 3b 0d 09 09 44 |gn(tempR|gn);...D|
|00002cf0| 69 73 70 6f 73 65 52 67 | 6e 28 63 6c 69 70 52 67 |isposeRg|n(clipRg|
|00002d00| 6e 29 3b 0d 0d 09 09 2f | 2a 20 74 68 65 20 63 6f |n);..../|* the co|
|00002d10| 6e 74 72 6f 6c 73 20 6d | 75 73 74 20 62 65 20 72 |ntrols m|ust be r|
|00002d20| 65 64 72 61 77 6e 20 6f | 6e 20 61 63 74 69 76 61 |edrawn o|n activa|
|00002d30| 74 69 6f 6e 3a 20 2a 2f | 0d 09 09 28 2a 66 44 6f |tion: */|...(*fDo|
|00002d40| 63 56 53 63 72 6f 6c 6c | 29 2d 3e 63 6f 6e 74 72 |cVScroll|)->contr|
|00002d50| 6c 56 69 73 20 3d 20 6b | 43 6f 6e 74 72 6f 6c 56 |lVis = k|ControlV|
|00002d60| 69 73 69 62 6c 65 3b 0d | 09 09 28 2a 66 44 6f 63 |isible;.|..(*fDoc|
|00002d70| 48 53 63 72 6f 6c 6c 29 | 2d 3e 63 6f 6e 74 72 6c |HScroll)|->contrl|
|00002d80| 56 69 73 20 3d 20 6b 43 | 6f 6e 74 72 6f 6c 56 69 |Vis = kC|ontrolVi|
|00002d90| 73 69 62 6c 65 3b 0d 09 | 09 2f 2f 20 63 6f 70 79 |sible;..|.// copy|
|00002da0| 20 72 65 63 74 61 6e 67 | 6c 65 73 20 74 6f 20 61 | rectang|les to a|
|00002db0| 76 6f 69 64 20 75 6e 73 | 61 66 65 20 6f 62 6a 65 |void uns|afe obje|
|00002dc0| 63 74 20 66 69 65 6c 64 | 20 72 65 66 65 72 65 6e |ct field| referen|
|00002dd0| 63 65 73 21 0d 09 09 74 | 52 65 63 74 20 3d 20 28 |ces!...t|Rect = (|
|00002de0| 2a 66 44 6f 63 56 53 63 | 72 6f 6c 6c 29 2d 3e 63 |*fDocVSc|roll)->c|
|00002df0| 6f 6e 74 72 6c 52 65 63 | 74 3b 20 49 6e 76 61 6c |ontrlRec|t; Inval|
|00002e00| 52 65 63 74 28 26 74 52 | 65 63 74 29 3b 0d 09 09 |Rect(&tR|ect);...|
|00002e10| 74 52 65 63 74 20 3d 20 | 28 2a 66 44 6f 63 48 53 |tRect = |(*fDocHS|
|00002e20| 63 72 6f 6c 6c 29 2d 3e | 63 6f 6e 74 72 6c 52 65 |croll)->|contrlRe|
|00002e30| 63 74 3b 20 49 6e 76 61 | 6c 52 65 63 74 28 26 74 |ct; Inva|lRect(&t|
|00002e40| 52 65 63 74 29 3b 0d 09 | 09 2f 2f 20 74 68 65 20 |Rect);..|.// the |
|00002e50| 67 72 6f 77 62 6f 78 20 | 6e 65 65 64 73 20 74 6f |growbox |needs to|
|00002e60| 20 62 65 20 72 65 64 72 | 61 77 6e 20 6f 6e 20 61 | be redr|awn on a|
|00002e70| 63 74 69 76 61 74 69 6f | 6e 3a 0d 09 09 67 72 6f |ctivatio|n:...gro|
|00002e80| 77 52 65 63 74 20 3d 20 | 66 44 6f 63 57 69 6e 64 |wRect = |fDocWind|
|00002e90| 6f 77 2d 3e 70 6f 72 74 | 52 65 63 74 3b 0d 09 09 |ow->port|Rect;...|
|00002ea0| 2f 2f 20 61 64 6a 75 73 | 74 20 66 6f 72 20 74 68 |// adjus|t for th|
|00002eb0| 65 20 73 63 72 6f 6c 6c | 62 61 72 73 0d 09 09 67 |e scroll|bars...g|
|00002ec0| 72 6f 77 52 65 63 74 2e | 74 6f 70 20 3d 20 67 72 |rowRect.|top = gr|
|00002ed0| 6f 77 52 65 63 74 2e 62 | 6f 74 74 6f 6d 20 2d 20 |owRect.b|ottom - |
|00002ee0| 6b 53 63 72 6f 6c 6c 62 | 61 72 41 64 6a 75 73 74 |kScrollb|arAdjust|
|00002ef0| 3b 0d 09 09 67 72 6f 77 | 52 65 63 74 2e 6c 65 66 |;...grow|Rect.lef|
|00002f00| 74 20 3d 20 67 72 6f 77 | 52 65 63 74 2e 72 69 67 |t = grow|Rect.rig|
|00002f10| 68 74 20 2d 20 6b 53 63 | 72 6f 6c 6c 62 61 72 41 |ht - kSc|rollbarA|
|00002f20| 64 6a 75 73 74 3b 0d 09 | 09 49 6e 76 61 6c 52 65 |djust;..|.InvalRe|
|00002f30| 63 74 28 26 67 72 6f 77 | 52 65 63 74 29 3b 0d 09 |ct(&grow|Rect);..|
|00002f40| 20 20 7d 0d 09 65 6c 73 | 65 0d 09 20 20 7b 09 09 | }..els|e.. {..|
|00002f50| 0d 09 09 54 45 44 65 61 | 63 74 69 76 61 74 65 28 |...TEDea|ctivate(|
|00002f60| 66 44 6f 63 54 45 29 3b | 0d 09 09 2f 2a 20 74 68 |fDocTE);|.../* th|
|00002f70| 65 20 63 6f 6e 74 72 6f | 6c 73 20 6d 75 73 74 20 |e contro|ls must |
|00002f80| 62 65 20 68 69 64 64 65 | 6e 20 6f 6e 20 64 65 61 |be hidde|n on dea|
|00002f90| 63 74 69 76 61 74 69 6f | 6e 3a 20 2a 2f 0d 09 09 |ctivatio|n: */...|
|00002fa0| 48 69 64 65 43 6f 6e 74 | 72 6f 6c 28 66 44 6f 63 |HideCont|rol(fDoc|
|00002fb0| 56 53 63 72 6f 6c 6c 29 | 3b 0d 09 09 48 69 64 65 |VScroll)|;...Hide|
|00002fc0| 43 6f 6e 74 72 6f 6c 28 | 66 44 6f 63 48 53 63 72 |Control(|fDocHScr|
|00002fd0| 6f 6c 6c 29 3b 0d 09 09 | 2f 2f 20 77 65 20 64 72 |oll);...|// we dr|
|00002fe0| 61 77 20 67 72 6f 77 20 | 69 63 6f 6e 20 69 6d 6d |aw grow |icon imm|
|00002ff0| 65 64 69 61 74 65 6c 79 | 2c 20 73 69 6e 63 65 20 |ediately|, since |
|00003000| 77 65 20 64 65 61 63 74 | 69 76 61 74 65 20 63 6f |we deact|ivate co|
|00003010| 6e 74 72 6f 6c 73 0d 09 | 09 2f 2f 20 69 6d 6d 65 |ntrols..|.// imme|
|00003020| 64 69 61 74 65 6c 79 2c | 20 61 6e 64 20 74 68 65 |diately,| and the|
|00003030| 20 75 70 64 61 74 65 20 | 64 65 6c 61 79 20 6c 6f | update |delay lo|
|00003040| 6f 6b 73 20 66 75 6e 6e | 79 0d 09 09 44 72 61 77 |oks funn|y...Draw|
|00003050| 47 72 6f 77 49 63 6f 6e | 28 66 44 6f 63 57 69 6e |GrowIcon|(fDocWin|
|00003060| 64 6f 77 29 3b 0d 09 20 | 20 7d 0d 7d 0d 0d 76 6f |dow);.. | }.}..vo|
|00003070| 69 64 20 54 45 44 6f 63 | 75 6d 65 6e 74 3a 3a 44 |id TEDoc|ument::D|
|00003080| 6f 55 70 64 61 74 65 28 | 76 6f 69 64 29 0d 7b 0d |oUpdate(|void).{.|
|00003090| 09 42 65 67 69 6e 55 70 | 64 61 74 65 28 66 44 6f |.BeginUp|date(fDo|
|000030a0| 63 57 69 6e 64 6f 77 29 | 3b 09 09 09 09 2f 2f 20 |cWindow)|;....// |
|000030b0| 74 68 69 73 20 73 65 74 | 73 20 75 70 20 74 68 65 |this set|s up the|
|000030c0| 20 76 69 73 52 67 6e 20 | 0d 09 69 66 20 28 20 21 | visRgn |..if ( !|
|000030d0| 20 45 6d 70 74 79 52 67 | 6e 28 66 44 6f 63 57 69 | EmptyRg|n(fDocWi|
|000030e0| 6e 64 6f 77 2d 3e 76 69 | 73 52 67 6e 29 20 29 09 |ndow->vi|sRgn) ).|
|000030f0| 2f 2f 20 64 72 61 77 20 | 69 66 20 75 70 64 61 74 |// draw |if updat|
|00003100| 69 6e 67 20 6e 65 65 64 | 73 20 74 6f 20 62 65 20 |ing need|s to be |
|00003110| 64 6f 6e 65 20 0d 09 20 | 20 7b 0d 09 09 44 72 61 |done .. | {...Dra|
|00003120| 77 57 69 6e 64 6f 77 28 | 29 3b 0d 09 20 20 7d 0d |wWindow(|);.. }.|
|00003130| 09 45 6e 64 55 70 64 61 | 74 65 28 66 44 6f 63 57 |.EndUpda|te(fDocW|
|00003140| 69 6e 64 6f 77 29 3b 0d | 7d 0d 0d 2f 2f 20 63 61 |indow);.|}..// ca|
|00003150| 6c 63 75 6c 61 74 65 20 | 68 6f 77 20 6d 75 63 68 |lculate |how much|
|00003160| 20 69 64 6c 65 20 74 69 | 6d 65 20 77 65 20 6e 65 | idle ti|me we ne|
|00003170| 65 64 0d 0d 75 6e 73 69 | 67 6e 65 64 20 6c 6f 6e |ed..unsi|gned lon|
|00003180| 67 20 54 45 44 6f 63 75 | 6d 65 6e 74 3a 3a 43 61 |g TEDocu|ment::Ca|
|00003190| 6c 63 49 64 6c 65 28 76 | 6f 69 64 29 0d 7b 0d 09 |lcIdle(v|oid).{..|
|000031a0| 69 66 20 28 48 61 76 65 | 53 65 6c 65 63 74 69 6f |if (Have|Selectio|
|000031b0| 6e 28 29 29 0d 09 20 20 | 72 65 74 75 72 6e 20 47 |n()).. |return G|
|000031c0| 65 74 43 61 72 65 74 54 | 69 6d 65 28 29 3b 0d 09 |etCaretT|ime();..|
|000031d0| 65 6c 73 65 20 72 65 74 | 75 72 6e 20 6b 4d 61 78 |else ret|urn kMax|
|000031e0| 53 6c 65 65 70 54 69 6d | 65 3b 09 2f 2f 20 69 66 |SleepTim|e;.// if|
|000031f0| 20 77 65 20 64 6f 6e 27 | 74 20 68 61 76 65 20 61 | we don'|t have a|
|00003200| 20 73 65 6c 65 63 74 69 | 6f 6e 2c 20 77 65 20 64 | selecti|on, we d|
|00003210| 6f 6e 27 74 20 6e 65 65 | 64 20 74 6f 20 69 64 6c |on't nee|d to idl|
|00003220| 65 0d 7d 0d 0d 2f 2f 20 | 54 68 69 73 20 69 73 20 |e.}..// |This is |
|00003230| 63 61 6c 6c 65 64 20 77 | 68 65 6e 65 76 65 72 20 |called w|henever |
|00003240| 77 65 20 67 65 74 20 61 | 20 6e 75 6c 6c 20 65 76 |we get a| null ev|
|00003250| 65 6e 74 20 65 74 20 61 | 6c 2e 0d 2f 2f 20 49 74 |ent et a|l..// It|
|00003260| 20 74 61 6b 65 73 20 63 | 61 72 65 20 6f 66 20 6e | takes c|are of n|
|00003270| 65 63 65 73 73 61 72 79 | 20 70 65 72 69 6f 64 69 |ecessary| periodi|
|00003280| 63 20 61 63 74 69 6f 6e | 73 2e 20 46 6f 72 20 74 |c action|s. For t|
|00003290| 68 69 73 20 70 72 6f 67 | 72 61 6d 2c 0d 2f 2f 20 |his prog|ram,.// |
|000032a0| 69 74 20 63 61 6c 6c 73 | 20 54 45 49 64 6c 65 2e |it calls| TEIdle.|
|000032b0| 0d 0d 76 6f 69 64 20 54 | 45 44 6f 63 75 6d 65 6e |..void T|EDocumen|
|000032c0| 74 3a 3a 44 6f 49 64 6c | 65 28 76 6f 69 64 29 0d |t::DoIdl|e(void).|
|000032d0| 7b 0d 09 54 45 49 64 6c | 65 28 66 44 6f 63 54 45 |{..TEIdl|e(fDocTE|
|000032e0| 29 3b 0d 7d 20 2f 2f 20 | 44 6f 49 64 6c 65 0d 0d |);.} // |DoIdle..|
|000032f0| 2f 2f 20 44 72 61 77 20 | 74 68 65 20 63 6f 6e 74 |// Draw |the cont|
|00003300| 65 6e 74 73 20 6f 66 20 | 61 6e 20 61 70 70 6c 69 |ents of |an appli|
|00003310| 63 61 74 69 6f 6e 20 77 | 69 6e 64 6f 77 2e 20 0d |cation w|indow. .|
|00003320| 0d 76 6f 69 64 20 54 45 | 44 6f 63 75 6d 65 6e 74 |.void TE|Document|
|00003330| 3a 3a 44 72 61 77 57 69 | 6e 64 6f 77 28 76 6f 69 |::DrawWi|ndow(voi|
|00003340| 64 29 0d 7b 0d 09 52 65 | 63 74 20 74 52 65 63 74 |d).{..Re|ct tRect|
|00003350| 3b 0d 0d 09 53 65 74 50 | 6f 72 74 28 66 44 6f 63 |;...SetP|ort(fDoc|
|00003360| 57 69 6e 64 6f 77 29 3b | 0d 09 74 52 65 63 74 20 |Window);|..tRect |
|00003370| 3d 20 66 44 6f 63 57 69 | 6e 64 6f 77 2d 3e 70 6f |= fDocWi|ndow->po|
|00003380| 72 74 52 65 63 74 3b 0d | 09 45 72 61 73 65 52 65 |rtRect;.|.EraseRe|
|00003390| 63 74 28 26 74 52 65 63 | 74 29 3b 0d 09 54 45 55 |ct(&tRec|t);..TEU|
|000033a0| 70 64 61 74 65 28 26 74 | 52 65 63 74 2c 20 66 44 |pdate(&t|Rect, fD|
|000033b0| 6f 63 54 45 29 3b 0d 09 | 44 72 61 77 43 6f 6e 74 |ocTE);..|DrawCont|
|000033c0| 72 6f 6c 73 28 66 44 6f | 63 57 69 6e 64 6f 77 29 |rols(fDo|cWindow)|
|000033d0| 3b 0d 09 44 72 61 77 47 | 72 6f 77 49 63 6f 6e 28 |;..DrawG|rowIcon(|
|000033e0| 66 44 6f 63 57 69 6e 64 | 6f 77 29 3b 0d 7d 20 2f |fDocWind|ow);.} /|
|000033f0| 2f 20 44 72 61 77 57 69 | 6e 64 6f 77 0d 0d 2f 2f |/ DrawWi|ndow..//|
|00003400| 20 52 65 74 75 72 6e 20 | 61 20 72 65 63 74 61 6e | Return |a rectan|
|00003410| 67 6c 65 20 74 68 61 74 | 20 69 73 20 69 6e 73 65 |gle that| is inse|
|00003420| 74 20 66 72 6f 6d 20 74 | 68 65 20 70 6f 72 74 52 |t from t|he portR|
|00003430| 65 63 74 20 62 79 20 74 | 68 65 20 73 69 7a 65 20 |ect by t|he size |
|00003440| 6f 66 0d 2f 2f 20 74 68 | 65 20 73 63 72 6f 6c 6c |of.// th|e scroll|
|00003450| 62 61 72 73 20 61 6e 64 | 20 61 20 6c 69 74 74 6c |bars and| a littl|
|00003460| 65 20 65 78 74 72 61 20 | 6d 61 72 67 69 6e 2e 0d |e extra |margin..|
|00003470| 0d 76 6f 69 64 20 54 45 | 44 6f 63 75 6d 65 6e 74 |.void TE|Document|
|00003480| 3a 3a 47 65 74 54 45 52 | 65 63 74 28 52 65 63 74 |::GetTER|ect(Rect|
|00003490| 2a 20 74 65 52 65 63 74 | 29 0d 7b 0d 09 2a 74 65 |* teRect|).{..*te|
|000034a0| 52 65 63 74 20 3d 20 66 | 44 6f 63 57 69 6e 64 6f |Rect = f|DocWindo|
|000034b0| 77 2d 3e 70 6f 72 74 52 | 65 63 74 3b 0d 09 49 6e |w->portR|ect;..In|
|000034c0| 73 65 74 52 65 63 74 28 | 74 65 52 65 63 74 2c 20 |setRect(|teRect, |
|000034d0| 6b 54 65 78 74 4d 61 72 | 67 69 6e 2c 20 6b 54 65 |kTextMar|gin, kTe|
|000034e0| 78 74 4d 61 72 67 69 6e | 29 3b 09 09 09 2f 2f 20 |xtMargin|);...// |
|000034f0| 61 64 6a 75 73 74 20 66 | 6f 72 20 6d 61 72 67 69 |adjust f|or margi|
|00003500| 6e 20 0d 09 74 65 52 65 | 63 74 2d 3e 62 6f 74 74 |n ..teRe|ct->bott|
|00003510| 6f 6d 20 3d 20 74 65 52 | 65 63 74 2d 3e 62 6f 74 |om = teR|ect->bot|
|00003520| 74 6f 6d 20 2d 20 6b 53 | 63 72 6f 6c 6c 62 61 72 |tom - kS|crollbar|
|00003530| 41 64 6a 75 73 74 3b 09 | 2f 2f 20 61 6e 64 20 66 |Adjust;.|// and f|
|00003540| 6f 72 20 74 68 65 20 73 | 63 72 6f 6c 6c 62 61 72 |or the s|crollbar|
|00003550| 73 20 0d 09 74 65 52 65 | 63 74 2d 3e 72 69 67 68 |s ..teRe|ct->righ|
|00003560| 74 20 3d 20 74 65 52 65 | 63 74 2d 3e 72 69 67 68 |t = teRe|ct->righ|
|00003570| 74 20 2d 20 6b 53 63 72 | 6f 6c 6c 62 61 72 41 64 |t - kScr|ollbarAd|
|00003580| 6a 75 73 74 3b 0d 7d 20 | 2f 2f 20 47 65 74 54 45 |just;.} |// GetTE|
|00003590| 52 65 63 74 0d 0d 2f 2f | 20 73 65 74 75 70 20 61 |Rect..//| setup a|
|000035a0| 20 72 65 67 69 6f 6e 20 | 77 68 69 63 68 20 63 6f | region |which co|
|000035b0| 6e 74 61 69 6e 73 20 74 | 68 65 20 76 69 73 69 62 |ntains t|he visib|
|000035c0| 6c 65 20 74 65 78 74 0d | 0d 76 6f 69 64 20 54 45 |le text.|.void TE|
|000035d0| 44 6f 63 75 6d 65 6e 74 | 3a 3a 47 65 74 56 69 73 |Document|::GetVis|
|000035e0| 54 45 52 67 6e 28 52 67 | 6e 48 61 6e 64 6c 65 20 |TERgn(Rg|nHandle |
|000035f0| 72 67 6e 29 0d 7b 0d 09 | 52 65 63 74 20 74 65 52 |rgn).{..|Rect teR|
|00003600| 65 63 74 3b 0d 0d 09 74 | 65 52 65 63 74 20 3d 20 |ect;...t|eRect = |
|00003610| 28 2a 66 44 6f 63 54 45 | 29 2d 3e 76 69 65 77 52 |(*fDocTE|)->viewR|
|00003620| 65 63 74 3b 09 2f 2f 20 | 67 65 74 20 61 20 6c 6f |ect;.// |get a lo|
|00003630| 63 61 6c 20 63 6f 70 79 | 20 6f 66 20 76 69 65 77 |cal copy| of view|
|00003640| 52 65 63 74 0d 09 53 65 | 74 50 6f 72 74 28 66 44 |Rect..Se|tPort(fD|
|00003650| 6f 63 57 69 6e 64 6f 77 | 29 3b 09 09 09 2f 2f 20 |ocWindow|);...// |
|00003660| 6d 61 6b 65 20 73 75 72 | 65 20 77 65 20 68 61 76 |make sur|e we hav|
|00003670| 65 20 72 69 67 68 74 20 | 70 6f 72 74 0d 09 4c 6f |e right |port..Lo|
|00003680| 63 61 6c 54 6f 47 6c 6f | 62 61 6c 28 26 54 6f 70 |calToGlo|bal(&Top|
|00003690| 4c 65 66 74 28 74 65 52 | 65 63 74 29 29 3b 0d 09 |Left(teR|ect));..|
|000036a0| 4c 6f 63 61 6c 54 6f 47 | 6c 6f 62 61 6c 28 26 42 |LocalToG|lobal(&B|
|000036b0| 6f 74 52 69 67 68 74 28 | 74 65 52 65 63 74 29 29 |otRight(|teRect))|
|000036c0| 3b 0d 09 52 65 63 74 52 | 67 6e 28 72 67 6e 2c 20 |;..RectR|gn(rgn, |
|000036d0| 26 74 65 52 65 63 74 29 | 3b 0d 09 2f 2f 20 77 65 |&teRect)|;..// we|
|000036e0| 20 74 65 6d 70 6f 72 61 | 72 69 6c 79 20 63 68 61 | tempora|rily cha|
|000036f0| 6e 67 65 20 74 68 65 20 | 70 6f 72 74 d5 73 20 6f |nge the |port.s o|
|00003700| 72 69 67 69 6e 20 74 6f | 20 d2 67 6c 6f 62 61 6c |rigin to| .global|
|00003710| 66 79 d3 20 74 68 65 20 | 76 69 73 52 67 6e 0d 09 |fy. the |visRgn..|
|00003720| 53 65 74 4f 72 69 67 69 | 6e 28 2d 28 66 44 6f 63 |SetOrigi|n(-(fDoc|
|00003730| 57 69 6e 64 6f 77 2d 3e | 70 6f 72 74 42 69 74 73 |Window->|portBits|
|00003740| 2e 62 6f 75 6e 64 73 2e | 6c 65 66 74 29 2c 0d 09 |.bounds.|left),..|
|00003750| 09 09 20 20 2d 28 66 44 | 6f 63 57 69 6e 64 6f 77 |.. -(fD|ocWindow|
|00003760| 2d 3e 70 6f 72 74 42 69 | 74 73 2e 62 6f 75 6e 64 |->portBi|ts.bound|
|00003770| 73 2e 74 6f 70 29 29 3b | 0d 09 53 65 63 74 52 67 |s.top));|..SectRg|
|00003780| 6e 28 72 67 6e 2c 20 66 | 44 6f 63 57 69 6e 64 6f |n(rgn, f|DocWindo|
|00003790| 77 2d 3e 76 69 73 52 67 | 6e 2c 20 72 67 6e 29 3b |w->visRg|n, rgn);|
|000037a0| 0d 09 53 65 74 4f 72 69 | 67 69 6e 28 30 2c 20 30 |..SetOri|gin(0, 0|
|000037b0| 29 3b 0d 7d 20 2f 2f 20 | 47 65 74 54 45 52 67 6e |);.} // |GetTERgn|
|000037c0| 0d 0d 2f 2f 20 52 65 74 | 75 72 6e 20 62 6f 6f 6c |..// Ret|urn bool|
|000037d0| 65 61 6e 20 76 61 6c 75 | 65 20 69 6e 64 69 63 61 |ean valu|e indica|
|000037e0| 74 69 6e 67 20 74 68 61 | 74 20 74 68 65 72 65 20 |ting tha|t there |
|000037f0| 69 73 20 6f 72 20 69 73 | 20 6e 6f 74 20 61 0d 2f |is or is| not a./|
|00003800| 2f 20 73 65 6c 65 63 74 | 69 6f 6e 20 69 6e 20 74 |/ select|ion in t|
|00003810| 68 65 20 64 6f 63 75 6d | 65 6e 74 0d 0d 42 6f 6f |he docum|ent..Boo|
|00003820| 6c 65 61 6e 20 54 45 44 | 6f 63 75 6d 65 6e 74 3a |lean TED|ocument:|
|00003830| 3a 48 61 76 65 53 65 6c | 65 63 74 69 6f 6e 28 29 |:HaveSel|ection()|
|00003840| 0d 7b 0d 09 69 66 20 28 | 20 28 2a 66 44 6f 63 54 |.{..if (| (*fDocT|
|00003850| 45 29 2d 3e 73 65 6c 53 | 74 61 72 74 20 3c 20 28 |E)->selS|tart < (|
|00003860| 2a 66 44 6f 63 54 45 29 | 2d 3e 73 65 6c 45 6e 64 |*fDocTE)|->selEnd|
|00003870| 20 29 0d 09 20 20 72 65 | 74 75 72 6e 20 74 72 75 | ).. re|turn tru|
|00003880| 65 3b 0d 09 65 6c 73 65 | 20 72 65 74 75 72 6e 20 |e;..else| return |
|00003890| 66 61 6c 73 65 3b 0d 7d | 0d 0d 2f 2f 20 55 70 64 |false;.}|..// Upd|
|000038a0| 61 74 65 20 74 68 65 20 | 54 45 52 65 63 27 73 20 |ate the |TERec's |
|000038b0| 76 69 65 77 20 72 65 63 | 74 20 73 6f 20 74 68 61 |view rec|t so tha|
|000038c0| 74 20 69 74 20 69 73 20 | 74 68 65 20 67 72 65 61 |t it is |the grea|
|000038d0| 74 65 73 74 20 6d 75 6c | 74 69 70 6c 65 20 6f 66 |test mul|tiple of|
|000038e0| 0d 2f 2f 20 74 68 65 20 | 6c 69 6e 65 48 65 69 67 |.// the |lineHeig|
|000038f0| 68 74 20 74 68 61 74 20 | 73 74 69 6c 6c 20 66 69 |ht that |still fi|
|00003900| 74 73 20 69 6e 20 74 68 | 65 20 6f 6c 64 20 76 69 |ts in th|e old vi|
|00003910| 65 77 52 65 63 74 2e 0d | 0d 76 6f 69 64 20 54 45 |ewRect..|.void TE|
|00003920| 44 6f 63 75 6d 65 6e 74 | 3a 3a 41 64 6a 75 73 74 |Document|::Adjust|
|00003930| 56 69 65 77 52 65 63 74 | 28 76 6f 69 64 29 0d 7b |ViewRect|(void).{|
|00003940| 0d 09 54 45 50 74 72 20 | 74 65 3b 0d 09 0d 09 74 |..TEPtr |te;....t|
|00003950| 65 20 3d 20 2a 66 44 6f | 63 54 45 3b 0d 09 74 65 |e = *fDo|cTE;..te|
|00003960| 2d 3e 76 69 65 77 52 65 | 63 74 2e 62 6f 74 74 6f |->viewRe|ct.botto|
|00003970| 6d 20 3d 20 28 28 28 74 | 65 2d 3e 76 69 65 77 52 |m = (((t|e->viewR|
|00003980| 65 63 74 2e 62 6f 74 74 | 6f 6d 20 2d 20 74 65 2d |ect.bott|om - te-|
|00003990| 3e 76 69 65 77 52 65 63 | 74 2e 74 6f 70 29 20 2f |>viewRec|t.top) /|
|000039a0| 20 74 65 2d 3e 6c 69 6e | 65 48 65 69 67 68 74 29 | te->lin|eHeight)|
|000039b0| 0d 09 09 09 09 09 09 09 | 2a 20 74 65 2d 3e 6c 69 |........|* te->li|
|000039c0| 6e 65 48 65 69 67 68 74 | 29 20 2b 20 74 65 2d 3e |neHeight|) + te->|
|000039d0| 76 69 65 77 52 65 63 74 | 2e 74 6f 70 3b 0d 7d 20 |viewRect|.top;.} |
|000039e0| 2f 2f 20 41 64 6a 75 73 | 74 56 69 65 77 52 65 63 |// Adjus|tViewRec|
|000039f0| 74 0d 0d 2f 2f 20 53 63 | 72 6f 6c 6c 20 74 68 65 |t..// Sc|roll the|
|00003a00| 20 54 45 52 65 63 20 61 | 72 6f 75 6e 64 20 74 6f | TERec a|round to|
|00003a10| 20 6d 61 74 63 68 20 75 | 70 20 74 6f 20 74 68 65 | match u|p to the|
|00003a20| 20 70 6f 74 65 6e 74 69 | 61 6c 6c 79 20 75 70 64 | potenti|ally upd|
|00003a30| 61 74 65 64 20 73 63 72 | 6f 6c 6c 62 61 72 0d 2f |ated scr|ollbar./|
|00003a40| 2f 20 76 61 6c 75 65 73 | 2e 20 54 68 69 73 20 69 |/ values|. This i|
|00003a50| 73 20 72 65 61 6c 6c 79 | 20 75 73 65 66 75 6c 20 |s really| useful |
|00003a60| 77 68 65 6e 20 74 68 65 | 20 77 69 6e 64 6f 77 20 |when the| window |
|00003a70| 68 61 73 20 62 65 65 6e | 20 72 65 73 69 7a 65 64 |has been| resized|
|00003a80| 20 73 75 63 68 20 74 68 | 61 74 20 74 68 65 0d 2f | such th|at the./|
|00003a90| 2f 20 73 63 72 6f 6c 6c | 62 61 72 73 20 62 65 63 |/ scroll|bars bec|
|00003aa0| 61 6d 65 20 69 6e 61 63 | 74 69 76 65 20 62 75 74 |ame inac|tive but|
|00003ab0| 20 74 68 65 20 54 45 52 | 65 63 20 77 61 73 20 61 | the TER|ec was a|
|00003ac0| 6c 72 65 61 64 79 20 73 | 63 72 6f 6c 6c 65 64 2e |lready s|crolled.|
|00003ad0| 0d 0d 76 6f 69 64 20 54 | 45 44 6f 63 75 6d 65 6e |..void T|EDocumen|
|00003ae0| 74 3a 3a 41 64 6a 75 73 | 74 54 45 28 76 6f 69 64 |t::Adjus|tTE(void|
|00003af0| 29 0d 7b 0d 09 54 45 50 | 74 72 20 74 65 3b 0d 09 |).{..TEP|tr te;..|
|00003b00| 0d 09 74 65 20 3d 20 2a | 66 44 6f 63 54 45 3b 0d |..te = *|fDocTE;.|
|00003b10| 09 54 45 53 63 72 6f 6c | 6c 28 28 74 65 2d 3e 76 |.TEScrol|l((te->v|
|00003b20| 69 65 77 52 65 63 74 2e | 6c 65 66 74 20 2d 20 74 |iewRect.|left - t|
|00003b30| 65 2d 3e 64 65 73 74 52 | 65 63 74 2e 6c 65 66 74 |e->destR|ect.left|
|00003b40| 29 20 2d 20 47 65 74 43 | 74 6c 56 61 6c 75 65 28 |) - GetC|tlValue(|
|00003b50| 66 44 6f 63 48 53 63 72 | 6f 6c 6c 29 2c 0d 09 09 |fDocHScr|oll),...|
|00003b60| 09 20 28 74 65 2d 3e 76 | 69 65 77 52 65 63 74 2e |. (te->v|iewRect.|
|00003b70| 74 6f 70 20 2d 20 74 65 | 2d 3e 64 65 73 74 52 65 |top - te|->destRe|
|00003b80| 63 74 2e 74 6f 70 29 20 | 2d 20 0d 09 09 09 20 09 |ct.top) |- .... .|
|00003b90| 28 47 65 74 43 74 6c 56 | 61 6c 75 65 28 66 44 6f |(GetCtlV|alue(fDo|
|00003ba0| 63 56 53 63 72 6f 6c 6c | 29 20 2a 20 74 65 2d 3e |cVScroll|) * te->|
|00003bb0| 6c 69 6e 65 48 65 69 67 | 68 74 29 2c 0d 09 09 09 |lineHeig|ht),....|
|00003bc0| 20 66 44 6f 63 54 45 29 | 3b 0d 7d 20 2f 2f 20 41 | fDocTE)|;.} // A|
|00003bd0| 64 6a 75 73 74 54 45 0d | 0d 2f 2f 20 52 65 2d 63 |djustTE.|.// Re-c|
|00003be0| 61 6c 63 75 6c 61 74 65 | 20 74 68 65 20 70 6f 73 |alculate| the pos|
|00003bf0| 69 74 69 6f 6e 20 61 6e | 64 20 73 69 7a 65 20 6f |ition an|d size o|
|00003c00| 66 20 74 68 65 20 76 69 | 65 77 52 65 63 74 20 61 |f the vi|ewRect a|
|00003c10| 6e 64 20 74 68 65 20 73 | 63 72 6f 6c 6c 62 61 72 |nd the s|crollbar|
|00003c20| 73 2e 0d 2f 2f 20 6b 53 | 63 72 6f 6c 6c 54 77 65 |s..// kS|crollTwe|
|00003c30| 65 6b 20 63 6f 6d 70 65 | 6e 73 61 74 65 73 20 66 |ek compe|nsates f|
|00003c40| 6f 72 20 6f 66 66 2d 62 | 79 2d 6f 6e 65 20 72 65 |or off-b|y-one re|
|00003c50| 71 75 69 72 65 6d 65 6e | 74 73 20 6f 66 20 74 68 |quiremen|ts of th|
|00003c60| 65 20 73 63 72 6f 6c 6c | 62 61 72 73 0d 2f 2f 20 |e scroll|bars.// |
|00003c70| 74 6f 20 68 61 76 65 20 | 62 6f 72 64 65 72 73 20 |to have |borders |
|00003c80| 63 6f 69 6e 63 69 64 65 | 20 77 69 74 68 20 74 68 |coincide| with th|
|00003c90| 65 20 67 72 6f 77 62 6f | 78 2e 0d 0d 76 6f 69 64 |e growbo|x...void|
|00003ca0| 20 54 45 44 6f 63 75 6d | 65 6e 74 3a 3a 41 64 6a | TEDocum|ent::Adj|
|00003cb0| 75 73 74 53 63 72 6f 6c | 6c 53 69 7a 65 73 28 76 |ustScrol|lSizes(v|
|00003cc0| 6f 69 64 29 0d 7b 0d 09 | 52 65 63 74 20 74 65 52 |oid).{..|Rect teR|
|00003cd0| 65 63 74 3b 0d 09 0d 09 | 47 65 74 54 45 52 65 63 |ect;....|GetTERec|
|00003ce0| 74 28 26 74 65 52 65 63 | 74 29 3b 0d 09 28 2a 66 |t(&teRec|t);..(*f|
|00003cf0| 44 6f 63 54 45 29 2d 3e | 76 69 65 77 52 65 63 74 |DocTE)->|viewRect|
|00003d00| 20 3d 20 74 65 52 65 63 | 74 3b 0d 09 41 64 6a 75 | = teRec|t;..Adju|
|00003d10| 73 74 56 69 65 77 52 65 | 63 74 28 29 3b 0d 09 4d |stViewRe|ct();..M|
|00003d20| 6f 76 65 43 6f 6e 74 72 | 6f 6c 28 66 44 6f 63 56 |oveContr|ol(fDocV|
|00003d30| 53 63 72 6f 6c 6c 2c 20 | 66 44 6f 63 57 69 6e 64 |Scroll, |fDocWind|
|00003d40| 6f 77 2d 3e 70 6f 72 74 | 52 65 63 74 2e 72 69 67 |ow->port|Rect.rig|
|00003d50| 68 74 20 2d 20 6b 53 63 | 72 6f 6c 6c 62 61 72 41 |ht - kSc|rollbarA|
|00003d60| 64 6a 75 73 74 2c 20 2d | 31 29 3b 0d 09 53 69 7a |djust, -|1);..Siz|
|00003d70| 65 43 6f 6e 74 72 6f 6c | 28 66 44 6f 63 56 53 63 |eControl|(fDocVSc|
|00003d80| 72 6f 6c 6c 2c 20 6b 53 | 63 72 6f 6c 6c 62 61 72 |roll, kS|crollbar|
|00003d90| 57 69 64 74 68 2c 0d 09 | 09 09 09 66 44 6f 63 57 |Width,..|...fDocW|
|00003da0| 69 6e 64 6f 77 2d 3e 70 | 6f 72 74 52 65 63 74 2e |indow->p|ortRect.|
|00003db0| 62 6f 74 74 6f 6d 20 2d | 20 66 44 6f 63 57 69 6e |bottom -| fDocWin|
|00003dc0| 64 6f 77 2d 3e 70 6f 72 | 74 52 65 63 74 2e 74 6f |dow->por|tRect.to|
|00003dd0| 70 20 2d 0d 09 09 09 09 | 09 6b 47 72 6f 77 62 6f |p -.....|.kGrowbo|
|00003de0| 78 41 64 6a 75 73 74 20 | 2b 20 6b 53 63 72 6f 6c |xAdjust |+ kScrol|
|00003df0| 6c 54 77 65 65 6b 29 3b | 0d 09 4d 6f 76 65 43 6f |lTweek);|..MoveCo|
|00003e00| 6e 74 72 6f 6c 28 66 44 | 6f 63 48 53 63 72 6f 6c |ntrol(fD|ocHScrol|
|00003e10| 6c 2c 20 2d 31 2c 20 66 | 44 6f 63 57 69 6e 64 6f |l, -1, f|DocWindo|
|00003e20| 77 2d 3e 70 6f 72 74 52 | 65 63 74 2e 62 6f 74 74 |w->portR|ect.bott|
|00003e30| 6f 6d 20 2d 20 6b 53 63 | 72 6f 6c 6c 62 61 72 41 |om - kSc|rollbarA|
|00003e40| 64 6a 75 73 74 29 3b 0d | 09 53 69 7a 65 43 6f 6e |djust);.|.SizeCon|
|00003e50| 74 72 6f 6c 28 66 44 6f | 63 48 53 63 72 6f 6c 6c |trol(fDo|cHScroll|
|00003e60| 2c 0d 09 09 09 09 66 44 | 6f 63 57 69 6e 64 6f 77 |,.....fD|ocWindow|
|00003e70| 2d 3e 70 6f 72 74 52 65 | 63 74 2e 72 69 67 68 74 |->portRe|ct.right|
|00003e80| 20 2d 20 66 44 6f 63 57 | 69 6e 64 6f 77 2d 3e 70 | - fDocW|indow->p|
|00003e90| 6f 72 74 52 65 63 74 2e | 6c 65 66 74 20 2d 0d 09 |ortRect.|left -..|
|00003ea0| 09 09 09 09 6b 47 72 6f | 77 62 6f 78 41 64 6a 75 |....kGro|wboxAdju|
|00003eb0| 73 74 20 2b 20 6b 53 63 | 72 6f 6c 6c 54 77 65 65 |st + kSc|rollTwee|
|00003ec0| 6b 2c 0d 09 09 09 09 6b | 53 63 72 6f 6c 6c 62 61 |k,.....k|Scrollba|
|00003ed0| 72 57 69 64 74 68 29 3b | 0d 7d 20 2f 2f 20 41 64 |rWidth);|.} // Ad|
|00003ee0| 6a 75 73 74 53 63 72 6f | 6c 6c 53 69 7a 65 73 0d |justScro|llSizes.|
|00003ef0| 0d 2f 2f 20 54 75 72 6e | 20 6f 66 66 20 74 68 65 |.// Turn| off the|
|00003f00| 20 63 6f 6e 74 72 6f 6c | 73 20 62 79 20 6a 61 6d | control|s by jam|
|00003f10| 6d 69 6e 67 20 61 20 7a | 65 72 6f 20 69 6e 74 6f |ming a z|ero into|
|00003f20| 20 74 68 65 69 72 20 63 | 6f 6e 74 72 6c 56 69 73 | their c|ontrlVis|
|00003f30| 20 66 69 65 6c 64 73 20 | 28 48 69 64 65 43 6f 6e | fields |(HideCon|
|00003f40| 74 72 6f 6c 20 65 72 61 | 73 65 73 20 74 68 65 6d |trol era|ses them|
|00003f50| 0d 2f 2f 20 61 6e 64 20 | 77 65 20 64 6f 6e 27 74 |.// and |we don't|
|00003f60| 20 77 61 6e 74 20 74 68 | 61 74 29 2e 20 49 66 20 | want th|at). If |
|00003f70| 74 68 65 20 63 6f 6e 74 | 72 6f 6c 73 20 61 72 65 |the cont|rols are|
|00003f80| 20 74 6f 20 62 65 20 72 | 65 73 69 7a 65 64 20 61 | to be r|esized a|
|00003f90| 73 20 77 65 6c 6c 2c 20 | 63 61 6c 6c 20 74 68 65 |s well, |call the|
|00003fa0| 20 70 72 6f 63 65 64 75 | 72 65 20 74 6f 20 64 6f | procedu|re to do|
|00003fb0| 20 74 68 61 74 2c 0d 2f | 2f 20 74 68 65 6e 20 63 | that,./|/ then c|
|00003fc0| 61 6c 6c 20 74 68 65 20 | 70 72 6f 63 65 64 75 72 |all the |procedur|
|00003fd0| 65 20 74 6f 20 61 64 6a | 75 73 74 20 74 68 65 20 |e to adj|ust the |
|00003fe0| 6d 61 78 69 6d 75 6d 20 | 61 6e 64 20 63 75 72 72 |maximum |and curr|
|00003ff0| 65 6e 74 20 76 61 6c 75 | 65 73 2e 20 46 69 6e 61 |ent valu|es. Fina|
|00004000| 6c 6c 79 20 72 65 2d 65 | 6e 61 62 6c 65 20 74 68 |lly re-e|nable th|
|00004010| 65 20 63 6f 6e 74 72 6f | 6c 73 0d 2f 2f 20 62 79 |e contro|ls.// by|
|00004020| 20 6a 61 6d 6d 69 6e 67 | 20 61 20 24 46 46 20 69 | jamming| a $FF i|
|00004030| 6e 20 74 68 65 69 72 20 | 63 6f 6e 74 72 6c 56 69 |n their |contrlVi|
|00004040| 73 20 66 69 65 6c 64 73 | 20 28 53 68 6f 77 43 6f |s fields| (ShowCo|
|00004050| 6e 74 72 6f 6c 20 72 65 | 2d 64 72 61 77 73 20 74 |ntrol re|-draws t|
|00004060| 68 65 20 63 6f 6e 74 72 | 6f 6c 2c 20 77 68 69 63 |he contr|ol, whic|
|00004070| 68 20 6d 61 79 20 6e 6f | 74 20 62 65 0d 2f 2f 20 |h may no|t be.// |
|00004080| 6e 65 63 65 73 73 61 72 | 79 29 2e 0d 0d 76 6f 69 |necessar|y)...voi|
|00004090| 64 20 54 45 44 6f 63 75 | 6d 65 6e 74 3a 3a 41 64 |d TEDocu|ment::Ad|
|000040a0| 6a 75 73 74 53 63 72 6f | 6c 6c 62 61 72 73 28 42 |justScro|llbars(B|
|000040b0| 6f 6f 6c 65 61 6e 20 6e | 65 65 64 73 52 65 73 69 |oolean n|eedsResi|
|000040c0| 7a 65 29 0d 7b 0d 09 2f | 2f 20 46 69 72 73 74 2c |ze).{../|/ First,|
|000040d0| 20 74 75 72 6e 20 76 69 | 73 69 62 69 6c 69 74 79 | turn vi|sibility|
|000040e0| 20 6f 66 20 73 63 72 6f | 6c 6c 62 61 72 73 20 6f | of scro|llbars o|
|000040f0| 66 66 20 73 6f 20 77 65 | 20 77 6f 6e d5 74 20 67 |ff so we| won.t g|
|00004100| 65 74 20 75 6e 77 61 6e | 74 65 64 20 72 65 64 72 |et unwan|ted redr|
|00004110| 61 77 69 6e 67 20 0d 09 | 28 2a 66 44 6f 63 56 53 |awing ..|(*fDocVS|
|00004120| 63 72 6f 6c 6c 29 2d 3e | 63 6f 6e 74 72 6c 56 69 |croll)->|contrlVi|
|00004130| 73 20 3d 20 30 3b 0d 09 | 28 2a 66 44 6f 63 48 53 |s = 0;..|(*fDocHS|
|00004140| 63 72 6f 6c 6c 29 2d 3e | 63 6f 6e 74 72 6c 56 69 |croll)->|contrlVi|
|00004150| 73 20 3d 20 30 3b 0d 09 | 69 66 20 28 20 6e 65 65 |s = 0;..|if ( nee|
|00004160| 64 73 52 65 73 69 7a 65 | 20 29 0d 09 20 20 41 64 |dsResize| ).. Ad|
|00004170| 6a 75 73 74 53 63 72 6f | 6c 6c 53 69 7a 65 73 28 |justScro|llSizes(|
|00004180| 29 3b 0d 09 41 64 6a 75 | 73 74 53 63 72 6f 6c 6c |);..Adju|stScroll|
|00004190| 56 61 6c 75 65 73 28 6e | 65 65 64 73 52 65 73 69 |Values(n|eedsResi|
|000041a0| 7a 65 29 3b 0d 09 2f 2f | 20 4e 6f 77 2c 20 72 65 |ze);..//| Now, re|
|000041b0| 73 74 6f 72 65 20 76 69 | 73 69 62 69 6c 69 74 79 |store vi|sibility|
|000041c0| 20 69 6e 20 63 61 73 65 | 20 77 65 20 6e 65 76 65 | in case| we neve|
|000041d0| 72 20 68 61 64 20 74 6f | 20 64 72 61 77 20 64 75 |r had to| draw du|
|000041e0| 72 69 6e 67 20 61 64 6a | 75 73 74 6d 65 6e 74 20 |ring adj|ustment |
|000041f0| 0d 09 28 2a 66 44 6f 63 | 56 53 63 72 6f 6c 6c 29 |..(*fDoc|VScroll)|
|00004200| 2d 3e 63 6f 6e 74 72 6c | 56 69 73 20 3d 20 30 78 |->contrl|Vis = 0x|
|00004210| 66 66 3b 0d 09 28 2a 66 | 44 6f 63 48 53 63 72 6f |ff;..(*f|DocHScro|
|00004220| 6c 6c 29 2d 3e 63 6f 6e | 74 72 6c 56 69 73 20 3d |ll)->con|trlVis =|
|00004230| 20 30 78 66 66 3b 0d 7d | 20 2f 2f 20 41 64 6a 75 | 0xff;.}| // Adju|
|00004240| 73 74 53 63 72 6f 6c 6c | 62 61 72 73 20 0d 0d 2f |stScroll|bars ../|
|00004250| 2f 20 43 61 6c 63 75 6c | 61 74 65 20 74 68 65 20 |/ Calcul|ate the |
|00004260| 6e 65 77 20 63 6f 6e 74 | 72 6f 6c 20 6d 61 78 69 |new cont|rol maxi|
|00004270| 6d 75 6d 20 76 61 6c 75 | 65 20 61 6e 64 20 63 75 |mum valu|e and cu|
|00004280| 72 72 65 6e 74 20 76 61 | 6c 75 65 2c 20 77 68 65 |rrent va|lue, whe|
|00004290| 74 68 65 72 20 69 74 20 | 69 73 20 74 68 65 20 68 |ther it |is the h|
|000042a0| 6f 72 69 7a 6f 6e 74 61 | 6c 20 6f 72 0d 2f 2f 20 |orizonta|l or.// |
|000042b0| 76 65 72 74 69 63 61 6c | 20 73 63 72 6f 6c 6c 62 |vertical| scrollb|
|000042c0| 61 72 2e 20 54 68 65 20 | 76 65 72 74 69 63 61 6c |ar. The |vertical|
|000042d0| 20 6d 61 78 20 69 73 20 | 63 61 6c 63 75 6c 61 74 | max is |calculat|
|000042e0| 65 64 20 62 79 20 63 6f | 6d 70 61 72 69 6e 67 20 |ed by co|mparing |
|000042f0| 74 68 65 20 6e 75 6d 62 | 65 72 20 6f 66 20 6c 69 |the numb|er of li|
|00004300| 6e 65 73 20 74 6f 20 74 | 68 65 0d 2f 2f 20 76 65 |nes to t|he.// ve|
|00004310| 72 74 69 63 61 6c 20 73 | 69 7a 65 20 6f 66 20 74 |rtical s|ize of t|
|00004320| 68 65 20 76 69 65 77 52 | 65 63 74 2e 20 54 68 65 |he viewR|ect. The|
|00004330| 20 68 6f 72 69 7a 6f 6e | 74 61 6c 20 6d 61 78 20 | horizon|tal max |
|00004340| 69 73 20 63 61 6c 63 75 | 6c 61 74 65 64 20 62 79 |is calcu|lated by|
|00004350| 20 63 6f 6d 70 61 72 69 | 6e 67 20 74 68 65 20 6d | compari|ng the m|
|00004360| 61 78 69 6d 75 6d 20 64 | 6f 63 75 6d 65 6e 74 0d |aximum d|ocument.|
|00004370| 2f 2f 20 77 69 64 74 68 | 20 74 6f 20 74 68 65 20 |// width| to the |
|00004380| 77 69 64 74 68 20 6f 66 | 20 74 68 65 20 76 69 65 |width of| the vie|
|00004390| 77 52 65 63 74 2e 20 54 | 68 65 20 63 75 72 72 65 |wRect. T|he curre|
|000043a0| 6e 74 20 76 61 6c 75 65 | 73 20 61 72 65 20 73 65 |nt value|s are se|
|000043b0| 74 20 62 79 20 63 6f 6d | 70 61 72 69 6e 67 20 74 |t by com|paring t|
|000043c0| 68 65 20 6f 66 66 73 65 | 74 20 62 65 74 77 65 65 |he offse|t betwee|
|000043d0| 6e 0d 2f 2f 20 74 68 65 | 20 76 69 65 77 20 61 6e |n.// the| view an|
|000043e0| 64 20 64 65 73 74 69 6e | 61 74 69 6f 6e 20 72 65 |d destin|ation re|
|000043f0| 63 74 73 2e 20 49 66 20 | 6e 65 63 65 73 73 61 72 |cts. If |necessar|
|00004400| 79 2c 20 72 65 64 72 61 | 77 20 74 68 65 20 63 6f |y, redra|w the co|
|00004410| 6e 74 72 6f 6c 20 62 79 | 20 63 61 6c 6c 69 6e 67 |ntrol by| calling|
|00004420| 20 53 68 6f 77 43 6f 6e | 74 72 6f 6c 2e 0d 0d 76 | ShowCon|trol...v|
|00004430| 6f 69 64 20 54 45 44 6f | 63 75 6d 65 6e 74 3a 3a |oid TEDo|cument::|
|00004440| 41 64 6a 75 73 74 48 56 | 28 42 6f 6f 6c 65 61 6e |AdjustHV|(Boolean|
|00004450| 20 69 73 56 65 72 74 2c | 42 6f 6f 6c 65 61 6e 20 | isVert,|Boolean |
|00004460| 6d 75 73 74 52 65 64 72 | 61 77 29 0d 7b 0d 09 73 |mustRedr|aw).{..s|
|00004470| 68 6f 72 74 20 76 61 6c | 75 65 2c 20 6c 69 6e 65 |hort val|ue, line|
|00004480| 73 2c 20 6d 61 78 3b 0d | 09 73 68 6f 72 74 20 6f |s, max;.|.short o|
|00004490| 6c 64 56 61 6c 75 65 2c | 20 6f 6c 64 4d 61 78 3b |ldValue,| oldMax;|
|000044a0| 0d 09 54 45 50 74 72 20 | 74 65 3b 0d 09 43 6f 6e |..TEPtr |te;..Con|
|000044b0| 74 72 6f 6c 48 61 6e 64 | 6c 65 20 63 6f 6e 74 72 |trolHand|le contr|
|000044c0| 6f 6c 3b 0d 0d 09 69 66 | 20 28 69 73 56 65 72 74 |ol;...if| (isVert|
|000044d0| 29 0d 09 20 20 63 6f 6e | 74 72 6f 6c 20 3d 20 66 |).. con|trol = f|
|000044e0| 44 6f 63 56 53 63 72 6f | 6c 6c 3b 0d 09 65 6c 73 |DocVScro|ll;..els|
|000044f0| 65 20 63 6f 6e 74 72 6f | 6c 20 3d 20 66 44 6f 63 |e contro|l = fDoc|
|00004500| 48 53 63 72 6f 6c 6c 3b | 0d 09 6f 6c 64 56 61 6c |HScroll;|..oldVal|
|00004510| 75 65 20 3d 20 47 65 74 | 43 74 6c 56 61 6c 75 65 |ue = Get|CtlValue|
|00004520| 28 63 6f 6e 74 72 6f 6c | 29 3b 0d 09 6f 6c 64 4d |(control|);..oldM|
|00004530| 61 78 20 3d 20 47 65 74 | 43 74 6c 4d 61 78 28 63 |ax = Get|CtlMax(c|
|00004540| 6f 6e 74 72 6f 6c 29 3b | 0d 09 74 65 20 3d 20 2a |ontrol);|..te = *|
|00004550| 66 44 6f 63 54 45 3b 09 | 09 09 09 09 09 09 2f 2f |fDocTE;.|......//|
|00004560| 20 70 6f 69 6e 74 20 74 | 6f 20 54 45 52 65 63 20 | point t|o TERec |
|00004570| 66 6f 72 20 63 6f 6e 76 | 65 6e 69 65 6e 63 65 20 |for conv|enience |
|00004580| 0d 09 69 66 20 28 20 69 | 73 56 65 72 74 20 29 0d |..if ( i|sVert ).|
|00004590| 09 20 20 7b 0d 09 09 6c | 69 6e 65 73 20 3d 20 74 |. {...l|ines = t|
|000045a0| 65 2d 3e 6e 4c 69 6e 65 | 73 3b 0d 09 09 2f 2f 20 |e->nLine|s;...// |
|000045b0| 73 69 6e 63 65 20 6e 4c | 69 6e 65 73 20 69 73 6e |since nL|ines isn|
|000045c0| d5 74 20 72 69 67 68 74 | 20 69 66 20 74 68 65 20 |.t right| if the |
|000045d0| 6c 61 73 74 20 63 68 61 | 72 61 63 74 65 72 20 69 |last cha|racter i|
|000045e0| 73 20 61 20 72 65 74 75 | 72 6e 2c 20 63 68 65 63 |s a retu|rn, chec|
|000045f0| 6b 20 66 6f 72 20 74 68 | 61 74 20 63 61 73 65 0d |k for th|at case.|
|00004600| 09 09 69 66 20 28 20 2a | 28 2a 74 65 2d 3e 68 54 |..if ( *|(*te->hT|
|00004610| 65 78 74 20 2b 20 74 65 | 2d 3e 74 65 4c 65 6e 67 |ext + te|->teLeng|
|00004620| 74 68 20 2d 20 31 29 20 | 3d 3d 20 6b 43 72 43 68 |th - 1) |== kCrCh|
|00004630| 61 72 20 29 0d 09 09 20 | 20 6c 69 6e 65 73 20 2b |ar )... | lines +|
|00004640| 3d 20 31 3b 0d 09 09 6d | 61 78 20 3d 20 6c 69 6e |= 1;...m|ax = lin|
|00004650| 65 73 20 2d 20 28 28 74 | 65 2d 3e 76 69 65 77 52 |es - ((t|e->viewR|
|00004660| 65 63 74 2e 62 6f 74 74 | 6f 6d 20 2d 20 74 65 2d |ect.bott|om - te-|
|00004670| 3e 76 69 65 77 52 65 63 | 74 2e 74 6f 70 29 20 2f |>viewRec|t.top) /|
|00004680| 0d 09 09 09 09 09 20 20 | 20 74 65 2d 3e 6c 69 6e |...... | te->lin|
|00004690| 65 48 65 69 67 68 74 29 | 3b 0d 09 20 20 7d 0d 09 |eHeight)|;.. }..|
|000046a0| 65 6c 73 65 20 6d 61 78 | 20 3d 20 6b 4d 61 78 44 |else max| = kMaxD|
|000046b0| 6f 63 57 69 64 74 68 20 | 2d 20 28 74 65 2d 3e 76 |ocWidth |- (te->v|
|000046c0| 69 65 77 52 65 63 74 2e | 72 69 67 68 74 20 2d 20 |iewRect.|right - |
|000046d0| 74 65 2d 3e 76 69 65 77 | 52 65 63 74 2e 6c 65 66 |te->view|Rect.lef|
|000046e0| 74 29 3b 0d 09 0d 09 69 | 66 20 28 20 6d 61 78 20 |t);....i|f ( max |
|000046f0| 3c 20 30 20 29 0d 09 20 | 20 6d 61 78 20 3d 20 30 |< 0 ).. | max = 0|
|00004700| 3b 0d 09 53 65 74 43 74 | 6c 4d 61 78 28 63 6f 6e |;..SetCt|lMax(con|
|00004710| 74 72 6f 6c 2c 20 6d 61 | 78 29 3b 0d 09 0d 09 2f |trol, ma|x);..../|
|00004720| 2f 20 4d 75 73 74 20 64 | 65 72 65 66 2e 20 61 66 |/ Must d|eref. af|
|00004730| 74 65 72 20 53 65 74 43 | 74 6c 4d 61 78 20 73 69 |ter SetC|tlMax si|
|00004740| 6e 63 65 2c 20 74 65 63 | 68 6e 69 63 61 6c 6c 79 |nce, tec|hnically|
|00004750| 2c 20 69 74 20 63 6f 75 | 6c 64 20 64 72 61 77 20 |, it cou|ld draw |
|00004760| 61 6e 64 20 74 68 65 72 | 65 66 6f 72 65 20 6d 6f |and ther|efore mo|
|00004770| 76 65 0d 09 2f 2f 20 6d | 65 6d 6f 72 79 2e 20 54 |ve..// m|emory. T|
|00004780| 68 69 73 20 69 73 20 77 | 68 79 20 77 65 20 64 6f |his is w|hy we do|
|00004790| 6e d5 74 20 6a 75 73 74 | 20 64 6f 20 69 74 20 6f |n.t just| do it o|
|000047a0| 6e 63 65 20 61 74 20 74 | 68 65 20 62 65 67 69 6e |nce at t|he begin|
|000047b0| 6e 69 6e 67 2e 0d 09 74 | 65 20 3d 20 2a 66 44 6f |ning...t|e = *fDo|
|000047c0| 63 54 45 3b 0d 09 69 66 | 20 28 20 69 73 56 65 72 |cTE;..if| ( isVer|
|000047d0| 74 20 29 0d 09 20 20 76 | 61 6c 75 65 20 3d 20 28 |t ).. v|alue = (|
|000047e0| 74 65 2d 3e 76 69 65 77 | 52 65 63 74 2e 74 6f 70 |te->view|Rect.top|
|000047f0| 20 2d 20 74 65 2d 3e 64 | 65 73 74 52 65 63 74 2e | - te->d|estRect.|
|00004800| 74 6f 70 29 20 2f 20 74 | 65 2d 3e 6c 69 6e 65 48 |top) / t|e->lineH|
|00004810| 65 69 67 68 74 3b 0d 09 | 65 6c 73 65 20 76 61 6c |eight;..|else val|
|00004820| 75 65 20 3d 20 74 65 2d | 3e 76 69 65 77 52 65 63 |ue = te-|>viewRec|
|00004830| 74 2e 6c 65 66 74 20 2d | 20 74 65 2d 3e 64 65 73 |t.left -| te->des|
|00004840| 74 52 65 63 74 2e 6c 65 | 66 74 3b 0d 09 0d 09 69 |tRect.le|ft;....i|
|00004850| 66 20 28 20 76 61 6c 75 | 65 20 3c 20 30 20 29 0d |f ( valu|e < 0 ).|
|00004860| 09 20 20 76 61 6c 75 65 | 20 3d 20 30 3b 0d 09 65 |. value| = 0;..e|
|00004870| 6c 73 65 20 69 66 20 28 | 20 76 61 6c 75 65 20 3e |lse if (| value >|
|00004880| 20 20 6d 61 78 20 29 0d | 09 20 20 76 61 6c 75 65 | max ).|. value|
|00004890| 20 3d 20 6d 61 78 3b 0d | 09 0d 09 53 65 74 43 74 | = max;.|...SetCt|
|000048a0| 6c 56 61 6c 75 65 28 63 | 6f 6e 74 72 6f 6c 2c 20 |lValue(c|ontrol, |
|000048b0| 76 61 6c 75 65 29 3b 0d | 09 2f 2f 20 6e 6f 77 20 |value);.|.// now |
|000048c0| 72 65 64 72 61 77 20 74 | 68 65 20 63 6f 6e 74 72 |redraw t|he contr|
|000048d0| 6f 6c 20 69 66 20 61 73 | 6b 65 64 20 74 6f 20 6f |ol if as|ked to o|
|000048e0| 72 20 69 66 20 61 20 73 | 65 74 74 69 6e 67 20 63 |r if a s|etting c|
|000048f0| 68 61 6e 67 65 64 20 0d | 09 69 66 20 28 20 6d 75 |hanged .|.if ( mu|
|00004900| 73 74 52 65 64 72 61 77 | 20 7c 7c 20 28 6d 61 78 |stRedraw| || (max|
|00004910| 20 21 3d 20 6f 6c 64 4d | 61 78 29 20 7c 7c 20 28 | != oldM|ax) || (|
|00004920| 76 61 6c 75 65 20 21 3d | 20 6f 6c 64 56 61 6c 75 |value !=| oldValu|
|00004930| 65 29 20 29 0d 09 09 53 | 68 6f 77 43 6f 6e 74 72 |e) )...S|howContr|
|00004940| 6f 6c 28 63 6f 6e 74 72 | 6f 6c 29 3b 0d 7d 20 2f |ol(contr|ol);.} /|
|00004950| 2f 20 41 64 6a 75 73 74 | 48 56 0d 0d 2f 2f 20 53 |/ Adjust|HV..// S|
|00004960| 69 6d 70 6c 79 20 63 61 | 6c 6c 20 74 68 65 20 63 |imply ca|ll the c|
|00004970| 6f 6d 6d 6f 6e 20 61 64 | 6a 75 73 74 20 72 6f 75 |ommon ad|just rou|
|00004980| 74 69 6e 65 20 66 6f 72 | 20 74 68 65 20 76 65 72 |tine for| the ver|
|00004990| 74 69 63 61 6c 20 61 6e | 64 20 68 6f 72 69 7a 6f |tical an|d horizo|
|000049a0| 6e 74 61 6c 20 73 63 72 | 6f 6c 6c 62 61 72 73 2e |ntal scr|ollbars.|
|000049b0| 20 0d 0d 76 6f 69 64 20 | 54 45 44 6f 63 75 6d 65 | ..void |TEDocume|
|000049c0| 6e 74 3a 3a 41 64 6a 75 | 73 74 53 63 72 6f 6c 6c |nt::Adju|stScroll|
|000049d0| 56 61 6c 75 65 73 28 42 | 6f 6f 6c 65 61 6e 20 6d |Values(B|oolean m|
|000049e0| 75 73 74 52 65 64 72 61 | 77 29 0d 7b 0d 09 41 64 |ustRedra|w).{..Ad|
|000049f0| 6a 75 73 74 48 56 28 74 | 72 75 65 2c 20 6d 75 73 |justHV(t|rue, mus|
|00004a00| 74 52 65 64 72 61 77 29 | 3b 0d 09 41 64 6a 75 73 |tRedraw)|;..Adjus|
|00004a10| 74 48 56 28 66 61 6c 73 | 65 2c 20 6d 75 73 74 52 |tHV(fals|e, mustR|
|00004a20| 65 64 72 61 77 29 3b 0d | 7d 20 2f 2f 20 41 64 6a |edraw);.|} // Adj|
|00004a30| 75 73 74 53 63 72 6f 6c | 6c 56 61 6c 75 65 73 0d |ustScrol|lValues.|
|00004a40| 0d 43 6c 69 6b 4c 6f 6f | 70 50 72 6f 63 50 74 72 |.ClikLoo|pProcPtr|
|00004a50| 20 54 45 44 6f 63 75 6d | 65 6e 74 3a 3a 47 65 74 | TEDocum|ent::Get|
|00004a60| 43 6c 69 6b 4c 6f 6f 70 | 28 76 6f 69 64 29 0d 7b |ClikLoop|(void).{|
|00004a70| 0d 09 72 65 74 75 72 6e | 20 66 44 6f 63 43 6c 69 |..return| fDocCli|
|00004a80| 6b 3b 0d 7d 0d 0d 54 45 | 48 61 6e 64 6c 65 20 54 |k;.}..TE|Handle T|
|00004a90| 45 44 6f 63 75 6d 65 6e | 74 3a 3a 47 65 74 54 45 |EDocumen|t::GetTE|
|00004aa0| 48 61 6e 64 6c 65 28 76 | 6f 69 64 29 0d 7b 0d 09 |Handle(v|oid).{..|
|00004ab0| 72 65 74 75 72 6e 20 66 | 44 6f 63 54 45 3b 0d 7d |return f|DocTE;.}|
|00004ac0| 0d 0d 76 6f 69 64 20 54 | 45 44 6f 63 75 6d 65 6e |..void T|EDocumen|
|00004ad0| 74 3a 3a 44 6f 43 75 74 | 28 76 6f 69 64 29 0d 7b |t::DoCut|(void).{|
|00004ae0| 0d 09 6c 6f 6e 67 20 74 | 6f 74 61 6c 2c 20 63 6f |..long t|otal, co|
|00004af0| 6e 74 69 67 3b 0d 0d 09 | 69 66 20 28 5a 65 72 6f |ntig;...|if (Zero|
|00004b00| 53 63 72 61 70 28 29 20 | 3d 3d 20 6e 6f 45 72 72 |Scrap() |== noErr|
|00004b10| 29 0d 09 20 20 7b 0d 09 | 09 50 75 72 67 65 53 70 |).. {..|.PurgeSp|
|00004b20| 61 63 65 28 26 74 6f 74 | 61 6c 2c 20 26 63 6f 6e |ace(&tot|al, &con|
|00004b30| 74 69 67 29 3b 0d 09 09 | 69 66 20 28 28 2a 66 44 |tig);...|if ((*fD|
|00004b40| 6f 63 54 45 29 2d 3e 73 | 65 6c 45 6e 64 20 2d 20 |ocTE)->s|elEnd - |
|00004b50| 28 2a 66 44 6f 63 54 45 | 29 2d 3e 73 65 6c 53 74 |(*fDocTE|)->selSt|
|00004b60| 61 72 74 20 2b 20 6b 54 | 45 53 6c 6f 70 20 3e 20 |art + kT|ESlop > |
|00004b70| 63 6f 6e 74 69 67 29 0d | 09 09 20 20 41 6c 65 72 |contig).|.. Aler|
|00004b80| 74 55 73 65 72 28 6b 54 | 45 44 6f 63 45 72 72 53 |tUser(kT|EDocErrS|
|00004b90| 74 72 69 6e 67 73 2c 65 | 4e 6f 53 70 61 63 65 43 |trings,e|NoSpaceC|
|00004ba0| 75 74 29 3b 0d 09 09 65 | 6c 73 65 0d 09 09 20 20 |ut);...e|lse... |
|00004bb0| 7b 0d 09 09 09 54 45 43 | 75 74 28 66 44 6f 63 54 |{....TEC|ut(fDocT|
|00004bc0| 45 29 3b 0d 09 09 09 69 | 66 20 28 54 45 54 6f 53 |E);....i|f (TEToS|
|00004bd0| 63 72 61 70 28 29 20 21 | 3d 20 6e 6f 45 72 72 29 |crap() !|= noErr)|
|00004be0| 0d 09 09 09 20 20 7b 0d | 09 09 09 09 41 6c 65 72 |.... {.|....Aler|
|00004bf0| 74 55 73 65 72 28 6b 54 | 45 44 6f 63 45 72 72 53 |tUser(kT|EDocErrS|
|00004c00| 74 72 69 6e 67 73 2c 65 | 4e 6f 43 75 74 29 3b 0d |trings,e|NoCut);.|
|00004c10| 09 09 09 09 28 76 6f 69 | 64 29 20 5a 65 72 6f 53 |....(voi|d) ZeroS|
|00004c20| 63 72 61 70 28 29 3b 0d | 09 09 09 20 20 7d 0d 09 |crap();.|... }..|
|00004c30| 09 20 20 7d 0d 09 20 20 | 7d 0d 09 41 64 6a 75 73 |. }.. |}..Adjus|
|00004c40| 74 53 63 72 6f 6c 6c 62 | 61 72 73 28 66 61 6c 73 |tScrollb|ars(fals|
|00004c50| 65 29 3b 0d 09 41 64 6a | 75 73 74 54 45 28 29 3b |e);..Adj|ustTE();|
|00004c60| 0d 7d 0d 0d 76 6f 69 64 | 20 54 45 44 6f 63 75 6d |.}..void| TEDocum|
|00004c70| 65 6e 74 3a 3a 44 6f 43 | 6f 70 79 28 76 6f 69 64 |ent::DoC|opy(void|
|00004c80| 29 0d 7b 0d 09 69 66 20 | 28 20 5a 65 72 6f 53 63 |).{..if |( ZeroSc|
|00004c90| 72 61 70 28 29 20 3d 3d | 20 6e 6f 45 72 72 20 29 |rap() ==| noErr )|
|00004ca0| 0d 09 20 20 7b 0d 09 09 | 54 45 43 6f 70 79 28 66 |.. {...|TECopy(f|
|00004cb0| 44 6f 63 54 45 29 3b 09 | 09 09 09 2f 2f 20 61 66 |DocTE);.|...// af|
|00004cc0| 74 65 72 20 63 6f 70 79 | 69 6e 67 2c 20 65 78 70 |ter copy|ing, exp|
|00004cd0| 6f 72 74 20 74 68 65 20 | 54 45 20 73 63 72 61 70 |ort the |TE scrap|
|00004ce0| 0d 09 09 69 66 20 28 20 | 54 45 54 6f 53 63 72 61 |...if ( |TEToScra|
|00004cf0| 70 28 29 20 21 3d 20 6e | 6f 45 72 72 20 29 0d 09 |p() != n|oErr )..|
|00004d00| 09 20 20 7b 0d 09 09 09 | 41 6c 65 72 74 55 73 65 |. {....|AlertUse|
|00004d10| 72 28 6b 54 45 44 6f 63 | 45 72 72 53 74 72 69 6e |r(kTEDoc|ErrStrin|
|00004d20| 67 73 2c 65 4e 6f 43 6f | 70 79 29 3b 0d 09 09 09 |gs,eNoCo|py);....|
|00004d30| 5a 65 72 6f 53 63 72 61 | 70 28 29 3b 0d 09 09 20 |ZeroScra|p();... |
|00004d40| 20 7d 0d 09 20 20 7d 0d | 09 41 64 6a 75 73 74 53 | }.. }.|.AdjustS|
|00004d50| 63 72 6f 6c 6c 62 61 72 | 73 28 66 61 6c 73 65 29 |crollbar|s(false)|
|00004d60| 3b 0d 09 41 64 6a 75 73 | 74 54 45 28 29 3b 0d 7d |;..Adjus|tTE();.}|
|00004d70| 0d 0d 76 6f 69 64 20 54 | 45 44 6f 63 75 6d 65 6e |..void T|EDocumen|
|00004d80| 74 3a 3a 44 6f 50 61 73 | 74 65 28 76 6f 69 64 29 |t::DoPas|te(void)|
|00004d90| 0d 7b 0d 09 48 61 6e 64 | 6c 65 20 61 48 61 6e 64 |.{..Hand|le aHand|
|00004da0| 6c 65 3b 0d 09 6c 6f 6e | 67 20 6f 6c 64 53 69 7a |le;..lon|g oldSiz|
|00004db0| 65 2c 20 6e 65 77 53 69 | 7a 65 3b 0d 09 4f 53 45 |e, newSi|ze;..OSE|
|00004dc0| 72 72 20 73 61 76 65 45 | 72 72 3b 0d 0d 09 69 66 |rr saveE|rr;...if|
|00004dd0| 20 28 20 54 45 46 72 6f | 6d 53 63 72 61 70 28 29 | ( TEFro|mScrap()|
|00004de0| 20 3d 3d 20 6e 6f 45 72 | 72 20 29 0d 09 20 20 7b | == noEr|r ).. {|
|00004df0| 0d 09 09 69 66 20 28 20 | 54 45 47 65 74 53 63 72 |...if ( |TEGetScr|
|00004e00| 61 70 4c 65 6e 28 29 20 | 2b 20 28 28 2a 66 44 6f |apLen() |+ ((*fDo|
|00004e10| 63 54 45 29 2d 3e 74 65 | 4c 65 6e 67 74 68 20 2d |cTE)->te|Length -|
|00004e20| 0d 09 09 09 20 28 28 2a | 66 44 6f 63 54 45 29 2d |.... ((*|fDocTE)-|
|00004e30| 3e 73 65 6c 45 6e 64 20 | 2d 20 28 2a 66 44 6f 63 |>selEnd |- (*fDoc|
|00004e40| 54 45 29 2d 3e 73 65 6c | 53 74 61 72 74 29 29 20 |TE)->sel|Start)) |
|00004e50| 3e 20 6b 4d 61 78 54 45 | 4c 65 6e 67 74 68 20 29 |> kMaxTE|Length )|
|00004e60| 0d 09 09 20 20 41 6c 65 | 72 74 55 73 65 72 28 6b |... Ale|rtUser(k|
|00004e70| 54 45 44 6f 63 45 72 72 | 53 74 72 69 6e 67 73 2c |TEDocErr|Strings,|
|00004e80| 65 45 78 63 65 65 64 50 | 61 73 74 65 29 3b 0d 09 |eExceedP|aste);..|
|00004e90| 09 65 6c 73 65 0d 09 09 | 20 20 7b 0d 09 09 09 61 |.else...| {....a|
|00004ea0| 48 61 6e 64 6c 65 20 3d | 20 28 48 61 6e 64 6c 65 |Handle =| (Handle|
|00004eb0| 29 20 54 45 47 65 74 54 | 65 78 74 28 66 44 6f 63 |) TEGetT|ext(fDoc|
|00004ec0| 54 45 29 3b 0d 09 09 09 | 6f 6c 64 53 69 7a 65 20 |TE);....|oldSize |
|00004ed0| 3d 20 47 65 74 48 61 6e | 64 6c 65 53 69 7a 65 28 |= GetHan|dleSize(|
|00004ee0| 61 48 61 6e 64 6c 65 29 | 3b 0d 09 09 09 6e 65 77 |aHandle)|;....new|
|00004ef0| 53 69 7a 65 20 3d 20 6f | 6c 64 53 69 7a 65 20 2b |Size = o|ldSize +|
|00004f00| 20 54 45 47 65 74 53 63 | 72 61 70 4c 65 6e 28 29 | TEGetSc|rapLen()|
|00004f10| 20 2b 20 6b 54 45 53 6c | 6f 70 3b 0d 09 09 09 53 | + kTESl|op;....S|
|00004f20| 65 74 48 61 6e 64 6c 65 | 53 69 7a 65 28 61 48 61 |etHandle|Size(aHa|
|00004f30| 6e 64 6c 65 2c 20 6e 65 | 77 53 69 7a 65 29 3b 0d |ndle, ne|wSize);.|
|00004f40| 09 09 09 73 61 76 65 45 | 72 72 20 3d 20 4d 65 6d |...saveE|rr = Mem|
|00004f50| 45 72 72 6f 72 28 29 3b | 0d 09 09 09 53 65 74 48 |Error();|....SetH|
|00004f60| 61 6e 64 6c 65 53 69 7a | 65 28 61 48 61 6e 64 6c |andleSiz|e(aHandl|
|00004f70| 65 2c 20 6f 6c 64 53 69 | 7a 65 29 3b 0d 09 09 09 |e, oldSi|ze);....|
|00004f80| 69 66 20 28 73 61 76 65 | 45 72 72 20 21 3d 20 6e |if (save|Err != n|
|00004f90| 6f 45 72 72 29 0d 09 09 | 09 20 20 41 6c 65 72 74 |oErr)...|. Alert|
|00004fa0| 55 73 65 72 28 6b 54 45 | 44 6f 63 45 72 72 53 74 |User(kTE|DocErrSt|
|00004fb0| 72 69 6e 67 73 2c 65 4e | 6f 53 70 61 63 65 50 61 |rings,eN|oSpacePa|
|00004fc0| 73 74 65 29 3b 0d 09 09 | 09 65 6c 73 65 20 54 45 |ste);...|.else TE|
|00004fd0| 50 61 73 74 65 28 66 44 | 6f 63 54 45 29 3b 0d 09 |Paste(fD|ocTE);..|
|00004fe0| 09 20 20 7d 0d 09 20 20 | 7d 0d 09 65 6c 73 65 20 |. }.. |}..else |
|00004ff0| 41 6c 65 72 74 55 73 65 | 72 28 6b 54 45 44 6f 63 |AlertUse|r(kTEDoc|
|00005000| 45 72 72 53 74 72 69 6e | 67 73 2c 65 4e 6f 50 61 |ErrStrin|gs,eNoPa|
|00005010| 73 74 65 29 3b 0d 09 41 | 64 6a 75 73 74 53 63 72 |ste);..A|djustScr|
|00005020| 6f 6c 6c 62 61 72 73 28 | 66 61 6c 73 65 29 3b 0d |ollbars(|false);.|
|00005030| 09 41 64 6a 75 73 74 54 | 45 28 29 3b 0d 7d 0d 0d |.AdjustT|E();.}..|
|00005040| 76 6f 69 64 20 54 45 44 | 6f 63 75 6d 65 6e 74 3a |void TED|ocument:|
|00005050| 3a 44 6f 43 6c 65 61 72 | 28 76 6f 69 64 29 0d 7b |:DoClear|(void).{|
|00005060| 0d 09 54 45 44 65 6c 65 | 74 65 28 66 44 6f 63 54 |..TEDele|te(fDocT|
|00005070| 45 29 3b 0d 09 41 64 6a | 75 73 74 53 63 72 6f 6c |E);..Adj|ustScrol|
|00005080| 6c 62 61 72 73 28 66 61 | 6c 73 65 29 3b 0d 09 41 |lbars(fa|lse);..A|
|00005090| 64 6a 75 73 74 54 45 28 | 29 3b 0d 7d 0d 0d 2f 2a |djustTE(|);.}../*|
|000050a0| 0d 09 52 6f 75 74 69 6e | 65 73 20 75 73 65 64 20 |..Routin|es used |
|000050b0| 62 79 20 74 68 69 73 20 | 63 6c 61 73 73 2c 20 77 |by this |class, w|
|000050c0| 68 69 63 68 20 64 6f 6e | 27 74 20 62 65 6c 6f 6e |hich don|'t belon|
|000050d0| 67 20 74 6f 20 74 68 65 | 20 63 6c 61 73 73 20 73 |g to the| class s|
|000050e0| 69 6e 63 65 20 77 65 20 | 75 73 65 0d 09 74 68 65 |ince we |use..the|
|000050f0| 6d 20 61 73 20 74 6f 6f | 6c 62 6f 78 20 66 69 6c |m as too|lbox fil|
|00005100| 74 65 72 20 72 6f 75 74 | 69 6e 65 73 2c 20 61 6e |ter rout|ines, an|
|00005110| 64 20 79 6f 75 20 63 61 | 6e 6e 6f 74 20 70 61 73 |d you ca|nnot pas|
|00005120| 73 20 63 6c 61 73 73 20 | 6d 65 74 68 6f 64 73 20 |s class |methods |
|00005130| 61 73 20 50 72 6f 63 50 | 74 72 73 2e 0d 2a 2f 0d |as ProcP|trs..*/.|
|00005140| 0d 2f 2f 20 77 65 20 72 | 65 66 65 72 20 62 61 63 |.// we r|efer bac|
|00005150| 6b 20 74 6f 20 74 68 65 | 20 6f 77 6e 69 6e 67 20 |k to the| owning |
|00005160| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 73 6f 20 74 |applicat|ion so t|
|00005170| 68 61 74 20 77 65 20 63 | 61 6e 20 67 65 74 20 61 |hat we c|an get a|
|00005180| 63 63 65 73 73 20 74 6f | 0d 2f 2f 20 74 68 65 20 |ccess to|.// the |
|00005190| 64 6f 63 75 6d 65 6e 74 | 20 6c 69 73 74 2c 20 74 |document| list, t|
|000051a0| 6f 20 66 69 6e 64 20 74 | 68 65 20 63 75 72 72 65 |o find t|he curre|
|000051b0| 6e 74 20 64 6f 63 75 6d | 65 6e 74 20 6f 62 6a 65 |nt docum|ent obje|
|000051c0| 63 74 2e 0d 65 78 74 65 | 72 6e 20 54 45 53 61 6d |ct..exte|rn TESam|
|000051d0| 70 6c 65 20 2a 67 54 68 | 65 41 70 70 6c 69 63 61 |ple *gTh|eApplica|
|000051e0| 74 69 6f 6e 3b 0d 0d 2f | 2f 20 43 6f 6d 6d 6f 6e |tion;../|/ Common|
|000051f0| 20 61 6c 67 6f 72 69 74 | 68 6d 20 66 6f 72 20 70 | algorit|hm for p|
|00005200| 69 6e 6e 69 6e 67 20 74 | 68 65 20 76 61 6c 75 65 |inning t|he value|
|00005210| 20 6f 66 20 61 20 63 6f | 6e 74 72 6f 6c 2e 20 49 | of a co|ntrol. I|
|00005220| 74 20 72 65 74 75 72 6e | 73 20 74 68 65 20 61 63 |t return|s the ac|
|00005230| 74 75 61 6c 20 61 6d 6f | 75 6e 74 0d 2f 2f 20 74 |tual amo|unt.// t|
|00005240| 68 65 20 76 61 6c 75 65 | 20 6f 66 20 74 68 65 20 |he value| of the |
|00005250| 63 6f 6e 74 72 6f 6c 20 | 63 68 61 6e 67 65 64 2e |control |changed.|
|00005260| 0d 0d 76 6f 69 64 20 43 | 6f 6d 6d 6f 6e 41 63 74 |..void C|ommonAct|
|00005270| 69 6f 6e 28 43 6f 6e 74 | 72 6f 6c 48 61 6e 64 6c |ion(Cont|rolHandl|
|00005280| 65 20 63 6f 6e 74 72 6f | 6c 2c 73 68 6f 72 74 2a |e contro|l,short*|
|00005290| 20 61 6d 6f 75 6e 74 29 | 0d 7b 0d 09 73 68 6f 72 | amount)|.{..shor|
|000052a0| 74 09 09 76 61 6c 75 65 | 2c 20 6d 61 78 3b 0d 09 |t..value|, max;..|
|000052b0| 0d 09 76 61 6c 75 65 20 | 3d 20 47 65 74 43 74 6c |..value |= GetCtl|
|000052c0| 56 61 6c 75 65 28 63 6f | 6e 74 72 6f 6c 29 3b 0d |Value(co|ntrol);.|
|000052d0| 09 6d 61 78 20 3d 20 47 | 65 74 43 74 6c 4d 61 78 |.max = G|etCtlMax|
|000052e0| 28 63 6f 6e 74 72 6f 6c | 29 3b 0d 09 2a 61 6d 6f |(control|);..*amo|
|000052f0| 75 6e 74 20 3d 20 76 61 | 6c 75 65 20 2d 20 2a 61 |unt = va|lue - *a|
|00005300| 6d 6f 75 6e 74 3b 0d 09 | 69 66 20 28 20 2a 61 6d |mount;..|if ( *am|
|00005310| 6f 75 6e 74 20 3c 3d 20 | 30 20 29 0d 09 09 2a 61 |ount <= |0 )...*a|
|00005320| 6d 6f 75 6e 74 20 3d 20 | 30 3b 0d 09 65 6c 73 65 |mount = |0;..else|
|00005330| 20 69 66 20 28 20 2a 61 | 6d 6f 75 6e 74 20 3e 3d | if ( *a|mount >=|
|00005340| 20 6d 61 78 20 29 0d 09 | 09 2a 61 6d 6f 75 6e 74 | max )..|.*amount|
|00005350| 20 3d 20 6d 61 78 3b 0d | 09 53 65 74 43 74 6c 56 | = max;.|.SetCtlV|
|00005360| 61 6c 75 65 28 63 6f 6e | 74 72 6f 6c 2c 20 2a 61 |alue(con|trol, *a|
|00005370| 6d 6f 75 6e 74 29 3b 0d | 09 2a 61 6d 6f 75 6e 74 |mount);.|.*amount|
|00005380| 20 3d 20 76 61 6c 75 65 | 20 2d 20 2a 61 6d 6f 75 | = value| - *amou|
|00005390| 6e 74 3b 0d 7d 20 2f 2f | 20 43 6f 6d 6d 6f 6e 41 |nt;.} //| CommonA|
|000053a0| 63 74 69 6f 6e 20 0d 0d | 0d 2f 2f 20 44 65 74 65 |ction ..|.// Dete|
|000053b0| 72 6d 69 6e 65 73 20 68 | 6f 77 20 6d 75 63 68 20 |rmines h|ow much |
|000053c0| 74 6f 20 63 68 61 6e 67 | 65 20 74 68 65 20 76 61 |to chang|e the va|
|000053d0| 6c 75 65 20 6f 66 20 74 | 68 65 20 76 65 72 74 69 |lue of t|he verti|
|000053e0| 63 61 6c 20 73 63 72 6f | 6c 6c 62 61 72 20 62 79 |cal scro|llbar by|
|000053f0| 20 61 6e 64 20 68 6f 77 | 0d 2f 2f 20 6d 75 63 68 | and how|.// much|
|00005400| 20 74 6f 20 73 63 72 6f | 6c 6c 20 74 68 65 20 54 | to scro|ll the T|
|00005410| 45 20 72 65 63 6f 72 64 | 2e 0d 0d 70 61 73 63 61 |E record|...pasca|
|00005420| 6c 20 76 6f 69 64 20 56 | 41 63 74 69 6f 6e 50 72 |l void V|ActionPr|
|00005430| 6f 63 28 43 6f 6e 74 72 | 6f 6c 48 61 6e 64 6c 65 |oc(Contr|olHandle|
|00005440| 20 63 6f 6e 74 72 6f 6c | 2c 73 68 6f 72 74 20 70 | control|,short p|
|00005450| 61 72 74 29 0d 7b 0d 09 | 73 68 6f 72 74 09 09 61 |art).{..|short..a|
|00005460| 6d 6f 75 6e 74 3b 0d 09 | 57 69 6e 64 6f 77 50 74 |mount;..|WindowPt|
|00005470| 72 09 77 69 6e 64 6f 77 | 3b 0d 09 54 45 50 74 72 |r.window|;..TEPtr|
|00005480| 09 09 74 65 3b 0d 09 54 | 45 44 6f 63 75 6d 65 6e |..te;..T|EDocumen|
|00005490| 74 2a 20 64 6f 63 3b 0d | 0d 09 69 66 20 28 20 70 |t* doc;.|..if ( p|
|000054a0| 61 72 74 20 21 3d 20 30 | 20 29 0d 09 20 20 7b 0d |art != 0| ).. {.|
|000054b0| 09 09 77 69 6e 64 6f 77 | 20 3d 20 28 2a 63 6f 6e |..window| = (*con|
|000054c0| 74 72 6f 6c 29 2d 3e 63 | 6f 6e 74 72 6c 4f 77 6e |trol)->c|ontrlOwn|
|000054d0| 65 72 3b 0d 09 09 64 6f | 63 20 3d 20 28 54 45 44 |er;...do|c = (TED|
|000054e0| 6f 63 75 6d 65 6e 74 2a | 29 20 28 67 54 68 65 41 |ocument*|) (gTheA|
|000054f0| 70 70 6c 69 63 61 74 69 | 6f 6e 2d 3e 44 6f 63 4c |pplicati|on->DocL|
|00005500| 69 73 74 28 29 29 2d 3e | 46 69 6e 64 44 6f 63 28 |ist())->|FindDoc(|
|00005510| 77 69 6e 64 6f 77 29 3b | 0d 09 09 74 65 20 3d 20 |window);|...te = |
|00005520| 2a 28 64 6f 63 2d 3e 47 | 65 74 54 45 48 61 6e 64 |*(doc->G|etTEHand|
|00005530| 6c 65 28 29 29 3b 0d 09 | 09 73 77 69 74 63 68 20 |le());..|.switch |
|00005540| 28 20 70 61 72 74 20 29 | 0d 09 09 20 20 7b 0d 09 |( part )|... {..|
|00005550| 09 09 63 61 73 65 20 69 | 6e 55 70 42 75 74 74 6f |..case i|nUpButto|
|00005560| 6e 3a 0d 09 09 09 63 61 | 73 65 20 69 6e 44 6f 77 |n:....ca|se inDow|
|00005570| 6e 42 75 74 74 6f 6e 3a | 09 09 2f 2f 20 6f 6e 65 |nButton:|..// one|
|00005580| 20 6c 69 6e 65 20 0d 09 | 09 09 09 61 6d 6f 75 6e | line ..|...amoun|
|00005590| 74 20 3d 20 31 3b 0d 09 | 09 09 09 62 72 65 61 6b |t = 1;..|...break|
|000055a0| 3b 0d 09 09 09 63 61 73 | 65 20 69 6e 50 61 67 65 |;....cas|e inPage|
|000055b0| 55 70 3a 09 09 09 2f 2f | 20 6f 6e 65 20 70 61 67 |Up:...//| one pag|
|000055c0| 65 20 0d 09 09 09 63 61 | 73 65 20 69 6e 50 61 67 |e ....ca|se inPag|
|000055d0| 65 44 6f 77 6e 3a 0d 09 | 09 09 09 61 6d 6f 75 6e |eDown:..|...amoun|
|000055e0| 74 20 3d 20 28 74 65 2d | 3e 76 69 65 77 52 65 63 |t = (te-|>viewRec|
|000055f0| 74 2e 62 6f 74 74 6f 6d | 20 2d 20 74 65 2d 3e 76 |t.bottom| - te->v|
|00005600| 69 65 77 52 65 63 74 2e | 74 6f 70 29 20 2f 20 74 |iewRect.|top) / t|
|00005610| 65 2d 3e 6c 69 6e 65 48 | 65 69 67 68 74 3b 0d 09 |e->lineH|eight;..|
|00005620| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 20 20 7d 0d |...break|;... }.|
|00005630| 09 09 69 66 20 28 20 28 | 70 61 72 74 20 3d 3d 20 |..if ( (|part == |
|00005640| 69 6e 44 6f 77 6e 42 75 | 74 74 6f 6e 29 20 7c 7c |inDownBu|tton) |||
|00005650| 20 28 70 61 72 74 20 3d | 3d 20 69 6e 50 61 67 65 | (part =|= inPage|
|00005660| 44 6f 77 6e 29 20 29 0d | 09 09 09 61 6d 6f 75 6e |Down) ).|...amoun|
|00005670| 74 20 3d 20 2d 61 6d 6f | 75 6e 74 3b 09 09 2f 2f |t = -amo|unt;..//|
|00005680| 20 72 65 76 65 72 73 65 | 20 64 69 72 65 63 74 69 | reverse| directi|
|00005690| 6f 6e 20 66 6f 72 20 61 | 20 64 6f 77 6e 65 72 20 |on for a| downer |
|000056a0| 0d 09 09 43 6f 6d 6d 6f | 6e 41 63 74 69 6f 6e 28 |...Commo|nAction(|
|000056b0| 63 6f 6e 74 72 6f 6c 2c | 20 26 61 6d 6f 75 6e 74 |control,| &amount|
|000056c0| 29 3b 0d 09 09 69 66 20 | 28 20 61 6d 6f 75 6e 74 |);...if |( amount|
|000056d0| 20 21 3d 20 30 20 29 0d | 09 09 09 54 45 53 63 72 | != 0 ).|...TEScr|
|000056e0| 6f 6c 6c 28 30 2c 20 61 | 6d 6f 75 6e 74 20 2a 20 |oll(0, a|mount * |
|000056f0| 74 65 2d 3e 6c 69 6e 65 | 48 65 69 67 68 74 2c 20 |te->line|Height, |
|00005700| 64 6f 63 2d 3e 47 65 74 | 54 45 48 61 6e 64 6c 65 |doc->Get|TEHandle|
|00005710| 28 29 29 3b 0d 09 20 20 | 7d 0d 7d 20 2f 2f 20 56 |());.. |}.} // V|
|00005720| 41 63 74 69 6f 6e 50 72 | 6f 63 20 0d 0d 2f 2f 20 |ActionPr|oc ..// |
|00005730| 44 65 74 65 72 6d 69 6e | 65 73 20 68 6f 77 20 6d |Determin|es how m|
|00005740| 75 63 68 20 74 6f 20 63 | 68 61 6e 67 65 20 74 68 |uch to c|hange th|
|00005750| 65 20 76 61 6c 75 65 20 | 6f 66 20 74 68 65 20 68 |e value |of the h|
|00005760| 6f 72 69 7a 6f 6e 74 61 | 6c 20 73 63 72 6f 6c 6c |orizonta|l scroll|
|00005770| 62 61 72 20 62 79 20 61 | 6e 64 20 68 6f 77 0d 2f |bar by a|nd how./|
|00005780| 2f 20 6d 75 63 68 20 74 | 6f 20 73 63 72 6f 6c 6c |/ much t|o scroll|
|00005790| 20 74 68 65 20 54 45 20 | 72 65 63 6f 72 64 2e 0d | the TE |record..|
|000057a0| 0d 70 61 73 63 61 6c 20 | 76 6f 69 64 20 48 41 63 |.pascal |void HAc|
|000057b0| 74 69 6f 6e 50 72 6f 63 | 28 43 6f 6e 74 72 6f 6c |tionProc|(Control|
|000057c0| 48 61 6e 64 6c 65 20 63 | 6f 6e 74 72 6f 6c 2c 73 |Handle c|ontrol,s|
|000057d0| 68 6f 72 74 20 70 61 72 | 74 29 0d 7b 0d 09 73 68 |hort par|t).{..sh|
|000057e0| 6f 72 74 09 09 61 6d 6f | 75 6e 74 3b 0d 09 57 69 |ort..amo|unt;..Wi|
|000057f0| 6e 64 6f 77 50 74 72 09 | 77 69 6e 64 6f 77 3b 0d |ndowPtr.|window;.|
|00005800| 09 54 45 50 74 72 09 09 | 74 65 3b 0d 09 54 45 44 |.TEPtr..|te;..TED|
|00005810| 6f 63 75 6d 65 6e 74 2a | 20 64 6f 63 3b 0d 0d 09 |ocument*| doc;...|
|00005820| 69 66 20 28 20 70 61 72 | 74 20 21 3d 20 30 20 29 |if ( par|t != 0 )|
|00005830| 0d 09 20 20 7b 0d 09 09 | 77 69 6e 64 6f 77 20 3d |.. {...|window =|
|00005840| 20 28 2a 63 6f 6e 74 72 | 6f 6c 29 2d 3e 63 6f 6e | (*contr|ol)->con|
|00005850| 74 72 6c 4f 77 6e 65 72 | 3b 0d 09 09 64 6f 63 20 |trlOwner|;...doc |
|00005860| 3d 20 28 54 45 44 6f 63 | 75 6d 65 6e 74 2a 29 20 |= (TEDoc|ument*) |
|00005870| 28 67 54 68 65 41 70 70 | 6c 69 63 61 74 69 6f 6e |(gTheApp|lication|
|00005880| 2d 3e 44 6f 63 4c 69 73 | 74 28 29 29 2d 3e 46 69 |->DocLis|t())->Fi|
|00005890| 6e 64 44 6f 63 28 77 69 | 6e 64 6f 77 29 3b 0d 09 |ndDoc(wi|ndow);..|
|000058a0| 09 74 65 20 3d 20 2a 28 | 64 6f 63 2d 3e 47 65 74 |.te = *(|doc->Get|
|000058b0| 54 45 48 61 6e 64 6c 65 | 28 29 29 3b 0d 09 09 73 |TEHandle|());...s|
|000058c0| 77 69 74 63 68 20 28 20 | 70 61 72 74 20 29 0d 09 |witch ( |part )..|
|000058d0| 09 20 20 7b 0d 09 09 09 | 63 61 73 65 20 69 6e 55 |. {....|case inU|
|000058e0| 70 42 75 74 74 6f 6e 3a | 0d 09 09 09 63 61 73 65 |pButton:|....case|
|000058f0| 20 69 6e 44 6f 77 6e 42 | 75 74 74 6f 6e 3a 09 09 | inDownB|utton:..|
|00005900| 2f 2f 20 61 20 66 65 77 | 20 70 69 78 65 6c 73 20 |// a few| pixels |
|00005910| 0d 09 09 09 09 61 6d 6f | 75 6e 74 20 3d 20 34 3b |.....amo|unt = 4;|
|00005920| 0d 09 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 09 63 |.....bre|ak;....c|
|00005930| 61 73 65 20 69 6e 50 61 | 67 65 55 70 3a 09 09 09 |ase inPa|geUp:...|
|00005940| 2f 2f 20 61 20 70 61 67 | 65 20 0d 09 09 09 63 61 |// a pag|e ....ca|
|00005950| 73 65 20 69 6e 50 61 67 | 65 44 6f 77 6e 3a 0d 09 |se inPag|eDown:..|
|00005960| 09 09 09 61 6d 6f 75 6e | 74 20 3d 20 74 65 2d 3e |...amoun|t = te->|
|00005970| 76 69 65 77 52 65 63 74 | 2e 72 69 67 68 74 20 2d |viewRect|.right -|
|00005980| 20 74 65 2d 3e 76 69 65 | 77 52 65 63 74 2e 6c 65 | te->vie|wRect.le|
|00005990| 66 74 3b 0d 09 09 09 09 | 62 72 65 61 6b 3b 0d 09 |ft;.....|break;..|
|000059a0| 09 20 20 7d 0d 09 09 69 | 66 20 28 20 28 70 61 72 |. }...i|f ( (par|
|000059b0| 74 20 3d 3d 20 69 6e 44 | 6f 77 6e 42 75 74 74 6f |t == inD|ownButto|
|000059c0| 6e 29 20 7c 7c 20 28 70 | 61 72 74 20 3d 3d 20 69 |n) || (p|art == i|
|000059d0| 6e 50 61 67 65 44 6f 77 | 6e 29 20 29 0d 09 09 09 |nPageDow|n) )....|
|000059e0| 61 6d 6f 75 6e 74 20 3d | 20 2d 61 6d 6f 75 6e 74 |amount =| -amount|
|000059f0| 3b 09 09 2f 2f 20 72 65 | 76 65 72 73 65 20 64 69 |;..// re|verse di|
|00005a00| 72 65 63 74 69 6f 6e 20 | 0d 09 09 43 6f 6d 6d 6f |rection |...Commo|
|00005a10| 6e 41 63 74 69 6f 6e 28 | 63 6f 6e 74 72 6f 6c 2c |nAction(|control,|
|00005a20| 20 26 61 6d 6f 75 6e 74 | 29 3b 0d 09 09 69 66 20 | &amount|);...if |
|00005a30| 28 20 61 6d 6f 75 6e 74 | 20 21 3d 20 30 20 29 0d |( amount| != 0 ).|
|00005a40| 09 09 09 54 45 53 63 72 | 6f 6c 6c 28 61 6d 6f 75 |...TEScr|oll(amou|
|00005a50| 6e 74 2c 20 30 2c 20 64 | 6f 63 2d 3e 47 65 74 54 |nt, 0, d|oc->GetT|
|00005a60| 45 48 61 6e 64 6c 65 28 | 29 29 3b 0d 09 20 20 7d |EHandle(|));.. }|
|00005a70| 0d 7d 20 2f 2f 20 56 41 | 63 74 69 6f 6e 50 72 6f |.} // VA|ctionPro|
|00005a80| 63 20 0d 0d 2f 2f 20 47 | 65 74 73 20 63 61 6c 6c |c ..// G|ets call|
|00005a90| 65 64 20 66 72 6f 6d 20 | 6f 75 72 20 61 73 73 65 |ed from |our asse|
|00005aa0| 6d 62 6c 79 20 6c 61 6e | 67 75 61 67 65 20 72 6f |mbly lan|guage ro|
|00005ab0| 75 74 69 6e 65 2c 20 41 | 73 6d 43 6c 69 6b 4c 6f |utine, A|smClikLo|
|00005ac0| 6f 70 2c 20 77 68 69 63 | 68 20 69 73 20 69 6e 0d |op, whic|h is in.|
|00005ad0| 2f 2f 20 74 75 72 6e 20 | 63 61 6c 6c 65 64 20 62 |// turn |called b|
|00005ae0| 79 20 74 68 65 20 54 45 | 43 6c 69 63 6b 20 74 6f |y the TE|Click to|
|00005af0| 6f 6c 62 6f 78 20 72 6f | 75 74 69 6e 65 2e 20 53 |olbox ro|utine. S|
|00005b00| 61 76 65 73 20 74 68 65 | 20 77 69 6e 64 6f 77 73 |aves the| windows|
|00005b10| 20 63 6c 69 70 20 72 65 | 67 69 6f 6e 2c 0d 2f 2f | clip re|gion,.//|
|00005b20| 20 73 65 74 73 20 69 74 | 20 74 6f 20 74 68 65 20 | sets it| to the |
|00005b30| 70 6f 72 74 52 65 63 74 | 2c 20 61 64 6a 75 73 74 |portRect|, adjust|
|00005b40| 73 20 74 68 65 20 73 63 | 72 6f 6c 6c 62 61 72 20 |s the sc|rollbar |
|00005b50| 76 61 6c 75 65 73 20 74 | 6f 20 6d 61 74 63 68 20 |values t|o match |
|00005b60| 74 68 65 20 54 45 20 73 | 63 72 6f 6c 6c 0d 2f 2f |the TE s|croll.//|
|00005b70| 20 61 6d 6f 75 6e 74 2c | 20 74 68 65 6e 20 72 65 | amount,| then re|
|00005b80| 73 74 6f 72 65 73 20 74 | 68 65 20 63 6c 69 70 20 |stores t|he clip |
|00005b90| 72 65 67 69 6f 6e 2e 0d | 0d 70 61 73 63 61 6c 20 |region..|.pascal |
|00005ba0| 76 6f 69 64 20 50 61 73 | 63 61 6c 43 6c 69 6b 4c |void Pas|calClikL|
|00005bb0| 6f 6f 70 28 76 6f 69 64 | 29 0d 7b 0d 09 52 67 6e |oop(void|).{..Rgn|
|00005bc0| 48 61 6e 64 6c 65 09 72 | 65 67 69 6f 6e 3b 0d 09 |Handle.r|egion;..|
|00005bd0| 57 69 6e 64 6f 77 50 74 | 72 20 77 69 6e 64 3b 0d |WindowPt|r wind;.|
|00005be0| 09 54 45 44 6f 63 75 6d | 65 6e 74 2a 20 64 6f 63 |.TEDocum|ent* doc|
|00005bf0| 3b 0d 0d 09 77 69 6e 64 | 20 3d 20 46 72 6f 6e 74 |;...wind| = Front|
|00005c00| 57 69 6e 64 6f 77 28 29 | 3b 0d 09 64 6f 63 20 3d |Window()|;..doc =|
|00005c10| 20 28 54 45 44 6f 63 75 | 6d 65 6e 74 2a 29 20 28 | (TEDocu|ment*) (|
|00005c20| 67 54 68 65 41 70 70 6c | 69 63 61 74 69 6f 6e 2d |gTheAppl|ication-|
|00005c30| 3e 44 6f 63 4c 69 73 74 | 28 29 29 2d 3e 46 69 6e |>DocList|())->Fin|
|00005c40| 64 44 6f 63 28 77 69 6e | 64 29 3b 0d 09 72 65 67 |dDoc(win|d);..reg|
|00005c50| 69 6f 6e 20 3d 20 4e 65 | 77 52 67 6e 28 29 3b 0d |ion = Ne|wRgn();.|
|00005c60| 09 47 65 74 43 6c 69 70 | 28 72 65 67 69 6f 6e 29 |.GetClip|(region)|
|00005c70| 3b 09 2f 2f 20 73 61 76 | 65 20 63 6c 69 70 20 0d |;.// sav|e clip .|
|00005c80| 09 43 6c 69 70 52 65 63 | 74 28 26 77 69 6e 64 2d |.ClipRec|t(&wind-|
|00005c90| 3e 70 6f 72 74 52 65 63 | 74 29 3b 0d 09 64 6f 63 |>portRec|t);..doc|
|00005ca0| 2d 3e 41 64 6a 75 73 74 | 53 63 72 6f 6c 6c 56 61 |->Adjust|ScrollVa|
|00005cb0| 6c 75 65 73 28 66 61 6c | 73 65 29 3b 0d 09 53 65 |lues(fal|se);..Se|
|00005cc0| 74 43 6c 69 70 28 72 65 | 67 69 6f 6e 29 3b 09 2f |tClip(re|gion);./|
|00005cd0| 2f 20 72 65 73 74 6f 72 | 65 20 63 6c 69 70 20 0d |/ restor|e clip .|
|00005ce0| 09 44 69 73 70 6f 73 65 | 52 67 6e 28 72 65 67 69 |.Dispose|Rgn(regi|
|00005cf0| 6f 6e 29 3b 0d 7d 20 2f | 2f 20 50 61 73 63 61 6c |on);.} /|/ Pascal|
|00005d00| 43 6c 69 6b 4c 6f 6f 70 | 20 0d 0d 2f 2f 20 47 65 |ClikLoop| ..// Ge|
|00005d10| 74 73 20 63 61 6c 6c 65 | 64 20 66 72 6f 6d 20 6f |ts calle|d from o|
|00005d20| 75 72 20 61 73 73 65 6d | 62 6c 79 20 6c 61 6e 67 |ur assem|bly lang|
|00005d30| 75 61 67 65 20 72 6f 75 | 74 69 6e 65 2c 20 41 73 |uage rou|tine, As|
|00005d40| 6d 43 6c 69 6b 4c 6f 6f | 70 2c 20 77 68 69 63 68 |mClikLoo|p, which|
|00005d50| 20 69 73 20 69 6e 0d 2f | 2f 20 74 75 72 6e 20 63 | is in./|/ turn c|
|00005d60| 61 6c 6c 65 64 20 62 79 | 20 74 68 65 20 54 45 43 |alled by| the TEC|
|00005d70| 6c 69 63 6b 20 74 6f 6f | 6c 62 6f 78 20 72 6f 75 |lick too|lbox rou|
|00005d80| 74 69 6e 65 2e 20 49 74 | 20 72 65 74 75 72 6e 73 |tine. It| returns|
|00005d90| 20 74 68 65 20 61 64 64 | 72 65 73 73 20 6f 66 20 | the add|ress of |
|00005da0| 74 68 65 0d 2f 2f 20 64 | 65 66 61 75 6c 74 20 63 |the.// d|efault c|
|00005db0| 6c 69 6b 4c 6f 6f 70 20 | 72 6f 75 74 69 6e 65 20 |likLoop |routine |
|00005dc0| 74 68 61 74 20 77 61 73 | 20 70 75 74 20 69 6e 74 |that was| put int|
|00005dd0| 6f 20 74 68 65 20 54 45 | 52 65 63 20 62 79 20 54 |o the TE|Rec by T|
|00005de0| 45 41 75 74 6f 56 69 65 | 77 20 74 6f 0d 2f 2f 20 |EAutoVie|w to.// |
|00005df0| 41 73 6d 43 6c 69 6b 4c | 6f 6f 70 20 73 6f 20 74 |AsmClikL|oop so t|
|00005e00| 68 61 74 20 69 74 20 63 | 61 6e 20 63 61 6c 6c 20 |hat it c|an call |
|00005e10| 69 74 2e 0d 0d 70 61 73 | 63 61 6c 20 43 6c 69 6b |it...pas|cal Clik|
|00005e20| 4c 6f 6f 70 50 72 6f 63 | 50 74 72 20 47 65 74 4f |LoopProc|Ptr GetO|
|00005e30| 6c 64 43 6c 69 6b 4c 6f | 6f 70 28 76 6f 69 64 29 |ldClikLo|op(void)|
|00005e40| 0d 7b 0d 09 54 45 44 6f | 63 75 6d 65 6e 74 2a 20 |.{..TEDo|cument* |
|00005e50| 64 6f 63 3b 0d 0d 09 64 | 6f 63 20 3d 20 28 54 45 |doc;...d|oc = (TE|
|00005e60| 44 6f 63 75 6d 65 6e 74 | 2a 29 20 28 67 54 68 65 |Document|*) (gThe|
|00005e70| 41 70 70 6c 69 63 61 74 | 69 6f 6e 2d 3e 44 6f 63 |Applicat|ion->Doc|
|00005e80| 4c 69 73 74 28 29 29 2d | 3e 46 69 6e 64 44 6f 63 |List())-|>FindDoc|
|00005e90| 28 46 72 6f 6e 74 57 69 | 6e 64 6f 77 28 29 29 3b |(FrontWi|ndow());|
|00005ea0| 0d 09 69 66 20 28 64 6f | 63 20 3d 3d 20 6e 69 6c |..if (do|c == nil|
|00005eb0| 29 0d 09 20 20 72 65 74 | 75 72 6e 20 6e 69 6c 3b |).. ret|urn nil;|
|00005ec0| 0d 09 72 65 74 75 72 6e | 20 64 6f 63 2d 3e 47 65 |..return| doc->Ge|
|00005ed0| 74 43 6c 69 6b 4c 6f 6f | 70 28 29 3b 0d 7d 20 2f |tClikLoo|p();.} /|
|00005ee0| 2f 20 47 65 74 4f 6c 64 | 43 6c 69 6b 4c 6f 6f 70 |/ GetOld|ClikLoop|
|00005ef0| 0d 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005f00| 00 00 01 00 00 00 01 4c | 00 00 00 4c 00 00 00 32 |.......L|...L...2|
|00005f10| 47 46 00 00 00 18 00 1e | 00 0a 01 1c 01 12 00 01 |GF......|........|
|00005f20| 00 00 00 00 00 00 00 00 | c1 82 03 53 43 57 00 00 |........|...SCW..|
|00005f30| 0d 54 45 44 6f 63 75 6d | 65 6e 74 2e 63 70 02 00 |.TEDocum|ent.cp..|
|00005f40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005f50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005f60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005f70| 00 00 a0 a1 88 df 00 00 | 00 00 00 00 01 7e 00 15 |........|.....~..|
|00005f80| 00 1e 00 0a 01 1c 01 12 | 00 01 00 00 00 00 00 00 |........|........|
|00005f90| 00 00 c1 8a 00 00 00 00 | 18 00 1e 00 0a 01 1c 01 |........|........|
|00005fa0| 12 00 01 00 00 00 00 00 | 00 00 00 c1 8b 03 53 43 |........|......SC|
|00005fb0| 57 00 00 01 00 06 07 e0 | fc 0c 0f f1 8c 08 18 19 |W.......|........|
|00005fc0| 8c 77 18 19 8c ff 80 19 | 9d fe 0f f9 ae fe 1f f8 |.w......|........|
|00005fd0| cc ff 98 18 00 ff 98 18 | 00 7f 18 18 0c 36 18 18 |........|.....6..|
|00005fe0| 18 00 18 18 10 06 18 1e | 6e 0c 0f fe ff 08 07 fd |........|n.......|
|00005ff0| fc 77 00 01 fc ff 80 01 | ff fe 00 01 ff fe 0c 00 |.w......|........|
|00006000| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 00 00 00 |...H..Mo|naco....|
|00006010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006020| 00 00 00 00 00 00 00 06 | 00 04 00 27 00 00 01 df |........|...'....|
|00006030| 02 30 00 8c 00 14 01 dd | 02 3d a0 72 17 3b 00 00 |.0......|.=.r.;..|
|00006040| 00 00 00 00 00 00 00 00 | 00 00 01 00 00 00 01 00 |........|........|
|00006050| 00 00 01 4c 00 00 00 4c | 00 00 00 32 00 16 a5 64 |...L...L|...2...d|
|00006060| 07 5a 00 00 00 1c 00 32 | 00 00 4d 50 53 52 00 00 |.Z.....2|..MPSR..|
|00006070| 00 0a 03 ed ff ff 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+