GLG 3.6 Release:
The new 3.6 release of the
GLG Toolkit includes the following major new features:
Java Script support. Java Script can
be used to define arbitrary custom functions to compute an output value
of a property based on values of several input variables.
Several new types of
text objects, including new scalable
text, as well as wrapped and
truncated text objects.
Support for indexed (referenced) colors that may
be used to define a global color table that can be used to change
colors used by objects in a drawing.
Enhanced support for
creating drawings with different
aspect ratios, with support for screens with 4:3 and 16:9 aspect
can now be executed on either button release or button press. Support
was also added for handling both ARMED and UNARMED actions attached to
the same object.
selecting all text displayed in a text box on a mouse click, as well as
parameters to control TAB traversing.
New widgets in
widget palettes: 3D pipes, a Password Text Input widget that
hides entered characters, a Text Edit widget with support for either
scrolling or wrapping long text lines, hex value display widget and a
fixed size viewport widget
that can be used for popup dialogs.
Constraint loop detection for
ConstrainOne and Merge operation to prevent crashes due to infinite
Support for large satellite and aerial datasets
in the map server.
Many other new
features, improvements and bug fixes.
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
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. *
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
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
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.
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
resource in the GLG configuration file, i.e. glg_config or glg_hmi_config.
New Text Object Types,
and Other New Text Attributes
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
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,
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,
Anchoring=CENTER BOTTOM and AnchorOffset=-5 will display the
text object above the marker with a small 5 pixel vertical gap between
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.
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.
Improved Text Edit Behavior
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 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.
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
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
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.
Executing Actions on Button
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
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.
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
Select All on Focus in
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
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,
key is pressed. If it is set to
push buttons and toggles are also included in the Tab traversing.
Attribute of a
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.
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.
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
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
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
and another anchored at its center (with the AnchorPointCenter resource).
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.
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
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),
exact match is used.
The DMap is a new
transformation, while the SMap
existed in the previous releases and was called SList.
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
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.
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
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
The Gnome integration was
updated to use the new version of GTK, eliminating the use of
New GLG API Methods and
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.
- ID of a widget on
- ID of a window in a
GDK, QT or Microsoft Windows environment
- ID of a top level
shell or window
- ID of a child text,
list or scrollbar widget of a scroll pane used to scroll text or list
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
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.
and a need
for casts when passing string literals to GLG methods.
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
New Map Server Features
The new release adds
features that are used with the large satellite are aerial image
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
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.
- BACKGROUND COLOR attribute defines
RGB values of a color to use for rendering transparent pixels in this
- BACKGROUND LAYER attribute defines
a name of another layer to use for rendering transparent pixels in this
layer instead of the background color.
- TILES OVERLAP attribute declares
that this layer contains overlapping tiles with transparent pixels.
When the map server renders a pixel on a map, it searches for a tile
that contains data for this pixel. If it find a tile and the pixel is
transparent, it will continue searching until it finds a source tile
that provides (non-transparent) data for the pixel. If a source tile is
not found, the pixel will be rendered using either the background color
(if it is defined), or using pixel data from the background
layer. If neither background color nor background layer are
defined, the pixel will not be rendered and either the underlying
layers or the background color of the map will be showing through.
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
Fixed a "scrollbar loop" for marginal cases with the PAN_AUTO_XY setting of a viewport's