diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-07-24 18:45:27 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-07-24 18:45:27 +0000 |
| commit | 50115a1e39ed4414dd9e684709253167072b29ee (patch) | |
| tree | a37ac591208a0f52e64ad7f5bddd45e773f138ee /src/extension | |
| parent | fix minor bug (diff) | |
| parent | Fix a bug continuing a bezier path whith a LPE one like spiro or bspline on a... (diff) | |
| download | inkscape-50115a1e39ed4414dd9e684709253167072b29ee.tar.gz inkscape-50115a1e39ed4414dd9e684709253167072b29ee.zip | |
update to trunk
(bzr r13708.1.37)
Diffstat (limited to 'src/extension')
| -rw-r--r-- | src/extension/implementation/implementation.h | 9 | ||||
| -rw-r--r-- | src/extension/internal/emf-print.cpp | 20 | ||||
| -rw-r--r-- | src/extension/internal/javafx-out.cpp | 9 | ||||
| -rw-r--r-- | src/extension/internal/latex-pstricks.cpp | 5 | ||||
| -rw-r--r-- | src/extension/internal/latex-text-renderer.cpp | 12 | ||||
| -rw-r--r-- | src/extension/internal/metafile-print.cpp | 8 | ||||
| -rw-r--r-- | src/extension/internal/odf.cpp | 5 | ||||
| -rw-r--r-- | src/extension/internal/pov-out.cpp | 5 | ||||
| -rw-r--r-- | src/extension/internal/wmf-print.cpp | 19 | ||||
| -rw-r--r-- | src/extension/param/color.cpp | 6 |
10 files changed, 46 insertions, 52 deletions
diff --git a/src/extension/implementation/implementation.h b/src/extension/implementation/implementation.h index fb323cd78..f6f933aaf 100644 --- a/src/extension/implementation/implementation.h +++ b/src/extension/implementation/implementation.h @@ -15,14 +15,7 @@ #include <vector> #include <sigc++/signal.h> #include <glibmm/value.h> - -namespace Geom { - class Affine; - class OptRect; - class Path; - typedef std::vector<Path> PathVector; - class Point; -} +#include <2geom/forward.h> namespace Gtk { class Widget; diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp index 40d0955e3..5b8aae655 100644 --- a/src/extension/internal/emf-print.cpp +++ b/src/extension/internal/emf-print.cpp @@ -860,7 +860,7 @@ Geom::Path PrintEmf::pathv_to_rect(Geom::PathVector const &pathv, bool *is_rect, /* Get the ends of the LAST line segment. Find minimum rotation to align rectangle with X,Y axes. (Very degenerate if it is rotated 45 degrees.) */ *angle = 10.0; /* must be > than the actual angle in radians. */ - for(Geom::Path::const_iterator cit = pR.begin(); cit != pR.end_open(); ++cit){ + for(Geom::Path::iterator cit = pR.begin(); cit != pR.end_open(); ++cit){ P1_trail = cit->initialPoint(); P1 = cit->finalPoint(); v1 = unit_vector(P1 - P1_trail); @@ -874,7 +874,7 @@ Geom::Path PrintEmf::pathv_to_rect(Geom::PathVector const &pathv, bool *is_rect, double convert = 36000.0/ (2.0 * M_PI); *angle = round(*angle * convert)/convert; - for(Geom::Path::const_iterator cit = pR.begin(); cit != pR.end_open();++cit) { + for(Geom::Path::iterator cit = pR.begin(); cit != pR.end_open();++cit) { P1_lead = cit->finalPoint(); v1 = unit_vector(P1 - P1_trail); v2 = unit_vector(P1_lead - P1 ); @@ -924,7 +924,7 @@ int PrintEmf::vector_rect_alignment(double angle, Geom::Point vtest){ */ Geom::Point PrintEmf::get_pathrect_corner(Geom::Path pathRect, double angle, int corner){ Geom::Point center(0,0); - for(Geom::Path::const_iterator cit = pathRect.begin(); cit != pathRect.end_open(); ++cit) { + for(Geom::Path::iterator cit = pathRect.begin(); cit != pathRect.end_open(); ++cit) { center += cit->initialPoint()/4.0; } @@ -952,7 +952,7 @@ Geom::Point PrintEmf::get_pathrect_corner(Geom::Path pathRect, double angle, int Geom::Point v1 = Geom::Point(1,0) * Geom::Rotate(-angle); // unit horizontal side (sign change because Y increases DOWN) Geom::Point v2 = Geom::Point(0,1) * Geom::Rotate(-angle); // unit vertical side (sign change because Y increases DOWN) Geom::Point P1; - for(Geom::Path::const_iterator cit = pathRect.begin(); cit != pathRect.end_open(); ++cit) { + for(Geom::Path::iterator cit = pathRect.begin(); cit != pathRect.end_open(); ++cit) { P1 = cit->initialPoint(); if ( ( LR == (dot(P1 - center,v1) > 0 ? 0 : 1) ) @@ -1494,11 +1494,11 @@ bool PrintEmf::print_simple_shape(Geom::PathVector const &pathv, const Geom::Aff int curves = 0; char *rec = NULL; - for (Geom::PathVector::const_iterator pit = pv.begin(); pit != pv.end(); ++pit) { + for (Geom::PathVector::iterator pit = pv.begin(); pit != pv.end(); ++pit) { moves++; nodes++; - for (Geom::Path::const_iterator cit = pit->begin(); cit != pit->end_open(); ++cit) { + for (Geom::Path::iterator cit = pit->begin(); cit != pit->end_open(); ++cit) { nodes++; if (is_straight_curve(*cit)) { @@ -1519,7 +1519,7 @@ bool PrintEmf::print_simple_shape(Geom::PathVector const &pathv, const Geom::Aff /** * For all Subpaths in the <path> */ - for (Geom::PathVector::const_iterator pit = pv.begin(); pit != pv.end(); ++pit) { + for (Geom::PathVector::iterator pit = pv.begin(); pit != pv.end(); ++pit) { using Geom::X; using Geom::Y; @@ -1538,7 +1538,7 @@ bool PrintEmf::print_simple_shape(Geom::PathVector const &pathv, const Geom::Aff /** * For all segments in the subpath */ - for (Geom::Path::const_iterator cit = pit->begin(); cit != pit->end_open(); ++cit) { + for (Geom::Path::iterator cit = pit->begin(); cit != pit->end_open(); ++cit) { if (is_straight_curve(*cit)) { //Geom::Point p0 = cit->initialPoint(); Geom::Point p1 = cit->finalPoint(); @@ -1557,7 +1557,7 @@ bool PrintEmf::print_simple_shape(Geom::PathVector const &pathv, const Geom::Aff lpPoints[i].y = y1; i = i + 1; } else if (Geom::CubicBezier const *cubic = dynamic_cast<Geom::CubicBezier const *>(&*cit)) { - std::vector<Geom::Point> points = cubic->points(); + std::vector<Geom::Point> points = cubic->controlPoints(); //Geom::Point p0 = points[0]; Geom::Point p1 = points[1]; Geom::Point p2 = points[2]; @@ -1846,7 +1846,7 @@ unsigned int PrintEmf::draw_pathv_to_EMF(Geom::PathVector const &pathv, const Ge g_error("Fatal programming error in PrintEmf::print_pathv at U_EMRLINETO_set"); } } else if (Geom::CubicBezier const *cubic = dynamic_cast<Geom::CubicBezier const *>(&*cit)) { - std::vector<Geom::Point> points = cubic->points(); + std::vector<Geom::Point> points = cubic->controlPoints(); //Geom::Point p0 = points[0]; Geom::Point p1 = points[1]; Geom::Point p2 = points[2]; diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp index 19946022c..386bde1d6 100644 --- a/src/extension/internal/javafx-out.cpp +++ b/src/extension/internal/javafx-out.cpp @@ -35,8 +35,7 @@ #include <extension/system.h> #include <2geom/pathvector.h> #include <2geom/rect.h> -#include <2geom/bezier-curve.h> -#include <2geom/hvlinesegment.h> +#include <2geom/curves.h> #include "helper/geom.h" #include "helper/geom-curves.h" #include <io/sys.h> @@ -531,9 +530,7 @@ bool JavaFXOutput::doCurve(SPItem *item, const String &id) for (Geom::Path::const_iterator cit = pit->begin(); cit != pit->end_closed(); ++cit) { //### LINE - if ( dynamic_cast<Geom::LineSegment const *> (&*cit) || - dynamic_cast<Geom::HLineSegment const *> (&*cit) || - dynamic_cast<Geom::VLineSegment const *> (&*cit) ) + if ( dynamic_cast<Geom::LineSegment const *> (&*cit) ) { Geom::Point p = cit->finalPoint(); out(" LineTo {\n"); @@ -545,7 +542,7 @@ bool JavaFXOutput::doCurve(SPItem *item, const String &id) //### BEZIER else if (Geom::CubicBezier const *cubic = dynamic_cast<Geom::CubicBezier const*>(&*cit)) { - std::vector<Geom::Point> points = cubic->points(); + std::vector<Geom::Point> points = cubic->controlPoints(); Geom::Point p1 = points[1]; Geom::Point p2 = points[2]; Geom::Point p3 = points[3]; diff --git a/src/extension/internal/latex-pstricks.cpp b/src/extension/internal/latex-pstricks.cpp index 6aaa1bca4..ae8f30a5c 100644 --- a/src/extension/internal/latex-pstricks.cpp +++ b/src/extension/internal/latex-pstricks.cpp @@ -17,8 +17,7 @@ #include <2geom/pathvector.h> #include <2geom/sbasis-to-bezier.h> -#include <2geom/bezier-curve.h> -#include <2geom/hvlinesegment.h> +#include <2geom/curves.h> #include <errno.h> #include <signal.h> #include "util/units.h" @@ -300,7 +299,7 @@ PrintLatex::print_2geomcurve(SVGOStringStream &os, Geom::Curve const &c) os << "\\lineto(" << c.finalPoint()[X] << "," << c.finalPoint()[Y] << ")\n"; } else if(Geom::CubicBezier const *cubic_bezier = dynamic_cast<Geom::CubicBezier const*>(&c)) { - std::vector<Geom::Point> points = cubic_bezier->points(); + std::vector<Geom::Point> points = cubic_bezier->controlPoints(); os << "\\curveto(" << points[1][X] << "," << points[1][Y] << ")(" << points[2][X] << "," << points[2][Y] << ")(" << points[3][X] << "," << points[3][Y] << ")\n"; diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp index 1026f51ad..5933dd526 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -409,7 +409,8 @@ Flowing in rectangle is possible, not in arb shape. return; // don't know how to handle non-rect frames yet. is quite uncommon for latex users i think } - Geom::Rect framebox = frame->getRect() * transform(); + // We will transform the coordinates + Geom::Rect framebox = frame->getRect(); // get position and alignment // Align on topleft corner. @@ -429,7 +430,10 @@ Flowing in rectangle is possible, not in arb shape. // no need to add LaTeX code for standard justified output :) break; } - Geom::Point pos(framebox.corner(3)); //topleft corner + + // The topleft Corner was calculated after rotating the text which results in a wrong Coordinate. + // Now, the topleft Corner is rotated after calculating it + Geom::Point pos(framebox.corner(0) * transform()); //topleft corner // determine color and transparency (for now, use rgb color model as it is most native to Inkscape) bool has_color = false; // if the item has no color set, don't force black color @@ -472,7 +476,9 @@ Flowing in rectangle is possible, not in arb shape. os << "\\rotatebox{" << degrees << "}{"; } os << "\\makebox(0,0)" << alignment << "{"; - os << "\\begin{minipage}{" << framebox.width() << "\\unitlength}"; + + // Scale the x width correctly + os << "\\begin{minipage}{" << framebox.width() * transform().expansionX() << "\\unitlength}"; os << justification; // Walk through all spans in the text object. diff --git a/src/extension/internal/metafile-print.cpp b/src/extension/internal/metafile-print.cpp index 73d63f27d..2fb36be85 100644 --- a/src/extension/internal/metafile-print.cpp +++ b/src/extension/internal/metafile-print.cpp @@ -389,7 +389,7 @@ Geom::PathVector PrintMetafile::center_ellipse_as_SVG_PathV(Geom::Point ctr, dou char text[256]; sprintf(text, " M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z", x1, y1, rx, ry, F * 360. / (2.*M_PI), x2, y2, rx, ry, F * 360. / (2.*M_PI), x1, y1); - std::vector<Geom::Path> outres = Geom::parse_svg_path(text); + Geom::PathVector outres = Geom::parse_svg_path(text); return outres; } @@ -419,7 +419,7 @@ Geom::PathVector PrintMetafile::center_elliptical_ring_as_SVG_PathV(Geom::Point sprintf(text, " M %f,%f A %f %f %f 0 1 %f %f A %f %f %f 0 1 %f %f z M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z", x11, y11, rx1, ry1, degrot, x12, y12, rx1, ry1, degrot, x11, y11, x21, y21, rx2, ry2, degrot, x22, y22, rx2, ry2, degrot, x21, y21); - std::vector<Geom::Path> outres = Geom::parse_svg_path(text); + Geom::PathVector outres = Geom::parse_svg_path(text); return outres; } @@ -440,7 +440,7 @@ Geom::PathVector PrintMetafile::center_elliptical_hole_as_SVG_PathV(Geom::Point char text[256]; sprintf(text, " M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z M 50000,50000 50000,-50000 -50000,-50000 -50000,50000 z", x1, y1, rx, ry, F * 360. / (2.*M_PI), x2, y2, rx, ry, F * 360. / (2.*M_PI), x1, y1); - std::vector<Geom::Path> outres = Geom::parse_svg_path(text); + Geom::PathVector outres = Geom::parse_svg_path(text); return outres; } @@ -452,7 +452,7 @@ width vector to side edge */ Geom::PathVector PrintMetafile::rect_cutter(Geom::Point ctr, Geom::Point pos, Geom::Point neg, Geom::Point width) { - std::vector<Geom::Path> outres; + Geom::PathVector outres; Geom::Path cutter; cutter.start(ctr + pos - width); cutter.appendNew<Geom::LineSegment>(ctr + pos + width); diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index 52fabcf3c..6904eb2fd 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -55,8 +55,7 @@ #include <style.h> #include "display/curve.h" #include <2geom/pathvector.h> -#include <2geom/bezier-curve.h> -#include <2geom/hvlinesegment.h> +#include <2geom/curves.h> #include <2geom/transforms.h> #include <helper/geom.h> #include "helper/geom-curves.h" @@ -1299,7 +1298,7 @@ writePath(Writer &outs, Geom::PathVector const &pathv, outs.printf("L %.3f %.3f ", destx, desty); } else if(Geom::CubicBezier const *cubic = dynamic_cast<Geom::CubicBezier const*>(&*cit)) { - std::vector<Geom::Point> points = cubic->points(); + std::vector<Geom::Point> points = cubic->controlPoints(); for (unsigned i = 1; i <= 3; i++) { if (fabs(points[i][X])<1.0) points[i][X] = 0.0; // Why is this needed? Shouldn't we just round all numbers then? if (fabs(points[i][Y])<1.0) points[i][Y] = 0.0; diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp index 3d149928f..bd2168b68 100644 --- a/src/extension/internal/pov-out.cpp +++ b/src/extension/internal/pov-out.cpp @@ -30,8 +30,7 @@ #include <extension/system.h> #include <2geom/pathvector.h> #include <2geom/rect.h> -#include <2geom/bezier-curve.h> -#include <2geom/hvlinesegment.h> +#include <2geom/curves.h> #include "helper/geom.h" #include "helper/geom-curves.h" #include <io/sys.h> @@ -388,7 +387,7 @@ bool PovOutput::doCurve(SPItem *item, const String &id) } else if(Geom::CubicBezier const *cubic = dynamic_cast<Geom::CubicBezier const*>(&*cit)) { - std::vector<Geom::Point> points = cubic->points(); + std::vector<Geom::Point> points = cubic->controlPoints(); Geom::Point p0 = points[0]; Geom::Point p1 = points[1]; Geom::Point p2 = points[2]; diff --git a/src/extension/internal/wmf-print.cpp b/src/extension/internal/wmf-print.cpp index 768909173..431053085 100644 --- a/src/extension/internal/wmf-print.cpp +++ b/src/extension/internal/wmf-print.cpp @@ -29,14 +29,13 @@ #endif -#include "2geom/sbasis-to-bezier.h" -#include "2geom/svg-elliptical-arc.h" - -#include "2geom/path.h" -#include "2geom/pathvector.h" -#include "2geom/rect.h" -#include "2geom/bezier-curve.h" -#include "2geom/hvlinesegment.h" +#include <2geom/sbasis-to-bezier.h> +#include <2geom/elliptical-arc.h> + +#include <2geom/path.h> +#include <2geom/pathvector.h> +#include <2geom/rect.h> +#include <2geom/curves.h> #include "helper/geom.h" #include "helper/geom-curves.h" #include "sp-item.h" @@ -59,7 +58,7 @@ #include "display/cairo-utils.h" #include "splivarot.h" // pieces for union on shapes -#include "2geom/svg-path-parser.h" // to get from SVG text to Geom::Path +#include <2geom/svg-path-parser.h> // to get from SVG text to Geom::Path #include "display/canvas-bpath.h" // for SPWindRule #include "display/cairo-utils.h" // for Inkscape::Pixbuf::PF_CAIRO @@ -984,7 +983,7 @@ bool PrintWmf::print_simple_shape(Geom::PathVector const &pathv, const Geom::Aff lpPoints[i].y = y1; i = i + 1; } else if (Geom::CubicBezier const *cubic = dynamic_cast<Geom::CubicBezier const *>(&*cit)) { - std::vector<Geom::Point> points = cubic->points(); + std::vector<Geom::Point> points = cubic->controlPoints(); //Geom::Point p0 = points[0]; Geom::Point p1 = points[1]; Geom::Point p2 = points[2]; diff --git a/src/extension/param/color.cpp b/src/extension/param/color.cpp index 3162e8a40..0b58c5011 100644 --- a/src/extension/param/color.cpp +++ b/src/extension/param/color.cpp @@ -86,9 +86,11 @@ Gtk::Widget *ParamColor::get_widget( SPDocument * /*doc*/, Inkscape::XML::Node * { using Inkscape::UI::Widget::ColorNotebook; - if (_gui_hidden) return NULL; + if (_gui_hidden) return NULL; - _changeSignal = new sigc::signal<void>(*changeSignal); + if (changeSignal) { + _changeSignal = new sigc::signal<void>(*changeSignal); + } if (_color.value() < 1) { _color_changed.block(true); |
