#define ZOOM_OUT_FACTOR (1.0/ZOOM_IN_FACTOR)
#define MIN_SCALE 0.05409
-#define MAX_SCALE 18.4884
+#define MAX_SCALE 6.0
struct _EvView {
GtkWidget parent_instance;
LOG ("Finalize");
-
- ev_view_set_scroll_adjustments (view, NULL, NULL);
+ g_free (view->status);
+ g_free (view->find_status);
G_OBJECT_CLASS (ev_view_parent_class)->finalize (object);
}
find = EV_DOCUMENT_FIND (view->document);
- g_mutex_lock (EV_DOC_MUTEX);
results = ev_document_find_get_n_results (find, view->current_page);
- g_mutex_unlock (EV_DOC_MUTEX);
for (i = 0; i < results; i++) {
EvRectangle rectangle;
guchar alpha;
alpha = (i == view->find_result) ? 0x90 : 0x20;
- g_mutex_lock (EV_DOC_MUTEX);
ev_document_find_get_result (find, view->current_page,
i, &rectangle);
- g_mutex_unlock (EV_DOC_MUTEX);
doc_rect_to_view_rect (view, &rectangle, &view_rectangle);
draw_rubberband (GTK_WIDGET (view), view->bin_window,
&view_rectangle, alpha);
return;
}
- g_mutex_lock (EV_DOC_MUTEX);
+ ev_document_doc_mutex_lock ();
text = ev_document_get_text (ev_view->document,
ev_view->current_page,
&ev_view->selection);
- g_mutex_unlock (EV_DOC_MUTEX);
+ ev_document_doc_mutex_unlock ();
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (ev_view),
GDK_SELECTION_CLIPBOARD);
return;
}
- g_mutex_lock (EV_DOC_MUTEX);
+ ev_document_doc_mutex_lock ();
text = ev_document_get_text (ev_view->document,
ev_view->current_page,
&ev_view->selection);
- g_mutex_unlock (EV_DOC_MUTEX);
+ ev_document_doc_mutex_unlock ();
gtk_selection_data_set_text (selection_data, text, -1);
}
return TRUE;
}
+/* FIXME: standardize this sometime */
+static void
+go_to_link (EvView *view, EvLink *link)
+{
+ EvLinkType type;
+ const char *uri;
+ int page;
+
+ type = ev_link_get_link_type (link);
+
+ switch (type) {
+ case EV_LINK_TYPE_TITLE:
+ break;
+ case EV_LINK_TYPE_PAGE:
+ page = ev_link_get_page (link);
+ ev_page_cache_set_current_page (view->page_cache, page);
+ break;
+ case EV_LINK_TYPE_EXTERNAL_URI:
+ uri = ev_link_get_uri (link);
+ gnome_vfs_url_show (uri);
+ break;
+ }
+}
+
+
static gboolean
ev_view_button_release_event (GtkWidget *widget,
GdkEventButton *event)
link = get_link_at_location (view, event->x, event->y);
if (link) {
- ev_view_go_to_link (view, link);
+ go_to_link (view, link);
}
}
{
char *message;
-// g_mutex_lock (EV_DOC_MUTEX);
+// ev_document_doc_mutex_lock ();
if (view->current_page == view->find_page) {
int results;
-// g_mutex_lock (EV_DOC_MUTEX);
+// ev_document_doc_mutex_lock ();
results = ev_document_find_get_n_results
(EV_DOCUMENT_FIND (view->document),
view->current_page);
-// g_mutex_unlock (EV_DOC_MUTEX);
+// ev_document_doc_mutex_unlock ();
/* TRANS: Sometimes this could be better translated as
"%d hit(s) on this page". Therefore this string
contains plural cases. */
} else {
double percent;
- g_mutex_lock (EV_DOC_MUTEX);
+ ev_document_doc_mutex_lock ();
percent = ev_document_find_get_progress
(EV_DOCUMENT_FIND (view->document));
- g_mutex_unlock (EV_DOC_MUTEX);
+ ev_document_doc_mutex_unlock ();
if (percent >= (1.0 - 1e-10)) {
message = g_strdup (_("Not found"));
} else {
}
}
-// g_mutex_unlock (EV_DOC_MUTEX);
+// ev_document_doc_mutex_unlock ();
ev_view_set_find_status (view, message);
// g_free (message);
GdkRectangle view_rect;
int n_results;
- g_mutex_lock (EV_DOC_MUTEX);
+ ev_document_doc_mutex_lock ();
n_results = ev_document_find_get_n_results (find, view->current_page);
- g_mutex_unlock (EV_DOC_MUTEX);
+ ev_document_doc_mutex_unlock ();
if (n_results > view->find_result) {
- g_mutex_lock (EV_DOC_MUTEX);
+ ev_document_doc_mutex_lock ();
ev_document_find_get_result
(find, view->current_page, view->find_result, &rect);
- g_mutex_unlock (EV_DOC_MUTEX);
+ ev_document_doc_mutex_unlock ();
doc_rect_to_view_rect (view, &rect, &view_rect);
ensure_rectangle_is_visible (view, &view_rect);
page = page - n_pages;
}
- // g_mutex_lock (EV_DOC_MUTEX);
+ // ev_document_doc_mutex_lock ();
has_results = ev_document_find_page_has_results
(EV_DOCUMENT_FIND (view->document), page);
if (has_results == -1) {
}
}
-int
-ev_view_get_page (EvView *view)
-{
- return view->current_page;
-}
-
-static void
-go_to_link (EvView *view, EvLink *link)
-{
- EvLinkType type;
- const char *uri;
- int page;
-
- type = ev_link_get_link_type (link);
-
- switch (type) {
- case EV_LINK_TYPE_TITLE:
- break;
- case EV_LINK_TYPE_PAGE:
- page = ev_link_get_page (link);
- ev_page_cache_set_current_page (view->page_cache, page);
- break;
- case EV_LINK_TYPE_EXTERNAL_URI:
- uri = ev_link_get_uri (link);
- gnome_vfs_url_show (uri);
- break;
- }
-}
-
-void
-ev_view_go_to_link (EvView *view, EvLink *link)
-{
- go_to_link (view, link);
-}
-
static void
ev_view_zoom (EvView *view,
double factor,
gtk_widget_queue_resize (GTK_WIDGET (view));
}
+gboolean
+ev_view_can_zoom_in (EvView *view)
+{
+ if (view->width != -1 || view->height != -1) {
+ return TRUE;
+ }
+
+ return view->scale * ZOOM_IN_FACTOR <= MAX_SCALE;
+}
+
+gboolean
+ev_view_can_zoom_out (EvView *view)
+{
+ if (view->width != -1 || view->height != -1) {
+ return TRUE;
+ }
+
+ return view->scale * ZOOM_OUT_FACTOR >= MIN_SCALE;
+}
+
void
ev_view_zoom_in (EvView *view)
{
ev_view_zoom (view, ZOOM_OUT_FACTOR, TRUE);
}
+void
+ev_view_zoom_normal (EvView *view)
+{
+ ev_view_zoom (view, 1.0, FALSE);
+}
+
void
ev_view_set_size (EvView *view,
int width,
if (EV_IS_DOCUMENT_FIND (view->document)) {
EvDocumentFind *find = EV_DOCUMENT_FIND (view->document);
- g_mutex_lock (EV_DOC_MUTEX);
+ ev_document_doc_mutex_lock ();
n_results = ev_document_find_get_n_results (find, view->current_page);
- g_mutex_unlock (EV_DOC_MUTEX);
+ ev_document_doc_mutex_unlock ();
}
return n_results > 0;
EvDocumentFind *find = EV_DOCUMENT_FIND (view->document);
page_cache = ev_document_get_page_cache (view->document);
- g_mutex_lock (EV_DOC_MUTEX);
+ ev_document_doc_mutex_lock ();
n_results = ev_document_find_get_n_results (find, view->current_page);
- g_mutex_unlock (EV_DOC_MUTEX);
+ ev_document_doc_mutex_unlock ();
n_pages = ev_page_cache_get_n_pages (page_cache);
page_cache = ev_document_get_page_cache (view->document);
- g_mutex_lock (EV_DOC_MUTEX);
+ ev_document_doc_mutex_lock ();
n_results = ev_document_find_get_n_results (find, view->current_page);
- g_mutex_unlock (EV_DOC_MUTEX);
+ ev_document_doc_mutex_unlock ();
n_pages = ev_page_cache_get_n_pages (page_cache);