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.
This class inherits its hyperlink mechanism (the "Show Links" command in the "Format" menu) from the Tcl editor. However, because of the namespaces in Itcl, the references to procedures and methods are only identified if they are completely qualified. For example, "::tycho::EditTcl" will be identified as a link, but "EditTcl" will not. Unfortunately, since Itcl-2.0 is dynamically scoped, it appears that there is no way around this.
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.
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 a
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
.