  ------------------------------------------------------------------------
  Direct unit                               by Sebastian Groeneveld (2000)
  ------------------------------------------------------------------------

  Usage
  =====

  Add the following line to your program:

  $INCLUDE "Direct.inc"


  Credits
  =======

  Most of the code for this unit was copied directly from SCRNUNIT.BAS,
  that comes with PowerBasic. The changes I made are clipping of coordinates,
  and different box styles.


  Public routines
  ===============

  In the following routines, there are several common parameters:

  Row   AS INTEGER      Row to start
  Col   AS INTEGER      Column to start
  Rows  AS INTEGER      Number of rows to act on
  Cols  AS INTEGER      Number of columns to act on

                        All coordinates are automatically clipped to the
                        screen's edges

  Attr  AS INTEGER      Color attribute (you can use MakeAttr(Fore%, Back%)
                        from Colors.inc to obtain this value for any color)


  -----
  SUB DirectPrint( BYVAL Row   AS INTEGER , BYVAL Col   AS INTEGER, _
                   BYVAL Text  AS STRING  , BYVAL Attr  AS INTEGER )

  Prints string Text directly to the screen. This means the text can not
  be redirected, and the cursor location is not changed.

  -----
  SUB DirectCentre( BYVAL Row   AS INTEGER , BYVAL ColL  AS INTEGER, _
                    BYVAL ColR  AS INTEGER , BYVAL Text  AS STRING, _
                    BYVAL Attr  AS INTEGER )

  Centres string Text between two columns specified by ColL and ColR.

  -----
  SUB DirectColor( BYVAL Row   AS INTEGER , BYVAL Col   AS INTEGER, _
                   BYVAL Rows  AS INTEGER , BYVAL Cols  AS INTEGER, _
                   BYVAL Attr  AS INTEGER )

  Changes the color attribute of a portion of the screen.

  -----
  SUB DirectBox( BYVAL Row    AS INTEGER , BYVAL Col   AS INTEGER, _
                 BYVAL Rows   AS INTEGER , BYVAL Cols  AS INTEGER, _
                 BYVAL Title  AS STRING  , BYVAL Attr  AS INTEGER, _
                 BYVAL Style  AS INTEGER )

  Draws a solid box with a caption Title and custom border style. If Title
  is an empty string, then only a frame will be drawn. The style can be any
  of the following values:

        0 = no border

        1 = single border     Ĵ  Ŀ
            extended ASCII          
                              

        2 = double border     ͵  ͻ
            extended ASCII          
                              ͼ

        3 = single border      _/  \_
            normal ASCII      |      |
                              |______|

        4 = thick border        
            extended ASCII          
                              


  Example
  =======

  $INCLUDE "Colors.inc"
  $INCLUDE "Direct.inc"

  ' Draw a box on the entire screen, white on blue, single border
  DirectBox 1, 1, 25, 80, "Main Window", MakeAttr(%White, %Blue), 1

  ' Print some text in the box, yellow on blue
  DirectCentre 5, 1, 80, "This text is centred", MakeAttr(%Yellow, %Blue)

  ' Change the color of a part of the box to green on red
  DirectColor 10, 20, 10, 40, MakeAttr(%Green, %Red)

