GLG 3.6 Release: New Features and Enhancements

Overview
Java Script Support
New Text Object Types, Text Scaling and Other New Text Attributes
Indexed Colors
Creating Drawings for Different Aspect Ratios
Miscellaneous GLG Editors' Interface Improvements
    Improved Text Edit Behavior in GLG Editors

    Selecting All Text on Focus in GLG Editor's Dialogs
   
Maintaining Icon's Aspect Ratio
   
Using Directional Arrows for Non-Color Attributes of G Type
   
Cut and Paste Shortcuts for Text Boxes on Unix/Linux
   
Specifying a List of Files to be Edited
    New HMI Configurator Layout
    Manual Widget Positioning Option
    Access to Chart Properties in the HMI Configurator
Miscellaneous New Features
    Executing Actions on Button Release

   
Improved Handling of ARMED and UNARMED Actions Attached to the Same Object
   
Select All on Focus in Text Boxes
   
Tab Traversing
   
Persistent Attribute of a Chart
   
Viewport's Pan Attribute is Extended to Native Widget Objects
   
New Widgets and Widget Palettes
   
Constraint Loop Detection to Prevent Crashes
   
Map Transformation
   
New Attributes of Screen Offset and Screen Scale Transformations
    Improved rendering of arcs, splines and rounded rectangles in Java
    Expanded Logging
   
New Global Configuration Resources
   
Updated GTK3 and GTKMM3 Integration
New GLG API Methods and Features
Interface Changes
New Map Server Features
Bug Fixes

Overview

The new 3.6 release of the GLG Toolkit includes the following major new features:

Java Script Support

The added support for Java Script makes it possible to define custom functions for converting several input values into an output value that drives animation. The Java Script is utilized via a new Java Script transformation that can be added to object properties. For example, a new LED Value Display widget uses a Java Script transformation to implement the widget's logic.

The Java Script property of the transformation contains the Java Script code used to produce the output value. The transformation's Arg List property supplies a variable number of arguments used in the script via the $N notation, where N is a 1-based argument index (i.e. $1 is the first argument). The arguments may be of either double (D), string (S) or XYZ (G) type. The output value of the Java Script transformation can be of the D, S or G type as well, matching the type of the property it is attached to.

For example, the following Java Script may be used to set the value of a D attribute to a sin function of the first argument that specifies an angle in degrees:

   Math.sin( $1 / 180. * Math.PI )

The following Java Script can be used to toggle a text string displayed in a text object between "NORMAL" and "ALARM" based on the value of the first argument and the value of thresholds defined by the second and the third arguments:

   $1 < $2 || $1 > $3 ? "ALARM" : "NORMAL"

For complex Java Scripts, a library of Java Script functions and methods can be provided via a Java Script file. When this file is loaded, the Java Script functions defined in the file can be used in Java Scripts used in a drawing.

An application can use a global Java Script file containing a collection of Java Script methods to be used in the application's drawings. This file will be preloaded and used as a Java Script library. A viewport's JavaScriptFile attribute can also be used to define a Java Script file to be preloaded for that viewport. All loaded Java Scripts are global and can be accessed anywhere in an application. A function loaded from a Java Script file will overwrite any previously defined Java Script functions with the same name.

Java Script is supported in the GLG editors and all GLG APIs: C/C++, Java, C# and ActiveX on Windows. Java Script support for C/C++ and ActiveX is provided by the Duktape JavaScript Engine, and for C# the Jurassic JavaScript engine is used (provided by the Jurassic.dll). In Java, the Java's native JavaScript engine is used.

All Java Scripts are precompiled at the drawing setup time for a faster run time performance. The scripts are also cached: only one instance of a compiled script is used for multiple copies of the same Java Script used in different transformations.

The GlgJavaScriptFile global configuration resource or the GLG_JAVA_SCRIPT_FILE environment variable can be used to specify a global Java Script file.  For the GLG Builder and the GLG HMI Configurator, a global Java Script file can also be supplied via either the -glg-java-script-file command line option, or the GlgJavaScriptFile resource in the GLG configuration file, i.e. glg_config or glg_hmi_config.

