summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2014-07-30 15:27:34 +0000
committerLiam P. White <inkscapebrony@gmail.com>2014-07-30 15:27:34 +0000
commitf9ea5bd2c9c4fe4f2b0a867bfdf0a10519dce5fd (patch)
tree88c5361cf3890cdf5d1b8bfa833229e9c16ac2ad /src
parentRead CSS Text 3 'white-space' property, SVG 2 <text> 'width', 'height' attrib... (diff)
parentFix for 1346972 (freehand shape mode should pick stroke width from tool's act... (diff)
downloadinkscape-f9ea5bd2c9c4fe4f2b0a867bfdf0a10519dce5fd.tar.gz
inkscape-f9ea5bd2c9c4fe4f2b0a867bfdf0a10519dce5fd.zip
Update to trunk r13482
(bzr r13341.1.111)
Diffstat (limited to 'src')
-rw-r--r--src/sp-path.cpp5
-rw-r--r--src/ui/clipboard.cpp9
-rw-r--r--src/ui/dialog/document-properties.cpp1
-rw-r--r--src/ui/tools/freehand-base.cpp28
4 files changed, 40 insertions, 3 deletions
diff --git a/src/sp-path.cpp b/src/sp-path.cpp
index d1fb850e1..5c076b7cb 100644
--- a/src/sp-path.cpp
+++ b/src/sp-path.cpp
@@ -140,10 +140,10 @@ void SPPath::build(SPDocument *document, Inkscape::XML::Node *repr) {
SPShape::build(document, repr);
- //this->readAttr( "inkscape:original-d" ); //lp1299948
+ // this->readAttr( "inkscape:original-d" ); // lp1299948
if (gchar const* s = this->getRepr()->attribute("inkscape:original-d"))
{
- //write it to XML, and to my curve, but don't update patheffects
+ // write it to XML, and to my curve, but don't update patheffects
Geom::PathVector pv = sp_svg_read_pathv(s);
SPCurve *curve = new SPCurve(pv);
@@ -154,7 +154,6 @@ void SPPath::build(SPDocument *document, Inkscape::XML::Node *repr) {
if (curve) {
_curve_before_lpe = curve->ref();
}
- //this->getRepr()->setAttribute("inkscape:original-d", s);
}
this->readAttr( "d" );
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index 8e2502545..1209b19cd 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -601,6 +601,12 @@ Glib::ustring ClipboardManagerImpl::getPathParameter(SPDesktop* desktop)
*/
Glib::ustring ClipboardManagerImpl::getShapeOrTextObjectId(SPDesktop *desktop)
{
+ // https://bugs.launchpad.net/inkscape/+bug/1293979
+ // basically, when we do a depth-first search, we're stopping
+ // at the first object to be <svg:path> or <svg:text>.
+ // but that could then return the id of the object's
+ // clip path or mask, not the original path!
+
SPDocument *tempdoc = _retrieveClipboard(); // any target will do here
if ( tempdoc == NULL ) {
_userWarn(desktop, _("Nothing on the clipboard."));
@@ -608,6 +614,9 @@ Glib::ustring ClipboardManagerImpl::getShapeOrTextObjectId(SPDesktop *desktop)
}
Inkscape::XML::Node *root = tempdoc->getReprRoot();
+ // 1293979: strip out the defs of the document
+ root->removeChild(tempdoc->getDefs()->getRepr());
+
Inkscape::XML::Node *repr = sp_repr_lookup_name(root, "svg:path", -1); // unlimited search depth
if ( repr == NULL ) {
repr = sp_repr_lookup_name(root, "svg:text", -1);
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index 2674efc1e..9141b2268 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -596,6 +596,7 @@ void DocumentProperties::removeSelectedProfile(){
//XML Tree being used directly here while it shouldn't be.
sp_repr_unparent(obj->getRepr());
DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_COLOR_PROFILE, _("Remove linked color profile"));
+ break; // removing the color profile likely invalidates part of the traversed list, stop traversing here.
}
current = g_slist_next(current);
}
diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp
index 86b78c953..aad924844 100644
--- a/src/ui/tools/freehand-base.cpp
+++ b/src/ui/tools/freehand-base.cpp
@@ -240,6 +240,31 @@ static void spdc_apply_powerstroke_shape(const std::vector<Geom::Point> & points
Effect* lpe = SP_LPE_ITEM(item)->getCurrentLPE();
static_cast<LPEPowerStroke*>(lpe)->offset_points.param_set_and_write_new_value(points);
+ // find out stroke width (TODO: is there an easier way??)
+ SPDesktop *desktop = dc->desktop;
+ Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
+ Inkscape::XML::Node *repr = xml_doc->createElement("svg:path");
+ Inkscape::GC::release(repr);
+
+ char const* tool = SP_IS_PEN_CONTEXT(dc) ? "/tools/freehand/pen" : "/tools/freehand/pencil";
+
+ // apply the tool's current style
+ sp_desktop_apply_style_tool(desktop, repr, tool, false);
+
+ double stroke_width = 1.0;
+ 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);
+ }
+
+ char * width_str = new char[50];
+ sprintf(width_str, "0,%f", stroke_width / 2.);
+
// write powerstroke parameters:
lpe->getRepr()->setAttribute("start_linecap_type", "zerowidth");
lpe->getRepr()->setAttribute("end_linecap_type", "zerowidth");
@@ -247,6 +272,9 @@ static void spdc_apply_powerstroke_shape(const std::vector<Geom::Point> & points
lpe->getRepr()->setAttribute("sort_points", "true");
lpe->getRepr()->setAttribute("interpolator_type", "CubicBezierJohan");
lpe->getRepr()->setAttribute("interpolator_beta", "0.2");
+ lpe->getRepr()->setAttribute("offset_points", width_str);
+
+ delete [] width_str;
}
static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, SPCurve *curve)