Lazarus 3.0 release notes

From Free Pascal wiki
Revision as of 11:36, 13 November 2023 by Dbannon (talk | contribs) (Gtk3 requirements)
Jump to navigationJump to search

LCL Interfaces Changes

Cocoa

  • IME fully supported, such as Chinese/Japanese/Korean, DeadKeys, Emoji & Symbols.
  • Multi Displays/Monitors fully supported.
  • Docking fully supported, including the IDE.
  • Cursor completely refactored and significantly improved, compatible with MacOS Ventura.
  • TPageControl significantly improved.
  • Many controls improved (TComboxBox/TListBox/TDateTimePicker/TStaticText/TSpeedButton/TPanel etc.)
  • Many memory leaks fixed.

Qt

  • Implemented TCheckBox.Alignment and TRadioButton.Alignment.
  • Implemented TCustomComboBox.AdjustDropDown and TCustomComboBox.ItemWidth.

Qt5

  • Qt5 uses native event loop on all platforms. C bindings are updated. Minimum C bindings version for lazarus 3.0 is 1.2.15.
  • Note that most Linux Distributions will not have an appropriate libqt5pas library until their next release after the formal release of Lazarus 3.0. Build your own from the Lazarus source tree or download from https://github.com/davidbannon/libqt5pas/releases/latest
  • Implemented TCheckBox.Alignment and TRadioButton.Alignment.
  • Implemented TCustomComboBox.AdjustDropDown and TCustomComboBox.ItemWidth.

Qt6

  • Qt6 widgetset implemented. C bindings are based on Qt6 6.2.0 LTS. Minimum C bindings version for lazarus 3.0 is 6.2.7.
  • Note that most Linux Distributions will not have an appropriate libqt6pas library until their next release after the formal release of Lazarus 3.0. Build your own from the Lazarus source tree or download from https://github.com/davidbannon/libqt6pas/releases/latest
  • Implemented TCheckBox.Alignment and TRadioButton.Alignment.
  • Implemented TCustomComboBox.AdjustDropDown and TCustomComboBox.ItemWidth.

Gtk3

  • Gtk3 pascal bindings are completely reworked.
  • A number of stability improvements.
  • Now requires GTK >= 3.24.24 and Glib2.0 >= 2.66

LCL Changes

TCustomImageList

TCustomImageList made more extensible:

  1. Protected MarkAsChanged method is added, which sets FChanged to true (this allows to make custom triggers for OnChange event).
  2. Virtual protected DoAfterUpdateStarted and DoBeforeUpdateEnded methods are added. They are called in first BeginUpdate and last EndUpdate respectively.

TTaskDialog

  • Old behaviour Win32: A placeholder icon was used for FooterIcon = tdiNone and MainIcon = tdiNone.
  • New behaviour Win32: No icon is used for FooterIcon = tdiNone and MainIcon = tdiNone.
  • Reason: Removing drawing glitch. The text move over to allow more content and better alignment. See Issue #39172

TSpeedButton

  • Old behaviour: Multi-line captions could only be entered by code. And multi-line captions were always left-aligned.
  • New behaviour: Multi-line captions can also be entered in the object inspector. New property Alignment to specify whether the caption should be left-/right-aligned or centered. Default: centered, like in Delphi.
  • Reason: Better usability.

TLabel.Transparent, .Color and .ParentColor changes

  • Old behaviour: Transparent property was bound to Color=clNone
  • New behaviour: Transparent is a standalone property
  • Reason: Delphi compatibility and to fix ParentColor issues.
  • Remedy: If you are setting the Color property, Transparent is not automatically switched from True to False now, you have to do it yourself. This is in compliance with Delphi and also solves problems with Color/ParentColor changes.

TPanel.VerticalAlignment

  • Old behaviour: The panel caption was always centered vertically.
  • New behaviour: The new property VerticalAlignment (taAlignTop, taAlignBottom, taVerticalCenter) allows to place the caption also at the top or bottom of the panel interior.
  • Reason: Delphi compatibility and better usability

TCalendar

  • Properties MinDate and MaxDate are implemented. These limits are only imposed if MaxDate > MinDate. Unfortunately GTK2/3 widgetsets do not support this, so selecting a date outside the MinDate/MaxDate range will still be possible there.