New Text Object Types, Text Scaling and Other New Text Attributes

Examples of WRAPPED and TRUNCATED text objects
A new WRAPPED text object automatically wraps long text lines at the word boundaries to fit into the box defined by the text object's control points.

A TRUNCATED text object truncates long lines to fit into the box, adding ellipsis at the end of each truncated line. The WRAPPED & TRUNCATED text type does both, i.e. wrapping long lines at the word boundaries and truncating the text if it still does not fit.

A new TextScaling attribute controls scaling of both FIXED, WRAPPED and TRUNCATED text objects. This new text scaling functionality does not need a bounding box which was required to scale the SCALED text in previous releases. The text scaling is now supported for the FIXED text type with one control point.

Since other text types are now also scalable via the TextScaling attribute, the SCALED text type was renamed to FIT TO BOX in the new release.

If the TextScaling attribute is set to ZOOM, the text object's font size will be increased or decreased based on the zoom factor. The font sizes available for scaling are defined by the font table of the parent viewport. The text object's MinFontSize defines the minimal font size to be used. If MinFontSize=-1, the text will not be displayed if it is scaled down too much.

If the TextScaling attribute is set to RESIZE, the text object's font size will be increased or decreased proportionally to the size of its parent viewport. The viewport's BaseWidth attribute specifies the base width in pixels that is used as a staring point for scaling the text. If the viewport's width equals the base width, the text will be rendered in the font size specified by the text object's FontSize attribute. Otherwise, the font size will be adjusted to scale the text extent proportionally to the current viewport width. For example, if a scalable text object is used as a label in a push button, the BaseWidth of the button's viewport may set to 200. If the drawing containing the button is resized in such a way that the button width increases to 300, the button's label will be rendered using a bigger font.

If the TextScaling attribute is set to ZOOM & RESIZE, the text will be scaled on both zooming and resizing.

A new LineAnchoring attribute may be used to specify the anchoring of individual lines of a multi-line text object, which can be different from the anchoring type of the text object itself. For example, the text object's horizontal anchoring can be set to RIGHT, but the individual lines inside the text can be anchored to the left, as shown in the picture. By default, LineAnchoring is set to INHERIT FROM ANCHOR which is how it was handled in previous releases. For the rotated text, the LEFT, CENTER and RIGHT values of the attribute are relative to the direction in which the text is drawn instead of referring to the anchoring in the horizontal dimension.

A new AnchorOffset attribute defines an offset in screen pixels from the control point of a FIXED text and the text object's anchor, and is set to (0,0,0) by default. AnchorOffset may be used when a text is rendered next to a marker, with the text object's control point being constrained to the control point of the marker. The AnchorOffset can be set to a value slightly bigger than the marker's radius to maintain a fixed gap between the marker and the text object. For example, if a FIXED text object is displayed next to a marker with MarkerSize=9, setting text object's Anchoring=CENTER BOTTOM and AnchorOffset=-5 will display the text object above the marker with a small 5 pixel vertical gap between them.

Indexed Colors

Indexed colors are colors defined as an index into a color table instead of an RGB value. Using indexed colors makes it possible to specify colors in a global color table shared between multiple drawings. If the color table is changed, all drawings that use this table will display new colors.

Indexed colors are specified by using a negative value for the R component of the color's RGB, and setting the G and B values to zero.  The absolute value of an indexed color's R component will be interpreted as a 1-based index into the color table. For example, setting a polygon's FillColor to (-2,0,0) will use the second color from the indexed color table.

By default, the GLG editors use the indexed color table based on the colors defined in the custom color palette (Ctrl-click on the color palette in the GLG editor to display the custom color palette).

