diff options
| author | Kris De Gussem <kris.degussem@gmail.com> | 2011-12-17 07:33:41 +0000 |
|---|---|---|
| committer | Kris <Kris.De.Gussem@hotmail.com> | 2011-12-17 07:33:41 +0000 |
| commit | c21a3c75d968aac77597843426ce65d7757bbdb3 (patch) | |
| tree | 4bb03a9adf17cc07d28a1077ed80da73961b33f5 /src | |
| parent | fix compiler warnings (diff) | |
| download | inkscape-c21a3c75d968aac77597843426ce65d7757bbdb3.tar.gz inkscape-c21a3c75d968aac77597843426ce65d7757bbdb3.zip | |
Dropped unused SPAttributeWidget
(bzr r10778)
Diffstat (limited to 'src')
| -rw-r--r-- | src/widgets/sp-attribute-widget.cpp | 152 | ||||
| -rw-r--r-- | src/widgets/sp-attribute-widget.h | 29 |
2 files changed, 0 insertions, 181 deletions
diff --git a/src/widgets/sp-attribute-widget.cpp b/src/widgets/sp-attribute-widget.cpp index 1c7d36b4d..d2c52e2ae 100644 --- a/src/widgets/sp-attribute-widget.cpp +++ b/src/widgets/sp-attribute-widget.cpp @@ -22,158 +22,6 @@ using Inkscape::DocumentUndo; -static void sp_attribute_widget_object_modified ( SPObject *object, - guint flags, - SPAttributeWidget *spaw ); - - -SPAttributeWidget::SPAttributeWidget () : - blocked(0), - hasobj(0), - _attribute(), - modified_connection() -{ - src.object = NULL; -} - -SPAttributeWidget::~SPAttributeWidget () -{ - if (hasobj) - { - if (src.object) - { - modified_connection.disconnect(); - src.object = NULL; - } - } - else - { - if (src.repr) - { - src.repr = Inkscape::GC::release(src.repr); - } - } -} - -void SPAttributeWidget::set_object(SPObject *object, const gchar *attribute) -{ - if (hasobj) { - if (src.object) { - modified_connection.disconnect(); - src.object = NULL; - } - } else { - - if (src.repr) { - src.repr = Inkscape::GC::release(src.repr); - } - } - - hasobj = true; - - if (object) { - const gchar *val; - - blocked = true; - src.object = object; - - modified_connection = object->connectModified(sigc::bind<2>(sigc::ptr_fun(&sp_attribute_widget_object_modified), this)); - - _attribute = attribute; - - val = object->getRepr()->attribute(attribute); - set_text (val ? val : (const gchar *) ""); - blocked = false; - } - gtk_widget_set_sensitive (GTK_WIDGET(this), (src.object != NULL)); -} - -void SPAttributeWidget::set_repr(Inkscape::XML::Node *repr, const gchar *attribute) -{ - if (hasobj) { - if (src.object) { - modified_connection.disconnect(); - src.object = NULL; - } - } else { - - if (src.repr) { - src.repr = Inkscape::GC::release(src.repr); - } - } - - hasobj = false; - - if (repr) { - const gchar *val; - - blocked = true; - src.repr = Inkscape::GC::anchor(repr); - attribute = g_strdup (attribute); - - val = repr->attribute(attribute); - set_text (val ? val : (const gchar *) ""); - blocked = false; - } - gtk_widget_set_sensitive (GTK_WIDGET (this), (src.repr != NULL)); -} - -void SPAttributeWidget::on_changed (void) -{ - if (!blocked) - { - Glib::ustring text1; - const gchar *text; - blocked = true; - text1 = get_text (); - text = text1.c_str(); - if (!*text) - text = NULL; - - if (hasobj && src.object) { - src.object->getRepr()->setAttribute(_attribute.c_str(), text, false); - DocumentUndo::done(src.object->document, SP_VERB_NONE, - _("Set attribute")); - - } else if (src.repr) { - src.repr->setAttribute(_attribute.c_str(), text, false); - /* TODO: Warning! Undo will not be flushed in given case */ - } - blocked = false; - } -} - -static void sp_attribute_widget_object_modified ( SPObject */*object*/, - guint flags, - SPAttributeWidget *spaw ) -{ - - if (flags && SP_OBJECT_MODIFIED_FLAG) { - - const gchar *val; - Glib::ustring text; - Glib::ustring attr = spaw->get_attribute(); - val = spaw->src.object->getRepr()->attribute(attr.c_str()); - text = spaw->get_text(); - - if (val || !text.empty()) { - - if (!val || text.empty() || (text == val)) { - /* We are different */ - spaw->set_blocked(true); - spaw->set_text(val ? val : (const gchar *) ""); - spaw->set_blocked(false); - } // end of if() - - } // end of if() - - } //end of if() - -} // end of sp_attribute_widget_object_modified() - - - -/* SPAttributeTable */ static void sp_attribute_table_object_modified (SPObject *object, guint flags, SPAttributeTable *spaw); static void sp_attribute_table_entry_changed (Gtk::Editable *editable, SPAttributeTable *spat); diff --git a/src/widgets/sp-attribute-widget.h b/src/widgets/sp-attribute-widget.h index 311d9ba66..a03b9b193 100644 --- a/src/widgets/sp-attribute-widget.h +++ b/src/widgets/sp-attribute-widget.h @@ -20,7 +20,6 @@ #include <glib.h> #include <stddef.h> #include <sigc++/connection.h> -//#include <vector.h> namespace Inkscape { namespace XML { @@ -32,34 +31,6 @@ struct SPAttributeTable; struct SPAttributeTableClass; class SPObject; -class SPAttributeWidget : public Gtk::Entry { -//NOTE: SPAttributeWidget does not seem to be used nowhere in Inkscape, conversion to c++ not tested -public: - SPAttributeWidget (); - ~SPAttributeWidget (); - void set_object(SPObject *object, const gchar *attribute); - void set_repr(Inkscape::XML::Node *repr, const gchar *attribute); - Glib::ustring get_attribute(void) {return _attribute;}; - void set_blocked(guint b) {blocked = b;}; - - union { - SPObject *object; - Inkscape::XML::Node *repr; - } src; - -protected: - void on_changed (void); - -private: - guint blocked; - guint hasobj; - Glib::ustring _attribute; - sigc::connection modified_connection; -}; - - -/* SPAttributeTable */ - class SPAttributeTable : public Gtk::Widget { public: SPAttributeTable (); |