TCheckbox, TRadioButton

  • Different calculation of checkbox/radiobutton size in order to correctly take care of Win-10 "ease of access" feature. See Issue #39398
  • Consequence: lfm files will contain different sizes of these controls (if auto-sized) compared with earlier versions.

Grids

  • You can now set the cell editors properties ParentColor and ParentFont by including goEditorParentColor resp. goEditorParentFont in the grid's Options2 property.

TShellTreeView

  • New property ExpandCollapseMode defining options whether a collapsing node should clear its child nodes.
  • Implements custom sorting of the treeview items by setting FileSortType to fstCustom and providing a custom compare function in the event OnSortCompare.

TShellListView

  • TShellListView now subclasses TListItem, so it can store file info in it.
  • If you use OnCreateItemClass to create your own descendant of TListItem, it may be advisable to base your own class on TShellListItem instead of on TListItem. This way you will also have access to the TShellListItem's FileInfo property.

TTreeView

  • Adds ShowSeparators as a published property like ShowLines and ShowRoot.

IDE Changes

Character map

  • Resizable characters to improve readability.
  • The character map was split off from the IDE and moved to separate packages. The designtime package is installed by default so that there is no difference in the IDE. Now users can access it in their own applications after adding the runtime package "charactermappkg.lpk" to the project requirements.

Debugger

Project Options

  • "Run(F9)" can either be "Debug" or "Run without debug".
In newly created Debug/Release modes, the Release mode will no longer invoke the debugger by default.
Existing Debug/Release modes must be edited, to enable this.
  • Per project "Debugger backend" settings. In addition to choosing a specific backend from the global IDE settings, a backend can be configured just for the project (i.e. special gdb-server settings)

IDE Dialogs

  • Improved Watches window
    • Expand/Unfold for classes, records, etc
    • Expand/Unfold with paged browser for arrays
    • Drag and Drop to reorder watches
    • Drag and Drop to create new "top level" watches from nested entries (in expand/unfolded lists)
    • Address column for types with internal pointer (classes, long-string, dyn-array, (real) pointer)
  • Improved Locals window
    • Expand/Unfold for classes, records, etc
    • Expand/Unfold with paged browser for arrays
    • Address column for types with internal pointer (classes, long-string, dyn-array, (real) pointer)
    • Power button
  • Improved Inspect window
    • Fixed: Updating value when context changes
    • Added options for Function calling / and "Converter" (See FpDebug: SysVarToLstr)
    • Added filter to search for text in name or value.
    • Added ctrl-Up/Down/Page-Up/Page-Down to navigate the grid.
      Alt-Left/Right for history. And ctrl-Enter to select.
  • Improved Evaluate/Modify window
    • New Layout
    • Added DisplayFormat
    • Added options for Function calling / and "Converter" (See FpDebug: SysVarToLstr)
  • Improved Assembler window
    • Added history navigation (forward/backward)
    • For FpDebug: added annotations to jump/call targets, and allow to ctrl-click to disassemble target address

FpDebug / LazDebuggerFp

  • Improved "function calling" in watch eval. See FpDebug-Watches-FunctionEval
  • %RAX Accessing cpu registers in watch expression (only full registers, not yet AH or AL or EAX on 64bit)
  • Intrinsic functions: FpDebug-Watches-Intrinsic-Functions
  • Intrinsic/extended operators: MyArray[1..3] array slice with operator mapping. FpDebug-Watches-Intrinsic-Functions#Intrinsic_Operators
  • Option to detect "variant" and call "SysVarToLStr" in the target app.
  • Suspend/Resume individual threads (must be done while app is paused, and will be applied for subsequent step/run)
  • Partial improvements to debug in DLL: https://wiki.freepascal.org/Debugger_Status#Other
  • Disassembler now annotates lines for call/jmp/jne/... with info on the target address (function name, file, line)
  • F7/F8 Step-Into/Over can now be used to start the debugger and run to the first line of the main program begin/end.

LazDebuggerFpLldb (default on MacOS)

  • Added Mem-Limits (and String,Pchar,Array) to the debugger config
