Thursday, 31 October 2019

Native GTK Dialogs in LibreOffice

LibreOffice Native GTK Dialog Status

The LibreOffice UI was traditionally implemented with its own VCL toolkit which via theming emulated the host desktop toolkit.

Then we migrated the file format the dialogs were described in to the GtkBuilder file format. But still implemented with VCL widgetry, though with additional GTK-alike layout widgets.

Then migrated the translation format to gettext .mo files, which added plural form translation support we had lacked.

Then incrementally migrated the code driving the dialogs to a new API with two implementations, one for VCL widgetry and one for GTK.

Over the last few major releases the GTK version of LibreOffice has increasingly had true GTK dialogs and less VCL dialogs and in master, as of this week, there are now no direct uses of the VCL dialog APIs.

There are still some non-dialog utility windows and other elements to port over, but dialogs are complete.

LibreOffice has a lot of UI. There are 1029 XML UI definition files in master. 480 definitions of a GtkDialog and 75 additional GtkMessageDialog definitions. The remainder of the files typically describe a single page of a Notebook, Assistant or Sidebar, often appearing in multiple dialogs.

Here are some gifs of a small set of the dialogs from master under Fedora 31, taken under Wayland with peek, showing some of the stock animations of the default GTK 3.24 Adwaita theme

The Writer Character dialog

Notebook, Color Selector MenuButton, and ToggleButton animations

The Calc Page dialog

SpinButtons and legacy Preview widgets hosted in a native dialog

The Writer Paragraph dialog

"Double Decker" Notebook and Scale widgets

The Writer AutoCorrect dialog

Smooth scrolling of huge Emoji autocorrect list

Chart 3D View dialog

Amusingly Over-engineered custom lighting direction widget

The Options dialog

TreeView, Overlay ScrollBar, fade in animation of CheckButtons