TRichView 19.3 - rich text editor for FireMonkey

News about TRichView, ScaleRichView, ReportWorkshop, RVMedia
Post Reply
Sergey Tkachenko
Site Admin
Posts: 15951
Joined: Sat Aug 27, 2005 10:28 am
Contact:

TRichView 19.3 - rich text editor for FireMonkey

Post by Sergey Tkachenko »

TRichView is updated to version 19.3.

The new release includes the first version for FireMonkey (Windows platform, see the notes in the next messages).

New in VCL/LCL version: HTML de-encapsulation from RTF, new components for DevExpress ribbon (described in a separate topic). Lazarus 2.0.12 support.

Trial versions are available: https://www.trichview.com/download/
A full version can be found in the protected section of this forum (or old setups can check for updates and download new versions).

Previous version
https://www.trichview.com/forums/viewto ... =6&t=10374
Sergey Tkachenko
Site Admin
Posts: 15951
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Licensing

Post by Sergey Tkachenko »

FireMonkey version is available for VCL+LCL customers without additional payments (however, for old customers, it may require a license renewal).

If you ordered in 2020 and 2021, or have an active subscription:
This update is free, including VCL, LCL, FMX.

If you ordered in 2019:
VCL and LCL update is free (the first paid update will be available later in this year).
FireMonkey version requires a payment for a renewal (or subscription).
After a renewal, you will receive a FMX version, and free updates of VCL+LCL+FMX version for the next period (till 2023).

If you ordered in 2018 or before (and the period of free updates expired):
This is a paid update, it requires a payment for a renewal (or subscription).
After a renewal, you will receive a FMX version, and free updates of VCL+LCL+FMX version for the next period (till 2023).

If you are one of the old customers who have free lifetime updates:
You still have free lifetime updates of VCL+LCL version, but not FMX version.
FMX version requires a payment for a renewal (or subscription).
After a renewal, you will receive a FMX version and its free updates till 2023.
Updates of VCL version are still free for you.

Renewal prices and links can be found on the private support forum, or contact me (email richviewgmailcom, or a private message in this forum)
Sergey Tkachenko
Site Admin
Posts: 15951
Joined: Sat Aug 27, 2005 10:28 am
Contact:

What's ported and plans

Post by Sergey Tkachenko »

What has been ported

The following components have been ported:
  • TRichView - rich text viewer
  • TRichViewEdit - rich text editor
  • TRVStyle - additional component that provides settings and formatting options for TRichView and TRichViewEdit
These are core components in the package.

TRVPrint and TRVReportHelper will be ported in the next update.
(all their code has been ported but not tested; most probably, it will work after minor modifications)

TRVOfficeConverter uses an obsolete Windows-only technology and will not be ported.

Supported Delphi/C++Builder versions: XE6, XE7, XE8, 10, 10.1, 10.2, 10.3, 10.4.

All types of document objects have been ported (except for equation item, it is available only in VCL version):
  • text
  • all types of bullets and numbering (including text and images)
  • pictures
  • images from TImageList
  • controls
  • tables
  • horizontal lines
  • text labels
  • numbered sequences (counters)
  • footnotes, endnotes, text boxes, page number, page count (although, the full functionality of these items requires printing)
  • tabulations
All paragraph attributes were ported, except for justified and distributed alignments (they are displayed as left alignment).
All text attributes were ported, except for character spacing, character scaling and font quality. Bi-directional text (Arabic and Hebrew), UTF-32 characters are supported.
All item properties were ported, except for transparent color and mode for TBitmap.

All editing operations have been ported, including Clipboard and drag&drop.

"Smart popups" (a button next to the edited object) were ported.

The following features were not ported yet: animations, live spelling check. They will be ported in the next update.

40 TRichView demo projects were ported (all projects except for demo projects related to printing (they will be included in the next update), animation, VCL-specific features (custom hints)).
FMXDemos.jpg
FMXDemos.jpg (247.57 KiB) Viewed 6193 times
The help file is updated. The same help file is used for VCL, Lazarus and FireMonkey version. The online version is here: https://www.trichview.com/help/

Platforms

All the code is written as cross-platform. There are some special improvements for Windows (like special Clipboard support, optimizations for Direct2D and GDI+ canvases; but they are used only when compiling for Windows target).

However, only Windows version is tested, so the current version is announced as Windows only. After testing on (and optimizing for) other platforms, they will be added.
But if you try it on other platforms, please let me know about results (for mobile platforms, make sure that string indexes are started from 1).
At least I know it can be compiled for non-Windows platform on Delphi 10.4.

What's next

Next I plan to port remaining features, starting from printing and spelling checking. I plan to port some additional components (RichViewXML, RvHtmlImporter, TRVASpell, TRVHunSpell).
Next I plan to add platforms, starting from Mac.
After platforms, I'll start converting RichViewActions.
Sergey Tkachenko
Site Admin
Posts: 15951
Joined: Sat Aug 27, 2005 10:28 am
Contact:

FMX vs VCL

Post by Sergey Tkachenko »

Can FMX and VCL versions be installed in the same Delphi/C++Builder IDE?

Yes, but the both of them must have version 19.3 or newer.
The FMX version uses similar unit names with "fmx" prefix. For example, fmxRichView.pas instead of RichView.pas. There are some units that exist only in VCL/LCL and only in FireMonkey version. FireMonkey-only units have "FM" postfix, for example fmxRVClipboardFM.pas.

Can RVF files saved by VCL version be opened in FMX version and vice versa?

Yes.

Maybe, except for controls (if you insert controls in documents), because controls are different in VCL and FMX.
The following RVF Options may help: rvfoIgnoreUnknownCtrls, rvfoIgnoreUnknownCtrlProperties.

Moreover, collections of text, paragraphs and list styles (properties of TRVStyle) are saved in DFM/FMX identically. Because of this, you can copy-paste TRVStyle objects between VCL and FMX projects.

In VCL and FMX, some properties have different types: font sizes (integer/single), colors (TColor/TAlphaColor), pictures (TPicture/TRVPicture). However, they are saved in RVF and DFM/FMX files in a compatible way. When FMX version saves TAlphaColor, it saves it as TColor and Opacity properties (Opacity is stored only for semitransparent colors). VCL version reads TColor and ignores Opacity. This ignoring works for styles. However, for tables it works only in v19.3+.
More about differences:
https://www.trichview.com/help/firemonkey.html

About color transparency

In FMX version, TAplaColor is used instead of TColor, so all lines and fills can be semitransparent.
In VCL version, you can specify opacities for some fills (like paragraph, table and cell backgrounds) in separate properties. In FMX version, both these opacities and color opacities are applied (multiplied).

About scrollbars

In VCL version:
- a horizontal scrollbar can be completely hidden or shown when needed.
- in TRichView, vertical scrollbar can be completely hidden or shown when needed.
- in TRichViewEdit, vertical scrollbar can be completely hidden or always shown (it has disable-no-scroll option).

In FMX version:
- you can define scrollbars in FMX style; by default, TRichView and TRichViewEdit use TMemo's style
- TRichView and TRichViewEdit are inherited from TScrollBox and use its properties, including ShowScrollBars and AutoHide. As a consequence, you cannot define different hide and show options for a horizontal and a vertical scrollbars.
To-do: now it will not be difficult to use an auto-show option for a vertical scrollbar in VCL/LCL TRichViewEdit. It will be implemented in one of next updates.

About scrolling

In VCL version, when you insert controls in documents, they are inserted directly in TRichView. On scrolling, coordinates of controls are changed accordingly. Due to some technical limitations, TRichView has to use tags of these controls. Vertical scrolling is possible to positions that are multiple of value of VSmallStep property.

In FireMonkey version, all controls are inserted in a special internal control that represents a document area. On scrolling, this internal control is moved, and all its child controls are moved together with it. Tags are not used, scrolling is possible to any position.

In VCL version, scrolling can be smooth (optionally). This feature is not implemented in FMX version (if you know how to implement it using FMX animations, let me know).
Sergey Tkachenko
Site Admin
Posts: 15951
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Clipboard and Drag&Drop

