home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / gfx / misc / cloudsaga / source / cloudsgui.mod < prev    next >
Encoding:
Text File  |  1994-07-18  |  27.5 KB  |  639 lines

  1. MODULE CloudsGUI;
  2.  
  3. (*
  4.  *  Source generated with GadToolsBox V2.0b
  5.  *  which is (c) Copyright 1991-1993 Jaba Development
  6.  *  Oberon-Sourcecode-Generator by Kai Bolay (AMOK)
  7.  *
  8.  *  GUI Designed by : Danny Amor
  9.  *)
  10.  
  11. (* $OvflChk- $RangeChk- $StackChk- $NilChk- $ReturnChk- $CaseChk- $TypeChk- *)
  12.  
  13. IMPORT
  14.  e: Exec, I: Intuition, gt: GadTools, g: Graphics, u: Utility, y: SYSTEM, a: ASL, req: Requests, No;
  15.  
  16. CONST
  17.   GDSize                            * = 0;
  18.   GDCreate                          * = 1;
  19.   GDAnimate                         * = 2;
  20.   GDSmooth                          * = 3;
  21.   GDSave                            * = 4;
  22.   GDScreen                          * = 5;
  23.  
  24. CONST
  25.   CloudsCNT = 6;
  26.   CloudsLeft = 106;
  27.   CloudsTop = 20;
  28.   CloudsWidth = 106;
  29.   CloudsHeight = 103;
  30.  
  31. CONST
  32.   GDGadget00                        * = 0;
  33.  
  34. CONST
  35.   InfoReqCNT = 1;
  36.   InfoReqLeft = 112;
  37.   InfoReqTop = 105;
  38.   InfoReqWidth = 358;
  39.   InfoReqHeight = 133;
  40.  
  41. VAR
  42.   Scr*: I.ScreenPtr;
  43.   VisualInfo*: e.APTR;
  44.   CloudsWnd*: I.WindowPtr;
  45.   InfoReqWnd*: I.WindowPtr;
  46.   CloudsGList*: I.GadgetPtr;
  47.   CloudsGadgets*: ARRAY CloudsCNT OF I.GadgetPtr;
  48.   InfoReqGList*: I.GadgetPtr;
  49.   InfoReqGadgets*: ARRAY InfoReqCNT OF I.GadgetPtr;
  50.   Font*: g.TextAttrPtr;
  51.   Attr*: g.TextAttr;
  52.   FontX, FontY*: INTEGER;
  53.   OffX, OffY: INTEGER;
  54.   Menu*: I.MenuPtr;
  55.   im: I.Image;
  56.  
  57. TYPE
  58.   Size0LArray = ARRAY     7 OF e.STRPTR;
  59. CONST
  60.   Size0Labels = Size0LArray (
  61.     y.ADR ("25"),
  62.     y.ADR ("50"),
  63.     y.ADR ("75"),
  64.     y.ADR ("100"),
  65.     y.ADR ("200"),
  66.     y.ADR ("400"),
  67.     NIL );
  68.  
  69. TYPE
  70.   CloudsGTypesArray = ARRAY CloudsCNT OF INTEGER;
  71. CONST
  72.   CloudsGTypes = CloudsGTypesArray (
  73.     gt.cycleKind,
  74.     gt.buttonKind,
  75.     gt.buttonKind,
  76.     gt.buttonKind,
  77.     gt.buttonKind,
  78.     gt.buttonKind
  79.   );
  80.  
  81. TYPE
  82.   CloudsNGadArray = ARRAY CloudsCNT OF gt.NewGadget;
  83. CONST
  84.   CloudsNGad = CloudsNGadArray (
  85.     43, 2, 59, 15, y.ADR ("Si_ze"), NIL, GDSize, LONGSET {gt.placeTextLeft} ,NIL, NIL,
  86.     3, 19, 99, 15, y.ADR ("_Create"), NIL, GDCreate, LONGSET {gt.placeTextIn} ,NIL, NIL,
  87.     3, 35, 99, 15, y.ADR ("_Palette"), NIL, GDAnimate, LONGSET {gt.placeTextIn} ,NIL, NIL,
  88.     3, 51, 99, 15, y.ADR ("S_mooth"), NIL, GDSmooth, LONGSET {gt.placeTextIn} ,NIL, NIL,
  89.     3, 67, 99, 15, y.ADR ("_Save"), NIL, GDSave, LONGSET {gt.placeTextIn} ,NIL, NIL,
  90.     3, 83, 99, 15, y.ADR ("Sc_reen"), NIL, GDScreen, LONGSET {gt.placeTextIn} ,NIL, NIL
  91.   );
  92.  
  93. TYPE
  94.   CloudsGTagsArray = ARRAY    20 OF u.Tag;
  95. CONST
  96.   CloudsGTags * = CloudsGTagsArray (
  97.     gt.underscore, ORD ('_'), gt.cyLabels, y.ADR (Size0Labels[0]), u.done,
  98.     gt.underscore, ORD ('_'), u.done,
  99.     gt.underscore, ORD ('_'), u.done,
  100.     gt.underscore, ORD ('_'), u.done,
  101.     gt.underscore, ORD ('_'), u.done,
  102.     gt.underscore, ORD ('_'), u.done
  103.   );
  104.  
  105. TYPE
  106.   DriPenArray = ARRAY     1 OF INTEGER;
  107.  
  108. CONST
  109.   DriPens = DriPenArray (-1);
  110.  
  111. TYPE colourstype32  = ARRAY 86  OF LONGINT;
  112.      colourstype64  = ARRAY 182 OF LONGINT;
  113.      colourstype128 = ARRAY 386 OF LONGINT;
  114.  
  115. CONST
  116.      colours32 = colourstype32(1C0004H,000000000H,000000000H,0FF000000H, 000000000H,010000000H,0FF000000H,
  117.                                      000000000H,020000000H,0FF000000H, 000000000H,030000000H,0FF000000H,
  118.                                      000000000H,040000000H,0FF000000H, 000000000H,050000000H,0FF000000H,
  119.                                      000000000H,060000000H,0FF000000H, 000000000H,070000000H,0FF000000H,
  120.                                      010000000H,080000000H,0FF000000H, 020000000H,08A000000H,0FF000000H,
  121.                                      030000000H,090000000H,0FF000000H, 040000000H,09A000000H,0FF000000H,
  122.                                      050000000H,0A0000000H,0FF000000H, 060000000H,0AA000000H,0FF000000H,
  123.                                      070000000H,0B0000000H,0FF000000H, 080000000H,0BA000000H,0FF000000H,
  124.                                      090000000H,0C0000000H,0FF000000H, 0A0000000H,0CA000000H,0FF000000H,
  125.                                      0B0000000H,0D0000000H,0FF000000H, 0C0000000H,0DA000000H,0FF000000H,
  126.                                      0D0000000H,0E0000000H,0FF000000H, 0E0000000H,0EA000000H,0FF000000H,
  127.                                      0F0000000H,0F0000000H,0FF000000H, 0E0000000H,0E0000000H,0EF000000H,
  128.                                      0D0000000H,0D0000000H,0DF000000H, 0C0000000H,0C0000000H,0CF000000H,
  129.                                      0B0000000H,0B0000000H,0BF000000H, 0A0000000H,0A0000000H,0AF000000H,0);
  130.      colours64 = colourstype64(3C0004H,000000000H,000000000H,0FF000000H, 000000000H,008000000H,0FF000000H,
  131.                                      000000000H,010000000H,0FF000000H, 000000000H,018000000H,0FF000000H,
  132.                                      000000000H,020000000H,0FF000000H, 000000000H,028000000H,0FF000000H,
  133.                                      000000000H,030000000H,0FF000000H, 000000000H,038000000H,0FF000000H,
  134.                                      000000000H,040000000H,0FF000000H, 000000000H,048000000H,0FF000000H,
  135.                                      000000000H,050000000H,0FF000000H, 000000000H,058000000H,0FF000000H,
  136.                                      000000000H,060000000H,0FF000000H, 000000000H,068000000H,0FF000000H,
  137.                                      000000000H,070000000H,0FF000000H, 000000000H,078000000H,0FF000000H,
  138.                                      010000000H,080000000H,0FF000000H, 018000000H,088000000H,0FF000000H,
  139.                                      020000000H,08A000000H,0FF000000H, 028000000H,08C000000H,0FF000000H,
  140.                                      030000000H,090000000H,0FF000000H, 038000000H,098000000H,0FF000000H,
  141.                                      040000000H,09A000000H,0FF000000H, 048000000H,09C000000H,0FF000000H,
  142.                                      050000000H,0A0000000H,0FF000000H, 058000000H,0A8000000H,0FF000000H,
  143.                                      060000000H,0AA000000H,0FF000000H, 068000000H,0AC000000H,0FF000000H,
  144.                                      070000000H,0B0000000H,0FF000000H, 078000000H,0B8000000H,0FF000000H,
  145.                                      080000000H,0BA000000H,0FF000000H, 088000000H,0BC000000H,0FF000000H,
  146.                                      090000000H,0C0000000H,0FF000000H, 098000000H,0C8000000H,0FF000000H,
  147.                                      0A0000000H,0CA000000H,0FF000000H, 0A8000000H,0CC000000H,0FF000000H,
  148.                                      0B0000000H,0D0000000H,0FF000000H, 0B8000000H,0D8000000H,0FF000000H,
  149.                                      0C0000000H,0DA000000H,0FF000000H, 0C8000000H,0DC000000H,0FF000000H,
  150.                                      0D0000000H,0E0000000H,0FF000000H, 0D8000000H,0E8000000H,0FF000000H,
  151.                                      0E0000000H,0EA000000H,0FF000000H, 0E8000000H,0EC000000H,0FF000000H,
  152.                                      0F0000000H,0F0000000H,0FF000000H, 0F8000000H,0F8000000H,0FF000000H,
  153.                                      0E8000000H,0E0000000H,0EF000000H, 0E0000000H,0E8000000H,0EF000000H,
  154.                                      0D8000000H,0D0000000H,0DF000000H, 0D0000000H,0D8000000H,0DF000000H,
  155.                                      0C8000000H,0C0000000H,0CF000000H, 0C0000000H,0C8000000H,0CF000000H,
  156.                                      0B8000000H,0B0000000H,0BF000000H, 0B0000000H,0B8000000H,0BF000000H,
  157.                                      0A8000000H,0A0000000H,0AF000000H, 0A0000000H,0A8000000H,0AF000000H,
  158.                                      09F000000H,09F000000H,09F000000H, 09A000000H,09A000000H,09A000000H,
  159.                                      098000000H,098000000H,098000000H, 094000000H,094000000H,094000000H,0);
  160.    colours128 = colourstype128(7C0004H,000000000H,000000000H,0FF000000H, 000000000H,004000000H,0FF000000H,
  161.                                      000000000H,008000000H,0FF000000H, 000000000H,00B000000H,0FF000000H,
  162.                                      000000000H,010000000H,0FF000000H, 000000000H,014000000H,0FF000000H,
  163.                                      000000000H,018000000H,0FF000000H, 000000000H,01B000000H,0FF000000H,
  164.                                      000000000H,020000000H,0FF000000H, 000000000H,024000000H,0FF000000H,
  165.                                      000000000H,028000000H,0FF000000H, 000000000H,02B000000H,0FF000000H,
  166.                                      000000000H,030000000H,0FF000000H, 000000000H,034000000H,0FF000000H,
  167.                                      000000000H,038000000H,0FF000000H, 000000000H,03B000000H,0FF000000H,
  168.                                      000000000H,040000000H,0FF000000H, 000000000H,044000000H,0FF000000H,
  169.                                      000000000H,048000000H,0FF000000H, 000000000H,04B000000H,0FF000000H,
  170.                                      000000000H,050000000H,0FF000000H, 000000000H,054000000H,0FF000000H,
  171.                                      000000000H,058000000H,0FF000000H, 000000000H,05B000000H,0FF000000H,
  172.                                      000000000H,060000000H,0FF000000H, 000000000H,064000000H,0FF000000H,
  173.                                      000000000H,068000000H,0FF000000H, 000000000H,06B000000H,0FF000000H,
  174.                                      000000000H,070000000H,0FF000000H, 000000000H,074000000H,0FF000000H,
  175.                                      000000000H,078000000H,0FF000000H, 000000000H,07B000000H,0FF000000H,
  176.                                      010000000H,080000000H,0FF000000H, 014000000H,084000000H,0FF000000H,
  177.                                      016000000H,088000000H,0FF000000H, 018000000H,08B000000H,0FF000000H,
  178.                                      020000000H,08A000000H,0FF000000H, 024000000H,08B000000H,0FF000000H,
  179.                                      026000000H,08C000000H,0FF000000H, 028000000H,08D000000H,0FF000000H,
  180.                                      030000000H,090000000H,0FF000000H, 034000000H,094000000H,0FF000000H,
  181.                                      036000000H,098000000H,0FF000000H, 038000000H,09B000000H,0FF000000H,
  182.                                      040000000H,09A000000H,0FF000000H, 044000000H,09B000000H,0FF000000H,
  183.                                      046000000H,09C000000H,0FF000000H, 048000000H,09D000000H,0FF000000H,
  184.                                      050000000H,0A0000000H,0FF000000H, 054000000H,0A4000000H,0FF000000H,
  185.                                      056000000H,0A8000000H,0FF000000H, 058000000H,0AB000000H,0FF000000H,
  186.                                      060000000H,0AA000000H,0FF000000H, 064000000H,0AB000000H,0FF000000H,
  187.                                      066000000H,0AC000000H,0FF000000H, 068000000H,0AD000000H,0FF000000H,
  188.                                      070000000H,0B0000000H,0FF000000H, 074000000H,0B4000000H,0FF000000H,
  189.                                      076000000H,0B8000000H,0FF000000H, 078000000H,0BB000000H,0FF000000H,
  190.                                      080000000H,0BA000000H,0FF000000H, 084000000H,0BB000000H,0FF000000H,
  191.                                      088000000H,0BC000000H,0FF000000H, 08B000000H,0BD000000H,0FF000000H,
  192.                                      090000000H,0C0000000H,0FF000000H, 098000000H,0C8000000H,0FF000000H,
  193.                                      0A0000000H,0CA000000H,0FF000000H, 0A8000000H,0CC000000H,0FF000000H,
  194.                                      0B0000000H,0D0000000H,0FF000000H, 0B8000000H,0D8000000H,0FF000000H,
  195.                                      0C0000000H,0DA000000H,0FF000000H, 0C8000000H,0DC000000H,0FF000000H,
  196.                                      0D0000000H,0E0000000H,0FF000000H, 0D8000000H,0E8000000H,0FF000000H,
  197.                                      0E0000000H,0EA000000H,0FF000000H, 0E8000000H,0EC000000H,0FF000000H,
  198.                                      0F0000000H,0F0000000H,0FF000000H, 0F8000000H,0F8000000H,0FF000000H,
  199.                                      0E8000000H,0E0000000H,0EF000000H, 0E0000000H,0E8000000H,0EF000000H,
  200.                                      0D8000000H,0D0000000H,0DF000000H, 0D0000000H,0D8000000H,0DF000000H,
  201.                                      0C8000000H,0C0000000H,0CF000000H, 0C0000000H,0C8000000H,0CF000000H,
  202.                                      0B8000000H,0B0000000H,0BF000000H, 0B0000000H,0B8000000H,0BF000000H,
  203.                                      0A8000000H,0A0000000H,0AF000000H, 0A0000000H,0A8000000H,0AF000000H,
  204.                                      09F000000H,09F000000H,09F000000H, 09A000000H,09A000000H,09A000000H,
  205.                                      098000000H,098000000H,098000000H, 094000000H,094000000H,094000000H,
  206.                                      0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0,
  207.                                      0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0,
  208.                                      0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0,
  209.                                      0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0,
  210.                                      0);
  211.  
  212.  
  213. TYPE
  214.   MenuArray = ARRAY     5 OF gt.NewMenu;
  215. CONST
  216.   NewMenu = MenuArray (
  217.     gt.title, y.ADR ("Project"), NIL, {}, y.VAL (LONGSET, 0), NIL,
  218.     gt.item, y.ADR ("About..."), y.ADR ("A"), {}, y.VAL (LONGSET, 0), NIL,
  219.     gt.item, gt.barLabel, NIL, {}, LONGSET {}, NIL,
  220.     gt.item, y.ADR ("Quit..."), y.ADR ("Q"), {}, y.VAL (LONGSET, 0), NIL,
  221.     gt.end, NIL, NIL, {}, LONGSET {}, NIL);
  222.  
  223. VAR
  224.   InfoReqIText: ARRAY 7 OF I.IntuiText;
  225. TYPE
  226.   InfoReqGTypesArray = ARRAY InfoReqCNT OF INTEGER;
  227. CONST
  228.   InfoReqGTypes = InfoReqGTypesArray (
  229.     gt.buttonKind
  230.   );
  231.  
  232. TYPE
  233.   InfoReqNGadArray = ARRAY InfoReqCNT OF gt.NewGadget;
  234. CONST
  235.   InfoReqNGad = InfoReqNGadArray (
  236.     133, 114, 91, 14, y.ADR ("_Ok"), NIL, GDGadget00, LONGSET {gt.placeTextIn} ,NIL, NIL
  237.   );
  238.  
  239. TYPE
  240.   InfoReqGTagsArray = ARRAY     3 OF u.Tag;
  241. CONST
  242.   InfoReqGTags = InfoReqGTagsArray (
  243.     gt.underscore, ORD ('_'), u.done
  244.   );
  245.  
  246. PROCEDURE ComputeX (value: INTEGER): INTEGER;
  247. BEGIN
  248.   RETURN ((FontX * value) + 4 ) DIV 8;
  249. END ComputeX;
  250.  
  251. PROCEDURE ComputeY (value: INTEGER): INTEGER;
  252. BEGIN
  253.   RETURN ((FontY * value)  + 4 ) DIV 8;
  254. END ComputeY;
  255.  
  256. PROCEDURE ComputeFont (width, height: INTEGER; VAR Scr: I.ScreenPtr);
  257. BEGIN
  258.   Font := y. ADR (Attr);
  259.   Font^.name := Scr^.rastPort.font^.message.node.name;
  260.   FontY := Scr^.rastPort.font^.ySize;
  261.   Font^.ySize := FontY;
  262.   FontX := Scr^.rastPort.font^.xSize;
  263.  
  264.   OffX := Scr^.wBorLeft;
  265.   OffY := Scr^.rastPort.txHeight + Scr^.wBorTop + 1;
  266.  
  267.   IF (width # 0) AND (height # 0) AND
  268.      (ComputeX (width) + OffX + Scr^.wBorRight > Scr^.width) OR
  269.      (ComputeY (height) + OffY + Scr^.wBorBottom > Scr^.height) THEN
  270.     Font^.name := y.ADR ("topaz.font");
  271.     Font^.ySize := 8;
  272.     FontY := Font^.ySize;
  273.     FontX := Font^.ySize;
  274.   END;
  275. END ComputeFont;
  276.  
  277. PROCEDURE SetupScreen*(VAR depth,resx,resy: LONGINT): INTEGER;
  278.  
  279. VAR Req                : UNTRACED POINTER TO a.ScreenModeRequester;
  280.     DisplayID          : LONGINT;
  281.     Ok                 : BOOLEAN;
  282.     colours            : e.APTR;
  283.  
  284. BEGIN
  285.   IF a.asl.version>37 THEN
  286.     IF a.asl#NIL THEN
  287.       Req := a.AllocAslRequestTags(a.screenModeRequest,
  288.                                    a.doOverscanType,1,
  289.                                    a.doAutoScroll,1,
  290.                                    a.doHeight,1,
  291.                                    a.doWidth,1,
  292.                                    a.doDepth,1,
  293.                                    a.initialDisplayID,g.euro72ProductKey,
  294.                                    a.initialDisplayWidth,656,
  295.                                    a.initialDisplayHeight,414,
  296.                                    a.initialDisplayDepth,depth,
  297.                                    a.smMinDepth,5,
  298.                                    a.smMaxDepth,7,
  299.                                    u.done);
  300.       IF Req#NIL THEN
  301.         Ok:=a.AslRequest(Req,NIL);
  302.         IF Ok THEN
  303.           DisplayID := Req^.displayID;
  304.           resx      := Req^.displayWidth;
  305.           resy      := Req^.displayHeight;
  306.           depth     := Req^.displayDepth;
  307.           IF g.base.libNode.version>38 THEN
  308.             IF depth=5 THEN colours := y.ADR(colours32);  END;
  309.             IF depth=6 THEN colours := y.ADR(colours64);  END;
  310.             IF depth=7 THEN colours := y.ADR(colours128); END;
  311.           ELSE
  312.             colours := NIL;
  313.           END;
  314.  
  315.           Scr := I.OpenScreenTagsA (NIL, I.saLeft,          0,
  316.                                          I.saTop,           0,
  317.                                          I.saWidth,         resx,
  318.                                          I.saHeight,        resy,
  319.                                          I.saDepth,         depth,
  320.                                          I.saType,          LONGSET{0..3},
  321.                                          I.saDisplayID,     DisplayID,
  322.                                          I.saAutoScroll,    I.LTRUE,
  323.                                          I.saColors32,      colours,
  324.                                          I.saOverscan,      I.oScanText,
  325.                                          I.saPens,          y.ADR (DriPens[0]),
  326.                                          I.saTitle,         y.ADR ("CloudsAGA 1.15 © Danny Amor in 1994"),
  327.                                     u.done);
  328.           IF Scr = NIL THEN RETURN 1 END;
  329.  
  330.           ComputeFont (0, 0, Scr);
  331.  
  332.           VisualInfo := gt.GetVisualInfo (Scr, u.done);
  333.           IF VisualInfo = NIL THEN RETURN 2 END;
  334.         ELSE RETURN 5 END;
  335.       END;
  336.     END;
  337.   ELSE
  338.     IF g.base.libNode.version>36 THEN
  339.       Ok:=req.Request("Clouds Request:","You only have Workbench 2.0!\nYou can only choose between high\nand low resolution!","High","Low");
  340.       depth:=5;
  341.       resx:=320;
  342.       resy:=256;
  343.       DisplayID:=g.loresKey+g.palMonitorID;
  344.       IF Ok THEN resy:=512; DisplayID:=g.loresLaceKey+g.palMonitorID; END;
  345.       Scr := I.OpenScreenTagsA (NIL, I.saLeft,          0,
  346.                                      I.saTop,           0,
  347.                                      I.saWidth,         resx,
  348.                                      I.saHeight,        resy,
  349.                                      I.saDepth,         depth,
  350.                                      I.saType,          LONGSET{0..3},
  351.                                      I.saDisplayID,     DisplayID,
  352.                                      I.saAutoScroll,    I.LTRUE,
  353.                                      I.saPens,          y.ADR (DriPens[0]),
  354.                                      I.saTitle,         y.ADR ("CloudsAGA 1.15 © Danny Amor in 1994"),
  355.                                      u.done);
  356.           IF Scr = NIL THEN RETURN 1 END;
  357.  
  358.           ComputeFont (0, 0, Scr);
  359.  
  360.           VisualInfo := gt.GetVisualInfo (Scr, u.done);
  361.           IF VisualInfo = NIL THEN RETURN 2 END;
  362.     ELSE
  363.       req.Fail("Sorry, you need Amiga-OS 2.0 or higher!");
  364.     END;
  365.   END;
  366.   RETURN 0;
  367. END SetupScreen;
  368.  
  369. PROCEDURE CloseDownScreen* (VAR scr : I.ScreenPtr);
  370. BEGIN
  371.   IF VisualInfo # NIL THEN
  372.     gt.FreeVisualInfo (VisualInfo);
  373.     VisualInfo := NIL;
  374.   END;
  375.   IF Scr # NIL THEN
  376.     IF I.CloseScreen (Scr) THEN END;
  377.     Scr := NIL;
  378.   END;
  379. END CloseDownScreen;
  380.  
  381. PROCEDURE OpenCloudsWindow* (VAR CloudsWnd: I.WindowPtr; VAR Scr: I.ScreenPtr): INTEGER;
  382.  
  383.  
  384. VAR
  385.   ng: gt.NewGadget;
  386.   gad: I.GadgetPtr;
  387.   help: u.TagListPtr;
  388.   lc, tc, lvc, offx, offy: INTEGER;
  389.   wleft, wtop: INTEGER;
  390.  
  391. BEGIN
  392.   wleft := CloudsLeft; wtop := CloudsTop;
  393.  
  394.   ComputeFont (CloudsWidth, CloudsHeight,Scr);
  395.  
  396.   wleft := Scr^.width - ComputeX(CloudsWidth);
  397.   wtop := OffY;
  398.  
  399.   Menu := gt.CreateMenus (NewMenu, gt.mnNewLookMenus, 1,u.done);
  400.   IF Menu = NIL THEN RETURN 3 END;
  401.  
  402.   IF NOT gt.LayoutMenus (Menu, VisualInfo, gt.mnTextAttr, Font, u.done) THEN RETURN 4 END;
  403.  
  404.   gad := gt.CreateContext (CloudsGList);
  405.   IF gad = NIL THEN RETURN 1 END;
  406.  
  407.   lc := 0; tc := 0; lvc := 0;
  408.  
  409.   WHILE lc < CloudsCNT DO
  410.     ng := CloudsNGad[lc];
  411.     ng.visualInfo := VisualInfo;
  412.     ng.textAttr   := Font;
  413.     ng.leftEdge   := OffX + ComputeX (ng.leftEdge);
  414.     ng.topEdge    := OffY + ComputeY (ng.topEdge);
  415.     ng.width      := ComputeX (ng.width);
  416.     ng.height     := ComputeY (ng.height);
  417.  
  418.     help := u.CloneTagItems (y.VAL (u.TagListPtr, y.ADR (CloudsGTags[tc])));
  419.     IF help = NIL THEN RETURN 8 END;
  420.     gad := gt.CreateGadgetA (CloudsGTypes[lc], gad, ng, help^ );
  421.     IF gad = NIL THEN RETURN 2 END;
  422.     u.FreeTagItems (help);
  423.     CloudsGadgets[lc] := gad;
  424.  
  425.     WHILE CloudsGTags[tc] # u.done DO INC (tc, 2) END;
  426.     INC (tc);
  427.  
  428.     lc:=lc+1; (* INC (lc); *)
  429.   END; (* WHILE *)
  430.  
  431.   CloudsWnd := I.OpenWindowTagsA ( NIL,
  432.                     I.waLeft,          wleft,
  433.                     I.waTop,           wtop,
  434.                     I.waWidth,         ComputeX(CloudsWidth) + OffX + Scr^.wBorRight,
  435.                     I.waHeight,        ComputeY(CloudsHeight) + OffY + Scr^.wBorBottom,
  436.                     I.waIDCMP,         gt.cycleIDCMP+gt.buttonIDCMP+LONGSET {I.closeWindow,I.refreshWindow,I.vanillaKey,I.menuPick},
  437.                     I.waFlags,         LONGSET {I.windowDrag,I.windowDepth,I.windowClose,I.activate,I.newLookMenus},
  438.                     I.waGadgets,       CloudsGList,
  439.                     I.waTitle,         y.ADR ("Clouds"),
  440.                     I.waScreenTitle,   y.ADR ("CloudsAGA 1.15 © Danny Amor in 1994"),
  441.                     I.waCustomScreen,  Scr,
  442.                     u.done);
  443.  
  444.   IF CloudsWnd = NIL THEN RETURN 20 END;
  445.  
  446.   IF NOT I.SetMenuStrip (CloudsWnd, Menu^) THEN RETURN 5 END;
  447.   gt.RefreshWindow (CloudsWnd, NIL);
  448.  
  449.   RETURN 0;
  450.  
  451. END OpenCloudsWindow;
  452.  
  453. PROCEDURE CloseCloudsWindow* (VAR CloudsWnd: I.WindowPtr);
  454. BEGIN
  455.   IF Menu # NIL THEN
  456.     IF CloudsWnd # NIL THEN
  457.       I.ClearMenuStrip (CloudsWnd);
  458.     END;
  459.     gt.FreeMenus(Menu);
  460.     Menu := NIL;
  461.   END;
  462.   IF CloudsWnd # NIL THEN
  463.     I.CloseWindow (CloudsWnd);
  464.     CloudsWnd := NIL;
  465.   END;
  466.   IF CloudsGList # NIL THEN
  467.     gt.FreeGadgets (CloudsGList);
  468.     CloudsGList := NIL;
  469.   END;
  470. END CloseCloudsWindow;
  471.  
  472. PROCEDURE InfoReqRender*;
  473. BEGIN
  474.   InfoReqIText[0].iText     := y.ADR ("Clouds 1.15");
  475.   InfoReqIText[0].iTextFont := Font;
  476.   InfoReqIText[0].frontPen  := 2;
  477.   InfoReqIText[0].backPen   := 0;
  478.   InfoReqIText[0].drawMode  := g.jam1+SHORTSET {};
  479.   InfoReqIText[0].leftEdge  := OffX + ComputeX (178) - (I.IntuiTextLength (InfoReqIText[0]) DIV 2);
  480.   InfoReqIText[0].topEdge   := OffY + ComputeY (10) - (Font^.ySize DIV 2);
  481.   InfoReqIText[0].nextText  := y.ADR (InfoReqIText[1]);
  482.  
  483.   InfoReqIText[1].iText     := y.ADR ("written by Danny Amor in 1994");
  484.   InfoReqIText[1].iTextFont := Font;
  485.   InfoReqIText[1].frontPen  := 1;
  486.   InfoReqIText[1].backPen   := 0;
  487.   InfoReqIText[1].drawMode  := g.jam1+SHORTSET {};
  488.   InfoReqIText[1].leftEdge  := OffX + ComputeX (178) - (I.IntuiTextLength (InfoReqIText[1]) DIV 2);
  489.   InfoReqIText[1].topEdge   := OffY + ComputeY (22) - (Font^.ySize DIV 2);
  490.   InfoReqIText[1].nextText  := y.ADR (InfoReqIText[2]);
  491.  
  492.   InfoReqIText[2].iText     := y.ADR ("Danny Amor");
  493.   InfoReqIText[2].iTextFont := Font;
  494.   InfoReqIText[2].frontPen  := 1;
  495.   InfoReqIText[2].backPen   := 0;
  496.   InfoReqIText[2].drawMode  := g.jam1+SHORTSET {};
  497.   InfoReqIText[2].leftEdge  := OffX + ComputeX (181) - (I.IntuiTextLength (InfoReqIText[2]) DIV 2);
  498.   InfoReqIText[2].topEdge   := OffY + ComputeY (49) - (Font^.ySize DIV 2);
  499.   InfoReqIText[2].nextText  := y.ADR (InfoReqIText[3]);
  500.  
  501.   InfoReqIText[3].iText     := y.ADR ("Ludwigstr. 124");
  502.   InfoReqIText[3].iTextFont := Font;
  503.   InfoReqIText[3].frontPen  := 1;
  504.   InfoReqIText[3].backPen   := 0;
  505.   InfoReqIText[3].drawMode  := g.jam1+SHORTSET {};
  506.   InfoReqIText[3].leftEdge  := OffX + ComputeX (182) - (I.IntuiTextLength (InfoReqIText[3]) DIV 2);
  507.   InfoReqIText[3].topEdge   := OffY + ComputeY (59) - (Font^.ySize DIV 2);
  508.   InfoReqIText[3].nextText  := y.ADR (InfoReqIText[4]);
  509.  
  510.   InfoReqIText[4].iText     := y.ADR ("70197 Stuttgart");
  511.   InfoReqIText[4].iTextFont := Font;
  512.   InfoReqIText[4].frontPen  := 1;
  513.   InfoReqIText[4].backPen   := 0;
  514.   InfoReqIText[4].drawMode  := g.jam1+SHORTSET {};
  515.   InfoReqIText[4].leftEdge  := OffX + ComputeX (182) - (I.IntuiTextLength (InfoReqIText[4]) DIV 2);
  516.   InfoReqIText[4].topEdge   := OffY + ComputeY (69) - (Font^.ySize DIV 2);
  517.   InfoReqIText[4].nextText  := y.ADR (InfoReqIText[5]);
  518.  
  519.   InfoReqIText[5].iText     := y.ADR ("Germany");
  520.   InfoReqIText[5].iTextFont := Font;
  521.   InfoReqIText[5].frontPen  := 1;
  522.   InfoReqIText[5].backPen   := 0;
  523.   InfoReqIText[5].drawMode  := g.jam1+SHORTSET {};
  524.   InfoReqIText[5].leftEdge  := OffX + ComputeX (180) - (I.IntuiTextLength (InfoReqIText[5]) DIV 2);
  525.   InfoReqIText[5].topEdge   := OffY + ComputeY (79) - (Font^.ySize DIV 2);
  526.   InfoReqIText[5].nextText  := y.ADR (InfoReqIText[6]);
  527.  
  528.   InfoReqIText[6].iText     := y.ADR ("Have you already smiled today?");
  529.   InfoReqIText[6].iTextFont := Font;
  530.   InfoReqIText[6].frontPen  := 2;
  531.   InfoReqIText[6].backPen   := 0;
  532.   InfoReqIText[6].drawMode  := g.jam1+SHORTSET {};
  533.   InfoReqIText[6].leftEdge  := OffX + ComputeX (188) - (I.IntuiTextLength (InfoReqIText[6]) DIV 2);
  534.   InfoReqIText[6].topEdge   := OffY + ComputeY (105) - (Font^.ySize DIV 2);
  535.   InfoReqIText[6].nextText  := NIL;
  536.  
  537.   I.PrintIText (InfoReqWnd^.rPort, InfoReqIText[0], 0, 0);
  538.   gt.DrawBevelBox(InfoReqWnd^.rPort, OffX + ComputeX (244),
  539.                   OffY + ComputeY (35),
  540.                   ComputeX (105),
  541.                   ComputeY (61),
  542.                   gt.visualInfo, VisualInfo, gt.bbRecessed, I.LTRUE, u.done);
  543.   gt.DrawBevelBox(InfoReqWnd^.rPort, OffX + ComputeX (12),
  544.                   OffY + ComputeY (34),
  545.                   ComputeX (105),
  546.                   ComputeY (61),
  547.                   gt.visualInfo, VisualInfo, gt.bbRecessed, I.LTRUE, u.done);
  548. END InfoReqRender;
  549.  
  550. PROCEDURE OpenInfoReqWindow* (): INTEGER;
  551.  
  552. VAR ng: gt.NewGadget;
  553.     gad: I.GadgetPtr;
  554.     help: u.TagListPtr;
  555.     lc, tc, lvc, offx, offy,i: INTEGER;
  556.     wleft, wtop, ww, wh: INTEGER;
  557.     infoRp: g.RastPortPtr;
  558.  
  559. BEGIN
  560.   wleft := InfoReqLeft; wtop := InfoReqTop;
  561.  
  562.   ComputeFont (InfoReqWidth, InfoReqHeight, Scr);
  563.  
  564.   ww := ComputeX (InfoReqWidth);
  565.   wh := ComputeY (InfoReqHeight);
  566.  
  567.   IF wleft + ww + OffX + Scr^.wBorRight > Scr^.width THEN
  568.     wleft := Scr^.width - ww;
  569.   END;
  570.   IF wtop + wh + OffY + Scr^.wBorBottom > Scr^.height THEN
  571.     wtop := Scr^.height - wh;
  572.   END;
  573.   gad := gt.CreateContext (InfoReqGList);
  574.   IF gad = NIL THEN RETURN 1 END;
  575.  
  576.   lc := 0; tc := 0; lvc := 0;
  577.   WHILE lc < InfoReqCNT DO
  578.     ng := InfoReqNGad[lc];
  579.     ng.visualInfo := VisualInfo;
  580.     ng.textAttr   := Font;
  581.     ng.leftEdge   := OffX + ComputeX (ng.leftEdge);
  582.     ng.topEdge    := OffY + ComputeY (ng.topEdge);
  583.     ng.width      := ComputeX (ng.width);
  584.     ng.height     := ComputeY (ng.height);
  585.  
  586.     help := u.CloneTagItems (y.VAL (u.TagListPtr, y.ADR (InfoReqGTags[tc])));
  587.     IF help = NIL THEN RETURN 8 END;
  588.     gad := gt.CreateGadgetA (InfoReqGTypes[lc], gad, ng, help^ );
  589.     u.FreeTagItems (help);
  590.     IF gad = NIL THEN RETURN 2 END;
  591.     InfoReqGadgets[lc] := gad;
  592.  
  593.     WHILE InfoReqGTags[tc] # u.done DO INC (tc, 2) END;
  594.     INC (tc);
  595.  
  596.     INC (lc);
  597.   END; (* WHILE *)
  598.   InfoReqWnd := I.OpenWindowTagsA ( NIL,
  599.                     I.waLeft,          wleft,
  600.                     I.waTop,           wtop,
  601.                     I.waWidth,         ww + OffX + Scr^.wBorRight,
  602.                     I.waHeight,        wh + OffY + Scr^.wBorBottom,
  603.                     I.waIDCMP,         gt.buttonIDCMP+LONGSET {I.vanillaKey,I.refreshWindow},
  604.                     I.waFlags,         LONGSET {I.windowDrag,I.windowDepth,I.activate},
  605.                     I.waGadgets,       InfoReqGList,
  606.                     I.waTitle,         y.ADR ("CloudsAGA Requester"),
  607.                     I.waScreenTitle,   y.ADR ("CloudsAGA 1.15 © Danny Amor in 1994"),
  608.                     I.waPubScreen,     Scr,
  609.                     u.done);
  610.   IF InfoReqWnd = NIL THEN RETURN 20 END;
  611.  
  612.   gt.RefreshWindow (InfoReqWnd, NIL);
  613.  
  614.   InfoReqRender;
  615.  
  616.   infoRp := InfoReqWnd.rPort;
  617.  
  618.   im := I.Image(0,0,73,37,1,y.ADR(No.NoData), SHORTSET{0}, SHORTSET{0},NIL);
  619.  
  620.   I.DrawImage(infoRp, im, 2+OffX + ComputeX (244), 10+OffY + ComputeY (35));
  621.   I.DrawImage(infoRp, im, 2+OffX + ComputeX (12), 10+OffY + ComputeY (34));
  622.  
  623.   RETURN 0;
  624. END OpenInfoReqWindow;
  625.  
  626. PROCEDURE CloseInfoReqWindow*;
  627. BEGIN
  628.   IF InfoReqWnd # NIL THEN
  629.     I.CloseWindow (InfoReqWnd);
  630.     InfoReqWnd := NIL;
  631.   END;
  632.   IF InfoReqGList # NIL THEN
  633.     gt.FreeGadgets (InfoReqGList);
  634.     InfoReqGList := NIL;
  635.   END;
  636. END CloseInfoReqWindow;
  637.  
  638. END CloudsGUI.
  639.