home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 100-199 / ff174.lzh / Tunnel / TunnelMenu.mod < prev    next >
Text File  |  1989-02-04  |  7KB  |  213 lines

  1. IMPLEMENTATION MODULE TunnelMenu;
  2.  
  3. (*
  4. This module initializes the menus for the Tunnel program.
  5.  
  6. Created: 16/2/88 by Garth Thornton   ( Thanks also to Richie Bielak!)
  7.                                        Richie wrote the Init.. routines
  8.                                        and I'm a lazy typist etc.
  9. Modified:
  10.  
  11.  
  12. Copyright (c) 1988  Garth Thornton
  13.  
  14. *)
  15.  
  16. FROM SYSTEM IMPORT ADDRESS, ADR, BYTE;
  17. FROM Intuition IMPORT WindowPtr, Menu, MenuPtr, IntuitionText,
  18.         IntuitionTextPtr, MenuItem, MenuItemPtr,
  19.        MenuFlags, MenuFlagSet, ItemFlags, ItemFlagSet;
  20. FROM Menus IMPORT SetMenuStrip, ClearMenuStrip, HighComp;
  21. FROM GraphicsLibrary IMPORT Jam2, Jam1, DrawingModeSet;
  22.  
  23. CONST
  24.   CheckWidth = 19; (* From Intuition.h *)
  25.  
  26. VAR
  27.   NULL : ADDRESS;
  28.   MenuStrip : MenuPtr;
  29.  
  30.   (*  ACTIONS   SYMETRY   SIZE  SQUARE*)
  31.   Menus     : ARRAY [0..3] OF Menu;
  32.  
  33.   (* HideStrip, ShowStrip, About, Quit *)
  34.   ActionItems : ARRAY [0..3] OF MenuItem;
  35.   ActionText  : ARRAY [0..3] OF IntuitionText;
  36.  
  37.   (* front, rear *)
  38.   ViewItems : ARRAY [0..1] OF MenuItem;
  39.   ViewText  : ARRAY [0..1] OF IntuitionText;
  40.  
  41.   (* single, double, reverse *)
  42.   PatternItems : ARRAY [0..2] OF MenuItem;
  43.   PatternText  : ARRAY [0..2] OF IntuitionText;
  44.  
  45.   (* rgbfoldover, rgbbounce, speedlocked, speedfree *)
  46.   StyleItems : ARRAY [0..3] OF MenuItem;
  47.   StyleText  : ARRAY [0..3] OF IntuitionText;
  48.   
  49. (* ++++++++++++++++++++++++++++++++ *)
  50. (* Connect a menu strip to a window *)
  51. PROCEDURE ConnectMenu (wp : WindowPtr);
  52.   BEGIN
  53.     SetMenuStrip (wp, MenuStrip^);
  54.   END ConnectMenu;
  55.  
  56. (* +++++++++++++++++++++++++++++++++++++ *)
  57. (* Disconnect a menu strip from a window *)
  58. PROCEDURE DisconnectMenu (wp : WindowPtr);
  59.   BEGIN
  60.     ClearMenuStrip (wp)
  61.   END DisconnectMenu;
  62.  
  63. (* ++++++++++++++++++++++++++++++++ *)
  64. (* Initialize a menu record.        *)
  65. PROCEDURE InitMenuRec (VAR m : Menu; L, T, W, H : INTEGER;
  66.                        VAR text : ARRAY OF CHAR) 
  67.        : MenuPtr;
  68.   BEGIN
  69.     WITH m DO
  70.       NextMenu := NULL;
  71.       LeftEdge := L; TopEdge := T;
  72.       Width := W; Height := H;
  73.       Flags := MenuFlagSet {MenuEnabled};
  74.       MenuName := ADR (text);
  75.       FirstItem := NULL
  76.     END;
  77.     RETURN ADR (m)
  78.   END InitMenuRec;
  79.  
  80. (* ++++++++++++++++++++++++++++++++ *)
  81. (* Initialize an item record.       *)
  82. PROCEDURE InitItemRec (VAR mi : MenuItem;
  83.                        L, T, W, H : INTEGER;
  84.        ItemFillPtr : ADDRESS) 
  85.        : MenuItemPtr;
  86.   BEGIN
  87.     WITH mi DO
  88.       NextItem := NULL;
  89.       LeftEdge := L; TopEdge := T;
  90.       Width := W; Height := H;
  91.       Flags := ItemFlagSet {ItemText, ItemEnabled} + HighComp;
  92.       MutualExclude := 0;
  93.       ItemFill := ItemFillPtr;
  94.       SelectFill := NULL; Command := BYTE (0);
  95.       SubItem := NULL; NextSelect := 0;
  96.     END;
  97.     RETURN ADR (mi)
  98.   END InitItemRec;
  99.  
  100. (* ++++++++++++++++++++++++++++++++ *)
  101. (* Initialize menu text record.     *)
  102. PROCEDURE InitTextRec (VAR it : IntuitionText;
  103.                        L, T : INTEGER;
  104.        VAR text : ARRAY OF CHAR) 
  105.                        : IntuitionTextPtr;
  106.   BEGIN
  107.     WITH it DO
  108.       FrontPen := BYTE(0); BackPen := BYTE(30);
  109.       LeftEdge := L; TopEdge := T;
  110.       DrawMode := BYTE (DrawingModeSet {Jam2});
  111.       ITextFont := NULL;
  112.       IText := ADR (text);
  113.       NextText := NULL
  114.     END;
  115.     RETURN ADR (it);
  116.   END InitTextRec;
  117.  
  118.  
  119. VAR
  120.   temp : ADDRESS;
  121.   i    : CARDINAL;
  122.  
  123. BEGIN
  124.   NULL := 0;
  125.   MenuStrip := NULL;
  126.   (* Now init menu records *)
  127.   MenuStrip :=
  128.    InitMenuRec (Menus[0], 10, 0, 72, 0, "Actions");
  129.   Menus[0].NextMenu := 
  130.     InitMenuRec (Menus[1], 10+72, 0, 48, 0, "View");
  131.   Menus[1].NextMenu := 
  132.     InitMenuRec (Menus[2], 10+72+48, 0, 68, 0, "Pattern");
  133.   Menus[2].NextMenu := 
  134.     InitMenuRec (Menus[3], 10+72+48+68, 0, 56, 0, "Style");
  135.  
  136.   (* Define action items *)
  137.   temp := InitTextRec (ActionText[0], 0, 0, "Hide Title Bar");
  138.   Menus[0].FirstItem := 
  139.     InitItemRec (ActionItems[0], 0, 0, 112, 9, temp);
  140.   temp := InitTextRec (ActionText[1], 0, 0, "Show Title Bar");
  141.   ActionItems[0].NextItem :=
  142.     InitItemRec (ActionItems[1], 0, 10, 112, 9, temp);
  143.   temp := InitTextRec (ActionText[2], 0, 0, "About Tunnel");
  144.   ActionItems[1].NextItem :=
  145.     InitItemRec (ActionItems[2], 0, 20, 112, 9, temp);
  146.   temp := InitTextRec (ActionText[3], 0, 0, "Quit");
  147.   ActionItems[2].NextItem :=
  148.     InitItemRec (ActionItems[3], 0, 30, 112, 9, temp);
  149.  
  150.   (* Define View Items *)
  151.   temp := InitTextRec (ViewText[0], 0+CheckWidth, 0, "Front");
  152.   Menus[1].FirstItem := 
  153.     InitItemRec (ViewItems[0], 0, 0, 64, 9, temp);
  154.   INCL (ViewItems[0].Flags,CheckIt);
  155.   INCL (ViewItems[0].Flags,Checked);
  156.   ViewItems[0].MutualExclude := 0FEH;
  157.  
  158.   temp := InitTextRec (ViewText[1], 0+CheckWidth, 0, "Rear");
  159.   ViewItems[0].NextItem :=
  160.     InitItemRec (ViewItems[1], 0, 10, 64, 9, temp);
  161.   INCL (ViewItems[1].Flags,CheckIt);
  162.   ViewItems[1].MutualExclude := 0FDH;
  163.  
  164.   (* Define Pattern items *)
  165.   temp := InitTextRec (PatternText[0], 0+CheckWidth, 0, "Single");
  166.   Menus[2].FirstItem := 
  167.     InitItemRec (PatternItems[0], 0, 0, 84, 9, temp);
  168.   INCL (PatternItems[0].Flags,CheckIt);
  169.   INCL (PatternItems[0].Flags,Checked);
  170.   PatternItems[0].MutualExclude := 0FEH;
  171.   
  172.   temp := InitTextRec (PatternText[1], 0+CheckWidth, 0, "Double");
  173.   PatternItems[0].NextItem :=
  174.     InitItemRec (PatternItems[1], 0, 10, 84, 9, temp);
  175.   INCL (PatternItems[1].Flags,CheckIt);
  176.   PatternItems[1].MutualExclude := 0FDH;
  177.  
  178.   temp := InitTextRec (PatternText[2], 0+CheckWidth, 0, "Reverse");
  179.   PatternItems[1].NextItem :=
  180.     InitItemRec (PatternItems[2], 0, 20, 84, 9, temp);
  181.   INCL (PatternItems[2].Flags,CheckIt);
  182.   PatternItems[2].MutualExclude := 0FBH;
  183.  
  184.   (* Style items *)
  185.   temp := InitTextRec (StyleText[0], 0+CheckWidth, 0, "RGB Foldover");
  186.   Menus[3].FirstItem := 
  187.     InitItemRec (StyleItems[0], 0, 0, 116, 9, temp);
  188.   INCL (StyleItems[0].Flags,CheckIt);
  189.   StyleItems[0].MutualExclude := 002;
  190.  
  191.   temp := InitTextRec (StyleText[1], 0+CheckWidth, 0, "RGB Bounce");
  192.   StyleItems[0].NextItem :=
  193.     InitItemRec (StyleItems[1], 0, 10, 116, 9, temp);
  194.   INCL (StyleItems[1].Flags,CheckIt);
  195.   INCL (StyleItems[1].Flags,Checked);
  196.   StyleItems[1].MutualExclude := 001;
  197.  
  198.   temp := InitTextRec (StyleText[2], 0+CheckWidth, 0, "Speed Locked");
  199.   StyleItems[1].NextItem :=
  200.     InitItemRec (StyleItems[2], 0, 20, 116, 9, temp);
  201.   INCL (StyleItems[2].Flags,CheckIt);
  202.   INCL (StyleItems[2].Flags,Checked);
  203.   StyleItems[2].MutualExclude := 008;
  204.  
  205.   temp := InitTextRec (StyleText[3], 0+CheckWidth, 0, "Speeds Free");
  206.   StyleItems[2].NextItem :=
  207.     InitItemRec (StyleItems[3], 0, 30, 116, 9, temp);
  208.   INCL (StyleItems[3].Flags,CheckIt);
  209.   StyleItems[3].MutualExclude := 004;
  210.  
  211. END TunnelMenu.
  212.  
  213.