home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / hypercar / science / heatofva.sit / ∆H(vapor) / background_3756.txt < prev    next >
Encoding:
Text File  |  1988-11-17  |  6.1 KB  |  250 lines

  1. -- background: 3756 from stack: in
  2. -- bmap block id: 4019
  3. -- flags: 0000
  4. -- background id: 0
  5. -- name: 
  6. ----- HyperTalk script -----
  7. on drawAxes
  8.   global top, left, bottom, right, xMin, xMax, yMin, yMax, xScale, yScale
  9.  
  10.   put (right - left)/(xMax - xMin) into xScale
  11.   put (top - bottom)/(yMax - yMin) into yScale
  12.  
  13.   put round( left + (0 - xMin) * xScale ) into scrnX0
  14.   if scrnX0 > right then
  15.     put right into scrnX0
  16.   else
  17.     if scrnX0 < left then
  18.       put left into scrnX0
  19.     end if
  20.   end if
  21.  
  22.  
  23.   put round( bottom + (0 - yMin) * yScale ) into scrnY0
  24.   if scrnY0 < top then
  25.     put top into scrnY0
  26.   else
  27.     if scrnY0 > bottom then
  28.       put bottom into scrnY0
  29.     end if
  30.   end if
  31.  
  32.   set loc of card field "yMin" to scrnX0,bottom
  33.   set loc of card field "yMax" to scrnX0,top
  34.   set loc of card field "xMin" to left,scrnY0
  35.   set loc of card field "xMax" to right,scrnY0
  36.  
  37.   if loc of card field "yMax" = loc of card field "xMin" then
  38.     get loc of card field "yMax"
  39.     put second item of it - 15 into second item of it
  40.     set loc of card field "yMax" to first item of it, second item of it
  41.   end if
  42.   if loc of card field "yMin" = loc of card field "xMin" then
  43.     get loc of card field "yMin"
  44.     put second item of it + 15 into second item of it
  45.     set loc of card field "yMin" to first item of it, second item of it
  46.   end if
  47.   if loc of card field "yMax" = loc of card field "xMax" then
  48.     get loc of card field "yMax"
  49.     put second item of it - 15 into second item of it
  50.     set loc of card field "yMax" to first item of it, second item of it
  51.   end if
  52.   if loc of card field "yMin" = loc of card field "xMax" then
  53.     get loc of card field "yMin"
  54.     put second item of it + 15 into second item of it
  55.     set loc of card field "yMin" to first item of it, second item of it
  56.   end if
  57.  
  58.   choose line tool
  59.   set dragspeed to 30000
  60.   drag from left,scrnY0 to right,scrnY0
  61.   drag from scrnX0,top to scrnX0,bottom
  62. end drawAxes
  63.  
  64. on doErase
  65.   choose eraser tool
  66.   domenu select all
  67.   domenu clear picture
  68.   drawAxes
  69.   choose browse tool
  70. end doErase
  71.  
  72.  
  73.  
  74.  
  75.  
  76. -- part 23 (button)
  77. -- low flags: 00
  78. -- high flags: A002
  79. -- rect: left=3 top=26 right=75 bottom=45
  80. -- title width / last selected line: 0
  81. -- icon id / first selected line: 20960 / 20960
  82. -- text alignment: 1
  83. -- font id: 0
  84. -- text size: 12
  85. -- style flags: 0
  86. -- line height: 16
  87. -- part name: Plot
  88. ----- HyperTalk script -----
  89. on mouseUp
  90.   global top, left, bottom, right, xMin, xMax, yMin, yMax, yScale, xScale
  91.   global slope, intcpt
  92.  
  93.   put (right - left)/(xMax - xMin) into xScale
  94.   put (top - bottom)/(yMax - yMin) into yScale
  95.  
  96.   hide field "lnP"
  97.   hide field "recipT"
  98.   set the lockScreen to true
  99.   go to card "Tables"
  100.   if field "lnP" is not empty and field "recipT" is not empty then
  101.     put field "lnP" into field "lnP" of card "Graph"
  102.     put field "recipT" into field "recipT" of card "Graph"
  103.     go to card "Graph"
  104.     set the lockScreen to false
  105.     choose line tool
  106.     repeat with i = 1 to number of lines in field "lnP"
  107.       if line i of field "lnP" is not empty and line i of field "recipT" is not empty then
  108.         put line i of field "lnP" into y
  109.         put line i of field "recipT" into x
  110.         put round(left + (x - xMin)*xScale) into scrnX
  111.         put round(bottom + (y - yMin)*yScale) into scrnY
  112.         drag from scrnX-2,scrnY to scrnX+2,scrnY
  113.         drag from scrnX,scrnY-2 to scrnX,scrnY+2
  114.       end if
  115.     end repeat
  116.     choose browse tool
  117.   end if
  118.  
  119.   if slope >= 0 then          -- cannot be for Clausius-Clapeyron
  120.     exit mouseup              -- so no straight line plot
  121.   end if
  122.   put round( bottom + (0 - yMin) * yScale ) into scrnY0
  123.   put max(top,min(scrnY0,bottom)) into scrnY0
  124.  
  125.   put (slope*xMin + intcpt) into y1
  126.   put round( left ) into scrnX1
  127.  
  128.   put round( bottom + (y1 - yMin) * yScale ) into scrnY1
  129.   put max(top,min(scrnY1,bottom)) into scrnY1
  130.  
  131.   choose line tool
  132.  
  133.   put (slope*xMax + intcpt) into y2
  134.   put round(left + (xMax - xMin)*xScale ) into scrnX2
  135.  
  136.   put round(bottom + (y2 - yMin)*yScale ) into scrnY2
  137.   put max(top,min(scrnY2,bottom)) into scrnY2
  138.   if abs(scrnY1 - scrnY2) <> abs(top - bottom) then
  139.     drag from scrnX1,scrnY1 to scrnX2,scrnY2
  140.   end if
  141.  
  142.   choose browse tool
  143. end mouseUp
  144.  
  145.  
  146.  
  147. -- part 25 (button)
  148. -- low flags: 00
  149. -- high flags: A002
  150. -- rect: left=4 top=78 right=127 bottom=45
  151. -- title width / last selected line: 0
  152. -- icon id / first selected line: 32434 / 32434
  153. -- text alignment: 1
  154. -- font id: 0
  155. -- text size: 12
  156. -- style flags: 0
  157. -- line height: 16
  158. -- part name: Clear
  159. ----- HyperTalk script -----
  160. on mouseUp
  161.   doErase
  162. end mouseUp
  163.  
  164.  
  165.  
  166. -- part 43 (button)
  167. -- low flags: 00
  168. -- high flags: 2001
  169. -- rect: left=2 top=294 right=332 bottom=39
  170. -- title width / last selected line: 0
  171. -- icon id / first selected line: 1011 / 1011
  172. -- text alignment: 1
  173. -- font id: 0
  174. -- text size: 12
  175. -- style flags: 0
  176. -- line height: 16
  177. -- part name: Home
  178. ----- HyperTalk script -----
  179. on mouseUp
  180.   go home
  181. end mouseUp
  182.  
  183.  
  184.  
  185. -- part 47 (button)
  186. -- low flags: 00
  187. -- high flags: 2001
  188. -- rect: left=3 top=251 right=289 bottom=40
  189. -- title width / last selected line: 0
  190. -- icon id / first selected line: 32462 / 32462
  191. -- text alignment: 1
  192. -- font id: 0
  193. -- text size: 12
  194. -- style flags: 0
  195. -- line height: 16
  196. -- part name: Help
  197. ----- HyperTalk script -----
  198. on mouseUp
  199.   go to card "moreInfo"
  200. end mouseUp
  201.  
  202.  
  203.  
  204. -- part 48 (button)
  205. -- low flags: 00
  206. -- high flags: A002
  207. -- rect: left=4 top=131 right=179 bottom=45
  208. -- title width / last selected line: 0
  209. -- icon id / first selected line: 16129 / 16129
  210. -- text alignment: 1
  211. -- font id: 0
  212. -- text size: 12
  213. -- style flags: 0
  214. -- line height: 16
  215. -- part name: Data
  216. ----- HyperTalk script -----
  217. on mouseUp
  218.   go to card Tables
  219.   show menubar
  220. end mouseUp
  221.  
  222.  
  223.  
  224. -- part 49 (field)
  225. -- low flags: 81
  226. -- high flags: 4000
  227. -- rect: left=159 top=98 right=308 bottom=225
  228. -- title width / last selected line: 0
  229. -- icon id / first selected line: 0 / 0
  230. -- text alignment: 0
  231. -- font id: 3
  232. -- text size: 10
  233. -- style flags: 0
  234. -- line height: 13
  235. -- part name: lnP
  236.  
  237.  
  238. -- part 50 (field)
  239. -- low flags: 81
  240. -- high flags: 4000
  241. -- rect: left=228 top=98 right=308 bottom=297
  242. -- title width / last selected line: 0
  243. -- icon id / first selected line: 0 / 0
  244. -- text alignment: 0
  245. -- font id: 3
  246. -- text size: 10
  247. -- style flags: 0
  248. -- line height: 13
  249. -- part name: recipT
  250.