A custom color table can be provided by either an indexed color palette defined in a separate GLG drawing file, or a simple text file containing RGB values for indexed colors. The GlgIndexedColorTableFile and GlgIndexedColorFile global configuration resources, or the corresponding GLG_INDEXED_COLOR_TABLE and GLG_INDEXED_COLOR_FILE environment variables, are used to specify the color table for indexed colors. For the GLG editors, global configuration resources can be specified in the GLG configuration file.

Refer to the GLG documentation for more information on indexed colors.

Creating Drawings for Different Aspect Ratios

New entries were added to the File, New, Widget menu to create drawings that target different screen sizes and aspect ratios. When creating a resizable drawing, a user can choose from 1:1, 4:3 or 16:9 aspect ratios. When creating a fixed scale drawing, a user can use either a default drawing size defined in the configuration file (glg_config or glg_hmi_config), or specify a custom width and height of the drawing in screen pixels.

If the 1:1 ratio is selected for a resizable drawing, the drawing's default coordinate extent is set to (1000, 1000) for the X and Y dimensions, as defined by the viewport's screen SpanX and SpanY attributes. For the 4:3 aspect ratio, the drawing's coordinate extent will be 1200 by 900, and for the 16:9 ratio it will be 1600 by 900.

When the editing focus is in a viewport with a resizable content, the default coordinate span is highlighted by using a different shade of color for the area outside of the default coordinate span. When going down into a fixed scale viewports, the highlight is used to annotate the area corresponding to the viewport's size.

A new File, Adjust $Widget Size menu option
of the GLG Graphics Builder may be used to maximize the size of the top-level $Widget viewport while preserving the aspect ratio of the viewport's drawing. A new File, Resize Drawing option of the GLG HMI Configurator may be used to change width and height of fixed size drawings.

Miscellaneous GLG Editors' Interface Improvements

Improved Text Edit Behavior in GLG Editors

In the new release, the Text Edit dialog contains a Wrap toggle which can be used to wrap long text lines for convenience of editing. If the toggle is unchecked, scrollbars will be displayed to scroll the text.

Selecting All Text on Focus in GLG Editor's Dialogs

In the new release, the behavior of the text entry boxes in the GLG editor's dialogs was changed. Clicking on a text box or navigating to a text box using the Tab key selects all text in the text box. The selected text will be deleted when a new value is entered. To unselect, move the cursor inside the box using either the keyboard or the mouse.

This behavior can be turned off by changing the value of the GlgSelectAllOnFocus global configuration resource in the GLG configuration file.

Maintaining Icon's Aspect Ratio

In the previous releases, the aspect ratio of icons in the GLG Graphics Builder and the GLG HMI Configurator was not preserved when the window was stretched.  In the new release, the Builder and the HMI configurator scales all icons and dialogs when the window is resized, but preserves their aspect ratio when the window is stretched.

Using Directional Arrows for Non-Color Attributes of G Type

Directional arrows are now enabled in all dialogs for editing all non-color attributes of G type. The Move By amount used by the directional arrows is automatically adjusted depending on the type of the attribute being edited.

Cut and Paste Shortcuts for Text Boxes on Unix/Linux

Added support for Ctrl-X (Cut), Ctrl-C (Copy), Ctrl-V (Paste from the Clipboard) and Ctrl-Y (Paste from the Mouse Selection) to text boxes on Unix/Linux.

Specifying a List of Files to be Edited

In previous releases, a single drawing file could be specified on a command line when starting GLG Graphics Builder or the HMI Configurator. In the new release, multiple files can be specified. The last file in the list will be loaded in the GLG editor on startup, and the rest of the files will be added to the list of Recent Drawings for easy access.

In the Unix/Linux environment, wild cards may be used, for example *.g may be used to edit all drawing files in the current directory. The maximum length of the recent file list was increased from 10 to 30 to accommodate an larger number of files.

New HMI Configurator Layout

The HMI Configurator's layout has been changed to use an Object Palette of graphical primitives as a floating palette instead of a permanent palette displayed on the left side of the HMI Configurator. The palette can be displayed using the Shapes, Images and Text option of the Palettes menu. The area on the left of the Drawing Area previously used by the Object Palette now contains Zoom, Flip and other quick access icons.

