home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 2
/
DATAFILE_PDCD2.iso
/
utilities
/
_resource
/
!Resource
/
!RunImage
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1994-06-12
|
36KB
|
1,394 lines
>!RunImage
"ERROR "+
$+" at line "+
Set up variables and dimming memory.
====================================
CFirst=
:Quit%=
:Run%=
:MaxFiles=99:SP=1:ScanItems%=0:ILen=&1000
ISfname$="":ExName$="":ViewFile$="":FType$="":Virtual%=0:DragASprite=0
GTaskN$="Resource Write":Ticked=0:Mod%=
:Cur%=1:Mul$="":Debugging%=0
KModName$="ResourceFiles":View=1:Total=1:Multiple%=0:Next%=0:FileOpen%=0
Block%1024,Block2% 512,Window% &1000,Ind% ILen,FListMenu &1000,Font% 256
Menu% 400,Object$(MaxFiles),Positioned$(MaxFiles),ScanName$(MaxFiles)
ScanPos$(99),ObType%(MaxFiles),ScanLen%(99),ScanType%(99):Free=Ind%
Scale% 32,Trans% 32:Verbose%=
:ModSave$="Module":FailDrag%=
Clear the font memory and start messagetrans file.
==================================================
X=0
256:Font%?X=0:
StartMessage
Now here's the clever bit, I'm calculating how much memory
I've used so I can reduce the wimpslot to the minimum.
===========================================================
"OS_ReadMemMapInfo"
PageSize%:Size%=
:Size%+=8*1024
;Temp=Size%
PageSize%:Size%=Size%
PageSize%:Size%+=1
Temp>(PageSize%/2)
Size%+=1
CSize%=Size%*PageSize%:
=&8000+Size%:
"Wimp_SlotSize",Size%,-1
$OSize%=Size%:Address=Size%+&8000
Error(1,
$+" at line "+
Start the task and kill any other active version of this program.
=================================================================
Block%!0=0
"Wimp_Initialise",310,&4B534154,TaskN$,Block%
WimpVer,THandle%
Kill(TaskN$)
Open the template file and load the windows.
============================================
"Wimp_OpenTemplate",,"<Resource$Dir>.Templates"
!;Main%=
CreateWindow("Main"):File%=
CreateWindow("File")
";Save%=
CreateWindow("Save"):Info%=
CreateWindow("Info")
#IFileInfo%=
CreateWindow("FileInfo"):Choices%=
CreateWindow("Choices")
$EPane%=
CreateWindow("Pane"):Operation%=
CreateWindow("Operation")
Debugging%
Debug%=
CreateWindow("Debug")
"Wimp_CloseTemplate"
Set up the menu, iconbar and blank all the text icons.
======================================================
SetUpMenu(Menu%):
DisplayText:First=
IconBar:
Blank
Icon%=2
IconText(Operation%,Icon%,""):
"Font_FindFont",,"Homerton.Medium",12*16,12*16
FileLHandle%
,FTe=FileLHandle%:
Font%?Te=0
Font%?Te+=1
"Font_LoseFont",Te
Read in the choices and select the pane window accordingly.
===========================================================
Choices("<Resource$Dir>.Choices"):
Select(Pane%,1,Run%)
Select(Pane%,0,Multiple%):
IconText(Pane%,3,Mul$)
Select(Pane%,8,Virtual%)
Debugging%
34Block%!0=Debug%:
"Wimp_GetWindowState",,Block%
"Wimp_OpenWindow",,Block%
Error(2,
$+" at line "+
Right here we go and poll.
==========================
"Wimp_Poll",1,Block%
Reason%
Reason%
Redraw
OpeningWindow
ClosingWindow
Button
DragBoxSave
Keyboard(Block%!24)
MenuSelect
17,18:
Receive
Quit%
Lose all the fonts and close the messagetrans file.
===================================================
L=0
255:Y=Font%?L:
Y>0:
"Font_LoseFont",L:Y-=1:
"Font_LoseFont",Ifhandle%:
"MessageTrans_CloseFile",Filedesc%
ClosingWindow
Block%!0
Main%:
"Wimp_CloseWindow",,Block%:Block%!0=File%
Choices%:
"Wimp_CloseWindow",,Block%:Block%!0=Pane%
"Wimp_CloseWindow",,Block%
OpeningWindow
As I'm using a pane I need to reposition the pane on top of my
choices window. To make it easier I'm using two different
Block%.
==============================================================
Block%!0
Choices%
]Mminx=Block%!4:miny=Block%!8:maxx=Block%!12:maxy=Block%!16:Block2%!0=Pane%
"Wimp_GetWindowState",,Block2%:lx=Block2%!12-Block2%!4
_Ely=Block2%!16-Block2%!8:Block2%!4=minx+26:Block2%!12=Block2%!4+lx
`CBlock2%!16=maxy-24:Block2%!8=Block2%!16-ly:Block2%!28=Block%!28
"Wimp_OpenWindow",,Block2%:Block%!28=Pane%
"Wimp_OpenWindow",,Block%
IconBar
h@!Block%=-5:Block%!4=0:Block%!8=-16:Block%!12=80:Block%!16=82
"Font_FindFont",,"Homerton.Medium",12*16,12*16
Ifhandle%
j4Block%!20=(Ifhandle%<<24)+%11000100001011+(1<<6)
IconSpr% 14,IconText% 14
lF$IconSpr%="sromapps;F17"+
0:$IconText%="Write":Block%!24=IconText%
m"Block%!28=IconSpr%:Block%!32=1
Prioritised to be just right of Apps Icon.
==========================================
"Wimp_CreateIcon",&45000000,Block%
BarIcon%
DragEnd
When a drag has finished, close the window and replace the sprite
=================================================================
WindowDrag%
File%:Block2%!0=WindowDrag%:
"Wimp_CloseWindow",,Block2%
Save%:
DestWindow%
Save%,Main%,File%,Choices%,Pane%,Choices%,Operation%,FileInfo%,Menu%
z0FailDrag%=
PROCIconText(Save%,1,ModSave$)
Block2%!0=Save%:
"Wimp_CloseWindow",,Block2%
~MBlock2%!0=WindowDrag%:Block2%!4=IconDrag%:
"Wimp_GetIconState",,Block2%
ValidText(WindowDrag%,IconDrag%,TextDrag$)
CreateWindow(WName$)
Handle%
"Wimp_LoadTemplate",,Window%,Free,Ind%+ILen,Font%,WName$
,,Free
"Wimp_CreateWindow",,Window%
Handle%
=Handle%
DragBoxSave
"Wimp_GetPointerInfo",,Block%:DestWindow%=Block%!12
+Block%!20=Block%!12:Block%!24=Block%!16
MBlock%!28=Block%!0:Block%!32=Block%!4:Block%!36=0:Block%!0=64:Block%!12=0
8Block%!16=1:Block%!40=FType%:$(Block%+44)=Sfname$+
Replace the sprite and close the window.
========================================
DragEnd
FailDrag%=
"Wimp_SendMessage",18,Block%,Block%!20,Block%!24
FailDrag%=
Receive
Block%!16
0:Quit%=
DataSaveAck
DataLoad
&502:
&40040:
NetMessage
&400C1:
ModeChange
&400CC:
Iconising
DataSaveAck
DragASprite
"DragASprite_Stop"
DestName$=
Strip(Block%+44)
DraggingWindow%
File%:
DataSave_File
Save%:
DataSave_Save
FileInfo%:
DataSave_FileInfo
Pane%:
DataSave_Pane
DataSave_File:
A:A=0:A$=DestName$
A$,9)="Resources"
A$,"."):A=
A$,"."):A$=
A$-A):
Mod%
"Change%=(Positioned$(Cur%)="")
DestName$,A$):DestName$=
DestName$,A-2)
?Positioned$(Cur%)=DestName$:
Change%
Next%+=1:Cur%=Next%
DestName$,A$):DestName$=
DestName$,A-2)
6Positioned$(Next%+1)=DestName$:Next%+=1:Cur%=Next%
=Block%!0=File%:
"Wimp_CloseWindow",,Block%:
DisplayText
Mod%
Mod%=
DataSave_Save
DestName$,9)="Resources"
;TotalLen=0:
f=1
Next%:TotalLen+=
Count(Object$(f)):
TotalLen+=16*1024
@Temp=TotalLen
PageSize%:Slot=TotalLen
PageSize%:Slot+=1:
Temp>(PageSize%/2)
PageSize%+=1
ASlot=Slot*PageSize%:
"Wimp_SlotSize",Size%+Slot,-1
NSize%
NSize%=Size%
Dialogue(1234,"Not enough memory, I need "+
Slot/1024+"k free",1,""):
"Wimp_CreateMenu",-1:
MakeMod:
"Wimp_SlotSize",Size%,-1
NSize%
Size%<>NSize%
Dialogue(1234,"Not been able to free memory",1,"")
"Wimp_CreateMenu",-1
DestName$="<Wimp$Scrap>"
HBlock%!16=3:Block%!36=Size%:
"Wimp_SendMessage",18,Block%,Block%!4
IconText(Save%,1,DestName$)
ModSave$=DestName$
DataSave_FileInfo
Number,A$
DestName$,9)="Resources"
Verbose%
IconText(Operation%,2,"Retrieve")
A$=DestName$
IconDrag%
Verbose%
IconText(Operation%,4,"Retrieving single file")
IconText(Operation%,3,
Right(ScanName$(SP)))
Retrieve(SP)
DestName$="<Wimp$Scrap>"
HBlock%!16=3:Block%!36=Size%:
"Wimp_SendMessage",18,Block%,Block%!4
Verbose%
IconText(Operation%,4,"Retrieving all files")
DestName$<>"<Wimp$Scrap>"
Number=1
ScanItems%
Verbose%
IconText(Operation%,3,
Right(ScanName$(Number)))
CreateDirectorys(A$+ScanPos$(Number))
7DestName$=A$+ScanPos$(Number)+"."+ScanName$(Number)
Retrieve(Number)
CreateDirectorys(A$)
Path$,B$,A
B$=""
A$,"."):Path$=
A$,A):A$=
A$-A)
A$,".")
A<>0
"CDir "+Path$+B$+
A$,A-1)
B$=B$+
A$,A-1)+".":
A$-A)
A$,".")
"CDir "+Path$+B$+
A$,A-1)
Retrieve(Number)
x,N,B$,Name$,Loc,Off,A,B,Finish%:Loc=0:Finish%=
FileOpen%=
(DestName$):X=
ExName$
#X=StartOfData:
"Hourglass_On"
:Ptr%=
GetWord:
Ptr%<>0
#X+Ptr%-4:Load=
GetWord:Exec=
GetWord:Len=
GetWord:Acc=
GetWord
&B$="":A=
A<>0:B$+=
*Name$=
Right(B$):Loc+=1:
Loc=Number
#X:[OPT 0:ALIGN:]:
#X=P%
%Len2=
GetWord:
ClaimSlot(Len)
"OS_GBPB",4,X,Address,Len
"OS_GBPB",2,N,Address,Len:Finish%=
'Off=1:
Off<>Len+1:
#X:Off+=1
"Hourglass_Percentage",100*(Off/Len)
:Finish%=
"Wimp_SlotSize",Size%,-1
Loc>=Number
Finish%=
Finish%:
#N:FileOpen%=
"Settype "+DestName$+" "+
~(ScanType%(Number))
"Hourglass_Off"
ClaimSlot(Extra)
OK%,A$,X:X=Extra
A$="":A$=STR$(X MOD 1024)+" Bytes.":X=X DIV 1024
A$=STR$(X MOD 1024)+"K "+A$:X=X DIV 1024
A$=STR$