See https://wiki.freepascal.org/LazDebuggerFp (MaxMemReadSize, MaxStringLen, MaxArrayLen, MaxNullStringSearchLen)
Limiting the default results for watches/locals/stack-params,... can prevent slow evaluation.
Arrays can then be browsed in the watches window, using the new "paged browser for arrays" (expand via [+])

Floating point properties in the Object Inspector

  • The Object Inspector now explicitely disallows to set a floating point property's value to +/-Inf or NaN.
  • Reason: whilst +/-Inf and NaN are valid values for a floating point property, they cannot be streamed (so, the form could not be loaded) and setting it to NaN caused havoc in the IDE.
  • Remedy: set the value at runtime (in code)

Reading unit names in lfm

FPC 3.3.1 component writer supports optionally writing types with their unit names as unitname/type. Lazarus can now read this.

Ambiguous Classtypes

You can now register two component classes with the same name, e.g. fresnel.TButton and StdCtrls.TButton. You can even put both on the same form.

Editor

- Highlight for PasDoc

IDE Options

In Tools -> Options -> Environment -> Window page these three settings are now ON by default :

  • IDE title starts with project name
  • IDE title shows project directory
  • IDE title shows selected build mode

It has been requested by many users. If the IDE's title bar has no info about the active project, a user must open Project Inspector or Project Options to see it, which is inconvenient.

IDE Interface Changes

Components

TAChart

  • The TLegendClickTools now is able to detect clicks on series legend items and reports the clicked series in the new OnSeriesClick event.
  • New TDatapointMarksClickTool which becomes active when the user clicked on the marks of a series.
  • New property TickWidth for the chart axes.
  • New property FullWidth for the chart title and footer to run their background across the entire chart width.
  • New property RandomColors for TRandomChartSource.
  • New properties YIndexWhiskerMin, YIndexBarMin, YIndexCenter, YIndexBarMax, YIndexWhiskerMax, and YDataLayout in TBoxAndWhiskerSeries for more flexible assignment of y values to the parts of the box/whisher shape.
  • New option aipInteger in the set TAxisIntervalParamOptions which sets axis labels only at integer values and thus supresses the unwanted intermediate labels in bar charts and helps to enforce labels in logarithmic plots at the powers of the logarithmic base (usually 10).
  • New event OnAddStyleToLegend for TChartStyles. It has a boolean parameter AddToLegend with which you can determine whether the series level using this style is displayed in the legend.

TDateTimePicker

  • New properties MonthDisplay and CustomMonthNames. They are meant to replace the MonthNames property, which has been deprecated.
  • New property DecimalSeparator. Allows a user-specified value to be used instead of a hard-coded Colon character.

TDBDateTimePicker

  • Adds Options as a published property.
  • Publishes the DecimalSeparator property.
  • Publishes the missing Alignment property. Consistent with TDateTimePicker,

T(Float)SpinEditEx

  • New property Orientation which allows to arrange the spin buttons horizontally.

TCheckListBox

  • Adds HeaderColor and HeaderBackgroundColor properties. Used on list items where the Header property is enabled. Implemented for the Win32 widget set.

Pas2js

  • lazbuild now can compile pas2js projects by passing the environment variable PAS2JS with the path of the pas2js executable.
  • Project groups with pas2js projects now can compile without being opened.
  • New project type Progressive Web Application
  • New project type Electron Web Application
  • pas2jsdsgn now uses the SimpleWebServerGUI package, replacing its own http server controller.
  • F9, Run now builds, starts a HTTP server and a browser

