Generic Logic, Inc.

GLG 4.4 Release: New Features and Enhancements

New Real-Time Chart Features
New SCADA Viewer Framework
Custom Component Processing Features
Custom Interaction Handlers API
Improved Handling of Viewport Shadows
Improved Text Scaling Precision
Transparent HTML Viewports
New Option Menu Message
New Parameters of Boolean Transformation
Support for Adjusting Drawing Size in HMI Editor
Custom Editor Extension API Changes
Enhanced Control Over SubDrawing and Image Caches
Preserving BaseWidth Setting on Hierarchy Up
New Widgets and Widget Enhancements
Support for .JPEG Filename Extension
New Programming API Methods and API Changes
Miscellaneous Changes
DXF Converter Changes
Bug Fixes
Real-Time Sweep Chart
Real-Time Sweep Chart
Web SCADA Viewer Demo
New SCADA Viewer Framework
Click for Web SCADA Viewer Demo
Dashboard-Style Dials
Dashboard-Style Dials

New Real-Time Chart Features

Real-Time Sweep Charts

Real-Time Sweep Chart
Real-Time Sweep Chart

A new widget palette with Real-Time Sweep Charts contains new chars with the SWEEP X axis type. The palette contains a variety of sweep charts with different number of plots and axes, as well as charts with an absolute and relative time axis.

Unlike the scrolling strip charts, which scroll to provide space for new data when the plot lines reach the border, the sweep charts wrap back and restart from the opposite side. This chart type is often used in signal and medical monitoring equipment.

The sweep charts are supported in all GLG runtime environments: C/C++ on both Windows and Unix/Linux, C# and .NET, Java, HTML5 and JavaScript, as well as in the ActiveX on Windows.

A new Line Attributes object with the SweepBar default attribute name contains rendering attributes for the sweep chart's vertical sweep bar. In the GLG editor, it is accessible via the Edit Sweep Bar button in the sweep chart Properties dialog.

The SweepPosition attribute controls the position of the sweep bar. It is automatically managed by the sweep chart, but may also be used to position the sweep bar on start up. In the editor, the attribute is accessible via the Resource Browser.

A new GlgUpdateChartTimeAxis API function may be used for updating the chart's time axis after filling chart data samples using the GlgAddDataSampleNode function. For the sweep charts, the new function updates both the time axis and the sweep bar position.

Minor Grid Rendering

In the previous releases, the Grid Attribute object contained attributes that controlled rendering of both the major and minor grid. In the new release, the new MinorGrid attribute object has been added to control rendering attributes of the minor grid, which can now be rendered differently from the major grid.

New SCADA Viewer Framework

Web SCADA Viewer Demo
New SCADA Viewer Framework
Click for Web SCADA Viewer Demo

The new SCADA Viewer is a graphical framework that can be used as a starting point for developing custom SCADA applications, providing support for the following features:

