home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / diskmanager / diskind_1 / !DiskInd / !RunImage (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1995-09-10  |  28KB  |  1,075 lines

  1.  !RunImage
  2.  for !DiskInd
  3.  by JJF
  4.  September 1994
  5.  (c) JJF 1994
  6.  TRACE TO "<DiskInd$Dir>.Tracer"
  7.  TRACE ON
  8.  blk% &100,blk2% &100,dat% &100
  9. killwimpext%=1
  10. fraud%=
  11.  "<DiskInd$Dir>.Addr"
  12. assemble("<DiskInd$Dir>.Code")
  13.  "<DiskInd$Dir>.Lib"
  14.  menu% &400,menu2% &400,menuind% &100
  15.  progwin% 500,progwinind% 350
  16.  blkforwindows% &1000,blkforwindowhandles% &100,ind% &B00
  17.  "Wimp_Initialise",200,&4B534154,"Disc Indexer" 
  18.  ,handle%
  19.  "WimpExt_Initialise",5,handle%,26
  20.  loop=0 
  21.  8*4:blkforwindowhandles%!loop=0:
  22.  "WimpExt_LoadTemplates",blkforwindowhandles%,blkforwindows%,ind%,ind%+&17FF,-1,"<DiskInd$Dir>.Templates",1
  23.  "Wimp_OpenTemplate",,"<DiskInd$Dir>.Templates2"
  24.  "Wimp_LoadTemplate",,progwin%,progwinind%,progwinind%+349,-1,"Progress"
  25.  "Wimp_CloseTemplate"
  26.  "WimpExt_Heap",0,
  27.  "WimpExt_Heap",2,,16 
  28.  ,data%
  29.  "WimpExt_Heap",2,,16 
  30.  ,sd%
  31.  "WimpExt_Heap",2,,16 
  32.  ,dnlist%
  33.  "WimpExt_Heap",2,,16 
  34.  ,lineptrs%
  35.  "WimpExt_Heap",2,,16 
  36.  ,dnlineptrs%
  37.  "WimpExt_Heap",2,,1024*4 
  38.  ,linefndata%:ml%=1024
  39. -&infohandle%=blkforwindowhandles%!8
  40. .)seldrihandle%=blkforwindowhandles%!12
  41. /'texthandle%=blkforwindowhandles%!16
  42. 0)dnlisthandle%=blkforwindowhandles%!20
  43. 1+infotexthandle%=blkforwindowhandles%!24
  44. 2)confighandle%=blkforwindowhandles%!28
  45. 3(searchhandle%=blkforwindowhandles%!4
  46. 4%renhandle%=blkforwindowhandles%!0
  47. isregistered=
  48. settext(infohandle%,0,"!DiskInd (Demo Version)")
  49. 8Lblk%!0=-2:blk%!4=0:blk%!8=0:blk%!12=68:blk%!16=68:blk%!20=(3<<12)+%11010
  50. $(blk%+24)="!DiskInd"
  51.  "Wimp_CreateIcon",,blk% 
  52.  iconbarh%
  53.  "WimpExt_SetIcon",,,searchhandle%,2,1
  54. discs%=0
  55. mem%=0
  56. od%=discs%:om%=mem%
  57. loadconfig
  58. lines%=0
  59. curmenu%=0
  60. discstart%=-1
  61. altered%=
  62. textshowing%=0
  63.  "WimpExt_PrePoll"
  64.  "Wimp_Poll",0,blk% 
  65.  reason%
  66.  "WimpExt_Action",handle%,blk%,reason% 
  67.  reason%
  68.  reason% 
  69. redrawtext
  70.  "Wimp_OpenWindow",,blk%
  71.  "Wimp_CloseWindow",,blk%
  72. click
  73. select
  74.  17,18:
  75. message
  76. message
  77.  blk%!16 
  78. prequit2
  79.  1282:
  80. click
  81. mx%=blk%!0:my%=blk%!4
  82.  blk%!12 
  83.  blk%!8 
  84.  selact% 
  85. l!   
  86.  discs%>0 
  87. opendnlist
  88. openseldri
  89. openconfig
  90. iconbarmenu
  91.  adjact% 
  92. r!   
  93.  discs%>0 
  94. opendnlist
  95. openseldri
  96. openconfig
  97.  seldrihandle%:
  98.  blk%!16 
  99.  blk%!8=1 
  100.  blk%!8=4 diskname2$="":
  101. startscan
  102.  dnlisthandle%:
  103.  blk%!8=1 
  104.  blk%!8=4 
  105. selfromdnlist 
  106.  blk%!8=2 
  107. dnlistmenu
  108.  texthandle%:
  109.  blk%!8=1 
  110.  discstart%<>-1 
  111. changetext 
  112.  blk%!8=4 
  113.  infotexthandle%:
  114.  (blk%!8=1 
  115.  blk%!8=4) 
  116.  blk%!16=3 
  117. setinfotext
  118.  confighandle%:
  119.  blk%!8=1 
  120.  blk%!8=4 
  121. clickinconfig
  122.  searchhandle%:
  123.  blk%!16=4 
  124.  "WimpExt_GetIcon",,,searchhandle%,2 
  125.  check%:
  126.  check%=1 
  127. searchfnames(
  128. readtext(searchhandle%,0))
  129.  "WimpExt_GetIcon",,,searchhandle%,3 
  130.  check%:
  131.  check%=1 
  132. searchinfotext(
  133. readtext(searchhandle%,0))
  134.  renhandle%:
  135.  blk%!16=2 diskname2$=
  136. readtext(renhandle%,1):
  137.  diskname2$<>"" 
  138. startscan
  139. select
  140.  curmenu% 
  141.  blk%!0 
  142. openseldri
  143.  blk%!4=0 
  144. showdisc(
  145. ctrlstring(menuind%)) 
  146. opendnlist
  147. clear
  148. openconfig
  149.  7:check%=
  150. prequit:
  151.  check%=
  152.  blk%!0 
  153.  blk%!4=0 
  154. rename(title$,
  155. ctrlstring(menuind%))
  156. remove(title$)
  157.  blk%!0 
  158.  seldrihandle%:
  159.  blk%!24 
  160.  13:diskname2$="":
  161. startscan
  162.  "Wimp_ProcessKey",blk%!24
  163.  infotexthandle%:
  164.  blk%!24 
  165. setinfotext
  166.  "Wimp_ProcessKey",blk%!24
  167.  "Wimp_ProcessKey",blk%!24
  168. iconbarmenu
  169. curmenu%=1
  170. setmenublock(menu%,"Disk Indexer",200)
  171. addmenuitem(menu%+28,0,infohandle%,((7<<24)+%10001),"Info")
  172. addmenuitem(menu%+52,0,-1,((7<<24)+%10001),"Scan Disk")
  173. checkmenuitem2(menu%+76,0,menu2%,((7<<24)+%10001),&7000021-(
  174. <<22),"Display Disc",discs%>0)
  175. checkmenuitem2(menu%+100,0,searchhandle%,((7<<24)+%10001),&7000021-(
  176. <<22),"Search",discs%>0)
  177. checkmenuitem2(menu%+124,0,-1,((7<<24)+%10001),&7000021-(
  178. <<22),"Clear",discs%>0)
  179. checkmenuitem2(menu%+148,0,-1,((7<<24)+%10001),&7000021-(
  180. <<22),"Save",discs%>0)
  181. addmenuitem(menu%+172,0,-1,((7<<24)+%10001),"Config")
  182. addmenuitem(menu%+196,128,-1,((7<<24)+%10001),"Quit")
  183. setmenublock(menu2%,"Disc Name",200)
  184. addindirectmenuitem(menu2%+28,132,-1,&7000119,"",menuind%,20)
  185.  "WimpExt_CreateMenu",,menu%,mx%-64,96+(40*8)
  186. openseldri
  187. blk%!0=seldrihandle%
  188.  "Wimp_GetWindowState",,blk%
  189. blk%!28=-1
  190.  "Wimp_OpenWindow",,blk%
  191. selfromdnlist
  192.  y%,discsel%
  193. 7blk%!0=dnlisthandle%:
  194.  "Wimp_GetWindowState",,blk%
  195.  y%=((blk%!16)-my%)-(blk%!24)
  196. discsel%=y% 
  197.  discsel%>discs%-1 
  198.  discsel%<0 
  199. showdisc($((!((!dnlineptrs%)+(discsel%*4)))+(!dnlist%)))
  200. changetext
  201.  y%,fnsel%,temp$
  202. 5blk%!0=texthandle%:
  203.  "Wimp_GetWindowState",,blk%
  204.  y%=((blk%!16)-my%)-(blk%!24)
  205. fnsel%=(y% 
  206.  fnsel%>lines% 
  207.  fnsel%<0 
  208. &mem2%=!((!linefndata%)+(fnsel%*4))
  209.  mem2%<0 
  210. :fnsel%-=1:mem2%=!((!linefndata%)+(fnsel%*4)):
  211.  mem2%>-1
  212.  mem2%=0 
  213. 5temp$=
  214. ctrlstring(mem2%+!data%):mem2%+=
  215. (temp$)+1
  216. mem2%+=9
  217. 4putit%=mem2%:infotext$=
  218. ctrlstring(mem2%+!data%)
  219. settext(infotexthandle%,0,infotext$)
  220. settext(infotexthandle%,2,temp$)
  221.  "Wimp_CreateMenu",,infotexthandle%,mx%-64,my%
  222.  "WimpExt_PutCaretIcon",,,infotexthandle%,0
  223. setinfotext
  224.  memneeded%
  225. od%=discs%:om%=mem%
  226. altered%=
  227. *infotext$=
  228. readtext(infotexthandle%,0)
  229. memneeded%=
  230. (infotext$)+1
  231. #mem2%=
  232. trackctrl(putit%+!data%)
  233. copymem(mem2%,putit%+!data%,mem%+!data%):mem%-=(mem2%-!data%)-putit%
  234.  "WimpExt_Heap",4,data%,mem%+memneeded% 
  235.  ,check%:
  236.  check%=0 
  237. nomem
  238. copymem(putit%+!data%,putit%+memneeded%+!data%,mem%+!data%):mem%+=memneeded%
  239. $(putit%+!data%)=infotext$
  240. rereaddisc(discstart%+!data%)
  241. od%=discs%:om%=mem%
  242.  "Wimp_CreateMenu",,-1
  243. showdisc(diskname$)
  244.  mem2%,searched%,curdisc%
  245.  "Hourglass_On"
  246. mem2%=!data%
  247. curdisc%=0
  248. diskname$=
  249. caps(diskname$)
  250. curdisc%+=1
  251. !dn$=
  252. caps(
  253. ctrlstring(mem2%))
  254.  dn$<>diskname$ 
  255. mem2%+=
  256. (dn$)+1
  257. mem2%=
  258. trackctrl(mem2%)
  259. mem2%=
  260. findendofdir(mem2%)
  261.  dn$=diskname$ 
  262.  curdisc%=discs%
  263.  "Hourglass_Off"
  264.  dn$<>diskname$ 
  265. whinge("Unknown disc name!"):
  266.  "Hourglass_On"
  267. memused%=0
  268. discstart%=mem2%-(!data%)
  269. mem2%=
  270. trackctrl(mem2%)
  271. ctrlstring(mem2%)
  272. ?memused%=
  273. addstringtoheap(cn$,sd%,memused%):mem2%+=
  274. (cn$)+1
  275. lines%=1
  276. listdir(0)
  277.  "WimpExt_Heap",4,lineptrs%,lines%*4 
  278.  ,check%:
  279.  check%=0 
  280. nomem
  281. !mem_sd=sd%
  282. !mem_lineptrs=lineptrs%
  283. !lines=lines%
  284.  makelinesdata
  285. closeifopen(texthandle%)
  286. Bblk%!0=0:blk%!4=-(lines%*36)-8:blk%!8=(maxlen*16)+38:blk%!12=0
  287.  "WimpExt_SetExtent",texthandle%,blk%
  288.  "WimpExt_OpenFullSize",,,texthandle%,-1
  289. 5blk%!0=texthandle%:
  290.  "Wimp_GetWindowState",,blk%
  291. 2blk%!20=0:blk%!24=0:
  292.  "Wimp_OpenWindow",,blk%
  293.  "Hourglass_Off"
  294. rereaddisc(mem2%)
  295.  "Hourglass_On"
  296. memused%=0
  297. discstart%=mem2%-(!data%)
  298. mem2%=
  299. trackctrl(mem2%)
  300. ctrlstring(mem2%)
  301. ?memused%=
  302. addstringtoheap(cn$,sd%,memused%):mem2%+=
  303. (cn$)+1
  304. lines%=1:data2%=!data%
  305. listdir(0)
  306.  "WimpExt_Heap",4,lineptrs%,lines%*4 
  307.  ,check%:
  308.  check%=0 
  309. nomem
  310. !mem_sd=sd%
  311. !mem_lineptrs=lineptrs%
  312. !lines=lines%
  313.  makelinesdata
  314. Bblk%!0=0:blk%!4=-(lines%*36)-8:blk%!8=(maxlen*16)+38:blk%!12=0
  315.  "WimpExt_SetExtent",texthandle%,blk%
  316.  "WimpExt_CheckWindowOpen",texthandle% 
  317.  check%:
  318.  check%=1 blk%!0=texthandle%:
  319.  "Wimp_GetWindowState",,blk%:
  320.  "Wimp_CloseWindow",,blk%:blk%!0=texthandle%:
  321.  "Wimp_GetWindowState",,blk%:
  322.  "Wimp_OpenWindow",,blk%
  323.  "Hourglass_Off"
  324. findendofdir(mem%)
  325. !findendofdir_mem=mem%
  326.  findendofdir
  327. =!findendofdir_mem
  328. listdir(level%)
  329. textshowing%=1
  330. !mem2=mem2%
  331. !lines=lines%
  332. !pos=memused%
  333. !mem_linefndata=linefndata%
  334. !mem_sd=sd%
  335. !mem_data=data%
  336. !level=level%*2
  337. 2!!canimagebeapp=canimagebeapp%
  338. !showinapp=showinapp%
  339. !mem_maxlen=75
  340.  listdir_start
  341. maxlen=!mem_maxlen
  342. mem2%=!mem2
  343. lines%=!lines
  344. 9#check%=!error:
  345.  check%=0 
  346. nomem
  347. redrawtext
  348.  loop=1 
  349.  more%,x0%,x1%,y0%,y1%,I%,T%,B%,S%
  350. winredrawing%=blk%!0
  351. @    S%=36
  352.  "Wimp_RedrawWindow",,blk% 
  353.  more%
  354.  more%
  355. redrawtext_decodeblock
  356. T%=(-(gtop%-w_sy%)-S%)/S%
  357.  T%<0 T%=0
  358. B%=(-(gbot%-w_sy%))/S%
  359.  winredrawing%=texthandle% 
  360.  B%>=lines% B%=lines%-1
  361.  winredrawing%=dnlisthandle% 
  362.  B%>=discs% B%=discs%-1
  363.  I%=T% 
  364. x0%=8+w_sx%
  365. y1%=-8-S%*I%+w_sy%
  366.  x0%,y1%
  367.  winredrawing%=texthandle% 
  368.  !((!linefndata%)+(I%*4))<0 
  369.  -!((!linefndata%)+(I%*4)) 
  370.  winredrawing%=texthandle% 
  371.  $(!((!lineptrs%)+(I%*4))+!sd%)
  372.  winredrawing%=dnlisthandle% 
  373.  $(!((!dnlineptrs%)+(I%*4))+!dnlist%)
  374.  "Wimp_GetRectangle",,blk% 
  375.  more%
  376. redrawtext_decodeblock
  377. w_sx%=blk%!4-blk%!20
  378. w_sy%=blk%!16-blk%!24
  379. gtop%=blk%!40
  380. gbot%=blk%!32
  381. updatednlist
  382.  discs%=0 
  383. mem2%=!data%
  384. memused%=0
  385.  "WimpExt_Heap",4,dnlineptrs%,discs%*4 
  386.  ,check%:
  387.  check%=0 
  388. nomem
  389. maxlen%=10
  390.  loop=0 
  391.  discs%-1
  392. d'!((!dnlineptrs%)+(loop*4))=memused%
  393. e>dn$=$mem2%:mem2%+=
  394. (dn$)+1:
  395. (dn$)>maxlen% maxlen%=
  396. (dn$)
  397. f3memused%=
  398. addstringtoheap(dn$,dnlist%,memused%)
  399. mem2%=
  400. trackctrl(mem2%)
  401. mem2%=
  402. findendofdir(mem2%)
  403. jCblk%!0=0:blk%!4=-(discs%*36)-8:blk%!8=(maxlen%*16)+16:blk%!12=0
  404.  "WimpExt_SetExtent",dnlisthandle%,blk%
  405.  "WimpExt_CheckWindowOpen",dnlisthandle% 
  406.  check%:
  407.  check%=1 
  408. m7blk%!0=dnlisthandle%:
  409.  "Wimp_GetWindowState",,blk%
  410. n+ob%=blk%!28:
  411.  "Wimp_CloseWindow",,blk%
  412.  "WimpExt_OpenFullSize",,,dnlisthandle%,ob%
  413. opendnlist
  414.  "WimpExt_OpenFullSize",,,dnlisthandle%,-1
  415. openconfig
  416. updateconfig
  417. y6!blk%=confighandle%:
  418.  "Wimp_GetWindowState",,blk%
  419.  "Wimp_OpenWindow",,blk%
  420. updateconfig
  421.  loop=9 
  422.  "WimpExt_SetIcon",,,confighandle%,loop,0:
  423.  "WimpExt_SetIcon",,,confighandle%,15+scaninapp%,1
  424.  "WimpExt_SetIcon",,,confighandle%,16-scaninapp%,0
  425.  "WimpExt_SetIcon",,,confighandle%,9+showinapp%,1
  426.  "WimpExt_SetIcon",,,confighandle%,
  427. "212528",(selact%*2)+1,2)),1
  428.  "WimpExt_SetIcon",,,confighandle%,
  429. "222629",(adjact%*2)+1,2)),1
  430.  "WimpExt_SetIcon",,,confighandle%,30,autodispcat%
  431.  "WimpExt_SetIcon",,,confighandle%,31,killwimpext%
  432.  "WimpExt_SetIcon",,,confighandle%,32,autosave%
  433.  "WimpExt_SetIcon",,,confighandle%,34,canimagebeapp%
  434. clickinconfig
  435.  blk%!16 
  436. setconfig
  437.  6:!blk%=confighandle%:
  438.  "Wimp_GetWindowState",,blk%:
  439.  "Wimp_CloseWindow",,blk%
  440. setconfig:
  441. saveconfig
  442. setconfig
  443.  loop,var1%,var2%,var3%,var4%
  444. var1%=-1
  445.  loop=15 
  446.  "WimpExt_GetIcon",,,confighandle%,loop 
  447.  check%
  448.  check%=1 var1%=loop-15
  449.  var1%=-1 
  450. whinge("Please select whether or not to scan inside applications."):
  451. var2%=-1
  452.  loop=9 
  453.  "WimpExt_GetIcon",,,confighandle%,loop 
  454.  check%
  455.  check%=1 var2%=loop-9
  456.  var2%=-1 
  457. whinge("Please select an option from the 'Show inside apps' box"):
  458. var3%=-1
  459.  loop=0 
  460.  "WimpExt_GetIcon",,,confighandle%,
  461. "212528",(loop*2)+1,2)) 
  462.  check%
  463.  check%=1 var3%=loop
  464.  var3%=-1 
  465. whinge("Please select an action to be performed when SELECT is used on the icon bar icon."):
  466. var4%=-1
  467.  loop=0 
  468.  "WimpExt_GetIcon",,,confighandle%,
  469. "222629",(loop*2)+1,2)) 
  470.  check%
  471.  check%=1 var4%=loop
  472.  var4%=-1 
  473. whinge("Please select an action for ADJUST to perform on the icon bar icon."):
  474. scaninapp%=var1%
  475. showinapp%=var2%
  476. selact%=var3%
  477. adjact%=var4%
  478.  "WimpExt_GetIcon",,,confighandle%,30 
  479.  autodispcat%
  480.  "WimpExt_GetIcon",,,confighandle%,31 
  481.  killwimpext%
  482.  "WimpExt_GetIcon",,,confighandle%,32 
  483.  autosave%
  484.  "WimpExt_GetIcon",,,confighandle%,34 
  485.  canimagebeapp%
  486. 6!blk%=confighandle%:
  487.  "Wimp_GetWindowState",,blk%
  488.  "Wimp_CloseWindow",,blk%
  489. saveconfig
  490. "<DiskInd$Dir>.Config"
  491. #fh%,scaninapp%
  492. #fh%,showinapp%
  493. #fh%,selact%
  494. #fh%,adjact%
  495. #fh%,autodispcat%
  496. #fh%,killwimpext%
  497. #fh%,autosave%
  498. #fh%,canimagebeapp%
  499. loadconfig
  500. "<DiskInd$Dir>.Config"
  501. #fh%,scaninapp%
  502. #fh%,showinapp%
  503. #fh%,selact%
  504. #fh%,adjact%
  505. #fh%,autodispcat%
  506. #fh%,killwimpext%
  507. #fh%,autosave%
  508. #fh%,canimagebeapp%
  509. dnlistmenu
  510. curmenu%=2
  511. 7blk%!0=dnlisthandle%:
  512.  "Wimp_GetWindowState",,blk%
  513.  y%=((blk%!16)-my%)-(blk%!24)
  514. discsel%=y% 
  515.  discsel%>discs%-1 
  516.  discsel%<0 
  517. (mem2%=!((!linefndata%)+(discsel%*4))
  518. 9title$=$((!((!dnlineptrs%)+(discsel%*4)))+(!dnlist%))
  519. setmenublock(menu%,"'"+title$+"'",120)
  520. addmenuitem(menu%+28,0,menu2%,((7<<24)+%10001),"Rename")
  521. addmenuitem(menu%+52,128,-1,((7<<24)+%10001),"Remove")
  522. setmenublock(menu2%,"Rename",190)
  523. addindirectmenuitem(menu2%+28,132,-1,&7000119,title$,menuind%,20)
  524.  "WimpExt_CreateMenu",,menu%,mx%-64,my%
  525. rename(title$,newname$)
  526. altered%=
  527.  newname$="" 
  528.  newname$=title$ 
  529. \check%=
  530. exists(newname$):
  531.  check%=
  532. whinge("There is already a disc with that name!"):
  533.  "WimpExt_Heap",4,!data%,mem%+20 
  534.  ,check%:
  535.  check%=0 
  536. nomem
  537.  "Hourglass_On"
  538. mem2%=!data%
  539. title$=
  540. caps(title$)
  541. !dn$=
  542. caps(
  543. ctrlstring(mem2%))
  544.  dn$<>title$ 
  545. mem2%+=
  546. (dn$)+1
  547. mem2%=
  548. trackctrl(mem2%)
  549. mem2%=
  550. findendofdir(mem2%)
  551.  dn$=title$
  552. tit$=
  553. ctrlstring(mem2%)
  554. copymem(mem2%+
  555. (tit$)+1,mem2%,mem%+!data%)
  556. mem%-=
  557. (tit$)+1
  558. copymem(mem2%,mem2%+
  559. (newname$)+1,mem%+!data%)
  560. mem%+=
  561. (newname$)+1
  562. $mem2%=newname$
  563.  "WimpExt_Heap",4,!data%,mem%
  564.  "Wimp_CreateMenu",,-1
  565. updatednlist
  566. closeifopen(texthandle%)
  567.  "Hourglass_Off"
  568. od%=discs%:om%=mem%
  569. remove(name$)
  570. altered%=
  571.  "Hourglass_On"
  572. mem2%=!data%
  573. name$=
  574. caps(name$)
  575. !dn$=
  576. caps(
  577. ctrlstring(mem2%))
  578.  dn$<>name$ 
  579. mem2%+=
  580. (dn$)+1
  581. mem2%=
  582. trackctrl(mem2%)
  583. mem2%=
  584. findendofdir(mem2%)
  585.  dn$=name$
  586. mem3%=mem2%+
  587. (dn$)+1
  588. mem3%=
  589. trackctrl(mem3%)
  590. mem3%=
  591. findendofdir(mem3%)
  592.  mem3%<>mem%+!data% 
  593. copymem(mem3%,mem2%,mem%+!data%)
  594. mem%-=mem3%-mem2%
  595. discs%-=1
  596.  mem%=0 
  597.  "WimpExt_Heap",4,data%,16 
  598.  "WimpExt_Heap",4,data%,mem%
  599.  "Wimp_CreateMenu",,-1
  600.  discs%>0 
  601. updatednlist 
  602. closeifopen(dnlisthandle%)
  603. closeifopen(texthandle%)
  604.  "Hourglass_Off"
  605. od%=discs%:om%=mem%
  606. exists(name$)
  607.  Checks if a disc of name name$ already exists
  608.  dn$,mem2%,curdisc%,check%
  609.  discs%=0 
  610. name$=
  611. caps(name$)
  612. check%=
  613. curdisc%=0
  614. mem2%=!data%
  615. $!dn$=
  616. caps(
  617. ctrlstring(mem2%))
  618.  dn$=name$ check%=
  619. mem2%+=
  620. (dn$)+1
  621. mem2%=
  622. trackctrl(mem2%)
  623. mem2%=
  624. findendofdir(mem2%)
  625. curdisc%+=1
  626.  check% 
  627.  curdisc%=discs%
  628. =check%
  629. searchfnames(sf$)
  630.  sf$="" 
  631. ol%=lines%
  632. caps(sf$)
  633.  "Hourglass_On"
  634. $searchstr=sf$
  635. !mem2=!data%
  636. !discs=discs%
  637. !mem_data=data%
  638. !mem_sd=sd%
  639. !mem_linefndata=linefndata%
  640. !mem_maxlen=75
  641.  searchfilenames
  642. maxlen=!mem_maxlen
  643. ;#check%=!error:
  644.  check%=0 
  645. nomem
  646. lines%=!lines
  647.  "Hourglass_Off"
  648.  "Wimp_CreateMenu",,-1
  649.  lines%=0 lines%=ol%:
  650. mess("Not found!"):
  651.  "WimpExt_Heap",4,lineptrs%,lines%*4 
  652.  ,check%:
  653.  check%=0 
  654. nomem
  655. !mem_sd=sd%
  656. !mem_lineptrs=lineptrs%
  657. !lines=lines%
  658.  makelinesdata
  659. closeifopen(texthandle%)
  660. FBblk%!0=0:blk%!4=-(lines%*36)-8:blk%!8=(maxlen*16)+38:blk%!12=0
  661.  "WimpExt_SetExtent",texthandle%,blk%
  662.  "WimpExt_OpenFullSize",,,texthandle%,-1
  663. I5blk%!0=texthandle%:
  664.  "Wimp_GetWindowState",,blk%
  665. J2blk%!20=0:blk%!24=0:
  666.  "Wimp_OpenWindow",,blk%
  667. textshowing%=2
  668. searchinfotext(sf$)
  669.  sf$="" 
  670. ol%=lines%
  671. caps(sf$)
  672.  "Hourglass_On"
  673. $searchstr=sf$
  674. !mem2=!data%
  675. !discs=discs%
  676. !mem_data=data%
  677. !mem_sd=sd%
  678. !mem_linefndata=linefndata%
  679. !mem_maxlen=75
  680.  searchinfotext
  681. maxlen=!mem_maxlen
  682. \#check%=!error:
  683.  check%=0 
  684. nomem
  685. lines%=!lines
  686.  "Hourglass_Off"
  687.  "Wimp_CreateMenu",,-1
  688.  lines%=0 lines%=ol%:
  689. mess("Not found!"):
  690.  "WimpExt_Heap",4,lineptrs%,lines%*4 
  691.  ,check%:
  692.  check%=0 
  693. nomem
  694. !mem_sd=sd%
  695. !mem_lineptrs=lineptrs%
  696. !lines=lines%
  697.  makelinesdata
  698. closeifopen(texthandle%)
  699. gBblk%!0=0:blk%!4=-(lines%*36)-8:blk%!8=(maxlen*16)+38:blk%!12=0
  700.  "WimpExt_SetExtent",texthandle%,blk%
  701.  "WimpExt_OpenFullSize",,,texthandle%,-1
  702. j5blk%!0=texthandle%:
  703.  "Wimp_GetWindowState",,blk%
  704. k2blk%!20=0:blk%!24=0:
  705.  "Wimp_OpenWindow",,blk%
  706. textshowing%=2
  707.  "Hourglass_On"
  708.  y%,linesel%,fn$,mem2%,fn2$,count%
  709. r5blk%!0=texthandle%:
  710.  "Wimp_GetWindowState",,blk%
  711. s y%=((blk%!16)-my%)-(blk%!24)
  712. linesel%=y% 
  713.  linesel%<0 
  714.  linesel%>lines%-1 
  715.  "Hourglass_Off":
  716. v(mem2%=!((!linefndata%)+(linesel%*4))
  717.  mem2%<0 
  718. :linesel%-=1:mem2%=!((!linefndata%)+(linesel%*4)):
  719.  mem2%>-1
  720.  textshowing% 
  721.  1:fn$=
  722. findpath(linesel%)
  723.  2:fn$=$(!((!lineptrs%)+(linesel%*4))+!sd%)
  724. {;  count%=1:
  725. :fn2$=
  726. fn$,count%):count%+=1:
  727. fn2$,1)=" "
  728.   fn$=
  729. fn2$,
  730. (fn2$)-1)
  731.  "Hourglass_Off"
  732.  "XOS_CLI","Filer_Run "+fn$
  733. findpath(linesel%)
  734.  level%,path$,loop,level2%
  735. :level%=
  736. countspaces(!((!lineptrs%)+(linesel%*4))+!sd%)
  737. 7path$=
  738. firstword(!((!lineptrs%)+(linesel%*4))+!sd%)
  739.  linesel%=0 
  740.  =path$
  741.  loop=linesel%-1 
  742. 7level2%=
  743. countspaces(!((!lineptrs%)+(loop*4))+!sd%)
  744.  level2%<level% 
  745.  !((!linefndata%)+(loop*4))>-1 level%=level2%:path$=
  746. firstword(!((!lineptrs%)+(loop*4))+!sd%)+"."+path$
  747. =path$
  748. countspaces(mem2%)
  749. !mem2=mem2%
  750.  countspaces
  751. =!mem2
  752. firstword(mem2%)
  753. !mem2=mem2%
  754.  firstword
  755. =$ctrlstring_str
  756.  FNreadtext, PROCdrag, PROCdraggedbox, FNleafname by A J Cawte.
  757. readtext(wi%,ic%)
  758. !dat%=wi%
  759. dat%!4=ic%
  760. "Wimp_GetIconState",,dat%
  761. ctrlstring(dat%!28)
  762. ctrlstring(ad%)
  763. !ctrlstring_mem=ad%
  764.  ctrlstring
  765. =$ctrlstring_str
  766. settext(wd%,ic%,t$)
  767.  sets the icon, handle 'ic%' in window 'wd%' to string t$
  768.  "WimpExt_SetIconString",,,wd%,ic%,t$
  769. "OS_ReadModeVariable",-1,11 
  770.  ,,xl%
  771. "OS_ReadModeVariable",-1,4 
  772.  ,,xe%:xl%=xl%*2^xe%
  773. "OS_ReadModeVariable",-1,12 
  774.  ,,yl%
  775. "OS_ReadModeVariable",-1,5 
  776.  ,,ye%:yl%=yl%*2^ye%
  777. .!blk%=saveh%:
  778. "Wimp_GetWindowState",,blk%
  779. 5!dat%=saveh%:dat%!4=0:
  780. "Wimp_GetIconState",,dat%
  781. blk%!20=blk%!8+dat%!20+160
  782. blk%!16=blk%!4+dat%!16
  783. blk%!12=blk%!8+dat%!12+160
  784. blk%!8=blk%!4+dat%!8
  785. blk%!4=5
  786. /blk%!24=0:blk%!28=0:blk%!32=xl%:blk%!36=yl%
  787. "Wimp_DragBox",,blk%
  788. draggedbox
  789. save$=
  790. readtext(saveh%,1)
  791. "Wimp_GetPointerInfo",,dat%
  792. !!blk%=256:blk%!12=0:blk%!16=1
  793. @blk%!20=dat%!12:blk%!24=dat%!16:blk%!28=!dat%:blk%!36=dat%!4
  794. blk%!36=100
  795. blk%!40=&453
  796. $(blk%+44)=
  797. leafname(save$)
  798. "Wimp_SendMessage",17,blk%,blk%!20
  799. leafname(file$)
  800. file$,".")<>0
  801. 'file$=
  802. file$,(
  803.  file$)-
  804. file$,"."))
  805. =file$
  806. setmenublock(block%,text$,width%)
  807. $block%=text$
  808. 3block%?12=7:block%?13=2:block%?14=7:block%?15=0
  809. block%!16=width%
  810. block%!20=40
  811. block%!24=0
  812. addmenuitem(addr,flags,pointer,iconflags,entry$)
  813. A!addr=flags:addr!4=pointer:addr!8=iconflags:$(addr+12)=entry$
  814. checkmenuitem1(addr,flags1,flags2,pointer,iconflags,entry$,test%)
  815.  test%=
  816. addmenuitem(addr,flags1,pointer,iconflags,entry$)
  817.  test%=
  818. addmenuitem(addr,flags2,pointer,iconflags,entry$)
  819. checkmenuitem2(addr,flags,pointer,iconflags1,iconflags2,entry$,test%)
  820.  test%=
  821. addmenuitem(addr,flags,pointer,iconflags1,entry$)
  822.  test%=
  823. addmenuitem(addr,flags,pointer,iconflags2,entry$)
  824. addindirectmenuitem(addr,flags,pointer,iconflags,entry$,addr2,len)
  825. addmenuitem(addr,flags,pointer,iconflags,"")
  826. addr!12=addr2
  827. addr!16=-1
  828. addr!20=len+1
  829. $addr2=entry$
  830. caps(txt$)
  831.  pos%
  832. (txt$)<1 txt$="  "
  833. txt2$=""
  834.  pos%=1 
  835. (txt$)
  836. txt$,pos%,1))>96 
  837. txt$,pos%,1))<123 
  838.  txt2$+=
  839. txt$,pos%,1))-32) 
  840.  txt2$+=
  841. txt$,pos%,1)
  842. =txt2$
  843. copymem(from%,to%,end%)
  844.  from%=to% 
  845.  from% 
  846.  4=0 
  847.  to% 
  848.  4=0 
  849.  "WimpExt_MemCopy",from%,to%,end%-from%:
  850. !from=from%
  851. !to=to%
  852. !end=end%
  853.  to%<from% 
  854.  copymem
  855.  copymembackwards
  856.  fraud%=
  857.  fraud%=
  858. whinge(
  859. $+" at line "+
  860. prequit2
  861. whinge(txt$)
  862.  "Hourglass_Smash"
  863. !blk%=0
  864. $(blk%+4)=txt$
  865.  "Wimp_ReportError",blk%,2,"Disk Indexer"
  866.  "WimpExt_CloseDown",handle%
  867.  "Wimp_CloseDown",handle%,&4B534154
  868.  killwimpext%=1 
  869.  "RmKill WimpExtension"
  870. getcarname(disk$)
  871.  "OS_FSControl",37,disk$,blk2%,0,0,256
  872. ctrlstring(blk2%)
  873. getdiskname(disk$)
  874.  cn$,pos%,diskname$
  875. getcarname(disk$)
  876. pos%=1
  877. cn$,pos%,1)=
  878. disk$,pos%,1) 
  879.  pos%<(
  880. (cn$)+1)
  881. pos%+=1
  882. diskname$=""
  883. cn$,pos%,1)<>"." 
  884.  pos%<(
  885. (cn$)+1)
  886. diskname$+=
  887. cn$,pos%,1)
  888. pos%+=1
  889.  diskname$="" 
  890. mess("I am unable to read this disc's name."):
  891. renamedisk
  892. =diskname$
  893. trackctrl(mem%)
  894. !trackctrl_mem=mem%
  895.  trackctrl
  896. =!trackctrl_mem
  897. addstringtoheap(string$,anchor%,pos%)
  898.  len%
  899. len%=
  900. (string$)
  901.  "WimpExt_Heap",4,anchor%,pos%+len%+1 
  902.  ,check%:
  903.  check%=0 
  904. nomem
  905. $(pos%+!anchor%)=string$
  906. pos%+=len%+1
  907. 4    =pos%
  908. prequit
  909.  altered%=
  910.  autosave%=1 
  911. save:=
  912.  mem2%,choice%
  913. mem2%=blk%
  914. $mem2%="Save":mem2%+=5
  915. $mem2%="Discard":mem2%+=8
  916. $mem2%="Cancel":mem2%+=7
  917. $mem2%=
  918. (13)+
  919.  "WimpExt_ControlImmediate",,2,"Warning from !DiskInd","Data has been modified since last save.",blk%,2 
  920.  choice%
  921.  choice%=0 
  922. save:=
  923.  choice%=1 =
  924.  choice%=2 =
  925. prequit2
  926.  altered%=
  927.  autosave%=1 
  928. save:
  929.  mem2%,choice%
  930. mem2%=blk%
  931. $mem2%="Save":mem2%+=5
  932. $mem2%="Discard":mem2%+=8
  933. $mem2%=
  934. (13)+
  935. (13)+
  936.  "WimpExt_ControlImmediate",,2,"Warning from !DiskInd","Data has been modified since last save.",blk%,1 
  937.  choice%
  938.  choice%=0 
  939. nomem
  940.  mem2%
  941. mem2%=blk%
  942. $mem2%="Continue":mem2%+=9
  943. T"$mem2%=
  944. (13)+
  945. (13)+
  946. (13)+
  947.  "WimpExt_ControlImmediate",,2,"Error from !DiskInd","I am unable to claim enough memory. Please free more memory and try again.",blk%,0
  948. discs%=od%:mem%=om%
  949. updatednlist
  950. closeifopen(texthandle%)
  951. closeifopen(infotexthandle%)
  952. fraud%=
  953. Goggles
  954. closeifopen(windowhandle%)
  955.  check%
  956.  "WimpExt_CheckWindowOpen",windowhandle% 
  957.  check%
  958.  check%=0 
  959. a6!blk%=windowhandle%:
  960.  "Wimp_GetWindowState",,blk%
  961.  "Wimp_CloseWindow",,blk%
  962. mess(mess$)
  963.  mem2%
  964. mem2%=dat%
  965. $mem2%="OK":mem2%+=3
  966. i"$mem2%=
  967. (13)+
  968. (13)+
  969. (13)+
  970.  "WimpExt_ControlImmediate",,2,"Message from !DiskInd",mess$,dat%,0
  971. diskexists
  972. mem2%=dat%
  973. $mem2%="Rename":mem2%+=7
  974. $mem2%="Update":mem2%+=7
  975. $mem2%="Cancel":mem2%+=7
  976. $mem2%=
  977. (13)+
  978.  "WimpExt_ControlImmediate",,2,"Message from !DiskInd","A disk of this name is already known by !DiskInd.",dat%,2 
  979.  choice%
  980.  "WimpExt_ControlImmediate",,0
  981.  choice%=2 cancel%=
  982.  cancel%=
  983.  choice%=1 
  984. remove(diskname$):
  985. renamedisk
  986. renamedisk
  987. cancel%=
  988.  "Wimp_CreateMenu",,renhandle%,mx%-64,my%
  989. clear
  990. mem2%=dat%
  991. $mem2%="OK":mem2%+=3
  992. $mem2%="Cancel":mem2%+=7
  993. $mem2%=
  994. (13)+
  995. (13)+
  996.  "WimpExt_ControlImmediate",,2,"Message from !DiskInd","This will erase all of the discs from memory. Please confirm.",dat%,1 
  997.  choice%
  998.  choice%=1 
  999. discs%=0
  1000. mem%=0
  1001.  "WimpExt_Heap",4,data%,16
  1002.  "WimpExt_Heap",4,sd%,16
  1003.  "WimpExt_Heap",4,dnlist%,16
  1004.  "WimpExt_Heap",4,lineptrs%,16
  1005.  "WimpExt_Heap",4,dnlineptrs%,16
  1006. closeifopen(texthandle%)
  1007. closeifopen(dnlisthandle%)
  1008. altered%=
  1009.  "OS_Find",&8F,"<DiskInd$Dir>.Data" 
  1010. dat%!0=discs%
  1011. dat%!4=mem%
  1012.  "OS_GBPB",2,fh%,dat%,8
  1013.  "OS_GBPB",2,fh%,!data%,mem%
  1014.  "OS_Find",0,fh%
  1015.  pointer%,fh%
  1016.  "OS_Find",&4F,"<DiskInd$Dir>.Data" 
  1017.  "OS_GBPB",3,fh%,dat%,8,0 
  1018.  ,,,,pointer%
  1019. discs%=dat%!0
  1020. mem%=dat%!4
  1021.  mem%>16 
  1022.  "WimpExt_Heap",4,data%,mem% 
  1023.  check%:
  1024.  check%=0 
  1025. nomem
  1026.  mem%<17 
  1027.  "WimpExt_Heap",4,data%,16
  1028.  "OS_GBPB",3,fh%,!data%,mem%,pointer% 
  1029.  ,,,,pointer%
  1030.  "OS_Find",0,fh%
  1031.  discs%>0 
  1032. updatednlist:
  1033. opendnlist
  1034. blk%!12=blk%!8
  1035. blk%!16=&503
  1036. text$=""
  1037.  blk%!32 
  1038.  -2:text$="This is the !DiskInd icon. Click MENU to bring up the icon bar menu."
  1039.  infohandle%:text$="This window displays information about !DiskInd."
  1040.  seldrihandle%:
  1041.  blk%!36 
  1042.  2:text$="This box contains the path to scan."
  1043.  3:text$="Click here to index the disc."
  1044.  texthandle%:
  1045.  textshowing% 
  1046.  1:text$="This is the text window. Click SELECT to run an item, or ADJUST to change it's info text."
  1047.  2:text$="This is the text window. Click SELECT to run an item."
  1048.  dnlisthandle%:text$="This window lists all of the discs that the computer knows about. Click SELECT to display one, or MENU to access a menu."
  1049.  infotexthandle%:text$="This window allows you to edit an item's info text."
  1050.  confighandle%:
  1051.  blk%!36 
  1052.  15,16:text$="Click here to tell the computer whether or not to scan inside applications."
  1053.  9,10,11,12,13:text$="Click on one of these icons to select when you wish to see what is inside an application."
  1054.  21,25,28:text$="These icons allow you to select what happens when you click SELECT on the icon bar icon."
  1055.  22,26,29:text$="These icons allow you to select what happens when you click ADJUST on the icon bar icon."
  1056.  31,32,33,34:text$="These icons allow you to fine-tune the operation of !DiskInd to your own personal taste."
  1057.  5:text$="Click here to confirm the new configuration."
  1058.  6:text$="Click here to return to the old configuration."
  1059.  7:text$="Click here to save this configuration."
  1060. L  text$="This window allows you to alter the configuration of !DiskInd."
  1061.  searchhandle%:
  1062.  blk%!36 
  1063.  0:text$="Type what you wish to search for into this box."
  1064.  2:text$="Click on this icon if you wish to search for a particular filename."
  1065.  3:text$="Click on this icon if you wish to search for a particular phrase in the info text."
  1066.  4:text$="Click here to commence the search."
  1067.  renhandle%:text$="Type in here what you want to call the disc."
  1068. $(blk%+20)=text$
  1069. %blk%!0=(((20+
  1070. (text$)+1)
  1071.  4)*4)+4
  1072. $(blk%+21+
  1073. (text$))=
  1074.  "Wimp_SendMessage",17,blk%
  1075.