summaryrefslogtreecommitdiffstats
path: root/src/extension/internal
diff options
context:
space:
mode:
authorMatthew Petroff <matthew@mpetroff.net>2013-08-27 16:32:55 +0000
committerMatthew Petroff <matthew@mpetroff.net>2013-08-27 16:32:55 +0000
commitf10048be170a45921ae8fc65ccd2588a9ad2897d (patch)
treec0abadf8d3b7ffb325061d797e5b8d9d8b2aefeb /src/extension/internal
parentUse real world units for page sizes. (diff)
downloadinkscape-f10048be170a45921ae8fc65ccd2588a9ad2897d.tar.gz
inkscape-f10048be170a45921ae8fc65ccd2588a9ad2897d.zip
Added viewBox implement document unit support.
(bzr r12475.1.2)
Diffstat (limited to 'src/extension/internal')
-rw-r--r--src/extension/internal/cairo-renderer.cpp4
-rw-r--r--src/extension/internal/grid.cpp5
-rw-r--r--src/extension/internal/latex-pstricks.cpp8
-rw-r--r--src/extension/internal/latex-text-renderer.cpp4
-rw-r--r--src/extension/internal/odf.cpp3
5 files changed, 13 insertions, 11 deletions
diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp
index f7ab63c98..eddc5ba23 100644
--- a/src/extension/internal/cairo-renderer.cpp
+++ b/src/extension/internal/cairo-renderer.cpp
@@ -645,9 +645,9 @@ CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool page
Geom::Affine tp( Geom::Translate( bleedmargin_px, bleedmargin_px ) );
ctx->transform(tp);
} else {
- double high = doc->getHeight();
+ double high = doc->getHeight().value("px");
if (ctx->_vector_based_target)
- high *= Inkscape::Util::Quantity::convert(1, "px", "pt");
+ high = Inkscape::Util::Quantity::convert(high, "px", "pt");
// this transform translates the export drawing to a virtual page (0,0)-(width,height)
Geom::Affine tp(Geom::Translate(-d.left() * (ctx->_vector_based_target ? Inkscape::Util::Quantity::convert(1, "pt", "px") : 1.0),
diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp
index 820d1c9d3..2f9d0ff25 100644
--- a/src/extension/internal/grid.cpp
+++ b/src/extension/internal/grid.cpp
@@ -35,6 +35,7 @@
#include "extension/effect.h"
#include "extension/system.h"
+#include "util/units.h"
#include "grid.h"
@@ -97,14 +98,14 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc
/* get page size */
SPDocument * doc = document->doc();
bounding_area = Geom::Rect( Geom::Point(0,0),
- Geom::Point(doc->getWidth(), doc->getHeight()) );
+ Geom::Point(doc->getWidth().value("px"), doc->getHeight().value("px")) );
} else {
Geom::OptRect bounds = selection->visualBounds();
if (bounds) {
bounding_area = *bounds;
}
- gdouble doc_height = (document->doc())->getHeight();
+ gdouble doc_height = (document->doc())->getHeight().value("px");
Geom::Rect temprec = Geom::Rect(Geom::Point(bounding_area.min()[Geom::X], doc_height - bounding_area.min()[Geom::Y]),
Geom::Point(bounding_area.max()[Geom::X], doc_height - bounding_area.max()[Geom::Y]));
diff --git a/src/extension/internal/latex-pstricks.cpp b/src/extension/internal/latex-pstricks.cpp
index 2ece1ba87..c8e8e2f2e 100644
--- a/src/extension/internal/latex-pstricks.cpp
+++ b/src/extension/internal/latex-pstricks.cpp
@@ -117,8 +117,8 @@ unsigned int PrintLatex::begin (Inkscape::Extension::Print *mod, SPDocument *doc
}
// width and height in pt
- _width = doc->getWidth() * Inkscape::Util::Quantity::convert(1, "px", "pt");
- _height = doc->getHeight() * Inkscape::Util::Quantity::convert(1, "px", "pt");
+ _width = doc->getWidth().value("pt");
+ _height = doc->getHeight().value("pt");
if (res >= 0) {
@@ -128,10 +128,10 @@ unsigned int PrintLatex::begin (Inkscape::Extension::Print *mod, SPDocument *doc
os << "\\psset{xunit=.5pt,yunit=.5pt,runit=.5pt}\n";
// from now on we can output px, but they will be treated as pt
- os << "\\begin{pspicture}(" << doc->getWidth() << "," << doc->getHeight() << ")\n";
+ os << "\\begin{pspicture}(" << doc->getWidth().value("px") << "," << doc->getHeight().value("px") << ")\n";
}
- m_tr_stack.push( Geom::Scale(1, -1) * Geom::Translate(0, doc->getHeight())); /// @fixme hardcoded doc2dt transform
+ m_tr_stack.push( Geom::Scale(1, -1) * Geom::Translate(0, doc->getHeight().value("px"))); /// @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 57a71b467..b1c67aa81 100644
--- a/src/extension/internal/latex-text-renderer.cpp
+++ b/src/extension/internal/latex-text-renderer.cpp
@@ -602,7 +602,7 @@ LaTeXTextRenderer::setupDocument(SPDocument *doc, bool pageBoundingBox, float bl
}
// flip y-axis
- push_transform( Geom::Scale(1,-1) * Geom::Translate(0, doc->getHeight()) ); /// @fixme hardcoded desktop transform!
+ push_transform( Geom::Scale(1,-1) * Geom::Translate(0, doc->getHeight().value("px")) ); /// @fixme hardcoded desktop transform!
// write the info to LaTeX
Inkscape::SVGOStringStream os;
@@ -611,7 +611,7 @@ LaTeXTextRenderer::setupDocument(SPDocument *doc, bool pageBoundingBox, float bl
// scaling of the image when including it in LaTeX
os << " \\ifx\\svgwidth\\undefined%\n";
- os << " \\setlength{\\unitlength}{" << d.width() * Inkscape::Util::Quantity::convert(1, "px", "pt") << "bp}%\n"; // note: 'bp' is the Postscript pt unit in LaTeX, see LP bug #792384
+ os << " \\setlength{\\unitlength}{" << Inkscape::Util::Quantity::convert(d.width(), "px", "pt") << "bp}%\n"; // note: 'bp' is the Postscript pt unit in LaTeX, see LP bug #792384
os << " \\ifx\\svgscale\\undefined%\n";
os << " \\relax%\n";
os << " \\else%\n";
diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp
index 9f745cdea..a4dbd1428 100644
--- a/src/extension/internal/odf.cpp
+++ b/src/extension/internal/odf.cpp
@@ -75,6 +75,7 @@
#include "sp-flowtext.h"
#include "svg/svg.h"
#include "text-editing.h"
+#include "util/units.h"
//# DOM-specific includes
@@ -945,7 +946,7 @@ static Geom::Affine getODFTransform(const SPItem *item)
//### Get SVG-to-ODF transform
Geom::Affine tf (item->i2dt_affine());
//Flip Y into document coordinates
- double doc_height = SP_ACTIVE_DOCUMENT->getHeight();
+ double doc_height = SP_ACTIVE_DOCUMENT->getHeight().value("px");
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;