summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9f1a03c)
raw | patch | inline | side by side (parent: 9f1a03c)
author | miklosh <miklosh@users.sourceforge.net> | |
Sun, 19 Aug 2007 16:23:36 +0000 (16:23 +0000) | ||
committer | miklosh <miklosh@users.sourceforge.net> | |
Sun, 19 Aug 2007 16:23:36 +0000 (16:23 +0000) |
configure.ac | patch | blob | history | |
src/extension/internal/pdfinput/pdf-input.cpp | patch | blob | history | |
src/extension/internal/pdfinput/pdf-input.h | patch | blob | history |
diff --git a/configure.ac b/configure.ac
index 8e063e0ece77e29fdabb7f34532f7a0da3ecf2a0..0210bd507d0d81cc370a434e220b8d4f1c495d5f 100644 (file)
--- a/configure.ac
+++ b/configure.ac
dnl ******************************
POPPLER_CFLAGS=""
-PKG_CHECK_MODULES(POPPLER, poppler >= 0.5.5, poppler=yes, poppler=no)
+PKG_CHECK_MODULES(POPPLER, poppler >= 0.5.9, poppler=yes, poppler=no)
if test "x$poppler" = "xyes"; then
dnl Working libpoppler
POPPLER_LIBS="-lpoppler "
dnl Have to test libpoppler-glib presence
- PKG_CHECK_MODULES(POPPLER_GLIB, poppler-glib >= 0.5.5, poppler_glib=yes, poppler_glib=no)
+ PKG_CHECK_MODULES(POPPLER_GLIB, poppler-glib >= 0.5.9, poppler_glib=yes, poppler_glib=no)
if test "x$poppler_glib" = "xyes"; then
dnl Working libpoppler-glib found
dnl Check whether the Cairo SVG backend is available
POPPLER_LIBS="$POPPLER_LIBS -lpoppler-glib "
fi
fi
+ dnl Have to test libpoppler-cairo presence for PDF preview
+ PKG_CHECK_MODULES(POPPLER_CAIRO, poppler-cairo >= 0.5.9, poppler_cairo=yes, poppler_cairo=no)
+ if test "x$poppler_cairo" = "xyes"; then
+ dnl Working libpoppler-cairo found
+ dnl Check whether the Cairo FreeType backend is available
+ PKG_CHECK_MODULES(CAIRO_FT, cairo-ft, cairo_ft=yes, cairo_ft=no)
+ fi
fi
if test "x$poppler" = "xyes"; then
LIBS="$LIBS $POPPLER_LIBS"
AC_DEFINE(HAVE_POPPLER, 1, [Use libpoppler for direct PDF import])
fi
+if test "x$cairo_ft" = "xyes"; then
+ AC_DEFINE(HAVE_POPPLER_CAIRO, 1, [Use libpoppler-cairo for rendering PDF preview])
+fi
if test "x$poppler_glib" = "xyes" -a "x$cairo_svg" = "xyes"; then
AC_DEFINE(HAVE_POPPLER_GLIB, 1, [Use libpoppler-glib and Cairo-SVG for PDF import])
fi
diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp
index 75940ff56f2f9ecad8d6c54f2cdde14b7f11bd00..759a84017c81fbe0008aa7de0c40b0cae06457b9 100644 (file)
_cropCheck->signal_toggled().connect(sigc::mem_fun(*this, &PdfImportDialog::_onToggleCropping));
_fallbackPrecisionSlider_adj->signal_value_changed().connect(sigc::mem_fun(*this, &PdfImportDialog::_onPrecisionChanged));
+#ifdef HAVE_POPPLER_CAIRO
// Create an OutputDev
_preview_output_dev = new CairoOutputDev();
_preview_output_dev->startDoc(_pdf_doc->getXRef());
+ _cairo_surface = NULL;
+#endif
// Set default preview size
_preview_width = 200;
// Init preview
_thumb_data = NULL;
- _cairo_surface = NULL;
_pageNumberSpin_adj->set_value(1.0);
}
PdfImportDialog::~PdfImportDialog() {
+#ifdef HAVE_POPPLER_CAIRO
if (_preview_output_dev) {
delete _preview_output_dev;
}
if (_cairo_surface) {
cairo_surface_destroy(_cairo_surface);
}
+#endif
if (_thumb_data) {
delete _thumb_data;
}
_setPreviewPage(_current_page);
}
+#ifdef HAVE_POPPLER_CAIRO
/**
* \brief Copies image data from a Cairo surface to a pixbuf
*
}
}
}
+#endif
/**
* \brief Updates the preview area with the previously rendered thumbnail
*/
bool PdfImportDialog::_onExposePreview(GdkEventExpose *event) {
+#ifdef HAVE_POPPLER_CAIRO
Glib::RefPtr<Gdk::Pixbuf> thumb = Gdk::Pixbuf::create(Gdk::COLORSPACE_RGB, true,
8, _thumb_width, _thumb_height);
// Set background to white
_previewArea->get_window()->draw_pixbuf(Glib::RefPtr<Gdk::GC>(), thumb,
0, 0, 0, 0, -1, -1,
Gdk::RGB_DITHER_NONE, 0, 0);
+#endif
return true;
}
*/
void PdfImportDialog::_setPreviewPage(int page) {
+#ifdef HAVE_POPPLER_CAIRO
_previewed_page = _pdf_doc->getCatalog()->getPage(page);
// TODO: When available, obtain the thumbnail from the PDF document itself
// Get page size by accounting for rotation
// Redraw preview area
_previewArea->set_size_request(_preview_width, _preview_height);
_previewArea->queue_draw();
+#endif
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/src/extension/internal/pdfinput/pdf-input.h b/src/extension/internal/pdfinput/pdf-input.h
index b7d3de774a600f9ef58498177a6e8735a3dab8bf..6e4388cb176487a28d0498bd1f2f06462b3652de 100644 (file)
#include <gdk/gdk.h>
#include "PDFDoc.h"
-#include "CairoOutputDev.h"
+#ifdef HAVE_POPPLER_CAIRO
+#include <CairoOutputDev.h>
+#endif
namespace Inkscape {
namespace Extension {
unsigned char *_thumb_data; // Thumbnail image data
int _thumb_width, _thumb_height; // Thumbnail size
int _preview_width, _preview_height; // Size of the preview area
+#ifdef HAVE_POPPLER_CAIRO
cairo_surface_t *_cairo_surface;
CairoOutputDev *_preview_output_dev;
+#endif
};