TRichView
Improves Lazarus and Unicode support.
Features
Compatibility Issues
- Methods for compatibility with very old versions of TRichView have been removed.
- Redundant TRichView.Add*** methods now marked as deprecated. Only a single method for each item type is recommended. These methods have optional parameters. For example, use AddBreak instead of AddBreakEx, AddBreakTag, AddBreakExTag.
- All String, TRVRawByteString, TRVAnsiString properties, events and parameters of methods have been changed to TRVUnicodeString, where possible.
- Changed events:
- In TRichView: OnAssignImageFileName, OnImportPicture, OnItemAction, OnItemHint, OnReadHyperlink, OnRVDblClick, OnRVRightClick, OnRVFControlNeeded, OnRVFPictureNeeded, OnSaveComponentToFile, OnSaveDocXExtra, OnSaveHTMLExtra, OnSaveImage2, OnSaveItemToFile (additionally, Unicode: Boolean parameter is removed), OnSaveParaToHTML, OnSaveRTFExtra, OnSpellingCheck, OnWriteHyperlink.
- In TRichViewEdit: OnDropFile, OnItemTextEdit.
- In TRVStyle: OnDrawStyleText.
- A new PSaD parameter has been added to TRVStyle custom drawing events. Additionally, text is now drawn relative to its base line. These change may affect your existing custom drawing code. Also, parameters are added to:
- In TRVStyle: OnDrawStyleText (Baseline and PSaD), OnApplyStyle (PSaD).
- In TFontInfo: Draw (Baseline and PSaD).
- If you use these events in your application, you need to change types of parameters manually. Since TRVUnicodeString is defined in RVTypes unit, make sure that this unit is listed in "uses" of your forms.
- In OnSaveDocXExtra, with Area = rv_docxs_ParaStyle, the meaning of the Obj parameter has changed. Now it contains an RVData instead of a paragraph style.
- Many method var-parameters have been changed to out-parameters. This change should not affect your projects unless you developed classes inherited from TRichView classes.
- Controls loaded from RVF are now scaled from RVF PPI ("pixels per inch") to the actual PPI. Controls in RVF files saved by older versions of TRichView are not scaled (unless you change value of DefaultRVFPixelsPerInch), however, the actual PPI is assigned to their Font.PixelsPerInch.
- RichViewPixelsPerInch global variable and TRVStyle.TextStyles.PixelsPerInch are deprecated. Use TRichView.DocumentPixelsPerInch and TRVStyle.UnitsPixelsPerInch.
- TRVStyle.GetAsPixels, TRVStyle.PixelsToUnits, and functions for unit conversions have additional parameters.
- Sizes measured in pixels now use TRVStyle.UnitsPixelsPerInch instead of Screen.PixelsPerInch. This change affects some code, e.g. the example in RV_GetPrinterDC;
Lazarus
- TRichView is compatible with Lazarus (32-bit and 64-bit Windows targets).
Embarcadero RAD Studio 10.3 Rio
- Complete support for multiple monitors with different PPI ("per monitor v2").
Unicode
- All text is now stored in the components as Unicode, for all versions of Delphi. All string properties and parameters are made Unicode, when possible. Because of this change, some properties became obsolete. They are not removed, but do nothing:
- TFontInfo.Unicode
- TRVStyle.DefUnicodeStyle
- TRVRTFReaderProperties.UnicodeMode
- Added support for Unicode characters with codes greater than $FFFF.
- Added support for pasting and drag & dropping Unicode URLs.
- Added support for entering a character by holding Alt and typing the decimal character code on the numeric keypad, starting from '0' (Num Lock must be on); this feature can be turned off, if you include rvoAlt0CodesUseKeyboardCodepage in EditorOptions.
- Added support for etering a character by typing its hexadecimal code (directly in the editor) and then pressing Alt+X. Pressing Alt+X again converts it back to a hexadecimal number.
Measure Units, Zooming, High DPI
- Added new measure unit to TRVStyleUnits: EMU (English metric unit).
- You can now define DPI for all values measured in pixels in TRVStyle.UnitsPixelsPerInch. With this property, pixels become independent of the screen DPI, like twips and EMU. When displaying on the screen, all pixel sizes are scaled from UnitsPixelsPerInch, including image sizes (the only exceptions are controls and images from image lists).
- High DPI display modes are now supported completely.
- If an application supports monitors with different DPI (in Delphi 10.1+), TRichView uses the DPI of its monitor. "Per monitor v2" is supported in Delphi 10.3.
- You can now change the document DPI using TRichView.DocumentPixelsPerInch property. This property allows to implement zooming.
Editing
- Added a new (alternative) way to group editing operations for undo: BeginUndoGroup2..EndUndoGroup2 (or BeginUndoCustomGroup2..EndUndoCustomGroup2). These methods allow grouping operations in several table cells.
New Events
- TRichView.OnReadMergeField allows reading merge fields from RTF.
Text Drawing
- All text is drawn relative to its base line. Previously, by default, it was drawn relative to its top left corner. This new drawing produces better results for scaled text (in TRVPrintPreview or in ScaleRichView). This change affects TRVStyle.OnDrawStyleText event and TFontInfo.Draw method, see the compatibility issues above.
Saving and Loading
- RVF
- Load graphics from RVF even if the specified graphic class is not available (or not registered). The proper graphic class is chosen by the graphic content. New option for RichView.RVFOptions: rvfoIgnoreGraphicClasses, allows you to ignore names of graphic classes specified in RVF.
- The "pixels per inch" value is now stored in RVF files. This value is used to scale loaded controls from RVF PPI to the actual PPI, you can disable scaling by assigning 0 to the additional integer property rveipcDPIScalable (but the actual PPI is still assigned to Font.PixelsPerInch of controls).
- DocX
- OnSaveDocXExtra, with Area = rv_docxs_ParaStyle, now you know the location of this paragraph in the document.
Animation
- If an image contains frames of an animation, it can be played. Previously, this kind of animation was implemented only for TBitmap pictures. Now it is available for any image type. This feature is available if RVGridAnimate unit is included in the project.
Other Features
- GetCurrentCharacter may return more than one characters, if they assemble a single glyph.
- Improvements in table layout algorithm.