Home » Archimedes archive » Archimedes World » AW-1992-09.adf » AWSept92 » !AWSept92/Goodies/Work/c/iconbar
!AWSept92/Goodies/Work/c/iconbar
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-1992-09.adf » AWSept92 |
Filename: | !AWSept92/Goodies/Work/c/iconbar |
Read OK: | ✔ |
File size: | 065E bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
/*********************************************************************/ /* */ /* Wimp Routine Library. Icon Bar Routines. */ /* */ /* (c) John Skingley 1992 */ /* */ /* Archimedes World 'All at C' series. */ /* */ /*********************************************************************/ #include <string.h> #include "h.system" #include "h.iconbar" #include "h.wimpstr" #include "h.swi" #include "h.swiwimp" int DisplayBarIcon( char *name ) { /* Create icon and place on right of icon bar. Return handle. */ int regs[10], width, height, mode; struct { int wind; iconstr icon; } block; regs[0] = 40; /* Read sprite info */ regs[2] = (int) name; Swi( Wimp_SpriteOp, regs ); width = regs[3]; height = regs[4]; mode = regs[6]; PixelsToScreenX( &width, mode ); PixelsToScreenY( &height, mode ); block.wind = -1; /* Right of icon bar. */ block.icon.box.x0 = 0; block.icon.box.y0 = 0; block.icon.box.x1 = width; block.icon.box.y1 = height; block.icon.flags = 0x0000301A; strncpy( block.icon.data.sprite, name, 12 ); regs[1] = (int) █ Swi( Wimp_CreateIcon, regs ); return regs[0]; }
00000000 2f 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a |/***************| 00000010 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a |****************| * 00000040 2a 2a 2a 2a 2a 2a 2f 0a 2f 2a 20 20 20 20 20 20 |******/./* | 00000050 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | * 00000080 20 20 20 20 20 20 20 20 20 20 20 20 20 2a 2f 0a | */.| 00000090 2f 2a 20 20 20 57 69 6d 70 20 52 6f 75 74 69 6e |/* Wimp Routin| 000000a0 65 20 4c 69 62 72 61 72 79 2e 20 20 20 20 20 20 |e Library. | 000000b0 20 20 20 49 63 6f 6e 20 42 61 72 20 52 6f 75 74 | Icon Bar Rout| 000000c0 69 6e 65 73 2e 20 20 20 20 20 20 20 20 20 20 20 |ines. | 000000d0 20 20 20 20 20 2a 2f 0a 2f 2a 20 20 20 20 20 20 | */./* | 000000e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | * 00000110 20 20 20 20 20 20 20 20 20 20 20 20 20 2a 2f 0a | */.| 00000120 2f 2a 20 20 20 28 63 29 20 4a 6f 68 6e 20 53 6b |/* (c) John Sk| 00000130 69 6e 67 6c 65 79 20 31 39 39 32 20 20 20 20 20 |ingley 1992 | 00000140 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | * 00000160 20 20 20 20 20 2a 2f 0a 2f 2a 20 20 20 20 20 20 | */./* | 00000170 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | * 000001a0 20 20 20 20 20 20 20 20 20 20 20 20 20 2a 2f 0a | */.| 000001b0 2f 2a 20 20 20 41 72 63 68 69 6d 65 64 65 73 20 |/* Archimedes | 000001c0 57 6f 72 6c 64 20 20 27 41 6c 6c 20 61 74 20 43 |World 'All at C| 000001d0 27 20 73 65 72 69 65 73 2e 20 20 20 20 20 20 20 |' series. | 000001e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000001f0 20 20 20 20 20 2a 2f 0a 2f 2a 20 20 20 20 20 20 | */./* | 00000200 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | * 00000230 20 20 20 20 20 20 20 20 20 20 20 20 20 2a 2f 0a | */.| 00000240 2f 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a |/***************| 00000250 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a |****************| * 00000280 2a 2a 2a 2a 2a 2a 2f 0a 0a 23 69 6e 63 6c 75 64 |******/..#includ| 00000290 65 20 3c 73 74 72 69 6e 67 2e 68 3e 0a 0a 23 69 |e <string.h>..#i| 000002a0 6e 63 6c 75 64 65 20 22 68 2e 73 79 73 74 65 6d |nclude "h.system| 000002b0 22 0a 23 69 6e 63 6c 75 64 65 20 22 68 2e 69 63 |".#include "h.ic| 000002c0 6f 6e 62 61 72 22 0a 23 69 6e 63 6c 75 64 65 20 |onbar".#include | 000002d0 22 68 2e 77 69 6d 70 73 74 72 22 0a 23 69 6e 63 |"h.wimpstr".#inc| 000002e0 6c 75 64 65 20 22 68 2e 73 77 69 22 0a 23 69 6e |lude "h.swi".#in| 000002f0 63 6c 75 64 65 20 22 68 2e 73 77 69 77 69 6d 70 |clude "h.swiwimp| 00000300 22 0a 0a 0a 69 6e 74 20 44 69 73 70 6c 61 79 42 |"...int DisplayB| 00000310 61 72 49 63 6f 6e 28 20 63 68 61 72 20 2a 6e 61 |arIcon( char *na| 00000320 6d 65 20 29 0a 7b 0a 2f 2a 20 20 43 72 65 61 74 |me ).{./* Creat| 00000330 65 20 69 63 6f 6e 20 61 6e 64 20 70 6c 61 63 65 |e icon and place| 00000340 20 6f 6e 20 72 69 67 68 74 20 6f 66 20 69 63 6f | on right of ico| 00000350 6e 20 62 61 72 2e 20 52 65 74 75 72 6e 20 68 61 |n bar. Return ha| 00000360 6e 64 6c 65 2e 20 2a 2f 0a 0a 20 20 20 20 69 6e |ndle. */.. in| 00000370 74 20 20 72 65 67 73 5b 31 30 5d 2c 20 77 69 64 |t regs[10], wid| 00000380 74 68 2c 20 68 65 69 67 68 74 2c 20 6d 6f 64 65 |th, height, mode| 00000390 3b 0a 0a 20 20 20 20 73 74 72 75 63 74 0a 20 20 |;.. struct. | 000003a0 20 20 7b 0a 20 20 20 20 20 20 20 20 69 6e 74 20 | {. int | 000003b0 20 20 20 20 77 69 6e 64 3b 0a 20 20 20 20 20 20 | wind;. | 000003c0 20 20 69 63 6f 6e 73 74 72 20 69 63 6f 6e 3b 0a | iconstr icon;.| 000003d0 20 20 20 20 7d 20 62 6c 6f 63 6b 3b 0a 0a 20 20 | } block;.. | 000003e0 20 20 72 65 67 73 5b 30 5d 20 3d 20 34 30 3b 20 | regs[0] = 40; | 000003f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000400 20 20 20 20 20 20 20 20 20 20 20 2f 2a 20 52 65 | /* Re| 00000410 61 64 20 73 70 72 69 74 65 20 69 6e 66 6f 20 2a |ad sprite info *| 00000420 2f 0a 20 20 20 20 72 65 67 73 5b 32 5d 20 3d 20 |/. regs[2] = | 00000430 28 69 6e 74 29 20 6e 61 6d 65 3b 0a 20 0a 20 20 |(int) name;. . | 00000440 20 20 53 77 69 28 20 57 69 6d 70 5f 53 70 72 69 | Swi( Wimp_Spri| 00000450 74 65 4f 70 2c 20 72 65 67 73 20 29 3b 0a 0a 20 |teOp, regs );.. | 00000460 20 20 20 77 69 64 74 68 20 20 3d 20 72 65 67 73 | width = regs| 00000470 5b 33 5d 3b 0a 20 20 20 20 68 65 69 67 68 74 20 |[3];. height | 00000480 3d 20 72 65 67 73 5b 34 5d 3b 0a 20 20 20 20 6d |= regs[4];. m| 00000490 6f 64 65 20 20 20 3d 20 72 65 67 73 5b 36 5d 3b |ode = regs[6];| 000004a0 0a 0a 20 20 20 20 50 69 78 65 6c 73 54 6f 53 63 |.. PixelsToSc| 000004b0 72 65 65 6e 58 28 20 26 77 69 64 74 68 2c 20 6d |reenX( &width, m| 000004c0 6f 64 65 20 29 3b 0a 20 20 20 20 50 69 78 65 6c |ode );. Pixel| 000004d0 73 54 6f 53 63 72 65 65 6e 59 28 20 26 68 65 69 |sToScreenY( &hei| 000004e0 67 68 74 2c 20 6d 6f 64 65 20 29 3b 0a 0a 20 20 |ght, mode );.. | 000004f0 20 20 62 6c 6f 63 6b 2e 77 69 6e 64 20 20 20 20 | block.wind | 00000500 20 20 20 20 3d 20 2d 31 3b 20 20 20 20 20 20 20 | = -1; | 00000510 20 20 20 20 20 20 20 20 20 20 20 2f 2a 20 52 69 | /* Ri| 00000520 67 68 74 20 6f 66 20 69 63 6f 6e 20 62 61 72 2e |ght of icon bar.| 00000530 20 2a 2f 0a 20 20 20 20 62 6c 6f 63 6b 2e 69 63 | */. block.ic| 00000540 6f 6e 2e 62 6f 78 2e 78 30 20 3d 20 20 30 3b 0a |on.box.x0 = 0;.| 00000550 20 20 20 20 62 6c 6f 63 6b 2e 69 63 6f 6e 2e 62 | block.icon.b| 00000560 6f 78 2e 79 30 20 3d 20 20 30 3b 0a 20 20 20 20 |ox.y0 = 0;. | 00000570 62 6c 6f 63 6b 2e 69 63 6f 6e 2e 62 6f 78 2e 78 |block.icon.box.x| 00000580 31 20 3d 20 20 77 69 64 74 68 3b 0a 20 20 20 20 |1 = width;. | 00000590 62 6c 6f 63 6b 2e 69 63 6f 6e 2e 62 6f 78 2e 79 |block.icon.box.y| 000005a0 31 20 3d 20 20 68 65 69 67 68 74 3b 0a 20 20 20 |1 = height;. | 000005b0 20 62 6c 6f 63 6b 2e 69 63 6f 6e 2e 66 6c 61 67 | block.icon.flag| 000005c0 73 20 20 3d 20 20 30 78 30 30 30 30 33 30 31 41 |s = 0x0000301A| 000005d0 3b 0a 0a 20 20 20 20 73 74 72 6e 63 70 79 28 20 |;.. strncpy( | 000005e0 62 6c 6f 63 6b 2e 69 63 6f 6e 2e 64 61 74 61 2e |block.icon.data.| 000005f0 73 70 72 69 74 65 2c 20 20 6e 61 6d 65 2c 20 31 |sprite, name, 1| 00000600 32 20 29 3b 0a 0a 20 20 20 20 72 65 67 73 5b 31 |2 );.. regs[1| 00000610 5d 20 3d 20 28 69 6e 74 29 20 26 62 6c 6f 63 6b |] = (int) &block| 00000620 3b 0a 0a 20 20 20 20 53 77 69 28 20 57 69 6d 70 |;.. Swi( Wimp| 00000630 5f 43 72 65 61 74 65 49 63 6f 6e 2c 20 72 65 67 |_CreateIcon, reg| 00000640 73 20 29 3b 0a 0a 20 20 20 20 72 65 74 75 72 6e |s );.. return| 00000650 20 72 65 67 73 5b 30 5d 3b 0a 7d 0a 0a 0a | regs[0];.}...| 0000065e