Commit 18139487 authored by David Odin's avatar David Odin

libgimpwidgets/gimppreview.c added a GimpPreview widget, abstract base for

* libgimpwidgets/gimppreview.c
* libgimpwidgets/gimppreview.h: added a GimpPreview widget, abstract
  base for a GimpDrawablePreview.

* libgimpwidgets/Makefile.am
* libgimpwidgets/gimpwidgets.h
* libgimpwidgets/gimpwidgetstypes.h: modified accordingly.

* libgimp/gimpdrawablepreview.c
* libgimp/gimpdrawablepreview.h: added a GimpDrawablePreview widget
  to ease	the use of previews by plug-ins.

* libgimp/Makefile.am
* libgimp/gimpui.h: Changed accordingly.

* plug-ins/common/despeckle.c
* plug-ins/common/gauss.c
* plug-ins/common/neon.c
* plug-ins/common/sobel.c
* plug-ins/common/softglow.c
* plug-ins/common/spread.c
* plug-ins/common/unsharp.c: use a GimpDrawablePreview with these plug-ins.
parent 7f045637
2004-08-31 DindinX <david@dindinx.org>
* libgimpwidgets/gimppreview.c
* libgimpwidgets/gimppreview.h: added a GimpPreview widget, abstract
base for a GimpDrawablePreview.
* libgimpwidgets/Makefile.am
* libgimpwidgets/gimpwidgets.h
* libgimpwidgets/gimpwidgetstypes.h: modified accordingly.
* libgimp/gimpdrawablepreview.c
* libgimp/gimpdrawablepreview.h: added a GimpDrawablePreview widget
to ease the use of previews by plug-ins.
* libgimp/Makefile.am
* libgimp/gimpui.h: Changed accordingly.
* plug-ins/common/despeckle.c
* plug-ins/common/gauss.c
* plug-ins/common/neon.c
* plug-ins/common/sobel.c
* plug-ins/common/softglow.c
* plug-ins/common/spread.c
* plug-ins/common/unsharp.c: use a GimpDrawablePreview with these
plug-ins.
2004-08-30 Michael Natterer <mitch@gimp.org>
* app/plug-in/plug-in-progress.[ch]: added boolean return values
......
......@@ -210,6 +210,8 @@ libgimpui_2_0_la_SOURCES = \
gimpmenu.h \
gimpbrushmenu.c \
gimpbrushmenu.h \
gimpdrawablepreview.c \
gimpdrawablepreview.h \
gimpfontmenu.c \
gimpfontmenu.h \
gimpgradientmenu.c \
......@@ -255,6 +257,7 @@ gimpinclude_HEADERS = \
gimpuitypes.h \
gimpmenu.h \
gimpbrushmenu.h \
gimpdrawablepreview.h \
gimpfontmenu.h \
gimpgradientmenu.h \
gimppalettemenu.h \
......
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimpdrawablepreview.c
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "gimpuitypes.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "gimpdrawablepreview.h"
#include "libgimp-intl.h"
#define PREVIEW_SIZE (128)
static void gimp_drawable_preview_class_init (GimpDrawablePreviewClass *klass);
static void gimp_drawable_preview_init (GimpDrawablePreview *preview);
static void gimp_drawable_preview_update (GimpPreview *preview);
static GimpPreviewClass *parent_class = NULL;
GType
gimp_drawable_preview_get_type (void)
{
static GType drawable_preview_type = 0;
if (!drawable_preview_type)
{
static const GTypeInfo drawable_preview_info =
{
sizeof (GimpDrawablePreviewClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_drawable_preview_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpDrawablePreview),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_drawable_preview_init,
};
drawable_preview_type = g_type_register_static (GIMP_TYPE_PREVIEW,
"GimpDrawablePreview",
&drawable_preview_info, 0);
}
return drawable_preview_type;
}
static void
gimp_drawable_preview_class_init (GimpDrawablePreviewClass *klass)
{
parent_class = g_type_class_peek_parent (klass);
GIMP_PREVIEW_CLASS (klass)->update = gimp_drawable_preview_update;
}
static void
gimp_drawable_preview_init (GimpDrawablePreview *preview)
{
/* */
}
static void
gimp_drawable_preview_update (GimpPreview *preview)
{
guint rowstride;
GimpPixelRgn srcPR;
guchar *buffer;
GimpDrawablePreview *drawable_preview;
g_return_if_fail (GIMP_IS_DRAWABLE_PREVIEW (preview));
drawable_preview = GIMP_DRAWABLE_PREVIEW (preview);
rowstride = preview->width * drawable_preview->drawable->bpp;
buffer = g_new (guchar, rowstride * preview->height);
preview->xoff = CLAMP (preview->xoff,
0, preview->xmax - preview->xmin - preview->width);
preview->yoff = CLAMP (preview->yoff,
0, preview->ymax - preview->ymin - preview->height);
gimp_pixel_rgn_init (&srcPR, drawable_preview->drawable,
preview->xoff + preview->xmin,
preview->yoff + preview->ymin,
preview->width, preview->height,
FALSE, FALSE);
gimp_pixel_rgn_get_rect (&srcPR, buffer,
preview->xoff + preview->xmin,
preview->yoff + preview->ymin,
preview->width, preview->height);
gimp_preview_area_draw (GIMP_PREVIEW_AREA (preview->area),
0, 0, preview->width, preview->height,
gimp_drawable_type (drawable_preview->drawable->drawable_id),
buffer,
rowstride);
g_free (buffer);
}
/**
* gimp_drawable_preview_new:
*
* Creates a new #GimpDrawablePreview widget.
*
* Returns: A pointer to the new #GimpDrawablePreview widget.
**/
GtkWidget *
gimp_drawable_preview_new (GimpDrawable *drawable)
{
GimpDrawablePreview *drawable_preview;
GimpPreview *preview;
gint sel_width, sel_height;
drawable_preview = g_object_new (GIMP_TYPE_DRAWABLE_PREVIEW, NULL);
drawable_preview->drawable = drawable;
preview = GIMP_PREVIEW (drawable_preview);
gimp_drawable_mask_bounds (drawable->drawable_id,
&preview->xmin, &preview->ymin,
&preview->xmax, &preview->ymax);
sel_width = preview->xmax - preview->xmin;
sel_height = preview->ymax - preview->ymin;
preview->width = MIN (sel_width, PREVIEW_SIZE);
preview->height = MIN (sel_height, PREVIEW_SIZE);
gtk_range_set_increments (GTK_RANGE (preview->hscr),
1.0,
MIN (preview->width, sel_width));
gtk_range_set_range (GTK_RANGE (preview->hscr),
0, sel_width-1);
gtk_range_set_increments (GTK_RANGE (preview->vscr),
1.0,
MIN (preview->height, sel_height));
gtk_range_set_range (GTK_RANGE (preview->vscr),
0, sel_height-1);
gtk_widget_set_size_request (preview->area,
preview->width, preview->height);
return GTK_WIDGET (preview);
}
/**
* gimp_drawable_preview_new_with_toggle:
*
* Creates a new #GimpDrawablePreview widget.
*
* Returns: A pointer to the new #GimpDrawablePreview widget.
**/
GtkWidget *
gimp_drawable_preview_new_with_toggle (GimpDrawable *drawable,
gboolean *toggle)
{
GimpDrawablePreview *drawable_preview;
GimpPreview *preview;
gint sel_width, sel_height;
drawable_preview = g_object_new (GIMP_TYPE_DRAWABLE_PREVIEW,
"show_toggle_preview", TRUE,
"update_preview", *toggle,
NULL);
drawable_preview->drawable = drawable;
preview = GIMP_PREVIEW (drawable_preview);
gimp_drawable_mask_bounds (drawable->drawable_id,
&preview->xmin, &preview->ymin,
&preview->xmax, &preview->ymax);
sel_width = preview->xmax - preview->xmin;
sel_height = preview->ymax - preview->ymin;
preview->width = MIN (sel_width, PREVIEW_SIZE);
preview->height = MIN (sel_height, PREVIEW_SIZE);
gtk_range_set_increments (GTK_RANGE (preview->hscr),
1.0,
MIN (preview->width, sel_width));
gtk_range_set_range (GTK_RANGE (preview->hscr),
0, sel_width-1);
gtk_range_set_increments (GTK_RANGE (preview->vscr),
1.0,
MIN (preview->height, sel_height));
gtk_range_set_range (GTK_RANGE (preview->vscr),
0, sel_height-1);
gtk_widget_set_size_request (preview->area,
preview->width, preview->height);
g_signal_connect (preview->toggle_update, "toggled",
G_CALLBACK (gimp_toggle_button_update), toggle);
return GTK_WIDGET (preview);
}
/**
* gimp_drawable_preview_draw:
*
**/
void
gimp_drawable_preview_draw (GimpDrawablePreview *drawable_preview,
guchar *buf)
{
GimpPreview *preview;
g_return_if_fail (GIMP_IS_DRAWABLE_PREVIEW (drawable_preview));
preview = GIMP_PREVIEW (drawable_preview);
gimp_preview_area_draw (GIMP_PREVIEW_AREA (preview->area),
0, 0, preview->width, preview->height,
gimp_drawable_type (drawable_preview->drawable->drawable_id),
buf,
preview->width * drawable_preview->drawable->bpp);
}
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimpdrawablepreview.h
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_DRAWABLE_PREVIEW_H__
#define __GIMP_DRAWABLE_PREVIEW_H__
#include "libgimp/gimp.h"
#include "libgimpwidgets/gimppreview.h"
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#define GIMP_TYPE_DRAWABLE_PREVIEW (gimp_drawable_preview_get_type ())
#define GIMP_DRAWABLE_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DRAWABLE_PREVIEW, GimpDrawablePreview))
#define GIMP_DRAWABLE_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DRAWABLE_PREVIEW, GimpDrawablePreviewClass))
#define GIMP_IS_DRAWABLE_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DRAWABLE_PREVIEW))
#define GIMP_IS_DRAWABLE_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DRAWABLE_PREVIEW))
#define GIMP_DRAWABLE_PREVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DRAWABLE_PREVIEW, GimpDrawablePreviewClass))
typedef struct _GimpDrawablePreviewClass GimpDrawablePreviewClass;
struct _GimpDrawablePreview
{
GimpPreview parent_instance;
GimpDrawable *drawable;
};
struct _GimpDrawablePreviewClass
{
GimpPreviewClass parent_class;
};
GType gimp_drawable_preview_get_type (void) G_GNUC_CONST;
GtkWidget *gimp_drawable_preview_new (GimpDrawable *drawable);
GtkWidget *gimp_drawable_preview_new_with_toggle (GimpDrawable *drawable,
gboolean *toggle);
void gimp_drawable_preview_draw (GimpDrawablePreview *preview,
guchar *buf);
G_END_DECLS
#endif /* __GIMP_DRAWABLE_PREVIEW_H__ */
......@@ -29,6 +29,7 @@
#include <libgimp/gimpexport.h>
#include <libgimp/gimpmenu.h>
#include <libgimp/gimpbrushmenu.h>
#include <libgimp/gimpdrawablepreview.h>
#include <libgimp/gimpfontmenu.h>
#include <libgimp/gimpgradientmenu.h>
#include <libgimp/gimppalettemenu.h>
......
......@@ -118,6 +118,8 @@ libgimpwidgets_2_0_la_sources = \
gimppickbutton.h \
gimppixmap.c \
gimppixmap.h \
gimppreview.c \
gimppreview.h \
gimppreviewarea.c \
gimppreviewarea.h \
gimpquerybox.c \
......@@ -177,6 +179,7 @@ libgimpwidgetsinclude_HEADERS = \
gimppatheditor.h \
gimppickbutton.h \
gimppixmap.h \
gimppreview.h \
gimppreviewarea.h \
gimpquerybox.h \
gimpsizeentry.h \
......
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimppreview.c
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "gimpstock.h"
#include "gimpwidgets.h"
#include "gimppreview.h"
#include "libgimp/libgimp-intl.h"
#define PREVIEW_SIZE (128)
enum
{
UPDATED,
LAST_SIGNAL
};
enum
{
PROP_0,
PROP_UPDATE_PREVIEW,
PROP_SHOW_TOGGLE_PREVIEW
};
static void gimp_preview_class_init (GimpPreviewClass *klass);
static void gimp_preview_init (GimpPreview *preview);
static void gimp_preview_get_property (GObject *object,
guint param_id,
GValue *value,
GParamSpec *pspec);
static void gimp_preview_set_property (GObject *object,
guint param_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_preview_emit_updated (GimpPreview *preview);
static gboolean gimp_preview_button_release (GtkWidget *hs,
GdkEventButton *ev,
GimpPreview *preview);
static void gimp_preview_update (GimpPreview *preview);
static void gimp_preview_area_size_allocate (GimpPreview *preview);
static void gimp_preview_h_scroll (GtkAdjustment *hadj,
GimpPreview *preview);
static void gimp_preview_v_scroll (GtkAdjustment *vadj,
GimpPreview *preview);
static gboolean gimp_preview_area_event (GtkWidget *area,
GdkEvent *event,
GimpPreview *preview);
static void gimp_preview_toggle_callback (GtkWidget *toggle,
GimpPreview *preview);
static guint preview_signals[LAST_SIGNAL] = { 0 };
static GtkTableClass *parent_class = NULL;
GType
gimp_preview_get_type (void)
{
static GType preview_type = 0;
if (!preview_type)
{
static const GTypeInfo preview_info =
{
sizeof (GimpPreviewClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_preview_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpPreview),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_preview_init,
};
preview_type = g_type_register_static (GTK_TYPE_TABLE,
"GimpPreview",
&preview_info,
G_TYPE_FLAG_ABSTRACT);
}
return preview_type;
}
static void
gimp_preview_class_init (GimpPreviewClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
preview_signals[UPDATED] =
g_signal_new ("updated",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpPreviewClass, updated),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
klass->update = NULL;
object_class->get_property = gimp_preview_get_property;
object_class->set_property = gimp_preview_set_property;
g_object_class_install_property (object_class,
PROP_UPDATE_PREVIEW,
g_param_spec_boolean ("update_preview",
NULL, NULL,
TRUE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class,
PROP_SHOW_TOGGLE_PREVIEW,
g_param_spec_boolean ("show_toggle_preview",
NULL, NULL,
FALSE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
}
static void
gimp_preview_init (GimpPreview *preview)
{
GtkWidget *frame;
gint sel_width;
gint sel_height;
preview->xoff = 0;
preview->yoff = 0;
preview->in_drag = FALSE;
preview->update_preview = TRUE;
preview->xmin = preview->ymin = 0;
preview->xmax = preview->ymax = 1;
sel_width = preview->xmax - preview->xmin;
sel_height = preview->ymax - preview->ymin;
preview->width = MIN (sel_width, PREVIEW_SIZE);
preview->height = MIN (sel_height, PREVIEW_SIZE);
gtk_table_resize (GTK_TABLE (preview), 3, 2);
gtk_table_set_homogeneous (GTK_TABLE (preview), FALSE);
preview->hadj = gtk_adjustment_new (0, 0, sel_width - 1, 1.0,
MIN (preview->width, sel_width),
MIN (preview->width, sel_width));
g_signal_connect (preview->hadj, "value_changed",
G_CALLBACK (gimp_preview_h_scroll),
preview);
preview->hscr = gtk_hscrollbar_new (GTK_ADJUSTMENT (preview->hadj));
gtk_range_set_update_policy (GTK_RANGE (preview->hscr),
GTK_UPDATE_CONTINUOUS);
gtk_table_attach (GTK_TABLE (preview), preview->hscr, 0,1, 1,2,
GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
g_signal_connect (preview->hscr, "button-release-event",
G_CALLBACK (gimp_preview_button_release), preview);
gtk_widget_show (preview->hscr);
preview->vadj = gtk_adjustment_new (0, 0, sel_height - 1, 1.0,
MIN (preview->height, sel_height),
MIN (preview->height, sel_height));
g_signal_connect (preview->vadj, "value_changed",
G_CALLBACK (gimp_preview_v_scroll),
preview);
preview->vscr = gtk_vscrollbar_new (GTK_ADJUSTMENT (preview->vadj));
gtk_range_set_update_policy (GTK_RANGE (preview->vscr),
GTK_UPDATE_CONTINUOUS);
gtk_table_attach (GTK_TABLE (preview), preview->vscr, 1,2, 0,1,
GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
g_signal_connect (preview->vscr, "button-release-event",
G_CALLBACK (gimp_preview_button_release), preview);
gtk_widget_show (preview->vscr);
/* the area itself */
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_table_attach (GTK_TABLE (preview), frame,
0,1, 0,1,
GTK_FILL, GTK_FILL, 0,0);
gtk_widget_show (frame);
preview->area = gimp_preview_area_new ();
gtk_widget_set_size_request (preview->area,
preview->width, preview->height);
gtk_container_add (GTK_CONTAINER (frame), preview->area);
gtk_widget_set_events (preview->area,
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_MOTION_MASK);
g_signal_connect (preview->area, "event",
G_CALLBACK (gimp_preview_area_event), preview);
gtk_widget_show (preview->area);
g_signal_connect_swapped (preview->area, "size_allocate",
G_CALLBACK (gimp_preview_area_size_allocate),
preview);
/* a toggle button to (des)activate the instant preview */
preview->toggle_update = gtk_check_button_new_with_mnemonic (_("_Preview"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (preview->toggle_update),
preview->update_preview);
gtk_table_attach (GTK_TABLE (preview), preview->toggle_update,
0, 1, 2, 3, GTK_FILL, GTK_FILL, 0, 0);
g_signal_connect_after (preview->toggle_update, "toggled",
G_CALLBACK (gimp_preview_toggle_callback),
preview);
}
static void
gimp_preview_get_property (GObject *object,
guint param_id,
GValue *value,
GParamSpec *pspec)
{
GimpPreview *preview = GIMP_PREVIEW (object);
switch (param_id)
{
case PROP_UPDATE_PREVIEW:
g_value_set_boolean (value, &preview->update_preview);
break;
case PROP_SHOW_TOGGLE_PREVIEW:
g_value_set_boolean (value, GTK_WIDGET_VISIBLE (preview->toggle_update));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
}
}
static void
gimp_preview_set_property (GObject *object,
guint param_id,
const GValue *value,
GParamSpec *pspec)
{
GimpPreview *preview = GIMP_PREVIEW (object);
switch (param_id)
{
case PROP_UPDATE_PREVIEW:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (preview->toggle_update),
g_value_get_boolean (value));
break;
case PROP_SHOW_TOGGLE_PREVIEW:
if (g_value_get_boolean (value))
gtk_widget_show (preview->toggle_update);
else
gtk_widget_hide (preview->toggle_update);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
}
}
static void
gimp_preview_emit_updated (GimpPreview *preview)
{
g_return_if_fail (GIMP_IS_PREVIEW (preview));
if (preview->update_preview)
g_signal_emit (preview, preview_signals[UPDATED], 0);
}
static gboolean
gimp_preview_button_release (GtkWidget *hs,
GdkEventButton *ev,
GimpPreview *preview)
{
g_return_val_if_fail (GIMP_IS_PREVIEW (preview), FALSE);
gimp_preview_emit_updated (preview);
return FALSE;
}
static void
gimp_preview_update (GimpPreview *preview)
{
GimpPreviewClass *class;
g_return_if_fail (GIMP_IS_PREVIEW (preview));
class = GIMP_PREVIEW_GET_CLASS (preview);
if (class->update)
class->update (preview);
}
static void
gimp_preview_area_size_allocate (GimpPreview *preview)
{
g_return_if_fail (GIMP_IS_PREVIEW (preview));
gimp_preview_update (preview);
gimp_preview_emit_updated (preview);
}
static void
gimp_preview_h_scroll (GtkAdjustment *hadj, GimpPreview *preview)
{
g_return_if_fail (GIMP_IS_PREVIEW (preview));
preview->xoff = hadj->value;
if (!preview->in_drag)
gimp_preview_update (preview);
}
static void
gimp_preview_v_scroll (GtkAdjustment *vadj, GimpPreview *preview)
{
g_return_if_fail (GIMP_IS_PREVIEW (preview));
preview->yoff = vadj->value;
if (!preview->in_drag)
gimp_preview_update (preview);
}
static gboolean
gimp_preview_area_event (GtkWidget *area,
GdkEvent *event,
GimpPreview *preview)
{
GdkEventButton *button_event;
gint x, y;
gint dx, dy;
g_return_val_if_fail (GIMP_IS_PREVIEW (preview), FALSE);
button_event = (GdkEventButton *) event;
switch (event->type)
{
case GDK_BUTTON_PRESS: