home *** CD-ROM | disk | FTP | other *** search
Modula Implementation | 1989-02-04 | 5.7 KB | 190 lines |
- IMPLEMENTATION MODULE TunInfo;
-
- (*
- This module displays a requester with some info
- about Tunnel.
-
- Created: 6/11/86 by Richie Bielak
-
- Modified: 17/2/88 by Garth Thornton
- All I've done is change the message; I'd never get around to
- putting this into a quick'n'easy program otherwise.
-
- CopyRight (c) 1986, by Richie Bielak
-
- This program may be freely distributed. But please leave
- my name in. Thanks... Richie. and... Garth.
-
- *)
-
- FROM Intuition IMPORT WindowPtr, IDCMPFlagSet, IntuitionText, Requester,
- RequesterFlagSet, Gadget, PropInfoPtr, GadgetFlagSet,
- ActivationFlagSet, ActivationFlags, Border;
- FROM Requesters IMPORT InitRequester, Request;
- FROM SYSTEM IMPORT ADR, BYTE, ADDRESS;
- FROM GraphicsLibrary IMPORT Jam2, Jam1, DrawingModeSet;
-
-
- VAR
- NULL : ADDRESS;
- InfoRequest : Requester;
-
- (* ++++++++++++++++++++++++++++++++++++ *)
- PROCEDURE ShowTunInfo (wp : WindowPtr);
- VAR succ : BOOLEAN;
- BEGIN
- succ := Request (InfoRequest, wp)
- END ShowTunInfo;
-
- (* ++++ GADGET related variables ++++++ *)
- CONST
- InfoGadWidth = 70;
- InfoGadHeight = 10;
- BOOLGADGET = 1H;
- REQGADGET = 1000H;
- VAR
- InfoGadText : IntuitionText;
- InfoGad : Gadget;
- InfoGadTextStr : ARRAY [0..20] OF CHAR;
- InfoGadBorder : Border;
- InfoGadPairs : ARRAY [1..10] OF INTEGER;
-
- (* ++++++++++++++++++++++++++++++++++++ *)
- PROCEDURE SetUpGadget ();
- BEGIN
- InfoGadTextStr := "Continue";
-
- (* Coordinates for border of the gadget box *)
- InfoGadPairs [1] := 0; InfoGadPairs [2] := 0;
- InfoGadPairs [3] := InfoGadWidth+1; InfoGadPairs [4] := 0;
- InfoGadPairs [5] := InfoGadWidth+1;
- InfoGadPairs [6] := InfoGadHeight+1;
- InfoGadPairs [7] := 0; InfoGadPairs [8] := InfoGadHeight+1;
- InfoGadPairs [9] := 0; InfoGadPairs [10] := 0;
-
- WITH InfoGadBorder DO
- LeftEdge := -1; TopEdge := -1;
- FrontPen := BYTE (3); BackPen := BYTE (0);
- DrawMode := BYTE (Jam1); Count := BYTE (5);
- XY := ADR (InfoGadPairs); NextBorder := NULL;
- END;
-
- WITH InfoGadText DO
- FrontPen := BYTE (2); BackPen := BYTE (1);
- DrawMode := BYTE (DrawingModeSet {Jam2});
- LeftEdge := 1; TopEdge := 1;
- ITextFont := NULL; NextText := NULL;
- IText := ADR (InfoGadTextStr);
- END;
-
- WITH InfoGad DO
- NextGadget := NULL;
- LeftEdge := (InfoReqWidth DIV 2) - (InfoGadWidth DIV 2);
- TopEdge := InfoReqHeight - (InfoGadHeight + 5);
- Width := InfoGadWidth; Height := InfoGadHeight;
- Flags := GadgetFlagSet {};
- Activation := ActivationFlagSet {EndGadget, RelVerify};
- GadgetType := BOOLGADGET + REQGADGET;
- GadgetRender := ADR (InfoGadBorder);
- SelectRender := NULL;
- GadgetText := ADR (InfoGadText);
- MutualExclude := 0;
- SpecialInfoProp := PropInfoPtr (0);
- GadgetID := 0; UserData := NULL
- END;
- END SetUpGadget;
-
- (* +++++++ These variables are needed for the requester's stuff +++ *)
- CONST
- InfoReqWidth = 300;
- InfoReqHeight = 100;
-
- VAR
- InfoReqBorder : Border;
- InfoReqPairs : ARRAY [1..10] OF INTEGER;
- InfoReqText : ARRAY [0..5] OF IntuitionText;
-
-
- (* ++++++++++++++++++++++++++++++++++++ *)
- PROCEDURE SetUpRequester ();
- BEGIN
- (* Set up the border stuff *)
- (* Coordinates for border of the gadget box *)
- InfoReqPairs [1] := 0; InfoReqPairs [2] := 0;
- InfoReqPairs [3] := InfoReqWidth-3; InfoReqPairs [4] := 0;
- InfoReqPairs [5] := InfoReqWidth-3;
- InfoReqPairs [6] := InfoReqHeight-3;
- InfoReqPairs [7] := 0; InfoReqPairs [8] := InfoReqHeight-3;
- InfoReqPairs [9] := 0; InfoReqPairs [10] := 0;
-
- WITH InfoReqBorder DO
- LeftEdge := 1; TopEdge := 1;
- FrontPen := BYTE (3); BackPen := BYTE (0);
- DrawMode := BYTE (Jam1); Count := BYTE (5);
- XY := ADR (InfoReqPairs); NextBorder := NULL;
- END;
-
- (* Set up the requester *)
- InitRequester (InfoRequest);
-
- WITH InfoRequest DO
- LeftEdge := 20; TopEdge := 30;
- Width := InfoReqWidth; Height := InfoReqHeight;
- ReqGadget := ADR (InfoGad);
- ReqText := ADR (InfoReqText);
- ReqBorder := ADR (InfoReqBorder);
- BackFill := BYTE (1);
- END;
-
- END SetUpRequester;
-
- (* ++++++++++++++++++++++++++++++++++++ *)
- PROCEDURE SetUpRequesterText ();
-
- (* ++++++++++++++++++++++++++++ *)
- PROCEDURE InitIText (VAR itext : IntuitionText;
- L, T : CARDINAL;
- Next : ADDRESS;
- VAR text : ARRAY OF CHAR);
- BEGIN
- WITH itext DO
- FrontPen := BYTE (2); BackPen := BYTE (1);
- DrawMode := BYTE (DrawingModeSet {Jam2});
- LeftEdge := L; TopEdge := T;
- ITextFont := NULL; NextText := Next;
- IText := ADR (text);
- END;
- END InitIText;
-
- BEGIN
- InitIText (InfoReqText[0], 5, 10, ADR (InfoReqText[1]),
- " This program was written using ");
- InitIText (InfoReqText[1], 5, 20, ADR (InfoReqText[2]),
- " TDI/Modula-2.");
- InitIText (InfoReqText[2], 5, 30, ADR (InfoReqText[3]),
- "-----------------------------------");
- InitIText (InfoReqText[3], 5, 40, ADR (InfoReqText[4]),
- "Copyright (c) 1988 - Garth Thornton");
- InitIText (InfoReqText[4], 5, 60, ADR (InfoReqText[5]),
- " Wellington, New Zealand. ");
- InitIText (InfoReqText[5], 5, 70, NULL,
- "It's Public Domain - UYRAF!");
- END SetUpRequesterText;
-
- (* +++++++++++++++++++++++++++++ *)
- PROCEDURE InitTunInfo ();
- BEGIN
- (* Initialize the Gadget that goes with the requester *)
- SetUpGadget ();
- (* Initialize text for the requester *)
- SetUpRequesterText ();
- (* Initialize the requester *)
- SetUpRequester ();
- END InitTunInfo;
-
- BEGIN
- NULL := ADDRESS (0);
- END TunInfo.
-
-
-