This class provides a text editor specialized for editing
Itcl source.
It is automatically invoked whenever you open any file with an
.itcl
extension or
.itk
extension.
Itcl is an object-oriented extension to the Tcl language
that was developed by Michael McLennan of AT&T Bell Labs.
(Itk is the associated extension to Tk).
The EditItcl class is derived from the
EditTcl class, and
therefore inherits all of its features.
It colors certain Itcl constructs, such as comments
and class and method definitions.
The Evaluate Body
command
in the File
menu evaluates the body of a method or proc.
Evaluate Body
is an excellent way to make changes
to Itcl code and then quickly re-evaluate the changes.
The Evaluate
command
in the File
menu
evaluates the Itcl code in the selection (if there is a selection) or
the entire file (if there is no selection). The returned result
is displayed.
In the case where the entire file is evaluated,
the editor first deletes any
classes that are defined within the file so that it can safely redefine
these classes. As a side effect, all instances of the classes and
all derived classes will also be deleted.
If these derived classes are not accessible by auto-loading,
then they must be manually reloaded.
Note that the Itcl auto-loading mechanism
implies some formatting restrictions on the syntax.
Specifically, class definitions must appear with the keyword "class"
starting in column zero and the class name following it on the same
line.
Moreover, the deletion of classes will only work properly if the class
names are fully qualified with all namespaces (the class names should
begin with ::
). If this is not the case, then there is no way
to tell from the syntax of the file what classes are actually being defined
(it depends on what namespace the file is evaluated in).
If the class name is not fully specified, we assume it is defined
in the global namespace only.
The Body Template
command in the Special
menu places a body template at the current point in the buffer.
An example body template would be:
##################################################################### #### myMethod # # body::tycho::ClassName::myMethod {} { }
The File Template
command in the Special
menu copies the file $TYCHO/editors/textedit/templates/ItclTemplate.itcl
into the editor and substitutes in a class name based on the file
name. For example, if the file is named Elvis.itcl
, then
the class name Elvis
will be substituted in where ever
the string ClassName
appears in ItclTemplate.itcl
.
The Test Template
command in the Special
menu copies the file $TYCHO/editors/textedit/templates/testTemplate.itcl
into the editor. The Tycho Testing system is documented in
$TYCHO/doc/coding/testing.html
.
The Generate doc
command in the Special
menu asks the user if they
would like to save the buffer and then runs the
Tydoc itcl to HTML
converter on the file and displays the results. Tydoc produces an
HTML file at
doc/codeDoc/className.html
. The
index.html
file in doc/codeDoc
is not
updated by Generate doc
since we are only passing one file to the
Tydoc system. To update index.html
, usually one runs
make itcldocs
, or uses the BuilderDialog.
The Class
Diagram
command in the Special
menu brings up
the Itcl Class List editor, which
allows the user to generate a class diagram from a user-supplied
list. Class diagrams
are documented separately.
For further information about Itcl, see the Tycho Itcl Internet Links.