print.cpp revision d16495c17bbc27ff37e18ea3eb61f6b07448152a
/**
* @file
* Print dialog.
*/
/* Authors:
* Kees Cook <kees@outflux.net>
* Abhishek Sharma
*
* Copyright (C) 2007 Kees Cook
* Released under GNU GPL. Read the file 'COPYING' for more information.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef WIN32
#include <io.h>
#include <windows.h>
#endif
#include "print.h"
#include "extension/internal/cairo-render-context.h"
#include "extension/internal/cairo-renderer.h"
#include "ui/widget/rendering-options.h"
#include "document.h"
#include "helper/png-write.h"
#include "svg/svg-color.h"
static void draw_page(
#ifdef WIN32
#else
#endif
gint /*page_nr*/,
{
//printf("%s %d\n",__FUNCTION__, page_nr);
// Render as exported PNG
int tmp_fd;
}
double opacity = 1.0;
}
// This doesn't seem to work:
//context->set_cairo_context ( Cairo::Context::create (Cairo::ImageSurface::create_from_png (tmp_png) ), dpi, dpi );
//
// so we'll use a surface pattern blat instead...
//
// but the C++ interface isn't implemented in cairomm:
//context->get_cairo_context ()->set_source_surface(Cairo::ImageSurface::create_from_png (tmp_png) );
//
// so do it in C:
{
cairo_get_matrix(cr, &m);
cairo_scale(cr, Inkscape::Util::Quantity::convert(1, "in", "pt") / dpi, Inkscape::Util::Quantity::convert(1, "in", "pt") / dpi);
// FIXME: why is the origin offset??
cairo_set_matrix(cr, &m);
}
// Clean up
}
else {
g_warning(_("Could not open temporary PNG for bitmap printing"));
}
}
else {
// Render as vectors
// ctx->setPSLevel(CAIRO_PS_LEVEL_3);
ctx->setTextToPath(false);
ctx->setFilterToBitmap(true);
#ifdef WIN32
//Gtk+ does not take the non printable area into account
//
// This workaround translates the origin from the top left of the
// printable area to the top left of the page.
if (hdc) {
}
#endif
if (ret) {
if (ret) {
}
else {
g_warning(_("Could not set up Document"));
}
}
else {
g_warning(_("Failed to set CairoRenderContext"));
}
// Clean up
}
}
{
//printf("%s\n",__FUNCTION__);
}
GtkPrintContext */*context*/,
gpointer /*user_data*/)
{
//printf("%s\n",__FUNCTION__);
}
namespace Inkscape {
namespace UI {
namespace Dialog {
{
// set up dialog title, based on document name
title += " ";
// set up paper size to match the document size
if (doc_width > doc_height) {
} else {
}
// set up signals
g_signal_connect (_printop, "create-custom-widget", G_CALLBACK (create_custom_widget), _tab.gobj());
// build custom preferences tab
}
{
return Gtk::PRINT_OPERATION_RESULT_APPLY;
}
} // namespace Dialog
} // namespace UI
} // namespace Inkscape
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :