[gimp/gimp-2-10] app: add gimp_gegl_node_is_point_operation()
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: add gimp_gegl_node_is_point_operation()
- Date: Fri, 15 Feb 2019 17:40:38 +0000 (UTC)
commit bd67478b49516519068d72c3321c22981ac047a4
Author: Ell <ell_se yahoo com>
Date: Fri Feb 15 12:27:55 2019 -0500
app: add gimp_gegl_node_is_point_operation()
... which takes a GeglNode, and determines if the associated
operation is a point operation.
Use in GimpFilterTool, instead of performing the same check
manually.
(cherry picked from commit 918f2e75bda4e8c93ceb76a78fdbd81a21181759)
app/gegl/gimp-gegl-utils.c | 18 ++++++++++++++++++
app/gegl/gimp-gegl-utils.h | 2 ++
app/tools/gimpfiltertool.c | 35 ++++++++++++++++-------------------
3 files changed, 36 insertions(+), 19 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-utils.c b/app/gegl/gimp-gegl-utils.c
index f9bc64a4b6..a6d96f653b 100644
--- a/app/gegl/gimp-gegl-utils.c
+++ b/app/gegl/gimp-gegl-utils.c
@@ -116,6 +116,24 @@ gimp_gegl_progress_connect (GeglNode *node,
(GDestroyNotify) g_free);
}
+gboolean
+gimp_gegl_node_is_point_operation (GeglNode *node)
+{
+ GeglOperation *operation;
+
+ g_return_val_if_fail (GEGL_IS_NODE (node), FALSE);
+
+ operation = gegl_node_get_gegl_operation (node);
+
+ if (! operation)
+ return FALSE;
+
+ return GEGL_IS_OPERATION_POINT_RENDER (operation) ||
+ GEGL_IS_OPERATION_POINT_FILTER (operation) ||
+ GEGL_IS_OPERATION_POINT_COMPOSER (operation) ||
+ GEGL_IS_OPERATION_POINT_COMPOSER3 (operation);
+}
+
const Babl *
gimp_gegl_node_get_format (GeglNode *node,
const gchar *pad_name)
diff --git a/app/gegl/gimp-gegl-utils.h b/app/gegl/gimp-gegl-utils.h
index cb76012b6e..1b95045102 100644
--- a/app/gegl/gimp-gegl-utils.h
+++ b/app/gegl/gimp-gegl-utils.h
@@ -31,6 +31,8 @@ void gimp_gegl_progress_connect (GeglNode *node,
GimpProgress *progress,
const gchar *text);
+gboolean gimp_gegl_node_is_point_operation (GeglNode *node);
+
const Babl * gimp_gegl_node_get_format (GeglNode *node,
const gchar *pad_name);
diff --git a/app/tools/gimpfiltertool.c b/app/tools/gimpfiltertool.c
index 9bb9ec452d..ccd2d6a8d3 100644
--- a/app/tools/gimpfiltertool.c
+++ b/app/tools/gimpfiltertool.c
@@ -303,15 +303,14 @@ gimp_filter_tool_initialize (GimpTool *tool,
if (! filter_tool->gui)
{
- GtkWidget *vbox;
- GtkWidget *hbox;
- GtkWidget *toggle;
- GtkWidget *expander;
- GtkWidget *frame;
- GtkWidget *vbox2;
- GtkWidget *combo;
- GeglOperation *operation;
- const gchar *operation_name = NULL;
+ GtkWidget *vbox;
+ GtkWidget *hbox;
+ GtkWidget *toggle;
+ GtkWidget *expander;
+ GtkWidget *frame;
+ GtkWidget *vbox2;
+ GtkWidget *combo;
+ gchar *operation_name;
/* disabled for at least GIMP 2.8 */
filter_tool->overlay = FALSE;
@@ -418,10 +417,9 @@ gimp_filter_tool_initialize (GimpTool *tool,
gtk_widget_show (toggle);
/* The area combo */
- operation = gegl_node_get_gegl_operation (filter_tool->operation);
-
- if (operation)
- operation_name = gegl_operation_get_name (operation);
+ gegl_node_get (filter_tool->operation,
+ "operation", &operation_name,
+ NULL);
filter_tool->region_combo =
gimp_prop_enum_combo_box_new (G_OBJECT (tool_info->tool_options),
@@ -430,16 +428,15 @@ gimp_filter_tool_initialize (GimpTool *tool,
gtk_box_pack_end (GTK_BOX (vbox), filter_tool->region_combo,
FALSE, FALSE, 0);
- if (! (GEGL_IS_OPERATION_POINT_RENDER (operation) ||
- GEGL_IS_OPERATION_POINT_FILTER (operation) ||
- GEGL_IS_OPERATION_POINT_COMPOSER (operation) ||
- GEGL_IS_OPERATION_POINT_COMPOSER3 (operation)) ||
- (operation_name &&
- gegl_operation_get_key (operation_name, "position-dependent")))
+ if (! gimp_gegl_node_is_point_operation (filter_tool->operation) ||
+ (operation_name &&
+ gegl_operation_get_key (operation_name, "position-dependent")))
{
gtk_widget_show (filter_tool->region_combo);
}
+ g_free (operation_name);
+
/* Fill in subclass widgets */
gimp_filter_tool_dialog (filter_tool);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]