Commit 3826b15b authored by Sagar Ghuge's avatar Sagar Ghuge Committed by Paolo Borelli

Support Ctrl+scroll to zoom in the print preview

Allow user to zoom in/out using the scroll up
and scroll down.

https://bugzilla.gnome.org/show_bug.cgi?id=729011
parent c6279ce3
......@@ -545,6 +545,32 @@ close_button_clicked (GtkWidget *button,
gtk_widget_destroy (GTK_WIDGET (preview));
}
static gboolean
scroll_event_activated (GtkWidget *widget,
GdkEventScroll *event,
GeditPrintPreview *preview)
{
if (event->state & GDK_CONTROL_MASK)
{
if ((event->direction == GDK_SCROLL_UP) ||
(event->direction == GDK_SCROLL_SMOOTH &&
event->delta_y < 0))
{
zoom_in (preview);
}
else if ((event->direction == GDK_SCROLL_DOWN) ||
(event->direction == GDK_SCROLL_SMOOTH &&
event->delta_y > 0))
{
zoom_out (preview);
}
return GDK_EVENT_STOP;
}
return GDK_EVENT_PROPAGATE;
}
static gint
get_first_page_displayed (GeditPrintPreview *preview)
{
......@@ -883,6 +909,11 @@ gedit_print_preview_init (GeditPrintPreview *preview)
G_CALLBACK (close_button_clicked),
preview);
g_signal_connect (priv->layout,
"scroll-event",
G_CALLBACK (scroll_event_activated),
preview);
g_object_set (priv->layout, "has-tooltip", TRUE, NULL);
g_signal_connect (priv->layout,
"query-tooltip",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment