From 57a3618d9254364157a12df39caebbf9247d5aca Mon Sep 17 00:00:00 2001 From: rootavish Date: Sat, 26 Jul 2014 12:26:32 +0530 Subject: Reading epub documents possible Alebit with a bit of bugs as far as navigation etc. are possible, we can read an epub document in Atril. The document will be displayed with thumbnails, and all keyboard shortcuts work. Menu options, the ones that I have currently added do work. I Will now move on to features such as inverted colors, document index, etc, most of which should be simple to add. Also made changes so that the presentation view does not fire up while displaying an epub document. Also added the feature to copy text to clipboard using the Atril menu. --- libview/ev-web-view.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'libview/ev-web-view.c') diff --git a/libview/ev-web-view.c b/libview/ev-web-view.c index b28befd7..a1caba36 100644 --- a/libview/ev-web-view.c +++ b/libview/ev-web-view.c @@ -1,7 +1,7 @@ /* this file is part of atril, a mate document viewer * * Copyright (C) 2014 Avishkar Gupta - * Based on ev-view.c + * Based on ev-view.c, also a part of atril, a mate document viewer. * * Atril is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by @@ -28,8 +28,10 @@ #else #include #endif + #include "ev-web-view.h" #include "ev-document-model.h" + #define EV_WEB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EV_TYPE_WEB_VIEW, EvWebViewClass)) #define EV_IS_WEB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EV_TYPE_WEB_VIEW)) #define EV_WEB_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EV_TYPE_WEB_VIEW, EvWebViewClass)) @@ -133,11 +135,12 @@ ev_web_view_change_page (EvWebView *webview, g_return_if_fail(EV_IS_WEB_VIEW(webview)); EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS(webview->document); + EvPage *page = klass->get_page(webview->document,new_page); - webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview),(gchar*)page->backend_page); webview->current_page = new_page; ev_document_model_set_page(webview->model,new_page); + webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview),(gchar*)page->backend_page); } static void @@ -187,11 +190,8 @@ ev_web_view_document_changed_cb (EvDocumentModel *model, } gint current_page = ev_document_model_get_page(model); - if (webview->current_page != current_page) { - ev_web_view_change_page (webview, current_page); - } else { - webkit_web_view_reload (WEBKIT_WEB_VIEW(webview)); - } + + ev_web_view_change_page (webview, current_page); } } @@ -365,6 +365,18 @@ ev_web_view_select_all(EvWebView *webview) webkit_web_view_select_all(WEBKIT_WEB_VIEW(webview)); } +void +ev_web_view_copy(EvWebView *webview) +{ + /* If for some reason we don't have a selection any longer,best to be safe*/ + if (ev_web_view_get_has_selection(webview) == FALSE) + return; + if (webkit_web_view_can_copy_clipboard(WEBKIT_WEB_VIEW(webview))) { + webkit_web_view_copy_clipboard(WEBKIT_WEB_VIEW(webview)); + } + +} + gboolean ev_web_view_zoom_in(EvWebView *webview) { -- cgit v1.2.1