[gegl/soc-2012-editor] Added a panel in the editor window which is populated with a table of properties whenever a new node
- From: Isaac Wagner <isaacbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/soc-2012-editor] Added a panel in the editor window which is populated with a table of properties whenever a new node
- Date: Mon, 18 Jun 2012 00:29:44 +0000 (UTC)
commit 513856ebbf74e4ff0959433620728e311fe6c534
Author: Isaac Wagner <isaacbw src gnome org>
Date: Sun Jun 17 20:23:06 2012 -0400
Added a panel in the editor window which is populated with a table of properties whenever a new node is selected. No functionality beyond adding stuff to a Gtk container
bin/editor/gegl-editor-layer.c | 41 ++++++++++++++++++++++++++++++++++++++-
bin/editor/gegl-editor-layer.h | 3 +-
bin/editor/gegl-editor.c | 23 +++++++++++++++++----
3 files changed, 59 insertions(+), 8 deletions(-)
---
diff --git a/bin/editor/gegl-editor-layer.c b/bin/editor/gegl-editor-layer.c
index 4396e1d..d0d0468 100644
--- a/bin/editor/gegl-editor-layer.c
+++ b/bin/editor/gegl-editor-layer.c
@@ -95,28 +95,65 @@ gint layer_node_selected (gpointer host, GeglEditor* editor, gint node_id)
guint n_props;
GParamSpec** properties = gegl_operation_list_properties(gegl_node_get_operation(node), &n_props);
+
+ //prop_box *should* only have one child which was added by the editor layer, but clear it anyway
+ /*GList *children, *iter;
+
+ children = gtk_container_get_children(GTK_CONTAINER(self->prop_box));
+ for(iter = children; iter != NULL; iter = g_list_next(iter))
+ gtk_widget_destroy(GTK_WIDGET(iter->data));
+ g_list_free(children);*/
+
+ //TODO: only create enough columns for the properties which will actually be included (i.e. ignoring GeglBuffer props)
+ GtkTable *prop_table = gtk_table_new(2, n_props, FALSE);
+
int i;
for(i = 0; i < n_props; i++)
{
GParamSpec* prop = properties[i];
- g_print("%s (%s)\n", prop->name, g_type_name(prop->value_type));
+ GType type = prop->value_type;
+ guchar* name = prop->name;
+
+ GtkWidget* name_label = gtk_label_new(name);
+ gtk_misc_set_alignment(GTK_MISC(name_label), 0, 0.5);
+ gtk_table_attach(prop_table, name_label, 0, 1, i, i+1, GTK_FILL, GTK_FILL, 1, 1);
+
+ GtkWidget* value_entry = gtk_entry_new();
+ gtk_entry_set_width_chars(GTK_ENTRY(value_entry), 5);
+ gtk_table_attach(prop_table, value_entry, 1, 2, i, i+1, GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL, 1, 1);
}
+
+ gtk_box_pack_start(GTK_BOX(self->prop_box), prop_table, TRUE, TRUE, 0);
+ gtk_widget_show_all(self->prop_box);
+}
+
+gint layer_node_deselected(gpointer host, GeglEditor* editor, gint node)
+{
+ GeglEditorLayer* self = (GeglEditorLayer*)host;
+ GList *children, *iter;
+
+ children = gtk_container_get_children(GTK_CONTAINER(self->prop_box));
+ for(iter = children; iter != NULL; iter = g_list_next(iter))
+ gtk_widget_destroy(GTK_WIDGET(iter->data));
+ g_list_free(children);
}
/* gint (*nodeSelected) (gpointer host, GeglEditor* editor, gint node);
gint (*nodeDeselected) (gpointer host, GeglEditor* editor, gint node);*/
GeglEditorLayer*
-layer_create(GeglEditor* editor, GeglNode* gegl)
+layer_create(GeglEditor* editor, GeglNode* gegl, GtkWidget* prop_box)
{
GeglEditorLayer* layer = malloc(sizeof(GeglEditorLayer));
editor->host = (gpointer)layer;
editor->connectedPads = layer_connected_pads;
editor->disconnectedPads = layer_disconnected_pads;
editor->nodeSelected = layer_node_selected;
+ editor->nodeDeselected = layer_node_deselected;
layer->editor = editor;
layer->gegl = gegl;
layer->pairs = NULL;
+ layer->prop_box = prop_box;
return layer;
}
diff --git a/bin/editor/gegl-editor-layer.h b/bin/editor/gegl-editor-layer.h
index 8f23a6c..e34356d 100644
--- a/bin/editor/gegl-editor-layer.h
+++ b/bin/editor/gegl-editor-layer.h
@@ -23,13 +23,14 @@ struct _GeglEditorLayer
{
GeglEditor *editor;
GeglNode *gegl;
+ GtkWidget *prop_box; //container for the property editor
GSList *pairs;
};
/*
Editor and gegl graph should both be empty, but properly initialized
*/
-GeglEditorLayer* layer_create(GeglEditor* editor, GeglNode* gegl);
+GeglEditorLayer* layer_create(GeglEditor* editor, GeglNode* gegl, GtkWidget* property_editor_container);
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 0fa4e28..b75bce8 100644
--- a/bin/editor/gegl-editor.c
+++ b/bin/editor/gegl-editor.c
@@ -56,10 +56,16 @@ main (gint argc,
GeglEditor* node_editor = GEGL_EDITOR(editor);
gegl_init(&argc, &argv);
+
+////////////////////////////////////////////CREATE OPERATION DIALOG///////////////////////////////////////////
+
+ GtkWidget* property_box = gtk_vbox_new(TRUE, 0);
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//add some samples nodes
GeglNode *gegl = gegl_node_new();
- GeglEditorLayer* layer = layer_create(node_editor, gegl);
+ GeglEditorLayer* layer = layer_create(node_editor, gegl, property_box);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(window), 800, 600);
@@ -69,9 +75,6 @@ main (gint argc,
gtk_widget_show(vbox);
gtk_container_add(GTK_CONTAINER(window), vbox);
-////////////////////////////////////////////ADD OPERATION DIALOG//////////////////////////////////////////////
-
-
/////////////////////////////////////////////////BUILD MENUBAR////////////////////////////////////////////////
@@ -104,10 +107,20 @@ main (gint argc,
gtk_menu_shell_append(GTK_MENU_SHELL(graph_menu), add_operation);
gtk_menu_shell_append(GTK_MENU_SHELL(menubar), graph);
+
+////////////////////////////////////////////HORIZONTAL PANE///////////////////////////////////////////////////
+
+ GtkWidget* pane = gtk_hpaned_new();
+ gtk_paned_set_position(GTK_PANED(pane), 200);
+
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(vbox), editor, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), pane, TRUE, TRUE, 0);
+
+ gtk_paned_pack1(GTK_PANED(pane), property_box, TRUE, FALSE);
+ gtk_paned_pack2(GTK_PANED(pane), editor, TRUE, TRUE);
+
gtk_widget_show_all(window);
////////////////////////////////////////////GEGL OPERATIONS///////////////////////////////////////////////////
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]