From 826a1119219108587e8300eaab2bfc951182cd7d Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 4 Jan 2008 20:25:52 +0000 Subject: [PATCH] Added implementation to get_effect() in EvDocumentTransitionIface. 2008-01-04 Carlos Garnacho * backend/pdf/ev-poppler.cc (pdf_document_get_effect): Added implementation to get_effect() in EvDocumentTransitionIface. svn path=/trunk/; revision=2797 --- ChangeLog | 5 +++++ backend/pdf/ev-poppler.cc | 40 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/ChangeLog b/ChangeLog index f28e3470..ba54f489 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-01-04 Carlos Garnacho + + * backend/pdf/ev-poppler.cc (pdf_document_get_effect): Added + implementation to get_effect() in EvDocumentTransitionIface. + 2008-01-04 Carlos Garnacho * libdocument/ev-transition-effect.[ch]: New files, define a page diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc index 5b039804..7c3a594d 100644 --- a/backend/pdf/ev-poppler.cc +++ b/backend/pdf/ev-poppler.cc @@ -45,6 +45,7 @@ #include "ev-document-transition.h" #include "ev-document-forms.h" #include "ev-selection.h" +#include "ev-transition-effect.h" #include "ev-attachment.h" #include "ev-image.h" @@ -1967,10 +1968,49 @@ pdf_document_get_page_duration (EvDocumentTransition *trans, return duration; } +static EvTransitionEffect * +pdf_document_get_effect (EvDocumentTransition *trans, + gint page) +{ + PdfDocument *pdf_document; + PopplerPage *poppler_page; + PopplerPageTransition *page_transition; + EvTransitionEffect *effect; + + pdf_document = PDF_DOCUMENT (trans); + poppler_page = poppler_document_get_page (pdf_document->document, page); + + if (!poppler_page) + return NULL; + + page_transition = poppler_page_get_transition (poppler_page); + + if (!page_transition) { + g_object_unref (poppler_page); + return NULL; + } + + /* enums in PopplerPageTransition match the EvTransitionEffect ones */ + effect = ev_transition_effect_new ((EvTransitionEffectType) page_transition->type, + "alignment", page_transition->alignment, + "direction", page_transition->direction, + "duration", page_transition->duration, + "angle", page_transition->angle, + "scale", page_transition->scale, + "rectangular", page_transition->rectangular, + NULL); + + poppler_page_transition_free (page_transition); + g_object_unref (poppler_page); + + return effect; +} + static void pdf_document_page_transition_iface_init (EvDocumentTransitionIface *iface) { iface->get_page_duration = pdf_document_get_page_duration; + iface->get_effect = pdf_document_get_effect; } /* Forms */ -- 2.43.5