summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiam P. White <inkscapebronyat-signgmaildotcom>2014-03-12 15:13:08 +0000
committerLiam P. White <inkscapebronyat-signgmaildotcom>2014-03-12 15:13:08 +0000
commit309112136c71cbb4f62fb850c6f6f12e32a67a8e (patch)
tree58e867ed84ddbc721113b948d4b6365cef02338a /src
parentReverted swatches (diff)
parentChange stroke-dasharray and stroke-dashoffset handling to match other propert... (diff)
downloadinkscape-309112136c71cbb4f62fb850c6f6f12e32a67a8e.tar.gz
inkscape-309112136c71cbb4f62fb850c6f6f12e32a67a8e.zip
Updated to trunk
(bzr r13090.1.24)
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile_insert1
-rw-r--r--src/attribute-rel-util.h1
-rw-r--r--src/box3d-side.cpp1
-rw-r--r--src/composite-undo-stack-observer.h1
-rw-r--r--src/display/nr-style.cpp6
-rw-r--r--src/display/sp-ctrlquadr.h4
-rw-r--r--src/extension/execution-env.h2
-rw-r--r--src/extension/internal/cairo-render-context.cpp10
-rw-r--r--src/extension/internal/emf-inout.cpp77
-rw-r--r--src/extension/internal/emf-print.cpp25
-rw-r--r--src/extension/internal/grid.cpp1
-rw-r--r--src/extension/internal/javafx-out.cpp18
-rw-r--r--src/extension/internal/latex-pstricks.cpp9
-rw-r--r--src/extension/internal/metafile-inout.cpp1
-rw-r--r--src/extension/internal/wmf-inout.cpp43
-rw-r--r--src/extension/internal/wmf-print.cpp13
-rw-r--r--src/gradient-drag.h1
-rw-r--r--src/knotholder.h1
-rw-r--r--src/line-geometry.h3
-rw-r--r--src/livarot/PathCutting.cpp35
-rw-r--r--src/marker.h1
-rw-r--r--src/persp3d.h4
-rw-r--r--src/selection-chemistry.cpp14
-rw-r--r--src/selection.h2
-rw-r--r--src/snapper.h1
-rw-r--r--src/sp-image.h3
-rw-r--r--src/sp-item.cpp8
-rw-r--r--src/sp-paint-server.h1
-rw-r--r--src/sp-root.h1
-rw-r--r--src/sp-script.h3
-rw-r--r--src/sp-symbol.h2
-rw-r--r--src/sp-text.h2
-rw-r--r--src/sp-use.h1
-rw-r--r--src/splivarot.cpp4
-rw-r--r--src/style-enums.h230
-rw-r--r--src/style-internal.h305
-rw-r--r--src/style-test.h18
-rw-r--r--src/style.cpp237
-rw-r--r--src/style.h492
-rw-r--r--src/ui/tools/spray-tool.cpp4
-rw-r--r--src/ui/tools/tool-base.cpp28
-rw-r--r--src/ui/tools/tool-base.h4
-rw-r--r--src/ui/widget/filter-effect-chooser.h1
-rw-r--r--src/ui/widget/style-swatch.h1
-rw-r--r--src/vanishing-point.h3
-rw-r--r--src/widgets/dash-selector.cpp20
-rw-r--r--src/widgets/gradient-selector.h1
-rw-r--r--src/widgets/sp-color-icc-selector.h1
-rw-r--r--src/widgets/sp-color-wheel-selector.h1
-rw-r--r--src/widgets/sp-xmlview-attr-list.h2
-rw-r--r--src/widgets/sp-xmlview-content.h5
-rw-r--r--src/widgets/sp-xmlview-tree.h3
-rw-r--r--src/widgets/spray-toolbar.cpp2
-rw-r--r--src/widgets/stroke-style.cpp15
55 files changed, 818 insertions, 857 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d1a3d194e..c34bd2e62 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -417,6 +417,8 @@ set(inkscape_SRC
strneq.h
style-test.h
style.h
+ style-enums.h
+ style-internal.h
svg-profile.h
svg-view-widget.h
svg-view.h
diff --git a/src/Makefile_insert b/src/Makefile_insert
index 7aedb38ee..5ff44b253 100644
--- a/src/Makefile_insert
+++ b/src/Makefile_insert
@@ -211,6 +211,7 @@ ink_common_sources += \
streq.h \
strneq.h \
style.cpp style.h \
+ style-enums.h style-internal.h \
svg-profile.h \
svg-view.cpp svg-view.h \
svg-view-widget.cpp svg-view-widget.h \
diff --git a/src/attribute-rel-util.h b/src/attribute-rel-util.h
index 449a66d9e..3a6661965 100644
--- a/src/attribute-rel-util.h
+++ b/src/attribute-rel-util.h
@@ -9,7 +9,6 @@
*/
#include "glibmm/ustring.h"
-#include "xml/node.h"
#include "xml/sp-css-attr.h"
using Inkscape::XML::Node;
diff --git a/src/box3d-side.cpp b/src/box3d-side.cpp
index 7b5ddc00e..dfccb63bf 100644
--- a/src/box3d-side.cpp
+++ b/src/box3d-side.cpp
@@ -19,6 +19,7 @@
#include "attributes.h"
#include "inkscape.h"
#include "persp3d.h"
+#include "persp3d-reference.h"
#include "ui/tools/box3d-tool.h"
#include "preferences.h"
#include "desktop-style.h"
diff --git a/src/composite-undo-stack-observer.h b/src/composite-undo-stack-observer.h
index 669c39a86..c93a2338b 100644
--- a/src/composite-undo-stack-observer.h
+++ b/src/composite-undo-stack-observer.h
@@ -11,7 +11,6 @@
#define SEEN_COMPOSITE_UNDO_COMMIT_OBSERVER_H
#include "gc-alloc.h"
-#include "gc-managed.h"
#include "undo-stack-observer.h"
#include <list>
diff --git a/src/display/nr-style.cpp b/src/display/nr-style.cpp
index 570ccd31e..125d0c6d6 100644
--- a/src/display/nr-style.cpp
+++ b/src/display/nr-style.cpp
@@ -152,12 +152,12 @@ void NRStyle::set(SPStyle *style)
delete [] dash;
}
- n_dash = style->stroke_dash.n_dash;
+ n_dash = style->stroke_dasharray.values.size();
if (n_dash != 0) {
- dash_offset = style->stroke_dash.offset;
+ dash_offset = style->stroke_dashoffset.value;
dash = new double[n_dash];
for (unsigned int i = 0; i < n_dash; ++i) {
- dash[i] = style->stroke_dash.dash[i];
+ dash[i] = style->stroke_dasharray.values[i];
}
} else {
dash_offset = 0.0;
diff --git a/src/display/sp-ctrlquadr.h b/src/display/sp-ctrlquadr.h
index 9fdfd29b3..1dfb06456 100644
--- a/src/display/sp-ctrlquadr.h
+++ b/src/display/sp-ctrlquadr.h
@@ -12,9 +12,7 @@
* Released under GNU GPL
*/
-#include "sp-canvas.h"
-
-
+#include <2geom/geom.h>
#define SP_TYPE_CTRLQUADR (sp_ctrlquadr_get_type ())
#define SP_CTRLQUADR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_CTRLQUADR, SPCtrlQuadr))
diff --git a/src/extension/execution-env.h b/src/extension/execution-env.h
index 92f496b90..795f5a65a 100644
--- a/src/extension/execution-env.h
+++ b/src/extension/execution-env.h
@@ -17,8 +17,6 @@
#include <gtkmm/dialog.h>
-#include "extension.h"
-
namespace Inkscape {
namespace UI {
diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp
index 2916d9fa9..4ec6ae1c8 100644
--- a/src/extension/internal/cairo-render-context.cpp
+++ b/src/extension/internal/cairo-render-context.cpp
@@ -1297,10 +1297,14 @@ CairoRenderContext::_setStrokeStyle(SPStyle const *style, Geom::OptRect const &p
}
}
- if (style->stroke_dash.n_dash &&
- style->stroke_dash.dash )
+ if (!style->stroke_dasharray.values.empty())
{
- cairo_set_dash(_cr, style->stroke_dash.dash, style->stroke_dash.n_dash, style->stroke_dash.offset);
+ size_t ndashes = style->stroke_dasharray.values.size();
+ double* dashes =(double*)malloc(ndashes*sizeof(double));
+ for( unsigned i = 0; i < ndashes; ++i ) {
+ dashes[i] = style->stroke_dasharray.values[i];
+ }
+ cairo_set_dash(_cr, dashes, ndashes, style->stroke_dashoffset.value);
} else {
cairo_set_dash(_cr, NULL, 0, 0.0); // disable dashing
}
diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp
index b73c5e9e5..bbbce46e7 100644
--- a/src/extension/internal/emf-inout.cpp
+++ b/src/extension/internal/emf-inout.cpp
@@ -915,14 +915,14 @@ Emf::output_style(PEMF_CALLBACK_DATA d, int iType)
tmp_style << "stroke-miterlimit:" <<
MAX( 2.0, d->dc[d->level].style.stroke_miterlimit.value ) << ";";
- if (d->dc[d->level].style.stroke_dasharray_set &&
- d->dc[d->level].style.stroke_dash.n_dash && d->dc[d->level].style.stroke_dash.dash)
+ if (d->dc[d->level].style.stroke_dasharray.set &&
+ !d->dc[d->level].style.stroke_dasharray.values.empty() )
{
tmp_style << "stroke-dasharray:";
- for (int i=0; i<d->dc[d->level].style.stroke_dash.n_dash; i++) {
+ for (unsigned i=0; i<d->dc[d->level].style.stroke_dasharray.values.size(); i++) {
if (i)
tmp_style << ",";
- tmp_style << d->dc[d->level].style.stroke_dash.dash[i];
+ tmp_style << d->dc[d->level].style.stroke_dasharray.values[i];
}
tmp_style << ";";
tmp_style << "stroke-dashoffset:0;";
@@ -1016,34 +1016,30 @@ Emf::select_pen(PEMF_CALLBACK_DATA d, int index)
case U_PS_DASHDOT:
case U_PS_DASHDOTDOT:
{
- int i = 0;
int penstyle = (pEmr->lopn.lopnStyle & U_PS_STYLE_MASK);
- d->dc[d->level].style.stroke_dash.n_dash =
- penstyle == U_PS_DASHDOTDOT ? 6 : penstyle == U_PS_DASHDOT ? 4 : 2;
- if (d->dc[d->level].style.stroke_dash.dash && (d->level==0 || (d->level>0 && d->dc[d->level].style.stroke_dash.dash!=d->dc[d->level-1].style.stroke_dash.dash)))
- delete[] d->dc[d->level].style.stroke_dash.dash;
- d->dc[d->level].style.stroke_dash.dash = new double[d->dc[d->level].style.stroke_dash.n_dash];
+ if (!d->dc[d->level].style.stroke_dasharray.values.empty() && (d->level==0 || (d->level>0 && d->dc[d->level].style.stroke_dasharray.values!=d->dc[d->level-1].style.stroke_dasharray.values)))
+ d->dc[d->level].style.stroke_dasharray.values.clear();
if (penstyle==U_PS_DASH || penstyle==U_PS_DASHDOT || penstyle==U_PS_DASHDOTDOT) {
- d->dc[d->level].style.stroke_dash.dash[i++] = 3;
- d->dc[d->level].style.stroke_dash.dash[i++] = 1;
+ d->dc[d->level].style.stroke_dasharray.values.push_back( 3 );
+ d->dc[d->level].style.stroke_dasharray.values.push_back( 1 );
}
if (penstyle==U_PS_DOT || penstyle==U_PS_DASHDOT || penstyle==U_PS_DASHDOTDOT) {
- d->dc[d->level].style.stroke_dash.dash[i++] = 1;
- d->dc[d->level].style.stroke_dash.dash[i++] = 1;
+ d->dc[d->level].style.stroke_dasharray.values.push_back( 1 );
+ d->dc[d->level].style.stroke_dasharray.values.push_back( 1 );
}
if (penstyle==U_PS_DASHDOTDOT) {
- d->dc[d->level].style.stroke_dash.dash[i++] = 1;
- d->dc[d->level].style.stroke_dash.dash[i++] = 1;
+ d->dc[d->level].style.stroke_dasharray.values.push_back( 1 );
+ d->dc[d->level].style.stroke_dasharray.values.push_back( 1 );
}
- d->dc[d->level].style.stroke_dasharray_set = 1;
+ d->dc[d->level].style.stroke_dasharray.set = 1;
break;
}
case U_PS_SOLID:
default:
{
- d->dc[d->level].style.stroke_dasharray_set = 0;
+ d->dc[d->level].style.stroke_dasharray.set = 0;
break;
}
}
@@ -1105,10 +1101,8 @@ Emf::select_extpen(PEMF_CALLBACK_DATA d, int index)
case U_PS_USERSTYLE:
{
if (pEmr->elp.elpNumEntries) {
- d->dc[d->level].style.stroke_dash.n_dash = pEmr->elp.elpNumEntries;
- if (d->dc[d->level].style.stroke_dash.dash && (d->level==0 || (d->level>0 && d->dc[d->level].style.stroke_dash.dash!=d->dc[d->level-1].style.stroke_dash.dash)))
- delete[] d->dc[d->level].style.stroke_dash.dash;
- d->dc[d->level].style.stroke_dash.dash = new double[pEmr->elp.elpNumEntries];
+ if (!d->dc[d->level].style.stroke_dasharray.values.empty() && (d->level==0 || (d->level>0 && d->dc[d->level].style.stroke_dasharray.values!=d->dc[d->level-1].style.stroke_dasharray.values)))
+ d->dc[d->level].style.stroke_dasharray.values.clear();
for (unsigned int i=0; i<pEmr->elp.elpNumEntries; i++) {
int cur_level = d->level;
d->level = d->emf_obj[index].level;
@@ -1117,11 +1111,11 @@ Emf::select_extpen(PEMF_CALLBACK_DATA d, int index)
// double dash_length = pix_to_abs_size( d, pEmr->elp.elpStyleEntry[i] );
double dash_length = pEmr->elp.elpStyleEntry[i];
d->level = cur_level;
- d->dc[d->level].style.stroke_dash.dash[i] = dash_length;
+ d->dc[d->level].style.stroke_dasharray.values[i] = dash_length;
}
- d->dc[d->level].style.stroke_dasharray_set = 1;
+ d->dc[d->level].style.stroke_dasharray.set = 1;
} else {
- d->dc[d->level].style.stroke_dasharray_set = 0;
+ d->dc[d->level].style.stroke_dasharray.set = 0;
}
break;
}
@@ -1131,27 +1125,23 @@ Emf::select_extpen(PEMF_CALLBACK_DATA d, int index)
case U_PS_DASHDOT:
case U_PS_DASHDOTDOT:
{
- int i = 0;
int penstyle = (pEmr->elp.elpPenStyle & U_PS_STYLE_MASK);
- d->dc[d->level].style.stroke_dash.n_dash =
- penstyle == U_PS_DASHDOTDOT ? 6 : penstyle == U_PS_DASHDOT ? 4 : 2;
- if (d->dc[d->level].style.stroke_dash.dash && (d->level==0 || (d->level>0 && d->dc[d->level].style.stroke_dash.dash!=d->dc[d->level-1].style.stroke_dash.dash)))
- delete[] d->dc[d->level].style.stroke_dash.dash;
- d->dc[d->level].style.stroke_dash.dash = new double[d->dc[d->level].style.stroke_dash.n_dash];
+ if (!d->dc[d->level].style.stroke_dasharray.values.empty() && (d->level==0 || (d->level>0 && d->dc[d->level].style.stroke_dasharray.values!=d->dc[d->level-1].style.stroke_dasharray.values)))
+ d->dc[d->level].style.stroke_dasharray.values.clear();
if (penstyle==U_PS_DASH || penstyle==U_PS_DASHDOT || penstyle==U_PS_DASHDOTDOT) {
- d->dc[d->level].style.stroke_dash.dash[i++] = 3;
- d->dc[d->level].style.stroke_dash.dash[i++] = 2;
+ d->dc[d->level].style.stroke_dasharray.values.push_back( 3 );
+ d->dc[d->level].style.stroke_dasharray.values.push_back( 2 );
}
if (penstyle==U_PS_DOT || penstyle==U_PS_DASHDOT || penstyle==U_PS_DASHDOTDOT) {
- d->dc[d->level].style.stroke_dash.dash[i++] = 1;
- d->dc[d->level].style.stroke_dash.dash[i++] = 2;
+ d->dc[d->level].style.stroke_dasharray.values.push_back( 1 );
+ d->dc[d->level].style.stroke_dasharray.values.push_back( 2 );
}
if (penstyle==U_PS_DASHDOTDOT) {
- d->dc[d->level].style.stroke_dash.dash[i++] = 1;
- d->dc[d->level].style.stroke_dash.dash[i++] = 2;
+ d->dc[d->level].style.stroke_dasharray.values.push_back( 1 );
+ d->dc[d->level].style.stroke_dasharray.values.push_back( 2 );
}
- d->dc[d->level].style.stroke_dasharray_set = 1;
+ d->dc[d->level].style.stroke_dasharray.set = 1;
break;
}
case U_PS_SOLID:
@@ -1163,7 +1153,7 @@ Emf::select_extpen(PEMF_CALLBACK_DATA d, int index)
*/
default:
{
- d->dc[d->level].style.stroke_dasharray_set = 0;
+ d->dc[d->level].style.stroke_dasharray.set = 0;
break;
}
}
@@ -2209,8 +2199,8 @@ std::cout << "BEFORE DRAW"
d->level = d->level + pEmr->iRelative;
}
while (old_level > d->level) {
- if (d->dc[old_level].style.stroke_dash.dash && (old_level==0 || (old_level>0 && d->dc[old_level].style.stroke_dash.dash!=d->dc[old_level-1].style.stroke_dash.dash))){
- delete[] d->dc[old_level].style.stroke_dash.dash;
+ if (!d->dc[old_level].style.stroke_dasharray.values.empty() && (old_level==0 || (old_level>0 && d->dc[old_level].style.stroke_dasharray.values!=d->dc[old_level-1].style.stroke_dasharray.values))){
+ d->dc[old_level].style.stroke_dasharray.values.clear();
}
if(d->dc[old_level].font_name){
free(d->dc[old_level].font_name); // else memory leak
@@ -2387,7 +2377,7 @@ std::cout << "BEFORE DRAW"
case U_WHITE_PEN:
{
float val = index == U_BLACK_PEN ? 0 : 1;
- d->dc[d->level].style.stroke_dasharray_set = 0;
+ d->dc[d->level].style.stroke_dasharray.set = 0;
d->dc[d->level].style.stroke_width.value = 1.0;
d->dc[d->level].style.stroke.value.color.set( val, val, val );
@@ -3452,8 +3442,7 @@ Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri )
delete[] d.emf_obj;
}
- if (d.dc[0].style.stroke_dash.dash)
- delete[] d.dc[0].style.stroke_dash.dash;
+ d.dc[0].style.stroke_dasharray.values.clear();
for(int i=0; i<=d.level;i++){
if(d.dc[i].font_name)free(d.dc[i].font_name);
diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp
index c103100b3..9cc662a27 100644
--- a/src/extension/internal/emf-print.cpp
+++ b/src/extension/internal/emf-print.cpp
@@ -683,25 +683,24 @@ int PrintEmf::create_pen(SPStyle const *style, const Geom::Affine &transform)
linejoin = U_PS_JOIN_BEVEL;
}
- if (style->stroke_dash.n_dash &&
- style->stroke_dash.dash) {
+ if (!style->stroke_dasharray.values.empty()) {
if (FixPPTDashLine) { // will break up line into many smaller lines. Override gradient if that was set, cannot do both.
brushStyle = U_BS_SOLID;
hatchType = U_HS_HORIZONTAL;
} else {
- int i = 0;
- while ((linestyle != U_PS_USERSTYLE) && (i < style->stroke_dash.n_dash)) {
- if (style->stroke_dash.dash[i] > 0.00000001) {
+ unsigned i = 0;
+ while ((linestyle != U_PS_USERSTYLE) && (i < style->stroke_dasharray.values.size())) {
+ if (style->stroke_dasharray.values[i] > 0.00000001) {
linestyle = U_PS_USERSTYLE;
}
i++;
}
if (linestyle == U_PS_USERSTYLE) {
- n_dash = style->stroke_dash.n_dash;
+ n_dash = style->stroke_dasharray.values.size();
dash = new uint32_t[n_dash];
- for (i = 0; i < style->stroke_dash.n_dash; i++) {
- dash[i] = (uint32_t)(Inkscape::Util::Quantity::convert(1, "mm", "px") * style->stroke_dash.dash[i]);
+ for (i = 0; i < n_dash; i++) {
+ dash[i] = (uint32_t)(Inkscape::Util::Quantity::convert(1, "mm", "px") * style->stroke_dasharray.values[i]);
}
}
}
@@ -1259,7 +1258,7 @@ unsigned int PrintEmf::fill(
}
if (
(style->stroke.isNone() || style->stroke.noneSet || style->stroke_width.computed == 0.0) ||
- (style->stroke_dash.n_dash && style->stroke_dash.dash && FixPPTDashLine) ||
+ (!style->stroke_dasharray.values.empty() && FixPPTDashLine) ||
!all_closed
) {
print_pathv(pathv, fill_transform); // do any fills. side effect: clears fill_pathv
@@ -1287,13 +1286,13 @@ unsigned int PrintEmf::stroke(
return 0;
}
- if (style->stroke_dash.n_dash && style->stroke_dash.dash && FixPPTDashLine) {
+ if (!style->stroke_dasharray.values.empty() && FixPPTDashLine) {
// convert the path, gets its complete length, and then make a new path with parameter length instead of t
Geom::Piecewise<Geom::D2<Geom::SBasis> > tmp_pathpw; // pathv-> sbasis
Geom::Piecewise<Geom::D2<Geom::SBasis> > tmp_pathpw2; // sbasis using arc length parameter
Geom::Piecewise<Geom::D2<Geom::SBasis> > tmp_pathpw3; // new (discontinuous) path, composed of dots/dashes
Geom::Piecewise<Geom::D2<Geom::SBasis> > first_frag; // first fragment, will be appended at end
- int n_dash = style->stroke_dash.n_dash;
+ int n_dash = style->stroke_dasharray.values.size();
int i = 0; //dash index
double tlength; // length of tmp_pathpw
double slength = 0.0; // start of gragment
@@ -1306,7 +1305,7 @@ unsigned int PrintEmf::stroke(
// go around the dash array repeatedly until the entire path is consumed (but not beyond).
while (slength < tlength) {
- elength = slength + style->stroke_dash.dash[i++];
+ elength = slength + style->stroke_dasharray.values[i++];
if (elength > tlength) {
elength = tlength;
}
@@ -1317,7 +1316,7 @@ unsigned int PrintEmf::stroke(
first_frag = fragment;
}
slength = elength;
- slength += style->stroke_dash.dash[i++]; // the gap
+ slength += style->stroke_dasharray.values[i++]; // the gap
if (i >= n_dash) {
i = 0;
}
diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp
index c2ef2b27c..c120df719 100644
--- a/src/extension/internal/grid.cpp
+++ b/src/extension/internal/grid.cpp
@@ -29,6 +29,7 @@
#include "selection.h"
#include "sp-object.h"
#include "util/glib-list-iterators.h"
+#include "2geom/geom.h"
#include "svg/path-string.h"
diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp
index e51e8d539..19946022c 100644
--- a/src/extension/internal/javafx-out.cpp
+++ b/src/extension/internal/javafx-out.cpp
@@ -418,10 +418,8 @@ bool JavaFXOutput::doStyle(SPStyle *style)
* SPIEnum stroke_linecap;
* SPIEnum stroke_linejoin;
* SPIFloat stroke_miterlimit;
- * NRVpathDash stroke_dash;
- * unsigned stroke_dasharray_set : 1;
- * unsigned stroke_dasharray_inherit : 1;
- * unsigned stroke_dashoffset_set : 1;
+ * SPIDashArray stroke_dasharray;
+ * SPILength stroke_dashoffset;
* SPIScale24 stroke_opacity;
*/
if (style->stroke_opacity.value > 0)
@@ -436,16 +434,16 @@ bool JavaFXOutput::doStyle(SPStyle *style)
out(" strokeLineCap: %s\n", getStrokeLineCap(linecap).c_str());
out(" strokeLineJoin: %s\n", getStrokeLineJoin(linejoin).c_str());
out(" strokeMiterLimit: %s\n", DSTR(style->stroke_miterlimit.value));
- if (style->stroke_dasharray_set) {
- if (style->stroke_dashoffset_set) {
- out(" strokeDashOffset: %s\n", DSTR(style->stroke_dash.offset));
+ if (style->stroke_dasharray.set) {
+ if (style->stroke_dashoffset.set) {
+ out(" strokeDashOffset: %s\n", DSTR(style->stroke_dashoffset.value));
}
out(" strokeDashArray: [ ");
- for(int i = 0; i < style->stroke_dash.n_dash; i++ ) {
+ for(unsigned i = 0; i < style->stroke_dasharray.values.size(); i++ ) {
if (i > 0) {
- out(", %.2lf", style->stroke_dash.dash[i]);
+ out(", %.2lf", style->stroke_dasharray.values[i]);
}else {
- out(" %.2lf", style->stroke_dash.dash[i]);
+ out(" %.2lf", style->stroke_dasharray.values[i]);
}
}
out(" ]\n");
diff --git a/src/extension/internal/latex-pstricks.cpp b/src/extension/internal/latex-pstricks.cpp
index c8e8e2f2e..6aaa1bca4 100644
--- a/src/extension/internal/latex-pstricks.cpp
+++ b/src/extension/internal/latex-pstricks.cpp
@@ -239,16 +239,13 @@ unsigned int PrintLatex::stroke(Inkscape::Extension::Print * /*mod*/,
os<<",strokeopacity="<<stroke_opacity;
}
- if (style->stroke_dasharray_set &&
- style->stroke_dash.n_dash &&
- style->stroke_dash.dash) {
- int i;
+ if (style->stroke_dasharray.set && !style->stroke_dasharray.values.empty()) {
os << ",linestyle=dashed,dash=";
- for (i = 0; i < style->stroke_dash.n_dash; i++) {
+ for (unsigned i = 0; i < style->stroke_dasharray.values.size(); i++) {
if ((i)) {
os << " ";
}
- os << style->stroke_dash.dash[i];
+ os << style->stroke_dasharray.values[i];
}
}
diff --git a/src/extension/internal/metafile-inout.cpp b/src/extension/internal/metafile-inout.cpp
index c7ae53370..1d419a6a0 100644
--- a/src/extension/internal/metafile-inout.cpp
+++ b/src/extension/internal/metafile-inout.cpp
@@ -17,6 +17,7 @@
#include <glib.h>
#include <glibmm/miscutils.h>
+#include "display/curve.h"
#include "extension/internal/metafile-inout.h" // picks up PNG
#include "extension/print.h"
#include "path-prefix.h"
diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp
index 3a62c9c16..906c40301 100644
--- a/src/extension/internal/wmf-inout.cpp
+++ b/src/extension/internal/wmf-inout.cpp
@@ -820,14 +820,14 @@ Wmf::output_style(PWMF_CALLBACK_DATA d)
tmp_style << "stroke-miterlimit:" <<
MAX( 2.0, d->dc[d->level].style.stroke_miterlimit.value ) << ";";
- if (d->dc[d->level].style.stroke_dasharray_set &&
- d->dc[d->level].style.stroke_dash.n_dash && d->dc[d->level].style.stroke_dash.dash)
+ if (d->dc[d->level].style.stroke_dasharray.set &&
+ !d->dc[d->level].style.stroke_dasharray.values.empty())
{
tmp_style << "stroke-dasharray:";
- for (int i=0; i<d->dc[d->level].style.stroke_dash.n_dash; i++) {
+ for (unsigned i=0; i<d->dc[d->level].style.stroke_dasharray.values.size(); i++) {
if (i)
tmp_style << ",";
- tmp_style << d->dc[d->level].style.stroke_dash.dash[i];
+ tmp_style << d->dc[d->level].style.stroke_dasharray.values[i];
}
tmp_style << ";";
tmp_style << "stroke-dashoffset:0;";
@@ -920,34 +920,30 @@ Wmf::select_pen(PWMF_CALLBACK_DATA d, int index)
case U_PS_DASHDOT:
case U_PS_DASHDOTDOT:
{
- int i = 0;
int penstyle = (up.Style & U_PS_STYLE_MASK);
- d->dc[d->level].style.stroke_dash.n_dash =
- penstyle == U_PS_DASHDOTDOT ? 6 : penstyle == U_PS_DASHDOT ? 4 : 2;
- if (d->dc[d->level].style.stroke_dash.dash && (d->level==0 || (d->level>0 && d->dc[d->level].style.stroke_dash.dash!=d->dc[d->level-1].style.stroke_dash.dash)))
- delete[] d->dc[d->level].style.stroke_dash.dash;
- d->dc[d->level].style.stroke_dash.dash = new double[d->dc[d->level].style.stroke_dash.n_dash];
+ if (!d->dc[d->level].style.stroke_dasharray.values.empty() && (d->level==0 || (d->level>0 && d->dc[d->level].style.stroke_dasharray.values!=d->dc[d->level-1].style.stroke_dasharray.values)))
+ d->dc[d->level].style.stroke_dasharray.values.clear();
if (penstyle==U_PS_DASH || penstyle==U_PS_DASHDOT || penstyle==U_PS_DASHDOTDOT) {
- d->dc[d->level].style.stroke_dash.dash[i++] = 3;
- d->dc[d->level].style.stroke_dash.dash[i++] = 1;
+ d->dc[d->level].style.stroke_dasharray.values.push_back( 3 );
+ d->dc[d->level].style.stroke_dasharray.values.push_back( 1 );
}
if (penstyle==U_PS_DOT || penstyle==U_PS_DASHDOT || penstyle==U_PS_DASHDOTDOT) {
- d->dc[d->level].style.stroke_dash.dash[i++] = 1;
- d->dc[d->level].style.stroke_dash.dash[i++] = 1;
+ d->dc[d->level].style.stroke_dasharray.values.push_back( 1 );
+ d->dc[d->level].style.stroke_dasharray.values.push_back( 1 );
}
if (penstyle==U_PS_DASHDOTDOT) {
- d->dc[d->level].style.stroke_dash.dash[i++] = 1;
- d->dc[d->level].style.stroke_dash.dash[i++] = 1;
+ d->dc[d->level].style.stroke_dasharray.values.push_back( 1 );
+ d->dc[d->level].style.stroke_dasharray.values.push_back( 1 );
}
- d->dc[d->level].style.stroke_dasharray_set = 1;
+ d->dc[d->level].style.stroke_dasharray.set = 1;
break;
}
case U_PS_SOLID:
default:
{
- d->dc[d->level].style.stroke_dasharray_set = 0;
+ d->dc[d->level].style.stroke_dasharray.set = 0;
break;
}
}
@@ -1174,7 +1170,7 @@ Wmf::delete_object(PWMF_CALLBACK_DATA d, int index)
// If the active object is deleted set default draw values
if(index == d->dc[d->level].active_pen){ // Use default pen: solid, black, 1 pixel wide
d->dc[d->level].active_pen = -1;
- d->dc[d->level].style.stroke_dasharray_set = 0;
+ d->dc[d->level].style.stroke_dasharray.set = 0;
d->dc[d->level].style.stroke_linecap.computed = 2; // U_PS_ENDCAP_SQUARE
d->dc[d->level].style.stroke_linejoin.computed = 0; // U_PS_JOIN_MITER;
d->dc[d->level].stroke_set = true;
@@ -2310,8 +2306,8 @@ std::cout << "BEFORE DRAW"
d->level = d->level + DC;
}
while (old_level > d->level) {
- if (d->dc[old_level].style.stroke_dash.dash && (old_level==0 || (old_level>0 && d->dc[old_level].style.stroke_dash.dash!=d->dc[old_level-1].style.stroke_dash.dash))){
- delete[] d->dc[old_level].style.stroke_dash.dash;
+ if (!d->dc[old_level].style.stroke_dasharray.values.empty() && (old_level==0 || (old_level>0 && d->dc[old_level].style.stroke_dasharray.values!=d->dc[old_level-1].style.stroke_dasharray.values))){
+ d->dc[old_level].style.stroke_dasharray.values.clear();
}
if(d->dc[old_level].font_name){
free(d->dc[old_level].font_name); // else memory leak
@@ -2976,7 +2972,7 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri )
d.dc[0].bkMode = U_TRANSPARENT;
d.dc[0].dirty = 0;
// Default pen, WMF files that do not specify a pen are unlikely to look very good!
- d.dc[0].style.stroke_dasharray_set = 0;
+ d.dc[0].style.stroke_dasharray.set = 0;
d.dc[0].style.stroke_linecap.computed = 2; // U_PS_ENDCAP_SQUARE;
d.dc[0].style.stroke_linejoin.computed = 0; // U_PS_JOIN_MITER;
d.dc[0].stroke_set = true;
@@ -3051,8 +3047,7 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri )
delete[] d.wmf_obj;
}
- if (d.dc[0].style.stroke_dash.dash)
- delete[] d.dc[0].style.stroke_dash.dash;
+ d.dc[0].style.stroke_dasharray.values.clear();
for(int i=0; i<=d.level;i++){
if(d.dc[i].font_name)free(d.dc[i].font_name);
diff --git a/src/extension/internal/wmf-print.cpp b/src/extension/internal/wmf-print.cpp
index 32c7ac0bd..232891c9c 100644
--- a/src/extension/internal/wmf-print.cpp
+++ b/src/extension/internal/wmf-print.cpp
@@ -596,8 +596,7 @@ int PrintWmf::create_pen(SPStyle const *style, const Geom::Affine &transform)
modstyle |= U_PS_JOIN_BEVEL;
}
- if (style->stroke_dash.n_dash &&
- style->stroke_dash.dash) {
+ if (!style->stroke_dasharray.values.empty()) {
if (!FixPPTDashLine) { // if this is set code elsewhere will break dots/dashes into many smaller lines.
penstyle = U_PS_DASH;// userstyle not supported apparently, for now map all Inkscape dot/dash to just dash
}
@@ -824,7 +823,7 @@ unsigned int PrintWmf::fill(
}
if (
(style->stroke.isNone() || style->stroke.noneSet || style->stroke_width.computed == 0.0) ||
- (style->stroke_dash.n_dash && style->stroke_dash.dash && FixPPTDashLine) ||
+ (!style->stroke_dasharray.values.empty() && FixPPTDashLine) ||
!all_closed
) {
print_pathv(pathv, fill_transform); // do any fills. side effect: clears fill_pathv
@@ -852,13 +851,13 @@ unsigned int PrintWmf::stroke(
return 0;
}
- if (style->stroke_dash.n_dash && style->stroke_dash.dash && FixPPTDashLine) {
+ if (!style->stroke_dasharray.values.empty() && FixPPTDashLine) {
// convert the path, gets its complete length, and then make a new path with parameter length instead of t
Geom::Piecewise<Geom::D2<Geom::SBasis> > tmp_pathpw; // pathv-> sbasis
Geom::Piecewise<Geom::D2<Geom::SBasis> > tmp_pathpw2; // sbasis using arc length parameter
Geom::Piecewise<Geom::D2<Geom::SBasis> > tmp_pathpw3; // new (discontinuous) path, composed of dots/dashes
Geom::Piecewise<Geom::D2<Geom::SBasis> > first_frag; // first fragment, will be appended at end
- int n_dash = style->stroke_dash.n_dash;
+ int n_dash = style->stroke_dasharray.values.size();
int i = 0; //dash index
double tlength; // length of tmp_pathpw
double slength = 0.0; // start of gragment
@@ -871,7 +870,7 @@ unsigned int PrintWmf::stroke(
// go around the dash array repeatedly until the entire path is consumed (but not beyond).
while (slength < tlength) {
- elength = slength + style->stroke_dash.dash[i++];
+ elength = slength + style->stroke_dasharray.values[i++];
if (elength > tlength) {
elength = tlength;
}
@@ -882,7 +881,7 @@ unsigned int PrintWmf::stroke(
first_frag = fragment;
}
slength = elength;
- slength += style->stroke_dash.dash[i++]; // the gap
+ slength += style->stroke_dasharray.values[i++]; // the gap
if (i >= n_dash) {
i = 0;
}
diff --git a/src/gradient-drag.h b/src/gradient-drag.h
index c92a5c22f..4ed13b9f7 100644
--- a/src/gradient-drag.h
+++ b/src/gradient-drag.h
@@ -25,7 +25,6 @@
#include <2geom/point.h>
-#include "knot-enums.h"
#include "sp-gradient.h" // TODO refactor enums to external .h file
#include "sp-mesh-array.h"
diff --git a/src/knotholder.h b/src/knotholder.h
index 25557bef2..fc91a56fc 100644
--- a/src/knotholder.h
+++ b/src/knotholder.h
@@ -18,7 +18,6 @@
*/
#include <glib.h>
-#include "knot-enums.h"
#include <2geom/forward.h>
#include <list>
#include <sigc++/connection.h>
diff --git a/src/line-geometry.h b/src/line-geometry.h
index 48baad265..d7be9570c 100644
--- a/src/line-geometry.h
+++ b/src/line-geometry.h
@@ -16,8 +16,7 @@
#include "glib.h"
#include "axis-manip.h" // FIXME: This is only for Box3D::epsilon; move that to a better location
#include "2geom/point.h"
-#include "document.h"
-#include "ui/view/view.h"
+#include "persp3d.h"
class SPDesktop;
diff --git a/src/livarot/PathCutting.cpp b/src/livarot/PathCutting.cpp
index 0dc7ede50..49b2c5a78 100644
--- a/src/livarot/PathCutting.cpp
+++ b/src/livarot/PathCutting.cpp
@@ -58,31 +58,36 @@ void Path::DashPolyline(float head,float tail,float body,int nbD,float *dashs,b
void Path::DashPolylineFromStyle(SPStyle *style, float scale, float min_len)
{
- if (style->stroke_dash.n_dash) {
+ if (!style->stroke_dasharray.values.empty()) {
double dlen = 0.0;
- for (int i = 0; i < style->stroke_dash.n_dash; i++) {
- dlen += style->stroke_dash.dash[i] * scale;
+ // Find total length
+ for (unsigned i = 0; i < style->stroke_dasharray.values.size(); i++) {
+ dlen += style->stroke_dasharray.values[i] * scale;
}
if (dlen >= min_len) {
- NRVpathDash dash;
- dash.offset = style->stroke_dash.offset * scale;
- dash.n_dash = style->stroke_dash.n_dash;
- dash.dash = g_new(double, dash.n_dash);
- for (int i = 0; i < dash.n_dash; i++) {
- dash.dash[i] = style->stroke_dash.dash[i] * scale;
+ // Extract out dash pattern (relative positions)
+ double dash_offset = style->stroke_dashoffset.value * scale;
+ size_t n_dash = style->stroke_dasharray.values.size();
+ double *dash = g_new(double, n_dash);
+ for (unsigned i = 0; i < n_dash; i++) {
+ dash[i] = style->stroke_dasharray.values[i] * scale;
}
- int nbD=dash.n_dash;
+
+ // Convert relative positions to absolute postions
+ int nbD = n_dash;
float *dashs=(float*)malloc((nbD+1)*sizeof(float));
- while ( dash.offset >= dlen ) dash.offset-=dlen;
- dashs[0]=dash.dash[0];
+ while ( dash_offset >= dlen ) dash_offset-=dlen;
+ dashs[0]=dash[0];
for (int i=1; i<nbD; i++) {
- dashs[i]=dashs[i-1]+dash.dash[i];
+ dashs[i]=dashs[i-1]+dash[i];
}
+
// modulo dlen
- this->DashPolyline(0.0, 0.0, dlen, nbD, dashs, true, dash.offset);
+ this->DashPolyline(0.0, 0.0, dlen, nbD, dashs, true, dash_offset);
+
free(dashs);
- g_free(dash.dash);
+ g_free(dash);
}
}
}
diff --git a/src/marker.h b/src/marker.h
index 21ad63a41..585615476 100644
--- a/src/marker.h
+++ b/src/marker.h
@@ -29,7 +29,6 @@ struct SPMarkerView;
#include "svg/svg-length.h"
#include "enums.h"
#include "sp-item-group.h"
-#include "sp-marker-loc.h"
#include "uri-references.h"
#include "viewbox.h"
diff --git a/src/persp3d.h b/src/persp3d.h
index 4690c0582..bd3777a19 100644
--- a/src/persp3d.h
+++ b/src/persp3d.h
@@ -18,10 +18,10 @@
#include <list>
#include <vector>
#include <map>
-#include "sp-item.h"
#include "transf_mat_3x4.h"
#include "document.h"
-#include "inkscape.h"
+#include "inkscape.h" // for SP_ACTIVE_DOCUMENT
+#include "sp-object.h"
class SPBox3D;
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index b3d9af910..fad2dff5b 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -2067,17 +2067,9 @@ GSList *sp_get_same_stroke_style(SPItem *sel, GSList *src, SPSelectStrokeStyleTy
}
}
else if (type == SP_STROKE_STYLE_DASHES ) {
- match = (sel_style->stroke_dasharray_set == iter_style->stroke_dasharray_set);
- if (sel_style->stroke_dasharray_set && iter_style->stroke_dasharray_set) {
- match = (sel_style->stroke_dash.n_dash == iter_style->stroke_dash.n_dash);
- if (sel_style->stroke_dash.n_dash == iter_style->stroke_dash.n_dash) {
- for (int i = 0; i < sel_style->stroke_dash.n_dash; i++) {
- if (sel_style->stroke_dash.dash[i] != iter_style->stroke_dash.dash[i]) {
- match = false;
- break;
- }
- }
- }
+ match = (sel_style->stroke_dasharray.set == iter_style->stroke_dasharray.set);
+ if (sel_style->stroke_dasharray.set && iter_style->stroke_dasharray.set) {
+ match = (sel_style->stroke_dasharray.values == iter_style->stroke_dasharray.values);
}
}
else if (type == SP_STROKE_STYLE_MARKERS) {
diff --git a/src/selection.h b/src/selection.h
index 373167a33..ba38bec08 100644
--- a/src/selection.h
+++ b/src/selection.h
@@ -23,9 +23,7 @@
#include "gc-finalized.h"
#include "gc-anchored.h"
#include "gc-soft-ptr.h"
-#include "util/list.h"
#include "sp-item.h"
-#include "snapped-point.h"
class SPDesktop;
diff --git a/src/snapper.h b/src/snapper.h
index d9f3ab797..c609239cf 100644
--- a/src/snapper.h
+++ b/src/snapper.h
@@ -20,7 +20,6 @@
#include "snapped-point.h"
#include "snapped-line.h"
#include "snapped-curve.h"
-#include "snap-preferences.h"
#include "snap-candidate.h"
struct IntermSnapResults {
diff --git a/src/sp-image.h b/src/sp-image.h
index 50eb731d7..17262d74f 100644
--- a/src/sp-image.h
+++ b/src/sp-image.h
@@ -17,7 +17,8 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glibmm/ustring.h>
#include "svg/svg-length.h"
-#include "sp-shape.h"
+#include "display/curve.h"
+#include "sp-item.h"
#include "viewbox.h"
#define SP_IMAGE(obj) (dynamic_cast<SPImage*>((SPObject*)obj))
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index ff3e3a31c..cd8e2119b 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -1208,11 +1208,11 @@ void SPItem::adjust_stroke( gdouble ex )
style->stroke_width.computed *= ex;
style->stroke_width.set = TRUE;
- if ( style->stroke_dash.n_dash != 0 ) {
- for (int i = 0; i < style->stroke_dash.n_dash; i++) {
- style->stroke_dash.dash[i] *= ex;
+ if ( !style->stroke_dasharray.values.empty() ) {
+ for (unsigned i = 0; i < style->stroke_dasharray.values.size(); i++) {
+ style->stroke_dasharray.values[i] *= ex;
}
- style->stroke_dash.offset *= ex;
+ style->stroke_dashoffset.value *= ex;
}
updateRepr();
diff --git a/src/sp-paint-server.h b/src/sp-paint-server.h
index 89c4f6b1b..02e2f10ec 100644
--- a/src/sp-paint-server.h
+++ b/src/sp-paint-server.h
@@ -18,7 +18,6 @@
#include <cairo.h>
#include <2geom/rect.h>
#include "sp-object.h"
-#include "uri-references.h"
#define SP_PAINT_SERVER(obj) (dynamic_cast<SPPaintServer*>((SPObject*)obj))
#define SP_IS_PAINT_SERVER(obj) (dynamic_cast<const SPPaintServer*>((SPObject*)obj) != NULL)
diff --git a/src/sp-root.h b/src/sp-root.h
index 0e5d87133..a25e8030c 100644
--- a/src/sp-root.h
+++ b/src/sp-root.h
@@ -16,7 +16,6 @@
#include "version.h"
#include "svg/svg-length.h"
-#include "enums.h"
#include "sp-item-group.h"
#include "viewbox.h"
diff --git a/src/sp-script.h b/src/sp-script.h
index 95b56e79c..36072a0ca 100644
--- a/src/sp-script.h
+++ b/src/sp-script.h
@@ -12,7 +12,8 @@
* Released under GNU GPL version 2 or later, read the file 'COPYING' for more information
*/
-#include "sp-item.h"
+#include "sp-object.h"
+#include "document.h"
#define SP_SCRIPT(obj) (dynamic_cast<SPScript*>((SPObject*)obj))
#define SP_IS_SCRIPT(obj) (dynamic_cast<const SPScript*>((SPObject*)obj) != NULL)
diff --git a/src/sp-symbol.h b/src/sp-symbol.h
index d1e62e923..a2e769cc2 100644
--- a/src/sp-symbol.h
+++ b/src/sp-symbol.h
@@ -22,8 +22,6 @@
#define SP_IS_SYMBOL(obj) (dynamic_cast<const SPSymbol*>((SPObject*)obj) != NULL)
#include <2geom/affine.h>
-#include "svg/svg-length.h"
-#include "enums.h"
#include "sp-item-group.h"
#include "viewbox.h"
diff --git a/src/sp-text.h b/src/sp-text.h
index f7cf5a3aa..5f0485083 100644
--- a/src/sp-text.h
+++ b/src/sp-text.h
@@ -16,8 +16,8 @@
#include <glib.h>
#include <stddef.h>
#include <sigc++/sigc++.h>
+#include "sp-string.h" // Provides many other headers with SP_IS_STRING
#include "sp-item.h"
-#include "sp-string.h"
#include "text-tag-attributes.h"
#include "libnrtype/Layout-TNG.h"
diff --git a/src/sp-use.h b/src/sp-use.h
index 604040d59..215eb44d7 100644
--- a/src/sp-use.h
+++ b/src/sp-use.h
@@ -17,6 +17,7 @@
#include <sigc++/sigc++.h>
#include "svg/svg-length.h"
#include "sp-item.h"
+#include "enums.h"
#define SP_USE(obj) (dynamic_cast<SPUse*>((SPObject*)obj))
#define SP_IS_USE(obj) (dynamic_cast<const SPUse*>((SPObject*)obj) != NULL)
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index 1eab73b62..c800ace0b 100644
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
@@ -1004,7 +1004,7 @@ Geom::PathVector* item_outline(SPItem const *item, bool bbox_only)
Path *res = new Path;
res->SetBackData(false);
- if (i_style->stroke_dash.n_dash) {
+ if (!i_style->stroke_dasharray.values.empty()) {
// For dashed strokes, use Stroke method, because Outline can't do dashes
// However Stroke adds lots of extra nodes _or_ makes the path crooked, so consider this a temporary workaround
@@ -1273,7 +1273,7 @@ sp_selected_path_outline(SPDesktop *desktop)
Path *res = new Path;
res->SetBackData(false);
- if (i_style->stroke_dash.n_dash) {
+ if (!i_style->stroke_dasharray.values.empty()) {
// For dashed strokes, use Stroke method, because Outline can't do dashes
// However Stroke adds lots of extra nodes _or_ makes the path crooked, so consider this a temporary workaround
diff --git a/src/style-enums.h b/src/style-enums.h
new file mode 100644
index 000000000..c6f9a1ea1
--- /dev/null
+++ b/src/style-enums.h
@@ -0,0 +1,230 @@
+#ifndef SEEN_SP_STYLE_ENUMS_H
+#define SEEN_SP_STYLE_ENUMS_H
+
+/** \file
+ * SPStyle enums: named public enums that correspond to SVG property values.
+ */
+/* Authors:
+ * Lauris Kaplinski <lauris@kaplinski.com>
+ * Jon A. Cruz <jon@joncruz.org>
+ *
+ * Copyright (C) 2010 Jon A. Cruz
+ * Copyright (C) 2001-2002 Lauris Kaplinski
+ * Copyright (C) 2001 Ximian, Inc.
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+/* SPTextStyle */
+
+enum SPCSSFontSize {
+ SP_CSS_FONT_SIZE_XX_SMALL,
+ SP_CSS_FONT_SIZE_X_SMALL,
+ SP_CSS_FONT_SIZE_SMALL,
+ SP_CSS_FONT_SIZE_MEDIUM,
+ SP_CSS_FONT_SIZE_LARGE,
+ SP_CSS_FONT_SIZE_X_LARGE,
+ SP_CSS_FONT_SIZE_XX_LARGE,
+ SP_CSS_FONT_SIZE_SMALLER,
+ SP_CSS_FONT_SIZE_LARGER
+};
+
+enum SPCSSFontStyle {
+ SP_CSS_FONT_STYLE_NORMAL,
+ SP_CSS_FONT_STYLE_ITALIC,
+ SP_CSS_FONT_STYLE_OBLIQUE
+};
+
+enum SPCSSFontVariant {
+ SP_CSS_FONT_VARIANT_NORMAL,
+ SP_CSS_FONT_VARIANT_SMALL_CAPS
+};
+
+enum SPCSSFontWeight {
+ SP_CSS_FONT_WEIGHT_100,
+ SP_CSS_FONT_WEIGHT_200,
+ SP_CSS_FONT_WEIGHT_300,
+ SP_CSS_FONT_WEIGHT_400,
+ SP_CSS_FONT_WEIGHT_500,
+ SP_CSS_FONT_WEIGHT_600,
+ SP_CSS_FONT_WEIGHT_700,
+ SP_CSS_FONT_WEIGHT_800,
+ SP_CSS_FONT_WEIGHT_900,
+ SP_CSS_FONT_WEIGHT_NORMAL,
+ SP_CSS_FONT_WEIGHT_BOLD,
+ SP_CSS_FONT_WEIGHT_LIGHTER,
+ SP_CSS_FONT_WEIGHT_BOLDER
+};
+
+enum SPCSSFontStretch {
+ SP_CSS_FONT_STRETCH_ULTRA_CONDENSED,
+ SP_CSS_FONT_STRETCH_EXTRA_CONDENSED,
+ SP_CSS_FONT_STRETCH_CONDENSED,
+ SP_CSS_FONT_STRETCH_SEMI_CONDENSED,
+ SP_CSS_FONT_STRETCH_NORMAL,
+ SP_CSS_FONT_STRETCH_SEMI_EXPANDED,
+ SP_CSS_FONT_STRETCH_EXPANDED,
+ SP_CSS_FONT_STRETCH_EXTRA_EXPANDED,
+ SP_CSS_FONT_STRETCH_ULTRA_EXPANDED,
+ SP_CSS_FONT_STRETCH_NARROWER,
+ SP_CSS_FONT_STRETCH_WIDER
+};
+
+enum SPCSSTextAlign {
+ SP_CSS_TEXT_ALIGN_START,
+ SP_CSS_TEXT_ALIGN_END,
+ SP_CSS_TEXT_ALIGN_LEFT,
+ SP_CSS_TEXT_ALIGN_RIGHT,
+ SP_CSS_TEXT_ALIGN_CENTER,
+ SP_CSS_TEXT_ALIGN_JUSTIFY
+ // also <string> is allowed, but only within table calls
+};
+
+enum SPCSSTextTransform {
+ SP_CSS_TEXT_TRANSFORM_CAPITALIZE,
+ SP_CSS_TEXT_TRANSFORM_UPPERCASE,
+ SP_CSS_TEXT_TRANSFORM_LOWERCASE,
+ SP_CSS_TEXT_TRANSFORM_NONE
+};
+
+enum SPCSSDirection {
+ SP_CSS_DIRECTION_LTR,
+ SP_CSS_DIRECTION_RTL
+};
+
+enum SPCSSBlockProgression {
+ SP_CSS_BLOCK_PROGRESSION_TB,
+ SP_CSS_BLOCK_PROGRESSION_RL,
+ SP_CSS_BLOCK_PROGRESSION_LR
+};
+
+enum SPCSSWritingMode {
+ SP_CSS_WRITING_MODE_LR_TB,
+ SP_CSS_WRITING_MODE_RL_TB,
+ SP_CSS_WRITING_MODE_TB_RL,
+ SP_CSS_WRITING_MODE_TB_LR
+};
+
+enum SPTextAnchor {
+ SP_CSS_TEXT_ANCHOR_START,
+ SP_CSS_TEXT_ANCHOR_MIDDLE,
+ SP_CSS_TEXT_ANCHOR_END
+};
+
+enum SPCSSBaselineShift {
+ SP_CSS_BASELINE_SHIFT_BASELINE,
+ SP_CSS_BASELINE_SHIFT_SUB,
+ SP_CSS_BASELINE_SHIFT_SUPER
+};
+
+enum SPVisibility {
+ SP_CSS_VISIBILITY_HIDDEN,
+ SP_CSS_VISIBILITY_COLLAPSE,
+ SP_CSS_VISIBILITY_VISIBLE
+};
+
+enum SPOverflow {
+ SP_CSS_OVERFLOW_VISIBLE,
+ SP_CSS_OVERFLOW_HIDDEN,
+ SP_CSS_OVERFLOW_SCROLL,
+ SP_CSS_OVERFLOW_AUTO
+};
+
+/// \todo more display types
+enum SPCSSDisplay {
+ SP_CSS_DISPLAY_NONE,
+ SP_CSS_DISPLAY_INLINE,
+ SP_CSS_DISPLAY_BLOCK,
+ SP_CSS_DISPLAY_LIST_ITEM,
+ SP_CSS_DISPLAY_RUN_IN,
+ SP_CSS_DISPLAY_COMPACT,
+ SP_CSS_DISPLAY_MARKER,
+ SP_CSS_DISPLAY_TABLE,
+ SP_CSS_DISPLAY_INLINE_TABLE,
+ SP_CSS_DISPLAY_TABLE_ROW_GROUP,
+ SP_CSS_DISPLAY_TABLE_HEADER_GROUP,
+ SP_CSS_DISPLAY_TABLE_FOOTER_GROUP,
+ SP_CSS_DISPLAY_TABLE_ROW,
+ SP_CSS_DISPLAY_TABLE_COLUMN_GROUP,
+ SP_CSS_DISPLAY_TABLE_COLUMN,
+ SP_CSS_DISPLAY_TABLE_CELL,
+ SP_CSS_DISPLAY_TABLE_CAPTION
+};
+
+enum SPIsolation {
+ SP_CSS_ISOLATION_AUTO,
+ SP_CSS_ISOLATION_ISOLATE
+};
+
+enum SPBlendMode {
+ SP_CSS_BLEND_NORMAL,
+ SP_CSS_BLEND_MULTIPLY,
+ SP_CSS_BLEND_SCREEN,
+ SP_CSS_BLEND_DARKEN,
+ SP_CSS_BLEND_LIGHTEN,
+ SP_CSS_BLEND_OVERLAY,
+ SP_CSS_BLEND_COLORDODGE,
+ SP_CSS_BLEND_COLORBURN,
+ SP_CSS_BLEND_HARDLIGHT,
+ SP_CSS_BLEND_SOFTLIGHT,
+ SP_CSS_BLEND_DIFFERENCE,
+ SP_CSS_BLEND_EXCLUSION,
+ SP_CSS_BLEND_HUE,
+ SP_CSS_BLEND_SATURATION,
+ SP_CSS_BLEND_COLOR,
+ SP_CSS_BLEND_LUMINOSITY
+};
+
+enum SPEnableBackground {
+ SP_CSS_BACKGROUND_ACCUMULATE,
+ SP_CSS_BACKGROUND_NEW
+};
+
+enum SPColorInterpolation {
+ SP_CSS_COLOR_INTERPOLATION_AUTO,
+ SP_CSS_COLOR_INTERPOLATION_SRGB,
+ SP_CSS_COLOR_INTERPOLATION_LINEARRGB
+};
+
+enum SPColorRendering {
+ SP_CSS_COLOR_RENDERING_AUTO,
+ SP_CSS_COLOR_RENDERING_OPTIMIZESPEED,
+ SP_CSS_COLOR_RENDERING_OPTIMIZEQUALITY
+};
+
+/* Last two are CSS4 Image values... for the momement prefaced with -inkscape. */
+enum SPImageRendering {
+ SP_CSS_IMAGE_RENDERING_AUTO,
+ SP_CSS_IMAGE_RENDERING_OPTIMIZESPEED,
+ SP_CSS_IMAGE_RENDERING_OPTIMIZEQUALITY,
+ SP_CSS_IMAGE_RENDERING_CRISPEDGES,
+ SP_CSS_IMAGE_RENDERING_PIXELATED
+};
+
+enum SPShapeRendering {
+ SP_CSS_SHAPE_RENDERING_AUTO,
+ SP_CSS_SHAPE_RENDERING_OPTIMIZESPEED,
+ SP_CSS_SHAPE_RENDERING_CRISPEDGES,
+ SP_CSS_SHAPE_RENDERING_GEOMETRICPRECISION
+};
+
+enum SPTextRendering {
+ SP_CSS_TEXT_RENDERING_AUTO,
+ SP_CSS_TEXT_RENDERING_OPTIMIZESPEED,
+ SP_CSS_TEXT_RENDERING_OPTIMIZELEGIBILITY,
+ SP_CSS_TEXT_RENDERING_GEOMETRICPRECISION
+};
+
+#endif // SEEN_SP_STYLE_ENUMS_H
+
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/src/style-internal.h b/src/style-internal.h
new file mode 100644
index 000000000..7d45f96f8
--- /dev/null
+++ b/src/style-internal.h
@@ -0,0 +1,305 @@
+#ifndef SEEN_SP_STYLE_INTERNAL_H
+#define SEEN_SP_STYLE_INTERNAL_H
+
+/** \file
+ * SPStyle internal: classes that are internal to SPStyle
+ */
+/* Authors:
+ * Lauris Kaplinski <lauris@kaplinski.com>
+ * Jon A. Cruz <jon@joncruz.org>
+ *
+ * Copyright (C) 2010 Jon A. Cruz
+ * Copyright (C) 2001-2002 Lauris Kaplinski
+ * Copyright (C) 2001 Ximian, Inc.
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "color.h"
+#include "sp-marker-loc.h"
+#include "sp-filter.h"
+#include "sp-filter-reference.h"
+#include "sp-paint-server-reference.h"
+#include "uri.h"
+
+#include <vector>
+
+/// Float type internal to SPStyle.
+struct SPIFloat {
+ unsigned set : 1;
+ unsigned inherit : 1;
+ unsigned data : 30;
+ float value;
+};
+
+/*
+ * One might think that the best value for SP_SCALE24_MAX would be ((1<<24)-1), which allows the
+ * greatest possible precision for fitting [0, 1] fractions into 24 bits.
+ *
+ * However, in practice, that gives a problem with 0.5, which falls half way between two fractions
+ * of ((1<<24)-1). What's worse is that casting double(1<<23) / ((1<<24)-1) to float on x86
+ * produces wrong rounding behaviour, resulting in a fraction of ((1<<23)+2.0f) / (1<<24) rather
+ * than ((1<<23)+1.0f) / (1<<24) as one would expect, let alone ((1<<23)+0.0f) / (1<<24) as one
+ * would ideally like for this example.
+ *
+ * The value (1<<23) is thus best if one considers float conversions alone.
+ *
+ * The value 0xff0000 can exactly represent all 8-bit alpha channel values,
+ * and can exactly represent all multiples of 0.1. I haven't yet tested whether
+ * rounding bugs still get in the way of conversions to & from float, but my instinct is that
+ * it's fairly safe because 0xff fits three times inside float's significand.
+ *
+ * We should probably use the value 0xffff00 once we support 16 bits per channel and/or LittleCMS,
+ * though that might need to be accompanied by greater use of double instead of float for
+ * colours and opacities, to be safe from rounding bugs.
+ */
+static const unsigned SP_SCALE24_MAX = 0xff0000;
+#define SP_SCALE24_TO_FLOAT(v) ((double) (v) / SP_SCALE24_MAX)
+#define SP_SCALE24_FROM_FLOAT(v) unsigned(((v) * SP_SCALE24_MAX) + .5)
+
+/** Returns a scale24 for the product of two scale24 values. */
+#define SP_SCALE24_MUL(_v1, _v2) unsigned((double)(_v1) * (_v2) / SP_SCALE24_MAX + .5)
+
+/// 24 bit data type internal to SPStyle.
+struct SPIScale24 {
+ unsigned set : 1;
+ unsigned inherit : 1;
+ unsigned value : 24;
+};
+
+/// Int type internal to SPStyle.
+struct SPIInt {
+ unsigned set : 1;
+ unsigned inherit : 1;
+ unsigned data : 30;
+ int value;
+};
+
+/// Short type internal to SPStyle.
+struct SPIShort {
+ unsigned set : 1;
+ unsigned inherit : 1;
+ unsigned data : 14;
+ int value : 16;
+};
+
+/// Enum type internal to SPStyle.
+struct SPIEnum {
+ unsigned set : 1;
+ unsigned inherit : 1;
+ unsigned value : 8;
+ unsigned computed : 8;
+};
+
+/// String type internal to SPStyle.
+struct SPIString {
+ unsigned set : 1;
+ unsigned inherit : 1;
+ unsigned data : 30;
+ gchar *value;
+};
+
+enum SPCSSUnit {
+ SP_CSS_UNIT_NONE,
+ SP_CSS_UNIT_PX,
+ SP_CSS_UNIT_PT,
+ SP_CSS_UNIT_PC,
+ SP_CSS_UNIT_MM,
+ SP_CSS_UNIT_CM,
+ SP_CSS_UNIT_IN,
+ SP_CSS_UNIT_EM,
+ SP_CSS_UNIT_EX,
+ SP_CSS_UNIT_PERCENT
+};
+
+/// Length type internal to SPStyle.
+struct SPILength {
+ unsigned set : 1;
+ unsigned inherit : 1;
+ unsigned unit : 4;
+ float value;
+ float computed;
+};
+
+#define SP_STYLE_FILL_SERVER(s) ((const_cast<SPStyle *> (s))->getFillPaintServer())
+#define SP_STYLE_STROKE_SERVER(s) ((const_cast<SPStyle *> (s))->getStrokePaintServer())
+
+/// Paint type internal to SPStyle.
+struct SPIPaint {
+ unsigned int set : 1; //c++ bitfields are used here as opposed to bools to reduce memory consumption, see http://tinyurl.com/cswh6mq
+ unsigned int inherit : 1;
+ unsigned int currentcolor : 1;
+ unsigned int colorSet : 1;
+ unsigned int noneSet : 1;
+ struct {
+ SPPaintServerReference *href;
+ SPColor color;
+ } value;
+
+ SPIPaint();
+
+ bool isSet() const { return true; /* set || colorSet*/}
+ bool isSameType( SPIPaint const & other ) const {return (isPaintserver() == other.isPaintserver()) && (colorSet == other.colorSet) && (currentcolor == other.currentcolor);}
+
+ bool isNoneSet() const {return noneSet;}
+
+ bool isNone() const {return !currentcolor && !colorSet && !isPaintserver();} // TODO refine
+ bool isColor() const {return colorSet && !isPaintserver();}
+ bool isPaintserver() const {return (value.href) ? value.href->getObject():0;}
+
+ void clear();
+
+ void setColor( float r, float g, float b ) {value.color.set( r, g, b ); colorSet = true;}
+ void setColor( guint32 val ) {value.color.set( val ); colorSet = true;}
+ void setColor( SPColor const& color ) {value.color = color; colorSet = true;}
+
+ void read( gchar const *str, SPStyle &tyle, SPDocument *document = 0);
+};
+
+class SPIDashArray {
+ public:
+ unsigned set : 1;
+ unsigned inherit : 1;
+ std::vector<double> values;
+};
+
+// SVG 2
+enum SPPaintOrderLayer {
+ SP_CSS_PAINT_ORDER_NORMAL,
+ SP_CSS_PAINT_ORDER_FILL,
+ SP_CSS_PAINT_ORDER_STROKE,
+ SP_CSS_PAINT_ORDER_MARKER
+};
+
+const size_t PAINT_ORDER_LAYERS = 3;
+struct SPIPaintOrder {
+ unsigned set : 1;
+ unsigned inherit : 1;
+ SPPaintOrderLayer layer[PAINT_ORDER_LAYERS];
+ bool layer_set[PAINT_ORDER_LAYERS];
+ gchar *value; // Raw string
+};
+
+/// Filter type internal to SPStyle
+struct SPIFilter {
+ unsigned set : 1;
+ unsigned inherit : 1;
+ SPFilterReference *href;
+};
+
+enum {
+ SP_FONT_SIZE_LITERAL,
+ SP_FONT_SIZE_LENGTH,
+ SP_FONT_SIZE_PERCENTAGE
+};
+
+enum {
+ SP_BASELINE_SHIFT_LITERAL,
+ SP_BASELINE_SHIFT_LENGTH,
+ SP_BASELINE_SHIFT_PERCENTAGE
+};
+
+
+#define SP_STYLE_FLAG_IFSET (1 << 0)
+#define SP_STYLE_FLAG_IFDIFF (1 << 1)
+#define SP_STYLE_FLAG_ALWAYS (1 << 2)
+
+/// Fontsize type internal to SPStyle (also used by libnrtype/Layout-TNG-Input.cpp).
+struct SPIFontSize {
+ unsigned set : 1;
+ unsigned inherit : 1;
+ unsigned type : 2;
+ unsigned unit : 4;
+ unsigned literal: 4;
+ float value;
+ float computed;
+};
+
+/// Baseline shift type internal to SPStyle.
+struct SPIBaselineShift {
+ unsigned set : 1;
+ unsigned inherit : 1;
+ unsigned type : 2;
+ unsigned unit : 4;
+ unsigned literal: 2;
+ float value; // Can be negative
+ float computed;
+};
+
+// CSS 2. Changes in CSS 3, where description is for TextDecorationLine, NOT TextDecoration
+/// Text decoration type internal to SPStyle.
+struct SPITextDecorationLine {
+ unsigned set : 1;
+ unsigned inherit : 1;
+ unsigned underline : 1;
+ unsigned overline : 1;
+ unsigned line_through : 1;
+ unsigned blink : 1; // "Conforming user agents are not required to support this value." yay!
+};
+
+// CSS3 2.2
+/// Text decoration style type internal to SPStyle.
+struct SPITextDecorationStyle {
+ unsigned set : 1;
+ unsigned inherit : 1;
+ unsigned solid : 1;
+ unsigned isdouble : 1; // cannot use "double" as it is a reserved keyword
+ unsigned dotted : 1;
+ unsigned dashed : 1;
+ unsigned wavy : 1;
+};
+
+/// Extended length type internal to SPStyle.
+struct SPILengthOrNormal {
+ unsigned set : 1;
+ unsigned inherit : 1;
+ unsigned normal : 1;
+ unsigned unit : 4;
+ float value;
+ float computed;
+};
+
+// These are used to implement text_decoration. The values are not saved to or read from SVG file
+struct SPITextDecorationData {
+ float phase_length; // length along text line,used for phase for dot/dash/wavy
+ bool tspan_line_start; // is first span on a line
+ bool tspan_line_end; // is last span on a line
+ float tspan_width; // from libnrtype, when it calculates spans
+ float ascender; // the rest from tspan's font
+ float descender;
+ float line_gap;
+ float underline_thickness;
+ float underline_position;
+ float line_through_thickness;
+ float line_through_position;
+};
+
+struct SPTextStyle;
+
+/// An SPTextStyle has a refcount, a font family, and a font name.
+struct SPTextStyle {
+ int refcount;
+
+ /* CSS font properties */
+ SPIString font_family;
+
+ /* Full font name, as font_factory::ConstructFontSpecification would give */
+ SPIString font_specification;
+
+ /** \todo fixme: The 'font' property is ugly, and not working (lauris) */
+ SPIString font;
+};
+
+#endif // SEEN_SP_STYLE_INTERNAL_H
+
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/src/style-test.h b/src/style-test.h
index 8a4055cc1..90654ce83 100644
--- a/src/style-test.h
+++ b/src/style-test.h
@@ -98,6 +98,7 @@ public:
TestCase("font-size:12px"),
TestCase("font-size:12pt", "font-size:15px"),
TestCase("font-size:medium"),
+ TestCase("font-size:smaller"),
TestCase("font-style:italic"), // SPIEnum
TestCase("font-variant:small-caps"), // SPIEnum
TestCase("font-weight:100"), // SPIEnum
@@ -107,9 +108,13 @@ public:
TestCase("text-indent:12em"), // SPILength?
TestCase("text-align:center"), // SPIEnum
TestCase("text-decoration: underline"), // SPITextDecoration
+ TestCase("text-decoration: underline wavy #0000ff"), // SPITextDecoration CSS3
+ TestCase("text-decoration: overline double #ff0000"),
TestCase("line-height:24px"), // SPILengthOrNormal
+ TestCase("line-height:1.5"),
TestCase("letter-spacing:2px"), // SPILengthOrNormal
TestCase("word-spacing:2px"), // SPILengthOrNormal
+ TestCase("word-spacing:normal"),
TestCase("text-transform:lowercase"), // SPIEnum
// ...
TestCase("baseline-shift:baseline"), // SPIBaselineShift
@@ -127,17 +132,24 @@ public:
TestCase("marker-mid:url(#Arrow)"),
TestCase("marker-end:url(#Arrow)"),
TestCase("stroke-opacity:0.5"), // SPIScale24
- TestCase("stroke-dasharray:0, 1, 0, 1"), // NRVpathDash
+ TestCase("stroke-dasharray:0, 1, 0, 1"), // SPIDashArray
TestCase("stroke-dasharray:0 1 0 1","stroke-dasharray:0, 1, 0, 1"),
- TestCase("stroke-dashoffset:13"), // NRVpathDash
+ TestCase("stroke-dasharray:0 1 2 3","stroke-dasharray:0, 1, 2, 3"),
+ TestCase("stroke-dashoffset:13"), // SPILength
+ TestCase("stroke-dashoffset:10px"),
// ...
TestCase("font-family:sans-serif"), // SPIString, text_private
- //TestCase("filter:url(#myfilter)"), // filter
+ //TestCase("filter:url(#myfilter)"), // SPIFilter segfault in read
+ TestCase("filter:inherit"),
TestCase("opacity:0.1;fill:#ff0000;stroke:#0000ff;stroke-width:2px"),
+ TestCase("opacity:0.1;fill:#ff0000;stroke:#0000ff;stroke-width:2px;stroke-dasharray:1, 2, 3, 4;stroke-dashoffset:15"),
+
#ifdef WITH_SVG2
TestCase("paint-order:stroke"), // SPIPaintOrder
+ TestCase("paint-order:normal"),
+ TestCase("paint-order: markers stroke fill", "paint-order:markers stroke fill"),
#endif
TestCase(0)
};
diff --git a/src/style.cpp b/src/style.cpp
index f3a12db86..de5b23854 100644
--- a/src/style.cpp
+++ b/src/style.cpp
@@ -115,6 +115,7 @@ static gint sp_style_write_istring(gchar *p, gint len, gchar const *key, SPIStri
static gint sp_style_write_ilength(gchar *p, gint len, gchar const *key, SPILength const *val, SPILength const *base, guint flags);
static gint sp_style_write_ipaint(gchar *b, gint len, gchar const *key, SPIPaint const *paint, SPIPaint const *base, guint flags);
static gint sp_style_write_ipaintorder(gchar *p, gint len, gchar const *key, SPIPaintOrder const *paint_order, SPIPaintOrder const *base, guint flags);
+static gint sp_style_write_idasharray(gchar *p, gint const len, gchar const *const key, SPIDashArray const *const val, SPIDashArray const *const base, guint const flags);
static gint sp_style_write_ifontsize(gchar *p, gint len, gchar const *key, SPIFontSize const *val, SPIFontSize const *base, guint flags);
static gint sp_style_write_ibaselineshift(gchar *p, gint len, gchar const *key, SPIBaselineShift const *val, SPIBaselineShift const *base, guint flags);
@@ -623,7 +624,7 @@ sp_style_unref(SPStyle *style)
style->stroke.clear();
sp_style_filter_clear(style);
- g_free(style->stroke_dash.dash);
+ style->stroke_dasharray.values.clear();
for (unsigned i = SP_MARKER_LOC; i < SP_MARKER_LOC_QTY; i++) {
if (style->marker[i].value) {
@@ -806,24 +807,13 @@ sp_style_read(SPStyle *style, SPObject *object, Inkscape::XML::Node *repr)
sp_style_read_iscale24(&style->stroke_opacity, val);
}
}
- if (!style->stroke_dasharray_set) {
+ if (!style->stroke_dasharray.set) {
val = repr->attribute("stroke-dasharray");
if (val) {
sp_style_read_dash(style, val);
}
}
-
- if (!style->stroke_dashoffset_set) {
- val = repr->attribute("stroke-dashoffset");
- if (sp_svg_number_read_d(val, &style->stroke_dash.offset)) {
- style->stroke_dashoffset_set = TRUE;
- } else if (val && !strcmp(val, "inherit")) {
- style->stroke_dashoffset_set = TRUE;
- style->stroke_dashoffset_inherit = TRUE;
- } else {
- style->stroke_dashoffset_set = FALSE;
- }
- }
+ SPS_READ_PLENGTH_IF_UNSET(&style->stroke_width, repr, "stroke-dashoffset");
/* paint-order */
if (!style->paint_order.set) {
@@ -1415,21 +1405,12 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val)
SPS_READ_ILENGTH_IF_UNSET(&style->stroke_width, val);
break;
case SP_PROP_STROKE_DASHARRAY:
- if (!style->stroke_dasharray_set) {
+ if (!style->stroke_dasharray.set) {
sp_style_read_dash(style, val);
}
break;
case SP_PROP_STROKE_DASHOFFSET:
- if (!style->stroke_dashoffset_set) {
- if (sp_svg_number_read_d(val, &style->stroke_dash.offset)) {
- style->stroke_dashoffset_set = TRUE;
- } else if (val && !strcmp(val, "inherit")) {
- style->stroke_dashoffset_set = TRUE;
- style->stroke_dashoffset_inherit = TRUE;
- } else {
- style->stroke_dashoffset_set = FALSE;
- }
- }
+ SPS_READ_ILENGTH_IF_UNSET(&style->stroke_dashoffset, val);
break;
case SP_PROP_STROKE_LINECAP:
if (!style->stroke_linecap.set) {
@@ -1894,16 +1875,12 @@ sp_style_merge_from_parent(SPStyle *const style, SPStyle const *const parent)
style->stroke_miterlimit.value = parent->stroke_miterlimit.value;
}
- if (!style->stroke_dasharray_set || style->stroke_dasharray_inherit) {
- style->stroke_dash.n_dash = parent->stroke_dash.n_dash;
- if (style->stroke_dash.n_dash > 0) {
- style->stroke_dash.dash = g_new(gdouble, style->stroke_dash.n_dash);
- memcpy(style->stroke_dash.dash, parent->stroke_dash.dash, style->stroke_dash.n_dash * sizeof(gdouble));
- }
+ if (!style->stroke_dasharray.set || style->stroke_dasharray.inherit) {
+ style->stroke_dasharray.values = parent->stroke_dasharray.values;
}
- if (!style->stroke_dashoffset_set || style->stroke_dashoffset_inherit) {
- style->stroke_dash.offset = parent->stroke_dash.offset;
+ if (!style->stroke_dashoffset.set || style->stroke_dashoffset.inherit) {
+ style->stroke_dashoffset.value = parent->stroke_dashoffset.value;
}
if (!style->stroke_opacity.set || style->stroke_opacity.inherit) {
@@ -2463,8 +2440,8 @@ sp_style_merge_from_dying_parent(SPStyle *const style, SPStyle const *const pare
if (!style->filter.set || style->filter.inherit)
{
sp_style_merge_ifilter(style, &parent->filter);
- }
-
+
+}
/** \todo
* fixme: Check that we correctly handle all properties that don't
* inherit by default (as shown in
@@ -2502,26 +2479,16 @@ sp_style_merge_from_dying_parent(SPStyle *const style, SPStyle const *const pare
}
/* Note: this will need length handling once dasharray supports units. */
- if ( ( !style->stroke_dasharray_set || style->stroke_dasharray_inherit )
- && parent->stroke_dasharray_set && !parent->stroke_dasharray_inherit )
+ if ( ( !style->stroke_dasharray.set || style->stroke_dasharray.inherit )
+ && parent->stroke_dasharray.set && !parent->stroke_dasharray.inherit )
{
- style->stroke_dash.n_dash = parent->stroke_dash.n_dash;
- if (style->stroke_dash.n_dash > 0) {
- style->stroke_dash.dash = g_new(gdouble, style->stroke_dash.n_dash);
- memcpy(style->stroke_dash.dash, parent->stroke_dash.dash, style->stroke_dash.n_dash * sizeof(gdouble));
- }
- style->stroke_dasharray_set = parent->stroke_dasharray_set;
- style->stroke_dasharray_inherit = parent->stroke_dasharray_inherit;
+ style->stroke_dasharray.values = parent->stroke_dasharray.values;
+ style->stroke_dasharray.set = parent->stroke_dasharray.set;
+ style->stroke_dasharray.inherit = parent->stroke_dasharray.inherit;
}
- /* Note: this will need length handling once dasharray_offset supports units. */
- if ((!style->stroke_dashoffset_set || style->stroke_dashoffset_inherit) && parent->stroke_dashoffset_set && !parent->stroke_dashoffset_inherit) {
- style->stroke_dash.offset = parent->stroke_dash.offset;
- style->stroke_dashoffset_set = parent->stroke_dashoffset_set;
- style->stroke_dashoffset_inherit = parent->stroke_dashoffset_inherit;
- /* TODO: Try to
- * represent it as a normal SPILength; though will need to do something about existing
- * users of stroke_dash.offset and stroke_dashoffset_set. */
+ {
+ sp_style_merge_prop_from_dying_parent<SPILength>(style->stroke_dashoffset, parent->stroke_dashoffset);
}
}
@@ -2792,44 +2759,8 @@ sp_style_write_string(SPStyle const *const style, guint const flags)
p += sp_style_write_ienum(p, c + BMAX - p, "stroke-linejoin", enum_stroke_linejoin, &style->stroke_linejoin, NULL, flags);
p += sp_style_write_ifloat(p, c + BMAX - p, "stroke-miterlimit", &style->stroke_miterlimit, NULL, flags);
p += sp_style_write_iscale24(p, c + BMAX - p, "stroke-opacity", &style->stroke_opacity, NULL, flags);
-
- /** \todo fixme: */
- if ((flags == SP_STYLE_FLAG_ALWAYS)
- || style->stroke_dasharray_set)
- {
- if (style->stroke_dasharray_inherit) {
- p += g_snprintf(p, c + BMAX - p, "stroke-dasharray:inherit;");
- } else if (style->stroke_dash.n_dash && style->stroke_dash.dash) {
- p += g_snprintf(p, c + BMAX - p, "stroke-dasharray:");
- gint i;
- for (i = 0; i < style->stroke_dash.n_dash; i++) {
- Inkscape::CSSOStringStream os;
- if (i) {
- os << ", ";
- }
- os << style->stroke_dash.dash[i];
- p += g_strlcpy(p, os.str().c_str(), c + BMAX - p);
- }
- if (p < c + BMAX) {
- *p++ = ';';
- }
- } else {
- p += g_snprintf(p, c + BMAX - p, "stroke-dasharray:none;");
- }
- }
-
- /** \todo fixme: */
- if (style->stroke_dashoffset_set) {
- if (style->stroke_dashoffset_inherit) {
- p += g_snprintf(p, c + BMAX - p, "stroke-dashoffset:inherit;");
- } else {
- Inkscape::CSSOStringStream os;
- os << "stroke-dashoffset:" << style->stroke_dash.offset << ";";
- p += g_strlcpy(p, os.str().c_str(), c + BMAX - p);
- }
- } else if (flags == SP_STYLE_FLAG_ALWAYS) {
- p += g_snprintf(p, c + BMAX - p, "stroke-dashoffset:0;");
- }
+ p += sp_style_write_idasharray(p, c + BMAX - p, "stroke-dasharray", &style->stroke_dasharray, NULL, flags);
+ p += sp_style_write_ilength(p, c + BMAX - p, "stroke-dashoffset", &style->stroke_dashoffset, NULL, flags);
}
if (style->paint_order.set) {
@@ -2980,33 +2911,9 @@ sp_style_write_difference(SPStyle const *const from, SPStyle const *const to)
&from->stroke_linejoin, &to->stroke_linejoin, SP_STYLE_FLAG_IFDIFF);
p += sp_style_write_ifloat(p, c + BMAX - p, "stroke-miterlimit",
&from->stroke_miterlimit, &to->stroke_miterlimit, SP_STYLE_FLAG_IFDIFF);
- /** \todo fixme: */
- if (from->stroke_dasharray_set) {
- if (from->stroke_dasharray_inherit) {
- p += g_snprintf(p, c + BMAX - p, "stroke-dasharray:inherit;");
- } else if (from->stroke_dash.n_dash && from->stroke_dash.dash) {
- p += g_snprintf(p, c + BMAX - p, "stroke-dasharray:");
- for (gint i = 0; i < from->stroke_dash.n_dash; i++) {
- Inkscape::CSSOStringStream os;
- if (i) {
- os << ", ";
- }
- os << from->stroke_dash.dash[i];
- p += g_strlcpy(p, os.str().c_str(), c + BMAX - p);
- }
- p += g_snprintf(p, c + BMAX - p, ";");
- }
- }
- /* fixme: */
- if (from->stroke_dashoffset_set) {
- if (from->stroke_dashoffset_inherit) {
- p += g_snprintf(p, c + BMAX - p, "stroke-dashoffset:inherit;");
- } else {
- Inkscape::CSSOStringStream os;
- os << "stroke-dashoffset:" << from->stroke_dash.offset << ";";
- p += g_strlcpy(p, os.str().c_str(), c + BMAX - p);
- }
- }
+ p += sp_style_write_idasharray(p, c + BMAX - p, "stroke-dasharray",
+ &from->stroke_dasharray, &to->stroke_dasharray, SP_STYLE_FLAG_IFDIFF);
+ p += sp_style_write_ilength(p, c + BMAX - p, "stroke-dashoffset", &from->stroke_dashoffset, &to->stroke_dashoffset, SP_STYLE_FLAG_IFDIFF);
p += sp_style_write_iscale24(p, c + BMAX - p, "stroke-opacity", &from->stroke_opacity, &to->stroke_opacity, SP_STYLE_FLAG_IFDIFF);
}
@@ -3100,12 +3007,9 @@ sp_style_clear(SPStyle *style)
style->filter.href = NULL;
}
- if (style->stroke_dash.dash) {
- g_free(style->stroke_dash.dash);
- }
-
- style->stroke_dasharray_inherit = FALSE;
- style->stroke_dashoffset_inherit = FALSE;
+ style->stroke_dasharray.values.clear();
+ style->stroke_dasharray.inherit = FALSE;
+ style->stroke_dashoffset.inherit = FALSE;
/** \todo fixme: Do that text manipulation via parents */
SPObject *object = style->object;
@@ -3301,14 +3205,13 @@ sp_style_clear(SPStyle *style)
style->stroke_miterlimit.inherit = FALSE;
style->stroke_miterlimit.value = 4.0;
- style->stroke_dash.n_dash = 0;
- style->stroke_dash.dash = NULL;
- style->stroke_dash.offset = 0.0;
+ style->stroke_dasharray.values.clear();
+ style->stroke_dasharray.set = FALSE;
+ style->stroke_dasharray.inherit = FALSE;
- style->stroke_dasharray_set = FALSE;
- style->stroke_dasharray_inherit = FALSE;
- style->stroke_dashoffset_set = FALSE;
- style->stroke_dashoffset_inherit = FALSE;
+ style->stroke_dashoffset.value = style->stroke_dashoffset.computed = 0.0;
+ style->stroke_dashoffset.set = FALSE;
+ style->stroke_dashoffset.inherit = FALSE;
for (unsigned i = SP_MARKER_LOC; i < SP_MARKER_LOC_QTY; i++) {
g_free(style->marker[i].value);
@@ -3361,49 +3264,36 @@ static void
sp_style_read_dash(SPStyle *style, gchar const *str)
{
/* Ref: http://www.w3.org/TR/SVG11/painting.html#StrokeDasharrayProperty */
- style->stroke_dasharray_set = TRUE;
+ style->stroke_dasharray.set = TRUE;
if (strcmp(str, "inherit") == 0) {
- style->stroke_dasharray_inherit = true;
+ style->stroke_dasharray.inherit = true;
return;
}
- style->stroke_dasharray_inherit = false;
+ style->stroke_dasharray.inherit = false;
- NRVpathDash &dash = style->stroke_dash;
- g_free(dash.dash);
- dash.dash = NULL;
+ style->stroke_dasharray.values.clear();
if (strcmp(str, "none") == 0) {
- dash.n_dash = 0;
return;
}
- gint n_dash = 0;
- gdouble d[64];
gchar *e = NULL;
-
- bool LineSolid=true;
- while (e != str && n_dash < 64) {
+ bool LineSolid = true;
+ while (e != str) {
/* TODO: Should allow <length> rather than just a unitless (px) number. */
- d[n_dash] = g_ascii_strtod(str, (char **) &e);
- if (d[n_dash] > 0.00000001)
+ double number = g_ascii_strtod(str, (char **) &e);
+ style->stroke_dasharray.values.push_back( number );
+ if (number > 0.00000001)
LineSolid = false;
if (e != str) {
- n_dash += 1;
str = e;
}
while (str && *str && !isalnum(*str)) str += 1;
}
if (LineSolid) {
- dash.n_dash = 0;
- return;
- }
-
- if (n_dash > 0) {
- dash.dash = g_new(gdouble, n_dash);
- memcpy(dash.dash, d, sizeof(gdouble) * n_dash);
- dash.n_dash = n_dash;
+ style->stroke_dasharray.values.clear();
}
}
@@ -4472,6 +4362,39 @@ sp_style_write_ilengthornormal(gchar *p, gint const len, gchar const *const key,
}
/**
+ * Write SPIDashArray object into string.
+ */
+static gint
+sp_style_write_idasharray(gchar *p, gint const len, gchar const *const key,
+ SPIDashArray const *const val, SPIDashArray const *const base, guint const flags)
+{
+ if ((flags & SP_STYLE_FLAG_ALWAYS)
+ || ((flags & SP_STYLE_FLAG_IFSET) && val->set)
+ || ((flags & SP_STYLE_FLAG_IFDIFF) && val->set
+ && (!base->set || (val->values != base->values))))
+ {
+ if (val->inherit) {
+ return g_snprintf(p, len, "stroke-dasharray:inherit;");
+ } else if ( !val->values.empty() ) {
+ Inkscape::CSSOStringStream os;
+ os << "stroke-dasharray:";
+ for (unsigned i = 0; i < val->values.size(); i++) {
+ if (i) {
+ os << ", ";
+ }
+ os << val->values[i];
+ }
+ os << ";";
+ return g_strlcpy(p, os.str().c_str(), len);
+ } else {
+ return g_snprintf(p, len, "stroke-dasharray:none;");
+ }
+ }
+ return 0;
+}
+
+
+/**
*
*/
static bool
@@ -4732,7 +4655,7 @@ sp_style_write_ipaintorder(gchar *p, gint len, gchar const *key, SPIPaintOrder c
break;
case SP_CSS_PAINT_ORDER_MARKER:
if (i!=0) css << " ";
- css << "marker";
+ css << "markers";
break;
}
} else {
@@ -5032,10 +4955,10 @@ sp_style_unset_property_attrs(SPObject *o)
if (style->stroke_opacity.set) {
repr->setAttribute("stroke-opacity", NULL);
}
- if (style->stroke_dasharray_set) {
+ if (style->stroke_dasharray.set) {
repr->setAttribute("stroke-dasharray", NULL);
}
- if (style->stroke_dashoffset_set) {
+ if (style->stroke_dashoffset.set) {
repr->setAttribute("stroke-dashoffset", NULL);
}
if (style->paint_order.set) {
@@ -5246,7 +5169,7 @@ sp_css_attr_scale(SPCSSAttr *css, double ex)
{
sp_css_attr_scale_property_single(css, "baseline-shift", ex);
sp_css_attr_scale_property_single(css, "stroke-width", ex);
- sp_css_attr_scale_property_list (css, "stroke-dasharray", ex);
+ sp_css_attr_scale_property_list (css, "stroke-dasharray", ex);
sp_css_attr_scale_property_single(css, "stroke-dashoffset", ex);
sp_css_attr_scale_property_single(css, "font-size", ex);
sp_css_attr_scale_property_single(css, "kerning", ex);
diff --git a/src/style.h b/src/style.h
index 7366c2a24..939ace0d3 100644
--- a/src/style.h
+++ b/src/style.h
@@ -15,13 +15,8 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#include "color.h"
-#include "sp-marker-loc.h"
-#include "sp-filter.h"
-#include "sp-filter-reference.h"
-#include "uri-references.h"
-#include "uri.h"
-#include "sp-paint-server-reference.h"
+#include "style-enums.h"
+#include "style-internal.h"
#include <stddef.h>
#include <sigc++/connection.h>
@@ -32,266 +27,6 @@ class Node;
}
}
-class SPCSSAttr;
-
-/// Float type internal to SPStyle.
-struct SPIFloat {
- unsigned set : 1;
- unsigned inherit : 1;
- unsigned data : 30;
- float value;
-};
-
-/*
- * One might think that the best value for SP_SCALE24_MAX would be ((1<<24)-1), which allows the
- * greatest possible precision for fitting [0, 1] fractions into 24 bits.
- *
- * However, in practice, that gives a problem with 0.5, which falls half way between two fractions
- * of ((1<<24)-1). What's worse is that casting double(1<<23) / ((1<<24)-1) to float on x86
- * produces wrong rounding behaviour, resulting in a fraction of ((1<<23)+2.0f) / (1<<24) rather
- * than ((1<<23)+1.0f) / (1<<24) as one would expect, let alone ((1<<23)+0.0f) / (1<<24) as one
- * would ideally like for this example.
- *
- * The value (1<<23) is thus best if one considers float conversions alone.
- *
- * The value 0xff0000 can exactly represent all 8-bit alpha channel values,
- * and can exactly represent all multiples of 0.1. I haven't yet tested whether
- * rounding bugs still get in the way of conversions to & from float, but my instinct is that
- * it's fairly safe because 0xff fits three times inside float's significand.
- *
- * We should probably use the value 0xffff00 once we support 16 bits per channel and/or LittleCMS,
- * though that might need to be accompanied by greater use of double instead of float for
- * colours and opacities, to be safe from rounding bugs.
- */
-#define SP_SCALE24_MAX (0xff0000)
-#define SP_SCALE24_TO_FLOAT(v) ((double) (v) / SP_SCALE24_MAX)
-#define SP_SCALE24_FROM_FLOAT(v) unsigned(((v) * SP_SCALE24_MAX) + .5)
-
-/** Returns a scale24 for the product of two scale24 values. */
-#define SP_SCALE24_MUL(_v1, _v2) unsigned((double)(_v1) * (_v2) / SP_SCALE24_MAX + .5)
-
-/// 24 bit data type internal to SPStyle.
-struct SPIScale24 {
- unsigned set : 1;
- unsigned inherit : 1;
- unsigned value : 24;
-};
-
-/// Int type internal to SPStyle.
-struct SPIInt {
- unsigned set : 1;
- unsigned inherit : 1;
- unsigned data : 30;
- int value;
-};
-
-/// Short type internal to SPStyle.
-struct SPIShort {
- unsigned set : 1;
- unsigned inherit : 1;
- unsigned data : 14;
- int value : 16;
-};
-
-/// Enum type internal to SPStyle.
-struct SPIEnum {
- unsigned set : 1;
- unsigned inherit : 1;
- unsigned value : 8;
- unsigned computed : 8;
-};
-
-/// String type internal to SPStyle.
-struct SPIString {
- unsigned set : 1;
- unsigned inherit : 1;
- unsigned data : 30;
- gchar *value;
-};
-
-enum SPCSSUnit {
- SP_CSS_UNIT_NONE,
- SP_CSS_UNIT_PX,
- SP_CSS_UNIT_PT,
- SP_CSS_UNIT_PC,
- SP_CSS_UNIT_MM,
- SP_CSS_UNIT_CM,
- SP_CSS_UNIT_IN,
- SP_CSS_UNIT_EM,
- SP_CSS_UNIT_EX,
- SP_CSS_UNIT_PERCENT
-};
-
-/// Length type internal to SPStyle.
-struct SPILength {
- unsigned set : 1;
- unsigned inherit : 1;
- unsigned unit : 4;
- float value;
- float computed;
-};
-
-#define SP_STYLE_FILL_SERVER(s) ((const_cast<SPStyle *> (s))->getFillPaintServer())
-#define SP_STYLE_STROKE_SERVER(s) ((const_cast<SPStyle *> (s))->getStrokePaintServer())
-
-/// Paint type internal to SPStyle.
-struct SPIPaint {
- unsigned int set : 1; //c++ bitfields are used here as opposed to bools to reduce memory consumption, see http://tinyurl.com/cswh6mq
- unsigned int inherit : 1;
- unsigned int currentcolor : 1;
- unsigned int colorSet : 1;
- unsigned int noneSet : 1;
- struct {
- SPPaintServerReference *href;
- SPColor color;
- } value;
-
- SPIPaint();
-
- bool isSet() const { return true; /* set || colorSet*/}
- bool isSameType( SPIPaint const & other ) const {return (isPaintserver() == other.isPaintserver()) && (colorSet == other.colorSet) && (currentcolor == other.currentcolor);}
-
- bool isNoneSet() const {return noneSet;}
-
- bool isNone() const {return !currentcolor && !colorSet && !isPaintserver();} // TODO refine
- bool isColor() const {return colorSet && !isPaintserver();}
- bool isPaintserver() const {return (value.href) ? value.href->getObject():0;}
-
- void clear();
-
- void setColor( float r, float g, float b ) {value.color.set( r, g, b ); colorSet = true;}
- void setColor( guint32 val ) {value.color.set( val ); colorSet = true;}
- void setColor( SPColor const& color ) {value.color = color; colorSet = true;}
-
- void read( gchar const *str, SPStyle &tyle, SPDocument *document = 0);
-};
-
-/// Filter type internal to SPStyle
-struct SPIFilter {
- unsigned set : 1;
- unsigned inherit : 1;
- SPFilterReference *href;
-};
-
-// SVG 2
-enum SPPaintOrderLayer {
- SP_CSS_PAINT_ORDER_NORMAL,
- SP_CSS_PAINT_ORDER_FILL,
- SP_CSS_PAINT_ORDER_STROKE,
- SP_CSS_PAINT_ORDER_MARKER
-};
-
-const size_t PAINT_ORDER_LAYERS = 3;
-struct SPIPaintOrder {
- unsigned set : 1;
- unsigned inherit : 1;
- SPPaintOrderLayer layer[PAINT_ORDER_LAYERS];
- bool layer_set[PAINT_ORDER_LAYERS];
- gchar *value; // Raw string
-};
-
-enum {
- SP_FONT_SIZE_LITERAL,
- SP_FONT_SIZE_LENGTH,
- SP_FONT_SIZE_PERCENTAGE
-};
-
-enum {
- SP_BASELINE_SHIFT_LITERAL,
- SP_BASELINE_SHIFT_LENGTH,
- SP_BASELINE_SHIFT_PERCENTAGE
-};
-
-/*
-Not used anymore, originally for SPIFontSize
-#define SP_F8_16_TO_FLOAT(v) ((gdouble) (v) / (1 << 16))
-#define SP_F8_16_FROM_FLOAT(v) ((int) ((v) * ((1 << 16) + 0.9999)))
-*/
-
-#define SP_STYLE_FLAG_IFSET (1 << 0)
-#define SP_STYLE_FLAG_IFDIFF (1 << 1)
-#define SP_STYLE_FLAG_ALWAYS (1 << 2)
-
-/// Fontsize type internal to SPStyle (also used by libnrtype/Layout-TNG-Input.cpp).
-struct SPIFontSize {
- unsigned set : 1;
- unsigned inherit : 1;
- unsigned type : 2;
- unsigned unit : 4;
- unsigned literal: 4;
- float value;
- float computed;
-};
-
-/// Baseline shift type internal to SPStyle.
-struct SPIBaselineShift {
- unsigned set : 1;
- unsigned inherit : 1;
- unsigned type : 2;
- unsigned unit : 4;
- unsigned literal: 2;
- float value; // Can be negative
- float computed;
-};
-
-// CSS 2. Changes in CSS 3, where description is for TextDecorationLine, NOT TextDecoration
-/// Text decoration type internal to SPStyle.
-struct SPITextDecorationLine {
- unsigned set : 1;
- unsigned inherit : 1;
- unsigned underline : 1;
- unsigned overline : 1;
- unsigned line_through : 1;
- unsigned blink : 1; // "Conforming user agents are not required to support this value." yay!
-};
-
-// CSS3 2.2
-/// Text decoration style type internal to SPStyle.
-struct SPITextDecorationStyle {
- unsigned set : 1;
- unsigned inherit : 1;
- unsigned solid : 1;
- unsigned isdouble : 1; // cannot use "double" as it is a reserved keyword
- unsigned dotted : 1;
- unsigned dashed : 1;
- unsigned wavy : 1;
-};
-
-/// Extended length type internal to SPStyle.
-struct SPILengthOrNormal {
- unsigned set : 1;
- unsigned inherit : 1;
- unsigned normal : 1;
- unsigned unit : 4;
- float value;
- float computed;
-};
-
-// These are used to implement text_decoration. The values are not saved to or read from SVG file
-struct SPITextDecorationData {
- float phase_length; // length along text line,used for phase for dot/dash/wavy
- bool tspan_line_start; // is first span on a line
- bool tspan_line_end; // is last span on a line
- float tspan_width; // from libnrtype, when it calculates spans
- float ascender; // the rest from tspan's font
- float descender;
- float line_gap;
- float underline_thickness;
- float underline_position;
- float line_through_thickness;
- float line_through_position;
-};
-
-struct SPTextStyle;
-
-/// Stroke dash details.
-class NRVpathDash {
-public:
- double offset;
- int n_dash;
- double *dash;
-};
-
/// An SVG style object.
struct SPStyle {
int refcount;
@@ -410,12 +145,10 @@ struct SPStyle {
SPIEnum stroke_linejoin;
/** stroke-miterlimit */
SPIFloat stroke_miterlimit;
- /** stroke-dash* */
- NRVpathDash stroke_dash;
- unsigned stroke_dasharray_set : 1;
- unsigned stroke_dasharray_inherit : 1;
- unsigned stroke_dashoffset_set : 1;
- unsigned stroke_dashoffset_inherit : 1;
+ /** stroke-dasharray */
+ SPIDashArray stroke_dasharray;
+ /** stroke-dashoffset */
+ SPILength stroke_dashoffset;
/** stroke-opacity */
SPIScale24 stroke_opacity;
@@ -494,219 +227,6 @@ gchar const *sp_style_get_css_unit_string(int unit);
double sp_style_css_size_px_to_units(double size, int unit);
double sp_style_css_size_units_to_px(double size, int unit);
-/* SPTextStyle */
-
-enum SPCSSFontSize {
- SP_CSS_FONT_SIZE_XX_SMALL,
- SP_CSS_FONT_SIZE_X_SMALL,
- SP_CSS_FONT_SIZE_SMALL,
- SP_CSS_FONT_SIZE_MEDIUM,
- SP_CSS_FONT_SIZE_LARGE,
- SP_CSS_FONT_SIZE_X_LARGE,
- SP_CSS_FONT_SIZE_XX_LARGE,
- SP_CSS_FONT_SIZE_SMALLER,
- SP_CSS_FONT_SIZE_LARGER
-};
-
-enum SPCSSFontStyle {
- SP_CSS_FONT_STYLE_NORMAL,
- SP_CSS_FONT_STYLE_ITALIC,
- SP_CSS_FONT_STYLE_OBLIQUE
-};
-
-enum SPCSSFontVariant {
- SP_CSS_FONT_VARIANT_NORMAL,
- SP_CSS_FONT_VARIANT_SMALL_CAPS
-};
-
-enum SPCSSFontWeight {
- SP_CSS_FONT_WEIGHT_100,
- SP_CSS_FONT_WEIGHT_200,
- SP_CSS_FONT_WEIGHT_300,
- SP_CSS_FONT_WEIGHT_400,
- SP_CSS_FONT_WEIGHT_500,
- SP_CSS_FONT_WEIGHT_600,
- SP_CSS_FONT_WEIGHT_700,
- SP_CSS_FONT_WEIGHT_800,
- SP_CSS_FONT_WEIGHT_900,
- SP_CSS_FONT_WEIGHT_NORMAL,
- SP_CSS_FONT_WEIGHT_BOLD,
- SP_CSS_FONT_WEIGHT_LIGHTER,
- SP_CSS_FONT_WEIGHT_BOLDER
-};
-
-enum SPCSSFontStretch {
- SP_CSS_FONT_STRETCH_ULTRA_CONDENSED,
- SP_CSS_FONT_STRETCH_EXTRA_CONDENSED,
- SP_CSS_FONT_STRETCH_CONDENSED,
- SP_CSS_FONT_STRETCH_SEMI_CONDENSED,
- SP_CSS_FONT_STRETCH_NORMAL,
- SP_CSS_FONT_STRETCH_SEMI_EXPANDED,
- SP_CSS_FONT_STRETCH_EXPANDED,
- SP_CSS_FONT_STRETCH_EXTRA_EXPANDED,
- SP_CSS_FONT_STRETCH_ULTRA_EXPANDED,
- SP_CSS_FONT_STRETCH_NARROWER,
- SP_CSS_FONT_STRETCH_WIDER
-};
-
-enum SPCSSTextAlign {
- SP_CSS_TEXT_ALIGN_START,
- SP_CSS_TEXT_ALIGN_END,
- SP_CSS_TEXT_ALIGN_LEFT,
- SP_CSS_TEXT_ALIGN_RIGHT,
- SP_CSS_TEXT_ALIGN_CENTER,
- SP_CSS_TEXT_ALIGN_JUSTIFY
- // also <string> is allowed, but only within table calls
-};
-
-enum SPCSSTextTransform {
- SP_CSS_TEXT_TRANSFORM_CAPITALIZE,
- SP_CSS_TEXT_TRANSFORM_UPPERCASE,
- SP_CSS_TEXT_TRANSFORM_LOWERCASE,
- SP_CSS_TEXT_TRANSFORM_NONE
-};
-
-enum SPCSSDirection {
- SP_CSS_DIRECTION_LTR,
- SP_CSS_DIRECTION_RTL
-};
-
-enum SPCSSBlockProgression {
- SP_CSS_BLOCK_PROGRESSION_TB,
- SP_CSS_BLOCK_PROGRESSION_RL,
- SP_CSS_BLOCK_PROGRESSION_LR
-};
-
-enum SPCSSWritingMode {
- SP_CSS_WRITING_MODE_LR_TB,
- SP_CSS_WRITING_MODE_RL_TB,
- SP_CSS_WRITING_MODE_TB_RL,
- SP_CSS_WRITING_MODE_TB_LR
-};
-
-enum SPTextAnchor {
- SP_CSS_TEXT_ANCHOR_START,
- SP_CSS_TEXT_ANCHOR_MIDDLE,
- SP_CSS_TEXT_ANCHOR_END
-};
-
-enum SPCSSBaselineShift {
- SP_CSS_BASELINE_SHIFT_BASELINE,
- SP_CSS_BASELINE_SHIFT_SUB,
- SP_CSS_BASELINE_SHIFT_SUPER
-};
-
-enum SPVisibility {
- SP_CSS_VISIBILITY_HIDDEN,
- SP_CSS_VISIBILITY_COLLAPSE,
- SP_CSS_VISIBILITY_VISIBLE
-};
-
-enum SPOverflow {
- SP_CSS_OVERFLOW_VISIBLE,
- SP_CSS_OVERFLOW_HIDDEN,
- SP_CSS_OVERFLOW_SCROLL,
- SP_CSS_OVERFLOW_AUTO
-};
-
-/// \todo more display types
-enum SPCSSDisplay {
- SP_CSS_DISPLAY_NONE,
- SP_CSS_DISPLAY_INLINE,
- SP_CSS_DISPLAY_BLOCK,
- SP_CSS_DISPLAY_LIST_ITEM,
- SP_CSS_DISPLAY_RUN_IN,
- SP_CSS_DISPLAY_COMPACT,
- SP_CSS_DISPLAY_MARKER,
- SP_CSS_DISPLAY_TABLE,
- SP_CSS_DISPLAY_INLINE_TABLE,
- SP_CSS_DISPLAY_TABLE_ROW_GROUP,
- SP_CSS_DISPLAY_TABLE_HEADER_GROUP,
- SP_CSS_DISPLAY_TABLE_FOOTER_GROUP,
- SP_CSS_DISPLAY_TABLE_ROW,
- SP_CSS_DISPLAY_TABLE_COLUMN_GROUP,
- SP_CSS_DISPLAY_TABLE_COLUMN,
- SP_CSS_DISPLAY_TABLE_CELL,
- SP_CSS_DISPLAY_TABLE_CAPTION
-};
-
-enum SPIsolation {
- SP_CSS_ISOLATION_AUTO,
- SP_CSS_ISOLATION_ISOLATE
-};
-
-enum SPBlendMode {
- SP_CSS_BLEND_NORMAL,
- SP_CSS_BLEND_MULTIPLY,
- SP_CSS_BLEND_SCREEN,
- SP_CSS_BLEND_DARKEN,
- SP_CSS_BLEND_LIGHTEN,
- SP_CSS_BLEND_OVERLAY,
- SP_CSS_BLEND_COLORDODGE,
- SP_CSS_BLEND_COLORBURN,
- SP_CSS_BLEND_HARDLIGHT,
- SP_CSS_BLEND_SOFTLIGHT,
- SP_CSS_BLEND_DIFFERENCE,
- SP_CSS_BLEND_EXCLUSION,
- SP_CSS_BLEND_HUE,
- SP_CSS_BLEND_SATURATION,
- SP_CSS_BLEND_COLOR,
- SP_CSS_BLEND_LUMINOSITY
-};
-
-enum SPEnableBackground {
- SP_CSS_BACKGROUND_ACCUMULATE,
- SP_CSS_BACKGROUND_NEW
-};
-
-enum SPColorInterpolation {
- SP_CSS_COLOR_INTERPOLATION_AUTO,
- SP_CSS_COLOR_INTERPOLATION_SRGB,
- SP_CSS_COLOR_INTERPOLATION_LINEARRGB
-};
-
-enum SPColorRendering {
- SP_CSS_COLOR_RENDERING_AUTO,
- SP_CSS_COLOR_RENDERING_OPTIMIZESPEED,
- SP_CSS_COLOR_RENDERING_OPTIMIZEQUALITY
-};
-
-/* Last two are CSS4 Image values... for the momement prefaced with -inkscape. */
-enum SPImageRendering {
- SP_CSS_IMAGE_RENDERING_AUTO,
- SP_CSS_IMAGE_RENDERING_OPTIMIZESPEED,
- SP_CSS_IMAGE_RENDERING_OPTIMIZEQUALITY,
- SP_CSS_IMAGE_RENDERING_CRISPEDGES,
- SP_CSS_IMAGE_RENDERING_PIXELATED
-};
-
-enum SPShapeRendering {
- SP_CSS_SHAPE_RENDERING_AUTO,
- SP_CSS_SHAPE_RENDERING_OPTIMIZESPEED,
- SP_CSS_SHAPE_RENDERING_CRISPEDGES,
- SP_CSS_SHAPE_RENDERING_GEOMETRICPRECISION
-};
-
-enum SPTextRendering {
- SP_CSS_TEXT_RENDERING_AUTO,
- SP_CSS_TEXT_RENDERING_OPTIMIZESPEED,
- SP_CSS_TEXT_RENDERING_OPTIMIZELEGIBILITY,
- SP_CSS_TEXT_RENDERING_GEOMETRICPRECISION
-};
-
-/// An SPTextStyle has a refcount, a font family, and a font name.
-struct SPTextStyle {
- int refcount;
-
- /* CSS font properties */
- SPIString font_family;
-
- /* Full font name, as font_factory::ConstructFontSpecification would give */
- SPIString font_specification;
-
- /** \todo fixme: The 'font' property is ugly, and not working (lauris) */
- SPIString font;
-};
SPCSSAttr *sp_css_attr_from_style (SPStyle const *const style, guint flags);
SPCSSAttr *sp_css_attr_from_object(SPObject *object, guint flags = SP_STYLE_FLAG_IFSET);
diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp
index e43b6575e..08d3119a1 100644
--- a/src/ui/tools/spray-tool.cpp
+++ b/src/ui/tools/spray-tool.cpp
@@ -82,7 +82,7 @@ using namespace std;
// Disabled in 0.91 because of Bug #1274831 (crash, spraying an object
// with the mode: spray object in single path)
// Please enable again when working on 1.0
-//#define ENABLE_SPRAY_MODE_SINGLE_PATH
+#define ENABLE_SPRAY_MODE_SINGLE_PATH
#include "tool-factory.h"
@@ -140,7 +140,7 @@ static void sp_spray_scale_rel(Geom::Point c, SPDesktop */*desktop*/, SPItem *it
}
SprayTool::SprayTool()
- : ToolBase(cursor_spray_xpm, 4, 4)
+ : ToolBase(cursor_spray_xpm, 4, 4, false)
, pressure(TC_DEFAULT_PRESSURE)
, dragging(false)
, usepressure(0)
diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp
index 45b519fb4..752053be1 100644
--- a/src/ui/tools/tool-base.cpp
+++ b/src/ui/tools/tool-base.cpp
@@ -90,7 +90,7 @@ SPDesktop const& ToolBase::getDesktop() const {
return *desktop;
}
-ToolBase::ToolBase(gchar const *const *cursor_shape, gint hot_x, gint hot_y)
+ToolBase::ToolBase(gchar const *const *cursor_shape, gint hot_x, gint hot_y, bool uses_snap)
: pref_observer(NULL)
, cursor(NULL)
, xp(0)
@@ -106,6 +106,7 @@ ToolBase::ToolBase(gchar const *const *cursor_shape, gint hot_x, gint hot_y)
, _delayed_snap_event(NULL)
, _dse_callback_in_process(false)
, desktop(NULL)
+ , _uses_snap(uses_snap)
, cursor_shape(cursor_shape)
, hot_x(hot_x)
, hot_y(hot_y)
@@ -384,7 +385,9 @@ bool ToolBase::root_handler(GdkEvent* event) {
case 1:
if (this->space_panning) {
// When starting panning, make sure there are no snap events pending because these might disable the panning again
- sp_event_context_discard_delayed_snap_event(this);
+ if (_uses_snap) {
+ sp_event_context_discard_delayed_snap_event(this);
+ }
panning = 1;
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
@@ -402,7 +405,9 @@ bool ToolBase::root_handler(GdkEvent* event) {
zoom_rb = 2;
} else {
// When starting panning, make sure there are no snap events pending because these might disable the panning again
- sp_event_context_discard_delayed_snap_event(this);
+ if (_uses_snap) {
+ sp_event_context_discard_delayed_snap_event(this);
+ }
panning = 2;
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
@@ -418,7 +423,9 @@ bool ToolBase::root_handler(GdkEvent* event) {
case 3:
if ((event->button.state & GDK_SHIFT_MASK) || (event->button.state & GDK_CONTROL_MASK)) {
// When starting panning, make sure there are no snap events pending because these might disable the panning again
- sp_event_context_discard_delayed_snap_event(this);
+ if (_uses_snap) {
+ sp_event_context_discard_delayed_snap_event(this);
+ }
panning = 3;
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
@@ -946,6 +953,10 @@ void sp_event_context_read(ToolBase *ec, gchar const *key) {
gint sp_event_context_root_handler(ToolBase * event_context,
GdkEvent * event)
{
+ if (!event_context->_uses_snap) {
+ return sp_event_context_virtual_root_handler(event_context, event);
+ }
+
switch (event->type) {
case GDK_MOTION_NOTIFY:
sp_event_context_snap_delay_handler(event_context, NULL, NULL,
@@ -995,7 +1006,12 @@ gint sp_event_context_virtual_root_handler(ToolBase * event_context, GdkEvent *
* Calls virtual item_handler(), the item event handling function.
*/
gint sp_event_context_item_handler(ToolBase * event_context,
- SPItem * item, GdkEvent * event) {
+ SPItem * item, GdkEvent * event)
+{
+ if (!event_context->_uses_snap) {
+ return sp_event_context_virtual_item_handler(event_context, item, event);
+ }
+
switch (event->type) {
case GDK_MOTION_NOTIFY:
sp_event_context_snap_delay_handler(event_context, (gpointer) item, NULL, (GdkEventMotion *) event, DelayedSnapEvent::EVENTCONTEXT_ITEM_HANDLER);
@@ -1232,7 +1248,7 @@ void sp_event_context_snap_delay_handler(ToolBase *ec,
static guint32 prev_time;
static boost::optional<Geom::Point> prev_pos;
- if (ec->_dse_callback_in_process) {
+ if (!ec->_uses_snap || ec->_dse_callback_in_process) {
return;
}
diff --git a/src/ui/tools/tool-base.h b/src/ui/tools/tool-base.h
index eb8908f3e..def6e3d91 100644
--- a/src/ui/tools/tool-base.h
+++ b/src/ui/tools/tool-base.h
@@ -113,7 +113,7 @@ public:
void enableGrDrag (bool enable=true);
bool deleteSelectedDrag(bool just_one);
- ToolBase(gchar const *const *cursor_shape, gint hot_x, gint hot_y);
+ ToolBase(gchar const *const *cursor_shape, gint hot_x, gint hot_y, bool uses_snap = true);
virtual ~ToolBase();
@@ -181,6 +181,7 @@ public:
void sp_event_context_update_cursor();
SPDesktop *desktop;
+ bool _uses_snap; // TODO: make protected or private
protected:
/// An xpm containing the shape of the tool's cursor.
@@ -188,6 +189,7 @@ protected:
/// The cursor's hot spot
gint hot_x, hot_y;
+ /// Whether the tool should receive delayed snap events
bool sp_event_context_knot_mouseover() const;
diff --git a/src/ui/widget/filter-effect-chooser.h b/src/ui/widget/filter-effect-chooser.h
index a467adcb1..6092c61a5 100644
--- a/src/ui/widget/filter-effect-chooser.h
+++ b/src/ui/widget/filter-effect-chooser.h
@@ -25,7 +25,6 @@
#include "combo-enums.h"
#include "filter-enums.h"
-#include "spin-slider.h"
#include "spin-scale.h"
namespace Inkscape {
diff --git a/src/ui/widget/style-swatch.h b/src/ui/widget/style-swatch.h
index 6da58a2dd..23ecbdfda 100644
--- a/src/ui/widget/style-swatch.h
+++ b/src/ui/widget/style-swatch.h
@@ -27,7 +27,6 @@
#include <gtkmm/enums.h>
#include "desktop.h"
-#include "button.h"
#include "preferences.h"
struct SPStyle;
diff --git a/src/vanishing-point.h b/src/vanishing-point.h
index 17e3a4aa9..53366fe66 100644
--- a/src/vanishing-point.h
+++ b/src/vanishing-point.h
@@ -16,11 +16,8 @@
#include <2geom/point.h>
#include "knot.h"
#include "selection.h"
-#include "axis-manip.h"
-#include "inkscape.h"
#include "persp3d.h"
#include "box3d.h"
-#include "persp3d-reference.h"
#include "ui/control-manager.h" // TODO break enums out separately
class SPBox3D;
diff --git a/src/widgets/dash-selector.cpp b/src/widgets/dash-selector.cpp
index afc81e574..fce7a9d9f 100644
--- a/src/widgets/dash-selector.cpp
+++ b/src/widgets/dash-selector.cpp
@@ -39,7 +39,7 @@ static double dash_4_1[] = {4.0, 1.0, -1.0};
static double dash_1_2[] = {1.0, 2.0, -1.0};
static double dash_1_4[] = {1.0, 4.0, -1.0};
-#define bd_len 7 // must correspond to the number of entries in the next line
+static size_t BD_LEN = 7; // must correspond to the number of entries in the next line
static double *builtin_dashes[] = {dash_0, dash_1_1, dash_2_1, dash_4_1, dash_1_2, dash_1_4, NULL};
static double **dashes = NULL;
@@ -124,12 +124,12 @@ void SPDashSelector::init_dashes() {
for (std::vector<Glib::ustring>::iterator i = dash_prefs.begin(); i != dash_prefs.end(); ++i) {
sp_style_read_from_prefs(style, *i);
- if (style->stroke_dash.n_dash > 0) {
- dashes[pos] = g_new (double, style->stroke_dash.n_dash + 1);
+ if (!style->stroke_dasharray.values.empty()) {
+ dashes[pos] = g_new (double, style->stroke_dasharray.values.size() + 1);
double *d = dashes[pos];
- int i = 0;
- for (; i < style->stroke_dash.n_dash; i++) {
- d[i] = style->stroke_dash.dash[i];
+ unsigned i = 0;
+ for (; i < style->stroke_dasharray.values.size(); i++) {
+ d[i] = style->stroke_dasharray.values[i];
}
d[i] = -1;
} else {
@@ -138,12 +138,12 @@ void SPDashSelector::init_dashes() {
pos += 1;
}
} else { // This code may never execute - a new preferences.xml is created for a new user. Maybe if the user deletes dashes from preferences.xml?
- dashes = g_new (double *, bd_len + 2); // +1 for custom slot, +1 for terminator slot
- int i;
- for(i=0;i<bd_len;i++) {
+ dashes = g_new (double *, BD_LEN + 2); // +1 for custom slot, +1 for terminator slot
+ unsigned i;
+ for(i=0;i<BD_LEN;i++) {
dashes[i] = builtin_dashes[i];
}
- pos = bd_len;
+ pos = BD_LEN;
}
// make a place to hold the custom dashes, up to 15 positions long (+ terminator)
dashes[pos] = g_new (double, 16);
diff --git a/src/widgets/gradient-selector.h b/src/widgets/gradient-selector.h
index c88666b06..1f58de2e4 100644
--- a/src/widgets/gradient-selector.h
+++ b/src/widgets/gradient-selector.h
@@ -37,7 +37,6 @@
#include "sp-gradient.h"
#include "sp-gradient-spread.h"
#include "sp-gradient-units.h"
-#include "gradient-image.h"
class SPGradient;
diff --git a/src/widgets/sp-color-icc-selector.h b/src/widgets/sp-color-icc-selector.h
index 3eb12222c..f63ab0853 100644
--- a/src/widgets/sp-color-icc-selector.h
+++ b/src/widgets/sp-color-icc-selector.h
@@ -4,7 +4,6 @@
#include <glib.h>
#include <gtk/gtk.h>
-#include "../color.h"
#include "sp-color-selector.h"
namespace Inkscape {
diff --git a/src/widgets/sp-color-wheel-selector.h b/src/widgets/sp-color-wheel-selector.h
index 8e0dc6cea..bbd377422 100644
--- a/src/widgets/sp-color-wheel-selector.h
+++ b/src/widgets/sp-color-wheel-selector.h
@@ -4,7 +4,6 @@
#include <glib.h>
#include <gtk/gtk.h>
-#include "../color.h"
#include "sp-color-slider.h"
#include "sp-color-selector.h"
diff --git a/src/widgets/sp-xmlview-attr-list.h b/src/widgets/sp-xmlview-attr-list.h
index 8b1dae49b..367ef1a12 100644
--- a/src/widgets/sp-xmlview-attr-list.h
+++ b/src/widgets/sp-xmlview-attr-list.h
@@ -14,8 +14,6 @@
#include <stdio.h>
#include <gtk/gtk.h>
-#include "../xml/repr.h"
-
#define SP_TYPE_XMLVIEW_ATTR_LIST (sp_xmlview_attr_list_get_type ())
diff --git a/src/widgets/sp-xmlview-content.h b/src/widgets/sp-xmlview-content.h
index 941ef0be1..8b1342c5e 100644
--- a/src/widgets/sp-xmlview-content.h
+++ b/src/widgets/sp-xmlview-content.h
@@ -13,16 +13,11 @@
*/
#include <config.h>
-
#include <stdio.h>
-
#include <gtk/gtk.h>
-#include "../xml/repr.h"
-
#include <glib.h>
-
#define SP_TYPE_XMLVIEW_CONTENT (sp_xmlview_content_get_type ())
#define SP_XMLVIEW_CONTENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_XMLVIEW_CONTENT, SPXMLViewContent))
#define SP_IS_XMLVIEW_CONTENT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_XMLVIEW_CONTENT))
diff --git a/src/widgets/sp-xmlview-tree.h b/src/widgets/sp-xmlview-tree.h
index 50fcb3bc8..69228fa88 100644
--- a/src/widgets/sp-xmlview-tree.h
+++ b/src/widgets/sp-xmlview-tree.h
@@ -13,12 +13,9 @@
*/
#include <gtk/gtk.h>
-#include "../xml/repr.h"
-
#include <glib.h>
-
#define SP_TYPE_XMLVIEW_TREE (sp_xmlview_tree_get_type ())
#define SP_XMLVIEW_TREE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_XMLVIEW_TREE, SPXMLViewTree))
#define SP_IS_XMLVIEW_TREE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_XMLVIEW_TREE))
diff --git a/src/widgets/spray-toolbar.cpp b/src/widgets/spray-toolbar.cpp
index cf56b3255..788ce6475 100644
--- a/src/widgets/spray-toolbar.cpp
+++ b/src/widgets/spray-toolbar.cpp
@@ -47,7 +47,7 @@ using Inkscape::UI::PrefPusher;
// Disabled in 0.91 because of Bug #1274831 (crash, spraying an object
// with the mode: spray object in single path)
// Please enable again when working on 1.0
-//#define ENABLE_SPRAY_MODE_SINGLE_PATH
+#define ENABLE_SPRAY_MODE_SINGLE_PATH
//########################
//## Spray ##
diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp
index d140cfb21..9567f81ba 100644
--- a/src/widgets/stroke-style.cpp
+++ b/src/widgets/stroke-style.cpp
@@ -24,6 +24,7 @@
#include "svg/svg-color.h"
#include "util/units.h"
#include "ui/widget/unit-menu.h"
+#include "desktop-widget.h"
using Inkscape::DocumentUndo;
using Inkscape::Util::unit_table;
@@ -726,18 +727,18 @@ StrokeStyle::getItemColorForMarker(SPItem *item, Inkscape::PaintTarget fill_or_s
void
StrokeStyle::setDashSelectorFromStyle(SPDashSelector *dsel, SPStyle *style)
{
- if (style->stroke_dash.n_dash > 0) {
+ if (!style->stroke_dasharray.values.empty()) {
double d[64];
- int len = MIN(style->stroke_dash.n_dash, 64);
- for (int i = 0; i < len; i++) {
+ size_t len = MIN(style->stroke_dasharray.values.size(), 64);
+ for (unsigned i = 0; i < len; i++) {
if (style->stroke_width.computed != 0)
- d[i] = style->stroke_dash.dash[i] / style->stroke_width.computed;
+ d[i] = style->stroke_dasharray.values[i] / style->stroke_width.computed;
else
- d[i] = style->stroke_dash.dash[i]; // is there a better thing to do for stroke_width==0?
+ d[i] = style->stroke_dasharray.values[i]; // is there a better thing to do for stroke_width==0?
}
dsel->set_dash(len, d, style->stroke_width.computed != 0 ?
- style->stroke_dash.offset / style->stroke_width.computed :
- style->stroke_dash.offset);
+ style->stroke_dashoffset.value / style->stroke_width.computed :
+ style->stroke_dashoffset.value);
} else {
dsel->set_dash(0, NULL, 0.0);
}