Post by Sergey Tkachenko »

Clipboard in FireMonkey version

In FireMonkey, you can copy only a single format to the Clipboard (in older versions of Delphi, FireMonkey allows copying only a plain text; newer version allows copying text, bitmap, or a custom format).

This is a very serious limitation for a rich text editor, so I implemented a special support for Windows clipboard. It is used only when compiling for Windows platform. So VCL and FMX versions support the Clipboard identically in Windows.

For all other platforms, the most appropriate format is copied:
- if an image is selected, this image is copied
- otherwise, the best format is chosen from Options: RVF, RTF or text.

Drag&drop in FireMonkey version

There is no way to override the standard drag&drop behavior in FireMonkey, so TRichView and TRichViewEdit use FMX drag&drop.

When dragging between editors within the same application (or dragging within the same editor), data are transferred in the most appropriate format listed in AcceptDragDropFormats property. Otherwise, data are provided as an image or as a plain text, depending on the selection.

When accepting dragged data from another source, TRichViewEdit supports: a plain text, an image, a list of files.
You can use events to insert data in your own formats.
Sergey Tkachenko
Site Admin
Posts: 15951
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Graphics

Post by Sergey Tkachenko »

Graphic

In VCL/LCL version, you can insert any image inherited from TGraphic, including TBitmap, TMetafile, TJPEGImage, TPngImage, etc., and third-party graphic classes (like TSVGImage).

In FireMonkey version, a special class TRVGraphic is used instead. Currently, it is a wrapper around TBitmap and supports all formats supported by FMX TBitmap (including bitmaps, windows icons, PNG, Jpeg). In future, I plan to add support for SVG images in FMX.
FireMonkey version does not support Windows metafiles (if you know a third-party metafile implementation for FireMonkey, please let me know).

Images from TImageList

Some items (bullets, hotspots, list markers) may display images from TImageList.
TImageList is available in FireMonkey starting from RAD Studio XE8. But it is different from VCL TImageList: for each image, it may contain multiple versions of arbitrary sizes (usually used for different resolutions).
FireMonkey version of TRichView supports TImageList. The items that use TImageList have two additional properties in FireMonkey: ImageWidth and ImageHeight. The component chooses the best image that fits the specified size.
Sergey Tkachenko
Site Admin
Posts: 15951
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Demo projects

Post by Sergey Tkachenko »

Demo projects for FireMonkey

As I said before, all appropriate TRichView demo projects have been ported.
You can find them in <TRichView FMX Dir>\TRichView\Demos\Delphi.FMX\ folder.

Demo projects can be opened in all Delphi versions starting from XE7.

Some demos were ported one-to-one.
Some demos have changes. For example, in "Search and Replace" demo, a "search and replace" dialog is implemented by the application (instead of TFindDialog and TReplaceDialog, because they do not have analogs in FireMonkey), and so on.

The most important changes are in the following demo projects:

1) Editors\Editor 2\, Editors\StyleTemplates\
Rvedit.jpg
Rvedit.jpg (166.39 KiB) Viewed 6201 times
These demos show how to implement simple text editors with commands for changing text and paragraph attributes (like "make bold", "apply font name", "change paragraph alignment").
FMX version have improvements:
- it is based on actions
- it has modern toolbar glyphs
- it supports image insertion
- it supports multiple file formats (RVF, DocX, RTF, Markdown)
(the last change was added to VCL and LCL versions of these demo projects as well)

2) Assorted\Graphics\DragImg\
FMXDrag.png
FMXDrag.png (61.12 KiB) Viewed 6200 times
In VCL/LCL version, the editor uses system (OLE) drag&drop, and this demo shows how you can use VCL/LCL drag&drop in addition to it.
In FireMonkey version, this demo uses FMX drag&drop, but shows how to use events to accept dragged controls differently: as an image, as a text, or as a control.
Sergey Tkachenko
Site Admin
Posts: 15951
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Changes in VCL/LCL versions

Post by Sergey Tkachenko »

Changes in VCL/LCL version

Lazarus: this version supports/needs Lazarus 2.0.12 (the previous version was for Lazarus 2.0.10).

