home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / turbopas / graphtxt.zip / GRAPHTXT.DOC < prev    next >
Text File  |  1990-02-16  |  7KB  |  203 lines

  1.     GraphTxt.TPU for TP 5.5
  2.     =======================
  3.  
  4.  
  5.     Thank you for down loading graphtxt.zip!  I found text
  6.     I/O to be somewhat burdensome using Turbo Pascal 5.5's
  7.     outtext() routines so I wrote this text file device
  8.     driver for the graphics' screen (see page 223, TP's
  9.     reference guide).
  10.  
  11.  
  12.     Simply include the graphtxt unit in your application's
  13.     "uses" clause.  Then immediately after calling
  14.     InitGraph(), call InitGraphText.  Now you can use
  15.     write[ln] and read[ln] just like you did with the crt
  16.     unit.  You can even change the fonts and justification
  17.     with SetTextStyle() and SetTextJustify().  To return
  18.     to text mode call CloseGraphText immediately before
  19.     CloseGraph.
  20.  
  21.  
  22.     Run graphtxt.dem for a demonstration of the graphtxt
  23.     unit.  Study the demo's source code to see how easy it
  24.     is to use.  Below is a listing of the inteface section
  25.     of graphtxt.pas.
  26.  
  27.  
  28.  
  29.         {
  30.  
  31.             graphtxt.pas
  32.             2-16-1990
  33.             Enables read, readln, write, and writeln to be used
  34.             in graph modes.  See graphtxt.dem.
  35.  
  36.             Copyright 1990, John W. Small, All rights reserved
  37.  
  38.             PSW / Power SoftWare
  39.             P.O. Box 10072
  40.             McLean, Virginia 22102 8072
  41.             (703) 759-3838
  42.  
  43.         }
  44.  
  45.         unit graphtxt;
  46.  
  47.         interface
  48.  
  49.             uses dos, crt, graph;
  50.  
  51.  
  52.             const
  53.  
  54.                 ColumnLeft      : boolean = false;
  55.                 InputWriteMode  : integer = CopyPut;
  56.                 InputRewrite    : boolean = false;
  57.                 InputDone       : boolean = false;
  58.                 OutputWriteMode : integer = CopyPut;
  59.                 ClearTextBk     : boolean = false;
  60.                 TextBkPattern   : integer = SolidFill;
  61.                 TextBkColor     : integer = 0; { 0 = current bkcolor }
  62.                 CursorChar      : string[1] = #124; { 0 = no readln cursor }
  63.                 CursorOnMsec    : word  = 100;
  64.                 CursorOffMsec   : word  = 100;
  65.  
  66.  
  67.             procedure InitGraphText;    { Call InitGraph() first }
  68.  
  69.             procedure CloseGraphText;   { Call before CloseGraph() }
  70.  
  71.             procedure AssignGraph(var F : Text);
  72.  
  73.  
  74.  
  75.     Line Input
  76.     ==========
  77.  
  78.     Line input with read[ln] honors the same special
  79.     characters as the Crt unit (see page 136, TP reference
  80.     guide).  Use crt.CheckEOF to enable CtrlZ check!
  81.     Crt.CheckBreak controls CtrlBreak operation.  Crt's
  82.     special output characters (Bell, BackSpace, etc) are
  83.     not honored so that output is faster.  They didn't
  84.     seem that important to me.
  85.  
  86.  
  87.     Column Justification
  88.     ====================
  89.  
  90.     Writeln operates on a column concept when the
  91.     justification is CenterText or RightText for horizonal
  92.     fonts and CenterText or TopText for vertical fonts.
  93.     The CR/LF puts the CP (current pointer) on the next line
  94.     aligned with the previous line instead of the left side
  95.     of the current viewport.  With LeftText justify in
  96.     conjunction with a horizonal font, the CR/LF puts the
  97.     CP on the next line flush left with the current viewport.
  98.     If you want to writeln a column, left justified, then
  99.     set graphtxt.ColumnLeft to true!  Then LeftText justify
  100.     works on the column concept too.  The same is true with
  101.     a vertical font that is BottomText justified.  Setting
  102.     graphtxt.ColumnLeft to false will cause writeln to put
  103.     the CP on the next line flush against the bottom of the
  104.     viewport.  This is the most satisfactory arrangement
  105.     that I could come up with.  You will recall that OutText
  106.     only advances the CP with (LeftText,TopText)
  107.     justification!
  108.  
  109.  
  110.     Write Mode for write[ln] and Stroked Fonts
  111.     ==========================================
  112.  
  113.     Graphtxt.OutputWriteMode only affects the stroked fonts.
  114.     Normally, if not always, you will want the text written
  115.     on the graphics screen with SetWriteMode(CopyPut).  If
  116.     you want the output text to be XORPut onto the screen
  117.     then assign XORput to graphtxt.OutputWriteMode.
  118.  
  119.  
  120.     Character Background for write[ln] and read[ln]
  121.     ===============================================
  122.  
  123.     Assign true to graphtxt.ClearTextBk if you want the
  124.     background cleared before writing a character with
  125.     either write[ln] or read[ln].  Graphtxt.TextBkPattern
  126.     specifies the background fill pattern to be used in this
  127.     case.  Its default is SolidFill.  Graphtxt.TextBkColor
  128.     specifies the color of the background fill.  If it is 0
  129.     (zero) then the current background color is used.  Both
  130.     TextBkPattern and TextBkColor are used by the backspace
  131.     in read[ln] to rub out the character whenever
  132.     graphtxt.InputWriteMode is CopyPut or the DefaultFont
  133.     (non-stroked) is the current font.
  134.  
  135.  
  136.     Read[ln] features
  137.     =================
  138.  
  139.     Graphtxt.InputWriteMode determines whether stroked font
  140.     characters echoed to the screen are CopyPut or XORPut.
  141.     The default is CopyPut.  Sometimes you may want to use
  142.     XORPut in which case backspacing on input will erase
  143.     the character if the current font is stroked.  This is
  144.     handy in paint programs where you only want the finished
  145.     line to be CopyPut.  Set InputWriteMode to XORPut and
  146.     InputRewrite to true to accomplish this.  InputRewrite
  147.     being set to true causes the input line to be rewritten
  148.     in the CopyPut mode after the user terminates the input
  149.     line with enter.  On the other hand, backspacing will
  150.     "blacken" out the rubbed out character if InputWriteMode
  151.     is set to CopyPut or the DefaultFont is current.  Wow!
  152.     You may want to reread this.
  153.  
  154.     Graphtxt.CursorChar is really a string of one character.
  155.     (There were internal reasons for making it a string.)
  156.     This is the cursor that is displayed by read[ln].  I
  157.     chose the vertical bar "|" which is present in all the
  158.     supplied fonts.  If you don't want a cursor displayed
  159.     then assign the zero character to the string, i.e.
  160.     CursorChar[1] := #0.  CursorOnMsec and CursorOffMsec are
  161.     the parameters passed internally to crt.delay() to
  162.     determine the blink rate.  100 milliseconds appears to
  163.     be acceptable.  If you think not then these are the
  164.     variables to monkey with.
  165.  
  166.     It may seem odd for Graphtxt.InputDone to be placed in
  167.     the interface section of the graphtxt unit.  It controls
  168.     the input loop for read[ln].  The reason it's there is
  169.     so that any interrupt routine you may have included in
  170.     your application can automatically terminate a read[ln]
  171.     in progress.  I am writing a Paint program where I need
  172.     the mouse interrupt to be able to terminate the text
  173.     paint tool which happens to use readln and the
  174.     graphtxt.tpu.  Perhaps you may need it too!  By the way
  175.     the paint program is a demo for omouse.zip which I
  176.     should be uploading next week sometime.  The program is
  177.     pretty primitive since it's only a demo for omouse.
  178.     Omouse stands for object mouse.  The mouse object has
  179.     all 30 some methods (mouse functions) and some other
  180.     necessities like an automatic interrupt handler, etc,
  181.     which should make your mouse programming a snap.
  182.  
  183.  
  184.     Registration
  185.     ============
  186.  
  187.     If you find graphtxt useful and are using it in your
  188.     applications, a registration fee of $7 is requested.
  189.     Upon registration you will be sent source code and the
  190.     latest examples programs on a DOS formatted 5 1/4" disk.
  191.  
  192.  
  193.     Thanks again!
  194.  
  195.     John W. Small
  196.  
  197.     PSW / Power SoftWare
  198.     P.O. Box 10072
  199.     McLean, VA 22102 8072
  200.     (703) 759-3838
  201.  
  202.  
  203.