home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l044 / 4.ddi / ONLINE.ZIP / EDITORS.DOC < prev    next >
Encoding:
Text File  |  1990-10-23  |  24.1 KB  |  774 lines

  1.                              EDITORS
  2.                              -------
  3.  
  4. TEditor implements a small, fast 64K editor for use in Turbo
  5. Vision applications. It features mouse support, undo, clipboard
  6. cut, copy and paste, autoindent and overwrite modes, WordStar
  7. key bindings, and search and replace. This editor can be used not
  8. only for editing files, but as a multi-line memo field in dialogs
  9. or forms.
  10.  
  11. The use of TEditor is demonstrated in TVEDIT.PAS for editing
  12. files and TVFORM.PAS as a memo field. Both of these file can be
  13. found in the \T6\TVDEMOS directory.
  14.  
  15.  
  16.  
  17.                          Object summary
  18.                          --------------
  19.  
  20. TEditor
  21. -------
  22. TEditor is the base object for all editors. It implements most of
  23. the editor's functionality. If a TEditor object is created, it
  24. will allocate its buffer out of the heap with the given size. The
  25. buffer will initially be empty.
  26.  
  27. TMemo
  28. -----
  29. TMemo is a descendant of TEditor that is intended to go into a
  30. dialog or form. It supports GetData and SetData and allows the Tab
  31. key to be processed by TDialog. It also has a different palette
  32. than TEditor. GetData/SetData expect a record like the following,
  33.  
  34.   TMemoRec = record
  35.     TextLen: Word;
  36.     TextData: array[1..MaxMemoLen] of Char;
  37.    end;
  38.  
  39. where MaxMemoLen is the BufSize value passed to TMemo. TMemo
  40. allocates its buffer from the heap.
  41.  
  42. TFileEditor
  43. -----------
  44. TFileEditor edits the contents of a file, which it stores in memory
  45. allocated from the Buffers unit. This allows several editors to share
  46. the same memory pool. Instead of allocating 64k for each editor, you
  47. can allocate, say, 128k for all your editors. If the first editor only
  48. takes up 16k, it will leave 112k for other editors. The editor takes
  49. only the memory it needs at the time out of the pool. An editor will
  50. grow by 4k at a time whenever the "gap" shrinks to 0, and will shrink
  51. by 4k at a time if the gap grows larger than 4K. See below for a
  52. description of the "gap." See BUFFERS.DOC for further information on
  53. dynamic buffers.
  54.  
  55. TEditWindow
  56. -----------
  57. TEditWindow is a window designed to hold a TFileEditor or the
  58. clipboard. It will change its title to display the file name
  59. being edited and will initialize scroll bars and an indicator for
  60. the editor. If the name passed to TEditWindow is blank, it
  61. assumes that you are initializing the clipboard.
  62.  
  63. TIndicator
  64. ----------
  65. TIndicator is the line and column counter in the lower left
  66. corner of the edit window. It is initialized by TEditWindow and
  67. passed as the fourth parameter to a TEditor.
  68.  
  69.  
  70.                           Key Bindings
  71.                           ------------
  72.  
  73. Keys are bound to many of the the familiar WordStar key bindings
  74. used in the IDE. The only exceptions are the block commands. Since
  75. TEditor does not use persistent blocks, the block commands are
  76. simulated by copying the information to and from the clipboard.
  77. For example, ^K^B will begin selecting text. ^K^K will copy the
  78. text to the clipboard. ^K^C will paste the contents from the
  79. clipboard to the editor. This simulates, quite closely, the
  80. keystrokes to do the same thing using WordStar bindings.
  81.  
  82. The selection can be started by holding down the shift key with
  83. any of the cursor movement commands instead of using the ^K
  84. bindings.
  85.  
  86. These key bindings can be changed by overriding the ConvertEvent
  87. method which translates the given key event to a command event.
  88.  
  89.  
  90.                             Internals
  91.                             ---------
  92.  
  93. Buffer structure
  94. ----------------
  95. TEditor implements a "buffer gap" editor. It stores the text in
  96. two pieces. Any text before the cursor is stored at the beginning
  97. of the buffer, and text after the cursor is stored at the end
  98. of the buffer. The space between the text is called the "gap."
  99. When a character is inserted into the editor it is inserted into
  100. the gap. The editor supports undo by recording deleted text in the
  101. gap and maintaining the the number of characters inserted and
  102. deleted. When asked to perform an undo, the characters that were
  103. inserted are deleted, the deleted characters are copied to the
  104. beginning of the gap, and the cursor is positioned after the
  105. formerly-deleted text.
  106.  
  107. To illustrate how the buffer operates, consider the following
  108. diagram of an editor buffer after the characters
  109. "abcdefghijkxxxopqrstuvwxyz" are inserted,
  110.  
  111.                                       CurPtr
  112.                                       |
  113.                                       v<-- GapLen -->
  114.            ===========================................
  115.            |abcdefghijkxxxopqrstuvwxyz               |
  116.            ===========================................
  117.             <-------- BufLen -------->
  118.             <---------------- BufSize -------------->
  119.  
  120.                    Buffer after text inserted
  121.  
  122. CurPtr records the position of the cursor, GapLen is the length
  123. of the gap, and BufLen is the total number of characters in the
  124. buffer. BufSize is the size of the buffer which is always the sum
  125. of GapLen and BufLen. If the cursor is then moved to just after
  126. the "xxx" characters, the buffer would look like,
  127.  
  128.                           CurPtr
  129.                           |
  130.                           v<-- GapLen -->
  131.            ===============...............=============
  132.            |abcdefghijkxxx               opqrstuvwxyz|
  133.            ===============...............=============
  134.   BufLen =  <------------>      +       <----------->
  135.             <--------------- BufSize --------------->
  136.  
  137.                   Buffer after cursor movement
  138.  
  139. Note that the gap is kept in front of the cursor. This allow for
  140. quick insertion of characters without moving any text. If "xxx"
  141. is deleted using the backspace key the characters are copied to
  142. the bottom of the gap and the cursor is moved backwards. The
  143. DelCount field records the number of characters deleted.
  144.  
  145.                        CurPtr
  146.                        |
  147.                        v<--- GapLen ---->
  148.            ============..................=============
  149.            |abcdefghijk               xxxopqrstuvwxyz|
  150.            ============..................=============
  151.                                       <-> DelCount
  152.   BufLen =  <------------>      +       <----------->
  153.             <--------------- BufSize --------------->
  154.  
  155.                   Buffer after "xxx" is deleted
  156.  
  157. When characters are inserted, the insertion count, InsCount, is
  158. incremented to record how to many characters to delete with an
  159. undo. If "lmn" are now typed, the buffer would look like this:
  160.  
  161.                           CurPtr
  162.                           |
  163.                           v<-- GapLen -->
  164.            ===============...............=============
  165.            |abcdefghijklmn            xxxopqrstuvwxyz|
  166.            ===============...............=============
  167.                        <-> InsCount   <-> DelCount
  168.   BufLen =  <------------>      +       <----------->
  169.             <--------------- BufSize --------------->
  170.  
  171.                  Buffer after "lmn" is inserted
  172.  
  173. InsCount records the number of characters inserted. If an undo is
  174. now requested "lmn" are deleted and "xxx" are copied on top of them,
  175. restoring the buffer to what it was before the edits.
  176.  
  177.                           CurPtr
  178.                           |
  179.                           v<-- GapLen -->
  180.            ===============...............=============
  181.            |abcdefghijkxxx               opqrstuvwxyz|
  182.            ===============...............=============
  183.   BufLen =  <------------>      +       <----------->
  184.             <--------------- BufSize --------------->
  185.  
  186.                         Buffer after undo
  187.  
  188.  
  189. If the cursor is moved before the undo is performed, all undo
  190. information is lost because the gap moves. Undo will only undo
  191. operations done between cursor movements. As soon as the cursor
  192. moves, the edits performed are considered "accepted."  Note also
  193. that undo takes space inside the buffer which could prevent the
  194. user from inserting text. The space can be recovered by moving
  195. the cursor.
  196.  
  197. Selection or block
  198. ------------------
  199. The Selection or block mark is always either before or after the
  200. cursor. If text is inserted into the editor, either through a key
  201. press, or through InsertText, the contents of the selection are
  202. replaced by the inserted text. If there is no selection, the text
  203. is just inserted. The selection is marked by the fields SelStart
  204. and SelEnd. The selection can be set by the call SetSelection,
  205. which will also move the cursor.
  206.  
  207. Options
  208. -------
  209. TEditor provides several options, the state of which are stored in
  210. Boolean fields. CanUndo indicates whether the editor records undo
  211. information. Since undo takes space temporarily from inserts, you
  212. might find it advantageous to disable undo. This is done
  213. automatically for the clipboard. Overwrite indicates whether the
  214. editor is in overwrite or insert mode. AutoIndent records whether
  215. the editor will, when the Enter key is pressed, indent the cursor
  216. to the column of the first non-space character of the previous
  217. line. This is convenient if the editor is used to edit source
  218. code.
  219.  
  220.  
  221.                              Objects
  222.                              -------
  223.  
  224. TEditor
  225. -----------------------------------------------------------------
  226.  
  227. Fields
  228. ------
  229. HScrollBar: PScrollBar;
  230.  
  231.   Pointer to the horizontal scroll bar, nil if the scroll bar
  232.   does not exist.
  233.  
  234. VScrollBar: PScrollBar;
  235.  
  236.   Pointer to the vertical scroll bar, nil if the scroll bar does
  237.   not exist.
  238.  
  239. Indicator: PIndicator;
  240.  
  241.   Pointer to the indicator, nil if the indicator does not exist.
  242.  
  243. Buffer: PEditBuffer;
  244.  
  245.   Pointer to the buffer used to hold the text.
  246.  
  247. BufSize: Word;
  248.  
  249.   Size of Buffer.
  250.  
  251. BufLen: Word;
  252.  
  253.   The amount of text currently in buffer.
  254.  
  255. GapLen: Word;
  256.  
  257.   The size of the "gap" between the text before the cursor and
  258.   the text after the cursor. See above description of the "gap."
  259.  
  260. SelStart: Word;
  261.  
  262.   Starting offset of the selection.
  263.  
  264. SelEnd: Word;
  265.  
  266.   Ending offset of the selection.
  267.  
  268. CurPtr: Word;
  269.  
  270.   Offset of the cursor.
  271.  
  272. CurPos: TPoint;
  273.  
  274.   Line/Column location of the cursor in the file.
  275.  
  276. Delta: TPoint;
  277.  
  278.   The top line and left most column shown in the view.
  279.  
  280. Limit: TPoint;
  281.  
  282.   The maximum number of columns to display, and the number of lines
  283.   in the file. Records the limits of the scroll bars.
  284.  
  285. DelCount: Word;
  286.  
  287.   Number of characters in the end of the gap that were deleted
  288.   from the text. Used to implement undo.
  289.  
  290. InsCount: Word;
  291.  
  292.   Number of characters inserted into the text since the last
  293.   cursor movement. Used to implement undo.
  294.  
  295. IsValid: Boolean;
  296.  
  297.   True if the view is valid. Used by the Valid method.
  298.  
  299. CanUndo: Boolean;
  300.  
  301.   True if the editor is to support undo.
  302.  
  303. Modified: Boolean;
  304.  
  305.   True if the buffer has been modified.
  306.  
  307. Selecting: Boolean;
  308.  
  309.   True if the editor is in selecting mode (i.e., ^K^B has been
  310.   pressed).
  311.  
  312. Overwrite: Boolean;
  313.  
  314.   True if in overwrite mode, otherwise the editor is in insert
  315.   mode.
  316.  
  317. AutoIndent: Boolean;
  318.  
  319.   True if the editor is in autoindent mode.
  320.  
  321.  
  322. Methods
  323. -------
  324. constructor Init(var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar;
  325.   AIndicator: PIndicator; ABufSize: Word);
  326.  
  327.   Creates a TEditor object with the given scroll bars and indicator,
  328.   and with a buffer of size ABufSize. Options are set to
  329.   sfSelectable and the EventMask additionally allows handling of
  330.   broadcast events. Any of AHScrollBar, AVScrollBar or
  331.   AIndicator can be nil if you do not want to use them.
  332.  
  333. constructor Load(var S: TStream);
  334.  
  335.   Creates and initializes a TEditor object off the given stream.
  336.   It does not load the previous contents of the buffer, but
  337.   instead initializes the buffer to empty.
  338.  
  339. function BufChar(P: Word): Char;
  340.  
  341.   Returns the P'th character in the file, factoring in the gap.
  342.  
  343. function BufPtr(P: Word): Word;
  344.  
  345.   Returns the offset into Buffer of the P'th character in the
  346.   file, factoring in the gap.
  347.  
  348. procedure ChangeBounds(var Bounds: TRect); virtual;
  349.  
  350.   Overridden to ensure the file stays within view if the parent
  351.   size changes.
  352.  
  353. procedure ConvertEvent(var Event: TEvent); virtual;
  354.  
  355.   Converts key events into command events. Used to implement the
  356.   WordStar key-bindings. Override if you wish to change or
  357.   extend the default key-bindings.
  358.  
  359. function CursorVisible: Boolean;
  360.  
  361.   Returns true if the cursor (or insertion point) is visible
  362.   within the view.
  363.  
  364. procedure DeleteSelect;
  365.  
  366.   Deletes selection if one exists.
  367.  
  368. procedure DoneBuffer; virtual;
  369.  
  370.   Called whenever the buffer should be disposed. By default it
  371.   calls FreeMem with Buffer and BufSize. It should be overridden
  372.   if you wish not to use the heap to store the buffer. This is
  373.   done in TFileEditor.
  374.  
  375. procedure Draw; virtual;
  376.  
  377.   Overridden to draw the editor. This should not be overridden
  378.   by descendants of TEditor.
  379.  
  380. function GetPalette: PPalette; virtual;
  381.  
  382.   Returns the Editor palette, CEditor. Override if you wish to
  383.   change the palette of the editor.
  384.  
  385. procedure HandleEvent(var Event: TEvent); virtual;
  386.  
  387.   Provides the event handling for the editor. Override if you
  388.   wish to extend the commands the editor handles.
  389.  
  390. procedure InitBuffer; virtual;
  391.  
  392.   Called whenever the buffer should be allocated. By default, an
  393.   editor will call GetMem with Buffer and BufSize. You should
  394.   override this method if you do not want the editor to allocate
  395.   the buffer from the heap.
  396.  
  397. function InsertBuffer(var P: PEditBuffer; Offset, Length: Word;
  398.   AllowUndo, SelectText: Boolean): Boolean;
  399.  
  400.   This is the lowest-level text insertion method. It will
  401.   insert Length bytes of text from the given pointer to text into
  402.   the buffer from the given offset into the buffer, P. It will
  403.   optionally record undo information and select the text
  404.   inserted. This method need never be called directly, since it
  405.   is called from InsertFrom and InsertText. This method should
  406.   be used if the buffer to be copied from could move (e.g., P was
  407.   allocated using the Buffers unit).
  408.  
  409. function InsertFrom(Editor: PEditor): Boolean; virtual;
  410.  
  411.   Insert the selection from the given editor into this editor.
  412.   This method is used to implement Cut, Copy, and Paste. It need
  413.   never be overridden by the user.
  414.  
  415. function InsertText(Text: Pointer; Length: Word;
  416.   SelectText: Boolean): Boolean;
  417.  
  418.   Insert the given text of length Length into the buffer,
  419.   optionally selecting the text. This is an easier-to-use
  420.   version of InsertBuffer.
  421.  
  422. procedure ScrollTo(X, Y: Integer);
  423.  
  424.   Move column X and line Y to the upper-left corner of the editor.
  425.  
  426. function Search(FindStr: String; Opts: Word): Boolean;
  427.  
  428.   Search for the given string in the editor with the given
  429.   options. The options words are,
  430.  
  431.     efCaseSensitive      Case sensitive search
  432.     efWholeWordsOnly     Find whole words only
  433.  
  434.  
  435. function SetBufSize(NewSize: Word): Boolean; virtual;
  436.  
  437.   Called whenever the buffer can be grown or shrunk to the given
  438.   value. It should return true if the the buffer can be of the
  439.   given size. By default, it returns true if NewSize is less than
  440.   or equal to the new size.
  441.  
  442. procedure SetCmdState(Command: Word; Enable: Boolean);
  443.  
  444.   Disables or enables the given command. The command is always
  445.   disabled if the editor is not the selected view. Used as a
  446.   convenient way to enable and disable command instead of using
  447.   EnableCommands and DisableCommands.
  448.  
  449. procedure SetSelect(NewStart, NewEnd: Word; CurStart: Boolean);
  450.  
  451.   Set the selection to the given offsets into the file. This
  452.   method will either place the cursor in front of behind the
  453.   selection pending on the value of CurStart.
  454.  
  455. procedure SetState(AState: Word; Enable: Boolean); virtual;
  456.  
  457.   SetState is overridden to hide and show scroll bars and the
  458.   indicator and to enable and disable commands. If you wish to
  459.   enable and disable additional commands, override UpdateCommands
  460.   instead. This is called whenever the command states should be
  461.   updated.
  462.  
  463. procedure Store(var S: TStream);
  464.  
  465.   Stores the editor on the given stream.
  466.  
  467. procedure TrackCursor(Center: Boolean);
  468.  
  469.   Forces the cursor to be visible. If Center is True, the
  470.   cursor is forced to be in the center of the screen in the Y
  471.   access. The X, or column, is not changed.
  472.  
  473. procedure Undo;
  474.  
  475.   Undo the changes since the last cursor movement.
  476.  
  477. procedure UpdateCommands; virtual;
  478.  
  479.   Called whenever the commands should be updated. This is used
  480.   to enable and disable commands such as cmUndo, cmClip, cmCopy,
  481.   etc.
  482.  
  483. function Valid(Command: Word): Boolean; virtual;
  484.  
  485.   Returns whether the view is valid given Command. By default it
  486.   returns the value of IsValid which is True if Buffer is non-nil.
  487.  
  488.  
  489. TMemo
  490. -----------------------------------------------------------------
  491.  
  492. Methods
  493. -------
  494. constructor Load(var S: TStream);
  495.  
  496.   Creates and initializes a TMemo object off the given stream.
  497.  
  498. function DataSize: Word; virtual;
  499.  
  500.   Returns the size of the data written by GetData and read by
  501.   SetData. By default it return SizeOf(Word) + BufSize.
  502.  
  503. procedure GetData(var Rec); virtual;
  504.  
  505.   Writes the contents of the buffer into the given Rec.
  506.  
  507. function GetPalette: PPalette; virtual;
  508.  
  509.   Returns a palette, CMemo, suitable for TMemo's use in a
  510.   TDialog.
  511.  
  512. procedure HandleEvent(var Event: TEvent); virtual;
  513.  
  514.   Prevents TMemo from handling kbTab, otherwise handles events the
  515.   same as a TEditor.
  516.  
  517. procedure SetData(var Rec); virtual;
  518.  
  519.   Read the contents of the buffer from the given Rec.
  520.  
  521. procedure Store(var S: TStream);
  522.  
  523.   Store the TMemo to the given stream.
  524.  
  525.  
  526. TFileEditor
  527. -----------------------------------------------------------------
  528.  
  529. Fields
  530. ------
  531.  
  532. FileName: FNameStr;
  533.  
  534.   Name of the file being edited.
  535.  
  536.  
  537. Methods
  538. -------
  539. constructor Init(var Bounds: TRect;
  540.   AHScrollBar, AVScrollBar: PScrollBar;
  541.   AIndicator: PIndicator; AFileName: FNameStr);
  542.  
  543.   Creates a TFileEditor object with the given scroll bars and
  544.   indicator and loads the contents of the given file. If the
  545.   file is not found or invalid an error message will be displayed
  546.   and the object's Valid method will return false. Options are
  547.   set to sfSelectable and the EventMask additionally allows
  548.   handling of broadcast events. Any of AHScrollBar, AVScrollBar
  549.   or AIndicator can be nil if you do not want them.
  550.  
  551. constructor Load(var S: TStream);
  552.  
  553.   Creates and initializes a TFileEditor object off the given
  554.   stream. The file is reloaded into the editor and the cursor is
  555.   positioned back to the location it was when the Store was
  556.   performed. It is ideal for use with a "Desktop save" option.
  557.  
  558. procedure DoneBuffer; virtual;
  559.  
  560.   Disposes of the buffer allocated from the Buffers unit.
  561.  
  562. procedure HandleEvent(var Event: TEvent); virtual;
  563.  
  564.   Overridden to implement the cmSave and cmSaveAs commands.
  565.  
  566. procedure InitBuffer; virtual;
  567.  
  568.   Allocates memory from the Buffers unit to use for the editor
  569.   buffer.
  570.  
  571. function LoadFile: Boolean;
  572.  
  573.   Read the file from disk and check for errors. Sets IsValid to
  574.   False if the file was not loaded into the buffer.
  575.  
  576. function Save: Boolean;
  577.  
  578.   Saves the file to disk. Returns false if the save failed or
  579.   was canceled. If EditorFlags has the efBackupFiles bit set, a
  580.   .BAK file is created. Will call SaveAs if the editor is
  581.   "Untitled."
  582.  
  583. function SaveAs: Boolean;
  584.  
  585.   Saves the editor with a different name. The name is derived
  586.   from a dialog brought up using the EditorDialogs function
  587.   pointer. Returns True if the editor was saved, False otherwise
  588.   (i.e., the operation was canceled).
  589.  
  590. function SaveFile: Boolean;
  591.  
  592.   Saves the file to disk. Returns False if the save failed. If
  593.   EditorFlags has the efBackupFiles bit set, a .BAK file is
  594.   created.
  595.  
  596. function SetBufSize(NewSize: Word): Boolean; virtual;
  597.  
  598.   Overridden to grow and shrink the buffer with calls to the
  599.   Buffers unit. Will grow and shrink the buffer in 4k
  600.   increments.
  601.  
  602. procedure Store(var S: TStream);
  603.  
  604.   Store the TFileEditor object on the given stream. The file
  605.   name, not the file contents, are stored on the stream.
  606.  
  607. procedure UpdateCommands; virtual;
  608.  
  609.   Overridden to enable and disable the cmSave and cmSaveAs
  610.   commands. They are only valid if the selected view is an
  611.   editor, otherwise they should be disabled.
  612.  
  613. function Valid(Command: Word): Boolean; virtual;
  614.  
  615.   Overridden to make sure the file is saved before the program
  616.   exits. Returns False if the user cancels the save.
  617.  
  618.  
  619. TEditWindow
  620. -----------------------------------------------------------------
  621.  
  622. Fields
  623. ------
  624.  
  625. Editor: PFileEditor;
  626.  
  627.   Pointer to the editor object in the edit window.
  628.  
  629. constructor Init(var Bounds: TRect; FileName: FNameStr;
  630.   ANumber: Integer);
  631.  
  632.   Creates a TEditWindow object that will edit the given file
  633.   name with window number ANumber. This method initializes a
  634.   TFileEditor with scroll bars and an indicator. If the file
  635.   name is a null string, it is assumed to be an untitled file. If
  636.   Editor is equal to the Clipboard variable, the editor is assumed
  637.   to be the clipboard.
  638.  
  639. constructor Load(var S: TStream);
  640.  
  641.   Creates and initializes a TEditWindow off the given stream.
  642.  
  643. procedure Close; virtual;
  644.  
  645.   Overridden to hide, instead of close, the window if the editor
  646.   is a clipboard.
  647.  
  648. function GetTitle(MaxSize: Integer): TTitleStr; virtual;
  649.  
  650.   Returns the name of the file being edited by the editor or
  651.   'Clipboard' if the editor is the clipboard.
  652.  
  653. procedure HandleEvent(var Event: TEvent); virtual;
  654.  
  655.   Handles cmUpdateTitle to redraw the frame of the window. Used
  656.   in SaveAs to change the title of the window if the file being
  657.   edited changes names.
  658.  
  659. procedure Store(var S: TStream);
  660.  
  661.   Saves the TEditWindow object to the given stream.
  662.  
  663.  
  664. TIndicator
  665. -----------------------------------------------------------------
  666.  
  667. Fields
  668. ------
  669.  
  670. Location: TPoint;
  671.  
  672.   Stores the location to display. Updated by a TEditor.
  673.  
  674. Modified: Boolean;
  675.  
  676.   True if the associated TEditor has been modified. Displays a
  677.   special character if true.
  678.  
  679. Methods
  680. -------
  681.  
  682. constructor Init(var Bounds: TRect);
  683.  
  684.   Creates a TIndicator object.
  685.  
  686. procedure Draw; virtual;
  687.  
  688.   Draws the indicator.
  689.  
  690. function GetPalette: PPalette; virtual;
  691.  
  692.   Return the a pointer to CIndicator, the TIndicator default
  693.   palette.
  694.  
  695. procedure SetState(AState: Word; Enable: Boolean); virtual;
  696.  
  697.   Draws the indicator in the frame dragging color if dragging.
  698.  
  699. procedure SetValue(ALocation: TPoint; AModified: Boolean);
  700.  
  701.   Method called by TEditor to update the values to the fields of
  702.   a TIndicator.
  703.  
  704.  
  705.  
  706.  
  707.                              Globals
  708.                              -------
  709.  
  710. Variables
  711. ---------
  712. WordChars: set of Char;
  713.  
  714.   Set of characters that define a word. Used when handling the
  715.   cmWordLeft and cmWordRight commands. The default value is
  716.   ['0'..'9', 'A'..'Z', '_', 'a'..'z'].
  717.  
  718. EditorDialog: TEditorDialog;
  719.  
  720.   EditorDialog is a procedure variable that is used by TEditor
  721.   objects to display various dialogs. Since dialogs are very
  722.   application-dependent, EDITORS cannot display its own dialogs.
  723.   Instead it calls this function variable instead. For an
  724.   example of an EditorDialog function, see TVEDIT.PAS. The various
  725.   dialog values are
  726.  
  727.     edOutOfMemory
  728.     edReadError
  729.     edWriteError
  730.     edCreateError
  731.     edSaveModify
  732.     edSaveUntitled
  733.     edSaveAs
  734.     edFind
  735.     edSearchFailed
  736.     edReplace
  737.     edReplacePrompt
  738.  
  739.  
  740. EditorFlags: Word;
  741.  
  742.   EditorFlags contains various flags for use in the editor. The
  743.   value of which are
  744.  
  745.     efCaseSensitive         Default to case sensitive search
  746.     efWholeWordsOnly        Default to whole words only search
  747.     efPromptOnReplace       Prompt on replace
  748.     efReplaceAll            Replace all occurrences.
  749.     efDoReplace             Do replace.
  750.     efBackupFiles           Create .BAK files on saves.
  751.  
  752.   The default value is efBackupFiles + efPromptOnReplace.
  753.  
  754. FindStr: String[80];
  755.  
  756.   Stores the last value used for a find.
  757.  
  758. ReplaceStr: String[80];
  759.  
  760.   Stores the last value of a replace.
  761.  
  762. Clipboard: PEditor = nil;
  763.  
  764.   Pointer to the clipboard. Any TEditor can be the clipboard, it
  765.   just needs be assigned to this variable. The clipboard should
  766.   not support undo (i.e., its CanUndo should be false).
  767.  
  768. Procedures
  769. ----------
  770.  
  771. procedure RegisterEditors;
  772.  
  773.   Register all object types in EDITORS.
  774.