Stingray Studio : Objective Edit User’s Guide : Chapter 3 The Objective Edit Architecture
Chapter 3 The Objective Edit Architecture
Class Hierarchy
Objective Edit is an MFC extension class library that combines several classes into a library of MFC classes that you can link into an MFC application. This chapter briefly describes some of the classes and methods available to you. For more information, please refer to the Objective Edit Class Reference.
Objective Edit is built on top of the model-view-controller (MVC) architecture. This architecture affords greater flexibility for customizing than the MFC document/view architecture does, and provides the framework necessary for multiple undo and redo operation support.
The Stingray Foundation Library's implementation of MVC is a scalable architecture that supports the development of lightweight graphical components, and provides a flexible supplement or alternative to MFC's document/view architecture. MVC is designed to complement and extend existing frameworks, and it works seamlessly with both ATL and MFC. In addition to providing a solid foundation on which to build graphical components and document management services, SFL's MVC adds support for scrolling, zooming, coordinate mapping, and command undo and redo.
NOTE >> For details about the MVC architecture, please refer to the Stingray Foundation Library User Guide.
The major classes in Objective Edit include: SECEdit, SECEditBlockBuffer, SECEditCtrl, SECEditView, SECEditController, and SECEditLangConfig. We discuss each of these classes in the following sections.
SECEdit
SECEdit represents the data model for Objective Edit. It maintains a pointer to a data buffer containing the actual text, multiline comments, breakpoints, and language settings. The derivation from MvcTransactionModel, shown in Figure 3, provides the hooks into the MVC architecture. The model also acts as an observer of the language configuration object.
Figure 3 – The derivation of SECEdit
SECEditBlockBuffer
SECEditBlockBuffer contains the actual text data for the editor. The SECEdit model, which maintains a pointer to an object of this class, interacts with this text buffer object through the ISECEditBuffer interface. You can use any class implementing the ISECEditBuffer interface in its place. The derivation of SECEditBlockBuffer is given in Figure 4:
Figure 4 – The derivation of SECEditBlockBuffer
SECEditCtrl
SECEditCtrl is a CWnd derivative that implements an editor that can be embedded in other windows, such as a dialog window. This class represents the viewport through which Objective Edit renders text. The class derivation is given in Figure 5:
Figure 5 – The derivation of SECEditCtrl
SECEditView
SECEditView is a CView derivative that implements the editor as a view. This class is typically used in frame windows that are bound to a CDocument. Like SECEditCtrl, this class provides a viewport for rendering text, but also includes print/print preview support. The class derivation is given in Figure 6:
Figure 6 – The derivation of SECEditView
SECEditController
The controller class SECEditController is the part of the model-view-controller triad that accepts input from the user and updates the SECEdit model and the SECEditCtrl or SECEditView viewports. You can easily override methods of this class to customize the behavior of the editor. The class derivation is given in Figure 7:
Figure 7 – The derivation of SECEditController
SECEditLangConfig
Class SECEditLangConfig stores the language definition and settings. Language definitions consist of keywords, colorgroup definitions, delimiter keys, and operator symbols. Settings consist of font information, tab size, and other editor settings. The setting information can come from an.ini file, resources built into the application, or the registry. It is important to note that several SECEdit model objects observe a single instance of an SECEditLangConfig for any given language configuration, such as C++, HTML, VB, VBScript, and JavaScript. The derivation of SECEditLangConfig is given in Figure 8:
Figure 8 – The derivation of SECEditLangConfig