Lazarus Icon Collection

  • Not a component, but the Lazarus installation now contains a folder with general-purpose icons for usage in toolbars, menus, buttons etc. of any GUI applications (folder images/general_purpose).
  • The images come in various sizes and thus are compatible with the scaled image list of Lazarus v2.0+.
  • Author: Roland Hahn (https://www.rhsoft.de/).
  • License: Creative Commons CC0 (no restrictions in usage).

gir2pascal

lazdelphi

An IDE addon adding a parser for the Delphi compiler errors and hints. You can run dcc32.exe as external tool or execute before command in the compiler options and use the Delphi Compiler parser for the output, so that the errors/hints in the Messages window can open the source. See Lazarus Delphi Compiler Tool

Jedi Code Format

  • Some improvements in code formatting.
  • The jcf command line tool is now a text-mode application and no longer requires XWindow on linux to run.

DockedFormEditor

In case you are still using the sparta docked form editor, use the dockedformeditor package instead.

Changes affecting compatibility

IDE Settings

Run > Run Parameters

The Working-Dir and the Launch-/Host-App can now be specified relative to the Project-Dir. As a result of this, and due to inconsistencies between "Run in debugger" and "Run without debug" some details of how those fields are resolved changed.

In some cases you may therefore have to adjust your settings.

The Working-dir is now determined as follows
  1. BuildMode.RunParams "working directory" set by user (New, this can now be relative to project dir)
  2. Project Dir, if not virtual
  3. Directory from Host-App (RunParams), or if (and only if) Host-App is empty from Project.exe (If host app is in %PATH, then there is no "working directory")

The first 2 steps are the same as before the change. The 3rd step was previously only used for "debugging", but "run without debug" did use: "Launch-App", "Host-App", Project.exe

Change
The path of the "Launch App" is no longer considered
The Launch-/Host-App location are now determined as follows
  1. An app with absolute path is used as given
  2. A relative path (including no path at all) is resolved as relative to the Project-dir.
  3. An app without any path at all (if not found in step 2) is searched in the %PATH environment.
Change
Search in %PATH was only done by "run without debug", but not by debug. It is now done by both.
Change
Checking for an exe relative to the project-dir was added.


LCL incompatibility

TLabel: autosized and right-aligned

  • Old behaviour: Autosized label with Alignment=taRightJustify but Anchors=[akLeft,...] grew to left.
  • New behaviour: The label grows to right now.
  • Reason: It wasn't possible to implement the behavior also for hidden labels without significant extensions in the LCL. The LCL has a different and more generic feature of control-based anchoring that delivers the same effect (see Remedy down), so it is not needed and wanted to double this feature and make the LCL code more complex and prone to bugs.
  • Remedy: Use the LCL anchoring to a secondary control. Anchor the right side of the label to another control. Then the autosized label will grow to the left but won't move to the right when the parent is resized like it is done with a simple akRight anchor without a reference control.

TDateEdit/TTimeEdit

The value of NullDate has changed.
Reason:

  • It was impossible to actually select the date corresponding to NullDate (30 dec 1899 by default) in the control.
  • Remedy (1): if your code depended on NullDate actually being 0.0, you have to adjust your code.
  • Remedy (2): if your code used NullDate for a TTimeEdit, change that to the new constant NullTime instead.
  • Note: NullDate is actually a writeable constant. This was kept for compatibility reasons. It is however a bad idea to change it's value to anything that is an actual date that is within the range of the control.

GTK3

GTK3 is no longer supported on earlier Linuxes, such as Ubuntu 20.04. It requires GTK >= 3.24.24 and Glib2.0 >= 2.66

LazUtils

Masks unit

The masks unit has been completely rewritten.
Reasons:

  • speed: the old Matches() method had O(n^2) or even O(n^3) characteristics.
  • improved control over how the mask is interpreted.

New types (for parameters) and a dedicated TMaskWindows class have been added.
TMask.MatchesWindowsMask and the old TMaskOptions type have been deprecated and will be removed in the next release.

Ranges and Sets
  • The old masks implementation supported sets, but not ranges. The new implementation supports both sets ([abc]) and ranges ([a-c]). As a consequence a '-' inside such a construct is now interpreted as part of the range definition, not as a literal '-'.
  • Reason: ranges are a good thing to have by default (the old implementation simply lacked this). We decided it's a small price to pay.
  • Remedy: either escape the '-' with EscapeChar (which defaults to '\') or exclude mocRange from the TMaskOpcodes parameter.
Constructors do not fail anymore on an invalid mask
  • When providing an invalid mask to the old T(Windows)Mask(List) constructors an exception was raised.
  • The new constructors do not raise an exception in this case. Instead an exception is raised in when Matches() is called.
  • Reason: it's not very nice to have a constructor fail.

Translations unit

Added GetLanguageID function. It returns a record with language code (in ISO 639-1 or ISO 639-2) and country code (in ISO 3166) for current system locale.
Added GetLanguageIDFromLocaleName function. It parses Unix locale name and returns a record with language code and country code. It is useful to parse language identifiers passed e. g. via command-line parameters.

Implementation is based on GetLanguageIDs procedure from GetText unit, but is rewritten to have the following properties:

  • Language and country codes are always returned in ISO formats on Windows.
  • Unix locale identifier is properly parsed and language/country codes are properly extracted.
  • Don't assume that language code is always two-letter (ISO 639-1), it can have bigger length (e. g. three letters, like in ISO 639-2).
  • Locale ID is returned in a record type. This will allow to return additional fields in backwards-compatible manner in future. Currently it contains language code, country code and language ID (combination of language code and country code).

These functions are used now throughout the Lazarus codebase. This greatly improves automatic language detection and loading of correct translations by Lazarus:

  • Three-letter (ISO 639-2) language identifiers are no more truncated to two letters. Thus, translations for such languages will be correctly loaded when available.
  • Previously on Windows some language and country codes were obtained in non-ISO format, which prevented correct loading of some translations, e. g. Chinese (zh_CN).
  • On Unix translations with country codes, like Brazilian Portuguese (pt_BR) or Chinese (zh_CN) are correctly loaded now.
  • macOS is now handled as any other Unix. This removes dependency on language list in Lazarus bundle (which had to be maintained manually) and thus fixes loading of Czech, Hungarian, Brazilian Portuguese, Ukrainian translations.

LazUTF8 unit

  • Deprecated LazGetLanguageIDs (returns combination of language and country codes) and LazGetShortLanguageID (returns only language code) procedures.
  • Reason: this functionality belongs to Translations unit (calls of these procedures are almost always followed by calls to procedures from Translations unit), and these procedures are now thin wrappers of GetLanguageID function from Translations unit.
  • Remedy: use GetLanguageID function from Translations unit.

LazUTF8Classes and LazUTF8SysUtils units

Everything in these units was deprecated for a long time and now they were removed. LazUTF8SysUtils was earlier renamed to LazSysUtils and this deprecated version was left for a transit period.

  • Class TStringListUTF8 can be replaced with TStringList.
  • Class TMemoryStreamUTF8 can be replaced with TMemoryStream.
  • Global procedure LoadStringsFromFileUTF8 can be replaced with TStrings.LoadFromFile.
  • Global procedure SaveStringsToFileUTF8 can be replaced with TStrings.SaveToFile.
  • Functions NowUTC and GetTickCount64 can be found in LazSysUtils.

Components incompatibility

LazControls

TSpinEditExBase derived classes
  • All derived classes form TSpinEditExBase must implement a SameValue method. This method is defined as an abstract method in TSpinEditExBase.
  • Reason: All derived classes used Math.SameValue. This is wrong for comparing integer types (even if is is safe when comparing relative small values).
  • Remedy: unfortunately you'll have to adjust your code.
TFloatSpinEditEx
  • The property NumbersOnly is no longer published.
  • Reason: the property makes no sense for this control and only confuses users.
  • Remedy: if you really need NumbersOnly to be True, you must set it in code.

FpVectorial

  • The Size element in the FPVectorial TvFont record is a floating point value now (type double).
  • Reason: Avoid rounding errors because the drawing coordinates are double already.
  • Remedy: There is rarely a chance that this change will have an effect on user code. Only when the font size is stored in a variable it must be declared as double rather than as integer.

TurboPower_ipro

  • Type declarations and the html nodes were moved from unit IpHtml to separate units, IpHtmlTypes, IpHtmlClasses and IpHtmlNodes. This may break compilation of existing projects.
  • Reason: Improve maintainability of the extremely long unit IpHtml
  • Remedy: Add IpHtmlTypes, IpHtmlClasses and/or IpHtmlNodes to the uses clause of the project unit(s) when an "identifier not found" error referring to this package is reported by the compiler.

Other release notes