From: Abhishek Sharma Public Date: Fri, 2 Jul 2010 12:35:42 +0000 (+0530) Subject: New Class SPDocumentUndo created which takes care of c++fying some non SPDocument... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5e1a030f60fc5f5753e30882711db9af56f763f5;p=inkscape.git New Class SPDocumentUndo created which takes care of c++fying some non SPDocument based methods --- diff --git a/src/arc-context.cpp b/src/arc-context.cpp index ab3389ec6..2f70e16f3 100644 --- a/src/arc-context.cpp +++ b/src/arc-context.cpp @@ -500,7 +500,7 @@ static void sp_arc_finish(SPArcContext *ac) sp_canvas_end_forced_full_redraws(desktop->canvas); sp_desktop_selection(desktop)->set(ac->item); - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ARC, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ARC, _("Create ellipse")); ac->item = NULL; @@ -526,7 +526,7 @@ static void sp_arc_cancel(SPArcContext *ac) sp_canvas_end_forced_full_redraws(desktop->canvas); - sp_document_cancel(sp_desktop_document(desktop)); + SPDocumentUndo::cancel(sp_desktop_document(desktop)); } diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp index 5534aa410..88763e183 100644 --- a/src/box3d-context.cpp +++ b/src/box3d-context.cpp @@ -436,42 +436,42 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven case GDK_bracketright: persp3d_rotate_VP (document->getCurrentPersp3D(), Proj::X, -180/snaps, MOD__ALT); - sp_document_done(document, SP_VERB_CONTEXT_3DBOX, + SPDocumentUndo::done(document, SP_VERB_CONTEXT_3DBOX, _("Change perspective (angle of PLs)")); ret = true; break; case GDK_bracketleft: persp3d_rotate_VP (document->getCurrentPersp3D(), Proj::X, 180/snaps, MOD__ALT); - sp_document_done(document, SP_VERB_CONTEXT_3DBOX, + SPDocumentUndo::done(document, SP_VERB_CONTEXT_3DBOX, _("Change perspective (angle of PLs)")); ret = true; break; case GDK_parenright: persp3d_rotate_VP (document->getCurrentPersp3D(), Proj::Y, -180/snaps, MOD__ALT); - sp_document_done(document, SP_VERB_CONTEXT_3DBOX, + SPDocumentUndo::done(document, SP_VERB_CONTEXT_3DBOX, _("Change perspective (angle of PLs)")); ret = true; break; case GDK_parenleft: persp3d_rotate_VP (document->getCurrentPersp3D(), Proj::Y, 180/snaps, MOD__ALT); - sp_document_done(document, SP_VERB_CONTEXT_3DBOX, + SPDocumentUndo::done(document, SP_VERB_CONTEXT_3DBOX, _("Change perspective (angle of PLs)")); ret = true; break; case GDK_braceright: persp3d_rotate_VP (document->getCurrentPersp3D(), Proj::Z, -180/snaps, MOD__ALT); - sp_document_done(document, SP_VERB_CONTEXT_3DBOX, + SPDocumentUndo::done(document, SP_VERB_CONTEXT_3DBOX, _("Change perspective (angle of PLs)")); ret = true; break; case GDK_braceleft: persp3d_rotate_VP (document->getCurrentPersp3D(), Proj::Z, 180/snaps, MOD__ALT); - sp_document_done(document, SP_VERB_CONTEXT_3DBOX, + SPDocumentUndo::done(document, SP_VERB_CONTEXT_3DBOX, _("Change perspective (angle of PLs)")); ret = true; break; @@ -667,7 +667,7 @@ static void sp_box3d_finish(Box3DContext *bc) sp_canvas_end_forced_full_redraws(desktop->canvas); sp_desktop_selection(desktop)->set(bc->item); - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_3DBOX, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_3DBOX, _("Create 3D box")); bc->item = NULL; diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp index 15cd97b28..70e0c3856 100644 --- a/src/conn-avoid-ref.cpp +++ b/src/conn-avoid-ref.cpp @@ -197,7 +197,7 @@ void SPAvoidRef::setConnectionPointsAttrUndoable(const gchar* value, const gchar sp_object_setAttribute( SP_OBJECT(item), "inkscape:connection-points", value, 0 ); item->updateRepr(); doc->ensure_up_to_date(); - sp_document_done(doc, SP_VERB_CONTEXT_CONNECTOR, action); + SPDocumentUndo::done(doc, SP_VERB_CONTEXT_CONNECTOR, action); } void SPAvoidRef::addConnectionPoint(ConnectionPoint &cp) @@ -589,8 +589,8 @@ void init_avoided_shape_geometry(SPDesktop *desktop) // Don't count this as changes to the document, // it is basically just late initialisation. SPDocument *document = sp_desktop_document(desktop); - bool saved = sp_document_get_undo_sensitive(document); - sp_document_set_undo_sensitive(document, false); + bool saved = SPDocumentUndo::get_undo_sensitive(document); + SPDocumentUndo::set_undo_sensitive(document, false); bool initialised = false; GSList *items = get_avoided_items(NULL, desktop->currentRoot(), desktop, @@ -604,7 +604,7 @@ void init_avoided_shape_geometry(SPDesktop *desktop) if (items) { g_slist_free(items); } - sp_document_set_undo_sensitive(document, saved); + SPDocumentUndo::set_undo_sensitive(document, saved); } diff --git a/src/connector-context.cpp b/src/connector-context.cpp index 90b16fddd..ff19c7749 100644 --- a/src/connector-context.cpp +++ b/src/connector-context.cpp @@ -1152,7 +1152,7 @@ connector_handle_key_press(SPConnectorContext *const cc, guint const keyval) cc_connector_rerouting_finish(cc, NULL); - sp_document_undo(doc); + SPDocumentUndo::undo(doc); cc->state = SP_CONNECTOR_CONTEXT_IDLE; desktop->messageStack()->flash( Inkscape::NORMAL_MESSAGE, @@ -1303,7 +1303,7 @@ cc_connector_rerouting_finish(SPConnectorContext *const cc, Geom::Point *const p cc->clickeditem->setHidden(false); sp_conn_reroute_path_immediate(SP_PATH(cc->clickeditem)); cc->clickeditem->updateRepr(); - sp_document_done(doc, SP_VERB_CONTEXT_CONNECTOR, + SPDocumentUndo::done(doc, SP_VERB_CONTEXT_CONNECTOR, _("Reroute connector")); cc_set_active_conn(cc, cc->clickeditem); } @@ -1477,7 +1477,7 @@ spcc_flush_white(SPConnectorContext *cc, SPCurve *gc) c->unref(); - sp_document_done(doc, SP_VERB_CONTEXT_CONNECTOR, _("Create connector")); + SPDocumentUndo::done(doc, SP_VERB_CONTEXT_CONNECTOR, _("Create connector")); } @@ -1935,7 +1935,7 @@ void cc_selection_set_avoid(bool const set_avoid) char *event_desc = (set_avoid) ? _("Make connectors avoid selected objects") : _("Make connectors ignore selected objects"); - sp_document_done(document, SP_VERB_CONTEXT_CONNECTOR, event_desc); + SPDocumentUndo::done(document, SP_VERB_CONTEXT_CONNECTOR, event_desc); } diff --git a/src/console-output-undo-observer.cpp b/src/console-output-undo-observer.cpp index 84d8af3a8..9369b5db5 100644 --- a/src/console-output-undo-observer.cpp +++ b/src/console-output-undo-observer.cpp @@ -1,6 +1,6 @@ /** * Inkscape::ConsoleOutputUndoObserver - observer for tracing calls to - * sp_document_undo, sp_document_redo, sp_document_maybe_done + * SPDocumentUndo::undo, SPDocumentUndo::redo, SPDocumentUndo::maybe_done * * Authors: * David Yip @@ -19,19 +19,19 @@ namespace Inkscape { void ConsoleOutputUndoObserver::notifyUndoEvent(Event* /*log*/) { - // g_message("notifyUndoEvent (sp_document_undo) called; log=%p\n", log->event); + // g_message("notifyUndoEvent (SPDocumentUndo::undo) called; log=%p\n", log->event); } void ConsoleOutputUndoObserver::notifyRedoEvent(Event* /*log*/) { - // g_message("notifyRedoEvent (sp_document_redo) called; log=%p\n", log->event); + // g_message("notifyRedoEvent (SPDocumentUndo::redo) called; log=%p\n", log->event); } void ConsoleOutputUndoObserver::notifyUndoCommitEvent(Event* /*log*/) { - //g_message("notifyUndoCommitEvent (sp_document_maybe_done) called; log=%p\n", log->event); + //g_message("notifyUndoCommitEvent (SPDocumentUndo::maybe_done) called; log=%p\n", log->event); } void diff --git a/src/console-output-undo-observer.h b/src/console-output-undo-observer.h index 9b42cf033..f8667d567 100644 --- a/src/console-output-undo-observer.h +++ b/src/console-output-undo-observer.h @@ -1,6 +1,6 @@ /** * Inkscape::ConsoleOutputUndoObserver - observer for tracing calls to - * sp_document_undo, sp_document_redo, sp_document_maybe_done + * SPDocumentUndo::undo, SPDocumentUndo::redo, SPDocumentUndo::maybe_done * * Authors: * David Yip diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp index 810f501d7..2046b9510 100644 --- a/src/desktop-events.cpp +++ b/src/desktop-events.cpp @@ -185,7 +185,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge sp_repr_set_point(repr, "position", from_2geom(event_dt)); SP_OBJECT_REPR(desktop->namedview)->appendChild(repr); Inkscape::GC::release(repr); - sp_document_done(sp_desktop_document(desktop), SP_VERB_NONE, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, _("Create guide")); } desktop->set_coordinate_status(from_2geom(event_dt)); @@ -398,14 +398,14 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) g_assert_not_reached(); break; } - sp_document_done(sp_desktop_document(desktop), SP_VERB_NONE, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, _("Move guide")); } else { /* Undo movement of any attached shapes. */ sp_guide_moveto(*guide, guide->point_on_line, false); sp_guide_set_normal(*guide, guide->normal_to_line, false); sp_guide_remove(guide); - sp_document_done(sp_desktop_document(desktop), SP_VERB_NONE, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, _("Delete guide")); } moved = false; @@ -452,7 +452,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) { SPDocument *doc = SP_OBJECT_DOCUMENT(guide); sp_guide_remove(guide); - sp_document_done(doc, SP_VERB_NONE, _("Delete guide")); + SPDocumentUndo::done(doc, SP_VERB_NONE, _("Delete guide")); ret = TRUE; sp_event_context_discard_delayed_snap_event(desktop->event_context); break; diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index 8dd59425a..b1c1cf74a 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -993,7 +993,7 @@ clonetiler_unclump( GtkWidget */*widget*/, void * ) g_slist_free (to_unclump); - sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_CLONETILER, + SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_DIALOG_CLONETILER, _("Unclump tiled clones")); } @@ -1046,7 +1046,7 @@ clonetiler_remove( GtkWidget */*widget*/, void *, bool do_undo = true ) clonetiler_change_selection (NULL, selection, dlg); if (do_undo) - sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_CLONETILER, + SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_DIALOG_CLONETILER, _("Delete tiled clones")); } @@ -1510,7 +1510,7 @@ clonetiler_apply( GtkWidget */*widget*/, void * ) desktop->clearWaitingCursor(); - sp_document_done(sp_desktop_document(desktop), SP_VERB_DIALOG_CLONETILER, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_CLONETILER, _("Create tiled clones")); } diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp index 6513813cc..649918742 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -1243,8 +1243,8 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) bool modified = false; const gchar * temp_string; - bool saved = sp_document_get_undo_sensitive(doc); - sp_document_set_undo_sensitive(doc, false); + bool saved = SPDocumentUndo::get_undo_sensitive(doc); + SPDocumentUndo::set_undo_sensitive(doc, false); temp_string = repr->attribute("inkscape:export-filename"); if (temp_string == NULL || strcmp(temp_string, filename_ext)) { @@ -1261,7 +1261,7 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) sp_repr_set_svg_double(repr, "inkscape:export-ydpi", ydpi); modified = true; } - sp_document_set_undo_sensitive(doc, saved); + SPDocumentUndo::set_undo_sensitive(doc, saved); if (modified) { doc->setModifiedSinceSave(); @@ -1273,8 +1273,8 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) SPDocument * doc = SP_ACTIVE_DOCUMENT; bool modified = false; - bool saved = sp_document_get_undo_sensitive(doc); - sp_document_set_undo_sensitive(doc, false); + bool saved = SPDocumentUndo::get_undo_sensitive(doc); + SPDocumentUndo::set_undo_sensitive(doc, false); reprlst = sp_desktop_selection(SP_ACTIVE_DESKTOP)->reprList(); for(; reprlst != NULL; reprlst = reprlst->next) { @@ -1302,7 +1302,7 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) modified = true; } } - sp_document_set_undo_sensitive(doc, saved); + SPDocumentUndo::set_undo_sensitive(doc, saved); if (modified) { doc->setModifiedSinceSave(); diff --git a/src/dialogs/item-properties.cpp b/src/dialogs/item-properties.cpp index abc45b44b..8d2b15e44 100644 --- a/src/dialogs/item-properties.cpp +++ b/src/dialogs/item-properties.cpp @@ -398,7 +398,7 @@ sp_item_widget_sensitivity_toggled (GtkWidget *widget, SPWidget *spw) 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)); @@ -417,7 +417,7 @@ sp_item_widget_hidden_toggled(GtkWidget *widget, SPWidget *spw) 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)); @@ -450,7 +450,7 @@ sp_item_widget_label_changed( GtkWidget */*widget*/, SPWidget *spw ) 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, + SPDocumentUndo::done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM, _("Set object ID")); } @@ -465,7 +465,7 @@ sp_item_widget_label_changed( GtkWidget */*widget*/, SPWidget *spw ) 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")); } @@ -473,7 +473,7 @@ sp_item_widget_label_changed( GtkWidget */*widget*/, SPWidget *spw ) 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 */ @@ -483,7 +483,7 @@ sp_item_widget_label_changed( GtkWidget */*widget*/, SPWidget *spw ) 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); diff --git a/src/dialogs/spellcheck.cpp b/src/dialogs/spellcheck.cpp index 24890f8eb..5372a8bb5 100644 --- a/src/dialogs/spellcheck.cpp +++ b/src/dialogs/spellcheck.cpp @@ -777,7 +777,7 @@ sp_spellcheck_accept (GObject *, GObject *dlg) // find the end of the word anew _end_w = _begin_w; _end_w.nextEndOfWord(); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_CONTEXT_TEXT, _("Fix spelling")); } } diff --git a/src/dialogs/text-edit.cpp b/src/dialogs/text-edit.cpp index dc71de7c3..ab0de514a 100644 --- a/src/dialogs/text-edit.cpp +++ b/src/dialogs/text-edit.cpp @@ -661,7 +661,7 @@ sp_text_edit_dialog_apply( GtkButton */*button*/, GtkWidget *dlg ) } // complete the transaction - sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, _("Set text style")); gtk_widget_set_sensitive (apply, FALSE); sp_repr_css_attr_unref (css); diff --git a/src/dialogs/xml-tree.cpp b/src/dialogs/xml-tree.cpp index c8644fef9..515b49360 100644 --- a/src/dialogs/xml-tree.cpp +++ b/src/dialogs/xml-tree.cpp @@ -870,10 +870,10 @@ void after_tree_move(GtkCTree */*tree*/, 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, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, _("Drag XML subtree")); } else { - sp_document_cancel(current_document); + SPDocumentUndo::cancel(current_document); } } @@ -1371,7 +1371,7 @@ void cmd_new_element_node(GtkObject */*object*/, gpointer /*data*/) set_tree_select(new_repr); set_dt_select(new_repr); - sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, _("Create new element node")); } @@ -1387,7 +1387,7 @@ void cmd_new_text_node(GtkObject */*object*/, gpointer /*data*/) Inkscape::XML::Node *text = xml_doc->createTextNode(""); selected_repr->appendChild(text); - sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, _("Create new text node")); set_tree_select(text); @@ -1405,7 +1405,7 @@ void cmd_duplicate_node(GtkObject */*object*/, gpointer /*data*/) Inkscape::XML::Node *dup = selected_repr->duplicate(parent->document()); parent->addChild(dup, selected_repr); - sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, _("Duplicate node")); GtkCTreeNode *node = sp_xmlview_tree_get_repr_node(SP_XMLVIEW_TREE(tree), dup); @@ -1422,7 +1422,7 @@ void cmd_delete_node(GtkObject */*object*/, gpointer /*data*/) g_assert(selected_repr != NULL); sp_repr_unparent(selected_repr); - sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, Q_("nodeAsInXMLinHistoryDialog|Delete node")); } @@ -1440,7 +1440,7 @@ void cmd_delete_attr(GtkObject */*object*/, gpointer /*data*/) updated->updateRepr(); } - sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, _("Delete attribute")); } @@ -1469,7 +1469,7 @@ void cmd_set_attr(GtkObject */*object*/, gpointer /*data*/) updated->updateRepr(); } - sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, _("Change attribute")); /* TODO: actually, the row won't have been created yet. why? */ @@ -1499,7 +1499,7 @@ void cmd_raise_node(GtkObject */*object*/, gpointer /*data*/) parent->changeOrder(selected_repr, ref); - sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, _("Raise node")); set_tree_select(selected_repr); @@ -1516,7 +1516,7 @@ void cmd_lower_node(GtkObject */*object*/, gpointer /*data*/) parent->changeOrder(selected_repr, selected_repr->next()); - sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, _("Lower node")); set_tree_select(selected_repr); @@ -1546,7 +1546,7 @@ void cmd_indent_node(GtkObject */*object*/, gpointer /*data*/) parent->removeChild(repr); prev->addChild(repr, ref); - sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, _("Indent node")); set_tree_select(repr); set_dt_select(repr); @@ -1567,7 +1567,7 @@ void cmd_unindent_node(GtkObject */*object*/, gpointer /*data*/) parent->removeChild(repr); grandparent->addChild(repr, parent); - sp_document_done(current_document, SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR, _("Unindent node")); set_tree_select(repr); set_dt_select(repr); diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index a79a6b610..7a21c19b8 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -255,7 +255,7 @@ CanvasGrid::writeNewGridToRepr(Inkscape::XML::Node * repr, SPDocument * doc, Gri repr->appendChild(newnode); Inkscape::GC::release(newnode); - sp_document_done(doc, SP_VERB_DIALOG_NAMEDVIEW, _("Create new grid")); + SPDocumentUndo::done(doc, SP_VERB_DIALOG_NAMEDVIEW, _("Create new grid")); } /* diff --git a/src/document-undo.cpp b/src/document-undo.cpp index ee15e480f..280eea243 100644 --- a/src/document-undo.cpp +++ b/src/document-undo.cpp @@ -63,6 +63,7 @@ #include "xml/repr.h" #include "document-private.h" #include "inkscape.h" +//#include "document-undo.h" #include "debug/event-tracker.h" #include "debug/simple-event.h" #include "debug/timestamp.h" @@ -85,7 +86,7 @@ sp_document_set_undo_sensitive(document, saved); \endverbatim */ void -sp_document_set_undo_sensitive (SPDocument *doc, bool sensitive) +SPDocumentUndo::set_undo_sensitive (SPDocument *doc, bool sensitive) { g_assert (doc != NULL); g_assert (doc->priv != NULL); @@ -112,7 +113,7 @@ sp_document_set_undo_sensitive (SPDocument *doc, bool sensitive) * the saved bools in a stack. Perhaps this is why the above solution is better. */ -bool sp_document_get_undo_sensitive(SPDocument const *document) { +bool SPDocumentUndo::get_undo_sensitive(SPDocument const *document) { g_assert(document != NULL); g_assert(document->priv != NULL); @@ -120,13 +121,13 @@ bool sp_document_get_undo_sensitive(SPDocument const *document) { } void -sp_document_done (SPDocument *doc, const unsigned int event_type, Glib::ustring event_description) +SPDocumentUndo::done (SPDocument *doc, const unsigned int event_type, Glib::ustring event_description) { - sp_document_maybe_done (doc, NULL, event_type, event_description); + maybe_done (doc, NULL, event_type, event_description); } void -sp_document_reset_key (Inkscape::Application */*inkscape*/, SPDesktop */*desktop*/, GtkObject *base) +SPDocumentUndo::reset_key (Inkscape::Application */*inkscape*/, SPDesktop */*desktop*/, GtkObject *base) { SPDocument *doc = (SPDocument *) base; doc->actionkey = NULL; @@ -165,7 +166,7 @@ public: } void -sp_document_maybe_done (SPDocument *doc, const gchar *key, const unsigned int event_type, +SPDocumentUndo::maybe_done (SPDocument *doc, const gchar *key, const unsigned int event_type, Glib::ustring event_description) { g_assert (doc != NULL); @@ -178,7 +179,7 @@ sp_document_maybe_done (SPDocument *doc, const gchar *key, const unsigned int ev doc->ensure_up_to_date (); - sp_document_clear_redo (doc); + SPDocumentUndo::clear_redo (doc); Inkscape::XML::Event *log = sp_repr_coalesce_log (doc->priv->partial, sp_repr_commit_undoable (doc->rdoc)); doc->priv->partial = NULL; @@ -209,7 +210,7 @@ sp_document_maybe_done (SPDocument *doc, const gchar *key, const unsigned int ev } void -sp_document_cancel (SPDocument *doc) +SPDocumentUndo::cancel (SPDocument *doc) { g_assert (doc != NULL); g_assert (doc->priv != NULL); @@ -241,7 +242,7 @@ static void finish_incomplete_transaction(SPDocument &doc) { } gboolean -sp_document_undo (SPDocument *doc) +SPDocumentUndo::undo (SPDocument *doc) { using Inkscape::Debug::EventTracker; using Inkscape::Debug::SimpleEvent; @@ -287,7 +288,7 @@ sp_document_undo (SPDocument *doc) } gboolean -sp_document_redo (SPDocument *doc) +SPDocumentUndo::redo (SPDocument *doc) { using Inkscape::Debug::EventTracker; using Inkscape::Debug::SimpleEvent; @@ -333,7 +334,7 @@ sp_document_redo (SPDocument *doc) } void -sp_document_clear_undo (SPDocument *doc) +SPDocumentUndo::clear_undo (SPDocument *doc) { if (doc->priv->undo) doc->priv->undoStackObservers.notifyClearUndoEvent(); @@ -351,7 +352,7 @@ sp_document_clear_undo (SPDocument *doc) } void -sp_document_clear_redo (SPDocument *doc) +SPDocumentUndo::clear_redo (SPDocument *doc) { if (doc->priv->redo) doc->priv->undoStackObservers.notifyClearRedoEvent(); diff --git a/src/document.cpp b/src/document.cpp index 147c22b3c..e68bc1f94 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -150,8 +150,8 @@ SPDocument::~SPDocument() { priv->partial = NULL; } - sp_document_clear_redo(this); - sp_document_clear_undo(this); + SPDocumentUndo::clear_redo(this); + SPDocumentUndo::clear_undo(this); if (root) { root->releaseReferences(); @@ -200,7 +200,7 @@ SPDocument::~SPDocument() { if (oldSignalsConnected) { g_signal_handlers_disconnect_by_func(G_OBJECT(INKSCAPE), - reinterpret_cast(sp_document_reset_key), + reinterpret_cast(SPDocumentUndo::reset_key), static_cast(this)); } else { _selection_changed_connection.disconnect(); @@ -416,14 +416,14 @@ SPDocument::createDoc(Inkscape::XML::Document *rdoc, document->setCurrentPersp3DImpl(persp_impl); } - sp_document_set_undo_sensitive(document, true); + SPDocumentUndo::set_undo_sensitive(document, true); // reset undo key when selection changes, so that same-key actions on different objects are not coalesced if (!Inkscape::NSApplication::Application::getNewGui()) { g_signal_connect(G_OBJECT(INKSCAPE), "change_selection", - G_CALLBACK(sp_document_reset_key), document); + G_CALLBACK(SPDocumentUndo::reset_key), document); g_signal_connect(G_OBJECT(INKSCAPE), "activate_desktop", - G_CALLBACK(sp_document_reset_key), document); + G_CALLBACK(SPDocumentUndo::reset_key), document); document->oldSignalsConnected = true; } else { document->_selection_changed_connection = Inkscape::NSApplication::Editor::connectSelectionChanged (sigc::mem_fun (*document, &SPDocument::reset_key)); @@ -717,10 +717,10 @@ void SPDocument::fitToRect(Geom::Rect const &rect, bool with_margins) } } -static void -do_change_uri(SPDocument *const document, gchar const *const filename, bool const rebase) +void +SPDocument::do_change_uri(gchar const *const filename, bool const rebase) { - g_return_if_fail(document != NULL); + //g_return_if_fail(this != NULL); gchar *new_base; gchar *new_name; @@ -739,32 +739,32 @@ do_change_uri(SPDocument *const document, gchar const *const filename, bool cons } else { new_uri = g_strdup_printf(_("Unnamed document %d"), ++doc_count); new_base = NULL; - new_name = g_strdup(document->uri); + new_name = g_strdup(this->uri); } // Update saveable repr attributes. - Inkscape::XML::Node *repr = sp_document_repr_root(document); + Inkscape::XML::Node *repr = sp_document_repr_root(this); // Changing uri in the document repr must not be not undoable. - bool const saved = sp_document_get_undo_sensitive(document); - sp_document_set_undo_sensitive(document, false); + bool const saved = SPDocumentUndo::get_undo_sensitive(this); + SPDocumentUndo::set_undo_sensitive(this, false); if (rebase) { - Inkscape::XML::rebase_hrefs(document, new_base, true); + Inkscape::XML::rebase_hrefs(this, new_base, true); } - repr->setAttribute("sodipodi:docname", document->name); - sp_document_set_undo_sensitive(document, saved); + repr->setAttribute("sodipodi:docname", this->name); + SPDocumentUndo::set_undo_sensitive(this, saved); - g_free(document->name); - g_free(document->base); - g_free(document->uri); - document->name = new_name; - document->base = new_base; - document->uri = new_uri; + g_free(this->name); + g_free(this->base); + g_free(this->uri); + this->name = new_name; + this->base = new_base; + this->uri = new_uri; - document->priv->uri_set_signal.emit(document->uri); + this->priv->uri_set_signal.emit(this->uri); } /** @@ -776,9 +776,9 @@ do_change_uri(SPDocument *const document, gchar const *const filename, bool cons */ void SPDocument::setUri(gchar const *filename) { - g_return_if_fail(this != NULL); + //g_return_if_fail(this != NULL); - do_change_uri(this, filename, false); + do_change_uri(filename, false); } /** @@ -789,15 +789,15 @@ void SPDocument::setUri(gchar const *filename) */ void SPDocument::change_uri_and_hrefs(gchar const *filename) { - g_return_if_fail(this != NULL); + //g_return_if_fail(this != NULL); - do_change_uri(this, filename, true); + do_change_uri(filename, true); } void SPDocument::resized_signal_emit(gdouble width, gdouble height) { - g_return_if_fail(this != NULL); + //g_return_if_fail(this != NULL); this->priv->resized_signal.emit(width, height); } @@ -1005,12 +1005,12 @@ SPDocument::_updateDocument() SPItemCtx ctx; sp_document_setup_viewport (this, &ctx); - bool saved = sp_document_get_undo_sensitive(this); - sp_document_set_undo_sensitive(this, false); + bool saved = SPDocumentUndo::get_undo_sensitive(this); + SPDocumentUndo::set_undo_sensitive(this, false); this->root->updateDisplay((SPCtx *)&ctx, 0); - sp_document_set_undo_sensitive(this, saved); + SPDocumentUndo::set_undo_sensitive(this, saved); } this->_emitModified(); } @@ -1271,7 +1271,7 @@ find_group_at_point(unsigned int dkey, SPGroup *group, Geom::Point const p) GSList *SPDocument::items_in_box(unsigned int dkey, Geom::Rect const &box) { - g_return_val_if_fail(this != NULL, NULL); + //g_return_val_if_fail(this != NULL, NULL); g_return_val_if_fail(this->priv != NULL, NULL); return find_items_in_area(NULL, SP_GROUP(this->root), dkey, box, is_within); @@ -1286,7 +1286,7 @@ GSList *SPDocument::items_in_box(unsigned int dkey, Geom::Rect const &box) GSList *SPDocument::partial_items_in_box(unsigned int dkey, Geom::Rect const &box) { - g_return_val_if_fail(this != NULL, NULL); + //g_return_val_if_fail(this != NULL, NULL); g_return_val_if_fail(this->priv != NULL, NULL); return find_items_in_area(NULL, SP_GROUP(this->root), dkey, box, overlaps); @@ -1321,7 +1321,7 @@ SPItem * SPDocument::item_at_point( unsigned const key, Geom::Point const p, gboolean const into_groups, SPItem *upto) { - g_return_val_if_fail(this != NULL, NULL); + //g_return_val_if_fail(this != NULL, NULL); g_return_val_if_fail(this->priv != NULL, NULL); return find_item_at_point(key, SP_GROUP(this->root), p, into_groups, false, upto); @@ -1330,7 +1330,7 @@ SPDocument::item_at_point( unsigned const key, Geom::Point const p, SPItem* SPDocument::group_at_point(unsigned int key, Geom::Point const p) { - g_return_val_if_fail(this != NULL, NULL); + //g_return_val_if_fail(this != NULL, NULL); g_return_val_if_fail(this->priv != NULL, NULL); return find_group_at_point(key, SP_GROUP(this->root), p); @@ -1345,7 +1345,7 @@ SPDocument::add_resource(gchar const *key, SPObject *object) GSList *rlist; GQuark q = g_quark_from_string(key); - g_return_val_if_fail(this != NULL, FALSE); + //g_return_val_if_fail(this != NULL, FALSE); g_return_val_if_fail(key != NULL, FALSE); g_return_val_if_fail(*key != '\0', FALSE); g_return_val_if_fail(object != NULL, FALSE); @@ -1370,7 +1370,7 @@ SPDocument::remove_resource(gchar const *key, SPObject *object) GSList *rlist; GQuark q = g_quark_from_string(key); - g_return_val_if_fail(this != NULL, FALSE); + //g_return_val_if_fail(this != NULL, FALSE); g_return_val_if_fail(key != NULL, FALSE); g_return_val_if_fail(*key != '\0', FALSE); g_return_val_if_fail(object != NULL, FALSE); @@ -1393,7 +1393,7 @@ SPDocument::remove_resource(gchar const *key, SPObject *object) GSList const * SPDocument::get_resource_list(gchar const *key) { - g_return_val_if_fail(this != NULL, NULL); + //g_return_val_if_fail(this != NULL, NULL); g_return_val_if_fail(key != NULL, NULL); g_return_val_if_fail(*key != '\0', NULL); diff --git a/src/document.h b/src/document.h index 3fa83c779..38f930c31 100644 --- a/src/document.h +++ b/src/document.h @@ -28,6 +28,7 @@ #include "gc-anchored.h" #include #include "verbs.h" +#include "document-undo.h" #include #include @@ -213,6 +214,9 @@ public: void resized_signal_emit(gdouble width, gdouble height); unsigned int vacuum_document(); + + private: + void do_change_uri(gchar const *const filename, bool const rebase); }; //SPDocument *sp_document_new(const gchar *uri, unsigned int keepalive, bool make_new = false); @@ -254,11 +258,11 @@ struct SPUnit; * Undo & redo */ -void sp_document_set_undo_sensitive(SPDocument *document, bool sensitive); -bool sp_document_get_undo_sensitive(SPDocument const *document); +//void sp_document_set_undo_sensitive(SPDocument *document, bool sensitive); +//bool sp_document_get_undo_sensitive(SPDocument const *document); -void sp_document_clear_undo(SPDocument *document); -void sp_document_clear_redo(SPDocument *document); +//void sp_document_clear_undo(SPDocument *document); +//void sp_document_clear_redo(SPDocument *document); //void sp_document_child_added(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); //void sp_document_child_removed(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); @@ -271,16 +275,16 @@ void sp_document_clear_redo(SPDocument *document); //gint sp_document_ensure_up_to_date(SPDocument *doc); /* Save all previous actions to stack, as one undo step */ -void sp_document_done(SPDocument *document, unsigned int event_type, Glib::ustring event_description); -void sp_document_maybe_done(SPDocument *document, const gchar *keyconst, unsigned int event_type, Glib::ustring event_description); -void sp_document_reset_key(Inkscape::Application *inkscape, SPDesktop *desktop, GtkObject *base); +//void sp_document_done(SPDocument *document, unsigned int event_type, Glib::ustring event_description); +//void sp_document_maybe_done(SPDocument *document, const gchar *keyconst, unsigned int event_type, Glib::ustring event_description); +//void sp_document_reset_key(Inkscape::Application *inkscape, SPDesktop *desktop, GtkObject *base); /* Cancel (and revert) current unsaved actions */ -void sp_document_cancel(SPDocument *document); +//void sp_document_cancel(SPDocument *document); /* Undo and redo */ -gboolean sp_document_undo(SPDocument *document); -gboolean sp_document_redo(SPDocument *document); +//gboolean sp_document_undo(SPDocument *document); +//gboolean sp_document_redo(SPDocument *document); /* Resource management */ //gboolean sp_document_add_resource(SPDocument *document, const gchar *key, SPObject *object); diff --git a/src/draw-context.cpp b/src/draw-context.cpp index ea25efc22..a3c3601cc 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -698,7 +698,7 @@ spdc_flush_white(SPDrawContext *dc, SPCurve *gc) item->updateRepr(); } - sp_document_done(doc, SP_IS_PEN_CONTEXT(dc)? SP_VERB_CONTEXT_PEN : SP_VERB_CONTEXT_PENCIL, + SPDocumentUndo::done(doc, SP_IS_PEN_CONTEXT(dc)? SP_VERB_CONTEXT_PEN : SP_VERB_CONTEXT_PENCIL, _("Draw path")); // When quickly drawing several subpaths with Shift, the next subpath may be finished and @@ -861,7 +861,7 @@ void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char cons sp_desktop_selection(desktop)->set(item); desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Creating single dot")); - sp_document_done(sp_desktop_document(desktop), SP_VERB_NONE, _("Create single dot")); + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, _("Create single dot")); } /* diff --git a/src/dropper-context.cpp b/src/dropper-context.cpp index 5415fdc80..513963692 100644 --- a/src/dropper-context.cpp +++ b/src/dropper-context.cpp @@ -350,7 +350,7 @@ static gint sp_dropper_context_root_handler(SPEventContext *event_context, GdkEv if (!(sp_desktop_selection(desktop)->isEmpty())) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_DROPPER, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_DROPPER, _("Set picked color")); } diff --git a/src/dyna-draw-context.cpp b/src/dyna-draw-context.cpp index 4d8ab2c11..ab57872cd 100644 --- a/src/dyna-draw-context.cpp +++ b/src/dyna-draw-context.cpp @@ -1040,7 +1040,7 @@ set_to_accumulated(SPDynaDrawContext *dc, bool unionize, bool subtract) dc->repr = NULL; } - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_CALLIGRAPHIC, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_CALLIGRAPHIC, _("Draw calligraphic stroke")); } diff --git a/src/eraser-context.cpp b/src/eraser-context.cpp index db1aa46d9..fdb0813ce 100644 --- a/src/eraser-context.cpp +++ b/src/eraser-context.cpp @@ -826,10 +826,10 @@ set_to_accumulated(SPEraserContext *dc) if ( workDone ) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ERASER, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ERASER, _("Draw eraser stroke")); } else { - sp_document_cancel(sp_desktop_document(desktop)); + SPDocumentUndo::cancel(sp_desktop_document(desktop)); } } diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp index afc0668a9..79bd96a7e 100644 --- a/src/extension/effect.cpp +++ b/src/extension/effect.cpp @@ -258,7 +258,7 @@ Effect::prefs (Inkscape::UI::View::View * doc) This function first insures that the extension is loaded, and if not, loads it. It then calls the implemention to do the actual work. It also resets the last effect pointer to be this effect. Finally, it - executes a \c sp_document_done to commit the changes to the undo + executes a \c SPDocumentUndo::done to commit the changes to the undo stack. */ void diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index 7ed389195..d97c8c6de 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -162,14 +162,14 @@ ExecutionEnv::cancel (void) { void ExecutionEnv::undo (void) { - sp_document_cancel(_doc->doc()); + SPDocumentUndo::cancel(_doc->doc()); reselect(); return; } void ExecutionEnv::commit (void) { - sp_document_done(_doc->doc(), SP_VERB_NONE, _(_effect->get_name())); + SPDocumentUndo::done(_doc->doc(), SP_VERB_NONE, _(_effect->get_name())); Effect::set_last_effect(_effect); _effect->get_imp()->commitDocument(); killDocCache(); diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index 4983d7eff..69fdbcfd1 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -55,8 +55,8 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) } doc = SPDocument::createNewDoc(NULL, TRUE, TRUE); - bool saved = sp_document_get_undo_sensitive(doc); - sp_document_set_undo_sensitive(doc, false); // no need to undo in this temporary document + bool saved = SPDocumentUndo::get_undo_sensitive(doc); + SPDocumentUndo::set_undo_sensitive(doc, false); // no need to undo in this temporary document double width = gdk_pixbuf_get_width(pb); double height = gdk_pixbuf_get_height(pb); @@ -103,7 +103,7 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) Inkscape::GC::release(image_node); fit_canvas_to_drawing(doc); // restore undo, as now this document may be shown to the user if a bitmap was opened - sp_document_set_undo_sensitive(doc, saved); + SPDocumentUndo::set_undo_sensitive(doc, saved); } else { printf("GdkPixbuf loader failed\n"); } diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index 9826addb6..b50711803 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -662,8 +662,8 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { Page *page = catalog->getPage(page_num); SPDocument *doc = SPDocument::createNewDoc(NULL, TRUE, TRUE); - bool saved = sp_document_get_undo_sensitive(doc); - sp_document_set_undo_sensitive(doc, false); // No need to undo in this temporary document + bool saved = SPDocumentUndo::get_undo_sensitive(doc); + SPDocumentUndo::set_undo_sensitive(doc, false); // No need to undo in this temporary document // Create builder gchar *docname = g_path_get_basename(uri); @@ -737,7 +737,7 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { delete dlg; // Restore undo - sp_document_set_undo_sensitive(doc, saved); + SPDocumentUndo::set_undo_sensitive(doc, saved); return doc; } diff --git a/src/extension/system.cpp b/src/extension/system.cpp index 67720235d..8cfc58797 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -274,8 +274,8 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, // Update attributes: { - bool const saved = sp_document_get_undo_sensitive(doc); - sp_document_set_undo_sensitive(doc, false); + bool const saved = SPDocumentUndo::get_undo_sensitive(doc); + SPDocumentUndo::set_undo_sensitive(doc, false); { // also save the extension for next use store_file_extension_in_prefs (omod->get_id(), save_method); @@ -285,7 +285,7 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, repr->setAttribute("inkscape:dataloss", "true"); } } - sp_document_set_undo_sensitive(doc, saved); + SPDocumentUndo::set_undo_sensitive(doc, saved); doc->setModifiedSinceSave(false); } @@ -295,13 +295,13 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, catch(...) { // revert attributes in case of official and overwrite if(check_overwrite && official) { - bool const saved = sp_document_get_undo_sensitive(doc); - sp_document_set_undo_sensitive(doc, false); + bool const saved = SPDocumentUndo::get_undo_sensitive(doc); + SPDocumentUndo::set_undo_sensitive(doc, false); { store_file_extension_in_prefs (saved_output_extension, save_method); repr->setAttribute("inkscape:dataloss", saved_dataloss); } - sp_document_set_undo_sensitive(doc, saved); + SPDocumentUndo::set_undo_sensitive(doc, saved); doc->change_uri_and_hrefs(saved_uri); } doc->setModifiedSinceSave(saved_modified); @@ -317,13 +317,13 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, // If it is an unofficial save, set the modified attributes back to what they were. if ( !official) { - bool const saved = sp_document_get_undo_sensitive(doc); - sp_document_set_undo_sensitive(doc, false); + bool const saved = SPDocumentUndo::get_undo_sensitive(doc); + SPDocumentUndo::set_undo_sensitive(doc, false); { store_file_extension_in_prefs (saved_output_extension, save_method); repr->setAttribute("inkscape:dataloss", saved_dataloss); } - sp_document_set_undo_sensitive(doc, saved); + SPDocumentUndo::set_undo_sensitive(doc, saved); doc->setModifiedSinceSave(saved_modified); g_free(saved_output_extension); diff --git a/src/file.cpp b/src/file.cpp index 6b162c799..2344c67f2 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -560,7 +560,7 @@ sp_file_vacuum() unsigned int diff = doc->vacuum_document (); - sp_document_done(doc, SP_VERB_FILE_VACUUM, + SPDocumentUndo::done(doc, SP_VERB_FILE_VACUUM, _("Vacuum <defs>")); SPDesktop *dt = SP_ACTIVE_DESKTOP; @@ -1064,7 +1064,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, } doc->doUnref(); - sp_document_done(in_doc, SP_VERB_FILE_IMPORT, + SPDocumentUndo::done(in_doc, SP_VERB_FILE_IMPORT, _("Import")); } else { diff --git a/src/flood-context.cpp b/src/flood-context.cpp index 019cbbb02..696efd3e3 100644 --- a/src/flood-context.cpp +++ b/src/flood-context.cpp @@ -1119,7 +1119,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even g_free(trace_px); - sp_document_done(document, SP_VERB_CONTEXT_PAINTBUCKET, _("Fill bounded area")); + SPDocumentUndo::done(document, SP_VERB_CONTEXT_PAINTBUCKET, _("Fill bounded area")); } static gint sp_flood_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event) @@ -1139,7 +1139,7 @@ static gint sp_flood_context_item_handler(SPEventContext *event_context, SPItem Inkscape::XML::Node *pathRepr = SP_OBJECT_REPR(item); /* Set style */ sp_desktop_apply_style_tool (desktop, pathRepr, "/tools/paintbucket", false); - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_PAINTBUCKET, _("Set style on object")); + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_PAINTBUCKET, _("Set style on object")); ret = TRUE; } break; @@ -1278,7 +1278,7 @@ static void sp_flood_finish(SPFloodContext *rc) sp_canvas_end_forced_full_redraws(desktop->canvas); sp_desktop_selection(desktop)->set(rc->item); - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_PAINTBUCKET, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_PAINTBUCKET, _("Fill bounded area")); rc->item = NULL; diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp index 6d6ea8761..2e6544b63 100644 --- a/src/gradient-context.cpp +++ b/src/gradient-context.cpp @@ -386,7 +386,7 @@ sp_gradient_context_add_stops_between_selected_stops (SPGradientContext *rc) } if (g_slist_length(these_stops) > 0 && doc) { - sp_document_done (doc, SP_VERB_CONTEXT_GRADIENT, _("Add gradient stop")); + SPDocumentUndo::done (doc, SP_VERB_CONTEXT_GRADIENT, _("Add gradient stop")); drag->updateDraggers(); // so that it does not automatically update draggers in idle loop, as this would deselect drag->local_change = true; @@ -454,7 +454,7 @@ sp_gradient_simplify(SPGradientContext *rc, double tolerance) } if (g_slist_length(todel) > 0) { - sp_document_done (doc, SP_VERB_CONTEXT_GRADIENT, _("Simplify gradient")); + SPDocumentUndo::done (doc, SP_VERB_CONTEXT_GRADIENT, _("Simplify gradient")); drag->local_change = true; drag->updateDraggers(); drag->selectByCoords(coords); @@ -478,7 +478,7 @@ sp_gradient_context_add_stop_near_point (SPGradientContext *rc, SPItem *item, G ec->get_drag()->addStopNearPoint (item, mouse_p, tolerance/desktop->current_zoom()); - sp_document_done (sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT, + SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT, _("Add gradient stop")); ec->get_drag()->updateDraggers(); @@ -530,7 +530,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event) sp_gradient_reset_to_userspace(priv, item); } - sp_document_done (sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT, + SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT, _("Create default gradient")); } ret = TRUE; @@ -812,7 +812,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event) } } // we did an undoable action - sp_document_done (sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT, + SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT, _("Invert gradient")); ret = TRUE; } @@ -924,7 +924,7 @@ static void sp_gradient_drag(SPGradientContext &rc, Geom::Point const pt, guint -1, // ignore number (though it is always 1) fill_or_stroke, 99999, 99999, etime); } - // We did an undoable action, but sp_document_done will be called by the knot when released + // We did an undoable action, but SPDocumentUndo::done will be called by the knot when released // status text; we do not track coords because this branch is run once, not all the time // during drag diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index 6306278c5..5fb490b8b 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -588,7 +588,7 @@ gr_knot_moved_handler(SPKnot *knot, Geom::Point const &ppointer, guint state, gp d_new->updateKnotShape (); d_new->updateTip (); d_new->updateDependencies(true); - sp_document_done (sp_desktop_document (d_new->parent->desktop), SP_VERB_CONTEXT_GRADIENT, + SPDocumentUndo::done (sp_desktop_document (d_new->parent->desktop), SP_VERB_CONTEXT_GRADIENT, _("Merge gradient handles")); return; } @@ -887,7 +887,7 @@ gr_knot_ungrabbed_handler (SPKnot *knot, unsigned int state, gpointer data) dragger->updateDependencies(true); // we did an undoable action - sp_document_done (sp_desktop_document (dragger->parent->desktop), SP_VERB_CONTEXT_GRADIENT, + SPDocumentUndo::done (sp_desktop_document (dragger->parent->desktop), SP_VERB_CONTEXT_GRADIENT, _("Move gradient handle")); } @@ -940,7 +940,7 @@ gr_knot_clicked_handler(SPKnot */*knot*/, guint state, gpointer data) } SP_OBJECT_REPR(gradient)->removeChild(SP_OBJECT_REPR(stop)); - sp_document_done (SP_OBJECT_DOCUMENT (gradient), SP_VERB_CONTEXT_GRADIENT, + SPDocumentUndo::done (SP_OBJECT_DOCUMENT (gradient), SP_VERB_CONTEXT_GRADIENT, _("Delete gradient stop")); } } else { @@ -1817,7 +1817,7 @@ GrDrag::selected_move (double x, double y, bool write_repr, bool scale_radial) if (write_repr && did) { // we did an undoable action - sp_document_maybe_done (sp_desktop_document (desktop), "grmoveh", SP_VERB_CONTEXT_GRADIENT, + SPDocumentUndo::maybe_done (sp_desktop_document (desktop), "grmoveh", SP_VERB_CONTEXT_GRADIENT, _("Move gradient handle(s)")); return; } @@ -1853,7 +1853,7 @@ GrDrag::selected_move (double x, double y, bool write_repr, bool scale_radial) if (write_repr && did) { // we did an undoable action - sp_document_maybe_done (sp_desktop_document (desktop), "grmovem", SP_VERB_CONTEXT_GRADIENT, + SPDocumentUndo::maybe_done (sp_desktop_document (desktop), "grmovem", SP_VERB_CONTEXT_GRADIENT, _("Move gradient mid stop(s)")); } } @@ -2142,7 +2142,7 @@ GrDrag::deleteSelected (bool just_one) } if (document) { - sp_document_done ( document, SP_VERB_CONTEXT_GRADIENT, _("Delete gradient stop(s)") ); + SPDocumentUndo::done ( document, SP_VERB_CONTEXT_GRADIENT, _("Delete gradient stop(s)") ); } } diff --git a/src/interface.cpp b/src/interface.cpp index bdec99291..a535ed1bd 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -1249,7 +1249,7 @@ sp_ui_drag_data_received(GtkWidget *widget, sp_desktop_apply_css_recursive( item, css, true ); item->updateRepr(); - sp_document_done( doc , SP_VERB_NONE, + SPDocumentUndo::done( doc , SP_VERB_NONE, _("Drop color")); if ( srgbProf ) { @@ -1289,7 +1289,7 @@ sp_ui_drag_data_received(GtkWidget *widget, if (desktop->event_context && desktop->event_context->get_drag()) { consumed = desktop->event_context->get_drag()->dropColor(item, colorspec, button_dt); if (consumed) { - sp_document_done( doc , SP_VERB_NONE, _("Drop color on gradient")); + SPDocumentUndo::done( doc , SP_VERB_NONE, _("Drop color on gradient")); desktop->event_context->get_drag()->updateDraggers(); } } @@ -1297,7 +1297,7 @@ sp_ui_drag_data_received(GtkWidget *widget, //if (!consumed && tools_active(desktop, TOOLS_TEXT)) { // consumed = sp_text_context_drop_color(c, button_doc); // if (consumed) { - // sp_document_done( doc , SP_VERB_NONE, _("Drop color on gradient stop")); + // SPDocumentUndo::done( doc , SP_VERB_NONE, _("Drop color on gradient stop")); // } //} @@ -1335,7 +1335,7 @@ sp_ui_drag_data_received(GtkWidget *widget, sp_desktop_apply_css_recursive( item, css, true ); item->updateRepr(); - sp_document_done( doc , SP_VERB_NONE, + SPDocumentUndo::done( doc , SP_VERB_NONE, _("Drop color")); } } @@ -1399,7 +1399,7 @@ sp_ui_drag_data_received(GtkWidget *widget, if (desktop->event_context && desktop->event_context->get_drag()) { consumed = desktop->event_context->get_drag()->dropColor(item, colorspec.c_str(), button_dt); if (consumed) { - sp_document_done( doc , SP_VERB_NONE, _("Drop color on gradient")); + SPDocumentUndo::done( doc , SP_VERB_NONE, _("Drop color on gradient")); desktop->event_context->get_drag()->updateDraggers(); } } @@ -1438,7 +1438,7 @@ sp_ui_drag_data_received(GtkWidget *widget, sp_desktop_apply_css_recursive( item, css, true ); item->updateRepr(); - sp_document_done( doc , SP_VERB_NONE, + SPDocumentUndo::done( doc , SP_VERB_NONE, _("Drop color")); } } @@ -1490,7 +1490,7 @@ sp_ui_drag_data_received(GtkWidget *widget, } Inkscape::GC::release(newgroup); - sp_document_done(doc, SP_VERB_NONE, + SPDocumentUndo::done(doc, SP_VERB_NONE, _("Drop SVG")); break; } @@ -1524,7 +1524,7 @@ sp_ui_drag_data_received(GtkWidget *widget, ext->set_param_optiongroup("link", save ? "embed" : "link"); ext->set_gui(true); - sp_document_done( doc , SP_VERB_NONE, + SPDocumentUndo::done( doc , SP_VERB_NONE, _("Drop bitmap image")); break; } diff --git a/src/knot.cpp b/src/knot.cpp index 10672e048..95a9ec148 100644 --- a/src/knot.cpp +++ b/src/knot.cpp @@ -427,7 +427,7 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot g_signal_emit(knot, knot_signals[UNGRABBED], 0, event->button.state); - sp_document_undo(sp_desktop_document(knot->desktop)); + SPDocumentUndo::undo(sp_desktop_document(knot->desktop)); knot->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Node or handle drag canceled.")); transform_escaped = true; consumed = TRUE; diff --git a/src/knotholder.cpp b/src/knotholder.cpp index af11d5acb..89f57da97 100644 --- a/src/knotholder.cpp +++ b/src/knotholder.cpp @@ -146,7 +146,7 @@ KnotHolder::knot_clicked_handler(SPKnot *knot, guint state) } // for drag, this is done by ungrabbed_handler, but for click we must do it here - sp_document_done(SP_OBJECT_DOCUMENT(item), object_verb, + SPDocumentUndo::done(SP_OBJECT_DOCUMENT(item), object_verb, _("Change handle")); } @@ -225,7 +225,7 @@ KnotHolder::knot_ungrabbed_handler(SPKnot */*knot*/) object_verb = SP_VERB_SELECTION_DYNAMIC_OFFSET; } - sp_document_done(SP_OBJECT_DOCUMENT (object), object_verb, + SPDocumentUndo::done(SP_OBJECT_DOCUMENT (object), object_verb, _("Move handle")); } } diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index b8e9b8cf9..a2476a098 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -636,7 +636,7 @@ KnotHolderEntityCrossingSwitcher::knot_click(guint state) //std::cout<<"crossing set to"<crossing_points[s].sign<<".\n"; } lpe->crossing_points_vector.param_set_and_write_new_value(lpe->crossing_points.to_vector()); - sp_document_done(lpe->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, /// @todo Is this the right verb? + SPDocumentUndo::done(lpe->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, /// @todo Is this the right verb? _("Change knot crossing")); // FIXME: this should not directly ask for updating the item. It should write to SVG, which triggers updating. diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index e662f7d95..af4f84f59 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -414,7 +414,7 @@ PathParam::on_paste_button_click() Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get(); Glib::ustring svgd = cm->getPathParameter(SP_ACTIVE_DESKTOP); paste_param_path(svgd.data()); - sp_document_done(param_effect->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, + SPDocumentUndo::done(param_effect->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Paste path parameter")); } @@ -446,7 +446,7 @@ PathParam::on_link_button_click() // check if linking to object to which LPE is applied (maybe delegated to PathReference param_write_to_repr(pathid.c_str()); - sp_document_done(param_effect->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, + SPDocumentUndo::done(param_effect->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Link path parameter to path")); } } diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index c44ab5bc6..daa9ae595 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -162,7 +162,7 @@ sp_selected_path_combine(SPDesktop *desktop) // move to the position of the topmost, reduced by the number of deleted items repr->setPosition(position > 0 ? position : 0); - sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_COMBINE, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_COMBINE, _("Combine")); selection->set(repr); @@ -272,7 +272,7 @@ sp_selected_path_break_apart(SPDesktop *desktop) desktop->clearWaitingCursor(); if (did) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_BREAK_APART, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_BREAK_APART, _("Break apart")); } else { sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("No path(s) to break apart in the selection.")); @@ -314,7 +314,7 @@ sp_selected_path_to_curves(SPDesktop *desktop, bool interactive) if (interactive) { desktop->clearWaitingCursor(); if (did) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_OBJECT_TO_CURVE, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_OBJECT_TO_CURVE, _("Object to path")); } else { sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("No objects to convert to path in the selection.")); @@ -627,7 +627,7 @@ sp_selected_path_reverse(SPDesktop *desktop) desktop->clearWaitingCursor(); if (did) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_REVERSE, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_REVERSE, _("Reverse path")); } else { sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("No paths to reverse in the selection.")); diff --git a/src/persp3d.cpp b/src/persp3d.cpp index d9839c556..817bb97d7 100644 --- a/src/persp3d.cpp +++ b/src/persp3d.cpp @@ -341,7 +341,7 @@ persp3d_toggle_VP (Persp3D *persp, Proj::Axis axis, bool set_undo) { persp3d_update_box_reprs (persp); SP_OBJECT(persp)->updateRepr(SP_OBJECT_WRITE_EXT); if (set_undo) { - sp_document_done(sp_desktop_document(inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX, + SPDocumentUndo::done(sp_desktop_document(inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX, _("Toggle vanishing point")); } } @@ -352,7 +352,7 @@ persp3d_toggle_VPs (std::list p, Proj::Axis axis) { for (std::list::iterator i = p.begin(); i != p.end(); ++i) { persp3d_toggle_VP((*i), axis, false); } - sp_document_done(sp_desktop_document(inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX, + SPDocumentUndo::done(sp_desktop_document(inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX, _("Toggle multiple vanishing points")); } diff --git a/src/rect-context.cpp b/src/rect-context.cpp index b232a340a..69a9bc2f0 100644 --- a/src/rect-context.cpp +++ b/src/rect-context.cpp @@ -545,7 +545,7 @@ static void sp_rect_finish(SPRectContext *rc) sp_canvas_end_forced_full_redraws(desktop->canvas); sp_desktop_selection(desktop)->set(rc->item); - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_RECT, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_RECT, _("Create rectangle")); rc->item = NULL; @@ -571,7 +571,7 @@ static void sp_rect_cancel(SPRectContext *rc) sp_canvas_end_forced_full_redraws(desktop->canvas); - sp_document_cancel(sp_desktop_document(desktop)); + SPDocumentUndo::cancel(sp_desktop_document(desktop)); } diff --git a/src/select-context.cpp b/src/select-context.cpp index db25d3fad..215436f38 100644 --- a/src/select-context.cpp +++ b/src/select-context.cpp @@ -222,7 +222,7 @@ sp_select_context_abort(SPEventContext *event_context) if (sc->item) { // only undo if the item is still valid if (SP_OBJECT_DOCUMENT( SP_OBJECT(sc->item))) { - sp_document_undo(sp_desktop_document(desktop)); + SPDocumentUndo::undo(sp_desktop_document(desktop)); } sp_object_unref( SP_OBJECT(sc->item), NULL); @@ -230,7 +230,7 @@ sp_select_context_abort(SPEventContext *event_context) // NOTE: This is a workaround to a bug. // When the ctrl key is held, sc->item is not defined // so in this case (only), we skip the object doc check - sp_document_undo(sp_desktop_document(desktop)); + SPDocumentUndo::undo(sp_desktop_document(desktop)); } sc->item = NULL; diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 223fcee33..066b86ddf 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -300,7 +300,7 @@ void sp_selection_delete(SPDesktop *desktop) if (tools_isactive(desktop, TOOLS_TEXT)) if (sp_text_delete_selection(desktop->event_context)) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Delete text")); return; } @@ -326,7 +326,7 @@ void sp_selection_delete(SPDesktop *desktop) */ tools_switch( desktop, tools_active( desktop ) ); - sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_DELETE, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_DELETE, _("Delete")); } @@ -421,7 +421,7 @@ void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone) if ( !suppressDone ) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_DUPLICATE, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_DUPLICATE, _("Duplicate")); } @@ -446,7 +446,7 @@ void sp_edit_clear_all(SPDesktop *dt) items = g_slist_remove(items, items->data); } - sp_document_done(doc, SP_VERB_EDIT_CLEAR_ALL, + SPDocumentUndo::done(doc, SP_VERB_EDIT_CLEAR_ALL, _("Delete all")); } @@ -647,7 +647,7 @@ void sp_selection_group(SPDesktop *desktop) sp_selection_group_impl(p, group, xml_doc, doc); - sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_GROUP, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_GROUP, _("Group")); selection->set(group); @@ -708,7 +708,7 @@ void sp_selection_ungroup(SPDesktop *desktop) g_slist_free(items); - sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_UNGROUP, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_UNGROUP, _("Ungroup")); } @@ -843,7 +843,7 @@ sp_selection_raise(SPDesktop *desktop) g_slist_free(rev); } - sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_RAISE, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_RAISE, //TRANSLATORS: only translate "string" in "context|string". // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS // "Raise" means "to raise an object" in the undo history @@ -881,7 +881,7 @@ void sp_selection_raise_to_top(SPDesktop *desktop) g_slist_free(rl); - sp_document_done(document, SP_VERB_SELECTION_TO_FRONT, + SPDocumentUndo::done(document, SP_VERB_SELECTION_TO_FRONT, _("Raise to top")); } @@ -944,7 +944,7 @@ sp_selection_lower(SPDesktop *desktop) g_slist_free(rev); } - sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_LOWER, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_LOWER, _("Lower")); } @@ -991,21 +991,21 @@ void sp_selection_lower_to_bottom(SPDesktop *desktop) g_slist_free(rl); - sp_document_done(document, SP_VERB_SELECTION_TO_BACK, + SPDocumentUndo::done(document, SP_VERB_SELECTION_TO_BACK, _("Lower to bottom")); } void sp_undo(SPDesktop *desktop, SPDocument *) { - if (!sp_document_undo(sp_desktop_document(desktop))) + if (!SPDocumentUndo::undo(sp_desktop_document(desktop))) desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing to undo.")); } void sp_redo(SPDesktop *desktop, SPDocument *) { - if (!sp_document_redo(sp_desktop_document(desktop))) + if (!SPDocumentUndo::redo(sp_desktop_document(desktop))) desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing to redo.")); } @@ -1066,7 +1066,7 @@ void sp_selection_paste(SPDesktop *desktop, bool in_place) { Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get(); if (cm->paste(desktop, in_place)) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE, _("Paste")); + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE, _("Paste")); } } @@ -1074,7 +1074,7 @@ void sp_selection_paste_style(SPDesktop *desktop) { Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get(); if (cm->pasteStyle(desktop)) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_STYLE, _("Paste style")); + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_STYLE, _("Paste style")); } } @@ -1083,7 +1083,7 @@ void sp_selection_paste_livepatheffect(SPDesktop *desktop) { Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get(); if (cm->pastePathEffect(desktop)) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_LIVEPATHEFFECT, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_LIVEPATHEFFECT, _("Paste live path effect")); } } @@ -1116,7 +1116,7 @@ void sp_selection_remove_livepatheffect(SPDesktop *desktop) } - sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT, _("Remove live path effect")); } @@ -1137,7 +1137,7 @@ void sp_selection_remove_filter(SPDesktop *desktop) sp_desktop_set_style(desktop, css); sp_repr_css_attr_unref(css); - sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_REMOVE_FILTER, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_REMOVE_FILTER, _("Remove filter")); } @@ -1146,7 +1146,7 @@ void sp_selection_paste_size(SPDesktop *desktop, bool apply_x, bool apply_y) { Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get(); if (cm->pasteSize(desktop, false, apply_x, apply_y)) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_SIZE, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_SIZE, _("Paste size")); } } @@ -1155,7 +1155,7 @@ void sp_selection_paste_size_separately(SPDesktop *desktop, bool apply_x, bool a { Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get(); if (cm->pasteSize(desktop, true, apply_x, apply_y)) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_SIZE_SEPARATELY, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_SIZE_SEPARATELY, _("Paste size separately")); } } @@ -1191,7 +1191,7 @@ void sp_selection_to_next_layer(SPDesktop *dt, bool suppressDone) if (temp_clip) g_slist_free(temp_clip); if (next) dt->setCurrentLayer(next); if ( !suppressDone ) { - sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_MOVE_TO_NEXT, + SPDocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_MOVE_TO_NEXT, _("Raise to next layer")); } } else { @@ -1236,7 +1236,7 @@ void sp_selection_to_prev_layer(SPDesktop *dt, bool suppressDone) if (temp_clip) g_slist_free(temp_clip); if (next) dt->setCurrentLayer(next); if ( !suppressDone ) { - sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_MOVE_TO_PREV, + SPDocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_MOVE_TO_PREV, _("Lower to previous layer")); } } else { @@ -1452,7 +1452,7 @@ void sp_selection_remove_transform(SPDesktop *desktop) l = l->next; } - sp_document_done(sp_desktop_document(desktop), SP_VERB_OBJECT_FLATTEN, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_OBJECT_FLATTEN, _("Remove transform")); } @@ -1554,7 +1554,7 @@ void sp_selection_rotate_90(SPDesktop *desktop, bool ccw) sp_item_rotate_rel(item, rot_90); } - sp_document_done(sp_desktop_document(desktop), + SPDocumentUndo::done(sp_desktop_document(desktop), ccw ? SP_VERB_OBJECT_ROTATE_90_CCW : SP_VERB_OBJECT_ROTATE_90_CW, ccw ? _("Rotate 90° CCW") : _("Rotate 90° CW")); } @@ -1572,7 +1572,7 @@ sp_selection_rotate(Inkscape::Selection *selection, gdouble const angle_degrees) sp_selection_rotate_relative(selection, *center, angle_degrees); - sp_document_maybe_done(sp_desktop_document(selection->desktop()), + SPDocumentUndo::maybe_done(sp_desktop_document(selection->desktop()), ( ( angle_degrees > 0 ) ? "selector:rotate:ccw" : "selector:rotate:cw" ), @@ -1619,7 +1619,7 @@ sp_selection_rotate_screen(Inkscape::Selection *selection, gdouble angle) sp_selection_rotate_relative(selection, *center, zangle); - sp_document_maybe_done(sp_desktop_document(selection->desktop()), + SPDocumentUndo::maybe_done(sp_desktop_document(selection->desktop()), ( (angle > 0) ? "selector:rotate:ccw" : "selector:rotate:cw" ), @@ -1649,7 +1649,7 @@ sp_selection_scale(Inkscape::Selection *selection, gdouble grow) double const times = 1.0 + grow / max_len; sp_selection_scale_relative(selection, center, Geom::Scale(times, times)); - sp_document_maybe_done(sp_desktop_document(selection->desktop()), + SPDocumentUndo::maybe_done(sp_desktop_document(selection->desktop()), ( (grow > 0) ? "selector:scale:larger" : "selector:scale:smaller" ), @@ -1678,7 +1678,7 @@ sp_selection_scale_times(Inkscape::Selection *selection, gdouble times) Geom::Point const center(sel_bbox->midpoint()); sp_selection_scale_relative(selection, center, Geom::Scale(times, times)); - sp_document_done(sp_desktop_document(selection->desktop()), SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_CONTEXT_SELECT, _("Scale by whole factor")); } @@ -1693,13 +1693,13 @@ sp_selection_move(SPDesktop *desktop, gdouble dx, gdouble dy) sp_selection_move_relative(selection, dx, dy); if (dx == 0) { - sp_document_maybe_done(sp_desktop_document(desktop), "selector:move:vertical", SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "selector:move:vertical", SP_VERB_CONTEXT_SELECT, _("Move vertically")); } else if (dy == 0) { - sp_document_maybe_done(sp_desktop_document(desktop), "selector:move:horizontal", SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "selector:move:horizontal", SP_VERB_CONTEXT_SELECT, _("Move horizontally")); } else { - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SELECT, _("Move")); } } @@ -1719,13 +1719,13 @@ sp_selection_move_screen(SPDesktop *desktop, gdouble dx, gdouble dy) sp_selection_move_relative(selection, zdx, zdy); if (dx == 0) { - sp_document_maybe_done(sp_desktop_document(desktop), "selector:move:vertical", SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "selector:move:vertical", SP_VERB_CONTEXT_SELECT, _("Move vertically by pixels")); } else if (dy == 0) { - sp_document_maybe_done(sp_desktop_document(desktop), "selector:move:horizontal", SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "selector:move:horizontal", SP_VERB_CONTEXT_SELECT, _("Move horizontally by pixels")); } else { - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SELECT, _("Move")); } } @@ -2055,7 +2055,7 @@ sp_selection_clone(SPDesktop *desktop) // TRANSLATORS: only translate "string" in "context|string". // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_CLONE, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_CLONE, Q_("action|Clone")); selection->setReprList(newsel); @@ -2105,7 +2105,7 @@ sp_selection_relink(SPDesktop *desktop) if (!relinked) { desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No clones to relink in the selection.")); } else { - sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_UNLINK_CLONE, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_UNLINK_CLONE, _("Relink clone")); } } @@ -2172,7 +2172,7 @@ sp_selection_unlink(SPDesktop *desktop) desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No clones to unlink in the selection.")); } - sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_UNLINK_CLONE, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_UNLINK_CLONE, _("Unlink clone")); } @@ -2328,7 +2328,7 @@ void sp_selection_to_marker(SPDesktop *desktop, bool apply) g_slist_free(items); - sp_document_done(doc, SP_VERB_EDIT_SELECTION_2_MARKER, + SPDocumentUndo::done(doc, SP_VERB_EDIT_SELECTION_2_MARKER, _("Objects to marker")); } @@ -2369,7 +2369,7 @@ void sp_selection_to_guides(SPDesktop *desktop) sp_selection_to_guides_recursive(SP_ITEM(i->data), deleteitem, wholegroups); } - sp_document_done(doc, SP_VERB_EDIT_SELECTION_2_GUIDES, _("Objects to guides")); + SPDocumentUndo::done(doc, SP_VERB_EDIT_SELECTION_2_GUIDES, _("Objects to guides")); } void @@ -2472,7 +2472,7 @@ sp_selection_tile(SPDesktop *desktop, bool apply) g_slist_free(items); - sp_document_done(doc, SP_VERB_EDIT_TILE, + SPDocumentUndo::done(doc, SP_VERB_EDIT_TILE, _("Objects to pattern")); } @@ -2544,7 +2544,7 @@ sp_selection_untile(SPDesktop *desktop) if (!did) { desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No pattern fills in the selection.")); } else { - sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_UNTILE, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_EDIT_UNTILE, _("Pattern to objects")); selection->setList(new_select); } @@ -2807,7 +2807,7 @@ sp_selection_create_bitmap_copy(SPDesktop *desktop) gdk_pixbuf_unref(pb); // Complete undoable transaction - sp_document_done(document, SP_VERB_SELECTION_CREATE_BITMAP, + SPDocumentUndo::done(document, SP_VERB_SELECTION_CREATE_BITMAP, _("Create bitmap")); } @@ -3024,9 +3024,9 @@ sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_to_la g_slist_free(items_to_select); if (apply_clip_path) - sp_document_done(doc, SP_VERB_OBJECT_SET_CLIPPATH, _("Set clipping path")); + SPDocumentUndo::done(doc, SP_VERB_OBJECT_SET_CLIPPATH, _("Set clipping path")); else - sp_document_done(doc, SP_VERB_OBJECT_SET_MASK, _("Set mask")); + SPDocumentUndo::done(doc, SP_VERB_OBJECT_SET_MASK, _("Set mask")); } void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) { @@ -3150,9 +3150,9 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) { g_slist_free(items_to_select); if (apply_clip_path) - sp_document_done(doc, SP_VERB_OBJECT_UNSET_CLIPPATH, _("Release clipping path")); + SPDocumentUndo::done(doc, SP_VERB_OBJECT_UNSET_CLIPPATH, _("Release clipping path")); else - sp_document_done(doc, SP_VERB_OBJECT_UNSET_MASK, _("Release mask")); + SPDocumentUndo::done(doc, SP_VERB_OBJECT_UNSET_MASK, _("Release mask")); } /** @@ -3189,7 +3189,7 @@ void verb_fit_canvas_to_selection(SPDesktop *const desktop) { if (fit_canvas_to_selection(desktop)) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_FIT_CANVAS_TO_SELECTION, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_FIT_CANVAS_TO_SELECTION, _("Fit Page to Selection")); } } @@ -3218,7 +3218,7 @@ void verb_fit_canvas_to_drawing(SPDesktop *desktop) { if (fit_canvas_to_drawing(sp_desktop_document(desktop))) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_FIT_CANVAS_TO_DRAWING, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_FIT_CANVAS_TO_DRAWING, _("Fit Page to Drawing")); } } @@ -3239,7 +3239,7 @@ void fit_canvas_to_selection_or_drawing(SPDesktop *desktop) { ? fit_canvas_to_drawing(doc, true) : fit_canvas_to_selection(desktop, true) ); if (changed) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, _("Fit Page to Selection or Drawing")); } }; diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 89799246c..627620a60 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -520,16 +520,16 @@ void Inkscape::SelTrans::ungrab() _items_centers.clear(); if (_current_relative_affine.isTranslation()) { - sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, _("Move")); } else if (_current_relative_affine.without_translation().isScale()) { - sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, _("Scale")); } else if (_current_relative_affine.without_translation().isRotation()) { - sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, _("Rotate")); } else { - sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, _("Skew")); } @@ -541,7 +541,7 @@ void Inkscape::SelTrans::ungrab() SPItem *it = (SPItem*)SP_OBJECT(l->data); SP_OBJECT(it)->updateRepr(); } - sp_document_done (sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, _("Set center")); } @@ -616,7 +616,7 @@ void Inkscape::SelTrans::stamp() Inkscape::GC::release(copy_repr); l = l->next; } - sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, _("Stamp")); } @@ -805,7 +805,7 @@ void Inkscape::SelTrans::handleClick(SPKnot */*knot*/, guint state, SPSelTransHa _center_is_set = false; // center has changed _updateHandles(); } - sp_document_done (sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, _("Reset center")); } break; diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index 5bf7f664c..877e73979 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -284,7 +284,7 @@ sp_guide_create_guides_around_page(SPDesktop *dt) { sp_guide_pt_pairs_to_guides(dt, pts); - sp_document_done (doc, SP_VERB_NONE, _("Guides Around Page")); + SPDocumentUndo::done (doc, SP_VERB_NONE, _("Guides Around Page")); } void sp_guide_show(SPGuide *guide, SPCanvasGroup *group, GCallback handler) diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index c178cfdd4..1d38771bc 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -497,7 +497,7 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) } if (do_done) - sp_document_done (doc, SP_VERB_NONE, _("Ungroup")); + SPDocumentUndo::done (doc, SP_VERB_NONE, _("Ungroup")); } /* diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index 44c3bf620..8c750f347 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -204,7 +204,7 @@ static void sp_namedview_generate_old_grid(SPNamedView * /*nv*/, SPDocument *doc repr->setAttribute("gridempopacity", NULL); repr->setAttribute("gridempspacing", NULL); -// sp_document_done(doc, SP_VERB_DIALOG_NAMEDVIEW, _("Create new grid from pre0.46 grid settings")); +// SPDocumentUndo::done(doc, SP_VERB_DIALOG_NAMEDVIEW, _("Create new grid from pre0.46 grid settings")); } } @@ -812,8 +812,8 @@ void sp_namedview_document_from_window(SPDesktop *desktop) Geom::Rect const r = desktop->get_display_area(); // saving window geometry is not undoable - bool saved = sp_document_get_undo_sensitive(sp_desktop_document(desktop)); - sp_document_set_undo_sensitive(sp_desktop_document(desktop), false); + bool saved = SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop)); + SPDocumentUndo::set_undo_sensitive(sp_desktop_document(desktop), false); sp_repr_set_svg_double(view, "inkscape:zoom", desktop->current_zoom()); sp_repr_set_svg_double(view, "inkscape:cx", r.midpoint()[Geom::X]); @@ -832,7 +832,7 @@ void sp_namedview_document_from_window(SPDesktop *desktop) view->setAttribute("inkscape:current-layer", desktop->currentLayer()->getId()); // restore undoability - sp_document_set_undo_sensitive(sp_desktop_document(desktop), saved); + SPDocumentUndo::set_undo_sensitive(sp_desktop_document(desktop), saved); } void SPNamedView::hide(SPDesktop const *desktop) @@ -889,10 +889,10 @@ void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr) v = !v; } - bool saved = sp_document_get_undo_sensitive(doc); - sp_document_set_undo_sensitive(doc, false); + bool saved = SPDocumentUndo::get_undo_sensitive(doc); + SPDocumentUndo::set_undo_sensitive(doc, false); sp_repr_set_boolean(repr, "showguides", v); - sp_document_set_undo_sensitive(doc, saved); + SPDocumentUndo::set_undo_sensitive(doc, saved); doc->setModifiedSinceSave(); } @@ -904,10 +904,10 @@ void sp_namedview_show_grids(SPNamedView * namedview, bool show, bool dirty_docu SPDocument *doc = SP_OBJECT_DOCUMENT (namedview); Inkscape::XML::Node *repr = SP_OBJECT_REPR(namedview); - bool saved = sp_document_get_undo_sensitive(doc); - sp_document_set_undo_sensitive(doc, false); + bool saved = SPDocumentUndo::get_undo_sensitive(doc); + SPDocumentUndo::set_undo_sensitive(doc, false); sp_repr_set_boolean(repr, "showgrid", namedview->grids_visible); - sp_document_set_undo_sensitive(doc, saved); + SPDocumentUndo::set_undo_sensitive(doc, saved); /* we don't want the document to get dirty on startup; that's when we call this function with dirty_document = false */ diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp index 2eb8daf89..3d1cd4b21 100644 --- a/src/spiral-context.cpp +++ b/src/spiral-context.cpp @@ -480,7 +480,7 @@ sp_spiral_finish(SPSpiralContext *sc) sp_canvas_end_forced_full_redraws(desktop->canvas); sp_desktop_selection(desktop)->set(sc->item); - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SPIRAL, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SPIRAL, _("Create spiral")); sc->item = NULL; @@ -506,7 +506,7 @@ static void sp_spiral_cancel(SPSpiralContext *sc) sp_canvas_end_forced_full_redraws(desktop->canvas); - sp_document_cancel(sp_desktop_document(desktop)); + SPDocumentUndo::cancel(sp_desktop_document(desktop)); } /* diff --git a/src/splivarot.cpp b/src/splivarot.cpp index db5ceaa8e..5073382e5 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -419,7 +419,7 @@ sp_selected_path_boolop(SPDesktop *desktop, bool_op bop, const unsigned int verb { SP_OBJECT(l->data)->deleteObject(); } - sp_document_done(sp_desktop_document(desktop), SP_VERB_NONE, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, description); selection->clear(); @@ -593,7 +593,7 @@ sp_selected_path_boolop(SPDesktop *desktop, bool_op bop, const unsigned int verb if (desc) g_free(desc); if (verb != SP_VERB_NONE) { - sp_document_done(sp_desktop_document(desktop), verb, description); + SPDocumentUndo::done(sp_desktop_document(desktop), verb, description); } delete res; @@ -1216,7 +1216,7 @@ sp_selected_path_outline(SPDesktop *desktop) } if (did) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_OUTLINE, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_OUTLINE, _("Convert stroke to path")); } else { // TRANSLATORS: "to outline" means "to convert stroke to path" @@ -1419,7 +1419,7 @@ sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool updat { // pas vraiment de points sur le resultat // donc il ne reste rien - sp_document_done(sp_desktop_document(desktop), + SPDocumentUndo::done(sp_desktop_document(desktop), (updating ? SP_VERB_SELECTION_LINKED_OFFSET : SP_VERB_SELECTION_DYNAMIC_OFFSET), (updating ? _("Create linked offset") @@ -1488,7 +1488,7 @@ sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool updat selection->set(nitem); } - sp_document_done(sp_desktop_document(desktop), + SPDocumentUndo::done(sp_desktop_document(desktop), (updating ? SP_VERB_SELECTION_LINKED_OFFSET : SP_VERB_SELECTION_DYNAMIC_OFFSET), (updating ? _("Create linked offset") @@ -1733,7 +1733,7 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset) } if (did) { - sp_document_done(sp_desktop_document(desktop), + SPDocumentUndo::done(sp_desktop_document(desktop), (expand ? SP_VERB_SELECTION_OFFSET : SP_VERB_SELECTION_INSET), (expand ? _("Outset path") : _("Inset path"))); } else { @@ -1993,7 +1993,7 @@ sp_selected_path_simplify_selection(SPDesktop *desktop, float threshold, bool ju breakableAngles, true); if (didSomething) - sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_SIMPLIFY, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_SIMPLIFY, _("Simplify")); else desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No paths to simplify in the selection.")); diff --git a/src/spray-context.cpp b/src/spray-context.cpp index 8c30f5a5a..ebdf56673 100644 --- a/src/spray-context.cpp +++ b/src/spray-context.cpp @@ -877,15 +877,15 @@ case GDK_SCROLL_LEFT: tc->has_dilated = false; switch (tc->mode) { case SPRAY_MODE_COPY: - sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), + SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), SP_VERB_CONTEXT_SPRAY, _("Spray with copies")); break; case SPRAY_MODE_CLONE: - sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), + SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), SP_VERB_CONTEXT_SPRAY, _("Spray with clones")); break; case SPRAY_MODE_SINGLE_PATH: - sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), + SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), SP_VERB_CONTEXT_SPRAY, _("Spray in single path")); break; } diff --git a/src/star-context.cpp b/src/star-context.cpp index 69d711722..2761c573a 100644 --- a/src/star-context.cpp +++ b/src/star-context.cpp @@ -499,7 +499,7 @@ sp_star_finish (SPStarContext * sc) sp_canvas_end_forced_full_redraws(desktop->canvas); sp_desktop_selection(desktop)->set(sc->item); - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, _("Create star")); sc->item = NULL; @@ -525,7 +525,7 @@ static void sp_star_cancel(SPStarContext *sc) sp_canvas_end_forced_full_redraws(desktop->canvas); - sp_document_cancel(sp_desktop_document(desktop)); + SPDocumentUndo::cancel(sp_desktop_document(desktop)); } /* diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp index 2cc6e30d9..5af97165e 100644 --- a/src/text-chemistry.cpp +++ b/src/text-chemistry.cpp @@ -188,7 +188,7 @@ text_put_on_path() SP_OBJECT_REPR(text)->setAttribute("x", NULL); SP_OBJECT_REPR(text)->setAttribute("y", NULL); - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Put text on path")); g_slist_free(text_reprs); } @@ -225,7 +225,7 @@ text_remove_from_path() if (!did) { sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("No texts-on-paths in the selection.")); } else { - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Remove text from path")); selection->setList(g_slist_copy((GSList *) selection->itemList())); // reselect to update statusbar description } @@ -289,7 +289,7 @@ text_remove_all_kerns() if (!did) { sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("Select text(s) to remove kerns from.")); } else { - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Remove manual kerns")); } } @@ -377,7 +377,7 @@ text_flow_into_shape() SP_OBJECT(text)->deleteObject (true); - sp_document_done(doc, SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(doc, SP_VERB_CONTEXT_TEXT, _("Flow text into shape")); sp_desktop_selection(desktop)->set(SP_ITEM(root_object)); @@ -473,7 +473,7 @@ text_unflow () g_slist_free (old_objs); g_slist_free (new_objs); - sp_document_done(doc, SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(doc, SP_VERB_CONTEXT_TEXT, _("Unflow flowed text")); } @@ -530,7 +530,7 @@ flowtext_to_text() g_slist_free(items); if (did) { - sp_document_done(sp_desktop_document(desktop), + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_OBJECT_FLOWTEXT_TO_TEXT, _("Convert flowed text to text")); selection->setReprList(reprs); diff --git a/src/text-context.cpp b/src/text-context.cpp index b37c97311..cfde60a0d 100644 --- a/src/text-context.cpp +++ b/src/text-context.cpp @@ -501,7 +501,7 @@ sp_text_context_setup_text(SPTextContext *tc) text_item->transform = SP_ITEM(ec->desktop->currentLayer())->i2doc_affine().inverse(); text_item->updateRepr(); - sp_document_done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT, _("Create text")); } @@ -540,7 +540,7 @@ insert_uni_char(SPTextContext *const tc) tc->text_sel_start = tc->text_sel_end = sp_te_replace(tc->text, tc->text_sel_start, tc->text_sel_end, u); sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); - sp_document_done(sp_desktop_document(tc->desktop), SP_VERB_DIALOG_TRANSFORM, + SPDocumentUndo::done(sp_desktop_document(tc->desktop), SP_VERB_DIALOG_TRANSFORM, _("Insert Unicode character")); } } @@ -699,7 +699,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons sp_desktop_apply_style_tool(desktop, SP_OBJECT_REPR(ft), "/tools/text", true); sp_desktop_selection(desktop)->set(ft); desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Flowed text is created.")); - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Create flowed text")); } else { desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("The frame is too small for the current font size. Flowed text not created.")); @@ -839,7 +839,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("No-break space")); - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Insert no-break space")); return TRUE; } @@ -876,7 +876,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons sp_repr_css_set_property(css, "font-weight", "normal"); sp_te_apply_style(tc->text, tc->text_sel_start, tc->text_sel_end, css); sp_repr_css_attr_unref(css); - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Make bold")); sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); @@ -894,7 +894,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons sp_repr_css_set_property(css, "font-style", "italic"); sp_te_apply_style(tc->text, tc->text_sel_start, tc->text_sel_end, css); sp_repr_css_attr_unref(css); - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Make italic")); sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); @@ -933,7 +933,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("New line")); return TRUE; } @@ -967,7 +967,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Backspace")); } return TRUE; @@ -998,7 +998,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Delete")); } return TRUE; @@ -1015,7 +1015,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, Geom::Point(mul*-1, 0)); sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); - sp_document_maybe_done(sp_desktop_document(desktop), "kern:left", SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "kern:left", SP_VERB_CONTEXT_TEXT, _("Kern to the left")); } else { if (MOD__CTRL) @@ -1040,7 +1040,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, Geom::Point(mul*1, 0)); sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); - sp_document_maybe_done(sp_desktop_document(desktop), "kern:right", SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "kern:right", SP_VERB_CONTEXT_TEXT, _("Kern to the right")); } else { if (MOD__CTRL) @@ -1065,7 +1065,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, Geom::Point(0, mul*-1)); sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); - sp_document_maybe_done(sp_desktop_document(desktop), "kern:up", SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "kern:up", SP_VERB_CONTEXT_TEXT, _("Kern up")); } else { @@ -1091,7 +1091,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, Geom::Point(0, mul*1)); sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); - sp_document_maybe_done(sp_desktop_document(desktop), "kern:down", SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "kern:down", SP_VERB_CONTEXT_TEXT, _("Kern down")); } else { @@ -1168,7 +1168,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons } else { sp_te_adjust_rotation(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -90); } - sp_document_maybe_done(sp_desktop_document(desktop), "textrot:ccw", SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "textrot:ccw", SP_VERB_CONTEXT_TEXT, _("Rotate counterclockwise")); sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); @@ -1189,7 +1189,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons } else { sp_te_adjust_rotation(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 90); } - sp_document_maybe_done(sp_desktop_document(desktop), "textrot:cw", SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "textrot:cw", SP_VERB_CONTEXT_TEXT, _("Rotate clockwise")); sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); @@ -1206,7 +1206,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons sp_te_adjust_linespacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -10); else sp_te_adjust_linespacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -1); - sp_document_maybe_done(sp_desktop_document(desktop), "linespacing:dec", SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "linespacing:dec", SP_VERB_CONTEXT_TEXT, _("Contract line spacing")); } else { @@ -1214,7 +1214,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons sp_te_adjust_tspan_letterspacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -10); else sp_te_adjust_tspan_letterspacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -1); - sp_document_maybe_done(sp_desktop_document(desktop), "letterspacing:dec", SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "letterspacing:dec", SP_VERB_CONTEXT_TEXT, _("Contract letter spacing")); } @@ -1233,7 +1233,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons sp_te_adjust_linespacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 10); else sp_te_adjust_linespacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 1); - sp_document_maybe_done(sp_desktop_document(desktop), "linespacing:inc", SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "linespacing:inc", SP_VERB_CONTEXT_TEXT, _("Expand line spacing")); } else { @@ -1241,7 +1241,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons sp_te_adjust_tspan_letterspacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 10); else sp_te_adjust_tspan_letterspacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 1); - sp_document_maybe_done(sp_desktop_document(desktop), "letterspacing:inc", SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::maybe_done(sp_desktop_document(desktop), "letterspacing:inc", SP_VERB_CONTEXT_TEXT, _("Expand letter spacing")); } @@ -1371,7 +1371,7 @@ sp_text_paste_inline(SPEventContext *ec) tc->text_sel_start = tc->text_sel_end = sp_te_insert_line(tc->text, tc->text_sel_start); begin = end + 1; } - sp_document_done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT, _("Paste text")); return true; @@ -1496,7 +1496,7 @@ sp_text_context_style_set(SPCSSAttr const *css, SPTextContext *tc) return false; // will get picked up by the parent and applied to the whole text object sp_te_apply_style(tc->text, tc->text_sel_start, tc->text_sel_end, css); - sp_document_done(sp_desktop_document(tc->desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(sp_desktop_document(tc->desktop), SP_VERB_CONTEXT_TEXT, _("Set text style")); sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); @@ -1704,7 +1704,7 @@ sp_text_context_forget_text(SPTextContext *tc) // the XML editor if ( text_repr && sp_repr_parent(text_repr) ) { sp_repr_unparent(text_repr); - sp_document_done(sp_desktop_document(tc->desktop), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(sp_desktop_document(tc->desktop), SP_VERB_CONTEXT_TEXT, _("Remove empty text")); } } @@ -1737,7 +1737,7 @@ sptc_commit(GtkIMContext */*imc*/, gchar *string, SPTextContext *tc) sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); - sp_document_done(SP_OBJECT_DOCUMENT(tc->text), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done(SP_OBJECT_DOCUMENT(tc->text), SP_VERB_CONTEXT_TEXT, _("Type text")); } diff --git a/src/trace/trace.cpp b/src/trace/trace.cpp index a2b0cd790..e9bc48372 100644 --- a/src/trace/trace.cpp +++ b/src/trace/trace.cpp @@ -568,7 +568,7 @@ void Tracer::traceThread() } //## inform the document, so we can undo - sp_document_done(doc, SP_VERB_SELECTION_TRACE, _("Trace bitmap")); + SPDocumentUndo::done(doc, SP_VERB_SELECTION_TRACE, _("Trace bitmap")); engine = NULL; diff --git a/src/tweak-context.cpp b/src/tweak-context.cpp index e77d2d465..cd6ff325a 100644 --- a/src/tweak-context.cpp +++ b/src/tweak-context.cpp @@ -1258,55 +1258,55 @@ sp_tweak_context_root_handler(SPEventContext *event_context, tc->has_dilated = false; switch (tc->mode) { case TWEAK_MODE_MOVE: - sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), + SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), SP_VERB_CONTEXT_TWEAK, _("Move tweak")); break; case TWEAK_MODE_MOVE_IN_OUT: - sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), + SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), SP_VERB_CONTEXT_TWEAK, _("Move in/out tweak")); break; case TWEAK_MODE_MOVE_JITTER: - sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), + SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), SP_VERB_CONTEXT_TWEAK, _("Move jitter tweak")); break; case TWEAK_MODE_SCALE: - sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), + SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), SP_VERB_CONTEXT_TWEAK, _("Scale tweak")); break; case TWEAK_MODE_ROTATE: - sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), + SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), SP_VERB_CONTEXT_TWEAK, _("Rotate tweak")); break; case TWEAK_MODE_MORELESS: - sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), + SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), SP_VERB_CONTEXT_TWEAK, _("Duplicate/delete tweak")); break; case TWEAK_MODE_PUSH: - sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), + SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), SP_VERB_CONTEXT_TWEAK, _("Push path tweak")); break; case TWEAK_MODE_SHRINK_GROW: - sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), + SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), SP_VERB_CONTEXT_TWEAK, _("Shrink/grow path tweak")); break; case TWEAK_MODE_ATTRACT_REPEL: - sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), + SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), SP_VERB_CONTEXT_TWEAK, _("Attract/repel path tweak")); break; case TWEAK_MODE_ROUGHEN: - sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), + SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), SP_VERB_CONTEXT_TWEAK, _("Roughen path tweak")); break; case TWEAK_MODE_COLORPAINT: - sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), + SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), SP_VERB_CONTEXT_TWEAK, _("Color paint tweak")); break; case TWEAK_MODE_COLORJITTER: - sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), + SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), SP_VERB_CONTEXT_TWEAK, _("Color jitter tweak")); break; case TWEAK_MODE_BLUR: - sp_document_done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), + SPDocumentUndo::done(sp_desktop_document(SP_EVENT_CONTEXT(tc)->desktop), SP_VERB_CONTEXT_TWEAK, _("Blur tweak")); break; } diff --git a/src/ui/context-menu.cpp b/src/ui/context-menu.cpp index 98ad9dc7b..1ffbf1fd0 100644 --- a/src/ui/context-menu.cpp +++ b/src/ui/context-menu.cpp @@ -284,7 +284,7 @@ sp_item_create_link(GtkMenuItem *menuitem, SPItem *item) Inkscape::GC::release(repr); Inkscape::GC::release(child); - sp_document_done(SP_OBJECT_DOCUMENT(object), SP_VERB_NONE, + SPDocumentUndo::done(SP_OBJECT_DOCUMENT(object), SP_VERB_NONE, _("Create link")); sp_object_attributes_dialog(object, "SPAnchor"); diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 0b47f42ab..af1671b04 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -233,7 +233,7 @@ private : prefs->setInt("/options/clonecompensation/value", saved_compensation); if (changed) { - sp_document_done ( sp_desktop_document (desktop) , SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + SPDocumentUndo::done ( sp_desktop_document (desktop) , SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Align")); } @@ -392,7 +392,7 @@ private : prefs->setInt("/options/clonecompensation/value", saved_compensation); if (changed) { - sp_document_done ( sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + SPDocumentUndo::done ( sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Distribute")); } } @@ -505,7 +505,7 @@ private : // restore compensation setting prefs->setInt("/options/clonecompensation/value", saved_compensation); - sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + SPDocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Remove overlaps")); } }; @@ -536,7 +536,7 @@ private : // restore compensation setting prefs->setInt("/options/clonecompensation/value", saved_compensation); - sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + SPDocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Arrange connector network")); } }; @@ -567,7 +567,7 @@ private : // restore compensation setting prefs->setInt("/options/clonecompensation/value", saved_compensation); - sp_document_done (sp_desktop_document (_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + SPDocumentUndo::done (sp_desktop_document (_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Unclump")); } }; @@ -638,7 +638,7 @@ private : // restore compensation setting prefs->setInt("/options/clonecompensation/value", saved_compensation); - sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Randomize positions")); } }; @@ -737,7 +737,7 @@ private : } if (changed) { - sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Distribute text baselines")); } @@ -760,7 +760,7 @@ private : } if (changed) { - sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Align text baselines")); } } diff --git a/src/ui/dialog/color-item.cpp b/src/ui/dialog/color-item.cpp index cb6cfbbbe..a8445c66c 100644 --- a/src/ui/dialog/color-item.cpp +++ b/src/ui/dialog/color-item.cpp @@ -486,7 +486,7 @@ void ColorItem::_updatePreviews() str = 0; if ( bruteForce( document, rroot, paletteName, def.getR(), def.getG(), def.getB() ) ) { - sp_document_done( document , SP_VERB_DIALOG_SWATCHES, + SPDocumentUndo::done( document , SP_VERB_DIALOG_SWATCHES, _("Change color definition")); } } @@ -720,7 +720,7 @@ void ColorItem::buttonClicked(bool secondary) sp_desktop_set_style(desktop, css); sp_repr_css_attr_unref(css); - sp_document_done( sp_desktop_document(desktop), SP_VERB_DIALOG_SWATCHES, descr.c_str() ); + SPDocumentUndo::done( sp_desktop_document(desktop), SP_VERB_DIALOG_SWATCHES, descr.c_str() ); } } diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 970c609af..2fe353533 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -450,7 +450,7 @@ DocumentProperties::linkSelectedProfile() //Inkscape::GC::release(defsRepr); // inform the document, so we can undo - sp_document_done(desktop->doc(), SP_VERB_EDIT_LINK_COLOR_PROFILE, _("Link Color Profile")); + SPDocumentUndo::done(desktop->doc(), SP_VERB_EDIT_LINK_COLOR_PROFILE, _("Link Color Profile")); populate_linked_profiles_box(); } @@ -523,7 +523,7 @@ void DocumentProperties::removeSelectedProfile(){ Inkscape::ColorProfile* prof = reinterpret_cast(obj); if (!name.compare(prof->name)){ sp_repr_unparent(obj->repr); - sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_COLOR_PROFILE, _("Remove linked color profile")); + SPDocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_COLOR_PROFILE, _("Remove linked color profile")); } current = g_slist_next(current); } @@ -668,7 +668,7 @@ void DocumentProperties::addExternalScript(){ xml_doc->root()->addChild(scriptRepr, NULL); // inform the document, so we can undo - sp_document_done(desktop->doc(), SP_VERB_EDIT_ADD_EXTERNAL_SCRIPT, _("Add external script...")); + SPDocumentUndo::done(desktop->doc(), SP_VERB_EDIT_ADD_EXTERNAL_SCRIPT, _("Add external script...")); populate_external_scripts_box(); } @@ -692,7 +692,7 @@ void DocumentProperties::removeExternalScript(){ SPScript* script = (SPScript*) obj; if (name == script->xlinkhref){ sp_repr_unparent(obj->repr); - sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, _("Remove external script")); + SPDocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, _("Remove external script")); } current = g_slist_next(current); } @@ -985,7 +985,7 @@ DocumentProperties::onRemoveGrid() // delete the grid that corresponds with the selected tab // when the grid is deleted from SVG, the SPNamedview handler automatically deletes the object, so found_grid becomes an invalid pointer! found_grid->repr->parent()->removeChild(found_grid->repr); - sp_document_done(sp_desktop_document(dt), SP_VERB_DIALOG_NAMEDVIEW, _("Remove grid")); + SPDocumentUndo::done(sp_desktop_document(dt), SP_VERB_DIALOG_NAMEDVIEW, _("Remove grid")); } } diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 7baf2d71f..3a80c4ba8 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -1032,7 +1032,7 @@ private: Inkscape::GC::release(repr); } - sp_document_done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("New light source")); + SPDocumentUndo::done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("New light source")); update(); } @@ -1215,7 +1215,7 @@ void FilterEffectsDialog::FilterModifier::on_name_edited(const Glib::ustring& pa if(iter) { SPFilter* filter = (*iter)[_columns.filter]; filter->setLabel(text.c_str()); - sp_document_done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Rename filter")); + SPDocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Rename filter")); if(iter) (*iter)[_columns.label] = text; } @@ -1251,7 +1251,7 @@ void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustri } update_selection(sel); - sp_document_done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Apply filter")); + SPDocumentUndo::done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Apply filter")); } } @@ -1327,7 +1327,7 @@ void FilterEffectsDialog::FilterModifier::add_filter() select_filter(filter); - sp_document_done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Add filter")); + SPDocumentUndo::done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Add filter")); } void FilterEffectsDialog::FilterModifier::remove_filter() @@ -1338,7 +1338,7 @@ void FilterEffectsDialog::FilterModifier::remove_filter() SPDocument* doc = filter->document; sp_repr_unparent(filter->repr); - sp_document_done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Remove filter")); + SPDocumentUndo::done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Remove filter")); update_filters(); } @@ -1353,7 +1353,7 @@ void FilterEffectsDialog::FilterModifier::duplicate_filter() repr = repr->duplicate(repr->document()); parent->appendChild(repr); - sp_document_done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Duplicate filter")); + SPDocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Duplicate filter")); update_filters(); } @@ -1543,7 +1543,7 @@ void FilterEffectsDialog::PrimitiveList::remove_selected() sp_repr_unparent(prim->repr); - sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_FILTER_EFFECTS, + SPDocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_FILTER_EFFECTS, _("Remove filter primitive")); update(); @@ -1915,7 +1915,7 @@ bool FilterEffectsDialog::PrimitiveList::on_button_release_event(GdkEventButton* // If input is null, delete it if(!in_val) { sp_repr_unparent(o->repr); - sp_document_done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS, + SPDocumentUndo::done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Remove merge node")); (*get_selection()->get_selected())[_columns.primitive] = prim; } @@ -2032,7 +2032,7 @@ void FilterEffectsDialog::PrimitiveList::on_drag_end(const Glib::RefPtrrequestModified(SP_OBJECT_MODIFIED_FLAG); - sp_document_done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Reorder filter primitive")); + SPDocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Reorder filter primitive")); } // If a connection is dragged towards the top or bottom of the list, the list should scroll to follow. @@ -2263,7 +2263,7 @@ void FilterEffectsDialog::add_primitive() _primitive_list.select(prim); - sp_document_done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Add filter primitive")); + SPDocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Add filter primitive")); } } @@ -2359,7 +2359,7 @@ void FilterEffectsDialog::duplicate_primitive() repr = SP_OBJECT_REPR(origprim)->duplicate(SP_OBJECT_REPR(origprim)->document()); SP_OBJECT_REPR(filter)->appendChild(repr); - sp_document_done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Duplicate filter primitive")); + SPDocumentUndo::done(filter->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Duplicate filter primitive")); _primitive_list.update(); } @@ -2411,7 +2411,7 @@ void FilterEffectsDialog::set_attr(SPObject* o, const SPAttributeEnum attr, cons Glib::ustring undokey = "filtereffects:"; undokey += name; - sp_document_maybe_done(filter->document, undokey.c_str(), SP_VERB_DIALOG_FILTER_EFFECTS, + SPDocumentUndo::maybe_done(filter->document, undokey.c_str(), SP_VERB_DIALOG_FILTER_EFFECTS, _("Set filter primitive attribute")); } diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp index 8ed502aae..8193b4384 100644 --- a/src/ui/dialog/glyphs.cpp +++ b/src/ui/dialog/glyphs.cpp @@ -28,7 +28,7 @@ #include "glyphs.h" #include "desktop.h" -#include "document.h" // for sp_document_done() +#include "document.h" // for SPDocumentUndo::done() #include "libnrtype/font-instance.h" #include "sp-flowtext.h" #include "sp-text.h" @@ -571,7 +571,7 @@ void GlyphsPanel::insertText() } combined += glyphs; sp_te_set_repr_text_multiline(textItem, combined.c_str()); - sp_document_done(targetDesktop->doc(), SP_VERB_CONTEXT_TEXT, _("Append text")); + SPDocumentUndo::done(targetDesktop->doc(), SP_VERB_CONTEXT_TEXT, _("Append text")); } } } diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index 3a7964ba2..9c3422167 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -108,7 +108,7 @@ void GuidelinePropertiesDialog::_onApply() sp_guide_moveto(*_guide, newpos, true); - sp_document_done(SP_OBJECT_DOCUMENT(_guide), SP_VERB_NONE, + SPDocumentUndo::done(SP_OBJECT_DOCUMENT(_guide), SP_VERB_NONE, _("Set guide properties")); } @@ -121,7 +121,7 @@ void GuidelinePropertiesDialog::_onDelete() { SPDocument *doc = SP_OBJECT_DOCUMENT(_guide); sp_guide_remove(_guide); - sp_document_done(doc, SP_VERB_NONE, + SPDocumentUndo::done(doc, SP_VERB_NONE, _("Delete guide")); } diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp index ffa4642e7..80c943e39 100644 --- a/src/ui/dialog/layer-properties.cpp +++ b/src/ui/dialog/layer-properties.cpp @@ -105,7 +105,7 @@ LayerPropertiesDialog::_apply() g_assert(_strategy != NULL); _strategy->perform(*this); - sp_document_done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_NONE, + SPDocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_NONE, _("Add layer")); _close(); @@ -188,7 +188,7 @@ void LayerPropertiesDialog::Rename::perform(LayerPropertiesDialog &dialog) { (gchar *)name.c_str(), FALSE ); - sp_document_done(sp_desktop_document(desktop), SP_VERB_NONE, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, _("Rename layer")); // TRANSLATORS: This means "The layer has been renamed" desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Renamed layer")); diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index ff3a13ab2..962d78df8 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -468,7 +468,7 @@ void LayersPanel::_toggled( Glib::ustring const& str, int targetCol ) row[_model->_colVisible] = newValue; item->setHidden( !newValue ); item->updateRepr(); - sp_document_done( _desktop->doc() , SP_VERB_DIALOG_LAYERS, + SPDocumentUndo::done( _desktop->doc() , SP_VERB_DIALOG_LAYERS, newValue? _("Unhide layer") : _("Hide layer")); } break; @@ -479,7 +479,7 @@ void LayersPanel::_toggled( Glib::ustring const& str, int targetCol ) row[_model->_colLocked] = newValue; item->setLocked( newValue ); item->updateRepr(); - sp_document_done( _desktop->doc() , SP_VERB_DIALOG_LAYERS, + SPDocumentUndo::done( _desktop->doc() , SP_VERB_DIALOG_LAYERS, newValue? _("Lock layer") : _("Unlock layer")); } break; diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 62ed4e639..d05790b3e 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -372,7 +372,7 @@ LivePathEffectEditor::onApply() LivePathEffect::Effect::createAndApply(data->key.c_str(), doc, item); - sp_document_done(doc, SP_VERB_DIALOG_LIVE_PATH_EFFECT, + SPDocumentUndo::done(doc, SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Create and apply path effect")); lpe_list_locked = false; @@ -390,7 +390,7 @@ LivePathEffectEditor::onRemove() if ( item && SP_IS_LPE_ITEM(item) ) { sp_lpe_item_remove_current_path_effect(SP_LPE_ITEM(item), false); - sp_document_done ( sp_desktop_document (current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT, + SPDocumentUndo::done ( sp_desktop_document (current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Remove path effect") ); effect_list_reload(SP_LPE_ITEM(item)); @@ -406,7 +406,7 @@ void LivePathEffectEditor::onUp() if ( item && SP_IS_LPE_ITEM(item) ) { sp_lpe_item_up_current_path_effect(SP_LPE_ITEM(item)); - sp_document_done ( sp_desktop_document (current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT, + SPDocumentUndo::done ( sp_desktop_document (current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Move path effect up") ); effect_list_reload(SP_LPE_ITEM(item)); @@ -422,7 +422,7 @@ void LivePathEffectEditor::onDown() if ( item && SP_IS_LPE_ITEM(item) ) { sp_lpe_item_down_current_path_effect(SP_LPE_ITEM(item)); - sp_document_done ( sp_desktop_document (current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT, + SPDocumentUndo::done ( sp_desktop_document (current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Move path effect down") ); effect_list_reload(SP_LPE_ITEM(item)); @@ -461,7 +461,7 @@ void LivePathEffectEditor::on_visibility_toggled( Glib::ustring const& str ) /* FIXME: this explicit writing to SVG is wrong. The lpe_item should have a method to disable/enable an effect within its stack. * So one can call: lpe_item->setActive(lpeobjref->lpeobject); */ lpeobjref->lpeobject->get_lpe()->getRepr()->setAttribute("is_visible", newValue ? "true" : "false"); - sp_document_done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT, + SPDocumentUndo::done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT, newValue ? _("Activate path effect") : _("Deactivate path effect")); } } diff --git a/src/ui/dialog/session-player.cpp b/src/ui/dialog/session-player.cpp index 0e484c3f2..01560733f 100644 --- a/src/ui/dialog/session-player.cpp +++ b/src/ui/dialog/session-player.cpp @@ -171,7 +171,7 @@ SessionPlaybackDialogImpl::_respCallback(int resp) switch (result) { case Gtk::RESPONSE_OK: this->_sm->clearDocument(); - sp_document_done(sp_desktop_document(this->_desktop), SP_VERB_NONE, + SPDocumentUndo::done(sp_desktop_document(this->_desktop), SP_VERB_NONE, /* TODO: annotate */ "session-player.cpp:186"); this->_sm->loadSessionFile(sessionfiledlg.get_filename()); this->_openfile.set_text(this->_sfp->filename()); diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 7f41c4d6b..7c6ced5aa 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -117,7 +117,7 @@ void SvgFontsDialog::AttrEntry::on_attr_changed(){ Glib::ustring undokey = "svgfonts:"; undokey += name; - sp_document_maybe_done(o->document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS, + SPDocumentUndo::maybe_done(o->document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS, _("Set SVG Font attribute")); } @@ -163,7 +163,7 @@ void SvgFontsDialog::on_kerning_value_changed(){ if (!this->kerning_pair) return; SPDocument* document = sp_desktop_document(this->getDesktop()); - //TODO: I am unsure whether this is the correct way of calling sp_document_maybe_done + //TODO: I am unsure whether this is the correct way of calling SPDocumentUndo::maybe_done Glib::ustring undokey = "svgfonts:hkern:k:"; undokey += this->kerning_pair->u1->attribute_string(); undokey += ":"; @@ -171,7 +171,7 @@ void SvgFontsDialog::on_kerning_value_changed(){ //slider values increase from right to left so that they match the kerning pair preview this->kerning_pair->repr->setAttribute("k", Glib::Ascii::dtostr(get_selected_spfont()->horiz_adv_x - kerning_slider.get_value()).c_str()); - sp_document_maybe_done(document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS, _("Adjust kerning value")); + SPDocumentUndo::maybe_done(document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS, _("Adjust kerning value")); //populate_kerning_pairs_box(); kerning_preview.redraw(); @@ -462,7 +462,7 @@ void SvgFontsDialog::add_glyph(){ SPDocument* doc = sp_desktop_document(this->getDesktop()); /* SPGlyph* glyph =*/ new_glyph(doc, get_selected_spfont(), count+1); - sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add glyph")); + SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add glyph")); update_glyphs(); } @@ -506,7 +506,7 @@ void SvgFontsDialog::set_glyph_description_from_selected_path(){ return; } glyph->repr->setAttribute("d", (char*) sp_svg_write_path (pathv)); - sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves")); + SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves")); update_glyphs(); } @@ -548,7 +548,7 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){ for (obj = get_selected_spfont()->children; obj; obj=obj->next){ if (SP_IS_MISSING_GLYPH(obj)){ obj->repr->setAttribute("d", (char*) sp_svg_write_path (pathv)); - sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves")); + SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves")); } } @@ -567,7 +567,7 @@ void SvgFontsDialog::reset_missing_glyph_description(){ for (obj = get_selected_spfont()->children; obj; obj=obj->next){ if (SP_IS_MISSING_GLYPH(obj)){ obj->repr->setAttribute("d", (char*) "M0,0h1000v1024h-1000z"); - sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Reset missing-glyph")); + SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Reset missing-glyph")); } } @@ -582,7 +582,7 @@ void SvgFontsDialog::glyph_name_edit(const Glib::ustring&, const Glib::ustring& glyph->repr->setAttribute("glyph-name", str.c_str()); SPDocument* doc = sp_desktop_document(this->getDesktop()); - sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Edit glyph name")); + SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Edit glyph name")); update_glyphs(); } @@ -595,7 +595,7 @@ void SvgFontsDialog::glyph_unicode_edit(const Glib::ustring&, const Glib::ustrin glyph->repr->setAttribute("unicode", str.c_str()); SPDocument* doc = sp_desktop_document(this->getDesktop()); - sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph unicode")); + SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph unicode")); update_glyphs(); } @@ -605,7 +605,7 @@ void SvgFontsDialog::remove_selected_font(){ sp_repr_unparent(font->repr); SPDocument* doc = sp_desktop_document(this->getDesktop()); - sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove font")); + SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove font")); update_fonts(); } @@ -620,7 +620,7 @@ void SvgFontsDialog::remove_selected_glyph(){ sp_repr_unparent(glyph->repr); SPDocument* doc = sp_desktop_document(this->getDesktop()); - sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove glyph")); + SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove glyph")); update_glyphs(); } @@ -635,7 +635,7 @@ void SvgFontsDialog::remove_selected_kerning_pair(){ sp_repr_unparent(pair->repr); SPDocument* doc = sp_desktop_document(this->getDesktop()); - sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove kerning pair")); + SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove kerning pair")); update_glyphs(); } @@ -723,7 +723,7 @@ void SvgFontsDialog::add_kerning_pair(){ // get corresponding object this->kerning_pair = SP_HKERN( document->getObjectByRepr(repr) ); - sp_document_done(document, SP_VERB_DIALOG_SVG_FONTS, _("Add kerning pair")); + SPDocumentUndo::done(document, SP_VERB_DIALOG_SVG_FONTS, _("Add kerning pair")); } Gtk::VBox* SvgFontsDialog::kerning_tab(){ @@ -816,7 +816,7 @@ void set_font_family(SPFont* font, char* str){ } } - sp_document_done(font->document, SP_VERB_DIALOG_SVG_FONTS, _("Set font family")); + SPDocumentUndo::done(font->document, SP_VERB_DIALOG_SVG_FONTS, _("Set font family")); } void SvgFontsDialog::add_font(){ @@ -839,7 +839,7 @@ void SvgFontsDialog::add_font(){ update_fonts(); // select_font(font); - sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add font")); + SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add font")); } SvgFontsDialog::SvgFontsDialog() diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index d5d48a528..62682d623 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -184,7 +184,7 @@ void SwatchesPanelHook::convertGradient( GtkMenuItem * /*menuitem*/, gpointer us if ( targetName == grad->getId() ) { grad->repr->setAttribute("osb:paint", "solid"); // TODO make conditional - sp_document_done(doc, SP_VERB_CONTEXT_GRADIENT, + SPDocumentUndo::done(doc, SP_VERB_CONTEXT_GRADIENT, _("Add gradient stop")); handleGradientsChange(doc); // work-around for signal not being emitted diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index 546fdd8f0..cf29ed77f 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -344,7 +344,7 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h g_slist_free (current_row); } - sp_document_done (sp_desktop_document (desktop), SP_VERB_SELECTION_GRIDTILE, + SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_SELECTION_GRIDTILE, _("Arrange in a grid")); } diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index f74c5d6e0..62f0f38aa 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -677,7 +677,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection) } } - sp_document_done ( sp_desktop_document (selection->desktop()) , SP_VERB_DIALOG_TRANSFORM, + SPDocumentUndo::done ( sp_desktop_document (selection->desktop()) , SP_VERB_DIALOG_TRANSFORM, _("Move")); } @@ -734,7 +734,7 @@ Transformation::applyPageScale(Inkscape::Selection *selection) } } - sp_document_done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM, + SPDocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM, _("Scale")); } @@ -756,7 +756,7 @@ Transformation::applyPageRotate(Inkscape::Selection *selection) } } - sp_document_done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM, + SPDocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM, _("Rotate")); } @@ -815,7 +815,7 @@ Transformation::applyPageSkew(Inkscape::Selection *selection) } } - sp_document_done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM, + SPDocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM, _("Skew")); } @@ -842,7 +842,7 @@ Transformation::applyPageTransform(Inkscape::Selection *selection) sp_selection_apply_affine(selection, displayed); // post-multiply each object's transform } - sp_document_done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM, + SPDocumentUndo::done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM, _("Edit transformation matrix")); } diff --git a/src/ui/dialog/undo-history.cpp b/src/ui/dialog/undo-history.cpp index 8017af803..9e0922072 100644 --- a/src/ui/dialog/undo-history.cpp +++ b/src/ui/dialog/undo-history.cpp @@ -214,7 +214,7 @@ UndoHistory::_onListSelectionChange() _event_log->blockNotifications(); for ( --last ; curr_event != last ; ++curr_event ) { - sp_document_redo(_document); + SPDocumentUndo::redo(_document); } _event_log->blockNotifications(false); @@ -248,7 +248,7 @@ UndoHistory::_onListSelectionChange() while ( selected != last_selected ) { - sp_document_undo(_document); + SPDocumentUndo::undo(_document); if ( last_selected->parent() && last_selected == last_selected->parent()->children().begin() ) @@ -273,7 +273,7 @@ UndoHistory::_onListSelectionChange() while ( selected != last_selected ) { - sp_document_redo(_document); + SPDocumentUndo::redo(_document); if ( !last_selected->children().empty() ) { _event_log->setCurrEventParent(last_selected); @@ -317,10 +317,10 @@ UndoHistory::_onCollapseEvent(const Gtk::TreeModel::iterator &iter, const Gtk::T EventLog::const_iterator last = curr_event_parent->children().end(); _event_log->blockNotifications(); - sp_document_redo(_document); + SPDocumentUndo::redo(_document); for ( --last ; curr_event != last ; ++curr_event ) { - sp_document_redo(_document); + SPDocumentUndo::redo(_document); } _event_log->blockNotifications(false); diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index 2025a12d7..a455567e8 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -662,9 +662,9 @@ void MultiPathManipulator::_commit(CommitEvent cps) _selection.signal_update.emit(); invokeForAll(&PathManipulator::writeXML); if (key) { - sp_document_maybe_done(sp_desktop_document(_desktop), key, SP_VERB_CONTEXT_NODE, reason); + SPDocumentUndo::maybe_done(sp_desktop_document(_desktop), key, SP_VERB_CONTEXT_NODE, reason); } else { - sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, reason); + SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, reason); } signal_coords_changed.emit(); } @@ -673,7 +673,7 @@ void MultiPathManipulator::_commit(CommitEvent cps) void MultiPathManipulator::_done(gchar const *reason) { invokeForAll(&PathManipulator::update); invokeForAll(&PathManipulator::writeXML); - sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, reason); + SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, reason); signal_coords_changed.emit(); } diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 8e37b2c85..dec37cd1c 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1387,13 +1387,13 @@ void PathManipulator::_removeNodesFromSelection() void PathManipulator::_commit(Glib::ustring const &annotation) { writeXML(); - sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, annotation.data()); + SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_NODE, annotation.data()); } void PathManipulator::_commit(Glib::ustring const &annotation, gchar const *key) { writeXML(); - sp_document_maybe_done(sp_desktop_document(_desktop), key, SP_VERB_CONTEXT_NODE, + SPDocumentUndo::maybe_done(sp_desktop_document(_desktop), key, SP_VERB_CONTEXT_NODE, annotation.data()); } diff --git a/src/ui/widget/color-picker.cpp b/src/ui/widget/color-picker.cpp index 34cf1d5e3..48dd59685 100644 --- a/src/ui/widget/color-picker.cpp +++ b/src/ui/widget/color-picker.cpp @@ -132,7 +132,7 @@ sp_color_picker_color_mod(SPColorSelector *csel, GObject *cp) (ptr->_preview).setRgba32 (rgba); if (ptr->_undo && SP_ACTIVE_DESKTOP) - sp_document_done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_NONE, + SPDocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_NONE, /* TODO: annotate */ "color-picker.cpp:130"); ptr->on_changed (rgba); diff --git a/src/ui/widget/entity-entry.cpp b/src/ui/widget/entity-entry.cpp index e9f09f574..cc38de24f 100644 --- a/src/ui/widget/entity-entry.cpp +++ b/src/ui/widget/entity-entry.cpp @@ -96,7 +96,7 @@ EntityLineEntry::on_changed() SPDocument *doc = SP_ACTIVE_DOCUMENT; Glib::ustring text = static_cast(_packable)->get_text(); if (rdf_set_work_entity (doc, _entity, text.c_str())) - sp_document_done (doc, SP_VERB_NONE, + SPDocumentUndo::done (doc, SP_VERB_NONE, /* TODO: annotate */ "entity-entry.cpp:101"); _wr->setUpdating (false); } @@ -141,7 +141,7 @@ EntityMultiLineEntry::on_changed() Gtk::TextView *tv = static_cast(s->get_child()); Glib::ustring text = tv->get_buffer()->get_text(); if (rdf_set_work_entity (doc, _entity, text.c_str())) - sp_document_done (doc, SP_VERB_NONE, + SPDocumentUndo::done (doc, SP_VERB_NONE, /* TODO: annotate */ "entity-entry.cpp:146"); _wr->setUpdating (false); } diff --git a/src/ui/widget/layer-selector.cpp b/src/ui/widget/layer-selector.cpp index f25192b2a..da096f25d 100644 --- a/src/ui/widget/layer-selector.cpp +++ b/src/ui/widget/layer-selector.cpp @@ -583,7 +583,7 @@ void LayerSelector::_prepareLabelRenderer( void LayerSelector::_lockLayer(bool lock) { if ( _layer && SP_IS_ITEM(_layer) ) { SP_ITEM(_layer)->setLocked(lock); - sp_document_done(sp_desktop_document(_desktop), SP_VERB_NONE, + SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_NONE, lock? _("Lock layer") : _("Unlock layer")); } } @@ -591,7 +591,7 @@ void LayerSelector::_lockLayer(bool lock) { void LayerSelector::_hideLayer(bool hide) { if ( _layer && SP_IS_ITEM(_layer) ) { SP_ITEM(_layer)->setHidden(hide); - sp_document_done(sp_desktop_document(_desktop), SP_VERB_NONE, + SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_NONE, hide? _("Hide layer") : _("Unhide layer")); } } diff --git a/src/ui/widget/licensor.cpp b/src/ui/widget/licensor.cpp index a5f1d89be..a4a789840 100644 --- a/src/ui/widget/licensor.cpp +++ b/src/ui/widget/licensor.cpp @@ -64,7 +64,7 @@ LicenseItem::on_toggled() _wr.setUpdating (true); rdf_set_license (SP_ACTIVE_DOCUMENT, _lic->details ? _lic : 0); - sp_document_done (SP_ACTIVE_DOCUMENT, SP_VERB_NONE, + SPDocumentUndo::done (SP_ACTIVE_DOCUMENT, SP_VERB_NONE, /* TODO: annotate */ "licensor.cpp:65"); _wr.setUpdating (false); static_cast(_eep->_packable)->set_text (_lic->uri); diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp index bfc291bc0..f5e4657b1 100644 --- a/src/ui/widget/object-composite-settings.cpp +++ b/src/ui/widget/object-composite-settings.cpp @@ -168,7 +168,7 @@ ObjectCompositeSettings::_blendBlurValueChanged() SP_OBJECT_STYLE_MODIFIED_FLAG )); } - sp_document_maybe_done (document, _blur_tag.c_str(), _verb_code, + SPDocumentUndo::maybe_done (document, _blur_tag.c_str(), _verb_code, _("Change blur")); // resume interruptibility @@ -208,7 +208,7 @@ ObjectCompositeSettings::_opacityValueChanged() sp_repr_css_attr_unref (css); - sp_document_maybe_done (sp_desktop_document (desktop), _opacity_tag.c_str(), _verb_code, + SPDocumentUndo::maybe_done (sp_desktop_document (desktop), _opacity_tag.c_str(), _verb_code, _("Change opacity")); // resume interruptibility diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 1f70a26fd..33adc85d0 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -413,7 +413,7 @@ PageSizer::setDim (double w, double h, bool changeList) // changing the page size. The SVG's origin however is in the upper left corner, so we must compensate for this Geom::Translate const vert_offset(Geom::Point(0, (old_height - h))); SP_GROUP(SP_ROOT(doc->root))->translateChildItems(vert_offset); - sp_document_done (doc, SP_VERB_NONE, _("Set page size")); + SPDocumentUndo::done (doc, SP_VERB_NONE, _("Set page size")); } if ( w != h ) { diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index db31d08d3..16422f1b2 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -349,14 +349,14 @@ RegisteredColorPicker::on_changed (guint32 rgba) gchar c[32]; sp_svg_write_color(c, sizeof(c), rgba); - bool saved = sp_document_get_undo_sensitive (local_doc); - sp_document_set_undo_sensitive (local_doc, false); + bool saved = SPDocumentUndo::get_undo_sensitive (local_doc); + SPDocumentUndo::set_undo_sensitive (local_doc, false); local_repr->setAttribute(_ckey.c_str(), c); sp_repr_set_css_double(local_repr, _akey.c_str(), (rgba & 0xff) / 255.0); - sp_document_set_undo_sensitive (local_doc, saved); + SPDocumentUndo::set_undo_sensitive (local_doc, saved); local_doc->setModifiedSinceSave(); - sp_document_done (local_doc, SP_VERB_NONE, + SPDocumentUndo::done (local_doc, SP_VERB_NONE, /* TODO: annotate */ "registered-widget.cpp: RegisteredColorPicker::on_changed"); _wr->setUpdating (false); diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h index 7aefbb90e..dec8cd111 100644 --- a/src/ui/widget/registered-widget.h +++ b/src/ui/widget/registered-widget.h @@ -104,16 +104,16 @@ protected: local_doc = sp_desktop_document(dt); } - bool saved = sp_document_get_undo_sensitive (local_doc); - sp_document_set_undo_sensitive (local_doc, false); + bool saved = SPDocumentUndo::get_undo_sensitive (local_doc); + SPDocumentUndo::set_undo_sensitive (local_doc, false); if (!write_undo) local_repr->setAttribute(_key.c_str(), svgstr); - sp_document_set_undo_sensitive (local_doc, saved); + SPDocumentUndo::set_undo_sensitive (local_doc, saved); local_doc->setModifiedSinceSave(); if (write_undo) { local_repr->setAttribute(_key.c_str(), svgstr); - sp_document_done (local_doc, event_type, event_description); + SPDocumentUndo::done (local_doc, event_type, event_description); } } diff --git a/src/ui/widget/ruler.cpp b/src/ui/widget/ruler.cpp index 0afc0da3e..9fac48145 100644 --- a/src/ui/widget/ruler.cpp +++ b/src/ui/widget/ruler.cpp @@ -152,7 +152,7 @@ Ruler::on_button_release_event(GdkEventButton *evb) sp_repr_set_svg_double(repr, "position", guide_pos_dt); SP_OBJECT_REPR(_dt->namedview)->appendChild(repr); Inkscape::GC::release(repr); - sp_document_done(sp_desktop_document(_dt), SP_VERB_NONE, + SPDocumentUndo::done(sp_desktop_document(_dt), SP_VERB_NONE, /* TODO: annotate */ "ruler.cpp:157"); } _dt->set_coordinate_status(event_dt); diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index a8f9f9c60..9a94113eb 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -464,7 +464,7 @@ void SelectedStyle::dragDataReceived( GtkWidget */*widget*/, sp_repr_css_set_property( css, (tracker->item == SS_FILL) ? "fill":"stroke", c ); sp_desktop_set_style( tracker->parent->_desktop, css ); sp_repr_css_attr_unref( css ); - sp_document_done( sp_desktop_document(tracker->parent->_desktop) , SP_VERB_NONE, + SPDocumentUndo::done( sp_desktop_document(tracker->parent->_desktop) , SP_VERB_NONE, _("Drop color")); } } @@ -477,7 +477,7 @@ void SelectedStyle::on_fill_remove() { sp_repr_css_set_property (css, "fill", "none"); sp_desktop_set_style (_desktop, css, true, true); sp_repr_css_attr_unref (css); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, _("Remove fill")); } @@ -486,7 +486,7 @@ void SelectedStyle::on_stroke_remove() { sp_repr_css_set_property (css, "stroke", "none"); sp_desktop_set_style (_desktop, css, true, true); sp_repr_css_attr_unref (css); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, _("Remove stroke")); } @@ -495,7 +495,7 @@ void SelectedStyle::on_fill_unset() { sp_repr_css_unset_property (css, "fill"); sp_desktop_set_style (_desktop, css, true, true); sp_repr_css_attr_unref (css); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, _("Unset fill")); } @@ -511,7 +511,7 @@ void SelectedStyle::on_stroke_unset() { sp_repr_css_unset_property (css, "stroke-dasharray"); sp_desktop_set_style (_desktop, css, true, true); sp_repr_css_attr_unref (css); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, _("Unset stroke")); } @@ -520,7 +520,7 @@ void SelectedStyle::on_fill_opaque() { sp_repr_css_set_property (css, "fill-opacity", "1"); sp_desktop_set_style (_desktop, css, true); sp_repr_css_attr_unref (css); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, _("Make fill opaque")); } @@ -529,7 +529,7 @@ void SelectedStyle::on_stroke_opaque() { sp_repr_css_set_property (css, "stroke-opacity", "1"); sp_desktop_set_style (_desktop, css, true); sp_repr_css_attr_unref (css); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, _("Make fill opaque")); } @@ -541,7 +541,7 @@ void SelectedStyle::on_fill_lastused() { sp_repr_css_set_property (css, "fill", c); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, _("Apply last set color to fill")); } @@ -553,7 +553,7 @@ void SelectedStyle::on_stroke_lastused() { sp_repr_css_set_property (css, "stroke", c); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, _("Apply last set color to stroke")); } @@ -564,7 +564,7 @@ void SelectedStyle::on_fill_lastselected() { sp_repr_css_set_property (css, "fill", c); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, _("Apply last selected color to fill")); } @@ -575,7 +575,7 @@ void SelectedStyle::on_stroke_lastselected() { sp_repr_css_set_property (css, "stroke", c); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, _("Apply last selected color to stroke")); } @@ -595,7 +595,7 @@ void SelectedStyle::on_fill_invert() { sp_repr_css_set_property (css, "fill", c); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, _("Invert fill")); } @@ -615,7 +615,7 @@ void SelectedStyle::on_stroke_invert() { sp_repr_css_set_property (css, "stroke", c); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, _("Invert stroke")); } @@ -627,7 +627,7 @@ void SelectedStyle::on_fill_white() { sp_repr_css_set_property (css, "fill-opacity", "1"); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, _("White fill")); } @@ -639,7 +639,7 @@ void SelectedStyle::on_stroke_white() { sp_repr_css_set_property (css, "stroke-opacity", "1"); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, _("White stroke")); } @@ -651,7 +651,7 @@ void SelectedStyle::on_fill_black() { sp_repr_css_set_property (css, "fill-opacity", "1.0"); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, _("Black fill")); } @@ -663,7 +663,7 @@ void SelectedStyle::on_stroke_black() { sp_repr_css_set_property (css, "stroke-opacity", "1.0"); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, _("Black stroke")); } @@ -706,7 +706,7 @@ void SelectedStyle::on_fill_paste() { sp_repr_css_set_property (css, "fill", text.c_str()); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, _("Paste fill")); } } @@ -724,7 +724,7 @@ void SelectedStyle::on_stroke_paste() { sp_repr_css_set_property (css, "stroke", text.c_str()); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, _("Paste stroke")); } } @@ -778,7 +778,7 @@ void SelectedStyle::on_fillstroke_swap() { sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_FILL_STROKE, _("Swap fill and stroke")); } @@ -853,7 +853,7 @@ SelectedStyle::on_opacity_click(GdkEventButton *event) sp_repr_css_set_property (css, "opacity", opacity); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - sp_document_done (sp_desktop_document (_desktop), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done (sp_desktop_document (_desktop), SP_VERB_DIALOG_FILL_STROKE, _("Change opacity")); return true; } @@ -888,7 +888,7 @@ void SelectedStyle::on_popup_preset(int i) { // FIXME: update dash patterns! sp_desktop_set_style (_desktop, css, true); sp_repr_css_attr_unref (css); - sp_document_done (sp_desktop_document(_desktop), SP_VERB_DIALOG_SWATCHES, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_DIALOG_SWATCHES, _("Change stroke width")); } @@ -1147,7 +1147,7 @@ void SelectedStyle::on_opacity_changed () { sp_canvas_force_full_redraw_after_interruptions(sp_desktop_canvas(_desktop), 0); sp_desktop_set_style (_desktop, css); sp_repr_css_attr_unref (css); - sp_document_maybe_done (sp_desktop_document (_desktop), "fillstroke:opacity", SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::maybe_done (sp_desktop_document (_desktop), "fillstroke:opacity", SP_VERB_DIALOG_FILL_STROKE, _("Change opacity")); // resume interruptibility sp_canvas_end_forced_full_redraws(sp_desktop_canvas(_desktop)); @@ -1274,19 +1274,19 @@ RotateableSwatch::do_motion(double by, guint modifier) { if (modifier == 3) { // Alt, do nothing } else if (modifier == 2) { // saturation - sp_document_maybe_done (sp_desktop_document(parent->getDesktop()), undokey, + SPDocumentUndo::maybe_done (sp_desktop_document(parent->getDesktop()), undokey, SP_VERB_DIALOG_FILL_STROKE, (_("Adjust saturation"))); double ch = hsl[1]; parent->getDesktop()->event_context->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Adjusting saturation: was %.3g, now %.3g (diff %.3g); with Ctrl to adjust lightness, without modifiers to adjust hue"), ch - diff, ch, diff); } else if (modifier == 1) { // lightness - sp_document_maybe_done (sp_desktop_document(parent->getDesktop()), undokey, + SPDocumentUndo::maybe_done (sp_desktop_document(parent->getDesktop()), undokey, SP_VERB_DIALOG_FILL_STROKE, (_("Adjust lightness"))); double ch = hsl[2]; parent->getDesktop()->event_context->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Adjusting lightness: was %.3g, now %.3g (diff %.3g); with Shift to adjust saturation, without modifiers to adjust hue"), ch - diff, ch, diff); } else { // hue - sp_document_maybe_done (sp_desktop_document(parent->getDesktop()), undokey, + SPDocumentUndo::maybe_done (sp_desktop_document(parent->getDesktop()), undokey, SP_VERB_DIALOG_FILL_STROKE, (_("Adjust hue"))); double ch = hsl[0]; parent->getDesktop()->event_context->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Adjusting hue: was %.3g, now %.3g (diff %.3g); with Shift to adjust saturation, with Ctrl to adjust lightness"), ch - diff, ch, diff); @@ -1315,15 +1315,15 @@ RotateableSwatch::do_release(double by, guint modifier) { if (modifier == 3) { // Alt, do nothing } else if (modifier == 2) { // saturation - sp_document_maybe_done (sp_desktop_document(parent->getDesktop()), undokey, + SPDocumentUndo::maybe_done (sp_desktop_document(parent->getDesktop()), undokey, SP_VERB_DIALOG_FILL_STROKE, ("Adjust saturation")); } else if (modifier == 1) { // lightness - sp_document_maybe_done (sp_desktop_document(parent->getDesktop()), undokey, + SPDocumentUndo::maybe_done (sp_desktop_document(parent->getDesktop()), undokey, SP_VERB_DIALOG_FILL_STROKE, ("Adjust lightness")); } else { // hue - sp_document_maybe_done (sp_desktop_document(parent->getDesktop()), undokey, + SPDocumentUndo::maybe_done (sp_desktop_document(parent->getDesktop()), undokey, SP_VERB_DIALOG_FILL_STROKE, ("Adjust hue")); } @@ -1397,7 +1397,7 @@ RotateableStrokeWidth::do_motion(double by, guint modifier) { if (modifier == 3) { // Alt, do nothing } else { double diff = value_adjust(startvalue, by, modifier, false); - sp_document_maybe_done (sp_desktop_document(parent->getDesktop()), undokey, + SPDocumentUndo::maybe_done (sp_desktop_document(parent->getDesktop()), undokey, SP_VERB_DIALOG_FILL_STROKE, (_("Adjust stroke width"))); parent->getDesktop()->event_context->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Adjusting stroke width: was %.3g, now %.3g (diff %.3g)"), startvalue, startvalue + diff, diff); } @@ -1411,7 +1411,7 @@ RotateableStrokeWidth::do_release(double by, guint modifier) { } else { value_adjust(startvalue, by, modifier, true); startvalue_set = false; - sp_document_maybe_done (sp_desktop_document(parent->getDesktop()), undokey, + SPDocumentUndo::maybe_done (sp_desktop_document(parent->getDesktop()), undokey, SP_VERB_DIALOG_FILL_STROKE, (_("Adjust stroke width"))); } diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp index 3a36127f4..84c6a0de2 100644 --- a/src/ui/widget/tolerance-slider.cpp +++ b/src/ui/widget/tolerance-slider.cpp @@ -186,11 +186,11 @@ ToleranceSlider::update (double val) _wr->setUpdating (true); SPDocument *doc = sp_desktop_document(dt); - bool saved = sp_document_get_undo_sensitive (doc); - sp_document_set_undo_sensitive (doc, false); + bool saved = SPDocumentUndo::get_undo_sensitive (doc); + SPDocumentUndo::set_undo_sensitive (doc, false); Inkscape::XML::Node *repr = SP_OBJECT_REPR (sp_desktop_namedview(dt)); repr->setAttribute(_key.c_str(), os.str().c_str()); - sp_document_set_undo_sensitive (doc, saved); + SPDocumentUndo::set_undo_sensitive (doc, saved); doc->setModifiedSinceSave(); diff --git a/src/vanishing-point.cpp b/src/vanishing-point.cpp index 78ceec467..80f15fc5a 100644 --- a/src/vanishing-point.cpp +++ b/src/vanishing-point.cpp @@ -119,7 +119,7 @@ vp_knot_moved_handler (SPKnot */*knot*/, Geom::Point const *ppointer, guint stat } // FIXME: Do we need to create a new dragger as well? dragger->updateZOrders (); - sp_document_done (sp_desktop_document (inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX, + SPDocumentUndo::done (sp_desktop_document (inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX, _("Split vanishing points")); return; } @@ -164,7 +164,7 @@ vp_knot_moved_handler (SPKnot */*knot*/, Geom::Point const *ppointer, guint stat // deleted according to changes in the svg representation, not based on any user input // as is currently the case. - sp_document_done (sp_desktop_document (inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX, + SPDocumentUndo::done (sp_desktop_document (inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX, _("Merge vanishing points")); return; @@ -220,7 +220,7 @@ vp_knot_ungrabbed_handler (SPKnot *knot, guint /*state*/, gpointer data) // TODO: Undo machinery!! g_return_if_fail (dragger->parent); g_return_if_fail (dragger->parent->document); - sp_document_done(dragger->parent->document, SP_VERB_CONTEXT_3DBOX, + SPDocumentUndo::done(dragger->parent->document, SP_VERB_CONTEXT_3DBOX, _("3D box: Move vanishing point")); } diff --git a/src/verbs.cpp b/src/verbs.cpp index 24c17aad8..300fe7494 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -1098,7 +1098,7 @@ LayerVerb::perform(SPAction *action, void *data, void */*pdata*/) SPObject *next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer()); if (next) { dt->setCurrentLayer(next); - sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_NEXT, + SPDocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_NEXT, _("Switch to next layer")); dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Switched to next layer.")); } else { @@ -1110,7 +1110,7 @@ LayerVerb::perform(SPAction *action, void *data, void */*pdata*/) SPObject *prev=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer()); if (prev) { dt->setCurrentLayer(prev); - sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_PREV, + SPDocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_PREV, _("Switch to previous layer")); dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Switched to previous layer.")); } else { @@ -1176,7 +1176,7 @@ LayerVerb::perform(SPAction *action, void *data, void */*pdata*/) description = _("Lower layer"); break; }; - sp_document_done(sp_desktop_document(dt), verb, description); + SPDocumentUndo::done(sp_desktop_document(dt), verb, description); if (message) { dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, message); g_free((void *) message); @@ -1221,7 +1221,7 @@ LayerVerb::perform(SPAction *action, void *data, void */*pdata*/) dt->setCurrentLayer(new_layer); } #endif - sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_DUPLICATE, + SPDocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_DUPLICATE, _("Duplicate layer")); // TRANSLATORS: this means "The layer has been duplicated." @@ -1253,7 +1253,7 @@ LayerVerb::perform(SPAction *action, void *data, void */*pdata*/) dt->setCurrentLayer(survivor); } - sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_DELETE, + SPDocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_DELETE, _("Delete layer")); // TRANSLATORS: this means "The layer has been deleted." @@ -1268,7 +1268,7 @@ LayerVerb::perform(SPAction *action, void *data, void */*pdata*/) dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer.")); } else { dt->toggleLayerSolo( dt->currentLayer() ); - sp_document_maybe_done(sp_desktop_document(dt), "layer:solo", SP_VERB_LAYER_SOLO, _("Toggle layer solo")); + SPDocumentUndo::maybe_done(sp_desktop_document(dt), "layer:solo", SP_VERB_LAYER_SOLO, _("Toggle layer solo")); } break; } @@ -1328,12 +1328,12 @@ ObjectVerb::perform( SPAction *action, void *data, void */*pdata*/ ) break; case SP_VERB_OBJECT_FLIP_HORIZONTAL: sp_selection_scale_relative(sel, center, Geom::Scale(-1.0, 1.0)); - sp_document_done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_HORIZONTAL, + SPDocumentUndo::done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_HORIZONTAL, _("Flip horizontally")); break; case SP_VERB_OBJECT_FLIP_VERTICAL: sp_selection_scale_relative(sel, center, Geom::Scale(1.0, -1.0)); - sp_document_done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_VERTICAL, + SPDocumentUndo::done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_VERTICAL, _("Flip vertically")); break; case SP_VERB_OBJECT_SET_MASK: @@ -2162,19 +2162,19 @@ LockAndHideVerb::perform(SPAction *action, void *data, void */*pdata*/) switch (reinterpret_cast(data)) { case SP_VERB_UNLOCK_ALL: unlock_all(dt); - sp_document_done(doc, SP_VERB_UNLOCK_ALL, _("Unlock all objects in the current layer")); + SPDocumentUndo::done(doc, SP_VERB_UNLOCK_ALL, _("Unlock all objects in the current layer")); break; case SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS: unlock_all_in_all_layers(dt); - sp_document_done(doc, SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS, _("Unlock all objects in all layers")); + SPDocumentUndo::done(doc, SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS, _("Unlock all objects in all layers")); break; case SP_VERB_UNHIDE_ALL: unhide_all(dt); - sp_document_done(doc, SP_VERB_UNHIDE_ALL, _("Unhide all objects in the current layer")); + SPDocumentUndo::done(doc, SP_VERB_UNHIDE_ALL, _("Unhide all objects in the current layer")); break; case SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS: unhide_all_in_all_layers(dt); - sp_document_done(doc, SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS, _("Unhide all objects in all layers")); + SPDocumentUndo::done(doc, SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS, _("Unhide all objects in all layers")); break; default: return; diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp index 5a7256d83..e4db09c90 100644 --- a/src/widgets/fill-style.cpp +++ b/src/widgets/fill-style.cpp @@ -332,7 +332,7 @@ void FillNStroke::setFillrule( SPPaintSelector::FillRule mode ) sp_repr_css_attr_unref(css); css = 0; - sp_document_done(desktop->doc(), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done(desktop->doc(), SP_VERB_DIALOG_FILL_STROKE, _("Change fill rule")); } } @@ -417,7 +417,7 @@ void FillNStroke::dragFromPaint() // local change, do not update from selection dragId = g_timeout_add_full(G_PRIORITY_DEFAULT, 100, dragDelayCB, this, 0); psel->setFlatColor( desktop, (kind == FILL) ? "fill" : "stroke", (kind == FILL) ? "fill-opacity" : "stroke-opacity" ); - sp_document_maybe_done(desktop->doc(), (kind == FILL) ? undo_F_label : undo_S_label, SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::maybe_done(desktop->doc(), (kind == FILL) ? undo_F_label : undo_S_label, SP_VERB_DIALOG_FILL_STROKE, (kind == FILL) ? _("Set fill color") : _("Set stroke color")); break; } @@ -480,7 +480,7 @@ void FillNStroke::updateFromPaint() sp_repr_css_attr_unref(css); css = 0; - sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE, (kind == FILL) ? _("Remove fill") : _("Remove stroke")); break; } @@ -496,7 +496,7 @@ void FillNStroke::updateFromPaint() psel->setFlatColor( desktop, (kind == FILL) ? "fill" : "stroke", (kind == FILL) ? "fill-opacity" : "stroke-opacity" ); - sp_document_maybe_done(sp_desktop_document(desktop), (kind == FILL) ? undo_F_label : undo_S_label, SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::maybe_done(sp_desktop_document(desktop), (kind == FILL) ? undo_F_label : undo_S_label, SP_VERB_DIALOG_FILL_STROKE, (kind == FILL) ? _("Set fill color") : _("Set stroke color")); if (kind == FILL) { @@ -583,7 +583,7 @@ void FillNStroke::updateFromPaint() css = 0; } - sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE, (kind == FILL) ? _("Set gradient on fill") : _("Set gradient on stroke")); } break; @@ -643,7 +643,7 @@ void FillNStroke::updateFromPaint() } // end if - sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE, (kind == FILL) ? _("Set pattern on fill") : _("Set pattern on stroke")); } // end if @@ -670,7 +670,7 @@ void FillNStroke::updateFromPaint() sp_repr_css_attr_unref(css); css = 0; - sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE, (kind == FILL) ? _("Unset fill") : _("Unset stroke")); } break; diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp index fe003319f..a55439908 100644 --- a/src/widgets/gradient-toolbar.cpp +++ b/src/widgets/gradient-toolbar.cpp @@ -151,7 +151,7 @@ gr_item_activate (GtkMenuItem *menuitem, gpointer data) gr_apply_gradient (selection, ev? ev->get_drag() : NULL, gr); - sp_document_done (sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT, + SPDocumentUndo::done (sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT, _("Assign gradient to object")); } diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp index 132aff455..d8bbcd788 100644 --- a/src/widgets/gradient-vector.cpp +++ b/src/widgets/gradient-vector.cpp @@ -363,7 +363,7 @@ static void sp_gvs_gradient_activate(GtkMenuItem *mi, SPGradientVectorSelector * /* We do extra undo push here */ /* If handler has already done it, it is just NOP */ // FIXME: looks like this is never a valid undo step, consider removing this - sp_document_done(SP_OBJECT_DOCUMENT(norm), SP_VERB_CONTEXT_GRADIENT, + SPDocumentUndo::done(SP_OBJECT_DOCUMENT(norm), SP_VERB_CONTEXT_GRADIENT, /* TODO: annotate */ "gradient-vector.cpp:350"); } } @@ -666,7 +666,7 @@ static void offadjustmentChanged( GtkAdjustment *adjustment, GtkWidget *vb) stop->offset = adjustment->value; sp_repr_set_css_double(SP_OBJECT_REPR(stop), "offset", stop->offset); - sp_document_done(SP_OBJECT_DOCUMENT(stop), SP_VERB_CONTEXT_GRADIENT, + SPDocumentUndo::done(SP_OBJECT_DOCUMENT(stop), SP_VERB_CONTEXT_GRADIENT, _("Change gradient stop offset")); blocked = FALSE; @@ -739,7 +739,7 @@ static void sp_grd_ed_add_stop(GtkWidget */*widget*/, GtkWidget *vb) GtkWidget *offslide =GTK_WIDGET(g_object_get_data(G_OBJECT(vb), "offslide")); gtk_widget_set_sensitive(offslide, TRUE); gtk_widget_set_sensitive(GTK_WIDGET(offspin), TRUE); - sp_document_done(SP_OBJECT_DOCUMENT(gradient), SP_VERB_CONTEXT_GRADIENT, + SPDocumentUndo::done(SP_OBJECT_DOCUMENT(gradient), SP_VERB_CONTEXT_GRADIENT, _("Add gradient stop")); } @@ -770,7 +770,7 @@ static void sp_grd_ed_del_stop(GtkWidget */*widget*/, GtkWidget *vb) SP_OBJECT_REPR(gradient)->removeChild(SP_OBJECT_REPR(stop)); sp_gradient_vector_widget_load_gradient(vb, gradient); update_stop_list(GTK_WIDGET(mnu), gradient, NULL); - sp_document_done(SP_OBJECT_DOCUMENT(gradient), SP_VERB_CONTEXT_GRADIENT, + SPDocumentUndo::done(SP_OBJECT_DOCUMENT(gradient), SP_VERB_CONTEXT_GRADIENT, _("Delete gradient stop")); } @@ -1040,10 +1040,10 @@ static void sp_gradient_vector_widget_load_gradient(GtkWidget *widget, SPGradien // Once the user edits a gradient, it stops being auto-collectable if (SP_OBJECT_REPR(gradient)->attribute("inkscape:collect")) { SPDocument *document = SP_OBJECT_DOCUMENT(gradient); - bool saved = sp_document_get_undo_sensitive(document); - sp_document_set_undo_sensitive(document, false); + bool saved = SPDocumentUndo::get_undo_sensitive(document); + SPDocumentUndo::set_undo_sensitive(document, false); SP_OBJECT_REPR(gradient)->setAttribute("inkscape:collect", NULL); - sp_document_set_undo_sensitive(document, saved); + SPDocumentUndo::set_undo_sensitive(document, saved); } } else { // no gradient, disable everything gtk_widget_set_sensitive(widget, FALSE); @@ -1197,7 +1197,7 @@ static void sp_gradient_vector_color_changed(SPColorSelector *csel, GtkObject *o // g_snprintf(c, 256, "stop-color:#%06x;stop-opacity:%g;", rgb >> 8, static_cast(alpha)); //SP_OBJECT_REPR(stop)->setAttribute("style", c); - sp_document_done(SP_OBJECT_DOCUMENT(ngr), SP_VERB_CONTEXT_GRADIENT, + SPDocumentUndo::done(SP_OBJECT_DOCUMENT(ngr), SP_VERB_CONTEXT_GRADIENT, _("Change gradient stop color")); blocked = FALSE; diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp index 487e3a274..a5bf81821 100644 --- a/src/widgets/select-toolbar.cpp +++ b/src/widgets/select-toolbar.cpp @@ -243,7 +243,7 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw) Geom::Matrix scaler = get_scale_transform_with_stroke (*bbox, strokewidth, transform_stroke, x0, y0, x1, y1); sp_selection_apply_affine(selection, scaler); - sp_document_maybe_done (document, actionkey, SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::maybe_done (document, actionkey, SP_VERB_CONTEXT_SELECT, _("Transform by toolbar")); // resume interruptibility diff --git a/src/widgets/sp-attribute-widget.cpp b/src/widgets/sp-attribute-widget.cpp index de14fc173..8a46001b1 100644 --- a/src/widgets/sp-attribute-widget.cpp +++ b/src/widgets/sp-attribute-widget.cpp @@ -154,7 +154,7 @@ sp_attribute_widget_changed (GtkEditable *editable) if (spaw->hasobj && spaw->src.object) { SP_OBJECT_REPR (spaw->src.object)->setAttribute(spaw->attribute, text, false); - sp_document_done (SP_OBJECT_DOCUMENT (spaw->src.object), SP_VERB_NONE, + SPDocumentUndo::done (SP_OBJECT_DOCUMENT (spaw->src.object), SP_VERB_NONE, _("Set attribute")); } else if (spaw->src.repr) { @@ -761,7 +761,7 @@ sp_attribute_table_entry_changed ( GtkEditable *editable, if (spat->hasobj && spat->src.object) { SP_OBJECT_REPR (spat->src.object)->setAttribute(spat->attributes[i], text, false); - sp_document_done (SP_OBJECT_DOCUMENT (spat->src.object), SP_VERB_NONE, + SPDocumentUndo::done (SP_OBJECT_DOCUMENT (spat->src.object), SP_VERB_NONE, _("Set attribute")); } else if (spat->src.repr) { diff --git a/src/widgets/sp-xmlview-content.cpp b/src/widgets/sp-xmlview-content.cpp index 7150b07fd..239f6e6e1 100644 --- a/src/widgets/sp-xmlview-content.cpp +++ b/src/widgets/sp-xmlview-content.cpp @@ -165,7 +165,7 @@ sp_xmlview_content_changed (GtkTextBuffer *tb, SPXMLViewContent *text) text->repr->setContent(data); g_free (data); text->blocked = FALSE; - sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_XML_EDITOR, + SPDocumentUndo::done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_XML_EDITOR, _("Type text in a text node")); } } diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index 1843c8edb..0d7b95f4c 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -498,7 +498,7 @@ sp_marker_select(Gtk::OptionMenu *mnu, Gtk::Container *spw, SPMarkerLoc const wh sp_repr_css_attr_unref(css); css = 0; - sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE, _("Set markers")); }; @@ -1203,7 +1203,7 @@ sp_stroke_style_scale_line(Gtk::Container *spw) sp_repr_css_attr_unref(css); css = 0; - sp_document_done(document, SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done(document, SP_VERB_DIALOG_FILL_STROKE, _("Set stroke style")); spw->set_data("update", GINT_TO_POINTER(FALSE)); @@ -1300,7 +1300,7 @@ sp_stroke_style_any_toggled(Gtk::ToggleButton *tb, Gtk::Container *spw) sp_repr_css_attr_unref(css); css = 0; - sp_document_done(sp_desktop_document(desktop), SP_VERB_DIALOG_FILL_STROKE, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_DIALOG_FILL_STROKE, _("Set stroke style")); } } diff --git a/src/widgets/swatch-selector.cpp b/src/widgets/swatch-selector.cpp index ce0f8a810..b1329b92a 100644 --- a/src/widgets/swatch-selector.cpp +++ b/src/widgets/swatch-selector.cpp @@ -135,7 +135,7 @@ void SwatchSelector::_changedCb(SPColorSelector */*csel*/, void *data) os << "stop-color:" << c << ";stop-opacity:" << static_cast(alpha) <<";"; SP_OBJECT_REPR(stop)->setAttribute("style", os.str().c_str()); - sp_document_done(SP_OBJECT_DOCUMENT(ngr), SP_VERB_CONTEXT_GRADIENT, + SPDocumentUndo::done(SP_OBJECT_DOCUMENT(ngr), SP_VERB_CONTEXT_GRADIENT, _("Change swatch color")); } } diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index c255e087b..29e735536 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -1270,7 +1270,7 @@ static void sp_node_path_value_changed(GtkAdjustment *adj, GObject *tbl, Geom::D UnitTracker* tracker = reinterpret_cast(g_object_get_data( tbl, "tracker" )); SPUnit const *unit = tracker->getActiveUnit(); - if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) { + if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) { prefs->setDouble(Glib::ustring("/tools/nodes/") + (d == Geom::X ? "x" : "y"), sp_units_get_pixels(adj->value, *unit)); } @@ -2051,8 +2051,8 @@ static void toggle_snap_callback(GtkToggleAction *act, gpointer data) //data poi return; } - bool saved = sp_document_get_undo_sensitive(doc); - sp_document_set_undo_sensitive(doc, false); + bool saved = SPDocumentUndo::get_undo_sensitive(doc); + SPDocumentUndo::set_undo_sensitive(doc, false); bool v = false; SPAttributeEnum attr = (SPAttributeEnum) GPOINTER_TO_INT(g_object_get_data(G_OBJECT(act), "SP_ATTR_INKSCAPE")); @@ -2137,7 +2137,7 @@ static void toggle_snap_callback(GtkToggleAction *act, gpointer data) //data poi // The snapping preferences are stored in the document, and therefore toggling makes the document dirty doc->setModifiedSinceSave(); - sp_document_set_undo_sensitive(doc, saved); + SPDocumentUndo::set_undo_sensitive(doc, saved); } void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) @@ -2491,7 +2491,7 @@ static void sp_stb_magnitude_value_changed( GtkAdjustment *adj, GObject *dataKlu { SPDesktop *desktop = (SPDesktop *) g_object_get_data( dataKludge, "desktop" ); - if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) { + if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) { // do not remember prefs if this call is initiated by an undo change, because undoing object // creation sets bogus values to its attributes before it is deleted Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -2522,7 +2522,7 @@ static void sp_stb_magnitude_value_changed( GtkAdjustment *adj, GObject *dataKlu } } if (modmade) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, _("Star: Change number of corners")); } @@ -2533,7 +2533,7 @@ static void sp_stb_proportion_value_changed( GtkAdjustment *adj, GObject *dataKl { SPDesktop *desktop = (SPDesktop *) g_object_get_data( dataKludge, "desktop" ); - if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) { + if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) { if (!IS_NAN(adj->value)) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble("/tools/shapes/star/proportion", adj->value); @@ -2569,7 +2569,7 @@ static void sp_stb_proportion_value_changed( GtkAdjustment *adj, GObject *dataKl } if (modmade) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, _("Star: Change spoke ratio")); } @@ -2581,7 +2581,7 @@ static void sp_stb_sides_flat_state_changed( EgeSelectOneAction *act, GObject *d SPDesktop *desktop = (SPDesktop *) g_object_get_data( dataKludge, "desktop" ); bool flat = ege_select_one_action_get_active( act ) == 0; - if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) { + if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setBool( "/tools/shapes/star/isflatsided", flat); } @@ -2613,7 +2613,7 @@ static void sp_stb_sides_flat_state_changed( EgeSelectOneAction *act, GObject *d } if (modmade) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, flat ? _("Make polygon") : _("Make star")); } @@ -2624,7 +2624,7 @@ static void sp_stb_rounded_value_changed( GtkAdjustment *adj, GObject *dataKludg { SPDesktop *desktop = (SPDesktop *) g_object_get_data( dataKludge, "desktop" ); - if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) { + if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble("/tools/shapes/star/rounded", (gdouble) adj->value); } @@ -2650,7 +2650,7 @@ static void sp_stb_rounded_value_changed( GtkAdjustment *adj, GObject *dataKludg } } if (modmade) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, _("Star: Change rounding")); } @@ -2661,7 +2661,7 @@ static void sp_stb_randomized_value_changed( GtkAdjustment *adj, GObject *dataKl { SPDesktop *desktop = (SPDesktop *) g_object_get_data( dataKludge, "desktop" ); - if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) { + if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble("/tools/shapes/star/randomized", (gdouble) adj->value); } @@ -2687,7 +2687,7 @@ static void sp_stb_randomized_value_changed( GtkAdjustment *adj, GObject *dataKl } } if (modmade) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, _("Star: Change randomization")); } @@ -3026,7 +3026,7 @@ static void sp_rtb_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const * UnitTracker* tracker = reinterpret_cast(g_object_get_data( tbl, "tracker" )); SPUnit const *unit = tracker->getActiveUnit(); - if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) { + if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble(Glib::ustring("/tools/shapes/rect/") + value_name, sp_units_get_pixels(adj->value, *unit)); } @@ -3055,7 +3055,7 @@ static void sp_rtb_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const * sp_rtb_sensitivize( tbl ); if (modmade) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_RECT, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_RECT, _("Change rectangle")); } @@ -3423,7 +3423,7 @@ static void box3d_persp_tb_event_attr_changed(Inkscape::XML::Node *repr, } // set freeze so that it can be caught in box3d_angle_z_value_changed() (to avoid calling - // sp_document_maybe_done() when the document is undo insensitive) + // SPDocumentUndo::maybe_done() when the document is undo insensitive) g_object_set_data(G_OBJECT(tbl), "freeze", GINT_TO_POINTER(TRUE)); // TODO: Only update the appropriate part of the toolbar @@ -3507,7 +3507,7 @@ static void box3d_angle_value_changed(GtkAdjustment *adj, GObject *dataKludge, P SP_OBJECT(persp)->updateRepr(); // TODO: use the correct axis here, too - sp_document_maybe_done(document, "perspangle", SP_VERB_CONTEXT_3DBOX, _("3D Box: Change perspective (angle of infinite axis)")); + SPDocumentUndo::maybe_done(document, "perspangle", SP_VERB_CONTEXT_3DBOX, _("3D Box: Change perspective (angle of infinite axis)")); g_object_set_data( dataKludge, "freeze", GINT_TO_POINTER(FALSE) ); } @@ -3702,7 +3702,7 @@ static void sp_spl_tb_value_changed(GtkAdjustment *adj, GObject *tbl, Glib::ustr { SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" ); - if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) { + if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble("/tools/shapes/spiral/" + value_name, adj->value); } @@ -3733,7 +3733,7 @@ static void sp_spl_tb_value_changed(GtkAdjustment *adj, GObject *tbl, Glib::ustr g_free(namespaced_name); if (modmade) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SPIRAL, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SPIRAL, _("Change spiral")); } @@ -5296,7 +5296,7 @@ sp_arctb_startend_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *v { SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" ); - if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) { + if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setDouble(Glib::ustring("/tools/shapes/arc/") + value_name, adj->value); } @@ -5344,7 +5344,7 @@ sp_arctb_startend_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *v sp_arctb_sensitivize( tbl, adj->value, other->value ); if (modmade) { - sp_document_maybe_done(sp_desktop_document(desktop), value_name, SP_VERB_CONTEXT_ARC, + SPDocumentUndo::maybe_done(sp_desktop_document(desktop), value_name, SP_VERB_CONTEXT_ARC, _("Arc: Change start/end")); } @@ -5366,7 +5366,7 @@ static void sp_arctb_end_value_changed(GtkAdjustment *adj, GObject *tbl) static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl ) { SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" ); - if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) { + if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setBool("/tools/shapes/arc/open", ege_select_one_action_get_active(act) != 0); } @@ -5408,7 +5408,7 @@ static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl ) } if (modmade) { - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ARC, + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ARC, _("Arc: Change open/closed")); } @@ -5739,7 +5739,7 @@ static void sp_lpetool_mode_changed(EgeSelectOneAction *act, GObject *tbl) SP_LPETOOL_CONTEXT(desktop->event_context)->mode = type; } - if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) { + if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setInt( "/tools/lpetool/mode", mode ); } @@ -6076,7 +6076,7 @@ static void sp_erasertb_mode_changed( EgeSelectOneAction *act, GObject *tbl ) { SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" ); bool eraserMode = ege_select_one_action_get_active( act ) != 0; - if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) { + if (SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop))) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setBool( "/tools/eraser/mode", eraserMode ); } @@ -6376,7 +6376,7 @@ static void sp_text_fontfamily_value_changed( Ink_ComboBoxEntry_Action *act, GOb g_free (family); // Save for undo - sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, _("Text: Change font family")); sp_repr_css_attr_unref (css); @@ -6423,7 +6423,7 @@ static void sp_text_fontsize_value_changed( Ink_ComboBoxEntry_Action *act, GObje sp_desktop_set_style (desktop, css, true, true); // Save for undo - sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:size", SP_VERB_NONE, + SPDocumentUndo::maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:size", SP_VERB_NONE, _("Text: Change font size")); // If no selected objects, set default. @@ -6569,7 +6569,7 @@ static void sp_text_style_changed( InkToggleAction* act, GObject *tbl ) // Do we need to update other CSS values? SPDesktop *desktop = SP_ACTIVE_DESKTOP; sp_desktop_set_style (desktop, css, true, true); - sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, _("Text: Change font style")); sp_repr_css_attr_unref (css); @@ -6646,7 +6646,7 @@ static void sp_text_script_changed( InkToggleAction* act, GObject *tbl ) sp_desktop_set_style (desktop, css, true, false); // Save for undo - sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:script", SP_VERB_NONE, + SPDocumentUndo::maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:script", SP_VERB_NONE, _("Text: Change superscript or subscript")); g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); @@ -6790,7 +6790,7 @@ static void sp_text_align_mode_changed( EgeSelectOneAction *act, GObject *tbl ) sp_style_unref(query); sp_desktop_set_style (desktop, css, true, true); - sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, _("Text: Change alignment")); sp_repr_css_attr_unref (css); @@ -6829,7 +6829,7 @@ static void sp_text_lineheight_value_changed( GtkAdjustment *adj, GObject *tbl ) } // Save for undo - sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:line-height", SP_VERB_NONE, + SPDocumentUndo::maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:line-height", SP_VERB_NONE, _("Text: Change line-height")); // If no selected objects, set default. @@ -6868,7 +6868,7 @@ static void sp_text_wordspacing_value_changed( GtkAdjustment *adj, GObject *tbl sp_desktop_set_style (desktop, css, true, false); // Save for undo - sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:word-spacing", SP_VERB_NONE, + SPDocumentUndo::maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:word-spacing", SP_VERB_NONE, _("Text: Change word-spacing")); // If no selected objects, set default. @@ -6907,7 +6907,7 @@ static void sp_text_letterspacing_value_changed( GtkAdjustment *adj, GObject *tb sp_desktop_set_style (desktop, css, true, false); // Save for undo - sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:letter-spacing", SP_VERB_NONE, + SPDocumentUndo::maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:letter-spacing", SP_VERB_NONE, _("Text: Change letter-spacing")); // If no selected objects, set default. @@ -6952,7 +6952,7 @@ static void sp_text_dx_value_changed( GtkAdjustment *adj, GObject *tbl ) } // Save for undo - sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:dx", SP_VERB_NONE, + SPDocumentUndo::maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:dx", SP_VERB_NONE, _("Text: Change dx (kern)")); g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); @@ -6983,7 +6983,7 @@ static void sp_text_dy_value_changed( GtkAdjustment *adj, GObject *tbl ) } // Save for undo - sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:dy", SP_VERB_NONE, + SPDocumentUndo::maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:dy", SP_VERB_NONE, _("Text: Change dy")); g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); @@ -7014,7 +7014,7 @@ static void sp_text_rotation_value_changed( GtkAdjustment *adj, GObject *tbl ) } // Save for undo - sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:rotate", SP_VERB_NONE, + SPDocumentUndo::maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:rotate", SP_VERB_NONE, _("Text: Change rotate")); g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); @@ -7059,7 +7059,7 @@ static void sp_text_orientation_mode_changed( EgeSelectOneAction *act, GObject * } sp_desktop_set_style (SP_ACTIVE_DESKTOP, css, true, true); - sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, + SPDocumentUndo::done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT, _("Text: Change orientation")); sp_repr_css_attr_unref (css); @@ -7869,7 +7869,7 @@ static void sp_connector_orthogonal_toggled( GtkToggleAction* act, GObject *tbl Inkscape::Selection * selection = sp_desktop_selection(desktop); SPDocument *doc = sp_desktop_document(desktop); - if (!sp_document_get_undo_sensitive(doc)) { + if (!SPDocumentUndo::get_undo_sensitive(doc)) { return; } @@ -7906,7 +7906,7 @@ static void sp_connector_orthogonal_toggled( GtkToggleAction* act, GObject *tbl prefs->setBool("/tools/connector/orthogonal", is_orthog); } - sp_document_done(doc, SP_VERB_CONTEXT_CONNECTOR, + SPDocumentUndo::done(doc, SP_VERB_CONTEXT_CONNECTOR, is_orthog ? _("Set connector type: orthogonal"): _("Set connector type: polyline")); g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); @@ -7918,7 +7918,7 @@ static void connector_curvature_changed(GtkAdjustment *adj, GObject* tbl) Inkscape::Selection * selection = sp_desktop_selection(desktop); SPDocument *doc = sp_desktop_document(desktop); - if (!sp_document_get_undo_sensitive(doc)) { + if (!SPDocumentUndo::get_undo_sensitive(doc)) { return; } @@ -7954,7 +7954,7 @@ static void connector_curvature_changed(GtkAdjustment *adj, GObject* tbl) prefs->setDouble(Glib::ustring("/tools/connector/curvature"), newValue); } - sp_document_done(doc, SP_VERB_CONTEXT_CONNECTOR, + SPDocumentUndo::done(doc, SP_VERB_CONTEXT_CONNECTOR, _("Change connector curvature")); g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); @@ -7966,7 +7966,7 @@ static void connector_spacing_changed(GtkAdjustment *adj, GObject* tbl) SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" ); SPDocument *doc = sp_desktop_document(desktop); - if (!sp_document_get_undo_sensitive(doc)) { + if (!SPDocumentUndo::get_undo_sensitive(doc)) { return; } @@ -8002,7 +8002,7 @@ static void connector_spacing_changed(GtkAdjustment *adj, GObject* tbl) g_slist_free(items); } - sp_document_done(doc, SP_VERB_CONTEXT_CONNECTOR, + SPDocumentUndo::done(doc, SP_VERB_CONTEXT_CONNECTOR, _("Change connector spacing")); g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); @@ -8023,7 +8023,7 @@ static void sp_connector_graph_layout(void) prefs->setInt("/options/clonecompensation/value", saved_compensation); - sp_document_done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Arrange connector network")); + SPDocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Arrange connector network")); } static void sp_directed_graph_layout_toggled( GtkToggleAction* act, GtkObject * /*tbl*/ )