summaryrefslogtreecommitdiffstats
path: root/src/ui/tools/freehand-base.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/tools/freehand-base.cpp')
-rw-r--r--src/ui/tools/freehand-base.cpp37
1 files changed, 16 insertions, 21 deletions
diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp
index 32702a17e..0f14d7534 100644
--- a/src/ui/tools/freehand-base.cpp
+++ b/src/ui/tools/freehand-base.cpp
@@ -27,7 +27,7 @@
#include <glibmm/i18n.h>
#include "display/curve.h"
#include "desktop.h"
-#include "desktop-handles.h"
+
#include "desktop-style.h"
#include "document.h"
#include "ui/draw-anchor.h"
@@ -117,7 +117,7 @@ FreehandBase::~FreehandBase() {
void FreehandBase::setup() {
ToolBase::setup();
- this->selection = sp_desktop_selection(desktop);
+ this->selection = desktop->getSelection();
// Connect signals to track selection changes
this->sel_changed_connection = this->selection->connectChanged(
@@ -128,14 +128,14 @@ void FreehandBase::setup() {
);
// Create red bpath
- this->red_bpath = sp_canvas_bpath_new(sp_desktop_sketch(this->desktop), NULL);
+ this->red_bpath = sp_canvas_bpath_new(this->desktop->getSketch(), NULL);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->red_bpath), this->red_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
// Create red curve
this->red_curve = new SPCurve();
// Create blue bpath
- this->blue_bpath = sp_canvas_bpath_new(sp_desktop_sketch(this->desktop), NULL);
+ this->blue_bpath = sp_canvas_bpath_new(this->desktop->getSketch(), NULL);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->blue_bpath), this->blue_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
// Create blue curve
@@ -247,11 +247,9 @@ static void spdc_apply_powerstroke_shape(const std::vector<Geom::Point> & points
char const *style_str = NULL;
style_str = repr->attribute("style");
if (style_str) {
- SPStyle *style = sp_style_new(SP_ACTIVE_DOCUMENT);
- sp_style_merge_from_style_string(style, style_str);
- stroke_width = style->stroke_width.computed;
- style->stroke_width.computed = 0;
- sp_style_unref(style);
+ SPStyle style(SP_ACTIVE_DOCUMENT);
+ style.mergeString(style_str);
+ stroke_width = style.stroke_width.computed;
}
std::ostringstream s;
@@ -500,7 +498,7 @@ void spdc_endpoint_snap_free(ToolBase const * const ec, Geom::Point& p, boost::o
{
SPDesktop *dt = ec->desktop;
SnapManager &m = dt->namedview->snap_manager;
- Inkscape::Selection *selection = sp_desktop_selection (dt);
+ Inkscape::Selection *selection = dt->getSelection();
// selection->singleItem() is the item that is currently being drawn. This item will not be snapped to (to avoid self-snapping)
// TODO: Allow snapping to the stationary parts of the item, and only ignore the last segment
@@ -667,7 +665,7 @@ static void spdc_flush_white(FreehandBase *dc, SPCurve *gc)
: dc->desktop->dt2doc() );
SPDesktop *desktop = dc->desktop;
- SPDocument *doc = sp_desktop_document(desktop);
+ SPDocument *doc = desktop->getDocument();
Inkscape::XML::Document *xml_doc = doc->getReprDoc();
if ( c && !c->is_empty() ) {
@@ -715,7 +713,7 @@ static void spdc_flush_white(FreehandBase *dc, SPCurve *gc)
// results in the tool losing all of the selected path's curve except that last subpath. To
// fix this, we force the selection_modified callback now, to make sure the tool's curve is
// in sync immediately.
- spdc_selection_modified(sp_desktop_selection(desktop), 0, dc);
+ spdc_selection_modified(desktop->getSelection(), 0, dc);
}
c->unref();
@@ -821,14 +819,11 @@ void spdc_create_single_dot(ToolBase *ec, Geom::Point const &pt, char const *too
// find out stroke width (TODO: is there an easier way??)
double stroke_width = 3.0;
- gchar const *style_str = NULL;
- style_str = repr->attribute("style");
+ gchar const *style_str = repr->attribute("style");
if (style_str) {
- SPStyle *style = sp_style_new(SP_ACTIVE_DOCUMENT);
- sp_style_merge_from_style_string(style, style_str);
- stroke_width = style->stroke_width.computed;
- style->stroke_width.computed = 0;
- sp_style_unref(style);
+ SPStyle style(SP_ACTIVE_DOCUMENT);
+ style.mergeString(style_str);
+ stroke_width = style.stroke_width.computed;
}
// unset stroke and set fill color to former stroke color
@@ -862,10 +857,10 @@ void spdc_create_single_dot(ToolBase *ec, Geom::Point const &pt, char const *too
sp_repr_set_svg_double (repr, "sodipodi:ry", rad * stroke_width);
item->updateRepr();
- sp_desktop_selection(desktop)->set(item);
+ desktop->getSelection()->set(item);
desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Creating single dot"));
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, _("Create single dot"));
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_NONE, _("Create single dot"));
}
}