home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 6 / RISCWORLD_VOL6.iso / Software / ISSUE2 / PD / taufull.spk / !Tau_!RunImage (.txt) < prev    next >
Encoding:
RISC OS BBC BASIC V Source  |  2005-07-05  |  122.0 KB  |  4,971 lines

  1.  This is Tau version 1.50
  2.  Copyright (C) 2001 Tim Birks
  3.  This program is free software; you can redistribute it and/or
  4.  modify it under the terms of the GNU General Public License
  5.  as published by the Free Software Foundation; either version 2
  6.  of the License, or (at your option) any later version.
  7.  This program is distributed in the hope that it will be useful,
  8.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  9.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10.  GNU General Public License for more details.
  11.  You should have received a copy of the GNU General Public License
  12.  along with this program; if not, write to the Free Software
  13.  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  14.  Tim Birks
  15.  Email : pystab@hotmail.com
  16.  Current development by Peter Killworth
  17.  Email : p.killworth@soc.soton.ac.uk
  18.  Snail : National Oceanography Centre, Southampton
  19.          Empress Dock
  20.          Southampton
  21.          SO14 3ZH
  22.          United Kingdom.
  23. $+" at line ";
  24. IFLEFT$(REPORT$,16)<>"ARM BBC BASIC V " THENERROR0,"Tau can only run on Basic V"
  25.  --- constants and array dimensions ---
  26. %maxC1%=64:room%=16*4096:minP1%=16
  27. C%=15:P%=4095
  28. !$C1%=C%+1:P1%=P%+1:maxC%=maxC1%-1
  29. "*fileversion$="150":workspacesize%=7804
  30. #@white%=&FFFFFF00:black%=&0:lgrey%=&DDDDDD00:mgrey%=&BBBBBB00
  31.  block% 3500, block1% 255, block2% 255, block3% 255, workspace0% workspacesize%
  32.  colourpick% 50, colourtitle% 50:colourhandle%=0
  33.  s%(60),g%(60)
  34.  ColumnPlot%(maxC%),ColumnMeaning$(maxC%),ColumnLine%(maxC%),ColumnThick(maxC%),ColumnDash(maxC%),ColumnGap(maxC%),ColumnFill%(maxC%),ColumnKeyText$(maxC%),workhorse%(maxC%)
  35.  ColumnPoints%(maxC%),ColumnChar%(maxC%),ColumnWidth(maxC%),ColumnHeight(maxC%),ColumnError%(maxC%),ColumnErrorThick(maxC%),ColumnErrorCap(maxC%),ColumnColour%(maxC%),drawn%(maxC%)
  36.  ColumnLinecol%(maxC%),ColumnCharcol%(maxC%)
  37.  ColumnLinestyle%(maxC%),ColumnDash2(maxC%)
  38.  ColumnX%(maxC%)
  39.  Data% 5*C1%*P1%,DataStatus% C1%*P1%
  40. i%=0 
  41. C1%*P1%-4 
  42. 4:DataStatus%!i%=0:
  43.  Save$(5),FileType$(5),OldSave$(5)
  44.  groupheader%(3)
  45.  style$(2):style$(0)="
  46. ":style$(1)="
  47. ":style$(2)="
  48. defaultsavevars
  49. sel%=1<<21:grey%=1<<22
  50. 37leftwidth%=96:topheight%=80:ox%=0:x%=ox%+leftwidth%
  51.  --- initial values for variables ---
  52. 52quit%=
  53. :fileopen%=0:juststarted%=
  54. :mainopen%=
  55. 65caretcolumn%=0:caretrow%=0:maxcolumn%=0:maxrow%=0
  56. 77caret$="              ":caretoffset%=11:gotcaret%=
  57. 8/caretx1%=0:caretx2%=0:carety1%=0:carety2%=0
  58. 9(changed%=
  59. :TauFileName$="<Untitled>"
  60. importdrawfile%=
  61. defaultvars
  62.  --- initial actions ---
  63. =%*FontCat { > <Tau$Dir>.FontList }
  64. loadDFMPicker:ViewOn%=
  65. :ViewLength%=0:ViewScale0=1:ViewScaleFactor=0.9:ViewUpdate%=
  66. setupsprites
  67.  stdum% 4
  68. !stdum%=0
  69. "Wimp_Initialise",310,&4B534154,"Tau",stdum% 
  70.  ,taskhandle%
  71. error1
  72. 23,255,255,255,255,255,255,255,255,255:fill$=
  73. templates
  74. definemenus
  75. iconbaricon
  76. opendatawindow:
  77. caretstring(-1)
  78. juststarted% juststarted%=
  79. Tautoload 
  80. error
  81. K!MinSlotSize%=
  82. -&8000:Himem%=
  83. "Wimp_Poll",%110001,block% 
  84.  reason%
  85.  reason% 
  86.  user redraw of window
  87. !block%=viewhandle% 
  88. "Hourglass_On"
  89. T9  !block%=viewhandle%:
  90. "Wimp_GetWindowState",,block%
  91. U9  ViewMatrixScale%=ViewScale0*ViewScaleFactor*(1<<16)
  92. V+  !block1%=ViewMatrixScale%:block1%!4=0
  93. W-  block1%!8=0:block1%!12=ViewMatrixScale%
  94. XQ  block1%!16=256*((block%!4+block%!12) 
  95. 2 -ViewX%*ViewScale0*ViewScaleFactor)
  96. YQ  block1%!20=256*((block%!8+block%!16) 
  97. 2 -ViewY%*ViewScale0*ViewScaleFactor)
  98.  !block% <> colourhandle% 
  99. "Wimp_RedrawWindow",,block% 
  100.  flag%
  101.  flag%
  102. !block% 
  103. columnhandle%:
  104. redrawcolumn
  105. viewhandle%:
  106. redrawview
  107.  colourhandle%:
  108.  do nothing
  109. userdraw
  110. "Wimp_GetRectangle",,block% 
  111.  flag%
  112. !block%=viewhandle% 
  113. "Hourglass_Smash"
  114.  open window
  115.  !block% 
  116.  mainhandle%:
  117. datawindowmoved
  118.  colourhandle%:
  119.  ignore
  120. "Wimp_OpenWindow",,block%
  121.  close window
  122. !block%=mainhandle% 
  123. ViewOn% 
  124. closewindow(viewhandle%):ViewOn%=
  125. "Wimp_SlotSize",MinSlotSize%,-1
  126. changed% 
  127. Tjeopardy mainopen%=
  128.    mainopen%=
  129. mainopen%=
  130. cleardata
  131. recordcaret(
  132. }"   
  133. closewindow(cornerhandle%)
  134. closewindow(tophandle%)
  135. closewindow(lefthandle%)
  136. closewindow(mainhandle%)
  137. closewindow(columnhandle%)
  138. closewindow(framehandle%)
  139. closewindow(sizehandle%)
  140. closewindow(!block%)
  141. !block%=viewhandle% ViewOn%=
  142. "Wimp_SlotSize",MinSlotSize%,-1
  143.  mouse click
  144. N x%=!block%:y%=block%!4:button%=block%!8:window%=block%!12:icon%=block%!16
  145. window%=mainhandle% 
  146. recordcaret(
  147.  button% 
  148.  menu clicked
  149.  window% 
  150.  mainhandle%,tophandle%,lefthandle%,cornerhandle%
  151. @   ?WarningItem%=(?WarningItem% 
  152. &FE) 
  153. (JeopardyWarning% 
  154. "Wimp_CreateMenu",,mainmenu%,x%-64,y%
  155. closewindow(columnhandle%):
  156. closewindow(framehandle%):
  157. closewindow(sizehandle%)
  158.    menutree$="main"
  159. viewhandle%:
  160. 9   ?UpdateItem%=(?UpdateItem% 
  161. &FE) 
  162. (ViewUpdate% 
  163. "Wimp_CreateMenu",,viewmenu%,x%-64,y%
  164.    menutree$="view"
  165. sizehandle%:
  166.  icon%=30 
  167.      ty$="keyfill"
  168. 9     
  169. opencolour("Key background colour",s%(30),30,1)
  170.  icon%=32 
  171.      ty$="keyborder"
  172. 5     
  173. opencolour("Key border colour",s%(32),32,1)
  174. framehandle%:
  175.  icon%=13 
  176.      ty$="framefill"
  177. 5     
  178. opencolour("Background colour",s%(13),13,1)
  179.  icon%=14 
  180.      ty$="framecol"
  181. A     
  182. opencolour("Frame, labels and text colour",s%(14),14,1)
  183. columnhandle%:
  184.  icon%=41 
  185.  icon%=43 
  186.  (icon%=15 
  187.  g%(15))
  188.  icon%=41 
  189.       ty$="colline"
  190. 0      
  191. opencolour("Line colour",s%(41),41,1)
  192.         
  193.  icon%=43 
  194.       ty$="colchar"
  195. 5      
  196. opencolour("Character colour",s%(43),43,1)
  197.         
  198.  icon%=15 
  199.       ty$="colfill"
  200. 0      
  201. opencolour("Fill colour",s%(15),15,1)
  202.         
  203.  icon%=47 
  204. "Wimp_CreateMenu",,stylemenu%,x%-64,y%
  205.    menutree$="styles"
  206. "Wimp_CreateMenu",,iconbarmenu%,x%-64,96+2*44
  207.    menutree$="iconbar"
  208.  adjust,select clicked (or double-clicked instead for mainhandle)
  209.  window% 
  210. opendatawindow:
  211. caretstring(-1)
  212. mainhandle%:
  213. button%=4 
  214. n    
  215. Tshift 
  216. highlight(0,maxcolumn%,caretrow%,caretrow%) 
  217. highlight(caretcolumn%,caretcolumn%,0,maxrow%)
  218. closewindow(columnhandle%):
  219. closewindow(framehandle%)
  220. closewindow(sizehandle%)
  221. cornerhandle%:
  222. closewindow(columnhandle%):
  223. closewindow(framehandle%)
  224. closewindow(sizehandle%)
  225. view(0)
  226. viewhandle%:
  227. Tshift 
  228. viewmouse(2) 
  229. viewmouse(button%)
  230. columnhandle%:
  231.  icon%=41 
  232.  icon%=43 
  233.  icon%=15 
  234.  g%(15) 
  235.  icon%=41 
  236.       ty$="colline"
  237. 0      
  238. opencolour("Line colour",s%(41),41,1)
  239.         
  240.  icon%=43 
  241.       ty$="colchar"
  242. 5      
  243. opencolour("Character colour",s%(43),43,1)
  244.         
  245.  icon%=15 
  246.       ty$="colfill"
  247. 0      
  248. opencolour("Fill colour",s%(15),15,1)
  249.         
  250. '    
  251. selectvariables(window%,icon%)
  252.  icon%=1 
  253.  icon%=2 
  254. closewindow(columnhandle%):
  255. cancelOK
  256. corrnhandle%:
  257.  icon%=1 
  258.  icon%=2 
  259. closewindow(corrnhandle%)   
  260. edithandle%:
  261.  icon%=1 
  262. pkiedit
  263.  icon%=2 
  264. closewindow(edithandle%):
  265. "Wimp_CreateMenu",,-1
  266. sizehandle%:
  267.  (icon%=30 
  268.  icon%=32) 
  269.  icon%=30 
  270.       ty$="keyfill"
  271. :      
  272. opencolour("Key background colour",s%(30),30,1)
  273.         
  274.  icon%=32 
  275.       ty$="keyborder"
  276. 6      
  277. opencolour("Key border colour",s%(32),32,1)
  278.         
  279. '    
  280. selectvariables(window%,icon%)
  281. =    
  282. icon%=1 
  283. icon%=2 
  284. closewindow(sizehandle%):
  285. cancelOK
  286. framehandle%:
  287.  (icon%=13 
  288.  s%(11)) 
  289.  icon%=14 
  290.  icon%=13 
  291.  s%(11) 
  292.       ty$="framefill"
  293. <      
  294. opencolour("Background frame colour",s%(13),13,1)
  295.         
  296.  icon%=14 
  297.      ty$="framecol"
  298. A     
  299. opencolour("Frame, labels and text colour",s%(14),14,1)
  300.         
  301. '    
  302. selectvariables(window%,icon%)
  303. >    
  304. icon%=1 
  305. icon%=2 
  306. closewindow(framehandle%):
  307. cancelOK
  308. colourhandle%:
  309.  ignore
  310. icon%=1 
  311. icon%=2 
  312. cancelOK
  313.     '    
  314. selectvariables(window%,icon%)
  315. 16,64:
  316.  drag
  317. window%=savehandle% 
  318. icon%=0 
  319. :   !block%=savehandle%:
  320. "Wimp_GetWindowState",,block%
  321. 3   x%=block%!4-block%!20:y%=block%!16-block%!24
  322. 3   block%!4=icon%:
  323. "Wimp_GetIconState",,block%
  324. Q   xmin%=x%+block%!8:ymin%=y%+block%!12:xmax%=x%+block%!16:ymax%=y%+block%!20
  325. P   block%!4=5:block%!8=xmin%:block%!12=ymin%:block%!16=xmax%:block%!20=ymax%
  326. F   block%!24=0:block%!28=0:block%!32=&7FFFFFFF:block%!36=&7FFFFFFF
  327. "Wimp_DragBox",,block%
  328. 256,1024:
  329.  click when double-click is active
  330. window%=mainhandle% 
  331.    !block%=mainhandle%
  332. "Wimp_GetWindowState",,block%
  333. 5   ox%=block%!4-block%!20:oy%=block%!16-block%!24
  334. H   column%=(x%-ox%-leftwidth%) 
  335. (14*16):row%=(oy%-y%-topheight%) 
  336. column%>C% column%=C% 
  337. column%<0 column%=0
  338. row%>P% row%=P% 
  339. row%<0 crow%=0
  340. redrawmain(caretx1%,caretx2%,carety1%,carety2%)
  341. button%=256 
  342.  O    caretx1%=caretcolumn%:caretx2%=column%:carety1%=caretrow%:carety2%=row%
  343. !A    
  344. caretx1%>caretx2% caretx2%=caretcolumn%:caretx1%=column%
  345. ";    
  346. carety1%>carety2% carety2%=caretrow%:carety1%=row%
  347. caretstring(-1)
  348. %J    caretx1%=column%:carety1%=row%:caretx2%=caretx1%:carety2%=carety1%
  349. &+    caretcolumn%=column%:caretrow%=row%
  350. '5    
  351. caretstring(((x%-ox%-leftwidth%-8) 
  352. )7   
  353. redrawmain(caretx1%,caretx2%,carety1%,carety2%)
  354.  drag box
  355. "Wimp_GetPointerInfo",,block%:window%=block%!12
  356.  window% 
  357.  colourhandle%:
  358.  ignore this
  359. putsave
  360. 3,   Save$=Save$(SaveType%):i%=
  361. Save$,".")
  362.     Save$=
  363. Save$,i%+1)
  364.     i%=
  365. Save$,".")
  366. 8O   destx%=!block%:desty%=block%!4:desthandle%=block%!12:desticon%=block%!16
  367. 9!   !block%=4*((49+
  368. Save$) 
  369. :H   block%!12=0:block%!16=1:block%!20=desthandle%:block%!24=desticon%
  370. ;9   block%!28=destx%:block%!32=desty%:block%!36=&10000
  371. <0   block%!40=
  372. ("&"+
  373. FileType$(SaveType%),3))
  374.    $(block%+44)=Save$+
  375. >;   
  376. "Wimp_SendMessage",18,block%,desthandle%,desticon%
  377.  key pressed
  378. B# key%=block%!24:window%=!block%
  379. !block%=mainhandle% 
  380. flush
  381.  key% 
  382.  &183: 
  383. G'   
  384.  "Wimp_GetPointerInfo",,block%
  385. H;   
  386. "Wimp_CreateMenu",,savehandle%,!block%-64,block%!4
  387.    SaveType%=0
  388. getsave
  389. KA   
  390. "Wimp_SetCaretPosition",savehandle%,3,0,0,-1,
  391. (Save$(0))
  392. &18E:
  393.  down arrow
  394. Mo   
  395. caretrow%<P% 
  396. recordcaret(
  397. ):caretrow%+=1:
  398. oneselect(-1):
  399. getmaininfo:
  400. caretrow%>brow%-2 
  401. scrollarea(1)
  402. &18F:
  403.  up arrow
  404. On   
  405. caretrow%>0 
  406. recordcaret(
  407. ):caretrow%-=1:
  408. oneselect(-1):
  409. getmaininfo:
  410. caretrow%<trow%+2 
  411. scrollarea(2)
  412. &1AE:
  413.  CTRL-down
  414. QA   
  415. recordcaret(
  416. ):caretrow%=P%:
  417. scrollarea(5):
  418. oneselect(-1)
  419. &1AF:
  420.  CTRL-up
  421. S@   
  422. recordcaret(
  423. ):caretrow%=0:
  424. scrollarea(6):
  425. oneselect(-1)
  426. &19C:
  427.  SHIFT-left
  428. getmaininfo:i%=-1
  429. VZ   
  430. caretx2%>caretcolumn% i%=caretx2%:caretx2%-=1 
  431. caretx1%>0 caretx1%-=1:i%=caretx1%
  432. WP   
  433. i%>-1 
  434. redrawmain(i%,i%,carety1%,carety2%):
  435. i%<lcolumn%+1 
  436. scrollarea(4)
  437. &19D:
  438.  SHIFT-right
  439. getmaininfo:i%=-1
  440. Z[   
  441. caretx1%<caretcolumn% i%=caretx1%:caretx1%+=1 
  442. caretx2%<C% caretx2%+=1:i%=caretx2%
  443. [P   
  444. i%>-1 
  445. redrawmain(i%,i%,carety1%,carety2%):
  446. i%>rcolumn%-1 
  447. scrollarea(3)
  448. &19E:
  449.  SHIFT-down
  450. getmaininfo:i%=-1
  451. ^X   
  452. carety1%<caretrow% i%=carety1%:carety1%+=1 
  453. carety2%<P% carety2%+=1:i%=carety2%
  454. _M   
  455. i%>-1 
  456. redrawmain(caretx1%,caretx2%,i%,i%):
  457. i%>brow%-2 
  458. scrollarea(1)
  459. &19F:
  460.  SHIFT-up
  461. getmaininfo:i%=-1
  462. bW   
  463. carety2%>caretrow% i%=carety2%:carety2%-=1 
  464. carety1%>0 carety1%-=1:i%=carety1%
  465. cM   
  466. i%>-1 
  467. redrawmain(caretx1%,caretx2%,i%,i%):
  468. i%<trow%+2 
  469. scrollarea(2)
  470. &18A:
  471. e)   
  472. recordcaret(
  473. caretcolumn%<C% 
  474. f[    caretcolumn%+=1:
  475. oneselect(11):
  476. getmaininfo:
  477. caretcolumn%>rcolumn%-1 
  478. scrollarea(3)
  479. hO    
  480. caretrow%<P% caretcolumn%=0:caretrow%+=1:
  481. oneselect(11):
  482. scrollarea(9)
  483. &19A:
  484.  SHIFT-TAB
  485. k(   
  486. recordcaret(
  487. caretcolumn%>0 
  488. l[    caretcolumn%-=1:
  489. oneselect(11):
  490. getmaininfo:
  491. caretcolumn%<lcolumn%+1 
  492. scrollarea(4)
  493. nP    
  494. caretrow%>0 caretcolumn%=C%:caretrow%-=1:
  495. oneselect(11):
  496. scrollarea(10)
  497.  home
  498. qO   
  499. recordcaret(
  500. ):caretcolumn%=0:caretrow%=0:
  501. oneselect(11):
  502. scrollarea(7)
  503. &19B:
  504.  SHIFT-copy/end
  505. s^   
  506. recordcaret(
  507. ):caretcolumn%=maxcolumn%:caretrow%=maxrow%:
  508. oneselect(11):
  509. scrollarea(8)
  510. &18D:
  511.  right arrow
  512. caretoffset%<11 
  513. v"    caretoffset%+=1:
  514. movecaret
  515. x{    
  516. caretcolumn%<C% 
  517. recordcaret(
  518. ):caretcolumn%+=1:
  519. oneselect(0):
  520. getmaininfo:
  521. caretcolumn%>rcolumn%-1 
  522. scrollarea(3)
  523. &18C:
  524.  left arrow
  525. {&   
  526. caretoffset%>11-
  527. caretshort$ 
  528. |"    caretoffset%-=1:
  529. movecaret
  530. ~{    
  531. caretcolumn%>0 
  532. recordcaret(
  533. ):caretcolumn%-=1:
  534. oneselect(11):
  535. getmaininfo:
  536. caretcolumn%<lcolumn%+1 
  537. scrollarea(4)
  538.  backspace
  539. (   pos%=
  540. caretshort$-11+caretoffset%
  541. pos%>0 caretshort$=
  542. caretshort$,pos%-1)+
  543. caretshort$,pos%+1)
  544. 3   caret$=
  545. "             "+caretshort$+"  ",14)
  546. redrawmain(caretcolumn%,caretcolumn%,caretrow%,caretrow%)
  547.  return
  548. recordcaret(
  549. oneselect(11)
  550. Tshift 
  551. caretcolumn%<C% 
  552. \     caretcolumn%+=1:
  553. oneselect(11):
  554. getmaininfo:
  555. caretcolumn%>rcolumn%-1 
  556. scrollarea(3)
  557.         
  558. P     
  559. caretrow%<P% caretcolumn%=0:caretrow%+=1:
  560. oneselect(11):
  561. scrollarea(9)
  562.         
  563. Tctrl 
  564. P     
  565. caretrow%<P% caretcolumn%=0:caretrow%+=1:
  566. oneselect(11):
  567. scrollarea(9)
  568.         
  569. caretrow%<P% caretrow%+=1:
  570. oneselect(11):
  571. getmaininfo:
  572. caretrow%>brow%-2 
  573. scrollarea(1)
  574.         
  575.  delete
  576. Tshift 
  577. caretrow%<=maxrow% 
  578.      
  579. changed(
  580. 8     
  581. j%=caretx1% 
  582. caretx2%:
  583. i%=caretrow% 
  584. maxrow%-1
  585. %     
  586. data(j%,i%,
  587. Tdata(j%,i%+1))
  588. <     DataStatus%?(j%+C1%*i%)=DataStatus%?(j%+C1%*(i%+1))
  589. +     
  590. :DataStatus%?(j%+C1%*maxrow%)=0:
  591. 9     maxrow%-=1:
  592. caretstring(11):
  593. update(mainhandle%)
  594.         
  595. )    pos%=
  596. caretshort$-11+caretoffset%
  597. E    
  598. pos%>0 caretshort$=
  599. caretshort$,pos%-1)+
  600. caretshort$,pos%+1)
  601. 4    caret$=
  602. "             "+caretshort$+"  ",14)
  603. B    
  604. redrawmain(caretcolumn%,caretcolumn%,caretrow%,caretrow%)
  605. &1CD:
  606.  insert
  607. caretrow%<P% 
  608. caretrow%<=maxrow% 
  609. changed(
  610. ):maxrow%+=1
  611. ;    
  612. j%=caretx1% 
  613. caretx2%:
  614. i%=maxrow% 
  615. caretrow%+1 
  616. $    
  617. data(j%,i%,
  618. Tdata(j%,i%-1))
  619. ;    DataStatus%?(j%+C1%*i%)=DataStatus%?(j%+C1%*(i%-1))
  620. ,    
  621. :DataStatus%?(j%+C1%*caretrow%)=0:
  622. E    caretrow%+=1:carety1%=caretrow%:carety2%=caretrow%:
  623. movecaret
  624. 6    
  625. getmaininfo:
  626. caretrow%>brow%-2 
  627. scrollarea(1)
  628. update(mainhandle%)
  629.  CTRL-U
  630. i%=caretx1% 
  631. caretx2%:
  632. j%=carety1% 
  633. carety2%
  634. #   DataStatus%?(i%+C1%*j%)=0:
  635. caretstring(11):
  636. redrawmain(caretx1%,caretx2%,carety1%,carety2%)
  637. changed(
  638. maxcolumnrow
  639.  including valid characters
  640. "Mm0123456789.E- ",
  641. key%)=0 
  642.      
  643. "Wimp_ProcessKey",key%
  644. )    pos%=
  645. caretshort$-11+caretoffset%
  646. A    caretshort$=
  647. caretshort$,pos%)+
  648. key%+
  649. caretshort$,pos%+1)
  650. 4    
  651. caretshort$>10 caretshort$=
  652. caretshort$,2)
  653. 4    caret$=
  654. "             "+caretshort$+"  ",14)
  655. B    
  656. redrawmain(caretcolumn%,caretcolumn%,caretrow%,caretrow%)
  657.  window% 
  658.  colourhandle%:
  659.  do nothing
  660.  key% 
  661.  return
  662. #    button%=4:icon%=1:
  663. cancelOK
  664. "Wimp_ProcessKey",key%
  665.  menu selection
  666. "Wimp_GetPointerInfo",,block1%
  667. S x%=!block1%:y%=block1%!4:button%=block1%!8:window%=block1%!12:icon%=block1%!16
  668.  adjust%=(button%=1)
  669.  menutree$ 
  670.  "iconbar":
  671.  !block% 
  672.  quit selected
  673. changed% 
  674.     quit%=
  675. Tjeopardy
  676.     quit%=
  677. adjust% 
  678. "Wimp_CreateMenu",,iconbarmenu%
  679.  "view":
  680.  !block% 
  681.  redraw to default size
  682. 8   ViewScaleFactor=0.9:ViewX%=ViewX0%:ViewY%=ViewY0%
  683. "Wimp_ForceRedraw",viewhandle%,0,-2000,2000,0
  684.  replot graph
  685. view(0)
  686.  toggle auto-update flag
  687.    ViewUpdate%=
  688. ViewUpdate%
  689. ViewUpdate% 
  690. view(0)
  691. adjust% ?UpdateItem%=(?UpdateItem% 
  692. &FE) 
  693. (ViewUpdate% 
  694. "Wimp_CreateMenu",,viewmenu%
  695.  "styles":
  696. setthestyle(block%!0)
  697.  "main":
  698.  !block% 
  699.  paper, new for 1.50
  700.  block%!4=0 
  701. getvariables(sizehandle%):
  702. openwindow(sizehandle%)
  703.  graph, new for 1.50
  704. block%!4=1 
  705. getvariables(framehandle%):
  706. openwindow(framehandle%)
  707.  Column
  708. block%!4=0 
  709. getvariables(columnhandle%):
  710. openwindow(columnhandle%)
  711. block%!4=3 
  712. calculate
  713. block%!4=5 
  714. normalise
  715. block%!4=6 
  716.  Save
  717.    SaveType%=block%!4
  718.  Cells
  719.  block%!4 
  720.  whole row
  721. 5     
  722. highlight(0,maxcolumn%,caretrow%,caretrow%)
  723.  whole column
  724. 8     
  725. highlight(caretcolumn%,caretcolumn%,0,maxrow%)
  726.  to top
  727. :     
  728. highlight(caretcolumn%,caretcolumn%,0,caretrow%)
  729.  to bottom
  730. @     
  731. highlight(caretcolumn%,caretcolumn%,caretrow%,maxrow%)
  732.  all data
  733. +     
  734. highlight(0,maxcolumn%,0,maxrow%)
  735.  Reduce
  736.  block%!4 
  737.  Compact
  738. compact
  739.  Clear
  740. changed% 
  741.      
  742. Tjeopardy 
  743. cleardata
  744.         
  745.      
  746. cleardata
  747.         
  748.  Warnings
  749. *    JeopardyWarning%=
  750. JeopardyWarning%
  751.  View
  752. view(0)
  753.  Multiple Xs
  754. &   !iMultipleX% = !iMultipleX% 
  755.     MultipleX% = 
  756.  MultipleX%
  757.  k,M, G labels
  758.    suffix%=
  759.  suffix%
  760.    !isuffix%=!isuffix% 
  761. adjust% ?WarningItem%=(?WarningItem% 
  762. &FE) 
  763. (JeopardyWarning% 
  764. "Wimp_CreateMenu",,mainmenu%
  765. report("No such menu tree!")
  766.  lose caret
  767. window%=block%!0
  768.  window%<>colourhandle% 
  769. recordcaret(
  770.  gotcaret%=
  771.  gain caret
  772. window%=block%!0
  773.  window%<>colourhandle% gotcaret%=
  774. 17,18:
  775.  message system
  776.  block%!16 
  777.  quit
  778.   quit%=
  779.  pre-quit
  780. changed% 
  781. Tjeopardy 
  782.     block%!12=block%!8
  783. 0(    
  784. "Wimp_SendMessage",19,block%,0
  785. &400C9:
  786.  colour picker
  787.     block%!12=block%!8
  788. 5(    
  789. "Wimp_SendMessage",19,block%,0
  790. &47700:
  791.  colour picked
  792.  ty$ 
  793.       
  794.  "colline":
  795.        s%(41)=block%!28
  796. :8       
  797. setcolour(columnhandle%,41,block%!28,"line")
  798.       
  799.  "colchar":
  800.        s%(43)=block%!28
  801. =8       
  802. setcolour(columnhandle%,43,block%!28,"char")
  803.       
  804.  "colfill":
  805.        s%(15)=block%!28
  806. @8       
  807. setcolour(columnhandle%,15,block%!28,"fill")
  808.       
  809.  "framefill":
  810.        s%(13)=block%!28
  811. C7       
  812. setcolour(framehandle%,13,block%!28,"fill")
  813.       
  814.  "framecol":
  815.        s%(14)=block%!28
  816. F7       
  817. setcolour(framehandle%,14,block%!28,"line")
  818.       
  819.  "keyfill":
  820.        s%(30)=block%!28
  821. I6       
  822. setcolour(sizehandle%,30,block%!28,"fill")
  823.       
  824.  "keyborder":
  825.        s%(32)=block%!28
  826. L6       
  827. setcolour(sizehandle%,32,block%!28,"line")
  828. M        
  829. &47702:
  830.  close colour picker
  831. "ColourPicker_CloseDialogue",0,dialogue%
  832. &400C1:
  833.  mode change
  834. &400C0:
  835.  menu warning
  836. R1  handle%=block%!20:x%=block%!24:y%=block%!28
  837. handle%=savehandle% SaveType%=block%!36
  838. getvariables(handle%)
  839. "Wimp_CreateSubMenu",,handle%,x%,y%
  840.  DataLoad
  841. W-  file$=
  842. Tzeroterminatedstring(block%+44)
  843.   filetype%=block%!40
  844.  DataSaveAck
  845. [8  Save$(SaveType%)=
  846. Tzeroterminatedstring(block%+44)
  847.  now send a DataLoad message
  848. ]$  block%!12=block%!8:block%!16=3
  849. "Wimp_SendMessage",18,block%,block%!4
  850. getsave
  851. update(savehandle%)
  852. "Wimp_CreateMenu",,-1
  853. quit%
  854. "Wimp_CloseDown"
  855. data(col%,row%,val)
  856. k"|(Data%+5*col%+5*C1%*row%)=val
  857. Tdata(col%,row%)
  858. =|(Data%+5*col%+5*C1%*row%)
  859. loadDFMPicker
  860.  try to find the DrawFile and ColourPicker modules
  861. TpresentDFM 
  862. "XOS_Module",1,"<Tau$Dir>.DrawFile"
  863. TpresentPicker 
  864. "XOS_Module",1,"<Tau$Dir>.Picker"
  865. TpresentDFM
  866. length%,flag%
  867. *Set TauDraw$Exists Yes
  868. z1*RMEnsure DrawFile 1.01 Set TauDraw$Exists No
  869. "XOS_ReadVarVal","TauDraw$Exists",block3%,255,0,0 
  870.  ,,length%
  871. length%>255 =
  872. block3%?length%=13
  873. =($block3%="Yes")
  874. TpresentPicker
  875. length%,flag%
  876. *Set TauPicker$Exists Yes
  877. 7*RMEnsure ColourPicker 0.39 Set TauPicker$Exists No
  878. "XOS_ReadVarVal","TauPicker$Exists",block3%,255,0,0 
  879.  ,,length%
  880. length%>255 =
  881. block3%?length%=13
  882. =($block3%="Yes")
  883. error1:@%=&90A
  884. report("fatal error: "+
  885. $+" (line "+
  886. +")")
  887. "Wimp_CloseDown"
  888. error:@%=&90A
  889. report(
  890. $+" (line "+
  891. +")")
  892. fileopen% 
  893. #fileopen%:fileopen%=0
  894. "OS_Byte",121,112 
  895. ,escpressed%
  896. escpressed% 
  897. "Wimp_CloseDown":
  898. "Wimp_CreateMenu",,-1
  899. ViewOn% 
  900. closewindow(viewhandle%):ViewOn%=
  901. "Wimp_SlotSize",MinSlotSize%,-1
  902. report(i$)
  903. #!block3%=255:$(block3%+4)=i$+
  904. "Wimp_ReportError",block3%,1,"Tau"
  905. Tjeopardy
  906. JeopardyWarning% 
  907. !block3%=255
  908. /$(block3%+4)="Data in jeopardy - proceed ?"
  909. "Wimp_ReportError",block3%,&13,"Tau" 
  910. ,response%
  911. =(response%=1)
  912. templates
  913. workspace%=workspace0%
  914. 'endwork%=workspace0%+workspacesize%
  915. "Wimp_OpenTemplate",,"<Tau$Dir>.Templates"
  916. )mainhandle%=
  917. Tgettemplate("DataMain")
  918. 'tophandle%=
  919. Tgettemplate("DataTop")
  920. )lefthandle%=
  921. Tgettemplate("DataLeft")
  922. ;X1%=block%!40:Y1%=block%!44:X2%=block%!48:Y2%=block%!52
  923. 'framehandle%=
  924. Tgettemplate("Frame")
  925. 'tickshandle%=
  926. Tgettemplate("Ticks")
  927. 'gridshandle%=
  928. Tgettemplate("Grids")
  929. )labelshandle%=
  930. Tgettemplate("Labels")
  931. %sizehandle%=
  932. Tgettemplate("Size")
  933. +scalinghandle%=
  934. Tgettemplate("Scaling")
  935. )columnhandle%=
  936. Tgettemplate("Column")
  937. %savehandle%=
  938. Tgettemplate("Save")
  939. %infohandle%=
  940. Tgettemplate("Info")
  941. /calculatehandle%=
  942. Tgettemplate("Calculate")
  943. +optionshandle%=
  944. Tgettemplate("Options")
  945. +bestfithandle%=
  946. Tgettemplate("BestFit")
  947. 'fontshandle%=
  948. Tgettemplate("Fonts")
  949. -cornerhandle%=
  950. Tgettemplate("DataCorner")
  951. -axistexthandle%=
  952. Tgettemplate("AxisText")
  953. +magnifyhandle%=
  954. Tgettemplate("Magnify")
  955. +meaninghandle%=
  956. Tgettemplate("Meaning")
  957. %weedhandle%=
  958. Tgettemplate("Weed")
  959. )importhandle%=
  960. Tgettemplate("Import")
  961. )downtohandle%=
  962. Tgettemplate("Downto")
  963. %manyhandle%=
  964. Tgettemplate("Many")
  965. /worksheethandle%=
  966. Tgettemplate("Worksheet")
  967. %viewhandle%=
  968. Tgettemplate("View")
  969. 'corrnhandle%=
  970. Tgettemplate("Corrn")
  971. %edithandle%=
  972. Tgettemplate("Edit")
  973. "Wimp_CloseTemplate"
  974. !block%=mainhandle%
  975. "Wimp_GetWindowInfo",,block%
  976. titlebuffer%=block%!76
  977. !block%=viewhandle%
  978. "Wimp_GetWindowInfo",,block%
  979. viewtitlebuffer%=block%!76
  980. changed(
  981. L!block1%=tophandle%:
  982. "Wimp_GetWindowState",,block1%:topflag%=block1%!32
  983. N!block2%=lefthandle%:
  984. "Wimp_GetWindowState",,block2%:leftflag%=block2%!32
  985. R!block3%=cornerhandle%:
  986. "Wimp_GetWindowState",,block3%:cornerflag%=block3%!32
  987. setextent
  988. Tgettemplate(temp$)
  989. $block2%=temp$
  990. "Wimp_LoadTemplate",,block%,workspace%,endwork%,-1,block2%,0 
  991. ,,workspace%
  992. temp$="Save" block%!112=1:
  993.  special pleading !!!
  994.  temp$ 
  995.  "Column":
  996. ,block%!64=spritearea%:
  997.  point to sprites
  998. $block%!(88+15*32+24)=spritearea%
  999. $block%!(88+41*32+24)=spritearea%
  1000. $block%!(88+43*32+24)=spritearea%
  1001.  "Frame":
  1002. ,block%!64=spritearea%:
  1003.  point to sprites
  1004. $block%!(88+13*32+24)=spritearea%
  1005. $block%!(88+14*32+24)=spritearea%
  1006.  "Size":
  1007. ,block%!64=spritearea%:
  1008.  point to sprites
  1009. $block%!(88+30*32+24)=spritearea%
  1010. $block%!(88+32*32+24)=spritearea%
  1011. "Wimp_CreateWindow",,block% 
  1012.  handle%
  1013. =handle%
  1014. setextent
  1015.  assumes C% and P% (and C1% and P1%) are set to valid new values
  1016.  and that any data is cleared (with the user's agreement).
  1017. )!block%=0:block%!4=-topheight%-32*P1%
  1018. -block%!8=leftwidth%+14*16*C1%:block%!12=0
  1019. "Wimp_SetExtent",mainhandle%,block%
  1020. (block%!4=-32*P1%:block%!8=leftwidth%
  1021. "Wimp_SetExtent",lefthandle%,block%
  1022. +block%!4=-topheight%:block%!8=14*16*C1%
  1023. "Wimp_SetExtent",tophandle%,block%
  1024. !block%=mainhandle%
  1025. "Wimp_GetWindowState",,block%
  1026. datawindowmoved
  1027. changed(i%)
  1028. x1%,x2%,y2%
  1029. changed%=i%
  1030. changed% $titlebuffer%=TauFileName$+" *" 
  1031. $titlebuffer%=TauFileName$
  1032. !block%=mainhandle%
  1033. "Wimp_GetWindowState",,block%
  1034. ,x1%=block%!4:x2%=block%!12:y2%=block%!16
  1035. "Wimp_ForceRedraw",-1,x1%,y2%,x2%,y2%+44
  1036. ViewOn% 
  1037. changed% 
  1038. ViewUpdate% 
  1039. view(0) 
  1040. viewchanged(
  1041. viewchanged(i%)
  1042. x1%,x2%,y2%
  1043. i% $viewtitlebuffer%=TauFileName$+" (has been modified)" 
  1044. $viewtitlebuffer%=TauFileName$
  1045. !block%=viewhandle%
  1046. "Wimp_GetWindowState",,block%
  1047. ,x1%=block%!4:x2%=block%!12:y2%=block%!16
  1048. "Wimp_ForceRedraw",-1,x1%,y2%,x2%,y2%+44
  1049. opendatawindow
  1050. mainopen%=
  1051. openwindow(tophandle%)
  1052. openwindow(lefthandle%)
  1053. openwindow(cornerhandle%)
  1054. openwindow(mainhandle%)
  1055. 7!block%=mainhandle%:
  1056. "Wimp_GetWindowState",,block%
  1057. block%!28=-1
  1058. datawindowmoved
  1059. openwindow(handle%)
  1060. !block%=handle%
  1061. "Wimp_GetWindowState",,block%
  1062. "Wimp_OpenWindow",,block%
  1063. datawindowmoved
  1064. reopenmain%
  1065. reopenmain%=
  1066. #8!block1%=tophandle%:
  1067. "Wimp_GetWindowState",,block1%
  1068. $"new%=block%!28:old%=block1%!28
  1069. new%<>old% reopenmain%=
  1070. block%!28=cornerhandle%
  1071. "Wimp_OpenWindow",,block%
  1072. '/!block2%=lefthandle%:!block3%=cornerhandle%
  1073. (Gblock1%!4=block%!4+leftwidth%:block2%!4=block%!4:block3%!4=block%!4
  1074. )Tblock1%!8=block%!16-topheight%:block2%!8=block%!8:block3%!8=block%!16-topheight%
  1075. *Vblock1%!12=block%!12:block2%!12=block%!4+leftwidth%:block3%!12=block%!4+leftwidth%
  1076. +Mblock1%!16=block%!16:block2%!16=block%!16-topheight%:block3%!16=block%!16
  1077. ,2block1%!20=block%!20:block2%!20=0:block3%!20=0
  1078. -2block1%!24=0:block2%!24=block%!24:block3%!24=0
  1079. .Cblock1%!32=topflag%:block2%!32=leftflag%:block3%!32=cornerflag%
  1080. /@block1%!28=new%:block2%!28=tophandle%:block3%!28=lefthandle%
  1081. "Wimp_OpenWindow",,block1%
  1082. "Wimp_OpenWindow",,block2%
  1083. "Wimp_OpenWindow",,block3%
  1084. reopenmain% block%!28=cornerhandle%:
  1085. "Wimp_OpenWindow",,block%
  1086. closewindow(handle%)
  1087. !block%=handle%
  1088. "Wimp_CloseWindow",,block%
  1089. Tshift
  1090. "OS_Byte",202,0,255 
  1091. ,status%
  1092. =(status% 
  1093. Tctrl
  1094. "OS_Byte",202,0,255 
  1095. ,status%
  1096. =(status% 
  1097. maxcolumnrow
  1098. j%,k%
  1099. EEk%=
  1100. j%=0 
  1101. maxrow%:k%=k% 
  1102. (DataStatus%?(maxcolumn%+C1%*j%)<>0):
  1103. (maxcolumn%>0) 
  1104.  maxcolumn%-=1
  1105. HF k%=
  1106. j%=0 
  1107. maxrow%:k%=k% 
  1108. (DataStatus%?(maxcolumn%+C1%*j%)<>0):
  1109. JEk%=
  1110. j%=0 
  1111. maxcolumn%:k%=k% 
  1112. (DataStatus%?(j%+C1%*maxrow%)<>0):
  1113. (maxrow%>0) 
  1114.  maxrow%-=1
  1115. MF k%=
  1116. j%=0 
  1117. maxcolumn%:k%=k% 
  1118. (DataStatus%?(j%+C1%*maxrow%)<>0):
  1119. getmaininfo
  1120. !block%=mainhandle%
  1121. "Wimp_GetWindowState",,block%
  1122. T2ox%=block%!4-block%!20:oy%=block%!16-block%!24
  1123. U9x1%=block%!4:x2%=block%!12:y1%=block%!8:y2%=block%!16
  1124. lcolumn%=(x1%-ox%) 
  1125. (16*14)
  1126. W*rcolumn%=(x2%-ox%-leftwidth%) 
  1127. (16*14)
  1128. trow%=(oy%-y2%) 
  1129. Y"brow%=(oy%-y1%-topheight%) 
  1130. scrollarea(type%)
  1131.  change the main window's visible area in some way
  1132. !block%=mainhandle%
  1133. "Wimp_GetWindowState",,block%
  1134.  type% 
  1135. 1:block%!24=block%!24-32:
  1136.  scroll down
  1137. 2:block%!24=block%!24+32:
  1138.  scroll up
  1139. 3:block%!20=block%!20+16*14:
  1140.  scroll right
  1141. 4:block%!20=block%!20-16*14:
  1142.  scroll left
  1143. 5:block%!24=-32*P1%-topheight%:
  1144.  bottom
  1145. 6:block%!24=0:
  1146. 7:block%!24=0:block%!20=0:
  1147.  home
  1148. 8:block%!24=-32*(maxrow%+2)+(block%!16-block%!8)-topheight%:block%!20=16*14*(maxcolumn%+1)-(block%!12-block%!4)+leftwidth%:
  1149. 9:block%!24=block%!24-32:block%!20=0:
  1150.  beginning of next line
  1151. 10:block%!24=block%!24+32:block%!20=14*16*C1%+leftwidth%:
  1152.  end of last line
  1153. block%!20<0 block%!20=0
  1154. block%!20>14*16*C1%+leftwidth%-(block%!12-block%!4) block%!20=14*16*C1%+leftwidth%-(block%!12-block%!4)
  1155. block%!24>0 block%!24=0
  1156. block%!24<-32*P1%-topheight%+(block%!16-block%!8) block%!24=-32*P1%-topheight%+(block%!16-block%!8)
  1157. datawindowmoved
  1158. oneselect(co%)
  1159.  collapse the selected area to the caret cell only
  1160. redrawmain(caretx1%,caretx2%,carety1%,carety2%)
  1161. v+caretx1%=caretcolumn%:caretx2%=caretx1%
  1162. w(carety1%=caretrow%:carety2%=carety1%
  1163. redrawmain(caretx1%,caretx2%,carety1%,carety2%)
  1164. caretstring(co%)
  1165. caretstring(co%)
  1166.  define the caret variables for the caret cell, and put the caret there
  1167.  DataStatus%?(caretcolumn%+C1%*caretrow%) 
  1168.  move flag
  1169.  caretshort$="M"
  1170.  caretoffset%=11
  1171.  numerical value
  1172.  @%=&100060D
  1173. 2 caretshort$=
  1174. Tdata(caretcolumn%,caretrow%))
  1175. co%>=0 caretoffset%=co%
  1176.  empty cell
  1177.  caretshort$=""
  1178.  caretoffset%=11
  1179. 255,"Bad DataStatus in PROCcaretstring"
  1180. 0caret$=
  1181. "             "+caretshort$+"  ",14)
  1182. movecaret
  1183. recordcaret(bigarea%)
  1184.  an edit of a cell has finished - record the result
  1185. altered%,ds%,d,cs$
  1186.  flag, new DataStatus%, new Data, old caretshort$
  1187. altered%=
  1188. :ds%=1
  1189. caretshort$,"M") 
  1190. caretshort$,"m") ds%=2
  1191. caretshort$=
  1192. caretshort$," ") ds%=0
  1193. caretshort$
  1194. bigarea% 
  1195. 8 x1%=caretx1%:x2%=caretx2%:y1%=carety1%:y2%=carety2%
  1196. 3 x1%=caretcolumn%:x2%=x1%:y1%=caretrow%:y2%=y1%
  1197. i%=x1% 
  1198. j%=y1% 
  1199. $@%=&100060D:cs$=
  1200. Tdata(i%,j%))
  1201. DataStatus%?(i%+C1%*j%)<>ds% 
  1202. (ds%=1 
  1203. cs$<>caretshort$) altered%=
  1204. data(i%,j%,d):DataStatus%?(i%+C1%*j%)=ds%
  1205. altered% 
  1206. caretx2%>maxcolumn% maxcolumn%=caretx2%
  1207. carety2%>maxrow% maxrow%=carety2%
  1208. changed(
  1209. movecaret
  1210. caretoffset%<11-
  1211. caretshort$ caretoffset%=11-
  1212. caretshort$ 
  1213. caretoffset%>11 caretoffset%=11
  1214. mainopen% 
  1215. "Wimp_SetCaretPosition",mainhandle%,-1,caretcolumn%*16*14+16*(caretoffset%+1)+leftwidth%,-caretrow%*32-36-topheight%,&40B0028,-1
  1216. userdraw
  1217.  screen co-ords of lop left of visible area
  1218. *topleftx%=block%!4:toplefty%=block%!16
  1219.  offset of top left of visible area from work area origin
  1220. )scrollx%=block%!20:scrolly%=block%!24
  1221.  screen co-ords of redraw rectangle
  1222. ;x1%=block%!28:y1%=block%!32:x2%=block%!36:y2%=block%!40
  1223.  screen co-ords of work area origin
  1224. 7workx%=topleftx%-scrollx%:worky%=toplefty%-scrolly%
  1225.  distance, of top left corner of redraw rectangle, from work area origin
  1226. /rectworkx%=x1%-workx%:rectworky%=worky%-y2%
  1227.  !block% 
  1228.  mainhandle%:
  1229.  character positions from work area origin, start and max width
  1230. L startx%=(rectworkx%-leftwidth%) 
  1231. 16:starty%=(rectworky%-topheight%) 
  1232. 4 widthx%=1+(x2%-x1%) 
  1233. 16:widthy%=1+(y2%-y1%) 
  1234. startx%<0 startx%=0
  1235. starty%<0 starty%=0
  1236. widthy%>P%-starty% widthy%=P%-starty%
  1237.  endy%=starty%+widthy%
  1238.  @%=&100060D
  1239.  startcolumn%=startx% 
  1240. G endcolumn%=startcolumn%+1+widthx% 
  1241. endcolumn%>C% endcolumn%=C%
  1242. i%=starty% 
  1243. endy%
  1244. j%=startcolumn% 
  1245.  endcolumn%
  1246. K select%=(j%>=caretx1%) 
  1247. (j%<=caretx2%) 
  1248. (i%>=carety1%) 
  1249. (i%<=carety2%)
  1250. select% 
  1251.  workx%+16*14*j%+leftwidth%,worky%-32*i%-4-topheight%
  1252. fill$;
  1253. "Wimp_SetColour",8
  1254. i%=caretrow% 
  1255. j%=caretcolumn% 
  1256.  workx%+16*14*j%+leftwidth%,worky%-32*i%-4-topheight%
  1257. caret$;
  1258. DataStatus%?(j%+C1%*i%)=1 
  1259.  workx%+16*14*j%+leftwidth%,worky%-32*i%-4-topheight%
  1260. "             "+
  1261. Tdata(j%,i%))+"  ",14);
  1262. DataStatus%?(j%+C1%*i%)=2 
  1263.  workx%+16*14*j%+leftwidth%,worky%-32*i%-4-topheight%
  1264. "             M  ",14);
  1265. select% 
  1266. "Wimp_SetColour",0
  1267.  lefthandle%:
  1268.  character positions from work area origin, start and max width
  1269.  starty%=rectworky% 
  1270.  widthy%=1+(y2%-y1%) 
  1271. widthy%>P%-starty% widthy%=P%-starty%
  1272.  endy%=starty%+widthy%
  1273. i%=starty% 
  1274. endy%
  1275. topleftx%+16,worky%-32*i%-4
  1276. "   "+
  1277. (i%),4)
  1278.  tophandle%:
  1279.  character positions from work area origin, start and max width
  1280. i%=0 
  1281. workx%+14*16*i%+9*16+8,toplefty%-8
  1282. i%,2)
  1283. workx%+14*16*i%+8*16+8,toplefty%-44
  1284. "  "+ColumnMeaning$(i%),3)
  1285. 255,"Bad redraw request"
  1286. redrawmain(x1%,x2%,y1%,y2%)
  1287. Cxmin%=x1%*14*16-4+leftwidth%:xmax%=x2%*14*16+14*16+4+leftwidth%
  1288. :ymax%=-y1%*32+8-topheight%:ymin%=-y2%*32-40-topheight%
  1289. "Wimp_ForceRedraw",mainhandle%,xmin%,ymin%,xmax%,ymax%
  1290. update(handle%)
  1291. !block1%=handle%
  1292. "Wimp_GetWindowState",,block1%
  1293. %xmin%=block1%!20:ymax%=block1%!24
  1294. Exmax%=xmin%+block1%!12-block1%!4:ymin%=ymax%+block1%!8-block1%!16
  1295. "Wimp_ForceRedraw",handle%,xmin%,ymin%,xmax%,ymax%
  1296. highlight(x1%,x2%,y1%,y2%)
  1297. redrawmain(caretx1%,caretx2%,carety1%,carety2%)
  1298. 7caretx1%=x1%:caretx2%=x2%:carety1%=y1%:carety2%=y2%
  1299. caretstring(((x%-ox%-leftwidth%-8) 
  1300. redrawmain(caretx1%,caretx2%,carety1%,carety2%)
  1301. flush
  1302. "OS_Byte",21,0
  1303. compact
  1304. row%,status%,j%,count%,start%
  1305. "Hourglass_On"
  1306. maxcolumnrow
  1307. count%=0:start%=-1
  1308. row%=0 
  1309. maxrow%
  1310.  status%=
  1311. j%=0 
  1312. maxcolumn%
  1313. DataStatus%?(j%+C1%*row%) status%=
  1314.  block%?row%=status%
  1315. status%=
  1316.  count%+=1:
  1317. start%=-1 start%=row%
  1318. docompact(count%,start%)
  1319. "Hourglass_Smash"
  1320. caretstring(11):
  1321. update(mainhandle%)
  1322. doweed
  1323. i%,count%,start%,end%
  1324.  retain start% and then every WeedGap% until end% (keep end%)
  1325. maxcolumnrow
  1326. start%=0:end%=maxrow%
  1327. WeedSelection% start%=carety1%:end%=carety2%
  1328. end%>maxrow% end%=maxrow%
  1329. WeedGap%<2 
  1330. end%-start%<2 
  1331. "Hourglass_On"
  1332. i%=0 
  1333. start%:block%?i%=
  1334. i%=end% 
  1335. maxrow%:block%?i%=
  1336. count%=0
  1337. i%=start%+1 
  1338. end%-1
  1339. (i%-start%) 
  1340. WeedGap%=0 block%?i%=
  1341. block%?i%=
  1342. :count%+=1
  1343. docompact(count%,start%+1)
  1344. "Hourglass_Smash"
  1345. caretstring(11):
  1346. update(mainhandle%)
  1347. changed(
  1348. docompact(count%,start%)
  1349. old%,row%,j%
  1350.  assumes block% is a table of which rows contain data
  1351.  with count% gaps, the first being row number start%
  1352. count%=0 
  1353. old%=start%
  1354. row%=start% 
  1355. maxrow%-count%
  1356. block%?old%=
  1357.  old%+=1:
  1358. row%<>old% 
  1359. j%=0 
  1360. maxcolumn%
  1361. data(j%,row%,
  1362. Tdata(j%,old%))
  1363. >9  DataStatus%?(j%+C1%*row%)=DataStatus%?(j%+C1%*old%)
  1364.  old%+=1
  1365. row%=maxrow%-count%+1 
  1366. maxrow%
  1367. j%=0 
  1368. maxcolumn%
  1369. DataStatus%?(j%+C1%*row%)=0
  1370. maxrow%-=count%
  1371. maxcolumnrow
  1372. definemenus
  1373. papermenu%=
  1374. Tdefinemenu
  1375. stylemenu%=
  1376. Tdefinemenu
  1377. plotsmenu%=
  1378. Tdefinemenu
  1379. savemenu%=
  1380. Tdefinemenu
  1381. reducemenu%=
  1382. Tdefinemenu
  1383. cellsmenu%=
  1384. Tdefinemenu
  1385. mainmenu%=
  1386. Tdefinemenu
  1387. viewmenu%=
  1388. Tdefinemenu
  1389. iconbarmenu%=
  1390. Tdefinemenu
  1391. colourmenu%=FNTdefinemenu
  1392. stylemenu%=
  1393. Tdefinemenu
  1394.  2,"Paper"
  1395.  0,-1,"Size..."
  1396.  &88,magnifyhandle%,"Magnify"
  1397.  8,"Graph"
  1398.  8,scalinghandle%,"Scaling"
  1399.  0,-1,"Frame..."
  1400.  8,tickshandle%,"Ticks"
  1401.  8,gridshandle%,"Grids"
  1402.  8,labelshandle%,"Labels"
  1403.  8,axistexthandle%,"Texts"
  1404.  8,fontshandle%,"Fonts"
  1405.  &88,worksheethandle%,"Worksheet"
  1406.  7,"Column"
  1407.  0,-1,"Plot..."
  1408.  8,meaninghandle%,"Meaning"
  1409.  8,manyhandle%,"Plot (many)"
  1410.  8,calculatehandle%,"Calculate"
  1411.  8,bestfithandle%,"Best fit"
  1412.  0,-1,"Normalise"
  1413.  &80,-1,"Sort"
  1414.  7,"Save"
  1415.  8,savehandle%,"Draw file F3"
  1416.  8,savehandle%,"Tau file"
  1417.  8,savehandle%,"Tau style"
  1418.  8,savehandle%,"CSV data"
  1419.  8,savehandle%,"Text data"
  1420.  8,savehandle%,"Binary data"
  1421.  &88,optionshandle%,"Options"
  1422.  4,"Reduce"
  1423.  8,weedhandle%,"Weed"
  1424.  0,-1,"Compact"
  1425.  0,-1,"Clear"
  1426.  &80,-1,"Warnings"
  1427.  6,"Cells"
  1428.  0,-1,"Whole row"
  1429.  0,-1,"Whole column"
  1430.  0,-1,"To top"
  1431.  0,-1,"To bottom"
  1432.  8,downtohandle%,"Down to"
  1433.  &80,-1,"All data"
  1434.  11,"Main"
  1435.  0,papermenu%,"Paper"
  1436.  0,stylemenu%,"Graph"
  1437.  0,plotsmenu%,"Column"
  1438.  0,savemenu%,"Save"
  1439.  8,importhandle%,"Import"
  1440.  0,cellsmenu%,"Cells"
  1441.  0,reducemenu%,"Reduce"
  1442.  0,-1,"View"
  1443.  0,-1,"Many Xs"
  1444.  0,-1,"k,M,G labels"
  1445.  &80,edithandle%,"Global Edit"
  1446.  3,"View"
  1447.  0,-1,"Zoom to fit"
  1448.  0,-1,"Re-plot"
  1449.  &80,-1,"Auto-update"
  1450.  2,"Tau"
  1451.  8,infohandle%,"Info"
  1452.  128,-1,"Quit"
  1453.  flags,submenu,entry
  1454.  3,"Line styles"
  1455.  0,-1,"
  1456.  0,-1,"
  1457.  &80,-1,"
  1458. Tdefinemenu
  1459.  m%,p%,fg%
  1460.  m% 28+24*n%
  1461. *m%!12=&70207:m%!20=44:m%!24=0:width%=0
  1462. i%=m%+28:p%=-1
  1463.  f%,i%!4,i$
  1464. i$="Warnings" WarningItem%=i%
  1465. i$="Auto-update" UpdateItem%=i%
  1466.  PDK Multiple X addition
  1467.  i$="Many Xs" 
  1468. iMultipleX%=i%
  1469.  MultipleX% f%=(f% 
  1470.  PDK suffix addition
  1471.  i$="k,M,G labels" 
  1472. isuffix%=i%
  1473.  suffix% f%=(f% 
  1474. $!i%=f%:i%!8=&7000021:$(i%+12)=i$
  1475. i$>width% width%=
  1476. i%+=24
  1477. m%!16=(1+width%)*16
  1478. iconbaricon
  1479. >!block%=-1:block%!4=0:block%!8=0:block%!12=68:block%!16=68
  1480. 'block%!20=&3002:$(block%+24)="!tau"
  1481. "Wimp_CreateIcon",,block% 
  1482.  iconbariconhandle%
  1483. Tzeroterminatedstring(m%)
  1484. i$="":i%=?m%
  1485. i%<>0
  1486. m%+=1:i%=?m%
  1487. Tcheckfont(font$)
  1488. find%,i$
  1489. $find%=
  1490. :font$=
  1491. Tlowercase(font$)
  1492. "<Tau$Dir>.FontList":fileopen%=c%
  1493. #c%:i$=
  1494. Tlowercase(i$)
  1495. font$=i$ find%=
  1496. find% 
  1497. #c%:fileopen%=0
  1498. =find%
  1499. Tlowercase(i$)
  1500. i$=0 =i$
  1501. i%=1 
  1502. i$,i%,1)
  1503. i$,i%,1)=
  1504. view(length%)
  1505. TpresentDFM 
  1506.  importdrawfile%=
  1507. ViewOn% 
  1508. closewindow(viewhandle%):ViewOn%=
  1509. "Wimp_SlotSize",MinSlotSize%,-1
  1510. report("Cannot view the graph: the DrawFile module is absent"):
  1511.  **** to avoid possible sillies before any scaling
  1512. ScalingAuto% 
  1513. autoscale
  1514. "Hourglass_On"
  1515. length% ViewLength%=length% 
  1516. ViewLength%=
  1517. Tgenerate(
  1518. ViewLength% 
  1519. "DrawFile_BBox",0,Himem%,ViewLength%,0,block2%
  1520. ) ViewWidth%=(block2%!8-!block2%) 
  1521. , ViewHeight%=(block2%!12-block2%!4) 
  1522. I ViewScale0=ViewWidth%:
  1523. ViewHeight%>ViewWidth% ViewScale0=ViewHeight%
  1524.  ViewScale0=1280/ViewScale0
  1525. J ViewX0%=(block2%!8+!block2%) 
  1526. 512:ViewY0%=(block2%!12+block2%!4) 
  1527. (ViewScaleFactor>0.8 
  1528. ViewScaleFactor<1) 
  1529. ViewOn% ViewScaleFactor=0.9:ViewX%=ViewX0%:ViewY%=ViewY0%
  1530.  !block%=viewhandle%
  1531. "Wimp_GetWindowState",,block%
  1532. - block%!12=block%!4+ViewScale0*ViewWidth%
  1533. . block%!8=block%!16-ViewScale0*ViewHeight%
  1534.  block%!28=-1
  1535. "Wimp_OpenWindow",,block%
  1536. "Wimp_ForceRedraw",viewhandle%,0,-2000,2000,0
  1537.  ViewOn%=
  1538. viewchanged(
  1539. ViewOn% 
  1540. closewindow(viewhandle%):ViewOn%=
  1541. "Wimp_SlotSize",MinSlotSize%,-1
  1542. report("There is not enough free memory to view the graph")
  1543. "Hourglass_Smash"
  1544. redrawview
  1545. TpresentDFM 
  1546. "DrawFile_Render",0,Himem%,ViewLength%,block1%,block%+28,0
  1547. viewmouse(button%)
  1548. !block%=viewhandle%
  1549. "Wimp_GetWindowState",,block%
  1550. EViewX%+=(x%-(block%!4+block%!12) 
  1551. 2)/(ViewScale0*ViewScaleFactor)
  1552. EViewY%+=(y%-(block%!8+block%!16) 
  1553. 2)/(ViewScale0*ViewScaleFactor)
  1554. button%=4 ViewScaleFactor=ViewScaleFactor*2
  1555. button%=1 ViewScaleFactor=ViewScaleFactor/2
  1556. "Wimp_ForceRedraw",viewhandle%,0,-2000,2000,0
  1557.  ##### file operations, loading, saving, etc #####
  1558. cleardata
  1559. i%=0 
  1560. C1%*P1%-4 
  1561. 4:DataStatus%!i%=0:
  1562. maxcolumn%=0:maxrow%=0
  1563. caretcolumn%=0:caretrow%=0
  1564. oneselect(11)
  1565. update(mainhandle%)
  1566. changed(
  1567. changed(
  1568. Tautoload
  1569. r$,i%,object%,load%
  1570. "OS_GetEnv" 
  1571. "%i%=
  1572. r$,"!RunImage"):r$=
  1573. r$,i%+10)
  1574. r$,"0")
  1575. i%<>0 
  1576.  filetype%=
  1577. ("&"+
  1578. r$,i%,3))
  1579.  file$=
  1580. r$,i%+3)
  1581. file$="<Tau$Dir>.Default"
  1582. "OS_File",17,file$ 
  1583.  object%,,load%
  1584. filetype%=(load%>>8) 
  1585. (filetype%=&82 
  1586. filetype%=&83) 
  1587. object%=1 =
  1588. filetype%=&FFB 
  1589.  file$:
  1590.  BASIC file
  1591. filetype%=&AFF importdrawfile%=
  1592. view(0):
  1593.  drawfile
  1594. changed% 
  1595. filetype%<>&83 
  1596. filetype%=&82 
  1597. (caretrow%<=maxrow% 
  1598. caretcolumn%<=maxcolumn%) 
  1599. Tjeopardy 
  1600. "Hourglass_On"
  1601. ViewOn% 
  1602. closewindow(viewhandle%):ViewOn%=
  1603. "Wimp_SlotSize",MinSlotSize%,-1
  1604. 9$rw0%=caretrow%:cl0%=caretcolumn%
  1605. (file$):fileopen%=c%
  1606.  filetype% 
  1607. &1000,&2000:
  1608.  directory or application
  1609.  TauFile
  1610. Tloadvars 
  1611. loadtaudata:
  1612. changed(
  1613. checkscaling:
  1614. file$<>"<Tau$Dir>.Default" Save$(1)=file$:TauFileName$=
  1615. Tleafname(file$)
  1616.  TauStyle
  1617. Tloadvars 
  1618. checkscaling:
  1619. file$<>"<Tau$Dir>.Default" Save$(2)=file$
  1620. &DFE:
  1621. loaddata:Save$(3)=file$:
  1622. changed(
  1623. &FFF:
  1624.  Text
  1625. loaddata:Save$(4)=file$:
  1626. changed(
  1627.  any other file type (including &FE4 "DOS" and &FFD "Data")
  1628. #c%=0
  1629. i%=&40 
  1630. i%=&80 
  1631. i%=&88 
  1632.  assume this is a BASIC data file
  1633. loaddatadata:Save$(5)=file$
  1634. loaddata
  1635. changed(
  1636. #c%:fileopen%=0
  1637. filetype%=&82 
  1638. filetype%=&83 
  1639. Tcheckfont(FontsPoints$) 
  1640. report("Warning: the font for data points is absent!")
  1641. Tcheckfont(FontsLabels$) 
  1642. report("Warning: the font for graph labels is absent!")
  1643. ScalingAuto% 
  1644. autoscale
  1645. mainopen% 
  1646. update(tophandle%)
  1647. update(mainhandle%):
  1648. caretstring(-1)
  1649. opendatawindow:
  1650. caretstring(-1)
  1651. "Hourglass_Smash"
  1652. loadtaudata
  1653. #c%,maxcolumn%,maxrow%
  1654. maxrow%>P% maxrow%=P%:
  1655. report("Big file: some rows of data will not be imported!")
  1656. i%=0 
  1657. C1%*P1%-4 
  1658. 4:DataStatus%!i%=0:
  1659. rw%=0 
  1660. maxrow%
  1661. cl%=0 
  1662. maxcolumn%
  1663. #c%,d
  1664. data(cl%,rw%,d)
  1665. g"DataStatus%?(cl%+C1%*rw%)=
  1666. loadweedwarn
  1667. l=loadweed%=(ImportGap%<>1) 
  1668. (ImportRow%>0) 
  1669. (ImportCol%>0)
  1670. JeopardyWarning% 
  1671. loadweed% 
  1672. report("Imported data will be weeded!")
  1673. loaddata
  1674.  a place filled with just "." has status "empty" but reserves a space
  1675.  a place filled with "M" marks a move rather than a draw plot action
  1676. loadweedwarn
  1677. t/rw%=caretrow%-1:cl%=caretcolumn%-ImportCol%
  1678. skiprows%=ImportRow%
  1679.  rows
  1680.  skip rows, with next byte ready in b%
  1681.  i%=skiprows%
  1682. b%<>13 
  1683. b%<>10 
  1684. #c%:b%=
  1685. (b%=13 
  1686. b%=10) 
  1687. #c%:b%=
  1688.   i%-=1
  1689.  skiprows%=ImportGap%-1
  1690. #c% rw%+=1:cl%=caretcolumn%-ImportCol%
  1691.  columns
  1692.  get the next datum
  1693.  anything not numerical, space, CR or LF is treated like a comma
  1694. b%=32 
  1695. #c%:b%=
  1696. 0  i$="":b$=
  1697. b%:n%=
  1698. "0123456789.EeDd+-Mm",b$)
  1699.    i$+=b$
  1700. 4    b%=
  1701. #c%:b$=
  1702. b%:n%=
  1703. "0123456789.EeDd+-Mm",b$)
  1704.     n%=0
  1705.  accept the datum if it hasn't been weeded
  1706. cl%>=caretcolumn% 
  1707. (i$<>"" 
  1708. #c%) 
  1709. cl%<=C% 
  1710. rw%<=P% 
  1711. "   i%=
  1712. i$,"e"):
  1713. i$,i%)="E"
  1714. "   i%=
  1715. i$,"D"):
  1716. i$,i%)="E"
  1717. "   i%=
  1718. i$,"d"):
  1719. i$,i%)="E"
  1720. 3   i%=
  1721. i$,"E"):
  1722. i% i$=
  1723. i$,i%-1)+"E"+
  1724. i$,i%+1)
  1725. data(cl%,rw%,
  1726. ,    
  1727.  ".","":DataStatus%?(cl%+C1%*rw%)=0
  1728. -    
  1729.  "M","m":DataStatus%?(cl%+C1%*rw%)=2
  1730. %    
  1731. :DataStatus%?(cl%+C1%*rw%)=1
  1732. cl%>maxcolumn% maxcolumn%=cl%
  1733. rw%>maxrow% maxrow%=rw%
  1734.   cl%+=1
  1735.  get the next bit of filling
  1736. b%<>13 
  1737. b%<>10 
  1738. #c% b%=
  1739.  next column
  1740.  no more columns, next row
  1741. (b%=13 
  1742. b%=10) 
  1743. #c%:b%=
  1744. rw%>P%
  1745. loaddatadata
  1746. ImportGet% 
  1747. #c%,cls% 
  1748. cls%=ImportNumber%
  1749. cls%<=ImportCol% 
  1750. report("all columns are weeded!")
  1751. loadweedwarn
  1752. $rw%=caretrow%-1:cl%=caretcolumn%
  1753. skiprows%=ImportRow%
  1754. skiprows% 
  1755. i%=1 
  1756. cls%*skiprows%
  1757. #c%,I
  1758.  skiprows%=ImportGap%-1
  1759. #c% rw%+=1
  1760. ImportCol% 
  1761. i%=1 
  1762. ImportCol%
  1763. #c%,I
  1764. cl%=caretcolumn% 
  1765. caretcolumn%+cls%-1-ImportCol%
  1766. #c%,I
  1767. cl%<=C% 
  1768. rw%<=P% 
  1769. data(cl%,rw%,I):DataStatus%?(cl%+C1%*rw%)=1
  1770. rw%>maxrow% maxrow%=rw%
  1771. rw%>P%
  1772. caretcolumn%+cls%-1-ImportCol% maxcolumn%=caretcolumn%+cls%-1-ImportCol%
  1773. Tloadvars
  1774.  filever%
  1775. !i$="":
  1776. i%=1 
  1777. 17:i$+=
  1778. #c%):
  1779. i$,14)<>"Tau variables " 
  1780. report("That's not a Tau-compatible file!"):=
  1781. filever%=
  1782. i$,3))
  1783.  filever% 
  1784. 100:newC1%=16:newP1%=1024
  1785. 120,130,140,filever%:
  1786. #c%,newC1%,newP1%
  1787. report("This version of Tau is too old for that file!"):=
  1788. newP1%<minP1% newP1%=minP1%
  1789. newC1%>maxC1% 
  1790. report("File has too many columns of data!"):=
  1791. newC1%<2 
  1792. report("File has less than 2 columns of data!"):=
  1793. newC1%*newP1%>room% newP1%=room% 
  1794. newC1%
  1795. changed% 
  1796. filetype%=&83 
  1797. newC1%<>C1% 
  1798. newP1%<>P1% 
  1799. Tjeopardy 
  1800. +C1%=newC1%:P1%=newP1%:C%=C1%-1:P%=P1%-1
  1801. setextent
  1802. #c%,DrawFrame%,DrawXAxis%,DrawYAxis%
  1803. #c%,FrameThick,AxisThick
  1804.  filever%=150 
  1805. #c%,FrameFill%,FrameFillColour%,FrameColour%
  1806. #c%,KeyBack%,KeyOutline%
  1807. #c%,TicksMajorXFrame%,TicksMajorYFrame%,TicksMajorXAxis%,TicksMajorYAxis%
  1808. #c%,TicksMinorXFrame%,TicksMinorYFrame%,TicksMinorXAxis%,TicksMinorYAxis%
  1809. #c%,TicksMajorIn,TicksMajorOut,TicksMajorDown,TicksMajorUp,TicksMajorLeft,TicksMajorRight
  1810. #c%,TicksMinorIn,TicksMinorOut,TicksMinorDown,TicksMinorUp,TicksMinorLeft,TicksMinorRight
  1811. #c%,TicksMajorThick,TicksMinorThick
  1812. #c%,GridsMajorX%,GridsMajorY%,GridsMinorX%,GridsMinorY%
  1813. #c%,GridsDash,GridsGap,GridsThick
  1814. #c%,LabelsXFrame%,LabelsXAxis%,LabelsBelow%,LabelsXMinor%
  1815. #c%,LabelsYFrame%,LabelsYAxis%,LabelsLeft%,LabelsYMinor%,LabelsYRotate%
  1816. #c%,LabelsXOffset,LabelsYOffset
  1817. #c%,FontsLabels$
  1818. #c%,LabelsFontWidth,LabelsFontHeight
  1819. #c%,AxistextXPlot%,AxistextYPlot%,AxistextXFrame%,AxistextYFrame%
  1820. #c%,AxistextBelow%,AxistextLeft%,AxistextRotate%
  1821. #c%,AxistextXOffset,AxistextYOffset,AxistextXSpacing,AxistextYSpacing
  1822. #c%,AxistextXText$,AxistextYText$
  1823. #c%,AxistextFontWidth,AxistextFontHeight
  1824. #c%,GraphWidth,GraphHeight,GraphLeft,GraphBottom,GraphBorder%
  1825. #c%,GraphBorderWidth,GraphBorderHeight,GraphBorderLeft,GraphBorderBottom
  1826. #c%,GraphKey%,GraphKeyLeft,GraphKeyTop
  1827. #c%,ScalingAuto%,ScalingBound%,ScalingXLog%,ScalingYLog%
  1828. #c%,ScalingXMin,ScalingXMax,ScalingXAtYAxis
  1829. #c%,ScalingYMin,ScalingYMax,ScalingYAtXAxis
  1830. #c%,ScalingXDigits%,ScalingYDigits%,ScalingXFormat%,ScalingYFormat%
  1831. #c%,ScalingXMajor,ScalingXMinor,ScalingXAnchor
  1832. #c%,ScalingYMajor,ScalingYMinor,ScalingYAnchor
  1833. #c%,ScalingXLogType%,ScalingYLogType%
  1834. i%=0 
  1835. #c%,ColumnPlot%(i%)
  1836. #c%,ColumnMeaning$(i%),ColumnKeyText$(i%)
  1837. #c%,ColumnLine%(i%),ColumnThick(i%),ColumnDash(i%),ColumnGap(i%)
  1838. #c%,ColumnFill%(i%),ColumnColour%(i%)
  1839.  convert to 24-bit
  1840.  filever%< 150 
  1841. ColumnColour%(i%)=
  1842. Treadpalette(ColumnColour%(i%))
  1843. #c%,ColumnPoints%(i%),ColumnChar%(i%),ColumnWidth(i%),ColumnHeight(i%)
  1844. #c%,ColumnError%(i%),ColumnErrorThick(i%),ColumnErrorCap(i%)
  1845.  filever%>= 130 
  1846. #c%,ColumnLinecol%(i%),ColumnCharcol%(i%)
  1847. #c%,ColumnLinestyle%(i%),ColumnDash2(i%)
  1848.  filever%>= 130 
  1849.  filever%< 150 
  1850.  convert colours to 24-bit
  1851. 8ColumnLinecol%(i%)=
  1852. Treadpalette(ColumnLinecol%(i%))
  1853. 8ColumnCharcol%(i%)=
  1854. Treadpalette(ColumnCharcol%(i%))
  1855.  filever%>= 140 
  1856. #c%,ColumnX%(i%)
  1857. #c%,BestFitYColumn%,BestFitForce%,BestFitX,BestFitY
  1858. #c%,FontsPoints$,Calculate$
  1859. #c%,Magnify,JeopardyWarning%
  1860. #c%,SaveIncludePoint%,SaveIncludeMove%,SaveOrder%,SaveLocal%
  1861.  filever%>=140 
  1862. #c%,MultipleX%
  1863.  MultipleX% !iMultipleX%=1 
  1864.  !iMultipleX%=0
  1865. MultipleX%=0
  1866. SaveType%=-1 SaveType%=1
  1867. SaveType%<0 
  1868. SaveType%>5 
  1869. SaveType%=0 
  1870. checkscaling:
  1871. scalingerror$ 
  1872. report("Can't create a Draw file: bad scaling!"):
  1873. Tcheckfont(FontsPoints$) 
  1874. Tcheckfont(FontsLabels$)) 
  1875. report("Can't create a Draw file: font missing!"):
  1876. 8Save$=Save$(SaveType%):Scrap%=(Save$="<Wimp$Scrap>")
  1877. Save$,".")=0) 
  1878. Scrap% 
  1879. report("Incomplete path name"):
  1880. "Hourglass_On"
  1881. maxcolumnrow
  1882.  SaveType% 
  1883.  DrawFile
  1884. savedrawfile
  1885.  TauFile
  1886. (Save$):fileopen%=c%
  1887. savevars:
  1888. savetaudata:TauFileName$=
  1889. Tleafname(Save$)
  1890. Scrap% 
  1891. changed(
  1892. checkscaling
  1893. #c%:fileopen%=0
  1894.  TauStyle
  1895. (Save$):fileopen%=c%
  1896. savevars:
  1897. checkscaling
  1898. #c%:fileopen%=0
  1899.  CSVFile
  1900. (Save$):fileopen%=c%
  1901. savedatacommas
  1902. #c%:fileopen%=0
  1903.  TextFile
  1904. (Save$):fileopen%=c%
  1905. savedataspaces
  1906. #c%:fileopen%=0
  1907.  BASIC data file, with no. columns (integer) as the first row
  1908. (Save$):fileopen%=c%
  1909. savedatadata
  1910. #c%:fileopen%=0
  1911. 255,"Bad save operation"
  1912. "SetType "+Save$+" "+
  1913. FileType$(SaveType%),3)
  1914. Scrap% Save$(SaveType%)=OldSave$(SaveType%)
  1915. "Hourglass_Smash"
  1916. savetaudata
  1917. #c%,maxcolumn%,maxrow%
  1918. rw%=0 
  1919. maxrow%
  1920. cl%=0 
  1921. maxcolumn%
  1922. Tdata(cl%,rw%)
  1923. #c%,DataStatus%?(cl%+C1%*rw%)
  1924. savedataspaces
  1925. @%=&100060D
  1926. saverange
  1927. rw%=rw1% 
  1928. #c%:status%=
  1929. cl%=cl1% 
  1930. Q,i$=
  1931. Tdata(workhorse%(cl%),rw%)):l%=
  1932. l%<12 
  1933. i$,"E"):
  1934. e%=0 e%=l%+1
  1935. i$,".") j$=
  1936. 12-l%,"0") 
  1937. j$="."+
  1938. 11-l%,"0")
  1939. U! i$=
  1940. i$,e%-1)+j$+
  1941. i$,l%-e%+1)
  1942. "   "+i$,14)
  1943.  DataStatus%?(workhorse%(cl%)+C1%*rw%) 
  1944. 0:i$="              ":
  1945. SaveIncludePoint% i$="            . "
  1946. 1:status%=
  1947. 2:i$="              ":
  1948. SaveIncludeMove% i$="            M "
  1949. 255,"Bad data status value"
  1950. i%=1 
  1951. i$,i%,1):
  1952. #c%,&0D:
  1953. #c%,&0A
  1954. status% 
  1955. #c%=p%
  1956. savedatacommas
  1957. @%=&100060D
  1958. saverange
  1959. rw%=rw1% 
  1960. #c%:status%=
  1961. cl%=cl1% 
  1962. i$=","
  1963. DataStatus%?(workhorse%(cl%)+C1%*rw%)=1 status%=
  1964. Tdata(workhorse%(cl%),rw%))+","
  1965. (DataStatus%?(workhorse%(cl%)+C1%*rw%)=2) 
  1966. SaveIncludeMove% i$="M,"
  1967. #c%,i$;
  1968. #c%-1
  1969. #c%,&0D:
  1970. #c%,&0A
  1971. status% 
  1972. #c%=p%
  1973. savedatadata
  1974. saverange
  1975. SaveBinaryColumns% 
  1976. #c%,cl2%-cl1%+1
  1977. rw%=rw1% 
  1978. #c%:status%=
  1979. cl%=cl1% 
  1980. DataStatus%?(workhorse%(cl%)+C1%*rw%)=1 status%=
  1981. Tdata(workhorse%(cl%),rw%)
  1982. status% 
  1983. #c%=p%
  1984. saverange
  1985.  i%,j%
  1986. .rw1%=0:rw2%=maxrow%:cl1%=0:cl2%=maxcolumn%
  1987. SaveLocal% rw1%=carety1%:rw2%=carety2%:cl1%=caretx1%:cl2%=caretx2%
  1988. i%=cl1% 
  1989. cl2%:workhorse%(i%)=i%:
  1990. SaveOrder% 
  1991.  workhorse(cl1%) will equal the column% for the first saved column
  1992.  i%=cl1%
  1993. ColumnMeaning$(i%))<>"X" 
  1994. i%<cl2%
  1995.  i%+=1
  1996. ColumnMeaning$(i%))="X" 
  1997. i%>cl1% 
  1998.   workhorse%(cl1%)=i%
  1999. j%=cl1%+1 
  2000. i%:workhorse%(j%)=j%-1:
  2001. savevars
  2002. @i$="Tau variables "+fileversion$:
  2003. i%=1 
  2004. i$,i%,1):
  2005. #c%,C1%,P1%
  2006. #c%,DrawFrame%,DrawXAxis%,DrawYAxis%
  2007. #c%,FrameThick,AxisThick
  2008.  1.50 next 2 lines
  2009. #c%,FrameFill%,FrameFillColour%,FrameColour%
  2010. #c%,KeyBack%,KeyOutline%
  2011. #c%,TicksMajorXFrame%,TicksMajorYFrame%,TicksMajorXAxis%,TicksMajorYAxis%
  2012. #c%,TicksMinorXFrame%,TicksMinorYFrame%,TicksMinorXAxis%,TicksMinorYAxis%
  2013. #c%,TicksMajorIn,TicksMajorOut,TicksMajorDown,TicksMajorUp,TicksMajorLeft,TicksMajorRight
  2014. #c%,TicksMinorIn,TicksMinorOut,TicksMinorDown,TicksMinorUp,TicksMinorLeft,TicksMinorRight
  2015. #c%,TicksMajorThick,TicksMinorThick
  2016. #c%,GridsMajorX%,GridsMajorY%,GridsMinorX%,GridsMinorY%
  2017. #c%,GridsDash,GridsGap,GridsThick
  2018. #c%,LabelsXFrame%,LabelsXAxis%,LabelsBelow%,LabelsXMinor%
  2019. #c%,LabelsYFrame%,LabelsYAxis%,LabelsLeft%,LabelsYMinor%,LabelsYRotate%
  2020. #c%,LabelsXOffset,LabelsYOffset
  2021. #c%,FontsLabels$
  2022. #c%,LabelsFontWidth,LabelsFontHeight
  2023. #c%,AxistextXPlot%,AxistextYPlot%,AxistextXFrame%,AxistextYFrame%
  2024. #c%,AxistextBelow%,AxistextLeft%,AxistextRotate%
  2025. #c%,AxistextXOffset,AxistextYOffset,AxistextXSpacing,AxistextYSpacing
  2026. #c%,AxistextXText$,AxistextYText$
  2027. #c%,AxistextFontWidth,AxistextFontHeight
  2028. #c%,GraphWidth,GraphHeight,GraphLeft,GraphBottom,GraphBorder%
  2029. #c%,GraphBorderWidth,GraphBorderHeight,GraphBorderLeft,GraphBorderBottom
  2030. #c%,GraphKey%,GraphKeyLeft,GraphKeyTop
  2031. #c%,ScalingAuto%,ScalingBound%,ScalingXLog%,ScalingYLog%
  2032. #c%,ScalingXMin,ScalingXMax,ScalingXAtYAxis
  2033. #c%,ScalingYMin,ScalingYMax,ScalingYAtXAxis
  2034. #c%,ScalingXDigits%,ScalingYDigits%,ScalingXFormat%,ScalingYFormat%
  2035. #c%,ScalingXMajor,ScalingXMinor,ScalingXAnchor
  2036. #c%,ScalingYMajor,ScalingYMinor,ScalingYAnchor
  2037. #c%,ScalingXLogType%,ScalingYLogType%
  2038. i%=0 
  2039. #c%,ColumnPlot%(i%)
  2040. #c%,ColumnMeaning$(i%),ColumnKeyText$(i%)
  2041. #c%,ColumnLine%(i%),ColumnThick(i%),ColumnDash(i%),ColumnGap(i%)
  2042. #c%,ColumnFill%(i%),ColumnColour%(i%)
  2043. #c%,ColumnPoints%(i%),ColumnChar%(i%),ColumnWidth(i%),ColumnHeight(i%)
  2044. #c%,ColumnError%(i%),ColumnErrorThick(i%),ColumnErrorCap(i%)
  2045. #c%,ColumnLinecol%(i%),ColumnCharcol%(i%)
  2046. #c%,ColumnLinestyle%(i%),ColumnDash2(i%)
  2047. #c%,ColumnX%(i%)
  2048. #c%,BestFitYColumn%,BestFitForce%,BestFitX,BestFitY
  2049. #c%,FontsPoints$,Calculate$
  2050. #c%,Magnify,JeopardyWarning%
  2051. #c%,SaveIncludePoint%,SaveIncludeMove%,SaveOrder%,SaveLocal%
  2052. #c%,MultipleX%
  2053. Tleafname(file$)
  2054. file$,".")
  2055.  file$=
  2056. file$,i%+1)
  2057. file$,".")
  2058. =file$
  2059. savedrawfile
  2060. length%
  2061. length%=
  2062. Tgenerate(
  2063. length% 
  2064. "Save "+Save$+" "+
  2065. ~Himem%+" +"+
  2066. ~length%
  2067. ViewOn% 
  2068. view(length%) 
  2069. "Wimp_SlotSize",MinSlotSize%,-1
  2070. "Wimp_SlotSize",MinSlotSize%,-1
  2071. (Save$):fileopen%=c%
  2072.  length%=
  2073. Tgenerate(
  2074. #c%:fileopen%=0
  2075.  ##### transfer between window icons and program variables #####
  2076. cancelOK
  2077. icon%=1 
  2078. putvariables(window%)
  2079. window%=scalinghandle% 
  2080. checkscaling
  2081. button%=4 
  2082. "Wimp_CreateMenu",,-1
  2083. getvariables(window%)
  2084. "Wimp_CreateMenu",,mainmenu%
  2085. window%=savehandle% 
  2086. icon%=1 
  2087. window%=edithandle% 
  2088. icon%=1 
  2089. pkiedit
  2090. getvariables(handle%)
  2091. @%=&1000405
  2092. ScalingAuto% 
  2093. autoscale
  2094.  handle% 
  2095.  framehandle%:
  2096. getframe
  2097.  tickshandle%:
  2098. getticks
  2099.  gridshandle%:
  2100. getgrids
  2101.  labelshandle%:
  2102. getlabels
  2103.  axistexthandle%:
  2104. getaxistext
  2105.  sizehandle%:
  2106. getsize
  2107.  scalinghandle%:
  2108. getscaling
  2109.  columnhandle%:
  2110. getcolumn
  2111.  savehandle%:
  2112. getsave
  2113.  calculatehandle%:
  2114. getcalculate
  2115.  optionshandle%:
  2116. getoptions
  2117.  bestfithandle%:
  2118. getbestfit
  2119.  fontshandle%:
  2120. getfonts
  2121.  magnifyhandle%:
  2122. getmagnify
  2123.  meaninghandle%:
  2124. getmeaning
  2125.  weedhandle%:
  2126. getweed
  2127.  importhandle%:
  2128. getimport
  2129.  downtohandle%:
  2130. getdownto
  2131.  manyhandle%:
  2132. getmany
  2133.  worksheethandle%:@%=&1000005:
  2134. getworksheet
  2135. selectvariables(handle%,icon%)
  2136.  handle% 
  2137.  framehandle%:
  2138. selectframe
  2139.  tickshandle%:
  2140. selectticks
  2141.  gridshandle%:
  2142. selectgrids
  2143.  labelshandle%:
  2144. selectlabels
  2145.  axistexthandle%:
  2146. selectaxistext
  2147.  sizehandle%:
  2148. selectsize
  2149.  scalinghandle%:
  2150. selectscaling
  2151.  columnhandle%:
  2152. selectcolumn
  2153.  optionshandle%:
  2154. selectoptions
  2155.  bestfithandle%:
  2156. selectbestfit
  2157.  meaninghandle%:
  2158. selectmeaning
  2159.  weedhandle%:
  2160. selectweed
  2161.  importhandle%:
  2162. selectimport
  2163.  downtohandle%:
  2164. selectdownto
  2165. putvariables(handle%)
  2166.  chng%
  2167. chng%=
  2168.  handle% 
  2169.  framehandle%:
  2170. putframe
  2171.  tickshandle%:
  2172. putticks
  2173.  gridshandle%:
  2174. putgrids
  2175.  labelshandle%:
  2176. putlabels
  2177.  axistexthandle%:
  2178. putaxistext
  2179.  sizehandle%:
  2180. putsize
  2181.  scalinghandle%:
  2182. putscaling
  2183.  columnhandle%:
  2184. putcolumn
  2185.  savehandle%:
  2186. putsave:chng%=
  2187.  calculatehandle%:
  2188. putcalculate
  2189.  optionshandle%:
  2190. putoptions:chng%=
  2191.  bestfithandle%:
  2192. putbestfit
  2193.  fontshandle%:
  2194. putfonts
  2195.  magnifyhandle%:
  2196. putmagnify
  2197.  meaninghandle%:
  2198. putmeaning
  2199.  weedhandle%:
  2200. putweed
  2201.  importhandle%:
  2202. putimport:chng%=
  2203.  downtohandle%:
  2204. putdownto:chng%=
  2205.  manyhandle%:
  2206. putmany
  2207.  worksheethandle%:
  2208. putworksheet:chng%=
  2209. chng% 
  2210. changed(
  2211. setwritable(ih%,v)
  2212. setwritablestring(ih%,
  2213. setwritablestring(ih%,v$)
  2214. ?A!block1%=handle%:block1%!4=ih%:
  2215. "Wimp_GetIconState",,block1%
  2216. @ indir%=block1%!28:$indir%=v$
  2217. Tgetwritable(ih%)
  2218. Tgetwritablestring(ih%))
  2219. Tgetwritablestring(ih%)
  2220. GA!block1%=handle%:block1%!4=ih%:
  2221. "Wimp_GetIconState",,block1%
  2222. indir%=block1%!28
  2223. =$indir%
  2224. setselectgrey(i1%,i2%)
  2225.  s%() indicates selected icons, g%() indicates UN-greyed icons
  2226. N+!block1%=handle%:block1%!12=sel% 
  2227. grey%
  2228. i%=i1% 
  2229. P;block1%!4=i%:block1%!8=(s%(i%) 
  2230. sel%) 
  2231. g%(i%) 
  2232. grey%)
  2233. "Wimp_SetIconState",,block1%
  2234. getframe
  2235. setwritable(7,FrameThick):
  2236. setwritable(8,AxisThick)
  2237. W=s%()=
  2238. :s%(4)=DrawFrame%:s%(5)=DrawXAxis%:s%(6)=DrawYAxis%
  2239. s%(11)=FrameFill%
  2240. s%(13)=FrameFillColour%
  2241. s%(14)=FrameColour%
  2242. setcolour(framehandle%,14,s%(14),"line")
  2243. greyframe
  2244. greyframe
  2245. `)g%()=
  2246. :g%(7)=s%(4):g%(8)=s%(5) 
  2247. s%(6)
  2248. setselectgrey(4,11)
  2249.  s%(11) 
  2250. setcolour(framehandle%,13,s%(13),"fill")
  2251. setgreycolour(framehandle%,13,"fill")
  2252. selectframe
  2253. s%(icon%)=
  2254. s%(icon%)
  2255. greyframe
  2256. putframe
  2257. o:FrameThick=
  2258. Tgetwritable(7):AxisThick=
  2259. Tgetwritable(8)
  2260. p6DrawFrame%=s%(4):DrawXAxis%=s%(5):DrawYAxis%=s%(6)
  2261. q-FrameFill%=s%(11):FrameFillColour%=s%(13)
  2262. FrameColour%=s%(14)
  2263. getticks
  2264. setwritable(4,TicksMajorThick):
  2265. setwritable(9,TicksMajorDown):
  2266. setwritable(10,TicksMajorUp)
  2267. setwritable(11,TicksMajorLeft):
  2268. setwritable(12,TicksMajorRight):
  2269. setwritable(13,TicksMajorIn)
  2270. setwritable(14,TicksMajorOut):
  2271. setwritable(15,TicksMinorThick):
  2272. setwritable(20,TicksMinorDown)
  2273. setwritable(21,TicksMinorUp):
  2274. setwritable(22,TicksMinorLeft):
  2275. setwritable(23,TicksMinorRight)
  2276. setwritable(24,TicksMinorIn):
  2277. setwritable(25,TicksMinorOut)
  2278. {hs%()=
  2279. :s%(5)=TicksMajorXAxis%:s%(6)=TicksMajorYAxis%:s%(7)=TicksMajorXFrame%:s%(8)=TicksMajorYFrame%
  2280. |es%(16)=TicksMinorXAxis%:s%(17)=TicksMinorYAxis%:s%(18)=TicksMinorXFrame%:s%(19)=TicksMinorYFrame%
  2281. greyticks
  2282. greyticks
  2283. g%()=
  2284. dg%(5)=DrawXAxis%:g%(9)=g%(5) 
  2285. s%(5):g%(10)=g%(9):g%(16)=g%(9):g%(20)=g%(9) 
  2286. s%(16):g%(21)=g%(20)
  2287. hg%(6)=DrawYAxis%:g%(11)=g%(6) 
  2288. s%(6):g%(12)=g%(11):g%(17)=g%(11):g%(22)=g%(11) 
  2289. s%(17):g%(23)=g%(22)
  2290. Kg%(7)=DrawFrame%:g%(8)=g%(7):g%(13)=g%(7) 
  2291. (s%(7) 
  2292. s%(8)):g%(14)=g%(13)
  2293. cg%(18)=g%(7) 
  2294. s%(7):g%(19)=g%(8) 
  2295. s%(8):g%(24)=(g%(18) 
  2296. s%(18)) 
  2297. (g%(19) 
  2298. s%(19)):g%(25)=g%(24)
  2299. =g%(4)=g%(9) 
  2300. g%(11) 
  2301. g%(13):g%(15)=g%(20) 
  2302. g%(22) 
  2303. g%(24)
  2304. setselectgrey(4,25)
  2305. selectticks
  2306. s%(icon%)=
  2307. s%(icon%)
  2308. greyticks
  2309. putticks
  2310. cTicksMajorThick=
  2311. Tgetwritable(4):TicksMajorDown=
  2312. Tgetwritable(9):TicksMajorUp=
  2313. Tgetwritable(10)
  2314. eTicksMajorLeft=
  2315. Tgetwritable(11):TicksMajorRight=
  2316. Tgetwritable(12):TicksMajorIn=
  2317. Tgetwritable(13)
  2318. fTicksMajorOut=
  2319. Tgetwritable(14):TicksMinorThick=
  2320. Tgetwritable(15):TicksMinorDown=
  2321. Tgetwritable(20)
  2322. eTicksMinorUp=
  2323. Tgetwritable(21):TicksMinorLeft=
  2324. Tgetwritable(22):TicksMinorRight=
  2325. Tgetwritable(23)
  2326. BTicksMinorIn=
  2327. Tgetwritable(24):TicksMinorOut=
  2328. Tgetwritable(25)
  2329. aTicksMajorXFrame%=s%(7):TicksMajorYFrame%=s%(8):TicksMajorXAxis%=s%(5):TicksMajorYAxis%=s%(6)
  2330. eTicksMinorXFrame%=s%(18):TicksMinorYFrame%=s%(19):TicksMinorXAxis%=s%(16):TicksMinorYAxis%=s%(17)
  2331. getgrids
  2332. setwritable(7,GridsDash):
  2333. setwritable(8,GridsGap):
  2334. setwritable(9,GridsThick)
  2335. Vs%()=
  2336. :s%(3)=GridsMajorX%:s%(4)=GridsMajorY%:s%(5)=GridsMinorX%:s%(6)=GridsMinorY%
  2337. greygrids
  2338. greygrids
  2339. Mg%()=
  2340. :g%(5)=s%(3):g%(6)=s%(4):g%(7)=s%(3) 
  2341. s%(4):g%(8)=g%(7):g%(9)=g%(7)
  2342. setselectgrey(3,9)
  2343. selectgrids
  2344. s%(icon%)=
  2345. s%(icon%)
  2346. greygrids
  2347. putgrids
  2348. TGridsDash=
  2349. Tgetwritable(7):GridsGap=
  2350. Tgetwritable(8):GridsThick=
  2351. Tgetwritable(9)
  2352. OGridsMajorX%=s%(3):GridsMajorY%=s%(4):GridsMinorX%=s%(5):GridsMinorY%=s%(6)
  2353. getlabels
  2354. setwritable(14,LabelsXOffset):
  2355. setwritable(15,LabelsYOffset)
  2356. setwritable(16,LabelsFontWidth):
  2357. setwritable(17,LabelsFontHeight)
  2358. Xs%()=
  2359. :s%(5)=LabelsXFrame%:s%(6)=LabelsXAxis%:s%(7)=LabelsBelow%:s%(8)=LabelsXMinor%
  2360. is%(9)=LabelsYFrame%:s%(10)=LabelsYAxis%:s%(11)=LabelsLeft%:s%(12)=LabelsYMinor%:s%(13)=LabelsYRotate%
  2361. greylabels
  2362. greylabels
  2363. ]g%()=
  2364. :g%(5)=DrawFrame%:g%(6)=DrawXAxis%:g%(7)=(g%(5) 
  2365. s%(5)) 
  2366. (g%(6) 
  2367. s%(6)):g%(8)=g%(7)
  2368. jg%(9)=DrawFrame%:g%(10)=DrawYAxis%:g%(11)=(g%(9) 
  2369. s%(9)) 
  2370. (g%(10) 
  2371. s%(10)):g%(12)=g%(11):g%(13)=g%(11)
  2372. Ag%(14)=g%(7):g%(15)=g%(11):g%(16)=g%(7) 
  2373. g%(11):g%(17)=g%(16)
  2374. setselectgrey(5,17)
  2375. selectlabels
  2376. s%(icon%)=
  2377. s%(icon%)
  2378. icon% 
  2379. 5,6,9,10:
  2380. greylabels
  2381. putlabels
  2382. CLabelsXOffset=
  2383. Tgetwritable(14):LabelsYOffset=
  2384. Tgetwritable(15)
  2385. HLabelsFontWidth=
  2386. Tgetwritable(16):LabelsFontHeight=
  2387. Tgetwritable(17)
  2388. QLabelsXFrame%=s%(5):LabelsXAxis%=s%(6):LabelsBelow%=s%(7):LabelsXMinor%=s%(8)
  2389. iLabelsYFrame%=s%(9):LabelsYAxis%=s%(10):LabelsLeft%=s%(11):LabelsYMinor%=s%(12):LabelsYRotate%=s%(13)
  2390. getaxistext
  2391. setwritable(8,AxistextXOffset):
  2392. setwritable(9,AxistextXSpacing)
  2393. setwritable(15,AxistextYOffset):
  2394. setwritable(16,AxistextYSpacing)
  2395. setwritablestring(10,AxistextXText$):
  2396. setwritablestring(17,AxistextYText$)
  2397. setwritable(18,AxistextFontWidth):
  2398. setwritable(19,AxistextFontHeight)
  2399. Js%()=
  2400. :s%(5)=AxistextXPlot%:s%(6)=AxistextXFrame%:s%(7)=AxistextBelow%
  2401. \s%(11)=AxistextYPlot%:s%(12)=AxistextYFrame%:s%(13)=AxistextLeft%:s%(14)=AxistextRotate%
  2402. greyaxistext
  2403. greyaxistext
  2404. :g%()=
  2405. :g%(5)=DrawFrame% 
  2406. DrawXAxis%:g%(6)=g%(5) 
  2407. s%(5)
  2408. <g%(7)=((DrawFrame% 
  2409. s%(6)) 
  2410. (DrawXAxis% 
  2411. s%(6))) 
  2412. s%(5)
  2413. 7g%(11)=DrawFrame% 
  2414. DrawYAxis%:g%(12)=g%(11) 
  2415. s%(11)
  2416. Ng%(13)=((DrawFrame% 
  2417. s%(12)) 
  2418. (DrawYAxis% 
  2419. s%(12))) 
  2420. s%(11):g%(14)=g%(13)
  2421. Rg%(8)=g%(7):g%(9)=g%(7):g%(10)=g%(7):g%(15)=g%(13):g%(16)=g%(13):g%(17)=g%(13)
  2422. &g%(18)=g%(7) 
  2423. g%(13):g%(19)=g%(18)
  2424. setselectgrey(5,19)
  2425. selectaxistext
  2426. s%(icon%)=
  2427. s%(icon%)
  2428. icon% 
  2429. 5,6,11,12:
  2430. greyaxistext
  2431. putaxistext
  2432. FAxistextXOffset=
  2433. Tgetwritable(8):AxistextYOffset=
  2434. Tgetwritable(15)
  2435. HAxistextXSpacing=
  2436. Tgetwritable(9):AxistextYSpacing=
  2437. Tgetwritable(16)
  2438. QAxistextXText$=
  2439. Tgetwritablestring(10):AxistextYText$=
  2440. Tgetwritablestring(17)
  2441. LAxistextFontWidth=
  2442. Tgetwritable(18):AxistextFontHeight=
  2443. Tgetwritable(19)
  2444. CAxistextXPlot%=s%(5):AxistextXFrame%=s%(6):AxistextBelow%=s%(7)
  2445. \AxistextYPlot%=s%(11):AxistextYFrame%=s%(12):AxistextLeft%=s%(13):AxistextRotate%=s%(14)
  2446. getsize
  2447. setwritable(5,GraphWidth):
  2448. setwritable(6,GraphHeight)
  2449. setwritable(7,GraphLeft):
  2450. setwritable(8,GraphBottom)
  2451. setwritable(10,GraphBorderWidth):
  2452. setwritable(11,GraphBorderHeight)
  2453. setwritable(12,GraphBorderLeft):
  2454. setwritable(13,GraphBorderBottom)
  2455. setwritable(15,GraphKeyLeft):
  2456. setwritable(16,GraphKeyTop)
  2457. .s%()=
  2458. :s%(9)=GraphBorder%:s%(14)=GraphKey%
  2459. s%(30)=KeyBack%
  2460. s%(32)=KeyOutline%
  2461. greysize
  2462. greysize
  2463. g%()=
  2464. :g%(10)=s%(9):g%(11)=g%(10):g%(12)=g%(10):g%(13)=g%(10)
  2465. g%(15)=s%(14):g%(16)=g%(15)
  2466. setselectgrey(5,16)
  2467. s%(14) 
  2468. setgreycolour(handle%,30,"fill"):
  2469. setgreycolour(handle%,32,"line")
  2470. setcolour(handle%,30,s%(30),"fill"):
  2471. setcolour(handle%,32,s%(32),"line")
  2472. selectsize
  2473. s%(icon%)=
  2474. s%(icon%)
  2475. greysize
  2476. putsize
  2477. <GraphWidth=
  2478. Tgetwritable(5):GraphHeight=
  2479. Tgetwritable(6)
  2480. ;GraphLeft=
  2481. Tgetwritable(7):GraphBottom=
  2482. Tgetwritable(8)
  2483. JGraphBorderWidth=
  2484. Tgetwritable(10):GraphBorderHeight=
  2485. Tgetwritable(11)
  2486. IGraphBorderLeft=
  2487. Tgetwritable(12):GraphBorderBottom=
  2488. Tgetwritable(13)
  2489. @GraphKeyLeft=
  2490. Tgetwritable(15):GraphKeyTop=
  2491. Tgetwritable(16)
  2492. &KeyBack%=s%(30):KeyOutline%=s%(32)
  2493. 'GraphBorder%=s%(9):GraphKey%=s%(14)
  2494. getscaling
  2495. setwritable(10,ScalingXMin):
  2496. setwritable(11,ScalingXMax):
  2497. setwritable(12,ScalingXAtYAxis)
  2498. setwritable(13,ScalingXDigits%):
  2499. setwritable(14,ScalingYMin):
  2500. setwritable(15,ScalingYMax)
  2501. setwritable(16,ScalingYAtXAxis):
  2502. setwritable(17,ScalingYDigits%)
  2503. setwritable(18,ScalingXMajor):
  2504. setwritable(19,ScalingXMinor):
  2505. setwritable(20,ScalingXAnchor)
  2506. setwritable(21,ScalingYMajor):
  2507. setwritable(22,ScalingYMinor):
  2508. setwritable(23,ScalingYAnchor)
  2509. Xs%()=
  2510. :s%(7)=ScalingAuto%:s%(34)=ScalingBound%:s%(8)=ScalingXLog%:s%(9)=ScalingYLog%
  2511. 7s%(27-ScalingXLogType%)=
  2512. :s%(32-ScalingYLogType%)=
  2513. 5s%(37+ScalingXFormat%)=
  2514. :s%(42+ScalingYFormat%)=
  2515. 1tempx%=ScalingXDigits%:tempy%=ScalingYDigits%
  2516.  D!block%=scalinghandle%:block%!4=13:
  2517. "Wimp_GetIconState",,block%
  2518. !>ix1%=block%!8:iy1%=block%!12:ix2%=block%!16:iy2%=block%!20
  2519. "D!block%=scalinghandle%:block%!4=17:
  2520. "Wimp_GetIconState",,block%
  2521. #>jx1%=block%!8:jy1%=block%!12:jx2%=block%!16:jy2%=block%!20
  2522. greyscaling
  2523. greyscaling
  2524. ScalingAuto% 
  2525. )  g%()=
  2526. :g%(7)=
  2527. g%(34)=TRUE
  2528.  g%(8)=
  2529. :g%(9)=
  2530. ,P g%()=
  2531. :g%(24)=s%(8):g%(25)=g%(24):g%(26)=g%(24):g%(27)=g%(24):g%(28)=g%(24)
  2532. -7 g%(18)=s%(28) 
  2533. g%(24):g%(19)=g%(18):g%(20)=g%(18)
  2534. .I g%(29)=s%(9):g%(30)=g%(29):g%(31)=g%(29):g%(32)=g%(29):g%(33)=g%(29)
  2535. /7 g%(21)=s%(33) 
  2536. g%(29):g%(22)=g%(21):g%(23)=g%(21)
  2537. setselectgrey(7,44)
  2538. selectscaling
  2539. icon% 
  2540.  autoscale clicked, must change AutoScale% and scale immediately
  2541. 8$ s%(7)=
  2542. s%(7):ScalingAuto%=s%(7)
  2543. 24,25,26,27,28:
  2544.  X log radio icons
  2545. i%=24 
  2546. 28:s%(i%)=(i%=icon%):
  2547. 29,30,31,32,33:
  2548.  Y log radio icons
  2549. i%=29 
  2550. 33:s%(i%)=(i%=icon%):
  2551. 35,36:
  2552.  X arrow icons
  2553. >" tempx%+=(icon%=36)-(icon%=35)
  2554. tempx%<1 tempx%=10 
  2555. tempx%>10 tempx%=1
  2556. setwritable(13,tempx%):
  2557. "Wimp_ForceRedraw",scalinghandle%,ix1%,iy1%,ix2%,iy2%
  2558. 40,41:
  2559.  Y arrow icons
  2560. B" tempy%+=(icon%=41)-(icon%=40)
  2561. tempy%<1 tempy%=10 
  2562. tempy%>10 tempy%=1
  2563. setwritable(17,tempy%):
  2564. "Wimp_ForceRedraw",scalinghandle%,jx1%,jy1%,jx2%,jy2%
  2565. 37,38,39:
  2566.  X format radio icons
  2567. i%=37 
  2568. 39:s%(i%)=(i%=icon%):
  2569. 42,43,44:
  2570.  X format radio icons
  2571. i%=42 
  2572. 44:s%(i%)=(i%=icon%):
  2573.  normal icons
  2574.  s%(icon%)=
  2575. s%(icon%)
  2576. ScalingAuto% 
  2577. M? ScalingBound%=s%(34):ScalingXLog%=s%(8):ScalingYLog%=s%(9)
  2578. autoscale
  2579. OS icon%=2:button%=1:
  2580. cancelOK:
  2581.  imitates click on Cancel icon with Adjust button
  2582. icon%<34 
  2583. greyscaling
  2584. putscaling
  2585. VaScalingXMin=
  2586. Tgetwritable(10):ScalingXMax=
  2587. Tgetwritable(11):ScalingXAtYAxis=
  2588. Tgetwritable(12)
  2589. W%ScalingXDigits%=
  2590. Tgetwritable(13)
  2591. XaScalingYMin=
  2592. Tgetwritable(14):ScalingYMax=
  2593. Tgetwritable(15):ScalingYAtXAxis=
  2594. Tgetwritable(16)
  2595. Y%ScalingYDigits%=
  2596. Tgetwritable(17)
  2597. ZdScalingXMajor=
  2598. Tgetwritable(18):ScalingXMinor=
  2599. Tgetwritable(19):ScalingXAnchor=
  2600. Tgetwritable(20)
  2601. [dScalingYMajor=
  2602. Tgetwritable(21):ScalingYMinor=
  2603. Tgetwritable(22):ScalingYAnchor=
  2604. Tgetwritable(23)
  2605. \/i%=4:
  2606. :i%-=1:
  2607. s%(27-i%):ScalingXLogType%=i%
  2608. ]/i%=4:
  2609. :i%-=1:
  2610. s%(32-i%):ScalingYLogType%=i%
  2611. ^.i%=3:
  2612. :i%-=1:
  2613. s%(37+i%):ScalingXFormat%=i%
  2614. _.i%=3:
  2615. :i%-=1:
  2616. s%(42+i%):ScalingYFormat%=i%
  2617. `>ScalingBound%=s%(34):ScalingXLog%=s%(8):ScalingYLog%=s%(9)
  2618. checkscaling
  2619. scalingerror$=""
  2620. ScalingXLog% 
  2621. ScalingXMin<=0 
  2622. adderror("min x value bad for log scale")
  2623. ScalingXMajor<ScalingXMinor 
  2624. adderror("minor>major in x spacing")
  2625. ScalingXMajor<=0 
  2626. ScalingXMinor<=0 
  2627. adderror("x spacing <= 0")
  2628. ScalingYLog% 
  2629. ScalingYMin<=0 
  2630. adderror("min y value bad for log scale")
  2631. ScalingYMajor<ScalingYMinor 
  2632. adderror("minor>major in y spacing")
  2633. ScalingYMajor<=0 
  2634. ScalingYMinor<=0 
  2635. adderror("y spacing <= 0")
  2636. ScalingXMin>=ScalingXMax 
  2637. adderror("min>=max in x values")
  2638. ScalingYMin>=ScalingYMax 
  2639. adderror("min>=max in y values")
  2640. ScalingXDigits%<1 
  2641. ScalingXDigits%>10 
  2642. adderror("bad number of x digits")
  2643. ScalingYDigits%<1 
  2644. ScalingYDigits%>10 
  2645. adderror("bad number of y digits")
  2646. scalingerror$ 
  2647. report(scalingerror$):button%=1
  2648. adderror(i$)
  2649. scalingerror$ scalingerror$+=", "+i$ 
  2650. scalingerror$=i$
  2651. getcolumn
  2652. handle%=columnhandle%
  2653. setwritable(3,caretcolumn%):
  2654. setwritablestring(4,ColumnMeaning$(caretcolumn%))
  2655. setwritable(7,ColumnThick(caretcolumn%))
  2656. setwritable(8,ColumnDash(caretcolumn%)):
  2657. setwritable(9,ColumnGap(caretcolumn%))
  2658. setwritable(11,ColumnErrorThick(caretcolumn%)):
  2659. setwritable(12,ColumnErrorCap(caretcolumn%))
  2660. setwritable(17,ColumnWidth(caretcolumn%)):
  2661. setwritable(18,ColumnHeight(caretcolumn%))
  2662. setwritable(19,ColumnChar%(caretcolumn%)):
  2663. setwritablestring(13,ColumnKeyText$(caretcolumn%))
  2664. setwritable(45,ColumnDash2(caretcolumn%))
  2665. setwritablestring(47,style$(ColumnLinestyle%(caretcolumn%)))
  2666.  MultipleX% 
  2667. ColumnMeaning$(caretcolumn%),1)<>"X" 
  2668. setwritable(49,ColumnX%(caretcolumn%)) 
  2669. setwritable(49,0)
  2670. 'tempchar%=ColumnChar%(caretcolumn%)
  2671. =!block%=handle%:block%!4=19:
  2672. "Wimp_GetIconState",,block%
  2673. >ix1%=block%!8:iy1%=block%!12:ix2%=block%!16:iy2%=block%!20
  2674. =!block%=handle%:block%!4=22:
  2675. "Wimp_GetIconState",,block%
  2676. >jx1%=block%!8:jy1%=block%!12:jx2%=block%!16:jy2%=block%!20
  2677. Js%()=
  2678. :s%(5)=ColumnPlot%(caretcolumn%):s%(6)=ColumnLine%(caretcolumn%)
  2679. is%(10)=ColumnError%(caretcolumn%):s%(16)=ColumnPoints%(caretcolumn%):s%(14)=ColumnFill%(caretcolumn%)
  2680. &s%(15)=ColumnColour%(caretcolumn%)
  2681. 's%(41)=ColumnLinecol%(caretcolumn%)
  2682. 's%(43)=ColumnCharcol%(caretcolumn%)
  2683. greycolumn
  2684. greycolumn
  2685.  i%,i$
  2686. ColumnMeaning$(caretcolumn%),1)<>"Y" 
  2687.  g%()=
  2688. :g%(5)=
  2689. :g%(4)=
  2690. setgrey(47,
  2691. setgrey(8,
  2692. setgrey(9,
  2693. setgrey(45,
  2694. setgreycolour(columnhandle%,41,"line")
  2695. setgreycolour(columnhandle%,43,"char")
  2696. / g%()=
  2697. :g%(7)=s%(6):g%(8)=g%(7):g%(9)=g%(7)
  2698.   g%(11)=s%(10):g%(12)=g%(11)
  2699. X g%(17)=s%(16):g%(18)=g%(17):g%(19)=g%(17):g%(20)=g%(17):g%(21)=g%(17):g%(22)=g%(17)
  2700. ) g%(14)=
  2701. ScalingYLog% 
  2702. ScalingBound%
  2703. # g%(13)=GraphKey%:g%(15)=s%(14)
  2704.  s%(6) 
  2705. $  i$=
  2706. Tgetwritablestring(47),3)
  2707.   i%=-1
  2708.   i%+=1
  2709. style$(i%),3)=i$
  2710. setgrey(47,
  2711. setthestyle(i%)
  2712. setgrey(47,
  2713. setgrey(8,
  2714. setgrey(9,
  2715. setgrey(45,
  2716. setselectgrey(4,22)
  2717. g%(15) 
  2718. grey%) 
  2719. setgreycolour(handle%,15,"fill")
  2720. setcolour(handle%,15,s%(15),"fill")
  2721. s%(16) 
  2722. setgreycolour(handle%,43,"char")
  2723. setcolour(handle%,43,s%(43),"char")
  2724. s%(6) 
  2725. setgreycolour(handle%,41,"line")
  2726. setcolour(handle%,41,s%(41),"line")
  2727. setgrey(49,MultipleX% 
  2728. ColumnMeaning$(caretcolumn%),1)<>"X")
  2729. "Wimp_ForceRedraw",handle%,jx1%,jy1%,jx2%,jy2%
  2730. selectcolumn
  2731. tempchar%=
  2732. Tgetwritable(19)
  2733. icon% 
  2734. 20,21:
  2735.  arrow icons
  2736. :tempchar%+=(icon%=21)-(icon%=20):
  2737. tempchar%<>127
  2738. tempchar%<32 tempchar%=255 
  2739. tempchar%>255 tempchar%=32
  2740. setwritable(19,tempchar%):
  2741. "Wimp_ForceRedraw",handle%,ix1%,iy1%,ix2%,iy2%
  2742. "Wimp_ForceRedraw",handle%,jx1%,jy1%,jx2%,jy2%
  2743.  normal icons
  2744.  s%(icon%)=
  2745. s%(icon%)
  2746. greycolumn
  2747. redrawcolumn
  2748. x%,y%,i$,dofont%,fonthandle%,bx1%,by1%,bx2%,by2%,cl%
  2749. !block%=columnhandle%:SYS"Wimp_GetWindowState",,block%
  2750. Tx%=block%!4-block%!20:y%=block%!16-block%!24:
  2751.  screen co-ords of top-left corner
  2752. tempchar%:dofont%=
  2753.  dofont%=
  2754. dofont% 
  2755. "Font_FindFont",,FontsPoints$,16*32,16*32 
  2756. fonthandle%
  2757. "Font_CharBBox",fonthandle%,tempchar%,16 
  2758. ,bx1%,by1%,bx2%,by2%
  2759. g%(19) cl%=7 
  2760. cl%=2
  2761. "Wimp_SetFontColours",,0,cl%
  2762. "Font_Paint",,i$,16,x%+(jx1%+jx2%)/2-(bx1%+bx2%)/2,y%+(jy1%+jy2%)/2-(by1%+by2%)/2
  2763. "Font_LoseFont",fonthandle%
  2764. "Wimp_SetColour",11
  2765. x%+jx1%+56,y%+jy2%-32:
  2766. "Bad"
  2767. x%+jx1%+48,y%+jy2%-72:
  2768. "Font"
  2769. putcolumn
  2770. i%,i$
  2771. handle%=columnhandle%
  2772. .ColumnThick(caretcolumn%)=
  2773. Tgetwritable(7)
  2774. VColumnDash(caretcolumn%)=
  2775. Tgetwritable(8):ColumnGap(caretcolumn%)=
  2776. Tgetwritable(9)
  2777. cColumnErrorThick(caretcolumn%)=
  2778. Tgetwritable(11):ColumnErrorCap(caretcolumn%)=
  2779. Tgetwritable(12)
  2780. \ColumnWidth(caretcolumn%)=
  2781. Tgetwritable(17):ColumnHeight(caretcolumn%)=
  2782. Tgetwritable(18)
  2783. dColumnChar%(caretcolumn%)=
  2784. Tgetwritable(19):ColumnKeyText$(caretcolumn%)=
  2785. Tgetwritablestring(13)
  2786.  MultipleX% 
  2787. ColumnMeaning$(caretcolumn%),1)<>"X" ColumnX%(caretcolumn%)=
  2788. Tgetwritable(49)
  2789. Tgetwritablestring(47),3)
  2790.     i%=-1
  2791.     i%+=1
  2792. style$(i%),3)=i$
  2793. %ColumnLinestyle%(caretcolumn%)=i%
  2794. /ColumnDash2(caretcolumn%)=
  2795. Tgetwritable(45)
  2796. CColumnPlot%(caretcolumn%)=s%(5):ColumnLine%(caretcolumn%)=s%(6)
  2797. iColumnError%(caretcolumn%)=s%(10):ColumnPoints%(caretcolumn%)=s%(16):ColumnFill%(caretcolumn%)=s%(14)
  2798. &ColumnColour%(caretcolumn%)=s%(15)
  2799. 'ColumnLinecol%(caretcolumn%)=s%(41)
  2800. 'ColumnCharcol%(caretcolumn%)=s%(43)
  2801. ScalingAuto% 
  2802. autoscale
  2803. update(tophandle%)
  2804. getmeaning
  2805. i$,l$,n$,i%
  2806. 7i$=ColumnMeaning$(caretcolumn%):l$=
  2807. i$,1):n$=
  2808. i$,2)
  2809. setwritablestring(11,n$)
  2810.         .s%()=
  2811. :s%(0)=
  2812. "XYLRHDUV",l$):s%(2+s%(0))=
  2813. greymeaning
  2814. greymeaning
  2815. +g%()=
  2816. s%(0)=1 
  2817.  MultipleX% g%(11)=
  2818. setselectgrey(3,11)
  2819. selectmeaning
  2820. $s%()=
  2821. :s%(0)=icon%-2:s%(icon%)=
  2822. greymeaning
  2823. putmeaning
  2824. i$,j$
  2825. "XYLRHDUV",s%(0),1)
  2826. i$<>"X" 
  2827.   i$+=
  2828. Tgetwritablestring(11)
  2829.  MultipleX% 
  2830.    j$=
  2831. Tgetwritablestring(11)
  2832.  j$="" i$="X0" 
  2833.  i$+=j$
  2834.     "#ColumnMeaning$(caretcolumn%)=i$
  2835. update(tophandle%)
  2836. getsave
  2837. handle%=savehandle%
  2838. setwritablestring(3,Save$(SaveType%))
  2839. setwritablestring(0,FileType$(SaveType%))
  2840. putsave
  2841. handle%=savehandle%
  2842.     .+Save$(SaveType%)=
  2843. Tgetwritablestring(3)
  2844. getcalculate
  2845. setwritablestring(0,Calculate$)
  2846. putcalculate
  2847.     6%Calculate$=
  2848. Tgetwritablestring(0)
  2849. calculate
  2850. calculate
  2851. j%,noerror%,calc$,pos%,n$,a$,b$,row%,i%,ds%,col%
  2852. "Hourglass_On"
  2853. col%=caretx1% 
  2854. caretx2%
  2855.     >5 calc$=Calculate$:workhorse%()=
  2856. :pos%=
  2857. calc$,"#")
  2858.  pos%
  2859.     @=  n$=
  2860. calc$,pos%+1,1):a$=
  2861. calc$,pos%-1):b$=
  2862. calc$,pos%+2)
  2863.     A0  
  2864. "9" n$+=
  2865. b$,1):b$=
  2866. b$,2)
  2867. n$="@" n$=
  2868.     CD  
  2869. n$="#" calc$=a$+"row%"+b$ 
  2870. calc$=a$+"FNTdata("+n$+",row%)"+b$
  2871.     D   
  2872. n$<>"#" workhorse%(
  2873.   pos%=
  2874. calc$,"#")
  2875.  workhorse is TRUE for columns which DON'T feature in the calculation
  2876.  noerror%=
  2877. row%=carety1% 
  2878. carety2%
  2879.  j%=2:noerror%=
  2880. noerror% 
  2881. data(col%,row%,
  2882. calc$)
  2883.   j%=
  2884. i%=0 
  2885.     PD  ds%=DataStatus%?(i%+C1%*row%):
  2886. ds%=2 
  2887. workhorse%(i%) 
  2888. 255,"M"
  2889.     Q&  j%=j% 
  2890. ((ds%=1) 
  2891. workhorse%(i%))
  2892. j% j%=1 
  2893.     U. noerror%=
  2894. :DataStatus%?(col%+C1%*row%)=j%
  2895. carety2%>maxrow% maxrow%=carety2%
  2896. caretx2%>maxcolumn% maxcolumn%=caretx2%
  2897. redrawmain(caretx1%,caretx2%,carety1%,carety2%)
  2898. caretstring(11):
  2899. changed(
  2900. "Hourglass_Smash"
  2901. getoptions
  2902.     `ms%(3)=SaveIncludePoint%:s%(4)=SaveIncludeMove%:s%(5)=SaveOrder%:s%(6)=SaveLocal%:s%(7)=SaveBinaryColumns%
  2903. g%()=
  2904. setselectgrey(3,7)
  2905. selectoptions
  2906. s%(icon%)=
  2907. s%(icon%)
  2908. putoptions
  2909.     imSaveIncludePoint%=s%(3):SaveIncludeMove%=s%(4):SaveOrder%=s%(5):SaveLocal%=s%(6):SaveBinaryColumns%=s%(7)
  2910. getmagnify
  2911. setwritable(3,Magnify)
  2912.     n's%(3)=
  2913. :g%(3)=
  2914. setselectgrey(3,3)
  2915. putmagnify
  2916. Tgetwritable(3)
  2917. i>0 Magnify=i
  2918. getbestfit
  2919. setwritable(3,BestFitYColumn%):
  2920. setwritable(5,BestFitX):
  2921. setwritable(6,BestFitY)
  2922.     y's%(4)=BestFitForce%:s%(5)=
  2923. :s%(6)=
  2924. greybestfit
  2925. greybestfit
  2926.     ~#g%(4)=
  2927. :g%(5)=s%(4):g%(6)=g%(5)
  2928. setselectgrey(4,6)
  2929. selectbestfit
  2930. s%(icon%)=
  2931. s%(icon%)
  2932. greybestfit
  2933. putbestfit
  2934.  A$,B$,pk1,pk2
  2935. XBestFitYColumn%=
  2936. Tgetwritable(3):BestFitX=
  2937. Tgetwritable(5):BestFitY=
  2938. Tgetwritable(6)
  2939. BestFitForce%=s%(4)
  2940. caretx2%<>caretx1% 
  2941. report("Best fit: too many destination columns"):
  2942. 'x%=-1:y%=-1:A$="Y"+
  2943. BestFitYColumn%
  2944.  MultipleX% 
  2945.   i%=-1
  2946.   i%+=1
  2947.   i$=ColumnMeaning$(i%)
  2948.  i%=C% 
  2949.  i$=A$
  2950.  i$=A$ y%=i%
  2951.  y%>-1 
  2952. ,    i%=-1:ii%=ColumnX%(y%):A$="X"+
  2953. (ii%)
  2954.         
  2955.     i%+=1
  2956.     i$=ColumnMeaning$(i%)
  2957.  i%=C% 
  2958.  i$=A$
  2959. 9    
  2960.  i$=A$ x%=i%:ColumnX%(caretcolumn%)=ColumnX%(y%)
  2961. i%=0 
  2962.   i$=ColumnMeaning$(i%)
  2963. x%=-1 
  2964. i$="X" x%=i%
  2965. y%=-1 
  2966. i$="Y"+
  2967. BestFitYColumn% y%=i%
  2968. x%=-1 
  2969. report("Best fit: no X column"):
  2970. y%=-1 
  2971. report("Best fit: no Y column"):
  2972. $s%=0:sx=0:sy=0:sxx=0:sxy=0:syy=0
  2973. i%=carety1% 
  2974. carety2%
  2975. DataStatus%?(x%+C1%*i%)=1 
  2976. DataStatus%?(y%+C1%*i%)=1 
  2977. * s%+=1:x=
  2978. Tdata(x%,i%):y=
  2979. Tdata(y%,i%)
  2980. ScalingXLog% 
  2981. x>0 x=
  2982. report("Best fit: bad log"):
  2983. ScalingYLog% 
  2984. y>0 y=
  2985. report("Best fit: bad log"):
  2986. + sx+=x:sy+=y:sxx+=x*x:sxy+=x*y:syy+=y*y
  2987. s%<2 
  2988. report("Best fit: not enough points"):
  2989. BestFitForce% 
  2990. " h=BestFitX:
  2991. ScalingXLog% h=
  2992. " k=BestFitY:
  2993. ScalingYLog% k=
  2994. 1 m=(sxy-k*sx-h*sy+s%*h*k)/(sxx-2*h*sx+s%*h*h)
  2995.  c=k-m*h
  2996. $ m=(sxy*s%-sx*sy)/(s%*sxx-sx*sx)
  2997.  c=(sy-m*sx)/s%
  2998. i%=carety1% 
  2999. carety2%
  3000. 'DataStatus%?(caretcolumn%+C1%*i%)=0
  3001. DataStatus%?(x%+C1%*i%)=1 
  3002. Tdata(x%,i%):
  3003. ScalingXLog% x=
  3004.  y=m*x+c:
  3005. ScalingYLog% y=
  3006. data(caretcolumn%,i%,y)
  3007. ( DataStatus%?(caretcolumn%+C1%*i%)=1
  3008. caretcolumn%>maxcolumn% maxcolumn%=caretcolumn%
  3009. redrawmain(caretcolumn%,caretcolumn%,carety1%,carety2%)
  3010. caretstring(11):
  3011. changed(
  3012.  ScalingXLog% 
  3013.  ScalingYLog% 
  3014.   pk1=
  3015. -  A$ = "y = "+
  3016. (pk1)+" * (x ** "+
  3017. (m)+")"
  3018. )  A$ = "y = "+
  3019. (m)+" * LN(x) + "+
  3020.  ScalingYLog% 
  3021.   pk1=
  3022. /  A$ = "y = "+
  3023. (pk1)+" * EXP("+
  3024. (m)+" * x)"
  3025. %  A$ = "y = "+
  3026. (m)+" * x + "+
  3027. handle%=corrnhandle%
  3028. setwritablestring(3,A$)
  3029. BestFitForce% 
  3030.  B$="Not applicable"
  3031. < pk2 = (sxy*s%-sx*sy)/
  3032. ( (sxx*s%-sx*sx)*(syy*s%-sy*sy) )
  3033. (pk2)
  3034. setwritablestring(4,B$)
  3035. update(corrnhandle%)
  3036. openwindow(corrnhandle%)
  3037. getfonts
  3038. setwritablestring(0,FontsPoints$)
  3039. setwritablestring(3,FontsLabels$)
  3040. putfonts
  3041. 'FontsPoints$=
  3042. Tgetwritablestring(0)
  3043. 'FontsLabels$=
  3044. Tgetwritablestring(3)
  3045. Tcheckfont(FontsPoints$) 
  3046. report("Warning: the font for data points is absent!")
  3047. Tcheckfont(FontsLabels$) 
  3048. report("Warning: the font for graph labels is absent!")
  3049. getweed
  3050. setwritable(3,WeedGap%)
  3051. s%()=
  3052. :s%(6)=WeedSelection%
  3053. greyweed
  3054. greyweed
  3055. g%()=
  3056. setselectgrey(3,6)
  3057. selectweed
  3058.  gap%
  3059.  icon% 
  3060.  select
  3061.  s%(6)=
  3062. s%(6)
  3063.  arrow icons
  3064. . gap%=
  3065. Tgetwritable(3)-(icon%=4)+(icon%=5)
  3066. gap%<1 gap%=1
  3067. gap%>99 gap%=99
  3068. setwritable(3,gap%)
  3069. "Wimp_ForceRedraw",handle%,220,-60,280,0
  3070. putweed
  3071. WeedGap%=
  3072. Tgetwritable(3)
  3073. WeedSelection%=s%(6)
  3074. WeedGap%<1 WeedGap%=1
  3075. doweed
  3076. getimport
  3077. setwritable(5,ImportNumber%):
  3078. setwritable(6,ImportGap%)
  3079. setwritable(7,ImportRow%):
  3080. setwritable(8,ImportCol%)
  3081. s%()=
  3082. :s%(4)=ImportGet%
  3083. greyimport
  3084. greyimport
  3085. g%()=
  3086. :g%(5)=
  3087. s%(4)
  3088. setselectgrey(4,8)
  3089. selectimport
  3090. icon%=4 
  3091.  s%(4)=
  3092. s%(4)
  3093. greyimport
  3094. putimport
  3095. $>ImportNumber%=
  3096. Tgetwritable(5):ImportGap%=
  3097. Tgetwritable(6)
  3098. %;ImportRow%=
  3099. Tgetwritable(7):ImportCol%=
  3100. Tgetwritable(8)
  3101. ImportGet%=s%(4)
  3102. ImportNumber%<1 ImportNumber%=1
  3103. ImportGap%<1 ImportGap%=1
  3104. getdownto
  3105. setwritable(3,maxrow%)
  3106. s%()=
  3107. greydownto
  3108. greydownto
  3109. g%()=
  3110. setselectgrey(3,5)
  3111. selectdownto
  3112.  gap%
  3113.  icon% 
  3114.  arrow icons
  3115. :. gap%=
  3116. Tgetwritable(3)-(icon%=4)+(icon%=5)
  3117. gap%<0 gap%=0
  3118. gap%>P% gap%=P%
  3119. setwritable(3,gap%)
  3120. "Wimp_ForceRedraw",handle%,220,-60,280,0
  3121. putdownto
  3122.  end%
  3123. end%=
  3124. Tgetwritable(3)
  3125. highlight(caretcolumn%,caretcolumn%,0,end%)
  3126. getmany
  3127. setwritablestring(3,ManyChoice$):
  3128. setwritablestring(4,ManyTag$)
  3129. s%()=
  3130. greymany
  3131. greymany
  3132. g%()=
  3133. setselectgrey(3,4)
  3134. putmany
  3135. i%,col%,i$,j$,i1%,i2%,t$
  3136. UFManyChoice$=
  3137. Tgetwritablestring(3):ManyTag$=
  3138. Tgetwritablestring(4)
  3139. t$=ManyTag$:i%=
  3140. t$,"#")
  3141. X" t$=
  3142. i$,i%-1)+"col%"+
  3143. t$,i%+1)
  3144. t$,"#")
  3145. t$="" t$="-1"
  3146. i$=ManyChoice$
  3147. i$,1)=" ":i$=
  3148. i$,2):
  3149. i$)=" ":i$=
  3150. i$="" i$="FALSE"
  3151. i$,"#")
  3152. (i$="TRUE" 
  3153. i$="FALSE") 
  3154. c#  i$=
  3155. i$,i%-1)+"col%"+
  3156. i$,i%+1)
  3157.   i%=
  3158. i$,"#")
  3159. col%=0 
  3160. manycopy(col%,caretcolumn%,t$)
  3161.   i%=
  3162. i$,",")
  3163. i% j$=
  3164. i$,i%-1):i$=
  3165. i$,i%+1) 
  3166. j$=i$:i$=""
  3167.   i%=
  3168. j$,"-")
  3169. i% i1%=
  3170. j$,i%-1):i2%=
  3171. j$,i%+1) 
  3172. j$:i2%=i1%
  3173. col%=i1% 
  3174. p&   
  3175. manycopy(col%,caretcolumn%,t$)
  3176. i$=""
  3177. update(tophandle%)
  3178. manycopy(col%,s%,t$)
  3179. i%,i$
  3180. ColumnMeaning$(s%),1)
  3181. z*i%=
  3182. i%>=0 
  3183. i%<100 
  3184. i$<>"X" i$+=
  3185. ColumnMeaning$(col%)=i$
  3186. |%ColumnThick(col%)=ColumnThick(s%)
  3187. }#ColumnDash(col%)=ColumnDash(s%)
  3188. ~!ColumnGap(col%)=ColumnGap(s%)
  3189. /ColumnErrorThick(col%)=ColumnErrorThick(s%)
  3190. +ColumnErrorCap(col%)=ColumnErrorCap(s%)
  3191. %ColumnWidth(col%)=ColumnWidth(s%)
  3192. 'ColumnHeight(col%)=ColumnHeight(s%)
  3193. %ColumnChar%(col%)=ColumnChar%(s%)
  3194. +ColumnKeyText$(col%)=ColumnKeyText$(s%)
  3195. )ColumnColour%(col%)=ColumnColour%(s%)
  3196. %ColumnPlot%(col%)=ColumnPlot%(s%)
  3197. %ColumnLine%(col%)=ColumnLine%(s%)
  3198. 'ColumnError%(col%)=ColumnError%(s%)
  3199. )ColumnPoints%(col%)=ColumnPoints%(s%)
  3200. %ColumnFill%(col%)=ColumnFill%(s%)
  3201. +ColumnLinecol%(col%)=ColumnLinecol%(s%)
  3202. +ColumnCharcol%(col%)=ColumnCharcol%(s%)
  3203. /ColumnLinestyle%(col%)=ColumnLinestyle%(s%)
  3204. %ColumnDash2(col%)=ColumnDash2(s%)
  3205. ColumnX%(col%)=ColumnX%(s%)
  3206. getworksheet
  3207. setwritable(3,C1%):
  3208. setwritable(4,P1%)
  3209. setwritablestring(5,""):
  3210. setwritablestring(6,"")
  3211. s%()=
  3212. greyworksheet
  3213. greyworksheet
  3214. g%()=
  3215. setselectgrey(3,6)
  3216. putworksheet
  3217. i$,j$
  3218. AnewC1%=
  3219. Tgetwritablestring(5):newP1%=
  3220. Tgetwritablestring(6)
  3221. newC1%=0 
  3222. newP1%=0 
  3223. newC1%=0 
  3224. newP1%<minP1% newP1%=minP1%
  3225. 6 newC1%=room% 
  3226. newP1%:
  3227. newC1%>maxC1% newC1%=maxC1%
  3228. newP1%=0 newP1%=room% 
  3229. newC1%
  3230. newP1%<minP1% newP1%=minP1%
  3231. newC1%<2 
  3232. report("That gives less than 2 columns!"):
  3233. newC1%>maxC1% 
  3234. report("The maximum number of columns is "+
  3235. maxC1%+"!"):
  3236. newC1%<>C1% 
  3237. newP1%<=maxrow% 
  3238. changed% 
  3239. Tjeopardy 
  3240. cleardata
  3241. +C1%=newC1%:P1%=newP1%:C%=C1%-1:P%=P1%-1
  3242. setextent
  3243. update(tophandle%)
  3244. caretx2%<>caretx1% 
  3245. report("Sort: too many destination columns"):
  3246. carety2%=carety1% 
  3247. report("Sort: not enough points"):
  3248. "Hourglass_On"
  3249. (s%=caretcolumn%:n%=carety2%-carety1%
  3250. i%=carety1% 
  3251. carety2%-1
  3252. n%>100 
  3253. 10=0 
  3254. "Hourglass_Percentage",
  3255. (100.0*
  3256. (i%/n%))
  3257.  any%=
  3258. :I=0:k%=-1
  3259. j%=i% 
  3260. carety2%
  3261. DataStatus%?(s%+C1%*j%)=1 
  3262. Tdata(s%,j%)<I 
  3263. any%=
  3264. Tdata(s%,j%):k%=j%:any%=
  3265. any% 
  3266. (k%<>i%) 
  3267. l%=0 
  3268. @   I=
  3269. Tdata(l%,i%):
  3270. data(l%,i%,
  3271. Tdata(l%,k%)):
  3272. data(l%,k%,I)
  3273. l   I%=DataStatus%?(l%+C1%*i%):DataStatus%?(l%+C1%*i%)=DataStatus%?(l%+C1%*k%):DataStatus%?(l%+C1%*k%)=I%
  3274. "Hourglass_Smash"
  3275. getmaininfo:
  3276. redrawmain(lcolumn%,rcolumn%,trow%,brow%)
  3277. caretstring(11):
  3278. changed(
  3279. normalise
  3280. i%,j%,m
  3281. "Hourglass_On":m=0
  3282. i%=caretx1% 
  3283. caretx2%:
  3284. j%=carety1% 
  3285. carety2%
  3286. DataStatus%?(i%+C1%*j%)=1 
  3287. Tdata(i%,j%)>m m=
  3288. Tdata(i%,j%)
  3289. "Hourglass_Smash":
  3290. report("Can't normalise by zero!"):
  3291. i%=caretx1% 
  3292. caretx2%:
  3293. j%=carety1% 
  3294. carety2%
  3295. data(i%,j%,
  3296. Tdata(i%,j%)/m)
  3297. redrawmain(caretx1%,caretx2%,carety1%,carety2%)
  3298. caretstring(11):
  3299. changed(
  3300. "Hourglass_Smash"
  3301. defaultsavevars
  3302.  DrawFile,file_aff,TauFile,file_082,TauStyle,file_083,CSVFile,file_dfe,TextFile,file_fff,DataFile,file_ffd
  3303. i%=0 
  3304. Save$(i%),FileType$(i%):
  3305. OldSave$()=Save$()
  3306. *SaveIncludePoint%=
  3307. :SaveIncludeMove%=
  3308. 2SaveOrder%=
  3309. :SaveLocal%=
  3310. :SaveBinaryColumns%=
  3311. defaultvars
  3312. *DrawFrame%=
  3313. :DrawXAxis%=
  3314. :DrawYAxis%=
  3315.  FrameThick=0.6:AxisThick=0.6
  3316.  v1.50
  3317. <FrameFill%=
  3318. :FrameFillColour%=lgrey%:FrameColour%=black%
  3319. &KeyBack%=white%:KeyOutline%=black%
  3320. QTicksMajorXFrame%=
  3321. :TicksMajorYFrame%=
  3322. :TicksMajorXAxis%=
  3323. :TicksMajorYAxis%=
  3324. QTicksMinorXFrame%=
  3325. :TicksMinorYFrame%=
  3326. :TicksMinorXAxis%=
  3327. :TicksMinorYAxis%=
  3328. jTicksMajorIn=10:TicksMajorOut=0:TicksMajorDown=10:TicksMajorUp=10:TicksMajorLeft=10:TicksMajorRight=10
  3329. eTicksMinorIn=5:TicksMinorOut=0:TicksMinorDown=5:TicksMinorUp=5:TicksMinorLeft=5:TicksMinorRight=5
  3330. +TicksMajorThick=0.2:TicksMinorThick=0.2
  3331. ?GridsMajorX%=
  3332. :GridsMajorY%=
  3333. :GridsMinorX%=
  3334. :GridsMinorY%=
  3335. *GridsDash=1:GridsGap=3:GridsThick=0.05
  3336. ALabelsXFrame%=
  3337. :LabelsXAxis%=
  3338. :LabelsBelow%=
  3339. :LabelsXMinor%=
  3340. QLabelsYFrame%=
  3341. :LabelsYAxis%=
  3342. :LabelsLeft%=
  3343. :LabelsYMinor%=
  3344. :LabelsYRotate%=
  3345. (LabelsXOffset=0.25:LabelsYOffset=0.5
  3346. QFontsLabels$="Homerton.Medium.Oblique":LabelsFontWidth=18:LabelsFontHeight=18
  3347. IAxistextXPlot%=
  3348. :AxistextYPlot%=
  3349. :AxistextXFrame%=
  3350. :AxistextYFrame%=
  3351. 6AxistextBelow%=
  3352. :AxistextLeft%=
  3353. :AxistextRotate%=
  3354. UAxistextXOffset=0.5:AxistextYOffset=0.5:AxistextXSpacing=1.2:AxistextYSpacing=1.2
  3355. ]AxistextXText$="Horizontal text\(x variable)":AxistextYText$="Vertical text\(y variable)"
  3356. .AxistextFontWidth=18:AxistextFontHeight=18
  3357. GGraphWidth=5:GraphHeight=4:GraphLeft=2:GraphBottom=2:GraphBorder%=
  3358. PGraphBorderWidth=7:GraphBorderHeight=6:GraphBorderLeft=1:GraphBorderBottom=1
  3359. ,GraphKey%=
  3360. :GraphKeyLeft=8:GraphKeyTop=6
  3361. "ScalingAuto%=
  3362. :ScalingBound%=
  3363. !ScalingXLog%=
  3364. :ScalingYLog%=
  3365. 1ScalingXMin=1:ScalingXMax=2:ScalingXAtYAxis=1
  3366. 1ScalingYMin=1:ScalingYMax=2:ScalingYAtXAxis=1
  3367. KScalingXDigits%=3:ScalingYDigits%=3:ScalingXFormat%=0:ScalingYFormat%=0
  3368. 8ScalingXMajor=0.5:ScalingXMinor=0.1:ScalingXAnchor=0
  3369. 8ScalingYMajor=0.5:ScalingYMinor=0.1:ScalingYAnchor=0
  3370. )ScalingXLogType%=1:ScalingYLogType%=1
  3371. <ColumnPlot%()=
  3372. :ColumnMeaning$(0)="X":ColumnChar%(0)=108
  3373. i%=1 
  3374. maxC1%-1:ColumnMeaning$(i%)="Y"+
  3375. i%:ColumnChar%(i%)=108+i% 
  3376. %ColumnKeyText$()=ColumnMeaning$()
  3377.     bColumnLine%()=
  3378. :ColumnThick()=0.6:ColumnDash()=6:ColumnGap()=0:ColumnDash2()=6:ColumnFill%()=
  3379. 6ColumnPoints%()=
  3380. :ColumnWidth()=8:ColumnHeight()=8
  3381. ?ColumnError%()=
  3382. :ColumnErrorThick()=0.6:ColumnErrorCap()=10
  3383. SColumnLinecol%()=black%:ColumnCharcol%()=black%:linecol%=black%:charcol%=black%
  3384. (ColumnLinestyle%()=0:ColumnDash2()=0
  3385. ColumnX%()=0
  3386. ;BestFitYColumn%=1:BestFitForce%=
  3387. :BestFitX=0:BestFitY=0
  3388. )FontsPoints$="Selwyn":Calculate$="##"
  3389. 7Magnify=1:JeopardyWarning%=
  3390. :ColumnColour%()=lgrey%
  3391. WeedGap%=2:WeedSelection%=
  3392.  ImportGet%=
  3393. :ImportNumber%=2
  3394. *ImportGap%=1:ImportRow%=0:ImportCol%=0
  3395. ManyChoice$="":ManyTag$="#"
  3396. MultipleX%=
  3397. suffix%=
  3398. autoscale
  3399. x%,min,max,minb,maxb,i%,y%,ii%,ok%
  3400. ScalingAuto% 
  3401. 255,"shouldn't be autoscaling"
  3402. x%=-1:min=0:max=0
  3403. :ii%=0
  3404. :x%+=1
  3405. !4i%=ColumnPlot%(x%) 
  3406. ColumnMeaning$(x%),1)="X")
  3407. (x%=maxcolumn%)
  3408. Tmaxmin(x%,min,max)
  3409.  MultipleX% 
  3410.  ii%=0 
  3411. '$   ii%=1:minb=min:maxb=max:ok%=
  3412.  min>minb min=minb
  3413.  max<maxb max=maxb
  3414.  MultipleX%) 
  3415.   (x%=maxcolumn%)
  3416.  MultipleX% i%=ok%
  3417. 1; ScalingXMin=min:ScalingXMax=max:
  3418. min<=0 ScalingXLog%=
  3419. ScalingXLog% 
  3420. autolog(ScalingXMin,ScalingXMax,ScalingXLogType%)
  3421. ScalingXLogType%=-1 
  3422. autolin(ScalingXMin,ScalingXMax,ScalingXMajor,ScalingXMinor,ScalingXAnchor,
  3423. autolin(ScalingXMin,ScalingXMax,ScalingXMajor,ScalingXMinor,ScalingXAnchor,
  3424. 8D ScalingXAtYAxis=ScalingXMin:ScalingXDigits%=3:ScalingXFormat%=0
  3425. y%=-1:i%=
  3426. :min=0:max=0
  3427. y%<maxcolumn%
  3428. :y%+=1
  3429. =5ii%=ColumnPlot%(y%) 
  3430. ColumnMeaning$(y%),1)="Y")
  3431. (y%=maxcolumn%)
  3432. ii% ii%=
  3433. Tmaxmin(y%,min,max)
  3434. min<ScalingYMin ScalingYMin=min
  3435. max>ScalingYMax ScalingYMax=max
  3436. E%  ScalingYMin=min:ScalingYMax=max
  3437. i%=i% 
  3438. ScalingYMin<=0 ScalingYLog%=
  3439. ScalingYLog% 
  3440. autolog(ScalingYMin,ScalingYMax,ScalingYLogType%)
  3441. ScalingYLogType%=-1 
  3442. autolin(ScalingYMin,ScalingYMax,ScalingYMajor,ScalingYMinor,ScalingYAnchor,
  3443. autolin(ScalingYMin,ScalingYMax,ScalingYMajor,ScalingYMinor,ScalingYAnchor,
  3444. RD ScalingYAtXAxis=ScalingYMin:ScalingYDigits%=3:ScalingYFormat%=0
  3445. Tmaxmin(column%,
  3446.  min,
  3447.  max)
  3448. valid%=
  3449. :min=0:max=0
  3450. j%=0 
  3451. maxrow%
  3452. Tdata(column%,j%)
  3453. DataStatus%?(column%+C1%*j%)=1 
  3454. valid% 
  3455. D>max max=D
  3456. D<min min=D
  3457.   valid%=
  3458.   min=D:max=D
  3459. min=max 
  3460. 0:max=1
  3461. -1:min=2*min
  3462. 1:max=2*max
  3463. =valid%
  3464. autolog(
  3465.  min,
  3466.  max,
  3467.  type%)
  3468. n!min=10^
  3469. min:max=10^
  3470. max+1)
  3471. type%=3
  3472. max/min<1E6 type%=2
  3473. max/min<100 type%=1
  3474. max/min<20 type%=0
  3475. max/min<10 type%=-1
  3476. autolin(
  3477.  min,
  3478.  max,
  3479.  major,
  3480.  minor,
  3481.  anchor,allowminmaxtochange%)
  3482. w1xr=(max-min)/2:xl=10^(
  3483. xr):j%=
  3484. (xr/xl+0.001)
  3485. j%>4 major=5*xl:minor=xl 
  3486. j%>1 major=2*xl:minor=xl 
  3487. major=xl:minor=xl/2
  3488. allowminmaxtochange% min=
  3489. (min/major+0.001)*major:max=
  3490. (max/major-0.001+1)*major
  3491. anchor=min
  3492.  ##### generation of graph as a Draw file #####
  3493. Tgenerate(memory%)
  3494.  buffer%,newsize%,overflow%,ptr%
  3495.  output file already opened with handle c% if memory% is FALSE
  3496.  if memory% is TRUE, then write file to memory above HIMEM
  3497. overflow%=
  3498. memory% 
  3499.  buffer%=64*1024
  3500. "Wimp_SlotSize",MinSlotSize%+buffer%,-1 
  3501.  newsize%
  3502. newsize%<>MinSlotSize%+buffer% =0
  3503.  ptr%=0
  3504. ?point%=640:pointsininch%=72:point=point%*Magnify:drawn%()=
  3505. importdrawfile% 
  3506.  importdrawfile%=
  3507. "OS_File",5,file$ 
  3508.  ,,,,ptr%
  3509. "Load "+file$+" "+
  3510. ~Himem%
  3511. startdrawfile
  3512. fonttable
  3513. startgroup(1)
  3514. GraphBorder% 
  3515. GraphKey% 
  3516. startgroup(2)
  3517. FrameFill% 
  3518. fillback
  3519. plots
  3520. overflow% 
  3521. DrawFrame% 
  3522. frame
  3523. DrawXAxis% 
  3524. xaxis
  3525. DrawYAxis% 
  3526. yaxis
  3527. xmarks
  3528. ymarks
  3529. AxistextXPlot% 
  3530. xtext
  3531. AxistextYPlot% 
  3532. ytext
  3533. GraphBorder% 
  3534. GraphKey% 
  3535. endgroup(2)
  3536. GraphKey% 
  3537. startgroup(3):
  3538. graphkey:
  3539. endgroup(3)
  3540. GraphBorder% 
  3541. border
  3542. endgroup(1)
  3543. boundgroups
  3544. enddrawfile
  3545. overflow% 
  3546.     =ptr%
  3547. plots
  3548. x%,i%
  3549.  MultipleX% 
  3550.   x%=
  3551. Txcolumn:
  3552. x%<0 
  3553. i%=0 
  3554. ColumnMeaning$(i%),1)="Y") 
  3555. ColumnPlot%(i%) 
  3556. ycolumn(i%)
  3557. i%=0 
  3558. ColumnMeaning$(i%),1)="Y") 
  3559. ColumnPlot%(i%) 
  3560.     x%=ColumnX%(i%)
  3561.      
  3562. Tokx(x%) 
  3563. ycolumn(i%)
  3564. Tokx(
  3565.  xx%,i%
  3566. xx%=-1
  3567. xx%+=1
  3568. Zi%= (
  3569. ColumnMeaning$(xx%),1)="X") 
  3570.  ColumnPlot%(xx%) 
  3571. ColumnMeaning$(xx%),2))=x%)
  3572. xx%=C% 
  3573.  i% x%=xx%
  3574. Txcolumn
  3575. x%,i%
  3576. x%=-1:i%=-1
  3577.     i%+=1
  3578.  only use column i% if its ColumnPlot% is TRUE
  3579. ColumnMeaning$(i%),1)="X") 
  3580. ColumnPlot%(i%) x%=i%
  3581. i%=C% 
  3582. x%<>-1
  3583. ycolumn(y%)
  3584. column$,validpoints%,j%,L%,R%,U%,D%,k%,type%
  3585.  global x%
  3586. linecol%=ColumnLinecol%(y%)
  3587. charcol%=ColumnCharcol%(y%)
  3588.  column$=
  3589. ColumnMeaning$(y%))
  3590. validpoints%=0
  3591. j%=0 
  3592. maxrow%
  3593. DataStatus%?(x%+C1%*j%)=1 
  3594. DataStatus%?(y%+C1%*j%)=1 validpoints%+=1
  3595. ColumnFill%(y%) 
  3596. (validpoints%>1) 
  3597. ScalingYLog% 
  3598. ScalingBound% 
  3599. line(ColumnColour%(y%)):drawn%(y%)=
  3600. ColumnLine%(y%) 
  3601. (validpoints%>1) 
  3602. (ColumnDash(y%)>0) 
  3603. line(-1):drawn%(y%)=
  3604. ColumnError%(y%) 
  3605. validpoints% 
  3606.  error bars
  3607.  L%=-1:R%=-1:U%=-1:D%=-1
  3608. k%=0 
  3609. (column$=
  3610. ColumnMeaning$(k%))) 
  3611. ColumnPlot%(k%) 
  3612.  only use column k% if its ColumnPlot% is TRUE
  3613. -  type%=
  3614. "HLRVDU",
  3615. ColumnMeaning$(k%),1))
  3616. type% 
  3617. L%=-1 L%=k%
  3618. R%=-1 R%=k%
  3619. L%=-1 L%=k%
  3620. R%=-1 R%=k%
  3621. D%=-1 D%=k%
  3622. U%=-1 U%=k%
  3623. D%=-1 D%=k%
  3624. U%=-1 U%=k%
  3625. L%+R%+D%+U%<>-4 
  3626. errorbars:drawn%(y%)=
  3627. ColumnPoints%(y%) 
  3628. validpoints% 
  3629. points:drawn%(y%)=
  3630. line(fill%)
  3631. start%,possiblestart%,oldin%,ox,oy,j%,x,y,in%,option%,x1,y1,x2,y2,xx,yy,localbound%
  3632. linecol%=ColumnLinecol%(y%)
  3633.  there is a line to be plotted for data column x%,y%
  3634. Pstart%=
  3635. :possiblestart%=
  3636. :localbound%=ScalingBound%:
  3637. fill%<>-1 localbound%=
  3638. localbound% 
  3639.  oldin%=
  3640. :ox=0:oy=0
  3641. j%=0 
  3642. maxrow%
  3643. (DataStatus%?(x%+C1%*j%)=2 
  3644. DataStatus%?(y%+C1%*j%)=2) 
  3645. 6  in%=
  3646. :oldin%=
  3647. :possiblestart%=
  3648. start% 
  3649. endpath
  3650.   start%=
  3651. DataStatus%?(x%+C1%*j%)=1 
  3652. DataStatus%?(y%+C1%*j%)=1 
  3653. %  x=
  3654. Tdata(x%,j%):y=
  3655. Tdata(y%,j%)
  3656. P  in%=(x>=ScalingXMin) 
  3657. (x<=ScalingXMax) 
  3658. (y>=ScalingYMin) 
  3659. (y<=ScalingYMax)
  3660. $  option%=-4*in%-2*oldin%-start%
  3661.  option% 
  3662.  both points are in, path in progress, join them
  3663. draw(
  3664. Tx(x),
  3665. Ty(y))
  3666.  this point is in, previous point in, path not in progress but must have been declared possible: start, move to old, draw to current
  3667. linestartpath(j%):
  3668. move(
  3669. Tx(ox),
  3670. Ty(oy)):
  3671. draw(
  3672. Tx(x),
  3673. Ty(y))
  3674.  this point is in, the last one was out, path in progress, join them
  3675. crossing(ox,oy,x,y):
  3676. move(
  3677. Tx(xx),
  3678. Ty(yy)):
  3679. draw(
  3680. Tx(x),
  3681. Ty(y))
  3682.  this point is in, last was out, path not started
  3683.  possiblestart% 
  3684. .    
  3685.  start up, do crossing, move and draw
  3686. \     
  3687. linestartpath(j%):
  3688. crossing(ox,oy,x,y):
  3689. move(
  3690. Tx(xx),
  3691. Ty(yy)):
  3692. draw(
  3693. Tx(x),
  3694. Ty(y))
  3695.         
  3696. 3     
  3697.  point is in, so possible start of a line
  3698.      possiblestart%=
  3699.  this point is out, the last one was in, path in progress, join them
  3700. crossing(x,y,ox,oy):
  3701. draw(
  3702. Tx(xx),
  3703. Ty(yy))
  3704.  this point is out, last was in, must be a possible start
  3705. linestartpath(j%):
  3706. crossing(x,y,ox,oy):
  3707. move(
  3708. Tx(ox),
  3709. Ty(oy)):
  3710. draw(
  3711. Tx(xx),
  3712. Ty(yy))
  3713.  this point is out, the last one was out, path in progress, join them?
  3714. Tinandout 
  3715. move(
  3716. Tx(x1),
  3717. Ty(y1)):
  3718. draw(
  3719. Tx(x2),
  3720. Ty(y2))
  3721.  this point is out, last point out
  3722.  possiblestart% 
  3723. D     
  3724.  if there is a line, start up and draw it, else do nothing
  3725.  V     
  3726. Tinandout 
  3727. linestartpath(j%):
  3728. move(
  3729. Tx(x1),
  3730. Ty(y1)):
  3731. draw(
  3732. Tx(x2),
  3733. Ty(y2))
  3734.      
  3735.      possiblestart%=
  3736. #        
  3737. 255,"banjaxed"
  3738.   ox=x:oy=y:oldin%=in%
  3739. start% 
  3740. endpath
  3741. j%=0 
  3742. maxrow%
  3743. (DataStatus%?(x%+C1%*j%)=2 
  3744. DataStatus%?(y%+C1%*j%)=2) 
  3745. start% 
  3746. fill%<>-1 
  3747. draw(
  3748. Tx(x),
  3749. Ty(0))
  3750.   start%=
  3751. endpath
  3752. DataStatus%?(x%+C1%*j%)=1 
  3753. DataStatus%?(y%+C1%*j%)=1 
  3754. 4%  x=
  3755. Tdata(x%,j%):y=
  3756. Tdata(y%,j%)
  3757. start% 
  3758. draw(
  3759. Tx(x),
  3760. Ty(y))
  3761. linestartpath(j%)
  3762. start% 
  3763. :R    
  3764. fill%<>-1 
  3765. move(
  3766. Tx(x),
  3767. Ty(0)):
  3768. draw(
  3769. Tx(x),
  3770. Ty(y)) 
  3771. move(
  3772. Tx(x),
  3773. Ty(y))
  3774. start% 
  3775. fill%<>-1 
  3776. draw(
  3777. Tx(x),
  3778. Ty(0))
  3779. endpath
  3780. linestartpath(pt%)
  3781. start% 
  3782. 255,"Don't call PROClinestartpath if already started!"
  3783.  localbound% 
  3784.  do test as per usual if no bounds checking
  3785. pt%>=maxrow% 
  3786.   pt%+=1
  3787. DataStatus%?(x%+C1%*pt%)=1 
  3788. DataStatus%?(y%+C1%*pt%)=1 start%=
  3789. DataStatus%?(x%+C1%*pt%)=2 
  3790. DataStatus%?(y%+C1%*pt%)=2 pt%=maxrow%
  3791. start% 
  3792. (pt%=maxrow%)
  3793. start% 
  3794.   already checked if localbound%=TRUE
  3795.  start%=
  3796. fill%<>-1 
  3797. ScalingYLog% 
  3798. report("Can't do a log fill graph (no zero!)")
  3799. startpathfill(-1,0,fill%)
  3800. ColumnGap(y%)=0 
  3801. startpath(ColumnThick(y%),0,0,0,0)
  3802. startpath(ColumnThick(y%),128,ColumnDash(y%),ColumnGap(y%),ColumnDash2(y%))
  3803. crossing(xout,yout,xin,yin)
  3804. yh,xv,yv
  3805.  the line between <in> and <out> leaves the frame at xx,yy
  3806. yout>yin yh=ScalingYMax 
  3807. yh=ScalingYMin
  3808. xout<xin xv=ScalingXMin 
  3809. xv=ScalingXMax
  3810. xin=xout xx=xin:yy=yh:
  3811. yin=yout yy=yin:xx=xv:
  3812. g+yv=yout+(xv-xout)*(yin-yout)/(xin-xout)
  3813. yv<=ScalingYMax 
  3814. yv>=ScalingYMin xx=xv:yy=yv:
  3815. i1yy=yh:xx=xout+(yh-yout)*(xin-xout)/(yin-yout)
  3816. Tinandout
  3817. yleft,yright,xbottom,xtop,gotone%,xx,yy
  3818.  if TRUE, the line between x,y and ox,oy enters and leaves the frame at x1,y1 and x2,y2
  3819. (x<=ScalingXMin 
  3820. ox<=ScalingXMin) 
  3821. (x>=ScalingXMax 
  3822. ox>=ScalingXMax) 
  3823. (y<=ScalingYMin 
  3824. oy<=ScalingYMin) 
  3825. (y>=ScalingYMax 
  3826. oy>=ScalingYMax) =
  3827. x=ox 
  3828.  x<ScalingXMin 
  3829.  x>ScalingXMax =
  3830.  (y-ScalingYMax)*(oy-ScalingYMax)>0 =
  3831. s, x1=x:x2=x:y1=ScalingYMin:y2=ScalingYMax
  3832. y=oy 
  3833.  y<ScalingYMin 
  3834.  y>ScalingYMax =
  3835.  (x-ScalingXMax)*(ox-ScalingXMax)>0 =
  3836. y, y1=y:y2=y:x1=ScalingXMin:x2=ScalingXMax
  3837. |+yleft=oy+(ScalingXMin-ox)*(y-oy)/(x-ox)
  3838. },yright=oy+(ScalingXMax-ox)*(y-oy)/(x-ox)
  3839. ~-xbottom=ox+(ScalingYMin-oy)*(x-ox)/(y-oy)
  3840. *xtop=ox+(ScalingYMax-oy)*(x-ox)/(y-oy)
  3841. gotone%=
  3842. yleft>=ScalingYMin 
  3843. yleft<=ScalingYMax 
  3844.  (y-yleft)*(yleft-oy)>=0 gotone%=
  3845. :x1=ScalingXMin:y1=yleft
  3846. yright>=ScalingYMin 
  3847. yright<=ScalingYMax 
  3848.  (y-yright)*(yright-oy)>=0 
  3849.  xx=ScalingXMax:yy=yright
  3850. gotone% x2=xx:y2=yy:=
  3851. gotone%=
  3852. :x1=xx:y1=yy
  3853. xbottom>=ScalingXMin 
  3854. xbottom<=ScalingXMax 
  3855.  (x-xbottom)*(xbottom-ox)>=0 
  3856.  xx=xbottom:yy=ScalingYMin
  3857. gotone% x2=xx:y2=yy:=
  3858. gotone%=
  3859. :x1=xx:y1=yy
  3860. xtop>=ScalingXMin 
  3861. xtop<=ScalingXMax 
  3862.  (x-xtop)*(xtop-ox)>=0 
  3863. gotone% x2=xtop:y2=ScalingYMax:=
  3864. points
  3865. i$,fonthandle%,bx1%,by1%,bx2%,by2%,d%,x,y
  3866.  there are points to be plotted for data column x%,y%
  3867. ColumnChar%(y%)
  3868. pointlength(y%)
  3869. charcol%=ColumnCharcol%(y%)
  3870. d%=0 
  3871. maxrow%
  3872. Tdata(x%,d%):y=
  3873. Tdata(y%,d%)
  3874. DataStatus%?(x%+C1%*d%)=1 
  3875. DataStatus%?(y%+C1%*d%)=1 
  3876. ((x>=ScalingXMin 
  3877. x<=ScalingXMax 
  3878. y>=ScalingYMin 
  3879. y<=ScalingYMax) 
  3880. ScalingBound%) 
  3881. text(
  3882. Tx(x)-(x1+x2)/2,
  3883. Ty(y)-(y1+y2)/2,2,ColumnWidth(y%),ColumnHeight(y%),i$,0)
  3884. charcol%=black%
  3885. errorbars
  3886. w,d%,x,y,start%,e
  3887.  there are probably error bars to be plotted for column x%,y%
  3888.  using column L%,R%,D%,U% (any =-1 means no error bars there)
  3889. w=ColumnErrorCap(y%)
  3890. d%=0 
  3891. maxrow%
  3892. Tdata(x%,d%):y=
  3893. Tdata(y%,d%)
  3894. DataStatus%?(x%+C1%*d%)=1 
  3895. DataStatus%?(y%+C1%*d%)=1 
  3896. ((x>=ScalingXMin 
  3897. x<=ScalingXMax 
  3898. y>=ScalingYMin 
  3899. y<=ScalingYMax) 
  3900. ScalingBound%) 
  3901.  start%=
  3902. L%>=0 
  3903. DataStatus%?(L%+C1%*d%)=1 
  3904. start% start%=
  3905. startpath(ColumnErrorThick(y%),0,0,0,0)
  3906.    e=
  3907. Tdata(L%,d%)
  3908. move(
  3909. Tx(x),
  3910. Ty(y)):
  3911. draw(
  3912. Tx(x-e),
  3913. Ty(y))
  3914. move(
  3915. Tx(x-e),
  3916. Ty(y)-w):
  3917. draw(
  3918. Tx(x-e),
  3919. Ty(y)+w)
  3920. R%>=0 
  3921. DataStatus%?(R%+C1%*d%)=1 
  3922. start% start%=
  3923. startpath(ColumnErrorThick(y%),0,0,0,0)
  3924.    e=
  3925. Tdata(R%,d%)
  3926. move(
  3927. Tx(x),
  3928. Ty(y)):
  3929. draw(
  3930. Tx(x+e),
  3931. Ty(y))
  3932. move(
  3933. Tx(x+e),
  3934. Ty(y)-w):
  3935. draw(
  3936. Tx(x+e),
  3937. Ty(y)+w)
  3938. D%>=0 
  3939. DataStatus%?(D%+C1%*d%)=1 
  3940. start% start%=
  3941. startpath(ColumnErrorThick(y%),0,0,0,0)
  3942.    e=
  3943. Tdata(D%,d%)
  3944. move(
  3945. Tx(x),
  3946. Ty(y)):
  3947. draw(
  3948. Tx(x),
  3949. Ty(y-e))
  3950. move(
  3951. Tx(x)-w,
  3952. Ty(y-e)):
  3953. draw(
  3954. Tx(x)+w,
  3955. Ty(y-e))
  3956. U%>=0 
  3957. DataStatus%?(U%+C1%*d%)=1 
  3958. start% start%=
  3959. startpath(ColumnErrorThick(y%),0,0,0,0)
  3960.    e=
  3961. Tdata(U%,d%)
  3962. move(
  3963. Tx(x),
  3964. Ty(y)):
  3965. draw(
  3966. Tx(x),
  3967. Ty(y+e))
  3968. move(
  3969. Tx(x)-w,
  3970. Ty(y+e)):
  3971. draw(
  3972. Tx(x)+w,
  3973. Ty(y+e))
  3974. start% 
  3975. endpath
  3976. xmarks
  3977. minors%,exponent%,m,mantissa%,x,y,i%,a%,i$,x1,y1,x2,y2,i,ex,ex$
  3978.  variables for label offset control
  3979. -frameup=0:framedown=0:axisup=0:axisdown=0
  3980. DrawFrame% 
  3981. TicksMajorXFrame% 
  3982. 2 frameup=TicksMajorOut:framedown=TicksMajorOut
  3983. TicksMinorXFrame% 
  3984. (TicksMinorOut>TicksMajorOut) frameup=TicksMinorOut:framedown=TicksMinorOut
  3985. DrawXAxis% 
  3986. TicksMajorXAxis% 
  3987. 0 axisup=TicksMajorUp:axisdown=TicksMajorDown
  3988. TicksMinorXAxis% 
  3989. (TicksMinorUp>TicksMajorUp) axisup=TicksMinorUp
  3990. TicksMinorXAxis% 
  3991. (TicksMinorDown>TicksMajorDown) axisdown=TicksMinorDown
  3992.  now prepare for loop
  3993. ScalingXLog% 
  3994.  minors%=2
  3995. ? exponent%=
  3996. (ScalingXMin*0.999):m=ScalingXMin/10^exponent%
  3997. ScalingXLogType% 
  3998. 0,-1:
  3999. m>5 mantissa%=1:exponent%+=1 
  4000. m>2 mantissa%=5 
  4001. mantissa%=2
  4002. m>3 mantissa%=1:exponent%+=1 
  4003. mantissa%=3
  4004. 2:mantissa%=1:
  4005. m>1 exponent%+=1
  4006. 3:mantissa%=1:
  4007. m>1 exponent%+=1
  4008. exponent% 
  4009. 3 exponent%+=1:
  4010. exponent% 
  4011. 3 exponent%+=1
  4012.  x=mantissa%*10^exponent%
  4013.  i%=1:
  4014. mantissa%=1 i%=0
  4015.  ScalingXLogType%=-1 
  4016.  mantissa%=1 
  4017.  mantissa%=2 
  4018.  mantissa%=5 i%=0 
  4019.  i%=1
  4020. 1 minors%=
  4021. (ScalingXMajor/ScalingXMinor+0.001)
  4022. d a%=0:
  4023. ScalingXAnchor>ScalingXMin a%=minors%*
  4024. ((ScalingXAnchor-ScalingXMin)/ScalingXMajor+1.001)
  4025.  i%=-1
  4026. :i%+=1:x=ScalingXAnchor+(i%-a%)*ScalingXMajor/minors%:
  4027. x>=ScalingXMin
  4028. linecol%=FrameColour%
  4029. charcol%=FrameColour%
  4030. x<=ScalingXMax
  4031.  grids
  4032. ((i% 
  4033. minors%=0) 
  4034. GridsMinorX%) 
  4035. GridsMajorX% 
  4036. (GridsDash>0) 
  4037. GridsGap>0 
  4038. startpath(GridsThick,128,GridsDash,GridsGap,0) 
  4039. startpath(GridsThick,0,0,0,0)
  4040. move(
  4041. Tx(x),
  4042. Ty(ScalingYMin)):
  4043. draw(
  4044. Tx(x),
  4045. Ty(ScalingYMax))
  4046. endpath
  4047.  ticks
  4048. minors% 
  4049.  minor tick
  4050. DrawFrame% 
  4051. TicksMajorXFrame% 
  4052. TicksMinorXFrame% 
  4053. (TicksMinorIn+TicksMinorOut>0) 
  4054.  do a frame tick
  4055. startpath(TicksMinorThick,0,0,0,0)
  4056. move(
  4057. Tx(x),
  4058. Ty(ScalingYMin)-TicksMinorOut):
  4059. draw(
  4060. Tx(x),
  4061. Ty(ScalingYMin)+TicksMinorIn)
  4062. endpath
  4063. startpath(TicksMinorThick,0,0,0,0)
  4064. move(
  4065. Tx(x),
  4066. Ty(ScalingYMax)+TicksMinorOut):
  4067. draw(
  4068. Tx(x),
  4069. Ty(ScalingYMax)-TicksMinorIn)
  4070. endpath
  4071. DrawXAxis% 
  4072. TicksMajorXAxis% 
  4073. TicksMinorXAxis% 
  4074. (TicksMinorUp+TicksMinorDown>0) 
  4075.  do an x axis tick
  4076. startpath(TicksMinorThick,0,0,0,0)
  4077. move(
  4078. Tx(x),
  4079. Ty(ScalingYAtXAxis)-TicksMinorDown):
  4080. draw(
  4081. Tx(x),
  4082. Ty(ScalingYAtXAxis)+TicksMinorUp)
  4083. endpath
  4084.  major tick
  4085. DrawFrame% 
  4086. TicksMajorXFrame% 
  4087. (TicksMajorIn+TicksMajorOut>0) 
  4088.  do a frame tick
  4089. startpath(TicksMajorThick,0,0,0,0)
  4090. move(
  4091. Tx(x),
  4092. Ty(ScalingYMin)-TicksMajorOut):
  4093. draw(
  4094. Tx(x),
  4095. Ty(ScalingYMin)+TicksMajorIn)
  4096. endpath
  4097. startpath(TicksMajorThick,0,0,0,0)
  4098. move(
  4099. Tx(x),
  4100. Ty(ScalingYMax)+TicksMajorOut):
  4101. draw(
  4102. Tx(x),
  4103. Ty(ScalingYMax)-TicksMajorIn)
  4104. endpath
  4105. DrawXAxis% 
  4106. TicksMajorXAxis% 
  4107. (TicksMajorUp+TicksMajorDown>0) 
  4108.  do an x axis tick
  4109. startpath(TicksMajorThick,0,0,0,0)
  4110. move(
  4111. Tx(x),
  4112. Ty(ScalingYAtXAxis)-TicksMajorDown):
  4113. draw(
  4114. Tx(x),
  4115. Ty(ScalingYAtXAxis)+TicksMajorUp)
  4116. endpath
  4117. ((i% 
  4118. minors%=0) 
  4119. LabelsXMinor%) 
  4120. ((DrawFrame% 
  4121. LabelsXFrame%) 
  4122. (DrawXAxis% 
  4123. LabelsXAxis%)) 
  4124.  do a label
  4125.  ex$="":ex = x
  4126.  suffix% 
  4127. (ex)>= 1.E12
  4128.    ex$="T":ex=ex*1.E-12
  4129. (ex)>= 1.E9
  4130.    ex$="G":ex=ex*1.E-9
  4131. (ex)>= 1.E6
  4132.    ex$="M":ex=ex*1.E-6
  4133. (ex)>=1.E3 
  4134.    ex$="k":ex=ex*1.E-3
  4135. )H @%=&A+(ScalingXDigits%<<8)+(ScalingXFormat%<<16)+(1<<24):i$=
  4136. ex+ex$
  4137. labellength(i$)
  4138. (DrawFrame% 
  4139. LabelsXFrame%) 
  4140. LabelsBelow% y=
  4141. Ty(ScalingYMin)-framedown-LabelsFontHeight*(1+LabelsXOffset) 
  4142. Ty(ScalingYMax)+frameup+LabelsFontHeight*LabelsXOffset
  4143. text(
  4144. Tx(x)-(x1+x2)/2,y,1,LabelsFontWidth,LabelsFontHeight,i$,0)
  4145. (DrawXAxis% 
  4146. LabelsXAxis%) 
  4147. LabelsBelow% y=
  4148. Ty(ScalingYAtXAxis)-axisdown-LabelsFontHeight*(1+LabelsXOffset) 
  4149. Ty(ScalingYAtXAxis)+axisup+LabelsFontHeight*LabelsXOffset
  4150. text(
  4151. Tx(x)-(x1+x2)/2,y,1,LabelsFontWidth,LabelsFontHeight,i$,0)
  4152. ScalingXLog% 
  4153. ScalingXLogType% 
  4154. mantissa%=5 mantissa%=1:exponent%+=1 
  4155. mantissa%=2 mantissa%=5 
  4156. mantissa%=2
  4157. mantissa%=3 mantissa%=1:exponent%+=1 
  4158. mantissa%=3
  4159. 2:exponent%+=1
  4160. 3:exponent%+=3
  4161. -1:mantissa%+=1:
  4162.  mantissa%=10 mantissa%=1:exponent%+=1
  4163.  x=mantissa%*10^exponent%
  4164.  i%=1:
  4165. mantissa%=1 i%=0
  4166.  ScalingXLogType%=-1 
  4167.  mantissa%=1 
  4168.  mantissa%=2 
  4169.  mantissa%=5 i%=0 
  4170.  i%=1
  4171. B9 i%+=1:x=ScalingXAnchor+(i%-a%)*ScalingXMajor/minors%
  4172.  now update ready for axis text offset
  4173. F(i=LabelsFontHeight*(1+LabelsXOffset)
  4174. DrawFrame% 
  4175. LabelsXFrame% 
  4176. LabelsBelow% framedown+=i 
  4177. frameup+=i
  4178. DrawXAxis% 
  4179. LabelsXAxis% 
  4180. LabelsBelow% axisdown+=i 
  4181. axisup+=i
  4182. xtext
  4183. x,y,x1,y1,x2,y2,n%,i$,j$,i%,j%
  4184. charcol%=FrameColour%
  4185. R-i$=AxistextXText$:n%=
  4186. Tcountbackslash(i$)
  4187. i%=0 
  4188. T3j%=
  4189. i$,"\"):j$=i$:
  4190. j% j$=
  4191. i$,j%-1):i$=
  4192. i$,j%+1)
  4193. textlength(j$):x=(
  4194. Tx(ScalingXMin)+
  4195. Tx(ScalingXMax)-x1-x2)/2
  4196. (DrawFrame% 
  4197. AxistextXFrame%) 
  4198. AxistextBelow% y=
  4199. Ty(ScalingYMin)-framedown-AxistextFontHeight*(1+AxistextXOffset+i%*AxistextXSpacing) 
  4200. Ty(ScalingYMax)+frameup+AxistextFontHeight*(AxistextXOffset+(n%-i%)*AxistextXSpacing)
  4201. text(x,y,1,AxistextFontWidth,AxistextFontHeight,j$,0)
  4202. (DrawXAxis% 
  4203. AxistextXFrame%) 
  4204. AxistextBelow% y=
  4205. Ty(ScalingYAtXAxis)-axisdown-AxistextFontHeight*(1+AxistextXOffset+i%*AxistextXSpacing) 
  4206. Ty(ScalingYAtXAxis)+axisup+AxistextFontHeight*(AxistextXOffset+(n%-i%)*AxistextXSpacing)
  4207. text(x,y,1,AxistextFontWidth,AxistextFontHeight,j$,0)
  4208. ymarks
  4209. minors%,exponent%,m,mantissa%,x,y,i%,a%,i$,x1,y1,x2,y2,i,longest,rot%,ex,ex$
  4210.  variables for label offset control
  4211. d=frameright=0:frameleft=0:axisright=0:axisleft=0:longest=0
  4212. DrawFrame% 
  4213. TicksMajorYFrame% 
  4214. f5 frameright=TicksMajorOut:frameleft=TicksMajorOut
  4215. TicksMinorYFrame% 
  4216. (TicksMinorOut>TicksMajorOut) frameright=TicksMinorOut:frameleft=TicksMinorOut
  4217. DrawYAxis% 
  4218. TicksMajorYAxis% 
  4219. j6 axisright=TicksMajorRight:axisleft=TicksMajorLeft
  4220. TicksMinorYAxis% 
  4221. (TicksMinorRight>TicksMajorRight) axisright=TicksMinorRight
  4222. TicksMinorYAxis% 
  4223. (TicksMinorLeft>TicksMajorLeft) axisleft=TicksMinorLeft
  4224. n6rot%=0:
  4225. LabelsYRotate% rot%=-1:
  4226. LabelsLeft% rot%=1
  4227.  now prepare for loop
  4228. ScalingYLog% 
  4229.  minors%=2
  4230. r? exponent%=
  4231. (ScalingYMin*0.999):m=ScalingYMin/10^exponent%
  4232. ScalingYLogType% 
  4233. 0,-1:
  4234. m>5 mantissa%=1:exponent%+=1 
  4235. m>2 mantissa%=5 
  4236. mantissa%=2
  4237. m>3 mantissa%=1:exponent%+=1 
  4238. mantissa%=3
  4239. 2:mantissa%=1:
  4240. m>1 exponent%+=1
  4241. 3:mantissa%=1:
  4242. m>1 exponent%+=1
  4243. exponent% 
  4244. 3 exponent%+=1:
  4245. exponent% 
  4246. 3 exponent%+=1
  4247.  y=mantissa%*10^exponent%
  4248.  i%=1:
  4249. mantissa%=1 i%=0
  4250.  ScalingYLogType%=-1 
  4251.  mantissa%=1 
  4252.  mantissa%=2 
  4253.  mantissa%=5 i%=0 
  4254.  i%=1
  4255. 1 minors%=
  4256. (ScalingYMajor/ScalingYMinor+0.001)
  4257. d a%=0:
  4258. ScalingYAnchor>ScalingYMin a%=minors%*
  4259. ((ScalingYAnchor-ScalingYMin)/ScalingYMajor+1.001)
  4260.  i%=-1
  4261. :i%+=1:y=ScalingYAnchor+(i%-a%)*ScalingYMajor/minors%:
  4262. y>=ScalingYMin
  4263. linecol%=FrameColour%
  4264. charcol%=FrameColour%
  4265. y<=ScalingYMax
  4266.  grids
  4267. ((i% 
  4268. minors%=0) 
  4269. GridsMinorY%) 
  4270. GridsMajorY% 
  4271. (GridsDash>0) 
  4272. GridsGap>0 
  4273. startpath(GridsThick,128,GridsDash,GridsGap,0) 
  4274. startpath(GridsThick,0,0,0,0)
  4275. move(
  4276. Tx(ScalingXMin),
  4277. Ty(y)):
  4278. draw(
  4279. Tx(ScalingXMax),
  4280. Ty(y))
  4281. endpath
  4282.  ticks
  4283. minors% 
  4284.  minor tick
  4285. DrawFrame% 
  4286. TicksMajorYFrame% 
  4287. TicksMinorYFrame% 
  4288. (TicksMinorIn+TicksMinorOut>0) 
  4289.  do a frame tick
  4290. startpath(TicksMinorThick,0,0,0,0)
  4291. move(
  4292. Tx(ScalingXMin)-TicksMinorOut,
  4293. Ty(y)):
  4294. draw(
  4295. Tx(ScalingXMin)+TicksMinorIn,
  4296. Ty(y))
  4297. endpath
  4298. startpath(TicksMinorThick,0,0,0,0)
  4299. move(
  4300. Tx(ScalingXMax)+TicksMinorOut,
  4301. Ty(y)):
  4302. draw(
  4303. Tx(ScalingXMax)-TicksMinorIn,
  4304. Ty(y))
  4305. endpath
  4306. DrawYAxis% 
  4307. TicksMajorYAxis% 
  4308. TicksMinorYAxis% 
  4309. (TicksMinorLeft+TicksMinorRight>0) 
  4310.  do a y axis tick
  4311. startpath(TicksMinorThick,0,0,0,0)
  4312. move(
  4313. Tx(ScalingXAtYAxis)-TicksMinorLeft,
  4314. Ty(y)):
  4315. draw(
  4316. Tx(ScalingXAtYAxis)+TicksMinorRight,
  4317. Ty(y))
  4318. endpath
  4319.  major tick
  4320. DrawFrame% 
  4321. TicksMajorYFrame% 
  4322. (TicksMajorIn+TicksMajorOut>0) 
  4323.  do a frame tick
  4324. startpath(TicksMajorThick,0,0,0,0)
  4325. move(
  4326. Tx(ScalingXMin)-TicksMajorOut,
  4327. Ty(y)):
  4328. draw(
  4329. Tx(ScalingXMin)+TicksMajorIn,
  4330. Ty(y))
  4331. endpath
  4332. startpath(TicksMajorThick,0,0,0,0)
  4333. move(
  4334. Tx(ScalingXMax)+TicksMajorOut,
  4335. Ty(y)):
  4336. draw(
  4337. Tx(ScalingXMax)-TicksMajorIn,
  4338. Ty(y))
  4339. endpath
  4340. DrawYAxis% 
  4341. TicksMajorYAxis% 
  4342. (TicksMajorLeft+TicksMajorRight>0) 
  4343.  do a y axis tick
  4344. startpath(TicksMajorThick,0,0,0,0)
  4345. move(
  4346. Tx(ScalingXAtYAxis)-TicksMajorLeft,
  4347. Ty(y)):
  4348. draw(
  4349. Tx(ScalingXAtYAxis)+TicksMajorRight,
  4350. Ty(y))
  4351. endpath
  4352. ((i% 
  4353. minors%=0) 
  4354. LabelsYMinor%) 
  4355. ((DrawFrame% 
  4356. LabelsYFrame%) 
  4357. (DrawYAxis% 
  4358. LabelsYAxis%)) 
  4359.  do a label
  4360.  ex$="":ex = y
  4361.  suffix% 
  4362. (ex)>= 1.E9
  4363.    ex$="G":ex=ex*1.E-9
  4364. (ex)>= 1.E6
  4365.    ex$="M":ex=ex*1.E-6
  4366. (ex)>=1.E3 
  4367.    ex$="k":ex=ex*1.E-3
  4368. H @%=&A+(ScalingYDigits%<<8)+(ScalingYFormat%<<16)+(1<<24):i$=
  4369. ex+ex$
  4370. labellength(i$):
  4371. rotateboundingbox(rot%):
  4372. x2-x1>longest longest=x2-x1
  4373. (DrawFrame% 
  4374. LabelsYFrame%) 
  4375. LabelsLeft% x=
  4376. Tx(ScalingXMin)-frameleft-LabelsFontWidth*LabelsYOffset-x2 
  4377. Tx(ScalingXMax)+frameright+LabelsFontWidth*LabelsYOffset-x1
  4378. text(x,
  4379. Ty(y)-(y1+y2)/2,1,LabelsFontWidth,LabelsFontHeight,i$,rot%)
  4380. (DrawYAxis% 
  4381. LabelsYAxis%) 
  4382. LabelsLeft% x=
  4383. Tx(ScalingXAtYAxis)-axisleft-LabelsFontWidth*LabelsYOffset-x2 
  4384. Tx(ScalingXAtYAxis)+axisright+LabelsFontWidth*LabelsYOffset-x1
  4385. text(x,
  4386. Ty(y)-(y1+y2)/2,1,LabelsFontWidth,LabelsFontHeight,i$,rot%)
  4387. ScalingYLog% 
  4388. ScalingYLogType% 
  4389. mantissa%=5 mantissa%=1:exponent%+=1 
  4390. mantissa%=2 mantissa%=5 
  4391. mantissa%=2
  4392. mantissa%=3 mantissa%=1:exponent%+=1 
  4393. mantissa%=3
  4394. 2:exponent%+=1
  4395. 3:exponent%+=3
  4396. -1:mantissa%+=1:
  4397.  mantissa%=10 mantissa%=1:exponent%+=1
  4398.  y=mantissa%*10^exponent%
  4399.  i%=1:
  4400. mantissa%=1 i%=0
  4401.  ScalingYLogType%=-1 
  4402.  mantissa%=1 
  4403.  mantissa%=2 
  4404.  mantissa%=5 i%=0 
  4405.  i%=1
  4406. 9 i%+=1:y=ScalingYAnchor+(i%-a%)*ScalingYMajor/minors%
  4407.  now update ready for axis text offset
  4408. +i=LabelsFontWidth*LabelsYOffset+longest
  4409. rot% i=LabelsFontHeight*(1+LabelsYOffset)
  4410. DrawFrame% 
  4411. LabelsYFrame% 
  4412. LabelsLeft% frameleft+=i 
  4413. frameright+=i
  4414. DrawYAxis% 
  4415. LabelsYAxis% 
  4416. LabelsLeft% axisleft+=i 
  4417. axisright+=i
  4418. ytext
  4419. x,y,x1,y1,x2,y2,n%,i$,j$,i%,j%,longest,rot%,meany,x0
  4420. charcol%=FrameColour%
  4421. 9rot%=0:
  4422. AxistextRotate% rot%=-1:
  4423. AxistextLeft% rot%=1
  4424. -i$=AxistextYText$:n%=
  4425. Tcountbackslash(i$)
  4426.  find the longest font-substring
  4427. longest=0:i%=
  4428. i$,"\"):j$=i$
  4429. textlength(
  4430. j$,i%-1)):
  4431. x2-x1>longest longest=x2-x1
  4432. j$,i%+1):i%=
  4433. j$,"\")
  4434. textlength(
  4435. j$,i%-1)):
  4436. x2-x1>longest longest=x2-x1
  4437.  now get on with it
  4438. /meany=(
  4439. Ty(ScalingYMin)+
  4440. Ty(ScalingYMax))/2
  4441. i%=0 
  4442. i$,"\"):j$=i$:
  4443. j% j$=
  4444. i$,j%-1):i$=
  4445. i$,j%+1)
  4446. textlength(j$):
  4447. rotateboundingbox(rot%)
  4448. rot% 
  4449. 3 x0=longest/2+AxistextYOffset*AxistextFontWidth
  4450. AxistextLeft% x0=-x0-(x1+x2)/2 
  4451. x0=x0-(x1+x2)/2
  4452. O y=meany-AxistextFontHeight/2+AxistextFontHeight*AxistextYSpacing*(n%/2-i%)
  4453. F x0=-AxistextFontHeight*(AxistextYOffset+AxistextYSpacing*(n%-i%))
  4454.  y=meany-(y1+y2)/2
  4455. E x0=AxistextFontHeight*(AxistextYOffset+AxistextYSpacing*(n%-i%))
  4456.  y=meany-(y1+y2)/2
  4457. (DrawFrame% 
  4458. AxistextYFrame%) 
  4459. AxistextLeft% x=
  4460. Tx(ScalingXMin)-frameleft+x0 
  4461. Tx(ScalingXMax)+frameright+x0
  4462. text(x,y,1,AxistextFontWidth,AxistextFontHeight,j$,rot%)
  4463. (DrawYAxis% 
  4464. AxistextYFrame%) 
  4465. AxistextLeft% x=
  4466. Tx(ScalingXAtYAxis)-axisleft+x0 
  4467. Tx(ScalingXAtYAxis)+axisright+x0
  4468. text(x,y,1,AxistextFontWidth,AxistextFontHeight,j$,rot%)
  4469. labellength(i$)
  4470.  returns bounding box in points in x1,y1,x2,y2
  4471. fonthandle%
  4472. "Font_FindFont",,FontsLabels$,16*LabelsFontWidth,16*LabelsFontHeight 
  4473.  fonthandle%
  4474. "Font_StringBBox",,i$ 
  4475. ,x1,y1,x2,y2
  4476. "Font_LoseFont",fonthandle%
  4477. /x1=x1/1000:y1=y1/1000:x2=x2/1000:y2=y2/1000
  4478. textlength(i$)
  4479.  returns bounding box in points in x1,y1,x2,y2
  4480. fonthandle%
  4481. "Font_FindFont",,FontsLabels$,16*AxistextFontWidth,16*AxistextFontHeight 
  4482.  fonthandle%
  4483. "Font_StringBBox",,i$ 
  4484. ,x1,y1,x2,y2
  4485. "Font_LoseFont",fonthandle%
  4486. /x1=x1/1000:y1=y1/1000:x2=x2/1000:y2=y2/1000
  4487. pointlength(y%)
  4488.  returns bounding box in points in x1,y1,x2,y2
  4489. fonthandle%
  4490. "Font_FindFont",,FontsPoints$,16*ColumnWidth(y%),16*ColumnHeight(y%) 
  4491. fonthandle%
  4492. "Font_CharBBox",fonthandle%,ColumnChar%(y%),0 
  4493. ,x1,y1,x2,y2
  4494. "Font_LoseFont",fonthandle%
  4495. &/x1=x1/1000:y1=y1/1000:x2=x2/1000:y2=y2/1000
  4496. rotateboundingbox(rot%)
  4497. rot% 
  4498.  rotate anticlockwise
  4499. -" i=x1:x1=-y2:y2=x2:x2=-y1:y1=i
  4500.  rotate clockwise
  4501. /" i=x1:x1=y1:y1=-x2:x2=y2:y2=-i
  4502. Tcountbackslash(i$)
  4503. i%,n%
  4504. n%=0:i%=
  4505. i$,"\")
  4506. (i%>0) 
  4507. (i$<>"")
  4508. 7"n%+=1:i$=
  4509. i$,i%+1):i%=
  4510. i$,"\")
  4511. graphkey
  4512. x,y,i%,width,style%,on,off,s,h,w,i$,fonthandle%,x1%,y1%,x2%,y2%,yo,wo
  4513. =Mx=GraphKeyLeft*pointsininch%:y=GraphKeyTop*pointsininch%-LabelsFontHeight
  4514. s=LabelsFontHeight
  4515. i%=0 
  4516. ColumnMeaning$(i%),1)="Y") 
  4517. ColumnPlot%(i%) 
  4518. ColumnHeight(i%)>s s=ColumnHeight(i%)
  4519. :s=1.2*s
  4520.  work out rectangle sizing first
  4521. i%=0 
  4522. ColumnMeaning$(i%),1)="Y") 
  4523. ColumnPlot%(i%) 
  4524. drawn%(i%) 
  4525. G+ i$=ColumnKeyText$(i%):
  4526. labellength(i$)
  4527.  wo < x2-x1 wo = x2-x1
  4528. L-charcol%=KeyOutline%:linecol%=KeyOutline%
  4529.  wo > 0 
  4530.  add in rectangle
  4531. wo+=72+LabelsFontWidth
  4532. startpathfill(linecol%,FrameThick,KeyBack%)
  4533. move(x-18,yo+s):
  4534. draw(x-18+wo,yo+s):
  4535. draw(x-18+wo,y+s/2):
  4536. draw(x-18,y+s/2)
  4537. closesubpath
  4538. endpath
  4539. i%=0 
  4540. ColumnMeaning$(i%),1)="Y") 
  4541. ColumnPlot%(i%) 
  4542. drawn%(i%) 
  4543. ColumnPoints%(i%) 
  4544. Y>  h=ColumnHeight(i%):w=ColumnWidth(i%):i$=
  4545. ColumnChar%(i%)
  4546. pointlength(i%)
  4547. [!  charcol%=ColumnCharcol%(i%)
  4548. text(x+18-(x1+x2)/2,y+s/3-(y1+y2)/2,2,w,h,i$,0)
  4549.   charcol%=black%
  4550. ColumnLine%(i%) 
  4551. `!  linecol%=ColumnLinecol%(i%)
  4552. an  width=ColumnThick(i%):style%=0:on=ColumnDash(i%):off=ColumnGap(i%):on2=ColumnDash2(i%):
  4553. off>0 style%=128
  4554. on>0 linecol%=ColumnLinecol%(i%):
  4555. startpath(width,style%,on,off,on2):
  4556. move(x,y+s/3):
  4557. draw(x+36,y+s/3):
  4558. endpath:linecol%=black%
  4559. d+ i$=ColumnKeyText$(i%):
  4560. labellength(i$)
  4561. text(x+36+LabelsFontWidth,y+s/2-LabelsFontHeight/2,1,LabelsFontWidth,LabelsFontHeight,i$,0)
  4562. startpathfill(colour%,width,fill%)
  4563. word(2)
  4564. memory% pathheader%=ptr% 
  4565. pathheader%=
  4566. word(0):
  4567. coord(0,0):
  4568. coord(1,1)
  4569. word(fill%):
  4570.  fill colour given by fill%
  4571. word(colour%)
  4572. word(width*point%):
  4573. word(0)
  4574. local%=
  4575. text(x,y,font%,w,h,i$,rot%)
  4576.  assumes bounding box given by x1,y1,x2,y2;text colour is charcol%
  4577. j%,w%,k%
  4578. rot% 
  4579. word(12)
  4580. word(13*4+4+4*(
  4581. 4)+28)
  4582. bound(x+x1,y+y1,x+x2,y+y2)
  4583. word(0):
  4584. word(rot%*&10000)
  4585. word(-rot%*&10000):
  4586. word(0)
  4587. word(0):
  4588. word(0)
  4589. word(0)
  4590. word(1)
  4591. word(13*4+4+4*(
  4592. bound(x+x1,y+y1,x+x2,y+y2)
  4593. word(charcol%):
  4594.  coloured text
  4595. word(white%):
  4596.  white background
  4597. word(font%)
  4598. coord(w*point,h*point):
  4599. coord(x*point,y*point)
  4600. j%=0 
  4601. k%=0 
  4602. j%+k%<
  4603. i$ w%+=((
  4604. i$,1+j%+k%,1))<<(8*k%))
  4605. word(w%)
  4606. xaxis
  4607. linecol%=FrameColour%
  4608. startpath(AxisThick,0,0,0,0)
  4609. move(
  4610. Tx(ScalingXMin),
  4611. Ty(ScalingYAtXAxis))
  4612. draw(
  4613. Tx(ScalingXMax),
  4614. Ty(ScalingYAtXAxis))
  4615. endpath
  4616. yaxis
  4617. linecol%=FrameColour%
  4618. startpath(AxisThick,0,0,0,0)
  4619. move(
  4620. Tx(ScalingXAtYAxis),
  4621. Ty(ScalingYMin))
  4622. draw(
  4623. Tx(ScalingXAtYAxis),
  4624. Ty(ScalingYMax))
  4625. endpath
  4626. frame
  4627. linecol%=FrameColour%
  4628. startpath(FrameThick,0,0,0,0)
  4629. move(
  4630. Tx(ScalingXMin),
  4631. Ty(ScalingYMin))
  4632. draw(
  4633. Tx(ScalingXMax),
  4634. Ty(ScalingYMin))
  4635. draw(
  4636. Tx(ScalingXMax),
  4637. Ty(ScalingYMax))
  4638. draw(
  4639. Tx(ScalingXMin),
  4640. Ty(ScalingYMax))
  4641. closesubpath
  4642. endpath
  4643. fillback
  4644. startpathfill(-1,0,FrameFillColour%)
  4645. move(
  4646. Tx(ScalingXMin),
  4647. Ty(ScalingYMin))
  4648. draw(
  4649. Tx(ScalingXMax),
  4650. Ty(ScalingYMin))
  4651. draw(
  4652. Tx(ScalingXMax),
  4653. Ty(ScalingYMax))
  4654. draw(
  4655. Tx(ScalingXMin),
  4656. Ty(ScalingYMax))
  4657. closesubpath
  4658. endpath
  4659. border
  4660. linecol%=black%
  4661. startpath(0,0,0,0,0)
  4662. move(GraphBorderLeft*pointsininch%,GraphBorderBottom*pointsininch%)
  4663. draw((GraphBorderLeft+GraphBorderWidth)*pointsininch%,GraphBorderBottom*pointsininch%)
  4664. draw((GraphBorderLeft+GraphBorderWidth)*pointsininch%,(GraphBorderBottom+GraphBorderHeight)*pointsininch%)
  4665. draw(GraphBorderLeft*pointsininch%,(GraphBorderBottom+GraphBorderHeight)*pointsininch%)
  4666. closesubpath
  4667. endpath
  4668. Tx(x):
  4669.  in points
  4670. offset
  4671. ScalingXLog% 
  4672. 9 offset=(
  4673. ScalingXMin)/(
  4674. ScalingXMax-
  4675. ScalingXMin)
  4676. 5 offset=(x-ScalingXMin)/(ScalingXMax-ScalingXMin)
  4677.  offset is between 0 and 1 if within the frame
  4678. <=GraphLeft*pointsininch%+GraphWidth*pointsininch%*offset
  4679. Ty(y):
  4680.  in points
  4681. offset
  4682. ScalingYLog% 
  4683. 9 offset=(
  4684. ScalingYMin)/(
  4685. ScalingYMax-
  4686. ScalingYMin)
  4687. 5 offset=(y-ScalingYMin)/(ScalingYMax-ScalingYMin)
  4688.  offset is between 0 and 1 if within the frame
  4689. ?=GraphBottom*pointsininch%+GraphHeight*pointsininch%*offset
  4690. startpath(width,style%,on,off,on2)
  4691. word(2)
  4692. memory% pathheader%=ptr% 
  4693. pathheader%=
  4694. word(0):
  4695. coord(0,0):
  4696. coord(1,1)
  4697. word(-1):
  4698.  fill colour = no fill
  4699. word(linecol%):
  4700.  line colour = linecol%
  4701. word(width*point):
  4702. word(style%)
  4703. (style% 
  4704. 128) 
  4705.  on2>0 
  4706. word(0):
  4707. word(4)
  4708. word(on*point):
  4709. word(off*point)
  4710. word(on2*point):
  4711. word(off*point)
  4712. word(0):
  4713. word(2)
  4714. word(on*point):
  4715. word(off*point)
  4716. local%=
  4717. Treadpalette(fill%)
  4718. "Wimp_ReadPalette",,block%
  4719. $r%=(block%!(4*fill%)) 
  4720. &F0F0F000
  4721.  (r%>>>4)
  4722. move(x,y)
  4723. word(2)
  4724. coord(x*point,y*point)
  4725. updatelocal(x,y)
  4726. draw(x,y)
  4727. word(8)
  4728. coord(x*point,y*point)
  4729. updatelocal(x,y)
  4730. closesubpath
  4731. word(5)
  4732. endpath
  4733. word(0)
  4734. memory% end%=ptr%:ptr%=pathheader% 
  4735. end%=
  4736. #c%=pathheader%
  4737. word(end%-pathheader%+4)
  4738. local% 
  4739. coord((localxmin-1)*point,(localymin-1)*point)
  4740. coord((localxmax+1)*point,(localymax+1)*point)
  4741. updateglobal(localxmin,localymin,localxmax,localymax)
  4742. memory% 
  4743.  ptr%=end% 
  4744. #c%=end%
  4745. updatelocal(x,y)
  4746.  in points
  4747. local% 
  4748. x<localxmin localxmin=x
  4749. y<localymin localymin=y
  4750. x>localxmax localxmax=x
  4751. y>localymax localymax=y
  4752.  localxmin=x:localxmax=x
  4753.  localymin=y:localymax=y
  4754.  local%=
  4755. updateglobal(xmin,ymin,xmax,ymax)
  4756.  in points
  4757. global% 
  4758. xmin<globalxmin globalxmin=xmin
  4759. ymin<globalymin globalymin=ymin
  4760. xmax>globalxmax globalxmax=xmax
  4761. ymax>globalymax globalymax=ymax
  4762. "$ globalxmin=xmin:globalxmax=xmax
  4763. #$ globalymin=ymin:globalymax=ymax
  4764.  global%=
  4765. startdrawfile
  4766. word(&77617244):
  4767. word(201):
  4768. word(0)
  4769. twelve("Tau")
  4770. memory% fileheader%=ptr% 
  4771. fileheader%=
  4772. coord(0,0)
  4773. coord(1,1)
  4774. global%=
  4775. fonttable
  4776. fontdata$,length%,i%,b%,j%
  4777. 33fontdata$=
  4778. 1+FontsLabels$+
  4779. 2+FontsPoints$+
  4780. 4*fontdata$+=
  4781. fontdata$ 
  4782. length%=
  4783. fontdata$
  4784. word(0):
  4785. word(8+length%)
  4786. i%=0 
  4787. length%-4 
  4788. 86b%=0:
  4789. j%=0 
  4790. 3:b%+=
  4791. fontdata$,1+i%+j%,1)<<(8*j%):
  4792. word(b%)
  4793. enddrawfile
  4794. global% 
  4795. memory% end%=ptr%:ptr%=fileheader% 
  4796. end%=
  4797. #c%=fileheader%
  4798. coord((globalxmin-1)*point,(globalymin-1)*point)
  4799. coord((globalxmax+1)*point,(globalymax+1)*point)
  4800. memory% ptr%=end% 
  4801. #c%=end%
  4802. startgroup(grouplevel%)
  4803. word(6)
  4804. memory% groupheader%(grouplevel%)=ptr% 
  4805. groupheader%(grouplevel%)=
  4806. word(0):
  4807. coord(0,0):
  4808. coord(1,1)
  4809. twelve("")
  4810. endgroup(grouplevel%)
  4811. memory% end%=ptr%:ptr%=groupheader%(grouplevel%) 
  4812. end%=
  4813. #c%=groupheader%(grouplevel%)
  4814. word(end%-groupheader%(grouplevel%)+4)
  4815. memory% ptr%=end% 
  4816. #c%=end%
  4817. boundgroups
  4818. memory% end%=ptr% 
  4819. end%=
  4820. boundgroup(1)
  4821. GraphBorder% 
  4822. GraphKey% 
  4823. boundgroup(2)
  4824. GraphKey% 
  4825. boundgroup(3)
  4826. memory% ptr%=end% 
  4827. #c%=end%
  4828. boundgroup(grouplevel%)
  4829. memory% ptr%=groupheader%(grouplevel%)+4 
  4830. #c%=groupheader%(grouplevel%)+4
  4831. coord((globalxmin-1)*point,(globalymin-1)*point)
  4832. coord((globalxmax+1)*point,(globalymax+1)*point)
  4833. word(i%)
  4834. memory% 
  4835. overflow% 
  4836.  Himem%!ptr%=i%
  4837. d5 ptr%+=4:
  4838. ptr%>buffer%-16 overflow%=
  4839. Tcheckmemory
  4840. #c%,i% 
  4841. #c%,(i%>>>8) 
  4842. #c%,(i%>>>16) 
  4843. #c%,(i%>>>24) 
  4844. twelve(i$)
  4845. i$+"            ",12)
  4846. memory% 
  4847. overflow% 
  4848.  $(Himem%+ptr%)=i$
  4849. s6 ptr%+=12:
  4850. ptr%>buffer%-16 overflow%=
  4851. Tcheckmemory
  4852. i%=1 
  4853. i$,i%,1)
  4854. Tcheckmemory
  4855. buffer%+=32*1024
  4856. "Wimp_SlotSize",MinSlotSize%+buffer%,-1 
  4857.  newsize%
  4858. newsize%<>MinSlotSize%+buffer% =
  4859. coord(x%,y%)
  4860. word(x%):
  4861. word(y%)
  4862. bound(x1,y1,x2,y2)
  4863.  never use this PROC with dummy values !!!
  4864. coord(x1*point,y1*point)
  4865. coord(x2*point,y2*point)
  4866. updateglobal(x1,y1,x2,y2)
  4867. setthestyle(i%)
  4868. handle%=columnhandle%
  4869. setwritablestring(47,style$(i%))
  4870. Qg%(8)=
  4871. :g%(9)=
  4872. :g%(45)=
  4873. setwritablestring(45,"0"):
  4874. setwritablestring(9,"0")
  4875. 7g%(8)=
  4876. :g%(9)=
  4877. :g%(45)=
  4878. setwritablestring(45,"0")
  4879. Tgetwritable(9):
  4880.  x%=0 
  4881. setwritablestring(9,"6")
  4882. g%(8)=
  4883. :g%(9)=
  4884. :g%(45)=
  4885. Tgetwritable(9):
  4886.  x%=0 
  4887. setwritablestring(9,"6")
  4888. Tgetwritable(45):
  4889.  x%=0 
  4890. setwritablestring(45,"2")
  4891. setgrey(8,g%(8))
  4892. setgrey(9,g%(9))
  4893. setgrey(45,g%(45))
  4894. setgrey(icon%,state%)
  4895.  if state% TRUE, ungreyed, else greyed; always unselected
  4896. +!block1%=handle%:block1%!12=sel% 
  4897. grey%
  4898. block1%!4=icon%
  4899.  state% block1%!8=0 
  4900.  block1%!8=grey%
  4901. "Wimp_SetIconState",,block1%
  4902. pkiedit
  4903.  r%,c%,a$,b$,a,b,s%,ch%
  4904. handle%=edithandle%
  4905.     ch%=
  4906. Tgetwritablestring(3)
  4907. Tgetwritablestring(5)
  4908. closewindow(edithandle%)
  4909.  a$="" 
  4910. report("No value to change!"):
  4911. "Wimp_CreateMenu",,-1:
  4912. b$)=" " b$=
  4913. (b$)-1):
  4914.  ".","":
  4915. b=0:s%=0
  4916.  "m","M":
  4917. b=0:s%=2
  4918. (b$):s%=1
  4919.  r%=0 
  4920.  maxrow%
  4921.  c%=0 
  4922.  maxcolumn%
  4923. Tdata(c%,r%)=a 
  4924.  ch%=
  4925. data(c%,r%,b)
  4926.  DataStatus%?(c%+C1%*r%)=s%
  4927.  ch% 
  4928. ScalingAuto% 
  4929. autoscale
  4930. update(mainhandle%)
  4931. "Wimp_CreateMenu",,-1
  4932. opencolour(t$,colour%,icon%,type%)
  4933. !colourpick%=0
  4934. colourpick%!4=colourtitle%
  4935. $colourtitle%=t$
  4936. colourpick%!8=x%
  4937. 5colourpick%!12=&80000000:colourpick%!16=&7FFFFFFF
  4938. colourpick%!20=y%
  4939. %colourpick%!24=0:colourpick%!28=0
  4940. colourpick%!32=colour%
  4941. colourpick%!36=0
  4942.  "ColourPicker_OpenDialogue",type%,colourpick% 
  4943.  dialogue%,colourhandle%
  4944. setupsprites
  4945.  spritearea% 700
  4946. !spritearea%=700
  4947. spritearea%!4=0
  4948. spritearea%!8=16
  4949. spritearea%!12=0
  4950.  &2E,256+9,spritearea%
  4951.  &2E,256+10,spritearea%,"<Tau$Dir>.Sprites"
  4952.  &2E,256+37,spritearea%,"fill",-1 
  4953.  ,,,,filladdress%
  4954.  &2E,256+37,spritearea%,"line",-1 
  4955.  ,,,,lineaddress%
  4956.  &2E,256+37,spritearea%,"char",-1 
  4957.  ,,,,charaddress%
  4958. setcolour(handle%,ih%,col%,sprname$)
  4959.  address%
  4960.  sprname$ 
  4961.  "fill":address%=filladdress%
  4962.  "line":address%=lineaddress%
  4963.  "char":address%=charaddress%
  4964. !address%=col%
  4965. <block1%!0=handle%:block1%!4=ih%:block1%!8=0:block1%!12=0
  4966.  "Wimp_SetIconState",,block1%
  4967. setgrey(ih%,
  4968. setgreycolour(handle%,ih%,sprname$)
  4969. setcolour(handle%,ih%,mgrey%,sprname$)
  4970. setgrey(ih%,
  4971.