TESTTRAK.LST 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992
  1. Listing:
  2. 1 (******************************************************************************)
  3. 2 (* TESTTRAK.MOD *)
  4. 3 (* *)
  5. 4 (* MetaWINDOW graphics test program *)
  6. 5 (* Transcribed from TESTTRAK.C METAGRAPHICS SOFTWARE CORPORATION (c) 1987-1989*)
  7. 6 (* *)
  8. 7 (* PSW 10/31/90 02:44am *)
  9. 8 (******************************************************************************)
  10. 9
  11. 10 MODULE Testtrak;
  12. 11 (*
  13. 12 * Graphix
  14. 13 * Release 3.7
  15. 14 * (c) Copyright 1986-1992 PMI
  16. 15 * Green Bay, Wisconsin
  17. 16 * (414) 468-6040
  18. 17 * All rights reserved
  19. 18 *
  20. 19 *)
  21. 20
  22. 21 IMPORT GrQry;
  23. 22 IMPORT GrConst;
  24. 23 IMPORT GrPorts;
  25. 24 IMPORT Meta;
  26. 25 IMPORT Str;
  27. 26 IMPORT Lib;
  28. 27 IMPORT IO;
  29. 28
  30. 29 FROM Storage IMPORT ALLOCATE, DEALLOCATE;
  31. 30
  32. 31 FROM GrConst IMPORT rect, point, event, cursor, dirRec, mapArray;
  33. ***** ^ duplicate identifier
  34. 32 FROM GrPorts IMPORT adsPort;
  35. ***** ^ duplicate identifier
  36. 33 FROM GrFonts IMPORT adsFont;
  37. 34
  38. 35
  39. 36 CONST
  40. 37 sec = 18;
  41. 38 COLOR = 11;
  42. 39
  43. 40 VAR
  44. 41 GrafixCard,
  45. 42 CommPort: INTEGER;
  46. 43 buf, buf1,
  47. 44 Msg1, Msg2: ARRAY [0..79] OF CHAR;
  48. ***** ^ not supported yet
  49. ***** ^ not supported yet
  50. 45 x, y,
  51. 46 ox, oy,
  52. 47 i, j,
  53. 48 evCnt,
  54. 49 max_clr,
  55. 50 clr,
  56. 51 px, py,
  57. 52 maxgig: INTEGER;
  58. 53 a, b: ARRAY [0..15] OF INTEGER;
  59. ***** ^ not supported yet
  60. ***** ^ not supported yet
  61. 54 bol, bol1: BOOLEAN;
  62. 55 evnt: event;
  63. 56 R1, sR: rect;
  64. 57 pt: point;
  65. 58 scrMask,
  66. 59 csrMask: cursor;
  67. 60 OK: BOOLEAN;
  68. 61 thePort: adsPort; (* pointer to default MetaWINDOW port *)
  69. 62 bm: mapArray;
  70. 63
  71. 64
  72. 65 (*
  73. 66 ** assumes event queing is enabled. call with # of
  74. 67 ** "ticks" to wait; ie appx 18 ticks per second
  75. 68 ** occur. Also use for "time outs".
  76. 69 *)
  77. 70
  78. 71 PROCEDURE mwDelay(time: INTEGER);
  79. 72 VAR
  80. 73 b: BOOLEAN;
  81. 74 i: INTEGER;
  82. 75 evnt: event;
  83. 76 BEGIN
  84. 77 b := Meta.PeekEvent(0, evnt);
  85. ***** ^ not supported yet
  86. ***** ^ not supported yet
  87. ***** ^ not supported yet
  88. 78 i := evnt.Time;
  89. ***** ^ not supported yet
  90. ***** ^ not supported yet
  91. 79
  92. 80 REPEAT
  93. 81 b := Meta.PeekEvent(0, evnt)
  94. ***** ^ not supported yet
  95. ***** ^ not supported yet
  96. ***** ^ not supported yet
  97. 82 UNTIL (evnt.Time - i >= time);
  98. ***** ^ not supported yet
  99. ***** ^ not supported yet
  100. 83 END mwDelay;
  101. ***** ^ not supported yet
  102. 84
  103. 85 (*** Display the active keys ***)
  104. 86
  105. 87 PROCEDURE DispOpt();
  106. 88 BEGIN
  107. 89 Meta.RasterOp(GrConst.zXORz);
  108. ***** ^ not supported yet
  109. ***** ^ not supported yet
  110. ***** ^ not supported yet
  111. ***** ^ not supported yet
  112. 90 Meta.MoveTo(px*2, py*22);
  113. ***** ^ not supported yet
  114. ***** ^ not supported yet
  115. ***** ^ not supported yet
  116. 91 Meta.DrawString('- Active keys - [w]hirl-a-gig, [c]lear screen');
  117. ***** ^ not supported yet
  118. ***** ^ not supported yet
  119. ***** ^ not supported yet
  120. 92 Meta.MoveTo(px*2, py*23);
  121. ***** ^ not supported yet
  122. ***** ^ not supported yet
  123. ***** ^ not supported yet
  124. 93 Meta.DrawString('[f]lip origin, [t]racking on/off.');
  125. ***** ^ not supported yet
  126. ***** ^ not supported yet
  127. ***** ^ not supported yet
  128. 94 Meta.MoveTo(px*2, py*24);
  129. ***** ^ not supported yet
  130. ***** ^ not supported yet
  131. ***** ^ not supported yet
  132. 95 Meta.DrawString('mouse: lft=draw, rt=plot');
  133. ***** ^ not supported yet
  134. ***** ^ not supported yet
  135. ***** ^ not supported yet
  136. 96 Meta.RasterOp(GrConst.zREPz);
  137. ***** ^ not supported yet
  138. ***** ^ not supported yet
  139. ***** ^ not supported yet
  140. ***** ^ not supported yet
  141. 97 END DispOpt;
  142. ***** ^ not supported yet
  143. 98
  144. 99 (*** do some keen patterns ***)
  145. 100
  146. 101 PROCEDURE DispPatt();
  147. 102 VAR
  148. 103 i: INTEGER;
  149. 104 BEGIN
  150. 105 Meta.SetRect(R1, 0, 0, sR.Xmax, sR.Ymax);
  151. ***** ^ not supported yet
  152. ***** ^ not supported yet
  153. ***** ^ not supported yet
  154. ***** ^ not supported yet
  155. ***** ^ not supported yet
  156. ***** ^ not supported yet
  157. ***** ^ not supported yet
  158. 106 x := R1.Xmax DIV 32; y := R1.Ymax DIV 32;
  159. ***** ^ not supported yet
  160. ***** ^ not supported yet
  161. ***** ^ not supported yet
  162. ***** ^ not supported yet
  163. 107
  164. 108 FOR i := 0 TO 15 DO
  165. 109 Meta.PenColor(i);
  166. ***** ^ not supported yet
  167. ***** ^ not supported yet
  168. ***** ^ not supported yet
  169. 110 Meta.BackColor(15-i);
  170. ***** ^ not supported yet
  171. ***** ^ not supported yet
  172. ***** ^ not supported yet
  173. 111 Meta.FillRect(R1, i+16);
  174. ***** ^ not supported yet
  175. ***** ^ not supported yet
  176. ***** ^ not supported yet
  177. ***** ^ not supported yet
  178. 112 Meta.FrameRect(R1);
  179. ***** ^ not supported yet
  180. ***** ^ not supported yet
  181. ***** ^ not supported yet
  182. 113 Meta.InsetRect(R1, x, y);
  183. ***** ^ not supported yet
  184. ***** ^ not supported yet
  185. ***** ^ not supported yet
  186. ***** ^ not supported yet
  187. 114 END;
  188. 115 END DispPatt;
  189. ***** ^ not supported yet
  190. 116
  191. 117 (*** Load the specified font. ***)
  192. 118
  193. 119 PROCEDURE LoadFont(VAR fontName: ARRAY OF CHAR);
  194. ***** ^ not supported yet
  195. 120 VAR
  196. 121 Dir: dirRec;
  197. 122 qErr,
  198. 123 loadErr: INTEGER;
  199. 124 path: ARRAY[0..80] OF CHAR;
  200. ***** ^ not supported yet
  201. ***** ^ not supported yet
  202. 125 fontBuf: adsFont;
  203. 126 BEGIN
  204. 127 Str.Copy(path, fontName);
  205. ***** ^ not supported yet
  206. ***** ^ not supported yet
  207. ***** ^ not supported yet
  208. ***** ^ not supported yet
  209. 128 loadErr := -1; (* Preempt Error *)
  210. 129 qErr := Meta.FileQuery(path, Dir, 1);
  211. ***** ^ not supported yet
  212. ***** ^ not supported yet
  213. ***** ^ not supported yet
  214. ***** ^ not supported yet
  215. ***** ^ not supported yet
  216. 130
  217. 131 IF (qErr # 1) THEN
  218. 132 (* No font file in default dir, try environment variable *)
  219. 133 Lib.EnvironmentFind("METAPATH", path);
  220. ***** ^ not supported yet
  221. ***** ^ not supported yet
  222. ***** ^ not supported yet
  223. ***** ^ not supported yet
  224. 134
  225. 135 IF (path[0] # CHR(0)) THEN
  226. ***** ^ not supported yet
  227. ***** ^ not supported yet
  228. ***** ^ undeclared identifier
  229. ***** ^ not supported yet
  230. 136 (* found the env parm, try using the path listed there *)
  231. 137
  232. 138 IF (path[Str.Length(path)] # '\') THEN
  233. ***** ^ not supported yet
  234. ***** ^ not supported yet
  235. ***** ^ not supported yet
  236. ***** ^ not supported yet
  237. 139 (* If no trailing slash, add one *)
  238. 140 Str.Append(path, '\');
  239. ***** ^ not supported yet
  240. ***** ^ not supported yet
  241. ***** ^ not supported yet
  242. ***** ^ not supported yet
  243. 141 END;
  244. 142
  245. 143 Str.Append(path, fontName);
  246. ***** ^ not supported yet
  247. ***** ^ not supported yet
  248. ***** ^ not supported yet
  249. ***** ^ not supported yet
  250. 144 qErr := Meta.FileQuery(path, Dir, 1);
  251. ***** ^ not supported yet
  252. ***** ^ not supported yet
  253. ***** ^ not supported yet
  254. ***** ^ not supported yet
  255. ***** ^ not supported yet
  256. 145 END;
  257. 146 END;
  258. 147
  259. 148 IF (qErr = 1) THEN
  260. 149 (* we got our file *)
  261. 150 ALLOCATE(ADDRESS(fontBuf), VAL(CARDINAL, Dir.fileSize + 1));
  262. ***** ^ not supported yet
  263. ***** ^ undeclared identifier
  264. ***** ^ not supported yet
  265. ***** ^ undeclared identifier
  266. ***** ^ not supported yet
  267. ***** ^ not supported yet
  268. ***** ^ not supported yet
  269. 151
  270. 152 IF (fontBuf # NIL) THEN
  271. ***** ^ not supported yet
  272. 153 (* We got our memory *)
  273. 154 loadErr := Meta.FileLoad(path, ADDRESS(fontBuf), VAL(CARDINAL, Dir.fileSize+1));
  274. ***** ^ not supported yet
  275. ***** ^ not supported yet
  276. ***** ^ not supported yet
  277. ***** ^ undeclared identifier
  278. ***** ^ not supported yet
  279. ***** ^ undeclared identifier
  280. ***** ^ not supported yet
  281. ***** ^ not supported yet
  282. ***** ^ not supported yet
  283. 155 IF loadErr <= 0 THEN
  284. 156 DEALLOCATE(ADDRESS(fontBuf), VAL(CARDINAL, Dir.fileSize + 1));
  285. ***** ^ not supported yet
  286. ***** ^ undeclared identifier
  287. ***** ^ not supported yet
  288. ***** ^ undeclared identifier
  289. ***** ^ not supported yet
  290. ***** ^ not supported yet
  291. ***** ^ not supported yet
  292. 157 END;
  293. 158 Meta.SetFont(ADDRESS(fontBuf));
  294. ***** ^ not supported yet
  295. ***** ^ not supported yet
  296. ***** ^ undeclared identifier
  297. ***** ^ not supported yet
  298. 159 END;
  299. 160 END;
  300. 161
  301. 162 IF (loadErr > 0) THEN
  302. 163 (* clear out system load error *)
  303. 164 qErr := Meta.QueryError();
  304. ***** ^ not supported yet
  305. ***** ^ not supported yet
  306. ***** ^ not supported yet
  307. 165 ELSE
  308. 166 (* beep if font load probs *)
  309. 167 IO.WrChar(CHR(7));
  310. ***** ^ not supported yet
  311. ***** ^ not supported yet
  312. ***** ^ undeclared identifier
  313. ***** ^ not supported yet
  314. 168 Str.Copy(fontName, 'Using internal SYSTEM08.FNT');
  315. ***** ^ not supported yet
  316. ***** ^ not supported yet
  317. ***** ^ not supported yet
  318. ***** ^ not supported yet
  319. 169 END;
  320. 170 END LoadFont;
  321. ***** ^ not supported yet
  322. 171
  323. 172
  324. 173 PROCEDURE Insert(VAR S1: ARRAY OF CHAR; S2: ARRAY OF CHAR; Pos, Width: CARDINAL);
  325. ***** ^ not supported yet
  326. ***** ^ not supported yet
  327. 174 VAR
  328. 175 L1, L2, i: CARDINAL;
  329. 176 BEGIN
  330. 177 L1 := Str.Length(S1);
  331. ***** ^ not supported yet
  332. ***** ^ not supported yet
  333. ***** ^ not supported yet
  334. 178 L2 := Str.Length(S2);
  335. ***** ^ not supported yet
  336. ***** ^ not supported yet
  337. ***** ^ not supported yet
  338. 179
  339. 180 IF (Pos + Width) > L1 THEN
  340. 181 RETURN
  341. 182 END;
  342. 183
  343. 184 IF L2 > Width THEN
  344. 185 RETURN
  345. 186 END;
  346. 187
  347. 188 FOR i := 0 TO L2 DO
  348. 189 S1[Pos + i] := S2[i];
  349. ***** ^ not supported yet
  350. ***** ^ not supported yet
  351. ***** ^ not supported yet
  352. ***** ^ not supported yet
  353. 190 END;
  354. 191
  355. 192 FOR i := Pos + L2 TO Pos + Width DO
  356. 193 S1[i] := ' ';
  357. ***** ^ not supported yet
  358. ***** ^ not supported yet
  359. 194 END;
  360. 195 END Insert;
  361. ***** ^ not supported yet
  362. 196
  363. 197
  364. 198 BEGIN
  365. 199 (* init the system *)
  366. 200
  367. 201 GrQry.GrQuery(GrafixCard, CommPort);
  368. ***** ^ not supported yet
  369. ***** ^ not supported yet
  370. ***** ^ not supported yet
  371. 202
  372. 203 i := Meta.InitGrafix(-GrafixCard);
  373. ***** ^ not supported yet
  374. ***** ^ not supported yet
  375. ***** ^ not supported yet
  376. 204
  377. 205 IF (i # 0) THEN
  378. 206 (* Display reason for no go *)
  379. 207 GrQry.GrInitErr(GrafixCard, CommPort, i);
  380. ***** ^ not supported yet
  381. ***** ^ not supported yet
  382. ***** ^ not supported yet
  383. 208 END;
  384. 209
  385. 210 Meta.ScreenRect(sR);
  386. ***** ^ not supported yet
  387. ***** ^ not supported yet
  388. ***** ^ not supported yet
  389. 211 Meta.SetDisplay(GrConst.GrafPg0);
  390. ***** ^ not supported yet
  391. ***** ^ not supported yet
  392. ***** ^ not supported yet
  393. ***** ^ not supported yet
  394. 212 max_clr := Meta.QueryColors();
  395. ***** ^ not supported yet
  396. ***** ^ not supported yet
  397. ***** ^ not supported yet
  398. 213 px := sR.Xmax DIV 80;
  399. ***** ^ not supported yet
  400. ***** ^ not supported yet
  401. 214 py := sR.Ymax DIV 25;
  402. ***** ^ not supported yet
  403. ***** ^ not supported yet
  404. 215 Meta.SetRect(R1, px*60, py*18, px*70, py*22);
  405. ***** ^ not supported yet
  406. ***** ^ not supported yet
  407. ***** ^ not supported yet
  408. ***** ^ not supported yet
  409. 216 Meta.PenColor(COLOR);
  410. ***** ^ not supported yet
  411. ***** ^ not supported yet
  412. ***** ^ not supported yet
  413. 217 Meta.FillRect(sR, 1);
  414. ***** ^ not supported yet
  415. ***** ^ not supported yet
  416. ***** ^ not supported yet
  417. ***** ^ not supported yet
  418. 218 Meta.PenColor(GrConst.White);
  419. ***** ^ not supported yet
  420. ***** ^ not supported yet
  421. ***** ^ not supported yet
  422. ***** ^ not supported yet
  423. 219
  424. 220 Meta.GetPort(thePort);
  425. ***** ^ not supported yet
  426. ***** ^ not supported yet
  427. ***** ^ not supported yet
  428. 221 i := thePort^.portBMap^.devClass;
  429. ***** ^ not supported yet
  430. ***** ^ not supported yet
  431. ***** ^ not supported yet
  432. 222
  433. 223 IF (thePort^.portBMap^.pixPlanes > 1) THEN
  434. ***** ^ not supported yet
  435. ***** ^ not supported yet
  436. ***** ^ not supported yet
  437. 224 i := INTEGER(BITSET(i) * BITSET(0FFF8H))
  438. ***** ^ undeclared identifier
  439. ***** ^ not supported yet
  440. ***** ^ undeclared identifier
  441. ***** ^ not supported yet
  442. 225 END;
  443. 226
  444. 227 Str.Copy(buf1, 'SYSTEM');
  445. ***** ^ not supported yet
  446. ***** ^ not supported yet
  447. ***** ^ not supported yet
  448. ***** ^ not supported yet
  449. 228 Str.IntToStr(LONGINT(i), buf, 10, OK);
  450. ***** ^ not supported yet
  451. ***** ^ not supported yet
  452. ***** ^ not supported yet
  453. ***** ^ not supported yet
  454. ***** ^ not supported yet
  455. 229 Str.Append(buf1, buf);
  456. ***** ^ not supported yet
  457. ***** ^ not supported yet
  458. ***** ^ not supported yet
  459. ***** ^ not supported yet
  460. 230 Str.Append(buf1, '.FNT');
  461. ***** ^ not supported yet
  462. ***** ^ not supported yet
  463. ***** ^ not supported yet
  464. ***** ^ not supported yet
  465. 231
  466. 232 LoadFont(buf1);
  467. ***** ^ not supported yet
  468. ***** ^ not supported yet
  469. 233
  470. 234 Meta.MoveTo(px, py);
  471. ***** ^ not supported yet
  472. ***** ^ not supported yet
  473. ***** ^ not supported yet
  474. 235 Meta.DrawString(buf1);
  475. ***** ^ not supported yet
  476. ***** ^ not supported yet
  477. ***** ^ not supported yet
  478. 236
  479. 237 (* Init the whirlagig *)
  480. 238 Meta.PenSize(1, 1);
  481. ***** ^ not supported yet
  482. ***** ^ not supported yet
  483. ***** ^ not supported yet
  484. 239 maxgig := 39;
  485. 240
  486. 241 x := px * 10;
  487. 242 y := py * 8;
  488. 243 j := py;
  489. 244
  490. 245 FOR i := 0 TO 15 DO
  491. 246 a[i] := x - px * 5;
  492. ***** ^ not supported yet
  493. ***** ^ not supported yet
  494. 247 b[i] := j;
  495. ***** ^ not supported yet
  496. ***** ^ not supported yet
  497. 248 j := j + py;
  498. 249 END;
  499. 250
  500. 251 (* Create a user-defined cursor to be a triangle *)
  501. 252
  502. 253 scrMask.curWidth := 16; scrMask.curHeight := 16;
  503. ***** ^ not supported yet
  504. ***** ^ not supported yet
  505. ***** ^ not supported yet
  506. ***** ^ not supported yet
  507. 254 scrMask.curAlign := 0; scrMask.curRowBytes := 2;
  508. ***** ^ not supported yet
  509. ***** ^ not supported yet
  510. ***** ^ not supported yet
  511. ***** ^ not supported yet
  512. 255 scrMask.curBits := 1; scrMask.curPlanes := 1;
  513. ***** ^ not supported yet
  514. ***** ^ not supported yet
  515. ***** ^ not supported yet
  516. ***** ^ not supported yet
  517. 256 scrMask.curData[0] := 000H; scrMask.curData[1] := 000H;
  518. ***** ^ not supported yet
  519. ***** ^ not supported yet
  520. ***** ^ not supported yet
  521. ***** ^ not supported yet
  522. ***** ^ not supported yet
  523. ***** ^ not supported yet
  524. 257 scrMask.curData[2] := 000H; scrMask.curData[3] := 000H;
  525. ***** ^ not supported yet
  526. ***** ^ not supported yet
  527. ***** ^ not supported yet
  528. ***** ^ not supported yet
  529. ***** ^ not supported yet
  530. ***** ^ not supported yet
  531. 258 scrMask.curData[4] := 000H; scrMask.curData[5] := 000H;
  532. ***** ^ not supported yet
  533. ***** ^ not supported yet
  534. ***** ^ not supported yet
  535. ***** ^ not supported yet
  536. ***** ^ not supported yet
  537. ***** ^ not supported yet
  538. 259 scrMask.curData[6] := 000H; scrMask.curData[7] := 000H;
  539. ***** ^ not supported yet
  540. ***** ^ not supported yet
  541. ***** ^ not supported yet
  542. ***** ^ not supported yet
  543. ***** ^ not supported yet
  544. ***** ^ not supported yet
  545. 260 scrMask.curData[8] := 000H; scrMask.curData[9] := 000H;
  546. ***** ^ not supported yet
  547. ***** ^ not supported yet
  548. ***** ^ not supported yet
  549. ***** ^ not supported yet
  550. ***** ^ not supported yet
  551. ***** ^ not supported yet
  552. 261 scrMask.curData[10] := 000H; scrMask.curData[11] := 000H;
  553. ***** ^ not supported yet
  554. ***** ^ not supported yet
  555. ***** ^ not supported yet
  556. ***** ^ not supported yet
  557. ***** ^ not supported yet
  558. ***** ^ not supported yet
  559. 262 scrMask.curData[12] := 000H; scrMask.curData[13] := 000H;
  560. ***** ^ not supported yet
  561. ***** ^ not supported yet
  562. ***** ^ not supported yet
  563. ***** ^ not supported yet
  564. ***** ^ not supported yet
  565. ***** ^ not supported yet
  566. 263 scrMask.curData[14] := 001H; scrMask.curData[15] := 000H;
  567. ***** ^ not supported yet
  568. ***** ^ not supported yet
  569. ***** ^ not supported yet
  570. ***** ^ not supported yet
  571. ***** ^ not supported yet
  572. ***** ^ not supported yet
  573. 264 scrMask.curData[16] := 003H; scrMask.curData[17] := 080H;
  574. ***** ^ not supported yet
  575. ***** ^ not supported yet
  576. ***** ^ not supported yet
  577. ***** ^ not supported yet
  578. ***** ^ not supported yet
  579. ***** ^ not supported yet
  580. 265 scrMask.curData[18] := 007H; scrMask.curData[19] := 0C0H;
  581. ***** ^ not supported yet
  582. ***** ^ not supported yet
  583. ***** ^ not supported yet
  584. ***** ^ not supported yet
  585. ***** ^ not supported yet
  586. ***** ^ not supported yet
  587. 266 scrMask.curData[20] := 00FH; scrMask.curData[21] := 0E0H;
  588. ***** ^ not supported yet
  589. ***** ^ not supported yet
  590. ***** ^ not supported yet
  591. ***** ^ not supported yet
  592. ***** ^ not supported yet
  593. ***** ^ not supported yet
  594. 267 scrMask.curData[22] := 01FH; scrMask.curData[23] := 0F0H;
  595. ***** ^ not supported yet
  596. ***** ^ not supported yet
  597. ***** ^ not supported yet
  598. ***** ^ not supported yet
  599. ***** ^ not supported yet
  600. ***** ^ not supported yet
  601. 268 scrMask.curData[24] := 03FH; scrMask.curData[25] := 0F8H;
  602. ***** ^ not supported yet
  603. ***** ^ not supported yet
  604. ***** ^ not supported yet
  605. ***** ^ not supported yet
  606. ***** ^ not supported yet
  607. ***** ^ not supported yet
  608. 269 scrMask.curData[26] := 07FH; scrMask.curData[27] := 0FCH;
  609. ***** ^ not supported yet
  610. ***** ^ not supported yet
  611. ***** ^ not supported yet
  612. ***** ^ not supported yet
  613. ***** ^ not supported yet
  614. ***** ^ not supported yet
  615. 270 scrMask.curData[28] := 000H; scrMask.curData[29] := 000H;
  616. ***** ^ not supported yet
  617. ***** ^ not supported yet
  618. ***** ^ not supported yet
  619. ***** ^ not supported yet
  620. ***** ^ not supported yet
  621. ***** ^ not supported yet
  622. 271 scrMask.curData[30] := 000H; scrMask.curData[31] := 000H;
  623. ***** ^ not supported yet
  624. ***** ^ not supported yet
  625. ***** ^ not supported yet
  626. ***** ^ not supported yet
  627. ***** ^ not supported yet
  628. ***** ^ not supported yet
  629. 272
  630. 273 csrMask.curWidth := 16; csrMask.curHeight := 16;
  631. ***** ^ not supported yet
  632. ***** ^ not supported yet
  633. ***** ^ not supported yet
  634. ***** ^ not supported yet
  635. 274 csrMask.curAlign := 0; csrMask.curRowBytes := 2;
  636. ***** ^ not supported yet
  637. ***** ^ not supported yet
  638. ***** ^ not supported yet
  639. ***** ^ not supported yet
  640. 275 csrMask.curBits := 1; csrMask.curPlanes := 1;
  641. ***** ^ not supported yet
  642. ***** ^ not supported yet
  643. ***** ^ not supported yet
  644. ***** ^ not supported yet
  645. 276 csrMask.curData[0] := 000H; csrMask.curData[1] := 000H;
  646. ***** ^ not supported yet
  647. ***** ^ not supported yet
  648. ***** ^ not supported yet
  649. ***** ^ not supported yet
  650. ***** ^ not supported yet
  651. ***** ^ not supported yet
  652. 277 csrMask.curData[2] := 000H; csrMask.curData[3] := 000H;
  653. ***** ^ not supported yet
  654. ***** ^ not supported yet
  655. ***** ^ not supported yet
  656. ***** ^ not supported yet
  657. ***** ^ not supported yet
  658. ***** ^ not supported yet
  659. 278 csrMask.curData[4] := 000H; csrMask.curData[5] := 000H;
  660. ***** ^ not supported yet
  661. ***** ^ not supported yet
  662. ***** ^ not supported yet
  663. ***** ^ not supported yet
  664. ***** ^ not supported yet
  665. ***** ^ not supported yet
  666. 279 csrMask.curData[6] := 000H; csrMask.curData[7] := 000H;
  667. ***** ^ not supported yet
  668. ***** ^ not supported yet
  669. ***** ^ not supported yet
  670. ***** ^ not supported yet
  671. ***** ^ not supported yet
  672. ***** ^ not supported yet
  673. 280 csrMask.curData[8] := 000H; csrMask.curData[9] := 000H;
  674. ***** ^ not supported yet
  675. ***** ^ not supported yet
  676. ***** ^ not supported yet
  677. ***** ^ not supported yet
  678. ***** ^ not supported yet
  679. ***** ^ not supported yet
  680. 281 csrMask.curData[10] := 000H; csrMask.curData[11] := 000H;
  681. ***** ^ not supported yet
  682. ***** ^ not supported yet
  683. ***** ^ not supported yet
  684. ***** ^ not supported yet
  685. ***** ^ not supported yet
  686. ***** ^ not supported yet
  687. 282 csrMask.curData[12] := 001H; csrMask.curData[13] := 000H;
  688. ***** ^ not supported yet
  689. ***** ^ not supported yet
  690. ***** ^ not supported yet
  691. ***** ^ not supported yet
  692. ***** ^ not supported yet
  693. ***** ^ not supported yet
  694. 283 csrMask.curData[14] := 002H; csrMask.curData[15] := 080H;
  695. ***** ^ not supported yet
  696. ***** ^ not supported yet
  697. ***** ^ not supported yet
  698. ***** ^ not supported yet
  699. ***** ^ not supported yet
  700. ***** ^ not supported yet
  701. 284 csrMask.curData[16] := 004H; csrMask.curData[17] := 040H;
  702. ***** ^ not supported yet
  703. ***** ^ not supported yet
  704. ***** ^ not supported yet
  705. ***** ^ not supported yet
  706. ***** ^ not supported yet
  707. ***** ^ not supported yet
  708. 285 csrMask.curData[18] := 008H; csrMask.curData[19] := 020H;
  709. ***** ^ not supported yet
  710. ***** ^ not supported yet
  711. ***** ^ not supported yet
  712. ***** ^ not supported yet
  713. ***** ^ not supported yet
  714. ***** ^ not supported yet
  715. 286 csrMask.curData[20] := 010H; csrMask.curData[21] := 010H;
  716. ***** ^ not supported yet
  717. ***** ^ not supported yet
  718. ***** ^ not supported yet
  719. ***** ^ not supported yet
  720. ***** ^ not supported yet
  721. ***** ^ not supported yet
  722. 287 csrMask.curData[22] := 020H; csrMask.curData[23] := 008H;
  723. ***** ^ not supported yet
  724. ***** ^ not supported yet
  725. ***** ^ not supported yet
  726. ***** ^ not supported yet
  727. ***** ^ not supported yet
  728. ***** ^ not supported yet
  729. 288 csrMask.curData[24] := 040H; csrMask.curData[25] := 004H;
  730. ***** ^ not supported yet
  731. ***** ^ not supported yet
  732. ***** ^ not supported yet
  733. ***** ^ not supported yet
  734. ***** ^ not supported yet
  735. ***** ^ not supported yet
  736. 289 csrMask.curData[26] := 080H; csrMask.curData[27] := 002H;
  737. ***** ^ not supported yet
  738. ***** ^ not supported yet
  739. ***** ^ not supported yet
  740. ***** ^ not supported yet
  741. ***** ^ not supported yet
  742. ***** ^ not supported yet
  743. 290 csrMask.curData[28] := 0FFH; csrMask.curData[29] := 0FEH;
  744. ***** ^ not supported yet
  745. ***** ^ not supported yet
  746. ***** ^ not supported yet
  747. ***** ^ not supported yet
  748. ***** ^ not supported yet
  749. ***** ^ not supported yet
  750. 291 csrMask.curData[30] := 000H; csrMask.curData[31] := 000H;
  751. ***** ^ not supported yet
  752. ***** ^ not supported yet
  753. ***** ^ not supported yet
  754. ***** ^ not supported yet
  755. ***** ^ not supported yet
  756. ***** ^ not supported yet
  757. 292
  758. 293 Meta.DefineCursor(2, 8, 8, scrMask, csrMask);
  759. ***** ^ not supported yet
  760. ***** ^ not supported yet
  761. ***** ^ not supported yet
  762. ***** ^ not supported yet
  763. 294
  764. 295
  765. 296 (* Now turn on mouse and event queue stuff *)
  766. 297 Meta.InitMouse(CommPort);
  767. ***** ^ not supported yet
  768. ***** ^ not supported yet
  769. ***** ^ not supported yet
  770. 298
  771. 299 Meta.ScaleMouse (sR.Xmax DIV 40, sR.Ymax DIV 40);
  772. ***** ^ not supported yet
  773. ***** ^ not supported yet
  774. ***** ^ not supported yet
  775. ***** ^ not supported yet
  776. ***** ^ not supported yet
  777. ***** ^ not supported yet
  778. ***** ^ not supported yet
  779. 300
  780. 301 ox := 100;
  781. 302 x := 100;
  782. 303 oy := 100;
  783. 304 y := 100;
  784. 305
  785. 306 Meta.MoveCursor(x, y);
  786. ***** ^ not supported yet
  787. ***** ^ not supported yet
  788. ***** ^ not supported yet
  789. 307
  790. 308 FOR i := 0 TO 7 DO
  791. 309 bm[i] := i;
  792. ***** ^ not supported yet
  793. ***** ^ not supported yet
  794. 310 END;
  795. 311
  796. 312 bm[4] := 0; (* arrow *)
  797. ***** ^ not supported yet
  798. ***** ^ not supported yet
  799. 313 bm[5] := 2; (* new pointy thing *)
  800. ***** ^ not supported yet
  801. ***** ^ not supported yet
  802. 314 Meta.CursorMap(bm);
  803. ***** ^ not supported yet
  804. ***** ^ not supported yet
  805. ***** ^ not supported yet
  806. 315 bol := TRUE;
  807. 316 bol1 := TRUE;
  808. 317
  809. 318 (* Enable mouse autotracking & event queue*)
  810. 319
  811. 320 Meta.TrackCursor(bol);
  812. ***** ^ not supported yet
  813. ***** ^ not supported yet
  814. ***** ^ not supported yet
  815. 321 Meta.ShowCursor();
  816. ***** ^ not supported yet
  817. ***** ^ not supported yet
  818. ***** ^ not supported yet
  819. 322 Meta.EventQueue(TRUE);
  820. ***** ^ not supported yet
  821. ***** ^ not supported yet
  822. ***** ^ not supported yet
  823. 323
  824. 324 (* flush event queue *)
  825. 325 WHILE Meta.KeyEvent(FALSE, evnt) DO
  826. ***** ^ not supported yet
  827. ***** ^ not supported yet
  828. ***** ^ not supported yet
  829. 326 ;
  830. 327 END;
  831. ***** ^ ident expected
  832. 328
  833. 329 DispOpt();
  834. 330 Meta.LimitMouse(sR.Xmin-20, sR.Ymin-20, sR.Xmax+20, sR.Ymax+20);
  835. 331 clr := 0;
  836. 332 evCnt := 0;
  837. 333
  838. 334 Meta.RasterOp(GrConst.zREPz);
  839. 335
  840. 336 (* Init messages *)
  841. 337 Str.Copy(Msg1, 'event= ascii= scan= state= x= y= time= ');
  842. 338 Str.Copy(Msg2, 'x= y= sw= time= ');
  843. 339
  844. 340
  845. 341 REPEAT
  846. 342 Meta.QueryCursor(pt.X, pt.Y, i, j);
  847. 343
  848. 344 IF Meta.KeyEvent(FALSE, evnt) THEN
  849. 345 CASE evnt.ASCII OF
  850. 346 | 't': (* t will flip tracking on/off *)
  851. 347 bol := NOT(bol);
  852. 348 Meta.TrackCursor(bol);
  853. 349 | 'c': (* clears screen *)
  854. 350 Meta.HideCursor();
  855. 351 Meta.PenColor(COLOR);
  856. 352 Meta.FillRect(sR, 1);
  857. 353 Meta.PenColor(GrConst.White);
  858. 354 DispOpt();
  859. 355 Meta.ShowCursor();
  860. 356 | 'f': (* f will flip port origin *)
  861. 357 Meta.HideCursor();
  862. 358 bol1 := NOT(bol1);
  863. 359 Meta.PortOrigin(bol1);
  864. 360 Meta.PenColor(COLOR);
  865. 361 Meta.FillRect(sR, 1);
  866. 362 Meta.PenColor(GrConst.White);
  867. 363 DispOpt();
  868. 364 Meta.ShowCursor();
  869. 365 | 'w': (* w for the whilagig *)
  870. 366 Meta.HideCursor();
  871. 367 Meta.RasterOp (GrConst.zXORz);
  872. 368 FOR i := 0 TO maxgig DO
  873. 369 FOR j := 0 TO 15 DO
  874. 370 Meta.MoveTo (pt.X, pt.Y);
  875. 371 Meta.LineTo (a[j], b[j]);
  876. 372 END
  877. 373 END;
  878. 374 Meta.RasterOp(GrConst.zREPz);
  879. 375 Meta.ShowCursor();
  880. 376 END;
  881. 377
  882. 378 INC(evCnt);
  883. 379 Str.IntToStr(LONGINT(evCnt), buf, 10, OK);
  884. 380 Insert(Msg1, buf, 6, 2);
  885. 381 Str.IntToStr(LONGINT(evnt.ASCII), buf, 16, OK);
  886. 382 Insert(Msg1, buf, 16, 2);
  887. 383 Str.IntToStr(LONGINT(evnt.ScanCode), buf, 16, OK);
  888. 384 Insert(Msg1, buf, 25, 2);
  889. 385 Str.IntToStr(LONGINT(evnt.State), buf, 16, OK);
  890. 386 Insert(Msg1, buf, 35, 4);
  891. 387 Str.IntToStr(LONGINT(evnt.CursorX), buf, 10, OK);
  892. 388 Insert(Msg1, buf, 43, 3);
  893. 389 Str.IntToStr(LONGINT(evnt.CursorY), buf, 10, OK);
  894. 390 Insert(Msg1, buf, 50, 3);
  895. 391 Str.IntToStr(LONGINT(evnt.Time), buf, 10, OK);
  896. 392 Insert(Msg1, buf, 60, 5);
  897. 393 Meta.MoveTo(px*6, py*2);
  898. 394 Meta.DrawString(Msg1);
  899. 395
  900. 396 ELSIF (evnt.Time MOD 8) = 0 THEN
  901. 397 Meta.ProtectRect(R1);
  902. 398 Meta.PenColor(clr);
  903. 399 Meta.FillRect(R1, 1);
  904. 400 Meta.ProtectOff();
  905. 401 INC(clr);
  906. 402
  907. 403 IF (clr > max_clr) THEN
  908. 404 clr := 0
  909. 405 END;
  910. 406 END;
  911. 407
  912. 408 (*** etch-a-sketch ***)
  913. 409
  914. 410 IF j = (GrConst.swRight + GrConst.swLeft) THEN
  915. 411 Meta.PenColor(GrConst.Black);
  916. 412 Meta.HideCursor();
  917. 413 Meta.MoveTo(ox, oy);
  918. 414 Meta.LineTo(pt.X, pt.Y);
  919. 415 Meta.ShowCursor();
  920. 416 ELSE
  921. 417 IF INTEGER(BITSET(j) * BITSET(GrConst.swLeft)) # 0 THEN
  922. 418 Meta.PenColor(GrConst.Black);
  923. 419 Meta.HideCursor();
  924. 420 Meta.MoveTo(ox, oy);
  925. 421 Meta.LineTo(pt.X, pt.Y);
  926. 422 Meta.ShowCursor();
  927. 423 END;
  928. 424 ox := pt.X;
  929. 425 oy := pt.Y;
  930. 426 END;
  931. 427
  932. 428 Meta.PenColor(GrConst.White);
  933. 429
  934. 430
  935. 431 Str.IntToStr(LONGINT(evnt.CursorX), buf, 10, OK);
  936. 432 Insert(Msg2, buf, 2, 3);
  937. 433 Str.IntToStr(LONGINT(evnt.CursorY), buf, 10, OK);
  938. 434 Insert(Msg2, buf, 9, 3);
  939. 435 Str.IntToStr(LONGINT(j), buf, 10, OK);
  940. 436 Insert(Msg2, buf, 17, 2);
  941. 437 Str.IntToStr(LONGINT(evnt.Time), buf, 10, OK);
  942. 438 Insert(Msg2, buf, 26, 6);
  943. 439 Meta.MoveTo(px*6, py*4);
  944. 440 Meta.DrawString(Msg2);
  945. 441
  946. 442 IF Meta.PtInRect(pt, R1) THEN
  947. 443 Meta.DrawString(" pt IS in rect ");
  948. 444 ELSE
  949. 445 Meta.DrawString(" pt NOT in rect ");
  950. 446 END;
  951. 447
  952. 448 Meta.RasterOp(GrConst.zXORz);
  953. 449 Meta.MoveTo(px*79, py*4);
  954. 450 Meta.LineTo(px*79, py*20);
  955. 451 Meta.RasterOp(GrConst.zREPz);
  956. 452 UNTIL ((pt.X <= -20) AND ((evnt.ASCII # CHR(3)) AND (evnt.ScanCode # BYTE(02EH))));
  957. 453
  958. 454 Meta.TrackCursor(FALSE);
  959. 455 Meta.HideCursor();
  960. 456
  961. 457 Meta.BackColor(COLOR);
  962. 458
  963. 459 (* Scroll a rectangle into screen *)
  964. 460
  965. 461 Meta.RasterOp(GrConst.zXORz);
  966. 462 Meta.FrameRect(R1);
  967. 463 Meta.RasterOp(GrConst.zREPz);
  968. 464
  969. 465 FOR i := 0 TO 30 DO
  970. 466 Meta.ScrollRect(R1, 0, -4);
  971. 467 Meta.OffsetRect(R1, 0, -4);
  972. 468 END;
  973. 469
  974. 470 FOR i := 0 TO 40 DO
  975. 471 Meta.ScrollRect(R1, 8, 0);
  976. 472 Meta.OffsetRect(R1, 8, 0);
  977. 473 END;
  978. 474
  979. 475 mwDelay(sec);
  980. 476
  981. 477 (* pretty patterns to end with *)
  982. 478 DispPatt();
  983. 479 mwDelay(sec*3);
  984. 480
  985. 481 GrQry.GrQuit('', 0);
  986. 482
  987. 483 END Testtrak.
  988. 503 errors