Code

Win32 post-GSoC fixups.
[inkscape.git] / src / extension / internal / emf-win32-print.cpp
index 8c92fc3209f8d3531093cf8f7a2ac02dbd085235..6be48e44ccb73692cf6ee5a40a61f7c756001ae0 100644 (file)
@@ -3,8 +3,10 @@
  */
 /* Authors:
  *   Ulf Erikson <ulferikson@users.sf.net>
+ *   Jon A. Cruz <jon@joncruz.org>
+ *   Abhishek Sharma
  *
- * Copyright (C) 2006-2008 Authors
+ * Copyright (C) 2006-2009 Authors
  *
  * Released under GNU GPL, read the file 'COPYING' for more information
  */
 //#include <signal.h>
 //#include <errno.h>
 
-//#include "libnr/nr-point-matrix-ops.h"
-//#include "libnr/nr-rect.h"
-//#include "libnr/nr-matrix.h"
-#include "libnr/nr-matrix-ops.h"
-//#include "libnr/nr-matrix-scale-ops.h"
-//#include "libnr/nr-matrix-translate-ops.h"
-#include "libnr/nr-scale-translate-ops.h"
-//#include "libnr/nr-translate-scale-ops.h"
-//#include "libnr/nr-matrix-fns.h"
-//#include "libnr/nr-pixblock.h"
 #include <2geom/pathvector.h>
 #include <2geom/rect.h>
 #include <2geom/bezier-curve.h>
@@ -59,7 +51,7 @@
 //#include "document.h"
 #include "style.h"
 //#include "sp-paint-server.h"
-#include "inkscape_version.h"
+#include "inkscape-version.h"
 
 //#include "libnrtype/FontFactory.h"
 //#include "libnrtype/font-instance.h"
@@ -145,8 +137,8 @@ PrintEmfWin32::begin (Inkscape::Extension::Print *mod, SPDocument *doc)
     WCHAR *unicode_uri = (WCHAR *) unicode_fn;
 
     // width and height in px
-    _width = sp_document_width(doc);
-    _height = sp_document_height(doc);
+    _width = doc->getWidth();
+    _height = doc->getHeight();
 
     NRRect d;
     bool pageBoundingBox;
@@ -156,8 +148,8 @@ PrintEmfWin32::begin (Inkscape::Extension::Print *mod, SPDocument *doc)
         d.x1 = _width;
         d.y1 = _height;
     } else {
-        SPItem* doc_item = SP_ITEM(sp_document_root(doc));
-        sp_item_invoke_bbox(doc_item, &d, sp_item_i2r_affine(doc_item), TRUE);
+        SPItem* doc_item = SP_ITEM(doc->getRoot());
+        doc_item->invoke_bbox(&d, doc_item->i2d_affine(), TRUE);
     }
 
     d.x0 *= IN_PER_PX;
@@ -182,7 +174,7 @@ PrintEmfWin32::begin (Inkscape::Extension::Print *mod, SPDocument *doc)
 
     CHAR buff[1024];
     ZeroMemory(buff, sizeof(buff));
-    snprintf(buff, sizeof(buff)-1, "Inkscape %s (%s)", INKSCAPE_VERSION, __DATE__);
+    snprintf(buff, sizeof(buff)-1, "Inkscape %s (%s)", Inkscape::version_string, __DATE__);
     INT len = strlen(buff);
     CHAR *p1 = strrchr(ansi_uri, '\\');
     CHAR *p2 = strrchr(ansi_uri, '/');
@@ -242,7 +234,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, sp_document_height(doc)));
+    m_tr_stack.push( Geom::Scale(1, -1) * Geom::Translate(0, doc->getHeight()));
 
     return 0;
 }
@@ -684,7 +676,6 @@ PrintEmfWin32::print_simple_shape(Geom::PathVector const &pathv, const Geom::Mat
     bool done = false;
     bool closed = (lpPoints[0].x == lpPoints[i-1].x) && (lpPoints[0].y == lpPoints[i-1].y);
     bool polygon = false;
-    bool polyline = false;
     bool rectangle = false;
     bool ellipse = false;
     
@@ -698,9 +689,6 @@ PrintEmfWin32::print_simple_shape(Geom::PathVector const &pathv, const Geom::Mat
             }
         }
     }
-    else if (moves == 1 && moves+lines == nodes) {
-        polyline = true;
-    }
     else if (moves == 1 && nodes == 5 && moves+curves == nodes && closed) {
         if (lpPoints[0].x == lpPoints[1].x && lpPoints[1].x == lpPoints[11].x &&
             lpPoints[5].x == lpPoints[6].x && lpPoints[6].x == lpPoints[7].x &&
@@ -713,7 +701,7 @@ PrintEmfWin32::print_simple_shape(Geom::PathVector const &pathv, const Geom::Mat
         }
     }
 
-    if (polygon || polyline || ellipse) {
+    if (polygon || ellipse) {
         HPEN hpenTmp = NULL;
         HPEN hpenOld = NULL;
         HBRUSH hbrushTmp = NULL;
@@ -736,9 +724,6 @@ PrintEmfWin32::print_simple_shape(Geom::PathVector const &pathv, const Geom::Mat
             else
                 Polygon( hdc, lpPoints, nodes );
         }
-        else if (polyline) {
-            Polyline( hdc, lpPoints, nodes );
-        }
         else if (ellipse) {
             Ellipse( hdc, lpPoints[6].x, lpPoints[3].y, lpPoints[0].x, lpPoints[9].y);
         }
@@ -1037,4 +1022,4 @@ PrintEmfWin32::init (void)
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :