Home » Archimedes archive » Acorn User » Acorn User - Shareware Collection (1993).adf » Zap » !Zap/Docs/E-Cursors

!Zap/Docs/E-Cursors

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » Acorn User - Shareware Collection (1993).adf » Zap
Filename: !Zap/Docs/E-Cursors
Read OK:
File size: 0A25 bytes
Load address: 0000
Exec address: 0000
File contents
*************************************************************************
* >E-Cursors	Documents a cursor block format.			*
*************************************************************************

Zap currently supports 3 cursors. Each has a cursor block. The addresses of
the blocks can be read via Zap_ReadVar (See E-Vars). I will call them after
the names of their pointers, ie, car_cursor, car_input, car_selection. The
second is not usually used. It is used in cursor mode 2, when the cursors are
split for keyboard copying.

The current cursor mode is stored in a variable called car_mode. Use
Zap_ReadVar to get at this. Currently modes 0-5 are defined as below:

Mode:	Cursors updated on screen:	Use:

0	car_selection			Window hasn't got the input.

1	car_cursor & car_selection	Standard editing

2	car_cursor			Split cursor copying
	car_input			car_cursor=moving cursor
	car_selection			car_input=where input goes

3	car_selection			Select area via keyboard
					car_cursor=current posn
					
4	car_selection			Select area via mouse
					car_cursor=current posn
					
5	car_input & car_selection	Select via mouse with CTRL held
					car_cursor=current posn
					car_input=fixed cursor

The offsets of a cursor block have names beginning 'c_'. As usual, the
E-Library file defines these offsets for you. They are described below. By
convention, R10 is used to point to a cursor block.

c_wind
Window offset of associated window (use Zap_ConvWindOff). This offset is -1
if the cursor is not being used.

c_line		Current line cursor is on.
c_col		Current column cursor is on.
c_off		Current file offset of cursor.
c_loff		Current file offset of start of physical line of cursor.
c_width		Width of cursor in characters.

c_owind		Window of old cursor position.
c_oline		Line of old cursor position.
c_ocol		Column of old cursor position.
c_owidth	Old cursor width.

The above meanings hold for car_cursor and car_input. For car_selection the
current cursor position is the start of the selection and the old cursor
position gives the end of the selection. Also c_owidth gives the end offset
of the selection. c_width is unused. By start and end I mean logical start
and end. Thus, it may not hold that the start comes before the end in the
file.

