diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp
index 2253bf1e1170dd7b869304d8aa30da7b09667ebe..5ff01814f06ae6a1c7fd2fc09ff1c79904799eb7 100644 (file)
--- a/src/sp-offset.cpp
+++ b/src/sp-offset.cpp
# include "config.h"
#endif
+#include <cstring>
+#include <string>
#include "svg/svg.h"
#include "attributes.h"
static void sp_offset_snappoints(SPItem const *item, SnapPointsIter p);
static void sp_offset_set_shape (SPShape * shape);
-Path *bpath_to_liv_path (NArtBpath * bpath);
+Path *bpath_to_liv_path (NArtBpath const * bpath);
static void refresh_offset_source(SPOffset* offset);
SPOffset *offset = SP_OFFSET (object);
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
- repr = sp_repr_new ("svg:path");
+ Inkscape::XML::Document *xml_doc = SP_OBJECT_REPR(object)->document();
+ repr = xml_doc->createElement("svg:path");
}
if (flags & SP_OBJECT_WRITE_EXT) {
offset->original = strdup (value);
bpath = sp_svg_read_path (offset->original);
- curve = sp_curve_new_from_bpath (bpath); // curve se chargera de detruire bpath
+ curve = SPCurve::new_from_bpath (bpath); // curve se chargera de detruire bpath
g_assert (curve != NULL);
offset->originalPath = bpath_to_liv_path (SP_CURVE_BPATH(curve));
- sp_curve_unref (curve);
+ curve->unref();
offset->knotSet = false;
if ( offset->isUpdating == false ) object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
* livarot Path. Duplicate of splivarot.
*/
Path *
-bpath_to_liv_path(NArtBpath *bpath)
+bpath_to_liv_path(NArtBpath const *bpath)
{
if (bpath == NULL)
return NULL;
const char *res_d = SP_OBJECT(shape)->repr->attribute("inkscape:original");
if ( res_d ) {
NArtBpath *bpath = sp_svg_read_path (res_d);
- SPCurve *c = sp_curve_new_from_bpath (bpath);
+ SPCurve *c = SPCurve::new_from_bpath (bpath);
g_assert(c != NULL);
sp_shape_set_curve_insync ((SPShape *) offset, c, TRUE);
- sp_curve_unref (c);
+ c->unref();
}
return;
}
theRes->ConvertToForme (orig, 1, originaux);
SPItem *item = shape;
- NR::Rect bbox = sp_item_bbox_desktop (item);
- if (!bbox.isEmpty()) {
- gdouble size = L2(bbox.dimensions());
+ NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop (item);
+ if ( bbox && !bbox->isEmpty() ) {
+ gdouble size = L2(bbox->dimensions());
gdouble const exp = NR::expansion(item->transform);
if (exp != 0)
size /= exp;
delete orig;
NArtBpath *bpath = sp_svg_read_path (res_d);
- SPCurve *c = sp_curve_new_from_bpath (bpath);
+ SPCurve *c = SPCurve::new_from_bpath (bpath);
g_assert(c != NULL);
sp_shape_set_curve_insync ((SPShape *) offset, c, TRUE);
- sp_curve_unref (c);
+ c->unref();
free (res_d);
}
Path *finalPath = bpath_to_liv_path (SP_CURVE_BPATH(curve));
if (finalPath == NULL)
{
- sp_curve_unref (curve);
+ curve->unref();
return;
}
delete theShape;
delete finalPath;
- sp_curve_unref (curve);
+ curve->unref();
}
// the listening functions
@@ -1093,7 +1096,7 @@ sp_offset_href_changed(SPObject */*old_ref*/, SPObject */*ref*/, SPOffset *offse
}
static void
-sp_offset_move_compensate(NR::Matrix const *mp, SPItem *original, SPOffset *self)
+sp_offset_move_compensate(NR::Matrix const *mp, SPItem */*original*/, SPOffset *self)
{
guint mode = prefs_get_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_PARALLEL);
if (mode == SP_CLONE_COMPENSATION_NONE) return;
}
static void
-sp_offset_source_modified (SPObject *iSource, guint flags, SPItem *item)
+sp_offset_source_modified (SPObject */*iSource*/, guint /*flags*/, SPItem *item)
{
SPOffset *offset = SP_OFFSET(item);
offset->sourceDirty=true;
return;
}
orig = bpath_to_liv_path (SP_CURVE_BPATH(curve));
- sp_curve_unref (curve);
+ curve->unref();
// Finish up.