From f9df98058549b938e2b93d8a60e66e9701a1ad35 Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Fri, 2 Aug 2024 00:01:55 +0000 Subject: [PATCH] plug-ins: Convert custom ImageMap icons to vectors Adds SVG versions of ImageMap custom icons and conditionally uses them if have_vector_icons is enabled. If not, we fall back to the original PNG icons. Since ImageMap mixes custom and stock icons, this keeps the icon size consistent across the UI. Per Denis Rangelov, tooltips for the coordinates and area displays as well as the shortcut menu were added. Also, removes a reference to IMAP_ARROW which no longer applies since that icon was removed in favor of using the stock cursor icon. --- plug-ins/imagemap/images/imagemap-circle.svg | 69 +++++++++ plug-ins/imagemap/images/imagemap-coord.svg | 56 ++++++++ .../imagemap/images/imagemap-dimension.svg | 131 ++++++++++++++++++ ...imagemap-icon-legacy-images.gresource.xml} | 0 ...magemap-icon-scalable-images.gresource.xml | 13 ++ plug-ins/imagemap/images/imagemap-java.svg | 93 +++++++++++++ plug-ins/imagemap/images/imagemap-polygon.svg | 42 ++++++ .../imagemap/images/imagemap-rectangle.svg | 48 +++++++ plug-ins/imagemap/images/imagemap-to-back.svg | 36 +++++ .../imagemap/images/imagemap-to-front.svg | 60 ++++++++ plug-ins/imagemap/images/meson.build | 26 ++-- plug-ins/imagemap/imap_icons.h | 1 - plug-ins/imagemap/imap_preview.c | 3 + plug-ins/imagemap/imap_statusbar.c | 8 +- 14 files changed, 574 insertions(+), 12 deletions(-) create mode 100644 plug-ins/imagemap/images/imagemap-circle.svg create mode 100644 plug-ins/imagemap/images/imagemap-coord.svg create mode 100644 plug-ins/imagemap/images/imagemap-dimension.svg rename plug-ins/imagemap/images/{imagemap-icon-images.gresource.xml => imagemap-icon-legacy-images.gresource.xml} (100%) create mode 100644 plug-ins/imagemap/images/imagemap-icon-scalable-images.gresource.xml create mode 100644 plug-ins/imagemap/images/imagemap-java.svg create mode 100644 plug-ins/imagemap/images/imagemap-polygon.svg create mode 100644 plug-ins/imagemap/images/imagemap-rectangle.svg create mode 100644 plug-ins/imagemap/images/imagemap-to-back.svg create mode 100644 plug-ins/imagemap/images/imagemap-to-front.svg diff --git a/plug-ins/imagemap/images/imagemap-circle.svg b/plug-ins/imagemap/images/imagemap-circle.svg new file mode 100644 index 0000000000..64a9008aaf --- /dev/null +++ b/plug-ins/imagemap/images/imagemap-circle.svg @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + diff --git a/plug-ins/imagemap/images/imagemap-coord.svg b/plug-ins/imagemap/images/imagemap-coord.svg new file mode 100644 index 0000000000..63baef103d --- /dev/null +++ b/plug-ins/imagemap/images/imagemap-coord.svg @@ -0,0 +1,56 @@ + + + + + + + + + + diff --git a/plug-ins/imagemap/images/imagemap-dimension.svg b/plug-ins/imagemap/images/imagemap-dimension.svg new file mode 100644 index 0000000000..8ad0a29989 --- /dev/null +++ b/plug-ins/imagemap/images/imagemap-dimension.svg @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/plug-ins/imagemap/images/imagemap-icon-images.gresource.xml b/plug-ins/imagemap/images/imagemap-icon-legacy-images.gresource.xml similarity index 100% rename from plug-ins/imagemap/images/imagemap-icon-images.gresource.xml rename to plug-ins/imagemap/images/imagemap-icon-legacy-images.gresource.xml diff --git a/plug-ins/imagemap/images/imagemap-icon-scalable-images.gresource.xml b/plug-ins/imagemap/images/imagemap-icon-scalable-images.gresource.xml new file mode 100644 index 0000000000..bddfaef782 --- /dev/null +++ b/plug-ins/imagemap/images/imagemap-icon-scalable-images.gresource.xml @@ -0,0 +1,13 @@ + + + + imagemap-circle.svg + imagemap-coord.svg + imagemap-dimension.svg + imagemap-java.svg + imagemap-polygon.svg + imagemap-rectangle.svg + imagemap-to-back.svg + imagemap-to-front.svg + + diff --git a/plug-ins/imagemap/images/imagemap-java.svg b/plug-ins/imagemap/images/imagemap-java.svg new file mode 100644 index 0000000000..4a88bd3ddb --- /dev/null +++ b/plug-ins/imagemap/images/imagemap-java.svg @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + diff --git a/plug-ins/imagemap/images/imagemap-polygon.svg b/plug-ins/imagemap/images/imagemap-polygon.svg new file mode 100644 index 0000000000..42c5e3ad99 --- /dev/null +++ b/plug-ins/imagemap/images/imagemap-polygon.svg @@ -0,0 +1,42 @@ + + + + + + + + + + + + + diff --git a/plug-ins/imagemap/images/imagemap-rectangle.svg b/plug-ins/imagemap/images/imagemap-rectangle.svg new file mode 100644 index 0000000000..73e43932ce --- /dev/null +++ b/plug-ins/imagemap/images/imagemap-rectangle.svg @@ -0,0 +1,48 @@ + + + + + + + + + + + + + diff --git a/plug-ins/imagemap/images/imagemap-to-back.svg b/plug-ins/imagemap/images/imagemap-to-back.svg new file mode 100644 index 0000000000..31089ab610 --- /dev/null +++ b/plug-ins/imagemap/images/imagemap-to-back.svg @@ -0,0 +1,36 @@ + + + + + + + + + diff --git a/plug-ins/imagemap/images/imagemap-to-front.svg b/plug-ins/imagemap/images/imagemap-to-front.svg new file mode 100644 index 0000000000..608d67915b --- /dev/null +++ b/plug-ins/imagemap/images/imagemap-to-front.svg @@ -0,0 +1,60 @@ + + + + + + + + + + diff --git a/plug-ins/imagemap/images/meson.build b/plug-ins/imagemap/images/meson.build index fb093a7130..b70be2d69e 100644 --- a/plug-ins/imagemap/images/meson.build +++ b/plug-ins/imagemap/images/meson.build @@ -1,16 +1,24 @@ +icon_type = 'scalable' +icon_format = 'svg' + +if not have_vector_icons + icon_type = 'legacy' + icon_format = 'png' +endif + stock_images = [ - 'imagemap-circle.png', - 'imagemap-coord.png', - 'imagemap-dimension.png', - 'imagemap-java.png', - 'imagemap-polygon.png', - 'imagemap-rectangle.png', - 'imagemap-to-back.png', - 'imagemap-to-front.png', + 'imagemap-circle' + icon_format, + 'imagemap-coord' + icon_format, + 'imagemap-dimension' + icon_format, + 'imagemap-java' + icon_format, + 'imagemap-polygon' + icon_format, + 'imagemap-rectangle' + icon_format, + 'imagemap-to-back' + icon_format, + 'imagemap-to-front' + icon_format, ] imagemap_icon_sources = gnome.compile_resources( 'imagemap-icon-images', - 'imagemap-icon-images.gresource.xml', + 'imagemap-icon-' + icon_type + '-images.gresource.xml', # source_dir: meson.current_source_directory(), ) diff --git a/plug-ins/imagemap/imap_icons.h b/plug-ins/imagemap/imap_icons.h index 195d2b568d..330cf3f9a8 100644 --- a/plug-ins/imagemap/imap_icons.h +++ b/plug-ins/imagemap/imap_icons.h @@ -23,7 +23,6 @@ #ifndef _IMAP_ICONS_H #define _IMAP_ICONS_H -#define IMAP_ARROW "imagemap-arrow" #define IMAP_CIRCLE "imagemap-circle" #define IMAP_COORD "imagemap-coord" #define IMAP_DIMENSION "imagemap-dimension" diff --git a/plug-ins/imagemap/imap_preview.c b/plug-ins/imagemap/imap_preview.c index 7d45ecfb45..65abbbcaba 100644 --- a/plug-ins/imagemap/imap_preview.c +++ b/plug-ins/imagemap/imap_preview.c @@ -31,6 +31,8 @@ #include "imap_menu.h" #include "imap_preview.h" +#include "libgimp/stdplugins-intl.h" + #define PREVIEW_MASK (GDK_EXPOSURE_MASK | \ GDK_POINTER_MOTION_MASK | \ GDK_BUTTON_PRESS_MASK | \ @@ -308,6 +310,7 @@ make_preview (GimpDrawable *drawable, /* Create button with arrow */ button = gtk_button_new (); gtk_widget_set_can_focus (button, FALSE); + gtk_widget_set_tooltip_text (button, _("Shortcut Menu")); gtk_grid_attach (GTK_GRID (grid), button, 0, 0, 1, 1); // GTK_FILL, GTK_FILL, 0, 0); gtk_widget_set_events (button, diff --git a/plug-ins/imagemap/imap_statusbar.c b/plug-ins/imagemap/imap_statusbar.c index d5c6987cd0..52e6296421 100644 --- a/plug-ins/imagemap/imap_statusbar.c +++ b/plug-ins/imagemap/imap_statusbar.c @@ -31,6 +31,8 @@ #include "imap_icons.h" #include "imap_statusbar.h" +#include "libgimp/stdplugins-intl.h" + StatusBar_t* make_statusbar(GtkWidget *main_vbox, GtkWidget *window) { @@ -50,6 +52,7 @@ make_statusbar(GtkWidget *main_vbox, GtkWidget *window) /* (x, y) coordinate */ iconw = gtk_image_new_from_icon_name (IMAP_COORD, GTK_ICON_SIZE_SMALL_TOOLBAR); + gtk_widget_set_tooltip_text (iconw, _("Coordinates:")); gtk_box_pack_start(GTK_BOX(hbox), iconw, FALSE, FALSE, 10); gtk_widget_show(iconw); @@ -64,8 +67,9 @@ make_statusbar(GtkWidget *main_vbox, GtkWidget *window) /* Dimension info */ iconw = gtk_image_new_from_icon_name (IMAP_DIMENSION, GTK_ICON_SIZE_SMALL_TOOLBAR); - gtk_box_pack_start(GTK_BOX(hbox), iconw, FALSE, FALSE, 10); - gtk_widget_show(iconw); + gtk_widget_set_tooltip_text (iconw, _("Active Area Size:")); + gtk_box_pack_start (GTK_BOX (hbox), iconw, FALSE, FALSE, 10); + gtk_widget_set_visible (iconw, TRUE); statusbar->dimension = gtk_entry_new(); gtk_widget_set_size_request(statusbar->dimension, 96, -1);