Manual Widget Positioning Option

A new Options, Manual Widget Positioning menu option controls how widgets from the widget palettes are positioned in the drawing. If the option is unchecked, clicking on a widget in a widget palette inserts the widget in the drawing and positions it in the center of the visible area. If the option is checked, the widget can be positioned at a desired location by clicking in the drawing area with the mouse.

Access to Chart Properties in the HMI Configurator

The HMI Configurator's Properties dialog now provides buttons for editing properties of the Chart and Legend objects inside the selected Real-Time Chart widget. Previously, these properties were accessible for editing only via the Resources dialog.

Miscellaneous New Features

Executing Actions on Button Release

In the new release, support was added for executing actions on mouse button release. Previously, Action Objects were activated only on a MouseClick or mouse MoveOver event.

Improved Handling of ARMED and UNARMED Actions Attached to the Same Object

In the previous releases, it was not possible to execute an action only if the Control key was not pressed. This presented a problem when different actions had to be executed based on the Control key's state, with one action executed only if the Control was not pressed, and another executed only if the Control was pressed.

In the previous releases, actions with the ProcessArmed attribute set to ARMED were executed only if the action was "armed" by pressing the Control key. All other settings of the attribute executed the action regardless of the state of the Control Key.

In the new release, the ProcessArmed attribute may be set to either UNARMED_ONLY, ARMED_ONLY or ARMED & UNARMED value, providing more precise control over action execution.

COMPATIBILITY NOTE: For MouseOver actions with ActionType=SEND_EVENT, the subaction of a message object received by the Input callback is now set to ArmedChange when the event is raised or reset, due to the Control key being pressed or released. This is done to differentiate this event from the mouse moving over or away, and is different from the subaction used in the 3.5 release. The same subaction is also used for MouseClick events with ActionType=SEND_EVENT that are raised or reset by pressing or releasing the Control key.

Select All on Focus in Text Boxes

In the new release, the text input widgets can select all text when the focus is moved inside the widget. This feature can be activated or deactivated on per widget basis by setting the value of the widget's SelectAllOnFocus property.

This feature is turned on by default for dialogs in the GLG editors, as described above.

Tab Traversing

The new release introduces the GlgTabNavigation global configuration resource and the corresponding GLG_TAB_NAVIGATION environment variable that can be used to control which native input objects receive focus when the Tab (or Shift-Tab) key is used. When set to the default value of GLG_TAB_TEXT_BOXES, the focus is moved to the next text box when the Tab key is pressed. If it is set to GLG_TAB_TEXT_AND_BUTTONS, the push buttons and toggles are also included in the Tab traversing.

Persistent Attribute of a Chart

A new Persistent attribute of a real-time chart controls whether or not the chart's data are discarded when the chart or its plots are reset. If set to VOLATILE, the data will be discarded if the chart is deleted from the drawing; a plot's data will be discarded if the plot is deleted from the chart. If the attribute is set to PERSISTENT, the data will be preserved and will be displayed when the chart is added to the drawing, or the plot is added to the chart again.

Viewport's Pan Attribute is Extended to Native Widget Objects

In the new release, the viewport's Pan attribute controls display of the horizontal or vertical scrollbar in native input objects that support it, such as Text Edit and List. The AUTO_PAN masks are also supported when the automatic display of the corresponding scrollbar is supported on the deployment platform.

New Widgets and Widget Palettes

A new 3P Pipes palette in the Process Control widget set contains a collection of 3D pipes, elbows and flanges for process control drawings. Both fixed size and resizable 3D pipes are provided. The fixed size 3D pipes use a line width gradient and may contain multiple segments without a need for separate pipe elbow elements.

A new Password Text Input hides entered characters and can be used for entering passwords. The input hiding behavior is controlled by the text input's Format property set to "password".

