(******************************************************************************)
(*                                                                            *)
(*    The global constants and variables defined in this module are optional: *)
(* if you don't want to access their features, you needn't import them into   *)
(* your program. The variables in the parameter lists of the procedures are   *)
(* the only variables you are required to supply.                             *)
(*    When describing the order in which certain routines are called, I have  *)
(* adopted the curly-bracket notation of EBNF: routines in curly brackets {}  *)
(* may be called an arbitrary number of times (0 to n). A, {B}, {C, {D}} thus *)
(* implies that A is called once, followed by an arbitrary number of calls to *)
(* to B, followed by an arbitrary number of calls to C. Each of the calls to  *)
(* C may be followed by an arbitrary number of calls to D. Likewise, {{C},{D}}*)
(* implies an arbitrary number of calls to C and D in any order.              *)
(*                                                                            *)
(******************************************************************************)
(*                                                                            *)
(*  Version 1.00a.002 (Beta) :   March 2, 1988                                *)
(*                                                                            *)
(*    These procedures were originally written under version 1.20 of the TDI  *)
(* Modula-2 compiler. I have rewritten this module to operate under the v2.00 *)
(* compiler. However, should you find any problem or inconsistency with the   *)
(* functionality of this code, please contact me at the following address:    *)
(*                                                                            *)
(*                               Jerry Mack                                   *)
(*                               23 Prospect Hill Ave.                        *)
(*                               Waltham, MA   02154                          *)
(*                                                                            *)
(*    Check the module MenuUtils for TDI's (considerably less powerful) ver-  *)
(* sions of my Menu and IntuitionText procedures. The modules GadgetUtils and *)
(* EasyGadgets should also be of great help.                                  *)
(*                                                                            *)
(******************************************************************************)
(*                                                                            *)
(*    The source code to TextTools is in the public domain. You may do with   *)
(* it as you please.                                                          *)
(*                                                                            *)
(******************************************************************************)

DEFINITION MODULE TextTools;

FROM GraphicsLibrary IMPORT DrawingModeSet;
FROM Intuition       IMPORT WindowPtr, IntuitionTextPtr;
FROM Strings         IMPORT String;
FROM Text            IMPORT TextAttrPtr;


VAR
   FrontTextPen : INTEGER;   (* these pens are chosen from the screen pen- *)
   BackTextPen  : INTEGER;   (* palette; e.g., 3 bit planes = 8 pens (0-7);*)
   CurrentFont  : TextAttrPtr;       (* in case you want a different font; *)
   LastText     : IntuitionTextPtr;  (* connect current text to last text; *)
   TextDrawMode : DrawingModeSet;             (* method used to draw text; *)

 
   PROCEDURE GetIntuiText     (TextItem          : String;        (* Input *)
                               TextLeft, TextTop : INTEGER;       (* Input *)
                               VAR IntuiText     : IntuitionTextPtr); 

   PROCEDURE DestroyIntuiText (VAR IntuiText     : IntuitionTextPtr;
                               DestroyAllText    : BOOLEAN); 
 

        (* Default values upon importing this module: *)
        (* FrontTextPen =  0    CurrentFont = NULL    *)
        (* BackTextPen  =  1    LastText    = NULL    *)
        (* TextDrawMode = Jam2                        *)
 
    (* GetIntuiText returns an IntuitionText structure containing the    *)
    (* desired text. TextLeft and TextTop are the pixel positions where  *)
    (* the lower-left corner of the text will be placed. If LastText <>  *)
    (* NULL, then LastText will point to IntuiText, thus creating a      *)
    (* linked list of IntuitionText structures. Just call GetIntuiText,  *)
    (* assign LastText to IntuiText and call GetIntuiText again.         *)
 
    (* LastText is set to NULL following the call to GetIntuiText.       *)

    (* DestroyIntuiText DISPOSEs of IntuitionText: If DestroyAllText is  *)
    (* TRUE, then it also DISPOSEs of all IntuitionText forward-linked   *)
    (* to IntuiText. If DestroyAllText is FALSE, then only the Intuition-*)
    (* Text pointed to by IntuiText is DISPOSEd. If IntuiText is forward-*)
    (* linked to other IntuitionText upon entry to this procedure, then, *)
    (* upon return, IntuiText will point to the next IntuitionText in the*)
    (* linked list.                                                      *)


END TextTools.