The source code of the demo for all supported programming environments (C/C++, C#, Java and HTML5/JavaScript) is provided in the SCADAViewer directory of the GLG installation.

Click on the following link to view a Web demo: https://www.genlogic.com/html5_demos/SCADAViewer.html

Custom Component Processing

Marking Custom Components in Graphics Builder

A new feature of the Enterprise Edition of the GLG Graphics Builder allows the user to mark objects in the drawing for custom processing at run time. The CustomSetup flag in an object's Properties dialog can be checked to request a custom setup callback to be invoked at run time.

If an application uses a custom component that has an ID property and multiple data tags, custom processing may be used to initialize object's data tags based on the object's ID. For example, if a valve has data tags with the Value, Flow and State tag names, and a user assigned ID=v15, custom processing could assign a data source to each tag based on the tag name and valve ID using an application-defined pattern, such as v15_value, v15_flow and v15_state. When such a custom component is added to the drawing, a user can set just its ID, and the tag assignments will be performed by the custom setup processing at run time. This automates the data tag assignment process, eliminating tedious manual assignment of multiple data tags and eliminating potential errors.

In previous releases, an application had to use GlgFindObjects API method to traverse the drawing at the setup time to find and process custom components, and it has to be done in every place when a new custom component (for example a dialog) could be added to the drawing.

The new feature eliminates the need to search the drawing and makes it possible to simply mark the custom components that need custom processing right in the Graphics Builder. The custom processing callback will be automatically invoked at run time regardless of the place and time when the custom component was loaded. For example, if a custom component represents a widget that handles user interaction, custom processing can be used to attach an Input callback to the component's viewport when the component is loaded.

The new feature also allows custom processing to be performed when a component is reset or deleted. For example, when a component is deleted, it may be needed to delete data attached to the component on setup, or delete the component from a list of currently active components.

Custom Processing API

The GlgSetCustomSetupHandler API method may be used to specify a custom setup handler which will be invoked to perform custom processing of objects that have the CustomSetup flag set. The handler will be invoked at different times during an object's lifetime, such as before and after hierarchy setup, on object reset and before the object is destroyed.

The custom setup callback can be used to process special objects in the drawing, such as custom widgets. In previous releases, such processing required traversing all objects in the drawing to find custom widgets that needed to be processed to initialize them. The use of the CustomSetup flag eliminates the need to perform the search and also allows to perform special processing to free any saved data when the object is reset and destroyed.

The new GlgSetObjectData and GlgGetObjectData API methods described below may be used to attach custom data to GLG objects.

The new SCADAViewer demo demonstrates the use of the Custom Processing feature to generically handle special widgets in arbitrary drawings. The source code of the demo for all supported programming environments (C/C++, C#, Java and HTML5/JavaScript) is provided in the SCADAViewer directory of the GLG installation and can be used as a starting point for a SCADA application framework.

Click on the following link to view a Web demo: https://www.genlogic.com/html5_demos/SCADAViewer.html

Custom Interaction Handlers API

An API for implementing custom interaction handlers was added in the new release. The Toolkit provides a number of stock handlers, such as GlgButton or GlgSlider, which handle user interaction with interface widgets. Custom interaction handlers may be implemented and attached to viewport-based custom components in the Graphics Builder to handle custom application logic, which can be more elaborate than just handling a single widget.

For example, a custom chart handler can handle all user interaction with a chart component, handling clicks on button widgets inside it as well as the mouse events inside the chart. The advantage of such a handler is that once it is installed, it may be attached by the user to an object (or multiple objects) in the GLG editor with no additional code changes. Without this feature, an application would need to know when a chart component is loaded to set it up and add any necessary Input and Trace callbacks in the application code.

A custom interaction handler is implemented as a single method that is invoked by the Toolkit at different times to handle user interaction with the object. A custom handler is installed using the GlgAddHandler method. The parameter of the method specifies a handler name used in the GLG editor. The custom handler name should start with the $ character to distinguish it from the stock handlers provided by the Toolkit.

A custom handler can be attached to an object in the GLG editor even if the handler is not activated inside the editor. The Custom Option editor extension may be used to activate custom handlers in the GLG editors. The Custom Option editor extension example demonstrates how to activate the handler in the GLG editor.

When a custom interaction handler is installed, the handler code will be automatically invoked at the appropriate times to handle setup, reset and user interaction for the custom component the handler is attached to. Unlike the custom processing callback described above, which is invoked only on object setup and reset, the custom interaction handler code is also invoked on native input events (such as mouse and keyboard events), as well as input messages from its children input objects. This make it possible to use a single function to implement a custom interaction handler without using separate functions to handle initialization, Input and Trace callbacks.

The source code of the SampleHandler examples for all supported deployment option (C/C++, C#, Java and HTML5 JavaScript) are also provided in the src directory of the GLG installation.

New GlgSetHandlerData, GlgGetHandlerData, GlgCreateMessage and GlgSendMessageToParent GLG API methods were added to facilitate development of custom interaction handlers.

Improved Handling of Viewport Shadows

A viewport's ShadowWidth attribute specifies the width of shadows drawn inside the viewport to create a bevel effect.

A new ShadowInsideSpan attribute controls rendering of shadows inside viewports and light viewports. If the attribute is set to YES, the coordinate span will include the whole area of the viewport, and the shadows will be rendered inside the span. The whole area of the viewport will be drawable, and objects at the edges of the viewport will be drawn on top of the shadows. This was the behavior used in the previous releases, and it will be preserved for any older drawings loaded into the newer versions of GLG. This behavior may be changed by setting the attribute to YES.

If the attribute is set to NO (default in the newer GLG versions), the shadows will be outside of the span and the viewport span will not include the shadows. The usable drawing area inside the viewport will be decreased by the shadow width, and the shadows will be drawn on top of any objects that extend outside of the span area, effectively clipping the objects to the span area. The only exception is child viewports, since they use native window objects and will be clipped to the parent viewport area instead of the area inside the shadows.

All viewport-based widgets in the GLG Widget Palettes were changed to use the ShadowInsideSpan=NO setting.

Improved Text Scaling Precision

In previous releases, the text scaling heuristic compared the viewport's BaseWidth with viewport's actual width to determine the scaling coefficient. This was not accurate for resizable viewports with Stretch=OFF, since the effective drawing width could be smaller when the viewport resized without maintaining its X/Y ratio. In the new release, the effective drawing width is used for text scaling instead of the actual width. The change also affects marker and line width scaling.

Transparent HTML Viewports

A new HTMLBackground attribute of a GLG viewport's Screen object controls if the viewport background is transparent when the viewport is rendered on the HTML page inside a web browser using the GLG HTML5 JavaScript library.

While the viewport's Visibility attribute can be set to a fractional value (for example, 0.5) to make all viewport content semi-transparent, setting HTMLBackground=OFF disables only the viewport background, while the rest of the viewport content is not affected.

The HTMLBackground attribute can be set in the GLG editor, but it is active only in the HTML5 JavaScript environment.

New Option Menu Message

A new SelectItem message is now supported by the GlgNOption interaction handler. The message supplies a selected index parameter that defines which option menu item to select. While setting of the menu's SelectedIndex resource selects the specified an item without invoking an Input callback, the SelectItem message selects the specified item and invokes the callback.

Support for Adjusting Drawing Size in HMI Editor

The File, Adjust $Widget Size menu for adjusting drawing size to the Work Area is now available in the GLG HMI Configurator. In previous releases, it was available only in the GLG Graphics Builder.

New Parameters of Boolean Transformation

The Boolean transformation has new True Value and False Value attributes, which specify the output value to use when the transformation condition evaluates to True or False. In previous releases, obtaining a similar effect required using two levels of chained transformations.

Custom Editor Extension API Changes

Custom Data Browser DLL

A new GlgCustomDataInitPath entry point was added to the custom data browser API. The new entry point may be used to initialize the data browser's Selection field depending on the selected object, as well as the selected attribute object and the data tag attached to it. The entry point can return an allocated string to select a custom initial data browser path, or NULL to use the default path ("/").

Custom Option DLL

A new GlgCustomOptionResetDrawingCallback entry point is invoked on every drawing reset and may be used to perform any custom processing of any specialized widgets in the drawing. In previous releases, such processing could only be performed when the drawing was loaded, and for subdrawings, the results of the processing disappeared after the drawing was reset. The new entry point provides consistent custom processing inside the GLG editors.

All Editor Extension DLLs

A new Terminate entry point is invoked on the GLG editor's exit and can be used to terminate the data connection opened by a DLL. This facilitates a clean exit for data connections that open separate threads.

Access to the editor layout resources was enabled for all editor extension DLLs via GlgGet/SetResource functions using the $GlgEditorLayout resource path.

A new GMEraseErrors function of the Custom Editor Extensions API can be used to erase error messages displayed in the GLG editor.

The following GLG functions for handling a relative path and the GLG search path have been added to the Custom Editor Extensions API:

Enhanced Control Over SubDrawing and Image Caches

When a GLG subdrawing is loaded, the subdrawing template is cached to be reused between multiple instances of subdrawings that use the same template drawing. For the GLG image objects, the image data is also cached to be reused between multiple instances of the same image. By default, the cached data is purged from the cache when the last instance that uses the cached data is deleted (except for the JavaScript environment, as noted below).

The GlgFreeSDCache and GlgFreeImageCache global configuration resources may be used to change the default behavior. If they are changed from the default value of 1 to 0, the data from the corresponding cache will never be purged. This may be used to increase performance of applications that have subdrawing or image dynamics by eliminating the need to load a subdrawing or image data when a particular subdrawing or image is repeatedly displayed, erased and displayed again. Keep in mind that if an application goes through a large number of subdrawings of different type, eliminating cache purging will cause increased memory consumption.

JavaScript note: In the JavaScript environment, the subdrawing cache is newer purged and the GlgFreeSDCache global configuration resource is not available.

Preserving BaseWidth Setting on Hierarchy Up

In the new release, changing the viewport's BaseWidth after going down into a viewport using the Hierarchy Down button is preserved when going back up using Hierarchy Up. This also makes it possible for the HMI Configurator users to set a drawing's BaseWidth, which was not saved in the previous releases.

Multi-Row Tab Widgets
Multi-Row Tab Widgets

Dashboard-Style Dials
Dashboard-Style Dials

New Widgets and Widget Enhancements

The new widgets include:

A sample of a real-time chart with a logarithmic Y axis has been added to the Real-Time Charts palette.

Disabled state indication has been added to the button widget with delayed activation.

Support for .JPEG Filename Extension

The .jpeg filename extension for the JPEG images is now supported in addition to the .jpg extension supported in the previous releases.

New Programming API Methods and API Changes

New Method for Updating Chart Time Axis

A new GlgUpdateChartTimeAxis API method may be used for updating the chart's time axis after filling chart data samples using the GlgAddDataSampleNode function. For the sweep charts, the new method updates both the time axis and the sweep bar position.

Convenience Method for Querying Parent Viewport

A new GlgGetObjectViewport method may be used to return an object's parent viewport. The method's parameters allow querying either a viewport or a light viewport parent, as well as returning an object itself if the object is a viewport.

Querying Object's Reference Count

A new GlgGetRefCount C/C++ function returns an object's reference count.

Convenience Methods for Storing Arbitrary Custom Data

New GlgSetObjectData and GlgGetObjectData convenience methods may be used for attaching custom data to GLG objects and querying them later. It is the responsibility of an application to manage and free the attached data. The data will not be saved with the object, nor it will be copied when the object is cloned.

The new SCADAViewer demo demonstrates how these methods can be used to store data used by the Custom Processing feature.

Hierarchy Callback Changes

In previous releases, the hierarchy callback was invoked before and after subdrawing's hierarchy setup (GLG_BEFORE_SETUP_CB and GLG_AFTER_SETUP_CB values of the callback's condition parameter). In the new release, the callback is also invoked after finishing an object's setup, when all transformed value are valid (GLG_FINISHED_SETUP_CB value of the callback's condition parameter), as well as before and after reset (GLG_BEFORE_RESET_CB and GLG_AFTER_RESET_CB).

New C++ Convenience Method

A new GlgObjectC::Same( GlgObject ) method with the GlgObject parameter type was added to perform comparison with the GLG objects passed from the C code without creating temporary GlgObjectC wrappers. The new method complements the existing Same method with the GlgObjectC& parameter type.

GlgLabelFormatter Parameters

The GlgLabelFormatter method was changed to use enum parameters instead of integers for better clarity.

Improved Handling of Trailing Slashes

In the new release, the GlgConcatResNames that concatenates two strings checks if a trailing / separator is already present in the first string, and adds it only if the separator is not present.

Installable Handlers Parameters

The name of the opaque void * GlgCallEvent parameter type of the Installable Handlers was changed to GlgIHCallEvent. The GlgCallEvent type reserved for use with custom interaction handlers.

Methods for Implementing Custom Interaction Handlers

New GlgAddHandler, GlgSetHandlerData, GlgGetHandlerData, GlgCreateMessage and GlgSendMessageToParent methods were added to facilitate development of custom interaction handlers.

Control Over Searching Templates of SubDrawings, SubWindows and Series

The new search_templates field of the GlgFindObjectsData structure allows the application code to control if the GlgFindObjects should search templates of subdrawings, subwindows and series. This field if set to False by default when the structure is initialized using the GlgInitStruct macro. In the previous releases the templates were always traversed.

The new dont_add_matches field of the GlgFindObjectsData structure may be set to True to prevent adding matching objects to the returned object array. This can be used to prevent creating and then destroying a returned object array (a GLG_GROUP object) when the found objects are processed in-place by the custom_match callback instead of traversing the returned object array to process the found objects. If dont_add_matches is set to True, the returned found_object field will always be set to NULL.

As documented, the GlgFindObjectsData structure in the C/C++ environment must be initialized using the GlgInitStruct macro, which ensures that the code from previous releases will continue working without a need to modify it.

Miscellaneous Changes

File Converter Option to Print Saved Format Version

A new -v file converter option prints the save format version of the processed drawing files. On Windows, the output is placed in the glg_error.log file.

Simple Version of Data Browser Example

A simple version of the data browser example with a flat list of data tags (sample_simple.c) was added in the editor_extensions/data_browser_example directory of the GLG installation.

Dialog Positioning

Positioning of dialogs displayed using GlgDialogSetupHierarchy method was improved to treat the dialog's XHint and YHint as offsets relative to the dialog's parent instead of treating them as absolute offsets. This change ensures that the dialogs appear on the same screen as their parents on systems with multiple monitors. In previous releases, XHint and YHint were treated as absolute offsets.

DXF Converter Changes

New DXF Converter Options

The new -vp_width, -vp_height, -span_x and -span_y, command-line options of the DXF converter make it possible to fine-tune the X/Y ratio of the produced output by specifying the width and height of the generated viewport as well as its coordinate span.

The -text_scaling option sets TextScaling attribute of all converted text object to the supplied value, which should be one of the values in the GlgScalingType enum.

The -min_font_size and -max_font_size options set the MinFontSize and MaxFontSize attributes of all converted text objects.

DXF Converter Limits Increase

The maximum number of blocks in the DXF converter was increased from 10k to 100k to enable processing of large DXF drawings.

Bug Fixes