# Why a new implementation of the GTV library?

The GreG program lies on the so-called GTV library, a low level segment library. This library was written two decades ago, and not updated for several years. This was resulting in old-fashion graphical aesthetics for nowadays users, with some annoying constraints from other ages, e.g. windows which where not refreshed as often as the user would like.

For the maintainers point of view, the lack of experts of the source code was a big problem to fix bugs or improve any feature, especially with an old-fashion source code. Finally the status was usual rule in such a case: “If you don't touch it you don't break it”.

It was decided in 2007 to act before reaching the non-return point. In particular it was time to cut the dependency with the old widget library Motif (and its various implementations giving more or less satisfying results). The choice was made to use GTK instead, a well-known widget library for Linux users (but also supported on MS Windows and Mac OSX), and actively developed by the community. This was a first part of the work.

Another key piece is that GTV could only do one action at a time. By action one have to understand: storing a new plot coming from a user command, or drawing in one window, or plotting an hardcopy, etc. In particular this explains why the windows could not all be refreshed when desired. From the developers point of view, it was due to the fact that a large amount of the drawings were performed with global variables (some of them were internal to the library, but some others were the user property!). Thanks to modern Fortran features (namely derived types and pointers), the majority of the variables are not global anymore, but are passed to the drawing routines through a small number of structures describing the plot and its destination.

Finally, thanks to the above point, it was possible to implement GTV as a multi-threaded library: the user can work on its data while all its X windows are automatically refreshed or updated.

In this new context, the field is open for new and modern graphical tools. For example, a lens is already available: a popup window can be opened to zoom and browse a plotting window with the cursor. And more tools are already considered for the future.