Home
Downloading
Installing
Compiling
Using
Developing
|
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.
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.
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 schemas .
- 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 (file
s 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).
The main software components involved in Thot Editor are the following:
- Graphical user interface
-
The Thot Editor user interface contains three types of widgets:
-
A menu bar, at the top of each document window
This bar and all its menus, including cascading menus, are specified in a Thot
application schema (file EDITOR.A in directory
thot ) written in the A language (see the A language
manual).
-
A button bar below the menu bar, in the formatted view (when
editing structured drawings).
This button bar is created by Thot Editor at initialization time (see function
AttacherIcones in module drawlib/boutons.c ).
-
Various dialogue boxes
Some of these dialogue boxes are standard Thot library dialogue boxes, other
are created by the Thot Editor application. Both Thot library and Thot Editor
use the Thot dialogue module.
- 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.
-
Some functions are called from the menu bar (see file
EDITOR.A in directory thot ) and are implemented in
the C modules of directory thot .
-
Some functions are called from the button bar (see function
AttacherIcones in module drawlib/boutons.c ) and are
implemented in the C modules of directory drawlib .
-
Some functions are called from standard Thot editing commands. They are
defined in file
EDITOR.A (directory thot ) and
implemented in the C modules of directory thot . They implement
some specific treatments.
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.
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).
You can change the button bar of the formatted view in many ways. You can
-
remove buttons (most of them are equivalent to some menu item),
-
change their order,
-
change their icon,
-
add new buttons.
For all these changes, you have to edit the function
ApresOuvreVue in module thot/EDITORactions.c and to
make thot .
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.
Users can configure Thot Editor in various ways, just by editing some
configuration files. This is described in the document Configuring Thot Editor.
|