home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ARM Club 3
/
TheARMClub_PDCD3.iso
/
hensa
/
utilities
/
vmecontrol_2
/
!VMEctrl
/
Source
/
!RunImage
(
.txt
)
next >
Wrap
RISC OS BBC BASIC V Source
|
1995-09-19
|
13KB
|
611 lines
>!RunImage
taskname$="VMECtrl"
dirname$="<VMECtrl$dir>"
iconname$="!VMECtrl"
menuname$="VMECtrl"
0vmefiletype%=&9a5:savefiletype%=vmefiletype%
painflag%=
os3%=
os3:soliddragon%=0
inquire%=
dieonsave%=
datamodified%=
nagg(
$+" at line "+
taskid% 8:$taskid%="TASK"
"Wimp_Initialise",200,!taskid%,taskname$
version%,taskhand%
block% 1024,ibm% 1024,winm% 1024,wblk% 1024,module% 4096
"OS_File",255,dirname$+".VMEcontrol",module%,0
,,,,modulelength%
"Hourglass_On"
sprites
templates
initmenus
initwindows
iconid%=
"Hourglass_Off"
pollloop
updatevmewindow
pollloop
"Wimp_Poll",1,block%
reason%
reason%
2 :
"Wimp_OpenWindow",,block%
3 :
"Wimp_CloseWindow",,block%
9 :
menuclick(block%)
6 :
iconclicked(block%!12,block%!16)
8 :
keypressed(block%!24)
17,18:
7 :
keypressed(code%)
code%<>13
"Wimp_ProcessKey",code%:
"Wimp_GetCaretPosition",,wblk%
2" window%=!wblk%:icon%=wblk%!4
3. buttons%=4:
simulate select by default!
window%
5D
save% :
selected(save%,0,-1):
saveok:
selected(save%,0,0)
6$
"Wimp_ProcessKey",code%
nagg(nagg$)
"Wimp_ReportError"," "+nagg$,1<<4,taskname$
block%!0=-1
block%!4=0
block%!8=0 :
Y DIRECTION
B block%!12=76 :
X DIRECTION
block%!16=76
block%!20=&2002
$(block%+24)=iconname$
"Wimp_CreateIcon",,block%
icon%
=icon%
nagg("Error in death throes!"):
b%=1
(b%?fontarray%)>0
M
i%=1
(b%?fontarray%)
"Font_LoseFont",b%
O
"Wimp_CloseDown",taskhand%,!taskid%
click_type
c%=block%!8
c%=4
select
c%=2
popupmenu(
c%=1
adjust
block%!16
saveack
filedrop
loadack
dataopen
filedrop
(block%!20=main%
block%!20=-2)
(block%!40=vmefiletype%)
checkload(
file(block%+44),block%!40)
file(where%)
file$=""
?where%
file$+=
(?where%)
where%+=1
=file$
initmenus
t" i%=
initmenu(ibm%,menuname$)
u' i%=
additem(i%,"Info",0,inf_win%)
v$ i%=
additem(i%,"Save",0,save%)
w" i%=
additem(i%,"Quit",-1,-1)
y# i%=
initmenu(winm%,menuname$)
z' i%=
additem(i%,"Info",0,inf_win%)
{$ i%=
additem(i%,"Save",0,save%)
|" i%=
additem(i%,"Quit",-1,-1)
popupmenu(bar%)
inquire%
"Wimp_GetPointerInfo",,block%
2q=!block%:w=block%!4:w%=block%!12:i%=block%!16
bar%
w=96+44*3
w+=22
bar%
menu%=ibm%
menu%=winm%
"Wimp_CreateMenu",,menu%,q-64,w
&lastmenu%=menu%:menx%=q-64:meny%=w
templates
fontarray% 256
b%=0
252
b%!fontarray%=0
infb% 500,infi% 128
autb% 864,auti% 204
savb% 600,savi% 328
maib% 1024,maii% 300
"Wimp_OpenTemplate",,dirname$+".templates"
Binf_win%=
template("info",infb%,infi%,200,fontarray%,sprites%)
Daut_win%=
template("author",autb%,auti%,300,fontarray%,sprites%)
?save%=
template("save",savb%,savi%,400,fontarray%,sprites%)
Cmain%=
template("vmectrl",maib%,maii%,1024,fontarray%,sprites%)
"Wimp_CloseTemplate"
template(name$,buf%,ind%,len%,fonts%,sprs%)
"Wimp_LoadTemplate",,buf%,ind%,ind%+len%,fonts%,name$,0
buf%!64=sprs%
"Wimp_CreateWindow",,buf%
handle%
=handle%
sprites
#file%=
(dirname$+".SpriteFile")
file%=0
nagg("Can't find spritefile!"):
#file%)+128
#file%
sprites% S%
sprites%!0=S%
sprites%!8=16
"OS_SpriteOp",9+256,sprites%
"OS_SpriteOp",10+256,sprites%,dirname$+".SPRITEFILE"
select
openwindow(main%)
adjust
openwindow(aut_win%)
openwindow(window%)
!wblk%=window%
"Wimp_GetWindowState",,wblk%
wblk%!28=-1
flags%=wblk%!32
(flags%
1<<16)=0
!wblk%=window%
"Wimp_GetWindowInfo",,wblk%
/ mwid%=
read_mode(-1,11)<<
read_mode(-1,4)
/ mhig%=
read_mode(-1,12)<<
read_mode(-1,5)
! width%=(wblk%!12)-(wblk%!4)
" height%=(wblk%!16)-(wblk%!8)
" wblk%!4=mwid%
2 - width%
wblk%!12=(wblk%!4)+width%
$ wblk%!8=mhig%
2 - height%
wblk%!16=wblk%!8+height%
wblk%!28=-1
"Wimp_OpenWindow",,wblk%
pii(window%,icon%,text$)
!wblk%=window%
wblk%!4=icon%
"Wimp_GetIconState",,wblk%
%ot$=$(wblk%!28):$(wblk%!28)=text$
wblk%!8=0
wblk%!12=0
ot$<>text$
"Wimp_SetIconState",,wblk%
contents(window%,icon%)
!wblk%=window%
wblk%!4=icon%
"Wimp_GetIconState",,wblk%
=$(wblk%!28)
closewindow(window%)
!wblk%=window%
"Wimp_CloseWindow",,wblk%
changeval(window%,icon%,to$)
!wblk%=window%
wblk%!4=icon%
"Wimp_GetIconState",,wblk%
$(wblk%!32)=to$
wblk%!8=0
wblk%!12=0
"Wimp_SetIconState",,wblk%
selected(window%,icon%,well%)
!wblk%=window%
wblk%!4=icon%
wblk%!12=1<<21
wblk%!8=(-well%)<<21
"Wimp_SetIconState",,wblk%
isselected(win%,icon%)
!wblk%=win%:wblk%!4=icon%
"Wimp_GetIconState",,wblk%
=((wblk%!24)
1<<21)<>0
menuselection(blk%,menu%)
"Wimp_DecodeMenu",,menu%,blk%,wblk%+64
=$(wblk%+64)
menuclick(brtnd%)
, item$=
menuselection(brtnd%,lastmenu%)
PROCnagg(item$)
item$
"Quit" :
@
"Info" :
"Wimp_CreateMenu",,-1:
openwindow(aut_win%)
"Save" :
saveok
openwindowxy(window%,x%,y%)
!wblk%=window%
"Wimp_GetWindowState",,wblk%
!wblk%=window%
"Wimp_GetWindowInfo",,wblk%
! width%=(wblk%!12)-(wblk%!4)
hite%=(wblk%!16)-(wblk%!8)
wblk%!4=x%
wblk%!12=(wblk%!4)+width%
wblk%!16=y%
wblk%!8=(wblk%!16)-hite%
wblk%!28=-1
"Wimp_OpenWindow",,wblk%
saveclicked(xx%,yy%)
openwindowxy(save%,xx%,yy%)
initwindows
changeval(save%,2,"Sfile_"+
~(vmefiletype%))
pii(main%,3,
pii(save%,1,"VME")
selected(save%,4,
updatevmewindow
loadack
block%!12=block%!8
block%!16=4
"Wimp_SendMessage",19,block%,block%!4
saveack
name$=
file(block%+44)
leafname(name$)=""
NO FILE NAME!
block%!16=3
"Wimp_SendMessage",17,block%,block%!4
pii(save%,1,name$)
saveok
saveok
closewindow(save%)
"Wimp_CreateMenu",,-1
/ filename$=
contents(save%,1)
savefile(filename$)
dieonsave%
startdrag(window%,icon%)
solid%=
usedragasprite
block%!0=window%
"Wimp_GetWindowState",,block%
wx%=block%!4-block%!20
wy%=block%!16-block%!24
block%!4=icon%
"Wimp_GetIconState",,block%
block%!0=window%
block%!4=5
block%!8+=wx%
block%!12+=wy%
block%!16+=wx%
block%!20+=wy%-2
block%!24=0
block%!28=0
D6block%!32=(
read_mode(-1,11)+1)*2^
read_mode(-1,4)
E6block%!36=(
read_mode(-1,12)+1)*2^
read_mode(-1,5)
solid%
G" spr$="file_"+
~savefiletype%
"DragASprite_Start",%10001010,1,spr$,block%+8
soliddragon%=
"Wimp_DragBox",,block%
soliddragon%=
read_mode(mode%,var%)
"OS_ReadModeVariable",mode%,var%
,,value%
=value%
soliddragon%
"DragASprite_Stop"
"Wimp_GetPointerInfo",,block%
mx%=block%!0
my%=block%!4
window%=block%!12
window%<1
['name$=
leafname(
contents(save%,1))
\#block%!0=44+((
name$
4)+1)*4
block%!16=1
block%!20=window%
block%!24=-1
block%!28=mx%
block%!32=my%
block%!36=&100
block%!40=savefiletype%
$(block%+44)=name$+
"Wimp_SendMessage",17,block%,window%
leafname(name$)
leaf$=""
name$<>""
name$,1)<>"."
leaf$=
name$,1)+leaf$
name$=
name$)
=leaf$
pad(num%)
" "+
(num%),4)
"OS_Module",20,0,-1
,,,name$,,,v%
u,=(name$="UtilityModule"
v%>=&30000)<>0
usedragasprite
"OS_Byte",161,&1C
,,value%
=(value%
2)<>0
os3%
filedrag
startdrag(save%,2)
dataopen
type%=block%!40
type%<>vmefiletype%
loadack
name$=
file(block%+44)
checkload(name$,type%)
checkload(name$,type%)
type%
vmefiletype% :
loadfile(name$)
linef(
a$,l%)
ll%,b$
b$=
a$,l%)
(b$)=l%
*
".,! ?):%;",
b$,1))=0
b$<>""
b$=
(b$)-1)
b$=""
a$,l%)
a$=
(a$)-
(b$))
b$,1)=" "
(b$)-1)
DEFFNquery(q$,a$,b$)
"Wimp_ReportError"," "+q$+" OK="+b$+" Cancel="+a$,3
,bob%
=bob%=1
query(q$,a$,b$)
* qq$=
linef(q$,32):
pii(query%,3,qq$)
* qq$=
linef(q$,32):
pii(query%,4,qq$)
* qq$=
linef(q$,40):
pii(query%,5,qq$)
* qq$=
linef(q$,40):
pii(query%,6,qq$)
pii(query%,2,a$):
pii(query%,7,b$)
openwindow(query%)
inquire%=
pollloop
inquire%=
=inqbut%
loadfile(name$)
pii(save%,1,name$)
loadfile$=name$
"VME_LoadMap",loadfile$
iconclicked(window%,icon%)
buttons%=block%!8
window%<0
icon%=iconid%
click_type:
(block%!8)=2
window%=-2
popupmenu(icon%=iconid%):
window%=main%
popupmenu(
painflag%
window%=pain%
popupmenu(
window%
save% :
icon%
&
2 :
buttons%>=16
filedrag
0 :
saveok
E
3 :
closewindow(save%):dieonsave%=
"Wimp_CreateMenu",-1
'
4 :
isselected(save%,4)
3
: savefiletype%=vmefiletype%
,
: savefiletype%=&FFA
=
changeval(save%,2,"Sfile_"+
~savefiletype%)
aut_win% :
icon%=16
closewindow(aut_win%)
inf_win% :
icon%=2
"Wimp_CreateMenu",,-1:
openwindow(aut_win%)
main% :
icon%
4
10 :
"VME_Control",
isselected(main%,10)
7
11 :
"VME_WriteMap",
isselected(main%,11)
1 :
mode_down
2 :
mode_up
4 : mode%=
modetest
J
mode%>=0
"VME_WriteMap",mode%,
isselected(main%,4)
13 :
savewindow
quit:
initmenu(menu%,menuname$)
2$menu%=menuname$: :
menu title
Emenu%?12=7:menu%?13=2 :
title foreground & background
Emenu%?14=7:menu%?15=0 :
menu foreground & background
(menuname$)>5
" menu%!16=(
(menuname$)+1)*16
menu%!16=6*16
2menu%!20=44 :
width & height of items
@menu%!24=0 :
vertical gap twixt items
=menu%+28
additem(menu%,text$,last%,sub%)
last%
!menu%=128
!menu%=0
menu%!4=sub%
menu%!8=&7000021
$(menu%+12)=text$
=menu%+24
updatevmewindow
"VME_Status"
vmeon%:vmeon%=vmeon%<>0
"VME_ReadMap",
,vmecfg%:vmecfg%=vmecfg%<>0
pii(main%,12,"Mode "+
# ves%=
isselected(main%,10)<>0
# vec%=
isselected(main%,11)<>0
ves%<>vmeon%
selected(main%,10,vmeon%)
vec%<>vmecfg%
selected(main%,11,vmecfg%)
1 mode%=
modetest:
mode%<0
mode%=
modetest
"VME_ReadMap",mode%
,vmecfg%:vmecfg%=vmecfg%<>0
" vec%=
isselected(main%,4)<>0
vec%<>vmecfg%
selected(main%,4,vmecfg%)
modetest
. mode%=
contents(main%,3)):nmode%=mode%
mode%<0
nagg("Hmm, negative mode number. Not good, Batman."):nmode%=0
mode%>127
nagg("Maximum mode number is 127"):nmode%=127
nmode%<>mode%
pii(main%,3,
(nmode%)):mode%=-1
=mode%
mode_up
mode%=
modetest
mode%<127
pii(main%,3,
(mode%+1))
mode_down
mode%=
modetest
mode%>0
pii(main%,3,
(mode%-1))
savewindow
"Wimp_GetPointerInfo",,block%
2q=!block%:w=block%!4:w%=block%!12:i%=block%!16
openwindowxy(save%,q,w)
savefile(as$)
savefiletype%
,
vmefiletype% :
"VME_SaveMap",as$
(
&FFA :
newmodule(as$)
saveerror
filehandle%
#filehandle%
filehandle%=0
nagg("File save operation failed: "+
newmodule(saveas$)
" table%=module%+modulelength%
table%?-1<>255:table%-=1:
m%=0
"VME_ReadMap",m%
#
?table%=m%:table%+=1
?table%=128:table%+=1
"XOS_File",10,saveas$,&FFA,,module%,table%
err%
err%=10
mp%=err%+4:mess$=""
?mp%>31
mess$+=
?mp%:mp%+=1
nagg("Module save operation failed: "+mess$)