There are no new features in TRichView (except for HTML-RTF deencapsulation)
There are some small fixes and optimizations + major refactoring inside, but without changing documented properties and methods.

Some functions were moved from RVFuncs.pas to RVColorFuncs.pas and RVCoordFuncs.pas.
Some undocumented properties were renamed (since this version, we avoid using parameters and properties that have the same names as units). For example, TRichViewRVData.RichView was renamed to TRichViewRVData.OwnerRichView.

Changes in VCL/LCL demo projects

The editors in "Editor 1" and "Editor 2" folder now support multiple formats (RVF, DocX, RTF, Markdown).
Images for tabs are changed for ScaleRichView ActionTestTabs demos. Now they include images for all formats (RVF, DocX, RTF, Markdown, text, other) and are the same for Unicode and non-Unicode versions of demos.
Some cosmetic changes in several demos.
Obsolete code is fixed in ScaleRichView\Demos\Delphi\RVDemos\Assorted\Printing\Headers.
Sergey Tkachenko
Site Admin
Posts: 15951
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Extracting encapsulated HTML from RTF

Post by Sergey Tkachenko »

Extracting encapsulated HTML from RTF

HTML-in-RTF encapsulation is made by Microsoft Outlook/Exchange.
This is an RTF file created from HTML. It looks close to the original HTML file (i.e. it contains RTF code that mimics the original HTML document), but also contains data allowing to extract the original HTML document unchanged.

A new unit is added: RVRTFDeEncapsulation.pas (fmxRVRTFDeEncapsulation.pas in FireMonkey version).

It contains two functions:

Code: Select all

function GetRTFEncapsulationType(RTFStream: TStream): TRVRTFEncapsulationType;
function ExtractEncapsulatedHTMLFromRTF(RTFStream, HTMLStream: TStream;
  OnAttachmentPosition: TRVAttachmentPositionEvent = nil): Boolean;
where

Code: Select all

type
   TRVRTFEncapsulationType = (rvrtfetNone, rvrtfetHTML, rvrtfetText, rvrtfetError);
GetRTFEncapsulationType checks if the specified stream contains HTML or a plain text encapsulated in RTF. Possible result values:
  • rvrtfetNone - RTF without encapsulation
  • rvrtfetHTML - RTF containing encapsulated HTML
  • rvrtfetText - RTF containing encapsulated plain text
  • rvrtfetError - not RTF
ExtractEncapsulatedHTMLFromRTF performs extraction of encapsulated HTML or plain text from RTF (from RTFStream to HTMLStream).
Also, if the callback function OnAttachmentPosition is provided, it calls it when it finds an attachment position (you can store the position of HTMLStream where this attachment is located, and/or insert some text in resulting HTML/text in this position).

More info about HTML-in-RTF encapsulation and attachments:
https://docs.microsoft.com/en-us/opensp ... 8b794079e7
Sergey Tkachenko
Site Admin
Posts: 15951
Joined: Sat Aug 27, 2005 10:28 am
Contact:

FireMonkey rich text editor

Post by Sergey Tkachenko »

User interface translations

The following UI translations were updated in RichViewActions and ScaleRichView:
  • Portuguese (Br), thanks to Alexandre Garcia
  • Slovenian, thanks to Goran Brumen
Sergey Tkachenko
Site Admin
Posts: 15951
Joined: Sat Aug 27, 2005 10:28 am
Contact:

TRichView 19.3.1

Post by Sergey Tkachenko »

TRichView 19.3.1

New events:
TCustomRichView.OnAfterDrawImage, TCustomRVPrint.OnAfterPrintImage allow drawing additional content on top of images.

New table operation:
TRVTableItemInfo.MoveRows.
This is an undoable operation. Like other similar operations, it requires BeginItemModify/EndItemModify.

Also, I forgot to mention a new method of version 19.3: TCustomRichViewEdit.MoveCaret.



Additionally, this version includes bug-fixes (the most important one is related to live spelling checking).
Since this update, FireMonkey version uses dotted lines instead of squiggly lines to underline misspelled words.
Post Reply