The Thot Editor Architecture

Abstract

Thot Editor is a large piece of software. If you want to change it or extend it in some way, you may experiment some difficulty in finding out the right part to be modified in the code. The purpose of this note is to help you understand the Thot Editor architecture and find your way in the source code.

Contents

1 Architecture

1.1 Document representations

1.2 Software components

2 Changing and extending Thot Editor

2.1 Changing menu bars and pull-down menus

2.2 Changing the button bar

2.3 Changing default document presentation

2.4 Creating new views

2.5 Adding new HTML tags and attributes

2.6 Modifying existing commands

2.7 Creating new editing commands

2.8 Adding new structure transformations

2.9 Configuring Thot Editor

1 Architecture

Thot Editor is an application based on Thot. Thot is a generic tool kit intended to build document based applications, with a structured approach to the document model. Basically, Thot provides a set of document manipulations functions with an API and allows applications to include additional functions through a callback mechanism. It can also includes a simple declarative language to generate the user interface of an application.

1.1 Document representations

Different document representations are maintained or generated by Thot Editor:

Document structure and contents
Each document is represented by a tree within Thot Editor. This tree represents the document structure. Its leaves contain the actual text. This tree structure is constrained by some rules that are specified in a Thot structure schema (files suffixed by .S in directory schemas), written in the S language (see the language manual).

Names of element types and attributes in structure schemas are not those that the user actually sees on the screen. Correspondence between internal and external names is given by files suffixed by en and fr in directory amaya.

Document presentation and views
The internal tree structure only represents the logical structure of documents. The graphical aspect of these documents is specified by a Thot presentation schema (files suffixed by .P in directory schemas), written in the P language (see the language manual).

The presentation schema specifies all possible views of documents and the aspect of these documents in each view. It also specify how documents should be formatted for printing.

Thot Editor uses a single source file (.P) to specify different presentation schemas, using conditional compilation (see variables PAGE, BLACK_WHITE, US_PAPER).

Document output
While editing, Thot Editor works on the internal tree structure. Document may be exported to various formats when saving a document. The tree structure is written in the output file according to a Thot translation schema (files suffixe by .T in directory schemas), written in the T language (see the language manual).

1.2 Software components

The main software components involved in Thot Editor are the following:

Graphical user interface
The Thot Editor user interface contains three types of widgets:
Standard editing functions
A number of basic editing functions are simply standard Thot functions. The name of these functions start with Ttc.
Specific editing functions
In addition to the standard functions, Thot Editor has its own editing functions.

2 Changing and extending Thot Editor

A number of modifications to Thot Editor can be made without modifying the C code. As explained above, the behavior of Thot Editor is defined by a number of schemas and other files that can be modified easily, as they are written in very simple declarative languages. Prior to making any change to the source code, it's worth considering modifications to these files.

2.1 Changing menu bars and pull-down menus

You may want to change the user interface. The simplest change you can make is modifying the menu bars and the pull-down menus.

There is a menu bar on top of each window handled by Thot Editor. Notice that the contents of these menu bars vary according to the view displayed in the window.

All menu bars and the corresponding pull-down menus are defined in file EDITOR.A (directory thot). Update that file for defining your own menu bars (it is written in the A language, which is documented in The Thot Application Generation Language). Then, you just have to make thot.

If you want the new (or existing) menus and their items to be available in different languages, don't forget to update the xx-thotdialogue file (in directory config), where xx is the language name (for instance, en for English or fr for French).

2.2 Changing the button bar

You can change the button bar of the formatted view in many ways. You can

For all these changes, you have to edit the function ApresOuvreVue in module thot/EDITORactions.c and to make thot.

2.3 Creating new editing commands

To create new commands, you have to define their user interface (add a new menu to a menu bar, a new item to an existing menu and/or a new button to the button bar) and to write the code of the corresponding function.

2.4 Configuring Thot Editor

Users can configure Thot Editor in various ways, just by editing some configuration files. This is described in the document Configuring Thot Editor.


V. Quint
$Date: 1997/02/07 00:04:51 $