diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2011-07-25 01:06:47 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2011-07-25 01:06:47 +0000 |
| commit | 4f3cc7cbb73a72e1ab10a587a3b81f8c8737fec3 (patch) | |
| tree | 75853d8eec5e85fb93a2a798b57f072e3c9eeb99 /src | |
| parent | Replace direct use of Cairo contexts and surfaces in the rendering tree (diff) | |
| parent | Revert workarounds from 10501 - no longer necessary (diff) | |
| download | inkscape-4f3cc7cbb73a72e1ab10a587a3b81f8c8737fec3.tar.gz inkscape-4f3cc7cbb73a72e1ab10a587a3b81f8c8737fec3.zip | |
Merge from trunk
(bzr r10347.1.18)
Diffstat (limited to 'src')
138 files changed, 1392 insertions, 1896 deletions
diff --git a/src/2geom/2geom.h b/src/2geom/2geom.h new file mode 100644 index 000000000..000f3423d --- /dev/null +++ b/src/2geom/2geom.h @@ -0,0 +1,75 @@ +/** + * \file + * \brief Include everything + *//* + * Authors: + * Krzysztof KosiĆski <tweenk.pl@gmail.com> + * + * Copyright 2011 Authors + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + */ + +#ifndef SEEN_LIB2GEOM_2GEOM_H +#define SEEN_LIB2GEOM_2GEOM_H + +#include <2geom/forward.h> + +// primitives +#include <2geom/coord.h> +#include <2geom/point.h> +#include <2geom/interval.h> +#include <2geom/rect.h> +#include <2geom/angle.h> +#include <2geom/ray.h> +#include <2geom/line.h> +#include <2geom/affine.h> +#include <2geom/transforms.h> + +// curves and paths +#include <2geom/curves.h> +#include <2geom/path.h> +#include <2geom/pathvector.h> + +// fragments +#include <2geom/d2.h> +#include <2geom/linear.h> +#include <2geom/bezier.h> +#include <2geom/sbasis.h> + +// others +#include <2geom/math-utils.h> +#include <2geom/utils.h> + +#endif // SEEN_LIB2GEOM_HEADER_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/2geom/CMakeLists.txt b/src/2geom/CMakeLists.txt index bc3f64bdc..dc261b5bd 100644 --- a/src/2geom/CMakeLists.txt +++ b/src/2geom/CMakeLists.txt @@ -27,6 +27,7 @@ set(2geom_SRC point.cpp poly.cpp quadtree.cpp + rect.cpp # recursive-bezier-intersection.cpp region.cpp sbasis-2d.cpp @@ -43,6 +44,7 @@ set(2geom_SRC svg-path-parser.cpp svg-path.cpp sweep.cpp + toposweep.cpp transforms.cpp utils.cpp @@ -76,10 +78,14 @@ set(2geom_SRC elliptical-arc.h exception.h forward.h + generic-interval.h + generic-rect.h geom.h hvlinesegment.h + int-interval.h + int-point.h + int-rect.h interval.h - isnan.h line.h linear.h math-utils.h @@ -89,7 +95,6 @@ set(2geom_SRC path.h pathvector.h piecewise.h - point-l.h point-ops.h point.h poly.h @@ -106,11 +111,11 @@ set(2geom_SRC sbasis.h shape.h solver.h - sturm.h svg-elliptical-arc.h svg-path-parser.h svg-path.h sweep.h + toposweep.h transforms.h utils.h diff --git a/src/2geom/bezier-curve.cpp b/src/2geom/bezier-curve.cpp index 8c40e5e42..6dfb0f0b3 100644 --- a/src/2geom/bezier-curve.cpp +++ b/src/2geom/bezier-curve.cpp @@ -108,7 +108,7 @@ BezierCurve::BezierCurve(std::vector<Point> const &pts) { inner = D2<Bezier>(Bezier::Order(pts.size() - 1), Bezier::Order(pts.size() - 1)); for (unsigned d = 0; d < 2; ++d) { - for(unsigned i = 0; i < pts.size(); i++) { + for (unsigned i = 0; i < pts.size(); i++) { inner[d][i] = pts[i][d]; } } diff --git a/src/2geom/bezier-curve.h b/src/2geom/bezier-curve.h index d13ff8321..c0224e850 100644 --- a/src/2geom/bezier-curve.h +++ b/src/2geom/bezier-curve.h @@ -47,7 +47,6 @@ class BezierCurve : public Curve { protected: D2<Bezier> inner; BezierCurve() {} - BezierCurve(BezierCurve const &b) : inner(b.inner) {} BezierCurve(D2<Bezier> const &b) : inner(b) {} BezierCurve(Bezier const &x, Bezier const &y) : inner(x, y) {} BezierCurve(std::vector<Point> const &pts); diff --git a/src/2geom/generic-rect.h b/src/2geom/generic-rect.h index 6dc57b169..2db30dfa9 100644 --- a/src/2geom/generic-rect.h +++ b/src/2geom/generic-rect.h @@ -54,10 +54,10 @@ class GenericOptRect; */ template <typename C> class GenericRect - : boost::additive< GenericRect<C>, typename CoordTraits<C>::PointType - , boost::equality_comparable< GenericRect<C> - , boost::orable< GenericRect<C> - , boost::orable< GenericRect<C>, typename CoordTraits<C>::OptRectType + : boost::additive< typename CoordTraits<C>::RectType, typename CoordTraits<C>::PointType + , boost::equality_comparable< typename CoordTraits<C>::RectType + , boost::orable< typename CoordTraits<C>::RectType + , boost::orable< typename CoordTraits<C>::RectType, typename CoordTraits<C>::OptRectType > > > > { typedef typename CoordTraits<C>::IntervalType CInterval; @@ -225,7 +225,7 @@ public: f[X].expandTo(p[X]); f[Y].expandTo(p[Y]); } /** @brief Enlarge the rectangle to contain the given rectangle. */ - void unionWith(GenericRect<C> const &b) { + void unionWith(CRect const &b) { f[X].unionWith(b[X]); f[Y].unionWith(b[Y]); } /** @brief Enlarge the rectangle to contain the given rectangle. @@ -265,7 +265,7 @@ public: return *this; } /** @brief Union two rectangles. */ - GenericRect<C> &operator|=(GenericRect<C> const &o) { + GenericRect<C> &operator|=(CRect const &o) { unionWith(o); return *this; } @@ -285,9 +285,9 @@ public: template <typename C> class GenericOptRect : public boost::optional<typename CoordTraits<C>::RectType> - , boost::orable< GenericOptRect<C> - , boost::andable< GenericOptRect<C> - , boost::andable< GenericOptRect<C>, typename CoordTraits<C>::RectType + , boost::orable< typename CoordTraits<C>::OptRectType + , boost::andable< typename CoordTraits<C>::OptRectType + , boost::andable< typename CoordTraits<C>::OptRectType, typename CoordTraits<C>::RectType > > > { typedef typename CoordTraits<C>::IntervalType CInterval; diff --git a/src/2geom/int-rect.h b/src/2geom/int-rect.h index a143b3ac5..567d42da5 100644 --- a/src/2geom/int-rect.h +++ b/src/2geom/int-rect.h @@ -32,7 +32,6 @@ #define LIB2GEOM_SEEN_INT_RECT_H #include <2geom/coord.h> -#include <2geom/int-point.h> #include <2geom/int-interval.h> #include <2geom/generic-rect.h> diff --git a/src/2geom/path-intersection.cpp b/src/2geom/path-intersection.cpp index be3e3b7cc..c38776304 100644 --- a/src/2geom/path-intersection.cpp +++ b/src/2geom/path-intersection.cpp @@ -226,8 +226,8 @@ intersect_polish_f (const gsl_vector * x, void *params, #endif static void -intersect_polish_root (Curve const &A, double &s, - Curve const &B, double &t) { +intersect_polish_root (Curve const &A, double &s, Curve const &B, double &t) +{ std::vector<Point> as, bs; as = A.pointAndDerivatives(s, 2); bs = B.pointAndDerivatives(t, 2); diff --git a/src/2geom/point.cpp b/src/2geom/point.cpp index cafc0fdba..3ad9dd1fd 100644 --- a/src/2geom/point.cpp +++ b/src/2geom/point.cpp @@ -49,8 +49,8 @@ namespace Geom { * from the origin (point at 0,0) to the stored coordinates, * and has methods implementing several vector operations (like length()). * - * @par Operator note - * @par + * @section OpNotePoint Operator note + * * Most operators are provided by Boost operator helpers, so they are not visible in this class. * If @a p, @a q, @a r denote points, @a s a floating-point scalar, and @a m a transformation matrix, * then the following operations are available: diff --git a/src/2geom/solve-bezier-parametric.cpp b/src/2geom/solve-bezier-parametric.cpp index 437f073a3..76cf65e17 100644 --- a/src/2geom/solve-bezier-parametric.cpp +++ b/src/2geom/solve-bezier-parametric.cpp @@ -68,13 +68,13 @@ find_parametric_bezier_roots(Geom::Point const *w, /* The control points */ break; } - // Otherwise, solve recursively after subdividing control polygon - std::vector<Geom::Point> Left(degree + 1); // New left and right - std::vector<Geom::Point> Right(degree + 1); // control polygons - Bezier(w, degree, 0.5, &Left[0], &Right[0]); + /* Otherwise, solve recursively after subdividing control polygon */ + Geom::Point Left[degree+1], /* New left and right */ + Right[degree+1]; /* control polygons */ + Bezier(w, degree, 0.5, Left, Right); total_subs ++; - find_parametric_bezier_roots(&Left[0], degree, solutions, depth + 1); - find_parametric_bezier_roots(&Right[0], degree, solutions, depth + 1); + find_parametric_bezier_roots(Left, degree, solutions, depth+1); + find_parametric_bezier_roots(Right, degree, solutions, depth+1); } diff --git a/src/2geom/solver.h b/src/2geom/solver.h index 5e77f13dc..793939b2a 100644 --- a/src/2geom/solver.h +++ b/src/2geom/solver.h @@ -1,7 +1,7 @@ /** * \file - * \brief \todo brief description - * + * \brief Finding roots of Bernstein-Bezier polynomials + *//* * Authors: * ? <?@?.?> * diff --git a/src/2geom/transforms.cpp b/src/2geom/transforms.cpp index 2658719c4..b8355cadc 100644 --- a/src/2geom/transforms.cpp +++ b/src/2geom/transforms.cpp @@ -35,9 +35,21 @@ #include <boost/concept_check.hpp> #include <2geom/point.h> #include <2geom/transforms.h> +#include <2geom/rect.h> namespace Geom { +/** @brief Zoom between rectangles. + * Given two rectangles, compute a zoom that maps one to the other. + * Rectangles are assumed to have the same aspect ratio. */ +Zoom Zoom::map_rect(Rect const &old_r, Rect const &new_r) +{ + Zoom ret; + ret._scale = new_r.width() / old_r.width(); + ret._trans = new_r.min() - old_r.min(); + return ret; +} + // Point transformation methods. Point &Point::operator*=(Translate const &t) { @@ -68,6 +80,14 @@ Point &Point::operator*=(VShear const &v) _pt[Y] += v.f * _pt[Y]; return *this; } +Point &Point::operator*=(Zoom const &z) +{ + _pt[X] += z._trans[X]; + _pt[Y] += z._trans[Y]; + _pt[X] *= z._scale; + _pt[Y] *= z._scale; + return *this; +} // Affine multiplication methods. @@ -110,6 +130,14 @@ Affine &Affine::operator*=(VShear const &v) { return *this; } +Affine &Affine::operator*=(Zoom const &z) { + _c[0] *= z._scale; _c[1] *= z._scale; + _c[2] *= z._scale; _c[3] *= z._scale; + _c[4] += z._trans[X]; _c[5] += z._trans[Y]; + _c[4] *= z._scale; _c[5] *= z._scale; + return *this; +} + // this checks whether the requirements of TransformConcept are satisfied for all transforms. // if you add a new transform type, include it here! void check_transforms() @@ -120,6 +148,7 @@ void check_transforms() BOOST_CONCEPT_ASSERT((TransformConcept<Rotate>)); BOOST_CONCEPT_ASSERT((TransformConcept<HShear>)); BOOST_CONCEPT_ASSERT((TransformConcept<VShear>)); + BOOST_CONCEPT_ASSERT((TransformConcept<Zoom>)); BOOST_CONCEPT_ASSERT((TransformConcept<Affine>)); // Affine is also a transform #endif @@ -130,14 +159,16 @@ void check_transforms() Rotate r(Rotate::identity()); HShear h(HShear::identity()); VShear v(VShear::identity()); + Zoom z(Zoom::identity()); // notice that the first column is always the same and enumerates all transform types, // while the second one changes to each transform type in turn. - m = t * t; m = t * s; m = t * r; m = t * h; m = t * v; - m = s * t; m = s * s; m = s * r; m = s * h; m = s * v; - m = r * t; m = r * s; m = r * r; m = r * h; m = r * v; - m = h * t; m = h * s; m = h * r; m = h * h; m = h * v; - m = v * t; m = v * s; m = v * r; m = v * h; m = v * v; + m = t * t; m = t * s; m = t * r; m = t * h; m = t * v; m = t * z; + m = s * t; m = s * s; m = s * r; m = s * h; m = s * v; m = s * z; + m = r * t; m = r * s; m = r * r; m = r * h; m = r * v; m = r * z; + m = h * t; m = h * s; m = h * r; m = h * h; m = h * v; m = h * z; + m = v * t; m = v * s; m = v * r; m = v * h; m = v * v; m = v * z; + m = z * t; m = z * s; m = z * r; m = z * h; m = z * v; m = z * z; } } diff --git a/src/arc-context.cpp b/src/arc-context.cpp index 6e5b935f1..96f5e1cff 100644 --- a/src/arc-context.cpp +++ b/src/arc-context.cpp @@ -14,8 +14,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#define __SP_ARC_CONTEXT_C__ - #ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -447,7 +445,7 @@ static void sp_arc_drag(SPArcContext *ac, Geom::Point pt, guint state) Geom::Point c = r.midpoint(); if (!ctrl_save) { if (fabs(dir[Geom::X]) > 1E-6 && fabs(dir[Geom::Y]) > 1E-6) { - Geom::Affine const i2d ((ac->item)->i2d_affine ()); + Geom::Affine const i2d ( (ac->item)->i2dt_affine() ); Geom::Point new_dir = pt * i2d - c; new_dir[Geom::X] *= dir[Geom::Y] / dir[Geom::X]; double lambda = new_dir.length() / dir[Geom::Y]; diff --git a/src/box3d.cpp b/src/box3d.cpp index 1a9c26b26..23f934b64 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -388,7 +388,7 @@ box3d_get_corner_screen (SPBox3D const *box, guint id, bool item_coords) { if (!box3d_get_perspective(box)) { return Geom::Point (Geom::infinity(), Geom::infinity()); } - Geom::Affine const i2d (SP_ITEM(box)->i2d_affine ()); + Geom::Affine const i2d(box->i2dt_affine ()); if (item_coords) { return box3d_get_perspective(box)->perspective_impl->tmat.image(proj_corner).affine() * i2d.inverse(); } else { @@ -412,7 +412,7 @@ box3d_get_center_screen (SPBox3D *box) { if (!box3d_get_perspective(box)) { return Geom::Point (Geom::infinity(), Geom::infinity()); } - Geom::Affine const i2d (SP_ITEM(box)->i2d_affine ()); + Geom::Affine const i2d( box->i2dt_affine() ); return box3d_get_perspective(box)->perspective_impl->tmat.image(proj_center).affine() * i2d.inverse(); } @@ -1180,7 +1180,7 @@ box3d_set_z_orders (SPBox3D *box) { for (unsigned int i = 0; i < 6; ++i) { side = sides.find(box->z_orders[i]); if (side != sides.end()) { - SP_ITEM((*side).second)->lowerToBottom(); + ((*side).second)->lowerToBottom(); } } } @@ -1422,7 +1422,7 @@ box3d_convert_to_guides(SPItem *item) { box3d_push_back_corner_pair(box, pts, 2, 6); box3d_push_back_corner_pair(box, pts, 3, 7); - sp_guide_pt_pairs_to_guides(inkscape_active_desktop(), pts); + sp_guide_pt_pairs_to_guides(item->document, pts); } /* diff --git a/src/connector-context.cpp b/src/connector-context.cpp index 2aa9c41ee..ecc8cdaad 100644 --- a/src/connector-context.cpp +++ b/src/connector-context.cpp @@ -977,7 +977,7 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons m.unSetup(); // Update the hidden path - Geom::Affine i2d = (cc->clickeditem)->i2d_affine(); + Geom::Affine i2d ( (cc->clickeditem)->i2dt_affine() ); Geom::Affine d2i = i2d.inverse(); SPPath *path = SP_PATH(cc->clickeditem); SPCurve *curve = path->original_curve ? path->original_curve : path->curve; @@ -1607,7 +1607,7 @@ endpt_handler(SPKnot */*knot*/, GdkEvent *event, SPConnectorContext *cc) // Show the red path for dragging. cc->red_curve = SP_PATH(cc->clickeditem)->original_curve ? SP_PATH(cc->clickeditem)->original_curve->copy() : SP_PATH(cc->clickeditem)->curve->copy(); - Geom::Affine i2d = (cc->clickeditem)->i2d_affine(); + Geom::Affine i2d = (cc->clickeditem)->i2dt_affine(); cc->red_curve->transform(i2d); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(cc->red_bpath), cc->red_curve); @@ -1766,7 +1766,7 @@ cc_set_active_conn(SPConnectorContext *cc, SPItem *item) g_assert( SP_IS_PATH(item) ); SPCurve *curve = SP_PATH(item)->original_curve ? SP_PATH(item)->original_curve : SP_PATH(item)->curve; - Geom::Affine i2d = item->i2d_affine(); + Geom::Affine i2dt = item->i2dt_affine(); if (cc->active_conn == item) { @@ -1780,10 +1780,10 @@ cc_set_active_conn(SPConnectorContext *cc, SPItem *item) else { // Just adjust handle positions. - Geom::Point startpt = *(curve->first_point()) * i2d; + Geom::Point startpt = *(curve->first_point()) * i2dt; sp_knot_set_position(cc->endpt_handle[0], startpt, 0); - Geom::Point endpt = *(curve->last_point()) * i2d; + Geom::Point endpt = *(curve->last_point()) * i2dt; sp_knot_set_position(cc->endpt_handle[1], endpt, 0); } @@ -1855,10 +1855,10 @@ cc_set_active_conn(SPConnectorContext *cc, SPItem *item) return; } - Geom::Point startpt = *(curve->first_point()) * i2d; + Geom::Point startpt = *(curve->first_point()) * i2dt; sp_knot_set_position(cc->endpt_handle[0], startpt, 0); - Geom::Point endpt = *(curve->last_point()) * i2d; + Geom::Point endpt = *(curve->last_point()) * i2dt; sp_knot_set_position(cc->endpt_handle[1], endpt, 0); sp_knot_show(cc->endpt_handle[0]); diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 88ad9ca57..1cad282b3 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -420,7 +420,7 @@ stroke_average_width (GSList const *objects) if (!SP_IS_ITEM (l->data)) continue; - Geom::Affine i2d = SP_ITEM(l->data)->i2d_affine(); + Geom::Affine i2dt = SP_ITEM(l->data)->i2dt_affine(); SPObject *object = SP_OBJECT(l->data); @@ -431,7 +431,7 @@ stroke_average_width (GSList const *objects) notstroked = false; } - avgwidth += object->style->stroke_width.computed * i2d.descrim(); + avgwidth += object->style->stroke_width.computed * i2dt.descrim(); } if (notstroked) @@ -725,7 +725,7 @@ objects_query_strokewidth (GSList *objects, SPStyle *style_res) noneSet &= style->stroke.isNone(); - Geom::Affine i2d = SP_ITEM(obj)->i2d_affine(); + Geom::Affine i2d = SP_ITEM(obj)->i2dt_affine(); double sw = style->stroke_width.computed * i2d.descrim(); if (prev_sw != -1 && fabs(sw - prev_sw) > 1e-3) @@ -961,7 +961,7 @@ objects_query_fontnumbers (GSList *objects, SPStyle *style_res) } texts ++; - size += style->font_size.computed * Geom::Affine(SP_ITEM(obj)->i2d_affine()).descrim(); /// \todo FIXME: we assume non-% units here + size += style->font_size.computed * Geom::Affine(SP_ITEM(obj)->i2dt_affine()).descrim(); /// \todo FIXME: we assume non-% units here if (style->letter_spacing.normal) { if (!different && (letterspacing_prev == 0 || letterspacing_prev == letterspacing)) { @@ -1428,7 +1428,7 @@ objects_query_blur (GSList *objects, SPStyle *style_res) continue; } - Geom::Affine i2d = SP_ITEM(obj)->i2d_affine(); + Geom::Affine i2d = SP_ITEM(obj)->i2dt_affine(); items ++; diff --git a/src/desktop.cpp b/src/desktop.cpp index 4ff2716ca..5e968b08b 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -285,7 +285,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWid _modified_connection = namedview->connectModified(sigc::bind<2>(sigc::ptr_fun(&_namedview_modified), this)); - NRArenaItem *ai = SP_ITEM(document->getRoot())->invoke_show( + NRArenaItem *ai = document->getRoot()->invoke_show( SP_CANVAS_ARENA (drawing)->arena, dkey, SP_ITEM_SHOW_DISPLAY); @@ -402,7 +402,7 @@ void SPDesktop::destroy() } if (drawing) { - SP_ITEM(doc()->getRoot())->invoke_hide(dkey); + doc()->getRoot()->invoke_hide(dkey); drawing = NULL; } @@ -541,8 +541,9 @@ void SPDesktop::toggleLayerSolo(SPObject *object) { } - if ( SP_ITEM(object)->isHidden() ) { - SP_ITEM(object)->setHidden(false); + SPItem *item = SP_ITEM(object); + if ( item->isHidden() ) { + item->setHidden(false); } for ( std::vector<SPObject*>::iterator it = layers.begin(); it != layers.end(); ++it ) { @@ -1131,7 +1132,7 @@ void SPDesktop::zoom_drawing() { g_return_if_fail (doc() != NULL); - SPItem *docitem = SP_ITEM(doc()->getRoot()); + SPItem *docitem = doc()->getRoot(); g_return_if_fail (docitem != NULL); Geom::OptRect d = docitem->getBboxDesktop(); @@ -1536,7 +1537,7 @@ SPDesktop::setDocument (SPDocument *doc) { if (this->doc() && doc) { namedview->hide(this); - SP_ITEM(this->doc()->getRoot())->invoke_hide(dkey); + this->doc()->getRoot()->invoke_hide(dkey); } if (_layer_hierarchy) { @@ -1567,7 +1568,7 @@ SPDesktop::setDocument (SPDocument *doc) _modified_connection = namedview->connectModified(sigc::bind<2>(sigc::ptr_fun(&_namedview_modified), this)); number = namedview->getViewCount(); - ai = SP_ITEM(doc->getRoot())->invoke_show( + ai = doc->getRoot()->invoke_show( SP_CANVAS_ARENA (drawing)->arena, dkey, SP_ITEM_SHOW_DISPLAY); @@ -1815,8 +1816,7 @@ Geom::Affine SPDesktop::doc2dt() const Geom::Affine SPDesktop::dt2doc() const { - // doc2dt is its own inverse - return _doc2dt; + return _doc2dt.inverse(); } Geom::Point SPDesktop::doc2dt(Geom::Point const &p) const diff --git a/src/desktop.h b/src/desktop.h index ed0a99dea..a7264e4aa 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -228,8 +228,11 @@ public: Inkscape::UI::Widget::Dock* getDock() { return _widget->getDock(); } void set_active (bool new_active); + + // TODO look into making these return a more specific subclass: SPObject *currentRoot() const; SPObject *currentLayer() const; + void setCurrentLayer(SPObject *object); void toggleLayerSolo(SPObject *object); SPObject *layerForObject(SPObject *object); diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index 1738754b4..55b405523 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -856,7 +856,7 @@ static void clonetiler_trace_setup(SPDocument *doc, gdouble zoom, SPItem *origin /* Create ArenaItem and set transform */ trace_visionkey = SPItem::display_key_new(1); trace_doc = doc; - trace_root = SP_ITEM(trace_doc->getRoot())->invoke_show((NRArena *) trace_arena, trace_visionkey, SP_ITEM_SHOW_DISPLAY); + trace_root = trace_doc->getRoot()->invoke_show((NRArena *) trace_arena, trace_visionkey, SP_ITEM_SHOW_DISPLAY); // hide the (current) original and any tiled clones, we only want to pick the background original->invoke_hide(trace_visionkey); @@ -901,7 +901,7 @@ static guint32 clonetiler_trace_pick(Geom::Rect box) static void clonetiler_trace_finish() { if (trace_doc) { - SP_ITEM(trace_doc->getRoot())->invoke_hide(trace_visionkey); + trace_doc->getRoot()->invoke_hide(trace_visionkey); } if (trace_arena) { ((NRObject *) trace_arena)->unreference(); @@ -1061,6 +1061,7 @@ static void clonetiler_apply(GtkWidget */*widget*/, void *) gdk_window_process_all_updates(); SPObject *obj = selection->singleItem(); + SPItem *item = SP_IS_ITEM(obj) ? SP_ITEM(obj) : 0; Inkscape::XML::Node *obj_repr = obj->getRepr(); const char *id_href = g_strdup_printf("#%s", obj_repr->attribute("id")); SPObject *parent = obj->parent; @@ -1150,7 +1151,7 @@ static void clonetiler_apply(GtkWidget */*widget*/, void *) double gamma_picked = prefs->getDoubleLimited(prefs_path + "gamma_picked", 0, -10, 10); if (dotrace) { - clonetiler_trace_setup (sp_desktop_document(desktop), 1.0, SP_ITEM (obj)); + clonetiler_trace_setup (sp_desktop_document(desktop), 1.0, item); } Geom::Point center; @@ -1177,16 +1178,16 @@ static void clonetiler_apply(GtkWidget */*widget*/, void *) y0 = sp_repr_get_double_attribute (obj_repr, "inkscape:tile-y0", 0); } else { bool prefs_bbox = prefs->getBool("/tools/bounding_box", false); - SPItem::BBoxType bbox_type = ( prefs_bbox ? + SPItem::BBoxType bbox_type = ( prefs_bbox ? SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX ); - Geom::OptRect r = SP_ITEM(obj)->getBounds(SP_ITEM(obj)->i2doc_affine(), + Geom::OptRect r = item->getBounds(item->i2doc_affine(), bbox_type); if (r) { w = r->dimensions()[Geom::X]; h = r->dimensions()[Geom::Y]; x0 = r->min()[Geom::X]; y0 = r->min()[Geom::Y]; - center = desktop->dt2doc(SP_ITEM(obj)->getCenter()); + center = desktop->dt2doc(item->getCenter()); sp_repr_set_svg_double(obj_repr, "inkscape:tile-cx", center[Geom::X]); sp_repr_set_svg_double(obj_repr, "inkscape:tile-cy", center[Geom::Y]); @@ -1402,7 +1403,7 @@ static void clonetiler_apply(GtkWidget */*widget*/, void *) Geom::Point new_center; bool center_set = false; if (obj_repr->attribute("inkscape:transform-center-x") || obj_repr->attribute("inkscape:transform-center-y")) { - new_center = desktop->dt2doc(SP_ITEM(obj)->getCenter()) * t; + new_center = desktop->dt2doc(item->getCenter()) * t; center_set = true; } @@ -1635,7 +1636,7 @@ static GtkWidget * clonetiler_table_x_y_rand(int values) { GtkWidget *hb = gtk_hbox_new (FALSE, 0); - GtkWidget *i = sp_icon_new (Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON_OBJECT_ROWS); + GtkWidget *i = sp_icon_new (Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON("object-rows")); gtk_box_pack_start (GTK_BOX (hb), i, FALSE, FALSE, 2); GtkWidget *l = gtk_label_new (""); @@ -1648,7 +1649,7 @@ static GtkWidget * clonetiler_table_x_y_rand(int values) { GtkWidget *hb = gtk_hbox_new (FALSE, 0); - GtkWidget *i = sp_icon_new (Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON_OBJECT_COLUMNS); + GtkWidget *i = sp_icon_new (Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON("object-columns")); gtk_box_pack_start (GTK_BOX (hb), i, FALSE, FALSE, 2); GtkWidget *l = gtk_label_new (""); @@ -1806,7 +1807,7 @@ void clonetiler_dialog(void) // Symmetry { GtkWidget *vb = clonetiler_new_tab (nb, _("_Symmetry")); - + /* TRANSLATORS: For the following 17 symmetry groups, see * http://www.bib.ulb.ac.be/coursmath/doc/17.htm (visual examples); * http://www.clarku.edu/~djoyce/wallpaper/seventeen.html (English vocabulary); or @@ -1844,14 +1845,14 @@ void clonetiler_dialog(void) // the symmetry group combo box. GtkListStore *store = gtk_list_store_new (1, G_TYPE_STRING); GtkTreeIter iter; - + for (unsigned j = 0; j < G_N_ELEMENTS(sym_groups); ++j) { SymGroups const &sg = sym_groups[j]; // Add the description of the symgroup to a new row gtk_list_store_append (store, &iter); - gtk_list_store_set (store, &iter, - 0, sg.label, + gtk_list_store_set (store, &iter, + 0, sg.label, -1); } diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp index 77447b658..0c2bc5adc 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -358,18 +358,18 @@ gchar* create_filepath_from_id (const gchar *id, const gchar *file_entry_text) { if (id == NULL) /* This should never happen */ id = "bitmap"; - gchar * directory = NULL; + gchar *directory = NULL; if (directory == NULL && file_entry_text != NULL && file_entry_text[0] != '\0') { // std::cout << "Directory from dialog" << std::endl; - directory = g_dirname(file_entry_text); + directory = g_path_get_dirname(file_entry_text); } if (directory == NULL) { /* Grab document directory */ if ( SP_ACTIVE_DOCUMENT->getURI() ) { // std::cout << "Directory from document" << std::endl; - directory = g_dirname( SP_ACTIVE_DOCUMENT->getURI() ); + directory = g_path_get_dirname( SP_ACTIVE_DOCUMENT->getURI() ); } } @@ -1053,7 +1053,7 @@ filename_add_extension (const gchar *filename, const gchar *extension) return g_strconcat (filename, extension, NULL); else { - if (g_strcasecmp (dot + 1, extension) == 0) + if (g_ascii_strcasecmp (dot + 1, extension) == 0) return g_strdup (filename); else { @@ -1130,7 +1130,7 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) } Geom::OptRect area; - item->invoke_bbox( area, item->i2d_affine(), TRUE ); + item->invoke_bbox( area, item->i2dt_affine(), TRUE ); if (area) { gint width = (gint) (area->width() * dpi / PX_PER_IN + 0.5); gint height = (gint) (area->height() * dpi / PX_PER_IN + 0.5); @@ -1282,11 +1282,13 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) for(; reprlst != NULL; reprlst = reprlst->next) { Inkscape::XML::Node * repr = (Inkscape::XML::Node *)reprlst->data; const gchar * temp_string; + gchar *dir = g_path_get_dirname(filename); + gchar *docdir = g_path_get_dirname(SP_ACTIVE_DOCUMENT->getURI()); if (repr->attribute("id") == NULL || !(g_strrstr(filename_ext, repr->attribute("id")) != NULL && ( !SP_ACTIVE_DOCUMENT->getURI() || - strcmp(g_dirname(filename), g_dirname(SP_ACTIVE_DOCUMENT->getURI())) == 0))) { + strcmp(dir, docdir) == 0))) { temp_string = repr->attribute("inkscape:export-filename"); if (temp_string == NULL || strcmp(temp_string, filename_ext)) { repr->setAttribute("inkscape:export-filename", filename_ext); @@ -1303,6 +1305,8 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) sp_repr_set_svg_double(repr, "inkscape:export-ydpi", ydpi); modified = true; } + g_free(dir); + g_free(docdir); } DocumentUndo::setUndoSensitive(doc, saved); diff --git a/src/dialogs/spellcheck.cpp b/src/dialogs/spellcheck.cpp index 5de0bc6fe..d0de6ad20 100644 --- a/src/dialogs/spellcheck.cpp +++ b/src/dialogs/spellcheck.cpp @@ -243,8 +243,8 @@ gint compare_text_bboxes (gconstpointer a, gconstpointer b) SPItem *i1 = SP_ITEM(a); SPItem *i2 = SP_ITEM(b); - Geom::OptRect bbox1 = i1->getBounds(i1->i2d_affine()); - Geom::OptRect bbox2 = i2->getBounds(i2->i2d_affine()); + Geom::OptRect bbox1 = i1->getBounds(i1->i2dt_affine()); + Geom::OptRect bbox2 = i2->getBounds(i2->i2dt_affine()); if (!bbox1 || !bbox2) { return 0; } @@ -577,7 +577,7 @@ spellcheck_next_word() // draw rect std::vector<Geom::Point> points = - _layout->createSelectionShape(_begin_w, _end_w, _text->i2d_affine()); + _layout->createSelectionShape(_begin_w, _end_w, _text->i2dt_affine()); Geom::Point tl, br; tl = br = points.front(); for (unsigned i = 0 ; i < points.size() ; i ++) { diff --git a/src/dialogs/text-edit.cpp b/src/dialogs/text-edit.cpp index 16166d97e..ce3165632 100644 --- a/src/dialogs/text-edit.cpp +++ b/src/dialogs/text-edit.cpp @@ -299,7 +299,7 @@ sp_text_edit_dialog (void) // horizontal { GtkWidget *px = sp_icon_new( Inkscape::ICON_SIZE_LARGE_TOOLBAR, - INKSCAPE_ICON_FORMAT_TEXT_DIRECTION_HORIZONTAL ); + INKSCAPE_ICON("format-text-direction-horizontal") ); GtkWidget *b = group = gtk_radio_button_new (NULL); gtk_widget_set_tooltip_text (b, _("Horizontal text")); gtk_button_set_relief (GTK_BUTTON (b), GTK_RELIEF_NONE); @@ -307,13 +307,13 @@ sp_text_edit_dialog (void) gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (b), FALSE); gtk_container_add (GTK_CONTAINER (b), px); gtk_box_pack_start (GTK_BOX (row), b, FALSE, FALSE, 0); - g_object_set_data (G_OBJECT (dlg), INKSCAPE_ICON_FORMAT_TEXT_DIRECTION_HORIZONTAL, b); + g_object_set_data (G_OBJECT (dlg), INKSCAPE_ICON("format-text-direction-horizontal"), b); } // vertical { GtkWidget *px = sp_icon_new( Inkscape::ICON_SIZE_LARGE_TOOLBAR, - INKSCAPE_ICON_FORMAT_TEXT_DIRECTION_VERTICAL ); + INKSCAPE_ICON("format-text-direction-vertical") ); GtkWidget *b = gtk_radio_button_new (gtk_radio_button_get_group (GTK_RADIO_BUTTON (group))); gtk_widget_set_tooltip_text (b, _("Vertical text")); gtk_button_set_relief (GTK_BUTTON (b), GTK_RELIEF_NONE); @@ -321,12 +321,12 @@ sp_text_edit_dialog (void) gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (b), FALSE); gtk_container_add (GTK_CONTAINER (b), px); gtk_box_pack_start (GTK_BOX (row), b, FALSE, FALSE, 0); - g_object_set_data (G_OBJECT (dlg), INKSCAPE_ICON_FORMAT_TEXT_DIRECTION_VERTICAL, b); + g_object_set_data (G_OBJECT (dlg), INKSCAPE_ICON("format-text-direction-vertical"), b); } gtk_box_pack_start (GTK_BOX (l_vb), row, FALSE, FALSE, 0); } - + { GtkWidget *row = gtk_hbox_new (FALSE, VB_MARGIN); @@ -604,7 +604,7 @@ sp_get_text_dialog_style () } } - b = (GtkWidget*)g_object_get_data (G_OBJECT (dlg), INKSCAPE_ICON_FORMAT_TEXT_DIRECTION_HORIZONTAL ); + b = (GtkWidget*)g_object_get_data (G_OBJECT (dlg), INKSCAPE_ICON("format-text-direction-horizontal") ); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (b))) { sp_repr_css_set_property (css, "writing-mode", "lr"); @@ -818,9 +818,9 @@ sp_text_edit_dialog_read_selection ( GtkWidget *dlg, gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b), TRUE); if (query->writing_mode.computed == SP_CSS_WRITING_MODE_LR_TB) { - b = (GtkWidget*)g_object_get_data ( G_OBJECT (dlg), INKSCAPE_ICON_FORMAT_TEXT_DIRECTION_HORIZONTAL ); + b = (GtkWidget*)g_object_get_data ( G_OBJECT (dlg), INKSCAPE_ICON("format-text-direction-horizontal") ); } else { - b = (GtkWidget*)g_object_get_data ( G_OBJECT (dlg), INKSCAPE_ICON_FORMAT_TEXT_DIRECTION_VERTICAL ); + b = (GtkWidget*)g_object_get_data ( G_OBJECT (dlg), INKSCAPE_ICON("format-text-direction-vertical") ); } gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b), TRUE); diff --git a/src/dialogs/xml-tree.cpp b/src/dialogs/xml-tree.cpp index 1a003c9c7..2f489c4b5 100644 --- a/src/dialogs/xml-tree.cpp +++ b/src/dialogs/xml-tree.cpp @@ -284,7 +284,7 @@ void sp_xml_tree_dialog() _("New element node"), NULL, sp_icon_new( Inkscape::ICON_SIZE_LARGE_TOOLBAR, - INKSCAPE_ICON_XML_ELEMENT_NEW ), + INKSCAPE_ICON("xml-element-new") ), G_CALLBACK(cmd_new_element_node), NULL); @@ -305,7 +305,7 @@ void sp_xml_tree_dialog() button = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), NULL, _("New text node"), NULL, sp_icon_new( Inkscape::ICON_SIZE_LARGE_TOOLBAR, - INKSCAPE_ICON_XML_TEXT_NEW ), + INKSCAPE_ICON("xml-text-new") ), G_CALLBACK(cmd_new_text_node), NULL); @@ -326,7 +326,7 @@ void sp_xml_tree_dialog() button = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), NULL, _("Duplicate node"), NULL, sp_icon_new( Inkscape::ICON_SIZE_LARGE_TOOLBAR, - INKSCAPE_ICON_XML_NODE_DUPLICATE ), + INKSCAPE_ICON("xml-node-duplicate") ), G_CALLBACK(cmd_duplicate_node), NULL); @@ -338,7 +338,7 @@ void sp_xml_tree_dialog() g_signal_connect_object(G_OBJECT(tree), "tree_unselect_row", G_CALLBACK(on_tree_unselect_row_disable), - button, + button, (GConnectFlags)0); gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); @@ -348,16 +348,16 @@ void sp_xml_tree_dialog() button = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), NULL, Q_("nodeAsInXMLdialogTooltip|Delete node"), NULL, sp_icon_new( Inkscape::ICON_SIZE_LARGE_TOOLBAR, - INKSCAPE_ICON_XML_NODE_DELETE ), + INKSCAPE_ICON("xml-node-delete") ), G_CALLBACK(cmd_delete_node), NULL ); g_signal_connect_object(G_OBJECT(tree), "tree_select_row", G_CALLBACK(on_tree_select_row_enable_if_mutable), - button, + button, (GConnectFlags)0); g_signal_connect_object(G_OBJECT(tree), "tree_unselect_row", G_CALLBACK(on_tree_unselect_row_disable), - button, + button, (GConnectFlags)0); gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); @@ -370,12 +370,12 @@ void sp_xml_tree_dialog() g_signal_connect_object(G_OBJECT(tree), "tree_select_row", G_CALLBACK(on_tree_select_row_enable_if_has_grandparent), - button, + button, (GConnectFlags)0); g_signal_connect_object(G_OBJECT(tree), "tree_unselect_row", G_CALLBACK(on_tree_unselect_row_disable), - button, + button, (GConnectFlags)0); gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); @@ -386,11 +386,11 @@ void sp_xml_tree_dialog() G_CALLBACK(cmd_indent_node), NULL); g_signal_connect_object(G_OBJECT(tree), "tree_select_row", G_CALLBACK(on_tree_select_row_enable_if_indentable), - button, + button, (GConnectFlags)0); g_signal_connect_object(G_OBJECT(tree), "tree_unselect_row", (GCallback) on_tree_unselect_row_disable, - button, + button, (GConnectFlags)0); gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); @@ -400,11 +400,11 @@ void sp_xml_tree_dialog() G_CALLBACK(cmd_raise_node), NULL); g_signal_connect_object(G_OBJECT(tree), "tree_select_row", G_CALLBACK(on_tree_select_row_enable_if_not_first_child), - button, + button, (GConnectFlags)0); g_signal_connect_object(G_OBJECT(tree), "tree_unselect_row", G_CALLBACK(on_tree_unselect_row_disable), - button, + button, (GConnectFlags)0); gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); @@ -414,11 +414,11 @@ void sp_xml_tree_dialog() G_CALLBACK(cmd_lower_node), NULL); g_signal_connect_object(G_OBJECT(tree), "tree_select_row", G_CALLBACK(on_tree_select_row_enable_if_not_last_child), - button, + button, (GConnectFlags)0); g_signal_connect_object(G_OBJECT(tree), "tree_unselect_row", G_CALLBACK(on_tree_unselect_row_disable), - button, + button, (GConnectFlags)0); gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); @@ -458,7 +458,7 @@ void sp_xml_tree_dialog() button = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), NULL, _("Delete attribute"), NULL, sp_icon_new( Inkscape::ICON_SIZE_LARGE_TOOLBAR, - INKSCAPE_ICON_XML_ATTRIBUTE_DELETE ), + INKSCAPE_ICON("xml-attribute-delete") ), (GCallback) cmd_delete_attr, NULL); g_signal_connect_object(G_OBJECT(attributes), "select_row", @@ -583,24 +583,24 @@ void sp_xml_tree_dialog() g_signal_connect_object(G_OBJECT(tree), "tree_select_row", (GCallback) on_tree_select_row_show_if_element, - attr_container, + attr_container, (GConnectFlags)0); g_signal_connect_object(G_OBJECT(tree), "tree_unselect_row", (GCallback) on_tree_unselect_row_hide, - attr_container, + attr_container, (GConnectFlags)0); gtk_widget_hide(attr_container); g_signal_connect_object(G_OBJECT(tree), "tree_select_row", (GCallback) on_tree_select_row_show_if_text, - text_container, + text_container, (GConnectFlags)0); g_signal_connect_object(G_OBJECT(tree), "tree_unselect_row", (GCallback) on_tree_unselect_row_hide, - text_container, + text_container, (GConnectFlags)0); gtk_widget_hide(text_container); diff --git a/src/display/guideline.cpp b/src/display/guideline.cpp index c1c3e7740..0d2905d23 100644 --- a/src/display/guideline.cpp +++ b/src/display/guideline.cpp @@ -13,12 +13,17 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <2geom/coord.h> #include <2geom/transforms.h> #include "sp-canvas-util.h" #include "sp-ctrlpoint.h" #include "guideline.h" #include "display/cairo-utils.h" +#include "inkscape.h" // for inkscape_active_desktop() +#include "desktop.h" +#include "sp-namedview.h" + static void sp_guideline_class_init(SPGuideLineClass *c); static void sp_guideline_init(SPGuideLine *guideline); static void sp_guideline_destroy(GtkObject *object); @@ -112,45 +117,46 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf) cairo_set_line_cap(buf->ct, CAIRO_LINE_CAP_SQUARE); cairo_set_font_size(buf->ct, 10); - int px = round(gl->point_on_line[Geom::X]); - int py = round(gl->point_on_line[Geom::Y]); + Geom::Point normal_dt = /*unit_vector*/(gl->normal_to_line * gl->affine.withoutTranslation()); // note that normal_dt does not have unit length + Geom::Point point_on_line_dt = gl->point_on_line * gl->affine; if (gl->label) { + int px = round(point_on_line_dt[Geom::X]); + int py = round(point_on_line_dt[Geom::Y]); cairo_save(buf->ct); cairo_translate(buf->ct, px, py); - cairo_rotate(buf->ct, atan2(gl->normal_to_line[Geom::X], gl->normal_to_line[Geom::Y])); + cairo_rotate(buf->ct, atan2(normal_dt.cw())); cairo_translate(buf->ct, 0, -5); cairo_move_to(buf->ct, 0, 0); cairo_show_text(buf->ct, gl->label); cairo_restore(buf->ct); } - if (gl->is_vertical()) { - int position = round(gl->point_on_line[Geom::X]); + if ( Geom::are_near(normal_dt[Geom::Y], 0.) ) { // is vertical? + int position = round(point_on_line_dt[Geom::X]); cairo_move_to(buf->ct, position + 0.5, buf->rect.y0 + 0.5); cairo_line_to(buf->ct, position + 0.5, buf->rect.y1 - 0.5); cairo_stroke(buf->ct); - } else if (gl->is_horizontal()) { - int position = round(gl->point_on_line[Geom::Y]); + } else if ( Geom::are_near(normal_dt[Geom::X], 0.) ) { // is horizontal? + int position = round(point_on_line_dt[Geom::Y]); cairo_move_to(buf->ct, buf->rect.x0 + 0.5, position + 0.5); cairo_line_to(buf->ct, buf->rect.x1 - 0.5, position + 0.5); cairo_stroke(buf->ct); } else { - // render angled line, once intersection has been detected, draw from there. - Geom::Point parallel_to_line( gl->normal_to_line[Geom::Y], - /*should be minus, but inverted y axis*/ gl->normal_to_line[Geom::X]); + // render angled line. Once intersection has been detected, draw from there. + Geom::Point parallel_to_line( normal_dt.ccw() ); //try to intersect with left vertical of rect - double y_intersect_left = (buf->rect.x0 - gl->point_on_line[Geom::X]) * parallel_to_line[Geom::Y] / parallel_to_line[Geom::X] + gl->point_on_line[Geom::Y]; + double y_intersect_left = (buf->rect.x0 - point_on_line_dt[Geom::X]) * parallel_to_line[Geom::Y] / parallel_to_line[Geom::X] + point_on_line_dt[Geom::Y]; if ( (y_intersect_left >= buf->rect.y0) && (y_intersect_left <= buf->rect.y1) ) { // intersects with left vertical! - double y_intersect_right = (buf->rect.x1 - gl->point_on_line[Geom::X]) * parallel_to_line[Geom::Y] / parallel_to_line[Geom::X] + gl->point_on_line[Geom::Y]; + double y_intersect_right = (buf->rect.x1 - point_on_line_dt[Geom::X]) * parallel_to_line[Geom::Y] / parallel_to_line[Geom::X] + point_on_line_dt[Geom::Y]; sp_guideline_drawline (buf, buf->rect.x0, static_cast<gint>(round(y_intersect_left)), buf->rect.x1, static_cast<gint>(round(y_intersect_right)), gl->rgba); goto end; } //try to intersect with right vertical of rect - double y_intersect_right = (buf->rect.x1 - gl->point_on_line[Geom::X]) * parallel_to_line[Geom::Y] / parallel_to_line[Geom::X] + gl->point_on_line[Geom::Y]; + double y_intersect_right = (buf->rect.x1 - point_on_line_dt[Geom::X]) * parallel_to_line[Geom::Y] / parallel_to_line[Geom::X] + point_on_line_dt[Geom::Y]; if ( (y_intersect_right >= buf->rect.y0) && (y_intersect_right <= buf->rect.y1) ) { // intersects with right vertical! sp_guideline_drawline (buf, buf->rect.x1, static_cast<gint>(round(y_intersect_right)), buf->rect.x0, static_cast<gint>(round(y_intersect_left)), gl->rgba); @@ -158,16 +164,16 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf) } //try to intersect with top horizontal of rect - double x_intersect_top = (buf->rect.y0 - gl->point_on_line[Geom::Y]) * parallel_to_line[Geom::X] / parallel_to_line[Geom::Y] + gl->point_on_line[Geom::X]; + double x_intersect_top = (buf->rect.y0 - point_on_line_dt[Geom::Y]) * parallel_to_line[Geom::X] / parallel_to_line[Geom::Y] + point_on_line_dt[Geom::X]; if ( (x_intersect_top >= buf->rect.x0) && (x_intersect_top <= buf->rect.x1) ) { // intersects with top horizontal! - double x_intersect_bottom = (buf->rect.y1 - gl->point_on_line[Geom::Y]) * parallel_to_line[Geom::X] / parallel_to_line[Geom::Y] + gl->point_on_line[Geom::X]; + double x_intersect_bottom = (buf->rect.y1 - point_on_line_dt[Geom::Y]) * parallel_to_line[Geom::X] / parallel_to_line[Geom::Y] + point_on_line_dt[Geom::X]; sp_guideline_drawline (buf, static_cast<gint>(round(x_intersect_top)), buf->rect.y0, static_cast<gint>(round(x_intersect_bottom)), buf->rect.y1, gl->rgba); goto end; } //try to intersect with bottom horizontal of rect - double x_intersect_bottom = (buf->rect.y1 - gl->point_on_line[Geom::Y]) * parallel_to_line[Geom::X] / parallel_to_line[Geom::Y] + gl->point_on_line[Geom::X]; + double x_intersect_bottom = (buf->rect.y1 - point_on_line_dt[Geom::Y]) * parallel_to_line[Geom::X] / parallel_to_line[Geom::Y] + point_on_line_dt[Geom::X]; if ( (x_intersect_top >= buf->rect.x0) && (x_intersect_top <= buf->rect.x1) ) { // intersects with bottom horizontal! sp_guideline_drawline (buf, static_cast<gint>(round(x_intersect_bottom)), buf->rect.y1, static_cast<gint>(round(x_intersect_top)), buf->rect.y0, gl->rgba); @@ -186,16 +192,16 @@ static void sp_guideline_update(SPCanvasItem *item, Geom::Affine const &affine, ((SPCanvasItemClass *) parent_class)->update(item, affine, flags); } - gl->point_on_line[Geom::X] = affine[4]; - gl->point_on_line[Geom::Y] = affine[5]; + gl->affine = affine; - sp_ctrlpoint_set_coords(gl->origin, gl->point_on_line * affine.inverse()); + sp_ctrlpoint_set_coords(gl->origin, gl->point_on_line); sp_canvas_item_request_update(SP_CANVAS_ITEM (gl->origin)); + Geom::Point pol_transformed = gl->point_on_line*affine; if (gl->is_horizontal()) { - sp_canvas_update_bbox (item, -1000000, round(gl->point_on_line[Geom::Y] - 16), 1000000, round(gl->point_on_line[Geom::Y] + 1)); + sp_canvas_update_bbox (item, -1000000, round(pol_transformed[Geom::Y] - 16), 1000000, round(pol_transformed[Geom::Y] + 1)); } else if (gl->is_vertical()) { - sp_canvas_update_bbox (item, round(gl->point_on_line[Geom::X]), -1000000, round(gl->point_on_line[Geom::X] + 16), 1000000); + sp_canvas_update_bbox (item, round(pol_transformed[Geom::X]), -1000000, round(pol_transformed[Geom::X] + 16), 1000000); } else { //TODO: labels in angled guidelines are not showing up for some reason. sp_canvas_update_bbox (item, -1000000, -1000000, 1000000, 1000000); @@ -213,8 +219,8 @@ static double sp_guideline_point(SPCanvasItem *item, Geom::Point p, SPCanvasItem *actual_item = item; - Geom::Point vec(gl->normal_to_line[Geom::X], - gl->normal_to_line[Geom::Y]); - double distance = Geom::dot((p - gl->point_on_line), vec); + Geom::Point vec = gl->normal_to_line * gl->affine.withoutTranslation(); + double distance = Geom::dot((p - gl->point_on_line * gl->affine), unit_vector(vec)); return MAX(fabs(distance)-1, 0); } @@ -250,8 +256,8 @@ void sp_guideline_set_label(SPGuideLine *gl, const char* label) void sp_guideline_set_position(SPGuideLine *gl, Geom::Point point_on_line) { - sp_canvas_item_affine_absolute(SP_CANVAS_ITEM (gl), Geom::Affine(Geom::Translate(point_on_line))); - sp_canvas_item_affine_absolute(SP_CANVAS_ITEM (gl->origin), Geom::Affine(Geom::Translate(point_on_line))); + gl->point_on_line = point_on_line; + sp_canvas_item_request_update(SP_CANVAS_ITEM (gl)); } void sp_guideline_set_normal(SPGuideLine *gl, Geom::Point normal_to_line) diff --git a/src/display/guideline.h b/src/display/guideline.h index a3966f76f..164244c46 100644 --- a/src/display/guideline.h +++ b/src/display/guideline.h @@ -25,6 +25,8 @@ class SPCtrlPoint; struct SPGuideLine { SPCanvasItem item; + Geom::Affine affine; + SPCtrlPoint *origin; // unlike 'item', this is only held locally guint32 rgba; diff --git a/src/display/sodipodi-ctrl.cpp b/src/display/sodipodi-ctrl.cpp index 0ff7ca9f5..b4d2633bb 100644 --- a/src/display/sodipodi-ctrl.cpp +++ b/src/display/sodipodi-ctrl.cpp @@ -105,7 +105,12 @@ sp_ctrl_init (SPCtrl *ctrl) ctrl->stroked = 0; ctrl->fill_color = 0x000000ff; ctrl->stroke_color = 0x000000ff; - ctrl->_moved = false; + + // This way we make sure that the first sp_ctrl_update() call finishes properly; + // in subsequent calls it will not update anything it the control hasn't moved + // Consider for example the case in which a snap indicator is drawn at (0, 0); + // If moveto() is called then it will not set _moved to true because we're initially already at (0, 0) + ctrl->_moved = true; // Is this flag ever going to be set back to false? I can't find where that is supposed to happen ctrl->box.x0 = ctrl->box.y0 = ctrl->box.x1 = ctrl->box.y1 = 0; ctrl->cache = NULL; diff --git a/src/display/sodipodi-ctrlrect.cpp b/src/display/sodipodi-ctrlrect.cpp index b516456e9..b4539841b 100644 --- a/src/display/sodipodi-ctrlrect.cpp +++ b/src/display/sodipodi-ctrlrect.cpp @@ -15,8 +15,8 @@ * */ -#include "sp-canvas-util.h" #include "sodipodi-ctrlrect.h" +#include "sp-canvas-util.h" #include "display/cairo-utils.h" /* @@ -83,77 +83,7 @@ static void sp_ctrlrect_destroy(GtkObject *object) (* GTK_OBJECT_CLASS(parent_class)->destroy)(object); } } -#if 0 -/* FIXME: use definitions from somewhere else */ -#define RGBA_R(v) ((v) >> 24) -#define RGBA_G(v) (((v) >> 16) & 0xff) -#define RGBA_B(v) (((v) >> 8) & 0xff) -#define RGBA_A(v) ((v) & 0xff) - -static void sp_ctrlrect_hline(SPCanvasBuf *buf, gint y, gint xs, gint xe, guint32 rgba, guint dashed) -{ - if (y >= buf->rect.y0 && y < buf->rect.y1) { - guint const r = RGBA_R(rgba); - guint const g = RGBA_G(rgba); - guint const b = RGBA_B(rgba); - guint const a = RGBA_A(rgba); - gint const x0 = MAX(buf->rect.x0, xs); - gint const x1 = MIN(buf->rect.x1, xe + 1); - guchar *p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x0 - buf->rect.x0) * 4; - for (gint x = x0; x < x1; x++) { - if (!dashed || ((x / DASH_LENGTH) % 2)) { - p[0] = INK_COMPOSE(r, a, p[0]); - p[1] = INK_COMPOSE(g, a, p[1]); - p[2] = INK_COMPOSE(b, a, p[2]); - } - p += 4; - } - } -} -static void sp_ctrlrect_vline(SPCanvasBuf *buf, gint x, gint ys, gint ye, guint32 rgba, guint dashed) -{ - if (x >= buf->rect.x0 && x < buf->rect.x1) { - guint const r = RGBA_R(rgba); - guint const g = RGBA_G(rgba); - guint const b = RGBA_B(rgba); - guint const a = RGBA_A(rgba); - gint const y0 = MAX(buf->rect.y0, ys); - gint const y1 = MIN(buf->rect.y1, ye + 1); - guchar *p = buf->buf + (y0 - buf->rect.y0) * buf->buf_rowstride + (x - buf->rect.x0) * 4; - for (gint y = y0; y < y1; y++) { - if (!dashed || ((y / DASH_LENGTH) % 2)) { - p[0] = INK_COMPOSE(r, a, p[0]); - p[1] = INK_COMPOSE(g, a, p[1]); - p[2] = INK_COMPOSE(b, a, p[2]); - } - p += buf->buf_rowstride; - } - } -} - -/** Fills the pixels in [xs, xe)*[ys,ye) clipped to the tile with rgb * a. */ -static void sp_ctrlrect_area(SPCanvasBuf *buf, gint xs, gint ys, gint xe, gint ye, guint32 rgba) -{ - guint const r = RGBA_R(rgba); - guint const g = RGBA_G(rgba); - guint const b = RGBA_B(rgba); - guint const a = RGBA_A(rgba); - gint const x0 = MAX(buf->rect.x0, xs); - gint const x1 = MIN(buf->rect.x1, xe + 1); - gint const y0 = MAX(buf->rect.y0, ys); - gint const y1 = MIN(buf->rect.y1, ye + 1); - for (gint y = y0; y < y1; y++) { - guchar *p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x0 - buf->rect.x0) * 4; - for (gint x = x0; x < x1; x++) { - p[0] = INK_COMPOSE(r, a, p[0]); - p[1] = INK_COMPOSE(g, a, p[1]); - p[2] = INK_COMPOSE(b, a, p[2]); - p += 4; - } - } -} -#endif static void sp_ctrlrect_render(SPCanvasItem *item, SPCanvasBuf *buf) { @@ -174,8 +104,7 @@ void CtrlRect::init() _dashed = false; _shadow = 0; - _area.x0 = _area.y0 = 0; - _area.x1 = _area.y1 = 0; + _area = Geom::OptIntRect(); _rect = Geom::Rect(Geom::Point(0,0),Geom::Point(0,0)); @@ -189,20 +118,25 @@ void CtrlRect::init() void CtrlRect::render(SPCanvasBuf *buf) { + using Geom::X; + using Geom::Y; + static double const dashes[2] = {4.0, 4.0}; - if ((_area.x0 != 0 || _area.x1 != 0 || _area.y0 != 0 || _area.y1 != 0) && - (_area.x0 < buf->rect.x1) && - (_area.y0 < buf->rect.y1) && - ((_area.x1 + _shadow_size) >= buf->rect.x0) && - ((_area.y1 + _shadow_size) >= buf->rect.y0)) + if (!_area) { + return; + } + Geom::IntRect area = *_area; + Geom::IntRect area_w_shadow (area[X].min(), area[Y].min(), + area[X].max() + _shadow_size, area[Y].max() + _shadow_size); + if ( area_w_shadow.intersects(buf->rect) ) { cairo_save(buf->ct); cairo_translate(buf->ct, -buf->rect.x0, -buf->rect.y0); cairo_set_line_width(buf->ct, 1); if (_dashed) cairo_set_dash(buf->ct, dashes, 2, 0); - cairo_rectangle(buf->ct, 0.5 + _area.x0, 0.5 + _area.y0, - _area.x1 - _area.x0, _area.y1 - _area.y0); + cairo_rectangle(buf->ct, 0.5 + area[X].min(), 0.5 + area[Y].min(), + area[X].max() - area[X].min(), area[Y].max() - area[Y].min()); if (_has_fill) { ink_cairo_set_source_rgba32(buf->ct, _fill_color); @@ -213,181 +147,161 @@ void CtrlRect::render(SPCanvasBuf *buf) if (_shadow_size > 0) { ink_cairo_set_source_rgba32(buf->ct, _shadow_color); - cairo_rectangle(buf->ct, 1 + _area.x1, _area.y0 + _shadow_size, - _shadow_size, _area.y1 - _area.y0 + 1); // right shadow - cairo_rectangle(buf->ct, _area.x0 + _shadow_size, 1 + _area.y1, - _area.x1 - _area.x0 - _shadow_size + 1, _shadow_size); + cairo_rectangle(buf->ct, 1 + area[X].max(), area[Y].min() + _shadow_size, + _shadow_size, area[Y].max() - area[Y].min() + 1); // right shadow + cairo_rectangle(buf->ct, area[X].min() + _shadow_size, 1 + area[Y].max(), + area[X].max() - area[X].min() - _shadow_size + 1, _shadow_size); cairo_fill(buf->ct); } cairo_restore(buf->ct); -#if 0 - /* Top */ - sp_ctrlrect_hline(buf, _area.y0, _area.x0, _area.x1, _border_color, _dashed); - /* Bottom */ - sp_ctrlrect_hline(buf, _area.y1, _area.x0, _area.x1, _border_color, _dashed); - /* Left */ - sp_ctrlrect_vline(buf, _area.x0, _area.y0 + 1, _area.y1 - 1, _border_color, _dashed); - /* Right */ - sp_ctrlrect_vline(buf, _area.x1, _area.y0 + 1, _area.y1 - 1, _border_color, _dashed); - if (_shadow_size > 0) { - /* Right shadow */ - sp_ctrlrect_area(buf, _area.x1 + 1, _area.y0 + _shadow_size, - _area.x1 + _shadow_size, _area.y1 + _shadow_size, _shadow_color); - /* Bottom shadow */ - sp_ctrlrect_area(buf, _area.x0 + _shadow_size, _area.y1 + 1, - _area.x1, _area.y1 + _shadow_size, _shadow_color); - } - if (_has_fill) { - /* Fill */ - sp_ctrlrect_area(buf, _area.x0 + 1, _area.y0 + 1, - _area.x1 - 1, _area.y1 - 1, _fill_color); - } -#endif } } void CtrlRect::update(Geom::Affine const &affine, unsigned int flags) { + using Geom::X; + using Geom::Y; + if (((SPCanvasItemClass *) parent_class)->update) { ((SPCanvasItemClass *) parent_class)->update(this, affine, flags); } sp_canvas_item_reset_bounds(this); - NRRectL _area_old; - _area_old.x0 = _area.x0; - _area_old.x1 = _area.x1; - _area_old.y0 = _area.y0; - _area_old.y1 = _area.y1; - Geom::Rect bbox(_rect.min() * affine, _rect.max() * affine); - _area.x0 = (int) floor(bbox.min()[Geom::X] + 0.5); - _area.y0 = (int) floor(bbox.min()[Geom::Y] + 0.5); - _area.x1 = (int) floor(bbox.max()[Geom::X] + 0.5); - _area.y1 = (int) floor(bbox.max()[Geom::Y] + 0.5); + Geom::OptIntRect _area_old = _area; + Geom::IntRect area ( (int) floor(bbox.min()[Geom::X] + 0.5), + (int) floor(bbox.min()[Geom::Y] + 0.5), + (int) floor(bbox.max()[Geom::X] + 0.5), + (int) floor(bbox.max()[Geom::Y] + 0.5) ); + _area = area; + Geom::IntRect area_old(0,0,0,0); + if (_area_old) { // this weird construction is because the code below assumes _area_old to be 'valid' + area_old = *_area_old; + } gint _shadow_size_old = _shadow_size; _shadow_size = _shadow; // FIXME: we don't process a possible change in _has_fill if (_has_fill) { - if (_area_old.x0 != 0 || _area_old.x1 != 0 || _area_old.y0 != 0 || _area_old.y1 != 0) { + if (_area_old) { sp_canvas_request_redraw(canvas, - _area_old.x0 - 1, _area_old.y0 - 1, - _area_old.x1 + _shadow_size + 1, _area_old.y1 + _shadow_size + 1); + area_old[X].min() - 1, area_old[Y].min() - 1, + area_old[X].max() + _shadow_size + 1, area_old[Y].max() + _shadow_size + 1); } - if (_area.x0 != 0 || _area.x1 != 0 || _area.y0 != 0 || _area.y1 != 0) { + if (_area) { sp_canvas_request_redraw(canvas, - _area.x0 - 1, _area.y0 - 1, - _area.x1 + _shadow_size + 1, _area.y1 + _shadow_size + 1); + area[X].min() - 1, area[Y].min() - 1, + area[X].max() + _shadow_size + 1, area[Y].max() + _shadow_size + 1); } } else { // clear box, be smart about what part of the frame to redraw /* Top */ - if (_area.y0 != _area_old.y0) { // different level, redraw fully old and new - if (_area_old.x0 != _area_old.x1) + if (area[Y].min() != area_old[Y].min()) { // different level, redraw fully old and new + if (area_old[X].min() != area_old[X].max()) sp_canvas_request_redraw(canvas, - _area_old.x0 - 1, _area_old.y0 - 1, - _area_old.x1 + 1, _area_old.y0 + 1); + area_old[X].min() - 1, area_old[Y].min() - 1, + area_old[X].max() + 1, area_old[Y].min() + 1); - if (_area.x0 != _area.x1) + if (area[X].min() != area[X].max()) sp_canvas_request_redraw(canvas, - _area.x0 - 1, _area.y0 - 1, - _area.x1 + 1, _area.y0 + 1); + area[X].min() - 1, area[Y].min() - 1, + area[X].max() + 1, area[Y].min() + 1); } else { // same level, redraw only the ends - if (_area.x0 != _area_old.x0) { + if (area[X].min() != area_old[X].min()) { sp_canvas_request_redraw(canvas, - MIN(_area_old.x0,_area.x0) - 1, _area.y0 - 1, - MAX(_area_old.x0,_area.x0) + 1, _area.y0 + 1); + MIN(area_old[X].min(),area[X].min()) - 1, area[Y].min() - 1, + MAX(area_old[X].min(),area[X].min()) + 1, area[Y].min() + 1); } - if (_area.x1 != _area_old.x1) { + if (area[X].max() != area_old[X].max()) { sp_canvas_request_redraw(canvas, - MIN(_area_old.x1,_area.x1) - 1, _area.y0 - 1, - MAX(_area_old.x1,_area.x1) + 1, _area.y0 + 1); + MIN(area_old[X].max(),area[X].max()) - 1, area[Y].min() - 1, + MAX(area_old[X].max(),area[X].max()) + 1, area[Y].min() + 1); } } /* Left */ - if (_area.x0 != _area_old.x0) { // different level, redraw fully old and new - if (_area_old.y0 != _area_old.y1) + if (area[X].min() != area_old[X].min()) { // different level, redraw fully old and new + if (area_old[Y].min() != area_old[Y].max()) sp_canvas_request_redraw(canvas, - _area_old.x0 - 1, _area_old.y0 - 1, - _area_old.x0 + 1, _area_old.y1 + 1); + area_old[X].min() - 1, area_old[Y].min() - 1, + area_old[X].min() + 1, area_old[Y].max() + 1); - if (_area.y0 != _area.y1) + if (area[Y].min() != area[Y].max()) sp_canvas_request_redraw(canvas, - _area.x0 - 1, _area.y0 - 1, - _area.x0 + 1, _area.y1 + 1); + area[X].min() - 1, area[Y].min() - 1, + area[X].min() + 1, area[Y].max() + 1); } else { // same level, redraw only the ends - if (_area.y0 != _area_old.y0) { + if (area[Y].min() != area_old[Y].min()) { sp_canvas_request_redraw(canvas, - _area.x0 - 1, MIN(_area_old.y0,_area.y0) - 1, - _area.x0 + 1, MAX(_area_old.y0,_area.y0) + 1); + area[X].min() - 1, MIN(area_old[Y].min(),area[Y].min()) - 1, + area[X].min() + 1, MAX(area_old[Y].min(),area[Y].min()) + 1); } - if (_area.y1 != _area_old.y1) { + if (area[Y].max() != area_old[Y].max()) { sp_canvas_request_redraw(canvas, - _area.x0 - 1, MIN(_area_old.y1,_area.y1) - 1, - _area.x0 + 1, MAX(_area_old.y1,_area.y1) + 1); + area[X].min() - 1, MIN(area_old[Y].max(),area[Y].max()) - 1, + area[X].min() + 1, MAX(area_old[Y].max(),area[Y].max()) + 1); } } /* Right */ - if (_area.x1 != _area_old.x1 || _shadow_size_old != _shadow_size) { - if (_area_old.y0 != _area_old.y1) + if (area[X].max() != area_old[X].max() || _shadow_size_old != _shadow_size) { + if (area_old[Y].min() != area_old[Y].max()) sp_canvas_request_redraw(canvas, - _area_old.x1 - 1, _area_old.y0 - 1, - _area_old.x1 + _shadow_size + 1, _area_old.y1 + _shadow_size + 1); + area_old[X].max() - 1, area_old[Y].min() - 1, + area_old[X].max() + _shadow_size + 1, area_old[Y].max() + _shadow_size + 1); - if (_area.y0 != _area.y1) + if (area[Y].min() != area[Y].max()) sp_canvas_request_redraw(canvas, - _area.x1 - 1, _area.y0 - 1, - _area.x1 + _shadow_size + 1, _area.y1 + _shadow_size + 1); + area[X].max() - 1, area[Y].min() - 1, + area[X].max() + _shadow_size + 1, area[Y].max() + _shadow_size + 1); } else { // same level, redraw only the ends - if (_area.y0 != _area_old.y0) { + if (area[Y].min() != area_old[Y].min()) { sp_canvas_request_redraw(canvas, - _area.x1 - 1, MIN(_area_old.y0,_area.y0) - 1, - _area.x1 + _shadow_size + 1, MAX(_area_old.y0,_area.y0) + _shadow_size + 1); + area[X].max() - 1, MIN(area_old[Y].min(),area[Y].min()) - 1, + area[X].max() + _shadow_size + 1, MAX(area_old[Y].min(),area[Y].min()) + _shadow_size + 1); } - if (_area.y1 != _area_old.y1) { + if (area[Y].max() != area_old[Y].max()) { sp_canvas_request_redraw(canvas, - _area.x1 - 1, MIN(_area_old.y1,_area.y1) - 1, - _area.x1 + _shadow_size + 1, MAX(_area_old.y1,_area.y1) + _shadow_size + 1); + area[X].max() - 1, MIN(area_old[Y].max(),area[Y].max()) - 1, + area[X].max() + _shadow_size + 1, MAX(area_old[Y].max(),area[Y].max()) + _shadow_size + 1); } } /* Bottom */ - if (_area.y1 != _area_old.y1 || _shadow_size_old != _shadow_size) { - if (_area_old.x0 != _area_old.x1) + if (area[Y].max() != area_old[Y].max() || _shadow_size_old != _shadow_size) { + if (area_old[X].min() != area_old[X].max()) sp_canvas_request_redraw(canvas, - _area_old.x0 - 1, _area_old.y1 - 1, - _area_old.x1 + _shadow_size + 1, _area_old.y1 + _shadow_size + 1); + area_old[X].min() - 1, area_old[Y].max() - 1, + area_old[X].max() + _shadow_size + 1, area_old[Y].max() + _shadow_size + 1); - if (_area.x0 != _area.x1) + if (area[X].min() != area[X].max()) sp_canvas_request_redraw(canvas, - _area.x0 - 1, _area.y1 - 1, - _area.x1 + _shadow_size + 1, _area.y1 + _shadow_size + 1); + area[X].min() - 1, area[Y].max() - 1, + area[X].max() + _shadow_size + 1, area[Y].max() + _shadow_size + 1); } else { // same level, redraw only the ends - if (_area.x0 != _area_old.x0) { + if (area[X].min() != area_old[X].min()) { sp_canvas_request_redraw(canvas, - MIN(_area_old.x0,_area.x0) - 1, _area.y1 - 1, - MAX(_area_old.x0,_area.x0) + _shadow_size + 1, _area.y1 + _shadow_size + 1); + MIN(area_old[X].min(),area[X].min()) - 1, area[Y].max() - 1, + MAX(area_old[X].min(),area[X].min()) + _shadow_size + 1, area[Y].max() + _shadow_size + 1); } - if (_area.x1 != _area_old.x1) { + if (area[X].max() != area_old[X].max()) { sp_canvas_request_redraw(canvas, - MIN(_area_old.x1,_area.x1) - 1, _area.y1 - 1, - MAX(_area_old.x1,_area.x1) + _shadow_size + 1, _area.y1 + _shadow_size + 1); + MIN(area_old[X].max(),area[X].max()) - 1, area[Y].max() - 1, + MAX(area_old[X].max(),area[X].max()) + _shadow_size + 1, area[Y].max() + _shadow_size + 1); } } } // update SPCanvasItem box - if (_area.x0 != 0 || _area.x1 != 0 || _area.y0 != 0 || _area.y1 != 0) { - x1 = _area.x0 - 1; - y1 = _area.y0 - 1; - x2 = _area.x1 + _shadow_size + 1; - y2 = _area.y1 + _shadow_size + 1; + if (_area) { + x1 = area[X].min() - 1; + y1 = area[Y].min() - 1; + x2 = area[X].max() + _shadow_size + 1; + y2 = area[Y].max() + _shadow_size + 1; } } diff --git a/src/display/sodipodi-ctrlrect.h b/src/display/sodipodi-ctrlrect.h index e69b6ba68..45f8523ed 100644 --- a/src/display/sodipodi-ctrlrect.h +++ b/src/display/sodipodi-ctrlrect.h @@ -18,7 +18,8 @@ #include <glib/gtypes.h> #include "sp-canvas-item.h" -#include "libnr/nr-rect-l.h" +#include <2geom/rect.h> +#include <2geom/int-rect.h> struct SPCanvasBuf; @@ -47,7 +48,7 @@ private: Geom::Rect _rect; bool _has_fill; bool _dashed; - NRRectL _area; + Geom::OptIntRect _area; gint _shadow_size; guint32 _border_color; guint32 _fill_color; diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index d7f34969f..71f608118 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -1120,9 +1120,9 @@ sp_canvas_destroy (GtkObject *object) } shutdown_transients (canvas); - +#if ENABLE_LCMS canvas->cms_key.~ustring(); - +#endif if (GTK_OBJECT_CLASS (canvas_parent_class)->destroy) (* GTK_OBJECT_CLASS (canvas_parent_class)->destroy) (object); } diff --git a/src/draw-context.cpp b/src/draw-context.cpp index 4dd58afa7..5d324754f 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -439,7 +439,7 @@ spdc_attach_selection(SPDrawContext *dc, Inkscape::Selection */*sel*/) /* Curve list */ /* We keep it in desktop coordinates to eliminate calculation errors */ SPCurve *norm = sp_path_get_curve_for_edit (SP_PATH(item)); - norm->transform((dc->white_item)->i2d_affine()); + norm->transform((dc->white_item)->i2dt_affine()); g_return_if_fail( norm != NULL ); dc->white_curves = g_slist_reverse(norm->split()); norm->unref(); @@ -821,7 +821,7 @@ void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char cons current stroke width, multiplied by the amount specified in the preferences */ Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Geom::Affine const i2d (item->i2d_affine ()); + Geom::Affine const i2d (item->i2dt_affine ()); Geom::Point pp = pt; double rad = 0.5 * prefs->getDouble(tool_path + "/dot-size", 3.0); if (event_state & GDK_MOD1_MASK) { diff --git a/src/extension/internal/cairo-png-out.cpp b/src/extension/internal/cairo-png-out.cpp index b30e22e7e..f741c9f39 100644 --- a/src/extension/internal/cairo-png-out.cpp +++ b/src/extension/internal/cairo-png-out.cpp @@ -57,8 +57,8 @@ png_render_document_to_file(SPDocument *doc, gchar const *filename) doc->ensureUpToDate(); /* Start */ - /* Create new arena */ - SPItem *base = SP_ITEM(doc->getRoot()); + // Create new arena + SPItem *base = doc->getRoot(); NRArena *arena = NRArena::create(); unsigned dkey = SPItem::display_key_new(1); NRArenaItem *root = base->invoke_show(arena, dkey, SP_ITEM_SHOW_DISPLAY); diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp index a5b7b3237..7fdfaf8df 100644 --- a/src/extension/internal/cairo-ps-out.cpp +++ b/src/extension/internal/cairo-ps-out.cpp @@ -79,7 +79,7 @@ ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int l } else { // we want to export the entire document from root - base = SP_ITEM(doc->getRoot()); + base = doc->getRoot(); pageBoundingBox = !exportDrawing; } diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp index cdd9647e2..5d7c82bff 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.cpp +++ b/src/extension/internal/cairo-renderer-pdf-out.cpp @@ -73,7 +73,7 @@ pdf_render_document_to_file(SPDocument *doc, gchar const *filename, unsigned int } else { // we want to export the entire document from root - base = SP_ITEM(doc->getRoot()); + base = doc->getRoot(); pageBoundingBox = !exportDrawing; } diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 1e550f7d1..7eb7881dc 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -454,7 +454,7 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) // Get the bounding box of the selection in document coordinates. Geom::OptRect bbox = - item->getBounds(item->i2d_affine(), SPItem::RENDERING_BBOX); + item->getBounds(item->i2dt_affine(), SPItem::RENDERING_BBOX); // no bbox, e.g. empty group if (!bbox) { @@ -502,7 +502,7 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) (Geom::Affine)(Geom::Translate (shift_x, shift_y)); // ctx matrix already includes item transformation. We must substract. - Geom::Affine t_item = item->i2d_affine (); + Geom::Affine t_item = item->i2dt_affine (); Geom::Affine t = t_on_document * t_item.inverse(); // Do the export @@ -624,7 +624,7 @@ CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool page g_assert( ctx != NULL ); if (!base) { - base = SP_ITEM(doc->getRoot()); + base = doc->getRoot(); } NRRect d; @@ -633,7 +633,7 @@ CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool page d.x1 = doc->getWidth(); d.y1 = doc->getHeight(); } else { - base->invoke_bbox( &d, base->i2d_affine(), TRUE, SPItem::RENDERING_BBOX); + base->invoke_bbox( &d, base->i2dt_affine(), TRUE, SPItem::RENDERING_BBOX); } if (ctx->_vector_based_target) { diff --git a/src/extension/internal/emf-win32-print.cpp b/src/extension/internal/emf-win32-print.cpp index e5d1b0681..7ed0f6fcf 100644 --- a/src/extension/internal/emf-win32-print.cpp +++ b/src/extension/internal/emf-win32-print.cpp @@ -144,7 +144,7 @@ PrintEmfWin32::begin (Inkscape::Extension::Print *mod, SPDocument *doc) d.y1 = _height; } else { SPItem* doc_item = doc->getRoot(); - doc_item->invoke_bbox(&d, doc_item->i2d_affine(), TRUE); + doc_item->invoke_bbox(&d, doc_item->i2dt_affine(), TRUE); } d.x0 *= IN_PER_PX; @@ -226,7 +226,7 @@ PrintEmfWin32::begin (Inkscape::Extension::Print *mod, SPDocument *doc) g_free(local_fn); g_free(unicode_fn); - m_tr_stack.push( Geom::Scale(1, -1) * Geom::Translate(0, doc->getHeight())); + m_tr_stack.push( Geom::Scale(1, -1) * Geom::Translate(0, doc->getHeight())); /// @fixme hardcoded doc2dt transform return 0; } diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h index 27b1fdda9..53734bee5 100755 --- a/src/extension/internal/filter/color.h +++ b/src/extension/internal/filter/color.h @@ -39,9 +39,10 @@ namespace Filter { Brightness filter. Filter's parameters: - * Strength (-10.->10., default 1) -> colorMatrix (RVB entries) - * Vibration (-10.->10., default 0.) -> colorMatrix (6 other entries) + * Brightness (1.->10., default 2.) -> colorMatrix (RVB entries) + * Over-saturation (0.->10., default 0.5) -> colorMatrix (6 other entries) * Lightness (-10.->10., default 0.) -> colorMatrix (last column) + * Inverted (boolean, default false) -> colorMatrix Matrix: St Vi Vi 0 Li @@ -62,9 +63,10 @@ public: "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" "<name>" N_("Brightness, custom (Color)") "</name>\n" "<id>org.inkscape.effect.filter.Brightness</id>\n" - "<param name=\"strength\" gui-text=\"" N_("Strength:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"-10.00\" max=\"10.00\">1</param>\n" - "<param name=\"vibration\" gui-text=\"" N_("Vibration:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"-10.00\" max=\"10.00\">0</param>\n" + "<param name=\"brightness\" gui-text=\"" N_("Brightness:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"1\" max=\"10.00\">2</param>\n" + "<param name=\"sat\" gui-text=\"" N_("Over-saturation:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.0\" max=\"10.00\">0.5</param>\n" "<param name=\"lightness\" gui-text=\"" N_("Lightness:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"-10.00\" max=\"10.00\">0</param>\n" + "<param name=\"invert\" gui-text=\"" N_("Inverted") "\" type=\"boolean\">false</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" @@ -83,21 +85,29 @@ Brightness::get_filter_text (Inkscape::Extension::Extension * ext) { if (_filter != NULL) g_free((void *)_filter); - std::ostringstream strength; - std::ostringstream vibration; + std::ostringstream brightness; + std::ostringstream sat; std::ostringstream lightness; - strength << ext->get_param_float("strength"); - vibration << ext->get_param_float("vibration"); - lightness << ext->get_param_float("lightness"); + if (ext->get_param_bool("invert")) { + brightness << -ext->get_param_float("brightness"); + sat << 1 + ext->get_param_float("sat"); + lightness << -ext->get_param_float("lightness"); + } else { + brightness << ext->get_param_float("brightness"); + sat << -ext->get_param_float("sat"); + lightness << ext->get_param_float("lightness"); + } + + _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=\"Brightness, custom\">\n" "<feColorMatrix values=\"%s %s %s 0 %s %s %s %s 0 %s %s %s %s 0 %s 0 0 0 1 0 \" />\n" - "</filter>\n", strength.str().c_str(), vibration.str().c_str(), vibration.str().c_str(), - lightness.str().c_str(), vibration.str().c_str(), strength.str().c_str(), - vibration.str().c_str(), lightness.str().c_str(), vibration.str().c_str(), - vibration.str().c_str(), strength.str().c_str(), lightness.str().c_str()); + "</filter>\n", brightness.str().c_str(), sat.str().c_str(), sat.str().c_str(), + lightness.str().c_str(), sat.str().c_str(), brightness.str().c_str(), + sat.str().c_str(), lightness.str().c_str(), sat.str().c_str(), + sat.str().c_str(), brightness.str().c_str(), lightness.str().c_str()); return _filter; }; /* Brightness filter */ @@ -192,11 +202,12 @@ Colorize::get_filter_text (Inkscape::Extension::Extension * ext) nlight << ext->get_param_float("nlight"); blend1 << ext->get_param_enum("blend1"); blend2 << ext->get_param_enum("blend2"); - if (ext->get_param_bool("duotone")) + if (ext->get_param_bool("duotone")) { duotone << "0"; - else + } else { duotone << "1"; - + } + _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=\"Colorize, custom\">\n" "<feComposite in2=\"SourceGraphic\" operator=\"arithmetic\" k1=\"%s\" k2=\"%s\" result=\"composite1\" />\n" @@ -297,17 +308,17 @@ Duochrome::get_filter_text (Inkscape::Extension::Extension * ext) b2 << ((color2 >> 8) & 0xff); fluo << fluorescence; - if((g_ascii_strcasecmp("full", swaptype) == 0)) { + 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)) { + } 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)) { + } else if ((g_ascii_strcasecmp("alpha", swaptype) == 0)) { swap1 << "out"; swap2 << "in"; a1 << (color2 & 0xff) / 255.0F; @@ -395,8 +406,9 @@ Electrize::get_filter_text (Inkscape::Extension::Extension * ext) // TransfertComponent table values are calculated based on the effect level and inverted parameters. int val = 0; int levels = ext->get_param_int("levels") + 1; - if (ext->get_param_bool("invert")) + if (ext->get_param_bool("invert")) { val = 1; + } values << val; for ( int step = 1 ; step <= levels ; step++ ) { if (val == 1) { @@ -721,7 +733,7 @@ Solarize::get_filter_text (Inkscape::Extension::Extension * ext) rotate << ext->get_param_int("rotate"); const gchar *type = ext->get_param_enum("type"); - if((g_ascii_strcasecmp("solarize", type) == 0)) { + if ((g_ascii_strcasecmp("solarize", type) == 0)) { // Solarize blend1 << "darken"; blend2 << "screen"; @@ -854,21 +866,21 @@ Tritone::get_filter_text (Inkscape::Extension::Extension * ext) glight << ext->get_param_float("glight"); const gchar *type = ext->get_param_enum("type"); - if((g_ascii_strcasecmp("enhue", type) == 0)) { + if ((g_ascii_strcasecmp("enhue", type) == 0)) { // Enhance hue c1in << "qminp"; c1in2 << "flood"; c2in << "SourceGraphic"; c2in2 << "blend6"; b6in2 << "qminpc"; - } else if((g_ascii_strcasecmp("rad", type) == 0)) { + } else if ((g_ascii_strcasecmp("rad", type) == 0)) { // Radiation c1in << "qminp"; c1in2 << "flood"; c2in << "blend6"; c2in2 << "qminpc"; b6in2 << "SourceGraphic"; - } else if((g_ascii_strcasecmp("htb", type) == 0)) { + } else if ((g_ascii_strcasecmp("htb", type) == 0)) { // Hue to background c1in << "qminp"; c1in2 << "BackgroundImage"; diff --git a/src/extension/internal/filter/experimental.h b/src/extension/internal/filter/experimental.h index 96485ad97..84b0eea3d 100755 --- a/src/extension/internal/filter/experimental.h +++ b/src/extension/internal/filter/experimental.h @@ -580,7 +580,7 @@ NeonDraw::get_filter_text (Inkscape::Extension::Extension * ext) Normal = feComponentTransfer Dented = Normal + intermediate values * Transfer type (enum, default "descrete") -> component (type) - * Levels (1->15, default 5) -> component (tableValues) + * Levels (0->15, default 5) -> component (tableValues) * Blend mode (enum, default "Lighten") -> blend (mode) * Primary simplify (0.01->100., default 4.) -> blur1 (stdDeviation) * Secondary simplify (0.01->100., default 0.5) -> blur2 (stdDeviation) @@ -609,11 +609,13 @@ public: "<_item value=\"discrete\">Poster</_item>\n" "<_item value=\"table\">Painting</_item>\n" "</param>\n" - "<param name=\"levels\" gui-text=\"" N_("Levels:") "\" type=\"int\" appearance=\"full\" min=\"1\" max=\"15\">5</param>\n" + "<param name=\"levels\" gui-text=\"" N_("Levels:") "\" type=\"int\" appearance=\"full\" min=\"0\" max=\"15\">5</param>\n" "<param name=\"blend\" gui-text=\"" N_("Blend mode:") "\" type=\"enum\">\n" "<_item value=\"lighten\">Lighten</_item>\n" "<_item value=\"normal\">Normal</_item>\n" "<_item value=\"darken\">Darken</_item>\n" + "<_item value=\"multiply\">Multiply</_item>\n" + "<_item value=\"screen\">Screen</_item>\n" "</param>\n" "<param name=\"blur1\" gui-text=\"" N_("Simplify (primary):") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"100.00\">4.0</param>\n" "<param name=\"blur2\" gui-text=\"" N_("Simplify (secondary):") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"100.00\">0.5</param>\n" @@ -659,11 +661,19 @@ Posterize::get_filter_text (Inkscape::Extension::Extension * ext) 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))); + if (levels == 1) { + if ((g_ascii_strcasecmp("dented", effecttype) == 0)) { + transf << " 1 0 1"; + } else { + transf << " 1"; + } + } else { + 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"; diff --git a/src/extension/internal/filter/image.h b/src/extension/internal/filter/image.h index 926c56a4d..f459466d5 100644 --- a/src/extension/internal/filter/image.h +++ b/src/extension/internal/filter/image.h @@ -53,7 +53,7 @@ public: "<_item value=\"vertical\">" N_("Vertical lines") "</_item>\n" "<_item value=\"horizontal\">" N_("Horizontal lines") "</_item>\n" "</param>\n" - "<param name=\"level\" gui-text=\"" N_("Level:") "\" type=\"float\" appearance=\"full\" min=\"0.01\" max=\"10.0\">1.0</param>\n" + "<param name=\"level\" gui-text=\"" N_("Level:") "\" type=\"float\" appearance=\"full\" min=\"0.1\" max=\"100.0\">1.0</param>\n" "<param name=\"inverted\" gui-text=\"" N_("Invert colors") "\" type=\"boolean\" >false</param>\n" "<effect>\n" "<object-type>all</object-type>\n" @@ -80,14 +80,14 @@ EdgeDetect::get_filter_text (Inkscape::Extension::Extension * ext) const gchar *type = ext->get_param_enum("type"); - level << ext->get_param_float("level"); + level << 1 / ext->get_param_float("level"); if ((g_ascii_strcasecmp("vertical", type) == 0)) { matrix << "0 0 0 1 -2 1 0 0 0"; } else if ((g_ascii_strcasecmp("horizontal", type) == 0)) { matrix << "0 1 0 0 -2 0 0 1 0"; } else { - matrix << "1 1 1 1 -8 1 1 1 1"; + matrix << "0 1 0 1 -4 1 0 1 0"; } if (ext->get_param_bool("inverted")) { diff --git a/src/extension/internal/filter/shadows.h b/src/extension/internal/filter/shadows.h index bfc6cace6..3c964da34 100644 --- a/src/extension/internal/filter/shadows.h +++ b/src/extension/internal/filter/shadows.h @@ -37,7 +37,8 @@ namespace Filter { * Blur type (enum, default outer) -> outer = composite1 (operator="in"), composite2 (operator="over", in1="SourceGraphic", in2="offset") inner = composite1 (operator="out"), composite2 (operator="atop", in1="offset", in2="SourceGraphic") - cutout = composite1 (operator="in"), composite2 (operator="out", in1="offset", in2="SourceGraphic") + innercut = composite1 (operator="in"), composite2 (operator="out", in1="offset", in2="SourceGraphic") + outercut = composite1 (operator="out"), composite2 (operator="in", in1="SourceGraphic", in2="offset") * Color (guint, default 0,0,0,127) -> flood (flood-opacity, flood-color) * Use object's color (boolean, default false) -> composite1 (in1, in2) */ @@ -62,7 +63,8 @@ public: "<param name=\"type\" gui-text=\"" N_("Blur type:") "\" type=\"enum\" >\n" "<_item value=\"outer\">" N_("Outer") "</_item>\n" "<_item value=\"inner\">" N_("Inner") "</_item>\n" - "<_item value=\"cutout\">" N_("Cutout") "</_item>\n" + "<_item value=\"innercut\">" N_("Inner cutout") "</_item>\n" + "<_item value=\"outercut\">" N_("Outer cutout") "</_item>\n" "</param>\n" "</page>\n" "<page name=\"coltab\" _gui-text=\"" N_("Blur color") "\">\n" @@ -113,14 +115,26 @@ ColorizableDropShadow::get_filter_text (Inkscape::Extension::Extension * ext) g << ((color >> 16) & 0xff); b << ((color >> 8) & 0xff); - if (ext->get_param_bool("objcolor")) { - comp1in1 << "SourceGraphic"; - comp1in2 << "flood"; + // Select object or user-defined color + if ((g_ascii_strcasecmp("outercut", type) == 0)) { + if (ext->get_param_bool("objcolor")) { + comp2in1 << "SourceGraphic"; + comp2in2 << "offset"; + } else { + comp2in1 << "offset"; + comp2in2 << "SourceGraphic"; + } } else { - comp1in1 << "flood"; - comp1in2 << "SourceGraphic"; + if (ext->get_param_bool("objcolor")) { + comp1in1 << "SourceGraphic"; + comp1in2 << "flood"; + } else { + comp1in1 << "flood"; + comp1in2 << "SourceGraphic"; + } } + // Shadow mode if ((g_ascii_strcasecmp("outer", type) == 0)) { comp1op << "in"; comp2op << "over"; @@ -131,14 +145,18 @@ ColorizableDropShadow::get_filter_text (Inkscape::Extension::Extension * ext) comp2op << "atop"; comp2in1 << "offset"; comp2in2 << "SourceGraphic"; - } else { + } else if ((g_ascii_strcasecmp("innercut", type) == 0)) { comp1op << "in"; comp2op << "out"; comp2in1 << "offset"; comp2in2 << "SourceGraphic"; + } else { //outercut + comp1op << "out"; + comp1in1 << "flood"; + comp1in2 << "SourceGraphic"; + comp2op << "in"; } - - + _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, custom\">\n" "<feFlood flood-opacity=\"%s\" flood-color=\"rgb(%s,%s,%s)\" result=\"flood\" />\n" diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index c3a30a2f0..8b4c8805b 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -150,8 +150,8 @@ GdkpixbufInput::init(void) "<name>%s</name>\n" "<id>org.inkscape.input.gdkpixbuf.%s</id>\n" "<param name='link' type='optiongroup' appearance='full' _gui-text='" N_("Link or embed image:") "' >\n" - "<_option value='embed'>" N_("embed") "</_option>\n" - "<_option value='link'>" N_("link") "</_option>\n" + "<_option value='embed'>" N_("Embed") "</_option>\n" + "<_option value='link'>" N_("Link") "</_option>\n" "</param>\n" "<_param name='help' type='description'>" N_("Embed results in stand-alone, larger SVG files. Link references a file outside this SVG document and all files must be moved together.") "</_param>\n" "<input>\n" diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp index 8399d602f..74b6a69ee 100644 --- a/src/extension/internal/javafx-out.cpp +++ b/src/extension/internal/javafx-out.cpp @@ -492,8 +492,8 @@ bool JavaFXOutput::doCurve(SPItem *item, const String &id) } // convert the path to only lineto's and cubic curveto's: - Geom::Scale yflip(1.0, -1.0); - Geom::Affine tf = item->i2d_affine() * yflip; + Geom::Scale yflip(1.0, -1.0); /// @fixme hardcoded desktop transform! + Geom::Affine tf = item->i2dt_affine() * yflip; Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers( curve->get_pathvector() * tf ); //Count the NR_CURVETOs/LINETOs (including closing line segment) @@ -634,8 +634,8 @@ bool JavaFXOutput::doCurve(SPItem *item, const String &id) } // convert the path to only lineto's and cubic curveto's: - Geom::Scale yflip(1.0, -1.0); - Geom::Affine tf = item->i2d_affine() * yflip; + Geom::Scale yflip(1.0, -1.0); /// @fixme hardcoded desktop transform + Geom::Affine tf = item->i2dt_affine() * yflip; Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers( curve->get_pathvector() * tf ); //Count the NR_CURVETOs/LINETOs (including closing line segment) diff --git a/src/extension/internal/latex-pstricks-out.cpp b/src/extension/internal/latex-pstricks-out.cpp index 1477d5daf..376db7ee3 100644 --- a/src/extension/internal/latex-pstricks-out.cpp +++ b/src/extension/internal/latex-pstricks-out.cpp @@ -20,7 +20,7 @@ #include "extension/db.h" #include "display/nr-arena.h" #include "display/nr-arena-item.h" - +#include "sp-root.h" @@ -39,36 +39,30 @@ LatexOutput::~LatexOutput (void) //The destructor return; } -bool -LatexOutput::check (Inkscape::Extension::Extension * module) +bool LatexOutput::check(Inkscape::Extension::Extension * /*module*/) { - if (NULL == Inkscape::Extension::db.get("org.inkscape.print.latex")) - return FALSE; - return TRUE; + bool result = Inkscape::Extension::db.get("org.inkscape.print.latex") != NULL; + return result; } -void -LatexOutput::save(Inkscape::Extension::Output *mod2, SPDocument *doc, gchar const *filename) +void LatexOutput::save(Inkscape::Extension::Output * /*mod2*/, SPDocument *doc, gchar const *filename) { - Inkscape::Extension::Print *mod; SPPrintContext context; - const gchar * oldconst; - gchar * oldoutput; - unsigned int ret; + unsigned int ret = 0; doc->ensureUpToDate(); - mod = Inkscape::Extension::get_print(SP_MODULE_KEY_PRINT_LATEX); - oldconst = mod->get_param_string("destination"); - oldoutput = g_strdup(oldconst); + Inkscape::Extension::Print *mod = Inkscape::Extension::get_print(SP_MODULE_KEY_PRINT_LATEX); + const gchar * oldconst = mod->get_param_string("destination"); + gchar * oldoutput = g_strdup(oldconst); mod->set_param_string("destination", filename); /* Start */ context.module = mod; /* fixme: This has to go into module constructor somehow */ - /* Create new arena */ - mod->base = SP_ITEM(doc->getRoot()); + // Create new arena + mod->base = doc->getRoot(); mod->arena = NRArena::create(); mod->dkey = SPItem::display_key_new (1); mod->root = (mod->base)->invoke_show (mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY); diff --git a/src/extension/internal/latex-pstricks.cpp b/src/extension/internal/latex-pstricks.cpp index e09e7c024..18950295c 100644 --- a/src/extension/internal/latex-pstricks.cpp +++ b/src/extension/internal/latex-pstricks.cpp @@ -141,7 +141,7 @@ PrintLatex::begin (Inkscape::Extension::Print *mod, SPDocument *doc) os << "\\begin{pspicture}(" << doc->getWidth() << "," << doc->getHeight() << ")\n"; } - m_tr_stack.push( Geom::Scale(1, -1) * Geom::Translate(0, doc->getHeight())); + m_tr_stack.push( Geom::Scale(1, -1) * Geom::Translate(0, doc->getHeight())); /// @fixme hardcoded doc2dt transform return fprintf(_stream, "%s", os.str().c_str()); } diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp index 5d9fec905..02f0823d9 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -70,7 +70,7 @@ latex_render_document_text_to_file( SPDocument *doc, gchar const *filename, } else { // we want to export the entire document from root - base = SP_ITEM(doc->getRoot()); + base = doc->getRoot(); pageBoundingBox = !exportDrawing; } @@ -585,7 +585,7 @@ LaTeXTextRenderer::setupDocument(SPDocument *doc, bool pageBoundingBox, SPItem * // The boundingbox calculation here should be exactly the same as the one by CairoRenderer::setupDocument ! if (!base) { - base = SP_ITEM(doc->getRoot()); + base = doc->getRoot(); } Geom::OptRect d; @@ -593,7 +593,7 @@ LaTeXTextRenderer::setupDocument(SPDocument *doc, bool pageBoundingBox, SPItem * d = Geom::Rect( Geom::Point(0,0), Geom::Point(doc->getWidth(), doc->getHeight()) ); } else { - base->invoke_bbox( d, base->i2d_affine(), TRUE, SPItem::RENDERING_BBOX); + base->invoke_bbox( d, base->i2dt_affine(), TRUE, SPItem::RENDERING_BBOX); } if (!d) { g_message("LaTeXTextRenderer: could not retrieve boundingbox."); @@ -612,7 +612,7 @@ LaTeXTextRenderer::setupDocument(SPDocument *doc, bool pageBoundingBox, SPItem * } // flip y-axis - push_transform( Geom::Scale(1,-1) * Geom::Translate(0, doc->getHeight()) ); + push_transform( Geom::Scale(1,-1) * Geom::Translate(0, doc->getHeight()) ); /// @fixme hardcoded desktop transform! // write the info to LaTeX Inkscape::SVGOStringStream os; diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index 6a350ab48..568c804a0 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -946,10 +946,10 @@ static Glib::ustring formatTransform(Geom::Affine &tf) static Geom::Affine getODFTransform(const SPItem *item) { //### Get SVG-to-ODF transform - Geom::Affine tf (item->i2d_affine()); + Geom::Affine tf (item->i2dt_affine()); //Flip Y into document coordinates double doc_height = SP_ACTIVE_DOCUMENT->getHeight(); - Geom::Affine doc2dt_tf = Geom::Affine(Geom::Scale(1.0, -1.0)); + Geom::Affine doc2dt_tf = Geom::Affine(Geom::Scale(1.0, -1.0)); /// @fixme hardcoded desktop transform doc2dt_tf = doc2dt_tf * Geom::Affine(Geom::Translate(0, doc_height)); tf = tf * doc2dt_tf; tf = tf * Geom::Affine(Geom::Scale(pxToCm)); @@ -986,7 +986,7 @@ static Geom::OptRect getODFBoundingBox(const SPItem *item) */ static Geom::Affine getODFItemTransform(const SPItem *item) { - Geom::Affine itemTransform (Geom::Scale(1, -1)); + Geom::Affine itemTransform (Geom::Scale(1, -1)); /// @fixme hardcoded doc2dt transform? itemTransform = itemTransform * (Geom::Affine)item->transform; itemTransform = itemTransform * Geom::Scale(1, -1); return itemTransform; diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp index 382f8cbfb..a29aade35 100644 --- a/src/extension/internal/pov-out.cpp +++ b/src/extension/internal/pov-out.cpp @@ -301,7 +301,7 @@ bool PovOutput::doCurve(SPItem *item, const String &id) povShapes.push_back(shapeInfo); //passed all tests. save the info // convert the path to only lineto's and cubic curveto's: - Geom::Affine tf = item->i2d_affine(); + Geom::Affine tf = item->i2dt_affine(); Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers( curve->get_pathvector() * tf ); /* diff --git a/src/extension/patheffect.cpp b/src/extension/patheffect.cpp index 6da310d30..e093d20d7 100644 --- a/src/extension/patheffect.cpp +++ b/src/extension/patheffect.cpp @@ -65,11 +65,9 @@ PathEffect::processPathEffects (SPDocument * doc, Inkscape::XML::Node * path) Inkscape::Extension::PathEffect * peffect; peffect = dynamic_cast<Inkscape::Extension::PathEffect *>(Inkscape::Extension::db.get(ext_id)); if (peffect != NULL) { - + peffect->processPath(doc, path, prefs); continue; } - - peffect->processPath(doc, path, prefs); } g_strfreev(patheffects); diff --git a/src/filter-chemistry.cpp b/src/filter-chemistry.cpp index b78b96c02..e98905439 100644 --- a/src/filter-chemistry.cpp +++ b/src/filter-chemistry.cpp @@ -328,9 +328,9 @@ new_filter_simple_from_item (SPDocument *document, SPItem *item, const char *mod width = height = 0; } - Geom::Affine i2d (item->i2d_affine () ); + Geom::Affine i2dt (item->i2dt_affine () ); - return (new_filter_blend_gaussian_blur (document, mode, radius, i2d.descrim(), i2d.expansionX(), i2d.expansionY(), width, height)); + return (new_filter_blend_gaussian_blur (document, mode, radius, i2dt.descrim(), i2dt.expansionX(), i2dt.expansionY(), width, height)); } /** @@ -363,7 +363,7 @@ SPFilter *modify_filter_gaussian_blur_from_item(SPDocument *document, SPItem *it } // Determine the required standard deviation value - Geom::Affine i2d (item->i2d_affine ()); + Geom::Affine i2d (item->i2dt_affine ()); double expansion = i2d.descrim(); double stdDeviation = radius; if (expansion != 0) diff --git a/src/flood-context.cpp b/src/flood-context.cpp index d93e0284d..84c97b096 100644 --- a/src/flood-context.cpp +++ b/src/flood-context.cpp @@ -784,8 +784,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even document->ensureUpToDate(); - SPItem *document_root = SP_ITEM(document->getRoot()); - Geom::OptRect bbox = document_root->getBounds(Geom::identity()); + Geom::OptRect bbox = document->getRoot()->getBounds(Geom::identity()); if (!bbox) { desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("<b>Area is not bounded</b>, cannot fill.")); @@ -813,7 +812,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even Geom::Affine affine = scale * Geom::Translate(-origin * scale); /* Create ArenaItems and set transform */ - NRArenaItem *root = SP_ITEM(document->getRoot())->invoke_show( arena, dkey, SP_ITEM_SHOW_DISPLAY); + NRArenaItem *root = document->getRoot()->invoke_show( arena, dkey, SP_ITEM_SHOW_DISPLAY); nr_arena_item_set_transform(NR_ARENA_ITEM(root), affine); NRGC gc(NULL); @@ -849,7 +848,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even cairo_surface_destroy(s); // Hide items - SP_ITEM(document->getRoot())->invoke_hide(dkey); + document->getRoot()->invoke_hide(dkey); nr_object_unref((NRObject *) arena); } diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index 642ddba5b..f803d7bf8 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -789,7 +789,7 @@ void sp_item_gradient_set_coords(SPItem *item, guint point_type, guint point_i, gradient = sp_gradient_convert_to_userspace (gradient, item, fill_or_stroke? "fill" : "stroke"); - Geom::Affine i2d (item->i2d_affine ()); + Geom::Affine i2d (item->i2dt_affine ()); Geom::Point p = p_w * i2d.inverse(); p *= (gradient->gradientTransform).inverse(); // now p is in gradient's original coordinates @@ -1070,7 +1070,7 @@ Geom::Point sp_item_gradient_get_coords(SPItem *item, guint point_type, guint po bbox->min()[Geom::X], bbox->min()[Geom::Y]); } } - p *= Geom::Affine(gradient->gradientTransform) * (Geom::Affine)item->i2d_affine(); + p *= Geom::Affine(gradient->gradientTransform) * (Geom::Affine)item->i2dt_affine(); return p; } diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp index df0a40858..c845da011 100644 --- a/src/helper/pixbuf-ops.cpp +++ b/src/helper/pixbuf-ops.cpp @@ -133,7 +133,7 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/, Geom::Affine affine = scale * Geom::Translate(-origin * scale); /* Create ArenaItems and set transform */ - NRArenaItem *root = SP_ITEM(doc->getRoot())->invoke_show( arena, dkey, SP_ITEM_SHOW_DISPLAY); + NRArenaItem *root = doc->getRoot()->invoke_show( arena, dkey, SP_ITEM_SHOW_DISPLAY); nr_arena_item_set_transform(NR_ARENA_ITEM(root), affine); NRGC gc(NULL); @@ -170,7 +170,7 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/, g_warning("sp_generate_internal_bitmap: not enough memory to create pixel buffer. Need %lld.", size); cairo_surface_destroy(surface); } - SP_ITEM(doc->getRoot())->invoke_hide(dkey); + doc->getRoot()->invoke_hide(dkey); nr_object_unref((NRObject *) arena); // gdk_pixbuf_save (pixbuf, "C:\\temp\\internal.jpg", "jpeg", NULL, "quality","100", NULL); diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp index f75f96afb..d2983806a 100644 --- a/src/helper/png-write.cpp +++ b/src/helper/png-write.cpp @@ -460,8 +460,8 @@ sp_export_png_file(SPDocument *doc, gchar const *filename, nr_arena_set_renderoffscreen(arena); unsigned const dkey = SPItem::display_key_new(1); - /* Create ArenaItems and set transform */ - ebp.root = SP_ITEM(doc->getRoot())->invoke_show(arena, dkey, SP_ITEM_SHOW_DISPLAY); + // Create ArenaItems and set transform + ebp.root = doc->getRoot()->invoke_show(arena, dkey, SP_ITEM_SHOW_DISPLAY); nr_arena_item_set_transform(NR_ARENA_ITEM(ebp.root), affine); // We show all and then hide all items we don't want, instead of showing only requested items, @@ -484,7 +484,7 @@ sp_export_png_file(SPDocument *doc, gchar const *filename, } // Hide items, this releases arenaitem - SP_ITEM(doc->getRoot())->invoke_hide(dkey); + doc->getRoot()->invoke_hide(dkey); /* Free arena */ nr_object_unref((NRObject *) arena); diff --git a/src/helper/units.cpp b/src/helper/units.cpp index 7914feeb3..4f5443e72 100644 --- a/src/helper/units.cpp +++ b/src/helper/units.cpp @@ -60,8 +60,8 @@ sp_unit_get_by_abbreviation(gchar const *abbreviation) g_return_val_if_fail(abbreviation != NULL, NULL); for (unsigned i = 0 ; i < sp_num_units ; i++) { - if (!g_strcasecmp(abbreviation, sp_units[i].abbr)) return &sp_units[i]; - if (!g_strcasecmp(abbreviation, sp_units[i].abbr_plural)) return &sp_units[i]; + if (!g_ascii_strcasecmp(abbreviation, sp_units[i].abbr)) return &sp_units[i]; + if (!g_ascii_strcasecmp(abbreviation, sp_units[i].abbr_plural)) return &sp_units[i]; } return NULL; diff --git a/src/ink-comboboxentry-action.cpp b/src/ink-comboboxentry-action.cpp index 5147b04a8..b0fd299bb 100644 --- a/src/ink-comboboxentry-action.cpp +++ b/src/ink-comboboxentry-action.cpp @@ -3,7 +3,8 @@ * Features: * Setting GtkEntryBox width in characters. * Passing a function for formatting cells. - * Displaying a warning if text isn't in list. + * Displaying a warning if entry text isn't in list. + * Check comma separated values in text against list. (Useful for font-family fallbacks.) * Setting names for GtkComboBoxEntry and GtkEntry (actionName_combobox, actionName_entry) * to allow setting resources. * @@ -35,6 +36,7 @@ static GtkWidget* create_menu_item( GtkAction* action ); // Internal static gint get_active_row_from_text( Ink_ComboBoxEntry_Action* action, const gchar* target_text ); +static gint check_comma_separated_text( Ink_ComboBoxEntry_Action* action ); // Callbacks static void combo_box_changed_cb( GtkComboBoxEntry* widget, gpointer data ); @@ -463,7 +465,9 @@ gboolean ink_comboboxentry_action_set_active_text( Ink_ComboBoxEntry_Action* ink gtk_entry_set_text( ink_comboboxentry_action->entry, text ); // Show or hide warning - if( ink_comboboxentry_action->active == -1 && ink_comboboxentry_action->warning != NULL ) { + if( ink_comboboxentry_action->active == -1 && + ink_comboboxentry_action->warning != NULL && + check_comma_separated_text( ink_comboboxentry_action ) ) { { GtkStockItem item; gboolean isStock = gtk_stock_lookup( GTK_STOCK_DIALOG_WARNING, &item ); @@ -607,6 +611,46 @@ gint get_active_row_from_text( Ink_ComboBoxEntry_Action* action, const gchar* ta } +// Checks if all comma separated text fragments are in the list. +// This is useful for checking if all fonts in a font-family fallback +// list are available on the system. +// The return value is set to the number of missing text fragments. +// This routine could also create a Pango Markup string to show which +// fragments are invalid. +// It is envisioned that one can construct a Pango Markup String here +// so that individual text fragments can be flagged as not being in the +// list. +static gint check_comma_separated_text( Ink_ComboBoxEntry_Action* action ) { + + gint ret_val = 0; + + // Parse fallback_list using a comma as deliminator + gchar** tokens = g_strsplit( action->text, ",", 0 ); + + gint i = 0; + gboolean first = TRUE; + while( tokens[i] != NULL ) { + + // Remove any surrounding white space. + g_strstrip( tokens[i] ); + + if( get_active_row_from_text( action, tokens[i] ) == -1 ) { + ret_val += 1; + } + ++i; + } + g_strfreev( tokens ); + + // Pango Markup notes: + // GString* Pango_Markup = g_string_new(""); + // if not present: + // g_string_sprintfa( Pango_Markup, "<span strikethrough=\"true\" strikethrough_color=\"#880000\">%s</span>", tokens[i] ); + // PangoLayout * pl = gtk_entry_get_layout( entry ); + // pango_layout_set_markup( pl, Pango_Markup->str, -1 ); + // g_string_free( Pango_Markup, TRUE ); + + return ret_val; +} // Callbacks --------------------------------------------------- diff --git a/src/interface.cpp b/src/interface.cpp index 9aa5cad31..25153097d 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -1261,7 +1261,7 @@ sp_ui_drag_data_received(GtkWidget *widget, ( !item->style->stroke.isNone() ? desktop->current_zoom() * item->style->stroke_width.computed * - item->i2d_affine().descrim() * 0.5 + item->i2dt_affine().descrim() * 0.5 : 0.0) + prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); @@ -1364,7 +1364,7 @@ sp_ui_drag_data_received(GtkWidget *widget, ( !item->style->stroke.isNone() ? desktop->current_zoom() * item->style->stroke_width.computed * - item->i2d_affine().descrim() * 0.5 + item->i2dt_affine().descrim() * 0.5 : 0.0) + prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); diff --git a/src/io/ftos.cpp b/src/io/ftos.cpp index 47f0dc232..b8d161ca4 100644 --- a/src/io/ftos.cpp +++ b/src/io/ftos.cpp @@ -320,6 +320,7 @@ string ftos(double val, char mode, int sigfig, int precision, int options) break; default: + g_free(p); return "**bad mode**"; } @@ -413,6 +414,7 @@ string ftos(double val, char mode, int sigfig, int precision, int options) fprintf(stderr, "*** End of ftos with ascii = ", ascii.c_str()); #endif /* finally, we can return */ + g_free(p); return ascii; } diff --git a/src/io/inkjar.cpp b/src/io/inkjar.cpp index c238aba36..20b164b99 100644 --- a/src/io/inkjar.cpp +++ b/src/io/inkjar.cpp @@ -139,16 +139,18 @@ bool JarFile::read_signature() #endif if (signature == 0x08074b50) { - //skip data descriptor - bytes = (guint8 *)malloc(sizeof(guint8) * 12); - if (!read(bytes, 12)) { - g_free(bytes); - return false; - } + //skip data descriptor + bytes = (guint8 *)g_malloc(sizeof(guint8) * 12); + if (!read(bytes, 12)) { + g_free(bytes); + return false; + } else { + g_free(bytes); + } } else if (signature == 0x02014b50 || signature == 0x04034b50) { - return true; + return true; } else { - return false; + return false; } return false; } @@ -214,6 +216,7 @@ GByteArray *JarFile::get_next_file_contents() if (_last_filename != NULL) g_free(_last_filename); _last_filename = NULL; + g_free(bytes); return NULL; } diff --git a/src/io/streamtest.cpp b/src/io/streamtest.cpp index b25ef43f0..2030e6a85 100644 --- a/src/io/streamtest.cpp +++ b/src/io/streamtest.cpp @@ -219,13 +219,15 @@ int main(int argc, char **argv) // create temp files somewhere else instead of current dir // TODO: clean them up too char * testpath = strdup("/tmp/streamtest-XXXXXX"); - testpath = mkdtemp(testpath); - if (!testpath) + char * testpath2; + testpath2 = mkdtemp(testpath); + free(testpath); + if (!testpath2) { perror("mkdtemp"); return 1; } - if (chdir(testpath)) + if (chdir(testpath2)) { perror("chdir"); return 1; diff --git a/src/knot-holder-entity.cpp b/src/knot-holder-entity.cpp index 128ca281e..835ce7550 100644 --- a/src/knot-holder-entity.cpp +++ b/src/knot-holder-entity.cpp @@ -75,9 +75,9 @@ KnotHolderEntity::~KnotHolderEntity() void KnotHolderEntity::update_knot() { - Geom::Affine const i2d(item->i2d_affine()); + Geom::Affine const i2dt(item->i2dt_affine()); - Geom::Point dp(knot_get() * i2d); + Geom::Point dp(knot_get() * i2dt); _moved_connection.block(); sp_knot_set_position(knot, dp, SP_KNOT_STATE_NORMAL); @@ -87,21 +87,21 @@ KnotHolderEntity::update_knot() Geom::Point KnotHolderEntity::snap_knot_position(Geom::Point const &p) { - Geom::Affine const i2d (item->i2d_affine()); - Geom::Point s = p * i2d; + Geom::Affine const i2dt (item->i2dt_affine()); + Geom::Point s = p * i2dt; SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop, true, item); m.freeSnapReturnByRef(s, Inkscape::SNAPSOURCE_NODE_HANDLE); m.unSetup(); - return s * i2d.inverse(); + return s * i2dt.inverse(); } Geom::Point KnotHolderEntity::snap_knot_position_constrained(Geom::Point const &p, Inkscape::Snapper::SnapConstraint const &constraint) { - Geom::Affine const i2d (item->i2d_affine()); + Geom::Affine const i2d (item->i2dt_affine()); Geom::Point s = p * i2d; SnapManager &m = desktop->namedview->snap_manager; diff --git a/src/knotholder.cpp b/src/knotholder.cpp index 59059c2a8..c26082baa 100644 --- a/src/knotholder.cpp +++ b/src/knotholder.cpp @@ -85,8 +85,6 @@ KnotHolder::~KnotHolder() { void KnotHolder::update_knots() { - Geom::Affine const i2d(item->i2d_affine()); - for(std::list<KnotHolderEntity *>::iterator i = entity.begin(); i != entity.end(); ++i) { KnotHolderEntity *e = *i; e->update_knot(); @@ -165,8 +163,8 @@ KnotHolder::knot_moved_handler(SPKnot *knot, Geom::Point const &p, guint state) for(std::list<KnotHolderEntity *>::iterator i = this->entity.begin(); i != this->entity.end(); ++i) { KnotHolderEntity *e = *i; if (e->knot == knot) { - Geom::Point const q = p * item->i2d_affine().inverse(); - e->knot_set(q, e->knot->drag_origin * item->i2d_affine().inverse(), state); + Geom::Point const q = p * item->i2dt_affine().inverse(); + e->knot_set(q, e->knot->drag_origin * item->i2dt_affine().inverse(), state); break; } } diff --git a/src/libnr/CMakeLists.txt b/src/libnr/CMakeLists.txt index b83358ae0..8a31e20db 100644 --- a/src/libnr/CMakeLists.txt +++ b/src/libnr/CMakeLists.txt @@ -8,7 +8,6 @@ set(nr_SRC nr-rect-l.cpp # nr-rotate-fns-test.cpp #nr-translate-test.cpp - nr-types.cpp # nr-types-test.cpp nr-values.cpp # testnr.cpp @@ -19,24 +18,15 @@ set(nr_SRC # in-svg-plane-test.h in-svg-plane.h nr-convert2geom.h - nr-coord.h - nr-dim2.h nr-forward.h - nr-i-coord.h nr-macros.h nr-object.h # nr-point-fns-test.h nr-point-fns.h - nr-point-l.h - nr-point-ops.h - nr-point.h nr-rect-l.h - nr-rect-ops.h nr-rect.h - nr-render.h # nr-translate-test.h # nr-types-test.h - nr-types.h nr-values.h ) diff --git a/src/libnr/Makefile_insert b/src/libnr/Makefile_insert index 57d82c8ef..cdb0b482c 100644 --- a/src/libnr/Makefile_insert +++ b/src/libnr/Makefile_insert @@ -20,6 +20,4 @@ ink_common_sources += \ # ### CxxTest stuff #### # ###################### CXXTEST_TESTSUITES += \ - $(srcdir)/libnr/in-svg-plane-test.h \ - $(srcdir)/libnr/nr-point-fns-test.h \ - $(srcdir)/libnr/nr-types-test.h + $(srcdir)/libnr/in-svg-plane-test.h diff --git a/src/libnr/in-svg-plane-test.h b/src/libnr/in-svg-plane-test.h index e64f76251..696f82421 100644 --- a/src/libnr/in-svg-plane-test.h +++ b/src/libnr/in-svg-plane-test.h @@ -4,7 +4,8 @@ #include <cmath> #include "libnr/in-svg-plane.h" -#include "2geom/isnan.h" +#include <2geom/math-utils.h> +#include <2geom/point.h> class InSvgPlaneTest : public CxxTest::TestSuite { @@ -38,14 +39,14 @@ public: } bool setupValid; - NR::Point const p3n4; - NR::Point const p0; + Geom::Point const p3n4; + Geom::Point const p0; double const small; double const inf; double const nan; - NR::Point const small_left; - NR::Point const small_n3_4; - NR::Point const part_nan; + Geom::Point const small_left; + Geom::Point const small_n3_4; + Geom::Point const part_nan; void testInSvgPlane(void) @@ -55,13 +56,13 @@ public: TS_ASSERT( in_svg_plane(small_left) ); TS_ASSERT( in_svg_plane(small_n3_4) ); TS_ASSERT_DIFFERS( nan, nan ); - TS_ASSERT( !in_svg_plane(NR::Point(nan, 3.)) ); - TS_ASSERT( !in_svg_plane(NR::Point(inf, nan)) ); - TS_ASSERT( !in_svg_plane(NR::Point(0., -inf)) ); + TS_ASSERT( !in_svg_plane(Geom::Point(nan, 3.)) ); + TS_ASSERT( !in_svg_plane(Geom::Point(inf, nan)) ); + TS_ASSERT( !in_svg_plane(Geom::Point(0., -inf)) ); double const xs[] = {inf, -inf, nan, 1., -2., small, -small}; for (unsigned i = 0; i < G_N_ELEMENTS(xs); ++i) { for (unsigned j = 0; j < G_N_ELEMENTS(xs); ++j) { - TS_ASSERT_EQUALS( in_svg_plane(NR::Point(xs[i], xs[j])), + TS_ASSERT_EQUALS( in_svg_plane(Geom::Point(xs[i], xs[j])), (fabs(xs[i]) < inf && fabs(xs[j]) < inf ) ); } diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index 7fc0a9715..e6d22e070 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -404,7 +404,10 @@ Glib::ustring font_factory::GetUIFamilyString(PangoFontDescription const *fontDe if (fontDescr) { // For now, keep it as family name taken from pango - family = pango_font_description_get_family(fontDescr); + const char *pangoFamily = pango_font_description_get_family(fontDescr); + if( pangoFamily ) { + family = pangoFamily; + } } return family; diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp index 1b65dd88c..641adc3ac 100644 --- a/src/libnrtype/FontInstance.cpp +++ b/src/libnrtype/FontInstance.cpp @@ -385,7 +385,8 @@ unsigned int font_instance::Attribute(const gchar *key, gchar *str, unsigned int } } if (free_res) { - free(res); + g_free(res); + res = 0; } return len; } diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index 522b3cdc6..b025debb3 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -517,7 +517,7 @@ void collectPathsAndWidths (SPLPEItem const *lpeitem, std::vector<Geom::Path> &p for (unsigned i=0; i<subpaths.size(); i++){ paths.push_back(subpaths[i]); //FIXME: do we have to be more carefull when trying to access stroke width? - stroke_widths.push_back(SP_ITEM(lpeitem)->style->stroke_width.computed); + stroke_widths.push_back(lpeitem->style->stroke_width.computed); } } } diff --git a/src/live_effects/lpe-lattice.cpp b/src/live_effects/lpe-lattice.cpp index 50ecdf04b..473469c8a 100644 --- a/src/live_effects/lpe-lattice.cpp +++ b/src/live_effects/lpe-lattice.cpp @@ -1,4 +1,3 @@ -#define INKSCAPE_LPE_LATTICE_CPP /** \file * LPE <lattice> implementation @@ -283,7 +282,7 @@ LPELattice::addHelperPathsImpl(SPLPEItem *lpeitem, SPDesktop *desktop) c->lineto(grid_point3); // TODO: factor this out (and remove the #include of desktop.h above) - SPCanvasItem *canvasitem = sp_nodepath_generate_helperpath(desktop, c, SP_ITEM(lpeitem), 0x009000ff); + SPCanvasItem *canvasitem = sp_nodepath_generate_helperpath(desktop, c, lpeitem, 0x009000ff); Inkscape::Display::TemporaryItem* tmpitem = desktop->add_temporary_canvasitem (canvasitem, 0); lpeitem->lpe_helperpaths.push_back(tmpitem); diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp index dec8c9216..02d24752b 100644 --- a/src/live_effects/lpe-mirror_symmetry.cpp +++ b/src/live_effects/lpe-mirror_symmetry.cpp @@ -45,9 +45,8 @@ LPEMirrorSymmetry::doOnApply (SPLPEItem *lpeitem) { using namespace Geom; - SPItem *item = SP_ITEM(lpeitem); - Geom::Affine t = item->i2d_affine(); - Geom::Rect bbox = *item->getBounds(t); // fixme: what happens if getBounds does not return a valid rect? + Geom::Affine t = lpeitem->i2dt_affine(); + Geom::Rect bbox = *lpeitem->getBounds(t); // fixme: what happens if getBounds does not return a valid rect? Point A(bbox.left(), bbox.bottom()); Point B(bbox.left(), bbox.top()); diff --git a/src/live_effects/lpegroupbbox.cpp b/src/live_effects/lpegroupbbox.cpp index 2678509a4..382231378 100644 --- a/src/live_effects/lpegroupbbox.cpp +++ b/src/live_effects/lpegroupbbox.cpp @@ -26,17 +26,15 @@ void GroupBBoxEffect::original_bbox(SPLPEItem *lpeitem, bool absolute) { // Get item bounding box - SPItem* item = SP_ITEM(lpeitem); - Geom::Affine transform; if (absolute) { - transform = item->i2doc_affine(); + transform = lpeitem->i2doc_affine(); } else { transform = Geom::identity(); } - Geom::OptRect bbox = item->getBounds(transform, SPItem::GEOMETRIC_BBOX); + Geom::OptRect bbox = lpeitem->getBounds(transform, SPItem::GEOMETRIC_BBOX); if (bbox) { boundingbox_X = (*bbox)[Geom::X]; boundingbox_Y = (*bbox)[Geom::Y]; diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index bd9748fd6..32da0a426 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -208,7 +208,7 @@ PathParam::param_editOncanvas(SPItem *item, SPDesktop * dt) ShapeRecord r; r.role = SHAPE_ROLE_LPE_PARAM; - r.edit_transform = item->i2d_affine(); // TODO is it right? + r.edit_transform = item->i2dt_affine(); // TODO is it right? if (!href) { r.item = reinterpret_cast<SPItem*>(param_effect->getLPEObj()); r.lpe_key = param_key; diff --git a/src/main.cpp b/src/main.cpp index 1614e97f7..ace99f519 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1321,7 +1321,7 @@ sp_do_export_png(SPDocument *doc) // write object bbox to area doc->ensureUpToDate(); Geom::OptRect areaMaybe; - static_cast<SPItem *>(o_area)->invoke_bbox( areaMaybe, static_cast<SPItem *>(o_area)->i2d_affine(), TRUE); + static_cast<SPItem *>(o_area)->invoke_bbox( areaMaybe, static_cast<SPItem *>(o_area)->i2dt_affine(), TRUE); if (areaMaybe) { area = *areaMaybe; } else { diff --git a/src/marker.cpp b/src/marker.cpp index 2354d686c..d3fa83ed6 100644 --- a/src/marker.cpp +++ b/src/marker.cpp @@ -191,14 +191,9 @@ sp_marker_release (SPObject *object) * SP_ATTR_VIEWBOX * SP_ATTR_PRESERVEASPECTRATIO */ -static void -sp_marker_set (SPObject *object, unsigned int key, const gchar *value) +static void sp_marker_set(SPObject *object, unsigned int key, const gchar *value) { - SPItem *item; - SPMarker *marker; - - item = SP_ITEM (object); - marker = SP_MARKER (object); + SPMarker *marker = SP_MARKER(object); switch (key) { case SP_ATTR_MARKERUNITS: @@ -339,18 +334,12 @@ sp_marker_set (SPObject *object, unsigned int key, const gchar *value) * Updates <marker> when its attributes have changed. Takes care of setting up * transformations and viewBoxes. */ -static void -sp_marker_update (SPObject *object, SPCtx *ctx, guint flags) +static void sp_marker_update(SPObject *object, SPCtx *ctx, guint flags) { - SPItem *item; - SPMarker *marker; + SPMarker *marker = SP_MARKER(object); SPItemCtx rctx; - Geom::Rect vb; + Geom::Rect vb; double x, y, width, height; - SPMarkerView *v; - - item = SP_ITEM (object); - marker = SP_MARKER (object); /* fixme: We have to set up clip here too */ @@ -450,19 +439,20 @@ sp_marker_update (SPObject *object, SPCtx *ctx, guint flags) rctx.i2vp = Geom::identity(); } - /* And invoke parent method */ - if (((SPObjectClass *) (parent_class))->update) + // And invoke parent method + if (((SPObjectClass *) (parent_class))->update) { ((SPObjectClass *) (parent_class))->update (object, (SPCtx *) &rctx, flags); + } - /* As last step set additional transform of arena group */ - for (v = marker->views; v != NULL; v = v->next) { - for (unsigned i = 0 ; i < v->items.size() ; i++) { + // As last step set additional transform of arena group + for (SPMarkerView *v = marker->views; v != NULL; v = v->next) { + for (unsigned i = 0 ; i < v->items.size() ; i++) { if (v->items[i]) { Geom::Affine tmp = marker->c2p; nr_arena_group_set_child_transform(NR_ARENA_GROUP(v->items[i]), &tmp); } - } - } + } + } } /** diff --git a/src/mod360-test.h b/src/mod360-test.h index 508553970..932361eb3 100644 --- a/src/mod360-test.h +++ b/src/mod360-test.h @@ -3,9 +3,7 @@ #define SEEN_MOD_360_TEST_H #include <cxxtest/TestSuite.h> - -#include "2geom/isnan.h" - +#include <2geom/math-utils.h> #include "mod360.h" diff --git a/src/object-edit.cpp b/src/object-edit.cpp index 28c8d44db..f042d2cf2 100644 --- a/src/object-edit.cpp +++ b/src/object-edit.cpp @@ -474,7 +474,7 @@ Box3DKnotHolderEntity::knot_set_generic(SPItem *item, unsigned int knot_id, Geom g_assert(item != NULL); SPBox3D *box = SP_BOX3D(item); - Geom::Affine const i2d (item->i2d_affine ()); + Geom::Affine const i2dt (item->i2dt_affine ()); Box3D::Axis movement; if ((knot_id < 4) != (state & GDK_SHIFT_MASK)) { @@ -483,7 +483,7 @@ Box3DKnotHolderEntity::knot_set_generic(SPItem *item, unsigned int knot_id, Geom movement = Box3D::Z; } - box3d_set_corner (box, knot_id, s * i2d, movement, (state & GDK_CONTROL_MASK)); + box3d_set_corner (box, knot_id, s * i2dt, movement, (state & GDK_CONTROL_MASK)); box3d_set_z_orders(box); box3d_position_set(box); } @@ -650,9 +650,9 @@ Box3DKnotHolderEntityCenter::knot_set(Geom::Point const &new_pos, Geom::Point co Geom::Point const s = snap_knot_position(new_pos); SPBox3D *box = SP_BOX3D(item); - Geom::Affine const i2d (item->i2d_affine ()); + Geom::Affine const i2dt (item->i2dt_affine ()); - box3d_set_center (SP_BOX3D(item), s * i2d, origin * i2d, !(state & GDK_SHIFT_MASK) ? Box3D::XY : Box3D::Z, + box3d_set_center (SP_BOX3D(item), s * i2dt, origin * i2dt, !(state & GDK_SHIFT_MASK) ? Box3D::XY : Box3D::Z, state & GDK_CONTROL_MASK); box3d_set_z_orders(box); diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp index 1944f7ffa..389930b57 100644 --- a/src/object-snapper.cpp +++ b/src/object-snapper.cpp @@ -147,7 +147,7 @@ void Inkscape::ObjectSnapper::_findCandidates(SPObject* parent, item->i2doc_affine() * additional_affine * _snapmanager->getDesktop()->doc2dt(), true); } else { - item->invoke_bbox( bbox_of_item, item->i2d_affine(), true); + item->invoke_bbox( bbox_of_item, item->i2dt_affine(), true); } if (bbox_of_item) { // See if the item is within range @@ -287,7 +287,7 @@ void Inkscape::ObjectSnapper::_snapNodes(SnappedConstraints &sc, for (std::vector<SnapCandidatePoint>::const_iterator k = _points_to_snap_to->begin(); k != _points_to_snap_to->end(); k++) { if (_allowSourceToSnapToTarget(p.getSourceType(), (*k).getTargetType(), strict_snapping)) { Geom::Point target_pt = (*k).getPoint(); - Geom::Coord dist = NR_HUGE; + Geom::Coord dist = Geom::infinity(); 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 @@ -406,7 +406,7 @@ void Inkscape::ObjectSnapper::_collectPaths(Geom::Point /*p*/, Inkscape::Text::Layout const *layout = te_get_layout((SPItem *) root_item); if (layout != NULL && layout->outputExists()) { Geom::PathVector *pv = new Geom::PathVector(); - pv->push_back(layout->baseline() * root_item->i2d_affine() * (*i).additional_affine * _snapmanager->getDesktop()->doc2dt()); + pv->push_back(layout->baseline() * root_item->i2dt_affine() * (*i).additional_affine * _snapmanager->getDesktop()->doc2dt()); _paths_to_snap_to->push_back(Inkscape::SnapCandidatePath(pv, SNAPTARGET_TEXT_BASELINE, Geom::OptRect())); } } @@ -432,7 +432,7 @@ void Inkscape::ObjectSnapper::_collectPaths(Geom::Point /*p*/, // Geom::PathVector *pv = pathvector_for_curve(root_item, curve, true, true, Geom::identity(), (*i).additional_affine); Geom::PathVector *pv = new Geom::PathVector(curve->get_pathvector()); - (*pv) *= root_item->i2d_affine() * (*i).additional_affine * _snapmanager->getDesktop()->doc2dt(); // (_edit_transform * _i2d_transform); + (*pv) *= root_item->i2dt_affine() * (*i).additional_affine * _snapmanager->getDesktop()->doc2dt(); // (_edit_transform * _i2d_transform); _paths_to_snap_to->push_back(Inkscape::SnapCandidatePath(pv, SNAPTARGET_PATH, Geom::OptRect())); // Perhaps for speed, get a reference to the Geom::pathvector, and store the transformation besides it. curve->unref(); @@ -483,9 +483,15 @@ void Inkscape::ObjectSnapper::_snapPaths(SnappedConstraints &sc, * manually when applicable. * */ if (node_tool_active) { - SPCurve *curve = curve_for_item(SP_ITEM(selected_path)); + // TODO fix the function to be const correct: + SPCurve *curve = curve_for_item(const_cast<SPPath*>(selected_path)); if (curve) { - Geom::PathVector *pathv = pathvector_for_curve(SP_ITEM(selected_path), curve, true, true, Geom::identity(), Geom::identity()); // We will get our own copy of the path, which must be freed at some point + Geom::PathVector *pathv = pathvector_for_curve(const_cast<SPPath*>(selected_path), + curve, + true, + true, + Geom::identity(), + Geom::identity()); // We will get our own copy of the path, which must be freed at some point _paths_to_snap_to->push_back(Inkscape::SnapCandidatePath(pathv, SNAPTARGET_PATH, Geom::OptRect(), true)); curve->unref(); } diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index 607d0ab6a..bd72632b2 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -205,14 +205,16 @@ sp_selected_path_break_apart(SPDesktop *desktop) SPItem *item = (SPItem *) items->data; - if (!SP_IS_PATH(item)) + if (!SP_IS_PATH(item)) { continue; + } SPPath *path = SP_PATH(item); - SPCurve *curve = sp_path_get_curve_for_edit(SP_PATH(path)); - if (curve == NULL) + SPCurve *curve = sp_path_get_curve_for_edit(path); + if (curve == NULL) { continue; + } did = true; @@ -225,7 +227,7 @@ sp_selected_path_break_apart(SPDesktop *desktop) // XML Tree being used directly here while it shouldn't be... gchar *path_effect = g_strdup(item->getRepr()->attribute("inkscape:path-effect")); - Geom::PathVector apv = curve->get_pathvector() * SP_ITEM(path)->transform; + Geom::PathVector apv = curve->get_pathvector() * path->transform; curve->unref(); diff --git a/src/prefix.cpp b/src/prefix.cpp index 92409a7d2..99e20171f 100644 --- a/src/prefix.cpp +++ b/src/prefix.cpp @@ -340,8 +340,8 @@ br_strndup (char *str, size_t size) * path: A path. * Returns: A directory name. This string should be freed when no longer needed. * - * Extracts the directory component of path. Similar to g_dirname() or the dirname - * commandline application. + * Extracts the directory component of path. Similar to g_path_get_dirname() + * or the dirname commandline application. * * Example: * br_extract_dir ("/usr/local/foobar"); --> Returns: "/usr/local" diff --git a/src/print.cpp b/src/print.cpp index 0774f5751..1ee58a3e6 100644 --- a/src/print.cpp +++ b/src/print.cpp @@ -21,6 +21,7 @@ #include "extension/print.h" #include "extension/system.h" #include "print.h" +#include "sp-root.h" #include "ui/dialog/print.h" @@ -90,7 +91,7 @@ sp_print_document(Gtk::Window& parentWindow, SPDocument *doc) doc->ensureUpToDate(); // Build arena - SPItem *base = SP_ITEM(doc->getRoot()); + SPItem *base = doc->getRoot(); NRArena *arena = NRArena::create(); unsigned int dkey = SPItem::display_key_new(1); // TODO investigate why we are grabbing root and then ignoring it. @@ -126,7 +127,7 @@ sp_print_document_to_file(SPDocument *doc, gchar const *filename) context.module = mod; /* fixme: This has to go into module constructor somehow */ /* Create new arena */ - mod->base = SP_ITEM(doc->getRoot()); + mod->base = doc->getRoot(); mod->arena = NRArena::create(); mod->dkey = SPItem::display_key_new(1); mod->root = (mod->base)->invoke_show(mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY); diff --git a/src/selcue.cpp b/src/selcue.cpp index 171178c41..c647c1f96 100644 --- a/src/selcue.cpp +++ b/src/selcue.cpp @@ -191,7 +191,7 @@ void Inkscape::SelCue::_newTextBaselines() NULL); sp_canvas_item_show(baseline_point); - SP_CTRL(baseline_point)->moveto((*pt) * item->i2d_affine()); + SP_CTRL(baseline_point)->moveto((*pt) * item->i2dt_affine()); sp_canvas_item_move_to_z(baseline_point, 0); } } diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 9b88077e7..23991bfb6 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -1399,7 +1399,7 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Affine cons item->readAttr( "transform" ); // calculate the matrix we need to apply to the clone to cancel its induced transform from its original - Geom::Affine parent2dt = SP_ITEM(item->parent)->i2d_affine(); + Geom::Affine parent2dt = SP_ITEM(item->parent)->i2dt_affine(); Geom::Affine t = parent2dt * affine * parent2dt.inverse(); Geom::Affine t_inv = t.inverse(); Geom::Affine result = t_inv * item->transform * t; @@ -1442,7 +1442,7 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Affine cons } else { if (set_i2d) { - item->set_i2d_affine(item->i2d_affine() * (Geom::Affine)affine); + item->set_i2d_affine(item->i2dt_affine() * (Geom::Affine)affine); } item->doWriteTransform(item->getRepr(), item->transform, NULL, compensate); } @@ -2248,8 +2248,8 @@ sp_select_clone_original(SPDesktop *desktop) Inkscape::Preferences *prefs = Inkscape::Preferences::get(); bool highlight = prefs->getBool("/options/highlightoriginal/value"); if (highlight) { - Geom::OptRect a = item->getBounds(item->i2d_affine()); - Geom::OptRect b = original->getBounds(original->i2d_affine()); + Geom::OptRect a = item->getBounds(item->i2dt_affine()); + Geom::OptRect b = original->getBounds(original->i2dt_affine()); if ( a && b ) { // draw a flashing line between the objects SPCurve *curve = new SPCurve(); @@ -2691,14 +2691,15 @@ void sp_selection_create_bitmap_copy(SPDesktop *desktop) g_strcanon(basename, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.=+~$#@^&!?", '_'); // Build the complete path by adding document base dir, if set, otherwise home dir - gchar * directory = NULL; + gchar *directory = NULL; if ( document->getURI() ) { - directory = g_dirname( document->getURI() ); + directory = g_path_get_dirname( document->getURI() ); } if (directory == NULL) { directory = homedir_path(NULL); } gchar *filepath = g_build_filename(directory, basename, NULL); + g_free(directory); //g_print("%s\n", filepath); @@ -2766,7 +2767,7 @@ void sp_selection_create_bitmap_copy(SPDesktop *desktop) } // Calculate the matrix that will be applied to the image so that it exactly overlaps the source objects - Geom::Affine eek(SP_ITEM(parent_object)->i2d_affine()); + Geom::Affine eek(SP_ITEM(parent_object)->i2dt_affine()); Geom::Affine t; double shift_x = bbox->min()[Geom::X]; @@ -2775,7 +2776,7 @@ void sp_selection_create_bitmap_copy(SPDesktop *desktop) shift_x = round(shift_x); shift_y = -round(-shift_y); // this gets correct rounding despite coordinate inversion, remove the negations when the inversion is gone } - t = Geom::Scale(1, -1) * Geom::Translate(shift_x, shift_y) * eek.inverse(); + t = Geom::Scale(1, -1) * Geom::Translate(shift_x, shift_y) * eek.inverse(); /// @fixme hardcoded doc2dt transform? // Do the export sp_export_png_file(document, filepath, @@ -3231,7 +3232,7 @@ fit_canvas_to_drawing(SPDocument *doc, bool with_margins) doc->ensureUpToDate(); SPItem const *const root = doc->getRoot(); - Geom::OptRect const bbox(root->getBounds(root->i2d_affine(), SPItem::RENDERING_BBOX)); + Geom::OptRect const bbox(root->getBounds(root->i2dt_affine(), SPItem::RENDERING_BBOX)); if (bbox) { doc->fitToRect(*bbox, with_margins); return true; diff --git a/src/seltrans.cpp b/src/seltrans.cpp index f6a702ed9..bc8194d48 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -267,7 +267,7 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s SPItem *it = reinterpret_cast<SPItem*>(sp_object_ref(SP_ITEM(l->data), NULL)); _items.push_back(it); _items_const.push_back(it); - _items_affines.push_back(it->i2d_affine()); + _items_affines.push_back(it->i2dt_affine()); _items_centers.push_back(it->getCenter()); // for content-dragging, we need to remember original centers } @@ -586,7 +586,7 @@ void Inkscape::SelTrans::stamp() Geom::Affine const *new_affine; if (_show == SHOW_OUTLINE) { - Geom::Affine const i2d(original_item->i2d_affine()); + Geom::Affine const i2d(original_item->i2dt_affine()); Geom::Affine const i2dnew( i2d * _current_relative_affine ); copy_item->set_i2d_affine(i2dnew); new_affine = ©_item->transform; diff --git a/src/snap.cpp b/src/snap.cpp index 3e79a221e..a3015e576 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -375,7 +375,7 @@ Inkscape::SnappedPoint SnapManager::constrainedSnap(Inkscape::SnapCandidatePoint // First project the mouse pointer onto the constraint Geom::Point pp = constraint.projection(p.getPoint()); - Inkscape::SnappedPoint no_snap = Inkscape::SnappedPoint(pp, p.getSourceType(), p.getSourceNum(), Inkscape::SNAPTARGET_CONSTRAINT, NR_HUGE, 0, false, true, false); + Inkscape::SnappedPoint no_snap = Inkscape::SnappedPoint(pp, p.getSourceType(), p.getSourceNum(), Inkscape::SNAPTARGET_CONSTRAINT, Geom::infinity(), 0, false, true, false); if (!someSnapperMightSnap()) { // Always return point on constraint @@ -437,7 +437,7 @@ Inkscape::SnappedPoint SnapManager::multipleConstrainedSnaps(Inkscape::SnapCandi Geom::OptRect const &bbox_to_snap) const { - Inkscape::SnappedPoint no_snap = Inkscape::SnappedPoint(p.getPoint(), p.getSourceType(), p.getSourceNum(), Inkscape::SNAPTARGET_CONSTRAINT, NR_HUGE, 0, false, true, false); + Inkscape::SnappedPoint no_snap = Inkscape::SnappedPoint(p.getPoint(), p.getSourceType(), p.getSourceNum(), Inkscape::SNAPTARGET_CONSTRAINT, Geom::infinity(), 0, false, true, false); if (constraints.size() == 0) { return no_snap; } @@ -746,6 +746,7 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed( // std::cout << std::endl; bool first_free_snap = true; + for (std::vector<Inkscape::SnapCandidatePoint>::const_iterator i = points.begin(); i != points.end(); i++) { /* Snap it */ @@ -828,7 +829,7 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed( break; case SCALE: { - result = Geom::Point(NR_HUGE, NR_HUGE); + 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 @@ -839,7 +840,7 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed( 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 have left result[1-index] = NR_HUGE + // we might have left result[1-index] = Geom::infinity() // if scaling didn't occur in the other direction } } @@ -850,18 +851,19 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed( result[0] = result[1]; } } + // 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 - if (scale_metric[0] == NR_HUGE || scale_metric[1] == NR_HUGE) { + Geom::Point scale_metric = Geom::abs(result - transformation); // One or both of its components might be Geom::infinity() + if (scale_metric[0] == Geom::infinity() || scale_metric[1] == Geom::infinity()) { snapped_point.setSnapDistance(std::min(scale_metric[0], scale_metric[1])); } else { snapped_point.setSnapDistance(Geom::L2(scale_metric)); } - snapped_point.setSecondSnapDistance(NR_HUGE); + snapped_point.setSecondSnapDistance(Geom::infinity()); break; } case STRETCH: - result = Geom::Point(NR_HUGE, NR_HUGE); + 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; @@ -873,14 +875,14 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed( } // Store the metric for this transformation as a virtual distance snapped_point.setSnapDistance(std::abs(result[dim] - transformation[dim])); - snapped_point.setSecondSnapDistance(NR_HUGE); + 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(NR_HUGE); + 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 @@ -889,7 +891,7 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed( if (Geom::L2(b) < 1e-9) { // points too close to the rotation center will not move. Don't try to snap these // as they will always yield a perfect snap result if they're already snapped beforehand (e.g. // when the transformation center has been snapped to a grid intersection in the selector tool) - snapped_point.setSnapDistance(NR_HUGE); + snapped_point.setSnapDistance(Geom::infinity()); // PS1: Apparently we don't have to do this for skewing, but why? // PS2: We cannot easily filter these points upstream, e.g. in the grab() method (seltrans.cpp) // because the rotation center will change when pressing shift, and grab() won't be recalled. @@ -898,7 +900,7 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed( } else { snapped_point.setSnapDistance(std::abs(result[0] - transformation[0])); } - snapped_point.setSecondSnapDistance(NR_HUGE); + snapped_point.setSecondSnapDistance(Geom::infinity()); break; default: g_assert_not_reached(); @@ -930,10 +932,10 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed( Geom::Coord best_metric; if (transformation_type == SCALE) { - // When scaling, don't ever exit with one of scaling components set to Geom::infinity() + // When scaling, don't ever exit with one of scaling components uninitialized for (int index = 0; index < 2; index++) { - if (best_transformation[index] == Geom::infinity()) { - if (uniform && best_transformation[1-index] < Geom::infinity()) { + if (fabs(best_transformation[index]) == Geom::infinity()) { + if (uniform && fabs(best_transformation[1-index]) < Geom::infinity()) { best_transformation[index] = best_transformation[1-index]; } else { best_transformation[index] = transformation[index]; @@ -1456,8 +1458,8 @@ void SnapManager::keepClosestPointOnly(std::vector<Inkscape::SnapCandidatePoint> { if (points.size() < 2) return; - Inkscape::SnapCandidatePoint closest_point = Inkscape::SnapCandidatePoint(Geom::Point(NR_HUGE, NR_HUGE), Inkscape::SNAPSOURCE_UNDEFINED, Inkscape::SNAPTARGET_UNDEFINED); - Geom::Coord closest_dist = NR_HUGE; + Inkscape::SnapCandidatePoint closest_point = Inkscape::SnapCandidatePoint(Geom::Point(Geom::infinity(), Geom::infinity()), Inkscape::SNAPSOURCE_UNDEFINED, Inkscape::SNAPTARGET_UNDEFINED); + Geom::Coord closest_dist = Geom::infinity(); for(std::vector<Inkscape::SnapCandidatePoint>::const_iterator i = points.begin(); i != points.end(); i++) { Geom::Coord dist = Geom::L2((*i).getPoint() - reference); diff --git a/src/sp-conn-end-pair.cpp b/src/sp-conn-end-pair.cpp index e22145425..00b9ab0e9 100644 --- a/src/sp-conn-end-pair.cpp +++ b/src/sp-conn-end-pair.cpp @@ -212,12 +212,12 @@ SPConnEndPair::getAttachedItems(SPItem *h2attItem[2]) const { } } -void -SPConnEndPair::getEndpoints(Geom::Point endPts[]) const { +void SPConnEndPair::getEndpoints(Geom::Point endPts[]) const +{ SPCurve *curve = _path->original_curve ? _path->original_curve : _path->curve; - SPItem *h2attItem[2]; + SPItem *h2attItem[2] = {0}; getAttachedItems(h2attItem); - Geom::Affine i2d = SP_ITEM(_path)->i2doc_affine(); + Geom::Affine i2d = _path->i2doc_affine(); for (unsigned h = 0; h < 2; ++h) { if ( h2attItem[h] ) { @@ -407,7 +407,7 @@ SPConnEndPair::reroutePathFromLibavoid(void) recreateCurve( curve, _connRef, _connCurvature ); - Geom::Affine doc2item = SP_ITEM(_path)->i2doc_affine().inverse(); + Geom::Affine doc2item = _path->i2doc_affine().inverse(); curve->transform(doc2item); return true; diff --git a/src/sp-conn-end.cpp b/src/sp-conn-end.cpp index 538638d7a..71b4f45a7 100644 --- a/src/sp-conn-end.cpp +++ b/src/sp-conn-end.cpp @@ -141,12 +141,11 @@ sp_conn_get_route_and_redraw(SPPath *const path, return; } - SPItem *h2attItem[2]; + SPItem *h2attItem[2] = {0}; path->connEndPair.getAttachedItems(h2attItem); - SPItem const *const path_item = SP_ITEM(path); - SPObject const *const ancestor = get_nearest_common_ancestor(path_item, h2attItem); - Geom::Affine const path2anc(i2anc_affine(path_item, ancestor)); + SPObject const *const ancestor = get_nearest_common_ancestor(path, h2attItem); + Geom::Affine const path2anc(i2anc_affine(path, ancestor)); // Set sensible values incase there the connector ends are not // attached to any shapes. diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 7ebedb816..d2ca2c445 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -282,7 +282,7 @@ static void sp_genericellipse_snappoints(SPItem const *item, std::vector<Inkscap SPGenericEllipse *ellipse = SP_GENERICELLIPSE(item); sp_genericellipse_normalize(ellipse); - Geom::Affine const i2d = item->i2d_affine(); + Geom::Affine const i2dt = item->i2dt_affine(); // figure out if we have a slice, while guarding against rounding errors bool slice = false; @@ -308,7 +308,7 @@ static void sp_genericellipse_snappoints(SPItem const *item, std::vector<Inkscap double angle = 0; for (angle = 0; angle < SP_2PI; angle += M_PI_2) { if (angle >= ellipse->start && angle <= ellipse->end) { - pt = Geom::Point(cx + cos(angle)*rx, cy + sin(angle)*ry) * i2d; + pt = Geom::Point(cx + cos(angle)*rx, cy + sin(angle)*ry) * i2dt; p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_ELLIPSE_QUADRANT_POINT, Inkscape::SNAPTARGET_ELLIPSE_QUADRANT_POINT)); } } @@ -316,7 +316,7 @@ static void sp_genericellipse_snappoints(SPItem const *item, std::vector<Inkscap // Add the centre, if we have a closed slice or when explicitly asked for if ((snapprefs->getSnapToItemNode() && slice && ellipse->closed) || snapprefs->getSnapObjectMidpoints()) { - pt = Geom::Point(cx, cy) * i2d; + pt = Geom::Point(cx, cy) * i2dt; p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_OBJECT_MIDPOINT, Inkscape::SNAPTARGET_OBJECT_MIDPOINT)); } @@ -324,12 +324,12 @@ static void sp_genericellipse_snappoints(SPItem const *item, std::vector<Inkscap if (snapprefs->getSnapToItemNode() && slice) { // Add the start point, if it's not coincident with a quadrant point if (fmod(ellipse->start, M_PI_2) != 0.0 ) { - pt = Geom::Point(cx + cos(ellipse->start)*rx, cy + sin(ellipse->start)*ry) * i2d; + pt = Geom::Point(cx + cos(ellipse->start)*rx, cy + sin(ellipse->start)*ry) * i2dt; p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); } // Add the end point, if it's not coincident with a quadrant point if (fmod(ellipse->end, M_PI_2) != 0.0 ) { - pt = Geom::Point(cx + cos(ellipse->end)*rx, cy + sin(ellipse->end)*ry) * i2d; + pt = Geom::Point(cx + cos(ellipse->end)*rx, cy + sin(ellipse->end)*ry) * i2dt; p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); } } diff --git a/src/sp-flowregion.cpp b/src/sp-flowregion.cpp index 46690167f..ebcfcdc2f 100644 --- a/src/sp-flowregion.cpp +++ b/src/sp-flowregion.cpp @@ -116,15 +116,13 @@ sp_flowregion_dispose(GObject *object) group->computed.~vector<Shape*>(); } -static void -sp_flowregion_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref) +static void sp_flowregion_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref) { - SPItem *item; - - item = SP_ITEM (object); + SP_ITEM(object); - if (((SPObjectClass *) (flowregion_parent_class))->child_added) + if (((SPObjectClass *) (flowregion_parent_class))->child_added) { (* ((SPObjectClass *) (flowregion_parent_class))->child_added) (object, child, ref); + } object->requestModified(SP_OBJECT_MODIFIED_FLAG); } @@ -332,15 +330,13 @@ sp_flowregionexclude_dispose(GObject *object) } } -static void -sp_flowregionexclude_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref) +static void sp_flowregionexclude_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref) { - SPItem *item; - - item = SP_ITEM (object); + SP_ITEM(object); - if (((SPObjectClass *) (flowregionexclude_parent_class))->child_added) + if (((SPObjectClass *) (flowregionexclude_parent_class))->child_added) { (* ((SPObjectClass *) (flowregionexclude_parent_class))->child_added) (object, child, ref); + } object->requestModified(SP_OBJECT_MODIFIED_FLAG); } diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp index ab545919f..87266464c 100644 --- a/src/sp-flowtext.cpp +++ b/src/sp-flowtext.cpp @@ -371,7 +371,7 @@ sp_flowtext_print(SPItem *item, SPPrintContext *ctx) dbox.y0 = 0.0; dbox.x1 = item->document->getWidth(); dbox.y1 = item->document->getHeight(); - Geom::Affine const ctm (item->i2d_affine()); + Geom::Affine const ctm (item->i2dt_affine()); group->layout.print(ctx, &pbox, &dbox, &bbox, ctm); } @@ -400,7 +400,7 @@ static void sp_flowtext_snappoints(SPItem const *item, std::vector<Inkscape::Sna if (layout != NULL && layout->outputExists()) { boost::optional<Geom::Point> pt = layout->baselineAnchorPoint(); if (pt) { - p.push_back(Inkscape::SnapCandidatePoint((*pt) * item->i2d_affine(), Inkscape::SNAPSOURCE_TEXT_ANCHOR, Inkscape::SNAPTARGET_TEXT_ANCHOR)); + p.push_back(Inkscape::SnapCandidatePoint((*pt) * item->i2dt_affine(), Inkscape::SNAPSOURCE_TEXT_ANCHOR, Inkscape::SNAPTARGET_TEXT_ANCHOR)); } } } @@ -554,12 +554,11 @@ void SPFlowtext::_clearFlow(NRArenaGroup *in_arena) } } -Inkscape::XML::Node * -SPFlowtext::getAsText() +Inkscape::XML::Node *SPFlowtext::getAsText() { - if (!this->layout.outputExists()) return NULL; - - SPItem *item = SP_ITEM(this); + if (!this->layout.outputExists()) { + return NULL; + } Inkscape::XML::Document *xml_doc = this->document->getReprDoc(); Inkscape::XML::Node *repr = xml_doc->createElement("svg:text"); @@ -588,7 +587,7 @@ SPFlowtext::getAsText() // set x,y attributes only when we need to bool set_x = false; bool set_y = false; - if (!item->transform.isIdentity()) { + if (!this->transform.isIdentity()) { set_x = set_y = true; } else { Inkscape::Text::Layout::iterator it_chunk_start = it; diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index f71bc1762..b55084609 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -261,9 +261,8 @@ static void sp_guide_set(SPObject *object, unsigned int key, const gchar *value) } } -SPGuide *SPGuide::createSPGuide(SPDesktop *desktop, Geom::Point const &pt1, Geom::Point const &pt2) +SPGuide *SPGuide::createSPGuide(SPDocument *doc, Geom::Point const &pt1, Geom::Point const &pt2) { - SPDocument *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::XML::Node *repr = xml_doc->createElement("sodipodi:guide"); @@ -273,7 +272,10 @@ SPGuide *SPGuide::createSPGuide(SPDesktop *desktop, Geom::Point const &pt1, Geom sp_repr_set_point(repr, "position", pt1); sp_repr_set_point(repr, "orientation", n); - desktop->namedview->appendChild(repr); + SPNamedView *namedview = sp_document_namedview(doc, NULL); + if (namedview) { + namedview->appendChild(repr); + } Inkscape::GC::release(repr); SPGuide *guide= SP_GUIDE(doc->getObjectByRepr(repr)); @@ -281,9 +283,9 @@ SPGuide *SPGuide::createSPGuide(SPDesktop *desktop, Geom::Point const &pt1, Geom } void -sp_guide_pt_pairs_to_guides(SPDesktop *dt, std::list<std::pair<Geom::Point, Geom::Point> > &pts) { +sp_guide_pt_pairs_to_guides(SPDocument *doc, std::list<std::pair<Geom::Point, Geom::Point> > &pts) { for (std::list<std::pair<Geom::Point, Geom::Point> >::iterator i = pts.begin(); i != pts.end(); ++i) { - SPGuide::createSPGuide(dt, (*i).first, (*i).second); + SPGuide::createSPGuide(doc, (*i).first, (*i).second); } } @@ -302,7 +304,7 @@ sp_guide_create_guides_around_page(SPDesktop *dt) { pts.push_back(std::make_pair<Geom::Point, Geom::Point>(C, D)); pts.push_back(std::make_pair<Geom::Point, Geom::Point>(D, A)); - sp_guide_pt_pairs_to_guides(dt, pts); + sp_guide_pt_pairs_to_guides(doc, pts); DocumentUndo::done(doc, SP_VERB_NONE, _("Create Guides Around the Page")); } @@ -472,36 +474,46 @@ char *sp_guide_description(SPGuide const *guide, const bool verbose) { using Geom::X; using Geom::Y; - - GString *position_string_x = SP_PX_TO_METRIC_STRING(guide->point_on_line[X], - SP_ACTIVE_DESKTOP->namedview->getDefaultMetric()); - GString *position_string_y = SP_PX_TO_METRIC_STRING(guide->point_on_line[Y], - SP_ACTIVE_DESKTOP->namedview->getDefaultMetric()); - - gchar *shortcuts = g_strdup_printf("; %s", _("<b>Shift+drag</b> to rotate, <b>Ctrl+drag</b> to move origin, <b>Del</b> to delete")); - gchar *descr; - - if ( are_near(guide->normal_to_line, component_vectors[X]) || - are_near(guide->normal_to_line, -component_vectors[X]) ) { - descr = g_strdup_printf(_("vertical, at %s"), position_string_x->str); - } else if ( are_near(guide->normal_to_line, component_vectors[Y]) || - are_near(guide->normal_to_line, -component_vectors[Y]) ) { - descr = g_strdup_printf(_("horizontal, at %s"), position_string_y->str); + + char *descr = 0; + if ( !guide->document ) { + // Guide has probably been deleted and no longer has an attached namedview. + descr = g_strdup_printf(_("Deleted")); } else { - double const radians = guide->angle(); - double const degrees = Geom::rad_to_deg(radians); - int const degrees_int = (int) round(degrees); - descr = g_strdup_printf(_("at %d degrees, through (%s,%s)"), - degrees_int, position_string_x->str, position_string_y->str); - } + SPNamedView *namedview = sp_document_namedview(guide->document, NULL); + + GString *position_string_x = SP_PX_TO_METRIC_STRING(guide->point_on_line[X], + namedview->getDefaultMetric()); + GString *position_string_y = SP_PX_TO_METRIC_STRING(guide->point_on_line[Y], + namedview->getDefaultMetric()); + + gchar *shortcuts = g_strdup_printf("; %s", _("<b>Shift+drag</b> to rotate, <b>Ctrl+drag</b> to move origin, <b>Del</b> to delete")); - g_string_free(position_string_x, TRUE); - g_string_free(position_string_y, TRUE); + if ( are_near(guide->normal_to_line, component_vectors[X]) || + are_near(guide->normal_to_line, -component_vectors[X]) ) { + descr = g_strdup_printf(_("vertical, at %s"), position_string_x->str); + } else if ( are_near(guide->normal_to_line, component_vectors[Y]) || + are_near(guide->normal_to_line, -component_vectors[Y]) ) { + descr = g_strdup_printf(_("horizontal, at %s"), position_string_y->str); + } else { + double const radians = guide->angle(); + double const degrees = Geom::rad_to_deg(radians); + int const degrees_int = (int) round(degrees); + descr = g_strdup_printf(_("at %d degrees, through (%s,%s)"), + degrees_int, position_string_x->str, position_string_y->str); + } + + g_string_free(position_string_x, TRUE); + g_string_free(position_string_y, TRUE); - if (verbose) { - descr = g_strconcat(descr, shortcuts, NULL); + if (verbose) { + gchar *oldDescr = descr; + descr = g_strconcat(oldDescr, shortcuts, NULL); + g_free(oldDescr); + } + g_free(shortcuts); } - g_free(shortcuts); + return descr; } diff --git a/src/sp-guide.h b/src/sp-guide.h index 4fbfbed3d..5d2a05791 100644 --- a/src/sp-guide.h +++ b/src/sp-guide.h @@ -43,7 +43,7 @@ public: inline bool isHorizontal() const { return (normal_to_line[Geom::X] == 0.); }; inline bool isVertical() const { return (normal_to_line[Geom::Y] == 0.); }; inline double angle() const { return std::atan2( - normal_to_line[Geom::X], normal_to_line[Geom::Y] ); }; - static SPGuide *createSPGuide(SPDesktop *desktop, Geom::Point const &pt1, Geom::Point const &pt2); + static SPGuide *createSPGuide(SPDocument *doc, Geom::Point const &pt1, Geom::Point const &pt2); void showSPGuide(SPCanvasGroup *group, GCallback handler); void hideSPGuide(SPCanvas *canvas); void sensitize(SPCanvas *canvas, gboolean sensitive); @@ -58,7 +58,7 @@ public: GType sp_guide_get_type(); -void sp_guide_pt_pairs_to_guides(SPDesktop *dt, std::list<std::pair<Geom::Point, Geom::Point> > &pts); +void sp_guide_pt_pairs_to_guides(SPDocument *doc, std::list<std::pair<Geom::Point, Geom::Point> > &pts); void sp_guide_create_guides_around_page(SPDesktop *dt); void sp_guide_delete_all_guides(SPDesktop *dt); diff --git a/src/sp-image.cpp b/src/sp-image.cpp index 791e88b39..c9647c939 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -1017,7 +1017,7 @@ static void sp_image_modified( SPObject *object, unsigned int flags ) } if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { - for (SPItemView *v = SP_ITEM (image)->display; v != NULL; v = v->next) { + for (SPItemView *v = image->display; v != NULL; v = v->next) { nr_arena_image_set_style (NR_ARENA_IMAGE (v->arenaitem), object->style); } } @@ -1273,8 +1273,7 @@ sp_image_update_arenaitem (SPImage *image, NRArenaImage *ai) nr_arena_image_set_clipbox(ai, image->clipbox); } -static void -sp_image_update_canvas_image (SPImage *image) +static void sp_image_update_canvas_image(SPImage *image) { SPItem *item = SP_ITEM(image); @@ -1304,7 +1303,7 @@ static void sp_image_snappoints( SPItem const *item, std::vector<Inkscape::SnapC double const y0 = image.y.computed; double const x1 = x0 + image.width.computed; double const y1 = y0 + image.height.computed; - Geom::Affine const i2d (item->i2d_affine ()); + Geom::Affine const i2d (item->i2dt_affine ()); p.push_back(Inkscape::SnapCandidatePoint(Geom::Point(x0, y0) * i2d, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER)); p.push_back(Inkscape::SnapCandidatePoint(Geom::Point(x0, y1) * i2d, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER)); p.push_back(Inkscape::SnapCandidatePoint(Geom::Point(x1, y1) * i2d, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER)); diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 8d38fee07..491b2a62a 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -169,17 +169,15 @@ sp_group_dispose(GObject *object) delete SP_GROUP(object)->group; } -static void -sp_group_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref) +static void sp_group_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref) { - SPItem *item; - - item = SP_ITEM (object); + SPGroup *group = SP_GROUP(object); - if (((SPObjectClass *) (parent_class))->child_added) + if (((SPObjectClass *) (parent_class))->child_added) { (* ((SPObjectClass *) (parent_class))->child_added) (object, child, ref); + } - SP_GROUP(object)->group->onChildAdded(child); + group->group->onChildAdded(child); } /* fixme: hide (Lauris) */ @@ -347,7 +345,7 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) SPRoot *root = doc->getRoot(); SPObject *defs = root->defs; - SPItem *gitem = SP_ITEM (group); + SPItem *gitem = group; Inkscape::XML::Node *grepr = gitem->getRepr(); g_return_if_fail (!strcmp (grepr->name(), "svg:g") || !strcmp (grepr->name(), "svg:a") || !strcmp (grepr->name(), "svg:switch")); @@ -360,7 +358,7 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) if (SP_IS_BOX3D(gitem)) { group = box3d_convert_to_group(SP_BOX3D(gitem)); - gitem = SP_ITEM(group); + gitem = group; } sp_lpe_item_remove_all_path_effects(SP_LPE_ITEM(group), false); diff --git a/src/sp-item-notify-moveto.cpp b/src/sp-item-notify-moveto.cpp index 2005356bd..fd27c896a 100644 --- a/src/sp-item-notify-moveto.cpp +++ b/src/sp-item-notify-moveto.cpp @@ -41,7 +41,7 @@ void sp_item_notify_moveto(SPItem &item, SPGuide const &mv_g, int const snappoin s = (position - pos0) / dot(dir, dir). */ Geom::Translate const tr( ( position - pos0 ) * ( dir / dir_lensq ) ); - item.set_i2d_affine(item.i2d_affine() * tr); + item.set_i2d_affine(item.i2dt_affine() * tr); /// \todo Reget snappoints, check satisfied. if (commit) { diff --git a/src/sp-item-transform.cpp b/src/sp-item-transform.cpp index eb4b81a61..9f166e718 100644 --- a/src/sp-item-transform.cpp +++ b/src/sp-item-transform.cpp @@ -25,7 +25,7 @@ sp_item_rotate_rel(SPItem *item, Geom::Rotate const &rotation) Geom::Affine affine = Geom::Affine(s).inverse() * Geom::Affine(rotation) * Geom::Affine(s); // Rotate item. - item->set_i2d_affine(item->i2d_affine() * (Geom::Affine)affine); + item->set_i2d_affine(item->i2dt_affine() * (Geom::Affine)affine); // Use each item's own transform writer, consistent with sp_selection_apply_affine() item->doWriteTransform(item->getRepr(), item->transform); @@ -42,7 +42,7 @@ sp_item_scale_rel (SPItem *item, Geom::Scale const &scale) Geom::OptRect bbox = item->getBboxDesktop(); if (bbox) { Geom::Translate const s(bbox->midpoint()); // use getCenter? - item->set_i2d_affine(item->i2d_affine() * s.inverse() * scale * s); + item->set_i2d_affine(item->i2dt_affine() * s.inverse() * scale * s); item->doWriteTransform(item->getRepr(), item->transform); } } @@ -56,7 +56,7 @@ sp_item_skew_rel (SPItem *item, double skewX, double skewY) Geom::Affine const skew(1, skewY, skewX, 1, 0, 0); Geom::Affine affine = Geom::Affine(s).inverse() * skew * Geom::Affine(s); - item->set_i2d_affine(item->i2d_affine() * affine); + item->set_i2d_affine(item->i2dt_affine() * affine); item->doWriteTransform(item->getRepr(), item->transform); // Restore the center position (it's changed because the bbox center changed) @@ -68,7 +68,7 @@ sp_item_skew_rel (SPItem *item, double skewX, double skewY) void sp_item_move_rel(SPItem *item, Geom::Translate const &tr) { - item->set_i2d_affine(item->i2d_affine() * tr); + item->set_i2d_affine(item->i2dt_affine() * tr); item->doWriteTransform(item->getRepr(), item->transform); } @@ -248,10 +248,6 @@ get_scale_transform_with_unequal_stroke (Geom::Rect const &bbox_visual, Geom::Re gdouble r0w = w0 - bbox_geom.width(); // r0w is the average strokewidth of the left and right edges, i.e. 0.5*(r0l + r0r) gdouble r0h = h0 - bbox_geom.height(); // r0h is the average strokewidth of the top and bottom edges, i.e. 0.5*(r0t + r0b) - // Check whether the stroke is not negative; should not be possible, but just in case: - g_assert(r0w >= 0); - g_assert(r0h >= 0); - if (bbox_visual.hasZeroArea()) { // Obviously we cannot scale from empty visual bounding boxes at all, so we will only translate in such a case Geom::Affine move = Geom::Translate(x0 - bbox_visual.min()[Geom::X], y0 - bbox_visual.min()[Geom::Y]); return (move); @@ -266,6 +262,14 @@ get_scale_transform_with_unequal_stroke (Geom::Rect const &bbox_visual, Geom::Re return (p2o * direct * o2n); } + // Check whether the stroke is negative; i.e. the geometric bounding box is larger than the visual bounding box, which + // occurs for example for clipped objects (see launchpad bug #811819) + if (r0w < 0 || r0w < 0) { + // How should we handle the stroke width scaling of clipped object? I don't know if we can/should handle this, + // so for now we simply return the direct scaling + return (p2o * direct * o2n); + } + // Here starts the calculation you've been waiting for; first do some preparation int flip_x = (w1 > 0) ? 1 : -1; int flip_y = (h1 > 0) ? 1 : -1; diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 8e1a4d92c..946c94353 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -272,7 +272,7 @@ void SPItem::setCenter(Geom::Point object_centre) { // for getBounds() to work document->ensureUpToDate(); - Geom::OptRect bbox = getBounds(i2d_affine()); + Geom::OptRect bbox = getBounds(i2dt_affine()); if (bbox) { transform_center_x = object_centre[Geom::X] - bbox->midpoint()[Geom::X]; if (fabs(transform_center_x) < 1e-5) // rounding error @@ -297,7 +297,7 @@ Geom::Point SPItem::getCenter() const { // for getBounds() to work document->ensureUpToDate(); - Geom::OptRect bbox = getBounds(i2d_affine()); + Geom::OptRect bbox = getBounds(i2dt_affine()); if (bbox) { return bbox->midpoint() + Geom::Point (transform_center_x, transform_center_y); } else { @@ -638,19 +638,19 @@ void SPItem::sp_item_update(SPObject *object, SPCtx *ctx, guint flags) Inkscape::XML::Node *SPItem::sp_item_write(SPObject *const object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - SPObject *child; SPItem *item = SP_ITEM(object); // in the case of SP_OBJECT_WRITE_BUILD, the item should always be newly created, // so we need to add any children from the underlying object to the new repr if (flags & SP_OBJECT_WRITE_BUILD) { - Inkscape::XML::Node *crepr; - GSList *l; - l = NULL; - for (child = object->firstChild(); child != NULL; child = child->next ) { - if (!SP_IS_TITLE(child) && !SP_IS_DESC(child)) continue; - crepr = child->updateRepr(xml_doc, NULL, flags); - if (crepr) l = g_slist_prepend (l, crepr); + GSList *l = NULL; + for (SPObject *child = object->firstChild(); child != NULL; child = child->next ) { + if (SP_IS_TITLE(child) || SP_IS_DESC(child)) { + Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags); + if (crepr) { + l = g_slist_prepend (l, crepr); + } + } } while (l) { repr->addChild((Inkscape::XML::Node *) l->data, NULL); @@ -658,9 +658,10 @@ Inkscape::XML::Node *SPItem::sp_item_write(SPObject *const object, Inkscape::XML l = g_slist_remove (l, l->data); } } else { - for (child = object->firstChild() ; child != NULL; child = child->next ) { - if (!SP_IS_TITLE(child) && !SP_IS_DESC(child)) continue; - child->updateRepr(flags); + for (SPObject *child = object->firstChild() ; child != NULL; child = child->next ) { + if (SP_IS_TITLE(child) || SP_IS_DESC(child)) { + child->updateRepr(flags); + } } } @@ -789,11 +790,11 @@ void SPItem::invoke_bbox_full( Geom::OptRect &bbox, Geom::Affine const &transfor } // transform the expansions by the item's transform: - Geom::Affine i2d(i2d_affine ()); - dx0 *= i2d.expansionX(); - dx1 *= i2d.expansionX(); - dy0 *= i2d.expansionY(); - dy1 *= i2d.expansionY(); + Geom::Affine i2dt(i2dt_affine ()); + dx0 *= i2dt.expansionX(); + dx1 *= i2dt.expansionX(); + dy0 *= i2dt.expansionY(); + dy1 *= i2dt.expansionY(); // expand the bbox temp_bbox.x0 += dx0; @@ -889,13 +890,13 @@ void SPItem::getBboxDesktop(NRRect *bbox, SPItem::BBoxType type) { g_assert(bbox != NULL); - invoke_bbox( bbox, i2d_affine(), TRUE, type); + invoke_bbox( bbox, i2dt_affine(), TRUE, type); } Geom::OptRect SPItem::getBboxDesktop(SPItem::BBoxType type) { Geom::OptRect rect = Geom::OptRect(); - invoke_bbox( rect, i2d_affine(), TRUE, type); + invoke_bbox( rect, i2dt_affine(), TRUE, type); return rect; } @@ -906,7 +907,7 @@ void SPItem::sp_item_private_snappoints(SPItem const *item, std::vector<Inkscape * We don't know what shape we could be dealing with here, so we'll just * return the corners of the bounding box */ - Geom::OptRect bbox = item->getBounds(item->i2d_affine()); + Geom::OptRect bbox = item->getBounds(item->i2dt_affine()); if (bbox) { Geom::Point p1, p2; @@ -952,7 +953,7 @@ void SPItem::getSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscap for (std::vector<Inkscape::SnapCandidatePoint>::const_iterator p_orig = p_clip_or_mask.begin(); p_orig != p_clip_or_mask.end(); p_orig++) { // All snappoints are in desktop coordinates, but the item's transformation is // in document coordinates. Hence the awkward construction below - Geom::Point pt = desktop->dt2doc((*p_orig).getPoint()) * i2d_affine(); + Geom::Point pt = desktop->dt2doc((*p_orig).getPoint()) * i2dt_affine(); p.push_back(Inkscape::SnapCandidatePoint(pt, (*p_orig).getSourceType(), (*p_orig).getTargetType())); } } @@ -1464,11 +1465,13 @@ Geom::Affine SPItem::i2doc_affine() const /** * Returns the transformation from item to desktop coords */ -Geom::Affine SPItem::i2d_affine() const +Geom::Affine SPItem::i2dt_affine() const { - Geom::Affine const ret( i2doc_affine() - * Geom::Scale(1, -1) - * Geom::Translate(0, document->getHeight()) ); +// Geom::Affine const ret( i2doc_affine() +// * Geom::Scale(1, -1) +// * Geom::Translate(0, document->getHeight()) ); + SPDesktop const *desktop = inkscape_active_desktop(); + Geom::Affine const ret( i2doc_affine() * desktop->doc2dt() ); return ret; } @@ -1476,10 +1479,10 @@ void SPItem::set_i2d_affine(Geom::Affine const &i2dt) { Geom::Affine dt2p; /* desktop to item parent transform */ if (parent) { - dt2p = static_cast<SPItem *>(parent)->i2d_affine().inverse(); + dt2p = static_cast<SPItem *>(parent)->i2dt_affine().inverse(); } else { - dt2p = ( Geom::Translate(0, -document->getHeight()) - * Geom::Scale(1, -1) ); + SPDesktop *dt = inkscape_active_desktop(); + dt2p = dt->dt2doc(); } Geom::Affine const i2p( i2dt * dt2p ); @@ -1493,7 +1496,7 @@ void SPItem::set_i2d_affine(Geom::Affine const &i2dt) Geom::Affine SPItem::dt2i_affine() const { /* fixme: Implement the right way (Lauris) */ - return i2d_affine().inverse(); + return i2dt_affine().inverse(); } /* Item views */ @@ -1571,9 +1574,6 @@ SPItem *sp_item_first_item_child(SPObject *obj) } void SPItem::convert_to_guides() { - SPDesktop *dt = inkscape_active_desktop(); - sp_desktop_namedview(dt); - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int prefs_bbox = prefs->getInt("/tools/bounding_box", 0); SPItem::BBoxType bbox_type = (prefs_bbox ==0)? @@ -1597,7 +1597,7 @@ void SPItem::convert_to_guides() { pts.push_back(std::make_pair(C, D)); pts.push_back(std::make_pair(D, A)); - sp_guide_pt_pairs_to_guides(dt, pts); + sp_guide_pt_pairs_to_guides(document, pts); } /* diff --git a/src/sp-item.h b/src/sp-item.h index 7c3eb87d9..0065a9c0e 100644 --- a/src/sp-item.h +++ b/src/sp-item.h @@ -201,7 +201,7 @@ public: void getBboxDesktop(NRRect *bbox, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) __attribute__ ((deprecated)); Geom::OptRect getBboxDesktop(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX); Geom::Affine i2doc_affine() const; - Geom::Affine i2d_affine() const; + Geom::Affine i2dt_affine() const; void set_i2d_affine(Geom::Affine const &transform); Geom::Affine dt2i_affine() const; void convert_to_guides(); diff --git a/src/sp-line.cpp b/src/sp-line.cpp index b21122566..d3faf2299 100644 --- a/src/sp-line.cpp +++ b/src/sp-line.cpp @@ -179,12 +179,12 @@ void SPLine::convertToGuides(SPItem *item) SPLine *line = SP_LINE(item); Geom::Point points[2]; - Geom::Affine const i2d(item->i2d_affine()); + Geom::Affine const i2dt(item->i2dt_affine()); - points[0] = Geom::Point(line->x1.computed, line->y1.computed)*i2d; - points[1] = Geom::Point(line->x2.computed, line->y2.computed)*i2d; + points[0] = Geom::Point(line->x1.computed, line->y1.computed)*i2dt; + points[1] = Geom::Point(line->x2.computed, line->y2.computed)*i2dt; - SPGuide::createSPGuide(inkscape_active_desktop(), points[0], points[1]); + SPGuide::createSPGuide(item->document, points[0], points[1]); } Geom::Affine SPLine::setTransform(SPItem *item, Geom::Affine const &xform) diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index 7d42400fa..d67afce8e 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -669,7 +669,7 @@ void sp_lpe_item_edit_next_param_oncanvas(SPLPEItem *lpeitem, SPDesktop *dt) { Inkscape::LivePathEffect::LPEObjectReference *lperef = sp_lpe_item_get_current_lpereference(lpeitem); if (lperef && lperef->lpeobject && lperef->lpeobject->get_lpe()) { - lperef->lpeobject->get_lpe()->editNextParamOncanvas(SP_ITEM(lpeitem), dt); + lperef->lpeobject->get_lpe()->editNextParamOncanvas(lpeitem, dt); } } diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index ac2d7dc1b..55947dacb 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -990,9 +990,9 @@ GSList const *SPNamedView::getViewList() const static gboolean sp_str_to_bool(const gchar *str) { if (str) { - if (!g_strcasecmp(str, "true") || - !g_strcasecmp(str, "yes") || - !g_strcasecmp(str, "y") || + if (!g_ascii_strcasecmp(str, "true") || + !g_ascii_strcasecmp(str, "yes") || + !g_ascii_strcasecmp(str, "y") || (atoi(str) != 0)) { return TRUE; } diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp index 0dd65c7b9..5187ff027 100644 --- a/src/sp-offset.cpp +++ b/src/sp-offset.cpp @@ -1026,23 +1026,20 @@ sp_offset_href_changed(SPObject */*old_ref*/, SPObject */*ref*/, SPOffset *offse } } -static void -sp_offset_move_compensate(Geom::Affine const *mp, SPItem */*original*/, SPOffset *self) +static void sp_offset_move_compensate(Geom::Affine const *mp, SPItem */*original*/, SPOffset *self) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint mode = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_PARALLEL); - SPItem *item = SP_ITEM(self); - Geom::Affine m(*mp); if (!(m.isTranslation()) || mode == SP_CLONE_COMPENSATION_NONE) { self->sourceDirty=true; - item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + self->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); return; } // calculate the compensation matrix and the advertized movement matrix - item->readAttr("transform"); + self->readAttr("transform"); Geom::Affine t = self->transform; Geom::Affine offset_move = t.inverse() * m * t; @@ -1061,9 +1058,9 @@ sp_offset_move_compensate(Geom::Affine const *mp, SPItem */*original*/, SPOffset self->sourceDirty=true; // commit the compensation - item->transform *= offset_move; - item->doWriteTransform(item->getRepr(), item->transform, &advertized_move); - item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + self->transform *= offset_move; + self->doWriteTransform(self->getRepr(), self->transform, &advertized_move); + self->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } static void diff --git a/src/sp-path.cpp b/src/sp-path.cpp index c8022d351..49cadc116 100644 --- a/src/sp-path.cpp +++ b/src/sp-path.cpp @@ -169,7 +169,7 @@ sp_path_convert_to_guides(SPItem *item) std::list<std::pair<Geom::Point, Geom::Point> > pts; - Geom::Affine const i2d (SP_ITEM(path)->i2d_affine()); + Geom::Affine const i2dt(path->i2dt_affine()); Geom::PathVector const & pv = curve->get_pathvector(); for(Geom::PathVector::const_iterator pit = pv.begin(); pit != pv.end(); ++pit) { @@ -177,12 +177,12 @@ sp_path_convert_to_guides(SPItem *item) // only add curves for straight line segments if( is_straight_curve(*cit) ) { - pts.push_back(std::make_pair(cit->initialPoint() * i2d, cit->finalPoint() * i2d)); + pts.push_back(std::make_pair(cit->initialPoint() * i2dt, cit->finalPoint() * i2dt)); } } } - sp_guide_pt_pairs_to_guides(inkscape_active_desktop(), pts); + sp_guide_pt_pairs_to_guides(item->document, pts); } /** diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index db5a62f8f..467b37d17 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -417,7 +417,7 @@ sp_rect_set_visible_rx(SPRect *rect, gdouble rx) rect->rx.computed = rx / vector_stretch( Geom::Point(rect->x.computed + 1, rect->y.computed), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); rect->rx._set = true; } SP_OBJECT(rect)->updateRepr(); @@ -433,7 +433,7 @@ sp_rect_set_visible_ry(SPRect *rect, gdouble ry) rect->ry.computed = ry / vector_stretch( Geom::Point(rect->x.computed, rect->y.computed + 1), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); rect->ry._set = true; } SP_OBJECT(rect)->updateRepr(); @@ -447,7 +447,7 @@ sp_rect_get_visible_rx(SPRect *rect) return rect->rx.computed * vector_stretch( Geom::Point(rect->x.computed + 1, rect->y.computed), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); } gdouble @@ -458,7 +458,7 @@ sp_rect_get_visible_ry(SPRect *rect) return rect->ry.computed * vector_stretch( Geom::Point(rect->x.computed, rect->y.computed + 1), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); } Geom::Rect @@ -481,9 +481,9 @@ sp_rect_compensate_rxry(SPRect *rect, Geom::Affine xform) Geom::Point cy = c + Geom::Point(0, 1); // apply previous transform if any - c *= SP_ITEM(rect)->transform; - cx *= SP_ITEM(rect)->transform; - cy *= SP_ITEM(rect)->transform; + c *= rect->transform; + cx *= rect->transform; + cy *= rect->transform; // find out stretches that we need to compensate gdouble eX = vector_stretch(cx, c, xform); @@ -513,7 +513,7 @@ sp_rect_set_visible_width(SPRect *rect, gdouble width) rect->width.computed = width / vector_stretch( Geom::Point(rect->x.computed + 1, rect->y.computed), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); rect->width._set = true; SP_OBJECT(rect)->updateRepr(); } @@ -524,7 +524,7 @@ sp_rect_set_visible_height(SPRect *rect, gdouble height) rect->height.computed = height / vector_stretch( Geom::Point(rect->x.computed, rect->y.computed + 1), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); rect->height._set = true; SP_OBJECT(rect)->updateRepr(); } @@ -537,7 +537,7 @@ sp_rect_get_visible_width(SPRect *rect) return rect->width.computed * vector_stretch( Geom::Point(rect->x.computed + 1, rect->y.computed), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); } gdouble @@ -548,7 +548,7 @@ sp_rect_get_visible_height(SPRect *rect) return rect->height.computed * vector_stretch( Geom::Point(rect->x.computed, rect->y.computed + 1), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); } /** @@ -573,12 +573,12 @@ static void sp_rect_snappoints(SPItem const *item, std::vector<Inkscape::SnapCan SPRect *rect = SP_RECT(item); - Geom::Affine const i2d (item->i2d_affine ()); + Geom::Affine const i2dt (item->i2dt_affine ()); - Geom::Point p0 = Geom::Point(rect->x.computed, rect->y.computed) * i2d; - Geom::Point p1 = Geom::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2d; - Geom::Point p2 = Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed) * i2d; - Geom::Point p3 = Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed) * i2d; + Geom::Point p0 = Geom::Point(rect->x.computed, rect->y.computed) * i2dt; + Geom::Point p1 = Geom::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2dt; + Geom::Point p2 = Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed) * i2dt; + Geom::Point p3 = Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed) * i2dt; if (snapprefs->getSnapToItemNode()) { p.push_back(Inkscape::SnapCandidatePoint(p0, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER)); @@ -606,25 +606,25 @@ sp_rect_convert_to_guides(SPItem *item) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (!prefs->getBool("/tools/shapes/rect/convertguides", true)) { - SP_ITEM(rect)->convert_to_guides(); + rect->convert_to_guides(); return; } std::list<std::pair<Geom::Point, Geom::Point> > pts; - Geom::Affine const i2d (SP_ITEM(rect)->i2d_affine()); + Geom::Affine const i2dt(rect->i2dt_affine()); - Geom::Point A1(Geom::Point(rect->x.computed, rect->y.computed) * i2d); - Geom::Point A2(Geom::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2d); - Geom::Point A3(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed) * i2d); - Geom::Point A4(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed) * i2d); + Geom::Point A1(Geom::Point(rect->x.computed, rect->y.computed) * i2dt); + Geom::Point A2(Geom::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2dt); + Geom::Point A3(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed) * i2dt); + Geom::Point A4(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed) * i2dt); pts.push_back(std::make_pair(A1, A2)); pts.push_back(std::make_pair(A2, A3)); pts.push_back(std::make_pair(A3, A4)); pts.push_back(std::make_pair(A4, A1)); - sp_guide_pt_pairs_to_guides(inkscape_active_desktop(), pts); + sp_guide_pt_pairs_to_guides(item->document, pts); } /* diff --git a/src/sp-root.cpp b/src/sp-root.cpp index 7d72b7695..918bd3295 100644 --- a/src/sp-root.cpp +++ b/src/sp-root.cpp @@ -395,12 +395,8 @@ static void sp_root_remove_child(SPObject *object, Inkscape::XML::Node *child) /** * This callback routine updates the SPRoot object when its attributes have been changed. */ -static void -sp_root_update(SPObject *object, SPCtx *ctx, guint flags) +static void sp_root_update(SPObject *object, SPCtx *ctx, guint flags) { - SPItemView *v; - - SPItem *item = SP_ITEM(object); SPRoot *root = SP_ROOT(object); SPItemCtx *ictx = (SPItemCtx *) ctx; @@ -543,7 +539,7 @@ sp_root_update(SPObject *object, SPCtx *ctx, guint flags) ((SPObjectClass *) (parent_class))->update(object, (SPCtx *) &rctx, flags); /* As last step set additional transform of arena group */ - for (v = item->display; v != NULL; v = v->next) { + for (SPItemView *v = root->display; v != NULL; v = v->next) { nr_arena_group_set_child_transform(NR_ARENA_GROUP(v->arenaitem), root->c2p); } } diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 24b6b8025..beec860be 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -225,7 +225,6 @@ Inkscape::XML::Node * SPShape::sp_shape_write(SPObject *object, Inkscape::XML::D */ void SPShape::sp_shape_update(SPObject *object, SPCtx *ctx, unsigned int flags) { - SPItem *item = (SPItem *) object; SPShape *shape = (SPShape *) object; if (((SPObjectClass *) (SPShapeClass::parent_class))->update) { @@ -257,7 +256,7 @@ void SPShape::sp_shape_update(SPObject *object, SPCtx *ctx, unsigned int flags) /* This is suboptimal, because changing parent style schedules recalculation */ /* But on the other hand - how can we know that parent does not tie style and transform */ Geom::OptRect paintbox = SP_ITEM(object)->getBounds(Geom::identity(), SPItem::GEOMETRIC_BBOX); - for (SPItemView *v = SP_ITEM (shape)->display; v != NULL; v = v->next) { + for (SPItemView *v = shape->display; v != NULL; v = v->next) { NRArenaShape * const s = NR_ARENA_SHAPE(v->arenaitem); if (flags & SP_OBJECT_MODIFIED_FLAG) { nr_arena_shape_set_path(s, shape->curve, (flags & SP_OBJECT_USER_MODIFIED_FLAG_B)); @@ -270,7 +269,7 @@ void SPShape::sp_shape_update(SPObject *object, SPCtx *ctx, unsigned int flags) if (shape->hasMarkers ()) { /* Dimension marker views */ - for (SPItemView *v = item->display; v != NULL; v = v->next) { + for (SPItemView *v = shape->display; v != NULL; v = v->next) { if (!v->arenaitem->key) { NR_ARENA_ITEM_SET_KEY (v->arenaitem, SPItem::display_key_new (SP_MARKER_LOC_QTY)); } @@ -284,7 +283,7 @@ void SPShape::sp_shape_update(SPObject *object, SPCtx *ctx, unsigned int flags) } /* Update marker views */ - for (SPItemView *v = item->display; v != NULL; v = v->next) { + for (SPItemView *v = shape->display; v != NULL; v = v->next) { sp_shape_update_marker_view (shape, v->arenaitem); } } @@ -495,7 +494,7 @@ void SPShape::sp_shape_modified(SPObject *object, unsigned int flags) } if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { - for (SPItemView *v = SP_ITEM (shape)->display; v != NULL; v = v->next) { + for (SPItemView *v = shape->display; v != NULL; v = v->next) { nr_arena_shape_set_style (NR_ARENA_SHAPE (v->arenaitem), object->style); } } @@ -764,16 +763,16 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx) dbox.x1 = item->document->getWidth(); dbox.y1 = item->document->getHeight(); item->getBboxDesktop (&bbox); - Geom::Affine const i2d(item->i2d_affine()); + Geom::Affine const i2dt(item->i2dt_affine()); SPStyle* style = item->style; if (!style->fill.isNone()) { - sp_print_fill (ctx, pathv, &i2d, style, &pbox, &dbox, &bbox); + sp_print_fill (ctx, pathv, &i2dt, style, &pbox, &dbox, &bbox); } if (!style->stroke.isNone()) { - sp_print_stroke (ctx, pathv, &i2d, style, &pbox, &dbox, &bbox); + sp_print_stroke (ctx, pathv, &i2dt, style, &pbox, &dbox, &bbox); } /** \todo make code prettier */ @@ -1198,10 +1197,10 @@ void SPShape::sp_shape_snappoints(SPItem const *item, std::vector<Inkscape::Snap if (pathv.empty()) return; - Geom::Affine const i2d (item->i2d_affine ()); + Geom::Affine const i2dt (item->i2dt_affine ()); if (snapprefs->getSnapObjectMidpoints()) { - Geom::OptRect bbox = item->getBounds(item->i2d_affine()); + Geom::OptRect bbox = item->getBounds(i2dt); if (bbox) { p.push_back(Inkscape::SnapCandidatePoint(bbox->midpoint(), Inkscape::SNAPSOURCE_OBJECT_MIDPOINT, Inkscape::SNAPTARGET_OBJECT_MIDPOINT)); } @@ -1210,7 +1209,7 @@ void SPShape::sp_shape_snappoints(SPItem const *item, std::vector<Inkscape::Snap for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { if (snapprefs->getSnapToItemNode()) { // Add the first point of the path - p.push_back(Inkscape::SnapCandidatePoint(path_it->initialPoint() * i2d, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); + p.push_back(Inkscape::SnapCandidatePoint(path_it->initialPoint() * i2dt, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); } Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve @@ -1220,7 +1219,7 @@ void SPShape::sp_shape_snappoints(SPItem const *item, std::vector<Inkscape::Snap // For each path: consider midpoints of line segments for snapping if (snapprefs->getSnapLineMidpoints()) { // only do this when we're snapping nodes (enforces strict snapping) if (Geom::LineSegment const* line_segment = dynamic_cast<Geom::LineSegment const*>(&(*curve_it1))) { - p.push_back(Inkscape::SnapCandidatePoint(Geom::middle_point(*line_segment) * i2d, Inkscape::SNAPSOURCE_LINE_MIDPOINT, Inkscape::SNAPTARGET_LINE_MIDPOINT)); + p.push_back(Inkscape::SnapCandidatePoint(Geom::middle_point(*line_segment) * i2dt, Inkscape::SNAPSOURCE_LINE_MIDPOINT, Inkscape::SNAPTARGET_LINE_MIDPOINT)); } } @@ -1228,7 +1227,7 @@ void SPShape::sp_shape_snappoints(SPItem const *item, std::vector<Inkscape::Snap if (snapprefs->getSnapToItemNode() && !path_it->closed()) { // Add the last point of the path, but only for open paths // (for closed paths the first and last point will coincide) - p.push_back(Inkscape::SnapCandidatePoint((*curve_it1).finalPoint() * i2d, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); + p.push_back(Inkscape::SnapCandidatePoint((*curve_it1).finalPoint() * i2dt, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); } } else { /* Test whether to add the node between curve_it1 and curve_it2. @@ -1257,7 +1256,7 @@ void SPShape::sp_shape_snappoints(SPItem const *item, std::vector<Inkscape::Snap stt = Inkscape::SNAPTARGET_UNDEFINED; break; } - p.push_back(Inkscape::SnapCandidatePoint(curve_it1->finalPoint() * i2d, sst, stt)); + p.push_back(Inkscape::SnapCandidatePoint(curve_it1->finalPoint() * i2dt, sst, stt)); } } @@ -1274,7 +1273,7 @@ void SPShape::sp_shape_snappoints(SPItem const *item, std::vector<Inkscape::Snap 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)); + p.push_back(Inkscape::SnapCandidatePoint(p_ix * i2dt, Inkscape::SNAPSOURCE_PATH_INTERSECTION, Inkscape::SNAPTARGET_PATH_INTERSECTION)); } } } catch (Geom::RangeError &e) { diff --git a/src/sp-spiral.cpp b/src/sp-spiral.cpp index a772e057d..3ba05adc6 100644 --- a/src/sp-spiral.cpp +++ b/src/sp-spiral.cpp @@ -534,9 +534,9 @@ static void sp_spiral_snappoints(SPItem const *item, std::vector<Inkscape::SnapC } if (snapprefs->getSnapObjectMidpoints()) { - Geom::Affine const i2d (item->i2d_affine ()); + Geom::Affine const i2dt (item->i2dt_affine ()); SPSpiral *spiral = SP_SPIRAL(item); - p.push_back(Inkscape::SnapCandidatePoint(Geom::Point(spiral->cx, spiral->cy) * i2d, Inkscape::SNAPSOURCE_OBJECT_MIDPOINT, Inkscape::SNAPTARGET_OBJECT_MIDPOINT)); + p.push_back(Inkscape::SnapCandidatePoint(Geom::Point(spiral->cx, spiral->cy) * i2dt, Inkscape::SNAPSOURCE_OBJECT_MIDPOINT, Inkscape::SNAPTARGET_OBJECT_MIDPOINT)); // This point is the start-point of the spiral, which is also returned when _snap_to_itemnode has been set // in the object snapper. In that case we will get a duplicate! } diff --git a/src/sp-star.cpp b/src/sp-star.cpp index 17ddf7279..c7c2c54ad 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -562,8 +562,8 @@ static void sp_star_snappoints(SPItem const *item, std::vector<Inkscape::SnapCan } if (snapprefs->getSnapObjectMidpoints()) { - Geom::Affine const i2d (item->i2d_affine ()); - p.push_back(Inkscape::SnapCandidatePoint(SP_STAR(item)->center * i2d,Inkscape::SNAPSOURCE_OBJECT_MIDPOINT, Inkscape::SNAPTARGET_OBJECT_MIDPOINT)); + Geom::Affine const i2dt (item->i2dt_affine ()); + p.push_back(Inkscape::SnapCandidatePoint(SP_STAR(item)->center * i2dt,Inkscape::SNAPSOURCE_OBJECT_MIDPOINT, Inkscape::SNAPTARGET_OBJECT_MIDPOINT)); } } diff --git a/src/sp-switch.cpp b/src/sp-switch.cpp index 19c014b9b..eb30f2644 100644 --- a/src/sp-switch.cpp +++ b/src/sp-switch.cpp @@ -125,7 +125,6 @@ void CSwitch::_reevaluate(bool /*add_to_arena*/) { _releaseLastItem(_cached_item); - SPItem * child; for ( GSList *l = _childList(false, SPObject::ActionShow); NULL != l ; l = g_slist_remove (l, l->data)) { @@ -134,7 +133,7 @@ void CSwitch::_reevaluate(bool /*add_to_arena*/) { continue; } - child = SP_ITEM (o); + SPItem * child = SP_ITEM(o); child->setEvaluated(o == evaluated_child); } @@ -161,16 +160,14 @@ void CSwitch::_releaseLastItem(SPObject *obj) void CSwitch::_showChildren (NRArena *arena, NRArenaItem *ai, unsigned int key, unsigned int flags) { SPObject *evaluated_child = _evaluateFirst(); - NRArenaItem *ac = NULL; NRArenaItem *ar = NULL; - SPItem * child; GSList *l = _childList(false, SPObject::ActionShow); while (l) { SPObject *o = SP_OBJECT (l->data); if (SP_IS_ITEM (o)) { - child = SP_ITEM (o); + SPItem * child = SP_ITEM(o); child->setEvaluated(o == evaluated_child); - ac = child->invoke_show (arena, key, flags); + NRArenaItem *ac = child->invoke_show (arena, key, flags); if (ac) { nr_arena_item_add_child (ai, ac, ar); ar = ac; diff --git a/src/sp-symbol.cpp b/src/sp-symbol.cpp index 1d4bdec0f..91218c986 100644 --- a/src/sp-symbol.cpp +++ b/src/sp-symbol.cpp @@ -4,6 +4,7 @@ * Authors: * Lauris Kaplinski <lauris@kaplinski.com> * Abhishek Sharma + * Jon A. Cruz <jon@joncruz.org> * * Copyright (C) 1999-2003 Lauris Kaplinski * @@ -63,16 +64,10 @@ sp_symbol_get_type (void) return type; } -static void -sp_symbol_class_init (SPSymbolClass *klass) +static void sp_symbol_class_init(SPSymbolClass *klass) { - GObjectClass *object_class; - SPObjectClass *sp_object_class; - SPItemClass *sp_item_class; - - object_class = G_OBJECT_CLASS (klass); - sp_object_class = (SPObjectClass *) klass; - sp_item_class = (SPItemClass *) klass; + SPObjectClass *sp_object_class = (SPObjectClass *) klass; + SPItemClass *sp_item_class = (SPItemClass *) klass; parent_class = (SPGroupClass *)g_type_class_ref (SP_TYPE_GROUP); @@ -90,49 +85,33 @@ sp_symbol_class_init (SPSymbolClass *klass) sp_item_class->print = sp_symbol_print; } -static void -sp_symbol_init (SPSymbol *symbol) +static void sp_symbol_init(SPSymbol *symbol) { symbol->viewBox_set = FALSE; symbol->c2p = Geom::identity(); } -static void -sp_symbol_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +static void sp_symbol_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { - SPGroup *group; - SPSymbol *symbol; - - group = (SPGroup *) object; - symbol = (SPSymbol *) object; - object->readAttr( "viewBox" ); object->readAttr( "preserveAspectRatio" ); - if (((SPObjectClass *) parent_class)->build) + if (((SPObjectClass *) parent_class)->build) { ((SPObjectClass *) parent_class)->build (object, document, repr); + } } -static void -sp_symbol_release (SPObject *object) +static void sp_symbol_release(SPObject *object) { - SPSymbol * symbol; - - symbol = (SPSymbol *) object; - - if (((SPObjectClass *) parent_class)->release) + if (((SPObjectClass *) parent_class)->release) { ((SPObjectClass *) parent_class)->release (object); + } } -static void -sp_symbol_set (SPObject *object, unsigned int key, const gchar *value) +static void sp_symbol_set(SPObject *object, unsigned int key, const gchar *value) { - SPItem *item; - SPSymbol *symbol; - - item = SP_ITEM (object); - symbol = SP_SYMBOL (object); + SPSymbol *symbol = SP_SYMBOL(object); switch (key) { case SP_ATTR_VIEWBOX: @@ -232,30 +211,18 @@ sp_symbol_set (SPObject *object, unsigned int key, const gchar *value) } } -static void -sp_symbol_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref) +static void sp_symbol_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref) { - SPSymbol *symbol; - SPGroup *group; - - symbol = (SPSymbol *) object; - group = (SPGroup *) object; - - if (((SPObjectClass *) (parent_class))->child_added) + if (((SPObjectClass *) (parent_class))->child_added) { ((SPObjectClass *) (parent_class))->child_added (object, child, ref); + } } -static void -sp_symbol_update (SPObject *object, SPCtx *ctx, guint flags) +static void sp_symbol_update(SPObject *object, SPCtx *ctx, guint flags) { - SPItem *item; - SPSymbol *symbol; - SPItemCtx *ictx, rctx; - SPItemView *v; - - item = SP_ITEM (object); - symbol = SP_SYMBOL (object); - ictx = (SPItemCtx *) ctx; + SPSymbol *symbol = SP_SYMBOL(object); + SPItemCtx *ictx = (SPItemCtx *) ctx; + SPItemCtx rctx; if (object->cloned) { /* Cloned <symbol> is actually renderable */ @@ -353,38 +320,35 @@ sp_symbol_update (SPObject *object, SPCtx *ctx, guint flags) rctx.i2vp = Geom::identity(); } - /* And invoke parent method */ - if (((SPObjectClass *) (parent_class))->update) + // And invoke parent method + if (((SPObjectClass *) (parent_class))->update) { ((SPObjectClass *) (parent_class))->update (object, (SPCtx *) &rctx, flags); + } - /* As last step set additional transform of arena group */ - for (v = item->display; v != NULL; v = v->next) { + // As last step set additional transform of arena group + for (SPItemView *v = symbol->display; v != NULL; v = v->next) { nr_arena_group_set_child_transform(NR_ARENA_GROUP(v->arenaitem), symbol->c2p); } } else { - /* No-op */ - if (((SPObjectClass *) (parent_class))->update) + // No-op + if (((SPObjectClass *) (parent_class))->update) { ((SPObjectClass *) (parent_class))->update (object, ctx, flags); + } } } -static void -sp_symbol_modified (SPObject *object, guint flags) +static void sp_symbol_modified(SPObject *object, guint flags) { - SPSymbol *symbol; + SP_SYMBOL(object); - symbol = SP_SYMBOL (object); - - if (((SPObjectClass *) (parent_class))->modified) + if (((SPObjectClass *) (parent_class))->modified) { (* ((SPObjectClass *) (parent_class))->modified) (object, flags); + } } -static Inkscape::XML::Node * -sp_symbol_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +static Inkscape::XML::Node *sp_symbol_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - SPSymbol *symbol; - - symbol = SP_SYMBOL (object); + SP_SYMBOL(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { repr = xml_doc->createElement("svg:symbol"); @@ -403,52 +367,42 @@ sp_symbol_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::X return repr; } -static NRArenaItem * -sp_symbol_show (SPItem *item, NRArena *arena, unsigned int key, unsigned int flags) +static NRArenaItem *sp_symbol_show(SPItem *item, NRArena *arena, unsigned int key, unsigned int flags) { - SPSymbol *symbol; - NRArenaItem *ai; - - symbol = SP_SYMBOL (item); + SPSymbol *symbol = SP_SYMBOL(item); + NRArenaItem *ai = 0; if (symbol->cloned) { - /* Cloned <symbol> is actually renderable */ + // Cloned <symbol> is actually renderable if (((SPItemClass *) (parent_class))->show) { ai = ((SPItemClass *) (parent_class))->show (item, arena, key, flags); if (ai) { nr_arena_group_set_child_transform(NR_ARENA_GROUP(ai), symbol->c2p); } - } else { - ai = NULL; } - } else { - ai = NULL; } return ai; } -static void -sp_symbol_hide (SPItem *item, unsigned int key) +static void sp_symbol_hide(SPItem *item, unsigned int key) { - SPSymbol *symbol; - - symbol = SP_SYMBOL (item); + SPSymbol *symbol = SP_SYMBOL(item); if (symbol->cloned) { /* Cloned <symbol> is actually renderable */ - if (((SPItemClass *) (parent_class))->hide) + if (((SPItemClass *) (parent_class))->hide) { ((SPItemClass *) (parent_class))->hide (item, key); + } } } -static void -sp_symbol_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const &transform, unsigned const flags) +static void sp_symbol_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const &transform, unsigned const flags) { SPSymbol const *symbol = SP_SYMBOL(item); if (symbol->cloned) { - /* Cloned <symbol> is actually renderable */ + // Cloned <symbol> is actually renderable if (((SPItemClass *) (parent_class))->bbox) { Geom::Affine const a( symbol->c2p * transform ); @@ -457,12 +411,11 @@ sp_symbol_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const &transform, } } -static void -sp_symbol_print (SPItem *item, SPPrintContext *ctx) +static void sp_symbol_print(SPItem *item, SPPrintContext *ctx) { SPSymbol *symbol = SP_SYMBOL(item); if (symbol->cloned) { - /* Cloned <symbol> is actually renderable */ + // Cloned <symbol> is actually renderable sp_print_bind(ctx, &symbol->c2p, 1.0); diff --git a/src/sp-text.cpp b/src/sp-text.cpp index f7ba7592b..89ca4ace4 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -450,7 +450,7 @@ static void sp_text_snappoints(SPItem const *item, std::vector<Inkscape::SnapCan if (layout != NULL && layout->outputExists()) { boost::optional<Geom::Point> pt = layout->baselineAnchorPoint(); if (pt) { - p.push_back(Inkscape::SnapCandidatePoint((*pt) * item->i2d_affine(), Inkscape::SNAPSOURCE_TEXT_ANCHOR, Inkscape::SNAPTARGET_TEXT_ANCHOR)); + p.push_back(Inkscape::SnapCandidatePoint((*pt) * item->i2dt_affine(), Inkscape::SNAPSOURCE_TEXT_ANCHOR, Inkscape::SNAPTARGET_TEXT_ANCHOR)); } } } @@ -517,7 +517,7 @@ sp_text_print (SPItem *item, SPPrintContext *ctx) dbox.y0 = 0.0; dbox.x1 = item->document->getWidth(); dbox.y1 = item->document->getHeight(); - Geom::Affine const ctm (item->i2d_affine()); + Geom::Affine const ctm (item->i2dt_affine()); group->layout.print(ctx,&pbox,&dbox,&bbox,ctm); } diff --git a/src/splivarot.cpp b/src/splivarot.cpp index 3d3027639..d3d6c3db7 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -1963,7 +1963,7 @@ sp_selected_path_simplify_items(SPDesktop *desktop, continue; if (simplifyIndividualPaths) { - Geom::OptRect itemBbox = item->getBounds(item->i2d_affine()); + Geom::OptRect itemBbox = item->getBounds(item->i2dt_affine()); if (itemBbox) { simplifySize = L2(itemBbox->dimensions()); } else { diff --git a/src/spray-context.cpp b/src/spray-context.cpp index b2d99a696..33fffb01f 100644 --- a/src/spray-context.cpp +++ b/src/spray-context.cpp @@ -137,7 +137,7 @@ void sp_spray_rotate_rel(Geom::Point c, SPDesktop */*desktop*/, SPItem *item, Ge Geom::Translate const s(c); Geom::Affine affine = Geom::Affine(s).inverse() * Geom::Affine(rotation) * Geom::Affine(s); // Rotate item. - item->set_i2d_affine(item->i2d_affine() * (Geom::Affine)affine); + item->set_i2d_affine(item->i2dt_affine() * (Geom::Affine)affine); // Use each item's own transform writer, consistent with sp_selection_apply_affine() item->doWriteTransform(item->getRepr(), item->transform); // Restore the center position (it's changed because the bbox center changed) @@ -151,7 +151,7 @@ void sp_spray_rotate_rel(Geom::Point c, SPDesktop */*desktop*/, SPItem *item, Ge void sp_spray_scale_rel(Geom::Point c, SPDesktop */*desktop*/, SPItem *item, Geom::Scale const &scale) { Geom::Translate const s(c); - item->set_i2d_affine(item->i2d_affine() * s.inverse() * scale * s); + item->set_i2d_affine(item->i2dt_affine() * s.inverse() * scale * s); item->doWriteTransform(item->getRepr(), item->transform); } @@ -432,7 +432,7 @@ bool sp_spray_recursive(SPDesktop *desktop, if (SP_IS_BOX3D(item) ) { // convert 3D boxes to ordinary groups before spraying their shapes - item = SP_ITEM(box3d_convert_to_group(SP_BOX3D(item))); + item = box3d_convert_to_group(SP_BOX3D(item)); selection->add(item); } diff --git a/src/svg-view.cpp b/src/svg-view.cpp index 03056de2e..2f1a20b82 100644 --- a/src/svg-view.cpp +++ b/src/svg-view.cpp @@ -18,7 +18,7 @@ #include "document.h" #include "sp-item.h" #include "svg-view.h" - +#include "sp-root.h" /** * Constructs new SPSVGView object and returns pointer to it. @@ -41,7 +41,7 @@ SPSVGView::~SPSVGView() { if (doc() && _drawing) { - SP_ITEM( doc()->getRoot() )->invoke_hide(_dkey); + doc()->getRoot()->invoke_hide(_dkey); _drawing = NULL; } } @@ -191,7 +191,7 @@ void SPSVGView::setDocument (SPDocument *document) { if (doc()) { - SP_ITEM( doc()->getRoot() )->invoke_hide(_dkey); + doc()->getRoot()->invoke_hide(_dkey); } if (!_drawing) { @@ -202,7 +202,7 @@ SPSVGView::setDocument (SPDocument *document) View::setDocument (document); if (document) { - NRArenaItem *ai = SP_ITEM( document->getRoot() )->invoke_show( + NRArenaItem *ai = document->getRoot()->invoke_show( SP_CANVAS_ARENA (_drawing)->arena, _dkey, SP_ITEM_SHOW_DISPLAY); diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp index 873c214a7..d64fa749a 100644 --- a/src/text-chemistry.cpp +++ b/src/text-chemistry.cpp @@ -150,7 +150,7 @@ text_put_on_path() Inkscape::Text::Layout::Alignment text_alignment = layout->paragraphAlignment(layout->begin()); // remove transform from text, but recursively scale text's fontsize by the expansion - SP_TEXT(text)->_adjustFontsizeRecursive (text, SP_ITEM(text)->transform.descrim()); + SP_TEXT(text)->_adjustFontsizeRecursive (text, text->transform.descrim()); text->getRepr()->setAttribute("transform", NULL); // make a list of text children @@ -316,7 +316,7 @@ text_flow_into_shape() if (SP_IS_TEXT(text)) { // remove transform from text, but recursively scale text's fontsize by the expansion - SP_TEXT(text)->_adjustFontsizeRecursive(text, SP_ITEM(text)->transform.descrim()); + SP_TEXT(text)->_adjustFontsizeRecursive(text, text->transform.descrim()); text->getRepr()->setAttribute("transform", NULL); } @@ -433,7 +433,7 @@ text_unflow () rtext->setAttribute("style", flowtext->getRepr()->attribute("style")); // fixme: transfer style attrs too; and from descendants Geom::OptRect bbox; - SP_ITEM(flowtext)->invoke_bbox(bbox, SP_ITEM(flowtext)->i2doc_affine(), TRUE); + flowtext->invoke_bbox(bbox, flowtext->i2doc_affine(), TRUE); if (bbox) { Geom::Point xy = bbox->min(); sp_repr_set_svg_double(rtext, "x", xy[Geom::X]); @@ -454,7 +454,8 @@ text_unflow () SPObject *text_object = doc->getObjectByRepr(rtext); // restore the font size multiplier from the flowtext's transform - SP_TEXT(text_object)->_adjustFontsizeRecursive(SP_ITEM(text_object), ex); + SPText *text = SP_TEXT(text_object); + text->_adjustFontsizeRecursive(text, ex); new_objs = g_slist_prepend (new_objs, text_object); old_objs = g_slist_prepend (old_objs, flowtext); diff --git a/src/text-context.cpp b/src/text-context.cpp index a27ad3ee4..1468984a1 100644 --- a/src/text-context.cpp +++ b/src/text-context.cpp @@ -1593,8 +1593,8 @@ sp_text_context_update_cursor(SPTextContext *tc, bool scroll_to_see) if (tc->text) { Geom::Point p0, p1; sp_te_get_cursor_coords(tc->text, tc->text_sel_end, p0, p1); - Geom::Point const d0 = p0 * SP_ITEM(tc->text)->i2d_affine(); - Geom::Point const d1 = p1 * SP_ITEM(tc->text)->i2d_affine(); + Geom::Point const d0 = p0 * tc->text->i2dt_affine(); + Geom::Point const d1 = p1 * tc->text->i2dt_affine(); // scroll to show cursor if (scroll_to_see) { @@ -1675,7 +1675,7 @@ static void sp_text_context_update_text_selection(SPTextContext *tc) std::vector<Geom::Point> quads; if (tc->text != NULL) - quads = sp_te_create_selection_quads(tc->text, tc->text_sel_start, tc->text_sel_end, (tc->text)->i2d_affine()); + quads = sp_te_create_selection_quads(tc->text, tc->text_sel_start, tc->text_sel_end, (tc->text)->i2dt_affine()); for (unsigned i = 0 ; i < quads.size() ; i += 4) { SPCanvasItem *quad_canvasitem; quad_canvasitem = sp_canvas_item_new(sp_desktop_controls(tc->desktop), SP_TYPE_CTRLQUADR, NULL); diff --git a/src/text-editing.cpp b/src/text-editing.cpp index 18264fa56..7b032065b 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -87,7 +87,7 @@ bool sp_te_input_is_empty(SPObject const *item) Inkscape::Text::Layout::iterator sp_te_get_position_by_coords (SPItem const *item, Geom::Point const &i_p) { - Geom::Affine im (item->i2d_affine ()); + Geom::Affine im (item->i2dt_affine ()); im = im.inverse(); Geom::Point p = i_p * im; @@ -1232,7 +1232,7 @@ sp_te_adjust_linespacing_screen (SPItem *text, Inkscape::Text::Layout::iterator gdouble zby = by / (desktop->current_zoom() * (line_count == 0 ? 1 : line_count)); // divide increment by matrix expansion - Geom::Affine t (SP_ITEM(text)->i2doc_affine ()); + Geom::Affine t(text->i2doc_affine()); zby = zby / t.descrim(); switch (style->line_height.unit) { diff --git a/src/trace/imagemap.cpp b/src/trace/imagemap.cpp index a9ad9b9c8..c5a6bc2b5 100644 --- a/src/trace/imagemap.cpp +++ b/src/trace/imagemap.cpp @@ -78,10 +78,16 @@ GrayMap *GrayMapCreate(int width, int height) me->height = height; me->pixels = (unsigned long *) malloc(sizeof(unsigned long) * width * height); + if (!me->pixels) + { + free(me); + return NULL; + } me->rows = (unsigned long **) malloc(sizeof(unsigned long *) * height); - if (!me->pixels || !me->rows) + if (!me->rows) { + free(me->pixels); free(me); return NULL; } diff --git a/src/tweak-context.cpp b/src/tweak-context.cpp index 974197786..83598d8da 100644 --- a/src/tweak-context.cpp +++ b/src/tweak-context.cpp @@ -406,7 +406,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P if (SP_IS_BOX3D(item) && !is_transform_mode(mode) && !is_color_mode(mode)) { // convert 3D boxes to ordinary groups before tweaking their shapes - item = SP_ITEM(box3d_convert_to_group(SP_BOX3D(item))); + item = box3d_convert_to_group(SP_BOX3D(item)); selection->add(item); } @@ -983,7 +983,7 @@ sp_tweak_color_recursive (guint mode, SPItem *item, SPItem *item_at_point, } double blur_now = 0; - Geom::Affine i2d = item->i2d_affine (); + Geom::Affine i2dt = item->i2dt_affine (); if (style->filter.set && style->getFilter()) { //cycle through filter primitives SPObject *primitive_obj = style->getFilter()->children; @@ -994,7 +994,7 @@ sp_tweak_color_recursive (guint mode, SPItem *item, SPItem *item_at_point, if(SP_IS_GAUSSIANBLUR(primitive)) { SPGaussianBlur * spblur = SP_GAUSSIANBLUR(primitive); float num = spblur->stdDeviation.getNumber(); - blur_now += num * i2d.descrim(); // sum all blurs in the filter + blur_now += num * i2dt.descrim(); // sum all blurs in the filter } } primitive_obj = primitive_obj->next; diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 1a662f3be..e697fba99 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -120,7 +120,7 @@ set(ui_SRC previewfillable.h previewholder.h uxmanager.h - + cache/svg_preview_cache.h dialog/aboutbox.h diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index f7cb06263..8728e2ef4 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -271,7 +271,7 @@ BBoxSort::BBoxSort(const BBoxSort &rhs) : //NOTE : this copy ctor is called O(sort) when sorting the vector //this is bad. The vector should be a vector of pointers. //But I'll wait the bohem GC before doing that - item(rhs.item), anchor(rhs.anchor), bbox(rhs.bbox) + item(rhs.item), anchor(rhs.anchor), bbox(rhs.bbox) { } @@ -550,7 +550,7 @@ public: None, ZOrder, Clockwise - }; + }; ActionExchangePositions(Glib::ustring const &id, Glib::ustring const &tiptext, @@ -806,7 +806,7 @@ private : Inkscape::Text::Layout const *layout = te_get_layout(*it); boost::optional<Geom::Point> pt = layout->baselineAnchorPoint(); if (pt) { - Geom::Point base = *pt * (*it)->i2d_affine(); + Geom::Point base = *pt * (*it)->i2dt_affine(); if (base[Geom::X] < b_min[Geom::X]) b_min[Geom::X] = base[Geom::X]; if (base[Geom::Y] < b_min[Geom::Y]) b_min[Geom::Y] = base[Geom::Y]; if (base[Geom::X] > b_max[Geom::X]) b_max[Geom::X] = base[Geom::X]; @@ -849,7 +849,7 @@ private : Inkscape::Text::Layout const *layout = te_get_layout(*it); boost::optional<Geom::Point> pt = layout->baselineAnchorPoint(); if (pt) { - Geom::Point base = *pt * (*it)->i2d_affine(); + Geom::Point base = *pt * (*it)->i2dt_affine(); Geom::Point t(0.0, 0.0); t[_orientation] = b_min[_orientation] - base[_orientation]; sp_item_move_rel(*it, Geom::Translate(t)); @@ -904,107 +904,107 @@ AlignAndDistribute::AlignAndDistribute() Inkscape::Preferences *prefs = Inkscape::Preferences::get(); //Instanciate the align buttons - addAlignButton(INKSCAPE_ICON_ALIGN_HORIZONTAL_RIGHT_TO_ANCHOR, + addAlignButton(INKSCAPE_ICON("align-horizontal-right-to-anchor"), _("Align right edges of objects to the left edge of the anchor"), 0, 0); - addAlignButton(INKSCAPE_ICON_ALIGN_HORIZONTAL_LEFT, + addAlignButton(INKSCAPE_ICON("align-horizontal-left"), _("Align left edges"), 0, 1); - addAlignButton(INKSCAPE_ICON_ALIGN_HORIZONTAL_CENTER, + addAlignButton(INKSCAPE_ICON("align-horizontal-center"), _("Center on vertical axis"), 0, 2); - addAlignButton(INKSCAPE_ICON_ALIGN_HORIZONTAL_RIGHT, + addAlignButton(INKSCAPE_ICON("align-horizontal-right"), _("Align right sides"), 0, 3); - addAlignButton(INKSCAPE_ICON_ALIGN_HORIZONTAL_LEFT_TO_ANCHOR, + addAlignButton(INKSCAPE_ICON("align-horizontal-left-to-anchor"), _("Align left edges of objects to the right edge of the anchor"), 0, 4); - addAlignButton(INKSCAPE_ICON_ALIGN_VERTICAL_BOTTOM_TO_ANCHOR, + addAlignButton(INKSCAPE_ICON("align-vertical-bottom-to-anchor"), _("Align bottom edges of objects to the top edge of the anchor"), 1, 0); - addAlignButton(INKSCAPE_ICON_ALIGN_VERTICAL_TOP, + addAlignButton(INKSCAPE_ICON("align-vertical-top"), _("Align top edges"), 1, 1); - addAlignButton(INKSCAPE_ICON_ALIGN_VERTICAL_CENTER, + addAlignButton(INKSCAPE_ICON("align-vertical-center"), _("Center on horizontal axis"), 1, 2); - addAlignButton(INKSCAPE_ICON_ALIGN_VERTICAL_BOTTOM, + addAlignButton(INKSCAPE_ICON("align-vertical-bottom"), _("Align bottom edges"), 1, 3); - addAlignButton(INKSCAPE_ICON_ALIGN_VERTICAL_TOP_TO_ANCHOR, + addAlignButton(INKSCAPE_ICON("align-vertical-top-to-anchor"), _("Align top edges of objects to the bottom edge of the anchor"), 1, 4); //Baseline aligns - addBaselineButton(INKSCAPE_ICON_ALIGN_HORIZONTAL_BASELINE, + addBaselineButton(INKSCAPE_ICON("align-horizontal-baseline"), _("Align baseline anchors of texts horizontally"), 0, 5, this->align_table(), Geom::X, false); - addBaselineButton(INKSCAPE_ICON_ALIGN_VERTICAL_BASELINE, + addBaselineButton(INKSCAPE_ICON("align-vertical-baseline"), _("Align baselines of texts"), 1, 5, this->align_table(), Geom::Y, false); //The distribute buttons - addDistributeButton(INKSCAPE_ICON_DISTRIBUTE_HORIZONTAL_GAPS, + addDistributeButton(INKSCAPE_ICON("distribute-horizontal-gaps"), _("Make horizontal gaps between objects equal"), 0, 4, true, Geom::X, .5, .5); - addDistributeButton(INKSCAPE_ICON_DISTRIBUTE_HORIZONTAL_LEFT, + addDistributeButton(INKSCAPE_ICON("distribute-horizontal-left"), _("Distribute left edges equidistantly"), 0, 1, false, Geom::X, 1., 0.); - addDistributeButton(INKSCAPE_ICON_DISTRIBUTE_HORIZONTAL_CENTER, + addDistributeButton(INKSCAPE_ICON("distribute-horizontal-center"), _("Distribute centers equidistantly horizontally"), 0, 2, false, Geom::X, .5, .5); - addDistributeButton(INKSCAPE_ICON_DISTRIBUTE_HORIZONTAL_RIGHT, + addDistributeButton(INKSCAPE_ICON("distribute-horizontal-right"), _("Distribute right edges equidistantly"), 0, 3, false, Geom::X, 0., 1.); - addDistributeButton(INKSCAPE_ICON_DISTRIBUTE_VERTICAL_GAPS, + addDistributeButton(INKSCAPE_ICON("distribute-vertical-gaps"), _("Make vertical gaps between objects equal"), 1, 4, true, Geom::Y, .5, .5); - addDistributeButton(INKSCAPE_ICON_DISTRIBUTE_VERTICAL_TOP, + addDistributeButton(INKSCAPE_ICON("distribute-vertical-top"), _("Distribute top edges equidistantly"), 1, 1, false, Geom::Y, 0, 1); - addDistributeButton(INKSCAPE_ICON_DISTRIBUTE_VERTICAL_CENTER, + addDistributeButton(INKSCAPE_ICON("distribute-vertical-center"), _("Distribute centers equidistantly vertically"), 1, 2, false, Geom::Y, .5, .5); - addDistributeButton(INKSCAPE_ICON_DISTRIBUTE_VERTICAL_BOTTOM, + addDistributeButton(INKSCAPE_ICON("distribute-vertical-bottom"), _("Distribute bottom edges equidistantly"), 1, 3, false, Geom::Y, 1., 0.); //Baseline distribs - addBaselineButton(INKSCAPE_ICON_DISTRIBUTE_HORIZONTAL_BASELINE, + addBaselineButton(INKSCAPE_ICON("distribute-horizontal-baseline"), _("Distribute baseline anchors of texts horizontally"), 0, 5, this->distribute_table(), Geom::X, true); - addBaselineButton(INKSCAPE_ICON_DISTRIBUTE_VERTICAL_BASELINE, + addBaselineButton(INKSCAPE_ICON("distribute-vertical-baseline"), _("Distribute baselines of texts vertically"), 1, 5, this->distribute_table(), Geom::Y, true); // Rearrange //Graph Layout - addGraphLayoutButton(INKSCAPE_ICON_DISTRIBUTE_GRAPH, + addGraphLayoutButton(INKSCAPE_ICON("distribute-graph"), _("Nicely arrange selected connector network"), 0, 0); - addExchangePositionsButton(INKSCAPE_ICON_EXCHANGE_POSITIONS, + addExchangePositionsButton(INKSCAPE_ICON("exchange-positions"), _("Exchange positions of selected objects - selection order"), 0, 1); - addExchangePositionsByZOrderButton(INKSCAPE_ICON_EXCHANGE_POSITIONS_ZORDER, + addExchangePositionsByZOrderButton(INKSCAPE_ICON("exchange-positions-zorder"), _("Exchange positions of selected objects - stacking order"), 0, 2); - addExchangePositionsClockwiseButton(INKSCAPE_ICON_EXCHANGE_POSITIONS_CLOCKWISE, + addExchangePositionsClockwiseButton(INKSCAPE_ICON("exchange-positions-clockwise"), _("Exchange positions of selected objects - clockwise rotate"), 0, 3); - + //Randomize & Unclump - addRandomizeButton(INKSCAPE_ICON_DISTRIBUTE_RANDOMIZE, + addRandomizeButton(INKSCAPE_ICON("distribute-randomize"), _("Randomize centers in both dimensions"), 0, 4); - addUnclumpButton(INKSCAPE_ICON_DISTRIBUTE_UNCLUMP, + addUnclumpButton(INKSCAPE_ICON("distribute-unclump"), _("Unclump objects: try to equalize edge-to-edge distances"), 0, 5); //Remove overlaps - addRemoveOverlapsButton(INKSCAPE_ICON_DISTRIBUTE_REMOVE_OVERLAPS, + addRemoveOverlapsButton(INKSCAPE_ICON("distribute-remove-overlaps"), _("Move objects as little as possible so that their bounding boxes do not overlap"), 0, 0); @@ -1012,16 +1012,16 @@ AlignAndDistribute::AlignAndDistribute() // NOTE: "align nodes vertically" means "move nodes vertically until they align on a common // _horizontal_ line". This is analogous to what the "align-vertical-center" icon means. // There is no doubt some ambiguity. For this reason the descriptions are different. - addNodeButton(INKSCAPE_ICON_ALIGN_VERTICAL_NODES, + addNodeButton(INKSCAPE_ICON("align-vertical-node"), _("Align selected nodes to a common horizontal line"), 0, Geom::X, false); - addNodeButton(INKSCAPE_ICON_ALIGN_HORIZONTAL_NODES, + addNodeButton(INKSCAPE_ICON("align-horizontal-node"), _("Align selected nodes to a common vertical line"), 1, Geom::Y, false); - addNodeButton(INKSCAPE_ICON_DISTRIBUTE_HORIZONTAL_NODE, + addNodeButton(INKSCAPE_ICON("distribute-horizontal-node"), _("Distribute selected nodes horizontally"), 2, Geom::X, true); - addNodeButton(INKSCAPE_ICON_DISTRIBUTE_VERTICAL_NODE, + addNodeButton(INKSCAPE_ICON("distribute-vertical-node"), _("Distribute selected nodes vertically"), 3, Geom::Y, true); diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index e83aeccad..bb800f9ca 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -995,7 +995,7 @@ bool FileOpenDialogImplWin32::set_svg_preview() Geom::OptRect maybeArea(area); svgDoc->ensureUpToDate(); svgDoc->getRoot()->invoke_bbox( maybeArea, - svgDoc->getRoot()->i2d_affine(), TRUE); + svgDoc->getRoot()->i2dt_affine(), TRUE); NRArena *const arena = NRArena::create(); diff --git a/src/ui/dialog/fill-and-stroke.cpp b/src/ui/dialog/fill-and-stroke.cpp index 19bcadc00..5d85b2397 100644 --- a/src/ui/dialog/fill-and-stroke.cpp +++ b/src/ui/dialog/fill-and-stroke.cpp @@ -54,9 +54,9 @@ FillAndStroke::FillAndStroke() contents->pack_start(_notebook, true, true); - _notebook.append_page(_page_fill, _createPageTabLabel(_("_Fill"), INKSCAPE_ICON_OBJECT_FILL)); - _notebook.append_page(_page_stroke_paint, _createPageTabLabel(_("Stroke _paint"), INKSCAPE_ICON_OBJECT_STROKE)); - _notebook.append_page(_page_stroke_style, _createPageTabLabel(_("Stroke st_yle"), INKSCAPE_ICON_OBJECT_STROKE_STYLE)); + _notebook.append_page(_page_fill, _createPageTabLabel(_("_Fill"), INKSCAPE_ICON("object-fill"))); + _notebook.append_page(_page_stroke_paint, _createPageTabLabel(_("Stroke _paint"), INKSCAPE_ICON("object-stroke"))); + _notebook.append_page(_page_stroke_style, _createPageTabLabel(_("Stroke st_yle"), INKSCAPE_ICON("object-stroke-style"))); _layoutPageFill(); _layoutPageStrokePaint(); diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp index 4d98793bb..38ec6d1be 100644 --- a/src/ui/dialog/icon-preview.cpp +++ b/src/ui/dialog/icon-preview.cpp @@ -356,11 +356,10 @@ void IconPreviewPanel::refreshPreview() GSList const *items = sel->itemList(); while ( items && !target ) { SPItem* item = SP_ITEM( items->data ); - SPObject * obj = item; - gchar const *id = obj->getId(); + gchar const *id = item->getId(); if ( id ) { targetId = id; - target = obj; + target = item; } items = g_slist_next(items); @@ -447,7 +446,7 @@ void IconPreviewPanel::renderPreview( SPObject* obj ) /* Create ArenaItem and set transform */ unsigned int visionkey = SPItem::display_key_new(1); - root = SP_ITEM( doc->getRoot() )->invoke_show( arena, visionkey, SP_ITEM_SHOW_DISPLAY ); + root = doc->getRoot()->invoke_show( arena, visionkey, SP_ITEM_SHOW_DISPLAY ); for ( int i = 0; i < numEntries; i++ ) { unsigned unused; @@ -465,7 +464,7 @@ void IconPreviewPanel::renderPreview( SPObject* obj ) } updateMagnify(); - SP_ITEM(doc->getRoot())->invoke_hide(visionkey); + doc->getRoot()->invoke_hide(visionkey); nr_object_unref((NRObject *) arena); renderTimer->stop(); minDelay = std::max( 0.1, renderTimer->elapsed() * 3.0 ); diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 8d2d25162..340a1921c 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -582,7 +582,7 @@ LayersPanel::LayersPanel() : _tree.set_headers_visible(false); Inkscape::UI::Widget::ImageToggler *eyeRenderer = manage( new Inkscape::UI::Widget::ImageToggler( - INKSCAPE_ICON_OBJECT_VISIBLE, INKSCAPE_ICON_OBJECT_HIDDEN) ); + INKSCAPE_ICON("object-visible"), INKSCAPE_ICON("object-hidden")) ); int visibleColNum = _tree.append_column("vis", *eyeRenderer) - 1; eyeRenderer->signal_pre_toggle().connect( sigc::mem_fun(*this, &LayersPanel::_preToggle) ); eyeRenderer->signal_toggled().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_toggled), (int)COL_VISIBLE) ); @@ -593,7 +593,7 @@ LayersPanel::LayersPanel() : } Inkscape::UI::Widget::ImageToggler * renderer = manage( new Inkscape::UI::Widget::ImageToggler( - INKSCAPE_ICON_OBJECT_LOCKED, INKSCAPE_ICON_OBJECT_UNLOCKED) ); + INKSCAPE_ICON("object-locked"), INKSCAPE_ICON("object-unlocked")) ); int lockedColNum = _tree.append_column("lock", *renderer) - 1; renderer->signal_pre_toggle().connect( sigc::mem_fun(*this, &LayersPanel::_preToggle) ); renderer->signal_toggled().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_toggled), (int)COL_LOCKED) ); diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index bf60fe059..40b7f26ac 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -138,7 +138,7 @@ LivePathEffectEditor::LivePathEffectEditor() //Add the visibility icon column: Inkscape::UI::Widget::ImageToggler *eyeRenderer = manage( new Inkscape::UI::Widget::ImageToggler( - INKSCAPE_ICON_OBJECT_VISIBLE, INKSCAPE_ICON_OBJECT_HIDDEN) ); + INKSCAPE_ICON("object-visible"), INKSCAPE_ICON("object-visible")) ); int visibleColNum = effectlist_view.append_column("is_visible", *eyeRenderer) - 1; eyeRenderer->signal_toggled().connect( sigc::mem_fun(*this, &LivePathEffectEditor::on_visibility_toggled) ); eyeRenderer->property_activatable() = true; @@ -245,7 +245,7 @@ LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel) // this was triggered by selecting a row in the list, so skip reloading lpe_list_locked = false; return; - } + } effectlist_store->clear(); current_lpeitem = NULL; @@ -265,7 +265,7 @@ LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel) Inkscape::LivePathEffect::Effect *lpe = sp_lpe_item_get_current_lpe(lpeitem); if (lpe) { showParams(*lpe); - lpe_list_locked = true; + lpe_list_locked = true; selectInList(lpe); } else { showText(_("Unknown effect is applied")); diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index 7c7413ce5..68ad9393c 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -337,7 +337,7 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h // signs are inverted between x and y due to y inversion Geom::Point move = Geom::Point(new_x - min[Geom::X], min[Geom::Y] - new_y); Geom::Affine const affine = Geom::Affine(Geom::Translate(move)); - item->set_i2d_affine(item->i2d_affine() * affine); + item->set_i2d_affine(item->i2dt_affine() * affine); item->doWriteTransform(repr, item->transform, NULL); SP_OBJECT (current_row->data)->updateRepr(); cnt +=1; diff --git a/src/ui/icon-names.h b/src/ui/icon-names.h index 8935b1def..f83d42174 100644 --- a/src/ui/icon-names.h +++ b/src/ui/icon-names.h @@ -1,10 +1,5 @@ /** @file * @brief Macro for icon names used in Inkscape - * - * This file exists for several reasons: firstly, it contains all the icon names - * in Inkscape, so it can serve as a reference to themers. Secondly, using - * macros instead of strings avoids typos. Thirdly, we can change names - * to conform to external icon sets / specifications without changing any code. */ /* Authors: * Krzysztof KosiĆski <tweenk.pl@gmail.com> @@ -16,574 +11,11 @@ #ifndef SEEN_INKSCAPE_ICON_NAMES_H #define SEEN_INKSCAPE_ICON_NAMES_H -#define INKSCAPE_ICON_ALIGN_HORIZONTAL_BASELINE \ - "align-horizontal-baseline" -#define INKSCAPE_ICON_ALIGN_HORIZONTAL_CENTER \ - "align-horizontal-center" -#define INKSCAPE_ICON_ALIGN_HORIZONTAL_LEFT \ - "align-horizontal-left" -#define INKSCAPE_ICON_ALIGN_HORIZONTAL_LEFT_TO_ANCHOR \ - "align-horizontal-left-to-anchor" -#define INKSCAPE_ICON_ALIGN_HORIZONTAL_NODES \ - "align-horizontal-node" -#define INKSCAPE_ICON_ALIGN_HORIZONTAL_RIGHT \ - "align-horizontal-right" -#define INKSCAPE_ICON_ALIGN_HORIZONTAL_RIGHT_TO_ANCHOR \ - "align-horizontal-right-to-anchor" -#define INKSCAPE_ICON_ALIGN_VERTICAL_BASELINE \ - "align-vertical-baseline" -#define INKSCAPE_ICON_ALIGN_VERTICAL_BOTTOM \ - "align-vertical-bottom" -#define INKSCAPE_ICON_ALIGN_VERTICAL_BOTTOM_TO_ANCHOR \ - "align-vertical-bottom-to-anchor" -#define INKSCAPE_ICON_ALIGN_VERTICAL_CENTER \ - "align-vertical-center" -#define INKSCAPE_ICON_ALIGN_VERTICAL_NODES \ - "align-vertical-node" -#define INKSCAPE_ICON_ALIGN_VERTICAL_TOP \ - "align-vertical-top" -#define INKSCAPE_ICON_ALIGN_VERTICAL_TOP_TO_ANCHOR \ - "align-vertical-top-to-anchor" -#define INKSCAPE_ICON_BITMAP_TRACE \ - "bitmap-trace" -#define INKSCAPE_ICON_COLOR_FILL \ - "color-fill" -#define INKSCAPE_ICON_COLOR_GRADIENT \ - "color-gradient" -#define INKSCAPE_ICON_COLOR_MANAGEMENT \ - "color-management" -#define INKSCAPE_ICON_COLOR_PICKER \ - "color-picker" -#define INKSCAPE_ICON_COLOR_REMOVE \ - "color-remove" -#define INKSCAPE_ICON_CONNECTOR_EDIT \ - "connector-edit" -#define INKSCAPE_ICON_CONNECTOR_AVOID \ - "connector-avoid" -#define INKSCAPE_ICON_CONNECTOR_IGNORE \ - "connector-ignore" -#define INKSCAPE_ICON_CONNECTOR_ORTHOGONAL \ - "connector-orthogonal" -#define INKSCAPE_ICON_CONNECTOR_NEW_CONNPOINT \ - "connector-new-connpoint" -#define INKSCAPE_ICON_CONNECTOR_REMOVE_CONNPOINT \ - "connector-remove-connpoint" -#define INKSCAPE_ICON_DIALOG_ALIGN_AND_DISTRIBUTE \ - "dialog-align-and-distribute" -#define INKSCAPE_ICON_DIALOG_FILL_AND_STROKE \ - "dialog-fill-and-stroke" -#define INKSCAPE_ICON_DIALOG_ICON_PREVIEW \ - "dialog-icon-preview" -#define INKSCAPE_ICON_DIALOG_INPUT_DEVICES \ - "dialog-input-devices" -#define INKSCAPE_ICON_DIALOG_LAYERS \ - "dialog-layers" -#define INKSCAPE_ICON_DIALOG_MEMORY \ - "dialog-memory" -#define INKSCAPE_ICON_DIALOG_MESSAGES \ - "dialog-messages" -#define INKSCAPE_ICON_DIALOG_OBJECT_PROPERTIES \ - "dialog-object-properties" -#define INKSCAPE_ICON_DIALOG_ROWS_AND_COLUMNS \ - "dialog-rows-and-columns" -#define INKSCAPE_ICON_DIALOG_SCRIPTS \ - "dialog-scripts" -#define INKSCAPE_ICON_DIALOG_TEXT_AND_FONT \ - "dialog-text-and-font" -#define INKSCAPE_ICON_DIALOG_TILE_CLONES \ - "dialog-tile-clones" -#define INKSCAPE_ICON_DIALOG_TRANSFORM \ - "dialog-transform" -#define INKSCAPE_ICON_DIALOG_XML_EDITOR \ - "dialog-xml-editor" -#define INKSCAPE_ICON_DISTRIBUTE_GRAPH \ - "distribute-graph" -#define INKSCAPE_ICON_DISTRIBUTE_GRAPH_DIRECTED \ - "distribute-graph-directed" -#define INKSCAPE_ICON_DISTRIBUTE_HORIZONTAL_BASELINE \ - "distribute-horizontal-baseline" -#define INKSCAPE_ICON_DISTRIBUTE_HORIZONTAL_CENTER \ - "distribute-horizontal-center" -#define INKSCAPE_ICON_DISTRIBUTE_HORIZONTAL_GAPS \ - "distribute-horizontal-gaps" -#define INKSCAPE_ICON_DISTRIBUTE_HORIZONTAL_LEFT \ - "distribute-horizontal-left" -#define INKSCAPE_ICON_DISTRIBUTE_HORIZONTAL_NODE \ - "distribute-horizontal-node" -#define INKSCAPE_ICON_DISTRIBUTE_HORIZONTAL_RIGHT \ - "distribute-horizontal-right" -#define INKSCAPE_ICON_DISTRIBUTE_RANDOMIZE \ - "distribute-randomize" -#define INKSCAPE_ICON_DISTRIBUTE_REMOVE_OVERLAPS \ - "distribute-remove-overlaps" -#define INKSCAPE_ICON_DISTRIBUTE_UNCLUMP \ - "distribute-unclump" -#define INKSCAPE_ICON_DISTRIBUTE_VERTICAL_BASELINE \ - "distribute-vertical-baseline" -#define INKSCAPE_ICON_DISTRIBUTE_VERTICAL_BOTTOM \ - "distribute-vertical-bottom" -#define INKSCAPE_ICON_DISTRIBUTE_VERTICAL_CENTER \ - "distribute-vertical-center" -#define INKSCAPE_ICON_DISTRIBUTE_VERTICAL_GAPS \ - "distribute-vertical-gaps" -#define INKSCAPE_ICON_DISTRIBUTE_VERTICAL_NODE \ - "distribute-vertical-node" -#define INKSCAPE_ICON_DISTRIBUTE_VERTICAL_TOP \ - "distribute-vertical-top" -#define INKSCAPE_ICON_DOCUMENT_CLEANUP \ - "document-cleanup" -#define INKSCAPE_ICON_DOCUMENT_EXPORT \ - "document-export" -#define INKSCAPE_ICON_DOCUMENT_EXPORT_OCAL \ - "document-export-ocal" -#define INKSCAPE_ICON_DOCUMENT_IMPORT \ - "document-import" -#define INKSCAPE_ICON_DOCUMENT_IMPORT_OCAL \ - "document-import-ocal" -#define INKSCAPE_ICON_DOCUMENT_METADATA \ - "document-metadata" -#define INKSCAPE_ICON_DOCUMENT_OPEN_RECENT \ - "document-open-recent" -#define INKSCAPE_ICON_DRAW_CALLIGRAPHIC \ - "draw-calligraphic" -#define INKSCAPE_ICON_DRAW_CONNECTOR \ - "draw-connector" -#define INKSCAPE_ICON_DRAW_CUBOID \ - "draw-cuboid" -#define INKSCAPE_ICON_DRAW_ELLIPSE \ - "draw-ellipse" -#define INKSCAPE_ICON_DRAW_ELLIPSE_ARC \ - "draw-ellipse-arc" -#define INKSCAPE_ICON_DRAW_ELLIPSE_SEGMENT \ - "draw-ellipse-segment" -#define INKSCAPE_ICON_DRAW_ELLIPSE_WHOLE \ - "draw-ellipse-whole" -#define INKSCAPE_ICON_DRAW_ERASER \ - "draw-eraser" -#define INKSCAPE_ICON_DRAW_ERASER_DELETE_OBJECTS \ - "draw-eraser-delete-objects" -#define INKSCAPE_ICON_DRAW_FREEHAND \ - "draw-freehand" -#define INKSCAPE_ICON_DRAW_PATH \ - "draw-path" -#define INKSCAPE_ICON_DRAW_POLYGON \ - "draw-polygon" -#define INKSCAPE_ICON_DRAW_POLYGON_STAR \ - "draw-polygon-star" -#define INKSCAPE_ICON_DRAW_RECTANGLE \ - "draw-rectangle" -#define INKSCAPE_ICON_DRAW_SPIRAL \ - "draw-spiral" -#define INKSCAPE_ICON_DRAW_STAR \ - "draw-star" -#define INKSCAPE_ICON_DRAW_TEXT \ - "draw-text" -#define INKSCAPE_ICON_DRAW_TRACE_BACKGROUND \ - "draw-trace-background" -#define INKSCAPE_ICON_DRAW_USE_PRESSURE \ - "draw-use-pressure" -#define INKSCAPE_ICON_DRAW_USE_TILT \ - "draw-use-tilt" -#define INKSCAPE_ICON_EDIT_CLONE \ - "edit-clone" -#define INKSCAPE_ICON_EDIT_CLONE_UNLINK \ - "edit-clone-unlink" -#define INKSCAPE_ICON_EDIT_DUPLICATE \ - "edit-duplicate" -#define INKSCAPE_ICON_EDIT_PASTE_IN_PLACE \ - "edit-paste-in-place" -#define INKSCAPE_ICON_EDIT_PASTE_STYLE \ - "edit-paste-style" -#define INKSCAPE_ICON_EDIT_SELECT_ALL \ - "edit-select-all" -#define INKSCAPE_ICON_EDIT_SELECT_ALL_LAYERS \ - "edit-select-all-layers" -#define INKSCAPE_ICON_EDIT_SELECT_INVERT \ - "edit-select-invert" -#define INKSCAPE_ICON_EDIT_SELECT_NONE \ - "edit-select-none" -#define INKSCAPE_ICON_EDIT_SELECT_ORIGINAL \ - "edit-select-original" -#define INKSCAPE_ICON_EDIT_UNDO_HISTORY \ - "edit-undo-history" -#define INKSCAPE_ICON_EXCHANGE_POSITIONS \ - "exchange-positions" -#define INKSCAPE_ICON_EXCHANGE_POSITIONS_ZORDER \ - "exchange-positions-zorder" -#define INKSCAPE_ICON_EXCHANGE_POSITIONS_CLOCKWISE \ - "exchange-positions-clockwise" -#define INKSCAPE_ICON_FILL_RULE_EVEN_ODD \ - "fill-rule-even-odd" -#define INKSCAPE_ICON_FILL_RULE_NONZERO \ - "fill-rule-nonzero" -#define INKSCAPE_ICON_FORMAT_TEXT_DIRECTION_HORIZONTAL \ - "format-text-direction-horizontal" -#define INKSCAPE_ICON_FORMAT_TEXT_DIRECTION_VERTICAL \ - "format-text-direction-vertical" -#define INKSCAPE_ICON_GRID_AXONOMETRIC \ - "grid-axonometric" -#define INKSCAPE_ICON_GRID_RECTANGULAR \ - "grid-rectangular" -#define INKSCAPE_ICON_GUIDES \ - "guides" -#define INKSCAPE_ICON_HELP_CONTENTS \ - "help-contents" -#define INKSCAPE_ICON_HELP_KEYBOARD_SHORTCUTS \ - "help-keyboard-shortcuts" -#define INKSCAPE_ICON_IMAGE_FILTER_BLEND \ - "image-filter-blend" -#define INKSCAPE_ICON_IMAGE_FILTER_COLOR_MATRIX \ - "image-filter-color-matrix" -#define INKSCAPE_ICON_IMAGE_FILTER_DIFFUSE_LIGHTING \ - "image-filter-diffuse-lighting" -#define INKSCAPE_ICON_IMAGE_FILTER_DISPLACEMENT_MAP \ - "image-filter-displacement-map" -#define INKSCAPE_ICON_IMAGE_FILTER_FLOOD \ - "image-filter-flood" -#define INKSCAPE_ICON_IMAGE_FILTER_GAUSSIAN_BLUR \ - "image-filter-gaussian-blur" -#define INKSCAPE_ICON_IMAGE_FILTER_MORPHOLOGY \ - "image-filter-morphology" -#define INKSCAPE_ICON_IMAGE_FILTER_OFFSET \ - "image-filter-offset" -#define INKSCAPE_ICON_IMAGE_FILTER_TURBULENCE \ - "image-filter-turbulence" -#define INKSCAPE_ICON_INKSCAPE \ - "inkscape-logo" -#define INKSCAPE_ICON_LAYER_BOTTOM \ - "layer-bottom" -#define INKSCAPE_ICON_LAYER_DELETE \ - "layer-delete" -#define INKSCAPE_ICON_LAYER_LOWER \ - "layer-lower" -#define INKSCAPE_ICON_LAYER_NEW \ - "layer-new" -#define INKSCAPE_ICON_LAYER_NEXT \ - "layer-next" -#define INKSCAPE_ICON_LAYER_PREVIOUS \ - "layer-previous" -#define INKSCAPE_ICON_LAYER_RAISE \ - "layer-raise" -#define INKSCAPE_ICON_LAYER_RENAME \ - "layer-rename" -#define INKSCAPE_ICON_LAYER_TOP \ - "layer-top" -#define INKSCAPE_ICON_NODE_ADD \ - "node-add" -#define INKSCAPE_ICON_NODE_BREAK \ - "node-break" -#define INKSCAPE_ICON_NODE_DELETE \ - "node-delete" -#define INKSCAPE_ICON_NODE_DELETE_SEGMENT \ - "node-delete-segment" -#define INKSCAPE_ICON_NODE_DISTRIBUTE_HORIZONTAL \ - "distribute-horizontal-node" -#define INKSCAPE_ICON_NODE_DISTRIBUTE_VERTICAL \ - "distribute-vertical-node" -#define INKSCAPE_ICON_NODE_JOIN \ - "node-join" -#define INKSCAPE_ICON_NODE_JOIN_SEGMENT \ - "node-join-segment" -#define INKSCAPE_ICON_NODE_SEGMENT_CURVE \ - "node-segment-curve" -#define INKSCAPE_ICON_NODE_SEGMENT_LINE \ - "node-segment-line" -#define INKSCAPE_ICON_NODE_TYPE_AUTO_SMOOTH \ - "node-type-auto-smooth" -#define INKSCAPE_ICON_NODE_TYPE_CUSP \ - "node-type-cusp" -#define INKSCAPE_ICON_NODE_TYPE_SMOOTH \ - "node-type-smooth" -#define INKSCAPE_ICON_NODE_TYPE_SYMMETRIC \ - "node-type-symmetric" -#define INKSCAPE_ICON_OBJECT_COLUMNS \ - "object-columns" -#define INKSCAPE_ICON_OBJECT_FILL \ - "object-fill" -#define INKSCAPE_ICON_OBJECT_FLIP_HORIZONTAL \ - "object-flip-horizontal" -#define INKSCAPE_ICON_OBJECT_FLIP_VERTICAL \ - "object-flip-vertical" -#define INKSCAPE_ICON_OBJECT_GROUP \ - "object-group" -#define INKSCAPE_ICON_OBJECT_HIDDEN \ - "object-hidden" -#define INKSCAPE_ICON_OBJECT_LOCKED \ - "object-locked" -#define INKSCAPE_ICON_OBJECT_ROTATE_LEFT \ - "object-rotate-left" -#define INKSCAPE_ICON_OBJECT_ROTATE_RIGHT \ - "object-rotate-right" -#define INKSCAPE_ICON_OBJECT_ROWS \ - "object-rows" -#define INKSCAPE_ICON_OBJECT_STROKE \ - "object-stroke" -#define INKSCAPE_ICON_OBJECT_STROKE_STYLE \ - "object-stroke-style" -#define INKSCAPE_ICON_OBJECT_TO_PATH \ - "object-to-path" -#define INKSCAPE_ICON_OBJECT_TWEAK_ATTRACT \ - "object-tweak-attract" -#define INKSCAPE_ICON_OBJECT_TWEAK_BLUR \ - "object-tweak-blur" -#define INKSCAPE_ICON_OBJECT_TWEAK_DUPLICATE \ - "object-tweak-duplicate" -#define INKSCAPE_ICON_OBJECT_TWEAK_JITTER_COLOR \ - "object-tweak-jitter-color" -#define INKSCAPE_ICON_OBJECT_TWEAK_PAINT \ - "object-tweak-paint" -#define INKSCAPE_ICON_OBJECT_TWEAK_PUSH \ - "object-tweak-push" -#define INKSCAPE_ICON_OBJECT_TWEAK_RANDOMIZE \ - "object-tweak-randomize" -#define INKSCAPE_ICON_OBJECT_TWEAK_ROTATE \ - "object-tweak-rotate" -#define INKSCAPE_ICON_OBJECT_TWEAK_SHRINK \ - "object-tweak-shrink" -#define INKSCAPE_ICON_OBJECT_UNGROUP \ - "object-ungroup" -#define INKSCAPE_ICON_OBJECT_UNLOCKED \ - "object-unlocked" -#define INKSCAPE_ICON_OBJECT_VISIBLE \ - "object-visible" -#define INKSCAPE_ICON_PAINT_GRADIENT_LINEAR \ - "paint-gradient-linear" -#define INKSCAPE_ICON_PAINT_GRADIENT_RADIAL \ - "paint-gradient-radial" -#define INKSCAPE_ICON_PAINT_NONE \ - "paint-none" -#define INKSCAPE_ICON_PAINT_PATTERN \ - "paint-pattern" -#define INKSCAPE_ICON_PAINT_SOLID \ - "paint-solid" -#define INKSCAPE_ICON_PAINT_SWATCH \ - "paint-swatch" -#define INKSCAPE_ICON_PAINT_UNKNOWN \ - "paint-unknown" -#define INKSCAPE_ICON_PATH_BREAK_APART \ - "path-break-apart" -#define INKSCAPE_ICON_PATH_CLIP_EDIT \ - "path-clip-edit" -#define INKSCAPE_ICON_PATH_COMBINE \ - "path-combine" -#define INKSCAPE_ICON_PATH_CUT \ - "path-cut" -#define INKSCAPE_ICON_PATH_DIFFERENCE \ - "path-difference" -#define INKSCAPE_ICON_PATH_DIVISION \ - "path-division" -#define INKSCAPE_ICON_PATH_EFFECT_PARAMETER_NEXT \ - "path-effect-parameter-next" -#define INKSCAPE_ICON_PATH_EXCLUSION \ - "path-exclusion" -#define INKSCAPE_ICON_PATH_INSET \ - "path-inset" -#define INKSCAPE_ICON_PATH_INTERSECTION \ - "path-intersection" -#define INKSCAPE_ICON_PATH_MASK_EDIT \ - "path-mask-edit" -#define INKSCAPE_ICON_PATH_MODE_BEZIER \ - "path-mode-bezier" -#define INKSCAPE_ICON_PATH_MODE_POLYLINE \ - "path-mode-polyline" -#define INKSCAPE_ICON_PATH_MODE_POLYLINE_PARAXIAL \ - "path-mode-polyline-paraxial" -#define INKSCAPE_ICON_PATH_MODE_SPIRO \ - "path-mode-spiro" -#define INKSCAPE_ICON_PATH_OFFSET_DYNAMIC \ - "path-offset-dynamic" -#define INKSCAPE_ICON_PATH_OFFSET_LINKED \ - "path-offset-linked" -#define INKSCAPE_ICON_PATH_OUTSET \ - "path-outset" -#define INKSCAPE_ICON_PATH_REVERSE \ - "path-reverse" -#define INKSCAPE_ICON_PATH_SIMPLIFY \ - "path-simplify" -#define INKSCAPE_ICON_PATH_TWEAK_ATTRACT \ - "path-tweak-attract" -#define INKSCAPE_ICON_PATH_TWEAK_GROW \ - "path-tweak-grow" -#define INKSCAPE_ICON_PATH_TWEAK_PUSH \ - "path-tweak-push" -#define INKSCAPE_ICON_PATH_TWEAK_ROUGHEN \ - "path-tweak-roughen" -#define INKSCAPE_ICON_PATH_TWEAK_SHRINK \ - "path-tweak-shrink" -#define INKSCAPE_ICON_PATH_UNION \ - "path-union" -#define INKSCAPE_ICON_PERSPECTIVE_PARALLEL \ - "perspective-parallel" -#define INKSCAPE_ICON_RECTANGLE_MAKE_CORNERS_SHARP \ - "rectangle-make-corners-sharp" -#define INKSCAPE_ICON_SELECTION_BOTTOM \ - "selection-bottom" -#define INKSCAPE_ICON_SELECTION_LOWER \ - "selection-lower" -#define INKSCAPE_ICON_SELECTION_MAKE_BITMAP_COPY \ - "selection-make-bitmap-copy" -#define INKSCAPE_ICON_SELECTION_MOVE_TO_LAYER_ABOVE \ - "selection-move-to-layer-above" -#define INKSCAPE_ICON_SELECTION_MOVE_TO_LAYER_BELOW \ - "selection-move-to-layer-below" -#define INKSCAPE_ICON_SELECTION_RAISE \ - "selection-raise" -#define INKSCAPE_ICON_SELECTION_TOP \ - "selection-top" -#define INKSCAPE_ICON_SHOW_DIALOGS \ - "show-dialogs" -#define INKSCAPE_ICON_SHOW_GRID \ - "show-grid" -#define INKSCAPE_ICON_SHOW_GUIDES \ - "show-guides" -#define INKSCAPE_ICON_SHOW_NODE_HANDLES \ - "show-node-handles" -#define INKSCAPE_ICON_SHOW_PATH_OUTLINE \ - "show-path-outline" -#define INKSCAPE_ICON_SNAP \ - "snap" -#define INKSCAPE_ICON_SNAP_BOUNDING_BOX \ - "snap-bounding-box" -#define INKSCAPE_ICON_SNAP_BOUNDING_BOX_CENTER \ - "snap-bounding-box-center" -#define INKSCAPE_ICON_SNAP_BOUNDING_BOX_CORNERS \ - "snap-bounding-box-corners" -#define INKSCAPE_ICON_SNAP_BOUNDING_BOX_EDGES \ - "snap-bounding-box-edges" -#define INKSCAPE_ICON_SNAP_BOUNDING_BOX_MIDPOINTS \ - "snap-bounding-box-midpoints" -#define INKSCAPE_ICON_SNAP_GRID_GUIDE_INTERSECTIONS \ - "snap-grid-guide-intersections" -#define INKSCAPE_ICON_SNAP_NODES \ - "snap-nodes" -#define INKSCAPE_ICON_SNAP_NODES_CENTER \ - "snap-nodes-center" -#define INKSCAPE_ICON_SNAP_OTHERS \ - "snap-nodes-others" -#define INKSCAPE_ICON_SNAP_NODES_CUSP \ - "snap-nodes-cusp" -#define INKSCAPE_ICON_SNAP_NODES_INTERSECTION \ - "snap-nodes-intersection" -#define INKSCAPE_ICON_SNAP_NODES_MIDPOINT \ - "snap-nodes-midpoint" -#define INKSCAPE_ICON_SNAP_NODES_PATH \ - "snap-nodes-path" -#define INKSCAPE_ICON_SNAP_NODES_ROTATION_CENTER \ - "snap-nodes-rotation-center" -#define INKSCAPE_ICON_SNAP_TEXT_BASELINE \ - "snap-text-baseline" -#define INKSCAPE_ICON_SNAP_NODES_SMOOTH \ - "snap-nodes-smooth" -#define INKSCAPE_ICON_SNAP_PAGE \ - "snap-page" -#define INKSCAPE_ICON_SPRAY_COPY_MODE \ - "spray-copy-mode" -#define INKSCAPE_ICON_SPRAY_CLONE_MODE \ - "spray-clone-mode" -#define INKSCAPE_ICON_SPRAY_UNION_MODE \ - "spray-union-mode" -#define INKSCAPE_ICON_DIALOG_SPRAY_OPTIONS \ - "dialog-spray-options" -#define INKSCAPE_ICON_STROKE_CAP_BUTT \ - "stroke-cap-butt" -#define INKSCAPE_ICON_STROKE_CAP_ROUND \ - "stroke-cap-round" -#define INKSCAPE_ICON_STROKE_CAP_SQUARE \ - "stroke-cap-square" -#define INKSCAPE_ICON_STROKE_JOIN_BEVEL \ - "stroke-join-bevel" -#define INKSCAPE_ICON_STROKE_JOIN_MITER \ - "stroke-join-miter" -#define INKSCAPE_ICON_STROKE_JOIN_ROUND \ - "stroke-join-round" -#define INKSCAPE_ICON_STROKE_TO_PATH \ - "stroke-to-path" -#define INKSCAPE_ICON_TEXT_CONVERT_TO_REGULAR \ - "text-convert-to-regular" -#define INKSCAPE_ICON_TEXT_FLOW_INTO_FRAME \ - "text-flow-into-frame" -#define INKSCAPE_ICON_TEXT_PUT_ON_PATH \ - "text-put-on-path" -#define INKSCAPE_ICON_TEXT_REMOVE_FROM_PATH \ - "text-remove-from-path" -#define INKSCAPE_ICON_TEXT_UNFLOW \ - "text-unflow" -#define INKSCAPE_ICON_TEXT_UNKERN \ - "text-unkern" -#define INKSCAPE_ICON_TOOL_NODE_EDITOR \ - "tool-node-editor" -#define INKSCAPE_ICON_TOOL_POINTER \ - "tool-pointer" -#define INKSCAPE_ICON_TOOL_TWEAK \ - "tool-tweak" -#define INKSCAPE_ICON_TOOL_SPRAY \ - "tool-spray" -#define INKSCAPE_ICON_TRANSFORM_AFFECT_GRADIENT \ - "transform-affect-gradient" -#define INKSCAPE_ICON_TRANSFORM_AFFECT_PATTERN \ - "transform-affect-pattern" -#define INKSCAPE_ICON_TRANSFORM_AFFECT_ROUNDED_CORNERS \ - "transform-affect-rounded-corners" -#define INKSCAPE_ICON_TRANSFORM_AFFECT_STROKE \ - "transform-affect-stroke" -#define INKSCAPE_ICON_TRANSFORM_MOVE_HORIZONTAL \ - "transform-move-horizontal" -#define INKSCAPE_ICON_TRANSFORM_MOVE_VERTICAL \ - "transform-move-vertical" -#define INKSCAPE_ICON_TRANSFORM_ROTATE \ - "transform-rotate" -#define INKSCAPE_ICON_TRANSFORM_SCALE_HORIZONTAL \ - "transform-scale-horizontal" -#define INKSCAPE_ICON_TRANSFORM_SCALE_VERTICAL \ - "transform-scale-vertical" -#define INKSCAPE_ICON_TRANSFORM_SKEW_HORIZONTAL \ - "transform-skew-horizontal" -#define INKSCAPE_ICON_TRANSFORM_SKEW_VERTICAL \ - "transform-skew-vertical" -#define INKSCAPE_ICON_VIEW_FULLSCREEN \ - "view-fullscreen" -#define INKSCAPE_ICON_WINDOW_NEW \ - "window-new" -#define INKSCAPE_ICON_WINDOW_NEXT \ - "window-next" -#define INKSCAPE_ICON_WINDOW_PREVIOUS \ - "window-previous" -#define INKSCAPE_ICON_XML_ATTRIBUTE_DELETE \ - "xml-attribute-delete" -#define INKSCAPE_ICON_XML_ELEMENT_NEW \ - "xml-element-new" -#define INKSCAPE_ICON_XML_NODE_DELETE \ - "xml-node-delete" -#define INKSCAPE_ICON_XML_NODE_DUPLICATE \ - "xml-node-duplicate" -#define INKSCAPE_ICON_XML_TEXT_NEW \ - "xml-text-new" -#define INKSCAPE_ICON_ZOOM \ - "zoom" -#define INKSCAPE_ICON_MEASURE \ - "measure" -#define INKSCAPE_ICON_ZOOM_DOUBLE_SIZE \ - "zoom-double-size" -#define INKSCAPE_ICON_ZOOM_FIT_DRAWING \ - "zoom-fit-drawing" -#define INKSCAPE_ICON_ZOOM_FIT_PAGE \ - "zoom-fit-page" -#define INKSCAPE_ICON_ZOOM_FIT_SELECTION \ - "zoom-fit-selection" -#define INKSCAPE_ICON_ZOOM_FIT_WIDTH \ - "zoom-fit-width" -#define INKSCAPE_ICON_ZOOM_HALF_SIZE \ - "zoom-half-size" -#define INKSCAPE_ICON_ZOOM_IN \ - "zoom-in" -#define INKSCAPE_ICON_ZOOM_NEXT \ - "zoom-next" -#define INKSCAPE_ICON_ZOOM_ORIGINAL \ - "zoom-original" -#define INKSCAPE_ICON_ZOOM_OUT \ - "zoom-out" -#define INKSCAPE_ICON_ZOOM_PREVIOUS \ - "zoom-previous" +/** @brief Icon name annotation. + * Use this macro to mark strings which are used as icon names. + * This greatly simplifies tasks such as obtaining a full list of icons + * used by Inkscape. */ +#define INKSCAPE_ICON(icon) icon #endif /* ifdef SEEN_INKSCAPE_ICON_NAMES_H */ diff --git a/src/ui/tool/node-tool.cpp b/src/ui/tool/node-tool.cpp index f83f8c473..6385fce0a 100644 --- a/src/ui/tool/node-tool.cpp +++ b/src/ui/tool/node-tool.cpp @@ -485,7 +485,7 @@ gint ink_node_tool_root_handler(SPEventContext *event_context, GdkEvent *event) nt->flashed_item = over_item; SPCurve *c = SP_SHAPE(over_item)->getCurveBeforeLPE(); if (!c) break; // break out when curve doesn't exist - c->transform(over_item->i2d_affine()); + c->transform(over_item->i2dt_affine()); SPCanvasItem *flash = sp_canvas_bpath_new(sp_desktop_tempgroup(desktop), c); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(flash), prefs->getInt("/tools/nodes/highlight_color", 0xff0000ff), 1.0, diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 52286c6cc..1310219a1 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -120,7 +120,7 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, , _lpe_key(lpe_key) { if (_lpe_key.empty()) { - _i2d_transform = SP_ITEM(path)->i2d_affine(); + _i2d_transform = path->i2dt_affine(); } else { _i2d_transform = Geom::identity(); } @@ -976,7 +976,7 @@ void PathManipulator::_externalChange(unsigned type) } break; case PATH_CHANGE_TRANSFORM: { Geom::Affine i2d_change = _d2i_transform; - _i2d_transform = SP_ITEM(_path)->i2d_affine(); + _i2d_transform = _path->i2dt_affine(); _d2i_transform = _i2d_transform.inverse(); i2d_change *= _i2d_transform; for (SubpathList::iterator i = _subpaths.begin(); i != _subpaths.end(); ++i) { diff --git a/src/ui/widget/layer-selector.cpp b/src/ui/widget/layer-selector.cpp index ba4629c82..de482fb74 100644 --- a/src/ui/widget/layer-selector.cpp +++ b/src/ui/widget/layer-selector.cpp @@ -95,7 +95,7 @@ LayerSelector::LayerSelector(SPDesktop *desktop) AlternateIcons *label; label = Gtk::manage(new AlternateIcons(Inkscape::ICON_SIZE_DECORATION, - INKSCAPE_ICON_OBJECT_VISIBLE, INKSCAPE_ICON_OBJECT_HIDDEN)); + INKSCAPE_ICON("object-visible"), INKSCAPE_ICON("object-hidden"))); _visibility_toggle.add(*label); _visibility_toggle.signal_toggled().connect( sigc::compose( @@ -116,7 +116,7 @@ LayerSelector::LayerSelector(SPDesktop *desktop) pack_start(_visibility_toggle, Gtk::PACK_EXPAND_PADDING); label = Gtk::manage(new AlternateIcons(Inkscape::ICON_SIZE_DECORATION, - INKSCAPE_ICON_OBJECT_UNLOCKED, INKSCAPE_ICON_OBJECT_LOCKED)); + INKSCAPE_ICON("object-unlocked"), INKSCAPE_ICON("object-locked"))); _lock_toggle.add(*label); _lock_toggle.signal_toggled().connect( sigc::compose( diff --git a/src/unclump.cpp b/src/unclump.cpp index baeeaff76..e570e8fa7 100644 --- a/src/unclump.cpp +++ b/src/unclump.cpp @@ -34,7 +34,7 @@ unclump_center (SPItem *item) return i->second; } - Geom::OptRect r = item->getBounds(item->i2d_affine()); + Geom::OptRect r = item->getBounds(item->i2dt_affine()); if (r) { Geom::Point const c = r->midpoint(); c_cache[item->getId()] = c; @@ -53,7 +53,7 @@ unclump_wh (SPItem *item) if ( i != wh_cache.end() ) { wh = i->second; } else { - Geom::OptRect r = item->getBounds(item->i2d_affine()); + Geom::OptRect r = item->getBounds(item->i2dt_affine()); if (r) { wh = r->dimensions(); wh_cache[item->getId()] = wh; @@ -297,7 +297,7 @@ unclump_push (SPItem *from, SPItem *what, double dist) //g_print ("push %s at %g,%g from %g,%g by %g,%g, dist %g\n", what->getId(), it[Geom::X],it[Geom::Y], p[Geom::X],p[Geom::Y], by[Geom::X],by[Geom::Y], dist); - what->set_i2d_affine(what->i2d_affine() * move); + what->set_i2d_affine(what->i2dt_affine() * move); what->doWriteTransform(what->getRepr(), what->transform, NULL); } @@ -320,7 +320,7 @@ unclump_pull (SPItem *to, SPItem *what, double dist) //g_print ("pull %s at %g,%g to %g,%g by %g,%g, dist %g\n", what->getId(), it[Geom::X],it[Geom::Y], p[Geom::X],p[Geom::Y], by[Geom::X],by[Geom::Y], dist); - what->set_i2d_affine(what->i2d_affine() * move); + what->set_i2d_affine(what->i2dt_affine() * move); what->doWriteTransform(what->getRepr(), what->transform, NULL); } diff --git a/src/verbs.cpp b/src/verbs.cpp index bb22711e8..e443e9917 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -2257,17 +2257,17 @@ Verb *Verb::_base_verbs[] = { GTK_STOCK_PRINT ), // TRANSLATORS: "Vacuum Defs" means "Clean up defs" (so as to remove unused definitions) new FileVerb(SP_VERB_FILE_VACUUM, "FileVacuum", N_("Vac_uum Defs"), N_("Remove unused definitions (such as gradients or clipping paths) from the <defs> of the document"), - INKSCAPE_ICON_DOCUMENT_CLEANUP ), + INKSCAPE_ICON("document-cleanup") ), new FileVerb(SP_VERB_FILE_IMPORT, "FileImport", N_("_Import..."), - N_("Import a bitmap or SVG image into this document"), INKSCAPE_ICON_DOCUMENT_IMPORT), + N_("Import a bitmap or SVG image into this document"), INKSCAPE_ICON("document-import")), new FileVerb(SP_VERB_FILE_EXPORT, "FileExport", N_("_Export Bitmap..."), - N_("Export this document or a selection as a bitmap image"), INKSCAPE_ICON_DOCUMENT_EXPORT), - new FileVerb(SP_VERB_FILE_IMPORT_FROM_OCAL, "FileImportFromOCAL", N_("Import From Open Clip Art Library"), N_("Import a document from Open Clip Art Library"), INKSCAPE_ICON_DOCUMENT_IMPORT_OCAL), -// new FileVerb(SP_VERB_FILE_EXPORT_TO_OCAL, "FileExportToOCAL", N_("Export To Open Clip Art Library"), N_("Export this document to Open Clip Art Library"), INKSCAPE_ICON_DOCUMENT_EXPORT_OCAL), + N_("Export this document or a selection as a bitmap image"), INKSCAPE_ICON("document-export")), + new FileVerb(SP_VERB_FILE_IMPORT_FROM_OCAL, "FileImportFromOCAL", N_("Import From Open Clip Art Library"), N_("Import a document from Open Clip Art Library"), INKSCAPE_ICON("document-import-ocal")), +// new FileVerb(SP_VERB_FILE_EXPORT_TO_OCAL, "FileExportToOCAL", N_("Export To Open Clip Art Library"), N_("Export this document to Open Clip Art Library"), INKSCAPE_ICON("document-export-ocal")), new FileVerb(SP_VERB_FILE_NEXT_DESKTOP, "NextWindow", N_("N_ext Window"), - N_("Switch to the next document window"), INKSCAPE_ICON_WINDOW_NEXT), + N_("Switch to the next document window"), INKSCAPE_ICON("window-next")), new FileVerb(SP_VERB_FILE_PREV_DESKTOP, "PrevWindow", N_("P_revious Window"), - N_("Switch to the previous document window"), INKSCAPE_ICON_WINDOW_PREVIOUS), + N_("Switch to the previous document window"), INKSCAPE_ICON("window-previous")), new FileVerb(SP_VERB_FILE_CLOSE_VIEW, "FileClose", N_("_Close"), N_("Close this document window"), GTK_STOCK_CLOSE), new FileVerb(SP_VERB_FILE_QUIT, "FileQuit", N_("_Quit"), N_("Quit Inkscape"), GTK_STOCK_QUIT), @@ -2284,7 +2284,7 @@ Verb *Verb::_base_verbs[] = { new EditVerb(SP_VERB_EDIT_PASTE, "EditPaste", N_("_Paste"), N_("Paste objects from clipboard to mouse point, or paste text"), GTK_STOCK_PASTE), new EditVerb(SP_VERB_EDIT_PASTE_STYLE, "EditPasteStyle", N_("Paste _Style"), - N_("Apply the style of the copied object to selection"), INKSCAPE_ICON_EDIT_PASTE_STYLE), + N_("Apply the style of the copied object to selection"), INKSCAPE_ICON("edit-paste-style")), new EditVerb(SP_VERB_EDIT_PASTE_SIZE, "EditPasteSize", N_("Paste Si_ze"), N_("Scale selection to match the size of the copied object"), NULL), new EditVerb(SP_VERB_EDIT_PASTE_SIZE_X, "EditPasteWidth", N_("Paste _Width"), @@ -2298,7 +2298,7 @@ Verb *Verb::_base_verbs[] = { new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_Y, "EditPasteHeightSeparately", N_("Paste Height Separately"), N_("Scale each selected object vertically to match the height of the copied object"), NULL), new EditVerb(SP_VERB_EDIT_PASTE_IN_PLACE, "EditPasteInPlace", N_("Paste _In Place"), - N_("Paste objects from clipboard to the original location"), INKSCAPE_ICON_EDIT_PASTE_IN_PLACE), + N_("Paste objects from clipboard to the original location"), INKSCAPE_ICON("edit-paste-in-place")), new EditVerb(SP_VERB_EDIT_PASTE_LIVEPATHEFFECT, "PasteLivePathEffect", N_("Paste Path _Effect"), N_("Apply the path effect of the copied object to selection"), NULL), new EditVerb(SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT, "RemoveLivePathEffect", N_("Remove Path _Effect"), @@ -2308,15 +2308,15 @@ Verb *Verb::_base_verbs[] = { new EditVerb(SP_VERB_EDIT_DELETE, "EditDelete", N_("_Delete"), N_("Delete selection"), GTK_STOCK_DELETE), new EditVerb(SP_VERB_EDIT_DUPLICATE, "EditDuplicate", N_("Duplic_ate"), - N_("Duplicate selected objects"), INKSCAPE_ICON_EDIT_DUPLICATE), + N_("Duplicate selected objects"), INKSCAPE_ICON("edit-duplicate")), new EditVerb(SP_VERB_EDIT_CLONE, "EditClone", N_("Create Clo_ne"), - N_("Create a clone (a copy linked to the original) of selected object"), INKSCAPE_ICON_EDIT_CLONE), + N_("Create a clone (a copy linked to the original) of selected object"), INKSCAPE_ICON("edit-clone")), new EditVerb(SP_VERB_EDIT_UNLINK_CLONE, "EditUnlinkClone", N_("Unlin_k Clone"), - N_("Cut the selected clones' links to the originals, turning them into standalone objects"), INKSCAPE_ICON_EDIT_CLONE_UNLINK), + N_("Cut the selected clones' links to the originals, turning them into standalone objects"), INKSCAPE_ICON("edit-clone-unlink")), new EditVerb(SP_VERB_EDIT_RELINK_CLONE, "EditRelinkClone", N_("Relink to Copied"), N_("Relink the selected clones to the object currently on the clipboard"), NULL), new EditVerb(SP_VERB_EDIT_CLONE_SELECT_ORIGINAL, "EditCloneSelectOriginal", N_("Select _Original"), - N_("Select the object to which the selected clone is linked"), INKSCAPE_ICON_EDIT_SELECT_ORIGINAL), + N_("Select the object to which the selected clone is linked"), INKSCAPE_ICON("edit-select-original")), new EditVerb(SP_VERB_EDIT_SELECTION_2_MARKER, "ObjectsToMarker", N_("Objects to _Marker"), N_("Convert selection to a line marker"), NULL), new EditVerb(SP_VERB_EDIT_SELECTION_2_GUIDES, "ObjectsToGuides", N_("Objects to Gu_ides"), @@ -2330,9 +2330,9 @@ Verb *Verb::_base_verbs[] = { new EditVerb(SP_VERB_EDIT_SELECT_ALL, "EditSelectAll", N_("Select Al_l"), N_("Select all objects or all nodes"), GTK_STOCK_SELECT_ALL), new EditVerb(SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS, "EditSelectAllInAllLayers", N_("Select All in All La_yers"), - N_("Select all objects in all visible and unlocked layers"), INKSCAPE_ICON_EDIT_SELECT_ALL_LAYERS), + N_("Select all objects in all visible and unlocked layers"), INKSCAPE_ICON("edit-select-all-layers")), new EditVerb(SP_VERB_EDIT_INVERT, "EditInvert", N_("In_vert Selection"), - N_("Invert selection (unselect what is selected and select everything else)"), INKSCAPE_ICON_EDIT_SELECT_INVERT), + N_("Invert selection (unselect what is selected and select everything else)"), INKSCAPE_ICON("edit-select-invert")), new EditVerb(SP_VERB_EDIT_INVERT_IN_ALL_LAYERS, "EditInvertInAllLayers", N_("Invert in All Layers"), N_("Invert selection in all visible and unlocked layers"), NULL), new EditVerb(SP_VERB_EDIT_SELECT_NEXT, "EditSelectNext", N_("Select Next"), @@ -2340,56 +2340,56 @@ Verb *Verb::_base_verbs[] = { new EditVerb(SP_VERB_EDIT_SELECT_PREV, "EditSelectPrev", N_("Select Previous"), N_("Select previous object or node"), NULL), new EditVerb(SP_VERB_EDIT_DESELECT, "EditDeselect", N_("D_eselect"), - N_("Deselect any selected objects or nodes"), INKSCAPE_ICON_EDIT_SELECT_NONE), + N_("Deselect any selected objects or nodes"), INKSCAPE_ICON("edit-select-none")), new EditVerb(SP_VERB_EDIT_GUIDES_AROUND_PAGE, "EditGuidesAroundPage", N_("Create _Guides Around the Page"), N_("Create four guides aligned with the page borders"), NULL), new EditVerb(SP_VERB_EDIT_DELETE_ALL_GUIDES, "EditRemoveAllGuides", N_("Delete All Guides"), 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 editable path effect parameter"), INKSCAPE_ICON_PATH_EFFECT_PARAMETER_NEXT), + 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"), - N_("Raise selection to top"), INKSCAPE_ICON_SELECTION_TOP), + N_("Raise selection to top"), INKSCAPE_ICON("selection-top")), new SelectionVerb(SP_VERB_SELECTION_TO_BACK, "SelectionToBack", N_("Lower to _Bottom"), - N_("Lower selection to bottom"), INKSCAPE_ICON_SELECTION_BOTTOM), + N_("Lower selection to bottom"), INKSCAPE_ICON("selection-bottom")), new SelectionVerb(SP_VERB_SELECTION_RAISE, "SelectionRaise", N_("_Raise"), - N_("Raise selection one step"), INKSCAPE_ICON_SELECTION_RAISE), + N_("Raise selection one step"), INKSCAPE_ICON("selection-raise")), new SelectionVerb(SP_VERB_SELECTION_LOWER, "SelectionLower", N_("_Lower"), - N_("Lower selection one step"), INKSCAPE_ICON_SELECTION_LOWER), + N_("Lower selection one step"), INKSCAPE_ICON("selection-lower")), new SelectionVerb(SP_VERB_SELECTION_GROUP, "SelectionGroup", N_("_Group"), - N_("Group selected objects"), INKSCAPE_ICON_OBJECT_GROUP), + N_("Group selected objects"), INKSCAPE_ICON("object-group")), new SelectionVerb(SP_VERB_SELECTION_UNGROUP, "SelectionUnGroup", N_("_Ungroup"), - N_("Ungroup selected groups"), INKSCAPE_ICON_OBJECT_UNGROUP), + N_("Ungroup selected groups"), INKSCAPE_ICON("object-ungroup")), new SelectionVerb(SP_VERB_SELECTION_TEXTTOPATH, "SelectionTextToPath", N_("_Put on Path"), - N_("Put text on path"), INKSCAPE_ICON_TEXT_PUT_ON_PATH), + N_("Put text on path"), INKSCAPE_ICON("text-put-on-path")), new SelectionVerb(SP_VERB_SELECTION_TEXTFROMPATH, "SelectionTextFromPath", N_("_Remove from Path"), - N_("Remove text from path"), INKSCAPE_ICON_TEXT_REMOVE_FROM_PATH), + N_("Remove text from path"), INKSCAPE_ICON("text-remove-from-path")), new SelectionVerb(SP_VERB_SELECTION_REMOVE_KERNS, "SelectionTextRemoveKerns", N_("Remove Manual _Kerns"), // TRANSLATORS: "glyph": An image used in the visual representation of characters; // roughly speaking, how a character looks. A font is a set of glyphs. - N_("Remove all manual kerns and glyph rotations from a text object"), INKSCAPE_ICON_TEXT_UNKERN), + N_("Remove all manual kerns and glyph rotations from a text object"), INKSCAPE_ICON("text-unkern")), new SelectionVerb(SP_VERB_SELECTION_UNION, "SelectionUnion", N_("_Union"), - N_("Create union of selected paths"), INKSCAPE_ICON_PATH_UNION), + N_("Create union of selected paths"), INKSCAPE_ICON("path-union")), new SelectionVerb(SP_VERB_SELECTION_INTERSECT, "SelectionIntersect", N_("_Intersection"), - N_("Create intersection of selected paths"), INKSCAPE_ICON_PATH_INTERSECTION), + N_("Create intersection of selected paths"), INKSCAPE_ICON("path-intersection")), new SelectionVerb(SP_VERB_SELECTION_DIFF, "SelectionDiff", N_("_Difference"), - N_("Create difference of selected paths (bottom minus top)"), INKSCAPE_ICON_PATH_DIFFERENCE), + N_("Create difference of selected paths (bottom minus top)"), INKSCAPE_ICON("path-difference")), new SelectionVerb(SP_VERB_SELECTION_SYMDIFF, "SelectionSymDiff", N_("E_xclusion"), - N_("Create exclusive OR of selected paths (those parts that belong to only one path)"), INKSCAPE_ICON_PATH_EXCLUSION), + N_("Create exclusive OR of selected paths (those parts that belong to only one path)"), INKSCAPE_ICON("path-exclusion")), new SelectionVerb(SP_VERB_SELECTION_CUT, "SelectionDivide", N_("Di_vision"), - N_("Cut the bottom path into pieces"), INKSCAPE_ICON_PATH_DIVISION), + N_("Cut the bottom path into pieces"), INKSCAPE_ICON("path-division")), // TRANSLATORS: "to cut a path" is not the same as "to break a path apart" - see the // Advanced tutorial for more info new SelectionVerb(SP_VERB_SELECTION_SLICE, "SelectionCutPath", N_("Cut _Path"), - N_("Cut the bottom path's stroke into pieces, removing fill"), INKSCAPE_ICON_PATH_CUT), + N_("Cut the bottom path's stroke into pieces, removing fill"), INKSCAPE_ICON("path-cut")), // TRANSLATORS: "outset": expand a shape by offsetting the object's path, // i.e. by displacing it perpendicular to the path in each point. // See also the Advanced Tutorial for explanation. new SelectionVerb(SP_VERB_SELECTION_OFFSET, "SelectionOffset", N_("Outs_et"), - N_("Outset selected paths"), INKSCAPE_ICON_PATH_OUTSET), + N_("Outset selected paths"), INKSCAPE_ICON("path-outset")), new SelectionVerb(SP_VERB_SELECTION_OFFSET_SCREEN, "SelectionOffsetScreen", N_("O_utset Path by 1 px"), N_("Outset selected paths by 1 px"), NULL), @@ -2400,7 +2400,7 @@ Verb *Verb::_base_verbs[] = { // i.e. by displacing it perpendicular to the path in each point. // See also the Advanced Tutorial for explanation. new SelectionVerb(SP_VERB_SELECTION_INSET, "SelectionInset", N_("I_nset"), - N_("Inset selected paths"), INKSCAPE_ICON_PATH_INSET), + N_("Inset selected paths"), INKSCAPE_ICON("path-inset")), new SelectionVerb(SP_VERB_SELECTION_INSET_SCREEN, "SelectionInsetScreen", N_("I_nset Path by 1 px"), N_("Inset selected paths by 1 px"), NULL), @@ -2408,55 +2408,55 @@ Verb *Verb::_base_verbs[] = { N_("I_nset Path by 10 px"), N_("Inset selected paths by 10 px"), NULL), new SelectionVerb(SP_VERB_SELECTION_DYNAMIC_OFFSET, "SelectionDynOffset", - N_("D_ynamic Offset"), N_("Create a dynamic offset object"), INKSCAPE_ICON_PATH_OFFSET_DYNAMIC), + N_("D_ynamic Offset"), N_("Create a dynamic offset object"), INKSCAPE_ICON("path-offset-dynamic")), new SelectionVerb(SP_VERB_SELECTION_LINKED_OFFSET, "SelectionLinkedOffset", N_("_Linked Offset"), N_("Create a dynamic offset object linked to the original path"), - INKSCAPE_ICON_PATH_OFFSET_LINKED), + INKSCAPE_ICON("path-offset-linked")), new SelectionVerb(SP_VERB_SELECTION_OUTLINE, "StrokeToPath", N_("_Stroke to Path"), - N_("Convert selected object's stroke to paths"), INKSCAPE_ICON_STROKE_TO_PATH), + N_("Convert selected object's stroke to paths"), INKSCAPE_ICON("stroke-to-path")), new SelectionVerb(SP_VERB_SELECTION_SIMPLIFY, "SelectionSimplify", N_("Si_mplify"), - N_("Simplify selected paths (remove extra nodes)"), INKSCAPE_ICON_PATH_SIMPLIFY), + N_("Simplify selected paths (remove extra nodes)"), INKSCAPE_ICON("path-simplify")), new SelectionVerb(SP_VERB_SELECTION_REVERSE, "SelectionReverse", N_("_Reverse"), - N_("Reverse the direction of selected paths (useful for flipping markers)"), INKSCAPE_ICON_PATH_REVERSE), + N_("Reverse the direction of selected paths (useful for flipping markers)"), INKSCAPE_ICON("path-reverse")), // TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize) new SelectionVerb(SP_VERB_SELECTION_TRACE, "SelectionTrace", N_("_Trace Bitmap..."), - N_("Create one or more paths from a bitmap by tracing it"), INKSCAPE_ICON_BITMAP_TRACE), + N_("Create one or more paths from a bitmap by tracing it"), INKSCAPE_ICON("bitmap-trace")), new SelectionVerb(SP_VERB_SELECTION_CREATE_BITMAP, "SelectionCreateBitmap", N_("_Make a Bitmap Copy"), - N_("Export selection to a bitmap and insert it into document"), INKSCAPE_ICON_SELECTION_MAKE_BITMAP_COPY ), + N_("Export selection to a bitmap and insert it into document"), INKSCAPE_ICON("selection-make-bitmap-copy") ), new SelectionVerb(SP_VERB_SELECTION_COMBINE, "SelectionCombine", N_("_Combine"), - N_("Combine several paths into one"), INKSCAPE_ICON_PATH_COMBINE), + N_("Combine several paths into one"), INKSCAPE_ICON("path-combine")), // TRANSLATORS: "to cut a path" is not the same as "to break a path apart" - see the // Advanced tutorial for more info new SelectionVerb(SP_VERB_SELECTION_BREAK_APART, "SelectionBreakApart", N_("Break _Apart"), - N_("Break selected paths into subpaths"), INKSCAPE_ICON_PATH_BREAK_APART), + N_("Break selected paths into subpaths"), INKSCAPE_ICON("path-break-apart")), new SelectionVerb(SP_VERB_SELECTION_GRIDTILE, "DialogGridArrange", N_("Ro_ws and Columns..."), - N_("Arrange selected objects in a table"), INKSCAPE_ICON_DIALOG_ROWS_AND_COLUMNS), + N_("Arrange selected objects in a table"), INKSCAPE_ICON("dialog-rows-and-columns")), /* Layer */ new LayerVerb(SP_VERB_LAYER_NEW, "LayerNew", N_("_Add Layer..."), - N_("Create a new layer"), INKSCAPE_ICON_LAYER_NEW), + N_("Create a new layer"), INKSCAPE_ICON("layer-new")), new LayerVerb(SP_VERB_LAYER_RENAME, "LayerRename", N_("Re_name Layer..."), - N_("Rename the current layer"), INKSCAPE_ICON_LAYER_RENAME), + N_("Rename the current layer"), INKSCAPE_ICON("layer-rename")), new LayerVerb(SP_VERB_LAYER_NEXT, "LayerNext", N_("Switch to Layer Abov_e"), - N_("Switch to the layer above the current"), INKSCAPE_ICON_LAYER_PREVIOUS), + N_("Switch to the layer above the current"), INKSCAPE_ICON("layer-previous")), new LayerVerb(SP_VERB_LAYER_PREV, "LayerPrev", N_("Switch to Layer Belo_w"), - N_("Switch to the layer below the current"), INKSCAPE_ICON_LAYER_NEXT), + N_("Switch to the layer below the current"), INKSCAPE_ICON("layer-next")), new LayerVerb(SP_VERB_LAYER_MOVE_TO_NEXT, "LayerMoveToNext", N_("Move Selection to Layer Abo_ve"), - N_("Move selection to the layer above the current"), INKSCAPE_ICON_SELECTION_MOVE_TO_LAYER_ABOVE), + N_("Move selection to the layer above the current"), INKSCAPE_ICON("selection-move-to-layer-above")), new LayerVerb(SP_VERB_LAYER_MOVE_TO_PREV, "LayerMoveToPrev", N_("Move Selection to Layer Bel_ow"), - N_("Move selection to the layer below the current"), INKSCAPE_ICON_SELECTION_MOVE_TO_LAYER_BELOW), + N_("Move selection to the layer below the current"), INKSCAPE_ICON("selection-move-to-layer-below")), new LayerVerb(SP_VERB_LAYER_TO_TOP, "LayerToTop", N_("Layer to _Top"), - N_("Raise the current layer to the top"), INKSCAPE_ICON_LAYER_TOP), + N_("Raise the current layer to the top"), INKSCAPE_ICON("layer-top")), new LayerVerb(SP_VERB_LAYER_TO_BOTTOM, "LayerToBottom", N_("Layer to _Bottom"), - N_("Lower the current layer to the bottom"), INKSCAPE_ICON_LAYER_BOTTOM), + N_("Lower the current layer to the bottom"), INKSCAPE_ICON("layer-bottom")), new LayerVerb(SP_VERB_LAYER_RAISE, "LayerRaise", N_("_Raise Layer"), - N_("Raise the current layer"), INKSCAPE_ICON_LAYER_RAISE), + N_("Raise the current layer"), INKSCAPE_ICON("layer-raise")), new LayerVerb(SP_VERB_LAYER_LOWER, "LayerLower", N_("_Lower Layer"), - N_("Lower the current layer"), INKSCAPE_ICON_LAYER_LOWER), + N_("Lower the current layer"), INKSCAPE_ICON("layer-lower")), new LayerVerb(SP_VERB_LAYER_DUPLICATE, "LayerDuplicate", N_("D_uplicate Current Layer"), N_("Duplicate an existing layer"), NULL), new LayerVerb(SP_VERB_LAYER_DELETE, "LayerDelete", N_("_Delete Current Layer"), - N_("Delete the current layer"), INKSCAPE_ICON_LAYER_DELETE), + N_("Delete the current layer"), INKSCAPE_ICON("layer-delete")), new LayerVerb(SP_VERB_LAYER_SOLO, "LayerSolo", N_("_Show/hide other layers"), N_("Solo the current layer"), NULL), @@ -2464,83 +2464,83 @@ Verb *Verb::_base_verbs[] = { new ObjectVerb(SP_VERB_OBJECT_ROTATE_90_CW, "ObjectRotate90", N_("Rotate _90° CW"), // This is shared between tooltips and statusbar, so they // must use UTF-8, not HTML entities for special characters. - N_("Rotate selection 90\xc2\xb0 clockwise"), INKSCAPE_ICON_OBJECT_ROTATE_RIGHT), + N_("Rotate selection 90\xc2\xb0 clockwise"), INKSCAPE_ICON("object-rotate-right")), new ObjectVerb(SP_VERB_OBJECT_ROTATE_90_CCW, "ObjectRotate90CCW", N_("Rotate 9_0° CCW"), // This is shared between tooltips and statusbar, so they // must use UTF-8, not HTML entities for special characters. - N_("Rotate selection 90\xc2\xb0 counter-clockwise"), INKSCAPE_ICON_OBJECT_ROTATE_LEFT), + N_("Rotate selection 90\xc2\xb0 counter-clockwise"), INKSCAPE_ICON("object-rotate-left")), new ObjectVerb(SP_VERB_OBJECT_FLATTEN, "ObjectRemoveTransform", N_("Remove _Transformations"), N_("Remove transformations from object"), NULL), new ObjectVerb(SP_VERB_OBJECT_TO_CURVE, "ObjectToPath", N_("_Object to Path"), - N_("Convert selected object to path"), INKSCAPE_ICON_OBJECT_TO_PATH), + N_("Convert selected object to path"), INKSCAPE_ICON("object-to-path")), new ObjectVerb(SP_VERB_OBJECT_FLOW_TEXT, "ObjectFlowText", N_("_Flow into Frame"), N_("Put text into a frame (path or shape), creating a flowed text linked to the frame object"), "text-flow-into-frame"), new ObjectVerb(SP_VERB_OBJECT_UNFLOW_TEXT, "ObjectUnFlowText", N_("_Unflow"), - N_("Remove text from frame (creates a single-line text object)"), INKSCAPE_ICON_TEXT_UNFLOW), + N_("Remove text from frame (creates a single-line text object)"), INKSCAPE_ICON("text-unflow")), new ObjectVerb(SP_VERB_OBJECT_FLOWTEXT_TO_TEXT, "ObjectFlowtextToText", N_("_Convert to Text"), - N_("Convert flowed text to regular text object (preserves appearance)"), INKSCAPE_ICON_TEXT_CONVERT_TO_REGULAR), + N_("Convert flowed text to regular text object (preserves appearance)"), INKSCAPE_ICON("text-convert-to-regular")), new ObjectVerb(SP_VERB_OBJECT_FLIP_HORIZONTAL, "ObjectFlipHorizontally", N_("Flip _Horizontal"), N_("Flip selected objects horizontally"), - INKSCAPE_ICON_OBJECT_FLIP_HORIZONTAL), + INKSCAPE_ICON("object-flip-horizontal")), new ObjectVerb(SP_VERB_OBJECT_FLIP_VERTICAL, "ObjectFlipVertically", N_("Flip _Vertical"), N_("Flip selected objects vertically"), - INKSCAPE_ICON_OBJECT_FLIP_VERTICAL), + INKSCAPE_ICON("object-flip-vertical")), new ObjectVerb(SP_VERB_OBJECT_SET_MASK, "ObjectSetMask", N_("_Set"), N_("Apply mask to selection (using the topmost object as mask)"), NULL), new ObjectVerb(SP_VERB_OBJECT_EDIT_MASK, "ObjectEditMask", N_("_Edit"), - N_("Edit mask"), INKSCAPE_ICON_PATH_MASK_EDIT), + N_("Edit mask"), INKSCAPE_ICON("path-mask-edit")), new ObjectVerb(SP_VERB_OBJECT_UNSET_MASK, "ObjectUnSetMask", N_("_Release"), N_("Remove mask from selection"), NULL), new ObjectVerb(SP_VERB_OBJECT_SET_CLIPPATH, "ObjectSetClipPath", N_("_Set"), N_("Apply clipping path to selection (using the topmost object as clipping path)"), NULL), new ObjectVerb(SP_VERB_OBJECT_EDIT_CLIPPATH, "ObjectEditClipPath", N_("_Edit"), - N_("Edit clipping path"), INKSCAPE_ICON_PATH_CLIP_EDIT), + N_("Edit clipping path"), INKSCAPE_ICON("path-clip-edit")), new ObjectVerb(SP_VERB_OBJECT_UNSET_CLIPPATH, "ObjectUnSetClipPath", N_("_Release"), N_("Remove clipping path from selection"), NULL), /* Tools */ new ContextVerb(SP_VERB_CONTEXT_SELECT, "ToolSelector", N_("Select"), - N_("Select and transform objects"), INKSCAPE_ICON_TOOL_POINTER), + N_("Select and transform objects"), INKSCAPE_ICON("tool-pointer")), new ContextVerb(SP_VERB_CONTEXT_NODE, "ToolNode", N_("Node Edit"), - N_("Edit paths by nodes"), INKSCAPE_ICON_TOOL_NODE_EDITOR), + N_("Edit paths by nodes"), INKSCAPE_ICON("tool-node-editor")), new ContextVerb(SP_VERB_CONTEXT_TWEAK, "ToolTweak", N_("Tweak"), - N_("Tweak objects by sculpting or painting"), INKSCAPE_ICON_TOOL_TWEAK), + N_("Tweak objects by sculpting or painting"), INKSCAPE_ICON("tool-tweak")), new ContextVerb(SP_VERB_CONTEXT_SPRAY, "ToolSpray", N_("Spray"), - N_("Spray objects by sculpting or painting"), INKSCAPE_ICON_TOOL_SPRAY), + N_("Spray objects by sculpting or painting"), INKSCAPE_ICON("tool-spray")), new ContextVerb(SP_VERB_CONTEXT_RECT, "ToolRect", N_("Rectangle"), - N_("Create rectangles and squares"), INKSCAPE_ICON_DRAW_RECTANGLE), + N_("Create rectangles and squares"), INKSCAPE_ICON("draw-rectangle")), new ContextVerb(SP_VERB_CONTEXT_3DBOX, "Tool3DBox", N_("3D Box"), - N_("Create 3D boxes"), INKSCAPE_ICON_DRAW_CUBOID), + N_("Create 3D boxes"), INKSCAPE_ICON("draw-cuboid")), new ContextVerb(SP_VERB_CONTEXT_ARC, "ToolArc", N_("Ellipse"), - N_("Create circles, ellipses, and arcs"), INKSCAPE_ICON_DRAW_ELLIPSE), + N_("Create circles, ellipses, and arcs"), INKSCAPE_ICON("draw-ellipse")), new ContextVerb(SP_VERB_CONTEXT_STAR, "ToolStar", N_("Star"), - N_("Create stars and polygons"), INKSCAPE_ICON_DRAW_POLYGON_STAR), + N_("Create stars and polygons"), INKSCAPE_ICON("draw-polygon-star")), new ContextVerb(SP_VERB_CONTEXT_SPIRAL, "ToolSpiral", N_("Spiral"), - N_("Create spirals"), INKSCAPE_ICON_DRAW_SPIRAL), + N_("Create spirals"), INKSCAPE_ICON("draw-spiral")), new ContextVerb(SP_VERB_CONTEXT_PENCIL, "ToolPencil", N_("Pencil"), - N_("Draw freehand lines"), INKSCAPE_ICON_DRAW_FREEHAND), + N_("Draw freehand lines"), INKSCAPE_ICON("draw-freehand")), new ContextVerb(SP_VERB_CONTEXT_PEN, "ToolPen", N_("Pen"), - N_("Draw Bezier curves and straight lines"), INKSCAPE_ICON_DRAW_PATH), + N_("Draw Bezier curves and straight lines"), INKSCAPE_ICON("draw-path")), new ContextVerb(SP_VERB_CONTEXT_CALLIGRAPHIC, "ToolCalligraphic", N_("Calligraphy"), - N_("Draw calligraphic or brush strokes"), INKSCAPE_ICON_DRAW_CALLIGRAPHIC), + N_("Draw calligraphic or brush strokes"), INKSCAPE_ICON("draw-calligraphic")), new ContextVerb(SP_VERB_CONTEXT_TEXT, "ToolText", N_("Text"), - N_("Create and edit text objects"), INKSCAPE_ICON_DRAW_TEXT), + N_("Create and edit text objects"), INKSCAPE_ICON("draw-text")), new ContextVerb(SP_VERB_CONTEXT_GRADIENT, "ToolGradient", N_("Gradient"), - N_("Create and edit gradients"), INKSCAPE_ICON_COLOR_GRADIENT), + N_("Create and edit gradients"), INKSCAPE_ICON("color-gradient")), new ContextVerb(SP_VERB_CONTEXT_ZOOM, "ToolZoom", N_("Zoom"), - N_("Zoom in or out"), INKSCAPE_ICON_ZOOM), + N_("Zoom in or out"), INKSCAPE_ICON("zoom")), new ContextVerb(SP_VERB_CONTEXT_MEASURE, "ToolMeasure", N_("Measure"), - N_("Measurement tool"), INKSCAPE_ICON_MEASURE), + N_("Measurement tool"), INKSCAPE_ICON("tool-measure")), new ContextVerb(SP_VERB_CONTEXT_DROPPER, "ToolDropper", N_("Dropper"), - N_("Pick colors from image"), INKSCAPE_ICON_COLOR_PICKER), + N_("Pick colors from image"), INKSCAPE_ICON("color-picker")), new ContextVerb(SP_VERB_CONTEXT_CONNECTOR, "ToolConnector", N_("Connector"), - N_("Create diagram connectors"), INKSCAPE_ICON_DRAW_CONNECTOR), + N_("Create diagram connectors"), INKSCAPE_ICON("draw-connector")), new ContextVerb(SP_VERB_CONTEXT_PAINTBUCKET, "ToolPaintBucket", N_("Paint Bucket"), - N_("Fill bounded areas"), INKSCAPE_ICON_COLOR_FILL), + N_("Fill bounded areas"), INKSCAPE_ICON("color-fill")), new ContextVerb(SP_VERB_CONTEXT_LPE, "ToolLPE", N_("LPE Edit"), N_("Edit Path Effect parameters"), NULL), new ContextVerb(SP_VERB_CONTEXT_ERASER, "ToolEraser", N_("Eraser"), - N_("Erase existing paths"), INKSCAPE_ICON_DRAW_ERASER), + N_("Erase existing paths"), INKSCAPE_ICON("draw-eraser")), new ContextVerb(SP_VERB_CONTEXT_LPETOOL, "ToolLPETool", N_("LPE Tool"), N_("Do geometric constructions"), "draw-geometry"), /* Tool prefs */ @@ -2588,31 +2588,31 @@ Verb *Verb::_base_verbs[] = { N_("Open Preferences for the LPETool tool"), NULL), /* Zoom/View */ - new ZoomVerb(SP_VERB_ZOOM_IN, "ZoomIn", N_("Zoom In"), N_("Zoom in"), INKSCAPE_ICON_ZOOM_IN), - new ZoomVerb(SP_VERB_ZOOM_OUT, "ZoomOut", N_("Zoom Out"), N_("Zoom out"), INKSCAPE_ICON_ZOOM_OUT), + new ZoomVerb(SP_VERB_ZOOM_IN, "ZoomIn", N_("Zoom In"), N_("Zoom in"), INKSCAPE_ICON("zoom-in")), + new ZoomVerb(SP_VERB_ZOOM_OUT, "ZoomOut", N_("Zoom Out"), N_("Zoom out"), INKSCAPE_ICON("zoom-out")), new ZoomVerb(SP_VERB_TOGGLE_RULERS, "ToggleRulers", N_("_Rulers"), N_("Show or hide the canvas rulers"), NULL), 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_("Enable snapping"), INKSCAPE_ICON_SNAP), + 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_("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), + INKSCAPE_ICON("zoom-next")), new ZoomVerb(SP_VERB_ZOOM_PREV, "ZoomPrev", N_("Pre_vious Zoom"), N_("Previous zoom (from the history of zooms)"), - INKSCAPE_ICON_ZOOM_PREVIOUS), + INKSCAPE_ICON("zoom-previous")), new ZoomVerb(SP_VERB_ZOOM_1_1, "Zoom1:0", N_("Zoom 1:_1"), N_("Zoom to 1:1"), - INKSCAPE_ICON_ZOOM_ORIGINAL), + INKSCAPE_ICON("zoom-original")), new ZoomVerb(SP_VERB_ZOOM_1_2, "Zoom1:2", N_("Zoom 1:_2"), N_("Zoom to 1:2"), - INKSCAPE_ICON_ZOOM_HALF_SIZE), + INKSCAPE_ICON("zoom-half-size")), new ZoomVerb(SP_VERB_ZOOM_2_1, "Zoom2:1", N_("_Zoom 2:1"), N_("Zoom to 2:1"), - INKSCAPE_ICON_ZOOM_DOUBLE_SIZE), + INKSCAPE_ICON("zoom-double-size")), #ifdef HAVE_GTK_WINDOW_FULLSCREEN new ZoomVerb(SP_VERB_FULLSCREEN, "FullScreen", N_("_Fullscreen"), N_("Stretch this document window to full screen"), - INKSCAPE_ICON_VIEW_FULLSCREEN), + INKSCAPE_ICON("view-fullscreen")), #endif /* HAVE_GTK_WINDOW_FULLSCREEN */ new ZoomVerb(SP_VERB_FOCUSTOGGLE, "FocusToggle", N_("Toggle _Focus Mode"), N_("Remove excess toolbars to focus on drawing"), NULL), new ZoomVerb(SP_VERB_VIEW_NEW, "ViewNew", N_("Duplic_ate Window"), N_("Open a new window with the same document"), - INKSCAPE_ICON_WINDOW_NEW), + INKSCAPE_ICON("window-new")), new ZoomVerb(SP_VERB_VIEW_NEW_PREVIEW, "ViewNewPreview", N_("_New View Preview"), N_("New View Preview"), NULL/*"view_new_preview"*/), @@ -2634,18 +2634,18 @@ Verb *Verb::_base_verbs[] = { N_("Toggle between normal and grayscale color display modes"), NULL), new ZoomVerb(SP_VERB_VIEW_CMS_TOGGLE, "ViewCmsToggle", N_("Color-managed view"), - N_("Toggle color-managed display for this document window"), INKSCAPE_ICON_COLOR_MANAGEMENT), + N_("Toggle color-managed display for this document window"), INKSCAPE_ICON("color-management")), new ZoomVerb(SP_VERB_VIEW_ICON_PREVIEW, "ViewIconPreview", N_("Ico_n Preview..."), - N_("Open a window to preview objects at different icon resolutions"), INKSCAPE_ICON_DIALOG_ICON_PREVIEW), + N_("Open a window to preview objects at different icon resolutions"), INKSCAPE_ICON("dialog-icon-preview")), new ZoomVerb(SP_VERB_ZOOM_PAGE, "ZoomPage", N_("_Page"), - N_("Zoom to fit page in window"), INKSCAPE_ICON_ZOOM_FIT_PAGE), + N_("Zoom to fit page in window"), INKSCAPE_ICON("zoom-fit-page")), new ZoomVerb(SP_VERB_ZOOM_PAGE_WIDTH, "ZoomPageWidth", N_("Page _Width"), - N_("Zoom to fit page width in window"), INKSCAPE_ICON_ZOOM_FIT_WIDTH), + N_("Zoom to fit page width in window"), INKSCAPE_ICON("zoom-fit-width")), new ZoomVerb(SP_VERB_ZOOM_DRAWING, "ZoomDrawing", N_("_Drawing"), - N_("Zoom to fit drawing in window"), INKSCAPE_ICON_ZOOM_FIT_DRAWING), + N_("Zoom to fit drawing in window"), INKSCAPE_ICON("zoom-fit-drawing")), new ZoomVerb(SP_VERB_ZOOM_SELECTION, "ZoomSelection", N_("_Selection"), - N_("Zoom to fit selection in window"), INKSCAPE_ICON_ZOOM_FIT_SELECTION), + N_("Zoom to fit selection in window"), INKSCAPE_ICON("zoom-fit-selection")), /* Dialogs */ new DialogVerb(SP_VERB_DIALOG_DISPLAY, "DialogPreferences", N_("In_kscape Preferences..."), @@ -2653,26 +2653,26 @@ Verb *Verb::_base_verbs[] = { new DialogVerb(SP_VERB_DIALOG_NAMEDVIEW, "DialogDocumentProperties", N_("_Document Properties..."), N_("Edit properties of this document (to be saved with the document)"), GTK_STOCK_PROPERTIES ), new DialogVerb(SP_VERB_DIALOG_METADATA, "DialogMetadata", N_("Document _Metadata..."), - N_("Edit document metadata (to be saved with the document)"), INKSCAPE_ICON_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, arrowheads, and other fill and stroke properties..."), 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_("Gl_yphs..."), N_("Select characters from a glyphs palette"), GTK_STOCK_SELECT_FONT), // TRANSLATORS: "Swatches" means: color samples new DialogVerb(SP_VERB_DIALOG_SWATCHES, "DialogSwatches", N_("S_watches..."), N_("Select colors from a swatches palette"), GTK_STOCK_SELECT_COLOR), new DialogVerb(SP_VERB_DIALOG_TRANSFORM, "DialogTransform", N_("Transfor_m..."), - N_("Precisely control objects' transformations"), INKSCAPE_ICON_DIALOG_TRANSFORM), + N_("Precisely control objects' transformations"), INKSCAPE_ICON("dialog-transform")), new DialogVerb(SP_VERB_DIALOG_ALIGN_DISTRIBUTE, "DialogAlignDistribute", N_("_Align and Distribute..."), - N_("Align and distribute objects"), INKSCAPE_ICON_DIALOG_ALIGN_AND_DISTRIBUTE), + N_("Align and distribute objects"), INKSCAPE_ICON("dialog-align-and-distribute")), new DialogVerb(SP_VERB_DIALOG_SPRAY_OPTION, "DialogSprayOption", N_("_Spray options..."), - N_("Some options for the spray"), INKSCAPE_ICON_DIALOG_SPRAY_OPTIONS), + N_("Some options for the spray"), INKSCAPE_ICON("dialog-spray-options")), new DialogVerb(SP_VERB_DIALOG_UNDO_HISTORY, "DialogUndoHistory", N_("Undo _History..."), - N_("Undo History"), INKSCAPE_ICON_EDIT_UNDO_HISTORY), + N_("Undo History"), INKSCAPE_ICON("edit-undo-history")), new DialogVerb(SP_VERB_DIALOG_TEXT, "DialogText", N_("_Text and Font..."), - N_("View and select font family, font size and other text properties"), INKSCAPE_ICON_DIALOG_TEXT_AND_FONT), + N_("View and select font family, font size and other text properties"), INKSCAPE_ICON("dialog-text-and-font")), new DialogVerb(SP_VERB_DIALOG_XML_EDITOR, "DialogXMLEditor", N_("_XML Editor..."), - N_("View and edit the XML tree of the document"), INKSCAPE_ICON_DIALOG_XML_EDITOR), + N_("View and edit the XML tree of the document"), INKSCAPE_ICON("dialog-xml-editor")), new DialogVerb(SP_VERB_DIALOG_FIND, "DialogFind", N_("_Find..."), N_("Find objects in document"), GTK_STOCK_FIND ), new DialogVerb(SP_VERB_DIALOG_FINDREPLACE, "DialogFindReplace", N_("Find and _Replace Text..."), @@ -2680,25 +2680,25 @@ Verb *Verb::_base_verbs[] = { new DialogVerb(SP_VERB_DIALOG_SPELLCHECK, "DialogSpellcheck", N_("Check Spellin_g..."), N_("Check spelling of text in document"), GTK_STOCK_SPELL_CHECK ), new DialogVerb(SP_VERB_DIALOG_DEBUG, "DialogDebug", N_("_Messages..."), - N_("View debug messages"), INKSCAPE_ICON_DIALOG_MESSAGES), + N_("View debug messages"), INKSCAPE_ICON("dialog-messages")), new DialogVerb(SP_VERB_DIALOG_SCRIPT, "DialogScript", N_("S_cripts..."), - N_("Run scripts"), INKSCAPE_ICON_DIALOG_SCRIPTS), + N_("Run scripts"), INKSCAPE_ICON("dialog-scripts")), new DialogVerb(SP_VERB_DIALOG_TOGGLE, "DialogsToggle", N_("Show/Hide D_ialogs"), - N_("Show or hide all open dialogs"), INKSCAPE_ICON_SHOW_DIALOGS), + N_("Show or hide all open dialogs"), INKSCAPE_ICON("show-dialogs")), new DialogVerb(SP_VERB_DIALOG_CLONETILER, "DialogClonetiler", N_("Create Tiled Clones..."), - N_("Create multiple clones of selected object, arranging them into a pattern or scattering"), INKSCAPE_ICON_DIALOG_TILE_CLONES), + N_("Create multiple clones of selected object, arranging them into a pattern or scattering"), INKSCAPE_ICON("dialog-tile-clones")), new DialogVerb(SP_VERB_DIALOG_ITEM, "DialogObjectProperties", N_("_Object Properties..."), - N_("Edit the ID, locked and visible status, and other object properties"), INKSCAPE_ICON_DIALOG_OBJECT_PROPERTIES), + N_("Edit the ID, locked and visible status, and other object properties"), INKSCAPE_ICON("dialog-object-properties")), /*#ifdef WITH_INKBOARD new DialogVerb(SP_VERB_XMPP_CLIENT, "DialogXmppClient", N_("_Instant Messaging..."), N_("Jabber Instant Messaging Client"), NULL), #endif*/ new DialogVerb(SP_VERB_DIALOG_INPUT, "DialogInput", N_("_Input Devices..."), - N_("Configure extended input devices, such as a graphics tablet"), INKSCAPE_ICON_DIALOG_INPUT_DEVICES), + N_("Configure extended input devices, such as a graphics tablet"), INKSCAPE_ICON("dialog-input-devices")), new DialogVerb(SP_VERB_DIALOG_EXTENSIONEDITOR, "org.inkscape.dialogs.extensioneditor", N_("_Extensions..."), N_("Query information about extensions"), NULL), new DialogVerb(SP_VERB_DIALOG_LAYERS, "DialogLayers", N_("Layer_s..."), - N_("View Layers"), INKSCAPE_ICON_DIALOG_LAYERS), + N_("View Layers"), INKSCAPE_ICON("dialog-layers")), new DialogVerb(SP_VERB_DIALOG_LIVE_PATH_EFFECT, "DialogLivePathEffect", N_("Path E_ffect Editor..."), N_("Manage, edit, and apply path effects"), NULL), new DialogVerb(SP_VERB_DIALOG_FILTER_EFFECTS, "DialogFilterEffects", N_("Filter _Editor..."), @@ -2712,9 +2712,9 @@ Verb *Verb::_base_verbs[] = { new HelpVerb(SP_VERB_HELP_ABOUT_EXTENSIONS, "HelpAboutExtensions", N_("About E_xtensions"), N_("Information on Inkscape extensions"), NULL), new HelpVerb(SP_VERB_HELP_MEMORY, "HelpAboutMemory", N_("About _Memory"), - N_("Memory usage information"), INKSCAPE_ICON_DIALOG_MEMORY), + N_("Memory usage information"), INKSCAPE_ICON("dialog-memory")), new HelpVerb(SP_VERB_HELP_ABOUT, "HelpAbout", N_("_About Inkscape"), - N_("Inkscape version, authors, license"), INKSCAPE_ICON_INKSCAPE), + N_("Inkscape version, authors, license"), INKSCAPE_ICON("inkscape")), //new HelpVerb(SP_VERB_SHOW_LICENSE, "ShowLicense", N_("_License"), // N_("Distribution terms"), /*"show_license"*/"inkscape_options"), diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 970a094a9..7958a9d07 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -334,7 +334,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); @@ -388,7 +388,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) dtw->sticky_zoom = sp_button_new_from_data ( Inkscape::ICON_SIZE_DECORATION, SP_BUTTON_TYPE_TOGGLE, NULL, - INKSCAPE_ICON_ZOOM_ORIGINAL, + INKSCAPE_ICON("zoom-original"), _("Zoom drawing if window size changes")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dtw->sticky_zoom), prefs->getBool("/options/stickyzoom/value")); gtk_box_pack_start (GTK_BOX (dtw->vscrollbar_box), dtw->sticky_zoom, FALSE, FALSE, 0); @@ -410,7 +410,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) dtw->cms_adjust = sp_button_new_from_data( Inkscape::ICON_SIZE_DECORATION, SP_BUTTON_TYPE_TOGGLE, NULL, - INKSCAPE_ICON_COLOR_MANAGEMENT, + INKSCAPE_ICON("color-management"), tip ); #if ENABLE_LCMS { @@ -631,9 +631,7 @@ SPDesktopWidget::updateTitle(gchar const* uri) Gtk::Window *window = (Gtk::Window*)g_object_get_data(G_OBJECT(this), "window"); if (window) { - gchar const *fname = ( TRUE - ? uri - : g_basename(uri) ); + gchar const *fname = uri; GString *name = g_string_new (""); gchar const *grayscalename = "(grayscale) "; @@ -1558,12 +1556,12 @@ void SPDesktopWidget::namedviewModified(SPObject *obj, guint flags) /* 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 + * 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)) { @@ -1571,7 +1569,7 @@ void SPDesktopWidget::namedviewModified(SPObject *obj, guint flags) 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) { + for (GList *j = grch; j != NULL; j = j->next) { if (!GTK_IS_WIDGET(j->data)) // wasn't a widget continue; diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp index 6d4f6fae0..9fe875d28 100644 --- a/src/widgets/gradient-toolbar.cpp +++ b/src/widgets/gradient-toolbar.cpp @@ -552,7 +552,7 @@ sp_gradient_toolbox_new(SPDesktop *desktop) GtkWidget *button = sp_button_new_from_data( Inkscape::ICON_SIZE_DECORATION, SP_BUTTON_TYPE_TOGGLE, NULL, - INKSCAPE_ICON_PAINT_GRADIENT_LINEAR, + INKSCAPE_ICON("paint-gradient-linear"), _("Create linear gradient") ); g_signal_connect_after (G_OBJECT (button), "clicked", G_CALLBACK (gr_toggle_type), tbl); g_object_set_data(G_OBJECT(tbl), "linear", button); @@ -565,7 +565,7 @@ sp_gradient_toolbox_new(SPDesktop *desktop) GtkWidget *button = sp_button_new_from_data( Inkscape::ICON_SIZE_DECORATION, SP_BUTTON_TYPE_TOGGLE, NULL, - INKSCAPE_ICON_PAINT_GRADIENT_RADIAL, + INKSCAPE_ICON("paint-gradient-radial"), _("Create radial (elliptic or circular) gradient")); g_signal_connect_after (G_OBJECT (button), "clicked", G_CALLBACK (gr_toggle_type), tbl); g_object_set_data(G_OBJECT(tbl), "radial", button); @@ -592,7 +592,7 @@ sp_gradient_toolbox_new(SPDesktop *desktop) GtkWidget *button = sp_button_new_from_data( Inkscape::ICON_SIZE_DECORATION, SP_BUTTON_TYPE_TOGGLE, NULL, - INKSCAPE_ICON_OBJECT_FILL, + INKSCAPE_ICON("object-fill"), _("Create gradient in the fill")); g_signal_connect_after (G_OBJECT (button), "clicked", G_CALLBACK (gr_toggle_fillstroke), tbl); g_object_set_data(G_OBJECT(tbl), "fill", button); @@ -605,7 +605,7 @@ sp_gradient_toolbox_new(SPDesktop *desktop) GtkWidget *button = sp_button_new_from_data( Inkscape::ICON_SIZE_DECORATION, SP_BUTTON_TYPE_TOGGLE, NULL, - INKSCAPE_ICON_OBJECT_STROKE, + INKSCAPE_ICON("object-stroke"), _("Create gradient in the stroke")); g_signal_connect_after (G_OBJECT (button), "clicked", G_CALLBACK (gr_toggle_fillstroke), tbl); g_object_set_data(G_OBJECT(tbl), "stroke", button); diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index bb2029bcf..c6823e2d8 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -35,6 +35,7 @@ #include "display/nr-arena.h" #include "display/nr-arena-item.h" #include "io/sys.h" +#include "sp-root.h" #include "icon.h" @@ -1099,9 +1100,10 @@ sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root, if (doc) { SPObject *object = doc->getObjectById(name); if (object && SP_IS_ITEM(object)) { - /* Find bbox in document */ - Geom::Affine const i2doc(SP_ITEM(object)->i2doc_affine()); - Geom::OptRect dbox = SP_ITEM(object)->getBounds(i2doc); + SPItem *item = SP_ITEM(object); + // Find bbox in document + Geom::Affine const i2doc(item->i2doc_affine()); + Geom::OptRect dbox = item->getBounds(i2doc); if ( object->parent == NULL ) { @@ -1292,7 +1294,7 @@ guchar *IconImpl::load_svg_pixels(std::list<Glib::ustring> const &names, // fixme: Memory manage root if needed (Lauris) // This needs to be fixed indeed; this leads to a memory leak of a few megabytes these days // because shapes are being rendered which are not being freed - NRArenaItem *root = SP_ITEM(doc->getRoot())->invoke_show( arena, visionkey, SP_ITEM_SHOW_DISPLAY ); + NRArenaItem *root = doc->getRoot()->invoke_show( arena, visionkey, SP_ITEM_SHOW_DISPLAY ); // store into the cache info = new SVGDocCache(doc, root); diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp index 9f2a30e32..259aa5f25 100644 --- a/src/widgets/paint-selector.cpp +++ b/src/widgets/paint-selector.cpp @@ -221,19 +221,19 @@ sp_paint_selector_init(SPPaintSelector *psel) gtk_box_pack_start(GTK_BOX(psel), psel->style, FALSE, FALSE, 0); /* Buttons */ - psel->none = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON_PAINT_NONE, + psel->none = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON("paint-none"), SPPaintSelector::MODE_NONE, _("No paint")); - psel->solid = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON_PAINT_SOLID, + psel->solid = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON("paint-solid"), SPPaintSelector::MODE_COLOR_RGB, _("Flat color")); - psel->gradient = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON_PAINT_GRADIENT_LINEAR, + psel->gradient = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON("paint-gradient-linear"), SPPaintSelector::MODE_GRADIENT_LINEAR, _("Linear gradient")); - psel->radial = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON_PAINT_GRADIENT_RADIAL, + psel->radial = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON("paint-gradient-radial"), SPPaintSelector::MODE_GRADIENT_RADIAL, _("Radial gradient")); - psel->pattern = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON_PAINT_PATTERN, + psel->pattern = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON("paint-pattern"), SPPaintSelector::MODE_PATTERN, _("Pattern")); - psel->swatch = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON_PAINT_SWATCH, + psel->swatch = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON("paint-swatch"), SPPaintSelector::MODE_SWATCH, _("Swatch")); - psel->unset = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON_PAINT_UNKNOWN, + psel->unset = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON("paint-unknown"), SPPaintSelector::MODE_UNSET, _("Unset paint (make it undefined so it can be inherited)")); /* Fillrule */ @@ -248,7 +248,7 @@ sp_paint_selector_init(SPPaintSelector *psel) // TRANSLATORS: for info, see http://www.w3.org/TR/2000/CR-SVG-20000802/painting.html#FillRuleProperty gtk_widget_set_tooltip_text(psel->evenodd, _("Any path self-intersections or subpaths create holes in the fill (fill-rule: evenodd)")); g_object_set_data(G_OBJECT(psel->evenodd), "mode", GUINT_TO_POINTER(SPPaintSelector::FILLRULE_EVENODD)); - w = sp_icon_new(Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON_FILL_RULE_EVEN_ODD); + w = sp_icon_new(Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON("fill-rule-even-odd")); gtk_container_add(GTK_CONTAINER(psel->evenodd), w); gtk_box_pack_start(GTK_BOX(psel->fillrulebox), psel->evenodd, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(psel->evenodd), "toggled", G_CALLBACK(sp_paint_selector_fillrule_toggled), psel); @@ -259,7 +259,7 @@ sp_paint_selector_init(SPPaintSelector *psel) // TRANSLATORS: for info, see http://www.w3.org/TR/2000/CR-SVG-20000802/painting.html#FillRuleProperty gtk_widget_set_tooltip_text(psel->nonzero, _("Fill is solid unless a subpath is counterdirectional (fill-rule: nonzero)")); g_object_set_data(G_OBJECT(psel->nonzero), "mode", GUINT_TO_POINTER(SPPaintSelector::FILLRULE_NONZERO)); - w = sp_icon_new(Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON_FILL_RULE_NONZERO); + w = sp_icon_new(Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON("fill-rule-nonzero")); gtk_container_add(GTK_CONTAINER(psel->nonzero), w); gtk_box_pack_start(GTK_BOX(psel->fillrulebox), psel->nonzero, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(psel->nonzero), "toggled", G_CALLBACK(sp_paint_selector_fillrule_toggled), psel); diff --git a/src/widgets/ruler.cpp b/src/widgets/ruler.cpp index 60e460cda..7baa0a172 100644 --- a/src/widgets/ruler.cpp +++ b/src/widgets/ruler.cpp @@ -1,5 +1,3 @@ -#define __SP_RULER_C__ - /* * Customized ruler class for inkscape * @@ -8,8 +6,9 @@ * Frank Felfe <innerspace@iname.com> * bulia byak <buliabyak@users.sf.net> * Diederik van Lierop <mail@diedenrezi.nl> + * Jon A. Cruz <jon@joncruz.org> * - * Copyright (C) 1999-2008 authors + * Copyright (C) 1999-2011 authors * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -377,26 +376,19 @@ sp_ruler_common_draw_ticks (GtkRuler *ruler) } } -//TODO: warning: deprecated conversion from string constant to âgchar*â -// -//Turn out to be warnings that we should probably leave in place. The -// pointers/types used need to be read-only. So until we correct the using -// code, those warnings are actually desired. They say "Hey! Fix this". We -// definitely don't want to hide/ignore them. --JonCruz - -// TODO address const/non-const gchar* issue: +// Note: const casts are due to GtkRuler being const-broken and not scheduled for any more fixes. /// Ruler metrics. static GtkRulerMetric const sp_ruler_metrics[] = { // NOTE: the order of records in this struct must correspond to the SPMetric enum. - {"NONE", "", 1, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, - {"millimeters", "mm", PX_PER_MM, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, - {"centimeters", "cm", PX_PER_CM, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, - {"inches", "in", PX_PER_IN, { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 }, { 1, 2, 4, 8, 16 }}, - {"feet", "ft", PX_PER_FT, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, - {"points", "pt", PX_PER_PT, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, - {"picas", "pc", PX_PER_PC, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, - {"pixels", "px", PX_PER_PX, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, - {"meters", "m", PX_PER_M, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, + {const_cast<gchar*>("NONE"), const_cast<gchar*>(""), 1, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, + {const_cast<gchar*>("millimeters"), const_cast<gchar*>("mm"), PX_PER_MM, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, + {const_cast<gchar*>("centimeters"), const_cast<gchar*>("cm"), PX_PER_CM, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, + {const_cast<gchar*>("inches"), const_cast<gchar*>("in"), PX_PER_IN, { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 }, { 1, 2, 4, 8, 16 }}, + {const_cast<gchar*>("feet"), const_cast<gchar*>("ft"), PX_PER_FT, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, + {const_cast<gchar*>("points"), const_cast<gchar*>("pt"), PX_PER_PT, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, + {const_cast<gchar*>("picas"), const_cast<gchar*>("pc"), PX_PER_PC, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, + {const_cast<gchar*>("pixels"), const_cast<gchar*>("px"), PX_PER_PX, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, + {const_cast<gchar*>("meters"), const_cast<gchar*>("m"), PX_PER_M, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, }; void diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp index ba32dc321..260c09c69 100644 --- a/src/widgets/select-toolbar.cpp +++ b/src/widgets/select-toolbar.cpp @@ -378,9 +378,9 @@ static void toggle_pattern( GtkToggleAction* act, gpointer data ) static void toggle_lock( GtkToggleAction *act, gpointer /*data*/ ) { gboolean active = gtk_toggle_action_get_active( act ); if ( active ) { - g_object_set( G_OBJECT(act), "iconId", INKSCAPE_ICON_OBJECT_LOCKED, NULL ); + g_object_set( G_OBJECT(act), "iconId", INKSCAPE_ICON("object-locked"), NULL ); } else { - g_object_set( G_OBJECT(act), "iconId", INKSCAPE_ICON_OBJECT_UNLOCKED, NULL ); + g_object_set( G_OBJECT(act), "iconId", INKSCAPE_ICON("object-unlocked"), NULL ); } } @@ -507,7 +507,7 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb InkToggleAction* itact = ink_toggle_action_new( "LockAction", _("Lock width and height"), _("When locked, change both width and height by the same proportion"), - INKSCAPE_ICON_OBJECT_UNLOCKED, + INKSCAPE_ICON("object-unlocked"), Inkscape::ICON_SIZE_DECORATION ); g_object_set( itact, "short_label", "Lock", NULL ); g_object_set_data( G_OBJECT(spw), "lock", itact ); @@ -554,7 +554,7 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb // "Transform with object" buttons { - EgeOutputAction* act = ege_output_action_new( "transform_affect_label", _("Affect:"), _("Control whether or not to scale stroke widths, scale rectangle corners, transform gradient fills, and transform pattern fills with the object"), 0 ); + EgeOutputAction* act = ege_output_action_new( "transform_affect_label", _("Affect:"), _("Control whether or not to scale stroke widths, scale rectangle corners, transform gradient fills, and transform pattern fills with the object"), 0 ); ege_output_action_set_use_markup( act, TRUE ); g_object_set( act, "visible-overflown", FALSE, NULL ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); @@ -564,7 +564,7 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb InkToggleAction* itact = ink_toggle_action_new( "transform_stroke", _("Scale stroke width"), _("When scaling objects, scale the stroke width by the same proportion"), - INKSCAPE_ICON_TRANSFORM_AFFECT_STROKE, + INKSCAPE_ICON("transform-affect-stroke"), Inkscape::ICON_SIZE_DECORATION ); gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), prefs->getBool("/options/transform/stroke", true) ); g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(toggle_stroke), desktop) ; @@ -575,7 +575,7 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb InkToggleAction* itact = ink_toggle_action_new( "transform_corners", _("Scale rounded corners"), _("When scaling rectangles, scale the radii of rounded corners"), - INKSCAPE_ICON_TRANSFORM_AFFECT_ROUNDED_CORNERS, + INKSCAPE_ICON("transform-affect-rounded-corners"), Inkscape::ICON_SIZE_DECORATION ); gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), prefs->getBool("/options/transform/rectcorners", true) ); g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(toggle_corners), desktop) ; @@ -586,7 +586,7 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb InkToggleAction* itact = ink_toggle_action_new( "transform_gradient", _("Move gradients"), _("Move gradients (in fill or stroke) along with the objects"), - INKSCAPE_ICON_TRANSFORM_AFFECT_GRADIENT, + INKSCAPE_ICON("transform-affect-gradient"), Inkscape::ICON_SIZE_DECORATION ); gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), prefs->getBool("/options/transform/gradient", true) ); g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(toggle_gradient), desktop) ; @@ -597,7 +597,7 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb InkToggleAction* itact = ink_toggle_action_new( "transform_pattern", _("Move patterns"), _("Move patterns (in fill or stroke) along with the objects"), - INKSCAPE_ICON_TRANSFORM_AFFECT_PATTERN, + INKSCAPE_ICON("transform-affect-pattern"), Inkscape::ICON_SIZE_DECORATION ); gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), prefs->getBool("/options/transform/pattern", true) ); g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(toggle_pattern), desktop) ; diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index 9da39bac4..8b5582163 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -157,8 +157,9 @@ sp_marker_prev_new(unsigned psize, gchar const *mname, { // Retrieve the marker named 'mname' from the source SVG document SPObject const *marker = source->getObjectById(mname); - if (marker == NULL) + if (marker == NULL) { return NULL; + } // Create a copy repr of the marker with id="sample" Inkscape::XML::Document *xml_doc = sandbox->getReprDoc(); @@ -168,8 +169,9 @@ sp_marker_prev_new(unsigned psize, gchar const *mname, // Replace the old sample in the sandbox by the new one Inkscape::XML::Node *defsrepr = sandbox->getObjectById("defs")->getRepr(); SPObject *oldmarker = sandbox->getObjectById("sample"); - if (oldmarker) + if (oldmarker) { oldmarker->deleteObject(false); + } defsrepr->appendChild(mrepr); Inkscape::GC::release(mrepr); @@ -183,12 +185,14 @@ sp_marker_prev_new(unsigned psize, gchar const *mname, sandbox->getRoot()->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); sandbox->ensureUpToDate(); - if (object == NULL || !SP_IS_ITEM(object)) + if (object == NULL || !SP_IS_ITEM(object)) { return NULL; // sandbox broken? + } + SPItem *item = SP_ITEM(object); // Find object's bbox in document - Geom::Affine const i2doc(SP_ITEM(object)->i2doc_affine()); - Geom::OptRect dbox = SP_ITEM(object)->getBounds(i2doc); + Geom::Affine const i2doc(item->i2doc_affine()); + Geom::OptRect dbox = item->getBounds(i2doc); if (!dbox) { return NULL; @@ -246,7 +250,7 @@ sp_marker_menu_build (Gtk::Menu *m, GSList *marker_list, SPDocument *source, SPD // Do this here, outside of loop, to speed up preview generation: NRArena const *arena = NRArena::create(); unsigned const visionkey = SPItem::display_key_new(1); - NRArenaItem *root = SP_ITEM(sandbox->getRoot())->invoke_show((NRArena *) arena, visionkey, SP_ITEM_SHOW_DISPLAY); + NRArenaItem *root = sandbox->getRoot()->invoke_show((NRArena *) arena, visionkey, SP_ITEM_SHOW_DISPLAY); for (; marker_list != NULL; marker_list = marker_list->next) { Inkscape::XML::Node *repr = reinterpret_cast<SPItem *>(marker_list->data)->getRepr(); @@ -284,7 +288,7 @@ sp_marker_menu_build (Gtk::Menu *m, GSList *marker_list, SPDocument *source, SPD m->append(*i); } - SP_ITEM(sandbox->getRoot())->invoke_hide(visionkey); + sandbox->getRoot()->invoke_hide(visionkey); nr_object_unref((NRObject *) arena); } @@ -721,7 +725,7 @@ sp_stroke_style_line_widget_new(void) tb = NULL; - tb = sp_stroke_radio_button(tb, INKSCAPE_ICON_STROKE_JOIN_MITER, + tb = sp_stroke_radio_button(tb, INKSCAPE_ICON("stroke-join-miter"), hb, spw, "join", "miter"); // TRANSLATORS: Miter join: joining lines with a sharp (pointed) corner. @@ -730,7 +734,7 @@ sp_stroke_style_line_widget_new(void) tt->set_tip(*tb, _("Miter join")); spw->set_data("miter join", tb); - tb = sp_stroke_radio_button(tb, INKSCAPE_ICON_STROKE_JOIN_ROUND, + tb = sp_stroke_radio_button(tb, INKSCAPE_ICON("stroke-join-round"), hb, spw, "join", "round"); @@ -740,7 +744,7 @@ sp_stroke_style_line_widget_new(void) tt->set_tip(*tb, _("Round join")); spw->set_data("round join", tb); - tb = sp_stroke_radio_button(tb, INKSCAPE_ICON_STROKE_JOIN_BEVEL, + tb = sp_stroke_radio_button(tb, INKSCAPE_ICON("stroke-join-bevel"), hb, spw, "join", "bevel"); @@ -787,7 +791,7 @@ sp_stroke_style_line_widget_new(void) tb = NULL; - tb = sp_stroke_radio_button(tb, INKSCAPE_ICON_STROKE_CAP_BUTT, + tb = sp_stroke_radio_button(tb, INKSCAPE_ICON("stroke-cap-butt"), hb, spw, "cap", "butt"); spw->set_data("cap butt", tb); @@ -795,7 +799,7 @@ sp_stroke_style_line_widget_new(void) // of the line; the ends of the line are square tt->set_tip(*tb, _("Butt cap")); - tb = sp_stroke_radio_button(tb, INKSCAPE_ICON_STROKE_CAP_ROUND, + tb = sp_stroke_radio_button(tb, INKSCAPE_ICON("stroke-cap-round"), hb, spw, "cap", "round"); spw->set_data("cap round", tb); @@ -803,7 +807,7 @@ sp_stroke_style_line_widget_new(void) // line; the ends of the line are rounded tt->set_tip(*tb, _("Round cap")); - tb = sp_stroke_radio_button(tb, INKSCAPE_ICON_STROKE_CAP_SQUARE, + tb = sp_stroke_radio_button(tb, INKSCAPE_ICON("stroke-cap-square"), hb, spw, "cap", "square"); spw->set_data("cap square", tb); @@ -949,13 +953,13 @@ sp_jointype_set (Gtk::Container *spw, unsigned const jointype) Gtk::RadioButton *tb = NULL; switch (jointype) { case SP_STROKE_LINEJOIN_MITER: - tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON_STROKE_JOIN_MITER)); + tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON("stroke-join-miter"))); break; case SP_STROKE_LINEJOIN_ROUND: - tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON_STROKE_JOIN_ROUND)); + tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON("stroke-join-round"))); break; case SP_STROKE_LINEJOIN_BEVEL: - tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON_STROKE_JOIN_BEVEL)); + tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON("stroke-join-bevel"))); break; default: break; @@ -972,13 +976,13 @@ sp_captype_set (Gtk::Container *spw, unsigned const captype) Gtk::RadioButton *tb = NULL; switch (captype) { case SP_STROKE_LINECAP_BUTT: - tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON_STROKE_CAP_BUTT)); + tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON("stroke-cap-butt"))); break; case SP_STROKE_LINECAP_ROUND: - tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON_STROKE_CAP_ROUND)); + tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON("stroke-cap-round"))); break; case SP_STROKE_LINECAP_SQUARE: - tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON_STROKE_CAP_SQUARE)); + tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON("stroke-cap-square"))); break; default: break; @@ -1325,16 +1329,16 @@ sp_stroke_style_set_join_buttons(Gtk::Container *spw, Gtk::ToggleButton *active) { Gtk::RadioButton *tb; - tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON_STROKE_JOIN_MITER)); + tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON("stroke-join-miter"))); tb->set_active(active == tb); Gtk::SpinButton *ml = static_cast<Gtk::SpinButton *>(spw->get_data("miterlimit_sb")); ml->set_sensitive(active == tb); - tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON_STROKE_JOIN_ROUND)); + tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON("stroke-join-round"))); tb->set_active(active == tb); - tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON_STROKE_JOIN_BEVEL)); + tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON("stroke-join-bevel"))); tb->set_active(active == tb); } @@ -1346,11 +1350,11 @@ sp_stroke_style_set_cap_buttons(Gtk::Container *spw, Gtk::ToggleButton *active) { Gtk::RadioButton *tb; - tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON_STROKE_CAP_BUTT)); + tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON("stroke-cap-butt"))); tb->set_active(active == tb); - tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON_STROKE_CAP_ROUND)); + tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON("stroke-cap-round"))); tb->set_active(active == tb); - tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON_STROKE_CAP_SQUARE)); + tb = static_cast<Gtk::RadioButton *>(spw->get_data(INKSCAPE_ICON("stroke-cap-square"))); tb->set_active(active == tb); } diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 3c1196e96..ea1811b92 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -1369,7 +1369,7 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions InkAction* inky = ink_action_new( "NodeInsertAction", _("Insert node"), _("Insert new nodes into selected segments"), - INKSCAPE_ICON_NODE_ADD, + INKSCAPE_ICON("node-add"), secondarySize ); g_object_set( inky, "short_label", _("Insert"), NULL ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_add), 0 ); @@ -1380,7 +1380,7 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions InkAction* inky = ink_action_new( "NodeDeleteAction", _("Delete node"), _("Delete selected nodes"), - INKSCAPE_ICON_NODE_DELETE, + INKSCAPE_ICON("node-delete"), secondarySize ); g_object_set( inky, "short_label", _("Delete"), NULL ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_delete), 0 ); @@ -1391,7 +1391,7 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions InkAction* inky = ink_action_new( "NodeJoinAction", _("Join nodes"), _("Join selected nodes"), - INKSCAPE_ICON_NODE_JOIN, + INKSCAPE_ICON("node-join"), secondarySize ); g_object_set( inky, "short_label", _("Join"), NULL ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_join), 0 ); @@ -1402,7 +1402,7 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions InkAction* inky = ink_action_new( "NodeBreakAction", _("Break nodes"), _("Break path at selected nodes"), - INKSCAPE_ICON_NODE_BREAK, + INKSCAPE_ICON("node-break"), secondarySize ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_break), 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); @@ -1413,7 +1413,7 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions InkAction* inky = ink_action_new( "NodeJoinSegmentAction", _("Join with segment"), _("Join selected endnodes with a new segment"), - INKSCAPE_ICON_NODE_JOIN_SEGMENT, + INKSCAPE_ICON("node-join-segment"), secondarySize ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_join_segment), 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); @@ -1423,7 +1423,7 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions InkAction* inky = ink_action_new( "NodeDeleteSegmentAction", _("Delete segment"), _("Delete segment between two non-endpoint nodes"), - INKSCAPE_ICON_NODE_DELETE_SEGMENT, + INKSCAPE_ICON("node-delete-segment"), secondarySize ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_delete_segment), 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); @@ -1433,7 +1433,7 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions InkAction* inky = ink_action_new( "NodeCuspAction", _("Node Cusp"), _("Make selected nodes corner"), - INKSCAPE_ICON_NODE_TYPE_CUSP, + INKSCAPE_ICON("node-type-cusp"), secondarySize ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_cusp), 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); @@ -1443,7 +1443,7 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions InkAction* inky = ink_action_new( "NodeSmoothAction", _("Node Smooth"), _("Make selected nodes smooth"), - INKSCAPE_ICON_NODE_TYPE_SMOOTH, + INKSCAPE_ICON("node-type-smooth"), secondarySize ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_smooth), 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); @@ -1453,7 +1453,7 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions InkAction* inky = ink_action_new( "NodeSymmetricAction", _("Node Symmetric"), _("Make selected nodes symmetric"), - INKSCAPE_ICON_NODE_TYPE_SYMMETRIC, + INKSCAPE_ICON("node-type-symmetric"), secondarySize ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_symmetrical), 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); @@ -1463,7 +1463,7 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions InkAction* inky = ink_action_new( "NodeAutoAction", _("Node Auto"), _("Make selected nodes auto-smooth"), - INKSCAPE_ICON_NODE_TYPE_AUTO_SMOOTH, + INKSCAPE_ICON("node-type-auto-smooth"), secondarySize ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_auto), 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); @@ -1473,7 +1473,7 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions InkAction* inky = ink_action_new( "NodeLineAction", _("Node Line"), _("Make selected segments lines"), - INKSCAPE_ICON_NODE_SEGMENT_LINE, + INKSCAPE_ICON("node-segment-line"), secondarySize ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_toline), 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); @@ -1483,7 +1483,7 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions InkAction* inky = ink_action_new( "NodeCurveAction", _("Node Curve"), _("Make selected segments curves"), - INKSCAPE_ICON_NODE_SEGMENT_CURVE, + INKSCAPE_ICON("node-segment-curve"), secondarySize ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_tocurve), 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); @@ -1504,7 +1504,7 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions InkToggleAction* act = ink_toggle_action_new( "NodesShowHandlesAction", _("Show Handles"), _("Show Bezier handles of selected nodes"), - INKSCAPE_ICON_SHOW_NODE_HANDLES, + INKSCAPE_ICON("show-node-handles"), secondarySize ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/nodes/show_handles"); @@ -1515,7 +1515,7 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions InkToggleAction* act = ink_toggle_action_new( "NodesShowHelperpath", _("Show Outline"), _("Show path outline (without path effects)"), - INKSCAPE_ICON_SHOW_PATH_OUTLINE, + INKSCAPE_ICON("show-path-outline"), secondarySize ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/nodes/show_outline"); @@ -1527,7 +1527,7 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions InkAction* inky = ink_action_new( verb->get_id(), verb->get_name(), verb->get_tip(), - INKSCAPE_ICON_PATH_EFFECT_PARAMETER_NEXT, + INKSCAPE_ICON("path-effect-parameter-next"), secondarySize ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_nextLPEparam), desktop ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); @@ -1538,7 +1538,7 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions InkToggleAction* inky = ink_toggle_action_new( "ObjectEditClipPathAction", _("Edit clipping paths"), _("Show clipping path(s) of selected object(s)"), - INKSCAPE_ICON_PATH_CLIP_EDIT, + INKSCAPE_ICON("path-clip-edit"), secondarySize ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(inky), "/tools/nodes/edit_clipping_paths"); @@ -1549,7 +1549,7 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions InkToggleAction* inky = ink_toggle_action_new( "ObjectEditMaskPathAction", _("Edit masks"), _("Show mask(s) of selected object(s)"), - INKSCAPE_ICON_PATH_MASK_EDIT, + INKSCAPE_ICON("path-mask-edit"), secondarySize ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(inky), "/tools/nodes/edit_masks"); @@ -1677,7 +1677,7 @@ static void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainAct // units label { - EgeOutputAction* act = ege_output_action_new( "measure_units_label", _("Units:"), _("The units to be used for the measurements"), 0 ); + EgeOutputAction* act = ege_output_action_new( "measure_units_label", _("Units:"), _("The units to be used for the measurements"), 0 ); ege_output_action_set_use_markup( act, TRUE ); g_object_set( act, "visible-overflown", FALSE, NULL ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); @@ -2274,7 +2274,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) // 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, + 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 ) ); @@ -2283,7 +2283,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { InkToggleAction* act = ink_toggle_action_new("ToggleSnapFromBBoxCorner", - _("Bounding box"), _("Snap bounding box corners"), INKSCAPE_ICON_SNAP_BOUNDING_BOX, + _("Bounding box"), _("Snap bounding box corners"), INKSCAPE_ICON("snap-bounding-box"), secondarySize, SP_ATTR_INKSCAPE_SNAP_BBOX); gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) ); @@ -2293,7 +2293,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { InkToggleAction* act = ink_toggle_action_new("ToggleSnapToBBoxPath", _("Bounding box edges"), _("Snap to edges of a bounding box"), - INKSCAPE_ICON_SNAP_BOUNDING_BOX_EDGES, secondarySize, SP_ATTR_INKSCAPE_BBOX_PATHS); + INKSCAPE_ICON("snap-bounding-box-edges"), secondarySize, SP_ATTR_INKSCAPE_BBOX_PATHS); gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) ); g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_snap_callback), toolbox ); @@ -2302,7 +2302,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { InkToggleAction* act = ink_toggle_action_new("ToggleSnapToBBoxNode", _("Bounding box corners"), _("Snap to bounding box corners"), - INKSCAPE_ICON_SNAP_BOUNDING_BOX_CORNERS, secondarySize, SP_ATTR_INKSCAPE_BBOX_NODES); + INKSCAPE_ICON("snap-bounding-box-corners"), secondarySize, SP_ATTR_INKSCAPE_BBOX_NODES); gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) ); g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_snap_callback), toolbox ); @@ -2311,7 +2311,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { InkToggleAction* act = ink_toggle_action_new("ToggleSnapToFromBBoxEdgeMidpoints", _("BBox Edge Midpoints"), _("Snap from and to midpoints of bounding box edges"), - INKSCAPE_ICON_SNAP_BOUNDING_BOX_MIDPOINTS, secondarySize, + INKSCAPE_ICON("snap-bounding-box-midpoints"), secondarySize, SP_ATTR_INKSCAPE_SNAP_BBOX_EDGE_MIDPOINTS); gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) ); @@ -2321,7 +2321,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { InkToggleAction* act = ink_toggle_action_new("ToggleSnapToFromBBoxCenters", _("BBox Centers"), _("Snapping from and to centers of bounding boxes"), - INKSCAPE_ICON_SNAP_BOUNDING_BOX_CENTER, secondarySize, SP_ATTR_INKSCAPE_SNAP_BBOX_MIDPOINTS); + INKSCAPE_ICON("snap-bounding-box-center"), secondarySize, SP_ATTR_INKSCAPE_SNAP_BBOX_MIDPOINTS); gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) ); g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_snap_callback), toolbox ); @@ -2329,7 +2329,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { InkToggleAction* act = ink_toggle_action_new("ToggleSnapFromNode", - _("Nodes"), _("Snap nodes or handles"), INKSCAPE_ICON_SNAP_NODES, secondarySize, SP_ATTR_INKSCAPE_SNAP_NODES); + _("Nodes"), _("Snap nodes or handles"), INKSCAPE_ICON("snap-nodes"), secondarySize, SP_ATTR_INKSCAPE_SNAP_NODES); gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) ); g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_snap_callback), toolbox ); @@ -2337,7 +2337,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { InkToggleAction* act = ink_toggle_action_new("ToggleSnapToItemPath", - _("Paths"), _("Snap to paths"), INKSCAPE_ICON_SNAP_NODES_PATH, secondarySize, + _("Paths"), _("Snap to paths"), INKSCAPE_ICON("snap-nodes-path"), secondarySize, SP_ATTR_INKSCAPE_OBJECT_PATHS); gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) ); @@ -2347,7 +2347,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { InkToggleAction* act = ink_toggle_action_new("ToggleSnapToPathIntersections", _("Path intersections"), _("Snap to path intersections"), - INKSCAPE_ICON_SNAP_NODES_INTERSECTION, secondarySize, SP_ATTR_INKSCAPE_SNAP_INTERS_PATHS); + INKSCAPE_ICON("snap-nodes-intersection"), secondarySize, SP_ATTR_INKSCAPE_SNAP_INTERS_PATHS); gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) ); g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_snap_callback), toolbox ); @@ -2355,7 +2355,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { InkToggleAction* act = ink_toggle_action_new("ToggleSnapToItemNode", - _("To nodes"), _("Snap to cusp nodes"), INKSCAPE_ICON_SNAP_NODES_CUSP, secondarySize, + _("To nodes"), _("Snap to cusp nodes"), INKSCAPE_ICON("snap-nodes-cusp"), secondarySize, SP_ATTR_INKSCAPE_OBJECT_NODES); gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) ); @@ -2364,7 +2364,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { InkToggleAction* act = ink_toggle_action_new("ToggleSnapToSmoothNodes", - _("Smooth nodes"), _("Snap to smooth nodes"), INKSCAPE_ICON_SNAP_NODES_SMOOTH, + _("Smooth nodes"), _("Snap to smooth nodes"), INKSCAPE_ICON("snap-nodes-smooth"), secondarySize, SP_ATTR_INKSCAPE_SNAP_SMOOTH_NODES); gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) ); @@ -2374,7 +2374,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { InkToggleAction* act = ink_toggle_action_new("ToggleSnapToFromLineMidpoints", _("Line Midpoints"), _("Snap from and to midpoints of line segments"), - INKSCAPE_ICON_SNAP_NODES_MIDPOINT, secondarySize, SP_ATTR_INKSCAPE_SNAP_LINE_MIDPOINTS); + INKSCAPE_ICON("snap-nodes-midpoint"), secondarySize, SP_ATTR_INKSCAPE_SNAP_LINE_MIDPOINTS); gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) ); g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_snap_callback), toolbox ); @@ -2382,7 +2382,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { InkToggleAction* act = ink_toggle_action_new("ToggleSnapFromOthers", - _("Others"), _("Snap other points (centers, guide origins, gradient handles, etc.)"), INKSCAPE_ICON_SNAP_OTHERS, secondarySize, SP_ATTR_INKSCAPE_SNAP_OTHERS); + _("Others"), _("Snap other points (centers, guide origins, gradient handles, etc.)"), INKSCAPE_ICON("snap-others"), secondarySize, SP_ATTR_INKSCAPE_SNAP_OTHERS); gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) ); g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_snap_callback), toolbox ); @@ -2391,7 +2391,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { InkToggleAction* act = ink_toggle_action_new("ToggleSnapToFromObjectCenters", _("Object Centers"), _("Snap from and to centers of objects"), - INKSCAPE_ICON_SNAP_NODES_CENTER, secondarySize, SP_ATTR_INKSCAPE_SNAP_OBJECT_MIDPOINTS); + INKSCAPE_ICON("snap-nodes-center"), secondarySize, SP_ATTR_INKSCAPE_SNAP_OBJECT_MIDPOINTS); gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) ); g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_snap_callback), toolbox ); @@ -2400,7 +2400,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { InkToggleAction* act = ink_toggle_action_new("ToggleSnapToFromRotationCenter", _("Rotation Centers"), _("Snap from and to an item's rotation center"), - INKSCAPE_ICON_SNAP_NODES_ROTATION_CENTER, secondarySize, SP_ATTR_INKSCAPE_SNAP_CENTER); + INKSCAPE_ICON("snap-nodes-rotation-center"), secondarySize, SP_ATTR_INKSCAPE_SNAP_CENTER); gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) ); g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_snap_callback), toolbox ); @@ -2409,7 +2409,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { InkToggleAction* act = ink_toggle_action_new("ToggleSnapToFromTextBaseline", _("Text baseline"), _("Snap from and to text anchors and baselines"), - INKSCAPE_ICON_SNAP_TEXT_BASELINE, secondarySize, SP_ATTR_INKSCAPE_SNAP_TEXT_BASELINE); + INKSCAPE_ICON("snap-text-baseline"), secondarySize, SP_ATTR_INKSCAPE_SNAP_TEXT_BASELINE); gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) ); g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_snap_callback), toolbox ); @@ -2418,7 +2418,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { InkToggleAction* act = ink_toggle_action_new("ToggleSnapToPageBorder", - _("Page border"), _("Snap to the page border"), INKSCAPE_ICON_SNAP_PAGE, + _("Page border"), _("Snap to the page border"), INKSCAPE_ICON("snap-page"), secondarySize, SP_ATTR_INKSCAPE_SNAP_PAGE); gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) ); @@ -2427,7 +2427,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { InkToggleAction* act = ink_toggle_action_new("ToggleSnapToGrids", - _("Grids"), _("Snap to grids"), INKSCAPE_ICON_GRID_RECTANGULAR, secondarySize, + _("Grids"), _("Snap to grids"), INKSCAPE_ICON("grid-rectangular"), secondarySize, SP_ATTR_INKSCAPE_SNAP_GRIDS); gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) ); @@ -2436,7 +2436,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { InkToggleAction* act = ink_toggle_action_new("ToggleSnapToGuides", - _("Guides"), _("Snap to guides"), INKSCAPE_ICON_GUIDES, secondarySize, + _("Guides"), _("Snap to guides"), INKSCAPE_ICON("guides"), secondarySize, SP_ATTR_INKSCAPE_SNAP_TO_GUIDES); gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) ); @@ -2446,7 +2446,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) /*{ InkToggleAction* act = ink_toggle_action_new("ToggleSnapToGridGuideIntersections", _("Grid/guide intersections"), _("Snap to intersections of a grid with a guide"), - INKSCAPE_ICON_SNAP_GRID_GUIDE_INTERSECTIONS, secondarySize, + INKSCAPE_ICON("snap-grid-guide-intersections"), secondarySize, SP_ATTR_INKSCAPE_SNAP_INTERS_GRIDGUIDE); gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) ); @@ -2564,7 +2564,7 @@ void ToolboxFactory::updateSnapToolbox(SPDesktop *desktop, SPEventContext * /*ev gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act11->gobj()), nv->snap_manager.snapprefs.getIncludeItemCenter()); gtk_action_set_sensitive(GTK_ACTION(act11->gobj()), c1 && c5); gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act11b->gobj()), nv->snap_manager.snapprefs.getSnapTextBaseline()); - gtk_action_set_sensitive(GTK_ACTION(act11->gobj()), c1 && c5); + gtk_action_set_sensitive(GTK_ACTION(act11b->gobj()), c1 && c5); gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act12->gobj()), nv->snap_manager.snapprefs.getSnapToPageBorder()); gtk_action_set_sensitive(GTK_ACTION(act12->gobj()), c1); @@ -3014,14 +3014,14 @@ static void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions gtk_list_store_set( model, &iter, 0, _("Polygon"), 1, _("Regular polygon (with one handle) instead of a star"), - 2, INKSCAPE_ICON_DRAW_POLYGON, + 2, INKSCAPE_ICON("draw-polygon"), -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Star"), 1, _("Star instead of a regular polygon (with one handle)"), - 2, INKSCAPE_ICON_DRAW_STAR, + 2, INKSCAPE_ICON("draw-star"), -1 ); EgeSelectOneAction* act = ege_select_one_action_new( "FlatAction", (""), (""), NULL, GTK_TREE_MODEL(model) ); @@ -3444,7 +3444,7 @@ static void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions InkAction* inky = ink_action_new( "RectResetAction", _("Not rounded"), _("Make corners sharp"), - INKSCAPE_ICON_RECTANGLE_MAKE_CORNERS_SHARP, + INKSCAPE_ICON("rectangle-make-corners-sharp"), secondarySize ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_rtb_defaults), holder ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); @@ -3731,7 +3731,7 @@ static void box3d_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, // Translators: VP is short for 'vanishing point' _("State of VP in X direction"), _("Toggle VP in X direction between 'finite' and 'infinite' (=parallel)"), - INKSCAPE_ICON_PERSPECTIVE_PARALLEL, + INKSCAPE_ICON("perspective-parallel"), Inkscape::ICON_SIZE_DECORATION ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); g_object_set_data( holder, "box3d_vp_x_state_action", act ); @@ -3770,7 +3770,7 @@ static void box3d_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, // Translators: VP is short for 'vanishing point' _("State of VP in Y direction"), _("Toggle VP in Y direction between 'finite' and 'infinite' (=parallel)"), - INKSCAPE_ICON_PERSPECTIVE_PARALLEL, + INKSCAPE_ICON("perspective-parallel"), Inkscape::ICON_SIZE_DECORATION ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); g_object_set_data( holder, "box3d_vp_y_state_action", act ); @@ -3809,7 +3809,7 @@ static void box3d_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, // Translators: VP is short for 'vanishing point' _("State of VP in Z direction"), _("Toggle VP in Z direction between 'finite' and 'infinite' (=parallel)"), - INKSCAPE_ICON_PERSPECTIVE_PARALLEL, + INKSCAPE_ICON("perspective-parallel"), Inkscape::ICON_SIZE_DECORATION ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); g_object_set_data( holder, "box3d_vp_z_state_action", act ); @@ -4111,14 +4111,14 @@ static void sp_add_freehand_mode_toggle(GtkActionGroup* mainActions, GObject* ho gtk_list_store_set( model, &iter, 0, _("Bezier"), 1, _("Create regular Bezier path"), - 2, INKSCAPE_ICON_PATH_MODE_BEZIER, + 2, INKSCAPE_ICON("path-mode-bezier"), -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Spiro"), 1, _("Create Spiro path"), - 2, INKSCAPE_ICON_PATH_MODE_SPIRO, + 2, INKSCAPE_ICON("path-mode-spiro"), -1 ); if (!tool_is_pencil) { @@ -4126,14 +4126,14 @@ static void sp_add_freehand_mode_toggle(GtkActionGroup* mainActions, GObject* ho gtk_list_store_set( model, &iter, 0, _("Zigzag"), 1, _("Create a sequence of straight line segments"), - 2, INKSCAPE_ICON_PATH_MODE_POLYLINE, + 2, INKSCAPE_ICON("path-mode-polyline"), -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Paraxial"), 1, _("Create a sequence of paraxial line segments"), - 2, INKSCAPE_ICON_PATH_MODE_POLYLINE_PARAXIAL, + 2, INKSCAPE_ICON("path-mode-polyline-paraxial"), -1 ); } @@ -4429,91 +4429,91 @@ static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction gtk_list_store_set( model, &iter, 0, _("Move mode"), 1, _("Move objects in any direction"), - 2, INKSCAPE_ICON_OBJECT_TWEAK_PUSH, + 2, INKSCAPE_ICON("object-tweak-push"), -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Move in/out mode"), 1, _("Move objects towards cursor; with Shift from cursor"), - 2, INKSCAPE_ICON_OBJECT_TWEAK_ATTRACT, + 2, INKSCAPE_ICON("object-tweak-attract"), -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Move jitter mode"), 1, _("Move objects in random directions"), - 2, INKSCAPE_ICON_OBJECT_TWEAK_RANDOMIZE, + 2, INKSCAPE_ICON("object-tweak-randomize"), -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Scale mode"), 1, _("Shrink objects, with Shift enlarge"), - 2, INKSCAPE_ICON_OBJECT_TWEAK_SHRINK, + 2, INKSCAPE_ICON("object-tweak-shrink"), -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Rotate mode"), 1, _("Rotate objects, with Shift counterclockwise"), - 2, INKSCAPE_ICON_OBJECT_TWEAK_ROTATE, + 2, INKSCAPE_ICON("object-tweak-rotate"), -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Duplicate/delete mode"), 1, _("Duplicate objects, with Shift delete"), - 2, INKSCAPE_ICON_OBJECT_TWEAK_DUPLICATE, + 2, INKSCAPE_ICON("object-tweak-duplicate"), -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Push mode"), 1, _("Push parts of paths in any direction"), - 2, INKSCAPE_ICON_PATH_TWEAK_PUSH, + 2, INKSCAPE_ICON("path-tweak-push"), -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Shrink/grow mode"), 1, _("Shrink (inset) parts of paths; with Shift grow (outset)"), - 2, INKSCAPE_ICON_PATH_TWEAK_SHRINK, + 2, INKSCAPE_ICON("path-tweak-shrink"), -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Attract/repel mode"), 1, _("Attract parts of paths towards cursor; with Shift from cursor"), - 2, INKSCAPE_ICON_PATH_TWEAK_ATTRACT, + 2, INKSCAPE_ICON("path-tweak-attract"), -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Roughen mode"), 1, _("Roughen parts of paths"), - 2, INKSCAPE_ICON_PATH_TWEAK_ROUGHEN, + 2, INKSCAPE_ICON("path-tweak-roughen"), -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Color paint mode"), 1, _("Paint the tool's color upon selected objects"), - 2, INKSCAPE_ICON_OBJECT_TWEAK_PAINT, + 2, INKSCAPE_ICON("object-tweak-paint"), -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Color jitter mode"), 1, _("Jitter the colors of selected objects"), - 2, INKSCAPE_ICON_OBJECT_TWEAK_JITTER_COLOR, + 2, INKSCAPE_ICON("object-tweak-jitter-color"), -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Blur mode"), 1, _("Blur selected objects more; with Shift, blur less"), - 2, INKSCAPE_ICON_OBJECT_TWEAK_BLUR, + 2, INKSCAPE_ICON("object-tweak-blur"), -1 ); @@ -4638,7 +4638,7 @@ static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction InkToggleAction* act = ink_toggle_action_new( "TweakPressureAction", _("Pressure"), _("Use the pressure of the input device to alter the force of tweak action"), - INKSCAPE_ICON_DRAW_USE_PRESSURE, + INKSCAPE_ICON("draw-use-pressure"), Inkscape::ICON_SIZE_DECORATION ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_tweak_pressure_state_changed), NULL); @@ -4758,21 +4758,21 @@ static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction gtk_list_store_set( model, &iter, 0, _("Spray with copies"), 1, _("Spray copies of the initial selection"), - 2, INKSCAPE_ICON_SPRAY_COPY_MODE, + 2, INKSCAPE_ICON("spray-mode-copy"), -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Spray with clones"), 1, _("Spray clones of the initial selection"), - 2, INKSCAPE_ICON_SPRAY_CLONE_MODE, + 2, INKSCAPE_ICON("spray-mode-clone"), -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Spray single path"), 1, _("Spray objects in a single path"), - 2, INKSCAPE_ICON_SPRAY_UNION_MODE, + 2, INKSCAPE_ICON("spray-mode-union"), -1 ); EgeSelectOneAction* act = ege_select_one_action_new( "SprayModeAction", _("Mode"), (""), NULL, GTK_TREE_MODEL(model) ); @@ -4821,7 +4821,7 @@ static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction gtk_action_group_add_action( mainActions, GTK_ACTION(act) ); PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/spray/usepressure"); g_signal_connect(holder, "destroy", G_CALLBACK(delete_prefspusher), pusher); - + } { /* Rotation */ @@ -5338,7 +5338,7 @@ static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main InkToggleAction* act = ink_toggle_action_new( "TraceAction", _("Trace Background"), _("Trace the lightness of the background by the width of the pen (white - minimum width, black - maximum width)"), - INKSCAPE_ICON_DRAW_TRACE_BACKGROUND, + INKSCAPE_ICON("draw-trace-background"), Inkscape::ICON_SIZE_DECORATION ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/calligraphic/tracebackground", update_presets_list, holder); @@ -5351,7 +5351,7 @@ static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main InkToggleAction* act = ink_toggle_action_new( "PressureAction", _("Pressure"), _("Use the pressure of the input device to alter the width of the pen"), - INKSCAPE_ICON_DRAW_USE_PRESSURE, + INKSCAPE_ICON("draw-use-pressure"), Inkscape::ICON_SIZE_DECORATION ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/calligraphic/usepressure", update_presets_list, holder); @@ -5364,7 +5364,7 @@ static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main InkToggleAction* act = ink_toggle_action_new( "TiltAction", _("Tilt"), _("Use the tilt of the input device to alter the angle of the pen's nib"), - INKSCAPE_ICON_DRAW_USE_TILT, + INKSCAPE_ICON("draw-use-tilt"), Inkscape::ICON_SIZE_DECORATION ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/calligraphic/usetilt", update_presets_list, holder); @@ -5692,14 +5692,14 @@ static void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, gtk_list_store_set( model, &iter, 0, _("Closed arc"), 1, _("Switch to segment (closed shape with two radii)"), - 2, INKSCAPE_ICON_DRAW_ELLIPSE_SEGMENT, + 2, INKSCAPE_ICON("draw-ellipse-segment"), -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Open Arc"), 1, _("Switch to arc (unclosed shape)"), - 2, INKSCAPE_ICON_DRAW_ELLIPSE_ARC, + 2, INKSCAPE_ICON("draw-ellipse-arc"), -1 ); EgeSelectOneAction* act = ege_select_one_action_new( "ArcOpenAction", (""), (""), NULL, GTK_TREE_MODEL(model) ); @@ -5723,7 +5723,7 @@ static void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, InkAction* inky = ink_action_new( "ArcResetAction", _("Make whole"), _("Make the shape a whole ellipse, not arc or segment"), - INKSCAPE_ICON_DRAW_ELLIPSE_WHOLE, + INKSCAPE_ICON("draw-ellipse-whole"), secondarySize ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_arctb_defaults), holder ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); @@ -6230,21 +6230,21 @@ static void sp_eraser_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActio gtk_list_store_set( model, &iter, 0, _("Delete"), 1, _("Delete objects touched by the eraser"), - 2, INKSCAPE_ICON_DRAW_ERASER_DELETE_OBJECTS, + 2, INKSCAPE_ICON("draw-eraser-delete-objects"), -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Cut"), 1, _("Cut out from objects"), - 2, INKSCAPE_ICON_PATH_DIFFERENCE, + 2, INKSCAPE_ICON("path-difference"), -1 ); EgeSelectOneAction* act = ege_select_one_action_new( "EraserModeAction", (""), (""), NULL, GTK_TREE_MODEL(model) ); g_object_set( act, "short_label", _("Mode:"), NULL ); gtk_action_group_add_action( mainActions, GTK_ACTION(act) ); g_object_set_data( holder, "eraser_mode_action", act ); - + ege_select_one_action_set_appearance( act, "full" ); ege_select_one_action_set_radio_action_type( act, INK_RADIO_ACTION_TYPE ); g_object_set( G_OBJECT(act), "icon-property", "iconId", NULL ); @@ -6361,6 +6361,20 @@ static void cell_data_func(GtkCellLayout * /*cell_layout*/, } // Font family +// +// In most cases we should just be able to set the new family name +// but there may be cases where a font family doesn't follow the +// standard naming pattern. To handle those cases, we do a song and +// dance to use Pango to find the best match. To do that we start +// with the old "fontSpec" (which is the returned string from +// pango_font_description_to_string() with the size unset). This +// has the form "[family-list] [style-options]" where the +// family-list is a comma separated list of font-family names +// (optionally terminated by a comma). An example would be +// "DejaVu Sans, Sans Bold". Only a "fontSpec" containing a +// single font-family will work with Pango's best match routine. +// If we can't obtain a good "fontSpec", we then resort to blindly +// changing the font-family. static void sp_text_fontfamily_value_changed( Ink_ComboBoxEntry_Action *act, GObject *tbl ) { #ifdef DEBUG_TEXT @@ -6385,6 +6399,9 @@ static void sp_text_fontfamily_value_changed( Ink_ComboBoxEntry_Action *act, GOb int result_fontspec = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONT_SPECIFICATION); Glib::ustring fontSpec = query->text->font_specification.set ? query->text->font_specification.value : ""; +#ifdef DEBUG_TEXT + std::cout << " fontSpec from query :" << fontSpec << ":" << std::endl; +#endif // If that didn't work, try to get font spec from style if (fontSpec.empty()) { @@ -6400,90 +6417,90 @@ static void sp_text_fontfamily_value_changed( Ink_ComboBoxEntry_Action *act, GOb fontSpec = font_factory::Default()->ConstructFontSpecification(fontFromStyle); fontFromStyle->Unref(); } + #ifdef DEBUG_TEXT - std::cout << " Fontspec not defined, reconstructed from style :" << fontSpec << ":" << std::endl; + std::cout << " fontSpec empty, try from style" << std::endl; + std::cout << " from style :" << fontSpec << ":" << std::endl; sp_print_font( query ); #endif + } - // And if that didn't work use default - if( fontSpec.empty() ) { + // And if that didn't work use default. DO WE REALLY WANT TO DO THIS? + if ( fontSpec.empty() ) { + sp_style_read_from_prefs(query, "/tools/text"); -#ifdef DEBUG_TEXT - std::cout << " read style from prefs:" << std::endl; - sp_print_font( query ); -#endif + // Construct a new font specification if it does not yet exist font_instance * fontFromStyle = font_factory::Default()->FaceFromStyle(query); - if( fontFromStyle ) { + if ( fontFromStyle ) { fontSpec = font_factory::Default()->ConstructFontSpecification(fontFromStyle); fontFromStyle->Unref(); } + #ifdef DEBUG_TEXT - std::cout << " Fontspec not defined, reconstructed from style :" << fontSpec << ":" << std::endl; + std::cout << " fontSpec empty, trying from prefs" << std::endl; + std::cout << " from prefs :" << fontSpec << ":" << std::endl; sp_print_font( query ); #endif } + // Now we have a font specification, replace family. + Glib::ustring newFontSpec = ""; SPCSSAttr *css = sp_repr_css_attr_new (); - if (!fontSpec.empty()) { - // Now we have a font specification, replace family. - Glib::ustring newFontSpec = font_factory::Default()->ReplaceFontSpecificationFamily(fontSpec, family); + if (!fontSpec.empty()) newFontSpec = font_factory::Default()->ReplaceFontSpecificationFamily(fontSpec, family); #ifdef DEBUG_TEXT - std::cout << " New FontSpec from ReplaceFontSpecificationFamily :" << newFontSpec << ":" << std::endl; + std::cout << " New FontSpec from ReplaceFontSpecificationFamily :" << newFontSpec << ":" << std::endl; #endif - if (!newFontSpec.empty()) { + if (!fontSpec.empty() && !newFontSpec.empty() ) { - if (fontSpec != newFontSpec) { + if (fontSpec != newFontSpec) { - font_instance *font = font_factory::Default()->FaceFromFontSpecification(newFontSpec.c_str()); + font_instance *font = font_factory::Default()->FaceFromFontSpecification(newFontSpec.c_str()); - if (font) { - sp_repr_css_set_property (css, "-inkscape-font-specification", newFontSpec.c_str()); + if (font) { + sp_repr_css_set_property (css, "-inkscape-font-specification", newFontSpec.c_str()); - // Set all the these just in case they were altered when finding the best - // match for the new family and old style... + // Set all the these just in case they were altered when finding the best + // match for the new family and old style... Unnecessary? - gchar c[256]; + gchar c[256]; - font->Family(c, 256); + font->Family(c, 256); - sp_repr_css_set_property (css, "font-family", c); + sp_repr_css_set_property (css, "font-family", c); - font->Attribute( "weight", c, 256); - sp_repr_css_set_property (css, "font-weight", c); + font->Attribute( "weight", c, 256); + sp_repr_css_set_property (css, "font-weight", c); - font->Attribute("style", c, 256); - sp_repr_css_set_property (css, "font-style", c); + font->Attribute("style", c, 256); + sp_repr_css_set_property (css, "font-style", c); - font->Attribute("stretch", c, 256); - sp_repr_css_set_property (css, "font-stretch", c); + font->Attribute("stretch", c, 256); + sp_repr_css_set_property (css, "font-stretch", c); - font->Attribute("variant", c, 256); - sp_repr_css_set_property (css, "font-variant", c); + font->Attribute("variant", c, 256); + sp_repr_css_set_property (css, "font-variant", c); - font->Unref(); - } + font->Unref(); + } else { + g_warning(_("Failed to find font matching: %s\n"), newFontSpec.c_str()); } + } + } else { - } else { - - // newFontSpec empty - // If the old font on selection (or default) does not exist on the system, - // or the new font family does not exist, - // ReplaceFontSpecificationFamily does not work. In that case we fall back to blindly - // setting the family reported by the family chooser. - - // g_print ("fallback setting family: %s\n", family); - sp_repr_css_set_property (css, "-inkscape-font-specification", family); - sp_repr_css_set_property (css, "font-family", family); - // Shoud we set other css font attributes? - } + // Either old font does not exist on system or ReplaceFontSpecificationFamily() failed. + // Blindly fall back to setting the family to text in the font-family chooser. - } // fontSpec not empty or not +#ifdef DEBUG_TEXT + std::cout << " Failed to find new font, blindly setting family: " << family << std::endl; +#endif + sp_repr_css_set_property (css, "-inkscape-font-specification", family); + sp_repr_css_set_property (css, "font-family", family); + } // If querying returned nothing, update default style. if (result_fontspec == QUERY_STYLE_NOTHING) @@ -6600,7 +6617,7 @@ static void sp_text_style_changed( InkToggleAction* act, GObject *tbl ) sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS); font_instance * fontFromStyle = font_factory::Default()->FaceFromStyle(query); - if( fontFromStyle ) { + if ( fontFromStyle ) { fontSpec = font_factory::Default()->ConstructFontSpecification(fontFromStyle); fontFromStyle->Unref(); } @@ -6617,67 +6634,51 @@ static void sp_text_style_changed( InkToggleAction* act, GObject *tbl ) case 0: { // Bold - if (!fontSpec.empty()) { - - newFontSpec = font_factory::Default()->FontSpecificationSetBold(fontSpec, active); + if (!fontSpec.empty()) newFontSpec = font_factory::Default()->FontSpecificationSetBold(fontSpec, active); + if ( !fontSpec.empty() && !newFontSpec.empty() ) { - if (!newFontSpec.empty()) { - - // Set weight if we found font. - font_instance * font = font_factory::Default()->FaceFromFontSpecification(newFontSpec.c_str()); - if (font) { - gchar c[256]; - font->Attribute( "weight", c, 256); - sp_repr_css_set_property (css, "font-weight", c); - font->Unref(); - font = NULL; - } - nochange = false; + // Set weight using new font if found. + font_instance * font = font_factory::Default()->FaceFromFontSpecification(newFontSpec.c_str()); + if (font) { + gchar c[256]; + font->Attribute( "weight", c, 256); + sp_repr_css_set_property (css, "font-weight", c); + font->Unref(); + font = NULL; } + nochange = false; + } else { + + // Blindly set weight. + sp_repr_css_set_property (css, "font-weight", (active == 0 ? "normal" : "bold") ); } - // Reset button if no change. - // The reset code didn't work in 0.47 and doesn't here... one must prevent an infinite loop - /* - if(nochange) { - gtk_action_block_activate( GTK_ACTION(act) ); - gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), !active ); - gtk_action_unblock_activate( GTK_ACTION(act) ); - } - */ break; } case 1: { // Italic/Oblique - if (!fontSpec.empty()) { - - newFontSpec = font_factory::Default()->FontSpecificationSetItalic(fontSpec, active); + if (!fontSpec.empty()) newFontSpec = font_factory::Default()->FontSpecificationSetItalic(fontSpec, active); - if (!newFontSpec.empty()) { + if ( !fontSpec.empty() && !newFontSpec.empty() ) { - // Don't even set the italic/oblique if the font didn't exist on the system - if( active ) { - if( newFontSpec.find( "Italic" ) != Glib::ustring::npos ) { - sp_repr_css_set_property (css, "font-style", "italic"); - } else { - sp_repr_css_set_property (css, "font-style", "oblique"); - } + // Don't even set the italic/oblique if the font didn't exist on the system + if ( active ) { + if ( newFontSpec.find( "Italic" ) != Glib::ustring::npos ) { + sp_repr_css_set_property (css, "font-style", "italic"); } else { - sp_repr_css_set_property (css, "font-style", "normal"); + sp_repr_css_set_property (css, "font-style", "oblique"); } - nochange = false; + } else { + sp_repr_css_set_property (css, "font-style", "normal"); } + nochange = false; + + } else { + + // Blindly set style. + sp_repr_css_set_property (css, "font-style", (active == 0 ? "normal" : "italic") ); } - // Reset button if no change. - // The reset code didn't work in 0.47... one must prevent an infinite loop - /* - if(nochange) { - gtk_action_block_activate( GTK_ACTION(act) ); - gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), !active ); - gtk_action_unblock_activate( GTK_ACTION(act) ); - } - */ break; } } @@ -7228,7 +7229,7 @@ static void sp_text_orientation_mode_changed( EgeSelectOneAction *act, GObject * * This function sets up the text-tool tool-controls, setting the entry boxes * etc. to the values from the current selection or the default if no selection. * It is called whenever a text selection is changed, including stepping cursor - * through text. + * through text, or setting focus to text. */ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/, GObject *tbl) { @@ -7753,14 +7754,14 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions gtk_list_store_set( model, &iter, 0, _("Horizontal"), 1, _("Horizontal text"), - 2, INKSCAPE_ICON_FORMAT_TEXT_DIRECTION_HORIZONTAL, + 2, INKSCAPE_ICON("format-text-direction-horizontal"), -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Vertical"), 1, _("Vertical text"), - 2, INKSCAPE_ICON_FORMAT_TEXT_DIRECTION_VERTICAL, + 2, INKSCAPE_ICON("format-text-direction-vertical"), -1 ); EgeSelectOneAction* act = ege_select_one_action_new( "TextOrientationAction", // Name @@ -8281,7 +8282,7 @@ static void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainA InkToggleAction* act = ink_toggle_action_new( "ConnectorEditModeAction", _("EditMode"), _("Switch between connection point editing and connector drawing mode"), - INKSCAPE_ICON_CONNECTOR_EDIT, + INKSCAPE_ICON("connector-edit"), Inkscape::ICON_SIZE_DECORATION ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); @@ -8296,7 +8297,7 @@ static void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainA InkAction* inky = ink_action_new( "ConnectorAvoidAction", _("Avoid"), _("Make connectors avoid selected objects"), - INKSCAPE_ICON_CONNECTOR_AVOID, + INKSCAPE_ICON("connector-avoid"), secondarySize ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_connector_path_set_avoid), holder ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); @@ -8306,7 +8307,7 @@ static void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainA InkAction* inky = ink_action_new( "ConnectorIgnoreAction", _("Ignore"), _("Make connectors ignore selected objects"), - INKSCAPE_ICON_CONNECTOR_IGNORE, + INKSCAPE_ICON("connector-ignore"), secondarySize ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_connector_path_set_ignore), holder ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); @@ -8317,7 +8318,7 @@ static void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainA InkToggleAction* act = ink_toggle_action_new( "ConnectorOrthogonalAction", _("Orthogonal"), _("Make connector orthogonal or polyline"), - INKSCAPE_ICON_CONNECTOR_ORTHOGONAL, + INKSCAPE_ICON("connector-orthogonal"), Inkscape::ICON_SIZE_DECORATION ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); @@ -8355,7 +8356,7 @@ static void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainA InkAction* inky = ink_action_new( "ConnectorGraphAction", _("Graph"), _("Nicely arrange selected connector network"), - INKSCAPE_ICON_DISTRIBUTE_GRAPH, + INKSCAPE_ICON("distribute-graph"), secondarySize ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_connector_graph_layout), holder ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); @@ -8378,7 +8379,7 @@ static void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainA InkToggleAction* act = ink_toggle_action_new( "ConnectorDirectedAction", _("Downwards"), _("Make connectors with end-markers (arrows) point downwards"), - INKSCAPE_ICON_DISTRIBUTE_GRAPH_DIRECTED, + INKSCAPE_ICON("distribute-graph-directed"), Inkscape::ICON_SIZE_DECORATION ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); @@ -8394,7 +8395,7 @@ static void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainA InkToggleAction* act = ink_toggle_action_new( "ConnectorOverlapAction", _("Remove overlaps"), _("Do not allow overlapping shapes"), - INKSCAPE_ICON_DISTRIBUTE_REMOVE_OVERLAPS, + INKSCAPE_ICON("distribute-remove-overlaps"), Inkscape::ICON_SIZE_DECORATION ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); @@ -8410,7 +8411,7 @@ static void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainA InkAction* inky = ink_action_new( "ConnectorNewConnPointAction", _("New connection point"), _("Add a new connection point to the currently selected item"), - INKSCAPE_ICON_CONNECTOR_NEW_CONNPOINT, + INKSCAPE_ICON("connector-new-connpoint"), secondarySize ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_connector_new_connection_point), holder ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); @@ -8422,7 +8423,7 @@ static void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainA InkAction* inky = ink_action_new( "ConnectorRemoveConnPointAction", _("Remove connection point"), _("Remove the currently selected connection point"), - INKSCAPE_ICON_CONNECTOR_REMOVE_CONNPOINT, + INKSCAPE_ICON("connector-remove-connpoint"), secondarySize ); g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_connector_remove_connection_point), holder ); gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); diff --git a/src/xml/repr-util.cpp b/src/xml/repr-util.cpp index 9405cde01..db1d5591e 100644 --- a/src/xml/repr-util.cpp +++ b/src/xml/repr-util.cpp @@ -494,9 +494,9 @@ sp_repr_get_boolean(Inkscape::XML::Node *repr, gchar const *key, unsigned int *v v = repr->attribute(key); if (v != NULL) { - if (!g_strcasecmp(v, "true") || - !g_strcasecmp(v, "yes" ) || - !g_strcasecmp(v, "y" ) || + if (!g_ascii_strcasecmp(v, "true") || + !g_ascii_strcasecmp(v, "yes" ) || + !g_ascii_strcasecmp(v, "y" ) || (atoi(v) != 0)) { *val = TRUE; } else { |
