home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
APDL Public Domain 1
/
APDL_PD1A.iso
/
discutils
/
bootup
/
makeboot
/
!MakeBoot
/
Source
(
.txt
)
< prev
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
RISC OS BBC BASIC V Source
|
1993-12-06
|
32.4 KB
|
1,534 lines
><MakeBoot$Dir>.Source
This application is FreeWare. (c) 1993 Dick Alstein
Appl$="MakeBoot"
Version$="1.14 (6-12-93)"
error
quit%=
)mask%=1+(1<<4)+(1<<5)+(1<<11)+(1<<12)
"Wimp_Poll",mask%,blk%
reason%
reason%
1 :
redraw(blk%!0)
2 :
"Wimp_OpenWindow",,blk%
blk%!0
!
winhdl%(0),winhdl%(1)
.
"Wimp_GetPointerInfo",,ptrinfo%
ptrinfo%!8=1
)
"Filer_OpenDir "+bootdir$
-1)
)
"Wimp_CloseWindow",,blk%
'
"Wimp_CloseWindow",,blk%
6 :
mouseclick(blk%!0,blk%!4,blk%!8,blk%!12,blk%!16)
7 :
moveappl
8 :
key(blk%!0,blk%!4,blk%!24)
9 :
menuselect(blk%)
17,18 :
receive(blk%!4,blk%!8,blk%!16)
quit%
msg_exit
"Wimp_CloseDown"
buf%,w%,i%
errblk% &100
"Wimp_Initialise",200,&4B534154,Appl$
osversion%,thistask%
error :
blk% &600
indsize%=&600
indir% indsize%
indirend%=indir%+indsize%
ptrinfo% 20
dragblk% 60
scrapblk% 256
"OS_ReadVarVal","MakeBoot$Dir",scrapblk%,256,0
,,len%
scrapblk%?len%=13
ApplDir$=$(scrapblk%)
ApplPath$="MakeBootRes:"
msg_init
scrapblk%!0=-1
:!scrapblk%!4=0 : scrapblk%!8=0
;%scrapblk%!12=82 : scrapblk%!16=68
scrapblk%!20=&7000301A
$(scrapblk%+24)="!makeboot"
"Wimp_CreateIcon",,scrapblk%
baricon%
winhdl%(1)
wintitle%(1)
maxapps%=256
"Wimp_OpenTemplate",,ApplPath$+"Templates"
C"infowin%=
loadtemplate("Info")
D!$(blk%!(92+3*32+20))=Version$
E'winhdl%(0)=
loadtemplate("BootSeq")
icon0xmin%=blk%!(92+0*32+0)
icon0xmax%=blk%!(92+0*32+8)
icon0ymin%=blk%!(92+0*32+4)
icon1xmin%=blk%!(92+1*32+0)
icon1xmax%=blk%!(92+1*32+8)
icon2xmin%=blk%!(92+2*32+0)
icon2xmax%=blk%!(92+2*32+8)
itemheight%=80
wintitle%(0)=blk%!76
i% (blk%!84)
wintitle%(1)=i%
blk%!76=wintitle%(1)
"Wimp_CreateWindow",,blk%+4
winhdl%(1)
S($(wintitle%(0))=
msg_lookup0("BSEQ")
T)$(wintitle%(1))=
msg_lookup0("DBSEQ")
U#filewin%=
loadtemplate("Files")
V#filename_dir%=blk%!(92+2*32+20)
W$filename_leaf%=blk%!(92+3*32+20)
X(saveseqwin%=
loadtemplate("SaveSeq")
Y"saveseq_dir%=blk%!(92+2*32+20)
Z#saveseq_leaf%=blk%!(92+3*32+20)
[(dialogwin%=
loadtemplate("Dialogue")
dial_msg%=blk%!(92+20)
]<dial_buttoncol%=(blk%!(92+1*32+16))
((1<<2)+(&FF<<24))
dial_text%(3)
_#dial_text%(1)=blk%!(92+1*32+20)
`#dial_text%(2)=blk%!(92+2*32+20)
a#dial_text%(3)=blk%!(92+3*32+20)
"Wimp_CloseTemplate"
nractions%=6
action%(nractions%)
i%=0
nractions%
buf% 16
action%(i%)=buf%
$(action%(0))="Run"
$(action%(1))="Boot"
$(action%(2))="IconSprites"
l!$(action%(3))="Filer_OpenDir"
$(action%(4))="ToolSprites"
$(action%(5))="Filer_Boot"
$(action%(6))="RMLoad"
Action$(nractions%+1)
i%=0
nractions%
r) Action$(i%)=
upcase($(action%(i%)))
nrapps%(1)
nrapps%(0)=0
nrapps%(1)=0
w8applblksize%=0 :
size of a block for item data
x#applblksize%+=256 :
pathname
y#applblksize%+=12 :
leafname
applblksize%+=4 :
type
{4applblksize%+=16 :
name of sprite to display
|!applblksize%+=4 :
action
},applblksize%+=4 :
"disabled" switch
~%applblksize%+=256 :
parameters
appl%(1,maxapps%) :
pointers to item data blocks
heap_init
initmenus
readscreenvars
display%(1) :
0 -> Name + Action, 1 -> Full info
winxmin%(1),winymin%(1),winxmax%(1),winymax%(1)
choices_load
selecticon(saveseqwin%,5,makebackup%)
changed%(1)
changed%(0)=
changed%(1)=
8shutdown_ok%=
allow shutdown with changes made?
*bootdir$=
striproot(ApplDir$)+".!Boot"
seqfname$(1)
seqfname$(0)="!Run"
seqfname$(1)="DeskBoot"
loadall
redraw(handle%)
w%,more%,top%,linenr%,lastline%
handle%=winhdl%(0)
w%=0
w%=1
blk%!0=handle%
"Wimp_RedrawWindow",,blk%
more%
#top%=blk%!16-blk%!24+icon0ymin%
more%
* linenr%=(top%-blk%!40)
itemheight%
, lastline%=(top%-blk%!32)
itemheight%
linenr%<=lastline%
0
(linenr%<nrapps%(w%))
(linenr%>=0)
)
print item data for this line
b%=appl%(w%,linenr%)
# scrapblk%!0=icon0xmin%+12
scrapblk%!8=icon0xmax%
7 scrapblk%!12=icon0ymin%-(itemheight%*linenr%)
0 scrapblk%!4=(scrapblk%!12)-itemheight%
b%!292
" scrapblk%!16=&13400133
" scrapblk%!16=&17000133
scrapblk%!20=b%+256
scrapblk%!24=b%+272
scrapblk%!28=12
'
"Wimp_PlotIcon",,scrapblk%
scrapblk%!0=icon1xmin%
scrapblk%!8=icon1xmax%
b%!292
" scrapblk%!16=&13000131
" scrapblk%!16=&1B000131
& scrapblk%!20=action%(b%!288)
scrapblk%!28=-1
scrapblk%!32=16
'
"Wimp_PlotIcon",,scrapblk%
display%(w%)=1
" scrapblk%!0=icon2xmin%
" scrapblk%!8=icon2xmax%
b%!292
$ scrapblk%!16=&13000131
$ scrapblk%!16=&18000131
scrapblk%!20=b%+296
scrapblk%!28=-1
scrapblk%!32=256
)
"Wimp_PlotIcon",,scrapblk%
linenr%+=1
"Wimp_GetRectangle",,blk%
more%
coordtolinenr(w%,y%)
yc%,l%
scrapblk%!0=winhdl%(w%)
"Wimp_GetWindowState",,scrapblk%
/yc%=scrapblk%!16-scrapblk%!24+icon0ymin%-y%
yc%<0
l%=-1
l%=yc%
itemheight%
l%>nrapps%(w%)
l%=nrapps%(w%)
coordtofieldnr(w%,x%)
scrapblk%!0=winhdl%(w%)
"Wimp_GetWindowState",,scrapblk%
x%-=scrapblk%!4-scrapblk%!20
x%<icon1xmin%
f%=0
x%<icon2xmin%
f%=1
f%=2
addappl(w%,name$,type%,action%,args$,off%,nr%)
b%,i%,spr$
nrapps%(w%)=maxapps%
dialogue(0)
nr%<0
nr%=0
nr%<nrapps%(w%)
3
inserting in sequence - shift other items
#
i%=nrapps%(w%)
nr%
% appl%(w%,i%+1)=appl%(w%,i%)
nr%=nrapps%(w%)
b%=
heap_get(applblksize%)
appl%(w%,nr%)=b%
$(b%)=name$
$(b%+256)=
leafname(name$)
b%!268=type%
type%
!
0 : spr$="file_???"
"
&1000 : spr$="directory"
&2000
#
sprexists($(b%+256))
spr$=$(b%+256)
spr$="application"
&FFFFFFFF
spr$="file_xxx"
spr$="file_"+
~(type%)
sprexists(spr$)
spr$="file_xxx"
$(b%+272)="S"+spr$
action%=-1
+
attach default action to new item
type%
&1000 : b%!288=3
&2000
*
(osversion%>=300)
(w%=1)
b%!288=5
-
fileexists(name$+".!Boot")
b%!288=1
2
fileexists(name$+".!Sprites")
b%!288=1
b%!288=0
&FF9 : b%!288=2
&FFA : b%!288=6
: b%!288=0
&
b%!288=action%
b%!292=off%
$(b%+296)=args$
nrapps%(w%)+=1
setextent(w%)
setchanged(w%,
redrawfromline(w%,nr%)
redrawline(w%,linenr%)
xmin%,ymin%,xmax%,ymax%
xmin%=icon0xmin%+12
xmax%=icon2xmax%
7*ymax%=icon0ymin%-(itemheight%*linenr%)
ymin%=ymax%-itemheight%
"Wimp_ForceRedraw",winhdl%(w%),xmin%,ymin%,xmax%,ymax%
redrawfromline(w%,linenr%)
xmin%,ymin%,xmax%,ymax%
xmin%=icon0xmin%+12
xmax%=icon2xmax%
@*ymax%=icon0ymin%-(itemheight%*linenr%)
ymin%=-10000
"Wimp_ForceRedraw",winhdl%(w%),xmin%,ymin%,xmax%,ymax%
clearsequence(w%)
nrapps%(w%)>0
deleteappl(w%,nrapps%(w%)-1)
deleteappl(w%,nr%)
heap_release(appl%(w%,nr%))
i%=nr%
(nrapps%(w%)-1)
P! appl%(w%,i%)=appl%(w%,i%+1)
nrapps%(w%)-=1
redrawfromline(w%,nr%)
setchanged(w%,
setextent(w%)
dirname(F$)
p%,q%
F$,".",p%)
q% > 0
p%=q%+1
q%=0
F$,p%-2)
errbox(err$,boxes%)
errblk%!0=0
$(errblk%+4)=err$+
"Wimp_ReportError",errblk%,boxes%,Appl$
,click%
=(click%=1)
error
"Wimp_CloseDown" :
errbox(
$+" (line "+
)+")",3)
"Wimp_CloseDown"
direxists(f$)
type%,flags%
type%=0
(f$)>0
"XOS_File",17,f$
type%;flags%
=(type%=2)
((flags%
1)=0)
fileexists(f$)
type%,flags%
type%=0
(f$)>0
"XOS_File",17,f$
type%;flags%
=(type%=1)
((flags%
1)=0)
seqfname(i%)
=bootdir$+"."+seqfname$(i%)
key(window%,icon%,key%)
window%
filewin%
!
(icon%=3)
(key%=13)
# bootdir$=$(filename_dir%)
( seqfname$(1)=$(filename_leaf%)
#
selecticon(filewin%,4,1)
"
"Wimp_CreateMenu",,-1
#
selecticon(filewin%,4,0)
#
"Wimp_ProcessKey",key%
!
"Wimp_ProcessKey",key%
leafname(f$)
p%,q%
p%=q%+1
q%=
f$,".",p%)
q%=0
f$,p%)
--- split name of root directory from pathname ---
striproot(f$)
p%,q%
f$,"$")
q%>0
p%=q%
q%=
f$,"$",p%+1)
f$,p%)
loadall
i%,loaderror%
loaderror%=0
"Hourglass_On"
direxists(bootdir$)
i%=0
&
fileexists(
seqfname(i%))
loadsequence(i%)
*
loaderror%=0
loaderror%=1+i%
loaderror%=4
"Hourglass_Off"
setextent(0)
setextent(1)
loaderror%
1 :
dialogue(1)
2 :
dialogue(2)
3 :
dialogue(3)
4 :
dialogue(4)
loadsequence(w%)
p%,in$,cmd$,file$,arg$,act%,tagfound%,disabled%
tagfound%=
seqfname(w%))
error :
in$=
p%=
in$,"|")
disabled%=(p%=1)
p%>0
tagfound%
' tagfound%=(
in$,Appl$,p%)<>0)
disabled%
in$=
in$,p%+1)
p%=
in$," ")
) cmd$=
upcase(
trimleft(
in$,p%-1)))
in$=
trimleft(
in$,p%+1))
p%=
in$," ")
file$=
in$,p%-1)
arg$=
trimleft(
in$,p%+1))
cmd$,1)="*"
9 cmd$=
cmd$,2) :
strip leading "*"s from command
cmd$,1)="%"
8 cmd$=
cmd$,2) :
strip leading "%" from command
(cmd$<>"")
(file$<>"")
act%=0
5
(act%<=nractions%)
(cmd$<>Action$(act%))
act%+=1
(act%<=nractions%)
act%
3
upcase(
leafname(file$))="!BOOT"
act%=1
% file$=
dirname(file$)
:
upcase(
leafname(file$)),8)="!SPRITES"
6
leafname(
dirname(file$)),1)="!"
act%=1
' file$=
dirname(file$)
N
addappl(w%,file$,
objtype(file$),act%,arg$,disabled%,nrapps%(w%)+1)
9
(cmd$="DESKTOP")
(file$="-File")
(w%=0)
( seqfname$(1)=
leafname(arg$)
tagfound%)
(loaderror%=0)
loaderror%=3
setchanged(w%,
loadtemplate(name$)
handle%
"Wimp_CloseTemplate" :
error
"Wimp_LoadTemplate",,blk%+4,indir%,indirend%,-1,name$,0
,,indir%
"Wimp_CreateWindow",,blk%+4
handle%
=handle%
mouseclick(xpos%,ypos%,button%,wndw%,icon%)
w%,linenr%,field%,data%
wndw%
button%
$
closewindow(winhdl%(0))
$
closewindow(winhdl%(1))
openwindow(0,1)
openwindow(1,1)
+
showmenu(blk%,mainmenu%,-1,-1)
winhdl%(0),winhdl%(1)
wndw%=winhdl%(0)
w%=0
w%=1
( linenr%=
coordtolinenr(w%,ypos%)
+
linenr%>=nrapps%(w%)
linenr%=-1
!( field%=
coordtofieldnr(w%,xpos%)
".
linenr%>=0
data%=appl%(w%,linenr%)
button%
2 :
menu button
%/
showmenu(blk%,seqmenu%,w%,linenr%)
')
(linenr%>=0)
(field%=1)
('
adjust button on action
data%!288=0
+& data%!288=nractions%
data%!288-=1
/4
validaction(data%!288,w%,data%!268)
0%
redrawline(w%,linenr%)
setchanged(w%,
3)
(linenr%>=0)
(field%=0)
4*
adjust button on item name
5% data%!292=
(data%!292)
6%
redrawline(w%,linenr%)
setchanged(w%,
:)
(linenr%>=0)
(field%=1)
;'
select button on action
=(
data%!288=nractions%
data%!288=0
data%!288+=1
B4
validaction(data%!288,w%,data%!268)
C%
redrawline(w%,linenr%)
setchanged(w%,
F%
4*16 :
drag with select
GA
(linenr%>=0)
(linenr%<nrapps%(w%))
(field%=0)
H$
startdrag(w%,linenr%)
J
filewin%
icon%
N% bootdir$=$(filename_dir%)
O* seqfname$(1)=$(filename_leaf%)
P$
"Wimp_CreateMenu",,-1
Q
saveseqwin%
icon%
U$
"Wimp_CreateMenu",,-1
V(
savesequence(lastmenu_seq%)
X% makebackup%=
makebackup%
Y
dialogwin%
[
"Wimp_CreateMenu",,-1
lastdialogue%
icon%=1
quit%=
icon%=1
a)
resume shutdown procedure
shutdown_ok%=
c3
"Wimp_GetCaretPosition",,scrapblk%
scrapblk%!24=&1FC
e>
"Wimp_SendMessage",8,scrapblk%,prequitsender%
g
--- open a sequence window
pos%=0 -> at current position
pos%=1 -> at position as read from choices
pos%=2 -> at current position, full width
openwindow(w%,pos%)
blk%!0=winhdl%(w%)
"Wimp_GetWindowInfo",,blk%
blk%!28=-1
pos%
blk%!4=winxmin%(w%)
blk%!8=winymin%(w%)
blk%!12=winxmax%(w%)
blk%!16=winymax%(w%)
z( blk%!12=blk%!4+(blk%!52-blk%!44)
"Wimp_OpenWindow",,blk%
closewindow(handle%)
scrapblk%!0=handle%
"Wimp_CloseWindow",,scrapblk%
moveappl
w%,linenr%,a%,i%
dragasprite%
"DragASprite_Stop"
"Wimp_GetPointerInfo",,ptrinfo%
w%=-1
ptrinfo%!12=winhdl%(0)
w%=0
ptrinfo%!12=winhdl%(1)
w%=1
w%<>-1
+ linenr%=
coordtolinenr(w%,ptrinfo%!4)
linenr%<0
linenr%=0
* a%=appl%(dragfromwin%,dragfromline%)
w%=dragfromwin%
6
linenr%>=nrapps%(w%)
linenr%=nrapps%(w%)-1
!
dragfromline%>linenr%
move down
/
i%=(dragfromline%-1)
linenr%
' appl%(w%,i%+1)=appl%(w%,i%)
appl%(w%,linenr%)=a%
%
redrawfromline(w%,linenr%)
!
dragfromline%<linenr%
move up
*
i%=dragfromline%
(linenr%-1)
' appl%(w%,i%)=appl%(w%,i%+1)
appl%(w%,linenr%)=a%
+
redrawfromline(w%,dragfromline%)
$
(dragfromline%<>linenr%)
setchanged(w%,
move to other window
nrapps%(w%)<maxapps%
C
addappl(w%,$(a%),a%!268,a%!288,$(a%+296),a%!292,linenr%)
1
deleteappl(dragfromwin%,dragfromline%)
readscreenvars
xeig%,yeig%,xpixels%,ypixels%
"OS_ReadModeVariable",-1,4
,,xeig%
"OS_ReadModeVariable",-1,5
,,yeig%
"OS_ReadModeVariable",-1,11
,,xpixels%
"OS_ReadModeVariable",-1,12
,,ypixels%
unitsppixel_x%=1<<xeig%
unitsppixel_y%=1<<yeig%
Iscreensize_x%=(xpixels%+1)*unitsppixel_x% :
screen size in OS units
-screensize_y%=(ypixels%+1)*unitsppixel_y%
receive(sender%,ref%,code%)
w%,ack%,file$,type%,hlp$,linenr%,field%
ack%=0
sender% <> thistask%
code%
quit%=
file$=
str(blk%+44)
type%=blk%!40
blk%!20
#
winhdl%(0),winhdl%(1)
&
(blk%!20=winhdl%(0))
w%=0
w%=1
I
addappl(w%,file$,type%,-1,"",0,
coordtolinenr(w%,blk%!32))
ack%=4
4
(blk%!24=baricon%)
(type%=&2000)
0
upcase(
file$,7))="$.!BOOT"
bootdir$=file$
#
clearsequence(0)
#
clearsequence(1)
loadall
ack%=4
desktop shutdown
<
(changed%(0)
changed%(1))
shutdown_ok%)
ack%=8
" prequitsender%=sender%
dialogue(8)
&502
*
request from !Help application
hlp$=""
icon%=blk%!36
blk%!32
icon%=baricon%
- hlp$=
msg_lookup0("HLP_IBAR")
#
winhdl%(0),winhdl%(1)
$
blk%!32=winhdl%(0)
w%=0
- hlp$=
msg_lookup0("HLP_SEQ0")
w%=1
- hlp$=
msg_lookup0("HLP_SEQ1")
0 linenr%=
coordtolinenr(w%,blk%!24)
0 field%=
coordtofieldnr(w%,blk%!20)
B
(icon%<0)
(linenr%>=0)
(linenr%<nrapps%(w%))
field%
;
0 : hlp$+="|M"+
msg_lookup0("HLP_ITEM")
;
1 : hlp$+="|M"+
msg_lookup0("HLP_ACTN")
;
2 : hlp$+="|M"+
msg_lookup0("HLP_ARGS")
filewin%
+ hlp$=
msg_lookup0("HLP_FILE")
hlp$<>""
$(blk%+20)=hlp$
ack%=&503
&400C0
# $(filename_dir%)=bootdir$
( $(filename_leaf%)=seqfname$(1)
:
"Wimp_CreateSubMenu",,blk%!20,blk%!24,blk%!28
&400C1
readscreenvars
ack%>0
blk%!0=256
blk%!12=ref%
blk%!16=ack%
-
"Wimp_SendMessage",17,blk%,sender%
saveall
savesequence(0)
savesequence(1)
savesequence(w%)
fn$,bfn$,i%,data%
direxists(bootdir$)
dialogue(7)
error :
fn$=
seqfname(w%)
makebackup%
fileexists(fn$)
8 bfn$=
dirname(fn$)+"."+
leafname(fn$),6)+"_bak"
fileexists(bfn$)
"Delete "+bfn$
"
#
"Rename "+fn$+" "+bfn$
F%=
(fn$)
#F%,"|"
#F%,"| "+
msg_lookup1("PRO1",Version$)
#F%,"| "+
msg_lookup0("PRO2")
#F%,"|";
nrapps%(w%)>0
#F%,""
i%=0
nrapps%(w%)-1
data%=appl%(w%,i%)
data%!292
#F%,"|";
data%!268=&2000
data%!288
42
fileexists($(data%)+".!Boot")
50
#F%,"Run "+$(data%)+".!Boot";
7;
#F%,"IconSprites "+$(data%)+".!Sprites";
:8
#F%,$(action%(data%!288))+" "+$(data%);
=4
#F%,$(action%(data%!288))+" "+$(data%);
#F%," "+$(data%+296)
w%=0
#F%,""
D,
#F%,"%Desktop -File "+
seqfname(1);
"OS_File",18,
seqfname(w%),&FEB
setchanged(w%,
setchanged(w%,newval%)
changed%(w%)
newval%
t$=$(wintitle%(w%))
changed%(w%)
Q% $(wintitle%(w%))=
(t$)-2)
S $(wintitle%(w%))=t$+" *"
U! changed%(w%)=
changed%(w%)
blk%!0=winhdl%(w%)
"Wimp_GetWindowState",,blk%
(blk%!32
(1<<16))
YH
"Wimp_ForceRedraw",-1,blk%!4,(blk%!16)+4,blk%!12,(blk%!16)+36
setextent(w%)
lines%
lines%=nrapps%(w%)+1
lines%<2
lines%=2
scrapblk%!0=0
c/scrapblk%!4=icon0ymin%-itemheight%*lines%-8
display%(w%)=1
scrapblk%!8=icon2xmax%-1
scrapblk%!8=icon1xmax%-1
scrapblk%!12=0
"Wimp_SetExtent",winhdl%(w%),scrapblk%
scrapblk%!0=winhdl%(w%)
"Wimp_GetWindowState",,scrapblk%
(scrapblk%!32
(1<<16))
"Wimp_OpenWindow",,scrapblk%
sprexists(sp$)
flags%
"XWimp_SpriteOp",&18,,sp$
;flags%
=((flags%
1)=0)
startdrag(w%,linenr%)
b%,spr$,width%
blk%!0=winhdl%(w%)
"Wimp_GetWindowState",,blk%
dragblk%!4=5
dragblk%!8=(blk%!4)+4
{Hdragblk%!12=(blk%!16)+icon0ymin%-((linenr%+1)*itemheight%)-(blk%!24)
display%(w%)=0
}% width%=icon1xmax%-icon0xmin%-16
% width%=icon2xmax%-icon0xmin%-16
#dragblk%!16=(dragblk%!8)+width%
8dragblk%!20=(dragblk%!12)+itemheight%-unitsppixel_y%
dragblk%!24=0
dragblk%!28=0
dragblk%!32=xpixels%
dragblk%!36=ypixels%
"OS_Byte",161,&1C
,,b% :
read "dragasprite" bit in CMOS RAM (RO3)
dragasprite%=(b%
2)<>0
dragasprite%
"Wimp_GetPointerInfo",,ptrinfo%
dragblk%!8=ptrinfo%!0-100
dragblk%!16=ptrinfo%!0+100
% spr$=$(appl%(w%,linenr%)+272+1)
"DragASprite_Start",&E5,1,spr$,dragblk%+8,dragblk%+24
"Wimp_DragBox",1,dragblk%
dragfromwin%=w%
dragfromline%=linenr%
str(s%)
i%,n$
s%?i% >= 32 : n$+=
(s%?i%) : i%+=1 :
trimleft(s$)
s$,p%,1)=" "
p%+=1
s$,p%)
upcase(s$)
i%=1
a%=
s$,i%,1))
(a%>=97)
(a%<=122)
s$,i%,1)=
(a%-32)
objtype(name$)
type%,loadaddr%
"OS_File",17,name$
type%,,loadaddr%
type%
(
((loadaddr%>>20)
&FFF)=&FFF
% type%=(loadaddr%>>8)
&FFF
type%=-1
$
leafname(file$),1)="!"
type%=&2000
type%=&1000
=type%
validaction(action%,window%,type%)
valid%
type%
&FF9
valid%=(action%=2)
7
osversion%>=300
valid%=valid%
(action%=4)
&FFA
( valid%=(action%=0)
(action%=6)
&1000
valid%=(action%=3)
&2000
action%
0,1 : valid%=
&
3 : valid%=(window%=1)
:
5 : valid%=(osversion%>=300)
(window%=1)
: valid%=
valid%=(action%=0)
=valid%
seticonstate(window%,icon%,eor%,clr%)
scrapblk%!0=window%
scrapblk%!4=icon%
scrapblk%!8=eor%
scrapblk%!12=clr%
"Wimp_SetIconState",,scrapblk%
selecticon(window%,icon%,f%)
scrapblk%!0=window%
scrapblk%!4=icon%
scrapblk%!8=1<<21
scrapblk%!8=0
scrapblk%!12=1<<21
"Wimp_SetIconState",,scrapblk%
menuselect(selection%)
adjust%,selinfo%,itemnr%,item%,item$,parentitem%,seq%,data%
"MenuUtil_Decode",lastmenu%,selection%
,adjust%,selinfo%
itemnr%=selinfo%!0
item%=selinfo%!8
item$=
str(selinfo%!12)
parentitem%=selinfo%!24
seq%=lastmenu_seq%
lastmenu_line%>=0
data%=appl%(seq%,lastmenu_line%)
item%
item_reread%
clearsequence(0)
clearsequence(1)
loadall
item_saveall%
saveall
item_savechoices%
choices_save
item_quit%
%
changed%(0)
changed%(1)
dialogue(6)
quit%=
item_display0%,item_display1%
item%=item_display0%
display%(seq%)=0
display%(seq%)=1
setextent(seq%)
openwindow(seq%,2)
redrawfromline(seq%,0)
item_openparent%
-
"Filer_OpenDir "+
dirname($(data%))
item_off%
data%!292=
(data%!292)
(
redrawline(seq%,lastmenu_line%)
setchanged(seq%,
item_delete%
(
deleteappl(seq%,lastmenu_line%)
lastmenu_line%=-1
item_args%
$(data%+296)=item$
(
redrawline(seq%,lastmenu_line%)
setchanged(seq%,
item_toroot%
% $(data%)=
striproot($(data%))
$(data%+256)="$"
(
redrawline(seq%,lastmenu_line%)
item_saveseq%
savesequence(seq%)
adjust%
showmenu(0,lastmenu%,lastmenu_seq%,lastmenu_line%)
*** procs for creating menus ***
showmenu(blkptr%,menu%,seq%,linenr%)
item$,b%,dy%
dy%=22
menu%
seqmenu%
,:
"MenuUtil_TickOnly",displaymenu%,display%(seq%)
-* item$=
msg_lookup0("IT_ITEM")+" '"
.-
linenr%>=nrapps%(seq%)
linenr%=-1
linenr%<0
0+
"MenuUtil_Fade",itemsubmenu%,1
1.
"MenuUtil_Colours",item_item%,2,0
2
3+
"MenuUtil_Fade",itemsubmenu%,0
4.
"MenuUtil_Colours",item_item%,7,0
5 b%=appl%(seq%,linenr%)
item$+=$(b%+256)
71
"MenuUtil_Text",item_args%,$(b%+292)
8I
"MenuUtil_Fade",item_toroot%,(b%!268<>&1000)
($(b%+256)="$")
9L
"MenuUtil_Fade",item_openparent%,(b%!268=&1000)
($(b%+256)="$")
::
"MenuUtil_Tick",item_argsmenu%,
($(b%+296))>0
;-
"MenuUtil_Tick",item_off%,b%!292
dy%+=44
=
item$+="'"
?+
"MenuUtil_Text",item_item%,item$
@ $(saveseq_dir%)=bootdir$
seq%=0
B! $(saveseq_leaf%)="!Run"
C
D' $(saveseq_leaf%)=seqfname$(1)
E
blkptr%<>0
blkptr%!4=blkptr%!4+dy%
lastmenu%=menu%
lastmenu_seq%=seq%
lastmenu_line%=linenr%
"MenuUtil_Show",lastmenu%,blkptr%
menu_add(text$,submenu%,genmsg%)
handle%
"MenuUtil_Add",,text$
handle%
submenu%<>-1
"MenuUtil_SubMenu",handle%,submenu%
genmsg%
"MenuUtil_Warning",handle%,1
=handle%
menu_addwritable(maxlen%,validstr%)
handle%
"MenuUtil_Add",,""
handle%
"MenuUtil_Writable",,1,maxlen%,validstr%
=handle%
initmenus
"MenuUtil_Initialise",010,0
"MenuUtil_New",,Appl$
mainmenu%
`<item_info%=
menu_add(
msg_lookup0("IT_INFO"),infowin%,0)
a8item_reread%=
menu_add(
msg_lookup0("IT_RERD"),-1,0)
b>item_fnames%=
menu_add(
msg_lookup0("IT_FNMS"),filewin%,1)
c9item_saveall%=
menu_add(
msg_lookup0("IT_SVAL"),-1,0)
"MenuUtil_Dots",0,1
e=item_savechoices%=
menu_add(
msg_lookup0("IT_SVCH"),-1,0)
f6item_quit%=
menu_add(
msg_lookup0("IT_QUIT"),-1,0)
"MenuUtil_New",,
msg_lookup0("IT_ARGS")
argsmenu%
h&item_args%=
menu_addwritable(64,0)
"MenuUtil_New",,
msg_lookup0("DISP")
displaymenu%
j8item_display0%=
menu_add(
msg_lookup0("DISP0"),-1,0)
k8item_display1%=
menu_add(
msg_lookup0("DISP1"),-1,0)
"MenuUtil_New",,
msg_lookup0("IT_ITEM")
itemsubmenu%
m4item_off%=
menu_add(
msg_lookup0("IT_OFF"),-1,0)
nAitem_argsmenu%=
menu_add(
msg_lookup0("IT_ARGS"),argsmenu%,0)
o<item_openparent%=
menu_add(
msg_lookup0("IT_OPAR"),-1,0)
p8item_toroot%=
menu_add(
msg_lookup0("IT_ROOT"),-1,0)
"MenuUtil_Dots",0,1
r7item_delete%=
menu_add(
msg_lookup0("IT_DEL"),-1,0)
"MenuUtil_New",,
msg_lookup0("IT_SEQ")
seqmenu%
t@item_display%=
menu_add(
msg_lookup0("DISP"),displaymenu%,0)
u+item_item%=
menu_add("",itemsubmenu%,0)
vBitem_saveseq%=
menu_add(
msg_lookup0("IT_SVSQ"),saveseqwin%,0)
lastmenu%=0
*** procs for handling messages in the Messages file ***
msg_init
fname$,flags%,size%,buf%
fname$=ApplPath$+"Messages"
"MessageTrans_FileInfo",,fname$
flags%,,size%
flags%
buf%=0
buf% size%
MsgDesc% 17+
(fname$)
$(MsgDesc%+16)=fname$
"MessageTrans_OpenFile",MsgDesc%,MsgDesc%+16,buf%
msg_exit
"MessageTrans_CloseFile",MsgDesc%
MsgDesc%=0
msg_lookup0(token$)
result%
"MessageTrans_Lookup",MsgDesc%,token$,0
,,result%
str(result%)
msg_lookup1(token$,param$)
result%
"MessageTrans_Lookup",MsgDesc%,token$,scrapblk%,&100,param$
,,result%
str(result%)
dialogue(no%)
cancelbutton%,text1$,text2$,text3$,beep%
beep%=
no%
' $dial_msg%=
msg_lookup0("NRMI")
! text2$=
msg_lookup0("OK")
beep%=
4 $dial_msg%=
msg_lookup1("CFBS",
seqfname(0))
! text2$=
msg_lookup0("OK")
4 $dial_msg%=
msg_lookup1("CFBS",
seqfname(1))
! text2$=
msg_lookup0("OK")
' $dial_msg%=
msg_lookup0("NTAG")
! text2$=
msg_lookup0("OK")
0 $dial_msg%=
msg_lookup1("CFBD",bootdir$)
! text2$=
msg_lookup0("OK")
' $dial_msg%=
msg_lookup0("QNYW")
# text1$=
msg_lookup0("QUIT")
# text3$=
msg_lookup0("CANC")
0 $dial_msg%=
msg_lookup1("NDIR",bootdir$)
! text2$=
msg_lookup0("OK")
dialogue_setbutton(1,text1$)
dialogue_setbutton(2,text2$)
dialogue_setbutton(3,text3$)
beep%
scrapblk%!0=dialogwin%
"Wimp_GetWindowState",,scrapblk%
"Wimp_CreateMenu",,dialogwin%,scrapblk%!4,scrapblk%!16
lastdialogue%=no%
dialogue_setbutton(no%,text$)
mask%
mask%=(1<<2)+(&FF<<24)
text$=""
make button invisible
seticonstate(dialogwin%,no%,&11<<24,mask%)
$(dial_text%(no%))=text$
seticonstate(dialogwin%,no%,dial_buttoncol%,mask%)
heap_init
>Heap%=
heap starts just after end of allocated memory
"OS_ReadMemMapInfo"
PageSize%
enlarge wimpslot (1 page) and create private heap in new memory
SlotSize%=Heap%-&8000
"Wimp_SlotSize",SlotSize%+PageSize%,-1
SlotSize%
HeapEnd%=SlotSize%+&8000
HeapEnd%<=Heap%
0,"Can't claim space for heap"
"OS_Heap",0,Heap%,,HeapEnd%-Heap%
heap_get(size%)
maxfree%,nrpages%,oldheapend%,ptr%
"OS_Heap",1,Heap%
,,maxfree%
size%>maxfree%
largest free block is too small - try to enlarge wimpslot and heap
C nrpages%=1+(size%
PageSize%) :
required # pages of memory
"Wimp_SlotSize",SlotSize%+nrpages%*PageSize%,-1
SlotSize%
oldheapend%=HeapEnd%
HeapEnd%=SlotSize%+&8000
"OS_Heap",5,Heap%,,HeapEnd%-oldheapend%
"OS_Heap",1,Heap%
,,maxfree% :
do we have enough now?
size%>maxfree%
complain(
msg_lookup0("NOHP"))
ptr%=-1
"OS_Heap",2,Heap%,,size%
,,ptr%
=ptr%
heap_release(ptr%)
maxfree%,nrpages%,flg%
"OS_Heap",3,Heap%,ptr%
"OS_Heap",1,Heap%
,,maxfree%
maxfree%>PageSize%
more than 1 page free - try to shrink heap (page by page)
, nrpages%=0 :
# pages of memory freed
1
"XOS_Heap",5,Heap%,,-PageSize%
;flg%
(flg%
1)=0
nrpages%+=1
(flg%
1)<>0
nrpages%>0
4
successfully shrunk heap - shrink WimpSlot
F
"Wimp_SlotSize",SlotSize%-nrpages%*PageSize%,-1
SlotSize%
HeapEnd%=SlotSize%+&8000
"OS_Heap",5,Heap%,,(HeapEnd%-Heap%)-Heap%!12
choices_load
(ApplDir$+".Choices")
F%=0
choices_default
#F%,makebackup%,display%(0),display%(1)
#F%,winxmin%(0),winymin%(0),winxmax%(0),winymax%(0)
#F%,winxmin%(1),winymin%(1),winxmax%(1),winymax%(1)
choices_save
(ApplDir$+".Choices")
F%<>0
#F%,makebackup%,display%(0),display%(1)
scrapblk%!0=winhdl%(0)
"Wimp_GetWindowState",,scrapblk%
winxmin%(0)=scrapblk%!4
winymin%(0)=scrapblk%!8
winxmax%(0)=scrapblk%!12
winymax%(0)=scrapblk%!16
#F%,winxmin%(0),winymin%(0),winxmax%(0),winymax%(0)
scrapblk%!0=winhdl%(1)
"Wimp_GetWindowState",,scrapblk%
winxmin%(1)=scrapblk%!4
winymin%(1)=scrapblk%!8
winxmax%(1)=scrapblk%!12
winymax%(1)=scrapblk%!16
#F%,winxmin%(1),winymin%(1),winxmax%(1),winymax%(1)
choices_default
display%(0)=0
display%(1)=0
makebackup%=
winxmin%(0)=2
winymin%(0)=824
winxmax%(0)=580
winymax%(0)=980
winxmin%(1)=660
winymin%(1)=824
winxmax%(1)=1238
winymax%(1)=980