Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2006-12-27 17:33:22 (GMT)
committer Carlos Garcia Campos <carlosgc@src.gnome.org>2006-12-27 17:33:22 (GMT)
commitf7c3085a0e3c5c813cf9ae40b55fd7390e9373e2 (patch)
tree0e54d7c36a9dc4393056f67cc14061a58aceeff1 /shell
parente9b31a6dcb17880596c0fab43d606294ffc5c17b (diff)
Add page transition support in presentation mode. At the moment only page
2006-12-27 Carlos Garcia Campos <carlosgc@gnome.org> * configure.ac: * backend/Makefile.am: * backend/ev-document-transition.[ch]: * pdf/ev-poppler.cc: (pdf_document_get_page_duration), (pdf_document_page_transition_iface_init): * shell/ev-view-private.h: * shell/ev-view.c: (ev_view_destroy), (page_changed_cb), (ev_view_set_presentation), (transition_next_page), (ev_view_presentation_transition_stop), (ev_view_presentation_transition_start), (ev_view_next_page): Add page transition support in presentation mode. At the moment only page duration is supported, but not transition effects. Fixes bug #309815.
Diffstat (limited to 'shell')
-rw-r--r--shell/ev-view-private.h1
-rw-r--r--shell/ev-view.c49
2 files changed, 50 insertions, 0 deletions
diff --git a/shell/ev-view-private.h b/shell/ev-view-private.h
index d03a936..f1f5ad5 100644
--- a/shell/ev-view-private.h
+++ b/shell/ev-view-private.h
@@ -111,6 +111,7 @@ struct _EvView {
EvPresentationState presentation_state;
EvSizingMode sizing_mode_saved;
double scale_saved;
+ guint trans_timeout_id;
/* Common for button press handling */
int pressed_button;
diff --git a/shell/ev-view.c b/shell/ev-view.c
index ad7ef61..a7bae3d 100644
--- a/shell/ev-view.c
+++ b/shell/ev-view.c
@@ -36,6 +36,7 @@
#include "ev-selection.h"
#include "ev-document-links.h"
#include "ev-document-find.h"
+#include "ev-document-transition.h"
#include "ev-document-misc.h"
#include "ev-debug.h"
#include "ev-job-queue.h"
@@ -312,6 +313,10 @@ static void ev_view_primary_clear_cb (GtkClipboard
gpointer data);
static void ev_view_update_primary_selection (EvView *ev_view);
+/*** Presentation ***/
+static void ev_view_presentation_transition_start (EvView *ev_view);
+static void ev_view_presentation_transition_stop (EvView *ev_view);
+
G_DEFINE_TYPE (EvView, ev_view, GTK_TYPE_WIDGET)
@@ -2814,6 +2819,8 @@ ev_view_destroy (GtkObject *object)
view->selection_update_id = 0;
}
+ ev_view_presentation_transition_stop (view);
+
ev_view_set_scroll_adjustments (view, NULL, NULL);
GTK_OBJECT_CLASS (ev_view_parent_class)->destroy (object);
@@ -3163,6 +3170,8 @@ page_changed_cb (EvPageCache *page_cache,
if (view->current_page != new_page) {
view->current_page = new_page;
view->pending_scroll = SCROLL_TO_PAGE_POSITION;
+ if (view->presentation)
+ ev_view_presentation_transition_start (view);
gtk_widget_queue_resize (GTK_WIDGET (view));
} else {
gtk_widget_queue_draw (GTK_WIDGET (view));
@@ -3427,6 +3436,11 @@ ev_view_set_presentation (EvView *view,
gtk_widget_queue_resize (GTK_WIDGET (view));
+ if (presentation)
+ ev_view_presentation_transition_start (view);
+ else
+ ev_view_presentation_transition_stop (view);
+
if (GTK_WIDGET_REALIZED (view)) {
if (view->presentation)
gdk_window_set_background (GTK_WIDGET(view)->window,
@@ -3447,6 +3461,40 @@ ev_view_get_presentation (EvView *view)
return view->presentation;
}
+static gboolean
+transition_next_page (EvView *view)
+{
+ ev_view_next_page (view);
+
+ return FALSE;
+}
+
+static void
+ev_view_presentation_transition_stop (EvView *view)
+{
+ if (view->trans_timeout_id > 0)
+ g_source_remove (view->trans_timeout_id);
+ view->trans_timeout_id = 0;
+}
+
+static void
+ev_view_presentation_transition_start (EvView *view)
+{
+ gdouble duration;
+
+ if (!EV_IS_DOCUMENT_TRANSITION (view->document))
+ return;
+
+ ev_view_presentation_transition_stop (view);
+
+ duration = ev_document_transition_get_page_duration (EV_DOCUMENT_TRANSITION (view->document),
+ view->current_page);
+ if (duration > 0)
+ view->trans_timeout_id = g_timeout_add (duration * 1000,
+ (GSourceFunc) transition_next_page,
+ view);
+}
+
void
ev_view_set_sizing_mode (EvView *view,
EvSizingMode sizing_mode)
@@ -4556,6 +4604,7 @@ ev_view_next_page (EvView *view)
if (!view->page_cache)
return FALSE;
+ ev_view_presentation_transition_stop (view);
ev_view_reset_presentation_state (view);
page = ev_page_cache_get_current_page (view->page_cache);