diff options
-rw-r--r-- | data/atril-previewer-ui.xml | 1 | ||||
-rw-r--r-- | data/atril-toolbar.xml | 1 | ||||
-rw-r--r-- | data/atril-ui.xml | 1 | ||||
-rw-r--r-- | libview/ev-view.c | 7 | ||||
-rw-r--r-- | libview/ev-view.h | 1 | ||||
-rw-r--r-- | libview/ev-web-view.c | 11 | ||||
-rw-r--r-- | libview/ev-web-view.h | 1 | ||||
-rw-r--r-- | previewer/ev-previewer-window.c | 11 | ||||
-rw-r--r-- | shell/ev-window.c | 27 |
9 files changed, 61 insertions, 0 deletions
diff --git a/data/atril-previewer-ui.xml b/data/atril-previewer-ui.xml index 37c989ad..b836d412 100644 --- a/data/atril-previewer-ui.xml +++ b/data/atril-previewer-ui.xml @@ -9,6 +9,7 @@ <toolitem name="ViewFitPage" action="ViewFitPage"/> <toolitem name="ViewZoomIn" action="ViewZoomIn"/> <toolitem name="ViewZoomOut" action="ViewZoomOut"/> + <toolitem name="ViewZoomReset" action="ViewZoomReset"/> <separator/> <toolitem name="PreviewPrint" action="PreviewPrint"/> </toolbar> diff --git a/data/atril-toolbar.xml b/data/atril-toolbar.xml index f49fe2f1..eb641581 100644 --- a/data/atril-toolbar.xml +++ b/data/atril-toolbar.xml @@ -14,6 +14,7 @@ <toolitem name="ViewZoom"/> <toolitem name="ViewZoomIn"/> <toolitem name="ViewZoomOut"/> + <toolitem name="ViewZoomReset"/> <toolitem name="ViewFitPage"/> <toolitem name="ViewFitWidth"/> <toolitem name="ViewFullscreen"/> diff --git a/data/atril-ui.xml b/data/atril-ui.xml index 33ccd263..f836bdf5 100644 --- a/data/atril-ui.xml +++ b/data/atril-ui.xml @@ -49,6 +49,7 @@ <separator/> <menuitem name="ViewZoomInMenu" action="ViewZoomIn"/> <menuitem name="ViewZoomOutMenu" action="ViewZoomOut"/> + <menuitem name="ViewZoomResetMenu" action="ViewZoomReset"/> <menuitem name="ViewFitPageMenu" action="ViewFitPage"/> <menuitem name="ViewFitWidthMenu" action="ViewFitWidth"/> <menuitem name="ViewExpandWindowMenu" action="ViewExpandWindow"/> diff --git a/libview/ev-view.c b/libview/ev-view.c index 545942e3..334540c6 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -7088,6 +7088,13 @@ ev_view_zoom_out (EvView *view) ev_view_zoom (view, ZOOM_OUT_FACTOR); } +void +ev_view_zoom_reset (EvView *view) +{ + g_return_if_fail (view->sizing_mode == EV_SIZING_FREE); + ev_document_model_set_scale (view->model, 1.2); +} + static double zoom_for_size_fit_width (gdouble doc_width, gdouble doc_height, diff --git a/libview/ev-view.h b/libview/ev-view.h index fdf6c0ea..802b8cb9 100644 --- a/libview/ev-view.h +++ b/libview/ev-view.h @@ -63,6 +63,7 @@ gboolean ev_view_can_zoom_in (EvView *view); void ev_view_zoom_in (EvView *view); gboolean ev_view_can_zoom_out (EvView *view); void ev_view_zoom_out (EvView *view); +void ev_view_zoom_reset (EvView *view); void ev_view_zoom (EvView *view, gdouble factor); diff --git a/libview/ev-web-view.c b/libview/ev-web-view.c index 6e302660..5a101f6b 100644 --- a/libview/ev-web-view.c +++ b/libview/ev-web-view.c @@ -687,6 +687,17 @@ ev_web_view_zoom_out(EvWebView *webview) return TRUE; } +gboolean +ev_web_view_zoom_reset(EvWebView *webview) +{ + if (webview->zoom_level == 1) + return FALSE; + + webkit_web_view_set_zoom_level (WEBKIT_WEB_VIEW(webview), + 1.0); + return TRUE; +} + /** * ev_web_view_disconnect_handlers * @webview : #EvWebView instance diff --git a/libview/ev-web-view.h b/libview/ev-web-view.h index 42345ca1..90892d37 100644 --- a/libview/ev-web-view.h +++ b/libview/ev-web-view.h @@ -83,6 +83,7 @@ void ev_web_view_copy (EvWebView *webview); /* Zoom control */ gboolean ev_web_view_zoom_in (EvWebView *webview); gboolean ev_web_view_zoom_out (EvWebView *webview); +gboolean ev_web_view_zoom_reset (EvWebView *webview); /*For safe replacement by an EvView*/ void ev_web_view_disconnect_handlers (EvWebView *webview); diff --git a/previewer/ev-previewer-window.c b/previewer/ev-previewer-window.c index 1979d954..38848e39 100644 --- a/previewer/ev-previewer-window.c +++ b/previewer/ev-previewer-window.c @@ -139,6 +139,14 @@ ev_previewer_window_zoom_out (GtkAction *action, } static void +ev_previewer_window_zoom_reset (GtkAction *action, + EvPreviewerWindow *window) +{ + ev_document_model_set_sizing_mode (window->model, EV_SIZING_FREE); + ev_view_zoom_reset (window->view); +} + +static void ev_previewer_window_zoom_fit_page (GtkToggleAction *action, EvPreviewerWindow *window) { @@ -284,6 +292,9 @@ static const GtkActionEntry action_entries[] = { { "ViewZoomOut", "zoom-out", N_("Zoom _Out"), "<control>minus", N_("Shrink the document"), G_CALLBACK (ev_previewer_window_zoom_out) }, + { "ViewZoomReset", "zoom-original", NULL, "<control>0", + N_("Reset zoom to 100\%"), + G_CALLBACK (ev_previewer_window_zoom_reset) }, #if GTKUNIXPRINT_ENABLED /* translators: Print document currently shown in the Print Preview window */ { "PreviewPrint", "document-print", N_("Print"), NULL, diff --git a/shell/ev-window.c b/shell/ev-window.c index a8f485dc..e7fc6538 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -575,6 +575,9 @@ ev_window_update_actions (EvWindow *ev_window) has_pages && ev_view_can_zoom_out (view) && !presentation_mode); + ev_window_set_action_sensitive (ev_window, "ViewZoomReset", + has_pages && + !presentation_mode); ev_window_set_action_sensitive (ev_window, "ViewDualOddLeft", dual_mode); } @@ -4725,6 +4728,23 @@ ev_window_cmd_view_zoom_out (GtkAction *action, EvWindow *ev_window) } static void +ev_window_cmd_view_zoom_reset (GtkAction *action, EvWindow *ev_window) +{ + g_return_if_fail (EV_IS_WINDOW (ev_window)); + + ev_document_model_set_sizing_mode (ev_window->priv->model, EV_SIZING_FREE); +#if ENABLE_EPUB + if ( ev_window->priv->document->iswebdocument) { + ev_web_view_zoom_reset(EV_WEB_VIEW(ev_window->priv->webview)); + } + else +#endif + { + ev_view_zoom_reset (EV_VIEW (ev_window->priv->view)); + } +} + +static void ev_window_cmd_go_previous_page (GtkAction *action, EvWindow *ev_window) { g_return_if_fail (EV_IS_WINDOW (ev_window)); @@ -6300,6 +6320,9 @@ static const GtkActionEntry entries[] = { { "ViewZoomOut", "zoom-out", N_("Zoom _Out"), "<control>minus", N_("Shrink the document"), G_CALLBACK (ev_window_cmd_view_zoom_out) }, + { "ViewZoomReset", "zoom-original", N_("_Reset Zoom"), "<control>0", + N_("Reset zoom to 100\%"), + G_CALLBACK (ev_window_cmd_view_zoom_reset) }, { "ViewReload", "view-refresh", N_("_Reload"), "<control>R", N_("Reload the document"), G_CALLBACK (ev_window_cmd_view_reload) }, @@ -6653,6 +6676,10 @@ set_action_properties (GtkActionGroup *action_group) /*translators: this is the label for toolbar button*/ g_object_set (action, "short_label", _("Zoom Out"), NULL); + action = gtk_action_group_get_action (action_group, "ViewZoomReset"); + /*translators: this is the label for toolbar button*/ + g_object_set (action, "short_label", _("Reset Zoom"), NULL); + action = gtk_action_group_get_action (action_group, "ViewFitPage"); /*translators: this is the label for toolbar button*/ g_object_set (action, "short_label", _("Fit Page"), NULL); |