gimp/menus/meson.build

109 lines
3.0 KiB
Meson
Raw Normal View History

2017-11-01 21:27:13 +08:00
menus_dir = prefix / gimpdatadir / 'menus'
ui_menus_files = files(
'app-menu.ui',
'brush-editor-menu.ui',
'brushes-menu.ui',
'buffers-menu.ui',
'channels-menu.ui',
'colormap-menu.ui',
'cursor-info-menu.ui',
'dashboard-menu.ui',
'documents-menu.ui',
'dynamics-editor-menu.ui',
'dynamics-menu.ui',
'error-console-menu.ui',
'fonts-menu.ui',
'gradient-editor-menu.ui',
'gradients-menu.ui',
'images-menu.ui',
'layers-menu.ui',
'mypaint-brushes-menu.ui',
'palette-editor-menu.ui',
'palettes-menu.ui',
'patterns-menu.ui',
'quick-mask-menu.ui',
'sample-points-menu.ui',
'selection-menu.ui',
'templates-menu.ui',
'text-editor-toolbar.ui',
'text-tool-menu.ui',
'tool-options-menu.ui',
'tool-preset-editor-menu.ui',
'tool-presets-menu.ui',
'undo-menu.ui',
'vector-toolpath-menu.ui',
'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' ]
menus_ui_built_files = []
foreach menu_filegen : [ 'dockable-menu.ui', 'image-menu.ui', ]
# 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,
)
menus_ui_built_files += custom_target(menu_filegen,
input : [ pre_built_file, 'menus.xsl', included_file],
output: [ menu_filegen ],
command: [
xsltproc,
'--xinclude',
unstable_menus_args,
'--path',
meson.current_build_dir(),
'--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(),
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