Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Blandford <jrb@redhat.com>2005-05-01 04:51:37 (GMT)
committer Jonathan Blandford <jrb@src.gnome.org>2005-05-01 04:51:37 (GMT)
commit2df8e54f39de7e26c981bbc5cae892230c65f3bd (patch)
tree33505438e735f9e1518e01b0f231dc4c94b011e8
parentbaece60ad5ed1ad3c89dfe67246caa4891e174cf (diff)
Change the preview cache back to 1. Don't know when it got set to 0.
Sun May 1 00:46:47 2005 Jonathan Blandford <jrb@redhat.com> * shell/ev-pixbuf-cache.c: (ev_pixbuf_cache_init): Change the preview cache back to 1. Don't know when it got set to 0. * shell/ev-view.c: (compute_border), (ev_view_realize), (draw_one_page), (ev_view_set_property), (ev_view_get_property), (ev_view_class_init), (ev_view_init), (ev_view_set_fullscreen), (ev_view_get_fullscreen), (ev_view_set_presentation), (ev_view_get_presentation), (ev_view_set_sizing_mode), (ev_view_zoom_for_size_presentation), (ev_view_set_zoom_for_size): * shell/ev-view.h: * shell/ev-window.c: (update_chrome_visibility), (ev_window_cmd_continuous), (ev_window_cmd_dual), (ev_window_cmd_view_best_fit), (ev_window_cmd_view_page_width), (update_document_mode), (ev_window_update_fullscreen_action), (ev_window_fullscreen), (ev_window_unfullscreen), (ev_window_cmd_view_fullscreen), (ev_window_update_presentation_action), (ev_window_run_presentation), (ev_window_stop_presentation), (ev_window_cmd_view_presentation), (ev_window_state_event), (ev_window_focus_in_event), (ev_window_focus_out_event), (ev_window_cmd_escape), (ev_window_sidebar_visibility_changed_cb): * data/evince-ui.xml: Initial presentation mode. We should probably hide this until it's done, as it's quite rough. Also, change full-screen to fullscreen and add two getters to EvView.
-rw-r--r--ChangeLog28
-rw-r--r--data/evince-ui.xml1
-rw-r--r--shell/ev-pixbuf-cache.c2
-rw-r--r--shell/ev-view.c117
-rw-r--r--shell/ev-view.h26
-rw-r--r--shell/ev-window.c227
6 files changed, 287 insertions, 114 deletions
diff --git a/ChangeLog b/ChangeLog
index f0ed51c..041ddd8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+Sun May 1 00:46:47 2005 Jonathan Blandford <jrb@redhat.com>
+
+ * shell/ev-pixbuf-cache.c: (ev_pixbuf_cache_init): Change the
+ preview cache back to 1. Don't know when it got set to 0.
+
+ * shell/ev-view.c: (compute_border), (ev_view_realize),
+ (draw_one_page), (ev_view_set_property), (ev_view_get_property),
+ (ev_view_class_init), (ev_view_init), (ev_view_set_fullscreen),
+ (ev_view_get_fullscreen), (ev_view_set_presentation),
+ (ev_view_get_presentation), (ev_view_set_sizing_mode),
+ (ev_view_zoom_for_size_presentation), (ev_view_set_zoom_for_size):
+ * shell/ev-view.h:
+ * shell/ev-window.c:
+ (update_chrome_visibility),
+ (ev_window_cmd_continuous), (ev_window_cmd_dual),
+ (ev_window_cmd_view_best_fit), (ev_window_cmd_view_page_width),
+ (update_document_mode), (ev_window_update_fullscreen_action),
+ (ev_window_fullscreen), (ev_window_unfullscreen),
+ (ev_window_cmd_view_fullscreen),
+ (ev_window_update_presentation_action),
+ (ev_window_run_presentation), (ev_window_stop_presentation),
+ (ev_window_cmd_view_presentation), (ev_window_state_event),
+ (ev_window_focus_in_event), (ev_window_focus_out_event),
+ (ev_window_cmd_escape), (ev_window_sidebar_visibility_changed_cb):
+ * data/evince-ui.xml: Initial presentation mode. We should
+ probably hide this until it's done, as it's quite rough. Also,
+ change full-screen to fullscreen and add two getters to EvView.
+
2005-04-29 Marco Pesenti Gritti <mpg@redhat.com>
* shell/ev-page-action.c: (update_page_cache),
diff --git a/data/evince-ui.xml b/data/evince-ui.xml
index dc11630..d620511 100644
--- a/data/evince-ui.xml
+++ b/data/evince-ui.xml
@@ -25,6 +25,7 @@
<menuitem name="ViewSidebarMenu" action="ViewSidebar"/>
<separator/>
<menuitem name="ViewFullscreenMenu" action="ViewFullscreen"/>
+ <menuitem name="ViewPresentationMenu" action="ViewPresentation"/>
<separator/>
<menuitem name="ViewContinuousMenu" action="ViewContinuous"/>
<menuitem name="ViewDualMenu" action="ViewDual"/>
diff --git a/shell/ev-pixbuf-cache.c b/shell/ev-pixbuf-cache.c
index 7350c62..b5227ee 100644
--- a/shell/ev-pixbuf-cache.c
+++ b/shell/ev-pixbuf-cache.c
@@ -73,7 +73,7 @@ ev_pixbuf_cache_init (EvPixbufCache *pixbuf_cache)
pixbuf_cache->end_page = 0;
pixbuf_cache->job_list = g_new0 (CacheJobInfo, PAGE_CACHE_LEN (pixbuf_cache));
- pixbuf_cache->preload_cache_size = 0;
+ pixbuf_cache->preload_cache_size = 1;
pixbuf_cache->prev_job = g_new0 (CacheJobInfo, pixbuf_cache->preload_cache_size);
pixbuf_cache->next_job = g_new0 (CacheJobInfo, pixbuf_cache->preload_cache_size);
}
diff --git a/shell/ev-view.c b/shell/ev-view.c
index cf00d82..2469dca 100644
--- a/shell/ev-view.c
+++ b/shell/ev-view.c
@@ -46,7 +46,7 @@ enum {
PROP_FIND_STATUS,
PROP_CONTINUOUS,
PROP_DUAL_PAGE,
- PROP_FULL_SCREEN,
+ PROP_FULLSCREEN,
PROP_PRESENTATION,
PROP_SIZING_MODE,
};
@@ -121,11 +121,10 @@ struct _EvView {
double scale;
GtkBorder border;
- gboolean show_border;
gboolean continuous;
gboolean dual_page;
- gboolean full_screen;
+ gboolean fullscreen;
gboolean presentation;
EvSizingMode sizing_mode;
};
@@ -394,13 +393,13 @@ doc_rect_to_view_rect (EvView *view, EvRectangle *doc_rect, GdkRectangle *view_r
static void
compute_border (EvView *view, int width, int height, GtkBorder *border)
{
- if (view->show_border) {
- ev_document_misc_get_page_border_size (width, height, border);
- } else {
+ if (view->presentation) {
border->left = 0;
border->right = 0;
border->top = 0;
border->bottom = 0;
+ } else {
+ ev_document_misc_get_page_border_size (width, height, border);
}
}
@@ -642,7 +641,10 @@ ev_view_realize (GtkWidget *widget)
gdk_window_show (view->bin_window);
widget->style = gtk_style_attach (widget->style, view->bin_window);
- gdk_window_set_background (view->bin_window, &widget->style->mid[widget->state]);
+ if (view->presentation)
+ gdk_window_set_background (view->bin_window, &widget->style->black);
+ else
+ gdk_window_set_background (view->bin_window, &widget->style->mid [GTK_STATE_NORMAL]);
if (view->document) {
/* We can't get page size without a target, so we have to
@@ -906,10 +908,9 @@ draw_one_page (EvView *view,
page, view->scale,
&width, &height);
- if (view->show_border)
- ev_document_misc_paint_one_page (view->bin_window,
- GTK_WIDGET (view),
- page_area, border);
+ ev_document_misc_paint_one_page (view->bin_window,
+ GTK_WIDGET (view),
+ page_area, border);
/* Render the document itself */
real_page_area = *page_area;
@@ -932,7 +933,6 @@ draw_one_page (EvView *view,
scaled_image = gdk_pixbuf_scale_simple (current_pixbuf,
width, height,
GDK_INTERP_NEAREST);
-
if (scaled_image) {
gdk_draw_pixbuf (view->bin_window,
GTK_WIDGET (view)->style->fg_gc[GTK_STATE_NORMAL],
@@ -1568,8 +1568,8 @@ ev_view_set_property (GObject *object,
case PROP_DUAL_PAGE:
ev_view_set_dual_page (view, g_value_get_boolean (value));
break;
- case PROP_FULL_SCREEN:
- ev_view_set_full_screen (view, g_value_get_boolean (value));
+ case PROP_FULLSCREEN:
+ ev_view_set_fullscreen (view, g_value_get_boolean (value));
break;
case PROP_PRESENTATION:
ev_view_set_presentation (view, g_value_get_boolean (value));
@@ -1604,8 +1604,8 @@ ev_view_get_property (GObject *object,
case PROP_DUAL_PAGE:
g_value_set_boolean (value, view->dual_page);
break;
- case PROP_FULL_SCREEN:
- g_value_set_boolean (value, view->full_screen);
+ case PROP_FULLSCREEN:
+ g_value_set_boolean (value, view->fullscreen);
break;
case PROP_PRESENTATION:
g_value_set_boolean (value, view->presentation);
@@ -1696,10 +1696,10 @@ ev_view_class_init (EvViewClass *class)
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
- PROP_FULL_SCREEN,
- g_param_spec_boolean ("full-screen",
+ PROP_FULLSCREEN,
+ g_param_spec_boolean ("fullscreen",
"Full Screen",
- "Draw page in a full-screen fashion",
+ "Draw page in a fullscreen fashion",
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
@@ -1743,12 +1743,11 @@ ev_view_init (EvView *view)
view->current_page = 0;
view->pressed_button = -1;
view->cursor = EV_VIEW_CURSOR_NORMAL;
- view->show_border = TRUE;
view->continuous = TRUE;
view->dual_page = FALSE;
view->presentation = FALSE;
- view->full_screen = FALSE;
+ view->fullscreen = FALSE;
view->sizing_mode = EV_SIZING_FIT_WIDTH;
}
@@ -2065,19 +2064,27 @@ ev_view_set_dual_page (EvView *view,
}
void
-ev_view_set_full_screen (EvView *view,
- gboolean full_screen)
+ev_view_set_fullscreen (EvView *view,
+ gboolean fullscreen)
{
g_return_if_fail (EV_IS_VIEW (view));
- full_screen = full_screen != FALSE;
+ fullscreen = fullscreen != FALSE;
- if (view->full_screen != full_screen) {
- view->full_screen = full_screen;
+ if (view->fullscreen != fullscreen) {
+ view->fullscreen = fullscreen;
gtk_widget_queue_resize (GTK_WIDGET (view));
}
- g_object_notify (G_OBJECT (view), "full-screen");
+ g_object_notify (G_OBJECT (view), "fullscreen");
+}
+
+gboolean
+ev_view_get_fullscreen (EvView *view)
+{
+ g_return_val_if_fail (EV_IS_VIEW (view), FALSE);
+
+ return view->fullscreen;
}
void
@@ -2088,24 +2095,44 @@ ev_view_set_presentation (EvView *view,
presentation = presentation != FALSE;
- if (view->presentation != presentation) {
- view->presentation = presentation;
- gtk_widget_queue_resize (GTK_WIDGET (view));
+ if (view->presentation == presentation)
+ return;
+
+ view->presentation = presentation;
+ gtk_widget_queue_resize (GTK_WIDGET (view));
+ if (GTK_WIDGET_REALIZED (view)) {
+ if (view->presentation)
+ gdk_window_set_background (view->bin_window,
+ &GTK_WIDGET (view)->style->black);
+ else
+ gdk_window_set_background (view->bin_window,
+ &GTK_WIDGET (view)->style->mid [GTK_STATE_NORMAL]);
}
+
g_object_notify (G_OBJECT (view), "presentation");
}
+gboolean
+ev_view_get_presentation (EvView *view)
+{
+ g_return_val_if_fail (EV_IS_VIEW (view), FALSE);
+
+ return view->presentation;
+}
+
void
ev_view_set_sizing_mode (EvView *view,
EvSizingMode sizing_mode)
{
g_return_if_fail (EV_IS_VIEW (view));
- if (view->sizing_mode != sizing_mode) {
- view->sizing_mode = sizing_mode;
- gtk_widget_queue_resize (GTK_WIDGET (view));
- }
+ if (view->sizing_mode == sizing_mode)
+ return;
+
+ view->sizing_mode = sizing_mode;
+ gtk_widget_queue_resize (GTK_WIDGET (view));
+
g_object_notify (G_OBJECT (view), "sizing-mode");
}
@@ -2179,6 +2206,24 @@ zoom_for_size_best_fit (int doc_width,
return MIN (w_scale, h_scale);
}
+
+static void
+ev_view_zoom_for_size_presentation (EvView *view,
+ int width,
+ int height)
+{
+ int doc_width, doc_height;
+ gdouble scale;
+
+ ev_page_cache_get_size (view->page_cache,
+ view->current_page,
+ 1.0,
+ &doc_width,
+ &doc_height);
+ scale = zoom_for_size_best_fit (doc_width, doc_height, width, height, 0, 0);
+ ev_view_zoom (view, scale, FALSE);
+}
+
static void
ev_view_zoom_for_size_continuous_and_dual_page (EvView *view,
int width,
@@ -2351,7 +2396,9 @@ ev_view_set_zoom_for_size (EvView *view,
if (view->document == NULL)
return;
- if (view->continuous && view->dual_page)
+ if (view->presentation)
+ ev_view_zoom_for_size_presentation (view, width, height);
+ else if (view->continuous && view->dual_page)
ev_view_zoom_for_size_continuous_and_dual_page (view, width, height, vsb_width, hsb_height);
else if (view->continuous)
ev_view_zoom_for_size_continuous (view, width, height, vsb_width, hsb_height);
diff --git a/shell/ev-view.h b/shell/ev-view.h
index b87d345..a96397f 100644
--- a/shell/ev-view.h
+++ b/shell/ev-view.h
@@ -54,18 +54,22 @@ void ev_view_select_all (EvView *view);
/* sizing and behavior */
-/* These are all orthoganal to each other, with the exception of 'presentation'
+/* These are all orthoganal to each other, except 'presentation' trumps all
+ * other behaviors
*/
-void ev_view_set_continuous (EvView *view,
- gboolean continuous);
-void ev_view_set_dual_page (EvView *view,
- gboolean dual_page);
-void ev_view_set_full_screen (EvView *view,
- gboolean full_screen);
-void ev_view_set_presentation (EvView *view,
- gboolean presentation);
-void ev_view_set_sizing_mode (EvView *view,
- EvSizingMode mode);
+void ev_view_set_continuous (EvView *view,
+ gboolean continuous);
+void ev_view_set_dual_page (EvView *view,
+ gboolean dual_page);
+void ev_view_set_fullscreen (EvView *view,
+ gboolean fullscreen);
+gboolean ev_view_get_fullscreen (EvView *view);
+void ev_view_set_presentation (EvView *view,
+ gboolean presentation);
+gboolean ev_view_get_presentation (EvView *view);
+void ev_view_set_sizing_mode (EvView *view,
+ EvSizingMode mode);
+
/* Page size */
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 471a45d..475cb5d 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -110,7 +110,6 @@ struct _EvWindowPrivate {
char *password_uri;
EvChrome chrome;
- gboolean fullscreen_mode;
GSource *fullscreen_timeout_source;
/* recent file stuff */
@@ -136,18 +135,29 @@ static const GtkTargetEntry ev_drop_types[] = {
#define SIDEBAR_DEFAULT_SIZE 132
-static void ev_window_update_fullscreen_popup (EvWindow *window);
-static void ev_window_sidebar_visibility_changed_cb (EvSidebar *ev_sidebar, GParamSpec *pspec,
- EvWindow *ev_window);
-static void ev_window_set_page_mode (EvWindow *window,
- EvWindowPageMode page_mode);
-static gboolean start_loading_document (EvWindow *ev_window,
- EvDocument *document,
- const char *uri);
-static void ev_window_sizing_mode_changed_cb (EvView *view, GParamSpec *pspec,
- EvWindow *ev_window);
-static void ev_window_add_recent (EvWindow *window, const char *filename);
-static void ev_window_fullscreen (EvWindow *window);
+static void ev_window_update_fullscreen_popup (EvWindow *window);
+static void ev_window_sidebar_visibility_changed_cb (EvSidebar *ev_sidebar,
+ GParamSpec *pspec,
+ EvWindow *ev_window);
+static void ev_window_set_page_mode (EvWindow *window,
+ EvWindowPageMode page_mode);
+static gboolean start_loading_document (EvWindow *ev_window,
+ EvDocument *document,
+ const char *uri);
+static void ev_window_sizing_mode_changed_cb (EvView *view,
+ GParamSpec *pspec,
+ EvWindow *ev_window);
+static void ev_window_add_recent (EvWindow *window,
+ const char *filename);
+static void ev_window_fullscreen (EvWindow *window);
+static void ev_window_unfullscreen (EvWindow *window);
+static void ev_window_cmd_view_fullscreen (GtkAction *action,
+ EvWindow *window);
+static void ev_window_run_presentation (EvWindow *window);
+static void ev_window_stop_presentation (EvWindow *window);
+static void ev_window_cmd_view_presentation (GtkAction *action,
+ EvWindow *window);
+
G_DEFINE_TYPE (EvWindow, ev_window, GTK_TYPE_WINDOW)
@@ -253,12 +263,17 @@ update_chrome_visibility (EvWindow *window)
{
EvWindowPrivate *priv = window->priv;
gboolean menubar, toolbar, sidebar, findbar, statusbar, fullscreen_toolbar;
+ gboolean fullscreen_mode, presentation, fullscreen;
+
+ presentation = ev_view_get_presentation (EV_VIEW (priv->view));
+ fullscreen = ev_view_get_fullscreen (EV_VIEW (priv->view));
+ fullscreen_mode = fullscreen || presentation;
- menubar = (priv->chrome & EV_CHROME_MENUBAR) != 0 && !priv->fullscreen_mode;
- toolbar = (priv->chrome & EV_CHROME_TOOLBAR) != 0 && !priv->fullscreen_mode;
- sidebar = (priv->chrome & EV_CHROME_SIDEBAR) != 0 && !priv->fullscreen_mode;
+ menubar = (priv->chrome & EV_CHROME_MENUBAR) != 0 && !fullscreen_mode;
+ toolbar = (priv->chrome & EV_CHROME_TOOLBAR) != 0 && !fullscreen_mode;
+ sidebar = (priv->chrome & EV_CHROME_SIDEBAR) != 0 && !fullscreen_mode;
fullscreen_toolbar = (priv->chrome & EV_CHROME_TOOLBAR) != 0;
- statusbar = (priv->chrome & EV_CHROME_STATUSBAR) != 0 && !priv->fullscreen_mode;
+ statusbar = (priv->chrome & EV_CHROME_STATUSBAR) != 0 && !fullscreen_mode;
findbar = (priv->chrome & EV_CHROME_FINDBAR) != 0;
set_widget_visibility (priv->menubar, menubar);
@@ -269,7 +284,7 @@ update_chrome_visibility (EvWindow *window)
set_widget_visibility (priv->fullscreen_toolbar, fullscreen_toolbar);
if (priv->fullscreen_popup != NULL) {
- set_widget_visibility (priv->fullscreen_popup, priv->fullscreen_mode);
+ set_widget_visibility (priv->fullscreen_popup, fullscreen);
}
}
@@ -300,6 +315,7 @@ ev_window_cmd_continuous (GtkAction *action, EvWindow *ev_window)
{
gboolean continuous;
+ ev_window_stop_presentation (ev_window);
continuous = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
g_object_set (G_OBJECT (ev_window->priv->view),
"continuous", continuous,
@@ -312,6 +328,7 @@ ev_window_cmd_dual (GtkAction *action, EvWindow *ev_window)
{
gboolean dual_page;
+ ev_window_stop_presentation (ev_window);
dual_page = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
g_object_set (G_OBJECT (ev_window->priv->view),
"dual-page", dual_page,
@@ -322,6 +339,8 @@ ev_window_cmd_dual (GtkAction *action, EvWindow *ev_window)
static void
ev_window_cmd_view_best_fit (GtkAction *action, EvWindow *ev_window)
{
+ ev_window_stop_presentation (ev_window);
+
if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
ev_view_set_sizing_mode (EV_VIEW (ev_window->priv->view), EV_SIZING_BEST_FIT);
} else {
@@ -333,6 +352,8 @@ ev_window_cmd_view_best_fit (GtkAction *action, EvWindow *ev_window)
static void
ev_window_cmd_view_page_width (GtkAction *action, EvWindow *ev_window)
{
+ ev_window_stop_presentation (ev_window);
+
if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
ev_view_set_sizing_mode (EV_VIEW (ev_window->priv->view), EV_SIZING_FIT_WIDTH);
} else {
@@ -497,7 +518,9 @@ static void
update_document_mode (EvWindow *window, EvDocumentMode mode)
{
if (mode == EV_DOCUMENT_MODE_FULL_SCREEN) {
- gtk_window_fullscreen (GTK_WINDOW (window));
+ ev_window_fullscreen (window);
+ } else if (mode == EV_DOCUMENT_MODE_PRESENTATION) {
+ ev_window_run_presentation (window);
}
}
@@ -1326,11 +1349,25 @@ ev_window_create_fullscreen_popup (EvWindow *window)
return popup;
}
+
static void
-ev_window_fullscreen (EvWindow *window)
+ev_window_update_fullscreen_action (EvWindow *window)
{
- window->priv->fullscreen_mode = TRUE;
+ GtkAction *action;
+ action = gtk_action_group_get_action (window->priv->action_group, "ViewFullscreen");
+ g_signal_handlers_block_by_func
+ (action, G_CALLBACK (ev_window_cmd_view_fullscreen), window);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+ ev_view_get_fullscreen (EV_VIEW (window->priv->view)));
+ g_signal_handlers_unblock_by_func
+ (action, G_CALLBACK (ev_window_cmd_view_fullscreen), window);
+}
+
+static void
+ev_window_fullscreen (EvWindow *window)
+{
+ ev_view_set_fullscreen (EV_VIEW (window->priv->view), TRUE);
if (window->priv->fullscreen_popup == NULL)
window->priv->fullscreen_popup
= ev_window_create_fullscreen_popup (window);
@@ -1351,7 +1388,8 @@ ev_window_fullscreen (EvWindow *window)
fullscreen_set_timeout (window);
gtk_widget_grab_focus (window->priv->view);
-
+ ev_window_update_fullscreen_action (window);
+ gtk_window_fullscreen (GTK_WINDOW (window));
ev_window_update_fullscreen_popup (window);
}
@@ -1360,8 +1398,7 @@ ev_window_unfullscreen (EvWindow *window)
{
EvView *view = EV_VIEW (window->priv->view);
- window->priv->fullscreen_mode = FALSE;
-
+ ev_view_set_fullscreen (view, FALSE);
g_object_set (G_OBJECT (window->priv->scrolled_window),
"shadow-type", GTK_SHADOW_IN,
NULL);
@@ -1371,33 +1408,86 @@ ev_window_unfullscreen (EvWindow *window)
g_signal_handlers_disconnect_by_func (view,
(gpointer) fullscreen_motion_notify_cb,
window);
-
- g_object_set (G_OBJECT (view),
- "full-screen", FALSE,
- NULL);
+ g_signal_handlers_disconnect_by_func (view,
+ (gpointer) fullscreen_leave_notify_cb,
+ window);
+ ev_window_update_fullscreen_action (window);
+ gtk_window_unfullscreen (GTK_WINDOW (window));
update_chrome_visibility (window);
}
static void
ev_window_cmd_view_fullscreen (GtkAction *action, EvWindow *window)
{
- EvView *view;
gboolean fullscreen;
g_return_if_fail (EV_IS_WINDOW (window));
+ ev_window_stop_presentation (window);
- view = EV_VIEW (window->priv->view);
fullscreen = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
-
if (fullscreen) {
- gtk_window_fullscreen (GTK_WINDOW (window));
+ ev_window_fullscreen (window);
} else {
- gtk_window_unfullscreen (GTK_WINDOW (window));
+ ev_window_unfullscreen (window);
}
+}
+
+static void
+ev_window_update_presentation_action (EvWindow *window)
+{
+ GtkAction *action;
+
+ action = gtk_action_group_get_action (window->priv->action_group, "ViewPresentation");
+ g_signal_handlers_block_by_func
+ (action, G_CALLBACK (ev_window_cmd_view_presentation), window);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+ ev_view_get_presentation (EV_VIEW (window->priv->view)));
+ g_signal_handlers_unblock_by_func
+ (action, G_CALLBACK (ev_window_cmd_view_presentation), window);
+}
- g_object_set (G_OBJECT (view),
- "full-screen", TRUE,
+static void
+ev_window_run_presentation (EvWindow *window)
+{
+ g_object_set (G_OBJECT (window->priv->scrolled_window),
+ "shadow-type", GTK_SHADOW_NONE,
NULL);
+
+ gtk_widget_grab_focus (window->priv->view);
+ ev_view_set_presentation (EV_VIEW (window->priv->view), TRUE);
+ gtk_window_fullscreen (GTK_WINDOW (window));
+ ev_window_update_presentation_action (window);
+ update_chrome_visibility (window);
+}
+
+static void
+ev_window_stop_presentation (EvWindow *window)
+{
+ if (! ev_view_get_presentation (EV_VIEW (window->priv->view)))
+ return;
+
+ g_object_set (G_OBJECT (window->priv->scrolled_window),
+ "shadow-type", GTK_SHADOW_IN,
+ NULL);
+ ev_view_set_presentation (EV_VIEW (window->priv->view), FALSE);
+ gtk_window_unfullscreen (GTK_WINDOW (window));
+ ev_window_update_presentation_action (window);
+ update_chrome_visibility (window);
+}
+
+static void
+ev_window_cmd_view_presentation (GtkAction *action, EvWindow *window)
+{
+ gboolean presentation;
+
+ g_return_if_fail (EV_IS_WINDOW (window));
+
+ presentation = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ if (presentation) {
+ ev_window_run_presentation (window);
+ } else {
+ ev_window_stop_presentation (window);
+ }
}
static gboolean
@@ -1414,29 +1504,6 @@ ev_window_state_event (GtkWidget *widget, GdkEventWindowState *event)
show);
}
- if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) {
- GtkActionGroup *action_group;
- GtkAction *action;
- gboolean fullscreen;
-
- fullscreen = event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN;
-
- if (fullscreen) {
- ev_window_fullscreen (window);
- } else {
- ev_window_unfullscreen (window);
- }
-
- action_group = window->priv->action_group;
-
- action = gtk_action_group_get_action (action_group, "ViewFullscreen");
- g_signal_handlers_block_by_func
- (action, G_CALLBACK (ev_window_cmd_view_fullscreen), window);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), fullscreen);
- g_signal_handlers_unblock_by_func
- (action, G_CALLBACK (ev_window_cmd_view_fullscreen), window);
- }
-
return FALSE;
}
@@ -1445,11 +1512,14 @@ ev_window_focus_in_event (GtkWidget *widget, GdkEventFocus *event)
{
EvWindow *window = EV_WINDOW (widget);
EvWindowPrivate *priv = window->priv;
+ gboolean fullscreen;
- if (priv->fullscreen_mode)
- {
+ g_object_get (priv->view,
+ "fullscreen", &fullscreen,
+ NULL);
+
+ if (fullscreen)
gtk_widget_show (priv->fullscreen_popup);
- }
return GTK_WIDGET_CLASS (ev_window_parent_class)->focus_in_event (widget, event);
}
@@ -1459,11 +1529,14 @@ ev_window_focus_out_event (GtkWidget *widget, GdkEventFocus *event)
{
EvWindow *window = EV_WINDOW (widget);
EvWindowPrivate *priv = window->priv;
+ gboolean fullscreen;
- if (priv->fullscreen_mode)
- {
+ g_object_get (priv->view,
+ "fullscreen", &fullscreen,
+ NULL);
+
+ if (fullscreen)
gtk_widget_hide (priv->fullscreen_popup);
- }
return GTK_WIDGET_CLASS (ev_window_parent_class)->focus_out_event (widget, event);
}
@@ -1615,7 +1688,21 @@ ev_window_cmd_escape (GtkAction *action, EvWindow *window)
if (widget && gtk_widget_get_ancestor (widget, EGG_TYPE_FIND_BAR)) {
update_chrome_flag (window, EV_CHROME_FINDBAR, NULL, FALSE);
} else {
- gtk_window_unfullscreen (GTK_WINDOW (window));
+ gboolean fullscreen;
+ gboolean presentation;
+
+ g_object_get (window->priv->view,
+ "fullscreen", &fullscreen,
+ "presentation", &presentation,
+ NULL);
+
+ if (fullscreen)
+ ev_window_unfullscreen (window);
+ if (presentation)
+ ev_window_stop_presentation (window);
+
+ if (fullscreen && presentation)
+ g_warning ("Both fullscreen and presentation set somehow");
}
}
@@ -1795,14 +1882,17 @@ ev_window_sidebar_visibility_changed_cb (EvSidebar *ev_sidebar, GParamSpec *pspe
EvWindow *ev_window)
{
GtkAction *action;
- gboolean visible;
+ gboolean visible, fullscreen;
+ g_object_get (ev_window->priv->view,
+ "fullscreen", &fullscreen,
+ NULL);
visible = GTK_WIDGET_VISIBLE (ev_sidebar);
/* In fullscreen mode the sidebar is not visible,
* but we don't want to update the chrome
*/
- if (ev_window->priv->fullscreen_mode)
+ if (fullscreen)
return;
action = gtk_action_group_get_action (ev_window->priv->action_group, "ViewSidebar");
@@ -2154,6 +2244,9 @@ static const GtkToggleActionEntry toggle_entries[] = {
{ "ViewFullscreen", NULL, N_("_Fullscreen"), "F11",
N_("Expand the window to fill the screen"),
G_CALLBACK (ev_window_cmd_view_fullscreen) },
+ { "ViewPresentation", NULL, N_("_Presentation"), "F12",
+ N_("Run document as a presentation"),
+ G_CALLBACK (ev_window_cmd_view_presentation) },
{ "ViewBestFit", EV_STOCK_ZOOM_PAGE, N_("_Best Fit"), NULL,
N_("Make the current document fill the window"),
G_CALLBACK (ev_window_cmd_view_best_fit) },