diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp
index 6a796b2ed01504dcfb96a669e27000fc1ebd1b90..bec3c5cbff27f23c51bd27e83da0d13fad7c6c6c 100644 (file)
--- a/src/path-chemistry.cpp
+++ b/src/path-chemistry.cpp
-#define __SP_PATH_CHEMISTRY_C__
-
/*
* Here are handlers for modifying selections, specific to paths
*
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Jasper van de Gronde <th.v.d.gronde@hccnet.nl>
+ * Jon A. Cruz <jon@joncruz.org>
+ * Abhishek Sharma
*
* Copyright (C) 1999-2008 Authors
* Copyright (C) 2001-2002 Ximian, Inc.
#include "selection-chemistry.h"
#include "path-chemistry.h"
+using Inkscape::DocumentUndo;
+
void
sp_selected_path_combine(SPDesktop *desktop)
{
SP_OBJECT(first)->deleteObject(false);
// delete the topmost.
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
+ Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
Inkscape::XML::Node *repr = xml_doc->createElement("svg:path");
// restore id, transform, path effect, and style
repr->setAttribute("id", id);
- if (transform) repr->setAttribute("transform", transform);
+ if (transform) {
+ repr->setAttribute("transform", transform);
+ }
repr->setAttribute("style", style);
g_free(style);
// set path data corresponding to new curve
gchar *dstring = sp_svg_write_path(curve->get_pathvector());
curve->unref();
- if (path_effect)
+ if (path_effect) {
repr->setAttribute("inkscape:original-d", dstring);
- else
+ } else {
repr->setAttribute("d", dstring);
+ }
g_free(dstring);
// add the new group to the parent of the topmost
// 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,
- _("Combine"));
+ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_COMBINE,
+ _("Combine"));
selection->set(repr);
gint pos = SP_OBJECT_REPR(item)->position();
char const *id = SP_OBJECT_REPR(item)->attribute("id");
- gchar *style = g_strdup(SP_OBJECT(item)->repr->attribute("style"));
- gchar *path_effect = g_strdup(SP_OBJECT(item)->repr->attribute("inkscape:path-effect"));
+ // XML Tree being used directly here while it shouldn't be...
+ gchar *style = g_strdup(SP_OBJECT(item)->getRepr()->attribute("style"));
+ // XML Tree being used directly here while it shouldn't be...
+ gchar *path_effect = g_strdup(SP_OBJECT(item)->getRepr()->attribute("inkscape:path-effect"));
Geom::PathVector apv = curve->get_pathvector() * SP_ITEM(path)->transform;
desktop->clearWaitingCursor();
if (did) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_BREAK_APART,
- _("Break apart"));
+ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_BREAK_APART,
+ _("Break apart"));
} else {
sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("<b>No path(s)</b> to break apart in the selection."));
}
if (interactive) {
desktop->clearWaitingCursor();
if (did) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_OBJECT_TO_CURVE,
- _("Object to path"));
+ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_OBJECT_TO_CURVE,
+ _("Object to path"));
} else {
sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("<b>No objects</b> to convert to path in the selection."));
return;
SPCurve *curve = NULL;
if (SP_IS_SHAPE(item)) {
- curve = sp_shape_get_curve(SP_SHAPE(item));
+ curve = SP_SHAPE(item)->getCurve();
}
if (!curve)
desktop->clearWaitingCursor();
if (did) {
- sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_REVERSE,
- _("Reverse path"));
+ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_REVERSE,
+ _("Reverse path"));
} else {
sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("<b>No paths</b> to reverse in the selection."));
}