[gegl/soc-2012-editor] Can add a node to the interface layer, which creates an appropriate node on the editor widget with t
- From: Isaac Wagner <isaacbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/soc-2012-editor] Can add a node to the interface layer, which creates an appropriate node on the editor widget with t
- Date: Wed, 13 Jun 2012 20:29:42 +0000 (UTC)
commit ef56d993dfd2579ff6f9376945462e8203d24a09
Author: Isaac Wagner <isaacbw src gnome org>
Date: Wed Jun 13 16:24:20 2012 -0400
Can add a node to the interface layer, which creates an appropriate node on the editor widget with title and inputs
bin/editor/build | 2 +-
bin/editor/gegl-editor-layer.c | 16 +++++++++++++---
bin/editor/gegl-editor-layer.h | 6 ++----
bin/editor/gegl-editor.c | 3 +++
bin/editor/gegl-node-widget.c | 1 +
5 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/bin/editor/build b/bin/editor/build
index 602f294..fb8f0fa 100755
--- a/bin/editor/build
+++ b/bin/editor/build
@@ -1 +1 @@
-gcc gegl-editor.c gegl-editor-layer.c gegl-node-widget.c -o editor `pkg-config --cflags --libs gtk+-2.0` -I/usr/local/include/gegl-0.1/ -I/usr/local/include/babl-0.1/
\ No newline at end of file
+gcc -g gegl-editor.c gegl-editor-layer.c gegl-node-widget.c -o editor `pkg-config --cflags --libs gtk+-2.0` -I/usr/local/include/gegl-0.2/ -I/usr/local/include/babl-0.1/ -lgegl-0.2
\ No newline at end of file
diff --git a/bin/editor/gegl-editor-layer.c b/bin/editor/gegl-editor-layer.c
index 48faf4e..5363a1f 100644
--- a/bin/editor/gegl-editor-layer.c
+++ b/bin/editor/gegl-editor-layer.c
@@ -1,7 +1,7 @@
#include "gegl-editor-layer.h"
GeglEditorLayer*
-layer_create(GeglEditor* editor, GeglEditor* gegl)
+layer_create(GeglEditor* editor, GeglNode* gegl)
{
GeglEditorLayer* layer = malloc(sizeof(GeglEditorLayer));
layer->editor = editor;
@@ -10,7 +10,17 @@ layer_create(GeglEditor* editor, GeglEditor* gegl)
}
void
-layer_add_gegl_op(GeglEditorLayer* layer, GeglOperation* node)
+layer_add_gegl_node(GeglEditorLayer* layer, GeglNode* node)
{
- gegl_editor_add_node(layer->editor, gegl_operation_get_name(operation), 0, NULL, 0, NULL);
+ //get input pads
+ //gegl_pad_is_output
+ GSList *pads = gegl_node_get_input_pads(node);
+ guint num_inputs = g_slist_length(pads);
+ gchar** inputs = malloc(sizeof(gchar*)*num_inputs);
+ int i;
+ for(i = 0; pads != NULL; pads = pads->next, i++)
+ {
+ inputs[i] = gegl_pad_get_name(pads->data);
+ }
+ gegl_editor_add_node(layer->editor, gegl_node_get_operation(node), num_inputs, inputs, 0, NULL);
}
diff --git a/bin/editor/gegl-editor-layer.h b/bin/editor/gegl-editor-layer.h
index 4e8eea6..8ee8a22 100644
--- a/bin/editor/gegl-editor-layer.h
+++ b/bin/editor/gegl-editor-layer.h
@@ -3,8 +3,6 @@
#include "gegl-node-widget.h"
#include <gegl.h>
-typedef struct _GeglOperation GeglOperation;
-#include <operation/gegl-operation.h>
/*
Creates and removes connections between pads in the Gegl graph
@@ -23,8 +21,8 @@ struct _GeglEditorLayer
/*
Editor and gegl graph should both be empty, but properly initialized
*/
-GeglEditorLayer* layer_create(GeglEditor* editor, GeglEditor* gegl);
-void layer_add_gegl_op(GeglEditorLayer* layer, GeglOperation* op);
+GeglEditorLayer* layer_create(GeglEditor* editor, GeglNode* gegl);
+void layer_add_gegl_node(GeglEditorLayer* layer, GeglNode* node);
//void layer_remove_gegl_node(GeglNode* node);
//link, unlink
diff --git a/bin/editor/gegl-editor.c b/bin/editor/gegl-editor.c
index c60a287..34b5534 100644
--- a/bin/editor/gegl-editor.c
+++ b/bin/editor/gegl-editor.c
@@ -37,6 +37,9 @@ main (gint argc,
GeglNode *gegl = gegl_node_new();
GeglEditorLayer* layer = layer_create(node_editor, gegl);
+ GeglNode *display = gegl_node_create_child (gegl, "gegl:display");
+ layer_add_gegl_node(layer, display);
+
gtk_main();
return 0;
diff --git a/bin/editor/gegl-node-widget.c b/bin/editor/gegl-node-widget.c
index 4502149..e378a34 100644
--- a/bin/editor/gegl-node-widget.c
+++ b/bin/editor/gegl-node-widget.c
@@ -536,6 +536,7 @@ gegl_editor_add_node(GeglEditor* self, gchar* title, gint ninputs, gchar** input
self->first_node = node;
node->id = self->next_id++;
+ node->title = title;
int i;
NodePad* pad;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]