home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 5
/
DATAFILE_PDCD5.iso
/
utilities
/
d
/
discopy
/
!Discopy
/
!RunImage
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1996-04-11
|
8KB
|
292 lines
>!Discopy.!RunImage
Copyright: Fractal Bonsai Software 1996
Author: Chris Whitworth
" @ ";
"<Discopy$Resources>.Library"
Local_NonWimpInit
Lib_ScriptLoad("<Discopy$Resources>.Task")
Lib_ScriptInt
Lib_ReportError(
Lib_Report("This is an unregistered copy of Discopy! Please see the Docs directory for details on registering.")
Local_WimpInit
Local_Poll
Lib_Report("This is an unregistered copy of Discopy! Please see the Docs directory for details on registering.")
Lib_CloseDown(task_handle%)
Initialisation procedures
-------------------------
Local_NonWimpInit
quit_menu_item=2
image_loaded=
license$="Unregistered"
"datestamp$="1.11d (06-Apr-96)"
"<Discopy$Resources>.!Config"
bufsize=
#A)*1024
ds=800*1024
discbuffer bufsize
Local_WimpInit
Lib_UpdateIconIndir(window(1),10,license$)
Lib_UpdateIconIndir(window(1),4,datestamp$)
Main polling routine
--------------------
Local_Poll
(1)*5*6000)
"Wimp_Poll",0,block%
event
event
"Wimp_OpenWindow",,block%
"Wimp_CloseWindow",,block%
Local_KeyPress
Local_MouseClick
Local_InitSave
Local_MenuSelect
17,18:
Local_MessageHandle(block%!16)
Lib_Report("This is an unregistered copy of Discopy! Please see the Docs directory for details on registering."):T=
(1)*5*6000)
quit
Local_KeyPress
;!char=block%!24:window=!block%
window
window(5):
char=13
Local_WriteImage
window(4):
char
@B
d_arrow,u_arrow:
"Wimp_GetCaretPosition",,waste_block%
A& icn=waste_block%!4:icn=icn
Bf
"Wimp_SetCaretPosition",!waste_block%,icn,waste_block%!8,waste_block%!12,waste_block%!16,-1
Menu handler
------------
Local_MenuSelect
"Wimp_GetPointerInfo",,waste_block%
button=waste_block%!8
x=!waste_block%
cur_menu
menu(1):
!block%
Q
quit_menu_item: quit=
button=1
Lib_ShowMenu(x,cur_menu)
Mouse clicked
-------------
Local_MouseClick
button=block%!8
window=block%!12
icon=block%!16
window
icon
i_bar_handle%:
b8
(button
(button
Local_BarSelect
c7
(button
Lib_ShowMenu(!block%,menu(1))
window(2)
icon
Local_ReadImage1
Local_WriteImage1
window(4)
icon
lB
Local_ReadImage($(
Lib_GetIconIndir(window(4),2))+
m;
(button
(button
Local_InitDrag
n
window(5)
icon
Local_WriteImage
window(6)
icon
1:ds=800*1024
2:ds=720*1024
3:ds=640*1024
Local_BarSelect
Lib_OpenWindow(window(2),256,192,256+288,192+96)
Lib_OpenWindow(window(3),150,640,150+874,640+204)
Message handler
---------------
Local_MessageHandle(message_id)
message_id
0:quit=
Local_ReadImage(
zerostr(block%+44))
Local_LoadFile
Message_DataLoad handler
------------------------
Local_LoadFile
block%!12=block%!8
to=block%!4
"Wimp_SendMessage",17,block%,to
Csize=block%!36:type=block%!40:current_name$=
zerostr(block%+44)
type<>&0A0
image_loaded=
(current_name$)
image_name$=
.image_name$=
image_name$,
(image_name$)-1)
)str$=image_name$+" ("+
(ds/1024)+"k)"
Lib_UpdateIconIndir(window(3),1,str$)
Initialise save (send Message_DataSave to Filer)
---------------
Local_InitSave
Lib_CheckDAS
"DragASprite_Stop"
"Wimp_GetPointerInfo",,waste_block%
x=!waste_block%
y=waste_block%!4
window=waste_block%!12
icon=waste_block%!16
size=800*1024
type=&0A0
.name$=$(
Lib_GetIconIndir(window(4),2))+
(name$)/4 <>
(name$)
name$+=
lenblock=44+
(name$)
!waste_block%=lenblock
waste_block%!12=0
waste_block%!16=1
waste_block%!20=window
waste_block%!24=icon
waste_block%!28=x
waste_block%!32=y
waste_block%!36=size
waste_block%!40=type
$(waste_block%+44)=name$
"Wimp_SendMessage",17,waste_block%,window
Initialise drag (assumed to be from save window)
---------------
Local_InitDrag
"Wimp_GetPointerInfo",,waste_block%
x=!waste_block%
y=waste_block%!4
Iwaste_block%!100=window(4):
"Wimp_GetWindowState",,waste_block%+100
1winmx=waste_block%!104:winmy=waste_block%!116
Zwaste_block%!100=window(4):waste_block%!104=3:
"Wimp_GetIconState",,waste_block%+100
=minxi=winmx+waste_block%!108:minyi=winmy+waste_block%!120
=maxxi=winmx+waste_block%!116:maxyi=winmy+waste_block%!112
)waste_block%!100=4:waste_block%!104=5
?waste_block%!108=11:waste_block%!112=12:waste_block%!116=-1
"OS_ReadVduVariables",waste_block%+100,waste_block%+100
-sx=(waste_block%!108)<<(waste_block%!100)
-sy=(waste_block%!112)<<(waste_block%!104)
Lib_CheckDAS
flags=%11000000
!r1=1:$waste_block%="file_0a0"
waste_block%!100=minxi
waste_block%!104=minyi
waste_block%!108=maxxi
waste_block%!112=maxyi
"DragASprite_Start",flags,r1,waste_block%,waste_block%+100
!waste_block%=window(4)
waste_block%!4=5
waste_block%!8=minxi
waste_block%!12=minyi
waste_block%!16=maxxi
waste_block%!20=maxyi
waste_block%!24=0
waste_block%!28=0
waste_block%!32=sx
waste_block%!36=sy
"Wimp_DragBox",,waste_block%
Read image part 1
----------
Local_ReadImage1
Lib_OpenWindow(window(4),512,512,512+276,512+272)
Read Image part 2
----------
Local_ReadImage(path$)
Lib_UpdateIconIndir(window(3),3,"Reading image...")
offset=0
file=
path$
bufs=bufsize:reading=
4image_name$=$(
Lib_GetIconIndir(window(4),4))+
#A,image_name$
"Hourglass_On"
bufs<bufsize
reading=
"ADFS_DiscOp",,1,offset,discbuffer,bufs
"OS_GBPB",2,file,discbuffer,bufs
offset+=bufs
bufs=ds-offset
bufs>bufsize
bufs=bufsize
"Hourglass_Percentage",(offset/ds)*100
reading
#file
"Settype "+path$+" 0A0"
"Hourglass_Off"
Lib_CloseWindow(window(4))
image_loaded=
current_name$=path$
Lib_UpdateIconIndir(window(3),1,image_name$)
Lib_UpdateIconIndir(window(3),3,"Idle")
Write image part 1
-----------
Local_WriteImage1
image_loaded=
Lib_Report("No image loaded"):
Lib_OpenWindow(window(5),512,512,512+362,512+180)
Write image part 2
-----------
Local_WriteImage
&adr=
Lib_GetIconIndir(window(5),1)
images=
($adr)
a=1
images
Lib_UpdateIconIndir(window(3),3,"Inserting disc "+
a+" of "+
images)
Lib_Report("Please insert disc "+
a+" of "+
images)
"Wimp_Poll",0,block%
event
Lib_UpdateIconIndir(window(3),3,"Writing image: Disc "+
a+" of "+
images)
offset=0
file=
current_name$
dummy$=
size=
bufs=bufsize:reading=
"Hourglass_On"
bufs<bufsize
reading=
"OS_GBPB",4,file,discbuffer,bufs
"ADFS_DiscOp",,2,offset,discbuffer,bufs
offset+=bufs
bufs=size-offset
bufs>bufsize
bufs=bufsize
"Hourglass_Percentage",(offset/size)*100
reading
#file
"OS_CLI","ADFS"
"OS_CLI","Dismount 0"
"Hourglass_Off"
Lib_CloseWindow(window(5))
Lib_UpdateIconIndir(window(3),3,"Idle")