To be compliant with the Java's security model, the GetWidgetPassword method is provided in the Java version for querying the entered password instead of the TextString resource used in the rest of the run time environments.

A new Text Edit widget displays multi-line text and supports either scrolling or wrapping long text lines. If the value of the Pan attribute of the Text Edit widget's viewport includes PAN_X mask, the widget will use a horizontal scrollbar to scroll long text lines. Otherwise, long text lines will be wrapped. The PAN_Y mask controls the vertical scroll bar.

A new LED Value Display widget displays a numerical value using 7-segment LED indicators. The widget parameters allow to define a number of digits after the decimal point and a total number of digits. A new HEX Value Display widget can be used to display an integer in a hexadecimal format.

Fixed size viewport objects are added to the Layout Templates and can be used to implement fixed size popup dialogs embedded in the drawing. The size of the dialogs in screen pixels is controlled by their Width and Height properties and will not change when the drawing is resized. The dialog position in world coordinates is specified by its anchor point. Two templates are provided: one anchored at the upper left corner (with an anchor point named AnchorPointTopLeft), and another anchored at its center (with the AnchorPointCenter resource).

Constraint Loop Detection to Prevent Crashes

In the previous release, an infinite constraint loop could be created if a parameter of a transformation is constrained to the attribute the transformations as attached to, which resulted in a crash of the GLG Builder.

In the new release, each constraining operation is checked for a possible constraint loop. If a constraint loop is detected, the operation is aborted, which prevents a crash.

Map Transformation

A new Map transformation can be used to convert a numerical or string key to an output value. A Map transformation has a list of output values and their corresponding keys. The input value is used as a key and is compared with the list of keys. If a match is found, the corresponding output value is used; otherwise, the last value from the list of values will be used. The type of the output values of the Map transformations is determined by the type of the data object they are attached to: D, S or G.

There are two types of the Map transformation depending on the input key type: DMap for numerical key and SMap for a string key. The DMap transformation also has a Precision attribute that specifies the precision used to compare double values. When set to 0 (default), an exact match is used.

The DMap is a new transformation, while the SMap existed in the previous releases and was called SList.

New Attributes of Screen Offset and Screen Scale Transformations

The Offset Type parameters of the Screen Offset transformation can be now set to RATIO, in addition to the WORLD and SCREEN values. RATIO can also be used as a value of the Scaling Type parameter of the ScaleScr transformations.

This new RATIO setting can be used to create specialized objects that maintain X/Y ratio when the drawing is resized. For example, if the X Offset Type of the Screen Offset transformation is set to RATIO and the Y Offset Type is set to WORLD, the effective Y offset will be adjusted by the X/Y ratio of the viewport to preserve X/Y ratio of the resulting offset used to transform points.

A new Move Flag parameter was added to the Screen Offset transformations to control how the parameters of the transformations are changed when the object or its control points are moved or transformed. By default, the Move Flag is set to CHANGE OFFSETS to change the transformation's offsets when the point is moved, which is the behavior observed in previous release.  If changed to MOVE ANCHOR POINT, the anchor point of the transformation will be moved instead of changing X and Y offsets. This can be used to create specialized objects, such as a fixed size viewport anchored at its center shown in the widget palettes.

Improved rendering of arcs, splines and rounded rectangles in Java

Arcs, splines, rounded rectangles and other polygons that use double anti-aliasing are now rendedred in Java using double coordinates, which improves visual appearance of these primitives.

Expanded Logging

All error, warning and information messages are now logged in the glg_error.log file by default on both Unix/Linux and Windows. Previously, only errors were logged in the Unix/Linux environment. C/C++ applications can now use the GlgError function to log not only errors, but also informational messages.

A new GlgLogLevel global configuration resource and a GLG_LOG_LEVEL environment variable control the verbosity of the GLG logging. Possible values defined in the GlgApi.h include:
GLG_DISABLE_LOGGING
GLG_LOG_INTERNAL_ERRORS
GLG_LOG_USER_ERRORS
GLG_LOG_WARNINGS
GLG_LOG_INFO_MESSAGES
GLG_LOG_ALL (default)

