home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / programs / desktop / insert / !Insert / !RunImage (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1998-02-22  |  6KB  |  305 lines

  1.  > <Insert$Dir>.!RunImage
  2. initiate
  3.  exit=
  4. check(
  5. $+", EXIT?")
  6.   poll%=%1110110110011
  7.  (calltype%=2 
  8.  ts%>-1) 
  9.  sending% 
  10.  poll%=poll%
  11. "Wimp_Poll",poll%,blk% 
  12.  reason%
  13.  reason% 
  14. '    
  15.  sending% 
  16. send 
  17. check
  18. %    
  19. "Wimp_OpenWindow",,blk%
  20. &    
  21. "Wimp_CloseWindow",,blk%
  22. 7    
  23. mouse(!blk%,blk%!4,blk%!8,blk%!12,blk%!16)
  24. "    
  25.  !blk%=2 
  26. closedown
  27. /    
  28.  17,18:
  29. message(blk%!4,blk%!8,blk%!16)
  30. closedown
  31. initiate
  32. mblen%=128:bs%=16*1024
  33.  blk% 1000, menubuffer% mblen%,text% bs%
  34. $blk%="TASK"
  35. program$="Insert"
  36. dir$="<Insert$Dir>"
  37. "Wimp_Initialise",200,!blk%,program$ 
  38.  ,mytask%
  39. 6iconbar%=
  40. createicon(-1,0,0,68,68,&2002,"!insert")
  41. "Wimp_OpenTemplate",,dir$+".Templates"
  42. #info%=
  43. loadtemplate("info",256)
  44. )options%=
  45. loadtemplate("options",256)
  46. "Wimp_CloseTemplate"
  47. menuptr%=menubuffer%
  48. !Amenubar%=
  49. crmenu("Insert,Info>,info%,Options>,options%,Quit")
  50. barheight%=items%*44+96
  51. exit=
  52. ts%=-1
  53. sending%=
  54. calltype%=0
  55. closedown
  56. "Wimp_CloseDown",mytask%
  57. check
  58.  calltype%=2 
  59. "Wimp_GetPointerInfo",,blk%
  60.  blk%!12=-2 
  61.  blk%!16=iconbar% 
  62. (-1) 
  63.       sending%=
  64.       tp%=0
  65.       
  66.       
  67. 6        
  68.  tp%<ts% 
  69.   key%=text%?tp%
  70.  key%=10 
  71.  key%=13
  72. "Wimp_ProcessKey",key%
  73.   tp%+=1
  74.   sending%=
  75.   tp%=0
  76. mouse(mx%,my%,but%,wind%,icon%)
  77.  wind% 
  78.  but% 
  79. K.      
  80.  2 : 
  81. menu(menubar%,mx%,barheight%)
  82.       
  83.         
  84.  sending% 
  85.           sending%=
  86.         
  87. P.          
  88.  calltype%=1 
  89.  sending%=
  90. :tp%=0
  91.         
  92. R        
  93.  options% : 
  94.  icon%>=0 
  95.  calltype%=icon%:
  96. "Wimp_CreateMenu",,-1
  97. menu(data%,x%,y%)
  98. openmenu%=data%
  99. x%=x%-(data%!16)/2-16
  100. "Wimp_CreateMenu",,data%,x%,y%
  101. message(task%,ref%,message%)
  102.  message% 
  103.  0 : 
  104. closedown
  105.  blk%!40<=&FFF
  106.       size%=blk%!36
  107.       
  108.  size%<=bs% 
  109.         trans%=0
  110.         tp%=0
  111.         ts%=-1
  112. g"        file$=
  113. string(blk%+44)
  114.         blk%!20=text%
  115.         blk%!24=size%
  116.         
  117. reply(18,6)
  118.       
  119. l%        
  120. report("File too large")
  121.       
  122. n        
  123. (-1) 
  124. q       file$=
  125. string(blk%+44)
  126.       $text%=file$
  127.       ts%=
  128.  file$
  129.       tp%=0
  130. u$      
  131.  calltype%=0 
  132.  sending%=
  133. v        
  134.  blk%!40<=&FFF 
  135. x       file$=
  136. string(blk%+44)
  137. y)      
  138. "OS_File",5,file$ 
  139.  ,,,,size%
  140.       
  141.  size%<=bs% 
  142.         ts%=-1
  143. |+        
  144. "Wimp_GetPointerInfo",,blk%+8
  145.         blk%!28=blk%!8
  146.         blk%!32=blk%!12
  147.         blk%!36=-1
  148. !        !blk%=(48+
  149.  file$)
  150.         $(blk%+44)=file$+
  151.         
  152. reply(17,4)
  153. '        
  154. "OS_File",255,file$,text%
  155.         ts%=size%
  156.         tp%=0
  157. &        
  158.  calltype%=0 
  159.  sending%=
  160.       
  161. %        
  162. report("File too large")
  163.       
  164.         
  165.         
  166.     trans%+=blk%!24
  167.  trans%=size% 
  168.       ts%=size%
  169.       tp%=0
  170. $      
  171.  calltype%=0 
  172.  sending%=
  173.         
  174.       blk%!20+=blk%!24
  175.       blk%!24=size%-trans%
  176.       
  177. reply(18,6)
  178.         
  179. reply(type%,reason%)
  180. blk%!12=ref%
  181. blk%!16=reason%
  182. "Wimp_SendMessage",type%,blk%,task%
  183. loadtemplate(title$,indir%)
  184.  buff% indir%
  185. "Wimp_LoadTemplate",,blk%,buff%,buff%+indir%,-1,title$
  186. "Wimp_CreateWindow",,blk% 
  187.  wind%
  188. =wind%
  189. crmenu(text$)
  190. oldptr%=menuptr%
  191. items%=0
  192. text$+=","
  193. title$=
  194. nextword(text$)
  195. $menuptr%=title$
  196. max%=
  197.  title$
  198. menuptr%!12=&70207
  199. menuptr%!20=44
  200. menuptr%!24=0
  201. menuptr%+=4
  202.  text$<>""
  203.   items%+=1
  204.   menuptr%+=24
  205.   !menuptr%=0
  206.   menuptr%!4=0
  207.   word$=
  208. nextword(text$)
  209.   token$=
  210. token(word$)
  211.  token$<>""
  212.  token$ 
  213. 0      
  214.  ">" : menuptr%!4=
  215. nextword(text$))
  216. )      
  217.  "/" : !menuptr%=!menuptr% 
  218. )      
  219.  "-" : !menuptr%=!menuptr% 
  220. )      
  221.  "!" : !menuptr%=!menuptr% 
  222.         
  223.     token$=
  224. token(word$)
  225. !  menuptr%!8=(7<<24) 
  226.  %10001
  227.  !menuptr% 
  228.  token$="#" 
  229. $    menuptr%!8=menuptr%!8 
  230.  1<<8
  231. '    menuptr%!12=
  232. nextword(text$))
  233.     menuptr%!16=-1
  234.     menuptr%!20=
  235. (word$)
  236. A    
  237.  menuptr%!20>max% 
  238.  (!menuptr% 
  239.  4)=0 
  240.  max%=menuptr%!20
  241.  word$>12 
  242. &      menuptr%!8=menuptr%!8 
  243.  1<<8
  244.       
  245.  menuptr%!12 
  246.  word$
  247.       $(menuptr%!12)=word$
  248.       menuptr%!16=-1
  249.       menuptr%!20=
  250.  word$
  251.         
  252.       $(menuptr%+12)=word$
  253.         
  254. %    
  255.  word$>max% 
  256.  max%=
  257.  word$
  258. !menuptr%=!menuptr% 
  259. menuptr%+=24
  260. oldptr%!16=max%*16+8
  261. =oldptr%
  262. token(
  263.  word$)
  264. token$=""
  265. ">/!#-",
  266. word$)) 
  267.   token$=
  268. word$,1)
  269.   word$=
  270. word$,
  271.  word$-1)
  272. =token$
  273. nextword(
  274.  text$)
  275.  word$,pos%
  276. pos%=
  277. text$,",")
  278. word$=
  279. text$,pos%-1)
  280. text$=
  281. text$,pos%+1)
  282. =word$
  283. createicon(!blk%,blk%!4,blk%!8,blk%!12,blk%!16,blk%!20,$(blk%+24))
  284. "Wimp_CreateIcon",,blk% 
  285.  icon%
  286. =icon%
  287. check(message$)
  288. "Wimp_DragBox",,0
  289. !blk%=0
  290. $(blk%+4)=message$
  291. "Wimp_ReportError",blk%,19,"Message from "+program$ 
  292.  ,answer%
  293.  answer%=1 
  294. string(b%)
  295.     s$=""
  296.  ?b%>31
  297.   s$+=
  298. (?b%)
  299.   b%+=1
  300. report(message$)
  301. "Wimp_DragBox",,0
  302. !blk%=0
  303. $(blk%+4)=message$
  304. "Wimp_ReportError",blk%,1,program$
  305.