[gimp] app: show the region combo only if the op has the "position-dependent" key
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: show the region combo only if the op has the "position-dependent" key
- Date: Sat, 24 May 2014 01:08:33 +0000 (UTC)
commit 62cbd3eac3c0bf179f13993d4804cf99771c164b
Author: Michael Natterer <mitch gimp org>
Date: Sat May 24 03:05:27 2014 +0200
app: show the region combo only if the op has the "position-dependent" key
otherwise, hide it and default to SELECTION.
app/tools/gimpimagemaptool.c | 49 ++++++++++++++++++++++++++++++++++++-----
app/tools/gimpimagemaptool.h | 1 +
2 files changed, 44 insertions(+), 6 deletions(-)
---
diff --git a/app/tools/gimpimagemaptool.c b/app/tools/gimpimagemaptool.c
index 8af496a..825366c 100644
--- a/app/tools/gimpimagemaptool.c
+++ b/app/tools/gimpimagemaptool.c
@@ -27,6 +27,7 @@
#include <string.h>
#include <gegl.h>
+#include <gegl-plugin.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
@@ -341,8 +342,8 @@ gimp_image_map_tool_initialize (GimpTool *tool,
{
GimpImageMapToolClass *klass;
GtkWidget *vbox;
- GtkWidget *combo;
GtkWidget *toggle;
+ gchar *operation_name;
klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (image_map_tool);
@@ -421,11 +422,24 @@ gimp_image_map_tool_initialize (GimpTool *tool,
gtk_widget_show (toggle);
/* The area combo */
- combo = gimp_prop_enum_combo_box_new (G_OBJECT (tool_info->tool_options),
- "region",
- 0, 0);
- gtk_box_pack_end (GTK_BOX (vbox), combo, FALSE, FALSE, 0);
- gtk_widget_show (combo);
+ gegl_node_get (image_map_tool->operation,
+ "operation", &operation_name,
+ NULL);
+
+ image_map_tool->region_combo =
+ gimp_prop_enum_combo_box_new (G_OBJECT (tool_info->tool_options),
+ "region",
+ 0, 0);
+ gtk_box_pack_end (GTK_BOX (vbox), image_map_tool->region_combo,
+ FALSE, FALSE, 0);
+
+ if (operation_name &&
+ gegl_operation_get_key (operation_name, "position-dependent"))
+ {
+ gtk_widget_show (image_map_tool->region_combo);
+ }
+
+ g_free (operation_name);
/* Fill in subclass widgets */
gimp_image_map_tool_dialog (image_map_tool);
@@ -784,6 +798,7 @@ void
gimp_image_map_tool_get_operation (GimpImageMapTool *image_map_tool)
{
GimpImageMapToolClass *klass;
+ gchar *operation_name;
g_return_if_fail (GIMP_IS_IMAGE_MAP_TOOL (image_map_tool));
@@ -826,6 +841,28 @@ gimp_image_map_tool_get_operation (GimpImageMapTool *image_map_tool)
image_map_tool->undo_desc =
g_strdup (GIMP_TOOL (image_map_tool)->tool_info->blurb);
+ gegl_node_get (image_map_tool->operation,
+ "operation", &operation_name,
+ NULL);
+
+ if (operation_name &&
+ gegl_operation_get_key (operation_name, "position-dependent"))
+ {
+ if (image_map_tool->region_combo)
+ gtk_widget_show (image_map_tool->region_combo);
+ }
+ else
+ {
+ if (image_map_tool->region_combo)
+ gtk_widget_show (image_map_tool->region_combo);
+
+ g_object_set (GIMP_IMAGE_MAP_TOOL_GET_OPTIONS (image_map_tool),
+ "region", GIMP_IMAGE_MAP_REGION_SELECTION,
+ NULL);
+ }
+
+ g_free (operation_name);
+
if (image_map_tool->config)
g_signal_connect_object (image_map_tool->config, "notify",
G_CALLBACK (gimp_image_map_tool_config_notify),
diff --git a/app/tools/gimpimagemaptool.h b/app/tools/gimpimagemaptool.h
index 53c37b7..300860e 100644
--- a/app/tools/gimpimagemaptool.h
+++ b/app/tools/gimpimagemaptool.h
@@ -51,6 +51,7 @@ struct _GimpImageMapTool
gboolean overlay;
GimpToolGui *gui;
GtkWidget *settings_box;
+ GtkWidget *region_combo;
GtkSizeGroup *label_group;
GtkWidget *active_picker;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]