summaryrefslogtreecommitdiffstats
path: root/src/ui/tools/eraser-tool.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-03-18 18:07:14 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-03-18 18:07:14 +0000
commite77956b4dbd029c9f6949f81fe083606f995c624 (patch)
tree74adda4df8986d65f70efb341c6235277361fd35 /src/ui/tools/eraser-tool.cpp
parentupdated code to work on 0.92 code (diff)
parentLatvian translation update (diff)
downloadinkscape-e77956b4dbd029c9f6949f81fe083606f995c624.tar.gz
inkscape-e77956b4dbd029c9f6949f81fe083606f995c624.zip
update to trunk
(bzr r12588.1.39)
Diffstat (limited to 'src/ui/tools/eraser-tool.cpp')
-rw-r--r--src/ui/tools/eraser-tool.cpp26
1 files changed, 8 insertions, 18 deletions
diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp
index bf4015b4c..af0cbcb78 100644
--- a/src/ui/tools/eraser-tool.cpp
+++ b/src/ui/tools/eraser-tool.cpp
@@ -44,7 +44,7 @@
#include "selection.h"
#include "desktop.h"
#include "desktop-events.h"
-#include "desktop-handles.h"
+
#include "desktop-style.h"
#include "message-context.h"
#include "preferences.h"
@@ -84,20 +84,10 @@ using Inkscape::DocumentUndo;
#define DRAG_DEFAULT 1.0
#define DRAG_MAX 1.0
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
-namespace {
- ToolBase* createEraserContext() {
- return new EraserTool();
- }
-
- bool eraserContextRegistered = ToolFactory::instance().registerObject("/tools/eraser", createEraserContext);
-}
-
const std::string& EraserTool::getPrefsPath() {
return EraserTool::prefsPath;
}
@@ -121,7 +111,7 @@ void EraserTool::setup() {
this->cal1 = new SPCurve();
this->cal2 = new SPCurve();
- this->currentshape = sp_canvas_item_new(sp_desktop_sketch(desktop), SP_TYPE_CANVAS_BPATH, NULL);
+ this->currentshape = sp_canvas_item_new(desktop->getSketch(), SP_TYPE_CANVAS_BPATH, NULL);
sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(this->currentshape), ERC_RED_RGBA, SP_WIND_RULE_EVENODD);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->currentshape), 0x00000000, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
@@ -666,7 +656,7 @@ void EraserTool::set_to_accumulated() {
if ( this->repr ) {
bool wasSelection = false;
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
gint eraserMode = prefs->getBool("/tools/eraser/mode") ? 1 : 0;
@@ -680,10 +670,10 @@ void EraserTool::set_to_accumulated() {
if (selection->isEmpty()) {
if ( eraserMode ) {
- toWorkOn = sp_desktop_document(desktop)->getItemsPartiallyInBox(desktop->dkey, bounds);
+ toWorkOn = desktop->getDocument()->getItemsPartiallyInBox(desktop->dkey, bounds);
} else {
Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop);
- toWorkOn = sp_desktop_document(desktop)->getItemsAtPoints(desktop->dkey, r->getPoints());
+ toWorkOn = desktop->getDocument()->getItemsAtPoints(desktop->dkey, r->getPoints());
}
toWorkOn = g_slist_remove( toWorkOn, acid );
@@ -767,9 +757,9 @@ void EraserTool::set_to_accumulated() {
if ( workDone ) {
- DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ERASER, _("Draw eraser stroke"));
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_ERASER, _("Draw eraser stroke"));
} else {
- DocumentUndo::cancel(sp_desktop_document(desktop));
+ DocumentUndo::cancel(desktop->getDocument());
}
}
@@ -949,7 +939,7 @@ void EraserTool::fit_and_split(bool release) {
gint eraserMode = prefs->getBool("/tools/eraser/mode") ? 1 : 0;
g_assert(!this->currentcurve->is_empty());
- SPCanvasItem *cbp = sp_canvas_item_new(sp_desktop_sketch(desktop), SP_TYPE_CANVAS_BPATH, NULL);
+ SPCanvasItem *cbp = sp_canvas_item_new(desktop->getSketch(), SP_TYPE_CANVAS_BPATH, NULL);
SPCurve *curve = this->currentcurve->copy();
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH (cbp), curve);
curve->unref();