Chapter 7. Tcl/Tk Parser-Converter to SVG

Table of Contents


This module modifies the parsing section of »vgcode.tcl«. Its purpose: allow a general –non-specific– mechanism to generate SVG code for each window. Windows are mostly simple rectangles from the SVG perspective. Only templates containing canvas are dealt with in details.

Exceptions, too: • text windows, the content of a text window can be mapped onto a text section with multiple tspan subsections. These allows also to cover text based windows such as »tablelist«.

• Listbox, a listbox contains text elements much simpler than a text window. The content must be clipped.

• Entry, same as listbox.

• Gistbox, this shall be handled in more specific ways. A gistbox can be constructed as a »contour«.

• Goolbar, gridwin, combobox, tree, statusbar, gstripes, ... the typical canvas based (or striped windows) from the RTL and Gestalt Items.

• Zinc, requires almost the same effort as does PathCanvas, most of this coding will be done inside the svgDumper file.

This modul extends »vgcode.tcl« and therefore features the namespace vgcode and not svgcode.

The packages base64 is necessary for this modul, any image intended for SVG is base64 encoded and will be embedded inside a SVG file. Either inside the <defs/> section or, if needed, directly where it is used.

In contrast to the conventional code generation process, only the simple code model is allowed inside this modul. This makes it possible to access the window under scrunity to be examined at every point during the generation.

Changes to the Implementation: dump-configure getOptions

The dump-children and dump-widget have to be reimplemented. Dump-children must ignore non-mapped windows and also any window obscured by other windows shall be ignored, too. Won't be fully possible– In addition the analysis related to non primitive classes –composit– is to be ignored at all. Maybe change the implementation for tclDumper, to relocate the window creation toward dumper (shouldn't be part of vgcode at all). In consequence, not may composit windows will survive the parser at all. These exceptions must be controllable some way in-order to allow higher order access and composit rules. Need to preserve functionality inside the generated SVG.

dump-children and dump-widget are straight tree-walker. There is a difference for children of . (which are templates normally) and deeper down. The same applies for toplevel windows.

package require tkParser package require base64 package provide svgParser 1.0 package provide svgCode 1.0