summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ada8703)
raw | patch | inline | side by side (parent: ada8703)
author | keescook <keescook@users.sourceforge.net> | |
Sat, 29 Dec 2007 12:59:05 +0000 (12:59 +0000) | ||
committer | keescook <keescook@users.sourceforge.net> | |
Sat, 29 Dec 2007 12:59:05 +0000 (12:59 +0000) |
src/ui/dialog/print.cpp | patch | blob | history | |
src/ui/dialog/print.h | patch | blob | history | |
src/ui/widget/rendering-options.cpp | patch | blob | history |
index 6740247cd57697fcb13d20d6b4d75c8602593041..3c6f9de4cae9b8c60310e38286714d0e9d41885a 100644 (file)
--- a/src/ui/dialog/print.cpp
+++ b/src/ui/dialog/print.cpp
namespace Dialog {
void
-Print::_draw_page (const Glib::RefPtr<Gtk::PrintContext> &context, int /*page_nr*/)
+Print::on_begin_print(const Glib::RefPtr<Gtk::PrintContext> &context)
{
+ //printf("%s\n",__FUNCTION__);
+ set_n_pages (1);
+}
+
+bool
+Print::on_paginate(const Glib::RefPtr<Gtk::PrintContext> &context)
+{
+ /* this should not be called since begin-print sets the n pages */
+ //printf("%s\n",__FUNCTION__);
+ set_n_pages (1);
+ return false;
+}
+
+void
+Print::on_draw_page (const Glib::RefPtr<Gtk::PrintContext> &context, int page_nr)
+{
+ //printf("%s %d\n",__FUNCTION__, page_nr);
if (_tab.as_bitmap()) {
// Render as exported PNG
gdouble width = sp_document_width(_doc);
sp_export_png_file(_doc, tmp_png.c_str(), 0.0, 0.0,
width, height,
- (unsigned long)width * dpi / PX_PER_IN,
- (unsigned long)height * dpi / PX_PER_IN,
+ (unsigned long)(width * dpi / PX_PER_IN),
+ (unsigned long)(height * dpi / PX_PER_IN),
dpi, dpi, bgcolor, NULL, NULL, true, NULL);
// This doesn't seem to work:
@@ -109,18 +126,13 @@ Print::_draw_page (const Glib::RefPtr<Gtk::PrintContext> &context, int /*page_nr
}
Gtk::Widget *
-Print::_create_custom_widget ()
+Print::on_create_custom_widget ()
{
return &_tab;
}
-void
-Print::_custom_widget_apply (Gtk::Widget */*widget*/)
-{
- g_warning (_("custom widget apply"));
-}
-
Print::Print(SPDocument *doc, SPItem *base) :
+ Gtk::PrintOperation (),
_doc (doc),
_base (base),
_tab ()
g_assert (_doc);
g_assert (_base);
- _printop = Gtk::PrintOperation::create();
-
// set up dialog title, based on document name
gchar *jobname = _doc->name ? _doc->name : _("SVG Document");
Glib::ustring title = _("Print");
title += " ";
title += jobname;
- _printop->set_job_name (title);
- _printop->set_n_pages (1);
+ set_job_name (title);
+ set_n_pages (1);
// set up paper size to match the document size
Glib::RefPtr<Gtk::PageSetup> page_setup = Gtk::PageSetup::create();
Gtk::PaperSize paper_size(Glib::ustring("custom"), Glib::ustring("custom"),
doc_width, doc_height, Gtk::UNIT_POINTS);
page_setup->set_paper_size (paper_size);
- _printop->set_default_page_setup (page_setup);
+ set_default_page_setup (page_setup);
// build custom preferences tab
- _printop->set_custom_tab_label (Glib::ustring(_("Rendering")));
- _printop->signal_create_custom_widget().connect(sigc::mem_fun(*this, &Print::_create_custom_widget));
-// _printop->signal_custom_widget_apply().connect(sigc::mem_fun(*this, &Print::_custom_widget_apply));
-
- // register actual page surface drawing callback
- _printop->signal_draw_page().connect(sigc::mem_fun(*this, &Print::_draw_page));
-
-}
-
-Gtk::PrintOperationResult
-Print::run(Gtk::PrintOperationAction action, Gtk::Window& parent)
-{
- Gtk::PrintOperationResult res;
- res = _printop->run (action, parent);
- return res;
+ set_custom_tab_label (Glib::ustring(_("Rendering")));
}
diff --git a/src/ui/dialog/print.h b/src/ui/dialog/print.h
index 721c910ffd77f1c5f4d3ed452922a2e894a95b81..fb8876dc0500376fa39f87ac36db0228a586d825 100644 (file)
--- a/src/ui/dialog/print.h
+++ b/src/ui/dialog/print.h
#define INKSCAPE_UI_DIALOG_PRINT_H
#include <glibmm/i18n.h>
-#include <gtkmm/printoperation.h> // GtkMM
+#include <gtkmm/printoperation.h> // GtkMM printoperation
#include <gtk/gtkprintoperation.h> // Gtk
#include "desktop.h"
namespace UI {
namespace Dialog {
-class Print {
+class Print : public Gtk::PrintOperation {
public:
Print(SPDocument *doc, SPItem *base);
- Gtk::PrintOperationResult run(Gtk::PrintOperationAction action, Gtk::Window& parentWindow);
- //GtkPrintOperationResult run(GtkPrintOperationAction action);
-
protected:
- Glib::RefPtr<Gtk::PrintOperation> _printop;
- //GtkPrintOperation *_printop;
+ Gtk::Widget *on_create_custom_widget ();
- Gtk::Widget *_create_custom_widget ();
- void _custom_widget_apply (Gtk::Widget *widget);
- void _draw_page (const Glib::RefPtr<Gtk::PrintContext> &context,
+ void on_begin_print(const Glib::RefPtr<Gtk::PrintContext> &context);
+ bool on_paginate(const Glib::RefPtr<Gtk::PrintContext> &context);
+ void on_draw_page (const Glib::RefPtr<Gtk::PrintContext> &context,
int page_nr);
private:
index 8a00bcc5d2803b94b9a2b1afbe5f1fac82751772..9ea7c07bdc691eff48bc66d0c1e73fbdfbee6a75 100644 (file)
_radio_cairo ( new Gtk::RadioButton () ),
//_radio_bitmap( new Gtk::RadioButton (_radio_cairo->get_group ()),
_radio_bitmap( new Gtk::RadioButton () ),
- _widget_cairo( Glib::ustring(_("_Cairo")),
+ _widget_cairo( Glib::ustring(_("_Vector")),
Glib::ustring(_("Render using Cairo vector operations. The resulting image is usually smaller in file "
"size and can be arbitrarily scaled, but some "
"filter effects will not be correctly rendered.")),