diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2010-11-25 20:51:17 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2010-11-25 20:51:17 +0000 |
| commit | 0bd9f7e209d522dbcebe0449a91397fdd9e38977 (patch) | |
| tree | 834c7d02456658b57625ab68cc28f7854a5a85dc /src | |
| parent | Fix handling of x and y attributes of patterns (diff) | |
| parent | Fix ruler redraw issue on GTK 2.22 (diff) | |
| download | inkscape-0bd9f7e209d522dbcebe0449a91397fdd9e38977.tar.gz inkscape-0bd9f7e209d522dbcebe0449a91397fdd9e38977.zip | |
Merge from trunk
(bzr r9508.1.70)
Diffstat (limited to 'src')
1060 files changed, 4154 insertions, 6013 deletions
diff --git a/src/2geom/angle.h b/src/2geom/angle.h index 621235a5e..c950dd803 100644 --- a/src/2geom/angle.h +++ b/src/2geom/angle.h @@ -104,4 +104,4 @@ Coord map_unit_interval_on_circular_arc(Coord t, double start_angle, double end_ fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/basic-intersection.cpp b/src/2geom/basic-intersection.cpp index e159839d2..66f174da6 100644 --- a/src/2geom/basic-intersection.cpp +++ b/src/2geom/basic-intersection.cpp @@ -422,4 +422,4 @@ double hausdorf(D2<SBasis>& A, D2<SBasis> const& B, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/basic-intersection.h b/src/2geom/basic-intersection.h index a19a10c8c..b07052449 100644 --- a/src/2geom/basic-intersection.h +++ b/src/2geom/basic-intersection.h @@ -148,4 +148,4 @@ double hausdorf(D2<SBasis>& A, D2<SBasis> const& B, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/bezier-clipping.cpp b/src/2geom/bezier-clipping.cpp index 96a06376c..799b3664a 100644 --- a/src/2geom/bezier-clipping.cpp +++ b/src/2geom/bezier-clipping.cpp @@ -1289,4 +1289,4 @@ void find_intersections_bezier_clipping (std::vector< std::pair<double, double> fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/bezier-curve.h b/src/2geom/bezier-curve.h index d5259c71f..c943512c7 100644 --- a/src/2geom/bezier-curve.h +++ b/src/2geom/bezier-curve.h @@ -252,4 +252,4 @@ Curve *BezierCurve<1>::derivative() const { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/bezier-to-sbasis.h b/src/2geom/bezier-to-sbasis.h index 71e39e2c7..ba98a8a34 100644 --- a/src/2geom/bezier-to-sbasis.h +++ b/src/2geom/bezier-to-sbasis.h @@ -95,4 +95,4 @@ D2<SBasis> handles_to_sbasis(T const& handles, unsigned order) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/bezier-utils.cpp b/src/2geom/bezier-utils.cpp index 4aa720127..dc8025115 100644 --- a/src/2geom/bezier-utils.cpp +++ b/src/2geom/bezier-utils.cpp @@ -1002,4 +1002,4 @@ compute_hook(Point const &a, Point const &b, double const u, BezierCurve const b fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/bezier-utils.h b/src/2geom/bezier-utils.h index 3d79df3b2..9689db82d 100644 --- a/src/2geom/bezier-utils.h +++ b/src/2geom/bezier-utils.h @@ -96,4 +96,4 @@ cubic_bezier_poly_coeff(iterator b, Point *pc) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/bezier.h b/src/2geom/bezier.h index 9e68d93ae..2a06d44f5 100644 --- a/src/2geom/bezier.h +++ b/src/2geom/bezier.h @@ -417,4 +417,4 @@ inline std::ostream &operator<< (std::ostream &out_file, const Bezier & b) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/chebyshev.cpp b/src/2geom/chebyshev.cpp index 73baf7b6b..d0d6edab4 100644 --- a/src/2geom/chebyshev.cpp +++ b/src/2geom/chebyshev.cpp @@ -123,4 +123,4 @@ SBasis chebyshev(unsigned n) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/chebyshev.h b/src/2geom/chebyshev.h index 6de9e9cc0..f729e1f07 100644 --- a/src/2geom/chebyshev.h +++ b/src/2geom/chebyshev.h @@ -25,6 +25,6 @@ SBasis chebyshev(unsigned n); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : #endif diff --git a/src/2geom/choose.h b/src/2geom/choose.h index 337569e36..579c46718 100644 --- a/src/2geom/choose.h +++ b/src/2geom/choose.h @@ -86,4 +86,4 @@ T choose(unsigned n, unsigned k) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/circle-circle.cpp b/src/2geom/circle-circle.cpp index 25385180b..425ff0e9f 100644 --- a/src/2geom/circle-circle.cpp +++ b/src/2geom/circle-circle.cpp @@ -138,4 +138,4 @@ int main(void) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/circle.cpp b/src/2geom/circle.cpp index 00b91de12..8a0704735 100644 --- a/src/2geom/circle.cpp +++ b/src/2geom/circle.cpp @@ -129,4 +129,4 @@ Circle::getPath(std::vector<Path> &path_out) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/circle.h b/src/2geom/circle.h index c346b8c8f..987570b62 100644 --- a/src/2geom/circle.h +++ b/src/2geom/circle.h @@ -132,4 +132,4 @@ class Circle fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/circulator.h b/src/2geom/circulator.h index 57f3bf741..1a70dc4d3 100644 --- a/src/2geom/circulator.h +++ b/src/2geom/circulator.h @@ -145,4 +145,4 @@ Geom::Circulator<T> operator+(int n, Geom::Circulator<T> const &c) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/concepts.h b/src/2geom/concepts.h index 9c57db44d..a03538d42 100644 --- a/src/2geom/concepts.h +++ b/src/2geom/concepts.h @@ -160,4 +160,4 @@ struct MultiplicableConcept { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/conjugate_gradient.cpp b/src/2geom/conjugate_gradient.cpp index 9c4ea7776..ae69d5281 100644 --- a/src/2geom/conjugate_gradient.cpp +++ b/src/2geom/conjugate_gradient.cpp @@ -135,4 +135,4 @@ conjugate_gradient(valarray<double> const &A, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/conjugate_gradient.h b/src/2geom/conjugate_gradient.h index 6f4098b5b..8ea1b83b4 100644 --- a/src/2geom/conjugate_gradient.h +++ b/src/2geom/conjugate_gradient.h @@ -55,4 +55,4 @@ conjugate_gradient(std::valarray<double> const &A, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/convex-cover.cpp b/src/2geom/convex-cover.cpp index e8ea2280d..db8094540 100644 --- a/src/2geom/convex-cover.cpp +++ b/src/2geom/convex-cover.cpp @@ -562,4 +562,4 @@ double ConvexHull::narrowest_diameter(Point &a, Point &b, Point &c) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/convex-cover.h b/src/2geom/convex-cover.h index 524108965..8a5124019 100644 --- a/src/2geom/convex-cover.h +++ b/src/2geom/convex-cover.h @@ -186,4 +186,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/coord.h b/src/2geom/coord.h index b44a0f71e..481723413 100644 --- a/src/2geom/coord.h +++ b/src/2geom/coord.h @@ -67,4 +67,4 @@ inline bool are_near(Coord a, Coord b, double eps=EPSILON) { return fabs(a-b) <= fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/crossing.cpp b/src/2geom/crossing.cpp index d717a4ed5..13affa8e9 100644 --- a/src/2geom/crossing.cpp +++ b/src/2geom/crossing.cpp @@ -113,6 +113,18 @@ CrossingGraph create_crossing_graph(std::vector<Path> const &p, Crossings const */ //} +// provide specific method for Paths because paths can be closed or open. Path::size() is named somewhat wrong... +std::vector<Rect> bounds(Path const &a) { + std::vector<Rect> rs; + for (unsigned i = 0; i < a.size_default(); i++) { + OptRect bb = a[i].boundsFast(); + if (bb) { + rs.push_back(*bb); + } + } + return rs; +} + void merge_crossings(Crossings &a, Crossings &b, unsigned i) { Crossings n; sort_crossings(b, i); @@ -200,4 +212,4 @@ void clean(Crossings &/*cr_a*/, Crossings &/*cr_b*/) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/crossing.h b/src/2geom/crossing.h index 427848033..62e447450 100644 --- a/src/2geom/crossing.h +++ b/src/2geom/crossing.h @@ -40,6 +40,7 @@ #include <2geom/rect.h> #include <2geom/sweep.h> #include <boost/optional/optional.hpp> +#include <2geom/path.h> namespace Geom { @@ -137,6 +138,8 @@ std::vector<Rect> bounds(C const &a) { } return rs; } +// provide specific method for Paths because paths can be closed or open. Path::size() is named somewhat wrong... +std::vector<Rect> bounds(Path const &a); inline void sort_crossings(Crossings &cr, unsigned ix) { std::sort(cr.begin(), cr.end(), CrossingOrder(ix)); } @@ -193,4 +196,4 @@ void clean(Crossings &cr_a, Crossings &cr_b); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/curve-helpers.cpp b/src/2geom/curve-helpers.cpp index c767af54f..0ecd7d425 100644 --- a/src/2geom/curve-helpers.cpp +++ b/src/2geom/curve-helpers.cpp @@ -91,4 +91,4 @@ int CurveHelpers::root_winding(Curve const &c, Point p) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/curve.h b/src/2geom/curve.h index ce1fec3a6..65bf86ef6 100644 --- a/src/2geom/curve.h +++ b/src/2geom/curve.h @@ -172,4 +172,4 @@ Coord nearest_point(Point const& p, Curve const& c) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/curves.h b/src/2geom/curves.h index f45d1e31f..6c8435387 100644 --- a/src/2geom/curves.h +++ b/src/2geom/curves.h @@ -61,5 +61,5 @@ fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/d2-sbasis.cpp b/src/2geom/d2-sbasis.cpp index aef989fc7..4f5a53cd2 100644 --- a/src/2geom/d2-sbasis.cpp +++ b/src/2geom/d2-sbasis.cpp @@ -272,4 +272,4 @@ std::vector<Piecewise<D2<SBasis> > > fuse_nearby_ends(std::vector<Piecewise<D2<S fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/d2-sbasis.h b/src/2geom/d2-sbasis.h index d404e0618..2b087bda6 100644 --- a/src/2geom/d2-sbasis.h +++ b/src/2geom/d2-sbasis.h @@ -153,4 +153,4 @@ inline OptRect bounds_local(D2<SBasis> const & s, OptInterval i, unsigned order= fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/d2.h b/src/2geom/d2.h index b2a0f8866..bdf042806 100644 --- a/src/2geom/d2.h +++ b/src/2geom/d2.h @@ -458,5 +458,5 @@ OptRect bounds_local(const D2<T> &a, const OptInterval &t) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : #endif diff --git a/src/2geom/ellipse.cpp b/src/2geom/ellipse.cpp index 10071d09a..8030ea517 100644 --- a/src/2geom/ellipse.cpp +++ b/src/2geom/ellipse.cpp @@ -282,6 +282,6 @@ Ellipse::Ellipse(Geom::Circle const &c) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/ellipse.h b/src/2geom/ellipse.h index 7ed04e51b..8e44f3395 100644 --- a/src/2geom/ellipse.h +++ b/src/2geom/ellipse.h @@ -138,4 +138,4 @@ class Ellipse fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/elliptical-arc.cpp b/src/2geom/elliptical-arc.cpp index f2b6b6be2..fd0e7cf9b 100644 --- a/src/2geom/elliptical-arc.cpp +++ b/src/2geom/elliptical-arc.cpp @@ -926,6 +926,6 @@ allNearestPoints( Point const& p, double from, double to ) const fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/elliptical-arc.h b/src/2geom/elliptical-arc.h index b0c0bd9df..002735944 100644 --- a/src/2geom/elliptical-arc.h +++ b/src/2geom/elliptical-arc.h @@ -307,4 +307,4 @@ class EllipticalArc : public Curve fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/exception.h b/src/2geom/exception.h index 99db54b45..fd92ca5e1 100644 --- a/src/2geom/exception.h +++ b/src/2geom/exception.h @@ -134,4 +134,4 @@ struct SVGPathParseError : public std::exception { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/forward.h b/src/2geom/forward.h index 15740faf0..adc099379 100644 --- a/src/2geom/forward.h +++ b/src/2geom/forward.h @@ -103,4 +103,4 @@ template <typename> class SVGPathGenerator; fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/geom.cpp b/src/2geom/geom.cpp index 5eade57f2..d3cf0ca73 100644 --- a/src/2geom/geom.cpp +++ b/src/2geom/geom.cpp @@ -386,4 +386,4 @@ int centroid(std::vector<Geom::Point> const &p, Geom::Point& centroid, double &a fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/geom.h b/src/2geom/geom.h index 9233696d7..5aeded23d 100644 --- a/src/2geom/geom.h +++ b/src/2geom/geom.h @@ -105,4 +105,4 @@ int centroid(std::vector<Geom::Point> const &p, Geom::Point& centroid, double &a fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/hvlinesegment.h b/src/2geom/hvlinesegment.h index 6c42b06aa..6a9edbcea 100644 --- a/src/2geom/hvlinesegment.h +++ b/src/2geom/hvlinesegment.h @@ -537,4 +537,4 @@ class VLineSegment : public Curve fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/interval.h b/src/2geom/interval.h index d4dae41b4..68a406318 100644 --- a/src/2geom/interval.h +++ b/src/2geom/interval.h @@ -282,4 +282,4 @@ inline std::ostream &operator<< (std::ostream &os, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/isnan.h b/src/2geom/isnan.h index b4e7341ff..e20ab7f87 100644 --- a/src/2geom/isnan.h +++ b/src/2geom/isnan.h @@ -113,4 +113,4 @@ fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/linear.h b/src/2geom/linear.h index a7f4c8f21..1b6cca071 100644 --- a/src/2geom/linear.h +++ b/src/2geom/linear.h @@ -169,4 +169,4 @@ inline Linear operator/=(Linear & a, double b) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/matrix.cpp b/src/2geom/matrix.cpp index cc91743b1..e130d2027 100644 --- a/src/2geom/matrix.cpp +++ b/src/2geom/matrix.cpp @@ -255,4 +255,4 @@ Eigen::Eigen(Matrix const &m) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/matrix.h b/src/2geom/matrix.h index e207bf812..6a378dbf1 100644 --- a/src/2geom/matrix.h +++ b/src/2geom/matrix.h @@ -162,4 +162,4 @@ inline bool operator!=(Matrix const &a, Matrix const &b) { return !( a == b ); } fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/numeric/fitting-model.h b/src/2geom/numeric/fitting-model.h index 564663cf7..dcf0e8e1d 100644 --- a/src/2geom/numeric/fitting-model.h +++ b/src/2geom/numeric/fitting-model.h @@ -480,4 +480,4 @@ class LFMBezierCurve fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/numeric/fitting-tool.h b/src/2geom/numeric/fitting-tool.h index d6a26bd2d..f2e856a72 100644 --- a/src/2geom/numeric/fitting-tool.h +++ b/src/2geom/numeric/fitting-tool.h @@ -559,4 +559,4 @@ class least_squeares_fitter<ModelT, Point, true> fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/numeric/linear_system.h b/src/2geom/numeric/linear_system.h index dc2a1d7e0..f793e208b 100644 --- a/src/2geom/numeric/linear_system.h +++ b/src/2geom/numeric/linear_system.h @@ -135,4 +135,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/numeric/matrix.cpp b/src/2geom/numeric/matrix.cpp index bb2a4cefd..94a345fd5 100644 --- a/src/2geom/numeric/matrix.cpp +++ b/src/2geom/numeric/matrix.cpp @@ -112,4 +112,4 @@ Matrix pseudo_inverse(detail::BaseMatrixImpl const& A) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/numeric/matrix.h b/src/2geom/numeric/matrix.h index 97db59d56..f2a934235 100644 --- a/src/2geom/numeric/matrix.h +++ b/src/2geom/numeric/matrix.h @@ -570,4 +570,4 @@ Matrix pseudo_inverse(detail::BaseMatrixImpl const& A); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/numeric/vector.h b/src/2geom/numeric/vector.h index 04c133372..46701645a 100644 --- a/src/2geom/numeric/vector.h +++ b/src/2geom/numeric/vector.h @@ -570,4 +570,4 @@ void swap_view(VectorView & v1, VectorView & v2) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/ord.h b/src/2geom/ord.h index 8c011529a..ca91af579 100644 --- a/src/2geom/ord.h +++ b/src/2geom/ord.h @@ -78,4 +78,4 @@ inline Cmp cmp(T1 const &a, T2 const &b) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/path-intersection.cpp b/src/2geom/path-intersection.cpp index 2e4eba519..5e58525c7 100644 --- a/src/2geom/path-intersection.cpp +++ b/src/2geom/path-intersection.cpp @@ -800,4 +800,4 @@ CrossingSet crossings_among(std::vector<Path> const &p) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/path-intersection.h b/src/2geom/path-intersection.h index 6457b5e43..de2a5b02c 100644 --- a/src/2geom/path-intersection.h +++ b/src/2geom/path-intersection.h @@ -117,4 +117,4 @@ inline CrossingSet crossings(std::vector<Path> const & a, std::vector<Path> cons fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/path.cpp b/src/2geom/path.cpp index 88c7a99b9..c47902649 100644 --- a/src/2geom/path.cpp +++ b/src/2geom/path.cpp @@ -420,4 +420,4 @@ void Path::check_continuity(Sequence::iterator first_replaced, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/path.h b/src/2geom/path.h index b95a54eaa..3167bb09e 100644 --- a/src/2geom/path.h +++ b/src/2geom/path.h @@ -717,4 +717,4 @@ inline void swap<Geom::Path>(Geom::Path &a, Geom::Path &b) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/pathvector.cpp b/src/2geom/pathvector.cpp index 790265c76..3d11dd48b 100644 --- a/src/2geom/pathvector.cpp +++ b/src/2geom/pathvector.cpp @@ -149,4 +149,4 @@ std::vector<PathVectorPosition> allNearestPoints(PathVector const & path_in, Poi fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/pathvector.h b/src/2geom/pathvector.h index d1d785a07..a531cc955 100644 --- a/src/2geom/pathvector.h +++ b/src/2geom/pathvector.h @@ -136,4 +136,4 @@ Point pointAt(PathVector const & path_in, PathVectorPosition const pvp) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/piecewise.cpp b/src/2geom/piecewise.cpp index 4c63b20df..fcecc13c1 100644 --- a/src/2geom/piecewise.cpp +++ b/src/2geom/piecewise.cpp @@ -189,4 +189,4 @@ std::vector<std::vector<double> > multi_roots(Piecewise<SBasis> const &f, std::v fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/piecewise.h b/src/2geom/piecewise.h index a0628daf1..62185b472 100644 --- a/src/2geom/piecewise.h +++ b/src/2geom/piecewise.h @@ -804,4 +804,4 @@ Piecewise<T> lerp(double t, Piecewise<T> const &a, Piecewise<T> b) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/point-l.h b/src/2geom/point-l.h index 88c4af948..d57314a19 100644 --- a/src/2geom/point-l.h +++ b/src/2geom/point-l.h @@ -83,4 +83,4 @@ class IPoint { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/point.cpp b/src/2geom/point.cpp index 4a0625713..45e035d4a 100644 --- a/src/2geom/point.cpp +++ b/src/2geom/point.cpp @@ -173,4 +173,4 @@ Point constrain_angle(Point const &A, Point const &B, unsigned int n, Point cons fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/point.h b/src/2geom/point.h index af97cbfa5..562950525 100644 --- a/src/2geom/point.h +++ b/src/2geom/point.h @@ -247,4 +247,4 @@ Point constrain_angle(Point const &A, Point const &B, unsigned int n = 4, Geom:: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/poly.cpp b/src/2geom/poly.cpp index d8b379557..9fa8e47db 100644 --- a/src/2geom/poly.cpp +++ b/src/2geom/poly.cpp @@ -199,4 +199,4 @@ Poly gcd(Poly const &a, Poly const &b, const double /*tol*/) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/poly.h b/src/2geom/poly.h index 86041a889..e0ba0580f 100644 --- a/src/2geom/poly.h +++ b/src/2geom/poly.h @@ -244,4 +244,4 @@ inline std::ostream &operator<< (std::ostream &out_file, const Poly &in_poly) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/quadtree.cpp b/src/2geom/quadtree.cpp index 211590bae..08e6dd7e2 100644 --- a/src/2geom/quadtree.cpp +++ b/src/2geom/quadtree.cpp @@ -285,4 +285,4 @@ bool QuadTree::clean_root() { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/quadtree.h b/src/2geom/quadtree.h index 2e114a0a0..01ea33ed7 100644 --- a/src/2geom/quadtree.h +++ b/src/2geom/quadtree.h @@ -96,4 +96,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/rect.h b/src/2geom/rect.h index fe2cc297b..cce1d64f0 100644 --- a/src/2geom/rect.h +++ b/src/2geom/rect.h @@ -270,4 +270,4 @@ inline void Rect::unionWith(OptRect const &b) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/recursive-bezier-intersection.cpp b/src/2geom/recursive-bezier-intersection.cpp index d59e7d9c9..421f61308 100644 --- a/src/2geom/recursive-bezier-intersection.cpp +++ b/src/2geom/recursive-bezier-intersection.cpp @@ -469,4 +469,4 @@ void find_intersections_bezier_recursive( std::vector<std::pair<double, double> fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/region.cpp b/src/2geom/region.cpp index 065f3f418..3c8c7fd1c 100644 --- a/src/2geom/region.cpp +++ b/src/2geom/region.cpp @@ -42,4 +42,4 @@ unsigned outer_index(Regions const &ps) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/region.h b/src/2geom/region.h index fe2517e23..937817595 100644 --- a/src/2geom/region.h +++ b/src/2geom/region.h @@ -127,4 +127,4 @@ inline Regions region_boolean(bool rev, Region const & a, Region const & b) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/sbasis-2d.cpp b/src/2geom/sbasis-2d.cpp index 399fb8595..4b414099a 100644 --- a/src/2geom/sbasis-2d.cpp +++ b/src/2geom/sbasis-2d.cpp @@ -199,4 +199,4 @@ sb2d_cubic_solve(SBasis2d const &f, Geom::Point const &A, Geom::Point const &B){ fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/sbasis-2d.h b/src/2geom/sbasis-2d.h index c29d53bcb..f1218b028 100644 --- a/src/2geom/sbasis-2d.h +++ b/src/2geom/sbasis-2d.h @@ -367,5 +367,5 @@ sb2d_cubic_solve(SBasis2d const &f, Geom::Point const &A, Geom::Point const &B); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : #endif diff --git a/src/2geom/sbasis-curve.h b/src/2geom/sbasis-curve.h index 893cd23af..6641c0fe1 100644 --- a/src/2geom/sbasis-curve.h +++ b/src/2geom/sbasis-curve.h @@ -121,4 +121,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/sbasis-geometric.cpp b/src/2geom/sbasis-geometric.cpp index c37118402..3fd667224 100644 --- a/src/2geom/sbasis-geometric.cpp +++ b/src/2geom/sbasis-geometric.cpp @@ -764,4 +764,4 @@ std::vector<double> find_tangents(Point P, D2<SBasis> const &A) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/sbasis-geometric.h b/src/2geom/sbasis-geometric.h index 4f249a7b1..f7216c15a 100644 --- a/src/2geom/sbasis-geometric.h +++ b/src/2geom/sbasis-geometric.h @@ -115,5 +115,5 @@ std::vector<double> find_tangents(Point P, D2<SBasis> const &A); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/sbasis-math.cpp b/src/2geom/sbasis-math.cpp index f3a984c96..409f80c31 100644 --- a/src/2geom/sbasis-math.cpp +++ b/src/2geom/sbasis-math.cpp @@ -377,4 +377,4 @@ Piecewise<SBasis> interpolate(std::vector<double> times, std::vector<double> val fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/sbasis-math.h b/src/2geom/sbasis-math.h index 49ad965d4..e6d40a3de 100644 --- a/src/2geom/sbasis-math.h +++ b/src/2geom/sbasis-math.h @@ -97,4 +97,4 @@ Piecewise<SBasis> interpolate( std::vector<double> times, std::vector<double> va fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/sbasis-poly.cpp b/src/2geom/sbasis-poly.cpp index ec632d5a2..ffee43f67 100644 --- a/src/2geom/sbasis-poly.cpp +++ b/src/2geom/sbasis-poly.cpp @@ -56,4 +56,4 @@ Poly sbasis_to_poly(SBasis const & sb) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/sbasis-poly.h b/src/2geom/sbasis-poly.h index 1c509cf84..e0bef9333 100644 --- a/src/2geom/sbasis-poly.h +++ b/src/2geom/sbasis-poly.h @@ -54,6 +54,6 @@ Poly sbasis_to_poly(SBasis const & s); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : #endif diff --git a/src/2geom/sbasis-roots.cpp b/src/2geom/sbasis-roots.cpp index 37e07cbe8..95fd0cf3b 100644 --- a/src/2geom/sbasis-roots.cpp +++ b/src/2geom/sbasis-roots.cpp @@ -389,4 +389,4 @@ std::vector<double> roots(SBasis const & s) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/sbasis-to-bezier.cpp b/src/2geom/sbasis-to-bezier.cpp index 0a5441254..aabafabea 100644 --- a/src/2geom/sbasis-to-bezier.cpp +++ b/src/2geom/sbasis-to-bezier.cpp @@ -425,4 +425,4 @@ path_from_piecewise(Geom::Piecewise<Geom::D2<Geom::SBasis> > const &B, double to fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/sbasis-to-bezier.h b/src/2geom/sbasis-to-bezier.h index 2875ab3f0..5b88a40fa 100644 --- a/src/2geom/sbasis-to-bezier.h +++ b/src/2geom/sbasis-to-bezier.h @@ -83,4 +83,4 @@ inline Path cubicbezierpath_from_sbasis(D2<SBasis> const &B, double tol) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/sbasis.cpp b/src/2geom/sbasis.cpp index 2f7f03bfc..e313ad08d 100644 --- a/src/2geom/sbasis.cpp +++ b/src/2geom/sbasis.cpp @@ -660,4 +660,4 @@ SBasis compose_inverse(SBasis const &f, SBasis const &g, unsigned order, double fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/sbasis.h b/src/2geom/sbasis.h index a32823f13..d7390c64d 100644 --- a/src/2geom/sbasis.h +++ b/src/2geom/sbasis.h @@ -383,5 +383,5 @@ std::vector<std::vector<double> > multi_roots(SBasis const &f, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : #endif diff --git a/src/2geom/shape.cpp b/src/2geom/shape.cpp index 9ea856133..92af814cb 100644 --- a/src/2geom/shape.cpp +++ b/src/2geom/shape.cpp @@ -686,4 +686,4 @@ bool Shape::invariants() const { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/shape.h b/src/2geom/shape.h index 7877bea20..960f9668b 100644 --- a/src/2geom/shape.h +++ b/src/2geom/shape.h @@ -145,4 +145,4 @@ inline std::vector<Path> desanitize(Shape const & s) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/solve-bezier-one-d.cpp b/src/2geom/solve-bezier-one-d.cpp index a1c0ca557..876c483fe 100644 --- a/src/2geom/solve-bezier-one-d.cpp +++ b/src/2geom/solve-bezier-one-d.cpp @@ -248,4 +248,4 @@ double Bernsteins::horner(const double *b, double t) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/solve-bezier-parametric.cpp b/src/2geom/solve-bezier-parametric.cpp index ad017f596..76cf65e17 100644 --- a/src/2geom/solve-bezier-parametric.cpp +++ b/src/2geom/solve-bezier-parametric.cpp @@ -222,4 +222,4 @@ Bezier(Geom::Point const *V, /* Control pts */ fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/solver.h b/src/2geom/solver.h index 4f3e8a13c..2aadaa476 100644 --- a/src/2geom/solver.h +++ b/src/2geom/solver.h @@ -75,4 +75,4 @@ find_bernstein_roots( fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/sturm.h b/src/2geom/sturm.h index 097a5120a..4fef1b954 100644 --- a/src/2geom/sturm.h +++ b/src/2geom/sturm.h @@ -67,4 +67,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/svg-elliptical-arc.cpp b/src/2geom/svg-elliptical-arc.cpp index 42c787eca..877667b43 100644 --- a/src/2geom/svg-elliptical-arc.cpp +++ b/src/2geom/svg-elliptical-arc.cpp @@ -1175,5 +1175,5 @@ bool make_elliptical_arc::make_elliptiarc() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/svg-elliptical-arc.h b/src/2geom/svg-elliptical-arc.h index dad9000c1..34c51508b 100644 --- a/src/2geom/svg-elliptical-arc.h +++ b/src/2geom/svg-elliptical-arc.h @@ -525,5 +525,5 @@ class make_elliptical_arc fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/svg-path-parser.cpp b/src/2geom/svg-path-parser.cpp index 691ddf022..804284077 100644 --- a/src/2geom/svg-path-parser.cpp +++ b/src/2geom/svg-path-parser.cpp @@ -1392,4 +1392,4 @@ throw(SVGPathParseError) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/svg-path-parser.h b/src/2geom/svg-path-parser.h index 12e80df5a..93fd23b77 100644 --- a/src/2geom/svg-path-parser.h +++ b/src/2geom/svg-path-parser.h @@ -77,4 +77,4 @@ inline std::vector<Path> read_svgd(char const * name) throw(SVGPathParseError) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/svg-path.cpp b/src/2geom/svg-path.cpp index 898c72bf5..3e4bf7bec 100644 --- a/src/2geom/svg-path.cpp +++ b/src/2geom/svg-path.cpp @@ -108,4 +108,4 @@ void output_svg_path(Path &path, SVGPathSink &sink) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/svg-path.h b/src/2geom/svg-path.h index f1fd67867..89192fb72 100644 --- a/src/2geom/svg-path.h +++ b/src/2geom/svg-path.h @@ -163,4 +163,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/sweep.cpp b/src/2geom/sweep.cpp index 7571efe09..f25894282 100644 --- a/src/2geom/sweep.cpp +++ b/src/2geom/sweep.cpp @@ -136,4 +136,4 @@ std::vector<std::vector<unsigned> > fake_cull(unsigned a, unsigned b) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/sweep.h b/src/2geom/sweep.h index 9d1643d7a..299813244 100644 --- a/src/2geom/sweep.h +++ b/src/2geom/sweep.h @@ -73,4 +73,4 @@ std::vector<std::vector<unsigned> > fake_cull(unsigned a, unsigned b); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/transforms.cpp b/src/2geom/transforms.cpp index a6426fe81..8182ce16d 100644 --- a/src/2geom/transforms.cpp +++ b/src/2geom/transforms.cpp @@ -114,4 +114,4 @@ Matrix pow(Matrix x, long n) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/transforms.h b/src/2geom/transforms.h index 29aab11aa..1d8d87da3 100644 --- a/src/2geom/transforms.h +++ b/src/2geom/transforms.h @@ -172,4 +172,4 @@ Matrix pow(Matrix t, int n); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/utils.cpp b/src/2geom/utils.cpp index 579718553..a40b7253d 100644 --- a/src/2geom/utils.cpp +++ b/src/2geom/utils.cpp @@ -84,4 +84,4 @@ void binomial_coefficients(std::vector<size_t>& bc, size_t n) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/2geom/utils.h b/src/2geom/utils.h index 5ab191749..dcadc8431 100644 --- a/src/2geom/utils.h +++ b/src/2geom/utils.h @@ -95,4 +95,4 @@ void binomial_coefficients(std::vector<size_t>& bc, size_t n); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a956f6ad8..f03f22c80 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -206,7 +206,6 @@ ${ONLY_WIN} SET(internalfolders
#algorithms
#api
-application
bind
debug
dialogs
diff --git a/src/Makefile.am b/src/Makefile.am index ce8113a13..6810d6d9d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -106,7 +106,6 @@ endif # Include all partial makefiles from subdirectories include Makefile_insert -include application/Makefile_insert include bind/Makefile_insert include dialogs/Makefile_insert include display/Makefile_insert diff --git a/src/MultiPrinter.h b/src/MultiPrinter.h index 944eead06..0d97b2ee9 100644 --- a/src/MultiPrinter.h +++ b/src/MultiPrinter.h @@ -107,6 +107,6 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : #endif //SEEN_MULTI_PRINTER_H diff --git a/src/PylogFormatter.h b/src/PylogFormatter.h index adfc9a7f1..94dba050c 100644 --- a/src/PylogFormatter.h +++ b/src/PylogFormatter.h @@ -381,6 +381,6 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : #endif // PYLOG_FORMATTER_H_SEEN diff --git a/src/TRPIFormatter.h b/src/TRPIFormatter.h index 2b0ab20c3..4aa9ed2e6 100644 --- a/src/TRPIFormatter.h +++ b/src/TRPIFormatter.h @@ -189,6 +189,6 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : #endif // TRPI_FORMATTER_H_SEEN diff --git a/src/application/CMakeLists.txt b/src/application/CMakeLists.txt deleted file mode 100644 index c09279395..000000000 --- a/src/application/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -SET(application_SRC -editor.cpp -application.cpp -app-prototype.cpp -) -ADD_LIBRARY(application STATIC ${application_SRC}) -TARGET_LINK_LIBRARIES(application -2geom ${INKSCAPE_LIBS})
\ No newline at end of file diff --git a/src/application/Makefile_insert b/src/application/Makefile_insert deleted file mode 100644 index d3afa2307..000000000 --- a/src/application/Makefile_insert +++ /dev/null @@ -1,9 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -ink_common_sources += \ - application/editor.cpp \ - application/editor.h \ - application/application.cpp \ - application/application.h \ - application/app-prototype.cpp \ - application/app-prototype.h diff --git a/src/application/app-prototype.cpp b/src/application/app-prototype.cpp deleted file mode 100644 index 27f58d92a..000000000 --- a/src/application/app-prototype.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/** @file - * @brief Base class for different application modes - */ -/* Author: - * Bryce W. Harrington <bryce@bryceharrington.org> - * - * Copyright (C) 2005 Bryce Harrington - * - * Released under GNU GPL. Read the file 'COPYING' for more information. - */ - -#include "app-prototype.h" - -namespace Inkscape { -namespace NSApplication { - -AppPrototype::AppPrototype() -{ -} - -AppPrototype::AppPrototype(int /*argc*/, const char **/*argv*/) -{ -} - -AppPrototype::~AppPrototype() -{ -} - - -} // namespace NSApplication -} // namespace Inkscape - - -/* - 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:encoding=utf-8:textwidth=99 : diff --git a/src/application/app-prototype.h b/src/application/app-prototype.h deleted file mode 100644 index ce1cd3c8e..000000000 --- a/src/application/app-prototype.h +++ /dev/null @@ -1,53 +0,0 @@ -/** @file - * @brief Base class for different application modes - */ -/* Author: - * Bryce W. Harrington <bryce@bryceharrington.org> - * - * Copyright (C) 2005 Bryce Harrington - * - * Released under GNU GPL. Read the file 'COPYING' for more information. - */ - -#ifndef INKSCAPE_APPLICATION_APP_PROTOTYPE_H -#define INKSCAPE_APPLICATION_APP_PROTOTYPE_H - -namespace Gtk { -class Window; -} - - -namespace Inkscape { -namespace NSApplication { - -class AppPrototype -{ -public: - AppPrototype(); - AppPrototype(int argc, const char **argv); - virtual ~AppPrototype(); - - virtual void* getWindow() = 0; - -protected: - AppPrototype(AppPrototype const &); - AppPrototype& operator=(AppPrototype const &); - -}; - -} // namespace NSApplication -} // namespace Inkscape - - -#endif /* !INKSCAPE_APPLICATION_APP_PROTOTYPE_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:encoding=utf-8:textwidth=99 : diff --git a/src/application/application.cpp b/src/application/application.cpp deleted file mode 100644 index ab516b9d4..000000000 --- a/src/application/application.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/** @file - * @brief The top level class for managing the application - */ -/* Authors: - * Bryce W. Harrington <bryce@bryceharrington.org> - * Ralf Stephan <ralf@ark.in-berlin.de> - * - * Copyright (C) 2005 Authors - * - * Released under GNU GPL. Read the file 'COPYING' for more information. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <gtkmm/main.h> - -#include "preferences.h" -#include "application.h" -#include "editor.h" - -int sp_main_gui(int argc, char const **argv); -int sp_main_console(int argc, char const **argv); - -static Gtk::Main *_gtk_main; -static bool _use_gui, _new_gui; - -namespace Inkscape { -namespace NSApplication { - -Application::Application(int argc, char **argv, bool use_gui, bool new_gui) - : _argc(argc), - _argv(NULL), - _app_impl(NULL), - _path_home(NULL) -{ - _use_gui = use_gui; - _new_gui = new_gui; - - if (argv != NULL) { - _argv = argv; // TODO: Is this correct? - } - - if (new_gui) { - _gtk_main = new Gtk::Main(argc, argv, true); - - // TODO: Determine class by arguments - g_warning("Creating new Editor"); - _app_impl = (AppPrototype*) Editor::create(_argc, _argv); - - } else if (use_gui) { - // No op - we'll use the old interface - } else { - _app_impl = NULL; // = Cmdline(_argc, _argv); - } - - /// \todo Install segv handler here? - -// Inkscape::Extension::init(); -} - -Application::~Application() -{ - g_free(_path_home); -} - - -/** Returns the current home directory location */ -gchar const* -Application::homedir() const -{ - if ( !_path_home ) { - _path_home = g_strdup(g_get_home_dir()); - gchar* utf8Path = g_filename_to_utf8( _path_home, -1, NULL, NULL, NULL ); - if ( utf8Path ) { - _path_home = utf8Path; - if ( !g_utf8_validate(_path_home, -1, NULL) ) { - g_warning( "Home directory is non-UTF-8" ); - } - } - } - if ( !_path_home && _argv != NULL) { - gchar * path = g_path_get_dirname(_argv[0]); - gchar * utf8Path = g_filename_to_utf8( path, -1, NULL, NULL, NULL ); - g_free(path); - if (utf8Path) { - _path_home = utf8Path; - if ( !g_utf8_validate(_path_home, -1, NULL) ) { - g_warning( "Application run directory is non-UTF-8" ); - } - } - } - return _path_home; -} - -gint -Application::run() -{ - gint result = 0; - - /* Note: This if loop should be replaced by calls to the - * various subclasses of I::A::AppPrototype. - */ - if (_gtk_main != NULL) { - g_assert(_app_impl != NULL); - g_warning("Running main window"); - Gtk::Window *win = static_cast<Gtk::Window*>(_app_impl->getWindow()); - g_assert(win != NULL); - _gtk_main->run(*win); - result = 0; - - } else if (_use_gui) { - result = sp_main_gui(_argc, (const char**)_argv); - - } else { - result = sp_main_console(_argc, (const char**)_argv); - } - - return result; -} - -void -Application::exit() -{ - Inkscape::Preferences::unload(); - - if (_gtk_main != NULL) { - _gtk_main->quit(); - } - -} - -bool -Application::getUseGui() -{ - return _use_gui; -} - -bool -Application::getNewGui() -{ - return _new_gui; -} - - -} // namespace NSApplication -} // namespace Inkscape - - -/* - 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:encoding=utf-8:textwidth=99 : diff --git a/src/application/application.h b/src/application/application.h deleted file mode 100644 index fce6bd47f..000000000 --- a/src/application/application.h +++ /dev/null @@ -1,65 +0,0 @@ -/** @file - * @brief The top level class for managing the application. - */ -/* Authors: - * Bryce W. Harrington <bryce@bryceharrington.org> - * Ralf Stephan <ralf@ark.in-berlin.de> - * - * Copyright (C) 2005 Authors - * - * Released under GNU GPL. Read the file 'COPYING' for more information. - */ - -#ifndef INKSCAPE_APPLICATION_APPLICATION_H -#define INKSCAPE_APPLICATION_APPLICATION_H - -#include <glib/gtypes.h> - -namespace Gtk { -class Main; -} - -namespace Inkscape { -namespace NSApplication { -class AppPrototype; - -class Application -{ -public: - Application(int argc, char **argv, bool use_gui=true, bool new_gui=false); - virtual ~Application(); - - gchar const *homedir() const; - - gint run(); - - static bool getUseGui(); - static bool getNewGui(); - static void exit(); - -protected: - Application(Application const &); - Application& operator=(Application const &); - - gint _argc; - char **_argv; - AppPrototype *_app_impl; - - mutable gchar *_path_home; -}; - -} // namespace NSApplication -} // namespace Inkscape - -#endif /* !INKSCAPE_APPLICATION_APPLICATION_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:encoding=utf-8:textwidth=99 : diff --git a/src/application/editor.cpp b/src/application/editor.cpp deleted file mode 100644 index 49010efdc..000000000 --- a/src/application/editor.cpp +++ /dev/null @@ -1,420 +0,0 @@ -/** @file - * @brief Editor class declaration. This - * singleton class implements much of the functionality of the former - * 'inkscape' object and its services and signals. - */ -/* Authors: - * Bryce W. Harrington <bryce@bryceharrington.org> - * Derek P. Moore <derekm@hackunix.org> - * Ralf Stephan <ralf@ark.in-berlin.de> - * - * Copyright (C) 2004-2005 Authors - * - * Released under GNU GPL. Read the file 'COPYING' for more information. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -/* - TODO: Replace SPDocument with the new Inkscape::Document - TODO: Change 'desktop's to 'view*'s - TODO: Add derivation from Inkscape::Application::RunMode -*/ - - -#include "path-prefix.h" -#include "io/sys.h" -#include "sp-object-repr.h" -#include <desktop-handles.h> -#include "document.h" -#include "sp-namedview.h" -#include "event-context.h" -#include "sp-guide.h" -#include "selection.h" -#include "editor.h" -#include "application/application.h" -#include "preferences.h" -#include "ui/view/edit-widget.h" - -namespace Inkscape { -namespace NSApplication { - -static Editor *_instance = 0; -static void *_window; - -Editor* -Editor::create (gint argc, char **argv) -{ - if (_instance == 0) - { - _instance = new Editor (argc, argv); - _instance->init(); - } - return _instance; -} - -Editor::Editor (gint /*argc*/, char **argv) -: _documents (0), - _desktops (0), - _argv0 (argv[0]), - _dialogs_toggle (true) - -{ - sp_object_type_register ("sodipodi:namedview", SP_TYPE_NAMEDVIEW); - sp_object_type_register ("sodipodi:guide", SP_TYPE_GUIDE); - - Inkscape::Preferences::get(); // Ensure preferences are loaded -} - -bool -Editor::init() -{ - // Load non-local template until we have everything right - // This code formerly lived in file.cpp - // - gchar const *tmpl = g_build_filename ((INKSCAPE_TEMPLATESDIR), "default.svg", NULL); - bool have_default = Inkscape::IO::file_test (tmpl, G_FILE_TEST_IS_REGULAR); - SPDocument *doc = sp_document_new (have_default? tmpl:0, true, true); - g_return_val_if_fail (doc != 0, false); - Inkscape::UI::View::EditWidget *ew = new Inkscape::UI::View::EditWidget (doc); - sp_document_unref (doc); - _window = ew->getWindow(); - return ew != 0; -} - -Editor::~Editor() -{ -} - -/// Returns the Window representation of this application object -void* -Editor::getWindow() -{ - return _window; -} - -/// Returns the active document -SPDocument* -Editor::getActiveDocument() -{ - if (getActiveDesktop()) { - return sp_desktop_document (getActiveDesktop()); - } - - return NULL; -} - -void -Editor::addDocument (SPDocument *doc) -{ - if ( _instance->_document_set.find(doc) == _instance->_document_set.end() ) { - _instance->_documents = g_slist_append (_instance->_documents, doc); - } - _instance->_document_set.insert(doc); -} - -void -Editor::removeDocument (SPDocument *doc) -{ - _instance->_document_set.erase(doc); - if ( _instance->_document_set.find(doc) == _instance->_document_set.end() ) { - _instance->_documents = g_slist_remove (_instance->_documents, doc); - } -} - -SPDesktop* -Editor::createDesktop (SPDocument* doc) -{ - g_assert (doc != 0); - (new Inkscape::UI::View::EditWidget (doc))->present(); - sp_document_unref (doc); - SPDesktop *dt = getActiveDesktop(); - reactivateDesktop (dt); - return dt; -} - -/// Returns the currently active desktop -SPDesktop* -Editor::getActiveDesktop() -{ - if (_instance->_desktops == NULL) { - return NULL; - } - - return (SPDesktop *) _instance->_desktops->data; -} - -/// Add desktop to list of desktops -void -Editor::addDesktop (SPDesktop *dt) -{ - g_return_if_fail (dt != 0); - g_assert (!g_slist_find (_instance->_desktops, dt)); - - _instance->_desktops = g_slist_append (_instance->_desktops, dt); - - if (isDesktopActive (dt)) { - _instance->_desktop_activated_signal.emit (dt); - _instance->_event_context_set_signal.emit (sp_desktop_event_context (dt)); - _instance->_selection_set_signal.emit (sp_desktop_selection (dt)); - _instance->_selection_changed_signal.emit (sp_desktop_selection (dt)); - } -} - -/// Remove desktop from list of desktops -void -Editor::removeDesktop (SPDesktop *dt) -{ - g_return_if_fail (dt != 0); - g_assert (g_slist_find (_instance->_desktops, dt)); - - if (dt == _instance->_desktops->data) { // is it the active desktop? - _instance->_desktop_deactivated_signal.emit (dt); - if (_instance->_desktops->next != 0) { - SPDesktop * new_desktop = (SPDesktop *) _instance->_desktops->next->data; - _instance->_desktops = g_slist_remove (_instance->_desktops, new_desktop); - _instance->_desktops = g_slist_prepend (_instance->_desktops, new_desktop); - _instance->_desktop_activated_signal.emit (new_desktop); - _instance->_event_context_set_signal.emit (sp_desktop_event_context (new_desktop)); - _instance->_selection_set_signal.emit (sp_desktop_selection (new_desktop)); - _instance->_selection_changed_signal.emit (sp_desktop_selection (new_desktop)); - } else { - _instance->_event_context_set_signal.emit (0); - if (sp_desktop_selection(dt)) - sp_desktop_selection(dt)->clear(); - } - } - - _instance->_desktops = g_slist_remove (_instance->_desktops, dt); - - // if this was the last desktop, shut down the program - if (_instance->_desktops == NULL) { - _instance->_shutdown_signal.emit(); - Inkscape::NSApplication::Application::exit(); - } -} - -void -Editor::activateDesktop (SPDesktop* dt) -{ - g_assert (dt != 0); - if (isDesktopActive (dt)) - return; - - g_assert (g_slist_find (_instance->_desktops, dt)); - SPDesktop *curr = (SPDesktop*)_instance->_desktops->data; - _instance->_desktop_deactivated_signal.emit (curr); - - _instance->_desktops = g_slist_remove (_instance->_desktops, dt); - _instance->_desktops = g_slist_prepend (_instance->_desktops, dt); - - _instance->_desktop_activated_signal.emit (dt); - _instance->_event_context_set_signal.emit (sp_desktop_event_context(dt)); - _instance->_selection_set_signal.emit (sp_desktop_selection(dt)); - _instance->_selection_changed_signal.emit (sp_desktop_selection(dt)); -} - -void -Editor::reactivateDesktop (SPDesktop* dt) -{ - g_assert (dt != 0); - if (isDesktopActive(dt)) - _instance->_desktop_activated_signal.emit (dt); -} - -bool -Editor::isDuplicatedView (SPDesktop* dt) -{ - SPDocument const* document = dt->doc(); - if (!document) { - return false; - } - for ( GSList *iter = _instance->_desktops ; iter ; iter = iter->next ) { - SPDesktop *other_desktop=(SPDesktop *)iter->data; - SPDocument *other_document=other_desktop->doc(); - if ( other_document == document && other_desktop != dt ) { - return true; - } - } - return false; -} - - /// Returns the event context -//SPEventContext* -//Editor::getEventContext() -//{ -// if (getActiveDesktop()) { -// return sp_desktop_event_context (getActiveDesktop()); -// } -// -// return NULL; -//} - - -void -Editor::selectionModified (Inkscape::Selection* sel, guint flags) -{ - g_return_if_fail (sel != NULL); - if (isDesktopActive (sel->desktop())) - _instance->_selection_modified_signal.emit (sel, flags); -} - -void -Editor::selectionChanged (Inkscape::Selection* sel) -{ - g_return_if_fail (sel != NULL); - if (isDesktopActive (sel->desktop())) - _instance->_selection_changed_signal.emit (sel); -} - -void -Editor::subSelectionChanged (SPDesktop* dt) -{ - g_return_if_fail (dt != NULL); - if (isDesktopActive (dt)) - _instance->_subselection_changed_signal.emit (dt); -} - -void -Editor::selectionSet (Inkscape::Selection* sel) -{ - g_return_if_fail (sel != NULL); - if (isDesktopActive (sel->desktop())) { - _instance->_selection_set_signal.emit (sel); - _instance->_selection_changed_signal.emit (sel); - } -} - -void -Editor::eventContextSet (SPEventContext* ec) -{ - g_return_if_fail (ec != NULL); - g_return_if_fail (SP_IS_EVENT_CONTEXT (ec)); - if (isDesktopActive (ec->desktop)) - _instance->_event_context_set_signal.emit (ec); -} - -void -Editor::hideDialogs() -{ - _instance->_dialogs_hidden_signal.emit(); - _instance->_dialogs_toggle = false; -} - -void -Editor::unhideDialogs() -{ - _instance->_dialogs_unhidden_signal.emit(); - _instance->_dialogs_toggle = true; -} - -void -Editor::toggleDialogs() -{ - if (_dialogs_toggle) { - hideDialogs(); - } else { - unhideDialogs(); - } -} - -void -Editor::refreshDisplay() -{ - // TODO -} - -void -Editor::exit() -{ - //emit shutdown signal so that dialogs could remember layout - _shutdown_signal.emit(); - Inkscape::Preferences::unload(); -} - -//================================================================== - -sigc::connection -Editor::connectSelectionModified -(const sigc::slot<void, Inkscape::Selection*, guint> &slot) -{ - return _instance->_selection_modified_signal.connect (slot); -} - -sigc::connection -Editor::connectSelectionChanged -(const sigc::slot<void, Inkscape::Selection*> &slot) -{ - return _instance->_selection_changed_signal.connect (slot); -} - -sigc::connection -Editor::connectSubselectionChanged (const sigc::slot<void, SPDesktop*> &slot) -{ - return _instance->_subselection_changed_signal.connect (slot); -} - -sigc::connection -Editor::connectSelectionSet (const sigc::slot<void, Inkscape::Selection*> &slot) -{ - return _instance->_selection_set_signal.connect (slot); -} - -sigc::connection -Editor::connectEventContextSet (const sigc::slot<void, SPEventContext*> &slot) -{ - return _instance->_event_context_set_signal.connect (slot); -} - -sigc::connection -Editor::connectDesktopActivated (const sigc::slot<void, SPDesktop*> &slot) -{ - return _instance->_desktop_activated_signal.connect (slot); -} - -sigc::connection -Editor::connectDesktopDeactivated (const sigc::slot<void, SPDesktop*> &slot) -{ - return _instance->_desktop_deactivated_signal.connect (slot); -} - -sigc::connection -Editor::connectShutdown (const sigc::slot<void> &slot) -{ - return _instance->_shutdown_signal.connect (slot); -} - -sigc::connection -Editor::connectDialogsHidden (const sigc::slot<void> &slot) -{ - return _instance->_dialogs_hidden_signal.connect (slot); -} - -sigc::connection -Editor::connectDialogsUnhidden (const sigc::slot<void> &slot) -{ - return _instance->_dialogs_unhidden_signal.connect (slot); -} - -sigc::connection -Editor::connectExternalChange (const sigc::slot<void> &slot) -{ - return _instance->_external_change_signal.connect (slot); -} - - -} // namespace NSApplication -} // namespace Inkscape - -/* - 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:encoding=utf-8:textwidth=99 : diff --git a/src/application/editor.h b/src/application/editor.h deleted file mode 100644 index 4545022b8..000000000 --- a/src/application/editor.h +++ /dev/null @@ -1,140 +0,0 @@ -/** @file - * @brief Singleton class to manage an application used for editing SVG - * documents using GUI views - */ -/* - * Authors: - * Bryce W. Harrington <bryce@bryceharrington.org> - * Ralf Stephan <ralf@ark.in-berlin.de> - * - * Copyright (C) 2004 Bryce Harrington - * - * Released under GNU GPL. Read the file 'COPYING' for more information. - */ - -#ifndef INKSCAPE_APPLICATION_EDITOR_H -#define INKSCAPE_APPLICATION_EDITOR_H - -#include <sigc++/sigc++.h> -#include <glib/gslist.h> -#include <glibmm/ustring.h> -#include <set> -#include "app-prototype.h" - -class SPDesktop; -class SPDocument; -class SPEventContext; - -namespace Inkscape { - class Selection; - namespace XML { - class Document; - } - namespace UI { - namespace View { - class Edit; - } - } - namespace NSApplication { - -class Editor : public AppPrototype -{ -public: - static Editor *create (int argc, char **argv); - virtual ~Editor(); - - void* getWindow(); - - void toggleDialogs(); - void nextDesktop(); - void prevDesktop(); - - void refreshDisplay(); - void exit(); - - bool lastViewOfDocument(SPDocument* doc, SPDesktop* view) const; - - bool addView(SPDesktop* view); - bool deleteView(SPDesktop* view); - - static Inkscape::XML::Document *getPreferences(); - static SPDesktop* getActiveDesktop(); - static bool isDesktopActive (SPDesktop* dt) { return getActiveDesktop()==dt; } - static SPDesktop* createDesktop (SPDocument* doc); - static void addDesktop (SPDesktop* dt); - static void removeDesktop (SPDesktop* dt); - static void activateDesktop (SPDesktop* dt); - static void reactivateDesktop (SPDesktop* dt); - static bool isDuplicatedView (SPDesktop* dt); - - static SPDocument* getActiveDocument(); - static void addDocument (SPDocument* doc); - static void removeDocument (SPDocument* doc); - - static void selectionModified (Inkscape::Selection*, guint); - static void selectionChanged (Inkscape::Selection*); - static void subSelectionChanged (SPDesktop*); - static void selectionSet (Inkscape::Selection*); - static void eventContextSet (SPEventContext*); - static void hideDialogs(); - static void unhideDialogs(); - - static sigc::connection connectSelectionModified (const sigc::slot<void, Inkscape::Selection*, guint> &slot); - static sigc::connection connectSelectionChanged (const sigc::slot<void, Inkscape::Selection*> &slot); - static sigc::connection connectSubselectionChanged (const sigc::slot<void, SPDesktop*> &slot); - static sigc::connection connectSelectionSet (const sigc::slot<void, Inkscape::Selection*> &slot); - static sigc::connection connectEventContextSet (const sigc::slot<void, SPEventContext*> &slot); - static sigc::connection connectDesktopActivated (const sigc::slot<void, SPDesktop*> &slot); - static sigc::connection connectDesktopDeactivated (const sigc::slot<void, SPDesktop*> &slot); - static sigc::connection connectShutdown (const sigc::slot<void> &slot); - static sigc::connection connectDialogsHidden (const sigc::slot<void> &slot); - static sigc::connection connectDialogsUnhidden (const sigc::slot<void> &slot); - static sigc::connection connectExternalChange (const sigc::slot<void> &slot); - - -protected: - Editor(Editor const &); - Editor& operator=(Editor const &); - - std::multiset<SPDocument *> _document_set; - GSList *_documents; - GSList *_desktops; - gchar *_argv0; - - bool _dialogs_toggle; - - sigc::signal <void, Inkscape::Selection*, guint> _selection_modified_signal; - sigc::signal <void, Inkscape::Selection*> _selection_changed_signal; - sigc::signal <void, SPDesktop*> _subselection_changed_signal; - sigc::signal <void, Inkscape::Selection*> _selection_set_signal; - sigc::signal <void, SPEventContext*> _event_context_set_signal; - sigc::signal <void, SPDesktop*> _desktop_activated_signal; - sigc::signal <void, SPDesktop*> _desktop_deactivated_signal; - sigc::signal <void> _shutdown_signal; - sigc::signal <void> _dialogs_hidden_signal; - sigc::signal <void> _dialogs_unhidden_signal; - sigc::signal <void> _external_change_signal; - -private: - Editor(int argc, char **argv); - bool init(); -}; - -#define ACTIVE_DESKTOP Inkscape::NSApplication::Editor::getActiveDesktop() - -} // namespace NSApplication -} // namespace Inkscape - - -#endif /* !INKSCAPE_APPLICATION_EDITOR_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:encoding=utf-8:textwidth=99 : diff --git a/src/application/makefile.in b/src/application/makefile.in deleted file mode 100644 index 7a879dba2..000000000 --- a/src/application/makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Convenience stub makefile to call the real Makefile. - -@SET_MAKE@ - -OBJEXT = @OBJEXT@ - -# Explicit so that it's the default rule. -all: - cd .. && $(MAKE) application/all - -clean %.a %.$(OBJEXT): - cd .. && $(MAKE) application/$@ - -.PHONY: all clean - -.SUFFIXES: -.SUFFIXES: .a .$(OBJEXT) diff --git a/src/approx-equal.h b/src/approx-equal.h index 3f5ebf109..92f36d7a5 100644 --- a/src/approx-equal.h +++ b/src/approx-equal.h @@ -22,4 +22,4 @@ inline bool approx_equal(double const a, double const b) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/arc-context.cpp b/src/arc-context.cpp index 799167a72..b485dd183 100644 --- a/src/arc-context.cpp +++ b/src/arc-context.cpp @@ -107,6 +107,7 @@ static void sp_arc_context_init(SPArcContext *arc_context) event_context->tolerance = 0; event_context->within_tolerance = false; event_context->item_to_select = NULL; + event_context->tool_url = "/tools/shapes/arc"; arc_context->item = NULL; @@ -251,6 +252,7 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK, NULL, event->button.time); ret = TRUE; + m.unSetup(); } break; case GDK_MOTION_NOTIFY: @@ -281,6 +283,7 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent Geom::Point const motion_w(event->motion.x, event->motion.y); Geom::Point motion_dt(desktop->w2d(motion_w)); m.preSnap(Inkscape::SnapCandidatePoint(motion_dt, Inkscape::SNAPSOURCE_NODE_HANDLE)); + m.unSetup(); } break; case GDK_BUTTON_RELEASE: @@ -539,4 +542,4 @@ static void sp_arc_cancel(SPArcContext *ac) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/attributes-test.h b/src/attributes-test.h index 6677294f2..14696b845 100644 --- a/src/attributes-test.h +++ b/src/attributes-test.h @@ -540,4 +540,4 @@ struct {char const *attr; bool supported;} const all_attrs[] = { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/attributes.cpp b/src/attributes.cpp index c44a7da4e..118a90482 100644 --- a/src/attributes.cpp +++ b/src/attributes.cpp @@ -111,6 +111,7 @@ static SPStyleProp const props[] = { {SP_ATTR_INKSCAPE_SNAP_PAGE, "inkscape:snap-page"}, {SP_ATTR_INKSCAPE_CURRENT_LAYER, "inkscape:current-layer"}, {SP_ATTR_INKSCAPE_DOCUMENT_UNITS, "inkscape:document-units"}, + {SP_ATTR_UNITS, "units"}, {SP_ATTR_INKSCAPE_CONNECTOR_SPACING, "inkscape:connector-spacing"}, /* SPColorProfile */ {SP_ATTR_LOCAL, "local"}, @@ -523,4 +524,4 @@ sp_attribute_name(unsigned int id) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/attributes.h b/src/attributes.h index aadb4d165..3755268d0 100644 --- a/src/attributes.h +++ b/src/attributes.h @@ -112,6 +112,7 @@ enum SPAttributeEnum { SP_ATTR_INKSCAPE_SNAP_PAGE, SP_ATTR_INKSCAPE_CURRENT_LAYER, SP_ATTR_INKSCAPE_DOCUMENT_UNITS, + SP_ATTR_UNITS, SP_ATTR_INKSCAPE_CONNECTOR_SPACING, /* SPColorProfile */ SP_ATTR_LOCAL, @@ -494,4 +495,4 @@ enum SPAttributeEnum { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/axis-manip.cpp b/src/axis-manip.cpp index 1eed56439..1dfa0e6bf 100644 --- a/src/axis-manip.cpp +++ b/src/axis-manip.cpp @@ -44,4 +44,4 @@ get_remaining_axes (Axis axis) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp index 5534aa410..14f4470bc 100644 --- a/src/box3d-context.cpp +++ b/src/box3d-context.cpp @@ -283,6 +283,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven if ( event->button.button == 1 && !event_context->space_panning) { Geom::Point const button_w(event->button.x, event->button.y); + Geom::Point button_dt(desktop->w2d(button_w)); // save drag origin event_context->xp = (gint) button_w[Geom::X]; @@ -294,8 +295,12 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven dragging = true; - /* */ - Geom::Point button_dt(desktop->w2d(button_w)); + SnapManager &m = desktop->namedview->snap_manager; + m.setup(desktop, true, bc->item); + m.freeSnapReturnByRef(button_dt, Inkscape::SNAPSOURCE_NODE_HANDLE); + m.unSetup(); + bc->center = from_2geom(button_dt); + bc->drag_origin = from_2geom(button_dt); bc->drag_ptB = from_2geom(button_dt); bc->drag_ptC = from_2geom(button_dt); @@ -313,12 +318,6 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven bc->drag_ptC_proj.normalize(); bc->drag_ptC_proj[Proj::Z] = 0.25; - /* Snap center */ - SnapManager &m = desktop->namedview->snap_manager; - m.setup(desktop, true, bc->item); - m.freeSnapReturnByRef(button_dt, Inkscape::SNAPSOURCE_NODE_HANDLE); - bc->center = from_2geom(button_dt); - sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), ( GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | @@ -349,7 +348,6 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop, true, bc->item); m.freeSnapReturnByRef(motion_dt, Inkscape::SNAPSOURCE_NODE_HANDLE); - bc->ctrl_dragged = event->motion.state & GDK_CONTROL_MASK; if (event->motion.state & GDK_SHIFT_MASK && !bc->extruded && bc->item) { @@ -383,6 +381,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven } m.freeSnapReturnByRef(bc->drag_ptC, Inkscape::SNAPSOURCE_NODE_HANDLE); } + m.unSetup(); sp_box3d_drag(*bc, event->motion.state); @@ -394,6 +393,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven Geom::Point const motion_w(event->motion.x, event->motion.y); Geom::Point motion_dt(desktop->w2d(motion_w)); m.preSnap(Inkscape::SnapCandidatePoint(motion_dt, Inkscape::SNAPSOURCE_NODE_HANDLE)); + m.unSetup(); } break; case GDK_BUTTON_RELEASE: @@ -691,4 +691,4 @@ void sp_box3d_context_update_lines(SPEventContext *ec) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/box3d-context.h b/src/box3d-context.h index 8bafa75f2..913e98263 100644 --- a/src/box3d-context.h +++ b/src/box3d-context.h @@ -80,4 +80,4 @@ void sp_box3d_context_update_lines(SPEventContext *ec); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/box3d-side.cpp b/src/box3d-side.cpp index 69bae53d9..057d8f7df 100644 --- a/src/box3d-side.cpp +++ b/src/box3d-side.cpp @@ -336,4 +336,4 @@ box3d_side_convert_to_path(Box3DSide *side) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/box3d-side.h b/src/box3d-side.h index d40e64b75..18c815073 100644 --- a/src/box3d-side.h +++ b/src/box3d-side.h @@ -57,4 +57,4 @@ Inkscape::XML::Node *box3d_side_convert_to_path(Box3DSide *side); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/box3d.h b/src/box3d.h index 9f2e1d78e..8273e3542 100644 --- a/src/box3d.h +++ b/src/box3d.h @@ -89,4 +89,4 @@ SPGroup *box3d_convert_to_group(SPBox3D *box); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/color-profile-fns.h b/src/color-profile-fns.h index c8c51b551..3d22417f6 100644 --- a/src/color-profile-fns.h +++ b/src/color-profile-fns.h @@ -61,4 +61,4 @@ Glib::ustring get_path_for_profile(Glib::ustring const& name); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/color-profile-test.h b/src/color-profile-test.h index cdbf76b44..42893039a 100644 --- a/src/color-profile-test.h +++ b/src/color-profile-test.h @@ -147,4 +147,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/color-profile.cpp b/src/color-profile.cpp index a8238556c..1189a7c29 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -7,6 +7,7 @@ #include <glib/gstdio.h> #include <sys/fcntl.h> #include <gdkmm/color.h> +#include <glib/gi18n.h> #ifdef DEBUG_LCMS #include <gtk/gtkmessagedialog.h> @@ -14,6 +15,7 @@ #include <cstring> #include <string> +#include <io/sys.h> #ifdef WIN32 #ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. Required for correctly including icm.h @@ -556,9 +558,6 @@ bool ColorProfile::GamutCheck(SPColor color){ return (outofgamut == 255); } - -#include <io/sys.h> - class ProfileInfo { public: @@ -630,7 +629,14 @@ Glib::ustring Inkscape::get_path_for_profile(Glib::ustring const& name) } #endif // ENABLE_LCMS -std::list<Glib::ustring> ColorProfile::getProfileDirs() { +std::list<Glib::ustring> ColorProfile::getBaseProfileDirs() { +#if ENABLE_LCMS + static bool warnSet = false; + if (!warnSet) { + cmsErrorAction( LCMS_ERROR_SHOW ); + warnSet = true; + } +#endif // ENABLE_LCMS std::list<Glib::ustring> sources; gchar* base = profile_path("XXX"); @@ -655,17 +661,26 @@ std::list<Glib::ustring> ColorProfile::getProfileDirs() { } // On OS X: - if ( g_file_test("/Library/ColorSync/Profiles", G_FILE_TEST_EXISTS) && g_file_test("/Library/ColorSync/Profiles", G_FILE_TEST_IS_DIR) ) { - sources.push_back("/Library/ColorSync/Profiles"); - - gchar* path = g_build_filename(g_get_home_dir(), "Library", "ColorSync", "Profiles", NULL); - if ( g_file_test(path, G_FILE_TEST_EXISTS) && g_file_test(path, G_FILE_TEST_IS_DIR) ) { - sources.push_back(path); + { + bool onOSX = false; + std::list<Glib::ustring> possible; + possible.push_back("/System/Library/ColorSync/Profiles"); + possible.push_back("/Library/ColorSync/Profiles"); + for ( std::list<Glib::ustring>::const_iterator it = possible.begin(); it != possible.end(); ++it ) { + if ( g_file_test(it->c_str(), G_FILE_TEST_EXISTS) && g_file_test(it->c_str(), G_FILE_TEST_IS_DIR) ) { + sources.push_back(it->c_str()); + onOSX = true; + } + } + if ( onOSX ) { + gchar* path = g_build_filename(g_get_home_dir(), "Library", "ColorSync", "Profiles", NULL); + if ( g_file_test(path, G_FILE_TEST_EXISTS) && g_file_test(path, G_FILE_TEST_IS_DIR) ) { + sources.push_back(path); + } + g_free(path); } - g_free(path); } - #ifdef WIN32 wchar_t pathBuf[MAX_PATH + 1]; pathBuf[0] = 0; @@ -685,10 +700,38 @@ std::list<Glib::ustring> ColorProfile::getProfileDirs() { return sources; } -#if ENABLE_LCMS -static void findThings() { - std::list<Glib::ustring> sources = ColorProfile::getProfileDirs(); +static bool isIccFile( gchar const *filepath ) +{ + bool isIccFile = false; + struct stat st; + if ( g_stat(filepath, &st) == 0 && (st.st_size > 128) ) { + //0-3 == size + //36-39 == 'acsp' 0x61637370 + int fd = g_open( filepath, O_RDONLY, S_IRWXU); + if ( fd != -1 ) { + guchar scratch[40] = {0}; + size_t len = sizeof(scratch); + + //size_t left = 40; + ssize_t got = read(fd, scratch, len); + if ( got != -1 ) { + size_t calcSize = (scratch[0] << 24) | (scratch[1] << 16) | (scratch[2] << 8) | scratch[3]; + if ( calcSize > 128 && calcSize <= static_cast<size_t>(st.st_size) ) { + isIccFile = (scratch[36] == 'a') && (scratch[37] == 'c') && (scratch[38] == 's') && (scratch[39] == 'p'); + } + } + + close(fd); + } + } + return isIccFile; +} + +std::list<Glib::ustring> ColorProfile::getProfileFiles() +{ + std::list<Glib::ustring> files; + std::list<Glib::ustring> sources = ColorProfile::getBaseProfileDirs(); for ( std::list<Glib::ustring>::const_iterator it = sources.begin(); it != sources.end(); ++it ) { if ( g_file_test( it->c_str(), G_FILE_TEST_EXISTS ) && g_file_test( it->c_str(), G_FILE_TEST_IS_DIR ) ) { GError *err = 0; @@ -697,57 +740,49 @@ static void findThings() { if (dir) { for (gchar const *file = g_dir_read_name(dir); file != NULL; file = g_dir_read_name(dir)) { gchar *filepath = g_build_filename(it->c_str(), file, NULL); - - if ( g_file_test( filepath, G_FILE_TEST_IS_DIR ) ) { sources.push_back(g_strdup(filepath)); } else { - bool isIccFile = false; - struct stat st; - if ( g_stat(filepath, &st) == 0 && (st.st_size > 128) ) { - //0-3 == size - //36-39 == 'acsp' 0x61637370 - int fd = g_open( filepath, O_RDONLY, S_IRWXU); - if ( fd != -1 ) { - guchar scratch[40] = {0}; - size_t len = sizeof(scratch); - - //size_t left = 40; - ssize_t got = read(fd, scratch, len); - if ( got != -1 ) { - size_t calcSize = (scratch[0] << 24) | (scratch[1] << 16) | (scratch[2] << 8) | scratch[3]; - if ( calcSize > 128 && calcSize <= static_cast<size_t>(st.st_size) ) { - isIccFile = (scratch[36] == 'a') && (scratch[37] == 'c') && (scratch[38] == 's') && (scratch[39] == 'p'); - } - } - - close(fd); - } - } - - if ( isIccFile ) { - cmsHPROFILE prof = cmsOpenProfileFromFile( filepath, "r" ); - if ( prof ) { - ProfileInfo info( prof, Glib::filename_to_utf8( filepath ) ); - cmsCloseProfile( prof ); - - bool sameName = false; - for ( std::vector<ProfileInfo>::iterator it = knownProfiles.begin(); it != knownProfiles.end(); ++it ) { - if ( it->getName() == info.getName() ) { - sameName = true; - break; - } - } - - if ( !sameName ) { - knownProfiles.push_back(info); - } - } + if ( isIccFile( filepath ) ) { + files.push_back( filepath ); } } g_free(filepath); } + g_dir_close(dir); + dir = 0; + } else { + gchar *safeDir = Inkscape::IO::sanitizeString(it->c_str()); + g_warning(_("Color profiles directory (%s) is unavailable."), safeDir); + g_free(safeDir); + } + } + } + + return files; +} + +#if ENABLE_LCMS +static void findThings() { + std::list<Glib::ustring> files = ColorProfile::getProfileFiles(); + + for ( std::list<Glib::ustring>::const_iterator it = files.begin(); it != files.end(); ++it ) { + cmsHPROFILE prof = cmsOpenProfileFromFile( it->c_str(), "r" ); + if ( prof ) { + ProfileInfo info( prof, Glib::filename_to_utf8( it->c_str() ) ); + cmsCloseProfile( prof ); + + bool sameName = false; + for ( std::vector<ProfileInfo>::iterator it = knownProfiles.begin(); it != knownProfiles.end(); ++it ) { + if ( it->getName() == info.getName() ) { + sameName = true; + break; + } + } + + if ( !sameName ) { + knownProfiles.push_back(info); } } } @@ -1145,4 +1180,4 @@ cmsHTRANSFORM Inkscape::colorprofile_get_display_per( Glib::ustring const& id ) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/color-profile.h b/src/color-profile.h index 40d0d7698..e1dd298bd 100644 --- a/src/color-profile.h +++ b/src/color-profile.h @@ -33,7 +33,8 @@ struct ColorProfile : public SPObject { static GType getType(); static void classInit( ColorProfileClass *klass ); - static std::list<Glib::ustring> getProfileDirs(); + static std::list<Glib::ustring> getBaseProfileDirs(); + static std::list<Glib::ustring> getProfileFiles(); #if ENABLE_LCMS static cmsHPROFILE getSRGBProfile(); static cmsHPROFILE getNULLProfile(); @@ -91,4 +92,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/color.cpp b/src/color.cpp index ae1bfa05d..54af89ae5 100644 --- a/src/color.cpp +++ b/src/color.cpp @@ -452,4 +452,4 @@ sp_color_cmyk_to_rgb_floatv (float *rgb, float c, float m, float y, float k) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/common-context.cpp b/src/common-context.cpp index 2229f3a23..08bac0152 100644 --- a/src/common-context.cpp +++ b/src/common-context.cpp @@ -216,4 +216,4 @@ static gint sp_common_context_root_handler(SPEventContext *event_context, GdkEve fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/common-context.h b/src/common-context.h index 870649caa..416307d58 100644 --- a/src/common-context.h +++ b/src/common-context.h @@ -116,5 +116,5 @@ GType sp_common_context_get_type(void); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/conditions.cpp b/src/conditions.cpp index 4a18a6913..8d1770d6a 100644 --- a/src/conditions.cpp +++ b/src/conditions.cpp @@ -459,4 +459,4 @@ zu Zulu fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp index 88c84a84c..fe25fa418 100644 --- a/src/conn-avoid-ref.cpp +++ b/src/conn-avoid-ref.cpp @@ -28,6 +28,7 @@ #include "libavoid/router.h" #include "libavoid/connector.h" #include "libavoid/geomtypes.h" +#include "libavoid/shape.h" #include "xml/node.h" #include "document.h" #include "desktop.h" @@ -63,8 +64,8 @@ SPAvoidRef::~SPAvoidRef() const bool routerInstanceExists = (item->document->router != NULL); if (shapeRef && routerInstanceExists) { - Router *router = shapeRef->router(); - router->removeShape(shapeRef); + // Deleting the shapeRef will remove it completely from + // an existing Router instance. delete shapeRef; } shapeRef = NULL; @@ -329,7 +330,8 @@ void SPAvoidRef::handleSettingChange(void) { g_assert(shapeRef); - router->removeShape(shapeRef); + // Deleting the shapeRef will remove it completely from + // an existing Router instance. delete shapeRef; shapeRef = NULL; } @@ -388,8 +390,6 @@ Geom::Point SPAvoidRef::getConnectionPointPos(const int type, const int id) g_assert(item); Geom::Point pos; const Geom::Matrix& transform = sp_item_i2doc_affine(item); - // TODO investigate why this was asking for the active desktop: - SPDesktop *desktop = inkscape_active_desktop(); if ( type == ConnPointDefault ) { @@ -446,6 +446,12 @@ static std::vector<Geom::Point> approxCurveWithPoints(SPCurve *curve) { Geom::Path::const_iterator cit = pit->begin(); while (cit != pit->end()) + { + if (cit == pit->begin()) + { + poly_points.push_back(cit->initialPoint()); + } + if (dynamic_cast<Geom::CubicBezier const*>(&*cit)) { at += seg_size; @@ -462,6 +468,7 @@ static std::vector<Geom::Point> approxCurveWithPoints(SPCurve *curve) poly_points.push_back(cit->finalPoint()); ++cit; } + } ++pit; } return poly_points; @@ -520,7 +527,7 @@ static Avoid::Polygon avoid_item_poly(SPItem const *item) prev_parallel_hull_edge.origin(hull_edge.origin()+hull_edge.versor().ccw()*spacing); prev_parallel_hull_edge.versor(hull_edge.versor()); int hull_size = hull.boundary.size(); - for (int i = 0; i <= hull_size; ++i) + for (int i = 0; i < hull_size; ++i) { hull_edge.setBy2Points(hull[i], hull[i+1]); Geom::Line parallel_hull_edge; diff --git a/src/connector-context.cpp b/src/connector-context.cpp index b0e192190..adc54a1ae 100644 --- a/src/connector-context.cpp +++ b/src/connector-context.cpp @@ -768,7 +768,6 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const Geom::Point const event_dt = cc->desktop->w2d(event_w); SnapManager &m = cc->desktop->namedview->snap_manager; - m.setup(cc->desktop); switch (cc->state) { case SP_CONNECTOR_CONTEXT_STOP: @@ -790,7 +789,9 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const if (!found) { // This is the first point, so just snap it to the grid // as there's no other points to go off. + m.setup(cc->desktop); m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE); + m.unSetup(); } spcc_connector_set_initial_point(cc, p); @@ -802,7 +803,9 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const case SP_CONNECTOR_CONTEXT_DRAGGING: { // This is the second click of a connector creation. + m.setup(cc->desktop); m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE); + m.unSetup(); spcc_connector_set_subsequent_point(cc, p); spcc_connector_finish_segment(cc, p); @@ -942,7 +945,6 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons if ( cc->mode == SP_CONNECTOR_CONTEXT_DRAWING_MODE ) { SnapManager &m = dt->namedview->snap_manager; - m.setup(dt); switch (cc->state) { case SP_CONNECTOR_CONTEXT_DRAGGING: @@ -950,7 +952,9 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons gobble_motion_events(mevent.state); // This is movement during a connector creation. if ( cc->npoints > 0 ) { + m.setup(dt); m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE); + m.unSetup(); cc->selection->clear(); spcc_connector_set_subsequent_point(cc, p); ret = TRUE; @@ -962,7 +966,9 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons gobble_motion_events(GDK_BUTTON1_MASK); g_assert( SP_IS_PATH(cc->clickeditem)); + m.setup(dt); m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE); + m.unSetup(); // Update the hidden path Geom::Matrix i2d = sp_item_i2d_affine(cc->clickeditem); @@ -993,7 +999,9 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons break; default: if (!sp_event_context_knot_mouseover(cc)) { + m.setup(dt); m.preSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_OTHER_HANDLE)); + m.unSetup(); } break; } @@ -1028,7 +1036,6 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con SPDocument *doc = sp_desktop_document(desktop); SnapManager &m = desktop->namedview->snap_manager; - m.setup(desktop); Geom::Point const event_w(revent.x, revent.y); @@ -1040,7 +1047,9 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con //case SP_CONNECTOR_CONTEXT_POINT: case SP_CONNECTOR_CONTEXT_DRAGGING: { + m.setup(desktop); m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE); + m.unSetup(); if (cc->within_tolerance) { @@ -1061,7 +1070,9 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con } case SP_CONNECTOR_CONTEXT_REROUTING: { + m.setup(desktop); m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE); + m.unSetup(); cc_connector_rerouting_finish(cc, &p); sp_document_ensure_up_to_date(doc); @@ -1085,7 +1096,9 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con if (!cc->within_tolerance) { + m.setup(desktop); m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE); + m.unSetup(); sp_knot_set_position(cc->selected_handle, p, 0); ConnectionPoint& cp = cc->connpthandles[cc->selected_handle]; cp.pos = p * sp_item_dt2i_affine(cc->active_shape); @@ -1098,7 +1111,9 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con case SP_CONNECTOR_CONTEXT_NEWCONNPOINT: + m.setup(desktop); m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE); + m.unSetup(); sp_knot_set_position(cc->selected_handle, p, 0); @@ -1193,15 +1208,15 @@ connector_handle_key_press(SPConnectorContext *const cc, guint const keyval) { // Put connection point at current position - SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc); - SnapManager &m = desktop->namedview->snap_manager; - m.setup(desktop); Geom::Point p = cc->selected_handle->pos; -// SPEventContext* event_context = SP_EVENT_CONTEXT( cc ); if (!cc->within_tolerance) { + SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc); + SnapManager &m = desktop->namedview->snap_manager; + m.setup(desktop); m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE); + m.unSetup(); sp_knot_set_position(cc->selected_handle, p, 0); ConnectionPoint& cp = cc->connpthandles[cc->selected_handle]; cp.pos = p * sp_item_dt2i_affine(cc->active_shape); @@ -1228,9 +1243,8 @@ connector_handle_key_press(SPConnectorContext *const cc, guint const keyval) SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop); Geom::Point p = cc->selected_handle->pos; - m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE); - + m.unSetup(); sp_knot_set_position(cc->selected_handle, p, 0); ConnectionPoint cp; @@ -1756,12 +1770,22 @@ cc_set_active_conn(SPConnectorContext *cc, SPItem *item) if (cc->active_conn == item) { - // Just adjust handle positions. - Geom::Point startpt = *(curve->first_point()) * i2d; - sp_knot_set_position(cc->endpt_handle[0], startpt, 0); + if (curve->is_empty()) + { + // Connector is invisible because it is clipped to the boundary of + // two overlpapping shapes. + sp_knot_hide(cc->endpt_handle[0]); + sp_knot_hide(cc->endpt_handle[1]); + } + else + { + // Just adjust handle positions. + Geom::Point startpt = *(curve->first_point()) * i2d; + sp_knot_set_position(cc->endpt_handle[0], startpt, 0); - Geom::Point endpt = *(curve->last_point()) * i2d; - sp_knot_set_position(cc->endpt_handle[1], endpt, 0); + Geom::Point endpt = *(curve->last_point()) * i2d; + sp_knot_set_position(cc->endpt_handle[1], endpt, 0); + } return; } @@ -1824,6 +1848,13 @@ cc_set_active_conn(SPConnectorContext *cc, SPItem *item) G_CALLBACK(endpt_handler), cc); } + if (curve->is_empty()) + { + // Connector is invisible because it is clipped to the boundary + // of two overlpapping shapes. So, it doesn't need endpoints. + return; + } + Geom::Point startpt = *(curve->first_point()) * i2d; sp_knot_set_position(cc->endpt_handle[0], startpt, 0); @@ -1887,8 +1918,10 @@ static bool cc_item_is_shape(SPItem *item) bool cc_item_is_connector(SPItem *item) { if (SP_IS_PATH(item)) { - if (SP_PATH(item)->connEndPair.isAutoRoutingConn()) { - g_assert( SP_PATH(item)->original_curve ? !(SP_PATH(item)->original_curve->is_closed()) : !(SP_PATH(item)->curve->is_closed()) ); + bool closed = SP_PATH(item)->original_curve ? SP_PATH(item)->original_curve->is_closed() : SP_PATH(item)->curve->is_closed(); + if (SP_PATH(item)->connEndPair.isAutoRoutingConn() && !closed) { + // To be considered a connector, an object must be a non-closed + // path that is marked with a "inkscape:connector-type" attribute. return true; } } @@ -2019,4 +2052,4 @@ shape_event_attr_changed(Inkscape::XML::Node *repr, gchar const *name, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/connector-context.h b/src/connector-context.h index bd3805e96..036981f6f 100644 --- a/src/connector-context.h +++ b/src/connector-context.h @@ -130,4 +130,4 @@ bool cc_item_is_connector(SPItem *item); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/console-output-undo-observer.cpp b/src/console-output-undo-observer.cpp index 84d8af3a8..18782c163 100644 --- a/src/console-output-undo-observer.cpp +++ b/src/console-output-undo-observer.cpp @@ -57,4 +57,4 @@ ConsoleOutputUndoObserver::notifyClearRedoEvent() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/console-output-undo-observer.h b/src/console-output-undo-observer.h index 9b42cf033..f7d1c7d29 100644 --- a/src/console-output-undo-observer.h +++ b/src/console-output-undo-observer.h @@ -42,4 +42,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/context-fns.cpp b/src/context-fns.cpp index b22cd488d..81eb6fdb5 100644 --- a/src/context-fns.cpp +++ b/src/context-fns.cpp @@ -209,6 +209,8 @@ Geom::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item p[0] *= desktop->dt2doc(); p[1] *= desktop->dt2doc(); + m.unSetup(); + return Geom::Rect(Geom::Point(MIN(p[0][Geom::X], p[1][Geom::X]), MIN(p[0][Geom::Y], p[1][Geom::Y])), Geom::Point(MAX(p[0][Geom::X], p[1][Geom::X]), MAX(p[0][Geom::Y], p[1][Geom::Y]))); } @@ -236,4 +238,4 @@ Geom::Point Inkscape::setup_for_drag_start(SPDesktop *desktop, SPEventContext* e fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/context-fns.h b/src/context-fns.h index 794f16c39..be8b4dfd5 100644 --- a/src/context-fns.h +++ b/src/context-fns.h @@ -44,4 +44,4 @@ Geom::Point setup_for_drag_start(SPDesktop *desktop, SPEventContext* ec, GdkEven fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/debug/demangle.cpp b/src/debug/demangle.cpp index 0da7cfd63..2b00fb8e9 100644 --- a/src/debug/demangle.cpp +++ b/src/debug/demangle.cpp @@ -77,4 +77,4 @@ Util::ptr_shared<char> demangle(char const *name) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/debug/demangle.h b/src/debug/demangle.h index 8c0dd6b4e..7505d9550 100644 --- a/src/debug/demangle.h +++ b/src/debug/demangle.h @@ -34,4 +34,4 @@ Util::ptr_shared<char> demangle(char const *name); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/debug/event-tracker.h b/src/debug/event-tracker.h index 89180d8d4..fe2069a29 100644 --- a/src/debug/event-tracker.h +++ b/src/debug/event-tracker.h @@ -221,4 +221,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/debug/event.h b/src/debug/event.h index ad56751fc..1cdd4f7e2 100644 --- a/src/debug/event.h +++ b/src/debug/event.h @@ -77,4 +77,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/debug/gc-heap.h b/src/debug/gc-heap.h index 4d0343f12..957f2067a 100644 --- a/src/debug/gc-heap.h +++ b/src/debug/gc-heap.h @@ -49,4 +49,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/debug/gdk-event-latency-tracker.cpp b/src/debug/gdk-event-latency-tracker.cpp index a6baae8da..b21675f53 100644 --- a/src/debug/gdk-event-latency-tracker.cpp +++ b/src/debug/gdk-event-latency-tracker.cpp @@ -75,4 +75,4 @@ GdkEventLatencyTracker &GdkEventLatencyTracker::default_tracker() { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/debug/gdk-event-latency-tracker.h b/src/debug/gdk-event-latency-tracker.h index 5a05baf48..12ebb6570 100644 --- a/src/debug/gdk-event-latency-tracker.h +++ b/src/debug/gdk-event-latency-tracker.h @@ -53,4 +53,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/debug/heap.cpp b/src/debug/heap.cpp index c0452f26b..8e7a920ba 100644 --- a/src/debug/heap.cpp +++ b/src/debug/heap.cpp @@ -62,4 +62,4 @@ void register_extra_heap(Heap &heap) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/debug/heap.h b/src/debug/heap.h index f3cc250a5..e1e01f022 100644 --- a/src/debug/heap.h +++ b/src/debug/heap.h @@ -60,4 +60,4 @@ void register_extra_heap(Heap &heap); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/debug/log-display-config.cpp b/src/debug/log-display-config.cpp index 0aeb71cf9..d2821cc53 100644 --- a/src/debug/log-display-config.cpp +++ b/src/debug/log-display-config.cpp @@ -86,4 +86,4 @@ void log_display_config() { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/debug/log-display-config.h b/src/debug/log-display-config.h index ae64b0836..6a598ac0f 100644 --- a/src/debug/log-display-config.h +++ b/src/debug/log-display-config.h @@ -34,4 +34,4 @@ void log_display_config(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/debug/logger.cpp b/src/debug/logger.cpp index f28d2750b..bc761d67e 100644 --- a/src/debug/logger.cpp +++ b/src/debug/logger.cpp @@ -225,4 +225,4 @@ void Logger::shutdown() { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/debug/logger.h b/src/debug/logger.h index 1513c0ac6..b5970e1ba 100644 --- a/src/debug/logger.h +++ b/src/debug/logger.h @@ -243,4 +243,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/debug/simple-event.h b/src/debug/simple-event.h index 74301a609..d09358224 100644 --- a/src/debug/simple-event.h +++ b/src/debug/simple-event.h @@ -96,4 +96,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/debug/sysv-heap.cpp b/src/debug/sysv-heap.cpp index 9ca6ea549..5cc06d619 100644 --- a/src/debug/sysv-heap.cpp +++ b/src/debug/sysv-heap.cpp @@ -76,4 +76,4 @@ Heap::Stats SysVHeap::stats() const { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/debug/sysv-heap.h b/src/debug/sysv-heap.h index 82fe9b769..ba8f5db83 100644 --- a/src/debug/sysv-heap.h +++ b/src/debug/sysv-heap.h @@ -44,4 +44,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/debug/timestamp.cpp b/src/debug/timestamp.cpp index 8814f37ad..4c014e965 100644 --- a/src/debug/timestamp.cpp +++ b/src/debug/timestamp.cpp @@ -42,4 +42,4 @@ Util::ptr_shared<char> timestamp() { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/debug/timestamp.h b/src/debug/timestamp.h index 31eac35fd..336ed5d0f 100644 --- a/src/debug/timestamp.h +++ b/src/debug/timestamp.h @@ -34,4 +34,4 @@ Util::ptr_shared<char> timestamp(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp index bb22b0faa..f7697a6c0 100644 --- a/src/desktop-events.cpp +++ b/src/desktop-events.cpp @@ -150,6 +150,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge // Because the guide snapper only looks in the document for guides to snap to, // we don't have to worry about a guide snapping to itself here m.guideFreeSnap(event_dt, normal, SP_DRAG_MOVE_ORIGIN); + m.unSetup(); } sp_guideline_set_position(SP_GUIDELINE(guide), from_2geom(event_dt)); @@ -172,6 +173,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge // Because the guide snapper only looks in the document for guides to snap to, // we don't have to worry about a guide snapping to itself here m.guideFreeSnap(event_dt, normal, SP_DRAG_MOVE_ORIGIN); + m.unSetup(); } dragging = false; @@ -297,9 +299,10 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) m.guideConstrainedSnap(motion_dt, *guide); } } else if (!((drag_type == SP_DRAG_ROTATE) && (event->motion.state & GDK_CONTROL_MASK))) { - // cannot use shift here to disable snapping, because we already use it for rotating the guide - m.guideFreeSnap(motion_dt, guide->normal_to_line, drag_type); + // cannot use shift here to disable snapping, because we already use it for rotating the guide + m.guideFreeSnap(motion_dt, guide->normal_to_line, drag_type); } + m.unSetup(); switch (drag_type) { case SP_DRAG_TRANSLATE: @@ -361,9 +364,10 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) m.guideConstrainedSnap(event_dt, *guide); } } else if (!((drag_type == SP_DRAG_ROTATE) && (event->motion.state & GDK_CONTROL_MASK))) { - // cannot use shift here to disable snapping, because we already use it for rotating the guide - m.guideFreeSnap(event_dt, guide->normal_to_line, drag_type); + // cannot use shift here to disable snapping, because we already use it for rotating the guide + m.guideFreeSnap(event_dt, guide->normal_to_line, drag_type); } + m.unSetup(); if (sp_canvas_world_pt_inside_window(item->canvas, event_w)) { switch (drag_type) { @@ -617,5 +621,5 @@ void snoop_extended(GdkEvent* event, SPDesktop *desktop) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/desktop-events.h b/src/desktop-events.h index 8ddff0949..e720cf7a0 100644 --- a/src/desktop-events.h +++ b/src/desktop-events.h @@ -51,4 +51,4 @@ gint sp_dt_guide_event (SPCanvasItem *item, GdkEvent *event, gpointer data); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/desktop-handles.h b/src/desktop-handles.h index a8d0a3d1e..61ea43d1e 100644 --- a/src/desktop-handles.h +++ b/src/desktop-handles.h @@ -54,4 +54,4 @@ SPNamedView * sp_desktop_namedview (SPDesktop const * desktop); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 55345ee8a..75b2f8eca 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -41,6 +41,7 @@ #include "xml/repr.h" #include "libnrtype/font-style-to-pos.h" #include "sp-path.h" +#include "event-context.h" #include "desktop-style.h" #include "svg/svg-icc-color.h" @@ -195,6 +196,10 @@ sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change, bool write // 3. If nobody has intercepted the signal, apply the style to the selection if (!intercepted) { + // If we have an event context, update its cursor (TODO: it could be neater to do this with the signal sent above, but what if the signal gets intercepted?) + if (desktop->event_context) { + sp_event_context_update_cursor(desktop->event_context); + } // Remove text attributes if not text... // Do this once in case a zillion objects are selected. diff --git a/src/desktop-style.h b/src/desktop-style.h index e1ca5b3e7..6aa685a36 100644 --- a/src/desktop-style.h +++ b/src/desktop-style.h @@ -95,4 +95,4 @@ bool sp_desktop_query_style_all (SPDesktop *desktop, SPStyle *query); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/desktop.cpp b/src/desktop.cpp index 692cc4112..c98a974a8 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -636,9 +636,15 @@ SPDesktop::set_event_context (GtkType type, const gchar *config) event_context = next; } + // The event_context will be null. This means that it will be impossible + // to process any event invoked by the lines below. See for example bug + // LP #622350. Cutting and undoing again in the node tool resets the event + // context to the node tool. In this bug the line bellow invokes GDK_LEAVE_NOTIFY + // events which cannot be handled and must be discarded. ec = sp_event_context_new (type, this, config, SP_EVENT_CONTEXT_STATIC); ec->next = event_context; event_context = ec; + // Now the event_context has been set again and we can process all events again sp_event_context_activate (ec); _event_context_changed_signal.emit (this, ec); } @@ -1367,7 +1373,7 @@ SPDesktop::emitToolSubselectionChanged(gpointer data) void SPDesktop::updateNow() { - sp_canvas_update_now(canvas); + sp_canvas_update_now(canvas); } void @@ -1810,4 +1816,4 @@ Geom::Point SPDesktop::dt2doc(Geom::Point const &p) const fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/device-manager.cpp b/src/device-manager.cpp index 62e0c2545..2b44a8d51 100644 --- a/src/device-manager.cpp +++ b/src/device-manager.cpp @@ -690,4 +690,4 @@ static void createFakeList() { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/device-manager.h b/src/device-manager.h index 4aea99ac0..5f83ab7b0 100644 --- a/src/device-manager.h +++ b/src/device-manager.h @@ -84,4 +84,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index 24a1682fe..c89a92ead 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -16,8 +16,6 @@ #include <gtk/gtk.h> #include <glibmm/i18n.h> -#include "application/application.h" -#include "application/editor.h" #include "desktop.h" #include "desktop-handles.h" #include "dialog-events.h" @@ -84,15 +82,7 @@ static Inkscape::UI::Widget::ColorPicker *color_picker; static void clonetiler_dialog_destroy( GtkObject */*object*/, gpointer /*data*/ ) { - if (Inkscape::NSApplication::Application::getNewGui()) - { - _shutdown_connection.disconnect(); - _dialogs_hidden_connection.disconnect(); - _dialogs_unhidden_connection.disconnect(); - _desktop_activated_connection.disconnect(); - } else { - sp_signal_disconnect_by_data (INKSCAPE, dlg); - } + sp_signal_disconnect_by_data (INKSCAPE, dlg); _color_changed_connection.disconnect(); delete color_picker; @@ -1826,18 +1816,10 @@ clonetiler_dialog (void) gtk_signal_connect ( GTK_OBJECT (dlg), "destroy", G_CALLBACK (clonetiler_dialog_destroy), dlg); gtk_signal_connect ( GTK_OBJECT (dlg), "delete_event", G_CALLBACK (clonetiler_dialog_delete), dlg); - if (Inkscape::NSApplication::Application::getNewGui()) - { - _shutdown_connection = Inkscape::NSApplication::Editor::connectShutdown (&on_delete); - _dialogs_hidden_connection = Inkscape::NSApplication::Editor::connectDialogsHidden (sigc::bind (&on_dialog_hide, dlg)); - _dialogs_unhidden_connection = Inkscape::NSApplication::Editor::connectDialogsUnhidden (sigc::bind (&on_dialog_unhide, dlg)); - _desktop_activated_connection = Inkscape::NSApplication::Editor::connectDesktopActivated (sigc::bind (&on_transientize, &wd)); - } else { - g_signal_connect ( G_OBJECT (INKSCAPE), "shut_down", G_CALLBACK (clonetiler_dialog_delete), dlg); - g_signal_connect ( G_OBJECT (INKSCAPE), "dialogs_hide", G_CALLBACK (sp_dialog_hide), dlg); - g_signal_connect ( G_OBJECT (INKSCAPE), "dialogs_unhide", G_CALLBACK (sp_dialog_unhide), dlg); - g_signal_connect ( G_OBJECT (INKSCAPE), "activate_desktop", G_CALLBACK (sp_transientize_callback), &wd); - } + g_signal_connect ( G_OBJECT (INKSCAPE), "shut_down", G_CALLBACK (clonetiler_dialog_delete), dlg); + g_signal_connect ( G_OBJECT (INKSCAPE), "dialogs_hide", G_CALLBACK (sp_dialog_hide), dlg); + g_signal_connect ( G_OBJECT (INKSCAPE), "dialogs_unhide", G_CALLBACK (sp_dialog_unhide), dlg); + g_signal_connect ( G_OBJECT (INKSCAPE), "activate_desktop", G_CALLBACK (sp_transientize_callback), &wd); GtkTooltips *tt = gtk_tooltips_new(); @@ -2610,9 +2592,7 @@ clonetiler_dialog (void) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_B); } { - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), Q_("clonetiler|H")); + radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color hue", "H")); gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), radio, _("Pick the hue of the color"), NULL); clonetiler_table_attach (table, radio, 0.0, 1, 3); gtk_signal_connect (GTK_OBJECT (radio), "toggled", @@ -2620,9 +2600,7 @@ clonetiler_dialog (void) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_H); } { - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), Q_("clonetiler|S")); + radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color saturation", "S")); gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), radio, _("Pick the saturation of the color"), NULL); clonetiler_table_attach (table, radio, 0.0, 2, 3); gtk_signal_connect (GTK_OBJECT (radio), "toggled", @@ -2630,9 +2608,7 @@ clonetiler_dialog (void) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_S); } { - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), Q_("clonetiler|L")); + radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color lightness", "L")); gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), radio, _("Pick the lightness of the color"), NULL); clonetiler_table_attach (table, radio, 0.0, 3, 3); gtk_signal_connect (GTK_OBJECT (radio), "toggled", @@ -2967,4 +2943,4 @@ clonetiler_dialog (void) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dialogs/clonetiler.h b/src/dialogs/clonetiler.h index 6bfb257a4..bfb35cd96 100644 --- a/src/dialogs/clonetiler.h +++ b/src/dialogs/clonetiler.h @@ -27,4 +27,4 @@ void clonetiler_dialog ( void ); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dialogs/dialog-events.cpp b/src/dialogs/dialog-events.cpp index b5992ab5c..89feca23e 100644 --- a/src/dialogs/dialog-events.cpp +++ b/src/dialogs/dialog-events.cpp @@ -256,4 +256,4 @@ sp_dialog_unhide (GtkObject */*object*/, gpointer data) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dialogs/dialog-events.h b/src/dialogs/dialog-events.h index 2fca84ad2..7b04d0f69 100644 --- a/src/dialogs/dialog-events.h +++ b/src/dialogs/dialog-events.h @@ -72,4 +72,4 @@ gboolean sp_dialog_unhide (GtkObject *object, gpointer data); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp index 696f38b77..82e2d45e1 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -2054,4 +2054,4 @@ sp_export_filename_modified (GtkObject * object, gpointer data) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dialogs/export.h b/src/dialogs/export.h index 801ddc91a..d4ea17c1d 100644 --- a/src/dialogs/export.h +++ b/src/dialogs/export.h @@ -32,4 +32,4 @@ void sp_export_dialog (void); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dialogs/find.cpp b/src/dialogs/find.cpp index ed693f6ed..a3612f60e 100644 --- a/src/dialogs/find.cpp +++ b/src/dialogs/find.cpp @@ -606,10 +606,8 @@ sp_find_types () { GtkWidget *c = sp_find_types_checkbox_indented (vb, "clones", TRUE, tt, _("Search clones"), - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - // "Clones" is a noun indicating type of object to find - Q_("find|Clones"), NULL, 10); + //TRANSLATORS: "Clones" is a noun indicating type of object to find + C_("Find dialog","Clones"), NULL, 10); gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0); } @@ -684,10 +682,10 @@ sp_find_dialog_old (void) GtkWidget *vb = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (dlg), vb); - sp_find_new_searchfield (dlg, vb, _("_Text: "), "text", tt, _("Find objects by their text content (exact or partial match)")); - sp_find_new_searchfield (dlg, vb, _("_ID: "), "id", tt, _("Find objects by the value of the id attribute (exact or partial match)")); - sp_find_new_searchfield (dlg, vb, _("_Style: "), "style", tt, _("Find objects by the value of the style attribute (exact or partial match)")); - sp_find_new_searchfield (dlg, vb, _("_Attribute: "), "attr", tt ,_("Find objects by the name of an attribute (exact or partial match)")); + sp_find_new_searchfield (dlg, vb, _("_Text:"), "text", tt, _("Find objects by their text content (exact or partial match)")); + sp_find_new_searchfield (dlg, vb, _("_ID:"), "id", tt, _("Find objects by the value of the id attribute (exact or partial match)")); + sp_find_new_searchfield (dlg, vb, _("_Style:"), "style", tt, _("Find objects by the value of the style attribute (exact or partial match)")); + sp_find_new_searchfield (dlg, vb, _("_Attribute:"), "attr", tt ,_("Find objects by the name of an attribute (exact or partial match)")); gtk_widget_show_all (vb); @@ -765,4 +763,4 @@ sp_find_dialog_old (void) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dialogs/item-properties.cpp b/src/dialogs/item-properties.cpp index abc45b44b..40665e08e 100644 --- a/src/dialogs/item-properties.cpp +++ b/src/dialogs/item-properties.cpp @@ -117,7 +117,7 @@ sp_item_widget_new (void) /* Create the label for the object id */ - l = gtk_label_new_with_mnemonic (_("_Id")); + l = gtk_label_new_with_mnemonic (_("_ID:")); gtk_misc_set_alignment (GTK_MISC (l), 1, 0.5); gtk_table_attach ( GTK_TABLE (t), l, 0, 1, 0, 1, (GtkAttachOptions)( GTK_SHRINK | GTK_FILL ), @@ -149,7 +149,7 @@ sp_item_widget_new (void) spw ); /* Create the label for the object label */ - l = gtk_label_new_with_mnemonic (_("_Label")); + l = gtk_label_new_with_mnemonic (_("_Label:")); gtk_misc_set_alignment (GTK_MISC (l), 1, 0.5); gtk_table_attach ( GTK_TABLE (t), l, 0, 1, 1, 2, (GtkAttachOptions)( GTK_SHRINK | GTK_FILL ), @@ -170,7 +170,7 @@ sp_item_widget_new (void) g_signal_connect ( G_OBJECT (tf), "activate", G_CALLBACK (sp_item_widget_label_changed), spw); /* Create the label for the object title */ - l = gtk_label_new_with_mnemonic (_("_Title")); + l = gtk_label_new_with_mnemonic (_("_Title:")); gtk_misc_set_alignment (GTK_MISC (l), 1, 0.5); gtk_table_attach ( GTK_TABLE (t), l, 0, 1, 2, 3, (GtkAttachOptions)( GTK_SHRINK | GTK_FILL ), @@ -331,7 +331,7 @@ sp_item_widget_setup ( SPWidget *spw, Inkscape::Selection *selection ) gtk_entry_set_text (GTK_ENTRY (w), obj->getId()); gtk_widget_set_sensitive (w, TRUE); w = GTK_WIDGET(gtk_object_get_data (GTK_OBJECT (spw), "id_label")); - gtk_label_set_markup_with_mnemonic (GTK_LABEL (w), _("_Id")); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (w), _("_ID:")); /* Label */ w = GTK_WIDGET(gtk_object_get_data (GTK_OBJECT (spw), "label")); @@ -440,14 +440,14 @@ sp_item_widget_label_changed( GtkWidget */*widget*/, SPWidget *spw ) g_strcanon (id, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.:", '_'); GtkWidget *id_label = GTK_WIDGET(gtk_object_get_data (GTK_OBJECT (spw), "id_label")); if (!strcmp (id, item->getId())) { - gtk_label_set_markup_with_mnemonic (GTK_LABEL (id_label), _("_Id")); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (id_label), _("_ID:")); } else if (!*id || !isalnum (*id)) { gtk_label_set_text (GTK_LABEL (id_label), _("Id invalid! ")); } else if (SP_ACTIVE_DOCUMENT->getObjectById(id) != NULL) { gtk_label_set_text (GTK_LABEL (id_label), _("Id exists! ")); } else { SPException ex; - gtk_label_set_markup_with_mnemonic (GTK_LABEL (id_label), _("_Id")); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (id_label), _("_ID:")); SP_EXCEPTION_INIT (&ex); sp_object_setAttribute (SP_OBJECT (item), "id", id, &ex); sp_document_done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM, @@ -560,4 +560,4 @@ sp_item_dialog (void) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dialogs/item-properties.h b/src/dialogs/item-properties.h index 9815a1fc5..bc04608bc 100644 --- a/src/dialogs/item-properties.h +++ b/src/dialogs/item-properties.h @@ -30,4 +30,4 @@ void sp_item_dialog (void); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dialogs/object-attributes.cpp b/src/dialogs/object-attributes.cpp index 320840f76..d9a0545e1 100644 --- a/src/dialogs/object-attributes.cpp +++ b/src/dialogs/object-attributes.cpp @@ -103,7 +103,14 @@ sp_object_attr_show_dialog ( SPObject *object, attrs[i] = desc[i].attribute; } - title = g_strdup_printf (_("%s Properties"), tag); + if (!strcmp (tag, "Link")) { + title = g_strdup_printf (_("Link Properties")); + } else if (!strcmp (tag, "Image")) { + title = g_strdup_printf (_("Image Properties")); + } else { + title = g_strdup_printf (_("%s Properties"), tag); + } + w = sp_window_new (title, TRUE); g_free (title); @@ -153,4 +160,4 @@ sp_object_attributes_dialog (SPObject *object, const gchar *tag) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dialogs/object-attributes.h b/src/dialogs/object-attributes.h index 726d8e43b..ef84708c0 100644 --- a/src/dialogs/object-attributes.h +++ b/src/dialogs/object-attributes.h @@ -29,4 +29,4 @@ void sp_object_attributes_dialog (SPObject *object, const gchar *tag); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dialogs/spellcheck.cpp b/src/dialogs/spellcheck.cpp index 1645218c6..476a551f1 100644 --- a/src/dialogs/spellcheck.cpp +++ b/src/dialogs/spellcheck.cpp @@ -1031,4 +1031,4 @@ void sp_spellcheck_dialog (void) {} fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dialogs/text-edit.cpp b/src/dialogs/text-edit.cpp index 957a3c63c..570265825 100644 --- a/src/dialogs/text-edit.cpp +++ b/src/dialogs/text-edit.cpp @@ -1004,4 +1004,4 @@ sp_ted_get_selected_text_count (void) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dialogs/text-edit.h b/src/dialogs/text-edit.h index 1e5cdc77d..84f914728 100644 --- a/src/dialogs/text-edit.h +++ b/src/dialogs/text-edit.h @@ -28,4 +28,4 @@ void sp_text_edit_dialog_default_set_insensitive (); //FIXME: Replace trough a v fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dialogs/xml-tree.cpp b/src/dialogs/xml-tree.cpp index c8644fef9..bd442b887 100644 --- a/src/dialogs/xml-tree.cpp +++ b/src/dialogs/xml-tree.cpp @@ -1609,4 +1609,4 @@ bool in_dt_coordsys(SPObject const &item) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dialogs/xml-tree.h b/src/dialogs/xml-tree.h index 0edea8f4d..8b1a21337 100644 --- a/src/dialogs/xml-tree.h +++ b/src/dialogs/xml-tree.h @@ -26,4 +26,4 @@ void sp_xml_tree_dialog (void); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dir-util-test.h b/src/dir-util-test.h index e2f0f8ed8..8f8475873 100644 --- a/src/dir-util-test.h +++ b/src/dir-util-test.h @@ -45,4 +45,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dir-util.h b/src/dir-util.h index 9bdfafa9e..7d04b3007 100644 --- a/src/dir-util.h +++ b/src/dir-util.h @@ -30,4 +30,4 @@ gchar *prepend_current_dir_if_relative(gchar const *filename); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/canvas-arena.cpp b/src/display/canvas-arena.cpp index ac5e68379..c681ea5a0 100644 --- a/src/display/canvas-arena.cpp +++ b/src/display/canvas-arena.cpp @@ -380,4 +380,4 @@ sp_canvas_arena_render_surface (SPCanvasArena *ca, cairo_surface_t *surface, NRR fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index 00a577635..c4fdb2452 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -786,4 +786,4 @@ bool CanvasAxonomGridSnapper::ThisSnapperMightSnap() const fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/canvas-bpath.cpp b/src/display/canvas-bpath.cpp index bd24881f7..082e6d44e 100644 --- a/src/display/canvas-bpath.cpp +++ b/src/display/canvas-bpath.cpp @@ -267,4 +267,4 @@ sp_canvas_bpath_set_stroke (SPCanvasBPath *cbp, guint32 rgba, gdouble width, SPS fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/canvas-bpath.h b/src/display/canvas-bpath.h index b97bbcc6b..65ad4aa00 100644 --- a/src/display/canvas-bpath.h +++ b/src/display/canvas-bpath.h @@ -106,4 +106,4 @@ void sp_canvas_bpath_set_stroke (SPCanvasBPath *cbp, guint32 rgba, gdouble width fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index b04dc4483..6c51acea8 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -1080,4 +1080,4 @@ bool CanvasXYGridSnapper::ThisSnapperMightSnap() const fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/canvas-text.cpp b/src/display/canvas-text.cpp index ab49d1fe3..682b15eb8 100644 --- a/src/display/canvas-text.cpp +++ b/src/display/canvas-text.cpp @@ -266,4 +266,4 @@ sp_canvastext_set_anchor (SPCanvasText *ct, double anchor_x, double anchor_y) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/curve-test.h b/src/display/curve-test.h index 784ccee89..d89cb4c99 100644 --- a/src/display/curve-test.h +++ b/src/display/curve-test.h @@ -257,4 +257,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/curve.cpp b/src/display/curve.cpp index 73b8dc36d..303d1bb4d 100644 --- a/src/display/curve.cpp +++ b/src/display/curve.cpp @@ -687,4 +687,4 @@ SPCurve::last_point_additive_move(Geom::Point const & p) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/curve.h b/src/display/curve.h index fe0720195..e6387a9f0 100644 --- a/src/display/curve.h +++ b/src/display/curve.h @@ -101,4 +101,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/guideline.cpp b/src/display/guideline.cpp index 6a9bebe1e..75c201d78 100644 --- a/src/display/guideline.cpp +++ b/src/display/guideline.cpp @@ -270,4 +270,4 @@ sp_guideline_drawline (SPCanvasBuf *buf, gint x0, gint y0, gint x1, gint y1, gui fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-3dutils.cpp b/src/display/nr-3dutils.cpp index 1d92d3ec9..4518269af 100644 --- a/src/display/nr-3dutils.cpp +++ b/src/display/nr-3dutils.cpp @@ -62,4 +62,4 @@ void normalized_sum(Fvector &r, const Fvector &a, const Fvector &b) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-3dutils.h b/src/display/nr-3dutils.h index 9a198a73d..5651b2246 100644 --- a/src/display/nr-3dutils.h +++ b/src/display/nr-3dutils.h @@ -104,4 +104,4 @@ void convert_coord(gdouble &x, gdouble &y, gdouble &z, Geom::Matrix const &trans fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-arena-forward.h b/src/display/nr-arena-forward.h index 67f62a78b..5a5cf228a 100644 --- a/src/display/nr-arena-forward.h +++ b/src/display/nr-arena-forward.h @@ -48,4 +48,4 @@ struct NRArenaGlyphsGroupClass; fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-arena-glyphs.cpp b/src/display/nr-arena-glyphs.cpp index a56b37406..571f777fe 100644 --- a/src/display/nr-arena-glyphs.cpp +++ b/src/display/nr-arena-glyphs.cpp @@ -461,4 +461,4 @@ nr_arena_glyphs_group_set_paintbox(NRArenaGlyphsGroup *gg, NRRect const *pbox) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-arena-group.cpp b/src/display/nr-arena-group.cpp index 3bc78ea56..7ad24bf70 100644 --- a/src/display/nr-arena-group.cpp +++ b/src/display/nr-arena-group.cpp @@ -296,4 +296,4 @@ void nr_arena_group_set_child_transform(NRArenaGroup *group, Geom::Matrix const fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-arena-group.h b/src/display/nr-arena-group.h index ae1763e99..4579d068f 100644 --- a/src/display/nr-arena-group.h +++ b/src/display/nr-arena-group.h @@ -58,4 +58,4 @@ void nr_arena_group_set_style(NRArenaGroup *group, SPStyle *style); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-arena-image.cpp b/src/display/nr-arena-image.cpp index fd75c8ff6..9913fd08a 100644 --- a/src/display/nr-arena-image.cpp +++ b/src/display/nr-arena-image.cpp @@ -406,4 +406,4 @@ void nr_arena_image_set_style (NRArenaImage *image, SPStyle *style) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-arena-image.h b/src/display/nr-arena-image.h index bde0d41bd..aaf7a5d59 100644 --- a/src/display/nr-arena-image.h +++ b/src/display/nr-arena-image.h @@ -63,4 +63,4 @@ void nr_arena_image_set_scale (NRArenaImage *image, double sx, double sy); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-arena-item.cpp b/src/display/nr-arena-item.cpp index 91c4391f6..e6b98e78e 100644 --- a/src/display/nr-arena-item.cpp +++ b/src/display/nr-arena-item.cpp @@ -840,4 +840,4 @@ nr_arena_item_detach (NRArenaItem *parent, NRArenaItem *child) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-arena-item.h b/src/display/nr-arena-item.h index 6aa7f9752..1497987ba 100644 --- a/src/display/nr-arena-item.h +++ b/src/display/nr-arena-item.h @@ -195,4 +195,4 @@ NRArenaItem *nr_arena_item_detach (NRArenaItem *parent, NRArenaItem *child); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp index a39e9e6fc..c687d3ca5 100644 --- a/src/display/nr-arena-shape.cpp +++ b/src/display/nr-arena-shape.cpp @@ -598,4 +598,4 @@ void NRArenaShape::setPaintBox(Geom::Rect const &pbox) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-arena-shape.h b/src/display/nr-arena-shape.h index 2e917bb46..2ee0d24c8 100644 --- a/src/display/nr-arena-shape.h +++ b/src/display/nr-arena-shape.h @@ -77,4 +77,4 @@ void nr_arena_shape_set_paintbox(NRArenaShape *shape, NRRect const *pbox); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-arena.cpp b/src/display/nr-arena.cpp index 1339786bd..1f7bd2591 100644 --- a/src/display/nr-arena.cpp +++ b/src/display/nr-arena.cpp @@ -178,4 +178,4 @@ void nr_arena_separate_color_plates(guint32* rgba){ fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-blend.cpp b/src/display/nr-filter-blend.cpp index d146dc46d..b5343d1d6 100644 --- a/src/display/nr-filter-blend.cpp +++ b/src/display/nr-filter-blend.cpp @@ -226,4 +226,4 @@ void FilterBlend::set_mode(FilterBlendMode mode) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-blend.h b/src/display/nr-filter-blend.h index 94c782156..0a2ba64d4 100644 --- a/src/display/nr-filter-blend.h +++ b/src/display/nr-filter-blend.h @@ -66,4 +66,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-colormatrix.cpp b/src/display/nr-filter-colormatrix.cpp index 7ab606182..1c2e3d85a 100644 --- a/src/display/nr-filter-colormatrix.cpp +++ b/src/display/nr-filter-colormatrix.cpp @@ -215,4 +215,4 @@ void FilterColorMatrix::set_values(std::vector<gdouble> const &v){ fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-colormatrix.h b/src/display/nr-filter-colormatrix.h index c95c84568..8e9b8a990 100644 --- a/src/display/nr-filter-colormatrix.h +++ b/src/display/nr-filter-colormatrix.h @@ -61,4 +61,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-component-transfer.cpp b/src/display/nr-filter-component-transfer.cpp index 05795d670..83f240307 100644 --- a/src/display/nr-filter-component-transfer.cpp +++ b/src/display/nr-filter-component-transfer.cpp @@ -320,4 +320,4 @@ void FilterComponentTransfer::area_enlarge(NRRectL &/*area*/, Geom::Matrix const fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-component-transfer.h b/src/display/nr-filter-component-transfer.h index 1e69deb15..b26aee917 100644 --- a/src/display/nr-filter-component-transfer.h +++ b/src/display/nr-filter-component-transfer.h @@ -61,4 +61,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-composite.cpp b/src/display/nr-filter-composite.cpp index de9905161..68700f792 100644 --- a/src/display/nr-filter-composite.cpp +++ b/src/display/nr-filter-composite.cpp @@ -152,4 +152,4 @@ void FilterComposite::set_arithmetic(double k1, double k2, double k3, double k4) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-composite.h b/src/display/nr-filter-composite.h index 192e79c69..828eb55b3 100644 --- a/src/display/nr-filter-composite.h +++ b/src/display/nr-filter-composite.h @@ -54,4 +54,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-convolve-matrix.cpp b/src/display/nr-filter-convolve-matrix.cpp index 44e3c2290..0a5ba16b0 100644 --- a/src/display/nr-filter-convolve-matrix.cpp +++ b/src/display/nr-filter-convolve-matrix.cpp @@ -224,4 +224,4 @@ void FilterConvolveMatrix::area_enlarge(NRRectL &area, Geom::Matrix const &/*tra fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-convolve-matrix.h b/src/display/nr-filter-convolve-matrix.h index d1fc9c364..4f314e4c3 100644 --- a/src/display/nr-filter-convolve-matrix.h +++ b/src/display/nr-filter-convolve-matrix.h @@ -70,4 +70,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-diffuselighting.cpp b/src/display/nr-filter-diffuselighting.cpp index fa925ceae..cc14bb165 100644 --- a/src/display/nr-filter-diffuselighting.cpp +++ b/src/display/nr-filter-diffuselighting.cpp @@ -183,4 +183,4 @@ void FilterDiffuseLighting::area_enlarge(NRRectL &area, Geom::Matrix const &tran fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-diffuselighting.h b/src/display/nr-filter-diffuselighting.h index 6e46bc1e1..1c17e8fe8 100644 --- a/src/display/nr-filter-diffuselighting.h +++ b/src/display/nr-filter-diffuselighting.h @@ -60,4 +60,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-displacement-map.cpp b/src/display/nr-filter-displacement-map.cpp index 15d590444..74b1b1dab 100644 --- a/src/display/nr-filter-displacement-map.cpp +++ b/src/display/nr-filter-displacement-map.cpp @@ -341,4 +341,4 @@ void FilterDisplacementMap::area_enlarge(NRRectL &area, Geom::Matrix const &tran fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-displacement-map.h b/src/display/nr-filter-displacement-map.h index 29f38d604..534fac620 100644 --- a/src/display/nr-filter-displacement-map.h +++ b/src/display/nr-filter-displacement-map.h @@ -53,4 +53,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-flood.cpp b/src/display/nr-filter-flood.cpp index f09738202..4e3952f9a 100644 --- a/src/display/nr-filter-flood.cpp +++ b/src/display/nr-filter-flood.cpp @@ -97,4 +97,4 @@ void FilterFlood::area_enlarge(NRRectL &/*area*/, Geom::Matrix const &/*trans*/) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-flood.h b/src/display/nr-filter-flood.h index 6f2e5b5d5..78b48302f 100644 --- a/src/display/nr-filter-flood.h +++ b/src/display/nr-filter-flood.h @@ -50,4 +50,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-gaussian.cpp b/src/display/nr-filter-gaussian.cpp index ba6f0bbe7..9bd9723cd 100644 --- a/src/display/nr-filter-gaussian.cpp +++ b/src/display/nr-filter-gaussian.cpp @@ -684,4 +684,4 @@ void FilterGaussian::set_deviation(double x, double y) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-gaussian.h b/src/display/nr-filter-gaussian.h index ebc0f8f52..cf3881ee3 100644 --- a/src/display/nr-filter-gaussian.h +++ b/src/display/nr-filter-gaussian.h @@ -77,4 +77,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-image.cpp b/src/display/nr-filter-image.cpp index 28b2aa5c1..eae25c8cd 100644 --- a/src/display/nr-filter-image.cpp +++ b/src/display/nr-filter-image.cpp @@ -237,4 +237,4 @@ void FilterImage::set_region(SVGLength x, SVGLength y, SVGLength width, SVGLengt fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-image.h b/src/display/nr-filter-image.h index a2aff0742..bd5cd525c 100644 --- a/src/display/nr-filter-image.h +++ b/src/display/nr-filter-image.h @@ -57,4 +57,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-merge.cpp b/src/display/nr-filter-merge.cpp index 406f74c9e..2129d7894 100644 --- a/src/display/nr-filter-merge.cpp +++ b/src/display/nr-filter-merge.cpp @@ -96,4 +96,4 @@ void FilterMerge::set_input(int input, int slot) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-merge.h b/src/display/nr-filter-merge.h index a7871641b..9c4204f07 100644 --- a/src/display/nr-filter-merge.h +++ b/src/display/nr-filter-merge.h @@ -47,4 +47,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-morphology.cpp b/src/display/nr-filter-morphology.cpp index 138674c27..9d3682fd6 100644 --- a/src/display/nr-filter-morphology.cpp +++ b/src/display/nr-filter-morphology.cpp @@ -182,4 +182,4 @@ void FilterMorphology::set_yradius(double y){ fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-morphology.h b/src/display/nr-filter-morphology.h index fe729c94d..48f43d61f 100644 --- a/src/display/nr-filter-morphology.h +++ b/src/display/nr-filter-morphology.h @@ -56,4 +56,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-offset.cpp b/src/display/nr-filter-offset.cpp index b44c5fac7..7b70398db 100644 --- a/src/display/nr-filter-offset.cpp +++ b/src/display/nr-filter-offset.cpp @@ -97,4 +97,4 @@ void FilterOffset::area_enlarge(NRRectL &area, Geom::Matrix const &trans) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-offset.h b/src/display/nr-filter-offset.h index 8404aa3d9..4a9e96789 100644 --- a/src/display/nr-filter-offset.h +++ b/src/display/nr-filter-offset.h @@ -50,4 +50,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-primitive.cpp b/src/display/nr-filter-primitive.cpp index c81afb874..2926b4960 100644 --- a/src/display/nr-filter-primitive.cpp +++ b/src/display/nr-filter-primitive.cpp @@ -77,4 +77,4 @@ FilterTraits FilterPrimitive::get_input_traits() { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-primitive.h b/src/display/nr-filter-primitive.h index 1205b1d30..06badffa6 100644 --- a/src/display/nr-filter-primitive.h +++ b/src/display/nr-filter-primitive.h @@ -152,4 +152,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-skeleton.cpp b/src/display/nr-filter-skeleton.cpp index d5adedad9..4924b8807 100644 --- a/src/display/nr-filter-skeleton.cpp +++ b/src/display/nr-filter-skeleton.cpp @@ -63,4 +63,4 @@ int FilterSkeleton::render(FilterSlot &slot, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-skeleton.h b/src/display/nr-filter-skeleton.h index dc69c95ed..a03004be1 100644 --- a/src/display/nr-filter-skeleton.h +++ b/src/display/nr-filter-skeleton.h @@ -56,4 +56,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-slot.cpp b/src/display/nr-filter-slot.cpp index c02f47b26..dafab20c8 100644 --- a/src/display/nr-filter-slot.cpp +++ b/src/display/nr-filter-slot.cpp @@ -249,4 +249,4 @@ int FilterSlot::get_blurquality(void) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-slot.h b/src/display/nr-filter-slot.h index 93c8e2fe2..f477b7b73 100644 --- a/src/display/nr-filter-slot.h +++ b/src/display/nr-filter-slot.h @@ -107,4 +107,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-specularlighting.cpp b/src/display/nr-filter-specularlighting.cpp index 8ea99562e..97936d86a 100644 --- a/src/display/nr-filter-specularlighting.cpp +++ b/src/display/nr-filter-specularlighting.cpp @@ -325,4 +325,4 @@ void FilterSpecularLighting::area_enlarge(NRRectL &area, Geom::Matrix const &tra fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-specularlighting.h b/src/display/nr-filter-specularlighting.h index 6622b6add..8d6252c69 100644 --- a/src/display/nr-filter-specularlighting.h +++ b/src/display/nr-filter-specularlighting.h @@ -61,4 +61,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-tile.cpp b/src/display/nr-filter-tile.cpp index 60f39e3cd..739ee2c5e 100644 --- a/src/display/nr-filter-tile.cpp +++ b/src/display/nr-filter-tile.cpp @@ -57,4 +57,4 @@ void FilterTile::area_enlarge(NRRectL &/*area*/, Geom::Matrix const &/*trans*/) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-tile.h b/src/display/nr-filter-tile.h index faf40ec63..e0eacddcf 100644 --- a/src/display/nr-filter-tile.h +++ b/src/display/nr-filter-tile.h @@ -42,4 +42,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-turbulence.cpp b/src/display/nr-filter-turbulence.cpp index 54b5cf7c6..7beebab68 100644 --- a/src/display/nr-filter-turbulence.cpp +++ b/src/display/nr-filter-turbulence.cpp @@ -399,4 +399,4 @@ void FilterTurbulence::render_cairo(FilterSlot &slot) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-turbulence.h b/src/display/nr-filter-turbulence.h index fca6ebde3..50161b6be 100644 --- a/src/display/nr-filter-turbulence.h +++ b/src/display/nr-filter-turbulence.h @@ -88,4 +88,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-types.h b/src/display/nr-filter-types.h index 595606d49..502bfe348 100644 --- a/src/display/nr-filter-types.h +++ b/src/display/nr-filter-types.h @@ -59,4 +59,4 @@ enum FilterQuality { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-units.cpp b/src/display/nr-filter-units.cpp index 6a7de1fed..4cf165800 100644 --- a/src/display/nr-filter-units.cpp +++ b/src/display/nr-filter-units.cpp @@ -202,4 +202,4 @@ FilterUnits& FilterUnits::operator=(FilterUnits const &other) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-units.h b/src/display/nr-filter-units.h index 12f0ca2ca..7ef6190fc 100644 --- a/src/display/nr-filter-units.h +++ b/src/display/nr-filter-units.h @@ -146,4 +146,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-utils.cpp b/src/display/nr-filter-utils.cpp index d36c0beb5..1ba341791 100644 --- a/src/display/nr-filter-utils.cpp +++ b/src/display/nr-filter-utils.cpp @@ -18,4 +18,4 @@ namespace Filters { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter-utils.h b/src/display/nr-filter-utils.h index 5c59a0e84..4d2b06bd5 100644 --- a/src/display/nr-filter-utils.h +++ b/src/display/nr-filter-utils.h @@ -82,4 +82,4 @@ inline int clamp_alpha(int const val, int const alpha) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter.cpp b/src/display/nr-filter.cpp index eda6eaf8e..5e8419ef4 100644 --- a/src/display/nr-filter.cpp +++ b/src/display/nr-filter.cpp @@ -487,4 +487,4 @@ std::pair<double,double> Filter::_filter_resolution( fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-filter.h b/src/display/nr-filter.h index b266ba053..ac434b402 100644 --- a/src/display/nr-filter.h +++ b/src/display/nr-filter.h @@ -220,4 +220,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-light-types.h b/src/display/nr-light-types.h index 79b4a3a5e..5c9acb324 100644 --- a/src/display/nr-light-types.h +++ b/src/display/nr-light-types.h @@ -24,4 +24,4 @@ enum LightType{ fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-light.cpp b/src/display/nr-light.cpp index 3d441a8ec..0c801d736 100644 --- a/src/display/nr-light.cpp +++ b/src/display/nr-light.cpp @@ -118,4 +118,4 @@ void SpotLight::light_components(NR::Fvector &lc, const NR::Fvector &L) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-light.h b/src/display/nr-light.h index e1870f176..65c341a7e 100644 --- a/src/display/nr-light.h +++ b/src/display/nr-light.h @@ -158,4 +158,4 @@ class SpotLight { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-svgfonts.cpp b/src/display/nr-svgfonts.cpp index 98b085333..f3207cf18 100644 --- a/src/display/nr-svgfonts.cpp +++ b/src/display/nr-svgfonts.cpp @@ -301,4 +301,4 @@ void SvgFont::refresh(){ fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/sodipodi-ctrl.cpp b/src/display/sodipodi-ctrl.cpp index 28488e7c3..ce4df98c6 100644 --- a/src/display/sodipodi-ctrl.cpp +++ b/src/display/sodipodi-ctrl.cpp @@ -560,4 +560,4 @@ void SPCtrl::moveto (Geom::Point const p) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/sodipodi-ctrl.h b/src/display/sodipodi-ctrl.h index ed4db27fe..f9deffd56 100644 --- a/src/display/sodipodi-ctrl.h +++ b/src/display/sodipodi-ctrl.h @@ -77,4 +77,4 @@ GtkType sp_ctrl_get_type (void); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/sodipodi-ctrlrect.cpp b/src/display/sodipodi-ctrlrect.cpp index 2ebf310c7..504a1bc92 100644 --- a/src/display/sodipodi-ctrlrect.cpp +++ b/src/display/sodipodi-ctrlrect.cpp @@ -434,4 +434,4 @@ void CtrlRect::_requestUpdate() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/sodipodi-ctrlrect.h b/src/display/sodipodi-ctrlrect.h index 7e5f5157e..70dcf1f30 100644 --- a/src/display/sodipodi-ctrlrect.h +++ b/src/display/sodipodi-ctrlrect.h @@ -67,4 +67,4 @@ GtkType sp_ctrlrect_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/sp-canvas-util.cpp b/src/display/sp-canvas-util.cpp index 1e7ba49ac..23b92c35d 100644 --- a/src/display/sp-canvas-util.cpp +++ b/src/display/sp-canvas-util.cpp @@ -114,4 +114,4 @@ sp_canvas_item_compare_z (SPCanvasItem * a, SPCanvasItem * b) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/sp-canvas-util.h b/src/display/sp-canvas-util.h index e86eeba20..82b85f1d8 100644 --- a/src/display/sp-canvas-util.h +++ b/src/display/sp-canvas-util.h @@ -48,4 +48,4 @@ gint sp_canvas_item_compare_z (SPCanvasItem * a, SPCanvasItem * b); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index fd3077adb..d2fd2fa3d 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -2477,4 +2477,4 @@ void sp_canvas_mark_rect(SPCanvas* canvas, int nl, int nt, int nr, int nb, uint8 fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/sp-ctrlline.cpp b/src/display/sp-ctrlline.cpp index 7db029dd3..f5ea225cc 100644 --- a/src/display/sp-ctrlline.cpp +++ b/src/display/sp-ctrlline.cpp @@ -197,4 +197,4 @@ sp_ctrlline_set_coords (SPCtrlLine *cl, const Geom::Point start, const Geom::Poi fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/sp-ctrlline.h b/src/display/sp-ctrlline.h index 696fb52ee..64497c464 100644 --- a/src/display/sp-ctrlline.h +++ b/src/display/sp-ctrlline.h @@ -49,4 +49,4 @@ void sp_ctrlline_set_coords (SPCtrlLine *cl, const Geom::Point start, const Geom fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/sp-ctrlpoint.cpp b/src/display/sp-ctrlpoint.cpp index 9f791676e..a5e93d07d 100644 --- a/src/display/sp-ctrlpoint.cpp +++ b/src/display/sp-ctrlpoint.cpp @@ -187,4 +187,4 @@ sp_ctrlpoint_set_radius (SPCtrlPoint *cp, const double r) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/sp-ctrlpoint.h b/src/display/sp-ctrlpoint.h index 67440c4db..d0e72f518 100644 --- a/src/display/sp-ctrlpoint.h +++ b/src/display/sp-ctrlpoint.h @@ -49,4 +49,4 @@ void sp_ctrlpoint_set_radius (SPCtrlPoint *cp, const double r); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/sp-ctrlquadr.cpp b/src/display/sp-ctrlquadr.cpp index 4372f871c..7a577a088 100644 --- a/src/display/sp-ctrlquadr.cpp +++ b/src/display/sp-ctrlquadr.cpp @@ -203,4 +203,4 @@ sp_ctrlquadr_set_coords (SPCtrlQuadr *cl, Geom::Point p1, Geom::Point p2, Geom:: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/sp-ctrlquadr.h b/src/display/sp-ctrlquadr.h index 996c02295..f3c1ced45 100644 --- a/src/display/sp-ctrlquadr.h +++ b/src/display/sp-ctrlquadr.h @@ -40,4 +40,4 @@ void sp_ctrlquadr_set_coords (SPCtrlQuadr *cl, const Geom::Point p1, const Geom: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/document-subset.cpp b/src/document-subset.cpp index 1988865d1..6a7f8822c 100644 --- a/src/document-subset.cpp +++ b/src/document-subset.cpp @@ -408,4 +408,4 @@ DocumentSubset::connectRemoved(sigc::slot<void, SPObject *> slot) const { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/document-subset.h b/src/document-subset.h index e424a289c..ce7776da4 100644 --- a/src/document-subset.h +++ b/src/document-subset.h @@ -67,4 +67,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/document.cpp b/src/document.cpp index 3c9f7e5ed..677883112 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -41,8 +41,6 @@ #include <string> #include <cstring> -#include "application/application.h" -#include "application/editor.h" #include "desktop.h" #include "dir-util.h" #include "display/nr-arena-item.h" @@ -418,17 +416,11 @@ sp_document_create(Inkscape::XML::Document *rdoc, sp_document_set_undo_sensitive(document, true); // reset undo key when selection changes, so that same-key actions on different objects are not coalesced - if (!Inkscape::NSApplication::Application::getNewGui()) { - g_signal_connect(G_OBJECT(INKSCAPE), "change_selection", - G_CALLBACK(sp_document_reset_key), document); - g_signal_connect(G_OBJECT(INKSCAPE), "activate_desktop", - G_CALLBACK(sp_document_reset_key), document); - document->oldSignalsConnected = true; - } else { - document->_selection_changed_connection = Inkscape::NSApplication::Editor::connectSelectionChanged (sigc::mem_fun (*document, &SPDocument::reset_key)); - document->_desktop_activated_connection = Inkscape::NSApplication::Editor::connectDesktopActivated (sigc::mem_fun (*document, &SPDocument::reset_key)); - document->oldSignalsConnected = false; - } + g_signal_connect(G_OBJECT(INKSCAPE), "change_selection", + G_CALLBACK(sp_document_reset_key), document); + g_signal_connect(G_OBJECT(INKSCAPE), "activate_desktop", + G_CALLBACK(sp_document_reset_key), document); + document->oldSignalsConnected = true; return document; } @@ -1487,4 +1479,4 @@ bool SPDocument::isSeeking() const { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/document.h b/src/document.h index 5810b5358..4f5f045c5 100644 --- a/src/document.h +++ b/src/document.h @@ -301,4 +301,4 @@ unsigned int vacuum_document(SPDocument *document); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dom/prop-svg.cpp b/src/dom/prop-svg.cpp index 0a517ef76..a38f23c23 100644 --- a/src/dom/prop-svg.cpp +++ b/src/dom/prop-svg.cpp @@ -743,4 +743,4 @@ int main(int /*argc*/, char **/*argv*/) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/doxygen-main.cpp b/src/doxygen-main.cpp index c6a6bb3ab..58c2f3f9a 100644 --- a/src/doxygen-main.cpp +++ b/src/doxygen-main.cpp @@ -283,7 +283,6 @@ namespace XML {} /** \page UI User Interface Classes and Files * * - Inkscape::UI::View::View [\ref ui/view/view.cpp, \ref ui/view/view.h] - * - Inkscape::UI::View::Edit [\ref ui/view/edit.cpp, \ref ui/view/edit.h] * - SPDesktop [\ref desktop.cpp, \ref desktop-events.cpp, \ref desktop-handles.cpp, \ref desktop-style.cpp, \ref desktop.h, \ref desktop-events.h, \ref desktop-handles.h, \ref desktop-style.h] * - SPSVGView [\ref svg-view.cpp, \ref svg-view.h] * diff --git a/src/draw-anchor.cpp b/src/draw-anchor.cpp index c6590ac44..f3a42ca4e 100644 --- a/src/draw-anchor.cpp +++ b/src/draw-anchor.cpp @@ -107,4 +107,4 @@ sp_draw_anchor_test(SPDrawAnchor *anchor, Geom::Point w, gboolean activate) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/draw-anchor.h b/src/draw-anchor.h index 027761684..4aa713b52 100644 --- a/src/draw-anchor.h +++ b/src/draw-anchor.h @@ -41,4 +41,4 @@ SPDrawAnchor *sp_draw_anchor_test(SPDrawAnchor *anchor, Geom::Point w, gboolean fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/draw-context.cpp b/src/draw-context.cpp index 1ecaa5490..885260456 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -468,7 +468,7 @@ spdc_attach_selection(SPDrawContext *dc, Inkscape::Selection */*sel*/) * \param dc draw context * \param p cursor point (to be changed by snapping) * \param o origin point - * \param state keyboard state to check if ctrl was pressed + * \param state keyboard state to check if ctrl or shift was pressed */ void spdc_endpoint_snap_rotation(SPEventContext const *const ec, Geom::Point &p, Geom::Point const &o, @@ -476,44 +476,27 @@ void spdc_endpoint_snap_rotation(SPEventContext const *const ec, Geom::Point &p, { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); unsigned const snaps = abs(prefs->getInt("/options/rotationsnapsperpi/value", 12)); - /* 0 means no snapping. */ - - /* mirrored by fabs, so this corresponds to 15 degrees */ - Geom::Point best; /* best solution */ - double bn = Geom::infinity(); /* best normal */ - double bdot = 0; - Geom::Point v = Geom::Point(0, 1); - double const r00 = cos(M_PI / snaps), r01 = sin(M_PI / snaps); - double const r10 = -r01, r11 = r00; - - Geom::Point delta = p - o; - - for (unsigned i = 0; i < snaps; i++) { - double const ndot = fabs(dot(v,Geom::rot90(delta))); - Geom::Point t(r00*v[Geom::X] + r01*v[Geom::Y], - r10*v[Geom::X] + r11*v[Geom::Y]); - if (ndot < bn) { - /* I think it is better numerically to use the normal, rather than the dot product - * to assess solutions, but I haven't proven it. */ - bn = ndot; - best = v; - bdot = dot(v, delta); - } - v = t; + + SnapManager &m = SP_EVENT_CONTEXT_DESKTOP(ec)->namedview->snap_manager; + m.setup(SP_EVENT_CONTEXT_DESKTOP(ec)); + + bool snap_enabled = m.snapprefs.getSnapEnabledGlobally(); + if (state & GDK_SHIFT_MASK) { + // SHIFT disables all snapping, except the angular snapping. After all, the user explicitly asked for angular + // snapping by pressing CTRL, otherwise we wouldn't have arrived here. But although we temporarily disable + // the snapping here, we must still call for a constrained snap in order to apply the constraints (i.e. round + // to the nearest angle increment) + m.snapprefs.setSnapEnabledGlobally(false); } - if (fabs(bdot) > 0) { - p = o + bdot * best; + Inkscape::SnappedPoint dummy = m.constrainedAngularSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_NODE_HANDLE), boost::optional<Geom::Point>(), o, snaps); + p = dummy.getPoint(); - if (!(state & GDK_SHIFT_MASK)) { //SHIFT disables all snapping, except the angular snapping above - //After all, the user explicitly asked for angular snapping by - //pressing CTRL - /* Snap it along best vector */ - SnapManager &m = SP_EVENT_CONTEXT_DESKTOP(ec)->namedview->snap_manager; - m.setup(SP_EVENT_CONTEXT_DESKTOP(ec)); - m.constrainedSnapReturnByRef(p, Inkscape::SNAPSOURCE_NODE_HANDLE, Inkscape::Snapper::SnapConstraint(best)); - } + if (state & GDK_SHIFT_MASK) { + m.snapprefs.setSnapEnabledGlobally(snap_enabled); // restore the original setting } + + m.unSetup(); } @@ -528,6 +511,7 @@ void spdc_endpoint_snap_free(SPEventContext const * const ec, Geom::Point& p, gu m.setup(dt, true, selection->singleItem()); m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_NODE_HANDLE); + m.unSetup(); } static SPCurve * @@ -872,4 +856,4 @@ void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char cons fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/draw-context.h b/src/draw-context.h index 30ebaa61d..1364b5dad 100644 --- a/src/draw-context.h +++ b/src/draw-context.h @@ -101,4 +101,4 @@ void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char cons fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dropper-context.h b/src/dropper-context.h index 64181e3c8..6f8b60b34 100644 --- a/src/dropper-context.h +++ b/src/dropper-context.h @@ -61,4 +61,4 @@ guint32 sp_dropper_context_get_color(SPEventContext *ec); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dyna-draw-context.cpp b/src/dyna-draw-context.cpp index 468124bb7..4e6d6e05c 100644 --- a/src/dyna-draw-context.cpp +++ b/src/dyna-draw-context.cpp @@ -1285,4 +1285,4 @@ draw_temporary_box(SPDynaDrawContext *dc) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/dyna-draw-context.h b/src/dyna-draw-context.h index 19cbfbb29..9a736a3fc 100644 --- a/src/dyna-draw-context.h +++ b/src/dyna-draw-context.h @@ -72,4 +72,4 @@ GType sp_dyna_draw_context_get_type(void); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/eraser-context.cpp b/src/eraser-context.cpp index 6afa07d77..021479843 100644 --- a/src/eraser-context.cpp +++ b/src/eraser-context.cpp @@ -1071,4 +1071,4 @@ draw_temporary_box(SPEraserContext *dc) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/eraser-context.h b/src/eraser-context.h index 0e3f5c625..a581acd94 100644 --- a/src/eraser-context.h +++ b/src/eraser-context.h @@ -56,4 +56,4 @@ GType sp_eraser_context_get_type(void); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/event-context.cpp b/src/event-context.cpp index 6184fb4c7..a4109a91c 100644 --- a/src/event-context.cpp +++ b/src/event-context.cpp @@ -44,6 +44,7 @@ #include "desktop.h" #include "desktop-handles.h" #include "desktop-events.h" +#include "desktop-style.h" #include "widgets/desktop-widget.h" #include "sp-namedview.h" #include "selection.h" @@ -62,6 +63,7 @@ #include "ui/tool/control-point.h" #include "shape-editor.h" #include "sp-guide.h" +#include "color.h" static void sp_event_context_class_init(SPEventContextClass *klass); static void sp_event_context_init(SPEventContext *event_context); @@ -141,6 +143,7 @@ static void sp_event_context_init(SPEventContext *event_context) { event_context->shape_editor = NULL; event_context->_delayed_snap_event = NULL; event_context->_dse_callback_in_process = false; + event_context->tool_url = NULL; } /** @@ -183,17 +186,38 @@ void sp_event_context_update_cursor(SPEventContext *ec) { if (w->window) { /* fixme: */ if (ec->cursor_shape) { - GdkBitmap *bitmap = NULL; - GdkBitmap *mask = NULL; - sp_cursor_bitmap_and_mask_from_xpm(&bitmap, &mask, ec->cursor_shape); - if ((bitmap != NULL) && (mask != NULL)) { - if (ec->cursor) - gdk_cursor_unref(ec->cursor); - ec->cursor = gdk_cursor_new_from_pixmap(bitmap, mask, - &w->style->black, &w->style->white, ec->hot_x, - ec->hot_y); - g_object_unref(bitmap); - g_object_unref(mask); + GdkDisplay *display = gdk_display_get_default(); + if (ec->tool_url && gdk_display_supports_cursor_alpha(display) && gdk_display_supports_cursor_color(display)) { + bool fillHasColor=false, strokeHasColor=false; + guint32 fillColor = sp_desktop_get_color_tool(ec->desktop, ec->tool_url, true, &fillHasColor); + guint32 strokeColor = sp_desktop_get_color_tool(ec->desktop, ec->tool_url, false, &strokeHasColor); + double fillOpacity = fillHasColor ? sp_desktop_get_opacity_tool(ec->desktop, ec->tool_url, true) : 0; + double strokeOpacity = strokeHasColor ? sp_desktop_get_opacity_tool(ec->desktop, ec->tool_url, false) : 0; + GdkPixbuf *pixbuf = sp_cursor_pixbuf_from_xpm( + ec->cursor_shape, + w->style->black, w->style->white, + SP_RGBA32_U_COMPOSE(SP_RGBA32_R_U(fillColor),SP_RGBA32_G_U(fillColor),SP_RGBA32_B_U(fillColor),SP_COLOR_F_TO_U(fillOpacity)), + SP_RGBA32_U_COMPOSE(SP_RGBA32_R_U(strokeColor),SP_RGBA32_G_U(strokeColor),SP_RGBA32_B_U(strokeColor),SP_COLOR_F_TO_U(strokeOpacity)) + ); + if (pixbuf != NULL) { + if (ec->cursor) + gdk_cursor_unref(ec->cursor); + ec->cursor = gdk_cursor_new_from_pixbuf(display, pixbuf, ec->hot_x, ec->hot_y); + g_object_unref(pixbuf); + } + } else { + GdkBitmap *bitmap = NULL; + GdkBitmap *mask = NULL; + sp_cursor_bitmap_and_mask_from_xpm(&bitmap, &mask, ec->cursor_shape); + if ((bitmap != NULL) && (mask != NULL)) { + if (ec->cursor) + gdk_cursor_unref(ec->cursor); + ec->cursor = gdk_cursor_new_from_pixmap(bitmap, mask, + &w->style->black, &w->style->white, ec->hot_x, + ec->hot_y); + g_object_unref(bitmap); + g_object_unref(mask); + } } } gdk_window_set_cursor(w->window, ec->cursor); @@ -937,8 +961,12 @@ gint sp_event_context_root_handler(SPEventContext * event_context, } gint sp_event_context_virtual_root_handler(SPEventContext * event_context, GdkEvent * event) { - gint ret = ((SPEventContextClass *) G_OBJECT_GET_CLASS(event_context))->root_handler(event_context, event); - set_event_location(event_context->desktop, event); + gint ret = false; + if (event_context) { // If no event-context is available then do nothing, otherwise Inkscape would crash + // (see the comment in SPDesktop::set_event_context, and bug LP #622350) + ret = ((SPEventContextClass *) G_OBJECT_GET_CLASS(event_context))->root_handler(event_context, event); + set_event_location(event_context->desktop, event); + } return ret; } @@ -972,12 +1000,15 @@ gint sp_event_context_item_handler(SPEventContext * event_context, } gint sp_event_context_virtual_item_handler(SPEventContext * event_context, SPItem * item, GdkEvent * event) { - gint ret = ((SPEventContextClass *) G_OBJECT_GET_CLASS(event_context))->item_handler(event_context, item, event); - - if (!ret) { - ret = sp_event_context_virtual_root_handler(event_context, event); - } else { - set_event_location(event_context->desktop, event); + gint ret = false; + if (event_context) { // If no event-context is available then do nothing, otherwise Inkscape would crash + // (see the comment in SPDesktop::set_event_context, and bug LP #622350) + ret = ((SPEventContextClass *) G_OBJECT_GET_CLASS(event_context))->item_handler(event_context, item, event); + if (!ret) { + ret = sp_event_context_virtual_root_handler(event_context, event); + } else { + set_event_location(event_context->desktop, event); + } } return ret; @@ -1342,4 +1373,4 @@ void sp_event_context_discard_delayed_snap_event(SPEventContext *ec) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/event-context.h b/src/event-context.h index 76c74e26c..71084cb5f 100644 --- a/src/event-context.h +++ b/src/event-context.h @@ -128,6 +128,8 @@ struct SPEventContext : public GObject { DelayedSnapEvent *_delayed_snap_event; bool _dse_callback_in_process; + + char const * tool_url; ///< the (preferences) url for the tool (if a subclass corresponding to a tool is used) }; /** @@ -195,4 +197,4 @@ void event_context_print_event_info(GdkEvent *event, bool print_return = true); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/event-log.cpp b/src/event-log.cpp index 82de44696..977d068f8 100644 --- a/src/event-log.cpp +++ b/src/event-log.cpp @@ -380,4 +380,4 @@ EventLog::checkForVirginity() { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/event-log.h b/src/event-log.h index 9fcd01e1c..3f3c6830e 100644 --- a/src/event-log.h +++ b/src/event-log.h @@ -165,4 +165,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/event.h b/src/event.h index bf11604d8..fe4ed681c 100644 --- a/src/event.h +++ b/src/event.h @@ -52,4 +52,4 @@ struct Event { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/Makefile_insert b/src/extension/Makefile_insert index 1965dfa9a..b9ce224ca 100644 --- a/src/extension/Makefile_insert +++ b/src/extension/Makefile_insert @@ -1,53 +1,55 @@ ## Makefile.am fragment sourced by src/Makefile.am. ink_common_sources += \ - extension/extension.cpp \ - extension/extension.h \ - extension/extension-forward.h \ - extension/db.cpp \ - extension/db.h \ - extension/dependency.cpp \ - extension/dependency.h \ - extension/error-file.cpp \ - extension/error-file.h \ - extension/execution-env.cpp \ - extension/execution-env.h \ - extension/init.cpp \ - extension/init.h \ - extension/param/parameter.h \ - extension/param/parameter.cpp \ - extension/param/notebook.h \ - extension/param/notebook.cpp \ - extension/param/bool.h \ - extension/param/bool.cpp \ - extension/param/color.h \ - extension/param/color.cpp \ - extension/param/description.h \ - extension/param/description.cpp \ - extension/param/enum.h \ - extension/param/enum.cpp \ - extension/param/float.h \ - extension/param/float.cpp \ - extension/param/int.h \ - extension/param/int.cpp \ - extension/param/radiobutton.h \ - extension/param/radiobutton.cpp \ - extension/param/string.h \ - extension/param/string.cpp \ - extension/prefdialog.cpp \ - extension/prefdialog.h \ - extension/system.cpp \ - extension/system.h \ - extension/timer.cpp \ - extension/timer.h \ - extension/input.h \ - extension/input.cpp \ - extension/output.h \ - extension/output.cpp \ - extension/effect.h \ - extension/effect.cpp \ - extension/patheffect.h \ - extension/patheffect.cpp \ - extension/print.h \ - extension/print.cpp + extension/extension.cpp \ + extension/extension.h \ + extension/extension-forward.h \ + extension/db.cpp \ + extension/db.h \ + extension/dependency.cpp \ + extension/dependency.h \ + extension/error-file.cpp \ + extension/error-file.h \ + extension/execution-env.cpp \ + extension/execution-env.h \ + extension/init.cpp \ + extension/init.h \ + extension/param/parameter.h \ + extension/param/parameter.cpp \ + extension/param/notebook.h \ + extension/param/notebook.cpp \ + extension/param/bool.h \ + extension/param/bool.cpp \ + extension/param/color.h \ + extension/param/color.cpp \ + extension/param/description.h \ + extension/param/description.cpp \ + extension/param/groupheader.h \ + extension/param/groupheader.cpp \ + extension/param/enum.h \ + extension/param/enum.cpp \ + extension/param/float.h \ + extension/param/float.cpp \ + extension/param/int.h \ + extension/param/int.cpp \ + extension/param/radiobutton.h \ + extension/param/radiobutton.cpp \ + extension/param/string.h \ + extension/param/string.cpp \ + extension/prefdialog.cpp \ + extension/prefdialog.h \ + extension/system.cpp \ + extension/system.h \ + extension/timer.cpp \ + extension/timer.h \ + extension/input.h \ + extension/input.cpp \ + extension/output.h \ + extension/output.cpp \ + extension/effect.h \ + extension/effect.cpp \ + extension/patheffect.h \ + extension/patheffect.cpp \ + extension/print.h \ + extension/print.cpp diff --git a/src/extension/db.h b/src/extension/db.h index 9d4fc77d3..bc07c8591 100644 --- a/src/extension/db.h +++ b/src/extension/db.h @@ -85,4 +85,4 @@ extern DB db; fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp index afc0668a9..9a22c07b7 100644 --- a/src/extension/effect.cpp +++ b/src/extension/effect.cpp @@ -295,6 +295,19 @@ Effect::effect (Inkscape::UI::View::View * doc) void Effect::set_last_effect (Effect * in_effect) { + gchar const * verb_id = in_effect->get_verb()->get_id(); + gchar const * help_id_prefix = "org.inkscape.help."; + + // We don't want these "effects" to register as the last effect, + // this wouldn't be helpful to the user who selects a real effect, + // then goes to the help file (implemented as an effect), then goes + // back to the effect, only to see it written over by the help file + // selection. + + // This snippet should fix this bug: + // https://bugs.launchpad.net/inkscape/+bug/600671 + if (strncmp(verb_id, help_id_prefix, strlen(help_id_prefix)) == 0) return; + if (in_effect == NULL) { Inkscape::Verb::get(SP_VERB_EFFECT_LAST)->sensitive(NULL, false); Inkscape::Verb::get(SP_VERB_EFFECT_LAST_PREF)->sensitive(NULL, false); diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index b4cf06bda..caed62735 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -669,9 +669,9 @@ public: */ void addWidget (Gtk::Widget * widg, gchar const * tooltip) { if (widg == NULL) return; - this->pack_start(*widg, true, true, 2); + this->pack_start(*widg, false, false, 2); if (tooltip != NULL) { - _tooltips.set_tip(*widg, Glib::ustring(tooltip)); + _tooltips.set_tip(*widg, Glib::ustring(_(tooltip))); } return; }; diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index 6090b72d0..a8533a427 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -240,4 +240,4 @@ Implementation::fontEmbedded(Inkscape::Extension::Print * /*ext*/) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index e075feb91..04c7c15a6 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -39,7 +39,7 @@ #include "extension/db.h" #include "script.h" #include "dialogs/dialog-events.h" -#include "application/application.h" +#include "inkscape.h" #include "xml/node.h" #include "xml/attribute-record.h" @@ -602,10 +602,14 @@ void Script::save(Inkscape::Extension::Output *module, file_listener fileout; - execute(command, params, tempfilename_in, fileout); + int data_read = execute(command, params, tempfilename_in, fileout); + + bool success = false; - std::string lfilename = Glib::filename_from_utf8(filenameArg); - bool success = fileout.toFile(lfilename); + if (data_read > 0) { + std::string lfilename = Glib::filename_from_utf8(filenameArg); + success = fileout.toFile(lfilename); + } // make sure we don't leak file descriptors from g_file_open_tmp close(tempfd_in); @@ -979,7 +983,7 @@ int Script::execute (const std::list<std::string> &in_command, Glib::ustring stderr_data = fileerr.string(); if (stderr_data.length() != 0 && - Inkscape::NSApplication::Application::getUseGui() + inkscape_use_gui() ) { checkStderr(stderr_data, Gtk::MESSAGE_INFO, _("Inkscape has received additional data from the script executed. " @@ -1011,4 +1015,4 @@ int Script::execute (const std::list<std::string> &in_command, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/implementation/xslt.cpp b/src/extension/implementation/xslt.cpp index 143d72362..2ab821e44 100644 --- a/src/extension/implementation/xslt.cpp +++ b/src/extension/implementation/xslt.cpp @@ -239,4 +239,4 @@ XSLT::save(Inkscape::Extension::Output */*module*/, SPDocument *doc, gchar const fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/init.cpp b/src/extension/init.cpp index f58c8cbe6..8578e8c6c 100644 --- a/src/extension/init.cpp +++ b/src/extension/init.cpp @@ -358,4 +358,4 @@ check_extensions() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/init.h b/src/extension/init.h index 6ccc85aea..efe44bf47 100644 --- a/src/extension/init.h +++ b/src/extension/init.h @@ -33,4 +33,4 @@ void init (void); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/bitmap/adaptiveThreshold.cpp b/src/extension/internal/bitmap/adaptiveThreshold.cpp index 8afbaa0ef..9183a797e 100644 --- a/src/extension/internal/bitmap/adaptiveThreshold.cpp +++ b/src/extension/internal/bitmap/adaptiveThreshold.cpp @@ -37,15 +37,15 @@ AdaptiveThreshold::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Adaptive Threshold") "</name>\n" "<id>org.inkscape.effect.bitmap.adaptiveThreshold</id>\n" - "<param name=\"width\" gui-text=\"" N_("Width") "\" type=\"int\" min=\"-100\" max=\"100\">5</param>\n" - "<param name=\"height\" gui-text=\"" N_("Height") "\" type=\"int\" min=\"-100\" max=\"100\">5</param>\n" - "<param name=\"offset\" gui-text=\"" N_("Offset") "\" type=\"int\" min=\"0\" max=\"100\">0</param>\n" + "<param name=\"width\" gui-text=\"" N_("Width:") "\" type=\"int\" min=\"-100\" max=\"100\">5</param>\n" + "<param name=\"height\" gui-text=\"" N_("Height:") "\" type=\"int\" min=\"-100\" max=\"100\">5</param>\n" + "<param name=\"offset\" gui-text=\"" N_("Offset:") "\" type=\"int\" min=\"0\" max=\"100\">0</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Apply adaptive thresholding to selected bitmap(s).") "</menu-tip>\n" + "<menu-tip>" N_("Apply adaptive thresholding to selected bitmap(s)") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new AdaptiveThreshold()); } diff --git a/src/extension/internal/bitmap/addNoise.cpp b/src/extension/internal/bitmap/addNoise.cpp index d524faaff..7f96723e4 100644 --- a/src/extension/internal/bitmap/addNoise.cpp +++ b/src/extension/internal/bitmap/addNoise.cpp @@ -43,7 +43,7 @@ AddNoise::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Add Noise") "</name>\n" "<id>org.inkscape.effect.bitmap.addNoise</id>\n" - "<param name=\"noiseType\" gui-text=\"" N_("Type") "\" type=\"enum\" >\n" + "<param name=\"noiseType\" gui-text=\"" N_("Type:") "\" type=\"enum\" >\n" "<_item value='Uniform Noise'>" N_("Uniform Noise") "</_item>\n" "<_item value='Gaussian Noise'>" N_("Gaussian Noise") "</_item>\n" "<_item value='Multiplicative Gaussian Noise'>" N_("Multiplicative Gaussian Noise") "</_item>\n" @@ -56,7 +56,7 @@ AddNoise::init(void) "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Add random noise to selected bitmap(s).") "</menu-tip>\n" + "<menu-tip>" N_("Add random noise to selected bitmap(s)") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new AddNoise()); } diff --git a/src/extension/internal/bitmap/blur.cpp b/src/extension/internal/bitmap/blur.cpp index 2aab4c012..5a20c4fb6 100644 --- a/src/extension/internal/bitmap/blur.cpp +++ b/src/extension/internal/bitmap/blur.cpp @@ -36,8 +36,8 @@ Blur::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Blur") "</name>\n" "<id>org.inkscape.effect.bitmap.blur</id>\n" - "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"float\" min=\"0\" max=\"100\">1</param>\n" - "<param name=\"sigma\" gui-text=\"" N_("Sigma") "\" type=\"float\" min=\"0\" max=\"100\">0.5</param>\n" + "<param name=\"radius\" gui-text=\"" N_("Radius:") "\" type=\"float\" min=\"0\" max=\"100\">1</param>\n" + "<param name=\"sigma\" gui-text=\"" N_("Sigma:") "\" type=\"float\" min=\"0\" max=\"100\">0.5</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" diff --git a/src/extension/internal/bitmap/channel.cpp b/src/extension/internal/bitmap/channel.cpp index 77bc875a6..84186aba7 100644 --- a/src/extension/internal/bitmap/channel.cpp +++ b/src/extension/internal/bitmap/channel.cpp @@ -46,7 +46,7 @@ Channel::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Channel") "</name>\n" "<id>org.inkscape.effect.bitmap.channel</id>\n" - "<param name=\"layer\" gui-text=\"" N_("Layer") "\" type=\"enum\" >\n" + "<param name=\"layer\" gui-text=\"" N_("Layer:") "\" type=\"enum\" >\n" "<_item value='Red Channel'>" N_("Red Channel") "</_item>\n" "<_item value='Green Channel'>" N_("Green Channel") "</_item>\n" "<_item value='Blue Channel'>" N_("Blue Channel") "</_item>\n" @@ -62,7 +62,7 @@ Channel::init(void) "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Extract specific channel from image.") "</menu-tip>\n" + "<menu-tip>" N_("Extract specific channel from image") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Channel()); } diff --git a/src/extension/internal/bitmap/charcoal.cpp b/src/extension/internal/bitmap/charcoal.cpp index e5a707374..5b3c7606e 100644 --- a/src/extension/internal/bitmap/charcoal.cpp +++ b/src/extension/internal/bitmap/charcoal.cpp @@ -36,14 +36,14 @@ Charcoal::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Charcoal") "</name>\n" "<id>org.inkscape.effect.bitmap.charcoal</id>\n" - "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"float\" min=\"0\" max=\"100\">1</param>\n" - "<param name=\"sigma\" gui-text=\"" N_("Sigma") "\" type=\"float\" min=\"0\" max=\"100\">0.5</param>\n" + "<param name=\"radius\" gui-text=\"" N_("Radius:") "\" type=\"float\" min=\"0\" max=\"100\">1</param>\n" + "<param name=\"sigma\" gui-text=\"" N_("Sigma:") "\" type=\"float\" min=\"0\" max=\"100\">0.5</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Apply charcoal stylization to selected bitmap(s).") "</menu-tip>\n" + "<menu-tip>" N_("Apply charcoal stylization to selected bitmap(s)") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Charcoal()); } diff --git a/src/extension/internal/bitmap/colorize.cpp b/src/extension/internal/bitmap/colorize.cpp index 33020ef43..de99f9660 100644 --- a/src/extension/internal/bitmap/colorize.cpp +++ b/src/extension/internal/bitmap/colorize.cpp @@ -54,7 +54,7 @@ Colorize::init(void) "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Colorize selected bitmap(s) with specified color, using given opacity.") "</menu-tip>\n" + "<menu-tip>" N_("Colorize selected bitmap(s) with specified color, using given opacity") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Colorize()); } diff --git a/src/extension/internal/bitmap/contrast.cpp b/src/extension/internal/bitmap/contrast.cpp index eb69f2eb9..0fa966e09 100644 --- a/src/extension/internal/bitmap/contrast.cpp +++ b/src/extension/internal/bitmap/contrast.cpp @@ -38,7 +38,7 @@ Contrast::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Contrast") "</name>\n" "<id>org.inkscape.effect.bitmap.contrast</id>\n" - "<param name=\"sharpen\" gui-text=\"" N_("Adjust") "\" type=\"int\" min=\"0\" max=\"10\">0</param>\n" + "<param name=\"sharpen\" gui-text=\"" N_("Adjust:") "\" type=\"int\" min=\"0\" max=\"10\">0</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" diff --git a/src/extension/internal/bitmap/cycleColormap.cpp b/src/extension/internal/bitmap/cycleColormap.cpp index 2efb4445c..339e8e0e8 100644 --- a/src/extension/internal/bitmap/cycleColormap.cpp +++ b/src/extension/internal/bitmap/cycleColormap.cpp @@ -35,13 +35,13 @@ CycleColormap::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Cycle Colormap") "</name>\n" "<id>org.inkscape.effect.bitmap.cycleColormap</id>\n" - "<param name=\"amount\" gui-text=\"" N_("Amount") "\" type=\"int\" min=\"0\" max=\"360\">180</param>\n" + "<param name=\"amount\" gui-text=\"" N_("Amount:") "\" type=\"int\" min=\"0\" max=\"360\">180</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Cycle colormap(s) of selected bitmap(s).") "</menu-tip>\n" + "<menu-tip>" N_("Cycle colormap(s) of selected bitmap(s)") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new CycleColormap()); } diff --git a/src/extension/internal/bitmap/despeckle.cpp b/src/extension/internal/bitmap/despeckle.cpp index 1d4d4a785..6382de041 100644 --- a/src/extension/internal/bitmap/despeckle.cpp +++ b/src/extension/internal/bitmap/despeckle.cpp @@ -39,7 +39,7 @@ Despeckle::init(void) "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Reduce speckle noise of selected bitmap(s).") "</menu-tip>\n" + "<menu-tip>" N_("Reduce speckle noise of selected bitmap(s)") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Despeckle()); } diff --git a/src/extension/internal/bitmap/edge.cpp b/src/extension/internal/bitmap/edge.cpp index af0ec1205..6fbc435e7 100644 --- a/src/extension/internal/bitmap/edge.cpp +++ b/src/extension/internal/bitmap/edge.cpp @@ -35,13 +35,13 @@ Edge::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Edge") "</name>\n" "<id>org.inkscape.effect.bitmap.edge</id>\n" - "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"int\" min=\"0\" max=\"100\">0</param>\n" + "<param name=\"radius\" gui-text=\"" N_("Radius:") "\" type=\"int\" min=\"0\" max=\"100\">0</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Highlight edges of selected bitmap(s).") "</menu-tip>\n" + "<menu-tip>" N_("Highlight edges of selected bitmap(s)") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Edge()); } diff --git a/src/extension/internal/bitmap/emboss.cpp b/src/extension/internal/bitmap/emboss.cpp index 98c245b37..38b677613 100644 --- a/src/extension/internal/bitmap/emboss.cpp +++ b/src/extension/internal/bitmap/emboss.cpp @@ -36,14 +36,14 @@ Emboss::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Emboss") "</name>\n" "<id>org.inkscape.effect.bitmap.emboss</id>\n" - "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"float\" min=\"0\" max=\"100\">1.0</param>\n" - "<param name=\"sigma\" gui-text=\"" N_("Sigma") "\" type=\"float\" min=\"-50\" max=\"50\">0.5</param>\n" + "<param name=\"radius\" gui-text=\"" N_("Radius:") "\" type=\"float\" min=\"0\" max=\"100\">1.0</param>\n" + "<param name=\"sigma\" gui-text=\"" N_("Sigma:") "\" type=\"float\" min=\"-50\" max=\"50\">0.5</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Emboss selected bitmap(s) -- highlight edges with 3D effect.") "</menu-tip>\n" + "<menu-tip>" N_("Emboss selected bitmap(s); highlight edges with 3D effect") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Emboss()); } diff --git a/src/extension/internal/bitmap/enhance.cpp b/src/extension/internal/bitmap/enhance.cpp index 2a1158d1d..d679d9e2b 100644 --- a/src/extension/internal/bitmap/enhance.cpp +++ b/src/extension/internal/bitmap/enhance.cpp @@ -38,7 +38,7 @@ Enhance::init(void) "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Enhance selected bitmap(s) -- minimize noise.") "</menu-tip>\n" + "<menu-tip>" N_("Enhance selected bitmap(s); minimize noise") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Enhance()); } diff --git a/src/extension/internal/bitmap/equalize.cpp b/src/extension/internal/bitmap/equalize.cpp index 67f2f5a82..29a1dc7c5 100644 --- a/src/extension/internal/bitmap/equalize.cpp +++ b/src/extension/internal/bitmap/equalize.cpp @@ -38,7 +38,7 @@ Equalize::init(void) "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Equalize selected bitmap(s) -- histogram equalization.") "</menu-tip>\n" + "<menu-tip>" N_("Equalize selected bitmap(s); histogram equalization") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Equalize()); } diff --git a/src/extension/internal/bitmap/gaussianBlur.cpp b/src/extension/internal/bitmap/gaussianBlur.cpp index e5e0db5f4..fe2df868c 100644 --- a/src/extension/internal/bitmap/gaussianBlur.cpp +++ b/src/extension/internal/bitmap/gaussianBlur.cpp @@ -36,14 +36,14 @@ GaussianBlur::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Gaussian Blur") "</name>\n" "<id>org.inkscape.effect.bitmap.gaussianBlur</id>\n" - "<param name=\"width\" gui-text=\"" N_("Factor") "\" type=\"float\" min=\"0\" max=\"100\">5.0</param>\n" - "<param name=\"sigma\" gui-text=\"" N_("Sigma") "\" type=\"float\" min=\"0\" max=\"100\">5.0</param>\n" + "<param name=\"width\" gui-text=\"" N_("Factor:") "\" type=\"float\" min=\"0\" max=\"100\">5.0</param>\n" + "<param name=\"sigma\" gui-text=\"" N_("Sigma:") "\" type=\"float\" min=\"0\" max=\"100\">5.0</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Gaussian blur selected bitmap(s).") "</menu-tip>\n" + "<menu-tip>" N_("Gaussian blur selected bitmap(s)") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new GaussianBlur()); } diff --git a/src/extension/internal/bitmap/implode.cpp b/src/extension/internal/bitmap/implode.cpp index 75fa1b871..afd9b089f 100644 --- a/src/extension/internal/bitmap/implode.cpp +++ b/src/extension/internal/bitmap/implode.cpp @@ -35,13 +35,13 @@ Implode::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Implode") "</name>\n" "<id>org.inkscape.effect.bitmap.implode</id>\n" - "<param name=\"factor\" gui-text=\"" N_("Factor") "\" type=\"float\" min=\"0\" max=\"100\">10</param>\n" + "<param name=\"factor\" gui-text=\"" N_("Factor:") "\" type=\"float\" min=\"0\" max=\"100\">10</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Implode selected bitmap(s).") "</menu-tip>\n" + "<menu-tip>" N_("Implode selected bitmap(s)") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Implode()); } diff --git a/src/extension/internal/bitmap/level.cpp b/src/extension/internal/bitmap/level.cpp index 5890aa9f1..718d4534c 100644 --- a/src/extension/internal/bitmap/level.cpp +++ b/src/extension/internal/bitmap/level.cpp @@ -39,15 +39,15 @@ Level::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Level") "</name>\n" "<id>org.inkscape.effect.bitmap.level</id>\n" - "<param name=\"blackPoint\" gui-text=\"" N_("Black Point") "\" type=\"float\" min=\"0\" max=\"100\">0</param>\n" - "<param name=\"whitePoint\" gui-text=\"" N_("White Point") "\" type=\"float\" min=\"0\" max=\"100\">100</param>\n" - "<param name=\"midPoint\" gui-text=\"" N_("Gamma Correction") "\" type=\"float\" min=\"0\" max=\"10\">1</param>\n" + "<param name=\"blackPoint\" gui-text=\"" N_("Black Point:") "\" type=\"float\" min=\"0\" max=\"100\">0</param>\n" + "<param name=\"whitePoint\" gui-text=\"" N_("White Point:") "\" type=\"float\" min=\"0\" max=\"100\">100</param>\n" + "<param name=\"midPoint\" gui-text=\"" N_("Gamma Correction:") "\" type=\"float\" min=\"0\" max=\"10\">1</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Level selected bitmap(s) by scaling values falling between the given ranges to the full color range.") "</menu-tip>\n" + "<menu-tip>" N_("Level selected bitmap(s) by scaling values falling between the given ranges to the full color range") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Level()); } diff --git a/src/extension/internal/bitmap/levelChannel.cpp b/src/extension/internal/bitmap/levelChannel.cpp index dde0feff7..4c579c46b 100644 --- a/src/extension/internal/bitmap/levelChannel.cpp +++ b/src/extension/internal/bitmap/levelChannel.cpp @@ -50,7 +50,7 @@ LevelChannel::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Level (with Channel)") "</name>\n" "<id>org.inkscape.effect.bitmap.levelChannel</id>\n" - "<param name=\"channel\" gui-text=\"" N_("Channel") "\" type=\"enum\" >\n" + "<param name=\"channel\" gui-text=\"" N_("Channel:") "\" type=\"enum\" >\n" "<_item value='Red Channel'>" N_("Red Channel") "</_item>\n" "<_item value='Green Channel'>" N_("Green Channel") "</_item>\n" "<_item value='Blue Channel'>" N_("Blue Channel") "</_item>\n" @@ -61,15 +61,15 @@ LevelChannel::init(void) "<_item value='Opacity Channel'>" N_("Opacity Channel") "</_item>\n" "<_item value='Matte Channel'>" N_("Matte Channel") "</_item>\n" "</param>\n" - "<param name=\"blackPoint\" gui-text=\"" N_("Black Point") "\" type=\"float\" min=\"0.0\" max=\"100.0\">0.0</param>\n" - "<param name=\"whitePoint\" gui-text=\"" N_("White Point") "\" type=\"float\" min=\"0.0\" max=\"100.0\">100.0</param>\n" - "<param name=\"midPoint\" gui-text=\"" N_("Gamma Correction") "\" type=\"float\" min=\"0.0\" max=\"10.0\">1.0</param>\n" + "<param name=\"blackPoint\" gui-text=\"" N_("Black Point:") "\" type=\"float\" min=\"0.0\" max=\"100.0\">0.0</param>\n" + "<param name=\"whitePoint\" gui-text=\"" N_("White Point:") "\" type=\"float\" min=\"0.0\" max=\"100.0\">100.0</param>\n" + "<param name=\"midPoint\" gui-text=\"" N_("Gamma Correction:") "\" type=\"float\" min=\"0.0\" max=\"10.0\">1.0</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Level the specified channel of selected bitmap(s) by scaling values falling between the given ranges to the full color range.") "</menu-tip>\n" + "<menu-tip>" N_("Level the specified channel of selected bitmap(s) by scaling values falling between the given ranges to the full color range") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new LevelChannel()); } diff --git a/src/extension/internal/bitmap/medianFilter.cpp b/src/extension/internal/bitmap/medianFilter.cpp index fdb6dc91b..8f3932a52 100644 --- a/src/extension/internal/bitmap/medianFilter.cpp +++ b/src/extension/internal/bitmap/medianFilter.cpp @@ -35,13 +35,13 @@ MedianFilter::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Median") "</name>\n" "<id>org.inkscape.effect.bitmap.medianFilter</id>\n" - "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"float\" min=\"0\" max=\"100\">0</param>\n" + "<param name=\"radius\" gui-text=\"" N_("Radius:") "\" type=\"float\" min=\"0\" max=\"100\">0</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Replace each pixel component with the median color in a circular neighborhood.") "</menu-tip>\n" + "<menu-tip>" N_("Replace each pixel component with the median color in a circular neighborhood") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new MedianFilter()); } diff --git a/src/extension/internal/bitmap/modulate.cpp b/src/extension/internal/bitmap/modulate.cpp index 9b7a1a655..4c146ee54 100644 --- a/src/extension/internal/bitmap/modulate.cpp +++ b/src/extension/internal/bitmap/modulate.cpp @@ -38,9 +38,9 @@ Modulate::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("HSB Adjust") "</name>\n" "<id>org.inkscape.effect.bitmap.modulate</id>\n" - "<param name=\"hue\" gui-text=\"" N_("Hue") "\" type=\"float\" min=\"-360\" max=\"360\">0</param>\n" - "<param name=\"saturation\" gui-text=\"" N_("Saturation") "\" type=\"float\" min=\"-200\" max=\"200\">0</param>\n" - "<param name=\"brightness\" gui-text=\"" N_("Brightness") "\" type=\"float\" min=\"-200\" max=\"200\">0</param>\n" + "<param name=\"hue\" gui-text=\"" N_("Hue:") "\" type=\"float\" min=\"-360\" max=\"360\">0</param>\n" + "<param name=\"saturation\" gui-text=\"" N_("Saturation:") "\" type=\"float\" min=\"-200\" max=\"200\">0</param>\n" + "<param name=\"brightness\" gui-text=\"" N_("Brightness:") "\" type=\"float\" min=\"-200\" max=\"200\">0</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" diff --git a/src/extension/internal/bitmap/negate.cpp b/src/extension/internal/bitmap/negate.cpp index 0f85ac726..ed2720de0 100644 --- a/src/extension/internal/bitmap/negate.cpp +++ b/src/extension/internal/bitmap/negate.cpp @@ -39,7 +39,7 @@ Negate::init(void) "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Negate (take inverse) selected bitmap(s).") "</menu-tip>\n" + "<menu-tip>" N_("Negate (take inverse) selected bitmap(s)") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Negate()); } diff --git a/src/extension/internal/bitmap/normalize.cpp b/src/extension/internal/bitmap/normalize.cpp index 318afb0da..9b612db6b 100644 --- a/src/extension/internal/bitmap/normalize.cpp +++ b/src/extension/internal/bitmap/normalize.cpp @@ -39,7 +39,7 @@ Normalize::init(void) "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Normalize selected bitmap(s), expanding color range to the full possible range of color.") "</menu-tip>\n" + "<menu-tip>" N_("Normalize selected bitmap(s), expanding color range to the full possible range of color") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Normalize()); } diff --git a/src/extension/internal/bitmap/oilPaint.cpp b/src/extension/internal/bitmap/oilPaint.cpp index 5d47efc32..d88bdcefd 100644 --- a/src/extension/internal/bitmap/oilPaint.cpp +++ b/src/extension/internal/bitmap/oilPaint.cpp @@ -35,13 +35,13 @@ OilPaint::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Oil Paint") "</name>\n" "<id>org.inkscape.effect.bitmap.oilPaint</id>\n" - "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"int\" min=\"0\" max=\"50\">3</param>\n" + "<param name=\"radius\" gui-text=\"" N_("Radius:") "\" type=\"int\" min=\"0\" max=\"50\">3</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Stylize selected bitmap(s) so that they appear to be painted with oils.") "</menu-tip>\n" + "<menu-tip>" N_("Stylize selected bitmap(s) so that they appear to be painted with oils") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new OilPaint()); } diff --git a/src/extension/internal/bitmap/opacity.cpp b/src/extension/internal/bitmap/opacity.cpp index 6033b5129..a9ef217d4 100644 --- a/src/extension/internal/bitmap/opacity.cpp +++ b/src/extension/internal/bitmap/opacity.cpp @@ -36,7 +36,7 @@ Opacity::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Opacity") "</name>\n" "<id>org.inkscape.effect.bitmap.opacity</id>\n" - "<param name=\"opacity\" gui-text=\"" N_("Opacity") "\" type=\"float\" min=\"0.0\" max=\"100.0\">80.0</param>\n" + "<param name=\"opacity\" gui-text=\"" N_("Opacity:") "\" type=\"float\" min=\"0.0\" max=\"100.0\">80.0</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" diff --git a/src/extension/internal/bitmap/raise.cpp b/src/extension/internal/bitmap/raise.cpp index 5ae0339b1..8b28dc53a 100644 --- a/src/extension/internal/bitmap/raise.cpp +++ b/src/extension/internal/bitmap/raise.cpp @@ -38,15 +38,15 @@ Raise::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Raise") "</name>\n" "<id>org.inkscape.effect.bitmap.raise</id>\n" - "<param name=\"width\" gui-text=\"" N_("Width") "\" type=\"int\" min=\"0\" max=\"800\">6</param>\n" - "<param name=\"height\" gui-text=\"" N_("Height") "\" type=\"int\" min=\"0\" max=\"800\">6</param>\n" + "<param name=\"width\" gui-text=\"" N_("Width:") "\" type=\"int\" min=\"0\" max=\"800\">6</param>\n" + "<param name=\"height\" gui-text=\"" N_("Height:") "\" type=\"int\" min=\"0\" max=\"800\">6</param>\n" "<param name=\"raisedFlag\" gui-text=\"" N_("Raised") "\" type=\"boolean\">0</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Alter lightness the edges of selected bitmap(s) to create a raised appearance.") "</menu-tip>\n" + "<menu-tip>" N_("Alter lightness the edges of selected bitmap(s) to create a raised appearance") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Raise()); } diff --git a/src/extension/internal/bitmap/reduceNoise.cpp b/src/extension/internal/bitmap/reduceNoise.cpp index 6c483291b..19233dfeb 100644 --- a/src/extension/internal/bitmap/reduceNoise.cpp +++ b/src/extension/internal/bitmap/reduceNoise.cpp @@ -38,13 +38,13 @@ ReduceNoise::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Reduce Noise") "</name>\n" "<id>org.inkscape.effect.bitmap.reduceNoise</id>\n" - "<param name=\"order\" gui-text=\"" N_("Order") "\" type=\"int\" min=\"-1\" max=\"100\">-1</param>\n" + "<param name=\"order\" gui-text=\"" N_("Order:") "\" type=\"int\" min=\"-1\" max=\"100\">-1</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Reduce noise in selected bitmap(s) using a noise peak elimination filter.") "</menu-tip>\n" + "<menu-tip>" N_("Reduce noise in selected bitmap(s) using a noise peak elimination filter") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new ReduceNoise()); } diff --git a/src/extension/internal/bitmap/sample.cpp b/src/extension/internal/bitmap/sample.cpp index 70c8995ac..dceb163fb 100644 --- a/src/extension/internal/bitmap/sample.cpp +++ b/src/extension/internal/bitmap/sample.cpp @@ -37,8 +37,8 @@ Sample::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Resample") "</name>\n" "<id>org.inkscape.effect.bitmap.sample</id>\n" - "<param name=\"width\" gui-text=\"" N_("Width") "\" type=\"int\" min=\"0\" max=\"6400\">100</param>\n" - "<param name=\"height\" gui-text=\"" N_("Height") "\" type=\"int\" min=\"0\" max=\"6400\">100</param>\n" + "<param name=\"width\" gui-text=\"" N_("Width:") "\" type=\"int\" min=\"0\" max=\"6400\">100</param>\n" + "<param name=\"height\" gui-text=\"" N_("Height:") "\" type=\"int\" min=\"0\" max=\"6400\">100</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" diff --git a/src/extension/internal/bitmap/shade.cpp b/src/extension/internal/bitmap/shade.cpp index 709149c54..18dae427d 100644 --- a/src/extension/internal/bitmap/shade.cpp +++ b/src/extension/internal/bitmap/shade.cpp @@ -38,15 +38,15 @@ Shade::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Shade") "</name>\n" "<id>org.inkscape.effect.bitmap.shade</id>\n" - "<param name=\"azimuth\" gui-text=\"" N_("Azimuth") "\" type=\"float\" min=\"-180\" max=\"180\">30</param>\n" - "<param name=\"elevation\" gui-text=\"" N_("Elevation") "\" type=\"float\" min=\"-180\" max=\"180\">30</param>\n" + "<param name=\"azimuth\" gui-text=\"" N_("Azimuth:") "\" type=\"float\" min=\"-180\" max=\"180\">30</param>\n" + "<param name=\"elevation\" gui-text=\"" N_("Elevation:") "\" type=\"float\" min=\"-180\" max=\"180\">30</param>\n" "<param name=\"colorShading\" gui-text=\"" N_("Colored Shading") "\" type=\"boolean\">false</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Shade selected bitmap(s) simulating distant light source.") "</menu-tip>\n" + "<menu-tip>" N_("Shade selected bitmap(s) simulating distant light source") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Shade()); } diff --git a/src/extension/internal/bitmap/sharpen.cpp b/src/extension/internal/bitmap/sharpen.cpp index cd87785ec..8eda536a3 100644 --- a/src/extension/internal/bitmap/sharpen.cpp +++ b/src/extension/internal/bitmap/sharpen.cpp @@ -36,14 +36,14 @@ Sharpen::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Sharpen") "</name>\n" "<id>org.inkscape.effect.bitmap.sharpen</id>\n" - "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"float\" min=\"0\" max=\"50\">1.0</param>\n" - "<param name=\"sigma\" gui-text=\"" N_("Sigma") "\" type=\"float\" min=\"0\" max=\"10\">0.5</param>\n" + "<param name=\"radius\" gui-text=\"" N_("Radius:") "\" type=\"float\" min=\"0\" max=\"50\">1.0</param>\n" + "<param name=\"sigma\" gui-text=\"" N_("Sigma:") "\" type=\"float\" min=\"0\" max=\"10\">0.5</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Sharpen selected bitmap(s).") "</menu-tip>\n" + "<menu-tip>" N_("Sharpen selected bitmap(s)") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Sharpen()); } diff --git a/src/extension/internal/bitmap/solarize.cpp b/src/extension/internal/bitmap/solarize.cpp index ea9ec42f3..223eb733c 100644 --- a/src/extension/internal/bitmap/solarize.cpp +++ b/src/extension/internal/bitmap/solarize.cpp @@ -37,13 +37,13 @@ Solarize::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Solarize") "</name>\n" "<id>org.inkscape.effect.bitmap.solarize</id>\n" - "<param name=\"factor\" gui-text=\"" N_("Factor") "\" type=\"float\" min=\"0\" max=\"100\">50</param>\n" + "<param name=\"factor\" gui-text=\"" N_("Factor:") "\" type=\"float\" min=\"0\" max=\"100\">50</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Solarize selected bitmap(s), like overexposing photographic film.") "</menu-tip>\n" + "<menu-tip>" N_("Solarize selected bitmap(s), like overexposing photographic film") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Solarize()); } diff --git a/src/extension/internal/bitmap/spread.cpp b/src/extension/internal/bitmap/spread.cpp index a52b7c33d..e7790ae67 100644 --- a/src/extension/internal/bitmap/spread.cpp +++ b/src/extension/internal/bitmap/spread.cpp @@ -35,7 +35,7 @@ Spread::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Dither") "</name>\n" "<id>org.inkscape.effect.bitmap.spread</id>\n" - "<param name=\"amount\" gui-text=\"" N_("Amount") "\" type=\"int\" min=\"0\" max=\"100\">3</param>\n" + "<param name=\"amount\" gui-text=\"" N_("Amount:") "\" type=\"int\" min=\"0\" max=\"100\">3</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" diff --git a/src/extension/internal/bitmap/swirl.cpp b/src/extension/internal/bitmap/swirl.cpp index a42047527..39bfe9b1d 100644 --- a/src/extension/internal/bitmap/swirl.cpp +++ b/src/extension/internal/bitmap/swirl.cpp @@ -35,13 +35,13 @@ Swirl::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Swirl") "</name>\n" "<id>org.inkscape.effect.bitmap.swirl</id>\n" - "<param name=\"degrees\" gui-text=\"" N_("Degrees") "\" type=\"int\" min=\"-360\" max=\"360\">30</param>\n" + "<param name=\"degrees\" gui-text=\"" N_("Degrees:") "\" type=\"int\" min=\"-360\" max=\"360\">30</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Swirl selected bitmap(s) around center point.") "</menu-tip>\n" + "<menu-tip>" N_("Swirl selected bitmap(s) around center point") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Swirl()); } diff --git a/src/extension/internal/bitmap/threshold.cpp b/src/extension/internal/bitmap/threshold.cpp index 8a6c8a6b0..85d0a8ed9 100644 --- a/src/extension/internal/bitmap/threshold.cpp +++ b/src/extension/internal/bitmap/threshold.cpp @@ -36,13 +36,13 @@ Threshold::init(void) // TRANSLATORS: see http://docs.gimp.org/en/gimp-tool-threshold.html "<name>" N_("Threshold") "</name>\n" "<id>org.inkscape.effect.bitmap.threshold</id>\n" - "<param name=\"threshold\" gui-text=\"" N_("Threshold") "\" type=\"float\" min=\"-100.0\" max=\"100.0\"></param>\n" + "<param name=\"threshold\" gui-text=\"" N_("Threshold:") "\" type=\"float\" min=\"-100.0\" max=\"100.0\"></param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Threshold selected bitmap(s).") "</menu-tip>\n" + "<menu-tip>" N_("Threshold selected bitmap(s)") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Threshold()); } diff --git a/src/extension/internal/bitmap/unsharpmask.cpp b/src/extension/internal/bitmap/unsharpmask.cpp index fe44432eb..32f3100f8 100644 --- a/src/extension/internal/bitmap/unsharpmask.cpp +++ b/src/extension/internal/bitmap/unsharpmask.cpp @@ -39,16 +39,16 @@ Unsharpmask::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Unsharp Mask") "</name>\n" "<id>org.inkscape.effect.bitmap.unsharpmask</id>\n" - "<param name=\"radius\" gui-text=\"" N_("Radius") "\" type=\"float\" min=\"0.0\" max=\"50.0\">5.0</param>\n" - "<param name=\"sigma\" gui-text=\"" N_("Sigma") "\" type=\"float\" min=\"0.0\" max=\"50.0\">5.0</param>\n" - "<param name=\"amount\" gui-text=\"" N_("Amount") "\" type=\"float\" min=\"0.0\" max=\"100.0\">50.0</param>\n" - "<param name=\"threshold\" gui-text=\"" N_("Threshold") "\" type=\"float\" min=\"0.0\" max=\"50.0\">5.0</param>\n" + "<param name=\"radius\" gui-text=\"" N_("Radius:") "\" type=\"float\" min=\"0.0\" max=\"50.0\">5.0</param>\n" + "<param name=\"sigma\" gui-text=\"" N_("Sigma:") "\" type=\"float\" min=\"0.0\" max=\"50.0\">5.0</param>\n" + "<param name=\"amount\" gui-text=\"" N_("Amount:") "\" type=\"float\" min=\"0.0\" max=\"100.0\">50.0</param>\n" + "<param name=\"threshold\" gui-text=\"" N_("Threshold:") "\" type=\"float\" min=\"0.0\" max=\"50.0\">5.0</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Sharpen selected bitmap(s) using unsharp mask algorithms.") "</menu-tip>\n" + "<menu-tip>" N_("Sharpen selected bitmap(s) using unsharp mask algorithms") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Unsharpmask()); } diff --git a/src/extension/internal/bitmap/wave.cpp b/src/extension/internal/bitmap/wave.cpp index 55993e982..ae84d7519 100644 --- a/src/extension/internal/bitmap/wave.cpp +++ b/src/extension/internal/bitmap/wave.cpp @@ -36,14 +36,14 @@ Wave::init(void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Wave") "</name>\n" "<id>org.inkscape.effect.bitmap.wave</id>\n" - "<param name=\"amplitude\" gui-text=\"" N_("Amplitude") "\" type=\"float\" min=\"-720.0\" max=\"720.0\">25</param>\n" - "<param name=\"wavelength\" gui-text=\"" N_("Wavelength") "\" type=\"float\" min=\"-720.0\" max=\"720.0\">150</param>\n" + "<param name=\"amplitude\" gui-text=\"" N_("Amplitude:") "\" type=\"float\" min=\"-720.0\" max=\"720.0\">25</param>\n" + "<param name=\"wavelength\" gui-text=\"" N_("Wavelength:") "\" type=\"float\" min=\"-720.0\" max=\"720.0\">150</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" "<submenu name=\"" N_("Raster") "\" />\n" "</effects-menu>\n" - "<menu-tip>" N_("Alter selected bitmap(s) along sine wave.") "</menu-tip>\n" + "<menu-tip>" N_("Alter selected bitmap(s) along sine wave") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Wave()); } diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index e32012070..a82c7ba77 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -133,8 +133,8 @@ BlurEdge::init (void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Inset/Outset Halo") "</name>\n" "<id>org.inkscape.effect.bluredge</id>\n" - "<param name=\"blur-width\" gui-text=\"" N_("Width") "\" gui-description=\"" N_("Width in px of the halo") "\" scope=\"document\" type=\"float\" min=\"1.0\" max=\"50.0\">1.0</param>\n" - "<param name=\"num-steps\" gui-text=\"" N_("Number of steps") "\" gui-description=\"" N_("Number of inset/outset copies of the object to make") "\" scope=\"document\" type=\"int\" min=\"5\" max=\"100\">11</param>\n" + "<param name=\"blur-width\" gui-text=\"" N_("Width:") "\" gui-description=\"" N_("Width in px of the halo") "\" scope=\"document\" type=\"float\" min=\"1.0\" max=\"50.0\">1.0</param>\n" + "<param name=\"num-steps\" gui-text=\"" N_("Number of steps:") "\" gui-description=\"" N_("Number of inset/outset copies of the object to make") "\" scope=\"document\" type=\"int\" min=\"5\" max=\"100\">11</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" diff --git a/src/extension/internal/cairo-png-out.h b/src/extension/internal/cairo-png-out.h index 9b9bd6ffe..93e3ab37f 100644 --- a/src/extension/internal/cairo-png-out.h +++ b/src/extension/internal/cairo-png-out.h @@ -47,4 +47,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp index 16adebac3..d9fd51ffd 100644 --- a/src/extension/internal/cairo-ps-out.cpp +++ b/src/extension/internal/cairo-ps-out.cpp @@ -314,7 +314,7 @@ CairoPsOutput::init (void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("PostScript") "</name>\n" "<id>" SP_MODULE_KEY_PRINT_CAIRO_PS "</id>\n" - "<param name=\"PSlevel\" gui-text=\"" N_("Restrict to PS level") "\" type=\"enum\" >\n" + "<param name=\"PSlevel\" gui-text=\"" N_("Restrict to PS level:") "\" type=\"enum\" >\n" "<_item value='PS3'>" N_("PostScript level 3") "</_item>\n" #if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 5, 2)) "<_item value='PS2'>" N_("PostScript level 2") "</_item>\n" @@ -323,10 +323,10 @@ CairoPsOutput::init (void) "<param name=\"textToPath\" gui-text=\"" N_("Convert texts to paths") "\" type=\"boolean\">false</param>\n" "<param name=\"textToLaTeX\" gui-text=\"" N_("PS+LaTeX: Omit text in PS, and create LaTeX file") "\" type=\"boolean\">false</param>\n" "<param name=\"blurToBitmap\" gui-text=\"" N_("Rasterize filter effects") "\" type=\"boolean\">true</param>\n" - "<param name=\"resolution\" gui-text=\"" N_("Resolution for rasterization (dpi)") "\" type=\"int\" min=\"1\" max=\"10000\">90</param>\n" + "<param name=\"resolution\" gui-text=\"" N_("Resolution for rasterization (dpi):") "\" type=\"int\" min=\"1\" max=\"10000\">90</param>\n" "<param name=\"areaDrawing\" gui-text=\"" N_("Export area is drawing") "\" type=\"boolean\">true</param>\n" "<param name=\"areaPage\" gui-text=\"" N_("Export area is page") "\" type=\"boolean\">true</param>\n" - "<param name=\"exportId\" gui-text=\"" N_("Limit export to the object with ID") "\" type=\"string\"></param>\n" + "<param name=\"exportId\" gui-text=\"" N_("Limit export to the object with ID:") "\" type=\"string\"></param>\n" "<output>\n" "<extension>.ps</extension>\n" "<mimetype>image/x-postscript</mimetype>\n" @@ -352,7 +352,7 @@ CairoEpsOutput::init (void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Encapsulated PostScript") "</name>\n" "<id>" SP_MODULE_KEY_PRINT_CAIRO_EPS "</id>\n" - "<param name=\"PSlevel\" gui-text=\"" N_("Restrict to PS level") "\" type=\"enum\" >\n" + "<param name=\"PSlevel\" gui-text=\"" N_("Restrict to PS level:") "\" type=\"enum\" >\n" "<_item value='PS3'>" N_("PostScript level 3") "</_item>\n" #if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 5, 2)) "<_item value='PS2'>" N_("PostScript level 2") "</_item>\n" @@ -361,10 +361,10 @@ CairoEpsOutput::init (void) "<param name=\"textToPath\" gui-text=\"" N_("Convert texts to paths") "\" type=\"boolean\">false</param>\n" "<param name=\"textToLaTeX\" gui-text=\"" N_("EPS+LaTeX: Omit text in EPS, and create LaTeX file") "\" type=\"boolean\">false</param>\n" "<param name=\"blurToBitmap\" gui-text=\"" N_("Rasterize filter effects") "\" type=\"boolean\">true</param>\n" - "<param name=\"resolution\" gui-text=\"" N_("Resolution for rasterization (dpi)") "\" type=\"int\" min=\"1\" max=\"10000\">90</param>\n" + "<param name=\"resolution\" gui-text=\"" N_("Resolution for rasterization (dpi):") "\" type=\"int\" min=\"1\" max=\"10000\">90</param>\n" "<param name=\"areaDrawing\" gui-text=\"" N_("Export area is drawing") "\" type=\"boolean\">true</param>\n" "<param name=\"areaPage\" gui-text=\"" N_("Export area is page") "\" type=\"boolean\">true</param>\n" - "<param name=\"exportId\" gui-text=\"" N_("Limit export to the object with ID") "\" type=\"string\"></param>\n" + "<param name=\"exportId\" gui-text=\"" N_("Limit export to the object with ID:") "\" type=\"string\"></param>\n" "<output>\n" "<extension>.eps</extension>\n" "<mimetype>image/x-e-postscript</mimetype>\n" diff --git a/src/extension/internal/cairo-ps-out.h b/src/extension/internal/cairo-ps-out.h index 019b6b810..368d827b1 100644 --- a/src/extension/internal/cairo-ps-out.h +++ b/src/extension/internal/cairo-ps-out.h @@ -62,4 +62,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 80152c298..a2a868feb 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -108,7 +108,7 @@ static cairo_status_t _write_callback(void *closure, const unsigned char *data, CairoRenderContext::CairoRenderContext(CairoRenderer *parent) : _dpi(72), - _pdf_level(0), + _pdf_level(1), _ps_level(1), _eps(false), _is_texttopath(FALSE), @@ -782,6 +782,9 @@ CairoRenderContext::setupSurface(double width, double height) #ifdef CAIRO_HAS_PDF_SURFACE case CAIRO_SURFACE_TYPE_PDF: surface = cairo_pdf_surface_create_for_stream(Inkscape::Extension::Internal::_write_callback, _stream, width, height); +#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0)) + cairo_pdf_surface_restrict_to_version(surface, (cairo_pdf_version_t)_pdf_level); +#endif break; #endif #ifdef CAIRO_HAS_PS_SURFACE @@ -791,8 +794,15 @@ CairoRenderContext::setupSurface(double width, double height) return FALSE; } #if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 5, 2)) - cairo_ps_surface_restrict_to_level (surface, (cairo_ps_level_t)_ps_level); - cairo_ps_surface_set_eps (surface, (cairo_bool_t) _eps); + cairo_ps_surface_restrict_to_level(surface, (cairo_ps_level_t)_ps_level); + cairo_ps_surface_set_eps(surface, (cairo_bool_t) _eps); +#endif + // Cairo calculates the bounding box itself, however we want to override this. See Launchpad bug #380501 +#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2)) + if (override_bbox) { + cairo_ps_dsc_comment(surface, "%%BoundingBox: 100 100 200 200"); + cairo_ps_dsc_comment(surface, "%%PageBoundingBox: 100 100 200 200"); + } #endif break; #endif @@ -1265,7 +1275,7 @@ CairoRenderContext::_setStrokeStyle(SPStyle const *style, NRRect const *pbox) cairo_set_source_rgba(_cr, rgb[0], rgb[1], rgb[2], alpha); } else { - g_assert( style->fill.isPaintserver() + g_assert( style->stroke.isPaintserver() || SP_IS_GRADIENT(SP_STYLE_STROKE_SERVER(style)) || SP_IS_PATTERN(SP_STYLE_STROKE_SERVER(style)) ); @@ -1477,18 +1487,19 @@ CairoRenderContext::_showGlyphs(cairo_t *cr, PangoFont *font, std::vector<CairoG glyphs = (cairo_glyph_t*)g_malloc(sizeof(cairo_glyph_t) * num_glyphs); unsigned int num_invalid_glyphs = 0; - unsigned int i = 0; + unsigned int i = 0; // is a counter for indexing the glyphs array, only counts the valid glyphs for (std::vector<CairoGlyphInfo>::const_iterator it_info = glyphtext.begin() ; it_info != glyphtext.end() ; it_info++) { // skip glyphs which are PANGO_GLYPH_EMPTY (0x0FFFFFFF) // or have the PANGO_GLYPH_UNKNOWN_FLAG (0x10000000) set if (it_info->index == 0x0FFFFFFF || it_info->index & 0x10000000) { TRACE(("INVALID GLYPH found\n")); + g_message("Invalid glyph found, continuing..."); num_invalid_glyphs++; continue; } - glyphs[i - num_invalid_glyphs].index = it_info->index; - glyphs[i - num_invalid_glyphs].x = it_info->x; - glyphs[i - num_invalid_glyphs].y = it_info->y; + glyphs[i].index = it_info->index; + glyphs[i].x = it_info->x; + glyphs[i].y = it_info->y; i++; } @@ -1676,4 +1687,4 @@ _write_callback(void *closure, const unsigned char *data, unsigned int length) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/cairo-render-context.h b/src/extension/internal/cairo-render-context.h index 5ba92ffa0..4fb554de7 100644 --- a/src/extension/internal/cairo-render-context.h +++ b/src/extension/internal/cairo-render-context.h @@ -217,4 +217,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp index e8eff20b7..32df1193b 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.cpp +++ b/src/extension/internal/cairo-renderer-pdf-out.cpp @@ -135,11 +135,11 @@ CairoRendererPdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, int level = 0; try { new_level = mod->get_param_enum("PDFversion"); -// if((new_level != NULL) && (g_ascii_strcasecmp("PDF-1.x", new_level) == 0)) -// level = 1; + if((new_level != NULL) && (g_ascii_strcasecmp("PDF-1.5", new_level) == 0)) + level = 1; } catch(...) { -// g_warning("Parameter <PDFversion> might not exist"); + g_warning("Parameter <PDFversion> might not exist"); } bool new_textToPath = FALSE; @@ -236,16 +236,19 @@ CairoRendererPdfOutput::init (void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>Portable Document Format</name>\n" "<id>org.inkscape.output.pdf.cairorenderer</id>\n" - "<param name=\"PDFversion\" gui-text=\"" N_("Restrict to PDF version") "\" type=\"enum\" >\n" - "<_item value='PDF14'>" N_("PDF 1.4") "</_item>\n" + "<param name=\"PDFversion\" gui-text=\"" N_("Restrict to PDF version:") "\" type=\"enum\" >\n" +#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0)) + "<_item value='PDF-1.5'>" N_("PDF 1.5") "</_item>\n" +#endif + "<_item value='PDF-1.4'>" N_("PDF 1.4") "</_item>\n" "</param>\n" "<param name=\"textToPath\" gui-text=\"" N_("Convert texts to paths") "\" type=\"boolean\">false</param>\n" "<param name=\"textToLaTeX\" gui-text=\"" N_("PDF+LaTeX: Omit text in PDF, and create LaTeX file") "\" type=\"boolean\">false</param>\n" "<param name=\"blurToBitmap\" gui-text=\"" N_("Rasterize filter effects") "\" type=\"boolean\">true</param>\n" - "<param name=\"resolution\" gui-text=\"" N_("Resolution for rasterization (dpi)") "\" type=\"int\" min=\"1\" max=\"10000\">90</param>\n" + "<param name=\"resolution\" gui-text=\"" N_("Resolution for rasterization (dpi):") "\" type=\"int\" min=\"1\" max=\"10000\">90</param>\n" "<param name=\"areaDrawing\" gui-text=\"" N_("Export area is drawing") "\" type=\"boolean\">false</param>\n" "<param name=\"areaPage\" gui-text=\"" N_("Export area is page") "\" type=\"boolean\">false</param>\n" - "<param name=\"exportId\" gui-text=\"" N_("Limit export to the object with ID") "\" type=\"string\"></param>\n" + "<param name=\"exportId\" gui-text=\"" N_("Limit export to the object with ID:") "\" type=\"string\"></param>\n" "<output>\n" "<extension>.pdf</extension>\n" "<mimetype>application/pdf</mimetype>\n" diff --git a/src/extension/internal/cairo-renderer-pdf-out.h b/src/extension/internal/cairo-renderer-pdf-out.h index d76ffb4d4..5cb61444b 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.h +++ b/src/extension/internal/cairo-renderer-pdf-out.h @@ -47,4 +47,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index ebdb82a69..988f61263 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -191,6 +191,7 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx) SPStyle* style = SP_OBJECT_STYLE (item); Geom::PathVector const & pathv = shape->curve->get_pathvector(); + if (pathv.empty()) return; ctx->renderPathVector(pathv, style, &pbox); @@ -812,4 +813,4 @@ calculatePreserveAspectRatio(unsigned int aspect_align, unsigned int aspect_clip fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/cairo-renderer.h b/src/extension/internal/cairo-renderer.h index d69a60753..f1a26a313 100644 --- a/src/extension/internal/cairo-renderer.h +++ b/src/extension/internal/cairo-renderer.h @@ -81,4 +81,4 @@ void calculatePreserveAspectRatio(unsigned int aspect_align, unsigned int aspect fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/emf-win32-inout.cpp b/src/extension/internal/emf-win32-inout.cpp index 4cace7db7..07f697775 100644 --- a/src/extension/internal/emf-win32-inout.cpp +++ b/src/extension/internal/emf-win32-inout.cpp @@ -2432,4 +2432,4 @@ EmfWin32::init (void) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/emf-win32-inout.h b/src/extension/internal/emf-win32-inout.h index c62d7a4e9..4b975c8de 100644 --- a/src/extension/internal/emf-win32-inout.h +++ b/src/extension/internal/emf-win32-inout.h @@ -54,4 +54,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/emf-win32-print.cpp b/src/extension/internal/emf-win32-print.cpp index d098f6466..bd42b0eb6 100644 --- a/src/extension/internal/emf-win32-print.cpp +++ b/src/extension/internal/emf-win32-print.cpp @@ -1020,4 +1020,4 @@ PrintEmfWin32::init (void) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/emf-win32-print.h b/src/extension/internal/emf-win32-print.h index 5c1d8439d..a0f26abb5 100644 --- a/src/extension/internal/emf-win32-print.h +++ b/src/extension/internal/emf-win32-print.h @@ -104,4 +104,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h new file mode 100644 index 000000000..1a1644276 --- /dev/null +++ b/src/extension/internal/filter/color.h @@ -0,0 +1,136 @@ +#ifndef __INKSCAPE_EXTENSION_INTERNAL_FILTER_COLOR_H__ +#define __INKSCAPE_EXTENSION_INTERNAL_FILTER_COLOR_H__ +/* Change the 'COLOR' above to be your file name */ + +/* + * Copyright (C) 2010 Authors: + * Ivan Louette (filters) + * Nicolas Dufour (UI) <nicoduf@yahoo.fr> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ +/* ^^^ Change the copyright to be you and your e-mail address ^^^ */ + +#include "filter.h" + +#include "extension/internal/clear-n_.h" +#include "extension/system.h" +#include "extension/extension.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Filter { + +class Duochrome : public Inkscape::Extension::Internal::Filter::Filter { +protected: + virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext); + +public: + Duochrome ( ) : Filter() { }; + virtual ~Duochrome ( ) { if (_filter != NULL) g_free((void *)_filter); return; } + + static void init (void) { + Inkscape::Extension::build_from_mem( + "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" + "<name>" N_("Duochrome, custom -EXP-") "</name>\n" + "<id>org.inkscape.effect.filter.Duochrome</id>\n" + "<param name=\"fluo\" gui-text=\"" N_("Fluorescence level:") "\" type=\"float\" min=\"0\" max=\"2\">0</param>\n" + "<param name=\"swap\" gui-text=\"" N_("Swap:") "\" type=\"enum\">\n" + "<_item value=\"none\">No swap</_item>\n" + "<_item value=\"full\">Color and alpha</_item>\n" + "<_item value=\"color\">Color only</_item>\n" + "<_item value=\"alpha\">Alpha only</_item>\n" + "</param>\n" + "<_param name=\"header1\" type=\"groupheader\">Color 1</_param>\n" + "<param name=\"color1\" gui-text=\"" N_("Color 1") "\" type=\"color\">1364325887</param>\n" + "<_param name=\"header2\" type=\"groupheader\">Color 2</_param>\n" + "<param name=\"color2\" gui-text=\"" N_("Color 2") "\" type=\"color\">-65281</param>\n" + "<effect>\n" + "<object-type>all</object-type>\n" + "<effects-menu>\n" + "<submenu name=\"" N_("Filters") "\">\n" + "<submenu name=\"" N_("Experimental") "\"/>\n" + "</submenu>\n" + "</effects-menu>\n" + "<menu-tip>" N_("Convert luminance values to a duochrome palette") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new Duochrome()); + }; + +}; + +gchar const * +Duochrome::get_filter_text (Inkscape::Extension::Extension * ext) +{ + if (_filter != NULL) g_free((void *)_filter); + + std::ostringstream a1; + std::ostringstream r1; + std::ostringstream g1; + std::ostringstream b1; + std::ostringstream a2; + std::ostringstream r2; + std::ostringstream g2; + std::ostringstream b2; + std::ostringstream fluo; + std::ostringstream swap1; + std::ostringstream swap2; + guint32 color1 = ext->get_param_color("color1"); + guint32 color2 = ext->get_param_color("color2"); + float fluorescence = ext->get_param_float("fluo"); + const gchar *swaptype = ext->get_param_enum("swap"); + + r1 << ((color1 >> 24) & 0xff); + g1 << ((color1 >> 16) & 0xff); + b1 << ((color1 >> 8) & 0xff); + r2 << ((color2 >> 24) & 0xff); + g2 << ((color2 >> 16) & 0xff); + b2 << ((color2 >> 8) & 0xff); + fluo << fluorescence; + + if((g_ascii_strcasecmp("full", swaptype) == 0)) { + swap1 << "in"; + swap2 << "out"; + a1 << (color1 & 0xff) / 255.0F; + a2 << (color2 & 0xff) / 255.0F; + } else if((g_ascii_strcasecmp("color", swaptype) == 0)) { + swap1 << "in"; + swap2 << "out"; + a1 << (color2 & 0xff) / 255.0F; + a2 << (color1 & 0xff) / 255.0F; + } else if((g_ascii_strcasecmp("alpha", swaptype) == 0)) { + swap1 << "out"; + swap2 << "in"; + a1 << (color2 & 0xff) / 255.0F; + a2 << (color1 & 0xff) / 255.0F; + } else { + swap1 << "out"; + swap2 << "in"; + a1 << (color1 & 0xff) / 255.0F; + a2 << (color2 & 0xff) / 255.0F; + } + + _filter = g_strdup_printf( + "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Duochrome, custom -EXP-\">\n" + "<feColorMatrix type=\"luminanceToAlpha\" result=\"colormatrix1\" />\n" + "<feFlood flood-opacity=\"%s\" flood-color=\"rgb(%s,%s,%s)\" result=\"flood1\" />\n" + "<feComposite in2=\"colormatrix1\" operator=\"%s\" result=\"composite1\" />\n" + "<feFlood in=\"colormatrix1\" flood-opacity=\"%s\" flood-color=\"rgb(%s,%s,%s)\" result=\"flood2\" />\n" + "<feComposite in2=\"colormatrix1\" result=\"composite2\" operator=\"%s\" />\n" + "<feComposite in=\"composite2\" in2=\"composite1\" k2=\"1\" k3=\"1\" operator=\"arithmetic\" result=\"composite3\" />\n" + "<feColorMatrix in=\"composite3\" type=\"matrix\" values=\"2 -1 0 0 0 0 2 -1 0 0 -1 0 2 0 0 0 0 0 1 0 \" result=\"colormatrix2\" />\n" + "<feComposite in=\"colormatrix2\" in2=\"composite3\" operator=\"arithmetic\" k2=\"%s\" result=\"composite4\" />\n" + "<feBlend in=\"composite4\" in2=\"composite3\" blend=\"normal\" mode=\"normal\" result=\"blend\" />\n" + "<feComposite in2=\"SourceGraphic\" operator=\"in\" />\n" + "</filter>\n", a1.str().c_str(), r1.str().c_str(), g1.str().c_str(), b1.str().c_str(), swap1.str().c_str(), a2.str().c_str(), r2.str().c_str(), g2.str().c_str(), b2.str().c_str(), swap2.str().c_str(), fluo.str().c_str()); + + return _filter; +}; +}; /* namespace Filter */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ + +/* Change the 'COLOR' below to be your file name */ +#endif /* __INKSCAPE_EXTENSION_INTERNAL_FILTER_COLOR_H__ */ diff --git a/src/extension/internal/filter/drop-shadow.h b/src/extension/internal/filter/drop-shadow.h index a48175fde..0cd2a8eeb 100644 --- a/src/extension/internal/filter/drop-shadow.h +++ b/src/extension/internal/filter/drop-shadow.h @@ -34,10 +34,10 @@ public: "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Drop Shadow") "</name>\n" "<id>org.inkscape.effect.filter.drop-shadow</id>\n" - "<param name=\"blur\" gui-text=\"" N_("Blur radius, px") "\" type=\"float\" min=\"0.0\" max=\"200.0\">2.0</param>\n" - "<param name=\"opacity\" gui-text=\"" N_("Opacity, %") "\" type=\"float\" min=\"0.0\" max=\"100.0\">50</param>\n" - "<param name=\"xoffset\" gui-text=\"" N_("Horizontal offset, px") "\" type=\"float\" min=\"-50.0\" max=\"50.0\">4.0</param>\n" - "<param name=\"yoffset\" gui-text=\"" N_("Vertical offset, px") "\" type=\"float\" min=\"-50.0\" max=\"50.0\">4.0</param>\n" + "<param name=\"blur\" gui-text=\"" N_("Blur radius (px):") "\" type=\"float\" min=\"0.0\" max=\"200.0\">2.0</param>\n" + "<param name=\"opacity\" gui-text=\"" N_("Opacity (%):") "\" type=\"float\" min=\"0.0\" max=\"100.0\">50</param>\n" + "<param name=\"xoffset\" gui-text=\"" N_("Horizontal offset (px):") "\" type=\"float\" min=\"-50.0\" max=\"50.0\">4.0</param>\n" + "<param name=\"yoffset\" gui-text=\"" N_("Vertical offset (px):") "\" type=\"float\" min=\"-50.0\" max=\"50.0\">4.0</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" @@ -94,10 +94,10 @@ public: "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Drop Glow") "</name>\n" "<id>org.inkscape.effect.filter.drop-glow</id>\n" - "<param name=\"blur\" gui-text=\"" N_("Blur radius, px") "\" type=\"float\" min=\"0.0\" max=\"200.0\">2.0</param>\n" - "<param name=\"opacity\" gui-text=\"" N_("Opacity, %") "\" type=\"float\" min=\"0.0\" max=\"100.0\">50</param>\n" - "<param name=\"xoffset\" gui-text=\"" N_("Horizontal offset, px") "\" type=\"float\" min=\"-50.0\" max=\"50.0\">4.0</param>\n" - "<param name=\"yoffset\" gui-text=\"" N_("Vertical offset, px") "\" type=\"float\" min=\"-50.0\" max=\"50.0\">4.0</param>\n" + "<param name=\"blur\" gui-text=\"" N_("Blur radius (px):") "\" type=\"float\" min=\"0.0\" max=\"200.0\">2.0</param>\n" + "<param name=\"opacity\" gui-text=\"" N_("Opacity (%):") "\" type=\"float\" min=\"0.0\" max=\"100.0\">50</param>\n" + "<param name=\"xoffset\" gui-text=\"" N_("Horizontal offset (px):") "\" type=\"float\" min=\"-50.0\" max=\"50.0\">4.0</param>\n" + "<param name=\"yoffset\" gui-text=\"" N_("Vertical offset (px):") "\" type=\"float\" min=\"-50.0\" max=\"50.0\">4.0</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" @@ -141,6 +141,71 @@ DropGlow::get_filter_text (Inkscape::Extension::Extension * ext) return _filter; }; +class ColorizableDropShadow : public Inkscape::Extension::Internal::Filter::Filter { +protected: + virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext); + +public: + ColorizableDropShadow ( ) : Filter() { }; + virtual ~ColorizableDropShadow ( ) { if (_filter != NULL) g_free((void *)_filter); return; } + + static void init (void) { + Inkscape::Extension::build_from_mem( + "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" + "<name>" N_("Drop shadow, color -EXP-") "</name>\n" + "<id>org.inkscape.effect.filter.colorizable-drop-shadow</id>\n" + "<param name=\"blur\" gui-text=\"" N_("Blur radius (px):") "\" type=\"float\" min=\"0.0\" max=\"200.0\">3.0</param>\n" + "<param name=\"xoffset\" gui-text=\"" N_("Horizontal offset (px):") "\" type=\"float\" min=\"-50.0\" max=\"50.0\">6.0</param>\n" + "<param name=\"yoffset\" gui-text=\"" N_("Vertical offset (px):") "\" type=\"float\" min=\"-50.0\" max=\"50.0\">6.0</param>\n" + "<param name=\"color\" gui-text=\"" N_("Color") "\" type=\"color\">127</param>\n" + "<effect>\n" + "<object-type>all</object-type>\n" + "<effects-menu>\n" + "<submenu name=\"" N_("Filters") "\">\n" + "<submenu name=\"" N_("Experimental") "\"/>\n" + "</submenu>\n" + "</effects-menu>\n" + "<menu-tip>" N_("Colorizable Drop shadow") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new ColorizableDropShadow()); + }; + +}; + +gchar const * +ColorizableDropShadow::get_filter_text (Inkscape::Extension::Extension * ext) +{ + if (_filter != NULL) g_free((void *)_filter); + + std::ostringstream blur; + std::ostringstream a; + std::ostringstream r; + std::ostringstream g; + std::ostringstream b; + std::ostringstream x; + std::ostringstream y; + + guint32 color = ext->get_param_color("color"); + + blur << ext->get_param_float("blur"); + x << ext->get_param_float("xoffset"); + y << ext->get_param_float("yoffset"); + a << (color & 0xff) / 255.0F; + r << ((color >> 24) & 0xff); + g << ((color >> 16) & 0xff); + b << ((color >> 8) & 0xff); + + _filter = g_strdup_printf( + "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1.2\" width=\"1.2\" y=\"-0.1\" x=\"-0.1\" inkscape:label=\"Drop shadow, color -EXP-\">\n" + "<feFlood flood-opacity=\"%s\" result=\"flood\" flood-color=\"rgb(%s,%s,%s)\" />\n" + "<feComposite in2=\"SourceGraphic\" in=\"flood\" result=\"composite\" operator=\"in\" />\n" + "<feGaussianBlur result=\"blur\" stdDeviation=\"%s\" in=\"composite\" />\n" + "<feOffset result=\"offsetBlur\" dx=\"%s\" dy=\"%s\" />\n" + "<feComposite in2=\"offsetBlur\" in=\"SourceGraphic\" operator=\"over\" result=\"compositeBlur\" />\n" + "</filter>\n", a.str().c_str(), r.str().c_str(), g.str().c_str(), b.str().c_str(), blur.str().c_str(), x.str().c_str(), y.str().c_str()); + + return _filter; +}; }; /* namespace Filter */ }; /* namespace Internal */ }; /* namespace Extension */ diff --git a/src/extension/internal/filter/experimental.h b/src/extension/internal/filter/experimental.h new file mode 100644 index 000000000..15c97202e --- /dev/null +++ b/src/extension/internal/filter/experimental.h @@ -0,0 +1,191 @@ +#ifndef __INKSCAPE_EXTENSION_INTERNAL_FILTER_EXPERIMENTAL_H__ +#define __INKSCAPE_EXTENSION_INTERNAL_FILTER_EXPERIMENTAL_H__ +/* Change the 'EXPERIMENTAL' above to be your file name */ + +/* + * Copyright (C) 2010 Authors: + * Ivan Louette (filters) + * Nicolas Dufour (UI) <nicoduf@yahoo.fr> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ +/* ^^^ Change the copyright to be you and your e-mail address ^^^ */ + +#include "filter.h" + +#include "extension/internal/clear-n_.h" +#include "extension/system.h" +#include "extension/extension.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { +namespace Filter { + +class Posterize : public Inkscape::Extension::Internal::Filter::Filter { +protected: + virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext); + +public: + Posterize ( ) : Filter() { }; + virtual ~Posterize ( ) { if (_filter != NULL) g_free((void *)_filter); return; } + + static void init (void) { + Inkscape::Extension::build_from_mem( + "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" + "<name>" N_("Poster and painting, custom -EXP-") "</name>\n" + "<id>org.inkscape.effect.filter.Posterize</id>\n" + "<param name=\"type\" gui-text=\"" N_("Effect type:") "\" type=\"enum\">\n" + "<_item value=\"normal\">Normal</_item>\n" + "<_item value=\"dented\">Dented</_item>\n" + "</param>\n" + "<param name=\"table\" gui-text=\"" N_("Transfer type:") "\" type=\"enum\">\n" + "<_item value=\"discrete\">Poster</_item>\n" + "<_item value=\"table\">Painting</_item>\n" + "</param>\n" + "<param name=\"levels\" gui-text=\"" N_("Levels:") "\" type=\"int\" min=\"1\" max=\"15\">5</param>\n" + "<param name=\"blend\" gui-text=\"" N_("Blend mode:") "\" type=\"enum\">\n" + "<_item value=\"lighten\">Ligthen</_item>\n" + "<_item value=\"normal\">Normal</_item>\n" + "<_item value=\"darken\">Darken</_item>\n" + "</param>\n" + "<param name=\"blur1\" gui-text=\"" N_("Primary blur:") "\" type=\"float\" min=\"0.0\" max=\"100.0\">4.0</param>\n" + "<param name=\"blur2\" gui-text=\"" N_("Secondary blur:") "\" type=\"float\" min=\"0.0\" max=\"100.0\">0.5</param>\n" + "<param name=\"presaturation\" gui-text=\"" N_("Pre-saturation:") "\" type=\"float\" min=\"0.00\" max=\"1.00\">1.00</param>\n" + "<param name=\"postsaturation\" gui-text=\"" N_("Post-saturation:") "\" type=\"float\" min=\"0.00\" max=\"1.00\">1.00</param>\n" + "<param name=\"antialiasing\" gui-text=\"" N_("Simulate antialiasing") "\" type=\"boolean\">false</param>\n" + "<effect>\n" + "<object-type>all</object-type>\n" + "<effects-menu>\n" + "<submenu name=\"" N_("Filters") "\">\n" + "<submenu name=\"" N_("Experimental") "\"/>\n" + "</submenu>\n" + "</effects-menu>\n" + "<menu-tip>" N_("Poster and painting effects") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new Posterize()); + }; + +}; + +gchar const * +Posterize::get_filter_text (Inkscape::Extension::Extension * ext) +{ + if (_filter != NULL) g_free((void *)_filter); + + std::ostringstream table; + std::ostringstream blendmode; + std::ostringstream blur1; + std::ostringstream blur2; + std::ostringstream presat; + std::ostringstream postsat; + std::ostringstream transf; + std::ostringstream antialias; + + table << ext->get_param_enum("table"); + blendmode << ext->get_param_enum("blend"); + blur1 << ext->get_param_float("blur1") + 0.01; + blur2 << ext->get_param_float("blur2") + 0.01; + presat << ext->get_param_float("presaturation"); + postsat << ext->get_param_float("postsaturation"); + + + // TransfertComponenet table values are calculated based on the poster type. + transf << "0"; + int levels = ext->get_param_int("levels") + 1; + const gchar *effecttype = ext->get_param_enum("type"); + float val = 0.0; + for ( int step = 1 ; step <= levels ; step++ ) { + val = (float) step / levels; + transf << " " << val; + if((g_ascii_strcasecmp("dented", effecttype) == 0)) { + transf << " " << (val - ((float) 1 / (3 * levels))) << " " << (val + ((float) 1 / (2 * levels))); + } + } + transf << " 1"; + + if (ext->get_param_bool("antialiasing")) + antialias << "0.5"; + else + antialias << "0.01"; + + + _filter = g_strdup_printf( + "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Poster and painting, custom -EXP-\">\n" + "<feComposite result=\"Composite1\" operator=\"arithmetic\" k2=\"1\" />\n" + "<feGaussianBlur stdDeviation=\"%s\" result=\"Gaussian1\" />\n" + "<feGaussianBlur stdDeviation=\"%s\" in=\"Composite1\" />\n" + "<feBlend in2=\"Gaussian1\" mode=\"%s\" />\n" + "<feColorMatrix type=\"saturate\" values=\"%s\" />\n" + "<feComponentTransfer>\n" + "<feFuncR type=\"%s\" tableValues=\"%s\" />\n" + "<feFuncG type=\"%s\" tableValues=\"%s\" />\n" + "<feFuncB type=\"%s\" tableValues=\"%s\" />\n" + "</feComponentTransfer>\n" + "<feColorMatrix type=\"saturate\" values=\"%s\" />\n" + "<feGaussianBlur stdDeviation=\"%s\" />\n" + "<feComposite in2=\"SourceGraphic\" operator=\"atop\" />\n" + "</filter>\n", blur1.str().c_str(), blur2.str().c_str(), blendmode.str().c_str(), presat.str().c_str(), table.str().c_str(), transf.str().c_str(), table.str().c_str(), transf.str().c_str(), table.str().c_str(), transf.str().c_str(), postsat.str().c_str(), antialias.str().c_str()); + + return _filter; +}; + +class TestFilter : public Inkscape::Extension::Internal::Filter::Filter { +protected: + virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext); + +public: + TestFilter ( ) : Filter() { }; + virtual ~TestFilter ( ) { if (_filter != NULL) g_free((void *)_filter); return; } + + static void init (void) { + Inkscape::Extension::build_from_mem( + "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" + "<name>" N_("Test Filter -EXP-") "</name>\n" + "<id>org.inkscape.effect.filter.TestFilter</id>\n" + "<_param name=\"header1\" type=\"groupheader\">Test filter</_param>\n" + "<effect>\n" + "<object-type>all</object-type>\n" + "<effects-menu>\n" + "<submenu name=\"" N_("Filters") "\">\n" + "<submenu name=\"" N_("Experimental") "\"/>\n" + "</submenu>\n" + "</effects-menu>\n" + "<menu-tip>" N_("Change colors to a two colors palette") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new TestFilter()); + }; + +}; + +gchar const * +TestFilter::get_filter_text (Inkscape::Extension::Extension * ext) +{ + if (_filter != NULL) g_free((void *)_filter); + + _filter = g_strdup_printf( + "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" color-interpolation-filters=\"sRGB\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Test Filter -EXP-\">\n" + "<feComposite result=\"Composite1\" operator=\"arithmetic\" k2=\"1\" />\n" + "<feGaussianBlur stdDeviation=\"4\" result=\"Gaussian1\" />\n" + "<feGaussianBlur stdDeviation=\"0.5\" in=\"Composite1\" />\n" + "<feBlend in2=\"Gaussian1\" mode=\"normal\" />\n" + "<feColorMatrix type=\"saturate\" values=\"1\" />\n" + "<feComponentTransfer>\n" + "<feFuncR type=\"discrete\" tableValues=\"0 0.25 0.5 0.75 1 1\" />\n" + "<feFuncG type=\"discrete\" tableValues=\"0 0.25 0.5 0.75 1 1\" />\n" + "<feFuncB type=\"discrete\" tableValues=\"0 0.25 0.5 0.75 1 1\" />\n" + "</feComponentTransfer>\n" + "<feColorMatrix type=\"saturate\" values=\"1\" />\n" + "<feGaussianBlur stdDeviation=\"0.05\" />\n" + "<feComposite in2=\"SourceGraphic\" operator=\"atop\" />\n" + "</filter>\n"); + + return _filter; +}; +}; /* namespace Filter */ +}; /* namespace Internal */ +}; /* namespace Extension */ +}; /* namespace Inkscape */ + +/* Change the 'COLOR' below to be your file name */ +#endif /* __INKSCAPE_EXTENSION_INTERNAL_FILTER_EXPERIMENTAL_H__ */ diff --git a/src/extension/internal/filter/filter-all.cpp b/src/extension/internal/filter/filter-all.cpp index b4b8caf81..6920e1bac 100644 --- a/src/extension/internal/filter/filter-all.cpp +++ b/src/extension/internal/filter/filter-all.cpp @@ -8,8 +8,10 @@ #include "filter.h" /* Put your filter here */ +#include "color.h" #include "drop-shadow.h" #include "snow.h" +#include "experimental.h" namespace Inkscape { namespace Extension { @@ -21,9 +23,14 @@ void Filter::filters_all (void ) { // Here come the filters which are coded in C++ in order to present a parameters dialog + Duochrome::init(); DropShadow::init(); DropGlow::init(); + ColorizableDropShadow::init(); Snow::init(); + + // Experimental! + Posterize::init(); // Here come the rest of the filters that are read from SVG files in share/filters and // .config/Inkscape/filters diff --git a/src/extension/internal/filter/snow.h b/src/extension/internal/filter/snow.h index 2bb798cf1..aac07fe62 100644 --- a/src/extension/internal/filter/snow.h +++ b/src/extension/internal/filter/snow.h @@ -31,7 +31,7 @@ public: "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Snow crest") "</name>\n" "<id>org.inkscape.effect.filter.snow</id>\n" - "<param name=\"drift\" gui-text=\"" N_("Drift Size") "\" type=\"float\" min=\"0.0\" max=\"20.0\">3.5</param>\n" + "<param name=\"drift\" gui-text=\"" N_("Drift Size:") "\" type=\"float\" min=\"0.0\" max=\"20.0\">3.5</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index df7f3481c..ff272d28d 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -195,4 +195,4 @@ GdkpixbufInput::init(void) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/gdkpixbuf-input.h b/src/extension/internal/gdkpixbuf-input.h index 9d5e6ccf7..597e7246b 100644 --- a/src/extension/internal/gdkpixbuf-input.h +++ b/src/extension/internal/gdkpixbuf-input.h @@ -28,4 +28,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/gimpgrad.h b/src/extension/internal/gimpgrad.h index 45b76dd6d..ed409ef93 100644 --- a/src/extension/internal/gimpgrad.h +++ b/src/extension/internal/gimpgrad.h @@ -43,4 +43,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index 1593ffe79..ed41dd97b 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -195,11 +195,11 @@ Grid::init (void) "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Grid") "</name>\n" "<id>org.inkscape.effect.grid</id>\n" - "<param name=\"lineWidth\" gui-text=\"" N_("Line Width") "\" type=\"float\">1.0</param>\n" - "<param name=\"xspacing\" gui-text=\"" N_("Horizontal Spacing") "\" type=\"float\" min=\"0.1\" max=\"1000\">10.0</param>\n" - "<param name=\"yspacing\" gui-text=\"" N_("Vertical Spacing") "\" type=\"float\" min=\"0.1\" max=\"1000\">10.0</param>\n" - "<param name=\"xoffset\" gui-text=\"" N_("Horizontal Offset") "\" type=\"float\" min=\"0.0\" max=\"1000\">0.0</param>\n" - "<param name=\"yoffset\" gui-text=\"" N_("Vertical Offset") "\" type=\"float\" min=\"0.0\" max=\"1000\">0.0</param>\n" + "<param name=\"lineWidth\" gui-text=\"" N_("Line Width:") "\" type=\"float\">1.0</param>\n" + "<param name=\"xspacing\" gui-text=\"" N_("Horizontal Spacing:") "\" type=\"float\" min=\"0.1\" max=\"1000\">10.0</param>\n" + "<param name=\"yspacing\" gui-text=\"" N_("Vertical Spacing:") "\" type=\"float\" min=\"0.1\" max=\"1000\">10.0</param>\n" + "<param name=\"xoffset\" gui-text=\"" N_("Horizontal Offset:") "\" type=\"float\" min=\"0.0\" max=\"1000\">0.0</param>\n" + "<param name=\"yoffset\" gui-text=\"" N_("Vertical Offset:") "\" type=\"float\" min=\"0.0\" max=\"1000\">0.0</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp index c635f7b2d..b371b0105 100644 --- a/src/extension/internal/javafx-out.cpp +++ b/src/extension/internal/javafx-out.cpp @@ -993,4 +993,4 @@ JavaFXOutput::init() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/latex-pstricks.cpp b/src/extension/internal/latex-pstricks.cpp index 34b7532ce..ed6024adf 100644 --- a/src/extension/internal/latex-pstricks.cpp +++ b/src/extension/internal/latex-pstricks.cpp @@ -369,5 +369,5 @@ PrintLatex::init (void) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp index 00448b89e..b37316d8f 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -578,4 +578,4 @@ LaTeXTextRenderer::pop_transform() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/latex-text-renderer.h b/src/extension/internal/latex-text-renderer.h index b5d4bfac1..e4bbd94ed 100644 --- a/src/extension/internal/latex-text-renderer.h +++ b/src/extension/internal/latex-text-renderer.h @@ -82,4 +82,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index 5331c072c..4f3f1ac89 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -2482,4 +2482,4 @@ OdfOutput::check (Inkscape::Extension::Extension */*module*/) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index ba00fe343..8dd4698b5 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -36,7 +36,7 @@ #include "pdf-parser.h" #include "document-private.h" -#include "application/application.h" +#include "inkscape.h" #include "dialogs/dialog-events.h" #include <gtk/gtkdialog.h> @@ -390,12 +390,10 @@ void PdfImportDialog::getImportSettings(Inkscape::XML::Node *prefs) { void PdfImportDialog::_onPrecisionChanged() { static Glib::ustring precision_comments[] = { - Glib::ustring(_("rough")), - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - Glib::ustring(Q_("pdfinput|medium")), - Glib::ustring(_("fine")), - Glib::ustring(_("very fine")) + Glib::ustring(C_("PDF input precision", "rough")), + Glib::ustring(C_("PDF input precision", "medium")), + Glib::ustring(C_("PDF input precision", "fine")), + Glib::ustring(C_("PDF input precision", "very fine")) }; double min = _fallbackPrecisionSlider_adj->get_lower(); @@ -643,7 +641,7 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { } PdfImportDialog *dlg = NULL; - if (Inkscape::NSApplication::Application::getUseGui()) { + if (inkscape_use_gui()) { dlg = new PdfImportDialog(pdf_doc, uri); if (!dlg->showDialog()) { delete dlg; diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp index b9583545f..e343dbf33 100644 --- a/src/extension/internal/pdfinput/svg-builder.cpp +++ b/src/extension/internal/pdfinput/svg-builder.cpp @@ -1291,8 +1291,8 @@ void SvgBuilder::_flushText() { last_delta_pos = delta_pos; // Append the character to the text buffer - if (0 != glyph.code[0]) { - text_buffer.append((char *)&glyph.code, 1); + if ( !glyph.code.empty() ) { + text_buffer.append(1, glyph.code[0]); } glyphs_in_a_row++; @@ -1333,8 +1333,8 @@ void SvgBuilder::addChar(GfxState *state, double x, double y, return; } // Allow only one space in a row - if ( is_space && _glyphs[_glyphs.size() - 1].code_size == 1 && - _glyphs[_glyphs.size() - 1].code[0] == 32 ) { + if ( is_space && (_glyphs[_glyphs.size() - 1].code.size() == 1) && + (_glyphs[_glyphs.size() - 1].code[0] == 32) ) { Geom::Point delta(dx, dy); _text_position += delta; return; @@ -1350,18 +1350,21 @@ void SvgBuilder::addChar(GfxState *state, double x, double y, _text_position += delta; // Convert the character to UTF-8 since that's our SVG document's encoding - static UnicodeMap *u_map = NULL; - if ( u_map == NULL ) { - GooString *enc = new GooString("UTF-8"); - u_map = globalParams->getUnicodeMap(enc); - u_map->incRefCnt(); - delete enc; - } - int code_size = 0; - for ( int i = 0 ; i < uLen ; i++ ) { - code_size += u_map->mapUnicode(u[i], (char *)&new_glyph.code[code_size], sizeof(new_glyph.code) - code_size); - } - new_glyph.code_size = code_size; + { + gunichar2 uu[8] = {0}; + + for (int i = 0; i < uLen; i++) { + uu[i] = u[i]; + } + + gchar *tmp = g_utf16_to_utf8(uu, uLen, NULL, NULL, NULL); + if ( tmp && *tmp ) { + new_glyph.code = tmp; + } else { + new_glyph.code.clear(); + } + g_free(tmp); + } // Copy current style if it has changed since the previous glyph if (_invalidated_style || _glyphs.size() == 0 ) { diff --git a/src/extension/internal/pdfinput/svg-builder.h b/src/extension/internal/pdfinput/svg-builder.h index 3b9192d31..f0062bbe6 100644 --- a/src/extension/internal/pdfinput/svg-builder.h +++ b/src/extension/internal/pdfinput/svg-builder.h @@ -28,6 +28,7 @@ namespace Inkscape { #include <2geom/point.h> #include <2geom/matrix.h> +#include <glibmm/ustring.h> #include "CharTypes.h" class GooString; @@ -75,10 +76,10 @@ struct SvgGraphicsState { struct SvgGlyph { Geom::Point position; // Absolute glyph coords Geom::Point text_position; // Absolute glyph coords in text space - double dx, dy; // Advance values + double dx; // X advance value + double dy; // Y advance value double rise; // Text rise parameter - char code[8]; // UTF-8 coded character - int code_size; + Glib::ustring code; // UTF-8 coded character bool is_space; bool style_changed; // Set to true if style has to be reset diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp index 16877c370..7b1fe8b87 100644 --- a/src/extension/internal/pov-out.cpp +++ b/src/extension/internal/pov-out.cpp @@ -727,4 +727,4 @@ PovOutput::init() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/win32.cpp b/src/extension/internal/win32.cpp index 21f278858..0c711824c 100644 --- a/src/extension/internal/win32.cpp +++ b/src/extension/internal/win32.cpp @@ -506,4 +506,4 @@ PrintWin32::init (void) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/internal/win32.h b/src/extension/internal/win32.h index 9462115c6..02790a231 100644 --- a/src/extension/internal/win32.h +++ b/src/extension/internal/win32.h @@ -93,4 +93,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/param/CMakeLists.txt b/src/extension/param/CMakeLists.txt index 843de8b7a..2ef5d5005 100644 --- a/src/extension/param/CMakeLists.txt +++ b/src/extension/param/CMakeLists.txt @@ -2,6 +2,7 @@ SET(extension_param_SRC bool.cpp color.cpp description.cpp +groupheader.cpp enum.cpp parameter.cpp float.cpp diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp index 1dda3d73f..a8a410382 100644 --- a/src/extension/param/bool.cpp +++ b/src/extension/param/bool.cpp @@ -139,9 +139,9 @@ ParamBool::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signa Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_LEFT)); label->show(); - hbox->pack_start(*label, true, true); + hbox->pack_end(*label, true, true); - ParamBoolCheckButton * checkbox = new ParamBoolCheckButton(this, doc, node, changeSignal); + ParamBoolCheckButton * checkbox = Gtk::manage(new ParamBoolCheckButton(this, doc, node, changeSignal)); checkbox->show(); hbox->pack_start(*checkbox, false, false); @@ -162,4 +162,4 @@ ParamBool::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signa fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index 656e58c49..f17b45b4b 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -40,7 +40,9 @@ ParamDescription::ParamDescription (const gchar * name, const gchar * guitext, c if (defaultval != NULL) _value = g_strdup(defaultval); - + + _context = xml->attribute("msgctxt"); + return; } @@ -50,12 +52,21 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node { if (_gui_hidden) return NULL; - Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_value))); + Glib::ustring newguitext; + + if (_context != NULL) { + newguitext = g_dpgettext2(NULL, _context, _value); + } else { + newguitext = _(_value); + } + + Gtk::Label * label = Gtk::manage(new Gtk::Label(newguitext, Gtk::ALIGN_LEFT)); + label->set_line_wrap(); label->show(); Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); - hbox->pack_start(*label, true, true, 5); + hbox->pack_start(*label, true, true, 12); hbox->show(); return hbox; diff --git a/src/extension/param/description.h b/src/extension/param/description.h index c305ea6df..c56b5c21d 100644 --- a/src/extension/param/description.h +++ b/src/extension/param/description.h @@ -21,6 +21,7 @@ class ParamDescription : public Parameter { private: /** \brief Internal value. */ gchar * _value; + const gchar* _context; public: ParamDescription(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal); diff --git a/src/extension/param/enum.cpp b/src/extension/param/enum.cpp index 03c1f839b..9ed5aac16 100644 --- a/src/extension/param/enum.cpp +++ b/src/extension/param/enum.cpp @@ -63,12 +63,20 @@ ParamComboBox::ParamComboBox (const gchar * name, const gchar * guitext, const g Glib::ustring newguitext, newvalue; const char * contents = NULL; if (node->firstChild()) contents = node->firstChild()->content(); - if (contents != NULL) + if (contents != NULL) { // don't translate when 'item' but do translate when '_item' // NOTE: internal extensions use build_from_mem and don't need _item but // still need to include if are to be localized - newguitext = !strcmp(chname, INKSCAPE_EXTENSION_NS "_item") ? _(contents) : contents; - else + if (!strcmp(chname, INKSCAPE_EXTENSION_NS "_item")) { + if (node->attribute("msgctxt") != NULL) { + newguitext = g_dpgettext2(NULL, node->attribute("msgctxt"), contents); + } else { + newguitext = _(contents); + } + } else { + newguitext = contents; + } + } else continue; const char * val = node->attribute("value"); diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index 5dce0f9e3..62762b3bb 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -35,11 +35,11 @@ ParamFloat::ParamFloat (const gchar * name, const gchar * guitext, const gchar * const char * maxval = xml->attribute("max"); if (maxval != NULL) - _max = atof(maxval); + _max = g_ascii_strtod (maxval,NULL); const char * minval = xml->attribute("min"); if (minval != NULL) - _min = atof(minval); + _min = g_ascii_strtod (minval,NULL); _precision = 1; const char * precision = xml->attribute("precision"); diff --git a/src/extension/param/groupheader.cpp b/src/extension/param/groupheader.cpp new file mode 100755 index 000000000..abf5f8beb --- /dev/null +++ b/src/extension/param/groupheader.cpp @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2005-2010 Authors: + * Ted Gould <ted@gould.cx> + * Johan Engelen <johan@shouraizou.nl> * + * Nicolas Dufour <nicoduf@yahoo.fr> + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifdef linux // does the dollar sign need escaping when passed as string parameter? +# define ESCAPE_DOLLAR_COMMANDLINE +#endif + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + + +#include "groupheader.h" + +#include <gtkmm/adjustment.h> +#include <gtkmm/box.h> +#include <gtkmm/spinbutton.h> +#include <sstream> +#include <glibmm/i18n.h> + +#include "xml/node.h" +#include "extension/extension.h" + +namespace Inkscape { +namespace Extension { + + +/** \brief Initialize the object, to do that, copy the data. */ +ParamGroupHeader::ParamGroupHeader (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) : + Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), _value(NULL) +{ + // printf("Building GroupHeader\n"); + const char * defaultval = NULL; + if (sp_repr_children(xml) != NULL) + defaultval = sp_repr_children(xml)->content(); + + if (defaultval != NULL) + _value = g_strdup(defaultval); + + _context = xml->attribute("msgctxt"); + + return; +} + +/** \brief Create a label for the GroupHeader */ +Gtk::Widget * +ParamGroupHeader::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal<void> * /*changeSignal*/) +{ + if (_gui_hidden) return NULL; + + Glib::ustring newguitext; + + if (_context != NULL) { + newguitext = g_dpgettext2(NULL, _context, _value); + } else { + newguitext = _(_value); + } + + Gtk::Label * label = Gtk::manage(new Gtk::Label(Glib::ustring("<b>") +newguitext + Glib::ustring("</b>"), Gtk::ALIGN_LEFT)); + label->set_line_wrap(); + label->set_padding(0,5); + label->set_use_markup(true); + label->show(); + + Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); + hbox->pack_start(*label, true, true); + hbox->show(); + + return hbox; +} + +} /* namespace Extension */ +} /* namespace Inkscape */ diff --git a/src/extension/param/groupheader.h b/src/extension/param/groupheader.h new file mode 100755 index 000000000..94fe880f9 --- /dev/null +++ b/src/extension/param/groupheader.h @@ -0,0 +1,45 @@ +#ifndef __INK_EXTENSION_PARAMGROUPHEADER_H__ +#define __INK_EXTENSION_PARAMGROUPHEADER_H__ + +/* + * Copyright (C) 2005-2010 Authors: + * Ted Gould <ted@gould.cx> + * Johan Engelen <johan@shouraizou.nl> * + * Nicolas Dufour <nicoduf@yahoo.fr> + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include <gtkmm/widget.h> +#include <xml/node.h> +#include <document.h> +#include "parameter.h" + +namespace Inkscape { +namespace Extension { + +/** \brief A GroupLabel parameter */ +class ParamGroupHeader : public Parameter { +private: + /** \brief Internal value. */ + gchar * _value; + const gchar* _context; +public: + ParamGroupHeader(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); + Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal); +}; + +} /* namespace Extension */ +} /* namespace Inkscape */ + +#endif /* __INK_EXTENSION_PARAMGROUPHEADER_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 : diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index 301d54ed0..ae69d0661 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -169,4 +169,4 @@ ParamInt::string (std::string &string) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index 1c30b7e0e..86e3cefe6 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -210,8 +210,8 @@ ParamNotebookPage::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sig Parameter * param = reinterpret_cast<Parameter *>(list->data); Gtk::Widget * widg = param->get_widget(doc, node, changeSignal); gchar const * tip = param->get_tooltip(); - - vbox->pack_start(*widg, true, true, 2); +// printf("Tip: '%s'\n", tip); + vbox->pack_start(*widg, false, false, 2); if (tip != NULL) { _tooltips->set_tip(*widg, Glib::ustring(tip)); } @@ -428,4 +428,4 @@ ParamNotebook::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::s fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index 3320cddca..1347653a2 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -35,6 +35,7 @@ #include "bool.h" #include "color.h" #include "description.h" +#include "groupheader.h" #include "enum.h" #include "float.h" #include "int.h" @@ -134,6 +135,8 @@ Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * } } else if (!strcmp(type, "description")) { param = new ParamDescription(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr); + } else if (!strcmp(type, "groupheader")) { + param = new ParamGroupHeader(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr); } else if (!strcmp(type, "enum")) { param = new ParamComboBox(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr); } else if (!strcmp(type, "notebook")) { @@ -294,7 +297,7 @@ Parameter::Parameter (const gchar * name, const gchar * guitext, const gchar * d } if (desc != NULL) { _desc = g_strdup(desc); - // printf("Adding description: '%s' on '%s'\n", _desc, _name); +// printf("Adding description: '%s' on '%s'\n", _desc, _name); } if (gui_tip != NULL) { _gui_tip = g_strdup(gui_tip); @@ -315,6 +318,7 @@ Parameter::~Parameter (void) g_free(_name); g_free(_text); g_free(_gui_tip); + g_free(_desc); } /** \brief Build the name to write the parameter from the extension's @@ -419,4 +423,4 @@ Glib::ustring const extension_pref_root = "/extensions/"; fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/param/parameter.h b/src/extension/param/parameter.h index c62dad9cc..beddf5936 100644 --- a/src/extension/param/parameter.h +++ b/src/extension/param/parameter.h @@ -136,4 +136,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index c17839001..23655baea 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -84,12 +84,22 @@ ParamRadioButton::ParamRadioButton (const gchar * name, Glib::ustring * newvalue = NULL; const char * contents = sp_repr_children(child_repr)->content(); - if (contents != NULL) - // don't translate when 'option' but do translate when '_option' - newguitext = new Glib::ustring( !strcmp(chname, INKSCAPE_EXTENSION_NS "_option") ? _(contents) : contents ); - else + if (contents != NULL) { + // don't translate when 'item' but do translate when '_option' + if (!strcmp(chname, INKSCAPE_EXTENSION_NS "_option")) { + if (child_repr->attribute("msgctxt") != NULL) { + newguitext = new Glib::ustring(g_dpgettext2(NULL, child_repr->attribute("msgctxt"), contents)); + } else { + newguitext = new Glib::ustring(_(contents)); + } + } else { + newguitext = new Glib::ustring(contents); + } + } else continue; + + const char * val = child_repr->attribute("value"); if (val != NULL) newvalue = new Glib::ustring(val); diff --git a/src/extension/script/InkscapeScript.cpp b/src/extension/script/InkscapeScript.cpp index d492cb100..ec9b5a8f9 100644 --- a/src/extension/script/InkscapeScript.cpp +++ b/src/extension/script/InkscapeScript.cpp @@ -220,4 +220,4 @@ bool InkscapeScript::interpretFile(const Glib::ustring &fname, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extension/script/InkscapeScript.h b/src/extension/script/InkscapeScript.h index 98508e4e6..c4a59e1e2 100644 --- a/src/extension/script/InkscapeScript.h +++ b/src/extension/script/InkscapeScript.h @@ -98,4 +98,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extract-uri-test.h b/src/extract-uri-test.h index aa96fa249..e795960a9 100644 --- a/src/extract-uri-test.h +++ b/src/extract-uri-test.h @@ -85,4 +85,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extract-uri.cpp b/src/extract-uri.cpp index 858027010..76778bacb 100644 --- a/src/extract-uri.cpp +++ b/src/extract-uri.cpp @@ -93,4 +93,4 @@ gchar *extract_uri( gchar const *s, gchar const** endptr ) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/extract-uri.h b/src/extract-uri.h index 1975d9b3a..b41a2b9d9 100644 --- a/src/extract-uri.h +++ b/src/extract-uri.h @@ -17,4 +17,4 @@ gchar *extract_uri(gchar const *s, gchar const** endptr = 0); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/file.cpp b/src/file.cpp index b6bc4c876..5a79cdbaf 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -30,8 +30,6 @@ #include <glib/gmem.h> #include <glibmm/i18n.h> -#include "application/application.h" -#include "application/editor.h" #include "desktop.h" #include "desktop-handles.h" #include "dialogs/export.h" @@ -125,19 +123,14 @@ sp_file_new(const Glib::ustring &templ) g_return_val_if_fail(doc != NULL, NULL); SPDesktop *dt; - if (Inkscape::NSApplication::Application::getNewGui()) - { - dt = Inkscape::NSApplication::Editor::createDesktop (doc); - } else { - SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); - g_return_val_if_fail(dtw != NULL, NULL); - sp_document_unref(doc); + SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); + g_return_val_if_fail(dtw != NULL, NULL); + sp_document_unref(doc); - sp_create_window(dtw, TRUE); - dt = static_cast<SPDesktop*>(dtw->view); - sp_namedview_window_from_document(dt); - sp_namedview_update_layers_from_document(dt); - } + sp_create_window(dtw, TRUE); + dt = static_cast<SPDesktop*>(dtw->view); + sp_namedview_window_from_document(dt); + sp_namedview_update_layers_from_document(dt); #ifdef WITH_DBUS Inkscape::Extension::Dbus::dbus_init_desktop_interface(dt); @@ -246,14 +239,10 @@ sp_file_open(const Glib::ustring &uri, desktop->change_document(doc); sp_document_resized_signal_emit (doc, sp_document_width(doc), sp_document_height(doc)); } else { - if (!Inkscape::NSApplication::Application::getNewGui()) { - // create a whole new desktop and window - SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); - sp_create_window(dtw, TRUE); - desktop = static_cast<SPDesktop*>(dtw->view); - } else { - desktop = Inkscape::NSApplication::Editor::createDesktop (doc); - } + // create a whole new desktop and window + SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); + sp_create_window(dtw, TRUE); + desktop = static_cast<SPDesktop*>(dtw->view); } doc->virgin = FALSE; diff --git a/src/filter-chemistry.cpp b/src/filter-chemistry.cpp index 0361f9276..9f8f63906 100644 --- a/src/filter-chemistry.cpp +++ b/src/filter-chemistry.cpp @@ -491,4 +491,4 @@ double get_single_gaussian_blur_radius(SPFilter *filter) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filter-chemistry.h b/src/filter-chemistry.h index 67531d630..9f16419fd 100644 --- a/src/filter-chemistry.h +++ b/src/filter-chemistry.h @@ -41,4 +41,4 @@ double get_single_gaussian_blur_radius(SPFilter *filter); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filter-enums.cpp b/src/filter-enums.cpp index 459272842..2f6d2f64b 100644 --- a/src/filter-enums.cpp +++ b/src/filter-enums.cpp @@ -48,13 +48,11 @@ const EnumDataConverter<FilterPrimitiveInput> FPInputConverter(FPInputData, FPIN // feBlend const EnumData<Inkscape::Filters::FilterBlendMode> BlendModeData[Inkscape::Filters::BLEND_ENDMODE] = { - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - {Inkscape::Filters::BLEND_NORMAL, Q_("filterBlendMode|Normal"), "normal"}, - {Inkscape::Filters::BLEND_MULTIPLY, _("Multiply"), "multiply"}, - {Inkscape::Filters::BLEND_SCREEN, _("Screen"), "screen"}, - {Inkscape::Filters::BLEND_DARKEN, _("Darken"), "darken"}, - {Inkscape::Filters::BLEND_LIGHTEN, _("Lighten"), "lighten"} + {Inkscape::Filters::BLEND_NORMAL, C_("Filter blend mode", "Normal"), "normal"}, + {Inkscape::Filters::BLEND_MULTIPLY, C_("Filter blend mode", "Multiply"), "multiply"}, + {Inkscape::Filters::BLEND_SCREEN, C_("Filter blend mode", "Screen"), "screen"}, + {Inkscape::Filters::BLEND_DARKEN, C_("Filter blend mode", "Darken"), "darken"}, + {Inkscape::Filters::BLEND_LIGHTEN, C_("Filter blend mode", "Lighten"), "lighten"} }; const EnumDataConverter<Inkscape::Filters::FilterBlendMode> BlendModeConverter(BlendModeData, Inkscape::Filters::BLEND_ENDMODE); @@ -137,4 +135,4 @@ const EnumDataConverter<LightSource> LightSourceConverter(LightSourceData, LIGHT fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filter-enums.h b/src/filter-enums.h index 6367a5102..3ced5ab94 100644 --- a/src/filter-enums.h +++ b/src/filter-enums.h @@ -85,4 +85,4 @@ extern const Inkscape::Util::EnumDataConverter<LightSource> LightSourceConverter fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/blend.cpp b/src/filters/blend.cpp index 795cbff20..870a50537 100644 --- a/src/filters/blend.cpp +++ b/src/filters/blend.cpp @@ -299,4 +299,4 @@ static void sp_feBlend_build_renderer(SPFilterPrimitive *primitive, Inkscape::Fi fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/blend.h b/src/filters/blend.h index 4fd763166..e7fc410e7 100644 --- a/src/filters/blend.h +++ b/src/filters/blend.h @@ -47,4 +47,4 @@ GType sp_feBlend_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/colormatrix.cpp b/src/filters/colormatrix.cpp index 07567cce6..a2d7aefb4 100644 --- a/src/filters/colormatrix.cpp +++ b/src/filters/colormatrix.cpp @@ -228,4 +228,4 @@ static void sp_feColorMatrix_build_renderer(SPFilterPrimitive *primitive, Inksca fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/colormatrix.h b/src/filters/colormatrix.h index 71c19db4d..8eb750ac1 100644 --- a/src/filters/colormatrix.h +++ b/src/filters/colormatrix.h @@ -46,4 +46,4 @@ GType sp_feColorMatrix_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/componenttransfer-funcnode.cpp b/src/filters/componenttransfer-funcnode.cpp index 8edb9cf2d..2fad81797 100644 --- a/src/filters/componenttransfer-funcnode.cpp +++ b/src/filters/componenttransfer-funcnode.cpp @@ -342,4 +342,4 @@ TODO: I'm not sure what to do here... fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/componenttransfer-funcnode.h b/src/filters/componenttransfer-funcnode.h index 52873f6d3..d81e50577 100644 --- a/src/filters/componenttransfer-funcnode.h +++ b/src/filters/componenttransfer-funcnode.h @@ -69,4 +69,4 @@ GType sp_fefuncA_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/componenttransfer.cpp b/src/filters/componenttransfer.cpp index 4853ab8cd..4d9541203 100644 --- a/src/filters/componenttransfer.cpp +++ b/src/filters/componenttransfer.cpp @@ -260,4 +260,4 @@ static void sp_feComponentTransfer_build_renderer(SPFilterPrimitive *primitive, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/componenttransfer.h b/src/filters/componenttransfer.h index be66d5a82..2df64009f 100644 --- a/src/filters/componenttransfer.h +++ b/src/filters/componenttransfer.h @@ -48,4 +48,4 @@ GType sp_feComponentTransfer_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/composite.cpp b/src/filters/composite.cpp index 0c534e01d..2d0ebeda5 100644 --- a/src/filters/composite.cpp +++ b/src/filters/composite.cpp @@ -346,4 +346,4 @@ static void sp_feComposite_build_renderer(SPFilterPrimitive *primitive, Inkscape fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/composite.h b/src/filters/composite.h index 126d8e71b..3eb62716f 100644 --- a/src/filters/composite.h +++ b/src/filters/composite.h @@ -57,4 +57,4 @@ GType sp_feComposite_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/convolvematrix.cpp b/src/filters/convolvematrix.cpp index 4444b82ce..319fe1654 100644 --- a/src/filters/convolvematrix.cpp +++ b/src/filters/convolvematrix.cpp @@ -343,4 +343,4 @@ static void sp_feConvolveMatrix_build_renderer(SPFilterPrimitive *primitive, Ink fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/convolvematrix.h b/src/filters/convolvematrix.h index 11120698d..4c5261e05 100644 --- a/src/filters/convolvematrix.h +++ b/src/filters/convolvematrix.h @@ -58,4 +58,4 @@ GType sp_feConvolveMatrix_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/diffuselighting.cpp b/src/filters/diffuselighting.cpp index 59b00d183..76179d560 100644 --- a/src/filters/diffuselighting.cpp +++ b/src/filters/diffuselighting.cpp @@ -384,4 +384,4 @@ static void sp_feDiffuseLighting_build_renderer(SPFilterPrimitive *primitive, In fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/diffuselighting.h b/src/filters/diffuselighting.h index 0cb62c5a7..a23346622 100644 --- a/src/filters/diffuselighting.h +++ b/src/filters/diffuselighting.h @@ -61,4 +61,4 @@ GType sp_feDiffuseLighting_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/displacementmap.cpp b/src/filters/displacementmap.cpp index cfa8e427e..1c874a8c3 100644 --- a/src/filters/displacementmap.cpp +++ b/src/filters/displacementmap.cpp @@ -312,4 +312,4 @@ static void sp_feDisplacementMap_build_renderer(SPFilterPrimitive *primitive, In fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/displacementmap.h b/src/filters/displacementmap.h index 414b3e663..6232f0937 100644 --- a/src/filters/displacementmap.h +++ b/src/filters/displacementmap.h @@ -54,4 +54,4 @@ GType sp_feDisplacementMap_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/distantlight.cpp b/src/filters/distantlight.cpp index de33d967e..d4b59074d 100644 --- a/src/filters/distantlight.cpp +++ b/src/filters/distantlight.cpp @@ -231,4 +231,4 @@ sp_fedistantlight_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/distantlight.h b/src/filters/distantlight.h index 21edbc56c..a68746334 100644 --- a/src/filters/distantlight.h +++ b/src/filters/distantlight.h @@ -56,4 +56,4 @@ sp_fedistantlight_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/flood.cpp b/src/filters/flood.cpp index 8b7d4c5cd..ff60e34ee 100644 --- a/src/filters/flood.cpp +++ b/src/filters/flood.cpp @@ -244,4 +244,4 @@ static void sp_feFlood_build_renderer(SPFilterPrimitive *primitive, Inkscape::Fi fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/flood.h b/src/filters/flood.h index 220faca83..0083def70 100644 --- a/src/filters/flood.h +++ b/src/filters/flood.h @@ -47,4 +47,4 @@ GType sp_feFlood_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/gaussian-blur.cpp b/src/filters/gaussian-blur.cpp index 3f7cea0c9..28e3bb6a3 100644 --- a/src/filters/gaussian-blur.cpp +++ b/src/filters/gaussian-blur.cpp @@ -209,4 +209,4 @@ static void sp_gaussianBlur_build_renderer(SPFilterPrimitive *primitive, Inkscap fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/gaussian-blur.h b/src/filters/gaussian-blur.h index 5607080fe..417f8a6f4 100644 --- a/src/filters/gaussian-blur.h +++ b/src/filters/gaussian-blur.h @@ -48,4 +48,4 @@ void sp_gaussianBlur_setDeviation(SPGaussianBlur *blur, float num, float optnum fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/image.cpp b/src/filters/image.cpp index eb6dfc22a..69a4b6018 100644 --- a/src/filters/image.cpp +++ b/src/filters/image.cpp @@ -274,4 +274,4 @@ static void sp_feImage_build_renderer(SPFilterPrimitive *primitive, Inkscape::Fi fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/image.h b/src/filters/image.h index a8fb65d6a..a66e6c4c5 100644 --- a/src/filters/image.h +++ b/src/filters/image.h @@ -54,4 +54,4 @@ GType sp_feImage_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/merge.cpp b/src/filters/merge.cpp index 798b7dfcc..dacfb7e91 100644 --- a/src/filters/merge.cpp +++ b/src/filters/merge.cpp @@ -198,4 +198,4 @@ static void sp_feMerge_build_renderer(SPFilterPrimitive *primitive, Inkscape::Fi fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/merge.h b/src/filters/merge.h index c28eaa1f6..3243073ca 100644 --- a/src/filters/merge.h +++ b/src/filters/merge.h @@ -42,4 +42,4 @@ GType sp_feMerge_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/mergenode.cpp b/src/filters/mergenode.cpp index 4ff569364..b532d961c 100644 --- a/src/filters/mergenode.cpp +++ b/src/filters/mergenode.cpp @@ -175,4 +175,4 @@ sp_feMergeNode_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::X fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/mergenode.h b/src/filters/mergenode.h index 8ec00bdcd..8352632a6 100644 --- a/src/filters/mergenode.h +++ b/src/filters/mergenode.h @@ -46,4 +46,4 @@ GType sp_feMergeNode_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/morphology.cpp b/src/filters/morphology.cpp index f6f9dc609..3d791daa8 100644 --- a/src/filters/morphology.cpp +++ b/src/filters/morphology.cpp @@ -223,4 +223,4 @@ static void sp_feMorphology_build_renderer(SPFilterPrimitive *primitive, Inkscap fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/morphology.h b/src/filters/morphology.h index 01eb2f59b..b7005a3d9 100644 --- a/src/filters/morphology.h +++ b/src/filters/morphology.h @@ -47,4 +47,4 @@ GType sp_feMorphology_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/offset.cpp b/src/filters/offset.cpp index b436fd0fb..58dd249a5 100644 --- a/src/filters/offset.cpp +++ b/src/filters/offset.cpp @@ -207,4 +207,4 @@ static void sp_feOffset_build_renderer(SPFilterPrimitive *primitive, Inkscape::F fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/offset.h b/src/filters/offset.h index 5319ff84e..dba7ed8ef 100644 --- a/src/filters/offset.h +++ b/src/filters/offset.h @@ -44,4 +44,4 @@ GType sp_feOffset_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/pointlight.cpp b/src/filters/pointlight.cpp index 5bb662c0f..b9625b33e 100644 --- a/src/filters/pointlight.cpp +++ b/src/filters/pointlight.cpp @@ -256,4 +256,4 @@ sp_fepointlight_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape:: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/pointlight.h b/src/filters/pointlight.h index 915d726af..c0b272021 100644 --- a/src/filters/pointlight.h +++ b/src/filters/pointlight.h @@ -61,4 +61,4 @@ sp_fepointlight_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/specularlighting.cpp b/src/filters/specularlighting.cpp index 2c38d6bda..77e90cd43 100644 --- a/src/filters/specularlighting.cpp +++ b/src/filters/specularlighting.cpp @@ -408,4 +408,4 @@ static void sp_feSpecularLighting_build_renderer(SPFilterPrimitive *primitive, I fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/specularlighting.h b/src/filters/specularlighting.h index 8d26b8cfe..90d1f9f62 100644 --- a/src/filters/specularlighting.h +++ b/src/filters/specularlighting.h @@ -63,4 +63,4 @@ GType sp_feSpecularLighting_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/spotlight.cpp b/src/filters/spotlight.cpp index 10815cfb1..51685c330 100644 --- a/src/filters/spotlight.cpp +++ b/src/filters/spotlight.cpp @@ -369,4 +369,4 @@ sp_fespotlight_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::X fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/spotlight.h b/src/filters/spotlight.h index d48cf6daa..6e2463c08 100644 --- a/src/filters/spotlight.h +++ b/src/filters/spotlight.h @@ -75,4 +75,4 @@ sp_fespotlight_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/tile.cpp b/src/filters/tile.cpp index c87d78554..d4e4ac890 100644 --- a/src/filters/tile.cpp +++ b/src/filters/tile.cpp @@ -185,4 +185,4 @@ static void sp_feTile_build_renderer(SPFilterPrimitive *primitive, Inkscape::Fil fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/tile.h b/src/filters/tile.h index 45c43213d..a376a6e10 100644 --- a/src/filters/tile.h +++ b/src/filters/tile.h @@ -44,4 +44,4 @@ GType sp_feTile_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/turbulence.cpp b/src/filters/turbulence.cpp index eed056ecc..268eca643 100644 --- a/src/filters/turbulence.cpp +++ b/src/filters/turbulence.cpp @@ -279,4 +279,4 @@ static void sp_feTurbulence_build_renderer(SPFilterPrimitive *primitive, Inkscap fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/filters/turbulence.h b/src/filters/turbulence.h index e9403a164..cbc4fb082 100644 --- a/src/filters/turbulence.h +++ b/src/filters/turbulence.h @@ -55,4 +55,4 @@ GType sp_feTurbulence_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/flood-context.cpp b/src/flood-context.cpp index 9e78c8d52..37f3e10ec 100644 --- a/src/flood-context.cpp +++ b/src/flood-context.cpp @@ -253,10 +253,10 @@ GList * flood_channels_dropdown_items_list() { GList * flood_autogap_dropdown_items_list() { GList *glist = NULL; - glist = g_list_append (glist, _("None")); - glist = g_list_append (glist, _("Small")); - glist = g_list_append (glist, _("Medium")); - glist = g_list_append (glist, _("Large")); + glist = g_list_append (glist, (void*) C_("Flood autogap", "None")); + glist = g_list_append (glist, (void*) C_("Flood autogap", "Small")); + glist = g_list_append (glist, (void*) C_("Flood autogap", "Medium")); + glist = g_list_append (glist, (void*) C_("Flood autogap", "Large")); return glist; } @@ -1292,4 +1292,4 @@ void flood_channels_set_channels( gint channels ) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/gc-alloc.h b/src/gc-alloc.h index 83811c0b3..a552ff6d2 100644 --- a/src/gc-alloc.h +++ b/src/gc-alloc.h @@ -86,4 +86,4 @@ bool operator!=(Alloc<T1, collect1> const &, Alloc<T2, collect2> const &) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/gc-anchored.cpp b/src/gc-anchored.cpp index 91055c968..0350e6bdd 100644 --- a/src/gc-anchored.cpp +++ b/src/gc-anchored.cpp @@ -92,4 +92,4 @@ void Anchored::release() const { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/gc-anchored.h b/src/gc-anchored.h index 917930a96..b15d11f5d 100644 --- a/src/gc-anchored.h +++ b/src/gc-anchored.h @@ -176,4 +176,4 @@ static R *release(R *r) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/gc-core.h b/src/gc-core.h index af327dc55..32779c83f 100644 --- a/src/gc-core.h +++ b/src/gc-core.h @@ -211,4 +211,4 @@ inline void operator delete[](void *mem, Inkscape::GC::Delete) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/gc-finalized.cpp b/src/gc-finalized.cpp index 5b9aa3c80..88685ae52 100644 --- a/src/gc-finalized.cpp +++ b/src/gc-finalized.cpp @@ -61,4 +61,4 @@ void Finalized::_invoke_dtor(void *base, void *offset) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/gc-finalized.h b/src/gc-finalized.h index cf47cb09b..4e09d6f8b 100644 --- a/src/gc-finalized.h +++ b/src/gc-finalized.h @@ -142,4 +142,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/gc-managed.h b/src/gc-managed.h index 954c8103b..74d224c9b 100644 --- a/src/gc-managed.h +++ b/src/gc-managed.h @@ -60,4 +60,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/gc-soft-ptr.h b/src/gc-soft-ptr.h index 539eac678..f83a0808d 100644 --- a/src/gc-soft-ptr.h +++ b/src/gc-soft-ptr.h @@ -68,4 +68,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/gc.cpp b/src/gc.cpp index ee988afbb..97350daff 100644 --- a/src/gc.cpp +++ b/src/gc.cpp @@ -300,4 +300,4 @@ void request_early_collection() { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index 24e4b534c..7d0498947 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -1271,4 +1271,4 @@ SPGradient *sp_gradient_vector_for_object( SPDocument *const doc, SPDesktop *con fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/gradient-chemistry.h b/src/gradient-chemistry.h index 0c8d0afe7..5e4a7b337 100644 --- a/src/gradient-chemistry.h +++ b/src/gradient-chemistry.h @@ -89,4 +89,4 @@ void sp_item_gradient_reverse_vector (SPItem *item, bool fill_or_stroke); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp index de4de7d5d..9aec46d5f 100644 --- a/src/gradient-context.cpp +++ b/src/gradient-context.cpp @@ -557,6 +557,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event) SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop); m.freeSnapReturnByRef(button_dt, Inkscape::SNAPSOURCE_NODE_HANDLE); + m.unSetup(); rc->origin = from_2geom(button_dt); } @@ -597,7 +598,9 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event) Geom::Point const motion_w(event->motion.x, event->motion.y); Geom::Point const motion_dt = event_context->desktop->w2d(motion_w); + m.preSnap(Inkscape::SnapCandidatePoint(motion_dt, Inkscape::SNAPSOURCE_NODE_HANDLE)); + m.unSetup(); } bool over_line = false; @@ -946,4 +949,4 @@ static void sp_gradient_drag(SPGradientContext &rc, Geom::Point const pt, guint fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/gradient-context.h b/src/gradient-context.h index 6f8a804ae..0e1059ee9 100644 --- a/src/gradient-context.h +++ b/src/gradient-context.h @@ -65,4 +65,4 @@ void sp_gradient_context_select_prev (SPEventContext *event_context); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index e7536a86a..d5ab64794 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -568,22 +568,6 @@ SPObject *GrDraggable::getServer() return server; } -static -boost::optional<Geom::Point> -get_snap_vector (Geom::Point p, Geom::Point o, double snap, double initial) -{ - double r = L2 (p - o); - if (r < 1e-3) { - return boost::optional<Geom::Point>(); - } - - double angle = atan2 (p - o); - // snap angle to snaps increments, starting from initial: - double a_snapped = initial + floor((angle - initial)/snap + 0.5) * snap; - // calculate the new position and subtract p to get the vector: - return (o + r * Geom::Point(cos(a_snapped), sin(a_snapped)) - p); -} - static void gr_knot_moved_handler(SPKnot *knot, Geom::Point const &ppointer, guint state, gpointer data) { @@ -645,15 +629,17 @@ gr_knot_moved_handler(SPKnot *knot, Geom::Point const &ppointer, guint state, gp } } - m.setup(desktop); if (!((state & GDK_SHIFT_MASK) || (state & GDK_CONTROL_MASK))) { + m.setup(desktop); Inkscape::SnappedPoint s = m.freeSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_OTHER_HANDLE)); + m.unSetup(); if (s.getSnapped()) { p = s.getPoint(); sp_knot_moveto (knot, p); } } else if (state & GDK_CONTROL_MASK) { SnappedConstraints sc; + Inkscape::SnapCandidatePoint scp = Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_OTHER_HANDLE); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); unsigned snaps = abs(prefs->getInt("/options/rotationsnapsperpi/value", 12)); /* 0 means no snapping. */ @@ -699,36 +685,38 @@ gr_knot_moved_handler(SPKnot *knot, Geom::Point const &ppointer, guint state, gp dr_snap = dragger->point_original; } - boost::optional<Geom::Point> snap_vector; + // dr_snap contains the origin of the gradient, whereas p will be the new endpoint which we will try to snap now + Inkscape::SnappedPoint sp; if (dr_snap.isFinite()) { + m.setup(desktop); if (state & GDK_MOD1_MASK) { // with Alt, snap to the original angle and its perpendiculars - snap_vector = get_snap_vector (p, dr_snap, M_PI/2, Geom::atan2 (dragger->point_original - dr_snap)); + sp = m.constrainedAngularSnap(scp, dragger->point_original, dr_snap, 2); } else { // with Ctrl, snap to M_PI/snaps - snap_vector = get_snap_vector (p, dr_snap, M_PI/snaps, 0); - } - if (snap_vector) { - Inkscape::Snapper::SnapConstraint cl(dr_snap, p + *snap_vector - dr_snap); - Inkscape::SnappedPoint s = m.constrainedSnap(Inkscape::SnapCandidatePoint(p + *snap_vector, Inkscape::SNAPSOURCE_OTHER_HANDLE), cl); - if (s.getSnapped()) { - s.setTransformation(s.getPoint() - p); - sc.points.push_back(s); - } else { - Inkscape::SnappedPoint dummy(p + *snap_vector, Inkscape::SNAPSOURCE_OTHER_HANDLE, 0, Inkscape::SNAPTARGET_CONSTRAINED_ANGLE, Geom::L2(*snap_vector), 10000, true, true, false); - dummy.setTransformation(*snap_vector); - sc.points.push_back(dummy); - } + sp = m.constrainedAngularSnap(scp, boost::optional<Geom::Point>(), dr_snap, snaps); } + m.unSetup(); + sc.points.push_back(sp); } } - Inkscape::SnappedPoint bsp = m.findBestSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_OTHER_HANDLE), sc, true); // snap indicator will be displayed if needed - - if (bsp.getSnapped()) { - p += bsp.getTransformation(); - sp_knot_moveto (knot, p); + m.setup(desktop, false); // turn of the snap indicator temporarily + Inkscape::SnappedPoint bsp = m.findBestSnap(scp, sc, true); + m.unSetup(); + if (!bsp.getSnapped()) { + // If we didn't truly snap to an object or to a grid, then we will still have to look for the + // closest projection onto one of the constraints. findBestSnap() will not do this for us + for (std::list<Inkscape::SnappedPoint>::const_iterator i = sc.points.begin(); i != sc.points.end(); i++) { + if (i == sc.points.begin() || (Geom::L2((*i).getPoint() - p) < Geom::L2(bsp.getPoint() - p))) { + bsp.setPoint((*i).getPoint()); + bsp.setTarget(Inkscape::SNAPTARGET_CONSTRAINED_ANGLE); + } + } } + //p = sc.points.front().getPoint(); + p = bsp.getPoint(); + sp_knot_moveto (knot, p); } drag->keep_selection = (bool) g_list_find(drag->selected, dragger); @@ -864,6 +852,7 @@ gr_knot_moved_midpoint_handler(SPKnot */*knot*/, Geom::Point const &ppointer, gu SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop); m.constrainedSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE, cl); + m.unSetup(); } } Geom::Point displacement = p - dragger->point; diff --git a/src/graphlayout.cpp b/src/graphlayout.cpp index a89af10af..0905cd94c 100644 --- a/src/graphlayout.cpp +++ b/src/graphlayout.cpp @@ -259,4 +259,4 @@ void graphlayout(GSList const *const items) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/help.h b/src/help.h index ab1008257..35f67a714 100644 --- a/src/help.h +++ b/src/help.h @@ -31,4 +31,4 @@ void sp_help_open_tutorial(GtkMenuItem *menuitem, gpointer data); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/helper-fns.h b/src/helper-fns.h index 2c2db92c4..05e65fea8 100644 --- a/src/helper-fns.h +++ b/src/helper-fns.h @@ -129,4 +129,4 @@ inline std::vector<gdouble> helperfns_read_vector(const gchar* value){ fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/helper/action.h b/src/helper/action.h index c4367df62..14a91b453 100644 --- a/src/helper/action.h +++ b/src/helper/action.h @@ -91,4 +91,4 @@ Inkscape::UI::View::View *sp_action_get_view(SPAction *action); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/helper/geom-curves.h b/src/helper/geom-curves.h index 7c181832c..f927634d8 100644 --- a/src/helper/geom-curves.h +++ b/src/helper/geom-curves.h @@ -53,4 +53,4 @@ inline bool is_straight_curve(Geom::Curve const & c) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/helper/geom-nodetype.cpp b/src/helper/geom-nodetype.cpp index 17266ad31..f570fc9ae 100644 --- a/src/helper/geom-nodetype.cpp +++ b/src/helper/geom-nodetype.cpp @@ -59,4 +59,4 @@ NodeType get_nodetype(Curve const &c_incoming, Curve const &c_outgoing) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/helper/geom-nodetype.h b/src/helper/geom-nodetype.h index 932ba6d84..1a0d33b9d 100644 --- a/src/helper/geom-nodetype.h +++ b/src/helper/geom-nodetype.h @@ -51,4 +51,4 @@ NodeType get_nodetype(Curve const &c_incoming, Curve const &c_outgoing); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/helper/geom.cpp b/src/helper/geom.cpp index da5d09436..7b8c5d57f 100644 --- a/src/helper/geom.cpp +++ b/src/helper/geom.cpp @@ -539,4 +539,4 @@ Geom::Matrix GEOM_MATRIX_IDENTITY = Geom::identity(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/helper/geom.h b/src/helper/geom.h index adf167392..73f95794f 100644 --- a/src/helper/geom.h +++ b/src/helper/geom.h @@ -49,4 +49,4 @@ bool matrix_equalp(Geom::Matrix const &m0, Geom::Matrix const &m1, Geom::Coord c fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/helper/gnome-utils.h b/src/helper/gnome-utils.h index 0a28c95a9..1a087433e 100644 --- a/src/helper/gnome-utils.h +++ b/src/helper/gnome-utils.h @@ -33,4 +33,4 @@ GList *gnome_uri_list_extract_filenames(gchar const *uri_list); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/helper/helper-forward.h b/src/helper/helper-forward.h index 7cb0cddea..f9b7f985b 100644 --- a/src/helper/helper-forward.h +++ b/src/helper/helper-forward.h @@ -32,4 +32,4 @@ struct SPUnitSelectorClass; fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp index 8439115cb..baf621348 100644 --- a/src/helper/pixbuf-ops.cpp +++ b/src/helper/pixbuf-ops.cpp @@ -181,4 +181,4 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp index fe7017d3e..83e4ce0cb 100644 --- a/src/helper/png-write.cpp +++ b/src/helper/png-write.cpp @@ -508,4 +508,4 @@ sp_export_png_file(SPDocument *doc, gchar const *filename, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/helper/unit-menu.cpp b/src/helper/unit-menu.cpp index 66fee95de..e4ff09829 100644 --- a/src/helper/unit-menu.cpp +++ b/src/helper/unit-menu.cpp @@ -372,4 +372,4 @@ sp_unit_selector_set_value_in_pixels(SPUnitSelector *selector, GtkAdjustment *ad fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/helper/unit-menu.h b/src/helper/unit-menu.h index bf5bb260e..b3ab8836c 100644 --- a/src/helper/unit-menu.h +++ b/src/helper/unit-menu.h @@ -56,4 +56,4 @@ void sp_unit_selector_set_value_in_pixels(SPUnitSelector *selector, GtkAdjustmen fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/helper/unit-tracker.cpp b/src/helper/unit-tracker.cpp index ac860f955..3f5a72e6a 100644 --- a/src/helper/unit-tracker.cpp +++ b/src/helper/unit-tracker.cpp @@ -264,4 +264,4 @@ void UnitTracker::_fixupAdjustments( SPUnit const* oldUnit, SPUnit const *newUni fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/helper/unit-tracker.h b/src/helper/unit-tracker.h index 30cbdabe0..0f333b2ec 100644 --- a/src/helper/unit-tracker.h +++ b/src/helper/unit-tracker.h @@ -73,4 +73,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/helper/units-test.h b/src/helper/units-test.h index e54c9d2f9..05bc75eff 100644 --- a/src/helper/units-test.h +++ b/src/helper/units-test.h @@ -87,4 +87,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/helper/units.cpp b/src/helper/units.cpp index 47c4746ac..7914feeb3 100644 --- a/src/helper/units.cpp +++ b/src/helper/units.cpp @@ -260,4 +260,4 @@ angle_from_compass(double angle) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/helper/window.h b/src/helper/window.h index 7f06fe423..36b91a813 100644 --- a/src/helper/window.h +++ b/src/helper/window.h @@ -37,4 +37,4 @@ Gtk::Window *window_new (const gchar *title, unsigned int resizeable); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/id-clash.h b/src/id-clash.h index 418642738..a76bf5137 100644 --- a/src/id-clash.h +++ b/src/id-clash.h @@ -16,4 +16,4 @@ void prevent_id_clashes(SPDocument *imported_doc, SPDocument *current_doc); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/inkscape-private.h b/src/inkscape-private.h index cb7f98729..2cb83ae76 100644 --- a/src/inkscape-private.h +++ b/src/inkscape-private.h @@ -65,4 +65,4 @@ void inkscape_set_color (SPColor *color, float opacity); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/inkscape-version.h b/src/inkscape-version.h index 41fbc4c8c..791351184 100644 --- a/src/inkscape-version.h +++ b/src/inkscape-version.h @@ -31,4 +31,4 @@ extern gchar const *version_string; ///< Full version string fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/inkscape.cpp b/src/inkscape.cpp index c10581a91..8b31ba267 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -45,8 +45,6 @@ using Inkscape::Extension::Internal::PrintWin32; #include <gtkmm/messagedialog.h> #include <signal.h> #include <string> -#include "application/application.h" -#include "application/editor.h" #include "desktop.h" #include "desktop-handles.h" #include "device-manager.h" @@ -93,8 +91,6 @@ enum { # FORWARD DECLARATIONS ################################*/ -gboolean inkscape_app_use_gui( Inkscape::Application const * app ); - static void inkscape_class_init (Inkscape::ApplicationClass *klass); static void inkscape_init (SPObject *object); static void inkscape_dispose (GObject *object); @@ -741,7 +737,7 @@ inkscape_crash_handler (int /*signum*/) } *(b + pos) = '\0'; - if ( inkscape_get_instance() && inkscape_app_use_gui( inkscape_get_instance() ) ) { + if ( inkscape_get_instance() && inkscape_use_gui() ) { GtkWidget *msgbox = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", b); gtk_dialog_run (GTK_DIALOG (msgbox)); gtk_widget_destroy (msgbox); @@ -861,9 +857,9 @@ inkscape_get_instance() return inkscape; } -gboolean inkscape_app_use_gui( Inkscape::Application const * app ) +gboolean inkscape_use_gui() { - return app->use_gui; + return inkscape_get_instance()->use_gui; } /** @@ -893,10 +889,6 @@ bool inkscape_load_menus (Inkscape::Application */*inkscape*/) void inkscape_selection_modified (Inkscape::Selection *selection, guint flags) { - if (Inkscape::NSApplication::Application::getNewGui()) { - Inkscape::NSApplication::Editor::selectionModified (selection, flags); - return; - } g_return_if_fail (selection != NULL); if (DESKTOP_IS_ACTIVE (selection->desktop())) { @@ -908,10 +900,6 @@ inkscape_selection_modified (Inkscape::Selection *selection, guint flags) void inkscape_selection_changed (Inkscape::Selection * selection) { - if (Inkscape::NSApplication::Application::getNewGui()) { - Inkscape::NSApplication::Editor::selectionChanged (selection); - return; - } g_return_if_fail (selection != NULL); if (DESKTOP_IS_ACTIVE (selection->desktop())) { @@ -922,10 +910,6 @@ inkscape_selection_changed (Inkscape::Selection * selection) void inkscape_subselection_changed (SPDesktop *desktop) { - if (Inkscape::NSApplication::Application::getNewGui()) { - Inkscape::NSApplication::Editor::subSelectionChanged (desktop); - return; - } g_return_if_fail (desktop != NULL); if (DESKTOP_IS_ACTIVE (desktop)) { @@ -937,10 +921,6 @@ inkscape_subselection_changed (SPDesktop *desktop) void inkscape_selection_set (Inkscape::Selection * selection) { - if (Inkscape::NSApplication::Application::getNewGui()) { - Inkscape::NSApplication::Editor::selectionSet (selection); - return; - } g_return_if_fail (selection != NULL); if (DESKTOP_IS_ACTIVE (selection->desktop())) { @@ -953,10 +933,6 @@ inkscape_selection_set (Inkscape::Selection * selection) void inkscape_eventcontext_set (SPEventContext * eventcontext) { - if (Inkscape::NSApplication::Application::getNewGui()) { - Inkscape::NSApplication::Editor::eventContextSet (eventcontext); - return; - } g_return_if_fail (eventcontext != NULL); g_return_if_fail (SP_IS_EVENT_CONTEXT (eventcontext)); @@ -970,12 +946,6 @@ void inkscape_add_desktop (SPDesktop * desktop) { g_return_if_fail (desktop != NULL); - - if (Inkscape::NSApplication::Application::getNewGui()) - { - Inkscape::NSApplication::Editor::addDesktop (desktop); - return; - } g_return_if_fail (inkscape != NULL); g_assert (!g_slist_find (inkscape->desktops, desktop)); @@ -994,11 +964,6 @@ void inkscape_remove_desktop (SPDesktop * desktop) { g_return_if_fail (desktop != NULL); - if (Inkscape::NSApplication::Application::getNewGui()) - { - Inkscape::NSApplication::Editor::removeDesktop (desktop); - return; - } g_return_if_fail (inkscape != NULL); g_assert (g_slist_find (inkscape->desktops, desktop)); @@ -1034,11 +999,6 @@ void inkscape_activate_desktop (SPDesktop * desktop) { g_return_if_fail (desktop != NULL); - if (Inkscape::NSApplication::Application::getNewGui()) - { - Inkscape::NSApplication::Editor::activateDesktop (desktop); - return; - } g_return_if_fail (inkscape != NULL); if (DESKTOP_IS_ACTIVE (desktop)) { @@ -1068,11 +1028,6 @@ void inkscape_reactivate_desktop (SPDesktop * desktop) { g_return_if_fail (desktop != NULL); - if (Inkscape::NSApplication::Application::getNewGui()) - { - Inkscape::NSApplication::Editor::reactivateDesktop (desktop); - return; - } g_return_if_fail (inkscape != NULL); if (DESKTOP_IS_ACTIVE (desktop)) @@ -1186,13 +1141,8 @@ inkscape_switch_desktops_prev () void inkscape_dialogs_hide () { - if (Inkscape::NSApplication::Application::getNewGui()) - Inkscape::NSApplication::Editor::hideDialogs(); - else - { - g_signal_emit (G_OBJECT (inkscape), inkscape_signals[DIALOGS_HIDE], 0); - inkscape->dialogs_toggle = FALSE; - } + g_signal_emit (G_OBJECT (inkscape), inkscape_signals[DIALOGS_HIDE], 0); + inkscape->dialogs_toggle = FALSE; } @@ -1200,13 +1150,8 @@ inkscape_dialogs_hide () void inkscape_dialogs_unhide () { - if (Inkscape::NSApplication::Application::getNewGui()) - Inkscape::NSApplication::Editor::unhideDialogs(); - else - { - g_signal_emit (G_OBJECT (inkscape), inkscape_signals[DIALOGS_UNHIDE], 0); - inkscape->dialogs_toggle = TRUE; - } + g_signal_emit (G_OBJECT (inkscape), inkscape_signals[DIALOGS_UNHIDE], 0); + inkscape->dialogs_toggle = TRUE; } @@ -1237,24 +1182,17 @@ inkscape_add_document (SPDocument *document) { g_return_if_fail (document != NULL); - if (!Inkscape::NSApplication::Application::getNewGui()) - { - // try to insert the pair into the list - if (!(inkscape->document_set.insert(std::make_pair(document, 1)).second)) { - //insert failed, this key (document) is already in the list - for (std::map<SPDocument*,int>::iterator iter = inkscape->document_set.begin(); - iter != inkscape->document_set.end(); - ++iter) { - if (iter->first == document) { - // found this document in list, increase its count - iter->second ++; - } - } - } - } - else - { - Inkscape::NSApplication::Editor::addDocument (document); + // try to insert the pair into the list + if (!(inkscape->document_set.insert(std::make_pair(document, 1)).second)) { + //insert failed, this key (document) is already in the list + for (std::map<SPDocument*,int>::iterator iter = inkscape->document_set.begin(); + iter != inkscape->document_set.end(); + ++iter) { + if (iter->first == document) { + // found this document in list, increase its count + iter->second ++; + } + } } } @@ -1265,28 +1203,21 @@ inkscape_remove_document (SPDocument *document) { g_return_val_if_fail (document != NULL, false); - if (!Inkscape::NSApplication::Application::getNewGui()) - { - for (std::map<SPDocument*,int>::iterator iter = inkscape->document_set.begin(); - iter != inkscape->document_set.end(); - ++iter) { - if (iter->first == document) { - // found this document in list, decrease its count - iter->second --; - if (iter->second < 1) { - // this was the last one, remove the pair from list - inkscape->document_set.erase (iter); - return true; - } else { - return false; - } + for (std::map<SPDocument*,int>::iterator iter = inkscape->document_set.begin(); + iter != inkscape->document_set.end(); + ++iter) { + if (iter->first == document) { + // found this document in list, decrease its count + iter->second --; + if (iter->second < 1) { + // this was the last one, remove the pair from list + inkscape->document_set.erase (iter); + return true; + } else { + return false; } } } - else - { - Inkscape::NSApplication::Editor::removeDocument (document); - } return false; } @@ -1294,9 +1225,6 @@ inkscape_remove_document (SPDocument *document) SPDesktop * inkscape_active_desktop (void) { - if (Inkscape::NSApplication::Application::getNewGui()) - return Inkscape::NSApplication::Editor::getActiveDesktop(); - if (inkscape->desktops == NULL) { return NULL; } @@ -1307,9 +1235,6 @@ inkscape_active_desktop (void) SPDocument * inkscape_active_document (void) { - if (Inkscape::NSApplication::Application::getNewGui()) - return Inkscape::NSApplication::Editor::getActiveDocument(); - if (SP_ACTIVE_DESKTOP) { return sp_desktop_document (SP_ACTIVE_DESKTOP); } diff --git a/src/inkscape.h b/src/inkscape.h index d82092754..d9de54782 100644 --- a/src/inkscape.h +++ b/src/inkscape.h @@ -41,6 +41,7 @@ bool inkscape_save_menus (Inkscape::Application * inkscape); Inkscape::XML::Node *inkscape_get_menus (Inkscape::Application * inkscape); Inkscape::Application *inkscape_get_instance(); +gboolean inkscape_use_gui(); SPDesktop * inkscape_find_desktop_by_dkey (unsigned int dkey); @@ -94,4 +95,4 @@ void inkscape_exit (Inkscape::Application *inkscape); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/inkscape.rc b/src/inkscape.rc index 9163658f0..08746aa77 100644 --- a/src/inkscape.rc +++ b/src/inkscape.rc @@ -3,8 +3,8 @@ APPLICATION_ICON ICON DISCARDABLE "../inkscape.ico" 1 24 DISCARDABLE "./inkscape-manifest.xml" 1 VERSIONINFO - FILEVERSION 0,47,0,9 - PRODUCTVERSION 0,47,0,9 + FILEVERSION 0,48,0,9 + PRODUCTVERSION 0,48,0,9 BEGIN BLOCK "StringFileInfo" BEGIN @@ -13,11 +13,11 @@ BEGIN VALUE "Comments", "Published under the GNU GPL" VALUE "CompanyName", "inkscape.org" VALUE "FileDescription", "Inkscape" - VALUE "FileVersion", "0.47+devel" + VALUE "FileVersion", "0.48+devel" VALUE "InternalName", "Inkscape" - VALUE "LegalCopyright", "© 2009 Inkscape" + VALUE "LegalCopyright", "© 2010 Inkscape" VALUE "ProductName", "Inkscape" - VALUE "ProductVersion", "0.47+devel" + VALUE "ProductVersion", "0.48+devel" END END BLOCK "VarFileInfo" diff --git a/src/inkview.rc b/src/inkview.rc index 390f4fb07..b2d3da7bc 100644 --- a/src/inkview.rc +++ b/src/inkview.rc @@ -3,8 +3,8 @@ APPLICATION_ICON ICON DISCARDABLE "../inkscape.ico" 1 24 DISCARDABLE "./inkview-manifest.xml"
1 VERSIONINFO
- FILEVERSION 0,47,0,9
- PRODUCTVERSION 0,47,0,9
+ FILEVERSION 0,48,0,9
+ PRODUCTVERSION 0,48,0,9
BEGIN
BLOCK "StringFileInfo"
BEGIN
@@ -13,11 +13,11 @@ BEGIN VALUE "Comments", "Published under the GNU GPL"
VALUE "CompanyName", "inkscape.org"
VALUE "FileDescription", "Inkview"
- VALUE "FileVersion", "0.47+devel"
+ VALUE "FileVersion", "0.48+devel"
VALUE "InternalName", "Inkview"
- VALUE "LegalCopyright", "© 2009 Inkscape"
+ VALUE "LegalCopyright", "© 2010 Inkscape"
VALUE "ProductName", "Inkview"
- VALUE "ProductVersion", "0.47+devel"
+ VALUE "ProductVersion", "0.48+devel"
END
END
BLOCK "VarFileInfo"
diff --git a/src/interface.cpp b/src/interface.cpp index 230fd8a60..471ecc458 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -456,85 +456,12 @@ sp_ui_menu_append_item( GtkMenu *menu, gchar const *stock, } // end of sp_ui_menu_append_item() -/** -\brief a wrapper around gdk_keyval_name producing (when possible) characters, not names - */ -static gchar const * -sp_key_name(guint keyval) -{ - /* TODO: Compare with the definition of gtk_accel_label_refetch in gtk/gtkaccellabel.c (or - simply use GtkAccelLabel as the TODO comment in sp_ui_shortcut_string suggests). */ - gchar const *n = gdk_keyval_name(gdk_keyval_to_upper(keyval)); - - if (!strcmp(n, "asciicircum")) return "^"; - else if (!strcmp(n, "parenleft" )) return "("; - else if (!strcmp(n, "parenright" )) return ")"; - else if (!strcmp(n, "plus" )) return "+"; - else if (!strcmp(n, "minus" )) return "-"; - else if (!strcmp(n, "asterisk" )) return "*"; - else if (!strcmp(n, "KP_Multiply")) return "*"; - else if (!strcmp(n, "Delete" )) return "Del"; - else if (!strcmp(n, "Page_Up" )) return "PgUp"; - else if (!strcmp(n, "Page_Down" )) return "PgDn"; - else if (!strcmp(n, "grave" )) return "`"; - else if (!strcmp(n, "numbersign" )) return "#"; - else if (!strcmp(n, "bar" )) return "|"; - else if (!strcmp(n, "slash" )) return "/"; - else if (!strcmp(n, "exclam" )) return "!"; - else if (!strcmp(n, "percent" )) return "%"; - else return n; -} - - -/** - * \param shortcut A GDK keyval OR'd with SP_SHORTCUT_blah_MASK values. - * \param c Points to a buffer at least 256 bytes long. - */ -void -sp_ui_shortcut_string(unsigned const shortcut, gchar *const c) -{ - /* TODO: This function shouldn't exist. Our callers should use GtkAccelLabel instead of - * a generic GtkLabel containing this string, and should call gtk_widget_add_accelerator. - * Will probably need to change sp_shortcut_invoke callers. - * - * The existing gtk_label_new_with_mnemonic call can be replaced with - * g_object_new(GTK_TYPE_ACCEL_LABEL, NULL) followed by - * gtk_label_set_text_with_mnemonic(lbl, str). - */ - static GtkAccelLabelClass const &accel_lbl_cls - = *(GtkAccelLabelClass const *) g_type_class_peek_static(GTK_TYPE_ACCEL_LABEL); - - struct { unsigned test; char const *name; } const modifier_tbl[] = { - { SP_SHORTCUT_SHIFT_MASK, accel_lbl_cls.mod_name_shift }, - { SP_SHORTCUT_CONTROL_MASK, accel_lbl_cls.mod_name_control }, - { SP_SHORTCUT_ALT_MASK, accel_lbl_cls.mod_name_alt } - }; - - gchar *p = c; - gchar *end = p + 256; - - for (unsigned i = 0; i < G_N_ELEMENTS(modifier_tbl); ++i) { - if ((shortcut & modifier_tbl[i].test) - && (p < end)) - { - p += g_snprintf(p, end - p, "%s%s", - modifier_tbl[i].name, - accel_lbl_cls.mod_separator); - } - } - if (p < end) { - p += g_snprintf(p, end - p, "%s", sp_key_name(shortcut & 0xffffff)); - } - end[-1] = '\0'; // snprintf doesn't guarantee to nul-terminate the string. -} - void sp_ui_dialog_title_string(Inkscape::Verb *verb, gchar *c) { SPAction *action; unsigned int shortcut; gchar *s; - gchar key[256]; gchar *atitle; action = verb->get_action(NULL); @@ -548,11 +475,12 @@ sp_ui_dialog_title_string(Inkscape::Verb *verb, gchar *c) g_free(atitle); shortcut = sp_shortcut_get_primary(verb); - if (shortcut) { + if (shortcut!=GDK_VoidSymbol) { + gchar* key = sp_shortcut_get_label(shortcut); s = g_stpcpy(s, " ("); - sp_ui_shortcut_string(shortcut, key); s = g_stpcpy(s, key); s = g_stpcpy(s, ")"); + g_free(key); } } @@ -582,9 +510,8 @@ sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb *verb, Inkscape:: if (!action) return NULL; shortcut = sp_shortcut_get_primary(verb); - if (shortcut) { - gchar c[256]; - sp_ui_shortcut_string(shortcut, c); + if (shortcut!=GDK_VoidSymbol) { + gchar* c = sp_shortcut_get_label(shortcut); GtkWidget *const hb = gtk_hbox_new(FALSE, 16); GtkWidget *const name_lbl = gtk_label_new(""); gtk_label_set_markup_with_mnemonic(GTK_LABEL(name_lbl), action->name); @@ -600,6 +527,7 @@ sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb *verb, Inkscape:: item = gtk_image_menu_item_new(); } gtk_container_add((GtkContainer *) item, hb); + g_free(c); } else { if (radio) { item = gtk_radio_menu_item_new (group); @@ -754,9 +682,8 @@ sp_ui_menu_append_check_item_from_verb(GtkMenu *menu, Inkscape::UI::View::View * SPAction *action = (verb) ? verb->get_action(view) : 0; GtkWidget *item = gtk_check_menu_item_new(); - if (verb && shortcut) { - gchar c[256]; - sp_ui_shortcut_string(shortcut, c); + if (verb && shortcut!=GDK_VoidSymbol) { + gchar* c = sp_shortcut_get_label(shortcut); GtkWidget *hb = gtk_hbox_new(FALSE, 16); @@ -775,6 +702,7 @@ sp_ui_menu_append_check_item_from_verb(GtkMenu *menu, Inkscape::UI::View::View * gtk_widget_show_all(hb); gtk_container_add((GtkContainer *) item, hb); + g_free(c); } else { GtkWidget *l = gtk_label_new_with_mnemonic(action ? action->name : label); gtk_misc_set_alignment((GtkMisc *) l, 0.0, 0.5); @@ -1677,4 +1605,4 @@ sp_ui_menu_item_set_name(SPAction */*action*/, Glib::ustring name, void *data) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/interface.h b/src/interface.h index 099fdd277..30fda6a39 100644 --- a/src/interface.h +++ b/src/interface.h @@ -69,8 +69,6 @@ void sp_ui_dialog_title_string (Inkscape::Verb * verb, gchar* c); void sp_ui_error_dialog (const gchar * message); bool sp_ui_overwrite_file (const gchar * filename); -void sp_ui_shortcut_string (unsigned int shortcut, gchar* c); - #endif /* @@ -82,4 +80,4 @@ void sp_ui_shortcut_string (unsigned int shortcut, gchar* c); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/io/resource.cpp b/src/io/resource.cpp index 1f6f8459c..8c76c7132 100644 --- a/src/io/resource.cpp +++ b/src/io/resource.cpp @@ -106,4 +106,4 @@ Util::ptr_shared<char> get_path(Domain domain, Type type, char const *filename) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/io/resource.h b/src/io/resource.h index a5269899f..be3ff21b7 100644 --- a/src/io/resource.h +++ b/src/io/resource.h @@ -63,4 +63,4 @@ Util::ptr_shared<char> get_path(Domain domain, Type type, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/io/simple-sax.cpp b/src/io/simple-sax.cpp index d8733858b..33e7b72bf 100644 --- a/src/io/simple-sax.cpp +++ b/src/io/simple-sax.cpp @@ -1491,4 +1491,4 @@ void FlatSaxHandler::_characters(const xmlChar *ch, int len) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/jabber_whiteboard/defines.cpp b/src/jabber_whiteboard/defines.cpp index ad0641260..fc56618bf 100644 --- a/src/jabber_whiteboard/defines.cpp +++ b/src/jabber_whiteboard/defines.cpp @@ -113,4 +113,4 @@ char const* DOCUMENT_NAMEDVIEW_NAME = "sodipodi:namedview"; fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/jabber_whiteboard/defines.h b/src/jabber_whiteboard/defines.h index a9bc80ca6..975ea18ca 100644 --- a/src/jabber_whiteboard/defines.h +++ b/src/jabber_whiteboard/defines.h @@ -259,4 +259,4 @@ extern char const* DOCUMENT_NAMEDVIEW_NAME; fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/jabber_whiteboard/dialog/choose-desktop.cpp b/src/jabber_whiteboard/dialog/choose-desktop.cpp index 862b6cb33..d46fd0161 100644 --- a/src/jabber_whiteboard/dialog/choose-desktop.cpp +++ b/src/jabber_whiteboard/dialog/choose-desktop.cpp @@ -104,4 +104,4 @@ bool ChooseDesktop::doSetup() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/jabber_whiteboard/inkboard-document.h b/src/jabber_whiteboard/inkboard-document.h index a4a82c6fb..69d92a751 100644 --- a/src/jabber_whiteboard/inkboard-document.h +++ b/src/jabber_whiteboard/inkboard-document.h @@ -164,4 +164,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/jabber_whiteboard/inkboard-node.cpp b/src/jabber_whiteboard/inkboard-node.cpp index 4d24cf72a..f64d0f212 100644 --- a/src/jabber_whiteboard/inkboard-node.cpp +++ b/src/jabber_whiteboard/inkboard-node.cpp @@ -147,4 +147,4 @@ InkboardDocument::changeNew(Glib::ustring parentid, Glib::ustring id, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/jabber_whiteboard/invitation-confirm-dialog.cpp b/src/jabber_whiteboard/invitation-confirm-dialog.cpp index 77fd75fcd..7530f58aa 100644 --- a/src/jabber_whiteboard/invitation-confirm-dialog.cpp +++ b/src/jabber_whiteboard/invitation-confirm-dialog.cpp @@ -65,4 +65,4 @@ InvitationConfirmDialog::_construct() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/jabber_whiteboard/invitation-confirm-dialog.h b/src/jabber_whiteboard/invitation-confirm-dialog.h index ea83bf0f7..4143e8866 100644 --- a/src/jabber_whiteboard/invitation-confirm-dialog.h +++ b/src/jabber_whiteboard/invitation-confirm-dialog.h @@ -64,4 +64,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/jabber_whiteboard/message-verifier.h b/src/jabber_whiteboard/message-verifier.h index 48ef01b4d..c7dca9958 100644 --- a/src/jabber_whiteboard/message-verifier.h +++ b/src/jabber_whiteboard/message-verifier.h @@ -44,4 +44,4 @@ enum MessageValidityTestResult { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/jabber_whiteboard/session-file-selector.h b/src/jabber_whiteboard/session-file-selector.h index e0c7965c3..ed6101ac5 100644 --- a/src/jabber_whiteboard/session-file-selector.h +++ b/src/jabber_whiteboard/session-file-selector.h @@ -56,4 +56,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/jabber_whiteboard/session-manager.cpp b/src/jabber_whiteboard/session-manager.cpp index a04ab05f0..0dcd744c3 100644 --- a/src/jabber_whiteboard/session-manager.cpp +++ b/src/jabber_whiteboard/session-manager.cpp @@ -29,9 +29,6 @@ #include "ui/view/view-widget.h" -#include "application/application.h" -#include "application/editor.h" - #include "document-private.h" #include "interface.h" #include "sp-namedview.h" @@ -386,20 +383,14 @@ makeInkboardDesktop(SPDocument* doc) { SPDesktop* dt; - if (NSApplication::Application::getNewGui()) - dt = NSApplication::Editor::createDesktop(doc); + SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); + g_return_val_if_fail(dtw != NULL, NULL); + sp_document_unref(doc); - else - { - SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); - g_return_val_if_fail(dtw != NULL, NULL); - sp_document_unref(doc); - - sp_create_window(dtw, TRUE); - dt = static_cast<SPDesktop*>(dtw->view); - sp_namedview_window_from_document(dt); - sp_namedview_update_layers_from_document(dt); - } + sp_create_window(dtw, TRUE); + dt = static_cast<SPDesktop*>(dtw->view); + sp_namedview_window_from_document(dt); + sp_namedview_update_layers_from_document(dt); return dt; } @@ -418,4 +409,4 @@ makeInkboardDesktop(SPDocument* doc) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/jabber_whiteboard/session-manager.h b/src/jabber_whiteboard/session-manager.h index 53cc8f5b4..ce57cc425 100644 --- a/src/jabber_whiteboard/session-manager.h +++ b/src/jabber_whiteboard/session-manager.h @@ -138,4 +138,4 @@ SPDesktop* makeInkboardDesktop(SPDocument* doc); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/knot-enums.h b/src/knot-enums.h index 708d3e19b..e82810242 100644 --- a/src/knot-enums.h +++ b/src/knot-enums.h @@ -55,4 +55,4 @@ enum { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/knot-holder-entity.cpp b/src/knot-holder-entity.cpp index 0ae7b8dc6..c4a22d28f 100644 --- a/src/knot-holder-entity.cpp +++ b/src/knot-holder-entity.cpp @@ -93,8 +93,8 @@ KnotHolderEntity::snap_knot_position(Geom::Point const &p) SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop, true, item); - m.freeSnapReturnByRef(s, Inkscape::SNAPSOURCE_NODE_HANDLE); + m.unSetup(); return s * i2d.inverse(); } @@ -109,22 +109,11 @@ KnotHolderEntity::snap_knot_position_constrained(Geom::Point const &p, Inkscape: m.setup(desktop, true, item); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if ((prefs->getBool("/options/snapmousepointer/value", false))) { // legacy behavior (pre v0.47) - // Snapping the mouse pointer instead of the constrained position of the knot allows to snap to - // things which don't intersect with the constraint line. This should be handled by the - // smart dynamic guides which are yet to be implemented, making this behavior more clean and - // transparent. With the current implementation it leads to unexpected results, and it doesn't - // allow accurately controlling what is being snapped to. - - // freeSnap() will try snapping point p. This will not take into account the constraint, which - // is therefore to be enforced after snap_knot_position_constrained() has finished - m.freeSnapReturnByRef(s, Inkscape::SNAPSOURCE_NODE_HANDLE); - } else { - // constrainedSnap() will first project the point p onto the constraint line and then try to snap along that line. - // This way the constraint is already enforced, no need to worry about that later on - Inkscape::Snapper::SnapConstraint transformed_constraint = Inkscape::Snapper::SnapConstraint(constraint.getPoint() * i2d, (constraint.getPoint() + constraint.getDirection()) * i2d - constraint.getPoint() * i2d); - m.constrainedSnapReturnByRef(s, Inkscape::SNAPSOURCE_NODE_HANDLE, transformed_constraint); - } + // constrainedSnap() will first project the point p onto the constraint line and then try to snap along that line. + // This way the constraint is already enforced, no need to worry about that later on + Inkscape::Snapper::SnapConstraint transformed_constraint = Inkscape::Snapper::SnapConstraint(constraint.getPoint() * i2d, (constraint.getPoint() + constraint.getDirection()) * i2d - constraint.getPoint() * i2d); + m.constrainedSnapReturnByRef(s, Inkscape::SNAPSOURCE_NODE_HANDLE, transformed_constraint); + m.unSetup(); return s * i2d.inverse(); } @@ -283,4 +272,4 @@ PatternKnotHolderEntityScale::knot_get() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/knot-holder-entity.h b/src/knot-holder-entity.h index aba93798a..bd654616c 100644 --- a/src/knot-holder-entity.h +++ b/src/knot-holder-entity.h @@ -117,4 +117,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/knot.cpp b/src/knot.cpp index 10672e048..824f16c3e 100644 --- a/src/knot.cpp +++ b/src/knot.cpp @@ -447,7 +447,7 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot g_object_unref(knot); - return consumed; + return consumed || grabbed; } void sp_knot_handler_request_position(GdkEvent *event, SPKnot *knot) diff --git a/src/knot.h b/src/knot.h index 351c7f7be..32035d603 100644 --- a/src/knot.h +++ b/src/knot.h @@ -189,4 +189,4 @@ Geom::Point sp_knot_position(SPKnot const *knot); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/knotholder.cpp b/src/knotholder.cpp index 314ad807c..df5c1cad9 100644 --- a/src/knotholder.cpp +++ b/src/knotholder.cpp @@ -270,4 +270,4 @@ KnotHolder::add_pattern_knotholder() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/knotholder.h b/src/knotholder.h index 0b37d211c..76142ed98 100644 --- a/src/knotholder.h +++ b/src/knotholder.h @@ -83,4 +83,4 @@ void knot_ungrabbed_handler(SPKnot *knot, unsigned int state, KnotHolder *kh); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/layer-fns.cpp b/src/layer-fns.cpp index ca7c1c493..7cf582f7a 100644 --- a/src/layer-fns.cpp +++ b/src/layer-fns.cpp @@ -213,4 +213,4 @@ SPObject *create_layer(SPObject *root, SPObject *layer, LayerRelativePosition po fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/layer-fns.h b/src/layer-fns.h index c3e74c472..63b1147a6 100644 --- a/src/layer-fns.h +++ b/src/layer-fns.h @@ -40,4 +40,4 @@ SPObject *previous_layer(SPObject *root, SPObject *layer); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/layer-manager.cpp b/src/layer-manager.cpp index db7384622..1e1bb8c33 100644 --- a/src/layer-manager.cpp +++ b/src/layer-manager.cpp @@ -341,4 +341,4 @@ void LayerManager::_selectedLayerChanged(SPObject *layer) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/layer-manager.h b/src/layer-manager.h index 5b5d25eb2..fbb22d405 100644 --- a/src/layer-manager.h +++ b/src/layer-manager.h @@ -73,4 +73,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/in-svg-plane-test.h b/src/libnr/in-svg-plane-test.h index 304182fed..e64f76251 100644 --- a/src/libnr/in-svg-plane-test.h +++ b/src/libnr/in-svg-plane-test.h @@ -78,4 +78,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/in-svg-plane.h b/src/libnr/in-svg-plane.h index d184f45be..c1937f0fc 100644 --- a/src/libnr/in-svg-plane.h +++ b/src/libnr/in-svg-plane.h @@ -30,4 +30,4 @@ in_svg_plane(NR::Point const p) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-convert2geom.h b/src/libnr/nr-convert2geom.h index b0ce18c90..49871c1f6 100644 --- a/src/libnr/nr-convert2geom.h +++ b/src/libnr/nr-convert2geom.h @@ -51,4 +51,4 @@ inline Geom::OptRect to_2geom(boost::optional<NR::Rect> const & rect) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-coord.h b/src/libnr/nr-coord.h index 668e2b460..e094caeb3 100644 --- a/src/libnr/nr-coord.h +++ b/src/libnr/nr-coord.h @@ -26,4 +26,4 @@ typedef double Coord; fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-dim2.h b/src/libnr/nr-dim2.h index d06fd4227..c068bc220 100644 --- a/src/libnr/nr-dim2.h +++ b/src/libnr/nr-dim2.h @@ -19,4 +19,4 @@ enum Dim2 { X=0, Y }; fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-forward.h b/src/libnr/nr-forward.h index da4fe99df..82e29030c 100644 --- a/src/libnr/nr-forward.h +++ b/src/libnr/nr-forward.h @@ -35,4 +35,4 @@ struct NRRectL; fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-i-coord.h b/src/libnr/nr-i-coord.h index f87dea3d5..a19d2ca46 100644 --- a/src/libnr/nr-i-coord.h +++ b/src/libnr/nr-i-coord.h @@ -22,4 +22,4 @@ typedef gint32 ICoord; fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-point-fns-test.h b/src/libnr/nr-point-fns-test.h index 7d28c9c0e..df166660c 100644 --- a/src/libnr/nr-point-fns-test.h +++ b/src/libnr/nr-point-fns-test.h @@ -136,4 +136,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-point-fns.cpp b/src/libnr/nr-point-fns.cpp index 0142655f2..cd6d6927b 100644 --- a/src/libnr/nr-point-fns.cpp +++ b/src/libnr/nr-point-fns.cpp @@ -120,4 +120,4 @@ project_on_linesegment(NR::Point const p, NR::Point const p1, NR::Point const p2 fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-point-fns.h b/src/libnr/nr-point-fns.h index 9ef7205c6..05c4f718c 100644 --- a/src/libnr/nr-point-fns.h +++ b/src/libnr/nr-point-fns.h @@ -107,4 +107,4 @@ NR::Point project_on_linesegment(NR::Point const p, NR::Point const p1, NR::Poin fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-point-l.h b/src/libnr/nr-point-l.h index 4ae1a8b82..9bfe2c790 100644 --- a/src/libnr/nr-point-l.h +++ b/src/libnr/nr-point-l.h @@ -100,4 +100,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-point-ops.h b/src/libnr/nr-point-ops.h index 03d61fb15..aba981803 100644 --- a/src/libnr/nr-point-ops.h +++ b/src/libnr/nr-point-ops.h @@ -85,4 +85,4 @@ inline bool operator!=(Point const &a, Point const &b) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-point.h b/src/libnr/nr-point.h index 57a25c746..19add7dd1 100644 --- a/src/libnr/nr-point.h +++ b/src/libnr/nr-point.h @@ -152,4 +152,4 @@ inline std::ostream &operator<< (std::ostream &out_file, const NR::Point &in_pnt fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-rect-l.cpp b/src/libnr/nr-rect-l.cpp index 4f6c5c866..9d1f80988 100644 --- a/src/libnr/nr-rect-l.cpp +++ b/src/libnr/nr-rect-l.cpp @@ -27,4 +27,4 @@ IRect::IRect(Rect const &r) : fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-rect-l.h b/src/libnr/nr-rect-l.h index f21ba8fc6..3493fa8f4 100644 --- a/src/libnr/nr-rect-l.h +++ b/src/libnr/nr-rect-l.h @@ -138,4 +138,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-rect.h b/src/libnr/nr-rect.h index f64b04f72..aa5921309 100644 --- a/src/libnr/nr-rect.h +++ b/src/libnr/nr-rect.h @@ -311,4 +311,4 @@ NRRectL *nr_rect_l_enlarge(NRRectL *d, int amount); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-types-test.h b/src/libnr/nr-types-test.h index e472c2d29..77550351f 100644 --- a/src/libnr/nr-types-test.h +++ b/src/libnr/nr-types-test.h @@ -139,4 +139,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-types.cpp b/src/libnr/nr-types.cpp index 4da711cc0..0231c91d5 100644 --- a/src/libnr/nr-types.cpp +++ b/src/libnr/nr-types.cpp @@ -65,4 +65,4 @@ void NR::Point::normalize() { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-types.h b/src/libnr/nr-types.h index 3aff62d4a..685c29342 100644 --- a/src/libnr/nr-types.h +++ b/src/libnr/nr-types.h @@ -36,4 +36,4 @@ fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-values.h b/src/libnr/nr-values.h index 93b66b3a7..f85fca690 100644 --- a/src/libnr/nr-values.h +++ b/src/libnr/nr-values.h @@ -41,4 +41,4 @@ extern NR::Point const component_vectors[2]; fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index 067254b9e..41533e0ab 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -1102,4 +1102,4 @@ void font_factory::AddInCache(font_instance *who) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnrtype/FontFactory.h b/src/libnrtype/FontFactory.h index 632ea565f..9843ebcfb 100644 --- a/src/libnrtype/FontFactory.h +++ b/src/libnrtype/FontFactory.h @@ -160,4 +160,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnrtype/Layout-TNG-Compute.cpp b/src/libnrtype/Layout-TNG-Compute.cpp index 77e21ef56..7e684e7e3 100644 --- a/src/libnrtype/Layout-TNG-Compute.cpp +++ b/src/libnrtype/Layout-TNG-Compute.cpp @@ -1630,4 +1630,4 @@ bool Layout::calculateFlow() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnrtype/Layout-TNG-Output.cpp b/src/libnrtype/Layout-TNG-Output.cpp index 836b86939..7c941522d 100644 --- a/src/libnrtype/Layout-TNG-Output.cpp +++ b/src/libnrtype/Layout-TNG-Output.cpp @@ -598,4 +598,4 @@ void Layout::transform(Geom::Matrix const &transform) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnrtype/Layout-TNG-Scanline-Maker.h b/src/libnrtype/Layout-TNG-Scanline-Maker.h index f0783c149..d513d7cc1 100644 --- a/src/libnrtype/Layout-TNG-Scanline-Maker.h +++ b/src/libnrtype/Layout-TNG-Scanline-Maker.h @@ -166,4 +166,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnrtype/Layout-TNG.h b/src/libnrtype/Layout-TNG.h index 1f82aab97..833ddc6fd 100644 --- a/src/libnrtype/Layout-TNG.h +++ b/src/libnrtype/Layout-TNG.h @@ -1060,4 +1060,4 @@ inline bool Layout::iterator::prevCharacter() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnrtype/TextWrapper.cpp b/src/libnrtype/TextWrapper.cpp index c818bcab3..3de85fcdf 100644 --- a/src/libnrtype/TextWrapper.cpp +++ b/src/libnrtype/TextWrapper.cpp @@ -934,4 +934,4 @@ void text_wrapper::AddDxDy(void) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnrtype/TextWrapper.h b/src/libnrtype/TextWrapper.h index e3b3272a6..b4a3cc724 100644 --- a/src/libnrtype/TextWrapper.h +++ b/src/libnrtype/TextWrapper.h @@ -136,4 +136,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnrtype/boundary-type.h b/src/libnrtype/boundary-type.h index 27baf43b7..91d748de5 100644 --- a/src/libnrtype/boundary-type.h +++ b/src/libnrtype/boundary-type.h @@ -30,4 +30,4 @@ enum BoundaryType { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnrtype/font-lister.h b/src/libnrtype/font-lister.h index 13611caf7..23c8548fe 100644 --- a/src/libnrtype/font-lister.h +++ b/src/libnrtype/font-lister.h @@ -130,4 +130,4 @@ namespace Inkscape fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnrtype/font-style-to-pos.h b/src/libnrtype/font-style-to-pos.h index f58fdda3f..635c7378d 100644 --- a/src/libnrtype/font-style-to-pos.h +++ b/src/libnrtype/font-style-to-pos.h @@ -17,4 +17,4 @@ NRTypePosDef font_style_to_pos (SPStyle const &style); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnrtype/one-box.h b/src/libnrtype/one-box.h index 7e1d90b72..c868cf23f 100644 --- a/src/libnrtype/one-box.h +++ b/src/libnrtype/one-box.h @@ -26,5 +26,5 @@ struct one_box { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnrtype/one-glyph.h b/src/libnrtype/one-glyph.h index 9467e69e9..678a38585 100644 --- a/src/libnrtype/one-glyph.h +++ b/src/libnrtype/one-glyph.h @@ -46,4 +46,4 @@ struct one_glyph { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnrtype/one-para.h b/src/libnrtype/one-para.h index 60e59531f..a7c881563 100644 --- a/src/libnrtype/one-para.h +++ b/src/libnrtype/one-para.h @@ -17,4 +17,4 @@ struct one_para { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnrtype/text-boundary.h b/src/libnrtype/text-boundary.h index 82532df1f..accd89e5a 100644 --- a/src/libnrtype/text-boundary.h +++ b/src/libnrtype/text-boundary.h @@ -49,4 +49,4 @@ struct text_boundary { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/line-geometry.cpp b/src/line-geometry.cpp index d01b5db82..2e528f3af 100644 --- a/src/line-geometry.cpp +++ b/src/line-geometry.cpp @@ -229,4 +229,4 @@ void create_canvas_line(Geom::Point const &p1, Geom::Point const &p2, guint32 rg fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/line-snapper.cpp b/src/line-snapper.cpp index 19e6c0fe6..22a964d43 100644 --- a/src/line-snapper.cpp +++ b/src/line-snapper.cpp @@ -64,18 +64,22 @@ void Inkscape::LineSnapper::constrainedSnap(SnappedConstraints &sc, Inkscape::SnapCandidatePoint const &p, Geom::OptRect const &/*bbox_to_snap*/, SnapConstraint const &c, - std::vector<SPItem const *> const */*it*/) const + std::vector<SPItem const *> const */*it*/, + std::vector<SnapCandidatePoint> */*unselected_nodes*/) const { if (_snap_enabled == false || _snapmanager->snapprefs.getSnapFrom(p.getSourceType()) == false) { return; } + // project the mouse pointer onto the constraint. Only the projected point will be considered for snapping + Geom::Point pp = c.projection(p.getPoint()); + /* Get the lines that we will try to snap to */ - const LineList lines = _getSnapLines(p.getPoint()); + const LineList lines = _getSnapLines(pp); for (LineList::const_iterator i = lines.begin(); i != lines.end(); i++) { - Geom::Point const point_on_line = c.hasPoint() ? c.getPoint() : p.getPoint(); + Geom::Point const point_on_line = c.hasPoint() ? c.getPoint() : pp; Geom::Line gridguide_line(i->second, i->second + Geom::rot90(i->first)); if (c.isCircular()) { @@ -87,7 +91,7 @@ void Inkscape::LineSnapper::constrainedSnap(SnappedConstraints &sc, Geom::Coord radius = c.getRadius(); if (dist == radius) { // Only one point of intersection; - _addSnappedPoint(sc, p_proj, Geom::L2(p.getPoint() - p_proj), p.getSourceType(), p.getSourceNum(), true); + _addSnappedPoint(sc, p_proj, Geom::L2(pp - p_proj), p.getSourceType(), p.getSourceNum(), true); } else if (dist < radius) { // Two points of intersection, symmetrical with respect to the projected point // Calculate half the length of the linesegment between the two points of intersection diff --git a/src/line-snapper.h b/src/line-snapper.h index 4f3d17998..cdc45c286 100644 --- a/src/line-snapper.h +++ b/src/line-snapper.h @@ -35,7 +35,8 @@ public: Inkscape::SnapCandidatePoint const &p, Geom::OptRect const &bbox_to_snap, SnapConstraint const &c, - std::vector<SPItem const *> const *it) const; + std::vector<SPItem const *> const *it, + std::vector<SnapCandidatePoint> *unselected_nodes) const; protected: typedef std::list<std::pair<Geom::Point, Geom::Point> > LineList; diff --git a/src/livarot/AVL.cpp b/src/livarot/AVL.cpp index 7eb606db9..e8ece7f8c 100644 --- a/src/livarot/AVL.cpp +++ b/src/livarot/AVL.cpp @@ -962,4 +962,4 @@ void AVLTree::insertBetween(AVLTree *l, AVLTree *r) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/livarot/AVL.h b/src/livarot/AVL.h index 9bfe5b36d..cc0f095cc 100644 --- a/src/livarot/AVL.h +++ b/src/livarot/AVL.h @@ -92,4 +92,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/livarot/Livarot.h b/src/livarot/Livarot.h index 0218e0127..24a702423 100644 --- a/src/livarot/Livarot.h +++ b/src/livarot/Livarot.h @@ -31,4 +31,4 @@ fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/livarot/Path.h b/src/livarot/Path.h index 102840d54..19b1ab48c 100644 --- a/src/livarot/Path.h +++ b/src/livarot/Path.h @@ -401,4 +401,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/livarot/PathCutting.cpp b/src/livarot/PathCutting.cpp index 35e9cb687..112aabed7 100644 --- a/src/livarot/PathCutting.cpp +++ b/src/livarot/PathCutting.cpp @@ -1531,4 +1531,4 @@ void Path::ConvertPositionsToMoveTo(int nbPos,cut_position* poss) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/livarot/PathSimplify.cpp b/src/livarot/PathSimplify.cpp index c53dfa029..4ebed0efd 100644 --- a/src/livarot/PathSimplify.cpp +++ b/src/livarot/PathSimplify.cpp @@ -1394,4 +1394,4 @@ void Path::FlushPendingAddition(Path *dest, PathDescr *lastAddition, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/livarot/float-line.cpp b/src/livarot/float-line.cpp index 57d77e3a4..55fda019a 100644 --- a/src/livarot/float-line.cpp +++ b/src/livarot/float-line.cpp @@ -917,4 +917,4 @@ void FloatLigne::Over(FloatLigne *a, float tresh) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/livarot/float-line.h b/src/livarot/float-line.h index 473d08a19..2359db95c 100644 --- a/src/livarot/float-line.h +++ b/src/livarot/float-line.h @@ -133,4 +133,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/livarot/int-line.h b/src/livarot/int-line.h index 31567e637..afd4d2f04 100644 --- a/src/livarot/int-line.h +++ b/src/livarot/int-line.h @@ -104,4 +104,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/livarot/path-description.h b/src/livarot/path-description.h index 27521e4b8..68088c27c 100644 --- a/src/livarot/path-description.h +++ b/src/livarot/path-description.h @@ -173,4 +173,4 @@ struct PathDescrClose : public PathDescr fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/livarot/sweep-event-queue.h b/src/livarot/sweep-event-queue.h index 22b349abf..28bec9065 100644 --- a/src/livarot/sweep-event-queue.h +++ b/src/livarot/sweep-event-queue.h @@ -51,4 +51,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/livarot/sweep-event.cpp b/src/livarot/sweep-event.cpp index 88d895e6b..268d0e363 100644 --- a/src/livarot/sweep-event.cpp +++ b/src/livarot/sweep-event.cpp @@ -272,4 +272,4 @@ void SweepEvent::MakeDelete() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/livarot/sweep-event.h b/src/livarot/sweep-event.h index bb22eddcf..dab006101 100644 --- a/src/livarot/sweep-event.h +++ b/src/livarot/sweep-event.h @@ -42,4 +42,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/livarot/sweep-tree-list.cpp b/src/livarot/sweep-tree-list.cpp index 1d2dcec7d..bef6a1797 100644 --- a/src/livarot/sweep-tree-list.cpp +++ b/src/livarot/sweep-tree-list.cpp @@ -44,4 +44,4 @@ SweepTree *SweepTreeList::add(Shape *iSrc, int iBord, int iWeight, int iStartPoi fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/livarot/sweep-tree-list.h b/src/livarot/sweep-tree-list.h index b6e765e13..7ae7b1ab4 100644 --- a/src/livarot/sweep-tree-list.h +++ b/src/livarot/sweep-tree-list.h @@ -37,4 +37,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/livarot/sweep-tree.cpp b/src/livarot/sweep-tree.cpp index b932b1542..9ff1143ce 100644 --- a/src/livarot/sweep-tree.cpp +++ b/src/livarot/sweep-tree.cpp @@ -556,4 +556,4 @@ SweepTree::Avance(Shape */*dstPts*/, int /*curPoint*/, Shape */*a*/, Shape */*b* fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/livarot/sweep-tree.h b/src/livarot/sweep-tree.h index 7f6b827dc..4a2efe5ec 100644 --- a/src/livarot/sweep-tree.h +++ b/src/livarot/sweep-tree.h @@ -79,4 +79,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/live_effects/lpe-bendpath.cpp b/src/live_effects/lpe-bendpath.cpp index bc8477829..254500908 100644 --- a/src/live_effects/lpe-bendpath.cpp +++ b/src/live_effects/lpe-bendpath.cpp @@ -52,8 +52,8 @@ namespace LivePathEffect { LPEBendPath::LPEBendPath(LivePathEffectObject *lpeobject) : Effect(lpeobject), - bend_path(_("Bend path"), _("Path along which to bend the original path"), "bendpath", &wr, this, "M0,0 L1,0"), - prop_scale(_("Width"), _("Width of the path"), "prop_scale", &wr, this, 1), + bend_path(_("Bend path:"), _("Path along which to bend the original path"), "bendpath", &wr, this, "M0,0 L1,0"), + prop_scale(_("Width:"), _("Width of the path"), "prop_scale", &wr, this, 1), scale_y_rel(_("Width in units of length"), _("Scale the width of the path in units of its length"), "scale_y_rel", &wr, this, false), vertical_pattern(_("Original path is vertical"), _("Rotates the original 90 degrees, before bending it along the bend path"), "vertical", &wr, this, false) { diff --git a/src/live_effects/lpe-circle_with_radius.cpp b/src/live_effects/lpe-circle_with_radius.cpp index 71611e18b..4aec82377 100644 --- a/src/live_effects/lpe-circle_with_radius.cpp +++ b/src/live_effects/lpe-circle_with_radius.cpp @@ -83,4 +83,4 @@ LPECircleWithRadius::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & p fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/live_effects/lpe-circle_with_radius.h b/src/live_effects/lpe-circle_with_radius.h index 2b9494875..10f652771 100644 --- a/src/live_effects/lpe-circle_with_radius.h +++ b/src/live_effects/lpe-circle_with_radius.h @@ -51,4 +51,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/live_effects/lpe-constructgrid.cpp b/src/live_effects/lpe-constructgrid.cpp index 4c6555f2d..aee4c127a 100644 --- a/src/live_effects/lpe-constructgrid.cpp +++ b/src/live_effects/lpe-constructgrid.cpp @@ -23,8 +23,8 @@ using namespace Geom; LPEConstructGrid::LPEConstructGrid(LivePathEffectObject *lpeobject) : Effect(lpeobject), - nr_x(_("Size X"), _("The size of the grid in X direction."), "nr_x", &wr, this, 5), - nr_y(_("Size Y"), _("The size of the grid in Y direction."), "nr_y", &wr, this, 5) + nr_x(_("Size X:"), _("The size of the grid in X direction."), "nr_x", &wr, this, 5), + nr_y(_("Size Y:"), _("The size of the grid in Y direction."), "nr_y", &wr, this, 5) { registerParameter( dynamic_cast<Parameter *>(&nr_x) ); registerParameter( dynamic_cast<Parameter *>(&nr_y) ); diff --git a/src/live_effects/lpe-curvestitch.cpp b/src/live_effects/lpe-curvestitch.cpp index 9e02a3975..9e9488ce5 100644 --- a/src/live_effects/lpe-curvestitch.cpp +++ b/src/live_effects/lpe-curvestitch.cpp @@ -39,13 +39,13 @@ using namespace Geom; LPECurveStitch::LPECurveStitch(LivePathEffectObject *lpeobject) : Effect(lpeobject), - strokepath(_("Stitch path"), _("The path that will be used as stitch."), "strokepath", &wr, this, "M0,0 L1,0"), - nrofpaths(_("Number of paths"), _("The number of paths that will be generated."), "count", &wr, this, 5), - startpoint_edge_variation(_("Start edge variance"), _("The amount of random jitter to move the start points of the stitches inside & outside the guide path"), "startpoint_edge_variation", &wr, this, 0), - startpoint_spacing_variation(_("Start spacing variance"), _("The amount of random shifting to move the start points of the stitches back & forth along the guide path"), "startpoint_spacing_variation", &wr, this, 0), - endpoint_edge_variation(_("End edge variance"), _("The amount of randomness that moves the end points of the stitches inside & outside the guide path"), "endpoint_edge_variation", &wr, this, 0), - endpoint_spacing_variation(_("End spacing variance"), _("The amount of random shifting to move the end points of the stitches back & forth along the guide path"), "endpoint_spacing_variation", &wr, this, 0), - prop_scale(_("Scale width"), _("Scale the width of the stitch path"), "prop_scale", &wr, this, 1), + strokepath(_("Stitch path:"), _("The path that will be used as stitch."), "strokepath", &wr, this, "M0,0 L1,0"), + nrofpaths(_("Number of paths:"), _("The number of paths that will be generated."), "count", &wr, this, 5), + startpoint_edge_variation(_("Start edge variance:"), _("The amount of random jitter to move the start points of the stitches inside & outside the guide path"), "startpoint_edge_variation", &wr, this, 0), + startpoint_spacing_variation(_("Start spacing variance:"), _("The amount of random shifting to move the start points of the stitches back & forth along the guide path"), "startpoint_spacing_variation", &wr, this, 0), + endpoint_edge_variation(_("End edge variance:"), _("The amount of randomness that moves the end points of the stitches inside & outside the guide path"), "endpoint_edge_variation", &wr, this, 0), + endpoint_spacing_variation(_("End spacing variance:"), _("The amount of random shifting to move the end points of the stitches back & forth along the guide path"), "endpoint_spacing_variation", &wr, this, 0), + prop_scale(_("Scale width:"), _("Scale the width of the stitch path"), "prop_scale", &wr, this, 1), scale_y_rel(_("Scale width relative to length"), _("Scale the width of the stitch path relative to its length"), "scale_y_rel", &wr, this, false) { registerParameter( dynamic_cast<Parameter *>(&nrofpaths) ); diff --git a/src/live_effects/lpe-envelope.cpp b/src/live_effects/lpe-envelope.cpp index abd975b4e..bd1cc5861 100755..100644 --- a/src/live_effects/lpe-envelope.cpp +++ b/src/live_effects/lpe-envelope.cpp @@ -30,10 +30,10 @@ namespace LivePathEffect { LPEEnvelope::LPEEnvelope(LivePathEffectObject *lpeobject) : Effect(lpeobject), - bend_path1(_("Top bend path"), _("Top path along which to bend the original path"), "bendpath1", &wr, this, "M0,0 L1,0"), - bend_path2(_("Right bend path"), _("Right path along which to bend the original path"), "bendpath2", &wr, this, "M0,0 L1,0"), - bend_path3(_("Bottom bend path"), _("Bottom path along which to bend the original path"), "bendpath3", &wr, this, "M0,0 L1,0"), - bend_path4(_("Left bend path"), _("Left path along which to bend the original path"), "bendpath4", &wr, this, "M0,0 L1,0"), + bend_path1(_("Top bend path:"), _("Top path along which to bend the original path"), "bendpath1", &wr, this, "M0,0 L1,0"), + bend_path2(_("Right bend path:"), _("Right path along which to bend the original path"), "bendpath2", &wr, this, "M0,0 L1,0"), + bend_path3(_("Bottom bend path:"), _("Bottom path along which to bend the original path"), "bendpath3", &wr, this, "M0,0 L1,0"), + bend_path4(_("Left bend path:"), _("Left path along which to bend the original path"), "bendpath4", &wr, this, "M0,0 L1,0"), xx(_("Enable left & right paths"), _("Enable the left and right deformation paths"), "xx", &wr, this, true), yy(_("Enable top & bottom paths"), _("Enable the top and bottom deformation paths"), "yy", &wr, this, true) { diff --git a/src/live_effects/lpe-envelope.h b/src/live_effects/lpe-envelope.h index fe1d9561d..fe1d9561d 100755..100644 --- a/src/live_effects/lpe-envelope.h +++ b/src/live_effects/lpe-envelope.h diff --git a/src/live_effects/lpe-extrude.cpp b/src/live_effects/lpe-extrude.cpp index 5f63d0567..96d465569 100644 --- a/src/live_effects/lpe-extrude.cpp +++ b/src/live_effects/lpe-extrude.cpp @@ -195,4 +195,4 @@ LPEExtrude::resetDefaults(SPItem * item) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/live_effects/lpe-extrude.h b/src/live_effects/lpe-extrude.h index b704aa856..0c9f11444 100644 --- a/src/live_effects/lpe-extrude.h +++ b/src/live_effects/lpe-extrude.h @@ -49,4 +49,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/live_effects/lpe-gears.cpp b/src/live_effects/lpe-gears.cpp index b1337d5fb..c9bbde8f2 100644 --- a/src/live_effects/lpe-gears.cpp +++ b/src/live_effects/lpe-gears.cpp @@ -209,8 +209,8 @@ namespace LivePathEffect { LPEGears::LPEGears(LivePathEffectObject *lpeobject) : Effect(lpeobject), - teeth(_("Teeth"), _("The number of teeth"), "teeth", &wr, this, 10), - phi(_("Phi"), _("Tooth pressure angle (typically 20-25 deg). The ratio of teeth not in contact."), "phi", &wr, this, 5) + teeth(_("Teeth:"), _("The number of teeth"), "teeth", &wr, this, 10), + phi(_("Phi:"), _("Tooth pressure angle (typically 20-25 deg). The ratio of teeth not in contact."), "phi", &wr, this, 5) { /* Tooth pressure angle: The angle between the tooth profile and a perpendicular to the pitch * circle, usually at the point where the pitch circle meets the tooth profile. Standard angles diff --git a/src/live_effects/lpe-interpolate.cpp b/src/live_effects/lpe-interpolate.cpp index 4eb86ccf0..a4546726f 100644 --- a/src/live_effects/lpe-interpolate.cpp +++ b/src/live_effects/lpe-interpolate.cpp @@ -27,8 +27,8 @@ namespace LivePathEffect { LPEInterpolate::LPEInterpolate(LivePathEffectObject *lpeobject) : Effect(lpeobject), - trajectory_path(_("Trajectory"), _("Path along which intermediate steps are created."), "trajectory", &wr, this, "M0,0 L0,0"), - number_of_steps(_("Steps"), _("Determines the number of steps from start to end path."), "steps", &wr, this, 5), + trajectory_path(_("Trajectory:"), _("Path along which intermediate steps are created."), "trajectory", &wr, this, "M0,0 L0,0"), + number_of_steps(_("Steps:"), _("Determines the number of steps from start to end path."), "steps", &wr, this, 5), equidistant_spacing(_("Equidistant spacing"), _("If true, the spacing between intermediates is constant along the length of the path. If false, the distance depends on the location of the nodes of the trajectory path."), "equidistant_spacing", &wr, this, true) { show_orig_path = true; diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index b8e9b8cf9..86d0907a1 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -47,6 +47,17 @@ public: }; +Geom::Path::size_type size_nondegenerate(Geom::Path const &path) { + Geom::Path::size_type retval = path.size_open(); + + // if path is closed and closing segment is not degenerate + if (path.closed() && !path.back_closed().isDegenerate()) { + retval = path.size_closed(); + } + + return retval; +} + //--------------------------------------------------------------------------- //LPEKnot specific Interval manipulation. //--------------------------------------------------------------------------- @@ -90,7 +101,7 @@ findShadowedTime(Geom::Path const &patha, std::vector<Geom::Point> const &pt_and std::vector<double> times; //TODO: explore the path fwd/backward from ta (worth?) - for (unsigned i=0; i<patha.size(); i++){ + for (unsigned i = 0; i < size_nondegenerate(patha); i++){ D2<SBasis> f = p[i].toSBasis(); std::vector<double> times_i, temptimes; temptimes = roots(f[Y]-width); @@ -110,8 +121,8 @@ findShadowedTime(Geom::Path const &patha, std::vector<Geom::Point> const &pt_and std::vector<double>::iterator new_end = std::unique( times.begin(), times.end() ); times.resize( new_end - times.begin() ); - double tmin = 0, tmax = patha.size(); - double period = patha.size();//hm... Should this be patha.size()+1? + double tmin = 0, tmax = size_nondegenerate(patha); + double period = size_nondegenerate(patha); if (times.size()>0){ unsigned rk = upper_bound( times.begin(), times.end(), ta ) - times.begin(); if ( rk < times.size() ) @@ -141,9 +152,9 @@ namespace LPEKnotNS {//just in case... CrossingPoints::CrossingPoints(std::vector<Geom::Path> const &paths) : std::vector<CrossingPoint>(){ // std::cout<<"\nCrossingPoints creation from path vector\n"; for( unsigned i=0; i<paths.size(); i++){ - for( unsigned ii=0; ii<paths[i].size(); ii++){ + for( unsigned ii=0; ii < size_nondegenerate(paths[i]); ii++){ for( unsigned j=i; j<paths.size(); j++){ - for( unsigned jj=(i==j?ii:0); jj<paths[j].size(); jj++){ + for( unsigned jj=(i==j?ii:0); jj < size_nondegenerate(paths[j]); jj++){ std::vector<std::pair<double,double> > times; if ( i==j && ii==jj){ @@ -169,7 +180,7 @@ CrossingPoints::CrossingPoints(std::vector<Geom::Path> const &paths) : std::vect if ( i==j && fabs(times[k].first+ii - times[k].second-jj)<=zero ){//this is just end=start of successive curves in a path. continue; } - if ( i==j && ii == 0 && jj==paths[i].size()-1 && + if ( i==j && ii == 0 && jj == size_nondegenerate(paths[i])-1 && paths[i].closed() && fabs(times[k].first) <= zero && fabs(times[k].second - 1) <= zero ){//this is just end=start of a closed path. @@ -328,11 +339,11 @@ CrossingPoints::inherit_signs(CrossingPoints const &other, int default_value) LPEKnot::LPEKnot(LivePathEffectObject *lpeobject) : Effect(lpeobject), // initialise your parameters here: - interruption_width(_("Fixed width"), _("Size of hidden region of lower string"), "interruption_width", &wr, this, 3), + interruption_width(_("Fixed width:"), _("Size of hidden region of lower string"), "interruption_width", &wr, this, 3), prop_to_stroke_width(_("In units of stroke width"), _("Consider 'Interruption width' as a ratio of stroke width"), "prop_to_stroke_width", &wr, this, true), add_stroke_width(_("Stroke width"), _("Add the stroke width to the interruption size"), "add_stroke_width", &wr, this, true), add_other_stroke_width(_("Crossing path stroke width"), _("Add crossed stroke width to the interruption size"), "add_other_stroke_width", &wr, this, true), - switcher_size(_("Switcher size"), _("Orientation indicator/switcher size"), "switcher_size", &wr, this, 15), + switcher_size(_("Switcher size:"), _("Orientation indicator/switcher size"), "switcher_size", &wr, this, 15), crossing_points_vector(_("Crossing Signs"), _("Crossings signs"), "crossing_points_vector", &wr, this), gpaths(),gstroke_widths() { @@ -393,7 +404,7 @@ LPEKnot::doEffect_path (std::vector<Geom::Path> const &path_in) if (i0 == gpaths.size() ) {THROW_EXCEPTION("lpe-knot error: group member not recognized");}// this should not happen... std::vector<Interval> dom; - dom.push_back(Interval(0.,gpaths[i0].size())); + dom.push_back(Interval(0., size_nondegenerate(gpaths[i0]))); for (unsigned p = 0; p < crossing_points.size(); p++){ if (crossing_points[p].i == i0 || crossing_points[p].j == i0){ unsigned i = crossing_points[p].i; @@ -404,13 +415,13 @@ LPEKnot::doEffect_path (std::vector<Geom::Path> const &path_in) double curveidx, t; t = modf(ti, &curveidx); - if(curveidx == gpaths[i].size() ) { curveidx--; t = 1.;} - assert(curveidx >= 0 && curveidx < gpaths[i].size()); + if(curveidx == size_nondegenerate(gpaths[i]) ) { curveidx--; t = 1.;} + assert(curveidx >= 0 && curveidx < size_nondegenerate(gpaths[i])); std::vector<Point> flag_i = gpaths[i][curveidx].pointAndDerivatives(t,1); t = modf(tj, &curveidx); - if(curveidx == gpaths[j].size() ) { curveidx--; t = 1.;} - assert(curveidx >= 0 && curveidx < gpaths[j].size()); + if(curveidx == size_nondegenerate(gpaths[j]) ) { curveidx--; t = 1.;} + assert(curveidx >= 0 && curveidx < size_nondegenerate(gpaths[j])); std::vector<Point> flag_j = gpaths[j][curveidx].pointAndDerivatives(t,1); @@ -439,7 +450,7 @@ LPEKnot::doEffect_path (std::vector<Geom::Path> const &path_in) width += gstroke_widths[j]; } Interval hidden = findShadowedTime(gpaths[i0], flag_j, ti, width/2); - double period = gpaths[i0].size();//hm... Should this be gpaths[i0].size()+1? + double period = size_nondegenerate(gpaths[i0]); if (hidden.max() > period ) hidden -= period; if (hidden.min()<0){ dom = complementOf( Interval(0,hidden.max()) ,dom); @@ -458,7 +469,7 @@ LPEKnot::doEffect_path (std::vector<Geom::Path> const &path_in) //If the current path is closed and the last/first point is still there, glue first and last piece. unsigned beg_comp = 0, end_comp = dom.size(); - if ( gpaths[i0].closed() && dom.front().min() == 0 && dom.back().max() == gpaths[i0].size() ){ + if ( gpaths[i0].closed() && dom.front().min() == 0 && dom.back().max() == size_nondegenerate(gpaths[i0]) ){ if ( dom.size() == 1){ path_out.push_back(gpaths[i0]); continue; @@ -473,7 +484,7 @@ LPEKnot::doEffect_path (std::vector<Geom::Path> const &path_in) } } for (unsigned comp = beg_comp; comp < end_comp; comp++){ - assert(dom.at(comp).min() >=0 and dom.at(comp).max() <= gpaths.at(i0).size()); + assert(dom.at(comp).min() >=0 and dom.at(comp).max() <= size_nondegenerate(gpaths.at(i0))); path_out.push_back(gpaths[i0].portion(dom.at(comp))); } } @@ -659,4 +670,5 @@ KnotHolderEntityCrossingSwitcher::knot_click(guint state) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : + diff --git a/src/live_effects/lpe-patternalongpath.cpp b/src/live_effects/lpe-patternalongpath.cpp index 6e1738db8..d00dc11db 100644 --- a/src/live_effects/lpe-patternalongpath.cpp +++ b/src/live_effects/lpe-patternalongpath.cpp @@ -58,25 +58,25 @@ static const Util::EnumDataConverter<PAPCopyType> PAPCopyTypeConverter(PAPCopyTy LPEPatternAlongPath::LPEPatternAlongPath(LivePathEffectObject *lpeobject) : Effect(lpeobject), - pattern(_("Pattern source"), _("Path to put along the skeleton path"), "pattern", &wr, this, "M0,0 L1,0"), - copytype(_("Pattern copies"), _("How many pattern copies to place along the skeleton path"), + pattern(_("Pattern source:"), _("Path to put along the skeleton path"), "pattern", &wr, this, "M0,0 L1,0"), + copytype(_("Pattern copies:"), _("How many pattern copies to place along the skeleton path"), "copytype", PAPCopyTypeConverter, &wr, this, PAPCT_SINGLE_STRETCHED), - prop_scale(_("Width"), _("Width of the pattern"), "prop_scale", &wr, this, 1), + prop_scale(_("Width:"), _("Width of the pattern"), "prop_scale", &wr, this, 1), scale_y_rel(_("Width in units of length"), _("Scale the width of the pattern in units of its length"), "scale_y_rel", &wr, this, false), - spacing(_("Spacing"), + spacing(_("Spacing:"), // xgettext:no-c-format _("Space between copies of the pattern. Negative values allowed, but are limited to -90% of pattern width."), "spacing", &wr, this, 0), - normal_offset(_("Normal offset"), "", "normal_offset", &wr, this, 0), - tang_offset(_("Tangential offset"), "", "tang_offset", &wr, this, 0), + normal_offset(_("Normal offset:"), "", "normal_offset", &wr, this, 0), + tang_offset(_("Tangential offset:"), "", "tang_offset", &wr, this, 0), prop_units(_("Offsets in unit of pattern size"), _("Spacing, tangential and normal offset are expressed as a ratio of width/height"), "prop_units", &wr, this, false), vertical_pattern(_("Pattern is vertical"), _("Rotate pattern 90 deg before applying"), "vertical_pattern", &wr, this, false), - fuse_tolerance(_("Fuse nearby ends"), _("Fuse ends closer than this number. 0 means don't fuse."), + fuse_tolerance(_("Fuse nearby ends:"), _("Fuse ends closer than this number. 0 means don't fuse."), "fuse_tolerance", &wr, this, 0) { registerParameter( dynamic_cast<Parameter *>(&pattern) ); diff --git a/src/live_effects/lpe-perspective_path.cpp b/src/live_effects/lpe-perspective_path.cpp index 3d18318c5..58efe4ef5 100644 --- a/src/live_effects/lpe-perspective_path.cpp +++ b/src/live_effects/lpe-perspective_path.cpp @@ -188,4 +188,4 @@ KnotHolderEntityOffset::knot_get() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/live_effects/lpe-perspective_path.h b/src/live_effects/lpe-perspective_path.h index 23731f9f7..ad4d307c1 100644 --- a/src/live_effects/lpe-perspective_path.h +++ b/src/live_effects/lpe-perspective_path.h @@ -74,4 +74,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp index 6109ea498..5dc170e84 100644 --- a/src/live_effects/lpe-powerstroke.cpp +++ b/src/live_effects/lpe-powerstroke.cpp @@ -259,4 +259,4 @@ LPEPowerStroke::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/live_effects/lpe-powerstroke.h b/src/live_effects/lpe-powerstroke.h index 6c208fda4..667c94f53 100644 --- a/src/live_effects/lpe-powerstroke.h +++ b/src/live_effects/lpe-powerstroke.h @@ -50,4 +50,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/live_effects/lpe-recursiveskeleton.cpp b/src/live_effects/lpe-recursiveskeleton.cpp index 50a3bfb6c..d78ad2fcb 100644 --- a/src/live_effects/lpe-recursiveskeleton.cpp +++ b/src/live_effects/lpe-recursiveskeleton.cpp @@ -129,4 +129,4 @@ LPERecursiveSkeleton::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > co fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/live_effects/lpe-recursiveskeleton.h b/src/live_effects/lpe-recursiveskeleton.h index 2fc9f8b68..099b030d4 100644 --- a/src/live_effects/lpe-recursiveskeleton.h +++ b/src/live_effects/lpe-recursiveskeleton.h @@ -47,4 +47,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/live_effects/lpe-rough-hatches.cpp b/src/live_effects/lpe-rough-hatches.cpp index eebac299a..7d5b6c238 100644 --- a/src/live_effects/lpe-rough-hatches.cpp +++ b/src/live_effects/lpe-rough-hatches.cpp @@ -223,27 +223,27 @@ Piecewise<D2<SBasis> > bend(Piecewise<D2<SBasis> > const &f, Piecewise<SBasis> b LPERoughHatches::LPERoughHatches(LivePathEffectObject *lpeobject) : Effect(lpeobject), hatch_dist(0), - dist_rdm(_("Frequency randomness"), _("Variation of distance between hatches, in %."), "dist_rdm", &wr, this, 75), - growth(_("Growth"), _("Growth of distance between hatches."), "growth", &wr, this, 0.), + dist_rdm(_("Frequency randomness:"), _("Variation of distance between hatches, in %."), "dist_rdm", &wr, this, 75), + growth(_("Growth:"), _("Growth of distance between hatches."), "growth", &wr, this, 0.), //FIXME: top/bottom names are inverted in the UI/svg and in the code!! - scale_tf(_("Half-turns smoothness: 1st side, in"), _("Set smoothness/sharpness of path when reaching a 'bottom' half-turn. 0=sharp, 1=default"), "scale_bf", &wr, this, 1.), - scale_tb(_("1st side, out"), _("Set smoothness/sharpness of path when leaving a 'bottom' half-turn. 0=sharp, 1=default"), "scale_bb", &wr, this, 1.), - scale_bf(_("2nd side, in"), _("Set smoothness/sharpness of path when reaching a 'top' half-turn. 0=sharp, 1=default"), "scale_tf", &wr, this, 1.), - scale_bb(_("2nd side, out"), _("Set smoothness/sharpness of path when leaving a 'top' half-turn. 0=sharp, 1=default"), "scale_tb", &wr, this, 1.), - top_edge_variation(_("Magnitude jitter: 1st side"), _("Randomly moves 'bottom' half-turns to produce magnitude variations."), "bottom_edge_variation", &wr, this, 0), - bot_edge_variation(_("2nd side"), _("Randomly moves 'top' half-turns to produce magnitude variations."), "top_edge_variation", &wr, this, 0), - top_tgt_variation(_("Parallelism jitter: 1st side"), _("Add direction randomness by moving 'bottom' half-turns tangentially to the boundary."), "bottom_tgt_variation", &wr, this, 0), - bot_tgt_variation(_("2nd side"), _("Add direction randomness by randomly moving 'top' half-turns tangentially to the boundary."), "top_tgt_variation", &wr, this, 0), - top_smth_variation(_("Variance: 1st side"), _("Randomness of 'bottom' half-turns smoothness"), "top_smth_variation", &wr, this, 0), - bot_smth_variation(_("2nd side"), _("Randomness of 'top' half-turns smoothness"), "bottom_smth_variation", &wr, this, 0), + scale_tf(_("Half-turns smoothness: 1st side, in:"), _("Set smoothness/sharpness of path when reaching a 'bottom' half-turn. 0=sharp, 1=default"), "scale_bf", &wr, this, 1.), + scale_tb(_("1st side, out:"), _("Set smoothness/sharpness of path when leaving a 'bottom' half-turn. 0=sharp, 1=default"), "scale_bb", &wr, this, 1.), + scale_bf(_("2nd side, in:"), _("Set smoothness/sharpness of path when reaching a 'top' half-turn. 0=sharp, 1=default"), "scale_tf", &wr, this, 1.), + scale_bb(_("2nd side, out:"), _("Set smoothness/sharpness of path when leaving a 'top' half-turn. 0=sharp, 1=default"), "scale_tb", &wr, this, 1.), + top_edge_variation(_("Magnitude jitter: 1st side:"), _("Randomly moves 'bottom' half-turns to produce magnitude variations."), "bottom_edge_variation", &wr, this, 0), + bot_edge_variation(_("2nd side:"), _("Randomly moves 'top' half-turns to produce magnitude variations."), "top_edge_variation", &wr, this, 0), + top_tgt_variation(_("Parallelism jitter: 1st side:"), _("Add direction randomness by moving 'bottom' half-turns tangentially to the boundary."), "bottom_tgt_variation", &wr, this, 0), + bot_tgt_variation(_("2nd side:"), _("Add direction randomness by randomly moving 'top' half-turns tangentially to the boundary."), "top_tgt_variation", &wr, this, 0), + top_smth_variation(_("Variance: 1st side:"), _("Randomness of 'bottom' half-turns smoothness"), "top_smth_variation", &wr, this, 0), + bot_smth_variation(_("2nd side:"), _("Randomness of 'top' half-turns smoothness"), "bottom_smth_variation", &wr, this, 0), // fat_output(_("Generate thick/thin path"), _("Simulate a stroke of varying width"), "fat_output", &wr, this, true), do_bend(_("Bend hatches"), _("Add a global bend to the hatches (slower)"), "do_bend", &wr, this, true), - stroke_width_top(_("Thickness: at 1st side"), _("Width at 'bottom' half-turns"), "stroke_width_top", &wr, this, 1.), - stroke_width_bot(_("at 2nd side"), _("Width at 'top' half-turns"), "stroke_width_bottom", &wr, this, 1.), + stroke_width_top(_("Thickness: at 1st side:"), _("Width at 'bottom' half-turns"), "stroke_width_top", &wr, this, 1.), + stroke_width_bot(_("at 2nd side:"), _("Width at 'top' half-turns"), "stroke_width_bottom", &wr, this, 1.), // - front_thickness(_("from 2nd to 1st side"), _("Width from 'top' to 'bottom'"), "front_thickness", &wr, this, 1.), - back_thickness(_("from 1st to 2nd side"), _("Width from 'bottom' to 'top'"), "back_thickness", &wr, this, .25), + front_thickness(_("from 2nd to 1st side:"), _("Width from 'top' to 'bottom'"), "front_thickness", &wr, this, 1.), + back_thickness(_("from 1st to 2nd side:"), _("Width from 'bottom' to 'top'"), "back_thickness", &wr, this, .25), direction(_("Hatches width and dir"), _("Defines hatches frequency and direction"), "direction", &wr, this, Geom::Point(50,0)), // diff --git a/src/live_effects/lpe-ruler.cpp b/src/live_effects/lpe-ruler.cpp index 35c9ea695..e51b03d15 100644 --- a/src/live_effects/lpe-ruler.cpp +++ b/src/live_effects/lpe-ruler.cpp @@ -40,15 +40,15 @@ static const Util::EnumDataConverter<BorderMarkType> BorderMarkTypeConverter(Bor LPERuler::LPERuler(LivePathEffectObject *lpeobject) : Effect(lpeobject), - mark_distance(_("Mark distance"), _("Distance between successive ruler marks"), "mark_distance", &wr, this, 20.0), - unit(_("Unit"), _("Unit"), "unit", &wr, this), - mark_length(_("Major length"), _("Length of major ruler marks"), "mark_length", &wr, this, 14.0), - minor_mark_length(_("Minor length"), _("Length of minor ruler marks"), "minor_mark_length", &wr, this, 7.0), - major_mark_steps(_("Major steps"), _("Draw a major mark every ... steps"), "major_mark_steps", &wr, this, 5), - shift(_("Shift marks by"), _("Shift marks by this many steps"), "shift", &wr, this, 0), - mark_dir(_("Mark direction"), _("Direction of marks (when viewing along the path from start to end)"), "mark_dir", MarkDirTypeConverter, &wr, this, MARKDIR_LEFT), - offset(_("Offset"), _("Offset of first mark"), "offset", &wr, this, 0.0), - border_marks(_("Border marks"), _("Choose whether to draw marks at the beginning and end of the path"), "border_marks", BorderMarkTypeConverter, &wr, this, BORDERMARK_BOTH) + mark_distance(_("Mark distance:"), _("Distance between successive ruler marks"), "mark_distance", &wr, this, 20.0), + unit(_("Unit:"), _("Unit"), "unit", &wr, this), + mark_length(_("Major length:"), _("Length of major ruler marks"), "mark_length", &wr, this, 14.0), + minor_mark_length(_("Minor length:"), _("Length of minor ruler marks"), "minor_mark_length", &wr, this, 7.0), + major_mark_steps(_("Major steps:"), _("Draw a major mark every ... steps"), "major_mark_steps", &wr, this, 5), + shift(_("Shift marks by:"), _("Shift marks by this many steps"), "shift", &wr, this, 0), + mark_dir(_("Mark direction:"), _("Direction of marks (when viewing along the path from start to end)"), "mark_dir", MarkDirTypeConverter, &wr, this, MARKDIR_LEFT), + offset(_("Offset:"), _("Offset of first mark"), "offset", &wr, this, 0.0), + border_marks(_("Border marks:"), _("Choose whether to draw marks at the beginning and end of the path"), "border_marks", BorderMarkTypeConverter, &wr, this, BORDERMARK_BOTH) { registerParameter(dynamic_cast<Parameter *>(&unit)); registerParameter(dynamic_cast<Parameter *>(&mark_distance)); diff --git a/src/live_effects/lpe-skeleton.cpp b/src/live_effects/lpe-skeleton.cpp index fdee68b88..daf96aa13 100644 --- a/src/live_effects/lpe-skeleton.cpp +++ b/src/live_effects/lpe-skeleton.cpp @@ -112,4 +112,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/live_effects/lpe-skeleton.h b/src/live_effects/lpe-skeleton.h index fd9dc0aba..104ef3489 100644 --- a/src/live_effects/lpe-skeleton.h +++ b/src/live_effects/lpe-skeleton.h @@ -63,4 +63,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/live_effects/lpe-sketch.cpp b/src/live_effects/lpe-sketch.cpp index 4d0212576..bcdf9df3c 100644 --- a/src/live_effects/lpe-sketch.cpp +++ b/src/live_effects/lpe-sketch.cpp @@ -32,34 +32,34 @@ LPESketch::LPESketch(LivePathEffectObject *lpeobject) : Effect(lpeobject), // initialise your parameters here: //testpointA(_("Test Point A"), _("Test A"), "ptA", &wr, this, Geom::Point(100,100)), - nbiter_approxstrokes(_("Strokes"), _("Draw that many approximating strokes"), "nbiter_approxstrokes", &wr, this, 5), - strokelength(_("Max stroke length"), + nbiter_approxstrokes(_("Strokes:"), _("Draw that many approximating strokes"), "nbiter_approxstrokes", &wr, this, 5), + strokelength(_("Max stroke length:"), _("Maximum length of approximating strokes"), "strokelength", &wr, this, 100.), - strokelength_rdm(_("Stroke length variation"), + strokelength_rdm(_("Stroke length variation:"), _("Random variation of stroke length (relative to maximum length)"), "strokelength_rdm", &wr, this, .3), - strokeoverlap(_("Max. overlap"), + strokeoverlap(_("Max. overlap:"), _("How much successive strokes should overlap (relative to maximum length)"), "strokeoverlap", &wr, this, .3), - strokeoverlap_rdm(_("Overlap variation"), + strokeoverlap_rdm(_("Overlap variation:"), _("Random variation of overlap (relative to maximum overlap)"), "strokeoverlap_rdm", &wr, this, .3), - ends_tolerance(_("Max. end tolerance"), + ends_tolerance(_("Max. end tolerance:"), _("Maximum distance between ends of original and approximating paths (relative to maximum length)"), "ends_tolerance", &wr, this, .1), - parallel_offset(_("Average offset"), + parallel_offset(_("Average offset:"), _("Average distance each stroke is away from the original path"), "parallel_offset", &wr, this, 5.), - tremble_size(_("Max. tremble"), + tremble_size(_("Max. tremble:"), _("Maximum tremble magnitude"), "tremble_size", &wr, this, 5.), - tremble_frequency(_("Tremble frequency"), + tremble_frequency(_("Tremble frequency:"), _("Average number of tremble periods in a stroke"), "tremble_frequency", &wr, this, 1.) #ifdef LPE_SKETCH_USE_CONSTRUCTION_LINES - ,nbtangents(_("Construction lines"), + ,nbtangents(_("Construction lines:"), _("How many construction lines (tangents) to draw"), "nbtangents", &wr, this, 5), - tgtscale(_("Scale"), + tgtscale(_("Scale:"), _("Scale factor relating curvature and length of construction lines (try 5*offset)"), "tgtscale", &wr, this, 10.0), - tgtlength(_("Max. length"), _("Maximum length of construction lines"), "tgtlength", &wr, this, 100.0), - tgtlength_rdm(_("Length variation"), _("Random variation of the length of construction lines"), "tgtlength_rdm", &wr, this, .3), - tgt_places_rdmness(_("Placement randomness"), _("0: evenly distributed construction lines, 1: purely random placement"), "tgt_places_rdmness", &wr, this, 1.) + tgtlength(_("Max. length:"), _("Maximum length of construction lines"), "tgtlength", &wr, this, 100.0), + tgtlength_rdm(_("Length variation:"), _("Random variation of the length of construction lines"), "tgtlength_rdm", &wr, this, .3), + tgt_places_rdmness(_("Placement randomness:"), _("0: evenly distributed construction lines, 1: purely random placement"), "tgt_places_rdmness", &wr, this, 1.) #ifdef LPE_SKETCH_USE_CURVATURE - ,min_curvature(_("k_min"), _("min curvature"), "k_min", &wr, this, 4.0) - ,max_curvature(_("k_max"), _("max curvature"), "k_max", &wr, this, 1000.0) + ,min_curvature(_("k_min:"), _("min curvature"), "k_min", &wr, this, 4.0) + ,max_curvature(_("k_max:"), _("max curvature"), "k_max", &wr, this, 1000.0) #endif #endif { @@ -387,4 +387,4 @@ LPESketch::doBeforeEffect (SPLPEItem */*lpeitem*/) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/live_effects/lpe-sketch.h b/src/live_effects/lpe-sketch.h index e82dab5c3..b95f57682 100644 --- a/src/live_effects/lpe-sketch.h +++ b/src/live_effects/lpe-sketch.h @@ -78,4 +78,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/live_effects/lpe-vonkoch.cpp b/src/live_effects/lpe-vonkoch.cpp index 23e76fe39..b94d03c1f 100644 --- a/src/live_effects/lpe-vonkoch.cpp +++ b/src/live_effects/lpe-vonkoch.cpp @@ -43,16 +43,16 @@ VonKochRefPathParam::param_readSVGValue(const gchar * strvalue) LPEVonKoch::LPEVonKoch(LivePathEffectObject *lpeobject) : Effect(lpeobject), - nbgenerations(_("Nb of generations"), _("Depth of the recursion --- keep low!!"), "nbgenerations", &wr, this, 1), - generator(_("Generating path"), _("Path whose segments define the iterated transforms"), "generator", &wr, this, "M0,0 L30,0 M0,10 L10,10 M 20,10 L30,10"), + nbgenerations(_("Nb of generations:"), _("Depth of the recursion --- keep low!!"), "nbgenerations", &wr, this, 1), + generator(_("Generating path:"), _("Path whose segments define the iterated transforms"), "generator", &wr, this, "M0,0 L30,0 M0,10 L10,10 M 20,10 L30,10"), similar_only(_("Use uniform transforms only"), _("2 consecutive segments are used to reverse/preserve orientation only (otherwise, they define a general transform)."), "similar_only", &wr, this, false), drawall(_("Draw all generations"), _("If unchecked, draw only the last generation"), "drawall", &wr, this, true), //,draw_boxes(_("Display boxes"), _("Display boxes instead of paths only"), "draw_boxes", &wr, this, true) - ref_path(_("Reference segment"), _("The reference segment. Defaults to the horizontal midline of the bbox."), "ref_path", &wr, this, "M0,0 L10,0"), + ref_path(_("Reference segment:"), _("The reference segment. Defaults to the horizontal midline of the bbox."), "ref_path", &wr, this, "M0,0 L10,0"), //refA(_("Ref Start"), _("Left side middle of the reference box"), "refA", &wr, this), //refB(_("Ref End"), _("Right side middle of the reference box"), "refB", &wr, this), //FIXME: a path is used here instead of 2 points to work around path/point param incompatibility bug. - maxComplexity(_("Max complexity"), _("Disable effect if the output is too complex"), "maxComplexity", &wr, this, 1000) + maxComplexity(_("Max complexity:"), _("Disable effect if the output is too complex"), "maxComplexity", &wr, this, 1000) { //FIXME: a path is used here instead of 2 points to work around path/point param incompatibility bug. registerParameter( dynamic_cast<Parameter *>(&ref_path) ); diff --git a/src/live_effects/lpeobject.h b/src/live_effects/lpeobject.h index 9f802643b..3ea1ea9ad 100644 --- a/src/live_effects/lpeobject.h +++ b/src/live_effects/lpeobject.h @@ -70,4 +70,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/live_effects/parameter/parameter.h b/src/live_effects/parameter/parameter.h index 61c151b0e..ff878e717 100644 --- a/src/live_effects/parameter/parameter.h +++ b/src/live_effects/parameter/parameter.h @@ -144,4 +144,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/lpe-tool-context.cpp b/src/lpe-tool-context.cpp index 438258cb3..8aa350d86 100644 --- a/src/lpe-tool-context.cpp +++ b/src/lpe-tool-context.cpp @@ -550,4 +550,4 @@ lpetool_show_measuring_info(SPLPEToolContext *lc, bool show) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/lpe-tool-context.h b/src/lpe-tool-context.h index 8a52ba97c..478989e0b 100644 --- a/src/lpe-tool-context.h +++ b/src/lpe-tool-context.h @@ -87,4 +87,4 @@ GType sp_lpetool_context_get_type(void); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/macros.h b/src/macros.h index d43dbc692..9a97820d8 100644 --- a/src/macros.h +++ b/src/macros.h @@ -51,4 +51,4 @@ fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/main.cpp b/src/main.cpp index 78b66d847..eda6d0b03 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -114,7 +114,6 @@ using Inkscape::Extension::Internal::PrintWin32; #define bind_textdomain_codeset(p,c) #endif -#include "application/application.h" #include "main-cmdlineact.h" #include "widgets/icon.h" #include "ui/widget/panel.h" @@ -208,7 +207,6 @@ static gboolean sp_query_width = FALSE; static gboolean sp_query_height = FALSE; static gboolean sp_query_all = FALSE; static gchar *sp_query_id = NULL; -static int sp_new_gui = FALSE; static gboolean sp_shell = FALSE; static gboolean sp_vacuum_defs = FALSE; @@ -713,10 +711,15 @@ main(int argc, char **argv) } #endif // WIN32 - /// \todo Should this be a static object (see inkscape.cpp)? - Inkscape::NSApplication::Application app(argc, argv, use_gui, sp_new_gui); + int retcode; - return app.run(); + if (use_gui) { + retcode = sp_main_gui(argc, (const char **) argv); + } else { + retcode = sp_main_console(argc, (const char **) argv); + } + + return retcode; } diff --git a/src/marker-test.h b/src/marker-test.h index 5b84dcc66..bf7e1040a 100644 --- a/src/marker-test.h +++ b/src/marker-test.h @@ -36,4 +36,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/media.cpp b/src/media.cpp index 8f9dfc18a..89221d9c4 100644 --- a/src/media.cpp +++ b/src/media.cpp @@ -24,4 +24,4 @@ media_set_all(Media &media) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/media.h b/src/media.h index 8ae374aa1..23020a9b6 100644 --- a/src/media.h +++ b/src/media.h @@ -21,4 +21,4 @@ void media_set_all(Media &); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/memeq.h b/src/memeq.h index db348d3f5..ebccc3c9e 100644 --- a/src/memeq.h +++ b/src/memeq.h @@ -22,4 +22,4 @@ memeq(void const *a, void const *b, size_t n) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/menus-skeleton.h b/src/menus-skeleton.h index 9c0ca1767..924cc1989 100644 --- a/src/menus-skeleton.h +++ b/src/menus-skeleton.h @@ -303,4 +303,4 @@ static char const menus_skeleton[] = fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/message-context.cpp b/src/message-context.cpp index 5055f4102..6b8944185 100644 --- a/src/message-context.cpp +++ b/src/message-context.cpp @@ -91,4 +91,4 @@ void MessageContext::clear() { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/message-context.h b/src/message-context.h index 145a73ee5..a92874d68 100644 --- a/src/message-context.h +++ b/src/message-context.h @@ -115,4 +115,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/message-stack.cpp b/src/message-stack.cpp index 05aec87fc..d2101009e 100644 --- a/src/message-stack.cpp +++ b/src/message-stack.cpp @@ -163,4 +163,4 @@ gboolean MessageStack::_timeout(gpointer data) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/message-stack.h b/src/message-stack.h index 24ec2d599..b5f1dd345 100644 --- a/src/message-stack.h +++ b/src/message-stack.h @@ -174,4 +174,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/message.h b/src/message.h index b9b38b613..956f2c03e 100644 --- a/src/message.h +++ b/src/message.h @@ -47,4 +47,4 @@ typedef unsigned long MessageId; fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/mod360-test.h b/src/mod360-test.h index 2d65beb92..508553970 100644 --- a/src/mod360-test.h +++ b/src/mod360-test.h @@ -54,5 +54,5 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/mod360.cpp b/src/mod360.cpp index 8abda4cf7..13e9aa36a 100644 --- a/src/mod360.cpp +++ b/src/mod360.cpp @@ -36,4 +36,4 @@ double mod360symm(double const x) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/mod360.h b/src/mod360.h index 15e006dd7..0a8a91e98 100644 --- a/src/mod360.h +++ b/src/mod360.h @@ -15,4 +15,4 @@ double mod360symm (double const x); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/modifier-fns.h b/src/modifier-fns.h index a3cab7d20..8d78455e1 100644 --- a/src/modifier-fns.h +++ b/src/modifier-fns.h @@ -61,4 +61,4 @@ mod_alt_only(guint const state) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/number-opt-number.h b/src/number-opt-number.h index 0025f2d07..b2f2f2a1e 100644 --- a/src/number-opt-number.h +++ b/src/number-opt-number.h @@ -138,4 +138,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/object-edit.cpp b/src/object-edit.cpp index 6db280670..314a45700 100644 --- a/src/object-edit.cpp +++ b/src/object-edit.cpp @@ -1358,4 +1358,4 @@ FlowtextKnotHolder::FlowtextKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotH fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/object-edit.h b/src/object-edit.h index 9dda02e34..ad63e92e2 100644 --- a/src/object-edit.h +++ b/src/object-edit.h @@ -74,4 +74,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/object-hierarchy.cpp b/src/object-hierarchy.cpp index 49de16d0b..55af55f28 100644 --- a/src/object-hierarchy.cpp +++ b/src/object-hierarchy.cpp @@ -214,4 +214,4 @@ void ObjectHierarchy::_detach(ObjectHierarchy::Record &rec) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/object-hierarchy.h b/src/object-hierarchy.h index e5f44b413..8a6d4aedc 100644 --- a/src/object-hierarchy.h +++ b/src/object-hierarchy.h @@ -117,4 +117,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp index d84ee9c4f..51b494498 100644 --- a/src/object-snapper.cpp +++ b/src/object-snapper.cpp @@ -229,10 +229,17 @@ void Inkscape::ObjectSnapper::_collectNodes(Inkscape::SnapSourceType const &t, _snapmanager->snapprefs.setSnapIntersectionCS(false); } + // We should not snap a transformation center to any of the centers of the items in the + // current selection (see the comment in SelTrans::centerRequest()) bool old_pref2 = _snapmanager->snapprefs.getIncludeItemCenter(); - if ((*i).item == _snapmanager->getRotationCenterSource()) { - // don't snap to this item's rotation center - _snapmanager->snapprefs.setIncludeItemCenter(false); + if (old_pref2) { + for ( GSList const *itemlist = _snapmanager->getRotationCenterSource(); itemlist != NULL; itemlist = g_slist_next(itemlist) ) { + if ((*i).item == reinterpret_cast<SPItem*>(itemlist->data)) { + // don't snap to this item's rotation center + _snapmanager->snapprefs.setIncludeItemCenter(false); + break; + } + } } sp_item_snappoints(root_item, *_points_to_snap_to, &_snapmanager->snapprefs); @@ -257,13 +264,16 @@ void Inkscape::ObjectSnapper::_collectNodes(Inkscape::SnapSourceType const &t, void Inkscape::ObjectSnapper::_snapNodes(SnappedConstraints &sc, Inkscape::SnapCandidatePoint const &p, - std::vector<SnapCandidatePoint> *unselected_nodes) const + std::vector<SnapCandidatePoint> *unselected_nodes, + SnapConstraint const &c, + Geom::Point const &p_proj_on_constraint) const { // Iterate through all nodes, find out which one is the closest to p, and snap to it! - _collectNodes(p.getSourceType(), p.getSourceNum() == 0); + _collectNodes(p.getSourceType(), p.getSourceNum() <= 0); - if (unselected_nodes != NULL) { + if (unselected_nodes != NULL && unselected_nodes->size() > 0) { + g_assert(_points_to_snap_to != NULL); _points_to_snap_to->insert(_points_to_snap_to->end(), unselected_nodes->begin(), unselected_nodes->end()); } @@ -271,9 +281,24 @@ void Inkscape::ObjectSnapper::_snapNodes(SnappedConstraints &sc, bool success = false; for (std::vector<SnapCandidatePoint>::const_iterator k = _points_to_snap_to->begin(); k != _points_to_snap_to->end(); k++) { - Geom::Coord dist = Geom::L2((*k).getPoint() - p.getPoint()); + Geom::Point target_pt = (*k).getPoint(); + Geom::Coord dist = NR_HUGE; + if (!c.isUndefined()) { + // We're snapping to nodes along a constraint only, so find out if this node + // is at the constraint, while allowing for a small margin + if (Geom::L2(target_pt - c.projection(target_pt)) > 1e-9) { + // The distance from the target point to its projection on the constraint + // is too large, so this point is not on the constraint. Skip it! + continue; + } + dist = Geom::L2(target_pt - p_proj_on_constraint); + } else { + // Free (unconstrained) snapping + dist = Geom::L2(target_pt - p.getPoint()); + } + if (dist < getSnapperTolerance() && dist < s.getSnapDistance()) { - s = SnappedPoint((*k).getPoint(), p.getSourceType(), p.getSourceNum(), (*k).getTargetType(), dist, getSnapperTolerance(), getSnapperAlwaysSnap(), false, true, (*k).getTargetBBox()); + s = SnappedPoint(target_pt, p.getSourceType(), p.getSourceNum(), (*k).getTargetType(), dist, getSnapperTolerance(), getSnapperAlwaysSnap(), false, true, (*k).getTargetBBox()); success = true; } } @@ -291,7 +316,7 @@ void Inkscape::ObjectSnapper::_snapTranslatingGuide(SnappedConstraints &sc, _collectNodes(SNAPSOURCE_GUIDE, true); if (_snapmanager->snapprefs.getSnapToItemPath() || _snapmanager->snapprefs.getSnapToBBoxPath() || _snapmanager->snapprefs.getSnapToPageBorder()) { - _collectPaths(Inkscape::SnapCandidatePoint(p, SNAPSOURCE_GUIDE), true); + _collectPaths(p, SNAPSOURCE_GUIDE, true); _snapPaths(sc, Inkscape::SnapCandidatePoint(p, SNAPSOURCE_GUIDE), NULL, NULL); } @@ -300,13 +325,13 @@ void Inkscape::ObjectSnapper::_snapTranslatingGuide(SnappedConstraints &sc, Geom::Coord tol = getSnapperTolerance(); for (std::vector<SnapCandidatePoint>::const_iterator k = _points_to_snap_to->begin(); k != _points_to_snap_to->end(); k++) { - + Geom::Point target_pt = (*k).getPoint(); // Project each node (*k) on the guide line (running through point p) - Geom::Point p_proj = Geom::projection((*k).getPoint(), Geom::Line(p, p + Geom::rot90(guide_normal))); - Geom::Coord dist = Geom::L2((*k).getPoint() - p_proj); // distance from node to the guide + Geom::Point p_proj = Geom::projection(target_pt, Geom::Line(p, p + Geom::rot90(guide_normal))); + Geom::Coord dist = Geom::L2(target_pt - p_proj); // distance from node to the guide Geom::Coord dist2 = Geom::L2(p - p_proj); // distance from projection of node on the guide, to the mouse location if ((dist < tol && dist2 < tol) || getSnapperAlwaysSnap()) { - s = SnappedPoint((*k).getPoint(), SNAPSOURCE_GUIDE, 0, (*k).getTargetType(), dist, tol, getSnapperAlwaysSnap(), false, true, (*k).getTargetBBox()); + s = SnappedPoint(target_pt, SNAPSOURCE_GUIDE, 0, (*k).getTargetType(), dist, tol, getSnapperAlwaysSnap(), false, true, (*k).getTargetBBox()); sc.points.push_back(s); } } @@ -317,7 +342,8 @@ void Inkscape::ObjectSnapper::_snapTranslatingGuide(SnappedConstraints &sc, * Returns index of first NR_END bpath in array. */ -void Inkscape::ObjectSnapper::_collectPaths(Inkscape::SnapCandidatePoint const &p, +void Inkscape::ObjectSnapper::_collectPaths(Geom::Point p, + Inkscape::SnapSourceType const source_type, bool const &first_point) const { // Now, let's first collect all paths to snap to. If we have a whole bunch of points to snap, @@ -329,8 +355,8 @@ void Inkscape::ObjectSnapper::_collectPaths(Inkscape::SnapCandidatePoint const & // Determine the type of bounding box we should snap to SPItem::BBoxType bbox_type = SPItem::GEOMETRIC_BBOX; - bool p_is_a_node = p.getSourceType() & Inkscape::SNAPSOURCE_NODE_CATEGORY; - bool p_is_other = p.getSourceType() & Inkscape::SNAPSOURCE_OTHER_CATEGORY; + bool p_is_a_node = source_type & Inkscape::SNAPSOURCE_NODE_CATEGORY; + bool p_is_other = source_type & Inkscape::SNAPSOURCE_OTHER_CATEGORY; if (_snapmanager->snapprefs.getSnapToBBoxPath()) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -428,7 +454,7 @@ void Inkscape::ObjectSnapper::_snapPaths(SnappedConstraints &sc, std::vector<Inkscape::SnapCandidatePoint> *unselected_nodes, SPPath const *selected_path) const { - _collectPaths(p, p.getSourceNum() == 0); + _collectPaths(p.getPoint(), p.getSourceType(), p.getSourceNum() <= 0); // Now we can finally do the real snapping, using the paths collected above g_assert(_snapmanager->getDesktop() != NULL); @@ -436,7 +462,7 @@ void Inkscape::ObjectSnapper::_snapPaths(SnappedConstraints &sc, bool const node_tool_active = _snapmanager->snapprefs.getSnapToItemPath() && selected_path != NULL; - if (p.getSourceNum() == 0) { + if (p.getSourceNum() <= 0) { /* findCandidates() is used for snapping to both paths and nodes. It ignores the path that is * currently being edited, because that path requires special care: when snapping to nodes * only the unselected nodes of that path should be considered, and these will be passed on separately. @@ -529,15 +555,16 @@ bool Inkscape::ObjectSnapper::isUnselectedNode(Geom::Point const &point, std::ve void Inkscape::ObjectSnapper::_snapPathsConstrained(SnappedConstraints &sc, Inkscape::SnapCandidatePoint const &p, - SnapConstraint const &c) const + SnapConstraint const &c, + Geom::Point const &p_proj_on_constraint) const { - _collectPaths(p, p.getSourceNum() == 0); + _collectPaths(p_proj_on_constraint, p.getSourceType(), p.getSourceNum() <= 0); // Now we can finally do the real snapping, using the paths collected above g_assert(_snapmanager->getDesktop() != NULL); - Geom::Point const p_doc = _snapmanager->getDesktop()->dt2doc(p.getPoint()); + Geom::Point const p_doc = _snapmanager->getDesktop()->dt2doc(p_proj_on_constraint); Geom::Point direction_vector = c.getDirection(); if (!is_zero(direction_vector)) { @@ -546,9 +573,8 @@ void Inkscape::ObjectSnapper::_snapPathsConstrained(SnappedConstraints &sc, // The intersection point of the constraint line with any path, must lie within two points on the // SnapConstraint: p_min_on_cl and p_max_on_cl. The distance between those points is twice the snapping tolerance - Geom::Point const p_proj_on_cl = p.getPoint(); // projection has already been taken care of in constrainedSnap in the snapmanager; - Geom::Point const p_min_on_cl = _snapmanager->getDesktop()->dt2doc(p_proj_on_cl - getSnapperTolerance() * direction_vector); - Geom::Point const p_max_on_cl = _snapmanager->getDesktop()->dt2doc(p_proj_on_cl + getSnapperTolerance() * direction_vector); + Geom::Point const p_min_on_cl = _snapmanager->getDesktop()->dt2doc(p_proj_on_constraint - getSnapperTolerance() * direction_vector); + Geom::Point const p_max_on_cl = _snapmanager->getDesktop()->dt2doc(p_proj_on_constraint + getSnapperTolerance() * direction_vector); Geom::Coord tolerance = getSnapperTolerance(); // PS: Because the paths we're about to snap to are all expressed relative to document coordinate system, we will have @@ -564,29 +590,57 @@ void Inkscape::ObjectSnapper::_snapPathsConstrained(SnappedConstraints &sc, constraint_line.appendNew<Geom::LineSegment>(p_max_on_cl); constraint_path.push_back(constraint_line); } + // Length of constraint_path will always be one + // Find all intersections of the constrained path with the snap target candidates + std::vector<Geom::Point> intersections; for (std::vector<Inkscape::SnapCandidatePath >::const_iterator k = _paths_to_snap_to->begin(); k != _paths_to_snap_to->end(); k++) { if (k->path_vector) { + // Do the intersection math Geom::CrossingSet cs = Geom::crossings(constraint_path, *(k->path_vector)); + // Store the results as intersection points unsigned int index = 0; for (Geom::CrossingSet::const_iterator i = cs.begin(); i != cs.end(); i++) { if (index >= constraint_path.size()) { break; } + // Reconstruct and store the points of intersection for (Geom::Crossings::const_iterator m = (*i).begin(); m != (*i).end(); m++) { - //std::cout << "ta = " << (*m).ta << " | tb = " << (*m).tb << std::endl; - // Reconstruct the point of intersection - Geom::Point p_inters = constraint_path[index].pointAt((*m).ta); - // .. and convert it to desktop coordinates - p_inters = _snapmanager->getDesktop()->doc2dt(p_inters); - Geom::Coord dist = Geom::L2(p_proj_on_cl - p_inters); - SnappedPoint s = SnappedPoint(p_inters, p.getSourceType(), p.getSourceNum(), k->target_type, dist, getSnapperTolerance(), getSnapperAlwaysSnap(), true, k->target_bbox);; - if (dist <= tolerance) { // If the intersection is within snapping range, then we might snap to it - sc.points.push_back(s); - } + intersections.push_back(constraint_path[index].pointAt((*m).ta)); } index++; } + + //Geom::crossings will not consider the closing segment apparently, so we'll handle that separately here + //TODO: This should have been fixed in rev. #9859, which makes this workaround obsolete + for(Geom::PathVector::iterator it_pv = k->path_vector->begin(); it_pv != k->path_vector->end(); ++it_pv) { + if (it_pv->closed()) { + // Get the closing linesegment and convert it to a path + Geom::Path cls; + cls.close(false); + cls.append(it_pv->back_closed()); + // Intersect that closing path with the constrained path + Geom::Crossings cs = Geom::crossings(constraint_path.front(), cls); + // Reconstruct and store the points of intersection + index = 0; // assuming the constraint path vector has only one path + for (Geom::Crossings::const_iterator m = cs.begin(); m != cs.end(); m++) { + intersections.push_back(constraint_path[index].pointAt((*m).ta)); + } + } + } + + // Convert the collected points of intersection to snapped points + for (std::vector<Geom::Point>::iterator p_inters = intersections.begin(); p_inters != intersections.end(); p_inters++) { + // Convert to desktop coordinates + (*p_inters) = _snapmanager->getDesktop()->doc2dt(*p_inters); + // Construct a snapped point + Geom::Coord dist = Geom::L2(p.getPoint() - *p_inters); + SnappedPoint s = SnappedPoint(*p_inters, p.getSourceType(), p.getSourceNum(), k->target_type, dist, getSnapperTolerance(), getSnapperAlwaysSnap(), true, k->target_bbox);; + // Store the snapped point + if (dist <= tolerance) { // If the intersection is within snapping range, then we might snap to it + sc.points.push_back(s); + } + } } } } @@ -603,12 +657,12 @@ void Inkscape::ObjectSnapper::freeSnap(SnappedConstraints &sc, } /* Get a list of all the SPItems that we will try to snap to */ - if (p.getSourceNum() == 0) { + if (p.getSourceNum() <= 0) { Geom::Rect const local_bbox_to_snap = bbox_to_snap ? *bbox_to_snap : Geom::Rect(p.getPoint(), p.getPoint()); - _findCandidates(sp_document_root(_snapmanager->getDocument()), it, p.getSourceNum() == 0, local_bbox_to_snap, false, Geom::identity()); + _findCandidates(sp_document_root(_snapmanager->getDocument()), it, p.getSourceNum() <= 0, local_bbox_to_snap, false, Geom::identity()); } - + // TODO: Argh, UGLY! Get rid of this here, move this logic to the snap manager bool snap_nodes = (_snapmanager->snapprefs.getSnapModeNode() && ( _snapmanager->snapprefs.getSnapToItemNode() || _snapmanager->snapprefs.getSnapSmoothNodes() || @@ -655,29 +709,47 @@ void Inkscape::ObjectSnapper::constrainedSnap( SnappedConstraints &sc, Inkscape::SnapCandidatePoint const &p, Geom::OptRect const &bbox_to_snap, SnapConstraint const &c, - std::vector<SPItem const *> const *it) const + std::vector<SPItem const *> const *it, + std::vector<SnapCandidatePoint> *unselected_nodes) const { if (_snap_enabled == false || _snapmanager->snapprefs.getSnapFrom(p.getSourceType()) == false) { return; } + // project the mouse pointer onto the constraint. Only the projected point will be considered for snapping + Geom::Point pp = c.projection(p.getPoint()); + /* Get a list of all the SPItems that we will try to snap to */ - if (p.getSourceNum() == 0) { - Geom::Rect const local_bbox_to_snap = bbox_to_snap ? *bbox_to_snap : Geom::Rect(p.getPoint(), p.getPoint()); - _findCandidates(sp_document_root(_snapmanager->getDocument()), it, p.getSourceNum() == 0, local_bbox_to_snap, false, Geom::identity()); + if (p.getSourceNum() <= 0) { + Geom::Rect const local_bbox_to_snap = bbox_to_snap ? *bbox_to_snap : Geom::Rect(pp, pp); + _findCandidates(sp_document_root(_snapmanager->getDocument()), it, p.getSourceNum() <= 0, local_bbox_to_snap, false, Geom::identity()); } // A constrained snap, is a snap in only one degree of freedom (specified by the constraint line). // This is useful for example when scaling an object while maintaining a fixed aspect ratio. It's // nodes are only allowed to move in one direction (i.e. in one degree of freedom). - // When snapping to objects, we either snap to their nodes or their paths. It is however very - // unlikely that any node will be exactly at the constrained line, so for a constrained snap - // to objects we will only consider the object's paths. Beside, the nodes will be at these paths, - // so we will more or less snap to them anyhow. + // TODO: Argh, UGLY! Get rid of this here, move this logic to the snap manager + bool snap_nodes = (_snapmanager->snapprefs.getSnapModeNode() && ( + _snapmanager->snapprefs.getSnapToItemNode() || + _snapmanager->snapprefs.getSnapSmoothNodes() || + _snapmanager->snapprefs.getSnapLineMidpoints() || + _snapmanager->snapprefs.getSnapObjectMidpoints() + )) || (_snapmanager->snapprefs.getSnapModeBBox() && ( + _snapmanager->snapprefs.getSnapToBBoxNode() || + _snapmanager->snapprefs.getSnapBBoxEdgeMidpoints() || + _snapmanager->snapprefs.getSnapBBoxMidpoints() + )) || (_snapmanager->snapprefs.getSnapModeBBoxOrNodes() && ( + _snapmanager->snapprefs.getIncludeItemCenter() || + _snapmanager->snapprefs.getSnapToPageBorder() + )); + + if (snap_nodes) { + _snapNodes(sc, p, unselected_nodes, c, pp); + } if (_snapmanager->snapprefs.getSnapToItemPath() || _snapmanager->snapprefs.getSnapToBBoxPath() || _snapmanager->snapprefs.getSnapToPageBorder()) { - _snapPathsConstrained(sc, p, c); + _snapPathsConstrained(sc, p, c, pp); } } @@ -781,15 +853,15 @@ void Inkscape::getBBoxPoints(Geom::OptRect const bbox, // collect the corners of the bounding box for ( unsigned k = 0 ; k < 4 ; k++ ) { if (includeCorners) { - points->push_back(Inkscape::SnapCandidatePoint(bbox->corner(k), Inkscape::SNAPSOURCE_BBOX_CORNER, 0, Inkscape::SNAPTARGET_BBOX_CORNER, *bbox)); + points->push_back(Inkscape::SnapCandidatePoint(bbox->corner(k), Inkscape::SNAPSOURCE_BBOX_CORNER, -1, Inkscape::SNAPTARGET_BBOX_CORNER, *bbox)); } // optionally, collect the midpoints of the bounding box's edges too if (includeLineMidpoints) { - points->push_back(Inkscape::SnapCandidatePoint((bbox->corner(k) + bbox->corner((k+1) % 4))/2, Inkscape::SNAPSOURCE_BBOX_EDGE_MIDPOINT, 0, Inkscape::SNAPTARGET_BBOX_EDGE_MIDPOINT, *bbox)); + points->push_back(Inkscape::SnapCandidatePoint((bbox->corner(k) + bbox->corner((k+1) % 4))/2, Inkscape::SNAPSOURCE_BBOX_EDGE_MIDPOINT, -1, Inkscape::SNAPTARGET_BBOX_EDGE_MIDPOINT, *bbox)); } } if (includeObjectMidpoints) { - points->push_back(Inkscape::SnapCandidatePoint(bbox->midpoint(), Inkscape::SNAPSOURCE_BBOX_MIDPOINT, 0, Inkscape::SNAPTARGET_BBOX_MIDPOINT, *bbox)); + points->push_back(Inkscape::SnapCandidatePoint(bbox->midpoint(), Inkscape::SNAPSOURCE_BBOX_MIDPOINT, -1, Inkscape::SNAPTARGET_BBOX_MIDPOINT, *bbox)); } } } diff --git a/src/object-snapper.h b/src/object-snapper.h index 99c8a077e..6bde3dd39 100644 --- a/src/object-snapper.h +++ b/src/object-snapper.h @@ -57,7 +57,8 @@ public: Inkscape::SnapCandidatePoint const &p, Geom::OptRect const &bbox_to_snap, SnapConstraint const &c, - std::vector<SPItem const *> const *it) const; + std::vector<SPItem const *> const *it, + std::vector<SnapCandidatePoint> *unselected_nodes) const; private: //store some lists of candidates, points and paths, so we don't have to rebuild them for each point we want to snap @@ -73,8 +74,10 @@ private: Geom::Matrix const additional_affine) const; void _snapNodes(SnappedConstraints &sc, - Inkscape::SnapCandidatePoint const &p, - std::vector<SnapCandidatePoint> *unselected_nodes) const; // in desktop coordinates + Inkscape::SnapCandidatePoint const &p, // in desktop coordinates + std::vector<SnapCandidatePoint> *unselected_nodes, + SnapConstraint const &c = SnapConstraint(), + Geom::Point const &p_proj_on_constraint = Geom::Point()) const; void _snapTranslatingGuide(SnappedConstraints &sc, Geom::Point const &p, @@ -90,12 +93,14 @@ private: void _snapPathsConstrained(SnappedConstraints &sc, Inkscape::SnapCandidatePoint const &p, // in desktop coordinates - SnapConstraint const &c) const; + SnapConstraint const &c, + Geom::Point const &p_proj_on_constraint) const; bool isUnselectedNode(Geom::Point const &point, std::vector<Inkscape::SnapCandidatePoint> const *unselected_nodes) const; - void _collectPaths(Inkscape::SnapCandidatePoint const &p, - bool const &first_point) const; + void _collectPaths(Geom::Point p, + Inkscape::SnapSourceType const source_type, + bool const &first_point) const; void _clear_paths() const; Geom::PathVector* _getBorderPathv() const; diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index c44ab5bc6..6a796b2ed 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -643,4 +643,4 @@ sp_selected_path_reverse(SPDesktop *desktop) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/path-chemistry.h b/src/path-chemistry.h index 64d7f63af..03adeeff9 100644 --- a/src/path-chemistry.h +++ b/src/path-chemistry.h @@ -34,4 +34,4 @@ bool sp_item_list_to_curves(const GSList *items, GSList **selected, GSList **to_ fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/pen-context.cpp b/src/pen-context.cpp index 4a21d7bcb..6778d4bcc 100644 --- a/src/pen-context.cpp +++ b/src/pen-context.cpp @@ -476,6 +476,7 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop); m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_NODE_HANDLE); + m.unSetup(); } spdc_create_single_dot(event_context, p, "/tools/freehand/pen", bevent.state); ret = TRUE; @@ -633,6 +634,7 @@ pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent) SnapManager &m = dt->namedview->snap_manager; m.setup(dt); m.preSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_NODE_HANDLE)); + m.unSetup(); } break; case SP_PEN_CONTEXT_CONTROL: @@ -683,6 +685,7 @@ pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent) SnapManager &m = dt->namedview->snap_manager; m.setup(dt); m.preSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_NODE_HANDLE)); + m.unSetup(); } } break; @@ -709,6 +712,7 @@ pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent) SnapManager &m = dt->namedview->snap_manager; m.setup(dt); m.preSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_NODE_HANDLE)); + m.unSetup(); } break; } @@ -1481,6 +1485,7 @@ void pen_set_to_nearest_horiz_vert(const SPPenContext *const pc, Geom::Point &pt m.setup(pc->desktop, true, selection->singleItem()); m.constrainedSnapReturnByRef(pt, Inkscape::SNAPSOURCE_NODE_HANDLE, cl); + m.unSetup(); } } @@ -1493,4 +1498,4 @@ void pen_set_to_nearest_horiz_vert(const SPPenContext *const pc, Geom::Point &pt fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/pen-context.h b/src/pen-context.h index c214da30d..1026369d1 100644 --- a/src/pen-context.h +++ b/src/pen-context.h @@ -81,4 +81,4 @@ void sp_pen_context_put_into_waiting_mode(SPDesktop *desktop, Inkscape::LivePath fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp index 9f9c187f3..0717724de 100644 --- a/src/pencil-context.cpp +++ b/src/pencil-context.cpp @@ -263,13 +263,14 @@ pencil_handle_button_press(SPPencilContext *const pc, GdkEventButton const &beve default: /* Set first point of sequence */ SnapManager &m = desktop->namedview->snap_manager; - m.setup(desktop); if (bevent.state & GDK_CONTROL_MASK) { + m.setup(desktop); if (!(bevent.state & GDK_SHIFT_MASK)) { m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_NODE_HANDLE); } spdc_create_single_dot(event_context, p, "/tools/freehand/pencil", bevent.state); + m.unSetup(); ret = true; break; } @@ -277,7 +278,7 @@ pencil_handle_button_press(SPPencilContext *const pc, GdkEventButton const &beve p = anchor->dp; desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Continuing selected path")); } else { - + m.setup(desktop); if (!(bevent.state & GDK_SHIFT_MASK)) { // This is the first click of a new curve; deselect item so that // this curve is not combined with it (unless it is drawn from its @@ -289,6 +290,7 @@ pencil_handle_button_press(SPPencilContext *const pc, GdkEventButton const &beve desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Appending to selected path")); m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_NODE_HANDLE); } + m.unSetup(); } pc->sa = anchor; spdc_set_startpoint(pc, p); @@ -416,6 +418,7 @@ pencil_handle_motion_notify(SPPencilContext *const pc, GdkEventMotion const &mev SnapManager &m = dt->namedview->snap_manager; m.setup(dt); m.preSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_NODE_HANDLE)); + m.unSetup(); } break; } @@ -950,4 +953,4 @@ fit_and_split(SPPencilContext *pc) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/pencil-context.h b/src/pencil-context.h index cbcf2b98e..aa0f60eb2 100644 --- a/src/pencil-context.h +++ b/src/pencil-context.h @@ -55,4 +55,4 @@ GType sp_pencil_context_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/persp3d-reference.cpp b/src/persp3d-reference.cpp index aa5e882ac..509332b52 100644 --- a/src/persp3d-reference.cpp +++ b/src/persp3d-reference.cpp @@ -107,4 +107,4 @@ persp3dreference_source_modified(SPObject */*iSource*/, guint /*flags*/, Persp3D fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/persp3d-reference.h b/src/persp3d-reference.h index 7c2ce31bf..992d34f60 100644 --- a/src/persp3d-reference.h +++ b/src/persp3d-reference.h @@ -63,4 +63,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/persp3d.cpp b/src/persp3d.cpp index 6a697ec9b..543d7efde 100644 --- a/src/persp3d.cpp +++ b/src/persp3d.cpp @@ -612,4 +612,4 @@ void print_current_persp3d(gchar *func_name, Persp3D *persp) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/persp3d.h b/src/persp3d.h index 62cc586ef..44b6d2435 100644 --- a/src/persp3d.h +++ b/src/persp3d.h @@ -111,4 +111,4 @@ void print_current_persp3d(gchar *func_name, Persp3D *persp); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/perspective-line.cpp b/src/perspective-line.cpp index 3e7d96fdd..4fd68f8ed 100644 --- a/src/perspective-line.cpp +++ b/src/perspective-line.cpp @@ -40,4 +40,4 @@ PerspectiveLine::PerspectiveLine (Geom::Point const &pt, Proj::Axis const axis, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/pixmaps/cursor-ellipse.xpm b/src/pixmaps/cursor-ellipse.xpm index 7a230bd55..b0f20d18c 100644 --- a/src/pixmaps/cursor-ellipse.xpm +++ b/src/pixmaps/cursor-ellipse.xpm @@ -1,8 +1,10 @@ /* XPM */ static char const *cursor_ellipse_xpm[] = { -"32 32 3 1", +"32 32 5 1", " c None", ". c #FFFFFF", +"% c Stroke", +"* c Fill", "+ c #000000", " ... ", " .+. ", @@ -12,17 +14,17 @@ static char const *cursor_ellipse_xpm[] = { "....+.... ", " .+. ", " .+. ....... ", -" ... ....+++++.... ", -" ..+++.....+++.. ", -" ..+...........+.. ", -" ..+.............+.. ", -" .+...............+. ", -" .+...............+. ", -" .+...............+. ", -" ..+.............+.. ", -" ..+...........+.. ", -" ..+++.....+++.. ", -" ....+++++.... ", +" ... ....%%%%%.... ", +" ..%%%*****%%%.. ", +" ..%***********%.. ", +" ..%*************%.. ", +" .%***************%. ", +" .%***************%. ", +" .%***************%. ", +" ..%*************%.. ", +" ..%***********%.. ", +" ..%%%*****%%%.. ", +" ....%%%%%.... ", " ....... ", " ", " ", diff --git a/src/pixmaps/cursor-rect.xpm b/src/pixmaps/cursor-rect.xpm index 149624aa7..69007bc77 100644 --- a/src/pixmaps/cursor-rect.xpm +++ b/src/pixmaps/cursor-rect.xpm @@ -1,8 +1,10 @@ /* XPM */ static char const *cursor_rect_xpm[] = { -"32 32 3 1", +"32 32 5 1", " c None", ". c #FFFFFF", +"% c Stroke", +"* c Fill", "+ c #000000", " ... ", " .+. ", @@ -12,17 +14,17 @@ static char const *cursor_rect_xpm[] = { "....+.... ", " .+. ", " .+. ................. ", -" ... .+++++++++++++++. ", -" .+.............+. ", -" .+.............+. ", -" .+.............+. ", -" .+.............+. ", -" .+.............+. ", -" .+.............+. ", -" .+.............+. ", -" .+.............+. ", -" .+.............+. ", -" .+++++++++++++++. ", +" ... .%%%%%%%%%%%%%%%. ", +" .%*************%. ", +" .%*************%. ", +" .%*************%. ", +" .%*************%. ", +" .%*************%. ", +" .%*************%. ", +" .%*************%. ", +" .%*************%. ", +" .%*************%. ", +" .%%%%%%%%%%%%%%%. ", " ................. ", " ", " ", diff --git a/src/pixmaps/cursor-star.xpm b/src/pixmaps/cursor-star.xpm index 80d312ace..eedf448e4 100644 --- a/src/pixmaps/cursor-star.xpm +++ b/src/pixmaps/cursor-star.xpm @@ -1,8 +1,10 @@ /* XPM */ static char const *cursor_star_xpm[] = { -"32 32 3 1", +"32 32 5 1", " c None", ". c #FFFFFF", +"% c Stroke", +"* c Fill", "+ c #000000", " ... ", " .+. ", @@ -10,21 +12,21 @@ static char const *cursor_star_xpm[] = { "....+.... ", ".+++ +++. ", "....+.... .. ", -" .+. .++. ", -" .+. .++. ", -" ... .++. ", -" .+..+. ", -" ........+..+........ ", -" .++++++....++++++. ", -" .++..........++. ", -" ..++......++.. ", -" .+......+. ", -" .+......+. ", -" .+...++...+. ", -" .+.++..++.+. ", -" .+.+.. ..+.+. ", -" .++. .++. ", -" .+. .+. ", +" .+. .%%. ", +" .+. .%%. ", +" ... .%%. ", +" .%**%* ", +" ........%**%........ ", +" .%%%%%%****%%%%%%. ", +" .%%**********%%. ", +" ..%%******%%.. ", +" .%******%. ", +" .%******%. ", +" .%***%%***%. ", +" .%*%%..%%*%. ", +" .%*%.. ..%*%. ", +" .%%. .%%. ", +" .%. .%. ", " .. .. ", " ", " ", diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 260136949..671f76e57 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -477,4 +477,4 @@ static char const preferences_skeleton[] = fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/preferences-test.h b/src/preferences-test.h index 79f852106..8e8ddb65b 100644 --- a/src/preferences-test.h +++ b/src/preferences-test.h @@ -133,4 +133,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/preferences.cpp b/src/preferences.cpp index 315c668b4..3815d44c5 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -828,4 +828,4 @@ Preferences *Preferences::_instance = NULL; fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/print.cpp b/src/print.cpp index ed9b8d19c..ba29b17ad 100644 --- a/src/print.cpp +++ b/src/print.cpp @@ -195,4 +195,4 @@ sp_print_document_to_file(SPDocument *doc, gchar const *filename) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/print.h b/src/print.h index 577a169cf..f566d4e31 100644 --- a/src/print.h +++ b/src/print.h @@ -57,4 +57,4 @@ void sp_print_document_to_file(SPDocument *doc, gchar const *filename); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/profile-manager.cpp b/src/profile-manager.cpp index 1cd965e39..b70926947 100644 --- a/src/profile-manager.cpp +++ b/src/profile-manager.cpp @@ -23,6 +23,8 @@ ProfileManager::ProfileManager(SPDocument *document) : ProfileManager::~ProfileManager() { + _resource_connection.disconnect(); + _doc = 0; } void ProfileManager::_resourcesChanged() @@ -94,4 +96,4 @@ ColorProfile* ProfileManager::find(gchar const* name) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/profile-manager.h b/src/profile-manager.h index 61e22615f..be9446c17 100644 --- a/src/profile-manager.h +++ b/src/profile-manager.h @@ -52,4 +52,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/proj_pt.cpp b/src/proj_pt.cpp index 55f896a1a..d9d4e06f1 100644 --- a/src/proj_pt.cpp +++ b/src/proj_pt.cpp @@ -116,4 +116,4 @@ Pt3::coord_string() { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/proj_pt.h b/src/proj_pt.h index cc56f1aa8..90b9df201 100644 --- a/src/proj_pt.h +++ b/src/proj_pt.h @@ -168,4 +168,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/rdf.cpp b/src/rdf.cpp index 0a8fd51f6..99b56a103 100644 --- a/src/rdf.cpp +++ b/src/rdf.cpp @@ -226,68 +226,68 @@ struct rdf_license_t rdf_licenses [] = { // Remember when using the "title" and "tip" elements to pass them through // the localization functions when you use them! struct rdf_work_entity_t rdf_work_entities [] = { - { "title", N_("Title"), "dc:title", RDF_CONTENT, - N_("Name by which this document is formally known."), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, + { "title", N_("Title:"), "dc:title", RDF_CONTENT, + N_("Name by which this document is formally known"), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, }, - { "date", N_("Date"), "dc:date", RDF_CONTENT, - N_("Date associated with the creation of this document (YYYY-MM-DD)."), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, + { "date", N_("Date:"), "dc:date", RDF_CONTENT, + N_("Date associated with the creation of this document (YYYY-MM-DD)"), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, }, - { "format", N_("Format"), "dc:format", RDF_CONTENT, - N_("The physical or digital manifestation of this document (MIME type)."), RDF_FORMAT_LINE, RDF_EDIT_HARDCODED, + { "format", N_("Format:"), "dc:format", RDF_CONTENT, + N_("The physical or digital manifestation of this document (MIME type)"), RDF_FORMAT_LINE, RDF_EDIT_HARDCODED, }, - { "type", N_("Type"), "dc:type", RDF_RESOURCE, - N_("Type of document (DCMI Type)."), RDF_FORMAT_LINE, RDF_EDIT_HARDCODED, + { "type", N_("Type:"), "dc:type", RDF_RESOURCE, + N_("Type of document (DCMI Type)"), RDF_FORMAT_LINE, RDF_EDIT_HARDCODED, }, - { "creator", N_("Creator"), "dc:creator", RDF_AGENT, - N_("Name of entity primarily responsible for making the content of this document."), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, + { "creator", N_("Creator:"), "dc:creator", RDF_AGENT, + N_("Name of entity primarily responsible for making the content of this document"), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, }, - { "rights", N_("Rights"), "dc:rights", RDF_AGENT, - N_("Name of entity with rights to the Intellectual Property of this document."), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, + { "rights", N_("Rights:"), "dc:rights", RDF_AGENT, + N_("Name of entity with rights to the Intellectual Property of this document"), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, }, - { "publisher", N_("Publisher"), "dc:publisher", RDF_AGENT, - N_("Name of entity responsible for making this document available."), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, + { "publisher", N_("Publisher:"), "dc:publisher", RDF_AGENT, + N_("Name of entity responsible for making this document available"), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, }, - { "identifier", N_("Identifier"), "dc:identifier", RDF_CONTENT, - N_("Unique URI to reference this document."), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, + { "identifier", N_("Identifier:"), "dc:identifier", RDF_CONTENT, + N_("Unique URI to reference this document"), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, }, - { "source", N_("Source"), "dc:source", RDF_CONTENT, - N_("Unique URI to reference the source of this document."), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, + { "source", N_("Source:"), "dc:source", RDF_CONTENT, + N_("Unique URI to reference the source of this document"), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, }, - { "relation", N_("Relation"), "dc:relation", RDF_CONTENT, - N_("Unique URI to a related document."), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, + { "relation", N_("Relation:"), "dc:relation", RDF_CONTENT, + N_("Unique URI to a related document"), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, }, - { "language", N_("Language"), "dc:language", RDF_CONTENT, - N_("Two-letter language tag with optional subtags for the language of this document. (e.g. 'en-GB')"), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, + { "language", N_("Language:"), "dc:language", RDF_CONTENT, + N_("Two-letter language tag with optional subtags for the language of this document (e.g. 'en-GB')"), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, }, - { "subject", N_("Keywords"), "dc:subject", RDF_BAG, - N_("The topic of this document as comma-separated key words, phrases, or classifications."), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, + { "subject", N_("Keywords:"), "dc:subject", RDF_BAG, + N_("The topic of this document as comma-separated key words, phrases, or classifications"), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, }, // TRANSLATORS: "Coverage": the spatial or temporal characteristics of the content. // For info, see Appendix D of http://www.w3.org/TR/1998/WD-rdf-schema-19980409/ - { "coverage", N_("Coverage"), "dc:coverage", RDF_CONTENT, - N_("Extent or scope of this document."), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, + { "coverage", N_("Coverage:"), "dc:coverage", RDF_CONTENT, + N_("Extent or scope of this document"), RDF_FORMAT_LINE, RDF_EDIT_GENERIC, }, - { "description", N_("Description"), "dc:description", RDF_CONTENT, - N_("A short account of the content of this document."), RDF_FORMAT_MULTILINE, RDF_EDIT_GENERIC, + { "description", N_("Description:"), "dc:description", RDF_CONTENT, + N_("A short account of the content of this document"), RDF_FORMAT_MULTILINE, RDF_EDIT_GENERIC, }, // FIXME: need to handle 1 agent per line of input - { "contributor", N_("Contributors"), "dc:contributor", RDF_AGENT, - N_("Names of entities responsible for making contributions to the content of this document."), RDF_FORMAT_MULTILINE, RDF_EDIT_GENERIC, + { "contributor", N_("Contributors:"), "dc:contributor", RDF_AGENT, + N_("Names of entities responsible for making contributions to the content of this document"), RDF_FORMAT_MULTILINE, RDF_EDIT_GENERIC, }, // TRANSLATORS: URL to a page that defines the license for the document - { "license_uri", N_("URI"), "cc:license", RDF_RESOURCE, + { "license_uri", N_("URI:"), "cc:license", RDF_RESOURCE, // TRANSLATORS: this is where you put a URL to a page that defines the license - N_("URI to this document's license's namespace definition."), RDF_FORMAT_LINE, RDF_EDIT_SPECIAL, + N_("URI to this document's license's namespace definition"), RDF_FORMAT_LINE, RDF_EDIT_SPECIAL, }, // TRANSLATORS: fragment of XML representing the license of the document - { "license_fragment", N_("Fragment"), "License", RDF_XML, - N_("XML fragment for the RDF 'License' section."), RDF_FORMAT_MULTILINE, RDF_EDIT_SPECIAL, + { "license_fragment", N_("Fragment:"), "License", RDF_XML, + N_("XML fragment for the RDF 'License' section"), RDF_FORMAT_MULTILINE, RDF_EDIT_SPECIAL, }, { NULL, NULL, NULL, RDF_CONTENT, @@ -1020,4 +1020,4 @@ rdf_set_defaults ( SPDocument * doc ) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : @@ -117,4 +117,4 @@ void rdf_set_defaults ( SPDocument * doc ); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/rect-context.cpp b/src/rect-context.cpp index 7ae27c13d..86f0b54a3 100644 --- a/src/rect-context.cpp +++ b/src/rect-context.cpp @@ -110,6 +110,7 @@ static void sp_rect_context_init(SPRectContext *rect_context) event_context->tolerance = 0; event_context->within_tolerance = false; event_context->item_to_select = NULL; + event_context->tool_url = "/tools/shapes/rect"; rect_context->item = NULL; @@ -284,6 +285,7 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop); m.freeSnapReturnByRef(button_dt, Inkscape::SNAPSOURCE_NODE_HANDLE); + m.unSetup(); rc->center = from_2geom(button_dt); sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), @@ -323,7 +325,9 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent Geom::Point const motion_w(event->motion.x, event->motion.y); Geom::Point motion_dt(desktop->w2d(motion_w)); + m.preSnap(Inkscape::SnapCandidatePoint(motion_dt, Inkscape::SNAPSOURCE_NODE_HANDLE)); + m.unSetup(); } break; case GDK_BUTTON_RELEASE: @@ -584,4 +588,4 @@ static void sp_rect_cancel(SPRectContext *rc) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/remove-last.h b/src/remove-last.h index 094f57cc2..a5bbd89f8 100644 --- a/src/remove-last.h +++ b/src/remove-last.h @@ -29,4 +29,4 @@ inline void remove_last(std::vector<T> &seq, T const &elem) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/round-test.h b/src/round-test.h index f2918583a..8e9ca69e0 100644 --- a/src/round-test.h +++ b/src/round-test.h @@ -87,5 +87,5 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/rubberband.cpp b/src/rubberband.cpp index 76743cf8b..17e7102f8 100644 --- a/src/rubberband.cpp +++ b/src/rubberband.cpp @@ -156,4 +156,4 @@ bool Inkscape::Rubberband::is_started() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/rubberband.h b/src/rubberband.h index 1f4b7d2ea..57e4ea2a3 100644 --- a/src/rubberband.h +++ b/src/rubberband.h @@ -85,4 +85,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/satisfied-guide-cns.cpp b/src/satisfied-guide-cns.cpp index dcf635989..0a47a5852 100644 --- a/src/satisfied-guide-cns.cpp +++ b/src/satisfied-guide-cns.cpp @@ -30,4 +30,4 @@ void satisfied_guide_cns(SPDesktop const &desktop, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/satisfied-guide-cns.h b/src/satisfied-guide-cns.h index 7fba29161..57803daf4 100644 --- a/src/satisfied-guide-cns.h +++ b/src/satisfied-guide-cns.h @@ -24,4 +24,4 @@ void satisfied_guide_cns(SPDesktop const &desktop, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 7538145d4..ff1b3baa1 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -840,10 +840,8 @@ sp_selection_raise(SPDesktop *desktop) } sp_document_done(sp_desktop_document(desktop), SP_VERB_SELECTION_RAISE, - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - // "Raise" means "to raise an object" in the undo history - Q_("undo action|Raise")); + //TRANSLATORS: "Raise" means "to raise an object" in the undo history + C_("Undo action", "Raise")); } void sp_selection_raise_to_top(SPDesktop *desktop) @@ -2049,10 +2047,8 @@ sp_selection_clone(SPDesktop *desktop) Inkscape::GC::release(clone); } - // TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_CLONE, - Q_("action|Clone")); + C_("Action","Clone")); selection->setReprList(newsel); @@ -3304,4 +3300,4 @@ void unhide_all_in_all_layers(SPDesktop *dt) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/selection-describer.cpp b/src/selection-describer.cpp index 9321ea0ef..c9d6871c3 100644 --- a/src/selection-describer.cpp +++ b/src/selection-describer.cpp @@ -39,10 +39,8 @@ const gchar * type2term(GType type) { if (type == SP_TYPE_ANCHOR) - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - // "Link" means internet link (anchor) - { return Q_("web|Link"); } + //TRANSLATORS: "Link" means internet link (anchor) + { return C_("Web", "Link"); } if (type == SP_TYPE_CIRCLE) { return _("Circle"); } if (type == SP_TYPE_ELLIPSE) @@ -68,10 +66,8 @@ type2term(GType type) if (type == SP_TYPE_TEXT) { return _("Text"); } if (type == SP_TYPE_USE) - // TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - // "Clone" is a noun, type of object - { return Q_("object|Clone"); } + // TRANSLATORS: "Clone" is a noun, type of object + { return C_("Object", "Clone"); } if (type == SP_TYPE_ARC) { return _("Ellipse"); } if (type == SP_TYPE_OFFSET) @@ -255,4 +251,4 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/selection-describer.h b/src/selection-describer.h index 4b0e3d8c7..cca6a3033 100644 --- a/src/selection-describer.h +++ b/src/selection-describer.h @@ -51,4 +51,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/selection.cpp b/src/selection.cpp index 3f333e4e2..a4508d9bb 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -557,4 +557,4 @@ guint Selection::numberOfParents() { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/selection.h b/src/selection.h index 5e3b4bba2..a3a6e87e8 100644 --- a/src/selection.h +++ b/src/selection.h @@ -381,4 +381,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/seltrans-handles.cpp b/src/seltrans-handles.cpp index 95b680c5e..d3197a062 100644 --- a/src/seltrans-handles.cpp +++ b/src/seltrans-handles.cpp @@ -39,4 +39,4 @@ SPSelTransHandle const handle_center = fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 4b1ab1e76..26de63cfd 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -401,21 +401,6 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s g_warning("Checking number of snap sources failed; nothing serious, but please report to Diederik"); } - // Optionally, show the snap source - if (!(_state == STATE_ROTATE && x != 0.5 && y != 0.5)) { // but not when we're dragging a rotation handle, because that won't snap - // Now either _bbox_points or _snap_points has a single element, the other one has zero..... or both have zero elements - if ((_snap_points.size() + _bbox_points.size() + _bbox_points_for_translating.size()) > 1) { - g_warning("too many snap sources to display, please fix this"); - } else if (m.snapprefs.getSnapEnabledGlobally()) { - if (_bbox_points.size() == 1) { - _desktop->snapindicator->set_new_snapsource(_bbox_points.at(0)); - } else if (_bbox_points_for_translating.size() == 1) { - _desktop->snapindicator->set_new_snapsource(_bbox_points_for_translating.at(0)); - } else if (_snap_points.size() == 1){ - _desktop->snapindicator->set_new_snapsource(_snap_points.at(0)); - } - } - } } if ((x != -1) && (y != -1)) { @@ -1039,6 +1024,7 @@ gboolean Inkscape::SelTrans::scaleRequest(Geom::Point &pt, guint state) geom_scale = Geom::Scale(sn.getTransformation()); pt = _calcAbsAffineGeom(geom_scale); } + m.unSetup(); } /* Status text */ @@ -1134,6 +1120,8 @@ gboolean Inkscape::SelTrans::stretchRequest(SPSelTransHandle const &handle, Geom // will have to calculate pt taking the stroke width into account pt = _calcAbsAffineGeom(geom_scale); } + + m.unSetup(); } // status text @@ -1226,6 +1214,8 @@ gboolean Inkscape::SelTrans::skewRequest(SPSelTransHandle const &handle, Geom::P } else { _desktop->snapindicator->remove_snaptarget(); } + + m.unSetup(); } // Update the handle position @@ -1299,6 +1289,7 @@ gboolean Inkscape::SelTrans::rotateRequest(Geom::Point &pt, guint state) m.setup(_desktop, false, _items_const); // When rotating, we cannot snap the corners of the bounding box, see the comment in "constrainedSnapRotate" for details Inkscape::SnappedPoint sn = m.constrainedSnapRotate(_snap_points, _point, radians, _origin); + m.unSetup(); if (sn.getSnapped()) { _desktop->snapindicator->set_new_snaptarget(sn); @@ -1309,6 +1300,7 @@ gboolean Inkscape::SelTrans::rotateRequest(Geom::Point &pt, guint state) } else { _desktop->snapindicator->remove_snaptarget(); } + } @@ -1331,29 +1323,30 @@ gboolean Inkscape::SelTrans::rotateRequest(Geom::Point &pt, guint state) // Move the item's transformation center gboolean Inkscape::SelTrans::centerRequest(Geom::Point &pt, guint state) { + // When dragging the transformation center while multiple items have been selected, then those + // items will share a single center. While dragging that single center, it should never snap to the + // centers of any of the selected objects. Therefore we will have to pass the list of selected items + // to the snapper, to avoid self-snapping of the rotation center + GSList *items = (GSList *) const_cast<Selection *>(_selection)->itemList(); SnapManager &m = _desktop->namedview->snap_manager; m.setup(_desktop); - - // Center is being dragged for the first item in the selection only - // Find out which item is first ... - GSList *items = (GSList *) const_cast<Selection *>(_selection)->itemList(); - SPItem *first = NULL; - if (items) { - first = reinterpret_cast<SPItem*>(g_slist_last(items)->data); // from the first item in selection - } - // ... and store that item because later on we need to make sure that - // this transformation center won't snap to itself - m.setRotationCenterSource(first); - m.freeSnapReturnByRef(pt, Inkscape::SNAPSOURCE_ROTATION_CENTER); - - if (state & GDK_CONTROL_MASK) { - if ( fabs(_point[Geom::X] - pt[Geom::X]) > fabs(_point[Geom::Y] - pt[Geom::Y]) ) { - pt[Geom::Y] = _point[Geom::Y]; - } else { - pt[Geom::X] = _point[Geom::X]; + m.setRotationCenterSource(items); + + if (state & GDK_CONTROL_MASK) { // with Ctrl, constrain to axes + std::vector<Inkscape::Snapper::SnapConstraint> constraints; + constraints.push_back(Inkscape::Snapper::SnapConstraint(_point, Geom::Point(1, 0))); + constraints.push_back(Inkscape::Snapper::SnapConstraint(_point, Geom::Point(0, 1))); + Inkscape::SnappedPoint sp = m.multipleConstrainedSnaps(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_ROTATION_CENTER), constraints, state & GDK_SHIFT_MASK); + pt = sp.getPoint(); + } + else { + if (!(state & GDK_SHIFT_MASK)) { // Shift disables snapping + m.freeSnapReturnByRef(pt, Inkscape::SNAPSOURCE_ROTATION_CENTER); } } + m.unSetup(); + // status text GString *xs = SP_PX_TO_METRIC_STRING(pt[Geom::X], _desktop->namedview->getDefaultMetric()); GString *ys = SP_PX_TO_METRIC_STRING(pt[Geom::Y], _desktop->namedview->getDefaultMetric()); @@ -1439,6 +1432,7 @@ void Inkscape::SelTrans::moveTo(Geom::Point const &xy, guint state) } m.setup(_desktop, true, _items_const); dxy = m.multipleOfGridPitch(dxy, _point); + m.unSetup(); } else if (shift) { if (control) { // shift & control: constrained movement without snapping if (fabs(dxy[Geom::X]) > fabs(dxy[Geom::Y])) { @@ -1493,6 +1487,7 @@ void Inkscape::SelTrans::moveTo(Geom::Point const &xy, guint state) double elapsed = ((((double)endtime.tv_sec - starttime.tv_sec) * G_USEC_PER_SEC + (endtime.tv_usec - starttime.tv_usec))) / 1000.0; std::cout << "Time spent snapping: " << elapsed << std::endl; */ } + m.unSetup(); /* Pick one */ Inkscape::SnappedPoint best_snapped_point; @@ -1650,6 +1645,7 @@ void Inkscape::SelTrans::_keepClosestPointOnly(std::vector<Inkscape::SnapCandida } } + closest_point.setSourceNum(-1); points.clear(); points.push_back(closest_point); } @@ -1663,4 +1659,4 @@ void Inkscape::SelTrans::_keepClosestPointOnly(std::vector<Inkscape::SnapCandida fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/shortcuts.cpp b/src/shortcuts.cpp index 7d0f3747d..d647d30b3 100644 --- a/src/shortcuts.cpp +++ b/src/shortcuts.cpp @@ -28,6 +28,7 @@ #include <gdk/gdkkeys.h> #include <gdk/gdkkeysyms.h> +#include <gtk/gtk.h> #include "helper/action.h" #include "io/sys.h" @@ -198,14 +199,41 @@ sp_shortcut_get_verb(unsigned int shortcut) return (Inkscape::Verb *)(g_hash_table_lookup(verbs, GINT_TO_POINTER(shortcut))); } -unsigned int -sp_shortcut_get_primary(Inkscape::Verb *verb) +unsigned int sp_shortcut_get_primary(Inkscape::Verb *verb) { - if (!primary_shortcuts) sp_shortcut_init(); - return (unsigned int)GPOINTER_TO_INT(g_hash_table_lookup(primary_shortcuts, - (gpointer)(verb))); + unsigned int result = GDK_VoidSymbol; + if (!primary_shortcuts) { + sp_shortcut_init(); + } + gpointer value = 0; + if (g_hash_table_lookup_extended(primary_shortcuts, static_cast<gpointer>(verb), NULL, &value)) { + result = static_cast<unsigned int>(GPOINTER_TO_INT(value)); + } + return result; } +gchar *sp_shortcut_get_label(unsigned int shortcut) +{ + // The comment below was copied from the function sp_ui_shortcut_string in interface.cpp (which was subsequently removed) + /* TODO: This function shouldn't exist. Our callers should use GtkAccelLabel instead of + * a generic GtkLabel containing this string, and should call gtk_widget_add_accelerator. + * Will probably need to change sp_shortcut_invoke callers. + * + * The existing gtk_label_new_with_mnemonic call can be replaced with + * g_object_new(GTK_TYPE_ACCEL_LABEL, NULL) followed by + * gtk_label_set_text_with_mnemonic(lbl, str). + */ + gchar *result = 0; + if (shortcut != GDK_VoidSymbol) { + result = gtk_accelerator_get_label( + shortcut & (~SP_SHORTCUT_MODIFIER_MASK), static_cast<GdkModifierType>( + ((shortcut & SP_SHORTCUT_SHIFT_MASK) ? GDK_SHIFT_MASK : 0) | + ((shortcut & SP_SHORTCUT_CONTROL_MASK) ? GDK_CONTROL_MASK : 0) | + ((shortcut & SP_SHORTCUT_ALT_MASK) ? GDK_MOD1_MASK : 0) + )); + } + return result; +} /* Local Variables: @@ -216,4 +244,4 @@ sp_shortcut_get_primary(Inkscape::Verb *verb) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/shortcuts.h b/src/shortcuts.h index 5119851c9..9d84aa6d1 100644 --- a/src/shortcuts.h +++ b/src/shortcuts.h @@ -24,12 +24,14 @@ namespace Inkscape { #define SP_SHORTCUT_SHIFT_MASK (1 << 24) #define SP_SHORTCUT_CONTROL_MASK (1 << 25) #define SP_SHORTCUT_ALT_MASK (1 << 26) +#define SP_SHORTCUT_MODIFIER_MASK (SP_SHORTCUT_SHIFT_MASK|SP_SHORTCUT_CONTROL_MASK|SP_SHORTCUT_ALT_MASK) /* Returns true if action was performed */ bool sp_shortcut_invoke (unsigned int shortcut, Inkscape::UI::View::View *view); Inkscape::Verb * sp_shortcut_get_verb (unsigned int shortcut); -unsigned int sp_shortcut_get_primary (Inkscape::Verb * verb); +unsigned int sp_shortcut_get_primary (Inkscape::Verb * verb); // Returns GDK_VoidSymbol if no shortcut is found. +char* sp_shortcut_get_label (unsigned int shortcut); // Returns the human readable form of the shortcut (or NULL), for example Shift+Ctrl+F. Free the returned string with g_free. #endif @@ -42,4 +44,4 @@ unsigned int sp_shortcut_get_primary (Inkscape::Verb * verb); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/snap-candidate.h b/src/snap-candidate.h index a0fc3290c..772800be5 100644 --- a/src/snap-candidate.h +++ b/src/snap-candidate.h @@ -38,21 +38,22 @@ public: _source_type(source), _target_type(target) { - _source_num = 0; + _source_num = -1; _target_bbox = Geom::OptRect(); } - SnapCandidatePoint(Geom::Point const &point, Inkscape::SnapSourceType const source, long const source_num = 0) + SnapCandidatePoint(Geom::Point const &point, Inkscape::SnapSourceType const source) : _point(point), _source_type(source), _target_type(Inkscape::SNAPTARGET_UNDEFINED), - _source_num(source_num) + _source_num(-1) { _target_bbox = Geom::OptRect(); } inline Geom::Point const & getPoint() const {return _point;} inline Inkscape::SnapSourceType getSourceType() const {return _source_type;} + bool isSingleHandle() const {return (_source_type == SNAPSOURCE_NODE_HANDLE || _source_type == SNAPSOURCE_OTHER_HANDLE) && _source_num == -1;} inline Inkscape::SnapTargetType getTargetType() const {return _target_type;} inline long getSourceNum() const {return _source_num;} void setSourceNum(long num) {_source_num = num;} @@ -68,7 +69,9 @@ private: Inkscape::SnapSourceType _source_type; Inkscape::SnapTargetType _target_type; - //Sequence number of the source point within the set of points that is to be snapped. Starting at zero + //Sequence number of the source point within the set of points that is to be snapped. + // - Starts counting at zero, but only if there might be more points following (e.g. in the selector tool) + // - Minus one (-1) if we're sure that we have only a single point long _source_num; // If this is a target and it belongs to a bounding box, e.g. when the target type is diff --git a/src/snap-preferences.cpp b/src/snap-preferences.cpp index aa967349d..15c976466 100644 --- a/src/snap-preferences.cpp +++ b/src/snap-preferences.cpp @@ -124,4 +124,4 @@ bool Inkscape::SnapPreferences::getSnapFrom(Inkscape::SnapSourceType t) const fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/snap-preferences.h b/src/snap-preferences.h index 49d52cdb2..cc8f24503 100644 --- a/src/snap-preferences.h +++ b/src/snap-preferences.h @@ -132,4 +132,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/snap.cpp b/src/snap.cpp index 40dd4ca31..7b0b4ce48 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -34,6 +34,7 @@ #include "sp-guide.h" #include "preferences.h" #include "event-context.h" +#include "util/mathfns.h" using std::vector; /** @@ -46,7 +47,11 @@ SnapManager::SnapManager(SPNamedView const *v) : guide(this, 0), object(this, 0), snapprefs(), - _named_view(v) + _named_view(v), + _rotation_center_source_items(NULL), + _guide_to_ignore(NULL), + _desktop(NULL), + _unselected_nodes(NULL) { } @@ -175,7 +180,7 @@ void SnapManager::freeSnapReturnByRef(Geom::Point &p, Geom::OptRect const &bbox_to_snap) const { Inkscape::SnappedPoint const s = freeSnap(Inkscape::SnapCandidatePoint(p, source_type), bbox_to_snap); - s.getPoint(p); + s.getPointIfSnapped(p); } @@ -220,6 +225,7 @@ void SnapManager::preSnap(Inkscape::SnapCandidatePoint const &p) if (_snapindicator) { _snapindicator = false; // prevent other methods from drawing a snap indicator; we want to control this here Inkscape::SnappedPoint s = freeSnap(p); + g_assert(_desktop != NULL); if (s.getSnapped()) { _desktop->snapindicator->set_new_snaptarget(s, true); } else { @@ -313,11 +319,12 @@ Geom::Point SnapManager::multipleOfGridPitch(Geom::Point const &t, Geom::Point c * constrainedSnapReturnByRef() is equal in snapping behavior to * constrainedSnap(), but the former returns the snapped point trough the referenced * parameter p. This parameter p initially contains the position of the snap - * source and will we overwritten by the target position if snapping has occurred. + * source and will be overwritten by the target position if snapping has occurred. * This makes snapping transparent to the calling code. If this is not desired * because either the calling code must know whether snapping has occurred, or * because the original position should not be touched, then constrainedSnap() should - * be called instead. + * be called instead. If there's nothing to snap to or if snapping has been disabled, + * then this method will still apply the constraint (but without snapping) * * PS: * 1) SnapManager::setup() must have been called before calling this method, @@ -337,8 +344,8 @@ void SnapManager::constrainedSnapReturnByRef(Geom::Point &p, Inkscape::Snapper::SnapConstraint const &constraint, Geom::OptRect const &bbox_to_snap) const { - Inkscape::SnappedPoint const s = constrainedSnap(Inkscape::SnapCandidatePoint(p, source_type, 0), constraint, bbox_to_snap); - s.getPoint(p); + Inkscape::SnappedPoint const s = constrainedSnap(Inkscape::SnapCandidatePoint(p, source_type), constraint, bbox_to_snap); + p = s.getPoint(); // If we didn't snap, then we will return the point projected onto the constraint } /** @@ -351,6 +358,8 @@ void SnapManager::constrainedSnapReturnByRef(Geom::Point &p, * * PS: SnapManager::setup() must have been called before calling this method, * but only once for a set of points + * PS: If there's nothing to snap to or if snapping has been disabled, then this + * method will still apply the constraint (but without snapping) * * \param p Source point to be snapped * \param constraint The direction or line along which snapping must occur @@ -371,17 +380,38 @@ Inkscape::SnappedPoint SnapManager::constrainedSnap(Inkscape::SnapCandidatePoint return no_snap; } + Inkscape::SnappedPoint result = no_snap; + + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if ((prefs->getBool("/options/snapmousepointer/value", false)) && p.isSingleHandle()) { + // Snapping the mouse pointer instead of the constrained position of the knot allows + // to snap to things which don't intersect with the constraint line; this is basically + // then just a freesnap with the constraint applied afterwards + // We'll only to this if we're dragging a single handle, and for example not when transforming an object in the selector tool + result = freeSnap(p, bbox_to_snap); + if (result.getSnapped()) { + // only change the snap indicator if we really snapped to something + if (_snapindicator && _desktop) { + _desktop->snapindicator->set_new_snaptarget(result); + } + // Apply the constraint + result.setPoint(constraint.projection(result.getPoint())); + return result; + } + return no_snap; + } + SnappedConstraints sc; SnapperList const snappers = getSnappers(); for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); i++) { - (*i)->constrainedSnap(sc, p, bbox_to_snap, constraint, &_items_to_ignore); + (*i)->constrainedSnap(sc, p, bbox_to_snap, constraint, &_items_to_ignore, _unselected_nodes); } - Inkscape::SnappedPoint result = findBestSnap(p, sc, true); + result = findBestSnap(p, sc, true); if (result.getSnapped()) { // only change the snap indicator if we really snapped to something - if (_snapindicator) { + if (_snapindicator && _desktop) { _desktop->snapindicator->set_new_snaptarget(result); } return result; @@ -394,12 +424,14 @@ Inkscape::SnappedPoint SnapManager::constrainedSnap(Inkscape::SnapCandidatePoint * and will try to snap the SnapCandidatePoint to all of the provided constraints and see which one fits best * \param p Source point to be snapped * \param constraints List of directions or lines along which snapping must occur + * \param dont_snap If true then we will only apply the constraint, without snapping * \param bbox_to_snap Bounding box hulling the set of points, all from the same selection and having the same transformation */ Inkscape::SnappedPoint SnapManager::multipleConstrainedSnaps(Inkscape::SnapCandidatePoint const &p, std::vector<Inkscape::Snapper::SnapConstraint> const &constraints, + bool dont_snap, Geom::OptRect const &bbox_to_snap) const { @@ -411,40 +443,65 @@ Inkscape::SnappedPoint SnapManager::multipleConstrainedSnaps(Inkscape::SnapCandi SnappedConstraints sc; SnapperList const snappers = getSnappers(); std::vector<Geom::Point> projections; - bool snapping_is_futile = !someSnapperMightSnap(); + bool snapping_is_futile = !someSnapperMightSnap() || dont_snap; + + Inkscape::SnappedPoint result = no_snap; + + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + bool snap_mouse = prefs->getBool("/options/snapmousepointer/value", false); - // Iterate over the constraints for (std::vector<Inkscape::Snapper::SnapConstraint>::const_iterator c = constraints.begin(); c != constraints.end(); c++) { // Project the mouse pointer onto the constraint; In case we don't snap then we will // return the projection onto the constraint, such that the constraint is always enforced Geom::Point pp = (*c).projection(p.getPoint()); projections.push_back(pp); - // Try to snap to the constraint - if (!snapping_is_futile) { - for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); i++) { - (*i)->constrainedSnap(sc, p, bbox_to_snap, *c, &_items_to_ignore); + } + + if (snap_mouse && p.isSingleHandle() && !dont_snap) { + // Snapping the mouse pointer instead of the constrained position of the knot allows + // to snap to things which don't intersect with the constraint line; this is basically + // then just a freesnap with the constraint applied afterwards + // We'll only to this if we're dragging a single handle, and for example not when transforming an object in the selector tool + result = freeSnap(p, bbox_to_snap); + } else { + // Iterate over the constraints + for (std::vector<Inkscape::Snapper::SnapConstraint>::const_iterator c = constraints.begin(); c != constraints.end(); c++) { + // Try to snap to the constraint + if (!snapping_is_futile) { + for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); i++) { + (*i)->constrainedSnap(sc, p, bbox_to_snap, *c, &_items_to_ignore,_unselected_nodes); + } } } + result = findBestSnap(p, sc, true); } - Inkscape::SnappedPoint result = findBestSnap(p, sc, true); - if (result.getSnapped()) { - // only change the snap indicator if we really snapped to something - if (_snapindicator) { - _desktop->snapindicator->set_new_snaptarget(result); + if (snap_mouse) { + // If "snap_mouse" then we still have to apply the constraint, because so far we only tried a freeSnap + Geom::Point result_closest; + for (std::vector<Inkscape::Snapper::SnapConstraint>::const_iterator c = constraints.begin(); c != constraints.end(); c++) { + // Project the mouse pointer onto the constraint; In case we don't snap then we will + // return the projection onto the constraint, such that the constraint is always enforced + Geom::Point result_p = (*c).projection(result.getPoint()); + if (c == constraints.begin() || (Geom::L2(result_p - p.getPoint()) < Geom::L2(result_closest - p.getPoint()))) { + result_closest = result_p; + } + } + result.setPoint(result_closest); } return result; } // So we didn't snap, but we still need to return a point on one of the constraints // Find out which of the constraints yielded the closest projection of point p - no_snap.setPoint(projections.front()); for (std::vector<Geom::Point>::iterator pp = projections.begin(); pp != projections.end(); pp++) { if (pp != projections.begin()) { if (Geom::L2(*pp - p.getPoint()) < Geom::L2(no_snap.getPoint() - p.getPoint())) { no_snap.setPoint(*pp); } + } else { + no_snap.setPoint(projections.front()); } } @@ -452,6 +509,55 @@ Inkscape::SnappedPoint SnapManager::multipleConstrainedSnaps(Inkscape::SnapCandi } /** + * \brief Try to snap a point to something at a specific angle + * + * When drawing a straight line or modifying a gradient, it will snap to specific angle increments + * if CTRL is being pressed. This method will enforce this angular constraint (even if there is nothing + * to snap to) + * + * \param p Source point to be snapped + * \param p_ref Optional original point, relative to which the angle should be calculated. If empty then + * the angle will be calculated relative to the y-axis + * \param snaps Number of angular increments per PI radians; E.g. if snaps = 2 then we will snap every PI/2 = 90 degrees + */ + +Inkscape::SnappedPoint SnapManager::constrainedAngularSnap(Inkscape::SnapCandidatePoint const &p, + boost::optional<Geom::Point> const &p_ref, + Geom::Point const &o, + unsigned const snaps) const +{ + Inkscape::SnappedPoint sp; + if (snaps > 0) { // 0 means no angular snapping + // p is at an arbitrary angle. Now we should snap this angle to specific increments. + // For this we'll calculate the closest two angles, one at each side of the current angle + Geom::Line y_axis(Geom::Point(0, 0), Geom::Point(0, 1)); + Geom::Line p_line(o, p.getPoint()); + double angle = Geom::angle_between(y_axis, p_line); + double angle_incr = M_PI / snaps; + double angle_offset = 0; + if (p_ref) { + Geom::Line p_line_ref(o, *p_ref); + angle_offset = Geom::angle_between(y_axis, p_line_ref); + } + double angle_ceil = round_to_upper_multiple_plus(angle, angle_incr, angle_offset); + double angle_floor = round_to_lower_multiple_plus(angle, angle_incr, angle_offset); + // We have two angles now. The constrained snapper will try each of them and return the closest + + // Now do the snapping... + std::vector<Inkscape::Snapper::SnapConstraint> constraints; + constraints.push_back(Inkscape::Snapper::SnapConstraint(Geom::Line(o, angle_ceil - M_PI/2))); + constraints.push_back(Inkscape::Snapper::SnapConstraint(Geom::Line(o, angle_floor - M_PI/2))); + sp = multipleConstrainedSnaps(p, constraints); // Constraints will always be applied, even if we didn't snap + if (!sp.getSnapped()) { // If we haven't snapped then we only had the constraint applied; + sp.setTarget(Inkscape::SNAPTARGET_CONSTRAINED_ANGLE); + } + } else { + sp = freeSnap(p); + } + return sp; +} + +/** * \brief Try to snap a point of a guide to another guide or to a node * * Try to snap a point of a guide to another guide or to a node in two degrees- @@ -493,7 +599,7 @@ void SnapManager::guideFreeSnap(Geom::Point &p, Geom::Point const &guide_normal, Inkscape::SnappedPoint const s = findBestSnap(candidate, sc, false, false); - s.getPoint(p); + s.getPointIfSnapped(p); } /** @@ -526,18 +632,18 @@ void SnapManager::guideConstrainedSnap(Geom::Point &p, SPGuide const &guideline) SnappedConstraints sc; Inkscape::Snapper::SnapConstraint cl(guideline.point_on_line, Geom::rot90(guideline.normal_to_line)); if (object.ThisSnapperMightSnap()) { - object.constrainedSnap(sc, candidate, Geom::OptRect(), cl, NULL); + object.constrainedSnap(sc, candidate, Geom::OptRect(), cl, NULL, NULL); } // Snap to guides & grid lines SnapperList snappers = getGridSnappers(); snappers.push_back(&guide); for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); i++) { - (*i)->constrainedSnap(sc, candidate, Geom::OptRect(), cl, NULL); + (*i)->constrainedSnap(sc, candidate, Geom::OptRect(), cl, NULL, NULL); } Inkscape::SnappedPoint const s = findBestSnap(candidate, sc, false); - s.getPoint(p); + s.getPointIfSnapped(p); } /** @@ -552,6 +658,8 @@ void SnapManager::guideConstrainedSnap(Geom::Point &p, SPGuide const &guideline) * a free snap or constrained snap is more appropriate, do the snapping, calculate * some metrics to quantify the snap "distance", and see if it's better than the * previous snap. Finally, the best ("nearest") snap from all these points is returned. + * If no snap has occurred and we're asked for a constrained snap then the constraint + * will be applied nevertheless * * \param points Collection of points to snap (snap sources), at their untransformed position, all points undergoing the same transformation. Paired with an identifier of the type of the snap source. * \param pointer Location of the mouse pointer at the time dragging started (i.e. when the selection was still untransformed). @@ -581,10 +689,7 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed( ** appropriate transformation with `true'; otherwise we return the original scale with `false'. */ - /* Quick check to see if we have any snappers that are enabled - ** Also used to globally disable all snapping - */ - if (someSnapperMightSnap() == false || points.size() == 0) { + if (points.size() == 0) { return Inkscape::SnappedPoint(pointer); } @@ -604,7 +709,7 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed( bbox.expandTo(transformed); } - transformed_points.push_back(Inkscape::SnapCandidatePoint(transformed, (*i).getSourceType(), source_num)); + transformed_points.push_back(Inkscape::SnapCandidatePoint(transformed, (*i).getSourceType(), source_num, Inkscape::SNAPTARGET_UNDEFINED, Geom::OptRect())); source_num++; } @@ -699,96 +804,110 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed( Geom::Point result; - if (snapped_point.getSnapped()) { - /* We snapped. Find the transformation that describes where the snapped point has - ** ended up, and also the metric for this transformation. - */ - Geom::Point const a = snapped_point.getPoint() - origin; // vector to snapped point - //Geom::Point const b = (*i - origin); // vector to original point - - switch (transformation_type) { - case TRANSLATE: - result = snapped_point.getPoint() - (*i).getPoint(); - /* Consider the case in which a box is almost aligned with a grid in both - * horizontal and vertical directions. The distance to the intersection of - * the grid lines will always be larger then the distance to a single grid - * line. If we prefer snapping to an intersection instead of to a single - * grid line, then we cannot use "metric = Geom::L2(result)". Therefore the - * snapped distance will be used as a metric. Please note that the snapped - * distance is defined as the distance to the nearest line of the intersection, - * and not to the intersection itself! - */ - // Only for translations, the relevant metric will be the real snapped distance, - // so we don't have to do anything special here - break; - case SCALE: - { - result = Geom::Point(Geom::infinity(), Geom::infinity()); - // If this point *i is horizontally or vertically aligned with - // the origin of the scaling, then it will scale purely in X or Y - // We can therefore only calculate the scaling in this direction - // and the scaling factor for the other direction should remain - // untouched (unless scaling is uniform of course) - for (int index = 0; index < 2; index++) { - if (fabs(b[index]) > 1e-6) { // if SCALING CAN occur in this direction - if (fabs(fabs(a[index]/b[index]) - fabs(transformation[index])) > 1e-12) { // if SNAPPING DID occur in this direction - result[index] = a[index] / b[index]; // then calculate it! - } - // we might leave result[1-index] = Geom::infinity() - // if scaling didn't occur in the other direction - } - } - if (uniform) { - if (fabs(result[0]) < fabs(result[1])) { - result[1] = result[0]; - } else { - result[0] = result[1]; + /*Find the transformation that describes where the snapped point has + ** ended up, and also the metric for this transformation. + */ + Geom::Point const a = snapped_point.getPoint() - origin; // vector to snapped point + //Geom::Point const b = (*i - origin); // vector to original point + + switch (transformation_type) { + case TRANSLATE: + result = snapped_point.getPoint() - (*i).getPoint(); + /* Consider the case in which a box is almost aligned with a grid in both + * horizontal and vertical directions. The distance to the intersection of + * the grid lines will always be larger then the distance to a single grid + * line. If we prefer snapping to an intersection instead of to a single + * grid line, then we cannot use "metric = Geom::L2(result)". Therefore the + * snapped distance will be used as a metric. Please note that the snapped + * distance is defined as the distance to the nearest line of the intersection, + * and not to the intersection itself! + */ + // Only for translations, the relevant metric will be the real snapped distance, + // so we don't have to do anything special here + break; + case SCALE: + { + result = Geom::Point(NR_HUGE, NR_HUGE); + // If this point *i is horizontally or vertically aligned with + // the origin of the scaling, then it will scale purely in X or Y + // We can therefore only calculate the scaling in this direction + // and the scaling factor for the other direction should remain + // untouched (unless scaling is uniform of course) + for (int index = 0; index < 2; index++) { + if (fabs(b[index]) > 1e-6) { // if SCALING CAN occur in this direction + if (fabs(fabs(a[index]/b[index]) - fabs(transformation[index])) > 1e-12) { // if SNAPPING DID occur in this direction + result[index] = a[index] / b[index]; // then calculate it! } + // we might leave result[1-index] = NR_HUGE + // if scaling didn't occur in the other direction } - // Compare the resulting scaling with the desired scaling - Geom::Point scale_metric = Geom::abs(result - transformation); // One or both of its components might be Geom::infinity() - snapped_point.setSnapDistance(std::min(scale_metric[0], scale_metric[1])); - snapped_point.setSecondSnapDistance(std::max(scale_metric[0], scale_metric[1])); - break; } - case STRETCH: - result = Geom::Point(Geom::infinity(), Geom::infinity()); - if (fabs(b[dim]) > 1e-6) { // if STRETCHING will occur for this point - result[dim] = a[dim] / b[dim]; - result[1-dim] = uniform ? result[dim] : 1; - } else { // STRETCHING might occur for this point, but only when the stretching is uniform - if (uniform && fabs(b[1-dim]) > 1e-6) { - result[1-dim] = a[1-dim] / b[1-dim]; - result[dim] = result[1-dim]; - } + if (uniform) { + if (fabs(result[0]) < fabs(result[1])) { + result[1] = result[0]; + } else { + result[0] = result[1]; } - // Store the metric for this transformation as a virtual distance - snapped_point.setSnapDistance(std::abs(result[dim] - transformation[dim])); - snapped_point.setSecondSnapDistance(Geom::infinity()); - break; - case SKEW: - result[0] = (snapped_point.getPoint()[dim] - ((*i).getPoint())[dim]) / b[1 - dim]; // skew factor - result[1] = transformation[1]; // scale factor - // Store the metric for this transformation as a virtual distance - snapped_point.setSnapDistance(std::abs(result[0] - transformation[0])); - snapped_point.setSecondSnapDistance(Geom::infinity()); - break; - case ROTATE: - // a is vector to snapped point; b is vector to original point; now lets calculate angle between a and b - result[0] = atan2(Geom::dot(Geom::rot90(b), a), Geom::dot(b, a)); - result[1] = result[1]; // how else should we store an angle in a point ;-) - // Store the metric for this transformation as a virtual distance (we're storing an angle) - snapped_point.setSnapDistance(std::abs(result[0] - transformation[0])); - snapped_point.setSecondSnapDistance(NR_HUGE); - break; - default: - g_assert_not_reached(); + } + // Compare the resulting scaling with the desired scaling + Geom::Point scale_metric = Geom::abs(result - transformation); // One or both of its components might be NR_HUGE + snapped_point.setSnapDistance(std::min(scale_metric[0], scale_metric[1])); + snapped_point.setSecondSnapDistance(std::max(scale_metric[0], scale_metric[1])); + break; } + case STRETCH: + result = Geom::Point(NR_HUGE, NR_HUGE); + if (fabs(b[dim]) > 1e-6) { // if STRETCHING will occur for this point + result[dim] = a[dim] / b[dim]; + result[1-dim] = uniform ? result[dim] : 1; + } else { // STRETCHING might occur for this point, but only when the stretching is uniform + if (uniform && fabs(b[1-dim]) > 1e-6) { + result[1-dim] = a[1-dim] / b[1-dim]; + result[dim] = result[1-dim]; + } + } + // Store the metric for this transformation as a virtual distance + snapped_point.setSnapDistance(std::abs(result[dim] - transformation[dim])); + snapped_point.setSecondSnapDistance(NR_HUGE); + break; + case SKEW: + result[0] = (snapped_point.getPoint()[dim] - ((*i).getPoint())[dim]) / b[1 - dim]; // skew factor + result[1] = transformation[1]; // scale factor + // Store the metric for this transformation as a virtual distance + snapped_point.setSnapDistance(std::abs(result[0] - transformation[0])); + snapped_point.setSecondSnapDistance(NR_HUGE); + break; + case ROTATE: + // a is vector to snapped point; b is vector to original point; now lets calculate angle between a and b + result[0] = atan2(Geom::dot(Geom::rot90(b), a), Geom::dot(b, a)); + result[1] = result[1]; // how else should we store an angle in a point ;-) + // Store the metric for this transformation as a virtual distance (we're storing an angle) + snapped_point.setSnapDistance(std::abs(result[0] - transformation[0])); + snapped_point.setSecondSnapDistance(NR_HUGE); + break; + default: + g_assert_not_reached(); + } + if (snapped_point.getSnapped()) { + // We snapped; keep track of the best snap if (best_snapped_point.isOtherSnapBetter(snapped_point, true)) { best_transformation = result; best_snapped_point = snapped_point; } + } else { + // So we didn't snap for this point + if (!best_snapped_point.getSnapped()) { + // ... and none of the points before snapped either + // We might still need to apply a constraint though, if we tried a constrained snap. And + // in case of a free snap we might have use for the transformed point, so let's return that + // point, whether it's constrained or not + if (best_snapped_point.isOtherSnapBetter(snapped_point, true)) { + // .. so we must keep track of the best non-snapped constrained point + best_transformation = result; + best_snapped_point = snapped_point; + } + } } j++; @@ -830,14 +949,13 @@ Inkscape::SnappedPoint SnapManager::freeSnapTranslate(std::vector<Inkscape::Snap Geom::Point const &pointer, Geom::Point const &tr) const { + Inkscape::SnappedPoint result = _snapTransformed(p, pointer, false, Geom::Point(0,0), TRANSLATE, tr, Geom::Point(0,0), Geom::X, false); + if (p.size() == 1) { - Geom::Point pt = _transformPoint(p.at(0), TRANSLATE, tr, Geom::Point(0,0), Geom::X, false); - _displaySnapsource(Inkscape::SnapCandidatePoint(pt, p.at(0).getSourceType())); + _displaySnapsource(Inkscape::SnapCandidatePoint(result.getPoint(), p.at(0).getSourceType())); } - - - return _snapTransformed(p, pointer, false, Geom::Point(0,0), TRANSLATE, tr, Geom::Point(0,0), Geom::X, false); + return result; } /** @@ -855,12 +973,13 @@ Inkscape::SnappedPoint SnapManager::constrainedSnapTranslate(std::vector<Inkscap Inkscape::Snapper::SnapConstraint const &constraint, Geom::Point const &tr) const { + Inkscape::SnappedPoint result = _snapTransformed(p, pointer, true, constraint, TRANSLATE, tr, Geom::Point(0,0), Geom::X, false); + if (p.size() == 1) { - Geom::Point pt = _transformPoint(p.at(0), TRANSLATE, tr, Geom::Point(0,0), Geom::X, false); - _displaySnapsource(Inkscape::SnapCandidatePoint(pt, p.at(0).getSourceType())); + _displaySnapsource(Inkscape::SnapCandidatePoint(result.getPoint(), p.at(0).getSourceType())); } - return _snapTransformed(p, pointer, true, constraint, TRANSLATE, tr, Geom::Point(0,0), Geom::X, false); + return result; } @@ -879,12 +998,13 @@ Inkscape::SnappedPoint SnapManager::freeSnapScale(std::vector<Inkscape::SnapCand Geom::Scale const &s, Geom::Point const &o) const { + Inkscape::SnappedPoint result = _snapTransformed(p, pointer, false, Geom::Point(0,0), SCALE, Geom::Point(s[Geom::X], s[Geom::Y]), o, Geom::X, false); + if (p.size() == 1) { - Geom::Point pt = _transformPoint(p.at(0), SCALE, Geom::Point(s[Geom::X], s[Geom::Y]), o, Geom::X, false); - _displaySnapsource(Inkscape::SnapCandidatePoint(pt, p.at(0).getSourceType())); + _displaySnapsource(Inkscape::SnapCandidatePoint(result.getPoint(), p.at(0).getSourceType())); } - return _snapTransformed(p, pointer, false, Geom::Point(0,0), SCALE, Geom::Point(s[Geom::X], s[Geom::Y]), o, Geom::X, false); + return result; } @@ -904,12 +1024,13 @@ Inkscape::SnappedPoint SnapManager::constrainedSnapScale(std::vector<Inkscape::S Geom::Point const &o) const { // When constrained scaling, only uniform scaling is supported. + Inkscape::SnappedPoint result = _snapTransformed(p, pointer, true, Geom::Point(0,0), SCALE, Geom::Point(s[Geom::X], s[Geom::Y]), o, Geom::X, true); + if (p.size() == 1) { - Geom::Point pt = _transformPoint(p.at(0), SCALE, Geom::Point(s[Geom::X], s[Geom::Y]), o, Geom::X, true); - _displaySnapsource(Inkscape::SnapCandidatePoint(pt, p.at(0).getSourceType())); + _displaySnapsource(Inkscape::SnapCandidatePoint(result.getPoint(), p.at(0).getSourceType())); } - return _snapTransformed(p, pointer, true, Geom::Point(0,0), SCALE, Geom::Point(s[Geom::X], s[Geom::Y]), o, Geom::X, true); + return result; } /** @@ -931,12 +1052,13 @@ Inkscape::SnappedPoint SnapManager::constrainedSnapStretch(std::vector<Inkscape: Geom::Dim2 d, bool u) const { + Inkscape::SnappedPoint result = _snapTransformed(p, pointer, true, Geom::Point(0,0), STRETCH, Geom::Point(s, s), o, d, u); + if (p.size() == 1) { - Geom::Point pt = _transformPoint(p.at(0), STRETCH, Geom::Point(s, s), o, d, u); - _displaySnapsource(Inkscape::SnapCandidatePoint(pt, p.at(0).getSourceType())); + _displaySnapsource(Inkscape::SnapCandidatePoint(result.getPoint(), p.at(0).getSourceType())); } - return _snapTransformed(p, pointer, true, Geom::Point(0,0), STRETCH, Geom::Point(s, s), o, d, u); + return result; } /** @@ -969,12 +1091,13 @@ Inkscape::SnappedPoint SnapManager::constrainedSnapSkew(std::vector<Inkscape::Sn g_assert(!(p.at(0).getSourceType() & Inkscape::SNAPSOURCE_BBOX_CATEGORY)); } + Inkscape::SnappedPoint result = _snapTransformed(p, pointer, true, constraint, SKEW, s, o, d, false); + if (p.size() == 1) { - Geom::Point pt = _transformPoint(p.at(0), SKEW, s, o, d, false); - _displaySnapsource(Inkscape::SnapCandidatePoint(pt, p.at(0).getSourceType())); + _displaySnapsource(Inkscape::SnapCandidatePoint(result.getPoint(), p.at(0).getSourceType())); } - return _snapTransformed(p, pointer, true, constraint, SKEW, s, o, d, false); + return result; } /** @@ -998,12 +1121,13 @@ Inkscape::SnappedPoint SnapManager::constrainedSnapRotate(std::vector<Inkscape:: // so it's corners have a different transformation. The snappers cannot handle this, therefore snapping // of bounding boxes is not allowed here. + Inkscape::SnappedPoint result = _snapTransformed(p, pointer, true, Geom::Point(0,0), ROTATE, Geom::Point(angle, angle), o, Geom::X, false); + if (p.size() == 1) { - Geom::Point pt = _transformPoint(p.at(0), ROTATE, Geom::Point(angle, angle), o, Geom::X, false); - _displaySnapsource(Inkscape::SnapCandidatePoint(pt, p.at(0).getSourceType())); + _displaySnapsource(Inkscape::SnapCandidatePoint(result.getPoint(), p.at(0).getSourceType())); } - return _snapTransformed(p, pointer, true, Geom::Point(0,0), ROTATE, Geom::Point(angle, angle), o, Geom::X, false); + return result; } @@ -1025,7 +1149,7 @@ Inkscape::SnappedPoint SnapManager::findBestSnap(Inkscape::SnapCandidatePoint co bool noCurves, bool allowOffScreen) const { - + g_assert(_desktop != NULL); /* std::cout << "Type and number of snapped constraints: " << std::endl; @@ -1147,13 +1271,16 @@ void SnapManager::setup(SPDesktop const *desktop, SPGuide *guide_to_ignore) { g_assert(desktop != NULL); + if (_desktop != NULL) { + g_warning("The snapmanager has been set up before, but unSetup() hasn't been called afterwards. It possibly held invalid pointers"); + } _items_to_ignore.clear(); _items_to_ignore.push_back(item_to_ignore); _desktop = desktop; _snapindicator = snapindicator; _unselected_nodes = unselected_nodes; _guide_to_ignore = guide_to_ignore; - _rotation_center_source_item = NULL; + _rotation_center_source_items = NULL; } /** @@ -1179,12 +1306,15 @@ void SnapManager::setup(SPDesktop const *desktop, SPGuide *guide_to_ignore) { g_assert(desktop != NULL); + if (_desktop != NULL) { + g_warning("The snapmanager has been set up before, but unSetup() hasn't been called afterwards. It possibly held invalid pointers"); + } _items_to_ignore = items_to_ignore; _desktop = desktop; _snapindicator = snapindicator; _unselected_nodes = unselected_nodes; _guide_to_ignore = guide_to_ignore; - _rotation_center_source_item = NULL; + _rotation_center_source_items = NULL; } /// Setup, taking the list of items to ignore from the desktop's selection. @@ -1193,11 +1323,16 @@ void SnapManager::setupIgnoreSelection(SPDesktop const *desktop, std::vector<Inkscape::SnapCandidatePoint> *unselected_nodes, SPGuide *guide_to_ignore) { + g_assert(desktop != NULL); + if (_desktop != NULL) { + // Someone has been naughty here! This is dangerous + g_warning("The snapmanager has been set up before, but unSetup() hasn't been called afterwards. It possibly held invalid pointers"); + } _desktop = desktop; _snapindicator = snapindicator; _unselected_nodes = unselected_nodes; _guide_to_ignore = guide_to_ignore; - _rotation_center_source_item = NULL; + _rotation_center_source_items = NULL; _items_to_ignore.clear(); Inkscape::Selection *sel = _desktop->selection; @@ -1285,6 +1420,7 @@ void SnapManager::_displaySnapsource(Inkscape::SnapCandidatePoint const &p) cons bool p_is_a_bbox = p.getSourceType() & Inkscape::SNAPSOURCE_BBOX_CATEGORY; bool p_is_other = p.getSourceType() & Inkscape::SNAPSOURCE_OTHER_CATEGORY; + g_assert(_desktop != NULL); if (snapprefs.getSnapEnabledGlobally() && (p_is_other || (p_is_a_node && snapprefs.getSnapModeNode()) || (p_is_a_bbox && snapprefs.getSnapModeBBox()))) { _desktop->snapindicator->set_new_snapsource(p); } else { @@ -1302,4 +1438,4 @@ void SnapManager::_displaySnapsource(Inkscape::SnapCandidatePoint const &p) cons fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/snap.h b/src/snap.h index c85c51963..c79bd308a 100644 --- a/src/snap.h +++ b/src/snap.h @@ -98,12 +98,17 @@ public: std::vector<Inkscape::SnapCandidatePoint> *unselected_nodes = NULL, SPGuide *guide_to_ignore = NULL); + void unSetup() {_rotation_center_source_items = NULL; + _guide_to_ignore = NULL; + _desktop = NULL; + _unselected_nodes = NULL;} + // If we're dragging a rotation center, then setRotationCenterSource() stores the parent item // of this rotation center; this reference is used to make sure that we do not snap a rotation // center to itself // NOTE: Must be called after calling setup(), not before! - void setRotationCenterSource(SPItem *item) {_rotation_center_source_item = item;} - SPItem* getRotationCenterSource() {return _rotation_center_source_item;} + void setRotationCenterSource(GSList *items) {_rotation_center_source_items = items;} + GSList const *getRotationCenterSource() {return _rotation_center_source_items;} // freeSnapReturnByRef() is preferred over freeSnap(), because it only returns a // point if snapping has occurred (by overwriting p); otherwise p is untouched @@ -130,8 +135,14 @@ public: Geom::OptRect const &bbox_to_snap = Geom::OptRect()) const; Inkscape::SnappedPoint multipleConstrainedSnaps(Inkscape::SnapCandidatePoint const &p, - std::vector<Inkscape::Snapper::SnapConstraint> const &constraints, - Geom::OptRect const &bbox_to_snap = Geom::OptRect()) const; + std::vector<Inkscape::Snapper::SnapConstraint> const &constraints, + bool dont_snap = false, + Geom::OptRect const &bbox_to_snap = Geom::OptRect()) const; + + Inkscape::SnappedPoint constrainedAngularSnap(Inkscape::SnapCandidatePoint const &p, + boost::optional<Geom::Point> const &p_ref, + Geom::Point const &o, + unsigned const snaps) const; void guideFreeSnap(Geom::Point &p, Geom::Point const &guide_normal, SPGuideDragType drag_type) const; void guideConstrainedSnap(Geom::Point &p, SPGuide const &guideline) const; @@ -195,7 +206,7 @@ protected: private: std::vector<SPItem const *> _items_to_ignore; ///< Items that should not be snapped to, for example the items that are currently being dragged. Set using the setup() method - SPItem *_rotation_center_source_item; // to avoid snapping a rotation center to itself + GSList *_rotation_center_source_items; // to avoid snapping a rotation center to itself SPGuide *_guide_to_ignore; ///< A guide that should not be snapped to, e.g. the guide that is currently being dragged SPDesktop const *_desktop; bool _snapindicator; ///< When true, an indicator will be drawn at the position that was being snapped to diff --git a/src/snapped-curve.cpp b/src/snapped-curve.cpp index 894e49f9a..3d563a3ec 100644 --- a/src/snapped-curve.cpp +++ b/src/snapped-curve.cpp @@ -47,7 +47,7 @@ Inkscape::SnappedCurve::SnappedCurve() _at_intersection = false; _fully_constrained = false; _source = SNAPSOURCE_UNDEFINED; - _source_num = 0; + _source_num = -1; _target = SNAPTARGET_UNDEFINED; _target_bbox = Geom::OptRect(); } diff --git a/src/snapped-line.cpp b/src/snapped-line.cpp index 4b6a25929..525208f06 100644 --- a/src/snapped-line.cpp +++ b/src/snapped-line.cpp @@ -33,7 +33,7 @@ Inkscape::SnappedLineSegment::SnappedLineSegment() _end_point_of_line = Geom::Point(0,0); _point = Geom::Point(0,0); _source = SNAPSOURCE_UNDEFINED; - _source_num = 0; + _source_num = -1; _target = SNAPTARGET_UNDEFINED; _distance = Geom::infinity(); _tolerance = 1; @@ -111,7 +111,7 @@ Inkscape::SnappedLine::SnappedLine() _normal_to_line = Geom::Point(0,0); _point_on_line = Geom::Point(0,0); _source = SNAPSOURCE_UNDEFINED; - _source_num = 0; + _source_num = -1; _target = SNAPTARGET_UNDEFINED; _distance = Geom::infinity(); _tolerance = 1; diff --git a/src/snapped-point.cpp b/src/snapped-point.cpp index 29e094a7c..2db3d62e4 100644 --- a/src/snapped-point.cpp +++ b/src/snapped-point.cpp @@ -61,7 +61,7 @@ Inkscape::SnappedPoint::SnappedPoint() { _point = Geom::Point(0,0); _source = SNAPSOURCE_UNDEFINED, - _source_num = 0, + _source_num = -1, _target = SNAPTARGET_UNDEFINED, _at_intersection = false; _constrained_snap = false; @@ -81,7 +81,7 @@ Inkscape::SnappedPoint::SnappedPoint(Geom::Point const &p) { _point = p; _source = SNAPSOURCE_UNDEFINED, - _source_num = 0, + _source_num = -1, _target = SNAPTARGET_UNDEFINED, _at_intersection = false; _fully_constrained = false; @@ -100,7 +100,7 @@ Inkscape::SnappedPoint::~SnappedPoint() { } -void Inkscape::SnappedPoint::getPoint(Geom::Point &p) const +void Inkscape::SnappedPoint::getPointIfSnapped(Geom::Point &p) const { // When we have snapped if (getSnapped()) { @@ -127,7 +127,7 @@ bool getClosestSP(std::list<Inkscape::SnappedPoint> const &list, Inkscape::Snapp bool Inkscape::SnappedPoint::isOtherSnapBetter(Inkscape::SnappedPoint const &other_one, bool weighted) const { - if (!other_one.getSnapped()) { + if (getSnapped() && !other_one.getSnapped()) { return false; } diff --git a/src/snapped-point.h b/src/snapped-point.h index 9c753acd0..7dc6edeca 100644 --- a/src/snapped-point.h +++ b/src/snapped-point.h @@ -47,7 +47,7 @@ public: * to, because it only returns a point if snapping has actually occurred * (by overwriting p) */ - void getPoint(Geom::Point &p) const; + void getPointIfSnapped(Geom::Point &p) const; /* This method however always returns a point, even if no snapping * has occurred; A check should be implemented in the calling code @@ -96,7 +96,7 @@ public: protected: Geom::Point _point; // Location of the snapped point SnapSourceType _source; // Describes what snapped - long _source_num; // Sequence number of the source point that snapped, if that point is part of a set of points. (starting at zero) + long _source_num; // Sequence number of the source point that snapped, if that point is part of a set of points. (starting at zero if we might have a set of points; -1 if we only have a single point) SnapTargetType _target; // Describes to what we've snapped to bool _at_intersection; // If true, the snapped point is at an intersection bool _constrained_snap; // If true, then the snapped point was found when looking for a constrained snap diff --git a/src/snapper.h b/src/snapper.h index d8214db80..91784d3ae 100644 --- a/src/snapper.h +++ b/src/snapper.h @@ -72,7 +72,7 @@ public: class SnapConstraint { private: - enum SnapConstraintType {LINE, DIRECTION, CIRCLE}; + enum SnapConstraintType {LINE, DIRECTION, CIRCLE, UNDEFINED}; public: // Constructs a direction constraint, e.g. horizontal or vertical but without a specified point @@ -82,11 +82,13 @@ public: SnapConstraint(Geom::Line const &l) : _point(l.origin()), _direction(l.versor()), _type(LINE) {} // Constructs a circular constraint SnapConstraint(Geom::Point const &p, Geom::Point const &d, Geom::Coord const &r) : _point(p), _direction(d), _radius(r), _type(CIRCLE) {} + // Undefined, or empty constraint + SnapConstraint() : _type(UNDEFINED) {} - bool hasPoint() const {return _type != DIRECTION;} + bool hasPoint() const {return _type != DIRECTION && _type != UNDEFINED;} Geom::Point getPoint() const { - g_assert(_type != DIRECTION); + g_assert(_type != DIRECTION && _type != UNDEFINED); return _point; } @@ -102,6 +104,7 @@ public: bool isCircular() const { return _type == CIRCLE; } bool isLinear() const { return _type == LINE; } bool isDirection() const { return _type == DIRECTION; } + bool isUndefined() const { return _type == UNDEFINED; } Geom::Point projection(Geom::Point const &p) const { // returns the projection of p on this constraint if (_type == CIRCLE) { @@ -114,11 +117,14 @@ public: // point to be projected is exactly at the center of the circle, so any point on the circle is a projection return _point + Geom::Point(_radius, 0); } - } else { + } else if (_type != UNDEFINED){ // project on to a linear constraint Geom::Point const p1_on_cl = (_type == LINE) ? _point : p; Geom::Point const p2_on_cl = p1_on_cl + _direction; return Geom::projection(p, Geom::Line(p1_on_cl, p2_on_cl)); + } else { + g_warning("Bug: trying to find the projection onto an undefined constraint"); + return Geom::Point(); } } @@ -133,7 +139,8 @@ public: Inkscape::SnapCandidatePoint const &/*p*/, Geom::OptRect const &/*bbox_to_snap*/, SnapConstraint const &/*c*/, - std::vector<SPItem const *> const */*it*/) const {}; + std::vector<SPItem const *> const */*it*/, + std::vector<SnapCandidatePoint> */*unselected_nodes*/) const {}; protected: SnapManager *_snapmanager; diff --git a/src/sp-animation.cpp b/src/sp-animation.cpp index 2d9f2e941..132d0aa0f 100644 --- a/src/sp-animation.cpp +++ b/src/sp-animation.cpp @@ -287,4 +287,4 @@ sp_animate_set(SPObject *object, unsigned int key, gchar const *value) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-clippath.cpp b/src/sp-clippath.cpp index f429933a7..ab7660cab 100644 --- a/src/sp-clippath.cpp +++ b/src/sp-clippath.cpp @@ -416,4 +416,4 @@ sp_clippath_create (GSList *reprs, SPDocument *document, Geom::Matrix const* app fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-cursor.cpp b/src/sp-cursor.cpp index 4bbba5f10..cc52f3c97 100644 --- a/src/sp-cursor.cpp +++ b/src/sp-cursor.cpp @@ -1,13 +1,15 @@ -#define __SP_CURSOR_C__ - /* * Some convenience stuff * * Authors: * Lauris Kaplinski <lauris@kaplinski.com> + * Jasper van de Gronde <th.v.d.gronde@hccnet.nl> + * Jon A. Cruz <jon@joncruz.org> * * Copyright (C) 1999-2002 authors * Copyright (C) 2001-2002 Ximian, Inc. + * Copyright (C) 2010 Jasper van de Gronde + * Copyright (C) 2010 Jon A. Cruz * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -16,26 +18,27 @@ #include <cstring> #include <string> #include <ctype.h> +#include <map> +#include "color.h" #include "sp-cursor.h" -void -sp_cursor_bitmap_and_mask_from_xpm(GdkBitmap **bitmap, GdkBitmap **mask, gchar const *const *xpm) +void sp_cursor_bitmap_and_mask_from_xpm(GdkBitmap **bitmap, GdkBitmap **mask, gchar const *const *xpm) { - int height; - int width; - int colors; - int pix; + int height = 0; + int width = 0; + int colors = 0; + int pix = 0; sscanf(xpm[0], "%d %d %d %d", &height, &width, &colors, &pix); - g_return_if_fail (height == 32); - g_return_if_fail (width == 32); - g_return_if_fail (colors >= 3); + g_return_if_fail(height == 32); + g_return_if_fail(width == 32); + g_return_if_fail(colors >= 3); int transparent_color = ' '; - int black_color = '.'; + std::string black_colors; - char pixmap_buffer[(32 * 32)/8]; - char mask_buffer[(32 * 32)/8]; + char pixmap_buffer[(32 * 32) / 8] = {0}; + char mask_buffer[(32 * 32) / 8] = {0}; for (int i = 0; i < colors; i++) { @@ -51,33 +54,36 @@ sp_cursor_bitmap_and_mask_from_xpm(GdkBitmap **bitmap, GdkBitmap **mask, gchar c p++; } - if (strcmp(p, "None") == 0) { + if (strcmp(p, "None") == 0) { transparent_color = ccode; } + if (strcmp(p, "Stroke") == 0) { + black_colors.push_back(ccode); + } + if (strcmp(p, "#000000") == 0) { - black_color = ccode; + black_colors.push_back(ccode); } } for (int y = 0; y < 32; y++) { for (int x = 0; x < 32; ) { - char value = 0; char maskv = 0; for (int pix = 0; pix < 8; pix++, x++){ - if (xpm[4+y][x] != transparent_color) { + if (xpm[1 + colors + y][x] != transparent_color) { maskv |= 1 << pix; - if (xpm[4+y][x] == black_color) { + if (black_colors.find(xpm[1 + colors + y][x]) != std::string::npos) { value |= 1 << pix; } } } - pixmap_buffer[(y * 4 + x/8)-1] = value; - mask_buffer[(y * 4 + x/8)-1] = maskv; + pixmap_buffer[(y * 4 + x / 8) - 1] = value; + mask_buffer[(y * 4 + x / 8) - 1] = maskv; } } @@ -85,26 +91,110 @@ sp_cursor_bitmap_and_mask_from_xpm(GdkBitmap **bitmap, GdkBitmap **mask, gchar c *mask = gdk_bitmap_create_from_data(NULL, mask_buffer, 32, 32); } -GdkCursor * -sp_cursor_new_from_xpm(gchar const *const *xpm, gint hot_x, gint hot_y) +static void free_cursor_data(guchar *pixels, gpointer data) { + delete [] reinterpret_cast<guint32*>(pixels); +} + +struct RGBA { + guchar v[4]; + + RGBA() { + v[0] = 0; + v[1] = 0; + v[2] = 0; + v[3] = 0; + } + + RGBA(guchar r, guchar g, guchar b, guchar a) { + v[0] = r; + v[1] = g; + v[2] = b; + v[3] = a; + } + + operator guint32() const { + guint32 result = (static_cast<guint32>(v[0]) << 0) + | (static_cast<guint32>(v[1]) << 8) + | (static_cast<guint32>(v[2]) << 16) + | (static_cast<guint32>(v[3]) << 24); + return result; + } +}; + +GdkPixbuf *sp_cursor_pixbuf_from_xpm(gchar const *const *xpm, GdkColor const& black, GdkColor const& white, guint32 fill, guint32 stroke) +{ + int height = 0; + int width = 0; + int colors = 0; + int pix = 0; + sscanf(xpm[0], "%d %d %d %d", &height, &width, &colors, &pix); + + //g_return_if_fail (height == 32); + //g_return_if_fail (width == 32); + //g_return_if_fail (colors >= 3); + + std::map<char, RGBA> colorMap; + + for (int i = 0; i < colors; i++) { + + char const *p = xpm[1 + i]; + char const ccode = *p; + + p++; + while (isspace(*p)) { + p++; + } + p++; + while (isspace(*p)) { + p++; + } + + if (strcmp(p, "None") == 0) { + colorMap[ccode] = RGBA(); + } else if (strcmp(p, "Fill") == 0) { + colorMap[ccode] = RGBA(SP_RGBA32_R_U(fill), SP_RGBA32_G_U(fill), SP_RGBA32_B_U(fill), SP_RGBA32_A_U(fill)); + } else if (strcmp(p, "Stroke") == 0) { + colorMap[ccode] = RGBA(SP_RGBA32_R_U(stroke), SP_RGBA32_G_U(stroke), SP_RGBA32_B_U(stroke), SP_RGBA32_A_U(stroke)); + } else if (strcmp(p, "#000000") == 0) { + colorMap[ccode] = RGBA(black.red, black.green, black.blue, 255); + } else if (strcmp(p, "#FFFFFF") == 0) { + colorMap[ccode] = RGBA(white.red, white.green, white.blue, 255); + } else { + colorMap[ccode] = RGBA(); + } + } + + guint32 *pixmap_buffer = new guint32[width * height]; + + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + std::map<char, RGBA>::const_iterator it = colorMap.find(xpm[1 + colors + y][x]); + pixmap_buffer[y * width + x] = (it == colorMap.end()) ? 0u : it->second; + } + } + + return gdk_pixbuf_new_from_data(reinterpret_cast<guchar*>(pixmap_buffer), GDK_COLORSPACE_RGB, TRUE, 8, width, height, width * sizeof(guint32), free_cursor_data, NULL); +} + +GdkCursor *sp_cursor_new_from_xpm(gchar const *const *xpm, gint hot_x, gint hot_y) { + GdkCursor *cursor = 0; GdkColor const fg = { 0, 0, 0, 0 }; GdkColor const bg = { 0, 65535, 65535, 65535 }; - GdkBitmap *bitmap = NULL; - GdkBitmap *mask = NULL; - - sp_cursor_bitmap_and_mask_from_xpm (&bitmap, &mask, xpm); - if ( bitmap != NULL && mask != NULL ) { - GdkCursor *new_cursor = gdk_cursor_new_from_pixmap (bitmap, mask, - &fg, &bg, - hot_x, hot_y); - g_object_unref (bitmap); - g_object_unref (mask); - return new_cursor; + GdkBitmap *bitmap = 0; + GdkBitmap *mask = 0; + + sp_cursor_bitmap_and_mask_from_xpm(&bitmap, &mask, xpm); + if ( bitmap && mask ) { + cursor = gdk_cursor_new_from_pixmap(bitmap, mask, + &fg, &bg, + hot_x, hot_y); + g_object_unref(bitmap); + g_object_unref(mask); } - return NULL; + return cursor; } /* diff --git a/src/sp-cursor.h b/src/sp-cursor.h index 1c40bdc44..8c23d4632 100644 --- a/src/sp-cursor.h +++ b/src/sp-cursor.h @@ -4,6 +4,7 @@ #include <gdk/gdk.h> void sp_cursor_bitmap_and_mask_from_xpm(GdkBitmap **bitmap, GdkBitmap **mask, gchar const *const *xpm); +GdkPixbuf* sp_cursor_pixbuf_from_xpm(gchar const *const *xpm, GdkColor const& black, GdkColor const& white, guint32 fill, guint32 stroke); GdkCursor *sp_cursor_new_from_xpm(gchar const *const *xpm, gint hot_x, gint hot_y); #endif @@ -17,4 +18,4 @@ GdkCursor *sp_cursor_new_from_xpm(gchar const *const *xpm, gint hot_x, gint hot_ fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 100be187a..964ab48b1 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -142,16 +142,18 @@ sp_genericellipse_update(SPObject *object, SPCtx *ctx, guint flags) SPGenericEllipse *ellipse = (SPGenericEllipse *) object; SPStyle const *style = object->style; Geom::OptRect viewbox = ((SPItemCtx const *) ctx)->vp; - double const dx = viewbox->width(); - double const dy = viewbox->height(); - double const dr = sqrt(dx*dx + dy*dy)/sqrt(2); - double const em = style->font_size.computed; - double const ex = em * 0.5; // fixme: get from pango or libnrtype - ellipse->cx.update(em, ex, dx); - ellipse->cy.update(em, ex, dy); - ellipse->rx.update(em, ex, dr); - ellipse->ry.update(em, ex, dr); - sp_shape_set_shape((SPShape *) object); + if (viewbox) { + double const dx = viewbox->width(); + double const dy = viewbox->height(); + double const dr = sqrt(dx*dx + dy*dy)/sqrt(2); + double const em = style->font_size.computed; + double const ex = em * 0.5; // fixme: get from pango or libnrtype + ellipse->cx.update(em, ex, dx); + ellipse->cy.update(em, ex, dy); + ellipse->rx.update(em, ex, dr); + ellipse->ry.update(em, ex, dr); + sp_shape_set_shape((SPShape *) object); + } } if (((SPObjectClass *) ge_parent_class)->update) @@ -921,4 +923,4 @@ Geom::Point sp_arc_get_xy(SPArc *arc, gdouble arg) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-filter-primitive.cpp b/src/sp-filter-primitive.cpp index 77325c4b1..265c72b14 100644 --- a/src/sp-filter-primitive.cpp +++ b/src/sp-filter-primitive.cpp @@ -292,4 +292,4 @@ void sp_filter_primitive_renderer_common(SPFilterPrimitive *sp_prim, Inkscape::F fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-filter-primitive.h b/src/sp-filter-primitive.h index 1ed101489..4ebe5df1a 100644 --- a/src/sp-filter-primitive.h +++ b/src/sp-filter-primitive.h @@ -59,4 +59,4 @@ int sp_filter_primitive_read_result(SPFilterPrimitive *prim, gchar const *name); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-filter-reference.cpp b/src/sp-filter-reference.cpp index 79860d5d8..57600ad39 100644 --- a/src/sp-filter-reference.cpp +++ b/src/sp-filter-reference.cpp @@ -19,4 +19,4 @@ SPFilterReference::_acceptObject(SPObject *obj) const fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-filter-reference.h b/src/sp-filter-reference.h index e5a3bc8ec..168ec1c1d 100644 --- a/src/sp-filter-reference.h +++ b/src/sp-filter-reference.h @@ -31,4 +31,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-filter-units.h b/src/sp-filter-units.h index 3f4c4c3a5..415b89365 100644 --- a/src/sp-filter-units.h +++ b/src/sp-filter-units.h @@ -18,4 +18,4 @@ enum SPFilterUnits { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp index 44db09b86..f362b7f2b 100644 --- a/src/sp-filter.cpp +++ b/src/sp-filter.cpp @@ -584,4 +584,4 @@ bool ltstr::operator()(const char* s1, const char* s2) const fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-filter.h b/src/sp-filter.h index 527a0b8a1..4ba04ecf0 100644 --- a/src/sp-filter.h +++ b/src/sp-filter.h @@ -112,4 +112,4 @@ Glib::ustring sp_filter_get_new_result_name(SPFilter *filter); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-flowtext.h b/src/sp-flowtext.h index 8889c7a56..3b0ce178a 100644 --- a/src/sp-flowtext.h +++ b/src/sp-flowtext.h @@ -65,4 +65,4 @@ SPItem *create_flowtext_with_internal_frame (SPDesktop *desktop, Geom::Point p1, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-gradient-fns.h b/src/sp-gradient-fns.h index 9d1b84158..a5b654822 100644 --- a/src/sp-gradient-fns.h +++ b/src/sp-gradient-fns.h @@ -41,4 +41,4 @@ void sp_gradient_set_gs2d_matrix(SPGradient *gr, Geom::Matrix const &ctm, Geom:: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-gradient-reference.cpp b/src/sp-gradient-reference.cpp index 39ef9915a..d2b8128fb 100644 --- a/src/sp-gradient-reference.cpp +++ b/src/sp-gradient-reference.cpp @@ -19,4 +19,4 @@ SPGradientReference::_acceptObject(SPObject *obj) const fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-gradient-reference.h b/src/sp-gradient-reference.h index 8f368b825..770593823 100644 --- a/src/sp-gradient-reference.h +++ b/src/sp-gradient-reference.h @@ -28,4 +28,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-gradient-spread.h b/src/sp-gradient-spread.h index 537b6aad7..cc74ef614 100644 --- a/src/sp-gradient-spread.h +++ b/src/sp-gradient-spread.h @@ -19,4 +19,4 @@ enum SPGradientSpread { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-gradient-test.h b/src/sp-gradient-test.h index bc188401b..a664218e0 100644 --- a/src/sp-gradient-test.h +++ b/src/sp-gradient-test.h @@ -159,4 +159,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-gradient-units.h b/src/sp-gradient-units.h index f79b4c264..2f58897b0 100644 --- a/src/sp-gradient-units.h +++ b/src/sp-gradient-units.h @@ -18,4 +18,4 @@ enum SPGradientUnits { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-gradient-vector.h b/src/sp-gradient-vector.h index 7bdfb51bf..5bb2a848a 100644 --- a/src/sp-gradient-vector.h +++ b/src/sp-gradient-vector.h @@ -39,4 +39,4 @@ struct SPGradientVector { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp index 8a05992eb..092bb993a 100644 --- a/src/sp-gradient.cpp +++ b/src/sp-gradient.cpp @@ -1597,4 +1597,4 @@ sp_gradient_create_preview_pattern(SPGradient *gr, double width) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-gradient.h b/src/sp-gradient.h index 05aea2618..bc0fe8691 100644 --- a/src/sp-gradient.h +++ b/src/sp-gradient.h @@ -172,4 +172,4 @@ struct SPGradientClass { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-guide-attachment.h b/src/sp-guide-attachment.h index 277b435b6..e42b2ed32 100644 --- a/src/sp-guide-attachment.h +++ b/src/sp-guide-attachment.h @@ -40,4 +40,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-guide-constraint.h b/src/sp-guide-constraint.h index 5444b8468..a39660e75 100644 --- a/src/sp-guide-constraint.h +++ b/src/sp-guide-constraint.h @@ -41,4 +41,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-guide.h b/src/sp-guide.h index 6bf541cd1..91c181a70 100644 --- a/src/sp-guide.h +++ b/src/sp-guide.h @@ -73,4 +73,4 @@ char *sp_guide_description(SPGuide const *guide, const bool verbose = true); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-item-notify-moveto.cpp b/src/sp-item-notify-moveto.cpp index 628d77956..6383a1fae 100644 --- a/src/sp-item-notify-moveto.cpp +++ b/src/sp-item-notify-moveto.cpp @@ -73,4 +73,4 @@ void sp_item_notify_moveto(SPItem &item, SPGuide const &mv_g, int const snappoin fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-item-notify-moveto.h b/src/sp-item-notify-moveto.h index 41bd9ef21..1e6ff2854 100644 --- a/src/sp-item-notify-moveto.h +++ b/src/sp-item-notify-moveto.h @@ -19,4 +19,4 @@ void sp_item_notify_moveto(SPItem &item, SPGuide const &g, int const snappoint_i fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-item-rm-unsatisfied-cns.cpp b/src/sp-item-rm-unsatisfied-cns.cpp index 792a9d3bf..78628f4a5 100644 --- a/src/sp-item-rm-unsatisfied-cns.cpp +++ b/src/sp-item-rm-unsatisfied-cns.cpp @@ -40,4 +40,4 @@ void sp_item_rm_unsatisfied_cns(SPItem &item) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-item-rm-unsatisfied-cns.h b/src/sp-item-rm-unsatisfied-cns.h index 72a6e0c66..97742dd4d 100644 --- a/src/sp-item-rm-unsatisfied-cns.h +++ b/src/sp-item-rm-unsatisfied-cns.h @@ -16,4 +16,4 @@ void sp_item_rm_unsatisfied_cns(SPItem &item); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-item-transform.cpp b/src/sp-item-transform.cpp index aefd6603a..e9a219cc7 100644 --- a/src/sp-item-transform.cpp +++ b/src/sp-item-transform.cpp @@ -200,4 +200,4 @@ get_visual_bbox (Geom::OptRect const &initial_geom_bbox, Geom::Matrix const &abs fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-item-transform.h b/src/sp-item-transform.h index 40bf0fa4e..893ab5822 100644 --- a/src/sp-item-transform.h +++ b/src/sp-item-transform.h @@ -24,4 +24,4 @@ Geom::Rect get_visual_bbox (Geom::OptRect const &initial_geom_bbox, Geom::Matrix fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-item-update-cns.cpp b/src/sp-item-update-cns.cpp index 51da1679d..c90df01ba 100644 --- a/src/sp-item-update-cns.cpp +++ b/src/sp-item-update-cns.cpp @@ -43,4 +43,4 @@ void sp_item_update_cns(SPItem &item, SPDesktop const &desktop) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-item-update-cns.h b/src/sp-item-update-cns.h index 4cb6a60b6..bf8de715d 100644 --- a/src/sp-item-update-cns.h +++ b/src/sp-item-update-cns.h @@ -17,4 +17,4 @@ void sp_item_update_cns(SPItem &item, SPDesktop const &desktop); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-item.h b/src/sp-item.h index faf64846e..7387a63cf 100644 --- a/src/sp-item.h +++ b/src/sp-item.h @@ -280,4 +280,4 @@ void sp_item_convert_to_guides(SPItem *item); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-linear-gradient-fns.h b/src/sp-linear-gradient-fns.h index 0962bae35..9f2f541dd 100644 --- a/src/sp-linear-gradient-fns.h +++ b/src/sp-linear-gradient-fns.h @@ -37,4 +37,4 @@ void sp_lineargradient_set_position(SPLinearGradient *lg, gdouble x1, gdouble y1 fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-linear-gradient.h b/src/sp-linear-gradient.h index eabf7f308..b99b6b293 100644 --- a/src/sp-linear-gradient.h +++ b/src/sp-linear-gradient.h @@ -33,4 +33,4 @@ struct SPLinearGradientClass { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index 71352ed98..43eb3c52e 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -868,4 +868,4 @@ bool sp_lpe_item_path_effects_enabled(SPLPEItem *lpeitem) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-lpe-item.h b/src/sp-lpe-item.h index 49edbf90a..1af7f2797 100644 --- a/src/sp-lpe-item.h +++ b/src/sp-lpe-item.h @@ -89,4 +89,4 @@ bool sp_lpe_item_path_effects_enabled(SPLPEItem *lpeitem); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-mask.cpp b/src/sp-mask.cpp index cc4d72936..4d880dfa1 100644 --- a/src/sp-mask.cpp +++ b/src/sp-mask.cpp @@ -412,4 +412,4 @@ sp_mask_view_list_remove (SPMaskView *list, SPMaskView *view) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-metric.h b/src/sp-metric.h index 644c2c8eb..5f0e5c8f6 100644 --- a/src/sp-metric.h +++ b/src/sp-metric.h @@ -25,4 +25,4 @@ enum SPMetric { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-metrics.cpp b/src/sp-metrics.cpp index e3d8c3fe1..5e34d9ab9 100644 --- a/src/sp-metrics.cpp +++ b/src/sp-metrics.cpp @@ -117,4 +117,4 @@ sp_metric_to_metric_string(gdouble const length, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index 44c3bf620..be2bcd478 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -218,6 +218,7 @@ static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape: } sp_object_read_attr(object, "inkscape:document-units"); + sp_object_read_attr(object, "units"); sp_object_read_attr(object, "viewonly"); sp_object_read_attr(object, "showguides"); sp_object_read_attr(object, "showgrid"); @@ -572,6 +573,30 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va object->requestModified(SP_OBJECT_MODIFIED_FLAG); break; } + case SP_ATTR_UNITS: { + SPUnit const *new_unit = NULL; + + if (value) { + SPUnit const *const req_unit = sp_unit_get_by_abbreviation(value); + if ( req_unit == NULL ) { + g_warning("Unrecognized unit `%s'", value); + /* fixme: Document errors should be reported in the status bar or + * the like (e.g. as per + * http://www.w3.org/TR/SVG11/implnote.html#ErrorProcessing); g_log + * should be only for programmer errors. */ + } else if ( req_unit->base == SP_UNIT_ABSOLUTE || + req_unit->base == SP_UNIT_DEVICE ) { + new_unit = req_unit; + } else { + g_warning("Document units must be absolute like `mm', `pt' or `px', but found `%s'", + value); + /* fixme: Don't use g_log (see above). */ + } + } + nv->units = new_unit; + object->requestModified(SP_OBJECT_MODIFIED_FLAG); + break; + } default: if (((SPObjectClass *) (parent_class))->set) { ((SPObjectClass *) (parent_class))->set(object, key, value); @@ -1038,4 +1063,4 @@ void SPNamedView::scrollAllDesktops(double dx, double dy, bool is_scrolling) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-namedview.h b/src/sp-namedview.h index 048096d8c..7a54b2dc5 100644 --- a/src/sp-namedview.h +++ b/src/sp-namedview.h @@ -54,7 +54,8 @@ struct SPNamedView : public SPObjectGroup { bool grids_visible; SPUnit const *doc_units; - + SPUnit const *units; + GQuark default_layer_id; double connector_spacing; @@ -110,4 +111,4 @@ Inkscape::CanvasGrid * sp_namedview_get_first_enabled_grid(SPNamedView *namedvie fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-object-repr.cpp b/src/sp-object-repr.cpp index cc289317e..6f3398918 100644 --- a/src/sp-object-repr.cpp +++ b/src/sp-object-repr.cpp @@ -290,4 +290,4 @@ sp_object_type_register(gchar const *name, GType const gtype) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-object-repr.h b/src/sp-object-repr.h index f3a80f83c..4e85acf53 100644 --- a/src/sp-object-repr.h +++ b/src/sp-object-repr.h @@ -38,4 +38,4 @@ void sp_object_type_register(gchar const *name, GType type); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-object.cpp b/src/sp-object.cpp index fd17b3c12..7fe099699 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -1821,4 +1821,4 @@ SPObject::textualContent() const fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-object.h b/src/sp-object.h index 633091668..59cab2328 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -584,4 +584,4 @@ SPObject *sp_object_prev(SPObject *child); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp index 2b6f535a4..28f0d1d5b 100644 --- a/src/sp-offset.cpp +++ b/src/sp-offset.cpp @@ -1172,4 +1172,4 @@ sp_offset_get_source (SPOffset *offset) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-offset.h b/src/sp-offset.h index caecdb1be..47e597c28 100644 --- a/src/sp-offset.h +++ b/src/sp-offset.h @@ -105,4 +105,4 @@ SPItem *sp_offset_get_source (SPOffset *offset); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-paint-server.h b/src/sp-paint-server.h index f18a7e689..facca4baa 100644 --- a/src/sp-paint-server.h +++ b/src/sp-paint-server.h @@ -73,4 +73,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-pattern.h b/src/sp-pattern.h index 8ca97e0a7..8ff878657 100644 --- a/src/sp-pattern.h +++ b/src/sp-pattern.h @@ -109,4 +109,4 @@ NRRect *pattern_viewBox (SPPattern *pat); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-radial-gradient-fns.h b/src/sp-radial-gradient-fns.h index 6d38e1605..912508a33 100644 --- a/src/sp-radial-gradient-fns.h +++ b/src/sp-radial-gradient-fns.h @@ -37,4 +37,4 @@ void sp_radialgradient_set_position(SPRadialGradient *rg, gdouble cx, gdouble cy fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-radial-gradient.h b/src/sp-radial-gradient.h index bec6cbe00..143afd79c 100644 --- a/src/sp-radial-gradient.h +++ b/src/sp-radial-gradient.h @@ -36,4 +36,4 @@ struct SPRadialGradientClass { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-root.cpp b/src/sp-root.cpp index adcad5ebb..9cde3a656 100644 --- a/src/sp-root.cpp +++ b/src/sp-root.cpp @@ -656,4 +656,4 @@ sp_root_print(SPItem *item, SPPrintContext *ctx) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-root.h b/src/sp-root.h index 7976eb2f4..28ed43154 100644 --- a/src/sp-root.h +++ b/src/sp-root.h @@ -78,4 +78,4 @@ GType sp_root_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-script.h b/src/sp-script.h index 127eeedf7..976603b65 100644 --- a/src/sp-script.h +++ b/src/sp-script.h @@ -43,4 +43,4 @@ GType sp_script_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 76ef7f73d..43e80a8ee 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -20,6 +20,7 @@ #include <2geom/transforms.h> #include <2geom/pathvector.h> #include <2geom/path-intersection.h> +#include <2geom/exception.h> #include "helper/geom.h" #include "helper/geom-nodetype.h" @@ -406,7 +407,9 @@ sp_shape_update_marker_view (SPShape *shape, NRArenaItem *ai) // position arguments to sp_marker_show_instance, basically counts the amount of markers. int counter[4] = {0}; + if (!shape->curve) return; Geom::PathVector const & pathv = shape->curve->get_pathvector(); + if (pathv.empty()) return; // the first vertex should get a start marker, the last an end marker, and all the others a mid marker // see bug 456148 @@ -581,7 +584,7 @@ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const & } // Union with bboxes of the markers, if any - if (sp_shape_has_markers (shape)) { + if (sp_shape_has_markers (shape) && !shape->curve->get_pathvector().empty()) { /** \todo make code prettier! */ Geom::PathVector const & pathv = shape->curve->get_pathvector(); // START marker @@ -763,6 +766,9 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx) if (!shape->curve) return; + Geom::PathVector const & pathv = shape->curve->get_pathvector(); + if (pathv.empty()) return; + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); gint add_comments = prefs->getBool("/printing/debug/add-label-comments"); if (add_comments) { @@ -784,15 +790,14 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx) SPStyle* style = SP_OBJECT_STYLE (item); if (!style->fill.isNone()) { - sp_print_fill (ctx, shape->curve->get_pathvector(), &i2d, style, &pbox, &dbox, &bbox); + sp_print_fill (ctx, pathv, &i2d, style, &pbox, &dbox, &bbox); } if (!style->stroke.isNone()) { - sp_print_stroke (ctx, shape->curve->get_pathvector(), &i2d, style, &pbox, &dbox, &bbox); + sp_print_stroke (ctx, pathv, &i2d, style, &pbox, &dbox, &bbox); } /** \todo make code prettier */ - Geom::PathVector const & pathv = shape->curve->get_pathvector(); // START marker for (int i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START if ( shape->marker[i] ) { @@ -1264,13 +1269,19 @@ static void sp_shape_snappoints(SPItem const *item, std::vector<Inkscape::SnapCa // (using "Method 1" as described in Inkscape::ObjectSnapper::_collectNodes()) if (snapprefs->getSnapIntersectionCS()) { Geom::Crossings cs; - cs = self_crossings(*path_it); - if (cs.size() > 0) { // There might be multiple intersections... - for (Geom::Crossings::const_iterator i = cs.begin(); i != cs.end(); i++) { - Geom::Point p_ix = (*path_it).pointAt((*i).ta); - p.push_back(Inkscape::SnapCandidatePoint(p_ix * i2d, Inkscape::SNAPSOURCE_PATH_INTERSECTION, Inkscape::SNAPTARGET_PATH_INTERSECTION)); + try { + cs = self_crossings(*path_it); + if (cs.size() > 0) { // There might be multiple intersections... + for (Geom::Crossings::const_iterator i = cs.begin(); i != cs.end(); i++) { + Geom::Point p_ix = (*path_it).pointAt((*i).ta); + p.push_back(Inkscape::SnapCandidatePoint(p_ix * i2d, Inkscape::SNAPSOURCE_PATH_INTERSECTION, Inkscape::SNAPTARGET_PATH_INTERSECTION)); + } } + } catch (Geom::RangeError &e) { + // do nothing + // The exception could be Geom::InfiniteSolutions: then no snappoints should be added } + } } @@ -1285,4 +1296,4 @@ static void sp_shape_snappoints(SPItem const *item, std::vector<Inkscape::SnapCa fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-skeleton.cpp b/src/sp-skeleton.cpp index ec6c9b437..329df8eb6 100644 --- a/src/sp-skeleton.cpp +++ b/src/sp-skeleton.cpp @@ -212,4 +212,4 @@ sp_skeleton_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-skeleton.h b/src/sp-skeleton.h index fc706aacd..d01cbcada 100644 --- a/src/sp-skeleton.h +++ b/src/sp-skeleton.h @@ -45,4 +45,4 @@ GType sp_skeleton_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-spiral.cpp b/src/sp-spiral.cpp index 11e84d9b2..c309c60cc 100644 --- a/src/sp-spiral.cpp +++ b/src/sp-spiral.cpp @@ -679,4 +679,4 @@ sp_spiral_is_invalid (SPSpiral const *spiral) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-star.cpp b/src/sp-star.cpp index 76a6618e5..ed7f7cf03 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -611,4 +611,4 @@ sp_star_get_xy (SPStar *star, SPStarPoint point, gint index, bool randomized) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-stop.cpp b/src/sp-stop.cpp index 71f937927..15fc93e2f 100644 --- a/src/sp-stop.cpp +++ b/src/sp-stop.cpp @@ -91,4 +91,4 @@ SPColor SPStop::getEffectiveColor() const fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-stop.h b/src/sp-stop.h index 2cf8ad690..692e67c5b 100644 --- a/src/sp-stop.h +++ b/src/sp-stop.h @@ -71,4 +71,4 @@ guint32 sp_stop_get_rgba32(SPStop const *); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-string.cpp b/src/sp-string.cpp index 871338ad5..b424ac3d8 100644 --- a/src/sp-string.cpp +++ b/src/sp-string.cpp @@ -166,4 +166,4 @@ sp_string_update(SPObject *object, SPCtx *ctx, unsigned flags) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-style-elem-test.h b/src/sp-style-elem-test.h index 6e24ee28c..0c01136f6 100644 --- a/src/sp-style-elem-test.h +++ b/src/sp-style-elem-test.h @@ -163,4 +163,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-style-elem.cpp b/src/sp-style-elem.cpp index 46c311920..5a57d548b 100644 --- a/src/sp-style-elem.cpp +++ b/src/sp-style-elem.cpp @@ -416,4 +416,4 @@ sp_style_elem_build(SPObject *object, SPDocument *document, Inkscape::XML::Node fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-style-elem.h b/src/sp-style-elem.h index f63fa1eb9..e6823442b 100644 --- a/src/sp-style-elem.h +++ b/src/sp-style-elem.h @@ -33,4 +33,4 @@ GType sp_style_elem_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-text.cpp b/src/sp-text.cpp index c6071bf0f..d36adc35b 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -1038,4 +1038,4 @@ void TextTagAttributes::setRotate(unsigned index, double angle) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-text.h b/src/sp-text.h index d9b153925..e7c264b07 100644 --- a/src/sp-text.h +++ b/src/sp-text.h @@ -85,4 +85,4 @@ GType sp_text_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-textpath.h b/src/sp-textpath.h index 193196606..76d236cc9 100644 --- a/src/sp-textpath.h +++ b/src/sp-textpath.h @@ -48,4 +48,4 @@ void sp_textpath_to_text(SPObject *tp); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-tref.cpp b/src/sp-tref.cpp index 3bc5e286b..af85bc58b 100644 --- a/src/sp-tref.cpp +++ b/src/sp-tref.cpp @@ -662,4 +662,4 @@ sp_tref_convert_to_tspan(SPObject *obj) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-tref.h b/src/sp-tref.h index 2e79a28c3..cc80e48a8 100644 --- a/src/sp-tref.h +++ b/src/sp-tref.h @@ -77,4 +77,4 @@ SPObject * sp_tref_convert_to_tspan(SPObject *item); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-tspan.cpp b/src/sp-tspan.cpp index 463a64aee..db8e0cad4 100644 --- a/src/sp-tspan.cpp +++ b/src/sp-tspan.cpp @@ -618,4 +618,4 @@ sp_textpath_to_text(SPObject *tp) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-tspan.h b/src/sp-tspan.h index def805165..a0e641b8e 100644 --- a/src/sp-tspan.h +++ b/src/sp-tspan.h @@ -46,4 +46,4 @@ GType sp_tspan_get_type(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp index 7ce9d4710..6730ab63b 100644 --- a/src/spiral-context.cpp +++ b/src/spiral-context.cpp @@ -242,7 +242,7 @@ sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event) SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop); m.freeSnapReturnByRef(sc->center, Inkscape::SNAPSOURCE_NODE_HANDLE); - + m.unSetup(); sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), ( GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | @@ -272,6 +272,7 @@ sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event) SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop, true, sc->item); m.freeSnapReturnByRef(motion_dt, Inkscape::SNAPSOURCE_NODE_HANDLE); + m.unSetup(); sp_spiral_drag(sc, from_2geom(motion_dt), event->motion.state); gobble_motion_events(GDK_BUTTON1_MASK); @@ -280,10 +281,10 @@ sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event) } else if (!sp_event_context_knot_mouseover(sc)) { SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop); - Geom::Point const motion_w(event->motion.x, event->motion.y); Geom::Point motion_dt(desktop->w2d(motion_w)); m.preSnap(Inkscape::SnapCandidatePoint(motion_dt, Inkscape::SNAPSOURCE_NODE_HANDLE)); + m.unSetup(); } break; case GDK_BUTTON_RELEASE: @@ -430,7 +431,7 @@ sp_spiral_drag(SPSpiralContext *sc, Geom::Point p, guint state) m.setup(desktop, true, sc->item); Geom::Point pt2g = to_2geom(p); m.freeSnapReturnByRef(pt2g, Inkscape::SNAPSOURCE_NODE_HANDLE); - + m.unSetup(); Geom::Point const p0 = desktop->dt2doc(sc->center); Geom::Point const p1 = desktop->dt2doc(pt2g); @@ -518,4 +519,4 @@ static void sp_spiral_cancel(SPSpiralContext *sc) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/splivarot.cpp b/src/splivarot.cpp index a58e3aa88..6e5c453e6 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -625,8 +625,7 @@ void sp_selected_path_outline_add_marker( SPObject *marker_object, Geom::Matrix static void item_outline_add_marker( SPObject const *marker_object, Geom::Matrix marker_transform, - Geom::Scale stroke_scale, Geom::Matrix transform, - Geom::PathVector* pathv_in ) + Geom::Scale stroke_scale, Geom::PathVector* pathv_in ) { SPMarker* marker = SP_MARKER (marker_object); SPItem* marker_item = sp_item_first_item_child(SP_OBJECT(marker_object)); @@ -636,7 +635,7 @@ void item_outline_add_marker( SPObject const *marker_object, Geom::Matrix marker tr = stroke_scale * tr; } // total marker transform - tr = marker_item->transform * marker->c2p * tr * transform; + tr = marker_item->transform * marker->c2p * tr; Geom::PathVector* marker_pathv = item_outline(marker_item); @@ -674,6 +673,10 @@ Geom::PathVector* item_outline(SPItem const *item) return ret_pathv; } + if (curve->get_pathvector().empty()) { + return ret_pathv; + } + // remember old stroke style, to be set on fill SPStyle *i_style = SP_OBJECT_STYLE(item); @@ -791,7 +794,7 @@ Geom::PathVector* item_outline(SPItem const *item) if ( SPObject *marker_obj = shape->marker[i] ) { Geom::Matrix const m (sp_shape_marker_get_transform_at_start(pathv.front().front())); item_outline_add_marker( marker_obj, m, - Geom::Scale(i_style->stroke_width.computed), transform, + Geom::Scale(i_style->stroke_width.computed), ret_pathv ); } } @@ -806,7 +809,7 @@ Geom::PathVector* item_outline(SPItem const *item) { Geom::Matrix const m (sp_shape_marker_get_transform_at_start(path_it->front())); item_outline_add_marker( midmarker_obj, m, - Geom::Scale(i_style->stroke_width.computed), transform, + Geom::Scale(i_style->stroke_width.computed), ret_pathv ); } // MID position @@ -821,7 +824,7 @@ Geom::PathVector* item_outline(SPItem const *item) */ Geom::Matrix const m (sp_shape_marker_get_transform(*curve_it1, *curve_it2)); item_outline_add_marker( midmarker_obj, m, - Geom::Scale(i_style->stroke_width.computed), transform, + Geom::Scale(i_style->stroke_width.computed), ret_pathv); ++curve_it1; @@ -833,7 +836,7 @@ Geom::PathVector* item_outline(SPItem const *item) Geom::Curve const &lastcurve = path_it->back_default(); Geom::Matrix const m = sp_shape_marker_get_transform_at_end(lastcurve); item_outline_add_marker( midmarker_obj, m, - Geom::Scale(i_style->stroke_width.computed), transform, + Geom::Scale(i_style->stroke_width.computed), ret_pathv ); } } @@ -852,7 +855,7 @@ Geom::PathVector* item_outline(SPItem const *item) Geom::Matrix const m = sp_shape_marker_get_transform_at_end(lastcurve); item_outline_add_marker( marker_obj, m, - Geom::Scale(i_style->stroke_width.computed), transform, + Geom::Scale(i_style->stroke_width.computed), ret_pathv ); } } @@ -900,6 +903,10 @@ sp_selected_path_outline(SPDesktop *desktop) continue; } + if (curve->get_pathvector().empty()) { + continue; + } + // pas de stroke pas de chocolat if (!SP_OBJECT_STYLE(item) || SP_OBJECT_STYLE(item)->stroke.noneSet) { curve->unref(); @@ -2147,4 +2154,4 @@ Geom::Point get_point_on_Path(Path *path, int piece, double t) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/splivarot.h b/src/splivarot.h index ff9f4f577..d85ae030a 100644 --- a/src/splivarot.h +++ b/src/splivarot.h @@ -65,4 +65,4 @@ Geom::Point get_point_on_Path(Path *path, int piece, double t); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/spray-context.cpp b/src/spray-context.cpp index 150d93c1e..0b70d1a84 100644 --- a/src/spray-context.cpp +++ b/src/spray-context.cpp @@ -1043,5 +1043,5 @@ break; fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/spray-context.h b/src/spray-context.h index ab2434223..b559fa593 100644 --- a/src/spray-context.h +++ b/src/spray-context.h @@ -119,5 +119,5 @@ GtkType sp_spray_context_get_type(void); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/star-context.cpp b/src/star-context.cpp index 4e9e883ce..d09a42b11 100644 --- a/src/star-context.cpp +++ b/src/star-context.cpp @@ -111,6 +111,7 @@ sp_star_context_init (SPStarContext * star_context) event_context->tolerance = 0; event_context->within_tolerance = false; event_context->item_to_select = NULL; + event_context->tool_url = "/tools/shapes/star"; star_context->item = NULL; @@ -260,7 +261,7 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop, true); m.freeSnapReturnByRef(sc->center, Inkscape::SNAPSOURCE_NODE_HANDLE); - + m.unSetup(); sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | @@ -297,7 +298,9 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent Geom::Point const motion_w(event->motion.x, event->motion.y); Geom::Point motion_dt(desktop->w2d(motion_w)); + m.preSnap(Inkscape::SnapCandidatePoint(motion_dt, Inkscape::SNAPSOURCE_NODE_HANDLE)); + m.unSetup(); } break; case GDK_BUTTON_RELEASE: @@ -443,7 +446,7 @@ static void sp_star_drag(SPStarContext *sc, Geom::Point p, guint state) m.setup(desktop, true, sc->item); Geom::Point pt2g = to_2geom(p); m.freeSnapReturnByRef(pt2g, Inkscape::SNAPSOURCE_NODE_HANDLE); - + m.unSetup(); Geom::Point const p0 = desktop->dt2doc(sc->center); Geom::Point const p1 = desktop->dt2doc(pt2g); @@ -537,4 +540,4 @@ static void sp_star_cancel(SPStarContext *sc) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/streq.h b/src/streq.h index 06f78e1e5..a3524a941 100644 --- a/src/streq.h +++ b/src/streq.h @@ -29,4 +29,4 @@ struct streq_rel { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/strneq.h b/src/strneq.h index 73a82e871..9314f2630 100644 --- a/src/strneq.h +++ b/src/strneq.h @@ -22,4 +22,4 @@ strneq(char const *a, char const *b, size_t n) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// 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 a2d5fcf24..67a4d7014 100644 --- a/src/style-test.h +++ b/src/style-test.h @@ -133,4 +133,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/style.cpp b/src/style.cpp index a4094621f..551dd6585 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -4436,4 +4436,4 @@ css2_escape_quote(gchar const *val) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/style.h b/src/style.h index f937fe33b..b4663e8f6 100644 --- a/src/style.h +++ b/src/style.h @@ -612,4 +612,4 @@ gchar *css2_escape_quote(gchar const *val); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/css-ostringstream-test.h b/src/svg/css-ostringstream-test.h index 295bf4bf3..fe2016d43 100644 --- a/src/svg/css-ostringstream-test.h +++ b/src/svg/css-ostringstream-test.h @@ -76,4 +76,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/css-ostringstream.cpp b/src/svg/css-ostringstream.cpp index a6eb2783e..f6e6a7293 100644 --- a/src/svg/css-ostringstream.cpp +++ b/src/svg/css-ostringstream.cpp @@ -80,4 +80,4 @@ operator<<(Inkscape::CSSOStringStream &os, double const d) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/css-ostringstream.h b/src/svg/css-ostringstream.h index 48ecf2992..52019f0d5 100644 --- a/src/svg/css-ostringstream.h +++ b/src/svg/css-ostringstream.h @@ -77,4 +77,4 @@ Inkscape::CSSOStringStream &operator<<(Inkscape::CSSOStringStream &os, double d) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/path-string.cpp b/src/svg/path-string.cpp index a850d7c10..61e9c90a2 100644 --- a/src/svg/path-string.cpp +++ b/src/svg/path-string.cpp @@ -149,4 +149,4 @@ void Inkscape::SVG::PathString::State::appendNumber(double v, double &rv, int pr fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/path-string.h b/src/svg/path-string.h index 9079acfb4..1d057519f 100644 --- a/src/svg/path-string.h +++ b/src/svg/path-string.h @@ -246,4 +246,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/stringstream-test.h b/src/svg/stringstream-test.h index d1a041721..ce32683f8 100644 --- a/src/svg/stringstream-test.h +++ b/src/svg/stringstream-test.h @@ -75,4 +75,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/stringstream.cpp b/src/svg/stringstream.cpp index 431d5d97b..ef7587154 100644 --- a/src/svg/stringstream.cpp +++ b/src/svg/stringstream.cpp @@ -100,4 +100,4 @@ Inkscape::SVGIStringStream::SVGIStringStream(const std::string& str):std::istrin fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/stringstream.h b/src/svg/stringstream.h index 60ed74ecb..5c819fcc6 100644 --- a/src/svg/stringstream.h +++ b/src/svg/stringstream.h @@ -100,4 +100,4 @@ Inkscape::SVGOStringStream &operator<<(Inkscape::SVGOStringStream &os, Geom::Poi fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/strip-trailing-zeros.cpp b/src/svg/strip-trailing-zeros.cpp index 769834d18..b0a14a74d 100644 --- a/src/svg/strip-trailing-zeros.cpp +++ b/src/svg/strip-trailing-zeros.cpp @@ -44,4 +44,4 @@ strip_trailing_zeros(string str) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/strip-trailing-zeros.h b/src/svg/strip-trailing-zeros.h index 53f6395a2..697be6227 100644 --- a/src/svg/strip-trailing-zeros.h +++ b/src/svg/strip-trailing-zeros.h @@ -17,4 +17,4 @@ std::string strip_trailing_zeros(std::string str); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/svg-affine-test.h b/src/svg/svg-affine-test.h index 5e9fc61fc..be5a941bb 100644 --- a/src/svg/svg-affine-test.h +++ b/src/svg/svg-affine-test.h @@ -258,4 +258,4 @@ SvgAffineTest::test_t const SvgAffineTest::write_skew_tests[3] = { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/svg-affine.cpp b/src/svg/svg-affine.cpp index b6dbd6d6a..b61d09a79 100644 --- a/src/svg/svg-affine.cpp +++ b/src/svg/svg-affine.cpp @@ -257,4 +257,4 @@ sp_svg_transform_write(Geom::Matrix const *transform) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/svg-color-test.h b/src/svg/svg-color-test.h index a540d4b1b..e077cc43d 100644 --- a/src/svg/svg-color-test.h +++ b/src/svg/svg-color-test.h @@ -122,4 +122,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/svg-color.cpp b/src/svg/svg-color.cpp index 04f387798..e50cb2928 100644 --- a/src/svg/svg-color.cpp +++ b/src/svg/svg-color.cpp @@ -615,4 +615,4 @@ bool sp_svg_read_icc_color( gchar const *str, SVGICCColor* dest ) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/svg-icc-color.h b/src/svg/svg-icc-color.h index 25ab4c1e1..a8e498594 100644 --- a/src/svg/svg-icc-color.h +++ b/src/svg/svg-icc-color.h @@ -26,4 +26,4 @@ struct SVGICCColor { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/svg-length-test.h b/src/svg/svg-length-test.h index 833b4a08b..81a28c9e7 100644 --- a/src/svg/svg-length-test.h +++ b/src/svg/svg-length-test.h @@ -194,4 +194,4 @@ char const * SvgLengthTest::fail_tests[8] = { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/svg-length.cpp b/src/svg/svg-length.cpp index 94f1cf312..3f04588ea 100644 --- a/src/svg/svg-length.cpp +++ b/src/svg/svg-length.cpp @@ -549,4 +549,4 @@ void SVGLength::readOrUnset(gchar const *str, Unit u, float v, float c) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/svg-length.h b/src/svg/svg-length.h index 1f4be8123..66f473cfd 100644 --- a/src/svg/svg-length.h +++ b/src/svg/svg-length.h @@ -68,4 +68,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/svg-path-geom-test.h b/src/svg/svg-path-geom-test.h index 1a084d5bf..239a975f6 100644 --- a/src/svg/svg-path-geom-test.h +++ b/src/svg/svg-path-geom-test.h @@ -624,4 +624,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/svg-path.cpp b/src/svg/svg-path.cpp index bbf1589b4..22af18acb 100644 --- a/src/svg/svg-path.cpp +++ b/src/svg/svg-path.cpp @@ -153,4 +153,4 @@ gchar * sp_svg_write_path(Geom::Path const &p) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/svg.h b/src/svg/svg.h index 0b2c3ae53..237a5d348 100644 --- a/src/svg/svg.h +++ b/src/svg/svg.h @@ -78,4 +78,4 @@ gchar * sp_svg_write_path( Geom::Path const &p ); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/test-stubs.cpp b/src/svg/test-stubs.cpp index 945488300..dea249aa9 100644 --- a/src/svg/test-stubs.cpp +++ b/src/svg/test-stubs.cpp @@ -43,4 +43,4 @@ prefs_get_int_attribute(gchar const *path, gchar const *attr, long long int def) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/svg/test-stubs.h b/src/svg/test-stubs.h index ab258b383..4e0731520 100644 --- a/src/svg/test-stubs.h +++ b/src/svg/test-stubs.h @@ -27,4 +27,4 @@ long long int prefs_get_int_attribute(gchar const *path, gchar const *attr, long fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/syseq.h b/src/syseq.h index 2902a8858..5c7702268 100644 --- a/src/syseq.h +++ b/src/syseq.h @@ -314,4 +314,4 @@ template <int S, int T> SolutionKind gaussjord_solve (double A[S][T], double x[T fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/test-helpers.h b/src/test-helpers.h index 8dba0c942..19dacd9c8 100644 --- a/src/test-helpers.h +++ b/src/test-helpers.h @@ -61,4 +61,4 @@ T* createSuiteAndDocument( void (*fun)(T*&) ) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp index e9a543596..363c49296 100644 --- a/src/text-chemistry.cpp +++ b/src/text-chemistry.cpp @@ -552,4 +552,4 @@ flowtext_to_text() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/text-chemistry.h b/src/text-chemistry.h index 7762b8fbc..cb86fc6c6 100644 --- a/src/text-chemistry.h +++ b/src/text-chemistry.h @@ -32,4 +32,4 @@ void flowtext_to_text(); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/text-context.cpp b/src/text-context.cpp index 4f89bd1e1..9d94e0e78 100644 --- a/src/text-context.cpp +++ b/src/text-context.cpp @@ -610,7 +610,14 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons event_context->within_tolerance = true; Geom::Point const button_pt(event->button.x, event->button.y); - tc->p0 = desktop->w2d(button_pt); + Geom::Point button_dt(desktop->w2d(button_pt)); + + SnapManager &m = desktop->namedview->snap_manager; + m.setup(desktop); + m.freeSnapReturnByRef(button_dt, Inkscape::SNAPSOURCE_NODE_HANDLE); + m.unSetup(); + + tc->p0 = button_dt; Inkscape::Rubberband::get(desktop)->start(desktop, tc->p0); sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK, @@ -645,7 +652,12 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons event_context->within_tolerance = false; Geom::Point const motion_pt(event->motion.x, event->motion.y); - Geom::Point const p = desktop->w2d(motion_pt); + Geom::Point p = desktop->w2d(motion_pt); + + SnapManager &m = desktop->namedview->snap_manager; + m.setup(desktop); + m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_NODE_HANDLE); + m.unSetup(); Inkscape::Rubberband::get(desktop)->move(p); gobble_motion_events(GDK_BUTTON1_MASK); @@ -657,10 +669,26 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons g_string_free(xs, FALSE); g_string_free(ys, FALSE); + } else if (!sp_event_context_knot_mouseover(event_context)) { + SnapManager &m = desktop->namedview->snap_manager; + m.setup(desktop); + + Geom::Point const motion_w(event->motion.x, event->motion.y); + Geom::Point motion_dt(desktop->w2d(motion_w)); + m.preSnap(Inkscape::SnapCandidatePoint(motion_dt, Inkscape::SNAPSOURCE_NODE_HANDLE)); + m.unSetup(); } break; case GDK_BUTTON_RELEASE: if (event->button.button == 1 && !event_context->space_panning) { + sp_event_context_discard_delayed_snap_event(event_context); + + Geom::Point p1 = desktop->w2d(Geom::Point(event->button.x, event->button.y)); + + SnapManager &m = desktop->namedview->snap_manager; + m.setup(desktop); + m.freeSnapReturnByRef(p1, Inkscape::SNAPSOURCE_NODE_HANDLE); + m.unSetup(); if (tc->grabbed) { sp_canvas_item_ungrab(tc->grabbed, GDK_CURRENT_TIME); @@ -672,9 +700,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons if (tc->creating && event_context->within_tolerance) { /* Button 1, set X & Y & new item */ sp_desktop_selection(desktop)->clear(); - Geom::Point dtp = desktop->w2d(Geom::Point(event->button.x, event->button.y)); - tc->pdoc = desktop->dt2doc(dtp); - + tc->pdoc = desktop->dt2doc(p1); tc->show = TRUE; tc->phase = 1; tc->nascent_object = 1; // new object was just created @@ -682,15 +708,13 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons /* Cursor */ sp_canvas_item_show(tc->cursor); // Cursor height is defined by the new text object's font size; it needs to be set - // articifically here, for the text object does not exist yet: + // artificially here, for the text object does not exist yet: double cursor_height = sp_desktop_get_font_size_tool(desktop); - sp_ctrlline_set_coords(SP_CTRLLINE(tc->cursor), dtp, dtp + Geom::Point(0, cursor_height)); + sp_ctrlline_set_coords(SP_CTRLLINE(tc->cursor), p1, p1 + Geom::Point(0, cursor_height)); event_context->_message_context->set(Inkscape::NORMAL_MESSAGE, _("Type text; <b>Enter</b> to start new line.")); // FIXME:: this is a copy of a string from _update_cursor below, do not desync event_context->within_tolerance = false; } else if (tc->creating) { - Geom::Point const button_pt(event->button.x, event->button.y); - Geom::Point p1 = desktop->w2d(button_pt); double cursor_height = sp_desktop_get_font_size_tool(desktop); if (fabs(p1[Geom::Y] - tc->p0[Geom::Y]) > cursor_height) { // otherwise even one line won't fit; most probably a slip of hand (even if bigger than tolerance) @@ -1774,4 +1798,4 @@ Inkscape::Text::Layout::iterator *sp_text_context_get_cursor_position(SPTextCont fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/text-editing.cpp b/src/text-editing.cpp index f52f9483b..4124511da 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -57,6 +57,7 @@ static void te_update_layout_now (SPItem *item) SP_TEXT(item)->rebuildLayout(); else if (SP_IS_FLOWTEXT (item)) SP_FLOWTEXT(item)->rebuildLayout(); + item->updateRepr(); } /** Returns true if there are no visible characters on the canvas */ @@ -972,30 +973,36 @@ sp_te_adjust_kerning_screen (SPItem *item, Inkscape::Text::Layout::iterator cons item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } -void -sp_te_adjust_dx (SPItem *item, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, double delta) +void sp_te_adjust_dx(SPItem *item, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop * /*desktop*/, double delta) { - unsigned char_index; + unsigned char_index = 0; TextTagAttributes *attributes = text_tag_attributes_at_position(item, std::min(start, end), &char_index); - if (attributes) attributes->addToDx(char_index, delta); + if (attributes) { + attributes->addToDx(char_index, delta); + } if (start != end) { attributes = text_tag_attributes_at_position(item, std::max(start, end), &char_index); - if (attributes) attributes->addToDx(char_index, -delta); + if (attributes) { + attributes->addToDx(char_index, -delta); + } } item->updateRepr(); item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } -void -sp_te_adjust_dy (SPItem *item, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, double delta) +void sp_te_adjust_dy(SPItem *item, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop * /*desktop*/, double delta) { - unsigned char_index; + unsigned char_index = 0; TextTagAttributes *attributes = text_tag_attributes_at_position(item, std::min(start, end), &char_index); - if (attributes) attributes->addToDy(char_index, delta); + if (attributes) { + attributes->addToDy(char_index, delta); + } if (start != end) { attributes = text_tag_attributes_at_position(item, std::max(start, end), &char_index); - if (attributes) attributes->addToDy(char_index, -delta); + if (attributes) { + attributes->addToDy(char_index, -delta); + } } item->updateRepr(); @@ -1041,23 +1048,25 @@ sp_te_adjust_rotation(SPItem *text, Inkscape::Text::Layout::iterator const &star text->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } -void -sp_te_set_rotation(SPItem *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop */*desktop*/, gdouble degrees) +void sp_te_set_rotation(SPItem *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop */*desktop*/, gdouble degrees) { - unsigned char_index; + unsigned char_index = 0; TextTagAttributes *attributes = text_tag_attributes_at_position(text, std::min(start, end), &char_index); - if (attributes == NULL) return; - - if (start != end) { - for (Inkscape::Text::Layout::iterator it = std::min(start, end) ; it != std::max(start, end) ; it.nextCharacter()) { - attributes = text_tag_attributes_at_position(text, it, &char_index); - if (attributes) attributes->setRotate(char_index, degrees); + if (attributes != NULL) { + if (start != end) { + for (Inkscape::Text::Layout::iterator it = std::min(start, end) ; it != std::max(start, end) ; it.nextCharacter()) { + attributes = text_tag_attributes_at_position(text, it, &char_index); + if (attributes) { + attributes->setRotate(char_index, degrees); + } + } + } else { + attributes->setRotate(char_index, degrees); } - } else - attributes->setRotate(char_index, degrees); - text->updateRepr(); - text->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + text->updateRepr(); + text->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + } } void @@ -1283,16 +1292,17 @@ static bool objects_have_equal_style(SPObject const *parent, SPObject const *chi parent_style = sp_style_write_string(parent_spstyle, SP_STYLE_FLAG_ALWAYS); sp_style_unref(parent_spstyle); - Glib::ustring child_style_construction(parent_style); + Glib::ustring child_style_construction; while (child != parent) { // FIXME: this assumes that child's style is only in style= whereas it can also be in css attributes! char const *style_text = SP_OBJECT_REPR(child)->attribute("style"); if (style_text && *style_text) { - child_style_construction += ';'; - child_style_construction += style_text; + child_style_construction.insert(0, style_text); + child_style_construction.insert(0, 1, ';'); } child = SP_OBJECT_PARENT(child); } + child_style_construction.insert(0, parent_style); SPStyle *child_spstyle = sp_style_new(SP_OBJECT_DOCUMENT(parent)); sp_style_merge_from_style_string(child_spstyle, child_style_construction.c_str()); gchar *child_style = sp_style_write_string(child_spstyle, SP_STYLE_FLAG_ALWAYS); @@ -1646,15 +1656,15 @@ static bool redundant_semi_nesting_processor(SPObject **item, SPObject *child, b SPCSSAttr *css_child_and_item = sp_repr_css_attr_new(); SPCSSAttr *css_child_only = sp_repr_css_attr_new(); + gchar const *item_style = SP_OBJECT_REPR(*item)->attribute("style"); + if (item_style && *item_style) { + sp_repr_css_attr_add_from_string(css_child_and_item, item_style); + } gchar const *child_style = SP_OBJECT_REPR(child)->attribute("style"); if (child_style && *child_style) { sp_repr_css_attr_add_from_string(css_child_and_item, child_style); sp_repr_css_attr_add_from_string(css_child_only, child_style); } - gchar const *item_style = SP_OBJECT_REPR(*item)->attribute("style"); - if (item_style && *item_style) { - sp_repr_css_attr_add_from_string(css_child_and_item, item_style); - } bool equal = css_attrs_are_equal(css_child_only, css_child_and_item); sp_repr_css_attr_unref(css_child_and_item); sp_repr_css_attr_unref(css_child_only); diff --git a/src/text-tag-attributes.h b/src/text-tag-attributes.h index 197bfb73f..11b751a2c 100644 --- a/src/text-tag-attributes.h +++ b/src/text-tag-attributes.h @@ -166,4 +166,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/tools-switch.cpp b/src/tools-switch.cpp index 5f33453f0..e9fca952e 100644 --- a/src/tools-switch.cpp +++ b/src/tools-switch.cpp @@ -277,4 +277,4 @@ void tools_switch_by_item(SPDesktop *dt, SPItem *item, Geom::Point const p) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/trace/potrace/potracelib.cpp b/src/trace/potrace/potracelib.cpp index 136f7a95a..17e04cabb 100644 --- a/src/trace/potrace/potracelib.cpp +++ b/src/trace/potrace/potracelib.cpp @@ -124,4 +124,4 @@ char *potrace_version(void) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/transf_mat_3x4.cpp b/src/transf_mat_3x4.cpp index 6b49dc44a..533972e29 100644 --- a/src/transf_mat_3x4.cpp +++ b/src/transf_mat_3x4.cpp @@ -193,4 +193,4 @@ TransfMat3x4::normalize_column (Proj::Axis axis) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/transf_mat_3x4.h b/src/transf_mat_3x4.h index 4b61c0951..afe4f92a4 100644 --- a/src/transf_mat_3x4.h +++ b/src/transf_mat_3x4.h @@ -78,4 +78,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/tweak-context.cpp b/src/tweak-context.cpp index d49c75a6d..37ca5c418 100644 --- a/src/tweak-context.cpp +++ b/src/tweak-context.cpp @@ -1536,4 +1536,4 @@ sp_tweak_context_root_handler(SPEventContext *event_context, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/tweak-context.h b/src/tweak-context.h index e860fd7ea..ad688b025 100644 --- a/src/tweak-context.h +++ b/src/tweak-context.h @@ -100,4 +100,4 @@ GtkType sp_tweak_context_get_type(void); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/cache/svg_preview_cache.h b/src/ui/cache/svg_preview_cache.h index 0b4d52774..0fac94782 100644 --- a/src/ui/cache/svg_preview_cache.h +++ b/src/ui/cache/svg_preview_cache.h @@ -47,6 +47,6 @@ class SvgPreview { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 0a64e7fa7..90a9ba0f5 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -875,6 +875,7 @@ void ClipboardManagerImpl::_pasteDocument(SPDesktop *desktop, SPDocument *clipdo // get offset from mouse pointer to bbox center, snap to grid if enabled Geom::Point mouse_offset = desktop->point() - sel_bbox->midpoint(); offset = m.multipleOfGridPitch(mouse_offset - offset, sel_bbox->midpoint() + offset) + offset; + m.unSetup(); } sp_selection_move_relative(selection, offset); @@ -1533,4 +1534,4 @@ ClipboardManager *ClipboardManager::get() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/clipboard.h b/src/ui/clipboard.h index 6020ecdd8..fb28bfc14 100644 --- a/src/ui/clipboard.h +++ b/src/ui/clipboard.h @@ -75,4 +75,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/context-menu.cpp b/src/ui/context-menu.cpp index 98ad9dc7b..262fdcf32 100644 --- a/src/ui/context-menu.cpp +++ b/src/ui/context-menu.cpp @@ -46,6 +46,7 @@ sp_object_menu(SPObject *object, SPDesktop *desktop, GtkMenu *menu) #include "sp-anchor.h" #include "sp-image.h" +#include "sp-text.h" #include "document.h" #include "desktop-handles.h" @@ -53,6 +54,8 @@ sp_object_menu(SPObject *object, SPDesktop *desktop, GtkMenu *menu) #include "selection-chemistry.h" #include "dialogs/item-properties.h" #include "dialogs/object-attributes.h" +#include "dialogs/text-edit.h" +#include "dialogs/spellcheck.h" #include "sp-path.h" #include "sp-clippath.h" @@ -64,6 +67,7 @@ static void sp_group_menu(SPObject *object, SPDesktop *desktop, GtkMenu *menu); static void sp_anchor_menu(SPObject *object, SPDesktop *desktop, GtkMenu *menu); static void sp_image_menu(SPObject *object, SPDesktop *desktop, GtkMenu *menu); static void sp_shape_menu(SPObject *object, SPDesktop *desktop, GtkMenu *menu); +static void sp_text_menu(SPObject *object, SPDesktop *desktop, GtkMenu *menu); static void sp_object_type_menu(GType type, SPObject *object, SPDesktop *desktop, GtkMenu *menu) @@ -77,6 +81,7 @@ sp_object_type_menu(GType type, SPObject *object, SPDesktop *desktop, GtkMenu *m g_hash_table_insert(t2m, GUINT_TO_POINTER(SP_TYPE_ANCHOR), (void*)sp_anchor_menu); g_hash_table_insert(t2m, GUINT_TO_POINTER(SP_TYPE_IMAGE), (void*)sp_image_menu); g_hash_table_insert(t2m, GUINT_TO_POINTER(SP_TYPE_SHAPE), (void*)sp_shape_menu); + g_hash_table_insert(t2m, GUINT_TO_POINTER(SP_TYPE_TEXT), (void*)sp_text_menu); } handler = (void (*)(SPObject*, SPDesktop*, GtkMenu*))g_hash_table_lookup(t2m, GUINT_TO_POINTER(type)); if (handler) handler(object, desktop, menu); @@ -102,7 +107,7 @@ sp_item_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m) item = (SPItem *) object; /* Item dialog */ - w = gtk_menu_item_new_with_mnemonic(_("Object _Properties")); + w = gtk_menu_item_new_with_mnemonic(_("_Object Properties...")); gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_item_properties), item); gtk_widget_show(w); @@ -151,7 +156,7 @@ sp_item_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m) gtk_widget_show(w); gtk_menu_append(GTK_MENU(m), w); /* Set Clip */ - w = gtk_menu_item_new_with_mnemonic(_("Set Clip")); + w = gtk_menu_item_new_with_mnemonic(_("Set _Clip")); gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_set_clip), item); if ((item && item->mask_ref && item->mask_ref->getObject()) || (item->clip_ref && item->clip_ref->getObject())) { @@ -162,7 +167,7 @@ sp_item_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m) gtk_widget_show(w); gtk_menu_append(GTK_MENU(m), w); /* Release Clip */ - w = gtk_menu_item_new_with_mnemonic(_("Release Clip")); + w = gtk_menu_item_new_with_mnemonic(_("Release C_lip")); gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_release_clip), item); if (item && item->clip_ref && item->clip_ref->getObject()) { @@ -343,7 +348,7 @@ sp_anchor_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m) item = (SPItem *) object; /* Link dialog */ - w = gtk_menu_item_new_with_mnemonic(_("Link _Properties")); + w = gtk_menu_item_new_with_mnemonic(_("Link _Properties...")); gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_anchor_link_properties), item); gtk_widget_show(w); @@ -402,7 +407,7 @@ sp_image_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m) GtkWidget *w; /* Link dialog */ - w = gtk_menu_item_new_with_mnemonic(_("Image _Properties")); + w = gtk_menu_item_new_with_mnemonic(_("Image _Properties...")); gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_image_image_properties), item); gtk_widget_show(w); @@ -473,10 +478,10 @@ static void sp_image_image_edit(GtkMenuItem *menuitem, SPAnchor *anchor) g_free(editorBin); } -/* SPShape */ +/* Fill and Stroke entry */ static void -sp_shape_fill_settings(GtkMenuItem *menuitem, SPItem *item) +sp_fill_settings(GtkMenuItem *menuitem, SPItem *item) { SPDesktop *desktop; @@ -492,6 +497,8 @@ sp_shape_fill_settings(GtkMenuItem *menuitem, SPItem *item) desktop->_dlg_mgr->showDialog("FillAndStroke"); } +/* SPShape */ + static void sp_shape_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m) { @@ -501,14 +508,82 @@ sp_shape_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m) item = (SPItem *) object; /* Item dialog */ - w = gtk_menu_item_new_with_mnemonic(_("_Fill and Stroke")); + w = gtk_menu_item_new_with_mnemonic(_("_Fill and Stroke...")); gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); - gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_shape_fill_settings), item); + gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_fill_settings), item); gtk_widget_show(w); gtk_menu_append(GTK_MENU(m), w); } +/* Edit Text entry */ + +static void +sp_text_settings(GtkMenuItem *menuitem, SPItem *item) +{ + SPDesktop *desktop; + + g_assert(SP_IS_ITEM(item)); + desktop = (SPDesktop*)gtk_object_get_data(GTK_OBJECT(menuitem), "desktop"); + g_return_if_fail(desktop != NULL); + + if (sp_desktop_selection(desktop)->isEmpty()) { + sp_desktop_selection(desktop)->set(item); + } + + sp_text_edit_dialog(); +} + +/* Spellcheck entry */ + +static void +sp_spellcheck_settings(GtkMenuItem *menuitem, SPItem *item) +{ + SPDesktop *desktop; + + g_assert(SP_IS_ITEM(item)); + + desktop = (SPDesktop*)gtk_object_get_data(GTK_OBJECT(menuitem), "desktop"); + g_return_if_fail(desktop != NULL); + + if (sp_desktop_selection(desktop)->isEmpty()) { + sp_desktop_selection(desktop)->set(item); + } + + sp_spellcheck_dialog(); +} + +/* SPText */ + +static void +sp_text_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m) +{ + SPItem *item; + GtkWidget *w; + + item = (SPItem *) object; + + /* Fill and Stroke dialog */ + w = gtk_menu_item_new_with_mnemonic(_("_Fill and Stroke...")); + gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); + gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_fill_settings), item); + gtk_widget_show(w); + gtk_menu_append(GTK_MENU(m), w); + + /* Edit Text dialog */ + w = gtk_menu_item_new_with_mnemonic(_("_Text and Font...")); + gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); + gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_text_settings), item); + gtk_widget_show(w); + gtk_menu_append(GTK_MENU(m), w); + + /* Spellcheck dialog */ + w = gtk_menu_item_new_with_mnemonic(_("Check Spellin_g...")); + gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); + gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_spellcheck_settings), item); + gtk_widget_show(w); + gtk_menu_append(GTK_MENU(m), w); +} /* Local Variables: mode:c++ @@ -518,4 +593,4 @@ sp_shape_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/context-menu.h b/src/ui/context-menu.h index 571698fd2..c66cd4e96 100644 --- a/src/ui/context-menu.h +++ b/src/ui/context-menu.h @@ -29,4 +29,4 @@ void sp_object_menu (SPObject *object, SPDesktop *desktop, GtkMenu *menu); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 048c46a20..ba8cc939b 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -465,10 +465,8 @@ public: removeOverlapXGap.set_value(0); dialog.tooltips().set_tip(removeOverlapXGap, _("Minimum horizontal gap (in px units) between bounding boxes")); - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - // "H:" stands for horizontal gap - removeOverlapXGapLabel.set_label(Q_("gap|H:")); + //TRANSLATORS: "H:" stands for horizontal gap + removeOverlapXGapLabel.set_label(C_("Gap", "H:")); removeOverlapYGap.set_digits(1); removeOverlapYGap.set_size_request(60, -1); @@ -478,7 +476,7 @@ public: dialog.tooltips().set_tip(removeOverlapYGap, _("Minimum vertical gap (in px units) between bounding boxes")); /* TRANSLATORS: Vertical gap */ - removeOverlapYGapLabel.set_label(_("V:")); + removeOverlapYGapLabel.set_label(C_("Gap", "V:")); dialog.removeOverlap_table().attach(removeOverlapXGapLabel, column, column+1, row, row+1, Gtk::FILL, Gtk::FILL); dialog.removeOverlap_table().attach(removeOverlapXGap, column+1, column+2, row, row+1, Gtk::FILL, Gtk::FILL); @@ -1298,4 +1296,4 @@ AlignAndDistribute::AlignTarget AlignAndDistribute::getAlignTarget()const { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/align-and-distribute.h b/src/ui/dialog/align-and-distribute.h index f55998385..7c99d67c7 100644 --- a/src/ui/dialog/align-and-distribute.h +++ b/src/ui/dialog/align-and-distribute.h @@ -141,4 +141,4 @@ bool operator< (const BBoxSort &a, const BBoxSort &b); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/behavior.h b/src/ui/dialog/behavior.h index fbe42c2fb..385cd05f5 100644 --- a/src/ui/dialog/behavior.h +++ b/src/ui/dialog/behavior.h @@ -100,4 +100,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/calligraphic-profile-rename.cpp b/src/ui/dialog/calligraphic-profile-rename.cpp index 888b327f4..fd7299ba2 100644 --- a/src/ui/dialog/calligraphic-profile-rename.cpp +++ b/src/ui/dialog/calligraphic-profile-rename.cpp @@ -105,4 +105,4 @@ void CalligraphicProfileRename::show(SPDesktop *desktop) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/calligraphic-profile-rename.h b/src/ui/dialog/calligraphic-profile-rename.h index 53ce907ed..e9f6a8b95 100644 --- a/src/ui/dialog/calligraphic-profile-rename.h +++ b/src/ui/dialog/calligraphic-profile-rename.h @@ -72,4 +72,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/color-item.cpp b/src/ui/dialog/color-item.cpp index a71f0789f..c7dfa0dc4 100644 --- a/src/ui/dialog/color-item.cpp +++ b/src/ui/dialog/color-item.cpp @@ -837,4 +837,4 @@ void ColorItem::_linkTone( ColorItem& other, int percent, int grayLevel ) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/color-item.h b/src/ui/dialog/color-item.h index de4618bc0..9080498eb 100644 --- a/src/ui/dialog/color-item.h +++ b/src/ui/dialog/color-item.h @@ -122,4 +122,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/debug.cpp b/src/ui/dialog/debug.cpp index b40796627..1f7539fc7 100644 --- a/src/ui/dialog/debug.cpp +++ b/src/ui/dialog/debug.cpp @@ -249,4 +249,4 @@ void DebugDialogImpl::releaseLogMessages() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/debug.h b/src/ui/dialog/debug.h index f2ad61dd4..34785a617 100644 --- a/src/ui/dialog/debug.h +++ b/src/ui/dialog/debug.h @@ -97,4 +97,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/desktop-tracker.cpp b/src/ui/dialog/desktop-tracker.cpp index f527f1c05..4eeac74b9 100644 --- a/src/ui/dialog/desktop-tracker.cpp +++ b/src/ui/dialog/desktop-tracker.cpp @@ -156,4 +156,4 @@ void DesktopTracker::setDesktop(SPDesktop *desktop) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/desktop-tracker.h b/src/ui/dialog/desktop-tracker.h index 7a5bc39c2..edde110af 100644 --- a/src/ui/dialog/desktop-tracker.h +++ b/src/ui/dialog/desktop-tracker.h @@ -70,4 +70,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index aab9d89d7..ff31c91c4 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -251,4 +251,4 @@ void DialogManager::showDialog(GQuark name) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/dialog-manager.h b/src/ui/dialog/dialog-manager.h index a97b58ce3..90e1862f1 100644 --- a/src/ui/dialog/dialog-manager.h +++ b/src/ui/dialog/dialog-manager.h @@ -71,4 +71,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp index 2483dc50e..43863625f 100644 --- a/src/ui/dialog/dialog.cpp +++ b/src/ui/dialog/dialog.cpp @@ -20,8 +20,6 @@ #include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> -#include "application/application.h" -#include "application/editor.h" #include "inkscape.h" #include "event-context.h" #include "desktop.h" @@ -109,17 +107,10 @@ Dialog::Dialog(Behavior::BehaviorFactory behavior_factory, const char *prefs_pat _behavior = behavior_factory(*this); - if (Inkscape::NSApplication::Application::getNewGui()) { - _desktop_activated_connection = Inkscape::NSApplication::Editor::connectDesktopActivated (sigc::mem_fun (*this, &Dialog::onDesktopActivated)); - _dialogs_hidden_connection = Inkscape::NSApplication::Editor::connectDialogsHidden (sigc::mem_fun (*this, &Dialog::onHideF12)); - _dialogs_unhidden_connection = Inkscape::NSApplication::Editor::connectDialogsUnhidden (sigc::mem_fun (*this, &Dialog::onShowF12)); - _shutdown_connection = Inkscape::NSApplication::Editor::connectShutdown (sigc::mem_fun (*this, &Dialog::onShutdown)); - } else { - g_signal_connect(G_OBJECT(INKSCAPE), "activate_desktop", G_CALLBACK(sp_retransientize), (void *)this); - g_signal_connect(G_OBJECT(INKSCAPE), "dialogs_hide", G_CALLBACK(hideCallback), (void *)this); - g_signal_connect(G_OBJECT(INKSCAPE), "dialogs_unhide", G_CALLBACK(unhideCallback), (void *)this); - g_signal_connect(G_OBJECT(INKSCAPE), "shut_down", G_CALLBACK(sp_dialog_shutdown), (void *)this); - } + g_signal_connect(G_OBJECT(INKSCAPE), "activate_desktop", G_CALLBACK(sp_retransientize), (void *)this); + g_signal_connect(G_OBJECT(INKSCAPE), "dialogs_hide", G_CALLBACK(hideCallback), (void *)this); + g_signal_connect(G_OBJECT(INKSCAPE), "dialogs_unhide", G_CALLBACK(unhideCallback), (void *)this); + g_signal_connect(G_OBJECT(INKSCAPE), "shut_down", G_CALLBACK(sp_dialog_shutdown), (void *)this); Glib::wrap(gobj())->signal_event().connect(sigc::mem_fun(*this, &Dialog::_onEvent)); Glib::wrap(gobj())->signal_key_press_event().connect(sigc::mem_fun(*this, &Dialog::_onKeyPress)); @@ -129,14 +120,6 @@ Dialog::Dialog(Behavior::BehaviorFactory behavior_factory, const char *prefs_pat Dialog::~Dialog() { - if (Inkscape::NSApplication::Application::getNewGui()) - { - _desktop_activated_connection.disconnect(); - _dialogs_hidden_connection.disconnect(); - _dialogs_unhidden_connection.disconnect(); - _shutdown_connection.disconnect(); - } - save_geometry(); delete _behavior; _behavior = 0; @@ -389,4 +372,4 @@ Dialog::_getSelection() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/dialog.h b/src/ui/dialog/dialog.h index f07c1bc86..307257b52 100644 --- a/src/ui/dialog/dialog.h +++ b/src/ui/dialog/dialog.h @@ -141,4 +141,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/dock-behavior.cpp b/src/ui/dialog/dock-behavior.cpp index 6b7a9b697..39d671cd8 100644 --- a/src/ui/dialog/dock-behavior.cpp +++ b/src/ui/dialog/dock-behavior.cpp @@ -300,4 +300,4 @@ DockBehavior::signal_drag_end() { return _dock_item.signal_drag_end(); } fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/dock-behavior.h b/src/ui/dialog/dock-behavior.h index 7f0d0ece0..b865af545 100644 --- a/src/ui/dialog/dock-behavior.h +++ b/src/ui/dialog/dock-behavior.h @@ -104,4 +104,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/document-metadata.cpp b/src/ui/dialog/document-metadata.cpp index 55eb94f92..a8a0fa191 100644 --- a/src/ui/dialog/document-metadata.cpp +++ b/src/ui/dialog/document-metadata.cpp @@ -256,4 +256,4 @@ on_repr_attr_changed (Inkscape::XML::Node *, gchar const *, gchar const *, gchar fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/document-metadata.h b/src/ui/dialog/document-metadata.h index f21bb0d83..21915c00f 100644 --- a/src/ui/dialog/document-metadata.h +++ b/src/ui/dialog/document-metadata.h @@ -83,4 +83,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 33fdf8327..f22509496 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -103,11 +103,8 @@ DocumentProperties::DocumentProperties() _rcp_hgui(_("_Highlight color:"), _("Highlighted guideline color"), _("Color of a guideline when it is under mouse"), "guidehicolor", "guidehiopacity", _wr), //--------------------------------------------------------------- _grids_label_crea("", Gtk::ALIGN_LEFT), - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - // "New" refers to grid - _grids_button_new(Q_("Grid|_New"), _("Create new grid.")), - _grids_button_remove(_("_Remove"), _("Remove selected grid.")), + _grids_button_new(C_("Grid", "_New"), _("Create new grid.")), + _grids_button_remove(C_("Grid", "_Remove"), _("Remove selected grid.")), _grids_label_def("", Gtk::ALIGN_LEFT) //--------------------------------------------------------------- { @@ -336,49 +333,28 @@ DocumentProperties::populate_available_profiles(){ delete(*it2); } - std::list<Glib::ustring> sources = ColorProfile::getProfileDirs(); - - // Use this loop to iterate through a list of possible document locations. - for ( std::list<Glib::ustring>::const_iterator it = sources.begin(); it != sources.end(); ++it ) { - if ( Inkscape::IO::file_test( it->c_str(), G_FILE_TEST_EXISTS ) - && Inkscape::IO::file_test( it->c_str(), G_FILE_TEST_IS_DIR )) { - GError *err = 0; - GDir *directory = g_dir_open(it->c_str(), 0, &err); - if (!directory) { - gchar *safeDir = Inkscape::IO::sanitizeString(it->c_str()); - g_warning(_("Color profiles directory (%s) is unavailable."), safeDir); - g_free(safeDir); - } else { - gchar *filename = 0; - while ((filename = (gchar *)g_dir_read_name(directory)) != NULL) { - gchar* full = g_build_filename(it->c_str(), filename, NULL); - if ( !Inkscape::IO::file_test( full, G_FILE_TEST_IS_DIR ) ) { - cmsErrorAction( LCMS_ERROR_SHOW ); - cmsHPROFILE hProfile = cmsOpenProfileFromFile(full, "r"); - if (hProfile != NULL){ - const gchar* name; - lcms_profile_get_name(hProfile, &name); - Gtk::MenuItem* mi = manage(new Gtk::MenuItem()); - mi->set_data("filepath", g_strdup(full)); - mi->set_data("name", g_strdup(name)); - Gtk::HBox *hbox = manage(new Gtk::HBox()); - hbox->show(); - Gtk::Label* lbl = manage(new Gtk::Label(name)); - lbl->show(); - hbox->pack_start(*lbl, true, true, 0); - mi->add(*hbox); - mi->show_all(); - _menu.append(*mi); - // g_free((void*)name); - cmsCloseProfile(hProfile); - } - } - g_free(full); - } - g_dir_close(directory); - } + std::list<Glib::ustring> files = ColorProfile::getProfileFiles(); + for ( std::list<Glib::ustring>::const_iterator it = files.begin(); it != files.end(); ++it ) { + cmsHPROFILE hProfile = cmsOpenProfileFromFile(it->c_str(), "r"); + if ( hProfile ){ + const gchar* name = 0; + lcms_profile_get_name(hProfile, &name); + Gtk::MenuItem* mi = manage(new Gtk::MenuItem()); + mi->set_data("filepath", g_strdup(it->c_str())); + mi->set_data("name", g_strdup(name)); + Gtk::HBox *hbox = manage(new Gtk::HBox()); + hbox->show(); + Gtk::Label* lbl = manage(new Gtk::Label(name)); + lbl->show(); + hbox->pack_start(*lbl, true, true, 0); + mi->add(*hbox); + mi->show_all(); + _menu.append(*mi); +// g_free((void*)name); + cmsCloseProfile(hProfile); } } + _menu.show_all(); } @@ -1003,4 +979,4 @@ DocumentProperties::onRemoveGrid() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h index c67dc9706..dbefca235 100644 --- a/src/ui/dialog/document-properties.h +++ b/src/ui/dialog/document-properties.h @@ -172,4 +172,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/extension-editor.cpp b/src/ui/dialog/extension-editor.cpp index c2f3426fd..527dfe23c 100644 --- a/src/ui/dialog/extension-editor.cpp +++ b/src/ui/dialog/extension-editor.cpp @@ -232,4 +232,4 @@ ExtensionEditor::add_extension (Inkscape::Extension::Extension * ext) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/extension-editor.h b/src/ui/dialog/extension-editor.h index fe171f60c..c209eb883 100644 --- a/src/ui/dialog/extension-editor.h +++ b/src/ui/dialog/extension-editor.h @@ -97,4 +97,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/extensions.cpp b/src/ui/dialog/extensions.cpp index f168da33a..3c778affe 100644 --- a/src/ui/dialog/extensions.cpp +++ b/src/ui/dialog/extensions.cpp @@ -126,4 +126,4 @@ void ExtensionsPanel::rescan() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/filedialog.cpp b/src/ui/dialog/filedialog.cpp index 68c0926aa..8db390cd2 100644 --- a/src/ui/dialog/filedialog.cpp +++ b/src/ui/dialog/filedialog.cpp @@ -199,4 +199,4 @@ FileExportDialog *FileExportDialog::create(Gtk::Window& parentWindow, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/filedialog.h b/src/ui/dialog/filedialog.h index 472c4ac0b..9f13308fb 100644 --- a/src/ui/dialog/filedialog.h +++ b/src/ui/dialog/filedialog.h @@ -386,4 +386,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp index 6f83a706f..fbfdc4a9b 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.cpp +++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp @@ -1625,4 +1625,4 @@ FileExportDialogImpl::getFilename() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/filedialogimpl-gtkmm.h b/src/ui/dialog/filedialogimpl-gtkmm.h index 65bb38971..af607c124 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.h +++ b/src/ui/dialog/filedialogimpl-gtkmm.h @@ -592,4 +592,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index cd9db2fac..b4379e071 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -57,7 +57,11 @@ namespace UI namespace Dialog { -const int PreviewWidening = 150; +const int PREVIEW_WIDENING = 150; +const int WINDOW_WIDTH_MINIMUM = 32; +const int WINDOW_WIDTH_FALLBACK = 450; +const int WINDOW_HEIGHT_MINIMUM = 32; +const int WINDOW_HEIGHT_FALLBACK = 360; const char PreviewWindowClassName[] = "PreviewWnd"; const unsigned long MaxPreviewFileSize = 10240; // kB @@ -89,6 +93,21 @@ ustring utf16_to_ustring(const wchar_t *utf16string, int utf16length = -1) return result; } +namespace { + +int sanitizeWindowSizeParam( int size, int delta, int minimum, int fallback ) +{ + int result = size; + if ( size < minimum ) { + g_warning( "Window size %d is less than cutoff.", size ); + result = fallback - delta; + } + result += delta; + return result; +} + +} // namespace + /*######################################################################### ### F I L E D I A L O G B A S E C L A S S #########################################################################*/ @@ -441,9 +460,9 @@ UINT_PTR CALLBACK FileOpenDialogImplWin32::GetOpenFileName_hookproc( RECT rcRect; GetWindowRect(hParentWnd, &rcRect); MoveWindow(hParentWnd, rcRect.left, rcRect.top, - rcRect.right - rcRect.left + PreviewWidening, - rcRect.bottom - rcRect.top, - FALSE); + rcRect.right - rcRect.left + PREVIEW_WIDENING, + rcRect.bottom - rcRect.top, + FALSE); // Set the pointer to the object OPENFILENAMEW *ofn = (OPENFILENAMEW*)lParam; @@ -1689,12 +1708,19 @@ UINT_PTR CALLBACK FileSaveDialogImplWin32::GetSaveFileName_hookproc( GetWindowRect(GetDlgItem(hParentWnd, stc2), &rST); GetWindowRect(hdlg, &rROOT); int ydelta = rCB1.top - rEDT1.top; + if ( ydelta < 0 ) { + g_warning("Negative dialog ydelta"); + ydelta = 0; + } // Make the window a bit longer + // Note: we have a width delta of 1 because there is a suspicion that MoveWindow() to the same size causes zero-width results. RECT rcRect; GetWindowRect(hParentWnd, &rcRect); - MoveWindow(hParentWnd, rcRect.left, rcRect.top, rcRect.right - rcRect.left, - rcRect.bottom - rcRect.top + ydelta, FALSE); + MoveWindow(hParentWnd, rcRect.left, rcRect.top, + sanitizeWindowSizeParam( rcRect.right - rcRect.left, 1, WINDOW_WIDTH_MINIMUM, WINDOW_WIDTH_FALLBACK ), + sanitizeWindowSizeParam( rcRect.bottom - rcRect.top, ydelta, WINDOW_HEIGHT_MINIMUM, WINDOW_HEIGHT_FALLBACK ), + FALSE); // It is not necessary to delete stock objects by calling DeleteObject HGDIOBJ dlgFont = GetStockObject(DEFAULT_GUI_FONT); @@ -1763,4 +1789,4 @@ UINT_PTR CALLBACK FileSaveDialogImplWin32::GetSaveFileName_hookproc( fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/filedialogimpl-win32.h b/src/ui/dialog/filedialogimpl-win32.h index 4234c1782..00d9cf37f 100644 --- a/src/ui/dialog/filedialogimpl-win32.h +++ b/src/ui/dialog/filedialogimpl-win32.h @@ -368,4 +368,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/fill-and-stroke.cpp b/src/ui/dialog/fill-and-stroke.cpp index 8c86e1ca4..0c234003e 100644 --- a/src/ui/dialog/fill-and-stroke.cpp +++ b/src/ui/dialog/fill-and-stroke.cpp @@ -171,4 +171,4 @@ FillAndStroke::_createPageTabLabel(const Glib::ustring& label, const char *label fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/fill-and-stroke.h b/src/ui/dialog/fill-and-stroke.h index 2d4e90d73..fe72aa31c 100644 --- a/src/ui/dialog/fill-and-stroke.h +++ b/src/ui/dialog/fill-and-stroke.h @@ -94,4 +94,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index dab42d897..b6a2c4fbf 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -27,8 +27,6 @@ #include <gtkmm/tooltips.h> #include <glibmm/i18n.h> -#include "application/application.h" -#include "application/editor.h" #include "desktop.h" #include "desktop-handles.h" #include "dialog-manager.h" @@ -2532,4 +2530,4 @@ void FilterEffectsDialog::update_color_matrix() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h index a14c85a91..61bb93415 100644 --- a/src/ui/dialog/filter-effects-dialog.h +++ b/src/ui/dialog/filter-effects-dialog.h @@ -287,4 +287,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index 837b82291..7fad00f56 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -57,10 +57,10 @@ namespace Dialog { Find::Find() : UI::Widget::Panel("", "/dialogs/find", SP_VERB_DIALOG_FIND), - _entry_text(_("_Text: "), _("Find objects by their text content (exact or partial match)")), - _entry_id(_("_ID: "), _("Find objects by the value of the id attribute (exact or partial match)")), - _entry_style(_("_Style: "), _("Find objects by the value of the style attribute (exact or partial match)")), - _entry_attribute(_("_Attribute: "), _("Find objects by the name of an attribute (exact or partial match)")), + _entry_text(_("_Text:"), _("Find objects by their text content (exact or partial match)")), + _entry_id(_("_ID:"), _("Find objects by the value of the id attribute (exact or partial match)")), + _entry_style(_("_Style:"), _("Find objects by the value of the style attribute (exact or partial match)")), + _entry_attribute(_("_Attribute:"), _("Find objects by the name of an attribute (exact or partial match)")), _check_search_selection(_("Search in s_election"), _("Limit search to the current selection")), _check_search_layer(_("Search in current _layer"), _("Limit search to the current layer")), _check_include_hidden(_("Include _hidden"), _("Include hidden objects in search")), @@ -76,10 +76,8 @@ Find::Find() _check_texts(_("Texts"), _("Search text objects")), _check_groups(_("Groups"), _("Search groups")), _check_clones( - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - // "Clones" is a noun indicating type of object to find - Q_("find|Clones"), _("Search clones")), + //TRANSLATORS: "Clones" is a noun indicating type of object to find + C_("Find dialog", "Clones"), _("Search clones")), _check_images(_("Images"), _("Search images")), _check_offsets(_("Offsets"), _("Search offset objects")), diff --git a/src/ui/dialog/find.h b/src/ui/dialog/find.h index 891df221f..d672bc658 100644 --- a/src/ui/dialog/find.h +++ b/src/ui/dialog/find.h @@ -106,4 +106,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/floating-behavior.cpp b/src/ui/dialog/floating-behavior.cpp index 85f078439..35cc88090 100644 --- a/src/ui/dialog/floating-behavior.cpp +++ b/src/ui/dialog/floating-behavior.cpp @@ -15,8 +15,6 @@ #include "floating-behavior.h" #include "dialog.h" -#include "application/application.h" -#include "application/editor.h" #include "inkscape.h" #include "desktop.h" #include "dialogs/dialog-events.h" @@ -240,4 +238,4 @@ FloatingBehavior::onDesktopActivated (SPDesktop *desktop) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/floating-behavior.h b/src/ui/dialog/floating-behavior.h index 30ecaa053..6ad316457 100644 --- a/src/ui/dialog/floating-behavior.h +++ b/src/ui/dialog/floating-behavior.h @@ -92,4 +92,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp index 8ed502aae..5e66ca9b8 100644 --- a/src/ui/dialog/glyphs.cpp +++ b/src/ui/dialog/glyphs.cpp @@ -746,4 +746,4 @@ void GlyphsPanel::rebuild() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/glyphs.h b/src/ui/dialog/glyphs.h index 1a01aebca..d6c731dda 100644 --- a/src/ui/dialog/glyphs.h +++ b/src/ui/dialog/glyphs.h @@ -104,4 +104,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index 3a7964ba2..aac6024b9 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -282,4 +282,4 @@ void GuidelinePropertiesDialog::_setup() { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/guides.h b/src/ui/dialog/guides.h index 49f94deea..2817e2644 100644 --- a/src/ui/dialog/guides.h +++ b/src/ui/dialog/guides.h @@ -90,4 +90,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp index 02e8cda9c..f35bd964b 100644 --- a/src/ui/dialog/icon-preview.cpp +++ b/src/ui/dialog/icon-preview.cpp @@ -228,7 +228,7 @@ IconPreviewPanel::IconPreviewPanel() : splitter.pack2( *actuals, false, false ); - selectionButton = new Gtk::CheckButton(_("Selection")); // , GTK_RESPONSE_APPLY + selectionButton = new Gtk::CheckButton(C_("Icon preview window", "Sele_ction"), true);//selectionButton = (Gtk::ToggleButton*) gtk_check_button_new_with_mnemonic(_("_Selection")); // , GTK_RESPONSE_APPLY magBox->pack_start( *selectionButton, Gtk::PACK_SHRINK ); tips.set_tip((*selectionButton), _("Selection only or whole document")); selectionButton->signal_clicked().connect( sigc::mem_fun(*this, &IconPreviewPanel::modeToggled) ); @@ -496,4 +496,4 @@ void IconPreviewPanel::updateMagnify() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/icon-preview.h b/src/ui/dialog/icon-preview.h index f8957086a..9c10eb89b 100644 --- a/src/ui/dialog/icon-preview.h +++ b/src/ui/dialog/icon-preview.h @@ -115,4 +115,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 8f5194eda..13491312a 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -356,7 +356,7 @@ void InkscapePreferences::AddNewObjectsStyle(DialogPage &p, Glib::ustring const if (banner) p.add_group_header(banner); else - p.add_group_header( _("Create new objects with:")); + p.add_group_header( _("Style of new objects")); PrefRadioButton* current = Gtk::manage( new PrefRadioButton); current->init ( _("Last used style"), prefs_path + "/usecurrent", 1, true, 0); p.add_line( true, "", *current, "", @@ -456,7 +456,7 @@ void InkscapePreferences::initPageTools() _t_node_pathflash_selected.init ( _("Show temporary outline for selected paths"), "/tools/nodes/pathflash_selected", false); _page_node.add_line( true, "", _t_node_pathflash_selected, "", _("Show temporary outline even when a path is selected for editing")); _t_node_pathflash_timeout.init("/tools/nodes/pathflash_timeout", 0, 10000.0, 100.0, 100.0, 1000.0, true, false); - _page_node.add_line( false, _("Flash time"), _t_node_pathflash_timeout, "ms", _("Specifies how long the path outline will be visible after a mouse-over (in milliseconds); specify 0 to have the outline shown until mouse leaves the path"), false); + _page_node.add_line( false, _("Flash time:"), _t_node_pathflash_timeout, "ms", _("Specifies how long the path outline will be visible after a mouse-over (in milliseconds); specify 0 to have the outline shown until mouse leaves the path"), false); _page_node.add_group_header(_("Editing preferences")); _t_node_single_node_transform_handles.init(_("Show transform handles for single nodes"), "/tools/nodes/single_node_transform_handles", false); _page_node.add_line( true, "", _t_node_single_node_transform_handles, "", _("Show transform handles even when only a single node is selected")); @@ -465,7 +465,7 @@ void InkscapePreferences::initPageTools() //Tweak this->AddPage(_page_tweak, _("Tweak"), iter_tools, PREFS_PAGE_TOOLS_TWEAK); - this->AddNewObjectsStyle(_page_tweak, "/tools/tweak", _("Paint objects with:")); + this->AddNewObjectsStyle(_page_tweak, "/tools/tweak", _("Object paint style")); AddSelcueCheckbox(_page_tweak, "/tools/tweak", true); AddGradientCheckbox(_page_tweak, "/tools/tweak", false); @@ -586,7 +586,7 @@ void InkscapePreferences::initPageWindows() _win_ontop_normal.init ( _("Normal"), "/options/transientpolicy/value", 1, true, &_win_ontop_none); _win_ontop_agressive.init ( _("Aggressive"), "/options/transientpolicy/value", 2, false, &_win_ontop_none); - _page_windows.add_group_header( _("Saving window geometry (size and position):")); + _page_windows.add_group_header( _("Saving window geometry (size and position)")); _page_windows.add_line( true, "", _win_save_geom_off, "", _("Let the window manager determine placement of all windows")); _page_windows.add_line( true, "", _win_save_geom_prefs, "", @@ -594,7 +594,7 @@ void InkscapePreferences::initPageWindows() _page_windows.add_line( true, "", _win_save_geom, "", _("Save and restore window geometry for each document (saves geometry in the document)")); - _page_windows.add_group_header( _("Dialog behavior (requires restart):")); + _page_windows.add_group_header( _("Dialog behavior (requires restart)")); _page_windows.add_line( true, "", _win_dockable, "", _("Dockable")); _page_windows.add_line( true, "", _win_floating, "", @@ -612,7 +612,7 @@ void InkscapePreferences::initPageWindows() #endif #if GTK_VERSION_GE(2, 12) - _page_windows.add_group_header( _("Dialog Transparency:")); + _page_windows.add_group_header( _("Dialog Transparency")); _win_trans_focus.init("/dialogs/transparency/on-focus", 0.5, 1.0, 0.01, 0.1, 1.0, false, false); _page_windows.add_line( true, _("Opacity when focused:"), _win_trans_focus, "", ""); _win_trans_blur.init("/dialogs/transparency/on-blur", 0.0, 1.0, 0.01, 0.1, 0.5, false, false); @@ -621,7 +621,7 @@ void InkscapePreferences::initPageWindows() _page_windows.add_line( true, _("Time of opacity change animation:"), _win_trans_time, "ms", ""); #endif - _page_windows.add_group_header( _("Miscellaneous:")); + _page_windows.add_group_header( _("Miscellaneous")); #ifndef WIN32 // FIXME: Temporary Win32 special code to enable transient dialogs _page_windows.add_line( false, "", _win_hide_task, "", _("Whether dialog windows are to be hidden in the window manager taskbar")); @@ -678,7 +678,7 @@ void InkscapePreferences::initPageMasks() _page_mask.add_line(true, "", _mask_mask_remove, "", _("After applying, remove the object used as the clipping path or mask from the drawing")); - _page_mask.add_group_header( _("Before applying clippath/mask:")); + _page_mask.add_group_header( _("Before applying")); _mask_grouping_none.init( _("Do not group clipped/masked objects"), "/options/maskobject/grouping", PREFS_MASKOBJECT_GROUPING_NONE, true, 0); _mask_grouping_separate.init( _("Enclose every clipped/masked object in its own group"), "/options/maskobject/grouping", PREFS_MASKOBJECT_GROUPING_SEPARATE, false, &_mask_grouping_none); @@ -693,7 +693,7 @@ void InkscapePreferences::initPageMasks() _page_mask.add_line(true, "", _mask_grouping_all, "", _("Apply clippath/mask to group containing all objects")); - _page_mask.add_group_header( _("After releasing clippath/mask:")); + _page_mask.add_group_header( _("After releasing")); _mask_ungrouping.init ( _("Ungroup automatically created groups"), "/options/maskobject/ungrouping", true); _page_mask.add_line(true, "", _mask_ungrouping, "", @@ -719,7 +719,7 @@ void InkscapePreferences::initPageTransforms() _("Move gradients (in fill or stroke) along with the objects")); _page_transforms.add_line( false, "", _trans_pattern, "", _("Move patterns (in fill or stroke) along with the objects")); - _page_transforms.add_group_header( _("Store transformation:")); + _page_transforms.add_group_header( _("Store transformation")); _page_transforms.add_line( true, "", _trans_optimized, "", _("If possible, apply transformation to objects without adding a transform= attribute")); _page_transforms.add_line( true, "", _trans_preserved, "", @@ -742,7 +742,7 @@ void InkscapePreferences::initPageFilters() _blur_quality_worst.init ( _("Lowest quality (fastest)"), "/options/blurquality/value", BLUR_QUALITY_WORST, false, &_blur_quality_best); - _page_filters.add_group_header( _("Gaussian blur quality for display:")); + _page_filters.add_group_header( _("Gaussian blur quality for display")); _page_filters.add_line( true, "", _blur_quality_best, "", _("Best quality, but display may be very slow at high zooms (bitmap export always uses best quality)")); _page_filters.add_line( true, "", _blur_quality_better, "", @@ -766,7 +766,7 @@ void InkscapePreferences::initPageFilters() _filter_quality_worst.init ( _("Lowest quality (fastest)"), "/options/filterquality/value", Inkscape::Filters::FILTER_QUALITY_WORST, false, &_filter_quality_best); - _page_filters.add_group_header( _("Filter effects quality for display:")); + _page_filters.add_group_header( _("Filter effects quality for display")); _page_filters.add_line( true, "", _filter_quality_best, "", _("Best quality, but display may be very slow at high zooms (bitmap export always uses best quality)")); _page_filters.add_line( true, "", _filter_quality_better, "", @@ -801,7 +801,7 @@ void InkscapePreferences::initPageSelecting() _sel_locked.init ( _("Ignore locked objects and layers"), "/options/kbselection/onlysensitive", true); _sel_layer_deselects.init ( _("Deselect upon layer change"), "/options/selection/layerdeselect", true); - _page_select.add_group_header( _("Ctrl+A, Tab, Shift+Tab:")); + _page_select.add_group_header( _("Ctrl+A, Tab, Shift+Tab")); _page_select.add_line( true, "", _sel_all, "", _("Make keyboard selection commands work on objects in all layers")); _page_select.add_line( true, "", _sel_current, "", @@ -896,7 +896,7 @@ void InkscapePreferences::initPageCMS() _page_cms.add_group_header( _("Display adjustment")); Glib::ustring tmpStr; - std::list<Glib::ustring> sources = ColorProfile::getProfileDirs(); + std::list<Glib::ustring> sources = ColorProfile::getBaseProfileDirs(); for ( std::list<Glib::ustring>::const_iterator it = sources.begin(); it != sources.end(); ++it ) { gchar* part = g_strdup_printf( "\n%s", it->c_str() ); tmpStr += part; @@ -1186,9 +1186,7 @@ void InkscapePreferences::initPageSave() _save_autosave_interval.init("/options/autosave/interval", 1.0, 10800.0, 1.0, 10.0, 10.0, true, false); _page_save.add_line(true, _("Interval (in minutes):"), _save_autosave_interval, "", _("Interval (in minutes) at which document will be autosaved"), false); _save_autosave_path.init("/options/autosave/path", true); - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - _page_save.add_line(true, Q_("filesystem|Path:"), _save_autosave_path, "", _("The directory where autosaves will be written"), false); + _page_save.add_line(true, C_("Filesystem", "Path:"), _save_autosave_path, "", _("The directory where autosaves will be written"), false); _save_autosave_max.init("/options/autosave/max", 1.0, 100.0, 1.0, 10.0, 10.0, true, false); _page_save.add_line(true, _("Maximum number of autosaves:"), _save_autosave_max, "", _("Maximum number of autosaved files; use this to limit the storage space used"), false); @@ -1505,4 +1503,4 @@ void InkscapePreferences::_presentPages() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp index 92a54affb..8f19c90c4 100644 --- a/src/ui/dialog/input.cpp +++ b/src/ui/dialog/input.cpp @@ -10,6 +10,7 @@ #include <map> #include <set> +#include <list> #include <glib/gprintf.h> #include <glibmm/i18n.h> #include <gtkmm/alignment.h> @@ -331,12 +332,14 @@ namespace Dialog { class DeviceModelColumns : public Gtk::TreeModel::ColumnRecord { public: + Gtk::TreeModelColumn<bool> toggler; + Gtk::TreeModelColumn<Glib::ustring> expander; Gtk::TreeModelColumn<Glib::ustring> description; - Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > thumbnail; + Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > thumbnail; Gtk::TreeModelColumn<Glib::RefPtr<InputDevice const> > device; Gtk::TreeModelColumn<Gdk::InputMode> mode; - DeviceModelColumns() { add(description); add(thumbnail); add(device); add(mode); } + DeviceModelColumns() { add(toggler), add(expander), add(description); add(thumbnail); add(device); add(mode); } }; static std::map<Gdk::InputMode, Glib::ustring> &getModeToString() @@ -390,6 +393,9 @@ private: static void commitCellModeChange(Glib::ustring const &path, Glib::ustring const &newText, Glib::RefPtr<Gtk::TreeStore> store); static void setModeCellString(Gtk::CellRenderer *rndr, Gtk::TreeIter const &iter); + static void commitCellStateChange(Glib::ustring const &path, Glib::RefPtr<Gtk::TreeStore> store); + static void setCellStateToggle(Gtk::CellRenderer *rndr, Gtk::TreeIter const &iter); + void saveSettings(); void useExtToggled(); @@ -720,6 +726,44 @@ InputDialogImpl::InputDialogImpl() : show_all_children(); } +class TabletTmp { +public: + TabletTmp() {} + + Glib::ustring name; + std::list<Glib::RefPtr<InputDevice const> > devices; +}; + +static Glib::ustring getCommon( std::list<Glib::ustring> const &names ) +{ + Glib::ustring result; + + if ( !names.empty() ) { + size_t pos = 0; + bool match = true; + while ( match ) { + if ( names.begin()->length() > pos ) { + gunichar ch = (*names.begin())[pos]; + for ( std::list<Glib::ustring>::const_iterator it = names.begin(); it != names.end(); ++it ) { + if ( (pos >= it->length()) + || ((*it)[pos] != ch) ) { + match = false; + break; + } + } + if (match) { + result += ch; + pos++; + } + } else { + match = false; + } + } + } + + return result; +} + void InputDialogImpl::setupTree( Glib::RefPtr<Gtk::TreeStore> store, Gtk::TreeIter &tablet ) { std::list<Glib::RefPtr<InputDevice const> > devList = Inkscape::DeviceManager::getManager().getDevices(); @@ -727,48 +771,99 @@ void InputDialogImpl::setupTree( Glib::RefPtr<Gtk::TreeStore> store, Gtk::TreeIt Gtk::TreeModel::Row row = *(store->append()); row[getCols().description] = _("Hardware"); - tablet = store->append(row.children()); - Gtk::TreeModel::Row childrow = *tablet; - childrow[getCols().description] = _("Tablet"); - childrow[getCols().thumbnail] = getPix(PIX_TABLET); + // Let's make some tablets!!! + std::list<TabletTmp> tablets; + std::set<Glib::ustring> consumed; + // Phase 1 - figure out which tablets are present for ( std::list<Glib::RefPtr<InputDevice const> >::iterator it = devList.begin(); it != devList.end(); ++it ) { Glib::RefPtr<InputDevice const> dev = *it; if ( dev ) { -// g_message("device: name[%s] source[0x%x] mode[0x%x] cursor[%s] axis count[%d] key count[%d]", dev->getName().c_str(), dev->getSource(), dev->getMode(), -// dev->hasCursor() ? "Yes":"no", dev->getNumAxes(), dev->getNumKeys()); - -// if ( dev->getSource() != Gdk::SOURCE_MOUSE ) { - if ( dev ) { - Gtk::TreeModel::Row deviceRow = *(store->append(childrow.children())); - deviceRow[getCols().description] = dev->getName(); - deviceRow[getCols().device] = dev; - deviceRow[getCols().mode] = dev->getMode(); - switch ( dev->getSource() ) { - case GDK_SOURCE_MOUSE: - deviceRow[getCols().thumbnail] = getPix(PIX_CORE); - break; - case GDK_SOURCE_PEN: - if (deviceRow[getCols().description] == _("pad")) { - deviceRow[getCols().thumbnail] = getPix(PIX_SIDEBUTTONS); - } else { - deviceRow[getCols().thumbnail] = getPix(PIX_TIP); - } - break; - case GDK_SOURCE_CURSOR: - deviceRow[getCols().thumbnail] = getPix(PIX_MOUSE); - break; - case GDK_SOURCE_ERASER: - deviceRow[getCols().thumbnail] = getPix(PIX_ERASER); - break; - default: - ; // nothing + if ( dev->getSource() != Gdk::SOURCE_MOUSE ) { + consumed.insert( dev->getId() ); + if ( tablets.empty() ) { + TabletTmp tmp; + tablets.push_back(tmp); } + tablets.back().devices.push_back(dev); } } else { g_warning("Null device in list"); } } + + // Phase 2 - build a UI for the present devices + for ( std::list<TabletTmp>::iterator it = tablets.begin(); it != tablets.end(); ++it ) { + tablet = store->append(row.children()); + Gtk::TreeModel::Row childrow = *tablet; + if ( it->name.empty() ) { + // Check to see if we can derive one + std::list<Glib::ustring> names; + for ( std::list<Glib::RefPtr<InputDevice const> >::iterator it2 = it->devices.begin(); it2 != it->devices.end(); ++it2 ) { + names.push_back( (*it2)->getName() ); + } + Glib::ustring common = getCommon(names); + if ( !common.empty() ) { + it->name = common; + } + } + childrow[getCols().description] = it->name.empty() ? _("Tablet") : it->name ; + childrow[getCols().thumbnail] = getPix(PIX_TABLET); + + // Check if there is an eraser we can link to a pen + for ( std::list<Glib::RefPtr<InputDevice const> >::iterator it2 = it->devices.begin(); it2 != it->devices.end(); ++it2 ) { + Glib::RefPtr<InputDevice const> dev = *it2; + if ( dev->getSource() == Gdk::SOURCE_PEN ) { + for ( std::list<Glib::RefPtr<InputDevice const> >::iterator it3 = it->devices.begin(); it3 != it->devices.end(); ++it3 ) { + Glib::RefPtr<InputDevice const> dev2 = *it3; + if ( dev2->getSource() == Gdk::SOURCE_ERASER ) { + DeviceManager::getManager().setLinkedTo(dev->getId(), dev2->getId()); + break; // only check the first eraser... for now + } + break; // only check the first pen... for now + } + } + } + + for ( std::list<Glib::RefPtr<InputDevice const> >::iterator it2 = it->devices.begin(); it2 != it->devices.end(); ++it2 ) { + Glib::RefPtr<InputDevice const> dev = *it2; + Gtk::TreeModel::Row deviceRow = *(store->append(childrow.children())); + deviceRow[getCols().description] = dev->getName(); + deviceRow[getCols().device] = dev; + deviceRow[getCols().mode] = dev->getMode(); + switch ( dev->getSource() ) { + case GDK_SOURCE_MOUSE: + deviceRow[getCols().thumbnail] = getPix(PIX_CORE); + break; + case GDK_SOURCE_PEN: + if (deviceRow[getCols().description] == _("pad")) { + deviceRow[getCols().thumbnail] = getPix(PIX_SIDEBUTTONS); + } else { + deviceRow[getCols().thumbnail] = getPix(PIX_TIP); + } + break; + case GDK_SOURCE_CURSOR: + deviceRow[getCols().thumbnail] = getPix(PIX_MOUSE); + break; + case GDK_SOURCE_ERASER: + deviceRow[getCols().thumbnail] = getPix(PIX_ERASER); + break; + default: + ; // nothing + } + } + } + + for ( std::list<Glib::RefPtr<InputDevice const> >::iterator it = devList.begin(); it != devList.end(); ++it ) { + Glib::RefPtr<InputDevice const> dev = *it; + if ( dev && (consumed.find( dev->getId() ) == consumed.end()) ) { + Gtk::TreeModel::Row deviceRow = *(store->append(row.children())); + deviceRow[getCols().description] = dev->getName(); + deviceRow[getCols().device] = dev; + deviceRow[getCols().mode] = dev->getMode(); + deviceRow[getCols().thumbnail] = getPix(PIX_CORE); + } + } } else { g_warning("No devices found"); } @@ -806,24 +901,39 @@ InputDialogImpl::ConfPanel::ConfPanel() : row = *(poppers->append()); row[foo.one] = getModeToString()[Gdk::MODE_WINDOW]; - Gtk::CellRendererCombo *rendr = new Gtk::CellRendererCombo(); - rendr->property_model().set_value(poppers); - rendr->property_text_column().set_value(0); - rendr->property_has_entry() = false; - //Add the TreeView's view columns: + { + Gtk::CellRendererToggle *rendr = new Gtk::CellRendererToggle(); + Gtk::TreeViewColumn *col = new Gtk::TreeViewColumn("xx", *rendr); + if (col) { + tree.append_column(*col); + col->set_cell_data_func(*rendr, sigc::ptr_fun(setCellStateToggle)); + rendr->signal_toggled().connect(sigc::bind(sigc::ptr_fun(commitCellStateChange), store)); + } + } + + int expPos = tree.append_column("", getCols().expander); + tree.append_column("I", getCols().thumbnail); tree.append_column("Bar", getCols().description); - Gtk::TreeViewColumn *col = new Gtk::TreeViewColumn("X", *rendr); - if (col) { - tree.append_column(*col); - col->set_cell_data_func(*rendr, sigc::ptr_fun(setModeCellString)); - rendr->signal_edited().connect(sigc::bind(sigc::ptr_fun(commitCellModeChange), store)); - rendr->property_editable() = true; + + { + Gtk::CellRendererCombo *rendr = new Gtk::CellRendererCombo(); + rendr->property_model().set_value(poppers); + rendr->property_text_column().set_value(0); + rendr->property_has_entry() = false; + Gtk::TreeViewColumn *col = new Gtk::TreeViewColumn("X", *rendr); + if (col) { + tree.append_column(*col); + col->set_cell_data_func(*rendr, sigc::ptr_fun(setModeCellString)); + rendr->signal_edited().connect(sigc::bind(sigc::ptr_fun(commitCellModeChange), store)); + rendr->property_editable() = true; + } } tree.set_enable_tree_lines(); tree.set_headers_visible(false); + tree.set_expander_column( *tree.get_column(expPos - 1) ); setupTree( store, tabletIter ); @@ -874,6 +984,38 @@ void InputDialogImpl::ConfPanel::commitCellModeChange(Glib::ustring const &path, } } +void InputDialogImpl::ConfPanel::setCellStateToggle(Gtk::CellRenderer *rndr, Gtk::TreeIter const &iter) +{ + if (iter) { + Gtk::CellRendererToggle *toggle = dynamic_cast<Gtk::CellRendererToggle *>(rndr); + if (toggle) { + Glib::RefPtr<InputDevice const> dev = (*iter)[getCols().device]; + if (dev) { + Gdk::InputMode mode = (*iter)[getCols().mode]; + toggle->set_active(mode != Gdk::MODE_DISABLED); + } else { + toggle->set_active(false); + } + } + } +} + +void InputDialogImpl::ConfPanel::commitCellStateChange(Glib::ustring const &path, Glib::RefPtr<Gtk::TreeStore> store) +{ + Gtk::TreeIter iter = store->get_iter(path); + if (iter) { + Glib::RefPtr<InputDevice const> dev = (*iter)[getCols().device]; + if (dev) { + Gdk::InputMode mode = (*iter)[getCols().mode]; + if (mode == Gdk::MODE_DISABLED) { + Inkscape::DeviceManager::getManager().setMode( dev->getId(), Gdk::MODE_SCREEN ); + } else { + Inkscape::DeviceManager::getManager().setMode( dev->getId(), Gdk::MODE_DISABLED ); + } + } + } +} + void InputDialogImpl::ConfPanel::saveSettings() { Inkscape::DeviceManager::getManager().saveConfig(); @@ -1468,4 +1610,4 @@ bool InputDialogImpl::eventSnoop(GdkEvent* event) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/input.h b/src/ui/dialog/input.h index 186612af0..40bbbeebf 100644 --- a/src/ui/dialog/input.h +++ b/src/ui/dialog/input.h @@ -44,4 +44,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp index ffa4642e7..1728ff3a6 100644 --- a/src/ui/dialog/layer-properties.cpp +++ b/src/ui/dialog/layer-properties.cpp @@ -259,4 +259,4 @@ void LayerPropertiesDialog::_setLayer(SPObject *layer) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/layer-properties.h b/src/ui/dialog/layer-properties.h index 807967e8d..4172c284d 100644 --- a/src/ui/dialog/layer-properties.h +++ b/src/ui/dialog/layer-properties.h @@ -129,4 +129,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index ff3a13ab2..c3c0ae3c5 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -631,32 +631,30 @@ LayersPanel::LayersPanel() : _buttonsRow.set_child_min_width( 16 ); Gtk::Button* btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_NEW, GTK_STOCK_ADD, _("New") ); + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_NEW, GTK_STOCK_ADD, C_("Layers", "New") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_NEW) ); _buttonsRow.add( *btn ); btn = manage( new Gtk::Button() ); - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_TOP, GTK_STOCK_GOTO_TOP, Q_("layers|Top") ); + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_TOP, GTK_STOCK_GOTO_TOP, C_("Layers", "Top") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_TOP) ); _watchingNonTop.push_back( btn ); _buttonsRow.add( *btn ); btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_RAISE, GTK_STOCK_GO_UP, _("Up") ); + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_RAISE, GTK_STOCK_GO_UP, C_("Layers", "Up") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_UP) ); _watchingNonTop.push_back( btn ); _buttonsRow.add( *btn ); btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_LOWER, GTK_STOCK_GO_DOWN, _("Dn") ); + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_LOWER, GTK_STOCK_GO_DOWN, C_("Layers", "Dn") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_DOWN) ); _watchingNonBottom.push_back( btn ); _buttonsRow.add( *btn ); btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_BOTTOM, GTK_STOCK_GOTO_BOTTOM, _("Bot") ); + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_BOTTOM, GTK_STOCK_GOTO_BOTTOM, C_("Layers", "Bot") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_BOTTOM) ); _watchingNonBottom.push_back( btn ); _buttonsRow.add( *btn ); @@ -794,4 +792,4 @@ void LayersPanel::setDesktop( SPDesktop* desktop ) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/layers.h b/src/ui/dialog/layers.h index 4f2a65435..b7e81480c 100644 --- a/src/ui/dialog/layers.h +++ b/src/ui/dialog/layers.h @@ -144,4 +144,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index fb24d8e72..706a84733 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -483,4 +483,4 @@ void LivePathEffectEditor::on_visibility_toggled( Glib::ustring const& str ) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/livepatheffect-editor.h b/src/ui/dialog/livepatheffect-editor.h index 50e948644..7880d726b 100644 --- a/src/ui/dialog/livepatheffect-editor.h +++ b/src/ui/dialog/livepatheffect-editor.h @@ -144,4 +144,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/memory.cpp b/src/ui/dialog/memory.cpp index a80c7b449..7f5c5cefa 100644 --- a/src/ui/dialog/memory.cpp +++ b/src/ui/dialog/memory.cpp @@ -241,4 +241,4 @@ void Memory::_apply() { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/memory.h b/src/ui/dialog/memory.h index 48dcc8f09..792391b89 100644 --- a/src/ui/dialog/memory.h +++ b/src/ui/dialog/memory.h @@ -50,4 +50,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/messages.cpp b/src/ui/dialog/messages.cpp index 31f9cc51e..654117704 100644 --- a/src/ui/dialog/messages.cpp +++ b/src/ui/dialog/messages.cpp @@ -190,4 +190,4 @@ void Messages::releaseLogMessages() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/messages.h b/src/ui/dialog/messages.h index b0a9d812b..1232914c8 100644 --- a/src/ui/dialog/messages.h +++ b/src/ui/dialog/messages.h @@ -93,4 +93,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/ocaldialogs.h b/src/ui/dialog/ocaldialogs.h index ce26f2148..85aefade8 100644 --- a/src/ui/dialog/ocaldialogs.h +++ b/src/ui/dialog/ocaldialogs.h @@ -375,4 +375,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/panel-dialog.h b/src/ui/dialog/panel-dialog.h index dc01c6a29..1103eccad 100644 --- a/src/ui/dialog/panel-dialog.h +++ b/src/ui/dialog/panel-dialog.h @@ -252,4 +252,4 @@ PanelDialog<Behavior::FloatingBehavior>::create() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index 60cab06a2..2456e10da 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -240,4 +240,4 @@ Gtk::PrintOperationResult Print::run(Gtk::PrintOperationAction, Gtk::Window &par fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/print.h b/src/ui/dialog/print.h index ea89ebdf2..cc27955cb 100644 --- a/src/ui/dialog/print.h +++ b/src/ui/dialog/print.h @@ -70,4 +70,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/scriptdialog.cpp b/src/ui/dialog/scriptdialog.cpp index 0e8a23baf..c7f828067 100644 --- a/src/ui/dialog/scriptdialog.cpp +++ b/src/ui/dialog/scriptdialog.cpp @@ -279,4 +279,4 @@ ScriptDialog &ScriptDialog::getInstance() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/scriptdialog.h b/src/ui/dialog/scriptdialog.h index d0021ce68..0b26f169a 100644 --- a/src/ui/dialog/scriptdialog.h +++ b/src/ui/dialog/scriptdialog.h @@ -75,4 +75,4 @@ class ScriptDialog : public UI::Widget::Panel fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/session-player.cpp b/src/ui/dialog/session-player.cpp index 0e484c3f2..51b206a85 100644 --- a/src/ui/dialog/session-player.cpp +++ b/src/ui/dialog/session-player.cpp @@ -227,4 +227,4 @@ SessionPlaybackDialogImpl::_respCallback(int resp) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/session-player.h b/src/ui/dialog/session-player.h index 52377a73f..9c10f264f 100644 --- a/src/ui/dialog/session-player.h +++ b/src/ui/dialog/session-player.h @@ -131,4 +131,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 998f4e1e1..1f11a412e 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -602,6 +602,7 @@ void SvgFontsDialog::glyph_unicode_edit(const Glib::ustring&, const Glib::ustrin void SvgFontsDialog::remove_selected_font(){ SPFont* font = get_selected_spfont(); + if (!font) return; sp_repr_unparent(font->repr); SPDocument* doc = sp_desktop_document(this->getDesktop()); @@ -731,7 +732,7 @@ Gtk::VBox* SvgFontsDialog::kerning_tab(){ create_kerning_pairs_popup_menu(_KerningPairsList, sigc::mem_fun(*this, &SvgFontsDialog::remove_selected_kerning_pair)); //Kerning Setup: - kerning_vbox.add(*Gtk::manage(new Gtk::Label(_("Kerning Setup:")))); + kerning_vbox.add(*Gtk::manage(new Gtk::Label(_("Kerning Setup")))); Gtk::HBox* kerning_selector = Gtk::manage(new Gtk::HBox()); kerning_selector->add(*Gtk::manage(new Gtk::Label(_("1st Glyph:")))); kerning_selector->add(first_glyph); @@ -910,4 +911,4 @@ SvgFontsDialog::~SvgFontsDialog(){} fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 96910821e..f6cd5b775 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -436,7 +436,7 @@ void _loadPaletteFile( gchar const *filename ) if ( !hasErr && *ptr ) { char* n = trim(ptr); if (n != NULL) { - name = n; + name = g_dpgettext2(NULL, "Palette", n); } } if ( !hasErr ) { @@ -1081,4 +1081,4 @@ void SwatchesPanel::_rebuild() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/swatches.h b/src/ui/dialog/swatches.h index 93bbe81d8..f9f3daf91 100644 --- a/src/ui/dialog/swatches.h +++ b/src/ui/dialog/swatches.h @@ -87,4 +87,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index 6be346582..b50610938 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -885,4 +885,4 @@ TileDialog::TileDialog() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :: +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/tile.h b/src/ui/dialog/tile.h index 9ade64935..16ae3e4f8 100644 --- a/src/ui/dialog/tile.h +++ b/src/ui/dialog/tile.h @@ -177,4 +177,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/tracedialog.h b/src/ui/dialog/tracedialog.h index 9dc084cd6..b52162aba 100644 --- a/src/ui/dialog/tracedialog.h +++ b/src/ui/dialog/tracedialog.h @@ -65,4 +65,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index c11801fcf..bb7ea1a69 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -25,6 +25,7 @@ #include "selection-chemistry.h" #include "verbs.h" #include "preferences.h" +#include "sp-namedview.h" #include "sp-item-transform.h" #include "macros.h" #include "sp-item.h" @@ -78,27 +79,27 @@ Transformation::Transformation() _page_rotate (4, 2), _page_skew (4, 2), _page_transform (3, 3), - _scalar_move_horizontal (_("_Horizontal"), _("Horizontal displacement (relative) or position (absolute)"), UNIT_TYPE_LINEAR, + _scalar_move_horizontal (_("_Horizontal:"), _("Horizontal displacement (relative) or position (absolute)"), UNIT_TYPE_LINEAR, "", "transform-move-horizontal", &_units_move), - _scalar_move_vertical (_("_Vertical"), _("Vertical displacement (relative) or position (absolute)"), UNIT_TYPE_LINEAR, + _scalar_move_vertical (_("_Vertical:"), _("Vertical displacement (relative) or position (absolute)"), UNIT_TYPE_LINEAR, "", "transform-move-vertical", &_units_move), - _scalar_scale_horizontal(_("_Width"), _("Horizontal size (absolute or percentage of current)"), UNIT_TYPE_DIMENSIONLESS, + _scalar_scale_horizontal(_("_Width:"), _("Horizontal size (absolute or percentage of current)"), UNIT_TYPE_DIMENSIONLESS, "", "transform-scale-horizontal", &_units_scale), - _scalar_scale_vertical (_("_Height"), _("Vertical size (absolute or percentage of current)"), UNIT_TYPE_DIMENSIONLESS, + _scalar_scale_vertical (_("_Height:"), _("Vertical size (absolute or percentage of current)"), UNIT_TYPE_DIMENSIONLESS, "", "transform-scale-vertical", &_units_scale), - _scalar_rotate (_("A_ngle"), _("Rotation angle (positive = counterclockwise)"), UNIT_TYPE_RADIAL, + _scalar_rotate (_("A_ngle:"), _("Rotation angle (positive = counterclockwise)"), UNIT_TYPE_RADIAL, "", "transform-rotate", &_units_rotate), - _scalar_skew_horizontal (_("_Horizontal"), _("Horizontal skew angle (positive = counterclockwise), or absolute displacement, or percentage displacement"), UNIT_TYPE_LINEAR, + _scalar_skew_horizontal (_("_Horizontal:"), _("Horizontal skew angle (positive = counterclockwise), or absolute displacement, or percentage displacement"), UNIT_TYPE_LINEAR, "", "transform-skew-horizontal", &_units_skew), - _scalar_skew_vertical (_("_Vertical"), _("Vertical skew angle (positive = counterclockwise), or absolute displacement, or percentage displacement"), UNIT_TYPE_LINEAR, + _scalar_skew_vertical (_("_Vertical:"), _("Vertical skew angle (positive = counterclockwise), or absolute displacement, or percentage displacement"), UNIT_TYPE_LINEAR, "", "transform-skew-vertical", &_units_skew), - _scalar_transform_a ("_A", _("Transformation matrix element A")), - _scalar_transform_b ("_B", _("Transformation matrix element B")), - _scalar_transform_c ("_C", _("Transformation matrix element C")), - _scalar_transform_d ("_D", _("Transformation matrix element D")), - _scalar_transform_e ("_E", _("Transformation matrix element E")), - _scalar_transform_f ("_F", _("Transformation matrix element F")), + _scalar_transform_a ("_A:", _("Transformation matrix element A")), + _scalar_transform_b ("_B:", _("Transformation matrix element B")), + _scalar_transform_c ("_C:", _("Transformation matrix element C")), + _scalar_transform_d ("_D:", _("Transformation matrix element D")), + _scalar_transform_e ("_E:", _("Transformation matrix element E")), + _scalar_transform_f ("_F:", _("Transformation matrix element F")), _check_move_relative (_("Rela_tive move"), _("Add the specified relative displacement to the current position; otherwise, edit the current absolute position directly")), _check_scale_proportional (_("Scale proportionally"), _("Preserve the width/height ratio of the scaled objects")), @@ -197,6 +198,14 @@ void Transformation::layoutPageMove() { _units_move.setUnitType(UNIT_TYPE_LINEAR); + + // Setting default unit to document unit + SPDesktop *dt = getDesktop(); + SPNamedView *nv = sp_desktop_namedview(dt); + if (nv->doc_units) { + _units_move.setUnit(nv->doc_units->abbr); + } + _scalar_move_horizontal.initScalar(-1e6, 1e6); _scalar_move_horizontal.setDigits(3); _scalar_move_horizontal.setIncrements(0.1, 1.0); @@ -461,8 +470,9 @@ Transformation::updatePageMove(Inkscape::Selection *selection) double x = bbox->min()[Geom::X]; double y = bbox->min()[Geom::Y]; - _scalar_move_horizontal.setValue(x, "px"); - _scalar_move_vertical.setValue(y, "px"); + double conversion = _units_move.getConversion("px"); + _scalar_move_horizontal.setValue(x / conversion); + _scalar_move_vertical.setValue(y / conversion); } } else { // do nothing, so you can apply the same relative move to many objects in turn @@ -870,6 +880,8 @@ Transformation::onMoveRelativeToggled() double x = _scalar_move_horizontal.getValue("px"); double y = _scalar_move_vertical.getValue("px"); + double conversion = _units_move.getConversion("px"); + //g_message("onMoveRelativeToggled: %f, %f px\n", x, y); Geom::OptRect bbox = selection->bounds(); @@ -877,12 +889,12 @@ Transformation::onMoveRelativeToggled() if (bbox) { if (_check_move_relative.get_active()) { // From absolute to relative - _scalar_move_horizontal.setValue(x - bbox->min()[Geom::X], "px"); - _scalar_move_vertical.setValue( y - bbox->min()[Geom::Y], "px"); + _scalar_move_horizontal.setValue((x - bbox->min()[Geom::X]) / conversion); + _scalar_move_vertical.setValue(( y - bbox->min()[Geom::Y]) / conversion); } else { // From relative to absolute - _scalar_move_horizontal.setValue(bbox->min()[Geom::X] + x, "px"); - _scalar_move_vertical.setValue( bbox->min()[Geom::Y] + y, "px"); + _scalar_move_horizontal.setValue((bbox->min()[Geom::X] + x) / conversion); + _scalar_move_vertical.setValue(( bbox->min()[Geom::Y] + y) / conversion); } } @@ -1067,4 +1079,4 @@ Transformation::onApplySeparatelyToggled() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/transformation.h b/src/ui/dialog/transformation.h index 0607871fd..cf6d72447 100644 --- a/src/ui/dialog/transformation.h +++ b/src/ui/dialog/transformation.h @@ -19,7 +19,6 @@ #include "ui/widget/panel.h" -#include "application/application.h" #include "ui/widget/notebook-page.h" #include "ui/widget/scalar-unit.h" #include "ui/widget/imageicon.h" @@ -145,12 +144,6 @@ protected: virtual void _apply(); void presentPage(PageType page); - - void onSelectionChanged(Inkscape::NSApplication::Application *inkscape, - Inkscape::Selection *selection); - void onSelectionModified(Inkscape::NSApplication::Application *inkscape, - Inkscape::Selection *selection, - int unsigned flags); void onSwitchPage(GtkNotebookPage *page, guint pagenum); @@ -232,4 +225,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/undo-history.cpp b/src/ui/dialog/undo-history.cpp index 8017af803..111dc014d 100644 --- a/src/ui/dialog/undo-history.cpp +++ b/src/ui/dialog/undo-history.cpp @@ -345,4 +345,4 @@ const CellRendererInt::Filter& UndoHistory::greater_than_1 = UndoHistory::Greate fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/undo-history.h b/src/ui/dialog/undo-history.h index 82e04f3c9..1a4d2e486 100644 --- a/src/ui/dialog/undo-history.h +++ b/src/ui/dialog/undo-history.h @@ -170,4 +170,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/whiteboard-connect.cpp b/src/ui/dialog/whiteboard-connect.cpp index b18ed99d4..0555281d4 100644 --- a/src/ui/dialog/whiteboard-connect.cpp +++ b/src/ui/dialog/whiteboard-connect.cpp @@ -318,4 +318,4 @@ WhiteboardConnectDialogImpl::_useSSLClickedCallback() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/whiteboard-sharewithuser.cpp b/src/ui/dialog/whiteboard-sharewithuser.cpp index bb3761f31..6d905b684 100644 --- a/src/ui/dialog/whiteboard-sharewithuser.cpp +++ b/src/ui/dialog/whiteboard-sharewithuser.cpp @@ -224,4 +224,4 @@ WhiteboardShareWithUserDialogImpl::_listCallback() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/icon-names.h b/src/ui/icon-names.h index 92fd86a48..2ec03c5cc 100644 --- a/src/ui/icon-names.h +++ b/src/ui/icon-names.h @@ -590,4 +590,4 @@ fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/previewable.h b/src/ui/previewable.h index ef1ca3ce2..9a086a9a2 100644 --- a/src/ui/previewable.h +++ b/src/ui/previewable.h @@ -59,4 +59,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/previewfillable.h b/src/ui/previewfillable.h index f863af121..07fbc4fc5 100644 --- a/src/ui/previewfillable.h +++ b/src/ui/previewfillable.h @@ -52,4 +52,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp index ba0b6a7ef..7a018d91a 100644 --- a/src/ui/previewholder.cpp +++ b/src/ui/previewholder.cpp @@ -338,4 +338,4 @@ void PreviewHolder::rebuildUI() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/previewholder.h b/src/ui/previewholder.h index 3c1a16195..c396cef19 100644 --- a/src/ui/previewholder.h +++ b/src/ui/previewholder.h @@ -77,4 +77,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/commit-events.h b/src/ui/tool/commit-events.h index d99872766..110564ba3 100644 --- a/src/ui/tool/commit-events.h +++ b/src/ui/tool/commit-events.h @@ -48,4 +48,4 @@ enum CommitEvent { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/control-point-selection.cpp b/src/ui/tool/control-point-selection.cpp index 615587eeb..91e0bc2c2 100644 --- a/src/ui/tool/control-point-selection.cpp +++ b/src/ui/tool/control-point-selection.cpp @@ -654,4 +654,4 @@ bool ControlPointSelection::event(GdkEvent *event) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/control-point-selection.h b/src/ui/tool/control-point-selection.h index 8023c3e28..3aed6ae93 100644 --- a/src/ui/tool/control-point-selection.h +++ b/src/ui/tool/control-point-selection.h @@ -159,4 +159,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/control-point.cpp b/src/ui/tool/control-point.cpp index b74e3bc9c..d5e5b7dfe 100644 --- a/src/ui/tool/control-point.cpp +++ b/src/ui/tool/control-point.cpp @@ -329,7 +329,7 @@ bool ControlPoint::_eventHandler(GdkEvent *event) _setState(STATE_CLICKED); return true; } - return false; + return _event_grab; case GDK_2BUTTON_PRESS: // store the button number for next release @@ -452,8 +452,9 @@ bool ControlPoint::_eventHandler(GdkEvent *event) default: break; } - - return false; + + // do not propagate events during grab - it might cause problems + return _event_grab; } void ControlPoint::_setMouseover(ControlPoint *p, unsigned state) @@ -578,4 +579,4 @@ bool ControlPoint::doubleclicked(GdkEventButton *) { return false; } fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/control-point.h b/src/ui/tool/control-point.h index 48c70748b..4de5e5847 100644 --- a/src/ui/tool/control-point.h +++ b/src/ui/tool/control-point.h @@ -199,4 +199,4 @@ extern ControlPoint::ColorSet invisible_cset; fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/curve-drag-point.cpp b/src/ui/tool/curve-drag-point.cpp index 0e5805dda..a3fb5aa6e 100644 --- a/src/ui/tool/curve-drag-point.cpp +++ b/src/ui/tool/curve-drag-point.cpp @@ -193,4 +193,4 @@ Glib::ustring CurveDragPoint::_getTip(unsigned state) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/curve-drag-point.h b/src/ui/tool/curve-drag-point.h index 288ae6a8e..42a4930c8 100644 --- a/src/ui/tool/curve-drag-point.h +++ b/src/ui/tool/curve-drag-point.h @@ -59,4 +59,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/event-utils.cpp b/src/ui/tool/event-utils.cpp index 91b2cdb04..ef2d27653 100644 --- a/src/ui/tool/event-utils.cpp +++ b/src/ui/tool/event-utils.cpp @@ -153,4 +153,4 @@ unsigned state_after_event(GdkEvent *event) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/event-utils.h b/src/ui/tool/event-utils.h index 784855f56..de29c3dda 100644 --- a/src/ui/tool/event-utils.h +++ b/src/ui/tool/event-utils.h @@ -129,4 +129,4 @@ unsigned state_after_event(GdkEvent *event); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/manipulator.cpp b/src/ui/tool/manipulator.cpp index b532fcab4..49e601797 100644 --- a/src/ui/tool/manipulator.cpp +++ b/src/ui/tool/manipulator.cpp @@ -86,4 +86,4 @@ bool ManipulatorGroup::event(GdkEvent *event) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/manipulator.h b/src/ui/tool/manipulator.h index 799dad0d3..fd24e7b61 100644 --- a/src/ui/tool/manipulator.h +++ b/src/ui/tool/manipulator.h @@ -162,4 +162,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/modifier-tracker.cpp b/src/ui/tool/modifier-tracker.cpp index 8c6033bc7..bbef0d469 100644 --- a/src/ui/tool/modifier-tracker.cpp +++ b/src/ui/tool/modifier-tracker.cpp @@ -90,4 +90,4 @@ bool ModifierTracker::event(GdkEvent *event) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/modifier-tracker.h b/src/ui/tool/modifier-tracker.h index 55538ead6..8c8787e87 100644 --- a/src/ui/tool/modifier-tracker.h +++ b/src/ui/tool/modifier-tracker.h @@ -51,4 +51,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index 2025a12d7..82446b7b4 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -220,11 +220,29 @@ void MultiPathManipulator::invertSelectionInSubpaths() void MultiPathManipulator::setNodeType(NodeType type) { if (_selection.empty()) return; + + // When all selected nodes are already cusp, retract their handles + bool retract_handles = (type == NODE_CUSP); + for (ControlPointSelection::iterator i = _selection.begin(); i != _selection.end(); ++i) { Node *node = dynamic_cast<Node*>(*i); - if (node) node->setType(type); + if (node) { + retract_handles &= (node->type() == NODE_CUSP); + node->setType(type); + } + } + + if (retract_handles) { + for (ControlPointSelection::iterator i = _selection.begin(); i != _selection.end(); ++i) { + Node *node = dynamic_cast<Node*>(*i); + if (node) { + node->front()->retract(); + node->back()->retract(); + } + } } - _done(_("Change node type")); + + _done(retract_handles ? _("Retract handles") : _("Change node type")); } void MultiPathManipulator::setSegmentType(SegmentType type) @@ -244,6 +262,12 @@ void MultiPathManipulator::insertNodes() _done(_("Add nodes")); } +void MultiPathManipulator::duplicateNodes() +{ + invokeForAll(&PathManipulator::duplicateNodes); + _done(_("Duplicate nodes")); +} + void MultiPathManipulator::joinNodes() { invokeForAll(&PathManipulator::hideDragPoint); @@ -513,6 +537,12 @@ bool MultiPathManipulator::event(GdkEvent *event) return true; } break; + case GDK_d: + case GDK_D: + if (held_only_shift(event->key)) { + duplicateNodes(); + return true; + } case GDK_j: case GDK_J: if (held_only_shift(event->key)) { @@ -591,6 +621,20 @@ bool MultiPathManipulator::event(GdkEvent *event) return true; } break; + case GDK_l: + case GDK_L: + if (held_only_shift(event->key)) { + // Shift+L - make segments linear + setSegmentType(SEGMENT_STRAIGHT); + return true; + } + case GDK_u: + case GDK_U: + if (held_only_shift(event->key)) { + // Shift+L - make segments curves + setSegmentType(SEGMENT_CUBIC_BEZIER); + return true; + } default: break; } @@ -714,4 +758,4 @@ guint32 MultiPathManipulator::_getOutlineColor(ShapeRole role) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/multi-path-manipulator.h b/src/ui/tool/multi-path-manipulator.h index 181ae6d1d..ddb74c1bc 100644 --- a/src/ui/tool/multi-path-manipulator.h +++ b/src/ui/tool/multi-path-manipulator.h @@ -53,6 +53,7 @@ public: void setSegmentType(SegmentType t); void insertNodes(); + void duplicateNodes(); void joinNodes(); void breakNodes(); void deleteNodes(bool keep_shape = true); @@ -135,4 +136,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/node-tool.cpp b/src/ui/tool/node-tool.cpp index 450ca96f0..8008d79eb 100644 --- a/src/ui/tool/node-tool.cpp +++ b/src/ui/tool/node-tool.cpp @@ -25,6 +25,7 @@ #include "sp-mask.h" #include "sp-object-group.h" #include "sp-path.h" +#include "sp-text.h" #include "ui/tool/node-tool.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/curve-drag-point.h" @@ -164,6 +165,7 @@ void ink_node_tool_init(InkNodeTool *nt) new (&nt->_multipath) MultiPathPtr(); new (&nt->_selector) SelectorPtr(); new (&nt->_path_data) PathSharedDataPtr(); + new (&nt->_shape_editors) ShapeEditors(); } void ink_node_tool_dispose(GObject *object) @@ -178,6 +180,7 @@ void ink_node_tool_dispose(GObject *object) nt->_multipath.~MultiPathPtr(); nt->_selected_nodes.~CSelPtr(); nt->_selector.~SelectorPtr(); + nt->_shape_editors.~ShapeEditors(); Inkscape::UI::PathSharedData &data = *nt->_path_data; destroy_group(data.node_data.node_group); @@ -195,10 +198,6 @@ void ink_node_tool_dispose(GObject *object) if (nt->_node_message_context) { delete nt->_node_message_context; } - if (nt->shape_editor) { - nt->shape_editor->unset_item(SH_KNOTHOLDER); - delete nt->shape_editor; - } G_OBJECT_CLASS(g_type_class_peek(g_type_parent(INK_TYPE_NODE_TOOL)))->dispose(object); } @@ -281,9 +280,6 @@ void ink_node_tool_setup(SPEventContext *ec) nt->flash_tempitem = NULL; nt->flashed_item = NULL; nt->_last_over = NULL; - // TODO long term, fold ShapeEditor into MultiPathManipulator and rename MPM - // to something better - nt->shape_editor = new ShapeEditor(nt->desktop); // read prefs before adding items to selection to prevent momentarily showing the outline sp_event_context_read(nt, "show_handles"); @@ -403,22 +399,30 @@ void ink_node_tool_selection_changed(InkNodeTool *nt, Inkscape::Selection *sel) } } - // ugly hack: set the first editable non-path item for knotholder - // maybe use multiple ShapeEditors for now, to allow editing many shapes at once? - bool something_set = false; + // use multiple ShapeEditors for now, to allow editing many shapes at once + // needs to be rethought + for (ShapeEditors::iterator i = nt->_shape_editors.begin(); + i != nt->_shape_editors.end(); ) + { + ShapeRecord s; + s.item = i->first; + if (shapes.find(s) == shapes.end()) { + nt->_shape_editors.erase(i++); + } else { + ++i; + } + } + for (std::set<ShapeRecord>::iterator i = shapes.begin(); i != shapes.end(); ++i) { ShapeRecord const &r = *i; - if (SP_IS_SHAPE(r.item) || - (SP_IS_PATH(r.item) && r.item->repr->attribute("inkscape:original-d") != NULL)) + if ((SP_IS_SHAPE(r.item) || SP_IS_TEXT(r.item)) && + nt->_shape_editors.find(r.item) == nt->_shape_editors.end()) { - nt->shape_editor->set_item(r.item, SH_KNOTHOLDER); - something_set = true; - break; + ShapeEditor *si = new ShapeEditor(nt->desktop); + si->set_item(r.item, SH_KNOTHOLDER); + nt->_shape_editors.insert(const_cast<SPItem*&>(r.item), si); } } - if (!something_set) { - nt->shape_editor->unset_item(SH_KNOTHOLDER); - } nt->_multipath->setItems(shapes); ink_node_tool_update_tip(nt, NULL); @@ -615,8 +619,14 @@ void ink_node_tool_select_point(InkNodeTool *nt, Geom::Point const &/*sel*/, Gdk if (item_clicked == NULL) { // nothing under cursor // if no Shift, deselect - if (!(event->state & GDK_SHIFT_MASK)) { - selection->clear(); + // if there are nodes selected, the first click should deselect the nodes + // and the second should deselect the items + if (!state_held_shift(event->state)) { + if (nt->_selected_nodes->empty()) { + selection->clear(); + } else { + nt->_selected_nodes->clear(); + } } } else { if (held_shift(*event)) { @@ -658,4 +668,4 @@ void ink_node_tool_mouseover_changed(InkNodeTool *nt, Inkscape::UI::ControlPoint fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/node-tool.h b/src/ui/tool/node-tool.h index 641d064c1..4d38e69e2 100644 --- a/src/ui/tool/node-tool.h +++ b/src/ui/tool/node-tool.h @@ -12,6 +12,7 @@ #define SEEN_UI_TOOL_NODE_TOOL_H #include <memory> +#include <boost/ptr_container/ptr_map.hpp> #include <glib.h> #include <sigc++/sigc++.h> #include "event-context.h" @@ -41,6 +42,7 @@ typedef std::auto_ptr<Inkscape::UI::MultiPathManipulator> MultiPathPtr; typedef std::auto_ptr<Inkscape::UI::ControlPointSelection> CSelPtr; typedef std::auto_ptr<Inkscape::UI::Selector> SelectorPtr; typedef std::auto_ptr<Inkscape::UI::PathSharedData> PathSharedDataPtr; +typedef boost::ptr_map<SPItem*, ShapeEditor> ShapeEditors; struct InkNodeTool : public SPEventContext { @@ -56,6 +58,7 @@ struct InkNodeTool : public SPEventContext PathSharedDataPtr _path_data; SPCanvasGroup *_transform_handle_group; SPItem *_last_over; + ShapeEditors _shape_editors; unsigned cursor_drag : 1; unsigned show_handles : 1; @@ -86,4 +89,4 @@ GType ink_node_tool_get_type (void); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/node-types.h b/src/ui/tool/node-types.h index 80eaf4fa7..e4921fa8d 100644 --- a/src/ui/tool/node-types.h +++ b/src/ui/tool/node-types.h @@ -45,4 +45,4 @@ enum SegmentType { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index a8582ccc5..12d04dd2b 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -274,8 +274,10 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) } else { sm.freeSnapReturnByRef(new_pos, SNAPSOURCE_NODE_HANDLE); } + sm.unSetup(); } + // with Shift, if the node is cusp, rotate the other handle as well if (_parent->type() == NODE_CUSP && !_drag_out) { if (held_shift(*event)) { @@ -566,11 +568,7 @@ void Node::setType(NodeType type, bool update_handles) if (update_handles) { switch (type) { case NODE_CUSP: - // if the existing type is also NODE_CUSP, retract handles - if (_type == NODE_CUSP) { - _front.retract(); - _back.retract(); - } + // nothing to do break; case NODE_AUTO: // auto handles make no sense for endnodes @@ -578,13 +576,15 @@ void Node::setType(NodeType type, bool update_handles) _updateAutoHandles(); break; case NODE_SMOOTH: { + // ignore attempts to make smooth endnodes. + if (isEndNode()) return; // rotate handles to be colinear // for degenerate nodes set positions like auto handles bool prev_line = _is_line_segment(_prev(), this); bool next_line = _is_line_segment(this, _next()); if (_type == NODE_SMOOTH) { - // for a node that is already smooth and has a degenerate handle, - // drag out the second handle to 1/3 the length of the linear segment + // For a node that is already smooth and has a degenerate handle, + // drag out the second handle without changing the direction of the first one. if (_front.isDegenerate()) { double dist = Geom::distance(_next()->position(), position()); _front.setRelativePos(Geom::unit_vector(-_back.relativePos()) * dist / 3); @@ -728,8 +728,7 @@ NodeType Node::parse_nodetype(char x) /** Customized event handler to catch scroll events needed for selection grow/shrink. */ bool Node::_eventHandler(GdkEvent *event) { - static NodeList::iterator origin; - static int dir; + int dir = 0; switch (event->type) { @@ -740,14 +739,34 @@ bool Node::_eventHandler(GdkEvent *event) dir = -1; } else break; if (held_control(event->scroll)) { - _selection.spatialGrow(this, dir); + _linearGrow(dir); } else { + _selection.spatialGrow(this, dir); + } + return true; + case GDK_KEY_PRESS: + switch (shortcut_key(event->key)) + { + case GDK_Page_Up: + dir = 1; + break; + case GDK_Page_Down: + dir = -1; + break; + default: goto bail_out; + } + + if (held_control(event->key)) { _linearGrow(dir); + } else { + _selection.spatialGrow(this, dir); } return true; default: break; } + + bail_out: return ControlPoint::_eventHandler(event); } @@ -942,8 +961,16 @@ void Node::dragged(Geom::Point &new_pos, GdkEventMotion *event) { // For a note on how snapping is implemented in Inkscape, see snap.h. SnapManager &sm = _desktop->namedview->snap_manager; - bool snap = sm.someSnapperMightSnap(); + // even if we won't really snap, we might still call the one of the + // constrainedSnap() methods to enforce the constraints, so we need + // to setup the snapmanager anyway; this is also required for someSnapperMightSnap() + sm.setup(_desktop); + + // do not snap when Shift is pressed + bool snap = !held_shift(*event) && sm.someSnapperMightSnap(); + Inkscape::SnappedPoint sp; + std::vector<Inkscape::SnapCandidatePoint> unselected; if (snap) { /* setup * TODO We are doing this every time a snap happens. It should once be done only once @@ -953,7 +980,6 @@ void Node::dragged(Geom::Point &new_pos, GdkEventMotion *event) * TODO Snapping to unselected segments of selected paths doesn't work yet. */ // Build the list of unselected nodes. - std::vector<Inkscape::SnapCandidatePoint> unselected; typedef ControlPointSelection::Set Set; Set &nodes = _selection.allPoints(); for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { @@ -963,6 +989,7 @@ void Node::dragged(Geom::Point &new_pos, GdkEventMotion *event) unselected.push_back(p); } } + sm.unSetup(); sm.setupIgnoreSelection(_desktop, true, &unselected); } @@ -1014,12 +1041,12 @@ void Node::dragged(Geom::Point &new_pos, GdkEventMotion *event) constraints.push_back(Inkscape::Snapper::SnapConstraint(origin, *bperp_point)); } - sp = sm.multipleConstrainedSnaps(Inkscape::SnapCandidatePoint(new_pos, _snapSourceType()), constraints); + sp = sm.multipleConstrainedSnaps(Inkscape::SnapCandidatePoint(new_pos, _snapSourceType()), constraints, held_shift(*event)); } else { // with Ctrl, constrain to axes constraints.push_back(Inkscape::Snapper::SnapConstraint(origin, Geom::Point(1, 0))); constraints.push_back(Inkscape::Snapper::SnapConstraint(origin, Geom::Point(0, 1))); - sp = sm.multipleConstrainedSnaps(Inkscape::SnapCandidatePoint(new_pos, _snapSourceType()), constraints); + sp = sm.multipleConstrainedSnaps(Inkscape::SnapCandidatePoint(new_pos, _snapSourceType()), constraints, held_shift(*event)); } new_pos = sp.getPoint(); } else if (snap) { @@ -1027,6 +1054,8 @@ void Node::dragged(Geom::Point &new_pos, GdkEventMotion *event) new_pos = sp.getPoint(); } + sm.unSetup(); + SelectableControlPoint::dragged(new_pos, event); } @@ -1374,4 +1403,4 @@ NodeList &NodeList::get(iterator const &i) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/node.h b/src/ui/tool/node.h index af4cd7e3a..0194f5053 100644 --- a/src/ui/tool/node.h +++ b/src/ui/tool/node.h @@ -408,4 +408,4 @@ NodeIterator<N> &NodeIterator<N>::retreat() { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 66f72f379..956f48a7d 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -319,6 +319,39 @@ void PathManipulator::insertNodes() } } +/** Insert new nodes exactly at the positions of selected nodes while preserving shape. + * This is equivalent to breaking, except that it doesn't split into subpaths. */ +void PathManipulator::duplicateNodes() +{ + if (_num_selected == 0) return; + + for (SubpathList::iterator i = _subpaths.begin(); i != _subpaths.end(); ++i) { + for (NodeList::iterator j = (*i)->begin(); j != (*i)->end(); ++j) { + if (j->selected()) { + NodeList::iterator k = j.next(); + Node *n = new Node(_multi_path_manipulator._path_data.node_data, *j); + + // Move the new node to the bottom of the Z-order. This way you can drag all + // nodes that were selected before this operation without deselecting + // everything because there is a new node above. + n->sink(); + + n->front()->setPosition(*j->front()); + j->front()->retract(); + j->setType(NODE_CUSP, false); + (*i)->insert(k, n); + + // We need to manually call the selection change callback to refresh + // the handle display correctly. + // This call changes num_selected, but we call this once for a selected node + // and once for an unselected node, so in the end the number stays correct. + _selectionChanged(j.ptr(), true); + _selectionChanged(n, false); + } + } + } +} + /** Replace contiguous selections of nodes in each subpath with one node. */ void PathManipulator::weldNodes(NodeList::iterator preserve_pos) { @@ -1292,17 +1325,11 @@ bool PathManipulator::_nodeClicked(Node *n, GdkEventButton *event) return true; } else if (held_control(*event)) { // Ctrl+click: cycle between node types - if (n->isEndNode()) { - if (n->type() == NODE_CUSP) { - n->setType(NODE_SMOOTH); - } else { - n->setType(NODE_CUSP); - } - } else { + if (!n->isEndNode()) { n->setType(static_cast<NodeType>((n->type() + 1) % NODE_LAST_REAL_TYPE)); + update(); + _commit(_("Cycle node type")); } - update(); - _commit(_("Cycle node type")); return true; } return false; @@ -1414,7 +1441,10 @@ void PathManipulator::_updateDragPoint(Geom::Point const &evp) NodeList::iterator first = (*spi)->before(pvp->t, &fracpart); double stroke_tolerance = _getStrokeTolerance(); - if (Geom::distance(evp, nearest_point) < stroke_tolerance) { + if (first && first.next() && + fracpart != 0.0 && + Geom::distance(evp, nearest_point) < stroke_tolerance) + { _dragpoint->setVisible(true); _dragpoint->setPosition(_desktop->w2d(nearest_point)); _dragpoint->setSize(2 * stroke_tolerance); @@ -1459,4 +1489,4 @@ double PathManipulator::_getStrokeTolerance() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/path-manipulator.h b/src/ui/tool/path-manipulator.h index a8f1c957e..87b88fc77 100644 --- a/src/ui/tool/path-manipulator.h +++ b/src/ui/tool/path-manipulator.h @@ -69,6 +69,7 @@ public: void invertSelectionInSubpaths(); void insertNodes(); + void duplicateNodes(); void weldNodes(NodeList::iterator preserve_pos = NodeList::iterator()); void weldSegments(); void breakNodes(); @@ -162,4 +163,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/selectable-control-point.cpp b/src/ui/tool/selectable-control-point.cpp index 76028dd82..e9a8bcbd6 100644 --- a/src/ui/tool/selectable-control-point.cpp +++ b/src/ui/tool/selectable-control-point.cpp @@ -136,4 +136,4 @@ void SelectableControlPoint::_setState(State state) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/selectable-control-point.h b/src/ui/tool/selectable-control-point.h index 2fde16ea9..1b8bd46cc 100644 --- a/src/ui/tool/selectable-control-point.h +++ b/src/ui/tool/selectable-control-point.h @@ -69,4 +69,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/selector.cpp b/src/ui/tool/selector.cpp index d766d5be3..fdd0fc51f 100644 --- a/src/ui/tool/selector.cpp +++ b/src/ui/tool/selector.cpp @@ -130,4 +130,4 @@ bool Selector::event(GdkEvent *event) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/selector.h b/src/ui/tool/selector.h index f7c00ea71..e61668d9e 100644 --- a/src/ui/tool/selector.h +++ b/src/ui/tool/selector.h @@ -56,4 +56,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/shape-record.h b/src/ui/tool/shape-record.h index edfad1401..893231404 100644 --- a/src/ui/tool/shape-record.h +++ b/src/ui/tool/shape-record.h @@ -58,4 +58,4 @@ struct ShapeRecord : fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/transform-handle-set.cpp b/src/ui/tool/transform-handle-set.cpp index 6b8fb4c11..ef93a3767 100644 --- a/src/ui/tool/transform-handle-set.cpp +++ b/src/ui/tool/transform-handle-set.cpp @@ -654,4 +654,4 @@ void TransformHandleSet::_updateVisibility(bool v) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/tool/transform-handle-set.h b/src/ui/tool/transform-handle-set.h index 48ad3af51..2a4df8751 100644 --- a/src/ui/tool/transform-handle-set.h +++ b/src/ui/tool/transform-handle-set.h @@ -93,4 +93,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/view/Makefile_insert b/src/ui/view/Makefile_insert index 812ce21ca..b3ab598d4 100644 --- a/src/ui/view/Makefile_insert +++ b/src/ui/view/Makefile_insert @@ -1,10 +1,6 @@ ## Makefile.am fragment sourced by src/Makefile.am. ink_common_sources += \ - ui/view/edit.h \ - ui/view/edit.cpp \ - ui/view/edit-widget.h \ - ui/view/edit-widget.cpp \ ui/view/edit-widget-interface.h \ ui/view/view.h \ ui/view/view.cpp \ diff --git a/src/ui/view/edit-widget-interface.h b/src/ui/view/edit-widget-interface.h index 7456f4adf..919b570dd 100644 --- a/src/ui/view/edit-widget-interface.h +++ b/src/ui/view/edit-widget-interface.h @@ -158,4 +158,4 @@ struct EditWidgetInterface fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/view/edit-widget.cpp b/src/ui/view/edit-widget.cpp deleted file mode 100644 index 770a9bf87..000000000 --- a/src/ui/view/edit-widget.cpp +++ /dev/null @@ -1,1698 +0,0 @@ -/** - * \brief This class implements the functionality of the window layout, menus, - * and signals. - * - * This is a reimplementation into C++/Gtkmm of Sodipodi's SPDesktopWidget class. - * Both SPDesktopWidget and EditWidget adhere to the EditWidgetInterface, so - * they both can serve as widget for the same SPDesktop/Edit class. - * - * Ideally, this class should only contain the handling of the Window (i.e., - * content construction and window signals) and implement its - * EditWidgetInterface. - * - * Authors: - * Ralf Stephan <ralf@ark.in-berlin.de> - * Bryce W. Harrington <bryce@bryceharrington.org> - * Derek P. Moore <derekm@hackunix.org> - * Lauris Kaplinski <lauris@kaplinski.com> - * Frank Felfe <innerspace@iname.com> - * John Bintz <jcoswell@coswellproductions.org> - * Johan Engelen <j.b.c.engelen@ewi.utwente.nl> - * - * Copyright (C) 2007 Johan Engelen - * Copyright (C) 2006 John Bintz - * Copyright (C) 1999-2005 Authors - * Copyright (C) 2000-2001 Ximian, Inc. - * - * Released under GNU GPL. Read the file 'COPYING' for more information. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <gtk/gtkwindow.h> -#include <gtk/gtkversion.h> -#include <gtk/gtklabel.h> -#include <gtkmm/radioaction.h> -#include <gtkmm/menubar.h> -#include <gtkmm/messagedialog.h> -#include <gtkmm/stock.h> -#include <gtkmm/accelmap.h> -#include <gtkmm/separator.h> -#include <gtkmm/base.h> - -#include <sigc++/functors/mem_fun.h> - -#include "macros.h" -#include "path-prefix.h" -#include "preferences.h" -#include "file.h" -#include "application/editor.h" -#include "edit-widget.h" - -#include "display/sodipodi-ctrlrect.h" -#include "helper/units.h" -#include "shortcuts.h" -#include "widgets/spw-utilities.h" -#include "event-context.h" -#include "document.h" -#include "sp-namedview.h" -#include "sp-item.h" -#include "interface.h" -#include "extension/db.h" - -#include "ui/dialog/dialog-manager.h" - -using namespace Inkscape::UI; -using namespace Inkscape::UI::Widget; - -namespace Inkscape { -namespace UI { -namespace View { - -EditWidget::EditWidget (SPDocument *doc) - : _main_window_table(4), - _viewport_table(3,3), - _act_grp(Gtk::ActionGroup::create()), - _ui_mgr(Gtk::UIManager::create()), - _update_s_f(false), - _update_a_f(false), - _interaction_disabled_counter(0) -{ - g_warning("Creating new EditWidget"); - - _desktop = 0; - initActions(); - initAccelMap(); - initUIManager(); - initLayout(); - initEdit (doc); - g_warning("Done creating new EditWidget"); -} - -EditWidget::~EditWidget() -{ - destroyEdit(); -} - -void -EditWidget::initActions() -{ - initMenuActions(); - initToolbarActions(); -} - -void -EditWidget::initUIManager() -{ - _ui_mgr->insert_action_group(_act_grp); - add_accel_group(_ui_mgr->get_accel_group()); - - gchar *filename_utf8 = g_build_filename(INKSCAPE_UIDIR, "menus-bars.xml", NULL); - if (_ui_mgr->add_ui_from_file(filename_utf8) == 0) { - g_warning("Error merging ui from file '%s'", filename_utf8); - // fixme-charset: What charset should we pass to g_warning? - } - g_free(filename_utf8); -} - -void -EditWidget::initLayout() -{ - set_title("New document 1 - Inkscape"); - set_resizable(); - set_default_size(640, 480); - - // top level window into which all other portions of the UI get inserted - add(_main_window_table); - // attach box for horizontal toolbars - _main_window_table.attach(_toolbars_vbox, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK); - // attach sub-window for viewport and vertical toolbars - _main_window_table.attach(_sub_window_hbox, 0, 1, 2, 3); - // viewport table with 3 rows by 3 columns - _sub_window_hbox.pack_end(_viewport_table); - - // Menus and Bars - initMenuBar(); - initCommandsBar(); - initToolControlsBar(); - initUriBar(); - initToolsBar(); - - // Canvas Viewport - initLeftRuler(); - initTopRuler(); - initStickyZoom(); - initBottomScrollbar(); - initRightScrollbar(); - _viewport_table.attach(_svg_canvas.widget(), 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); - _svg_canvas.widget().show_all(); - - // The statusbar comes last and appears at the bottom of _main_window_table - initStatusbar(); - - signal_size_allocate().connect (sigc::mem_fun (*this, &EditWidget::onWindowSizeAllocate), false); - signal_realize().connect (sigc::mem_fun (*this, &EditWidget::onWindowRealize)); - show_all_children(); -} - -void -EditWidget::onMenuItem() -{ - g_warning("onMenuItem called"); -} - -void -EditWidget::onActionFileNew() -{ -// g_warning("onActionFileNew called"); - sp_file_new_default(); -} - -void -EditWidget::onActionFileOpen() -{ -// g_warning("onActionFileOpen called"); - sp_file_open_dialog (*this, NULL, NULL); -} - -void -EditWidget::onActionFileQuit() -{ - g_warning("onActionFileQuit"); - sp_ui_close_all(); -} - -void -EditWidget::onActionFilePrint() -{ - g_warning("onActionFilePrint"); -} - -void -EditWidget::onToolbarItem() -{ - g_warning("onToolbarItem called"); -} - -void -EditWidget::onSelectTool() -{ - _tool_ctrl->remove(); - _tool_ctrl->add(*_select_ctrl); -} - -void -EditWidget::onNodeTool() -{ - _tool_ctrl->remove(); - _tool_ctrl->add(*_node_ctrl); -} - -void -EditWidget::onDialogInkscapePreferences() -{ - _dlg_mgr.showDialog("InkscapePreferences"); -} - -void -EditWidget::onDialogAbout() -{ -} - -void -EditWidget::onDialogAlignAndDistribute() -{ - _dlg_mgr.showDialog("AlignAndDistribute"); -} - -void -EditWidget::onDialogDocumentProperties() -{ -// manage (Inkscape::UI::Dialog::DocumentPreferences::create()); - _dlg_mgr.showDialog("DocumentPreferences"); -} - -void -EditWidget::onDialogExport() -{ - _dlg_mgr.showDialog("Export"); -} - -void -EditWidget::onDialogExtensionEditor() -{ - _dlg_mgr.showDialog("ExtensionEditor"); -} - -void -EditWidget::onDialogFillAndStroke() -{ - _dlg_mgr.showDialog("FillAndStroke"); -} - -void -EditWidget::onDialogFind() -{ - _dlg_mgr.showDialog("Find"); -} - -void -EditWidget::onDialogLayerEditor() -{ - _dlg_mgr.showDialog("LayerEditor"); -} - -void -EditWidget::onDialogMessages() -{ - _dlg_mgr.showDialog("Messages"); -} - -void -EditWidget::onDialogObjectProperties() -{ - _dlg_mgr.showDialog("ObjectProperties"); -} - -void -EditWidget::onDialogTextProperties() -{ - _dlg_mgr.showDialog("TextProperties"); -} - -void -EditWidget::onDialogTrace() -{ -} - -void -EditWidget::onDialogTransformation() -{ - _dlg_mgr.showDialog("Transformation"); -} - -void -EditWidget::onDialogXmlEditor() -{ - _dlg_mgr.showDialog("XmlEditor"); -} - -void -EditWidget::onUriChanged() -{ - g_message("onUriChanged called"); - -} - -// FIXME: strings are replaced by placeholders, NOT to be translated until the code is enabled -// See http://sourceforge.net/mailarchive/message.php?msg_id=11746016 for details - -void -EditWidget::initMenuActions() -{ -// This has no chance of working right now. -// Has to be converted to Gtk::Action::create_with_icon_name. - - _act_grp->add(Gtk::Action::create("MenuFile", "File")); - _act_grp->add(Gtk::Action::create("MenuEdit", "Edit")); - _act_grp->add(Gtk::Action::create("MenuView", "View")); - _act_grp->add(Gtk::Action::create("MenuLayer", "Layer")); - _act_grp->add(Gtk::Action::create("MenuObject", "Object")); - _act_grp->add(Gtk::Action::create("MenuPath", "Path")); - _act_grp->add(Gtk::Action::create("MenuText", "Text")); - _act_grp->add(Gtk::Action::create("MenuHelp", "Help")); - - // File menu - _act_grp->add(Gtk::Action::create("New", - Gtk::Stock::NEW, Glib::ustring(), - _("PLACEHOLDER, do not translate")), - sigc::mem_fun(*this, &EditWidget::onActionFileNew)); - - _act_grp->add(Gtk::Action::create("Open", - Gtk::Stock::OPEN, Glib::ustring(), - _("PLACEHOLDER, do not translate")), - sigc::mem_fun(*this, &EditWidget::onActionFileOpen)); -/* - _act_grp->add(Gtk::Action::create("OpenRecent", - Stock::OPEN_RECENT));*/ - - _act_grp->add(Gtk::Action::create("Revert", - Gtk::Stock::REVERT_TO_SAVED, Glib::ustring(), - _("PLACEHOLDER, do not translate")), - sigc::mem_fun(*this, &EditWidget::onActionFileOpen)); - - _act_grp->add(Gtk::Action::create("Save", - Gtk::Stock::SAVE, Glib::ustring(), - _("PLACEHOLDER, do not translate")), - sigc::mem_fun(*this, &EditWidget::onActionFileOpen)); - - _act_grp->add(Gtk::Action::create("SaveAs", - Gtk::Stock::SAVE_AS, Glib::ustring(), - _("PLACEHOLDER, do not translate")), - sigc::mem_fun(*this, &EditWidget::onActionFileOpen)); -/* - _act_grp->add(Gtk::Action::create("Import", - Stock::IMPORT, Glib::ustring(), - _("PLACEHOLDER, do not translate")), - sigc::mem_fun(*this, &EditWidget::onActionFileOpen)); - - _act_grp->add(Gtk::Action::create("Export", - Stock::EXPORT, Glib::ustring(), - _("PLACEHOLDER, do not translate")), - sigc::mem_fun(*this, &EditWidget::onDialogExport));*/ - - _act_grp->add(Gtk::Action::create("Print", - Gtk::Stock::PRINT, Glib::ustring(), - _("PLACEHOLDER, do not translate")), - sigc::mem_fun(*this, &EditWidget::onActionFilePrint)); - - _act_grp->add(Gtk::Action::create("PrintPreview", - Gtk::Stock::PRINT_PREVIEW), - sigc::mem_fun(*this, &EditWidget::onActionFileOpen)); -/* - _act_grp->add(Gtk::Action::create("VacuumDefs", - Stock::VACUUM_DEFS), - sigc::mem_fun(*this, &EditWidget::onActionFileOpen));*/ - - _act_grp->add(Gtk::Action::create("DocumentProperties", - Gtk::Stock::PROPERTIES, Glib::ustring(), - _("PLACEHOLDER, do not translate")), - sigc::mem_fun(*this, &EditWidget::onDialogDocumentProperties)); - - _act_grp->add(Gtk::Action::create("InkscapePreferences", - Gtk::Stock::PREFERENCES, Glib::ustring(), - _("PLACEHOLDER, do not translate")), - sigc::mem_fun(*this, &EditWidget::onDialogInkscapePreferences)); - - _act_grp->add(Gtk::Action::create("Close", - Gtk::Stock::CLOSE), - sigc::mem_fun(*this, &EditWidget::onActionFileOpen)); - - _act_grp->add(Gtk::Action::create("Quit", - Gtk::Stock::QUIT), - sigc::mem_fun(*this, &EditWidget::onActionFileQuit)); - - // EditWidget menu - _act_grp->add(Gtk::Action::create("Undo", - Gtk::Stock::UNDO, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("Redo", - Gtk::Stock::REDO, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); -/* - _act_grp->add(Gtk::Action::create("UndoHistory", - Stock::UNDO_HISTORY, Glib::ustring(), - _("PLACEHOLDER, do not translate")));*/ - - _act_grp->add(Gtk::Action::create("Cut", - Gtk::Stock::CUT, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("Copy", - Gtk::Stock::COPY, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("Paste", - Gtk::Stock::PASTE, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); -/* - _act_grp->add(Gtk::Action::create("PasteInPlace", - Stock::PASTE_IN_PLACE)); - - _act_grp->add(Gtk::Action::create("PasteStyle", - Stock::PASTE_STYLE));*/ - - _act_grp->add(Gtk::Action::create("Find", - Gtk::Stock::FIND), - sigc::mem_fun(*this, &EditWidget::onDialogFind)); -/* - _act_grp->add(Gtk::Action::create("Duplicate", - Stock::DUPLICATE, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("Clone", - Stock::CLONE, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("CloneUnlink", - Stock::CLONE_UNLINK, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("CloneSelectOrig", - Stock::CLONE_SELECT_ORIG)); - - _act_grp->add(Gtk::Action::create("MakeBitmap", - Stock::MAKE_BITMAP)); - - _act_grp->add(Gtk::Action::create("Tile", - Stock::TILE)); - - _act_grp->add(Gtk::Action::create("Untile", - Stock::UNTILE)); - - _act_grp->add(Gtk::Action::create("Delete", - Gtk::Stock::DELETE)); - - _act_grp->add(Gtk::Action::create("SelectAll", - Stock::SELECT_ALL)); - - _act_grp->add(Gtk::Action::create("SelectAllInAllLayers", - Stock::SELECT_ALL_IN_ALL_LAYERS)); - - _act_grp->add(Gtk::Action::create("SelectInvert", - Stock::SELECT_INVERT)); - - _act_grp->add(Gtk::Action::create("SelectNone", - Stock::SELECT_NONE)); - - _act_grp->add(Gtk::Action::create("XmlEditor", - Stock::XML_EDITOR, Glib::ustring(), - _("PLACEHOLDER, do not translate")), - sigc::mem_fun(*this, &EditWidget::onDialogXmlEditor)); - - // View menu - _act_grp->add(Gtk::Action::create("Zoom", - Stock::ZOOM)); - - _act_grp->add(Gtk::Action::create("ZoomIn", - Stock::ZOOM_IN, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("ZoomOut", - Stock::ZOOM_OUT, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("Zoom100", - Stock::ZOOM_100, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("Zoom50", - Stock::ZOOM_50, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("Zoom200", - Stock::ZOOM_200, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("ZoomSelection", - Stock::ZOOM_SELECTION, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("ZoomDrawing", - Stock::ZOOM_DRAWING, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("ZoomPage", - Stock::ZOOM_PAGE, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("ZoomWidth", - Stock::ZOOM_WIDTH, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("ZoomPrev", - Stock::ZOOM_PREV, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("ZoomNext", - Stock::ZOOM_NEXT, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("ShowHide", - Stock::SHOW_HIDE)); - - _act_grp->add(Gtk::ToggleAction::create("ShowHideCommandsBar", - Stock::SHOW_HIDE_COMMANDS_BAR)); - - _act_grp->add(Gtk::ToggleAction::create("ShowHideToolControlsBar", - Stock::SHOW_HIDE_TOOL_CONTROLS_BAR)); - - _act_grp->add(Gtk::ToggleAction::create("ShowHideToolsBar", - Stock::SHOW_HIDE_TOOLS_BAR)); - - _act_grp->add(Gtk::ToggleAction::create("ShowHideRulers", - Stock::SHOW_HIDE_RULERS)); - - _act_grp->add(Gtk::ToggleAction::create("ShowHideScrollbars", - Stock::SHOW_HIDE_SCROLLBARS)); - - _act_grp->add(Gtk::ToggleAction::create("ShowHideStatusbar", - Stock::SHOW_HIDE_STATUSBAR)); - - _act_grp->add(Gtk::Action::create("ShowHideDialogs", - Stock::SHOW_HIDE_DIALOGS)); - - _act_grp->add(Gtk::Action::create("Grid", - Stock::GRID)); - - _act_grp->add(Gtk::Action::create("Guides", - Stock::GUIDES)); - - _act_grp->add(Gtk::Action::create("Fullscreen", - Stock::FULLSCREEN)); - - _act_grp->add(Gtk::Action::create("Messages", - Stock::MESSAGES), - sigc::mem_fun(*this, &EditWidget::onDialogMessages)); - - _act_grp->add(Gtk::Action::create("Scripts", - Stock::SCRIPTS)); - - _act_grp->add(Gtk::Action::create("WindowPrev", - Stock::WINDOW_PREV)); - - _act_grp->add(Gtk::Action::create("WindowNext", - Stock::WINDOW_NEXT)); - - _act_grp->add(Gtk::Action::create("WindowDuplicate", - Stock::WINDOW_DUPLICATE)); - - // Layer menu - _act_grp->add(Gtk::Action::create("LayerNew", - Stock::LAYER_NEW)); - - _act_grp->add(Gtk::Action::create("LayerRename", - Stock::LAYER_RENAME)); - - _act_grp->add(Gtk::Action::create("LayerDuplicate", - Stock::LAYER_DUPLICATE)); - - _act_grp->add(Gtk::Action::create("LayerAnchor", - Stock::LAYER_ANCHOR)); - - _act_grp->add(Gtk::Action::create("LayerMergeDown", - Stock::LAYER_MERGE_DOWN)); - - _act_grp->add(Gtk::Action::create("LayerDelete", - Stock::LAYER_DELETE)); - - _act_grp->add(Gtk::Action::create("LayerSelectNext", - Stock::LAYER_SELECT_NEXT)); - - _act_grp->add(Gtk::Action::create("LayerSelectPrev", - Stock::LAYER_SELECT_PREV)); - - _act_grp->add(Gtk::Action::create("LayerSelectTop", - Stock::LAYER_SELECT_TOP)); - - _act_grp->add(Gtk::Action::create("LayerSelectBottom", - Stock::LAYER_SELECT_BOTTOM)); - - _act_grp->add(Gtk::Action::create("LayerRaise", - Stock::LAYER_RAISE)); - - _act_grp->add(Gtk::Action::create("LayerLower", - Stock::LAYER_LOWER)); - - _act_grp->add(Gtk::Action::create("LayerToTop", - Stock::LAYER_TO_TOP)); - - _act_grp->add(Gtk::Action::create("LayerToBottom", - Stock::LAYER_TO_BOTTOM)); - - // Object menu - _act_grp->add(Gtk::Action::create("FillAndStroke", - Stock::FILL_STROKE, Glib::ustring(), - _("PLACEHOLDER, do not translate")), - sigc::mem_fun(*this, &EditWidget::onDialogFillAndStroke)); - - _act_grp->add(Gtk::Action::create("ObjectProperties", - Stock::OBJECT_PROPERTIES), - sigc::mem_fun(*this, &EditWidget::onDialogObjectProperties)); - - _act_grp->add(Gtk::Action::create("FilterEffects", - Stock::FILTER_EFFECTS)); - - _act_grp->add(Gtk::Action::create("Group", - Stock::GROUP, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("Ungroup", - Stock::UNGROUP, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("Raise", - Stock::RAISE, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("Lower", - Stock::LOWER, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("RaiseToTop", - Stock::RAISE_TO_TOP, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("LowerToBottom", - Stock::LOWER_TO_BOTTOM, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("MoveToNewLayer", - Stock::MOVE_TO_NEW_LAYER, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("MoveToNextLayer", - Stock::MOVE_TO_NEXT_LAYER, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("MoveToPrevLayer", - Stock::MOVE_TO_PREV_LAYER, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("MoveToTopLayer", - Stock::MOVE_TO_TOP_LAYER, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("MoveToBottomLayer", - Stock::MOVE_TO_BOTTOM_LAYER, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("Rotate90CW", - Stock::ROTATE_90_CW, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("Rotate90CCW", - Stock::ROTATE_90_CCW, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("FlipHoriz", - Stock::FLIP_HORIZ, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("FlipVert", - Stock::FLIP_VERT, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("Transformation", - Stock::TRANSFORMATION, Glib::ustring(), - _("PLACEHOLDER, do not translate")), - sigc::mem_fun(*this, &EditWidget::onDialogTransformation)); - - _act_grp->add(Gtk::Action::create("AlignAndDistribute", - Stock::ALIGN_DISTRIBUTE, Glib::ustring(), - _("PLACEHOLDER, do not translate")), - sigc::mem_fun(*this, &EditWidget::onDialogAlignAndDistribute)); - - // Path menu - _act_grp->add(Gtk::Action::create("ObjectToPath", - Stock::OBJECT_TO_PATH, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("StrokeToPath", - Stock::STROKE_TO_PATH, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("Trace", - Stock::TRACE), - sigc::mem_fun(*this, &EditWidget::onDialogTrace)); - - _act_grp->add(Gtk::Action::create("Union", - Stock::UNION)); - - _act_grp->add(Gtk::Action::create("Difference", - Stock::DIFFERENCE)); - - _act_grp->add(Gtk::Action::create("Intersection", - Stock::INTERSECTION)); - - _act_grp->add(Gtk::Action::create("Exclusion", - Stock::EXCLUSION)); - - _act_grp->add(Gtk::Action::create("Division", - Stock::DIVISION)); - - _act_grp->add(Gtk::Action::create("CutPath", - Stock::CUT_PATH)); - - _act_grp->add(Gtk::Action::create("Combine", - Stock::COMBINE)); - - _act_grp->add(Gtk::Action::create("BreakApart", - Stock::BREAK_APART)); - - _act_grp->add(Gtk::Action::create("Inset", - Stock::INSET)); - - _act_grp->add(Gtk::Action::create("Outset", - Stock::OUTSET)); - - _act_grp->add(Gtk::Action::create("OffsetDynamic", - Stock::OFFSET_DYNAMIC)); - - _act_grp->add(Gtk::Action::create("OffsetLinked", - Stock::OFFSET_LINKED)); - - _act_grp->add(Gtk::Action::create("Simplify", - Stock::SIMPLIFY)); - - _act_grp->add(Gtk::Action::create("Reverse", - Stock::REVERSE));*/ - - _act_grp->add(Gtk::Action::create("Cleanup", - Gtk::Stock::CLEAR, - _("PLACEHOLDER, do not translate"))); - - // Text menu - _act_grp->add(Gtk::Action::create("TextProperties", - Gtk::Stock::SELECT_FONT, Glib::ustring(), - _("PLACEHOLDER, do not translate")), - sigc::mem_fun(*this, &EditWidget::onDialogTextProperties)); -/* - _act_grp->add(Gtk::Action::create("PutOnPath", - Stock::PUT_ON_PATH)); - - _act_grp->add(Gtk::Action::create("RemoveFromPath", - Stock::REMOVE_FROM_PATH)); - - _act_grp->add(Gtk::Action::create("RemoveManualKerns", - Stock::REMOVE_MANUAL_KERNS));*/ - - // Whiteboard menu -#ifdef WITH_INKBOARD -#endif - - // About menu -/* - _act_grp->add(Gtk::Action::create("KeysAndMouse", - Stock::KEYS_MOUSE)); - - _act_grp->add(Gtk::Action::create("Tutorials", - Stock::TUTORIALS)); - - _act_grp->add(Gtk::Action::create("About", - Stock::ABOUT), - sigc::mem_fun(*this, &EditWidget::onDialogAbout));*/ -} - -void -EditWidget::initToolbarActions() -{ - // Tools bar - // This has zero chance to work, and has to be converted to create_with_icon_name - Gtk::RadioAction::Group tools; -/* - _act_grp->add(Gtk::RadioAction::create(tools, "ToolSelect", - Stock::TOOL_SELECT, Glib::ustring(), - _("PLACEHOLDER, do not translate")), - sigc::mem_fun(*this, &EditWidget::onSelectTool)); - - _act_grp->add(Gtk::RadioAction::create(tools, "ToolNode", - Stock::TOOL_NODE, Glib::ustring(), - _("PLACEHOLDER, do not translate")), - sigc::mem_fun(*this, &EditWidget::onNodeTool)); - - _act_grp->add(Gtk::RadioAction::create(tools, "ToolZoom", - Stock::TOOL_ZOOM, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::RadioAction::create(tools, "ToolRect", - Stock::TOOL_RECT, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::RadioAction::create(tools, "ToolArc", - Stock::TOOL_ARC, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::RadioAction::create(tools, "ToolStar", - Stock::TOOL_STAR, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::RadioAction::create(tools, "ToolSpiral", - Stock::TOOL_SPIRAL, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::RadioAction::create(tools, "ToolFreehand", - Stock::TOOL_FREEHAND, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::RadioAction::create(tools, "ToolPen", - Stock::TOOL_PEN, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::RadioAction::create(tools, "ToolDynaDraw", - Stock::TOOL_DYNADRAW, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::RadioAction::create(tools, "ToolText", - Stock::TOOL_TEXT, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::RadioAction::create(tools, "ToolDropper", - Stock::TOOL_DROPPER, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - // Select Controls bar - _act_grp->add(Gtk::ToggleAction::create("TransformStroke", - Stock::TRANSFORM_STROKE, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::ToggleAction::create("TransformCorners", - Stock::TRANSFORM_CORNERS, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::ToggleAction::create("TransformGradient", - Stock::TRANSFORM_GRADIENT, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::ToggleAction::create("TransformPattern", - Stock::TRANSFORM_PATTERN, Glib::ustring(), - _("PLACEHOLDER, do not translate")));*/ - - // Node Controls bar - _act_grp->add(Gtk::Action::create("NodeInsert", - Gtk::Stock::ADD, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("NodeDelete", - Gtk::Stock::REMOVE, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); -/* - _act_grp->add(Gtk::Action::create("NodeJoin", - Stock::NODE_JOIN, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("NodeJoinSegment", - Stock::NODE_JOIN_SEGMENT, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("NodeDeleteSegment", - Stock::NODE_DELETE_SEGMENT, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("NodeBreak", - Stock::NODE_BREAK, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("NodeCorner", - Stock::NODE_CORNER, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("NodeSmooth", - Stock::NODE_SMOOTH, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("NodeSymmetric", - Stock::NODE_SYMMETRIC, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("NodeLine", - Stock::NODE_LINE, Glib::ustring(), - _("PLACEHOLDER, do not translate"))); - - _act_grp->add(Gtk::Action::create("NodeCurve", - Stock::NODE_CURVE, Glib::ustring(), - _("PLACEHOLDER, do not translate")));*/ -} - -void -EditWidget::initAccelMap() -{ - gchar *filename = g_build_filename(INKSCAPE_UIDIR, "keybindings.rc", NULL); - Gtk::AccelMap::load(filename); - g_free(filename); - - // One problem is that the keys 1-6 are zoom accelerators which get - // caught as accelerator _before_ any Entry input handler receives them, - // for example the zoom status. At the moment, the best way seems to - // disable them as accelerators when the Entry gets focus, and enable - // them when focus goes elsewhere. The code for this belongs here, - // and not in zoom-status.cpp . - - _zoom_status.signal_focus_in_event().connect (sigc::mem_fun (*this, &EditWidget::onEntryFocusIn)); - _zoom_status.signal_focus_out_event().connect (sigc::mem_fun (*this, &EditWidget::onEntryFocusOut)); -} - -bool -EditWidget::onEntryFocusIn (GdkEventFocus* /*ev*/) -{ - Gdk::ModifierType m = static_cast<Gdk::ModifierType>(0); - Gtk::AccelMap::change_entry ("<Actions>//Zoom100", 0, m, false); - Gtk::AccelMap::change_entry ("<Actions>//Zoom50", 0, m, false); - Gtk::AccelMap::change_entry ("<Actions>//ZoomSelection", 0, m, false); - Gtk::AccelMap::change_entry ("<Actions>//ZoomDrawing", 0, m, false); - Gtk::AccelMap::change_entry ("<Actions>//ZoomPage", 0, m, false); - Gtk::AccelMap::change_entry ("<Actions>//ZoomWidth", 0, m, false); - return false; -} - -bool -EditWidget::onEntryFocusOut (GdkEventFocus* /*ev*/) -{ - Gdk::ModifierType m = static_cast<Gdk::ModifierType>(0); - Gtk::AccelMap::change_entry ("<Actions>//Zoom100", '1', m, false); - Gtk::AccelMap::change_entry ("<Actions>//Zoom50", '2', m, false); - Gtk::AccelMap::change_entry ("<Actions>//ZoomSelection", '3', m, false); - Gtk::AccelMap::change_entry ("<Actions>//ZoomDrawing", '4', m, false); - Gtk::AccelMap::change_entry ("<Actions>//ZoomPage", '5', m, false); - Gtk::AccelMap::change_entry ("<Actions>//ZoomWidth", '6', m, false); - return false; -} - -void -EditWidget::initMenuBar() -{ - g_assert(_ui_mgr); - Gtk::MenuBar *menu = static_cast<Gtk::MenuBar*>(_ui_mgr->get_widget("/MenuBar")); - g_assert(menu != NULL); - _main_window_table.attach(*Gtk::manage(menu), 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK); -} - -void -EditWidget::initCommandsBar() -{ - g_assert(_ui_mgr); - Toolbox *bar = new Toolbox(static_cast<Gtk::Toolbar*>(_ui_mgr->get_widget("/CommandsBar")), - Gtk::TOOLBAR_ICONS); - g_assert(bar != NULL); - _toolbars_vbox.pack_start(*Gtk::manage(bar), Gtk::PACK_SHRINK); -} - -void -EditWidget::initToolControlsBar() -{ - // TODO: Do UIManager controlled widgets need to be deleted? - _select_ctrl = static_cast<Gtk::Toolbar*>(_ui_mgr->get_widget("/SelectControlsBar")); - _node_ctrl = static_cast<Gtk::Toolbar*>(_ui_mgr->get_widget("/NodeControlsBar")); - - _tool_ctrl = new Toolbox(_select_ctrl, Gtk::TOOLBAR_ICONS); - - _toolbars_vbox.pack_start(*Gtk::manage(_tool_ctrl), Gtk::PACK_SHRINK); -} - -void -EditWidget::initUriBar() -{ - /// \todo Create an Inkscape::UI::Widget::UriBar class (?) - - _uri_ctrl = new Gtk::Toolbar(); - - _uri_label.set_label(_("PLACEHOLDER, do not translate")); - _uri_ctrl->add(_uri_label); - _uri_ctrl->add(_uri_entry); - - _uri_entry.signal_activate() - .connect_notify(sigc::mem_fun(*this, &EditWidget::onUriChanged)); - - _toolbars_vbox.pack_start(*Gtk::manage(_uri_ctrl), Gtk::PACK_SHRINK); -} - -void -EditWidget::initToolsBar() -{ - Toolbox *bar = new Toolbox(static_cast<Gtk::Toolbar*>(_ui_mgr->get_widget("/ToolsBar")), - Gtk::TOOLBAR_ICONS, - Gtk::ORIENTATION_VERTICAL); - g_assert(bar != NULL); - _sub_window_hbox.pack_start(*Gtk::manage(bar), Gtk::PACK_SHRINK); -} - -void -EditWidget::initTopRuler() -{ - _viewport_table.attach(_top_ruler, 1, 2, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK); - - _tooltips.set_tip (_top_ruler, _top_ruler.get_tip()); -} - -void -EditWidget::initLeftRuler() -{ - _viewport_table.attach(_left_ruler, 0, 1, 1, 2, Gtk::SHRINK, Gtk::FILL|Gtk::EXPAND); - - _tooltips.set_tip (_left_ruler, _left_ruler.get_tip()); -} - -void -EditWidget::initBottomScrollbar() -{ - _viewport_table.attach(_bottom_scrollbar, 1, 2, 2, 3, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK); - _bottom_scrollbar.signal_value_changed().connect (sigc::mem_fun (*this, &EditWidget::onAdjValueChanged)); - _bottom_scrollbar.property_adjustment() = new Gtk::Adjustment (0.0, -4000.0, 4000.0, 10.0, 100.0, 4.0); -} - -void -EditWidget::initRightScrollbar() -{ - _viewport_table.attach(_right_scrollbar, 2, 3, 1, 2, Gtk::SHRINK, Gtk::FILL|Gtk::EXPAND); - - _right_scrollbar.signal_value_changed().connect (sigc::mem_fun (*this, &EditWidget::onAdjValueChanged)); - _right_scrollbar.property_adjustment() = new Gtk::Adjustment (0.0, -4000.0, 4000.0, 10.0, 100.0, 4.0); -} - -void -EditWidget::initStickyZoom() -{ - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - _viewport_table.attach(_sticky_zoom, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - _sticky_zoom.set_active (prefs->getBool("/options/stickyzoom/value")); - _tooltips.set_tip (_sticky_zoom, _("Zoom drawing if window size changes")); - - /// \todo icon not implemented -} - -void -EditWidget::initStatusbar() -{ - _statusbar.pack_start (_selected_style_status, false, false, 1); - _statusbar.pack_start (*new Gtk::VSeparator(), false, false, 0); - - _tooltips.set_tip (_zoom_status, _("Zoom")); - - _layer_selector.reference(); - _statusbar.pack_start (_layer_selector, false, false, 1); - - _coord_status.property_n_rows() = 2; - _coord_status.property_n_columns() = 5; - _coord_status.property_row_spacing() = 0; - _coord_status.property_column_spacing() = 2; - _coord_eventbox.add (_coord_status); - _tooltips.set_tip (_coord_eventbox, _("Cursor coordinates")); - _coord_status.attach (*new Gtk::VSeparator(), 0,1, 0,2, Gtk::FILL,Gtk::FILL, 0,0); - _coord_status.attach (*new Gtk::Label(_("X:"), 0.0, 0.5), 1,2, 0,1, Gtk::FILL,Gtk::FILL, 0,0); - _coord_status.attach (*new Gtk::Label(_("Y:"), 0.0, 0.5), 1,2, 1,2, Gtk::FILL,Gtk::FILL, 0,0); - _coord_status_x.set_text ("0.0"); - _coord_status_x.set_alignment (0.0, 0.5); - _coord_status_y.set_text ("0.0"); - _coord_status_y.set_alignment (0.0, 0.5); - _coord_status.attach (_coord_status_x, 2,3, 0,1, Gtk::FILL,Gtk::FILL, 0,0); - _coord_status.attach (_coord_status_y, 2,3, 1,2, Gtk::FILL,Gtk::FILL, 0,0); - _coord_status.attach (*new Gtk::Label(_("Z:"), 0.0, 0.5), 3,4, 0,2, Gtk::FILL,Gtk::FILL, 0,0); - _coord_status.attach (_zoom_status, 4,5, 0,2, Gtk::FILL,Gtk::FILL, 0,0); - sp_set_font_size_smaller (static_cast<GtkWidget*>((void*)_coord_status.gobj())); - _statusbar.pack_end (_coord_eventbox, false, false, 1); - - _select_status.property_xalign() = 0.0; - _select_status.property_yalign() = 0.5; - _select_status.set_markup (_("<b>Welcome to Inkscape!</b> Use shape or drawing tools to create objects; use selector (arrow) to move or transform them.")); - // include this again with Gtk+-2.6 -#if GTK_VERSION_GE(2,6) - gtk_label_set_ellipsize (GTK_LABEL(_select_status.gobj()), PANGO_ELLIPSIZE_END); -#endif - _select_status.set_size_request (1, -1); - _statusbar.pack_start (_select_status, true, true, 0); - - _main_window_table.attach(_statusbar, 0, 1, 3, 4, Gtk::FILL, Gtk::SHRINK); -} - -//======================================== -//----------implements EditWidgetInterface - -Gtk::Window * -EditWidget::getWindow() -{ - return this; -} - -void -EditWidget::setTitle (gchar const* new_title) -{ - set_title (new_title); -} - -void -EditWidget::layout() -{ - show_all_children(); -} - -void -EditWidget::present() -{ - this->Gtk::Window::present(); -} - -void -EditWidget::getGeometry (gint &x, gint &y, gint &w, gint &h) -{ - get_position (x, y); - get_size (w, h); -} - -void -EditWidget::setSize (gint w, gint h) -{ - resize (w, h); -} - -void -EditWidget::setPosition (Geom::Point p) -{ - move (int(p[Geom::X]), int(p[Geom::Y])); -} - -/// \param p is already gobj()! -void -EditWidget::setTransient (void* p, int i) -{ - gtk_window_set_transient_for (static_cast<GtkWindow*>(p), this->gobj()); - if (i==2) - this->Gtk::Window::present(); -} - -Geom::Point -EditWidget::getPointer() -{ - int x, y; - get_pointer (x, y); - return Geom::Point (x, y); -} - -void -EditWidget::setIconified() -{ - iconify(); -} - -void -EditWidget::setMaximized() -{ - maximize(); -} - -void -EditWidget::setFullscreen() -{ - fullscreen(); -} - -/** - * Shuts down the desktop object for the view being closed. It checks - * to see if the document has been edited, and if so prompts the user - * to save, discard, or cancel. Returns TRUE if the shutdown operation - * is cancelled or if the save is cancelled or fails, FALSE otherwise. - */ -bool -EditWidget::shutdown() -{ - g_assert (_desktop != NULL); - if (Inkscape::NSApplication::Editor::isDuplicatedView (_desktop)) - return false; - - SPDocument *doc = _desktop->doc(); - if (doc->isModifiedSinceSave()) { - gchar *markup; - /// \todo FIXME !!! obviously this will have problems if the document - /// name contains markup characters - markup = g_strdup_printf( - _("<span weight=\"bold\" size=\"larger\">Save changes to document \"%s\" before closing?</span>\n\n" - "If you close without saving, your changes will be discarded."), - SP_DOCUMENT_NAME(doc)); - - Gtk::MessageDialog dlg (*this, - markup, - true, - Gtk::MESSAGE_WARNING, - Gtk::BUTTONS_NONE, - true); - g_free(markup); - Gtk::Button close_button (_("Close _without saving"), true); - dlg.add_action_widget (close_button, Gtk::RESPONSE_NO); - close_button.show(); - dlg.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - dlg.add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_YES); - dlg.set_default_response (Gtk::RESPONSE_YES); - - int response = dlg.run(); - switch (response) - { - case Gtk::RESPONSE_YES: - sp_document_ref(doc); - sp_namedview_document_from_window(_desktop); - if (sp_file_save_document(*this, doc)) { - sp_document_unref(doc); - } else { // save dialog cancelled or save failed - sp_document_unref(doc); - return TRUE; - } - break; - case Gtk::RESPONSE_NO: - break; - default: // cancel pressed, or dialog was closed - return TRUE; - break; - } - } - - /* Code to check data loss */ - bool allow_data_loss = FALSE; - while (sp_document_repr_root(doc)->attribute("inkscape:dataloss") != NULL && allow_data_loss == FALSE) - { - gchar *markup; - /// \todo FIXME !!! obviously this will have problems if the document - /// name contains markup characters - markup = g_strdup_printf( - _("<span weight=\"bold\" size=\"larger\">The file \"%s\" was saved with a format (%s) that may cause data loss!</span>\n\n" - "Do you want to save this file as an Inkscape SVG?"), - SP_DOCUMENT_NAME(doc), - SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE); - - Gtk::MessageDialog dlg (*this, - markup, - true, - Gtk::MESSAGE_WARNING, - Gtk::BUTTONS_NONE, - true); - g_free(markup); - Gtk::Button close_button (_("Close _without saving"), true); - dlg.add_action_widget (close_button, Gtk::RESPONSE_NO); - close_button.show(); - Gtk::Button save_button (_("_Save as SVG"), true); - dlg.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - dlg.add_action_widget (save_button, Gtk::RESPONSE_YES); - save_button.show(); - dlg.set_default_response (Gtk::RESPONSE_YES); - - int response = dlg.run(); - - switch (response) - { - case Gtk::RESPONSE_YES: - sp_document_ref(doc); - if (sp_file_save_document(*this, doc)) { - sp_document_unref(doc); - } else { // save dialog cancelled or save failed - sp_document_unref(doc); - return TRUE; - } - break; - case Gtk::RESPONSE_NO: - allow_data_loss = TRUE; - break; - default: // cancel pressed, or dialog was closed - return TRUE; - break; - } - } - - return false; -} - - -void -EditWidget::destroy() -{ - delete this; -} - -void -EditWidget::requestCanvasUpdate() -{ - _svg_canvas.widget().queue_draw(); -} - -void -EditWidget::requestCanvasUpdateAndWait() -{ - requestCanvasUpdate(); - - while (gtk_events_pending()) - gtk_main_iteration_do(FALSE); -} - -void -EditWidget::enableInteraction() -{ - g_return_if_fail(_interaction_disabled_counter > 0); - - _interaction_disabled_counter--; - - if (_interaction_disabled_counter == 0) { - this->set_sensitive(true); - } -} - -void -EditWidget::disableInteraction() -{ - if (_interaction_disabled_counter == 0) { - this->set_sensitive(false); - } - - _interaction_disabled_counter++; -} - -void -EditWidget::activateDesktop() -{ - /// \todo active_desktop_indicator not implemented -} - -void -EditWidget::deactivateDesktop() -{ - /// \todo active_desktop_indicator not implemented -} - -void -EditWidget::viewSetPosition (Geom::Point p) -{ - // p -= _namedview->gridorigin; - /// \todo Why was the origin corrected for the grid origin? (johan) - - double lo, up, pos, max; - _top_ruler.get_range (lo, up, pos, max); - _top_ruler.set_range (lo, up, p[Geom::X], max); - _left_ruler.get_range (lo, up, pos, max); - _left_ruler.set_range (lo, up, p[Geom::Y], max); -} - -void -EditWidget::updateRulers() -{ - //Geom::Point gridorigin = _namedview->gridorigin; - /// \todo Why was the origin corrected for the grid origin? (johan) - - Geom::Rect const viewbox = _svg_canvas.spobj()->getViewbox(); - double lo, up, pos, max; - double const scale = _desktop->current_zoom(); - double s = viewbox.min()[Geom::X] / scale; //- gridorigin[Geom::X]; - double e = viewbox.max()[Geom::X] / scale; //- gridorigin[Geom::X]; - _top_ruler.get_range(lo, up, pos, max); - _top_ruler.set_range(s, e, pos, e); - s = viewbox.min()[Geom::Y] / -scale; //- gridorigin[Geom::Y]; - e = viewbox.max()[Geom::Y] / -scale; //- gridorigin[Geom::Y]; - _left_ruler.set_range(s, e, 0 /*gridorigin[Geom::Y]*/, e); - /// \todo is that correct? -} - -void -EditWidget::updateScrollbars (double scale) -{ - // do not call this function before canvas has its size allocated - if (!is_realized() || _update_s_f) { - return; - } - - _update_s_f = true; - - /* The desktop region we always show unconditionally */ - SPDocument *doc = _desktop->doc(); - Geom::Rect darea ( Geom::Point(-sp_document_width(doc), -sp_document_height(doc)), - Geom::Point(2 * sp_document_width(doc), 2 * sp_document_height(doc)) ); - SPObject* root = doc->root; - SPItem* item = SP_ITEM(root); - Geom::OptRect deskarea = Geom::unify(darea, sp_item_bbox_desktop(item)); - - /* Canvas region we always show unconditionally */ - Geom::Rect carea( Geom::Point(deskarea->min()[Geom::X] * scale - 64, deskarea->max()[Geom::Y] * -scale - 64), - Geom::Point(deskarea->max()[Geom::X] * scale + 64, deskarea->min()[Geom::Y] * -scale + 64) ); - - Geom::Rect const viewbox = _svg_canvas.spobj()->getViewbox(); - - /* Viewbox is always included into scrollable region */ - carea = Geom::unify(carea, viewbox); - - Gtk::Adjustment *adj = _bottom_scrollbar.get_adjustment(); - adj->set_value(viewbox.min()[Geom::X]); - adj->set_lower(carea.min()[Geom::X]); - adj->set_upper(carea.max()[Geom::X]); - adj->set_page_increment(viewbox.dimensions()[Geom::X]); - adj->set_step_increment(0.1 * (viewbox.dimensions()[Geom::X])); - adj->set_page_size(viewbox.dimensions()[Geom::X]); - - adj = _right_scrollbar.get_adjustment(); - adj->set_value(viewbox.min()[Geom::Y]); - adj->set_lower(carea.min()[Geom::Y]); - adj->set_upper(carea.max()[Geom::Y]); - adj->set_page_increment(viewbox.dimensions()[Geom::Y]); - adj->set_step_increment(0.1 * viewbox.dimensions()[Geom::Y]); - adj->set_page_size(viewbox.dimensions()[Geom::Y]); - - _update_s_f = false; -} - -void -EditWidget::toggleRulers() -{ - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if (_top_ruler.is_visible()) - { - _top_ruler.hide_all(); - _left_ruler.hide_all(); - prefs->setBool(_desktop->is_fullscreen() ? "/fullscreen/rulers/state" : "/window/rulers/state", false); - } else { - _top_ruler.show_all(); - _left_ruler.show_all(); - prefs->setBool(_desktop->is_fullscreen() ? "/fullscreen/rulers/state" : "/window/rulers/state", true); - } -} - -void -EditWidget::toggleScrollbars() -{ - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if (_bottom_scrollbar.is_visible()) - { - _bottom_scrollbar.hide_all(); - _right_scrollbar.hide_all(); - prefs->setBool(_desktop->is_fullscreen() ? "/fullscreen/scrollbars/state" : "/window/scrollbars/state", false); - } else { - _bottom_scrollbar.show_all(); - _right_scrollbar.show_all(); - prefs->setBool(_desktop->is_fullscreen() ? "/fullscreen/scrollbars/state" : "/window/scrollbars/state", true); - } -} - -void EditWidget::toggleColorProfAdjust() -{ - // TODO implement -} - -void -EditWidget::updateZoom() -{ - _zoom_status.update(); -} - -void -EditWidget::letZoomGrabFocus() -{ - _zoom_status.grab_focus(); -} - -void -EditWidget::setToolboxFocusTo (const gchar *) -{ - /// \todo not implemented -} - -void -EditWidget::setToolboxAdjustmentValue (const gchar *, double) -{ - /// \todo not implemented -} - -void -EditWidget::setToolboxSelectOneValue (const gchar *, gint) -{ - /// \todo not implemented -} - -bool -EditWidget::isToolboxButtonActive (gchar const*) -{ - /// \todo not implemented - return true; -} - -void -EditWidget::setCoordinateStatus (Geom::Point p) -{ - gchar *cstr = g_strdup_printf ("%6.2f", _dt2r * p[Geom::X]); - _coord_status_x.property_label() = cstr; - g_free (cstr); - cstr = g_strdup_printf ("%6.2f", _dt2r * p[Geom::Y]); - _coord_status_y.property_label() = cstr; - g_free (cstr); -} - -void -EditWidget::setMessage (Inkscape::MessageType /*type*/, gchar const* msg) -{ - _select_status.set_markup (msg? msg : ""); -} - -bool -EditWidget::warnDialog (gchar* msg) -{ - Gtk::MessageDialog dlg (*this, - msg, - true, - Gtk::MESSAGE_WARNING, - Gtk::BUTTONS_YES_NO, - true); - int r = dlg.run(); - return r == Gtk::RESPONSE_YES; -} - - -Inkscape::UI::Widget::Dock* -EditWidget::getDock () -{ - return &_dock; -} - -void EditWidget::_namedview_modified (SPObject *obj, guint flags) { - SPNamedView *nv = static_cast<SPNamedView *>(obj); - if (flags & SP_OBJECT_MODIFIED_FLAG) { - this->_dt2r = 1.0 / nv->doc_units->unittobase; - this->_top_ruler.update_metric(); - this->_left_ruler.update_metric(); - this->_tooltips.set_tip(this->_top_ruler, this->_top_ruler.get_tip()); - this->_tooltips.set_tip(this->_left_ruler, this->_left_ruler.get_tip()); - this->updateRulers(); - } -} - -void -EditWidget::initEdit (SPDocument *doc) -{ - _desktop = new SPDesktop(); - - _namedview = sp_document_namedview (doc, 0); - _svg_canvas.init (_desktop); - _desktop->init (_namedview, _svg_canvas.spobj(), this); - sp_namedview_window_from_document (_desktop); - sp_namedview_update_layers_from_document (_desktop); - _dt2r = 1.0 / _namedview->doc_units->unittobase; - - /// \todo convert to sigc++ when SPObject hierarchy gets converted - /* Listen on namedview modification */ - _namedview_modified_connection = _desktop->namedview->connectModified(sigc::mem_fun(*this, &EditWidget::_namedview_modified)); - _layer_selector.setDesktop (_desktop); - _selected_style_status.setDesktop (_desktop); - - Inkscape::NSApplication::Editor::addDesktop (_desktop); - - _zoom_status.init (_desktop); - _top_ruler.init (_desktop, _svg_canvas.widget()); - _left_ruler.init (_desktop, _svg_canvas.widget()); - updateRulers(); -} - -void -EditWidget::destroyEdit() -{ - if (_desktop) { - _layer_selector.unreference(); - Inkscape::NSApplication::Editor::removeDesktop (_desktop); // clears selection too - _namedview_modified_connection.disconnect(); - _desktop->destroy(); - Inkscape::GC::release (_desktop); - _desktop = 0; - } -} - -//----------end of EditWidgetInterface implementation - -//----------start of other callbacks - -bool -EditWidget::on_key_press_event (GdkEventKey* event) -{ - // this is the original code from helper/window.cpp - - unsigned int shortcut; - shortcut = get_group0_keyval (event) | - ( event->state & GDK_SHIFT_MASK ? - SP_SHORTCUT_SHIFT_MASK : 0 ) | - ( event->state & GDK_CONTROL_MASK ? - SP_SHORTCUT_CONTROL_MASK : 0 ) | - ( event->state & GDK_MOD1_MASK ? - SP_SHORTCUT_ALT_MASK : 0 ); - return sp_shortcut_invoke (shortcut, - Inkscape::NSApplication::Editor::getActiveDesktop()); -} - -bool -EditWidget::on_delete_event (GdkEventAny*) -{ - return shutdown(); -} - -bool -EditWidget::on_focus_in_event (GdkEventFocus*) -{ - Inkscape::NSApplication::Editor::activateDesktop (_desktop); - _svg_canvas.widget().grab_focus(); - - return false; -} - -void -EditWidget::onWindowSizeAllocate (Gtk::Allocation &newall) -{ - if (!is_realized()) return; - - const Gtk::Allocation& all = get_allocation(); - if ((newall.get_x() == all.get_x()) && - (newall.get_y() == all.get_y()) && - (newall.get_width() == all.get_width()) && - (newall.get_height() == all.get_height())) { - return; - } - - Geom::Rect const area = _desktop->get_display_area(); - double zoom = _desktop->current_zoom(); - - if (_sticky_zoom.get_active()) { - /* Calculate zoom per pixel */ - double const zpsp = zoom / hypot(area.dimensions()[Geom::X], area.dimensions()[Geom::Y]); - /* Find new visible area */ - Geom::Rect const newarea = _desktop->get_display_area(); - /* Calculate adjusted zoom */ - zoom = zpsp * hypot(newarea.dimensions()[Geom::X], newarea.dimensions()[Geom::Y]); - } - - _desktop->zoom_absolute(area.midpoint()[Geom::X], area.midpoint()[Geom::Y], zoom); -} - -void -EditWidget::onWindowRealize() -{ - - if ( (sp_document_width(_desktop->doc()) < 1.0) || (sp_document_height(_desktop->doc()) < 1.0) ) { - return; - } - - Geom::Rect d( Geom::Point(0, 0), - Geom::Point(sp_document_width(_desktop->doc()), sp_document_height(_desktop->doc())) ); - - _desktop->set_display_area(d.min()[Geom::X], d.min()[Geom::Y], d.max()[Geom::X], d.max()[Geom::Y], 10); - _namedview_modified(_desktop->namedview, SP_OBJECT_MODIFIED_FLAG); - setTitle (SP_DOCUMENT_NAME(_desktop->doc())); -} - -void -EditWidget::onAdjValueChanged() -{ - if (_update_a_f) return; - _update_a_f = true; - - sp_canvas_scroll_to (_svg_canvas.spobj(), - _bottom_scrollbar.get_value(), - _right_scrollbar.get_value(), - false); - updateRulers(); - - _update_a_f = false; -} - - -} // namespace View -} // namespace UI -} // namespace Inkscape - -/* - 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:encoding=utf-8:textwidth=99 : diff --git a/src/ui/view/edit-widget.h b/src/ui/view/edit-widget.h deleted file mode 100644 index 2bb708305..000000000 --- a/src/ui/view/edit-widget.h +++ /dev/null @@ -1,227 +0,0 @@ -/** - * \brief This class implements the functionality of the window layout, menus, - * and signals. - * - * Authors: - * Bryce W. Harrington <bryce@bryceharrington.org> - * Derek P. Moore <derekm@hackunix.org> - * Ralf Stephan <ralf@ark.in-berlin.de> - * John Bintz <jcoswell@coswellproductions.org> - * - * Copyright (C) 2006 John Bintz - * Copyright (C) 2004 Bryce Harrington - * - * Released under GNU GPL. Read the file 'COPYING' for more information. - */ - -#ifndef INKSCAPE_UI_VIEW_EDIT_WIDGET_H -#define INKSCAPE_UI_VIEW_EDIT_WIDGET_H - -#include <gtkmm/box.h> -#include <gtkmm/table.h> -#include <gtkmm/entry.h> -#include <gtkmm/scrollbar.h> -#include <gtkmm/actiongroup.h> -#include <gtkmm/uimanager.h> -#include <gtkmm/togglebutton.h> - -#include "ui/dialog/dialog-manager.h" -#include "ui/view/edit-widget-interface.h" -#include "ui/widget/dock.h" -#include "ui/widget/layer-selector.h" -#include "ui/widget/ruler.h" -#include "ui/widget/selected-style.h" -#include "ui/widget/svg-canvas.h" -#include "ui/widget/toolbox.h" -#include "ui/widget/zoom-status.h" - -struct SPDesktop; -struct SPDocument; -struct SPNamedView; - -namespace Inkscape { -namespace UI { -namespace View { - -class EditWidget : public Gtk::Window, - public EditWidgetInterface { -public: - EditWidget (SPDocument*); - ~EditWidget(); - - // Initialization - void initActions(); - void initUIManager(); - void initLayout(); - void initEdit (SPDocument*); - void destroyEdit(); - - // Actions - void onActionFileNew(); - void onActionFileOpen(); - void onActionFilePrint(); - void onActionFileQuit(); - void onToolbarItem(); - void onSelectTool(); - void onNodeTool(); - - // Menus - void onMenuItem(); - - void onDialogAbout(); - void onDialogAlignAndDistribute(); - void onDialogInkscapePreferences(); - void onDialogDialog(); - void onDialogDocumentProperties(); - void onDialogExport(); - void onDialogExtensionEditor(); - void onDialogFillAndStroke(); - void onDialogFind(); - void onDialogLayerEditor(); - void onDialogMessages(); - void onDialogObjectProperties(); - void onDialogTextProperties(); - void onDialogTransform(); - void onDialogTransformation(); - void onDialogTrace(); - void onDialogXmlEditor(); - - // Whiteboard (Inkboard) -#ifdef WITH_INKBOARD - void onDialogWhiteboardConnect(); - void onDialogWhiteboardShareWithUser(); - void onDialogWhiteboardShareWithChat(); - void onDialogOpenSessionFile(); - void onDumpXMLTracker(); -#endif - - void onUriChanged(); - - // from EditWidgetInterface - virtual Gtk::Window* getWindow(); - virtual void setTitle (gchar const*); - virtual void layout(); - virtual void present(); - virtual void getGeometry (gint &x, gint &y, gint &w, gint &h); - virtual void setSize (gint w, gint h); - virtual void setPosition (Geom::Point p); - virtual void setTransient (void*, int); - virtual Geom::Point getPointer(); - virtual void setIconified(); - virtual void setMaximized(); - virtual void setFullscreen(); - virtual bool shutdown(); - virtual void destroy(); - virtual void requestCanvasUpdate(); - virtual void requestCanvasUpdateAndWait(); - virtual void enableInteraction(); - virtual void disableInteraction(); - virtual void activateDesktop(); - virtual void deactivateDesktop(); - virtual void viewSetPosition (Geom::Point p); - virtual void updateRulers(); - virtual void updateScrollbars (double scale); - virtual void toggleRulers(); - virtual void toggleScrollbars(); - virtual void toggleColorProfAdjust(); - virtual void updateZoom(); - virtual void letZoomGrabFocus(); - virtual void setToolboxFocusTo (const gchar *); - virtual void setToolboxAdjustmentValue (const gchar *, double); - virtual void setToolboxSelectOneValue (const gchar *, gint); - virtual bool isToolboxButtonActive (gchar const*); - virtual void setCoordinateStatus (Geom::Point p); - virtual void setMessage (Inkscape::MessageType type, gchar const* msg); - virtual bool warnDialog (gchar*); - - virtual Inkscape::UI::Widget::Dock* getDock (); - -protected: - void _namedview_modified(SPObject *namedview, guint); - - Gtk::Tooltips _tooltips; - - // Child widgets: - Gtk::Table _main_window_table; - Gtk::VBox _toolbars_vbox; - Gtk::HBox _sub_window_hbox; - Gtk::Table _viewport_table; - - UI::Widget::Toolbox *_tool_ctrl; - Gtk::Toolbar *_select_ctrl; - Gtk::Toolbar *_uri_ctrl; - Gtk::Label _uri_label; - Gtk::Entry _uri_entry; - Gtk::Toolbar *_node_ctrl; - - UI::Widget::HRuler _top_ruler; - UI::Widget::VRuler _left_ruler; - Gtk::HScrollbar _bottom_scrollbar; - Gtk::VScrollbar _right_scrollbar; - Gtk::ToggleButton _sticky_zoom; - UI::Widget::SVGCanvas _svg_canvas; - Gtk::HBox _statusbar; - UI::Widget::Dock _dock; - UI::Widget::SelectedStyle _selected_style_status; - UI::Widget::ZoomStatus _zoom_status; - Inkscape::Widgets::LayerSelector _layer_selector; - Gtk::EventBox _coord_eventbox; - Gtk::Table _coord_status; - Gtk::Label _coord_status_x, _coord_status_y; - Gtk::Label _select_status; - - SPDesktop* _desktop; - SPNamedView* _namedview; - double _dt2r; - - Glib::RefPtr<Gtk::ActionGroup> _act_grp; - Glib::RefPtr<Gtk::UIManager> _ui_mgr; - UI::Dialog::DialogManager _dlg_mgr; - - void initMenuActions(); - void initToolbarActions(); - void initAccelMap(); - void initMenuBar(); - void initCommandsBar(); - void initToolControlsBar(); - void initUriBar(); - void initToolsBar(); - void initBottomScrollbar(); - void initRightScrollbar(); - void initLeftRuler(); - void initTopRuler(); - void initStickyZoom(); - void initStatusbar(); - - virtual bool on_key_press_event (GdkEventKey*); - virtual bool on_delete_event (GdkEventAny*); - virtual bool on_focus_in_event (GdkEventFocus*); - -private: - bool onEntryFocusIn (GdkEventFocus*); - bool onEntryFocusOut (GdkEventFocus*); - void onWindowSizeAllocate (Gtk::Allocation&); - void onWindowRealize(); - void onAdjValueChanged(); - - bool _update_s_f, _update_a_f; - unsigned int _interaction_disabled_counter; - - sigc::connection _namedview_modified_connection; -}; -} // namespace View -} // namespace UI -} // namespace Inkscape - -#endif // INKSCAPE_UI_VIEW_EDIT_WIDGET_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:encoding=utf-8:textwidth=99 : diff --git a/src/ui/view/edit.cpp b/src/ui/view/edit.cpp deleted file mode 100644 index 87bbc241c..000000000 --- a/src/ui/view/edit.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/** - * \brief Empty file left in repo for current desktop.cpp - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - - -namespace Inkscape { -namespace UI { -namespace View { - - -} // namespace View -} // namespace UI -} // namespace Inkscape - -/* - 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:encoding=utf-8:textwidth=99 : diff --git a/src/ui/view/edit.h b/src/ui/view/edit.h deleted file mode 100644 index 76c2b5942..000000000 --- a/src/ui/view/edit.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * \brief empty file left in repo for current desktop.h - */ - -#ifndef INKSCAPE_UI_VIEW_EDIT_H -#define INKSCAPE_UI_VIEW_EDIT_H - -namespace Inkscape { -namespace UI { -namespace View { - -} // namespace View -} // namespace UI -} // namespace Inkscape - -#endif // INKSCAPE_UI_VIEW_EDIT_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:encoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/attr-widget.h b/src/ui/widget/attr-widget.h index 8abe6b1ba..b9924a2ef 100644 --- a/src/ui/widget/attr-widget.h +++ b/src/ui/widget/attr-widget.h @@ -179,4 +179,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/color-picker.cpp b/src/ui/widget/color-picker.cpp index 34cf1d5e3..b7a67b744 100644 --- a/src/ui/widget/color-picker.cpp +++ b/src/ui/widget/color-picker.cpp @@ -156,4 +156,4 @@ sp_color_picker_color_mod(SPColorSelector *csel, GObject *cp) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/color-picker.h b/src/ui/widget/color-picker.h index 477aa1c19..2c246aaa3 100644 --- a/src/ui/widget/color-picker.h +++ b/src/ui/widget/color-picker.h @@ -86,4 +86,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/combo-enums.h b/src/ui/widget/combo-enums.h index 4f70c9d28..d9044daa6 100644 --- a/src/ui/widget/combo-enums.h +++ b/src/ui/widget/combo-enums.h @@ -208,4 +208,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp index b48d43076..026eac8e0 100644 --- a/src/ui/widget/dock-item.cpp +++ b/src/ui/widget/dock-item.cpp @@ -508,4 +508,4 @@ DockItem::_signal_drag_end_callback(GtkWidget *self, gboolean cancelled, void *d fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/dock-item.h b/src/ui/widget/dock-item.h index c0f52a77a..79d69d862 100644 --- a/src/ui/widget/dock-item.h +++ b/src/ui/widget/dock-item.h @@ -160,4 +160,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/dock.cpp b/src/ui/widget/dock.cpp index 3608c3551..02e1f2b41 100644 --- a/src/ui/widget/dock.cpp +++ b/src/ui/widget/dock.cpp @@ -294,4 +294,4 @@ Dock::_signal_layout_changed_proxy = fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/dock.h b/src/ui/widget/dock.h index c49d71268..5836cf83f 100644 --- a/src/ui/widget/dock.h +++ b/src/ui/widget/dock.h @@ -99,5 +99,5 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/entity-entry.cpp b/src/ui/widget/entity-entry.cpp index e9f09f574..968e35b6c 100644 --- a/src/ui/widget/entity-entry.cpp +++ b/src/ui/widget/entity-entry.cpp @@ -56,7 +56,7 @@ EntityEntry::create (rdf_work_entity_t* ent, Gtk::Tooltips& tt, Registry& wr) } EntityEntry::EntityEntry (rdf_work_entity_t* ent, Gtk::Tooltips& tt, Registry& wr) -: _label(Glib::ustring(_(ent->title))+":", 1.0, 0.5), _packable(0), +: _label(Glib::ustring(_(ent->title)), 1.0, 0.5), _packable(0), _entity(ent), _tt(&tt), _wr(&wr) { } diff --git a/src/ui/widget/filter-effect-chooser.cpp b/src/ui/widget/filter-effect-chooser.cpp index 9aaa64220..309730600 100644 --- a/src/ui/widget/filter-effect-chooser.cpp +++ b/src/ui/widget/filter-effect-chooser.cpp @@ -23,7 +23,7 @@ namespace Widget { SimpleFilterModifier::SimpleFilterModifier(int flags) : _lb_blend(_("_Blend mode:")), - _lb_blur(_("B_lur:"), Gtk::ALIGN_LEFT), + _lb_blur(_("Blur:"), Gtk::ALIGN_LEFT), _blend(BlendModeConverter, SP_ATTR_INVALID, false), _blur(0, 0, 100, 1, 0.01, 1) { @@ -106,4 +106,4 @@ void SimpleFilterModifier::set_blur_sensitive(const bool s) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/filter-effect-chooser.h b/src/ui/widget/filter-effect-chooser.h index 7f2a980c3..e91d786cd 100644 --- a/src/ui/widget/filter-effect-chooser.h +++ b/src/ui/widget/filter-effect-chooser.h @@ -76,4 +76,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/imagetoggler.cpp b/src/ui/widget/imagetoggler.cpp index 961cce5b5..073e071af 100644 --- a/src/ui/widget/imagetoggler.cpp +++ b/src/ui/widget/imagetoggler.cpp @@ -103,6 +103,6 @@ ImageToggler::activate_vfunc(GdkEvent* event, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/imagetoggler.h b/src/ui/widget/imagetoggler.h index 229d153a8..54446230e 100644 --- a/src/ui/widget/imagetoggler.h +++ b/src/ui/widget/imagetoggler.h @@ -83,4 +83,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/labelled.cpp b/src/ui/widget/labelled.cpp index 72c4f6785..c55b57616 100644 --- a/src/ui/widget/labelled.cpp +++ b/src/ui/widget/labelled.cpp @@ -99,4 +99,4 @@ Labelled::getLabel() const fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/labelled.h b/src/ui/widget/labelled.h index 5670af0b6..a8b00ebb6 100644 --- a/src/ui/widget/labelled.h +++ b/src/ui/widget/labelled.h @@ -64,4 +64,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/layer-selector.cpp b/src/ui/widget/layer-selector.cpp index f25192b2a..5fb8089b4 100644 --- a/src/ui/widget/layer-selector.cpp +++ b/src/ui/widget/layer-selector.cpp @@ -608,4 +608,4 @@ void LayerSelector::_hideLayer(bool hide) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/layer-selector.h b/src/ui/widget/layer-selector.h index 0b5300272..8bfa52ad7 100644 --- a/src/ui/widget/layer-selector.h +++ b/src/ui/widget/layer-selector.h @@ -107,4 +107,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp index bfc291bc0..a9b4fe83e 100644 --- a/src/ui/widget/object-composite-settings.cpp +++ b/src/ui/widget/object-composite-settings.cpp @@ -59,7 +59,7 @@ ObjectCompositeSettings::ObjectCompositeSettings(unsigned int verb_code, char co _opacity_tag(Glib::ustring(history_prefix) + ":opacity"), _opacity_vbox(false, 0), _opacity_label_box(false, 0), - _opacity_label(_("Opacity, %"), 0.0, 1.0, true), + _opacity_label(_("Opacity (%):"), 0.0, 1.0, true), _opacity_adjustment(100.0, 0.0, 100.0, 1.0, 1.0, 0.0), _opacity_hscale(_opacity_adjustment), _opacity_spin_button(_opacity_adjustment, 0.01, 1), @@ -305,4 +305,4 @@ ObjectCompositeSettings::_subjectChanged() { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/object-composite-settings.h b/src/ui/widget/object-composite-settings.h index f778c3ac0..76538d6a7 100644 --- a/src/ui/widget/object-composite-settings.h +++ b/src/ui/widget/object-composite-settings.h @@ -83,4 +83,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 26763cc77..724848ca5 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -297,6 +297,15 @@ PageSizer::PageSizer(Registry & _wr) _portraitButton.set_group (group); _portraitButton.set_active (true); + // Setting default custom unit to document unit + SPDesktop *dt = SP_ACTIVE_DESKTOP; + SPNamedView *nv = sp_desktop_namedview(dt); + if (nv->units) { + _dimensionUnits.setUnit(nv->units); + } else if (nv->doc_units) { + _dimensionUnits.setUnit(nv->doc_units); + } + //## Set up custom size frame _customFrame.set_label(_("Custom size")); pack_start (_customFrame, false, false, 0); diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 4b806afb5..b3c8ce376 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -131,20 +131,15 @@ void Panel::_init() } { - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - Glib::ustring heightItemLabel(Q_("swatches|Size")); + Glib::ustring heightItemLabel(C_("Swatches", "Size")); //TRANSLATORS: Indicates size of colour swatches const gchar *heightLabels[] = { - N_("tiny"), - N_("small"), - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - // "medium" indicates size of colour swatches - N_("swatchesHeight|medium"), - N_("large"), - N_("huge") + NC_("Swatches height", "Tiny"), + NC_("Swatches height", "Small"), + NC_("Swatches height", "Medium"), + NC_("Swatches height", "Large"), + NC_("Swatches height", "Huge") }; Gtk::MenuItem *sizeItem = manage(new Gtk::MenuItem(heightItemLabel)); @@ -153,7 +148,7 @@ void Panel::_init() Gtk::RadioMenuItem::Group heightGroup; for (unsigned int i = 0; i < G_N_ELEMENTS(heightLabels); i++) { - Glib::ustring _label(Q_(heightLabels[i])); + Glib::ustring _label(g_dpgettext2(NULL, "Swatches height", heightLabels[i])); Gtk::RadioMenuItem* _item = manage(new Gtk::RadioMenuItem(heightGroup, _label)); sizeMenu->append(*_item); if (i == panel_size) { @@ -166,20 +161,15 @@ void Panel::_init() } { - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - Glib::ustring widthItemLabel(Q_("swatches|Width")); + Glib::ustring widthItemLabel(C_("Swatches", "Width")); //TRANSLATORS: Indicates width of colour swatches const gchar *widthLabels[] = { - N_("narrower"), - N_("narrow"), - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - // "medium" indicates width of colour swatches - N_("swatchesWidth|medium"), - N_("wide"), - N_("wider") + NC_("Swatches width", "Narrower"), + NC_("Swatches width", "Narrow"), + NC_("Swatches width", "Medium"), + NC_("Swatches width", "Wide"), + NC_("Swatches width", "Wider") }; Gtk::MenuItem *item = manage( new Gtk::MenuItem(widthItemLabel)); @@ -198,7 +188,7 @@ void Panel::_init() } } for ( guint i = 0; i < G_N_ELEMENTS(widthLabels); ++i ) { - Glib::ustring _label(Q_(widthLabels[i])); + Glib::ustring _label(g_dpgettext2(NULL, "Swatches width", widthLabels[i])); Gtk::RadioMenuItem *_item = manage(new Gtk::RadioMenuItem(widthGroup, _label)); type_menu->append(*_item); if ( i <= hot_index ) { @@ -209,10 +199,8 @@ void Panel::_init() } { - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - // "Wrap" indicates how colour swatches are displayed - Glib::ustring wrap_label(Q_("swatches|Wrap")); + //TRANSLATORS: "Wrap" indicates how colour swatches are displayed + Glib::ustring wrap_label(C_("Swatches","Wrap")); Gtk::CheckMenuItem *check = manage(new Gtk::CheckMenuItem(wrap_label)); check->set_active(panel_wrap); _menu->append(*check); @@ -613,4 +601,4 @@ Inkscape::Selection *Panel::_getSelection() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h index d42548f16..fe3e226b4 100644 --- a/src/ui/widget/panel.h +++ b/src/ui/widget/panel.h @@ -150,4 +150,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/point.cpp b/src/ui/widget/point.cpp index f27cfe8c6..ca7f7a501 100644 --- a/src/ui/widget/point.cpp +++ b/src/ui/widget/point.cpp @@ -246,4 +246,4 @@ Point::signal_y_value_changed() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/point.h b/src/ui/widget/point.h index 94477d877..68d2f4c9d 100644 --- a/src/ui/widget/point.h +++ b/src/ui/widget/point.h @@ -95,4 +95,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 70aed505e..4816304db 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -700,4 +700,4 @@ void PrefUnit::on_changed() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/random.cpp b/src/ui/widget/random.cpp index c06051098..02201be12 100644 --- a/src/ui/widget/random.cpp +++ b/src/ui/widget/random.cpp @@ -145,4 +145,4 @@ Random::onReseedButtonClick() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/random.h b/src/ui/widget/random.h index 93c6c2ff4..71cc8d1e5 100644 --- a/src/ui/widget/random.h +++ b/src/ui/widget/random.h @@ -69,4 +69,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/registered-enums.h b/src/ui/widget/registered-enums.h index 739745817..056a09fed 100644 --- a/src/ui/widget/registered-enums.h +++ b/src/ui/widget/registered-enums.h @@ -94,4 +94,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/rendering-options.cpp b/src/ui/widget/rendering-options.cpp index d17c11d0f..48e257af7 100644 --- a/src/ui/widget/rendering-options.cpp +++ b/src/ui/widget/rendering-options.cpp @@ -121,4 +121,4 @@ RenderingOptions::bitmap_dpi () fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/rendering-options.h b/src/ui/widget/rendering-options.h index 964ffca57..8e047e682 100644 --- a/src/ui/widget/rendering-options.h +++ b/src/ui/widget/rendering-options.h @@ -60,4 +60,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/ruler.cpp b/src/ui/widget/ruler.cpp index 0afc0da3e..7f260680b 100644 --- a/src/ui/widget/ruler.cpp +++ b/src/ui/widget/ruler.cpp @@ -197,4 +197,4 @@ VRuler::~VRuler() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/scalar-unit.cpp b/src/ui/widget/scalar-unit.cpp index 8727ed052..6209d40e0 100644 --- a/src/ui/widget/scalar-unit.cpp +++ b/src/ui/widget/scalar-unit.cpp @@ -249,4 +249,4 @@ ScalarUnit::on_unit_changed() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/scalar-unit.h b/src/ui/widget/scalar-unit.h index c99161dad..d8b2edbd5 100644 --- a/src/ui/widget/scalar-unit.h +++ b/src/ui/widget/scalar-unit.h @@ -82,4 +82,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/scalar.cpp b/src/ui/widget/scalar.cpp index 17fb4964d..26a1f6541 100644 --- a/src/ui/widget/scalar.cpp +++ b/src/ui/widget/scalar.cpp @@ -219,4 +219,4 @@ Scalar::signal_value_changed() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/scalar.h b/src/ui/widget/scalar.h index 8ce72d949..6de128edb 100644 --- a/src/ui/widget/scalar.h +++ b/src/ui/widget/scalar.h @@ -83,4 +83,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index a8f9f9c60..8e11c8308 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -1030,8 +1030,8 @@ SelectedStyle::update() case QUERY_STYLE_SINGLE: case QUERY_STYLE_MULTIPLE_AVERAGED: case QUERY_STYLE_MULTIPLE_SAME: - _tooltips.set_tip(_opacity_place, _("Opacity, %")); - _tooltips.set_tip(_opacity_sb, _("Opacity, %")); + _tooltips.set_tip(_opacity_place, _("Opacity (%)")); + _tooltips.set_tip(_opacity_sb, _("Opacity (%)")); if (_opacity_blocked) break; _opacity_blocked = true; _opacity_sb.set_sensitive(true); diff --git a/src/ui/widget/spin-slider.cpp b/src/ui/widget/spin-slider.cpp index e3e73a51f..faafc63b4 100644 --- a/src/ui/widget/spin-slider.cpp +++ b/src/ui/widget/spin-slider.cpp @@ -114,10 +114,8 @@ DualSpinSlider::DualSpinSlider(double value, double lower, double upper, double : AttrWidget(a), _s1(value, lower, upper, step_inc, climb_rate, digits, SP_ATTR_INVALID, tip_text1), _s2(value, lower, upper, step_inc, climb_rate, digits, SP_ATTR_INVALID, tip_text2), - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - // "Link" means to _link_ two sliders together - _link(Q_("sliders|Link")) + //TRANSLATORS: "Link" means to _link_ two sliders together + _link(C_("Sliders", "Link")) { signal_value_changed().connect(signal_attr_changed().make_slot()); diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp index a7359242d..09001a993 100644 --- a/src/ui/widget/style-subject.cpp +++ b/src/ui/widget/style-subject.cpp @@ -191,4 +191,4 @@ void StyleSubject::CurrentLayer::_afterDesktopSwitch(SPDesktop *desktop) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/style-subject.h b/src/ui/widget/style-subject.h index 6f46efff5..77e4c4846 100644 --- a/src/ui/widget/style-subject.h +++ b/src/ui/widget/style-subject.h @@ -121,4 +121,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/svg-canvas.cpp b/src/ui/widget/svg-canvas.cpp index 1ba49b7ec..64657296d 100644 --- a/src/ui/widget/svg-canvas.cpp +++ b/src/ui/widget/svg-canvas.cpp @@ -89,4 +89,4 @@ SVGCanvas::onEvent (GdkEvent * ev) const fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/text.cpp b/src/ui/widget/text.cpp index 3284af54a..581491f0e 100644 --- a/src/ui/widget/text.cpp +++ b/src/ui/widget/text.cpp @@ -79,4 +79,4 @@ Text::signal_activate() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/text.h b/src/ui/widget/text.h index d1ef35be5..0dcfc5cc6 100644 --- a/src/ui/widget/text.h +++ b/src/ui/widget/text.h @@ -59,4 +59,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/zoom-status.cpp b/src/ui/widget/zoom-status.cpp index 7c1cf72d7..9322aa803 100644 --- a/src/ui/widget/zoom-status.cpp +++ b/src/ui/widget/zoom-status.cpp @@ -125,4 +125,4 @@ ZoomStatus::on_value_changed() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/unclump.cpp b/src/unclump.cpp index 85306698c..3226160dc 100644 --- a/src/unclump.cpp +++ b/src/unclump.cpp @@ -385,4 +385,4 @@ unclump (GSList *items) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/unclump.h b/src/unclump.h index c5a8bf7d7..f7fcea087 100644 --- a/src/unclump.h +++ b/src/unclump.h @@ -26,4 +26,4 @@ void unclump(GSList *items); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/uri.cpp b/src/uri.cpp index aeb678304..1e38c034a 100644 --- a/src/uri.cpp +++ b/src/uri.cpp @@ -260,4 +260,4 @@ gchar *URI::Impl::toString() const { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : @@ -88,4 +88,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/accumulators.h b/src/util/accumulators.h index c627786b1..2cd51b101 100644 --- a/src/util/accumulators.h +++ b/src/util/accumulators.h @@ -110,4 +110,4 @@ struct LogicalOr { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/copy.h b/src/util/copy.h index 27038ff2d..1b4232814 100644 --- a/src/util/copy.h +++ b/src/util/copy.h @@ -45,4 +45,4 @@ struct Copy<T &> { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/ege-tags.cpp b/src/util/ege-tags.cpp index 5d33c85a3..8a2ce0529 100644 --- a/src/util/ege-tags.cpp +++ b/src/util/ege-tags.cpp @@ -175,4 +175,4 @@ void TagSet::decrement( std::string const& key ) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/ege-tags.h b/src/util/ege-tags.h index eaba6a00a..7280e1f6a 100644 --- a/src/util/ege-tags.h +++ b/src/util/ege-tags.h @@ -118,4 +118,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/enums.h b/src/util/enums.h index cbb1cb9a1..824da3f75 100644 --- a/src/util/enums.h +++ b/src/util/enums.h @@ -130,4 +130,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/filter-list.h b/src/util/filter-list.h index 50aba12fa..cf086df4a 100644 --- a/src/util/filter-list.h +++ b/src/util/filter-list.h @@ -62,4 +62,4 @@ filter_list(UnaryPredicate p, List<T> const &list) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/fixed_point.h b/src/util/fixed_point.h index 05a73dab5..cfc6e4020 100644 --- a/src/util/fixed_point.h +++ b/src/util/fixed_point.h @@ -108,4 +108,4 @@ template<typename T, unsigned int precision> double operator *(double a, FixedPo fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/format.h b/src/util/format.h index 80d79c28a..690121254 100644 --- a/src/util/format.h +++ b/src/util/format.h @@ -53,4 +53,4 @@ inline ptr_shared<char> format(char const *format, ...) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/forward-pointer-iterator.h b/src/util/forward-pointer-iterator.h index 1603fed27..198225d5f 100644 --- a/src/util/forward-pointer-iterator.h +++ b/src/util/forward-pointer-iterator.h @@ -117,4 +117,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/function.h b/src/util/function.h index d0dd5d87c..a7970f1c0 100644 --- a/src/util/function.h +++ b/src/util/function.h @@ -119,4 +119,4 @@ struct Function<R (*)(A0, A1, A2, A3, A4, A5)> { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/glib-list-iterators.h b/src/util/glib-list-iterators.h index 586bc314a..dfee69c07 100644 --- a/src/util/glib-list-iterators.h +++ b/src/util/glib-list-iterators.h @@ -235,4 +235,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/list-container-test.h b/src/util/list-container-test.h index 7765352eb..5f0e06e0c 100644 --- a/src/util/list-container-test.h +++ b/src/util/list-container-test.h @@ -246,4 +246,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/list-container.h b/src/util/list-container.h index ca614314c..e123fea0c 100644 --- a/src/util/list-container.h +++ b/src/util/list-container.h @@ -349,4 +349,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/list-copy.h b/src/util/list-copy.h index 811f93b77..28ce66ad3 100644 --- a/src/util/list-copy.h +++ b/src/util/list-copy.h @@ -42,4 +42,4 @@ struct ListCopy { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/list.h b/src/util/list.h index ebe3a9773..e65aa849b 100644 --- a/src/util/list.h +++ b/src/util/list.h @@ -404,4 +404,4 @@ inline MutableList<T> const &set_rest(MutableList<T> const &list, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/map-list.h b/src/util/map-list.h index 8eba81e3c..841a87a6d 100644 --- a/src/util/map-list.h +++ b/src/util/map-list.h @@ -65,4 +65,4 @@ map_list_in_place(UnaryFunction f, List<T> start, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/mathfns.h b/src/util/mathfns.h index 20c06145a..830e159da 100644 --- a/src/util/mathfns.h +++ b/src/util/mathfns.h @@ -48,7 +48,7 @@ inline double round_to_nearest_multiple_plus(double x, double const c1, double c * If c1==0 (and c0 is finite), then returns +/-inf. This makes grid spacing of zero * mean "ignore the grid in this dimension". */ -inline double round_to_lower_multiple_plus(double x, double const c1, double const c0) +inline double round_to_lower_multiple_plus(double x, double const c1, double const c0 = 0) { return floor((x - c0) / c1) * c1 + c0; } @@ -60,7 +60,7 @@ inline double round_to_lower_multiple_plus(double x, double const c1, double con * If c1==0 (and c0 is finite), then returns +/-inf. This makes grid spacing of zero * mean "ignore the grid in this dimension". */ -inline double round_to_upper_multiple_plus(double x, double const c1, double const c0) +inline double round_to_upper_multiple_plus(double x, double const c1, double const c0 = 0) { return ceil((x - c0) / c1) * c1 + c0; } @@ -80,4 +80,4 @@ inline double round_to_upper_multiple_plus(double x, double const c1, double con fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/reference.h b/src/util/reference.h index 199ae8929..5c94bbba5 100644 --- a/src/util/reference.h +++ b/src/util/reference.h @@ -46,4 +46,4 @@ struct Reference<T &> { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/reverse-list.h b/src/util/reverse-list.h index 798b15701..dacbc2a11 100644 --- a/src/util/reverse-list.h +++ b/src/util/reverse-list.h @@ -65,4 +65,4 @@ reverse_list_in_place(MutableList<T> start, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/share.cpp b/src/util/share.cpp index 2f693fac9..606ed9d47 100644 --- a/src/util/share.cpp +++ b/src/util/share.cpp @@ -40,4 +40,4 @@ ptr_shared<char> share_string(char const *string, std::size_t length) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/share.h b/src/util/share.h index 3a2b73561..4891b9588 100644 --- a/src/util/share.h +++ b/src/util/share.h @@ -145,4 +145,4 @@ inline ptr_shared<T1> reinterpret_cast_shared(ptr_shared<T2> const &ref) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/tuple.h b/src/util/tuple.h index 42266c8d2..1e4c4f62a 100644 --- a/src/util/tuple.h +++ b/src/util/tuple.h @@ -179,4 +179,4 @@ inline Tuple<> tuple() { return Tuple<>(); } fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/units.cpp b/src/util/units.cpp index c49b2176d..a251dc5db 100644 --- a/src/util/units.cpp +++ b/src/util/units.cpp @@ -341,4 +341,4 @@ void UnitsSAXHandler::_endElement(xmlChar const *xname) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/util/unordered-containers.h b/src/util/unordered-containers.h index aaf771959..9411657a5 100644 --- a/src/util/unordered-containers.h +++ b/src/util/unordered-containers.h @@ -75,4 +75,4 @@ struct hash<T *> : public std::unary_function<T *, std::size_t> { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/vanishing-point.cpp b/src/vanishing-point.cpp index 78ceec467..d8e27debd 100644 --- a/src/vanishing-point.cpp +++ b/src/vanishing-point.cpp @@ -22,6 +22,8 @@ #include "xml/repr.h" #include "perspective-line.h" #include "shape-editor.h" +#include "snap.h" +#include "sp-namedview.h" namespace Box3D { @@ -76,7 +78,7 @@ have_VPs_of_same_perspective (VPDragger *dr1, VPDragger *dr2) } static void -vp_knot_moved_handler (SPKnot */*knot*/, Geom::Point const *ppointer, guint state, gpointer data) +vp_knot_moved_handler (SPKnot *knot, Geom::Point const *ppointer, guint state, gpointer data) { VPDragger *dragger = (VPDragger *) data; VPDrag *drag = dragger->parent; @@ -170,10 +172,20 @@ vp_knot_moved_handler (SPKnot */*knot*/, Geom::Point const *ppointer, guint stat return; } } - } + // We didn't snap to another dragger, so we'll try a regular snap + SPDesktop *desktop = inkscape_active_desktop(); + SnapManager &m = desktop->namedview->snap_manager; + m.setup(desktop); + Inkscape::SnappedPoint s = m.freeSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_OTHER_HANDLE)); + m.unSetup(); + if (s.getSnapped()) { + p = s.getPoint(); + sp_knot_moveto(knot, p); + } + } - dragger->point = p; // FIXME: Brauchen wir dragger->point ĂŒberhaupt? + dragger->point = p; // FIXME: Is dragger->point being used at all? dragger->updateVPs(p); dragger->updateBoxDisplays(); @@ -775,4 +787,4 @@ VPDrag::addLine (Geom::Point p1, Geom::Point p2, guint32 rgba) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/verbs-test.h b/src/verbs-test.h index 145b3859f..04a0b80c0 100644 --- a/src/verbs-test.h +++ b/src/verbs-test.h @@ -83,4 +83,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/verbs.cpp b/src/verbs.cpp index c2af399c5..8b5ec9b3b 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -63,6 +63,7 @@ #include "selection-chemistry.h" #include "seltrans.h" #include "shape-editor.h" +#include "shortcuts.h" #include "sp-flowtext.h" #include "sp-guide.h" #include "splivarot.h" @@ -334,7 +335,15 @@ Verb::VerbIDTable Verb::_verb_ids; in the \c _verbs hashtable which is indexed by the \c code. */ Verb::Verb(gchar const *id, gchar const *name, gchar const *tip, gchar const *image) : - _actions(NULL), _id(id), _name(name), _tip(tip), _image(image) + _actions(0), + _id(id), + _name(name), + _tip(tip), + _full_tip(0), + _shortcut(0), + _image(image), + _code(0), + _default_sensitive(false) { static int count = SP_VERB_LAST; @@ -342,8 +351,6 @@ Verb::Verb(gchar const *id, gchar const *name, gchar const *tip, gchar const *im _code = count; _verbs.insert(VerbTable::value_type(count, this)); _verb_ids.insert(VerbIDTable::value_type(_id, this)); - - return; } /** \brief Destroy a verb. @@ -358,7 +365,10 @@ Verb::~Verb(void) delete _actions; } - return; + if (_full_tip) { + g_free(_full_tip); + _full_tip = 0; + } } /** \brief Verbs are no good without actions. This is a place holder @@ -628,10 +638,30 @@ Verb::sensitive(SPDocument *in_doc, bool in_sensitive) } /** \brief Accessor to get the tooltip for verb as localised string */ -gchar const * -Verb::get_tip (void) +gchar const *Verb::get_tip(void) { - return _(_tip); + gchar const *result = 0; + if (_tip) { + unsigned int shortcut = sp_shortcut_get_primary(this); + if ( (shortcut != _shortcut) || !_full_tip) { + if (_full_tip) { + g_free(_full_tip); + _full_tip = 0; + } + _shortcut = shortcut; + gchar* shortcutString = sp_shortcut_get_label(shortcut); + if (shortcutString) { + _full_tip = g_strdup_printf("%s (%s)", _(_tip), shortcutString); + g_free(shortcutString); + shortcutString = 0; + } else { + _full_tip = g_strdup(_(_tip)); + } + } + result = _full_tip; + } + + return result; } void @@ -2296,8 +2326,8 @@ Verb *Verb::_base_verbs[] = { N_("Deselect any selected objects or nodes"), INKSCAPE_ICON_EDIT_SELECT_NONE), new EditVerb(SP_VERB_EDIT_GUIDES_AROUND_PAGE, "EditGuidesAroundPage", N_("_Guides Around Page"), N_("Create four guides aligned with the page borders"), NULL), - new EditVerb(SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER, "EditNextPathEffectParameter", N_("Next Path Effect Parameter"), - N_("Show next Path Effect parameter for editing"), INKSCAPE_ICON_PATH_EFFECT_PARAMETER_NEXT), + new EditVerb(SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER, "EditNextPathEffectParameter", N_("Next path effect parameter"), + N_("Show next editable path effect parameter"), INKSCAPE_ICON_PATH_EFFECT_PARAMETER_NEXT), /* Selection */ new SelectionVerb(SP_VERB_SELECTION_TO_FRONT, "SelectionToFront", N_("Raise to _Top"), @@ -2541,7 +2571,7 @@ Verb *Verb::_base_verbs[] = { new ZoomVerb(SP_VERB_TOGGLE_SCROLLBARS, "ToggleScrollbars", N_("Scroll_bars"), N_("Show or hide the canvas scrollbars"), NULL), new ZoomVerb(SP_VERB_TOGGLE_GRID, "ToggleGrid", N_("_Grid"), N_("Show or hide the grid"), INKSCAPE_ICON_SHOW_GRID), new ZoomVerb(SP_VERB_TOGGLE_GUIDES, "ToggleGuides", N_("G_uides"), N_("Show or hide guides (drag from a ruler to create a guide)"), INKSCAPE_ICON_SHOW_GUIDES), - new ZoomVerb(SP_VERB_TOGGLE_SNAPPING, "ToggleSnapGlobal", N_("Snap"), N_("Toggle snapping on or off"), INKSCAPE_ICON_SNAP), + new ZoomVerb(SP_VERB_TOGGLE_SNAPPING, "ToggleSnapGlobal", N_("Snap"), N_("Enable snapping"), INKSCAPE_ICON_SNAP), new ZoomVerb(SP_VERB_ZOOM_NEXT, "ZoomNext", N_("Nex_t Zoom"), N_("Next zoom (from the history of zooms)"), INKSCAPE_ICON_ZOOM_NEXT), new ZoomVerb(SP_VERB_ZOOM_PREV, "ZoomPrev", N_("Pre_vious Zoom"), N_("Previous zoom (from the history of zooms)"), @@ -2596,7 +2626,7 @@ Verb *Verb::_base_verbs[] = { new DialogVerb(SP_VERB_DIALOG_METADATA, "DialogMetadata", N_("Document _Metadata..."), N_("Edit document metadata (to be saved with the document)"), INKSCAPE_ICON_DOCUMENT_METADATA ), new DialogVerb(SP_VERB_DIALOG_FILL_STROKE, "DialogFillStroke", N_("_Fill and Stroke..."), - N_("Edit objects' colors, gradients, stroke width, arrowheads, dash patterns..."), INKSCAPE_ICON_DIALOG_FILL_AND_STROKE), + N_("Edit objects' colors, gradients, arrowheads, and other fill and stroke properties..."), INKSCAPE_ICON_DIALOG_FILL_AND_STROKE), new DialogVerb(SP_VERB_DIALOG_GLYPHS, "DialogGlyphs", N_("Glyphs..."), N_("Select characters from a glyphs palette"), GTK_STOCK_SELECT_FONT), // TRANSLATORS: "Swatches" means: color samples @@ -2738,4 +2768,4 @@ Verb::list (void) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/verbs.h b/src/verbs.h index 7c04ba3f6..f118014d2 100644 --- a/src/verbs.h +++ b/src/verbs.h @@ -303,12 +303,15 @@ class Verb { private: /** \brief An easy to use defition of the table of verbs by code. */ typedef std::map<unsigned int, Inkscape::Verb *> VerbTable; + /** \brief A table of all the dynamically created verbs. */ static VerbTable _verbs; + /** \brief The table of statically created verbs which are mostly 'base verbs'. */ static Verb * _base_verbs[SP_VERB_LAST + 1]; /* Plus one because there is an entry for SP_VERB_LAST */ + /** A string comparison function to be used in the Verb ID lookup to find the different verbs in the hash map. */ struct ltstr { @@ -322,8 +325,10 @@ private: } } }; + /** \brief An easy to use definition of the table of verbs by ID. */ typedef std::map<gchar const *, Verb *, ltstr> VerbIDTable; + /** \brief Quick lookup of verbs by ID */ static VerbIDTable _verb_ids; @@ -335,12 +340,20 @@ private: /** \brief A unique textual ID for the verb. */ gchar const * _id; + /** \brief The full name of the verb. (shown on menu entries) */ gchar const * _name; + /** \brief Tooltip for the verb. */ gchar const * _tip; + + gchar * _full_tip; // includes shortcut + + unsigned int _shortcut; + /** \brief Name of the image that represents the verb. */ gchar const * _image; + /** \brief Unique numerical representation of the verb. In most cases it is a value from the anonymous enum at the top of this file. */ @@ -349,6 +362,7 @@ private: /** \brief Whether this verb is set to default to sensitive or insensitive when new actions are created. */ bool _default_sensitive; + protected: /** \brief Allows for preliminary setting of the \c _default_sensitive value without effecting existing actions @@ -409,7 +423,16 @@ public: gchar const * name, gchar const * tip, gchar const * image) : - _actions(NULL), _id(id), _name(name), _tip(tip), _image(image), _code(code), _default_sensitive(true) { + _actions(0), + _id(id), + _name(name), + _tip(tip), + _full_tip(0), + _shortcut(0), + _image(image), + _code(code), + _default_sensitive(true) + { _verbs.insert(VerbTable::value_type(_code, this)); _verb_ids.insert(VerbIDTable::value_type(_id, this)); } diff --git a/src/widgets/button.cpp b/src/widgets/button.cpp index 6769fa389..dc830d096 100644 --- a/src/widgets/button.cpp +++ b/src/widgets/button.cpp @@ -27,6 +27,8 @@ #include "shortcuts.h" #include "interface.h" +#include <gdk/gdkkeysyms.h> + #include "icon.h" #include "button.h" @@ -286,29 +288,27 @@ sp_button_action_set_shortcut (SPAction *action, unsigned int /*shortcut*/, void } } -static void -sp_button_set_composed_tooltip (GtkTooltips *tooltips, GtkWidget *widget, SPAction *action) +static void sp_button_set_composed_tooltip(GtkTooltips *tooltips, GtkWidget *widget, SPAction *action) { - if (action) { - unsigned int shortcut = sp_shortcut_get_primary (action->verb); - if (shortcut) { - // there's both action and shortcut - - gchar key[256]; - sp_ui_shortcut_string (shortcut, key); - - gchar *tip = g_strdup_printf ("%s (%s)", action->tip, key); - gtk_tooltips_set_tip (tooltips, widget, tip, NULL); - g_free (tip); - - } else { - // action has no shortcut - gtk_tooltips_set_tip (tooltips, widget, action->tip, NULL); - } - } else { - // no action - gtk_tooltips_set_tip (tooltips, widget, NULL, NULL); - } + if (action) { + unsigned int shortcut = sp_shortcut_get_primary (action->verb); + if (shortcut != GDK_VoidSymbol) { + // there's both action and shortcut + + gchar *key = sp_shortcut_get_label(shortcut); + + gchar *tip = g_strdup_printf ("%s (%s)", action->tip, key); + gtk_tooltips_set_tip(tooltips, widget, tip, NULL); + g_free(tip); + g_free(key); + } else { + // action has no shortcut + gtk_tooltips_set_tip(tooltips, widget, action->tip, NULL); + } + } else { + // no action + gtk_tooltips_set_tip(tooltips, widget, NULL, NULL); + } } GtkWidget * diff --git a/src/widgets/dash-selector.cpp b/src/widgets/dash-selector.cpp index 3ac2bd4af..e7e029334 100644 --- a/src/widgets/dash-selector.cpp +++ b/src/widgets/dash-selector.cpp @@ -347,4 +347,4 @@ SPDashSelector::offset_value_changed() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/dash-selector.h b/src/widgets/dash-selector.h index 25417285a..6db66f805 100644 --- a/src/widgets/dash-selector.h +++ b/src/widgets/dash-selector.h @@ -58,4 +58,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 36047e81b..d447abf2e 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -41,6 +41,7 @@ #include <extension/db.h> #include "file.h" #include "helper/units.h" +#include "helper/unit-tracker.h" #include "inkscape-private.h" #include "interface.h" #include "macros.h" @@ -69,7 +70,7 @@ using Inkscape::round; #endif - +using Inkscape::UnitTracker; using Inkscape::UI::UXManager; using Inkscape::UI::ToolboxFactory; @@ -325,7 +326,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) dtw->hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_end( GTK_BOX (dtw->vbox), dtw->hbox, TRUE, TRUE, 0 ); gtk_widget_show(dtw->hbox); - + dtw->aux_toolbox = ToolboxFactory::createAuxToolbox(); gtk_box_pack_end (GTK_BOX (dtw->vbox), dtw->aux_toolbox, FALSE, TRUE, 0); @@ -1510,6 +1511,40 @@ void SPDesktopWidget::namedviewModified(SPObject *obj, guint flags) sp_ruler_set_metric(GTK_RULER (this->vruler), nv->getDefaultMetric()); sp_ruler_set_metric(GTK_RULER (this->hruler), nv->getDefaultMetric()); + /* This loops through all the grandchildren of aux toolbox, + * and for each that it finds, it performs an sp_search_by_data_recursive(), + * looking for widgets that hold some "tracker" data (this is used by + * all toolboxes to refer to the unit selector). The default document units + * is then selected within these unit selectors. + * + * Of course it would be nice to be able to refer to the toolbox and the + * unit selector directly by name, but I don't yet see a way to do that. + * + * This should solve: https://bugs.launchpad.net/inkscape/+bug/362995 + */ + if (GTK_IS_CONTAINER(aux_toolbox)) { + GList *ch = gtk_container_get_children (GTK_CONTAINER(aux_toolbox)); + for (GList *i = ch; i != NULL; i = i->next) { + if (GTK_IS_CONTAINER(i->data)) { + GList *grch = gtk_container_get_children (GTK_CONTAINER(i->data)); + for (GList *j = grch; j != NULL; j = j->next) { + if (!GTK_IS_WIDGET(j->data)) // wasn't a widget + continue; + + gpointer t = sp_search_by_data_recursive(GTK_WIDGET(j->data), (gpointer) "tracker"); + if (t == NULL) // didn't find any tracker data + continue; + + UnitTracker *tracker = reinterpret_cast<UnitTracker*>( t ); + if (tracker == NULL) // it's null when inkscape is first opened + continue; + + tracker->setActiveUnit( nv->doc_units ); + } // grandchildren + } // if child is a container + } // children + } // if aux_toolbox is a container + gtk_tooltips_set_tip(this->tt, this->hruler_box, gettext(sp_unit_get_plural (nv->doc_units)), NULL); gtk_tooltips_set_tip(this->tt, this->vruler_box, gettext(sp_unit_get_plural (nv->doc_units)), NULL); diff --git a/src/widgets/eek-preview.cpp b/src/widgets/eek-preview.cpp index 7d408c689..8fefbe75c 100644 --- a/src/widgets/eek-preview.cpp +++ b/src/widgets/eek-preview.cpp @@ -771,4 +771,4 @@ GtkWidget* eek_preview_new(void) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/eek-preview.h b/src/widgets/eek-preview.h index 86481e548..49fe8e660 100644 --- a/src/widgets/eek-preview.h +++ b/src/widgets/eek-preview.h @@ -151,4 +151,4 @@ G_END_DECLS fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/ege-paint-def.cpp b/src/widgets/ege-paint-def.cpp index f7a46cfbb..cab675b29 100644 --- a/src/widgets/ege-paint-def.cpp +++ b/src/widgets/ege-paint-def.cpp @@ -326,4 +326,4 @@ static std::string doubleToStr(double d) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/ege-paint-def.h b/src/widgets/ege-paint-def.h index b47aec8aa..32f92ac3d 100644 --- a/src/widgets/ege-paint-def.h +++ b/src/widgets/ege-paint-def.h @@ -108,4 +108,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/fill-n-stroke-factory.h b/src/widgets/fill-n-stroke-factory.h index 74339a07f..c671842fc 100644 --- a/src/widgets/fill-n-stroke-factory.h +++ b/src/widgets/fill-n-stroke-factory.h @@ -33,4 +33,4 @@ Gtk::Widget *createStyleWidget( FillOrStroke kind ); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp index a0e343b58..b70c8f47d 100644 --- a/src/widgets/fill-style.cpp +++ b/src/widgets/fill-style.cpp @@ -705,4 +705,4 @@ void FillNStroke::updateFromPaint() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/fill-style.h b/src/widgets/fill-style.h index ef19d7788..28a3f4f46 100644 --- a/src/widgets/fill-style.h +++ b/src/widgets/fill-style.h @@ -35,4 +35,4 @@ void sp_fill_style_widget_set_desktop(Gtk::Widget *widget, SPDesktop *desktop); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/font-selector.cpp b/src/widgets/font-selector.cpp index cac4caee0..965910ba2 100644 --- a/src/widgets/font-selector.cpp +++ b/src/widgets/font-selector.cpp @@ -177,10 +177,8 @@ static void sp_font_selector_init(SPFontSelector *fsel) g_object_set_data (G_OBJECT(fsel), "family-treeview", fsel->family_treeview); - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS /* Style frame */ - f = gtk_frame_new(Q_("fontselector|Style")); + f = gtk_frame_new(C_("Font selector", "Style")); gtk_widget_show(f); gtk_box_pack_start(GTK_BOX (fsel), f, TRUE, TRUE, 0); diff --git a/src/widgets/font-selector.h b/src/widgets/font-selector.h index 2c4e26610..febd4a34a 100644 --- a/src/widgets/font-selector.h +++ b/src/widgets/font-selector.h @@ -49,4 +49,4 @@ double sp_font_selector_get_size (SPFontSelector *fsel); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp index f37158eec..06ba7b908 100644 --- a/src/widgets/gradient-vector.cpp +++ b/src/widgets/gradient-vector.cpp @@ -649,25 +649,22 @@ static void sp_grad_edit_select(GtkOptionMenu *mnu, GtkWidget *tbl) static void offadjustmentChanged( GtkAdjustment *adjustment, GtkWidget *vb) { - if (blocked) { - return; - } + if (!blocked) { + blocked = TRUE; - blocked = TRUE; + GtkOptionMenu *mnu = static_cast<GtkOptionMenu *>(g_object_get_data(G_OBJECT(vb), "stopmenu")); + if ( g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(mnu)))), "stop") ) { + SPStop *stop = SP_STOP(g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(mnu)))), "stop")); - GtkOptionMenu *mnu = static_cast<GtkOptionMenu *>(g_object_get_data(G_OBJECT(vb), "stopmenu")); - if (!g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(mnu)))), "stop")) { - return; - } - SPStop *stop = SP_STOP(g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(mnu)))), "stop")); - - stop->offset = adjustment->value; - sp_repr_set_css_double(SP_OBJECT_REPR(stop), "offset", stop->offset); + stop->offset = adjustment->value; + sp_repr_set_css_double(SP_OBJECT_REPR(stop), "offset", stop->offset); - sp_document_done(SP_OBJECT_DOCUMENT(stop), SP_VERB_CONTEXT_GRADIENT, - _("Change gradient stop offset")); + sp_document_maybe_done(SP_OBJECT_DOCUMENT(stop), "gradient:stop:offset", SP_VERB_CONTEXT_GRADIENT, + _("Change gradient stop offset")); - blocked = FALSE; + blocked = FALSE; + } + } } guint32 sp_average_color(guint32 c1, guint32 c2, gdouble p = 0.5) @@ -1204,4 +1201,4 @@ static void sp_gradient_vector_color_changed(SPColorSelector *csel, GtkObject *o fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/gradient-vector.h b/src/widgets/gradient-vector.h index ceca9158c..9147f9cc1 100644 --- a/src/widgets/gradient-vector.h +++ b/src/widgets/gradient-vector.h @@ -80,4 +80,4 @@ GtkWidget *sp_gradient_vector_editor_new (SPGradient *gradient, SPStop *stop = N fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index d8f451ed7..d039dd2de 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -1450,4 +1450,4 @@ static void imageMapNamedCB(GtkWidget* widget, gpointer user_data) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp index cf6a04a3c..a7bed9e94 100644 --- a/src/widgets/paint-selector.cpp +++ b/src/widgets/paint-selector.cpp @@ -1186,4 +1186,4 @@ SPPaintSelector::Mode SPPaintSelector::getModeForStyle(SPStyle const & style, Fi fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/paint-selector.h b/src/widgets/paint-selector.h index 84209d1da..f3aff5a68 100644 --- a/src/widgets/paint-selector.h +++ b/src/widgets/paint-selector.h @@ -131,4 +131,4 @@ SPPaintSelector *sp_paint_selector_new(FillOrStroke kind); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/ruler.cpp b/src/widgets/ruler.cpp index c70d96991..dd0336413 100644 --- a/src/widgets/ruler.cpp +++ b/src/widgets/ruler.cpp @@ -29,12 +29,11 @@ #define MAXIMUM_SCALES 10 #define UNUSED_PIXELS 2 // There appear to be two pixels that are not being used at each end of the ruler +static void sp_ruler_common_draw_ticks (GtkRuler *ruler); + static void sp_hruler_class_init (SPHRulerClass *klass); static void sp_hruler_init (SPHRuler *hruler); static gint sp_hruler_motion_notify (GtkWidget *widget, GdkEventMotion *event); -static void sp_hruler_draw_ticks (GtkRuler *ruler); -static void sp_hruler_draw_pos (GtkRuler *ruler); -static void sp_hruler_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static GtkWidgetClass *hruler_parent_class; @@ -79,10 +78,8 @@ sp_hruler_class_init (SPHRulerClass *klass) ruler_class = (GtkRulerClass*) klass; widget_class->motion_notify_event = sp_hruler_motion_notify; - widget_class->size_allocate = sp_hruler_size_allocate; - ruler_class->draw_ticks = sp_hruler_draw_ticks; - ruler_class->draw_pos = sp_hruler_draw_pos; + ruler_class->draw_ticks = sp_ruler_common_draw_ticks; } static void @@ -114,269 +111,20 @@ sp_hruler_motion_notify (GtkWidget *widget, ruler = GTK_RULER (widget); double x = event->x; //Although event->x is double according to the docs, it only appears to return integers - ruler->position = ruler->lower + (ruler->upper - ruler->lower) * (x + UNUSED_PIXELS) / (widget->allocation.width + 2*UNUSED_PIXELS); - - /* Make sure the ruler has been allocated already */ - if (ruler->backing_store != NULL) - gtk_ruler_draw_pos (ruler); - - return FALSE; -} - -static void -sp_hruler_draw_ticks (GtkRuler *ruler) -{ - GtkWidget *widget; - GdkGC *gc, *bg_gc; - PangoFontDescription *pango_desc; - PangoContext *pango_context; - PangoLayout *pango_layout; - gint i, tick_index; - gint width, height; - gint xthickness; - gint ythickness; - gint length, ideal_length; - double lower, upper; /* Upper and lower limits, in ruler units */ - double increment; /* Number of pixels per unit */ - gint scale; /* Number of units per major unit */ - double subd_incr; - double start, end, cur; - gchar unit_str[32]; - gint digit_height; - gint text_width; - gint pos; - - g_return_if_fail (ruler != NULL); - g_return_if_fail (SP_IS_HRULER (ruler)); - - if (!GTK_WIDGET_DRAWABLE (ruler)) - return; - - widget = GTK_WIDGET (ruler); - - gc = widget->style->fg_gc[GTK_STATE_NORMAL]; - bg_gc = widget->style->bg_gc[GTK_STATE_NORMAL]; - - pango_desc = widget->style->font_desc; - - // Create the pango layout - pango_context = gtk_widget_get_pango_context (widget); - - pango_layout = pango_layout_new (pango_context); - - PangoFontDescription *fs = pango_font_description_new (); - pango_font_description_set_size (fs, RULER_FONT_SIZE); - pango_layout_set_font_description (pango_layout, fs); - pango_font_description_free (fs); - - digit_height = (int) floor (RULER_FONT_SIZE * RULER_FONT_VERTICAL_SPACING / PANGO_SCALE + 0.5); - - xthickness = widget->style->xthickness; - ythickness = widget->style->ythickness; - - width = widget->allocation.width; // in pixels; is apparently 2 pixels shorter than the canvas at each end - height = widget->allocation.height;// - ythickness * 2; - - gtk_paint_box (widget->style, ruler->backing_store, - GTK_STATE_NORMAL, GTK_SHADOW_NONE, - NULL, widget, "hruler", - 0, 0, - widget->allocation.width, widget->allocation.height); - - upper = ruler->upper / ruler->metric->pixels_per_unit; // upper and lower are expressed in ruler units - lower = ruler->lower / ruler->metric->pixels_per_unit; - /* "pixels_per_unit" should be "points_per_unit". This is the size of the unit - * in 1/72nd's of an inch and has nothing to do with screen pixels */ - - if ((upper - lower) == 0) - return; - increment = (double) (width + 2*UNUSED_PIXELS) / (upper - lower); // screen pixels per ruler unit - - /* determine the scale - * We calculate the text size as for the vruler instead of using - * text_width = gdk_string_width(font, unit_str), so that the result - * for the scale looks consistent with an accompanying vruler - */ - scale = (int)(ceil (ruler->max_size / ruler->metric->pixels_per_unit)); - sprintf (unit_str, "%d", scale); - text_width = strlen (unit_str) * digit_height + 1; - - for (scale = 0; scale < MAXIMUM_SCALES; scale++) - if (ruler->metric->ruler_scale[scale] * fabs(increment) > 2 * text_width) - break; - - if (scale == MAXIMUM_SCALES) - scale = MAXIMUM_SCALES - 1; - - /* drawing starts here */ - length = 0; - for (i = MAXIMUM_SUBDIVIDE - 1; i >= 0; i--) - { - subd_incr = ruler->metric->ruler_scale[scale] / - ruler->metric->subdivide[i]; - if (subd_incr * fabs(increment) <= MINIMUM_INCR) - continue; - - /* Calculate the length of the tickmarks. Make sure that - * this length increases for each set of ticks - */ - ideal_length = height / (i + 1) - 1; - if (ideal_length > ++length) - length = ideal_length; - - if (lower < upper) - { - start = floor (lower / subd_incr) * subd_incr; - end = ceil (upper / subd_incr) * subd_incr; - } - else - { - start = floor (upper / subd_incr) * subd_incr; - end = ceil (lower / subd_incr) * subd_incr; - } - - tick_index = 0; - cur = start; // location (in ruler units) of the first invisible tick at the left side of the canvas - - while (cur <= end) - { - // due to the typical values for cur, lower and increment, pos will often end up to - // be e.g. 641.50000000000; rounding behaviour is not defined in such a case (see round.h) - // and jitter will be apparent (upon redrawing some of the lines on the ruler might jump a - // by a pixel, and jump back on the next redraw). This is suppressed by adding 1e-9 (that's only one nanopixel ;-)) - pos = int(Inkscape::round((cur - lower) * increment + 1e-12)) - UNUSED_PIXELS; - gdk_draw_line (ruler->backing_store, gc, - pos, height + ythickness, - pos, height - length + ythickness); - - /* draw label */ - double label_spacing_px = (increment*(double)ruler->metric->ruler_scale[scale])/ruler->metric->subdivide[i]; - if (i == 0 && - (label_spacing_px > 6*digit_height || tick_index%2 == 0 || cur == 0) && - (label_spacing_px > 3*digit_height || tick_index%4 == 0 || cur == 0)) - { - if (fabs((int)cur) >= 2000 && (((int) cur)/1000)*1000 == ((int) cur)) - sprintf (unit_str, "%dk", ((int) cur)/1000); - else - sprintf (unit_str, "%d", (int) cur); - - pango_layout_set_text (pango_layout, unit_str, -1); - - gdk_draw_layout (ruler->backing_store, gc, - pos + 2, 0, pango_layout); - } - - /* Calculate cur from start rather than incrementing by subd_incr - * in each iteration. This is to avoid propagation of floating point - * errors in subd_incr. - */ - ++tick_index; - cur = start + tick_index * subd_incr; - } - } -} - -static void -sp_hruler_draw_pos (GtkRuler *ruler) -{ - GtkWidget *widget; - GdkGC *gc; - int i; - gint x, y; - gint width, height; - gint bs_width, bs_height; - gint xthickness; - gint ythickness; - gfloat increment; + double pos = ruler->lower + (ruler->upper - ruler->lower) * (x + UNUSED_PIXELS) / (widget->allocation.width + 2*UNUSED_PIXELS); - g_return_if_fail (ruler != NULL); - g_return_if_fail (SP_IS_HRULER (ruler)); - - if (GTK_WIDGET_DRAWABLE (ruler)) - { - widget = GTK_WIDGET (ruler); - - gc = widget->style->fg_gc[GTK_STATE_NORMAL]; - xthickness = widget->style->xthickness; - ythickness = widget->style->ythickness; - width = widget->allocation.width; // in pixels; is apparently 2 pixels shorter than the canvas at each end - height = widget->allocation.height - ythickness * 2; - - bs_width = height / 2; - bs_width |= 1; /* make sure it's odd */ - bs_height = bs_width / 2 + 1; - - if ((bs_width > 0) && (bs_height > 0)) - { - /* If a backing store exists, restore the ruler */ - if (ruler->backing_store && ruler->non_gr_exp_gc) - gdk_draw_pixmap (ruler->widget.window, - ruler->non_gr_exp_gc, - ruler->backing_store, - ruler->xsrc, ruler->ysrc, - ruler->xsrc, ruler->ysrc, - bs_width, bs_height); - - increment = (gfloat) (width + 2*UNUSED_PIXELS) / (ruler->upper - ruler->lower); - - // Calculate the coordinates (x, y, in pixels) of the tip of the triangle - x = int(Inkscape::round((ruler->position - ruler->lower) * increment + double(xthickness - bs_width) / 2.0) - UNUSED_PIXELS); - y = (height + bs_height) / 2 + ythickness; - - for (i = 0; i < bs_height; i++) - gdk_draw_line (widget->window, gc, - x + i, y + i, - x + bs_width - 1 - i, y + i); - - - ruler->xsrc = x; - ruler->ysrc = y; - } - } -} + gtk_ruler_set_range(ruler, ruler->lower, ruler->upper, pos, ruler->max_size); -/** - * The hruler widget's size_allocate callback. - */ -static void -sp_hruler_size_allocate (GtkWidget *widget, GtkAllocation *allocation) -{ - g_assert (widget != NULL); - g_assert (SP_IS_HRULER (widget)); - - // First call the default gtk_widget_size_allocate() method (which is being overridden here) - if (GTK_WIDGET_CLASS (hruler_parent_class)->size_allocate) - (* GTK_WIDGET_CLASS (hruler_parent_class)->size_allocate) (widget, allocation); - - // Now the size of the ruler has changed, the ruler bounds (upper & lower) need to be updated - // For this we first need to obtain a pointer to the desktop, by walking up the tree of ancestors - GtkWidget *parent = gtk_widget_get_parent(widget); - do { - if (SP_IS_DESKTOP_WIDGET(parent)) { - // Now we've found the desktop widget we can have the ruler boundaries updated - sp_desktop_widget_update_hruler(SP_DESKTOP_WIDGET(parent)); - // If the size of the ruler has increased, then a blank part is uncovered; therefore - // it must be redrawn - sp_hruler_draw_ticks(GTK_RULER(widget)); - break; - } - parent = gtk_widget_get_parent(parent); - } while (parent != NULL); + return FALSE; } - - - // vruler static void sp_vruler_class_init (SPVRulerClass *klass); static void sp_vruler_init (SPVRuler *vruler); static gint sp_vruler_motion_notify (GtkWidget *widget, GdkEventMotion *event); -static void sp_vruler_draw_ticks (GtkRuler *ruler); -static void sp_vruler_draw_pos (GtkRuler *ruler); static void sp_vruler_size_request (GtkWidget *widget, GtkRequisition *requisition); -static void sp_vruler_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static GtkWidgetClass *vruler_parent_class; @@ -421,11 +169,9 @@ sp_vruler_class_init (SPVRulerClass *klass) ruler_class = (GtkRulerClass*) klass; widget_class->motion_notify_event = sp_vruler_motion_notify; - widget_class->size_allocate = sp_vruler_size_allocate; widget_class->size_request = sp_vruler_size_request; - ruler_class->draw_ticks = sp_vruler_draw_ticks; - ruler_class->draw_pos = sp_vruler_draw_pos; + ruler_class->draw_ticks = sp_ruler_common_draw_ticks; } static void @@ -436,6 +182,8 @@ sp_vruler_init (SPVRuler *vruler) widget = GTK_WIDGET (vruler); widget->requisition.width = widget->style->xthickness * 2 + RULER_WIDTH; widget->requisition.height = widget->style->ythickness * 2 + 1; + + g_object_set(G_OBJECT(vruler), "orientation", GTK_ORIENTATION_VERTICAL, NULL); } GtkWidget* @@ -457,267 +205,189 @@ sp_vruler_motion_notify (GtkWidget *widget, ruler = GTK_RULER (widget); double y = event->y; //Although event->y is double according to the docs, it only appears to return integers - ruler->position = ruler->lower + (ruler->upper - ruler->lower) * (y + UNUSED_PIXELS) / (widget->allocation.height + 2*UNUSED_PIXELS); + double pos = ruler->lower + (ruler->upper - ruler->lower) * (y + UNUSED_PIXELS) / (widget->allocation.height + 2*UNUSED_PIXELS); - /* Make sure the ruler has been allocated already */ - if (ruler->backing_store != NULL) - gtk_ruler_draw_pos (ruler); + gtk_ruler_set_range(ruler, ruler->lower, ruler->upper, pos, ruler->max_size); return FALSE; } static void -sp_vruler_draw_ticks (GtkRuler *ruler) +sp_vruler_size_request (GtkWidget *widget, GtkRequisition *requisition) { - GtkWidget *widget; - GdkGC *gc, *bg_gc; - PangoFontDescription *pango_desc; - PangoContext *pango_context; - PangoLayout *pango_layout; - gint i, j, tick_index; - gint width, height; - gint xthickness; - gint ythickness; - gint length, ideal_length; - double lower, upper; /* Upper and lower limits, in ruler units */ - double increment; /* Number of pixels per unit */ - gint scale; /* Number of units per major unit */ - double subd_incr; - double start, end, cur; - gchar unit_str[32]; - gchar digit_str[2] = { '\0', '\0' }; - gint digit_height; - gint text_height; - gint pos; - - g_return_if_fail (ruler != NULL); - g_return_if_fail (SP_IS_VRULER (ruler)); - - if (!GTK_WIDGET_DRAWABLE (ruler)) - return; - - widget = GTK_WIDGET (ruler); - - gc = widget->style->fg_gc[GTK_STATE_NORMAL]; - bg_gc = widget->style->bg_gc[GTK_STATE_NORMAL]; - - pango_desc = widget->style->font_desc; - - // Create the pango layout - pango_context = gtk_widget_get_pango_context (widget); - - pango_layout = pango_layout_new (pango_context); - - PangoFontDescription *fs = pango_font_description_new (); - pango_font_description_set_size (fs, RULER_FONT_SIZE); - pango_layout_set_font_description (pango_layout, fs); - pango_font_description_free (fs); - - digit_height = (int) floor (RULER_FONT_SIZE * RULER_FONT_VERTICAL_SPACING / PANGO_SCALE + 0.5); - - xthickness = widget->style->xthickness; - ythickness = widget->style->ythickness; - - width = widget->allocation.height; //in pixels; is apparently 2 pixels shorter than the canvas at each end - height = widget->allocation.width;// - ythickness * 2; - - gtk_paint_box (widget->style, ruler->backing_store, - GTK_STATE_NORMAL, GTK_SHADOW_NONE, - NULL, widget, "vruler", - 0, 0, - widget->allocation.width, widget->allocation.height); - - upper = ruler->upper / ruler->metric->pixels_per_unit; // upper and lower are expressed in ruler units - lower = ruler->lower / ruler->metric->pixels_per_unit; - /* "pixels_per_unit" should be "points_per_unit". This is the size of the unit - * in 1/72nd's of an inch and has nothing to do with screen pixels */ - - if ((upper - lower) == 0) - return; - increment = (double) (width + 2*UNUSED_PIXELS) / (upper - lower); // screen pixels per ruler unit - - /* determine the scale - * use the maximum extents of the ruler to determine the largest - * possible number to be displayed. Calculate the height in pixels - * of this displayed text. Use this height to find a scale which - * leaves sufficient room for drawing the ruler. - */ - scale = (int)ceil (ruler->max_size / ruler->metric->pixels_per_unit); - sprintf (unit_str, "%d", scale); - text_height = strlen (unit_str) * digit_height + 1; - - for (scale = 0; scale < MAXIMUM_SCALES; scale++) - if (ruler->metric->ruler_scale[scale] * fabs(increment) > 2 * text_height) - break; - - if (scale == MAXIMUM_SCALES) - scale = MAXIMUM_SCALES - 1; - - /* drawing starts here */ - length = 0; - for (i = MAXIMUM_SUBDIVIDE - 1; i >= 0; i--) { - subd_incr = (double) ruler->metric->ruler_scale[scale] / - (double) ruler->metric->subdivide[i]; - if (subd_incr * fabs(increment) <= MINIMUM_INCR) - continue; - - /* Calculate the length of the tickmarks. Make sure that - * this length increases for each set of ticks - */ - ideal_length = height / (i + 1) - 1; - if (ideal_length > ++length) - length = ideal_length; - - if (lower < upper) - { - start = floor (lower / subd_incr) * subd_incr; - end = ceil (upper / subd_incr) * subd_incr; - } - else - { - start = floor (upper / subd_incr) * subd_incr; - end = ceil (lower / subd_incr) * subd_incr; - } - - tick_index = 0; - cur = start; // location (in ruler units) of the first invisible tick at the top side of the canvas - - while (cur < end) { - // due to the typical values for cur, lower and increment, pos will often end up to - // be e.g. 641.50000000000; rounding behaviour is not defined in such a case (see round.h) - // and jitter will be apparent (upon redrawing some of the lines on the ruler might jump a - // by a pixel, and jump back on the next redraw). This is suppressed by adding 1e-9 (that's only one nanopixel ;-)) - pos = int(Inkscape::round((cur - lower) * increment + 1e-12)) - UNUSED_PIXELS; - - gdk_draw_line (ruler->backing_store, gc, - height + xthickness - length, pos, - height + xthickness, pos); - - /* draw label */ - double label_spacing_px = fabs((increment*(double)ruler->metric->ruler_scale[scale])/ruler->metric->subdivide[i]); - if (i == 0 && - (label_spacing_px > 6*digit_height || tick_index%2 == 0 || cur == 0) && - (label_spacing_px > 3*digit_height || tick_index%4 == 0 || cur == 0)) - { - if (fabs((int)cur) >= 2000 && (((int) cur)/1000)*1000 == ((int) cur)) - sprintf (unit_str, "%dk", ((int) cur)/1000); - else - sprintf (unit_str, "%d", (int) cur); - for (j = 0; j < (int) strlen (unit_str); j++) - { - digit_str[0] = unit_str[j]; - - pango_layout_set_text (pango_layout, digit_str, 1); - - gdk_draw_layout (ruler->backing_store, gc, - xthickness + 1, - pos + digit_height * (j) + 1, - pango_layout); - } - } - - /* Calculate cur from start rather than incrementing by subd_incr - * in each iteration. This is to avoid propagation of floating point - * errors in subd_incr. - */ - ++tick_index; - cur = start + tick_index * subd_incr; - } - } + requisition->width = widget->style->xthickness * 2 + RULER_WIDTH; } static void -sp_vruler_draw_pos (GtkRuler *ruler) +sp_ruler_common_draw_ticks (GtkRuler *ruler) { - GtkWidget *widget; - GdkGC *gc; - int i; - gint x, y; - gint width, height; - gint bs_width, bs_height; - gint xthickness; - gint ythickness; - gfloat increment; - - g_return_if_fail (ruler != NULL); - g_return_if_fail (SP_IS_VRULER (ruler)); - - if (GTK_WIDGET_DRAWABLE (ruler)) - { - widget = GTK_WIDGET (ruler); - - gc = widget->style->fg_gc[GTK_STATE_NORMAL]; - xthickness = widget->style->xthickness; - ythickness = widget->style->ythickness; - width = widget->allocation.width - xthickness * 2; - height = widget->allocation.height; // in pixels; is apparently 2 pixels shorter than the canvas at each end - - bs_height = width / 2; - bs_height |= 1; /* make sure it's odd */ - bs_width = bs_height / 2 + 1; - - if ((bs_width > 0) && (bs_height > 0)) - { - /* If a backing store exists, restore the ruler */ - if (ruler->backing_store && ruler->non_gr_exp_gc) - gdk_draw_pixmap (ruler->widget.window, - ruler->non_gr_exp_gc, - ruler->backing_store, - ruler->xsrc, ruler->ysrc, - ruler->xsrc, ruler->ysrc, - bs_width, bs_height); - - increment = (gfloat) (height + 2*UNUSED_PIXELS) / (ruler->upper - ruler->lower); - - // Calculate the coordinates (x, y, in pixels) of the tip of the triangle - x = (width + bs_width) / 2 + xthickness; - y = int(Inkscape::round((ruler->position - ruler->lower) * increment + double(ythickness - bs_height) / 2.0) - UNUSED_PIXELS); - - for (i = 0; i < bs_width; i++) - gdk_draw_line (widget->window, gc, - x + i, y + i, - x + i, y + bs_height - 1 - i); - - ruler->xsrc = x; - ruler->ysrc = y; - } + GtkWidget *widget; + GdkGC *gc, *bg_gc; + PangoFontDescription *pango_desc; + PangoContext *pango_context; + PangoLayout *pango_layout; + gint i, j, tick_index; + gint width, height; + gint xthickness; + gint ythickness; + gint length, ideal_length; + double lower, upper; /* Upper and lower limits, in ruler units */ + double increment; /* Number of pixels per unit */ + gint scale; /* Number of units per major unit */ + double subd_incr; + double start, end, cur; + gchar unit_str[32]; + gchar digit_str[2] = { '\0', '\0' }; + gint digit_height; + //gint text_width, text_height; + gint text_dimension; + gint pos; + GtkOrientation orientation; + + g_return_if_fail (ruler != NULL); + + if (!GTK_WIDGET_DRAWABLE (ruler)) + return; + + g_object_get(G_OBJECT(ruler), "orientation", &orientation, NULL); + widget = GTK_WIDGET (ruler); + gc = widget->style->fg_gc[GTK_STATE_NORMAL]; + bg_gc = widget->style->bg_gc[GTK_STATE_NORMAL]; + + pango_desc = widget->style->font_desc; + pango_context = gtk_widget_get_pango_context (widget); + pango_layout = pango_layout_new (pango_context); + PangoFontDescription *fs = pango_font_description_new (); + pango_font_description_set_size (fs, RULER_FONT_SIZE); + pango_layout_set_font_description (pango_layout, fs); + pango_font_description_free (fs); + + digit_height = (int) floor (RULER_FONT_SIZE * RULER_FONT_VERTICAL_SPACING / PANGO_SCALE + 0.5); + xthickness = widget->style->xthickness; + ythickness = widget->style->ythickness; + + if (orientation == GTK_ORIENTATION_HORIZONTAL) { + width = widget->allocation.width; // in pixels; is apparently 2 pixels shorter than the canvas at each end + height = widget->allocation.height; + } else { + width = widget->allocation.height; + height = widget->allocation.width; } -} -static void -sp_vruler_size_request (GtkWidget *widget, GtkRequisition *requisition) -{ - requisition->width = widget->style->xthickness * 2 + RULER_WIDTH; -} + gtk_paint_box (widget->style, ruler->backing_store, + GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, widget, + orientation == GTK_ORIENTATION_HORIZONTAL ? "hruler" : "vruler", + 0, 0, + widget->allocation.width, widget->allocation.height); + + upper = ruler->upper / ruler->metric->pixels_per_unit; // upper and lower are expressed in ruler units + lower = ruler->lower / ruler->metric->pixels_per_unit; + /* "pixels_per_unit" should be "points_per_unit". This is the size of the unit + * in 1/72nd's of an inch and has nothing to do with screen pixels */ + + if ((upper - lower) == 0) + return; + + increment = (double) (width + 2*UNUSED_PIXELS) / (upper - lower); // screen pixels per ruler unit + + /* determine the scale + * For vruler, use the maximum extents of the ruler to determine the largest + * possible number to be displayed. Calculate the height in pixels + * of this displayed text. Use this height to find a scale which + * leaves sufficient room for drawing the ruler. + * For hruler, we calculate the text size as for the vruler instead of using + * text_width = gdk_string_width(font, unit_str), so that the result + * for the scale looks consistent with an accompanying vruler + */ + scale = (int)(ceil (ruler->max_size / ruler->metric->pixels_per_unit)); + sprintf (unit_str, "%d", scale); + text_dimension = strlen (unit_str) * digit_height + 1; + + for (scale = 0; scale < MAXIMUM_SCALES; scale++) + if (ruler->metric->ruler_scale[scale] * fabs(increment) > 2 * text_dimension) + break; + + if (scale == MAXIMUM_SCALES) + scale = MAXIMUM_SCALES - 1; + + /* drawing starts here */ + length = 0; + for (i = MAXIMUM_SUBDIVIDE - 1; i >= 0; i--) { + subd_incr = ruler->metric->ruler_scale[scale] / + ruler->metric->subdivide[i]; + if (subd_incr * fabs(increment) <= MINIMUM_INCR) + continue; + + /* Calculate the length of the tickmarks. Make sure that + * this length increases for each set of ticks + */ + ideal_length = height / (i + 1) - 1; + if (ideal_length > ++length) + length = ideal_length; + + if (lower < upper) { + start = floor (lower / subd_incr) * subd_incr; + end = ceil (upper / subd_incr) * subd_incr; + } else { + start = floor (upper / subd_incr) * subd_incr; + end = ceil (lower / subd_incr) * subd_incr; + } + tick_index = 0; + cur = start; // location (in ruler units) of the first invisible tick at the left side of the canvas -/** - * The vruler widget's size_allocate callback. - */ -static void -sp_vruler_size_allocate (GtkWidget *widget, GtkAllocation *allocation) -{ - g_assert (widget != NULL); - g_assert (SP_IS_VRULER (widget)); - - // First call the default gtk_widget_size_allocate() method (which is being overridden here) - if (GTK_WIDGET_CLASS (vruler_parent_class)->size_allocate) - (* GTK_WIDGET_CLASS (vruler_parent_class)->size_allocate) (widget, allocation); - - // Now the size of the ruler has changed, the ruler bounds (upper & lower) need to be updated - // For this we first need to obtain a pointer to the desktop, by walking up the tree of ancestors - GtkWidget *parent = gtk_widget_get_parent(widget); - do { - if (SP_IS_DESKTOP_WIDGET(parent)) { - // Now we've found the desktop widget we can have the ruler boundaries updated - sp_desktop_widget_update_vruler(SP_DESKTOP_WIDGET(parent)); - // If the size of the ruler has increased, then a blank part is uncovered; therefore - // it must be redrawn - sp_vruler_draw_ticks(GTK_RULER(widget)); - break; + while (cur <= end) { + // due to the typical values for cur, lower and increment, pos will often end up to + // be e.g. 641.50000000000; rounding behaviour is not defined in such a case (see round.h) + // and jitter will be apparent (upon redrawing some of the lines on the ruler might jump a + // by a pixel, and jump back on the next redraw). This is suppressed by adding 1e-9 (that's only one nanopixel ;-)) + pos = int(Inkscape::round((cur - lower) * increment + 1e-12)) - UNUSED_PIXELS; + + if (orientation == GTK_ORIENTATION_HORIZONTAL) { + gdk_draw_line (ruler->backing_store, gc, + pos, height + ythickness, + pos, height - length + ythickness); + } else { + gdk_draw_line (ruler->backing_store, gc, + height + xthickness - length, pos, + height + xthickness, pos); + } + + /* draw label */ + double label_spacing_px = fabs((increment*(double)ruler->metric->ruler_scale[scale])/ruler->metric->subdivide[i]); + if (i == 0 && + (label_spacing_px > 6*digit_height || tick_index%2 == 0 || cur == 0) && + (label_spacing_px > 3*digit_height || tick_index%4 == 0 || cur == 0)) + { + if (fabs((int)cur) >= 2000 && (((int) cur)/1000)*1000 == ((int) cur)) + sprintf (unit_str, "%dk", ((int) cur)/1000); + else + sprintf (unit_str, "%d", (int) cur); + + if (orientation == GTK_ORIENTATION_HORIZONTAL) { + pango_layout_set_text (pango_layout, unit_str, -1); + gdk_draw_layout (ruler->backing_store, gc, + pos + 2, 0, pango_layout); + } else { + for (j = 0; j < (int) strlen (unit_str); j++) { + digit_str[0] = unit_str[j]; + pango_layout_set_text (pango_layout, digit_str, 1); + + gdk_draw_layout (ruler->backing_store, gc, + xthickness + 1, + pos + digit_height * (j) + 1, + pango_layout); + } + } + } + /* Calculate cur from start rather than incrementing by subd_incr + * in each iteration. This is to avoid propagation of floating point + * errors in subd_incr. + */ + ++tick_index; + cur = start + tick_index * subd_incr; } - parent = gtk_widget_get_parent(parent); - } while (parent != NULL); + } } //TODO: warning: deprecated conversion from string constant to âgchar*â diff --git a/src/widgets/ruler.h b/src/widgets/ruler.h index 9e685771b..7a3509325 100644 --- a/src/widgets/ruler.h +++ b/src/widgets/ruler.h @@ -80,4 +80,4 @@ GtkWidget* sp_vruler_new (void); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp index e2ad61e2d..ed54857f8 100644 --- a/src/widgets/select-toolbar.cpp +++ b/src/widgets/select-toolbar.cpp @@ -455,25 +455,19 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb // four spinbuttons - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - eact = create_adjustment_action( "XAction", _("select toolbar|X position"), _("select toolbar|X"), "X", + eact = create_adjustment_action( "XAction", C_("Select toolbar", "X position"), C_("Select toolbar", "X:"), "X", -1e6, GTK_WIDGET(desktop->canvas), tracker, spw, _("Horizontal coordinate of selection"), TRUE ); gtk_action_group_add_action( selectionActions, GTK_ACTION(eact) ); contextActions->push_back( GTK_ACTION(eact) ); - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - eact = create_adjustment_action( "YAction", _("select toolbar|Y position"), _("select toolbar|Y"), "Y", + eact = create_adjustment_action( "YAction", C_("Select toolbar", "Y position"), C_("Select toolbar", "Y:"), "Y", -1e6, GTK_WIDGET(desktop->canvas), tracker, spw, _("Vertical coordinate of selection"), FALSE ); gtk_action_group_add_action( selectionActions, GTK_ACTION(eact) ); contextActions->push_back( GTK_ACTION(eact) ); - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - eact = create_adjustment_action( "WidthAction", _("select toolbar|Width"), _("select toolbar|W"), "width", + eact = create_adjustment_action( "WidthAction", C_("Select toolbar", "Width"), C_("Select toolbar", "W:"), "width", 1e-3, GTK_WIDGET(desktop->canvas), tracker, spw, _("Width of selection"), FALSE ); gtk_action_group_add_action( selectionActions, GTK_ACTION(eact) ); @@ -492,9 +486,7 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb gtk_action_group_add_action( mainActions, GTK_ACTION(itact) ); } - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - eact = create_adjustment_action( "HeightAction", _("select toolbar|Height"), _("select toolbar|H"), "height", + eact = create_adjustment_action( "HeightAction", C_("Select toolbar", "Height"), C_("Select toolbar", "H:"), "height", 1e-3, GTK_WIDGET(desktop->canvas), tracker, spw, _("Height of selection"), FALSE ); gtk_action_group_add_action( selectionActions, GTK_ACTION(eact) ); diff --git a/src/widgets/select-toolbar.h b/src/widgets/select-toolbar.h index fe5a0b8da..dbab1975a 100644 --- a/src/widgets/select-toolbar.h +++ b/src/widgets/select-toolbar.h @@ -32,4 +32,4 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/shrink-wrap-button.cpp b/src/widgets/shrink-wrap-button.cpp index c1775005c..d73f972d9 100644 --- a/src/widgets/shrink-wrap-button.cpp +++ b/src/widgets/shrink-wrap-button.cpp @@ -52,4 +52,4 @@ void shrink_wrap_button(Gtk::Button &button) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/shrink-wrap-button.h b/src/widgets/shrink-wrap-button.h index ce615960f..ca9153aea 100644 --- a/src/widgets/shrink-wrap-button.h +++ b/src/widgets/shrink-wrap-button.h @@ -32,4 +32,4 @@ void shrink_wrap_button(Gtk::Button &button); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/sp-attribute-widget.cpp b/src/widgets/sp-attribute-widget.cpp index de14fc173..3473d8f31 100644 --- a/src/widgets/sp-attribute-widget.cpp +++ b/src/widgets/sp-attribute-widget.cpp @@ -787,4 +787,4 @@ sp_attribute_table_entry_changed ( GtkEditable *editable, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/sp-attribute-widget.h b/src/widgets/sp-attribute-widget.h index 01da29bed..2703bd98a 100644 --- a/src/widgets/sp-attribute-widget.h +++ b/src/widgets/sp-attribute-widget.h @@ -127,4 +127,4 @@ void sp_attribute_table_set_repr ( SPAttributeTable *spw, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/sp-color-icc-selector.cpp b/src/widgets/sp-color-icc-selector.cpp index 6bd1957a8..4b565d1a3 100644 --- a/src/widgets/sp-color-icc-selector.cpp +++ b/src/widgets/sp-color-icc-selector.cpp @@ -217,12 +217,12 @@ void getThings( DWORD space, gchar const**& namers, gchar const**& tippies, guin // {"_Y", "C_b", "C_r", "", "", ""}, {"_Y", "_x", "y", "", "", ""}, - {_("_R"), _("_G"), _("_B"), "", "", ""}, - {_("_G"), "", "", "", "", ""}, - {_("_H"), _("_S"), "_V", "", "", ""}, - {_("_H"), _("_L"), _("_S"), "", "", ""}, - {_("_C"), _("_M"), _("_Y"), _("_K"), "", ""}, - {_("_C"), _("_M"), _("_Y"), "", "", ""}, + {_("_R:"), _("_G:"), _("_B:"), "", "", ""}, + {_("_G:"), "", "", "", "", ""}, + {_("_H:"), _("_S:"), "_V:", "", "", ""}, + {_("_H:"), _("_L:"), _("_S:"), "", "", ""}, + {_("_C:"), _("_M:"), _("_Y:"), _("_K:"), "", ""}, + {_("_C:"), _("_M:"), _("_Y:"), "", "", ""}, }; static gchar const *tips[][6] = { @@ -377,7 +377,7 @@ void ColorICCSelector::init() } /* Label */ - _label = gtk_label_new_with_mnemonic (_("_A")); + _label = gtk_label_new_with_mnemonic (_("_A:")); gtk_misc_set_alignment (GTK_MISC (_label), 1.0, 0.5); gtk_widget_show (_label); gtk_table_attach (GTK_TABLE (t), _label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD); @@ -933,4 +933,4 @@ void ColorICCSelector::_sliderChanged( SPColorSlider */*slider*/, SPColorICCSele fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/sp-color-icc-selector.h b/src/widgets/sp-color-icc-selector.h index dfba71a09..9fd80c04a 100644 --- a/src/widgets/sp-color-icc-selector.h +++ b/src/widgets/sp-color-icc-selector.h @@ -115,4 +115,4 @@ GtkWidget *sp_color_icc_selector_new (void); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/sp-color-notebook.cpp b/src/widgets/sp-color-notebook.cpp index 6c5113084..8429434a6 100644 --- a/src/widgets/sp-color-notebook.cpp +++ b/src/widgets/sp-color-notebook.cpp @@ -725,4 +725,4 @@ void ColorNotebook::removePage( GType page_type, guint submode ) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/sp-color-notebook.h b/src/widgets/sp-color-notebook.h index 5eb29ac73..0b9b2ed87 100644 --- a/src/widgets/sp-color-notebook.h +++ b/src/widgets/sp-color-notebook.h @@ -116,5 +116,5 @@ GtkWidget *sp_color_notebook_new (void); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/sp-color-scales.cpp b/src/widgets/sp-color-scales.cpp index d20cf65ef..fb8bb0795 100644 --- a/src/widgets/sp-color-scales.cpp +++ b/src/widgets/sp-color-scales.cpp @@ -401,16 +401,16 @@ void ColorScales::setMode(SPColorScalesMode mode) switch (mode) { case SP_COLOR_SCALES_MODE_RGB: _setRangeLimit(255.0); - gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[0]), _("_R")); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[0]), _("_R:")); gtk_tooltips_set_tip (_tt, _s[0], _("Red"), NULL); gtk_tooltips_set_tip (_tt, _b[0], _("Red"), NULL); - gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[1]), _("_G")); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[1]), _("_G:")); gtk_tooltips_set_tip (_tt, _s[1], _("Green"), NULL); gtk_tooltips_set_tip (_tt, _b[1], _("Green"), NULL); - gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[2]), _("_B")); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[2]), _("_B:")); gtk_tooltips_set_tip (_tt, _s[2], _("Blue"), NULL); gtk_tooltips_set_tip (_tt, _b[2], _("Blue"), NULL); - gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[3]), _("_A")); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[3]), _("_A:")); gtk_tooltips_set_tip (_tt, _s[3], _("Alpha (opacity)"), NULL); gtk_tooltips_set_tip (_tt, _b[3], _("Alpha (opacity)"), NULL); sp_color_slider_set_map (SP_COLOR_SLIDER (_s[0]), NULL); @@ -427,16 +427,16 @@ void ColorScales::setMode(SPColorScalesMode mode) break; case SP_COLOR_SCALES_MODE_HSV: _setRangeLimit(255.0); - gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[0]), _("_H")); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[0]), _("_H:")); gtk_tooltips_set_tip (_tt, _s[0], _("Hue"), NULL); gtk_tooltips_set_tip (_tt, _b[0], _("Hue"), NULL); - gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[1]), _("_S")); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[1]), _("_S:")); gtk_tooltips_set_tip (_tt, _s[1], _("Saturation"), NULL); gtk_tooltips_set_tip (_tt, _b[1], _("Saturation"), NULL); - gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[2]), _("_L")); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[2]), _("_L:")); gtk_tooltips_set_tip (_tt, _s[2], _("Lightness"), NULL); gtk_tooltips_set_tip (_tt, _b[2], _("Lightness"), NULL); - gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[3]), _("_A")); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[3]), _("_A:")); gtk_tooltips_set_tip (_tt, _s[3], _("Alpha (opacity)"), NULL); gtk_tooltips_set_tip (_tt, _b[3], _("Alpha (opacity)"), NULL); sp_color_slider_set_map (SP_COLOR_SLIDER (_s[0]), (guchar*)sp_color_scales_hue_map ()); @@ -455,19 +455,19 @@ void ColorScales::setMode(SPColorScalesMode mode) break; case SP_COLOR_SCALES_MODE_CMYK: _setRangeLimit(100.0); - gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[0]), _("_C")); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[0]), _("_C:")); gtk_tooltips_set_tip (_tt, _s[0], _("Cyan"), NULL); gtk_tooltips_set_tip (_tt, _b[0], _("Cyan"), NULL); - gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[1]), _("_M")); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[1]), _("_M:")); gtk_tooltips_set_tip (_tt, _s[1], _("Magenta"), NULL); gtk_tooltips_set_tip (_tt, _b[1], _("Magenta"), NULL); - gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[2]), _("_Y")); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[2]), _("_Y:")); gtk_tooltips_set_tip (_tt, _s[2], _("Yellow"), NULL); gtk_tooltips_set_tip (_tt, _b[2], _("Yellow"), NULL); - gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[3]), _("_K")); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[3]), _("_K:")); gtk_tooltips_set_tip (_tt, _s[3], _("Black"), NULL); gtk_tooltips_set_tip (_tt, _b[3], _("Black"), NULL); - gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[4]), _("_A")); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[4]), _("_A:")); gtk_tooltips_set_tip (_tt, _s[4], _("Alpha (opacity)"), NULL); gtk_tooltips_set_tip (_tt, _b[4], _("Alpha (opacity)"), NULL); sp_color_slider_set_map (SP_COLOR_SLIDER (_s[0]), NULL); diff --git a/src/widgets/sp-color-selector.cpp b/src/widgets/sp-color-selector.cpp index 203bc3c2a..c6f13b391 100644 --- a/src/widgets/sp-color-selector.cpp +++ b/src/widgets/sp-color-selector.cpp @@ -338,10 +338,6 @@ void ColorSelector::getColorAlpha( SPColor &color, gfloat &alpha ) const { i++; } - if ( color.v.c[3] ) - { - i++; - } if ( alpha ) { i++; @@ -357,4 +353,4 @@ void ColorSelector::getColorAlpha( SPColor &color, gfloat &alpha ) const fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/sp-color-selector.h b/src/widgets/sp-color-selector.h index a2ad87dd5..3b35140ed 100644 --- a/src/widgets/sp-color-selector.h +++ b/src/widgets/sp-color-selector.h @@ -99,4 +99,4 @@ GtkWidget *sp_color_selector_new( GType selector_type ); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/sp-color-wheel-selector.cpp b/src/widgets/sp-color-wheel-selector.cpp index 6012f4e20..5ba2c347b 100644 --- a/src/widgets/sp-color-wheel-selector.cpp +++ b/src/widgets/sp-color-wheel-selector.cpp @@ -132,7 +132,7 @@ void ColorWheelSelector::init() row++; /* Label */ - _label = gtk_label_new_with_mnemonic (_("_A")); + _label = gtk_label_new_with_mnemonic (_("_A:")); gtk_misc_set_alignment (GTK_MISC (_label), 1.0, 0.5); gtk_widget_show (_label); gtk_table_attach (GTK_TABLE (t), _label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD); @@ -311,4 +311,4 @@ void ColorWheelSelector::_wheelChanged( SPColorWheel *wheel, SPColorWheelSelecto fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/sp-color-wheel-selector.h b/src/widgets/sp-color-wheel-selector.h index df8819bc9..1adbb65a7 100644 --- a/src/widgets/sp-color-wheel-selector.h +++ b/src/widgets/sp-color-wheel-selector.h @@ -87,4 +87,4 @@ GtkWidget *sp_color_wheel_selector_new (void); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/sp-color-wheel.cpp b/src/widgets/sp-color-wheel.cpp index 5e1547e10..ade226c0f 100644 --- a/src/widgets/sp-color-wheel.cpp +++ b/src/widgets/sp-color-wheel.cpp @@ -1158,4 +1158,4 @@ static void sp_color_wheel_process_in_triangle( SPColorWheel *wheel, gdouble x, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/sp-color-wheel.h b/src/widgets/sp-color-wheel.h index 699750bed..d62c26782 100644 --- a/src/widgets/sp-color-wheel.h +++ b/src/widgets/sp-color-wheel.h @@ -77,4 +77,4 @@ gboolean sp_color_wheel_is_adjusting( SPColorWheel *wheel ); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/spinbutton-events.h b/src/widgets/spinbutton-events.h index 868bc195a..683748d0a 100644 --- a/src/widgets/spinbutton-events.h +++ b/src/widgets/spinbutton-events.h @@ -27,4 +27,4 @@ void spinbutton_defocus (GtkObject *container); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/spw-utilities.cpp b/src/widgets/spw-utilities.cpp index 0e191b002..7c2956c65 100644 --- a/src/widgets/spw-utilities.cpp +++ b/src/widgets/spw-utilities.cpp @@ -278,4 +278,4 @@ sp_search_by_value_recursive (GtkWidget *w, gchar *key, gchar *value) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/spw-utilities.h b/src/widgets/spw-utilities.h index 5c4018199..d17762811 100644 --- a/src/widgets/spw-utilities.h +++ b/src/widgets/spw-utilities.h @@ -72,4 +72,4 @@ GtkWidget *sp_search_by_value_recursive(GtkWidget *w, gchar *key, gchar *value); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index 3e628c2cf..43bc5fc07 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -671,10 +671,7 @@ sp_stroke_style_line_widget_new(void) gint i = 0; - //TRANSLATORS: only translate "string" in "context|string". - // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - /* Stroke width */ - spw_label(t, Q_("StrokeWidth|Width:"), 0, i); + spw_label(t, C_("Stroke width", "Width:"), 0, i); hb = spw_hbox(t, 3, 1, i); @@ -1474,4 +1471,4 @@ ink_extract_marker_name(gchar const *n, SPDocument *doc) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/stroke-style.h b/src/widgets/stroke-style.h index 72dc5449a..b8ab05810 100644 --- a/src/widgets/stroke-style.h +++ b/src/widgets/stroke-style.h @@ -35,4 +35,4 @@ void sp_stroke_style_widget_set_desktop(Gtk::Widget *widget, SPDesktop *desktop) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/swatch-selector.cpp b/src/widgets/swatch-selector.cpp index 88abca358..3c209a45d 100644 --- a/src/widgets/swatch-selector.cpp +++ b/src/widgets/swatch-selector.cpp @@ -202,4 +202,4 @@ void SwatchSelector::setVector(SPDocument */*doc*/, SPGradient *vector) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/swatch-selector.h b/src/widgets/swatch-selector.h index 83acf9fda..b97aac4f1 100644 --- a/src/widgets/swatch-selector.h +++ b/src/widgets/swatch-selector.h @@ -55,5 +55,5 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 08e463ea4..0c94f5d68 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -303,7 +303,7 @@ static gchar const * ui_descr = " <separator />" " <toolitem action='ObjectEditClipPathAction' />" " <toolitem action='ObjectEditMaskPathAction' />" - " <toolitem action='EditNextLPEParameterAction' />" + " <toolitem action='EditNextPathEffectParameter' />" " <separator />" " <toolitem action='NodesShowTransformHandlesAction' />" " <toolitem action='NodesShowHandlesAction' />" @@ -827,14 +827,14 @@ GtkWidget * sp_toolbox_button_new_from_verb_with_doubleclick(GtkWidget *t, Inksc unsigned int shortcut = sp_shortcut_get_primary(verb); - if (shortcut) { - gchar key[256]; - sp_ui_shortcut_string(shortcut, key); + if (shortcut != GDK_VoidSymbol) { + gchar *key = sp_shortcut_get_label(shortcut); gchar *tip = g_strdup_printf ("%s (%s)", action->tip, key); if ( t ) { gtk_toolbar_append_widget( GTK_TOOLBAR(t), b, tip, 0 ); } g_free(tip); + g_free(key); } else { if ( t ) { gtk_toolbar_append_widget( GTK_TOOLBAR(t), b, action->tip, 0 ); @@ -1500,9 +1500,10 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions } { - InkAction* inky = ink_action_new( "EditNextLPEParameterAction", - _("Next path effect parameter"), - _("Show next editable path effect parameter"), + Inkscape::Verb* verb = Inkscape::Verb::get(SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER); + InkAction* inky = ink_action_new( verb->get_id(), + verb->get_name(), + verb->get_tip(), INKSCAPE_ICON_PATH_EFFECT_PARAMETER_NEXT, secondarySize ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_nextLPEparam), desktop ); @@ -2175,8 +2176,13 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) Inkscape::IconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1); { - InkToggleAction* act = ink_toggle_action_new("ToggleSnapGlobal", - _("Snap"), _("Enable snapping"), INKSCAPE_ICON_SNAP, secondarySize, + // TODO: This is a cludge. On the one hand we have verbs+actions, + // on the other we have all these explicit callbacks specified here. + // We should really unify these (should save some lines of code as well). + // For example, this action could be based on the verb(+action) + PrefsPusher. + Inkscape::Verb* verb = Inkscape::Verb::get(SP_VERB_TOGGLE_SNAPPING); + InkToggleAction* act = ink_toggle_action_new(verb->get_id(), + verb->get_name(), verb->get_tip(), INKSCAPE_ICON_SNAP, secondarySize, SP_ATTR_INKSCAPE_SNAP_GLOBAL); gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) ); @@ -8461,4 +8467,4 @@ static void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/toolbox.h b/src/widgets/toolbox.h index 2e4b2958a..a25705536 100644 --- a/src/widgets/toolbox.h +++ b/src/widgets/toolbox.h @@ -68,4 +68,4 @@ void sp_toolbox_add_label(GtkWidget *tbl, gchar const *title, bool wide = true); fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/widgets/widget-sizes.h b/src/widgets/widget-sizes.h index c63890bd0..644740637 100644 --- a/src/widgets/widget-sizes.h +++ b/src/widgets/widget-sizes.h @@ -49,4 +49,4 @@ fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/comment-node.h b/src/xml/comment-node.h index 698a30a90..2232fb61e 100644 --- a/src/xml/comment-node.h +++ b/src/xml/comment-node.h @@ -55,4 +55,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/composite-node-observer.cpp b/src/xml/composite-node-observer.cpp index 564938dda..36fe469de 100644 --- a/src/xml/composite-node-observer.cpp +++ b/src/xml/composite-node-observer.cpp @@ -308,4 +308,4 @@ void CompositeNodeObserver::removeListenerByData(void *data) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/composite-node-observer.h b/src/xml/composite-node-observer.h index 826467dc4..96825d607 100644 --- a/src/xml/composite-node-observer.h +++ b/src/xml/composite-node-observer.h @@ -106,4 +106,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/croco-node-iface.cpp b/src/xml/croco-node-iface.cpp index db98e3d01..afea4abba 100644 --- a/src/xml/croco-node-iface.cpp +++ b/src/xml/croco-node-iface.cpp @@ -75,4 +75,4 @@ CRNodeIface const croco_node_iface = { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/document.h b/src/xml/document.h index 2b9ea5cc3..98cc0522e 100644 --- a/src/xml/document.h +++ b/src/xml/document.h @@ -118,4 +118,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/element-node.h b/src/xml/element-node.h index 7b75f8080..12df8dc97 100644 --- a/src/xml/element-node.h +++ b/src/xml/element-node.h @@ -51,4 +51,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/event.h b/src/xml/event.h index c62257751..18dc47865 100644 --- a/src/xml/event.h +++ b/src/xml/event.h @@ -245,4 +245,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/invalid-operation-exception.h b/src/xml/invalid-operation-exception.h index fa3f740d1..d9d743557 100644 --- a/src/xml/invalid-operation-exception.h +++ b/src/xml/invalid-operation-exception.h @@ -44,4 +44,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/log-builder.cpp b/src/xml/log-builder.cpp index 5ff09a0e0..951cd4029 100644 --- a/src/xml/log-builder.cpp +++ b/src/xml/log-builder.cpp @@ -75,4 +75,4 @@ void LogBuilder::setAttribute(Node &node, GQuark name, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/log-builder.h b/src/xml/log-builder.h index 0a161d18f..264c2ced7 100644 --- a/src/xml/log-builder.h +++ b/src/xml/log-builder.h @@ -81,4 +81,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/node-fns.cpp b/src/xml/node-fns.cpp index bf860d8f3..20e9fbc38 100644 --- a/src/xml/node-fns.cpp +++ b/src/xml/node-fns.cpp @@ -88,4 +88,4 @@ Node *previous_node(Node *node) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/node-fns.h b/src/xml/node-fns.h index 4c6408789..f6b1173db 100644 --- a/src/xml/node-fns.h +++ b/src/xml/node-fns.h @@ -85,4 +85,4 @@ inline Node const *parent_node(Node const *node) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/node-iterators.h b/src/xml/node-iterators.h index 0868fb2ab..3d09dfd1b 100644 --- a/src/xml/node-iterators.h +++ b/src/xml/node-iterators.h @@ -58,4 +58,4 @@ typedef Inkscape::Util::ForwardPointerIterator<Node const, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/node-observer.h b/src/xml/node-observer.h index ca787c269..c3ec437b5 100644 --- a/src/xml/node-observer.h +++ b/src/xml/node-observer.h @@ -160,4 +160,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/node.h b/src/xml/node.h index abcccdb9a..17479e50b 100644 --- a/src/xml/node.h +++ b/src/xml/node.h @@ -471,4 +471,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/pi-node.h b/src/xml/pi-node.h index 4aa1f840b..e1f59ab27 100644 --- a/src/xml/pi-node.h +++ b/src/xml/pi-node.h @@ -53,4 +53,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/quote-test.h b/src/xml/quote-test.h index cfcb3bef2..bd5c1f54c 100644 --- a/src/xml/quote-test.h +++ b/src/xml/quote-test.h @@ -79,4 +79,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/quote.cpp b/src/xml/quote.cpp index 37f00bad0..e569ed818 100644 --- a/src/xml/quote.cpp +++ b/src/xml/quote.cpp @@ -83,4 +83,4 @@ xml_quote_strdup(char const *src) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/repr-action-test.h b/src/xml/repr-action-test.h index 8fe1327af..afc9b2c46 100644 --- a/src/xml/repr-action-test.h +++ b/src/xml/repr-action-test.h @@ -100,4 +100,4 @@ public: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/repr-css.cpp b/src/xml/repr-css.cpp index be125f453..dc6494bcd 100644 --- a/src/xml/repr-css.cpp +++ b/src/xml/repr-css.cpp @@ -299,4 +299,4 @@ sp_repr_css_change_recursive(Node *repr, SPCSSAttr *css, gchar const *attr) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index fa5e9b6ed..b1320a4a3 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -20,6 +20,8 @@ #include <string> #include <stdexcept> +#include <libxml/parser.h> + #include "xml/repr.h" #include "xml/attribute-record.h" #include "xml/rebase-hrefs.h" @@ -294,7 +296,7 @@ sp_repr_read_file (const gchar * filename, const gchar *default_ns) &src, localFilename, src.getEncoding(), - XML_PARSE_NOENT ); + XML_PARSE_NOENT | XML_PARSE_HUGE); } } @@ -988,4 +990,4 @@ sp_repr_write_stream_element (Node * repr, Writer & out, gint indent_level, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/repr-sorting.cpp b/src/xml/repr-sorting.cpp index 27293d3c2..df1d2cbb8 100644 --- a/src/xml/repr-sorting.cpp +++ b/src/xml/repr-sorting.cpp @@ -50,4 +50,4 @@ AncetreFils(Inkscape::XML::Node *descendent, Inkscape::XML::Node *ancestor) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/repr-sorting.h b/src/xml/repr-sorting.h index 37f719622..7d5542f67 100644 --- a/src/xml/repr-sorting.h +++ b/src/xml/repr-sorting.h @@ -22,4 +22,4 @@ Inkscape::XML::Node *AncetreFils(Inkscape::XML::Node *descendent, Inkscape::XML: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/repr-util.cpp b/src/xml/repr-util.cpp index d78f6a927..d310639ba 100644 --- a/src/xml/repr-util.cpp +++ b/src/xml/repr-util.cpp @@ -659,4 +659,4 @@ sp_repr_get_point(Inkscape::XML::Node *repr, gchar const *key, Geom::Point *val) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/repr.h b/src/xml/repr.h index 549822e4e..3b8d532fd 100644 --- a/src/xml/repr.h +++ b/src/xml/repr.h @@ -162,4 +162,4 @@ inline Inkscape::XML::Node *sp_repr_document_first_child(Inkscape::XML::Document fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/simple-document.cpp b/src/xml/simple-document.cpp index c2f7c8c1c..2807133af 100644 --- a/src/xml/simple-document.cpp +++ b/src/xml/simple-document.cpp @@ -126,4 +126,4 @@ void SimpleDocument::notifyAttributeChanged(Node &node, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/simple-document.h b/src/xml/simple-document.h index 0a20f121e..8a37c577c 100644 --- a/src/xml/simple-document.h +++ b/src/xml/simple-document.h @@ -92,4 +92,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/simple-node.cpp b/src/xml/simple-node.cpp index 7ecdc1b83..b7c0c34ed 100644 --- a/src/xml/simple-node.cpp +++ b/src/xml/simple-node.cpp @@ -628,4 +628,4 @@ void SimpleNode::mergeFrom(Node const *src, gchar const *key) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/simple-node.h b/src/xml/simple-node.h index 67070d0fc..7c5eb8fbd 100644 --- a/src/xml/simple-node.h +++ b/src/xml/simple-node.h @@ -166,4 +166,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/sp-css-attr.h b/src/xml/sp-css-attr.h index f6a0d9682..e3aecf8fa 100644 --- a/src/xml/sp-css-attr.h +++ b/src/xml/sp-css-attr.h @@ -30,4 +30,4 @@ class SPCSSAttr : virtual public Inkscape::XML::Node { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/subtree.cpp b/src/xml/subtree.cpp index c608efd64..94c1436a9 100644 --- a/src/xml/subtree.cpp +++ b/src/xml/subtree.cpp @@ -62,4 +62,4 @@ void Subtree::removeObserver(NodeObserver &observer) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/subtree.h b/src/xml/subtree.h index 07996e6a6..deee0cab1 100644 --- a/src/xml/subtree.h +++ b/src/xml/subtree.h @@ -74,4 +74,4 @@ private: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/text-node.h b/src/xml/text-node.h index ef6e477ab..b0b7c884b 100644 --- a/src/xml/text-node.h +++ b/src/xml/text-node.h @@ -54,4 +54,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/xml/xml-forward.h b/src/xml/xml-forward.h index 33218c8ae..bc7b8a405 100644 --- a/src/xml/xml-forward.h +++ b/src/xml/xml-forward.h @@ -55,4 +55,4 @@ struct TextNode; fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : |
