#include "ev-transition-animation.h"
#include "ev-view-cursor.h"
#include "ev-page-cache.h"
+#include "ev-view-marshal.h"
enum {
PROP_0,
};
enum {
+ PAGE_CHANGED,
CHANGE_PAGE,
FINISHED,
SIGNAL_EXTERNAL_LINK,
GtkWidgetClass base_class;
/* signals */
+ void (* page_changed) (EvViewPresentation *pview,
+ gint old_page,
+ gint new_page);
void (* change_page) (EvViewPresentation *pview,
GtkScrollType scroll);
void (* finished) (EvViewPresentation *pview);
}
}
+ g_signal_emit (pview, signals[PAGE_CHANGED], 0, pview->current_page);
+
pview->current_page = page;
if (pview->page_cache)
gtk_widget_queue_draw (GTK_WIDGET (pview));
}
+void
+ev_view_presentation_set_page (EvViewPresentation *pview, gint new_page)
+{
+ guint n_pages;
+
+ n_pages = ev_document_get_n_pages (pview->document);
+
+ if (new_page >= n_pages)
+ ev_view_presentation_set_end (pview);
+ else
+ ev_view_presentation_update_current_page (pview, new_page);
+}
+
void
ev_view_presentation_next_page (EvViewPresentation *pview)
{
static GObject *
ev_view_presentation_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_params)
+ guint n_construct_properties,
+ GObjectConstructParam *construct_params)
{
GObject *object;
EvViewPresentation *pview;
g_cclosure_marshal_VOID__ENUM,
G_TYPE_NONE, 1,
GTK_TYPE_SCROLL_TYPE);
+ signals [PAGE_CHANGED] =
+ g_signal_new ("page-changed",
+ EV_TYPE_VIEW_PRESENTATION,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EvViewPresentationClass, page_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE, 2,
+ G_TYPE_INT, G_TYPE_INT);
signals[FINISHED] =
g_signal_new ("finished",
G_OBJECT_CLASS_TYPE (gobject_class),
#include "ev-dualscreen.h"
#include "ev-window.h"
#include "ev-view.h"
+#include "ev-view-presentation.h"
#include "ev-utils.h"
#include "ev-sidebar.h"
#include "ev-sidebar-thumbnails.h"
GtkWidget *overview_scrolled_window;
GtkWidget *notesview_scrolled_window;
+ GtkWidget *presentation_window;
- EvWindow *presentation_window;
+ EvView *presentation_view;
EvDocument * presentation_document;
gint moveback_monitor;
};
#define EV_DSCWINDOW_GET_PRIVATE(object) \
(G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_DSCWINDOW, EvDSCWindowPrivate))
#define PAGE_CACHE_SIZE 52428800 /* 50MB */
+#define SIDEBAR_DEFAULT_SIZE 132
/*static gpointer parent_class = NULL;*/
ev_dscwindow_window_placement (EvDSCWindow *ev_dscwindow)
{
gint num_monitors = get_num_monitors (GTK_WINDOW (ev_dscwindow));
- if (num_monitors == 2) {
+ g_printf ("num_monitors: %d \n",num_monitors);
+ //if (num_monitors == 2) {
GtkWindow * presentation_window = GTK_WINDOW (ev_dscwindow->priv->presentation_window);
GdkScreen * screen = gtk_window_get_screen (presentation_window);
-
gint work_monitor = gdk_screen_get_monitor_at_window (screen,
gtk_widget_get_window (GTK_WIDGET (presentation_window)));
-
gint presentation_monitor = (work_monitor + 1) % 2;
-
GdkRectangle coords;
gdk_screen_get_monitor_geometry (screen, presentation_monitor,
&coords);
gtk_window_move (presentation_window, coords.x, coords.y);
- ev_window_run_presentation (ev_dscwindow->priv->presentation_window);
+ //ev_window_run_presentation (ev_dscwindow->priv->presentation_window);
ev_dscwindow->priv->moveback_monitor = work_monitor;
-
gtk_window_maximize (GTK_WINDOW (ev_dscwindow));
- }
+ //}
}
+/**
+ * ev_dscwindow_page_changed_cb: Callback to change page on all views
+ *
+ **/
+static void
+ev_dscwindow_page_changed_cb (EvDocumentModel *model,
+ GParamSpec *pspec,
+ EvDSCWindow *ev_dscwindow)
+{
+ gint page = ev_document_model_get_page (model);
+ g_printf("page:%d\n",page);
+ ev_view_presentation_set_page (EV_VIEW_PRESENTATION(ev_dscwindow->priv->presentation_view), page);
+}
+static void
+ev_dscwindow_presentation_page_changed_cb (EvDocumentModel *model,
+ GParamSpec *pspec,
+ EvDSCWindow *ev_dscwindow)
+{
+ gint page = ev_view_presentation_get_current_page (ev_dscwindow->priv->presentation_view);
+ ev_document_model_set_page (ev_dscwindow->priv->model, page);
+}
/**
* ev_dscwindow_set_presentation: Set presentation document
**/
void
ev_dscwindow_set_presentation (EvDSCWindow *ev_dscwindow,
- EvWindow *presentation_window, EvDocument *document)
+ EvWindow *presentation_window, EvDocument *document, GtkWidget *pview)
{
if (!EV_IS_WINDOW (presentation_window))
return;
ev_dscwindow->priv->presentation_window = presentation_window;
ev_dscwindow->priv->presentation_document = document;
-
+ ev_dscwindow->priv->presentation_view = pview;
+ g_signal_connect (ev_dscwindow->priv->presentation_view,
+ "notify::page",
+ G_CALLBACK (ev_dscwindow_presentation_page_changed_cb),
+ ev_dscwindow);
ev_document_model_set_document(ev_dscwindow->priv->model,
document);
-/* ev_view_set_document (EV_VIEW (priv->notesview),
- priv->presentation_document);*/
ev_dscwindow_window_placement (ev_dscwindow);
- /*ev_dscwindow_handle_resized (NULL, NULL, self);
- */
}
/**
/**
* ev_dscwindow_init: Initialize multihead presentation
*
-* @self: EvDSCWindow.
+* @ev_dscwindow: EvDSCWindow.
*
* ev_dscwindow_set_presentation has to be called afterwards for loading in a document. TBD
**/
GtkWidget *v = gtk_vbox_new (FALSE, 0);
ev_dscwindow->priv->model = ev_document_model_new ();
-
+ g_signal_connect (ev_dscwindow->priv->model,
+ "notify::page",
+ G_CALLBACK (ev_dscwindow_page_changed_cb),
+ ev_dscwindow);
ev_dscwindow->priv->overview = ev_sidebar_new ();
ev_sidebar_set_model (EV_SIDEBAR (ev_dscwindow->priv->overview),
ev_dscwindow->priv->model);
-/* gtk_paned_pack1 (GTK_PANED (h),
- ev_dscwindow->priv->overview, FALSE, FALSE);*/
- gtk_box_pack_start (GTK_BOX (v), ev_dscwindow->priv->overview, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (v), ev_dscwindow->priv->overview, TRUE , TRUE, 0);
gtk_widget_show (ev_dscwindow->priv->overview);
- /* Stub sidebar, for now */
-
GtkWidget *sidebar_widget;
sidebar_widget = ev_sidebar_thumbnails_new ();
- /*ev_window->priv->sidebar_thumbs = sidebar_widget;*/
/*g_signal_connect (sidebar_widget,
"notify::main-widget",
G_CALLBACK (sidebar_page_main_widget_update_cb),
ev_document_model_set_dual_page (ev_dscwindow->priv->model, FALSE);
ev_document_model_set_sizing_mode (ev_dscwindow->priv->model, EV_SIZING_BEST_FIT);
-
-/* gtk_container_add (GTK_CONTAINER (ev_dscwindow->priv->overview_scrolled_window),
- ev_dscwindow->priv->overview);
- */
-
GtkWidget *e = gtk_expander_new (_("Expensive features"));
gtk_expander_set_expanded (GTK_EXPANDER (e), TRUE);
gtk_container_add (GTK_CONTAINER (ev_dscwindow->priv->notesview_scrolled_window),
ev_dscwindow->priv->notesview);
ev_view_set_model (EV_VIEW (ev_dscwindow->priv->notesview), ev_dscwindow->priv->model);
-
- gtk_paned_set_position (GTK_PANED (h), 400);
gtk_widget_show_all (h);
gtk_container_add (GTK_CONTAINER (ev_dscwindow), h);
/* fallback if we have >2 monitors (see window placement) */
/*+ gtk_window_set_default_size (GTK_WINDOW (self), 800, 600);
+
-+ g_signal_connect (h, "notify::position",
-+ G_CALLBACK (ev_dscwindow_handle_resized), self);
-+
-+ g_signal_connect (self, "size-allocate",
-+ G_CALLBACK (ev_dscwindow_handle_resized), self);
+
+ /* This would just open new windows. */
/*+ gtk_drag_dest_unset (GTK_WIDGET (priv->notesview));
EvDSCWindow * ev_dscwindow = EV_DSCWINDOW (obj);
EvDSCWindowPrivate *priv = ev_dscwindow->priv;
-/* if (EV_IS_VIEW (priv->overview) {
- ev_document_model_set_document (priv->model, NULL);
+// if (EV_IS_VIEW (priv->overview) {
+// ev_document_model_set_document (priv->model, NULL);
-+ ev_view_set_document (EV_VIEW (priv->overview), NULL);
-+ g_object_unref (priv->overview);
-+ }
-+ if (EV_IS_VIEW (priv->notesview)) {
-+ ev_view_set_document (EV_VIEW (priv->notesview), NULL);
-+ g_object_unref (priv->notesview);
-+ }*/
+// ev_view_set_document (EV_VIEW (priv->overview), NULL);
+ g_object_unref (priv->overview);
+// }
+// if (EV_IS_VIEW (priv->notesview)) {
+// ev_view_set_document (EV_VIEW (priv->notesview), NULL);
+// g_object_unref (priv->notesview);
+// }
/*TODO: save fulscreen state*/
ev_window_stop_presentation (priv->presentation_window, 0);
G_OBJECT_CLASS (ev_dscwindow_parent_class)->dispose (obj);
}
-
static void
ev_dscwindow_class_init (EvDSCWindowClass *ev_dscwindow_class)
{
gboolean unfullscreen_window);
static void ev_window_cmd_view_fullscreen (GtkAction *action,
EvWindow *window);
-static void ev_window_run_presentation_wrapper (EvWindow *window);
-static void ev_window_stop_presentation_wrapper (EvWindow *window,
- gboolean unfullscreen_window);
static void ev_window_cmd_view_presentation (GtkAction *action,
EvWindow *window);
static void ev_view_popup_cmd_open_link (GtkAction *action,
update_document_mode (EvWindow *window, EvDocumentMode mode)
{
if (mode == EV_DOCUMENT_MODE_PRESENTATION) {
- ev_window_run_presentation_wrapper (window);
+ ev_window_run_presentation (window);
}
else if (mode == EV_DOCUMENT_MODE_FULL_SCREEN) {
ev_window_run_fullscreen (window);
/* Presentation */
if (ev_metadata_get_boolean (window->priv->metadata, "presentation", &presentation)) {
if (presentation) {
- ev_window_run_presentation_wrapper (window);
+ ev_window_run_presentation (window);
}
}
}
/* Update the model with the current presentation page */
ev_document_model_set_page (ev_window->priv->model, current_page);
- ev_window_run_presentation_wrapper (ev_window);
+ ev_window_run_presentation (ev_window);
}
if (ev_window->priv->setup_document_idle > 0)
ev_window_run_fullscreen (ev_window);
break;
case EV_WINDOW_MODE_PRESENTATION:
- ev_window_run_presentation_wrapper (ev_window);
+ ev_window_run_presentation (ev_window);
break;
default:
break;
ev_window_run_fullscreen (ev_window);
break;
case EV_WINDOW_MODE_PRESENTATION:
- ev_window_run_presentation_wrapper (ev_window);
+ ev_window_run_presentation (ev_window);
break;
default:
break;
return FALSE;
}
-static void
-ev_window_run_presentation_wrapper (EvWindow *window)
-{
- /*if ( get_num_monitors(GTK_WINDOW(window)) > 1) {*/
- EvWindow *presentation_window = window;
- EvDSCWindow *control = ev_dscwindow_get_control();
-
- ev_dscwindow_set_presentation (control, presentation_window,
- presentation_window->priv->document);
- gtk_window_present (GTK_WINDOW (control));
- /*} else
- ev_window_run_presentation (window);*/
-
-}
-static void
-ev_window_stop_presentation_wrapper(EvWindow *window, gboolean unfullscreen_window)
-{
-}
-
void
ev_window_run_presentation (EvWindow *window)
{
current_page,
rotation,
inverted_colors);
+
g_signal_connect_swapped (window->priv->presentation_view, "finished",
G_CALLBACK (ev_window_view_presentation_finished),
window);
if (window->priv->metadata && !ev_window_is_empty (window))
ev_metadata_set_boolean (window->priv->metadata, "presentation", TRUE);
+ //if ( get_num_monitors(GTK_WINDOW(window)) > 1) {
+
+ EvDSCWindow *control = ev_dscwindow_get_control();
+ ev_dscwindow_set_presentation (control, window,
+ window->priv->document,
+ window->priv->presentation_view);
+ gtk_window_present (GTK_WINDOW (control));
+ //}
}
void
presentation = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (presentation) {
- ev_window_run_presentation_wrapper (window);
+ ev_window_run_presentation (window);
}
}
static void
ev_window_cmd_start_presentation (GtkAction *action, EvWindow *window)
{
- ev_window_run_presentation_wrapper (window);
+ ev_window_run_presentation (window);
}
static void
* often seen keys
*/
if (strcmp (key, "Play") == 0) {
- ev_window_run_presentation_wrapper (window);
+ ev_window_run_presentation (window);
} else if (strcmp (key, "Previous") == 0) {
if (EV_WINDOW_IS_PRESENTATION (window))
ev_view_presentation_previous_page (EV_VIEW_PRESENTATION (window->priv->presentation_view));