diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index df5b82710f419980843e6144a49df6d080d03145..2f44418896d8d650f6f8abb78dfde74fedccc607 100644 (file)
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
#include "livarot/Path.h"
#include "livarot/Shape.h"
-Path *Path_for_item(SPItem *item, bool doTransformation, bool transformFull = true);
+#include "splivarot.h"
+
bool Ancetre(Inkscape::XML::Node *a, Inkscape::XML::Node *who);
void sp_selected_path_boolop(bool_op bop);
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- Inkscape::Selection *selection = SP_DT_SELECTION(desktop);
+ Inkscape::Selection *selection = sp_desktop_selection(desktop);
GSList *il = (GSList *) selection->itemList();
if ( bop == bool_op_inters || bop == bool_op_union || bop == bool_op_diff || bop == bool_op_symdiff ) {
// true boolean op
// get the polygons of each path, with the winding rule specified, and apply the operation iteratively
- originaux[0]->ConvertWithBackData(0.001);
+ originaux[0]->ConvertWithBackData(0.1);
originaux[0]->Fill(theShape, 0);
curOrig = 1;
for (GSList *l = il->next; l != NULL; l = l->next) {
- originaux[curOrig]->ConvertWithBackData(0.001);
+ originaux[curOrig]->ConvertWithBackData(0.1);
originaux[curOrig]->Fill(theShape, curOrig);
{
SP_OBJECT(l->data)->deleteObject();
}
- sp_document_done(SP_DT_DOCUMENT(desktop));
+ sp_document_done(sp_desktop_document(desktop));
selection->clear();
delete res;
g_slist_free(il);
// premultiply by the inverse of parent's repr
- SPItem *parent_item = SP_ITEM(SP_DT_DOCUMENT(desktop)->getObjectByRepr(parent));
+ SPItem *parent_item = SP_ITEM(sp_desktop_document(desktop)->getObjectByRepr(parent));
NR::Matrix local = sp_item_i2doc_affine(parent_item);
gchar affinestr[80];
gchar *transform = NULL;
Inkscape::GC::release(repr);
}
- sp_document_done(SP_DT_DOCUMENT(desktop));
+ sp_document_done(sp_desktop_document(desktop));
delete res;
}
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- Inkscape::Selection *selection = SP_DT_SELECTION(desktop);
+ Inkscape::Selection *selection = sp_desktop_selection(desktop);
if (selection->isEmpty()) {
// TRANSLATORS: "to outline" means "to convert stroke to path"
repr->setAttribute("id", id);
- SPItem *newitem = (SPItem *) SP_DT_DOCUMENT(desktop)->getObjectByRepr(repr);
+ SPItem *newitem = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr);
sp_item_write_transform(newitem, repr, transform);
selection->add(repr);
}
if (did) {
- sp_document_done(SP_DT_DOCUMENT(desktop));
+ sp_document_done(sp_desktop_document(desktop));
} else {
// TRANSLATORS: "to outline" means "to convert stroke to path"
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No stroked paths</b> to outline in the selection."));
desktop = SP_ACTIVE_DESKTOP;
- selection = SP_DT_SELECTION(desktop);
+ selection = sp_desktop_selection(desktop);
item = selection->singleItem();
{
// pas vraiment de points sur le resultat
// donc il ne reste rien
- sp_document_done(SP_DT_DOCUMENT(desktop));
+ sp_document_done(sp_desktop_document(desktop));
selection->clear();
delete res;
// move to the saved position
repr->setPosition(pos > 0 ? pos : 0);
- SPItem *nitem = (SPItem *) SP_DT_DOCUMENT(desktop)->getObjectByRepr(repr);
+ SPItem *nitem = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr);
if ( updating ) {
// on conserve l'original
selection->set(nitem);
}
- sp_document_done(SP_DT_DOCUMENT(desktop));
+ sp_document_done(sp_desktop_document(desktop));
delete res;
delete orig;
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- Inkscape::Selection *selection = SP_DT_SELECTION(desktop);
+ Inkscape::Selection *selection = sp_desktop_selection(desktop);
if (selection->isEmpty()) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>path(s)</b> to inset/outset."));
// move to the saved position
repr->setPosition(pos > 0 ? pos : 0);
- SPItem *newitem = (SPItem *) SP_DT_DOCUMENT(desktop)->getObjectByRepr(repr);
+ SPItem *newitem = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr);
// reapply the transform
sp_item_write_transform(newitem, repr, transform);
}
if (did) {
- sp_document_done(SP_DT_DOCUMENT(desktop));
+ sp_document_done(sp_desktop_document(desktop));
} else {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No paths</b> to inset/outset in the selection."));
return;
@@ -1352,7 +1353,7 @@ sp_selected_path_simplify_item(SPDesktop *desktop, Inkscape::Selection *selectio
// move to the saved position
repr->setPosition(pos > 0 ? pos : 0);
- SPItem *newitem = (SPItem *) SP_DT_DOCUMENT(desktop)->getObjectByRepr(repr);
+ SPItem *newitem = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr);
// reapply the transform
sp_item_write_transform(newitem, repr, transform);
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- Inkscape::Selection *selection = SP_DT_SELECTION(desktop);
+ Inkscape::Selection *selection = sp_desktop_selection(desktop);
if (selection->isEmpty()) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE,
if (didSomething)
- sp_document_done(SP_DT_DOCUMENT(desktop));
+ sp_document_done(sp_desktop_document(desktop));
else
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No paths</b> to simplify in the selection."));
return dest;
}
-NR::Maybe<Path::cut_position> get_nearest_position_on_Path(SPItem *item, NR::Point p)
+NR::Maybe<Path::cut_position> get_nearest_position_on_Path(Path *path, NR::Point p)
{
- //Create and initialize a livarot Path
- Path *path = Path_for_item(item, true, true);
- if (path == NULL) {
- return NR::Nothing();
- }
- path->ConvertWithBackData(0.01);
-
//get nearest position on path
Path::cut_position pos = path->PointToCurvilignPosition(p);
- delete path;
return pos;
}
-NR::Point get_point_on_Path(SPItem *item, int piece, double t)
+NR::Point get_point_on_Path(Path *path, int piece, double t)
{
- //Create and initialize a livarot Path
- Path *path = Path_for_item(item, true, true);
- path->ConvertWithBackData(0.01);
-
- //get nearest position on path
NR::Point p;
path->PointAt(piece, t, p);
- delete path;
return p;
}