#include "ev-window.h"
#include "ev-window-title.h"
+#include "ev-navigation-action.h"
#include "ev-page-action.h"
#include "ev-sidebar.h"
#include "ev-sidebar-links.h"
#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 "ev-file-helpers.h"
#include "ev-utils.h"
#include "ev-debug.h"
+#include "ev-history.h"
#ifdef WITH_GNOME_PRINT
#include "ev-print-job.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;
gboolean unlink_temp_file;
EvDocument *document;
-
+ EvHistory *history;
EvPageCache *page_cache;
EvWindowPageMode page_mode;
EvWindowTitle *title;
#define PAGE_SELECTOR_ACTION "PageSelector"
#define ZOOM_CONTROL_ACTION "ViewZoom"
+#define NAVIGATION_ACTION "Navigation"
#define GCONF_OVERRIDE_RESTRICTIONS "/apps/evince/override_restrictions"
#define GCONF_LOCKDOWN_SAVE "/desktop/gnome/lockdown/disable_save_to_disk"
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;
/* Toolbar-specific actions: */
ev_window_set_action_sensitive (ev_window, PAGE_SELECTOR_ACTION, has_pages);
ev_window_set_action_sensitive (ev_window, ZOOM_CONTROL_ACTION, has_pages);
+ ev_window_set_action_sensitive (ev_window, NAVIGATION_ACTION, has_pages);
ev_window_update_actions (ev_window);
}
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);
gint page,
EvWindow *ev_window)
{
+ gchar *label;
+
ev_window_update_actions (ev_window);
+
+ if (ev_window->priv->history) {
+ label = ev_page_cache_get_page_label (ev_window->priv->page_cache, page);
+ ev_history_add_page (ev_window->priv->history, page, label);
+ g_free (label);
+ }
if (!ev_window_is_empty (ev_window))
ev_metadata_manager_set_int (ev_window->priv->uri, "page", 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);
}
ev_page_action_set_document (EV_PAGE_ACTION (action), document);
ev_window_setup_action_sensitivity (ev_window);
+ if (ev_window->priv->history)
+ g_object_unref (ev_window->priv->history);
+ ev_window->priv->history = ev_history_new ();
+ action = gtk_action_group_get_action (ev_window->priv->action_group, NAVIGATION_ACTION);
+ ev_navigation_action_set_history (EV_NAVIGATION_ACTION (action), ev_window->priv->history);
+ ev_navigation_action_set_window (EV_NAVIGATION_ACTION (action), ev_window);
+
if (ev_window->priv->properties) {
ev_properties_dialog_set_document (EV_PROPERTIES_DIALOG (ev_window->priv->properties),
ev_window->priv->document);
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);
}
}
priv->dest = NULL;
}
+ if (priv->history) {
+ g_object_unref (priv->history);
+ priv->history = NULL;
+ }
+
if (priv->fullscreen_timeout_id) {
g_source_remove (priv->fullscreen_timeout_id);
priv->fullscreen_timeout_id = 0;
/* 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"),
G_CALLBACK (ev_window_cmd_edit_find_previous) },
{ "EditToolbar", NULL, N_("T_oolbar"), NULL, NULL,
G_CALLBACK (ev_window_cmd_edit_toolbar) },
- { "EditRotateLeft", "object-rotate-left", N_("Rotate _Left"), NULL, NULL,
+ { "EditRotateLeft", EV_STOCK_ROTATE_LEFT, N_("Rotate _Left"), NULL, NULL,
G_CALLBACK (ev_window_cmd_edit_rotate_left) },
- { "EditRotateRight", "object-rotate-right", N_("Rotate _Right"), NULL, NULL,
+ { "EditRotateRight", EV_STOCK_ROTATE_RIGHT, N_("Rotate _Right"), NULL, NULL,
G_CALLBACK (ev_window_cmd_edit_rotate_right) },
/* View menu */
}
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);
G_CALLBACK (zoom_control_changed_cb), window);
gtk_action_group_add_action (group, action);
g_object_unref (action);
+
+ action = g_object_new (EV_TYPE_NAVIGATION_ACTION,
+ "name", NAVIGATION_ACTION,
+ "label", _("Navigation"),
+ "is_important", TRUE,
+ "short_label", _("Back"),
+ "stock_id", GTK_STOCK_GO_DOWN,
+ "tooltip", _("Move across visited pages"),
+ NULL);
+ gtk_action_group_add_action (group, action);
+ g_object_unref (action);
}
static void
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);