enum {
SIGNAL_BINDING_ACTIVATED,
SIGNAL_ZOOM_INVALID,
+ SIGNAL_HANDLE_LINK,
SIGNAL_EXTERNAL_LINK,
SIGNAL_POPUP_MENU,
N_SIGNALS,
view->current_page);
}
-void
+static void
ev_view_goto_dest (EvView *view, EvLinkDest *dest)
{
EvLinkDestType type;
action = ev_link_get_action (link);
if (!action)
return;
-
+
type = ev_link_action_get_action_type (action);
switch (type) {
case EV_LINK_ACTION_TYPE_GOTO_DEST: {
EvLinkDest *dest;
+ g_signal_emit (view, signals[SIGNAL_HANDLE_LINK], 0, link);
+
dest = ev_link_action_get_dest (action);
ev_view_goto_dest (view, dest);
}
}
}
-static gchar *
-page_label_from_dest (EvView *view, EvLinkDest *dest)
+gchar *
+ev_view_page_label_from_dest (EvView *view, EvLinkDest *dest)
{
EvLinkDestType type;
gchar *msg = NULL;
}
break;
+ case EV_LINK_DEST_TYPE_PAGE_LABEL: {
+ msg = g_strdup (ev_link_dest_get_page_label (dest));
+ }
+ break;
default:
msg = ev_page_cache_get_page_label (view->page_cache,
ev_link_dest_get_page (dest));
switch (type) {
case EV_LINK_ACTION_TYPE_GOTO_DEST:
- page_label = page_label_from_dest (view,
- ev_link_action_get_dest (action));
+ page_label = ev_view_page_label_from_dest (view,
+ ev_link_action_get_dest (action));
msg = g_strdup_printf (_("Go to page %s"), page_label);
g_free (page_label);
break;
GdkEventButton *event)
{
EvView *view = EV_VIEW (widget);
+
+ if (!view->document)
+ return FALSE;
if (!GTK_WIDGET_HAS_FOCUS (widget)) {
gtk_widget_grab_focus (widget);
}
gtk_widget_queue_draw (widget);
- } else if ((image = ev_view_get_image_at_location (view, event->x, event->y))) {
+ } else if (!location_in_text (view, event->x + view->scroll_x, event->y + view->scroll_y) &&
+ (image = ev_view_get_image_at_location (view, event->x, event->y))) {
if (view->image_dnd_info.image)
g_object_unref (view->image_dnd_info.image);
view->image_dnd_info.image = g_object_ref (image);
ev_view_set_cursor (view, EV_VIEW_CURSOR_NORMAL);
}
- if (view->document && view->pressed_button == 1) {
+ if (view->document && view->pressed_button != 3) {
link = ev_view_get_link_at_location (view, event->x, event->y);
} else {
link = NULL;
view->selection_info.in_drag = FALSE;
} else if (link) {
- ev_view_handle_link (view, link);
+ if (event->button == 2) {
+ EvLinkAction *action;
+ EvLinkActionType type;
+
+ action = ev_link_get_action (link);
+ if (!action)
+ return FALSE;
+
+ type = ev_link_action_get_action_type (action);
+ if (type == EV_LINK_ACTION_TYPE_GOTO_DEST) {
+ g_signal_emit (view,
+ signals[SIGNAL_EXTERNAL_LINK],
+ 0, action);
+ }
+ } else {
+ ev_view_handle_link (view, link);
+ }
} else if (view->presentation) {
switch (event->button) {
case 1:
EvView *view = EV_VIEW (widget);
EvPresentationState current;
+ if (!view->document)
+ return FALSE;
+
if (!view->presentation ||
view->presentation_state == EV_PRESENTATION_END)
return gtk_bindings_activate_event (GTK_OBJECT (widget), event);
NULL, NULL,
ev_marshal_VOID__VOID,
G_TYPE_NONE, 0, G_TYPE_NONE);
+ signals[SIGNAL_HANDLE_LINK] = g_signal_new ("handle-link",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EvViewClass, handle_link),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
signals[SIGNAL_EXTERNAL_LINK] = g_signal_new ("external-link",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
{
g_return_if_fail (view->sizing_mode == EV_SIZING_FREE);
+ if (view->presentation)
+ return;
+
view->pending_scroll = SCROLL_TO_CENTER;
ev_view_set_zoom (view, ZOOM_IN_FACTOR, TRUE);
}
{
g_return_if_fail (view->sizing_mode == EV_SIZING_FREE);
+ if (view->presentation)
+ return;
+
view->pending_scroll = SCROLL_TO_CENTER;
ev_view_set_zoom (view, ZOOM_OUT_FACTOR, TRUE);
}
{
GString *text;
GList *l;
+ gchar *normalized_text;
text = g_string_new (NULL);
ev_document_doc_mutex_unlock ();
- return g_string_free (text, FALSE);
+ normalized_text = g_utf8_normalize (text->str, text->len, G_NORMALIZE_NFKC);
+ g_string_free (text, TRUE);
+ return normalized_text;
}
void