[gegl] bin: add ability to clone parts of graph
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] bin: add ability to clone parts of graph
- Date: Sat, 19 Jan 2019 21:50:35 +0000 (UTC)
commit e9a5ef2b00540419e6dfc918c48d36a5176309dd
Author: Øyvind Kolås <pippin gimp org>
Date: Sat Jan 19 22:47:44 2019 +0100
bin: add ability to clone parts of graph
This continus the use of similar or side-effect behavior of the
traditional copy paste keybindings in addition to control-x - which
already is used for removing nodes (it doesn't store them to a clipboard however).
now control-c stores a pointer to the active node and control-v uses the
pointer on the input port, or if aux port is active on aux port of a node, this
permits rigging up custom implementations of unsharp mask and drop-shadow from
primitive gegl nodes from scratch when using keybindings.
bin/ui.c | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
---
diff --git a/bin/ui.c b/bin/ui.c
index b04d1c4a0..38ebbdc81 100644
--- a/bin/ui.c
+++ b/bin/ui.c
@@ -210,6 +210,8 @@ struct _State {
int show_bindings;
+ GeglNode *reference_node;
+
GeglNode *processor_node; /* the node we have a processor for */
GeglProcessor *processor;
GeglBuffer *processor_buffer;
@@ -1257,6 +1259,33 @@ cmd_todo (COMMAND_ARGS)
return 0;
}
+int cmd_reference (COMMAND_ARGS);/* "reference", -1, "", ""*/
+int
+cmd_reference (COMMAND_ARGS)
+{
+ State *o = global_state;
+ o->reference_node = o->active;
+ return 0;
+}
+
+int cmd_dereference (COMMAND_ARGS);/* "dereference", -1, "", ""*/
+int
+cmd_dereference (COMMAND_ARGS)
+{
+ State *o = global_state;
+ switch (o->pad_active)
+ {
+ case 0:
+ case 2:
+ gegl_node_link_many (o->reference_node, o->active, NULL);
+ break;
+ case 1:
+ gegl_node_link_many (o->reference_node, o->active, NULL);
+ break;
+ }
+ return 0;
+}
+
int cmd_mipmap (COMMAND_ARGS);/* "mipmap", -1, "", ""*/
@@ -3071,8 +3100,8 @@ static void ui_commandline (Mrg *mrg, void *data)
mrg_edit_start (mrg, update_commandline, o);
mrg_printf (mrg, "%s", commandline);
mrg_edit_end (mrg);
- mrg_end (mrg);
mrg_edit_end (mrg);
+ mrg_end (mrg);
row++;
//mrg_set_xy (mrg, em, h * 0.5);
@@ -3237,6 +3266,11 @@ static void gegl_ui (Mrg *mrg, void *data)
if (o->active != o->source)
mrg_add_binding (mrg, "control-x", NULL, NULL, run_command, "remove");
+ if (o->active != o->source)
+ mrg_add_binding (mrg, "control-c", NULL, NULL, run_command, "reference");
+
+ mrg_add_binding (mrg, "control-v", NULL, NULL, run_command, "dereference");
+
mrg_add_binding (mrg, "control-s", NULL, NULL, run_command, "toggle slideshow");
}
mrg_add_binding (mrg, "control-l", NULL, NULL, run_command, "clear");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]