summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-08-02 11:29:25 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-08-02 11:29:25 +0000
commitd141eb2df3805c3049b863c1bf8429bed9d0763d (patch)
treea757cf20a6015e721f59c238a7095e6c4e06baa0 /src
parentUpdate simplify interactive to handle trinagle out powerstrokes, also fix it ... (diff)
downloadinkscape-d141eb2df3805c3049b863c1bf8429bed9d0763d.tar.gz
inkscape-d141eb2df3805c3049b863c1bf8429bed9d0763d.zip
Fixed some typos in bsector and bspline
In freehand base fix a crash un bend path if no clipboard. Also rewrite retrive clipboard to get it at correct document size (bzr r14272)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/lpe-angle_bisector.cpp2
-rw-r--r--src/live_effects/lpe-bspline.cpp1
-rw-r--r--src/ui/tools/freehand-base.cpp46
3 files changed, 33 insertions, 16 deletions
diff --git a/src/live_effects/lpe-angle_bisector.cpp b/src/live_effects/lpe-angle_bisector.cpp
index 95a81c763..900d29e3a 100644
--- a/src/live_effects/lpe-angle_bisector.cpp
+++ b/src/live_effects/lpe-angle_bisector.cpp
@@ -38,7 +38,7 @@ public:
virtual Geom::Point knot_get() const;
};
-} // namespace TtC
+} // namespace AB
LPEAngleBisector::LPEAngleBisector(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
diff --git a/src/live_effects/lpe-bspline.cpp b/src/live_effects/lpe-bspline.cpp
index c2a2d080e..6575700c7 100644
--- a/src/live_effects/lpe-bspline.cpp
+++ b/src/live_effects/lpe-bspline.cpp
@@ -245,6 +245,7 @@ LPEBSpline::addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector<Geom::
{
hp_vec.push_back(hp);
}
+
Gtk::Widget *LPEBSpline::newWidget()
{
// use manage here, because after deletion of Effect object, others might
diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp
index f4ad284c7..bdce1cd46 100644
--- a/src/ui/tools/freehand-base.cpp
+++ b/src/ui/tools/freehand-base.cpp
@@ -46,6 +46,7 @@
#include "live_effects/lpe-powerstroke.h"
#include "style.h"
#include "ui/control-manager.h"
+#include "util/units.h"
// clipboard support
#include "ui/clipboard.h"
#include "ui/tools/freehand-base.h"
@@ -393,15 +394,24 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item,
}
case CLIPBOARD:
{
- // take shape from clipboard; TODO: catch the case where clipboard is empty
- Effect::createAndApply(PATTERN_ALONG_PATH, dc->desktop->doc(), item);
- Effect* lpe = SP_LPE_ITEM(item)->getCurrentLPE();
- static_cast<LPEPatternAlongPath*>(lpe)->pattern.on_paste_button_click();
+ // take shape from clipboard;
Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get();
Glib::ustring svgd = cm->getPathParameter(SP_ACTIVE_DESKTOP);
- previous_shape_pathv = sp_svg_read_pathv(svgd.data());
-
- shape_applied = true;
+ if(svgd != ""){
+ previous_shape_pathv = sp_svg_read_pathv(svgd.data());
+ Inkscape::XML::Node *nv_repr = SP_ACTIVE_DESKTOP->getNamedView()->getRepr();
+ if (nv_repr->attribute("inkscape:document-units")){
+ double scale_units = Inkscape::Util::Quantity::convert(1, "px", nv_repr->attribute("inkscape:document-units"));
+ if (!Geom::are_near(scale_units, 1.0, Geom::EPSILON)) {
+ previous_shape_pathv *= Geom::Scale(scale_units);
+ }
+ }
+ SPCurve const *c = new SPCurve(previous_shape_pathv);
+ spdc_paste_curve_as_freehand_shape(c, dc, item);
+ shape_applied = true;
+ } else {
+ shape = NONE;
+ }
break;
}
case BEND_CLIPBOARD:
@@ -413,10 +423,14 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item,
path *= item->i2doc_affine().inverse();
svgd = sp_svg_write_path( path );
bend_item = dc->selection->singleItem();
- bend_item->moveTo(item,false);
- spdc_apply_bend_shape(svgd, dc, bend_item);
- bend_item->transform = Geom::Affine(1,0,0,1,0,0);
- dc->selection->add(SP_OBJECT(bend_item));
+ if(bend_item){
+ bend_item->moveTo(item,false);
+ spdc_apply_bend_shape(svgd, dc, bend_item);
+ bend_item->transform = Geom::Affine(1,0,0,1,0,0);
+ dc->selection->add(SP_OBJECT(bend_item));
+ } else {
+ shape = NONE;
+ }
} else {
shape = NONE;
}
@@ -444,10 +458,12 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item,
sp_selection_duplicate(dc->desktop);
dc->selection->remove(SP_OBJECT(bend_item));
bend_item = dc->selection->singleItem();
- bend_item->moveTo(item,false);
- spdc_apply_bend_shape(svgd, dc, bend_item);
- bend_item->transform = Geom::Affine(1,0,0,1,0,0);
- dc->selection->add(SP_OBJECT(bend_item));
+ if(bend_item){
+ bend_item->moveTo(item,false);
+ spdc_apply_bend_shape(svgd, dc, bend_item);
+ bend_item->transform = Geom::Affine(1,0,0,1,0,0);
+ dc->selection->add(SP_OBJECT(bend_item));
+ }
}
shape = BEND_CLIPBOARD;
}