[gimp] app: allow arbitrary aux inputs in GimpOperationTool
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: allow arbitrary aux inputs in GimpOperationTool
- Date: Thu, 14 May 2020 21:51:52 +0000 (UTC)
commit 1bf9d1ba53c7f777afcb7b7c41a121f4f034eef0
Author: Ell <ell_se yahoo com>
Date: Thu May 14 22:23:48 2020 +0300
app: allow arbitrary aux inputs in GimpOperationTool
In GimpOperationTool, don't limit aux inputs to "aux".."aux32", and
rather list all aux inputs the op has.
app/tools/gimpoperationtool.c | 63 +++++++++++++++++++++++--------------------
1 file changed, 34 insertions(+), 29 deletions(-)
---
diff --git a/app/tools/gimpoperationtool.c b/app/tools/gimpoperationtool.c
index 2c16ca351d..d5894dc19f 100644
--- a/app/tools/gimpoperationtool.c
+++ b/app/tools/gimpoperationtool.c
@@ -517,11 +517,11 @@ gimp_operation_tool_sync_op (GimpOperationTool *op_tool,
static void
gimp_operation_tool_create_gui (GimpOperationTool *op_tool)
{
- GimpFilterTool *filter_tool = GIMP_FILTER_TOOL (op_tool);
- GtkWidget *options_gui;
- gint off_x, off_y;
- GeglRectangle area;
- gint aux;
+ GimpFilterTool *filter_tool = GIMP_FILTER_TOOL (op_tool);
+ GtkWidget *options_gui;
+ gint off_x, off_y;
+ GeglRectangle area;
+ gchar **input_pads;
gimp_filter_tool_get_drawable_area (filter_tool, &off_x, &off_y, &area);
@@ -535,38 +535,43 @@ gimp_operation_tool_create_gui (GimpOperationTool *op_tool)
filter_tool);
g_weak_ref_set (&op_tool->options_gui_ref, options_gui);
- for (aux = 1; ; aux++)
- {
- gchar pad[32];
- gchar label[32];
+ input_pads = gegl_node_list_input_pads (filter_tool->operation);
- if (aux == 1)
- {
- g_snprintf (pad, sizeof (pad), "aux");
- /* don't translate "Aux" */
- g_snprintf (label, sizeof (label), _("Aux Input"));
- }
- else
- {
- g_snprintf (pad, sizeof (pad), "aux%d", aux);
- /* don't translate "Aux" */
- g_snprintf (label, sizeof (label), _("Aux%d Input"), aux);
- }
+ if (input_pads)
+ {
+ gint i;
- if (gegl_node_has_pad (filter_tool->operation, pad))
+ for (i = 0; input_pads[i]; i++)
{
AuxInput *input;
+ GRegex *regex;
+ gchar *label;
+
+ if (! strcmp (input_pads[i], "input"))
+ continue;
+
+ regex = g_regex_new ("^aux(\\d*)$", 0, 0, NULL);
+
+ g_return_if_fail (regex != NULL);
+
+ /* Translators: don't translate "Aux" */
+ label = g_regex_replace (regex,
+ input_pads[i], -1, 0,
+ _("Aux\\1 Input"),
+ 0, NULL);
input = gimp_operation_tool_aux_input_new (op_tool,
- filter_tool->operation, pad,
- label);
+ filter_tool->operation,
+ input_pads[i], label);
- op_tool->aux_inputs = g_list_append (op_tool->aux_inputs, input);
- }
- else
- {
- break;
+ op_tool->aux_inputs = g_list_prepend (op_tool->aux_inputs, input);
+
+ g_free (label);
+
+ g_regex_unref (regex);
}
+
+ g_strfreev (input_pads);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]