DEFINITION MODULE DuWindow;

(*
        PART OF DirUtil for Modula 2

        This creates, opens and maintains the DirUtil window.
        It contains a couple of other importable routines for
        user alteration.

        Written: 3/21/87 by Greg Browne

        Compiles on TDI's Modula-2 Compiler version 2.20a

 NOTES: I kept being bugged with RefreshWindow not being exported from
        Intuition as a flag. Then I found that it is either misspelled
        in the .def module (as  ResfreshWindow) or that it is supposed
        to mean ResetFreshWindow. Don't know whats up but it works now.

*)

FROM Intuition          IMPORT  ActivationFlags,ActivationFlagSet,Gadget,
                                PropFlags,PropFlagSet,IntuitionText,
                                RequesterPtr,WindowPtr,StringInfo;
FROM GraphicsLibrary    IMPORT  DrawingModes,DrawingModeSet;

(*--------------------------------------------------------------------*)

(* ALMOST ALL CONSTANTS AND MOST VARIABLES/TYPES DEFINED IN .DEF FILE
   FOR IMPORTATION
*)

CONST
  StringBufSize = 255;
  RegFlags      = ActivationFlagSet{RelVerify,GadgetImmediate};
  StringFlags   = ActivationFlagSet{StringCenter} + RegFlags;
  JamTwo        = DrawingModeSet{Jam2};
  SliderFlags   = PropFlagSet{FreeVert,AutoKnob};

TYPE
  WBColors      = (Blue,White,Black,Green);     (* My workbench colors *)

(*
   Gadgets are addressed as a set. First are the devices, then the message
   string gadgets, then the command gadgets, and finally the slider.  Note
   that this is larger than a BITSET already, so the 'GadgetID' is passed as
   a set name and converted as CARDINAL(ORD(whatever)). Expansion of the set
   should be easy, with only screen positioning being the hard part.
*)

  GadgetNames   = (df0,df1,df2,dh0,dh1,ram,vd0,
                   run,source,dest,msg,
                   filewindow,
                   arc,bytes,clear,copy,copydel,deldir,edit,execfr,execrf,
                   hprint,htype,info,makedir,move,parent,print,rename,
                   root,runfr,runrf,select,show,type,zapfile,
                   dtor,dtos,rtod,rtos,stod,stor,swapsd,swaprd,swaprs,
                   slider);


(* EXTERNAL AVAILABLE VARIABLES *)

VAR

  IOStringInfo  : ARRAY[run..filewindow] OF StringInfo;
  NullReqPtr    : RequesterPtr;   (* initialized to be NULL always *)
  DuWindowPtr   : WindowPtr;
  IOString      : ARRAY[run..filewindow] OF ARRAY[0..StringBufSize-1] OF CHAR;
  GadTxt        : ARRAY GadgetNames OF IntuitionText;
  DuGads        : ARRAY GadgetNames OF Gadget;



(* ---------------------------*)
(*     EXTERNAL PROCEDURES    *)
(* ---------------------------*)
PROCEDURE SlidePot():CARDINAL;
(*
  Function returns the current value of the VertPot of the slider
*)


PROCEDURE ResetSlider(bod:CARDINAL);
(*
   Resets slide gadget size to the size passed in
*)



PROCEDURE CloseDuWindow;
(*
  Closes the window and intuition and graphics bases if they are open
*)


PROCEDURE OpenDuWindow(VAR name:ARRAY OF CHAR):BOOLEAN;

(*
        The external primary procedure - sets up and opens the window
        or returns FALSE.  The window may be accessed through
        the import of DuWindowPtr

*)


END DuWindow.

