home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / programs / comms_networking / dehtml / !DeHTML / !RunImage (.txt) < prev    next >
Encoding:
RISC OS BBC BASIC V Source  |  1996-06-16  |  7.2 KB  |  344 lines

  1.  > <DeHTML$Dir>.!RunImage
  2.  -=[-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-]=-
  3.  -=[              DeHTML v0.01             ]=-
  4.  -=[ Front End by Chime/DiGiTAL ViSiON '95 ]=-
  5.  -=[    DeHTMLer by Philip R. Banks 1995   ]=-
  6.  -=[-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-]=-
  7.  q% &400,icons% &400,ic% 128,temp% &400
  8.     +task$="DeHTML":icon_memory%=icons%+&400
  9. error:
  10.  "<DeHTML$Dir>.DeHTML"
  11.  "Wimp_Initialise",200,&4B534154,task$ 
  12.  version%,task%
  13.  "Hourglass_On"
  14. 8info_win%=
  15. load_win("Info","<DeHTML$Dir>.Templates")
  16. =save_win%=
  17. load_win("xfer_send","<DeHTML$Dir>.Templates")
  18. %bar_icon%=
  19. icon_on_bar("!dehtml")
  20. 4m_menu%=
  21. make_menu("DeHTML\Info>info_win%\Quit")
  22. *xdragstart%=
  23. swi("XDragASprite_Start")
  24. finished%=
  25. get_args
  26.  "Hourglass_Off"
  27. error
  28. closedown
  29. get_args
  30.  mess%,mess$,key$,start_file$,end_file$
  31.  "OS_GetEnv" 
  32.  mess%
  33. #mess$=
  34. process(
  35. get_adr(mess%))
  36. )key$="infile,outfile,length/k,quit/s"
  37.  "OS_ReadArgs",key$,mess$,q%,1024
  38.  q%!0=0 
  39.  start_file$="" 
  40.  start_file$=
  41. get_adr(q%!0)
  42.  q%!4=0 
  43.  end_file$="" 
  44.  end_file$=
  45. get_adr(q%!4)
  46.  q%!8=0 
  47.  line_length%=76 
  48.  line_length%=
  49. get_adr(q%!8))
  50. autoquit%=(q%!12<>0)
  51.  start_file$<>"" 
  52.  end_file$<>"" 
  53. convert(line_length%)
  54. upper(c$)
  55.  d$,e$,l:d$=""
  56.  l=1 
  57.   e$=
  58. c$,l,1)
  59. (e$)>=97 
  60. (e$)<=122 
  61. (e$)-32)
  62.   d$+=e$
  63. process(a$)
  64.  pos%
  65. upper(
  66. a$,5))="BASIC" 
  67.   pos%=
  68. a$,"""")
  69.   pos%=
  70. a$,"""",pos%+1)
  71.   a$=
  72. a$,pos%+1)
  73. strip(a$)
  74. put_text(window%,icon%,text$)
  75. ;#temp%!0=window% : temp%!4=icon%
  76.  "Wimp_GetIconState",,temp%
  77. $(temp%!28)=text$
  78. >#temp%!0=window% : temp%!4=icon%
  79. temp%!8=0 : temp%!12=0
  80.  "Wimp_SetIconState",,temp%
  81. open(w%)
  82. D'!q%=w%:
  83.  "Wimp_GetWindowState",,q%
  84.  "Wimp_OpenWindow",,q%
  85. error
  86. I    !q%=
  87. J#$(q%+4)=
  88. $+" (Line "+
  89. +")"+
  90.  "Wimp_ReportError",q%,1,task$
  91. find(f$)
  92.  "OS_File",5,f$ 
  93. =(f%=1)
  94. load_win(window$,template$)
  95.  c%,i%,n%,j%,sp$,sp2$
  96.  "Wimp_OpenTemplate",,template$
  97.  "Wimp_LoadTemplate",,q%,icons%,icon_memory%,-1,window$,0 
  98.  ,,icons%
  99. q%!64=1
  100.  "Wimp_CreateWindow",,q% 
  101.  "Wimp_CloseTemplate"
  102. win_to_top(window%)
  103. !q%=window%
  104.  "Wimp_GetWindowState",,q%
  105. q%!28=-1
  106.  "Wimp_OpenWindow",,q%
  107. closedown
  108.  "Wimp_CloseDown",task%,&4B534154
  109.  mask%,event%,a,c
  110. mask%=%10000001100000110001
  111.  "Wimp_Poll",mask%,q% 
  112.  event%
  113.  event% 
  114.  1 : 
  115. Wimp_PollDrawWindow
  116.  2 : 
  117.  "Wimp_OpenWindow",,q%
  118.  3 : 
  119.  "Wimp_CloseWindow",,q%
  120.  6 : 
  121. click
  122.  7 : 
  123. save_message
  124.  9 : 
  125.  17,18 : 
  126. message_received
  127.  finished%
  128. save_message
  129.  xdragstart%<>-1 
  130.  "XDragASprite_Stop"
  131.  "Wimp_GetPointerInfo",,q%
  132. q%!32=q%!4:q%!28=!q%
  133. q%!24=q%!16:q%!20=q%!12
  134. q%!16=1:q%!12=0
  135. q%!40=&FFF
  136. q%!36=0
  137. 3$(q%+44)=
  138. leaf_name(
  139. icon_text(save_win%,1))+
  140. !q%=60
  141.  "Wimp_SendMessage",17,q%,q%!20,q%!24
  142. leaf_name(s$)
  143. s$,".")>0
  144. s$,".")+1)
  145. message_received
  146.  file$
  147.  q%!16 
  148.  0 : finished%=
  149.  2 : 
  150.  q%!36<>-1 
  151. (           end_file$=
  152. get_adr(q%+44)
  153. /           
  154. put_text(save_win%,1,end_file$)
  155. -           
  156.  "Wimp_GetCaretPosition",,q%
  157. Y           
  158.  !q%=save_win% 
  159.  "Wimp_SetCaretPosition",save_win%,1,,,-1,
  160. (end_file$)
  161.            
  162. save_file
  163.             
  164. close(save_win%)
  165.          
  166.  3 : 
  167.  q%!40=&FAF 
  168. 2           start_file$=
  169. strip(
  170. get_adr(q%+44))
  171. -           
  172. ack(4):
  173. win_to_top(save_win%)
  174. <           
  175.  "Wimp_SetCaretPosition",save_win%,1,,,-1,9
  176. =           
  177. put_text(save_win%,1,
  178. leaf_name(start_file$))
  179.          
  180. key_pressed
  181.  !q% 
  182.  save_win% : 
  183.  q%!4=1 
  184. !                   
  185.  q%!24 
  186. (                   
  187.  13 : 
  188. save_file
  189. ,                   
  190.  398,399 : 
  191.  up/down
  192. 5                   
  193.  "Wimp_ProcessKey",q%!24
  194.                    
  195.                  
  196. big_rep(s$)
  197. !q%=0:$(q%+4)=s$+
  198.  "Wimp_ReportError",q%,%10001,task$
  199. ack(m%)
  200. q%!12=q%!8
  201. q%!16=m%
  202.  "Wimp_SendMessage",17,q%,q%!4
  203. icon_text(window%,icon%)
  204. ?temp%!0=window%:temp%!4=icon%:
  205.  "Wimp_GetIconState",,temp%
  206. =$(temp%!28)
  207.  !q%=1 
  208.  finished%=
  209.  "Wimp_GetPointerInfo",,q%
  210.  (q%!8 
  211.  1)>0 
  212.  "Wimp_CreateMenu",,m_open%
  213. click
  214.  temp_v%
  215.  (q%!8 
  216.  2)>0 
  217.  q%!12 
  218.  -2 : 
  219.  "Wimp_CreateMenu",,m_menu%,!q%-64,184:m_open%=m_menu%
  220.  q%!12 
  221.  save_win% :
  222.  q%!16 
  223. .    
  224.  2 : 
  225.  (q%!8 
  226.  &50)>0 
  227. save_dragbox
  228. )    
  229.  0 : 
  230.  (q%!8 
  231.  5)>0 
  232. save_file
  233.         
  234. save_file
  235.  file$
  236. Gq%!0=save_win%:q%!4=1:
  237.  "Wimp_GetIconState",,q%:end_file$=$(q%!28)
  238. end_file$,".") 
  239.  0 : 
  240. report("To save, drag the icon to a directory window")
  241. convert(line_length%):
  242. close(save_win%)
  243. save_dragbox
  244.  x%,y%,ysize%
  245. .!q%=save_win%:
  246.  "Wimp_GetWindowState",,q%
  247. 'x%=q%!4-q%!20:y%=q%!16-q%!24:q%!4=2
  248.  "Wimp_GetIconState",,q%
  249. *q%!8+=x%:q%!12+=y%:q%!16+=x%:q%!20+=y%
  250. -q%!24=0:q%!28=0:q%!32=(
  251. mv(11)+1)<<
  252. mv(4)
  253. *q%!36=(
  254. mv(12)+1)<<
  255. mv(5):!q%=0:q%!4=5
  256.  xdragstart%<>-1 
  257. read_cmos(28) 
  258.  2)>0 
  259.  xdragstart%,%11000101,1,"file_fff",q%+8,q%+24 
  260.  "Wimp_DragBox",,q%
  261. mv(m%)
  262.  "OS_ReadModeVariable",-1,m% 
  263.  ,,v%
  264. read_cmos(byte%)
  265.  "OS_Byte",161,byte% 
  266.  ,,byte%
  267. =byte%
  268. set_icon_flags(!temp%,temp%!4,temp%!8,temp%!12)
  269.  "Wimp_SetIconState",,temp%
  270. close(w%)
  271. *!temp%=w%:
  272.  "Wimp_CloseWindow",,temp%
  273. Wimp_PollDrawWindow
  274.  more%
  275.  "Wimp_RedrawWindow",,q% 
  276.  more%
  277.  more%
  278.  "Wimp_GetRectangle",,q% 
  279.  more%
  280. get_adr(array%)
  281.  s$:s$=""
  282. (?array%>31 
  283. (s$)<255):s$+=
  284. (?array%):array%+=1:
  285. make_menu(menu$)
  286.  menu%,index%,width%,length%,k%,s%,unknown%
  287.  menu% 28+
  288. Wimp_MenuNoOfEntries(menu$)*24
  289. menu%!12=&70207
  290. +menu%!16=140 : menu%!20=44 : menu%!24=0
  291. index%=menu%+28
  292.  $menu%=
  293. menu$,
  294. menu$,"\")-1)
  295. #width%=
  296. menu$,
  297. menu$,"\")-1))
  298. $menu$+="\" : Menu_NoOfEntries%=0
  299.  menu$<>""
  300. menu$=
  301. menu$,
  302. menu$,"\")+1)
  303.  menu$ 
  304. 1  !index%=0 : index%!4=-1 : index%!8=&7000021
  305.   length%=
  306. menu$,"\")-1
  307.   k%=
  308. menu$,length%),">")
  309. %    s%=
  310. menu$,k%+1,length%-k%))
  311.     index%!4=s%
  312.     length%=k%-1
  313. "  $(index%+12)=
  314. menu$,length%)
  315.  length%>width% 
  316.  width%=length%
  317.   index%+=24
  318. menu%!16=width%*16+32
  319. "(index%!-24=index%!-24 
  320.  &80 : =menu%
  321. Wimp_MenuNoOfEntries(menu$)
  322.  n% ,j% : n%=0 : j%=0
  323. menu$,"\",j%+1)
  324.  j%<>0 
  325.  n%+=1
  326.  j%=0
  327. icon_on_bar(s$)
  328.  icon%
  329. .Cq%!0=-1:q%!4=0:q%!8=0:q%!12=68:q%!16=68:q%!20=&2002:$(q%+24)=s$
  330.  "Wimp_CreateIcon",,q% 
  331.  icon%
  332. =icon%
  333. strip(s$)
  334. s$)=" ":s$=
  335. s$,1)=" ":s$=
  336. s$,2):
  337. swi(swi$)
  338.  swi%,ok%
  339.  "XOS_SWINumberFromString",,swi$ 
  340.  swi%;ok%
  341.  (ok% 
  342.  1)>0 swi%=-1
  343. ;    =swi%
  344.