[tail]

Chapter 10
Other resources provided by the widget

In this chapter we describe resources included in TkZinc widget. This include bitmaps sets (used as symbols for some items or used as stipples), Perl modules goodies and TkZinc simple demonstrations.

10.1 Bitmaps

TkZinc creates two sets of bitmaps.

The first set contains symbols for ATC tracks position, waypoints position and maps symbols. These bitmaps are named AtcSymbol1 to AtcSymbol22.


PIC

Figure 10.1: Bitmaps available for position of tracks, waypoints, and maps


The second set provides stipples that can be used to implement transparency, they are named AlphaStipple0 to AlphaStipple15, AlphaStipple0 being the most transparent.


PIC

Figure 10.2: Bitmaps available for creating stipples


10.2 Tk::Zinc::Debug Perl module

Tk::Zinc::Debug.pm is a Perl module useful for debugging purpose. It can be used in a Perl application using TkZinc to display the hierarchical tree of items, to display items selected by their id or tags, to grab items with the mouse and to get the list of items enclosed or overlapped by a rectangle designated by the mouse. You will be presented a list of items, with many interesting attributes such as position, priority, visibility, group... and even more information on request. Much of the selected items attributes can be interactively modified. When an application uses Tk::Zinc::Debug.pm, you can get a short reminder by depressing the Esc key in the main window of this application. For more information, please refer to the Tk::Zinc::Debug.pm man pages with the classical command man Tk::Zinc::Debug

To use this module, you can import it either by adding, for example, the following statements in your source code:

  use Tk::Zinc::Debug;  
 
  finditems($zinc);  
  tree($zinc, -optionsToDisplay => '-tags', -optionsFormat => 'row');

or simply by using the -M option of Perl:

  perl -MTk::Zinc::Debug yourscript.pl

10.3 Tracing TkZinc methods call in Perl/Tk

TkZinc package includes two tools for helping you debugging your Perl/Tk scripts or tracking some nasty segfault which should never occure since TkZinc is (almost) totally bugfree.

10.3.1 Tracking Perl/Tk script errors

Because you sometime get some errors inside TkZinc with a cryptic message like ".... errors in Tk.pm line 228", it may be usefull to know where exactly in your code is the error. There is a simple and convenient mean to do this, just by using a small module called Tk::Zinc::TraceErrors, released with TkZinc. It traces every call of a TkZinc method inducing a Tk error. It prints on the standard output the following informations:

To use this module you can import it either by adding the following statement in your source code:

  use Tk::Zinc::TraceErrors;

or better, by using the -M option of Perl:

  perl -MTk::Zinc::TraceErrors yourscript.pl

10.3.2 Tracking TkZinc segfaults in Perl/Tk

If you encounters a segfault in one Perl/Tk script and you suspects that TkZinc might be responsible, you should use a small module called Tk::Zinc::Trace, released with TkZinc. It traces every call of a TkZinc method. The method call is printed on the standard output before the effective call, and the result of the invokation is printed after the call. To be sure to identify a segfault at the proper time, it forces an update of TkZinc widget. Thus, this might slow down your script, but should dramatically speed up the identification of the call which makes TkZinc segfaulting. It prints on the standard output the following informations:

To use this module you can import it either by adding the following statement in your source code:

  use Tk::Zinc::Trace;

or better, by using the -M option of Perl:

  perl -MTk::Zinc::Trace yourscript.pl

10.4 zinc-demos

Starting at version 3.2.4 of TkZinc small applications are included as demos. They are all accessible through an application called zinc-demos. These numerous (about 30) tiny demos are useful for newcomers and as starting points for developing real applications. They consists in toy applications, graphically advanced examples or even a TkZinc port of TkTetris from Slaven Rezic.

10.5 Tk::Zinc::Graphics Perl module

The Tk::Zinc::Graphics Perl module implements many high level functions for building high quality graphic objects with TkZinc.

Please read the man page for more details: man Tk::Zinc::Graphics, french version only currently. Any volontear to translate it in English?

NB: There is also a tcl version of this module.

10.6 Tk::Zinc::Text Perl module

The Tk::Zinc::Text Perl module implements bindings for text input ’a la emacs’. It works for text item or for text fields of track, waypoint or tabular items. The item which requires text input must just be tagged with the ’text’ tag.

Please read the man page for more details: man Tk::Zinc::Text

10.7 C api for adding new items

The C function AddItemClass provided with the source code of TkZinc, can be used to extent the default set of items in TkZinc in an additionnal dynamic library. The AddItemClass C function is extensively used for implementing the core item set. So please refer to the source code for examples or send email for more information on precise problems.

We will try to further document this feature in the future.

10.8 C++ api to TkZinc

In the course of the development of IntuiKit, IntuiLab developed a C++ API to TkZinc. This wrapper gives access to functions of TkZinc for opening/closing of a Tkzinc window, creating/destroying items, using colour gradients, events, access to the mainloop... directly in C++ by hiding the use of Tk. This source code (as well as samples and tests) are distributed with TkZinc. IntuiLab choose the same licence than TkZinc, ie LGPL. The C++ API does not fully cover all TkZinc functions, but most of them can be easily extended (e.g. the access of some ATC items currently not wrapped such as track, waypoint, tabular...).

The C++ api is fully documented and have been largely tested by IntuiLab for its own need.

IntuiLab hopes this wrapper will be useful to the TkZinc community.

[front]