home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 44
/
Amiga_Dream_44.iso
/
RiscPc
/
Utils
/
AcornMenu.arc
/
!AcornMenu
/
!RunImage
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1996-07-01
|
7KB
|
300 lines
>!RunImage
AcornMenu v0.01
Alan Trewartha 1996
"<AcornMenu$Dir>.User"
Adisplay$="" :
holds the text shown in the title bar
0quit%=
:
set to true on quitting!
b% 900 :
the WIMP block
ws% 200 :
the WIMP workspace (I think it's empty!)
main% 6000 :
where the menus are held
m$(40) :
the main menu entries
mlimit%=40
mainsize%=6000
wsend%=ws%+200
b%!0=0
"Wimp_Initialise",310,&4B534154,"Acorn Menu",b%
,task%
&file%=
"<AcornMenu$Dir>.Sprites24"
size%=
#file%+4 :
#file%
usespr% size% : !usespr%=size%: usespr%!8=16
"OS_SpriteOp",256+9,usespr%
"OS_SpriteOp",256+10,usespr%,"<AcornMenu$Dir>.Sprites24"
"Wimp_OpenTemplate",,"<AcornMenu$Dir>.Templates"
"Wimp_LoadTemplate",,b%,ws%,wsend%,-1,"display",0
,,ws%
display%=b%!72
b%!64=usespr%
"Wimp_CreateWindow",,b%
displaywh%
"Wimp_LoadTemplate",,b%,ws%,wsend%,-1,"Info",0
,,ws%
"Wimp_CreateWindow",,b%
infowh%
"Wimp_CloseTemplate"
$2b%!0=displaywh% :
"Wimp_GetWindowState",,b%
%)file% =
("<AcornMenu$Dir>.MenuData")
#file% : b%!4=
#file% : b%!16=
maintop%=0
#file%=0
m$(maintop%)=
#file%
m$(maintop%)<>""
maintop%+=1
#file%
"Wimp_OpenWindow",,b%
makemainmenu
error=1
close:
"OS_ReadMonotonicTime"
otime%
"OS_ReadMonotonicTime"
ntime%
(ntime% - otime%) > 0:otime%+=50:
"Wimp_PollIdle",&1932,b%,otime%
display
:$
"Wimp_OpenWindow",,b%
;%
"Wimp_CloseWindow",,b%
b%!12
displaywh%:
b%!8
@/
floatwindow:
showmainmenu
b%!16
action
menuclick
17,18:
message
well what?
floatkeys
floatwindow
quit%
close
close
T2b%!0=displaywh% :
"Wimp_GetWindowState",,b%
U(file%=
("<AcornMenu$Dir>.MenuData")
(b%!4) :
#file%, a$
(b%!16):
#file%, a$
a%=0
maintop%-1 :
#file%, m$(a%) :
#file%
"Wimp_CloseDown",task%,&4B534154
error
_ !b%=
!b%
1<<30:err_str$="":box%=7
1<<30+1:err_str$="":box%=6
:err_str$=" at line "+
:box%=1
$(b%+4)=
$+err_str$+
"Wimp_ReportError",b%,box%,"Acorn Menu"
,response%
=response%
message
b%!16
0: quit%=
3:
additem
&400c0:
submenus
floatwindow
t2b%!0=displaywh% :
"Wimp_GetWindowState",,b%
u'b%!28=-1 :
"Wimp_OpenWindow",,b%
display
"Wimp_WhichIcon",displaywh%,b%,1<<21,1<<21
!b%
0: display$=
ButtonOne
1: display$=
ButtonTwo
2: display$=
ButtonThree
$display%<>display$
$display%=display$
b%!0=displaywh%
"Wimp_RedrawWindow",,b%
more%
more%
*
"Wimp_GetRectangle",,b%
more%
showmainmenu
b%!0=displaywh%
"Wimp_GetWindowOutline",,b%
mainx%=b%!4+2:mainy%=b%!8
"Wimp_CreateMenu",,main%+4,mainx%,mainy%
makemainmenu
start%=main%
main%+=4
$(main%)=""
Dmain%!12=&00070207:main%!16=176:main%!20=44:main%!24=0:main%+=28
a%=0
maintop%-1
a$=m$(a%)
!main%=0
main%!4=-1
a$,1)="."
!main%=8:main%!4=1
a$=
(a$)-1)
main%!8=&07000001
a$,".")<>0:a$=
a$,".")+1):
$(main%+12)=a$
main%+=24
maintop%=0
main%-=24
!(main%-24)=!(main%-24)
G!main%=0 : main%!4=infowh% : main%!8=&07000001 : $(main%+12)="Info"
Hmain%!24=&80 : main%!28=-1 : main%!32=&07000001 : $(main%+36)="Quit"
!start%=main%+48
main%=start%
menuclick
"Wimp_GetPointerInfo",,b%+80
"OS_Byte",121,0
adj%=(b%!88
b%!0=maintop%+1
1<<30,"Are you sure you want to quit Acorn
Menu?"
b%!0<maintop%
a%=2
(b%!4=-1)
maintop%-=1
2
f%=!b%
maintop%-1:m$(f%)=m$(f%+1):
makemainmenu
a$=m$(b%!0)
$
b%!4<>-1
(a$)-1)
c%=b%+4:f%=main%
!c%<>-1
f%=!f%
# a$=a$+"."+$(f%+44+24*!c%)
c%+=4
$
a$,1)="."
a$-1)
"OS_File",13,a$
a%=0
cleanmainmenu
"Filer_Run "+a$
adj%
a%=0:f%=main%
!(b%+a%+4) <>-1
5 !(f%+32+24*!(b%+a%))=!(f%+32+24*!(b%+a%))
" !(f%+36+24*!(b%+a%))=4+!f%
f%=!f%
a%+=4
"Wimp_CreateMenu",,main%+4,mainx%,mainy%
a%=0:f%=main%
!(b%+a%+4) <>-1
5 !(f%+32+24*!(b%+a%))=!(f%+32+24*!(b%+a%))
f%=!f%
a%+=4
submenus
a$=m$(b%!32)
(a$)-1):
Get main menu path thing
c%=b%+36:f%=main%
!c%<>-1
f%=!f%
a$=a$+"."+$(f%+44+24*!c%)
c%+=4
subx%=b%!24:suby%=b%!28
start%=!f%:sub%=start%+4
$(sub%)=$(f%+44+24*!(c%-4))
offset%=0
?sub%!12=&00070207:sub%!16=176:sub%!20=44:sub%!24=0:sub%+=28
"XOS_GBPB",10,a$,sub%+40,40,offset%,mainsize%-(sub%+40-main%),"*"
,,,a%,offset%;flag%
(flag%
cleanmainmenu
g%=sub%+40
a%>0
!sub%=0
sub%!4=-1
'
!(g%+16)=2
!sub%=8:sub%!4=1
sub%!8=&07000021
terminate(g%+20)
$(sub%+12)=$(g%+20)
# g%+=24+4*
($(sub%+12))/4)
sub%+=24
a%-=1
offset%=-1
sub%=start%+32
H !sub%=&80:sub%!4=-1:sub%!8=&07400021:$(sub%+12)="Nothing":sub%+=24
! !(sub%-24)=&80
!(sub%-24)
!start%=sub%
sub%=start%
"XWimp_CreateSubMenu",,sub%+4,subx%,suby%
additem
terminate(b%+44)
a$=$(b%+44)
b%!40>&FFF
a$=a$+"."
maintop%<=mlimit%
m$(maintop%)=a$ : maintop%+=1
b%!12=b%!8 : b%!16=4
"Wimp_SendMessage",17,b%,b%!4
makemainmenu
terminate(a%)
a%?n%>31:n%+=1:
a%?n%=13
cleanmainmenu
f%<maintop%
a$=m$(f%)
a$,1)="."
(a$)-1)
"OS_File",13,a$
0: maintop%-=1:
g%=f%
maintop%-1:m$(g%)=m$(g%+1):
1: f%+=1:
m$(f%-1)<>a$
m$(f%-1)=a$
2: f%+=1
makemainmenu
showmainmenu
1<<30+1,"The main menu is invalid. Attempting to fix..."