TRichView 16.13 - text fields, image deactivation, etc.
Posted: Mon Feb 13, 2017 9:32 am
New versions are released: TRichView 16.13, RichViewActions 6.12, ScaleRichView 7.7, ReportWorkshop 1.5
As you may notice from version numbers, we do not consider this update as a major update. However, many interesting new features are implemented.
Some of them:
- image activation/deactivation to save memory and resources
- text fields
- controlling image file names on import
- seamless integration of HTML reading and XML components in RichViewActions,
and more
Installers
Trial versions are available here:
http://www.trichview.com/download/
Like before, there are two versions of the trial Setup.
The first version installs the components in Delphi (and also in C++Builder, if available). It supports both 32-bit and 64-bit platforms.
(important!) This version can install even in C++Builder without Delphi personality, if command line Delphi compilers are available (and they should). This is the recommended way to install.
The second version installs C++Builder only packages. This version of the installer is mainly provided for a backward compatibility (or use it, if you need to install in C++Builder 6).
Image activation/deactivation
Since this version, only 100 images in each TRichView are stored as TGraphic objects. All other images are "deactivated" (destroyed and saved to a memory stream, to be recreated again when they are needed). This mechanism allows saving memory and (the most important) GDI resources. It works for pictures, hot-pictures, background images of tables and table cells.
In previous version, application crashed if you tried to add several thousand of images. Now you can add 10000 images, without any problem.
Obvious compatibility issues:
1) You cannot add an image to TRichView and store a link to its TGraphic object for a later use. After redrawing or adding other images, this object may be destroyed.
2) All TGraphic classes used in TRichView must implement SaveToStream and LoadToStream correctly (there are some third-party graphic classes that implement only LoadToStream).
Otherwise, this feature is completely transparent to the application and end-users.
Text fields
This update introduces a new feature: text items that are not deleted when they become empty. They can be used to implement text fields.
Text styles have new property: EmpyWidth. By default, it is zero, so text items work as before.
If you assign a positive value to this property, it defines width of empty text items of this style. Such items are not deleted when all item characters are deleted (when pressing Delete or Backspace key, or deleting selection), but they can be deleted when they are empty (unless protected).
Recommendations: I recommend to use background color for these items. You can assign a small width (less than space characters). Or you can assign large value (to attract attention to unfilled fields).
I have more ideas to improve this feature in future.
The demo Demos\DelphiUnicode\Assorted\Fields\FillInGaps is changed to use this new property.
Controlling image file names on import
A new option is added in for TRichView.Options: rvoAssignImageFileNames.
If included, the components assign "image file name properties" when importing external images.
In other words, this options defines whether the file name (or URL) of the image source will be stored together with imported images.
The following properties are affected:
- rvespImageFileName item property of pictures, hot-pictures, tables (for tables, it is also accessible as table.BackgroundImageFileName property)
- cell.BackgroundImageFileName.
External images may be imported on:
- RTF loading (reading external images),
- HTML loading using TrvHtmlImporter
- HTML loading using TrvHtmlViewImporter
- pasting files (CF_HDROP format)
- accepting drag&drop files (CF_HDROP format)
- accepting drag&drop URL to image (if rvoDragDropPicturesFromLinks is included in EditorOptions property; this is also a new feature, see below)
- RichViewActions (TrvActionPasteSpecial, TrvActionInsertPicture, TrvActionItemProperties (properties of pictures, hot-pictures and tables), TrvActionTableProperties)
Previously, the behavior was either hard-coded (usually, file names were not stored), or was controlled by various different properties. Now, everything is centralized in this option.
A new event is added: TRichView.OnAssignImageFileName event. This event allows changing image file name before assigning (for example, you can convert full paths to relative paths). It occurs on all cases listed above.
Previous versions:
http://www.trichview.com/forums/viewtop ... f=6&t=7906 (TRichView, RichViewActions, ScaleRichView)
http://www.trichview.com/forums/viewtop ... f=6&t=7907 (Report Workshop)
As you may notice from version numbers, we do not consider this update as a major update. However, many interesting new features are implemented.
Some of them:
- image activation/deactivation to save memory and resources
- text fields
- controlling image file names on import
- seamless integration of HTML reading and XML components in RichViewActions,
and more
Installers
Trial versions are available here:
http://www.trichview.com/download/
Like before, there are two versions of the trial Setup.
The first version installs the components in Delphi (and also in C++Builder, if available). It supports both 32-bit and 64-bit platforms.
(important!) This version can install even in C++Builder without Delphi personality, if command line Delphi compilers are available (and they should). This is the recommended way to install.
The second version installs C++Builder only packages. This version of the installer is mainly provided for a backward compatibility (or use it, if you need to install in C++Builder 6).
Image activation/deactivation
Since this version, only 100 images in each TRichView are stored as TGraphic objects. All other images are "deactivated" (destroyed and saved to a memory stream, to be recreated again when they are needed). This mechanism allows saving memory and (the most important) GDI resources. It works for pictures, hot-pictures, background images of tables and table cells.
In previous version, application crashed if you tried to add several thousand of images. Now you can add 10000 images, without any problem.
Obvious compatibility issues:
1) You cannot add an image to TRichView and store a link to its TGraphic object for a later use. After redrawing or adding other images, this object may be destroyed.
2) All TGraphic classes used in TRichView must implement SaveToStream and LoadToStream correctly (there are some third-party graphic classes that implement only LoadToStream).
Otherwise, this feature is completely transparent to the application and end-users.
Text fields
This update introduces a new feature: text items that are not deleted when they become empty. They can be used to implement text fields.
Text styles have new property: EmpyWidth. By default, it is zero, so text items work as before.
If you assign a positive value to this property, it defines width of empty text items of this style. Such items are not deleted when all item characters are deleted (when pressing Delete or Backspace key, or deleting selection), but they can be deleted when they are empty (unless protected).
Recommendations: I recommend to use background color for these items. You can assign a small width (less than space characters). Or you can assign large value (to attract attention to unfilled fields).
I have more ideas to improve this feature in future.
The demo Demos\DelphiUnicode\Assorted\Fields\FillInGaps is changed to use this new property.
Controlling image file names on import
A new option is added in for TRichView.Options: rvoAssignImageFileNames.
If included, the components assign "image file name properties" when importing external images.
In other words, this options defines whether the file name (or URL) of the image source will be stored together with imported images.
The following properties are affected:
- rvespImageFileName item property of pictures, hot-pictures, tables (for tables, it is also accessible as table.BackgroundImageFileName property)
- cell.BackgroundImageFileName.
External images may be imported on:
- RTF loading (reading external images),
- HTML loading using TrvHtmlImporter
- HTML loading using TrvHtmlViewImporter
- pasting files (CF_HDROP format)
- accepting drag&drop files (CF_HDROP format)
- accepting drag&drop URL to image (if rvoDragDropPicturesFromLinks is included in EditorOptions property; this is also a new feature, see below)
- RichViewActions (TrvActionPasteSpecial, TrvActionInsertPicture, TrvActionItemProperties (properties of pictures, hot-pictures and tables), TrvActionTableProperties)
Previously, the behavior was either hard-coded (usually, file names were not stored), or was controlled by various different properties. Now, everything is centralized in this option.
A new event is added: TRichView.OnAssignImageFileName event. This event allows changing image file name before assigning (for example, you can convert full paths to relative paths). It occurs on all cases listed above.
Previous versions:
http://www.trichview.com/forums/viewtop ... f=6&t=7906 (TRichView, RichViewActions, ScaleRichView)
http://www.trichview.com/forums/viewtop ... f=6&t=7907 (Report Workshop)