To alter a cursors position you should first store the new position in the
current position variables. The easiest way to do this is to store the new
offset in c_off and then call Zap_UpdateCaret. You should then call Zap_Plot
caret to move the caret on screen and update the old offset to the current
offset. Zap_ReflectCaret combines these.
00000000  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000040  2a 2a 2a 2a 2a 2a 2a 2a  2a 0a 2a 20 3e 45 2d 43  |*********.* >E-C|
00000050  75 72 73 6f 72 73 09 44  6f 63 75 6d 65 6e 74 73  |ursors.Documents|
00000060  20 61 20 63 75 72 73 6f  72 20 62 6c 6f 63 6b 20  | a cursor block |
00000070  66 6f 72 6d 61 74 2e 09  09 09 2a 0a 2a 2a 2a 2a  |format....*.****|
00000080  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
000000c0  2a 2a 2a 2a 2a 0a 0a 5a  61 70 20 63 75 72 72 65  |*****..Zap curre|
000000d0  6e 74 6c 79 20 73 75 70  70 6f 72 74 73 20 33 20  |ntly supports 3 |
000000e0  63 75 72 73 6f 72 73 2e  20 45 61 63 68 20 68 61  |cursors. Each ha|
000000f0  73 20 61 20 63 75 72 73  6f 72 20 62 6c 6f 63 6b  |s a cursor block|
00000100  2e 20 54 68 65 20 61 64  64 72 65 73 73 65 73 20  |. The addresses |
00000110  6f 66 0a 74 68 65 20 62  6c 6f 63 6b 73 20 63 61  |of.the blocks ca|
00000120  6e 20 62 65 20 72 65 61  64 20 76 69 61 20 5a 61  |n be read via Za|
00000130  70 5f 52 65 61 64 56 61  72 20 28 53 65 65 20 45  |p_ReadVar (See E|
00000140  2d 56 61 72 73 29 2e 20  49 20 77 69 6c 6c 20 63  |-Vars). I will c|
00000150  61 6c 6c 20 74 68 65 6d  20 61 66 74 65 72 0a 74  |all them after.t|
00000160  68 65 20 6e 61 6d 65 73  20 6f 66 20 74 68 65 69  |he names of thei|
00000170  72 20 70 6f 69 6e 74 65  72 73 2c 20 69 65 2c 20  |r pointers, ie, |
00000180  63 61 72 5f 63 75 72 73  6f 72 2c 20 63 61 72 5f  |car_cursor, car_|
00000190  69 6e 70 75 74 2c 20 63  61 72 5f 73 65 6c 65 63  |input, car_selec|
000001a0  74 69 6f 6e 2e 20 54 68  65 0a 73 65 63 6f 6e 64  |tion. The.second|
000001b0  20 69 73 20 6e 6f 74 20  75 73 75 61 6c 6c 79 20  | is not usually |
000001c0  75 73 65 64 2e 20 49 74  20 69 73 20 75 73 65 64  |used. It is used|
000001d0  20 69 6e 20 63 75 72 73  6f 72 20 6d 6f 64 65 20  | in cursor mode |
000001e0  32 2c 20 77 68 65 6e 20  74 68 65 20 63 75 72 73  |2, when the curs|
000001f0  6f 72 73 20 61 72 65 0a  73 70 6c 69 74 20 66 6f  |ors are.split fo|
00000200  72 20 6b 65 79 62 6f 61  72 64 20 63 6f 70 79 69  |r keyboard copyi|
00000210  6e 67 2e 0a 0a 54 68 65  20 63 75 72 72 65 6e 74  |ng...The current|
00000220  20 63 75 72 73 6f 72 20  6d 6f 64 65 20 69 73 20  | cursor mode is |
00000230  73 74 6f 72 65 64 20 69  6e 20 61 20 76 61 72 69  |stored in a vari|
00000240  61 62 6c 65 20 63 61 6c  6c 65 64 20 63 61 72 5f  |able called car_|
00000250  6d 6f 64 65 2e 20 55 73  65 0a 5a 61 70 5f 52 65  |mode. Use.Zap_Re|
00000260  61 64 56 61 72 20 74 6f  20 67 65 74 20 61 74 20  |adVar to get at |
00000270  74 68 69 73 2e 20 43 75  72 72 65 6e 74 6c 79 20  |this. Currently |
00000280  6d 6f 64 65 73 20 30 2d  35 20 61 72 65 20 64 65  |modes 0-5 are de|
00000290  66 69 6e 65 64 20 61 73  20 62 65 6c 6f 77 3a 0a  |fined as below:.|
000002a0  0a 4d 6f 64 65 3a 09 43  75 72 73 6f 72 73 20 75  |.Mode:.Cursors u|
000002b0  70 64 61 74 65 64 20 6f  6e 20 73 63 72 65 65 6e  |pdated on screen|
000002c0  3a 09 55 73 65 3a 0a 0a  30 09 63 61 72 5f 73 65  |:.Use:..0.car_se|
000002d0  6c 65 63 74 69 6f 6e 09  09 09 57 69 6e 64 6f 77  |lection...Window|
000002e0  20 68 61 73 6e 27 74 20  67 6f 74 20 74 68 65 20  | hasn't got the |
000002f0  69 6e 70 75 74 2e 0a 0a  31 09 63 61 72 5f 63 75  |input...1.car_cu|
00000300  72 73 6f 72 20 26 20 63  61 72 5f 73 65 6c 65 63  |rsor & car_selec|
00000310  74 69 6f 6e 09 53 74 61  6e 64 61 72 64 20 65 64  |tion.Standard ed|
00000320  69 74 69 6e 67 0a 0a 32  09 63 61 72 5f 63 75 72  |iting..2.car_cur|
00000330  73 6f 72 09 09 09 53 70  6c 69 74 20 63 75 72 73  |sor...Split curs|
00000340  6f 72 20 63 6f 70 79 69  6e 67 0a 09 63 61 72 5f  |or copying..car_|
00000350  69 6e 70 75 74 09 09 09  63 61 72 5f 63 75 72 73  |input...car_curs|
00000360  6f 72 3d 6d 6f 76 69 6e  67 20 63 75 72 73 6f 72  |or=moving cursor|
00000370  0a 09 63 61 72 5f 73 65  6c 65 63 74 69 6f 6e 09  |..car_selection.|
00000380  09 09 63 61 72 5f 69 6e  70 75 74 3d 77 68 65 72  |..car_input=wher|
00000390  65 20 69 6e 70 75 74 20  67 6f 65 73 0a 0a 33 09  |e input goes..3.|
000003a0  63 61 72 5f 73 65 6c 65  63 74 69 6f 6e 09 09 09  |car_selection...|
000003b0  53 65 6c 65 63 74 20 61  72 65 61 20 76 69 61 20  |Select area via |
000003c0  6b 65 79 62 6f 61 72 64  0a 09 09 09 09 09 63 61  |keyboard......ca|
000003d0  72 5f 63 75 72 73 6f 72  3d 63 75 72 72 65 6e 74  |r_cursor=current|
000003e0  20 70 6f 73 6e 0a 09 09  09 09 09 0a 34 09 63 61  | posn.......4.ca|
000003f0  72 5f 73 65 6c 65 63 74  69 6f 6e 09 09 09 53 65  |r_selection...Se|
00000400  6c 65 63 74 20 61 72 65  61 20 76 69 61 20 6d 6f  |lect area via mo|
00000410  75 73 65 0a 09 09 09 09  09 63 61 72 5f 63 75 72  |use......car_cur|
00000420  73 6f 72 3d 63 75 72 72  65 6e 74 20 70 6f 73 6e  |sor=current posn|
00000430  0a 09 09 09 09 09 0a 35  09 63 61 72 5f 69 6e 70  |.......5.car_inp|
00000440  75 74 20 26 20 63 61 72  5f 73 65 6c 65 63 74 69  |ut & car_selecti|
00000450  6f 6e 09 53 65 6c 65 63  74 20 76 69 61 20 6d 6f  |on.Select via mo|
00000460  75 73 65 20 77 69 74 68  20 43 54 52 4c 20 68 65  |use with CTRL he|
00000470  6c 64 0a 09 09 09 09 09  63 61 72 5f 63 75 72 73  |ld......car_curs|
00000480  6f 72 3d 63 75 72 72 65  6e 74 20 70 6f 73 6e 0a  |or=current posn.|
00000490  09 09 09 09 09 63 61 72  5f 69 6e 70 75 74 3d 66  |.....car_input=f|
000004a0  69 78 65 64 20 63 75 72  73 6f 72 0a 0a 54 68 65  |ixed cursor..The|
000004b0  20 6f 66 66 73 65 74 73  20 6f 66 20 61 20 63 75  | offsets of a cu|
000004c0  72 73 6f 72 20 62 6c 6f  63 6b 20 68 61 76 65 20  |rsor block have |
000004d0  6e 61 6d 65 73 20 62 65  67 69 6e 6e 69 6e 67 20  |names beginning |
000004e0  27 63 5f 27 2e 20 41 73  20 75 73 75 61 6c 2c 20  |'c_'. As usual, |
000004f0  74 68 65 0a 45 2d 4c 69  62 72 61 72 79 20 66 69  |the.E-Library fi|
00000500  6c 65 20 64 65 66 69 6e  65 73 20 74 68 65 73 65  |le defines these|
00000510  20 6f 66 66 73 65 74 73  20 66 6f 72 20 79 6f 75  | offsets for you|
00000520  2e 20 54 68 65 79 20 61  72 65 20 64 65 73 63 72  |. They are descr|
00000530  69 62 65 64 20 62 65 6c  6f 77 2e 20 42 79 0a 63  |ibed below. By.c|
00000540  6f 6e 76 65 6e 74 69 6f  6e 2c 20 52 31 30 20 69  |onvention, R10 i|
00000550  73 20 75 73 65 64 20 74  6f 20 70 6f 69 6e 74 20  |s used to point |
00000560  74 6f 20 61 20 63 75 72  73 6f 72 20 62 6c 6f 63  |to a cursor bloc|
00000570  6b 2e 0a 0a 63 5f 77 69  6e 64 0a 57 69 6e 64 6f  |k...c_wind.Windo|
00000580  77 20 6f 66 66 73 65 74  20 6f 66 20 61 73 73 6f  |w offset of asso|
00000590  63 69 61 74 65 64 20 77  69 6e 64 6f 77 20 28 75  |ciated window (u|
000005a0  73 65 20 5a 61 70 5f 43  6f 6e 76 57 69 6e 64 4f  |se Zap_ConvWindO|
000005b0  66 66 29 2e 20 54 68 69  73 20 6f 66 66 73 65 74  |ff). This offset|
000005c0  20 69 73 20 2d 31 0a 69  66 20 74 68 65 20 63 75  | is -1.if the cu|
000005d0  72 73 6f 72 20 69 73 20  6e 6f 74 20 62 65 69 6e  |rsor is not bein|
000005e0  67 20 75 73 65 64 2e 0a  0a 63 5f 6c 69 6e 65 09  |g used...c_line.|
000005f0  09 43 75 72 72 65 6e 74  20 6c 69 6e 65 20 63 75  |.Current line cu|
00000600  72 73 6f 72 20 69 73 20  6f 6e 2e 0a 63 5f 63 6f  |rsor is on..c_co|
00000610  6c 09 09 43 75 72 72 65  6e 74 20 63 6f 6c 75 6d  |l..Current colum|
00000620  6e 20 63 75 72 73 6f 72  20 69 73 20 6f 6e 2e 0a  |n cursor is on..|
00000630  63 5f 6f 66 66 09 09 43  75 72 72 65 6e 74 20 66  |c_off..Current f|
00000640  69 6c 65 20 6f 66 66 73  65 74 20 6f 66 20 63 75  |ile offset of cu|
00000650  72 73 6f 72 2e 0a 63 5f  6c 6f 66 66 09 09 43 75  |rsor..c_loff..Cu|
00000660  72 72 65 6e 74 20 66 69  6c 65 20 6f 66 66 73 65  |rrent file offse|
00000670  74 20 6f 66 20 73 74 61  72 74 20 6f 66 20 70 68  |t of start of ph|
00000680  79 73 69 63 61 6c 20 6c  69 6e 65 20 6f 66 20 63  |ysical line of c|
00000690  75 72 73 6f 72 2e 0a 63  5f 77 69 64 74 68 09 09  |ursor..c_width..|
000006a0  57 69 64 74 68 20 6f 66  20 63 75 72 73 6f 72 20  |Width of cursor |
000006b0  69 6e 20 63 68 61 72 61  63 74 65 72 73 2e 0a 0a  |in characters...|
000006c0  63 5f 6f 77 69 6e 64 09  09 57 69 6e 64 6f 77 20  |c_owind..Window |
000006d0  6f 66 20 6f 6c 64 20 63  75 72 73 6f 72 20 70 6f  |of old cursor po|
000006e0  73 69 74 69 6f 6e 2e 0a  63 5f 6f 6c 69 6e 65 09  |sition..c_oline.|
000006f0  09 4c 69 6e 65 20 6f 66  20 6f 6c 64 20 63 75 72  |.Line of old cur|
00000700  73 6f 72 20 70 6f 73 69  74 69 6f 6e 2e 0a 63 5f  |sor position..c_|
00000710  6f 63 6f 6c 09 09 43 6f  6c 75 6d 6e 20 6f 66 20  |ocol..Column of |
00000720  6f 6c 64 20 63 75 72 73  6f 72 20 70 6f 73 69 74  |old cursor posit|
00000730  69 6f 6e 2e 0a 63 5f 6f  77 69 64 74 68 09 4f 6c  |ion..c_owidth.Ol|
00000740  64 20 63 75 72 73 6f 72  20 77 69 64 74 68 2e 0a  |d cursor width..|
00000750  0a 54 68 65 20 61 62 6f  76 65 20 6d 65 61 6e 69  |.The above meani|
00000760  6e 67 73 20 68 6f 6c 64  20 66 6f 72 20 63 61 72  |ngs hold for car|
00000770  5f 63 75 72 73 6f 72 20  61 6e 64 20 63 61 72 5f  |_cursor and car_|
00000780  69 6e 70 75 74 2e 20 46  6f 72 20 63 61 72 5f 73  |input. For car_s|
00000790  65 6c 65 63 74 69 6f 6e  20 74 68 65 0a 63 75 72  |election the.cur|
000007a0  72 65 6e 74 20 63 75 72  73 6f 72 20 70 6f 73 69  |rent cursor posi|
000007b0  74 69 6f 6e 20 69 73 20  74 68 65 20 73 74 61 72  |tion is the star|
000007c0  74 20 6f 66 20 74 68 65  20 73 65 6c 65 63 74 69  |t of the selecti|
000007d0  6f 6e 20 61 6e 64 20 74  68 65 20 6f 6c 64 20 63  |on and the old c|
000007e0  75 72 73 6f 72 0a 70 6f  73 69 74 69 6f 6e 20 67  |ursor.position g|
000007f0  69 76 65 73 20 74 68 65  20 65 6e 64 20 6f 66 20  |ives the end of |
00000800  74 68 65 20 73 65 6c 65  63 74 69 6f 6e 2e 20 41  |the selection. A|
00000810  6c 73 6f 20 63 5f 6f 77  69 64 74 68 20 67 69 76  |lso c_owidth giv|
00000820  65 73 20 74 68 65 20 65  6e 64 20 6f 66 66 73 65  |es the end offse|
00000830  74 0a 6f 66 20 74 68 65  20 73 65 6c 65 63 74 69  |t.of the selecti|
00000840  6f 6e 2e 20 63 5f 77 69  64 74 68 20 69 73 20 75  |on. c_width is u|
00000850  6e 75 73 65 64 2e 20 42  79 20 73 74 61 72 74 20  |nused. By start |
00000860  61 6e 64 20 65 6e 64 20  49 20 6d 65 61 6e 20 6c  |and end I mean l|
00000870  6f 67 69 63 61 6c 20 73  74 61 72 74 0a 61 6e 64  |ogical start.and|
00000880  20 65 6e 64 2e 20 54 68  75 73 2c 20 69 74 20 6d  | end. Thus, it m|
00000890  61 79 20 6e 6f 74 20 68  6f 6c 64 20 74 68 61 74  |ay not hold that|
000008a0  20 74 68 65 20 73 74 61  72 74 20 63 6f 6d 65 73  | the start comes|
000008b0  20 62 65 66 6f 72 65 20  74 68 65 20 65 6e 64 20  | before the end |
000008c0  69 6e 20 74 68 65 0a 66  69 6c 65 2e 0a 0a 54 6f  |in the.file...To|
000008d0  20 61 6c 74 65 72 20 61  20 63 75 72 73 6f 72 73  | alter a cursors|
000008e0  20 70 6f 73 69 74 69 6f  6e 20 79 6f 75 20 73 68  | position you sh|
000008f0  6f 75 6c 64 20 66 69 72  73 74 20 73 74 6f 72 65  |ould first store|
00000900  20 74 68 65 20 6e 65 77  20 70 6f 73 69 74 69 6f  | the new positio|
00000910  6e 20 69 6e 20 74 68 65  0a 63 75 72 72 65 6e 74  |n in the.current|
00000920  20 70 6f 73 69 74 69 6f  6e 20 76 61 72 69 61 62  | position variab|
00000930  6c 65 73 2e 20 54 68 65  20 65 61 73 69 65 73 74  |les. The easiest|
00000940  20 77 61 79 20 74 6f 20  64 6f 20 74 68 69 73 20  | way to do this |
00000950  69 73 20 74 6f 20 73 74  6f 72 65 20 74 68 65 20  |is to store the |
00000960  6e 65 77 0a 6f 66 66 73  65 74 20 69 6e 20 63 5f  |new.offset in c_|
00000970  6f 66 66 20 61 6e 64 20  74 68 65 6e 20 63 61 6c  |off and then cal|
00000980  6c 20 5a 61 70 5f 55 70  64 61 74 65 43 61 72 65  |l Zap_UpdateCare|
00000990  74 2e 20 59 6f 75 20 73  68 6f 75 6c 64 20 74 68  |t. You should th|
000009a0  65 6e 20 63 61 6c 6c 20  5a 61 70 5f 50 6c 6f 74  |en call Zap_Plot|
000009b0  0a 63 61 72 65 74 20 74  6f 20 6d 6f 76 65 20 74  |.caret to move t|
000009c0  68 65 20 63 61 72 65 74  20 6f 6e 20 73 63 72 65  |he caret on scre|
000009d0  65 6e 20 61 6e 64 20 75  70 64 61 74 65 20 74 68  |en and update th|
000009e0  65 20 6f 6c 64 20 6f 66  66 73 65 74 20 74 6f 20  |e old offset to |
000009f0  74 68 65 20 63 75 72 72  65 6e 74 0a 6f 66 66 73  |the current.offs|
00000a00  65 74 2e 20 5a 61 70 5f  52 65 66 6c 65 63 74 43  |et. Zap_ReflectC|
00000a10  61 72 65 74 20 63 6f 6d  62 69 6e 65 73 20 74 68  |aret combines th|
00000a20  65 73 65 2e 0a                                    |ese..|
00000a25