From f12e01f1c0ba0c6a51ba923320c496fa50b53066 Mon Sep 17 00:00:00 2001 From: JucaBlues Date: Thu, 15 Jan 2009 10:24:38 +0000 Subject: [PATCH] added interactivity attributes to the object properties dialog. If you want to test it, create a new document, draw something, select it, ctrl+shift+O, expand the Interactivity expander and set: onclick to window.location="http://xkcd.com" onmouseover to this.style.cursor="pointer" Save as Inkscape SVG (currently not working for Plain SVG) then open this SVG file in Firefox to see the result. --- src/dialogs/item-properties.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/dialogs/item-properties.cpp b/src/dialogs/item-properties.cpp index d1992b158..a885e7a61 100644 --- a/src/dialogs/item-properties.cpp +++ b/src/dialogs/item-properties.cpp @@ -36,6 +36,7 @@ #include "../macros.h" #include "../verbs.h" #include "../interface.h" +#include "sp-attribute-widget.h" #include "dialog-events.h" #include "../preferences.h" @@ -91,7 +92,7 @@ GtkWidget * sp_item_widget_new (void) { - GtkWidget *spw, *vb, *t, *cb, *l, *f, *tf, *pb; + GtkWidget *spw, *vb, *t, *cb, *l, *f, *tf, *pb, *int_expander, *int_label; GtkTextBuffer *desc_buffer; GtkTooltips *tt = gtk_tooltips_new(); @@ -238,6 +239,14 @@ sp_item_widget_new (void) spw ); gtk_object_set_data (GTK_OBJECT (spw), "sensitive", cb); + /* Create the frame for interactivity options */ + int_label = gtk_label_new_with_mnemonic (_("_Interactivity")); + int_expander = gtk_expander_new (NULL); + gtk_expander_set_label_widget (GTK_EXPANDER (int_expander),int_label); + gtk_object_set_data (GTK_OBJECT (spw), "interactivity", int_expander); + + gtk_box_pack_start (GTK_BOX (vb), int_expander, FALSE, FALSE, 0); + gtk_widget_show_all (spw); sp_item_widget_setup (SP_WIDGET (spw), sp_desktop_selection (SP_ACTIVE_DESKTOP)); @@ -351,6 +360,22 @@ sp_item_widget_setup ( SPWidget *spw, Inkscape::Selection *selection ) } w = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(spw), "desc_frame")); gtk_widget_set_sensitive(w, TRUE); + + w = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(spw), "interactivity")); + + GtkWidget* int_table = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(spw), "interactivity_table")); + if (int_table){ + gtk_container_remove(GTK_CONTAINER(w), int_table); + } + + const gchar* int_labels[10] = {"onclick", "onmouseover", "onmouseout", "onmousedown", "onmouseup", "onmousemove","onfocusin", "onfocusout", "onactivate", "onload"}; + + int_table = sp_attribute_table_new (obj, 10, int_labels, int_labels); + gtk_widget_show_all (int_table); + gtk_object_set_data(GTK_OBJECT(spw), "interactivity_table", int_table); + + gtk_container_add (GTK_CONTAINER (w), int_table); + } gtk_object_set_data (GTK_OBJECT (spw), "blocked", GUINT_TO_POINTER (FALSE)); -- 2.30.2