|
GLG Toolkit supports both fixed size and resizable drawings. Resizable drawings automatically resize objects in the drawing to adjust to the size of the window they are displayed in. When resizable drawings are edited in the GLG editors (Graphics Builder or HMI Configurator), they assume the size of an editor's Drawing Area. When a GLG editor is maximized, the size of its Drawing Area differs depending on the screen size. For example, a laptop screen is usually smaller than a desktop screen, and a drawing will be displayed in a different size depending on where it is edited.
In the new release, a new Work Area feature makes it possible to display resizable drawings the same way regardless of the size of the screen and the GLG editor's Drawing Area. When a Work Area size is defined, the loaded drawing will be displayed in that size, regardless of the screen size or the editor window size. When the user navigates down into the drawing, the drawing will be displayed in that size as well. If the Work Area is bigger than the editor's Drawing Area, the drawing can be scrolled as needed.
The File, Work Area Size menu provides several options for defining Work Area size:
The SetWorkAreaOnStart variable in the configuration file may also be used to set the Work Area Size on the GLG editor's startup.
If the Work Area's size is set, the work area boundaries are annotated in the GLG editor via a dashed red line. The Options, Show Span, Work Area menu option may be used to control whether the Work Area boundaries are shown. The ShowWorkArea variable in the GLG editor configuration file may be used to control the default behavior on the editor's start up.
New options for adjusting a widget's size have been added to the File, Adjust $Widget Size menu of the GLG Graphics Builder:
New subdrawing ratio targeting options were added for creating resizable subdrawings via the File, New, SubDrawing (Resizable) menu. The new options provide choices for targeting drawings with different width/height rations and match the corresponding options for creating new resizable widgets:
The same subdrawing can be used in drawings with different ratios regardless of the targeting ratio selected at the creation time. However, targeting ratios can be used for precise size matching. If the work area is defined and the drawing size matches the work area size, using a matching ratio when creating subdrawing makes sure that the subdrawing will appear in the drawing in exactly the same size as seen when the subdrawing was created.
In the new release, the drawing ratio of the Builder's Drawing Area (defined by its SpanX and SpanY) is saved with the drawing.
The new Custom Width/Height Ratio option can now be used to create a resizable widget with a custom width/height ratio by defining the widget's X and Y Span. In previous releases, it required editing the widget viewport's span after the widget has been created.
The TopDrawingAreaSpanX and TopDrawingAreaSpanY configuration file variables can be used to define coordinate span of the Graphics Builder's Drawing Area.
The InitSpanX and InitSpanY configuration file variables define the $Widget viewport ratio on the Graphics Builder startup.
In previous releases, temporary files in the tmp directory were used to facilitate loading and saving of compressed drawings. In the new release, compressed drawings are loaded and saved without the use of temporary files in the tmp directory, which makes the process more efficient.
Together with other improvements, the new loading technique speeds up loading compressed drawings in C/C++ applications and GLG editors by on average 50% for compressed ASCII drawings and by 30% for compressed BINARY drawings.
NOTE: The load speed stats listed above refer only to the drawing loading performed by the GlgLoadObject and GlgLoadWidget functions. The total time it takes to load and display the drawing is longer, since it also involves setting up the drawing hierarchy using GlgSetupHierarchy function, as well as actual rendering performed by GlgUpdate.
The GlgLoadWidgetFromImage and GlgLoadObjectFromImage functions that load drawings from memory images now also support compressed memory images, which decreases size of executables that use this feature.
The new release provides two versions of the Toolkit on Linux: a GTK version and an X11 version. The GTK version uses GTK for all interface and rendering needs and can be used with either Wayland or X11 display servers.
The GTK version of the GLG library can be seamlessly integrated in any GTK-based application, with full support for GTK native input objects (such as text entries, buttons and toggles, combo boxes, lists, etc.) inside GLG drawings.
In the new release, two versions of executables are provided for the GLG editors, demos and examples on Linux:
Two versions of the GLG C/C++ library are also provided:
Other GLG C/C++ libraries, such as GLG Intermediate API, GLG Extended API and the GLG Map Server library, may be used with either the GTK or X11 version of the GLG library.
The GTK version of the Toolkit doesn't depend on any additional libraries other than the GTK itself. This frees the GTK version of the Toolkit from relying on X11 fonts, which needed to be installed in the past to run GLG editors.
The GTK version uses Cairo for rendering, which provides anti-aliasing and alpha-blending features while taking advantage of hardware acceleration when available, without the explicit use of OpenGL. In previous releases, these rendering features were available only with the OpenGL driver. The OpenGL driver can still be used by the GLG drawing in the GTK version directly if hidden surface removal is required for rendering 3D objects.
The X11 version of the Toolkit uses either X11 drawing primitives or OpenGL for rendering.
If an application uses the GLG Generic API to load and display GLG drawings, it may select which version of the GLG library to use by simply compiling and linking with either the GTK or X11 version of the GLG library. The src directory of the GLG installation provides makefiles for building either version of the application.
If an application embeds GLG drawings inside the GTK GUI, it can use the gtk_glg widget provided by the GLG library. The integration/gtk3_glg_native directory of the GLG installation provides an example of using the widget. The integration/gtkmm3_glg_native directory contains a C++ GTKMM example of using the GTK version of the Toolkit via the provided GtkmmGlgWidget widget.
The X11 versions of the GTK and GTKMM integrations are also provided to support legacy applications.
In previous releases, OpenGL was required for using anti-aliasing and alpha-blending features, and was enabled by default. To minimize the number of OpenGL contexts, software-based OpenGL was used for buttons and other children viewports that did not require continuous animation, while the hardware OpenGL was used for the main drawing with continuous animation.
In the new release, while hardware acceleration might be used if available, the GTK version doesn't rely on OpenGL for anti-aliased rendering and alpha-blending. In the GTK version, the explicit use of OpenGL requested by the setting of a viewport's OpenGLHint attribute is disabled, since it is unnecessary. If OpenGL is really required for hidden surface removal when rendering 3D objects, it may be enabled by using the ForceOpenGL attribute of the viewport's screen.
GTK uses its own double buffering system, which makes GLG double buffering redundant in the GTK version of the Toolkit. To avoid unnecessary resource consumption by the double buffering pixmaps, the GLG double buffering is disabled in the GTK version by default even if the viewport's DoubleBuffering attribute is set to ON. The new ON (FORCED) attribute value may be used to force the viewport to use GLG-based double buffering if required.
The GlgDoubleBufferingType enum in the GlgApi.h file provides attribute values that can be used via the GLG API. The GlgDisableDB global configuration resource and the corresponding GLG_DISABLE_DB environment variable may be used to globally control the use of the GLG double buffering.
In the GTK version of the GLG library, the GXEvent structure is used to pass events to the GLG Trace callback. This structure mimics the XEvent structure, which allows the same code to be compiled for use with either the GTK or X11 version of the GLG library. The native GDK event is also provided by the event1 field of the GlgTraceCBStruct structure, which may be NULL for the GX events that do not have corresponding GDK events.
To compile the code with the GTK version, the GLG_GTK preprocessor macro has to be defined, enabling the use of the GXEvent instead of XEvent structure. All GLG demos and examples can be compiled with either version of the library without code changes. If the XEvent structure type has to be explicitly referenced in the code, it has to be ifdef'ed to be used only with the X11 version.
The GTK version of the Toolkit transparently handles different system locales, including UTF8 and non-UTF8 locales, with no additional actions or font settings required.
Internally, GTK uses UTF8 encoding for all text strings regardless of the current locale. The GLG Toolkit uses the current locale for string data values that do not have UTF8 flag set. Any GlgSetSResource calls for such data values should use strings in the current locale. The GlgGetSResource calls return strings in the current locale. The Toolkit handles all necessary reencoding between UTF8 and the current system locale.
If the UTF8 flag of an S (string) property is set, the property uses UTF8 encoding regardless of the current locale. UTF8-encoded strings should be used for setting such property values using GlgSetSResource calls, and GlgGetSResource calls return UTF8-encoded strings for these properties.
If current locale is different from UTF8, all supplied strings are automatically reencoded from the current locale to UTF8. If supplied strings are in an incorrect locale, the reencoding will yield invalid UTF8 strings. The GlgValidateUTF8 global configuration variable and the corresponding GLG_VALIDATE_UTF8 environment variable control internal string validation, which is performed to avoid errors and rendering issues. By default, they are set to true to enable the validation.
By default, the GLG Editors use the Adwaita GTK theme. The -dark-theme command-line option may be used to specify the Adwaita-dark theme. The -system-theme command-line option forces GLG Editors to use the current system theme.
When a C/C++ application linked with the GTK version of the GLG library is run, native input objects inside the GLG drawings (such as text entry, combo boxes, etc.) will be rendered using the current system theme. The GTK environment variable GTK_THEME may be used to control the GTK theme of the application at run time.
In the GTK version, the viewports that have WidgetType=DIALOG_AREA paint their background using the current GTK theme. The viewport's FillColor is also set to an RGB value matching the rendered background for possible constraining. The new DefaultLabelColor attribute of the viewport's screen will also be set to the label color of the current GTK theme, which can be used as TextColor of text objects in the viewport. When the GTK theme changes, Dialog Area viewports automatically change colors of their background and the labels constrained to their DefaultLabelColor, to match the corresponding GTK theme colors.
The GlgDefaultDialogColor and GlgDefaultLabelColor global configuration resources, as well as the corresponding GLG_DEFAULT_DIALOG_COLOR and GLG_DEFAULT_LABEL_COLOR environment variables may be used to override the theme colors, as well as define these colors when the drawing is deployed in other environments.
The new GlgGtkFontSize global configuration resource and the corresponding GLG_GTK_FONT_SIZE environment variable may be used to define the font size that will be used in the native GTK input objects, such as text entry, buttons and toggles, combo boxes, etc.
For example, setting the $config/GlgGtkFontSize resource to the "20px" string will define the font size in the native input objects, overriding the font size defined by the GTK theme.
In the new release, GLG editors on Linux support printing via the GTK-based printing dialogs. Both Print and a legacy Export PostScript options are provided.
The GlgNativePrint API function is also provided to facilitate printing GLG drawings from a C/C++ application program.
In the GTK version, the GlgNSlider interaction handler used with the native GTK sliders supports DrawTicks and TickFormat properties, which may be defined to draw slider ticks and control tick label format.
In the new release, all C#/.NET DLLs and Visual Studio projects target .NET 4.6.2. The C#/.NET DLLs that target older .NET 4.0 are also available in the GLG download for the older version of Visual Studio.
The new CHANGE_CURSOR action type can be used to change the cursor shape when the mouse moves over an object. The ProcessArmed action attribute may be used to change the cursor only if the Control key was held down when the mouse moved over the object, to match the logic of armed buttons that are activated by the mouse click only when the Control key is held down. The CursorType action attribute defines the cursor type used when the mouse moves over the object and may be one of the following:
This action may be used to provide a visual feedback for objects that have an attached mouse click actions and perform some action when the object is clicked on.
In previous releases, the ZOOM TextScaling type used the zoom factor of the text object's parent viewport or light viewport. If a drawing containing a viewport-based widget, such as a button or a dial, was zoomed, the text labels inside the widget viewport did not get scaled, since the zoom factor of the widget's viewport did not change. The only way to enable text scaling inside of such child viewport was to set TextScaling=RESIZE and also set its BaseWidth, so that text scaling would be driven by the widget size change when the drawing was zoomed.
In the new release, a new ZoomFromParent viewport and light viewport attribute may be set to scale text objects on zoom based on the parent viewport's zoom factor. This is more convenient as it avoids a need to set BaseWidth of each child widget viewport. In the new release this attribute is set by default for all viewport-based widgets in GLG palettes to enable text scaling on zoom by default.
The new MaxFontSize attribute of a text object defines the maximum font size to be used for scalable text objects. Setting MaxFontSize to a negative value disables the maximum size limit.
The MaxFontSize attribute limits the maximum font size only when the text object is scaled. If a text object's FontSize is set to a value greater than MaxFontSize, the FontSize value overrides the maximum font size limit.
In the previous releases, the Global attribute of a Data object was overloaded and contained information about both constraining on clone as well as subdrawing binding. This overloading prevented specifying both conditions in some elaborate use cases.
In the new release, a separate Bound attribute contains binding information, while the Global attribute contains only the information about constraining. This allows to specify both conditions when necessary.
If drawings that use bindings have to be exported into the pre-4.3 releases using the EXTENDED save format, a special option has to be used to combine both attributes into a single Global attribute used in previous versions.
If either the -glg-ext-save-42 command-line option is used or the GLG_EXT_SAVE_42 environment variable is set to true, the GLG Drawing File Conversion Utility and the GLG Graphics Builder will merge both attributes into one if the drawing is saved in the EXTENDED format. These options should only be used for exporting to the pre-4.3 versions of the Toolkit. The GlgExtSave42 global configuration resource is also provided for the API use.
The $Series/ prefix may be used to make public properties of a series' instances distinct. If the prefix is added to the TagName of the Export tags attached to an attribute of the series template, the corresponding public properties of the instances will be formed by adding a numerical suffix to the property name. For example, if a series template has public property with the TagName=$Series/Value, the series' instances will have corresponding public properties named Value0, Value1 and so on. If the Category of the template's export tag has the $Series/ prefix, each series instance will have a category that is created by adding a numerical index to the category name in a similar fashion.
The export tags of the series template with the $Series/ prefix will be listed in a tag browser in the OEM mode, but will be omitted in the non-OEM mode.
A new GlgSetCursorType API method may be used to set a cursor type in all supported environments. Several cursor types listed in the GlgCursorType enum are supported:
The new GlgSerialize and GlgSerializeFull C/C++ functions provide a way to save a GLG drawing into a stream or memory without a need to create a temporary file. Previously, this functionality was available only in the Java and C# versions of the GLG library.
A new GlgNativePrint API method may be used to print GLG drawings on both Windows and Linux. The method is passed a printing context obtained via the Windows or GTK print dialogs and uses it to print the drawing.
The GlgWinPrint method used in previous releases is deprecated, and GlgNativePrint should be used instead. The GlgPrint method used to generate PostScript output is deprecated and a new GlgExportPostScript method now provides this functionality.
The SetTemplate method used to set template of a subdrawing or a subwindow in the GLG JavaScript library now allows passing null as the template parameter. If non-null template is used, it overrides the filename specified by the object's SourcePath attribute. If a null template is passed, the file specified by the object's SourcePath attribute will be used (the SourcePath attribute must be set before setting a null template).
The FindMatchingObjects method has been deprecated and replaced with the new FindObjects method. The new method uses a new GlgFindObjectsData structure with a new include_top_object field that controls if the top object passed as the object parameter is included in the search results if it matches the search criteria.
To accommodate future extensions in the C/C++ version of the library, the GlgFindObjectsData structure in the C/C++ environment has be to initialized with zeros using the GlgInitStruct macro before being used.
In previous releases, the GLG Extended API was required to handle dialog viewports saved in a separate file. New GlgDialogInitialDraw and GlgDialogSetupHierarchy functions were added to the C/C++ API to handle dialog viewports saved in a separate file without a need for the Extended API.
The functions are similar to the corresponding GlgInitialDraw and GlgSetupHierarchy functions, but take a parent parameter that specifies the parent viewport the dialog will be attached to. The dialog viewport will still be a top level viewport and not a child viewport.
In previous releases, GLG_DISABLE_X_WRAPPER macro had to be defined in order to disable the GlgWrapperC class. This class was used by the Motif-based GLG wrapped widget in the X Windows environment. In the new release, the GlgWrapperC class is used only by the legacy X11 version of the C/C++ library and is disabled be default. In the C++ environment, the GTK version of the library uses a different GtkmmGlgWidget class. A new GLG_ENABLE_X11_WRAPPER macro can be used to enable the GlgWrapperC class to be used with the legacy version of the GLG library.
The name of the GLG_XFT_CHAR8_LOCALE value of the GlgLocaleType enum was changed to GLG_LATIN1_LOCALE.
A new button at the top of the Add Dynamics menu in the Professional and Enterprise versions of the GLG Graphics Builder toggles the dynamics type between Stock Dynamics and Predefined Dynamics. Previously, the user had to scroll to the end of the menu to access a button that toggled the dynamics type.
In previous releases, the grid used a fixed color defined by the GridColor variable in the GLG configuration file. This was not optimal when editing drawings with different background colors.
In the new release, the GridColor variable is set to -1., -1., -1. by default to use adaptive color. The grid automatically adjusts its color to make it distinct regardless of the drawing background color. The grid color can still be set to a predefined color by setting GridColor to the color RGB value with component range from 0 to 1.
At run time, the grid color is controlled by the GlgGridPolygon resource. If its EdgeColor is set to -1, -1, -1 (default), the grid will use adaptive color which is controlled by the color scale transformation attached to the EdgeColor attribute. The transformation parameters can be changed to control the exact way adaptive colors are selected depending on the drawing background color.
The grid color can still be set to a predefined color by setting GlgGridPolygon/EdgeColor resource to the color RGB value with component range from 0 to 1.
In previous releases, the KeepEditRatio attribute of the viewport and light viewport objects was limited to the binary YES or NO settings. In the new release, it may have three values that control how the viewport area is expanded when the user traverses the hierarchy down to edit the content of the viewport:
The KEEP RATIO option works the same as the YES option from the previous releases. The new KEEP SIZE option may be used to edit objects in the viewport in the same viewport size as it appears at the top level. It is now a default for the newly created viewports and all viewport-based widgets in the widget palettes.
The GlgKeepEditRatio enum contains the attribute values that can be used in a program.
In the previous releases, the layout toolbox did not update the object's Width and Height measurements when the object was changed. The object has to be unselected and than selected again to display the updated values.
In the new release, to display an updated value after changing the object, it is sufficient to click on any button to switch between displaying Width or Height, or switch between World or Screen coordinates.
New light-weight color indicator widget was added to the Controls widget set. The new widget uses a round marker object to minimize resource consumption in drawings with a large number of color indicators. The marker's SizeScaling property can be set to change marker size when the drawing resizes while preserving its round shape.
New Tabs Widgets may be used to create a tabbed interface that switches a drawing displayed in the display area depending on the selected tab. Several versions of the Tabs widget are provided, including both horizontal and vertical tabs.
The Tabs widget can be used in conjunction with a SubWindow object to switch drawings displayed in the SubWindow. The Tabs widget has a GoTo command action attached.
When the GoTo command is executed, an application can also access the selected drawing filename by using the transformed value of the DrawingFile resource in the Input callback, which can be accessed from the message object using the "Action/Command/DrawingFile/XfValue" resource path.
The XFT fonts in the default font table have been changed to better support UTF8 locale and to provide a more consistent font mapping among different Linux distributions. The Mono font is now used instead of Courier, Sans font is used instead of Helvetica, and Serif font is used instead of Times.
Multi-line labels are now supported in native buttons and toggles in all programming environments, including Windows.
In C/C++ on Windows, enabling support for multi-line labels is done via the BS_MULTILINE flag, which has a side effect of wrapping the label text if it doesn't fit the button, even if the label is not multi-line. The GlgEnableMultiline global configuration resource and the corresponding GLG_ENABLE_MULTILINE environment variable may be set to false to disable label wrapping, if needed.
The LB_INITSTORAGE Windows message was used to speed up initialization of list boxes that have a large number of items. The message preallocates memory for list items which results in faster initialization.
On Windows, the combo box height is determined by the font size and can't be adjusted. In the previous releases, the combo box was anchored at the top edge of the bounding box defined by its points, regardless of the bounding box height.
In the new release, if the combo box's height is smaller than the height of the bounding box defined by its points, the combo box will be centered vertically inside the bounding box. The GlgCenterComboBox global configuration resource and the corresponding GLG_CENTER_COMBO_BOX environment variable may be set to 0 to disable the centering.
In the new release, viewports can be made semi-transparent by setting their Visibility attribute to a fractional value in the range from 0 to 1 in the environments that support it (C/C++ GTK version and HTML5/JavaScript).
As an alternative, a Light Viewport object may be used instead of a Viewport for a cross-platform solution that supports transparency and works in all supported environments. In addition to the semi-transparency, Light Viewports also support a transparent background.
The default setting of the Palettes, Adjust Widget Size menu option in the HMI Configurator has been changed from ON to OFF to preserve original size of the custom components. The AdjustWidgetSize variable in the glg_hmi_config file may be used to change the default.
The new GLG_ENABLE_OPENGL environment variable may be used to enable the use of OpenGL for viewports that have their OpenGLHint set, providing a more convenient alternative to the GLG_OPENGL_MODE variable.
In the GTK environment on Linux, the use of OpenGL is disabled by default, as Cairo renderer uses automatically hardware acceleration when available. Setting this variable to true enables the explicit use of OpenGL API for rendering all viewports that have OpenGLHint set.
The Color Scale transformation was improved to better handle colors with a single RGB component. Such colors are now treated as bright colors regardless of the transformation's MinBrightness attribute setting. This ensures that the output value is distinct from the transformation's BaseColor.
Fixed incorrect positioning of top level dialog viewports on systems with multiple monitors on Windows. Previously, the dialogs could appear off-screen depending on the monitor where the application that displayed the dialogs was located.
Fixed incorrect viewport Z-ordering on initial appearance in C#, which was visible for intersecting viewports.
Fixed viewport Z-ordering after using ReorderElement to reorder viewports in Java. The correct order was shown only after the window was resized.
When a Subwindow containing a viewport with multiple text entry boxes was destroyed, an exception was generated in some special cases due to the large number of Focus events being generated. This exception was fixed in the new release.
Fixed a Chrome browser slowdown when a drawing with fast update rate was displayed on a web page for a long time.
Fixed exception generated when destroying a native text entry with a focus inside it.
Fixed tooltips of a floating top-level dialog viewports appearing behind the dialog.
Fixed handling of the DisableInput attribute of option menu, list, text and text edit widgets.
Fixed the password widget to properly display dots for entered text characters.