index 9b816436b331c3ddf54951dce79e4cc875f52e53..d96b364ef4fdb82ab43bbef07b7bf7dbc34ac922 100644 (file)
-#define __SP_ITEM_PROPERTIES_C__
-
-/*
- * Object properties dialog
- *
- * Authors:
+/** @file
+ * @brief Object properties dialog
+ */
+/* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Johan Engelen <goejendaagh@zonnet.nl>
#include <gtk/gtkhbox.h>
#include <gtk/gtktable.h>
#include <gtk/gtkcheckbutton.h>
-#include <gtk/gtkspinbutton.h>
+#include <gtk/gtk.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkframe.h>
+#include <gtk/gtkexpander.h>
#include <gtk/gtktextview.h>
#include <gtk/gtktooltips.h>
+#include "../desktop-handles.h"
+#include "dialog-events.h"
+#include "../document.h"
#include <glibmm/i18n.h>
-#include "helper/window.h"
-#include "../widgets/sp-widget.h"
+#include "../helper/window.h"
#include "../inkscape.h"
-#include "../document.h"
-#include "../desktop-handles.h"
+#include "../interface.h"
+#include "../macros.h"
+#include "../preferences.h"
#include "../selection.h"
#include "../sp-item.h"
-#include "../macros.h"
#include "../verbs.h"
-#include "../interface.h"
-
-#include "dialog-events.h"
-#include "../prefs-utils.h"
+#include "../widgets/sp-attribute-widget.h"
+#include "../widgets/sp-widget.h"
#define MIN_ONSCREEN_DISTANCE 50
// impossible original values to make sure they are read from prefs
static gint x = -1000, y = -1000, w = 0, h = 0;
-static gchar const *prefs_path = "dialogs.object";
+static Glib::ustring const prefs_path = "/dialogs/object/";
static void sp_item_widget_modify_selection (SPWidget *spw, Inkscape::Selection *selection, guint flags, GtkWidget *itemw);
static void sp_item_widget_change_selection (SPWidget *spw, Inkscape::Selection *selection, GtkWidget *itemw);
@@ -75,10 +74,11 @@ sp_item_dialog_delete( GtkObject */*object*/, GdkEvent */*event*/, gpointer /*da
if (x<0) x=0;
if (y<0) y=0;
- prefs_set_int_attribute (prefs_path, "x", x);
- prefs_set_int_attribute (prefs_path, "y", y);
- prefs_set_int_attribute (prefs_path, "w", w);
- prefs_set_int_attribute (prefs_path, "h", h);
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ prefs->setInt(prefs_path + "x", x);
+ prefs->setInt(prefs_path + "y", y);
+ prefs->setInt(prefs_path + "w", w);
+ prefs->setInt(prefs_path + "h", h);
return FALSE; // which means, go ahead and destroy it
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();
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));
/* ID */
w = GTK_WIDGET(gtk_object_get_data (GTK_OBJECT (spw), "id"));
- gtk_entry_set_text (GTK_ENTRY (w), obj->id);
+ gtk_entry_set_text (GTK_ENTRY (w), obj->getId());
gtk_widget_set_sensitive (w, TRUE);
w = GTK_WIDGET(gtk_object_get_data (GTK_OBJECT (spw), "id_label"));
gtk_label_set_markup_with_mnemonic (GTK_LABEL (w), _("_Id"));
}
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));
item->setLocked(gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)));
- sp_document_done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
+ SPDocumentUndo::done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))? _("Lock object") : _("Unlock object"));
gtk_object_set_data (GTK_OBJECT (spw), "blocked", GUINT_TO_POINTER (FALSE));
item->setExplicitlyHidden(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)));
- sp_document_done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
+ SPDocumentUndo::done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))? _("Hide object") : _("Unhide object"));
gtk_object_set_data (GTK_OBJECT (spw), "blocked", GUINT_TO_POINTER (FALSE));
gchar *id = (gchar *) gtk_entry_get_text (GTK_ENTRY (id_entry));
g_strcanon (id, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.:", '_');
GtkWidget *id_label = GTK_WIDGET(gtk_object_get_data (GTK_OBJECT (spw), "id_label"));
- if (!strcmp (id, SP_OBJECT_ID(item))) {
+ if (!strcmp (id, item->getId())) {
gtk_label_set_markup_with_mnemonic (GTK_LABEL (id_label), _("_Id"));
} else if (!*id || !isalnum (*id)) {
gtk_label_set_text (GTK_LABEL (id_label), _("Id invalid! "));
SPException ex;
gtk_label_set_markup_with_mnemonic (GTK_LABEL (id_label), _("_Id"));
SP_EXCEPTION_INIT (&ex);
- sp_object_setAttribute (SP_OBJECT (item), "id", id, &ex);
- sp_document_done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
+ SP_OBJECT (item)->setAttribute ("id", id, &ex);
+ SPDocumentUndo::done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
_("Set object ID"));
}
SPObject *obj = (SPObject*)item;
if (strcmp (label, obj->defaultLabel())) {
obj->setLabel(label);
- sp_document_done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
+ SPDocumentUndo::done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
_("Set object label"));
}
GtkWidget *w = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(spw), "title"));
gchar *title = (gchar *)gtk_entry_get_text(GTK_ENTRY (w));
if (obj->setTitle(title))
- sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
+ SPDocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
_("Set object title"));
/* Retrieve the description */
gtk_text_buffer_get_bounds(buf, &start, &end);
gchar *desc = gtk_text_buffer_get_text(buf, &start, &end, TRUE);
if (obj->setDesc(desc))
- sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
+ SPDocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
_("Set object description"));
g_free(desc);
gchar title[500];
sp_ui_dialog_title_string (Inkscape::Verb::get(SP_VERB_DIALOG_ITEM), title);
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
dlg = sp_window_new (title, TRUE);
if (x == -1000 || y == -1000) {
- x = prefs_get_int_attribute (prefs_path, "x", -1000);
- y = prefs_get_int_attribute (prefs_path, "y", -1000);
+ x = prefs->getInt(prefs_path + "x", -1000);
+ y = prefs->getInt(prefs_path + "y", -1000);
}
-
if (w ==0 || h == 0) {
- w = prefs_get_int_attribute (prefs_path, "w", 0);
- h = prefs_get_int_attribute (prefs_path, "h", 0);
+ w = prefs->getInt(prefs_path + "w", 0);
+ h = prefs->getInt(prefs_path + "h", 0);
}
// if (x<0) x=0;