index bd442b8872a1ec375b0f36f38f9722b7c3b4cc37..c90cde490ba02dfd0812b1c57a19ddadfbe2934f 100644 (file)
--- a/src/dialogs/xml-tree.cpp
+++ b/src/dialogs/xml-tree.cpp
* bulia byak <buliabyak@users.sf.net>
* Johan Engelen <goejendaagh@zonnet.nl>
* David Turner
+ * Jon A. Cruz <jon@joncruz.org>
+ * Abhishek Sharma
*
* Copyright (C) 1999-2006 Authors
* Released under GNU GPL, read the file 'COPYING' for more information
#include "../widgets/sp-xmlview-content.h"
#include "../widgets/sp-xmlview-tree.h"
+using Inkscape::DocumentUndo;
+
#define MIN_ONSCREEN_DISTANCE 50
struct EditableDest {
if (current_document) {
document_uri_set_connection = current_document->connectURISet(sigc::bind(sigc::ptr_fun(&on_document_uri_set), current_document));
- on_document_uri_set(SP_DOCUMENT_URI(current_document), current_document);
- set_tree_repr(sp_document_repr_root(current_document));
-
+ on_document_uri_set( current_document->getURI(), current_document );
+ set_tree_repr(current_document->getReprRoot());
} else {
set_tree_repr(NULL);
}
if (GTK_CTREE_ROW(node)->parent == new_parent &&
GTK_CTREE_ROW(node)->sibling == new_sibling)
{
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- _("Drag XML subtree"));
+ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
+ _("Drag XML subtree"));
} else {
- sp_document_cancel(current_document);
+ DocumentUndo::cancel(current_document);
}
}
{
gchar title[500];
sp_ui_dialog_title_string(Inkscape::Verb::get(SP_VERB_DIALOG_XML_EDITOR), title);
- gchar *t = g_strdup_printf("%s: %s", SP_DOCUMENT_NAME(document), title);
+ gchar *t = g_strdup_printf("%s: %s", document->getName(), title);
gtk_window_set_title(GTK_WINDOW(dlg), t);
g_free(t);
}
gtk_main();
if (selected_repr != NULL && name.text) {
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(current_document);
+ Inkscape::XML::Document *xml_doc = current_document->getReprDoc();
Inkscape::XML::Node *new_repr;
new_repr = xml_doc->createElement(name.text);
Inkscape::GC::release(new_repr);
set_tree_select(new_repr);
set_dt_select(new_repr);
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- _("Create new element node"));
+ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
+ _("Create new element node"));
}
} // end of cmd_new_element_node()
{
g_assert(selected_repr != NULL);
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(current_document);
+ Inkscape::XML::Document *xml_doc = current_document->getReprDoc();
Inkscape::XML::Node *text = xml_doc->createTextNode("");
selected_repr->appendChild(text);
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- _("Create new text node"));
+ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
+ _("Create new text node"));
set_tree_select(text);
set_dt_select(text);
Inkscape::XML::Node *dup = selected_repr->duplicate(parent->document());
parent->addChild(dup, selected_repr);
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- _("Duplicate node"));
+ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
+ _("Duplicate node"));
GtkCTreeNode *node = sp_xmlview_tree_get_repr_node(SP_XMLVIEW_TREE(tree), dup);
g_assert(selected_repr != NULL);
sp_repr_unparent(selected_repr);
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- Q_("nodeAsInXMLinHistoryDialog|Delete node"));
+ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
+ Q_("nodeAsInXMLinHistoryDialog|Delete node"));
}
updated->updateRepr();
}
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- _("Delete attribute"));
+ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
+ _("Delete attribute"));
}
updated->updateRepr();
}
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- _("Change attribute"));
+ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
+ _("Change attribute"));
/* TODO: actually, the row won't have been created yet. why? */
gint row = sp_xmlview_attr_list_find_row_from_key(GTK_CLIST(attributes),
parent->changeOrder(selected_repr, ref);
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- _("Raise node"));
+ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
+ _("Raise node"));
set_tree_select(selected_repr);
set_dt_select(selected_repr);
parent->changeOrder(selected_repr, selected_repr->next());
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- _("Lower node"));
+ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
+ _("Lower node"));
set_tree_select(selected_repr);
set_dt_select(selected_repr);
parent->removeChild(repr);
prev->addChild(repr, ref);
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- _("Indent node"));
+ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
+ _("Indent node"));
set_tree_select(repr);
set_dt_select(repr);
parent->removeChild(repr);
grandparent->addChild(repr, parent);
- sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR,
- _("Unindent node"));
+ DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
+ _("Unindent node"));
set_tree_select(repr);
set_dt_select(repr);