2017-11-01 21:27:13 +08:00
|
|
|
menus_dir = prefix / gimpdatadir / 'menus'
|
|
|
|
|
2023-02-24 04:15:40 +08:00
|
|
|
ui_menus_files = files(
|
2023-04-05 06:46:35 +08:00
|
|
|
'app-menu.ui',
|
2023-03-02 21:32:18 +08:00
|
|
|
'brush-editor-menu.ui',
|
2023-02-24 04:15:40 +08:00
|
|
|
'brushes-menu.ui',
|
|
|
|
'buffers-menu.ui',
|
|
|
|
'channels-menu.ui',
|
|
|
|
'colormap-menu.ui',
|
2023-03-02 21:32:18 +08:00
|
|
|
'cursor-info-menu.ui',
|
2023-03-01 23:09:10 +08:00
|
|
|
'dashboard-menu.ui',
|
2023-02-24 04:15:40 +08:00
|
|
|
'documents-menu.ui',
|
2023-03-02 21:32:18 +08:00
|
|
|
'dynamics-editor-menu.ui',
|
2023-02-24 04:15:40 +08:00
|
|
|
'dynamics-menu.ui',
|
|
|
|
'error-console-menu.ui',
|
|
|
|
'fonts-menu.ui',
|
2023-02-28 20:51:09 +08:00
|
|
|
'gradient-editor-menu.ui',
|
2023-02-24 04:15:40 +08:00
|
|
|
'gradients-menu.ui',
|
|
|
|
'images-menu.ui',
|
|
|
|
'layers-menu.ui',
|
|
|
|
'mypaint-brushes-menu.ui',
|
2023-03-02 21:32:18 +08:00
|
|
|
'palette-editor-menu.ui',
|
2023-02-24 04:15:40 +08:00
|
|
|
'palettes-menu.ui',
|
|
|
|
'patterns-menu.ui',
|
|
|
|
'quick-mask-menu.ui',
|
2023-03-02 21:32:18 +08:00
|
|
|
'sample-points-menu.ui',
|
|
|
|
'selection-menu.ui',
|
2023-02-24 04:15:40 +08:00
|
|
|
'templates-menu.ui',
|
2023-03-02 21:27:23 +08:00
|
|
|
'text-editor-toolbar.ui',
|
2023-03-02 21:32:18 +08:00
|
|
|
'text-tool-menu.ui',
|
|
|
|
'tool-options-menu.ui',
|
|
|
|
'tool-preset-editor-menu.ui',
|
|
|
|
'tool-presets-menu.ui',
|
2023-02-28 01:49:45 +08:00
|
|
|
'undo-menu.ui',
|
2023-03-02 21:32:18 +08:00
|
|
|
'vector-toolpath-menu.ui',
|
2023-02-24 04:15:40 +08:00
|
|
|
'vectors-menu.ui',
|
|
|
|
)
|
|
|
|
|
|
|
|
install_data(ui_menus_files,
|
|
|
|
install_dir: menus_dir,
|
|
|
|
)
|
|
|
|
|
2017-11-01 21:27:13 +08:00
|
|
|
unstable_menus_args = stable ? [] : [ '--stringparam', 'unstable-menus', 'yes' ]
|
|
|
|
|
2023-02-23 04:29:08 +08:00
|
|
|
menus_ui_built_files = []
|
|
|
|
foreach menu_filegen : [ 'dockable-menu.ui', 'image-menu.ui', ]
|
2023-04-04 23:28:49 +08:00
|
|
|
# This does look a bit overly complicated, but I encountered 2 issues:
|
|
|
|
# 1. The simpler solution was to do first the custom_target() then a single
|
|
|
|
# configure_file() per file. It didn't work out because of meson complex
|
|
|
|
# dependency logic (see https://github.com/mesonbuild/meson/issues/8123).
|
|
|
|
# 2. So I inverted, but now xsltproc was the one acting up by adding the
|
|
|
|
# 'xml:base' attribute when the included and including XML files are in
|
|
|
|
# different folders. This is why I added a second configure_file() to have
|
|
|
|
# both XML files in the same folder.
|
|
|
|
conf = configuration_data()
|
|
|
|
if menu_filegen == 'dockable-menu.ui'
|
|
|
|
group = 'dockable'
|
|
|
|
else
|
|
|
|
group = 'dialogs'
|
|
|
|
endif
|
|
|
|
conf.set('GROUP', group)
|
|
|
|
included_file = configure_file(
|
|
|
|
input: 'dialogs-menuitems.ui.in',
|
|
|
|
output: group + '-dialogs-menuitems.ui',
|
|
|
|
configuration: conf,
|
|
|
|
)
|
|
|
|
|
|
|
|
pre_built_file = configure_file(
|
|
|
|
input: menu_filegen + '.in.in',
|
|
|
|
output: menu_filegen + '.in',
|
|
|
|
configuration: conf,
|
|
|
|
)
|
|
|
|
|
2023-02-23 04:29:08 +08:00
|
|
|
menus_ui_built_files += custom_target(menu_filegen,
|
2023-04-04 23:28:49 +08:00
|
|
|
input : [ pre_built_file, 'menus.xsl', included_file],
|
2023-02-23 04:29:08 +08:00
|
|
|
output: [ menu_filegen ],
|
|
|
|
command: [
|
|
|
|
xsltproc,
|
|
|
|
'--xinclude',
|
|
|
|
unstable_menus_args,
|
2023-04-04 23:28:49 +08:00
|
|
|
'--path',
|
|
|
|
meson.current_build_dir(),
|
2023-02-23 04:29:08 +08:00
|
|
|
'--output', '@OUTPUT@',
|
|
|
|
'@INPUT1@',
|
|
|
|
'@INPUT0@',
|
|
|
|
],
|
|
|
|
install: true,
|
|
|
|
install_dir: menus_dir,
|
|
|
|
)
|
|
|
|
endforeach
|
|
|
|
|
2017-11-01 21:27:13 +08:00
|
|
|
if xmllint.found()
|
app, menus: very early prototype for a GimpMenu.
This demonstrates a first version of our replacing menu, using GAction and
GMenuModel. I had to make our own subclass of GtkMenu to process the model (from
a .ui XML file) for the following reasons:
* gtk_menu_new_from_model() doesn't support tooltips, which is a feature we use
quite extensively in GIMP: with all our filters, being able to give a longer
description is often useful; moreover we use tooltips to give hints about why
a menu item is deactivated as well.
Unfortunately it looks like GTK doesn't consider this lack as a problem and
don't plan on adding tooltip support.
See: https://gitlab.gnome.org/GNOME/gtk/-/issues/785
* I won't to avoid copying action's label and icons in the .ui file. This only
duplicates strings and would be a source of issues each time we change
action's strings (we'd have to do it in 2 places, which someone will
inevitably forget).
Now it still has various issues:
* The syncing between actions and menu items need to be cleaned up. It's still
in early demo code.
* It uses directly some Gtk*Action code because GimpRadioAction and
GimpToggleAction are not directly related right now (only through their
parents).
* gtk_application_set_menubar() might still be necessary on macOS as I think
it's what enables the native menu system on this OS. It means that we'll have
to edit the menu model to add back the labels (as this function does not
extract these from the linked action since GAction has no label or icon
concept).
* Icons are not taken into account right now.
* I'll have to verify if GimpAction with proxy work (but my guess is that right
now, it won't).
* Action's active state is not synced with menu item active state right now.
* Various actions are inserted live, such as opened images, opened views,
recently opened images, and so on. This needs to be implemented back.
* Plug-ins need to be able to create their own menu item into this new menu.
* For all these various reasons, I'm keeping the old menu around, for the sake
of comparison, until the time the new one becomes feature-full.
Part of this commit is inspired by !558 and obsoletes this MR.
2023-02-07 20:59:20 +08:00
|
|
|
# XXX: no DTD validation as GtkBuilder UI format does not have a DTD (as far as
|
|
|
|
# we could find).
|
|
|
|
custom_target('validate_ui_menus',
|
|
|
|
command: [
|
|
|
|
xmllint,
|
|
|
|
'--output', '@OUTPUT@',
|
|
|
|
'--path', meson.current_source_dir(),
|
2023-02-24 04:15:40 +08:00
|
|
|
ui_menus_files, menus_ui_built_files
|
app, menus: very early prototype for a GimpMenu.
This demonstrates a first version of our replacing menu, using GAction and
GMenuModel. I had to make our own subclass of GtkMenu to process the model (from
a .ui XML file) for the following reasons:
* gtk_menu_new_from_model() doesn't support tooltips, which is a feature we use
quite extensively in GIMP: with all our filters, being able to give a longer
description is often useful; moreover we use tooltips to give hints about why
a menu item is deactivated as well.
Unfortunately it looks like GTK doesn't consider this lack as a problem and
don't plan on adding tooltip support.
See: https://gitlab.gnome.org/GNOME/gtk/-/issues/785
* I won't to avoid copying action's label and icons in the .ui file. This only
duplicates strings and would be a source of issues each time we change
action's strings (we'd have to do it in 2 places, which someone will
inevitably forget).
Now it still has various issues:
* The syncing between actions and menu items need to be cleaned up. It's still
in early demo code.
* It uses directly some Gtk*Action code because GimpRadioAction and
GimpToggleAction are not directly related right now (only through their
parents).
* gtk_application_set_menubar() might still be necessary on macOS as I think
it's what enables the native menu system on this OS. It means that we'll have
to edit the menu model to add back the labels (as this function does not
extract these from the linked action since GAction has no label or icon
concept).
* Icons are not taken into account right now.
* I'll have to verify if GimpAction with proxy work (but my guess is that right
now, it won't).
* Action's active state is not synced with menu item active state right now.
* Various actions are inserted live, such as opened images, opened views,
recently opened images, and so on. This needs to be implemented back.
* Plug-ins need to be able to create their own menu item into this new menu.
* For all these various reasons, I'm keeping the old menu around, for the sake
of comparison, until the time the new one becomes feature-full.
Part of this commit is inspired by !558 and obsoletes this MR.
2023-02-07 20:59:20 +08:00
|
|
|
],
|
|
|
|
# The output file is only useful as a flag file, so that the command
|
|
|
|
# knows if it has been run already.
|
|
|
|
output: [ 'validate_ui_menus-output.xml' ],
|
|
|
|
build_by_default: true,
|
|
|
|
install: false
|
|
|
|
)
|
2017-11-01 21:27:13 +08:00
|
|
|
endif
|