home *** CD-ROM | disk | FTP | other *** search
Modula Implementation | 1986-11-21 | 2.5 KB | 84 lines |
- (*
-
- This module contains a procedure that prompts the user
- for resolution parameters that will be used in
- a later screen display.
-
- Created: 9/16/87 by Richie Bielak
-
- Modified:
-
- Copyright © 1987 by Richie Bielak
-
- This program maybe freely copied, but please leave
- my name in. Thanks....Richie
-
- *)
- IMPLEMENTATION MODULE GetRes;
-
- FROM SYSTEM IMPORT ADR;
- FROM SimpleWindows IMPORT CreateWindow;
- FROM Intuition IMPORT WindowPtr, GadgetPtr, CloseWindow, IDCMPFlagsSet,
- IDCMPFlags, WindowFlagsSet, WindowFlags,
- IntuiMessagePtr;
- FROM SimpleGadgets IMPORT BeginGadgetList, EndGadgetList, FreeGadgetList,
- AddGadgetTextButton;
- FROM Views IMPORT ViewModesSet, ViewModes;
- FROM Ports IMPORT WaitPort, ReplyMsg, GetMsg, MessagePtr;
-
- TYPE
- ResGadType = (Low, LowLace, High, HighLace);
-
- (* ++++++++++++++++++++++++++++++++++++++++ *)
- PROCEDURE SetUpGadgets () : GadgetPtr;
- BEGIN
- BeginGadgetList ();
- AddGadgetTextButton (20, 15, ADR("320 X 200"));
- AddGadgetTextButton (20, 30, ADR("320 X 400"));
- AddGadgetTextButton (120, 15, ADR("640 X 200"));
- AddGadgetTextButton (120, 30, ADR("640 X 400"));
- RETURN EndGadgetList ();
- END SetUpGadgets;
-
- (* ++++++++++++++++++++++++++++++++++++++++ *)
- PROCEDURE ChooseResolution (VAR width, height : CARDINAL;
- VAR distype : ViewModesSet);
-
- VAR
- wp : WindowPtr;
- gp, glistp : GadgetPtr;
- msgptr : IntuiMessagePtr;
- BEGIN
- glistp := SetUpGadgets ();
- wp := CreateWindow (100, 70, 220, 50,
- IDCMPFlagsSet {GadgetUp, GadgetDown},
- WindowFlagsSet {Activate, WindowDrag}, glistp, NIL,
- ADR ("Choose resolution"));
-
- (* All we got to do is get one message *)
- msgptr := WaitPort (wp^.UserPort^);
- LOOP
- msgptr := GetMsg (wp^.UserPort^);
- IF msgptr = NIL THEN EXIT END;
- gp := msgptr^.IAddress;
- ReplyMsg (MessagePtr (msgptr));
- END;
- distype := ViewModesSet{}; width := 320; height := 200;
- CASE ResGadType(gp^.GadgetID) OF
- Low: (* This one is the default *) |
- LowLace:
- distype := ViewModesSet{Lace};
- height := 400; |
- High:
- distype := ViewModesSet{Hires};
- width := 640; |
- HighLace:
- distype := ViewModesSet{Hires, Lace};
- width := 640; height := 400;
- END;
- CloseWindow (wp^);
- FreeGadgetList (glistp^);
- END ChooseResolution;
-
- END GetRes.
-