summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2019-07-14 18:28:39 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2019-07-14 18:29:22 +0000
commitac73a1c0f33081d9094f14d1956a760639e6acc5 (patch)
treed398770d5a82ec15138b44be9f18333015573469 /src
parentPoewePencil improvements (diff)
downloadinkscape-ac73a1c0f33081d9094f14d1956a760639e6acc5.tar.gz
inkscape-ac73a1c0f33081d9094f14d1956a760639e6acc5.zip
Powerpencil substitute
Diffstat (limited to 'src')
-rw-r--r--src/ui/tools/freehand-base.cpp20
-rw-r--r--src/ui/tools/pencil-tool.cpp6
2 files changed, 11 insertions, 15 deletions
diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp
index f669788dd..bc092b79c 100644
--- a/src/ui/tools/freehand-base.cpp
+++ b/src/ui/tools/freehand-base.cpp
@@ -39,6 +39,7 @@
#include "object/sp-rect.h"
#include "object/sp-use.h"
#include "style.h"
+#include "id-clash.h"
#include "ui/clipboard.h"
#include "ui/control-manager.h"
@@ -278,20 +279,16 @@ static void spdc_apply_powerstroke_shape(std::vector<Geom::Point> points, Freeha
if (dc->tablet_enabled) {
SPObject *elemref = nullptr;
if ((elemref = document->getObjectById("power_stroke_preview"))) {
- sp_lpe_item_update_patheffect(SP_LPE_ITEM(elemref), false, true);
if (SP_SHAPE(elemref)->getCurve() != pt->curvepressure) {
elemref->getRepr()->setAttribute("style", nullptr);
- SPObject *successor = dynamic_cast<SPObject *>(elemref);
+ SPItem *successor = dynamic_cast<SPItem *>(elemref);
sp_desktop_apply_style_tool(desktop, successor->getRepr(), Glib::ustring("/tools/freehand/pencil").data(), false);
spdc_apply_style(successor);
- sp_lpe_item_enable_path_effects(SP_LPE_ITEM(item), false);
- item->getRepr()->setAttribute("style", elemref->getRepr()->attribute("style"));
- item->getRepr()->setAttribute("inkscape:original-d", elemref->getRepr()->attribute("inkscape:original-d"));
- SP_LPE_ITEM(item)->set(SP_ATTR_INKSCAPE_PATH_EFFECT, elemref->getRepr()->attribute("inkscape:path-effect"));
- sp_lpe_item_enable_path_effects(SP_LPE_ITEM(item), true);
- sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, true);
- //successor->deleteObject(true);
- //successor = nullptr;
+ item->deleteObject(true);
+ item = successor;
+ dc->selection->set(item);
+ item->setLocked(false);
+ rename_id(SP_OBJECT(item), "path-1");
} else {
using namespace Inkscape::LivePathEffect;
Effect* lpe = SP_LPE_ITEM(elemref)->getCurrentLPE();
@@ -451,7 +448,7 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item,
if (dc->tablet_enabled) {
std::vector<Geom::Point> points;
spdc_apply_powerstroke_shape(points, dc, item);
- shape_applied = true;
+ shape_applied = false;
shape = NONE;
previous_shape_type = NONE;
}
@@ -921,7 +918,6 @@ static void spdc_flush_white(FreehandBase *dc, SPCurve *gc)
dc->white_item = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr));
}
spdc_check_for_and_apply_waiting_LPE(dc, dc->white_item, c, false);
- dc->selection->set(dc->white_item);
}
}
if (!dc->white_item) {
diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp
index 23f4bba69..000ea86d8 100644
--- a/src/ui/tools/pencil-tool.cpp
+++ b/src/ui/tools/pencil-tool.cpp
@@ -356,7 +356,7 @@ bool PencilTool::_handleMotionNotify(GdkEventMotion const &mevent) {
// whether we're going into freehand mode or not
this->ps.push_back(this->p[0]);
if (tablet_enabled) {
- this->_wps.push_back(this->pressure/10);
+ this->_wps.push_back(this->pressure);
}
}
this->_addFreehandPoint(p, mevent.state);
@@ -904,7 +904,7 @@ void PencilTool::_addFreehandPoint(Geom::Point const &p, guint /*state*/) {
this->_fitAndSplit();
this->ps.push_back(p);
if (tablet_enabled) {
- this->_wps.push_back(this->pressure/10);
+ this->_wps.push_back(this->pressure);
this->addPowerStrokePencil(false);
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), nullptr);
for (auto i:this->green_bpaths) {
@@ -924,7 +924,7 @@ PencilTool::powerStrokeInterpolate(Geom::Path path) {
using Geom::X;
using Geom::Y;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- double step = prefs->getDoubleLimited("/tools/freehand/pencil/pressurestep", 5.0, 0.0, 100.0)/100.0;
+ double step = prefs->getDoubleLimited("/tools/freehand/pencil/pressurestep", 5.0, 0.0, 100.0);
double min = prefs->getIntLimited("/tools/freehand/pencil/minpressure", 10, 1, 100) / 100.0;
double max = prefs->getIntLimited("/tools/freehand/pencil/maxpressure", 40, 1, 100) / 100.0;
if (min > max){