WiSE - A Wireless System Engineering Tool

7. User Interface Implementation

The user interface proper has two parts. The purely graphical and display components are written in Tcl/Tk, a public-domain system developed at UC Berkeley by John Ousterhout [5]. Tcl is a simple interpreted language at about the level of AWK or Perl or the C shell; it is meant for writing scripts of modest complexity, and for combining with C code into larger systems. Tk is an example of such C code, a library of widgets for the X window system that mimic the Motif widget set in functionality and appearance. The widgets include menu buttons, sliders, scales, scrollbars, and a general canvas widget for graphical operations; canvases are used for displaying the building plan and elevation views.

The second half of the interface is a C++ program that is controlled by the Tk part. The C++ program is responsible for reading and writing files, and for any substantial amount of arithmetic.

The division into two pieces is not mandatory, but has proven to be more efficient than other alternatives. In particular, although Tk widgets are generally very efficient (they are coded in C), some computations are slow; in particular, arithmetic is not fast, since Tcl converts all numbers from and to strings.

Tcl and Tk provide a remarkably flexible and effective tool for building interfaces; it has been possible to perform myriad experiments with the look and feel of the interface in response to suggestions and criticisms by users. It appears that development of interfaces with Tcl/Tk is at least an order of magnitude faster than with code written in C or C++, even with good libraries and other aids. The code is also relatively compact; for months the interface had less than 500 lines of Tcl and about 250 lines of AWK. The current version has 2450 lines of Tcl and 1200 lines of C++. There is also a separate program of about 1350 lines of C++ for the perspective view.

Previous Beginning Next