mac.mod 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895
  1. MODULE mac;
  2. IMPORT FindMeta;
  3. IMPORT GrConst;
  4. IMPORT GrProcs1;
  5. IMPORT GrProcs2;
  6. IMPORT GrPorts;
  7. IMPORT GrFonts;
  8. FROM GrProcs1 IMPORT AddPt,AlignPattern,BackColor,BackPattern,BorderColor,CenterRect,CharWidth,ClearText,ClipRect,
  9. ClrInt,CopyBits,CursorBitmap,CursorMap,CursorStyle,DefineCursor,DefineDash,DefinePattern,DrawChar,
  10. DrawString,DrawText,DupPt,DupRect,EqualPt,EqualRect,EraseArc,EraseOval,ErasePoly,EraseRect,
  11. EraseRoundRect,EventQueue,FillArc,FillOval,FillPoly,FillRect,FillRoundRect,FrameArc,FrameOval,
  12. FramePoly,FrameRect,FrameRoundRect,Gbl2LclPt,Gbl2LclRect,Gbl2VirPt,Gbl2VirRect,GetBMapField,
  13. GetCmdLine,GetFontField,GetLPixel,GetPenState,GetPixel,GetPort,GetPortField,HardCopy,
  14. HideCursor,HidePen,ImagePara,ImageSize,InceptRect,InitBitmap,InitGrafix,InitMouse,InitPort,
  15. InitRowTable,InsetRect,InvertArc,InvertOval,InvertPoly,InvertRect,InvertRoundRect,KeyEvent,
  16. Lcl2GblPt,Lcl2GblRect,Lcl2VirPt,Lcl2VirRect,LimitMouse,LineRel,LineTo,LoadFont,LoadPalette,
  17. MapPoly,MapPt,MapRect,MarkerAngle,MarkerSize,MarkerType,MetaInstalled,MiterLimit,MoveCursor,
  18. MovePortTo,MoveTo,OffsetPoly,OffsetRect,OvalPt;
  19. FROM GrProcs2 IMPORT PaintArc,PaintOval,PaintPoly,PaintRect,PaintRoundRect,PeekEvent,PenCap,PenColor,PenDash,PenJoin,
  20. PenMode,PenNormal,PenOffset,PenPattern,PenSize,PolyLine,PolyMarker,PopGrafix,PortBitmap,PortOrigin,
  21. PortSize,ProtectOff,ProtectPort,ProtectRect,Pt2Rect,PtInArc,PtInRect,PtInRoundRect,PtOnArc,
  22. PtOnLine,PtOnOval,PtOnPoly,PtOnRect,PtOnRoundRect,PtToAngle,PushGrafix,QueryColors,QueryComm,
  23. QueryCursor,QueryError,QueryGrafix,QueryPosn,QueryRes,QueryX,QueryY,RasterOp,ReadImage,
  24. ReadMouse,ScaleMouse,ScalePt,ScreenRect,ScreenSize,ScrollRect,SetBitmap,SetDisplay,SetFont,
  25. SetInt,SetLocal,SetOrigin,SetPalette,SetPenState,SetPixel,SetPort,SetPt,SetRect,SetVirtual,
  26. ShiftRect,ShowCursor,ShowPen,StopEvent,StopMouse,StoreEvent,StringWidth,SubPt,SystemFont,
  27. TextAlign,TextAngle,TextExtra,TextFace,TextMode,TextPath,TextScore,TextSize,TextSlant,TextSpace,
  28. TextUnder,TextWidth,TrackCursor,UnionRect,Vir2GblPt,Vir2GblRect,Vir2LclPt,Vir2LclRect,VirtualRect,
  29. WriteImage,XlateImage,XYInRect,XYOnLine,ZoomBits;
  30. FROM GrConst IMPORT
  31. Replace,
  32. Ovrlay,
  33. Invert,
  34. Erase,
  35. zREPz,
  36. zORz,
  37. zXORz,
  38. zNANDz,
  39. zNREPz,
  40. zNORz,
  41. zNXORz,
  42. zANDz,
  43. ATT , (* AT&T Std. Color & DEB Adaptors *)
  44. ATT640x400 , (* 640x400 monochrome *)
  45. DEB640x200 , (* 640x200 16-color *)
  46. DEB640x400 , (* 640x400 16-color *)
  47. CGA , (* IBM Color Graphics Adaptor (CGA) *)
  48. CGA320x200 , (* 320x200 4-color *)
  49. CGA640x200 , (* 640x200 2-color *)
  50. COR , (* Cornerstone *)
  51. COR1600x1280V , (* Vista 1600 1600x1280 mono *)
  52. COR1600x1280VA , (*Vista 1600 1600x1280 no em, 2 mon *)
  53. COR1600x1280DP , (* DualPage 1600x1280 mono *)
  54. COR1600x1280DPA , (* DualPage 1600x1280, no JP1 *)
  55. EGA , (* IBM Enhanced Graphics Adaptor *)
  56. EGAMono , (* 640x350 monochrome *)
  57. EGA320x200 , (* 320x200 16-color *)
  58. EGA640x200 , (* 640x200 16-color *)
  59. EGA640x350 , (* 640x350 16-color (128k EGA) *)
  60. MGA640x350 , (* 640x350 2-color *)
  61. EGA640x480 , (* 640x480 16-color (VGA) *)
  62. MGA640x480 , (* 640x480 2-color (MCGA) *)
  63. VGA320x200 , (* 320x200 256-color (PS2 VGA) *)
  64. EGA640x350S , (* 640x350 16-color (no bios-EGA) *)
  65. VGA640x350S , (* 640x350 16-color (no bios-VGA) *)
  66. VGA640x480S , (* 640x480 16-color (no bios-VGA) *)
  67. JRT320x200 , (*320x200 16-color IBM PCjr & Tandy 1000 EX *)
  68. EVA , (* Tseng Labs EVA/480 *)
  69. EVA640x480 , (* 640x480 16-color *)
  70. EVR , (* Everex Graphics Edge Adaptor *)
  71. EVR640x200 , (* 640x200 16-color *)
  72. EVR640x400 , (* 640x400 4-color *)
  73. GEN , (* Genoa SuperEGA HiRes *)
  74. GEN800x600 , (* 800x600 16-color *)
  75. GEN1024x768 , (* Genoa SuperVGA HiRes-10 16-color *)
  76. GEN640x350X , (* 640x350 256-color *)
  77. GEN640x480X , (* 640x480 256-color *)
  78. HER , (* Hercules/AST Monochrome Adaptor *)
  79. HER720x348 , (* 720x348 monochrome *)
  80. MDS , (* MDS Genius Graphics Display *)
  81. MDS736x1008 , (* 736x1008 monochrome *)
  82. NNR512x512 , (* Number Nine 512x485 256-color *)
  83. NNR1024x768 , (* 2048x4 @ 1024x768x16 *)
  84. NSI , (* NSI Logic Smart EGA/Plus *)
  85. NSI800x600 , (* 800x600 16-color *)
  86. OCD800x600 , (* Orchid Designer VGA 800x600x16 *)
  87. OCD1024x768 , (* 1024x768 16 color *)
  88. OCD640x350X , (* 640x480 256 color *)
  89. OCD640x480X , (* 640x480 256 color *)
  90. PAR , (* Paradise AutoSwitch EGA/480 *)
  91. PAR640x480 , (* 640x480 16-color *)
  92. PAR800x600 , (* 800x600 16-color *)
  93. SIG , (* Sigma Design *)
  94. SIG640x400 , (* 640x400 16-color, Color-400 *)
  95. SIG1664x1200 , (* Sigma LaserView 1664x1200 mono *)
  96. STB , (* STB GraphicsPlus-II Adaptor *)
  97. STB640x352 , (* 640x352 monochrome *)
  98. STB320x200 , (* 320x200 16-color *)
  99. STB640x200 , (* 640x200 4-color *)
  100. STB640x400 , (* 640x400 monochrome *)
  101. STB800x600 , (* STB VGA Extra/EM 800x600x16 *)
  102. STB1024x768 , (* 1024x768 16 color *)
  103. STB640x350X , (* 640x350 256 color *)
  104. STB640x480X , (* 640x480 256 color *)
  105. TEC , (* Tecmar Graphics-Master Adaptor *)
  106. TEC720x352 , (* 720x352 monochrome *)
  107. TEC720x704 , (* 720x704 monochrome *)
  108. TEC320x200 , (* 320x200 16-color *)
  109. TEC640x200 , (* 640x200 16-color *)
  110. TEC640x400 , (* 640x400 16-color *)
  111. TOS , (* Toshiba 3100 *)
  112. TOS640x400 , (* 640x400 monochrome *)
  113. TTS , (* IBM 3270 PC *)
  114. TTS720x350 , (* 720x350 monochrome *)
  115. TTS360x350 , (* 360x350 4-color *)
  116. VGA , (* Video-7 VEGA Deluxe *)
  117. VGA640x480 , (* 640x480 16-color *)
  118. VGA752x410 , (* 752x410 16-color *)
  119. VGA720x540 , (* V7 VGA 720x540 16-color *)
  120. VGA800x600 , (* 800x600 16-color (VGA) *)
  121. VGA640x350X , (* V7 VRAM 640x350 256-color *)
  122. VGA640x480X , (* 640x480 256-color *)
  123. VGA1024x768x2 , (* 1024x768 2-color *)
  124. WYS , (* Wyse WY-700 Graphics Display *)
  125. WYS1280x800 , (* 1280x800 monochrome *)
  126. WYS1280x400 , (* 1280x400 monochrome *)
  127. WYS640x400 , (* 640x400 monochrome *)
  128. MEC1120x750 , (* NEC PC 98XA monochrome *)
  129. MEC640x400 , (* NEC PC 98VM monochrome *)
  130. NEC1120x750 , (* NEC PC 98XA 16-color *)
  131. NEC640x400 , (* NEC PC 98VM 16-color *)
  132. (* Defines for National Design Genesis-1024/1280 *)
  133. NDI640x480x4D , (* 640x480 16-color, digitl *)
  134. NDI640x480x4A , (* 640x480 16-color, analog *)
  135. NDI1024x768x4J , (* 1024x768 16-color, JVC *)
  136. NDI1024x768x4M , (* 1024x768 16-color, Mitsu. *)
  137. NDI1280x1024x4J , (* 1280x1024 16-color, JVC *)
  138. NDI960x720x4N , (* 960x720 16-color, NEC XL *)
  139. (* Defines for Hewlett-Packard HP82328 IGC *)
  140. HP1024x768x4 , (* 1024x768 16-color *)
  141. CUSTLIN , (* User defined linear memory *)
  142. CUSTBS , (* User defined Bank select *)
  143. CUSTEGA , (* User defined EGA Superset *)
  144. (* Mouse Definitions *)
  145. com1 , (* Mouse Systems mouse, COM1 *)
  146. com2 , (* Mouse Systems mouse, COM2 *)
  147. msMouse , (* Microsoft Bus Mouse *)
  148. msCOM1 , (* Microsoft Serial Mouse, COM1 *)
  149. msCOM2 , (* Microsoft Serial Mouse, COM2 *)
  150. MsDriver , (* Microsoft Mouse driver *)
  151. swRight ,
  152. swMiddle , (* (not on 2 button mice) *)
  153. swLeft ,
  154. swAll ,
  155. black , (* all bits OFF *)
  156. white , (* all bits ON *)
  157. TextPg0 ,
  158. GrafPg0 ,
  159. GrafPg1 ,
  160. ScrnXmin ,
  161. ScrnYmin ,
  162. cNormal , (* TEXTFACE *)
  163. cBold ,
  164. cItalic ,
  165. cUnderline ,
  166. cStrikeout ,
  167. cMirrorX ,
  168. cMirrorY ,
  169. cProportional ,
  170. alignLeft , (* TEXTALIGN - Horizontal *)
  171. alignCenter ,
  172. alignRight ,
  173. alignBaseline , (* TEXTALIGN - Vertical *)
  174. alignBottom ,
  175. alignMiddle ,
  176. alignTop ,
  177. pathRight , (* TEXTPATH definitions *)
  178. pathUp ,
  179. pathLeft ,
  180. pathDown ,
  181. capFlat , (* PENCAP definitions *)
  182. capRound ,
  183. capSquare ,
  184. joinRound , (* PENJOIN definitions *)
  185. joinBevel ,
  186. joinMiter ,
  187. POINT , (* "Point" structure type
  188. RECORD
  189. X: INTEGER; (* X coordinate *)
  190. Y: INTEGER; (* Y coordinate *)
  191. END;
  192. *)
  193. COLRTABLE, (*= ARRAY[0..15] OF LONGINT; *)
  194. RECT , (* "Rectangle" structure type
  195. RECORD
  196. xMin: INTEGER; (* minimum X *)
  197. yMin: INTEGER; (* minimum Y *)
  198. xMax: INTEGER; (* maximum X *)
  199. yMax: INTEGER; (* maximum Y *)
  200. END;
  201. *)
  202. POLYHEAD , (* Polygon "header" structure
  203. RECORD
  204. polyBgn: CARDINAL; (* beginning index *)
  205. polyEnd: CARDINAL; (* ending index *)
  206. polyRect: RECT; (* boundry limits *)
  207. END;
  208. *)
  209. EVENT , (* Event record structure
  210. RECORD
  211. ASCII: CHAR; (* ASCII character code *)
  212. ScanCode: SYSTEM.BYTE; (* Keyboard scan code *)
  213. State: CARDINAL; (* Keyboard & mouse switches *)
  214. CursorX: INTEGER; (* Cursor X position *)
  215. CursorY: INTEGER; (* Cursor Y position *)
  216. Time: INTEGER; (* System time of event *)
  217. END;
  218. *)
  219. CURRCD , (* Cursor Image definition
  220. RECORD
  221. curWidth: CARDINAL; (* must be 16 *)
  222. curHeight: CARDINAL; (* must be 16 *)
  223. curAlign: CARDINAL; (* must be 0 *)
  224. curRowBytes: CARDINAL; (* must be 2 *)
  225. curBits: CHAR; (* must be 1 *)
  226. curPlanes: CHAR; (* must be 1 *)
  227. curData: ARRAY [1..32] OF SYSTEM.BYTE;(* cursor data bytes *)
  228. END;
  229. *)
  230. PATRCD , (* Pattern Image definition
  231. RECORD
  232. patWidth: CARDINAL; (* must be 8 *)
  233. patHeight: CARDINAL; (* must be 8 *)
  234. patAlign: CARDINAL; (* must be zero *)
  235. patRowBytes: CARDINAL; (* must be equal to patBits *)
  236. patBits: SYSTEM.BYTE; (* value of 1,2,4 or 8 *)
  237. patPlanes: SYSTEM.BYTE; (* value of 1 thru 32 *)
  238. patData: ARRAY [1..32] OF SYSTEM.BYTE; (* pattern data bytes *)
  239. END;
  240. *)
  241. PENSTATE , (* Pen State record structure
  242. RECORD
  243. psBkColor: LONGINT; (* Background color *)
  244. psPnColor: LONGINT; (* Pen color *)
  245. psPnLoc: POINT; (* Pen location *)
  246. psPnSize: POINT; (* Pen size *)
  247. psPnMode: CARDINAL; (* Pen mode (rasterOp) *)
  248. psPnPat: CARDINAL; (* Pen pattern index *)
  249. psPnCap: CARDINAL; (* Pen end-cap style *)
  250. psPnJoin: CARDINAL; (* Line join style *)
  251. psPnDash: CARDINAL; (* Line dash style *)
  252. psPnOffset: CARDINAL;(* Dash starting offset *)
  253. psPnLevel: CARDINAL; (* Pen visibility level *)
  254. END;
  255. *)
  256. DIRREC , (* FILEQUERY - directory record
  257. RECORD
  258. reserved: ARRAY [1..21] OF CHAR; (* (DOS reserved) *)
  259. fileAttr: SYSTEM.BYTE; (* File attribute *)
  260. fileTime: CARDINAL; (* File create time *)
  261. fileDate: CARDINAL; (* File create date *)
  262. fileSize: LONGINT; (* File size (bytes) *)
  263. fileName: ARRAY [1..14] OF CHAR; (* "FILENAME.EXT\0" *)
  264. END;
  265. *)
  266. IMAGEHEADER , (* Image Header record structure
  267. RECORD
  268. imWidth: CARDINAL; (* Pixel width (X) *)
  269. imHeight: CARDINAL; (* Pixel height (Y) *)
  270. imAlign: CARDINAL; (* Image alignment *)
  271. imRowBytes: CARDINAL; (* Bytes per row *)
  272. imBits: SYSTEM.BYTE; (* Bits per pixel *)
  273. imPlanes: SYSTEM.BYTE;(* Planes per pixel *)
  274. (* imData: array [1..?] of byte;
  275. image data, variable length *)
  276. END;
  277. *)
  278. DASHRCD , (* DEFINEDASH data record
  279. RECORD
  280. nCnts: CARDINAL; (* number of active entries, 1-8*)
  281. cnt1: CARDINAL; (* distance ON, 1 *)
  282. cnt2: CARDINAL; (* distance OFF, 2 *)
  283. cnt3: CARDINAL; (* distance ON, 3 *)
  284. cnt4: CARDINAL; (* distance OFF, 4 *)
  285. cnt5: CARDINAL; (* distance ON, 5 *)
  286. cnt6: CARDINAL; (* distance OFF, 6 *)
  287. cnt7: CARDINAL; (* distance ON, 7 *)
  288. cnt8: CARDINAL; (* distance OFF, 8 *)
  289. END;
  290. *)
  291. MAPARRAY , (*ARRAY [0..7] OF CARDINAL;(* CursorMap data record *)
  292. *)
  293. (* Sample User Definable Types: *)
  294. CCBtype , (*
  295. RECORD
  296. (*User Definable Clock_Communication_Block*)
  297. Timer: CARDINAL;
  298. tX: INTEGER;
  299. tY: INTEGER;
  300. tSw: INTEGER;
  301. END;
  302. *)
  303. MCBtype , (*
  304. RECORD
  305. (*User Definable Mouse_Communication_Block*)
  306. mX: INTEGER;
  307. mY: INTEGER;
  308. mSw: INTEGER;
  309. END;
  310. *)
  311. IMAGE , (* SYSTEM.BYTE;
  312. (* "image" type equivalence *)
  313. *)
  314. IMAGEPTR ; (* POINTER TO IMAGE;*)
  315. FROM GrPorts IMPORT
  316. adsMem , (* POINTER TO SYSTEM.BYTE;
  317. *)
  318. MAP , (* RECORD (* "rowTable" Raster Line Pointers *)
  319. rowTable: ARRAY [0..1280] OF adsMem; (* Table of row pointers *)
  320. END;
  321. *)
  322. rowtblPtr , (* POINTER TO MAP;*)
  323. BITMAP , (* "bitmap" Data Structure
  324. RECORD
  325. devClass: INTEGER; (* Device class *)
  326. devType: INTEGER; (* Device type *)
  327. devProcs: adsMem; (* Ptr to device procedure list *)
  328. rowBytes: INTEGER; (* Bytes per scan line *)
  329. pixWidth: INTEGER; (* Pixels horizontal *)
  330. pixHeight: INTEGER; (* Pixels vertical *)
  331. pixResX: INTEGER; (* Pixels per inch horzontally *)
  332. pixResY: INTEGER; (* Pixels per inch vertically *)
  333. pixBits: INTEGER; (* Color bits per pixel *)
  334. pixPlanes: INTEGER; (* Color planes per pixel *)
  335. mapTable: ARRAY [0..23] OF rowtblPtr; (* Pointers to rowTable(s) *)
  336. mapActive: INTEGER; (* Active logical page *)
  337. mapPages: INTEGER; (* Number of mapList entries,1-4 *)
  338. mapList: ARRAY [0..3] OF INTEGER; (* List of logical pages loaded *)
  339. mapRsvd: ARRAY [0..5] OF INTEGER; (* (reserved for future use) *)
  340. mapSegment: CARDINAL;(* Map segment *)
  341. mapHandle: CARDINAL; (* Map handle *)
  342. mapManager: adsMem; (* Pointer to paging manager *)
  343. END;
  344. *)
  345. BITMAPPTR , (* POINTER TO BITMAP;*)
  346. (* Bitmap Device Type (devType) Definitions *)
  347. devSTD , (* Standard memory mapped bitmap *)
  348. devEGA , (* IBM EGA/VGA display bitmap *)
  349. devND1 , (* NDI Genesis-1024 bitmap *)
  350. devND2 , (* NDI Genesis-1280 bitmap *)
  351. devHP1 , (* Hewlett Packard1 *)
  352. devEMS , (* EMS expanded memory bitmap *)
  353. devWYS , (* Wyse 1280x800 display bitmap *)
  354. devSIG , (* Sigma Design Color-400 bitmap *)
  355. devLASVU , (* Sigma Design LaserView/plus *)
  356. devVISTA , (* Cornerstone VISTA 1600 *)
  357. devREV512 , (* Number Nine Revolution 512x484 *)
  358. devDUALPG , (* Cornerstone DualPage System *)
  359. devTSENG , (* Tseng labs Bank Select - STB/GENOA/ORCHID *)
  360. devREV2048 , (* #9 2048x4 Bank manager *)
  361. cDevClass , (* "GetBMapField" index definitions *)
  362. cDevType ,
  363. cRowBytes ,
  364. cPixWidth ,
  365. cPixHeight ,
  366. cPixRsX ,
  367. cPixRsY ,
  368. cPixBits ,
  369. cPixPlanes ,
  370. cMapTable ,
  371. METAPORT , (* "metaPort" Data Structure
  372. RECORD
  373. portBMap: BITMAPPTR; (* Pointer to "bitmap" record *)
  374. portRect: GrConst.RECT; (* 'Local' coordinate port bounds *)
  375. portOrgn: GrConst.POINT; (* 'Global' origin of portRect *)
  376. portVirt: GrConst.RECT; (* 'Virtual' port bounds *)
  377. portFlgs: INTEGER; (* Port Flags *)
  378. portClip: GrConst.RECT; (* 'Local' clipping rectangle *)
  379. portRgn: adsMem; (* (reserved) *)
  380. bkPat: INTEGER; (* Background pattern index *)
  381. bkColor: LONGINT; (* Background color *)
  382. pnColor: LONGINT; (* Pen color *)
  383. pnLoc: GrConst.POINT; (* Pen location *)
  384. pnSize: GrConst.POINT; (* Pen size *)
  385. pnMode: INTEGER; (* Pen mode (rasterOp) *)
  386. pnPat: INTEGER; (* Pen pattern index *)
  387. pnCap: INTEGER; (* Pen end-cap style *)
  388. pnJoin: INTEGER; (* Line join style *)
  389. pnDash: INTEGER; (* Line dash style *)
  390. pnOffset: INTEGER; (* Dash sequence offset *)
  391. pnLevel: INTEGER; (* Pen visibility level *)
  392. txFont: adsMem; (* Pointer to current font record *)
  393. txFace: INTEGER; (* Text facing flags *)
  394. txMode: INTEGER; (* Text mode (rasterOp) *)
  395. txUnder: INTEGER; (* Text underline position *)
  396. txScore: INTEGER; (* Text underline scoring *)
  397. txPath: INTEGER; (* Text path *)
  398. txAlign: GrConst.POINT; (* Text alignment *)
  399. txAngle: INTEGER; (* Text angle (stroked) *)
  400. txSize: GrConst.POINT; (* Text size (stroked) *)
  401. txSlant: INTEGER; (* Text slant (stroked) *)
  402. txExtra: INTEGER; (* Text justify bits *)
  403. txSpace: INTEGER; (* Space justify bits *)
  404. mkType: INTEGER; (* Marker type index *)
  405. mkSize: GrConst.POINT; (* Marker size *)
  406. mkAngle: INTEGER; (* Marker angle *)
  407. spare: ARRAY [1..10] OF INTEGER; (* (spares) *)
  408. END;
  409. *)
  410. METAPORTPTR , (* POINTER TO METAPORT;*)
  411. PUSHAREA , (* PUSHGRAFIX/POPGRAFIX savearea
  412. RECORD
  413. saveArea: ARRAY [1..64] OF CARDINAL;
  414. END;
  415. *)
  416. cportBMap , (* "GetPortField" Index Definitions *)
  417. cportRect ,
  418. cportOrgn ,
  419. cportVirt ,
  420. cportFlgs ,
  421. cportClip ,
  422. cportRgn ,
  423. cbkPat ,
  424. cbkColor ,
  425. cpnColor ,
  426. cpnLoc ,
  427. cpnSize ,
  428. cpnMode ,
  429. cpnPat ,
  430. cpnCap ,
  431. cpnJoin ,
  432. cpnDash ,
  433. cpnOffset ,
  434. cpnLevel ,
  435. ctxFont ,
  436. ctxFace ,
  437. ctxMode ,
  438. ctxUnder ,
  439. ctxScore ,
  440. ctxPath ,
  441. ctxAlign ,
  442. ctxAngle ,
  443. ctxSize ,
  444. ctxSlant ,
  445. ctxExtra ,
  446. ctxSpace ,
  447. cmkType ,
  448. cmkSize ,
  449. cmkAngle ,
  450. cspare ,
  451. cxmin ,
  452. cymin ,
  453. cxmax ,
  454. cymax ,
  455. cX ,
  456. cY ,
  457. cseg ,
  458. coff ;
  459. IMPORT IO,SYSTEM,Lib,Str,FIO;
  460. FROM Storage IMPORT ALLOCATE,DEALLOCATE;
  461. VAR ecran : RECT;
  462. car : CHAR;
  463. aire : PUSHAREA;
  464. i : INTEGER;
  465. carre : RECT;
  466. bouton : RECT;
  467. PROCEDURE GetTime ( VAR Hrs,Mins,Secs,Hsecs : CARDINAL ) ;
  468. VAR
  469. R : SYSTEM.Registers ;
  470. BEGIN
  471. WITH R DO
  472. AH := 2CH ;
  473. Lib.Dos(R) ;
  474. Hrs := CARDINAL(CH) ;
  475. Mins := CARDINAL(CL) ;
  476. Secs := CARDINAL(DH) ;
  477. Hsecs := CARDINAL(DL) ;
  478. END ;
  479. END GetTime ;
  480. PROCEDURE GetDate ( VAR Year,Month,Day : CARDINAL ;
  481. VAR DayOfWeek : BYTE ) ;
  482. VAR
  483. R : SYSTEM.Registers ;
  484. BEGIN
  485. WITH R DO
  486. AH := 2AH ;
  487. Lib.Dos(R) ;
  488. Year := CX ;
  489. Month := CARDINAL(DH) ;
  490. Day := CARDINAL(DL) ;
  491. DayOfWeek := AL ;
  492. END ;
  493. END GetDate ;
  494. TYPE t_bouton = RECORD
  495. rectangle : RECT;
  496. posh,posb : POINT;
  497. contenu : CHAR;
  498. END;
  499. VAR tableau_boutons : ARRAY[1..8] OF t_bouton;
  500. PROCEDURE init_boutons;
  501. VAR i : CARDINAL;
  502. BEGIN
  503. tableau_boutons[1].posh.X := 10;
  504. tableau_boutons[1].posh.Y := 10;
  505. tableau_boutons[1].posb.X := 60;
  506. tableau_boutons[1].posb.Y := 60;
  507. Pt2Rect(tableau_boutons[1].posh, tableau_boutons[1].posb,tableau_boutons[1].rectangle);
  508. (**********************************)
  509. FOR i := 2 TO 8 DO
  510. tableau_boutons[i].posh.X := tableau_boutons[i-1].posh.X ;
  511. tableau_boutons[i].posh.Y := tableau_boutons[i-1].posh.Y + 53;
  512. tableau_boutons[i].posb.X := tableau_boutons[i-1].posb.X;
  513. tableau_boutons[i].posb.Y := tableau_boutons[i-1].posb.Y + 53;
  514. Pt2Rect(tableau_boutons[i].posh, tableau_boutons[i].posb,tableau_boutons[i].rectangle);
  515. END;
  516. END init_boutons;
  517. PROCEDURE dessine_boutons;
  518. VAR i : CARDINAL;
  519. aire : PUSHAREA;
  520. fichier,cal : FIO.File;
  521. tampon : ADDRESS;
  522. ptr_port: METAPORTPTR;
  523. adr_fonte : ADDRESS;
  524. BEGIN
  525. PushGrafix(aire);
  526. GetPort(ptr_port);
  527. adr_fonte := ptr_port^.txFont;
  528. ALLOCATE(tampon,15000);
  529. fichier := FIO.Open("c:\mII\fonte\CAIRO24.fnt");
  530. i := FIO.RdBin(fichier,tampon^,15000);
  531. SetFont(tampon^);
  532. BackColor(3);
  533. BackPattern(0);
  534. FOR i := 1 TO 8 DO
  535. EraseRect(tableau_boutons[i].rectangle) ;
  536. PenColor(0);
  537. PenSize(3,3);
  538. FrameRect(tableau_boutons[i].rectangle);
  539. PenNormal;
  540. PenColor(15);
  541. MoveTo(tableau_boutons[i].posh.X,tableau_boutons[i].posb.Y);
  542. LineTo(tableau_boutons[i].posb.X,tableau_boutons[i].posb.Y);
  543. MoveTo(tableau_boutons[i].posh.X+1,tableau_boutons[i].posb.Y-1);
  544. LineTo(tableau_boutons[i].posb.X,tableau_boutons[i].posb.Y-1);
  545. MoveTo(tableau_boutons[i].posh.X+2,tableau_boutons[i].posb.Y-2);
  546. LineTo(tableau_boutons[i].posb.X,tableau_boutons[i].posb.Y-2);
  547. PenColor(15);
  548. MoveTo(tableau_boutons[i].posb.X-2,tableau_boutons[i].posh.Y+2);
  549. LineTo(tableau_boutons[i].posb.X-2,tableau_boutons[i].posb.Y);
  550. MoveTo(tableau_boutons[i].posb.X-1,tableau_boutons[i].posh.Y+1);
  551. LineTo(tableau_boutons[i].posb.X-1,tableau_boutons[i].posb.Y);
  552. MoveTo(tableau_boutons[i].posb.X,tableau_boutons[i].posh.Y);
  553. LineTo(tableau_boutons[i].posb.X,tableau_boutons[i].posb.Y);
  554. MoveTo(tableau_boutons[i].posh.X+3,tableau_boutons[i].posh.Y + 25 );
  555. DrawChar(CHR(83H));
  556. END;
  557. PopGrafix(aire);
  558. SetFont(adr_fonte^);
  559. END dessine_boutons;
  560. VAR curseur,inter: INTEGER;
  561. pointeur : POINT;
  562. im_calc : RECT;
  563. PROCEDURE horloge;
  564. VAR hor : RECT;
  565. aire: PUSHAREA;
  566. BEGIN
  567. PushGrafix(aire);
  568. SetRect(hor,580,25,620,70);
  569. BackColor(0);
  570. BackPattern(0);
  571. EraseRect(hor);
  572. FrameRect(hor);
  573. ShowCursor;
  574. Lib.Delay(500);
  575. LOOP
  576. QueryCursor(pointeur.X,pointeur.Y,inter,curseur);
  577. IF PtInRect(pointeur,tableau_boutons[2].rectangle) AND (curseur = swLeft) THEN
  578. EXIT
  579. END;
  580. END;
  581. Lib.Delay(100);
  582. HideCursor;
  583. InvertRect(tableau_boutons[2].rectangle);
  584. ShowCursor;
  585. Lib.Delay(50);
  586. HideCursor;
  587. InvertRect(tableau_boutons[2].rectangle);
  588. PopGrafix(aire);
  589. BackPattern(4);
  590. EraseRect(hor);
  591. PenNormal;
  592. END horloge;
  593. PROCEDURE calculatrice;
  594. VAR image_calc : RECT;
  595. aire : PUSHAREA;
  596. tab_boutons: ARRAY[1..22] OF t_bouton;
  597. PROCEDURE dessine_bout;
  598. VAR i : CARDINAL;
  599. BEGIN
  600. FOR i := 1 TO 22 DO
  601. EraseRoundRect(tab_boutons[i].rectangle,3,3);
  602. END;
  603. END dessine_bout;
  604. PROCEDURE dessine;
  605. BEGIN
  606. SetRect(image_calc,100,100,600,400);
  607. BackColor(3);
  608. BackPattern(0);
  609. PenColor(15);
  610. EraseRect(image_calc);
  611. FrameRect(image_calc);
  612. MoveTo(110,402);
  613. PenSize(4,4);
  614. LineTo(602,402);
  615. MoveTo(602,107);
  616. LineTo(602,402);
  617. MoveTo(100,125);
  618. PenNormal;
  619. LineTo(600,125);
  620. MoveTo(300,120);
  621. DrawString("CALCULATRICE");
  622. MoveTo(100,150);
  623. LineTo(600,150);
  624. MoveTo(110,145);
  625. TextMode(1);
  626. TextFace(cBold );
  627. DrawString("Editions Options ");
  628. PenPattern(0);
  629. TextFace(0);
  630. END dessine;
  631. VAR quantite : CARDINAL;
  632. ptr : IMAGEPTR;
  633. cal : FIO.File;
  634. j : CARDINAL;
  635. petitrect,
  636. onoff : RECT;
  637. BEGIN
  638. PushGrafix(aire);
  639. SetRect(im_calc,100,100,610,410);
  640. (* SetRect(petitrect,100,100,200,200);
  641. IF NOT FIO.Exists("c:\m2\call.pic") THEN
  642. dessine;
  643. cal := FIO.Create("c:\m2\call.pic");
  644. quantite := ImagePara(petitrect);
  645. quantite := quantite * 16;
  646. ALLOCATE(ptr,quantite);
  647. ReadImage(petitrect,ptr);
  648. FIO.WrBin(cal,ptr^,quantite);
  649. DEALLOCATE(ptr,quantite);
  650. FIO.Close(cal);
  651. ELSE
  652. cal := FIO.Open("c:\m2\call.pic");
  653. ALLOCATE(ptr,VAL(CARDINAL,FIO.Size(cal)));
  654. j := FIO.RdBin(cal,ptr^,VAL(CARDINAL,FIO.Size(cal)));
  655. WriteImage(petitrect,ptr);
  656. DEALLOCATE(ptr,VAL(CARDINAL,FIO.Size(cal)));
  657. FIO.Close(cal);
  658. END;
  659. *)
  660. dessine;
  661. SetRect(onoff,550,104,578,120);
  662. BackColor(5);
  663. EraseRoundRect(onoff,3,3);
  664. FrameRoundRect(onoff,3,3);
  665. MoveTo(552,115);
  666. i:=SystemFont(16);
  667. DrawString("OFF");
  668. BackColor(0);
  669. ShowCursor;
  670. LOOP
  671. QueryCursor(pointeur.X,pointeur.Y,inter,curseur);
  672. IF PtInRect(pointeur,(*onoff*)tableau_boutons[1].rectangle) AND (curseur = swLeft) THEN
  673. EXIT
  674. END;
  675. END;
  676. HideCursor;
  677. InvertRoundRect(onoff,3,3);
  678. ShowCursor;
  679. Lib.Delay(50);
  680. HideCursor;
  681. InvertRoundRect(onoff,3,3);
  682. PopGrafix(aire);
  683. BackPattern(4);
  684. EraseRect(im_calc);
  685. PenNormal;
  686. END calculatrice;
  687. VAR vois_curseur : MAPARRAY;
  688. BEGIN (* principal *)
  689. InitGrafix(-562);
  690. SetDisplay(GrafPg0);
  691. InitMouse(msCOM1);
  692. ScreenRect(ecran);
  693. LimitMouse(ecran.xMin,ecran.yMin,ecran.xMax,ecran.yMax);
  694. BackPattern(4);
  695. EraseRoundRect(ecran,ecran.xMax DIV 32,ecran.yMax DIV 32);
  696. PenSize(10,8);
  697. FrameRoundRect(ecran,ecran.xMax DIV 32,ecran.yMax DIV 32);
  698. MoveCursor(ecran.xMax DIV 2,ecran.yMax DIV 2);
  699. PenNormal;
  700. CursorMap(vois_curseur);
  701. init_boutons;
  702. dessine_boutons;
  703. ShowCursor;
  704. TrackCursor(TRUE);
  705. LOOP
  706. QueryCursor(pointeur.X,pointeur.Y,inter,curseur);
  707. IF PtInRect(pointeur,tableau_boutons[1].rectangle) AND (curseur = swLeft) THEN
  708. HideCursor;
  709. InvertRect(tableau_boutons[1].rectangle);
  710. ShowCursor;
  711. Lib.Delay(50);
  712. HideCursor;
  713. InvertRect(tableau_boutons[1].rectangle);
  714. calculatrice;
  715. ShowCursor;
  716. END;
  717. IF PtInRect(pointeur,tableau_boutons[2].rectangle) AND (curseur = swLeft) THEN
  718. HideCursor;
  719. InvertRect(tableau_boutons[2].rectangle);
  720. ShowCursor;
  721. Lib.Delay(50);
  722. HideCursor;
  723. InvertRect(tableau_boutons[2].rectangle);
  724. horloge;
  725. ShowCursor;
  726. END;
  727. IF PtInRect(pointeur,tableau_boutons[3].rectangle) AND (curseur = swLeft) THEN
  728. HideCursor;
  729. InvertRect(tableau_boutons[3].rectangle);
  730. ShowCursor;
  731. Lib.Delay(50);
  732. HideCursor;
  733. InvertRect(tableau_boutons[3].rectangle);
  734. 2 calculatrice;
  735. ShowCursor;
  736. END;
  737. IF PtInRect(pointeur,tableau_boutons[4].rectangle) AND (curseur = swLeft) THEN
  738. HideCursor;
  739. InvertRect(tableau_boutons[4].rectangle);
  740. ShowCursor;
  741. Lib.Delay(50);
  742. HideCursor;
  743. InvertRect(tableau_boutons[4].rectangle);
  744. calculatrice;
  745. ShowCursor;
  746. END;
  747. IF PtInRect(pointeur,tableau_boutons[5].rectangle) AND (curseur = swLeft) THEN
  748. HideCursor;
  749. InvertRect(tableau_boutons[5].rectangle);
  750. ShowCursor;
  751. Lib.Delay(50);
  752. HideCursor;
  753. InvertRect(tableau_boutons[5].rectangle);
  754. calculatrice;
  755. ShowCursor;
  756. END;
  757. IF PtInRect(pointeur,tableau_boutons[6].rectangle) AND (curseur = swLeft) THEN
  758. HideCursor;
  759. InvertRect(tableau_boutons[6].rectangle);
  760. ShowCursor;
  761. Lib.Delay(50);
  762. HideCursor;
  763. InvertRect(tableau_boutons[6].rectangle);
  764. calculatrice;
  765. ShowCursor;
  766. END;
  767. IF PtInRect(pointeur,tableau_boutons[7].rectangle) AND (curseur = swLeft) THEN
  768. HideCursor;
  769. InvertRect(tableau_boutons[7].rectangle);
  770. ShowCursor;
  771. Lib.Delay(50);
  772. HideCursor;
  773. InvertRect(tableau_boutons[7].rectangle);
  774. ShowCursor;
  775. calculatrice;
  776. END;
  777. IF PtInRect(pointeur,tableau_boutons[8].rectangle) AND (curseur = swLeft) THEN
  778. HideCursor;
  779. InvertRect(tableau_boutons[8].rectangle);
  780. ShowCursor;
  781. Lib.Delay(50);
  782. HideCursor;
  783. InvertRect(tableau_boutons[8].rectangle);
  784. calculatrice;
  785. ShowCursor;
  786. END;
  787. IF curseur = swRight THEN EXIT END;
  788. END;
  789. TrackCursor(FALSE);
  790. StopMouse;
  791. SetDisplay(TextPg0);
  792. ClearText;
  793. END mac.
  794.