New Global Configuration Resources

New global configuration resources were added to allow an application to change the mouse buttons used for zooming and panning. The GlgZoomToButton global configuration resource specifies the mouse button (1, 2 or 3) used for the ZoomTo operation.  The GlgPanDragButton resource specifies the mouse button used for panning the drawing by dragging it with the mouse.

A new GlgChangeCursorOnKBGrab global configuration resource controls changing cursor on a keyboard focus grab when a GLG slider or knob is dragged with the mouse. The resource is set to 1 by default to enable cursor change.  To disable the cursor change, set this resource to 0. Alternatively, the GLG_CHANGE_CURSOR_ON_KB_GRAB environment variable may be set to False to disable the cursor change.

A new GlgCustomDataLib global configuration resource and a GLG_CUSTOM_DATA_LIB environment variable may be used to provide a path of a custom data DLL from a program at run time.

Updated GTK3 and GTKMM3 Integration

The Gnome integration was updated to use the new version of GTK, eliminating the use of deprecated features.

New GLG API Methods and Features

New convenience methods were added to query an object's name and type, as well as a data type of a data object:
A new GlgGetNativeComponent method may be used to query native resources used by the widget's viewport, including:
A new GlgSetBrowserSelection method can be used to set Selection and Filter boxes of the GLG Data, Tag and Resource Browser widgets, and update the browser display based on the specified values.

A new GlgFindFile method was added to the GLG C/C++ API and may be used to return a full path name of a file by searching in the supplied directory, the GLG path and the current directory.

The GlgGetObjectName and GlgGetObjectType quick access macros were replaced with functions that perform an additional check for NULL object. A new GlgGetDataType quick access function was added for querying a data type (D, S, or G) of either a data or attribute object.

A conditional const modifier was added to the string parameters and return values of the GLG API methods in the GlgApi.h include file. The const modifier can be enabled be defining GLG_C_CONST_CHAR_PTR before including GlgApi.h.  This can be used in a C++ environment to minimize warnings and a need for casts when passing string literals to GLG methods.

Interface Changes

In the previous releases, Ctrl-Shift-Move was used to move the anchor point of subdrawings and container objects. In the new release, it was changed to Ctrl-Alt-Move to avoid moving the anchor point accidentally when performing other operations that use the same bindings, such as group zooming or setting editing focus.

New Map Server Features

Sample of the US 0.5m Aerial Dataset
Sample of the US 0.5m Aerial Dataset
Click to see a larger image

The new release adds features that are used with the large satellite are aerial image datasets.

Satellite datasets, such as World 15m Satellite Images, use black color for ocean areas where there is no image data. The black areas should be treated as transparent when this images are displayed. This is accomplished by using the TRANSPARENT COLOR OPAQUE layer type, and specifying black as a transparent color. Transparent color precision is also used to eliminate artifacts of lossy compression for JPEG images.

The aerial datasets, such as US 0.5m Aerial Images shown on the right, use tiles created in the UTM projection. To display this tiles in different projections, they need to be converted (unprojected) to use lat/lon coordinates. Since the UTM rectangles are not rectangular in the lat/lon coordinates, the converted tiles will have unused areas at the edges that is filled with black color.  This black areas should also be treated as transparent when this images are displayed. Also, since the tiles were converted from the UTM projection, the tiles will overlap, and data for the transparent area in one tile will be provided by another overlapping tile.

The transparent color attribute is already supported by the map server.  The new layer attributes listed below were added to better render satellite and aerial image datasets.

Bug Fixes

Fixed real-time chart filter logic to properly handle the oldest visible data point in a chart to avoid a gap at the left edge of the chart.

Fixed the Null Object error when browsing resources of a subdrawing template that has aliases.

Improved handling of layout operations for objects with constrained points.

Fixed a "scrollbar loop" for marginal cases with the PAN_AUTO_XY setting of a viewport's Pan attribute.