diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index d9ac792b3d680020d0896334b0e1223fb4761e23..5f32e591ef906ab4b90c1dfd43a5060f6ef3e594 100644 (file)
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
-#define __SP_LIVAROT_C__
/*
* splivarot.cpp
* Inkscape
#include "splivarot.h"
+using Inkscape::DocumentUndo;
+
bool Ancetre(Inkscape::XML::Node *a, Inkscape::XML::Node *who);
void sp_selected_path_boolop(SPDesktop *desktop, bool_op bop, const unsigned int verb=SP_VERB_NONE, const Glib::ustring description="");
@@ -419,8 +420,8 @@ sp_selected_path_boolop(SPDesktop *desktop, bool_op bop, const unsigned int verb
{
SP_OBJECT(l->data)->deleteObject();
}
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE,
- description);
+ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE,
+ description);
selection->clear();
delete res;
@@ -513,7 +514,7 @@ sp_selected_path_boolop(SPDesktop *desktop, bool_op bop, const unsigned int verb
for (int i=0;i<nbRP;i++) {
gchar *d = resPath[i]->svg_dump_path();
- 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");
repr->setAttribute("style", style);
if (mask)
@@ -559,7 +560,7 @@ sp_selected_path_boolop(SPDesktop *desktop, bool_op bop, const unsigned int verb
} else {
gchar *d = res->svg_dump_path();
- 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");
repr->setAttribute("style", style);
@@ -593,7 +594,7 @@ sp_selected_path_boolop(SPDesktop *desktop, bool_op bop, const unsigned int verb
if (desc) g_free(desc);
if (verb != SP_VERB_NONE) {
- SPDocumentUndo::done(sp_desktop_document(desktop), verb, description);
+ DocumentUndo::done(sp_desktop_document(desktop), verb, description);
}
delete res;
static
void item_outline_add_marker( SPObject const *marker_object, Geom::Matrix marker_transform,
- Geom::Scale stroke_scale, Geom::Matrix transform,
- Geom::PathVector* pathv_in )
+ Geom::Scale stroke_scale, Geom::PathVector* pathv_in )
{
SPMarker* marker = SP_MARKER (marker_object);
SPItem* marker_item = sp_item_first_item_child(SP_OBJECT(marker_object));
@@ -637,7 +637,7 @@ void item_outline_add_marker( SPObject const *marker_object, Geom::Matrix marker
tr = stroke_scale * tr;
}
// total marker transform
- tr = marker_item->transform * marker->c2p * tr * transform;
+ tr = marker_item->transform * marker->c2p * tr;
Geom::PathVector* marker_pathv = item_outline(marker_item);
SPCurve *curve = NULL;
if (SP_IS_SHAPE(item)) {
- curve = sp_shape_get_curve(SP_SHAPE(item));
+ curve = SP_SHAPE(item)->getCurve();
} else if (SP_IS_TEXT(item)) {
curve = SP_TEXT(item)->getNormalizedBpath();
}
return ret_pathv;
}
+ if (curve->get_pathvector().empty()) {
+ return ret_pathv;
+ }
+
// remember old stroke style, to be set on fill
SPStyle *i_style = SP_OBJECT_STYLE(item);
if (res->descr_cmd.size() > 1) { // if there's 0 or 1 node left, drop this path altogether
ret_pathv = orig->MakePathVector();
- if (SP_IS_SHAPE(item) && sp_shape_has_markers (SP_SHAPE(item))) {
+ if (SP_IS_SHAPE(item) && SP_SHAPE(item)->hasMarkers ()) {
SPShape *shape = SP_SHAPE(item);
Geom::PathVector const & pathv = curve->get_pathvector();
if ( SPObject *marker_obj = shape->marker[i] ) {
Geom::Matrix const m (sp_shape_marker_get_transform_at_start(pathv.front().front()));
item_outline_add_marker( marker_obj, m,
- Geom::Scale(i_style->stroke_width.computed), transform,
+ Geom::Scale(i_style->stroke_width.computed),
ret_pathv );
}
}
{
Geom::Matrix const m (sp_shape_marker_get_transform_at_start(path_it->front()));
item_outline_add_marker( midmarker_obj, m,
- Geom::Scale(i_style->stroke_width.computed), transform,
+ Geom::Scale(i_style->stroke_width.computed),
ret_pathv );
}
// MID position
*/
Geom::Matrix const m (sp_shape_marker_get_transform(*curve_it1, *curve_it2));
item_outline_add_marker( midmarker_obj, m,
- Geom::Scale(i_style->stroke_width.computed), transform,
+ Geom::Scale(i_style->stroke_width.computed),
ret_pathv);
++curve_it1;
Geom::Curve const &lastcurve = path_it->back_default();
Geom::Matrix const m = sp_shape_marker_get_transform_at_end(lastcurve);
item_outline_add_marker( midmarker_obj, m,
- Geom::Scale(i_style->stroke_width.computed), transform,
+ Geom::Scale(i_style->stroke_width.computed),
ret_pathv );
}
}
Geom::Matrix const m = sp_shape_marker_get_transform_at_end(lastcurve);
item_outline_add_marker( marker_obj, m,
- Geom::Scale(i_style->stroke_width.computed), transform,
+ Geom::Scale(i_style->stroke_width.computed),
ret_pathv );
}
}
SPCurve *curve = NULL;
if (SP_IS_SHAPE(item)) {
- curve = sp_shape_get_curve(SP_SHAPE(item));
+ curve = SP_SHAPE(item)->getCurve();
if (curve == NULL)
continue;
}
continue;
}
+ if (curve->get_pathvector().empty()) {
+ continue;
+ }
+
// pas de stroke pas de chocolat
if (!SP_OBJECT_STYLE(item) || SP_OBJECT_STYLE(item)->stroke.noneSet) {
curve->unref();
if (res->descr_cmd.size() > 1) { // if there's 0 or 1 node left, drop this path altogether
SPDocument * doc = sp_desktop_document(desktop);
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
+ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::XML::Node *repr = xml_doc->createElement("svg:path");
// restore old style, but set old stroke style on fill
if (clip_path)
repr->setAttribute("clip-path", clip_path);
- if (SP_IS_SHAPE(item) && sp_shape_has_markers (SP_SHAPE(item))) {
+ if (SP_IS_SHAPE(item) && SP_SHAPE(item)->hasMarkers ()) {
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
+ Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::XML::Node *g_repr = xml_doc->createElement("svg:g");
// add the group to the parent
}
if (did) {
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_OUTLINE,
- _("Convert stroke to path"));
+ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_OUTLINE,
+ _("Convert stroke to path"));
} else {
// TRANSLATORS: "to outline" means "to convert stroke to path"
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No stroked paths</b> in the selection."));
@@ -1308,7 +1316,7 @@ sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool updat
}
if (SP_IS_SHAPE(item))
{
- curve = sp_shape_get_curve(SP_SHAPE(item));
+ curve = SP_SHAPE(item)->getCurve();
if (curve == NULL)
return;
}
@@ -1420,11 +1428,11 @@ sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool updat
{
// pas vraiment de points sur le resultat
// donc il ne reste rien
- SPDocumentUndo::done(sp_desktop_document(desktop),
- (updating ? SP_VERB_SELECTION_LINKED_OFFSET
- : SP_VERB_SELECTION_DYNAMIC_OFFSET),
- (updating ? _("Create linked offset")
- : _("Create dynamic offset")));
+ DocumentUndo::done(sp_desktop_document(desktop),
+ (updating ? SP_VERB_SELECTION_LINKED_OFFSET
+ : SP_VERB_SELECTION_DYNAMIC_OFFSET),
+ (updating ? _("Create linked offset")
+ : _("Create dynamic offset")));
selection->clear();
delete res;
@@ -1438,7 +1446,7 @@ sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool updat
tstr[79] = '\0';
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
+ Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
repr = xml_doc->createElement("svg:path");
repr->setAttribute("sodipodi:type", "inkscape:offset");
sp_repr_set_svg_double(repr, "inkscape:radius", ( expand > 0
@@ -1491,11 +1499,11 @@ sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool updat
selection->set(nitem);
}
- SPDocumentUndo::done(sp_desktop_document(desktop),
- (updating ? SP_VERB_SELECTION_LINKED_OFFSET
- : SP_VERB_SELECTION_DYNAMIC_OFFSET),
- (updating ? _("Create linked offset")
- : _("Create dynamic offset")));
+ DocumentUndo::done(sp_desktop_document(desktop),
+ (updating ? SP_VERB_SELECTION_LINKED_OFFSET
+ : SP_VERB_SELECTION_DYNAMIC_OFFSET),
+ (updating ? _("Create linked offset")
+ : _("Create dynamic offset")));
delete res;
delete orig;
@@ -1537,7 +1545,7 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset)
SPCurve *curve = NULL;
if (SP_IS_SHAPE(item)) {
- curve = sp_shape_get_curve(SP_SHAPE(item));
+ curve = SP_SHAPE(item)->getCurve();
if (curve == NULL)
continue;
}
@@ -1704,7 +1712,7 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset)
tstr[79] = '\0';
- 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");
repr->setAttribute("style", style);
@@ -1736,9 +1744,9 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset)
}
if (did) {
- SPDocumentUndo::done(sp_desktop_document(desktop),
- (expand ? SP_VERB_SELECTION_OFFSET : SP_VERB_SELECTION_INSET),
- (expand ? _("Outset path") : _("Inset path")));
+ DocumentUndo::done(sp_desktop_document(desktop),
+ (expand ? SP_VERB_SELECTION_OFFSET : SP_VERB_SELECTION_INSET),
+ (expand ? _("Outset path") : _("Inset path")));
} else {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No paths</b> to inset/outset 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)
return false;
}
orig->Simplify(threshold * size);
}
- 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 style, mask and clip-path
@@ -1996,8 +2004,8 @@ sp_selected_path_simplify_selection(SPDesktop *desktop, float threshold, bool ju
breakableAngles, true);
if (didSomething)
- SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_SIMPLIFY,
- _("Simplify"));
+ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_SELECTION_SIMPLIFY,
+ _("Simplify"));
else
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No paths</b> to simplify in the selection."));
if (SP_IS_PATH(item)) {
curve = sp_path_get_curve_for_edit(SP_PATH(item));
} else {
- curve = sp_shape_get_curve(SP_SHAPE(item));
+ curve = SP_SHAPE(item)->getCurve();
}
}
else if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item))
fill-column:99
End:
*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :