summaryrefslogtreecommitdiff
path: root/libview
diff options
context:
space:
mode:
authorLars Mueller <[email protected]>2017-08-30 14:57:59 +0200
committerraveit65 <[email protected]>2018-03-15 19:11:11 +0100
commit580e4fa77018dc57cfd88e229fb21b1d87dfd3dd (patch)
treebef8430bcffd40808f1b578fdfdc49005b2947cb /libview
parenta3ade9fd0cea1bb4a6d0c00cf89ffc546093683a (diff)
downloadatril-580e4fa77018dc57cfd88e229fb21b1d87dfd3dd.tar.bz2
atril-580e4fa77018dc57cfd88e229fb21b1d87dfd3dd.tar.xz
Add zoom reset
origin commit: https://github.com/linuxmint/xreader/commit/43acb8f
Diffstat (limited to 'libview')
-rw-r--r--libview/ev-view.c7
-rw-r--r--libview/ev-view.h1
-rw-r--r--libview/ev-web-view.c11
-rw-r--r--libview/ev-web-view.h1
4 files changed, 20 insertions, 0 deletions
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);