From d3e5483c848d0a75b767082c7ca09b96f0dd5a37 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C5=99emysl=20Janouch?=
Date: Tue, 4 Jan 2011 09:54:05 +0100
Subject: Make adding symbols to the diagram possible.
This required creating a simple framework for operations to LdCanvas.
It is probable that it's going to require some changes when other
operations are added. The basic idea behind it seems to be good, though.
---
src/ld-window-main.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
(limited to 'src/ld-window-main.c')
diff --git a/src/ld-window-main.c b/src/ld-window-main.c
index 16c223c..32212a1 100644
--- a/src/ld-window-main.c
+++ b/src/ld-window-main.c
@@ -761,7 +761,25 @@ on_canvas_button_release (GtkWidget *widget, GdkEventButton *event,
if (event->button != 1)
return FALSE;
- /* TODO: Add the selected symbol into the document on the position. */
+ if (data->active_item != -1)
+ {
+ LdDiagramSymbol *symbol;
+ const gchar *category_name, *symbol_name;
+ gchar *klass;
+
+ category_name = ld_symbol_category_get_name
+ (g_object_get_data (G_OBJECT (data->active_button), "category"));
+ symbol_name = ld_symbol_get_name
+ (data->items[data->active_item].symbol);
+
+ klass = g_build_path (LD_LIBRARY_IDENTIFIER_SEPARATOR,
+ category_name, symbol_name, NULL);
+ symbol = ld_diagram_symbol_new (klass);
+ g_free (klass);
+
+ ld_canvas_add_object_begin (self->priv->canvas,
+ LD_DIAGRAM_OBJECT (symbol));
+ }
/* We've either chosen a symbol or canceled the menu, so hide it. */
if (data->active_button)
--
cgit v1.2.3