CCrystalTextBuffer class is responsible for storing lines, loading and saving text to a file. To simplify Undo/Redo command implementations, every editing operation is split into a sequence of 'insert text' and 'delete text' actions. Accordingly, CView-derived classes are only intended to react only on this primitive operations.
CCrystalTextView class is the framework for text viewing window. It derives from CView, and it provides text painting code, overridable functions for syntax highlighting, different kinds of text selections, cursor movements, Find common dialog etc. However, it's not allowed to perform any changes to the text.
CCrystalTextView-derived views are usually used with CCrystalTextBuffer object. Once such a view is connected to the CCrystalTextBuffer object, it is capable to track changes made to the text. (Obviously, any number of views can be connected to a single CCrystalTextBuffer object at the same time. This is useful, when we need to use the editor in the dynamic splitter as shown on the figure above).
CCrystalEditView class is derived from CCrystalTextView class. Unlike its ansector, which is only able to display a text and update the view when it is needed, it has functions to perform all sorts of editing, including drag-and-drop and Replace dialog. Note, that the view does not make the changes in the text directly, instead, it transforms the command into a sequence of primitive operations described above, and delegates them to the CCrystalTextBuffer object. Once the changes are made, the CCrystalTextBuffer object updates all views connected to it.
Usually,
CCrystalTextBuffer exists within the
CDocument object. You must provide a way to connect views to the object (the best place for it is