Home » Archimedes archive » Archimedes World » AW-1994-06-Disc2.adf » Disk2Jun94 » !AWJune94/Goodies/Zap/!Zap/Docs/E-Cursors

!AWJune94/Goodies/Zap/!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 » Archimedes World » AW-1994-06-Disc2.adf » Disk2Jun94
Filename: !AWJune94/Goodies/Zap/!Zap/Docs/E-Cursors
Read OK:
File size: 0B65 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			Zap hasn't got the input.
	square where input should be

1	car_cursor & car_selection	Standard editing
					cursor and input carets combined.

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

Internally, Zap also uses the modes:

-1	square where input should be	Caret 'temporarily' lost by Zap.
	car_selection			(Eg it is in a menu item)

-2	car_selection only		Used as a temporary value to scrub
					carets from the screen.

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 (including margin).
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 5a 61 70 20 68 61  |lection...Zap ha|
000002e0  73 6e 27 74 20 67 6f 74  20 74 68 65 20 69 6e 70  |sn't got the inp|
000002f0  75 74 2e 0a 09 73 71 75  61 72 65 20 77 68 65 72  |ut...square wher|
00000300  65 20 69 6e 70 75 74 20  73 68 6f 75 6c 64 20 62  |e input should b|
00000310  65 0a 0a 31 09 63 61 72  5f 63 75 72 73 6f 72 20  |e..1.car_cursor |
00000320  26 20 63 61 72 5f 73 65  6c 65 63 74 69 6f 6e 09  |& car_selection.|
00000330  53 74 61 6e 64 61 72 64  20 65 64 69 74 69 6e 67  |Standard editing|
00000340  0a 09 09 09 09 09 63 75  72 73 6f 72 20 61 6e 64  |......cursor and|
00000350  20 69 6e 70 75 74 20 63  61 72 65 74 73 20 63 6f  | input carets co|
00000360  6d 62 69 6e 65 64 2e 0a  0a 32 09 63 61 72 5f 63  |mbined...2.car_c|
00000370  75 72 73 6f 72 09 09 09  53 70 6c 69 74 20 63 75  |ursor...Split cu|
00000380  72 73 6f 72 20 63 6f 70  79 69 6e 67 0a 09 63 61  |rsor copying..ca|
00000390  72 5f 69 6e 70 75 74 09  09 09 63 61 72 5f 63 75  |r_input...car_cu|
000003a0  72 73 6f 72 3d 6d 6f 76  69 6e 67 20 63 75 72 73  |rsor=moving curs|
000003b0  6f 72 0a 09 63 61 72 5f  73 65 6c 65 63 74 69 6f  |or..car_selectio|
000003c0  6e 09 09 09 63 61 72 5f  69 6e 70 75 74 3d 77 68  |n...car_input=wh|
000003d0  65 72 65 20 69 6e 70 75  74 20 67 6f 65 73 0a 0a  |ere input goes..|
000003e0  33 09 63 61 72 5f 73 65  6c 65 63 74 69 6f 6e 09  |3.car_selection.|
000003f0  09 09 53 65 6c 65 63 74  20 61 72 65 61 20 76 69  |..Select area vi|
00000400  61 20 6b 65 79 62 6f 61  72 64 0a 09 09 09 09 09  |a keyboard......|
00000410  63 61 72 5f 63 75 72 73  6f 72 3d 63 75 72 72 65  |car_cursor=curre|
00000420  6e 74 20 70 6f 73 6e 0a  09 09 09 09 09 0a 34 09  |nt posn.......4.|
00000430  63 61 72 5f 73 65 6c 65  63 74 69 6f 6e 09 09 09  |car_selection...|
00000440  53 65 6c 65 63 74 20 61  72 65 61 20 76 69 61 20  |Select area via |
00000450  6d 6f 75 73 65 0a 09 09  09 09 09 63 61 72 5f 63  |mouse......car_c|
00000460  75 72 73 6f 72 3d 63 75  72 72 65 6e 74 20 70 6f  |ursor=current po|
00000470  73 6e 0a 09 09 09 09 09  0a 35 09 63 61 72 5f 69  |sn.......5.car_i|
00000480  6e 70 75 74 20 26 20 63  61 72 5f 73 65 6c 65 63  |nput & car_selec|
00000490  74 69 6f 6e 09 53 65 6c  65 63 74 20 76 69 61 20  |tion.Select via |
000004a0  6d 6f 75 73 65 20 77 69  74 68 20 43 54 52 4c 20  |mouse with CTRL |
000004b0  68 65 6c 64 0a 09 09 09  09 09 63 61 72 5f 63 75  |held......car_cu|
000004c0  72 73 6f 72 3d 63 75 72  72 65 6e 74 20 70 6f 73  |rsor=current pos|
000004d0  6e 0a 09 09 09 09 09 63  61 72 5f 69 6e 70 75 74  |n......car_input|
000004e0  3d 66 69 78 65 64 20 63  75 72 73 6f 72 0a 0a 49  |=fixed cursor..I|
000004f0  6e 74 65 72 6e 61 6c 6c  79 2c 20 5a 61 70 20 61  |nternally, Zap a|
00000500  6c 73 6f 20 75 73 65 73  20 74 68 65 20 6d 6f 64  |lso uses the mod|
00000510  65 73 3a 0a 0a 2d 31 09  73 71 75 61 72 65 20 77  |es:..-1.square w|
00000520  68 65 72 65 20 69 6e 70  75 74 20 73 68 6f 75 6c  |here input shoul|
00000530  64 20 62 65 09 43 61 72  65 74 20 27 74 65 6d 70  |d be.Caret 'temp|
00000540  6f 72 61 72 69 6c 79 27  20 6c 6f 73 74 20 62 79  |orarily' lost by|
00000550  20 5a 61 70 2e 0a 09 63  61 72 5f 73 65 6c 65 63  | Zap...car_selec|
00000560  74 69 6f 6e 09 09 09 28  45 67 20 69 74 20 69 73  |tion...(Eg it is|
00000570  20 69 6e 20 61 20 6d 65  6e 75 20 69 74 65 6d 29  | in a menu item)|
00000580  0a 0a 2d 32 09 63 61 72  5f 73 65 6c 65 63 74 69  |..-2.car_selecti|
00000590  6f 6e 20 6f 6e 6c 79 09  09 55 73 65 64 20 61 73  |on only..Used as|
000005a0  20 61 20 74 65 6d 70 6f  72 61 72 79 20 76 61 6c  | a temporary val|
000005b0  75 65 20 74 6f 20 73 63  72 75 62 0a 09 09 09 09  |ue to scrub.....|
000005c0  09 63 61 72 65 74 73 20  66 72 6f 6d 20 74 68 65  |.carets from the|
000005d0  20 73 63 72 65 65 6e 2e  0a 0a 54 68 65 20 6f 66  | screen...The of|
000005e0  66 73 65 74 73 20 6f 66  20 61 20 63 75 72 73 6f  |fsets of a curso|
000005f0  72 20 62 6c 6f 63 6b 20  68 61 76 65 20 6e 61 6d  |r block have nam|
00000600  65 73 20 62 65 67 69 6e  6e 69 6e 67 20 27 63 5f  |es beginning 'c_|
00000610  27 2e 20 41 73 20 75 73  75 61 6c 2c 20 74 68 65  |'. As usual, the|
00000620  0a 45 2d 4c 69 62 72 61  72 79 20 66 69 6c 65 20  |.E-Library file |
00000630  64 65 66 69 6e 65 73 20  74 68 65 73 65 20 6f 66  |defines these of|
00000640  66 73 65 74 73 20 66 6f  72 20 79 6f 75 2e 20 54  |fsets for you. T|
00000650  68 65 79 20 61 72 65 20  64 65 73 63 72 69 62 65  |hey are describe|
00000660  64 20 62 65 6c 6f 77 2e  20 42 79 0a 63 6f 6e 76  |d below. By.conv|
00000670  65 6e 74 69 6f 6e 2c 20  52 31 30 20 69 73 20 75  |ention, R10 is u|
00000680  73 65 64 20 74 6f 20 70  6f 69 6e 74 20 74 6f 20  |sed to point to |
00000690  61 20 63 75 72 73 6f 72  20 62 6c 6f 63 6b 2e 0a  |a cursor block..|
000006a0  0a 63 5f 77 69 6e 64 0a  57 69 6e 64 6f 77 20 6f  |.c_wind.Window o|
000006b0  66 66 73 65 74 20 6f 66  20 61 73 73 6f 63 69 61  |ffset of associa|
000006c0  74 65 64 20 77 69 6e 64  6f 77 20 28 75 73 65 20  |ted window (use |
000006d0  5a 61 70 5f 43 6f 6e 76  57 69 6e 64 4f 66 66 29  |Zap_ConvWindOff)|
000006e0  2e 20 54 68 69 73 20 6f  66 66 73 65 74 20 69 73  |. This offset is|
000006f0  20 2d 31 0a 69 66 20 74  68 65 20 63 75 72 73 6f  | -1.if the curso|
00000700  72 20 69 73 20 6e 6f 74  20 62 65 69 6e 67 20 75  |r is not being u|
00000710  73 65 64 2e 0a 0a 63 5f  6c 69 6e 65 09 09 43 75  |sed...c_line..Cu|
00000720  72 72 65 6e 74 20 6c 69  6e 65 20 63 75 72 73 6f  |rrent line curso|
00000730  72 20 69 73 20 6f 6e 2e  0a 63 5f 63 6f 6c 09 09  |r is on..c_col..|
00000740  43 75 72 72 65 6e 74 20  63 6f 6c 75 6d 6e 20 63  |Current column c|
00000750  75 72 73 6f 72 20 69 73  20 6f 6e 20 28 69 6e 63  |ursor is on (inc|
00000760  6c 75 64 69 6e 67 20 6d  61 72 67 69 6e 29 2e 0a  |luding margin)..|
00000770  63 5f 6f 66 66 09 09 43  75 72 72 65 6e 74 20 66  |c_off..Current f|
00000780  69 6c 65 20 6f 66 66 73  65 74 20 6f 66 20 63 75  |ile offset of cu|
00000790  72 73 6f 72 2e 0a 63 5f  6c 6f 66 66 09 09 43 75  |rsor..c_loff..Cu|
000007a0  72 72 65 6e 74 20 66 69  6c 65 20 6f 66 66 73 65  |rrent file offse|
000007b0  74 20 6f 66 20 73 74 61  72 74 20 6f 66 20 70 68  |t of start of ph|
000007c0  79 73 69 63 61 6c 20 6c  69 6e 65 20 6f 66 20 63  |ysical line of c|
000007d0  75 72 73 6f 72 2e 0a 63  5f 77 69 64 74 68 09 09  |ursor..c_width..|
000007e0  57 69 64 74 68 20 6f 66  20 63 75 72 73 6f 72 20  |Width of cursor |
000007f0  69 6e 20 63 68 61 72 61  63 74 65 72 73 2e 0a 0a  |in characters...|
00000800  63 5f 6f 77 69 6e 64 09  09 57 69 6e 64 6f 77 20  |c_owind..Window |
00000810  6f 66 20 6f 6c 64 20 63  75 72 73 6f 72 20 70 6f  |of old cursor po|
00000820  73 69 74 69 6f 6e 2e 0a  63 5f 6f 6c 69 6e 65 09  |sition..c_oline.|
00000830  09 4c 69 6e 65 20 6f 66  20 6f 6c 64 20 63 75 72  |.Line of old cur|
00000840  73 6f 72 20 70 6f 73 69  74 69 6f 6e 2e 0a 63 5f  |sor position..c_|
00000850  6f 63 6f 6c 09 09 43 6f  6c 75 6d 6e 20 6f 66 20  |ocol..Column of |
00000860  6f 6c 64 20 63 75 72 73  6f 72 20 70 6f 73 69 74  |old cursor posit|
00000870  69 6f 6e 2e 0a 63 5f 6f  77 69 64 74 68 09 4f 6c  |ion..c_owidth.Ol|
00000880  64 20 63 75 72 73 6f 72  20 77 69 64 74 68 2e 0a  |d cursor width..|
00000890  0a 54 68 65 20 61 62 6f  76 65 20 6d 65 61 6e 69  |.The above meani|
000008a0  6e 67 73 20 68 6f 6c 64  20 66 6f 72 20 63 61 72  |ngs hold for car|
000008b0  5f 63 75 72 73 6f 72 20  61 6e 64 20 63 61 72 5f  |_cursor and car_|
000008c0  69 6e 70 75 74 2e 20 46  6f 72 20 63 61 72 5f 73  |input. For car_s|
000008d0  65 6c 65 63 74 69 6f 6e  20 74 68 65 0a 63 75 72  |election the.cur|
000008e0  72 65 6e 74 20 63 75 72  73 6f 72 20 70 6f 73 69  |rent cursor posi|
000008f0  74 69 6f 6e 20 69 73 20  74 68 65 20 73 74 61 72  |tion is the star|
00000900  74 20 6f 66 20 74 68 65  20 73 65 6c 65 63 74 69  |t of the selecti|
00000910  6f 6e 20 61 6e 64 20 74  68 65 20 6f 6c 64 20 63  |on and the old c|
00000920  75 72 73 6f 72 0a 70 6f  73 69 74 69 6f 6e 20 67  |ursor.position g|
00000930  69 76 65 73 20 74 68 65  20 65 6e 64 20 6f 66 20  |ives the end of |
00000940  74 68 65 20 73 65 6c 65  63 74 69 6f 6e 2e 20 41  |the selection. A|
00000950  6c 73 6f 20 63 5f 6f 77  69 64 74 68 20 67 69 76  |lso c_owidth giv|
00000960  65 73 20 74 68 65 20 65  6e 64 20 6f 66 66 73 65  |es the end offse|
00000970  74 0a 6f 66 20 74 68 65  20 73 65 6c 65 63 74 69  |t.of the selecti|
00000980  6f 6e 2e 20 63 5f 77 69  64 74 68 20 69 73 20 75  |on. c_width is u|
00000990  6e 75 73 65 64 2e 20 42  79 20 73 74 61 72 74 20  |nused. By start |
000009a0  61 6e 64 20 65 6e 64 20  49 20 6d 65 61 6e 20 6c  |and end I mean l|
000009b0  6f 67 69 63 61 6c 20 73  74 61 72 74 0a 61 6e 64  |ogical start.and|
000009c0  20 65 6e 64 2e 20 54 68  75 73 2c 20 69 74 20 6d  | end. Thus, it m|
000009d0  61 79 20 6e 6f 74 20 68  6f 6c 64 20 74 68 61 74  |ay not hold that|
000009e0  20 74 68 65 20 73 74 61  72 74 20 63 6f 6d 65 73  | the start comes|
000009f0  20 62 65 66 6f 72 65 20  74 68 65 20 65 6e 64 20  | before the end |
00000a00  69 6e 20 74 68 65 0a 66  69 6c 65 2e 0a 0a 54 6f  |in the.file...To|
00000a10  20 61 6c 74 65 72 20 61  20 63 75 72 73 6f 72 73  | alter a cursors|
00000a20  20 70 6f 73 69 74 69 6f  6e 20 79 6f 75 20 73 68  | position you sh|
00000a30  6f 75 6c 64 20 66 69 72  73 74 20 73 74 6f 72 65  |ould first store|
00000a40  20 74 68 65 20 6e 65 77  20 70 6f 73 69 74 69 6f  | the new positio|
00000a50  6e 20 69 6e 20 74 68 65  0a 63 75 72 72 65 6e 74  |n in the.current|
00000a60  20 70 6f 73 69 74 69 6f  6e 20 76 61 72 69 61 62  | position variab|
00000a70  6c 65 73 2e 20 54 68 65  20 65 61 73 69 65 73 74  |les. The easiest|
00000a80  20 77 61 79 20 74 6f 20  64 6f 20 74 68 69 73 20  | way to do this |
00000a90  69 73 20 74 6f 20 73 74  6f 72 65 20 74 68 65 20  |is to store the |
00000aa0  6e 65 77 0a 6f 66 66 73  65 74 20 69 6e 20 63 5f  |new.offset in c_|
00000ab0  6f 66 66 20 61 6e 64 20  74 68 65 6e 20 63 61 6c  |off and then cal|
00000ac0  6c 20 5a 61 70 5f 55 70  64 61 74 65 43 61 72 65  |l Zap_UpdateCare|
00000ad0  74 2e 20 59 6f 75 20 73  68 6f 75 6c 64 20 74 68  |t. You should th|
00000ae0  65 6e 20 63 61 6c 6c 20  5a 61 70 5f 50 6c 6f 74  |en call Zap_Plot|
00000af0  0a 63 61 72 65 74 20 74  6f 20 6d 6f 76 65 20 74  |.caret to move t|
00000b00  68 65 20 63 61 72 65 74  20 6f 6e 20 73 63 72 65  |he caret on scre|
00000b10  65 6e 20 61 6e 64 20 75  70 64 61 74 65 20 74 68  |en and update th|
00000b20  65 20 6f 6c 64 20 6f 66  66 73 65 74 20 74 6f 20  |e old offset to |
00000b30  74 68 65 20 63 75 72 72  65 6e 74 0a 6f 66 66 73  |the current.offs|
00000b40  65 74 2e 20 5a 61 70 5f  52 65 66 6c 65 63 74 43  |et. Zap_ReflectC|
00000b50  61 72 65 74 20 63 6f 6d  62 69 6e 65 73 20 74 68  |aret combines th|
00000b60  65 73 65 2e 0a                                    |ese..|
00000b65