home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / d / disclook / !Disc / !RunImage (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1994-02-11  |  17KB  |  757 lines

  1.  DiscLook II 1.00
  2.  (c) 1993 RJ Developments
  3.  By Ian Clark
  4. $+" at line "+
  5. quit%=
  6. Error
  7.  quit%=
  8.  noquit%=
  9. "WimpExt_CloseDown",id%
  10. "XOS_Module",7,,msg%
  11. "Wimp_CloseDown"
  12.  ON ERROR LOCAL SYS"WimpExt_CloseDown",id%:SYS"Wimp_CloseDown",id%,&4B534154:RUN
  13. "Hourglass_On"
  14. ,msgpath$="<Disc$Dir>.Resources.Messages"
  15. "MessageTrans_FileInfo",,msgpath$ 
  16.  ,,msgsize%
  17.  "OS_Module",6,,,20+
  18. msgpath$ 
  19.  ,,msg%
  20. .$(msg%+16)="<Disc$Dir>.Resources.Messages"
  21.  msblk% msgsize%
  22. "MessageTrans_OpenFile",msg%,msg%+16,msblk%
  23.  block% 800
  24.  buffer% 4
  25.  handles% 8
  26.  indirected% 238
  27.  ok% 32
  28.  qui% 32
  29.  ibtxt% 50
  30.  ibsp% 255
  31.  imm% 32
  32.  prefs% 32
  33.  bkprefs% 30
  34. mount%=
  35. curfs$="ADFS"
  36. actfs$="ADFS"
  37. menhelp%=
  38. noquit%=
  39. nohd%=
  40. cfs%=
  41. cfs$=""
  42. fstick%=1
  43. drive%=0
  44. drm%=0
  45. 0    on%=
  46. ?prefs%=1
  47. prefs%?1=1
  48. prefs%?2=0
  49. prefs%?3=1
  50. prefs%?4=1
  51. $(prefs%+8)="1234"+
  52. $(prefs%+20)="1234"+
  53. 8%$qui%="Quit"+
  54. 0+"Cancel"+
  55. $ok%="OK"+
  56. :#$imm%="OK"+
  57. 0+"Cancel"+
  58. ;d$ibsp%="sFloppyLook;whThe Disc Look II icon.|mA RJ Developments program.|mCode 
  59. 1993 Ian Clark."
  60. shutdown%=
  61. running%=
  62. task%=
  63. open%=
  64. toquit%=
  65. password%=0
  66. correct%=0
  67. C<!block%=&502:block%!4=&400C0:block%!8=&43B00:block%!12=0
  68. "Wimp_Initialise",310,&4B534154,"Disc Look II",block% 
  69.  ver%,id%
  70.  ver%<310 
  71.  0,"Disc Look II needs Risc OS 3.10 or later"
  72. "WimpExt_Initialise",14,id%,%010010010 
  73.  ver%
  74.  ver%<195 
  75.  0,"Disc Look II needs Wimp Extentions 1.95 or later. (There is a copy inside the !DMen directory.)"
  76. "OS_File",13,"<Disc$Dir>.Resources.Sprites" 
  77.  ,,,,size%
  78. size%+=4:
  79.  sprite% size%
  80. !sprite%=size%:sprite%!8=16
  81. "OS_SpriteOp",&209,sprite%
  82. "OS_SpriteOp",&20A,sprite%,"<Disc$Dir>.Resources.Sprites"
  83.  x%=0 
  84. handles%!x%=%101:
  85. "WimpExt_LoadTemplates",handles%,block%,indirected%,indirected%+238,-1,"<Disc$Dir>.Resources.Templates",sprite%
  86. P8infow%=!handles%:titlew%=handles%!4:curw%=handles%!8
  87. "WimpExt_SetIconString",,,titlew%,5,"1.00"
  88. "WimpExt_OpenWindowTop",titlew%
  89. "WimpExt_PrePoll"
  90. "Wimp_Poll",0,block% 
  91.  code%
  92. "WimpExt_Action",id%,block%,code% 
  93.  code%
  94.  code% 
  95.  1 : 
  96. "WimpExt_AutoRedraw",,block%
  97.  2 : 
  98. "Wimp_OpenWindow",,block%
  99.  3 : 
  100. "Wimp_CloseWindow",,block%
  101.  code%=0
  102. "WimpExt_SetIconString",,,infow%,3,"
  103. 1993 Ian Clark ("+
  104. Gm("Date")+")"
  105. "WimpExt_SetIconString",,,infow%,0,
  106. Gm("Ver")
  107. GetFSs
  108. "ADFS_Drives" 
  109.  ,flop%,hard%
  110. Drivemenu(flop%,hard%)
  111. d0curfs$=
  112. String(devicem%+16+(24*(fstick%+1)))
  113. !block%=titlew%
  114. "Wimp_CloseWindow",,block%
  115. Ibtxt
  116. h    on%=
  117.  x%=END
  118.  PROCImm("Disc Look 2 is currently using "+STR$x%+" bytes, that's "+STR$(INT(x%/1024))+"K")
  119. "Hourglass_Off"      
  120.  title$
  121. title$=
  122. Gm("MT01")
  123.  barmenu% 28+(24*6)
  124.  actm% 28+(24*6)
  125.  formatm% 28+(24*6)
  126.  otherformatm% 28+(24*6)
  127. $barmenu%=title$
  128. width%=(
  129. title$-1)*16
  130. barmenu%?12=7
  131. barmenu%?13=2
  132. barmenu%?14=7
  133. barmenu%?15=0
  134. barmenu%!20=44
  135. barmenu%!24=0
  136.  The procedure below adds a single item to a menu.
  137.    Item Text        Flag Item Menu Submenu Pointer
  138.            |           | |    |       |
  139.           \ /         \/\/   \ /     \ /
  140. Additem(
  141. Gm("MI00"),2,1,barmenu%,infow%)
  142. Additem(
  143. Gm("MI01"),0,2,barmenu%,devicem%)
  144. Additem(
  145. Gm("MI02"),8,3,barmenu%,drivem%)
  146. Additem(
  147. Gm("MI03"),0,4,barmenu%,actm%)
  148. Additem(
  149. Gm("MI04"),2,5,barmenu%,-1)
  150. Additem(
  151. Gm("MI05"),&80,6,barmenu%,-1)
  152. barmenu%!16=width%
  153. title$=
  154. Gm("MT04")
  155. $actm%=title$
  156. width%=(
  157. title$-1)*16
  158. actm%?12=7
  159. actm%?13=2
  160. actm%?14=7
  161. actm%?15=0
  162. actm%!20=44
  163. actm%!24=0
  164. Additem(
  165. Gm("MI40"),0,1,actm%,-1)
  166. Additem(
  167. Gm("MI41"),0,2,actm%,-1)
  168. Additem(
  169. Gm("MI42"),0,3,actm%,formatm%)
  170. Additem(
  171. Gm("MI43"),0,4,actm%,-1)
  172. Additem(
  173. Gm("MI44"),0,5,actm%,-1)
  174. Additem(
  175. Gm("MI45"),&80,6,actm%,-1)
  176. actm%!16=width%
  177. title$=
  178. Gm("MT05")
  179. $formatm%=title$
  180. width%=(
  181. title$-1)*16
  182. formatm%?12=7
  183. formatm%?13=2
  184. formatm%?14=7
  185. formatm%?15=0
  186. formatm%!20=44
  187. formatm%!24=0
  188. Additem(
  189. Gm("MI55"),8,1,formatm%,curw%)
  190. Additem(
  191. Gm("MI50"),0,2,formatm%,-1)
  192. Additem(
  193. Gm("MI51"),0,3,formatm%,-1)
  194. Additem(
  195. Gm("MI52"),0,4,formatm%,-1)
  196. Additem(
  197. Gm("MI53"),0,5,formatm%,-1)
  198. Additem(
  199. Gm("MI54"),&80,6,formatm%,otherformatm%)
  200. formatm%!16=width%
  201. title$=
  202. Gm("MT05")
  203. $otherformatm%=title$
  204. width%=(
  205. title$-1)*16
  206. otherformatm%?12=7
  207. otherformatm%?13=2
  208. otherformatm%?14=7
  209. otherformatm%?15=0
  210. otherformatm%!20=44
  211. otherformatm%!24=0
  212. Additem(
  213. Gm("MI60"),0,1,otherformatm%,-1)
  214. Additem(
  215. Gm("MI61"),0,2,otherformatm%,-1)
  216. Additem(
  217. Gm("MI62"),0,3,otherformatm%,-1)
  218. Additem(
  219. Gm("MI63"),0,4,otherformatm%,-1)
  220. Additem(
  221. Gm("MI64"),0,5,otherformatm%,-1)
  222. Additem(
  223. Gm("MI65"),&80,6,otherformatm%,-1)
  224. otherformatm%!16=width%
  225. Imm(text$)
  226. Errbox(
  227. Gm("MS01"),text$,1)
  228. Errbox(title$,text$,bflag%)
  229.  bt%,pressed%
  230.  bflag% 
  231.  1 : bt%=ok%
  232.  2 : bt%=imm%
  233.  3 : bt%=qui%
  234.  : bt%=ok%
  235. "WimpExt_ControlImmediate",,2,title$,text$,bt%,1 
  236.  pressed%
  237. =pressed%
  238. Decodemenu
  239.  buffer%
  240.  buffer% 512
  241. "Wimp_DecodeMenu",,menu%,block%,buffer%
  242.  menu% 
  243.  barmenu% : 
  244.  $buffer% 
  245. Gm("MI05") : quit%=
  246. Gm("MI00") : 
  247. Gm("MS02"))
  248. Gm("MI04") : 
  249. FSWarn
  250. Gm("MI01")+".CFS#+" : 
  251. SwapCFS
  252. Gm("MI03")+"."+
  253. Gm("MI41") : 
  254. Dismount
  255. Gm("MI03")+"."+
  256. Gm("MI44") : 
  257. Verify
  258. Gm("MI03")+"."+
  259. Gm("MI45") : 
  260. Showfree
  261.  !block%=3 
  262.  block%!4=2 
  263.  block%!8<>-1 
  264. Format(block%!8,block%!12)
  265. $buffer%,
  266. Gm("MI01"))+1)=
  267. Gm("MI01")+"." 
  268. NewFS($buffer%)
  269. $buffer%,
  270. Gm("MI02"))+1)=
  271. Gm("MI02")+"." 
  272. Newdrive($buffer%)
  273. Additem(item$,flag%,item%,menu%,submenu%)
  274. item$>12 
  275. Gm1("ER00",item$)
  276. item$+1)*16>width% 
  277.  width%=(
  278. item$+1)*16
  279. P%=menu%+28+(24*(item%-1))
  280.     OPT 0
  281. EQUD flag%
  282. EQUD submenu%
  283. EQUD &7000021
  284. !EQUS item$+
  285. item$-1),
  286. Error
  287.  67795 : 
  288. Imm("Drive '"+curfs$+" "+
  289. drive%+"' is empty!"):
  290.  67756 : 
  291. Imm("Bad drive regarding '"+curfs$+" "+
  292. drive%+"'!"):
  293. }bt%=
  294. Errbox("Error "+
  295. +" from Disc Look II","Error: '"+
  296. $+"' - Internal error code "+
  297. +", "+
  298. +". What should I do?",3)
  299.  bt% 
  300.  0 : 
  301. "WimpExt_CloseDown",id%:
  302. "Wimp_CloseDown":
  303.  quit% 
  304.  noquit% 
  305. "WimpExt_PrePoll"
  306. "Wimp_Poll",0,block% 
  307.  code%
  308. "WimpExt_Action",id%,block%,code% 
  309.  code%
  310.  code% 
  311.  1 : 
  312. "WimpExt_AutoRedraw",,block%
  313.  2 : 
  314. "Wimp_OpenWindow",,block%
  315.  3 : 
  316. "Wimp_CloseWindow",,block%
  317.  6 : 
  318. Click(block%!8,block%!12,block%!16,!block%,block%!4)
  319.  8 : 
  320. Processkey
  321.  9 : 
  322. Decodemenu
  323.  17,18 : 
  324. Receive
  325. Exists(path$)
  326. "OS_File",17,path$ 
  327.  found%
  328.  found%=0 =
  329. Click(b%,w%,i%,x%,y%)
  330.  -2 : 
  331. $            
  332.  baricon% : 
  333. n                             
  334.  2 : menu%=barmenu%:
  335.  "WimpExt_CreateMenu",,barmenu%,x%-64,96+(44*6)+(24*2)
  336. /                             
  337.  4 : 
  338. Opendir
  339. !                            
  340.            
  341.  infow% : 
  342.  3 : 
  343. Gm("IW03"))
  344.  4 : 
  345. Gm("IW02"))
  346. String(pointertostring%)
  347.  ?pointertostring%>25 
  348. tx$<255
  349. $1tx$+=
  350. (?pointertostring%):pointertostring%+=1
  351. Receive
  352.  block%!16 
  353.  0 : quit%=
  354.   WHEN 3 : CASE block%!40 OF
  355.             WHEN &FFF : PROCReadtextfile(FNString(block%+44))
  356.            ENDCASE
  357.  &502 : 
  358.  block%!32 
  359. /&              
  360.  infow% : 
  361. Infohelp
  362. 03             
  363. Menuhelp(block%!32,block%!36)
  364.               
  365.  &400C0 : 
  366.  block%!20=curw% 
  367. Currentform 
  368. Drivewarn
  369.  &43B00 : 
  370. String(block%+20),8)="DiscLook" 
  371. Extcommand(
  372. String(block%+20),9))
  373. Sendhelp(help$)
  374. "WimpExt_SendHelp",help$,block%
  375. Menuhelp(w%,i%)
  376.  menuhelp%
  377.  menuhelp% 512
  378.  menhelp% 
  379.  w%=barmenu% 
  380.  i%=3 
  381. "Wimp_GetMenuState",0,menuhelp%
  382.  !menuhelp% 
  383.  -1 : 
  384. Sendhelp("Ohh! Your sooooooo good with that mouse!!")
  385.  0 : 
  386. Sendhelp("This option leads to a standard info box.")
  387.  1 : 
  388.  menuhelp%!4 
  389.  -1 : 
  390. Sendhelp("Move right to select a filing system")
  391.  0 : 
  392.  cfs% 
  393. Sendhelp("Click here to turn CFS off.") 
  394. Sendhelp("Click here to turn CFS on.")
  395. Sendhelp("Click here to select this as the current filing system.")
  396.  4 : 
  397. 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.")
  398. Ibtxt
  399.  drive$
  400.  drive%<>-1 drive$=":"+
  401. drive% 
  402.  drive$="$"
  403. R text$=cfs$+actfs$+":"+drive$
  404. $ibtxt%=text$
  405.  width%
  406. ($ibtxt%)*16>100 
  407.  width%=
  408. ($ibtxt%)*16 
  409.  width%=100
  410.  on% !block%=-7:block%!4=baricon%:
  411. "Wimp_DeleteIcon",,block%
  412. !block%=-6
  413. block%!4=0
  414. block%!8=-16
  415. block%!12=width%
  416. block%!16=90
  417. block%!20=&1700310B
  418. block%!24=ibtxt%
  419. block%!28=ibsp%
  420. block%!32=50
  421. "Wimp_CreateIcon",251658240,block% 
  422.  baricon%
  423. a    on%=
  424. "WimpExt_PrePoll":
  425. "Wimp_Poll",0,block% 
  426.  code%:
  427. "WimpExt_Action",id%,block%,code% 
  428.  code%
  429.  code%=1 
  430. "WimpExt_AutoRedraw",,block%
  431.  code%=0
  432. Opendir
  433.  drive$
  434.  drive%=-1 drive$="$" 
  435.  drive$=
  436. drive%
  437. discname$=""
  438. CheckSWI(curfs$+"_DescribeDisc") 
  439.  curfs$+"_DescribeDisc",":"+drive$,block%
  440. n$discname$=":"+
  441. String(block%+22)
  442. discname$,1))<=32
  443. discname$=
  444. discname$)
  445.