home *** CD-ROM | disk | FTP | other *** search
/ Acorn User 2 / AUCD2.iso / internet / acornet.spk / !Acornet / Apps / !Ping / !Runimage (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1996-03-13  |  9KB  |  350 lines

  1.  Runimage for Ping
  2. "Wimp_Initialise",200,&4B534154,"Ping" 
  3.  ,myhandle%
  4. version$="0.13 (12-Mar-96)"
  5.  errorblock% 100
  6. errbox(
  7. indlength%=&400
  8. pings%=0
  9. maxpings%=20
  10. maxpinglength%=128
  11. "OS_File",17,"<Ping$Dir>.Sprites" 
  12.  ,,,,spsize%
  13. spsize%+=4
  14. "pingm%=99:
  15.  just silly numbers
  16. mainm%=137
  17.  indirected% indlength%
  18.  wblk% &300
  19.  menublk% 28+24*maxpings%
  20.  messb% &200
  21.  iconblock% 42
  22.  plblk% &100 
  23.  sp% spsize%
  24.  pingslot% (maxpings%+1)*maxpinglength%
  25. !sp%=spsize%
  26.  &2E,266,sp%,"<Ping$Dir>.Sprites"
  27. set_message_numbers
  28. load_my_windows
  29. load_messages
  30. rewriteIcon(info%,3,version$)
  31. get_pings
  32.  PROCrewriteIcon(pane%,0,$pingslot%)
  33. all_over%=
  34. mask%=1
  35. errbox(
  36. $+" "+
  37. +". "+"OK to continue CANCEL to Quit",3):
  38.  errreturn%=2 
  39. openOnTop
  40.  SYS"Wimp_SetCaretPosition",pane%,0,0,0,-1,LEN FNgeticontext(pane%,0)
  41.  all_over%
  42. "Wimp_CloseDown",myhandle%,&4B534154
  43. "Wimp_Poll",mask%,plblk% 
  44.  reason%
  45.  reason% 
  46.  2     : 
  47. "Wimp_OpenWindow",,plblk%
  48.  3     : all_over%=
  49.  6     : 
  50. buttons
  51.  8     : 
  52. keyPress
  53.  9     : 
  54. menu_selection
  55.  17,18 : 
  56. receive
  57. receive
  58.  plblk%!16 
  59. >%   
  60.  Quit%          : all_over%=
  61.  HelpRequest%   : 
  62.  plblk%!32 
  63.  pane%     :win$="PN":
  64. sendhelp
  65. sendhelp
  66. "MessageTrans_Lookup",filedesc%,win$+
  67.  plblk%!36,plblk%+20,200
  68. !plblk%=256
  69. plblk%!12=plblk%!8
  70. plblk%!16=HelpReply%
  71. "Wimp_SendMessage",17,plblk%,plblk%!4
  72. "<Ping$Dir>.Pings"
  73. geticontext(pane%,0)
  74.  pings%>0 
  75.  i%=0 
  76.  pings%-1
  77. \+    
  78. #x%,$(pingslot%+maxpinglength%*i%)
  79. memtostring(ptr%)
  80.  ?ptr%<>0
  81. (?ptr%):ptr%+=1
  82. reminder(mess$)
  83. rewriteIcon(message%,0,mess$)
  84. !wblk%=message%
  85. "Wimp_GetWindowState",,wblk%
  86. centreWindow(wblk%)
  87. wblk%!28=-1
  88. "Wimp_OpenWindow",,wblk%
  89. keyPress
  90. window%=plblk%!0
  91. key%=plblk%!24
  92.  key%=13 
  93. "Wimp_ProcessKey",key%
  94. menu_selection
  95. option%=plblk%!0
  96.  menu% 
  97.  mainm%   : 
  98.  option%=1 
  99.  all_over%=
  100. C                  
  101.  option%=0 
  102. reminder(
  103. )+" bytes free")
  104.  pingm% : 
  105. ping_selection
  106. "Wimp_GetPointerInfo",,plblk%
  107.  plblk%!8=1 
  108. ping_menu
  109. ping_selection
  110.  6,129,0
  111. &FF,&FF 
  112.  ,key%
  113.  key%=255 
  114.  pings%>0 
  115. cut(option%)
  116.  pings%>0 
  117. A    
  118. rewriteIcon(pane%,0,$(pingslot%+maxpinglength%*option%))
  119. )    
  120. "Wimp_GetCaretPosition",,plblk%
  121. h    
  122.  plblk%!0=pane% 
  123.  plblk%!4=0 
  124. "Wimp_SetCaretPosition",pane%,0,0,0,-1,
  125. geticontext(pane%,0)
  126. buttons
  127. button%=plblk%!8
  128. window%=plblk%!12
  129. icon%=plblk%!16
  130.  button%=2 
  131. main_menu
  132. menu%=mainm%
  133. "Wimp_CreateMenu",,menublk%,plblk%!0-64,plblk%!4
  134.  window% 
  135.  pane%     : 
  136. pane_buttons
  137.  message%  : 
  138. closeWindow(message%)
  139.  IF button% AND &50 THEN 
  140.  wblk%!4=pane%:SYS "Wimp_GetWindowState",,wblk%+4: REM drag whole window if not on card
  141.  !wblk%=pane%:wblk%!4=1:SYS "Wimp_DragBox",,wblk%
  142.  ENDIF
  143. closeWindow(w%)
  144. !wblk%=w%
  145. "Wimp_CloseWindow",,wblk%
  146. openOnTop
  147. !plblk%=pane%
  148. "Wimp_GetWindowState",,plblk%
  149. centreWindow(plblk%)
  150. plblk%!28=-1
  151. "Wimp_OpenWindow",,plblk%
  152. openwin(handle%)
  153. !plblk%=handle%
  154.  "Wimp_GetWindowState",,plblk%
  155. plblk%!28=-1
  156. "Wimp_OpenWindow",,plblk%
  157. pane_buttons
  158.  icon% 
  159.   1 : 
  160.   2 : 
  161.   3 : 
  162. remove
  163.   4 : 
  164.   5 : all_over%=
  165.   6 : 
  166. ping_menu
  167. cut(what%)
  168.  what%<>pings%-1 
  169.  i%=what% 
  170.  pings%-1
  171. J     $(pingslot%+maxpinglength%*i%)=$(pingslot%+maxpinglength%*(i%+1))
  172.         
  173. $  $(pingslot%-maxpinglength%)=""
  174.   pings%-=1
  175. remove
  176. (at%=
  177. position(
  178. geticontext(pane%,0))
  179.  at%<>-1 
  180. cut(at%)
  181.  pings%<maxpings% 
  182. position(
  183. geticontext(pane%,0))=-1 
  184. @    $(pingslot%+maxpinglength%*pings%)=
  185. geticontext(pane%,0)
  186.     pings%+=1
  187. reminder("Sorry I can only remember "+
  188.  maxpings%+" pings.")
  189. position(f$)
  190.  return%
  191. return%=-1
  192.  pings%>0 
  193.  i%=0 
  194.  pings%-1
  195.  $(pingslot%+i%*maxpinglength%)=f$ 
  196.  return%=i%
  197. =return%
  198.  place$=
  199. geticontext(pane%,0)
  200.  "Wimp_StartTask","taskwindow -wimpslot 128k -quit -name PingInfo "+
  201. (34)+"ping -c 10 -q "+place$+
  202. exists(f$)
  203.  exists%
  204. "XOS_File",17,(f$) 
  205.  found%
  206.  found%=1 
  207.  found%=2 
  208.  exists%=
  209. =exists%
  210. rewriteIcon(wind%,icon%,text$)
  211. !iconblock%=wind%
  212. iconblock%!4=icon%
  213. &400CE,,iconblock%
  214. $iconblock%!28=text$
  215. iconblock%!8=0
  216. iconblock%!12=&400000
  217. &400CD,,iconblock%
  218. geticontext(window%,ic%)
  219. !iconblock%=window%
  220. iconblock%!4=ic%
  221. &400CE,,iconblock%
  222. =$iconblock%!28
  223. centreWindow(b%)
  224. getmodeInfo
  225. width%=(b%!12-b%!4)
  226. height%=(b%!16-b%!8)
  227. x%=(xos%+1-width%)/2
  228. y%=(yos%+1-height%)/2
  229. b%!12=x%+width%:b%!4=x%
  230. b%!16=y%+height%:b%!8=y%
  231. getmodeInfo
  232.  "OS_ReadModeVariable",-1,11 
  233.  ,,Xpixels%
  234.  "OS_ReadModeVariable",-1,12 
  235.  ,,Ypixels%
  236.  "OS_ReadModeVariable",-1,4 
  237.  ,,XEigFactor%
  238.  "OS_ReadModeVariable",-1,5 
  239.  ,,YEigFactor%
  240. A"xos%=(Xpixels%+1)<<XEigFactor%
  241. B"yos%=(Ypixels%+1)<<YEigFactor%
  242. get_pings
  243. pings%=0
  244. exists("<Ping$Dir>.Pings") 
  245.   c%=
  246. "<Ping$Dir>.Pings"
  247. rewriteIcon(pane%,0,
  248. #c%) 
  249.  pings%<maxpings%
  250. M/    $(pingslot%+maxpinglength%*pings%)=
  251.     pings%+=1
  252. RC$(pingslot%+pings%*maxpinglength%)="" : 
  253.  ensure one empty slot
  254. errbox(msg$,flags%)
  255. Xl!errorblock%=0:$(errorblock%+4)=msg$+
  256. "Wimp_ReportError",errorblock%,flags%, "!Ping" 
  257.  ,errreturn%
  258. main_menu
  259. b%=wblk%
  260. menu_head(b%,"MTITLE")
  261. p%=b%+
  262. "MTITLE"+1+6
  263. menuitem(0,"BM0")
  264. menuitem(&80,"BM1")
  265. c    !p%=0
  266. "MessageTrans_MakeMenus",filedesc%,b%,menublk%,256
  267. menublk%!(28+4)=info%
  268. ping_menu
  269. menwid%=9*16:
  270.  (title+1)*16
  271. $menublk%="Pings"
  272. menublk%?12=7
  273. menublk%?13=2
  274. menublk%?14=7
  275. menublk%?15=0
  276. menublk%!20=44
  277. menublk%!24=0
  278. at%=menublk%+28
  279.  pings%>0 
  280.  i%=0 
  281.  pings%-1
  282. inditem(at%,0  ,0    ,&07000111,pingslot%+maxpinglength%*i%)
  283. $(pingslot%+maxpinglength%*i%)>9 
  284.  menwid%=(
  285. $(pingslot%+maxpinglength%*i%)+1)*16
  286. {/  $pingslot%="Sorry I don't have any pings"
  287.   menwid%=32*16
  288. inditem(at%,0  ,0    ,&07000111,pingslot%+maxpinglength%*i%)
  289. at%!(-24)=&80
  290. menu%=pingm%
  291. menublk%!16=menwid%
  292. "Wimp_CreateMenu",,menublk%,plblk%!0+24,plblk%!4+22
  293. menuitem(flags%,token$)
  294. $p%=token$+
  295.  token$+1
  296. p%=((p%+3)
  297. !p%=flags%
  298. p%!4=0
  299. p%!8=&7000011
  300. p%+=12
  301. inditem(
  302.  where%,mflags%,submpointer%,miconflags%,item%)
  303. where%!0=mflags%
  304. where%!4=submpointer%
  305. where%!8=miconflags%
  306. !(where%+12)=item%
  307. $(item%+
  308. $item%+1)=""
  309.  !(where%+16)=item%+
  310. $item%+1
  311.  PROCerrbox($item%+"   "+$!(where%+16))
  312. !!(where%+20)=1+
  313. $!(where%+16)
  314. where%+=24
  315. menu_head(where%,t$)
  316. $where%=t$
  317. where%+=
  318.  t$+1
  319. !where%=&70207
  320. where%?4=44
  321. where%?5=0
  322. load_my_windows
  323.  "Wimp_OpenTemplate",,"<Ping$Dir>.Templates"
  324. 5indy%=indirected%:ind_end%=indirected%+indlength%
  325. $pane%        =
  326. onewindow("Pane")
  327. $info%        =
  328. onewindow("Info")
  329. 'message%     =
  330. onewindow("Message")
  331.  "Wimp_CloseTemplate"
  332. onewindow(t$)
  333.  "Wimp_LoadTemplate",,wblk%,indy%,ind_end%,-1,t$,0 
  334.  ,,indy%
  335. wblk%!64=sp%
  336.  "Wimp_CreateWindow",,wblk% 
  337. set_message_numbers
  338. Quit%        =0
  339. HelpRequest% =&502
  340. HelpReply%   =&503
  341. load_messages
  342. m$="<Ping$Dir>.Messages"
  343. "MessageTrans_FileInfo",,m$ 
  344.  flags%,,size%
  345. "OS_Module",6,,,17+
  346.  ,,filedesc%
  347. $(filedesc%+16)=m$
  348. "MessageTrans_OpenFile",filedesc%,filedesc%+16,messb%
  349. "MessageTrans_CloseFile",filedesc%
  350.