home *** CD-ROM | disk | FTP | other *** search
RISC OS BBC BASIC V Source | 1994-02-12 | 16.4 KB | 757 lines |
- DiscLook II 1.00
- (c) 1993 RJ Developments
- By Ian Clark
- $+" at line "+
- quit%=
- Error
- quit%=
- noquit%=
- "WimpExt_CloseDown",id%
- "XOS_Module",7,,msg%
- "Wimp_CloseDown"
- ON ERROR LOCAL SYS"WimpExt_CloseDown",id%:SYS"Wimp_CloseDown",id%,&4B534154:RUN
- "Hourglass_On"
- ,msgpath$="<Disc$Dir>.Resources.Messages"
- "MessageTrans_FileInfo",,msgpath$
- ,,msgsize%
- "OS_Module",6,,,20+
- msgpath$
- ,,msg%
- .$(msg%+16)="<Disc$Dir>.Resources.Messages"
- msblk% msgsize%
- "MessageTrans_OpenFile",msg%,msg%+16,msblk%
- block% 800
- buffer% 4
- handles% 8
- indirected% 238
- ok% 32
- qui% 32
- ibtxt% 50
- ibsp% 255
- imm% 32
- prefs% 32
- bkprefs% 30
- mount%=
- curfs$="ADFS"
- actfs$="ADFS"
- menhelp%=
- noquit%=
- nohd%=
- cfs%=
- cfs$=""
- fstick%=1
- drive%=0
- drm%=0
- 0 on%=
- ?prefs%=1
- prefs%?1=1
- prefs%?2=0
- prefs%?3=1
- prefs%?4=1
- $(prefs%+8)="1234"+
- $(prefs%+20)="1234"+
- 8%$qui%="Quit"+
- 0+"Cancel"+
- $ok%="OK"+
- :#$imm%="OK"+
- 0+"Cancel"+
- ;d$ibsp%="sFloppyLook;whThe Disc Look II icon.|mA RJ Developments program.|mCode
- 1993 Ian Clark."
- shutdown%=
- running%=
- task%=
- open%=
- toquit%=
- password%=0
- correct%=0
- C<!block%=&502:block%!4=&400C0:block%!8=&43B00:block%!12=0
- "Wimp_Initialise",310,&4B534154,"Disc Look II",block%
- ver%,id%
- ver%<310
- 0,"Disc Look II needs Risc OS 3.10 or later"
- "WimpExt_Initialise",14,id%,%010010010
- ver%
- ver%<195
- 0,"Disc Look II needs Wimp Extentions 1.95 or later. (There is a copy inside the !DMen directory.)"
- "OS_File",13,"<Disc$Dir>.Resources.Sprites"
- ,,,,size%
- size%+=4:
- sprite% size%
- !sprite%=size%:sprite%!8=16
- "OS_SpriteOp",&209,sprite%
- "OS_SpriteOp",&20A,sprite%,"<Disc$Dir>.Resources.Sprites"
- x%=0
- handles%!x%=%101:
- "WimpExt_LoadTemplates",handles%,block%,indirected%,indirected%+238,-1,"<Disc$Dir>.Resources.Templates",sprite%
- P8infow%=!handles%:titlew%=handles%!4:curw%=handles%!8
- "WimpExt_SetIconString",,,titlew%,5,"1.00"
- "WimpExt_OpenWindowTop",titlew%
- "WimpExt_PrePoll"
- "Wimp_Poll",0,block%
- code%
- "WimpExt_Action",id%,block%,code%
- code%
- code%
- 1 :
- "WimpExt_AutoRedraw",,block%
- 2 :
- "Wimp_OpenWindow",,block%
- 3 :
- "Wimp_CloseWindow",,block%
- code%=0
- "WimpExt_SetIconString",,,infow%,3,"
- 1993 Ian Clark ("+
- Gm("Date")+")"
- "WimpExt_SetIconString",,,infow%,0,
- Gm("Ver")
- GetFSs
- "ADFS_Drives"
- ,flop%,hard%
- Drivemenu(flop%,hard%)
- d0curfs$=
- String(devicem%+16+(24*(fstick%+1)))
- !block%=titlew%
- "Wimp_CloseWindow",,block%
- Ibtxt
- h on%=
- x%=END
- PROCImm("Disc Look 2 is currently using "+STR$x%+" bytes, that's "+STR$(INT(x%/1024))+"K")
- "Hourglass_Off"
- title$
- title$=
- Gm("MT01")
- barmenu% 28+(24*6)
- actm% 28+(24*6)
- formatm% 28+(24*6)
- otherformatm% 28+(24*6)
- $barmenu%=title$
- width%=(
- title$-1)*16
- barmenu%?12=7
- barmenu%?13=2
- barmenu%?14=7
- barmenu%?15=0
- barmenu%!20=44
- barmenu%!24=0
- The procedure below adds a single item to a menu.
- Item Text Flag Item Menu Submenu Pointer
- | | | | |
- \ / \/\/ \ / \ /
- Additem(
- Gm("MI00"),2,1,barmenu%,infow%)
- Additem(
- Gm("MI01"),0,2,barmenu%,devicem%)
- Additem(
- Gm("MI02"),8,3,barmenu%,drivem%)
- Additem(
- Gm("MI03"),0,4,barmenu%,actm%)
- Additem(
- Gm("MI04"),2,5,barmenu%,-1)
- Additem(
- Gm("MI05"),&80,6,barmenu%,-1)
- barmenu%!16=width%
- title$=
- Gm("MT04")
- $actm%=title$
- width%=(
- title$-1)*16
- actm%?12=7
- actm%?13=2
- actm%?14=7
- actm%?15=0
- actm%!20=44
- actm%!24=0
- Additem(
- Gm("MI40"),0,1,actm%,-1)
- Additem(
- Gm("MI41"),0,2,actm%,-1)
- Additem(
- Gm("MI42"),0,3,actm%,formatm%)
- Additem(
- Gm("MI43"),0,4,actm%,-1)
- Additem(
- Gm("MI44"),0,5,actm%,-1)
- Additem(
- Gm("MI45"),&80,6,actm%,-1)
- actm%!16=width%
- title$=
- Gm("MT05")
- $formatm%=title$
- width%=(
- title$-1)*16
- formatm%?12=7
- formatm%?13=2
- formatm%?14=7
- formatm%?15=0
- formatm%!20=44
- formatm%!24=0
- Additem(
- Gm("MI55"),8,1,formatm%,curw%)
- Additem(
- Gm("MI50"),0,2,formatm%,-1)
- Additem(
- Gm("MI51"),0,3,formatm%,-1)
- Additem(
- Gm("MI52"),0,4,formatm%,-1)
- Additem(
- Gm("MI53"),0,5,formatm%,-1)
- Additem(
- Gm("MI54"),&80,6,formatm%,otherformatm%)
- formatm%!16=width%
- title$=
- Gm("MT05")
- $otherformatm%=title$
- width%=(
- title$-1)*16
- otherformatm%?12=7
- otherformatm%?13=2
- otherformatm%?14=7
- otherformatm%?15=0
- otherformatm%!20=44
- otherformatm%!24=0
- Additem(
- Gm("MI60"),0,1,otherformatm%,-1)
- Additem(
- Gm("MI61"),0,2,otherformatm%,-1)
- Additem(
- Gm("MI62"),0,3,otherformatm%,-1)
- Additem(
- Gm("MI63"),0,4,otherformatm%,-1)
- Additem(
- Gm("MI64"),0,5,otherformatm%,-1)
- Additem(
- Gm("MI65"),&80,6,otherformatm%,-1)
- otherformatm%!16=width%
- Imm(text$)
- Errbox(
- Gm("MS01"),text$,1)
- Errbox(title$,text$,bflag%)
- bt%,pressed%
- bflag%
- 1 : bt%=ok%
- 2 : bt%=imm%
- 3 : bt%=qui%
- : bt%=ok%
- "WimpExt_ControlImmediate",,2,title$,text$,bt%,1
- pressed%
- =pressed%
- Decodemenu
- buffer%
- buffer% 512
- "Wimp_DecodeMenu",,menu%,block%,buffer%
- menu%
- barmenu% :
- $buffer%
- Gm("MI05") : quit%=
- Gm("MI00") :
- Gm("MS02"))
- Gm("MI04") :
- FSWarn
- Gm("MI01")+".CFS#+" :
- SwapCFS
- Gm("MI03")+"."+
- Gm("MI41") :
- Dismount
- Gm("MI03")+"."+
- Gm("MI44") :
- Verify
- Gm("MI03")+"."+
- Gm("MI45") :
- Showfree
- !block%=3
- block%!4=2
- block%!8<>-1
- Format(block%!8,block%!12)
- $buffer%,
- Gm("MI01"))+1)=
- Gm("MI01")+"."
- NewFS($buffer%)
- $buffer%,
- Gm("MI02"))+1)=
- Gm("MI02")+"."
- Newdrive($buffer%)
- Additem(item$,flag%,item%,menu%,submenu%)
- item$>12
- Gm1("ER00",item$)
- item$+1)*16>width%
- width%=(
- item$+1)*16
- P%=menu%+28+(24*(item%-1))
- OPT 0
- EQUD flag%
- EQUD submenu%
- EQUD &7000021
- !EQUS item$+
- item$-1),
- Error
- 67795 :
- Imm("Drive '"+curfs$+" "+
- drive%+"' is empty!"):
- 67756 :
- Imm("Bad drive regarding '"+curfs$+" "+
- drive%+"'!"):
- }bt%=
- Errbox("Error "+
- +" from Disc Look II","Error: '"+
- $+"' - Internal error code "+
- +", "+
- +". What should I do?",3)
- bt%
- 0 :
- "WimpExt_CloseDown",id%:
- "Wimp_CloseDown":
- quit%
- noquit%
- "WimpExt_PrePoll"
- "Wimp_Poll",0,block%
- code%
- "WimpExt_Action",id%,block%,code%
- code%
- code%
- 1 :
- "WimpExt_AutoRedraw",,block%
- 2 :
- "Wimp_OpenWindow",,block%
- 3 :
- "Wimp_CloseWindow",,block%
- 6 :
- Click(block%!8,block%!12,block%!16,!block%,block%!4)
- 8 :
- Processkey
- 9 :
- Decodemenu
- 17,18 :
- Receive
- Exists(path$)
- "OS_File",17,path$
- found%
- found%=0 =
- Click(b%,w%,i%,x%,y%)
- -2 :
- $
- baricon% :
- n
- 2 : menu%=barmenu%:
- "WimpExt_CreateMenu",,barmenu%,x%-64,96+(44*6)+(24*2)
- /
- 4 :
- Opendir
- !
-
- infow% :
- 3 :
- Gm("IW03"))
- 4 :
- Gm("IW02"))
- String(pointertostring%)
- ?pointertostring%>25
- tx$<255
- $1tx$+=
- (?pointertostring%):pointertostring%+=1
- Receive
- block%!16
- 0 : quit%=
- WHEN 3 : CASE block%!40 OF
- WHEN &FFF : PROCReadtextfile(FNString(block%+44))
- ENDCASE
- &502 :
- block%!32
- /&
- infow% :
- Infohelp
- 03
- Menuhelp(block%!32,block%!36)
-
- &400C0 :
- block%!20=curw%
- Currentform
- Drivewarn
- &43B00 :
- String(block%+20),8)="DiscLook"
- Extcommand(
- String(block%+20),9))
- Sendhelp(help$)
- "WimpExt_SendHelp",help$,block%
- Menuhelp(w%,i%)
- menuhelp%
- menuhelp% 512
- menhelp%
- w%=barmenu%
- i%=3
- "Wimp_GetMenuState",0,menuhelp%
- !menuhelp%
- -1 :
- Sendhelp("Ohh! Your sooooooo good with that mouse!!")
- 0 :
- Sendhelp("This option leads to a standard info box.")
- 1 :
- menuhelp%!4
- -1 :
- Sendhelp("Move right to select a filing system")
- 0 :
- cfs%
- Sendhelp("Click here to turn CFS off.")
- Sendhelp("Click here to turn CFS on.")
- Sendhelp("Click here to select this as the current filing system.")
- 4 :
- Sendhelp("Click here to re-calculate the device menu, usefull if any filing systems have started up since the program was loaded, eg the RAM filer.")
- Ibtxt
- drive$
- drive%<>-1 drive$=":"+
- drive%
- drive$="$"
- R text$=cfs$+actfs$+":"+drive$
- $ibtxt%=text$
- width%
- ($ibtxt%)*16>100
- width%=
- ($ibtxt%)*16
- width%=100
- on% !block%=-7:block%!4=baricon%:
- "Wimp_DeleteIcon",,block%
- !block%=-6
- block%!4=0
- block%!8=-16
- block%!12=width%
- block%!16=90
- block%!20=&1700310B
- block%!24=ibtxt%
- block%!28=ibsp%
- block%!32=50
- "Wimp_CreateIcon",251658240,block%
- baricon%
- a on%=
- "WimpExt_PrePoll":
- "Wimp_Poll",0,block%
- code%:
- "WimpExt_Action",id%,block%,code%
- code%
- code%=1
- "WimpExt_AutoRedraw",,block%
- code%=0
- Opendir
- drive$
- drive%=-1 drive$="$"
- drive$=
- drive%
- discname$=""
- CheckSWI(curfs$+"_DescribeDisc")
- curfs$+"_DescribeDisc",":"+drive$,block%
- n$discname$=":"+
- String(block%+22)
- discname$,1))<=32
- discname$=
- discname$)
- discname$+=".$"
- discname$="$"
- SYS"Wimp_StartTask",actfs$+":Mount "+STR$drive%
- "XOS_CLI","Filer_OpenDir "+cfs$+actfs$+":"+discname$
- GetFSs
- This is the proc which gets the current devices.
- fs$=""
- x%=1
- fs$+=
- Getfsname(x%)+","
- fs$,2)=",," fs$=
- title$=
- Gm("MT02")
- it%=-1
- x%=0
- fs$,x%,1)=","
- it%+=1
- devicem% 28+(24*(it%+2))
- $devicem%=title$
- width%=(
- title$-1)*16
- devicem%?12=7
- devicem%?13=2
- devicem%?14=7
- devicem%?15=0
- devicem%!20=44
- devicem%!24=0
- The procedure below adds a single item to a menu.
- Item Text Flag Item Menu Submenu Pointer
- | | | | |
- \ / \/\/ \ / \ /
- Additem("CFS#+",2,1,devicem%,-1)
- x%=1
- pos%=
- fs$,2),",")
- fs$,2,pos%-1)
- x%<>it% fl%=0
- fl%=&80
- Additem(it$,fl%,x%+1,devicem%,-1)
- fs$,pos%+1)
- devicem%!16=width%
- Modexist("CFSModule")
- "WimpExt_ShadeEntry",,devicem%,0,1
- cfs%=
- cfs$=""
- "WimpExt_ShadeEntry",,devicem%,0,0
- fstick%>it%
- fstick%=it%
- cfs% tk%=1
- tk%=0
- "WimpExt_TickEntry",,devicem%,0,tk%
- "WimpExt_TickEntry",,devicem%,fstick%,1
- Getfsname(num%)
- name$,name%
- "XOS_FSControl",33,num%,block%,12
- ,,name%
- ?name%
- name$=
- String(name%)
- name$
- "null","printer","serial","vdu","rawvdu","kbd","rawkbd","deskfs","msdos","netprint","pipe","Pipe","devices","CFS" : name$=""
- name$=""
- =name$
- FSWarn
- GetFSs
- "WimpExt_CreateMenu",,-1
- SwapCFS
- cfs%
- cfs%=
- cfs%=
- cfs%
- cfs$="CFS#"
- cfs$=""
- cfs% tk%=1
- tk%=0
- "WimpExt_TickEntry",,devicem%,0,tk%
- Ibtxt
- NewFS(item$)
- fs$,dr%,tick%
- item$="Device.CFS#+"
- !block%<>1
- tick%=block%!4
- +fs$=
- String(devicem%+16+(24*(tick%+1)))
- actfs$=fs$
- fs$="RAM" fs$="RamFS"
- CheckSWI(fs$+"_Drives")
- dr%=
- fs$,2)="fs"
- 9 fs$=
- fs$-2)+"FS":dr%=
- CheckSWI(fs$+"_Drives")
- fs$,2)="FS"
- 5 fs$=
- fs$-2):dr%=
- CheckSWI(fs$+"_Drives")
-
-
- fs$,2)<>"fs"
- / fs$+="FS":dr%=
- CheckSWI(fs$+"_Drives")
-
-
- fs$,2)<>"FS"
- 0 fs$+="FS":dr%=
- CheckSWI(fs$+"_Drives")
-
-
-
- dr%
- fs$+"_Drives"
- ,flop%,hard%
- nohd% hard%=0
- flop%+hard%=0
- drive%=-1:drm$=-1:
- flop%=0
- drive%=4:drm%=0
- drive%=0:drm%=0
- drive%=-1
- flop%=0:hard%=0
- curfs$=fs$
- "WimpExt_TickEntry",,devicem%,fstick%,0
- fstick%=tick%
- "WimpExt_TickEntry",,devicem%,fstick%,1
- Ibtxt
- CheckSWI(swi$)
- "XOS_SWINumberFromString",,swi$
- ;error%
- =((error%
- 1)=0)
- Drivemenu(flop%,hard%)
- menhelp%=
- it%,flag%,count%
- title$=
- Gm("MT03")
- flop%+hard%=0
- it%=1
- it%=flop%+hard%
- drivem% 28+(24*it%)
- $drivem%=title$
- width%=(
- title$-1)*16
- drivem%?12=7
- drivem%?13=2
- drivem%?14=7
- drivem%?15=0
- drivem%!20=44
- drivem%!24=0
- flop%+hard%=0
- Additem("<None>",&80,1,drivem%,-1):drivem%!16=width%:
- "WimpExt_ShadeEntry",,drivem%,0,1:
- count%=1
- flop%>0
- x%=1
- flop%
- x%=flop%
- hard%=0
- flag%=&80
- flag%=2
- flag%=0
- Additem("Drive "+
- (x%-1),flag%,count%,drivem%,-1)
- count%+=1
- hard%>0
- x%=1
- hard%
- x%=hard%
- flag%=&80
- flag%=0
- Additem("Drive "+
- (3+x%),flag%,count%,drivem%,-1)
- count%+=1
- drivem%!16=width%
- drm%>-1
- "WimpExt_TickEntry",,drivem%,drm%,1
- menhelp%=
- Drivewarn
- menhelp%=
- nohd% thd%=0
- thd%=hard%
- Drivemenu(flop%,thd%)
- "Wimp_CreateSubMenu",,drivem%,block%!24,block%!28
- menhelp%=
- Modexist(name$)
- "XOS_Module",18,name$
- ;error%
- =((error%
- 1)=0)
- Newdrive(item$)
- drm%=block%!4
- drive%=
- item$))
- Ibtxt
- Infohelp
- block%!36<7
- Sendhelp(
- Gm("IW00")):
- Sendhelp(
- Gm("IW01"))
- Gm(tok$)
- p1$=""
- Gm1(tok$,p1$)
- p2$=""
- Gm2(tok$,p1$,p2$)
- Imm("Couldn't find message token: '"+tok$+"' parm 1: '"+p1$+"' parm 2: '"+p2$+"'"):="---- Fatal Error ----"
- "MessageTrans_Lookup",msg%,tok$,msblk%,msgsize%,p1$,p2$
- String(msblk%)
- Dismount
- drive%=-1
- Gm1("ER01",actfs$)):
- "XWimp_StartTask",actfs$+":Dismount "+
- drive%
- "XWimp_StartTask","Filer_CloseDir CFS#"+actfs$+"::"+
- drive%
- Showfree
- drive%=-1
- actfs$="Mem"
- "XWimp_StartTask","Mem:Free":
- Gm1("ER01",actfs$)):
- "XWimp_StartTask","ShowFree -FS "+actfs$+" "+
- drive%
- Format(fo%,ofo%)
- actfs$<>"ADFS"
- Gm1("ER01",actfs$)):
- drive%>3
- Gm("ER02"):
- fo%
- 0 :
- "XWimp_StartTask","ADFS:Format "+
- drive%+" F"
- 1 :
- "XWimp_StartTask","ADFS:Format "+
- drive%+" E"
- 2 :
- "XWimp_StartTask","ADFS:Format "+
- drive%+" D"
- 3 :
- "XWimp_StartTask","ADFS:Format "+
- drive%+" L"
- 4 :
- ofo%
- S@
- 0 :
- "XWimp_StartTask","ADFS:Format "+
- drive%+" DOS/Q"
- T@
- 1 :
- "XWimp_StartTask","ADFS:Format "+
- drive%+" DOS/M"
- U@
- 2 :
- "XWimp_StartTask","ADFS:Format "+
- drive%+" DOS/H"
- V@
- 3 :
- "XWimp_StartTask","ADFS:Format "+
- drive%+" DOS/N"
- WB
- 4 :
- "XWimp_StartTask","ADFS:Format "+
- drive%+" Atari/M"
- XB
- 5 :
- "XWimp_StartTask","ADFS:Format "+
- drive%+" Atari/N"
- Verify
- drive%=-1
- Gm1("ER01",actfs$)):
- "XWimp_StartTask",actfs$+":Verify "+
- drive%
- Extcommand(com$)
- com$))<33
- com$=
- com$,2)
- WHILE ASC(RIGHT$(com$))<33
- com$=LEFT$(com$,LENcom$-1)
- ENDWHILE
- com$
- "-Quit" : quit%=
- "-ShadeQuit" : noquit%=
- "-UnshadeQuit" : noquit%=
- "-NoHD" : nohd%=
- drive%>3
- drive%=0:
- Ibtxt
- "-HD" : nohd%=
- Currentform
- ptr%
- CheckSWI(curfs$+"_DescribeDisc")
- "WimpExt_SetIconString",,,curw%,1,
- Gm("MS03")
- "Wimp_CreateSubMenu",,block%!20,block%!24,block%!28
- ptr%=block%+32
- curfs$+"_DescribeDisc",
- drive%,ptr%
- "WimpExt_SetIconString",,,curw%,1,
- String(ptr%+22)
- "WimpExt_SetIconString",,,curw%,5,
- (ptr%!16/1024)+"K"
- "WimpExt_SetNumberIcon",,,curw%,7,ptr%?3
- den%=ptr%?2
- $ptr%="Don't know"
- den%
- 0 : $ptr%="Hard disc"
- 1 : $ptr%="Single"
- 2 : $ptr%="Double"
- 3 : $ptr%="Double+"
- 4 : $ptr%="Quad"
- 8 : $ptr%="Octal"
- "WimpExt_SetIconString",,,curw%,3,
- String(ptr%)
- "Wimp_CreateSubMenu",,block%!20,block%!24,block%!28
-