Enhancements to Legacy Printing using 4.6xx maps - E4000048 - 6 Jan 2005

This download includes updated 4.621 compatible components that can give improved results when printing GUI style maps to a legacy print device (i.e. not using DFPRINT).

The Problem

When a 4.6xx map is output to a legacy print device the DP4 terminal manager must convert the map's internal coordinates, which are essentially pixel based, to a crude row/column approximation. Up until now this conversion has been hard coded at 32 internal units vertically equals one row.

For maps intended only for printing this works well. However, if the map is also used in dialogs and contains edit controls, then the edit controls will typically be separated by at least 40 internal units (maps converted from 4.5xx using -smarten typically use 48 units). This means that the output from such a map will contain blank lines.

The Ideal Solution

The correct solution would be for each control in a map to have both a pixel based coordinate system, and a row/column coordinate system. Such a solution would facilitate using 4.6xx maps in console applications, which is not currently supported.

Unfortunately such a solution is not compatible with the existing 4.6xx map architecture, and would require base dictionary changes.

The Stop-gap Solution

The MAPEDIT in the download allows you to specify two additional properties for the map control: an X and Y factor for Legacy printing. If values are set for these, the values will be used for printing to traditional DP4 print devices. For example for map 6 of the DFSETUP mapset, the edit controls are spaced 48 units apart, so an appropriate Y factor is 48. This causes some compression of the upper part of the map where there are no edit controls, but gives better results than the default value of 32. The solution will work well provided all controls are well aligned on a fixed size grid.

Please note that the values for X and Y factor must always be expressed in the "internal" coordinate system, even if you have configured mapedit to use pixel based coordinates.

6 January 2005. The download has been updated to add support for a new DP4 C API: map_get_metrics() which is required to retrieve correct dimensions for a map that is being printed to a legacy printer and which uses the new enhancement. To retrieve the actual row and column print dimensions in use when printing to a legacy printer replace calls to map_get_depth(mapnr) this code:

map_get_metrics(mapnr,MPM_PRINT,&width,&depth);

map_get_metrics() is a BOOLEAN function that expects four parameters: int mapnr, int flags,int * width,int * depth. the width and depth are set to the row and column dimensions of the map. If one or other value is not required you can pass NULL (0) as the pointer. The return value is TRUE unless the map does not exist. In the latter case depth and width will be set to 0.

The updated components are in fact all 4.622 components. The download now contains a number of other 4.622 files which must be upgraded at the same time.

DP4 Version Compatibility

4.621, provided all components used together and sys621.prn file applied to system database with mappost.

Downloads

Updated run-time 4.622 components for use with 4.621 DP4 release
Updated C library and include files containing map_get_metrics() function

For 4.622 obtain an updated complete 4.622 release from the DP4 FTP site. 621a.zip on the FTP site includes the executable files for this and all other 4.621 compatible enhancements.