home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
220.lha
/
Tunnel
/
TunnelMenu.mod
< prev
next >
Wrap
Text File
|
1996-02-15
|
7KB
|
213 lines
IMPLEMENTATION MODULE TunnelMenu;
(*
This module initializes the menus for the Tunnel program.
Created: 16/2/88 by Garth Thornton ( Thanks also to Richie Bielak!)
Richie wrote the Init.. routines
and I'm a lazy typist etc.
Modified:
Copyright (c) 1988 Garth Thornton
*)
FROM SYSTEM IMPORT ADDRESS, ADR, BYTE;
FROM Intuition IMPORT WindowPtr, Menu, MenuPtr, IntuitionText,
IntuitionTextPtr, MenuItem, MenuItemPtr,
MenuFlags, MenuFlagSet, ItemFlags, ItemFlagSet;
FROM Menus IMPORT SetMenuStrip, ClearMenuStrip, HighComp;
FROM GraphicsLibrary IMPORT Jam2, Jam1, DrawingModeSet;
CONST
CheckWidth = 19; (* From Intuition.h *)
VAR
NULL : ADDRESS;
MenuStrip : MenuPtr;
(* ACTIONS SYMETRY SIZE SQUARE*)
Menus : ARRAY [0..3] OF Menu;
(* HideStrip, ShowStrip, About, Quit *)
ActionItems : ARRAY [0..3] OF MenuItem;
ActionText : ARRAY [0..3] OF IntuitionText;
(* front, rear *)
ViewItems : ARRAY [0..1] OF MenuItem;
ViewText : ARRAY [0..1] OF IntuitionText;
(* single, double, reverse *)
PatternItems : ARRAY [0..2] OF MenuItem;
PatternText : ARRAY [0..2] OF IntuitionText;
(* rgbfoldover, rgbbounce, speedlocked, speedfree *)
StyleItems : ARRAY [0..3] OF MenuItem;
StyleText : ARRAY [0..3] OF IntuitionText;
(* ++++++++++++++++++++++++++++++++ *)
(* Connect a menu strip to a window *)
PROCEDURE ConnectMenu (wp : WindowPtr);
BEGIN
SetMenuStrip (wp, MenuStrip^);
END ConnectMenu;
(* +++++++++++++++++++++++++++++++++++++ *)
(* Disconnect a menu strip from a window *)
PROCEDURE DisconnectMenu (wp : WindowPtr);
BEGIN
ClearMenuStrip (wp)
END DisconnectMenu;
(* ++++++++++++++++++++++++++++++++ *)
(* Initialize a menu record. *)
PROCEDURE InitMenuRec (VAR m : Menu; L, T, W, H : INTEGER;
VAR text : ARRAY OF CHAR)
: MenuPtr;
BEGIN
WITH m DO
NextMenu := NULL;
LeftEdge := L; TopEdge := T;
Width := W; Height := H;
Flags := MenuFlagSet {MenuEnabled};
MenuName := ADR (text);
FirstItem := NULL
END;
RETURN ADR (m)
END InitMenuRec;
(* ++++++++++++++++++++++++++++++++ *)
(* Initialize an item record. *)
PROCEDURE InitItemRec (VAR mi : MenuItem;
L, T, W, H : INTEGER;
ItemFillPtr : ADDRESS)
: MenuItemPtr;
BEGIN
WITH mi DO
NextItem := NULL;
LeftEdge := L; TopEdge := T;
Width := W; Height := H;
Flags := ItemFlagSet {ItemText, ItemEnabled} + HighComp;
MutualExclude := 0;
ItemFill := ItemFillPtr;
SelectFill := NULL; Command := BYTE (0);
SubItem := NULL; NextSelect := 0;
END;
RETURN ADR (mi)
END InitItemRec;
(* ++++++++++++++++++++++++++++++++ *)
(* Initialize menu text record. *)
PROCEDURE InitTextRec (VAR it : IntuitionText;
L, T : INTEGER;
VAR text : ARRAY OF CHAR)
: IntuitionTextPtr;
BEGIN
WITH it DO
FrontPen := BYTE(0); BackPen := BYTE(30);
LeftEdge := L; TopEdge := T;
DrawMode := BYTE (DrawingModeSet {Jam2});
ITextFont := NULL;
IText := ADR (text);
NextText := NULL
END;
RETURN ADR (it);
END InitTextRec;
VAR
temp : ADDRESS;
i : CARDINAL;
BEGIN
NULL := 0;
MenuStrip := NULL;
(* Now init menu records *)
MenuStrip :=
InitMenuRec (Menus[0], 10, 0, 72, 0, "Actions");
Menus[0].NextMenu :=
InitMenuRec (Menus[1], 10+72, 0, 48, 0, "View");
Menus[1].NextMenu :=
InitMenuRec (Menus[2], 10+72+48, 0, 68, 0, "Pattern");
Menus[2].NextMenu :=
InitMenuRec (Menus[3], 10+72+48+68, 0, 56, 0, "Style");
(* Define action items *)
temp := InitTextRec (ActionText[0], 0, 0, "Hide Title Bar");
Menus[0].FirstItem :=
InitItemRec (ActionItems[0], 0, 0, 112, 9, temp);
temp := InitTextRec (ActionText[1], 0, 0, "Show Title Bar");
ActionItems[0].NextItem :=
InitItemRec (ActionItems[1], 0, 10, 112, 9, temp);
temp := InitTextRec (ActionText[2], 0, 0, "About Tunnel");
ActionItems[1].NextItem :=
InitItemRec (ActionItems[2], 0, 20, 112, 9, temp);
temp := InitTextRec (ActionText[3], 0, 0, "Quit");
ActionItems[2].NextItem :=
InitItemRec (ActionItems[3], 0, 30, 112, 9, temp);
(* Define View Items *)
temp := InitTextRec (ViewText[0], 0+CheckWidth, 0, "Front");
Menus[1].FirstItem :=
InitItemRec (ViewItems[0], 0, 0, 64, 9, temp);
INCL (ViewItems[0].Flags,CheckIt);
INCL (ViewItems[0].Flags,Checked);
ViewItems[0].MutualExclude := 0FEH;
temp := InitTextRec (ViewText[1], 0+CheckWidth, 0, "Rear");
ViewItems[0].NextItem :=
InitItemRec (ViewItems[1], 0, 10, 64, 9, temp);
INCL (ViewItems[1].Flags,CheckIt);
ViewItems[1].MutualExclude := 0FDH;
(* Define Pattern items *)
temp := InitTextRec (PatternText[0], 0+CheckWidth, 0, "Single");
Menus[2].FirstItem :=
InitItemRec (PatternItems[0], 0, 0, 84, 9, temp);
INCL (PatternItems[0].Flags,CheckIt);
INCL (PatternItems[0].Flags,Checked);
PatternItems[0].MutualExclude := 0FEH;
temp := InitTextRec (PatternText[1], 0+CheckWidth, 0, "Double");
PatternItems[0].NextItem :=
InitItemRec (PatternItems[1], 0, 10, 84, 9, temp);
INCL (PatternItems[1].Flags,CheckIt);
PatternItems[1].MutualExclude := 0FDH;
temp := InitTextRec (PatternText[2], 0+CheckWidth, 0, "Reverse");
PatternItems[1].NextItem :=
InitItemRec (PatternItems[2], 0, 20, 84, 9, temp);
INCL (PatternItems[2].Flags,CheckIt);
PatternItems[2].MutualExclude := 0FBH;
(* Style items *)
temp := InitTextRec (StyleText[0], 0+CheckWidth, 0, "RGB Foldover");
Menus[3].FirstItem :=
InitItemRec (StyleItems[0], 0, 0, 116, 9, temp);
INCL (StyleItems[0].Flags,CheckIt);
StyleItems[0].MutualExclude := 002;
temp := InitTextRec (StyleText[1], 0+CheckWidth, 0, "RGB Bounce");
StyleItems[0].NextItem :=
InitItemRec (StyleItems[1], 0, 10, 116, 9, temp);
INCL (StyleItems[1].Flags,CheckIt);
INCL (StyleItems[1].Flags,Checked);
StyleItems[1].MutualExclude := 001;
temp := InitTextRec (StyleText[2], 0+CheckWidth, 0, "Speed Locked");
StyleItems[1].NextItem :=
InitItemRec (StyleItems[2], 0, 20, 116, 9, temp);
INCL (StyleItems[2].Flags,CheckIt);
INCL (StyleItems[2].Flags,Checked);
StyleItems[2].MutualExclude := 008;
temp := InitTextRec (StyleText[3], 0+CheckWidth, 0, "Speeds Free");
StyleItems[2].NextItem :=
InitItemRec (StyleItems[3], 0, 30, 116, 9, temp);
INCL (StyleItems[3].Flags,CheckIt);
StyleItems[3].MutualExclude := 004;
END TunnelMenu.