home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ARM Club 3
/
TheARMClub_PDCD3.iso
/
hensa
/
filemanager
/
director_1
/
!Director
/
Utils
/
ExpandMenu
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1994-09-06
|
6KB
|
278 lines
>ExpandMenu
taskwindow
"Expand BackMenu file"'
"Shift-Drag files to input their paths if running in a task window"'
" Input : "f$
'"Press Return for """f$+"<"""'
" Output : "o$:
o$="" o$=f$+"<"
tab$=
4," ")
tab2$=
8," ")
"OS_File",5,f$
,,,,len
mem len
"OS_File",&FF,f$,mem
menu$(256),count(256)
menus=0
duplicates=
collate("",0)
"OS_CLI","Create "+o$
throwback=
duplicates
"XOS_SWINumberFromString",,"DDEUtils_ThrowbackStart"
throwback=(v
1)=0
throwback
canon 256
"OS_FSControl",37,o$,canon,,,256
"DDEUtils_ThrowbackStart"
"DDEUtils_ThrowbackSend",0,,canon
$;" at ";
#out:
out_line=0
bput("|Start "+f$+lf$)
first_menu=
show_menu(0)
bput(lf$)
bput("|End"+lf$)
throwback
"DDEUtils_ThrowbackEnd"
#out
"OS_CLI","SetType "+o$+" Obey"
'"Done"'
"You will probably need to edit the file by hand now to"
"1) Replace %%0 with <MenuText> and %% with % or <37>"
" in parameterised Menus"
"2) Delete key shortcuts from option texts (-key adds"
" them for you)"'
collate(root$,start)
ptr,sub(),s,i,name$
sub(50)
name$=$(mem+start)
add_menu(name$)
ptr=mem+start+28
PRINT MID$(root$+"."+name$,2)
last=
bit(7,!ptr)
ptr!4<>-1 s+=1:sub(s)=ptr!4
ptr+=24
last
s>0
i=1
collate(root$+"."+name$,sub(i))
show_menu(start)
ptr,a,last,sub(),s,i
sub(50)
ptr=mem+start
name$=$ptr
bput(lf$)
bput("Menu "+
quoted(name$))
first_menu
bput(" Pinboard")
first_menu=
bput(lf$)
check("Duplicated definition of",name$)
title_fg=ptr?12
title_bg=ptr?13
work_fg=ptr?14
work_bg=ptr?15
width=ptr!16
height=ptr!20
gap=ptr!24
a=ptr+28
tick=
bit(0,!a)
line=
bit(1,!a)
write=
bit(2,!a)
last=
bit(7,!a)
sub=a!4
flags=a!8
text_bg=(flags>>28)
text_fg=(flags>>24)
text=mem+a!12
l8 command=mem+a!16+1 :
all have a &07 at the start!
type=a!20-1
keys=command+
$command+1
keys=keys+
$keys
keys=(keys+1+3)
sub<>-1 s+=1:sub(s)=sub
bput(tab$+"Option "+
quoted($text))
$command<>""
command1$=
com($command)
command1$=""
type=0
command2$=
com($(command+
$command+1))
command2$=""
command2$=""
command1$,10)="Filer_Run "
command1$,"|M")=0
sub=-1
w&
bput(" -path "+
command1$,11))
command1$=""
sub<>-1
bput(" -sub ")
sub$=$(mem+sub)
sub$<>$text
bput(
quoted(sub$))
bput("*")
sub<>-1
check("Call to submenu",sub$)
i=0
key=keys!(i*4)
key<>&FF
i=0
#
bput(" -key "+
key(key))
)
"Can't assign key ";
key(key)
tick
bput(" -tick")
text_bg<>0
text_fg<>7
bput(" -bg "+
text_bg+" -fg "+
text_fg)
type>0
bput(" -len "+
type)
bput(lf$)
command1$<>""
bput(tab2$+"Command "+command1$+lf$)
command2$<>""
bput(tab2$+"Command "+command2$+lf$)
line
bput("Dash"+lf$)
a+=24
last
bput("EndMenu"+lf$)
s>0
i=1
show_menu(sub(i))
bput(o$)
#out,o$;
o$,1)=lf$ out_line+=1
quoted(a$)
a$," ")
a$=""
=""""+a$+""""
bit(b,n)
(1<<b))>0
key(key)
m$=""
key >= &180
key <= &1FF
key
&10
m$+=
key
&20
m$+="^"
key = key
key >=
key <=
key = key - 64
key
&01E: =m$+"Home"
&01D: =m$+"Return"
&01C: =m$+"Backspace"
&020: =m$+"Space"
&07F: =m$+"Delete"
&01B: =m$+"Esc"
&180: =m$+"Print"
&181: =m$+"F1"
&182: =m$+"F2"
&183: =m$+"F3"
&184: =m$+"F4"
&185: =m$+"F5"
&186: =m$+"F6"
&187: =m$+"F7"
&188: =m$+"F8"
&189: =m$+"F9"
&18A: =m$+"Tab"
&18B: =m$+"Copy"
&18C: =m$+"Left"
&18D: =m$+"Right"
&18E: =m$+"Down"
&18F: =m$+"Up"
&1CA: =m$+"F10"
&1CB: =m$+"F11"
&1CC: =m$+"F12"
&1CD: =m$+"Insert"
A
(key >= 33
key <= 126)
(key >= 128
key <= 255)
=
!
key >= 0
key <= 31
="^"+
(key + 64)
"Unknown key &";~key
com(c$)
o$,i
o$=""
c$,"%")
i=0
o$+=c$
o$+=
c$,i)+"%"
c$=
c$,i+1)
add_menu(n$)
i<menus
n$<>menu$(i)
i+=1
n$<>menu$(i) menu$(i)=n$:menus+=1
duplicates=
count(i)+=1
check(err$,n$)
i<menus
menu$(i)<>n$
i+=1
count(i)>1
throwback
"DDEUtils_ThrowbackSend",1,,canon,out_line,0,err$+"
"+n$+"
err$+"
"+n$+"
at line ";out_line
taskwindow
buf 256
"OS_GetEnv"
env$
"XOS_ReadArgs","quit/k,task/S,,,,,",env$,buf,256
!buf<>0
) n$="":i=!buf:
?i>31:n$+=
?i:i+=1:
7 l$="":i=
n$,i,1)<>".":l$=
n$,i,1)+l$:i-=1:
buf!4=0
"OS_CLI","TaskWindow -quit -name "+l$+" ""Run "+n$+" -task"""