diff options
| author | Jabiertxof <jabier.arraiza@marker.es> | 2019-01-17 18:45:16 +0000 |
|---|---|---|
| committer | Jabiertxof <jabier.arraiza@marker.es> | 2019-01-17 18:45:16 +0000 |
| commit | b04e3d7c17f1eb0624031962608bf14e473a1460 (patch) | |
| tree | d7fc4e0a67b969f51764b1141491beac2be4231d /src | |
| parent | Remove confusing and broken save as PNG option (diff) | |
| download | inkscape-b04e3d7c17f1eb0624031962608bf14e473a1460.tar.gz inkscape-b04e3d7c17f1eb0624031962608bf14e473a1460.zip | |
Allow edit text nodes with the XMLInspector
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/dialog/attrdialog.cpp | 33 | ||||
| -rw-r--r-- | src/ui/dialog/xml-tree.cpp | 2 |
2 files changed, 29 insertions, 6 deletions
diff --git a/src/ui/dialog/attrdialog.cpp b/src/ui/dialog/attrdialog.cpp index 21e92f600..bd480dcb7 100644 --- a/src/ui/dialog/attrdialog.cpp +++ b/src/ui/dialog/attrdialog.cpp @@ -36,11 +36,20 @@ static void on_attr_changed (Inkscape::XML::Node * repr, { ATTR_DIALOG(data)->onAttrChanged(repr, name, new_value); } + +static void on_content_changed (Inkscape::XML::Node * repr, + gchar const * oldcontent, + gchar const * newcontent, + gpointer data) +{ + ATTR_DIALOG(data)->onAttrChanged(repr, "content", repr->content()); +} + Inkscape::XML::NodeEventVector _repr_events = { nullptr, /* child_added */ nullptr, /* child_removed */ on_attr_changed, - nullptr, /* content_changed */ + on_content_changed, /* content_changed */ nullptr /* order_changed */ }; @@ -127,7 +136,6 @@ AttrDialog::AttrDialog(): setDesktop(getDesktop()); } - /** * @brief AttrDialog::~AttrDialog * Class destructor @@ -260,7 +268,11 @@ void AttrDialog::onAttrDelete(Glib::ustring path) Gtk::TreeModel::Row row = *_store->get_iter(path); if (row) { Glib::ustring name = row[_attrColumns._attributeName]; - this->_repr->setAttribute(name.c_str(), nullptr, false); + if(name == "content") { + return; + } else { + this->_repr->setAttribute(name.c_str(), nullptr, false); + } this->setUndo(_("Delete attribute")); } } @@ -283,7 +295,11 @@ bool AttrDialog::onKeyPressed(GdkEventKey *event) { // Create new attribute (repeat code, fold into above event!) Glib::ustring name = row[_attrColumns._attributeName]; - this->_repr->setAttribute(name.c_str(), nullptr, false); + if(name == "content") { + return true; + } else { + this->_repr->setAttribute(name.c_str(), nullptr, false); + } this->setUndo(_("Delete attribute")); return true; } @@ -314,6 +330,9 @@ void AttrDialog::nameEdited (const Glib::ustring& path, const Glib::ustring& nam Gtk::TreeModel::Row row = *_store->get_iter(path); if(row && this->_repr) { Glib::ustring old_name = row[_attrColumns._attributeName]; + if (old_name == "content") { + return; + } Glib::ustring value = row[_attrColumns._attributeValue]; if(!old_name.empty()) { // Remove named value @@ -344,7 +363,11 @@ void AttrDialog::valueEdited (const Glib::ustring& path, const Glib::ustring& va if(row && this->_repr) { Glib::ustring name = row[_attrColumns._attributeName]; if(name.empty()) return; - _repr->setAttribute(name, value, false); + if (name == "content") { + _repr->setContent(value.c_str()); + } else { + _repr->setAttribute(name, value, false); + } this->setUndo(_("Change attribute value")); } } diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp index c6058945f..26c1e964b 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -353,7 +353,7 @@ void XmlTree::set_tree_select(Inkscape::XML::Node *repr) void XmlTree::propagate_tree_select(Inkscape::XML::Node *repr) { - if (repr && (repr->type() == Inkscape::XML::ELEMENT_NODE)) { + if (repr && (repr->type() == Inkscape::XML::ELEMENT_NODE || repr->type() == Inkscape::XML::TEXT_NODE)) { attributes->setRepr(repr); } else { attributes->setRepr(nullptr); |
