+2007-07-27 Johannes Buchner <buchner.johannes@gmx.at>
+
+ * shell/ev-utils.c: (get_num_monitors), (get_screen_dpi):
+ * shell/ev-utils.h:
+ * shell/ev-view.c: (ev_view_set_zoom_for_size),
+ (ev_view_update_view_size):
+ * shell/ev-view.h:
+ * shell/ev-window.c: (ev_window_update_actions),
+ (setup_view_from_metadata), (ev_window_screen_changed),
+ (ev_window_sizing_mode_changed_cb), (ev_window_zoom_changed_cb),
+ (zoom_control_changed_cb):
+ * shell/ev-window.h:
+
+ Reorganizes utility functions.
+
2007-07-26 Carlos Garcia Campos <carlosgc@gnome.org>
* shell/ev-pixbuf-cache.c: (job_page_ready_cb), (job_finished_cb),
Add page_ready signal to notify that page is ready as soon as
possible even if other page elements like links, forms, images or
text mapping are not ready yet.
-
+
2007-07-26 Carlos Garcia Campos <carlosgc@gnome.org>
* backend/dvi/dvi-document.c: (dvi_document_file_exporter_begin),
Use capabilities to know which options should be offered by the
print dialog depending on the document backend.
-
+
2007-07-25 Carlos Garcia Campos <carlosgc@gnome.org>
* shell/ev-view.c: (ev_view_handle_cursor_over_xy):
Give priority to forms over text to set the cursor.
-
+
2007-07-24 Carlos Garcia Campos <carlosgc@gnome.org>
* shell/ev-view-private.h:
Use IBEAM cursor for text form fields and NORMAL cursor for read
only fields. Remove unused status attribute.
-
+
2007-07-20 Carlos Garcia Campos <carlosgc@gnome.org>
* shell/ev-view.c: (ev_view_form_field_button_create_widget):
Update region for current selected items also for checkbox
buttons, since they can behave as radio buttons when they are in a
set.
-
+
2007-07-19 Carlos Garcia Campos <carlosgc@gnome.org>
* configure.ac:
* backend/pdf/ev-poppler.cc: (ev_form_field_from_poppler_field):
Get max length of text form fields.
-
+
2007-07-19 Carlos Garcia Campos <carlosgc@gnome.org>
* backend/pdf/ev-poppler.cc: (ev_form_field_from_poppler_field):
* shell/ev-view.c: (ev_view_form_field_text_create_widget):
Fix build with current poppler cvs head.
-
+
2007-07-11 Carlos Garcia Campos <carlosgc@gnome.org>
* cut-n-paste/zoom-control/ephy-zoom-control.c:
Fix build with gtk+ >= 2.11.5 due to gtktooltips
deprecation. Fixes bug #455667
-
+
2007-07-10 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
* NEWS:
ev_gui_sanitise_popup_position (menu, widget, x, y);
}
+/**
+ * get_num_monitors: Get the number of user monitors.
+ * @window: optional GtkWindow to look at.
+ *
+ * Returns: Number of monitors, -1 if uncertain situation (like multiple screens)
+ */
+gint
+get_num_monitors (GtkWindow * window)
+{
+ GdkDisplay * display;
+ GdkScreen * screen;
+ gint num_screen = gdk_display_get_n_screens(display);
+
+ display = gdk_display_get_default();
+
+ if (num_screen != 1)
+ return -1;
+
+ if (window)
+ screen = gtk_window_get_screen(window);
+ else
+ screen = gdk_display_get_screen(display, 0);
+
+ return gdk_screen_get_n_monitors(screen);
+}
+
+gdouble
+get_screen_dpi (GtkWindow * window)
+{
+ GdkScreen *screen;
+ gdouble xdpi, ydpi;
+
+ screen = gtk_window_get_screen (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;
+}
+
void ev_print_region_contents (GdkRegion *region);
-void ev_gui_menu_position_tree_selection (GtkMenu *menu,
- gint *x,
- gint *y,
- gboolean *push_in,
- gpointer user_data);
+void ev_gui_menu_position_tree_selection (GtkMenu *menu,
+ gint *x,
+ gint *y,
+ gboolean *push_in,
+ gpointer user_data);
#ifdef WITH_GNOME_PRINT
GnomePrintConfig* load_print_config_from_file (void);
gboolean using_postscript_printer (GnomePrintConfig *config);
gboolean using_pdf_printer (GnomePrintConfig *config);
#endif
+gint get_num_monitors (GtkWindow * window);
+
+gdouble get_screen_dpi (GtkWindow * window);
G_END_DECLS
ev_view_set_zoom (view, scale, FALSE);
}
-void
+static void
ev_view_set_zoom_for_size (EvView *view,
int width,
int height,
int vsb_width,
int hsb_height)
{
+ g_return_if_fail (EV_IS_VIEW (view));
g_return_if_fail (view->sizing_mode == EV_SIZING_FIT_WIDTH ||
view->sizing_mode == EV_SIZING_BEST_FIT);
g_return_if_fail (width >= 0);
}
return etype;
}
+
+void
+ev_view_update_view_size (EvView *view, GtkScrolledWindow * scrolled_window)
+{
+ int width, height;
+ GtkRequisition vsb_requisition;
+ GtkRequisition hsb_requisition;
+ int scrollbar_spacing;
+
+ /* Calculate the width available for the content */
+ width = GTK_WIDGET (scrolled_window)->allocation.width;
+ height = GTK_WIDGET (scrolled_window)->allocation.height;
+
+ if (gtk_scrolled_window_get_shadow_type (scrolled_window) == GTK_SHADOW_IN
+ && view) {
+ width -= 2 * GTK_WIDGET(view)->style->xthickness;
+ height -= 2 * GTK_WIDGET(view)->style->ythickness;
+ }
+
+ gtk_widget_size_request (scrolled_window->vscrollbar, &vsb_requisition);
+ gtk_widget_size_request (scrolled_window->hscrollbar, &hsb_requisition);
+ gtk_widget_style_get (GTK_WIDGET (scrolled_window),
+ "scrollbar_spacing",
+ &scrollbar_spacing,
+ NULL);
+
+ if (EV_IS_VIEW(view)) {
+ ev_view_set_zoom_for_size (EV_VIEW (view),
+ MAX (1, width),
+ MAX (1, height),
+ vsb_requisition.width + scrollbar_spacing,
+ hsb_requisition.height + scrollbar_spacing);
+ }
+}
#include <gtk/gtkwidget.h>
#include <gtk/gtklayout.h>
+#include <gtk/gtkscrolledwindow.h>
#include "ev-document.h"
#include "ev-link.h"
double factor,
gboolean relative);
double ev_view_get_zoom (EvView *view);
-void ev_view_set_zoom_for_size (EvView *view,
- int width,
- int height,
- int vsb_width,
- int hsb_height);
void ev_view_set_screen_dpi (EvView *view,
gdouble dpi);
void ev_view_rotate_left (EvView *view);
gboolean ev_view_previous_page (EvView *view);
gchar* ev_view_page_label_from_dest (EvView *view, EvLinkDest *dest);
+void ev_view_update_view_size (EvView *view, GtkScrolledWindow *scrolled_window);
+
G_END_DECLS
#endif /* __EV_VIEW_H__ */
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,
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);
+ real_zoom *= 72.0 / get_screen_dpi (GTK_WINDOW (ev_window));
zoom = ephy_zoom_get_nearest_zoom_level (real_zoom);
ephy_zoom_action_set_zoom_level (EPHY_ZOOM_ACTION (action), zoom);
gdouble zoom_value;
zoom_value = g_value_get_double (&zoom);
- zoom_value *= ev_window_get_screen_dpi (window) / 72.0;
+ zoom_value *= get_screen_dpi (GTK_WINDOW (window)) / 72.0;
ev_view_set_zoom (view, zoom_value, FALSE);
g_value_unset (&zoom);
}
{
gboolean presentation;
- g_return_if_fail (EV_IS_WINDOW (window));
+ g_return_if_fail (EV_IS_WINDOW (window));
ev_window_stop_fullscreen (window);
presentation = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
#endif
ev_view_set_screen_dpi (EV_VIEW (window->priv->view),
- ev_window_get_screen_dpi (window));
+ get_screen_dpi (GTK_WINDOW (window)));
if (GTK_WIDGET_CLASS (ev_window_parent_class)->screen_changed) {
GTK_WIDGET_CLASS (ev_window_parent_class)->screen_changed (widget, old_screen);
}
}
-static void
-update_view_size (EvView *view, EvWindow *window)
-{
- int width, height;
- GtkRequisition vsb_requisition;
- GtkRequisition hsb_requisition;
- int scrollbar_spacing;
-
- /* Calculate the width available for the */
- width = window->priv->scrolled_window->allocation.width;
- height = window->priv->scrolled_window->allocation.height;
-
- if (gtk_scrolled_window_get_shadow_type (GTK_SCROLLED_WINDOW (window->priv->scrolled_window)) == GTK_SHADOW_IN) {
- width -= 2 * window->priv->view->style->xthickness;
- height -= 2 * window->priv->view->style->ythickness;
- }
-
- gtk_widget_size_request (GTK_SCROLLED_WINDOW (window->priv->scrolled_window)->vscrollbar,
- &vsb_requisition);
- gtk_widget_size_request (GTK_SCROLLED_WINDOW (window->priv->scrolled_window)->hscrollbar,
- &hsb_requisition);
- gtk_widget_style_get (window->priv->scrolled_window,
- "scrollbar_spacing", &scrollbar_spacing,
- NULL);
-
- ev_view_set_zoom_for_size (EV_VIEW (window->priv->view),
- MAX (1, width),
- MAX (1, height),
- vsb_requisition.width + scrollbar_spacing,
- hsb_requisition.height + scrollbar_spacing);
-}
-
static void
save_sizing_mode (EvWindow *window)
{
scrolled_window = ev_window->priv->scrolled_window;
- g_signal_handlers_disconnect_by_func (ev_window->priv->view, update_view_size, ev_window);
+ g_signal_handlers_disconnect_by_func (ev_window->priv->view, ev_view_update_view_size, scrolled_window);
if (sizing_mode != EV_SIZING_FREE)
- update_view_size (NULL, ev_window);
+ ev_view_update_view_size (ev_window->priv->view, GTK_SCROLLED_WINDOW (scrolled_window));
switch (sizing_mode) {
case EV_SIZING_BEST_FIT:
"vscrollbar-policy", GTK_POLICY_AUTOMATIC,
NULL);
g_signal_connect (ev_window->priv->view, "zoom_invalid",
- G_CALLBACK (update_view_size),
- ev_window);
+ G_CALLBACK (ev_view_update_view_size),
+ scrolled_window);
break;
case EV_SIZING_FIT_WIDTH:
g_object_set (G_OBJECT (scrolled_window),
"vscrollbar-policy", GTK_POLICY_AUTOMATIC,
NULL);
g_signal_connect (ev_window->priv->view, "zoom_invalid",
- G_CALLBACK (update_view_size),
- ev_window);
+ G_CALLBACK (ev_view_update_view_size),
+ scrolled_window);
break;
case EV_SIZING_FREE:
g_object_set (G_OBJECT (scrolled_window),
gdouble zoom;
zoom = ev_view_get_zoom (view);
- zoom *= 72.0 / ev_window_get_screen_dpi (ev_window);
+ zoom *= 72.0 / get_screen_dpi (GTK_WINDOW(ev_window));
ev_metadata_manager_set_double (ev_window->priv->uri, "zoom", zoom);
}
}
if (mode == EV_SIZING_FREE) {
ev_view_set_zoom (EV_VIEW (ev_window->priv->view),
- zoom * ev_window_get_screen_dpi (ev_window) / 72.0,
+ zoom * get_screen_dpi (GTK_WINDOW (ev_window)) / 72.0,
FALSE);
}
}
ev_window->priv->view = ev_view_new ();
ev_view_set_screen_dpi (EV_VIEW (ev_window->priv->view),
- ev_window_get_screen_dpi (ev_window));
+ get_screen_dpi (GTK_WINDOW (ev_window)));
ev_window->priv->password_view = ev_password_view_new ();
g_signal_connect_swapped (ev_window->priv->password_view,
"unlock",
#include <glib-object.h>
#include <gtk/gtkwindow.h>
+#include <gtk/gtkscrolledwindow.h>
#include "ev-link.h"
#include "ev-page-cache.h"
G_END_DECLS
#endif /* !EV_WINDOW_H */
-