Code

Merge and cleanup of GSoC C++-ification project.
[inkscape.git] / src / ui / dialog / print.cpp
index d98d6a49e8f3996b2d931882f98113c0f2b72394..a56cbfd9d65dd6066d4126c9cd5df143ba52f9dc 100644 (file)
@@ -3,6 +3,7 @@
  */
 /* Authors:
  *   Kees Cook <kees@outflux.net>
+ *   Abhishek Sharma
  *
  * Copyright (C) 2007 Kees Cook
  * Released under GNU GPL.  Read the file 'COPYING' for more information.
 
 
 
-static void
-draw_page (GtkPrintOperation *operation,
-           GtkPrintContext   *context,
-           gint               /*page_nr*/,
-           gpointer           user_data)
+static void draw_page(
+#ifdef WIN32
+                      GtkPrintOperation *operation,
+#else
+                      GtkPrintOperation *,
+#endif
+                      GtkPrintContext   *context,
+                      gint               /*page_nr*/,
+                      gpointer           user_data)
 {
     struct workaround_gtkmm *junk = (struct workaround_gtkmm*)user_data;
     //printf("%s %d\n",__FUNCTION__, page_nr);
 
     if (junk->_tab->as_bitmap()) {
         // Render as exported PNG
-        gdouble width = sp_document_width(junk->_doc);
-        gdouble height = sp_document_height(junk->_doc);
+        gdouble width = (junk->_doc)->getWidth();
+        gdouble height = (junk->_doc)->getHeight();
         gdouble dpi = junk->_tab->bitmap_dpi();
         std::string tmp_png;
         std::string tmp_base = "inkscape-print-png-XXXXXX";
@@ -177,7 +182,7 @@ Print::Print(SPDocument *doc, SPItem *base) :
     _printop = gtk_print_operation_new ();
 
     // set up dialog title, based on document name
-    gchar *jobname = _doc->name ? _doc->name : _("SVG Document");
+    gchar const *jobname = _doc->getName() ? _doc->getName() : _("SVG Document");
     Glib::ustring title = _("Print");
     title += " ";
     title += jobname;
@@ -186,10 +191,10 @@ Print::Print(SPDocument *doc, SPItem *base) :
     // set up paper size to match the document size
     gtk_print_operation_set_unit (_printop, GTK_UNIT_POINTS);
     GtkPageSetup *page_setup = gtk_page_setup_new();
-    gdouble doc_width = sp_document_width(_doc) * PT_PER_PX;
-    gdouble doc_height = sp_document_height(_doc) * PT_PER_PX;
+    gdouble doc_width = _doc->getWidth() * PT_PER_PX;
+    gdouble doc_height = _doc->getHeight() * PT_PER_PX;
     GtkPaperSize *paper_size;
-    if (sp_document_landscape(_doc)) {
+    if (doc_width > doc_height) {
         gtk_page_setup_set_orientation (page_setup, GTK_PAGE_ORIENTATION_LANDSCAPE);
         paper_size = gtk_paper_size_new_custom("custom", "custom",
                                                doc_height, doc_width, GTK_UNIT_POINTS);
@@ -236,4 +241,4 @@ Gtk::PrintOperationResult Print::run(Gtk::PrintOperationAction, Gtk::Window &par
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :