diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp
index 32c20ace698a6fd1f751b71207563ed266b5f5d7..d7cafaed2ab12864d502e2e2f3a7c58d8f26593c 100644 (file)
--- a/src/shape-editor.cpp
+++ b/src/shape-editor.cpp
#include "desktop.h"
#include "desktop-handles.h"
#include "knotholder.h"
-#include "live_effects/parameter/pointparam-knotholder.h"
+#include "live_effects/parameter/point.h"
#include "nodepath.h"
#include "xml/node-event-vector.h"
-#include "prefs-utils.h"
+#include "preferences.h"
#include "object-edit.h"
#include "style.h"
#include "display/curve.h"
}
this->grab_node = -1;
- sp_nodepath_destroy(this->nodepath);
+ delete this->nodepath;
this->nodepath = NULL;
}
break;
switch(type) {
case SH_NODEPATH:
if (SP_IS_LPE_ITEM(item)) {
- this->nodepath = sp_nodepath_new(desktop, item, (prefs_get_int_attribute("tools.nodes", "show_handles", 1) != 0));
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ this->nodepath = sp_nodepath_new(desktop, item, (prefs->getBool("/tools/nodes/show_handles", true)));
}
if (this->nodepath) {
this->nodepath->shape_editor = this;
@@ -286,8 +287,9 @@ void ShapeEditor::set_item_lpe_path_parameter(SPItem *item, SPObject *lpeobject,
this->grab_node = -1;
if (lpeobject) {
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
this->nodepath = sp_nodepath_new( desktop, lpeobject,
- (prefs_get_int_attribute("tools.nodes", "show_handles", 1) != 0),
+ (prefs->getInt("/tools/nodes/show_handles", true)),
key, item);
if (this->nodepath) {
this->nodepath->shape_editor = this;
sp_nodepath_update_statusbar(this->nodepath);
}
-bool ShapeEditor::is_over_stroke (NR::Point event_p, bool remember) {
+bool ShapeEditor::is_over_stroke (Geom::Point event_p, bool remember) {
if (!this->nodepath)
return false; // no stroke in knotholder
return false;
}
- NR::Point nearest = pathv[pvpos->path_nr].pointAt(pvpos->t);
- NR::Point delta = nearest - this->curvepoint_doc;
+ Geom::Point nearest = pathv[pvpos->path_nr].pointAt(pvpos->t);
+ Geom::Point delta = nearest - this->curvepoint_doc;
delta = desktop->d2w(delta);
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
double stroke_tolerance =
(( !SP_OBJECT_STYLE(item)->stroke.isNone() ?
desktop->current_zoom() *
SP_OBJECT_STYLE (item)->stroke_width.computed * 0.5 *
- NR::expansion(sp_item_i2d_affine(item))
+ to_2geom(sp_item_i2d_affine(item)).descrim()
: 0.0)
- + prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100)) /NR::expansion(sp_item_i2d_affine(item));
- bool close = (NR::L2 (delta) < stroke_tolerance);
+ + prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100)) / to_2geom(sp_item_i2d_affine(item)).descrim();
+ bool close = (Geom::L2 (delta) < stroke_tolerance);
if (remember && close) {
// calculate index for nodepath's representation.
segment_index += 1;
}
- this->curvepoint_event[NR::X] = (gint) event_p [NR::X];
- this->curvepoint_event[NR::Y] = (gint) event_p [NR::Y];
+ this->curvepoint_event[Geom::X] = (gint) event_p [Geom::X];
+ this->curvepoint_event[Geom::Y] = (gint) event_p [Geom::Y];
this->hit = true;
this->grab_t = t;
this->grab_node = segment_index;
// The coordinates hasn't changed since the last motion event, abort
- if (this->curvepoint_event[NR::X] == x &&
- this->curvepoint_event[NR::Y] == y)
+ if (this->curvepoint_event[Geom::X] == x &&
+ this->curvepoint_event[Geom::Y] == y)
return;
- NR::Point const delta_w(eventx - this->curvepoint_event[NR::X],
- eventy - this->curvepoint_event[NR::Y]);
- NR::Point const delta_dt(this->desktop->w2d(delta_w));
+ Geom::Point const delta_w(eventx - this->curvepoint_event[Geom::X],
+ eventy - this->curvepoint_event[Geom::Y]);
+ Geom::Point const delta_dt(this->desktop->w2d(delta_w));
sp_nodepath_curve_drag (this->nodepath, this->grab_node, this->grab_t, delta_dt);
- this->curvepoint_event[NR::X] = x;
- this->curvepoint_event[NR::Y] = y;
+ this->curvepoint_event[Geom::X] = x;
+ this->curvepoint_event[Geom::Y] = y;
}
if (this->knotholder) {
}
}
-void ShapeEditor::select_rect(NR::Rect const &rect, bool add) {
+void ShapeEditor::select_rect(Geom::Rect const &rect, bool add) {
if (this->nodepath) {
sp_nodepath_select_rect(this->nodepath, rect, add);
}
if (this->nodepath) {
sp_nodepath_select_next (this->nodepath);
if (this->nodepath->numSelected() >= 1) {
- this->desktop->scroll_to_point(&(this->nodepath->singleSelectedCoords()), 1.0);
+ this->desktop->scroll_to_point(this->nodepath->singleSelectedCoords(), 1.0);
}
}
}
if (this->nodepath) {
sp_nodepath_select_prev (this->nodepath);
if (this->nodepath->numSelected() >= 1) {
- this->desktop->scroll_to_point(&(this->nodepath->singleSelectedCoords()), 1.0);
+ this->desktop->scroll_to_point(this->nodepath->singleSelectedCoords(), 1.0);
}
}
}
sp_nodepath_show_helperpath (this->nodepath, show);
}
-void ShapeEditor::flip (NR::Dim2 axis, boost::optional<NR::Point> center) {
+void ShapeEditor::flip (Geom::Dim2 axis, boost::optional<Geom::Point> center) {
if (this->nodepath)
sp_nodepath_flip (this->nodepath, axis, center);
}
-void ShapeEditor::distribute (NR::Dim2 axis) {
+void ShapeEditor::distribute (Geom::Dim2 axis) {
if (this->nodepath)
sp_nodepath_selected_distribute (this->nodepath, axis);
}
-void ShapeEditor::align (NR::Dim2 axis) {
+void ShapeEditor::align (Geom::Dim2 axis) {
if (this->nodepath)
sp_nodepath_selected_align (this->nodepath, axis);
}