#include "ev-password.h"
#include "ev-password-view.h"
#include "ev-properties-dialog.h"
-#include "ev-ps-exporter.h"
+#include "ev-file-exporter.h"
#include "ev-document-thumbnails.h"
#include "ev-document-links.h"
#include "ev-document-fonts.h"
#include <gtk/gtkprintunixdialog.h>
#endif
+#ifdef ENABLE_PDF
#include <poppler.h>
+#endif
#include <glib/gstdio.h>
#include <glib/gi18n.h>
GtkWidget *fullscreen_toolbar;
GtkWidget *fullscreen_popup;
guint fullscreen_timeout_id;
-
+
/* Popup link */
GtkWidget *view_popup;
EvLink *link;
#endif
};
-static const GtkTargetEntry ev_drop_types[] = {
- { "text/uri-list", 0, 0 }
-};
-
-
#define EV_WINDOW_GET_PRIVATE(object) \
(G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_WINDOW, EvWindowPrivate))
G_DEFINE_TYPE (EvWindow, ev_window, GTK_TYPE_WINDOW)
+static gdouble
+ev_window_get_screen_dpi (EvWindow *ev_window)
+{
+ GdkScreen *screen;
+ gdouble xdpi, ydpi;
+
+ screen = gtk_window_get_screen (GTK_WINDOW (ev_window));
+
+ xdpi = 25.4 * gdk_screen_get_width (screen) / gdk_screen_get_width_mm (screen);
+ ydpi = 25.4 * gdk_screen_get_height (screen) / gdk_screen_get_height_mm (screen);
+
+ return (xdpi + ydpi) / 2.0;
+}
+
static void
ev_window_set_action_sensitive (EvWindow *ev_window,
const char *name,
ok_to_copy = (info->permissions & EV_DOCUMENT_PERMISSIONS_OK_TO_COPY);
}
- if (has_document && !EV_IS_PS_EXPORTER(document))
+ if (has_document && !EV_IS_FILE_EXPORTER(document))
ok_to_print = FALSE;
ZOOM_CONTROL_ACTION);
real_zoom = ev_view_get_zoom (EV_VIEW (ev_window->priv->view));
+ real_zoom *= 72.0 / ev_window_get_screen_dpi (ev_window);
zoom = ephy_zoom_get_nearest_zoom_level (real_zoom);
ephy_zoom_action_set_zoom_level (EPHY_ZOOM_ACTION (action), zoom);
{
char *uri = window->priv->uri;
GValue page = { 0, };
+ gint n_pages;
gint new_page;
+ /* View the previously shown page, but make sure to not open a document on
+ * the last page, since closing it on the last page most likely means the
+ * user was finished reading the document. In that case, reopening should
+ * show the first page. */
if (uri && ev_metadata_manager_get (uri, "page", &page, TRUE)) {
- new_page = CLAMP (g_value_get_int (&page), 0, ev_page_cache_get_n_pages (window->priv->page_cache) - 1);
+ n_pages = ev_page_cache_get_n_pages (window->priv->page_cache);
+ new_page = CLAMP (g_value_get_int (&page), 0, n_pages - 1);
+ if (new_page == n_pages - 1)
+ new_page = 0;
ev_page_cache_set_current_page (window->priv->page_cache,
new_page);
g_value_unset (&page);
/* Zoom */
if (ev_metadata_manager_get (uri, "zoom", &zoom, FALSE) &&
ev_view_get_sizing_mode (view) == EV_SIZING_FREE) {
- ev_view_set_zoom (view, g_value_get_double (&zoom), FALSE);
+ gdouble zoom_value;
+
+ zoom_value = g_value_get_double (&zoom);
+ zoom_value *= ev_window_get_screen_dpi (window) / 72.0;
+ ev_view_set_zoom (view, zoom_value, FALSE);
g_value_unset (&zoom);
}
gdouble width;
gdouble height;
GtkPrintPages print_pages;
+ const gchar *file_format;
if (response != GTK_RESPONSE_OK) {
gtk_widget_destroy (GTK_WIDGET (dialog));
window->priv->print_page_setup = g_object_ref (
gtk_print_unix_dialog_get_page_setup (GTK_PRINT_UNIX_DIALOG (dialog)));
+ file_format = gtk_print_settings_get (window->priv->print_settings,
+ GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT);
+
if (!gtk_printer_accepts_ps (window->priv->printer)) {
GtkWidget *msgdialog;
reverse = gtk_print_settings_get_reverse (window->priv->print_settings);
window->priv->print_job = ev_job_print_new (window->priv->document,
+ file_format ? file_format : "ps",
width, height,
ranges, n_ranges,
page_set,
void
ev_window_print_range (EvWindow *ev_window, int first_page, int last_page)
{
- GtkWidget *dialog;
- EvPageCache *page_cache;
- gint current_page;
- gint document_last_page;
+ GtkWidget *dialog;
+ EvPageCache *page_cache;
+ gint current_page;
+ gint document_last_page;
+ GtkPrintCapabilities capabilities;
g_return_if_fail (EV_IS_WINDOW (ev_window));
g_return_if_fail (ev_window->priv->document != NULL);
dialog = gtk_print_unix_dialog_new (_("Print"), GTK_WINDOW (ev_window));
ev_window->priv->print_dialog = dialog;
+
+ capabilities = GTK_PRINT_CAPABILITY_PAGE_SET |
+ GTK_PRINT_CAPABILITY_COPIES |
+ GTK_PRINT_CAPABILITY_COLLATE |
+ GTK_PRINT_CAPABILITY_REVERSE |
+ GTK_PRINT_CAPABILITY_SCALE |
+ GTK_PRINT_CAPABILITY_GENERATE_PS;
+
+ if (EV_IS_FILE_EXPORTER (ev_window->priv->document) &&
+ ev_file_exporter_format_supported (EV_FILE_EXPORTER (ev_window->priv->document),
+ EV_FILE_FORMAT_PDF)) {
+ capabilities |= GTK_PRINT_CAPABILITY_GENERATE_PDF;
+ }
+
gtk_print_unix_dialog_set_manual_capabilities (GTK_PRINT_UNIX_DIALOG (dialog),
- GTK_PRINT_CAPABILITY_PAGE_SET |
- GTK_PRINT_CAPABILITY_COPIES |
- GTK_PRINT_CAPABILITY_COLLATE |
- GTK_PRINT_CAPABILITY_REVERSE |
- GTK_PRINT_CAPABILITY_SCALE |
- GTK_PRINT_CAPABILITY_GENERATE_PS);
+ capabilities);
gtk_print_unix_dialog_set_current_page (GTK_PRINT_UNIX_DIALOG (dialog),
current_page);
GTK_WINDOW (ev_window));
}
+ ev_document_fc_mutex_lock ();
gtk_widget_show (ev_window->priv->properties);
+ ev_document_fc_mutex_unlock ();
}
static void
{
EvView *view = EV_VIEW (window->priv->view);
- if (!view || !ev_view_get_fullscreen (EV_VIEW (view)))
+ if (!view ||
+ (!ev_view_get_fullscreen (EV_VIEW (view)) &&
+ !ev_view_get_presentation (EV_VIEW (view))))
return FALSE;
-
+
update_chrome_flag (window, EV_CHROME_FULLSCREEN_TOOLBAR, FALSE);
ev_view_hide_cursor (EV_VIEW (window->priv->view));
window->priv->fullscreen_timeout_id = 0;
window);
fullscreen_set_timeout (window);
+ ev_application_screensaver_disable (EV_APP);
+
if (!ev_window_is_empty (window))
ev_metadata_manager_set_boolean (window->priv->uri, "presentation", TRUE);
}
window);
fullscreen_clear_timeout (window);
+ ev_application_screensaver_enable (EV_APP);
+
if (!ev_window_is_empty (window))
ev_metadata_manager_set_boolean (window->priv->uri, "presentation", FALSE);
}
ev_window_update_actions (ev_window);
if (ev_view_get_sizing_mode (view) == EV_SIZING_FREE && !ev_window_is_empty (ev_window)) {
- ev_metadata_manager_set_double (ev_window->priv->uri, "zoom",
- ev_view_get_zoom (view));
+ gdouble zoom;
+
+ zoom = ev_view_get_zoom (view);
+ zoom *= 72.0 / ev_window_get_screen_dpi (ev_window);
+ ev_metadata_manager_set_double (ev_window->priv->uri, "zoom", zoom);
}
}
static char *
build_comments_string (void)
{
+#ifdef ENABLE_PDF
PopplerBackend backend;
const char *backend_name;
const char *version;
break;
}
- return g_strdup_printf (_("PostScript and PDF File Viewer.\n"
+ return g_strdup_printf (_("Document Viewer.\n"
"Using poppler %s (%s)"),
version, backend_name);
+#else
+ return g_strdup_printf (_("Document Viewer"));
+#endif
}
static void
"name", _("Evince"),
"version", VERSION,
"copyright",
- _("\xc2\xa9 1996-2005 The Evince authors"),
+ _("\xc2\xa9 1996-2007 The Evince authors"),
"license", license_trans,
"website", "http://www.gnome.org/projects/evince",
"comments", comments,
ev_view_set_sizing_mode (EV_VIEW (ev_window->priv->view), mode);
if (mode == EV_SIZING_FREE) {
- ev_view_set_zoom (EV_VIEW (ev_window->priv->view), zoom, FALSE);
+ ev_view_set_zoom (EV_VIEW (ev_window->priv->view),
+ zoom * ev_window_get_screen_dpi (ev_window) / 72.0,
+ FALSE);
}
}
/* Edit menu */
{ "EditCopy", GTK_STOCK_COPY, NULL, "<control>C", NULL,
G_CALLBACK (ev_window_cmd_edit_copy) },
- { "EditSelectAll", NULL, N_("Select _All"), "<control>A", NULL,
+#ifdef HAVE_GTK_RECENT
+ { "EditSelectAll", GTK_STOCK_SELECT_ALL, N_("Select _All"), "<control>A", NULL,
+#else
+ { "EditSelectAll", NULL, N_("Select _All"), "<control>A", NULL,
+#endif /* HAVE_GTK_RECENT */
G_CALLBACK (ev_window_cmd_edit_select_all) },
{ "EditFind", GTK_STOCK_FIND, N_("_Find..."), "<control>F",
N_("Find a word or phrase in the document"),
NULL, G_CALLBACK (ev_attachment_popup_cmd_save_attachment_as) },
};
-static void
-drag_data_received_cb (GtkWidget *widget, GdkDragContext *context,
- gint x, gint y, GtkSelectionData *selection_data,
- guint info, guint time, gpointer gdata)
-{
- GList *uri_list = NULL;
- GSList *uris = NULL;
- gchar *uri;
-
- uri_list = gnome_vfs_uri_list_parse ((gchar *) selection_data->data);
-
- if (uri_list) {
- while (uri_list) {
- uri = gnome_vfs_uri_to_string (uri_list->data, GNOME_VFS_URI_HIDE_NONE);
- uris = g_slist_append (uris, (gpointer) uri);
-
- uri_list = g_list_next (uri_list);
- }
-
- gnome_vfs_uri_list_free (uri_list);
-
- ev_application_open_uri_list (EV_APP, uris,
- gtk_widget_get_screen (widget),
- 0);
-
- g_slist_free (uris);
- }
-}
-
static void
activate_link_cb (EvPageAction *page_action, EvLink *link, EvWindow *window)
{
}
static gboolean
-activate_label_cb (EvPageAction *page_action, char *label, EvWindow *window)
+activate_label_cb (EvPageAction *page_action, const gchar *label, EvWindow *window)
{
g_return_val_if_fail (EV_IS_WINDOW (window), FALSE);
static void
launch_external_uri (EvWindow *window, EvLinkAction *action)
{
- const char *uri;
- char *escaped;
-
- uri = ev_link_action_get_uri (action);
- escaped = gnome_vfs_escape_host_and_path_string (uri);
-
- gnome_vfs_url_show (escaped);
- g_free (escaped);
+ gnome_vfs_url_show (ev_link_action_get_uri (action));
}
static void
/* Give focus to the document view */
gtk_widget_grab_focus (ev_window->priv->view);
- /* Drag and Drop */
- gtk_drag_dest_unset (GTK_WIDGET (ev_window->priv->view));
- gtk_drag_dest_set (GTK_WIDGET (ev_window->priv->view),
- GTK_DEST_DEFAULT_ALL,
- ev_drop_types,
- sizeof (ev_drop_types) / sizeof (ev_drop_types[0]),
- GDK_ACTION_COPY);
- g_signal_connect_swapped (G_OBJECT (ev_window->priv->view), "drag-data-received",
- G_CALLBACK (drag_data_received_cb),
- ev_window);
-
/* Set it user interface params */
-
ev_window_setup_recent (ev_window);
setup_chrome_from_metadata (ev_window);