[Goodies-commits] r3792 - ristretto/trunk/src
Stephan Arts
stephan at xfce.org
Fri Jan 11 15:59:45 CET 2008
Author: stephan
Date: 2008-01-11 14:59:45 +0000 (Fri, 11 Jan 2008)
New Revision: 3792
Modified:
ristretto/trunk/src/main_window.c
ristretto/trunk/src/picture_viewer.c
ristretto/trunk/src/picture_viewer.h
Log:
Add zoom modes
Modified: ristretto/trunk/src/main_window.c
===================================================================
--- ristretto/trunk/src/main_window.c 2008-01-09 23:12:01 UTC (rev 3791)
+++ ristretto/trunk/src/main_window.c 2008-01-11 14:59:45 UTC (rev 3792)
@@ -1743,6 +1743,7 @@
static void
cb_rstto_main_window_zoom_in(GtkWidget *widget, RsttoMainWindow *window)
{
+ rstto_picture_viewer_set_zoom_mode(RSTTO_PICTURE_VIEWER(window->priv->picture_viewer), RSTTO_ZOOM_MODE_CUSTOM);
gdouble scale = rstto_picture_viewer_get_scale(RSTTO_PICTURE_VIEWER(window->priv->picture_viewer));
rstto_picture_viewer_set_scale(RSTTO_PICTURE_VIEWER(window->priv->picture_viewer), scale * window->priv->zoom_factor);
}
@@ -1750,6 +1751,7 @@
static void
cb_rstto_main_window_zoom_out(GtkWidget *widget, RsttoMainWindow *window)
{
+ rstto_picture_viewer_set_zoom_mode(RSTTO_PICTURE_VIEWER(window->priv->picture_viewer), RSTTO_ZOOM_MODE_CUSTOM);
gdouble scale = rstto_picture_viewer_get_scale(RSTTO_PICTURE_VIEWER(window->priv->picture_viewer));
rstto_picture_viewer_set_scale(RSTTO_PICTURE_VIEWER(window->priv->picture_viewer), scale / window->priv->zoom_factor);
}
@@ -1757,12 +1759,14 @@
static void
cb_rstto_main_window_zoom_100(GtkWidget *widget, RsttoMainWindow *window)
{
+ rstto_picture_viewer_set_zoom_mode(RSTTO_PICTURE_VIEWER(window->priv->picture_viewer), RSTTO_ZOOM_MODE_100);
rstto_picture_viewer_set_scale(RSTTO_PICTURE_VIEWER(window->priv->picture_viewer), 1);
}
static void
cb_rstto_main_window_zoom_fit(GtkWidget *widget, RsttoMainWindow *window)
{
+ rstto_picture_viewer_set_zoom_mode(RSTTO_PICTURE_VIEWER(window->priv->picture_viewer), RSTTO_ZOOM_MODE_FIT);
rstto_picture_viewer_fit_scale(RSTTO_PICTURE_VIEWER(window->priv->picture_viewer));
}
Modified: ristretto/trunk/src/picture_viewer.c
===================================================================
--- ristretto/trunk/src/picture_viewer.c 2008-01-09 23:12:01 UTC (rev 3791)
+++ ristretto/trunk/src/picture_viewer.c 2008-01-11 14:59:45 UTC (rev 3792)
@@ -36,6 +36,7 @@
{
RsttoNavigator *navigator;
RsttoNavigatorEntry *entry;
+ RsttoZoomMode zoom_mode;
GdkPixbuf *src_pixbuf;
GdkPixbuf *dst_pixbuf; /* The pixbuf which ends up on screen */
@@ -142,6 +143,7 @@
viewer->priv->src_pixbuf = NULL;
viewer->priv->dst_pixbuf = NULL;
+ viewer->priv->zoom_mode = RSTTO_ZOOM_MODE_FIT;
gtk_widget_set_redraw_on_allocate(GTK_WIDGET(viewer), TRUE);
gtk_widget_set_events (GTK_WIDGET(viewer),
GDK_BUTTON_PRESS_MASK |
@@ -580,6 +582,21 @@
}
}
+ switch (viewer->priv->zoom_mode)
+ {
+ case RSTTO_ZOOM_MODE_FIT:
+ fit_to_screen = TRUE;
+ rstto_navigator_entry_set_fit_to_screen(entry, TRUE);
+ break;
+ case RSTTO_ZOOM_MODE_100:
+ fit_to_screen = FALSE;
+ scale = 1.0;
+ rstto_navigator_entry_set_scale(entry, scale);
+ break;
+ case RSTTO_ZOOM_MODE_CUSTOM:
+ break;
+ }
+
if(fit_to_screen)
{
gdouble h_scale = GTK_WIDGET(viewer)->allocation.width / width;
@@ -1100,3 +1117,8 @@
rstto_picture_viewer_paint(GTK_WIDGET(viewer));
}
+void
+rstto_picture_viewer_set_zoom_mode(RsttoPictureViewer *viewer, RsttoZoomMode mode)
+{
+ viewer->priv->zoom_mode = mode;
+}
Modified: ristretto/trunk/src/picture_viewer.h
===================================================================
--- ristretto/trunk/src/picture_viewer.h 2008-01-09 23:12:01 UTC (rev 3791)
+++ ristretto/trunk/src/picture_viewer.h 2008-01-11 14:59:45 UTC (rev 3792)
@@ -39,6 +39,13 @@
G_TYPE_CHECK_CLASS_TYPE ((klass), \
RSTTO_TYPE_PICTURE_VIEWER()))
+typedef enum
+{
+ RSTTO_ZOOM_MODE_100,
+ RSTTO_ZOOM_MODE_FIT,
+ RSTTO_ZOOM_MODE_CUSTOM
+} RsttoZoomMode;
+
typedef struct _RsttoPictureViewerPriv RsttoPictureViewerPriv;
typedef struct _RsttoPictureViewer RsttoPictureViewer;
@@ -77,6 +84,8 @@
rstto_picture_viewer_get_bg_color (RsttoPictureViewer *viewer);
void rstto_picture_viewer_redraw (RsttoPictureViewer *viewer);
+void
+rstto_picture_viewer_set_zoom_mode(RsttoPictureViewer *viewer, RsttoZoomMode mode);
G_END_DECLS
More information about the Goodies-commits
mailing list