[gegl] bin: permit selecting aux/input pads of all nodes



commit 62d3d6700aae0b5cc9c86e2da17b3d5cf2c00e16
Author: Øyvind Kolås <pippin gimp org>
Date:   Sun Jan 20 19:37:23 2019 +0100

    bin: permit selecting aux/input pads of all nodes
    
    This is achieve by making cursor right, go to the aux pad if it exist
    or to input pad otherwise, cursor left cycles through the same route
    in reverse.

 bin/ui.c | 49 ++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 38 insertions(+), 11 deletions(-)
---
diff --git a/bin/ui.c b/bin/ui.c
index ad729da71..ccef50de5 100644
--- a/bin/ui.c
+++ b/bin/ui.c
@@ -2021,25 +2021,52 @@ int cmd_activate (COMMAND_ARGS) /* "activate", 1, "<input|output|aux|append|sour
 
   if (!strcmp (argv[1], "input"))
   {
-    ref = gegl_node_get_ui_producer (o->active, "input", NULL);
-    if (ref == NULL)
-      o->pad_active = 0;
-    else
-      o->pad_active = 2;
+    switch (o->pad_active)
+    {
+       case 1:
+        ref = gegl_node_get_ui_producer (o->active, "aux", NULL);
+        if (ref == NULL)
+          o->pad_active = 0;
+        else
+          o->pad_active = 2;
+        break;
+
+       case 0:
+       case 2:
+        ref = gegl_node_get_ui_producer (o->active, "input", NULL);
+        if (ref == NULL)
+          o->pad_active = 0;
+        else
+          o->pad_active = 2;
+       break;
+
+    }
   }
   else if (!strcmp (argv[1], "aux"))
   {
-    ref = gegl_node_get_producer (o->active, "aux", NULL);
-    if (!ref)
+    if (o->pad_active == 1)
+    {
+      ref = gegl_node_get_producer (o->active, "aux", NULL);
+      if (!ref)
+      {
+        ref = o->active;
+        if (gegl_node_has_pad (o->active, "aux"))
+          o->pad_active = 1;
+        else if (gegl_node_has_pad (o->active, "input"))
+          o->pad_active = 0;
+    }
+    else
+    {
+        o->pad_active = 2;
+    }
+    }
+    else
     {
-      ref = o->active;
       if (gegl_node_has_pad (o->active, "aux"))
         o->pad_active = 1;
       else if (gegl_node_has_pad (o->active, "input"))
         o->pad_active = 0;
-    }
-    else
-    {
+      else
         o->pad_active = 2;
     }
   }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]